From 128cf5a35bb01f02c824881079e71f00726c98bb Mon Sep 17 00:00:00 2001 From: RohacekD Date: Tue, 8 Dec 2020 01:13:31 +0100 Subject: [PATCH 01/10] Adding constexpr for exterior product --- glm/gtx/exterior_product.hpp | 2 +- glm/gtx/exterior_product.inl | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/glm/gtx/exterior_product.hpp b/glm/gtx/exterior_product.hpp index 5522df78..7d6c2e19 100644 --- a/glm/gtx/exterior_product.hpp +++ b/glm/gtx/exterior_product.hpp @@ -37,7 +37,7 @@ namespace glm /// /// @see Exterior product template - GLM_FUNC_DECL T cross(vec<2, T, Q> const& v, vec<2, T, Q> const& u); + GLM_FUNC_DECL GLM_CONSTEXPR T cross(vec<2, T, Q> const& v, vec<2, T, Q> const& u); /// @} } //namespace glm diff --git a/glm/gtx/exterior_product.inl b/glm/gtx/exterior_product.inl index 93661fd3..d489142e 100644 --- a/glm/gtx/exterior_product.inl +++ b/glm/gtx/exterior_product.inl @@ -8,7 +8,7 @@ namespace detail template struct compute_cross_vec2 { - GLM_FUNC_QUALIFIER static T call(vec<2, T, Q> const& v, vec<2, T, Q> const& u) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR static T call(vec<2, T, Q> const& v, vec<2, T, Q> const& u) { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'cross' accepts only floating-point inputs"); @@ -18,7 +18,7 @@ namespace detail }//namespace detail template - GLM_FUNC_QUALIFIER T cross(vec<2, T, Q> const& x, vec<2, T, Q> const& y) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR T cross(vec<2, T, Q> const& x, vec<2, T, Q> const& y) { return detail::compute_cross_vec2::value>::call(x, y); } From 4c1d50810ebcc3facb8e21e4fc60647060430c3a Mon Sep 17 00:00:00 2001 From: RohacekD Date: Tue, 8 Dec 2020 01:19:39 +0100 Subject: [PATCH 02/10] Adding constexpr for conjugate --- glm/ext/quaternion_common.hpp | 2 +- glm/ext/quaternion_common.inl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/glm/ext/quaternion_common.hpp b/glm/ext/quaternion_common.hpp index f519d559..c9163609 100644 --- a/glm/ext/quaternion_common.hpp +++ b/glm/ext/quaternion_common.hpp @@ -96,7 +96,7 @@ namespace glm /// @tparam T A floating-point scalar type /// @tparam Q A value from qualifier enum template - GLM_FUNC_DECL qua conjugate(qua const& q); + GLM_FUNC_DECL GLM_CONSTEXPR qua conjugate(qua const& q); /// Returns the q inverse. /// diff --git a/glm/ext/quaternion_common.inl b/glm/ext/quaternion_common.inl index 0e4a3bb2..4d6869e5 100644 --- a/glm/ext/quaternion_common.inl +++ b/glm/ext/quaternion_common.inl @@ -110,7 +110,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER qua conjugate(qua const& q) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua conjugate(qua const& q) { return qua(q.w, -q.x, -q.y, -q.z); } From 39af05781f74bff45e92914ef4049092d6a4f8dc Mon Sep 17 00:00:00 2001 From: RohacekD Date: Tue, 8 Dec 2020 01:27:49 +0100 Subject: [PATCH 03/10] 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, From 1456d3836f5109b39f509d978a5189c19ab7a5d8 Mon Sep 17 00:00:00 2001 From: RohacekD Date: Tue, 8 Dec 2020 01:34:53 +0100 Subject: [PATCH 04/10] Adding constexpr for quat lerp --- glm/ext/quaternion_common.hpp | 2 +- glm/ext/quaternion_common.inl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/glm/ext/quaternion_common.hpp b/glm/ext/quaternion_common.hpp index a2a43463..f738692a 100644 --- a/glm/ext/quaternion_common.hpp +++ b/glm/ext/quaternion_common.hpp @@ -62,7 +62,7 @@ namespace glm /// @tparam T A floating-point scalar type /// @tparam Q A value from qualifier enum template - GLM_FUNC_DECL qua lerp(qua const& x, qua const& y, T a); + GLM_FUNC_DECL GLM_CONSTEXPR qua lerp(qua const& x, qua const& y, T a); /// Spherical linear interpolation of two quaternions. /// The interpolation always take the short path and the rotation is performed at constant speed. diff --git a/glm/ext/quaternion_common.inl b/glm/ext/quaternion_common.inl index 4b4d0f80..d19df8b4 100644 --- a/glm/ext/quaternion_common.inl +++ b/glm/ext/quaternion_common.inl @@ -26,7 +26,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER qua lerp(qua const& x, qua const& y, T a) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua lerp(qua const& x, qua const& y, T a) { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'lerp' only accept floating-point inputs"); From cc10137802b1f4a6d63b5294214827ea77712bf0 Mon Sep 17 00:00:00 2001 From: RohacekD Date: Tue, 8 Dec 2020 01:51:22 +0100 Subject: [PATCH 05/10] Adding constexpr to quaternion comparison functions lessThan, lessThanEqual, greaterThan, greaterThanEqual --- glm/gtc/quaternion.hpp | 8 ++++---- glm/gtc/quaternion.inl | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/glm/gtc/quaternion.hpp b/glm/gtc/quaternion.hpp index 359e072b..314449eb 100644 --- a/glm/gtc/quaternion.hpp +++ b/glm/gtc/quaternion.hpp @@ -112,7 +112,7 @@ namespace glm /// /// @see ext_quaternion_relational template - GLM_FUNC_DECL vec<4, bool, Q> lessThan(qua const& x, qua const& y); + GLM_FUNC_DECL GLM_CONSTEXPR vec<4, bool, Q> lessThan(qua const& x, qua const& y); /// Returns the component-wise comparison of result x <= y. /// @@ -121,7 +121,7 @@ namespace glm /// /// @see ext_quaternion_relational template - GLM_FUNC_DECL vec<4, bool, Q> lessThanEqual(qua const& x, qua const& y); + GLM_FUNC_DECL GLM_CONSTEXPR vec<4, bool, Q> lessThanEqual(qua const& x, qua const& y); /// Returns the component-wise comparison of result x > y. /// @@ -130,7 +130,7 @@ namespace glm /// /// @see ext_quaternion_relational template - GLM_FUNC_DECL vec<4, bool, Q> greaterThan(qua const& x, qua const& y); + GLM_FUNC_DECL GLM_CONSTEXPR vec<4, bool, Q> greaterThan(qua const& x, qua const& y); /// Returns the component-wise comparison of result x >= y. /// @@ -139,7 +139,7 @@ namespace glm /// /// @see ext_quaternion_relational template - GLM_FUNC_DECL vec<4, bool, Q> greaterThanEqual(qua const& x, qua const& y); + GLM_FUNC_DECL GLM_CONSTEXPR vec<4, bool, Q> greaterThanEqual(qua const& x, qua const& y); /// Build a look at quaternion based on the default handedness. /// diff --git a/glm/gtc/quaternion.inl b/glm/gtc/quaternion.inl index e1ef0321..5f328816 100644 --- a/glm/gtc/quaternion.inl +++ b/glm/gtc/quaternion.inl @@ -129,7 +129,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER vec<4, bool, Q> lessThan(qua const& x, qua const& y) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, bool, Q> lessThan(qua const& x, qua const& y) { vec<4, bool, Q> Result; for(length_t i = 0; i < x.length(); ++i) @@ -138,7 +138,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER vec<4, bool, Q> lessThanEqual(qua const& x, qua const& y) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, bool, Q> lessThanEqual(qua const& x, qua const& y) { vec<4, bool, Q> Result; for(length_t i = 0; i < x.length(); ++i) @@ -147,7 +147,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER vec<4, bool, Q> greaterThan(qua const& x, qua const& y) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, bool, Q> greaterThan(qua const& x, qua const& y) { vec<4, bool, Q> Result; for(length_t i = 0; i < x.length(); ++i) @@ -156,7 +156,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER vec<4, bool, Q> greaterThanEqual(qua const& x, qua const& y) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, bool, Q> greaterThanEqual(qua const& x, qua const& y) { vec<4, bool, Q> Result; for(length_t i = 0; i < x.length(); ++i) From 895acecb90b4303445098857c61c5b726b3a20c1 Mon Sep 17 00:00:00 2001 From: RohacekD Date: Tue, 8 Dec 2020 02:07:33 +0100 Subject: [PATCH 06/10] Adding constexpr for mix functions mix(scalar, scalar), mix(vec, vec, vec), mix(vec,vec,scalar) --- glm/common.hpp | 6 +++--- glm/detail/func_common.inl | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/glm/common.hpp b/glm/common.hpp index 0328dc91..f80d06ac 100644 --- a/glm/common.hpp +++ b/glm/common.hpp @@ -306,13 +306,13 @@ namespace glm /// glm::vec4 u = glm::mix(g, h, r); // Interpolations can be perform per component with a vector for the last parameter. /// @endcode template - GLM_FUNC_DECL genTypeT mix(genTypeT x, genTypeT y, genTypeU a); + GLM_FUNC_DECL GLM_CONSTEXPR genTypeT mix(genTypeT x, genTypeT y, genTypeU a); template - GLM_FUNC_DECL vec mix(vec const& x, vec const& y, vec const& a); + GLM_FUNC_DECL GLM_CONSTEXPR vec mix(vec const& x, vec const& y, vec const& a); template - GLM_FUNC_DECL vec mix(vec const& x, vec const& y, U a); + GLM_FUNC_DECL GLM_CONSTEXPR vec mix(vec const& x, vec const& y, U a); /// Returns 0.0 if x < edge, otherwise it returns 1.0 for each component of a genType. /// diff --git a/glm/detail/func_common.inl b/glm/detail/func_common.inl index 4b5f1441..301b2403 100644 --- a/glm/detail/func_common.inl +++ b/glm/detail/func_common.inl @@ -80,7 +80,7 @@ namespace detail template struct compute_mix_vector { - GLM_FUNC_QUALIFIER static vec call(vec const& x, vec const& y, vec const& a) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR static vec call(vec const& x, vec const& y, vec const& a) { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE, "'mix' only accept floating-point inputs for the interpolator a"); @@ -91,7 +91,7 @@ namespace detail template struct compute_mix_vector { - GLM_FUNC_QUALIFIER static vec call(vec const& x, vec const& y, vec const& a) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR static vec call(vec const& x, vec const& y, vec const& a) { vec Result; for(length_t i = 0; i < x.length(); ++i) @@ -103,7 +103,7 @@ namespace detail template struct compute_mix_scalar { - GLM_FUNC_QUALIFIER static vec call(vec const& x, vec const& y, U const& a) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR static vec call(vec const& x, vec const& y, U const& a) { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE, "'mix' only accept floating-point inputs for the interpolator a"); @@ -114,7 +114,7 @@ namespace detail template struct compute_mix_scalar { - GLM_FUNC_QUALIFIER static vec call(vec const& x, vec const& y, bool const& a) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR static vec call(vec const& x, vec const& y, bool const& a) { return a ? y : x; } @@ -123,7 +123,7 @@ namespace detail template struct compute_mix { - GLM_FUNC_QUALIFIER static T call(T const& x, T const& y, U const& a) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR static T call(T const& x, T const& y, U const& a) { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE, "'mix' only accept floating-point inputs for the interpolator a"); @@ -134,7 +134,7 @@ namespace detail template struct compute_mix { - GLM_FUNC_QUALIFIER static T call(T const& x, T const& y, bool const& a) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR static T call(T const& x, T const& y, bool const& a) { return a ? y : x; } @@ -523,19 +523,19 @@ namespace detail } template - GLM_FUNC_QUALIFIER genTypeT mix(genTypeT x, genTypeT y, genTypeU a) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR genTypeT mix(genTypeT x, genTypeT y, genTypeU a) { return detail::compute_mix::call(x, y, a); } template - GLM_FUNC_QUALIFIER vec mix(vec const& x, vec const& y, U a) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec mix(vec const& x, vec const& y, U a) { return detail::compute_mix_scalar::value>::call(x, y, a); } template - GLM_FUNC_QUALIFIER vec mix(vec const& x, vec const& y, vec const& a) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec mix(vec const& x, vec const& y, vec const& a) { return detail::compute_mix_vector::value>::call(x, y, a); } From cbaddcbac44f598ffa322e3a8438afb50f8a8169 Mon Sep 17 00:00:00 2001 From: RohacekD Date: Tue, 8 Dec 2020 02:13:21 +0100 Subject: [PATCH 07/10] Adding constexpr for sign(vec) and sign(genFIType) --- glm/common.hpp | 2 +- glm/detail/func_common.inl | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/glm/common.hpp b/glm/common.hpp index f80d06ac..ae228ee9 100644 --- a/glm/common.hpp +++ b/glm/common.hpp @@ -51,7 +51,7 @@ namespace glm /// @see GLSL sign man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template - GLM_FUNC_DECL vec sign(vec const& x); + GLM_FUNC_DECL GLM_CONSTEXPR vec sign(vec const& x); /// Returns a value equal to the nearest integer that is less then or equal to x. /// diff --git a/glm/detail/func_common.inl b/glm/detail/func_common.inl index 301b2403..0b8ddd0c 100644 --- a/glm/detail/func_common.inl +++ b/glm/detail/func_common.inl @@ -143,7 +143,7 @@ namespace detail template struct compute_sign { - GLM_FUNC_QUALIFIER static vec call(vec const& x) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR static vec call(vec const& x) { return vec(glm::lessThan(vec(0), x)) - vec(glm::lessThan(x, vec(0))); } @@ -153,7 +153,7 @@ namespace detail template struct compute_sign { - GLM_FUNC_QUALIFIER static vec call(vec const& x) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR static vec call(vec const& x) { T const Shift(static_cast(sizeof(T) * 8 - 1)); vec const y(vec::type, Q>(-x) >> typename detail::make_unsigned::type(Shift)); @@ -281,7 +281,7 @@ namespace detail // sign // fast and works for any type template - GLM_FUNC_QUALIFIER genFIType sign(genFIType x) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR genFIType sign(genFIType x) { GLM_STATIC_ASSERT( std::numeric_limits::is_iec559 || (std::numeric_limits::is_signed && std::numeric_limits::is_integer), @@ -292,7 +292,7 @@ namespace detail } template - GLM_FUNC_QUALIFIER vec sign(vec const& x) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec sign(vec const& x) { GLM_STATIC_ASSERT( std::numeric_limits::is_iec559 || (std::numeric_limits::is_signed && std::numeric_limits::is_integer), From a1293b5f1c4c48a5433a4801d124eb748b08c7f3 Mon Sep 17 00:00:00 2001 From: RohacekD Date: Tue, 8 Dec 2020 23:17:43 +0100 Subject: [PATCH 08/10] Initialize result lessThan, lessThanEqual, greaterThan, greaterThanEqual Default ctor used in constexpr contex generates warning on gcc --- glm/gtc/quaternion.inl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/glm/gtc/quaternion.inl b/glm/gtc/quaternion.inl index 5f328816..beb96236 100644 --- a/glm/gtc/quaternion.inl +++ b/glm/gtc/quaternion.inl @@ -131,7 +131,7 @@ namespace glm template GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, bool, Q> lessThan(qua const& x, qua const& y) { - vec<4, bool, Q> Result; + vec<4, bool, Q> Result(false, false, false, false); for(length_t i = 0; i < x.length(); ++i) Result[i] = x[i] < y[i]; return Result; @@ -140,7 +140,7 @@ namespace glm template GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, bool, Q> lessThanEqual(qua const& x, qua const& y) { - vec<4, bool, Q> Result; + vec<4, bool, Q> Result(false, false, false, false); for(length_t i = 0; i < x.length(); ++i) Result[i] = x[i] <= y[i]; return Result; @@ -149,7 +149,7 @@ namespace glm template GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, bool, Q> greaterThan(qua const& x, qua const& y) { - vec<4, bool, Q> Result; + vec<4, bool, Q> Result(false, false, false, false); for(length_t i = 0; i < x.length(); ++i) Result[i] = x[i] > y[i]; return Result; @@ -158,7 +158,7 @@ namespace glm template GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, bool, Q> greaterThanEqual(qua const& x, qua const& y) { - vec<4, bool, Q> Result; + vec<4, bool, Q> Result(false, false, false, false); for(length_t i = 0; i < x.length(); ++i) Result[i] = x[i] >= y[i]; return Result; From 7d25e2d2a9201042603cbf558d9c172a2fc9f40f Mon Sep 17 00:00:00 2001 From: RohacekD Date: Tue, 8 Dec 2020 23:19:33 +0100 Subject: [PATCH 09/10] Adding constexpr to cross(vec, qua) and cross(qua, vec) --- glm/gtx/quaternion.hpp | 4 ++-- glm/gtx/quaternion.inl | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/glm/gtx/quaternion.hpp b/glm/gtx/quaternion.hpp index 5c2b5ad0..319f320c 100644 --- a/glm/gtx/quaternion.hpp +++ b/glm/gtx/quaternion.hpp @@ -43,7 +43,7 @@ namespace glm /// /// @see gtx_quaternion template - GLM_FUNC_DECL vec<3, T, Q> cross( + GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> cross( qua const& q, vec<3, T, Q> const& v); @@ -51,7 +51,7 @@ namespace glm /// /// @see gtx_quaternion template - GLM_FUNC_DECL vec<3, T, Q> cross( + GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> cross( vec<3, T, Q> const& v, qua const& q); diff --git a/glm/gtx/quaternion.inl b/glm/gtx/quaternion.inl index d125bccc..eea38a02 100644 --- a/glm/gtx/quaternion.inl +++ b/glm/gtx/quaternion.inl @@ -12,13 +12,13 @@ namespace glm } template - GLM_FUNC_QUALIFIER vec<3, T, Q> cross(vec<3, T, Q> const& v, qua const& q) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<3, T, Q> cross(vec<3, T, Q> const& v, qua const& q) { return inverse(q) * v; } template - GLM_FUNC_QUALIFIER vec<3, T, Q> cross(qua const& q, vec<3, T, Q> const& v) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<3, T, Q> cross(qua const& q, vec<3, T, Q> const& v) { return q * v; } From a4dba3cbbfb77638a62565d3ae965afdb9e6a977 Mon Sep 17 00:00:00 2001 From: RohacekD Date: Tue, 8 Dec 2020 23:40:29 +0100 Subject: [PATCH 10/10] Adding constexpr to glm::translate --- glm/ext/matrix_transform.hpp | 2 +- glm/ext/matrix_transform.inl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/glm/ext/matrix_transform.hpp b/glm/ext/matrix_transform.hpp index cbd187ef..71492146 100644 --- a/glm/ext/matrix_transform.hpp +++ b/glm/ext/matrix_transform.hpp @@ -61,7 +61,7 @@ namespace glm /// @see - translate(vec<3, T, Q> const& v) /// @see glTranslate man page template - GLM_FUNC_DECL mat<4, 4, T, Q> translate( + GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 4, T, Q> translate( mat<4, 4, T, Q> const& m, vec<3, T, Q> const& v); /// Builds a rotation 4 * 4 matrix created from an axis vector and an angle. diff --git a/glm/ext/matrix_transform.inl b/glm/ext/matrix_transform.inl index 01cefab6..d540f84a 100644 --- a/glm/ext/matrix_transform.inl +++ b/glm/ext/matrix_transform.inl @@ -7,7 +7,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER mat<4, 4, T, Q> translate(mat<4, 4, T, Q> const& m, vec<3, T, Q> const& v) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 4, T, Q> translate(mat<4, 4, T, Q> const& m, vec<3, T, Q> const& v) { mat<4, 4, T, Q> Result(m); Result[3] = m[0] * v[0] + m[1] * v[1] + m[2] * v[2] + m[3];