/////////////////////////////////////////////////////////////////////////////////// /// OpenGL Mathematics (glm.g-truc.net) /// /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) /// Permission is hereby granted, free of charge, to any person obtaining a copy /// of this software and associated documentation files (the "Software"), to deal /// in the Software without restriction, including without limitation the rights /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell /// copies of the Software, and to permit persons to whom the Software is /// furnished to do so, subject to the following conditions: /// /// The above copyright notice and this permission notice shall be included in /// all copies or substantial portions of the Software. /// /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN /// THE SOFTWARE. /// /// @ref core /// @file glm/core/func_matrix.inl /// @date 2008-03-08 / 2011-06-15 /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// #include "../geometric.hpp" #include 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(detail::tvec2 const & c, detail::tvec2 const & r) { detail::tmat2x2 m(detail::tmat2x2::_null); 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(detail::tvec3 const & c, detail::tvec3 const & r) { detail::tmat3x3 m(detail::tmat3x3::_null); for(length_t i(0); i < m.length(); ++i) m[i] = c * r[i]; return m; } }; template struct compute_outerProduct { GLM_FUNC_QUALIFIER static typename detail::outerProduct_trait::type call(detail::tvec4 const & c, detail::tvec4 const & r) { detail::tmat4x4 m(detail::tmat4x4::_null); for(length_t i(0); i < m.length(); ++i) m[i] = c * r[i]; return m; } }; template struct compute_outerProduct { GLM_FUNC_QUALIFIER static typename detail::outerProduct_trait::type call(detail::tvec3 const & c, detail::tvec2 const & r) { detail::tmat2x3 m(detail::tmat2x3::_null); 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(detail::tvec2 const & c, detail::tvec3 const & r) { detail::tmat3x2 m(detail::tmat3x2::_null); 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(detail::tvec4 const & c, detail::tvec2 const & r) { detail::tmat2x4 m(detail::tmat2x4::_null); 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(detail::tvec2 const & c, detail::tvec4 const & r) { detail::tmat4x2 m(detail::tmat4x2::_null); 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(detail::tvec4 const & c, detail::tvec3 const & r) { detail::tmat3x4 m(detail::tmat3x4::_null); 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(detail::tvec3 const & c, detail::tvec4 const & r) { detail::tmat4x3 m(detail::tmat4x3::_null); 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