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, 7 insertions, 0 deletions
diff --git a/gfx/gl/camera.cpp b/gfx/gl/camera.cpp
index 5a90d84..905f78e 100644
--- a/gfx/gl/camera.cpp
+++ b/gfx/gl/camera.cpp
@@ -12,3 +12,10 @@ Camera::GetViewProjection() const
{
return projection * glm::lookAt(pos, pos + forward, up);
}
+
+glm::vec3
+Camera::unProject(const glm::vec2 & mouse) const
+{
+ static constexpr const glm::vec4 screen {0, 0, 1, 1};
+ return glm::normalize(glm::unProject(mouse ^ 1, glm::lookAt(::origin, forward, up), projection, screen));
+}