summaryrefslogtreecommitdiff
path: root/gfx/gl/camera.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2022-12-11 14:22:57 +0000
committerDan Goodliffe <dan.goodliffe@octal.co.uk>2022-12-12 09:17:38 +0000
commit379b07fa1fb953cc175028fcb95dfbb64c392451 (patch)
treea299bb5118612a308f2404638e24d3b4184a78d7 /gfx/gl/camera.cpp
parentFix case of GetViewProjection (diff)
downloadilt-379b07fa1fb953cc175028fcb95dfbb64c392451.tar.bz2
ilt-379b07fa1fb953cc175028fcb95dfbb64c392451.tar.xz
ilt-379b07fa1fb953cc175028fcb95dfbb64c392451.zip
Make Camera members private with accessors and helpful setters
Diffstat (limited to 'gfx/gl/camera.cpp')
-rw-r--r--gfx/gl/camera.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/gfx/gl/camera.cpp b/gfx/gl/camera.cpp
index 7438739..0e81282 100644
--- a/gfx/gl/camera.cpp
+++ b/gfx/gl/camera.cpp
@@ -4,19 +4,20 @@
#include <ray.hpp>
Camera::Camera(glm::vec3 pos, float fov, float aspect, float zNear, float zFar) :
- pos {pos}, forward {::north}, up {::up}, projection {glm::perspective(fov, aspect, zNear, zFar)}
+ position {pos}, forward {::north}, up {::up}, projection {glm::perspective(fov, aspect, zNear, zFar)}
{
}
glm::mat4
Camera::getViewProjection() const
{
- return projection * glm::lookAt(pos, pos + forward, up);
+ return projection * glm::lookAt(position, position + forward, up);
}
Ray
Camera::unProject(const glm::vec2 & mouse) const
{
static constexpr const glm::vec4 screen {0, 0, 1, 1};
- return {pos, glm::normalize(glm::unProject(mouse ^ 1, glm::lookAt(::origin, forward, up), projection, screen))};
+ return {position,
+ glm::normalize(glm::unProject(mouse ^ 1, glm::lookAt(::origin, forward, up), projection, screen))};
}