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

This commit is contained in:
Christophe Riccio 2016-05-05 10:38:51 +02:00
parent c8070624db
commit 7193cd2c3a
6 changed files with 75 additions and 75 deletions

View file

@ -94,31 +94,31 @@ namespace glm
// -- Implicit basic constructors --
GLM_FUNC_DECL tvec1() GLM_DEFAULT_CTOR;
GLM_FUNC_DECL tvec1(tvec1<T, P> const & v) GLM_DEFAULT;
GLM_FUNC_DECL GLM_CONSTEXPR tvec1() GLM_DEFAULT_CTOR;
GLM_FUNC_DECL GLM_CONSTEXPR tvec1(tvec1<T, P> const & v) GLM_DEFAULT;
template <precision Q>
GLM_FUNC_DECL tvec1(tvec1<T, Q> const & v);
GLM_FUNC_DECL GLM_CONSTEXPR tvec1(tvec1<T, Q> const & v);
// -- Explicit basic constructors --
GLM_FUNC_DECL explicit tvec1(ctor);
GLM_FUNC_DECL explicit tvec1(T scalar);
GLM_FUNC_DECL GLM_CONSTEXPR explicit tvec1(ctor);
GLM_FUNC_DECL GLM_CONSTEXPR explicit tvec1(T scalar);
// -- Conversion vector constructors --
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q>
GLM_FUNC_DECL GLM_EXPLICIT tvec1(tvec2<U, Q> const & v);
GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tvec1(tvec2<U, Q> const & v);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q>
GLM_FUNC_DECL GLM_EXPLICIT tvec1(tvec3<U, Q> const & v);
GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tvec1(tvec3<U, Q> const & v);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q>
GLM_FUNC_DECL GLM_EXPLICIT tvec1(tvec4<U, Q> const & v);
GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tvec1(tvec4<U, Q> const & v);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q>
GLM_FUNC_DECL GLM_EXPLICIT tvec1(tvec1<U, Q> const & v);
GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tvec1(tvec1<U, Q> const & v);
// -- Swizzle constructors --

View file

@ -94,37 +94,37 @@ namespace glm
// -- Implicit basic constructors --
GLM_FUNC_DECL tvec2() GLM_DEFAULT_CTOR;
GLM_FUNC_DECL tvec2(tvec2<T, P> const & v) GLM_DEFAULT;
GLM_FUNC_DECL GLM_CONSTEXPR tvec2() GLM_DEFAULT_CTOR;
GLM_FUNC_DECL GLM_CONSTEXPR tvec2(tvec2<T, P> const& v) GLM_DEFAULT;
template <precision Q>
GLM_FUNC_DECL tvec2(tvec2<T, Q> const & v);
GLM_FUNC_DECL GLM_CONSTEXPR tvec2(tvec2<T, Q> const& v);
// -- Explicit basic constructors --
GLM_FUNC_DECL explicit tvec2(ctor);
GLM_FUNC_DECL explicit tvec2(T scalar);
GLM_FUNC_DECL tvec2(T s1, T s2);
GLM_FUNC_DECL GLM_CONSTEXPR explicit tvec2(ctor);
GLM_FUNC_DECL GLM_CONSTEXPR explicit tvec2(T scalar);
GLM_FUNC_DECL GLM_CONSTEXPR tvec2(T s1, T s2);
// -- Conversion constructors --
/// Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B>
GLM_FUNC_DECL tvec2(A x, B y);
GLM_FUNC_DECL GLM_CONSTEXPR tvec2(A x, B y);
template <typename A, typename B>
GLM_FUNC_DECL tvec2(tvec1<A, P> const & v1, tvec1<B, P> const & v2);
GLM_FUNC_DECL GLM_CONSTEXPR tvec2(tvec1<A, P> const & v1, tvec1<B, P> const & v2);
// -- Conversion vector constructors --
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q>
GLM_FUNC_DECL GLM_EXPLICIT tvec2(tvec3<U, Q> const & v);
GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tvec2(tvec3<U, Q> const & v);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q>
GLM_FUNC_DECL GLM_EXPLICIT tvec2(tvec4<U, Q> const & v);
GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tvec2(tvec4<U, Q> const & v);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q>
GLM_FUNC_DECL GLM_EXPLICIT tvec2(tvec2<U, Q> const & v);
GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tvec2(tvec2<U, Q> const & v);
// -- Swizzle constructors --

View file

@ -95,46 +95,46 @@ namespace glm
// -- Implicit basic constructors --
GLM_FUNC_DECL tvec3() GLM_DEFAULT_CTOR;
GLM_FUNC_DECL tvec3(tvec3<T, P> const & v) GLM_DEFAULT;
GLM_FUNC_DECL GLM_CONSTEXPR tvec3() GLM_DEFAULT_CTOR;
GLM_FUNC_DECL GLM_CONSTEXPR tvec3(tvec3<T, P> const & v) GLM_DEFAULT;
template <precision Q>
GLM_FUNC_DECL tvec3(tvec3<T, Q> const & v);
GLM_FUNC_DECL GLM_CONSTEXPR tvec3(tvec3<T, Q> const & v);
// -- Explicit basic constructors --
GLM_FUNC_DECL explicit tvec3(ctor);
GLM_FUNC_DECL explicit tvec3(T scalar);
GLM_FUNC_DECL tvec3(T a, T b, T c);
GLM_FUNC_DECL GLM_CONSTEXPR explicit tvec3(ctor);
GLM_FUNC_DECL GLM_CONSTEXPR explicit tvec3(T scalar);
GLM_FUNC_DECL GLM_CONSTEXPR tvec3(T a, T b, T c);
// -- Conversion scalar constructors --
/// Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, typename C>
GLM_FUNC_DECL tvec3(A a, B b, C c);
GLM_FUNC_DECL GLM_CONSTEXPR tvec3(A a, B b, C c);
template <typename A, typename B, typename C>
GLM_FUNC_DECL tvec3(tvec1<A, P> const & a, tvec1<B, P> const & b, tvec1<C, P> const & c);
GLM_FUNC_DECL GLM_CONSTEXPR tvec3(tvec1<A, P> const & a, tvec1<B, P> const & b, tvec1<C, P> const & c);
// -- Conversion vector constructors --
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q>
GLM_FUNC_DECL tvec3(tvec2<A, Q> const & a, B b);
GLM_FUNC_DECL GLM_CONSTEXPR tvec3(tvec2<A, Q> const & a, B b);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q>
GLM_FUNC_DECL tvec3(tvec2<A, Q> const & a, tvec1<B, Q> const & b);
GLM_FUNC_DECL GLM_CONSTEXPR tvec3(tvec2<A, Q> const & a, tvec1<B, Q> const & b);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q>
GLM_FUNC_DECL tvec3(A a, tvec2<B, Q> const & b);
GLM_FUNC_DECL GLM_CONSTEXPR tvec3(A a, tvec2<B, Q> const & b);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q>
GLM_FUNC_DECL tvec3(tvec1<A, Q> const & a, tvec2<B, Q> const & b);
GLM_FUNC_DECL GLM_CONSTEXPR tvec3(tvec1<A, Q> const & a, tvec2<B, Q> const & b);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q>
GLM_FUNC_DECL GLM_EXPLICIT tvec3(tvec4<U, Q> const & v);
GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tvec3(tvec4<U, Q> const & v);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q>
GLM_FUNC_DECL GLM_EXPLICIT tvec3(tvec3<U, Q> const & v);
GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tvec3(tvec3<U, Q> const & v);
// -- Swizzle constructors --

View file

@ -150,64 +150,64 @@ namespace detail
// -- Implicit basic constructors --
GLM_FUNC_DECL tvec4() GLM_DEFAULT_CTOR;
GLM_FUNC_DECL tvec4(tvec4<T, P> const& v) GLM_DEFAULT;
GLM_FUNC_DECL GLM_CONSTEXPR tvec4() GLM_DEFAULT_CTOR;
GLM_FUNC_DECL GLM_CONSTEXPR tvec4(tvec4<T, P> const& v) GLM_DEFAULT;
template <precision Q>
GLM_FUNC_DECL tvec4(tvec4<T, Q> const& v);
GLM_FUNC_DECL GLM_CONSTEXPR tvec4(tvec4<T, Q> const& v);
// -- Explicit basic constructors --
GLM_FUNC_DECL explicit tvec4(ctor);
GLM_FUNC_DECL explicit tvec4(T scalar);
GLM_FUNC_DECL tvec4(T a, T b, T c, T d);
GLM_FUNC_DECL GLM_CONSTEXPR explicit tvec4(ctor);
GLM_FUNC_DECL GLM_CONSTEXPR explicit tvec4(T scalar);
GLM_FUNC_DECL GLM_CONSTEXPR tvec4(T a, T b, T c, T d);
// -- Conversion scalar constructors --
/// 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>
GLM_FUNC_DECL tvec4(A a, B b, C c, D d);
GLM_FUNC_DECL GLM_CONSTEXPR tvec4(A a, B b, C c, D d);
template <typename A, typename B, typename C, typename D>
GLM_FUNC_DECL tvec4(tvec1<A, P> const& a, tvec1<B, P> const& b, tvec1<C, P> const& c, tvec1<D, P> const& d);
GLM_FUNC_DECL GLM_CONSTEXPR tvec4(tvec1<A, P> const& a, tvec1<B, P> const& b, tvec1<C, P> const& c, tvec1<D, P> const& d);
// -- Conversion vector constructors --
/// 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>
GLM_FUNC_DECL tvec4(tvec2<A, Q> const & a, B b, C c);
GLM_FUNC_DECL GLM_CONSTEXPR tvec4(tvec2<A, Q> const & a, B b, C c);
/// 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>
GLM_FUNC_DECL tvec4(tvec2<A, Q> const & a, tvec1<B, Q> const & b, tvec1<C, Q> const & c);
GLM_FUNC_DECL GLM_CONSTEXPR tvec4(tvec2<A, Q> const & a, tvec1<B, Q> const & b, tvec1<C, Q> const & c);
/// 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>
GLM_FUNC_DECL tvec4(A a, tvec2<B, Q> const & b, C c);
GLM_FUNC_DECL GLM_CONSTEXPR tvec4(A a, tvec2<B, Q> const & b, C c);
/// 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>
GLM_FUNC_DECL tvec4(tvec1<A, Q> const & a, tvec2<B, Q> const & b, tvec1<C, Q> const & c);
GLM_FUNC_DECL GLM_CONSTEXPR tvec4(tvec1<A, Q> const & a, tvec2<B, Q> const & b, tvec1<C, Q> const & c);
/// 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>
GLM_FUNC_DECL tvec4(A a, B b, tvec2<C, Q> const & c);
GLM_FUNC_DECL GLM_CONSTEXPR tvec4(A a, B b, tvec2<C, Q> const & c);
/// 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>
GLM_FUNC_DECL tvec4(tvec1<A, Q> const & a, tvec1<B, Q> const & b, tvec2<C, Q> const & c);
GLM_FUNC_DECL GLM_CONSTEXPR tvec4(tvec1<A, Q> const & a, tvec1<B, Q> const & b, tvec2<C, Q> const & c);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q>
GLM_FUNC_DECL tvec4(tvec3<A, Q> const & a, B b);
GLM_FUNC_DECL GLM_CONSTEXPR tvec4(tvec3<A, Q> const & a, B b);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q>
GLM_FUNC_DECL tvec4(tvec3<A, Q> const & a, tvec1<B, Q> const & b);
GLM_FUNC_DECL GLM_CONSTEXPR tvec4(tvec3<A, Q> const & a, tvec1<B, Q> const & b);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q>
GLM_FUNC_DECL tvec4(A a, tvec3<B, Q> const & b);
GLM_FUNC_DECL GLM_CONSTEXPR tvec4(A a, tvec3<B, Q> const & b);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q>
GLM_FUNC_DECL tvec4(tvec1<A, Q> const & a, tvec3<B, Q> const & b);
GLM_FUNC_DECL GLM_CONSTEXPR tvec4(tvec1<A, Q> const & a, tvec3<B, Q> const & b);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q>
GLM_FUNC_DECL tvec4(tvec2<A, Q> const & a, tvec2<B, Q> const & b);
GLM_FUNC_DECL GLM_CONSTEXPR tvec4(tvec2<A, Q> const & a, tvec2<B, Q> const & b);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q>
GLM_FUNC_DECL GLM_EXPLICIT tvec4(tvec4<U, Q> const& v);
GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tvec4(tvec4<U, Q> const& v);
// -- Swizzle constructors --

View file

@ -82,21 +82,21 @@ namespace glm
// -- Implicit basic constructors --
GLM_FUNC_DECL tquat() GLM_DEFAULT_CTOR;
GLM_FUNC_DECL tquat(tquat<T, P> const & q) GLM_DEFAULT;
GLM_FUNC_DECL GLM_CONSTEXPR tquat() GLM_DEFAULT_CTOR;
GLM_FUNC_DECL GLM_CONSTEXPR tquat(tquat<T, P> const & q) GLM_DEFAULT;
template <precision Q>
GLM_FUNC_DECL tquat(tquat<T, Q> const & q);
GLM_FUNC_DECL GLM_CONSTEXPR tquat(tquat<T, Q> const & q);
// -- Explicit basic constructors --
GLM_FUNC_DECL explicit tquat(ctor);
GLM_FUNC_DECL tquat(T const & s, tvec3<T, P> const & v);
GLM_FUNC_DECL tquat(T const & w, T const & x, T const & y, T const & z);
GLM_FUNC_DECL GLM_CONSTEXPR explicit tquat(ctor);
GLM_FUNC_DECL GLM_CONSTEXPR tquat(T const & s, tvec3<T, P> const & v);
GLM_FUNC_DECL GLM_CONSTEXPR tquat(T const & w, T const & x, T const & y, T const & z);
// -- Conversion constructors --
template <typename U, precision Q>
GLM_FUNC_DECL GLM_EXPLICIT tquat(tquat<U, Q> const & q);
GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tquat(tquat<U, Q> const & q);
/// Explicit conversion operators
# if GLM_HAS_EXPLICIT_CONVERSION_OPERATORS
@ -110,12 +110,12 @@ namespace glm
/// @param v A second normalized axis
/// @see gtc_quaternion
/// @see http://lolengine.net/blog/2013/09/18/beautiful-maths-quaternion-from-vectors
GLM_FUNC_DECL tquat(tvec3<T, P> const & u, tvec3<T, P> const & v);
GLM_FUNC_DECL GLM_CONSTEXPR tquat(tvec3<T, P> const & u, tvec3<T, P> const & v);
/// Build a quaternion from euler angles (pitch, yaw, roll), in radians.
GLM_FUNC_DECL GLM_EXPLICIT tquat(tvec3<T, P> const & eulerAngles);
GLM_FUNC_DECL GLM_EXPLICIT tquat(tmat3x3<T, P> const & m);
GLM_FUNC_DECL GLM_EXPLICIT tquat(tmat4x4<T, P> const & m);
GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tquat(tvec3<T, P> const & eulerAngles);
GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tquat(tmat3x3<T, P> const & m);
GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tquat(tmat4x4<T, P> const & m);
// -- Unary arithmetic operators --

View file

@ -81,25 +81,25 @@ namespace glm
// -- Implicit basic constructors --
GLM_FUNC_DECL tdualquat() GLM_DEFAULT_CTOR;
GLM_FUNC_DECL tdualquat(tdualquat<T, P> const & d) GLM_DEFAULT;
GLM_FUNC_DECL GLM_CONSTEXPR tdualquat() GLM_DEFAULT_CTOR;
GLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tdualquat<T, P> const & d) GLM_DEFAULT;
template <precision Q>
GLM_FUNC_DECL tdualquat(tdualquat<T, Q> const & d);
GLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tdualquat<T, Q> const & d);
// -- Explicit basic constructors --
GLM_FUNC_DECL explicit tdualquat(ctor);
GLM_FUNC_DECL tdualquat(tquat<T, P> const & real);
GLM_FUNC_DECL tdualquat(tquat<T, P> const & orientation, tvec3<T, P> const & translation);
GLM_FUNC_DECL tdualquat(tquat<T, P> const & real, tquat<T, P> const & dual);
GLM_FUNC_DECL GLM_CONSTEXPR explicit tdualquat(ctor);
GLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tquat<T, P> const & real);
GLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tquat<T, P> const & orientation, tvec3<T, P> const & translation);
GLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tquat<T, P> const & real, tquat<T, P> const & dual);
// -- Conversion constructors --
template <typename U, precision Q>
GLM_FUNC_DECL GLM_EXPLICIT tdualquat(tdualquat<U, Q> const & q);
GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tdualquat(tdualquat<U, Q> const & q);
GLM_FUNC_DECL GLM_EXPLICIT tdualquat(tmat2x4<T, P> const & holder_mat);
GLM_FUNC_DECL GLM_EXPLICIT tdualquat(tmat3x4<T, P> const & aug_mat);
GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tdualquat(tmat2x4<T, P> const & holder_mat);
GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tdualquat(tmat3x4<T, P> const & aug_mat);
// -- Unary arithmetic operators --