Added implicit conversion of types with different precision qualifier

This commit is contained in:
Christophe Riccio 2013-09-02 00:16:41 +02:00
parent 635d2d0eca
commit 16b9c79acc
29 changed files with 253 additions and 87 deletions

View File

@ -65,8 +65,9 @@ namespace detail
////////////////////////////////////// //////////////////////////////////////
// Constructors // Constructors
GLM_FUNC_DECL tmat2x2(); GLM_FUNC_DECL tmat2x2();
GLM_FUNC_DECL tmat2x2( GLM_FUNC_DECL tmat2x2(tmat2x2<T, P> const & m);
tmat2x2 const & m); template <precision Q>
GLM_FUNC_DECL tmat2x2(tmat2x2<T, Q> const & m);
GLM_FUNC_DECL explicit tmat2x2( GLM_FUNC_DECL explicit tmat2x2(
ctor Null); ctor Null);

View File

@ -92,6 +92,15 @@ namespace detail
this->value[1] = m.value[1]; this->value[1] = m.value[1];
} }
template <typename T, precision P>
template <precision Q>
GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2(
tmat2x2<T, Q> const & m)
{
this->value[0] = m.value[0];
this->value[1] = m.value[1];
}
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2 GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2
( (
@ -133,7 +142,7 @@ namespace detail
} }
////////////////////////////////////// //////////////////////////////////////
// Convertion constructors // Conversion constructors
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U>
GLM_FUNC_DECL tmat2x2<T, P>::tmat2x2 GLM_FUNC_DECL tmat2x2<T, P>::tmat2x2

View File

@ -58,7 +58,9 @@ namespace detail
public: public:
// Constructors // Constructors
GLM_FUNC_DECL tmat2x3(); GLM_FUNC_DECL tmat2x3();
GLM_FUNC_DECL tmat2x3(tmat2x3 const & m); GLM_FUNC_DECL tmat2x3(tmat2x3<T, P> const & m);
template <precision Q>
GLM_FUNC_DECL tmat2x3(tmat2x3<T, Q> const & m);
GLM_FUNC_DECL explicit tmat2x3( GLM_FUNC_DECL explicit tmat2x3(
ctor); ctor);

View File

@ -92,6 +92,15 @@ namespace detail
this->value[1] = m.value[1]; this->value[1] = m.value[1];
} }
template <typename T, precision P>
template <precision Q>
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3(
tmat2x3<T, Q> const & m)
{
this->value[0] = m.value[0];
this->value[1] = m.value[1];
}
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3 GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3
( (
@ -132,7 +141,7 @@ namespace detail
} }
////////////////////////////////////// //////////////////////////////////////
// Convertion constructors // Conversion constructors
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U>
GLM_FUNC_DECL tmat2x3<T, P>::tmat2x3 GLM_FUNC_DECL tmat2x3<T, P>::tmat2x3

View File

@ -58,7 +58,9 @@ namespace detail
public: public:
// Constructors // Constructors
GLM_FUNC_DECL tmat2x4(); GLM_FUNC_DECL tmat2x4();
GLM_FUNC_DECL tmat2x4(tmat2x4 const & m); GLM_FUNC_DECL tmat2x4(tmat2x4<T, P> const & m);
template <precision Q>
GLM_FUNC_DECL tmat2x4(tmat2x4<T, Q> const & m);
GLM_FUNC_DECL explicit tmat2x4( GLM_FUNC_DECL explicit tmat2x4(
ctor); ctor);

View File

@ -94,6 +94,15 @@ namespace detail
this->value[1] = m.value[1]; this->value[1] = m.value[1];
} }
template <typename T, precision P>
template <precision Q>
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4(
tmat2x4<T, Q> const & m)
{
this->value[0] = m.value[0];
this->value[1] = m.value[1];
}
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4 GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4
( (
@ -135,7 +144,7 @@ namespace detail
} }
////////////////////////////////////// //////////////////////////////////////
// Convertion constructors // Conversion constructors
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U>
GLM_FUNC_DECL tmat2x4<T, P>::tmat2x4 GLM_FUNC_DECL tmat2x4<T, P>::tmat2x4

View File

@ -59,6 +59,8 @@ namespace detail
// Constructors // Constructors
GLM_FUNC_DECL tmat3x2(); GLM_FUNC_DECL tmat3x2();
GLM_FUNC_DECL tmat3x2(tmat3x2<T, P> const & m); GLM_FUNC_DECL tmat3x2(tmat3x2<T, P> const & m);
template <precision Q>
GLM_FUNC_DECL tmat3x2(tmat3x2<T, Q> const & m);
GLM_FUNC_DECL explicit tmat3x2( GLM_FUNC_DECL explicit tmat3x2(
ctor); ctor);

View File

@ -94,6 +94,16 @@ namespace detail
this->value[2] = m.value[2]; this->value[2] = m.value[2];
} }
template <typename T, precision P>
template <precision Q>
GLM_FUNC_QUALIFIER tmat3x2<T, P>::tmat3x2(
tmat3x2<T, Q> const & m)
{
this->value[0] = m.value[0];
this->value[1] = m.value[1];
this->value[2] = m.value[2];
}
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x2<T, P>::tmat3x2 GLM_FUNC_QUALIFIER tmat3x2<T, P>::tmat3x2
( (
@ -139,7 +149,7 @@ namespace detail
} }
////////////////////////////////////// //////////////////////////////////////
// Convertion constructors // Conversion constructors
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U>
GLM_FUNC_DECL tmat3x2<T, P>::tmat3x2 GLM_FUNC_DECL tmat3x2<T, P>::tmat3x2

View File

@ -65,6 +65,8 @@ namespace detail
// Constructors // Constructors
GLM_FUNC_DECL tmat3x3(); GLM_FUNC_DECL tmat3x3();
GLM_FUNC_DECL tmat3x3(tmat3x3<T, P> const & m); GLM_FUNC_DECL tmat3x3(tmat3x3<T, P> const & m);
template <precision Q>
GLM_FUNC_DECL tmat3x3(tmat3x3<T, Q> const & m);
GLM_FUNC_DECL explicit tmat3x3( GLM_FUNC_DECL explicit tmat3x3(
ctor Null); ctor Null);

View File

@ -103,6 +103,16 @@ namespace detail
) )
{} {}
template <typename T, precision P>
template <precision Q>
GLM_FUNC_QUALIFIER tmat3x3<T, P>::tmat3x3(
tmat3x3<T, Q> const & m)
{
this->value[0] = m.value[0];
this->value[1] = m.value[1];
this->value[2] = m.value[2];
}
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x3<T, P>::tmat3x3 GLM_FUNC_QUALIFIER tmat3x3<T, P>::tmat3x3
( (
@ -142,7 +152,7 @@ namespace detail
} }
////////////////////////////////////// //////////////////////////////////////
// Convertion constructors // Conversion constructors
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U>
GLM_FUNC_DECL tmat3x3<T, P>::tmat3x3 GLM_FUNC_DECL tmat3x3<T, P>::tmat3x3

View File

@ -58,7 +58,9 @@ namespace detail
public: public:
// Constructors // Constructors
GLM_FUNC_DECL tmat3x4(); GLM_FUNC_DECL tmat3x4();
GLM_FUNC_DECL tmat3x4(tmat3x4 const & m); GLM_FUNC_DECL tmat3x4(tmat3x4<T, P> const & m);
template <precision Q>
GLM_FUNC_DECL tmat3x4(tmat3x4<T, Q> const & m);
GLM_FUNC_DECL explicit tmat3x4( GLM_FUNC_DECL explicit tmat3x4(
ctor Null); ctor Null);

View File

@ -94,6 +94,16 @@ namespace detail
this->value[2] = m.value[2]; this->value[2] = m.value[2];
} }
template <typename T, precision P>
template <precision Q>
GLM_FUNC_QUALIFIER tmat3x4<T, P>::tmat3x4(
tmat3x4<T, Q> const & m)
{
this->value[0] = m.value[0];
this->value[1] = m.value[1];
this->value[2] = m.value[2];
}
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x4<T, P>::tmat3x4 GLM_FUNC_QUALIFIER tmat3x4<T, P>::tmat3x4
( (
@ -140,7 +150,7 @@ namespace detail
} }
////////////////////////////////////// //////////////////////////////////////
// Convertion constructors // Conversion constructors
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U>
GLM_FUNC_DECL tmat3x4<T, P>::tmat3x4 GLM_FUNC_DECL tmat3x4<T, P>::tmat3x4

View File

@ -58,7 +58,9 @@ namespace detail
public: public:
// Constructors // Constructors
GLM_FUNC_DECL tmat4x2(); GLM_FUNC_DECL tmat4x2();
GLM_FUNC_DECL tmat4x2(tmat4x2 const & m); GLM_FUNC_DECL tmat4x2(tmat4x2<T, P> const & m);
template <precision Q>
GLM_FUNC_DECL tmat4x2(tmat4x2<T, Q> const & m);
GLM_FUNC_DECL explicit tmat4x2( GLM_FUNC_DECL explicit tmat4x2(
ctor Null); ctor Null);

View File

@ -87,10 +87,8 @@ namespace detail
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2 GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2(
( tmat4x2<T, P> const & m)
tmat4x2<T, P> 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];
@ -99,10 +97,18 @@ namespace detail
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2 template <precision Q>
( GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2(
ctor tmat4x2<T, Q> const & m)
) {
this->value[0] = m.value[0];
this->value[1] = m.value[1];
this->value[2] = m.value[2];
this->value[3] = m.value[3];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2(ctor)
{} {}
template <typename T, precision P> template <typename T, precision P>
@ -149,7 +155,7 @@ namespace detail
} }
////////////////////////////////////// //////////////////////////////////////
// Convertion constructors // Conversion constructors
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U>
GLM_FUNC_DECL tmat4x2<T, P>::tmat4x2 GLM_FUNC_DECL tmat4x2<T, P>::tmat4x2

View File

@ -58,7 +58,9 @@ namespace detail
public: public:
// Constructors // Constructors
GLM_FUNC_DECL tmat4x3(); GLM_FUNC_DECL tmat4x3();
GLM_FUNC_DECL tmat4x3(tmat4x3 const & m); GLM_FUNC_DECL tmat4x3(tmat4x3<T, P> const & m);
template <precision Q>
GLM_FUNC_DECL tmat4x3(tmat4x3<T, Q> const & m);
GLM_FUNC_DECL explicit tmat4x3( GLM_FUNC_DECL explicit tmat4x3(
ctor Null); ctor Null);

View File

@ -87,10 +87,19 @@ namespace detail
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3 GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3(
( tmat4x3<T, P> const & m)
tmat4x3<T, P> const & m {
) this->value[0] = m.value[0];
this->value[1] = m.value[1];
this->value[2] = m.value[2];
this->value[3] = m.value[3];
}
template <typename T, precision P>
template <precision Q>
GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3(
tmat4x3<T, Q> 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];
@ -99,17 +108,12 @@ namespace detail
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3 GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3(ctor)
(
ctor
)
{} {}
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3 GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3(
( 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); this->value[0] = col_type(s, Zero, Zero);
@ -149,7 +153,7 @@ namespace detail
} }
////////////////////////////////////// //////////////////////////////////////
// Convertion constructors // Conversion constructors
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U>
GLM_FUNC_DECL tmat4x3<T, P>::tmat4x3 GLM_FUNC_DECL tmat4x3<T, P>::tmat4x3

View File

@ -64,7 +64,9 @@ namespace detail
public: public:
// Constructors // Constructors
GLM_FUNC_DECL tmat4x4(); GLM_FUNC_DECL tmat4x4();
GLM_FUNC_DECL tmat4x4(tmat4x4 const & m); GLM_FUNC_DECL tmat4x4(tmat4x4<T, P> const & m);
template <precision Q>
GLM_FUNC_DECL tmat4x4(tmat4x4<T, Q> const & m);
GLM_FUNC_DECL explicit tmat4x4( GLM_FUNC_DECL explicit tmat4x4(
ctor Null); ctor Null);

View File

@ -98,6 +98,19 @@ namespace detail
this->value[3] = m.value[3]; this->value[3] = m.value[3];
} }
template <typename T, precision P>
template <precision Q>
GLM_FUNC_QUALIFIER tmat4x4<T, P>::tmat4x4
(
tmat4x4<T, Q> const & m
)
{
this->value[0] = m.value[0];
this->value[1] = m.value[1];
this->value[2] = m.value[2];
this->value[3] = m.value[3];
}
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x4<T, P>::tmat4x4 GLM_FUNC_QUALIFIER tmat4x4<T, P>::tmat4x4
( (
@ -162,7 +175,7 @@ namespace detail
} }
////////////////////////////////////// //////////////////////////////////////
// Convertion constructors // Conversion constructors
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U>
GLM_FUNC_DECL tmat4x4<T, P>::tmat4x4 GLM_FUNC_DECL tmat4x4<T, P>::tmat4x4

View File

@ -68,6 +68,8 @@ namespace detail
GLM_FUNC_DECL tvec1(); GLM_FUNC_DECL tvec1();
GLM_FUNC_DECL tvec1(tvec1<T, P> const & v); GLM_FUNC_DECL tvec1(tvec1<T, P> const & v);
template <precision Q>
GLM_FUNC_DECL tvec1(tvec1<T, Q> const & v);
////////////////////////////////////// //////////////////////////////////////
// Explicit basic constructors // Explicit basic constructors
@ -83,14 +85,14 @@ namespace detail
GLM_FUNC_DECL tvec1(tref1<T, P> const & r); GLM_FUNC_DECL tvec1(tref1<T, P> const & r);
////////////////////////////////////// //////////////////////////////////////
// Convertion scalar constructors // Conversion scalar constructors
//! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U> template <typename U>
GLM_FUNC_DECL explicit tvec1(U const & s); GLM_FUNC_DECL explicit tvec1(U const & s);
////////////////////////////////////// //////////////////////////////////////
// Convertion vector constructors // Conversion vector constructors
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q> template <typename U, precision Q>

View File

@ -69,14 +69,16 @@ namespace detail
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec1<T, P>::tvec1 GLM_FUNC_QUALIFIER tvec1<T, P>::tvec1
( (
ctor tvec1<T, P> const & v
) ) :
x(v.x)
{} {}
template <typename T, precision P> template <typename T, precision P>
template <precision Q>
GLM_FUNC_QUALIFIER tvec1<T, P>::tvec1 GLM_FUNC_QUALIFIER tvec1<T, P>::tvec1
( (
tvec1<T, P> const & v tvec1<T, Q> const & v
) : ) :
x(v.x) x(v.x)
{} {}
@ -84,6 +86,13 @@ namespace detail
////////////////////////////////////// //////////////////////////////////////
// Explicit basic constructors // Explicit basic constructors
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec1<T, P>::tvec1
(
ctor
)
{}
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec1<T, P>::tvec1 GLM_FUNC_QUALIFIER tvec1<T, P>::tvec1
( (
@ -104,7 +113,7 @@ namespace detail
{} {}
////////////////////////////////////// //////////////////////////////////////
// Convertion scalar constructors // Conversion scalar constructors
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U>
@ -116,7 +125,7 @@ namespace detail
{} {}
////////////////////////////////////// //////////////////////////////////////
// Convertion vector constructors // Conversion vector constructors
template <typename T, precision P> template <typename T, precision P>
template <typename U, precision Q> template <typename U, precision Q>

View File

@ -89,6 +89,8 @@ namespace detail
GLM_FUNC_DECL tvec2(); GLM_FUNC_DECL tvec2();
GLM_FUNC_DECL tvec2(tvec2<T, P> const & v); GLM_FUNC_DECL tvec2(tvec2<T, P> const & v);
template <precision Q>
GLM_FUNC_DECL tvec2(tvec2<T, Q> const & v);
////////////////////////////////////// //////////////////////////////////////
// Explicit basic constructors // Explicit basic constructors
@ -113,7 +115,7 @@ namespace detail
} }
////////////////////////////////////// //////////////////////////////////////
// Convertion constructors // Conversion constructors
//! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U> template <typename U>
@ -126,7 +128,7 @@ namespace detail
V const & y); V const & y);
////////////////////////////////////// //////////////////////////////////////
// Convertion vector constructors // Conversion vector constructors
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q> template <typename U, precision Q>

View File

@ -64,14 +64,17 @@ namespace detail
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2 GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2
( (
ctor tvec2<T, P> const & v
) ) :
x(v.x),
y(v.y)
{} {}
template <typename T, precision P> template <typename T, precision P>
template <precision Q>
GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2 GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2
( (
tvec2<T, P> const & v tvec2<T, Q> const & v
) : ) :
x(v.x), x(v.x),
y(v.y) y(v.y)
@ -80,6 +83,13 @@ namespace detail
////////////////////////////////////// //////////////////////////////////////
// Explicit basic constructors // Explicit basic constructors
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2
(
ctor
)
{}
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2 GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2
( (
@ -112,7 +122,7 @@ namespace detail
{} {}
////////////////////////////////////// //////////////////////////////////////
// Convertion scalar constructors // Conversion scalar constructors
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U>
@ -136,7 +146,7 @@ namespace detail
{} {}
////////////////////////////////////// //////////////////////////////////////
// Convertion vector constructors // Conversion vector constructors
template <typename T, precision P> template <typename T, precision P>
template <typename U, precision Q> template <typename U, precision Q>

View File

@ -90,6 +90,8 @@ namespace detail
GLM_FUNC_DECL tvec3(); GLM_FUNC_DECL tvec3();
GLM_FUNC_DECL tvec3(tvec3<T, P> const & v); GLM_FUNC_DECL tvec3(tvec3<T, P> const & v);
template <precision Q>
GLM_FUNC_DECL tvec3(tvec3<T, Q> const & v);
////////////////////////////////////// //////////////////////////////////////
// Explicit basic constructors // Explicit basic constructors
@ -104,7 +106,7 @@ namespace detail
value_type const & s3); value_type const & s3);
////////////////////////////////////// //////////////////////////////////////
// Convertion scalar constructors // Conversion scalar constructors
//! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U> template <typename U>
@ -118,7 +120,7 @@ namespace detail
W const & z); W const & z);
////////////////////////////////////// //////////////////////////////////////
// Convertion vector constructors // Conversion vector constructors
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q> template <typename A, typename B, precision Q>

View File

@ -65,14 +65,18 @@ namespace detail
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3 GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3
( (
ctor tvec3<T, P> const & v
) ) :
x(v.x),
y(v.y),
z(v.z)
{} {}
template <typename T, precision P> template <typename T, precision P>
template <precision Q>
GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3 GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3
( (
tvec3<T, P> const & v tvec3<T, Q> const & v
) : ) :
x(v.x), x(v.x),
y(v.y), y(v.y),
@ -82,6 +86,13 @@ namespace detail
////////////////////////////////////// //////////////////////////////////////
// Explicit basic constructors // Explicit basic constructors
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3
(
ctor
)
{}
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3 GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3
( (
@ -142,7 +153,7 @@ namespace detail
{} {}
////////////////////////////////////// //////////////////////////////////////
// Convertion scalar constructors // Conversion scalar constructors
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U>
@ -169,7 +180,7 @@ namespace detail
{} {}
////////////////////////////////////// //////////////////////////////////////
// Convertion vector constructors // Conversion vector constructors
template <typename T, precision P> template <typename T, precision P>
template <typename A, typename B, precision Q> template <typename A, typename B, precision Q>

View File

@ -91,6 +91,8 @@ namespace detail
GLM_FUNC_DECL tvec4(); GLM_FUNC_DECL tvec4();
GLM_FUNC_DECL tvec4(type const & v); GLM_FUNC_DECL tvec4(type const & v);
template <precision Q>
GLM_FUNC_DECL tvec4(tvec4<T, Q> const & v);
////////////////////////////////////// //////////////////////////////////////
// Explicit basic constructors // Explicit basic constructors
@ -106,22 +108,22 @@ namespace detail
value_type const & s3); value_type const & s3);
////////////////////////////////////// //////////////////////////////////////
// Convertion scalar constructors // Conversion scalar constructors
//! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) /// Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U> template <typename U>
GLM_FUNC_DECL explicit tvec4( GLM_FUNC_DECL explicit tvec4(
U const & x); U const & x);
//! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) /// Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, typename C, typename D> template <typename A, typename B, typename C, typename D>
GLM_FUNC_DECL explicit tvec4( GLM_FUNC_DECL explicit tvec4(
A const & x, A const & x,
B const & y, B const & y,
C const & z, C const & z,
D const & w); D const & w);
////////////////////////////////////// //////////////////////////////////////
// Convertion vector constructors // Conversion vector constructors
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, typename C, precision Q> template <typename A, typename B, typename C, precision Q>
@ -221,8 +223,8 @@ namespace detail
// Unary arithmetic operators // Unary arithmetic operators
GLM_FUNC_DECL tvec4<T, P> & operator= (tvec4<T, P> const & v); GLM_FUNC_DECL tvec4<T, P> & operator= (tvec4<T, P> const & v);
template <typename U> template <typename U, precision Q>
GLM_FUNC_DECL tvec4<T, P> & operator= (tvec4<U, P> const & v); GLM_FUNC_DECL tvec4<T, P> & operator= (tvec4<U, Q> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator+=(U const & s); GLM_FUNC_DECL tvec4<T, P> & operator+=(U const & s);

View File

@ -72,14 +72,19 @@ namespace detail
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P>::tvec4 GLM_FUNC_QUALIFIER tvec4<T, P>::tvec4
( (
ctor type const & v
) ) :
x(v.x),
y(v.y),
z(v.z),
w(v.w)
{} {}
template <typename T, precision P> template <typename T, precision P>
template <precision Q>
GLM_FUNC_QUALIFIER tvec4<T, P>::tvec4 GLM_FUNC_QUALIFIER tvec4<T, P>::tvec4
( (
type const & v tvec4<T, Q> const & v
) : ) :
x(v.x), x(v.x),
y(v.y), y(v.y),
@ -90,6 +95,13 @@ namespace detail
////////////////////////////////////// //////////////////////////////////////
// Explicit basic constructors // Explicit basic constructors
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P>::tvec4
(
ctor
)
{}
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P>::tvec4 GLM_FUNC_QUALIFIER tvec4<T, P>::tvec4
( (
@ -237,8 +249,8 @@ namespace detail
{} {}
////////////////////////////////////// //////////////////////////////////////
// Convertion scalar constructors // Conversion scalar constructors
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tvec4<T, P>::tvec4 GLM_FUNC_QUALIFIER tvec4<T, P>::tvec4
@ -266,8 +278,20 @@ namespace detail
w(value_type(w)) w(value_type(w))
{} {}
template <typename T, precision P>
template <typename U, precision Q>
GLM_FUNC_QUALIFIER tvec4<T, P>::tvec4
(
tvec4<U, Q> const & v
) :
x(value_type(v.x)),
y(value_type(v.y)),
z(value_type(v.z)),
w(value_type(v.w))
{}
////////////////////////////////////// //////////////////////////////////////
// Convertion vector constructors // Conversion vector constructors
template <typename T, precision P> template <typename T, precision P>
template <typename A, typename B, typename C, precision Q> template <typename A, typename B, typename C, precision Q>
@ -350,18 +374,6 @@ namespace detail
w(value_type(v2.y)) w(value_type(v2.y))
{} {}
template <typename T, precision P>
template <typename U, precision Q>
GLM_FUNC_QUALIFIER tvec4<T, P>::tvec4
(
tvec4<U, Q> const & v
) :
x(value_type(v.x)),
y(value_type(v.y)),
z(value_type(v.z)),
w(value_type(v.w))
{}
////////////////////////////////////// //////////////////////////////////////
// Unary arithmetic operators // Unary arithmetic operators
@ -379,10 +391,10 @@ namespace detail
} }
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U, precision Q>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator= GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator=
( (
tvec4<U, P> const & v tvec4<U, Q> const & v
) )
{ {
this->x = T(v.x); this->x = T(v.x);

View File

@ -111,7 +111,7 @@ namespace detail
vec4 const & v); vec4 const & v);
//////////////////////////////////////// ////////////////////////////////////////
//// Convertion vector constructors //// Conversion vector constructors
fvec4SIMD(vec2 const & v, float const & s1, float const & s2); fvec4SIMD(vec2 const & v, float const & s1, float const & s2);
fvec4SIMD(float const & s1, vec2 const & v, float const & s2); fvec4SIMD(float const & s1, vec2 const & v, float const & s2);

View File

@ -59,7 +59,7 @@ GLM_FUNC_QUALIFIER fvec4SIMD::fvec4SIMD(float const v[4]) :
//fvec4SIMD(ref4<float> const & r); //fvec4SIMD(ref4<float> const & r);
////////////////////////////////////// //////////////////////////////////////
// Convertion vector constructors // Conversion vector constructors
GLM_FUNC_QUALIFIER fvec4SIMD::fvec4SIMD(vec2 const & v, float const & s1, float const & s2) : GLM_FUNC_QUALIFIER fvec4SIMD::fvec4SIMD(vec2 const & v, float const & s1, float const & s2) :
Data(_mm_set_ps(s2, s1, v.y, v.x)) Data(_mm_set_ps(s2, s1, v.y, v.x))

View File

@ -836,12 +836,31 @@ static int test_quat_precision()
return Error; return Error;
} }
static int test_fvec_conversion()
{
int Error(0);
{
glm::highp_vec4 a = glm::vec4(1, 2, 3, 4);
glm::mediump_vec4 b = glm::vec4(1, 2, 3, 4);
glm::lowp_vec4 c = b;
glm::mediump_vec4 d = c;
glm::lowp_ivec4 e = glm::ivec4(d);
glm::lowp_ivec3 f = glm::ivec3(e);
Error += glm::all(glm::equal(b, d)) ? 0 : 1;
}
return Error;
}
int main() int main()
{ {
int Error(0); int Error(0);
Error += test_scalar_size(); Error += test_scalar_size();
Error += test_fvec_size(); Error += test_fvec_size();
Error += test_fvec_precision(); Error += test_fvec_precision();
Error += test_fvec_conversion();
Error += test_dvec_precision(); Error += test_dvec_precision();
Error += test_ivec_size(); Error += test_ivec_size();
Error += test_ivec_precision(); Error += test_ivec_precision();