Added matrix inverse tests and clean up space characters

master
Christophe Riccio ago%!(EXTRA string=13 years)
parent c9a0b87c7b
commit 4fff9b4367
  1. 7
      glm/core/type_mat2x2.inl
  2. 581
      glm/core/type_mat2x3.inl
  3. 1
      glm/core/type_mat2x4.inl
  4. 29
      glm/core/type_mat3x2.hpp
  5. 700
      glm/core/type_mat3x2.inl
  6. 33
      glm/core/type_mat3x3.hpp
  7. 752
      glm/core/type_mat3x4.inl
  8. 31
      glm/core/type_mat4x2.hpp
  9. 785
      glm/core/type_mat4x2.inl
  10. 33
      glm/core/type_mat4x3.hpp
  11. 823
      glm/core/type_mat4x3.inl
  12. 30
      glm/core/type_mat4x4.hpp
  13. 962
      glm/core/type_mat4x4.inl
  14. 14
      glm/core/type_vec2.hpp
  15. 1
      glm/core/type_vec2.inl
  16. 38
      glm/core/type_vec3.hpp
  17. 82
      glm/core/type_vec4.hpp
  18. 8
      glm/gtc/epsilon.hpp
  19. 199
      glm/gtc/epsilon.inl
  20. 22
      test/core/core_type_mat2x2.cpp
  21. 34
      test/core/core_type_mat3x3.cpp
  22. 75
      test/core/core_type_mat4x4.cpp

@ -499,10 +499,6 @@ namespace detail
m[1] * s); m[1] * s);
} }
// X
// X
// X X
// X X
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x2<T> operator* GLM_FUNC_QUALIFIER tmat2x2<T> operator*
( (
@ -527,9 +523,6 @@ 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>
GLM_FUNC_QUALIFIER typename tmat2x2<T>::row_type operator* GLM_FUNC_QUALIFIER typename tmat2x2<T>::row_type operator*
( (

@ -29,11 +29,11 @@
namespace glm{ namespace glm{
namespace detail namespace detail
{ {
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat2x3<T>::size_type tmat2x3<T>::length() const GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat2x3<T>::size_type tmat2x3<T>::length() const
{ {
return 2; return 2;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER typename tmat2x3<T>::size_type tmat2x3<T>::col_size() GLM_FUNC_QUALIFIER typename tmat2x3<T>::size_type tmat2x3<T>::col_size()
@ -72,64 +72,64 @@ namespace detail
return this->value[i]; return this->value[i];
} }
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
// Constructors // Constructors
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3() GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3()
{ {
this->value[0] = col_type(T(1), T(0), T(0)); this->value[0] = col_type(T(1), T(0), T(0));
this->value[1] = col_type(T(0), T(1), T(0)); this->value[1] = col_type(T(0), T(1), T(0));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3 GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3
( (
tmat2x3<T> const & m tmat2x3<T> const & m
) )
{ {
this->value[0] = m.value[0]; this->value[0] = m.value[0];
this->value[1] = m.value[1]; this->value[1] = m.value[1];
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3 GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3
( (
ctor ctor
) )
{} {}
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3 GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3
( (
value_type const & s value_type const & s
) )
{ {
this->value[0] = col_type(s, T(0), T(0)); this->value[0] = col_type(s, T(0), T(0));
this->value[1] = col_type(T(0), s, T(0)); this->value[1] = col_type(T(0), s, T(0));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3 GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3
( (
value_type const & x0, value_type const & y0, value_type const & z0, value_type const & x0, value_type const & y0, value_type const & z0,
value_type const & x1, value_type const & y1, value_type const & z1 value_type const & x1, value_type const & y1, value_type const & z1
) )
{ {
this->value[0] = col_type(x0, y0, z0); this->value[0] = col_type(x0, y0, z0);
this->value[1] = col_type(x1, y1, z1); this->value[1] = col_type(x1, y1, z1);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3 GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3
( (
col_type const & v0, col_type const & v0,
col_type const & v1 col_type const & v1
) )
{ {
this->value[0] = v0; this->value[0] = v0;
this->value[1] = v1; this->value[1] = v1;
} }
////////////////////////////////////// //////////////////////////////////////
// Convertion constructors // Convertion constructors
@ -141,8 +141,8 @@ namespace detail
) )
{ {
value_type const Zero(0); value_type const Zero(0);
this->value[0] = tvec3<T>(value_type(s), Zero, Zero); this->value[0] = tvec3<T>(value_type(s), Zero, Zero);
this->value[1] = tvec3<T>(Zero, value_type(s), Zero); this->value[1] = tvec3<T>(Zero, value_type(s), Zero);
} }
template <typename T> template <typename T>
@ -155,8 +155,8 @@ namespace detail
X2 const & x2, Y2 const & y2, Z2 const & z2 X2 const & x2, Y2 const & y2, Z2 const & z2
) )
{ {
this->value[0] = col_type(value_type(x1), value_type(y1), value_type(z1)); this->value[0] = col_type(value_type(x1), value_type(y1), value_type(z1));
this->value[1] = col_type(value_type(x2), value_type(y2), value_type(z2)); this->value[1] = col_type(value_type(x2), value_type(y2), value_type(z2));
} }
template <typename T> template <typename T>
@ -167,325 +167,325 @@ namespace detail
tvec3<V2> const & v2 tvec3<V2> const & v2
) )
{ {
this->value[0] = col_type(v1); this->value[0] = col_type(v1);
this->value[1] = col_type(v2); this->value[1] = col_type(v2);
} }
////////////////////////////////////// //////////////////////////////////////
// Matrix conversions // Matrix conversions
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3 GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3
( (
tmat2x3<U> const & m tmat2x3<U> const & m
) )
{ {
this->value[0] = col_type(m[0]); this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]); this->value[1] = col_type(m[1]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3 GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3
( (
tmat2x2<T> const & m tmat2x2<T> const & m
) )
{ {
this->value[0] = col_type(m[0], T(0)); this->value[0] = col_type(m[0], T(0));
this->value[1] = col_type(m[1], T(0)); this->value[1] = col_type(m[1], T(0));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3 GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3
( (
tmat3x3<T> const & m tmat3x3<T> const & m
) )
{ {
this->value[0] = col_type(m[0]); this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]); this->value[1] = col_type(m[1]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3 GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3
( (
tmat4x4<T> const & m tmat4x4<T> const & m
) )
{ {
this->value[0] = col_type(m[0]); this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]); this->value[1] = col_type(m[1]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3 GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3
( (
tmat2x4<T> const & m tmat2x4<T> const & m
) )
{ {
this->value[0] = col_type(m[0]); this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]); this->value[1] = col_type(m[1]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3 GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3
( (
tmat3x2<T> const & m tmat3x2<T> const & m
) )
{ {
this->value[0] = col_type(m[0], T(0)); this->value[0] = col_type(m[0], T(0));
this->value[1] = col_type(m[1], T(0)); this->value[1] = col_type(m[1], T(0));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3 GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3
( (
tmat3x4<T> const & m tmat3x4<T> const & m
) )
{ {
this->value[0] = col_type(m[0]); this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]); this->value[1] = col_type(m[1]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3 GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3
( (
tmat4x2<T> const & m tmat4x2<T> const & m
) )
{ {
this->value[0] = col_type(m[0], T(0)); this->value[0] = col_type(m[0], T(0));
this->value[1] = col_type(m[1], T(0)); this->value[1] = col_type(m[1], T(0));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3 GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3
( (
tmat4x3<T> const & m tmat4x3<T> const & m
) )
{ {
this->value[0] = m[0]; this->value[0] = m[0];
this->value[1] = m[1]; this->value[1] = m[1];
} }
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
// Unary updatable operators // Unary updatable operators
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x3<T>& tmat2x3<T>::operator= GLM_FUNC_QUALIFIER tmat2x3<T>& tmat2x3<T>::operator=
( (
tmat2x3<T> const & m tmat2x3<T> const & m
) )
{ {
this->value[0] = m[0]; this->value[0] = m[0];
this->value[1] = m[1]; this->value[1] = m[1];
return *this; return *this;
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat2x3<T>& tmat2x3<T>::operator= GLM_FUNC_QUALIFIER tmat2x3<T>& tmat2x3<T>::operator=
( (
tmat2x3<U> const & m tmat2x3<U> const & m
) )
{ {
this->value[0] = m[0]; this->value[0] = m[0];
this->value[1] = m[1]; this->value[1] = m[1];
return *this; return *this;
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat2x3<T> & tmat2x3<T>::operator+= GLM_FUNC_QUALIFIER tmat2x3<T> & tmat2x3<T>::operator+=
( (
U const & s U const & s
) )
{ {
this->value[0] += s; this->value[0] += s;
this->value[1] += s; this->value[1] += s;
return *this; return *this;
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat2x3<T>& tmat2x3<T>::operator+= GLM_FUNC_QUALIFIER tmat2x3<T>& tmat2x3<T>::operator+=
( (
tmat2x3<U> const & m tmat2x3<U> const & m
) )
{ {
this->value[0] += m[0]; this->value[0] += m[0];
this->value[1] += m[1]; this->value[1] += m[1];
return *this; return *this;
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat2x3<T>& tmat2x3<T>::operator-= GLM_FUNC_QUALIFIER tmat2x3<T>& tmat2x3<T>::operator-=
( (
U const & s U const & s
) )
{ {
this->value[0] -= s; this->value[0] -= s;
this->value[1] -= s; this->value[1] -= s;
return *this; return *this;
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat2x3<T>& tmat2x3<T>::operator-= GLM_FUNC_QUALIFIER tmat2x3<T>& tmat2x3<T>::operator-=
( (
tmat2x3<U> const & m tmat2x3<U> const & m
) )
{ {
this->value[0] -= m[0]; this->value[0] -= m[0];
this->value[1] -= m[1]; this->value[1] -= m[1];
return *this; return *this;
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat2x3<T>& tmat2x3<T>::operator*= GLM_FUNC_QUALIFIER tmat2x3<T>& tmat2x3<T>::operator*=
( (
U const & s U const & s
) )
{ {
this->value[0] *= s; this->value[0] *= s;
this->value[1] *= s; this->value[1] *= s;
return *this; return *this;
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat2x3<T> & tmat2x3<T>::operator*= GLM_FUNC_QUALIFIER tmat2x3<T> & tmat2x3<T>::operator*=
( (
tmat2x3<U> const & m tmat2x3<U> const & m
) )
{ {
return (*this = tmat2x3<U>(*this * m)); return (*this = tmat2x3<U>(*this * m));
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat2x3<T> & tmat2x3<T>::operator/= GLM_FUNC_QUALIFIER tmat2x3<T> & tmat2x3<T>::operator/=
( (
U const & s U const & s
) )
{ {
this->value[0] /= s; this->value[0] /= s;
this->value[1] /= s; this->value[1] /= s;
return *this; return *this;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x3<T> & tmat2x3<T>::operator++ () GLM_FUNC_QUALIFIER tmat2x3<T> & tmat2x3<T>::operator++ ()
{ {
++this->value[0]; ++this->value[0];
++this->value[1]; ++this->value[1];
return *this; return *this;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x3<T> & tmat2x3<T>::operator-- () GLM_FUNC_QUALIFIER tmat2x3<T> & tmat2x3<T>::operator-- ()
{ {
--this->value[0]; --this->value[0];
--this->value[1]; --this->value[1];
return *this; return *this;
} }
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
// Binary operators // Binary operators
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x3<T> operator+ GLM_FUNC_QUALIFIER tmat2x3<T> operator+
( (
tmat2x3<T> const & m, tmat2x3<T> const & m,
typename tmat2x3<T>::value_type const & s typename tmat2x3<T>::value_type const & s
) )
{ {
return tmat2x3<T>( return tmat2x3<T>(
m[0] + s, m[0] + s,
m[1] + s); m[1] + s);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x3<T> operator+ GLM_FUNC_QUALIFIER tmat2x3<T> operator+
( (
tmat2x3<T> const & m1, tmat2x3<T> const & m1,
tmat2x3<T> const & m2 tmat2x3<T> const & m2
) )
{ {
return tmat2x3<T>( return tmat2x3<T>(
m1[0] + m2[0], m1[0] + m2[0],
m1[1] + m2[1]); m1[1] + m2[1]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x3<T> operator- GLM_FUNC_QUALIFIER tmat2x3<T> operator-
( (
tmat2x3<T> const & m, tmat2x3<T> const & m,
typename tmat2x3<T>::value_type const & s typename tmat2x3<T>::value_type const & s
) )
{ {
return tmat2x3<T>( return tmat2x3<T>(
m[0] - s, m[0] - s,
m[1] - s); m[1] - s);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x3<T> operator- GLM_FUNC_QUALIFIER tmat2x3<T> operator-
( (
tmat2x3<T> const & m1, tmat2x3<T> const & m1,
tmat2x3<T> const & m2 tmat2x3<T> const & m2
) )
{ {
return tmat2x3<T>( return tmat2x3<T>(
m1[0] - m2[0], m1[0] - m2[0],
m1[1] - m2[1]); m1[1] - m2[1]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x3<T> operator* GLM_FUNC_QUALIFIER tmat2x3<T> operator*
( (
tmat2x3<T> const & m, tmat2x3<T> const & m,
typename tmat2x3<T>::value_type const & s typename tmat2x3<T>::value_type const & s
) )
{ {
return tmat2x3<T>( return tmat2x3<T>(
m[0] * s, m[0] * s,
m[1] * s); m[1] * s);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x3<T> operator* GLM_FUNC_QUALIFIER tmat2x3<T> operator*
( (
typename tmat2x3<T>::value_type const & s, typename tmat2x3<T>::value_type const & s,
tmat2x3<T> const & m tmat2x3<T> const & m
) )
{ {
return tmat2x3<T>( return tmat2x3<T>(
m[0] * s, m[0] * s,
m[1] * s); m[1] * s);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER typename tmat2x3<T>::col_type operator* GLM_FUNC_QUALIFIER typename tmat2x3<T>::col_type operator*
( (
tmat2x3<T> const & m, tmat2x3<T> const & m,
typename tmat2x3<T>::row_type const & v) typename tmat2x3<T>::row_type const & v)
{ {
return typename tmat2x3<T>::col_type( return typename tmat2x3<T>::col_type(
m[0][0] * v.x + m[1][0] * v.y, m[0][0] * v.x + m[1][0] * v.y,
m[0][1] * v.x + m[1][1] * v.y, m[0][1] * v.x + m[1][1] * v.y,
m[0][2] * v.x + m[1][2] * v.y); m[0][2] * v.x + m[1][2] * v.y);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER typename tmat2x3<T>::row_type operator* GLM_FUNC_QUALIFIER typename tmat2x3<T>::row_type operator*
( (
typename tmat2x3<T>::col_type const & v, typename tmat2x3<T>::col_type const & v,
tmat2x3<T> const & m) tmat2x3<T> const & m)
{ {
return typename tmat2x3<T>::row_type( return typename tmat2x3<T>::row_type(
v.x * m[0][0] + v.y * m[0][1] + v.z * m[0][2], 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[1][0] + v.y * m[1][1] + v.z * m[1][2]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x3<T> operator* GLM_FUNC_QUALIFIER tmat2x3<T> operator*
@ -503,13 +503,13 @@ namespace detail
m1[0][2] * m2[1][0] + m1[1][2] * m2[1][1]); m1[0][2] * m2[1][0] + m1[1][2] * m2[1][1]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x3<T> operator* GLM_FUNC_QUALIFIER tmat3x3<T> operator*
( (
tmat2x3<T> const & m1, tmat2x3<T> const & m1,
tmat3x2<T> const & m2 tmat3x2<T> const & m2
) )
{ {
typename tmat2x3<T>::value_type SrcA00 = m1[0][0]; typename tmat2x3<T>::value_type SrcA00 = m1[0][0];
typename tmat2x3<T>::value_type SrcA01 = m1[0][1]; typename tmat2x3<T>::value_type SrcA01 = m1[0][1];
typename tmat2x3<T>::value_type SrcA02 = m1[0][2]; typename tmat2x3<T>::value_type SrcA02 = m1[0][2];
@ -535,7 +535,7 @@ namespace detail
Result[2][1] = SrcA01 * SrcB20 + SrcA11 * SrcB21; Result[2][1] = SrcA01 * SrcB20 + SrcA11 * SrcB21;
Result[2][2] = SrcA02 * SrcB20 + SrcA12 * SrcB21; Result[2][2] = SrcA02 * SrcB20 + SrcA12 * SrcB21;
return Result; return Result;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat4x3<T> operator* GLM_FUNC_QUALIFIER tmat4x3<T> operator*
@ -559,65 +559,65 @@ namespace detail
m1[0][2] * m2[3][0] + m1[1][2] * m2[3][1]); m1[0][2] * m2[3][0] + m1[1][2] * m2[3][1]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x3<T> operator/ GLM_FUNC_QUALIFIER tmat2x3<T> operator/
( (
tmat2x3<T> const & m, tmat2x3<T> const & m,
typename tmat2x3<T>::value_type const & s typename tmat2x3<T>::value_type const & s
) )
{ {
return tmat2x3<T>( return tmat2x3<T>(
m[0] / s, m[0] / s,
m[1] / s); m[1] / s);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x3<T> operator/ GLM_FUNC_QUALIFIER tmat2x3<T> operator/
( (
typename tmat2x3<T>::value_type const & s, typename tmat2x3<T>::value_type const & s,
tmat2x3<T> const & m tmat2x3<T> const & m
) )
{ {
return tmat2x3<T>( return tmat2x3<T>(
s / m[0], s / m[0],
s / m[1]); s / m[1]);
} }
// Unary constant operators // Unary constant operators
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x3<T> const operator- GLM_FUNC_QUALIFIER tmat2x3<T> const operator-
( (
tmat2x3<T> const & m tmat2x3<T> const & m
) )
{ {
return tmat2x3<T>( return tmat2x3<T>(
-m[0], -m[0],
-m[1]); -m[1]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x3<T> const operator++ GLM_FUNC_QUALIFIER tmat2x3<T> const operator++
( (
tmat2x3<T> const & m, tmat2x3<T> const & m,
int int
) )
{ {
return tmat2x3<T>( return tmat2x3<T>(
m[0] + typename tmat2x3<T>::value_type(1), m[0] + typename tmat2x3<T>::value_type(1),
m[1] + typename tmat2x3<T>::value_type(1)); m[1] + typename tmat2x3<T>::value_type(1));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x3<T> const operator-- GLM_FUNC_QUALIFIER tmat2x3<T> const operator--
( (
tmat2x3<T> const & m, tmat2x3<T> const & m,
int int
) )
{ {
return tmat2x3<T>( return tmat2x3<T>(
m[0] - typename tmat2x3<T>::value_type(1), m[0] - typename tmat2x3<T>::value_type(1),
m[1] - typename tmat2x3<T>::value_type(1)); m[1] - typename tmat2x3<T>::value_type(1));
} }
////////////////////////////////////// //////////////////////////////////////
// Boolean operators // Boolean operators
@ -641,6 +641,5 @@ namespace detail
{ {
return (m1[0] != m2[0]) || (m1[1] != m2[1]); return (m1[0] != m2[0]) || (m1[1] != m2[1]);
} }
} //namespace detail } //namespace detail
} //namespace glm } //namespace glm

@ -660,6 +660,5 @@ namespace detail
{ {
return (m1[0] != m2[0]) || (m1[1] != m2[1]); return (m1[0] != m2[0]) || (m1[1] != m2[1]);
} }
} //namespace detail } //namespace detail
} //namespace glm } //namespace glm

@ -48,8 +48,8 @@ namespace detail
template <typename T> struct tmat4x3; template <typename T> struct tmat4x3;
template <typename T> struct tmat4x4; template <typename T> struct tmat4x4;
// \brief Template for 3 columns and 2 rows matrix of floating-point numbers. /// @brief Template for 3 columns and 2 rows matrix of floating-point numbers.
// \ingroup core_template /// @ingroup core_template
template <typename T> template <typename T>
struct tmat3x2 struct tmat3x2
{ {
@ -92,24 +92,24 @@ namespace detail
// Conversions // Conversions
template <typename U> template <typename U>
GLM_FUNC_DECL explicit tmat3x2( GLM_FUNC_DECL explicit tmat3x2(
U const & x); U const & x);
template template
< <
typename X1, typename Y1, typename X1, typename Y1,
typename X2, typename Y2, typename X2, typename Y2,
typename X3, typename Y3 typename X3, typename Y3
> >
GLM_FUNC_DECL explicit tmat3x2( GLM_FUNC_DECL explicit tmat3x2(
X1 const & x1, Y1 const & y1, X1 const & x1, Y1 const & y1,
X2 const & x2, Y2 const & y2, X2 const & x2, Y2 const & y2,
X3 const & x3, Y3 const & y3); X3 const & x3, Y3 const & y3);
template <typename V1, typename V2, typename V3> template <typename V1, typename V2, typename V3>
GLM_FUNC_DECL explicit tmat3x2( GLM_FUNC_DECL explicit tmat3x2(
tvec2<V1> const & v1, tvec2<V1> const & v1,
tvec2<V2> const & v2, tvec2<V2> const & v2,
tvec2<V3> const & v3); tvec2<V3> const & v3);
// Matrix conversions // Matrix conversions
template <typename U> template <typename U>
@ -231,7 +231,6 @@ namespace detail
tmat3x2<T> const operator++ ( tmat3x2<T> const operator++ (
tmat3x2<T> const & m, tmat3x2<T> const & m,
int); int);
} //namespace detail } //namespace detail
/// @addtogroup core_precision /// @addtogroup core_precision

@ -29,11 +29,11 @@
namespace glm{ namespace glm{
namespace detail namespace detail
{ {
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat3x2<T>::size_type tmat3x2<T>::length() const GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat3x2<T>::size_type tmat3x2<T>::length() const
{ {
return 3; return 3;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER typename tmat3x2<T>::size_type tmat3x2<T>::col_size() GLM_FUNC_QUALIFIER typename tmat3x2<T>::size_type tmat3x2<T>::col_size()
@ -72,71 +72,71 @@ namespace detail
return this->value[i]; return this->value[i];
} }
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
// Constructors // Constructors
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2() GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2()
{ {
this->value[0] = col_type(1, 0); this->value[0] = col_type(1, 0);
this->value[1] = col_type(0, 1); this->value[1] = col_type(0, 1);
this->value[2] = col_type(0, 0); this->value[2] = col_type(0, 0);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2 GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2
( (
tmat3x2<T> const & m tmat3x2<T> const & m
) )
{ {
this->value[0] = m.value[0]; this->value[0] = m.value[0];
this->value[1] = m.value[1]; this->value[1] = m.value[1];
this->value[2] = m.value[2]; this->value[2] = m.value[2];
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2 GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2
( (
ctor ctor
) )
{} {}
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2 GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2
( (
value_type const & s value_type const & s
) )
{ {
this->value[0] = col_type(s, 0); this->value[0] = col_type(s, 0);
this->value[1] = col_type(0, s); this->value[1] = col_type(0, s);
this->value[2] = col_type(0, 0); this->value[2] = col_type(0, 0);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2 GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2
( (
value_type const & x0, value_type const & y0, value_type const & x0, value_type const & y0,
value_type const & x1, value_type const & y1, value_type const & x1, value_type const & y1,
value_type const & x2, value_type const & y2 value_type const & x2, value_type const & y2
) )
{ {
this->value[0] = col_type(x0, y0); this->value[0] = col_type(x0, y0);
this->value[1] = col_type(x1, y1); this->value[1] = col_type(x1, y1);
this->value[2] = col_type(x2, y2); this->value[2] = col_type(x2, y2);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2 GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2
( (
col_type const & v0, col_type const & v0,
col_type const & v1, col_type const & v1,
col_type const & v2 col_type const & v2
) )
{ {
this->value[0] = v0; this->value[0] = v0;
this->value[1] = v1; this->value[1] = v1;
this->value[2] = v2; this->value[2] = v2;
} }
////////////////////////////////////// //////////////////////////////////////
// Convertion constructors // Convertion constructors
@ -148,9 +148,9 @@ namespace detail
) )
{ {
value_type const Zero(0); value_type const Zero(0);
this->value[0] = tvec2<T>(value_type(s), Zero); this->value[0] = tvec2<T>(value_type(s), Zero);
this->value[1] = tvec2<T>(Zero, value_type(s)); this->value[1] = tvec2<T>(Zero, value_type(s));
this->value[2] = tvec2<T>(Zero); this->value[2] = tvec2<T>(Zero);
} }
template <typename T> template <typename T>
@ -165,9 +165,9 @@ namespace detail
X3 const & x3, Y3 const & y3 X3 const & x3, Y3 const & y3
) )
{ {
this->value[0] = col_type(value_type(x1), value_type(y1)); this->value[0] = col_type(value_type(x1), value_type(y1));
this->value[1] = col_type(value_type(x2), value_type(y2)); this->value[1] = col_type(value_type(x2), value_type(y2));
this->value[2] = col_type(value_type(x3), value_type(y3)); this->value[2] = col_type(value_type(x3), value_type(y3));
} }
template <typename T> template <typename T>
@ -179,380 +179,380 @@ namespace detail
tvec2<V3> const & v3 tvec2<V3> const & v3
) )
{ {
this->value[0] = col_type(v1); this->value[0] = col_type(v1);
this->value[1] = col_type(v2); this->value[1] = col_type(v2);
this->value[2] = col_type(v3); this->value[2] = col_type(v3);
} }
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
// mat3x2 matrix conversions // mat3x2 matrix conversions
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2 GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2
( (
tmat3x2<U> const & m tmat3x2<U> const & m
) )
{ {
this->value[0] = col_type(m[0]); this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]); this->value[1] = col_type(m[1]);
this->value[2] = col_type(m[2]); this->value[2] = col_type(m[2]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2 GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2
( (
tmat2x2<T> const & m tmat2x2<T> const & m
) )
{ {
this->value[0] = m[0]; this->value[0] = m[0];
this->value[1] = m[1]; this->value[1] = m[1];
this->value[2] = col_type(T(0)); this->value[2] = col_type(T(0));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2 GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2
( (
tmat3x3<T> const & m tmat3x3<T> const & m
) )
{ {
this->value[0] = col_type(m[0]); this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]); this->value[1] = col_type(m[1]);
this->value[2] = col_type(m[2]); this->value[2] = col_type(m[2]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2 GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2
( (
tmat4x4<T> const & m tmat4x4<T> const & m
) )
{ {
this->value[0] = col_type(m[0]); this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]); this->value[1] = col_type(m[1]);
this->value[2] = col_type(m[2]); this->value[2] = col_type(m[2]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2 GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2
( (
tmat2x3<T> const & m tmat2x3<T> const & m
) )
{ {
this->value[0] = col_type(m[0]); this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]); this->value[1] = col_type(m[1]);
this->value[2] = col_type(T(0)); this->value[2] = col_type(T(0));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2 GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2
( (
tmat2x4<T> const & m tmat2x4<T> const & m
) )
{ {
this->value[0] = col_type(m[0]); this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]); this->value[1] = col_type(m[1]);
this->value[2] = col_type(T(0)); this->value[2] = col_type(T(0));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2 GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2
( (
tmat3x4<T> const & m tmat3x4<T> const & m
) )
{ {
this->value[0] = col_type(m[0]); this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]); this->value[1] = col_type(m[1]);
this->value[2] = col_type(m[2]); this->value[2] = col_type(m[2]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2 GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2
( (
tmat4x2<T> const & m tmat4x2<T> const & m
) )
{ {
this->value[0] = m[0]; this->value[0] = m[0];
this->value[1] = m[1]; this->value[1] = m[1];
this->value[2] = m[2]; this->value[2] = m[2];
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2 GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2
( (
tmat4x3<T> const & m tmat4x3<T> const & m
) )
{ {
this->value[0] = col_type(m[0]); this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]); this->value[1] = col_type(m[1]);
this->value[2] = col_type(m[2]); this->value[2] = col_type(m[2]);
} }
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
// Unary updatable operators // Unary updatable operators
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x2<T>& tmat3x2<T>::operator= GLM_FUNC_QUALIFIER tmat3x2<T>& tmat3x2<T>::operator=
( (
tmat3x2<T> const & m tmat3x2<T> const & m
) )
{ {
this->value[0] = m[0]; this->value[0] = m[0];
this->value[1] = m[1]; this->value[1] = m[1];
this->value[2] = m[2]; this->value[2] = m[2];
return *this; return *this;
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat3x2<T>& tmat3x2<T>::operator= GLM_FUNC_QUALIFIER tmat3x2<T>& tmat3x2<T>::operator=
( (
tmat3x2<U> const & m tmat3x2<U> const & m
) )
{ {
this->value[0] = m[0]; this->value[0] = m[0];
this->value[1] = m[1]; this->value[1] = m[1];
this->value[2] = m[2]; this->value[2] = m[2];
return *this; return *this;
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat3x2<T>& tmat3x2<T>::operator+= GLM_FUNC_QUALIFIER tmat3x2<T>& tmat3x2<T>::operator+=
( (
U const & s U const & s
) )
{ {
this->value[0] += s; this->value[0] += s;
this->value[1] += s; this->value[1] += s;
this->value[2] += s; this->value[2] += s;
return *this; return *this;
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat3x2<T>& tmat3x2<T>::operator+= GLM_FUNC_QUALIFIER tmat3x2<T>& tmat3x2<T>::operator+=
( (
tmat3x2<U> const & m tmat3x2<U> const & m
) )
{ {
this->value[0] += m[0]; this->value[0] += m[0];
this->value[1] += m[1]; this->value[1] += m[1];
this->value[2] += m[2]; this->value[2] += m[2];
return *this; return *this;
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat3x2<T>& tmat3x2<T>::operator-= GLM_FUNC_QUALIFIER tmat3x2<T>& tmat3x2<T>::operator-=
( (
U const & s U const & s
) )
{ {
this->value[0] -= s; this->value[0] -= s;
this->value[1] -= s; this->value[1] -= s;
this->value[2] -= s; this->value[2] -= s;
return *this; return *this;
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat3x2<T>& tmat3x2<T>::operator-= GLM_FUNC_QUALIFIER tmat3x2<T>& tmat3x2<T>::operator-=
( (
tmat3x2<U> const & m tmat3x2<U> const & m
) )
{ {
this->value[0] -= m[0]; this->value[0] -= m[0];
this->value[1] -= m[1]; this->value[1] -= m[1];
this->value[2] -= m[2]; this->value[2] -= m[2];
return *this; return *this;
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat3x2<T>& tmat3x2<T>::operator*= GLM_FUNC_QUALIFIER tmat3x2<T>& tmat3x2<T>::operator*=
( (
U const & s U const & s
) )
{ {
this->value[0] *= s; this->value[0] *= s;
this->value[1] *= s; this->value[1] *= s;
this->value[2] *= s; this->value[2] *= s;
return *this; return *this;
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat3x2<T>& tmat3x2<T>::operator*= GLM_FUNC_QUALIFIER tmat3x2<T>& tmat3x2<T>::operator*=
( (
tmat3x2<U> const & m tmat3x2<U> const & m
) )
{ {
return (*this = tmat3x2<T>(*this * m)); return (*this = tmat3x2<T>(*this * m));
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat3x2<T> & tmat3x2<T>::operator/= GLM_FUNC_QUALIFIER tmat3x2<T> & tmat3x2<T>::operator/=
( (
U const & s U const & s
) )
{ {
this->value[0] /= s; this->value[0] /= s;
this->value[1] /= s; this->value[1] /= s;
this->value[2] /= s; this->value[2] /= s;
return *this; return *this;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x2<T>& tmat3x2<T>::operator++ () GLM_FUNC_QUALIFIER tmat3x2<T>& tmat3x2<T>::operator++ ()
{ {
++this->value[0]; ++this->value[0];
++this->value[1]; ++this->value[1];
++this->value[2]; ++this->value[2];
return *this; return *this;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x2<T>& tmat3x2<T>::operator-- () GLM_FUNC_QUALIFIER tmat3x2<T>& tmat3x2<T>::operator-- ()
{ {
--this->value[0]; --this->value[0];
--this->value[1]; --this->value[1];
--this->value[2]; --this->value[2];
return *this; return *this;
} }
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
// Binary operators // Binary operators
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x2<T> operator+ GLM_FUNC_QUALIFIER tmat3x2<T> operator+
( (
tmat3x2<T> const & m, tmat3x2<T> const & m,
typename tmat3x2<T>::value_type const & s typename tmat3x2<T>::value_type const & s
) )
{ {
return tmat3x2<T>( return tmat3x2<T>(
m[0] + s, m[0] + s,
m[1] + s, m[1] + s,
m[2] + s); m[2] + s);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x2<T> operator+ GLM_FUNC_QUALIFIER tmat3x2<T> operator+
( (
tmat3x2<T> const & m1, tmat3x2<T> const & m1,
tmat3x2<T> const & m2 tmat3x2<T> const & m2
) )
{ {
return tmat3x2<T>( return tmat3x2<T>(
m1[0] + m2[0], m1[0] + m2[0],
m1[1] + m2[1], m1[1] + m2[1],
m1[2] + m2[2]); m1[2] + m2[2]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x2<T> operator- GLM_FUNC_QUALIFIER tmat3x2<T> operator-
( (
tmat3x2<T> const & m, tmat3x2<T> const & m,
typename tmat3x2<T>::value_type const & s typename tmat3x2<T>::value_type const & s
) )
{ {
return tmat3x2<T>( return tmat3x2<T>(
m[0] - s, m[0] - s,
m[1] - s, m[1] - s,
m[2] - s); m[2] - s);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x2<T> operator- GLM_FUNC_QUALIFIER tmat3x2<T> operator-
( (
tmat3x2<T> const & m1, tmat3x2<T> const & m1,
tmat3x2<T> const & m2 tmat3x2<T> const & m2
) )
{ {
return tmat3x2<T>( return tmat3x2<T>(
m1[0] - m2[0], m1[0] - m2[0],
m1[1] - m2[1], m1[1] - m2[1],
m1[2] - m2[2]); m1[2] - m2[2]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x2<T> operator* GLM_FUNC_QUALIFIER tmat3x2<T> operator*
( (
tmat3x2<T> const & m, tmat3x2<T> const & m,
typename tmat3x2<T>::value_type const & s typename tmat3x2<T>::value_type const & s
) )
{ {
return tmat3x2<T>( return tmat3x2<T>(
m[0] * s, m[0] * s,
m[1] * s, m[1] * s,
m[2] * s); m[2] * s);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x2<T> operator* GLM_FUNC_QUALIFIER tmat3x2<T> operator*
( (
typename tmat3x2<T>::value_type const & s, typename tmat3x2<T>::value_type const & s,
tmat3x2<T> const & m tmat3x2<T> const & m
) )
{ {
return tmat3x2<T>( return tmat3x2<T>(
m[0] * s, m[0] * s,
m[1] * s, m[1] * s,
m[2] * s); m[2] * s);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER typename tmat3x2<T>::col_type operator* GLM_FUNC_QUALIFIER typename tmat3x2<T>::col_type operator*
( (
tmat3x2<T> const & m, tmat3x2<T> const & m,
typename tmat3x2<T>::row_type const & v) typename tmat3x2<T>::row_type const & v)
{ {
return typename tmat3x2<T>::col_type( return typename tmat3x2<T>::col_type(
m[0][0] * v.x + m[1][0] * v.y + m[2][0] * v.z, 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][1] * v.x + m[1][1] * v.y + m[2][1] * v.z);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER typename tmat3x2<T>::row_type operator* GLM_FUNC_QUALIFIER typename tmat3x2<T>::row_type operator*
( (
typename tmat3x2<T>::col_type const & v, typename tmat3x2<T>::col_type const & v,
tmat3x2<T> const & m) tmat3x2<T> const & m)
{ {
return typename tmat3x2<T>::row_type( return typename tmat3x2<T>::row_type(
v.x * m[0][0] + v.y * m[0][1], v.x * m[0][0] + v.y * m[0][1],
v.x * m[1][0] + v.y * m[1][1], v.x * m[1][0] + v.y * m[1][1],
v.x * m[2][0] + v.y * m[2][1]); v.x * m[2][0] + v.y * m[2][1]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x2<T> operator* GLM_FUNC_QUALIFIER tmat2x2<T> operator*
( (
tmat3x2<T> const & m1, tmat3x2<T> const & m1,
tmat2x3<T> const & m2 tmat2x3<T> const & m2
) )
{ {
const T SrcA00 = m1[0][0]; const T SrcA00 = m1[0][0];
const T SrcA01 = m1[0][1]; const T SrcA01 = m1[0][1];
const T SrcA10 = m1[1][0]; const T SrcA10 = m1[1][0];
const T SrcA11 = m1[1][1]; const T SrcA11 = m1[1][1];
const T SrcA20 = m1[2][0]; const T SrcA20 = m1[2][0];
const T SrcA21 = m1[2][1]; const T SrcA21 = m1[2][1];
const T SrcB00 = m2[0][0]; const T SrcB00 = m2[0][0];
const T SrcB01 = m2[0][1]; const T SrcB01 = m2[0][1];
const T SrcB02 = m2[0][2]; const T SrcB02 = m2[0][2];
const T SrcB10 = m2[1][0]; const T SrcB10 = m2[1][0];
const T SrcB11 = m2[1][1]; const T SrcB11 = m2[1][1];
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 + SrcA10 * 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;
return Result; return Result;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x2<T> operator* GLM_FUNC_QUALIFIER tmat3x2<T> operator*
@ -588,72 +588,72 @@ namespace detail
m1[0][1] * m2[3][0] + m1[1][1] * m2[3][1] + m1[2][1] * m2[3][2]); m1[0][1] * m2[3][0] + m1[1][1] * m2[3][1] + m1[2][1] * m2[3][2]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x2<T> operator/ GLM_FUNC_QUALIFIER tmat3x2<T> operator/
( (
tmat3x2<T> const & m, tmat3x2<T> const & m,
typename tmat3x2<T>::value_type const & s typename tmat3x2<T>::value_type const & s
) )
{ {
return tmat3x2<T>( return tmat3x2<T>(
m[0] / s, m[0] / s,
m[1] / s, m[1] / s,
m[2] / s); m[2] / s);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x2<T> operator/ GLM_FUNC_QUALIFIER tmat3x2<T> operator/
( (
typename tmat3x2<T>::value_type const & s, typename tmat3x2<T>::value_type const & s,
tmat3x2<T> const & m tmat3x2<T> const & m
) )
{ {
return tmat3x2<T>( return tmat3x2<T>(
s / m[0], s / m[0],
s / m[1], s / m[1],
s / m[2]); s / m[2]);
} }
// Unary constant operators // Unary constant operators
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x2<T> const operator- GLM_FUNC_QUALIFIER tmat3x2<T> const operator-
( (
tmat3x2<T> const & m tmat3x2<T> const & m
) )
{ {
return tmat3x2<T>( return tmat3x2<T>(
-m[0], -m[0],
-m[1], -m[1],
-m[2]); -m[2]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x2<T> const operator++ GLM_FUNC_QUALIFIER tmat3x2<T> const operator++
( (
tmat3x2<T> const & m, tmat3x2<T> const & m,
int int
) )
{ {
typename tmat3x2<T>::value_type One(1); typename tmat3x2<T>::value_type One(1);
return tmat3x2<T>( return tmat3x2<T>(
m[0] + One, m[0] + One,
m[1] + One, m[1] + One,
m[2] + One); m[2] + One);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x2<T> const operator-- GLM_FUNC_QUALIFIER tmat3x2<T> const operator--
( (
tmat3x2<T> const & m, tmat3x2<T> const & m,
int int
) )
{ {
typename tmat3x2<T>::value_type One(1); typename tmat3x2<T>::value_type One(1);
return tmat3x2<T>( return tmat3x2<T>(
m[0] - One, m[0] - One,
m[1] - One, m[1] - One,
m[2] - One); m[2] - One);
} }
////////////////////////////////////// //////////////////////////////////////
// Boolean operators // Boolean operators

@ -48,8 +48,8 @@ namespace detail
template <typename T> struct tmat4x3; template <typename T> struct tmat4x3;
template <typename T> struct tmat4x4; template <typename T> struct tmat4x4;
// @brief Template for 3 * 3 matrix of floating-point numbers. /// @brief Template for 3 * 3 matrix of floating-point numbers.
// @ingroup core_template /// @ingroup core_template
template <typename T> template <typename T>
struct tmat3x3 struct tmat3x3
{ {
@ -68,9 +68,9 @@ namespace detail
public: public:
/// Implementation detail /// Implementation detail
/// @cond DETAIL /// @cond DETAIL
GLM_FUNC_DECL tmat3x3<T> _inverse() const; GLM_FUNC_DECL tmat3x3<T> _inverse() const;
/// @endcond /// @endcond
private: private:
// Data // Data
@ -98,24 +98,24 @@ namespace detail
// Conversions // Conversions
template <typename U> template <typename U>
GLM_FUNC_DECL explicit tmat3x3( GLM_FUNC_DECL explicit tmat3x3(
U const & x); U const & x);
template template
< <
typename X1, typename Y1, typename Z1, typename X1, typename Y1, typename Z1,
typename X2, typename Y2, typename Z2, typename X2, typename Y2, typename Z2,
typename X3, typename Y3, typename Z3 typename X3, typename Y3, typename Z3
> >
GLM_FUNC_DECL explicit tmat3x3( GLM_FUNC_DECL explicit tmat3x3(
X1 const & x1, Y1 const & y1, Z1 const & z1, X1 const & x1, Y1 const & y1, Z1 const & z1,
X2 const & x2, Y2 const & y2, Z2 const & z2, X2 const & x2, Y2 const & y2, Z2 const & z2,
X3 const & x3, Y3 const & y3, Z3 const & z3); X3 const & x3, Y3 const & y3, Z3 const & z3);
template <typename V1, typename V2, typename V3> template <typename V1, typename V2, typename V3>
GLM_FUNC_DECL explicit tmat3x3( GLM_FUNC_DECL explicit tmat3x3(
tvec3<V1> const & v1, tvec3<V1> const & v1,
tvec3<V2> const & v2, tvec3<V2> const & v2,
tvec3<V3> const & v3); tvec3<V3> const & v3);
// Matrix conversions // Matrix conversions
template <typename U> template <typename U>
@ -263,7 +263,6 @@ namespace detail
tmat3x3<T> const operator++ ( tmat3x3<T> const operator++ (
tmat3x3<T> const & m, tmat3x3<T> const & m,
int); int);
} //namespace detail } //namespace detail
/// @addtogroup core_precision /// @addtogroup core_precision

@ -29,11 +29,11 @@
namespace glm{ namespace glm{
namespace detail namespace detail
{ {
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat3x4<T>::size_type tmat3x4<T>::length() const GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat3x4<T>::size_type tmat3x4<T>::length() const
{ {
return 3; return 3;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER typename tmat3x4<T>::size_type tmat3x4<T>::col_size() GLM_FUNC_QUALIFIER typename tmat3x4<T>::size_type tmat3x4<T>::col_size()
@ -72,72 +72,72 @@ namespace detail
return this->value[i]; return this->value[i];
} }
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
// Constructors // Constructors
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4() GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4()
{ {
this->value[0] = col_type(1, 0, 0, 0); this->value[0] = col_type(1, 0, 0, 0);
this->value[1] = col_type(0, 1, 0, 0); this->value[1] = col_type(0, 1, 0, 0);
this->value[2] = col_type(0, 0, 1, 0); this->value[2] = col_type(0, 0, 1, 0);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4 GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4
( (
tmat3x4<T> const & m tmat3x4<T> const & m
) )
{ {
this->value[0] = m.value[0]; this->value[0] = m.value[0];
this->value[1] = m.value[1]; this->value[1] = m.value[1];
this->value[2] = m.value[2]; this->value[2] = m.value[2];
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4 GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4
( (
ctor ctor
) )
{} {}
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4 GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4
( (
value_type const & s value_type const & s
) )
{ {
value_type const Zero(0); value_type const Zero(0);
this->value[0] = col_type(s, Zero, Zero, Zero); this->value[0] = col_type(s, Zero, Zero, Zero);
this->value[1] = col_type(Zero, s, Zero, Zero); this->value[1] = col_type(Zero, s, Zero, Zero);
this->value[2] = col_type(Zero, Zero, s, Zero); this->value[2] = col_type(Zero, Zero, s, Zero);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4 GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4
( (
value_type const & x0, value_type const & y0, value_type const & z0, value_type const & w0, value_type const & x0, value_type const & y0, value_type const & z0, value_type const & w0,
value_type const & x1, value_type const & y1, value_type const & z1, value_type const & w1, value_type const & x1, value_type const & y1, value_type const & z1, value_type const & w1,
value_type const & x2, value_type const & y2, value_type const & z2, value_type const & w2 value_type const & x2, value_type const & y2, value_type const & z2, value_type const & w2
) )
{ {
this->value[0] = col_type(x0, y0, z0, w0); this->value[0] = col_type(x0, y0, z0, w0);
this->value[1] = col_type(x1, y1, z1, w1); this->value[1] = col_type(x1, y1, z1, w1);
this->value[2] = col_type(x2, y2, z2, w2); this->value[2] = col_type(x2, y2, z2, w2);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4 GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4
( (
col_type const & v0, col_type const & v0,
col_type const & v1, col_type const & v1,
col_type const & v2 col_type const & v2
) )
{ {
this->value[0] = v0; this->value[0] = v0;
this->value[1] = v1; this->value[1] = v1;
this->value[2] = v2; this->value[2] = v2;
} }
////////////////////////////////////// //////////////////////////////////////
// Convertion constructors // Convertion constructors
@ -149,9 +149,9 @@ namespace detail
) )
{ {
value_type const Zero(0); value_type const Zero(0);
this->value[0] = tvec4<T>(value_type(s), Zero, Zero, Zero); this->value[0] = tvec4<T>(value_type(s), Zero, Zero, Zero);
this->value[1] = tvec4<T>(Zero, value_type(s), Zero, Zero); this->value[1] = tvec4<T>(Zero, value_type(s), Zero, Zero);
this->value[2] = tvec4<T>(Zero, Zero, value_type(s), Zero); this->value[2] = tvec4<T>(Zero, Zero, value_type(s), Zero);
} }
template <typename T> template <typename T>
@ -166,9 +166,9 @@ namespace detail
X3 const & x3, Y3 const & y3, Z3 const & z3, W3 const & w3 X3 const & x3, Y3 const & y3, Z3 const & z3, W3 const & w3
) )
{ {
this->value[0] = col_type(value_type(x1), value_type(y1), value_type(z1), value_type(w1)); this->value[0] = col_type(value_type(x1), value_type(y1), value_type(z1), value_type(w1));
this->value[1] = col_type(value_type(x2), value_type(y2), value_type(z2), value_type(w2)); this->value[1] = col_type(value_type(x2), value_type(y2), value_type(z2), value_type(w2));
this->value[2] = col_type(value_type(x3), value_type(y3), value_type(z3), value_type(w3)); this->value[2] = col_type(value_type(x3), value_type(y3), value_type(z3), value_type(w3));
} }
template <typename T> template <typename T>
@ -180,411 +180,406 @@ namespace detail
tvec4<V3> const & v3 tvec4<V3> const & v3
) )
{ {
this->value[0] = col_type(v1); this->value[0] = col_type(v1);
this->value[1] = col_type(v2); this->value[1] = col_type(v2);
this->value[2] = col_type(v3); this->value[2] = col_type(v3);
} }
// Conversion // Conversion
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4 GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4
( (
tmat3x4<U> const & m tmat3x4<U> const & m
) )
{ {
this->value[0] = col_type(m[0]); this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]); this->value[1] = col_type(m[1]);
this->value[2] = col_type(m[2]); this->value[2] = col_type(m[2]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4 GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4
( (
tmat2x2<T> const & m tmat2x2<T> const & m
) )
{ {
this->value[0] = col_type(m[0], detail::tvec2<T>(0)); this->value[0] = col_type(m[0], detail::tvec2<T>(0));
this->value[1] = col_type(m[1], detail::tvec2<T>(0)); this->value[1] = col_type(m[1], detail::tvec2<T>(0));
this->value[2] = col_type(T(0), T(0), T(1), T(0)); this->value[2] = col_type(T(0), T(0), T(1), T(0));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4 GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4
( (
tmat3x3<T> const & m tmat3x3<T> const & m
) )
{ {
this->value[0] = col_type(m[0], T(0)); this->value[0] = col_type(m[0], T(0));
this->value[1] = col_type(m[1], T(0)); this->value[1] = col_type(m[1], T(0));
this->value[2] = col_type(m[2], T(0)); this->value[2] = col_type(m[2], T(0));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4 GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4
( (
tmat4x4<T> const & m tmat4x4<T> const & m
) )
{ {
this->value[0] = col_type(m[0]); this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]); this->value[1] = col_type(m[1]);
this->value[2] = col_type(m[2]); this->value[2] = col_type(m[2]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4 GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4
( (
tmat2x3<T> const & m tmat2x3<T> const & m
) )
{ {
this->value[0] = col_type(m[0], T(0)); this->value[0] = col_type(m[0], T(0));
this->value[1] = col_type(m[1], T(0)); this->value[1] = col_type(m[1], T(0));
this->value[2] = col_type(T(0), T(0), T(1), T(0)); this->value[2] = col_type(T(0), T(0), T(1), T(0));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4 GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4
( (
tmat3x2<T> const & m tmat3x2<T> const & m
) )
{ {
this->value[0] = col_type(m[0], detail::tvec2<T>(0)); this->value[0] = col_type(m[0], detail::tvec2<T>(0));
this->value[1] = col_type(m[1], detail::tvec2<T>(0)); this->value[1] = col_type(m[1], detail::tvec2<T>(0));
this->value[2] = col_type(m[2], T(0), T(1)); this->value[2] = col_type(m[2], T(0), T(1));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4 GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4
( (
tmat2x4<T> const & m tmat2x4<T> const & m
) )
{ {
this->value[0] = col_type(m[0]); this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]); this->value[1] = col_type(m[1]);
this->value[2] = col_type(T(0), T(0), T(1), T(0)); this->value[2] = col_type(T(0), T(0), T(1), T(0));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4 GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4
( (
tmat4x2<T> const & m tmat4x2<T> const & m
) )
{ {
this->value[0] = col_type(m[0], detail::tvec2<T>(T(0))); this->value[0] = col_type(m[0], detail::tvec2<T>(T(0)));
this->value[1] = col_type(m[1], detail::tvec2<T>(T(0))); this->value[1] = col_type(m[1], detail::tvec2<T>(T(0)));
this->value[2] = col_type(m[2], detail::tvec2<T>(T(1), T(0))); this->value[2] = col_type(m[2], detail::tvec2<T>(T(1), T(0)));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4 GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4
( (
tmat4x3<T> const & m tmat4x3<T> const & m
) )
{ {
this->value[0] = col_type(m[0], T(0)); this->value[0] = col_type(m[0], T(0));
this->value[1] = col_type(m[1], T(0)); this->value[1] = col_type(m[1], T(0));
this->value[2] = col_type(m[2], T(0)); this->value[2] = col_type(m[2], T(0));
} }
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
// Unary updatable operators // Unary updatable operators
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x4<T>& tmat3x4<T>::operator= GLM_FUNC_QUALIFIER tmat3x4<T>& tmat3x4<T>::operator=
( (
tmat3x4<T> const & m tmat3x4<T> const & m
) )
{ {
this->value[0] = m[0]; this->value[0] = m[0];
this->value[1] = m[1]; this->value[1] = m[1];
this->value[2] = m[2]; this->value[2] = m[2];
return *this; return *this;
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat3x4<T>& tmat3x4<T>::operator= GLM_FUNC_QUALIFIER tmat3x4<T>& tmat3x4<T>::operator=
( (
tmat3x4<U> const & m tmat3x4<U> const & m
) )
{ {
this->value[0] = m[0]; this->value[0] = m[0];
this->value[1] = m[1]; this->value[1] = m[1];
this->value[2] = m[2]; this->value[2] = m[2];
return *this; return *this;
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat3x4<T>& tmat3x4<T>::operator+= GLM_FUNC_QUALIFIER tmat3x4<T>& tmat3x4<T>::operator+=
( (
U const & s U const & s
) )
{ {
this->value[0] += s; this->value[0] += s;
this->value[1] += s; this->value[1] += s;
this->value[2] += s; this->value[2] += s;
return *this; return *this;
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat3x4<T>& tmat3x4<T>::operator+= GLM_FUNC_QUALIFIER tmat3x4<T>& tmat3x4<T>::operator+=
( (
tmat3x4<U> const & m tmat3x4<U> const & m
) )
{ {
this->value[0] += m[0]; this->value[0] += m[0];
this->value[1] += m[1]; this->value[1] += m[1];
this->value[2] += m[2]; this->value[2] += m[2];
return *this; return *this;
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat3x4<T>& tmat3x4<T>::operator-= GLM_FUNC_QUALIFIER tmat3x4<T>& tmat3x4<T>::operator-=
( (
U const & s U const & s
) )
{ {
this->value[0] -= s; this->value[0] -= s;
this->value[1] -= s; this->value[1] -= s;
this->value[2] -= s; this->value[2] -= s;
return *this; return *this;
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat3x4<T>& tmat3x4<T>::operator-= GLM_FUNC_QUALIFIER tmat3x4<T>& tmat3x4<T>::operator-=
( (
tmat3x4<U> const & m tmat3x4<U> const & m
) )
{ {
this->value[0] -= m[0]; this->value[0] -= m[0];
this->value[1] -= m[1]; this->value[1] -= m[1];
this->value[2] -= m[2]; this->value[2] -= m[2];
return *this; return *this;
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat3x4<T>& tmat3x4<T>::operator*= GLM_FUNC_QUALIFIER tmat3x4<T>& tmat3x4<T>::operator*=
( (
U const & s U const & s
) )
{ {
this->value[0] *= s; this->value[0] *= s;
this->value[1] *= s; this->value[1] *= s;
this->value[2] *= s; this->value[2] *= s;
return *this; return *this;
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat3x4<T>& tmat3x4<T>::operator*= GLM_FUNC_QUALIFIER tmat3x4<T>& tmat3x4<T>::operator*=
( (
tmat3x4<U> const & m tmat3x4<U> const & m
) )
{ {
return (*this = tmat3x4<T>(*this * m)); return (*this = tmat3x4<T>(*this * m));
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat3x4<T> & tmat3x4<T>::operator/= GLM_FUNC_QUALIFIER tmat3x4<T> & tmat3x4<T>::operator/=
( (
U const & s U const & s
) )
{ {
this->value[0] /= s; this->value[0] /= s;
this->value[1] /= s; this->value[1] /= s;
this->value[2] /= s; this->value[2] /= s;
return *this; return *this;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x4<T>& tmat3x4<T>::operator++ () GLM_FUNC_QUALIFIER tmat3x4<T>& tmat3x4<T>::operator++ ()
{ {
++this->value[0]; ++this->value[0];
++this->value[1]; ++this->value[1];
++this->value[2]; ++this->value[2];
return *this; return *this;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x4<T>& tmat3x4<T>::operator-- () GLM_FUNC_QUALIFIER tmat3x4<T>& tmat3x4<T>::operator-- ()
{ {
--this->value[0]; --this->value[0];
--this->value[1]; --this->value[1];
--this->value[2]; --this->value[2];
return *this; return *this;
} }
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
// Binary operators // Binary operators
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x4<T> operator+ GLM_FUNC_QUALIFIER tmat3x4<T> operator+
( (
tmat3x4<T> const & m, tmat3x4<T> const & m,
typename tmat3x4<T>::value_type const & s typename tmat3x4<T>::value_type const & s
) )
{ {
return tmat3x4<T>( return tmat3x4<T>(
m[0] + s, m[0] + s,
m[1] + s, m[1] + s,
m[2] + s); m[2] + s);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x4<T> operator+ GLM_FUNC_QUALIFIER tmat3x4<T> operator+
( (
tmat3x4<T> const & m1, tmat3x4<T> const & m1,
tmat3x4<T> const & m2 tmat3x4<T> const & m2
) )
{ {
return tmat3x4<T>( return tmat3x4<T>(
m1[0] + m2[0], m1[0] + m2[0],
m1[1] + m2[1], m1[1] + m2[1],
m1[2] + m2[2]); m1[2] + m2[2]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x4<T> operator- GLM_FUNC_QUALIFIER tmat3x4<T> operator-
( (
tmat3x4<T> const & m, tmat3x4<T> const & m,
typename tmat3x4<T>::value_type const & s typename tmat3x4<T>::value_type const & s
) )
{ {
return tmat3x4<T>( return tmat3x4<T>(
m[0] - s, m[0] - s,
m[1] - s, m[1] - s,
m[2] - s); m[2] - s);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x4<T> operator- GLM_FUNC_QUALIFIER tmat3x4<T> operator-
( (
tmat3x4<T> const & m1, tmat3x4<T> const & m1,
tmat3x4<T> const & m2 tmat3x4<T> const & m2
) )
{ {
return tmat3x4<T>( return tmat3x4<T>(
m1[0] - m2[0], m1[0] - m2[0],
m1[1] - m2[1], m1[1] - m2[1],
m1[2] - m2[2]); m1[2] - m2[2]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x4<T> operator* GLM_FUNC_QUALIFIER tmat3x4<T> operator*
( (
tmat3x4<T> const & m, tmat3x4<T> const & m,
typename tmat3x4<T>::value_type const & s typename tmat3x4<T>::value_type const & s
) )
{ {
return tmat3x4<T>( return tmat3x4<T>(
m[0] * s, m[0] * s,
m[1] * s, m[1] * s,
m[2] * s); m[2] * s);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x4<T> operator* GLM_FUNC_QUALIFIER tmat3x4<T> operator*
( (
typename tmat3x4<T>::value_type const & s, typename tmat3x4<T>::value_type const & s,
tmat3x4<T> const & m tmat3x4<T> const & m
) )
{ {
return tmat3x4<T>( return tmat3x4<T>(
m[0] * s, m[0] * s,
m[1] * s, m[1] * s,
m[2] * s); m[2] * s);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER typename tmat3x4<T>::col_type operator* GLM_FUNC_QUALIFIER typename tmat3x4<T>::col_type operator*
( (
tmat3x4<T> const & m, tmat3x4<T> const & m,
typename tmat3x4<T>::row_type const & v typename tmat3x4<T>::row_type const & v
) )
{ {
return typename tmat3x4<T>::col_type( return typename tmat3x4<T>::col_type(
m[0][0] * v.x + m[1][0] * v.y + m[2][0] * v.z, 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][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, m[0][2] * v.x + m[1][2] * v.y + m[2][2] * v.z,
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 template <typename T>
// X X X GLM_FUNC_QUALIFIER typename tmat3x4<T>::row_type operator*
// X X X
// X X X
// X X X X
template <typename T>
GLM_FUNC_QUALIFIER typename tmat3x4<T>::row_type operator*
( (
typename tmat3x4<T>::col_type const & v, typename tmat3x4<T>::col_type const & v,
tmat3x4<T> const & m tmat3x4<T> const & m
) )
{ {
return typename tmat3x4<T>::row_type( return typename tmat3x4<T>::row_type(
v.x * m[0][0] + v.y * m[0][1] + v.z * m[0][2] + v.w * m[0][3], 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[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]); 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>
GLM_FUNC_QUALIFIER tmat4x4<T> operator* GLM_FUNC_QUALIFIER tmat4x4<T> operator*
( (
tmat3x4<T> const & m1, tmat3x4<T> const & m1,
tmat4x3<T> const & m2 tmat4x3<T> const & m2
) )
{ {
const T SrcA00 = m1[0][0]; const T SrcA00 = m1[0][0];
const T SrcA01 = m1[0][1]; const T SrcA01 = m1[0][1];
const T SrcA02 = m1[0][2]; const T SrcA02 = m1[0][2];
const T SrcA03 = m1[0][3]; const T SrcA03 = m1[0][3];
const T SrcA10 = m1[1][0]; const T SrcA10 = m1[1][0];
const T SrcA11 = m1[1][1]; const T SrcA11 = m1[1][1];
const T SrcA12 = m1[1][2]; const T SrcA12 = m1[1][2];
const T SrcA13 = m1[1][3]; const T SrcA13 = m1[1][3];
const T SrcA20 = m1[2][0]; const T SrcA20 = m1[2][0];
const T SrcA21 = m1[2][1]; const T SrcA21 = m1[2][1];
const T SrcA22 = m1[2][2]; const T SrcA22 = m1[2][2];
const T SrcA23 = m1[2][3]; const T SrcA23 = m1[2][3];
const T SrcB00 = m2[0][0]; const T SrcB00 = m2[0][0];
const T SrcB01 = m2[0][1]; const T SrcB01 = m2[0][1];
const T SrcB02 = m2[0][2]; const T SrcB02 = m2[0][2];
const T SrcB10 = m2[1][0]; const T SrcB10 = m2[1][0];
const T SrcB11 = m2[1][1]; const T SrcB11 = m2[1][1];
const T SrcB12 = m2[1][2]; const T SrcB12 = m2[1][2];
const T SrcB20 = m2[2][0]; const T SrcB20 = m2[2][0];
const T SrcB21 = m2[2][1]; const T SrcB21 = m2[2][1];
const T SrcB22 = m2[2][2]; const T SrcB22 = m2[2][2];
const T SrcB30 = m2[3][0]; const T SrcB30 = m2[3][0];
const T SrcB31 = m2[3][1]; const T SrcB31 = m2[3][1];
const T SrcB32 = m2[3][2]; const T SrcB32 = m2[3][2];
tmat4x4<T> Result(tmat4x4<T>::null); tmat4x4<T> Result(tmat4x4<T>::null);
Result[0][0] = SrcA00 * SrcB00 + SrcA10 * 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[0][2] = SrcA02 * SrcB00 + SrcA12 * SrcB01 + SrcA22 * SrcB02; Result[0][2] = SrcA02 * SrcB00 + SrcA12 * SrcB01 + SrcA22 * SrcB02;
Result[0][3] = SrcA03 * SrcB00 + SrcA13 * SrcB01 + SrcA23 * SrcB02; Result[0][3] = SrcA03 * SrcB00 + SrcA13 * SrcB01 + SrcA23 * 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;
Result[1][2] = SrcA02 * SrcB10 + SrcA12 * SrcB11 + SrcA22 * SrcB12; Result[1][2] = SrcA02 * SrcB10 + SrcA12 * SrcB11 + SrcA22 * SrcB12;
Result[1][3] = SrcA03 * SrcB10 + SrcA13 * SrcB11 + SrcA23 * SrcB12; Result[1][3] = SrcA03 * SrcB10 + SrcA13 * SrcB11 + SrcA23 * SrcB12;
Result[2][0] = SrcA00 * SrcB20 + SrcA10 * SrcB21 + SrcA20 * SrcB22; Result[2][0] = SrcA00 * SrcB20 + SrcA10 * SrcB21 + SrcA20 * SrcB22;
Result[2][1] = SrcA01 * SrcB20 + SrcA11 * SrcB21 + SrcA21 * SrcB22; Result[2][1] = SrcA01 * SrcB20 + SrcA11 * SrcB21 + SrcA21 * SrcB22;
Result[2][2] = SrcA02 * SrcB20 + SrcA12 * SrcB21 + SrcA22 * SrcB22; Result[2][2] = SrcA02 * SrcB20 + SrcA12 * SrcB21 + SrcA22 * SrcB22;
Result[2][3] = SrcA03 * SrcB20 + SrcA13 * SrcB21 + SrcA23 * SrcB22; Result[2][3] = SrcA03 * SrcB20 + SrcA13 * SrcB21 + SrcA23 * SrcB22;
Result[3][0] = SrcA00 * SrcB30 + SrcA10 * SrcB31 + SrcA20 * SrcB32; Result[3][0] = SrcA00 * SrcB30 + SrcA10 * SrcB31 + SrcA20 * SrcB32;
Result[3][1] = SrcA01 * SrcB30 + SrcA11 * SrcB31 + SrcA21 * SrcB32; Result[3][1] = SrcA01 * SrcB30 + SrcA11 * SrcB31 + SrcA21 * SrcB32;
Result[3][2] = SrcA02 * SrcB30 + SrcA12 * SrcB31 + SrcA22 * SrcB32; Result[3][2] = SrcA02 * SrcB30 + SrcA12 * SrcB31 + SrcA22 * SrcB32;
Result[3][3] = SrcA03 * SrcB30 + SrcA13 * SrcB31 + SrcA23 * SrcB32; Result[3][3] = SrcA03 * SrcB30 + SrcA13 * SrcB31 + SrcA23 * SrcB32;
return Result; return Result;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x4<T> operator* GLM_FUNC_QUALIFIER tmat2x4<T> operator*
@ -626,69 +621,69 @@ namespace detail
m1[0][3] * m2[2][0] + m1[1][3] * m2[2][1] + m1[2][3] * m2[2][2]); m1[0][3] * m2[2][0] + m1[1][3] * m2[2][1] + m1[2][3] * m2[2][2]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x4<T> operator/ GLM_FUNC_QUALIFIER tmat3x4<T> operator/
( (
tmat3x4<T> const & m, tmat3x4<T> const & m,
typename tmat3x4<T>::value_type const & s typename tmat3x4<T>::value_type const & s
) )
{ {
return tmat3x4<T>( return tmat3x4<T>(
m[0] / s, m[0] / s,
m[1] / s, m[1] / s,
m[2] / s); m[2] / s);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x4<T> operator/ GLM_FUNC_QUALIFIER tmat3x4<T> operator/
( (
typename tmat3x4<T>::value_type const & s, typename tmat3x4<T>::value_type const & s,
tmat3x4<T> const & m tmat3x4<T> const & m
) )
{ {
return tmat3x4<T>( return tmat3x4<T>(
s / m[0], s / m[0],
s / m[1], s / m[1],
s / m[2]); s / m[2]);
} }
// Unary constant operators // Unary constant operators
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x4<T> const operator- GLM_FUNC_QUALIFIER tmat3x4<T> const operator-
( (
tmat3x4<T> const & m tmat3x4<T> const & m
) )
{ {
return tmat3x4<T>( return tmat3x4<T>(
-m[0], -m[0],
-m[1], -m[1],
-m[2]); -m[2]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x4<T> const operator++ GLM_FUNC_QUALIFIER tmat3x4<T> const operator++
( (
tmat3x4<T> const & m, tmat3x4<T> const & m,
int int
) )
{ {
return tmat3x4<T>( return tmat3x4<T>(
m[0] + T(1), m[0] + T(1),
m[1] + T(1), m[1] + T(1),
m[2] + T(1)); m[2] + T(1));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x4<T> const operator-- GLM_FUNC_QUALIFIER tmat3x4<T> const operator--
( (
tmat3x4<T> const & m, tmat3x4<T> const & m,
int int
) )
{ {
return tmat3x4<T>( return tmat3x4<T>(
m[0] - T(1), m[0] - T(1),
m[1] - T(1), m[1] - T(1),
m[2] - T(1)); m[2] - T(1));
} }
////////////////////////////////////// //////////////////////////////////////
@ -713,6 +708,5 @@ namespace detail
{ {
return (m1[0] != m2[0]) || (m1[1] != m2[1]) || (m1[2] != m2[2]); return (m1[0] != m2[0]) || (m1[1] != m2[1]) || (m1[2] != m2[2]);
} }
} //namespace detail } //namespace detail
} //namespace glm } //namespace glm

@ -94,27 +94,27 @@ namespace detail
// Conversions // Conversions
template <typename U> template <typename U>
GLM_FUNC_DECL explicit tmat4x2( GLM_FUNC_DECL explicit tmat4x2(
U const & x); U const & x);
template template
< <
typename X1, typename Y1, typename X1, typename Y1,
typename X2, typename Y2, typename X2, typename Y2,
typename X3, typename Y3, typename X3, typename Y3,
typename X4, typename Y4 typename X4, typename Y4
> >
GLM_FUNC_DECL explicit tmat4x2( GLM_FUNC_DECL explicit tmat4x2(
X1 const & x1, Y1 const & y1, X1 const & x1, Y1 const & y1,
X2 const & x2, Y2 const & y2, X2 const & x2, Y2 const & y2,
X3 const & x3, Y3 const & y3, X3 const & x3, Y3 const & y3,
X4 const & x4, Y4 const & y4); X4 const & x4, Y4 const & y4);
template <typename V1, typename V2, typename V3, typename V4> template <typename V1, typename V2, typename V3, typename V4>
GLM_FUNC_DECL explicit tmat4x2( GLM_FUNC_DECL explicit tmat4x2(
tvec2<V1> const & v1, tvec2<V1> const & v1,
tvec2<V2> const & v2, tvec2<V2> const & v2,
tvec2<V3> const & v3, tvec2<V3> const & v3,
tvec2<V4> const & v4); tvec2<V4> const & v4);
// Matrix conversions // Matrix conversions
template <typename U> template <typename U>
@ -236,7 +236,6 @@ namespace detail
tmat4x2<T> const operator++ ( tmat4x2<T> const operator++ (
tmat4x2<T> const & m, tmat4x2<T> const & m,
int); int);
} //namespace detail } //namespace detail
/// @addtogroup core_precision /// @addtogroup core_precision

@ -29,11 +29,11 @@
namespace glm{ namespace glm{
namespace detail namespace detail
{ {
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat4x2<T>::size_type tmat4x2<T>::length() const GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat4x2<T>::size_type tmat4x2<T>::length() const
{ {
return 4; return 4;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER typename tmat4x2<T>::size_type tmat4x2<T>::col_size() GLM_FUNC_QUALIFIER typename tmat4x2<T>::size_type tmat4x2<T>::col_size()
@ -72,81 +72,81 @@ namespace detail
return this->value[i]; return this->value[i];
} }
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
// Constructors // Constructors
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat4x2<T>::tmat4x2() GLM_FUNC_QUALIFIER tmat4x2<T>::tmat4x2()
{ {
value_type const Zero(0); value_type const Zero(0);
value_type const One(1); value_type const One(1);
this->value[0] = col_type(One, Zero); this->value[0] = col_type(One, Zero);
this->value[1] = col_type(Zero, One); this->value[1] = col_type(Zero, One);
this->value[2] = col_type(Zero, Zero); this->value[2] = col_type(Zero, Zero);
this->value[3] = col_type(Zero, Zero); this->value[3] = col_type(Zero, Zero);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat4x2<T>::tmat4x2 GLM_FUNC_QUALIFIER tmat4x2<T>::tmat4x2
( (
tmat4x2<T> const & m tmat4x2<T> const & m
) )
{ {
this->value[0] = m.value[0]; this->value[0] = m.value[0];
this->value[1] = m.value[1]; this->value[1] = m.value[1];
this->value[2] = m.value[2]; this->value[2] = m.value[2];
this->value[3] = m.value[3]; this->value[3] = m.value[3];
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat4x2<T>::tmat4x2 GLM_FUNC_QUALIFIER tmat4x2<T>::tmat4x2
( (
ctor ctor
) )
{} {}
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat4x2<T>::tmat4x2 GLM_FUNC_QUALIFIER tmat4x2<T>::tmat4x2
( (
value_type const & s value_type const & s
) )
{ {
value_type const Zero(0); value_type const Zero(0);
this->value[0] = col_type(s, Zero); this->value[0] = col_type(s, Zero);
this->value[1] = col_type(Zero, s); this->value[1] = col_type(Zero, s);
this->value[2] = col_type(Zero, Zero); this->value[2] = col_type(Zero, Zero);
this->value[3] = col_type(Zero, Zero); this->value[3] = col_type(Zero, Zero);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat4x2<T>::tmat4x2 GLM_FUNC_QUALIFIER tmat4x2<T>::tmat4x2
( (
value_type const & x0, value_type const & y0, value_type const & x0, value_type const & y0,
value_type const & x1, value_type const & y1, value_type const & x1, value_type const & y1,
value_type const & x2, value_type const & y2, value_type const & x2, value_type const & y2,
value_type const & x3, value_type const & y3 value_type const & x3, value_type const & y3
) )
{ {
this->value[0] = col_type(x0, y0); this->value[0] = col_type(x0, y0);
this->value[1] = col_type(x1, y1); this->value[1] = col_type(x1, y1);
this->value[2] = col_type(x2, y2); this->value[2] = col_type(x2, y2);
this->value[3] = col_type(x3, y3); this->value[3] = col_type(x3, y3);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat4x2<T>::tmat4x2 GLM_FUNC_QUALIFIER tmat4x2<T>::tmat4x2
( (
col_type const & v0, col_type const & v0,
col_type const & v1, col_type const & v1,
col_type const & v2, col_type const & v2,
col_type const & v3 col_type const & v3
) )
{ {
this->value[0] = v0; this->value[0] = v0;
this->value[1] = v1; this->value[1] = v1;
this->value[2] = v2; this->value[2] = v2;
this->value[3] = v3; this->value[3] = v3;
} }
////////////////////////////////////// //////////////////////////////////////
// Convertion constructors // Convertion constructors
@ -158,10 +158,10 @@ namespace detail
) )
{ {
value_type const Zero(0); value_type const Zero(0);
this->value[0] = tvec2<T>(value_type(s), Zero); this->value[0] = tvec2<T>(value_type(s), Zero);
this->value[1] = tvec2<T>(Zero, value_type(s)); this->value[1] = tvec2<T>(Zero, value_type(s));
this->value[2] = tvec2<T>(Zero, Zero); this->value[2] = tvec2<T>(Zero, Zero);
this->value[3] = tvec2<T>(Zero, Zero); this->value[3] = tvec2<T>(Zero, Zero);
} }
template <typename T> template <typename T>
@ -178,9 +178,9 @@ namespace detail
X4 const & x4, Y4 const & y4 X4 const & x4, Y4 const & y4
) )
{ {
this->value[0] = col_type(value_type(x1), value_type(y1)); this->value[0] = col_type(value_type(x1), value_type(y1));
this->value[1] = col_type(value_type(x2), value_type(y2)); this->value[1] = col_type(value_type(x2), value_type(y2));
this->value[2] = col_type(value_type(x3), value_type(y3)); this->value[2] = col_type(value_type(x3), value_type(y3));
this->value[3] = col_type(value_type(x4), value_type(y4)); this->value[3] = col_type(value_type(x4), value_type(y4));
} }
@ -194,409 +194,409 @@ namespace detail
tvec2<V4> const & v4 tvec2<V4> const & v4
) )
{ {
this->value[0] = col_type(v1); this->value[0] = col_type(v1);
this->value[1] = col_type(v2); this->value[1] = col_type(v2);
this->value[2] = col_type(v3); this->value[2] = col_type(v3);
this->value[3] = col_type(v4); this->value[3] = col_type(v4);
} }
// Conversion // Conversion
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat4x2<T>::tmat4x2 GLM_FUNC_QUALIFIER tmat4x2<T>::tmat4x2
( (
tmat4x2<U> const & m tmat4x2<U> const & m
) )
{ {
this->value[0] = col_type(m[0]); this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]); this->value[1] = col_type(m[1]);
this->value[2] = col_type(m[2]); this->value[2] = col_type(m[2]);
this->value[3] = col_type(m[3]); this->value[3] = col_type(m[3]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat4x2<T>::tmat4x2 GLM_FUNC_QUALIFIER tmat4x2<T>::tmat4x2
( (
tmat2x2<T> const & m tmat2x2<T> const & m
) )
{ {
this->value[0] = col_type(m[0]); this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]); this->value[1] = col_type(m[1]);
this->value[2] = col_type(value_type(0)); this->value[2] = col_type(value_type(0));
this->value[3] = col_type(value_type(0)); this->value[3] = col_type(value_type(0));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat4x2<T>::tmat4x2 GLM_FUNC_QUALIFIER tmat4x2<T>::tmat4x2
( (
tmat3x3<T> const & m tmat3x3<T> const & m
) )
{ {
this->value[0] = col_type(m[0]); this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]); this->value[1] = col_type(m[1]);
this->value[2] = col_type(m[2]); this->value[2] = col_type(m[2]);
this->value[3] = col_type(value_type(0)); this->value[3] = col_type(value_type(0));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat4x2<T>::tmat4x2 GLM_FUNC_QUALIFIER tmat4x2<T>::tmat4x2
( (
tmat4x4<T> const & m tmat4x4<T> const & m
) )
{ {
this->value[0] = col_type(m[0]); this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]); this->value[1] = col_type(m[1]);
this->value[2] = col_type(m[2]); this->value[2] = col_type(m[2]);
this->value[3] = col_type(m[3]); this->value[3] = col_type(m[3]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat4x2<T>::tmat4x2 GLM_FUNC_QUALIFIER tmat4x2<T>::tmat4x2
( (
tmat2x3<T> const & m tmat2x3<T> const & m
) )
{ {
this->value[0] = col_type(m[0]); this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]); this->value[1] = col_type(m[1]);
this->value[2] = col_type(value_type(0)); this->value[2] = col_type(value_type(0));
this->value[3] = col_type(value_type(0)); this->value[3] = col_type(value_type(0));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat4x2<T>::tmat4x2 GLM_FUNC_QUALIFIER tmat4x2<T>::tmat4x2
( (
tmat3x2<T> const & m tmat3x2<T> const & m
) )
{ {
this->value[0] = col_type(m[0]); this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]); this->value[1] = col_type(m[1]);
this->value[2] = col_type(m[2]); this->value[2] = col_type(m[2]);
this->value[3] = col_type(value_type(0)); this->value[3] = col_type(value_type(0));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat4x2<T>::tmat4x2 GLM_FUNC_QUALIFIER tmat4x2<T>::tmat4x2
( (
tmat2x4<T> const & m tmat2x4<T> const & m
) )
{ {
this->value[0] = col_type(m[0]); this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]); this->value[1] = col_type(m[1]);
this->value[2] = col_type(value_type(0)); this->value[2] = col_type(value_type(0));
this->value[3] = col_type(value_type(0)); this->value[3] = col_type(value_type(0));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat4x2<T>::tmat4x2 GLM_FUNC_QUALIFIER tmat4x2<T>::tmat4x2
( (
tmat4x3<T> const & m tmat4x3<T> const & m
) )
{ {
this->value[0] = col_type(m[0]); this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]); this->value[1] = col_type(m[1]);
this->value[2] = col_type(m[2]); this->value[2] = col_type(m[2]);
this->value[3] = col_type(m[3]); this->value[3] = col_type(m[3]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat4x2<T>::tmat4x2 GLM_FUNC_QUALIFIER tmat4x2<T>::tmat4x2
( (
tmat3x4<T> const & m tmat3x4<T> const & m
) )
{ {
this->value[0] = col_type(m[0]); this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]); this->value[1] = col_type(m[1]);
this->value[2] = col_type(m[2]); this->value[2] = col_type(m[2]);
this->value[3] = col_type(value_type(0)); this->value[3] = col_type(value_type(0));
} }
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
// Unary updatable operators // Unary updatable operators
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat4x2<T>& tmat4x2<T>::operator= GLM_FUNC_QUALIFIER tmat4x2<T>& tmat4x2<T>::operator=
( (
tmat4x2<T> const & m tmat4x2<T> const & m
) )
{ {
this->value[0] = m[0]; this->value[0] = m[0];
this->value[1] = m[1]; this->value[1] = m[1];
this->value[2] = m[2]; this->value[2] = m[2];
this->value[3] = m[3]; this->value[3] = m[3];
return *this; return *this;
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat4x2<T>& tmat4x2<T>::operator= GLM_FUNC_QUALIFIER tmat4x2<T>& tmat4x2<T>::operator=
( (
tmat4x2<U> const & m tmat4x2<U> const & m
) )
{ {
this->value[0] = m[0]; this->value[0] = m[0];
this->value[1] = m[1]; this->value[1] = m[1];
this->value[2] = m[2]; this->value[2] = m[2];
this->value[3] = m[3]; this->value[3] = m[3];
return *this; return *this;
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat4x2<T> & tmat4x2<T>::operator+= GLM_FUNC_QUALIFIER tmat4x2<T> & tmat4x2<T>::operator+=
( (
U const & s U const & s
) )
{ {
this->value[0] += s; this->value[0] += s;
this->value[1] += s; this->value[1] += s;
this->value[2] += s; this->value[2] += s;
this->value[3] += s; this->value[3] += s;
return *this; return *this;
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat4x2<T> & tmat4x2<T>::operator+= GLM_FUNC_QUALIFIER tmat4x2<T> & tmat4x2<T>::operator+=
( (
tmat4x2<U> const & m tmat4x2<U> const & m
) )
{ {
this->value[0] += m[0]; this->value[0] += m[0];
this->value[1] += m[1]; this->value[1] += m[1];
this->value[2] += m[2]; this->value[2] += m[2];
this->value[3] += m[3]; this->value[3] += m[3];
return *this; return *this;
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat4x2<T> & tmat4x2<T>::operator-= GLM_FUNC_QUALIFIER tmat4x2<T> & tmat4x2<T>::operator-=
( (
U const & s U const & s
) )
{ {
this->value[0] -= s; this->value[0] -= s;
this->value[1] -= s; this->value[1] -= s;
this->value[2] -= s; this->value[2] -= s;
this->value[3] -= s; this->value[3] -= s;
return *this; return *this;
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat4x2<T> & tmat4x2<T>::operator-= GLM_FUNC_QUALIFIER tmat4x2<T> & tmat4x2<T>::operator-=
( (
tmat4x2<U> const & m tmat4x2<U> const & m
) )
{ {
this->value[0] -= m[0]; this->value[0] -= m[0];
this->value[1] -= m[1]; this->value[1] -= m[1];
this->value[2] -= m[2]; this->value[2] -= m[2];
this->value[3] -= m[3]; this->value[3] -= m[3];
return *this; return *this;
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat4x2<T> & tmat4x2<T>::operator*= GLM_FUNC_QUALIFIER tmat4x2<T> & tmat4x2<T>::operator*=
( (
U const & s U const & s
) )
{ {
this->value[0] *= s; this->value[0] *= s;
this->value[1] *= s; this->value[1] *= s;
this->value[2] *= s; this->value[2] *= s;
this->value[3] *= s; this->value[3] *= s;
return *this; return *this;
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat4x2<T> & tmat4x2<T>::operator*= GLM_FUNC_QUALIFIER tmat4x2<T> & tmat4x2<T>::operator*=
( (
tmat4x2<U> const & m tmat4x2<U> const & m
) )
{ {
return (*this = tmat4x2<T>(*this * m)); return (*this = tmat4x2<T>(*this * m));
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat4x2<T> & tmat4x2<T>::operator/= GLM_FUNC_QUALIFIER tmat4x2<T> & tmat4x2<T>::operator/=
( (
U const & s U const & s
) )
{ {
this->value[0] /= s; this->value[0] /= s;
this->value[1] /= s; this->value[1] /= s;
this->value[2] /= s; this->value[2] /= s;
this->value[3] /= s; this->value[3] /= s;
return *this; return *this;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat4x2<T> & tmat4x2<T>::operator++ () GLM_FUNC_QUALIFIER tmat4x2<T> & tmat4x2<T>::operator++ ()
{ {
++this->value[0]; ++this->value[0];
++this->value[1]; ++this->value[1];
++this->value[2]; ++this->value[2];
++this->value[3]; ++this->value[3];
return *this; return *this;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat4x2<T> & tmat4x2<T>::operator-- () GLM_FUNC_QUALIFIER tmat4x2<T> & tmat4x2<T>::operator-- ()
{ {
--this->value[0]; --this->value[0];
--this->value[1]; --this->value[1];
--this->value[2]; --this->value[2];
--this->value[3]; --this->value[3];
return *this; return *this;
} }
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
// Binary operators // Binary operators
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat4x2<T> operator+ GLM_FUNC_QUALIFIER tmat4x2<T> operator+
( (
tmat4x2<T> const & m, tmat4x2<T> const & m,
typename tmat4x2<T>::value_type const & s typename tmat4x2<T>::value_type const & s
) )
{ {
return tmat4x2<T>( return tmat4x2<T>(
m[0] + s, m[0] + s,
m[1] + s, m[1] + s,
m[2] + s, m[2] + s,
m[3] + s); m[3] + s);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat4x2<T> operator+ GLM_FUNC_QUALIFIER tmat4x2<T> operator+
( (
tmat4x2<T> const & m1, tmat4x2<T> const & m1,
tmat4x2<T> const & m2 tmat4x2<T> const & m2
) )
{ {
return tmat4x2<T>( return tmat4x2<T>(
m1[0] + m2[0], m1[0] + m2[0],
m1[1] + m2[1], m1[1] + m2[1],
m1[2] + m2[2], m1[2] + m2[2],
m1[3] + m2[3]); m1[3] + m2[3]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat4x2<T> operator- GLM_FUNC_QUALIFIER tmat4x2<T> operator-
( (
tmat4x2<T> const & m, tmat4x2<T> const & m,
typename tmat4x2<T>::value_type const & s typename tmat4x2<T>::value_type const & s
) )
{ {
return tmat4x2<T>( return tmat4x2<T>(
m[0] - s, m[0] - s,
m[1] - s, m[1] - s,
m[2] - s, m[2] - s,
m[3] - s); m[3] - s);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat4x2<T> operator- GLM_FUNC_QUALIFIER tmat4x2<T> operator-
( (
tmat4x2<T> const & m1, tmat4x2<T> const & m1,
tmat4x2<T> const & m2 tmat4x2<T> const & m2
) )
{ {
return tmat4x2<T>( return tmat4x2<T>(
m1[0] - m2[0], m1[0] - m2[0],
m1[1] - m2[1], m1[1] - m2[1],
m1[2] - m2[2], m1[2] - m2[2],
m1[3] - m2[3]); m1[3] - m2[3]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat4x2<T> operator* GLM_FUNC_QUALIFIER tmat4x2<T> operator*
( (
tmat4x2<T> const & m, tmat4x2<T> const & m,
typename tmat4x2<T>::value_type const & s typename tmat4x2<T>::value_type const & s
) )
{ {
return tmat4x2<T>( return tmat4x2<T>(
m[0] * s, m[0] * s,
m[1] * s, m[1] * s,
m[2] * s, m[2] * s,
m[3] * s); m[3] * s);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat4x2<T> operator* GLM_FUNC_QUALIFIER tmat4x2<T> operator*
( (
typename tmat4x2<T>::value_type const & s, typename tmat4x2<T>::value_type const & s,
tmat4x2<T> const & m tmat4x2<T> const & m
) )
{ {
return tmat4x2<T>( return tmat4x2<T>(
m[0] * s, m[0] * s,
m[1] * s, m[1] * s,
m[2] * s, m[2] * s,
m[3] * s); m[3] * s);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER typename tmat4x2<T>::col_type operator* GLM_FUNC_QUALIFIER typename tmat4x2<T>::col_type operator*
( (
tmat4x2<T> const & m, tmat4x2<T> const & m,
typename tmat4x2<T>::row_type const & v) typename tmat4x2<T>::row_type const & v)
{ {
return typename tmat4x2<T>::col_type( return typename tmat4x2<T>::col_type(
m[0][0] * v.x + m[1][0] * v.y + m[2][0] * v.z + m[3][0] * v.w, 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][1] * v.x + m[1][1] * v.y + m[2][1] * v.z + m[3][1] * v.w);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER typename tmat4x2<T>::row_type operator* GLM_FUNC_QUALIFIER typename tmat4x2<T>::row_type operator*
( (
typename tmat4x2<T>::col_type const & v, typename tmat4x2<T>::col_type const & v,
tmat4x2<T> const & m) tmat4x2<T> const & m)
{ {
return typename tmat4x2<T>::row_type( return typename tmat4x2<T>::row_type(
v.x * m[0][0] + v.y * m[0][1], v.x * m[0][0] + v.y * m[0][1],
v.x * m[1][0] + v.y * m[1][1], v.x * m[1][0] + v.y * m[1][1],
v.x * m[2][0] + v.y * m[2][1], v.x * m[2][0] + v.y * m[2][1],
v.x * m[3][0] + v.y * m[3][1]); v.x * m[3][0] + v.y * m[3][1]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x2<T> operator* GLM_FUNC_QUALIFIER tmat2x2<T> operator*
( (
tmat4x2<T> const & m1, tmat4x2<T> const & m1,
tmat2x4<T> const & m2 tmat2x4<T> const & m2
) )
{ {
T const SrcA00 = m1[0][0]; T const SrcA00 = m1[0][0];
T const SrcA01 = m1[0][1]; T const SrcA01 = m1[0][1];
T const SrcA10 = m1[1][0]; T const SrcA10 = m1[1][0];
T const SrcA11 = m1[1][1]; T const SrcA11 = m1[1][1];
T const SrcA20 = m1[2][0]; T const SrcA20 = m1[2][0];
T const SrcA21 = m1[2][1]; T const SrcA21 = m1[2][1];
T const SrcA30 = m1[3][0]; T const SrcA30 = m1[3][0];
T const SrcA31 = m1[3][1]; T const SrcA31 = m1[3][1];
T const SrcB00 = m2[0][0]; T const SrcB00 = m2[0][0];
T const SrcB01 = m2[0][1]; T const SrcB01 = m2[0][1];
T const SrcB02 = m2[0][2]; T const SrcB02 = m2[0][2];
T const SrcB03 = m2[0][3]; T const SrcB03 = m2[0][3];
T const SrcB10 = m2[1][0]; T const SrcB10 = m2[1][0];
T const SrcB11 = m2[1][1]; T const SrcB11 = m2[1][1];
T const SrcB12 = m2[1][2]; T const SrcB12 = m2[1][2];
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 + SrcA10 * 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;
return Result; return Result;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat3x2<T> operator* GLM_FUNC_QUALIFIER tmat3x2<T> operator*
@ -632,75 +632,75 @@ namespace detail
m1[0][1] * m2[3][0] + m1[1][1] * m2[3][1] + m1[2][1] * m2[3][2] + m1[3][1] * m2[3][3]); m1[0][1] * m2[3][0] + m1[1][1] * m2[3][1] + m1[2][1] * m2[3][2] + m1[3][1] * m2[3][3]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat4x2<T> operator/ GLM_FUNC_QUALIFIER tmat4x2<T> operator/
( (
tmat4x2<T> const & m, tmat4x2<T> const & m,
typename tmat4x2<T>::value_type const & s typename tmat4x2<T>::value_type const & s
) )
{ {
return tmat4x2<T>( return tmat4x2<T>(
m[0] / s, m[0] / s,
m[1] / s, m[1] / s,
m[2] / s, m[2] / s,
m[3] / s); m[3] / s);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat4x2<T> operator/ GLM_FUNC_QUALIFIER tmat4x2<T> operator/
( (
typename tmat4x2<T>::value_type const & s, typename tmat4x2<T>::value_type const & s,
tmat4x2<T> const & m tmat4x2<T> const & m
) )
{ {
return tmat4x2<T>( return tmat4x2<T>(
s / m[0], s / m[0],
s / m[1], s / m[1],
s / m[2], s / m[2],
s / m[3]); s / m[3]);
} }
// Unary constant operators // Unary constant operators
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat4x2<T> const operator- GLM_FUNC_QUALIFIER tmat4x2<T> const operator-
( (
tmat4x2<T> const & m tmat4x2<T> const & m
) )
{ {
return tmat4x2<T>( return tmat4x2<T>(
-m[0], -m[0],
-m[1], -m[1],
-m[2], -m[2],
-m[3]); -m[3]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat4x2<T> const operator++ GLM_FUNC_QUALIFIER tmat4x2<T> const operator++
( (
tmat4x2<T> const & m, tmat4x2<T> const & m,
int int
) )
{ {
return tmat4x2<T>( return tmat4x2<T>(
m[0] + typename tmat4x2<T>::value_type(1), m[0] + typename tmat4x2<T>::value_type(1),
m[1] + typename tmat4x2<T>::value_type(1), m[1] + typename tmat4x2<T>::value_type(1),
m[2] + typename tmat4x2<T>::value_type(1), m[2] + typename tmat4x2<T>::value_type(1),
m[3] + typename tmat4x2<T>::value_type(1)); m[3] + typename tmat4x2<T>::value_type(1));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat4x2<T> const operator-- GLM_FUNC_QUALIFIER tmat4x2<T> const operator--
( (
tmat4x2<T> const & m, tmat4x2<T> const & m,
int int
) )
{ {
return tmat4x2<T>( return tmat4x2<T>(
m[0] - typename tmat4x2<T>::value_type(1), m[0] - typename tmat4x2<T>::value_type(1),
m[1] - typename tmat4x2<T>::value_type(1), m[1] - typename tmat4x2<T>::value_type(1),
m[2] - typename tmat4x2<T>::value_type(1), m[2] - typename tmat4x2<T>::value_type(1),
m[3] - typename tmat4x2<T>::value_type(1)); m[3] - typename tmat4x2<T>::value_type(1));
} }
////////////////////////////////////// //////////////////////////////////////
// Boolean operators // Boolean operators
@ -724,6 +724,5 @@ namespace detail
{ {
return (m1[0] != m2[0]) || (m1[1] != m2[1]) || (m1[2] != m2[2]) || (m1[3] != m2[3]); return (m1[0] != m2[0]) || (m1[1] != m2[1]) || (m1[2] != m2[2]) || (m1[3] != m2[3]);
} }
} //namespace detail } //namespace detail
} //namespace glm } //namespace glm

@ -48,8 +48,8 @@ namespace detail
template <typename T> struct tmat4x3; template <typename T> struct tmat4x3;
template <typename T> struct tmat4x4; template <typename T> struct tmat4x4;
// \brief Template for 4 columns and 3 rows matrix of floating-point numbers. /// @brief Template for 4 columns and 3 rows matrix of floating-point numbers.
// \ingroup core_template /// @ingroup core_template
template <typename T> template <typename T>
struct tmat4x3 struct tmat4x3
{ {
@ -88,31 +88,31 @@ namespace detail
col_type const & v0, col_type const & v0,
col_type const & v1, col_type const & v1,
col_type const & v2, col_type const & v2,
col_type const & v3); col_type const & v3);
////////////////////////////////////// //////////////////////////////////////
// Conversions // Conversions
template <typename U> template <typename U>
GLM_FUNC_DECL explicit tmat4x3( GLM_FUNC_DECL explicit tmat4x3(
U const & x); U const & x);
template < template <
typename X1, typename Y1, typename Z1, typename X1, typename Y1, typename Z1,
typename X2, typename Y2, typename Z2, typename X2, typename Y2, typename Z2,
typename X3, typename Y3, typename Z3, typename X3, typename Y3, typename Z3,
typename X4, typename Y4, typename Z4> typename X4, typename Y4, typename Z4>
GLM_FUNC_DECL explicit tmat4x3( GLM_FUNC_DECL explicit tmat4x3(
X1 const & x1, Y1 const & y1, Z1 const & z1, X1 const & x1, Y1 const & y1, Z1 const & z1,
X2 const & x2, Y2 const & y2, Z2 const & z2, X2 const & x2, Y2 const & y2, Z2 const & z2,
X3 const & x3, Y3 const & y3, Z3 const & z3, X3 const & x3, Y3 const & y3, Z3 const & z3,
X4 const & x4, Y4 const & y4, Z4 const & z4); X4 const & x4, Y4 const & y4, Z4 const & z4);
template <typename V1, typename V2, typename V3, typename V4> template <typename V1, typename V2, typename V3, typename V4>
GLM_FUNC_DECL explicit tmat4x3( GLM_FUNC_DECL explicit tmat4x3(
tvec3<V1> const & v1, tvec3<V1> const & v1,
tvec3<V2> const & v2, tvec3<V2> const & v2,
tvec3<V3> const & v3, tvec3<V3> const & v3,
tvec3<V4> const & v4); tvec3<V4> const & v4);
// Matrix conversions // Matrix conversions
template <typename U> template <typename U>
@ -234,7 +234,6 @@ namespace detail
tmat4x3<T> const operator++ ( tmat4x3<T> const operator++ (
tmat4x3<T> const & m, tmat4x3<T> const & m,
int); int);
}//namespace detail }//namespace detail
/// @addtogroup core_precision /// @addtogroup core_precision

File diff suppressed because it is too large Load Diff

@ -68,9 +68,9 @@ namespace detail
public: public:
/// Implementation detail /// Implementation detail
/// @cond DETAIL /// @cond DETAIL
GLM_FUNC_DECL tmat4x4<T> _inverse() const; GLM_FUNC_DECL tmat4x4<T> _inverse() const;
/// @endcond /// @endcond
private: private:
// Data // Data
@ -100,25 +100,25 @@ namespace detail
// Conversions // Conversions
template <typename U> template <typename U>
GLM_FUNC_DECL explicit tmat4x4( GLM_FUNC_DECL explicit tmat4x4(
U const & x); U const & x);
template < template <
typename X1, typename Y1, typename Z1, typename W1, typename X1, typename Y1, typename Z1, typename W1,
typename X2, typename Y2, typename Z2, typename W2, typename X2, typename Y2, typename Z2, typename W2,
typename X3, typename Y3, typename Z3, typename W3, typename X3, typename Y3, typename Z3, typename W3,
typename X4, typename Y4, typename Z4, typename W4> typename X4, typename Y4, typename Z4, typename W4>
GLM_FUNC_DECL explicit tmat4x4( GLM_FUNC_DECL explicit tmat4x4(
X1 const & x1, Y1 const & y1, Z1 const & z1, W1 const & w1, X1 const & x1, Y1 const & y1, Z1 const & z1, W1 const & w1,
X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2, X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2,
X3 const & x3, Y3 const & y3, Z3 const & z3, W3 const & w3, X3 const & x3, Y3 const & y3, Z3 const & z3, W3 const & w3,
X4 const & x4, Y4 const & y4, Z4 const & z4, W4 const & w4); X4 const & x4, Y4 const & y4, Z4 const & z4, W4 const & w4);
template <typename V1, typename V2, typename V3, typename V4> template <typename V1, typename V2, typename V3, typename V4>
GLM_FUNC_DECL explicit tmat4x4( GLM_FUNC_DECL explicit tmat4x4(
tvec4<V1> const & v1, tvec4<V1> const & v1,
tvec4<V2> const & v2, tvec4<V2> const & v2,
tvec4<V3> const & v3, tvec4<V3> const & v3,
tvec4<V4> const & v4); tvec4<V4> const & v4);
// Matrix conversions // Matrix conversions
template <typename U> template <typename U>

File diff suppressed because it is too large Load Diff

@ -44,8 +44,8 @@ namespace detail
template <typename T> struct tvec3; template <typename T> struct tvec3;
template <typename T> struct tvec4; template <typename T> struct tvec4;
// The basic 2D vector type. /// The basic 2D vector type.
// \ingroup core_template /// @ingroup core_template
template <typename T> template <typename T>
struct tvec2 struct tvec2
{ {
@ -127,11 +127,11 @@ namespace detail
tvec2(tref2<T> const & r); tvec2(tref2<T> const & r);
template <int E0, int E1> template <int E0, int E1>
GLM_FUNC_DECL tvec2(const glm::detail::swizzle<2,T,tvec2<T>,E0,E1,-1,-2>& that) GLM_FUNC_DECL tvec2(const glm::detail::swizzle<2,T,tvec2<T>,E0,E1,-1,-2>& that)
{ {
*this = that(); *this = that();
} }
////////////////////////////////////// //////////////////////////////////////
// Convertion constructors // Convertion constructors

@ -1024,6 +1024,5 @@ namespace detail
{ {
return tvec2<T>(this->x, this->y); return tvec2<T>(this->x, this->y);
} }
}//namespace detail }//namespace detail
}//namespace glm }//namespace glm

@ -44,8 +44,8 @@ namespace detail
template <typename T> struct tvec2; template <typename T> struct tvec2;
template <typename T> struct tvec4; template <typename T> struct tvec4;
// Basic 3D vector type. /// Basic 3D vector type.
// \ingroup core_template /// @ingroup core_template
template <typename T> template <typename T>
struct tvec3 struct tvec3
{ {
@ -165,23 +165,23 @@ namespace detail
template <typename A, typename B> template <typename A, typename B>
GLM_FUNC_DECL explicit tvec3(A const & s, tref2<B> const & v); GLM_FUNC_DECL explicit tvec3(A const & s, tref2<B> const & v);
template <int E0, int E1, int E2> template <int E0, int E1, int E2>
GLM_FUNC_DECL tvec3(glm::detail::swizzle<3, T, tvec3<T>, E0, E1, E2, -1> const & that) GLM_FUNC_DECL tvec3(glm::detail::swizzle<3, T, tvec3<T>, E0, E1, E2, -1> const & that)
{ {
*this = that(); *this = that();
} }
template <int E0, int E1> template <int E0, int E1>
GLM_FUNC_DECL tvec3(glm::detail::swizzle<2, T, tvec2<T>, E0, E1, -1, -2> const & v, T const & s) GLM_FUNC_DECL tvec3(glm::detail::swizzle<2, T, tvec2<T>, E0, E1, -1, -2> const & v, T const & s)
{ {
*this = tvec3<T>(v(), s); *this = tvec3<T>(v(), s);
} }
template <int E0, int E1> template <int E0, int E1>
GLM_FUNC_DECL tvec3(T const & s, glm::detail::swizzle<2, T, tvec2<T>, E0, E1, -1, -2> const & v) GLM_FUNC_DECL tvec3(T const & s, glm::detail::swizzle<2, T, tvec2<T>, E0, E1, -1, -2> const & v)
{ {
*this = tvec3<T>(s, v()); *this = tvec3<T>(s, v());
} }
////////////////////////////////////// //////////////////////////////////////
// Unary arithmetic operators // Unary arithmetic operators

@ -166,47 +166,47 @@ namespace detail
template <typename U> template <typename U>
GLM_FUNC_DECL explicit tvec4(tvec4<U> const & v); GLM_FUNC_DECL explicit tvec4(tvec4<U> const & v);
template <int E0, int E1, int E2, int E3> template <int E0, int E1, int E2, int E3>
GLM_FUNC_DECL tvec4(glm::detail::swizzle<4, T, tvec4<T>, E0, E1, E2, E3> const & that) GLM_FUNC_DECL tvec4(glm::detail::swizzle<4, T, tvec4<T>, E0, E1, E2, E3> const & that)
{ {
*this = that(); *this = that();
} }
template <int E0, int E1, int F0, int F1> template <int E0, int E1, int F0, int F1>
GLM_FUNC_DECL tvec4(glm::detail::swizzle<2, T, tvec2<T>, E0, E1, -1, -2> const & v, glm::detail::swizzle<2, T, tvec2<T>, F0, F1, -1, -2> const & u) GLM_FUNC_DECL tvec4(glm::detail::swizzle<2, T, tvec2<T>, E0, E1, -1, -2> const & v, glm::detail::swizzle<2, T, tvec2<T>, F0, F1, -1, -2> const & u)
{ {
*this = tvec4<T>(v(), u()); *this = tvec4<T>(v(), u());
} }
template <int E0, int E1> template <int E0, int E1>
GLM_FUNC_DECL tvec4(T const & x, T const & y, glm::detail::swizzle<2, T, tvec2<T>, E0, E1, -1, -2> const & v) GLM_FUNC_DECL tvec4(T const & x, T const & y, glm::detail::swizzle<2, T, tvec2<T>, E0, E1, -1, -2> const & v)
{ {
*this = tvec4<T>(x, y, v()); *this = tvec4<T>(x, y, v());
} }
template <int E0, int E1> template <int E0, int E1>
GLM_FUNC_DECL tvec4(T const & x, glm::detail::swizzle<2, T, tvec2<T>, E0, E1, -1, -2> const & v, T const & w) GLM_FUNC_DECL tvec4(T const & x, glm::detail::swizzle<2, T, tvec2<T>, E0, E1, -1, -2> const & v, T const & w)
{ {
*this = tvec4<T>(x, v(), w); *this = tvec4<T>(x, v(), w);
} }
template <int E0, int E1> template <int E0, int E1>
GLM_FUNC_DECL tvec4(glm::detail::swizzle<2, T, tvec2<T>, E0, E1, -1, -2> const & v, T const & z, T const & w) GLM_FUNC_DECL tvec4(glm::detail::swizzle<2, T, tvec2<T>, E0, E1, -1, -2> const & v, T const & z, T const & w)
{ {
*this = tvec4<T>(v(), z, w); *this = tvec4<T>(v(), z, w);
} }
template <int E0, int E1, int E2> template <int E0, int E1, int E2>
GLM_FUNC_DECL tvec4(glm::detail::swizzle<3, T, tvec3<T>, E0, E1, E2, -1> const & v, T const & w) GLM_FUNC_DECL tvec4(glm::detail::swizzle<3, T, tvec3<T>, E0, E1, E2, -1> const & v, T const & w)
{ {
*this = tvec4<T>(v(), w); *this = tvec4<T>(v(), w);
} }
template <int E0, int E1, int E2> template <int E0, int E1, int E2>
GLM_FUNC_DECL tvec4(T const & x, glm::detail::swizzle<3, T, tvec3<T>, E0, E1, E2, -1> const & v) GLM_FUNC_DECL tvec4(T const & x, glm::detail::swizzle<3, T, tvec3<T>, E0, E1, E2, -1> const & v)
{ {
*this = tvec4<T>(x, v()); *this = tvec4<T>(x, v());
} }
////////////////////////////////////// //////////////////////////////////////
// Swizzle constructors // Swizzle constructors

@ -56,16 +56,16 @@ namespace glm
/// Returns the component-wise compare of |x - y| < epsilon. /// Returns the component-wise compare of |x - y| < epsilon.
/// @see gtc_epsilon /// @see gtc_epsilon
template <typename genTypeT, typename genTypeU> template <typename genTypeT, typename genTypeU, typename boolType>
bool epsilonEqual( boolType epsilonEqual(
genTypeT const & x, genTypeT const & x,
genTypeT const & y, genTypeT const & y,
genTypeU const & epsilon); genTypeU const & epsilon);
/// Returns the component-wise compare of |x - y| >= epsilon. /// Returns the component-wise compare of |x - y| >= epsilon.
/// @see gtc_epsilon /// @see gtc_epsilon
template <typename genTypeT, typename genTypeU> template <typename genTypeT, typename genTypeU, typename boolType>
bool epsilonNotEqual( boolType epsilonNotEqual(
genTypeT const & x, genTypeT const & x,
genTypeT const & y, genTypeT const & y,
genTypeU const & epsilon); genTypeU const & epsilon);

@ -28,108 +28,82 @@
namespace glm namespace glm
{ {
template <typename genType> template <>
GLM_FUNC_QUALIFIER bool epsilonEqual GLM_FUNC_QUALIFIER bool epsilonEqual
( (
genType const & x, glm::half const & x,
genType const & y, glm::half const & y,
genType const & epsilon glm::half const & epsilon
) )
{ {
return abs(x - y) < epsilon; return abs(x - y) < epsilon;
} }
template <typename genType> template <>
GLM_FUNC_QUALIFIER bool epsilonNotEqual GLM_FUNC_QUALIFIER bool epsilonEqual
( (
genType const & x, float const & x,
genType const & y, float const & y,
genType const & epsilon float const & epsilon
) )
{ {
return abs(x - y) >= epsilon; return abs(x - y) < epsilon;
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec2<bool> epsilonEqual
(
detail::tvec2<valType> const & x,
detail::tvec2<valType> const & y,
valType const & epsilon)
{
return detail::tvec2<bool>(
abs(x.x - y.x) < epsilon,
abs(x.y - y.y) < epsilon);
} }
template <typename valType> template <>
GLM_FUNC_QUALIFIER detail::tvec3<bool> epsilonEqual GLM_FUNC_QUALIFIER bool epsilonEqual
( (
detail::tvec3<valType> const & x, double const & x,
detail::tvec3<valType> const & y, double const & y,
valType const & epsilon) double const & epsilon
)
{ {
return detail::tvec3<bool>( return abs(x - y) < epsilon;
abs(x.x - y.x) < epsilon,
abs(x.y - y.y) < epsilon,
abs(x.z - y.z) < epsilon);
} }
template <typename valType> template <>
GLM_FUNC_QUALIFIER detail::tvec4<bool> epsilonEqual GLM_FUNC_QUALIFIER bool epsilonNotEqual
( (
detail::tvec4<valType> const & x, glm::half const & x,
detail::tvec4<valType> const & y, glm::half const & y,
valType const & epsilon glm::half const & epsilon
) )
{ {
return detail::tvec4<bool>( return abs(x - y) >= epsilon;
abs(x.x - y.x) < epsilon,
abs(x.y - y.y) < epsilon,
abs(x.z - y.z) < epsilon,
abs(x.w - y.w) < epsilon);
} }
template <typename valType> template <>
GLM_FUNC_QUALIFIER detail::tvec2<bool> epsilonNotEqual GLM_FUNC_QUALIFIER bool epsilonNotEqual
( (
detail::tvec2<valType> const & x, float const & x,
detail::tvec2<valType> const & y, float const & y,
valType const & epsilon float const & epsilon
) )
{ {
return detail::tvec2<bool>( return abs(x - y) >= epsilon;
abs(x.x - y.x) >= epsilon,
abs(x.y - y.y) >= epsilon);
} }
template <typename valType> template <>
GLM_FUNC_QUALIFIER detail::tvec3<bool> epsilonNotEqual GLM_FUNC_QUALIFIER bool epsilonNotEqual
( (
detail::tvec3<valType> const & x, double const & x,
detail::tvec3<valType> const & y, double const & y,
valType const & epsilon double const & epsilon
) )
{ {
return detail::tvec3<bool>( return abs(x - y) >= epsilon;
abs(x.x - y.x) >= epsilon,
abs(x.y - y.y) >= epsilon,
abs(x.z - y.z) >= epsilon);
} }
template <typename valType> template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<bool> epsilonNotEqual GLM_FUNC_QUALIFIER detail::tvec2<bool> epsilonEqual
( (
detail::tvec4<valType> const & x, detail::tvec2<valType> const & x,
detail::tvec4<valType> const & y, detail::tvec2<valType> const & y,
valType const & epsilon valType const & epsilon)
)
{ {
return detail::tvec4<bool>( return detail::tvec2<bool>(
abs(x.x - y.x) >= epsilon, abs(x.x - y.x) < epsilon,
abs(x.y - y.y) >= epsilon, abs(x.y - y.y) < epsilon);
abs(x.z - y.z) >= epsilon,
abs(x.w - y.w) >= epsilon);
} }
template <typename valType> template <typename valType>
@ -145,6 +119,19 @@ namespace glm
abs(x.y - y.y) < epsilon.y); abs(x.y - y.y) < epsilon.y);
} }
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<bool> epsilonEqual
(
detail::tvec3<valType> const & x,
detail::tvec3<valType> const & y,
valType const & epsilon)
{
return detail::tvec3<bool>(
abs(x.x - y.x) < epsilon,
abs(x.y - y.y) < epsilon,
abs(x.z - y.z) < epsilon);
}
template <typename valType> template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<bool> epsilonEqual GLM_FUNC_QUALIFIER detail::tvec3<bool> epsilonEqual
( (
@ -164,22 +151,22 @@ namespace glm
( (
detail::tvec4<valType> const & x, detail::tvec4<valType> const & x,
detail::tvec4<valType> const & y, detail::tvec4<valType> const & y,
detail::tvec4<valType> const & epsilon valType const & epsilon
) )
{ {
return detail::tvec4<bool>( return detail::tvec4<bool>(
abs(x.x - y.x) < epsilon.x, abs(x.x - y.x) < epsilon,
abs(x.y - y.y) < epsilon.y, abs(x.y - y.y) < epsilon,
abs(x.z - y.z) < epsilon.z, abs(x.z - y.z) < epsilon,
abs(x.w - y.w) < epsilon.w); abs(x.w - y.w) < epsilon);
} }
template <typename valType> template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<bool> epsilonEqual GLM_FUNC_QUALIFIER detail::tvec4<bool> epsilonEqual
( (
detail::tquat<valType> const & x, detail::tvec4<valType> const & x,
detail::tquat<valType> const & y, detail::tvec4<valType> const & y,
detail::tquat<valType> const & epsilon detail::tvec4<valType> const & epsilon
) )
{ {
return detail::tvec4<bool>( return detail::tvec4<bool>(
@ -189,6 +176,19 @@ namespace glm
abs(x.w - y.w) < epsilon.w); abs(x.w - y.w) < epsilon.w);
} }
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec2<bool> epsilonNotEqual
(
detail::tvec2<valType> const & x,
detail::tvec2<valType> const & y,
valType const & epsilon
)
{
return detail::tvec2<bool>(
abs(x.x - y.x) >= epsilon,
abs(x.y - y.y) >= epsilon);
}
template <typename valType> template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec2<bool> epsilonNotEqual GLM_FUNC_QUALIFIER detail::tvec2<bool> epsilonNotEqual
( (
@ -202,6 +202,20 @@ namespace glm
abs(x.y - y.y) >= epsilon.y); abs(x.y - y.y) >= epsilon.y);
} }
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<bool> epsilonNotEqual
(
detail::tvec3<valType> const & x,
detail::tvec3<valType> const & y,
valType const & epsilon
)
{
return detail::tvec3<bool>(
abs(x.x - y.x) >= epsilon,
abs(x.y - y.y) >= epsilon,
abs(x.z - y.z) >= epsilon);
}
template <typename valType> template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<bool> epsilonNotEqual GLM_FUNC_QUALIFIER detail::tvec3<bool> epsilonNotEqual
( (
@ -216,6 +230,21 @@ namespace glm
abs(x.z - y.z) >= epsilon.z); abs(x.z - y.z) >= epsilon.z);
} }
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<bool> epsilonNotEqual
(
detail::tvec4<valType> const & x,
detail::tvec4<valType> const & y,
valType const & epsilon
)
{
return detail::tvec4<bool>(
abs(x.x - y.x) >= epsilon,
abs(x.y - y.y) >= epsilon,
abs(x.z - y.z) >= epsilon,
abs(x.w - y.w) >= epsilon);
}
template <typename valType> template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<bool> epsilonNotEqual GLM_FUNC_QUALIFIER detail::tvec4<bool> epsilonNotEqual
( (
@ -231,6 +260,22 @@ namespace glm
abs(x.w - y.w) >= epsilon.w); abs(x.w - y.w) >= epsilon.w);
} }
/*
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<bool> epsilonEqual
(
detail::tquat<valType> const & x,
detail::tquat<valType> const & y,
detail::tquat<valType> const & epsilon
)
{
return detail::tvec4<bool>(
abs(x.x - y.x) < epsilon.x,
abs(x.y - y.y) < epsilon.y,
abs(x.z - y.z) < epsilon.z,
abs(x.w - y.w) < epsilon.w);
}
template <typename valType> template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<bool> epsilonNotEqual GLM_FUNC_QUALIFIER detail::tvec4<bool> epsilonNotEqual
( (
@ -245,4 +290,6 @@ namespace glm
abs(x.z - y.z) >= epsilon.z, abs(x.z - y.z) >= epsilon.z,
abs(x.w - y.w) >= epsilon.w); abs(x.w - y.w) >= epsilon.w);
} }
*/
}//namespace glm }//namespace glm

@ -34,24 +34,20 @@ int test_inverse()
int Error(0); int Error(0);
{ {
glm::mat2 Matrix(1, 2, 3, 4); glm::mat2 const Matrix(1, 2, 3, 4);
glm::mat2 Inverse = glm::inverse(Matrix); glm::mat2 const Inverse = glm::inverse(Matrix);
glm::mat2 Identity = Matrix * Inverse; glm::mat2 const Identity = Matrix * Inverse;
Error += glm::epsilonEqual(Identity[0][0], 1.0f, 0.01f) ? 0 : 1; Error += glm::all(glm::epsilonEqual(Identity[0], glm::vec2(1.0f, 0.0f), glm::vec2(0.01f))) ? 0 : 1;
Error += glm::epsilonEqual(Identity[0][1], 0.0f, 0.01f) ? 0 : 1; Error += glm::all(glm::epsilonEqual(Identity[1], glm::vec2(0.0f, 1.0f), glm::vec2(0.01f))) ? 0 : 1;
Error += glm::epsilonEqual(Identity[1][0], 0.0f, 0.01f) ? 0 : 1;
Error += glm::epsilonEqual(Identity[1][1], 1.0f, 0.01f) ? 0 : 1;
} }
{ {
glm::mat2 Matrix(1, 2, 3, 4); glm::mat2 const Matrix(1, 2, 3, 4);
glm::mat2 Identity = Matrix / Matrix; glm::mat2 const Identity = Matrix / Matrix;
Error += glm::epsilonEqual(Identity[0][0], 1.0f, 0.01f) ? 0 : 1; Error += glm::all(glm::epsilonEqual(Identity[0], glm::vec2(1.0f, 0.0f), glm::vec2(0.01f))) ? 0 : 1;
Error += glm::epsilonEqual(Identity[0][1], 0.0f, 0.01f) ? 0 : 1; Error += glm::all(glm::epsilonEqual(Identity[1], glm::vec2(0.0f, 1.0f), glm::vec2(0.01f))) ? 0 : 1;
Error += glm::epsilonEqual(Identity[1][0], 0.0f, 0.01f) ? 0 : 1;
Error += glm::epsilonEqual(Identity[1][1], 1.0f, 0.01f) ? 0 : 1;
} }
return Error; return Error;

@ -8,6 +8,7 @@
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp> #include <glm/glm.hpp>
#include <glm/gtc/epsilon.hpp>
#include <cstdio> #include <cstdio>
void print(glm::dmat3 const & Mat0) void print(glm::dmat3 const & Mat0)
@ -53,12 +54,45 @@ static int test_operators()
return (S && !R) ? 0 : 1; return (S && !R) ? 0 : 1;
} }
int test_inverse()
{
int Error(0);
{
glm::mat3 const Matrix(
glm::vec3(0.6f, 0.2f, 0.3f),
glm::vec3(0.2f, 0.7f, 0.5f),
glm::vec3(0.3f, 0.5f, 0.7f));
glm::mat3 const Inverse = glm::inverse(Matrix);
glm::mat3 const Identity = Matrix * Inverse;
Error += glm::all(glm::epsilonEqual(Identity[0], glm::vec3(1.0f, 0.0f, 0.0f), glm::vec3(0.01f))) ? 0 : 1;
Error += glm::all(glm::epsilonEqual(Identity[1], glm::vec3(0.0f, 1.0f, 0.0f), glm::vec3(0.01f))) ? 0 : 1;
Error += glm::all(glm::epsilonEqual(Identity[2], glm::vec3(0.0f, 0.0f, 1.0f), glm::vec3(0.01f))) ? 0 : 1;
}
{
glm::mat3 const Matrix(
glm::vec3(0.6f, 0.2f, 0.3f),
glm::vec3(0.2f, 0.7f, 0.5f),
glm::vec3(0.3f, 0.5f, 0.7f));
glm::mat3 const Identity = Matrix / Matrix;
Error += glm::all(glm::epsilonEqual(Identity[0], glm::vec3(1.0f, 0.0f, 0.0f), glm::vec3(0.01f))) ? 0 : 1;
Error += glm::all(glm::epsilonEqual(Identity[1], glm::vec3(0.0f, 1.0f, 0.0f), glm::vec3(0.01f))) ? 0 : 1;
Error += glm::all(glm::epsilonEqual(Identity[2], glm::vec3(0.0f, 0.0f, 1.0f), glm::vec3(0.01f))) ? 0 : 1;
}
return Error;
}
int main() int main()
{ {
int Error = 0; int Error = 0;
Error += test_mat3x3(); Error += test_mat3x3();
Error += test_operators(); Error += test_operators();
Error += test_inverse();
return Error; return Error;
} }

@ -7,8 +7,9 @@
// File : test/core/type_mat4x4.cpp // File : test/core/type_mat4x4.cpp
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_PRECISION_HIGHP_FLOAT //#define GLM_PRECISION_HIGHP_FLOAT
#include <glm/glm.hpp> #include <glm/glm.hpp>
#include <glm/gtc/epsilon.hpp>
#include <cstdio> #include <cstdio>
void print(glm::dmat4 const & Mat0) void print(glm::dmat4 const & Mat0)
@ -20,7 +21,33 @@ void print(glm::dmat4 const & Mat0)
printf("\tvec4(%2.3f, %2.3f, %2.3f, %2.3f))\n\n", Mat0[3][0], Mat0[3][1], Mat0[3][2], Mat0[3][3]); printf("\tvec4(%2.3f, %2.3f, %2.3f, %2.3f))\n\n", Mat0[3][0], Mat0[3][1], Mat0[3][2], Mat0[3][3]);
} }
int test_mat4x4() void print(glm::mat4 const & Mat0)
{
printf("mat4(\n");
printf("\tvec4(%2.3f, %2.3f, %2.3f, %2.3f)\n", Mat0[0][0], Mat0[0][1], Mat0[0][2], Mat0[0][3]);
printf("\tvec4(%2.3f, %2.3f, %2.3f, %2.3f)\n", Mat0[1][0], Mat0[1][1], Mat0[1][2], Mat0[1][3]);
printf("\tvec4(%2.3f, %2.3f, %2.3f, %2.3f)\n", Mat0[2][0], Mat0[2][1], Mat0[2][2], Mat0[2][3]);
printf("\tvec4(%2.3f, %2.3f, %2.3f, %2.3f))\n\n", Mat0[3][0], Mat0[3][1], Mat0[3][2], Mat0[3][3]);
}
int test_inverse_mat4x4()
{
glm::mat4 Mat0(
glm::vec4(0.6f, 0.2f, 0.3f, 0.4f),
glm::vec4(0.2f, 0.7f, 0.5f, 0.3f),
glm::vec4(0.3f, 0.5f, 0.7f, 0.2f),
glm::vec4(0.4f, 0.3f, 0.2f, 0.6f));
glm::mat4 Inv0 = glm::inverse(Mat0);
glm::mat4 Res0 = Mat0 * Inv0;
print(Mat0);
print(Inv0);
print(Res0);
return 0;
}
int test_inverse_dmat4x4()
{ {
glm::dmat4 Mat0( glm::dmat4 Mat0(
glm::dvec4(0.6f, 0.2f, 0.3f, 0.4f), glm::dvec4(0.6f, 0.2f, 0.3f, 0.4f),
@ -56,12 +83,54 @@ static bool test_operators()
return (S && !R) ? 0 : 1; return (S && !R) ? 0 : 1;
} }
int test_inverse()
{
int Error(0);
{
glm::mat4 const Matrix(
glm::vec4(0.6f, 0.2f, 0.3f, 0.4f),
glm::vec4(0.2f, 0.7f, 0.5f, 0.3f),
glm::vec4(0.3f, 0.5f, 0.7f, 0.2f),
glm::vec4(0.4f, 0.3f, 0.2f, 0.6f));
glm::mat4 const Inverse = glm::inverse(Matrix);
glm::mat4 const Identity = Matrix * Inverse;
print(Matrix);
print(Inverse);
print(Identity);
Error += glm::all(glm::epsilonEqual(Identity[0], glm::vec4(1.0f, 0.0f, 0.0f, 0.0f), glm::vec4(0.01f))) ? 0 : 1;
Error += glm::all(glm::epsilonEqual(Identity[1], glm::vec4(0.0f, 1.0f, 0.0f, 0.0f), glm::vec4(0.01f))) ? 0 : 1;
Error += glm::all(glm::epsilonEqual(Identity[2], glm::vec4(0.0f, 0.0f, 1.0f, 0.0f), glm::vec4(0.01f))) ? 0 : 1;
Error += glm::all(glm::epsilonEqual(Identity[3], glm::vec4(0.0f, 0.0f, 0.0f, 1.0f), glm::vec4(0.01f))) ? 0 : 1;
}
{
glm::mat4 const Matrix(
glm::vec4(0.6f, 0.2f, 0.3f, 0.4f),
glm::vec4(0.2f, 0.7f, 0.5f, 0.3f),
glm::vec4(0.3f, 0.5f, 0.7f, 0.2f),
glm::vec4(0.4f, 0.3f, 0.2f, 0.6f));
glm::mat4 const Identity = Matrix / Matrix;
Error += glm::all(glm::epsilonEqual(Identity[0], glm::vec4(1.0f, 0.0f, 0.0f, 0.0f), glm::vec4(0.01f))) ? 0 : 1;
Error += glm::all(glm::epsilonEqual(Identity[1], glm::vec4(0.0f, 1.0f, 0.0f, 0.0f), glm::vec4(0.01f))) ? 0 : 1;
Error += glm::all(glm::epsilonEqual(Identity[2], glm::vec4(0.0f, 0.0f, 1.0f, 0.0f), glm::vec4(0.01f))) ? 0 : 1;
Error += glm::all(glm::epsilonEqual(Identity[3], glm::vec4(0.0f, 0.0f, 0.0f, 1.0f), glm::vec4(0.01f))) ? 0 : 1;
}
return Error;
}
int main() int main()
{ {
int Error = 0; int Error = 0;
Error += test_mat4x4(); Error += test_inverse_dmat4x4();
Error += test_inverse_mat4x4();
Error += test_operators(); Error += test_operators();
Error += test_inverse();
return Error; return Error;
} }

Loading…
Cancel
Save