X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fcamera.hpp;h=805109c313af3a8f0fd692448e02c7bab7190b0c;hb=5588a6a9b1e2fb6fee8f1166f855ef497e551a09;hp=5be71e24295a7142f0bc2db146d1a3f3c2065ea8;hpb=0a13b3fe342db83eef2c0ddc991a44452df77aa3;p=blank.git diff --git a/src/camera.hpp b/src/camera.hpp index 5be71e2..805109c 100644 --- a/src/camera.hpp +++ b/src/camera.hpp @@ -3,20 +3,21 @@ #include +#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); @@ -25,14 +26,15 @@ public: void Aspect(float w, float h); void Clip(float near, float far); - void Position(glm::vec3 pos) { position = pos; UpdateView(); } - void Move(glm::vec3 delta) { position += delta; UpdateView(); } + Ray Aim() const; - void LookAt(glm::vec3 tgt) { target = tgt; UpdateView(); } + const glm::mat4 &Projection() { return projection; } + const glm::mat4 &View() { return view; } + + void Update(int dt); private: void UpdateProjection(); - void UpdateView(); private: float fov; @@ -40,13 +42,8 @@ private: float near_clip; float far_clip; - glm::vec3 position; - glm::vec3 target; - glm::vec3 up; - glm::mat4 projection; glm::mat4 view; - glm::mat4 vp; };