summaryrefslogtreecommitdiff
path: root/gfx
diff options
context:
space:
mode:
Diffstat (limited to 'gfx')
-rw-r--r--gfx/gl/camera.cpp7
-rw-r--r--gfx/gl/camera.h1
2 files changed, 3 insertions, 5 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);
}
diff --git a/gfx/gl/camera.h b/gfx/gl/camera.h
index 1ded3e0..5b2b4f4 100644
--- a/gfx/gl/camera.h
+++ b/gfx/gl/camera.h
@@ -74,6 +74,5 @@ private:
float fov, aspect, near, far;
glm::mat4 projection;
- glm::mat4 view, unView;
glm::mat4 viewProjection, inverseViewProjection;
};