Added constexpr relational operators
This commit is contained in:
@@ -13,29 +13,29 @@ static int test_operators()
|
||||
|
||||
float const Epsilon = 0.001f;
|
||||
|
||||
glm::mat4x4 const M(2.0f);
|
||||
glm::mat4x4 const N(1.0f);
|
||||
glm::vec4 const U(2.0f);
|
||||
matType const M(2.0f);
|
||||
matType const N(1.0f);
|
||||
vecType const U(2.0f);
|
||||
|
||||
{
|
||||
glm::mat4 const P = N * 2.0f;
|
||||
matType const P = N * 2.0f;
|
||||
Error += glm::all(glm::equal(P, M, Epsilon)) ? 0 : 1;
|
||||
|
||||
glm::mat4 const Q = M / 2.0f;
|
||||
matType const Q = M / 2.0f;
|
||||
Error += glm::all(glm::equal(Q, N, Epsilon)) ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
glm::vec4 const V = M * U;
|
||||
Error += glm::all(glm::equal(V, glm::vec4(4.f), Epsilon)) ? 0 : 1;
|
||||
vecType const V = M * U;
|
||||
Error += glm::all(glm::equal(V, vecType(4.f), Epsilon)) ? 0 : 1;
|
||||
|
||||
glm::vec4 const W = U / M;
|
||||
Error += glm::all(glm::equal(V, W, Epsilon)) ? 0 : 1;
|
||||
vecType const W = U / M;
|
||||
Error += glm::all(glm::equal(W, vecType(1.f), Epsilon)) ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
glm::mat4 const O = M * N;
|
||||
Error += glm::all(glm::equal(O, glm::mat4(4.f), Epsilon)) ? 0 : 1;
|
||||
matType const O = M * N;
|
||||
Error += glm::all(glm::equal(O, matType(2.f), Epsilon)) ? 0 : 1;
|
||||
}
|
||||
|
||||
return Error;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <glm/gtc/constants.hpp>
|
||||
#include <glm/ext/scalar_relational.hpp>
|
||||
#include <glm/ext/vector_relational.hpp>
|
||||
#include <glm/ext/vector_dvec1.hpp>
|
||||
#include <glm/ext/vector_dvec1_precision.hpp>
|
||||
@@ -89,9 +90,6 @@ static int test_constexpr()
|
||||
{
|
||||
# if GLM_CONFIG_CONSTEXP == GLM_ENABLE
|
||||
static_assert(genType::length() == 1, "GLM: Failed constexpr");
|
||||
static_assert(glm::equal(genType(1)[0], 1.0, glm::epsilon<double>()), "GLM: Failed constexpr");
|
||||
static_assert(glm::all(glm::equal(genType(1), genType(glm::vec1(1), glm::epsilon<double>()), "GLM: Failed constexpr");
|
||||
static_assert(glm::all(glm::notEqual(genType(1), genType(0), glm::epsilon<double>())), "GLM: Failed constexpr");
|
||||
# endif
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -89,9 +89,6 @@ static int test_constexpr()
|
||||
{
|
||||
# if GLM_CONFIG_CONSTEXP == GLM_ENABLE
|
||||
static_assert(genType::length() == 1, "GLM: Failed constexpr");
|
||||
static_assert(glm::equal(genType(1)[0], 1.0f, glm::epsilon<float>()), "GLM: Failed constexpr");
|
||||
static_assert(glm::all(glm::equal(genType(1), genType(glm::vec1(1), glm::epsilon<float>()), "GLM: Failed constexpr");
|
||||
static_assert(glm::all(glm::notEqual(genType(1), genType(0), glm::epsilon<float>())), "GLM: Failed constexpr");
|
||||
# endif
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -301,8 +301,10 @@ int test_size()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
Error += 16 == sizeof(glm::quat) ? 0 : 1;
|
||||
Error += 32 == sizeof(glm::dquat) ? 0 : 1;
|
||||
std::size_t const A = sizeof(glm::quat);
|
||||
Error += 16 == A ? 0 : 1;
|
||||
std::size_t const B = sizeof(glm::dquat);
|
||||
Error += 32 == B ? 0 : 1;
|
||||
Error += glm::quat().length() == 4 ? 0 : 1;
|
||||
Error += glm::dquat().length() == 4 ? 0 : 1;
|
||||
Error += glm::quat::length() == 4 ? 0 : 1;
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
#if GLM_CONFIG_ALIGNED_GENTYPES == GLM_ENABLE
|
||||
#include <glm/gtc/type_aligned.hpp>
|
||||
#include <glm/gtc/type_precision.hpp>
|
||||
#include <glm/ext/vector_relational.hpp>
|
||||
#include <glm/ext/matrix_relational.hpp>
|
||||
|
||||
GLM_STATIC_ASSERT(glm::detail::is_aligned<glm::aligned_lowp>::value, "aligned_lowp is not aligned");
|
||||
GLM_STATIC_ASSERT(glm::detail::is_aligned<glm::aligned_mediump>::value, "aligned_mediump is not aligned");
|
||||
|
||||
Reference in New Issue
Block a user