summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gfx/gl/camera.cpp4
-rw-r--r--gfx/gl/camera.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/gfx/gl/camera.cpp b/gfx/gl/camera.cpp
index 994d8ab..72b5240 100644
--- a/gfx/gl/camera.cpp
+++ b/gfx/gl/camera.cpp
@@ -14,13 +14,13 @@ 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, glm::lookAt(::origin, forward, up), projection, screen))};
+ return {position, glm::normalize(glm::unProject(mouse ^ 1, unView, projection, screen))};
}
void
Camera::updateView()
{
view = glm::lookAt(position, position + forward, up);
+ unView = glm::lookAt(::origin, forward, up);
viewProjection = projection * view;
}
diff --git a/gfx/gl/camera.h b/gfx/gl/camera.h
index 94eb8fc..bcc7469 100644
--- a/gfx/gl/camera.h
+++ b/gfx/gl/camera.h
@@ -60,6 +60,6 @@ private:
float fov, aspect, near, far;
glm::mat4 projection;
- glm::mat4 view;
+ glm::mat4 view, unView;
glm::mat4 viewProjection;
};