]> git.localhorst.tv Git - blank.git/blob - src/camera.hpp
7cdd5e527b1ca5ecc2e0c795dd5679907dd0d209
[blank.git] / src / camera.hpp
1 #ifndef BLANK_CAMERA_HPP_
2 #define BLANK_CAMERA_HPP_
3
4 #include <glm/glm.hpp>
5
6 #include "controller.hpp"
7
8
9 namespace blank {
10
11 class Camera
12 : public FPSController {
13
14 public:
15         Camera();
16         ~Camera();
17
18         Camera(const Camera &) = delete;
19         Camera &operator =(const Camera &) = delete;
20
21         glm::mat4 MakeMVP(const glm::mat4 &m) const { return vp * m; }
22
23         void Viewport(int width, int height);
24         void Viewport(int x, int y, int width, int height);
25
26         void FOV(float f);
27         void Aspect(float r);
28         void Aspect(float w, float h);
29         void Clip(float near, float far);
30
31         const glm::mat4 &Projection() { return projection; }
32         const glm::mat4 &View() { return view; }
33
34         void Update(int dt);
35
36 private:
37         void UpdateProjection();
38
39 private:
40         float fov;
41         float aspect;
42         float near_clip;
43         float far_clip;
44
45         glm::mat4 projection;
46         glm::mat4 view;
47         glm::mat4 vp;
48
49 };
50
51 }
52
53 #endif