fix: change renderer to class
This commit is contained in:
@@ -9,37 +9,53 @@
|
||||
#define RENDER_RENDERER_H_
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <memory>
|
||||
#include "loader/GLLoader.h"
|
||||
#include "render/shaders/WorldShader.h"
|
||||
#include "render/shaders/EntityShader.h"
|
||||
|
||||
namespace td {
|
||||
namespace render{
|
||||
namespace render {
|
||||
|
||||
namespace Renderer{
|
||||
class Renderer {
|
||||
public:
|
||||
static constexpr float m_AnimationSpeed = 2.0f;
|
||||
|
||||
struct Model{
|
||||
GL::VAO* vao;
|
||||
glm::vec2 positon;
|
||||
struct Model {
|
||||
GL::VAO* vao;
|
||||
glm::vec2 positon;
|
||||
};
|
||||
private:
|
||||
std::unique_ptr<WorldShader> m_WorldShader;
|
||||
std::unique_ptr<EntityShader> m_EntityShader;
|
||||
|
||||
bool m_IsometricView = true;
|
||||
float m_IsometricShade = m_IsometricView;
|
||||
glm::vec2 m_CamPos{};
|
||||
public:
|
||||
Renderer();
|
||||
~Renderer();
|
||||
|
||||
bool init();
|
||||
|
||||
void prepare();
|
||||
void resize(const int width, const int height);
|
||||
|
||||
void renderVAO(const GL::VAO& vao);
|
||||
void renderModel(const Model& model);
|
||||
|
||||
void setZoom(float zoom);
|
||||
void setCamMovement(const glm::vec2& mov);
|
||||
void setCamPos(const glm::vec2& newPos);
|
||||
void setIsometricView(bool isometric); // false = 2D true = Isometric
|
||||
|
||||
glm::vec2 getCursorWorldPos(const glm::vec2& cursorPos, float aspectRatio, float zoom, float windowWidth, float windowHeight);
|
||||
private:
|
||||
void updateIsometricView();
|
||||
void updateIsometricFade();
|
||||
void initShader();
|
||||
};
|
||||
|
||||
bool init();
|
||||
void destroy();
|
||||
|
||||
void prepare();
|
||||
void resize(const int width, const int height);
|
||||
|
||||
void renderVAO(const GL::VAO& vao);
|
||||
void renderModel(const Model& model);
|
||||
|
||||
void setZoom(float zoom);
|
||||
void setCamMovement(const glm::vec2& mov);
|
||||
void setCamPos(const glm::vec2& newPos);
|
||||
void setIsometricView(bool isometric); // false = 2D true = Isometric
|
||||
|
||||
glm::vec2 getCursorWorldPos(const glm::vec2& cursorPos, float aspectRatio, float zoom, float windowWidth, float windowHeight);
|
||||
|
||||
}
|
||||
|
||||
|
||||
} // namespace render
|
||||
} // namespace td
|
||||
|
||||
|
||||
Reference in New Issue
Block a user