diff --git a/glm/core/_swizzle.hpp b/glm/core/_swizzle.hpp index 5da02a89..8cd16cf0 100644 --- a/glm/core/_swizzle.hpp +++ b/glm/core/_swizzle.hpp @@ -29,25 +29,6 @@ #ifndef glm_core_swizzle #define glm_core_swizzle -namespace glm -{ - enum comp - { - X = 0, - R = 0, - S = 0, - Y = 1, - G = 1, - T = 1, - Z = 2, - B = 2, - P = 2, - W = 3, - A = 3, - Q = 3 - }; -}//namespace glm - namespace glm{ namespace detail { diff --git a/glm/core/dummy.cpp b/glm/core/dummy.cpp index 7116729a..7a32239b 100644 --- a/glm/core/dummy.cpp +++ b/glm/core/dummy.cpp @@ -31,6 +31,7 @@ #define GLM_MESSAGES #include "../glm.hpp" +#include /* #if(GLM_ARCH & GLM_ARCH_SSE2) struct float4 diff --git a/glm/core/func_common.inl b/glm/core/func_common.inl index fb74f983..ae37ae0b 100644 --- a/glm/core/func_common.inl +++ b/glm/core/func_common.inl @@ -26,6 +26,8 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// +#include + namespace glm{ namespace detail { @@ -39,8 +41,8 @@ namespace detail GLM_FUNC_QUALIFIER static genFIType get(genFIType const & x) { GLM_STATIC_ASSERT( - detail::type::is_float || - detail::type::is_int, "'abs' only accept floating-point and integer inputs"); + std::numeric_limits::is_iec559 || std::numeric_limits::is_signed, + "'abs' only accept floating-point and integer inputs"); return x >= genFIType(0) ? x : -x; // TODO, perf comp with: *(((int *) &x) + 1) &= 0x7fffffff; } @@ -52,7 +54,8 @@ namespace detail GLM_FUNC_QUALIFIER static genFIType get(genFIType const & x) { GLM_STATIC_ASSERT( - detail::type::is_uint, "'abs' only accept floating-point and integer inputs"); + !std::numeric_limits::is_signed && std::numeric_limits::is_integer, + "'abs' only accept floating-point and integer inputs"); return x; } }; @@ -79,7 +82,7 @@ namespace detail ) { GLM_STATIC_ASSERT( - detail::type::is_float || + std::numeric_limits::is_iec559 || detail::type::is_int, "'sign' only accept signed inputs"); genFIType result; @@ -98,7 +101,9 @@ namespace detail template GLM_FUNC_QUALIFIER genType floor(genType const & x) { - GLM_STATIC_ASSERT(detail::type::is_float, "'floor' only accept floating-point inputs"); + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'floor' only accept floating-point inputs"); return ::std::floor(x); } @@ -109,7 +114,11 @@ namespace detail template GLM_FUNC_QUALIFIER genType trunc(genType const & x) { - GLM_STATIC_ASSERT(detail::type::is_float, "'trunc' only accept floating-point inputs"); + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'trunc' only accept floating-point inputs"); + + // TODO, add C++11 std::trunk return x < 0 ? -floor(-x) : floor(x); } @@ -119,11 +128,12 @@ namespace detail template GLM_FUNC_QUALIFIER genType round(genType const& x) { - GLM_STATIC_ASSERT(detail::type::is_float, "'round' only accept floating-point inputs"); + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'round' only accept floating-point inputs"); - if(x < 0) - return genType(int(x - genType(0.5))); - return genType(int(x + genType(0.5))); + // TODO, add C++11 std::round + return x < 0 ? genType(int(x - genType(0.5))) : genType(int(x + genType(0.5))); } VECTORIZE_VEC(round) @@ -143,13 +153,15 @@ 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"); - int Integer = int(x); - genType IntegerPart = genType(Integer); + int Integer = static_cast(x); + genType IntegerPart = static_cast(Integer); genType FractionalPart = fract(x); - if(FractionalPart > genType(0.5) || FractionalPart < genType(0.5)) + if(FractionalPart > static_cast(0.5) || FractionalPart < static_cast(0.5)) { return round(x); } @@ -157,13 +169,13 @@ namespace detail { return IntegerPart; } - else if(x <= genType(0)) // Work around... + else if(x <= static_cast(0)) // Work around... { - return IntegerPart - 1; + return IntegerPart - static_cast(1); } else { - return IntegerPart + 1; + return IntegerPart + static_cast(1); } //else // Bug on MinGW 4.5.2 //{ @@ -177,7 +189,9 @@ namespace detail template GLM_FUNC_QUALIFIER genType ceil(genType const & x) { - GLM_STATIC_ASSERT(detail::type::is_float, "'ceil' only accept floating-point inputs"); + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'ceil' only accept floating-point inputs"); return ::std::ceil(x); } @@ -191,9 +205,11 @@ namespace detail genType const & x ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'fract' only accept floating-point inputs"); + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'fract' only accept floating-point inputs"); - return x - ::std::floor(x); + return x - floor(x); } VECTORIZE_VEC(fract) @@ -206,7 +222,9 @@ namespace detail genType const & y ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'mod' only accept floating-point inputs"); + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'mod' only accept floating-point inputs"); return x - y * floor(x / y); } @@ -222,7 +240,9 @@ namespace detail genType & i ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'modf' only accept floating-point inputs"); + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'modf' only accept floating-point inputs"); return std::modf(x, &i); } @@ -283,9 +303,8 @@ namespace detail ) { GLM_STATIC_ASSERT( - detail::type::is_float || - detail::type::is_int || - detail::type::is_uint, "'min' only accept numbers"); + std::numeric_limits::is_iec559 || std::numeric_limits::is_integer, + "'min' only accept floating-point or integer inputs"); return x < y ? x : y; } @@ -302,9 +321,8 @@ namespace detail ) { GLM_STATIC_ASSERT( - detail::type::is_float || - detail::type::is_int || - detail::type::is_uint, "'max' only accept numbers"); + std::numeric_limits::is_iec559 || detail::type::is_int || detail::type::is_uint, + "'max' only accept floating-point or integer inputs"); return x > y ? x : y; } @@ -313,18 +331,17 @@ namespace detail VECTORIZE_VEC_VEC(max) // clamp - template - GLM_FUNC_QUALIFIER valType clamp + template + GLM_FUNC_QUALIFIER genType clamp ( - valType const & x, - valType const & minVal, - valType const & maxVal + genType const & x, + genType const & minVal, + genType const & maxVal ) { GLM_STATIC_ASSERT( - detail::type::is_float || - detail::type::is_int || - detail::type::is_uint, "'clamp' only accept numbers"); + std::numeric_limits::is_iec559 || detail::type::is_int || detail::type::is_uint, + "'clamp' only accept floating-point or integer inputs"); return min(maxVal, max(minVal, x)); } @@ -337,6 +354,10 @@ namespace detail T const & maxVal ) { + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559 || detail::type::is_int || detail::type::is_uint, + "'clamp' only accept floating-point or integer inputs"); + return detail::tvec2( clamp(x.x, minVal, maxVal), clamp(x.y, minVal, maxVal)); @@ -350,6 +371,10 @@ namespace detail T const & maxVal ) { + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559 || detail::type::is_int || detail::type::is_uint, + "'clamp' only accept floating-point or integer inputs"); + return detail::tvec3( clamp(x.x, minVal, maxVal), clamp(x.y, minVal, maxVal), @@ -364,6 +389,10 @@ namespace detail T const & maxVal ) { + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559 || detail::type::is_int || detail::type::is_uint, + "'clamp' only accept floating-point or integer inputs"); + return detail::tvec4( clamp(x.x, minVal, maxVal), clamp(x.y, minVal, maxVal), @@ -379,6 +408,10 @@ namespace detail detail::tvec2 const & maxVal ) { + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559 || detail::type::is_int || detail::type::is_uint, + "'clamp' only accept floating-point or integer inputs"); + return detail::tvec2( clamp(x.x, minVal.x, maxVal.x), clamp(x.y, minVal.y, maxVal.y)); @@ -392,6 +425,10 @@ namespace detail detail::tvec3 const & maxVal ) { + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559 || detail::type::is_int || detail::type::is_uint, + "'clamp' only accept floating-point or integer inputs"); + return detail::tvec3( clamp(x.x, minVal.x, maxVal.x), clamp(x.y, minVal.y, maxVal.y), @@ -406,6 +443,10 @@ namespace detail detail::tvec4 const & maxVal ) { + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559 || detail::type::is_int || detail::type::is_uint, + "'clamp' only accept floating-point or integer inputs"); + return detail::tvec4( clamp(x.x, minVal.x, maxVal.x), clamp(x.y, minVal.y, maxVal.y), @@ -422,7 +463,9 @@ namespace detail genType const & a ) { - GLM_STATIC_ASSERT(detail::type::is_float , "'genType' is not floating-point type"); + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'mix' only accept floating-point inputs"); return x + a * (y - x); } @@ -435,7 +478,9 @@ namespace detail T const & a ) { - GLM_STATIC_ASSERT(detail::type::is_float , "'genType' is not floating-point type"); + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'mix' only accept floating-point inputs"); return x + a * (y - x); } @@ -448,6 +493,10 @@ namespace detail T const & a ) { + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'mix' only accept floating-point inputs"); + return x + a * (y - x); } @@ -459,6 +508,10 @@ namespace detail T const & a ) { + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'mix' only accept floating-point inputs"); + return x + a * (y - x); } @@ -470,6 +523,10 @@ namespace detail detail::tvec2 const & a ) { + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'mix' only accept floating-point inputs"); + return x + a * (y - x); } @@ -481,7 +538,9 @@ namespace detail detail::tvec3 const & a ) { - GLM_STATIC_ASSERT(detail::type::is_float , "'genType' is not floating-point type"); + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'mix' only accept floating-point inputs"); return x + a * (y - x); } @@ -494,6 +553,10 @@ namespace detail detail::tvec4 const & a ) { + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'mix' only accept floating-point inputs"); + return x + a * (y - x); } @@ -543,7 +606,9 @@ namespace detail bool a ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'mix' only accept floating-point inputs"); + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'mix' only accept floating-point inputs"); return a ? y : x; } @@ -556,7 +621,9 @@ namespace detail bool a ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'mix' only accept floating-point inputs"); + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'mix' only accept floating-point inputs"); return a ? y : x; } @@ -569,7 +636,9 @@ namespace detail bool a ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'mix' only accept floating-point inputs"); + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'mix' only accept floating-point inputs"); return a ? y : x; } @@ -582,7 +651,9 @@ namespace detail typename detail::tvec2::bool_type a ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'mix' only accept floating-point inputs"); + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'mix' only accept floating-point inputs"); detail::tvec2 result; for(int i = 0; i < x.length(); ++i) @@ -599,7 +670,9 @@ namespace detail typename detail::tvec3::bool_type a ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'mix' only accept floating-point inputs"); + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'mix' only accept floating-point inputs"); detail::tvec3 result; for(int i = 0; i < x.length(); ++i) @@ -616,7 +689,9 @@ namespace detail typename detail::tvec4::bool_type a ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'mix' only accept floating-point inputs"); + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'mix' only accept floating-point inputs"); detail::tvec4 result; for(int i = 0; i < x.length(); ++i) @@ -633,9 +708,11 @@ namespace detail genType const & x ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'step' only accept floating-point inputs"); + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'step' only accept floating-point inputs"); - return x < edge ? genType(0) : genType(1); + return x < edge ? static_cast(0) : static_cast(1); } template @@ -645,6 +722,10 @@ namespace detail detail::tvec2 const & x ) { + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'step' only accept floating-point inputs"); + return detail::tvec2( x.x < edge ? T(0) : T(1), x.y < edge ? T(0) : T(1)); @@ -657,6 +738,10 @@ namespace detail detail::tvec3 const & x ) { + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'step' only accept floating-point inputs"); + return detail::tvec3( x.x < edge ? T(0) : T(1), x.y < edge ? T(0) : T(1), @@ -670,6 +755,10 @@ namespace detail detail::tvec4 const & x ) { + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'step' only accept floating-point inputs"); + return detail::tvec4( x.x < edge ? T(0) : T(1), x.y < edge ? T(0) : T(1), @@ -684,6 +773,10 @@ namespace detail detail::tvec2 const & x ) { + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'step' only accept floating-point inputs"); + return detail::tvec2( x.x < edge.x ? T(0) : T(1), x.y < edge.y ? T(0) : T(1)); @@ -696,6 +789,10 @@ namespace detail detail::tvec3 const & x ) { + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'step' only accept floating-point inputs"); + return detail::tvec3( x.x < edge.x ? T(0) : T(1), x.y < edge.y ? T(0) : T(1), @@ -709,6 +806,10 @@ namespace detail detail::tvec4 const & x ) { + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'step' only accept floating-point inputs"); + return detail::tvec4( x.x < edge.x ? T(0) : T(1), x.y < edge.y ? T(0) : T(1), @@ -725,7 +826,9 @@ namespace detail genType const & x ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'smoothstep' only accept floating-point inputs"); + GLM_STATIC_ASSERT( + std::numeric_limits::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); @@ -739,6 +842,10 @@ namespace detail detail::tvec2 const & x ) { + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'smoothstep' only accept floating-point inputs"); + return detail::tvec2( smoothstep(edge0, edge1, x.x), smoothstep(edge0, edge1, x.y)); @@ -752,6 +859,10 @@ namespace detail detail::tvec3 const & x ) { + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'smoothstep' only accept floating-point inputs"); + return detail::tvec3( smoothstep(edge0, edge1, x.x), smoothstep(edge0, edge1, x.y), @@ -766,6 +877,10 @@ namespace detail detail::tvec4 const & x ) { + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'smoothstep' only accept floating-point inputs"); + return detail::tvec4( smoothstep(edge0, edge1, x.x), smoothstep(edge0, edge1, x.y), @@ -781,6 +896,10 @@ namespace detail detail::tvec2 const & x ) { + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'smoothstep' only accept floating-point inputs"); + return detail::tvec2( smoothstep(edge0.x, edge1.x, x.x), smoothstep(edge0.y, edge1.y, x.y)); @@ -794,6 +913,10 @@ namespace detail detail::tvec3 const & x ) { + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'smoothstep' only accept floating-point inputs"); + return detail::tvec3( smoothstep(edge0.x, edge1.x, x.x), smoothstep(edge0.y, edge1.y, x.y), @@ -808,6 +931,10 @@ namespace detail detail::tvec4 const & x ) { + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'smoothstep' only accept floating-point inputs"); + return detail::tvec4( smoothstep(edge0.x, edge1.x, x.x), smoothstep(edge0.y, edge1.y, x.y), @@ -819,7 +946,9 @@ namespace detail template GLM_FUNC_QUALIFIER bool isnan(genType const & x) { - GLM_STATIC_ASSERT(detail::type::is_float, "'isnan' only accept floating-point inputs"); + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'isnan' only accept floating-point inputs"); # if(GLM_COMPILER & (GLM_COMPILER_VC | GLM_COMPILER_INTEL)) return _isnan(x) != 0; @@ -842,6 +971,10 @@ namespace detail detail::tvec2 const & x ) { + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'isnan' only accept floating-point inputs"); + return typename detail::tvec2::bool_type( isnan(x.x), isnan(x.y)); @@ -853,6 +986,10 @@ namespace detail detail::tvec3 const & x ) { + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'isnan' only accept floating-point inputs"); + return typename detail::tvec3::bool_type( isnan(x.x), isnan(x.y), @@ -865,6 +1002,10 @@ namespace detail detail::tvec4 const & x ) { + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'isnan' only accept floating-point inputs"); + return typename detail::tvec4::bool_type( isnan(x.x), isnan(x.y), @@ -876,7 +1017,9 @@ namespace detail GLM_FUNC_QUALIFIER bool isinf( genType const & x) { - GLM_STATIC_ASSERT(detail::type::is_float, "'isinf' only accept floating-point inputs"); + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'isinf' only accept floating-point inputs"); # if(GLM_COMPILER & (GLM_COMPILER_INTEL | GLM_COMPILER_VC)) return _fpclass(x) == _FPCLASS_NINF || _fpclass(x) == _FPCLASS_PINF; @@ -900,6 +1043,10 @@ namespace detail detail::tvec2 const & x ) { + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'isinf' only accept floating-point inputs"); + return typename detail::tvec2::bool_type( isinf(x.x), isinf(x.y)); @@ -911,6 +1058,10 @@ namespace detail detail::tvec3 const & x ) { + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'isinf' only accept floating-point inputs"); + return typename detail::tvec3::bool_type( isinf(x.x), isinf(x.y), @@ -923,6 +1074,10 @@ namespace detail detail::tvec4 const & x ) { + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'isinf' only accept floating-point inputs"); + return typename detail::tvec4::bool_type( isinf(x.x), isinf(x.y), @@ -930,157 +1085,120 @@ namespace detail isinf(x.w)); } - GLM_FUNC_QUALIFIER int floatBitsToInt(float const & value) + GLM_FUNC_QUALIFIER int floatBitsToInt(float const & v) { - return *reinterpret_cast(const_cast(&value)); + return *reinterpret_cast(const_cast(&v)); } GLM_FUNC_QUALIFIER detail::tvec2 floatBitsToInt ( - detail::tvec2 const & value + detail::tvec2 const & v ) { - return detail::tvec2( - floatBitsToInt(value.x), - floatBitsToInt(value.y)); + return *reinterpret_cast*>(const_cast*>(&v)); } GLM_FUNC_QUALIFIER detail::tvec3 floatBitsToInt ( - detail::tvec3 const & value + detail::tvec3 const & v ) { - return detail::tvec3( - floatBitsToInt(value.x), - floatBitsToInt(value.y), - floatBitsToInt(value.z)); + return *reinterpret_cast*>(const_cast*>(&v)); } GLM_FUNC_QUALIFIER detail::tvec4 floatBitsToInt ( - detail::tvec4 const & value + detail::tvec4 const & v ) { - return detail::tvec4( - floatBitsToInt(value.x), - floatBitsToInt(value.y), - floatBitsToInt(value.z), - floatBitsToInt(value.w)); + return *reinterpret_cast*>(const_cast*>(&v)); } - GLM_FUNC_QUALIFIER uint floatBitsToUint(float const & value) + GLM_FUNC_QUALIFIER uint floatBitsToUint(float const & v) { - return *reinterpret_cast(const_cast(&value)); + return *reinterpret_cast(const_cast(&v)); } GLM_FUNC_QUALIFIER detail::tvec2 floatBitsToUint ( - detail::tvec2 const & value + detail::tvec2 const & v ) { - return detail::tvec2( - floatBitsToUint(value.x), - floatBitsToUint(value.y)); + return *reinterpret_cast*>(const_cast*>(&v)); } GLM_FUNC_QUALIFIER detail::tvec3 floatBitsToUint ( - detail::tvec3 const & value + detail::tvec3 const & v ) { - return detail::tvec3( - floatBitsToUint(value.x), - floatBitsToUint(value.y), - floatBitsToUint(value.z)); + return *reinterpret_cast*>(const_cast*>(&v)); } GLM_FUNC_QUALIFIER detail::tvec4 floatBitsToUint ( - detail::tvec4 const & value + detail::tvec4 const & v ) { - return detail::tvec4( - floatBitsToUint(value.x), - floatBitsToUint(value.y), - floatBitsToUint(value.z), - floatBitsToUint(value.w)); + return *reinterpret_cast*>(const_cast*>(&v)); } - GLM_FUNC_QUALIFIER float intBitsToFloat(int const & value) + GLM_FUNC_QUALIFIER float intBitsToFloat(int const & v) { - return *reinterpret_cast(const_cast(&value)); + return *reinterpret_cast(const_cast(&v)); } GLM_FUNC_QUALIFIER detail::tvec2 intBitsToFloat - ( - detail::tvec2 const & value + detail::tvec2 const & v ) { - return detail::tvec2( - intBitsToFloat(value.x), - intBitsToFloat(value.y)); + return *reinterpret_cast*>(const_cast*>(&v)); } GLM_FUNC_QUALIFIER detail::tvec3 intBitsToFloat ( - detail::tvec3 const & value + detail::tvec3 const & v ) { - return detail::tvec3( - intBitsToFloat(value.x), - intBitsToFloat(value.y), - intBitsToFloat(value.z)); + return *reinterpret_cast*>(const_cast*>(&v)); } GLM_FUNC_QUALIFIER detail::tvec4 intBitsToFloat ( - detail::tvec4 const & value + detail::tvec4 const & v ) { - return detail::tvec4( - intBitsToFloat(value.x), - intBitsToFloat(value.y), - intBitsToFloat(value.z), - intBitsToFloat(value.w)); + return *reinterpret_cast*>(const_cast*>(&v)); } - GLM_FUNC_QUALIFIER float uintBitsToFloat(uint const & value) + GLM_FUNC_QUALIFIER float uintBitsToFloat(uint const & v) { - return *reinterpret_cast(const_cast(&value)); + return *reinterpret_cast(const_cast(&v)); } GLM_FUNC_QUALIFIER detail::tvec2 uintBitsToFloat ( - detail::tvec2 const & value + detail::tvec2 const & v ) { - return detail::tvec2( - uintBitsToFloat(value.x), - uintBitsToFloat(value.y)); + return *reinterpret_cast*>(const_cast*>(&v)); } GLM_FUNC_QUALIFIER detail::tvec3 uintBitsToFloat ( - detail::tvec3 const & value + detail::tvec3 const & v ) { - return detail::tvec3( - uintBitsToFloat(value.x), - uintBitsToFloat(value.y), - uintBitsToFloat(value.z)); + return *reinterpret_cast*>(const_cast*>(&v)); } GLM_FUNC_QUALIFIER detail::tvec4 uintBitsToFloat ( - detail::tvec4 const & value + detail::tvec4 const & v ) { - return detail::tvec4( - uintBitsToFloat(value.x), - uintBitsToFloat(value.y), - uintBitsToFloat(value.z), - uintBitsToFloat(value.w)); + return *reinterpret_cast*>(const_cast*>(&v)); } template @@ -1101,6 +1219,10 @@ namespace detail int & exp ) { + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'frexp' only accept floating-point inputs"); + return std::frexp(x, exp); } @@ -1111,6 +1233,10 @@ namespace detail detail::tvec2 & exp ) { + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'frexp' only accept floating-point inputs"); + return std::frexp(x, exp); } @@ -1121,6 +1247,10 @@ namespace detail detail::tvec3 & exp ) { + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'frexp' only accept floating-point inputs"); + return std::frexp(x, exp); } @@ -1131,6 +1261,10 @@ namespace detail detail::tvec4 & exp ) { + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'frexp' only accept floating-point inputs"); + return std::frexp(x, exp); } @@ -1141,7 +1275,11 @@ namespace detail int const & exp ) { - return std::frexp(x, exp); + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'frexp' only accept floating-point inputs"); + + return std::ldexp(x, exp); } template @@ -1151,7 +1289,11 @@ namespace detail detail::tvec2 const & exp ) { - return std::frexp(x, exp); + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'ldexp' only accept floating-point inputs"); + + return std::ldexp(x, exp); } template @@ -1161,7 +1303,11 @@ namespace detail detail::tvec3 const & exp ) { - return std::frexp(x, exp); + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'ldexp' only accept floating-point inputs"); + + return std::ldexp(x, exp); } template @@ -1171,7 +1317,11 @@ namespace detail detail::tvec4 const & exp ) { - return std::frexp(x, exp); + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'ldexp' only accept floating-point inputs"); + + return std::ldexp(x, exp); } }//namespace glm diff --git a/glm/core/func_exponential.hpp b/glm/core/func_exponential.hpp index e85200df..b466f682 100644 --- a/glm/core/func_exponential.hpp +++ b/glm/core/func_exponential.hpp @@ -36,6 +36,11 @@ #ifndef glm_core_func_exponential #define glm_core_func_exponential GLM_VERSION +#include "type_vec1.hpp" +#include "type_vec2.hpp" +#include "type_vec3.hpp" +#include "type_vec4.hpp" + namespace glm { /// @addtogroup core_func_exponential diff --git a/glm/core/func_exponential.inl b/glm/core/func_exponential.inl index bb54b78b..c58a23f1 100644 --- a/glm/core/func_exponential.inl +++ b/glm/core/func_exponential.inl @@ -26,6 +26,11 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// +#include "func_vector_relational.hpp" +#include "_vectorize.hpp" +#include +#include + namespace glm { // pow @@ -36,9 +41,11 @@ namespace glm genType const & y ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'pow' only accept floating-point input"); + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'pow' only accept floating-point inputs"); - return genType(::std::pow(x, y)); + return std::pow(x, y); } VECTORIZE_VEC_VEC(pow) @@ -50,9 +57,11 @@ namespace glm genType const & x ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'exp' only accept floating-point input"); + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'exp' only accept floating-point inputs"); - return genType(::std::exp(x)); + return std::exp(x); } VECTORIZE_VEC(exp) @@ -64,9 +73,11 @@ namespace glm genType const & x ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'log' only accept floating-point input"); + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'log' only accept floating-point inputs"); - return genType(::std::log(x)); + return std::log(x); } VECTORIZE_VEC(log) @@ -78,9 +89,11 @@ namespace glm genType const & x ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'exp2' only accept floating-point input"); + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'exp2' only accept floating-point inputs"); - return genType(::std::exp(genType(0.69314718055994530941723212145818) * x)); + return std::exp(genType(0.69314718055994530941723212145818) * x); } VECTORIZE_VEC(exp2) @@ -132,9 +145,11 @@ namespace _detail genType const & x ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'sqrt' only accept floating-point input"); + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'sqrt' only accept floating-point inputs"); - return genType(::std::sqrt(x)); + return std::sqrt(x); } VECTORIZE_VEC(sqrt) @@ -145,10 +160,13 @@ namespace _detail genType const & x ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'inversesqrt' only accept floating-point input"); + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559, + "'inversesqrt' only accept floating-point inputs"); + assert(x > genType(0)); - return genType(1) / ::std::sqrt(x); + return genType(1) / std::sqrt(x); } VECTORIZE_VEC(inversesqrt) @@ -171,24 +189,32 @@ namespace _detail template <> GLM_FUNC_QUALIFIER lowp_vec1 inversesqrt(lowp_vec1 const & v) { + assert(glm::all(glm::greaterThan(v, lowp_vec1(0)))); + return detail::fastInversesqrt(v); } template <> GLM_FUNC_QUALIFIER lowp_vec2 inversesqrt(lowp_vec2 const & v) { + assert(glm::all(glm::greaterThan(v, lowp_vec2(0)))); + return detail::fastInversesqrt(v); } template <> GLM_FUNC_QUALIFIER lowp_vec3 inversesqrt(lowp_vec3 const & v) { + assert(glm::all(glm::greaterThan(v, lowp_vec3(0)))); + return detail::fastInversesqrt(v); } template <> GLM_FUNC_QUALIFIER lowp_vec4 inversesqrt(lowp_vec4 const & v) { + assert(glm::all(glm::greaterThan(v, lowp_vec4(0)))); + return detail::fastInversesqrt(v); } diff --git a/glm/core/func_geometric.inl b/glm/core/func_geometric.inl index b0d50d9e..75d1da7b 100644 --- a/glm/core/func_geometric.inl +++ b/glm/core/func_geometric.inl @@ -26,6 +26,8 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// +#include "type_float.hpp" + namespace glm { // length @@ -137,7 +139,7 @@ namespace glm detail::tvec2 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; } diff --git a/glm/core/func_matrix.hpp b/glm/core/func_matrix.hpp index 6983d0ad..d3939c5e 100644 --- a/glm/core/func_matrix.hpp +++ b/glm/core/func_matrix.hpp @@ -40,6 +40,16 @@ #ifndef GLM_CORE_func_matrix #define GLM_CORE_func_matrix GLM_VERSION +#include "type_mat2x2.hpp" +#include "type_mat2x3.hpp" +#include "type_mat2x4.hpp" +#include "type_mat3x2.hpp" +#include "type_mat3x3.hpp" +#include "type_mat3x4.hpp" +#include "type_mat4x2.hpp" +#include "type_mat4x3.hpp" +#include "type_mat4x4.hpp" + namespace glm { /// @addtogroup core_func_matrix diff --git a/glm/core/func_matrix.inl b/glm/core/func_matrix.inl index bcbcecc8..5f8a854f 100644 --- a/glm/core/func_matrix.inl +++ b/glm/core/func_matrix.inl @@ -26,6 +26,8 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// +#include "func_geometric.hpp" + namespace glm { // matrixCompMult @@ -573,7 +575,7 @@ namespace glm detail::tvec4 Row0(Inverse[0][0], Inverse[1][0], Inverse[2][0], Inverse[3][0]); - T Determinant = glm::dot(m[0], Row0); + T Determinant = dot(m[0], Row0); Inverse /= Determinant; diff --git a/glm/core/func_packing.inl b/glm/core/func_packing.inl index 4193f5f3..918abe60 100644 --- a/glm/core/func_packing.inl +++ b/glm/core/func_packing.inl @@ -26,6 +26,8 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// +#include "type_half.hpp" + namespace glm { GLM_FUNC_QUALIFIER uint32 packUnorm2x16(vec2 const & v) diff --git a/glm/core/func_trigonometric.inl b/glm/core/func_trigonometric.inl index 0a545286..c5d7b4fc 100644 --- a/glm/core/func_trigonometric.inl +++ b/glm/core/func_trigonometric.inl @@ -26,6 +26,8 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// +#include "./core/_vectorize.hpp" + namespace glm { // radians diff --git a/glm/core/func_vector_relational.hpp b/glm/core/func_vector_relational.hpp index 609bc601..c2f17806 100644 --- a/glm/core/func_vector_relational.hpp +++ b/glm/core/func_vector_relational.hpp @@ -41,6 +41,9 @@ #ifndef GLM_CORE_func_vector_relational #define GLM_CORE_func_vector_relational GLM_VERSION +#include "precision.hpp" +#include "setup.hpp" + #if !((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER <= GLM_COMPILER_VC10)) // Workaround a Visual C++ bug namespace glm diff --git a/glm/core/type_float.hpp b/glm/core/type_float.hpp index c5b0532b..023e2b71 100644 --- a/glm/core/type_float.hpp +++ b/glm/core/type_float.hpp @@ -81,6 +81,13 @@ namespace detail typedef float float32; typedef double float64; +//////////////////// +// check type sizes +#ifndef GLM_STATIC_ASSERT_NULL + GLM_STATIC_ASSERT(sizeof(glm::float32) == 4, "float32 size isn't 4 bytes on this platform"); + GLM_STATIC_ASSERT(sizeof(glm::float64) == 8, "float64 size isn't 8 bytes on this platform"); +#endif//GLM_STATIC_ASSERT_NULL + /// @} namespace detail diff --git a/glm/core/type_mat2x2.hpp b/glm/core/type_mat2x2.hpp index ac6ea704..2c7766b8 100644 --- a/glm/core/type_mat2x2.hpp +++ b/glm/core/type_mat2x2.hpp @@ -30,7 +30,9 @@ #define glm_core_type_mat2x2 #include "../fwd.hpp" +#include "type_vec2.hpp" #include "type_mat.hpp" +#include namespace glm{ namespace detail diff --git a/glm/core/type_mat2x3.hpp b/glm/core/type_mat2x3.hpp index 1198bbbc..b0a7f0b3 100644 --- a/glm/core/type_mat2x3.hpp +++ b/glm/core/type_mat2x3.hpp @@ -30,7 +30,10 @@ #define glm_core_type_mat2x3 #include "../fwd.hpp" +#include "type_vec2.hpp" +#include "type_vec3.hpp" #include "type_mat.hpp" +#include namespace glm{ namespace detail diff --git a/glm/core/type_mat2x4.hpp b/glm/core/type_mat2x4.hpp index be830776..7f76d4ec 100644 --- a/glm/core/type_mat2x4.hpp +++ b/glm/core/type_mat2x4.hpp @@ -30,7 +30,10 @@ #define glm_core_type_mat2x4 #include "../fwd.hpp" +#include "type_vec2.hpp" +#include "type_vec4.hpp" #include "type_mat.hpp" +#include namespace glm{ namespace detail diff --git a/glm/core/type_mat3x2.hpp b/glm/core/type_mat3x2.hpp index 6e305299..be78b035 100644 --- a/glm/core/type_mat3x2.hpp +++ b/glm/core/type_mat3x2.hpp @@ -30,7 +30,10 @@ #define glm_core_type_mat3x2 #include "../fwd.hpp" +#include "type_vec2.hpp" +#include "type_vec3.hpp" #include "type_mat.hpp" +#include namespace glm{ namespace detail diff --git a/glm/core/type_mat3x3.hpp b/glm/core/type_mat3x3.hpp index 26f44aec..7af73089 100644 --- a/glm/core/type_mat3x3.hpp +++ b/glm/core/type_mat3x3.hpp @@ -30,7 +30,9 @@ #define glm_core_type_mat3x3 #include "../fwd.hpp" +#include "type_vec3.hpp" #include "type_mat.hpp" +#include namespace glm{ namespace detail diff --git a/glm/core/type_mat3x4.hpp b/glm/core/type_mat3x4.hpp index eab4cd44..e71b635a 100644 --- a/glm/core/type_mat3x4.hpp +++ b/glm/core/type_mat3x4.hpp @@ -30,7 +30,10 @@ #define glm_core_type_mat3x4 #include "../fwd.hpp" +#include "type_vec3.hpp" +#include "type_vec4.hpp" #include "type_mat.hpp" +#include namespace glm{ namespace detail diff --git a/glm/core/type_mat4x2.hpp b/glm/core/type_mat4x2.hpp index 62e30517..efa6034e 100644 --- a/glm/core/type_mat4x2.hpp +++ b/glm/core/type_mat4x2.hpp @@ -30,7 +30,10 @@ #define glm_core_type_mat4x2 #include "../fwd.hpp" +#include "type_vec2.hpp" +#include "type_vec4.hpp" #include "type_mat.hpp" +#include namespace glm{ namespace detail diff --git a/glm/core/type_mat4x3.hpp b/glm/core/type_mat4x3.hpp index 0b83a596..495121a0 100644 --- a/glm/core/type_mat4x3.hpp +++ b/glm/core/type_mat4x3.hpp @@ -30,7 +30,10 @@ #define glm_core_type_mat4x3 #include "../fwd.hpp" +#include "type_vec3.hpp" +#include "type_vec4.hpp" #include "type_mat.hpp" +#include namespace glm{ namespace detail diff --git a/glm/core/type_mat4x4.hpp b/glm/core/type_mat4x4.hpp index 809ee5de..c4335764 100644 --- a/glm/core/type_mat4x4.hpp +++ b/glm/core/type_mat4x4.hpp @@ -30,7 +30,9 @@ #define glm_core_type_mat4x4 #include "../fwd.hpp" +#include "type_vec4.hpp" #include "type_mat.hpp" +#include namespace glm{ namespace detail diff --git a/glm/core/type_vec.hpp b/glm/core/type_vec.hpp index 37cc980b..a36055b9 100644 --- a/glm/core/type_vec.hpp +++ b/glm/core/type_vec.hpp @@ -30,6 +30,7 @@ #define glm_core_type_vec #include "precision.hpp" +#include "type_int.hpp" namespace glm{ namespace detail diff --git a/glm/core/type_vec2.hpp b/glm/core/type_vec2.hpp index fa377698..df45ac72 100644 --- a/glm/core/type_vec2.hpp +++ b/glm/core/type_vec2.hpp @@ -29,7 +29,7 @@ #ifndef glm_core_type_gentype2 #define glm_core_type_gentype2 -#include "../fwd.hpp" +//#include "../fwd.hpp" #include "type_vec.hpp" #ifdef GLM_SWIZZLE # if GLM_HAS_ANONYMOUS_UNION @@ -38,6 +38,7 @@ # include "_swizzle_func.hpp" # endif #endif //GLM_SWIZZLE +#include namespace glm{ namespace detail diff --git a/glm/core/type_vec3.hpp b/glm/core/type_vec3.hpp index 424ffdce..032662f6 100644 --- a/glm/core/type_vec3.hpp +++ b/glm/core/type_vec3.hpp @@ -29,7 +29,7 @@ #ifndef glm_core_type_gentype3 #define glm_core_type_gentype3 -#include "../fwd.hpp" +//#include "../fwd.hpp" #include "type_vec.hpp" #ifdef GLM_SWIZZLE # if GLM_HAS_ANONYMOUS_UNION @@ -38,6 +38,7 @@ # include "_swizzle_func.hpp" # endif #endif //GLM_SWIZZLE +#include namespace glm{ namespace detail diff --git a/glm/core/type_vec4.hpp b/glm/core/type_vec4.hpp index a1438d02..61726819 100644 --- a/glm/core/type_vec4.hpp +++ b/glm/core/type_vec4.hpp @@ -29,7 +29,8 @@ #ifndef glm_core_type_gentype4 #define glm_core_type_gentype4 -#include "../fwd.hpp" +//#include "../fwd.hpp" +#include "setup.hpp" #include "type_vec.hpp" #ifdef GLM_SWIZZLE # if GLM_HAS_ANONYMOUS_UNION @@ -38,6 +39,7 @@ # include "_swizzle_func.hpp" # endif #endif //GLM_SWIZZLE +#include namespace glm{ namespace detail diff --git a/glm/fwd.hpp b/glm/fwd.hpp index 72247341..326de73e 100644 --- a/glm/fwd.hpp +++ b/glm/fwd.hpp @@ -39,11 +39,6 @@ namespace glm{ namespace detail { - template struct tref1; - template struct tref2; - template struct tref3; - template struct tref4; - template struct tquat; }//namespace detail diff --git a/glm/glm.hpp b/glm/glm.hpp index 0056e3a6..b555b49b 100644 --- a/glm/glm.hpp +++ b/glm/glm.hpp @@ -85,19 +85,13 @@ #include #include #include -//#include -//#include - #include "fwd.hpp" -#include "core/setup.hpp" #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_CORE_INCLUDED_DISPLAYED)) # define GLM_MESSAGE_CORE_INCLUDED_DISPLAYED # pragma message("GLM: Core library included") #endif//GLM_MESSAGE - -#include "./core/_vectorize.hpp" - +/* #include "./core/type_half.hpp" #include "./core/type_float.hpp" #include "./core/type_int.hpp" @@ -118,7 +112,7 @@ #include "./core/type_mat4x2.hpp" #include "./core/type_mat4x3.hpp" #include "./core/type_mat4x4.hpp" - +*/ #include "./core/func_trigonometric.hpp" #include "./core/func_exponential.hpp" #include "./core/func_common.hpp" @@ -129,13 +123,4 @@ #include "./core/func_integer.hpp" #include "./core/func_noise.hpp" -#include "./core/_swizzle.hpp" - -//////////////////// -// check type sizes -#ifndef GLM_STATIC_ASSERT_NULL - GLM_STATIC_ASSERT(sizeof(glm::float32) == 4, "float32 size isn't 4 bytes on this platform"); - GLM_STATIC_ASSERT(sizeof(glm::float64) == 8, "float64 size isn't 8 bytes on this platform"); -#endif//GLM_STATIC_ASSERT_NULL - #endif//glm_glm diff --git a/glm/gtc/quaternion.inl b/glm/gtc/quaternion.inl index ed05ff03..cce0333c 100644 --- a/glm/gtc/quaternion.inl +++ b/glm/gtc/quaternion.inl @@ -32,7 +32,7 @@ namespace glm{ namespace detail { template - GLM_FUNC_QUALIFIER int tquat::length() const + GLM_FUNC_QUALIFIER GLM_CONSTEXPR int tquat::length() const { return 4; } diff --git a/glm/gtx/simd_vec4.hpp b/glm/gtx/simd_vec4.hpp index 04c67c4c..47f6b65b 100644 --- a/glm/gtx/simd_vec4.hpp +++ b/glm/gtx/simd_vec4.hpp @@ -58,10 +58,29 @@ // Warning silencer for nameless struct/union. #if (GLM_COMPILER & GLM_COMPILER_VC) -# pragma warning(push) -# pragma warning(disable:4201) // warning C4201: nonstandard extension used : nameless struct/union +# pragma warning(push) +# pragma warning(disable:4201) // warning C4201: nonstandard extension used : nameless struct/union #endif +namespace glm +{ + enum comp + { + X = 0, + R = 0, + S = 0, + Y = 1, + G = 1, + T = 1, + Z = 2, + B = 2, + P = 2, + W = 3, + A = 3, + Q = 3 + }; + +}//namespace glm namespace glm{ namespace detail diff --git a/readme.txt b/readme.txt index a295ef0d..dd017276 100644 --- a/readme.txt +++ b/readme.txt @@ -59,6 +59,11 @@ GLM 0.9.5.0: 2013-XX-XX - Optimized packing and unpacking functions - Removed the normalization of the up argument of lookAt function (#114) - Added low precision specializations of inversesqrt +- Fixed ldexp implementation +- Increased assert coverage +- Increased static_assert coverage +- Replaced GLM traits by STL traits when possible +- Allowed including individual core feature ================================================================================ GLM 0.9.4.6: 2013-09-15 diff --git a/test/core/core_func_matrix.cpp b/test/core/core_func_matrix.cpp index 8cb33dd4..e2aa6b4e 100644 --- a/test/core/core_func_matrix.cpp +++ b/test/core/core_func_matrix.cpp @@ -7,66 +7,66 @@ // File : test/core/func_matrix.cpp /////////////////////////////////////////////////////////////////////////////////////////////////// -#include +#include int test_matrixCompMult() { - int Error(0); - - { - glm::mat2 m(0, 1, 2, 3); - glm::mat2 n = glm::matrixCompMult(m, m); - Error += n == glm::mat2(0, 1, 4, 9) ? 0 : 1; - } + int Error(0); + + { + glm::mat2 m(0, 1, 2, 3); + glm::mat2 n = glm::matrixCompMult(m, m); + Error += n == glm::mat2(0, 1, 4, 9) ? 0 : 1; + } + + { + glm::mat2x3 m(0, 1, 2, 3, 4, 5); + glm::mat2x3 n = glm::matrixCompMult(m, m); + Error += n == glm::mat2x3(0, 1, 4, 9, 16, 25) ? 0 : 1; + } + + { + glm::mat2x4 m(0, 1, 2, 3, 4, 5, 6, 7); + glm::mat2x4 n = glm::matrixCompMult(m, m); + Error += n == glm::mat2x4(0, 1, 4, 9, 16, 25, 36, 49) ? 0 : 1; + } + + { + glm::mat3 m(0, 1, 2, 3, 4, 5, 6, 7, 8); + glm::mat3 n = glm::matrixCompMult(m, m); + Error += n == glm::mat3(0, 1, 4, 9, 16, 25, 36, 49, 64) ? 0 : 1; + } + + { + glm::mat3x2 m(0, 1, 2, 3, 4, 5); + glm::mat3x2 n = glm::matrixCompMult(m, m); + Error += n == glm::mat3x2(0, 1, 4, 9, 16, 25) ? 0 : 1; + } + + { + glm::mat3x4 m(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11); + glm::mat3x4 n = glm::matrixCompMult(m, m); + Error += n == glm::mat3x4(0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121) ? 0 : 1; + } + + { + glm::mat4 m(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); + glm::mat4 n = glm::matrixCompMult(m, m); + Error += n == glm::mat4(0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225) ? 0 : 1; + } + + { + glm::mat4x2 m(0, 1, 2, 3, 4, 5, 6, 7); + glm::mat4x2 n = glm::matrixCompMult(m, m); + Error += n == glm::mat4x2(0, 1, 4, 9, 16, 25, 36, 49) ? 0 : 1; + } + + { + glm::mat4x3 m(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11); + glm::mat4x3 n = glm::matrixCompMult(m, m); + Error += n == glm::mat4x3(0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121) ? 0 : 1; + } - { - glm::mat2x3 m(0, 1, 2, 3, 4, 5); - glm::mat2x3 n = glm::matrixCompMult(m, m); - Error += n == glm::mat2x3(0, 1, 4, 9, 16, 25) ? 0 : 1; - } - - { - glm::mat2x4 m(0, 1, 2, 3, 4, 5, 6, 7); - glm::mat2x4 n = glm::matrixCompMult(m, m); - Error += n == glm::mat2x4(0, 1, 4, 9, 16, 25, 36, 49) ? 0 : 1; - } - - { - glm::mat3 m(0, 1, 2, 3, 4, 5, 6, 7, 8); - glm::mat3 n = glm::matrixCompMult(m, m); - Error += n == glm::mat3(0, 1, 4, 9, 16, 25, 36, 49, 64) ? 0 : 1; - } - - { - glm::mat3x2 m(0, 1, 2, 3, 4, 5); - glm::mat3x2 n = glm::matrixCompMult(m, m); - Error += n == glm::mat3x2(0, 1, 4, 9, 16, 25) ? 0 : 1; - } - - { - glm::mat3x4 m(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11); - glm::mat3x4 n = glm::matrixCompMult(m, m); - Error += n == glm::mat3x4(0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121) ? 0 : 1; - } - - { - glm::mat4 m(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); - glm::mat4 n = glm::matrixCompMult(m, m); - Error += n == glm::mat4(0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225) ? 0 : 1; - } - - { - glm::mat4x2 m(0, 1, 2, 3, 4, 5, 6, 7); - glm::mat4x2 n = glm::matrixCompMult(m, m); - Error += n == glm::mat4x2(0, 1, 4, 9, 16, 25, 36, 49) ? 0 : 1; - } - - { - glm::mat4x3 m(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11); - glm::mat4x3 n = glm::matrixCompMult(m, m); - Error += n == glm::mat4x3(0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121) ? 0 : 1; - } - return Error; } diff --git a/test/core/core_type_mat2x2.cpp b/test/core/core_type_mat2x2.cpp index 7382688e..7150e233 100644 --- a/test/core/core_type_mat2x2.cpp +++ b/test/core/core_type_mat2x2.cpp @@ -7,7 +7,7 @@ // File : test/core/type_mat2x2.cpp /////////////////////////////////////////////////////////////////////////////////////////////////// -#include +#include #include int test_operators() diff --git a/test/core/core_type_mat2x3.cpp b/test/core/core_type_mat2x3.cpp index 9a06cd41..af42b76f 100644 --- a/test/core/core_type_mat2x3.cpp +++ b/test/core/core_type_mat2x3.cpp @@ -7,7 +7,7 @@ // File : test/core/type_mat2x3.cpp /////////////////////////////////////////////////////////////////////////////////////////////////// -#include +#include static int test_operators() { diff --git a/test/core/core_type_mat2x4.cpp b/test/core/core_type_mat2x4.cpp index 50cb9621..5ba3b6ed 100644 --- a/test/core/core_type_mat2x4.cpp +++ b/test/core/core_type_mat2x4.cpp @@ -7,7 +7,7 @@ // File : test/core/type_mat2x4.cpp /////////////////////////////////////////////////////////////////////////////////////////////////// -#include +#include static int test_operators() { diff --git a/test/core/core_type_mat3x2.cpp b/test/core/core_type_mat3x2.cpp index 9ff8f1b4..e1bdc20d 100644 --- a/test/core/core_type_mat3x2.cpp +++ b/test/core/core_type_mat3x2.cpp @@ -7,7 +7,7 @@ // File : test/core/type_mat3x2.cpp /////////////////////////////////////////////////////////////////////////////////////////////////// -#include +#include static bool test_operators() { diff --git a/test/core/core_type_mat3x3.cpp b/test/core/core_type_mat3x3.cpp index effecc8f..7448f796 100644 --- a/test/core/core_type_mat3x3.cpp +++ b/test/core/core_type_mat3x3.cpp @@ -7,7 +7,7 @@ // File : test/core/type_mat3x3.cpp /////////////////////////////////////////////////////////////////////////////////////////////////// -#include +#include #include #include diff --git a/test/core/core_type_mat3x4.cpp b/test/core/core_type_mat3x4.cpp index e21f8e36..140d4368 100644 --- a/test/core/core_type_mat3x4.cpp +++ b/test/core/core_type_mat3x4.cpp @@ -7,7 +7,7 @@ // File : test/core/type_mat3x4.cpp /////////////////////////////////////////////////////////////////////////////////////////////////// -#include +#include static bool test_operators() { diff --git a/test/core/core_type_mat4x2.cpp b/test/core/core_type_mat4x2.cpp index f9884824..cf2e837b 100644 --- a/test/core/core_type_mat4x2.cpp +++ b/test/core/core_type_mat4x2.cpp @@ -7,7 +7,7 @@ // File : test/core/type_mat4x2.cpp /////////////////////////////////////////////////////////////////////////////////////////////////// -#include +#include static int test_operators() { diff --git a/test/core/core_type_mat4x3.cpp b/test/core/core_type_mat4x3.cpp index 5e37b468..5a8bd09e 100644 --- a/test/core/core_type_mat4x3.cpp +++ b/test/core/core_type_mat4x3.cpp @@ -7,7 +7,7 @@ // File : test/core/type_mat4x3.cpp /////////////////////////////////////////////////////////////////////////////////////////////////// -#include +#include static int test_operators() { diff --git a/test/core/core_type_mat4x4.cpp b/test/core/core_type_mat4x4.cpp index ca3dbc8d..31a2c22d 100644 --- a/test/core/core_type_mat4x4.cpp +++ b/test/core/core_type_mat4x4.cpp @@ -7,8 +7,7 @@ // File : test/core/type_mat4x4.cpp /////////////////////////////////////////////////////////////////////////////////////////////////// -//#define GLM_PRECISION_HIGHP_FLOAT -#include +#include #include #include diff --git a/test/core/core_type_vec2.cpp b/test/core/core_type_vec2.cpp index 458ddf60..07ac3448 100644 --- a/test/core/core_type_vec2.cpp +++ b/test/core/core_type_vec2.cpp @@ -7,7 +7,8 @@ // File : test/core/type_vec2.cpp /////////////////////////////////////////////////////////////////////////////////////////////////// -#include +#include +#include int test_vec2_operators() { diff --git a/test/core/core_type_vec3.cpp b/test/core/core_type_vec3.cpp index f3a3259d..ccf537da 100644 --- a/test/core/core_type_vec3.cpp +++ b/test/core/core_type_vec3.cpp @@ -8,7 +8,11 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// #define GLM_SWIZZLE -#include +#include +#include +#include +#include +#include #include #include diff --git a/test/core/core_type_vec4.cpp b/test/core/core_type_vec4.cpp index 5c7e0ba9..1080685d 100644 --- a/test/core/core_type_vec4.cpp +++ b/test/core/core_type_vec4.cpp @@ -7,7 +7,10 @@ // File : test/core/type_vec4.cpp /////////////////////////////////////////////////////////////////////////////////////////////////// -#include +#include +#include +#include +#include #include template diff --git a/test/external/gli/core/texture2d.hpp b/test/external/gli/core/texture2d.hpp index af2983e8..b5327c29 100644 --- a/test/external/gli/core/texture2d.hpp +++ b/test/external/gli/core/texture2d.hpp @@ -14,6 +14,22 @@ namespace gli { + enum comp + { + X = 0, + R = 0, + S = 0, + Y = 1, + G = 1, + T = 1, + Z = 2, + B = 2, + P = 2, + W = 3, + A = 3, + Q = 3 + }; + //template