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*