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

Method prepRenderImage

Engine/source/T3D/convexShape.cpp:493–580  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

491}
492
493void ConvexShape::prepRenderImage( SceneRenderState *state )
494{
495 /*
496 if ( state->isDiffusePass() )
497 {
498 ObjectRenderInst *ri2 = state->getRenderPass()->allocInst<ObjectRenderInst>();
499 ri2->renderDelegate.bind( this, &ConvexShape::_renderDebug );
500 ri2->type = RenderPassManager::RIT_Editor;
501 state->getRenderPass()->addInst( ri2 );
502 }
503 */
504
505 if ( mVertexBuffer.isNull() || !state)
506 return;
507
508 // If we don't have a material instance after the override then
509 // we can skip rendering all together.
510 BaseMatInstance *matInst = state->getOverrideMaterial( mMaterialInst ? mMaterialInst : MATMGR->getWarningMatInstance() );
511 if ( !matInst )
512 return;
513
514 // Get a handy pointer to our RenderPassmanager
515 RenderPassManager *renderPass = state->getRenderPass();
516
517 // Allocate an MeshRenderInst so that we can submit it to the RenderPassManager
518 MeshRenderInst *ri = renderPass->allocInst<MeshRenderInst>();
519
520 // Set our RenderInst as a standard mesh render
521 ri->type = RenderPassManager::RIT_Mesh;
522
523 // Calculate our sorting point
524 if ( state )
525 {
526 // Calculate our sort point manually.
527 const Box3F& rBox = getRenderWorldBox();
528 ri->sortDistSq = rBox.getSqDistanceToPoint( state->getCameraPosition() );
529 }
530 else
531 ri->sortDistSq = 0.0f;
532
533 // Set up our transforms
534 MatrixF objectToWorld = getRenderTransform();
535 objectToWorld.scale( getScale() );
536
537 ri->objectToWorld = renderPass->allocUniqueXform( objectToWorld );
538 ri->worldToCamera = renderPass->allocSharedXform(RenderPassManager::View);
539 ri->projection = renderPass->allocSharedXform(RenderPassManager::Projection);
540
541 // If we need lights then set them up.
542 if ( matInst->isForwardLit() )
543 {
544 LightQuery query;
545 query.init( getWorldSphere() );
546 query.getLights( ri->lights, 8 );
547 }
548
549 // Make sure we have an up-to-date backbuffer in case
550 // our Material would like to make use of it

Callers

nothing calls this directly

Calls 15

getOverrideMaterialMethod · 0.80
getWarningMatInstanceMethod · 0.80
allocUniqueXformMethod · 0.80
allocSharedXformMethod · 0.80
isForwardLitMethod · 0.80
getLightsMethod · 0.80
isTranslucentMethod · 0.80
allocPrimMethod · 0.80
isNullMethod · 0.45
getRenderPassMethod · 0.45
getSqDistanceToPointMethod · 0.45
scaleMethod · 0.45

Tested by

no test coverage detected