| 641 | } |
| 642 | |
| 643 | void 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], |
nothing calls this directly
no test coverage detected