| 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 |
nothing calls this directly
no test coverage detected