From b8ff59a61bde65ffd88f39820619bb0b422df2a6 Mon Sep 17 00:00:00 2001 From: Jesse Talavera-Greenberg Date: Fri, 2 Oct 2015 18:32:39 -0400 Subject: [PATCH 01/16] Add static constants for vec1 - Tests, too --- glm/detail/type_vec1.hpp | 2 ++ glm/detail/type_vec1.inl | 5 +++++ test/core/core_type_vec1.cpp | 13 +++++++++++++ 3 files changed, 20 insertions(+) diff --git a/glm/detail/type_vec1.hpp b/glm/detail/type_vec1.hpp index 943290bb..11783c4b 100644 --- a/glm/detail/type_vec1.hpp +++ b/glm/detail/type_vec1.hpp @@ -59,6 +59,8 @@ namespace glm static GLM_RELAXED_CONSTEXPR precision prec = P; # endif//GLM_META_PROG_HELPERS + static const type ZERO; + static const type X; // -- Data -- # if GLM_HAS_ANONYMOUS_UNION diff --git a/glm/detail/type_vec1.inl b/glm/detail/type_vec1.inl index 39485782..5a6c4d7a 100644 --- a/glm/detail/type_vec1.inl +++ b/glm/detail/type_vec1.inl @@ -32,6 +32,11 @@ namespace glm { + template + const tvec1 tvec1::X = tvec1(static_cast(1)); + + template + const tvec1 tvec1::ZERO = tvec1(static_cast(0)); // -- Implicit basic constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) diff --git a/test/core/core_type_vec1.cpp b/test/core/core_type_vec1.cpp index 711a16a6..3a51be94 100644 --- a/test/core/core_type_vec1.cpp +++ b/test/core/core_type_vec1.cpp @@ -166,6 +166,18 @@ int test_vec1_operator_increment() return Error; } +int test_vec1_static_const() { + int Error = 0; + + Error += (glm::vec1(1.0f) == glm::vec1::X) ? 0 : 1; + Error += (glm::ivec1(1) == glm::ivec1::X) ? 0 : 1; + Error += (glm::dvec1(1.0) == glm::dvec1::X) ? 0 : 1; + Error += (glm::bvec1(false) == glm::bvec1::ZERO) ? 0 : 1; + Error += (glm::uvec1(0) == glm::uvec1::ZERO) ? 0 : 1; + + return Error; +} + int main() { int Error = 0; @@ -178,6 +190,7 @@ int main() assert(glm::vec1::components == 1); # endif + Error += test_vec1_static_const(); Error += test_vec1_size(); Error += test_vec1_ctor(); Error += test_vec1_operators(); From b42a46d246f4efda22c895a4a5878d89b82579d7 Mon Sep 17 00:00:00 2001 From: Jesse Talavera-Greenberg Date: Fri, 2 Oct 2015 18:33:14 -0400 Subject: [PATCH 02/16] Add static constants for vec2 - Tests, too --- glm/detail/type_vec2.hpp | 4 ++++ glm/detail/type_vec2.inl | 11 +++++++++++ test/core/core_type_vec2.cpp | 12 ++++++++++++ 3 files changed, 27 insertions(+) diff --git a/glm/detail/type_vec2.hpp b/glm/detail/type_vec2.hpp index 521e8ccc..762229b3 100644 --- a/glm/detail/type_vec2.hpp +++ b/glm/detail/type_vec2.hpp @@ -58,6 +58,10 @@ namespace glm static GLM_RELAXED_CONSTEXPR precision prec = P; # endif//GLM_META_PROG_HELPERS + static const type ZERO; + static const type X; + static const type Y; + static const type XY; // -- Data -- # if GLM_HAS_ANONYMOUS_UNION diff --git a/glm/detail/type_vec2.inl b/glm/detail/type_vec2.inl index 39d0549e..db95c67a 100644 --- a/glm/detail/type_vec2.inl +++ b/glm/detail/type_vec2.inl @@ -28,6 +28,17 @@ namespace glm { + template + const tvec2 tvec2::ZERO = tvec2(static_cast(0), static_cast(0)); + + template + const tvec2 tvec2::X = tvec2(static_cast(1), static_cast(0)); + + template + const tvec2 tvec2::Y = tvec2(static_cast(0), static_cast(1)); + + template + const tvec2 tvec2::XY = tvec2(static_cast(1), static_cast(1)); // -- Implicit basic constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) diff --git a/test/core/core_type_vec2.cpp b/test/core/core_type_vec2.cpp index 69b5957e..9f2e8d14 100644 --- a/test/core/core_type_vec2.cpp +++ b/test/core/core_type_vec2.cpp @@ -331,6 +331,17 @@ int test_operator_increment() return Error; } +int test_vec2_static_const() { + int Error(0); + + Error += (glm::ivec2(0, 0) == glm::ivec2::ZERO) ? 0 : 1; + Error += (glm::vec2(1, 0) == glm::vec2::X) ? 0 : 1; + Error += (glm::bvec2(false, true) == glm::bvec2::Y) ? 0 : 1; + Error += (glm::dvec2(1, 1) == glm::dvec2::XY) ? 0 : 1; + + return Error; +} + int main() { int Error = 0; @@ -343,6 +354,7 @@ int main() assert(glm::vec2::components == 2); # endif + Error += test_vec2_static_const(); Error += test_vec2_size(); Error += test_vec2_ctor(); Error += test_vec2_operators(); From 25bd7014b0041c872df4ca9a279cdb7933af83c3 Mon Sep 17 00:00:00 2001 From: Jesse Talavera-Greenberg Date: Fri, 2 Oct 2015 18:34:17 -0400 Subject: [PATCH 03/16] Add static constants for vec3 - Tests, too --- glm/detail/type_vec3.hpp | 9 +++++++++ glm/detail/type_vec3.inl | 24 ++++++++++++++++++++++++ test/core/core_type_vec3.cpp | 16 ++++++++++++++++ 3 files changed, 49 insertions(+) diff --git a/glm/detail/type_vec3.hpp b/glm/detail/type_vec3.hpp index 98dd74f8..5e497459 100644 --- a/glm/detail/type_vec3.hpp +++ b/glm/detail/type_vec3.hpp @@ -58,6 +58,15 @@ namespace glm static GLM_RELAXED_CONSTEXPR precision prec = P; # endif//GLM_META_PROG_HELPERS + static const type ZERO; + static const type X; + static const type Y; + static const type Z; + static const type XY; + static const type XZ; + static const type YZ; + static const type XYZ; + // -- Data -- # if GLM_HAS_ANONYMOUS_UNION diff --git a/glm/detail/type_vec3.inl b/glm/detail/type_vec3.inl index 1e5081d4..51fbf23c 100644 --- a/glm/detail/type_vec3.inl +++ b/glm/detail/type_vec3.inl @@ -32,6 +32,30 @@ namespace glm { +template +const tvec3 tvec3::ZERO = tvec3(static_cast(0), static_cast(0), static_cast(0)); + +template +const tvec3 tvec3::X = tvec3(static_cast(1), static_cast(0), static_cast(0)); + +template +const tvec3 tvec3::Y = tvec3(static_cast(0), static_cast(1), static_cast(0)); + +template +const tvec3 tvec3::Z = tvec3(static_cast(0), static_cast(0), static_cast(1)); + +template +const tvec3 tvec3::XY = tvec3(static_cast(1), static_cast(1), static_cast(0)); + +template +const tvec3 tvec3::XZ = tvec3(static_cast(1), static_cast(0), static_cast(1)); + +template +const tvec3 tvec3::YZ = tvec3(static_cast(0), static_cast(1), static_cast(1)); + +template +const tvec3 tvec3::XYZ = tvec3(static_cast(1), static_cast(1), static_cast(1)); + // -- Implicit basic constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) diff --git a/test/core/core_type_vec3.cpp b/test/core/core_type_vec3.cpp index 727e90d7..46e3f2d7 100644 --- a/test/core/core_type_vec3.cpp +++ b/test/core/core_type_vec3.cpp @@ -493,6 +493,21 @@ int test_operator_increment() return Error; } +int test_vec3_static_const() { + int Error(0); + + Error += (glm::ivec3(0, 0, 0) == glm::ivec3::ZERO) ? 0 : 1; + Error += (glm::vec3(1, 0, 0) == glm::vec3::X) ? 0 : 1; + Error += (glm::bvec3(false, true, false) == glm::bvec3::Y) ? 0 : 1; + Error += (glm::bvec3(false, false, true) == glm::bvec3::Z) ? 0 : 1; + Error += (glm::dvec3(1, 1, 0) == glm::dvec3::XY) ? 0 : 1; + Error += (glm::vec3(1, 0, 1) == glm::vec3::XZ) ? 0 : 1; + Error += (glm::uvec3(0u, 1u, 1u) == glm::uvec3::YZ) ? 0 : 1; + Error += (glm::dvec3(1, 1, 1) == glm::dvec3::XYZ) ? 0 : 1; + + return Error; +} + int main() { int Error = 0; @@ -505,6 +520,7 @@ int main() assert(glm::vec3::components == 3); # endif + Error += test_vec3_static_const(); Error += test_vec3_ctor(); Error += test_vec3_operators(); Error += test_vec3_size(); From 02b011651b43ba8e710b5f5cdf23f47d63587a3b Mon Sep 17 00:00:00 2001 From: Jesse Talavera-Greenberg Date: Fri, 2 Oct 2015 18:34:53 -0400 Subject: [PATCH 04/16] Add static constants to vec4 - Tests, too --- glm/detail/type_vec4.hpp | 16 +++++++++ glm/detail/type_vec4.inl | 64 ++++++++++++++++++++++++++++++++++++ test/core/core_type_vec4.cpp | 23 +++++++++++++ 3 files changed, 103 insertions(+) diff --git a/glm/detail/type_vec4.hpp b/glm/detail/type_vec4.hpp index 2d110c31..4d9b352c 100644 --- a/glm/detail/type_vec4.hpp +++ b/glm/detail/type_vec4.hpp @@ -112,6 +112,22 @@ namespace detail static GLM_RELAXED_CONSTEXPR precision prec = P; # endif//GLM_META_PROG_HELPERS + static const type ZERO; + 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; // -- 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 80c75945..ee663a0c 100644 --- a/glm/detail/type_vec4.inl +++ b/glm/detail/type_vec4.inl @@ -32,6 +32,70 @@ 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)); + +template +const tvec4 tvec4::Y = + tvec4(static_cast(0), static_cast(1), 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::W = + tvec4(static_cast(0), static_cast(0), static_cast(0), static_cast(1)); + +template +const tvec4 tvec4::XY = + tvec4(static_cast(1), static_cast(1), static_cast(0), static_cast(0)); + +template +const tvec4 tvec4::XZ = + tvec4(static_cast(1), static_cast(0), 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::YZ = + tvec4(static_cast(0), static_cast(1), static_cast(1), static_cast(0)); + +template +const tvec4 tvec4::YW = + tvec4(static_cast(0), static_cast(1), static_cast(0), static_cast(1)); + +template +const tvec4 tvec4::ZW = + tvec4(static_cast(0), static_cast(0), static_cast(1), 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::XYW = + tvec4(static_cast(1), static_cast(1), static_cast(0), 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::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)); + // -- 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 cc72ddaa..00b77db6 100644 --- a/test/core/core_type_vec4.cpp +++ b/test/core/core_type_vec4.cpp @@ -376,6 +376,28 @@ int test_operator_increment() return Error; } +int test_vec4_static_const() { + int Error(0); + + Error += (glm::ivec4(0, 0, 0, 0) == glm::ivec4::ZERO) ? 0 : 1; + Error += (glm::vec4(1, 0, 0, 0) == glm::vec4::X) ? 0 : 1; + Error += (glm::bvec4(false, true, false, false) == glm::bvec4::Y) ? 0 : 1; + Error += (glm::bvec4(false, false, true, false) == glm::bvec4::Z) ? 0 : 1; + Error += (glm::uvec4(0u, 0u, 0u, 1u) == glm::uvec4::W) ? 0 : 1; + Error += (glm::dvec4(1, 1, 0, 0) == glm::dvec4::XY) ? 0 : 1; + Error += (glm::vec4(1, 0, 1, 0) == glm::vec4::XZ) ? 0 : 1; + Error += (glm::vec4(1, 0, 0, 1) == glm::vec4::XW) ? 0 : 1; + Error += (glm::uvec4(0u, 1u, 1u, 0u) == glm::uvec4::YZ) ? 0 : 1; + Error += (glm::vec4(0, 1, 0, 1) == glm::vec4::YW) ? 0 : 1; + Error += (glm::dvec4(1, 1, 1, 0) == glm::dvec4::XYZ) ? 0 : 1; + Error += (glm::vec4(1, 1, 0, 1) == glm::vec4::XYW) ? 0 : 1; + Error += (glm::vec4(1, 0, 1, 1) == glm::vec4::XZW) ? 0 : 1; + Error += (glm::vec4(0, 1, 1, 1) == glm::vec4::YZW) ? 0 : 1; + Error += (glm::vec4(1, 1, 1, 1) == glm::vec4::XYZW) ? 0 : 1; + + return Error; +} + struct AoS { glm::vec4 A; @@ -486,6 +508,7 @@ int main() Error += test_vec4_perf_SoA(Size); # endif//NDEBUG + Error += test_vec4_static_const(); Error += test_vec4_ctor(); Error += test_vec4_size(); Error += test_vec4_operators(); From a92ed0cdf54737c5c6d4c516249a8452997b49c7 Mon Sep 17 00:00:00 2001 From: Jesse Talavera-Greenberg Date: Fri, 2 Oct 2015 18:36:27 -0400 Subject: [PATCH 05/16] Add static constants to quat, simdVec4, and simdQuat - No tests, though --- glm/gtc/quaternion.hpp | 17 ++++++++++++ glm/gtc/quaternion.inl | 63 ++++++++++++++++++++++++++++++++++++++++++ glm/gtx/simd_quat.hpp | 17 ++++++++++++ glm/gtx/simd_quat.inl | 17 ++++++++++++ glm/gtx/simd_vec4.hpp | 17 ++++++++++++ glm/gtx/simd_vec4.inl | 17 ++++++++++++ 6 files changed, 148 insertions(+) diff --git a/glm/gtc/quaternion.hpp b/glm/gtc/quaternion.hpp index 25df0f22..40c910d8 100644 --- a/glm/gtc/quaternion.hpp +++ b/glm/gtc/quaternion.hpp @@ -76,6 +76,23 @@ namespace glm T x, y, z, w; + static const type ZERO; + 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; + // -- Component accesses -- # ifdef GLM_FORCE_SIZE_FUNC diff --git a/glm/gtc/quaternion.inl b/glm/gtc/quaternion.inl index 4c8565bc..8d846cba 100644 --- a/glm/gtc/quaternion.inl +++ b/glm/gtc/quaternion.inl @@ -49,6 +49,69 @@ namespace detail }; }//namespace detail +template +const tquat tquat::ZERO = + tquat(static_cast(0), static_cast(0), static_cast(0), static_cast(0)); + +template +const tquat tquat::X = + tquat(static_cast(0), static_cast(1), static_cast(0), static_cast(0)); + +template +const tquat tquat::Y = + tquat(static_cast(0), static_cast(0), static_cast(1), static_cast(0)); + +template +const tquat tquat::Z = + tquat(static_cast(0), static_cast(0), static_cast(0), static_cast(1)); + +template +const tquat tquat::W = + tquat(static_cast(1), static_cast(0), static_cast(0), static_cast(0)); + +template +const tquat tquat::XY = + tquat(static_cast(0), static_cast(1), static_cast(1), static_cast(0)); + +template +const tquat tquat::XZ = + tquat(static_cast(0), static_cast(0), static_cast(1), static_cast(1)); + +template +const tquat tquat::XW = + tquat(static_cast(1), static_cast(1), static_cast(0), static_cast(0)); + +template +const tquat tquat::YZ = + tquat(static_cast(0), static_cast(0), static_cast(1), static_cast(1)); + +template +const tquat tquat::YW = + tquat(static_cast(1), static_cast(0), static_cast(1), static_cast(0)); + +template +const tquat tquat::ZW = + tquat(static_cast(1), static_cast(0), static_cast(0), static_cast(1)); + +template +const tquat tquat::XYZ = + tquat(static_cast(0), static_cast(1), static_cast(1), static_cast(1)); + +template +const tquat tquat::XYW = + tquat(static_cast(1), static_cast(1), static_cast(1), static_cast(0)); + +template +const tquat tquat::XZW = + tquat(static_cast(1), static_cast(1), static_cast(0), static_cast(1)); + +template +const tquat tquat::YZW = + tquat(static_cast(1), static_cast(0), static_cast(1), static_cast(1)); + +template +const tquat tquat::XYZW = + tquat(static_cast(1), static_cast(1), static_cast(1), static_cast(1)); // -- Component accesses -- # ifdef GLM_FORCE_SIZE_FUNC diff --git a/glm/gtx/simd_quat.hpp b/glm/gtx/simd_quat.hpp index 97075ba6..ca9ae2c2 100644 --- a/glm/gtx/simd_quat.hpp +++ b/glm/gtx/simd_quat.hpp @@ -91,6 +91,23 @@ namespace detail __m128 Data; #endif + static const type ZERO; + 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; + ////////////////////////////////////// // Implicit basic constructors diff --git a/glm/gtx/simd_quat.inl b/glm/gtx/simd_quat.inl index 2fcc7fe4..95d73037 100644 --- a/glm/gtx/simd_quat.inl +++ b/glm/gtx/simd_quat.inl @@ -51,6 +51,23 @@ void print(const fvec4SIMD &v) } #endif +const fquatSIMD fquatSIMD::ZERO = fquatSIMD(0, 0, 0, 0); +const fquatSIMD fquatSIMD::X = fquatSIMD(0, 1, 0, 0); +const fquatSIMD fquatSIMD::Y = fquatSIMD(0, 0, 1, 0); +const fquatSIMD fquatSIMD::Z = fquatSIMD(0, 0, 0, 1); +const fquatSIMD fquatSIMD::W = fquatSIMD(1, 0, 0, 0); +const fquatSIMD fquatSIMD::XY = fquatSIMD(0, 1, 1, 0); +const fquatSIMD fquatSIMD::XZ = fquatSIMD(0, 1, 0, 1); +const fquatSIMD fquatSIMD::XW = fquatSIMD(1, 1, 0, 0); +const fquatSIMD fquatSIMD::YZ = fquatSIMD(0, 0, 1, 1); +const fquatSIMD fquatSIMD::YW = fquatSIMD(1, 0, 1, 0); +const fquatSIMD fquatSIMD::ZW = fquatSIMD(1, 0, 0, 1); +const fquatSIMD fquatSIMD::XYZ = fquatSIMD(0, 1, 1, 1); +const fquatSIMD fquatSIMD::XYW = fquatSIMD(1, 1, 1, 0); +const fquatSIMD fquatSIMD::XZW = fquatSIMD(1, 1, 0, 1); +const fquatSIMD fquatSIMD::YZW = fquatSIMD(1, 0, 1, 1); +const fquatSIMD fquatSIMD::XYZW = fquatSIMD(1, 1, 1, 1); + ////////////////////////////////////// // Implicit basic constructors diff --git a/glm/gtx/simd_vec4.hpp b/glm/gtx/simd_vec4.hpp index cb084852..0eb44fa4 100644 --- a/glm/gtx/simd_vec4.hpp +++ b/glm/gtx/simd_vec4.hpp @@ -114,6 +114,23 @@ namespace detail __m128 Data; #endif + static const type ZERO; + 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; + ////////////////////////////////////// // Implicit basic constructors diff --git a/glm/gtx/simd_vec4.inl b/glm/gtx/simd_vec4.inl index e375073f..3ff7d47e 100644 --- a/glm/gtx/simd_vec4.inl +++ b/glm/gtx/simd_vec4.inl @@ -16,6 +16,23 @@ struct shuffle_mask enum{value = Value}; }; +const fvec4SIMD fvec4SIMD::ZERO = fvec4SIMD(0, 0, 0, 0); +const fvec4SIMD fvec4SIMD::X = fvec4SIMD(1, 0, 0, 0); +const fvec4SIMD fvec4SIMD::Y = fvec4SIMD(0, 1, 0, 0); +const fvec4SIMD fvec4SIMD::Z = fvec4SIMD(0, 0, 1, 0); +const fvec4SIMD fvec4SIMD::W = fvec4SIMD(0, 0, 0, 1); +const fvec4SIMD fvec4SIMD::XY = fvec4SIMD(1, 1, 0, 0); +const fvec4SIMD fvec4SIMD::XZ = fvec4SIMD(1, 0, 1, 0); +const fvec4SIMD fvec4SIMD::XW = fvec4SIMD(1, 0, 0, 1); +const fvec4SIMD fvec4SIMD::YZ = fvec4SIMD(0, 1, 1, 0); +const fvec4SIMD fvec4SIMD::YW = fvec4SIMD(0, 1, 0, 1); +const fvec4SIMD fvec4SIMD::ZW = fvec4SIMD(0, 0, 1, 1); +const fvec4SIMD fvec4SIMD::XYZ = fvec4SIMD(1, 1, 1, 0); +const fvec4SIMD fvec4SIMD::XYW = fvec4SIMD(1, 1, 0, 1); +const fvec4SIMD fvec4SIMD::XZW = fvec4SIMD(1, 0, 1, 1); +const fvec4SIMD fvec4SIMD::YZW = fvec4SIMD(0, 1, 1, 1); +const fvec4SIMD fvec4SIMD::XYZW = fvec4SIMD(1, 1, 1, 1); + ////////////////////////////////////// // Implicit basic constructors From 5a60b3986b2a5a9fb735d404b386f416920a5ac6 Mon Sep 17 00:00:00 2001 From: Jesse Talavera-Greenberg Date: Mon, 5 Oct 2015 18:22:43 -0400 Subject: [PATCH 06/16] Wrap tvec1's static constants in GLM_STATIC_CONST_MEMBERS --- glm/detail/type_vec1.hpp | 2 ++ glm/detail/type_vec1.inl | 2 ++ test/core/core_type_vec1.cpp | 1 + 3 files changed, 5 insertions(+) diff --git a/glm/detail/type_vec1.hpp b/glm/detail/type_vec1.hpp index 11783c4b..f59e1c96 100644 --- a/glm/detail/type_vec1.hpp +++ b/glm/detail/type_vec1.hpp @@ -59,8 +59,10 @@ namespace glm 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; +# endif // -- Data -- # if GLM_HAS_ANONYMOUS_UNION diff --git a/glm/detail/type_vec1.inl b/glm/detail/type_vec1.inl index 5a6c4d7a..5dfc2556 100644 --- a/glm/detail/type_vec1.inl +++ b/glm/detail/type_vec1.inl @@ -32,11 +32,13 @@ namespace glm { +# ifdef GLM_STATIC_CONST_MEMBERS template const tvec1 tvec1::X = tvec1(static_cast(1)); template const tvec1 tvec1::ZERO = tvec1(static_cast(0)); +# endif // -- Implicit basic constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) diff --git a/test/core/core_type_vec1.cpp b/test/core/core_type_vec1.cpp index 3a51be94..32c23670 100644 --- a/test/core/core_type_vec1.cpp +++ b/test/core/core_type_vec1.cpp @@ -32,6 +32,7 @@ #if !(GLM_COMPILER & GLM_COMPILER_GCC) # define GLM_META_PROG_HELPERS #endif +#define GLM_STATIC_CONST_MEMBERS #define GLM_SWIZZLE #include #include From 4552ec737e2c155b6d9c225bdf3b97ab03a67785 Mon Sep 17 00:00:00 2001 From: Jesse Talavera-Greenberg Date: Mon, 5 Oct 2015 18:23:18 -0400 Subject: [PATCH 07/16] Wrap tvec2's static constants in GLM_STATIC_CONST_MEMBERS --- glm/detail/type_vec2.hpp | 3 +++ glm/detail/type_vec2.inl | 2 ++ test/core/core_type_vec2.cpp | 2 ++ 3 files changed, 7 insertions(+) diff --git a/glm/detail/type_vec2.hpp b/glm/detail/type_vec2.hpp index 762229b3..ddd45564 100644 --- a/glm/detail/type_vec2.hpp +++ b/glm/detail/type_vec2.hpp @@ -58,10 +58,13 @@ namespace glm 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; static const type XY; +# endif + // -- Data -- # if GLM_HAS_ANONYMOUS_UNION diff --git a/glm/detail/type_vec2.inl b/glm/detail/type_vec2.inl index db95c67a..f3bc76fa 100644 --- a/glm/detail/type_vec2.inl +++ b/glm/detail/type_vec2.inl @@ -28,6 +28,7 @@ namespace glm { +# ifdef GLM_STATIC_CONST_MEMBERS template const tvec2 tvec2::ZERO = tvec2(static_cast(0), static_cast(0)); @@ -39,6 +40,7 @@ namespace glm template const tvec2 tvec2::XY = tvec2(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_vec2.cpp b/test/core/core_type_vec2.cpp index 9f2e8d14..11065ea1 100644 --- a/test/core/core_type_vec2.cpp +++ b/test/core/core_type_vec2.cpp @@ -29,6 +29,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// +#define GLM_STATIC_CONST_MEMBERS #if !(GLM_COMPILER & GLM_COMPILER_GCC) # define GLM_META_PROG_HELPERS #endif @@ -40,6 +41,7 @@ # include #endif + int test_vec2_operators() { int Error = 0; From 8be318970c3995fc1507b3d72ed545b100fa0eb1 Mon Sep 17 00:00:00 2001 From: Jesse Talavera-Greenberg Date: Mon, 5 Oct 2015 18:24:31 -0400 Subject: [PATCH 08/16] Wrap tvec3's static constants in GLM_STATIC_CONST_MEMBERS - Fixed the indentation, too --- glm/detail/type_vec3.hpp | 2 ++ glm/detail/type_vec3.inl | 34 ++++++++++++++++++---------------- test/core/core_type_vec3.cpp | 1 + 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/glm/detail/type_vec3.hpp b/glm/detail/type_vec3.hpp index 5e497459..d08b7c29 100644 --- a/glm/detail/type_vec3.hpp +++ b/glm/detail/type_vec3.hpp @@ -58,6 +58,7 @@ namespace glm 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; @@ -66,6 +67,7 @@ namespace glm static const type XZ; static const type YZ; static const type XYZ; +# endif // -- Data -- diff --git a/glm/detail/type_vec3.inl b/glm/detail/type_vec3.inl index 51fbf23c..1db51ffb 100644 --- a/glm/detail/type_vec3.inl +++ b/glm/detail/type_vec3.inl @@ -32,30 +32,32 @@ namespace glm { -template -const tvec3 tvec3::ZERO = tvec3(static_cast(0), static_cast(0), static_cast(0)); -template -const tvec3 tvec3::X = tvec3(static_cast(1), static_cast(0), static_cast(0)); +# ifdef GLM_STATIC_CONST_MEMBERS + template + const tvec3 tvec3::ZERO = tvec3(static_cast(0), static_cast(0), static_cast(0)); -template -const tvec3 tvec3::Y = tvec3(static_cast(0), static_cast(1), static_cast(0)); + template + const tvec3 tvec3::X = tvec3(static_cast(1), static_cast(0), static_cast(0)); -template -const tvec3 tvec3::Z = tvec3(static_cast(0), static_cast(0), static_cast(1)); + template + const tvec3 tvec3::Y = tvec3(static_cast(0), static_cast(1), static_cast(0)); -template -const tvec3 tvec3::XY = tvec3(static_cast(1), static_cast(1), static_cast(0)); + template + const tvec3 tvec3::Z = tvec3(static_cast(0), static_cast(0), static_cast(1)); -template -const tvec3 tvec3::XZ = tvec3(static_cast(1), static_cast(0), static_cast(1)); + template + const tvec3 tvec3::XY = tvec3(static_cast(1), static_cast(1), static_cast(0)); -template -const tvec3 tvec3::YZ = tvec3(static_cast(0), static_cast(1), static_cast(1)); + template + const tvec3 tvec3::XZ = tvec3(static_cast(1), static_cast(0), static_cast(1)); -template -const tvec3 tvec3::XYZ = tvec3(static_cast(1), static_cast(1), static_cast(1)); + template + const tvec3 tvec3::YZ = tvec3(static_cast(0), static_cast(1), static_cast(1)); + template + const tvec3 tvec3::XYZ = tvec3(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_vec3.cpp b/test/core/core_type_vec3.cpp index 46e3f2d7..8b0c8d09 100644 --- a/test/core/core_type_vec3.cpp +++ b/test/core/core_type_vec3.cpp @@ -33,6 +33,7 @@ # define GLM_META_PROG_HELPERS #endif #define GLM_SWIZZLE +#define GLM_STATIC_CONST_MEMBERS #include #include #include From 5df08dfc78659eed4ba75bafc6b30ad9660e0b7c Mon Sep 17 00:00:00 2001 From: Jesse Talavera-Greenberg Date: Mon, 5 Oct 2015 18:25:01 -0400 Subject: [PATCH 09/16] 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 From d1cdb46cfbebb5f9313935cf3b5ef862f80d483f Mon Sep 17 00:00:00 2001 From: Jesse Talavera-Greenberg Date: Mon, 5 Oct 2015 18:27:07 -0400 Subject: [PATCH 10/16] Wrap tquat's, simdQuat's and simdVec4's static constants in GLM_STATIC_CONST_MEMBERS - Also, fixed indentation --- glm/gtc/quaternion.hpp | 2 + glm/gtc/quaternion.inl | 98 +++++++++++++++++++------------------- glm/gtx/simd_quat.hpp | 2 + glm/gtx/simd_quat.inl | 35 +++++++------- glm/gtx/simd_vec4.hpp | 2 + glm/gtx/simd_vec4.inl | 34 ++++++------- test/gtx/gtx_simd_vec4.cpp | 2 + 7 files changed, 94 insertions(+), 81 deletions(-) diff --git a/glm/gtc/quaternion.hpp b/glm/gtc/quaternion.hpp index 40c910d8..37df9a96 100644 --- a/glm/gtc/quaternion.hpp +++ b/glm/gtc/quaternion.hpp @@ -76,6 +76,7 @@ namespace glm T x, y, z, w; +# ifdef GLM_STATIC_CONST_MEMBERS static const type ZERO; static const type X; static const type Y; @@ -92,6 +93,7 @@ namespace glm static const type XZW; static const type YZW; static const type XYZW; +# endif // -- Component accesses -- diff --git a/glm/gtc/quaternion.inl b/glm/gtc/quaternion.inl index 8d846cba..a50f1f26 100644 --- a/glm/gtc/quaternion.inl +++ b/glm/gtc/quaternion.inl @@ -49,69 +49,71 @@ namespace detail }; }//namespace detail -template -const tquat tquat::ZERO = - tquat(static_cast(0), static_cast(0), static_cast(0), static_cast(0)); +# ifdef GLM_STATIC_CONST_MEMBERS + template + const tquat tquat::ZERO = + tquat(static_cast(0), static_cast(0), static_cast(0), static_cast(0)); -template -const tquat tquat::X = - tquat(static_cast(0), static_cast(1), static_cast(0), static_cast(0)); + template + const tquat tquat::X = + tquat(static_cast(0), static_cast(1), static_cast(0), static_cast(0)); -template -const tquat tquat::Y = - tquat(static_cast(0), static_cast(0), static_cast(1), static_cast(0)); + template + const tquat tquat::Y = + tquat(static_cast(0), static_cast(0), static_cast(1), static_cast(0)); -template -const tquat tquat::Z = - tquat(static_cast(0), static_cast(0), static_cast(0), static_cast(1)); + template + const tquat tquat::Z = + tquat(static_cast(0), static_cast(0), static_cast(0), static_cast(1)); -template -const tquat tquat::W = - tquat(static_cast(1), static_cast(0), static_cast(0), static_cast(0)); + template + const tquat tquat::W = + tquat(static_cast(1), static_cast(0), static_cast(0), static_cast(0)); -template -const tquat tquat::XY = - tquat(static_cast(0), static_cast(1), static_cast(1), static_cast(0)); + template + const tquat tquat::XY = + tquat(static_cast(0), static_cast(1), static_cast(1), static_cast(0)); -template -const tquat tquat::XZ = - tquat(static_cast(0), static_cast(0), static_cast(1), static_cast(1)); + template + const tquat tquat::XZ = + tquat(static_cast(0), static_cast(0), static_cast(1), static_cast(1)); -template -const tquat tquat::XW = - tquat(static_cast(1), static_cast(1), static_cast(0), static_cast(0)); + template + const tquat tquat::XW = + tquat(static_cast(1), static_cast(1), static_cast(0), static_cast(0)); -template -const tquat tquat::YZ = - tquat(static_cast(0), static_cast(0), static_cast(1), static_cast(1)); + template + const tquat tquat::YZ = + tquat(static_cast(0), static_cast(0), static_cast(1), static_cast(1)); -template -const tquat tquat::YW = - tquat(static_cast(1), static_cast(0), static_cast(1), static_cast(0)); + template + const tquat tquat::YW = + tquat(static_cast(1), static_cast(0), static_cast(1), static_cast(0)); -template -const tquat tquat::ZW = - tquat(static_cast(1), static_cast(0), static_cast(0), static_cast(1)); + template + const tquat tquat::ZW = + tquat(static_cast(1), static_cast(0), static_cast(0), static_cast(1)); -template -const tquat tquat::XYZ = - tquat(static_cast(0), static_cast(1), static_cast(1), static_cast(1)); + template + const tquat tquat::XYZ = + tquat(static_cast(0), static_cast(1), static_cast(1), static_cast(1)); -template -const tquat tquat::XYW = - tquat(static_cast(1), static_cast(1), static_cast(1), static_cast(0)); + template + const tquat tquat::XYW = + tquat(static_cast(1), static_cast(1), static_cast(1), static_cast(0)); -template -const tquat tquat::XZW = - tquat(static_cast(1), static_cast(1), static_cast(0), static_cast(1)); + template + const tquat tquat::XZW = + tquat(static_cast(1), static_cast(1), static_cast(0), static_cast(1)); -template -const tquat tquat::YZW = - tquat(static_cast(1), static_cast(0), static_cast(1), static_cast(1)); + template + const tquat tquat::YZW = + tquat(static_cast(1), static_cast(0), static_cast(1), static_cast(1)); -template -const tquat tquat::XYZW = - tquat(static_cast(1), static_cast(1), static_cast(1), static_cast(1)); + template + const tquat tquat::XYZW = + tquat(static_cast(1), static_cast(1), static_cast(1), static_cast(1)); +# endif // -- Component accesses -- # ifdef GLM_FORCE_SIZE_FUNC diff --git a/glm/gtx/simd_quat.hpp b/glm/gtx/simd_quat.hpp index ca9ae2c2..00b32239 100644 --- a/glm/gtx/simd_quat.hpp +++ b/glm/gtx/simd_quat.hpp @@ -91,6 +91,7 @@ namespace detail __m128 Data; #endif +# ifdef GLM_STATIC_CONST_MEMBERS static const type ZERO; static const type X; static const type Y; @@ -107,6 +108,7 @@ namespace detail static const type XZW; static const type YZW; static const type XYZW; +# endif ////////////////////////////////////// // Implicit basic constructors diff --git a/glm/gtx/simd_quat.inl b/glm/gtx/simd_quat.inl index 95d73037..422f3c85 100644 --- a/glm/gtx/simd_quat.inl +++ b/glm/gtx/simd_quat.inl @@ -51,23 +51,24 @@ void print(const fvec4SIMD &v) } #endif -const fquatSIMD fquatSIMD::ZERO = fquatSIMD(0, 0, 0, 0); -const fquatSIMD fquatSIMD::X = fquatSIMD(0, 1, 0, 0); -const fquatSIMD fquatSIMD::Y = fquatSIMD(0, 0, 1, 0); -const fquatSIMD fquatSIMD::Z = fquatSIMD(0, 0, 0, 1); -const fquatSIMD fquatSIMD::W = fquatSIMD(1, 0, 0, 0); -const fquatSIMD fquatSIMD::XY = fquatSIMD(0, 1, 1, 0); -const fquatSIMD fquatSIMD::XZ = fquatSIMD(0, 1, 0, 1); -const fquatSIMD fquatSIMD::XW = fquatSIMD(1, 1, 0, 0); -const fquatSIMD fquatSIMD::YZ = fquatSIMD(0, 0, 1, 1); -const fquatSIMD fquatSIMD::YW = fquatSIMD(1, 0, 1, 0); -const fquatSIMD fquatSIMD::ZW = fquatSIMD(1, 0, 0, 1); -const fquatSIMD fquatSIMD::XYZ = fquatSIMD(0, 1, 1, 1); -const fquatSIMD fquatSIMD::XYW = fquatSIMD(1, 1, 1, 0); -const fquatSIMD fquatSIMD::XZW = fquatSIMD(1, 1, 0, 1); -const fquatSIMD fquatSIMD::YZW = fquatSIMD(1, 0, 1, 1); -const fquatSIMD fquatSIMD::XYZW = fquatSIMD(1, 1, 1, 1); - +# ifdef GLM_STATIC_CONST_MEMBERS + const fquatSIMD fquatSIMD::ZERO = fquatSIMD(0, 0, 0, 0); + const fquatSIMD fquatSIMD::X = fquatSIMD(0, 1, 0, 0); + const fquatSIMD fquatSIMD::Y = fquatSIMD(0, 0, 1, 0); + const fquatSIMD fquatSIMD::Z = fquatSIMD(0, 0, 0, 1); + const fquatSIMD fquatSIMD::W = fquatSIMD(1, 0, 0, 0); + const fquatSIMD fquatSIMD::XY = fquatSIMD(0, 1, 1, 0); + const fquatSIMD fquatSIMD::XZ = fquatSIMD(0, 1, 0, 1); + const fquatSIMD fquatSIMD::XW = fquatSIMD(1, 1, 0, 0); + const fquatSIMD fquatSIMD::YZ = fquatSIMD(0, 0, 1, 1); + const fquatSIMD fquatSIMD::YW = fquatSIMD(1, 0, 1, 0); + const fquatSIMD fquatSIMD::ZW = fquatSIMD(1, 0, 0, 1); + const fquatSIMD fquatSIMD::XYZ = fquatSIMD(0, 1, 1, 1); + const fquatSIMD fquatSIMD::XYW = fquatSIMD(1, 1, 1, 0); + const fquatSIMD fquatSIMD::XZW = fquatSIMD(1, 1, 0, 1); + const fquatSIMD fquatSIMD::YZW = fquatSIMD(1, 0, 1, 1); + const fquatSIMD fquatSIMD::XYZW = fquatSIMD(1, 1, 1, 1); +# endif ////////////////////////////////////// // Implicit basic constructors diff --git a/glm/gtx/simd_vec4.hpp b/glm/gtx/simd_vec4.hpp index 0eb44fa4..5f5a7e11 100644 --- a/glm/gtx/simd_vec4.hpp +++ b/glm/gtx/simd_vec4.hpp @@ -114,6 +114,7 @@ namespace detail __m128 Data; #endif +# ifdef GLM_STATIC_CONST_MEMBERS static const type ZERO; static const type X; static const type Y; @@ -130,6 +131,7 @@ namespace detail static const type XZW; static const type YZW; static const type XYZW; +# endif ////////////////////////////////////// // Implicit basic constructors diff --git a/glm/gtx/simd_vec4.inl b/glm/gtx/simd_vec4.inl index 3ff7d47e..ea327798 100644 --- a/glm/gtx/simd_vec4.inl +++ b/glm/gtx/simd_vec4.inl @@ -16,22 +16,24 @@ struct shuffle_mask enum{value = Value}; }; -const fvec4SIMD fvec4SIMD::ZERO = fvec4SIMD(0, 0, 0, 0); -const fvec4SIMD fvec4SIMD::X = fvec4SIMD(1, 0, 0, 0); -const fvec4SIMD fvec4SIMD::Y = fvec4SIMD(0, 1, 0, 0); -const fvec4SIMD fvec4SIMD::Z = fvec4SIMD(0, 0, 1, 0); -const fvec4SIMD fvec4SIMD::W = fvec4SIMD(0, 0, 0, 1); -const fvec4SIMD fvec4SIMD::XY = fvec4SIMD(1, 1, 0, 0); -const fvec4SIMD fvec4SIMD::XZ = fvec4SIMD(1, 0, 1, 0); -const fvec4SIMD fvec4SIMD::XW = fvec4SIMD(1, 0, 0, 1); -const fvec4SIMD fvec4SIMD::YZ = fvec4SIMD(0, 1, 1, 0); -const fvec4SIMD fvec4SIMD::YW = fvec4SIMD(0, 1, 0, 1); -const fvec4SIMD fvec4SIMD::ZW = fvec4SIMD(0, 0, 1, 1); -const fvec4SIMD fvec4SIMD::XYZ = fvec4SIMD(1, 1, 1, 0); -const fvec4SIMD fvec4SIMD::XYW = fvec4SIMD(1, 1, 0, 1); -const fvec4SIMD fvec4SIMD::XZW = fvec4SIMD(1, 0, 1, 1); -const fvec4SIMD fvec4SIMD::YZW = fvec4SIMD(0, 1, 1, 1); -const fvec4SIMD fvec4SIMD::XYZW = fvec4SIMD(1, 1, 1, 1); +# ifdef GLM_STATIC_CONST_MEMBERS + const fvec4SIMD fvec4SIMD::ZERO = fvec4SIMD(0, 0, 0, 0); + const fvec4SIMD fvec4SIMD::X = fvec4SIMD(1, 0, 0, 0); + const fvec4SIMD fvec4SIMD::Y = fvec4SIMD(0, 1, 0, 0); + const fvec4SIMD fvec4SIMD::Z = fvec4SIMD(0, 0, 1, 0); + const fvec4SIMD fvec4SIMD::W = fvec4SIMD(0, 0, 0, 1); + const fvec4SIMD fvec4SIMD::XY = fvec4SIMD(1, 1, 0, 0); + const fvec4SIMD fvec4SIMD::XZ = fvec4SIMD(1, 0, 1, 0); + const fvec4SIMD fvec4SIMD::XW = fvec4SIMD(1, 0, 0, 1); + const fvec4SIMD fvec4SIMD::YZ = fvec4SIMD(0, 1, 1, 0); + const fvec4SIMD fvec4SIMD::YW = fvec4SIMD(0, 1, 0, 1); + const fvec4SIMD fvec4SIMD::ZW = fvec4SIMD(0, 0, 1, 1); + const fvec4SIMD fvec4SIMD::XYZ = fvec4SIMD(1, 1, 1, 0); + const fvec4SIMD fvec4SIMD::XYW = fvec4SIMD(1, 1, 0, 1); + const fvec4SIMD fvec4SIMD::XZW = fvec4SIMD(1, 0, 1, 1); + const fvec4SIMD fvec4SIMD::YZW = fvec4SIMD(0, 1, 1, 1); + const fvec4SIMD fvec4SIMD::XYZW = fvec4SIMD(1, 1, 1, 1); +# endif ////////////////////////////////////// // Implicit basic constructors diff --git a/test/gtx/gtx_simd_vec4.cpp b/test/gtx/gtx_simd_vec4.cpp index b86eb272..e18a7e39 100644 --- a/test/gtx/gtx_simd_vec4.cpp +++ b/test/gtx/gtx_simd_vec4.cpp @@ -29,6 +29,8 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// +#define GLM_STATIC_CONST_MEMBERS + #include #include #include From 9604a7549fc664ba70b5b4e95e153df48e2403a3 Mon Sep 17 00:00:00 2001 From: Jesse Talavera-Greenberg Date: Mon, 5 Oct 2015 19:26:30 -0400 Subject: [PATCH 11/16] Add IDENTITY and ZERO constants for all matrices - Tests, too --- glm/detail/type_mat2x2.hpp | 4 ++++ glm/detail/type_mat2x2.inl | 7 +++++++ glm/detail/type_mat2x3.hpp | 5 +++++ glm/detail/type_mat2x3.inl | 7 +++++++ glm/detail/type_mat2x4.hpp | 5 +++++ glm/detail/type_mat2x4.inl | 7 +++++++ glm/detail/type_mat3x2.hpp | 5 +++++ glm/detail/type_mat3x2.inl | 7 +++++++ glm/detail/type_mat3x3.hpp | 5 +++++ glm/detail/type_mat3x3.inl | 8 ++++++++ glm/detail/type_mat3x4.hpp | 5 +++++ glm/detail/type_mat3x4.inl | 7 +++++++ glm/detail/type_mat4x2.hpp | 5 +++++ glm/detail/type_mat4x2.inl | 7 +++++++ glm/detail/type_mat4x3.hpp | 5 +++++ glm/detail/type_mat4x3.inl | 7 +++++++ glm/detail/type_mat4x4.hpp | 5 +++++ glm/detail/type_mat4x4.inl | 7 +++++++ test/core/core_type_mat2x2.cpp | 11 +++++++++++ test/core/core_type_mat2x3.cpp | 12 ++++++++++++ test/core/core_type_mat2x4.cpp | 11 +++++++++++ test/core/core_type_mat3x2.cpp | 12 ++++++++++++ test/core/core_type_mat3x3.cpp | 11 +++++++++++ test/core/core_type_mat3x4.cpp | 11 +++++++++++ test/core/core_type_mat4x2.cpp | 11 +++++++++++ test/core/core_type_mat4x3.cpp | 11 +++++++++++ test/core/core_type_mat4x4.cpp | 11 +++++++++++ 27 files changed, 209 insertions(+) diff --git a/glm/detail/type_mat2x2.hpp b/glm/detail/type_mat2x2.hpp index 13840689..78faf314 100644 --- a/glm/detail/type_mat2x2.hpp +++ b/glm/detail/type_mat2x2.hpp @@ -61,6 +61,10 @@ namespace glm static GLM_RELAXED_CONSTEXPR precision prec = P; # endif//GLM_META_PROG_HELPERS +# ifdef GLM_STATIC_CONST_MEMBERS + static const type ZERO; + static const type IDENTITY; +# endif private: col_type value[2]; diff --git a/glm/detail/type_mat2x2.inl b/glm/detail/type_mat2x2.inl index 202839f4..b7f09d7d 100644 --- a/glm/detail/type_mat2x2.inl +++ b/glm/detail/type_mat2x2.inl @@ -50,6 +50,13 @@ namespace detail } }//namespace detail +# ifdef GLM_STATIC_CONST_MEMBERS + template + const tmat2x2 tmat2x2::ZERO(static_cast(0)); + + template + const tmat2x2 tmat2x2::IDENTITY(static_cast(1)); +# endif // -- Constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) diff --git a/glm/detail/type_mat2x3.hpp b/glm/detail/type_mat2x3.hpp index 755c7cb9..0477c0f9 100644 --- a/glm/detail/type_mat2x3.hpp +++ b/glm/detail/type_mat2x3.hpp @@ -57,6 +57,11 @@ namespace glm static GLM_RELAXED_CONSTEXPR precision prec = P; # endif//GLM_META_PROG_HELPERS +# ifdef GLM_STATIC_CONST_MEMBERS + static const type ZERO; + static const type IDENTITY; +# endif + private: col_type value[2]; diff --git a/glm/detail/type_mat2x3.inl b/glm/detail/type_mat2x3.inl index 267f0c0c..23018c19 100644 --- a/glm/detail/type_mat2x3.inl +++ b/glm/detail/type_mat2x3.inl @@ -32,6 +32,13 @@ namespace glm { +# ifdef GLM_STATIC_CONST_MEMBERS + template + const tmat2x3 tmat2x3::ZERO(static_cast(0)); + + template + const tmat2x3 tmat2x3::IDENTITY(static_cast(1)); +# endif // -- Constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) diff --git a/glm/detail/type_mat2x4.hpp b/glm/detail/type_mat2x4.hpp index 4cba2cb8..36840f12 100644 --- a/glm/detail/type_mat2x4.hpp +++ b/glm/detail/type_mat2x4.hpp @@ -57,6 +57,11 @@ namespace glm static GLM_RELAXED_CONSTEXPR precision prec = P; # endif//GLM_META_PROG_HELPERS +# ifdef GLM_STATIC_CONST_MEMBERS + static const type ZERO; + static const type IDENTITY; +# endif + private: col_type value[2]; diff --git a/glm/detail/type_mat2x4.inl b/glm/detail/type_mat2x4.inl index 766640e4..ebb9170c 100644 --- a/glm/detail/type_mat2x4.inl +++ b/glm/detail/type_mat2x4.inl @@ -32,6 +32,13 @@ namespace glm { +# ifdef GLM_STATIC_CONST_MEMBERS + template + const tmat2x4 tmat2x4::ZERO(static_cast(0)); + + template + const tmat2x4 tmat2x4::IDENTITY(static_cast(1)); +# endif // -- Constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) diff --git a/glm/detail/type_mat3x2.hpp b/glm/detail/type_mat3x2.hpp index 52890f19..06549837 100644 --- a/glm/detail/type_mat3x2.hpp +++ b/glm/detail/type_mat3x2.hpp @@ -57,6 +57,11 @@ namespace glm static GLM_RELAXED_CONSTEXPR precision prec = P; # endif//GLM_META_PROG_HELPERS +# ifdef GLM_STATIC_CONST_MEMBERS + static const type ZERO; + static const type IDENTITY; +# endif + private: col_type value[3]; diff --git a/glm/detail/type_mat3x2.inl b/glm/detail/type_mat3x2.inl index d112a054..7e3ff4be 100644 --- a/glm/detail/type_mat3x2.inl +++ b/glm/detail/type_mat3x2.inl @@ -32,6 +32,13 @@ namespace glm { +# ifdef GLM_STATIC_CONST_MEMBERS + template + const tmat3x2 tmat3x2::ZERO(static_cast(0)); + + template + const tmat3x2 tmat3x2::IDENTITY(static_cast(1)); +# endif // -- Constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) diff --git a/glm/detail/type_mat3x3.hpp b/glm/detail/type_mat3x3.hpp index 58b2e7fe..4ef3708d 100644 --- a/glm/detail/type_mat3x3.hpp +++ b/glm/detail/type_mat3x3.hpp @@ -56,6 +56,11 @@ namespace glm static GLM_RELAXED_CONSTEXPR precision prec = P; # endif//GLM_META_PROG_HELPERS +# ifdef GLM_STATIC_CONST_MEMBERS + static const type ZERO; + static const type IDENTITY; +# endif + template friend tvec3 operator/(tmat3x3 const & m, tvec3 const & v); template diff --git a/glm/detail/type_mat3x3.inl b/glm/detail/type_mat3x3.inl index 6f936036..ec6f3eb6 100644 --- a/glm/detail/type_mat3x3.inl +++ b/glm/detail/type_mat3x3.inl @@ -56,6 +56,14 @@ namespace detail } }//namespace detail +# ifdef GLM_STATIC_CONST_MEMBERS + template + const tmat3x3 tmat3x3::ZERO(static_cast(0)); + + template + const tmat3x3 tmat3x3::IDENTITY(static_cast(1)); +# endif + // -- Constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) diff --git a/glm/detail/type_mat3x4.hpp b/glm/detail/type_mat3x4.hpp index 4bf6ab18..f9c7b908 100644 --- a/glm/detail/type_mat3x4.hpp +++ b/glm/detail/type_mat3x4.hpp @@ -57,6 +57,11 @@ namespace glm static GLM_RELAXED_CONSTEXPR precision prec = P; # endif//GLM_META_PROG_HELPERS +# ifdef GLM_STATIC_CONST_MEMBERS + static const type ZERO; + static const type IDENTITY; +# endif + private: col_type value[3]; diff --git a/glm/detail/type_mat3x4.inl b/glm/detail/type_mat3x4.inl index 8862df47..16ff84d3 100644 --- a/glm/detail/type_mat3x4.inl +++ b/glm/detail/type_mat3x4.inl @@ -32,6 +32,13 @@ namespace glm { +# ifdef GLM_STATIC_CONST_MEMBERS + template + const tmat3x4 tmat3x4::ZERO(static_cast(0)); + + template + const tmat3x4 tmat3x4::IDENTITY(static_cast(1)); +# endif // -- Constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) diff --git a/glm/detail/type_mat4x2.hpp b/glm/detail/type_mat4x2.hpp index 5c050e26..b3c27261 100644 --- a/glm/detail/type_mat4x2.hpp +++ b/glm/detail/type_mat4x2.hpp @@ -57,6 +57,11 @@ namespace glm static GLM_RELAXED_CONSTEXPR precision prec = P; # endif//GLM_META_PROG_HELPERS +# ifdef GLM_STATIC_CONST_MEMBERS + static const type ZERO; + static const type IDENTITY; +# endif + private: col_type value[4]; diff --git a/glm/detail/type_mat4x2.inl b/glm/detail/type_mat4x2.inl index d012b884..187b4579 100644 --- a/glm/detail/type_mat4x2.inl +++ b/glm/detail/type_mat4x2.inl @@ -32,6 +32,13 @@ namespace glm { +# ifdef GLM_STATIC_CONST_MEMBERS + template + const tmat4x2 tmat4x2::ZERO(static_cast(0)); + + template + const tmat4x2 tmat4x2::IDENTITY(static_cast(1)); +# endif // -- Constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) diff --git a/glm/detail/type_mat4x3.hpp b/glm/detail/type_mat4x3.hpp index 74b8364b..7a870a86 100644 --- a/glm/detail/type_mat4x3.hpp +++ b/glm/detail/type_mat4x3.hpp @@ -57,6 +57,11 @@ namespace glm static GLM_RELAXED_CONSTEXPR precision prec = P; # endif//GLM_META_PROG_HELPERS +# ifdef GLM_STATIC_CONST_MEMBERS + static const type ZERO; + static const type IDENTITY; +# endif + private: col_type value[4]; diff --git a/glm/detail/type_mat4x3.inl b/glm/detail/type_mat4x3.inl index e7368619..da76cdcc 100644 --- a/glm/detail/type_mat4x3.inl +++ b/glm/detail/type_mat4x3.inl @@ -32,6 +32,13 @@ namespace glm { +# ifdef GLM_STATIC_CONST_MEMBERS + template + const tmat4x3 tmat4x3::ZERO(static_cast(0)); + + template + const tmat4x3 tmat4x3::IDENTITY(static_cast(1)); +# endif // -- Constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) diff --git a/glm/detail/type_mat4x4.hpp b/glm/detail/type_mat4x4.hpp index e00b3ac3..fa585e5b 100644 --- a/glm/detail/type_mat4x4.hpp +++ b/glm/detail/type_mat4x4.hpp @@ -56,6 +56,11 @@ namespace glm static GLM_RELAXED_CONSTEXPR precision prec = P; # endif//GLM_META_PROG_HELPERS +# ifdef GLM_STATIC_CONST_MEMBERS + static const type ZERO; + static const type IDENTITY; +# endif + template friend tvec4 operator/(tmat4x4 const & m, tvec4 const & v); template diff --git a/glm/detail/type_mat4x4.inl b/glm/detail/type_mat4x4.inl index c075122b..1d463836 100644 --- a/glm/detail/type_mat4x4.inl +++ b/glm/detail/type_mat4x4.inl @@ -92,6 +92,13 @@ namespace detail } }//namespace detail +# ifdef GLM_STATIC_CONST_MEMBERS + template + const tmat4x4 tmat4x4::ZERO(static_cast(0)); + + template + const tmat4x4 tmat4x4::IDENTITY(static_cast(1)); +# endif // -- Constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) diff --git a/test/core/core_type_mat2x2.cpp b/test/core/core_type_mat2x2.cpp index a682640b..9e36e54d 100644 --- a/test/core/core_type_mat2x2.cpp +++ b/test/core/core_type_mat2x2.cpp @@ -29,6 +29,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// +#define GLM_STATIC_CONST_MEMBERS #include #include #include @@ -86,6 +87,15 @@ int test_inverse() return Error; } +int test_static_const() { + int Error(0); + + Error += glm::mat2x2(1) == glm::mat2x2::IDENTITY ? 0 : 1; + Error += glm::mat2x2(0) == glm::mat2x2::ZERO ? 0 : 1; + + return Error; +} + int test_ctr() { int Error(0); @@ -173,6 +183,7 @@ int main() #endif Error += cast::test(); + Error += test_static_const(); Error += test_ctr(); Error += test_operators(); Error += test_inverse(); diff --git a/test/core/core_type_mat2x3.cpp b/test/core/core_type_mat2x3.cpp index 59b06be0..34e2d9a8 100644 --- a/test/core/core_type_mat2x3.cpp +++ b/test/core/core_type_mat2x3.cpp @@ -29,6 +29,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// +#define GLM_STATIC_CONST_MEMBERS #include #include #include @@ -102,6 +103,16 @@ int test_ctr() return Error; } +int test_static_const() { + int Error(0); + + Error += glm::mat2x3(1) == glm::mat2x3::IDENTITY ? 0 : 1; + Error += glm::mat2x3(0) == glm::mat2x3::ZERO ? 0 : 1; + + return Error; +} + + namespace cast { template @@ -147,6 +158,7 @@ int main() #endif Error += cast::test(); + Error += test_static_const(); Error += test_ctr(); Error += test_operators(); diff --git a/test/core/core_type_mat2x4.cpp b/test/core/core_type_mat2x4.cpp index f6f706cf..9ad9a47c 100644 --- a/test/core/core_type_mat2x4.cpp +++ b/test/core/core_type_mat2x4.cpp @@ -29,6 +29,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// +#define GLM_STATIC_CONST_MEMBERS #include #include #include @@ -98,6 +99,15 @@ int test_ctr() }; #endif//GLM_HAS_INITIALIZER_LISTS + + return Error; +} + +int test_static_const() { + int Error(0); + + Error += glm::mat2x4(1) == glm::mat2x4::IDENTITY ? 0 : 1; + Error += glm::mat2x4(0) == glm::mat2x4::ZERO ? 0 : 1; return Error; } @@ -147,6 +157,7 @@ int main() #endif Error += cast::test(); + Error += test_static_const(); Error += test_ctr(); Error += test_operators(); diff --git a/test/core/core_type_mat3x2.cpp b/test/core/core_type_mat3x2.cpp index b6611d23..e68c2638 100644 --- a/test/core/core_type_mat3x2.cpp +++ b/test/core/core_type_mat3x2.cpp @@ -29,6 +29,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// +#define GLM_STATIC_CONST_MEMBERS #include #include #include @@ -106,6 +107,16 @@ int test_ctr() return Error; } +int test_static_const() { + int Error(0); + + Error += glm::mat3x2(1) == glm::mat3x2::IDENTITY ? 0 : 1; + Error += glm::mat3x2(0) == glm::mat3x2::ZERO ? 0 : 1; + + return Error; +} + + namespace cast { template @@ -152,6 +163,7 @@ int main() Error += cast::test(); Error += test_ctr(); + Error += test_static_const(); Error += test_operators(); return Error; diff --git a/test/core/core_type_mat3x3.cpp b/test/core/core_type_mat3x3.cpp index 89ec2be8..f9ece80f 100644 --- a/test/core/core_type_mat3x3.cpp +++ b/test/core/core_type_mat3x3.cpp @@ -29,6 +29,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// +#define GLM_STATIC_CONST_MEMBERS #include #include #include @@ -165,6 +166,15 @@ int test_ctr() return Error; } +int test_static_const() { + int Error(0); + + Error += glm::mat3x3(1) == glm::mat3x3::IDENTITY ? 0 : 1; + Error += glm::mat3x3(0) == glm::mat3x3::ZERO ? 0 : 1; + + return Error; +} + namespace cast { template @@ -210,6 +220,7 @@ int main() #endif Error += cast::test(); + Error += test_static_const(); Error += test_ctr(); Error += test_mat3x3(); Error += test_operators(); diff --git a/test/core/core_type_mat3x4.cpp b/test/core/core_type_mat3x4.cpp index a76bb21e..bde2e89d 100644 --- a/test/core/core_type_mat3x4.cpp +++ b/test/core/core_type_mat3x4.cpp @@ -29,6 +29,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// +#define GLM_STATIC_CONST_MEMBERS #include #include #include @@ -106,6 +107,15 @@ int test_ctr() return Error; } +int test_static_const() { + int Error(0); + + Error += glm::mat3x4(1) == glm::mat3x4::IDENTITY ? 0 : 1; + Error += glm::mat3x4(0) == glm::mat3x4::ZERO ? 0 : 1; + + return Error; +} + namespace cast { template @@ -151,6 +161,7 @@ int main() #endif Error += cast::test(); + Error += test_static_const(); Error += test_ctr(); Error += test_operators(); diff --git a/test/core/core_type_mat4x2.cpp b/test/core/core_type_mat4x2.cpp index 3b38e6d2..78cd9170 100644 --- a/test/core/core_type_mat4x2.cpp +++ b/test/core/core_type_mat4x2.cpp @@ -29,6 +29,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// +#define GLM_STATIC_CONST_MEMBERS #include #include #include @@ -110,6 +111,15 @@ int test_ctr() return Error; } +int test_static_const() { + int Error(0); + + Error += glm::mat4x2(1) == glm::mat4x2::IDENTITY ? 0 : 1; + Error += glm::mat4x2(0) == glm::mat4x2::ZERO ? 0 : 1; + + return Error; +} + namespace cast { template @@ -155,6 +165,7 @@ int main() #endif Error += cast::test(); + Error += test_static_const(); Error += test_ctr(); Error += test_operators(); diff --git a/test/core/core_type_mat4x3.cpp b/test/core/core_type_mat4x3.cpp index 8a7e0542..677fcf03 100644 --- a/test/core/core_type_mat4x3.cpp +++ b/test/core/core_type_mat4x3.cpp @@ -29,6 +29,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// +#define GLM_STATIC_CONST_MEMBERS #include #include #include @@ -110,6 +111,15 @@ int test_ctr() return Error; } +int test_static_const() { + int Error(0); + + Error += glm::mat4x3(1) == glm::mat4x3::IDENTITY ? 0 : 1; + Error += glm::mat4x3(0) == glm::mat4x3::ZERO ? 0 : 1; + + return Error; +} + namespace cast { template @@ -155,6 +165,7 @@ int main() #endif Error += cast::test(); + Error += test_static_const(); Error += test_ctr(); Error += test_operators(); diff --git a/test/core/core_type_mat4x4.cpp b/test/core/core_type_mat4x4.cpp index 6b7b36e3..f3fa5aaf 100644 --- a/test/core/core_type_mat4x4.cpp +++ b/test/core/core_type_mat4x4.cpp @@ -29,6 +29,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// +#define GLM_STATIC_CONST_MEMBERS #define GLM_SIMD #include #include @@ -283,6 +284,15 @@ int perf_mul() return Error; } +int test_static_const() { + int Error(0); + + Error += glm::mat4x4(1) == glm::mat4x4::IDENTITY ? 0 : 1; + Error += glm::mat4x4(0) == glm::mat4x4::ZERO ? 0 : 1; + + return Error; +} + namespace cast { template @@ -339,6 +349,7 @@ int main() Error += cast::test(); Error += test_ctr(); + Error += test_static_const(); Error += test_inverse_dmat4x4(); Error += test_inverse_mat4x4(); Error += test_operators(); From ef320a2a2fed4839c6251279e2960e3c1bb89b36 Mon Sep 17 00:00:00 2001 From: Jesse Talavera-Greenberg Date: Mon, 5 Oct 2015 19:30:16 -0400 Subject: [PATCH 12/16] Simplify the static const definitions for vectors and quaternions - DRY, baby! --- glm/detail/type_vec1.inl | 4 +-- glm/detail/type_vec2.inl | 8 ++--- glm/detail/type_vec3.inl | 16 +++++----- glm/detail/type_vec4.inl | 64 ++++++++++++++++++++-------------------- glm/gtc/quaternion.inl | 64 ++++++++++++++++++++-------------------- glm/gtx/simd_quat.inl | 32 ++++++++++---------- glm/gtx/simd_vec4.inl | 32 ++++++++++---------- 7 files changed, 110 insertions(+), 110 deletions(-) diff --git a/glm/detail/type_vec1.inl b/glm/detail/type_vec1.inl index 5dfc2556..0da79982 100644 --- a/glm/detail/type_vec1.inl +++ b/glm/detail/type_vec1.inl @@ -34,10 +34,10 @@ namespace glm { # ifdef GLM_STATIC_CONST_MEMBERS template - const tvec1 tvec1::X = tvec1(static_cast(1)); + const tvec1 tvec1::X(static_cast(1)); template - const tvec1 tvec1::ZERO = tvec1(static_cast(0)); + const tvec1 tvec1::ZERO(static_cast(0)); # endif // -- Implicit basic constructors -- diff --git a/glm/detail/type_vec2.inl b/glm/detail/type_vec2.inl index f3bc76fa..1bcaf772 100644 --- a/glm/detail/type_vec2.inl +++ b/glm/detail/type_vec2.inl @@ -30,16 +30,16 @@ namespace glm { # ifdef GLM_STATIC_CONST_MEMBERS template - const tvec2 tvec2::ZERO = tvec2(static_cast(0), static_cast(0)); + const tvec2 tvec2::ZERO(static_cast(0), static_cast(0)); template - const tvec2 tvec2::X = tvec2(static_cast(1), static_cast(0)); + const tvec2 tvec2::X(static_cast(1), static_cast(0)); template - const tvec2 tvec2::Y = tvec2(static_cast(0), static_cast(1)); + const tvec2 tvec2::Y(static_cast(0), static_cast(1)); template - const tvec2 tvec2::XY = tvec2(static_cast(1), static_cast(1)); + const tvec2 tvec2::XY(static_cast(1), static_cast(1)); # endif // -- Implicit basic constructors -- diff --git a/glm/detail/type_vec3.inl b/glm/detail/type_vec3.inl index 1db51ffb..f231a682 100644 --- a/glm/detail/type_vec3.inl +++ b/glm/detail/type_vec3.inl @@ -35,28 +35,28 @@ namespace glm # ifdef GLM_STATIC_CONST_MEMBERS template - const tvec3 tvec3::ZERO = tvec3(static_cast(0), static_cast(0), static_cast(0)); + const tvec3 tvec3::ZERO(static_cast(0), static_cast(0), static_cast(0)); template - const tvec3 tvec3::X = tvec3(static_cast(1), static_cast(0), static_cast(0)); + const tvec3 tvec3::X(static_cast(1), static_cast(0), static_cast(0)); template - const tvec3 tvec3::Y = tvec3(static_cast(0), static_cast(1), static_cast(0)); + const tvec3 tvec3::Y(static_cast(0), static_cast(1), static_cast(0)); template - const tvec3 tvec3::Z = tvec3(static_cast(0), static_cast(0), static_cast(1)); + const tvec3 tvec3::Z(static_cast(0), static_cast(0), static_cast(1)); template - const tvec3 tvec3::XY = tvec3(static_cast(1), static_cast(1), static_cast(0)); + const tvec3 tvec3::XY(static_cast(1), static_cast(1), static_cast(0)); template - const tvec3 tvec3::XZ = tvec3(static_cast(1), static_cast(0), static_cast(1)); + const tvec3 tvec3::XZ(static_cast(1), static_cast(0), static_cast(1)); template - const tvec3 tvec3::YZ = tvec3(static_cast(0), static_cast(1), static_cast(1)); + const tvec3 tvec3::YZ(static_cast(0), static_cast(1), static_cast(1)); template - const tvec3 tvec3::XYZ = tvec3(static_cast(1), static_cast(1), static_cast(1)); + const tvec3 tvec3::XYZ(static_cast(1), static_cast(1), static_cast(1)); # endif // -- Implicit basic constructors -- diff --git a/glm/detail/type_vec4.inl b/glm/detail/type_vec4.inl index 0189c2ce..23b8c8b3 100644 --- a/glm/detail/type_vec4.inl +++ b/glm/detail/type_vec4.inl @@ -35,68 +35,68 @@ namespace glm # ifdef GLM_STATIC_CONST_MEMBERS template - const tvec4 tvec4::ZERO = - tvec4(static_cast(0), static_cast(0), static_cast(0), static_cast(0)); + const tvec4 tvec4::ZERO + (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)); + const tvec4 tvec4::X + (static_cast(1), 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)); + const tvec4 tvec4::Y + (static_cast(0), static_cast(1), static_cast(0), static_cast(0)); template - const tvec4 tvec4::Z = - tvec4(static_cast(0), static_cast(0), static_cast(1), static_cast(0)); + const tvec4 tvec4::Z + (static_cast(0), static_cast(0), static_cast(1), static_cast(0)); template - const tvec4 tvec4::W = - tvec4(static_cast(0), static_cast(0), static_cast(0), static_cast(1)); + const tvec4 tvec4::W + (static_cast(0), static_cast(0), static_cast(0), static_cast(1)); template - const tvec4 tvec4::XY = - tvec4(static_cast(1), static_cast(1), static_cast(0), static_cast(0)); + const tvec4 tvec4::XY + (static_cast(1), static_cast(1), static_cast(0), static_cast(0)); template - const tvec4 tvec4::XZ = - tvec4(static_cast(1), static_cast(0), static_cast(1), static_cast(0)); + const tvec4 tvec4::XZ + (static_cast(1), static_cast(0), static_cast(1), static_cast(0)); template - const tvec4 tvec4::XW = - tvec4(static_cast(1), static_cast(0), static_cast(0), static_cast(1)); + const tvec4 tvec4::XW + (static_cast(1), static_cast(0), static_cast(0), static_cast(1)); template - const tvec4 tvec4::YZ = - tvec4(static_cast(0), static_cast(1), static_cast(1), static_cast(0)); + const tvec4 tvec4::YZ + (static_cast(0), static_cast(1), static_cast(1), static_cast(0)); template - const tvec4 tvec4::YW = - tvec4(static_cast(0), static_cast(1), static_cast(0), static_cast(1)); + const tvec4 tvec4::YW + (static_cast(0), static_cast(1), static_cast(0), static_cast(1)); template - const tvec4 tvec4::ZW = - tvec4(static_cast(0), static_cast(0), static_cast(1), static_cast(1)); + const tvec4 tvec4::ZW + (static_cast(0), static_cast(0), static_cast(1), static_cast(1)); template - const tvec4 tvec4::XYZ = - tvec4(static_cast(1), static_cast(1), static_cast(1), static_cast(0)); + const tvec4 tvec4::XYZ + (static_cast(1), static_cast(1), static_cast(1), static_cast(0)); template - const tvec4 tvec4::XYW = - tvec4(static_cast(1), static_cast(1), static_cast(0), static_cast(1)); + const tvec4 tvec4::XYW + (static_cast(1), static_cast(1), static_cast(0), static_cast(1)); template - const tvec4 tvec4::XZW = - tvec4(static_cast(1), static_cast(0), static_cast(1), static_cast(1)); + const tvec4 tvec4::XZW + (static_cast(1), static_cast(0), static_cast(1), static_cast(1)); template - const tvec4 tvec4::YZW = - tvec4(static_cast(0), static_cast(1), static_cast(1), static_cast(1)); + const tvec4 tvec4::YZW + (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)); + const tvec4 tvec4::XYZW + (static_cast(1), static_cast(1), static_cast(1), static_cast(1)); # endif // -- Implicit basic constructors -- diff --git a/glm/gtc/quaternion.inl b/glm/gtc/quaternion.inl index a50f1f26..a6ea6432 100644 --- a/glm/gtc/quaternion.inl +++ b/glm/gtc/quaternion.inl @@ -51,68 +51,68 @@ namespace detail # ifdef GLM_STATIC_CONST_MEMBERS template - const tquat tquat::ZERO = - tquat(static_cast(0), static_cast(0), static_cast(0), static_cast(0)); + const tquat tquat::ZERO + (static_cast(0), static_cast(0), static_cast(0), static_cast(0)); template - const tquat tquat::X = - tquat(static_cast(0), static_cast(1), static_cast(0), static_cast(0)); + const tquat tquat::X + (static_cast(0), static_cast(1), static_cast(0), static_cast(0)); template - const tquat tquat::Y = - tquat(static_cast(0), static_cast(0), static_cast(1), static_cast(0)); + const tquat tquat::Y + (static_cast(0), static_cast(0), static_cast(1), static_cast(0)); template - const tquat tquat::Z = - tquat(static_cast(0), static_cast(0), static_cast(0), static_cast(1)); + const tquat tquat::Z + (static_cast(0), static_cast(0), static_cast(0), static_cast(1)); template - const tquat tquat::W = - tquat(static_cast(1), static_cast(0), static_cast(0), static_cast(0)); + const tquat tquat::W + (static_cast(1), static_cast(0), static_cast(0), static_cast(0)); template - const tquat tquat::XY = - tquat(static_cast(0), static_cast(1), static_cast(1), static_cast(0)); + const tquat tquat::XY + (static_cast(0), static_cast(1), static_cast(1), static_cast(0)); template - const tquat tquat::XZ = - tquat(static_cast(0), static_cast(0), static_cast(1), static_cast(1)); + const tquat tquat::XZ + (static_cast(0), static_cast(0), static_cast(1), static_cast(1)); template - const tquat tquat::XW = - tquat(static_cast(1), static_cast(1), static_cast(0), static_cast(0)); + const tquat tquat::XW + (static_cast(1), static_cast(1), static_cast(0), static_cast(0)); template - const tquat tquat::YZ = - tquat(static_cast(0), static_cast(0), static_cast(1), static_cast(1)); + const tquat tquat::YZ + (static_cast(0), static_cast(0), static_cast(1), static_cast(1)); template - const tquat tquat::YW = - tquat(static_cast(1), static_cast(0), static_cast(1), static_cast(0)); + const tquat tquat::YW + (static_cast(1), static_cast(0), static_cast(1), static_cast(0)); template - const tquat tquat::ZW = - tquat(static_cast(1), static_cast(0), static_cast(0), static_cast(1)); + const tquat tquat::ZW + (static_cast(1), static_cast(0), static_cast(0), static_cast(1)); template - const tquat tquat::XYZ = - tquat(static_cast(0), static_cast(1), static_cast(1), static_cast(1)); + const tquat tquat::XYZ + (static_cast(0), static_cast(1), static_cast(1), static_cast(1)); template - const tquat tquat::XYW = - tquat(static_cast(1), static_cast(1), static_cast(1), static_cast(0)); + const tquat tquat::XYW + (static_cast(1), static_cast(1), static_cast(1), static_cast(0)); template - const tquat tquat::XZW = - tquat(static_cast(1), static_cast(1), static_cast(0), static_cast(1)); + const tquat tquat::XZW + (static_cast(1), static_cast(1), static_cast(0), static_cast(1)); template - const tquat tquat::YZW = - tquat(static_cast(1), static_cast(0), static_cast(1), static_cast(1)); + const tquat tquat::YZW + (static_cast(1), static_cast(0), static_cast(1), static_cast(1)); template - const tquat tquat::XYZW = - tquat(static_cast(1), static_cast(1), static_cast(1), static_cast(1)); + const tquat tquat::XYZW + (static_cast(1), static_cast(1), static_cast(1), static_cast(1)); # endif // -- Component accesses -- diff --git a/glm/gtx/simd_quat.inl b/glm/gtx/simd_quat.inl index 422f3c85..dfa5b3c1 100644 --- a/glm/gtx/simd_quat.inl +++ b/glm/gtx/simd_quat.inl @@ -52,22 +52,22 @@ void print(const fvec4SIMD &v) #endif # ifdef GLM_STATIC_CONST_MEMBERS - const fquatSIMD fquatSIMD::ZERO = fquatSIMD(0, 0, 0, 0); - const fquatSIMD fquatSIMD::X = fquatSIMD(0, 1, 0, 0); - const fquatSIMD fquatSIMD::Y = fquatSIMD(0, 0, 1, 0); - const fquatSIMD fquatSIMD::Z = fquatSIMD(0, 0, 0, 1); - const fquatSIMD fquatSIMD::W = fquatSIMD(1, 0, 0, 0); - const fquatSIMD fquatSIMD::XY = fquatSIMD(0, 1, 1, 0); - const fquatSIMD fquatSIMD::XZ = fquatSIMD(0, 1, 0, 1); - const fquatSIMD fquatSIMD::XW = fquatSIMD(1, 1, 0, 0); - const fquatSIMD fquatSIMD::YZ = fquatSIMD(0, 0, 1, 1); - const fquatSIMD fquatSIMD::YW = fquatSIMD(1, 0, 1, 0); - const fquatSIMD fquatSIMD::ZW = fquatSIMD(1, 0, 0, 1); - const fquatSIMD fquatSIMD::XYZ = fquatSIMD(0, 1, 1, 1); - const fquatSIMD fquatSIMD::XYW = fquatSIMD(1, 1, 1, 0); - const fquatSIMD fquatSIMD::XZW = fquatSIMD(1, 1, 0, 1); - const fquatSIMD fquatSIMD::YZW = fquatSIMD(1, 0, 1, 1); - const fquatSIMD fquatSIMD::XYZW = fquatSIMD(1, 1, 1, 1); + const fquatSIMD fquatSIMD::ZERO(0, 0, 0, 0); + const fquatSIMD fquatSIMD::X(0, 1, 0, 0); + const fquatSIMD fquatSIMD::Y(0, 0, 1, 0); + const fquatSIMD fquatSIMD::Z(0, 0, 0, 1); + const fquatSIMD fquatSIMD::W(1, 0, 0, 0); + const fquatSIMD fquatSIMD::XY(0, 1, 1, 0); + const fquatSIMD fquatSIMD::XZ(0, 1, 0, 1); + const fquatSIMD fquatSIMD::XW(1, 1, 0, 0); + const fquatSIMD fquatSIMD::YZ(0, 0, 1, 1); + const fquatSIMD fquatSIMD::YW(1, 0, 1, 0); + const fquatSIMD fquatSIMD::ZW(1, 0, 0, 1); + const fquatSIMD fquatSIMD::XYZ(0, 1, 1, 1); + const fquatSIMD fquatSIMD::XYW(1, 1, 1, 0); + const fquatSIMD fquatSIMD::XZW(1, 1, 0, 1); + const fquatSIMD fquatSIMD::YZW(1, 0, 1, 1); + const fquatSIMD fquatSIMD::XYZW(1, 1, 1, 1); # endif ////////////////////////////////////// diff --git a/glm/gtx/simd_vec4.inl b/glm/gtx/simd_vec4.inl index ea327798..08ca10f9 100644 --- a/glm/gtx/simd_vec4.inl +++ b/glm/gtx/simd_vec4.inl @@ -17,22 +17,22 @@ struct shuffle_mask }; # ifdef GLM_STATIC_CONST_MEMBERS - const fvec4SIMD fvec4SIMD::ZERO = fvec4SIMD(0, 0, 0, 0); - const fvec4SIMD fvec4SIMD::X = fvec4SIMD(1, 0, 0, 0); - const fvec4SIMD fvec4SIMD::Y = fvec4SIMD(0, 1, 0, 0); - const fvec4SIMD fvec4SIMD::Z = fvec4SIMD(0, 0, 1, 0); - const fvec4SIMD fvec4SIMD::W = fvec4SIMD(0, 0, 0, 1); - const fvec4SIMD fvec4SIMD::XY = fvec4SIMD(1, 1, 0, 0); - const fvec4SIMD fvec4SIMD::XZ = fvec4SIMD(1, 0, 1, 0); - const fvec4SIMD fvec4SIMD::XW = fvec4SIMD(1, 0, 0, 1); - const fvec4SIMD fvec4SIMD::YZ = fvec4SIMD(0, 1, 1, 0); - const fvec4SIMD fvec4SIMD::YW = fvec4SIMD(0, 1, 0, 1); - const fvec4SIMD fvec4SIMD::ZW = fvec4SIMD(0, 0, 1, 1); - const fvec4SIMD fvec4SIMD::XYZ = fvec4SIMD(1, 1, 1, 0); - const fvec4SIMD fvec4SIMD::XYW = fvec4SIMD(1, 1, 0, 1); - const fvec4SIMD fvec4SIMD::XZW = fvec4SIMD(1, 0, 1, 1); - const fvec4SIMD fvec4SIMD::YZW = fvec4SIMD(0, 1, 1, 1); - const fvec4SIMD fvec4SIMD::XYZW = fvec4SIMD(1, 1, 1, 1); + const fvec4SIMD fvec4SIMD::ZERO(0, 0, 0, 0); + const fvec4SIMD fvec4SIMD::X(1, 0, 0, 0); + const fvec4SIMD fvec4SIMD::Y(0, 1, 0, 0); + const fvec4SIMD fvec4SIMD::Z(0, 0, 1, 0); + const fvec4SIMD fvec4SIMD::W(0, 0, 0, 1); + const fvec4SIMD fvec4SIMD::XY(1, 1, 0, 0); + const fvec4SIMD fvec4SIMD::XZ(1, 0, 1, 0); + const fvec4SIMD fvec4SIMD::XW(1, 0, 0, 1); + const fvec4SIMD fvec4SIMD::YZ(0, 1, 1, 0); + const fvec4SIMD fvec4SIMD::YW(0, 1, 0, 1); + const fvec4SIMD fvec4SIMD::ZW(0, 0, 1, 1); + const fvec4SIMD fvec4SIMD::XYZ(1, 1, 1, 0); + const fvec4SIMD fvec4SIMD::XYW(1, 1, 0, 1); + const fvec4SIMD fvec4SIMD::XZW(1, 0, 1, 1); + const fvec4SIMD fvec4SIMD::YZW(0, 1, 1, 1); + const fvec4SIMD fvec4SIMD::XYZW(1, 1, 1, 1); # endif ////////////////////////////////////// From 57e6ea071dfff00cbed6c5f484bb4f42c60cfefe Mon Sep 17 00:00:00 2001 From: Jesse Talavera-Greenberg Date: Mon, 5 Oct 2015 19:31:17 -0400 Subject: [PATCH 13/16] Add simdMat4 static constants - Tests, too --- glm/gtx/simd_mat4.hpp | 5 +++++ glm/gtx/simd_mat4.inl | 5 +++++ test/gtx/gtx_simd_mat4.cpp | 12 +++++++++++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/glm/gtx/simd_mat4.hpp b/glm/gtx/simd_mat4.hpp index 04198333..e1567610 100644 --- a/glm/gtx/simd_mat4.hpp +++ b/glm/gtx/simd_mat4.hpp @@ -83,6 +83,11 @@ namespace detail static GLM_RELAXED_CONSTEXPR precision prec = defaultp; # endif//GLM_META_PROG_HELPERS +# ifdef GLM_STATIC_CONST_MEMBERS + static const type ZERO; + static const type IDENTITY; +# endif + GLM_FUNC_DECL length_t length() const; fvec4SIMD Data[4]; diff --git a/glm/gtx/simd_mat4.inl b/glm/gtx/simd_mat4.inl index 13dcb20f..9b48289f 100644 --- a/glm/gtx/simd_mat4.inl +++ b/glm/gtx/simd_mat4.inl @@ -61,6 +61,11 @@ GLM_FUNC_QUALIFIER fvec4SIMD const & fmat4x4SIMD::operator[] return this->Data[i]; } +#ifdef GLM_STATIC_CONST_MEMBERS + const fmat4x4SIMD fmat4x4SIMD::ZERO(0); + const fmat4x4SIMD fmat4x4SIMD::IDENTITY(1); +#endif + ////////////////////////////////////////////////////////////// // Constructors diff --git a/test/gtx/gtx_simd_mat4.cpp b/test/gtx/gtx_simd_mat4.cpp index 11230466..dce607b6 100644 --- a/test/gtx/gtx_simd_mat4.cpp +++ b/test/gtx/gtx_simd_mat4.cpp @@ -29,6 +29,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// +#define GLM_STATIC_CONST_MEMBERS #include #include #include @@ -252,6 +253,15 @@ int test_compute_gtx() return 0; } +int test_static_const() { + int Error(0); + + Error += glm::simdMat4(1) == glm::simdMat4::IDENTITY ? 0 : 1; + Error += glm::simdMat4(0) == glm::simdMat4::ZERO ? 0 : 1; + + return Error; +} + int main() { int Error = 0; @@ -313,7 +323,7 @@ int main() Error += test_compute_glm(); Error += test_compute_gtx(); - + Error += test_static_const(); float Det = glm::determinant(glm::simdMat4(1.0)); Error += Det == 1.0f ? 0 : 1; From 5eb7ad5d471a93d70186a2ac8e0f715aa1f0b557 Mon Sep 17 00:00:00 2001 From: Jesse Talavera-Greenberg Date: Mon, 5 Oct 2015 19:32:19 -0400 Subject: [PATCH 14/16] Add IDENTITY constants for quat and simdQuat - Why the hell am I not studying for the test I have tomorrow --- glm/gtc/quaternion.hpp | 1 + glm/gtc/quaternion.inl | 2 ++ glm/gtx/simd_quat.hpp | 1 + glm/gtx/simd_quat.inl | 1 + 4 files changed, 5 insertions(+) diff --git a/glm/gtc/quaternion.hpp b/glm/gtc/quaternion.hpp index 37df9a96..f5711c64 100644 --- a/glm/gtc/quaternion.hpp +++ b/glm/gtc/quaternion.hpp @@ -78,6 +78,7 @@ namespace glm # 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; diff --git a/glm/gtc/quaternion.inl b/glm/gtc/quaternion.inl index a6ea6432..4ee7f802 100644 --- a/glm/gtc/quaternion.inl +++ b/glm/gtc/quaternion.inl @@ -54,6 +54,8 @@ namespace detail const tquat tquat::ZERO (static_cast(0), static_cast(0), static_cast(0), static_cast(0)); + template const tquat tquat::IDENTITY; + template const tquat tquat::X (static_cast(0), static_cast(1), static_cast(0), static_cast(0)); diff --git a/glm/gtx/simd_quat.hpp b/glm/gtx/simd_quat.hpp index 00b32239..16782081 100644 --- a/glm/gtx/simd_quat.hpp +++ b/glm/gtx/simd_quat.hpp @@ -93,6 +93,7 @@ namespace detail # 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; diff --git a/glm/gtx/simd_quat.inl b/glm/gtx/simd_quat.inl index dfa5b3c1..c301988a 100644 --- a/glm/gtx/simd_quat.inl +++ b/glm/gtx/simd_quat.inl @@ -53,6 +53,7 @@ void print(const fvec4SIMD &v) # ifdef GLM_STATIC_CONST_MEMBERS const fquatSIMD fquatSIMD::ZERO(0, 0, 0, 0); + const fquatSIMD fquatSIMD::IDENTITY(1, 0, 0, 0); const fquatSIMD fquatSIMD::X(0, 1, 0, 0); const fquatSIMD fquatSIMD::Y(0, 0, 1, 0); const fquatSIMD fquatSIMD::Z(0, 0, 0, 1); From 08bf6e78c9b21e41a553b773749c343d1ef4b200 Mon Sep 17 00:00:00 2001 From: Jesse Talavera-Greenberg Date: Wed, 7 Oct 2015 16:11:23 -0400 Subject: [PATCH 15/16] Renamed comp (X|Y|Z|W) template parameters in fvec4SIMD to (X|Y|Z|W)_ --- glm/gtx/simd_vec4.hpp | 10 +++++----- glm/gtx/simd_vec4.inl | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/glm/gtx/simd_vec4.hpp b/glm/gtx/simd_vec4.hpp index 5f5a7e11..3877f821 100644 --- a/glm/gtx/simd_vec4.hpp +++ b/glm/gtx/simd_vec4.hpp @@ -186,15 +186,15 @@ namespace detail ////////////////////////////////////// // Swizzle operators - template + template fvec4SIMD& swizzle(); - template + template fvec4SIMD swizzle() const; - template + template fvec4SIMD swizzle() const; - template + template fvec4SIMD swizzle() const; - template + template fvec4SIMD swizzle() const; }; }//namespace detail diff --git a/glm/gtx/simd_vec4.inl b/glm/gtx/simd_vec4.inl index 08ca10f9..b1413eea 100644 --- a/glm/gtx/simd_vec4.inl +++ b/glm/gtx/simd_vec4.inl @@ -186,21 +186,21 @@ GLM_FUNC_QUALIFIER fvec4SIMD& fvec4SIMD::operator--() ////////////////////////////////////// // Swizzle operators -template +template GLM_FUNC_QUALIFIER fvec4SIMD fvec4SIMD::swizzle() const { __m128 Data = _mm_shuffle_ps( this->Data, this->Data, - shuffle_mask<(W << 6) | (Z << 4) | (Y << 2) | (X << 0)>::value); + shuffle_mask<(W_ << 6) | (Z_ << 4) | (Y_ << 2) | (X_ << 0)>::value); return fvec4SIMD(Data); } -template +template GLM_FUNC_QUALIFIER fvec4SIMD& fvec4SIMD::swizzle() { this->Data = _mm_shuffle_ps( this->Data, this->Data, - shuffle_mask<(W << 6) | (Z << 4) | (Y << 2) | (X << 0)>::value); + shuffle_mask<(W_ << 6) | (Z_ << 4) | (Y_ << 2) | (X_ << 0)>::value); return *this; } From e55eb1e08b5c7ee1d293a6b1cf8b063f34bc9fb4 Mon Sep 17 00:00:00 2001 From: Jesse Talavera-Greenberg Date: Wed, 7 Oct 2015 16:12:45 -0400 Subject: [PATCH 16/16] Removed ambiguity in fmat4x4 constructor --- glm/gtx/simd_mat4.inl | 4 ++-- test/gtx/gtx_simd_mat4.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/glm/gtx/simd_mat4.inl b/glm/gtx/simd_mat4.inl index 9b48289f..c436ab1f 100644 --- a/glm/gtx/simd_mat4.inl +++ b/glm/gtx/simd_mat4.inl @@ -62,8 +62,8 @@ GLM_FUNC_QUALIFIER fvec4SIMD const & fmat4x4SIMD::operator[] } #ifdef GLM_STATIC_CONST_MEMBERS - const fmat4x4SIMD fmat4x4SIMD::ZERO(0); - const fmat4x4SIMD fmat4x4SIMD::IDENTITY(1); + const fmat4x4SIMD fmat4x4SIMD::ZERO(static_cast(0)); + const fmat4x4SIMD fmat4x4SIMD::IDENTITY(static_cast(1)); #endif ////////////////////////////////////////////////////////////// diff --git a/test/gtx/gtx_simd_mat4.cpp b/test/gtx/gtx_simd_mat4.cpp index dce607b6..6a9a42df 100644 --- a/test/gtx/gtx_simd_mat4.cpp +++ b/test/gtx/gtx_simd_mat4.cpp @@ -256,8 +256,8 @@ int test_compute_gtx() int test_static_const() { int Error(0); - Error += glm::simdMat4(1) == glm::simdMat4::IDENTITY ? 0 : 1; - Error += glm::simdMat4(0) == glm::simdMat4::ZERO ? 0 : 1; + Error += glm::mat4_cast(glm::simdMat4(static_cast(1))) == glm::mat4_cast(glm::simdMat4::IDENTITY) ? 0 : 1; + Error += glm::mat4_cast(glm::simdMat4(static_cast(0))) == glm::mat4_cast(glm::simdMat4::ZERO) ? 0 : 1; return Error; }