Game Development Community

BUG FIX: No cubemaps in show tool

by David Wyand · in Torque Game Engine Advanced · 09/28/2004 (7:58 pm) · 0 replies

Greetings!

While working away on some...ahem...show tool goodness, I've discovered that the existing show tool does not show static cube maps (dynamic cube maps are another matter). Here's a fix!

Open up materials/materials.cpp and head to the Material::setStageData() method. At the bottom of the function, add the following (changes are in bold):

[b]   //*** DAW: Added for show tool
   if( !mCubemapData && cubemapName != NULL)
   {
      mCubemapData = static_cast<CubemapData*>(Sim::findObject( cubemapName ) );
   }[/b]

   if( mCubemapData )
   {
      mCubemapData->createMap();
      stages[0].cubemap = mCubemapData->cubemap;
   }

This initialization is normally done in the unpackData() method, but as the show tool doesn't actually make use of datablocks in the normal, game sense, we need to do this manually. This is very similar to the glow buffer's init() method.

Enjoy!

- LightWave Dave

About the author

A long time Associate of the GarageGames' community and author of the Torque 3D Game Development Cookbook. Buy it today from Packt Publishing!