From 7eef79c9c75f171ee8259b685c29670e4be0defd Mon Sep 17 00:00:00 2001 From: RohacekD Date: Tue, 8 Dec 2020 01:27:49 +0100 Subject: [PATCH] Adding constexpr for dot, cross and inverse quaternion functions --- glm/ext/quaternion_common.hpp | 2 +- glm/ext/quaternion_common.inl | 2 +- glm/ext/quaternion_geometric.hpp | 4 ++-- glm/ext/quaternion_geometric.inl | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/glm/ext/quaternion_common.hpp b/glm/ext/quaternion_common.hpp index c9163609..a2a43463 100644 --- a/glm/ext/quaternion_common.hpp +++ b/glm/ext/quaternion_common.hpp @@ -103,7 +103,7 @@ namespace glm /// @tparam T A floating-point scalar type /// @tparam Q A value from qualifier enum template - GLM_FUNC_DECL qua inverse(qua const& q); + GLM_FUNC_DECL GLM_CONSTEXPR qua inverse(qua const& q); /// Returns true if x holds a NaN (not a number) /// representation in the underlying implementation's set of diff --git a/glm/ext/quaternion_common.inl b/glm/ext/quaternion_common.inl index 4d6869e5..4b4d0f80 100644 --- a/glm/ext/quaternion_common.inl +++ b/glm/ext/quaternion_common.inl @@ -116,7 +116,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER qua inverse(qua const& q) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua inverse(qua const& q) { return conjugate(q) / dot(q, q); } diff --git a/glm/ext/quaternion_geometric.hpp b/glm/ext/quaternion_geometric.hpp index 6d98bbe9..da9711c7 100644 --- a/glm/ext/quaternion_geometric.hpp +++ b/glm/ext/quaternion_geometric.hpp @@ -53,7 +53,7 @@ namespace glm /// /// @see ext_quaternion_geometric template - GLM_FUNC_DECL T dot(qua const& x, qua const& y); + GLM_FUNC_DECL GLM_CONSTEXPR T dot(qua const& x, qua const& y); /// Compute a cross product. /// @@ -62,7 +62,7 @@ namespace glm /// /// @see ext_quaternion_geometric template - GLM_FUNC_QUALIFIER qua cross(qua const& q1, qua const& q2); + GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua cross(qua const& q1, qua const& q2); /// @} } //namespace glm diff --git a/glm/ext/quaternion_geometric.inl b/glm/ext/quaternion_geometric.inl index e155ac52..73351909 100644 --- a/glm/ext/quaternion_geometric.inl +++ b/glm/ext/quaternion_geometric.inl @@ -1,7 +1,7 @@ namespace glm { template - GLM_FUNC_QUALIFIER T dot(qua const& x, qua const& y) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR T dot(qua const& x, qua const& y) { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'dot' accepts only floating-point inputs"); return detail::compute_dot, T, detail::is_aligned::value>::call(x, y); @@ -24,7 +24,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER qua cross(qua const& q1, qua const& q2) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua cross(qua const& q1, qua const& q2) { return qua( q1.w * q2.w - q1.x * q2.x - q1.y * q2.y - q1.z * q2.z,