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

Method prepRenderImage

Engine/source/environment/scatterSky.cpp:635–701  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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