Game Development Community

$pref::shadows = "2";

by Howard Dortch · in Torque Game Engine · 09/21/2004 (6:17 pm) · 3 replies

Can anyone tell me what numbers I can use here and what they do?

#1
09/21/2004 (7:10 pm)
It appears the value is intended to be a float from 0.0 to 1.0. shapeBase derived class objects have two values, genericShadowLevel and noShadowLevel. Those values are compared against the value represented by $pref::shadows to determine what, if any, shadow to draw for an object.

If $pref::shadows > genericShadowLevel, then the full shadow is drawn.
If $pref::shadows > noShadowLevel but < genericShadowLevel, then some kind of global shadow is used instead of calculating the shadow.
And if $pref::shadows < noShadowLevel, as you can guess no shadow at all is drawn.

$pref::shadows is actually set when the consoleMethod setShadowDetailLevel is called.

The values aren't set via script, they're set in shapeBase.h:

#define Player_GenericShadowLevel 0.4f
#define Player_NoShadowLevel 0.01f
#define Vehicle_GenericShadowLevel 0.7f
#define Vehicle_NoShadowLevel 0.2f
#define Item_GenericShadowLevel 0.4f
#define Item_NoShadowLevel 0.01f
#define StaticShape_GenericShadowLevel 2.0f
#2
09/21/2004 (7:26 pm)
It appears the value is intended to be a float from 0.0 to 1.0
All the examples show this value to be a 2. So by doing this then $pref::shadows > genericShadowLevel is true and I get full shadow?
#3
09/21/2004 (8:15 pm)
In theory, yes. I just noticed the StaticShape genericshadowlevel is at 2.0 (which contradicts the comment in the source that says ShadowDetailLevel should be between 0 and 1), which suggests that if you set it at 2.0 (or perhaps 2.1; all the comparisons I recall seeing weren't less-than/equal to, they were just less-than) then even StaticShapes will have real shadows. But this assumes that the underlying calls to 'renderShadow' and such are enabled for StaticShapes, and that somewhere in the code the ShadowLevelDetail (e.g. $prefs::shadow) isn't getting capped at 1.0f...