Browse Source

Fixes submitted by ticket #30

Christophe Riccio 15 years ago
parent
commit
e07f5f1f24

+ 2 - 0
glm/core/dummy.cpp

@@ -18,6 +18,8 @@ int main()
 		glm::mat2x3 o = m / x;
 		glm::mat2x3 o = m / x;
 		glm::mat2x3 p = x * m;
 		glm::mat2x3 p = x * m;
 		glm::mat2x3 q = m * x;
 		glm::mat2x3 q = m * x;
+
+		glm::mat2x3::col_type v1 = m[3]
 	}
 	}
 
 
 	{
 	{

+ 11 - 4
glm/core/type_mat2x2.inl

@@ -32,7 +32,7 @@ namespace detail
 		size_type i
 		size_type i
 	)
 	)
 	{
 	{
-		assert(i < col_size());
+		assert(i < this->row_size());
 		return this->value[i];
 		return this->value[i];
 	}
 	}
 
 
@@ -43,7 +43,7 @@ namespace detail
 		size_type i
 		size_type i
 	) const
 	) const
 	{
 	{
-		assert(i < col_size());
+		assert(i < this->row_size());
 		return this->value[i];
 		return this->value[i];
 	}
 	}
 
 
@@ -436,6 +436,10 @@ namespace detail
             m[1] * s);
             m[1] * s);
     }
     }
 
 
+	//     X
+	//     X
+	// X X
+	// X X
     template <typename T> 
     template <typename T> 
     inline tmat2x2<T> operator* 
     inline tmat2x2<T> operator* 
 	(	
 	(	
@@ -460,6 +464,9 @@ namespace detail
             m[0][1] * v.x + m[1][1] * v.y);
             m[0][1] * v.x + m[1][1] * v.y);
     }
     }
 
 
+	//		X X
+	//		X X
+	// X X 
     template <typename T> 
     template <typename T> 
     inline typename tmat2x2<T>::row_type operator* 
     inline typename tmat2x2<T>::row_type operator* 
 	(
 	(
@@ -468,8 +475,8 @@ namespace detail
 	)
 	)
     {
     {
         return detail::tvec2<T>(
         return detail::tvec2<T>(
-            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 <typename T>
 	template <typename T>

+ 2 - 2
glm/core/type_mat2x3.inl

@@ -32,7 +32,7 @@ namespace detail
 		size_type i
 		size_type i
 	)
 	)
 	{
 	{
-		assert(i < col_size());
+		assert(i < this->row_size());
 		return this->value[i];
 		return this->value[i];
 	}
 	}
 
 
@@ -43,7 +43,7 @@ namespace detail
 		size_type i
 		size_type i
 	) const
 	) const
 	{
 	{
-		assert(i < col_size());
+		assert(i < this->row_size());
 		return this->value[i];
 		return this->value[i];
 	}
 	}
 
 

+ 4 - 4
glm/core/type_mat2x4.inl

@@ -32,7 +32,7 @@ namespace detail
 		size_type i
 		size_type i
 	)
 	)
 	{
 	{
-		assert(i < col_size());
+		assert(i < this->row_size());
 		return this->value[i];
 		return this->value[i];
 	}
 	}
 
 
@@ -43,7 +43,7 @@ namespace detail
 		size_type i
 		size_type i
 	) const
 	) const
 	{
 	{
-		assert(i < col_size());
+		assert(i < this->row_size());
 		return this->value[i];
 		return this->value[i];
 	}
 	}
 
 
@@ -433,8 +433,8 @@ namespace detail
 	) 
 	) 
     {
     {
         return typename tmat2x4<T>::row_type(
         return typename tmat2x4<T>::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 <typename T> 
     template <typename T> 

+ 5 - 5
glm/core/type_mat3x2.inl

@@ -32,7 +32,7 @@ namespace detail
 		size_type i
 		size_type i
 	)
 	)
 	{
 	{
-		assert(i < col_size());
+		assert(i < this->row_size());
 		return this->value[i];
 		return this->value[i];
 	}
 	}
 
 
@@ -43,7 +43,7 @@ namespace detail
 		size_type i
 		size_type i
 	) const
 	) const
 	{
 	{
-		assert(i < col_size());
+		assert(i < this->row_size());
 		return this->value[i];
 		return this->value[i];
 	}
 	}
 
 
@@ -384,7 +384,7 @@ namespace detail
 		typename tmat3x2<T>::value_type const & s
 		typename tmat3x2<T>::value_type const & s
 	)
 	)
     {
     {
-        return tmat3x4<T>(
+        return tmat3x2<T>(
             m[0] - s,
             m[0] - s,
             m[1] - s,
             m[1] - s,
             m[2] - s);
             m[2] - s);
@@ -420,7 +420,7 @@ namespace detail
     inline tmat3x2<T> operator* 
     inline tmat3x2<T> operator* 
 	(
 	(
 		typename tmat3x2<T>::value_type const & s, 
 		typename tmat3x2<T>::value_type const & s, 
-		const tmat3x2<T> & m
+		tmat3x2<T> const & m
 	)
 	)
     {
     {
         return tmat3x2<T>(
         return tmat3x2<T>(
@@ -474,7 +474,7 @@ namespace detail
         const T SrcB12 = m2[1][2];
         const T SrcB12 = m2[1][2];
 
 
         tmat2x2<T> Result(tmat2x2<T>::null);
         tmat2x2<T> Result(tmat2x2<T>::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[0][1] = SrcA01 * SrcB00 + SrcA11 * SrcB01 + SrcA21 * SrcB02;
         Result[1][0] = SrcA00 * SrcB10 + SrcA10 * SrcB11 + SrcA20 * SrcB12;
         Result[1][0] = SrcA00 * SrcB10 + SrcA10 * SrcB11 + SrcA20 * SrcB12;
         Result[1][1] = SrcA01 * SrcB10 + SrcA11 * SrcB11 + SrcA21 * SrcB12;
         Result[1][1] = SrcA01 * SrcB10 + SrcA11 * SrcB11 + SrcA21 * SrcB12;

+ 8 - 8
glm/core/type_mat3x3.inl

@@ -32,7 +32,7 @@ namespace detail
 		size_type i
 		size_type i
 	)
 	)
 	{
 	{
-		assert(i < col_size());
+		assert(i < this->row_size());
 		return this->value[i];
 		return this->value[i];
 	}
 	}
 
 
@@ -43,7 +43,7 @@ namespace detail
 		size_type i
 		size_type i
 	) const
 	) const
 	{
 	{
-		assert(i < col_size());
+		assert(i < this->row_size());
 		return this->value[i];
 		return this->value[i];
 	}
 	}
 
 
@@ -348,18 +348,18 @@ namespace detail
     template <typename T> 
     template <typename T> 
     inline tmat3x3<T> & tmat3x3<T>::operator++ ()
     inline tmat3x3<T> & tmat3x3<T>::operator++ ()
     {
     {
-	    this->value[0]++;
-	    this->value[1]++;
-        this->value[2]++;
+	    ++this->value[0];
+	    ++this->value[1];
+        ++this->value[2];
 	    return *this;
 	    return *this;
     }
     }
 
 
     template <typename T> 
     template <typename T> 
     inline tmat3x3<T> & tmat3x3<T>::operator-- ()
     inline tmat3x3<T> & tmat3x3<T>::operator-- ()
     {
     {
-	    this->value[0]--;
-	    this->value[1]--;
-        this->value[2]--;
+	    --this->value[0];
+	    --this->value[1];
+        --this->value[2];
 	    return *this;
 	    return *this;
     }
     }
 
 

+ 10 - 5
glm/core/type_mat3x4.inl

@@ -32,7 +32,7 @@ namespace detail
 		size_type i
 		size_type i
 	)
 	)
 	{
 	{
-		assert(i < col_size());
+		assert(i < this->row_size());
 		return this->value[i];
 		return this->value[i];
 	}
 	}
 
 
@@ -43,7 +43,7 @@ namespace detail
 		size_type i
 		size_type i
 	) const
 	) const
 	{
 	{
-		assert(i < col_size());
+		assert(i < this->row_size());
 		return this->value[i];
 		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);
             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 <typename T> 
     template <typename T> 
     inline typename tmat3x4<T>::row_type operator* 
     inline typename tmat3x4<T>::row_type operator* 
 	(
 	(
@@ -454,9 +459,9 @@ namespace detail
 	)
 	)
     {
     {
 		return typename tmat3x4<T>::row_type(
 		return typename tmat3x4<T>::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 <typename T> 
     template <typename T> 

+ 3 - 3
glm/core/type_mat4x2.inl

@@ -32,7 +32,7 @@ namespace detail
 		size_type i
 		size_type i
 	)
 	)
 	{
 	{
-		assert(i < col_size());
+		assert(i < this->row_size());
 		return this->value[i];
 		return this->value[i];
 	}
 	}
 
 
@@ -43,7 +43,7 @@ namespace detail
 		size_type i
 		size_type i
 	) const
 	) const
 	{
 	{
-		assert(i < col_size());
+		assert(i < this->row_size());
 		return this->value[i];
 		return this->value[i];
 	}
 	}
 
 
@@ -514,7 +514,7 @@ namespace detail
         T const SrcB13 = m2[1][3];
         T const SrcB13 = m2[1][3];
 
 
         tmat2x2<T> Result(tmat2x2<T>::null);
         tmat2x2<T> Result(tmat2x2<T>::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[0][1] = SrcA01 * SrcB00 + SrcA11 * SrcB01 + SrcA21 * SrcB02 + SrcA31 * SrcB03;
         Result[1][0] = SrcA00 * SrcB10 + SrcA10 * SrcB11 + SrcA20 * SrcB12 + SrcA30 * SrcB13;
         Result[1][0] = SrcA00 * SrcB10 + SrcA10 * SrcB11 + SrcA20 * SrcB12 + SrcA30 * SrcB13;
         Result[1][1] = SrcA01 * SrcB10 + SrcA11 * SrcB11 + SrcA21 * SrcB12 + SrcA31 * SrcB13;
         Result[1][1] = SrcA01 * SrcB10 + SrcA11 * SrcB11 + SrcA21 * SrcB12 + SrcA31 * SrcB13;

+ 2 - 2
glm/core/type_mat4x3.inl

@@ -32,7 +32,7 @@ namespace detail
 		size_type i
 		size_type i
 	)
 	)
 	{
 	{
-		assert(i < col_size());
+		assert(i < this->row_size());
 		return this->value[i];
 		return this->value[i];
 	}
 	}
 
 
@@ -43,7 +43,7 @@ namespace detail
 		size_type i
 		size_type i
 	) const
 	) const
 	{
 	{
-		assert(i < col_size());
+		assert(i < this->row_size());
 		return this->value[i];
 		return this->value[i];
 	}
 	}
 
 

+ 2 - 2
glm/core/type_mat4x4.inl

@@ -32,7 +32,7 @@ namespace detail
 		size_type i
 		size_type i
 	)
 	)
 	{
 	{
-		assert(i < col_size());
+		assert(i < this->row_size());
 		return this->value[i];
 		return this->value[i];
 	}
 	}
 
 
@@ -43,7 +43,7 @@ namespace detail
 		size_type i
 		size_type i
 	) const
 	) const
 	{
 	{
-		assert(i < col_size());
+		assert(i < this->row_size());
 		return this->value[i];
 		return this->value[i];
 	}
 	}