From a4bf8867c27e26a4a69ebb61ce692624a5dde74b Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Tue, 11 Feb 2020 12:53:12 +0100 Subject: [PATCH] Added clamp, repeat, mirrorClamp and mirrorRepeat function to GLM_EXT_scalar_commond and GLM_EXT_vector_commond extensions with tests --- glm/ext/scalar_common.hpp | 34 +++++++++- glm/ext/scalar_common.inl | 29 ++++++++ glm/ext/scalar_packing.hpp | 32 +++++++++ glm/ext/vector_common.hpp | 40 +++++++++++ glm/ext/vector_common.inl | 29 ++++++++ glm/ext/vector_packing.hpp | 4 +- glm/gtx/wrap.hpp | 22 +----- glm/gtx/wrap.inl | 51 -------------- readme.md | 6 +- test/ext/ext_scalar_common.cpp | 120 +++++++++++++++++++++++++++++++++ test/ext/ext_vector_common.cpp | 82 ++++++++++++++++++++++ test/gtx/gtx_wrap.cpp | 93 ++++++++++++------------- 12 files changed, 421 insertions(+), 121 deletions(-) diff --git a/glm/ext/scalar_common.hpp b/glm/ext/scalar_common.hpp index 98eb6b77..aa5a1807 100644 --- a/glm/ext/scalar_common.hpp +++ b/glm/ext/scalar_common.hpp @@ -113,12 +113,44 @@ namespace glm /// Returns min(max(x, minVal), maxVal) for each component in x. If one of the two arguments is NaN, the value of the other argument is returned. /// - /// @tparam genType Floating-point scalar or vector types. + /// @tparam genType Floating-point scalar types. /// /// @see ext_scalar_common template GLM_FUNC_DECL genType fclamp(genType x, genType minVal, genType maxVal); + /// Simulate GL_CLAMP OpenGL wrap mode + /// + /// @tparam genType Floating-point scalar types. + /// + /// @see ext_scalar_common extension. + template + GLM_FUNC_DECL genType clamp(genType const& Texcoord); + + /// Simulate GL_REPEAT OpenGL wrap mode + /// + /// @tparam genType Floating-point scalar types. + /// + /// @see ext_scalar_common extension. + template + GLM_FUNC_DECL genType repeat(genType const& Texcoord); + + /// Simulate GL_MIRRORED_REPEAT OpenGL wrap mode + /// + /// @tparam genType Floating-point scalar types. + /// + /// @see ext_scalar_common extension. + template + GLM_FUNC_DECL genType mirrorClamp(genType const& Texcoord); + + /// Simulate GL_MIRROR_REPEAT OpenGL wrap mode + /// + /// @tparam genType Floating-point scalar types. + /// + /// @see ext_scalar_common extension. + template + GLM_FUNC_DECL genType mirrorRepeat(genType const& Texcoord); + /// @} }//namespace glm diff --git a/glm/ext/scalar_common.inl b/glm/ext/scalar_common.inl index f85169a0..7d9207af 100644 --- a/glm/ext/scalar_common.inl +++ b/glm/ext/scalar_common.inl @@ -120,4 +120,33 @@ namespace glm GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'fclamp' only accept floating-point or integer inputs"); return fmin(fmax(x, minVal), maxVal); } + + template + GLM_FUNC_QUALIFIER genType clamp(genType const& Texcoord) + { + return glm::clamp(Texcoord, static_cast(0), static_cast(1)); + } + + template + GLM_FUNC_QUALIFIER genType repeat(genType const& Texcoord) + { + return glm::fract(Texcoord); + } + + template + GLM_FUNC_QUALIFIER genType mirrorClamp(genType const& Texcoord) + { + return glm::fract(glm::abs(Texcoord)); + } + + template + GLM_FUNC_QUALIFIER genType mirrorRepeat(genType const& Texcoord) + { + genType const Abs = glm::abs(Texcoord); + genType const Clamp = glm::mod(glm::floor(Abs), static_cast(2)); + genType const Floor = glm::floor(Abs); + genType const Rest = Abs - Floor; + genType const Mirror = Clamp + Rest; + return mix(Rest, static_cast(1) - Rest, Mirror >= static_cast(1)); + } }//namespace glm diff --git a/glm/ext/scalar_packing.hpp b/glm/ext/scalar_packing.hpp index e69de29b..18b85b72 100644 --- a/glm/ext/scalar_packing.hpp +++ b/glm/ext/scalar_packing.hpp @@ -0,0 +1,32 @@ +/// @ref ext_scalar_packing +/// @file glm/ext/scalar_packing.hpp +/// +/// @see core (dependence) +/// +/// @defgroup ext_scalar_packing GLM_EXT_scalar_packing +/// @ingroup ext +/// +/// Include to use the features of this extension. +/// +/// This extension provides a set of function to convert scalar values to packed +/// formats. + +#pragma once + +// Dependency: +#include "../detail/qualifier.hpp" + +#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_EXT_scalar_packing extension included") +#endif + +namespace glm +{ + /// @addtogroup ext_scalar_packing + /// @{ + + + /// @} +}// namespace glm + +#include "scalar_packing.inl" diff --git a/glm/ext/vector_common.hpp b/glm/ext/vector_common.hpp index 0ea359b2..521ec01e 100644 --- a/glm/ext/vector_common.hpp +++ b/glm/ext/vector_common.hpp @@ -158,6 +158,46 @@ namespace glm template GLM_FUNC_DECL vec fclamp(vec const& x, vec const& minVal, vec const& maxVal); + /// Simulate GL_CLAMP OpenGL wrap mode + /// + /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector + /// @tparam T Floating-point scalar types + /// @tparam Q Value from qualifier enum + /// + /// @see ext_vector_common extension. + template + GLM_FUNC_DECL vec clamp(vec const& Texcoord); + + /// Simulate GL_REPEAT OpenGL wrap mode + /// + /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector + /// @tparam T Floating-point scalar types + /// @tparam Q Value from qualifier enum + /// + /// @see ext_vector_common extension. + template + GLM_FUNC_DECL vec repeat(vec const& Texcoord); + + /// Simulate GL_MIRRORED_REPEAT OpenGL wrap mode + /// + /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector + /// @tparam T Floating-point scalar types + /// @tparam Q Value from qualifier enum + /// + /// @see ext_vector_common extension. + template + GLM_FUNC_DECL vec mirrorClamp(vec const& Texcoord); + + /// Simulate GL_MIRROR_REPEAT OpenGL wrap mode + /// + /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector + /// @tparam T Floating-point scalar types + /// @tparam Q Value from qualifier enum + /// + /// @see ext_vector_common extension. + template + GLM_FUNC_DECL vec mirrorRepeat(vec const& Texcoord); + /// @} }//namespace glm diff --git a/glm/ext/vector_common.inl b/glm/ext/vector_common.inl index a5789560..e2747be7 100644 --- a/glm/ext/vector_common.inl +++ b/glm/ext/vector_common.inl @@ -97,4 +97,33 @@ namespace glm { return fmin(fmax(x, minVal), maxVal); } + + template + GLM_FUNC_QUALIFIER vec clamp(vec const& Texcoord) + { + return glm::clamp(Texcoord, vec(0), vec(1)); + } + + template + GLM_FUNC_QUALIFIER vec repeat(vec const& Texcoord) + { + return glm::fract(Texcoord); + } + + template + GLM_FUNC_QUALIFIER vec mirrorClamp(vec const& Texcoord) + { + return glm::fract(glm::abs(Texcoord)); + } + + template + GLM_FUNC_QUALIFIER vec mirrorRepeat(vec const& Texcoord) + { + vec const Abs = glm::abs(Texcoord); + vec const Clamp = glm::mod(glm::floor(Abs), vec(2)); + vec const Floor = glm::floor(Abs); + vec const Rest = Abs - Floor; + vec const Mirror = Clamp + Rest; + return mix(Rest, vec(1) - Rest, glm::greaterThanEqual(Mirror, vec(1))); + } }//namespace glm diff --git a/glm/ext/vector_packing.hpp b/glm/ext/vector_packing.hpp index b75971e1..76e5d0cc 100644 --- a/glm/ext/vector_packing.hpp +++ b/glm/ext/vector_packing.hpp @@ -1,4 +1,4 @@ -/// @ref vector_packing +/// @ref ext_vector_packing /// @file glm/ext/vector_packing.hpp /// /// @see core (dependence) @@ -8,7 +8,7 @@ /// /// Include to use the features of this extension. /// -/// This extension provides a set of function to convert vertors to packed +/// This extension provides a set of function to convert vectors to packed /// formats. #pragma once diff --git a/glm/gtx/wrap.hpp b/glm/gtx/wrap.hpp index 02c51965..ad4eb3fc 100644 --- a/glm/gtx/wrap.hpp +++ b/glm/gtx/wrap.hpp @@ -14,6 +14,8 @@ // Dependency: #include "../glm.hpp" +#include "../ext/scalar_common.hpp" +#include "../ext/vector_common.hpp" #include "../gtc/vec1.hpp" #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) @@ -29,26 +31,6 @@ namespace glm /// @addtogroup gtx_wrap /// @{ - /// Simulate GL_CLAMP OpenGL wrap mode - /// @see gtx_wrap extension. - template - GLM_FUNC_DECL genType clamp(genType const& Texcoord); - - /// Simulate GL_REPEAT OpenGL wrap mode - /// @see gtx_wrap extension. - template - GLM_FUNC_DECL genType repeat(genType const& Texcoord); - - /// Simulate GL_MIRRORED_REPEAT OpenGL wrap mode - /// @see gtx_wrap extension. - template - GLM_FUNC_DECL genType mirrorClamp(genType const& Texcoord); - - /// Simulate GL_MIRROR_REPEAT OpenGL wrap mode - /// @see gtx_wrap extension. - template - GLM_FUNC_DECL genType mirrorRepeat(genType const& Texcoord); - /// @} }// namespace glm diff --git a/glm/gtx/wrap.inl b/glm/gtx/wrap.inl index 409a316a..4be3b4c3 100644 --- a/glm/gtx/wrap.inl +++ b/glm/gtx/wrap.inl @@ -2,56 +2,5 @@ namespace glm { - template - GLM_FUNC_QUALIFIER vec clamp(vec const& Texcoord) - { - return glm::clamp(Texcoord, vec(0), vec(1)); - } - template - GLM_FUNC_QUALIFIER genType clamp(genType const& Texcoord) - { - return clamp(vec<1, genType, defaultp>(Texcoord)).x; - } - - template - GLM_FUNC_QUALIFIER vec repeat(vec const& Texcoord) - { - return glm::fract(Texcoord); - } - - template - GLM_FUNC_QUALIFIER genType repeat(genType const& Texcoord) - { - return repeat(vec<1, genType, defaultp>(Texcoord)).x; - } - - template - GLM_FUNC_QUALIFIER vec mirrorClamp(vec const& Texcoord) - { - return glm::fract(glm::abs(Texcoord)); - } - - template - GLM_FUNC_QUALIFIER genType mirrorClamp(genType const& Texcoord) - { - return mirrorClamp(vec<1, genType, defaultp>(Texcoord)).x; - } - - template - GLM_FUNC_QUALIFIER vec mirrorRepeat(vec const& Texcoord) - { - vec const Abs = glm::abs(Texcoord); - vec const Clamp = glm::mod(glm::floor(Abs), vec(2)); - vec const Floor = glm::floor(Abs); - vec const Rest = Abs - Floor; - vec const Mirror = Clamp + Rest; - return mix(Rest, vec(1) - Rest, glm::greaterThanEqual(Mirror, vec(1))); - } - - template - GLM_FUNC_QUALIFIER genType mirrorRepeat(genType const& Texcoord) - { - return mirrorRepeat(vec<1, genType, defaultp>(Texcoord)).x; - } }//namespace glm diff --git a/readme.md b/readme.md index 1c3db541..b349af07 100644 --- a/readme.md +++ b/readme.md @@ -55,7 +55,11 @@ glm::mat4 camera(float Translate, glm::vec2 const& Rotate) ### [GLM 0.9.9.8](https://github.com/g-truc/glm/releases/tag/0.9.9.8) - 2020-0X-XX #### Features: -- Added GLM_EXT_vector_intX_sized and GLM_EXT_vector_uintX_sized extensions +- Added GLM_EXT_vector_intX* and GLM_EXT_vector_uintX* extensions +- Added GLM_EXT_matrix_intX* and GLM_EXT_matrix_uintX* extensions + +#### Improvements: +- Added clamp, repeat, mirrorClamp and mirrorRepeat function to GLM_EXT_scalar_commond and GLM_EXT_vector_commond extensions with tests ### [GLM 0.9.9.7](https://github.com/g-truc/glm/releases/tag/0.9.9.7) - 2020-01-05 #### Improvements: diff --git a/test/ext/ext_scalar_common.cpp b/test/ext/ext_scalar_common.cpp index df679a84..d3d22fb2 100644 --- a/test/ext/ext_scalar_common.cpp +++ b/test/ext/ext_scalar_common.cpp @@ -183,6 +183,121 @@ static int test_fmax() return Error; } +static int test_clamp() +{ + int Error = 0; + + float A = glm::clamp(0.5f); + Error += glm::equal(A, 0.5f, 0.00001f) ? 0 : 1; + + float B = glm::clamp(0.0f); + Error += glm::equal(B, 0.0f, 0.00001f) ? 0 : 1; + + float C = glm::clamp(1.0f); + Error += glm::equal(C, 1.0f, 0.00001f) ? 0 : 1; + + float D = glm::clamp(-0.5f); + Error += glm::equal(D, 0.0f, 0.00001f) ? 0 : 1; + + float E = glm::clamp(1.5f); + Error += glm::equal(E, 1.0f, 0.00001f) ? 0 : 1; + + return Error; +} + +static int test_repeat() +{ + int Error = 0; + + float A = glm::repeat(0.5f); + Error += glm::equal(A, 0.5f, 0.00001f) ? 0 : 1; + + float B = glm::repeat(0.0f); + Error += glm::equal(B, 0.0f, 0.00001f) ? 0 : 1; + + float C = glm::repeat(1.0f); + Error += glm::equal(C, 0.0f, 0.00001f) ? 0 : 1; + + float D = glm::repeat(-0.5f); + Error += glm::equal(D, 0.5f, 0.00001f) ? 0 : 1; + + float E = glm::repeat(1.5f); + Error += glm::equal(E, 0.5f, 0.00001f) ? 0 : 1; + + float F = glm::repeat(0.9f); + Error += glm::equal(F, 0.9f, 0.00001f) ? 0 : 1; + + return Error; +} + +static int test_mirrorClamp() +{ + int Error = 0; + + float A = glm::mirrorClamp(0.5f); + Error += glm::equal(A, 0.5f, 0.00001f) ? 0 : 1; + + float B = glm::mirrorClamp(0.0f); + Error += glm::equal(B, 0.0f, 0.00001f) ? 0 : 1; + + float C = glm::mirrorClamp(1.1f); + Error += glm::equal(C, 0.1f, 0.00001f) ? 0 : 1; + + float D = glm::mirrorClamp(-0.5f); + Error += glm::equal(D, 0.5f, 0.00001f) ? 0 : 1; + + float E = glm::mirrorClamp(1.5f); + Error += glm::equal(E, 0.5f, 0.00001f) ? 0 : 1; + + float F = glm::mirrorClamp(0.9f); + Error += glm::equal(F, 0.9f, 0.00001f) ? 0 : 1; + + float G = glm::mirrorClamp(3.1f); + Error += glm::equal(G, 0.1f, 0.00001f) ? 0 : 1; + + float H = glm::mirrorClamp(-3.1f); + Error += glm::equal(H, 0.1f, 0.00001f) ? 0 : 1; + + float I = glm::mirrorClamp(-0.9f); + Error += glm::equal(I, 0.9f, 0.00001f) ? 0 : 1; + + return Error; +} + +static int test_mirrorRepeat() +{ + int Error = 0; + + float A = glm::mirrorRepeat(0.5f); + Error += glm::equal(A, 0.5f, 0.00001f) ? 0 : 1; + + float B = glm::mirrorRepeat(0.0f); + Error += glm::equal(B, 0.0f, 0.00001f) ? 0 : 1; + + float C = glm::mirrorRepeat(1.0f); + Error += glm::equal(C, 1.0f, 0.00001f) ? 0 : 1; + + float D = glm::mirrorRepeat(-0.5f); + Error += glm::equal(D, 0.5f, 0.00001f) ? 0 : 1; + + float E = glm::mirrorRepeat(1.5f); + Error += glm::equal(E, 0.5f, 0.00001f) ? 0 : 1; + + float F = glm::mirrorRepeat(0.9f); + Error += glm::equal(F, 0.9f, 0.00001f) ? 0 : 1; + + float G = glm::mirrorRepeat(3.0f); + Error += glm::equal(G, 1.0f, 0.00001f) ? 0 : 1; + + float H = glm::mirrorRepeat(-3.0f); + Error += glm::equal(H, 1.0f, 0.00001f) ? 0 : 1; + + float I = glm::mirrorRepeat(-1.0f); + Error += glm::equal(I, 1.0f, 0.00001f) ? 0 : 1; + + return Error; +} + int main() { int Error = 0; @@ -203,5 +318,10 @@ int main() Error += test_fmax(); Error += test_fmax(); + Error += test_clamp(); + Error += test_repeat(); + Error += test_mirrorClamp(); + Error += test_mirrorRepeat(); + return Error; } diff --git a/test/ext/ext_vector_common.cpp b/test/ext/ext_vector_common.cpp index 9a883f6a..344b669b 100644 --- a/test/ext/ext_vector_common.cpp +++ b/test/ext/ext_vector_common.cpp @@ -1,4 +1,5 @@ #include + #include #include #include @@ -226,6 +227,82 @@ static int test_fmax() return Error; } +static int test_clamp() +{ + int Error = 0; + + glm::vec2 K = glm::clamp(glm::vec2(0.5f)); + Error += glm::all(glm::equal(K, glm::vec2(0.5f), glm::vec2(0.00001f))) ? 0 : 1; + + glm::vec3 L = glm::clamp(glm::vec3(0.5f)); + Error += glm::all(glm::equal(L, glm::vec3(0.5f), glm::vec3(0.00001f))) ? 0 : 1; + + glm::vec4 M = glm::clamp(glm::vec4(0.5f)); + Error += glm::all(glm::equal(M, glm::vec4(0.5f), glm::vec4(0.00001f))) ? 0 : 1; + + glm::vec1 N = glm::clamp(glm::vec1(0.5f)); + Error += glm::all(glm::equal(N, glm::vec1(0.5f), glm::vec1(0.00001f))) ? 0 : 1; + + return Error; +} + +static int test_repeat() +{ + int Error = 0; + + glm::vec2 K = glm::repeat(glm::vec2(0.5f)); + Error += glm::all(glm::equal(K, glm::vec2(0.5f), glm::vec2(0.00001f))) ? 0 : 1; + + glm::vec3 L = glm::repeat(glm::vec3(0.5f)); + Error += glm::all(glm::equal(L, glm::vec3(0.5f), glm::vec3(0.00001f))) ? 0 : 1; + + glm::vec4 M = glm::repeat(glm::vec4(0.5f)); + Error += glm::all(glm::equal(M, glm::vec4(0.5f), glm::vec4(0.00001f))) ? 0 : 1; + + glm::vec1 N = glm::repeat(glm::vec1(0.5f)); + Error += glm::all(glm::equal(N, glm::vec1(0.5f), glm::vec1(0.00001f))) ? 0 : 1; + + return Error; +} + +static int test_mirrorClamp() +{ + int Error = 0; + + glm::vec2 K = glm::mirrorClamp(glm::vec2(0.5f)); + Error += glm::all(glm::equal(K, glm::vec2(0.5f), glm::vec2(0.00001f))) ? 0 : 1; + + glm::vec3 L = glm::mirrorClamp(glm::vec3(0.5f)); + Error += glm::all(glm::equal(L, glm::vec3(0.5f), glm::vec3(0.00001f))) ? 0 : 1; + + glm::vec4 M = glm::mirrorClamp(glm::vec4(0.5f)); + Error += glm::all(glm::equal(M, glm::vec4(0.5f), glm::vec4(0.00001f))) ? 0 : 1; + + glm::vec1 N = glm::mirrorClamp(glm::vec1(0.5f)); + Error += glm::all(glm::equal(N, glm::vec1(0.5f), glm::vec1(0.00001f))) ? 0 : 1; + + return Error; +} + +static int test_mirrorRepeat() +{ + int Error = 0; + + glm::vec2 K = glm::mirrorRepeat(glm::vec2(0.5f)); + Error += glm::all(glm::equal(K, glm::vec2(0.5f), glm::vec2(0.00001f))) ? 0 : 1; + + glm::vec3 L = glm::mirrorRepeat(glm::vec3(0.5f)); + Error += glm::all(glm::equal(L, glm::vec3(0.5f), glm::vec3(0.00001f))) ? 0 : 1; + + glm::vec4 M = glm::mirrorRepeat(glm::vec4(0.5f)); + Error += glm::all(glm::equal(M, glm::vec4(0.5f), glm::vec4(0.00001f))) ? 0 : 1; + + glm::vec1 N = glm::mirrorRepeat(glm::vec1(0.5f)); + Error += glm::all(glm::equal(N, glm::vec1(0.5f), glm::vec1(0.00001f))) ? 0 : 1; + + return Error; +} + int main() { int Error = 0; @@ -246,5 +323,10 @@ int main() Error += test_fmax(); Error += test_fmax(); + Error += test_clamp(); + Error += test_repeat(); + Error += test_mirrorClamp(); + Error += test_mirrorRepeat(); + return Error; } diff --git a/test/gtx/gtx_wrap.cpp b/test/gtx/gtx_wrap.cpp index 48ee0dc6..2354cc8b 100644 --- a/test/gtx/gtx_wrap.cpp +++ b/test/gtx/gtx_wrap.cpp @@ -1,6 +1,7 @@ #define GLM_ENABLE_EXPERIMENTAL #include -#include +#include +#include namespace clamp { @@ -9,31 +10,31 @@ namespace clamp int Error(0); float A = glm::clamp(0.5f); - Error += glm::epsilonEqual(A, 0.5f, 0.00001f) ? 0 : 1; + Error += glm::equal(A, 0.5f, 0.00001f) ? 0 : 1; float B = glm::clamp(0.0f); - Error += glm::epsilonEqual(B, 0.0f, 0.00001f) ? 0 : 1; + Error += glm::equal(B, 0.0f, 0.00001f) ? 0 : 1; float C = glm::clamp(1.0f); - Error += glm::epsilonEqual(C, 1.0f, 0.00001f) ? 0 : 1; + Error += glm::equal(C, 1.0f, 0.00001f) ? 0 : 1; float D = glm::clamp(-0.5f); - Error += glm::epsilonEqual(D, 0.0f, 0.00001f) ? 0 : 1; + Error += glm::equal(D, 0.0f, 0.00001f) ? 0 : 1; float E = glm::clamp(1.5f); - Error += glm::epsilonEqual(E, 1.0f, 0.00001f) ? 0 : 1; + Error += glm::equal(E, 1.0f, 0.00001f) ? 0 : 1; glm::vec2 K = glm::clamp(glm::vec2(0.5f)); - Error += glm::all(glm::epsilonEqual(K, glm::vec2(0.5f), glm::vec2(0.00001f))) ? 0 : 1; + Error += glm::all(glm::equal(K, glm::vec2(0.5f), glm::vec2(0.00001f))) ? 0 : 1; glm::vec3 L = glm::clamp(glm::vec3(0.5f)); - Error += glm::all(glm::epsilonEqual(L, glm::vec3(0.5f), glm::vec3(0.00001f))) ? 0 : 1; + Error += glm::all(glm::equal(L, glm::vec3(0.5f), glm::vec3(0.00001f))) ? 0 : 1; glm::vec4 M = glm::clamp(glm::vec4(0.5f)); - Error += glm::all(glm::epsilonEqual(M, glm::vec4(0.5f), glm::vec4(0.00001f))) ? 0 : 1; + Error += glm::all(glm::equal(M, glm::vec4(0.5f), glm::vec4(0.00001f))) ? 0 : 1; glm::vec1 N = glm::clamp(glm::vec1(0.5f)); - Error += glm::all(glm::epsilonEqual(N, glm::vec1(0.5f), glm::vec1(0.00001f))) ? 0 : 1; + Error += glm::all(glm::equal(N, glm::vec1(0.5f), glm::vec1(0.00001f))) ? 0 : 1; return Error; } @@ -46,34 +47,34 @@ namespace repeat int Error(0); float A = glm::repeat(0.5f); - Error += glm::epsilonEqual(A, 0.5f, 0.00001f) ? 0 : 1; + Error += glm::equal(A, 0.5f, 0.00001f) ? 0 : 1; float B = glm::repeat(0.0f); - Error += glm::epsilonEqual(B, 0.0f, 0.00001f) ? 0 : 1; + Error += glm::equal(B, 0.0f, 0.00001f) ? 0 : 1; float C = glm::repeat(1.0f); - Error += glm::epsilonEqual(C, 0.0f, 0.00001f) ? 0 : 1; + Error += glm::equal(C, 0.0f, 0.00001f) ? 0 : 1; float D = glm::repeat(-0.5f); - Error += glm::epsilonEqual(D, 0.5f, 0.00001f) ? 0 : 1; + Error += glm::equal(D, 0.5f, 0.00001f) ? 0 : 1; float E = glm::repeat(1.5f); - Error += glm::epsilonEqual(E, 0.5f, 0.00001f) ? 0 : 1; + Error += glm::equal(E, 0.5f, 0.00001f) ? 0 : 1; float F = glm::repeat(0.9f); - Error += glm::epsilonEqual(F, 0.9f, 0.00001f) ? 0 : 1; + Error += glm::equal(F, 0.9f, 0.00001f) ? 0 : 1; glm::vec2 K = glm::repeat(glm::vec2(0.5f)); - Error += glm::all(glm::epsilonEqual(K, glm::vec2(0.5f), glm::vec2(0.00001f))) ? 0 : 1; + Error += glm::all(glm::equal(K, glm::vec2(0.5f), glm::vec2(0.00001f))) ? 0 : 1; glm::vec3 L = glm::repeat(glm::vec3(0.5f)); - Error += glm::all(glm::epsilonEqual(L, glm::vec3(0.5f), glm::vec3(0.00001f))) ? 0 : 1; + Error += glm::all(glm::equal(L, glm::vec3(0.5f), glm::vec3(0.00001f))) ? 0 : 1; glm::vec4 M = glm::repeat(glm::vec4(0.5f)); - Error += glm::all(glm::epsilonEqual(M, glm::vec4(0.5f), glm::vec4(0.00001f))) ? 0 : 1; + Error += glm::all(glm::equal(M, glm::vec4(0.5f), glm::vec4(0.00001f))) ? 0 : 1; glm::vec1 N = glm::repeat(glm::vec1(0.5f)); - Error += glm::all(glm::epsilonEqual(N, glm::vec1(0.5f), glm::vec1(0.00001f))) ? 0 : 1; + Error += glm::all(glm::equal(N, glm::vec1(0.5f), glm::vec1(0.00001f))) ? 0 : 1; return Error; } @@ -86,43 +87,43 @@ namespace mirrorClamp int Error(0); float A = glm::mirrorClamp(0.5f); - Error += glm::epsilonEqual(A, 0.5f, 0.00001f) ? 0 : 1; + Error += glm::equal(A, 0.5f, 0.00001f) ? 0 : 1; float B = glm::mirrorClamp(0.0f); - Error += glm::epsilonEqual(B, 0.0f, 0.00001f) ? 0 : 1; + Error += glm::equal(B, 0.0f, 0.00001f) ? 0 : 1; float C = glm::mirrorClamp(1.1f); - Error += glm::epsilonEqual(C, 0.1f, 0.00001f) ? 0 : 1; + Error += glm::equal(C, 0.1f, 0.00001f) ? 0 : 1; float D = glm::mirrorClamp(-0.5f); - Error += glm::epsilonEqual(D, 0.5f, 0.00001f) ? 0 : 1; + Error += glm::equal(D, 0.5f, 0.00001f) ? 0 : 1; float E = glm::mirrorClamp(1.5f); - Error += glm::epsilonEqual(E, 0.5f, 0.00001f) ? 0 : 1; + Error += glm::equal(E, 0.5f, 0.00001f) ? 0 : 1; float F = glm::mirrorClamp(0.9f); - Error += glm::epsilonEqual(F, 0.9f, 0.00001f) ? 0 : 1; + Error += glm::equal(F, 0.9f, 0.00001f) ? 0 : 1; float G = glm::mirrorClamp(3.1f); - Error += glm::epsilonEqual(G, 0.1f, 0.00001f) ? 0 : 1; + Error += glm::equal(G, 0.1f, 0.00001f) ? 0 : 1; float H = glm::mirrorClamp(-3.1f); - Error += glm::epsilonEqual(H, 0.1f, 0.00001f) ? 0 : 1; + Error += glm::equal(H, 0.1f, 0.00001f) ? 0 : 1; float I = glm::mirrorClamp(-0.9f); - Error += glm::epsilonEqual(I, 0.9f, 0.00001f) ? 0 : 1; + Error += glm::equal(I, 0.9f, 0.00001f) ? 0 : 1; glm::vec2 K = glm::mirrorClamp(glm::vec2(0.5f)); - Error += glm::all(glm::epsilonEqual(K, glm::vec2(0.5f), glm::vec2(0.00001f))) ? 0 : 1; + Error += glm::all(glm::equal(K, glm::vec2(0.5f), glm::vec2(0.00001f))) ? 0 : 1; glm::vec3 L = glm::mirrorClamp(glm::vec3(0.5f)); - Error += glm::all(glm::epsilonEqual(L, glm::vec3(0.5f), glm::vec3(0.00001f))) ? 0 : 1; + Error += glm::all(glm::equal(L, glm::vec3(0.5f), glm::vec3(0.00001f))) ? 0 : 1; glm::vec4 M = glm::mirrorClamp(glm::vec4(0.5f)); - Error += glm::all(glm::epsilonEqual(M, glm::vec4(0.5f), glm::vec4(0.00001f))) ? 0 : 1; + Error += glm::all(glm::equal(M, glm::vec4(0.5f), glm::vec4(0.00001f))) ? 0 : 1; glm::vec1 N = glm::mirrorClamp(glm::vec1(0.5f)); - Error += glm::all(glm::epsilonEqual(N, glm::vec1(0.5f), glm::vec1(0.00001f))) ? 0 : 1; + Error += glm::all(glm::equal(N, glm::vec1(0.5f), glm::vec1(0.00001f))) ? 0 : 1; return Error; } @@ -135,43 +136,43 @@ namespace mirrorRepeat int Error(0); float A = glm::mirrorRepeat(0.5f); - Error += glm::epsilonEqual(A, 0.5f, 0.00001f) ? 0 : 1; + Error += glm::equal(A, 0.5f, 0.00001f) ? 0 : 1; float B = glm::mirrorRepeat(0.0f); - Error += glm::epsilonEqual(B, 0.0f, 0.00001f) ? 0 : 1; + Error += glm::equal(B, 0.0f, 0.00001f) ? 0 : 1; float C = glm::mirrorRepeat(1.0f); - Error += glm::epsilonEqual(C, 1.0f, 0.00001f) ? 0 : 1; + Error += glm::equal(C, 1.0f, 0.00001f) ? 0 : 1; float D = glm::mirrorRepeat(-0.5f); - Error += glm::epsilonEqual(D, 0.5f, 0.00001f) ? 0 : 1; + Error += glm::equal(D, 0.5f, 0.00001f) ? 0 : 1; float E = glm::mirrorRepeat(1.5f); - Error += glm::epsilonEqual(E, 0.5f, 0.00001f) ? 0 : 1; + Error += glm::equal(E, 0.5f, 0.00001f) ? 0 : 1; float F = glm::mirrorRepeat(0.9f); - Error += glm::epsilonEqual(F, 0.9f, 0.00001f) ? 0 : 1; + Error += glm::equal(F, 0.9f, 0.00001f) ? 0 : 1; float G = glm::mirrorRepeat(3.0f); - Error += glm::epsilonEqual(G, 1.0f, 0.00001f) ? 0 : 1; + Error += glm::equal(G, 1.0f, 0.00001f) ? 0 : 1; float H = glm::mirrorRepeat(-3.0f); - Error += glm::epsilonEqual(H, 1.0f, 0.00001f) ? 0 : 1; + Error += glm::equal(H, 1.0f, 0.00001f) ? 0 : 1; float I = glm::mirrorRepeat(-1.0f); - Error += glm::epsilonEqual(I, 1.0f, 0.00001f) ? 0 : 1; + Error += glm::equal(I, 1.0f, 0.00001f) ? 0 : 1; glm::vec2 K = glm::mirrorRepeat(glm::vec2(0.5f)); - Error += glm::all(glm::epsilonEqual(K, glm::vec2(0.5f), glm::vec2(0.00001f))) ? 0 : 1; + Error += glm::all(glm::equal(K, glm::vec2(0.5f), glm::vec2(0.00001f))) ? 0 : 1; glm::vec3 L = glm::mirrorRepeat(glm::vec3(0.5f)); - Error += glm::all(glm::epsilonEqual(L, glm::vec3(0.5f), glm::vec3(0.00001f))) ? 0 : 1; + Error += glm::all(glm::equal(L, glm::vec3(0.5f), glm::vec3(0.00001f))) ? 0 : 1; glm::vec4 M = glm::mirrorRepeat(glm::vec4(0.5f)); - Error += glm::all(glm::epsilonEqual(M, glm::vec4(0.5f), glm::vec4(0.00001f))) ? 0 : 1; + Error += glm::all(glm::equal(M, glm::vec4(0.5f), glm::vec4(0.00001f))) ? 0 : 1; glm::vec1 N = glm::mirrorRepeat(glm::vec1(0.5f)); - Error += glm::all(glm::epsilonEqual(N, glm::vec1(0.5f), glm::vec1(0.00001f))) ? 0 : 1; + Error += glm::all(glm::equal(N, glm::vec1(0.5f), glm::vec1(0.00001f))) ? 0 : 1; return Error; }