From 50cead0793f950488aae536be36df1697dc61cec Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Fri, 24 Oct 2014 22:14:17 +0200 Subject: [PATCH] Vectorize outerProduct --- glm/detail/func_matrix.inl | 164 +------------------------- glm/detail/func_vector_relational.hpp | 2 +- 2 files changed, 6 insertions(+), 160 deletions(-) diff --git a/glm/detail/func_matrix.inl b/glm/detail/func_matrix.inl index edf2cfe1..4d96db95 100644 --- a/glm/detail/func_matrix.inl +++ b/glm/detail/func_matrix.inl @@ -32,164 +32,6 @@ namespace glm{ namespace detail { - template - < - template class vecTypeA, - template class vecTypeB, - typename T, precision P - > - struct compute_outerProduct{}; - - template - struct compute_outerProduct - { - GLM_FUNC_QUALIFIER static typename detail::outerProduct_trait::type call(tvec2 const & c, tvec2 const & r) - { - tmat2x2 m(uninitialize); - m[0][0] = c[0] * r[0]; - m[0][1] = c[1] * r[0]; - m[1][0] = c[0] * r[1]; - m[1][1] = c[1] * r[1]; - return m; - } - }; - - template - struct compute_outerProduct - { - GLM_FUNC_QUALIFIER static typename detail::outerProduct_trait::type call(tvec3 const & c, tvec3 const & r) - { - tmat3x3 m(uninitialize); - for(detail::component_count_t i = 0; i < detail::component_count(m); ++i) - m[i] = c * r[i]; - return m; - } - }; - - template - struct compute_outerProduct - { - GLM_FUNC_QUALIFIER static typename detail::outerProduct_trait::type call(tvec4 const & c, tvec4 const & r) - { - tmat4x4 m(uninitialize); - for(detail::component_count_t i = 0; i < detail::component_count(m); ++i) - m[i] = c * r[i]; - return m; - } - }; - - template - struct compute_outerProduct - { - GLM_FUNC_QUALIFIER static typename detail::outerProduct_trait::type call(tvec3 const & c, tvec2 const & r) - { - tmat2x3 m(uninitialize); - m[0][0] = c.x * r.x; - m[0][1] = c.y * r.x; - m[0][2] = c.z * r.x; - m[1][0] = c.x * r.y; - m[1][1] = c.y * r.y; - m[1][2] = c.z * r.y; - return m; - } - }; - - template - struct compute_outerProduct - { - GLM_FUNC_QUALIFIER static typename detail::outerProduct_trait::type call(tvec2 const & c, tvec3 const & r) - { - tmat3x2 m(uninitialize); - m[0][0] = c.x * r.x; - m[0][1] = c.y * r.x; - m[1][0] = c.x * r.y; - m[1][1] = c.y * r.y; - m[2][0] = c.x * r.z; - m[2][1] = c.y * r.z; - return m; - } - }; - - template - struct compute_outerProduct - { - GLM_FUNC_QUALIFIER static typename detail::outerProduct_trait::type call(tvec4 const & c, tvec2 const & r) - { - tmat2x4 m(uninitialize); - m[0][0] = c.x * r.x; - m[0][1] = c.y * r.x; - m[0][2] = c.z * r.x; - m[0][3] = c.w * r.x; - m[1][0] = c.x * r.y; - m[1][1] = c.y * r.y; - m[1][2] = c.z * r.y; - m[1][3] = c.w * r.y; - return m; - } - }; - - template - struct compute_outerProduct - { - GLM_FUNC_QUALIFIER static typename detail::outerProduct_trait::type call(tvec2 const & c, tvec4 const & r) - { - tmat4x2 m(uninitialize); - m[0][0] = c.x * r.x; - m[0][1] = c.y * r.x; - m[1][0] = c.x * r.y; - m[1][1] = c.y * r.y; - m[2][0] = c.x * r.z; - m[2][1] = c.y * r.z; - m[3][0] = c.x * r.w; - m[3][1] = c.y * r.w; - return m; - } - }; - - template - struct compute_outerProduct - { - GLM_FUNC_QUALIFIER static typename detail::outerProduct_trait::type call(tvec4 const & c, tvec3 const & r) - { - tmat3x4 m(uninitialize); - m[0][0] = c.x * r.x; - m[0][1] = c.y * r.x; - m[0][2] = c.z * r.x; - m[0][3] = c.w * r.x; - m[1][0] = c.x * r.y; - m[1][1] = c.y * r.y; - m[1][2] = c.z * r.y; - m[1][3] = c.w * r.y; - m[2][0] = c.x * r.z; - m[2][1] = c.y * r.z; - m[2][2] = c.z * r.z; - m[2][3] = c.w * r.z; - return m; - } - }; - - template - struct compute_outerProduct - { - GLM_FUNC_QUALIFIER static typename detail::outerProduct_trait::type call(tvec3 const & c, tvec4 const & r) - { - tmat4x3 m(uninitialize); - m[0][0] = c.x * r.x; - m[0][1] = c.y * r.x; - m[0][2] = c.z * r.x; - m[1][0] = c.x * r.y; - m[1][1] = c.y * r.y; - m[1][2] = c.z * r.y; - m[2][0] = c.x * r.z; - m[2][1] = c.y * r.z; - m[2][2] = c.z * r.z; - m[3][0] = c.x * r.w; - m[3][1] = c.y * r.w; - m[3][2] = c.z * r.w; - return m; - } - }; - template