Game Development Community

StaticShape shadows - Universal?

by Nicolai Dutka · in Torque Game Engine Advanced · 06/01/2009 (9:30 am) · 6 replies

Is there a way to make ALL static shapes have shadows rather than declaring them "per datablock"?

Currently, I am making a separate datablock for every single object in my game...

datablock staticShapeData( CargoTruckClosedStatic )
{
   category = "StaticShape";
   shapeFile = "~/data/shapes/vehicles/cargoTruck_closed.dts";
   emap = true;
   allowPlayerStep = 1;
   shadowEnable ="1";
   shadowCanMove="0";
   shadowSelfShadow ="1";
   shadowDTSShadow ="1";
   shadowSize ="256";
   shadowMaxVisibleDistance ="85";
   shadowProjectionDistance ="100";
};

Just wondering if I can stick this somewhere in ONE SPOT that will effect ALL my static shapes?

#1
06/01/2009 (9:47 am)
You can use your conditions directly into the StaticShapeData constructor.
And compile.
Then each StaticShape will have your shadow options.
#2
06/01/2009 (9:54 am)
Ok, I'm not too savvy with the engine code yet.. Am I editing the basicLightManager.cpp and just adding StaticShapeData to the type mask?
#3
06/01/2009 (9:57 am)
staticShape.cpp

StaticShapeData::StaticShapeData()
{
.....
   shadowEnable = true;
   shadowCanMove = false;
   shadowSelfShadow = true;
   shadowDTSShadow = true;
   shadowSize = 256;
   shadowMaxVisibleDistance = 85.0f;
   shadowProjectionDistance = 100.0f;

}
#4
06/01/2009 (10:25 am)
Alternatively you could also make a base datablock and have all of your other static shape datablocks inherit from it. Something like this:

datablock staticShapeData( StaticBase )
{
   category = "StaticShape";
   emap = true;
   allowPlayerStep = 1;
   shadowEnable ="1";
   shadowCanMove="0";
   shadowSelfShadow ="1";
   shadowDTSShadow ="1";
   shadowSize ="256";
   shadowMaxVisibleDistance ="85";
   shadowProjectionDistance ="100";
};

datablock staticShapeData( CargoTruckClosedStatic: StaticBase )
{
   shapeFile = "~/data/shapes/vehicles/cargoTruck_closed.dts";
};

datablock staticShapeData( SomethingElseStatic: StaticBase )
{
   shapeFile = "~/data/shapes/vehicles/somethingelse.dts";
};

...


#5
06/01/2009 (10:25 am)
Works great! And how!! :P

Is there a way to get this same concept applied to TSSTatics? I'm still having to make all my objects into static shapes which requires them to have a datablock and all those extra datablocks are killing my load times...
#6
06/01/2009 (10:30 am)
TSStatic objects are SceneObject derived and they don't have a datablock interface.
Your shadow options can be applied to ShapeBase derived objects.