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

Method prepRenderImage

Engine/source/T3D/convexShape.cpp:644–743  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

642}
643
644void ConvexShape::prepRenderImage( SceneRenderState *state )
645{
646 /*
647 if ( state->isDiffusePass() )
648 {
649 ObjectRenderInst *ri2 = state->getRenderPass()->allocInst<ObjectRenderInst>();
650 ri2->renderDelegate.bind( this, &ConvexShape::_renderDebug );
651 ri2->type = RenderPassManager::RIT_Editor;
652 state->getRenderPass()->addInst( ri2 );
653 }
654 */
655
656 for (U32 i = 0; i < mSurfaceBuffers.size(); i++)
657 {
658 if (mSurfaceBuffers[i].mPrimitiveBuffer.isNull())
659 continue;
660
661 // If we don't have a material instance after the override then
662 // we can skip rendering all together.
663 BaseMatInstance *matInst;
664 if (i == 0)
665 {
666 matInst = state->getOverrideMaterial(mMaterialInst ? mMaterialInst : MATMGR->getWarningMatInstance());
667 }
668 else
669 {
670 matInst = state->getOverrideMaterial(mSurfaceTextures[i - 1].materialInst ? mSurfaceTextures[i - 1].materialInst : MATMGR->getWarningMatInstance());
671 }
672
673 if (!matInst)
674 continue;
675
676 // Get a handy pointer to our RenderPassmanager
677 RenderPassManager *renderPass = state->getRenderPass();
678
679 // Allocate an MeshRenderInst so that we can submit it to the RenderPassManager
680 MeshRenderInst *ri = renderPass->allocInst<MeshRenderInst>();
681
682 // Set our RenderInst as a standard mesh render
683 ri->type = RenderPassManager::RIT_Mesh;
684
685 // Calculate our sorting point
686 if (state)
687 {
688 // Calculate our sort point manually.
689 const Box3F& rBox = getRenderWorldBox();
690 ri->sortDistSq = rBox.getSqDistanceToPoint(state->getCameraPosition());
691 }
692 else
693 ri->sortDistSq = 0.0f;
694
695 // Set up our transforms
696 MatrixF objectToWorld = getRenderTransform();
697 objectToWorld.scale(getScale());
698
699 ri->objectToWorld = renderPass->allocUniqueXform(objectToWorld);
700 ri->worldToCamera = renderPass->allocSharedXform(RenderPassManager::View);
701 ri->projection = renderPass->allocSharedXform(RenderPassManager::Projection);

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
isAlphatestMethod · 0.80
isShadowPassMethod · 0.80
allocPrimMethod · 0.80
sizeMethod · 0.45
isNullMethod · 0.45

Tested by

no test coverage detected