Simplify GLM_FORCE_EXPLICIT_CTOR declarations

- Instead of wrapping the declarations, use a macro for the keyword "explicit"
This commit is contained in:
Jesse Talavera-Greenberg 2015-07-20 20:18:24 -04:00
parent c2078afc12
commit 9cc7dc1763
15 changed files with 39 additions and 118 deletions

View File

@ -98,13 +98,8 @@ namespace glm
//////////////////////////////////////
// Matrix conversions
# ifdef GLM_FORCE_EXPLICIT_CTOR
template <typename U, precision Q>
GLM_FUNC_DECL explicit tmat2x2(tmat2x2<U, Q> const & m);
# else
template <typename U, precision Q>
GLM_FUNC_DECL tmat2x2(tmat2x2<U, Q> const & m);
# endif
template <typename U, precision Q>
GLM_FUNC_DECL GLM_EXPLICIT_CTOR_MAYBE tmat2x2(tmat2x2<U, Q> const & m);
GLM_FUNC_DECL explicit tmat2x2(tmat3x3<T, P> const & x);
GLM_FUNC_DECL explicit tmat2x2(tmat4x4<T, P> const & x);

View File

@ -94,13 +94,8 @@ namespace glm
//////////////////////////////////////
// Matrix conversion
# ifdef GLM_FORCE_EXPLICIT_CTOR
template <typename U, precision Q>
GLM_FUNC_DECL explicit tmat2x3(tmat2x3<U, Q> const & m);
# else
template <typename U, precision Q>
GLM_FUNC_DECL tmat2x3(tmat2x3<U, Q> const & m);
# endif
template <typename U, precision Q>
GLM_FUNC_DECL GLM_EXPLICIT_CTOR_MAYBE tmat2x3(tmat2x3<U, Q> const & m);
GLM_FUNC_DECL explicit tmat2x3(tmat2x2<T, P> const & x);
GLM_FUNC_DECL explicit tmat2x3(tmat3x3<T, P> const & x);

View File

@ -95,13 +95,8 @@ namespace glm
//////////////////////////////////////
// Matrix conversions
# ifdef GLM_FORCE_EXPLICIT_CTOR
template <typename U, precision Q>
GLM_FUNC_DECL explicit tmat2x4(tmat2x4<U, Q> const & m);
# else
template <typename U, precision Q>
GLM_FUNC_DECL tmat2x4(tmat2x4<U, Q> const & m);
# endif
template <typename U, precision Q>
GLM_FUNC_DECL GLM_EXPLICIT_CTOR_MAYBE tmat2x4(tmat2x4<U, Q> const & m);
GLM_FUNC_DECL explicit tmat2x4(tmat2x2<T, P> const & x);
GLM_FUNC_DECL explicit tmat2x4(tmat3x3<T, P> const & x);

View File

@ -101,13 +101,8 @@ namespace glm
//////////////////////////////////////
// Matrix conversions
# ifdef GLM_FORCE_EXPLICIT_CTOR
template <typename U, precision Q>
GLM_FUNC_DECL explicit tmat3x2(tmat3x2<U, Q> const & m);
# else
template <typename U, precision Q>
GLM_FUNC_DECL tmat3x2(tmat3x2<U, Q> const & m);
# endif
template <typename U, precision Q>
GLM_FUNC_DECL GLM_EXPLICIT_CTOR_MAYBE tmat3x2(tmat3x2<U, Q> const & m);
GLM_FUNC_DECL explicit tmat3x2(tmat2x2<T, P> const & x);
GLM_FUNC_DECL explicit tmat3x2(tmat3x3<T, P> const & x);

View File

@ -105,13 +105,8 @@ namespace glm
//////////////////////////////////////
// Matrix conversions
# ifdef GLM_FORCE_EXPLICIT_CTOR
template <typename U, precision Q>
GLM_FUNC_DECL explicit tmat3x3(tmat3x3<U, Q> const & m);
# else
template <typename U, precision Q>
GLM_FUNC_DECL tmat3x3(tmat3x3<U, Q> const & m);
# endif
template <typename U, precision Q>
GLM_FUNC_DECL GLM_EXPLICIT_CTOR_MAYBE tmat3x3(tmat3x3<U, Q> const & m);
GLM_FUNC_DECL explicit tmat3x3(tmat2x2<T, P> const & x);
GLM_FUNC_DECL explicit tmat3x3(tmat4x4<T, P> const & x);

View File

@ -100,13 +100,8 @@ namespace glm
//////////////////////////////////////
// Matrix conversion
# ifdef GLM_FORCE_EXPLICIT_CTOR
template <typename U, precision Q>
GLM_FUNC_DECL explicit tmat3x4(tmat3x4<U, Q> const & m);
# else
template <typename U, precision Q>
GLM_FUNC_DECL tmat3x4(tmat3x4<U, Q> const & m);
# endif
template <typename U, precision Q>
GLM_FUNC_DECL GLM_EXPLICIT_CTOR_MAYBE tmat3x4(tmat3x4<U, Q> const & m);
GLM_FUNC_DECL explicit tmat3x4(tmat2x2<T, P> const & x);
GLM_FUNC_DECL explicit tmat3x4(tmat3x3<T, P> const & x);

View File

@ -106,13 +106,8 @@ namespace glm
//////////////////////////////////////
// Matrix conversions
# ifdef GLM_FORCE_EXPLICIT_CTOR
template <typename U, precision Q>
GLM_FUNC_DECL explicit tmat4x2(tmat4x2<U, Q> const & m);
# else
template <typename U, precision Q>
GLM_FUNC_DECL tmat4x2(tmat4x2<U, Q> const & m);
# endif
template <typename U, precision Q>
GLM_FUNC_DECL GLM_EXPLICIT_CTOR_MAYBE tmat4x2(tmat4x2<U, Q> const & m);
GLM_FUNC_DECL explicit tmat4x2(tmat2x2<T, P> const & x);
GLM_FUNC_DECL explicit tmat4x2(tmat3x3<T, P> const & x);

View File

@ -105,13 +105,8 @@ namespace glm
//////////////////////////////////////
// Matrix conversions
# ifdef GLM_FORCE_EXPLICIT_CTOR
template <typename U, precision Q>
GLM_FUNC_DECL explicit tmat4x3(tmat4x3<U, Q> const & m);
# else
template <typename U, precision Q>
GLM_FUNC_DECL tmat4x3(tmat4x3<U, Q> const & m);
# endif
template <typename U, precision Q>
GLM_FUNC_DECL GLM_EXPLICIT_CTOR_MAYBE tmat4x3(tmat4x3<U, Q> const & m);
GLM_FUNC_DECL explicit tmat4x3(tmat2x2<T, P> const & x);
GLM_FUNC_DECL explicit tmat4x3(tmat3x3<T, P> const & x);

View File

@ -110,13 +110,8 @@ namespace glm
//////////////////////////////////////
// Matrix conversions
# ifdef GLM_FORCE_EXPLICIT_CTOR
template <typename U, precision Q>
GLM_FUNC_DECL explicit tmat4x4(tmat4x4<U, Q> const & m);
# else
template <typename U, precision Q>
GLM_FUNC_DECL tmat4x4(tmat4x4<U, Q> const & m);
# endif
template <typename U, precision Q>
GLM_FUNC_DECL GLM_EXPLICIT_CTOR_MAYBE tmat4x4(tmat4x4<U, Q> const & m);
GLM_FUNC_DECL explicit tmat4x4(tmat2x2<T, P> const & x);
GLM_FUNC_DECL explicit tmat4x4(tmat3x3<T, P> const & x);

View File

@ -136,15 +136,9 @@ namespace glm
template <typename U, precision Q>
GLM_FUNC_DECL explicit tvec1(tvec4<U, Q> const & v);
# ifdef GLM_FORCE_EXPLICIT_CTOR
//! 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 explicit tvec1(tvec1<U, Q> const & v);
# else
//! 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 tvec1(tvec1<U, Q> const & v);
# endif
//! 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_CTOR_MAYBE tvec1(tvec1<U, Q> const & v);
//////////////////////////////////////
// Swizzle constructors

View File

@ -144,15 +144,9 @@ namespace glm
template <typename U, precision Q>
GLM_FUNC_DECL explicit tvec2(tvec4<U, Q> const & v);
# ifdef GLM_FORCE_EXPLICIT_CTOR
//! 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 explicit tvec2(tvec2<U, Q> const & v);
# else
//! 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 tvec2(tvec2<U, Q> const & v);
# endif
//! 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_CTOR_MAYBE tvec2(tvec2<U, Q> const & v);
//////////////////////////////////////
// Swizzle constructors

View File

@ -154,15 +154,9 @@ namespace glm
template <typename U, precision Q>
GLM_FUNC_DECL explicit tvec3(tvec4<U, Q> const & v);
# ifdef GLM_FORCE_EXPLICIT_CTOR
//! 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 explicit tvec3(tvec3<U, Q> const & v);
# else
//! 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 tvec3(tvec3<U, Q> const & v);
# endif
//! 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_CTOR_MAYBE tvec3(tvec3<U, Q> const & v);
//////////////////////////////////////
// Swizzle constructors

View File

@ -229,16 +229,10 @@ namespace detail
//! 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 explicit tvec4(tvec2<A, Q> const & a, tvec2<B, Q> const & b);
# ifdef GLM_FORCE_EXPLICIT_CTOR
//! 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 explicit tvec4(tvec4<U, Q> const & v);
# else
//! 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 tvec4(tvec4<U, Q> const & v);
# endif
//! 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_CTOR_MAYBE tvec4(tvec4<U, Q> const & v);
//////////////////////////////////////
// Swizzle constructors

View File

@ -108,24 +108,19 @@ namespace glm
GLM_FUNC_DECL tquat(T const & w, T const & x, T const & y, T const & z);
//////////////////////////////////////
// Convertions
// Conversions
template <typename U, precision Q>
GLM_FUNC_DECL GLM_EXPLICIT_CTOR_MAYBE tquat(tquat<U, Q> const & q);
# ifdef GLM_FORCE_EXPLICIT_CTOR
template <typename U, precision Q>
GLM_FUNC_DECL explicit tquat(tquat<U, Q> const & q);
# else
template <typename U, precision Q>
GLM_FUNC_DECL tquat(tquat<U, Q> const & q);
# endif
// explicit conversion operators
# if GLM_HAS_EXPLICIT_CONVERSION_OPERATORS
GLM_FUNC_DECL explicit operator tmat3x3<T, P>();
GLM_FUNC_DECL explicit operator tmat4x4<T, P>();
# endif
/// Create a quaternion from two normalized axis
///
///
/// @param u A first normalized axis
/// @param v A second normalized axis
/// @see gtc_quaternion

View File

@ -110,13 +110,8 @@ namespace glm
//////////////////////////////////////////////////////////////
// tdualquat conversions
# ifdef GLM_FORCE_EXPLICIT_CTOR
template <typename U, precision Q>
GLM_FUNC_DECL explicit tdualquat(tdualquat<U, Q> const & q);
# else
template <typename U, precision Q>
GLM_FUNC_DECL tdualquat(tdualquat<U, Q> const & q);
# endif
template <typename U, precision Q>
GLM_FUNC_DECL GLM_EXPLICIT_CTOR_MAYBE tdualquat(tdualquat<U, Q> const & q);
GLM_FUNC_DECL explicit tdualquat(tmat2x4<T, P> const & holder_mat);
GLM_FUNC_DECL explicit tdualquat(tmat3x4<T, P> const & aug_mat);