-------------------------------------------------------------------------- Make the explosion face the viewer (if desired) --------------------------------------------------------------------------
| 1167 | // Make the explosion face the viewer (if desired) |
| 1168 | //-------------------------------------------------------------------------- |
| 1169 | void Explosion::prepModelView(SceneRenderState* state) |
| 1170 | { |
| 1171 | MatrixF rotMatrix( true ); |
| 1172 | Point3F targetVector; |
| 1173 | |
| 1174 | if( mDataBlock->faceViewer ) |
| 1175 | { |
| 1176 | targetVector = getPosition() - state->getCameraPosition(); |
| 1177 | targetVector.normalize(); |
| 1178 | |
| 1179 | // rotate explosion each time so it's a little different |
| 1180 | rotMatrix.set( EulerF( 0.0f, mRandAngle, 0.0f ) ); |
| 1181 | } |
| 1182 | else |
| 1183 | { |
| 1184 | targetVector = mInitialNormal; |
| 1185 | } |
| 1186 | |
| 1187 | MatrixF explOrient = MathUtils::createOrientFromDir( targetVector ); |
| 1188 | explOrient.mul( rotMatrix ); |
| 1189 | explOrient.setPosition( getPosition() ); |
| 1190 | |
| 1191 | setCurrentScale(); |
| 1192 | explOrient.scale( mObjScale ); |
| 1193 | GFX->setWorldMatrix( explOrient ); |
| 1194 | } |
| 1195 | |
| 1196 | //-------------------------------------------------------------------------- |
| 1197 | // Render object |
nothing calls this directly
no test coverage detected