MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / _calcScore

Method _calcScore

Engine/source/lighting/common/projectedShadow.cpp:378–399  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

376}
377
378void ProjectedShadow::_calcScore( const SceneRenderState *state )
379{
380 if ( !mDecalInstance )
381 return;
382
383 F32 pixRadius = mDecalInstance->calcPixelSize( state->getViewport().extent.y, state->getCameraPosition(), state->getWorldToScreenScale().y );
384
385 F32 pct = pixRadius / mDecalInstance->mDataBlock->fadeStartPixelSize;
386
387 U32 msSinceLastRender = Platform::getVirtualMilliseconds() - getLastRenderTime();
388
389 ShapeBaseData *data = NULL;
390 if ( mShapeBase )
391 data = static_cast<ShapeBaseData*>( mShapeBase->getDataBlock() );
392
393 // For every 1s this shadow hasn't been
394 // updated we'll add 10 to the score.
395 F32 secs = mFloor( (F32)msSinceLastRender / 1000.0f );
396
397 mScore = pct + secs;
398 mClampF( mScore, 0.0f, 2000.0f );
399}
400
401void ProjectedShadow::update( const SceneRenderState *state )
402{

Callers

nothing calls this directly

Calls 5

mFloorFunction · 0.85
mClampFFunction · 0.85
calcPixelSizeMethod · 0.80
getWorldToScreenScaleMethod · 0.80
getDataBlockMethod · 0.45

Tested by

no test coverage detected