47 lines
1.2 KiB
C++
47 lines
1.2 KiB
C++
//
|
|
// Created by sebastian on 24.12.25.
|
|
//
|
|
|
|
#ifndef DICEWARS_SIEDLER_RENDERER_H
|
|
#define DICEWARS_SIEDLER_RENDERER_H
|
|
#include "../../game/hexWorld/HexTile.h"
|
|
#include "../layer/entities/Entity.h"
|
|
#include "model/RawModel.h"
|
|
#include "model/TexturedModel.h"
|
|
#include "shaders/StaticShader.h"
|
|
|
|
|
|
|
|
class Light;
|
|
class Camera;
|
|
|
|
class Renderer {
|
|
public:
|
|
Renderer() : projectionMatrix(createProjectionMatrix()) {
|
|
glEnable(GL_CULL_FACE);
|
|
glCullFace(GL_BACK);
|
|
|
|
staticShader.start();
|
|
staticShader.loadProjectionMatrix(projectionMatrix);
|
|
staticShader.stop();
|
|
};
|
|
void prepare(const ::Camera &camera, const Light& light);
|
|
void renderFrame(const ::Entity &entity, const ::Camera &camera, const ::Light &light, const std::vector<HexRenderData> &terrainTiles);
|
|
|
|
void renderHexTile(const HexRenderData &tile);
|
|
|
|
[[nodiscard]] glm::mat4 getProjectionMatrix() const {return projectionMatrix;}
|
|
private:
|
|
void renderRawModel(const Entity &entity);
|
|
StaticShader staticShader;
|
|
|
|
glm::mat4 projectionMatrix;
|
|
constexpr static float FOV = 70.0f;
|
|
constexpr static float NEAR_PLANE = 0.1f;
|
|
constexpr static float FAR_PLANE = 1000.0f;
|
|
|
|
static glm::mat4 createProjectionMatrix();
|
|
};
|
|
|
|
|
|
#endif //DICEWARS_SIEDLER_RENDERER_H
|