Game Development Community

T3D 1.0.1 - ChunkedBitmap Controls not tiling when "Tile" checked - LOGGED

by Thomas -elfprince13- Dickerson · in Torque 3D Professional · 03/12/2011 (11:06 pm) · 2 replies

Build: 1.0.1
Platform: Mac OS X 10.6.6
Target: GUI Editor

Issues: Checking "tile" for a ChunkedBitmap control does not appear to affect whether the bitmap is rendered in stretch-to-fit or tiled mode.

Steps to repeat:
1. Create an 800x800 image to be used as a texture.
2. Edit the MainMenuGui (with the root GuiChunkedBitmapControl set to dimensions of 1024x768, and the gaming running in 1024x768) so that the "Tile" property is enabled, and the 800x800 image is selected as the bitmap.
3. Observe that adjusting tile has no effect.

Suggested Fix:
void GuiChunkedBitmapCtrl::onRender(Point2I offset, const RectI &updateRect)
{

   if( mTexHandle )
   {
	   if(mTile)
	   {
		   GFXTextureObject* gto = mTexHandle;
		   for(int stepy = 0; offset.y + stepy < getExtent().y; stepy += gto->getBitmapHeight())
		   {
			   for(int stepx = 0; offset.x + stepx < getExtent().x; stepx += gto->getBitmapWidth())
			   {
				   RectI boundsRect( Point2I(offset.x+stepx,offset.y+stepy), Point2I(gto->getBitmapWidth(), gto->getBitmapHeight()));
				   GFX->getDrawUtil()->drawBitmapStretch( mTexHandle, boundsRect, GFXBitmapFlip_None, GFXTextureFilterLinear );
 
			   }
				   
		   }
	   } else{
		   
		   RectI boundsRect( offset, getExtent());
		   GFX->getDrawUtil()->drawBitmapStretch( mTexHandle, boundsRect, GFXBitmapFlip_None, GFXTextureFilterLinear );
	   }
   }

   renderChildControls(offset, updateRect);
}

About the author

C.S. PhD student at Brown University. Project lead for FreeBuild. Administrator, Cemetech tech community. Webmaster for the Village2Village Projects and the Vermont Sustainable Heating Initiative.


#1
03/15/2011 (11:45 pm)
Greetings!

Logged as THREED-1475. Thanks!

- Dave
#2
03/15/2011 (11:53 pm)
No problem. I guess not many people other than myself make GUI elements that tile rather than stretch!