Refactored GLM_FORCE_MESSAGES, added swizzle operators and functions tests

This commit is contained in:
Christophe Riccio 2018-07-14 17:56:40 +02:00
parent d50c699515
commit 4db3abe6b5
6 changed files with 140 additions and 83 deletions

View File

@ -360,6 +360,10 @@
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC14) && (GLM_ARCH & GLM_ARCH_X86_BIT)))) ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC14) && (GLM_ARCH & GLM_ARCH_X86_BIT))))
#endif #endif
///////////////////////////////////////////////////////////////////////////////////
#define GLM_HAS_ANONYMOUS_STRUCT (GLM_LANG & GLM_LANG_CXXMS_FLAG)
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
// OpenMP // OpenMP
#ifdef _OPENMP #ifdef _OPENMP
@ -465,8 +469,13 @@
// User defines: GLM_FORCE_SWIZZLE // User defines: GLM_FORCE_SWIZZLE
#if defined(GLM_FORCE_SWIZZLE) #define GLM_SWIZZLE_OPERATOR 1
# define GLM_SWIZZLE GLM_ENABLE #define GLM_SWIZZLE_FUNCTION 2
#if defined(GLM_FORCE_SWIZZLE) && GLM_HAS_ANONYMOUS_STRUCT
# define GLM_SWIZZLE GLM_SWIZZLE_OPERATOR
#elif defined(GLM_FORCE_SWIZZLE)
# define GLM_SWIZZLE GLM_SWIZZLE_FUNCTION
#else #else
# define GLM_SWIZZLE GLM_DISABLE # define GLM_SWIZZLE GLM_DISABLE
#endif #endif
@ -477,9 +486,9 @@
// #define GLM_FORCE_UNRESTRICTED_GENTYPE // #define GLM_FORCE_UNRESTRICTED_GENTYPE
#ifdef GLM_FORCE_UNRESTRICTED_GENTYPE #ifdef GLM_FORCE_UNRESTRICTED_GENTYPE
# define GLM_UNRESTRICTED_GENTYPE 1 # define GLM_UNRESTRICTED_GENTYPE GLM_ENABLE
#else #else
# define GLM_UNRESTRICTED_GENTYPE 0 # define GLM_UNRESTRICTED_GENTYPE GLM_DISABLE
#endif #endif
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
@ -581,10 +590,6 @@
# define GLM_EXPLICIT # define GLM_EXPLICIT
#endif #endif
///////////////////////////////////////////////////////////////////////////////////
#define GLM_HAS_ANONYMOUS_STRUCT (GLM_LANG & GLM_LANG_CXXMS_FLAG)
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
// Length type: all length functions returns a length_t type. // Length type: all length functions returns a length_t type.
// When GLM_FORCE_SIZE_T_LENGTH is defined, length_t is a typedef of size_t otherwise // When GLM_FORCE_SIZE_T_LENGTH is defined, length_t is a typedef of size_t otherwise
@ -802,37 +807,41 @@ namespace glm
# endif # endif
// Report swizzle operator support // Report swizzle operator support
# if GLM_SWIZZLE == GLM_ENABLE # if GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR
# pragma message("GLM: Swizzling operators enabled") # pragma message("GLM: GLM_FORCE_SWIZZLE is defined, swizzling operators enabled")
# elif GLM_SWIZZLE == GLM_SWIZZLE_FUNCTION
# pragma message("GLM: GLM_FORCE_SWIZZLE is defined, swizzling functions enabled. Enable compiler C++ language extensions to enable swizzle operators.")
# else # else
# pragma message("GLM: Swizzling operators disabled, #define GLM_FORCE_SWIZZLE to enable swizzle operators") # pragma message("GLM: GLM_FORCE_SWIZZLE is undefined. swizzling functions or operators are disabled.")
# endif # endif
// Report .length() type // Report .length() type
# if defined GLM_FORCE_SIZE_T_LENGTH # if defined GLM_FORCE_SIZE_T_LENGTH
# pragma message("GLM: .length() returns glm::length_t, a typedef of std::size_t") # pragma message("GLM: GLM_FORCE_SIZE_T_LENGTH is defined. .length() returns a glm::length_t, a typedef of std::size_t instead of int.")
# else # else
# pragma message("GLM: .length() returns glm::length_t, a typedef of int following the GLSL specification") # pragma message("GLM: GLM_FORCE_SIZE_T_LENGTH is undefined. .length() returns a glm::length_t, a typedef of int following the GLSL specification. Define GLM_FORCE_SIZE_T_LENGTH to make glm::length_t, a typedef of std::size_t.")
# endif # endif
# ifdef GLM_FORCE_UNRESTRICTED_GENTYPE # ifdef GLM_FORCE_UNRESTRICTED_GENTYPE
# pragma message("GLM: Use unrestricted genType") # pragma message("GLM: GLM_FORCE_UNRESTRICTED_GENTYPE is defined. Removes GLSL specification restrictions on valid function genTypes.")
# else
# pragma message("GLM: GLM_FORCE_UNRESTRICTED_GENTYPE is undefined. Follows strictly GLSL specification on valid function genTypes.")
# endif # endif
# ifdef GLM_FORCE_SINGLE_ONLY # ifdef GLM_FORCE_SINGLE_ONLY
# pragma message("GLM: Using only single precision floating-point types") # pragma message("GLM: GLM_FORCE_SINGLE_ONLY is defined. Using only single precision floating-point types")
# endif # endif
# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE # if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE
# pragma message("GLM: Depth clip space: Zero to one") # pragma message("GLM: GLM_FORCE_DEPTH_ZERO_TO_ONE is defined. Using zero to one depth clip space.")
# else # else
# pragma message("GLM: Depth clip space: negative one to one") # pragma message("GLM: GLM_FORCE_DEPTH_ZERO_TO_ONE is undefined. Using negative one to one depth clip space.")
# endif # endif
# if GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED # if GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED
# pragma message("GLM: Coordinate system: left handed") # pragma message("GLM: GLM_FORCE_LEFT_HANDED is defined. Using left handed coordinate system.")
# else # else
# pragma message("GLM: Coordinate system: right handed") # pragma message("GLM: GLM_FORCE_LEFT_HANDED is undefined. Using right handed coordinate system.")
# endif # endif
#endif//GLM_MESSAGES #endif//GLM_MESSAGES

View File

@ -4,13 +4,11 @@
#pragma once #pragma once
#include "type_vec.hpp" #include "type_vec.hpp"
#if GLM_SWIZZLE == GLM_ENABLE #if GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR
# if GLM_HAS_ANONYMOUS_STRUCT # include "_swizzle.hpp"
# include "_swizzle.hpp" #elif GLM_SWIZZLE == GLM_SWIZZLE_FUNCTION
# else # include "_swizzle_func.hpp"
# include "_swizzle_func.hpp" #endif
# endif
#endif //GLM_SWIZZLE
#include <cstddef> #include <cstddef>
namespace glm namespace glm
@ -35,7 +33,7 @@ namespace glm
typename detail::storage<2, T, detail::is_aligned<Q>::value>::type data; typename detail::storage<2, T, detail::is_aligned<Q>::value>::type data;
# if GLM_SWIZZLE == GLM_ENABLE # if GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR
GLM_SWIZZLE2_2_MEMBERS(T, Q, x, y) GLM_SWIZZLE2_2_MEMBERS(T, Q, x, y)
GLM_SWIZZLE2_2_MEMBERS(T, Q, r, g) GLM_SWIZZLE2_2_MEMBERS(T, Q, r, g)
GLM_SWIZZLE2_2_MEMBERS(T, Q, s, t) GLM_SWIZZLE2_2_MEMBERS(T, Q, s, t)
@ -45,13 +43,13 @@ namespace glm
GLM_SWIZZLE2_4_MEMBERS(T, Q, x, y) GLM_SWIZZLE2_4_MEMBERS(T, Q, x, y)
GLM_SWIZZLE2_4_MEMBERS(T, Q, r, g) GLM_SWIZZLE2_4_MEMBERS(T, Q, r, g)
GLM_SWIZZLE2_4_MEMBERS(T, Q, s, t) GLM_SWIZZLE2_4_MEMBERS(T, Q, s, t)
# endif//GLM_SWIZZLE # endif
}; };
# else # else
union {T x, r, s;}; union {T x, r, s;};
union {T y, g, t;}; union {T y, g, t;};
# if GLM_SWIZZLE == GLM_ENABLE # if GLM_SWIZZLE == GLM_SWIZZLE_FUNCTION
GLM_SWIZZLE_GEN_VEC_FROM_VEC2(T, Q) GLM_SWIZZLE_GEN_VEC_FROM_VEC2(T, Q)
# endif//GLM_SWIZZLE # endif//GLM_SWIZZLE
# endif # endif
@ -106,13 +104,13 @@ namespace glm
GLM_FUNC_DECL GLM_CONSTEXPR_CXX11 GLM_EXPLICIT vec(vec<2, U, P> const& v); GLM_FUNC_DECL GLM_CONSTEXPR_CXX11 GLM_EXPLICIT vec(vec<2, U, P> const& v);
// -- Swizzle constructors -- // -- Swizzle constructors --
# if GLM_HAS_ANONYMOUS_STRUCT && GLM_SWIZZLE == GLM_ENABLE # if GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR
template<int E0, int E1> template<int E0, int E1>
GLM_FUNC_DECL vec(detail::_swizzle<2, T, Q, E0, E1,-1,-2> const& that) GLM_FUNC_DECL vec(detail::_swizzle<2, T, Q, E0, E1,-1,-2> const& that)
{ {
*this = that(); *this = that();
} }
# endif//GLM_SWIZZLE == GLM_ENABLE # endif//GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR
// -- Unary arithmetic operators -- // -- Unary arithmetic operators --

View File

@ -4,13 +4,11 @@
#pragma once #pragma once
#include "type_vec.hpp" #include "type_vec.hpp"
#if GLM_SWIZZLE == GLM_ENABLE #if GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR
# if GLM_HAS_ANONYMOUS_STRUCT # include "_swizzle.hpp"
# include "_swizzle.hpp" #elif GLM_SWIZZLE == GLM_SWIZZLE_FUNCTION
# else # include "_swizzle_func.hpp"
# include "_swizzle_func.hpp" #endif
# endif
#endif //GLM_SWIZZLE == GLM_ENABLE
#include <cstddef> #include <cstddef>
namespace glm namespace glm
@ -35,7 +33,7 @@ namespace glm
typename detail::storage<3, T, detail::is_aligned<Q>::value>::type data; typename detail::storage<3, T, detail::is_aligned<Q>::value>::type data;
# if GLM_SWIZZLE == GLM_ENABLE # if GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR
GLM_SWIZZLE3_2_MEMBERS(T, Q, x, y, z) GLM_SWIZZLE3_2_MEMBERS(T, Q, x, y, z)
GLM_SWIZZLE3_2_MEMBERS(T, Q, r, g, b) GLM_SWIZZLE3_2_MEMBERS(T, Q, r, g, b)
GLM_SWIZZLE3_2_MEMBERS(T, Q, s, t, p) GLM_SWIZZLE3_2_MEMBERS(T, Q, s, t, p)
@ -45,14 +43,14 @@ namespace glm
GLM_SWIZZLE3_4_MEMBERS(T, Q, x, y, z) GLM_SWIZZLE3_4_MEMBERS(T, Q, x, y, z)
GLM_SWIZZLE3_4_MEMBERS(T, Q, r, g, b) GLM_SWIZZLE3_4_MEMBERS(T, Q, r, g, b)
GLM_SWIZZLE3_4_MEMBERS(T, Q, s, t, p) GLM_SWIZZLE3_4_MEMBERS(T, Q, s, t, p)
# endif//GLM_SWIZZLE # endif
}; };
# else # else
union { T x, r, s; }; union { T x, r, s; };
union { T y, g, t; }; union { T y, g, t; };
union { T z, b, p; }; union { T z, b, p; };
# if GLM_SWIZZLE == GLM_ENABLE # if GLM_SWIZZLE == GLM_SWIZZLE_FUNCTION
GLM_SWIZZLE_GEN_VEC_FROM_VEC3(T, Q) GLM_SWIZZLE_GEN_VEC_FROM_VEC3(T, Q)
# endif//GLM_SWIZZLE # endif//GLM_SWIZZLE
# endif//GLM_LANG # endif//GLM_LANG
@ -124,7 +122,7 @@ namespace glm
GLM_FUNC_DECL GLM_CONSTEXPR_CXX11 GLM_EXPLICIT vec(vec<3, U, P> const& v); GLM_FUNC_DECL GLM_CONSTEXPR_CXX11 GLM_EXPLICIT vec(vec<3, U, P> const& v);
// -- Swizzle constructors -- // -- Swizzle constructors --
# if GLM_HAS_ANONYMOUS_STRUCT && GLM_SWIZZLE == GLM_ENABLE # if GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR
template<int E0, int E1, int E2> template<int E0, int E1, int E2>
GLM_FUNC_DECL vec(detail::_swizzle<3, T, Q, E0, E1, E2, -1> const& that) GLM_FUNC_DECL vec(detail::_swizzle<3, T, Q, E0, E1, E2, -1> const& that)
{ {
@ -142,7 +140,7 @@ namespace glm
{ {
*this = vec(scalar, v()); *this = vec(scalar, v());
} }
# endif//GLM_HAS_ANONYMOUS_STRUCT && GLM_SWIZZLE == GLM_ENABLE # endif//GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR
// -- Unary arithmetic operators -- // -- Unary arithmetic operators --

View File

@ -4,13 +4,11 @@
#pragma once #pragma once
#include "type_vec.hpp" #include "type_vec.hpp"
#if GLM_SWIZZLE == GLM_ENABLE #if GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR
# if GLM_HAS_ANONYMOUS_STRUCT # include "_swizzle.hpp"
# include "_swizzle.hpp" #elif GLM_SWIZZLE == GLM_SWIZZLE_FUNCTION
# else # include "_swizzle_func.hpp"
# include "_swizzle_func.hpp" #endif
# endif
#endif //GLM_SWIZZLE
#include <cstddef> #include <cstddef>
namespace glm namespace glm
@ -35,7 +33,7 @@ namespace glm
typename detail::storage<4, T, detail::is_aligned<Q>::value>::type data; typename detail::storage<4, T, detail::is_aligned<Q>::value>::type data;
# if GLM_SWIZZLE == GLM_ENABLE # if GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR
GLM_SWIZZLE4_2_MEMBERS(T, Q, x, y, z, w) GLM_SWIZZLE4_2_MEMBERS(T, Q, x, y, z, w)
GLM_SWIZZLE4_2_MEMBERS(T, Q, r, g, b, a) GLM_SWIZZLE4_2_MEMBERS(T, Q, r, g, b, a)
GLM_SWIZZLE4_2_MEMBERS(T, Q, s, t, p, q) GLM_SWIZZLE4_2_MEMBERS(T, Q, s, t, p, q)
@ -45,7 +43,7 @@ namespace glm
GLM_SWIZZLE4_4_MEMBERS(T, Q, x, y, z, w) GLM_SWIZZLE4_4_MEMBERS(T, Q, x, y, z, w)
GLM_SWIZZLE4_4_MEMBERS(T, Q, r, g, b, a) GLM_SWIZZLE4_4_MEMBERS(T, Q, r, g, b, a)
GLM_SWIZZLE4_4_MEMBERS(T, Q, s, t, p, q) GLM_SWIZZLE4_4_MEMBERS(T, Q, s, t, p, q)
# endif//GLM_SWIZZLE # endif
}; };
# else # else
union { T x, r, s; }; union { T x, r, s; };
@ -53,9 +51,9 @@ namespace glm
union { T z, b, p; }; union { T z, b, p; };
union { T w, a, q; }; union { T w, a, q; };
# if GLM_SWIZZLE == GLM_ENABLE # if GLM_SWIZZLE == GLM_SWIZZLE_FUNCTION
GLM_SWIZZLE_GEN_VEC_FROM_VEC4(T, Q) GLM_SWIZZLE_GEN_VEC_FROM_VEC4(T, Q)
# endif//GLM_SWIZZLE # endif
# endif # endif
// -- Component accesses -- // -- Component accesses --
@ -175,7 +173,7 @@ namespace glm
GLM_FUNC_DECL GLM_CONSTEXPR_CXX11 GLM_EXPLICIT vec(vec<4, U, P> const& v); GLM_FUNC_DECL GLM_CONSTEXPR_CXX11 GLM_EXPLICIT vec(vec<4, U, P> const& v);
// -- Swizzle constructors -- // -- Swizzle constructors --
# if GLM_HAS_ANONYMOUS_STRUCT && GLM_SWIZZLE == GLM_ENABLE # if GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR
template<int E0, int E1, int E2, int E3> template<int E0, int E1, int E2, int E3>
GLM_FUNC_DECL vec(detail::_swizzle<4, T, Q, E0, E1, E2, E3> const& that) GLM_FUNC_DECL vec(detail::_swizzle<4, T, Q, E0, E1, E2, E3> const& that)
{ {
@ -217,7 +215,7 @@ namespace glm
{ {
*this = vec<4, T, Q>(x, v()); *this = vec<4, T, Q>(x, v());
} }
# endif//GLM_HAS_ANONYMOUS_STRUCT && GLM_SWIZZLE == GLM_ENABLE # endif//GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR
// -- Unary arithmetic operators -- // -- Unary arithmetic operators --

View File

@ -14,13 +14,11 @@
#include "../fwd.hpp" #include "../fwd.hpp"
#include "../detail/type_vec.hpp" #include "../detail/type_vec.hpp"
#if GLM_SWIZZLE == GLM_ENABLE #if GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR
# if GLM_HAS_ANONYMOUS_STRUCT # include "_swizzle.hpp"
# include "../detail/_swizzle.hpp" #elif GLM_SWIZZLE == GLM_SWIZZLE_FUNCTION
# else # include "_swizzle_func.hpp"
# include "../detail/_swizzle_func.hpp" #endif
# endif
#endif //GLM_SWIZZLE
#include <cstddef> #include <cstddef>
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
@ -52,7 +50,7 @@ namespace glm
typename detail::storage<1, T, detail::is_aligned<Q>::value>::type data; typename detail::storage<1, T, detail::is_aligned<Q>::value>::type data;
/* /*
# if GLM_SWIZZLE == GLM_ENABLE # if GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR
_GLM_SWIZZLE1_2_MEMBERS(T, Q, tvec2, x) _GLM_SWIZZLE1_2_MEMBERS(T, Q, tvec2, x)
_GLM_SWIZZLE1_2_MEMBERS(T, Q, tvec2, r) _GLM_SWIZZLE1_2_MEMBERS(T, Q, tvec2, r)
_GLM_SWIZZLE1_2_MEMBERS(T, Q, tvec2, s) _GLM_SWIZZLE1_2_MEMBERS(T, Q, tvec2, s)
@ -62,14 +60,16 @@ namespace glm
_GLM_SWIZZLE1_4_MEMBERS(T, Q, tvec4, x) _GLM_SWIZZLE1_4_MEMBERS(T, Q, tvec4, x)
_GLM_SWIZZLE1_4_MEMBERS(T, Q, tvec4, r) _GLM_SWIZZLE1_4_MEMBERS(T, Q, tvec4, r)
_GLM_SWIZZLE1_4_MEMBERS(T, Q, tvec4, s) _GLM_SWIZZLE1_4_MEMBERS(T, Q, tvec4, s)
# endif//GLM_SWIZZLE*/ # endif
*/
}; };
# else # else
union {T x, r, s;}; union {T x, r, s;};
/* /*
# if GLM_SWIZZLE == GLM_ENABLE # if GLM_SWIZZLE == GLM_SWIZZLE_FUNCTION
GLM_SWIZZLE_GEN_VEC_FROM_VEC1(T, Q, tvec2, tvec2, tvec3, tvec4) GLM_SWIZZLE_GEN_VEC_FROM_VEC1(T, Q, tvec2, tvec2, tvec3, tvec4)
# endif//GLM_SWIZZLE*/ # endif
*/
# endif # endif
// -- Component accesses -- // -- Component accesses --
@ -110,13 +110,13 @@ namespace glm
// -- Swizzle constructors -- // -- Swizzle constructors --
/* /*
# if GLM_HAS_ANONYMOUS_STRUCT && GLM_SWIZZLE == GLM_ENABLE # if GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR
template<int E0> template<int E0>
GLM_FUNC_DECL tvec(detail::_swizzle<1, T, Q, tvec1, E0, -1,-2,-3> const& that) GLM_FUNC_DECL tvec(detail::_swizzle<1, T, Q, tvec1, E0, -1,-2,-3> const& that)
{ {
*this = that(); *this = that();
} }
# endif//GLM_SWIZZLE == GLM_ENABLE # endif//GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR
*/ */
// -- Unary arithmetic operators -- // -- Unary arithmetic operators --

View File

@ -6,14 +6,39 @@ static int test_ivec2_swizzle()
{ {
int Error = 0; int Error = 0;
#if GLM_SWIZZLE == GLM_ENABLE # if GLM_SWIZZLE
glm::ivec2 A(1, 2); {
glm::ivec2 B = A.yx(); glm::ivec2 A(1, 2);
glm::ivec2 C = B.yx(); glm::ivec2 B = A.yx();
glm::ivec2 C = B.yx();
Error += A != B ? 0 : 1; Error += A != B ? 0 : 1;
Error += A == C ? 0 : 1; Error += A == C ? 0 : 1;
#endif//GLM_SWIZZLE == GLM_ENABLE }
# endif//GLM_SWIZZLE
# if GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR
{
glm::ivec2 A(1, 2);
glm::ivec2 B = A.yx;
glm::ivec2 C = A.yx;
Error += A != B ? 0 : 1;
Error += B == C ? 0 : 1;
B.xy = B.yx;
C.xy = C.yx;
Error += B == C ? 0 : 1;
glm::ivec2 D(0, 0);
D.yx = A.xy;
Error += A.yx() == D ? 0 : 1;
glm::ivec2 E = A.yx;
Error += E == D ? 0 : 1;
}
# endif//GLM_SWIZZLE
return Error; return Error;
} }
@ -22,14 +47,43 @@ int test_ivec3_swizzle()
{ {
int Error = 0; int Error = 0;
#if GLM_SWIZZLE == GLM_ENABLE # if GLM_SWIZZLE == GLM_ENABLE
glm::ivec3 A(1, 2, 3); {
glm::ivec3 B = A.zyx(); glm::ivec3 A(1, 2, 3);
glm::ivec3 C = B.zyx(); glm::ivec3 B = A.zyx();
glm::ivec3 C = B.zyx();
Error += A != B ? 0 : 1; Error += A != B ? 0 : 1;
Error += A == C ? 0 : 1; Error += A == C ? 0 : 1;
#endif//GLM_SWIZZLE == GLM_ENABLE }
# endif//GLM_SWIZZLE == GLM_ENABLE
# if GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR
{
glm::ivec3 A(1, 2, 3);
glm::ivec2 B = A.yx;
glm::ivec2 C = A.yx;
Error += A.yx() == B ? 0 : 1;
Error += B == C ? 0 : 1;
B.xy = B.yx;
C.xy = C.yx;
Error += B == C ? 0 : 1;
glm::ivec2 D(0, 0);
D.yx = A.xy;
Error += A.yx() == D ? 0 : 1;
glm::ivec2 E(0, 0);
E.xy = A.xy();
Error += E == A.xy() ? 0 : 1;
Error += E.xy() == A.xy() ? 0 : 1;
}
# endif//GLM_SWIZZLE
return Error; return Error;
} }