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

Method prepRenderImage

Engine/source/T3D/physics/physicsShape.cpp:1049–1088  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1047}
1048
1049void PhysicsShape::prepRenderImage( SceneRenderState *state )
1050{
1051 AssertFatal( !mDestroyed, "PhysicsShape::prepRenderImage - Shouldn't be processing a destroyed shape!" );
1052
1053 PROFILE_SCOPE( PhysicsShape_prepRenderImage );
1054
1055 if( !mShapeInst )
1056 return;
1057
1058 Point3F cameraOffset;
1059 getRenderTransform().getColumn(3,&cameraOffset);
1060 cameraOffset -= state->getDiffuseCameraPosition();
1061 F32 dist = cameraOffset.len();
1062 if (dist < 0.01f)
1063 dist = 0.01f;
1064
1065 F32 invScale = (1.0f/getMax(getMax(mObjScale.x,mObjScale.y),mObjScale.z));
1066 if ( mShapeInst->setDetailFromDistance( state, dist * invScale ) < 0 )
1067 return;
1068
1069 GFXTransformSaver saver;
1070
1071 // Set up our TS render state.
1072 TSRenderState rdata;
1073 rdata.setSceneState( state );
1074 rdata.setFadeOverride( 1.0f );
1075
1076 // We might have some forward lit materials
1077 // so pass down a query to gather lights.
1078 LightQuery query;
1079 query.init( getWorldSphere() );
1080 rdata.setLightQuery( &query );
1081
1082 MatrixF mat = getRenderTransform();
1083 mat.scale( mObjScale );
1084 GFX->setWorldMatrix( mat );
1085
1086 mShapeInst->animate();
1087 mShapeInst->render( rdata );
1088}
1089
1090void PhysicsShape::destroy()
1091{

Callers

nothing calls this directly

Calls 13

getMaxFunction · 0.85
getColumnMethod · 0.80
setDetailFromDistanceMethod · 0.80
setSceneStateMethod · 0.80
setFadeOverrideMethod · 0.80
setLightQueryMethod · 0.80
lenMethod · 0.45
initMethod · 0.45
scaleMethod · 0.45
setWorldMatrixMethod · 0.45
animateMethod · 0.45

Tested by

no test coverage detected