2016-11-12 13:19:22 +00:00
|
|
|
#define GLM_ENABLE_EXPERIMENTAL
|
2015-06-27 17:36:03 +00:00
|
|
|
#include <glm/gtx/wrap.hpp>
|
2020-02-11 11:53:12 +00:00
|
|
|
#include <glm/ext/scalar_relational.hpp>
|
|
|
|
#include <glm/ext/vector_relational.hpp>
|
2015-06-27 17:36:03 +00:00
|
|
|
|
|
|
|
namespace clamp
|
|
|
|
{
|
2024-01-20 09:11:13 +00:00
|
|
|
static int test()
|
2015-06-27 17:36:03 +00:00
|
|
|
{
|
|
|
|
int Error(0);
|
|
|
|
|
|
|
|
float A = glm::clamp(0.5f);
|
2020-02-11 11:53:12 +00:00
|
|
|
Error += glm::equal(A, 0.5f, 0.00001f) ? 0 : 1;
|
2015-06-27 17:36:03 +00:00
|
|
|
|
|
|
|
float B = glm::clamp(0.0f);
|
2020-02-11 11:53:12 +00:00
|
|
|
Error += glm::equal(B, 0.0f, 0.00001f) ? 0 : 1;
|
2015-06-27 17:36:03 +00:00
|
|
|
|
|
|
|
float C = glm::clamp(1.0f);
|
2020-02-11 11:53:12 +00:00
|
|
|
Error += glm::equal(C, 1.0f, 0.00001f) ? 0 : 1;
|
2015-06-27 17:36:03 +00:00
|
|
|
|
|
|
|
float D = glm::clamp(-0.5f);
|
2020-02-11 11:53:12 +00:00
|
|
|
Error += glm::equal(D, 0.0f, 0.00001f) ? 0 : 1;
|
2015-06-27 17:36:03 +00:00
|
|
|
|
|
|
|
float E = glm::clamp(1.5f);
|
2020-02-11 11:53:12 +00:00
|
|
|
Error += glm::equal(E, 1.0f, 0.00001f) ? 0 : 1;
|
2015-06-27 17:36:03 +00:00
|
|
|
|
2016-08-06 17:28:16 +00:00
|
|
|
glm::vec2 K = glm::clamp(glm::vec2(0.5f));
|
2020-02-11 11:53:12 +00:00
|
|
|
Error += glm::all(glm::equal(K, glm::vec2(0.5f), glm::vec2(0.00001f))) ? 0 : 1;
|
2016-08-06 17:28:16 +00:00
|
|
|
|
|
|
|
glm::vec3 L = glm::clamp(glm::vec3(0.5f));
|
2020-02-11 11:53:12 +00:00
|
|
|
Error += glm::all(glm::equal(L, glm::vec3(0.5f), glm::vec3(0.00001f))) ? 0 : 1;
|
2016-08-06 17:28:16 +00:00
|
|
|
|
|
|
|
glm::vec4 M = glm::clamp(glm::vec4(0.5f));
|
2020-02-11 11:53:12 +00:00
|
|
|
Error += glm::all(glm::equal(M, glm::vec4(0.5f), glm::vec4(0.00001f))) ? 0 : 1;
|
2016-08-06 17:28:16 +00:00
|
|
|
|
|
|
|
glm::vec1 N = glm::clamp(glm::vec1(0.5f));
|
2020-02-11 11:53:12 +00:00
|
|
|
Error += glm::all(glm::equal(N, glm::vec1(0.5f), glm::vec1(0.00001f))) ? 0 : 1;
|
2016-08-06 17:28:16 +00:00
|
|
|
|
2015-06-27 17:36:03 +00:00
|
|
|
return Error;
|
|
|
|
}
|
|
|
|
}//namespace clamp
|
|
|
|
|
|
|
|
namespace repeat
|
|
|
|
{
|
2024-01-20 09:11:13 +00:00
|
|
|
static int test()
|
2015-06-27 17:36:03 +00:00
|
|
|
{
|
|
|
|
int Error(0);
|
|
|
|
|
|
|
|
float A = glm::repeat(0.5f);
|
2020-02-11 11:53:12 +00:00
|
|
|
Error += glm::equal(A, 0.5f, 0.00001f) ? 0 : 1;
|
2015-06-27 17:36:03 +00:00
|
|
|
|
|
|
|
float B = glm::repeat(0.0f);
|
2020-02-11 11:53:12 +00:00
|
|
|
Error += glm::equal(B, 0.0f, 0.00001f) ? 0 : 1;
|
2015-06-27 17:36:03 +00:00
|
|
|
|
|
|
|
float C = glm::repeat(1.0f);
|
2020-02-11 11:53:12 +00:00
|
|
|
Error += glm::equal(C, 0.0f, 0.00001f) ? 0 : 1;
|
2015-06-27 17:36:03 +00:00
|
|
|
|
|
|
|
float D = glm::repeat(-0.5f);
|
2020-02-11 11:53:12 +00:00
|
|
|
Error += glm::equal(D, 0.5f, 0.00001f) ? 0 : 1;
|
2015-06-27 17:36:03 +00:00
|
|
|
|
|
|
|
float E = glm::repeat(1.5f);
|
2020-02-11 11:53:12 +00:00
|
|
|
Error += glm::equal(E, 0.5f, 0.00001f) ? 0 : 1;
|
2015-06-27 17:36:03 +00:00
|
|
|
|
|
|
|
float F = glm::repeat(0.9f);
|
2020-02-11 11:53:12 +00:00
|
|
|
Error += glm::equal(F, 0.9f, 0.00001f) ? 0 : 1;
|
2015-06-27 17:36:03 +00:00
|
|
|
|
2016-08-06 17:28:16 +00:00
|
|
|
glm::vec2 K = glm::repeat(glm::vec2(0.5f));
|
2020-02-11 11:53:12 +00:00
|
|
|
Error += glm::all(glm::equal(K, glm::vec2(0.5f), glm::vec2(0.00001f))) ? 0 : 1;
|
2016-08-06 17:28:16 +00:00
|
|
|
|
|
|
|
glm::vec3 L = glm::repeat(glm::vec3(0.5f));
|
2020-02-11 11:53:12 +00:00
|
|
|
Error += glm::all(glm::equal(L, glm::vec3(0.5f), glm::vec3(0.00001f))) ? 0 : 1;
|
2016-08-06 17:28:16 +00:00
|
|
|
|
|
|
|
glm::vec4 M = glm::repeat(glm::vec4(0.5f));
|
2020-02-11 11:53:12 +00:00
|
|
|
Error += glm::all(glm::equal(M, glm::vec4(0.5f), glm::vec4(0.00001f))) ? 0 : 1;
|
2016-08-06 17:28:16 +00:00
|
|
|
|
|
|
|
glm::vec1 N = glm::repeat(glm::vec1(0.5f));
|
2020-02-11 11:53:12 +00:00
|
|
|
Error += glm::all(glm::equal(N, glm::vec1(0.5f), glm::vec1(0.00001f))) ? 0 : 1;
|
2016-08-06 17:28:16 +00:00
|
|
|
|
2015-06-27 17:36:03 +00:00
|
|
|
return Error;
|
|
|
|
}
|
|
|
|
}//namespace repeat
|
|
|
|
|
2015-06-27 18:12:27 +00:00
|
|
|
namespace mirrorClamp
|
|
|
|
{
|
2024-01-20 09:11:13 +00:00
|
|
|
static int test()
|
2015-06-27 18:12:27 +00:00
|
|
|
{
|
|
|
|
int Error(0);
|
|
|
|
|
|
|
|
float A = glm::mirrorClamp(0.5f);
|
2020-02-11 11:53:12 +00:00
|
|
|
Error += glm::equal(A, 0.5f, 0.00001f) ? 0 : 1;
|
2015-06-27 18:12:27 +00:00
|
|
|
|
|
|
|
float B = glm::mirrorClamp(0.0f);
|
2020-02-11 11:53:12 +00:00
|
|
|
Error += glm::equal(B, 0.0f, 0.00001f) ? 0 : 1;
|
2015-06-27 18:12:27 +00:00
|
|
|
|
|
|
|
float C = glm::mirrorClamp(1.1f);
|
2020-02-11 11:53:12 +00:00
|
|
|
Error += glm::equal(C, 0.1f, 0.00001f) ? 0 : 1;
|
2015-06-27 18:12:27 +00:00
|
|
|
|
|
|
|
float D = glm::mirrorClamp(-0.5f);
|
2020-02-11 11:53:12 +00:00
|
|
|
Error += glm::equal(D, 0.5f, 0.00001f) ? 0 : 1;
|
2015-06-27 18:12:27 +00:00
|
|
|
|
|
|
|
float E = glm::mirrorClamp(1.5f);
|
2020-02-11 11:53:12 +00:00
|
|
|
Error += glm::equal(E, 0.5f, 0.00001f) ? 0 : 1;
|
2015-06-27 18:12:27 +00:00
|
|
|
|
|
|
|
float F = glm::mirrorClamp(0.9f);
|
2020-02-11 11:53:12 +00:00
|
|
|
Error += glm::equal(F, 0.9f, 0.00001f) ? 0 : 1;
|
2015-06-27 18:12:27 +00:00
|
|
|
|
|
|
|
float G = glm::mirrorClamp(3.1f);
|
2020-02-11 11:53:12 +00:00
|
|
|
Error += glm::equal(G, 0.1f, 0.00001f) ? 0 : 1;
|
2015-06-27 18:12:27 +00:00
|
|
|
|
|
|
|
float H = glm::mirrorClamp(-3.1f);
|
2020-02-11 11:53:12 +00:00
|
|
|
Error += glm::equal(H, 0.1f, 0.00001f) ? 0 : 1;
|
2015-06-27 18:12:27 +00:00
|
|
|
|
|
|
|
float I = glm::mirrorClamp(-0.9f);
|
2020-02-11 11:53:12 +00:00
|
|
|
Error += glm::equal(I, 0.9f, 0.00001f) ? 0 : 1;
|
2015-06-27 18:12:27 +00:00
|
|
|
|
2016-08-06 17:28:16 +00:00
|
|
|
glm::vec2 K = glm::mirrorClamp(glm::vec2(0.5f));
|
2020-02-11 11:53:12 +00:00
|
|
|
Error += glm::all(glm::equal(K, glm::vec2(0.5f), glm::vec2(0.00001f))) ? 0 : 1;
|
2016-08-06 17:28:16 +00:00
|
|
|
|
|
|
|
glm::vec3 L = glm::mirrorClamp(glm::vec3(0.5f));
|
2020-02-11 11:53:12 +00:00
|
|
|
Error += glm::all(glm::equal(L, glm::vec3(0.5f), glm::vec3(0.00001f))) ? 0 : 1;
|
2016-08-06 17:28:16 +00:00
|
|
|
|
|
|
|
glm::vec4 M = glm::mirrorClamp(glm::vec4(0.5f));
|
2020-02-11 11:53:12 +00:00
|
|
|
Error += glm::all(glm::equal(M, glm::vec4(0.5f), glm::vec4(0.00001f))) ? 0 : 1;
|
2016-08-06 17:28:16 +00:00
|
|
|
|
|
|
|
glm::vec1 N = glm::mirrorClamp(glm::vec1(0.5f));
|
2020-02-11 11:53:12 +00:00
|
|
|
Error += glm::all(glm::equal(N, glm::vec1(0.5f), glm::vec1(0.00001f))) ? 0 : 1;
|
2016-08-06 17:28:16 +00:00
|
|
|
|
2015-06-27 18:12:27 +00:00
|
|
|
return Error;
|
|
|
|
}
|
|
|
|
}//namespace mirrorClamp
|
|
|
|
|
2015-06-27 17:36:03 +00:00
|
|
|
namespace mirrorRepeat
|
|
|
|
{
|
2024-01-20 09:11:13 +00:00
|
|
|
static int test()
|
2015-06-27 17:36:03 +00:00
|
|
|
{
|
|
|
|
int Error(0);
|
|
|
|
|
|
|
|
float A = glm::mirrorRepeat(0.5f);
|
2020-02-11 11:53:12 +00:00
|
|
|
Error += glm::equal(A, 0.5f, 0.00001f) ? 0 : 1;
|
2015-06-27 17:36:03 +00:00
|
|
|
|
|
|
|
float B = glm::mirrorRepeat(0.0f);
|
2020-02-11 11:53:12 +00:00
|
|
|
Error += glm::equal(B, 0.0f, 0.00001f) ? 0 : 1;
|
2015-06-27 17:36:03 +00:00
|
|
|
|
|
|
|
float C = glm::mirrorRepeat(1.0f);
|
2020-02-11 11:53:12 +00:00
|
|
|
Error += glm::equal(C, 1.0f, 0.00001f) ? 0 : 1;
|
2015-06-27 17:36:03 +00:00
|
|
|
|
|
|
|
float D = glm::mirrorRepeat(-0.5f);
|
2020-02-11 11:53:12 +00:00
|
|
|
Error += glm::equal(D, 0.5f, 0.00001f) ? 0 : 1;
|
2015-06-27 17:36:03 +00:00
|
|
|
|
|
|
|
float E = glm::mirrorRepeat(1.5f);
|
2020-02-11 11:53:12 +00:00
|
|
|
Error += glm::equal(E, 0.5f, 0.00001f) ? 0 : 1;
|
2015-06-27 17:36:03 +00:00
|
|
|
|
|
|
|
float F = glm::mirrorRepeat(0.9f);
|
2020-02-11 11:53:12 +00:00
|
|
|
Error += glm::equal(F, 0.9f, 0.00001f) ? 0 : 1;
|
2015-06-27 17:36:03 +00:00
|
|
|
|
|
|
|
float G = glm::mirrorRepeat(3.0f);
|
2020-02-11 11:53:12 +00:00
|
|
|
Error += glm::equal(G, 1.0f, 0.00001f) ? 0 : 1;
|
2015-06-27 17:36:03 +00:00
|
|
|
|
|
|
|
float H = glm::mirrorRepeat(-3.0f);
|
2020-02-11 11:53:12 +00:00
|
|
|
Error += glm::equal(H, 1.0f, 0.00001f) ? 0 : 1;
|
2015-06-27 17:36:03 +00:00
|
|
|
|
|
|
|
float I = glm::mirrorRepeat(-1.0f);
|
2020-02-11 11:53:12 +00:00
|
|
|
Error += glm::equal(I, 1.0f, 0.00001f) ? 0 : 1;
|
2015-06-27 17:36:03 +00:00
|
|
|
|
2016-08-06 17:28:16 +00:00
|
|
|
glm::vec2 K = glm::mirrorRepeat(glm::vec2(0.5f));
|
2020-02-11 11:53:12 +00:00
|
|
|
Error += glm::all(glm::equal(K, glm::vec2(0.5f), glm::vec2(0.00001f))) ? 0 : 1;
|
2016-08-06 17:28:16 +00:00
|
|
|
|
|
|
|
glm::vec3 L = glm::mirrorRepeat(glm::vec3(0.5f));
|
2020-02-11 11:53:12 +00:00
|
|
|
Error += glm::all(glm::equal(L, glm::vec3(0.5f), glm::vec3(0.00001f))) ? 0 : 1;
|
2016-08-06 17:28:16 +00:00
|
|
|
|
|
|
|
glm::vec4 M = glm::mirrorRepeat(glm::vec4(0.5f));
|
2020-02-11 11:53:12 +00:00
|
|
|
Error += glm::all(glm::equal(M, glm::vec4(0.5f), glm::vec4(0.00001f))) ? 0 : 1;
|
2016-08-06 17:28:16 +00:00
|
|
|
|
|
|
|
glm::vec1 N = glm::mirrorRepeat(glm::vec1(0.5f));
|
2020-02-11 11:53:12 +00:00
|
|
|
Error += glm::all(glm::equal(N, glm::vec1(0.5f), glm::vec1(0.00001f))) ? 0 : 1;
|
2016-08-06 17:28:16 +00:00
|
|
|
|
2015-06-27 17:36:03 +00:00
|
|
|
return Error;
|
|
|
|
}
|
|
|
|
}//namespace mirrorRepeat
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
int Error(0);
|
|
|
|
|
|
|
|
Error += clamp::test();
|
|
|
|
Error += repeat::test();
|
2015-06-27 18:12:27 +00:00
|
|
|
Error += mirrorClamp::test();
|
2015-06-27 17:36:03 +00:00
|
|
|
Error += mirrorRepeat::test();
|
|
|
|
|
|
|
|
return Error;
|
|
|
|
}
|