From b60047fa16607f0ca5921510c7fa3bf9d3d78508 Mon Sep 17 00:00:00 2001 From: Jesse Talavera-Greenberg Date: Sun, 6 Mar 2016 19:43:43 -0500 Subject: [PATCH] Templatize unary conversions from glm types to quat and dualquat --- glm/gtc/quaternion.hpp | 11 ++++++++--- glm/gtc/quaternion.inl | 9 ++++++--- glm/gtx/dual_quaternion.hpp | 7 +++++-- glm/gtx/dual_quaternion.inl | 6 ++++-- 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/glm/gtc/quaternion.hpp b/glm/gtc/quaternion.hpp index 431228d7..4f34c858 100644 --- a/glm/gtc/quaternion.hpp +++ b/glm/gtc/quaternion.hpp @@ -147,9 +147,14 @@ namespace glm GLM_FUNC_DECL tquat(tvec3 const & u, tvec3 const & v); /// Build a quaternion from euler angles (pitch, yaw, roll), in radians. - GLM_FUNC_DECL GLM_EXPLICIT tquat(tvec3 const & eulerAngles); - GLM_FUNC_DECL GLM_EXPLICIT tquat(tmat3x3 const & m); - GLM_FUNC_DECL GLM_EXPLICIT tquat(tmat4x4 const & m); + template + GLM_FUNC_DECL GLM_EXPLICIT tquat(tvec3 const & eulerAngles); + + template + GLM_FUNC_DECL GLM_EXPLICIT tquat(tmat3x3 const & m); + + template + GLM_FUNC_DECL GLM_EXPLICIT tquat(tmat4x4 const & m); // -- Unary arithmetic operators -- diff --git a/glm/gtc/quaternion.inl b/glm/gtc/quaternion.inl index b46cd62c..176f78dd 100644 --- a/glm/gtc/quaternion.inl +++ b/glm/gtc/quaternion.inl @@ -240,7 +240,8 @@ namespace detail } template - GLM_FUNC_QUALIFIER tquat::tquat(tvec3 const & eulerAngle) + template + GLM_FUNC_QUALIFIER tquat::tquat(tvec3 const & eulerAngle) { tvec3 c = glm::cos(eulerAngle * T(0.5)); tvec3 s = glm::sin(eulerAngle * T(0.5)); @@ -252,13 +253,15 @@ namespace detail } template - GLM_FUNC_QUALIFIER tquat::tquat(tmat3x3 const & m) + template + GLM_FUNC_QUALIFIER tquat::tquat(tmat3x3 const & m) { *this = quat_cast(m); } template - GLM_FUNC_QUALIFIER tquat::tquat(tmat4x4 const & m) + template + GLM_FUNC_QUALIFIER tquat::tquat(tmat4x4 const & m) { *this = quat_cast(m); } diff --git a/glm/gtx/dual_quaternion.hpp b/glm/gtx/dual_quaternion.hpp index 35a5d850..e7715a72 100644 --- a/glm/gtx/dual_quaternion.hpp +++ b/glm/gtx/dual_quaternion.hpp @@ -112,8 +112,11 @@ namespace glm template GLM_FUNC_DECL GLM_EXPLICIT tdualquat(tdualquat const & q); - GLM_FUNC_DECL GLM_EXPLICIT tdualquat(tmat2x4 const & holder_mat); - GLM_FUNC_DECL GLM_EXPLICIT tdualquat(tmat3x4 const & aug_mat); + template + GLM_FUNC_DECL GLM_EXPLICIT tdualquat(tmat2x4 const & holder_mat); + + template + GLM_FUNC_DECL GLM_EXPLICIT tdualquat(tmat3x4 const & aug_mat); // -- Unary arithmetic operators -- diff --git a/glm/gtx/dual_quaternion.inl b/glm/gtx/dual_quaternion.inl index 961dd1ca..c5713bc4 100644 --- a/glm/gtx/dual_quaternion.inl +++ b/glm/gtx/dual_quaternion.inl @@ -141,13 +141,15 @@ namespace glm {} template - GLM_FUNC_QUALIFIER tdualquat::tdualquat(tmat2x4 const & m) + template + GLM_FUNC_QUALIFIER tdualquat::tdualquat(tmat2x4 const & m) { *this = dualquat_cast(m); } template - GLM_FUNC_QUALIFIER tdualquat::tdualquat(tmat3x4 const & m) + template + GLM_FUNC_QUALIFIER tdualquat::tdualquat(tmat3x4 const & m) { *this = dualquat_cast(m); }