diff --git a/CMakeLists.txt b/CMakeLists.txt index db4774d0..4431cb16 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,5 +19,9 @@ add_subdirectory(test) add_subdirectory(bench) 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() diff --git a/glm/gtc/quaternion.hpp b/glm/gtc/quaternion.hpp index ed57141f..d0ca1f8b 100644 --- a/glm/gtc/quaternion.hpp +++ b/glm/gtc/quaternion.hpp @@ -78,6 +78,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*