From 2cc21176467d4501adb7bfb9ee03eb9a2a7d14f2 Mon Sep 17 00:00:00 2001 From: majortom6 Date: Sun, 19 Feb 2017 08:06:37 -0600 Subject: -removed all references to sdl_rect and location and now everything now uses our own class rectangle -standardization of tab spaces to 8 is now in effect -refractoring of graphicsobjects.hpp --- inc/graphicsobjects.hpp | 149 +----------------------------------------------- 1 file changed, 3 insertions(+), 146 deletions(-) (limited to 'inc/graphicsobjects.hpp') diff --git a/inc/graphicsobjects.hpp b/inc/graphicsobjects.hpp index 66e3fc3..de85467 100644 --- a/inc/graphicsobjects.hpp +++ b/inc/graphicsobjects.hpp @@ -4,82 +4,7 @@ #include #include - -struct Camera -{ -public: - Camera(const glm::vec3& pos, float fov, float aspect, float zNear, float zFar) - { - this->pos = pos; - this->forward = glm::vec3(0.0f, 0.0f, -1.0f); - this->up = glm::vec3(0.0f, 1.0f, 0.0f); - this->projection = glm::perspective(fov, aspect, zNear, zFar); - } - - inline glm::mat4 GetViewProjection() const - { - return projection * glm::lookAt(pos, pos + forward, up); - } - - void MoveForward() - { - pos += forward * amt; - } - - void MoveBackward() - { - pos += forward * -amt; - } - - void MoveRight() - { - pos += -glm::cross(up, forward) * amt; - } - - void MoveLeft() - { - pos += glm::cross(up, forward) * amt; - } - - void MoveUp() - { - //pos += glm::cross(up, forward) * amt; - pos += glm::vec3(0,.2,0); - } - - void MoveDown() - { - //pos += glm::cross(up, forward) * amt; - pos -= glm::vec3(0,.2,0); - } - - void Pitch(float angle) - { - glm::vec3 right = glm::normalize(glm::cross(up, forward)); - - forward = glm::vec3(glm::normalize(glm::rotate(angle, right) * glm::vec4(forward, 0.0))); - up = glm::normalize(glm::cross(forward, right)); - } - - /*void RotateY(float angle) - { - static const glm::vec3 UP(0.0f, 1.0f, 0.0f); - - glm::mat4 rotation = glm::rotate(angle, UP); - - forward = glm::vec3(glm::normalize(rotation * glm::vec4(forward, 0.0))); - up = glm::vec3(glm::normalize(rotation * glm::vec4(up, 0.0))); - }*/ - -private: - float amt = .2; - //glm::vec3 speed = glm::vec3(0,0,0.2); - glm::mat4 projection; - glm::vec3 pos; - glm::vec3 forward; - glm::vec3 up; -}; - +#include "camera.hpp" struct Transform @@ -109,7 +34,7 @@ public: glm::mat4 VP = camera.GetViewProjection(); glm::mat4 M = GetModel(); - return VP * M;//camera.GetViewProjection() * GetModel(); + return VP * M; } inline glm::vec3* GetPos() { return &pos; } @@ -126,32 +51,6 @@ private: glm::vec3 scale; }; - - - - - -class Location -{ - public: - Location(float x1, float y1){x=x1;y=y1; w=5; h=5;}; - Location(){x=y=0; w=5; h=5;}; - - float getX(){ - return x; - } - - float getY(){ - return y; - } - - float x; - float y; - float w; - float h; -}; - - class GraphicsData { public: @@ -162,8 +61,6 @@ class GraphicsData float g; float b; float sides; - //float theret[6]; - //float* ret[6]; GraphicsData(){ this->x = 0; @@ -194,44 +91,4 @@ class GraphicsData }; - -class Rectangle -{ - public: - Rectangle(float x1, float y1, float wid, float heit){x=x1;y=y1;width=wid; height=heit;}; - Rectangle(){x=y=width=height=0;}; - - - void setX(float x1){ - x=x1; - } - - void setY(float y1){ - y=y1; - } - - - - float getX(){ - return x; - } - - float getY(){ - return y; - } - - float getWidth(){ - return width; - } - - float getHeight(){ - return height; - } - - float x; - float y; - float width; - float height; -}; - -#endif \ No newline at end of file +#endif -- cgit v1.2.3