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

Method prepRenderImage

Engine/source/environment/scatterSky.cpp:643–709  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

641}
642
643void ScatterSky::prepRenderImage( SceneRenderState *state )
644{
645 // Only render into diffuse and reflect passes.
646
647 if( !state->isDiffusePass() &&
648 !state->isReflectPass() )
649 return;
650
651 // Regular sky render instance.
652 RenderPassManager* renderPass = state->getRenderPass();
653 ObjectRenderInst *ri = renderPass->allocInst<ObjectRenderInst>();
654 ri->renderDelegate.bind( this, &ScatterSky::_render );
655 ri->type = RenderPassManager::RIT_Sky;
656 ri->defaultKey = 15;
657 ri->defaultKey2 = 0;
658 renderPass->addInst(ri);
659
660 // Debug render instance.
661 /*
662 if ( Con::getBoolVariable( "$ScatterSky::debug", false ) )
663 {
664 ri = state->getRenderPass()->allocInst<ObjectRenderInst>();
665 ri->renderDelegate.bind( this, &ScatterSky::_debugRender );
666 ri->type = RenderPassManager::RIT_Editor;
667 state->getRenderPass()->addInst( ri );
668 }
669 */
670
671 // Light flare effect render instance.
672 if ( mFlareData && mNightInterpolant != 1.0f )
673 {
674 mFlareState.fullBrightness = mBrightness;
675 mFlareState.scale = mFlareScale;
676 mFlareState.lightInfo = mLight;
677
678 Point3F lightPos = state->getDiffuseCameraPosition() - state->getFarPlane() * mLight->getDirection() * 0.9f;
679 mFlareState.lightMat.identity();
680 mFlareState.lightMat.setPosition( lightPos );
681
682 F32 dist = ( lightPos - state->getDiffuseCameraPosition( ) ).len( );
683 F32 coronaScale = 0.5f;
684 F32 screenRadius = GFX->getViewport( ).extent.y * coronaScale * 0.5f;
685 mFlareState.worldRadius = screenRadius * dist / state->getWorldToScreenScale( ).y;
686
687 mFlareData->prepRender( state, &mFlareState );
688 }
689
690 // Render instances for Night effects.
691 if ( mNightInterpolant <= 0.0f )
692 return;
693
694 // Render instance for Moon sprite.
695 if ( mMoonEnabled && mMoonMatInst )
696 {
697 mMatrixSet->setSceneView(GFX->getWorldMatrix());
698 mMatrixSet->setSceneProjection(GFX->getProjectionMatrix());
699 mMatrixSet->setWorld(GFX->getWorldMatrix());
700

Callers

nothing calls this directly

Calls 15

isDiffusePassMethod · 0.80
isReflectPassMethod · 0.80
getFarPlaneMethod · 0.80
getWorldToScreenScaleMethod · 0.80
getProjectionMatrixMethod · 0.80
getRenderPassMethod · 0.45
bindMethod · 0.45
addInstMethod · 0.45
getDirectionMethod · 0.45
identityMethod · 0.45
setPositionMethod · 0.45

Tested by

no test coverage detected