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

Method prepRenderImage

Engine/source/T3D/groundPlane.cpp:336–388  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

334}
335
336void GroundPlane::prepRenderImage( SceneRenderState* state )
337{
338 PROFILE_SCOPE( GroundPlane_prepRenderImage );
339
340 // TODO: Should we skip rendering the ground plane into
341 // the shadows? Its not like you can ever get under it.
342
343 if ( !mMaterial )
344 return;
345
346 // If we don't have a material instance after the override then
347 // we can skip rendering all together.
348 BaseMatInstance *matInst = state->getOverrideMaterial( mMaterial );
349 if ( !matInst )
350 return;
351
352 PROFILE_SCOPE( GroundPlane_prepRender );
353
354 // Update the geometry.
355 createGeometry( state->getCullingFrustum() );
356 if( mVertexBuffer.isNull() )
357 return;
358
359 // Add a render instance.
360
361 RenderPassManager* pass = state->getRenderPass();
362 MeshRenderInst* ri = pass->allocInst< MeshRenderInst >();
363
364 ri->type = RenderPassManager::RIT_Mesh;
365 ri->vertBuff = &mVertexBuffer;
366 ri->primBuff = &mPrimitiveBuffer;
367 ri->prim = &mPrimitive;
368 ri->matInst = matInst;
369 ri->objectToWorld = pass->allocUniqueXform( MatrixF::Identity );
370 ri->worldToCamera = pass->allocSharedXform( RenderPassManager::View );
371 ri->projection = pass->allocSharedXform( RenderPassManager::Projection );
372 ri->visibility = 1.0f;
373 ri->translucentSort = matInst->getMaterial()->isTranslucent();
374 ri->defaultKey = matInst->getStateHint();
375
376 if( ri->translucentSort )
377 ri->type = RenderPassManager::RIT_Translucent;
378
379 // If we need lights then set them up.
380 if ( matInst->isForwardLit() )
381 {
382 LightQuery query;
383 query.init( getWorldSphere() );
384 query.getLights( ri->lights, 8 );
385 }
386
387 pass->addInst( ri );
388}
389
390/// Generate a subset of the ground plane matching the given frustum.
391

Callers

nothing calls this directly

Calls 11

getOverrideMaterialMethod · 0.80
allocUniqueXformMethod · 0.80
allocSharedXformMethod · 0.80
isTranslucentMethod · 0.80
isForwardLitMethod · 0.80
getLightsMethod · 0.80
isNullMethod · 0.45
getRenderPassMethod · 0.45
getMaterialMethod · 0.45
initMethod · 0.45
addInstMethod · 0.45

Tested by

no test coverage detected