mirror of
https://github.com/g-truc/glm.git
synced 2024-11-22 17:04:35 +00:00
Fixed matrix comparison as constexpr
This commit is contained in:
parent
c1be8bf008
commit
cca8569a41
@ -22,7 +22,7 @@ namespace glm
|
||||
template<length_t C, length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<C, bool, Q> equal(mat<C, R, T, Q> const& a, mat<C, R, T, Q> const& b, vec<C, T, Q> const& Epsilon)
|
||||
{
|
||||
vec<C, bool, Q> Result;
|
||||
vec<C, bool, Q> Result(true);
|
||||
for(length_t i = 0; i < C; ++i)
|
||||
Result[i] = all(equal(a[i], b[i], Epsilon[i]));
|
||||
return Result;
|
||||
@ -43,7 +43,7 @@ namespace glm
|
||||
template<length_t C, length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<C, bool, Q> notEqual(mat<C, R, T, Q> const& a, mat<C, R, T, Q> const& b, vec<C, T, Q> const& Epsilon)
|
||||
{
|
||||
vec<C, bool, Q> Result;
|
||||
vec<C, bool, Q> Result(true);
|
||||
for(length_t i = 0; i < C; ++i)
|
||||
Result[i] = any(notEqual(a[i], b[i], Epsilon[i]));
|
||||
return Result;
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <glm/ext/matrix_relational.hpp>
|
||||
#include <glm/matrix.hpp>
|
||||
#include <glm/mat4x4.hpp>
|
||||
#include <glm/vec4.hpp>
|
||||
#include <vector>
|
||||
|
||||
template <typename matType, typename vecType>
|
||||
@ -174,6 +175,10 @@ static int test_constexpr()
|
||||
{
|
||||
#if GLM_HAS_CONSTEXPR
|
||||
static_assert(glm::mat4::length() == 4, "GLM: Failed constexpr");
|
||||
constexpr glm::mat4 A(1.f);
|
||||
constexpr glm::mat4 B(1.f);
|
||||
constexpr glm::bvec4 C = glm::equal(A, B, 0.01f);
|
||||
static_assert(glm::all(C), "GLM: Failed constexpr");
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user