Add GLM_FORCE_UNRESTRICTED_FLOAT to skip static assert when using not float types

This commit is contained in:
christophe 2023-12-25 18:48:48 +01:00 committed by Christophe
parent 869f9da00e
commit 8e2bdd1fdb

View File

@ -18,28 +18,28 @@ namespace detail
template<typename genType> template<typename genType>
GLM_FUNC_QUALIFIER genType length2(genType x) GLM_FUNC_QUALIFIER genType length2(genType x)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'length2' accepts only floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || GLM_CONFIG_UNRESTRICTED_FLOAT, "'length2' accepts only floating-point inputs");
return x * x; return x * x;
} }
template<length_t L, typename T, qualifier Q> template<length_t L, typename T, qualifier Q>
GLM_FUNC_QUALIFIER T length2(vec<L, T, Q> const& v) GLM_FUNC_QUALIFIER T length2(vec<L, T, Q> const& v)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'length2' accepts only floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_FLOAT, "'length2' accepts only floating-point inputs");
return detail::compute_length2<L, T, Q, detail::is_aligned<Q>::value>::call(v); return detail::compute_length2<L, T, Q, detail::is_aligned<Q>::value>::call(v);
} }
template<typename T> template<typename T>
GLM_FUNC_QUALIFIER T distance2(T p0, T p1) GLM_FUNC_QUALIFIER T distance2(T p0, T p1)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'distance2' accepts only floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_FLOAT, "'distance2' accepts only floating-point inputs");
return length2(p1 - p0); return length2(p1 - p0);
} }
template<length_t L, typename T, qualifier Q> 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_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 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'distance2' accepts only floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_FLOAT, "'distance2' accepts only floating-point inputs");
return length2(p1 - p0); return length2(p1 - p0);
} }