forked from cricklet/Hatched
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcamera.h
More file actions
54 lines (41 loc) · 961 Bytes
/
Copy pathcamera.h
File metadata and controls
54 lines (41 loc) · 961 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#define GLM_FORCE_RADIANS
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
#include <glm/gtx/rotate_vector.hpp>
#define GLEW_STATIC
#include <GL/glew.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_opengl.h>
#include "uniforms.h"
class Camera {
public:
virtual ~Camera() {};
virtual void SetupTransforms(const Uniforms &u);
virtual void HandleEvent(SDL_Event event) = 0;
virtual void Think(float dt) = 0;
protected:
glm::mat4 viewTrans;
glm::mat4 projTrans;
};
class RotationCamera : public Camera {
public:
RotationCamera();
void HandleEvent(SDL_Event event);
void Think(float dt);
private:
glm::vec3 location;
glm::vec3 origin;
glm::vec3 up;
};
class FPSCamera : public Camera {
public:
FPSCamera();
void HandleEvent(SDL_Event event);
void Think(float dt);
private:
glm::vec3 location;
float pitch;
float yaw;
bool w = false, a = false, s = false, d = false;
};