From cca8569a4147cf1f8acd3ce7b650804d790e86fa Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Wed, 8 Aug 2018 00:17:29 +0200 Subject: [PATCH] Fixed matrix comparison as constexpr --- glm/ext/matrix_relational.inl | 4 ++-- test/core/core_type_mat4x4.cpp | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/glm/ext/matrix_relational.inl b/glm/ext/matrix_relational.inl index d6054f33..f7a82dda 100644 --- a/glm/ext/matrix_relational.inl +++ b/glm/ext/matrix_relational.inl @@ -22,7 +22,7 @@ namespace glm template GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec equal(mat const& a, mat const& b, vec const& Epsilon) { - vec Result; + vec 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 GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec notEqual(mat const& a, mat const& b, vec const& Epsilon) { - vec Result; + vec Result(true); for(length_t i = 0; i < C; ++i) Result[i] = any(notEqual(a[i], b[i], Epsilon[i])); return Result; diff --git a/test/core/core_type_mat4x4.cpp b/test/core/core_type_mat4x4.cpp index a056112c..0be87f18 100644 --- a/test/core/core_type_mat4x4.cpp +++ b/test/core/core_type_mat4x4.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include template @@ -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;