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

Method prepRenderImage

Engine/source/T3D/groundPlane.cpp:353–407  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

351}
352
353void GroundPlane::prepRenderImage( SceneRenderState* state )
354{
355 PROFILE_SCOPE( GroundPlane_prepRenderImage );
356
357 // TODO: Should we skip rendering the ground plane into
358 // the shadows? Its not like you can ever get under it.
359
360 if ( !mMaterial )
361 return;
362
363 // If we don't have a material instance after the override then
364 // we can skip rendering all together.
365 BaseMatInstance *matInst = state->getOverrideMaterial(mMaterialInst);
366 if ( !matInst )
367 return;
368
369 PROFILE_SCOPE( GroundPlane_prepRender );
370
371 // Update the geometry.
372 createGeometry( state->getCullingFrustum() );
373 if( mVertexBuffer.isNull() )
374 return;
375#ifdef TORQUE_AFX_ENABLED
376 afxZodiacMgr::renderGroundPlaneZodiacs(state, this);
377#endif
378 // Add a render instance.
379
380 RenderPassManager* pass = state->getRenderPass();
381 MeshRenderInst* ri = pass->allocInst< MeshRenderInst >();
382
383 ri->type = RenderPassManager::RIT_Mesh;
384 ri->vertBuff = &mVertexBuffer;
385 ri->primBuff = &mPrimitiveBuffer;
386 ri->prim = &mPrimitive;
387 ri->matInst = matInst;
388 ri->objectToWorld = pass->allocUniqueXform( MatrixF::Identity );
389 ri->worldToCamera = pass->allocSharedXform( RenderPassManager::View );
390 ri->projection = pass->allocSharedXform( RenderPassManager::Projection );
391 ri->visibility = 1.0f;
392 ri->translucentSort = matInst->getMaterial()->isTranslucent();
393 ri->defaultKey = matInst->getStateHint();
394
395 if( ri->translucentSort )
396 ri->type = RenderPassManager::RIT_Translucent;
397
398 // If we need lights then set them up.
399 if ( matInst->isForwardLit() )
400 {
401 LightQuery query;
402 query.init( getWorldSphere() );
403 query.getLights( ri->lights, 8 );
404 }
405
406 pass->addInst( ri );
407}
408
409/// Generate a subset of the ground plane matching the given frustum.
410

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