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

Method RenderAreaLight

BakingLab/MeshRenderer.cpp:977–1010  ·  view source on GitHub ↗

Renders the area light

Source from the content-addressed store, hash-verified

975
976// Renders the area light
977void MeshRenderer::RenderAreaLight(ID3D11DeviceContext* context, const Camera& camera)
978{
979 PIXEvent event(L"Area Light Rendering");
980
981 // Set states
982 float blendFactor[4] = {1, 1, 1, 1};
983 context->OMSetBlendState(blendStates.BlendDisabled(), blendFactor, 0xFFFFFFFF);
984 context->OMSetDepthStencilState(depthStencilStates.DepthWriteEnabled(), 0);
985 context->RSSetState(rasterizerStates.NoCull());
986
987 // Set constant buffers
988 areaLightConstants.Data.ViewProjection = Float4x4::Transpose(camera.ViewProjectionMatrix());
989 areaLightConstants.Data.PrevViewProjection = Float4x4::Transpose(prevVP);
990 areaLightConstants.ApplyChanges(context);
991 areaLightConstants.SetVS(context, 0);
992 areaLightConstants.SetPS(context, 0);
993
994 // Set shaders
995 context->DSSetShader(nullptr, nullptr, 0);
996 context->HSSetShader(nullptr, nullptr, 0);
997 context->GSSetShader(nullptr, nullptr, 0);
998 context->VSSetShader(areaLightVS , nullptr, 0);
999 context->PSSetShader(areaLightPS, nullptr, 0);
1000
1001 // Draw the visualizer sphere
1002 ID3D11Buffer* vertexBuffers[1] = { areaLightVB };
1003 uint32 vertexStrides[1] = { sizeof(Float3) };
1004 uint32 offsets[1] = { 0 };
1005 context->IASetVertexBuffers(0, 1, vertexBuffers, vertexStrides, offsets);
1006 context->IASetIndexBuffer(areaLightIB, DXGI_FORMAT_R32_UINT, 0);
1007 context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
1008 context->IASetInputLayout(areaLightInputLayout);
1009 context->DrawIndexedInstanced(uint32(numAreaLightIndices), 1, 0, 0, 0);
1010}
1011
1012// Renders the bake data visualizer
1013void MeshRenderer::RenderBakeDataVisualizer(ID3D11DeviceContext* context, const Camera& camera, const MeshBakerStatus& status)

Callers 1

RenderMainPassMethod · 0.80

Calls 7

BlendDisabledMethod · 0.80
DepthWriteEnabledMethod · 0.80
NoCullMethod · 0.80
ApplyChangesMethod · 0.80
SetVSMethod · 0.80
SetPSMethod · 0.80
TransposeClass · 0.50

Tested by

no test coverage detected