From 4be7a9bbaa111f4a0e59f123bf7dad0627e1f4e6 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Thu, 26 May 2011 15:00:06 +0100 Subject: [PATCH 1/5] Fixed factorial implementation --- glm/gtx/integer.inl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/glm/gtx/integer.inl b/glm/gtx/integer.inl index aef659e0..e9c93c0f 100644 --- a/glm/gtx/integer.inl +++ b/glm/gtx/integer.inl @@ -49,9 +49,10 @@ namespace integer template GLM_FUNC_QUALIFIER genType factorial(genType const & x) { + genType Temp = x; genType Result; - for(Result = 1; x > 1; --x) - Result *= x; + for(Result = 1; Temp > 1; --Temp) + Result *= Temp; return Result; } From d815607abb425150d7c608668f2c9f3142f56f73 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Thu, 26 May 2011 22:01:28 +0100 Subject: [PATCH 2/5] Fixed slerp --- glm/gtc/quaternion.inl | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/glm/gtc/quaternion.inl b/glm/gtc/quaternion.inl index 27a5c541..d4e33aaa 100644 --- a/glm/gtc/quaternion.inl +++ b/glm/gtc/quaternion.inl @@ -147,6 +147,20 @@ namespace detail{ ////////////////////////////////////////////////////////////// // tquat external operators + template + GLM_FUNC_QUALIFIER detail::tquat operator* + ( + detail::tquat const & q, + detail::tquat const & p + ) + { + return detail::tquat( + q.w + p.w, + q.x + p.x, + q.y + p.y, + q.z + p.z); + } + template GLM_FUNC_QUALIFIER detail::tquat operator- ( From 197d78454989fae9df839f2ca0c407464c622355 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Fri, 27 May 2011 00:27:52 +0100 Subject: [PATCH 3/5] Fixed quat mix build --- glm/gtc/quaternion.hpp | 7 ++++++- glm/gtc/quaternion.inl | 14 ++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/glm/gtc/quaternion.hpp b/glm/gtc/quaternion.hpp index f6238ccd..949f08f7 100644 --- a/glm/gtc/quaternion.hpp +++ b/glm/gtc/quaternion.hpp @@ -74,6 +74,11 @@ namespace detail detail::tquat operator- ( detail::tquat const & q); + template + detail::tquat operator+ ( + detail::tquat const & q, + detail::tquat const & p); + template detail::tquat operator* ( detail::tquat const & q, @@ -154,7 +159,7 @@ namespace quaternion ///< GLM_GTC_quaternion extension: Quaternion types and fun detail::tquat mix( detail::tquat const & x, detail::tquat const & y, - typename detail::tquat::value_type const & a); + T const & a); //! Returns the q conjugate. //! From GLM_GTC_quaternion extension. diff --git a/glm/gtc/quaternion.inl b/glm/gtc/quaternion.inl index 27a5c541..e262c663 100644 --- a/glm/gtc/quaternion.inl +++ b/glm/gtc/quaternion.inl @@ -156,6 +156,20 @@ namespace detail{ return detail::tquat(-q.w, -q.x, -q.y, -q.z); } + template + GLM_FUNC_QUALIFIER detail::tquat operator+ + ( + detail::tquat const & q, + detail::tquat const & p + ) + { + return detail::tquat( + q.w + p.w, + q.x + p.x, + q.y + p.y, + q.z + p.z); + } + template GLM_FUNC_QUALIFIER detail::tquat operator* ( From f87def17de5dbd74a82057f64bbd77f0717ae90d Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Fri, 27 May 2011 00:31:58 +0100 Subject: [PATCH 4/5] Fixed tests --- glm/gtc/quaternion.inl | 14 -------------- test/gtc/gtc_quaternion.cpp | 2 +- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/glm/gtc/quaternion.inl b/glm/gtc/quaternion.inl index df92920a..e262c663 100644 --- a/glm/gtc/quaternion.inl +++ b/glm/gtc/quaternion.inl @@ -147,20 +147,6 @@ namespace detail{ ////////////////////////////////////////////////////////////// // tquat external operators - template - GLM_FUNC_QUALIFIER detail::tquat operator* - ( - detail::tquat const & q, - detail::tquat const & p - ) - { - return detail::tquat( - q.w + p.w, - q.x + p.x, - q.y + p.y, - q.z + p.z); - } - template GLM_FUNC_QUALIFIER detail::tquat operator- ( diff --git a/test/gtc/gtc_quaternion.cpp b/test/gtc/gtc_quaternion.cpp index 689cfe27..00ed0503 100644 --- a/test/gtc/gtc_quaternion.cpp +++ b/test/gtc/gtc_quaternion.cpp @@ -27,7 +27,7 @@ int test_quat_slerp() glm::quat B(90.0f, glm::vec3(0, 0, 1)); glm::quat C = glm::mix(A, B, 0.5f); - Error += C != glm::quat(45.f, glm::vec3(0, 0, 1)) ? 0 : 1; + Error += C == glm::quat(45.f, glm::vec3(0, 0, 1)) ? 0 : 1; return Error; } From 2305e6b2f07027201ab5d10bdebb3f90f30c3731 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Fri, 27 May 2011 00:36:59 +0100 Subject: [PATCH 5/5] Removed test messages for dev left behind... --- glm/core/setup.hpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/glm/core/setup.hpp b/glm/core/setup.hpp index 329a8e22..01075f3c 100644 --- a/glm/core/setup.hpp +++ b/glm/core/setup.hpp @@ -135,13 +135,10 @@ // G++ #elif defined(__GNUC__) || defined(__llvm__) || defined(__clang__) # if defined (__llvm__) -# pragma message("LLVM") # define GLM_COMPILER_GCC_EXTRA GLM_COMPILER_GCC_LLVM # elif defined (__clang__) -# pragma message("CLANG") # define GLM_COMPILER_GCC_EXTRA GLM_COMPILER_GCC_CLANG # else -# pragma message("GCC") # define GLM_COMPILER_GCC_EXTRA 0 # endif #