MCPcopy Create free account
hub / github.com/TheRealMJP/BakingLab / RenderMainPass

Method RenderMainPass

BakingLab/BakingLab.cpp:643–703  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

641}
642
643void BakingLab::RenderMainPass(const MeshBakerStatus& status)
644{
645 PIXEvent event(L"Main Pass");
646
647 ID3D11DeviceContextPtr context = deviceManager.ImmediateContext();
648
649 ID3D11RenderTargetView* renderTargets[2] = { nullptr, nullptr };
650 ID3D11DepthStencilView* ds = depthBuffer.DSView;
651 context->OMSetRenderTargets(1, renderTargets, ds);
652
653 SetViewport(context, colorTargetMSAA.Width, colorTargetMSAA.Height);
654
655 float clearColor[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
656 context->ClearRenderTargetView(colorTargetMSAA.RTView, clearColor);
657 context->ClearRenderTargetView(velocityTargetMSAA.RTView, clearColor);
658 context->ClearDepthStencilView(ds, D3D11_CLEAR_DEPTH|D3D11_CLEAR_STENCIL, 1.0f, 0);
659
660 meshRenderer.RenderDepth(context, camera, false, false);
661
662 meshRenderer.ReduceDepth(context, depthBuffer, camera);
663
664 if(AppSettings::EnableSun)
665 meshRenderer.RenderSunShadowMap(context, camera);
666
667 if(AppSettings::EnableAreaLight)
668 meshRenderer.RenderAreaLightShadowMap(context, camera);
669
670 renderTargets[0] = colorTargetMSAA.RTView;
671 renderTargets[1] = velocityTargetMSAA.RTView;
672 context->OMSetRenderTargets(2, renderTargets, ds);
673 SetViewport(context, colorTargetMSAA.Width, colorTargetMSAA.Height);
674
675 meshRenderer.RenderMainPass(context, camera, status);
676
677 if(AppSettings::ShowBakeDataVisualizer)
678 meshRenderer.RenderBakeDataVisualizer(context, camera, status);
679
680 if(AppSettings::EnableAreaLight)
681 meshRenderer.RenderAreaLight(context, camera);
682
683 if(AppSettings::SkyMode == SkyModes::Procedural)
684 {
685 float sunSize = AppSettings::EnableSun ? AppSettings::SunSize : 0.0f;
686 skybox.RenderSky(context, AppSettings::SunDirection, AppSettings::GroundAlbedo,
687 AppSettings::SunLuminance(), sunSize,
688 AppSettings::Turbidity, camera.ViewMatrix(),
689 camera.ProjectionMatrix(), 1.0f);
690 }
691 else if(AppSettings::SkyMode == SkyModes::Simple)
692 {
693 float sunSize = AppSettings::EnableSun ? AppSettings::SunSize : 0.0f;
694 skybox.RenderSimpleSky(context, AppSettings::SkyColor, AppSettings::SunDirection,
695 AppSettings::SunLuminance(), sunSize,
696 camera.ViewMatrix(), camera.ProjectionMatrix(), FP16Scale);
697 }
698 else if(AppSettings::SkyMode >= AppSettings::CubeMapStart)
699 {
700 skybox.RenderEnvironmentMap(context, envMaps[AppSettings::SkyMode - AppSettings::CubeMapStart],

Callers

nothing calls this directly

Calls 12

SetViewportFunction · 0.85
SunLuminanceFunction · 0.85
ImmediateContextMethod · 0.80
RenderDepthMethod · 0.80
ReduceDepthMethod · 0.80
RenderSunShadowMapMethod · 0.80
RenderAreaLightMethod · 0.80
RenderSkyMethod · 0.80
RenderSimpleSkyMethod · 0.80
RenderEnvironmentMapMethod · 0.80

Tested by

no test coverage detected