remove glm dependency
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include "Defines.h"
|
||||
#include <memory>
|
||||
#include "loader/GLLoader.h"
|
||||
#include "render/shaders/WorldShader.h"
|
||||
@@ -15,17 +15,17 @@ public:
|
||||
|
||||
struct Model {
|
||||
GL::VertexArray* vao;
|
||||
glm::vec2 positon;
|
||||
Vec2f positon;
|
||||
};
|
||||
private:
|
||||
std::unique_ptr<shader::WorldShader> m_WorldShader;
|
||||
std::unique_ptr<shader::EntityShader> m_EntityShader;
|
||||
|
||||
glm::vec3 m_BackgroundColor;
|
||||
Vec3f m_BackgroundColor;
|
||||
|
||||
bool m_IsometricView = true;
|
||||
float m_IsometricShade = m_IsometricView;
|
||||
glm::vec2 m_CamPos{};
|
||||
Vec2f m_CamPos{};
|
||||
public:
|
||||
Renderer();
|
||||
~Renderer();
|
||||
@@ -39,13 +39,13 @@ public:
|
||||
void RenderModel(const Model& model);
|
||||
|
||||
void SetZoom(float zoom);
|
||||
void SetCamMovement(const glm::vec2& mov);
|
||||
void SetCamPos(const glm::vec2& newPos);
|
||||
void SetCamMovement(const Vec2f& mov);
|
||||
void SetCamPos(const Vec2f& newPos);
|
||||
void SetIsometricView(bool isometric); // false = 2D true = Isometric
|
||||
|
||||
void SetBackgroundColor(const glm::vec3& color) { m_BackgroundColor = color; }
|
||||
void SetBackgroundColor(const Vec3f& color) { m_BackgroundColor = color; }
|
||||
|
||||
glm::vec2 GetCursorWorldPos(const glm::vec2& cursorPos, float aspectRatio, float zoom, float windowWidth, float windowHeight);
|
||||
Vec2f GetCursorWorldPos(const Vec2f& cursorPos, float aspectRatio, float zoom, float windowWidth, float windowHeight);
|
||||
private:
|
||||
void UpdateIsometricView();
|
||||
void UpdateIsometricFade();
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
|
||||
#include "render/gui/imgui/imgui.h"
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
namespace td {
|
||||
|
||||
namespace client {
|
||||
@@ -30,10 +28,10 @@ private:
|
||||
Renderer* m_Renderer;
|
||||
game::World* m_World;
|
||||
std::unique_ptr<GL::VertexArray> m_WorldVao, m_MobVao, m_SelectTileVao;
|
||||
glm::vec2 m_CamPos;
|
||||
glm::vec2 m_CursorPos;
|
||||
glm::vec2 m_HoldCursorPos;
|
||||
glm::vec2 m_LastClicked;
|
||||
Vec2f m_CamPos;
|
||||
Vec2f m_CursorPos;
|
||||
Vec2f m_HoldCursorPos;
|
||||
Vec2f m_LastClicked;
|
||||
float m_Zoom;
|
||||
float m_CamSensibility = 1;
|
||||
bool m_PopupOpened = false;
|
||||
@@ -77,8 +75,8 @@ private:
|
||||
void DetectCastleHovering() const;
|
||||
void RenderTooltips() const;
|
||||
void RemoveTower();
|
||||
glm::vec2 GetCursorWorldPos() const;
|
||||
glm::vec2 GetClickWorldPos() const;
|
||||
Vec2f GetCursorWorldPos() const;
|
||||
Vec2f GetClickWorldPos() const;
|
||||
|
||||
void UpdateCursorPos();
|
||||
};
|
||||
|
||||
@@ -2,20 +2,20 @@
|
||||
|
||||
#include "GuiWidget.h"
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include "Defines.h"
|
||||
|
||||
namespace td {
|
||||
namespace gui {
|
||||
|
||||
class TowerPlacePopup : public GuiWidget {
|
||||
private:
|
||||
glm::vec2 m_ClickWorldPos;
|
||||
Vec2f m_ClickWorldPos;
|
||||
public:
|
||||
TowerPlacePopup(client::Client* client);
|
||||
|
||||
virtual void Render();
|
||||
|
||||
void SetClickPos(const glm::vec2& worldPos);
|
||||
void SetClickPos(const Vec2f& worldPos);
|
||||
private:
|
||||
static constexpr float m_TowerPopupTileWidth = 200.0f;
|
||||
static constexpr float m_TowerPopupTileHeight = 200.0f;
|
||||
|
||||
@@ -19,10 +19,10 @@ public:
|
||||
EntityShader();
|
||||
|
||||
void LoadShader();
|
||||
void SetCamPos(const glm::vec2& camPos);
|
||||
void SetCamPos(const Vec2f& camPos);
|
||||
void SetZoom(float zoom);
|
||||
void SetAspectRatio(float aspectRatio);
|
||||
void SetModelPos(const glm::vec2& modelPos);
|
||||
void SetModelPos(const Vec2f& modelPos);
|
||||
void SetIsometricView(float isometric);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <glm/glm.hpp>
|
||||
#include "Defines.h"
|
||||
#include "render/GL.h"
|
||||
|
||||
namespace td {
|
||||
@@ -24,11 +24,9 @@ protected:
|
||||
|
||||
void LoadFloat(unsigned int location, float value) const;
|
||||
void LoadInt(unsigned int location, int value) const;
|
||||
void LoadVector(unsigned int location, const glm::vec2& vector) const;
|
||||
void LoadVector(unsigned int location, const glm::vec3& vector) const;
|
||||
void LoadVector(unsigned int location, const glm::vec4& vector) const;
|
||||
void LoadVector(unsigned int location, const Vec2f& vector) const;
|
||||
void LoadVector(unsigned int location, const Vec3f& vector) const;
|
||||
void LoadBoolean(unsigned int location, bool value) const;
|
||||
void LoadMatrix(unsigned int location, const glm::mat4& matrix) const;
|
||||
void CleanUp() const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -13,7 +13,7 @@ protected:
|
||||
public:
|
||||
WorldShader();
|
||||
void LoadShader();
|
||||
void SetCamPos(const glm::vec2& camPos);
|
||||
void SetCamPos(const Vec2f& camPos);
|
||||
void SetZoom(float zoom);
|
||||
void SetAspectRatio(float aspectRatio);
|
||||
void SetIsometricView(float isometric);
|
||||
|
||||
Reference in New Issue
Block a user