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

Method update

Engine/source/lighting/common/projectedShadow.cpp:401–435  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

399}
400
401void ProjectedShadow::update( const SceneRenderState *state )
402{
403 mUpdateTexture = true;
404
405 // Set the decal lod settings.
406 mDecalData->fadeStartPixelSize = smFadeStartPixelSize;
407 mDecalData->fadeEndPixelSize = smFadeEndPixelSize;
408
409 // Update our decal before
410 // we render to texture.
411 // If it fails, something bad happened
412 // (no light to grab/failed clip) and we should return.
413 if ( !_updateDecal( state ) )
414 {
415 // Release our shadow texture
416 // so that others can grab it out
417 // of the pool.
418 mShadowTexture = NULL;
419 mUpdateTexture = false;
420 return;
421 }
422
423 _calcScore( state );
424
425 if ( !mCasterPositionSC || !mCasterPositionSC->isValid() )
426 mCasterPositionSC = mDecalData->matInst->getMaterialParameterHandle( "$shadowCasterPosition" );
427
428 if ( !mShadowLengthSC || !mShadowLengthSC->isValid() )
429 mShadowLengthSC = mDecalData->matInst->getMaterialParameterHandle( "$shadowLength" );
430
431 MaterialParameters *matParams = mDecalData->matInst->getMaterialParameters();
432
433 matParams->setSafe( mCasterPositionSC, mParentObject->getRenderPosition() );
434 matParams->setSafe( mShadowLengthSC, mShadowLength / 4.0f );
435}
436
437void ProjectedShadow::render( F32 camDist, const TSRenderState &rdata )
438{

Callers 2

updateShadowMethod · 0.45

Calls 5

getRenderPositionMethod · 0.80
isValidMethod · 0.45
getMaterialParametersMethod · 0.45
setSafeMethod · 0.45

Tested by

no test coverage detected