diff --git a/glm/common.hpp b/glm/common.hpp index 32d71a2e..b59657d5 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. /// @@ -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 3a8551c9..8fcfd28b 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; } @@ -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), @@ -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); } diff --git a/glm/ext/matrix_transform.hpp b/glm/ext/matrix_transform.hpp index 3e688b91..52695b8b 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 ef2e9f34..40459bbb 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]; diff --git a/glm/ext/quaternion_common.hpp b/glm/ext/quaternion_common.hpp index f519d559..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. @@ -96,14 +96,14 @@ 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. /// /// @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 014a7ae1..c5ecf5ae 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"); @@ -110,13 +110,13 @@ namespace glm } template - GLM_FUNC_QUALIFIER qua conjugate(qua const& q) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua conjugate(qua const& q) { return qua::wxyz(q.w, -q.x, -q.y, -q.z); } 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 f4b9d6e6..6a2403fd 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 93bb6b9d..557a0cba 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::wxyz( q1.w * q2.w - q1.x * q2.x - q1.y * q2.y - q1.z * q2.z, 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 702ebabd..ea159f29 100644 --- a/glm/gtc/quaternion.inl +++ b/glm/gtc/quaternion.inl @@ -129,36 +129,36 @@ 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; + 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; } 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; + 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; } 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; + 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; } 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; + 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; 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); } diff --git a/glm/gtx/quaternion.hpp b/glm/gtx/quaternion.hpp index 259cd40b..35c372b8 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 838126e9..5e18899a 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; }