clean up the light.cookie entries

This commit is contained in:
AzaezelX 2021-07-22 11:57:41 -05:00
parent 059fb63487
commit c41b8e00ff
2 changed files with 11 additions and 10 deletions

View file

@ -542,6 +542,7 @@ ShadowMapParams::ShadowMapParams( LightInfo *light )
fadeStartDist = 75.0f; fadeStartDist = 75.0f;
lastSplitTerrainOnly = false; lastSplitTerrainOnly = false;
mQuery = GFX->createOcclusionQuery(); mQuery = GFX->createOcclusionQuery();
cookie = StringTable->EmptyString();;
_validate(); _validate();
} }
@ -647,15 +648,15 @@ LightShadowMap* ShadowMapParams::getOrCreateShadowMap()
GFXTextureObject* ShadowMapParams::getCookieTex() GFXTextureObject* ShadowMapParams::getCookieTex()
{ {
if ( cookie.isNotEmpty() && if ( hasCookieTex() &&
( mCookieTex.isNull() || ( mCookieTex.isNull() ||
cookie != mCookieTex->getPath() ) ) cookie != StringTable->insert(mCookieTex->getPath().c_str()) ) )
{ {
mCookieTex.set( cookie, mCookieTex.set( cookie,
&GFXStaticTextureSRGBProfile, &GFXStaticTextureSRGBProfile,
"ShadowMapParams::getCookieTex()" ); "ShadowMapParams::getCookieTex()" );
} }
else if ( cookie.isEmpty() ) else if (!hasCookieTex())
mCookieTex = NULL; mCookieTex = NULL;
return mCookieTex.getPointer(); return mCookieTex.getPointer();
@ -663,13 +664,13 @@ GFXTextureObject* ShadowMapParams::getCookieTex()
GFXCubemap* ShadowMapParams::getCookieCubeTex() GFXCubemap* ShadowMapParams::getCookieCubeTex()
{ {
if ( cookie.isNotEmpty() && if ( hasCookieTex() &&
( mCookieCubeTex.isNull() || ( mCookieCubeTex.isNull() ||
cookie != mCookieCubeTex->getPath() ) ) cookie != StringTable->insert(mCookieTex->getPath().c_str())) )
{ {
mCookieCubeTex.set( cookie ); mCookieCubeTex.set( cookie );
} }
else if ( cookie.isEmpty() ) else if (!hasCookieTex())
mCookieCubeTex = NULL; mCookieCubeTex = NULL;
return mCookieCubeTex.getPointer(); return mCookieCubeTex.getPointer();
@ -693,7 +694,7 @@ void ShadowMapParams::packUpdate( BitStream *stream ) const
stream->write( texSize ); stream->write( texSize );
stream->write( cookie ); stream->writeString( cookie );
stream->write( numSplits ); stream->write( numSplits );
stream->write( logWeight ); stream->write( logWeight );
@ -723,7 +724,7 @@ void ShadowMapParams::unpackUpdate( BitStream *stream )
stream->read( &texSize ); stream->read( &texSize );
stream->read( &cookie ); cookie = stream->readSTString();
stream->read( &numSplits ); stream->read( &numSplits );
stream->read( &logWeight ); stream->read( &logWeight );

View file

@ -288,7 +288,7 @@ public:
LightShadowMap* getOrCreateShadowMap(); LightShadowMap* getOrCreateShadowMap();
bool hasCookieTex() const { return cookie.isNotEmpty(); } bool hasCookieTex() const { return cookie != StringTable->EmptyString(); }
GFXOcclusionQuery* getOcclusionQuery() const { return mQuery; } GFXOcclusionQuery* getOcclusionQuery() const { return mQuery; }
@ -325,7 +325,7 @@ public:
U32 texSize; U32 texSize;
/// ///
FileName cookie; StringTableEntry cookie;
/// @} /// @}