-------------------------------------------------------------------------- Make the explosion face the viewer (if desired) --------------------------------------------------------------------------
| 1016 | // Make the explosion face the viewer (if desired) |
| 1017 | //-------------------------------------------------------------------------- |
| 1018 | void Explosion::prepModelView(SceneRenderState* state) |
| 1019 | { |
| 1020 | MatrixF rotMatrix( true ); |
| 1021 | Point3F targetVector; |
| 1022 | |
| 1023 | if( mDataBlock->faceViewer ) |
| 1024 | { |
| 1025 | targetVector = getPosition() - state->getCameraPosition(); |
| 1026 | targetVector.normalize(); |
| 1027 | |
| 1028 | // rotate explosion each time so it's a little different |
| 1029 | rotMatrix.set( EulerF( 0.0f, mRandAngle, 0.0f ) ); |
| 1030 | } |
| 1031 | else |
| 1032 | { |
| 1033 | targetVector = mInitialNormal; |
| 1034 | } |
| 1035 | |
| 1036 | MatrixF explOrient = MathUtils::createOrientFromDir( targetVector ); |
| 1037 | explOrient.mul( rotMatrix ); |
| 1038 | explOrient.setPosition( getPosition() ); |
| 1039 | |
| 1040 | setCurrentScale(); |
| 1041 | explOrient.scale( mObjScale ); |
| 1042 | GFX->setWorldMatrix( explOrient ); |
| 1043 | } |
| 1044 | |
| 1045 | //-------------------------------------------------------------------------- |
| 1046 | // Render object |
nothing calls this directly
no test coverage detected