| 545 | } |
| 546 | |
| 547 | void PhysicsDebris::prepRenderImage( SceneRenderState *state ) |
| 548 | { |
| 549 | if( !mShapeInstance ) |
| 550 | return; |
| 551 | |
| 552 | // Skip shadow rendering if this debris doesn't support it. |
| 553 | if ( state->isShadowPass() && |
| 554 | !mDataBlock->castShadows ) |
| 555 | return; |
| 556 | |
| 557 | // If the debris is completed LOD'd out then skip it. |
| 558 | if ( mShapeInstance->setDetailFromPosAndScale( state, getRenderPosition(), getScale() ) < 0 ) |
| 559 | return; |
| 560 | |
| 561 | // Fade out the debris over the last second of its lifetime. |
| 562 | F32 alpha = 1.0; |
| 563 | if ( mDataBlock->lifetime > 0.0f ) |
| 564 | alpha = getMin( mLifetime * smLifetimeScale, 1.0f ); |
| 565 | |
| 566 | // Set up our TS render state. |
| 567 | TSRenderState rdata; |
| 568 | rdata.setSceneState( state ); |
| 569 | rdata.setFadeOverride( alpha ); |
| 570 | |
| 571 | // We might have some forward lit materials |
| 572 | // so pass down a query to gather lights. |
| 573 | LightQuery query; |
| 574 | query.init( getWorldSphere() ); |
| 575 | rdata.setLightQuery( &query ); |
| 576 | |
| 577 | GFXTransformSaver saver; |
| 578 | |
| 579 | MatrixF mat = getRenderTransform(); |
| 580 | mat.scale( getScale() ); |
| 581 | GFX->setWorldMatrix( mat ); |
| 582 | |
| 583 | mShapeInstance->animate(); |
| 584 | mShapeInstance->render( rdata ); |
| 585 | } |
| 586 | |
| 587 | void PhysicsDebris::applyImpulse( const Point3F &pos, const VectorF &vec ) |
| 588 | { |
nothing calls this directly
no test coverage detected