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

Method prepModelView

Engine/source/T3D/fx/explosion.cpp:1018–1043  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1016// Make the explosion face the viewer (if desired)
1017//--------------------------------------------------------------------------
1018void 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

Callers

nothing calls this directly

Calls 7

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