MCPcopy Create free account
hub / github.com/RavEngine/RavEngine / Draw

Method Draw

src/Material.cpp:41–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39}
40
41void Material::Draw(LLGL::CommandBuffer* const commands,LLGL::Buffer* vertexBuffer, LLGL::Buffer* indexBuffer)
42{
43 //calculate wvp matrix
44 auto view = MaterialManager::GetCurrentViewMatrix();
45 auto projection = MaterialManager::GetCurrentProjectionMatrix();
46 auto wvp = projection * view * transformMatrix; //transformMatrix * view * projection;
47
48 const decimalType* pSource = (const decimalType*)glm::value_ptr(wvp);
49 for (int i = 0; i < 16; ++i) {
50 settings.wvpMatrix[i] = pSource[i];
51 }
52
53 // Set graphics pipeline
54 commands->SetPipelineState(*pipeline);
55
56 commands->UpdateBuffer(*constantBuffer, 0, &settings, sizeof(settings));
57
58 if (resourceHeap) {
59 commands->SetResourceHeap(*resourceHeap);
60 }
61
62 // Set vertex buffer
63 commands->SetVertexBuffer(*vertexBuffer);
64 commands->SetIndexBuffer(*indexBuffer);
65 commands->DrawIndexed(indexBuffer->GetDesc().size / sizeof(uint32_t), 0);
66}
67
68/**
69Create a material given a shader. Also registers it in the material manager

Callers 1

tickMethod · 0.45

Calls 7

SetPipelineStateMethod · 0.45
UpdateBufferMethod · 0.45
SetResourceHeapMethod · 0.45
SetVertexBufferMethod · 0.45
SetIndexBufferMethod · 0.45
DrawIndexedMethod · 0.45
GetDescMethod · 0.45

Tested by

no test coverage detected