diff --git a/glm/gtc/matrix_transform.inl b/glm/gtc/matrix_transform.inl index 6853fc73..cadf479d 100644 --- a/glm/gtc/matrix_transform.inl +++ b/glm/gtc/matrix_transform.inl @@ -39,7 +39,28 @@ namespace glm Result[3] = m[0] * v[0] + m[1] * v[1] + m[2] * v[2] + m[3]; return Result; } - + + + template + GLM_FUNC_QUALIFIER detail::tmat4x4 translate_slow + ( + detail::tmat4x4 const & m, + detail::tvec3 const & v + ) + { + detail::tmat4x4 Result(T(1)); + Result[3] = detail::tvec4(v, T(1)); + return m * Result; + + //detail::tmat4x4 Result(m); + Result[3] = m[0] * v[0] + m[1] * v[1] + m[2] * v[2] + m[3]; + //Result[3][0] = m[0][0] * v[0] + m[1][0] * v[1] + m[2][0] * v[2] + m[3][0]; + //Result[3][1] = m[0][1] * v[0] + m[1][1] * v[1] + m[2][1] * v[2] + m[3][1]; + //Result[3][2] = m[0][2] * v[0] + m[1][2] * v[1] + m[2][2] * v[2] + m[3][2]; + //Result[3][3] = m[0][3] * v[0] + m[1][3] * v[1] + m[2][3] * v[2] + m[3][3]; + //return Result; + } + template GLM_FUNC_QUALIFIER detail::tmat4x4 rotate ( @@ -80,41 +101,6 @@ namespace glm Result[3] = m[3]; return Result; } - - template - GLM_FUNC_QUALIFIER detail::tmat4x4 scale - ( - detail::tmat4x4 const & m, - detail::tvec3 const & v - ) - { - detail::tmat4x4 Result(detail::tmat4x4::_null); - Result[0] = m[0] * v[0]; - Result[1] = m[1] * v[1]; - Result[2] = m[2] * v[2]; - Result[3] = m[3]; - return Result; - } - - template - GLM_FUNC_QUALIFIER detail::tmat4x4 translate_slow - ( - detail::tmat4x4 const & m, - detail::tvec3 const & v - ) - { - detail::tmat4x4 Result(T(1)); - Result[3] = detail::tvec4(v, T(1)); - return m * Result; - - //detail::tmat4x4 Result(m); - Result[3] = m[0] * v[0] + m[1] * v[1] + m[2] * v[2] + m[3]; - //Result[3][0] = m[0][0] * v[0] + m[1][0] * v[1] + m[2][0] * v[2] + m[3][0]; - //Result[3][1] = m[0][1] * v[0] + m[1][1] * v[1] + m[2][1] * v[2] + m[3][1]; - //Result[3][2] = m[0][2] * v[0] + m[1][2] * v[1] + m[2][2] * v[2] + m[3][2]; - //Result[3][3] = m[0][3] * v[0] + m[1][3] * v[1] + m[2][3] * v[2] + m[3][3]; - //return Result; - } template GLM_FUNC_QUALIFIER detail::tmat4x4 rotate_slow @@ -154,6 +140,21 @@ namespace glm return m * Result; } + template + GLM_FUNC_QUALIFIER detail::tmat4x4 scale + ( + detail::tmat4x4 const & m, + detail::tvec3 const & v + ) + { + detail::tmat4x4 Result(detail::tmat4x4::_null); + Result[0] = m[0] * v[0]; + Result[1] = m[1] * v[1]; + Result[2] = m[2] * v[2]; + Result[3] = m[3]; + return Result; + } + template GLM_FUNC_QUALIFIER detail::tmat4x4 scale_slow (