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

Method render

Engine/source/renderInstance/renderOcclusionMgr.cpp:169–237  ·  view source on GitHub ↗

----------------------------------------------------------------------------- render objects -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

167// render objects
168//-----------------------------------------------------------------------------
169void RenderOcclusionMgr::render( SceneRenderState *state )
170{
171 PROFILE_SCOPE(RenderOcclusionMgr_render);
172
173 // Early out if nothing to draw.
174 if ( !mElementList.size() )
175 return;
176
177 GFXTransformSaver saver;
178
179 GFXDEBUGEVENT_SCOPE(RenderOcclusionMgr_Render, ColorI::BLUE);
180
181 if ( mMatInstance == NULL )
182 init();
183
184 SceneData sgData;
185 sgData.init( state );
186
187 // Restore transforms
188 MatrixSet &matrixSet = getRenderPass()->getMatrixSet();
189 matrixSet.restoreSceneViewProjection();
190
191 // The material is single pass... just setup once here.
192 mMatInstance->setupPass( state, sgData );
193
194 U32 primCount;
195 for( U32 i=0; i<mElementList.size(); i++ )
196 {
197 OccluderRenderInst *ri = static_cast<OccluderRenderInst*>(mElementList[i].inst);
198 AssertFatal( ri->query != NULL, "RenderOcclusionMgr::render, OcclusionRenderInst has NULL GFXOcclusionQuery" );
199
200 if ( ri->isSphere )
201 {
202 GFX->setVertexBuffer( mSphereBuff );
203 primCount = mSpherePrimCount;
204 }
205 else
206 {
207 GFX->setVertexBuffer( mBoxBuff );
208 primCount = 12;
209 }
210
211 MatrixF xfm( *ri->orientation );
212 xfm.setPosition( ri->position );
213 xfm.scale( ri->scale );
214
215 matrixSet.setWorld(xfm);
216 mMatInstance->setTransforms(matrixSet, state);
217
218 if ( !smDebugRender )
219 GFX->setStateBlock( mRenderSB );
220
221 ri->query->begin();
222 GFX->drawPrimitive( GFXTriangleList, 0, primCount );
223 ri->query->end();
224
225 if ( ri->query2 )
226 {

Callers

nothing calls this directly

Calls 12

setVertexBufferMethod · 0.80
setStateBlockMethod · 0.80
initFunction · 0.50
sizeMethod · 0.45
initMethod · 0.45
setupPassMethod · 0.45
setPositionMethod · 0.45
scaleMethod · 0.45
setTransformsMethod · 0.45
beginMethod · 0.45
drawPrimitiveMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected