diff options
author | majortom6 <tombarrett@siu.edu> | 2017-02-19 09:17:35 -0600 |
---|---|---|
committer | Tom Barrett <tombarrett@siu.edu> | 2017-03-07 13:23:41 -0600 |
commit | 5c46e0f0a924989201c6784b0f956bc442f14a7e (patch) | |
tree | 33b5889b872023bd7d414f7baec45706330813b3 /inc/camera.hpp | |
parent | 2cc21176467d4501adb7bfb9ee03eb9a2a7d14f2 (diff) |
-removed glm library, its in the debian repos
-made opengl and sdl folders in includes, moved various *hpps to them
Diffstat (limited to 'inc/camera.hpp')
-rw-r--r-- | inc/camera.hpp | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/inc/camera.hpp b/inc/camera.hpp deleted file mode 100644 index 62ae837..0000000 --- a/inc/camera.hpp +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef camera_h -#define camera_h - -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::vec3(0,.2,0); - } - - void MoveDown(){ - 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)); - } - - private: - float amt = .2; - glm::mat4 projection; - glm::vec3 pos; - glm::vec3 forward; - glm::vec3 up; -}; - -#endif |