mirror of
https://github.com/g-truc/glm.git
synced 2024-11-25 01:44:35 +00:00
Add GLM_FORCE_UNRESTRICTED_SCALAR_TYPES
This commit is contained in:
parent
458882e46c
commit
1c4afdb7f6
@ -16,7 +16,7 @@ namespace detail
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR static genFIType call(genFIType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(
|
||||
std::numeric_limits<genFIType>::is_iec559 || std::numeric_limits<genFIType>::is_signed,
|
||||
std::numeric_limits<genFIType>::is_iec559 || std::numeric_limits<genFIType>::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<genFIType>::is_signed && std::numeric_limits<genFIType>::is_integer),
|
||||
"'abs' only accept floating-point and integer scalar or vector inputs");
|
||||
|
||||
return x;
|
||||
}
|
||||
};
|
||||
|
@ -16,7 +16,10 @@ namespace glm
|
||||
template<typename genType>
|
||||
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<genType>::is_iec559 || std::numeric_limits<genType>::is_integer, "'min' only accept floating-point or integer inputs");
|
||||
#endif
|
||||
|
||||
return (y < x) ? y : x;
|
||||
}
|
||||
|
||||
@ -29,7 +32,9 @@ namespace glm
|
||||
template<typename genType>
|
||||
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<genType>::is_iec559 || std::numeric_limits<genType>::is_integer, "'max' only accept floating-point or integer inputs");
|
||||
#endif
|
||||
|
||||
return (x < y) ? y : x;
|
||||
}
|
||||
@ -59,7 +64,9 @@ namespace glm
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType round(genType x)
|
||||
{
|
||||
#if GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES == GLM_ENABLE
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'round' only accept floating-point inputs");
|
||||
#endif
|
||||
|
||||
return x < static_cast<genType>(0) ? static_cast<genType>(int(x - static_cast<genType>(0.5))) : static_cast<genType>(int(x + static_cast<genType>(0.5)));
|
||||
}
|
||||
@ -77,7 +84,9 @@ namespace glm
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType trunc(genType x)
|
||||
{
|
||||
#if GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES == GLM_ENABLE
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'trunc' only accept floating-point inputs");
|
||||
#endif
|
||||
|
||||
return x < static_cast<genType>(0) ? -std::floor(-x) : std::floor(x);
|
||||
}
|
||||
@ -112,7 +121,9 @@ namespace detail
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& x, vec<L, T, Q> const& y, vec<L, U, Q> const& a)
|
||||
{
|
||||
#if GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES == GLM_ENABLE
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<U>::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE, "'mix' only accept floating-point inputs for the interpolator a");
|
||||
#endif
|
||||
|
||||
return vec<L, T, Q>(vec<L, U, Q>(x) * (static_cast<U>(1) - a) + vec<L, U, Q>(y) * a);
|
||||
}
|
||||
@ -135,7 +146,9 @@ namespace detail
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& x, vec<L, T, Q> const& y, U const& a)
|
||||
{
|
||||
#if GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES == GLM_ENABLE
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<U>::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE, "'mix' only accept floating-point inputs for the interpolator a");
|
||||
#endif
|
||||
|
||||
return vec<L, T, Q>(vec<L, U, Q>(x) * (static_cast<U>(1) - a) + vec<L, U, Q>(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<U>::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE, "'mix' only accept floating-point inputs for the interpolator a");
|
||||
#endif
|
||||
|
||||
return static_cast<T>(static_cast<U>(x) * (static_cast<U>(1) - a) + static_cast<U>(y) * a);
|
||||
}
|
||||
@ -243,7 +258,10 @@ namespace detail
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& a, vec<L, T, Q> const& b)
|
||||
{
|
||||
#if GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES == GLM_ENABLE
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'mod' only accept floating-point inputs. Include <glm/gtc/integer.hpp> for integer inputs.");
|
||||
#endif
|
||||
|
||||
return a - b * floor(a / b);
|
||||
}
|
||||
};
|
||||
@ -298,7 +316,9 @@ namespace detail
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& edge0, vec<L, T, Q> const& edge1, vec<L, T, Q> const& x)
|
||||
{
|
||||
#if GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES == GLM_ENABLE
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE, "'smoothstep' only accept floating-point inputs");
|
||||
#endif
|
||||
vec<L, T, Q> const tmp(clamp((x - edge0) / (edge1 - edge0), static_cast<T>(0), static_cast<T>(1)));
|
||||
return tmp * tmp * (static_cast<T>(3) - static_cast<T>(2) * tmp);
|
||||
}
|
||||
@ -373,7 +393,7 @@ namespace detail
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genFIType sign(genFIType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(
|
||||
std::numeric_limits<genFIType>::is_iec559 || (std::numeric_limits<genFIType>::is_signed && std::numeric_limits<genFIType>::is_integer),
|
||||
std::numeric_limits<genFIType>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES || (std::numeric_limits<genFIType>::is_signed && std::numeric_limits<genFIType>::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<L, T, Q> sign(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(
|
||||
std::numeric_limits<T>::is_iec559 || (std::numeric_limits<T>::is_signed && std::numeric_limits<T>::is_integer),
|
||||
std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES || (std::numeric_limits<T>::is_signed && std::numeric_limits<T>::is_integer),
|
||||
"'sign' only accept signed inputs");
|
||||
|
||||
return detail::compute_sign<L, T, Q, std::numeric_limits<T>::is_iec559, detail::is_aligned<Q>::value>::call(x);
|
||||
@ -395,21 +415,24 @@ namespace detail
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> floor(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'floor' only accept floating-point inputs.");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'floor' only accept floating-point inputs.");
|
||||
|
||||
return detail::compute_floor<L, T, Q, detail::is_aligned<Q>::value>::call(x);
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> trunc(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'trunc' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'trunc' only accept floating-point inputs");
|
||||
|
||||
return detail::compute_trunc<L, T, Q, detail::is_aligned<Q>::value>::call(x);
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> round(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'round' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'round' only accept floating-point inputs");
|
||||
|
||||
return detail::compute_round<L, T, Q, detail::is_aligned<Q>::value>::call(x);
|
||||
}
|
||||
|
||||
@ -418,7 +441,7 @@ namespace detail
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType roundEven(genType const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'roundEven' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::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<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType roundEven(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'roundEven' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'roundEven' only accept floating-point inputs");
|
||||
|
||||
int Integer = static_cast<int>(x);
|
||||
genType IntegerPart = static_cast<genType>(Integer);
|
||||
@ -459,7 +482,8 @@ namespace detail
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> roundEven(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'roundEven' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'roundEven' only accept floating-point inputs");
|
||||
|
||||
return detail::functor1<vec, L, T, T, Q>::call(roundEven, x);
|
||||
}
|
||||
|
||||
@ -468,7 +492,8 @@ namespace detail
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> ceil(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'ceil' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'ceil' only accept floating-point inputs");
|
||||
|
||||
return detail::compute_ceil<L, T, Q, detail::is_aligned<Q>::value>::call(x);
|
||||
}
|
||||
|
||||
@ -482,7 +507,8 @@ namespace detail
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> fract(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'fract' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'fract' only accept floating-point inputs");
|
||||
|
||||
return detail::compute_fract<L, T, Q, detail::is_aligned<Q>::value>::call(x);
|
||||
}
|
||||
|
||||
@ -570,7 +596,8 @@ namespace detail
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType modf(genType x, genType & i)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'modf' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::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<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> min(vec<L, T, Q> const& a, T b)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer, "'min' only accept floating-point or integer inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'min' only accept floating-point or integer inputs");
|
||||
|
||||
return detail::compute_min_vector<L, T, Q, detail::is_aligned<Q>::value>::call(a, vec<L, T, Q>(b));
|
||||
}
|
||||
|
||||
@ -634,7 +662,8 @@ namespace detail
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> max(vec<L, T, Q> const& a, T b)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer, "'max' only accept floating-point or integer inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'max' only accept floating-point or integer inputs");
|
||||
|
||||
return detail::compute_max_vector<L, T, Q, detail::is_aligned<Q>::value>::call(a, vec<L, T, Q>(b));
|
||||
}
|
||||
|
||||
@ -648,21 +677,24 @@ namespace detail
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType clamp(genType x, genType minVal, genType maxVal)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || std::numeric_limits<genType>::is_integer, "'clamp' only accept floating-point or integer inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || std::numeric_limits<genType>::is_integer || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'clamp' only accept floating-point or integer inputs");
|
||||
|
||||
return min(max(x, minVal), maxVal);
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> clamp(vec<L, T, Q> const& x, T minVal, T maxVal)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer, "'clamp' only accept floating-point or integer inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'clamp' only accept floating-point or integer inputs");
|
||||
|
||||
return detail::compute_clamp_vector<L, T, Q, detail::is_aligned<Q>::value>::call(x, vec<L, T, Q>(minVal), vec<L, T, Q>(maxVal));
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> clamp(vec<L, T, Q> const& x, vec<L, T, Q> const& minVal, vec<L, T, Q> const& maxVal)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer, "'clamp' only accept floating-point or integer inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'clamp' only accept floating-point or integer inputs");
|
||||
|
||||
return detail::compute_clamp_vector<L, T, Q, detail::is_aligned<Q>::value>::call(x, minVal, maxVal);
|
||||
}
|
||||
|
||||
@ -707,7 +739,7 @@ namespace detail
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType smoothstep(genType edge0, genType edge1, genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE, "'smoothstep' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::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<typename genType>
|
||||
GLM_FUNC_QUALIFIER bool isnan(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'isnan' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::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<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, bool, Q> isnan(vec<L, T, Q> const& v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'isnan' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'isnan' only accept floating-point inputs");
|
||||
|
||||
vec<L, bool, Q> Result;
|
||||
for (length_t l = 0; l < v.length(); ++l)
|
||||
@ -770,7 +802,7 @@ namespace detail
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER bool isinf(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'isinf' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::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<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, bool, Q> isinf(vec<L, T, Q> const& v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'isinf' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'isinf' only accept floating-point inputs");
|
||||
|
||||
vec<L, bool, Q> Result;
|
||||
for (length_t l = 0; l < v.length(); ++l)
|
||||
@ -895,7 +927,7 @@ namespace detail
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType frexp(genType x, int& exp)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'frexp' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::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<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> frexp(vec<L, T, Q> const& v, vec<L, int, Q>& exp)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'frexp' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'frexp' only accept floating-point inputs");
|
||||
|
||||
vec<L, T, Q> Result;
|
||||
for (length_t l = 0; l < v.length(); ++l)
|
||||
@ -914,7 +946,7 @@ namespace detail
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType ldexp(genType const& x, int const& exp)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'ldexp' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::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<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> ldexp(vec<L, T, Q> const& v, vec<L, int, Q> const& exp)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'ldexp' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'ldexp' only accept floating-point inputs");
|
||||
|
||||
vec<L, T, Q> Result;
|
||||
for (length_t l = 0; l < v.length(); ++l)
|
||||
|
@ -25,8 +25,9 @@ namespace detail
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& v)
|
||||
{
|
||||
#if GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES == GLM_ENABLE
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'log2' only accept floating-point inputs. Include <glm/gtc/integer.hpp> for integer inputs.");
|
||||
|
||||
#endif
|
||||
return detail::functor1<vec, L, T, T, Q>::call(log2, v);
|
||||
}
|
||||
};
|
||||
@ -97,7 +98,7 @@ namespace detail
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType exp2(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'exp2' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'exp2' only accept floating-point inputs");
|
||||
|
||||
return std::exp(static_cast<genType>(0.69314718055994530941723212145818) * x);
|
||||
}
|
||||
@ -127,7 +128,8 @@ namespace detail
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> sqrt(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'sqrt' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'sqrt' only accept floating-point inputs");
|
||||
|
||||
return detail::compute_sqrt<L, T, Q, detail::is_aligned<Q>::value>::call(x);
|
||||
}
|
||||
|
||||
@ -141,7 +143,8 @@ namespace detail
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> inversesqrt(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'inversesqrt' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'inversesqrt' only accept floating-point inputs");
|
||||
|
||||
return detail::compute_inversesqrt<L, T, Q, detail::is_aligned<Q>::value>::call(x);
|
||||
}
|
||||
}//namespace glm
|
||||
|
@ -20,7 +20,7 @@ namespace detail
|
||||
struct compute_matrixCompMult_type {
|
||||
GLM_FUNC_QUALIFIER static mat<C, R, T, Q> call(mat<C, R, T, Q> const& x, mat<C, R, T, Q> const& y)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE,
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES,
|
||||
"'matrixCompMult' only accept floating-point inputs, include <glm/ext/matrix_integer.hpp> to discard this restriction.");
|
||||
return detail::compute_matrixCompMult<C, R, T, Q, detail::is_aligned<Q>::value>::call(x, y);
|
||||
}
|
||||
@ -41,7 +41,7 @@ namespace detail
|
||||
struct compute_outerProduct_type {
|
||||
GLM_FUNC_QUALIFIER static typename detail::outerProduct_trait<DA, DB, T, Q>::type call(vec<DA, T, Q> const& c, vec<DB, T, Q> const& r)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE,
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES,
|
||||
"'outerProduct' only accept floating-point inputs, include <glm/ext/matrix_integer.hpp> to discard this restriction.");
|
||||
|
||||
return detail::compute_outerProduct<DA, DB, T, Q>::call(c, r);
|
||||
@ -231,7 +231,7 @@ namespace detail
|
||||
struct compute_transpose_type {
|
||||
GLM_FUNC_QUALIFIER static mat<R, C, T, Q> call(mat<C, R, T, Q> const& m)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE,
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES,
|
||||
"'transpose' only accept floating-point inputs, include <glm/ext/matrix_integer.hpp> to discard this restriction.");
|
||||
return detail::compute_transpose<C, R, T, Q, detail::is_aligned<Q>::value>::call(m);
|
||||
}
|
||||
@ -290,7 +290,7 @@ namespace detail
|
||||
|
||||
GLM_FUNC_QUALIFIER static T call(mat<C, R, T, Q> const& m)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE,
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES,
|
||||
"'determinant' only accept floating-point inputs, include <glm/ext/matrix_integer.hpp> to discard this restriction.");
|
||||
return detail::compute_determinant<C, R, T, Q, detail::is_aligned<Q>::value>::call(m);
|
||||
}
|
||||
@ -473,7 +473,7 @@ namespace detail
|
||||
template<length_t C, length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER mat<C, R, T, Q> inverse(mat<C, R, T, Q> const& m)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE, "'inverse' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'inverse' only accept floating-point inputs");
|
||||
return detail::compute_inverse<C, R, T, Q, detail::is_aligned<Q>::value>::call(m);
|
||||
}
|
||||
}//namespace glm
|
||||
|
@ -8,7 +8,7 @@ namespace glm
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType radians(genType degrees)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'radians' only accept floating-point input");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'radians' only accept floating-point input");
|
||||
|
||||
return degrees * static_cast<genType>(0.01745329251994329576923690768489);
|
||||
}
|
||||
@ -23,7 +23,7 @@ namespace glm
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType degrees(genType radians)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'degrees' only accept floating-point input");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'degrees' only accept floating-point input");
|
||||
|
||||
return radians * static_cast<genType>(57.295779513082320876798154814105);
|
||||
}
|
||||
@ -83,7 +83,7 @@ namespace glm
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType atan(genType y, genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'atan' only accept floating-point input");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::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<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType asinh(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'asinh' only accept floating-point input");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'asinh' only accept floating-point input");
|
||||
|
||||
return (x < static_cast<genType>(0) ? static_cast<genType>(-1) : (x > static_cast<genType>(0) ? static_cast<genType>(1) : static_cast<genType>(0))) * log(std::abs(x) + sqrt(static_cast<genType>(1) + x * x));
|
||||
}
|
||||
@ -155,7 +155,7 @@ namespace glm
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType acosh(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'acosh' only accept floating-point input");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'acosh' only accept floating-point input");
|
||||
|
||||
if(x < static_cast<genType>(1))
|
||||
return static_cast<genType>(0);
|
||||
@ -176,7 +176,7 @@ namespace glm
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType atanh(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'atanh' only accept floating-point input");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'atanh' only accept floating-point input");
|
||||
|
||||
if(std::abs(x) >= static_cast<genType>(1))
|
||||
return 0;
|
||||
|
@ -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.
|
||||
|
@ -3,7 +3,7 @@ namespace glm
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER qua<T, Q> mix(qua<T, Q> const& x, qua<T, Q> const& y, T a)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'mix' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::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<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua<T, Q> lerp(qua<T, Q> const& x, qua<T, Q> const& y, T a)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'lerp' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'lerp' only accept floating-point inputs");
|
||||
|
||||
// Lerp is only defined in [0, 1]
|
||||
assert(a >= static_cast<T>(0));
|
||||
@ -40,7 +40,7 @@ namespace glm
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER qua<T, Q> slerp(qua<T, Q> const& x, qua<T, Q> const& y, T a)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'slerp' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'slerp' only accept floating-point inputs");
|
||||
|
||||
qua<T, Q> z = y;
|
||||
|
||||
@ -75,7 +75,7 @@ namespace glm
|
||||
template<typename T, typename S, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER qua<T, Q> slerp(qua<T, Q> const& x, qua<T, Q> const& y, T a, S k)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'slerp' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'slerp' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<S>::is_integer, "'slerp' only accept integer for spin count");
|
||||
|
||||
qua<T, Q> z = y;
|
||||
@ -124,7 +124,7 @@ namespace glm
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<4, bool, Q> isnan(qua<T, Q> const& q)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'isnan' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::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<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<4, bool, Q> isinf(qua<T, Q> const& q)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'isinf' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::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));
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ namespace glm
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR T dot(qua<T, Q> const& x, qua<T, Q> const& y)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'dot' accepts only floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'dot' accepts only floating-point inputs");
|
||||
return detail::compute_dot<qua<T, Q>, T, detail::is_aligned<Q>::value>::call(x, y);
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ namespace glm
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T fmin(T a, T b)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'fmin' only accept floating-point input");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::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<typename T>
|
||||
GLM_FUNC_QUALIFIER T fmin(T a, T b, T c)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'fmin' only accept floating-point input");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::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<typename T>
|
||||
GLM_FUNC_QUALIFIER T fmin(T a, T b, T c, T d)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'fmin' only accept floating-point input");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::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<typename T>
|
||||
GLM_FUNC_QUALIFIER T fmax(T a, T b)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'fmax' only accept floating-point input");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::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<typename T>
|
||||
GLM_FUNC_QUALIFIER T fmax(T a, T b, T c)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'fmax' only accept floating-point input");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::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<typename T>
|
||||
GLM_FUNC_QUALIFIER T fmax(T a, T b, T c, T d)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'fmax' only accept floating-point input");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::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<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType fclamp(genType x, genType minVal, genType maxVal)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'fclamp' only accept floating-point or integer inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::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<typename genType>
|
||||
GLM_FUNC_QUALIFIER int iround(genType const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'iround' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'iround' only accept floating-point inputs");
|
||||
assert(static_cast<genType>(0.0) <= x);
|
||||
|
||||
return static_cast<int>(x + static_cast<genType>(0.5));
|
||||
@ -162,7 +162,7 @@ namespace glm
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER uint uround(genType const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'uround' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'uround' only accept floating-point inputs");
|
||||
assert(static_cast<genType>(0.0) <= x);
|
||||
|
||||
return static_cast<uint>(x + static_cast<genType>(0.5));
|
||||
|
@ -5,14 +5,14 @@ namespace glm
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType epsilon()
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'epsilon' only accepts floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'epsilon' only accepts floating-point inputs");
|
||||
return std::numeric_limits<genType>::epsilon();
|
||||
}
|
||||
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType pi()
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'pi' only accepts floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'pi' only accepts floating-point inputs");
|
||||
return static_cast<genType>(3.14159265358979323846264338327950288);
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ namespace detail
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(!std::numeric_limits<T>::is_iec559, "'ceilPowerOfTwo' only accept integer scalar or vector inputs");
|
||||
GLM_STATIC_ASSERT(!std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'ceilPowerOfTwo' only accept integer scalar or vector inputs");
|
||||
|
||||
vec<L, T, Q> const Sign(sign(x));
|
||||
|
||||
@ -48,7 +48,7 @@ namespace detail
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(!std::numeric_limits<T>::is_iec559, "'ceilPowerOfTwo' only accept integer scalar or vector inputs");
|
||||
GLM_STATIC_ASSERT(!std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'ceilPowerOfTwo' only accept integer scalar or vector inputs");
|
||||
|
||||
vec<L, T, Q> v(x);
|
||||
|
||||
|
@ -9,7 +9,7 @@ namespace glm
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType sec(genType angle)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'sec' only accept floating-point values");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::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<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType csc(genType angle)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'csc' only accept floating-point values");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::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<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType cot(genType angle)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'cot' only accept floating-point values");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::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<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType asec(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'asec' only accept floating-point values");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::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<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType acsc(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'acsc' only accept floating-point values");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::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<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType acot(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'acot' only accept floating-point values");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::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<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType sech(genType angle)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'sech' only accept floating-point values");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::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<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType csch(genType angle)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'csch' only accept floating-point values");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::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<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType coth(genType angle)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'coth' only accept floating-point values");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::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<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType asech(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'asech' only accept floating-point values");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::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<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType acsch(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'acsch' only accept floating-point values");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::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<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType acoth(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'acoth' only accept floating-point values");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'acoth' only accept floating-point values");
|
||||
return atanh(genType(1) / x);
|
||||
}
|
||||
}//namespace glm
|
||||
|
@ -219,7 +219,7 @@ namespace glm
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T nextFloat(T x, int ULPs)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'next_float' only accept floating-point input");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::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<typename T>
|
||||
GLM_FUNC_QUALIFIER T prevFloat(T x, int ULPs)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'prev_float' only accept floating-point input");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'prev_float' only accept floating-point input");
|
||||
assert(ULPs >= 0);
|
||||
|
||||
T temp = x;
|
||||
|
@ -9,7 +9,7 @@ namespace glm
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> sec(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'sec' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'sec' only accept floating-point inputs");
|
||||
return static_cast<T>(1) / detail::functor1<vec, L, T, T, Q>::call(cos, x);
|
||||
}
|
||||
|
||||
@ -17,7 +17,7 @@ namespace glm
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> csc(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'csc' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'csc' only accept floating-point inputs");
|
||||
return static_cast<T>(1) / detail::functor1<vec, L, T, T, Q>::call(sin, x);
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ namespace glm
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> cot(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'cot' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'cot' only accept floating-point inputs");
|
||||
T const pi_over_2 = static_cast<T>(3.1415926535897932384626433832795 / 2.0);
|
||||
return detail::functor1<vec, L, T, T, Q>::call(tan, pi_over_2 - x);
|
||||
}
|
||||
@ -34,7 +34,7 @@ namespace glm
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> asec(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'asec' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'asec' only accept floating-point inputs");
|
||||
return detail::functor1<vec, L, T, T, Q>::call(acos, static_cast<T>(1) / x);
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ namespace glm
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> acsc(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'acsc' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'acsc' only accept floating-point inputs");
|
||||
return detail::functor1<vec, L, T, T, Q>::call(asin, static_cast<T>(1) / x);
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ namespace glm
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> acot(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'acot' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'acot' only accept floating-point inputs");
|
||||
T const pi_over_2 = static_cast<T>(3.1415926535897932384626433832795 / 2.0);
|
||||
return pi_over_2 - detail::functor1<vec, L, T, T, Q>::call(atan, x);
|
||||
}
|
||||
@ -59,7 +59,7 @@ namespace glm
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> sech(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'sech' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'sech' only accept floating-point inputs");
|
||||
return static_cast<T>(1) / detail::functor1<vec, L, T, T, Q>::call(cosh, x);
|
||||
}
|
||||
|
||||
@ -67,7 +67,7 @@ namespace glm
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> csch(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'csch' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'csch' only accept floating-point inputs");
|
||||
return static_cast<T>(1) / detail::functor1<vec, L, T, T, Q>::call(sinh, x);
|
||||
}
|
||||
|
||||
@ -75,7 +75,7 @@ namespace glm
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> coth(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'coth' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::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<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> asech(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'asech' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'asech' only accept floating-point inputs");
|
||||
return detail::functor1<vec, L, T, T, Q>::call(acosh, static_cast<T>(1) / x);
|
||||
}
|
||||
|
||||
@ -91,7 +91,7 @@ namespace glm
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> acsch(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'acsch' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'acsch' only accept floating-point inputs");
|
||||
return detail::functor1<vec, L, T, T, Q>::call(asinh, static_cast<T>(1) / x);
|
||||
}
|
||||
|
||||
@ -99,7 +99,7 @@ namespace glm
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> acoth(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'acoth' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'acoth' only accept floating-point inputs");
|
||||
return detail::functor1<vec, L, T, T, Q>::call(atanh, static_cast<T>(1) / x);
|
||||
}
|
||||
}//namespace glm
|
||||
|
@ -35,7 +35,7 @@ namespace glm
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T next_float(T x, int ULPs)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'next_float' only accept floating-point input");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::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<typename T>
|
||||
GLM_FUNC_QUALIFIER T prev_float(T x, int ULPs)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'prev_float' only accept floating-point input");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'prev_float' only accept floating-point input");
|
||||
assert(ULPs >= 0);
|
||||
|
||||
T temp = x;
|
||||
|
@ -29,7 +29,7 @@ namespace detail
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER bool isdenormal(T const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'isdenormal' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::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<T>::is_iec559, "'isdenormal' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::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<T>::is_iec559, "'isdenormal' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::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<T>::is_iec559, "'isdenormal' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::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<T>::is_iec559, "'isdenormal' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'isdenormal' only accept floating-point inputs");
|
||||
|
||||
return typename vec<4, T, Q>::bool_type(
|
||||
isdenormal(x.x),
|
||||
|
@ -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<T>::is_iec559, "'cross' accepts only floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'cross' accepts only floating-point inputs");
|
||||
|
||||
return v.x * u.y - u.x * v.y;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ namespace glm
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType fastSqrt(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'fastSqrt' only accept floating-point input");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::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<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType fastLength(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'fastLength' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'fastLength' only accept floating-point inputs");
|
||||
|
||||
return abs(x);
|
||||
}
|
||||
@ -42,7 +42,7 @@ namespace glm
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER T fastLength(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'fastLength' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'fastLength' only accept floating-point inputs");
|
||||
|
||||
return fastSqrt(dot(x, x));
|
||||
}
|
||||
|
@ -9,21 +9,21 @@ namespace glm
|
||||
genType const& y
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'angle' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'angle' only accept floating-point inputs");
|
||||
return acos(clamp(dot(x, y), genType(-1), genType(1)));
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER T angle(vec<L, T, Q> const& x, vec<L, T, Q> const& y)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'angle' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'angle' only accept floating-point inputs");
|
||||
return acos(clamp(dot(x, y), T(-1), T(1)));
|
||||
}
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER T orientedAngle(vec<2, T, Q> const& x, vec<2, T, Q> const& y)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'orientedAngle' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::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<typename T, qualifier Q>
|
||||
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<T>::is_iec559, "'orientedAngle' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::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));
|
||||
|
Loading…
Reference in New Issue
Block a user