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

Method prepRenderImage

Engine/source/T3D/physics/physicsShape.cpp:1051–1090  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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