From 3481b82b6b796b4e0c6d2794880601a3924798cc Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Thu, 3 Feb 2011 23:58:24 +0000 Subject: [PATCH 1/2] Added developer option --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index e0007705..524241dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,5 +8,9 @@ add_definitions(-D_CRT_SECURE_NO_WARNINGS) add_subdirectory(glm) add_subdirectory(doc) +option(GLM_DEVELOPMENT_MODE "GLM development" OFF) +if(NOT GLM_DEVELOPMENT_MODE) + message(FATAL_ERROR "GLM is a header only library, no need to build it") +endif() From 5b2e2e22857ee5c56c30bcd8cca37d600c4615f5 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Fri, 4 Feb 2011 10:57:03 +0000 Subject: [PATCH 2/2] Added multiplication operator --- glm/gtc/quaternion.hpp | 5 +++++ glm/gtc/quaternion.inl | 14 ++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/glm/gtc/quaternion.hpp b/glm/gtc/quaternion.hpp index f3c6fbc4..c70b1cde 100644 --- a/glm/gtc/quaternion.hpp +++ b/glm/gtc/quaternion.hpp @@ -76,6 +76,11 @@ namespace glm detail::tquat operator- ( detail::tquat const & q); + template + detail::tquat operator* ( + detail::tquat const & q, + detail::tquat const & p); + template detail::tvec3 operator* ( detail::tquat const & q, diff --git a/glm/gtc/quaternion.inl b/glm/gtc/quaternion.inl index d0344d14..a445c182 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 + inline 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, + q.w * p.x + q.x * p.w + q.y * p.z - q.z * p.y, + q.w * p.y + q.y * p.w + q.z * p.x - q.x * p.z, + q.w * p.z + q.z * p.w + q.x * p.y - q.y * p.x); + } + // Transformation template inline detail::tvec3 operator*