//
// Created by sebastian on 08.02.26.
//

#ifndef TERRAINRENDERER_H
#define TERRAINRENDERER_H
#include "../../game/hexWorld/HexTile.h"
#include "model/TexturedModel.h"
#include "shaders/StaticShader.h"

#include "../layer/entities/Camera.h"
#include "../layer/entities/Light.h"
#include "shaders/TerrainShader.h"


class TerrainRenderer {
public:
    explicit TerrainRenderer(const glm::mat4 &projectionMatrix) {
        terrainShader.start();
        terrainShader.loadProjectionMatrix(projectionMatrix);
        terrainShader.stop();
    }

    void prepare(const Camera &camera, const Light &light);
    void renderTerrainTiles(const std::unordered_map<TexturedModel*, std::vector<HexRenderData*>>& terrainTiles);
    void finalizeFrame();
private:
    TerrainShader terrainShader;

    void prepareTexturedModel(const TexturedModel &texturedModel);
    void unbindTexturedModel();
    void prepareInstance(const HexRenderData& hexTile);
};



#endif //TERRAINRENDERER_H
