Added implementation of missing matrix constructor

This commit is contained in:
Christophe Riccio 2011-06-01 20:17:23 +01:00
parent 35ed096cc8
commit f9dd517d0c
7 changed files with 282 additions and 10 deletions

View File

@ -122,11 +122,11 @@ namespace detail
}
template <typename T>
template <typename U, typename V, typename M, typename N>
template <typename X1, typename Y1, typename X2, typename Y2>
GLM_FUNC_DECL tmat2x2<T>::tmat2x2
(
U const & x1, V const & y1,
M const & x2, N const & y2
X1 const & x1, Y1 const & y1,
X2 const & x2, Y2 const & y2
)
{
this->value[0] = col_type(value_type(x1), value_type(y1));
@ -134,11 +134,11 @@ namespace detail
}
template <typename T>
template <typename U, typename V>
template <typename V1, typename V2>
GLM_FUNC_DECL tmat2x2<T>::tmat2x2
(
tvec2<U> const & v1,
tvec2<V> const & v2
tvec2<V1> const & v1,
tvec2<V2> const & v2
)
{
this->value[0] = col_type(v1);
@ -146,7 +146,7 @@ namespace detail
}
//////////////////////////////////////////////////////////////
// mat2x2 conversions
// mat2x2 matrix conversions
template <typename T>
template <typename U>

View File

@ -106,7 +106,49 @@ namespace detail
this->value[1] = v1;
}
// Conversion
//////////////////////////////////////
// Convertion constructors
template <typename T>
template <typename U>
GLM_FUNC_DECL tmat2x3<T>::tmat2x3
(
U const & s
)
{
value_type const Zero(0);
this->value[0] = tvec3<T>(value_type(s), Zero, Zero);
this->value[1] = tvec3<T>(Zero, value_type(s), Zero);
}
template <typename T>
template <
typename X1, typename Y1, typename Z1,
typename X2, typename Y2, typename Z2>
GLM_FUNC_DECL tmat2x3<T>::tmat2x3
(
X1 const & x1, Y1 const & y1, Z1 const & z1,
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[1] = col_type(value_type(x2), value_type(y2), value_type(z2));
}
template <typename T>
template <typename V1, typename V2>
GLM_FUNC_DECL tmat2x3<T>::tmat2x3
(
tvec3<V1> const & v1,
tvec3<V2> const & v2
)
{
this->value[0] = col_type(v1);
this->value[1] = col_type(v2);
}
//////////////////////////////////////
// Matrix conversions
template <typename T>
template <typename U>
GLM_FUNC_QUALIFIER tmat2x3<T>::tmat2x3

View File

@ -109,7 +109,49 @@ namespace detail
this->value[1] = v1;
}
// Conversion
//////////////////////////////////////
// Convertion constructors
template <typename T>
template <typename U>
GLM_FUNC_DECL tmat2x4<T>::tmat2x4
(
U const & s
)
{
value_type const Zero(0);
this->value[0] = tvec4<T>(value_type(s), Zero, Zero, Zero);
this->value[1] = tvec4<T>(Zero, value_type(s), Zero, Zero);
}
template <typename T>
template <
typename X1, typename Y1, typename Z1, typename W1
typename X2, typename Y2, typename Z2, typename W2>
GLM_FUNC_DECL tmat2x4<T>::tmat2x4
(
X1 const & x1, Y1 const & y1, Z1 const & z1, W1 const & w1,
X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2,
)
{
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));
}
template <typename T>
template <typename V1, typename V2>
GLM_FUNC_DECL tmat2x4<T>::tmat2x4
(
tvec4<V1> const & v1,
tvec4<V2> const & v2
)
{
this->value[0] = col_type(v1);
this->value[1] = col_type(v2);
}
//////////////////////////////////////
// Matrix conversions
template <typename T>
template <typename U>
GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4

View File

@ -113,7 +113,55 @@ namespace detail
this->value[2] = v2;
}
// Conversion
//////////////////////////////////////
// Convertion constructors
template <typename T>
template <typename U>
GLM_FUNC_DECL tmat3x2<T>::tmat3x2
(
U const & s
)
{
value_type const Zero(0);
this->value[0] = tvec2<T>(value_type(s), Zero);
this->value[1] = tvec2<T>(Zero, value_type(s));
this->value[2] = tvec2<T>(Zero);
}
template <typename T>
template <
typename X1, typename Y1,
typename X2, typename Y2,
typename X3, typename Y3>
GLM_FUNC_DECL tmat3x2<T>::tmat3x2
(
X1 const & x1, Y1 const & y1,
X2 const & x2, Y2 const & y2,
X3 const & x3, Y3 const & y3
)
{
this->value[0] = col_type(value_type(x1), value_type(y1));
this->value[1] = col_type(value_type(x2), value_type(y2));
this->value[2] = col_type(value_type(x3), value_type(y3));
}
template <typename T>
template <typename U, typename V>
GLM_FUNC_DECL tmat3x2<T>::tmat3x2
(
tvec2<V1> const & v1,
tvec2<V2> const & v2,
tvec2<V3> const & v3
)
{
this->value[0] = col_type(v1);
this->value[1] = col_type(v2);
this->value[2] = col_type(v3);
}
//////////////////////////////////////////////////////////////
// mat3x2 matrix conversions
template <typename T>
template <typename U>
GLM_FUNC_QUALIFIER tmat3x2<T>::tmat3x2

View File

@ -116,6 +116,52 @@ namespace detail
this->value[2] = v2;
}
//////////////////////////////////////
// Convertion constructors
template <typename T>
template <typename U>
GLM_FUNC_DECL tmat3x3<T>::tmat3x3
(
U const & s
)
{
value_type const Zero(0);
this->value[0] = tvec3<T>(value_type(s), Zero, Zero);
this->value[1] = tvec3<T>(Zero, value_type(s), Zero);
this->value[2] = tvec3<T>(Zero, Zero, value_type(s));
}
template <typename T>
template <
typename X1, typename Y1, typename Z1,
typename X2, typename Y2, typename Z2,
typename X3, typename Y3, typename Z3>
GLM_FUNC_DECL tmat3x3<T>::tmat3x3
(
X1 const & x1, Y1 const & y1, Z1 const & z1,
X2 const & x2, Y2 const & y2, Z2 const & z2,
X3 const & x3, Y3 const & y3, Z3 const & z3
)
{
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[2] = col_type(value_type(x3), value_type(y3), value_type(z3));
}
template <typename T>
template <typename V1, typename V2, typename V3>
GLM_FUNC_DECL tmat3x3<T>::tmat3x3
(
tvec3<V1> const & v1,
tvec3<V2> const & v2,
tvec3<V3> const & v3
)
{
this->value[0] = col_type(v1);
this->value[1] = col_type(v2);
this->value[2] = col_type(v3);
}
//////////////////////////////////////////////////////////////
// Conversions

View File

@ -114,6 +114,52 @@ namespace detail
this->value[2] = v2;
}
//////////////////////////////////////
// Convertion constructors
template <typename T>
template <typename U>
GLM_FUNC_DECL tmat3x4<T>::tmat3x4
(
U const & s
)
{
value_type const Zero(0);
this->value[0] = tvec4<T>(value_type(s), Zero, Zero, Zero);
this->value[1] = tvec4<T>(Zero, value_type(s), Zero, Zero);
this->value[2] = tvec4<T>(Zero, Zero, value_type(s), Zero);
}
template <typename T>
template <
typename X1, typename Y1, typename Z1, typename W1,
typename X2, typename Y2, typename Z2, typename W2,
typename X3, typename Y3, typename Z3, typename W3>
GLM_FUNC_DECL tmat3x4<T>::tmat3x4
(
X1 const & x1, Y1 const & y1, Z1 const & z1, W1 const & w1,
X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2,
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[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));
}
template <typename T>
template <typename V1, typename V2, typename V3>
GLM_FUNC_DECL tmat3x4<T>::tmat3x4
(
tvec4<V1> const & v1,
tvec4<V2> const & v2,
tvec4<V3> const & v3
)
{
this->value[0] = col_type(v1);
this->value[1] = col_type(v2);
this->value[2] = col_type(v3);
}
// Conversion
template <typename T>
template <typename U>

View File

@ -123,6 +123,54 @@ namespace detail
this->value[3] = v3;
}
//////////////////////////////////////
// Convertion constructors
template <typename T>
template <typename U>
GLM_FUNC_DECL tmat4x2<T>::tmat4x2
(
U const & s
)
{
value_type const Zero(0);
this->value[0] = tvec4<T>(value_type(s), Zero);
this->value[1] = tvec4<T>(Zero, value_type(s));
this->value[2] = tvec4<T>(Zero, Zero);
this->value[3] = tvec4<T>(Zero, Zero);
}
template <typename T>
template <
typename X1, typename Y1,
typename X2, typename Y2,
typename X3, typename Y3,
typename X4, typename Y4>
GLM_FUNC_DECL tmat4x2<T>::tmat4x2
(
X1 const & x1, Y1 const & y1, Z1 const & z1, W1 const & w1,
X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2,
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[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));
}
template <typename T>
template <typename V1, typename V2, typename V3>
GLM_FUNC_DECL tmat4x2<T>::tmat4x2
(
tvec4<V1> const & v1,
tvec4<V2> const & v2,
tvec4<V3> const & v3
)
{
this->value[0] = col_type(v1);
this->value[1] = col_type(v2);
this->value[2] = col_type(v3);
}
// Conversion
template <typename T>
template <typename U>