Spaces:
Running
on
Zero
Running
on
Zero
File size: 1,881 Bytes
fc6af43 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
#include <glm/gtc/epsilon.hpp>
#include <glm/gtc/constants.hpp>
#include <glm/gtc/quaternion.hpp>
#include <glm/vector_relational.hpp>
int test_defined()
{
glm::epsilonEqual(glm::vec2(), glm::vec2(), glm::vec2());
glm::epsilonEqual(glm::vec3(), glm::vec3(), glm::vec3());
glm::epsilonEqual(glm::vec4(), glm::vec4(), glm::vec4());
glm::epsilonNotEqual(glm::vec2(), glm::vec2(), glm::vec2());
glm::epsilonNotEqual(glm::vec3(), glm::vec3(), glm::vec3());
glm::epsilonNotEqual(glm::vec4(), glm::vec4(), glm::vec4());
glm::epsilonEqual(glm::vec2(), glm::vec2(), 0.0f);
glm::epsilonEqual(glm::vec3(), glm::vec3(), 0.0f);
glm::epsilonEqual(glm::vec4(), glm::vec4(), 0.0f);
glm::epsilonEqual(glm::quat(), glm::quat(), 0.0f);
glm::epsilonNotEqual(glm::vec2(), glm::vec2(), 0.0f);
glm::epsilonNotEqual(glm::vec3(), glm::vec3(), 0.0f);
glm::epsilonNotEqual(glm::vec4(), glm::vec4(), 0.0f);
glm::epsilonNotEqual(glm::quat(), glm::quat(), 0.0f);
return 0;
}
template<typename T>
int test_equal()
{
int Error(0);
{
T A = glm::epsilon<T>();
T B = glm::epsilon<T>();
Error += glm::epsilonEqual(A, B, glm::epsilon<T>() * T(2)) ? 0 : 1;
}
{
T A(0);
T B = static_cast<T>(0) + glm::epsilon<T>();
Error += glm::epsilonEqual(A, B, glm::epsilon<T>() * T(2)) ? 0 : 1;
}
{
T A(0);
T B = static_cast<T>(0) - glm::epsilon<T>();
Error += glm::epsilonEqual(A, B, glm::epsilon<T>() * T(2)) ? 0 : 1;
}
{
T A = static_cast<T>(0) + glm::epsilon<T>();
T B = static_cast<T>(0);
Error += glm::epsilonEqual(A, B, glm::epsilon<T>() * T(2)) ? 0 : 1;
}
{
T A = static_cast<T>(0) - glm::epsilon<T>();
T B = static_cast<T>(0);
Error += glm::epsilonEqual(A, B, glm::epsilon<T>() * T(2)) ? 0 : 1;
}
return Error;
}
int main()
{
int Error(0);
Error += test_defined();
Error += test_equal<float>();
Error += test_equal<double>();
return Error;
}
|