render entities

This commit is contained in:
2025-07-17 23:00:16 +02:00
parent b21439718b
commit b788caafa6
8 changed files with 228 additions and 158 deletions

View File

@@ -0,0 +1,23 @@
#pragma once
#include <td/render/Renderer.h>
#include <td/render/shader/EntityShader.h>
#include <td/game/World.h>
namespace td {
namespace render {
class EntityRenderer : public Renderer<shader::EntityShader> {
private:
const game::World& m_World;
std::unique_ptr<GL::VertexArray> m_EntityVao;
public:
EntityRenderer(Camera& a_Camera, const game::World& a_World);
virtual ~EntityRenderer();
virtual void Render() override;
};
} // namespace render
} // namespace td

View File

@@ -1,14 +1,12 @@
#pragma once
#include <td/render/shader/ShaderProgram.h>
#include <td/render/shader/CameraShaderProgram.h>
namespace td {
namespace shader {
class EntityShader : public ShaderProgram {
class EntityShader : public CameraShaderProgram {
private:
unsigned int m_LocationProjectionMatrix = 0;
unsigned int m_LocationViewMatrix = 0;
unsigned int m_LocationPosition = 0;
unsigned int m_LocationColorEffect = 0;
@@ -18,11 +16,7 @@ class EntityShader : public ShaderProgram {
public:
EntityShader();
void LoadShader();
void SetColorEffect(const Vec3f& color);
void SetProjectionMatrix(const Mat4f& proj) const;
void SetViewMatrix(const Mat4f& view) const;
void SetModelPos(const Vec3f& pos) const;
};