39 lines
1011 B
C++
39 lines
1011 B
C++
//
|
|
// Created by sebastian on 08.02.26.
|
|
//
|
|
|
|
#ifndef TERRAINRENDERER_H
|
|
#define TERRAINRENDERER_H
|
|
|
|
#include "model/TexturedModel.h"
|
|
#include "shaders/StaticShader.h"
|
|
|
|
#include "../layer/entities/Camera.h"
|
|
#include "../layer/entities/Light.h"
|
|
#include "components/TerrainRenderingData.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<std::unique_ptr<TerrainRenderingData>>>& terrainTiles);
|
|
void finalizeFrame();
|
|
private:
|
|
TerrainShader terrainShader;
|
|
|
|
void prepareTexturedModel(const TexturedModel &texturedModel);
|
|
void unbindTexturedModel();
|
|
void prepareInstance(const TerrainRenderingData& hexTile);
|
|
};
|
|
|
|
|
|
|
|
#endif //TERRAINRENDERER_H
|