Added clamp, repeat, mirrorClamp and mirrorRepeat function to GLM_EXT_scalar_commond and GLM_EXT_vector_commond extensions with tests

This commit is contained in:
Christophe Riccio 2020-02-11 12:53:12 +01:00
parent e8d758f746
commit a4bf8867c2
12 changed files with 421 additions and 121 deletions

View File

@ -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<typename genType>
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<typename genType>
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<typename genType>
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<typename genType>
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<typename genType>
GLM_FUNC_DECL genType mirrorRepeat(genType const& Texcoord);
/// @}
}//namespace glm

View File

@ -120,4 +120,33 @@ namespace glm
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'fclamp' only accept floating-point or integer inputs");
return fmin(fmax(x, minVal), maxVal);
}
template<typename genType>
GLM_FUNC_QUALIFIER genType clamp(genType const& Texcoord)
{
return glm::clamp(Texcoord, static_cast<genType>(0), static_cast<genType>(1));
}
template<typename genType>
GLM_FUNC_QUALIFIER genType repeat(genType const& Texcoord)
{
return glm::fract(Texcoord);
}
template<typename genType>
GLM_FUNC_QUALIFIER genType mirrorClamp(genType const& Texcoord)
{
return glm::fract(glm::abs(Texcoord));
}
template<typename genType>
GLM_FUNC_QUALIFIER genType mirrorRepeat(genType const& Texcoord)
{
genType const Abs = glm::abs(Texcoord);
genType const Clamp = glm::mod(glm::floor(Abs), static_cast<genType>(2));
genType const Floor = glm::floor(Abs);
genType const Rest = Abs - Floor;
genType const Mirror = Clamp + Rest;
return mix(Rest, static_cast<genType>(1) - Rest, Mirror >= static_cast<genType>(1));
}
}//namespace glm

View File

@ -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 <glm/ext/scalar_packing.hpp> 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"

View File

@ -158,6 +158,46 @@ namespace glm
template<length_t L, typename T, qualifier Q>
GLM_FUNC_DECL vec<L, T, Q> fclamp(vec<L, T, Q> const& x, vec<L, T, Q> const& minVal, vec<L, T, Q> 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<length_t L, typename T, qualifier Q>
GLM_FUNC_DECL vec<L, T, Q> clamp(vec<L, T, Q> 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<length_t L, typename T, qualifier Q>
GLM_FUNC_DECL vec<L, T, Q> repeat(vec<L, T, Q> 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<length_t L, typename T, qualifier Q>
GLM_FUNC_DECL vec<L, T, Q> mirrorClamp(vec<L, T, Q> 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<length_t L, typename T, qualifier Q>
GLM_FUNC_DECL vec<L, T, Q> mirrorRepeat(vec<L, T, Q> const& Texcoord);
/// @}
}//namespace glm

View File

@ -97,4 +97,33 @@ namespace glm
{
return fmin(fmax(x, minVal), maxVal);
}
template<length_t L, typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<L, T, Q> clamp(vec<L, T, Q> const& Texcoord)
{
return glm::clamp(Texcoord, vec<L, T, Q>(0), vec<L, T, Q>(1));
}
template<length_t L, typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<L, T, Q> repeat(vec<L, T, Q> const& Texcoord)
{
return glm::fract(Texcoord);
}
template<length_t L, typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<L, T, Q> mirrorClamp(vec<L, T, Q> const& Texcoord)
{
return glm::fract(glm::abs(Texcoord));
}
template<length_t L, typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<L, T, Q> mirrorRepeat(vec<L, T, Q> const& Texcoord)
{
vec<L, T, Q> const Abs = glm::abs(Texcoord);
vec<L, T, Q> const Clamp = glm::mod(glm::floor(Abs), vec<L, T, Q>(2));
vec<L, T, Q> const Floor = glm::floor(Abs);
vec<L, T, Q> const Rest = Abs - Floor;
vec<L, T, Q> const Mirror = Clamp + Rest;
return mix(Rest, vec<L, T, Q>(1) - Rest, glm::greaterThanEqual(Mirror, vec<L, T, Q>(1)));
}
}//namespace glm

View File

@ -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 <glm/ext/vector_packing.hpp> 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

View File

@ -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<typename genType>
GLM_FUNC_DECL genType clamp(genType const& Texcoord);
/// Simulate GL_REPEAT OpenGL wrap mode
/// @see gtx_wrap extension.
template<typename genType>
GLM_FUNC_DECL genType repeat(genType const& Texcoord);
/// Simulate GL_MIRRORED_REPEAT OpenGL wrap mode
/// @see gtx_wrap extension.
template<typename genType>
GLM_FUNC_DECL genType mirrorClamp(genType const& Texcoord);
/// Simulate GL_MIRROR_REPEAT OpenGL wrap mode
/// @see gtx_wrap extension.
template<typename genType>
GLM_FUNC_DECL genType mirrorRepeat(genType const& Texcoord);
/// @}
}// namespace glm

View File

@ -2,56 +2,5 @@
namespace glm
{
template<length_t L, typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<L, T, Q> clamp(vec<L, T, Q> const& Texcoord)
{
return glm::clamp(Texcoord, vec<L, T, Q>(0), vec<L, T, Q>(1));
}
template<typename genType>
GLM_FUNC_QUALIFIER genType clamp(genType const& Texcoord)
{
return clamp(vec<1, genType, defaultp>(Texcoord)).x;
}
template<length_t L, typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<L, T, Q> repeat(vec<L, T, Q> const& Texcoord)
{
return glm::fract(Texcoord);
}
template<typename genType>
GLM_FUNC_QUALIFIER genType repeat(genType const& Texcoord)
{
return repeat(vec<1, genType, defaultp>(Texcoord)).x;
}
template<length_t L, typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<L, T, Q> mirrorClamp(vec<L, T, Q> const& Texcoord)
{
return glm::fract(glm::abs(Texcoord));
}
template<typename genType>
GLM_FUNC_QUALIFIER genType mirrorClamp(genType const& Texcoord)
{
return mirrorClamp(vec<1, genType, defaultp>(Texcoord)).x;
}
template<length_t L, typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<L, T, Q> mirrorRepeat(vec<L, T, Q> const& Texcoord)
{
vec<L, T, Q> const Abs = glm::abs(Texcoord);
vec<L, T, Q> const Clamp = glm::mod(glm::floor(Abs), vec<L, T, Q>(2));
vec<L, T, Q> const Floor = glm::floor(Abs);
vec<L, T, Q> const Rest = Abs - Floor;
vec<L, T, Q> const Mirror = Clamp + Rest;
return mix(Rest, vec<L, T, Q>(1) - Rest, glm::greaterThanEqual(Mirror, vec<L, T, Q>(1)));
}
template<typename genType>
GLM_FUNC_QUALIFIER genType mirrorRepeat(genType const& Texcoord)
{
return mirrorRepeat(vec<1, genType, defaultp>(Texcoord)).x;
}
}//namespace glm

View File

@ -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:

View File

@ -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<float>();
Error += test_fmax<double>();
Error += test_clamp();
Error += test_repeat();
Error += test_mirrorClamp();
Error += test_mirrorRepeat();
return Error;
}

View File

@ -1,4 +1,5 @@
#include <glm/ext/vector_common.hpp>
#include <glm/ext/vector_bool1.hpp>
#include <glm/ext/vector_bool1_precision.hpp>
#include <glm/ext/vector_bool2.hpp>
@ -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<glm::vec3>();
Error += test_fmax<glm::vec2>();
Error += test_clamp();
Error += test_repeat();
Error += test_mirrorClamp();
Error += test_mirrorRepeat();
return Error;
}

View File

@ -1,6 +1,7 @@
#define GLM_ENABLE_EXPERIMENTAL
#include <glm/gtx/wrap.hpp>
#include <glm/gtc/epsilon.hpp>
#include <glm/ext/scalar_relational.hpp>
#include <glm/ext/vector_relational.hpp>
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;
}