Jamie Slowgrove - PGG Assignment 2
 All Classes Namespaces Files Functions Variables Typedefs Macros
Camera.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <SDL.h>
4 #include <iostream>
5 #include <glm.hpp>
6 #include <gtc/type_ptr.hpp>
7 #include <gtc/matrix_transform.hpp>
8 #include "glew.h"
9 
14 class Camera
15 {
16 private:
17  /*Create a viewing matrix for the Camera (Camera orientation)*/
18  glm::mat4 view;
19  /*Construct a projection matrix for the Camera (Camera lense)*/
20  glm::mat4 projection;
21  /*The Orientation of the Camera*/
22  glm::vec3 orientation;
24  float moveSpeed;
26  float rotateSpeed;
31  glm::vec2 mouse;
32 
33 public:
37  Camera();
38 
42  ~Camera();
43 
48  void input(SDL_Event &incomingEvent);
49 
54  void update(float dt);
55 
60  void moveCamera(glm::vec3 translation);
61 
66  void moveCameraAlongX(float translateX);
67 
72  void moveCameraAlongY(float translateY);
73 
78  void moveCameraAlongZ(float translateZ);
79 
84  void rotateCamera(glm::vec3 rotation);
85 
90  void rotateCameraAlongX(float rotationX);
91 
96  void rotateCameraAlongY(float rotationY);
97 
102  void rotateCameraAlongZ(float rotationZ);
103 
108  glm::mat4 getView();
109 
114  glm::mat4 getProjection();
115 
120  glm::vec3 getOrientation();
121 
126  void setPosition(glm::vec3 position);
127 };
void moveCameraAlongZ(float translateZ)
Definition: Camera.cpp:263
bool up
Definition: Camera.h:28
void rotateCameraAlongZ(float rotationZ)
Definition: Camera.cpp:310
bool rotateLeft
Definition: Camera.h:28
glm::mat4 getView()
Definition: Camera.cpp:321
void rotateCameraAlongX(float rotationX)
Definition: Camera.cpp:288
glm::mat4 projection
Definition: Camera.h:20
void rotateCamera(glm::vec3 rotation)
Definition: Camera.cpp:273
bool rotateDown
Definition: Camera.h:28
bool down
Definition: Camera.h:28
void moveCameraAlongX(float translateX)
Definition: Camera.cpp:243
bool right
Definition: Camera.h:28
void moveCameraAlongY(float translateY)
Definition: Camera.cpp:253
bool rollLeft
Definition: Camera.h:28
glm::vec3 getOrientation()
Definition: Camera.cpp:339
float rotateSpeed
Definition: Camera.h:26
Creates an Camera object.
Definition: Camera.h:14
void setPosition(glm::vec3 position)
Definition: Camera.cpp:348
void moveCamera(glm::vec3 translation)
Definition: Camera.cpp:233
glm::vec3 orientation
Definition: Camera.h:22
glm::mat4 view
Definition: Camera.h:18
Camera()
Definition: Camera.cpp:6
bool backwards
Definition: Camera.h:28
bool rollRight
Definition: Camera.h:28
bool rotateRight
Definition: Camera.h:28
void input(SDL_Event &incomingEvent)
Definition: Camera.cpp:37
void rotateCameraAlongY(float rotationY)
Definition: Camera.cpp:299
void update(float dt)
Definition: Camera.cpp:175
~Camera()
Definition: Camera.cpp:30
float moveSpeed
Definition: Camera.h:24
glm::vec2 mouse
Definition: Camera.h:31
bool forwards
Definition: Camera.h:28
bool rotateUp
Definition: Camera.h:28
bool left
Definition: Camera.h:28
glm::mat4 getProjection()
Definition: Camera.cpp:330