From 579c45cc66aa5e68a8a9f9ac44051da450c6225d Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Tue, 13 Dec 2022 12:09:29 +0000 Subject: Calculate an accurate up vector for the camera --- gfx/gl/camera.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'gfx/gl/camera.cpp') diff --git a/gfx/gl/camera.cpp b/gfx/gl/camera.cpp index fadbfd7..69cfe35 100644 --- a/gfx/gl/camera.cpp +++ b/gfx/gl/camera.cpp @@ -25,3 +25,10 @@ Camera::updateView() viewProjection = projection * view; inverseViewProjection = glm::inverse(viewProjection); } + +glm::vec3 +Camera::upFromForward(const glm::vec3 & forward) +{ + const auto right = glm::cross(forward, ::down); + return glm::cross(forward, right); +} -- cgit v1.2.3