mirror of
https://github.com/g-truc/glm.git
synced 2024-11-16 14:54:35 +00:00
Add metaprogramming constructors for vec1
- Tests, too
This commit is contained in:
parent
067e1f546d
commit
51cbb47f3f
@ -134,6 +134,12 @@ namespace glm
|
|||||||
template <typename U, precision Q>
|
template <typename U, precision Q>
|
||||||
GLM_FUNC_DECL GLM_EXPLICIT tvec1(tvec1<U, Q> const & v);
|
GLM_FUNC_DECL GLM_EXPLICIT tvec1(tvec1<U, Q> const & v);
|
||||||
|
|
||||||
|
/// Extra helper constructors for metaprogramming
|
||||||
|
# ifdef GLM_META_PROG_HELPERS
|
||||||
|
template <typename X, typename Y, typename Z = Y, typename W = Z>
|
||||||
|
GLM_FUNC_DECL tvec1(X const& x, Y const&, Z const& = Z(0), W const& = W(0));
|
||||||
|
# endif
|
||||||
|
|
||||||
// -- Swizzle constructors --
|
// -- Swizzle constructors --
|
||||||
|
|
||||||
# if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
|
# if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
|
||||||
|
@ -93,6 +93,15 @@ namespace glm
|
|||||||
: x(static_cast<T>(v.x))
|
: x(static_cast<T>(v.x))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
// -- Metaprogramming helper constructors --
|
||||||
|
# ifdef GLM_META_PROG_HELPERS
|
||||||
|
template <typename T, precision P>
|
||||||
|
template <typename X, typename Y, typename Z, typename W>
|
||||||
|
GLM_FUNC_QUALIFIER tvec1<T, P>::tvec1(X const& x, Y const&, Z const&, W const&)
|
||||||
|
: x(static_cast<T>(x))
|
||||||
|
{}
|
||||||
|
# endif
|
||||||
|
|
||||||
// -- Component accesses --
|
// -- Component accesses --
|
||||||
|
|
||||||
# ifdef GLM_FORCE_SIZE_FUNC
|
# ifdef GLM_FORCE_SIZE_FUNC
|
||||||
|
@ -80,6 +80,17 @@ int test_vec1_ctor()
|
|||||||
Error += std::is_copy_constructible<glm::vec1>::value ? 0 : 1;
|
Error += std::is_copy_constructible<glm::vec1>::value ? 0 : 1;
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
# ifdef GLM_META_PROG_HELPERS
|
||||||
|
{
|
||||||
|
glm::vec1 a(1), b(1, 2), c(1, 2, 3), d(1, 2, 3, 4);
|
||||||
|
|
||||||
|
Error += (a == b) ? 0 : 1;
|
||||||
|
Error += (b == c) ? 0 : 1;
|
||||||
|
Error += (c == d) ? 0 : 1;
|
||||||
|
Error += (d == a) ? 0 : 1;
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#if GLM_HAS_INITIALIZER_LISTS
|
#if GLM_HAS_INITIALIZER_LISTS
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user