]> git.localhorst.tv Git - blank.git/blobdiff - src/camera.hpp
simple HUD
[blank.git] / src / camera.hpp
index 88da8caf858aff87a3aacada9bd8cf865d2c300e..805109c313af3a8f0fd692448e02c7bab7190b0c 100644 (file)
@@ -3,22 +3,21 @@
 
 #include <glm/glm.hpp>
 
-#include "model.hpp"
+#include "controller.hpp"
+#include "geometry.hpp"
 
 
 namespace blank {
 
-class Camera {
+class Camera
+: public FPSController {
 
 public:
        Camera();
-       ~Camera();
 
        Camera(const Camera &) = delete;
        Camera &operator =(const Camera &) = delete;
 
-       glm::mat4 MakeMVP(const glm::mat4 &m) const { return vp * m; }
-
        void Viewport(int width, int height);
        void Viewport(int x, int y, int width, int height);
 
@@ -27,20 +26,15 @@ public:
        void Aspect(float w, float h);
        void Clip(float near, float far);
 
-       void Position(glm::vec3 pos) { model.Position(pos); UpdateView(); }
-       void Move(glm::vec3 delta) { model.Move(delta); UpdateView(); }
+       Ray Aim() const;
+
+       const glm::mat4 &Projection() { return projection; }
+       const glm::mat4 &View() { return view; }
 
-       // all angles in radians (full circle = 2π)
-       float Pitch() const { return model.Pitch(); }
-       void Pitch(float p) { model.Pitch(p); UpdateView(); }
-       void RotatePitch(float delta) { model.RotatePitch(delta); UpdateView(); }
-       float Yaw() const { return model.Yaw(); }
-       void Yaw(float y) { model.Yaw(y); UpdateView(); }
-       void RotateYaw(float delta) { model.RotateYaw(delta); UpdateView(); }
+       void Update(int dt);
 
 private:
        void UpdateProjection();
-       void UpdateView();
 
 private:
        float fov;
@@ -48,11 +42,8 @@ private:
        float near_clip;
        float far_clip;
 
-       Model model;
-
        glm::mat4 projection;
        glm::mat4 view;
-       glm::mat4 vp;
 
 };