From 5df08dfc78659eed4ba75bafc6b30ad9660e0b7c Mon Sep 17 00:00:00 2001 From: Jesse Talavera-Greenberg Date: Mon, 5 Oct 2015 18:25:01 -0400 Subject: [PATCH] Wrap tvec4's static constants in GLM_STATIC_CONST_MEMBERS - Fix the indentation, too --- glm/detail/type_vec4.hpp | 3 ++ glm/detail/type_vec4.inl | 98 ++++++++++++++++++------------------ test/core/core_type_vec4.cpp | 1 + 3 files changed, 54 insertions(+), 48 deletions(-) diff --git a/glm/detail/type_vec4.hpp b/glm/detail/type_vec4.hpp index 4d9b352c..489ef6f8 100644 --- a/glm/detail/type_vec4.hpp +++ b/glm/detail/type_vec4.hpp @@ -112,6 +112,7 @@ namespace detail 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; @@ -128,6 +129,8 @@ namespace detail static const type XZW; static const type YZW; static const type XYZW; +# endif + // -- Data -- # if GLM_HAS_ANONYMOUS_UNION && GLM_NOT_BUGGY_VC32BITS diff --git a/glm/detail/type_vec4.inl b/glm/detail/type_vec4.inl index ee663a0c..0189c2ce 100644 --- a/glm/detail/type_vec4.inl +++ b/glm/detail/type_vec4.inl @@ -32,70 +32,72 @@ namespace glm { -template -const tvec4 tvec4::ZERO = - tvec4(static_cast(0), static_cast(0), static_cast(0), static_cast(0)); -template -const tvec4 tvec4::X = - tvec4(static_cast(1), static_cast(0), static_cast(0), static_cast(0)); +# ifdef GLM_STATIC_CONST_MEMBERS + template + const tvec4 tvec4::ZERO = + tvec4(static_cast(0), static_cast(0), static_cast(0), static_cast(0)); -template -const tvec4 tvec4::Y = - tvec4(static_cast(0), static_cast(1), static_cast(0), static_cast(0)); + template + const tvec4 tvec4::X = + tvec4(static_cast(1), static_cast(0), static_cast(0), static_cast(0)); -template -const tvec4 tvec4::Z = - tvec4(static_cast(0), static_cast(0), static_cast(1), static_cast(0)); + template + const tvec4 tvec4::Y = + tvec4(static_cast(0), static_cast(1), static_cast(0), static_cast(0)); -template -const tvec4 tvec4::W = - tvec4(static_cast(0), static_cast(0), static_cast(0), static_cast(1)); + template + const tvec4 tvec4::Z = + tvec4(static_cast(0), static_cast(0), static_cast(1), static_cast(0)); -template -const tvec4 tvec4::XY = - tvec4(static_cast(1), static_cast(1), static_cast(0), static_cast(0)); + template + const tvec4 tvec4::W = + tvec4(static_cast(0), static_cast(0), static_cast(0), static_cast(1)); -template -const tvec4 tvec4::XZ = - tvec4(static_cast(1), static_cast(0), static_cast(1), static_cast(0)); + template + const tvec4 tvec4::XY = + tvec4(static_cast(1), static_cast(1), static_cast(0), static_cast(0)); -template -const tvec4 tvec4::XW = - tvec4(static_cast(1), static_cast(0), static_cast(0), static_cast(1)); + template + const tvec4 tvec4::XZ = + tvec4(static_cast(1), static_cast(0), static_cast(1), static_cast(0)); -template -const tvec4 tvec4::YZ = - tvec4(static_cast(0), static_cast(1), static_cast(1), static_cast(0)); + template + const tvec4 tvec4::XW = + tvec4(static_cast(1), static_cast(0), static_cast(0), static_cast(1)); -template -const tvec4 tvec4::YW = - tvec4(static_cast(0), static_cast(1), static_cast(0), static_cast(1)); + template + const tvec4 tvec4::YZ = + tvec4(static_cast(0), static_cast(1), static_cast(1), static_cast(0)); -template -const tvec4 tvec4::ZW = - tvec4(static_cast(0), static_cast(0), static_cast(1), static_cast(1)); + template + const tvec4 tvec4::YW = + tvec4(static_cast(0), static_cast(1), static_cast(0), static_cast(1)); -template -const tvec4 tvec4::XYZ = - tvec4(static_cast(1), static_cast(1), static_cast(1), static_cast(0)); + template + const tvec4 tvec4::ZW = + tvec4(static_cast(0), static_cast(0), static_cast(1), static_cast(1)); -template -const tvec4 tvec4::XYW = - tvec4(static_cast(1), static_cast(1), static_cast(0), static_cast(1)); + template + const tvec4 tvec4::XYZ = + tvec4(static_cast(1), static_cast(1), static_cast(1), static_cast(0)); -template -const tvec4 tvec4::XZW = - tvec4(static_cast(1), static_cast(0), static_cast(1), static_cast(1)); + template + const tvec4 tvec4::XYW = + tvec4(static_cast(1), static_cast(1), static_cast(0), static_cast(1)); -template -const tvec4 tvec4::YZW = - tvec4(static_cast(0), static_cast(1), static_cast(1), static_cast(1)); + template + const tvec4 tvec4::XZW = + tvec4(static_cast(1), static_cast(0), static_cast(1), static_cast(1)); -template -const tvec4 tvec4::XYZW = - tvec4(static_cast(1), static_cast(1), static_cast(1), static_cast(1)); + template + const tvec4 tvec4::YZW = + tvec4(static_cast(0), static_cast(1), static_cast(1), static_cast(1)); + template + const tvec4 tvec4::XYZW = + tvec4(static_cast(1), static_cast(1), static_cast(1), static_cast(1)); +# endif // -- Implicit basic constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) diff --git a/test/core/core_type_vec4.cpp b/test/core/core_type_vec4.cpp index 00b77db6..5c48eccd 100644 --- a/test/core/core_type_vec4.cpp +++ b/test/core/core_type_vec4.cpp @@ -33,6 +33,7 @@ # define GLM_META_PROG_HELPERS #endif #define GLM_SWIZZLE +#define GLM_STATIC_CONST_MEMBERS #include #include #include