MCPcopy Create free account
hub / github.com/JeanPhilippeKernel/RendererEngine / Run

Method Run

ZEngine/src/GraphicRendererDrawStage.cpp:14–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12 GraphicRendererDrawStage::~GraphicRendererDrawStage() {}
13
14 void GraphicRendererDrawStage::Run(GraphicRendererPipelineInformation& information) {
15
16 auto const pipeline = reinterpret_cast<GraphicRendererPipelineContext*>(m_context);
17 auto const renderer = pipeline->GetRenderer();
18 const auto& camera = renderer->GetCamera();
19
20 while (!information.GraphicStorageCollection.empty()) {
21 const auto& storage = information.GraphicStorageCollection.front();
22
23 const auto& material = storage.GetMaterial();
24 const auto& geometry = storage.GetGeometry();
25
26 const auto& shader = storage.GetShader();
27 shader->CreateProgram();
28
29 material->Apply(shader.get());
30
31 // Todo : As used by many shader, we should moved it out to an Uniform Buffer
32 shader->SetUniform("model", geometry->GetTransform());
33 shader->SetUniform("view", camera->GetViewMatrix());
34 shader->SetUniform("projection", camera->GetProjectionMatrix());
35
36 const auto& vertex_array = storage.GetVertexArray();
37 RendererCommand::DrawIndexed(shader, vertex_array);
38
39 information.GraphicStorageCollection.pop();
40 }
41 }
42
43} // namespace ZEngine::Rendering::Renderers::Pipelines

Callers

nothing calls this directly

Calls 7

GetRendererMethod · 0.80
GetMaterialMethod · 0.80
GetGeometryMethod · 0.80
CreateProgramMethod · 0.80
SetUniformMethod · 0.80
GetCameraMethod · 0.45
ApplyMethod · 0.45

Tested by

no test coverage detected