Renders all meshes using depth-only rendering
| 616 | |
| 617 | // Renders all meshes using depth-only rendering |
| 618 | void MeshRenderer::RenderDepth(ID3D12GraphicsCommandList* cmdList, const Camera& camera, ID3D12PipelineState* pso, uint64 numVisible) |
| 619 | { |
| 620 | cmdList->SetGraphicsRootSignature(depthRootSignature); |
| 621 | cmdList->SetPipelineState(pso); |
| 622 | cmdList->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST); |
| 623 | |
| 624 | Float4x4 world; |
| 625 | |
| 626 | // Set constant buffers |
| 627 | meshVSConstants.Data.World = world; |
| 628 | meshVSConstants.Data.View = camera.ViewMatrix(); |
| 629 | meshVSConstants.Data.WorldViewProjection = world * camera.ViewProjectionMatrix(); |
| 630 | meshVSConstants.Upload(); |
| 631 | meshVSConstants.SetAsGfxRootParameter(cmdList, 0); |
| 632 | |
| 633 | // Bind vertices and indices |
| 634 | D3D12_VERTEX_BUFFER_VIEW vbView = model->VertexBuffer().VBView(); |
| 635 | D3D12_INDEX_BUFFER_VIEW ibView = model->IndexBuffer().IBView(); |
| 636 | cmdList->IASetVertexBuffers(0, 1, &vbView); |
| 637 | cmdList->IASetIndexBuffer(&ibView); |
| 638 | |
| 639 | // Draw all meshes |
| 640 | for(uint64 i = 0; i < numVisible; ++i) |
| 641 | { |
| 642 | uint64 meshIdx = meshDrawIndices[i]; |
| 643 | const Mesh& mesh = model->Meshes()[meshIdx]; |
| 644 | |
| 645 | // Draw the whole mesh |
| 646 | cmdList->DrawIndexedInstanced(mesh.NumIndices(), 1, mesh.IndexOffset(), mesh.VertexOffset(), 0); |
| 647 | } |
| 648 | } |
| 649 | |
| 650 | // Renders all meshes using depth-only rendering for a sun shadow map |
| 651 | void MeshRenderer::RenderDepthPrepass(ID3D12GraphicsCommandList* cmdList, const Camera& camera) |
nothing calls this directly
no test coverage detected