From 1fe48f0d099ae79aea8e3599be4d76c7539e9117 Mon Sep 17 00:00:00 2001 From: CaptainCarrot Date: Thu, 14 Sep 2017 09:04:09 +0200 Subject: [PATCH 1/4] Update quaternion.hpp --- glm/gtx/quaternion.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/glm/gtx/quaternion.hpp b/glm/gtx/quaternion.hpp index fba1eb80..c3d99a5c 100644 --- a/glm/gtx/quaternion.hpp +++ b/glm/gtx/quaternion.hpp @@ -185,7 +185,7 @@ namespace glm /// Build a look at quaternion based on the default handedness. /// - /// @param direction Desired direction of the camera. + /// @param direction Desired forward direction. Needs to be normalized. /// @param up Up vector, how the camera is oriented. Typically (0, 1, 0). template GLM_FUNC_DECL tquat quatLookAt( @@ -194,7 +194,7 @@ namespace glm /// Build a right-handed look at quaternion. /// - /// @param direction Desired direction of the camera. + /// @param direction Desired forward direction onto which the -z-axis gets mapped. Needs to be normalized. /// @param up Up vector, how the camera is oriented. Typically (0, 1, 0). template GLM_FUNC_DECL tquat quatLookAtRH( @@ -203,7 +203,7 @@ namespace glm /// Build a left-handed look at quaternion. /// - /// @param direction Desired direction onto which the +z-axis gets mapped + /// @param direction Desired forward direction onto which the +z-axis gets mapped. Needs to be normalized. /// @param up Up vector, how the camera is oriented. Typically (0, 1, 0). template GLM_FUNC_DECL tquat quatLookAtLH( From 3669256fd153da3aca487e38fe57b179a614b36f Mon Sep 17 00:00:00 2001 From: CaptainCarrot Date: Thu, 14 Sep 2017 09:05:09 +0200 Subject: [PATCH 2/4] Update quaternion.inl --- glm/gtx/quaternion.inl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/glm/gtx/quaternion.inl b/glm/gtx/quaternion.inl index 6c713fde..5595ec38 100644 --- a/glm/gtx/quaternion.inl +++ b/glm/gtx/quaternion.inl @@ -230,7 +230,7 @@ namespace glm { mat<3, 3, T, Q> Result; - Result[2] = -normalize(direction); + Result[2] = -direction; Result[0] = normalize(cross(up, Result[2])); Result[1] = cross(Result[2], Result[0]); @@ -242,7 +242,7 @@ namespace glm { mat<3, 3, T, Q> Result; - Result[2] = normalize(direction); + Result[2] = direction; Result[0] = normalize(cross(up, Result[2])); Result[1] = cross(Result[2], Result[0]); From e28dd1db5928c47ab561c6e86e547205c3d5aa46 Mon Sep 17 00:00:00 2001 From: CaptainCarrot Date: Thu, 14 Sep 2017 09:08:44 +0200 Subject: [PATCH 3/4] Update gtx_quaternion.cpp --- test/gtx/gtx_quaternion.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/gtx/gtx_quaternion.cpp b/test/gtx/gtx_quaternion.cpp index 164cbf2a..533c4ef4 100644 --- a/test/gtx/gtx_quaternion.cpp +++ b/test/gtx/gtx_quaternion.cpp @@ -101,7 +101,7 @@ int test_quat_lookAt() glm::vec3 center(1.1f, -2.0f, 3.1416f); glm::vec3 up = glm::vec3(-0.17f, 7.23f, -1.744f); - glm::quat test_quat = glm::quatLookAt(center - eye, up); + glm::quat test_quat = glm::quatLookAt(glm::normalize(center - eye), up); glm::quat test_mat = glm::conjugate(glm::quat_cast(glm::lookAt(eye, center, up))); Error += static_cast(glm::abs(glm::length(test_quat) - 1.0f) > glm::epsilon()); From 62433e1f4093e368a3dc64e92b965d053b3351c8 Mon Sep 17 00:00:00 2001 From: CaptainCarrot Date: Thu, 14 Sep 2017 09:33:49 +0200 Subject: [PATCH 4/4] Update gtx_quaternion.cpp --- test/gtx/gtx_quaternion.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/gtx/gtx_quaternion.cpp b/test/gtx/gtx_quaternion.cpp index 533c4ef4..28e31095 100644 --- a/test/gtx/gtx_quaternion.cpp +++ b/test/gtx/gtx_quaternion.cpp @@ -99,7 +99,7 @@ int test_quat_lookAt() glm::vec3 eye(0.0f); glm::vec3 center(1.1f, -2.0f, 3.1416f); - glm::vec3 up = glm::vec3(-0.17f, 7.23f, -1.744f); + glm::vec3 up(-0.17f, 7.23f, -1.744f); glm::quat test_quat = glm::quatLookAt(glm::normalize(center - eye), up); glm::quat test_mat = glm::conjugate(glm::quat_cast(glm::lookAt(eye, center, up)));