//
// Created by sebastian on 04.08.26.
//

#include "DebugRenderer.h"

void engine::DebugRenderer::render(RenderQueue &queue, const Camera &camera) {
    m_shader->start();
    m_shader->loadViewMatrix(camera.getViewMatrix());
    m_shader->loadProjectionMatrix(camera.getProjectionMatrix());
    m_shader->loadColor(debugColor);

    glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
    for (const auto&[mesh, transformationMatrix, highlightColor, highlightIntensity] : queue.getRenderCommands()) {
        m_shader->loadTransformationMatrix(transformationMatrix);
        mesh->bind();
        mesh->draw();
        mesh->unbind();
    }
    glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);

    m_shader->stop();
}
