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,26 @@
#include <td/render/renderer/EntityRenderer.h>
#include <td/render/loader/WorldLoader.h>
namespace td {
namespace render {
EntityRenderer::EntityRenderer(Camera& a_Camera, const game::World& a_World) : Renderer(a_Camera), m_World(a_World) {
m_EntityVao = std::make_unique<GL::VertexArray>(std::move(WorldLoader::LoadMobModel()));
m_Shader->Start();
m_Shader->SetColorEffect({1, 0, 1});
}
EntityRenderer::~EntityRenderer() {}
void EntityRenderer::Render() {
m_Shader->Start();
for (const auto& mob : m_World.GetMobList()) {
const auto mobCoords = mob->GetCenter();
m_Shader->SetModelPos({mobCoords.GetX(), 1, mobCoords.GetY()});
Renderer::Render(*m_EntityVao);
}
}
} // namespace render
} // namespace td