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

Method render

Engine/source/renderInstance/renderTerrainMgr.cpp:116–204  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114}
115
116void RenderTerrainMgr::render( SceneRenderState *state )
117{
118 if ( mInstVector.empty() )
119 return;
120
121 // Check if bin is disabled in advanced lighting.
122 if ( MATMGR->getPrePassEnabled() && mBasicOnly )
123 return;
124
125 PROFILE_SCOPE( RenderTerrainMgr_Render );
126
127 GFXTransformSaver saver;
128
129 // Prepare the common scene graph data.
130 SceneData sgData;
131 sgData.init( state );
132 sgData.wireframe |= smRenderWireframe;
133
134 // Restore transforms
135 MatrixSet &matrixSet = getRenderPass()->getMatrixSet();
136 matrixSet.restoreSceneViewProjection();
137
138 GFXDEBUGEVENT_SCOPE( RenderTerrainMgr_Render, ColorI::GREEN );
139
140 const MatrixF worldViewXfm = matrixSet.getWorldToCamera();
141 const MatrixF &projXfm = matrixSet.getCameraToScreen();
142
143 // HACKTASTIC!
144 //
145 // If this is a shadow pass then render the terrain
146 // with the first material we get.
147 //
148 // In the near future terrains will operate using regular
149 // MatInstance materials like any other mesh in which case
150 // this will all be replaced by a normal mesh render bin.
151 //
152 if ( state->isShadowPass() )
153 {
154 PROFILE_SCOPE( RenderTerrainMgr_Render_Shadow );
155
156 Vector<TerrainRenderInst*>::iterator inst = mInstVector.begin();
157 BaseMatInstance *overideMat = (*inst)->mat;
158 while ( overideMat && overideMat->setupPass( state, sgData ) )
159 {
160 for ( ; inst != mInstVector.end(); inst++ )
161 {
162 smOverrideCells++;
163
164 GFX->setPrimitiveBuffer( (*inst)->primBuff );
165 GFX->setVertexBuffer( (*inst)->vertBuff );
166
167 matrixSet.setWorld(*(*inst)->objectToWorldXfm);
168
169 overideMat->setSceneInfo( state, sgData );
170 overideMat->setTransforms( matrixSet, state );
171
172 GFX->drawPrimitive( (*inst)->prim );
173 }

Callers

nothing calls this directly

Calls 15

getPrePassEnabledMethod · 0.80
isShadowPassMethod · 0.80
setPrimitiveBufferMethod · 0.80
setVertexBufferMethod · 0.80
setTransformAndEyeMethod · 0.80
getFarPlaneMethod · 0.80
dMemcpyFunction · 0.50
emptyMethod · 0.45
initMethod · 0.45
beginMethod · 0.45
setupPassMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected