mirror of
https://github.com/g-truc/glm.git
synced 2024-11-26 18:24:35 +00:00
Replace glm::detail::type traits by std::numerical_limits traits
This commit is contained in:
parent
f228d42910
commit
f911117407
@ -148,7 +148,7 @@ namespace detail
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType roundEven(genType const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'roundEven' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'roundEven' only accept floating-point inputs");
|
||||
|
||||
return genType(int(x + genType(int(x) % 2)));
|
||||
}
|
||||
|
@ -98,32 +98,26 @@ namespace glm
|
||||
|
||||
VECTORIZE_VEC(exp2)
|
||||
|
||||
namespace _detail
|
||||
namespace detail
|
||||
{
|
||||
template <int _PATH = detail::float_or_int_value::GLM_ERROR>
|
||||
struct _compute_log2
|
||||
template <bool T>
|
||||
struct compute_log2
|
||||
{
|
||||
template <typename T>
|
||||
T operator() (T const & Value) const;
|
||||
/*
|
||||
{
|
||||
GLM_STATIC_ASSERT(0, "'log2' parameter has an invalid template parameter type. GLM core features only supports floating-point types, include <glm/gtx/integer.hpp> for integer types support. Others types are not supported.");
|
||||
return Value;
|
||||
}
|
||||
*/
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _compute_log2<detail::float_or_int_value::GLM_FLOAT>
|
||||
struct compute_log2<true>
|
||||
{
|
||||
template <typename T>
|
||||
T operator() (T const & Value) const
|
||||
{
|
||||
return T(::std::log(Value)) / T(0.69314718055994530941723212145818);
|
||||
return static_cast<T>(::std::log(Value)) * static_cast<T>(1.4426950408889634073599246810019);
|
||||
}
|
||||
};
|
||||
|
||||
}//namespace _detail
|
||||
}//namespace detail
|
||||
|
||||
// log2, ln2 = 0.69314718055994530941723212145818f
|
||||
template <typename genType>
|
||||
@ -132,8 +126,11 @@ namespace _detail
|
||||
genType const & x
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || std::numeric_limits<genType>::is_integer,
|
||||
"GLM core 'log2' only accept floating-point inputs. Include <glm/gtx/integer.hpp> for additional integer support.");
|
||||
|
||||
assert(x > genType(0)); // log2 is only defined on the range (0, inf]
|
||||
return _detail::_compute_log2<detail::float_or_int_trait<genType>::ID>()(x);
|
||||
return detail::compute_log2<std::numeric_limits<genType>::is_iec559>()(x);
|
||||
}
|
||||
|
||||
VECTORIZE_VEC(log2)
|
||||
|
@ -40,7 +40,7 @@ namespace glm
|
||||
genType const & x
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'length' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'length' only accept floating-point inputs");
|
||||
|
||||
genType sqr = x * x;
|
||||
return sqrt(sqr);
|
||||
@ -49,7 +49,7 @@ namespace glm
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T length(detail::tvec2<T, P> const & v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'length' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'length' only accept floating-point inputs");
|
||||
|
||||
T sqr = v.x * v.x + v.y * v.y;
|
||||
return sqrt(sqr);
|
||||
@ -58,7 +58,7 @@ namespace glm
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T length(detail::tvec3<T, P> const & v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'length' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'length' only accept floating-point inputs");
|
||||
|
||||
T sqr = v.x * v.x + v.y * v.y + v.z * v.z;
|
||||
return sqrt(sqr);
|
||||
@ -67,7 +67,7 @@ namespace glm
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T length(detail::tvec4<T, P> const & v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'length' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'length' only accept floating-point inputs");
|
||||
|
||||
T sqr = v.x * v.x + v.y * v.y + v.z * v.z + v.w * v.w;
|
||||
return sqrt(sqr);
|
||||
@ -81,7 +81,7 @@ namespace glm
|
||||
genType const & p1
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'distance' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'distance' only accept floating-point inputs");
|
||||
|
||||
return length(p1 - p0);
|
||||
}
|
||||
@ -93,7 +93,7 @@ namespace glm
|
||||
detail::tvec2<T, P> const & p1
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'distance' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'distance' only accept floating-point inputs");
|
||||
|
||||
return length(p1 - p0);
|
||||
}
|
||||
@ -105,7 +105,7 @@ namespace glm
|
||||
detail::tvec3<T, P> const & p1
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'distance' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'distance' only accept floating-point inputs");
|
||||
|
||||
return length(p1 - p0);
|
||||
}
|
||||
@ -117,7 +117,7 @@ namespace glm
|
||||
detail::tvec4<T, P> const & p1
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'distance' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'distance' only accept floating-point inputs");
|
||||
|
||||
return length(p1 - p0);
|
||||
}
|
||||
@ -130,7 +130,7 @@ namespace glm
|
||||
genType const & y
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'dot' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'dot' only accept floating-point inputs");
|
||||
|
||||
return x * y;
|
||||
}
|
||||
@ -154,7 +154,7 @@ namespace glm
|
||||
detail::tvec3<T, P> const & y
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'dot' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'dot' only accept floating-point inputs");
|
||||
|
||||
return x.x * y.x + x.y * y.y + x.z * y.z;
|
||||
}
|
||||
@ -182,7 +182,7 @@ namespace glm
|
||||
detail::tvec4<T, P> const & y
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'dot' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'dot' only accept floating-point inputs");
|
||||
|
||||
return x.x * y.x + x.y * y.y + x.z * y.z + x.w * y.w;
|
||||
}
|
||||
@ -195,7 +195,7 @@ namespace glm
|
||||
detail::tvec3<T, P> const & y
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'cross' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'cross' only accept floating-point inputs");
|
||||
|
||||
return detail::tvec3<T, P>(
|
||||
x.y * y.z - y.y * x.z,
|
||||
@ -210,7 +210,7 @@ namespace glm
|
||||
genType const & x
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'normalize' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'normalize' only accept floating-point inputs");
|
||||
|
||||
return x < genType(0) ? genType(-1) : genType(1);
|
||||
}
|
||||
@ -222,7 +222,7 @@ namespace glm
|
||||
detail::tvec2<T, P> const & x
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'normalize' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'normalize' only accept floating-point inputs");
|
||||
|
||||
T sqr = x.x * x.x + x.y * x.y;
|
||||
return x * inversesqrt(sqr);
|
||||
@ -234,7 +234,7 @@ namespace glm
|
||||
detail::tvec3<T, P> const & x
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'normalize' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'normalize' only accept floating-point inputs");
|
||||
|
||||
T sqr = x.x * x.x + x.y * x.y + x.z * x.z;
|
||||
return x * inversesqrt(sqr);
|
||||
@ -246,7 +246,7 @@ namespace glm
|
||||
detail::tvec4<T, P> const & x
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'normalize' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'normalize' only accept floating-point inputs");
|
||||
|
||||
T sqr = x.x * x.x + x.y * x.y + x.z * x.z + x.w * x.w;
|
||||
return x * inversesqrt(sqr);
|
||||
@ -284,7 +284,7 @@ namespace glm
|
||||
genType const & eta
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'refract' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'refract' only accept floating-point inputs");
|
||||
|
||||
genType dotValue = dot(N, I);
|
||||
genType k = genType(1) - eta * eta * (genType(1) - dotValue * dotValue);
|
||||
@ -302,7 +302,7 @@ namespace glm
|
||||
T const & eta
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'refract' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'refract' only accept floating-point inputs");
|
||||
|
||||
T dotValue = dot(N, I);
|
||||
T k = T(1) - eta * eta * (T(1) - dotValue * dotValue);
|
||||
|
@ -38,7 +38,7 @@ namespace glm
|
||||
matType const & y
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<typename matType::value_type>::is_float, "'matrixCompMult' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<typename matType::value_type>::is_iec559, "'matrixCompMult' only accept floating-point inputs");
|
||||
|
||||
matType result(matType::_null);
|
||||
for(typename matType::size_type i = 0; i < matType::row_size(); ++i)
|
||||
@ -54,7 +54,7 @@ namespace glm
|
||||
detail::tvec2<T, P> const & r
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'outerProduct' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'outerProduct' only accept floating-point inputs");
|
||||
|
||||
detail::tmat2x2<T, P> m(detail::tmat2x2<T, P>::null);
|
||||
m[0][0] = c[0] * r[0];
|
||||
@ -71,7 +71,7 @@ namespace glm
|
||||
detail::tvec3<T, P> const & r
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'outerProduct' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'outerProduct' only accept floating-point inputs");
|
||||
|
||||
detail::tmat3x3<T, P> m(detail::tmat3x3<T, P>::null);
|
||||
for(typename detail::tmat3x3<T, P>::size_type i(0); i < m.length(); ++i)
|
||||
@ -86,7 +86,7 @@ namespace glm
|
||||
detail::tvec4<T, P> const & r
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'outerProduct' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'outerProduct' only accept floating-point inputs");
|
||||
|
||||
detail::tmat4x4<T, P> m(detail::tmat4x4<T, P>::null);
|
||||
for(typename detail::tmat4x4<T, P>::size_type i(0); i < m.length(); ++i)
|
||||
@ -101,7 +101,7 @@ namespace glm
|
||||
detail::tvec2<T, P> const & r
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'outerProduct' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'outerProduct' only accept floating-point inputs");
|
||||
|
||||
detail::tmat2x3<T, P> m(detail::tmat2x3<T, P>::null);
|
||||
m[0][0] = c.x * r.x;
|
||||
@ -120,7 +120,7 @@ namespace glm
|
||||
detail::tvec3<T, P> const & r
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'outerProduct' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'outerProduct' only accept floating-point inputs");
|
||||
|
||||
detail::tmat3x2<T, P> m(detail::tmat3x2<T, P>::null);
|
||||
m[0][0] = c.x * r.x;
|
||||
@ -139,7 +139,7 @@ namespace glm
|
||||
detail::tvec2<T, P> const & r
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'outerProduct' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'outerProduct' only accept floating-point inputs");
|
||||
|
||||
detail::tmat2x4<T, P> m(detail::tmat2x4<T, P>::null);
|
||||
m[0][0] = c.x * r.x;
|
||||
@ -160,7 +160,7 @@ namespace glm
|
||||
detail::tvec4<T, P> const & r
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'outerProduct' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'outerProduct' only accept floating-point inputs");
|
||||
|
||||
detail::tmat4x2<T, P> m(detail::tmat4x2<T, P>::null);
|
||||
m[0][0] = c.x * r.x;
|
||||
@ -181,7 +181,7 @@ namespace glm
|
||||
detail::tvec3<T, P> const & r
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'outerProduct' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'outerProduct' only accept floating-point inputs");
|
||||
|
||||
detail::tmat3x4<T, P> m(detail::tmat3x4<T, P>::null);
|
||||
m[0][0] = c.x * r.x;
|
||||
@ -206,7 +206,7 @@ namespace glm
|
||||
detail::tvec4<T, P> const & r
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'outerProduct' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'outerProduct' only accept floating-point inputs");
|
||||
|
||||
detail::tmat4x3<T, P> m(detail::tmat4x3<T, P>::null);
|
||||
m[0][0] = c.x * r.x;
|
||||
@ -230,7 +230,7 @@ namespace glm
|
||||
detail::tmat2x2<T, P> const & m
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'transpose' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'transpose' only accept floating-point inputs");
|
||||
|
||||
detail::tmat2x2<T, P> result(detail::tmat2x2<T, P>::_null);
|
||||
result[0][0] = m[0][0];
|
||||
@ -246,7 +246,7 @@ namespace glm
|
||||
detail::tmat3x3<T, P> const & m
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'transpose' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'transpose' only accept floating-point inputs");
|
||||
|
||||
detail::tmat3x3<T, P> result(detail::tmat3x3<T, P>::_null);
|
||||
result[0][0] = m[0][0];
|
||||
@ -269,7 +269,7 @@ namespace glm
|
||||
detail::tmat4x4<T, P> const & m
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'transpose' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'transpose' only accept floating-point inputs");
|
||||
|
||||
detail::tmat4x4<T, P> result(detail::tmat4x4<T, P>::_null);
|
||||
result[0][0] = m[0][0];
|
||||
@ -300,7 +300,7 @@ namespace glm
|
||||
detail::tmat3x2<T, P> const & m
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'transpose' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'transpose' only accept floating-point inputs");
|
||||
|
||||
detail::tmat2x3<T, P> result(detail::tmat2x3<T, P>::_null);
|
||||
result[0][0] = m[0][0];
|
||||
@ -318,7 +318,7 @@ namespace glm
|
||||
detail::tmat2x3<T, P> const & m
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'transpose' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'transpose' only accept floating-point inputs");
|
||||
|
||||
detail::tmat3x2<T, P> result(detail::tmat3x2<T, P>::_null);
|
||||
result[0][0] = m[0][0];
|
||||
@ -336,7 +336,7 @@ namespace glm
|
||||
detail::tmat4x2<T, P> const & m
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'transpose' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'transpose' only accept floating-point inputs");
|
||||
|
||||
detail::tmat2x4<T, P> result(detail::tmat2x4<T, P>::_null);
|
||||
result[0][0] = m[0][0];
|
||||
@ -356,7 +356,7 @@ namespace glm
|
||||
detail::tmat2x4<T, P> const & m
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'transpose' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'transpose' only accept floating-point inputs");
|
||||
|
||||
detail::tmat4x2<T, P> result(detail::tmat4x2<T, P>::_null);
|
||||
result[0][0] = m[0][0];
|
||||
@ -376,7 +376,7 @@ namespace glm
|
||||
detail::tmat4x3<T, P> const & m
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'transpose' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'transpose' only accept floating-point inputs");
|
||||
|
||||
detail::tmat3x4<T, P> result(detail::tmat3x4<T, P>::_null);
|
||||
result[0][0] = m[0][0];
|
||||
@ -400,7 +400,7 @@ namespace glm
|
||||
detail::tmat3x4<T, P> const & m
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'transpose' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'transpose' only accept floating-point inputs");
|
||||
|
||||
detail::tmat4x3<T, P> result(detail::tmat4x3<T, P>::_null);
|
||||
result[0][0] = m[0][0];
|
||||
@ -424,7 +424,7 @@ namespace glm
|
||||
detail::tmat2x2<T, P> const & m
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'determinant' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'determinant' only accept floating-point inputs");
|
||||
|
||||
return m[0][0] * m[1][1] - m[1][0] * m[0][1];
|
||||
}
|
||||
@ -435,7 +435,7 @@ namespace glm
|
||||
detail::tmat3x3<T, P> const & m
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'determinant' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'determinant' only accept floating-point inputs");
|
||||
|
||||
return
|
||||
+ m[0][0] * (m[1][1] * m[2][2] - m[2][1] * m[1][2])
|
||||
@ -449,7 +449,7 @@ namespace glm
|
||||
detail::tmat4x4<T, P> const & m
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'determinant' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'determinant' only accept floating-point inputs");
|
||||
|
||||
T SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3];
|
||||
T SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3];
|
||||
@ -476,7 +476,7 @@ namespace glm
|
||||
detail::tmat2x2<T, P> const & m
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'inverse' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'inverse' only accept floating-point inputs");
|
||||
|
||||
//valType Determinant = m[0][0] * m[1][1] - m[1][0] * m[0][1];
|
||||
T Determinant = determinant(m);
|
||||
@ -496,7 +496,7 @@ namespace glm
|
||||
detail::tmat3x3<T, P> const & m
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'inverse' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'inverse' only accept floating-point inputs");
|
||||
|
||||
//valType Determinant = m[0][0] * (m[1][1] * m[2][2] - m[2][1] * m[1][2])
|
||||
// - m[1][0] * (m[0][1] * m[2][2] - m[2][1] * m[0][2])
|
||||
@ -525,7 +525,7 @@ namespace glm
|
||||
detail::tmat4x4<T, P> const & m
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'inverse' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'inverse' only accept floating-point inputs");
|
||||
|
||||
T Coef00 = m[2][2] * m[3][3] - m[3][2] * m[2][3];
|
||||
T Coef02 = m[1][2] * m[3][3] - m[3][2] * m[1][3];
|
||||
|
@ -37,7 +37,7 @@ namespace glm
|
||||
genType const & degrees
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'radians' only accept floating-point input");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'radians' only accept floating-point input");
|
||||
|
||||
return degrees * genType(0.01745329251994329576923690768489);
|
||||
}
|
||||
@ -51,7 +51,7 @@ namespace glm
|
||||
genType const & radians
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'degrees' only accept floating-point input");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'degrees' only accept floating-point input");
|
||||
|
||||
return radians * genType(57.295779513082320876798154814105);
|
||||
}
|
||||
@ -65,7 +65,7 @@ namespace glm
|
||||
genType const & angle
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'sin' only accept floating-point input");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'sin' only accept floating-point input");
|
||||
|
||||
return genType(::std::sin(angle));
|
||||
}
|
||||
@ -76,7 +76,7 @@ namespace glm
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType cos(genType const & angle)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'cos' only accept floating-point input");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'cos' only accept floating-point input");
|
||||
|
||||
return genType(::std::cos(angle));
|
||||
}
|
||||
@ -90,7 +90,7 @@ namespace glm
|
||||
genType const & angle
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'tan' only accept floating-point input");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'tan' only accept floating-point input");
|
||||
|
||||
return genType(::std::tan(angle));
|
||||
}
|
||||
@ -104,7 +104,7 @@ namespace glm
|
||||
genType const & x
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'asin' only accept floating-point input");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'asin' only accept floating-point input");
|
||||
|
||||
return genType(::std::asin(x));
|
||||
}
|
||||
@ -118,7 +118,7 @@ namespace glm
|
||||
genType const & x
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'acos' only accept floating-point input");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'acos' only accept floating-point input");
|
||||
|
||||
return genType(::std::acos(x));
|
||||
}
|
||||
@ -133,7 +133,7 @@ namespace glm
|
||||
genType const & x
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'atan' only accept floating-point input");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'atan' only accept floating-point input");
|
||||
|
||||
return genType(::std::atan2(y, x));
|
||||
}
|
||||
@ -146,7 +146,7 @@ namespace glm
|
||||
genType const & x
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'atan' only accept floating-point input");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'atan' only accept floating-point input");
|
||||
|
||||
return genType(::std::atan(x));
|
||||
}
|
||||
@ -160,7 +160,7 @@ namespace glm
|
||||
genType const & angle
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'sinh' only accept floating-point input");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'sinh' only accept floating-point input");
|
||||
|
||||
return genType(std::sinh(angle));
|
||||
}
|
||||
@ -174,7 +174,7 @@ namespace glm
|
||||
genType const & angle
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'cosh' only accept floating-point input");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'cosh' only accept floating-point input");
|
||||
|
||||
return genType(std::cosh(angle));
|
||||
}
|
||||
@ -188,7 +188,7 @@ namespace glm
|
||||
genType const & angle
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'tanh' only accept floating-point input");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'tanh' only accept floating-point input");
|
||||
|
||||
return genType(std::tanh(angle));
|
||||
}
|
||||
@ -202,7 +202,7 @@ namespace glm
|
||||
genType const & x
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'asinh' only accept floating-point input");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'asinh' only accept floating-point input");
|
||||
|
||||
return (x < genType(0) ? genType(-1) : (x > genType(0) ? genType(1) : genType(0))) * log(abs(x) + sqrt(genType(1) + x * x));
|
||||
}
|
||||
@ -216,7 +216,7 @@ namespace glm
|
||||
genType const & x
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'acosh' only accept floating-point input");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'acosh' only accept floating-point input");
|
||||
|
||||
if(x < genType(1))
|
||||
return genType(0);
|
||||
@ -232,7 +232,7 @@ namespace glm
|
||||
genType const & x
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'atanh' only accept floating-point input");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'atanh' only accept floating-point input");
|
||||
|
||||
if(abs(x) >= genType(1))
|
||||
return 0;
|
||||
|
@ -35,9 +35,7 @@ namespace glm
|
||||
vecType<T, P> const & y
|
||||
)
|
||||
{
|
||||
//GLM_STATIC_ASSERT(detail::is_vector<vecType<T, P> >::_YES,
|
||||
// "Invalid template instantiation of 'lessThan', GLM vector types required");
|
||||
GLM_STATIC_ASSERT(detail::is_bool<T>::_NO,
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer,
|
||||
"Invalid template instantiation of 'lessThan', GLM vector types required floating-point or integer value types vectors");
|
||||
assert(x.length() == y.length());
|
||||
|
||||
@ -55,9 +53,7 @@ namespace glm
|
||||
vecType<T, P> const & y
|
||||
)
|
||||
{
|
||||
//GLM_STATIC_ASSERT(detail::is_vector<vecType<T, P> >::_YES,
|
||||
// "Invalid template instantiation of 'lessThanEqual', GLM vector types required");
|
||||
GLM_STATIC_ASSERT(detail::is_bool<T>::_NO,
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer,
|
||||
"Invalid template instantiation of 'lessThanEqual', GLM vector types required floating-point or integer value types vectors");
|
||||
assert(x.length() == y.length());
|
||||
|
||||
@ -74,9 +70,7 @@ namespace glm
|
||||
vecType<T, P> const & y
|
||||
)
|
||||
{
|
||||
//GLM_STATIC_ASSERT(detail::is_vector<vecType<T, P> >::_YES,
|
||||
// "Invalid template instantiation of 'greaterThan', GLM vector types required");
|
||||
GLM_STATIC_ASSERT(detail::is_bool<T>::_NO,
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer,
|
||||
"Invalid template instantiation of 'greaterThan', GLM vector types required floating-point or integer value types vectors");
|
||||
assert(x.length() == y.length());
|
||||
|
||||
@ -93,9 +87,7 @@ namespace glm
|
||||
vecType<T, P> const & y
|
||||
)
|
||||
{
|
||||
//GLM_STATIC_ASSERT(detail::is_vector<vecType<T, P> >::_YES,
|
||||
// "Invalid template instantiation of 'greaterThanEqual', GLM vector types required");
|
||||
GLM_STATIC_ASSERT(detail::is_bool<T>::_NO,
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer,
|
||||
"Invalid template instantiation of 'greaterThanEqual', GLM vector types required floating-point or integer value types vectors");
|
||||
assert(x.length() == y.length());
|
||||
|
||||
|
@ -90,83 +90,6 @@ namespace detail
|
||||
|
||||
/// @}
|
||||
|
||||
namespace detail
|
||||
{
|
||||
//////////////////
|
||||
// float
|
||||
|
||||
template <typename T>
|
||||
struct is_float
|
||||
{
|
||||
enum is_float_enum
|
||||
{
|
||||
_YES = 0,
|
||||
_NO = 1
|
||||
};
|
||||
};
|
||||
|
||||
#define GLM_DETAIL_IS_FLOAT(T) \
|
||||
template <> \
|
||||
struct is_float<T> \
|
||||
{ \
|
||||
enum is_float_enum \
|
||||
{ \
|
||||
_YES = 1, \
|
||||
_NO = 0 \
|
||||
}; \
|
||||
}
|
||||
|
||||
////////////////////
|
||||
// Mark half to be flaot
|
||||
GLM_DETAIL_IS_FLOAT(float);
|
||||
GLM_DETAIL_IS_FLOAT(double);
|
||||
GLM_DETAIL_IS_FLOAT(long double);
|
||||
|
||||
template <>
|
||||
struct float_or_int_trait<float32>
|
||||
{
|
||||
enum{ID = float_or_int_value::GLM_FLOAT};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct float_or_int_trait<float64>
|
||||
{
|
||||
enum{ID = float_or_int_value::GLM_FLOAT};
|
||||
};
|
||||
|
||||
union uif64
|
||||
{
|
||||
GLM_FUNC_QUALIFIER uif64() :
|
||||
i(0)
|
||||
{}
|
||||
|
||||
GLM_FUNC_QUALIFIER uif64(double f) :
|
||||
f(f)
|
||||
{}
|
||||
|
||||
GLM_FUNC_QUALIFIER uif64(uint64 i) :
|
||||
i(i)
|
||||
{}
|
||||
|
||||
double f;
|
||||
uint64 i;
|
||||
};
|
||||
|
||||
//////////////////
|
||||
// type
|
||||
|
||||
template <typename T>
|
||||
struct type
|
||||
{
|
||||
enum type_enum
|
||||
{
|
||||
is_float = is_float<T>::_YES,
|
||||
is_int = is_int<T>::_YES,
|
||||
is_uint = is_uint<T>::_YES,
|
||||
is_bool = is_bool<T>::_YES
|
||||
};
|
||||
};
|
||||
}//namespace detail
|
||||
}//namespace glm
|
||||
|
||||
#endif//glm_core_type_float
|
||||
|
@ -186,166 +186,6 @@ namespace detail
|
||||
GLM_STATIC_ASSERT(sizeof(glm::uint64) == 8, "uint64 size isn't 8 bytes on this platform");
|
||||
#endif//GLM_STATIC_ASSERT_NULL
|
||||
|
||||
namespace detail
|
||||
{
|
||||
//////////////////
|
||||
// int
|
||||
|
||||
template <typename T>
|
||||
struct is_int
|
||||
{
|
||||
enum is_int_enum
|
||||
{
|
||||
_YES = 0,
|
||||
_NO = 1
|
||||
};
|
||||
};
|
||||
|
||||
#define GLM_DETAIL_IS_INT(T) \
|
||||
template <> \
|
||||
struct is_int<T> \
|
||||
{ \
|
||||
enum is_int_enum \
|
||||
{ \
|
||||
_YES = 1, \
|
||||
_NO = 0 \
|
||||
}; \
|
||||
}
|
||||
|
||||
GLM_DETAIL_IS_INT(signed char);
|
||||
GLM_DETAIL_IS_INT(signed short);
|
||||
GLM_DETAIL_IS_INT(signed int);
|
||||
GLM_DETAIL_IS_INT(signed long);
|
||||
# if(GLM_LANG >= GLM_LANG_CXX0X)
|
||||
GLM_DETAIL_IS_INT(signed long long);
|
||||
# else
|
||||
GLM_DETAIL_IS_INT(glm::int64);
|
||||
# endif
|
||||
|
||||
//////////////////
|
||||
// uint
|
||||
|
||||
template <typename T>
|
||||
struct is_uint
|
||||
{
|
||||
enum is_uint_enum
|
||||
{
|
||||
_YES = 0,
|
||||
_NO = 1
|
||||
};
|
||||
};
|
||||
|
||||
#define GLM_DETAIL_IS_UINT(T) \
|
||||
template <> \
|
||||
struct is_uint<T> \
|
||||
{ \
|
||||
enum is_uint_enum \
|
||||
{ \
|
||||
_YES = 1, \
|
||||
_NO = 0 \
|
||||
}; \
|
||||
}
|
||||
|
||||
GLM_DETAIL_IS_UINT(unsigned char);
|
||||
GLM_DETAIL_IS_UINT(unsigned short);
|
||||
GLM_DETAIL_IS_UINT(unsigned int);
|
||||
GLM_DETAIL_IS_UINT(unsigned long);
|
||||
# if(GLM_LANG >= GLM_LANG_CXX0X)
|
||||
GLM_DETAIL_IS_INT(unsigned long long);
|
||||
# else
|
||||
GLM_DETAIL_IS_INT(glm::uint64);
|
||||
# endif
|
||||
|
||||
//////////////////
|
||||
// bool
|
||||
|
||||
template <typename T>
|
||||
struct is_bool
|
||||
{
|
||||
enum is_bool_enum
|
||||
{
|
||||
_YES = 0,
|
||||
_NO = 1
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct is_bool<bool>
|
||||
{
|
||||
enum is_bool_enum
|
||||
{
|
||||
_YES = 1,
|
||||
_NO = 0
|
||||
};
|
||||
};
|
||||
|
||||
//////////////////
|
||||
// float_or_int_trait
|
||||
|
||||
struct float_or_int_value
|
||||
{
|
||||
enum
|
||||
{
|
||||
GLM_ERROR,
|
||||
GLM_FLOAT,
|
||||
GLM_INT
|
||||
};
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct float_or_int_trait
|
||||
{
|
||||
enum{ID = float_or_int_value::GLM_ERROR};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct float_or_int_trait<detail::int8>
|
||||
{
|
||||
enum{ID = float_or_int_value::GLM_INT};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct float_or_int_trait<detail::int16>
|
||||
{
|
||||
enum{ID = float_or_int_value::GLM_INT};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct float_or_int_trait<detail::int32>
|
||||
{
|
||||
enum{ID = float_or_int_value::GLM_INT};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct float_or_int_trait<detail::int64>
|
||||
{
|
||||
enum{ID = float_or_int_value::GLM_INT};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct float_or_int_trait<detail::uint8>
|
||||
{
|
||||
enum{ID = float_or_int_value::GLM_INT};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct float_or_int_trait<detail::uint16>
|
||||
{
|
||||
enum{ID = float_or_int_value::GLM_INT};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct float_or_int_trait<detail::uint32>
|
||||
{
|
||||
enum{ID = float_or_int_value::GLM_INT};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct float_or_int_trait<detail::uint64>
|
||||
{
|
||||
enum{ID = float_or_int_value::GLM_INT};
|
||||
};
|
||||
}//namespace detail
|
||||
}//namespace glm
|
||||
|
||||
#endif//glm_core_type_int
|
||||
|
@ -207,7 +207,7 @@ namespace detail
|
||||
U const & s
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<U>::is_float || std::numeric_limits<U>::is_integer, "*mat4x4 constructor only takes float and integer types");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<U>::is_iec559 || std::numeric_limits<U>::is_integer, "*mat4x4 constructor only takes float and integer types");
|
||||
|
||||
value_type const Zero(0);
|
||||
this->value[0] = tvec4<T, P>(static_cast<T>(s), Zero, Zero, Zero);
|
||||
@ -230,25 +230,25 @@ namespace detail
|
||||
X4 const & x4, Y4 const & y4, Z4 const & z4, W4 const & w4
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<X1>::is_float || std::numeric_limits<X1>::is_integer, "*mat4x4 constructor only takes float and integer types, 1st parameter type invalid.");
|
||||
GLM_STATIC_ASSERT(detail::type<Y1>::is_float || std::numeric_limits<Y1>::is_integer, "*mat4x4 constructor only takes float and integer types, 2nd parameter type invalid.");
|
||||
GLM_STATIC_ASSERT(detail::type<Z1>::is_float || std::numeric_limits<Z1>::is_integer, "*mat4x4 constructor only takes float and integer types, 3rd parameter type invalid.");
|
||||
GLM_STATIC_ASSERT(detail::type<W1>::is_float || std::numeric_limits<W1>::is_integer, "*mat4x4 constructor only takes float and integer types, 4th parameter type invalid.");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<X1>::is_iec559 || std::numeric_limits<X1>::is_integer, "*mat4x4 constructor only takes float and integer types, 1st parameter type invalid.");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<Y1>::is_iec559 || std::numeric_limits<Y1>::is_integer, "*mat4x4 constructor only takes float and integer types, 2nd parameter type invalid.");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<Z1>::is_iec559 || std::numeric_limits<Z1>::is_integer, "*mat4x4 constructor only takes float and integer types, 3rd parameter type invalid.");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<W1>::is_iec559 || std::numeric_limits<W1>::is_integer, "*mat4x4 constructor only takes float and integer types, 4th parameter type invalid.");
|
||||
|
||||
GLM_STATIC_ASSERT(detail::type<X2>::is_float || std::numeric_limits<X2>::is_integer, "*mat4x4 constructor only takes float and integer types, 5th parameter type invalid.");
|
||||
GLM_STATIC_ASSERT(detail::type<Y2>::is_float || std::numeric_limits<Y2>::is_integer, "*mat4x4 constructor only takes float and integer types, 6th parameter type invalid.");
|
||||
GLM_STATIC_ASSERT(detail::type<Z2>::is_float || std::numeric_limits<Z2>::is_integer, "*mat4x4 constructor only takes float and integer types, 7th parameter type invalid.");
|
||||
GLM_STATIC_ASSERT(detail::type<W2>::is_float || std::numeric_limits<W2>::is_integer, "*mat4x4 constructor only takes float and integer types, 8th parameter type invalid.");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<X2>::is_iec559 || std::numeric_limits<X2>::is_integer, "*mat4x4 constructor only takes float and integer types, 5th parameter type invalid.");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<Y2>::is_iec559 || std::numeric_limits<Y2>::is_integer, "*mat4x4 constructor only takes float and integer types, 6th parameter type invalid.");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<Z2>::is_iec559 || std::numeric_limits<Z2>::is_integer, "*mat4x4 constructor only takes float and integer types, 7th parameter type invalid.");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<W2>::is_iec559 || std::numeric_limits<W2>::is_integer, "*mat4x4 constructor only takes float and integer types, 8th parameter type invalid.");
|
||||
|
||||
GLM_STATIC_ASSERT(detail::type<X3>::is_float || std::numeric_limits<X3>::is_integer, "*mat4x4 constructor only takes float and integer types, 9th parameter type invalid.");
|
||||
GLM_STATIC_ASSERT(detail::type<Y3>::is_float || std::numeric_limits<Y3>::is_integer, "*mat4x4 constructor only takes float and integer types, 10th parameter type invalid.");
|
||||
GLM_STATIC_ASSERT(detail::type<Z3>::is_float || std::numeric_limits<Z3>::is_integer, "*mat4x4 constructor only takes float and integer types, 11th parameter type invalid.");
|
||||
GLM_STATIC_ASSERT(detail::type<W3>::is_float || std::numeric_limits<W3>::is_integer, "*mat4x4 constructor only takes float and integer types, 12th parameter type invalid.");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<X3>::is_iec559 || std::numeric_limits<X3>::is_integer, "*mat4x4 constructor only takes float and integer types, 9th parameter type invalid.");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<Y3>::is_iec559 || std::numeric_limits<Y3>::is_integer, "*mat4x4 constructor only takes float and integer types, 10th parameter type invalid.");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<Z3>::is_iec559 || std::numeric_limits<Z3>::is_integer, "*mat4x4 constructor only takes float and integer types, 11th parameter type invalid.");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<W3>::is_iec559 || std::numeric_limits<W3>::is_integer, "*mat4x4 constructor only takes float and integer types, 12th parameter type invalid.");
|
||||
|
||||
GLM_STATIC_ASSERT(detail::type<X4>::is_float || std::numeric_limits<X4>::is_integer, "*mat4x4 constructor only takes float and integer types, 13th parameter type invalid.");
|
||||
GLM_STATIC_ASSERT(detail::type<Y4>::is_float || std::numeric_limits<Y4>::is_integer, "*mat4x4 constructor only takes float and integer types, 14th parameter type invalid.");
|
||||
GLM_STATIC_ASSERT(detail::type<Z4>::is_float || std::numeric_limits<Z4>::is_integer, "*mat4x4 constructor only takes float and integer types, 15th parameter type invalid.");
|
||||
GLM_STATIC_ASSERT(detail::type<W4>::is_float || std::numeric_limits<W4>::is_integer, "*mat4x4 constructor only takes float and integer types, 16th parameter type invalid.");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<X4>::is_iec559 || std::numeric_limits<X4>::is_integer, "*mat4x4 constructor only takes float and integer types, 13th parameter type invalid.");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<Y4>::is_iec559 || std::numeric_limits<Y4>::is_integer, "*mat4x4 constructor only takes float and integer types, 14th parameter type invalid.");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<Z4>::is_iec559 || std::numeric_limits<Z4>::is_integer, "*mat4x4 constructor only takes float and integer types, 15th parameter type invalid.");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<W4>::is_iec559 || std::numeric_limits<W4>::is_integer, "*mat4x4 constructor only takes float and integer types, 16th parameter type invalid.");
|
||||
|
||||
this->value[0] = col_type(static_cast<T>(x1), value_type(y1), value_type(z1), value_type(w1));
|
||||
this->value[1] = col_type(static_cast<T>(x2), value_type(y2), value_type(z2), value_type(w2));
|
||||
@ -266,10 +266,10 @@ namespace detail
|
||||
tvec4<V4, P> const & v4
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<V1>::is_float || std::numeric_limits<V1>::is_integer, "*mat4x4 constructor only takes float and integer types, 1st parameter type invalid.");
|
||||
GLM_STATIC_ASSERT(detail::type<V2>::is_float || std::numeric_limits<V2>::is_integer, "*mat4x4 constructor only takes float and integer types, 2nd parameter type invalid.");
|
||||
GLM_STATIC_ASSERT(detail::type<V3>::is_float || std::numeric_limits<V3>::is_integer, "*mat4x4 constructor only takes float and integer types, 3rd parameter type invalid.");
|
||||
GLM_STATIC_ASSERT(detail::type<V4>::is_float || std::numeric_limits<V4>::is_integer, "*mat4x4 constructor only takes float and integer types, 4th parameter type invalid.");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<V1>::is_iec559 || std::numeric_limits<V1>::is_integer, "*mat4x4 constructor only takes float and integer types, 1st parameter type invalid.");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<V2>::is_iec559 || std::numeric_limits<V2>::is_integer, "*mat4x4 constructor only takes float and integer types, 2nd parameter type invalid.");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<V3>::is_iec559 || std::numeric_limits<V3>::is_integer, "*mat4x4 constructor only takes float and integer types, 3rd parameter type invalid.");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<V4>::is_iec559 || std::numeric_limits<V4>::is_integer, "*mat4x4 constructor only takes float and integer types, 4th parameter type invalid.");
|
||||
|
||||
this->value[0] = col_type(v1);
|
||||
this->value[1] = col_type(v2);
|
||||
|
@ -61,7 +61,7 @@ namespace detail
|
||||
public:
|
||||
T x, y, z, w;
|
||||
|
||||
GLM_FUNC_DECL int length() const;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR int length() const;
|
||||
|
||||
// Constructors
|
||||
tquat();
|
||||
|
@ -35,7 +35,7 @@ namespace glm
|
||||
genType const & angle
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'sec' only accept floating-point values");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'sec' only accept floating-point values");
|
||||
|
||||
return genType(1) / glm::cos(angle);
|
||||
}
|
||||
@ -49,7 +49,7 @@ namespace glm
|
||||
genType const & angle
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'csc' only accept floating-point values");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'csc' only accept floating-point values");
|
||||
|
||||
return genType(1) / glm::sin(angle);
|
||||
}
|
||||
@ -63,7 +63,7 @@ namespace glm
|
||||
genType const & angle
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'cot' only accept floating-point values");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'cot' only accept floating-point values");
|
||||
|
||||
return genType(1) / glm::tan(angle);
|
||||
}
|
||||
@ -77,7 +77,7 @@ namespace glm
|
||||
genType const & x
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'asec' only accept floating-point values");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'asec' only accept floating-point values");
|
||||
|
||||
return acos(genType(1) / x);
|
||||
}
|
||||
@ -91,7 +91,7 @@ namespace glm
|
||||
genType const & x
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'acsc' only accept floating-point values");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'acsc' only accept floating-point values");
|
||||
|
||||
return asin(genType(1) / x);
|
||||
}
|
||||
@ -105,7 +105,7 @@ namespace glm
|
||||
genType const & x
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'acot' only accept floating-point values");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'acot' only accept floating-point values");
|
||||
|
||||
genType const pi_over_2 = genType(3.1415926535897932384626433832795 / 2.0);
|
||||
return pi_over_2 - atan(x);
|
||||
@ -120,7 +120,7 @@ namespace glm
|
||||
genType const & angle
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'sech' only accept floating-point values");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'sech' only accept floating-point values");
|
||||
|
||||
return genType(1) / glm::cosh(angle);
|
||||
}
|
||||
@ -134,7 +134,7 @@ namespace glm
|
||||
genType const & angle
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'csch' only accept floating-point values");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'csch' only accept floating-point values");
|
||||
|
||||
return genType(1) / glm::sinh(angle);
|
||||
}
|
||||
@ -148,7 +148,7 @@ namespace glm
|
||||
genType const & angle
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'coth' only accept floating-point values");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'coth' only accept floating-point values");
|
||||
|
||||
return glm::cosh(angle) / glm::sinh(angle);
|
||||
}
|
||||
@ -162,7 +162,7 @@ namespace glm
|
||||
genType const & x
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'asech' only accept floating-point values");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'asech' only accept floating-point values");
|
||||
|
||||
return acosh(genType(1) / x);
|
||||
}
|
||||
@ -176,7 +176,7 @@ namespace glm
|
||||
genType const & x
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'acsch' only accept floating-point values");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'acsch' only accept floating-point values");
|
||||
|
||||
return asinh(genType(1) / x);
|
||||
}
|
||||
@ -190,7 +190,7 @@ namespace glm
|
||||
genType const & x
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'acoth' only accept floating-point values");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'acoth' only accept floating-point values");
|
||||
|
||||
return atanh(genType(1) / x);
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ namespace glm
|
||||
genType const & x
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'fastSqrt' only accept floating-point input");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'fastSqrt' only accept floating-point input");
|
||||
|
||||
return genType(1) / fastInverseSqrt(x);
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ namespace glm
|
||||
}
|
||||
|
||||
// Henry Gordon Dietz: http://aggregate.org/MAGIC/
|
||||
namespace _detail
|
||||
namespace detail
|
||||
{
|
||||
GLM_FUNC_QUALIFIER unsigned int ones32(unsigned int x)
|
||||
{
|
||||
@ -55,7 +55,7 @@ namespace _detail
|
||||
}
|
||||
|
||||
template <>
|
||||
struct _compute_log2<detail::float_or_int_value::GLM_INT>
|
||||
struct compute_log2<false>
|
||||
{
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER T operator() (T const & Value) const
|
||||
@ -67,7 +67,6 @@ namespace _detail
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
}//namespace _detail
|
||||
|
||||
// Henry Gordon Dietz: http://aggregate.org/MAGIC/
|
||||
|
@ -9,14 +9,14 @@
|
||||
|
||||
namespace glm
|
||||
{
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER T angle
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType angle
|
||||
(
|
||||
T const & x,
|
||||
T const & y
|
||||
genType const & x,
|
||||
genType const & y
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'angle' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'angle' only accept floating-point inputs");
|
||||
|
||||
#ifdef GLM_FORCE_RADIANS
|
||||
return acos(dot(x, y));
|
||||
@ -32,7 +32,7 @@ namespace glm
|
||||
vecType<T, P> const & y
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'angle' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'angle' only accept floating-point inputs");
|
||||
|
||||
#ifdef GLM_FORCE_RADIANS
|
||||
return acos(dot(x, y));
|
||||
@ -49,7 +49,7 @@ namespace glm
|
||||
detail::tvec2<T, P> const & y
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'orientedAngle' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'orientedAngle' only accept floating-point inputs");
|
||||
|
||||
#ifdef GLM_FORCE_RADIANS
|
||||
T const Angle(acos(dot(x, y)));
|
||||
@ -71,7 +71,7 @@ namespace glm
|
||||
detail::tvec3<T, P> const & ref
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'orientedAngle' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'orientedAngle' only accept floating-point inputs");
|
||||
|
||||
#ifdef GLM_FORCE_RADIANS
|
||||
T const Angle(acos(dot(x, y)));
|
||||
|
Loading…
Reference in New Issue
Block a user