From c03ebcc688b2b8ab084cb36691210529b09d78f0 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Wed, 25 Dec 2013 06:30:52 +0100 Subject: [PATCH] Refactored transpose function --- glm/detail/func_matrix.hpp | 19 +- glm/detail/func_matrix.inl | 450 ++++++++++++++++++------------------- 2 files changed, 225 insertions(+), 244 deletions(-) diff --git a/glm/detail/func_matrix.hpp b/glm/detail/func_matrix.hpp index 34f4f61d..e4adc5ba 100644 --- a/glm/detail/func_matrix.hpp +++ b/glm/detail/func_matrix.hpp @@ -56,10 +56,8 @@ namespace glm /// /// @see GLSL matrixCompMult man page /// @see GLSL 4.20.8 specification, section 8.6 Matrix Functions - template - GLM_FUNC_DECL matType matrixCompMult( - matType const & x, - matType const & y); + template class matType> + GLM_FUNC_DECL matType matrixCompMult(matType const & x, matType const & y); /// Treats the first parameter c as a column vector /// and the second parameter r as a row vector @@ -72,9 +70,7 @@ namespace glm /// /// @todo Clarify the declaration to specify that matType doesn't have to be provided when used. template - GLM_FUNC_DECL matType outerProduct( - vecType const & c, - vecType const & r); + GLM_FUNC_DECL matType outerProduct(vecType const & c, vecType const & r); /// Returns the transposed matrix of x /// @@ -83,8 +79,7 @@ namespace glm /// @see GLSL transpose man page /// @see GLSL 4.20.8 specification, section 8.6 Matrix Functions template - GLM_FUNC_DECL typename matType::transpose_type transpose( - matType const & x); + GLM_FUNC_DECL typename matType::transpose_type transpose(matType const & x); /// Return the determinant of a squared matrix. /// @@ -93,8 +88,7 @@ namespace glm /// @see GLSL determinant man page /// @see GLSL 4.20.8 specification, section 8.6 Matrix Functions template class matType> - GLM_FUNC_DECL T determinant( - matType const & m); + GLM_FUNC_DECL T determinant(matType const & m); /// Return the inverse of a squared matrix. /// @@ -103,8 +97,7 @@ namespace glm /// @see GLSL inverse man page /// @see GLSL 4.20.8 specification, section 8.6 Matrix Functions template class matType> - GLM_FUNC_DECL matType inverse( - matType const & m); + GLM_FUNC_DECL matType inverse(matType const & m); /// @} }//namespace glm diff --git a/glm/detail/func_matrix.inl b/glm/detail/func_matrix.inl index 3f178bb2..a3e668bd 100644 --- a/glm/detail/func_matrix.inl +++ b/glm/detail/func_matrix.inl @@ -43,22 +43,6 @@ namespace glm { - // matrixCompMult - template - GLM_FUNC_QUALIFIER matType matrixCompMult - ( - matType const & x, - matType const & y - ) - { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'matrixCompMult' only accept floating-point inputs"); - - matType result(matType::_null); - for(length_t i = 0; i < result.length(); ++i) - result[i] = x[i] * y[i]; - return result; - } - // outerProduct template GLM_FUNC_QUALIFIER detail::tmat2x2 outerProduct @@ -237,254 +221,236 @@ namespace glm return m; } +namespace detail +{ + template