]> git.localhorst.tv Git - blank.git/blob - src/camera.hpp
simple HUD
[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 #include "geometry.hpp"
8
9
10 namespace blank {
11
12 class Camera
13 : public FPSController {
14
15 public:
16         Camera();
17
18         Camera(const Camera &) = delete;
19         Camera &operator =(const Camera &) = delete;
20
21         void Viewport(int width, int height);
22         void Viewport(int x, int y, int width, int height);
23
24         void FOV(float f);
25         void Aspect(float r);
26         void Aspect(float w, float h);
27         void Clip(float near, float far);
28
29         Ray Aim() const;
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
48 };
49
50 }
51
52 #endif