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

Method _renderObject

Engine/source/environment/skyBox.cpp:199–251  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

197}
198
199void SkyBox::_renderObject( ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance *mi )
200{
201 GFXDEBUGEVENT_SCOPE( SkyBox_RenderObject, ColorI::WHITE );
202
203 GFXTransformSaver saver;
204 GFX->setVertexBuffer( mVB );
205
206 MatrixF worldMat = MatrixF::Identity;
207 worldMat.setPosition( state->getCameraPosition() );
208
209 SceneData sgData;
210 sgData.init( state );
211 sgData.objTrans = &worldMat;
212
213 mMatrixSet->restoreSceneViewProjection();
214 mMatrixSet->setWorld( worldMat );
215 if ( state->isReflectPass() )
216 mMatrixSet->setProjection( state->getSceneManager()->getNonClipProjection() );
217
218 while ( mMatInstance->setupPass( state, sgData ) )
219 {
220 mMatInstance->setTransforms( *mMatrixSet, state );
221 mMatInstance->setSceneInfo( state, sgData );
222
223 GFX->drawPrimitive( GFXTriangleList, 0, mPrimCount );
224 }
225
226 // Draw render band.
227 if ( mFogBandHeight > 0 && mFogBandMatInst )
228 {
229 const FogData &fog = state->getSceneManager()->getFogData();
230 if ( mLastFogColor != fog.color )
231 {
232 mLastFogColor = fog.color;
233 _initRender();
234 }
235
236 // Just need it to follow the camera... no rotation.
237 MatrixF camPosMat( MatrixF::Identity );
238 camPosMat.setPosition( worldMat.getPosition() );
239 sgData.objTrans = &camPosMat;
240 mMatrixSet->setWorld( *sgData.objTrans );
241
242 while ( mFogBandMatInst->setupPass( state, sgData ) )
243 {
244 mFogBandMatInst->setTransforms( *mMatrixSet, state );
245 mFogBandMatInst->setSceneInfo( state, sgData );
246
247 GFX->setVertexBuffer( mFogBandVB );
248 GFX->drawPrimitive( GFXTriangleList, 0, 16 );
249 }
250 }
251}
252
253void SkyBox::_initRender()
254{

Callers

nothing calls this directly

Calls 10

setVertexBufferMethod · 0.80
isReflectPassMethod · 0.80
setPositionMethod · 0.45
initMethod · 0.45
getSceneManagerMethod · 0.45
setupPassMethod · 0.45
setTransformsMethod · 0.45
setSceneInfoMethod · 0.45
drawPrimitiveMethod · 0.45
getPositionMethod · 0.45

Tested by

no test coverage detected