Enabled swizzle operator by default, removed GLM_SWIZZLE and add GLM_SWIZZLE_RELAX for Visual C++ lang extension implementation.

master
Christophe Riccio ago%!(EXTRA string=12 years)
parent 5d66caa7da
commit 1d9e6dc95c
  1. 5
      glm/core/type_vec2.hpp
  2. 5
      glm/core/type_vec3.hpp
  3. 5
      glm/core/type_vec4.hpp
  4. 1
      test/core/core_func_swizzle.cpp
  5. 1
      test/core/core_type_vec1.cpp
  6. 1
      test/core/core_type_vec2.cpp
  7. 1
      test/core/core_type_vec3.cpp
  8. 5
      test/core/core_type_vec4.cpp

@ -56,7 +56,7 @@ namespace detail
////////////////////////////////////// //////////////////////////////////////
// Data // Data
# if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE)) # if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE_RELAX))
union union
{ {
struct{ T x, y; }; struct{ T x, y; };
@ -77,10 +77,7 @@ namespace detail
union {T x, r, s;}; union {T x, r, s;};
union {T y, g, t;}; union {T y, g, t;};
# if(defined(GLM_SWIZZLE))
//GLM_SWIZZLE_GEN_REF_FROM_VEC2(T, P, detail::tvec2, detail::tref2)
GLM_SWIZZLE_GEN_VEC_FROM_VEC2(T, P, detail::tvec2, detail::tvec2, detail::tvec3, detail::tvec4) GLM_SWIZZLE_GEN_VEC_FROM_VEC2(T, P, detail::tvec2, detail::tvec2, detail::tvec3, detail::tvec4)
# endif//(defined(GLM_SWIZZLE))
# endif//GLM_LANG # endif//GLM_LANG
////////////////////////////////////// //////////////////////////////////////

@ -56,7 +56,7 @@ namespace detail
////////////////////////////////////// //////////////////////////////////////
// Data // Data
# if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE)) # if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE_RELAX))
union union
{ {
struct{ T x, y, z; }; struct{ T x, y, z; };
@ -78,10 +78,7 @@ namespace detail
union { T y, g, t; }; union { T y, g, t; };
union { T z, b, p; }; union { T z, b, p; };
# if(defined(GLM_SWIZZLE))
//GLM_SWIZZLE_GEN_REF_FROM_VEC3(T, P, detail::tvec3, detail::tref2, detail::tref3)
GLM_SWIZZLE_GEN_VEC_FROM_VEC3(T, P, detail::tvec3, detail::tvec2, detail::tvec3, detail::tvec4) GLM_SWIZZLE_GEN_VEC_FROM_VEC3(T, P, detail::tvec3, detail::tvec2, detail::tvec3, detail::tvec4)
# endif//(defined(GLM_SWIZZLE))
# endif//GLM_LANG # endif//GLM_LANG
////////////////////////////////////// //////////////////////////////////////

@ -56,7 +56,7 @@ namespace detail
////////////////////////////////////// //////////////////////////////////////
// Data // Data
# if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE)) # if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE_RELAX))
union union
{ {
struct { T r, g, b, a; }; struct { T r, g, b, a; };
@ -79,10 +79,7 @@ namespace detail
union { T z, b, p; }; union { T z, b, p; };
union { T w, a, q; }; union { T w, a, q; };
# if(defined(GLM_SWIZZLE))
//GLM_SWIZZLE_GEN_REF_FROM_VEC4(T, P, detail::tvec4, detail::tref2, detail::tref3, detail::tref4)
GLM_SWIZZLE_GEN_VEC_FROM_VEC4(T, P, detail::tvec4, detail::tvec2, detail::tvec3, detail::tvec4) GLM_SWIZZLE_GEN_VEC_FROM_VEC4(T, P, detail::tvec4, detail::tvec2, detail::tvec3, detail::tvec4)
# endif//(defined(GLM_SWIZZLE))
# endif//GLM_LANG # endif//GLM_LANG
////////////////////////////////////// //////////////////////////////////////

@ -8,7 +8,6 @@
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_MESSAGES #define GLM_MESSAGES
#define GLM_SWIZZLE
#include <glm/glm.hpp> #include <glm/glm.hpp>
int test_ivec2_swizzle() int test_ivec2_swizzle()

@ -7,7 +7,6 @@
// File : test/core/type_vec1.cpp // File : test/core/type_vec1.cpp
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_SWIZZLE
#include <glm/glm.hpp> #include <glm/glm.hpp>
#include <glm/gtx/vec1.hpp> #include <glm/gtx/vec1.hpp>

@ -7,7 +7,6 @@
// File : test/core/type_vec2.cpp // File : test/core/type_vec2.cpp
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_SWIZZLE
#include <glm/glm.hpp> #include <glm/glm.hpp>
int test_vec2_operators() int test_vec2_operators()

@ -7,7 +7,6 @@
// File : test/core/type_vec3.cpp // File : test/core/type_vec3.cpp
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_SWIZZLE
#include <glm/glm.hpp> #include <glm/glm.hpp>
#include <cstdio> #include <cstdio>
#include <vector> #include <vector>

@ -7,7 +7,6 @@
// File : test/core/type_vec4.cpp // File : test/core/type_vec4.cpp
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_SWIZZLE
#include <glm/glm.hpp> #include <glm/glm.hpp>
#include <vector> #include <vector>
@ -216,7 +215,7 @@ int test_vec4_swizzle_partial()
glm::vec4 A(1, 2, 3, 4); glm::vec4 A(1, 2, 3, 4);
# if((GLM_LANG & GLM_LANG_CXXMS_FLAG) && defined(GLM_SWIZZLE)) # if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE_RELAX))
{ {
glm::vec4 B(A.xy, A.zw); glm::vec4 B(A.xy, A.zw);
Error += A == B ? 0 : 1; Error += A == B ? 0 : 1;
@ -242,7 +241,7 @@ int test_vec4_swizzle_partial()
glm::vec4 B(1.0f, A.yzw); glm::vec4 B(1.0f, A.yzw);
Error += A == B ? 0 : 1; Error += A == B ? 0 : 1;
} }
# endif//GLM_LANG # endif
return Error; return Error;
} }

Loading…
Cancel
Save