MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / prepModelView

Method prepModelView

Engine/source/T3D/fx/explosion.cpp:1169–1194  ·  view source on GitHub ↗

-------------------------------------------------------------------------- Make the explosion face the viewer (if desired) --------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1167// Make the explosion face the viewer (if desired)
1168//--------------------------------------------------------------------------
1169void 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

Callers

nothing calls this directly

Calls 8

getPositionFunction · 0.85
createOrientFromDirFunction · 0.85
normalizeMethod · 0.45
setMethod · 0.45
mulMethod · 0.45
setPositionMethod · 0.45
scaleMethod · 0.45
setWorldMatrixMethod · 0.45

Tested by

no test coverage detected