make use of TexturedModel
This commit is contained in:
@@ -16,24 +16,48 @@ struct Camera {
|
||||
Mat4f InvProjectionMatrix;
|
||||
|
||||
float CamDistance = 25.0f;
|
||||
Vec3f CamPos {0, CamDistance, 0};
|
||||
Vec2f CamLook {};
|
||||
Vec3f CamPos{ 0, CamDistance, 0 };
|
||||
Vec2f CamLook{};
|
||||
|
||||
float m_Yaw = -PI / 2.0f;
|
||||
float m_Pitch = -PI / 2.0f + 0.0000001f;
|
||||
};
|
||||
|
||||
struct Model {
|
||||
std::unique_ptr<GL::VertexArray> vao;
|
||||
Vec3f positon;
|
||||
Vec3f color = { 1, 1, 1 };
|
||||
};
|
||||
|
||||
class TexturedModel {
|
||||
private:
|
||||
std::unique_ptr<GL::VertexArray> m_Vao;
|
||||
std::unique_ptr<GL::Texture> m_Texture;
|
||||
Vec3f m_Positon;
|
||||
Vec3f m_Color = { 1, 1, 1 };
|
||||
public:
|
||||
REMOVE_COPY(TexturedModel);
|
||||
|
||||
TexturedModel(GL::VertexArray&& vao, GL::Texture&& texture);
|
||||
TexturedModel(TexturedModel&& other);
|
||||
~TexturedModel() {}
|
||||
|
||||
const GL::VertexArray& GetVao() const { return *m_Vao; }
|
||||
const GL::Texture& GetTexture() const { return *m_Texture; }
|
||||
Vec3f GetPosition() const { return m_Positon; }
|
||||
Vec3f GetColor() const { return m_Color; }
|
||||
|
||||
void SetPosition(Vec3f newPos) { m_Positon = newPos; }
|
||||
void SetColor(Vec3f newColor) { m_Color = newColor; }
|
||||
|
||||
};
|
||||
|
||||
class Renderer {
|
||||
public:
|
||||
static constexpr float m_AnimationSpeed = 2.0f;
|
||||
static constexpr float m_MouseSensitivity = 200.0f;
|
||||
|
||||
struct Model {
|
||||
std::unique_ptr<GL::VertexArray> vao;
|
||||
std::unique_ptr<GL::Texture> texture;
|
||||
Vec3f positon;
|
||||
Vec3f color = { 1, 1, 1 };
|
||||
};
|
||||
|
||||
private:
|
||||
std::unique_ptr<shader::WorldShader> m_WorldShader;
|
||||
std::unique_ptr<shader::EntityShader> m_EntityShader;
|
||||
@@ -42,7 +66,7 @@ private:
|
||||
|
||||
Vec3f m_BackgroundColor;
|
||||
|
||||
Camera m_Camera {};
|
||||
Camera m_Camera{};
|
||||
public:
|
||||
Renderer();
|
||||
~Renderer();
|
||||
@@ -54,6 +78,7 @@ public:
|
||||
|
||||
void RenderVAO(const GL::VertexArray& vao);
|
||||
void RenderModel(const Model& model);
|
||||
void RenderModel(const TexturedModel& model);
|
||||
|
||||
void AddZoom(float zoom);
|
||||
void SetCamAngularMovement(const Vec2f& mov);
|
||||
|
||||
@@ -29,7 +29,8 @@ private:
|
||||
Renderer* m_Renderer;
|
||||
game::World* m_World;
|
||||
std::unique_ptr<GL::VertexArray> m_WorldVao;
|
||||
std::unique_ptr<Renderer::Model> m_MobModel, m_SelectTileModel;
|
||||
std::unique_ptr<Model> m_SelectTileModel;
|
||||
std::unique_ptr<TexturedModel> m_MobModel;
|
||||
Vec2f m_CamPos;
|
||||
Vec2f m_CursorPos;
|
||||
Vec2f m_HoldCursorPos;
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include "GLLoader.h"
|
||||
#include "render/Renderer.h"
|
||||
|
||||
namespace td {
|
||||
namespace render {
|
||||
|
||||
namespace MobLoader {
|
||||
|
||||
GL::VertexArray LoadMobModel();
|
||||
TexturedModel LoadMobModel();
|
||||
|
||||
} // namespace loader
|
||||
} // namespace MobLoader
|
||||
|
||||
} // namespace render
|
||||
} // namespace td
|
||||
|
||||
Reference in New Issue
Block a user