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

Method RenderBackgroundVelocity

BakingLab/BakingLab.cpp:750–796  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

748}
749
750void 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
798void BakingLab::RenderHUD(const Timer& timer, float groundTruthProgress, float bakeProgress,
799 uint64 groundTruthSampleCount)

Callers

nothing calls this directly

Calls 10

SetViewportFunction · 0.85
Float3Class · 0.85
ImmediateContextMethod · 0.80
SetPositionMethod · 0.80
ApplyChangesMethod · 0.80
SetPSMethod · 0.80
BlendDisabledMethod · 0.80
DepthEnabledMethod · 0.80
NoCullMethod · 0.80
TransposeClass · 0.50

Tested by

no test coverage detected