|
|
@@ -254,6 +254,8 @@ namespace detail
|
|
|
VECTORIZE_VEC(roundEven)
|
|
|
|
|
|
// ceil
|
|
|
+ using std::ceil;
|
|
|
+/*
|
|
|
template <typename genType>
|
|
|
GLM_FUNC_QUALIFIER genType ceil(genType const & x)
|
|
|
{
|
|
|
@@ -263,7 +265,7 @@ namespace detail
|
|
|
|
|
|
return ::std::ceil(x);
|
|
|
}
|
|
|
-
|
|
|
+*/
|
|
|
VECTORIZE_VEC(ceil)
|
|
|
|
|
|
// fract
|
|
|
@@ -273,9 +275,7 @@ namespace detail
|
|
|
genType const & x
|
|
|
)
|
|
|
{
|
|
|
- GLM_STATIC_ASSERT(
|
|
|
- std::numeric_limits<genType>::is_iec559,
|
|
|
- "'fract' only accept floating-point inputs");
|
|
|
+ GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'fract' only accept floating-point inputs");
|
|
|
|
|
|
return x - floor(x);
|
|
|
}
|
|
|
@@ -286,13 +286,11 @@ namespace detail
|
|
|
template <typename genType>
|
|
|
GLM_FUNC_QUALIFIER genType mod
|
|
|
(
|
|
|
- genType const & x,
|
|
|
+ genType const & x,
|
|
|
genType const & y
|
|
|
)
|
|
|
{
|
|
|
- GLM_STATIC_ASSERT(
|
|
|
- std::numeric_limits<genType>::is_iec559,
|
|
|
- "'mod' only accept floating-point inputs");
|
|
|
+ GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'mod' only accept floating-point inputs");
|
|
|
|
|
|
return x - y * floor(x / y);
|
|
|
}
|
|
|
@@ -304,13 +302,11 @@ namespace detail
|
|
|
template <typename genType>
|
|
|
GLM_FUNC_QUALIFIER genType modf
|
|
|
(
|
|
|
- genType const & x,
|
|
|
+ genType const & 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, "'modf' only accept floating-point inputs");
|
|
|
|
|
|
return std::modf(x, &i);
|
|
|
}
|
|
|
@@ -573,9 +569,7 @@ namespace detail
|
|
|
vecType<T, P> const & x
|
|
|
)
|
|
|
{
|
|
|
- GLM_STATIC_ASSERT(
|
|
|
- std::numeric_limits<T>::is_iec559,
|
|
|
- "'step' only accept floating-point inputs");
|
|
|
+ GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'step' only accept floating-point inputs");
|
|
|
|
|
|
return mix(vecType<T, P>(1), vecType<T, P>(0), glm::lessThan(x, vecType<T, P>(edge)));
|
|
|
}
|
|
|
@@ -589,9 +583,7 @@ namespace detail
|
|
|
genType const & x
|
|
|
)
|
|
|
{
|
|
|
- GLM_STATIC_ASSERT(
|
|
|
- std::numeric_limits<genType>::is_iec559,
|
|
|
- "'smoothstep' only accept floating-point inputs");
|
|
|
+ GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'smoothstep' only accept floating-point inputs");
|
|
|
|
|
|
genType tmp = clamp((x - edge0) / (edge1 - edge0), genType(0), genType(1));
|
|
|
return tmp * tmp * (genType(3) - genType(2) * tmp);
|
|
|
@@ -605,9 +597,7 @@ namespace detail
|
|
|
detail::tvec2<T, P> const & x
|
|
|
)
|
|
|
{
|
|
|
- GLM_STATIC_ASSERT(
|
|
|
- std::numeric_limits<T>::is_iec559,
|
|
|
- "'smoothstep' only accept floating-point inputs");
|
|
|
+ GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'smoothstep' only accept floating-point inputs");
|
|
|
|
|
|
return detail::tvec2<T, P>(
|
|
|
smoothstep(edge0, edge1, x.x),
|
|
|
@@ -622,9 +612,7 @@ namespace detail
|
|
|
detail::tvec3<T, P> const & x
|
|
|
)
|
|
|
{
|
|
|
- GLM_STATIC_ASSERT(
|
|
|
- std::numeric_limits<T>::is_iec559,
|
|
|
- "'smoothstep' only accept floating-point inputs");
|
|
|
+ GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'smoothstep' only accept floating-point inputs");
|
|
|
|
|
|
return detail::tvec3<T, P>(
|
|
|
smoothstep(edge0, edge1, x.x),
|
|
|
@@ -640,9 +628,7 @@ namespace detail
|
|
|
detail::tvec4<T, P> const & x
|
|
|
)
|
|
|
{
|
|
|
- GLM_STATIC_ASSERT(
|
|
|
- std::numeric_limits<T>::is_iec559,
|
|
|
- "'smoothstep' only accept floating-point inputs");
|
|
|
+ GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'smoothstep' only accept floating-point inputs");
|
|
|
|
|
|
return detail::tvec4<T, P>(
|
|
|
smoothstep(edge0, edge1, x.x),
|
|
|
@@ -659,9 +645,7 @@ namespace detail
|
|
|
detail::tvec2<T, P> const & x
|
|
|
)
|
|
|
{
|
|
|
- GLM_STATIC_ASSERT(
|
|
|
- std::numeric_limits<T>::is_iec559,
|
|
|
- "'smoothstep' only accept floating-point inputs");
|
|
|
+ GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'smoothstep' only accept floating-point inputs");
|
|
|
|
|
|
return detail::tvec2<T, P>(
|
|
|
smoothstep(edge0.x, edge1.x, x.x),
|
|
|
@@ -676,9 +660,7 @@ namespace detail
|
|
|
detail::tvec3<T, P> const & x
|
|
|
)
|
|
|
{
|
|
|
- GLM_STATIC_ASSERT(
|
|
|
- std::numeric_limits<T>::is_iec559,
|
|
|
- "'smoothstep' only accept floating-point inputs");
|
|
|
+ GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'smoothstep' only accept floating-point inputs");
|
|
|
|
|
|
return detail::tvec3<T, P>(
|
|
|
smoothstep(edge0.x, edge1.x, x.x),
|
|
|
@@ -694,9 +676,7 @@ namespace detail
|
|
|
detail::tvec4<T, P> const & x
|
|
|
)
|
|
|
{
|
|
|
- GLM_STATIC_ASSERT(
|
|
|
- std::numeric_limits<T>::is_iec559,
|
|
|
- "'smoothstep' only accept floating-point inputs");
|
|
|
+ GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'smoothstep' only accept floating-point inputs");
|
|
|
|
|
|
return detail::tvec4<T, P>(
|
|
|
smoothstep(edge0.x, edge1.x, x.x),
|
|
|
@@ -709,9 +689,7 @@ namespace detail
|
|
|
template <typename genType>
|
|
|
GLM_FUNC_QUALIFIER bool isnan(genType const & 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, "'isnan' only accept floating-point inputs");
|
|
|
|
|
|
# if(GLM_LANG & GLM_LANG_CXX11_FLAG)
|
|
|
return std::isnan(x);
|
|
|
@@ -730,15 +708,25 @@ namespace detail
|
|
|
# endif
|
|
|
}
|
|
|
|
|
|
+ template <typename T, precision P>
|
|
|
+ GLM_FUNC_QUALIFIER typename detail::tvec1<T, P>::bool_type isnan
|
|
|
+ (
|
|
|
+ detail::tvec1<T, P> const & x
|
|
|
+ )
|
|
|
+ {
|
|
|
+ GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'isnan' only accept floating-point inputs");
|
|
|
+
|
|
|
+ return typename detail::tvec1<T, P>::bool_type(
|
|
|
+ isnan(x.x));
|
|
|
+ }
|
|
|
+
|
|
|
template <typename T, precision P>
|
|
|
GLM_FUNC_QUALIFIER typename detail::tvec2<T, P>::bool_type isnan
|
|
|
(
|
|
|
detail::tvec2<T, P> const & x
|
|
|
)
|
|
|
{
|
|
|
- GLM_STATIC_ASSERT(
|
|
|
- std::numeric_limits<T>::is_iec559,
|
|
|
- "'isnan' only accept floating-point inputs");
|
|
|
+ GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'isnan' only accept floating-point inputs");
|
|
|
|
|
|
return typename detail::tvec2<T, P>::bool_type(
|
|
|
isnan(x.x),
|
|
|
@@ -751,9 +739,7 @@ namespace detail
|
|
|
detail::tvec3<T, P> const & x
|
|
|
)
|
|
|
{
|
|
|
- GLM_STATIC_ASSERT(
|
|
|
- std::numeric_limits<T>::is_iec559,
|
|
|
- "'isnan' only accept floating-point inputs");
|
|
|
+ GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'isnan' only accept floating-point inputs");
|
|
|
|
|
|
return typename detail::tvec3<T, P>::bool_type(
|
|
|
isnan(x.x),
|
|
|
@@ -767,9 +753,7 @@ namespace detail
|
|
|
detail::tvec4<T, P> const & x
|
|
|
)
|
|
|
{
|
|
|
- GLM_STATIC_ASSERT(
|
|
|
- std::numeric_limits<T>::is_iec559,
|
|
|
- "'isnan' only accept floating-point inputs");
|
|
|
+ GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'isnan' only accept floating-point inputs");
|
|
|
|
|
|
return typename detail::tvec4<T, P>::bool_type(
|
|
|
isnan(x.x),
|
|
|
@@ -802,15 +786,25 @@ namespace detail
|
|
|
# endif
|
|
|
}
|
|
|
|
|
|
+ template <typename T, precision P>
|
|
|
+ GLM_FUNC_QUALIFIER typename detail::tvec1<T, P>::bool_type isinf
|
|
|
+ (
|
|
|
+ detail::tvec1<T, P> const & x
|
|
|
+ )
|
|
|
+ {
|
|
|
+ GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'isinf' only accept floating-point inputs");
|
|
|
+
|
|
|
+ return typename detail::tvec1<T, P>::bool_type(
|
|
|
+ isinf(x.x));
|
|
|
+ }
|
|
|
+
|
|
|
template <typename T, precision P>
|
|
|
GLM_FUNC_QUALIFIER typename detail::tvec2<T, P>::bool_type isinf
|
|
|
(
|
|
|
detail::tvec2<T, P> const & x
|
|
|
)
|
|
|
{
|
|
|
- GLM_STATIC_ASSERT(
|
|
|
- std::numeric_limits<T>::is_iec559,
|
|
|
- "'isinf' only accept floating-point inputs");
|
|
|
+ GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'isinf' only accept floating-point inputs");
|
|
|
|
|
|
return typename detail::tvec2<T, P>::bool_type(
|
|
|
isinf(x.x),
|
|
|
@@ -823,9 +817,7 @@ namespace detail
|
|
|
detail::tvec3<T, P> const & x
|
|
|
)
|
|
|
{
|
|
|
- GLM_STATIC_ASSERT(
|
|
|
- std::numeric_limits<T>::is_iec559,
|
|
|
- "'isinf' only accept floating-point inputs");
|
|
|
+ GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'isinf' only accept floating-point inputs");
|
|
|
|
|
|
return typename detail::tvec3<T, P>::bool_type(
|
|
|
isinf(x.x),
|
|
|
@@ -839,9 +831,7 @@ namespace detail
|
|
|
detail::tvec4<T, P> const & x
|
|
|
)
|
|
|
{
|
|
|
- GLM_STATIC_ASSERT(
|
|
|
- std::numeric_limits<T>::is_iec559,
|
|
|
- "'isinf' only accept floating-point inputs");
|
|
|
+ GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'isinf' only accept floating-point inputs");
|
|
|
|
|
|
return typename detail::tvec4<T, P>::bool_type(
|
|
|
isinf(x.x),
|
|
|
@@ -912,13 +902,23 @@ namespace detail
|
|
|
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, "'frexp' only accept floating-point inputs");
|
|
|
|
|
|
return std::frexp(x, exp);
|
|
|
}
|
|
|
|
|
|
+ template <typename T, precision P>
|
|
|
+ GLM_FUNC_QUALIFIER detail::tvec1<T, P> frexp
|
|
|
+ (
|
|
|
+ detail::tvec1<T, P> const & x,
|
|
|
+ detail::tvec1<int, P> & exp
|
|
|
+ )
|
|
|
+ {
|
|
|
+ GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'frexp' only accept floating-point inputs");
|
|
|
+
|
|
|
+ return detail::tvec1<T, P>(std::frexp(x.x, exp.x));
|
|
|
+ }
|
|
|
+
|
|
|
template <typename T, precision P>
|
|
|
GLM_FUNC_QUALIFIER detail::tvec2<T, P> frexp
|
|
|
(
|
|
|
@@ -926,9 +926,7 @@ namespace detail
|
|
|
detail::tvec2<int, P> & 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, "'frexp' only accept floating-point inputs");
|
|
|
|
|
|
return detail::tvec2<T, P>(
|
|
|
frexp(x.x, exp.x),
|
|
|
@@ -942,9 +940,7 @@ namespace detail
|
|
|
detail::tvec3<int, P> & 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, "'frexp' only accept floating-point inputs");
|
|
|
|
|
|
return detail::tvec3<T, P>(
|
|
|
frexp(x.x, exp.x),
|
|
|
@@ -959,9 +955,7 @@ namespace detail
|
|
|
detail::tvec4<int, P> & 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, "'frexp' only accept floating-point inputs");
|
|
|
|
|
|
return detail::tvec4<T, P>(
|
|
|
frexp(x.x, exp.x),
|
|
|
@@ -977,13 +971,24 @@ namespace detail
|
|
|
int const & 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, "'ldexp' only accept floating-point inputs");
|
|
|
|
|
|
return std::ldexp(x, exp);
|
|
|
}
|
|
|
|
|
|
+ template <typename T, precision P>
|
|
|
+ GLM_FUNC_QUALIFIER detail::tvec1<T, P> ldexp
|
|
|
+ (
|
|
|
+ detail::tvec1<T, P> const & x,
|
|
|
+ detail::tvec1<int, P> const & exp
|
|
|
+ )
|
|
|
+ {
|
|
|
+ GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'ldexp' only accept floating-point inputs");
|
|
|
+
|
|
|
+ return detail::tvec1<T, P>(
|
|
|
+ ldexp(x.x, exp.x));
|
|
|
+ }
|
|
|
+
|
|
|
template <typename T, precision P>
|
|
|
GLM_FUNC_QUALIFIER detail::tvec2<T, P> ldexp
|
|
|
(
|
|
|
@@ -991,9 +996,7 @@ namespace detail
|
|
|
detail::tvec2<int, P> 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, "'ldexp' only accept floating-point inputs");
|
|
|
|
|
|
return detail::tvec2<T, P>(
|
|
|
ldexp(x.x, exp.x),
|
|
|
@@ -1007,9 +1010,7 @@ namespace detail
|
|
|
detail::tvec3<int, P> 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, "'ldexp' only accept floating-point inputs");
|
|
|
|
|
|
return detail::tvec3<T, P>(
|
|
|
ldexp(x.x, exp.x),
|
|
|
@@ -1024,9 +1025,7 @@ namespace detail
|
|
|
detail::tvec4<int, P> 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, "'ldexp' only accept floating-point inputs");
|
|
|
|
|
|
return detail::tvec4<T, P>(
|
|
|
ldexp(x.x, exp.x),
|