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:
@@ -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;
|
||||
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[](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
|
||||
GLM_FUNC_DECL T & operator[](length_type i);
|
||||
GLM_FUNC_DECL T const & operator[](length_type i) const;
|
||||
|
||||
// -- 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"
|
||||
|
||||
@@ -49,116 +49,27 @@ 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 GLM_CONSTEXPR typename tquat<T, P>::length_type tquat<T, P>::length() 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 & tquat<T, P>::operator[](typename tquat<T, P>::length_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
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T & tquat<T, P>::operator[](typename tquat<T, P>::length_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>::length_type i) const
|
||||
{
|
||||
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
|
||||
return (&x)[i];
|
||||
}
|
||||
# endif//GLM_FORCE_SIZE_FUNC
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T const & tquat<T, P>::operator[](typename tquat<T, P>::length_type i) const
|
||||
{
|
||||
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
|
||||
return (&x)[i];
|
||||
}
|
||||
|
||||
// -- Implicit basic constructors --
|
||||
|
||||
|
||||
Reference in New Issue
Block a user