diff --git a/glm/gtc/quaternion.hpp b/glm/gtc/quaternion.hpp index 12730932..31fe68e6 100644 --- a/glm/gtc/quaternion.hpp +++ b/glm/gtc/quaternion.hpp @@ -102,7 +102,11 @@ namespace glm template GLM_FUNC_DECL tquat(tquat const & q); # endif - + + // explicit conversion operators + GLM_FUNC_DECL explicit operator tmat3x3(); + GLM_FUNC_DECL explicit operator tmat4x4(); + /// Create a quaternion from two normalized axis /// /// @param u A first normalized axis diff --git a/glm/gtc/quaternion.inl b/glm/gtc/quaternion.inl index 70587b86..049df569 100644 --- a/glm/gtc/quaternion.inl +++ b/glm/gtc/quaternion.inl @@ -172,6 +172,18 @@ namespace detail { *this = quat_cast(m); } + + template + GLM_FUNC_QUALIFIER tquat::operator tmat3x3() + { + return mat3_cast(*this); + } + + template + GLM_FUNC_QUALIFIER tquat::operator tmat4x4() + { + return mat4_cast(*this); + } template GLM_FUNC_QUALIFIER tquat conjugate(tquat const & q)