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