From e07f5f1f2481607b26f8afb28847d9ba64366151 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Mon, 20 Dec 2010 00:04:53 +0000 Subject: [PATCH] Fixes submitted by ticket #30 --- glm/core/dummy.cpp | 2 ++ glm/core/type_mat2x2.inl | 15 +++++++++++---- glm/core/type_mat2x3.inl | 4 ++-- glm/core/type_mat2x4.inl | 8 ++++---- glm/core/type_mat3x2.inl | 10 +++++----- glm/core/type_mat3x3.inl | 16 ++++++++-------- glm/core/type_mat3x4.inl | 15 ++++++++++----- glm/core/type_mat4x2.inl | 6 +++--- glm/core/type_mat4x3.inl | 4 ++-- glm/core/type_mat4x4.inl | 4 ++-- 10 files changed, 49 insertions(+), 35 deletions(-) diff --git a/glm/core/dummy.cpp b/glm/core/dummy.cpp index 44c505c5..db48a2d6 100644 --- a/glm/core/dummy.cpp +++ b/glm/core/dummy.cpp @@ -18,6 +18,8 @@ int main() glm::mat2x3 o = m / x; glm::mat2x3 p = x * m; glm::mat2x3 q = m * x; + + glm::mat2x3::col_type v1 = m[3] } { diff --git a/glm/core/type_mat2x2.inl b/glm/core/type_mat2x2.inl index 0dbefc1e..33673c0f 100644 --- a/glm/core/type_mat2x2.inl +++ b/glm/core/type_mat2x2.inl @@ -32,7 +32,7 @@ namespace detail size_type i ) { - assert(i < col_size()); + assert(i < this->row_size()); return this->value[i]; } @@ -43,7 +43,7 @@ namespace detail size_type i ) const { - assert(i < col_size()); + assert(i < this->row_size()); return this->value[i]; } @@ -436,6 +436,10 @@ namespace detail m[1] * s); } + // X + // X + // X X + // X X template inline tmat2x2 operator* ( @@ -460,6 +464,9 @@ namespace detail m[0][1] * v.x + m[1][1] * v.y); } + // X X + // X X + // X X template inline typename tmat2x2::row_type operator* ( @@ -468,8 +475,8 @@ namespace detail ) { return detail::tvec2( - m[0][0] * v.x + m[0][1] * v.y, - m[1][0] * v.x + m[1][1] * v.y); + v.x * m[0][0] + v.y * m[0][1], + v.x * m[1][0] + v.y * m[1][1]); } template diff --git a/glm/core/type_mat2x3.inl b/glm/core/type_mat2x3.inl index 00871076..1b2f3a3f 100644 --- a/glm/core/type_mat2x3.inl +++ b/glm/core/type_mat2x3.inl @@ -32,7 +32,7 @@ namespace detail size_type i ) { - assert(i < col_size()); + assert(i < this->row_size()); return this->value[i]; } @@ -43,7 +43,7 @@ namespace detail size_type i ) const { - assert(i < col_size()); + assert(i < this->row_size()); return this->value[i]; } diff --git a/glm/core/type_mat2x4.inl b/glm/core/type_mat2x4.inl index 0f1bc4b8..007aae74 100644 --- a/glm/core/type_mat2x4.inl +++ b/glm/core/type_mat2x4.inl @@ -32,7 +32,7 @@ namespace detail size_type i ) { - assert(i < col_size()); + assert(i < this->row_size()); return this->value[i]; } @@ -43,7 +43,7 @@ namespace detail size_type i ) const { - assert(i < col_size()); + assert(i < this->row_size()); return this->value[i]; } @@ -433,8 +433,8 @@ namespace detail ) { 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); + v.x * m[0][0] + v.y * m[0][1] + v.z * m[0][2] + v.w * m[0][3], + v.x * m[1][0] + v.y * m[1][1] + v.z * m[1][2] + v.w * m[1][3]); } template diff --git a/glm/core/type_mat3x2.inl b/glm/core/type_mat3x2.inl index 6576cdcc..3f2d3b05 100644 --- a/glm/core/type_mat3x2.inl +++ b/glm/core/type_mat3x2.inl @@ -32,7 +32,7 @@ namespace detail size_type i ) { - assert(i < col_size()); + assert(i < this->row_size()); return this->value[i]; } @@ -43,7 +43,7 @@ namespace detail size_type i ) const { - assert(i < col_size()); + assert(i < this->row_size()); return this->value[i]; } @@ -384,7 +384,7 @@ namespace detail typename tmat3x2::value_type const & s ) { - return tmat3x4( + return tmat3x2( m[0] - s, m[1] - s, m[2] - s); @@ -420,7 +420,7 @@ namespace detail inline tmat3x2 operator* ( typename tmat3x2::value_type const & s, - const tmat3x2 & m + tmat3x2 const & m ) { return tmat3x2( @@ -474,7 +474,7 @@ namespace detail const T SrcB12 = m2[1][2]; tmat2x2 Result(tmat2x2::null); - Result[0][0] = SrcA00 * SrcB00 + SrcA01 * SrcB01 + SrcA20 * SrcB02; + Result[0][0] = SrcA00 * SrcB00 + SrcA10 * SrcB01 + SrcA20 * SrcB02; Result[0][1] = SrcA01 * SrcB00 + SrcA11 * SrcB01 + SrcA21 * SrcB02; Result[1][0] = SrcA00 * SrcB10 + SrcA10 * SrcB11 + SrcA20 * SrcB12; Result[1][1] = SrcA01 * SrcB10 + SrcA11 * SrcB11 + SrcA21 * SrcB12; diff --git a/glm/core/type_mat3x3.inl b/glm/core/type_mat3x3.inl index 7766dd4d..b99ab3c6 100644 --- a/glm/core/type_mat3x3.inl +++ b/glm/core/type_mat3x3.inl @@ -32,7 +32,7 @@ namespace detail size_type i ) { - assert(i < col_size()); + assert(i < this->row_size()); return this->value[i]; } @@ -43,7 +43,7 @@ namespace detail size_type i ) const { - assert(i < col_size()); + assert(i < this->row_size()); return this->value[i]; } @@ -348,18 +348,18 @@ namespace detail template inline tmat3x3 & tmat3x3::operator++ () { - this->value[0]++; - this->value[1]++; - this->value[2]++; + ++this->value[0]; + ++this->value[1]; + ++this->value[2]; return *this; } template inline tmat3x3 & tmat3x3::operator-- () { - this->value[0]--; - this->value[1]--; - this->value[2]--; + --this->value[0]; + --this->value[1]; + --this->value[2]; return *this; } diff --git a/glm/core/type_mat3x4.inl b/glm/core/type_mat3x4.inl index 104d802c..6fd8f2c8 100644 --- a/glm/core/type_mat3x4.inl +++ b/glm/core/type_mat3x4.inl @@ -32,7 +32,7 @@ namespace detail size_type i ) { - assert(i < col_size()); + assert(i < this->row_size()); return this->value[i]; } @@ -43,7 +43,7 @@ namespace detail size_type i ) const { - assert(i < col_size()); + assert(i < this->row_size()); return this->value[i]; } @@ -446,6 +446,11 @@ namespace detail m[0][3] * v.x + m[1][3] * v.y + m[2][3] * v.z); } + // X X X + // X X X + // X X X + // X X X + // X X X X template inline typename tmat3x4::row_type operator* ( @@ -454,9 +459,9 @@ namespace detail ) { 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); + v.x * m[0][0] + v.y * m[0][1] + v.z * m[0][2] + v.w * m[0][3], + v.x * m[1][0] + v.y * m[1][1] + v.z * m[1][2] + v.w * m[1][3], + v.x * m[2][0] + v.y * m[2][1] + v.z * m[2][2] + v.w * m[2][3]); } template diff --git a/glm/core/type_mat4x2.inl b/glm/core/type_mat4x2.inl index d61d624b..232675b8 100644 --- a/glm/core/type_mat4x2.inl +++ b/glm/core/type_mat4x2.inl @@ -32,7 +32,7 @@ namespace detail size_type i ) { - assert(i < col_size()); + assert(i < this->row_size()); return this->value[i]; } @@ -43,7 +43,7 @@ namespace detail size_type i ) const { - assert(i < col_size()); + assert(i < this->row_size()); return this->value[i]; } @@ -514,7 +514,7 @@ namespace detail T const SrcB13 = m2[1][3]; tmat2x2 Result(tmat2x2::null); - Result[0][0] = SrcA00 * SrcB00 + SrcA01 * SrcB01 + SrcA20 * SrcB02 + SrcA30 * SrcB03; + Result[0][0] = SrcA00 * SrcB00 + SrcA10 * SrcB01 + SrcA20 * SrcB02 + SrcA30 * SrcB03; Result[0][1] = SrcA01 * SrcB00 + SrcA11 * SrcB01 + SrcA21 * SrcB02 + SrcA31 * SrcB03; Result[1][0] = SrcA00 * SrcB10 + SrcA10 * SrcB11 + SrcA20 * SrcB12 + SrcA30 * SrcB13; Result[1][1] = SrcA01 * SrcB10 + SrcA11 * SrcB11 + SrcA21 * SrcB12 + SrcA31 * SrcB13; diff --git a/glm/core/type_mat4x3.inl b/glm/core/type_mat4x3.inl index 2a07c299..c66ccbec 100644 --- a/glm/core/type_mat4x3.inl +++ b/glm/core/type_mat4x3.inl @@ -32,7 +32,7 @@ namespace detail size_type i ) { - assert(i < col_size()); + assert(i < this->row_size()); return this->value[i]; } @@ -43,7 +43,7 @@ namespace detail size_type i ) const { - assert(i < col_size()); + assert(i < this->row_size()); return this->value[i]; } diff --git a/glm/core/type_mat4x4.inl b/glm/core/type_mat4x4.inl index 153a2c26..a344952d 100644 --- a/glm/core/type_mat4x4.inl +++ b/glm/core/type_mat4x4.inl @@ -32,7 +32,7 @@ namespace detail size_type i ) { - assert(i < col_size()); + assert(i < this->row_size()); return this->value[i]; } @@ -43,7 +43,7 @@ namespace detail size_type i ) const { - assert(i < col_size()); + assert(i < this->row_size()); return this->value[i]; }