X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fcamera.hpp;h=717da243eefe26b060da588bb72c2fa0fd5497c6;hb=e53a0e2e711a7d8bd9b0ddacd1360aa14370643f;hp=88da8caf858aff87a3aacada9bd8cf865d2c300e;hpb=ea1ce7b0fb7709ae56977480821ac96a231a0686;p=blank.git diff --git a/src/camera.hpp b/src/camera.hpp index 88da8ca..717da24 100644 --- a/src/camera.hpp +++ b/src/camera.hpp @@ -3,44 +3,27 @@ #include -#include "model.hpp" - namespace blank { class Camera { public: - Camera(); - ~Camera(); - - Camera(const Camera &) = delete; - Camera &operator =(const Camera &) = delete; - - glm::mat4 MakeMVP(const glm::mat4 &m) const { return vp * m; } + Camera() noexcept; - void Viewport(int width, int height); - void Viewport(int x, int y, int width, int height); + void Viewport(int width, int height) noexcept; + void Viewport(int x, int y, int width, int height) noexcept; - void FOV(float f); - void Aspect(float r); - void Aspect(float w, float h); - void Clip(float near, float far); + /// FOV in radians + void FOV(float f) noexcept; + void Aspect(float r) noexcept; + void Aspect(float w, float h) noexcept; + void Clip(float near, float far) noexcept; - void Position(glm::vec3 pos) { model.Position(pos); UpdateView(); } - void Move(glm::vec3 delta) { model.Move(delta); UpdateView(); } - - // 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(); } + const glm::mat4 &Projection() noexcept { return projection; } private: - void UpdateProjection(); - void UpdateView(); + void UpdateProjection() noexcept; private: float fov; @@ -48,11 +31,7 @@ private: float near_clip; float far_clip; - Model model; - glm::mat4 projection; - glm::mat4 view; - glm::mat4 vp; };