diff --git a/glm/core/dummy.cpp b/glm/core/dummy.cpp index 9fbb93ec..25c91e2e 100644 --- a/glm/core/dummy.cpp +++ b/glm/core/dummy.cpp @@ -3,5 +3,61 @@ int main() { + //glm::mat2x3 m1(1.0f); + //glm::vec3 v1(1.0f); + //glm::vec2 w1 = m1 * v1; + { + glm::mat2x3 m(1.0f); + glm::vec2 u(1.0f); + glm::vec3 v(1.0f); + glm::vec3 a = m * u; + glm::vec2 b = v * m; + } + + { + glm::mat2x4 m(1.0f); + glm::vec2 u(1.0f); + glm::vec4 v(1.0f); + glm::vec4 a = m * u; + glm::vec2 b = v * m; + } + + { + glm::mat3x2 m(1.0f); + glm::vec3 u(1.0f); + glm::vec2 v(1.0f); + glm::vec2 a = m * u; + glm::vec3 b = v * m; + } + + { + glm::mat3x4 m(1.0f); + glm::vec3 u(1.0f); + glm::vec4 v(1.0f); + glm::vec4 a = m * u; + glm::vec3 b = v * m; + } + + { + glm::mat4x2 m(1.0f); + glm::vec4 u(1.0f); + glm::vec2 v(1.0f); + glm::vec2 a = m * u; + glm::vec4 b = v * m; + } + + { + glm::mat4x3 m(1.0f); + glm::vec4 u(1.0f); + glm::vec3 v(1.0f); + glm::vec3 a = m * u; + glm::vec4 b = v * m; + } + + //{ + // glm::mat3x4 m(1.0f); + // glm::vec3 v(1.0f); + // glm::vec4 w = m * v; + //} } diff --git a/glm/core/type_mat2x3.inl b/glm/core/type_mat2x3.inl index 94f43905..0b8a1bcf 100644 --- a/glm/core/type_mat2x3.inl +++ b/glm/core/type_mat2x3.inl @@ -396,31 +396,28 @@ namespace detail m[0] * s, m[1] * s); } - + template - inline typename tmat2x3::row_type operator* + inline typename tmat2x3::col_type operator* ( tmat2x3 const & m, - typename tmat2x3::col_type const & v - ) + typename tmat2x3::row_type const & v) { - return detail::tvec3( + return typename tmat2x3::col_type( m[0][0] * v.x + m[1][0] * v.y, m[0][1] * v.x + m[1][1] * v.y, - m[0][2] * v.x + m[1][2] * v.y, - m[0][3] * v.x + m[1][3] * v.y); + m[0][2] * v.x + m[1][2] * v.y); } template - inline typename tmat2x3::col_type operator* + inline typename tmat2x3::row_type operator* ( - typename tmat2x3::row_type const & v, - tmat2x3 const & m - ) + typename tmat2x3::col_type const & v, + tmat2x3 const & m) { - return detail::tvec2( - m[0][0] * v.x + m[1][0] * v.y + m[2][0] * v.z + m[3][0] * v.w, - m[0][1] * v.x + m[1][1] * v.y + m[2][1] * v.z + m[3][1] * v.w); + return typename tmat2x3::row_type( + v.x * m[0][0] + v.y * m[0][1] + v.z * m[0][2], + v.x * m[1][0] + v.y * m[1][1] + v.z * m[1][2]); } template diff --git a/glm/core/type_mat2x4.inl b/glm/core/type_mat2x4.inl index 9da29a7f..0cae47e6 100644 --- a/glm/core/type_mat2x4.inl +++ b/glm/core/type_mat2x4.inl @@ -401,13 +401,13 @@ namespace detail } template - inline typename tmat2x4::row_type operator* + inline typename tmat2x4::col_type operator* ( tmat2x4 const & m, - typename tmat2x4::col_type const & v + typename tmat2x4::row_type const & v ) { - return typename tmat2x4::row_type( + return typename tmat2x4::col_type( m[0][0] * v.x + m[1][0] * v.y, m[0][1] * v.x + m[1][1] * v.y, m[0][2] * v.x + m[1][2] * v.y, @@ -415,13 +415,13 @@ namespace detail } template - inline typename tmat2x4::col_type operator* + inline typename tmat2x4::row_type operator* ( - typename tmat2x4::row_type const & v, + typename tmat2x4::col_type const & v, tmat2x4 const & m ) { - return typename tmat2x4::col_type( + return typename tmat2x4::row_type( m[0][0] * v.x + m[1][0] * v.y + m[2][0] * v.z + m[3][0] * v.w, m[0][1] * v.x + m[1][1] * v.y + m[2][1] * v.z + m[3][1] * v.w); } diff --git a/glm/core/type_mat3x2.inl b/glm/core/type_mat3x2.inl index 24def0b2..da707efd 100644 --- a/glm/core/type_mat3x2.inl +++ b/glm/core/type_mat3x2.inl @@ -412,27 +412,26 @@ namespace detail } template - inline detail::tvec2 operator* + inline typename tmat3x2::col_type operator* ( tmat3x2 const & m, - detail::tvec3 const & v - ) + typename tmat3x2::row_type const & v) { - return detail::tvec2( + return typename tmat3x2::col_type( m[0][0] * v.x + m[1][0] * v.y + m[2][0] * v.z, m[0][1] * v.x + m[1][1] * v.y + m[2][1] * v.z); } template - inline detail::tvec3 operator* + inline typename tmat3x2::row_type operator* ( - detail::tvec2 const & v, - tmat3x2 const & m - ) + typename tmat3x2::col_type const & v, + tmat3x2 const & m) { - return detail::tvec3( - m[0][0] * v.x + m[1][0] * v.y + m[2][0] * v.z + m[3][0] * v.w, - m[0][1] * v.x + m[1][1] * v.y + m[2][1] * v.z + m[3][1] * v.w); + return typename tmat3x2::row_type( + v.x * m[0][0] + v.y * m[0][1], + v.x * m[1][0] + v.y * m[1][1], + v.x * m[2][0] + v.y * m[2][1]); } template diff --git a/glm/core/type_mat3x4.inl b/glm/core/type_mat3x4.inl index 5bb9158f..60a8647c 100644 --- a/glm/core/type_mat3x4.inl +++ b/glm/core/type_mat3x4.inl @@ -433,13 +433,13 @@ namespace detail } template - inline typename tmat3x4::row_type operator* + inline typename tmat3x4::col_type operator* ( tmat3x4 const & m, - typename tmat3x4::col_type const & v + typename tmat3x4::row_type const & v ) { - return typename tmat3x4::row_type( + return typename tmat3x4::col_type( m[0][0] * v.x + m[1][0] * v.y + m[2][0] * v.z, m[0][1] * v.x + m[1][1] * v.y + m[2][1] * v.z, m[0][2] * v.x + m[1][2] * v.y + m[2][2] * v.z, @@ -447,13 +447,13 @@ namespace detail } template - inline typename tmat3x4::col_type operator* + inline typename tmat3x4::row_type operator* ( - typename tmat3x4::row_type const & v, + typename tmat3x4::col_type const & v, tmat3x4 const & m ) { - return typename tmat3x4::col_type( + return typename tmat3x4::row_type( m[0][0] * v.x + m[1][0] * v.y + m[2][0] * v.z + m[3][0] * v.w, m[0][1] * v.x + m[1][1] * v.y + m[2][1] * v.z + m[3][1] * v.w, m[0][2] * v.x + m[1][2] * v.y + m[2][2] * v.z + m[3][2] * v.w); diff --git a/glm/core/type_mat4x2.inl b/glm/core/type_mat4x2.inl index 48117f28..d61d624b 100644 --- a/glm/core/type_mat4x2.inl +++ b/glm/core/type_mat4x2.inl @@ -463,15 +463,14 @@ namespace detail m[2] * s, m[3] * s); } - + template - inline typename tmat4x2::row_type operator* + inline typename tmat4x2::col_type operator* ( tmat4x2 const & m, - typename tmat4x2::col_type const & v - ) + typename tmat4x2::row_type const & v) { - return typename tmat4x2::row_type( + return typename tmat4x2::col_type( m[0][0] * v.x + m[1][0] * v.y + m[2][0] * v.z + m[3][0] * v.w, m[0][1] * v.x + m[1][1] * v.y + m[2][1] * v.z + m[3][1] * v.w); } @@ -479,11 +478,10 @@ namespace detail template inline typename tmat4x2::row_type operator* ( - typename tmat4x2::row_type const & v, - tmat4x2 const & m - ) + typename tmat4x2::col_type const & v, + tmat4x2 const & m) { - return typename tmat4x2::row_type( + return typename tmat4x2::row_type( v.x * m[0][0] + v.y * m[0][1], v.x * m[1][0] + v.y * m[1][1], v.x * m[2][0] + v.y * m[2][1], diff --git a/glm/core/type_mat4x3.inl b/glm/core/type_mat4x3.inl index 0ba1f17c..2a07c299 100644 --- a/glm/core/type_mat4x3.inl +++ b/glm/core/type_mat4x3.inl @@ -455,22 +455,24 @@ namespace detail } template - inline typename tmat4x3::row_type operator* ( + inline typename tmat4x3::col_type operator* + ( tmat4x3 const & m, - typename tmat4x3::col_type const & v) + typename tmat4x3::row_type const & v) { - return row_type( + return typename tmat4x3::col_type( m[0][0] * v.x + m[1][0] * v.y + m[2][0] * v.z + m[3][0] * v.w, m[0][1] * v.x + m[1][1] * v.y + m[2][1] * v.z + m[3][1] * v.w, m[0][2] * v.x + m[1][2] * v.y + m[2][2] * v.z + m[3][2] * v.w); } template - inline typename tmat4x3::col_type operator* ( - typename tmat4x3::row_type const & v, + inline typename tmat4x3::row_type operator* + ( + typename tmat4x3::col_type const & v, tmat4x3 const & m) { - return col_type( + return typename tmat4x3::row_type( v.x * m[0][0] + v.y * m[0][1] + v.z * m[0][2], v.x * m[1][0] + v.y * m[1][1] + v.z * m[1][2], v.x * m[2][0] + v.y * m[2][1] + v.z * m[2][2],