From b17d3668a25a56a1fa5f468f03222265520377ad Mon Sep 17 00:00:00 2001 From: stfx Date: Mon, 20 Nov 2017 18:21:18 +0100 Subject: [PATCH] Partly revert last commit --- glm/gtx/quaternion.inl | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/glm/gtx/quaternion.inl b/glm/gtx/quaternion.inl index caae63ad..0e267ed8 100644 --- a/glm/gtx/quaternion.inl +++ b/glm/gtx/quaternion.inl @@ -230,13 +230,10 @@ namespace glm template GLM_FUNC_QUALIFIER tquat quatLookAtRH(vec<3, T, Q> const& direction, vec<3, T, Q> const& up) { - vec<3, T, Q> const invertedDirection(-direction); - vec<3, T, Q> const right(normalize(cross(up, invertedDirection))); - mat<3, 3, T, Q> result; - result[0] = right; - result[1] = cross(invertedDirection, right); - result[2] = invertedDirection; + result[2] = -direction; + result[0] = normalize(cross(up, Result[2])); + result[1] = cross(Result[2], Result[0]); return quat_cast(result); } @@ -244,11 +241,9 @@ namespace glm template GLM_FUNC_QUALIFIER tquat quatLookAtLH(vec<3, T, Q> const& direction, vec<3, T, Q> const& up) { - vec<3, T, Q> const right(normalize(cross(up, direction))); - mat<3, 3, T, Q> result; - result[0] = right; - result[1] = cross(direction, right); + result[0] = normalize(cross(up, direction)); + result[1] = cross(direction, result[0]); result[2] = direction; return quat_cast(result);