|
|
@ -21,11 +21,14 @@ |
|
|
|
namespace Renderer { |
|
|
|
namespace Renderer { |
|
|
|
class Object { |
|
|
|
class Object { |
|
|
|
public: |
|
|
|
public: |
|
|
|
const char* name = "Object"; |
|
|
|
|
|
|
|
Object(); |
|
|
|
Object(); |
|
|
|
Object(glm::vec3 pos); |
|
|
|
Object(glm::vec3 pos); |
|
|
|
Object(glm::vec3 pos, glm::vec3 angle); |
|
|
|
Object(glm::vec3 pos, glm::vec3 angle); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
glm::mat4 getModelTransform(); |
|
|
|
|
|
|
|
void transform(glm::mat4 T); |
|
|
|
|
|
|
|
void scale(glm::vec3 vscale); |
|
|
|
|
|
|
|
|
|
|
|
glm::mat4 getPositionTransform(); |
|
|
|
glm::mat4 getPositionTransform(); |
|
|
|
void setPosition(glm::vec3 pos); |
|
|
|
void setPosition(glm::vec3 pos); |
|
|
|
void translate(glm::vec3 dpos); |
|
|
|
void translate(glm::vec3 dpos); |
|
|
@ -33,12 +36,10 @@ namespace Renderer { |
|
|
|
glm::mat4 getRotationTransform(); |
|
|
|
glm::mat4 getRotationTransform(); |
|
|
|
void setRotation(glm::vec3 angle); |
|
|
|
void setRotation(glm::vec3 angle); |
|
|
|
void rotate(glm::vec3 dangle); |
|
|
|
void rotate(glm::vec3 dangle); |
|
|
|
|
|
|
|
private: |
|
|
|
void transform(glm::mat4 T); |
|
|
|
|
|
|
|
void updatePositionTransform(); |
|
|
|
void updatePositionTransform(); |
|
|
|
void updateRotationTransform(); |
|
|
|
void updateRotationTransform(); |
|
|
|
|
|
|
|
|
|
|
|
private: |
|
|
|
|
|
|
|
glm::vec3 position = glm::vec3(0.0f, 0.0f, 0.0f); |
|
|
|
glm::vec3 position = glm::vec3(0.0f, 0.0f, 0.0f); |
|
|
|
glm::vec3 angle = glm::vec3(0.0f, 0.0f, 0.0f); |
|
|
|
glm::vec3 angle = glm::vec3(0.0f, 0.0f, 0.0f); |
|
|
|
glm::mat4 positionTransform = glm::mat4(1.0f); |
|
|
|
glm::mat4 positionTransform = glm::mat4(1.0f); |
|
|
@ -48,7 +49,6 @@ namespace Renderer { |
|
|
|
|
|
|
|
|
|
|
|
class Camera : public Object { |
|
|
|
class Camera : public Object { |
|
|
|
public: |
|
|
|
public: |
|
|
|
const char* name = "Camera"; |
|
|
|
|
|
|
|
Camera(GLFWwindow* win); |
|
|
|
Camera(GLFWwindow* win); |
|
|
|
Camera(GLFWwindow* win, glm::vec3 pos); |
|
|
|
Camera(GLFWwindow* win, glm::vec3 pos); |
|
|
|
Camera(GLFWwindow* win, glm::vec3 pos, glm::vec3 angle); |
|
|
|
Camera(GLFWwindow* win, glm::vec3 pos, glm::vec3 angle); |
|
|
@ -62,14 +62,9 @@ namespace Renderer { |
|
|
|
|
|
|
|
|
|
|
|
class RenderObject : public Object { |
|
|
|
class RenderObject : public Object { |
|
|
|
public: |
|
|
|
public: |
|
|
|
const char* name = "RenderObject"; |
|
|
|
|
|
|
|
RenderObject(std::vector<float> verts, std::vector<unsigned int> indices); |
|
|
|
RenderObject(std::vector<float> verts, std::vector<unsigned int> indices); |
|
|
|
void render(GLFWwindow* win, Camera cam); |
|
|
|
void render(GLFWwindow* win, Camera cam); |
|
|
|
void preRenderHook(); |
|
|
|
void preRenderHook(); |
|
|
|
void transform(glm::mat4 T); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void setPosition(glm::vec3 pos); |
|
|
|
|
|
|
|
void setRotation(glm::vec3 angle); |
|
|
|
|
|
|
|
private: |
|
|
|
private: |
|
|
|
Shaders::Shader shader; |
|
|
|
Shaders::Shader shader; |
|
|
|
unsigned int EBO; |
|
|
|
unsigned int EBO; |
|
|
@ -96,7 +91,6 @@ namespace Renderer { |
|
|
|
|
|
|
|
|
|
|
|
class TexturedObject : public RenderObject { |
|
|
|
class TexturedObject : public RenderObject { |
|
|
|
public: |
|
|
|
public: |
|
|
|
const char* name = "TexturedObject"; |
|
|
|
|
|
|
|
using RenderObject::RenderObject; |
|
|
|
using RenderObject::RenderObject; |
|
|
|
void setTexture(const char* t_src); |
|
|
|
void setTexture(const char* t_src); |
|
|
|
void preRenderHook(); |
|
|
|
void preRenderHook(); |
|
|
|