make use of TexturedModel

This commit is contained in:
2023-06-28 22:19:18 +02:00
parent 385dcf11d0
commit b985cc7ade
6 changed files with 91 additions and 33 deletions

View File

@@ -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);