mirror of
https://github.com/g-truc/glm.git
synced 2024-11-25 09:54:35 +00:00
Add GLM_FORCE_UNRESTRICTED_FLOAT to skip static assert when using not float types
This commit is contained in:
parent
2993560ec9
commit
229f3eced4
@ -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 || GLM_FORCE_UNRESTRICTED_FLOAT || std::numeric_limits<genFIType>::is_signed,
|
||||
"'abs' only accept floating-point and integer scalar or vector inputs");
|
||||
|
||||
return x >= genFIType(0) ? x : -x;
|
||||
|
@ -16,7 +16,7 @@ namespace glm
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType min(genType x, genType y)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || std::numeric_limits<genType>::is_integer, "'min' only accept floating-point or integer inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || GLM_FORCE_UNRESTRICTED_FLOAT || std::numeric_limits<genType>::is_integer, "'min' only accept floating-point or integer inputs");
|
||||
return (y < x) ? y : x;
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@ namespace glm
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType max(genType x, genType y)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || std::numeric_limits<genType>::is_integer, "'max' only accept floating-point or integer inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || GLM_FORCE_UNRESTRICTED_FLOAT || std::numeric_limits<genType>::is_integer, "'max' only accept floating-point or integer inputs");
|
||||
|
||||
return (x < y) ? y : x;
|
||||
}
|
||||
@ -44,7 +44,7 @@ namespace glm
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType round(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'round' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || GLM_FORCE_UNRESTRICTED_FLOAT, "'round' only accept floating-point inputs");
|
||||
|
||||
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)));
|
||||
}
|
||||
@ -57,7 +57,7 @@ namespace glm
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType trunc(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'trunc' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || GLM_FORCE_UNRESTRICTED_FLOAT, "'trunc' only accept floating-point inputs");
|
||||
|
||||
return x < static_cast<genType>(0) ? -std::floor(-x) : std::floor(x);
|
||||
}
|
||||
@ -82,7 +82,7 @@ namespace detail
|
||||
{
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR static vec<L, T, Q> call(vec<L, T, Q> const& x, vec<L, T, Q> const& y, vec<L, U, Q> const& a)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<U>::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE, "'mix' only accept floating-point inputs for the interpolator a");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<U>::is_iec559 || GLM_FORCE_UNRESTRICTED_FLOAT || GLM_CONFIG_UNRESTRICTED_GENTYPE, "'mix' only accept floating-point inputs for the interpolator a");
|
||||
|
||||
return vec<L, T, Q>(vec<L, U, Q>(x) * (static_cast<U>(1) - a) + vec<L, U, Q>(y) * a);
|
||||
}
|
||||
@ -105,7 +105,7 @@ namespace detail
|
||||
{
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR static vec<L, T, Q> call(vec<L, T, Q> const& x, vec<L, T, Q> const& y, U const& a)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<U>::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE, "'mix' only accept floating-point inputs for the interpolator a");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<U>::is_iec559 || GLM_FORCE_UNRESTRICTED_FLOAT || GLM_CONFIG_UNRESTRICTED_GENTYPE, "'mix' only accept floating-point inputs for the interpolator a");
|
||||
|
||||
return vec<L, T, Q>(vec<L, U, Q>(x) * (static_cast<U>(1) - a) + vec<L, U, Q>(y) * a);
|
||||
}
|
||||
@ -125,7 +125,7 @@ namespace detail
|
||||
{
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR static T call(T const& x, T const& y, U const& a)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<U>::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE, "'mix' only accept floating-point inputs for the interpolator a");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<U>::is_iec559 || GLM_FORCE_UNRESTRICTED_FLOAT || GLM_CONFIG_UNRESTRICTED_GENTYPE, "'mix' only accept floating-point inputs for the interpolator a");
|
||||
|
||||
return static_cast<T>(static_cast<U>(x) * (static_cast<U>(1) - a) + static_cast<U>(y) * a);
|
||||
}
|
||||
@ -213,7 +213,7 @@ namespace detail
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& a, vec<L, T, Q> const& b)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'mod' only accept floating-point inputs. Include <glm/gtc/integer.hpp> for integer inputs.");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_FORCE_UNRESTRICTED_FLOAT, "'mod' only accept floating-point inputs. Include <glm/gtc/integer.hpp> for integer inputs.");
|
||||
return a - b * floor(a / b);
|
||||
}
|
||||
};
|
||||
@ -259,7 +259,7 @@ 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)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE, "'smoothstep' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_FORCE_UNRESTRICTED_FLOAT || GLM_CONFIG_UNRESTRICTED_GENTYPE, "'smoothstep' only accept floating-point inputs");
|
||||
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);
|
||||
}
|
||||
@ -284,7 +284,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_FORCE_UNRESTRICTED_FLOAT || (std::numeric_limits<genFIType>::is_signed && std::numeric_limits<genFIType>::is_integer),
|
||||
"'sign' only accept signed inputs");
|
||||
|
||||
return detail::compute_sign<1, genFIType, defaultp,
|
||||
@ -295,7 +295,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_FORCE_UNRESTRICTED_FLOAT || (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);
|
||||
@ -306,21 +306,21 @@ 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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'round' only accept floating-point inputs");
|
||||
return detail::compute_round<L, T, Q, detail::is_aligned<Q>::value>::call(x);
|
||||
}
|
||||
|
||||
@ -329,7 +329,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_FORCE_UNRESTRICTED_FLOAT, "'roundEven' only accept floating-point inputs");
|
||||
|
||||
return genType(int(x + genType(int(x) % 2)));
|
||||
}
|
||||
@ -339,7 +339,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_FORCE_UNRESTRICTED_FLOAT, "'roundEven' only accept floating-point inputs");
|
||||
|
||||
int Integer = static_cast<int>(x);
|
||||
genType IntegerPart = static_cast<genType>(Integer);
|
||||
@ -370,7 +370,7 @@ 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_FORCE_UNRESTRICTED_FLOAT, "'roundEven' only accept floating-point inputs");
|
||||
return detail::functor1<vec, L, T, T, Q>::call(roundEven, x);
|
||||
}
|
||||
|
||||
@ -379,7 +379,7 @@ 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_FORCE_UNRESTRICTED_FLOAT, "'ceil' only accept floating-point inputs");
|
||||
return detail::compute_ceil<L, T, Q, detail::is_aligned<Q>::value>::call(x);
|
||||
}
|
||||
|
||||
@ -393,7 +393,7 @@ 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_FORCE_UNRESTRICTED_FLOAT, "'fract' only accept floating-point inputs");
|
||||
return detail::compute_fract<L, T, Q, detail::is_aligned<Q>::value>::call(x);
|
||||
}
|
||||
|
||||
@ -426,7 +426,7 @@ 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_FORCE_UNRESTRICTED_FLOAT, "'modf' only accept floating-point inputs");
|
||||
return std::modf(x, &i);
|
||||
}
|
||||
|
||||
@ -476,7 +476,7 @@ 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 || GLM_FORCE_UNRESTRICTED_FLOAT || std::numeric_limits<T>::is_integer, "'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));
|
||||
}
|
||||
|
||||
@ -490,7 +490,7 @@ 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 || GLM_FORCE_UNRESTRICTED_FLOAT || std::numeric_limits<T>::is_integer, "'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));
|
||||
}
|
||||
|
||||
@ -504,21 +504,21 @@ 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 || GLM_FORCE_UNRESTRICTED_FLOAT || std::numeric_limits<genType>::is_integer, "'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 || GLM_FORCE_UNRESTRICTED_FLOAT || std::numeric_limits<T>::is_integer, "'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 || GLM_FORCE_UNRESTRICTED_FLOAT || std::numeric_limits<T>::is_integer, "'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);
|
||||
}
|
||||
|
||||
@ -563,7 +563,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_FORCE_UNRESTRICTED_FLOAT || GLM_CONFIG_UNRESTRICTED_GENTYPE, "'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);
|
||||
@ -587,7 +587,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_FORCE_UNRESTRICTED_FLOAT, "'isnan' only accept floating-point inputs");
|
||||
|
||||
# if GLM_HAS_CXX11_STL
|
||||
return std::isnan(x);
|
||||
@ -612,7 +612,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_FORCE_UNRESTRICTED_FLOAT, "'isnan' only accept floating-point inputs");
|
||||
|
||||
vec<L, bool, Q> Result;
|
||||
for (length_t l = 0; l < v.length(); ++l)
|
||||
@ -626,7 +626,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_FORCE_UNRESTRICTED_FLOAT, "'isinf' only accept floating-point inputs");
|
||||
|
||||
# if GLM_HAS_CXX11_STL
|
||||
return std::isinf(x);
|
||||
@ -654,7 +654,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_FORCE_UNRESTRICTED_FLOAT, "'isinf' only accept floating-point inputs");
|
||||
|
||||
vec<L, bool, Q> Result;
|
||||
for (length_t l = 0; l < v.length(); ++l)
|
||||
@ -751,7 +751,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_FORCE_UNRESTRICTED_FLOAT, "'frexp' only accept floating-point inputs");
|
||||
|
||||
return std::frexp(x, &exp);
|
||||
}
|
||||
@ -759,7 +759,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_FORCE_UNRESTRICTED_FLOAT, "'frexp' only accept floating-point inputs");
|
||||
|
||||
vec<L, T, Q> Result;
|
||||
for (length_t l = 0; l < v.length(); ++l)
|
||||
@ -770,7 +770,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_FORCE_UNRESTRICTED_FLOAT, "'ldexp' only accept floating-point inputs");
|
||||
|
||||
return std::ldexp(x, exp);
|
||||
}
|
||||
@ -778,7 +778,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_FORCE_UNRESTRICTED_FLOAT, "'ldexp' only accept floating-point inputs");
|
||||
|
||||
vec<L, T, Q> Result;
|
||||
for (length_t l = 0; l < v.length(); ++l)
|
||||
|
@ -25,7 +25,7 @@ namespace detail
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'log2' only accept floating-point inputs. Include <glm/gtc/integer.hpp> for integer inputs.");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_FORCE_UNRESTRICTED_FLOAT, "'log2' only accept floating-point inputs. Include <glm/gtc/integer.hpp> for integer inputs.");
|
||||
|
||||
return detail::functor1<vec, L, T, T, Q>::call(log2, v);
|
||||
}
|
||||
@ -97,7 +97,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_FORCE_UNRESTRICTED_FLOAT, "'exp2' only accept floating-point inputs");
|
||||
|
||||
return std::exp(static_cast<genType>(0.69314718055994530941723212145818) * x);
|
||||
}
|
||||
@ -127,7 +127,7 @@ 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_FORCE_UNRESTRICTED_FLOAT, "'sqrt' only accept floating-point inputs");
|
||||
return detail::compute_sqrt<L, T, Q, detail::is_aligned<Q>::value>::call(x);
|
||||
}
|
||||
|
||||
@ -141,7 +141,7 @@ 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_FORCE_UNRESTRICTED_FLOAT, "'inversesqrt' only accept floating-point inputs");
|
||||
return detail::compute_inversesqrt<L, T, Q, detail::is_aligned<Q>::value>::call(x);
|
||||
}
|
||||
}//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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'atanh' only accept floating-point input");
|
||||
|
||||
if(std::abs(x) >= static_cast<genType>(1))
|
||||
return 0;
|
||||
|
@ -528,6 +528,17 @@
|
||||
# define GLM_CONFIG_UNRESTRICTED_GENTYPE GLM_DISABLE
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Allows using any scaler as float
|
||||
|
||||
// #define GLM_FORCE_UNRESTRICTED_FLOAT
|
||||
|
||||
#ifdef GLM_FORCE_UNRESTRICTED_FLOAT
|
||||
# define GLM_CONFIG_UNRESTRICTED_FLOAT GLM_ENABLE
|
||||
#else
|
||||
# define GLM_CONFIG_UNRESTRICTED_FLOAT 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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'fastLength' only accept floating-point inputs");
|
||||
|
||||
return fastSqrt(dot(x, x));
|
||||
}
|
||||
|
@ -18,28 +18,28 @@ namespace detail
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType length2(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'length2' accepts only floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'length2' accepts only floating-point inputs");
|
||||
return x * x;
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER T length2(vec<L, T, Q> const& v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'length2' accepts only floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'length2' accepts only floating-point inputs");
|
||||
return detail::compute_length2<L, T, Q, detail::is_aligned<Q>::value>::call(v);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T distance2(T p0, T p1)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'distance2' accepts only floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'distance2' accepts only floating-point inputs");
|
||||
return length2(p1 - p0);
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER T distance2(vec<L, T, Q> const& p0, vec<L, T, Q> const& p1)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'distance2' accepts only floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'distance2' accepts only floating-point inputs");
|
||||
return length2(p1 - p0);
|
||||
}
|
||||
|
||||
|
@ -16,14 +16,14 @@ namespace glm
|
||||
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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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_FORCE_UNRESTRICTED_FLOAT, "'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));
|
||||
|
@ -92,6 +92,7 @@ vcpkg install glm
|
||||
- Added `glm::iround` and `glm::uround` to *GLM_EXT_scalar_common* and *GLM_EXT_vector_common*
|
||||
- Added *GLM_EXT_matrix_integer* with tests
|
||||
- Added Github Actions
|
||||
- Added GLM_FORCE_UNRESTRICTED_FLOAT to prevent static asserts when using other scalar types with function expecting floats.
|
||||
|
||||
#### Improvements:
|
||||
- Added `constexpr` qualifier for `cross` product #1040
|
||||
|
Loading…
Reference in New Issue
Block a user