diff --git a/glm/core/func_common.inl b/glm/core/func_common.inl index 635a7a00..162d7e47 100644 --- a/glm/core/func_common.inl +++ b/glm/core/func_common.inl @@ -148,7 +148,7 @@ namespace detail template GLM_FUNC_QUALIFIER genType roundEven(genType const& x) { - GLM_STATIC_ASSERT(detail::type::is_float, "'roundEven' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'roundEven' only accept floating-point inputs"); return genType(int(x + genType(int(x) % 2))); } diff --git a/glm/core/func_exponential.inl b/glm/core/func_exponential.inl index c58a23f1..acf4d449 100644 --- a/glm/core/func_exponential.inl +++ b/glm/core/func_exponential.inl @@ -98,32 +98,26 @@ namespace glm VECTORIZE_VEC(exp2) -namespace _detail +namespace detail { - template - struct _compute_log2 + template + struct compute_log2 { template 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 for integer types support. Others types are not supported."); - return Value; - } -*/ }; template <> - struct _compute_log2 + struct compute_log2 { template T operator() (T const & Value) const { - return T(::std::log(Value)) / T(0.69314718055994530941723212145818); + return static_cast(::std::log(Value)) * static_cast(1.4426950408889634073599246810019); } }; -}//namespace _detail +}//namespace detail // log2, ln2 = 0.69314718055994530941723212145818f template @@ -132,8 +126,11 @@ namespace _detail genType const & x ) { + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || std::numeric_limits::is_integer, + "GLM core 'log2' only accept floating-point inputs. Include for additional integer support."); + assert(x > genType(0)); // log2 is only defined on the range (0, inf] - return _detail::_compute_log2::ID>()(x); + return detail::compute_log2::is_iec559>()(x); } VECTORIZE_VEC(log2) diff --git a/glm/core/func_geometric.inl b/glm/core/func_geometric.inl index b082dc2d..093d92a8 100644 --- a/glm/core/func_geometric.inl +++ b/glm/core/func_geometric.inl @@ -40,7 +40,7 @@ namespace glm genType const & x ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'length' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'length' only accept floating-point inputs"); genType sqr = x * x; return sqrt(sqr); @@ -49,7 +49,7 @@ namespace glm template GLM_FUNC_QUALIFIER T length(detail::tvec2 const & v) { - GLM_STATIC_ASSERT(detail::type::is_float, "'length' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::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 GLM_FUNC_QUALIFIER T length(detail::tvec3 const & v) { - GLM_STATIC_ASSERT(detail::type::is_float, "'length' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::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 GLM_FUNC_QUALIFIER T length(detail::tvec4 const & v) { - GLM_STATIC_ASSERT(detail::type::is_float, "'length' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::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::is_float, "'distance' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'distance' only accept floating-point inputs"); return length(p1 - p0); } @@ -93,7 +93,7 @@ namespace glm detail::tvec2 const & p1 ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'distance' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'distance' only accept floating-point inputs"); return length(p1 - p0); } @@ -105,7 +105,7 @@ namespace glm detail::tvec3 const & p1 ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'distance' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'distance' only accept floating-point inputs"); return length(p1 - p0); } @@ -117,7 +117,7 @@ namespace glm detail::tvec4 const & p1 ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'distance' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::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::is_float, "'dot' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'dot' only accept floating-point inputs"); return x * y; } @@ -154,7 +154,7 @@ namespace glm detail::tvec3 const & y ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'dot' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::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 const & y ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'dot' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::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 const & y ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'cross' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'cross' only accept floating-point inputs"); return detail::tvec3( x.y * y.z - y.y * x.z, @@ -210,7 +210,7 @@ namespace glm genType const & x ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'normalize' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'normalize' only accept floating-point inputs"); return x < genType(0) ? genType(-1) : genType(1); } @@ -222,7 +222,7 @@ namespace glm detail::tvec2 const & x ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'normalize' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::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 const & x ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'normalize' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::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 const & x ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'normalize' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::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::is_float, "'refract' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::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::is_float, "'refract' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'refract' only accept floating-point inputs"); T dotValue = dot(N, I); T k = T(1) - eta * eta * (T(1) - dotValue * dotValue); diff --git a/glm/core/func_matrix.inl b/glm/core/func_matrix.inl index 5f8a854f..096fa9f2 100644 --- a/glm/core/func_matrix.inl +++ b/glm/core/func_matrix.inl @@ -38,7 +38,7 @@ namespace glm matType const & y ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'matrixCompMult' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::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 const & r ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'outerProduct' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'outerProduct' only accept floating-point inputs"); detail::tmat2x2 m(detail::tmat2x2::null); m[0][0] = c[0] * r[0]; @@ -71,7 +71,7 @@ namespace glm detail::tvec3 const & r ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'outerProduct' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'outerProduct' only accept floating-point inputs"); detail::tmat3x3 m(detail::tmat3x3::null); for(typename detail::tmat3x3::size_type i(0); i < m.length(); ++i) @@ -86,7 +86,7 @@ namespace glm detail::tvec4 const & r ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'outerProduct' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'outerProduct' only accept floating-point inputs"); detail::tmat4x4 m(detail::tmat4x4::null); for(typename detail::tmat4x4::size_type i(0); i < m.length(); ++i) @@ -101,7 +101,7 @@ namespace glm detail::tvec2 const & r ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'outerProduct' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'outerProduct' only accept floating-point inputs"); detail::tmat2x3 m(detail::tmat2x3::null); m[0][0] = c.x * r.x; @@ -120,7 +120,7 @@ namespace glm detail::tvec3 const & r ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'outerProduct' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'outerProduct' only accept floating-point inputs"); detail::tmat3x2 m(detail::tmat3x2::null); m[0][0] = c.x * r.x; @@ -139,7 +139,7 @@ namespace glm detail::tvec2 const & r ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'outerProduct' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'outerProduct' only accept floating-point inputs"); detail::tmat2x4 m(detail::tmat2x4::null); m[0][0] = c.x * r.x; @@ -160,7 +160,7 @@ namespace glm detail::tvec4 const & r ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'outerProduct' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'outerProduct' only accept floating-point inputs"); detail::tmat4x2 m(detail::tmat4x2::null); m[0][0] = c.x * r.x; @@ -181,7 +181,7 @@ namespace glm detail::tvec3 const & r ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'outerProduct' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'outerProduct' only accept floating-point inputs"); detail::tmat3x4 m(detail::tmat3x4::null); m[0][0] = c.x * r.x; @@ -206,7 +206,7 @@ namespace glm detail::tvec4 const & r ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'outerProduct' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'outerProduct' only accept floating-point inputs"); detail::tmat4x3 m(detail::tmat4x3::null); m[0][0] = c.x * r.x; @@ -230,7 +230,7 @@ namespace glm detail::tmat2x2 const & m ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'transpose' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'transpose' only accept floating-point inputs"); detail::tmat2x2 result(detail::tmat2x2::_null); result[0][0] = m[0][0]; @@ -246,7 +246,7 @@ namespace glm detail::tmat3x3 const & m ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'transpose' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'transpose' only accept floating-point inputs"); detail::tmat3x3 result(detail::tmat3x3::_null); result[0][0] = m[0][0]; @@ -269,7 +269,7 @@ namespace glm detail::tmat4x4 const & m ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'transpose' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'transpose' only accept floating-point inputs"); detail::tmat4x4 result(detail::tmat4x4::_null); result[0][0] = m[0][0]; @@ -300,7 +300,7 @@ namespace glm detail::tmat3x2 const & m ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'transpose' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'transpose' only accept floating-point inputs"); detail::tmat2x3 result(detail::tmat2x3::_null); result[0][0] = m[0][0]; @@ -318,7 +318,7 @@ namespace glm detail::tmat2x3 const & m ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'transpose' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'transpose' only accept floating-point inputs"); detail::tmat3x2 result(detail::tmat3x2::_null); result[0][0] = m[0][0]; @@ -336,7 +336,7 @@ namespace glm detail::tmat4x2 const & m ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'transpose' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'transpose' only accept floating-point inputs"); detail::tmat2x4 result(detail::tmat2x4::_null); result[0][0] = m[0][0]; @@ -356,7 +356,7 @@ namespace glm detail::tmat2x4 const & m ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'transpose' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'transpose' only accept floating-point inputs"); detail::tmat4x2 result(detail::tmat4x2::_null); result[0][0] = m[0][0]; @@ -376,7 +376,7 @@ namespace glm detail::tmat4x3 const & m ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'transpose' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'transpose' only accept floating-point inputs"); detail::tmat3x4 result(detail::tmat3x4::_null); result[0][0] = m[0][0]; @@ -400,7 +400,7 @@ namespace glm detail::tmat3x4 const & m ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'transpose' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'transpose' only accept floating-point inputs"); detail::tmat4x3 result(detail::tmat4x3::_null); result[0][0] = m[0][0]; @@ -424,7 +424,7 @@ namespace glm detail::tmat2x2 const & m ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'determinant' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::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 const & m ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'determinant' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::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 const & m ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'determinant' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::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 const & m ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'inverse' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::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 const & m ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'inverse' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::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 const & m ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'inverse' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::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]; diff --git a/glm/core/func_trigonometric.inl b/glm/core/func_trigonometric.inl index 5f8a0055..45553a63 100644 --- a/glm/core/func_trigonometric.inl +++ b/glm/core/func_trigonometric.inl @@ -37,7 +37,7 @@ namespace glm genType const & degrees ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'radians' only accept floating-point input"); + GLM_STATIC_ASSERT(std::numeric_limits::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::is_float, "'degrees' only accept floating-point input"); + GLM_STATIC_ASSERT(std::numeric_limits::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::is_float, "'sin' only accept floating-point input"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'sin' only accept floating-point input"); return genType(::std::sin(angle)); } @@ -76,7 +76,7 @@ namespace glm template GLM_FUNC_QUALIFIER genType cos(genType const & angle) { - GLM_STATIC_ASSERT(detail::type::is_float, "'cos' only accept floating-point input"); + GLM_STATIC_ASSERT(std::numeric_limits::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::is_float, "'tan' only accept floating-point input"); + GLM_STATIC_ASSERT(std::numeric_limits::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::is_float, "'asin' only accept floating-point input"); + GLM_STATIC_ASSERT(std::numeric_limits::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::is_float, "'acos' only accept floating-point input"); + GLM_STATIC_ASSERT(std::numeric_limits::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::is_float, "'atan' only accept floating-point input"); + GLM_STATIC_ASSERT(std::numeric_limits::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::is_float, "'atan' only accept floating-point input"); + GLM_STATIC_ASSERT(std::numeric_limits::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::is_float, "'sinh' only accept floating-point input"); + GLM_STATIC_ASSERT(std::numeric_limits::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::is_float, "'cosh' only accept floating-point input"); + GLM_STATIC_ASSERT(std::numeric_limits::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::is_float, "'tanh' only accept floating-point input"); + GLM_STATIC_ASSERT(std::numeric_limits::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::is_float, "'asinh' only accept floating-point input"); + GLM_STATIC_ASSERT(std::numeric_limits::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::is_float, "'acosh' only accept floating-point input"); + GLM_STATIC_ASSERT(std::numeric_limits::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::is_float, "'atanh' only accept floating-point input"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'atanh' only accept floating-point input"); if(abs(x) >= genType(1)) return 0; diff --git a/glm/core/func_vector_relational.inl b/glm/core/func_vector_relational.inl index da0a4933..e229bf6b 100644 --- a/glm/core/func_vector_relational.inl +++ b/glm/core/func_vector_relational.inl @@ -35,9 +35,7 @@ namespace glm vecType const & y ) { - //GLM_STATIC_ASSERT(detail::is_vector >::_YES, - // "Invalid template instantiation of 'lessThan', GLM vector types required"); - GLM_STATIC_ASSERT(detail::is_bool::_NO, + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || std::numeric_limits::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 const & y ) { - //GLM_STATIC_ASSERT(detail::is_vector >::_YES, - // "Invalid template instantiation of 'lessThanEqual', GLM vector types required"); - GLM_STATIC_ASSERT(detail::is_bool::_NO, + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || std::numeric_limits::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 const & y ) { - //GLM_STATIC_ASSERT(detail::is_vector >::_YES, - // "Invalid template instantiation of 'greaterThan', GLM vector types required"); - GLM_STATIC_ASSERT(detail::is_bool::_NO, + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || std::numeric_limits::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 const & y ) { - //GLM_STATIC_ASSERT(detail::is_vector >::_YES, - // "Invalid template instantiation of 'greaterThanEqual', GLM vector types required"); - GLM_STATIC_ASSERT(detail::is_bool::_NO, + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || std::numeric_limits::is_integer, "Invalid template instantiation of 'greaterThanEqual', GLM vector types required floating-point or integer value types vectors"); assert(x.length() == y.length()); diff --git a/glm/core/type_float.hpp b/glm/core/type_float.hpp index 11859338..c729da3a 100644 --- a/glm/core/type_float.hpp +++ b/glm/core/type_float.hpp @@ -90,83 +90,6 @@ namespace detail /// @} -namespace detail -{ - ////////////////// - // float - - template - struct is_float - { - enum is_float_enum - { - _YES = 0, - _NO = 1 - }; - }; - - #define GLM_DETAIL_IS_FLOAT(T) \ - template <> \ - struct is_float \ - { \ - 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 - { - enum{ID = float_or_int_value::GLM_FLOAT}; - }; - - template <> - struct float_or_int_trait - { - 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 - struct type - { - enum type_enum - { - is_float = is_float::_YES, - is_int = is_int::_YES, - is_uint = is_uint::_YES, - is_bool = is_bool::_YES - }; - }; -}//namespace detail }//namespace glm #endif//glm_core_type_float diff --git a/glm/core/type_int.hpp b/glm/core/type_int.hpp index 2411ea29..9924557b 100644 --- a/glm/core/type_int.hpp +++ b/glm/core/type_int.hpp @@ -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 - struct is_int - { - enum is_int_enum - { - _YES = 0, - _NO = 1 - }; - }; - - #define GLM_DETAIL_IS_INT(T) \ - template <> \ - struct is_int \ - { \ - 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 - struct is_uint - { - enum is_uint_enum - { - _YES = 0, - _NO = 1 - }; - }; - - #define GLM_DETAIL_IS_UINT(T) \ - template <> \ - struct is_uint \ - { \ - 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 - struct is_bool - { - enum is_bool_enum - { - _YES = 0, - _NO = 1 - }; - }; - - template <> - struct is_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 - struct float_or_int_trait - { - enum{ID = float_or_int_value::GLM_ERROR}; - }; - - template <> - struct float_or_int_trait - { - enum{ID = float_or_int_value::GLM_INT}; - }; - - template <> - struct float_or_int_trait - { - enum{ID = float_or_int_value::GLM_INT}; - }; - - template <> - struct float_or_int_trait - { - enum{ID = float_or_int_value::GLM_INT}; - }; - - template <> - struct float_or_int_trait - { - enum{ID = float_or_int_value::GLM_INT}; - }; - - template <> - struct float_or_int_trait - { - enum{ID = float_or_int_value::GLM_INT}; - }; - - template <> - struct float_or_int_trait - { - enum{ID = float_or_int_value::GLM_INT}; - }; - - template <> - struct float_or_int_trait - { - enum{ID = float_or_int_value::GLM_INT}; - }; - - template <> - struct float_or_int_trait - { - enum{ID = float_or_int_value::GLM_INT}; - }; -}//namespace detail }//namespace glm #endif//glm_core_type_int diff --git a/glm/core/type_mat4x4.inl b/glm/core/type_mat4x4.inl index d3476fa8..e45cccc3 100644 --- a/glm/core/type_mat4x4.inl +++ b/glm/core/type_mat4x4.inl @@ -207,7 +207,7 @@ namespace detail U const & s ) { - GLM_STATIC_ASSERT(detail::type::is_float || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types"); value_type const Zero(0); this->value[0] = tvec4(static_cast(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::is_float || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 1st parameter type invalid."); - GLM_STATIC_ASSERT(detail::type::is_float || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 2nd parameter type invalid."); - GLM_STATIC_ASSERT(detail::type::is_float || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 3rd parameter type invalid."); - GLM_STATIC_ASSERT(detail::type::is_float || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 4th parameter type invalid."); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 1st parameter type invalid."); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 2nd parameter type invalid."); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 3rd parameter type invalid."); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 4th parameter type invalid."); - GLM_STATIC_ASSERT(detail::type::is_float || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 5th parameter type invalid."); - GLM_STATIC_ASSERT(detail::type::is_float || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 6th parameter type invalid."); - GLM_STATIC_ASSERT(detail::type::is_float || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 7th parameter type invalid."); - GLM_STATIC_ASSERT(detail::type::is_float || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 8th parameter type invalid."); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 5th parameter type invalid."); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 6th parameter type invalid."); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 7th parameter type invalid."); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 8th parameter type invalid."); - GLM_STATIC_ASSERT(detail::type::is_float || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 9th parameter type invalid."); - GLM_STATIC_ASSERT(detail::type::is_float || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 10th parameter type invalid."); - GLM_STATIC_ASSERT(detail::type::is_float || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 11th parameter type invalid."); - GLM_STATIC_ASSERT(detail::type::is_float || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 12th parameter type invalid."); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 9th parameter type invalid."); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 10th parameter type invalid."); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 11th parameter type invalid."); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 12th parameter type invalid."); - GLM_STATIC_ASSERT(detail::type::is_float || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 13th parameter type invalid."); - GLM_STATIC_ASSERT(detail::type::is_float || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 14th parameter type invalid."); - GLM_STATIC_ASSERT(detail::type::is_float || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 15th parameter type invalid."); - GLM_STATIC_ASSERT(detail::type::is_float || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 16th parameter type invalid."); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 13th parameter type invalid."); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 14th parameter type invalid."); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 15th parameter type invalid."); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 16th parameter type invalid."); this->value[0] = col_type(static_cast(x1), value_type(y1), value_type(z1), value_type(w1)); this->value[1] = col_type(static_cast(x2), value_type(y2), value_type(z2), value_type(w2)); @@ -266,10 +266,10 @@ namespace detail tvec4 const & v4 ) { - GLM_STATIC_ASSERT(detail::type::is_float || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 1st parameter type invalid."); - GLM_STATIC_ASSERT(detail::type::is_float || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 2nd parameter type invalid."); - GLM_STATIC_ASSERT(detail::type::is_float || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 3rd parameter type invalid."); - GLM_STATIC_ASSERT(detail::type::is_float || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 4th parameter type invalid."); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 1st parameter type invalid."); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 2nd parameter type invalid."); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 3rd parameter type invalid."); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || std::numeric_limits::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); diff --git a/glm/gtc/quaternion.hpp b/glm/gtc/quaternion.hpp index e2ef6176..cf5690b7 100644 --- a/glm/gtc/quaternion.hpp +++ b/glm/gtc/quaternion.hpp @@ -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(); diff --git a/glm/gtc/reciprocal.inl b/glm/gtc/reciprocal.inl index 84f5cb79..ec8f6335 100644 --- a/glm/gtc/reciprocal.inl +++ b/glm/gtc/reciprocal.inl @@ -35,7 +35,7 @@ namespace glm genType const & angle ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'sec' only accept floating-point values"); + GLM_STATIC_ASSERT(std::numeric_limits::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::is_float, "'csc' only accept floating-point values"); + GLM_STATIC_ASSERT(std::numeric_limits::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::is_float, "'cot' only accept floating-point values"); + GLM_STATIC_ASSERT(std::numeric_limits::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::is_float, "'asec' only accept floating-point values"); + GLM_STATIC_ASSERT(std::numeric_limits::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::is_float, "'acsc' only accept floating-point values"); + GLM_STATIC_ASSERT(std::numeric_limits::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::is_float, "'acot' only accept floating-point values"); + GLM_STATIC_ASSERT(std::numeric_limits::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::is_float, "'sech' only accept floating-point values"); + GLM_STATIC_ASSERT(std::numeric_limits::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::is_float, "'csch' only accept floating-point values"); + GLM_STATIC_ASSERT(std::numeric_limits::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::is_float, "'coth' only accept floating-point values"); + GLM_STATIC_ASSERT(std::numeric_limits::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::is_float, "'asech' only accept floating-point values"); + GLM_STATIC_ASSERT(std::numeric_limits::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::is_float, "'acsch' only accept floating-point values"); + GLM_STATIC_ASSERT(std::numeric_limits::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::is_float, "'acoth' only accept floating-point values"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'acoth' only accept floating-point values"); return atanh(genType(1) / x); } diff --git a/glm/gtx/fast_square_root.inl b/glm/gtx/fast_square_root.inl index f514dd57..496abe21 100644 --- a/glm/gtx/fast_square_root.inl +++ b/glm/gtx/fast_square_root.inl @@ -16,7 +16,7 @@ namespace glm genType const & x ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'fastSqrt' only accept floating-point input"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'fastSqrt' only accept floating-point input"); return genType(1) / fastInverseSqrt(x); } diff --git a/glm/gtx/integer.inl b/glm/gtx/integer.inl index 40d6541e..405b9ee3 100644 --- a/glm/gtx/integer.inl +++ b/glm/gtx/integer.inl @@ -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 + struct compute_log2 { template 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/ diff --git a/glm/gtx/vector_angle.inl b/glm/gtx/vector_angle.inl index a3f4ead0..39e04f22 100644 --- a/glm/gtx/vector_angle.inl +++ b/glm/gtx/vector_angle.inl @@ -9,14 +9,14 @@ namespace glm { - template - GLM_FUNC_QUALIFIER T angle + template + GLM_FUNC_QUALIFIER genType angle ( - T const & x, - T const & y + genType const & x, + genType const & y ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'angle' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'angle' only accept floating-point inputs"); #ifdef GLM_FORCE_RADIANS return acos(dot(x, y)); @@ -32,7 +32,7 @@ namespace glm vecType const & y ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'angle' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::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 const & y ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'orientedAngle' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::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 const & ref ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'orientedAngle' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'orientedAngle' only accept floating-point inputs"); #ifdef GLM_FORCE_RADIANS T const Angle(acos(dot(x, y)));