| 748 | } |
| 749 | |
| 750 | void BakingLab::RenderBackgroundVelocity() |
| 751 | { |
| 752 | PIXEvent pixEvent(L"Render Background Velocity"); |
| 753 | |
| 754 | ID3D11DeviceContextPtr context = deviceManager.ImmediateContext(); |
| 755 | |
| 756 | SetViewport(context, velocityTargetMSAA.Width, velocityTargetMSAA.Height); |
| 757 | |
| 758 | // Don't use camera translation for background velocity |
| 759 | FirstPersonCamera tempCamera = camera; |
| 760 | tempCamera.SetPosition(Float3(0.0f, 0.0f, 0.0f)); |
| 761 | |
| 762 | backgroundVelocityConstants.Data.InvViewProjection = Float4x4::Transpose(Float4x4::Invert(tempCamera.ViewProjectionMatrix())); |
| 763 | backgroundVelocityConstants.Data.PrevViewProjection = Float4x4::Transpose(prevViewProjection); |
| 764 | backgroundVelocityConstants.Data.RTSize.x = float(velocityTargetMSAA.Width); |
| 765 | backgroundVelocityConstants.Data.RTSize.y = float(velocityTargetMSAA.Height); |
| 766 | backgroundVelocityConstants.Data.JitterOffset = jitterOffset; |
| 767 | backgroundVelocityConstants.ApplyChanges(context); |
| 768 | backgroundVelocityConstants.SetPS(context, 0); |
| 769 | |
| 770 | prevViewProjection = tempCamera.ViewProjectionMatrix(); |
| 771 | |
| 772 | float blendFactor[4] = { 1.0f, 1.0f, 1.0f, 1.0f }; |
| 773 | context->OMSetBlendState(blendStates.BlendDisabled(), blendFactor, 0xFFFFFFFF); |
| 774 | context->OMSetDepthStencilState(depthStencilStates.DepthEnabled(), 0); |
| 775 | context->RSSetState(rasterizerStates.NoCull()); |
| 776 | |
| 777 | ID3D11RenderTargetView* rtvs[1] = { velocityTargetMSAA.RTView }; |
| 778 | context->OMSetRenderTargets(1, rtvs, depthBuffer.DSView); |
| 779 | |
| 780 | context->VSSetShader(backgroundVelocityVS, nullptr, 0); |
| 781 | context->PSSetShader(backgroundVelocityPS, nullptr, 0); |
| 782 | context->GSSetShader(nullptr, nullptr, 0); |
| 783 | context->HSSetShader(nullptr, nullptr, 0); |
| 784 | context->DSSetShader(nullptr, nullptr, 0); |
| 785 | |
| 786 | ID3D11Buffer* vbs[1] = { nullptr }; |
| 787 | UINT strides[1] = { 0 }; |
| 788 | UINT offsets[1] = { 0 }; |
| 789 | context->IASetVertexBuffers(0, 1, vbs, strides, offsets); |
| 790 | context->IASetInputLayout(nullptr); |
| 791 | context->IASetIndexBuffer(nullptr, DXGI_FORMAT_R16_UINT, 0); |
| 792 | context->Draw(3, 0); |
| 793 | |
| 794 | rtvs[0] = nullptr; |
| 795 | context->OMSetRenderTargets(1, rtvs, nullptr); |
| 796 | } |
| 797 | |
| 798 | void BakingLab::RenderHUD(const Timer& timer, float groundTruthProgress, float bakeProgress, |
| 799 | uint64 groundTruthSampleCount) |
nothing calls this directly
no test coverage detected