From 1c4afdb7f672f710a6582a9dd8c1685d8bf987f9 Mon Sep 17 00:00:00 2001 From: christophe Date: Mon, 25 Dec 2023 11:35:10 +0100 Subject: [PATCH] Add GLM_FORCE_UNRESTRICTED_SCALAR_TYPES --- glm/detail/compute_common.hpp | 3 +- glm/detail/func_common.inl | 82 +++++++++++++++++++++---------- glm/detail/func_exponential.inl | 11 +++-- glm/detail/func_matrix.inl | 10 ++-- glm/detail/func_trigonometric.inl | 12 ++--- glm/detail/setup.hpp | 9 ++++ glm/ext/quaternion_common.inl | 12 ++--- glm/ext/quaternion_geometric.inl | 2 +- glm/ext/scalar_common.inl | 18 +++---- glm/ext/scalar_constants.inl | 4 +- glm/ext/scalar_integer.inl | 4 +- glm/ext/scalar_reciprocal.inl | 24 ++++----- glm/ext/scalar_ulp.inl | 4 +- glm/ext/vector_reciprocal.inl | 24 ++++----- glm/gtc/ulp.inl | 4 +- glm/gtx/common.inl | 10 ++-- glm/gtx/exterior_product.inl | 2 +- glm/gtx/fast_square_root.inl | 6 +-- glm/gtx/vector_angle.inl | 8 +-- 19 files changed, 147 insertions(+), 102 deletions(-) diff --git a/glm/detail/compute_common.hpp b/glm/detail/compute_common.hpp index 0952195f..c176cb3d 100644 --- a/glm/detail/compute_common.hpp +++ b/glm/detail/compute_common.hpp @@ -16,7 +16,7 @@ namespace detail GLM_FUNC_QUALIFIER GLM_CONSTEXPR static genFIType call(genFIType x) { GLM_STATIC_ASSERT( - std::numeric_limits::is_iec559 || std::numeric_limits::is_signed, + std::numeric_limits::is_iec559 || std::numeric_limits::is_signed || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'abs' only accept floating-point and integer scalar or vector inputs"); return x >= genFIType(0) ? x : -x; @@ -43,6 +43,7 @@ namespace detail GLM_STATIC_ASSERT( (!std::numeric_limits::is_signed && std::numeric_limits::is_integer), "'abs' only accept floating-point and integer scalar or vector inputs"); + return x; } }; diff --git a/glm/detail/func_common.inl b/glm/detail/func_common.inl index 6bdf9c7c..006e5e62 100644 --- a/glm/detail/func_common.inl +++ b/glm/detail/func_common.inl @@ -16,7 +16,10 @@ namespace glm template GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType min(genType x, genType y) { +#if GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES == GLM_ENABLE GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || std::numeric_limits::is_integer, "'min' only accept floating-point or integer inputs"); +#endif + return (y < x) ? y : x; } @@ -29,7 +32,9 @@ namespace glm template GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType max(genType x, genType y) { +#if GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES == GLM_ENABLE GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || std::numeric_limits::is_integer, "'max' only accept floating-point or integer inputs"); +#endif return (x < y) ? y : x; } @@ -59,7 +64,9 @@ namespace glm template GLM_FUNC_QUALIFIER genType round(genType x) { +#if GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES == GLM_ENABLE GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'round' only accept floating-point inputs"); +#endif return x < static_cast(0) ? static_cast(int(x - static_cast(0.5))) : static_cast(int(x + static_cast(0.5))); } @@ -77,7 +84,9 @@ namespace glm template GLM_FUNC_QUALIFIER genType trunc(genType x) { +#if GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES == GLM_ENABLE GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'trunc' only accept floating-point inputs"); +#endif return x < static_cast(0) ? -std::floor(-x) : std::floor(x); } @@ -112,7 +121,9 @@ namespace detail { GLM_FUNC_QUALIFIER static vec call(vec const& x, vec const& y, vec const& a) { +#if GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES == GLM_ENABLE GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE, "'mix' only accept floating-point inputs for the interpolator a"); +#endif return vec(vec(x) * (static_cast(1) - a) + vec(y) * a); } @@ -135,7 +146,9 @@ namespace detail { GLM_FUNC_QUALIFIER static vec call(vec const& x, vec const& y, U const& a) { +#if GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES == GLM_ENABLE GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE, "'mix' only accept floating-point inputs for the interpolator a"); +#endif return vec(vec(x) * (static_cast(1) - a) + vec(y) * a); } @@ -155,7 +168,9 @@ namespace detail { GLM_FUNC_QUALIFIER static T call(T const& x, T const& y, U const& a) { +#if GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES == GLM_ENABLE GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE, "'mix' only accept floating-point inputs for the interpolator a"); +#endif return static_cast(static_cast(x) * (static_cast(1) - a) + static_cast(y) * a); } @@ -243,7 +258,10 @@ namespace detail { GLM_FUNC_QUALIFIER static vec call(vec const& a, vec const& b) { +#if GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES == GLM_ENABLE GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'mod' only accept floating-point inputs. Include for integer inputs."); +#endif + return a - b * floor(a / b); } }; @@ -298,7 +316,9 @@ namespace detail { GLM_FUNC_QUALIFIER static vec call(vec const& edge0, vec const& edge1, vec const& x) { +#if GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES == GLM_ENABLE GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE, "'smoothstep' only accept floating-point inputs"); +#endif vec const tmp(clamp((x - edge0) / (edge1 - edge0), static_cast(0), static_cast(1))); return tmp * tmp * (static_cast(3) - static_cast(2) * tmp); } @@ -373,7 +393,7 @@ namespace detail 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), + std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES || (std::numeric_limits::is_signed && std::numeric_limits::is_integer), "'sign' only accept signed inputs"); return detail::compute_sign<1, genFIType, defaultp, @@ -384,7 +404,7 @@ namespace detail 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), + std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES || (std::numeric_limits::is_signed && std::numeric_limits::is_integer), "'sign' only accept signed inputs"); return detail::compute_sign::is_iec559, detail::is_aligned::value>::call(x); @@ -395,21 +415,24 @@ namespace detail template GLM_FUNC_QUALIFIER vec floor(vec const& x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'floor' only accept floating-point inputs."); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'floor' only accept floating-point inputs."); + return detail::compute_floor::value>::call(x); } template GLM_FUNC_QUALIFIER vec trunc(vec const& x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'trunc' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'trunc' only accept floating-point inputs"); + return detail::compute_trunc::value>::call(x); } template GLM_FUNC_QUALIFIER vec round(vec const& x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'round' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'round' only accept floating-point inputs"); + return detail::compute_round::value>::call(x); } @@ -418,7 +441,7 @@ namespace detail template GLM_FUNC_QUALIFIER genType roundEven(genType const& x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'roundEven' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'roundEven' only accept floating-point inputs"); return genType(int(x + genType(int(x) % 2))); } @@ -428,7 +451,7 @@ namespace detail template GLM_FUNC_QUALIFIER genType roundEven(genType x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'roundEven' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'roundEven' only accept floating-point inputs"); int Integer = static_cast(x); genType IntegerPart = static_cast(Integer); @@ -459,7 +482,8 @@ namespace detail template GLM_FUNC_QUALIFIER vec roundEven(vec const& x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'roundEven' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'roundEven' only accept floating-point inputs"); + return detail::functor1::call(roundEven, x); } @@ -468,7 +492,8 @@ namespace detail template GLM_FUNC_QUALIFIER vec ceil(vec const& x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'ceil' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'ceil' only accept floating-point inputs"); + return detail::compute_ceil::value>::call(x); } @@ -482,7 +507,8 @@ namespace detail template GLM_FUNC_QUALIFIER vec fract(vec const& x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'fract' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'fract' only accept floating-point inputs"); + return detail::compute_fract::value>::call(x); } @@ -570,7 +596,8 @@ namespace detail template GLM_FUNC_QUALIFIER genType modf(genType x, genType & i) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'modf' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'modf' only accept floating-point inputs"); + return std::modf(x, &i); } @@ -620,7 +647,8 @@ namespace detail template GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec min(vec const& a, T b) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || std::numeric_limits::is_integer, "'min' only accept floating-point or integer inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || std::numeric_limits::is_integer || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'min' only accept floating-point or integer inputs"); + return detail::compute_min_vector::value>::call(a, vec(b)); } @@ -634,7 +662,8 @@ namespace detail template GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec max(vec const& a, T b) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || std::numeric_limits::is_integer, "'max' only accept floating-point or integer inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || std::numeric_limits::is_integer || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'max' only accept floating-point or integer inputs"); + return detail::compute_max_vector::value>::call(a, vec(b)); } @@ -648,21 +677,24 @@ namespace detail template GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType clamp(genType x, genType minVal, genType maxVal) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || std::numeric_limits::is_integer, "'clamp' only accept floating-point or integer inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || std::numeric_limits::is_integer || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'clamp' only accept floating-point or integer inputs"); + return min(max(x, minVal), maxVal); } template GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec clamp(vec const& x, T minVal, T maxVal) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || std::numeric_limits::is_integer, "'clamp' only accept floating-point or integer inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || std::numeric_limits::is_integer || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'clamp' only accept floating-point or integer inputs"); + return detail::compute_clamp_vector::value>::call(x, vec(minVal), vec(maxVal)); } template GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec clamp(vec const& x, vec const& minVal, vec const& maxVal) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || std::numeric_limits::is_integer, "'clamp' only accept floating-point or integer inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || std::numeric_limits::is_integer || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'clamp' only accept floating-point or integer inputs"); + return detail::compute_clamp_vector::value>::call(x, minVal, maxVal); } @@ -707,7 +739,7 @@ namespace detail template GLM_FUNC_QUALIFIER genType smoothstep(genType edge0, genType edge1, genType x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE, "'smoothstep' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'smoothstep' only accept floating-point inputs"); genType const tmp(clamp((x - edge0) / (edge1 - edge0), genType(0), genType(1))); return tmp * tmp * (genType(3) - genType(2) * tmp); @@ -731,7 +763,7 @@ namespace detail template GLM_FUNC_QUALIFIER bool isnan(genType x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'isnan' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'isnan' only accept floating-point inputs"); # if GLM_HAS_CXX11_STL return std::isnan(x); @@ -756,7 +788,7 @@ namespace detail template GLM_FUNC_QUALIFIER vec isnan(vec const& v) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'isnan' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'isnan' only accept floating-point inputs"); vec Result; for (length_t l = 0; l < v.length(); ++l) @@ -770,7 +802,7 @@ namespace detail template GLM_FUNC_QUALIFIER bool isinf(genType x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'isinf' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'isinf' only accept floating-point inputs"); # if GLM_HAS_CXX11_STL return std::isinf(x); @@ -798,7 +830,7 @@ namespace detail template GLM_FUNC_QUALIFIER vec isinf(vec const& v) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'isinf' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'isinf' only accept floating-point inputs"); vec Result; for (length_t l = 0; l < v.length(); ++l) @@ -895,7 +927,7 @@ namespace detail template GLM_FUNC_QUALIFIER genType frexp(genType x, int& exp) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'frexp' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'frexp' only accept floating-point inputs"); return std::frexp(x, &exp); } @@ -903,7 +935,7 @@ namespace detail template GLM_FUNC_QUALIFIER vec frexp(vec const& v, vec& exp) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'frexp' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'frexp' only accept floating-point inputs"); vec Result; for (length_t l = 0; l < v.length(); ++l) @@ -914,7 +946,7 @@ namespace detail template GLM_FUNC_QUALIFIER genType ldexp(genType const& x, int const& exp) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'ldexp' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'ldexp' only accept floating-point inputs"); return std::ldexp(x, exp); } @@ -922,7 +954,7 @@ namespace detail template GLM_FUNC_QUALIFIER vec ldexp(vec const& v, vec const& exp) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'ldexp' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'ldexp' only accept floating-point inputs"); vec Result; for (length_t l = 0; l < v.length(); ++l) diff --git a/glm/detail/func_exponential.inl b/glm/detail/func_exponential.inl index 2040d41f..b3e8dea7 100644 --- a/glm/detail/func_exponential.inl +++ b/glm/detail/func_exponential.inl @@ -25,8 +25,9 @@ namespace detail { GLM_FUNC_QUALIFIER static vec call(vec const& v) { +#if GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES == GLM_ENABLE GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'log2' only accept floating-point inputs. Include for integer inputs."); - +#endif return detail::functor1::call(log2, v); } }; @@ -97,7 +98,7 @@ namespace detail template GLM_FUNC_QUALIFIER genType exp2(genType x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'exp2' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'exp2' only accept floating-point inputs"); return std::exp(static_cast(0.69314718055994530941723212145818) * x); } @@ -127,7 +128,8 @@ namespace detail template GLM_FUNC_QUALIFIER vec sqrt(vec const& x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'sqrt' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'sqrt' only accept floating-point inputs"); + return detail::compute_sqrt::value>::call(x); } @@ -141,7 +143,8 @@ namespace detail template GLM_FUNC_QUALIFIER vec inversesqrt(vec const& x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'inversesqrt' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'inversesqrt' only accept floating-point inputs"); + return detail::compute_inversesqrt::value>::call(x); } }//namespace glm diff --git a/glm/detail/func_matrix.inl b/glm/detail/func_matrix.inl index 4c59fb90..50550d31 100644 --- a/glm/detail/func_matrix.inl +++ b/glm/detail/func_matrix.inl @@ -20,7 +20,7 @@ namespace detail struct compute_matrixCompMult_type { GLM_FUNC_QUALIFIER static mat call(mat const& x, mat const& y) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE, + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'matrixCompMult' only accept floating-point inputs, include to discard this restriction."); return detail::compute_matrixCompMult::value>::call(x, y); } @@ -41,7 +41,7 @@ namespace detail struct compute_outerProduct_type { GLM_FUNC_QUALIFIER static typename detail::outerProduct_trait::type call(vec const& c, vec const& r) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE, + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'outerProduct' only accept floating-point inputs, include to discard this restriction."); return detail::compute_outerProduct::call(c, r); @@ -231,7 +231,7 @@ namespace detail struct compute_transpose_type { GLM_FUNC_QUALIFIER static mat call(mat const& m) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE, + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'transpose' only accept floating-point inputs, include to discard this restriction."); return detail::compute_transpose::value>::call(m); } @@ -290,7 +290,7 @@ namespace detail GLM_FUNC_QUALIFIER static T call(mat const& m) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE, + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'determinant' only accept floating-point inputs, include to discard this restriction."); return detail::compute_determinant::value>::call(m); } @@ -473,7 +473,7 @@ namespace detail template GLM_FUNC_QUALIFIER mat inverse(mat const& m) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE, "'inverse' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'inverse' only accept floating-point inputs"); return detail::compute_inverse::value>::call(m); } }//namespace glm diff --git a/glm/detail/func_trigonometric.inl b/glm/detail/func_trigonometric.inl index 6792d856..7716c44e 100644 --- a/glm/detail/func_trigonometric.inl +++ b/glm/detail/func_trigonometric.inl @@ -8,7 +8,7 @@ namespace glm template GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType radians(genType degrees) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'radians' only accept floating-point input"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'radians' only accept floating-point input"); return degrees * static_cast(0.01745329251994329576923690768489); } @@ -23,7 +23,7 @@ namespace glm template GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType degrees(genType radians) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'degrees' only accept floating-point input"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'degrees' only accept floating-point input"); return radians * static_cast(57.295779513082320876798154814105); } @@ -83,7 +83,7 @@ namespace glm template GLM_FUNC_QUALIFIER genType atan(genType y, genType x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'atan' only accept floating-point input"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'atan' only accept floating-point input"); return ::std::atan2(y, x); } @@ -136,7 +136,7 @@ namespace glm template GLM_FUNC_QUALIFIER genType asinh(genType x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'asinh' only accept floating-point input"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'asinh' only accept floating-point input"); return (x < static_cast(0) ? static_cast(-1) : (x > static_cast(0) ? static_cast(1) : static_cast(0))) * log(std::abs(x) + sqrt(static_cast(1) + x * x)); } @@ -155,7 +155,7 @@ namespace glm template GLM_FUNC_QUALIFIER genType acosh(genType x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'acosh' only accept floating-point input"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'acosh' only accept floating-point input"); if(x < static_cast(1)) return static_cast(0); @@ -176,7 +176,7 @@ namespace glm template GLM_FUNC_QUALIFIER genType atanh(genType x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'atanh' only accept floating-point input"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'atanh' only accept floating-point input"); if(std::abs(x) >= static_cast(1)) return 0; diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index 9c565ec6..663d3d80 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -528,6 +528,15 @@ # define GLM_CONFIG_UNRESTRICTED_GENTYPE GLM_DISABLE #endif +/////////////////////////////////////////////////////////////////////////////////// +// Allows using any scalar types as float. + +#ifdef GLM_FORCE_UNRESTRICTED_SCALAR_TYPES +# define GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES GLM_ENABLE +#else +# define GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES GLM_DISABLE +#endif + /////////////////////////////////////////////////////////////////////////////////// // Clip control, define GLM_FORCE_DEPTH_ZERO_TO_ONE before including GLM // to use a clip space between 0 to 1. diff --git a/glm/ext/quaternion_common.inl b/glm/ext/quaternion_common.inl index c5ecf5ae..e77014fa 100644 --- a/glm/ext/quaternion_common.inl +++ b/glm/ext/quaternion_common.inl @@ -3,7 +3,7 @@ namespace glm template GLM_FUNC_QUALIFIER qua mix(qua const& x, qua const& y, T a) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'mix' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'mix' only accept floating-point inputs"); T const cosTheta = dot(x, y); @@ -28,7 +28,7 @@ namespace glm template 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"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'lerp' only accept floating-point inputs"); // Lerp is only defined in [0, 1] assert(a >= static_cast(0)); @@ -40,7 +40,7 @@ namespace glm template GLM_FUNC_QUALIFIER qua slerp(qua const& x, qua const& y, T a) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'slerp' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'slerp' only accept floating-point inputs"); qua z = y; @@ -75,7 +75,7 @@ namespace glm template GLM_FUNC_QUALIFIER qua slerp(qua const& x, qua const& y, T a, S k) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'slerp' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'slerp' only accept floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits::is_integer, "'slerp' only accept integer for spin count"); qua z = y; @@ -124,7 +124,7 @@ namespace glm template GLM_FUNC_QUALIFIER vec<4, bool, Q> isnan(qua const& q) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'isnan' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'isnan' only accept floating-point inputs"); return vec<4, bool, Q>(isnan(q.x), isnan(q.y), isnan(q.z), isnan(q.w)); } @@ -132,7 +132,7 @@ namespace glm template GLM_FUNC_QUALIFIER vec<4, bool, Q> isinf(qua const& q) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'isinf' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'isinf' only accept floating-point inputs"); return vec<4, bool, Q>(isinf(q.x), isinf(q.y), isinf(q.z), isinf(q.w)); } diff --git a/glm/ext/quaternion_geometric.inl b/glm/ext/quaternion_geometric.inl index 557a0cba..bf4fb4b8 100644 --- a/glm/ext/quaternion_geometric.inl +++ b/glm/ext/quaternion_geometric.inl @@ -3,7 +3,7 @@ namespace glm template 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"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'dot' accepts only floating-point inputs"); return detail::compute_dot, T, detail::is_aligned::value>::call(x, y); } diff --git a/glm/ext/scalar_common.inl b/glm/ext/scalar_common.inl index 2807a372..e364ca5c 100644 --- a/glm/ext/scalar_common.inl +++ b/glm/ext/scalar_common.inl @@ -30,7 +30,7 @@ namespace glm template GLM_FUNC_QUALIFIER T fmin(T a, T b) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'fmin' only accept floating-point input"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'fmin' only accept floating-point input"); if (isnan(a)) return b; @@ -41,7 +41,7 @@ namespace glm template GLM_FUNC_QUALIFIER T fmin(T a, T b, T c) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'fmin' only accept floating-point input"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'fmin' only accept floating-point input"); if (isnan(a)) return fmin(b, c); @@ -55,7 +55,7 @@ namespace glm template GLM_FUNC_QUALIFIER T fmin(T a, T b, T c, T d) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'fmin' only accept floating-point input"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'fmin' only accept floating-point input"); if (isnan(a)) return fmin(b, c, d); @@ -75,7 +75,7 @@ namespace glm template GLM_FUNC_QUALIFIER T fmax(T a, T b) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'fmax' only accept floating-point input"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'fmax' only accept floating-point input"); if (isnan(a)) return b; @@ -86,7 +86,7 @@ namespace glm template GLM_FUNC_QUALIFIER T fmax(T a, T b, T c) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'fmax' only accept floating-point input"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'fmax' only accept floating-point input"); if (isnan(a)) return fmax(b, c); @@ -100,7 +100,7 @@ namespace glm template GLM_FUNC_QUALIFIER T fmax(T a, T b, T c, T d) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'fmax' only accept floating-point input"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'fmax' only accept floating-point input"); if (isnan(a)) return fmax(b, c, d); @@ -117,7 +117,7 @@ namespace glm template GLM_FUNC_QUALIFIER genType fclamp(genType x, genType minVal, genType maxVal) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'fclamp' only accept floating-point or integer inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'fclamp' only accept floating-point or integer inputs"); return fmin(fmax(x, minVal), maxVal); } @@ -153,7 +153,7 @@ namespace glm template GLM_FUNC_QUALIFIER int iround(genType const& x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'iround' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'iround' only accept floating-point inputs"); assert(static_cast(0.0) <= x); return static_cast(x + static_cast(0.5)); @@ -162,7 +162,7 @@ namespace glm template GLM_FUNC_QUALIFIER uint uround(genType const& x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'uround' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'uround' only accept floating-point inputs"); assert(static_cast(0.0) <= x); return static_cast(x + static_cast(0.5)); diff --git a/glm/ext/scalar_constants.inl b/glm/ext/scalar_constants.inl index b475adf8..b23c3f68 100644 --- a/glm/ext/scalar_constants.inl +++ b/glm/ext/scalar_constants.inl @@ -5,14 +5,14 @@ namespace glm template GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType epsilon() { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'epsilon' only accepts floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'epsilon' only accepts floating-point inputs"); return std::numeric_limits::epsilon(); } template GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType pi() { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'pi' only accepts floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'pi' only accepts floating-point inputs"); return static_cast(3.14159265358979323846264338327950288); } diff --git a/glm/ext/scalar_integer.inl b/glm/ext/scalar_integer.inl index efba9600..1730fc0a 100644 --- a/glm/ext/scalar_integer.inl +++ b/glm/ext/scalar_integer.inl @@ -26,7 +26,7 @@ namespace detail { GLM_FUNC_QUALIFIER static vec call(vec const& x) { - GLM_STATIC_ASSERT(!std::numeric_limits::is_iec559, "'ceilPowerOfTwo' only accept integer scalar or vector inputs"); + GLM_STATIC_ASSERT(!std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'ceilPowerOfTwo' only accept integer scalar or vector inputs"); vec const Sign(sign(x)); @@ -48,7 +48,7 @@ namespace detail { GLM_FUNC_QUALIFIER static vec call(vec const& x) { - GLM_STATIC_ASSERT(!std::numeric_limits::is_iec559, "'ceilPowerOfTwo' only accept integer scalar or vector inputs"); + GLM_STATIC_ASSERT(!std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'ceilPowerOfTwo' only accept integer scalar or vector inputs"); vec v(x); diff --git a/glm/ext/scalar_reciprocal.inl b/glm/ext/scalar_reciprocal.inl index 570a406d..73b7c2c9 100644 --- a/glm/ext/scalar_reciprocal.inl +++ b/glm/ext/scalar_reciprocal.inl @@ -9,7 +9,7 @@ namespace glm template GLM_FUNC_QUALIFIER genType sec(genType angle) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'sec' only accept floating-point values"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'sec' only accept floating-point values"); return genType(1) / glm::cos(angle); } @@ -17,7 +17,7 @@ namespace glm template GLM_FUNC_QUALIFIER genType csc(genType angle) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'csc' only accept floating-point values"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'csc' only accept floating-point values"); return genType(1) / glm::sin(angle); } @@ -25,7 +25,7 @@ namespace glm template GLM_FUNC_QUALIFIER genType cot(genType angle) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'cot' only accept floating-point values"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'cot' only accept floating-point values"); genType const pi_over_2 = genType(3.1415926535897932384626433832795 / 2.0); return glm::tan(pi_over_2 - angle); @@ -35,7 +35,7 @@ namespace glm template GLM_FUNC_QUALIFIER genType asec(genType x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'asec' only accept floating-point values"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'asec' only accept floating-point values"); return acos(genType(1) / x); } @@ -43,7 +43,7 @@ namespace glm template GLM_FUNC_QUALIFIER genType acsc(genType x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'acsc' only accept floating-point values"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'acsc' only accept floating-point values"); return asin(genType(1) / x); } @@ -51,7 +51,7 @@ namespace glm template GLM_FUNC_QUALIFIER genType acot(genType x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'acot' only accept floating-point values"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'acot' only accept floating-point values"); genType const pi_over_2 = genType(3.1415926535897932384626433832795 / 2.0); return pi_over_2 - atan(x); @@ -61,7 +61,7 @@ namespace glm template GLM_FUNC_QUALIFIER genType sech(genType angle) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'sech' only accept floating-point values"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'sech' only accept floating-point values"); return genType(1) / glm::cosh(angle); } @@ -69,7 +69,7 @@ namespace glm template GLM_FUNC_QUALIFIER genType csch(genType angle) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'csch' only accept floating-point values"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'csch' only accept floating-point values"); return genType(1) / glm::sinh(angle); } @@ -77,7 +77,7 @@ namespace glm template GLM_FUNC_QUALIFIER genType coth(genType angle) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'coth' only accept floating-point values"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'coth' only accept floating-point values"); return glm::cosh(angle) / glm::sinh(angle); } @@ -85,7 +85,7 @@ namespace glm template GLM_FUNC_QUALIFIER genType asech(genType x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'asech' only accept floating-point values"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'asech' only accept floating-point values"); return acosh(genType(1) / x); } @@ -93,7 +93,7 @@ namespace glm template GLM_FUNC_QUALIFIER genType acsch(genType x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'acsch' only accept floating-point values"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'acsch' only accept floating-point values"); return asinh(genType(1) / x); } @@ -101,7 +101,7 @@ namespace glm template GLM_FUNC_QUALIFIER genType acoth(genType x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'acoth' only accept floating-point values"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'acoth' only accept floating-point values"); return atanh(genType(1) / x); } }//namespace glm diff --git a/glm/ext/scalar_ulp.inl b/glm/ext/scalar_ulp.inl index 308df150..ac4db10a 100644 --- a/glm/ext/scalar_ulp.inl +++ b/glm/ext/scalar_ulp.inl @@ -219,7 +219,7 @@ namespace glm template GLM_FUNC_QUALIFIER T nextFloat(T x, int ULPs) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'next_float' only accept floating-point input"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'next_float' only accept floating-point input"); assert(ULPs >= 0); T temp = x; @@ -257,7 +257,7 @@ namespace glm template GLM_FUNC_QUALIFIER T prevFloat(T x, int ULPs) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'prev_float' only accept floating-point input"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'prev_float' only accept floating-point input"); assert(ULPs >= 0); T temp = x; diff --git a/glm/ext/vector_reciprocal.inl b/glm/ext/vector_reciprocal.inl index 0d3c25fb..0a61199c 100644 --- a/glm/ext/vector_reciprocal.inl +++ b/glm/ext/vector_reciprocal.inl @@ -9,7 +9,7 @@ namespace glm template GLM_FUNC_QUALIFIER vec sec(vec const& x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'sec' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'sec' only accept floating-point inputs"); return static_cast(1) / detail::functor1::call(cos, x); } @@ -17,7 +17,7 @@ namespace glm template GLM_FUNC_QUALIFIER vec csc(vec const& x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'csc' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'csc' only accept floating-point inputs"); return static_cast(1) / detail::functor1::call(sin, x); } @@ -25,7 +25,7 @@ namespace glm template GLM_FUNC_QUALIFIER vec cot(vec const& x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'cot' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'cot' only accept floating-point inputs"); T const pi_over_2 = static_cast(3.1415926535897932384626433832795 / 2.0); return detail::functor1::call(tan, pi_over_2 - x); } @@ -34,7 +34,7 @@ namespace glm template GLM_FUNC_QUALIFIER vec asec(vec const& x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'asec' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'asec' only accept floating-point inputs"); return detail::functor1::call(acos, static_cast(1) / x); } @@ -42,7 +42,7 @@ namespace glm template GLM_FUNC_QUALIFIER vec acsc(vec const& x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'acsc' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'acsc' only accept floating-point inputs"); return detail::functor1::call(asin, static_cast(1) / x); } @@ -50,7 +50,7 @@ namespace glm template GLM_FUNC_QUALIFIER vec acot(vec const& x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'acot' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'acot' only accept floating-point inputs"); T const pi_over_2 = static_cast(3.1415926535897932384626433832795 / 2.0); return pi_over_2 - detail::functor1::call(atan, x); } @@ -59,7 +59,7 @@ namespace glm template GLM_FUNC_QUALIFIER vec sech(vec const& x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'sech' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'sech' only accept floating-point inputs"); return static_cast(1) / detail::functor1::call(cosh, x); } @@ -67,7 +67,7 @@ namespace glm template GLM_FUNC_QUALIFIER vec csch(vec const& x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'csch' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'csch' only accept floating-point inputs"); return static_cast(1) / detail::functor1::call(sinh, x); } @@ -75,7 +75,7 @@ namespace glm template GLM_FUNC_QUALIFIER vec coth(vec const& x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'coth' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'coth' only accept floating-point inputs"); return glm::cosh(x) / glm::sinh(x); } @@ -83,7 +83,7 @@ namespace glm template GLM_FUNC_QUALIFIER vec asech(vec const& x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'asech' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'asech' only accept floating-point inputs"); return detail::functor1::call(acosh, static_cast(1) / x); } @@ -91,7 +91,7 @@ namespace glm template GLM_FUNC_QUALIFIER vec acsch(vec const& x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'acsch' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'acsch' only accept floating-point inputs"); return detail::functor1::call(asinh, static_cast(1) / x); } @@ -99,7 +99,7 @@ namespace glm template GLM_FUNC_QUALIFIER vec acoth(vec const& x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'acoth' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'acoth' only accept floating-point inputs"); return detail::functor1::call(atanh, static_cast(1) / x); } }//namespace glm diff --git a/glm/gtc/ulp.inl b/glm/gtc/ulp.inl index 4ecbd3f4..5d36d746 100644 --- a/glm/gtc/ulp.inl +++ b/glm/gtc/ulp.inl @@ -35,7 +35,7 @@ namespace glm template GLM_FUNC_QUALIFIER T next_float(T x, int ULPs) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'next_float' only accept floating-point input"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'next_float' only accept floating-point input"); assert(ULPs >= 0); T temp = x; @@ -73,7 +73,7 @@ namespace glm template GLM_FUNC_QUALIFIER T prev_float(T x, int ULPs) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'prev_float' only accept floating-point input"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'prev_float' only accept floating-point input"); assert(ULPs >= 0); T temp = x; diff --git a/glm/gtx/common.inl b/glm/gtx/common.inl index 60216258..edfd0753 100644 --- a/glm/gtx/common.inl +++ b/glm/gtx/common.inl @@ -29,7 +29,7 @@ namespace detail template GLM_FUNC_QUALIFIER bool isdenormal(T const& x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'isdenormal' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'isdenormal' only accept floating-point inputs"); # if GLM_HAS_CXX11_STL return std::fpclassify(x) == FP_SUBNORMAL; @@ -44,7 +44,7 @@ namespace detail vec<1, T, Q> const& x ) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'isdenormal' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'isdenormal' only accept floating-point inputs"); return typename vec<1, T, Q>::bool_type( isdenormal(x.x)); @@ -56,7 +56,7 @@ namespace detail vec<2, T, Q> const& x ) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'isdenormal' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'isdenormal' only accept floating-point inputs"); return typename vec<2, T, Q>::bool_type( isdenormal(x.x), @@ -69,7 +69,7 @@ namespace detail vec<3, T, Q> const& x ) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'isdenormal' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'isdenormal' only accept floating-point inputs"); return typename vec<3, T, Q>::bool_type( isdenormal(x.x), @@ -83,7 +83,7 @@ namespace detail vec<4, T, Q> const& x ) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'isdenormal' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'isdenormal' only accept floating-point inputs"); return typename vec<4, T, Q>::bool_type( isdenormal(x.x), diff --git a/glm/gtx/exterior_product.inl b/glm/gtx/exterior_product.inl index d489142e..0d62ce25 100644 --- a/glm/gtx/exterior_product.inl +++ b/glm/gtx/exterior_product.inl @@ -10,7 +10,7 @@ namespace detail { 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"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'cross' accepts only floating-point inputs"); return v.x * u.y - u.x * v.y; } diff --git a/glm/gtx/fast_square_root.inl b/glm/gtx/fast_square_root.inl index 4e6c6de9..3d47d8ff 100644 --- a/glm/gtx/fast_square_root.inl +++ b/glm/gtx/fast_square_root.inl @@ -6,7 +6,7 @@ namespace glm template GLM_FUNC_QUALIFIER genType fastSqrt(genType x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'fastSqrt' only accept floating-point input"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'fastSqrt' only accept floating-point input"); return genType(1) / fastInverseSqrt(x); } @@ -34,7 +34,7 @@ namespace glm template GLM_FUNC_QUALIFIER genType fastLength(genType x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'fastLength' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'fastLength' only accept floating-point inputs"); return abs(x); } @@ -42,7 +42,7 @@ namespace glm template GLM_FUNC_QUALIFIER T fastLength(vec const& x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'fastLength' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'fastLength' only accept floating-point inputs"); return fastSqrt(dot(x, x)); } diff --git a/glm/gtx/vector_angle.inl b/glm/gtx/vector_angle.inl index 878160d9..a0978930 100644 --- a/glm/gtx/vector_angle.inl +++ b/glm/gtx/vector_angle.inl @@ -9,21 +9,21 @@ namespace glm genType const& y ) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'angle' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'angle' only accept floating-point inputs"); return acos(clamp(dot(x, y), genType(-1), genType(1))); } template GLM_FUNC_QUALIFIER T angle(vec const& x, vec const& y) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'angle' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'angle' only accept floating-point inputs"); return acos(clamp(dot(x, y), T(-1), T(1))); } template GLM_FUNC_QUALIFIER T orientedAngle(vec<2, T, Q> const& x, vec<2, T, Q> const& y) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'orientedAngle' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'orientedAngle' only accept floating-point inputs"); T const Angle(acos(clamp(dot(x, y), T(-1), T(1)))); T const partialCross = x.x * y.y - y.x * x.y; @@ -37,7 +37,7 @@ namespace glm template GLM_FUNC_QUALIFIER T orientedAngle(vec<3, T, Q> const& x, vec<3, T, Q> const& y, vec<3, T, Q> const& ref) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'orientedAngle' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'orientedAngle' only accept floating-point inputs"); T const Angle(acos(clamp(dot(x, y), T(-1), T(1)))); return mix(Angle, -Angle, dot(ref, cross(x, y)) < T(0));