Renders the area light
| 975 | |
| 976 | // Renders the area light |
| 977 | void 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 |
| 1013 | void MeshRenderer::RenderBakeDataVisualizer(ID3D11DeviceContext* context, const Camera& camera, const MeshBakerStatus& status) |
no test coverage detected