Simplify code removing GLM_FORCE_SIZE_FUNC, GLM_META_PROG_HELPERS, GLM_STATIC_CONST_MEMBERS and 'type' type trait. Added experiments for GTX_type_trait

This commit is contained in:
Christophe Riccio 2016-03-13 12:56:26 +01:00
parent d245268c2e
commit 234d7d4ba9
57 changed files with 426 additions and 1361 deletions

View File

@ -42,12 +42,4 @@ namespace glm
simd,
defaultp = highp
};
template <typename T, precision P, template <typename, precision> class genType>
struct type
{
static bool const is_vec = false;
static bool const is_mat = false;
static bool const is_quat = false;
};
}//namespace glm

View File

@ -54,17 +54,6 @@ namespace glm
template <typename U, precision Q>
friend tvec2<U, Q> operator/(tvec2<U, Q> const & v, tmat2x2<U, Q> const & m);
# ifdef GLM_META_PROG_HELPERS
static GLM_RELAXED_CONSTEXPR length_t components = 2;
static GLM_RELAXED_CONSTEXPR length_t cols = 2;
static GLM_RELAXED_CONSTEXPR length_t rows = 2;
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
# endif
private:
col_type value[2];
@ -113,19 +102,11 @@ namespace glm
// -- Accesses --
# ifdef GLM_FORCE_SIZE_FUNC
typedef size_t size_type;
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
GLM_FUNC_DECL col_type & operator[](size_type i);
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
# else
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
// -- Unary arithmetic operators --
@ -229,16 +210,6 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tmat2x2<T, P> const & m1, tmat2x2<T, P> const & m2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tmat2x2>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
};
} //namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -50,13 +50,6 @@ namespace detail
}
}//namespace detail
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tmat2x2<T, P> tmat2x2<T, P>::ZERO(static_cast<T>(0));
template<typename T, precision P>
const tmat2x2<T, P> tmat2x2<T, P>::IDENTITY(static_cast<T>(1));
# endif
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

View File

@ -50,18 +50,6 @@ namespace glm
typedef tmat3x2<T, P> transpose_type;
typedef T value_type;
# ifdef GLM_META_PROG_HELPERS
static GLM_RELAXED_CONSTEXPR length_t components = 2;
static GLM_RELAXED_CONSTEXPR length_t cols = 2;
static GLM_RELAXED_CONSTEXPR length_t rows = 3;
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
# endif
private:
col_type value[2];
@ -110,19 +98,11 @@ namespace glm
// -- Accesses --
# ifdef GLM_FORCE_SIZE_FUNC
typedef size_t size_type;
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
GLM_FUNC_DECL col_type & operator[](size_type i);
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
# else
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
// -- Unary arithmetic operators --
@ -207,16 +187,6 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tmat2x3<T, P> const & m1, tmat2x3<T, P> const & m2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tmat2x3>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -32,13 +32,6 @@
namespace glm
{
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tmat2x3<T, P> tmat2x3<T, P>::ZERO(static_cast<T>(0));
template<typename T, precision P>
const tmat2x3<T, P> tmat2x3<T, P>::IDENTITY(static_cast<T>(1));
# endif
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

View File

@ -50,18 +50,6 @@ namespace glm
typedef tmat4x2<T, P> transpose_type;
typedef T value_type;
# ifdef GLM_META_PROG_HELPERS
static GLM_RELAXED_CONSTEXPR length_t components = 2;
static GLM_RELAXED_CONSTEXPR length_t cols = 2;
static GLM_RELAXED_CONSTEXPR length_t rows = 4;
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
# endif
private:
col_type value[2];
@ -112,19 +100,11 @@ namespace glm
// -- Accesses --
# ifdef GLM_FORCE_SIZE_FUNC
typedef size_t size_type;
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
GLM_FUNC_DECL col_type & operator[](size_type i);
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
# else
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
// -- Unary arithmetic operators --
@ -209,16 +189,6 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tmat2x4<T, P> const & m1, tmat2x4<T, P> const & m2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tmat2x4>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -32,13 +32,6 @@
namespace glm
{
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tmat2x4<T, P> tmat2x4<T, P>::ZERO(static_cast<T>(0));
template<typename T, precision P>
const tmat2x4<T, P> tmat2x4<T, P>::IDENTITY(static_cast<T>(1));
# endif
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

View File

@ -50,18 +50,6 @@ namespace glm
typedef tmat2x3<T, P> transpose_type;
typedef T value_type;
# ifdef GLM_META_PROG_HELPERS
static GLM_RELAXED_CONSTEXPR length_t components = 3;
static GLM_RELAXED_CONSTEXPR length_t cols = 3;
static GLM_RELAXED_CONSTEXPR length_t rows = 2;
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
# endif
private:
col_type value[3];
@ -117,19 +105,11 @@ namespace glm
// -- Accesses --
# ifdef GLM_FORCE_SIZE_FUNC
typedef size_t size_type;
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
GLM_FUNC_DECL col_type & operator[](size_type i);
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
# else
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
// -- Unary arithmetic operators --
@ -215,15 +195,6 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tmat3x2<T, P> const & m1, tmat3x2<T, P> const & m2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tmat3x2>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -32,13 +32,6 @@
namespace glm
{
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tmat3x2<T, P> tmat3x2<T, P>::ZERO(static_cast<T>(0));
template<typename T, precision P>
const tmat3x2<T, P> tmat3x2<T, P>::IDENTITY(static_cast<T>(1));
# endif
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

View File

@ -49,18 +49,6 @@ namespace glm
typedef tmat3x3<T, P> transpose_type;
typedef T value_type;
# ifdef GLM_META_PROG_HELPERS
static GLM_RELAXED_CONSTEXPR length_t components = 3;
static GLM_RELAXED_CONSTEXPR length_t cols = 3;
static GLM_RELAXED_CONSTEXPR length_t rows = 3;
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
# endif
template <typename U, precision Q>
friend tvec3<U, Q> operator/(tmat3x3<U, Q> const & m, tvec3<U, Q> const & v);
template <typename U, precision Q>
@ -121,19 +109,11 @@ namespace glm
// -- Accesses --
# ifdef GLM_FORCE_SIZE_FUNC
typedef size_t size_type;
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
GLM_FUNC_DECL col_type & operator[](size_type i);
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
# else
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
// -- Unary arithmetic operators --
@ -237,16 +217,6 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tmat3x3<T, P> const & m1, tmat3x3<T, P> const & m2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tmat3x3>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -56,14 +56,6 @@ namespace detail
}
}//namespace detail
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tmat3x3<T, P> tmat3x3<T, P>::ZERO(static_cast<T>(0));
template<typename T, precision P>
const tmat3x3<T, P> tmat3x3<T, P>::IDENTITY(static_cast<T>(1));
# endif
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

View File

@ -50,18 +50,6 @@ namespace glm
typedef tmat4x3<T, P> transpose_type;
typedef T value_type;
# ifdef GLM_META_PROG_HELPERS
static GLM_RELAXED_CONSTEXPR length_t components = 3;
static GLM_RELAXED_CONSTEXPR length_t cols = 3;
static GLM_RELAXED_CONSTEXPR length_t rows = 4;
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
# endif
private:
col_type value[3];
@ -117,19 +105,11 @@ namespace glm
// -- Accesses --
# ifdef GLM_FORCE_SIZE_FUNC
typedef size_t size_type;
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
GLM_FUNC_DECL col_type & operator[](size_type i);
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
# else
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
// -- Unary arithmetic operators --
@ -214,16 +194,6 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tmat3x4<T, P> const & m1, tmat3x4<T, P> const & m2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tmat3x4>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -32,13 +32,6 @@
namespace glm
{
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tmat3x4<T, P> tmat3x4<T, P>::ZERO(static_cast<T>(0));
template<typename T, precision P>
const tmat3x4<T, P> tmat3x4<T, P>::IDENTITY(static_cast<T>(1));
# endif
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

View File

@ -50,18 +50,6 @@ namespace glm
typedef tmat2x4<T, P> transpose_type;
typedef T value_type;
# ifdef GLM_META_PROG_HELPERS
static GLM_RELAXED_CONSTEXPR length_t components = 4;
static GLM_RELAXED_CONSTEXPR length_t cols = 4;
static GLM_RELAXED_CONSTEXPR length_t rows = 2;
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
# endif
private:
col_type value[4];
@ -122,19 +110,11 @@ namespace glm
// -- Accesses --
# ifdef GLM_FORCE_SIZE_FUNC
typedef size_t size_type;
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
GLM_FUNC_DECL col_type & operator[](size_type i);
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
# else
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
// -- Unary arithmetic operators --
@ -219,16 +199,6 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tmat4x2<T, P> const & m1, tmat4x2<T, P> const & m2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tmat4x2>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -50,18 +50,6 @@ namespace glm
typedef tmat3x4<T, P> transpose_type;
typedef T value_type;
# ifdef GLM_META_PROG_HELPERS
static GLM_RELAXED_CONSTEXPR length_t components = 4;
static GLM_RELAXED_CONSTEXPR length_t cols = 4;
static GLM_RELAXED_CONSTEXPR length_t rows = 3;
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
# endif
private:
col_type value[4];
@ -122,19 +110,11 @@ namespace glm
// -- Accesses --
# ifdef GLM_FORCE_SIZE_FUNC
typedef size_t size_type;
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
GLM_FUNC_DECL col_type & operator[](size_type i);
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
# else
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
// -- Unary arithmetic operators --
@ -219,16 +199,6 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tmat4x3<T, P> const & m1, tmat4x3<T, P> const & m2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tmat4x3>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -32,13 +32,6 @@
namespace glm
{
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tmat4x3<T, P> tmat4x3<T, P>::ZERO(static_cast<T>(0));
template<typename T, precision P>
const tmat4x3<T, P> tmat4x3<T, P>::IDENTITY(static_cast<T>(1));
# endif
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

View File

@ -49,18 +49,6 @@ namespace glm
typedef tmat4x4<T, P> transpose_type;
typedef T value_type;
# ifdef GLM_META_PROG_HELPERS
static GLM_RELAXED_CONSTEXPR length_t components = 4;
static GLM_RELAXED_CONSTEXPR length_t cols = 4;
static GLM_RELAXED_CONSTEXPR length_t rows = 4;
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
# endif
template <typename U, precision Q>
friend tvec4<U, Q> operator/(tmat4x4<U, Q> const & m, tvec4<U, Q> const & v);
template <typename U, precision Q>
@ -126,19 +114,11 @@ namespace glm
// -- Accesses --
# ifdef GLM_FORCE_SIZE_FUNC
typedef size_t size_type;
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
GLM_FUNC_DECL col_type & operator[](size_type i);
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
# else
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
// -- Unary arithmetic operators --
@ -242,16 +222,6 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tmat4x4<T, P> const & m1, tmat4x4<T, P> const & m2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tmat4x4>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -92,13 +92,6 @@ namespace detail
}
}//namespace detail
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tmat4x4<T, P> tmat4x4<T, P>::ZERO(static_cast<T>(0));
template<typename T, precision P>
const tmat4x4<T, P> tmat4x4<T, P>::IDENTITY(static_cast<T>(1));
# endif
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

View File

@ -54,15 +54,6 @@ namespace glm
typedef tvec1<bool, P> bool_type;
typedef T value_type;
# ifdef GLM_META_PROG_HELPERS
static GLM_RELAXED_CONSTEXPR length_t components = 1;
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type X;
# endif
// -- Data --
# if GLM_HAS_ANONYMOUS_UNION
@ -94,21 +85,12 @@ namespace glm
// -- Component accesses --
# ifdef GLM_FORCE_SIZE_FUNC
/// Return the count of components of the vector
typedef size_t size_type;
GLM_FUNC_DECL GLM_CONSTEXPR size_type size() const;
GLM_FUNC_DECL T & operator[](size_type i);
GLM_FUNC_DECL T const & operator[](size_type i) const;
# else
/// Return the count of components of the vector
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL T & operator[](length_type i);
GLM_FUNC_DECL T const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
// -- Implicit basic constructors --
@ -322,16 +304,6 @@ namespace glm
template <precision P>
GLM_FUNC_DECL tvec1<bool, P> operator||(tvec1<bool, P> const & v1, tvec1<bool, P> const & v2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tvec1>
{
static bool const is_vec = true;
static bool const is_mat = false;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -32,13 +32,6 @@
namespace glm
{
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tvec1<T, P> tvec1<T, P>::X(static_cast<T>(1));
template<typename T, precision P>
const tvec1<T, P> tvec1<T, P>::ZERO(static_cast<T>(0));
# endif
// -- Implicit basic constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)
@ -102,27 +95,6 @@ namespace glm
// -- Component accesses --
# ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec1<T, P>::size_type tvec1<T, P>::size() const
{
return 1;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T & tvec1<T, P>::operator[](typename tvec1<T, P>::size_type i)
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T const & tvec1<T, P>::operator[](typename tvec1<T, P>::size_type i) const
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
# else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec1<T, P>::length_type tvec1<T, P>::length() const
{
@ -142,7 +114,6 @@ namespace glm
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
# endif//GLM_FORCE_SIZE_FUNC
// -- Unary arithmetic operators --

View File

@ -49,21 +49,9 @@ namespace glm
{
// -- Implementation detail --
typedef T value_type;
typedef tvec2<T, P> type;
typedef tvec2<bool, P> bool_type;
typedef T value_type;
# ifdef GLM_META_PROG_HELPERS
static GLM_RELAXED_CONSTEXPR length_t components = 2;
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type X;
static const type Y;
static const type XY;
# endif
// -- Data --
@ -97,21 +85,12 @@ namespace glm
// -- Component accesses --
# ifdef GLM_FORCE_SIZE_FUNC
/// Return the count of components of the vector
typedef size_t size_type;
GLM_FUNC_DECL GLM_CONSTEXPR size_type size() const;
GLM_FUNC_DECL T & operator[](size_type i);
GLM_FUNC_DECL T const & operator[](size_type i) const;
# else
/// Return the count of components of the vector
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL T & operator[](length_type i);
GLM_FUNC_DECL T const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
// -- Implicit basic constructors --
@ -411,16 +390,6 @@ namespace glm
template <precision P>
GLM_FUNC_DECL tvec2<bool, P> operator||(tvec2<bool, P> const & v1, tvec2<bool, P> const & v2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tvec2>
{
static bool const is_vec = true;
static bool const is_mat = false;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -53,22 +53,6 @@ namespace glm
typedef tvec3<bool, P> bool_type;
typedef T value_type;
# ifdef GLM_META_PROG_HELPERS
static GLM_RELAXED_CONSTEXPR length_t components = 3;
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type X;
static const type Y;
static const type Z;
static const type XY;
static const type XZ;
static const type YZ;
static const type XYZ;
# endif
// -- Data --
# if GLM_HAS_ANONYMOUS_UNION
@ -102,21 +86,12 @@ namespace glm
// -- Component accesses --
# ifdef GLM_FORCE_SIZE_FUNC
/// Return the count of components of the vector
typedef size_t size_type;
GLM_FUNC_DECL GLM_CONSTEXPR size_type size() const;
GLM_FUNC_DECL T & operator[](size_type i);
GLM_FUNC_DECL T const & operator[](size_type i) const;
# else
/// Return the count of components of the vector
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL T & operator[](length_type i);
GLM_FUNC_DECL T const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
// -- Implicit basic constructors --
@ -437,16 +412,6 @@ namespace glm
template <precision P>
GLM_FUNC_DECL tvec3<bool, P> operator||(tvec3<bool, P> const & v1, tvec3<bool, P> const & v2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tvec3>
{
static bool const is_vec = true;
static bool const is_mat = false;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -103,33 +103,9 @@ namespace detail
{
// -- Implementation detail --
typedef T value_type;
typedef tvec4<T, P> type;
typedef tvec4<bool, P> bool_type;
typedef T value_type;
# ifdef GLM_META_PROG_HELPERS
static GLM_RELAXED_CONSTEXPR length_t components = 4;
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type X;
static const type Y;
static const type Z;
static const type W;
static const type XY;
static const type XZ;
static const type XW;
static const type YZ;
static const type YW;
static const type ZW;
static const type XYZ;
static const type XYW;
static const type XZW;
static const type YZW;
static const type XYZW;
# endif
// -- Data --
@ -167,21 +143,12 @@ namespace detail
// -- Component accesses --
# ifdef GLM_FORCE_SIZE_FUNC
/// Return the count of components of the vector
typedef size_t size_type;
GLM_FUNC_DECL GLM_CONSTEXPR size_type size() const;
GLM_FUNC_DECL T & operator[](size_type i);
GLM_FUNC_DECL T const & operator[](size_type i) const;
# else
/// Return the count of components of the vector
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL T & operator[](length_type i);
GLM_FUNC_DECL T const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
// -- Implicit basic constructors --
@ -544,16 +511,6 @@ namespace detail
template <precision P>
GLM_FUNC_DECL tvec4<bool, P> operator||(tvec4<bool, P> const & v1, tvec4<bool, P> const & v2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tvec4>
{
static bool const is_vec = true;
static bool const is_mat = false;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -32,72 +32,6 @@
namespace glm
{
# ifdef GLM_STATIC_CONST_MEMBERS
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::ZERO
(static_cast<T>(0), static_cast<T>(0), static_cast<T>(0), static_cast<T>(0));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::X
(static_cast<T>(1), static_cast<T>(0), static_cast<T>(0), static_cast<T>(0));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::Y
(static_cast<T>(0), static_cast<T>(1), static_cast<T>(0), static_cast<T>(0));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::Z
(static_cast<T>(0), static_cast<T>(0), static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::W
(static_cast<T>(0), static_cast<T>(0), static_cast<T>(0), static_cast<T>(1));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::XY
(static_cast<T>(1), static_cast<T>(1), static_cast<T>(0), static_cast<T>(0));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::XZ
(static_cast<T>(1), static_cast<T>(0), static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::XW
(static_cast<T>(1), static_cast<T>(0), static_cast<T>(0), static_cast<T>(1));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::YZ
(static_cast<T>(0), static_cast<T>(1), static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::YW
(static_cast<T>(0), static_cast<T>(1), static_cast<T>(0), static_cast<T>(1));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::ZW
(static_cast<T>(0), static_cast<T>(0), static_cast<T>(1), static_cast<T>(1));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::XYZ
(static_cast<T>(1), static_cast<T>(1), static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::XYW
(static_cast<T>(1), static_cast<T>(1), static_cast<T>(0), static_cast<T>(1));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::XZW
(static_cast<T>(1), static_cast<T>(0), static_cast<T>(1), static_cast<T>(1));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::YZW
(static_cast<T>(0), static_cast<T>(1), static_cast<T>(1), static_cast<T>(1));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::XYZW
(static_cast<T>(1), static_cast<T>(1), static_cast<T>(1), static_cast<T>(1));
# endif
// -- Implicit basic constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)
@ -270,27 +204,6 @@ namespace glm
// -- Component accesses --
# ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec4<T, P>::size_type tvec4<T, P>::size() const
{
return 4;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T & tvec4<T, P>::operator[](typename tvec4<T, P>::size_type i)
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T const & tvec4<T, P>::operator[](typename tvec4<T, P>::size_type i) const
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
# else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec4<T, P>::length_type tvec4<T, P>::length() const
{
@ -310,7 +223,6 @@ namespace glm
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
# endif//GLM_FORCE_SIZE_FUNC
// -- Unary arithmetic operators --

View File

@ -67,52 +67,18 @@ namespace glm
typedef tquat<T, P> type;
typedef T value_type;
# ifdef GLM_META_PROG_HELPERS
static GLM_RELAXED_CONSTEXPR length_t components = 4;
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
// -- Data --
T x, y, z, w;
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
static const type X;
static const type Y;
static const type Z;
static const type W;
static const type XY;
static const type XZ;
static const type XW;
static const type YZ;
static const type YW;
static const type ZW;
static const type XYZ;
static const type XYW;
static const type XZW;
static const type YZW;
static const type XYZW;
# endif
// -- Component accesses --
# ifdef GLM_FORCE_SIZE_FUNC
typedef size_t size_type;
/// Return the count of components of a quaternion
GLM_FUNC_DECL GLM_CONSTEXPR size_type size() const;
GLM_FUNC_DECL T & operator[](size_type i);
GLM_FUNC_DECL T const & operator[](size_type i) const;
# else
typedef length_t length_type;
/// Return the count of components of a quaternion
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL T & operator[](length_type i);
GLM_FUNC_DECL T const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
// -- Implicit basic constructors --
@ -397,16 +363,6 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL tvec4<bool, P> notEqual(tquat<T, P> const & x, tquat<T, P> const & y);
/// @}
// -- Is type --
template <typename T, precision P>
struct type<T, P, tquat>
{
static bool const is_vec = false;
static bool const is_mat = false;
static bool const is_quat = true;
};
} //namespace glm
#include "quaternion.inl"

View File

@ -49,96 +49,8 @@ namespace detail
};
}//namespace detail
# ifdef GLM_STATIC_CONST_MEMBERS
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::ZERO
(static_cast<T>(0), static_cast<T>(0), static_cast<T>(0), static_cast<T>(0));
template <typename T, precision P> const tquat<T, P> tquat<T, P>::IDENTITY;
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::X
(static_cast<T>(0), static_cast<T>(1), static_cast<T>(0), static_cast<T>(0));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::Y
(static_cast<T>(0), static_cast<T>(0), static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::Z
(static_cast<T>(0), static_cast<T>(0), static_cast<T>(0), static_cast<T>(1));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::W
(static_cast<T>(1), static_cast<T>(0), static_cast<T>(0), static_cast<T>(0));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::XY
(static_cast<T>(0), static_cast<T>(1), static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::XZ
(static_cast<T>(0), static_cast<T>(0), static_cast<T>(1), static_cast<T>(1));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::XW
(static_cast<T>(1), static_cast<T>(1), static_cast<T>(0), static_cast<T>(0));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::YZ
(static_cast<T>(0), static_cast<T>(0), static_cast<T>(1), static_cast<T>(1));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::YW
(static_cast<T>(1), static_cast<T>(0), static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::ZW
(static_cast<T>(1), static_cast<T>(0), static_cast<T>(0), static_cast<T>(1));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::XYZ
(static_cast<T>(0), static_cast<T>(1), static_cast<T>(1), static_cast<T>(1));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::XYW
(static_cast<T>(1), static_cast<T>(1), static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::XZW
(static_cast<T>(1), static_cast<T>(1), static_cast<T>(0), static_cast<T>(1));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::YZW
(static_cast<T>(1), static_cast<T>(0), static_cast<T>(1), static_cast<T>(1));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::XYZW
(static_cast<T>(1), static_cast<T>(1), static_cast<T>(1), static_cast<T>(1));
# endif
// -- Component accesses --
# ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tquat<T, P>::size_type tquat<T, P>::size() const
{
return 4;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T & tquat<T, P>::operator[](typename tquat<T, P>::size_type i)
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T const & tquat<T, P>::operator[](typename tquat<T, P>::size_type i) const
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
# else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tquat<T, P>::length_type tquat<T, P>::length() const
{
@ -158,7 +70,6 @@ namespace detail
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
# endif//GLM_FORCE_SIZE_FUNC
// -- Implicit basic constructors --

View File

@ -66,32 +66,18 @@ namespace glm
typedef T value_type;
typedef glm::tquat<T, P> part_type;
# ifdef GLM_META_PROG_HELPERS
static GLM_RELAXED_CONSTEXPR length_t components = 2;
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
// -- Data --
glm::tquat<T, P> real, dual;
// -- Component accesses --
# ifdef GLM_FORCE_SIZE_FUNC
typedef size_t size_type;
/// Return the count of components of a dual quaternion
GLM_FUNC_DECL GLM_CONSTEXPR size_type size() const;
GLM_FUNC_DECL part_type & operator[](size_type i);
GLM_FUNC_DECL part_type const & operator[](size_type i) const;
# else
typedef length_t length_type;
/// Return the count of components of a dual quaternion
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL part_type & operator[](length_type i);
GLM_FUNC_DECL part_type const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
// -- Implicit basic constructors --
@ -295,16 +281,6 @@ namespace glm
#endif
/// @}
// -- Is type --
template <typename T, precision P>
struct type<T, P, tdualquat>
{
static bool const is_vec = false;
static bool const is_mat = false;
static bool const is_quat = true;
};
} //namespace glm
#include "dual_quaternion.inl"

View File

@ -76,18 +76,6 @@ namespace detail
typedef tvec4<float, defaultp> pure_col_type;
typedef tmat4x4<float, defaultp> pure_transpose_type;
# ifdef GLM_META_PROG_HELPERS
static GLM_RELAXED_CONSTEXPR length_t components = 4;
static GLM_RELAXED_CONSTEXPR length_t cols = 4;
static GLM_RELAXED_CONSTEXPR length_t rows = 4;
static GLM_RELAXED_CONSTEXPR precision prec = defaultp;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
# endif
GLM_FUNC_DECL length_t length() const;
fvec4SIMD Data[4];

View File

@ -61,11 +61,6 @@ GLM_FUNC_QUALIFIER fvec4SIMD const & fmat4x4SIMD::operator[]
return this->Data[i];
}
#ifdef GLM_STATIC_CONST_MEMBERS
const fmat4x4SIMD fmat4x4SIMD::ZERO(static_cast<float>(0));
const fmat4x4SIMD fmat4x4SIMD::IDENTITY(static_cast<float>(1));
#endif
//////////////////////////////////////////////////////////////
// Constructors

View File

@ -76,11 +76,6 @@ namespace detail
typedef tquat<bool, defaultp> bool_type;
typedef tquat<float, defaultp> pure_type;
# ifdef GLM_META_PROG_HELPERS
static GLM_RELAXED_CONSTEXPR length_t components = 4;
static GLM_RELAXED_CONSTEXPR precision prec = defaultp;
# endif//GLM_META_PROG_HELPERS
#ifdef GLM_SIMD_ENABLE_XYZW_UNION
union
{
@ -91,26 +86,6 @@ namespace detail
__m128 Data;
#endif
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
static const type X;
static const type Y;
static const type Z;
static const type W;
static const type XY;
static const type XZ;
static const type XW;
static const type YZ;
static const type YW;
static const type ZW;
static const type XYZ;
static const type XYW;
static const type XZW;
static const type YZW;
static const type XYZW;
# endif
//////////////////////////////////////
// Implicit basic constructors

View File

@ -51,26 +51,6 @@ void print(const fvec4SIMD &v)
}
#endif
# ifdef GLM_STATIC_CONST_MEMBERS
const fquatSIMD fquatSIMD::ZERO(0, 0, 0, 0);
const fquatSIMD fquatSIMD::IDENTITY(1, 0, 0, 0);
const fquatSIMD fquatSIMD::X(0, 1, 0, 0);
const fquatSIMD fquatSIMD::Y(0, 0, 1, 0);
const fquatSIMD fquatSIMD::Z(0, 0, 0, 1);
const fquatSIMD fquatSIMD::W(1, 0, 0, 0);
const fquatSIMD fquatSIMD::XY(0, 1, 1, 0);
const fquatSIMD fquatSIMD::XZ(0, 1, 0, 1);
const fquatSIMD fquatSIMD::XW(1, 1, 0, 0);
const fquatSIMD fquatSIMD::YZ(0, 0, 1, 1);
const fquatSIMD fquatSIMD::YW(1, 0, 1, 0);
const fquatSIMD fquatSIMD::ZW(1, 0, 0, 1);
const fquatSIMD fquatSIMD::XYZ(0, 1, 1, 1);
const fquatSIMD fquatSIMD::XYW(1, 1, 1, 0);
const fquatSIMD fquatSIMD::XZW(1, 1, 0, 1);
const fquatSIMD fquatSIMD::YZW(1, 0, 1, 1);
const fquatSIMD fquatSIMD::XYZW(1, 1, 1, 1);
# endif
//////////////////////////////////////
// Implicit basic constructors

View File

@ -99,11 +99,6 @@ namespace detail
typedef tvec4<float, defaultp> pure_type;
typedef tvec4<bool, highp> bool_type;
# ifdef GLM_META_PROG_HELPERS
static GLM_RELAXED_CONSTEXPR length_t components = 4;
static GLM_RELAXED_CONSTEXPR precision prec = defaultp;
# endif//GLM_META_PROG_HELPERS
#ifdef GLM_SIMD_ENABLE_XYZW_UNION
union
{
@ -114,25 +109,6 @@ namespace detail
__m128 Data;
#endif
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type X;
static const type Y;
static const type Z;
static const type W;
static const type XY;
static const type XZ;
static const type XW;
static const type YZ;
static const type YW;
static const type ZW;
static const type XYZ;
static const type XYW;
static const type XZW;
static const type YZW;
static const type XYZW;
# endif
//////////////////////////////////////
// Implicit basic constructors

View File

@ -16,25 +16,6 @@ struct shuffle_mask
enum{value = Value};
};
# ifdef GLM_STATIC_CONST_MEMBERS
const fvec4SIMD fvec4SIMD::ZERO(0, 0, 0, 0);
const fvec4SIMD fvec4SIMD::X(1, 0, 0, 0);
const fvec4SIMD fvec4SIMD::Y(0, 1, 0, 0);
const fvec4SIMD fvec4SIMD::Z(0, 0, 1, 0);
const fvec4SIMD fvec4SIMD::W(0, 0, 0, 1);
const fvec4SIMD fvec4SIMD::XY(1, 1, 0, 0);
const fvec4SIMD fvec4SIMD::XZ(1, 0, 1, 0);
const fvec4SIMD fvec4SIMD::XW(1, 0, 0, 1);
const fvec4SIMD fvec4SIMD::YZ(0, 1, 1, 0);
const fvec4SIMD fvec4SIMD::YW(0, 1, 0, 1);
const fvec4SIMD fvec4SIMD::ZW(0, 0, 1, 1);
const fvec4SIMD fvec4SIMD::XYZ(1, 1, 1, 0);
const fvec4SIMD fvec4SIMD::XYW(1, 1, 0, 1);
const fvec4SIMD fvec4SIMD::XZW(1, 0, 1, 1);
const fvec4SIMD fvec4SIMD::YZW(0, 1, 1, 1);
const fvec4SIMD fvec4SIMD::XYZW(1, 1, 1, 1);
# endif
//////////////////////////////////////
// Implicit basic constructors

224
glm/gtx/type_trait.hpp Normal file
View File

@ -0,0 +1,224 @@
///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net)
///
/// Copyright (c) 2005 - 2016 G-Truc Creation (www.g-truc.net)
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to deal
/// in the Software without restriction, including without limitation the rights
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
/// copies of the Software, and to permit persons to whom the Software is
/// furnished to do so, subject to the following conditions:
///
/// The above copyright notice and this permission notice shall be included in
/// all copies or substantial portions of the Software.
///
/// Restrictions:
/// By making use of the Software for military purposes, you choose to make
/// a Bunny unhappy.
///
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
/// THE SOFTWARE.
///
/// @ref gtx_type_info
/// @file glm/gtx/type_info.hpp
/// @date 2016-03-12 / 2016-03-12
/// @author Christophe Riccio
///
/// @see core (dependence)
///
/// @defgroup gtx_type_info GLM_GTX_type_info
/// @ingroup gtx
///
/// @brief Defines aligned types.
///
/// <glm/gtx/type_aligned.hpp> need to be included to use these functionalities.
///////////////////////////////////////////////////////////////////////////////////
#pragma once
// Dependency:
#include "../detail/precision.hpp"
#include "../detail/setup.hpp"
#if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
# pragma message("GLM: GLM_GTX_type_info extension included")
#endif
namespace glm
{
/// @addtogroup gtx_type_info
/// @{
template <typename T, precision P> struct tvec1;
template <typename T, precision P> struct tvec2;
template <typename T, precision P> struct tvec3;
template <typename T, precision P> struct tvec4;
template <typename T, precision P> struct tmat2x2;
template <typename T, precision P> struct tmat2x3;
template <typename T, precision P> struct tmat2x4;
template <typename T, precision P> struct tmat3x2;
template <typename T, precision P> struct tmat3x3;
template <typename T, precision P> struct tmat3x4;
template <typename T, precision P> struct tmat4x2;
template <typename T, precision P> struct tmat4x3;
template <typename T, precision P> struct tmat4x4;
template <typename T, precision P> struct tquat;
template <typename T, precision P> struct tdualquat;
template <template <typename, precision> class genType>
struct type
{
static bool const is_vec = false;
static bool const is_mat = false;
static bool const is_quat = false;
static GLM_RELAXED_CONSTEXPR length_t components = 0;
};
template <>
struct type<tvec1>
{
static bool const is_vec = true;
static bool const is_mat = false;
static bool const is_quat = false;
static GLM_RELAXED_CONSTEXPR length_t components = 1;
};
template <>
struct type<tvec2>
{
static bool const is_vec = true;
static bool const is_mat = false;
static bool const is_quat = false;
static GLM_RELAXED_CONSTEXPR length_t components = 2;
};
template <>
struct type<tvec3>
{
static bool const is_vec = true;
static bool const is_mat = false;
static bool const is_quat = false;
static GLM_RELAXED_CONSTEXPR length_t components = 3;
};
template <>
struct type<tvec4>
{
static bool const is_vec = true;
static bool const is_mat = false;
static bool const is_quat = false;
static GLM_RELAXED_CONSTEXPR length_t components = 4;
};
template <>
struct type<tmat2x2>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
static GLM_RELAXED_CONSTEXPR length_t components = 2;
};
template <>
struct type<tmat2x3>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
static GLM_RELAXED_CONSTEXPR length_t components = 2;
};
template <>
struct type<tmat2x4>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
static GLM_RELAXED_CONSTEXPR length_t components = 2;
};
template <>
struct type<tmat3x2>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
static GLM_RELAXED_CONSTEXPR length_t components = 3;
static GLM_RELAXED_CONSTEXPR length_t cols = 3;
static GLM_RELAXED_CONSTEXPR length_t rows = 2;
};
template <>
struct type<tmat3x3>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
static GLM_RELAXED_CONSTEXPR length_t components = 3;
};
template <>
struct type<tmat3x4>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
static GLM_RELAXED_CONSTEXPR length_t components = 3;
};
template <>
struct type<tmat4x2>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
static GLM_RELAXED_CONSTEXPR length_t components = 4;
};
template <>
struct type<tmat4x3>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
static GLM_RELAXED_CONSTEXPR length_t components = 4;
};
template <>
struct type<tmat4x4>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
static GLM_RELAXED_CONSTEXPR length_t components = 4;
};
template <>
struct type<tquat>
{
static bool const is_vec = false;
static bool const is_mat = false;
static bool const is_quat = true;
static GLM_RELAXED_CONSTEXPR length_t components = 4;
};
template <>
struct type<tdualquat>
{
static bool const is_vec = false;
static bool const is_mat = false;
static bool const is_quat = true;
static GLM_RELAXED_CONSTEXPR length_t components = 8;
};
/// @}
}//namespace glm
#include "type_trait.inl"

0
glm/gtx/type_trait.inl Normal file
View File

View File

@ -73,6 +73,9 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate)
- Fixed intersectRayTriangle to not do any unintentional backface culling
- Fixed long long warnings when using C++98 on GCC and Clang #482
##### Deprecation:
- Removed GLM_FORCE_SIZE_FUNC define
#### [GLM 0.9.7.4](https://github.com/g-truc/glm/tree/0.9.7) - 2016-XX-XX
##### Fixes:
- Fixed asinh and atanh warning with C++98 STL #484

View File

@ -3,7 +3,6 @@ glmCreateTestGTC(core_type_ctor)
glmCreateTestGTC(core_type_float)
glmCreateTestGTC(core_type_int)
glmCreateTestGTC(core_type_length)
glmCreateTestGTC(core_type_length_size)
glmCreateTestGTC(core_type_mat2x2)
glmCreateTestGTC(core_type_mat2x3)
glmCreateTestGTC(core_type_mat2x4)

View File

@ -1,116 +0,0 @@
///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net)
///
/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net)
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to deal
/// in the Software without restriction, including without limitation the rights
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
/// copies of the Software, and to permit persons to whom the Software is
/// furnished to do so, subject to the following conditions:
///
/// The above copyright notice and this permission notice shall be included in
/// all copies or substantial portions of the Software.
///
/// Restrictions:
/// By making use of the Software for military purposes, you choose to make
/// a Bunny unhappy.
///
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
/// THE SOFTWARE.
///
/// @file test/core/core_type_length_size.cpp
/// @date 2011-05-25 / 2014-11-25
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_SIZE_FUNC
#include <glm/glm.hpp>
#include <glm/gtc/vec1.hpp>
int test_length_mat_non_squared()
{
int Error = 0;
Error += glm::mat2x3().size() == 2 ? 0 : 1;
Error += glm::mat2x4().size() == 2 ? 0 : 1;
Error += glm::mat3x2().size() == 3 ? 0 : 1;
Error += glm::mat3x4().size() == 3 ? 0 : 1;
Error += glm::mat4x2().size() == 4 ? 0 : 1;
Error += glm::mat4x3().size() == 4 ? 0 : 1;
Error += glm::dmat2x3().size() == 2 ? 0 : 1;
Error += glm::dmat2x4().size() == 2 ? 0 : 1;
Error += glm::dmat3x2().size() == 3 ? 0 : 1;
Error += glm::dmat3x4().size() == 3 ? 0 : 1;
Error += glm::dmat4x2().size() == 4 ? 0 : 1;
Error += glm::dmat4x3().size() == 4 ? 0 : 1;
return Error;
}
int test_length_mat()
{
int Error = 0;
Error += glm::mat2().size() == 2 ? 0 : 1;
Error += glm::mat3().size() == 3 ? 0 : 1;
Error += glm::mat4().size() == 4 ? 0 : 1;
Error += glm::mat2x2().size() == 2 ? 0 : 1;
Error += glm::mat3x3().size() == 3 ? 0 : 1;
Error += glm::mat4x4().size() == 4 ? 0 : 1;
Error += glm::dmat2().size() == 2 ? 0 : 1;
Error += glm::dmat3().size() == 3 ? 0 : 1;
Error += glm::dmat4().size() == 4 ? 0 : 1;
Error += glm::dmat2x2().size() == 2 ? 0 : 1;
Error += glm::dmat3x3().size() == 3 ? 0 : 1;
Error += glm::dmat4x4().size() == 4 ? 0 : 1;
return Error;
}
int test_length_vec()
{
int Error = 0;
Error += glm::vec1().size() == 1 ? 0 : 1;
Error += glm::vec2().size() == 2 ? 0 : 1;
Error += glm::vec3().size() == 3 ? 0 : 1;
Error += glm::vec4().size() == 4 ? 0 : 1;
Error += glm::ivec1().size() == 1 ? 0 : 1;
Error += glm::ivec2().size() == 2 ? 0 : 1;
Error += glm::ivec3().size() == 3 ? 0 : 1;
Error += glm::ivec4().size() == 4 ? 0 : 1;
Error += glm::uvec1().size() == 1 ? 0 : 1;
Error += glm::uvec2().size() == 2 ? 0 : 1;
Error += glm::uvec3().size() == 3 ? 0 : 1;
Error += glm::uvec4().size() == 4 ? 0 : 1;
Error += glm::dvec1().size() == 1 ? 0 : 1;
Error += glm::dvec2().size() == 2 ? 0 : 1;
Error += glm::dvec3().size() == 3 ? 0 : 1;
Error += glm::dvec4().size() == 4 ? 0 : 1;
return Error;
}
int main()
{
int Error = 0;
Error += test_length_vec();
Error += test_length_mat();
Error += test_length_mat_non_squared();
return Error;
}

View File

@ -29,7 +29,6 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/gtc/epsilon.hpp>
#include <glm/matrix.hpp>
#include <glm/vector_relational.hpp>
@ -87,15 +86,6 @@ int test_inverse()
return Error;
}
int test_static_const() {
int Error(0);
Error += glm::mat2x2(1) == glm::mat2x2::IDENTITY ? 0 : 1;
Error += glm::mat2x2(0) == glm::mat2x2::ZERO ? 0 : 1;
return Error;
}
int test_ctr()
{
int Error(0);
@ -177,13 +167,7 @@ int main()
{
int Error(0);
#ifdef GLM_META_PROG_HELPERS
assert(glm::mat2::rows == glm::mat2::row_type::components);
assert(glm::mat2::cols == glm::mat2::col_type::components);
#endif
Error += cast::test();
Error += test_static_const();
Error += test_ctr();
Error += test_operators();
Error += test_inverse();

View File

@ -29,7 +29,6 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/vector_relational.hpp>
#include <glm/mat2x2.hpp>
#include <glm/mat2x3.hpp>
@ -103,16 +102,6 @@ int test_ctr()
return Error;
}
int test_static_const() {
int Error(0);
Error += glm::mat2x3(1) == glm::mat2x3::IDENTITY ? 0 : 1;
Error += glm::mat2x3(0) == glm::mat2x3::ZERO ? 0 : 1;
return Error;
}
namespace cast
{
template <typename genType>
@ -152,13 +141,7 @@ int main()
{
int Error = 0;
#ifdef GLM_META_PROG_HELPERS
assert(glm::mat2x3::rows == glm::mat2x3::row_type::components);
assert(glm::mat2x3::cols == glm::mat2x3::col_type::components);
#endif
Error += cast::test();
Error += test_static_const();
Error += test_ctr();
Error += test_operators();

View File

@ -29,7 +29,6 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/vector_relational.hpp>
#include <glm/mat2x2.hpp>
#include <glm/mat2x3.hpp>
@ -103,15 +102,6 @@ int test_ctr()
return Error;
}
int test_static_const() {
int Error(0);
Error += glm::mat2x4(1) == glm::mat2x4::IDENTITY ? 0 : 1;
Error += glm::mat2x4(0) == glm::mat2x4::ZERO ? 0 : 1;
return Error;
}
namespace cast
{
template <typename genType>
@ -151,13 +141,7 @@ int main()
{
int Error = 0;
#ifdef GLM_META_PROG_HELPERS
assert(glm::mat2x4::rows == glm::mat2x4::row_type::components);
assert(glm::mat2x4::cols == glm::mat2x4::col_type::components);
#endif
Error += cast::test();
Error += test_static_const();
Error += test_ctr();
Error += test_operators();

View File

@ -29,7 +29,6 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/vector_relational.hpp>
#include <glm/mat2x2.hpp>
#include <glm/mat2x3.hpp>
@ -107,16 +106,6 @@ int test_ctr()
return Error;
}
int test_static_const() {
int Error(0);
Error += glm::mat3x2(1) == glm::mat3x2::IDENTITY ? 0 : 1;
Error += glm::mat3x2(0) == glm::mat3x2::ZERO ? 0 : 1;
return Error;
}
namespace cast
{
template <typename genType>
@ -156,14 +145,8 @@ int main()
{
int Error = 0;
#ifdef GLM_META_PROG_HELPERS
assert(glm::mat3x2::rows == glm::mat3x2::row_type::components);
assert(glm::mat3x2::cols == glm::mat3x2::col_type::components);
#endif
Error += cast::test();
Error += test_ctr();
Error += test_static_const();
Error += test_operators();
return Error;

View File

@ -29,7 +29,6 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/gtc/epsilon.hpp>
#include <glm/matrix.hpp>
#include <glm/vector_relational.hpp>
@ -166,15 +165,6 @@ int test_ctr()
return Error;
}
int test_static_const() {
int Error(0);
Error += glm::mat3x3(1) == glm::mat3x3::IDENTITY ? 0 : 1;
Error += glm::mat3x3(0) == glm::mat3x3::ZERO ? 0 : 1;
return Error;
}
namespace cast
{
template <typename genType>
@ -214,13 +204,7 @@ int main()
{
int Error = 0;
#ifdef GLM_META_PROG_HELPERS
assert(glm::mat3::rows == glm::mat3::row_type::components);
assert(glm::mat3::cols == glm::mat3::col_type::components);
#endif
Error += cast::test();
Error += test_static_const();
Error += test_ctr();
Error += test_mat3x3();
Error += test_operators();

View File

@ -29,7 +29,6 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/vector_relational.hpp>
#include <glm/mat2x2.hpp>
#include <glm/mat2x3.hpp>
@ -107,15 +106,6 @@ int test_ctr()
return Error;
}
int test_static_const() {
int Error(0);
Error += glm::mat3x4(1) == glm::mat3x4::IDENTITY ? 0 : 1;
Error += glm::mat3x4(0) == glm::mat3x4::ZERO ? 0 : 1;
return Error;
}
namespace cast
{
template <typename genType>
@ -155,13 +145,7 @@ int main()
{
int Error = 0;
#ifdef GLM_META_PROG_HELPERS
assert(glm::mat3x4::rows == glm::mat3x4::row_type::components);
assert(glm::mat3x4::cols == glm::mat3x4::col_type::components);
#endif
Error += cast::test();
Error += test_static_const();
Error += test_ctr();
Error += test_operators();

View File

@ -29,7 +29,6 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/vector_relational.hpp>
#include <glm/mat2x2.hpp>
#include <glm/mat2x3.hpp>
@ -111,15 +110,6 @@ int test_ctr()
return Error;
}
int test_static_const() {
int Error(0);
Error += glm::mat4x2(1) == glm::mat4x2::IDENTITY ? 0 : 1;
Error += glm::mat4x2(0) == glm::mat4x2::ZERO ? 0 : 1;
return Error;
}
namespace cast
{
template <typename genType>
@ -159,13 +149,7 @@ int main()
{
int Error = 0;
#ifdef GLM_META_PROG_HELPERS
assert(glm::mat4x2::rows == glm::mat4x2::row_type::components);
assert(glm::mat4x2::cols == glm::mat4x2::col_type::components);
#endif
Error += cast::test();
Error += test_static_const();
Error += test_ctr();
Error += test_operators();

View File

@ -29,7 +29,6 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/vector_relational.hpp>
#include <glm/mat2x2.hpp>
#include <glm/mat2x3.hpp>
@ -111,15 +110,6 @@ int test_ctr()
return Error;
}
int test_static_const() {
int Error(0);
Error += glm::mat4x3(1) == glm::mat4x3::IDENTITY ? 0 : 1;
Error += glm::mat4x3(0) == glm::mat4x3::ZERO ? 0 : 1;
return Error;
}
namespace cast
{
template <typename genType>
@ -159,13 +149,7 @@ int main()
{
int Error = 0;
#ifdef GLM_META_PROG_HELPERS
assert(glm::mat4x3::rows == glm::mat4x3::row_type::components);
assert(glm::mat4x3::cols == glm::mat4x3::col_type::components);
#endif
Error += cast::test();
Error += test_static_const();
Error += test_ctr();
Error += test_operators();

View File

@ -29,7 +29,6 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#define GLM_SIMD
#include <glm/gtc/epsilon.hpp>
#include <glm/matrix.hpp>
@ -284,15 +283,6 @@ int perf_mul()
return Error;
}
int test_static_const() {
int Error(0);
Error += glm::mat4x4(1) == glm::mat4x4::IDENTITY ? 0 : 1;
Error += glm::mat4x4(0) == glm::mat4x4::ZERO ? 0 : 1;
return Error;
}
namespace cast
{
template <typename genType>
@ -342,14 +332,8 @@ int main()
repro Repro;
#ifdef GLM_META_PROG_HELPERS
assert(glm::mat4::rows == glm::mat4::row_type::components);
assert(glm::mat4::cols == glm::mat4::col_type::components);
#endif
Error += cast::test();
Error += test_ctr();
Error += test_static_const();
Error += test_inverse_dmat4x4();
Error += test_inverse_mat4x4();
Error += test_operators();

View File

@ -29,10 +29,6 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#if !(GLM_COMPILER & GLM_COMPILER_GCC)
# define GLM_META_PROG_HELPERS
#endif
#define GLM_STATIC_CONST_MEMBERS
#define GLM_SWIZZLE
#include <glm/vector_relational.hpp>
#include <glm/gtc/vec1.hpp>
@ -135,7 +131,6 @@ int test_vec1_size()
Error += 8 == sizeof(glm::highp_dvec1) ? 0 : 1;
Error += glm::vec1().length() == 1 ? 0 : 1;
Error += glm::dvec1().length() == 1 ? 0 : 1;
Error += glm::vec1::components == 1 ? 0 : 1;
return Error;
}
@ -167,18 +162,6 @@ int test_vec1_operator_increment()
return Error;
}
int test_vec1_static_const() {
int Error = 0;
Error += (glm::vec1(1.0f) == glm::vec1::X) ? 0 : 1;
Error += (glm::ivec1(1) == glm::ivec1::X) ? 0 : 1;
Error += (glm::dvec1(1.0) == glm::dvec1::X) ? 0 : 1;
Error += (glm::bvec1(false) == glm::bvec1::ZERO) ? 0 : 1;
Error += (glm::uvec1(0) == glm::uvec1::ZERO) ? 0 : 1;
return Error;
}
int main()
{
int Error = 0;
@ -186,12 +169,6 @@ int main()
glm::vec1 v;
assert(v.length() == 1);
# ifdef GLM_META_PROG_HELPERS
assert(glm::vec1::components == glm::vec1().length());
assert(glm::vec1::components == 1);
# endif
Error += test_vec1_static_const();
Error += test_vec1_size();
Error += test_vec1_ctor();
Error += test_vec1_operators();

View File

@ -29,10 +29,6 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#if !(GLM_COMPILER & GLM_COMPILER_GCC)
# define GLM_META_PROG_HELPERS
#endif
#define GLM_SWIZZLE
#include <glm/vector_relational.hpp>
#include <glm/vec2.hpp>
@ -301,7 +297,6 @@ int test_vec2_size()
Error += 16 == sizeof(glm::highp_dvec2) ? 0 : 1;
Error += glm::vec2().length() == 2 ? 0 : 1;
Error += glm::dvec2().length() == 2 ? 0 : 1;
Error += glm::vec2::components == 2 ? 0 : 1;
return Error;
}
@ -333,17 +328,6 @@ int test_operator_increment()
return Error;
}
int test_vec2_static_const() {
int Error(0);
Error += (glm::ivec2(0, 0) == glm::ivec2::ZERO) ? 0 : 1;
Error += (glm::vec2(1, 0) == glm::vec2::X) ? 0 : 1;
Error += (glm::bvec2(false, true) == glm::bvec2::Y) ? 0 : 1;
Error += (glm::dvec2(1, 1) == glm::dvec2::XY) ? 0 : 1;
return Error;
}
int main()
{
int Error = 0;
@ -351,12 +335,6 @@ int main()
glm::vec2 v;
assert(v.length() == 2);
# ifdef GLM_META_PROG_HELPERS
assert(glm::vec2::components == glm::vec2().length());
assert(glm::vec2::components == 2);
# endif
Error += test_vec2_static_const();
Error += test_vec2_size();
Error += test_vec2_ctor();
Error += test_vec2_operators();

View File

@ -29,11 +29,7 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#if !(GLM_COMPILER & GLM_COMPILER_GCC)
# define GLM_META_PROG_HELPERS
#endif
#define GLM_SWIZZLE
#define GLM_STATIC_CONST_MEMBERS
#include <glm/vector_relational.hpp>
#include <glm/geometric.hpp>
#include <glm/vec2.hpp>
@ -267,7 +263,6 @@ int test_vec3_size()
Error += 24 == sizeof(glm::highp_dvec3) ? 0 : 1;
Error += glm::vec3().length() == 3 ? 0 : 1;
Error += glm::dvec3().length() == 3 ? 0 : 1;
Error += glm::vec3::components == 3 ? 0 : 1;
return Error;
}
@ -494,21 +489,6 @@ int test_operator_increment()
return Error;
}
int test_vec3_static_const() {
int Error(0);
Error += (glm::ivec3(0, 0, 0) == glm::ivec3::ZERO) ? 0 : 1;
Error += (glm::vec3(1, 0, 0) == glm::vec3::X) ? 0 : 1;
Error += (glm::bvec3(false, true, false) == glm::bvec3::Y) ? 0 : 1;
Error += (glm::bvec3(false, false, true) == glm::bvec3::Z) ? 0 : 1;
Error += (glm::dvec3(1, 1, 0) == glm::dvec3::XY) ? 0 : 1;
Error += (glm::vec3(1, 0, 1) == glm::vec3::XZ) ? 0 : 1;
Error += (glm::uvec3(0u, 1u, 1u) == glm::uvec3::YZ) ? 0 : 1;
Error += (glm::dvec3(1, 1, 1) == glm::dvec3::XYZ) ? 0 : 1;
return Error;
}
int main()
{
int Error = 0;
@ -516,12 +496,6 @@ int main()
glm::vec3 v;
assert(v.length() == 3);
# ifdef GLM_META_PROG_HELPERS
assert(glm::vec3::components == glm::vec3().length());
assert(glm::vec3::components == 3);
# endif
Error += test_vec3_static_const();
Error += test_vec3_ctor();
Error += test_vec3_operators();
Error += test_vec3_size();

View File

@ -29,11 +29,7 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#if !(GLM_COMPILER & GLM_COMPILER_GCC)
# define GLM_META_PROG_HELPERS
#endif
#define GLM_SWIZZLE
#define GLM_STATIC_CONST_MEMBERS
#include <glm/vector_relational.hpp>
#include <glm/vec2.hpp>
#include <glm/vec3.hpp>
@ -397,28 +393,6 @@ int test_operator_increment()
return Error;
}
int test_vec4_static_const() {
int Error(0);
Error += (glm::ivec4(0, 0, 0, 0) == glm::ivec4::ZERO) ? 0 : 1;
Error += (glm::vec4(1, 0, 0, 0) == glm::vec4::X) ? 0 : 1;
Error += (glm::bvec4(false, true, false, false) == glm::bvec4::Y) ? 0 : 1;
Error += (glm::bvec4(false, false, true, false) == glm::bvec4::Z) ? 0 : 1;
Error += (glm::uvec4(0u, 0u, 0u, 1u) == glm::uvec4::W) ? 0 : 1;
Error += (glm::dvec4(1, 1, 0, 0) == glm::dvec4::XY) ? 0 : 1;
Error += (glm::vec4(1, 0, 1, 0) == glm::vec4::XZ) ? 0 : 1;
Error += (glm::vec4(1, 0, 0, 1) == glm::vec4::XW) ? 0 : 1;
Error += (glm::uvec4(0u, 1u, 1u, 0u) == glm::uvec4::YZ) ? 0 : 1;
Error += (glm::vec4(0, 1, 0, 1) == glm::vec4::YW) ? 0 : 1;
Error += (glm::dvec4(1, 1, 1, 0) == glm::dvec4::XYZ) ? 0 : 1;
Error += (glm::vec4(1, 1, 0, 1) == glm::vec4::XYW) ? 0 : 1;
Error += (glm::vec4(1, 0, 1, 1) == glm::vec4::XZW) ? 0 : 1;
Error += (glm::vec4(0, 1, 1, 1) == glm::vec4::YZW) ? 0 : 1;
Error += (glm::vec4(1, 1, 1, 1) == glm::vec4::XYZW) ? 0 : 1;
return Error;
}
struct AoS
{
glm::vec4 A;
@ -518,18 +492,12 @@ int main()
glm::vec4 v;
assert(v.length() == 4);
# ifdef GLM_META_PROG_HELPERS
assert(glm::vec4::components == glm::vec4().length());
assert(glm::vec4::components == 4);
# endif
# ifdef NDEBUG
std::size_t const Size(1000000);
Error += test_vec4_perf_AoS(Size);
Error += test_vec4_perf_SoA(Size);
# endif//NDEBUG
Error += test_vec4_static_const();
Error += test_vec4_ctor();
Error += test_bvec4_ctor();
Error += test_vec4_size();

View File

@ -29,7 +29,6 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_META_PROG_HELPERS
#include <glm/gtc/quaternion.hpp>
#include <glm/gtc/epsilon.hpp>
#include <glm/vector_relational.hpp>
@ -327,11 +326,6 @@ int main()
{
int Error(0);
#ifdef GLM_META_PROG_HELPERS
assert(glm::quat::components == 4);
assert(glm::quat::components == glm::quat().length());
#endif
Error += test_quat_ctr();
Error += test_quat_mul_vec();
Error += test_quat_two_axis_ctr();

View File

@ -45,6 +45,7 @@ glmCreateTestGTC(gtx_simd_mat4)
glmCreateTestGTC(gtx_spline)
glmCreateTestGTC(gtx_string_cast)
glmCreateTestGTC(gtx_type_aligned)
glmCreateTestGTC(gtx_type_trait)
glmCreateTestGTC(gtx_vector_angle)
glmCreateTestGTC(gtx_vector_query)
glmCreateTestGTC(gtx_wrap)

View File

@ -209,10 +209,6 @@ int main()
{
int Error(0);
#ifdef GLM_META_PROG_HELPERS
assert(glm::dualquat::components == glm::dualquat().length());
#endif
Error += test_dual_quat_ctr();
Error += test_dquat_type();
Error += test_scalars();

View File

@ -29,7 +29,6 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/quaternion.hpp>
@ -266,15 +265,6 @@ int main()
{
int Error = 0;
#ifdef GLM_META_PROG_HELPERS
assert(glm::simdMat4::rows == glm::simdMat4::row_type::components);
assert(glm::simdMat4::cols == glm::simdMat4::col_type::components);
assert(glm::simdMat4::components == glm::simdMat4::pure_type::components);
assert(glm::simdMat4::rows == glm::simdMat4::pure_row_type::components);
assert(glm::simdMat4::cols == glm::simdMat4::pure_col_type::components);
#endif
std::vector<glm::mat4> Data(64 * 64 * 1);
for(std::size_t i = 0; i < Data.size(); ++i)
Data[i] = glm::mat4(

View File

@ -29,8 +29,6 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/glm.hpp>
#include <glm/gtx/simd_vec4.hpp>
#include <cstdio>
@ -39,11 +37,6 @@
int main()
{
#ifdef GLM_META_PROG_HELPERS
assert(glm::simdVec4::components == glm::simdVec4::pure_type::components);
#endif
glm::simdVec4 A1(0.0f, 0.1f, 0.2f, 0.3f);
glm::simdVec4 B1(0.4f, 0.5f, 0.6f, 0.7f);
glm::simdVec4 C1 = A1 + B1;

View File

@ -0,0 +1,79 @@
#include <glm/vec4.hpp>
#include <glm/gtx/type_trait.hpp>
template <typename genType>
struct type_gni
{
static bool const is_vec = true;
static bool const is_mat = false;
static bool const is_quat = false;
};
/*
template <template <class, glm::precision> class vecType, typename T, glm::precision P>
struct type_gni<vecType, T, P>
{
static bool const is_vec = true;
static bool const is_mat = false;
static bool const is_quat = false;
};
*/
namespace detail
{
template <template <typename, glm::precision> class vec_type>
struct compute_vec_type
{
static bool const is_vec = false;
static GLM_RELAXED_CONSTEXPR glm::length_t components = 0;
};
template <>
struct compute_vec_type<glm::tvec1>
{
static bool const is_vec = false;
//static GLM_RELAXED_CONSTEXPR glm::length_t components = 1;
};
template <>
struct compute_vec_type<glm::tvec2>
{
static bool const is_vec = false;
//static GLM_RELAXED_CONSTEXPR glm::length_t components = 2;
};
template <>
struct compute_vec_type<glm::tvec3>
{
static bool const is_vec = false;
//static GLM_RELAXED_CONSTEXPR glm::length_t components = 3;
};
template <>
struct compute_vec_type<glm::tvec4>
{
static bool const is_vec = false;
//static GLM_RELAXED_CONSTEXPR glm::length_t components = 4;
};
}//namespace detail
/*
template <class gen_type>
struct vec_type
{
static bool const is_vec = detail::compute_vec_type<typename gen_type::vec_type>::is_vec;
//static GLM_RELAXED_CONSTEXPR glm::length_t const components = detail::compute_vec_type<typename gen_type::vec_type>::components;
};
*/
int main()
{
int Error = 0;
//typedef vec_type;
//bool const is_vec = detail::compute_vec_type<>::is_vec;
//Error += vec_type<glm::vec4>::is_vec ? 0 : 1;
//Error += vec_type<glm::vec4>::components == 4 ? 0 : 1;
return Error;
}