Game Development Community

Image mapping onto terrain to highlight players etc.

by Phil Mundy · in Torque Game Engine · 09/01/2006 (3:30 am) · 1 replies

Hey folks, I'm looking to make some changes to the selection ring which surrounds a selected player in the RTS Starter Kit. I'm not sure whether this is in the normal Torque stuff but I assume it is.

The following code is the only place I have found "starter.RTS/client/ui/ring_white" used (which is the image used to highlight the selected players), and the TextureHandle it is bound to is never called anywhere else as far as I have found.

Basically I would like to know where the texture is used to select the players, or how....

Hope anyone can shed some light on this.


Code from onAdd() function in "\engine\terrain\terrData.cc".

//------------------------------------------------------------------------------

bool TerrainBlock::onAdd()
{

.....

.....

.....

.....


//CW - end bump mapping stuff
      lightMap = new GBitmap(LightmapSize, LightmapSize, false, GBitmap::RGB5551);

      if (!buildMaterialMap())
         return false;

      mTextureCallbackKey = TextureManager::registerEventCallback(terrainTextureEventCB, this);

      mDynLightTexture = TextureHandle("common/lighting/lightFalloffMono", BitmapTexture, true);
[b][i]      mSelectionTexture = TextureHandle("starter.RTS/client/ui/ring_white", BitmapTexture, true);[/i][/b]

      if (dglDoesSupportVertexBuffer())
         mVertexBuffer = glAllocateVertexBufferEXT(VertexBufferSize,GL_V12MTVFMT_EXT,true);
      else
         mVertexBuffer = -1;
   }
   else
      mCRC = terr.getCRC();

   addToScene();

   if(!unpackEmptySquares())
      return(false);

   return true;
}

#1
09/01/2006 (7:30 am)
Ok, I've found where you can edit things like the size and colour of the texture to be drawna and set it to recieve different colours from the datablocks of the different unit types.

I want to now make it so I can edit the image to be rendered underneath them. I'll try just reloading the texture to something else, but I really want a seperateTextureHandle for the different image.