mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-24 22:05:40 +00:00
Merge pull request #1442 from Azaezel/shadow_caching
This all seems to work pretty well.
This commit is contained in:
commit
92aa785bb2
61 changed files with 1490 additions and 466 deletions
|
|
@ -60,6 +60,8 @@ LightBase::LightBase()
|
|||
mColor( ColorF::WHITE ),
|
||||
mBrightness( 1.0f ),
|
||||
mCastShadows( false ),
|
||||
mStaticRefreshFreq( 250 ),
|
||||
mDynamicRefreshFreq( 8 ),
|
||||
mPriority( 1.0f ),
|
||||
mAnimationData( NULL ),
|
||||
mFlareData( NULL ),
|
||||
|
|
@ -90,6 +92,8 @@ void LightBase::initPersistFields()
|
|||
addField( "color", TypeColorF, Offset( mColor, LightBase ), "Changes the base color hue of the light." );
|
||||
addField( "brightness", TypeF32, Offset( mBrightness, LightBase ), "Adjusts the lights power, 0 being off completely." );
|
||||
addField( "castShadows", TypeBool, Offset( mCastShadows, LightBase ), "Enables/disabled shadow casts by this light." );
|
||||
addField( "staticRefreshFreq", TypeS32, Offset( mStaticRefreshFreq, LightBase ), "static shadow refresh rate (milliseconds)" );
|
||||
addField( "dynamicRefreshFreq", TypeS32, Offset( mDynamicRefreshFreq, LightBase ), "dynamic shadow refresh rate (milliseconds)" );
|
||||
addField( "priority", TypeF32, Offset( mPriority, LightBase ), "Used for sorting of lights by the light manager. "
|
||||
"Priority determines if a light has a stronger effect than, those with a lower value" );
|
||||
|
||||
|
|
@ -277,6 +281,8 @@ U32 LightBase::packUpdate( NetConnection *conn, U32 mask, BitStream *stream )
|
|||
stream->write( mBrightness );
|
||||
|
||||
stream->writeFlag( mCastShadows );
|
||||
stream->write(mStaticRefreshFreq);
|
||||
stream->write(mDynamicRefreshFreq);
|
||||
|
||||
stream->write( mPriority );
|
||||
|
||||
|
|
@ -322,6 +328,8 @@ void LightBase::unpackUpdate( NetConnection *conn, BitStream *stream )
|
|||
stream->read( &mColor );
|
||||
stream->read( &mBrightness );
|
||||
mCastShadows = stream->readFlag();
|
||||
stream->read(&mStaticRefreshFreq);
|
||||
stream->read(&mDynamicRefreshFreq);
|
||||
|
||||
stream->read( &mPriority );
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,8 @@ protected:
|
|||
F32 mBrightness;
|
||||
|
||||
bool mCastShadows;
|
||||
|
||||
S32 mStaticRefreshFreq;
|
||||
S32 mDynamicRefreshFreq;
|
||||
F32 mPriority;
|
||||
|
||||
LightInfo *mLight;
|
||||
|
|
|
|||
|
|
@ -36,6 +36,8 @@ LightDescription::LightDescription()
|
|||
brightness( 1.0f ),
|
||||
range( 5.0f ),
|
||||
castShadows( false ),
|
||||
mStaticRefreshFreq( 250 ),
|
||||
mDynamicRefreshFreq( 8 ),
|
||||
animationData( NULL ),
|
||||
animationDataId( 0 ),
|
||||
animationPeriod( 1.0f ),
|
||||
|
|
@ -94,6 +96,8 @@ void LightDescription::initPersistFields()
|
|||
addField( "brightness", TypeF32, Offset( brightness, LightDescription ), "Adjusts the lights power, 0 being off completely." );
|
||||
addField( "range", TypeF32, Offset( range, LightDescription ), "Controls the size (radius) of the light" );
|
||||
addField( "castShadows", TypeBool, Offset( castShadows, LightDescription ), "Enables/disabled shadow casts by this light." );
|
||||
addField( "staticRefreshFreq", TypeS32, Offset( mStaticRefreshFreq, LightDescription ), "static shadow refresh rate (milliseconds)" );
|
||||
addField( "dynamicRefreshFreq", TypeS32, Offset( mDynamicRefreshFreq, LightDescription ), "dynamic shadow refresh rate (milliseconds)" );
|
||||
|
||||
endGroup( "Light" );
|
||||
|
||||
|
|
@ -153,6 +157,8 @@ void LightDescription::packData( BitStream *stream )
|
|||
stream->write( brightness );
|
||||
stream->write( range );
|
||||
stream->writeFlag( castShadows );
|
||||
stream->write(mStaticRefreshFreq);
|
||||
stream->write(mDynamicRefreshFreq);
|
||||
|
||||
stream->write( animationPeriod );
|
||||
stream->write( animationPhase );
|
||||
|
|
@ -181,6 +187,8 @@ void LightDescription::unpackData( BitStream *stream )
|
|||
stream->read( &brightness );
|
||||
stream->read( &range );
|
||||
castShadows = stream->readFlag();
|
||||
stream->read(&mStaticRefreshFreq);
|
||||
stream->read(&mDynamicRefreshFreq);
|
||||
|
||||
stream->read( &animationPeriod );
|
||||
stream->read( &animationPhase );
|
||||
|
|
@ -200,6 +208,8 @@ void LightDescription::submitLight( LightState *state, const MatrixF &xfm, Light
|
|||
li->setRange( range );
|
||||
li->setColor( color );
|
||||
li->setCastShadows( castShadows );
|
||||
li->setStaticRefreshFreq(mStaticRefreshFreq);
|
||||
li->setDynamicRefreshFreq(mDynamicRefreshFreq);
|
||||
li->setTransform( xfm );
|
||||
|
||||
if ( animationData )
|
||||
|
|
|
|||
|
|
@ -101,6 +101,8 @@ public:
|
|||
F32 brightness;
|
||||
F32 range;
|
||||
bool castShadows;
|
||||
S32 mStaticRefreshFreq;
|
||||
S32 mDynamicRefreshFreq;
|
||||
|
||||
LightAnimData *animationData;
|
||||
S32 animationDataId;
|
||||
|
|
|
|||
|
|
@ -116,6 +116,8 @@ void PointLight::_conformLights()
|
|||
|
||||
mLight->setBrightness( mBrightness );
|
||||
mLight->setCastShadows( mCastShadows );
|
||||
mLight->setStaticRefreshFreq(mStaticRefreshFreq);
|
||||
mLight->setDynamicRefreshFreq(mDynamicRefreshFreq);
|
||||
mLight->setPriority( mPriority );
|
||||
|
||||
// Update the bounds and scale to fit our light.
|
||||
|
|
|
|||
|
|
@ -122,6 +122,8 @@ void SpotLight::_conformLights()
|
|||
mLight->setColor( mColor );
|
||||
mLight->setBrightness( mBrightness );
|
||||
mLight->setCastShadows( mCastShadows );
|
||||
mLight->setStaticRefreshFreq(mStaticRefreshFreq);
|
||||
mLight->setDynamicRefreshFreq(mDynamicRefreshFreq);
|
||||
mLight->setPriority( mPriority );
|
||||
|
||||
mOuterConeAngle = getMax( 0.01f, mOuterConeAngle );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue