summaryrefslogtreecommitdiff
path: root/gfx/gl/camera.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gfx/gl/camera.cpp')
-rw-r--r--gfx/gl/camera.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/gfx/gl/camera.cpp b/gfx/gl/camera.cpp
index 31be9a6..ff706e7 100644
--- a/gfx/gl/camera.cpp
+++ b/gfx/gl/camera.cpp
@@ -14,15 +14,14 @@ Ray
Camera::unProject(const glm::vec2 & mouse) const
{
static constexpr const glm::vec4 screen {0, 0, 1, 1};
- return {position, glm::normalize(glm::unProject(mouse ^ 1, unView, projection, screen))};
+ const auto mouseProjection = glm::lookAt(::origin, forward, up);
+ return {position, glm::normalize(glm::unProject(mouse ^ 1, mouseProjection, projection, screen))};
}
void
Camera::updateView()
{
- view = glm::lookAt(position, position + forward, up);
- unView = glm::lookAt(::origin, forward, up);
- viewProjection = projection * view;
+ viewProjection = projection * glm::lookAt(position, position + forward, up);
inverseViewProjection = glm::inverse(viewProjection);
}