- Added constexpr for *vec*, *mat*, *quat* and *dual_quat* types #493

This commit is contained in:
Christophe Riccio 2016-05-05 13:27:26 +02:00
parent 9a7b802bdc
commit d0c4bbaef7
3 changed files with 35 additions and 35 deletions

View File

@ -55,45 +55,45 @@ namespace glm
public: public:
// -- Constructors -- // -- Constructors --
GLM_FUNC_DECL GLM_CONSTEXPR tmat2x2() GLM_DEFAULT_CTOR; GLM_FUNC_DECL tmat2x2() GLM_DEFAULT_CTOR;
GLM_FUNC_DECL GLM_CONSTEXPR tmat2x2(tmat2x2<T, P> const & m) GLM_DEFAULT; GLM_FUNC_DECL tmat2x2(tmat2x2<T, P> const & m) GLM_DEFAULT;
template <precision Q> template <precision Q>
GLM_FUNC_DECL GLM_CONSTEXPR tmat2x2(tmat2x2<T, Q> const & m); GLM_FUNC_DECL tmat2x2(tmat2x2<T, Q> const & m);
GLM_FUNC_DECL GLM_CONSTEXPR explicit tmat2x2(ctor); GLM_FUNC_DECL GLM_CONSTEXPR explicit tmat2x2(ctor);
GLM_FUNC_DECL GLM_CONSTEXPR explicit tmat2x2(T scalar); GLM_FUNC_DECL explicit tmat2x2(T scalar);
GLM_FUNC_DECL GLM_CONSTEXPR tmat2x2( GLM_FUNC_DECL tmat2x2(
T const & x1, T const & y1, T const & x1, T const & y1,
T const & x2, T const & y2); T const & x2, T const & y2);
GLM_FUNC_DECL GLM_CONSTEXPR tmat2x2( GLM_FUNC_DECL tmat2x2(
col_type const & v1, col_type const & v1,
col_type const & v2); col_type const & v2);
// -- Conversions -- // -- Conversions --
template <typename U, typename V, typename M, typename N> template <typename U, typename V, typename M, typename N>
GLM_FUNC_DECL GLM_CONSTEXPR tmat2x2( GLM_FUNC_DECL tmat2x2(
U const & x1, V const & y1, U const & x1, V const & y1,
M const & x2, N const & y2); M const & x2, N const & y2);
template <typename U, typename V> template <typename U, typename V>
GLM_FUNC_DECL GLM_CONSTEXPR tmat2x2( GLM_FUNC_DECL tmat2x2(
tvec2<U, P> const & v1, tvec2<U, P> const & v1,
tvec2<V, P> const & v2); tvec2<V, P> const & v2);
// -- Matrix conversions -- // -- Matrix conversions --
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tmat2x2(tmat2x2<U, Q> const & m); GLM_FUNC_DECL GLM_EXPLICIT tmat2x2(tmat2x2<U, Q> const & m);
GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tmat2x2(tmat3x3<T, P> const & x); GLM_FUNC_DECL GLM_EXPLICIT tmat2x2(tmat3x3<T, P> const & x);
GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tmat2x2(tmat4x4<T, P> const & x); GLM_FUNC_DECL GLM_EXPLICIT tmat2x2(tmat4x4<T, P> const & x);
GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tmat2x2(tmat2x3<T, P> const & x); GLM_FUNC_DECL GLM_EXPLICIT tmat2x2(tmat2x3<T, P> const & x);
GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tmat2x2(tmat3x2<T, P> const & x); GLM_FUNC_DECL GLM_EXPLICIT tmat2x2(tmat3x2<T, P> const & x);
GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tmat2x2(tmat2x4<T, P> const & x); GLM_FUNC_DECL GLM_EXPLICIT tmat2x2(tmat2x4<T, P> const & x);
GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tmat2x2(tmat4x2<T, P> const & x); GLM_FUNC_DECL GLM_EXPLICIT tmat2x2(tmat4x2<T, P> const & x);
GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tmat2x2(tmat3x4<T, P> const & x); GLM_FUNC_DECL GLM_EXPLICIT tmat2x2(tmat3x4<T, P> const & x);
GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tmat2x2(tmat4x3<T, P> const & x); GLM_FUNC_DECL GLM_EXPLICIT tmat2x2(tmat4x3<T, P> const & x);
// -- Accesses -- // -- Accesses --

View File

@ -54,7 +54,7 @@ namespace detail
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tmat2x2<T, P>::tmat2x2() GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2()
{ {
# ifndef GLM_FORCE_NO_CTOR_INIT # ifndef GLM_FORCE_NO_CTOR_INIT
this->value[0] = col_type(1, 0); this->value[0] = col_type(1, 0);
@ -65,7 +65,7 @@ namespace detail
# if !GLM_HAS_DEFAULTED_FUNCTIONS # if !GLM_HAS_DEFAULTED_FUNCTIONS
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tmat2x2<T, P>::tmat2x2(tmat2x2<T, P> const & m) GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2(tmat2x2<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];
@ -74,7 +74,7 @@ namespace detail
template <typename T, precision P> template <typename T, precision P>
template <precision Q> template <precision Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tmat2x2<T, P>::tmat2x2(tmat2x2<T, Q> const & m) GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2(tmat2x2<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];
@ -85,14 +85,14 @@ namespace detail
{} {}
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tmat2x2<T, P>::tmat2x2(T scalar) GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2(T scalar)
{ {
this->value[0] = col_type(scalar, 0); this->value[0] = col_type(scalar, 0);
this->value[1] = col_type(0, scalar); this->value[1] = col_type(0, scalar);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tmat2x2<T, P>::tmat2x2 GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2
( (
T const & x0, T const & y0, T const & x0, T const & y0,
T const & x1, T const & y1 T const & x1, T const & y1
@ -103,7 +103,7 @@ namespace detail
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tmat2x2<T, P>::tmat2x2(col_type const & v0, col_type const & v1) GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2(col_type const & v0, col_type const & v1)
{ {
this->value[0] = v0; this->value[0] = v0;
this->value[1] = v1; this->value[1] = v1;
@ -113,7 +113,7 @@ namespace detail
template <typename T, precision P> template <typename T, precision P>
template <typename X1, typename Y1, typename X2, typename Y2> template <typename X1, typename Y1, typename X2, typename Y2>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tmat2x2<T, P>::tmat2x2 GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2
( (
X1 const & x1, Y1 const & y1, X1 const & x1, Y1 const & y1,
X2 const & x2, Y2 const & y2 X2 const & x2, Y2 const & y2
@ -125,7 +125,7 @@ namespace detail
template <typename T, precision P> template <typename T, precision P>
template <typename V1, typename V2> template <typename V1, typename V2>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tmat2x2<T, P>::tmat2x2(tvec2<V1, P> const & v1, tvec2<V2, P> const & v2) GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2(tvec2<V1, P> const & v1, tvec2<V2, P> 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);
@ -135,63 +135,63 @@ namespace detail
template <typename T, precision P> template <typename T, precision P>
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tmat2x2<T, P>::tmat2x2(tmat2x2<U, Q> const & m) GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2(tmat2x2<U, Q> 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, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tmat2x2<T, P>::tmat2x2(tmat3x3<T, P> const & m) GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2(tmat3x3<T, P> 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, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tmat2x2<T, P>::tmat2x2(tmat4x4<T, P> const & m) GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2(tmat4x4<T, P> 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, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tmat2x2<T, P>::tmat2x2(tmat2x3<T, P> const & m) GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2(tmat2x3<T, P> 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, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tmat2x2<T, P>::tmat2x2(tmat3x2<T, P> const & m) GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2(tmat3x2<T, P> const & m)
{ {
this->value[0] = m[0]; this->value[0] = m[0];
this->value[1] = m[1]; this->value[1] = m[1];
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tmat2x2<T, P>::tmat2x2(tmat2x4<T, P> const & m) GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2(tmat2x4<T, P> 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, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tmat2x2<T, P>::tmat2x2(tmat4x2<T, P> const & m) GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2(tmat4x2<T, P> const & m)
{ {
this->value[0] = m[0]; this->value[0] = m[0];
this->value[1] = m[1]; this->value[1] = m[1];
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tmat2x2<T, P>::tmat2x2(tmat3x4<T, P> const & m) GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2(tmat3x4<T, P> 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, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tmat2x2<T, P>::tmat2x2(tmat4x3<T, P> const & m) GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2(tmat4x3<T, P> 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]);

View File

@ -71,7 +71,7 @@ namespace glm
# if !GLM_HAS_DEFAULTED_FUNCTIONS # if !GLM_HAS_DEFAULTED_FUNCTIONS
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tdualquat<T, P>::tdualquat(tdualquat<T, P> const & d) GLM_FUNC_QUALIFIER tdualquat<T, P>::tdualquat(tdualquat<T, P> const & d)
: real(d.real) : real(d.real)
, dual(d.dual) , dual(d.dual)
{} {}