ReflectionManager.cpp in 1.1 Final (and probably all other versions) - LOGGED (THREED-3170)
by John "Mythic" Henry · in Torque 3D Professional · 06/04/2011 (9:44 am) · 1 replies
Ran into this as I was integrating my Tank system into 1.1 Final
in reflectionManager.cpp it gathers metrics for when we want to see
how the engine is doing with our design. Nothing wrong with that,
as we could turn it off for release builds.
The thing I noticed was part of the code was basically
left On and only part was shut Off.
Thus it was looping thru the relectors for visibles
even when it didn't need to?
relevant code section with it modified:
I simply moved the Define up a little further as it doesnt Change anything
except to clear out 2 UnRefenced Variable warnings with metrics turned off.
I tend to think in terms of best speed for the game and try to avoid any
excess overhead :)
in reflectionManager.cpp it gathers metrics for when we want to see
how the engine is doing with our design. Nothing wrong with that,
as we could turn it off for release builds.
The thing I noticed was part of the code was basically
left On and only part was shut Off.
Thus it was looping thru the relectors for visibles
even when it didn't need to?
relevant code section with it modified:
// Mythic DEBUG -->
// This was Iterating thru the Reflectors to gather
// Metrics even when we did NOT want it too...
//
#ifdef TORQUE_GATHER_METRICS
// Set metric/debug related script variables...
U32 totalElapsed = mTimer->getElapsedMs();
U32 numEnabled = mReflectors.size();
U32 numVisible = 0;
U32 numOccluded = 0;
reflectorIter = mReflectors.begin();
for ( ; reflectorIter != mReflectors.end(); reflectorIter++ )
{
ReflectorBase *pReflector = (*reflectorIter);
if ( pReflector->isOccluded() )
numOccluded++;
else
numVisible++;
}
//#ifdef TORQUE_GATHER_METRICS
// Mythic DEBUG <--
const GFXTextureProfileStats &stats = ReflectRenderTargetProfile.getStats();
F32 mb = ( stats.activeBytes / 1024.0f ) / 1024.0f;
char temp[256];
dSprintf( temp, 256, "%s %d %0.2fn",
ReflectRenderTargetProfile.getName().c_str(),
stats.activeCount,
mb );
Con::setVariable( "$Reflect::textureStats", temp );
Con::setIntVariable( "$Reflect::renderTargetsAllocated", stats.allocatedTextures );
Con::setIntVariable( "$Reflect::poolSize", stats.activeCount );
Con::setIntVariable( "$Reflect::numObjects", numEnabled );
Con::setIntVariable( "$Reflect::numVisible", numVisible );
Con::setIntVariable( "$Reflect::numOccluded", numOccluded );
Con::setIntVariable( "$Reflect::numUpdated", numUpdated );
Con::setIntVariable( "$Reflect::elapsed", totalElapsed );
#endif
}I simply moved the Define up a little further as it doesnt Change anything
except to clear out 2 UnRefenced Variable warnings with metrics turned off.
I tend to think in terms of best speed for the game and try to avoid any
excess overhead :)
About the author
Associate David Montgomery-Blake
David MontgomeryBlake