diff options
author | Dan Goodliffe <dan.goodliffe@octal.co.uk> | 2022-12-13 12:09:29 +0000 |
---|---|---|
committer | Dan Goodliffe <dan.goodliffe@octal.co.uk> | 2022-12-13 12:09:29 +0000 |
commit | 579c45cc66aa5e68a8a9f9ac44051da450c6225d (patch) | |
tree | eb7a8b1ec6dde6e5443a990200c33ef6c7b3480c /gfx/gl/camera.cpp | |
parent | Maintain a camera's inverse view projection matrix (diff) | |
download | ilt-579c45cc66aa5e68a8a9f9ac44051da450c6225d.tar.bz2 ilt-579c45cc66aa5e68a8a9f9ac44051da450c6225d.tar.xz ilt-579c45cc66aa5e68a8a9f9ac44051da450c6225d.zip |
Calculate an accurate up vector for the camera
Diffstat (limited to 'gfx/gl/camera.cpp')
-rw-r--r-- | gfx/gl/camera.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
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); +} |