| 399 | } |
| 400 | |
| 401 | void 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 | |
| 437 | void ProjectedShadow::render( F32 camDist, const TSRenderState &rdata ) |
| 438 | { |
no test coverage detected