diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-12-11 20:11:23 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-12-11 20:16:22 +0000 |
commit | daed922f23daa8a8e2659d8aea7864cccd5e08c7 (patch) | |
tree | e8a1c949f3341f331408d91826038ab63346e32d /gfx/gl/camera.h | |
parent | Helper for testing integer vector approximations (diff) | |
download | ilt-daed922f23daa8a8e2659d8aea7864cccd5e08c7.tar.bz2 ilt-daed922f23daa8a8e2659d8aea7864cccd5e08c7.tar.xz ilt-daed922f23daa8a8e2659d8aea7864cccd5e08c7.zip |
Integer camera
Diffstat (limited to 'gfx/gl/camera.h')
-rw-r--r-- | gfx/gl/camera.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/gfx/gl/camera.h b/gfx/gl/camera.h index 469df0d..eca7b8f 100644 --- a/gfx/gl/camera.h +++ b/gfx/gl/camera.h @@ -7,7 +7,7 @@ class Camera { public: - Camera(Position3D, Angle fov, Angle aspect, Distance zNear, Distance zFar); + Camera(GlobalPosition3D, Angle fov, Angle aspect, GlobalDistance zNear, GlobalDistance zFar); [[nodiscard]] glm::mat4 getViewProjection() const @@ -18,7 +18,7 @@ public: [[nodiscard]] Ray unProject(const ScreenRelCoord &) const; void - setPosition(const Position3D & p) + setPosition(const GlobalPosition3D & p) { position = p; updateView(); @@ -39,23 +39,23 @@ public: } void - setView(const Position3D & p, const Direction3D & f) + setView(const GlobalPosition3D & p, const Direction3D & f) { position = p; setForward(f); } void - setView(const Position3D & p, const Direction3D & f, const Direction3D & u) + setView(const GlobalPosition3D & p, const Direction3D & f, const Direction3D & u) { position = p; setView(f, u); } void - lookAt(const Position3D & target) + lookAt(const GlobalPosition3D & target) { - setForward(glm::normalize(target - position)); + setForward(glm::normalize(RelativePosition3D(target - position))); } [[nodiscard]] auto @@ -70,18 +70,18 @@ public: return position; } - [[nodiscard]] std::array<glm::vec4, 4> extentsAtDist(float) const; + [[nodiscard]] std::array<GlobalPosition4D, 4> extentsAtDist(GlobalDistance) const; [[nodiscard]] static Direction3D upFromForward(const Direction3D & forward); private: void updateView(); - Position3D position; + GlobalPosition3D position; Direction3D forward; Direction3D up; - float near, far; + GlobalDistance near, far; glm::mat4 projection; glm::mat4 viewProjection, inverseViewProjection; }; |