diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-11-09 00:40:40 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-11-09 00:40:40 +0000 |
commit | 9c2c3f71065c94a18c02440111b6ff8ca977b90e (patch) | |
tree | 339c9846cdd6937a5e77b37f88e3ee3674f944e5 /gfx/gl/camera.cpp | |
parent | WIP typedefing all the things - headers (diff) | |
download | ilt-9c2c3f71065c94a18c02440111b6ff8ca977b90e.tar.bz2 ilt-9c2c3f71065c94a18c02440111b6ff8ca977b90e.tar.xz ilt-9c2c3f71065c94a18c02440111b6ff8ca977b90e.zip |
WIP typedefing all the things - sources
Diffstat (limited to 'gfx/gl/camera.cpp')
-rw-r--r-- | gfx/gl/camera.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/gfx/gl/camera.cpp b/gfx/gl/camera.cpp index 80feab4..6a0359c 100644 --- a/gfx/gl/camera.cpp +++ b/gfx/gl/camera.cpp @@ -2,6 +2,7 @@ #include <collections.h> #include <glm/gtx/intersect.hpp> // IWYU pragma: keep #include <glm/gtx/transform.hpp> // IWYU pragma: keep +#include <math.h> #include <maths.h> #include <ray.h> @@ -28,8 +29,8 @@ Camera::updateView() inverseViewProjection = glm::inverse(viewProjection); } -glm::vec3 -Camera::upFromForward(const glm::vec3 & forward) +Direction3D +Camera::upFromForward(const Direction3D & forward) { const auto right = glm::cross(forward, ::down); return glm::cross(forward, right); @@ -38,11 +39,11 @@ Camera::upFromForward(const glm::vec3 & forward) std::array<glm::vec4, 4> Camera::extentsAtDist(const float dist) const { - const auto clampToSeaFloor = [this, dist](const glm::vec3 & target) { + const auto clampToSeaFloor = [this, dist](const Position3D & target) { if (target.z < -1.5F) { const auto vec = glm::normalize(target - position); - constexpr glm::vec3 seafloor {0, 0, -1.5F}; - float outdist; + constexpr Position3D seafloor {0, 0, -1.5F}; + float outdist {}; if (glm::intersectRayPlane(position, vec, seafloor, ::up, outdist)) { return (vec * outdist + position) ^ outdist; } |