From c585cb9d6cd2bf8fba177d703a3b78086561d0d3 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sat, 6 Jan 2018 19:58:39 +0100 Subject: [PATCH] Added quat left and right handed tests #703 --- test/gtx/gtx_quaternion.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/gtx/gtx_quaternion.cpp b/test/gtx/gtx_quaternion.cpp index 28e31095..c6346afa 100644 --- a/test/gtx/gtx_quaternion.cpp +++ b/test/gtx/gtx_quaternion.cpp @@ -107,6 +107,18 @@ int test_quat_lookAt() Error += static_cast(glm::abs(glm::length(test_quat) - 1.0f) > glm::epsilon()); Error += static_cast(glm::min(glm::length(test_quat + (-test_mat)), glm::length(test_quat + test_mat)) > glm::epsilon()); + // Test left-handed implementation + glm::quat test_quatLH = glm::quatLookAtLH(glm::normalize(center - eye), up); + glm::quat test_matLH = glm::conjugate(glm::quat_cast(glm::lookAtLH(eye, center, up))); + Error += static_cast(glm::abs(glm::length(test_quatLH) - 1.0f) > glm::epsilon()); + Error += static_cast(glm::min(glm::length(test_quatLH - test_matLH), glm::length(test_quatLH + test_matLH)) > glm::epsilon()); + + // Test right-handed implementation + glm::quat test_quatRH = glm::quatLookAtRH(glm::normalize(center - eye), up); + glm::quat test_matRH = glm::conjugate(glm::quat_cast(glm::lookAtRH(eye, center, up))); + Error += static_cast(glm::abs(glm::length(test_quatRH) - 1.0f) > glm::epsilon()); + Error += static_cast(glm::min(glm::length(test_quatRH - test_matRH), glm::length(test_quatRH + test_matRH)) > glm::epsilon()); + return Error; }