diff --git a/glm/detail/func_integer.inl b/glm/detail/func_integer.inl index 8adffab1d8..67177a0559 100644 --- a/glm/detail/func_integer.inl +++ b/glm/detail/func_integer.inl @@ -9,9 +9,11 @@ #if !GLM_HAS_EXTENDED_INTEGER_TYPE # if GLM_COMPILER & GLM_COMPILER_GCC +# pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wlong-long" # endif # if (GLM_COMPILER & GLM_COMPILER_CLANG) +# pragma clang diagnostic push # pragma clang diagnostic ignored "-Wc++11-long-long" # endif #endif @@ -375,6 +377,15 @@ namespace detail } }//namespace glm +#if !GLM_HAS_EXTENDED_INTEGER_TYPE +# if GLM_COMPILER & GLM_COMPILER_GCC +# pragma GCC diagnostic pop +# endif +# if (GLM_COMPILER & GLM_COMPILER_CLANG) +# pragma clang diagnostic pop +# endif +#endif + #if GLM_CONFIG_SIMD == GLM_ENABLE # include "func_integer_simd.inl" #endif diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index 19953bcb4e..efc4ed6589 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -877,10 +877,10 @@ namespace detail /////////////////////////////////////////////////////////////////////////////////// // Silent warnings -#ifdef GLM_FORCE_SILENT_WARNINGS -# define GLM_SILENT_WARNINGS GLM_ENABLE -#else +#ifdef GLM_FORCE_WARNINGS # define GLM_SILENT_WARNINGS GLM_DISABLE +#else +# define GLM_SILENT_WARNINGS GLM_ENABLE #endif /////////////////////////////////////////////////////////////////////////////////// diff --git a/glm/detail/type_quat.hpp b/glm/detail/type_quat.hpp index d489e0a233..586785a7e2 100644 --- a/glm/detail/type_quat.hpp +++ b/glm/detail/type_quat.hpp @@ -15,16 +15,6 @@ namespace glm { - template - struct qua - { - // -- Implementation detail -- - - typedef qua type; - typedef T value_type; - - // -- Data -- - # if GLM_SILENT_WARNINGS == GLM_ENABLE # if GLM_COMPILER & GLM_COMPILER_GCC # pragma GCC diagnostic push @@ -39,6 +29,16 @@ namespace glm # endif # endif + template + struct qua + { + // -- Implementation detail -- + + typedef qua type; + typedef T value_type; + + // -- Data -- + # if GLM_LANG & GLM_LANG_CXXMS_FLAG union { @@ -56,16 +56,6 @@ namespace glm # else T x, y, z, w; # endif -# endif - -# if GLM_SILENT_WARNINGS == GLM_ENABLE -# if GLM_COMPILER & GLM_COMPILER_CLANG -# pragma clang diagnostic pop -# elif GLM_COMPILER & GLM_COMPILER_GCC -# pragma GCC diagnostic pop -# elif GLM_COMPILER & GLM_COMPILER_VC -# pragma warning(pop) -# endif # endif // -- Component accesses -- @@ -139,6 +129,16 @@ namespace glm GLM_FUNC_DECL GLM_CONSTEXPR qua& operator/=(U s); }; +# if GLM_SILENT_WARNINGS == GLM_ENABLE +# if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic pop +# elif GLM_COMPILER & GLM_COMPILER_GCC +# pragma GCC diagnostic pop +# elif GLM_COMPILER & GLM_COMPILER_VC +# pragma warning(pop) +# endif +# endif + // -- Unary bit operators -- template diff --git a/glm/ext/scalar_ulp.inl b/glm/ext/scalar_ulp.inl index 89f347e441..9858dc0580 100644 --- a/glm/ext/scalar_ulp.inl +++ b/glm/ext/scalar_ulp.inl @@ -10,9 +10,13 @@ #include #include -#if(GLM_COMPILER & GLM_COMPILER_VC) +#if GLM_COMPILER & GLM_COMPILER_VC # pragma warning(push) # pragma warning(disable : 4127) +#elif GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wsign-conversion" +# pragma clang diagnostic ignored "-Wpadded" #endif typedef union @@ -182,8 +186,10 @@ namespace detail }//namespace detail }//namespace glm -#if(GLM_COMPILER & GLM_COMPILER_VC) +#if GLM_COMPILER & GLM_COMPILER_VC # pragma warning(pop) +#elif GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic pop #endif namespace glm diff --git a/glm/gtc/bitfield.inl b/glm/gtc/bitfield.inl index 06cf1889cd..e7a0b4f722 100644 --- a/glm/gtc/bitfield.inl +++ b/glm/gtc/bitfield.inl @@ -221,6 +221,11 @@ namespace detail } }//namespace detail +#if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wsign-compare" +#endif + template GLM_FUNC_QUALIFIER genIUType mask(genIUType Bits) { @@ -229,6 +234,10 @@ namespace detail return Bits >= sizeof(genIUType) * 8 ? ~static_cast(0) : (static_cast(1) << Bits) - static_cast(1); } +#if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic pop +#endif + template GLM_FUNC_QUALIFIER vec mask(vec const& v) { diff --git a/glm/gtc/packing.inl b/glm/gtc/packing.inl index 3f0c63a7b5..70f80991c6 100644 --- a/glm/gtc/packing.inl +++ b/glm/gtc/packing.inl @@ -179,6 +179,13 @@ namespace detail // return ((floatTo11bit(x) & ((1 << 11) - 1)) << 0) | ((floatTo11bit(y) & ((1 << 11) - 1)) << 11) | ((floatTo10bit(z) & ((1 << 10) - 1)) << 22); // } +#if GLM_SILENT_WARNINGS == GLM_ENABLE +# if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wpadded" +# endif +#endif + union u3u3u2 { struct Data @@ -235,6 +242,12 @@ namespace detail uint16 pack; }; +#if GLM_SILENT_WARNINGS == GLM_ENABLE +# if defined(__clang__) +# pragma clang diagnostic pop +# endif +#endif + union u10u10u10u2 { struct Data @@ -347,7 +360,7 @@ namespace detail { i16vec4 Unpack; memcpy(&Unpack, &v, sizeof(Unpack)); - return vec<4, float, Q>(detail::toFloat32(v.x), detail::toFloat32(v.y), detail::toFloat32(v.z), detail::toFloat32(v.w)); + return vec<4, float, Q>(detail::toFloat32(Unpack.x), detail::toFloat32(Unpack.y), detail::toFloat32(Unpack.z), detail::toFloat32(Unpack.w)); } }; }//namespace detail diff --git a/glm/gtx/associated_min_max.hpp b/glm/gtx/associated_min_max.hpp index 4c036add21..435230d277 100644 --- a/glm/gtx/associated_min_max.hpp +++ b/glm/gtx/associated_min_max.hpp @@ -16,12 +16,10 @@ // Dependency: #include "../glm.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_associated_min_max is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_associated_min_max extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_associated_min_max is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_associated_min_max extension included") #endif namespace glm diff --git a/glm/gtx/bit.hpp b/glm/gtx/bit.hpp index 60a7aef1b4..2f6b3f6644 100644 --- a/glm/gtx/bit.hpp +++ b/glm/gtx/bit.hpp @@ -15,12 +15,10 @@ // Dependencies #include "../gtc/bitfield.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_bit is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_bit extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_bit is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_bit extension included") #endif namespace glm diff --git a/glm/gtx/closest_point.hpp b/glm/gtx/closest_point.hpp index de6dbbff94..a248e4b593 100644 --- a/glm/gtx/closest_point.hpp +++ b/glm/gtx/closest_point.hpp @@ -15,12 +15,10 @@ // Dependency: #include "../glm.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_closest_point is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_closest_point extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_closest_point is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_closest_point extension included") #endif namespace glm diff --git a/glm/gtx/color_encoding.hpp b/glm/gtx/color_encoding.hpp index 96ded2a277..4769e0abcb 100644 --- a/glm/gtx/color_encoding.hpp +++ b/glm/gtx/color_encoding.hpp @@ -19,12 +19,10 @@ #include "../vec3.hpp" #include -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTC_color_encoding is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTC_color_encoding extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTC_color_encoding is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTC_color_encoding extension included") #endif namespace glm diff --git a/glm/gtx/color_space.hpp b/glm/gtx/color_space.hpp index a634392149..c39a1f47de 100644 --- a/glm/gtx/color_space.hpp +++ b/glm/gtx/color_space.hpp @@ -15,12 +15,10 @@ // Dependency: #include "../glm.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_color_space is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_color_space extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_color_space is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_color_space extension included") #endif namespace glm diff --git a/glm/gtx/color_space.inl b/glm/gtx/color_space.inl index 0a7059fabb..ed39c0a949 100644 --- a/glm/gtx/color_space.inl +++ b/glm/gtx/color_space.inl @@ -1,5 +1,7 @@ /// @ref gtx_color_space +#include + namespace glm { template @@ -8,7 +10,7 @@ namespace glm vec<3, T, Q> hsv = hsvColor; vec<3, T, Q> rgbColor; - if(hsv.y == static_cast(0)) + if(equal(hsv.y, static_cast(0), epsilon())) // achromatic (grey) rgbColor = vec<3, T, Q>(hsv.z); else @@ -69,15 +71,15 @@ namespace glm hsv.z = Max; - if(Max != static_cast(0)) + if(!equal(Max, static_cast(0), epsilon())) { hsv.y = Delta / hsv.z; T h = static_cast(0); - if(rgbColor.r == Max) + if(equal(rgbColor.r, Max, epsilon())) // between yellow & magenta h = static_cast(0) + T(60) * (rgbColor.g - rgbColor.b) / Delta; - else if(rgbColor.g == Max) + else if(equal(rgbColor.g, Max, epsilon())) // between cyan & yellow h = static_cast(120) + T(60) * (rgbColor.b - rgbColor.r) / Delta; else diff --git a/glm/gtx/color_space_YCoCg.hpp b/glm/gtx/color_space_YCoCg.hpp index dd2b771693..a41803750e 100644 --- a/glm/gtx/color_space_YCoCg.hpp +++ b/glm/gtx/color_space_YCoCg.hpp @@ -15,12 +15,10 @@ // Dependency: #include "../glm.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_color_space_YCoCg is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_color_space_YCoCg extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_color_space_YCoCg is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_color_space_YCoCg extension included") #endif namespace glm diff --git a/glm/gtx/common.hpp b/glm/gtx/common.hpp index 254ada2d76..283f947b9d 100644 --- a/glm/gtx/common.hpp +++ b/glm/gtx/common.hpp @@ -18,12 +18,10 @@ #include "../vec4.hpp" #include "../gtc/vec1.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_common is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_common extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_common is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_common extension included") #endif namespace glm diff --git a/glm/gtx/compatibility.hpp b/glm/gtx/compatibility.hpp index 0af75583b9..463f86fe4e 100644 --- a/glm/gtx/compatibility.hpp +++ b/glm/gtx/compatibility.hpp @@ -16,12 +16,10 @@ #include "../glm.hpp" #include "../gtc/quaternion.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_compatibility is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_compatibility extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_compatibility is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_compatibility extension included") #endif #if GLM_COMPILER & GLM_COMPILER_VC diff --git a/glm/gtx/component_wise.hpp b/glm/gtx/component_wise.hpp index 34a2b0a375..57925cd001 100644 --- a/glm/gtx/component_wise.hpp +++ b/glm/gtx/component_wise.hpp @@ -18,12 +18,10 @@ #include "../detail/setup.hpp" #include "../detail/qualifier.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_component_wise is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_component_wise extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_component_wise is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_component_wise extension included") #endif namespace glm diff --git a/glm/gtx/dual_quaternion.hpp b/glm/gtx/dual_quaternion.hpp index a6f57613db..5ff1835624 100644 --- a/glm/gtx/dual_quaternion.hpp +++ b/glm/gtx/dual_quaternion.hpp @@ -20,12 +20,10 @@ #include "../gtc/constants.hpp" #include "../gtc/quaternion.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_dual_quaternion is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_dual_quaternion extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_dual_quaternion is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_dual_quaternion extension included") #endif namespace glm diff --git a/glm/gtx/easing.hpp b/glm/gtx/easing.hpp index da89826a90..50ed9037b1 100644 --- a/glm/gtx/easing.hpp +++ b/glm/gtx/easing.hpp @@ -21,12 +21,10 @@ #include "../gtc/constants.hpp" #include "../detail/qualifier.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_easing is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_easing extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_easing is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_easing extension included") #endif namespace glm{ diff --git a/glm/gtx/euler_angles.hpp b/glm/gtx/euler_angles.hpp index 27236973af..6f064735b9 100644 --- a/glm/gtx/euler_angles.hpp +++ b/glm/gtx/euler_angles.hpp @@ -18,12 +18,10 @@ // Dependency: #include "../glm.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_euler_angles is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_euler_angles extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_euler_angles is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_euler_angles extension included") #endif namespace glm diff --git a/glm/gtx/extend.hpp b/glm/gtx/extend.hpp index 28b7c5c014..46bf5e7059 100644 --- a/glm/gtx/extend.hpp +++ b/glm/gtx/extend.hpp @@ -15,12 +15,10 @@ // Dependency: #include "../glm.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_extend is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_extend extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_extend is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_extend extension included") #endif namespace glm diff --git a/glm/gtx/extended_min_max.hpp b/glm/gtx/extended_min_max.hpp index 20cd89b0d5..e1b722fe49 100644 --- a/glm/gtx/extended_min_max.hpp +++ b/glm/gtx/extended_min_max.hpp @@ -16,12 +16,10 @@ #include "../glm.hpp" #include "../ext/vector_common.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_extended_min_max is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_extended_min_max extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_extended_min_max is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_extended_min_max extension included") #endif namespace glm diff --git a/glm/gtx/exterior_product.hpp b/glm/gtx/exterior_product.hpp index 7d6c2e19b1..1979acc847 100644 --- a/glm/gtx/exterior_product.hpp +++ b/glm/gtx/exterior_product.hpp @@ -17,12 +17,10 @@ #include "../detail/setup.hpp" #include "../detail/qualifier.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_exterior_product is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_exterior_product extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_exterior_product is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_exterior_product extension included") #endif namespace glm diff --git a/glm/gtx/fast_exponential.hpp b/glm/gtx/fast_exponential.hpp index 6fb7286528..9fae32521f 100644 --- a/glm/gtx/fast_exponential.hpp +++ b/glm/gtx/fast_exponential.hpp @@ -16,12 +16,10 @@ // Dependency: #include "../glm.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_fast_exponential is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_fast_exponential extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_fast_exponential is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_fast_exponential extension included") #endif namespace glm diff --git a/glm/gtx/fast_square_root.hpp b/glm/gtx/fast_square_root.hpp index ac42a9c006..80729dbda4 100644 --- a/glm/gtx/fast_square_root.hpp +++ b/glm/gtx/fast_square_root.hpp @@ -19,12 +19,10 @@ #include "../exponential.hpp" #include "../geometric.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_fast_square_root is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_fast_square_root extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_fast_square_root is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_fast_square_root extension included") #endif namespace glm diff --git a/glm/gtx/fast_trigonometry.hpp b/glm/gtx/fast_trigonometry.hpp index 2650d6e4d6..93acab5fff 100644 --- a/glm/gtx/fast_trigonometry.hpp +++ b/glm/gtx/fast_trigonometry.hpp @@ -15,12 +15,10 @@ // Dependency: #include "../gtc/constants.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_fast_trigonometry is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_fast_trigonometry extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_fast_trigonometry is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_fast_trigonometry extension included") #endif namespace glm diff --git a/glm/gtx/functions.hpp b/glm/gtx/functions.hpp index 9f4166c4c1..df68a0d74d 100644 --- a/glm/gtx/functions.hpp +++ b/glm/gtx/functions.hpp @@ -18,12 +18,10 @@ #include "../detail/qualifier.hpp" #include "../detail/type_vec2.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_functions is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_functions extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_functions is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_functions extension included") #endif namespace glm diff --git a/glm/gtx/gradient_paint.hpp b/glm/gtx/gradient_paint.hpp index 6f85bf482d..5656445dfe 100644 --- a/glm/gtx/gradient_paint.hpp +++ b/glm/gtx/gradient_paint.hpp @@ -17,12 +17,10 @@ #include "../glm.hpp" #include "../gtx/optimum_pow.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_gradient_paint is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_gradient_paint extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_gradient_paint is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_gradient_paint extension included") #endif namespace glm diff --git a/glm/gtx/handed_coordinate_space.hpp b/glm/gtx/handed_coordinate_space.hpp index e59e3e2ac2..7c2aada016 100644 --- a/glm/gtx/handed_coordinate_space.hpp +++ b/glm/gtx/handed_coordinate_space.hpp @@ -15,12 +15,10 @@ // Dependency: #include "../glm.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_handed_coordinate_space is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_handed_coordinate_space extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_handed_coordinate_space is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_handed_coordinate_space extension included") #endif namespace glm diff --git a/glm/gtx/integer.hpp b/glm/gtx/integer.hpp index d0b4c61a3f..2b168302df 100644 --- a/glm/gtx/integer.hpp +++ b/glm/gtx/integer.hpp @@ -16,12 +16,10 @@ #include "../glm.hpp" #include "../gtc/integer.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_integer is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_integer extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_integer is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_integer extension included") #endif namespace glm diff --git a/glm/gtx/integer.inl b/glm/gtx/integer.inl index 956366b250..eb5df30cfc 100644 --- a/glm/gtx/integer.inl +++ b/glm/gtx/integer.inl @@ -141,13 +141,13 @@ namespace detail return x - y * (x / y); } -#if(GLM_COMPILER & (GLM_COMPILER_VC | GLM_COMPILER_GCC)) +//#if(GLM_COMPILER & (GLM_COMPILER_VC | GLM_COMPILER_GCC)) GLM_FUNC_QUALIFIER unsigned int nlz(unsigned int x) { - return 31u - findMSB(x); + return 31u - static_cast(findMSB(x)); } - +/* #else // Hackers Delight: http://www.hackersdelight.org/HDcode/nlz.c.txt @@ -181,5 +181,5 @@ namespace detail } #endif//(GLM_COMPILER) - +*/ }//namespace glm diff --git a/glm/gtx/intersect.hpp b/glm/gtx/intersect.hpp index f5c0621deb..c7aec6f223 100644 --- a/glm/gtx/intersect.hpp +++ b/glm/gtx/intersect.hpp @@ -21,12 +21,10 @@ #include "../gtx/closest_point.hpp" #include "../gtx/vector_query.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_closest_point is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_closest_point extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_closest_point is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_closest_point extension included") #endif namespace glm diff --git a/glm/gtx/io.hpp b/glm/gtx/io.hpp index 68b5499bfb..3a4ad2c60f 100644 --- a/glm/gtx/io.hpp +++ b/glm/gtx/io.hpp @@ -23,12 +23,10 @@ #include "../glm.hpp" #include "../gtx/quaternion.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_io is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_io extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_io is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_io extension included") #endif #include // std::basic_ostream<> (fwd) diff --git a/glm/gtx/log_base.hpp b/glm/gtx/log_base.hpp index ba28c9d7bf..915c7a4a05 100644 --- a/glm/gtx/log_base.hpp +++ b/glm/gtx/log_base.hpp @@ -15,12 +15,10 @@ // Dependency: #include "../glm.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_log_base is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_log_base extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_log_base is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_log_base extension included") #endif namespace glm diff --git a/glm/gtx/matrix_cross_product.hpp b/glm/gtx/matrix_cross_product.hpp index 1e585f9a4f..882a1d760d 100644 --- a/glm/gtx/matrix_cross_product.hpp +++ b/glm/gtx/matrix_cross_product.hpp @@ -16,12 +16,10 @@ // Dependency: #include "../glm.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_matrix_cross_product is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_matrix_cross_product extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_matrix_cross_product is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_matrix_cross_product extension included") #endif namespace glm diff --git a/glm/gtx/matrix_decompose.hpp b/glm/gtx/matrix_decompose.hpp index 8ab38e6b36..2ebc072fe1 100644 --- a/glm/gtx/matrix_decompose.hpp +++ b/glm/gtx/matrix_decompose.hpp @@ -20,12 +20,10 @@ #include "../gtc/quaternion.hpp" #include "../gtc/matrix_transform.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_matrix_decompose is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_matrix_decompose extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_matrix_decompose is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_matrix_decompose extension included") #endif namespace glm diff --git a/glm/gtx/matrix_factorisation.hpp b/glm/gtx/matrix_factorisation.hpp index 5a975d60b6..ef56961db3 100644 --- a/glm/gtx/matrix_factorisation.hpp +++ b/glm/gtx/matrix_factorisation.hpp @@ -15,12 +15,10 @@ // Dependency: #include "../glm.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_matrix_factorisation is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_matrix_factorisation extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_matrix_factorisation is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_matrix_factorisation extension included") #endif /* diff --git a/glm/gtx/matrix_interpolation.hpp b/glm/gtx/matrix_interpolation.hpp index 7d5ad4cd9a..bbd0f4250f 100644 --- a/glm/gtx/matrix_interpolation.hpp +++ b/glm/gtx/matrix_interpolation.hpp @@ -16,12 +16,10 @@ // Dependency: #include "../glm.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_matrix_interpolation is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_matrix_interpolation extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_matrix_interpolation is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_matrix_interpolation extension included") #endif namespace glm diff --git a/glm/gtx/matrix_major_storage.hpp b/glm/gtx/matrix_major_storage.hpp index 8c6bc22d14..f5185786cd 100644 --- a/glm/gtx/matrix_major_storage.hpp +++ b/glm/gtx/matrix_major_storage.hpp @@ -16,12 +16,10 @@ // Dependency: #include "../glm.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_matrix_major_storage is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_matrix_major_storage extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_matrix_major_storage is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_matrix_major_storage extension included") #endif namespace glm diff --git a/glm/gtx/matrix_operation.hpp b/glm/gtx/matrix_operation.hpp index de6ff1f86f..07ed8e843d 100644 --- a/glm/gtx/matrix_operation.hpp +++ b/glm/gtx/matrix_operation.hpp @@ -15,12 +15,10 @@ // Dependency: #include "../glm.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_matrix_operation is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_matrix_operation extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_matrix_operation is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_matrix_operation extension included") #endif namespace glm diff --git a/glm/gtx/matrix_query.hpp b/glm/gtx/matrix_query.hpp index 8011b2b1d4..de8c65593d 100644 --- a/glm/gtx/matrix_query.hpp +++ b/glm/gtx/matrix_query.hpp @@ -18,12 +18,10 @@ #include "../gtx/vector_query.hpp" #include -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_matrix_query is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_matrix_query extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_matrix_query is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_matrix_query extension included") #endif namespace glm diff --git a/glm/gtx/matrix_transform_2d.hpp b/glm/gtx/matrix_transform_2d.hpp index 5f9c540218..deb8da2dc6 100644 --- a/glm/gtx/matrix_transform_2d.hpp +++ b/glm/gtx/matrix_transform_2d.hpp @@ -17,12 +17,10 @@ #include "../mat3x3.hpp" #include "../vec2.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_matrix_transform_2d is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_matrix_transform_2d extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_matrix_transform_2d is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_matrix_transform_2d extension included") #endif namespace glm diff --git a/glm/gtx/mixed_product.hpp b/glm/gtx/mixed_product.hpp index b242e357e5..a091274cbb 100644 --- a/glm/gtx/mixed_product.hpp +++ b/glm/gtx/mixed_product.hpp @@ -15,12 +15,10 @@ // Dependency: #include "../glm.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_mixed_product is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_mixed_product extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_mixed_product is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_mixed_product extension included") #endif namespace glm diff --git a/glm/gtx/norm.hpp b/glm/gtx/norm.hpp index dfaebb7a8b..d6724a80b6 100644 --- a/glm/gtx/norm.hpp +++ b/glm/gtx/norm.hpp @@ -19,12 +19,10 @@ #include "../gtx/quaternion.hpp" #include "../gtx/component_wise.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_norm is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_norm extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_norm is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_norm extension included") #endif namespace glm diff --git a/glm/gtx/normal.hpp b/glm/gtx/normal.hpp index 068682f75f..8b3a4b54b3 100644 --- a/glm/gtx/normal.hpp +++ b/glm/gtx/normal.hpp @@ -16,12 +16,10 @@ // Dependency: #include "../glm.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_normal is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_normal extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_normal is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_normal extension included") #endif namespace glm diff --git a/glm/gtx/normalize_dot.hpp b/glm/gtx/normalize_dot.hpp index 127aa1f65a..04a6b08a98 100644 --- a/glm/gtx/normalize_dot.hpp +++ b/glm/gtx/normalize_dot.hpp @@ -16,12 +16,10 @@ // Dependency: #include "../gtx/fast_square_root.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_normalize_dot is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_normalize_dot extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_normalize_dot is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_normalize_dot extension included") #endif namespace glm diff --git a/glm/gtx/number_precision.hpp b/glm/gtx/number_precision.hpp index 3bf0ad68bd..ed195f2ce3 100644 --- a/glm/gtx/number_precision.hpp +++ b/glm/gtx/number_precision.hpp @@ -18,12 +18,10 @@ #include "../glm.hpp" #include "../gtc/type_precision.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_number_precision is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_number_precision extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_number_precision is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_number_precision extension included") #endif namespace glm{ diff --git a/glm/gtx/optimum_pow.hpp b/glm/gtx/optimum_pow.hpp index a8ff6002f1..ac34e7e1ff 100644 --- a/glm/gtx/optimum_pow.hpp +++ b/glm/gtx/optimum_pow.hpp @@ -15,12 +15,10 @@ // Dependency: #include "../glm.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_optimum_pow is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_optimum_pow extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_optimum_pow is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_optimum_pow extension included") #endif namespace glm diff --git a/glm/gtx/orthonormalize.hpp b/glm/gtx/orthonormalize.hpp index 3e004fb06f..801b7558a4 100644 --- a/glm/gtx/orthonormalize.hpp +++ b/glm/gtx/orthonormalize.hpp @@ -18,12 +18,10 @@ #include "../mat3x3.hpp" #include "../geometric.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_orthonormalize is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_orthonormalize extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_orthonormalize is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_orthonormalize extension included") #endif namespace glm diff --git a/glm/gtx/pca.hpp b/glm/gtx/pca.hpp index d89c408e36..828b8a8154 100644 --- a/glm/gtx/pca.hpp +++ b/glm/gtx/pca.hpp @@ -42,13 +42,10 @@ #include "../glm.hpp" #include "../ext/scalar_relational.hpp" - -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_pca is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_pca extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_pca is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_pca extension included") #endif namespace glm { diff --git a/glm/gtx/perpendicular.hpp b/glm/gtx/perpendicular.hpp index 72b77b6e23..4087ab04a7 100644 --- a/glm/gtx/perpendicular.hpp +++ b/glm/gtx/perpendicular.hpp @@ -17,12 +17,10 @@ #include "../glm.hpp" #include "../gtx/projection.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_perpendicular is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_perpendicular extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_perpendicular is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_perpendicular extension included") #endif namespace glm diff --git a/glm/gtx/polar_coordinates.hpp b/glm/gtx/polar_coordinates.hpp index 76beb82bd5..c27aacfe61 100644 --- a/glm/gtx/polar_coordinates.hpp +++ b/glm/gtx/polar_coordinates.hpp @@ -15,12 +15,10 @@ // Dependency: #include "../glm.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_polar_coordinates is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_polar_coordinates extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_polar_coordinates is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_polar_coordinates extension included") #endif namespace glm diff --git a/glm/gtx/projection.hpp b/glm/gtx/projection.hpp index 678f3ad5a5..a438f396e6 100644 --- a/glm/gtx/projection.hpp +++ b/glm/gtx/projection.hpp @@ -15,12 +15,10 @@ // Dependency: #include "../geometric.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_projection is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_projection extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_projection is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_projection extension included") #endif namespace glm diff --git a/glm/gtx/quaternion.hpp b/glm/gtx/quaternion.hpp index 35c372b816..f51c521cc3 100644 --- a/glm/gtx/quaternion.hpp +++ b/glm/gtx/quaternion.hpp @@ -20,12 +20,10 @@ #include "../ext/quaternion_exponential.hpp" #include "../gtx/norm.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_quaternion is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_quaternion extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_quaternion is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_quaternion extension included") #endif namespace glm diff --git a/glm/gtx/range.hpp b/glm/gtx/range.hpp index 93bcb9a65a..50c5e57be6 100644 --- a/glm/gtx/range.hpp +++ b/glm/gtx/range.hpp @@ -15,12 +15,10 @@ // Dependencies #include "../detail/setup.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_range is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_range extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_range is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_range extension included") #endif #include "../gtc/type_ptr.hpp" diff --git a/glm/gtx/raw_data.hpp b/glm/gtx/raw_data.hpp index 86cbe77d9a..3bc27b98dd 100644 --- a/glm/gtx/raw_data.hpp +++ b/glm/gtx/raw_data.hpp @@ -16,12 +16,10 @@ #include "../ext/scalar_uint_sized.hpp" #include "../detail/setup.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_raw_data is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_raw_data extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_raw_data is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_raw_data extension included") #endif namespace glm diff --git a/glm/gtx/rotate_normalized_axis.hpp b/glm/gtx/rotate_normalized_axis.hpp index 2103ca08f1..02c3f5c7e4 100644 --- a/glm/gtx/rotate_normalized_axis.hpp +++ b/glm/gtx/rotate_normalized_axis.hpp @@ -19,12 +19,10 @@ #include "../gtc/epsilon.hpp" #include "../gtc/quaternion.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_rotate_normalized_axis is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_rotate_normalized_axis extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_rotate_normalized_axis is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_rotate_normalized_axis extension included") #endif namespace glm diff --git a/glm/gtx/rotate_vector.hpp b/glm/gtx/rotate_vector.hpp index dcd5b95a6e..b7345bf41e 100644 --- a/glm/gtx/rotate_vector.hpp +++ b/glm/gtx/rotate_vector.hpp @@ -19,12 +19,10 @@ #include "../ext/vector_relational.hpp" #include "../glm.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_rotate_vector is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_rotate_vector extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_rotate_vector is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_rotate_vector extension included") #endif namespace glm diff --git a/glm/gtx/scalar_multiplication.hpp b/glm/gtx/scalar_multiplication.hpp index 9f9f2fb3ed..97df000035 100644 --- a/glm/gtx/scalar_multiplication.hpp +++ b/glm/gtx/scalar_multiplication.hpp @@ -19,12 +19,10 @@ #include "../detail/setup.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_scalar_multiplication is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_scalar_multiplication extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_scalar_multiplication is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_scalar_multiplication extension included") #endif #include "../vec2.hpp" diff --git a/glm/gtx/scalar_relational.hpp b/glm/gtx/scalar_relational.hpp index 8be9c57b8b..e8409329b6 100644 --- a/glm/gtx/scalar_relational.hpp +++ b/glm/gtx/scalar_relational.hpp @@ -15,12 +15,10 @@ // Dependency: #include "../glm.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_extend is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_extend extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_scalar_relational is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_scalar_relational extension included") #endif namespace glm diff --git a/glm/gtx/spline.hpp b/glm/gtx/spline.hpp index 731c979e35..8df5584913 100644 --- a/glm/gtx/spline.hpp +++ b/glm/gtx/spline.hpp @@ -16,12 +16,10 @@ #include "../glm.hpp" #include "../gtx/optimum_pow.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_spline is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_spline extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_spline is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_spline extension included") #endif namespace glm diff --git a/glm/gtx/std_based_type.hpp b/glm/gtx/std_based_type.hpp index cd3be8cb78..864885de7a 100644 --- a/glm/gtx/std_based_type.hpp +++ b/glm/gtx/std_based_type.hpp @@ -17,12 +17,10 @@ #include "../glm.hpp" #include -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_std_based_type is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_std_based_type extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_std_based_type is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_std_based_type extension included") #endif namespace glm diff --git a/glm/gtx/string_cast.hpp b/glm/gtx/string_cast.hpp index 71f6ece4c9..2958edc469 100644 --- a/glm/gtx/string_cast.hpp +++ b/glm/gtx/string_cast.hpp @@ -21,13 +21,12 @@ #include "../gtx/dual_quaternion.hpp" #include #include +#include -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_string_cast is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_string_cast extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_string_cast is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_string_cast extension included") #endif namespace glm diff --git a/glm/gtx/string_cast.inl b/glm/gtx/string_cast.inl index 0b2d4b6aeb..c51b7f4139 100644 --- a/glm/gtx/string_cast.inl +++ b/glm/gtx/string_cast.inl @@ -18,24 +18,29 @@ namespace detail typedef double value_type; }; - GLM_FUNC_QUALIFIER std::string format(const char* msg, ...) - { + GLM_FUNC_QUALIFIER std::string format(const char* message, ...) { std::size_t const STRING_BUFFER(4096); - char text[STRING_BUFFER]; + + assert(message != NULL); + assert(strlen(message) >= 0 && strlen(message) < STRING_BUFFER); + + char buffer[STRING_BUFFER]; va_list list; - if(msg == GLM_NULLPTR) - return std::string(); +#if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wformat-nonliteral" +#endif - va_start(list, msg); -# if (GLM_COMPILER & GLM_COMPILER_VC) - vsprintf_s(text, STRING_BUFFER, msg, list); -# else// - std::vsnprintf(text, STRING_BUFFER, msg, list); -# endif// + va_start(list, message); + vsnprintf(buffer, STRING_BUFFER, message, list); va_end(list); - return std::string(text); +#if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic pop +#endif + + return buffer; } static const char* LabelTrue = "true"; diff --git a/glm/gtx/texture.hpp b/glm/gtx/texture.hpp index 20585e68ce..608c6ad03f 100644 --- a/glm/gtx/texture.hpp +++ b/glm/gtx/texture.hpp @@ -17,12 +17,10 @@ #include "../gtc/integer.hpp" #include "../gtx/component_wise.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_texture is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_texture extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_texture is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_texture extension included") #endif namespace glm diff --git a/glm/gtx/transform.hpp b/glm/gtx/transform.hpp index 0279fc8bd3..9707b5041b 100644 --- a/glm/gtx/transform.hpp +++ b/glm/gtx/transform.hpp @@ -19,12 +19,10 @@ #include "../glm.hpp" #include "../gtc/matrix_transform.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_transform is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_transform extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_transform is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_transform extension included") #endif namespace glm diff --git a/glm/gtx/transform2.hpp b/glm/gtx/transform2.hpp index 0d8ba9d90b..9604a92312 100644 --- a/glm/gtx/transform2.hpp +++ b/glm/gtx/transform2.hpp @@ -17,12 +17,10 @@ #include "../glm.hpp" #include "../gtx/transform.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_transform2 is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_transform2 extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_transform2 is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_transform2 extension included") #endif namespace glm diff --git a/glm/gtx/type_aligned.hpp b/glm/gtx/type_aligned.hpp index 2ae522c1fc..ec40935847 100644 --- a/glm/gtx/type_aligned.hpp +++ b/glm/gtx/type_aligned.hpp @@ -17,12 +17,10 @@ #include "../gtc/type_precision.hpp" #include "../gtc/quaternion.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_type_aligned is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_type_aligned extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# pragma message("GLM: GLM_GTX_type_aligned is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_type_aligned extension included") #endif namespace glm diff --git a/glm/gtx/type_trait.hpp b/glm/gtx/type_trait.hpp index 56685c8cb9..17ddbad1b8 100644 --- a/glm/gtx/type_trait.hpp +++ b/glm/gtx/type_trait.hpp @@ -12,12 +12,10 @@ #pragma once -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_type_trait is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_type_trait extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_type_trait is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_type_trait extension included") #endif // Dependency: diff --git a/glm/gtx/vec_swizzle.hpp b/glm/gtx/vec_swizzle.hpp index 4440c9accd..2dafa645f5 100644 --- a/glm/gtx/vec_swizzle.hpp +++ b/glm/gtx/vec_swizzle.hpp @@ -14,12 +14,10 @@ #include "../glm.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_vec_swizzle is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_vec_swizzle extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_vec_swizzle is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_vec_swizzle extension included") #endif namespace glm { diff --git a/glm/gtx/vector_angle.hpp b/glm/gtx/vector_angle.hpp index 9ae437126b..9ff41279b3 100644 --- a/glm/gtx/vector_angle.hpp +++ b/glm/gtx/vector_angle.hpp @@ -20,12 +20,10 @@ #include "../gtx/quaternion.hpp" #include "../gtx/rotate_vector.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_vector_angle is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_vector_angle extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_vector_angle is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_vector_angle extension included") #endif namespace glm diff --git a/glm/gtx/vector_query.hpp b/glm/gtx/vector_query.hpp index af1f7b9bd5..ab52df0f20 100644 --- a/glm/gtx/vector_query.hpp +++ b/glm/gtx/vector_query.hpp @@ -17,12 +17,10 @@ #include #include -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_vector_query is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_vector_query extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_vector_query is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_vector_query extension included") #endif namespace glm diff --git a/glm/gtx/wrap.hpp b/glm/gtx/wrap.hpp index ad4eb3fca7..b7ac5af263 100644 --- a/glm/gtx/wrap.hpp +++ b/glm/gtx/wrap.hpp @@ -18,12 +18,10 @@ #include "../ext/vector_common.hpp" #include "../gtc/vec1.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# ifndef GLM_ENABLE_EXPERIMENTAL -# pragma message("GLM: GLM_GTX_wrap is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") -# else -# pragma message("GLM: GLM_GTX_wrap extension included") -# endif +#ifndef GLM_ENABLE_EXPERIMENTAL +# error "GLM: GLM_GTX_wrap is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." +#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_GTX_wrap extension included") #endif namespace glm diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 0624008cf9..6614ffe93e 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -209,10 +209,12 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU") if(NOT GLM_DISABLE_AUTO_DETECTION) add_compile_options(-Werror) +# add_compile_options(-Wpedantic) +# add_compile_options(-Wall) +# add_compile_options(-Wextra) endif() add_compile_options(-O2) - add_compile_options(-Wno-long-long) - + #add_compile_options(-Wno-long-long) elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel") if(NOT GLM_QUIET) message("GLM: Intel - ${CMAKE_CXX_COMPILER_ID} compiler") diff --git a/test/bug/bug_ms_vec_static.cpp b/test/bug/bug_ms_vec_static.cpp index 7f44e409a7..ed62212899 100644 --- a/test/bug/bug_ms_vec_static.cpp +++ b/test/bug/bug_ms_vec_static.cpp @@ -14,11 +14,20 @@ struct vec2 x(0), y(0) {} +#if defined(_MSC_VER) +# pragma warning(push) +# pragma warning(disable: 4201) // nonstandard extension used : nameless struct/union +#endif + union { struct { float x, y; }; struct { _swizzle xx; }; }; + +#if defined(_MSC_VER) +# pragma warning(pop) +#endif }; #endif diff --git a/test/core/core_force_compiler_unknown.cpp b/test/core/core_force_compiler_unknown.cpp index 44d7fc3365..33284d09b0 100644 --- a/test/core/core_force_compiler_unknown.cpp +++ b/test/core/core_force_compiler_unknown.cpp @@ -2,9 +2,32 @@ # define GLM_FORCE_COMPILER_UNKNOWN #endif +#if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wgnu-anonymous-struct" +# pragma clang diagnostic ignored "-Wnested-anon-types" +# pragma clang diagnostic ignored "-Wsign-conversion" +# pragma clang diagnostic ignored "-Wpadded" +# pragma clang diagnostic ignored "-Wc++11-long-long" +#elif defined(__GNUC__) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wpedantic" +#elif defined(_MSC_VER) +# pragma warning(push) +# pragma warning(disable: 4201) // nonstandard extension used : nameless struct/union +#endif + #include #include +#if defined(__clang__) +# pragma clang diagnostic pop +#elif defined(__GNUC__) +# pragma GCC diagnostic pop +#elif defined(_MSC_VER) +# pragma warning(pop) +#endif + int main() { int Error = 0; diff --git a/test/core/core_func_common.cpp b/test/core/core_func_common.cpp index 5d9295e1f1..bc09af1fcf 100644 --- a/test/core/core_func_common.cpp +++ b/test/core/core_func_common.cpp @@ -298,12 +298,12 @@ namespace min_ return Error; } - int min_tern(int a, int b) + static int min_tern(int a, int b) { return a < b ? a : b; } - int min_int(int x, int y) + static int min_int(int x, int y) { return y ^ ((x ^ y) & -(x < y)); } @@ -397,6 +397,11 @@ namespace clamp_ namespace mix_ { +#if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wpadded" +#endif + template struct entry { @@ -406,7 +411,16 @@ namespace mix_ T Result; }; - entry const TestBool[] = +#if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic pop +#endif + +#if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wglobal-constructors" +#endif + + static entry const TestBool[] = { {0.0f, 1.0f, false, 0.0f}, {0.0f, 1.0f, true, 1.0f}, @@ -414,7 +428,7 @@ namespace mix_ {-1.0f, 1.0f, true, 1.0f} }; - entry const TestFloat[] = + static entry const TestFloat[] = { {0.0f, 1.0f, 0.0f, 0.0f}, {0.0f, 1.0f, 1.0f, 1.0f}, @@ -422,7 +436,7 @@ namespace mix_ {-1.0f, 1.0f, 1.0f, 1.0f} }; - entry const TestVec2Bool[] = + static entry const TestVec2Bool[] = { {glm::vec2(0.0f), glm::vec2(1.0f), false, glm::vec2(0.0f)}, {glm::vec2(0.0f), glm::vec2(1.0f), true, glm::vec2(1.0f)}, @@ -430,7 +444,7 @@ namespace mix_ {glm::vec2(-1.0f), glm::vec2(1.0f), true, glm::vec2(1.0f)} }; - entry const TestBVec2[] = + static entry const TestBVec2[] = { {glm::vec2(0.0f), glm::vec2(1.0f), glm::bvec2(false), glm::vec2(0.0f)}, {glm::vec2(0.0f), glm::vec2(1.0f), glm::bvec2(true), glm::vec2(1.0f)}, @@ -439,7 +453,7 @@ namespace mix_ {glm::vec2(-1.0f), glm::vec2(1.0f), glm::bvec2(true, false), glm::vec2(1.0f, -1.0f)} }; - entry const TestVec3Bool[] = + static entry const TestVec3Bool[] = { {glm::vec3(0.0f), glm::vec3(1.0f), false, glm::vec3(0.0f)}, {glm::vec3(0.0f), glm::vec3(1.0f), true, glm::vec3(1.0f)}, @@ -447,7 +461,7 @@ namespace mix_ {glm::vec3(-1.0f), glm::vec3(1.0f), true, glm::vec3(1.0f)} }; - entry const TestBVec3[] = + static entry const TestBVec3[] = { {glm::vec3(0.0f), glm::vec3(1.0f), glm::bvec3(false), glm::vec3(0.0f)}, {glm::vec3(0.0f), glm::vec3(1.0f), glm::bvec3(true), glm::vec3(1.0f)}, @@ -456,7 +470,7 @@ namespace mix_ {glm::vec3(1.0f, 2.0f, 3.0f), glm::vec3(4.0f, 5.0f, 6.0f), glm::bvec3(true, false, true), glm::vec3(4.0f, 2.0f, 6.0f)} }; - entry const TestVec4Bool[] = + static entry const TestVec4Bool[] = { {glm::vec4(0.0f), glm::vec4(1.0f), false, glm::vec4(0.0f)}, {glm::vec4(0.0f), glm::vec4(1.0f), true, glm::vec4(1.0f)}, @@ -464,7 +478,7 @@ namespace mix_ {glm::vec4(-1.0f), glm::vec4(1.0f), true, glm::vec4(1.0f)} }; - entry const TestBVec4[] = + static entry const TestBVec4[] = { {glm::vec4(0.0f, 0.0f, 1.0f, 1.0f), glm::vec4(2.0f, 2.0f, 3.0f, 3.0f), glm::bvec4(false, true, false, true), glm::vec4(0.0f, 2.0f, 1.0f, 3.0f)}, {glm::vec4(0.0f), glm::vec4(1.0f), glm::bvec4(true), glm::vec4(1.0f)}, @@ -473,6 +487,10 @@ namespace mix_ {glm::vec4(1.0f, 2.0f, 3.0f, 4.0f), glm::vec4(5.0f, 6.0f, 7.0f, 8.0f), glm::bvec4(true, false, true, false), glm::vec4(5.0f, 2.0f, 7.0f, 4.0f)} }; +#if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic pop +#endif + static int test() { int Error = 0; @@ -575,14 +593,19 @@ namespace step_ VEC result; }; - entry TestVec4Scalar [] = +#if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wglobal-constructors" +#endif + + static const entry TestVec4Scalar [] = { { 1.0f, glm::vec4(1.0f, 2.0f, 3.0f, 4.0f), glm::vec4(1.0f) }, { 0.0f, glm::vec4(1.0f, 2.0f, 3.0f, 4.0f), glm::vec4(1.0f) }, { 0.0f, glm::vec4(-1.0f, -2.0f, -3.0f, -4.0f), glm::vec4(0.0f) } }; - entry TestVec4Vector [] = + static const entry TestVec4Vector [] = { { glm::vec4(-1.0f, -2.0f, -3.0f, -4.0f), glm::vec4(-2.0f, -3.0f, -4.0f, -5.0f), glm::vec4(0.0f) }, { glm::vec4( 0.0f, 1.0f, 2.0f, 3.0f), glm::vec4( 1.0f, 2.0f, 3.0f, 4.0f), glm::vec4(1.0f) }, @@ -590,6 +613,10 @@ namespace step_ { glm::vec4( 0.0f, 1.0f, 2.0f, 3.0f), glm::vec4(-1.0f,-2.0f,-3.0f,-4.0f), glm::vec4(0.0f) } }; +#if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic pop +#endif + static int test() { int Error = 0; @@ -901,6 +928,11 @@ namespace sign return result; } +#if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wsign-conversion" +#endif + template GLM_FUNC_QUALIFIER genFIType sign_alu1(genFIType x) { @@ -911,6 +943,10 @@ namespace sign return (x >> 31) | (static_cast(-x) >> 31); } +#if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic pop +#endif + GLM_FUNC_QUALIFIER int sign_alu2(int x) { GLM_STATIC_ASSERT(std::numeric_limits::is_signed && std::numeric_limits::is_integer, "'sign' only accept integer inputs"); @@ -954,7 +990,7 @@ namespace sign genType Return; }; - int test_int32() + static int test_int32() { type const Data[] = { @@ -1004,7 +1040,7 @@ namespace sign return Error; } - int test_i32vec4() + static int test_i32vec4() { type const Data[] = { @@ -1028,7 +1064,7 @@ namespace sign return Error; } - int test_f32vec4() + static int test_f32vec4() { type const Data[] = { @@ -1063,7 +1099,7 @@ namespace sign return Error; } - int perf_rand(std::size_t Samples) + static int perf_rand(std::size_t Samples) { int Error = 0; @@ -1116,7 +1152,7 @@ namespace sign return Error; } - int perf_linear(std::size_t Samples) + static int perf_linear(std::size_t Samples) { int Error = 0; @@ -1163,7 +1199,7 @@ namespace sign return Error; } - int perf_linear_cal(std::size_t Samples) + static int perf_linear_cal(std::size_t Samples) { int Error = 0; diff --git a/test/core/core_func_geometric.cpp b/test/core/core_func_geometric.cpp index 7ef9c6838a..2820ad4c81 100644 --- a/test/core/core_func_geometric.cpp +++ b/test/core/core_func_geometric.cpp @@ -13,7 +13,7 @@ namespace length { - int test() + static int test() { float Length1 = glm::length(glm::vec1(1)); float Length2 = glm::length(glm::vec2(1, 0)); @@ -33,7 +33,7 @@ namespace length namespace distance { - int test() + static int test() { float Distance1 = glm::distance(glm::vec1(1), glm::vec1(1)); float Distance2 = glm::distance(glm::vec2(1, 0), glm::vec2(1, 0)); @@ -53,7 +53,7 @@ namespace distance namespace dot { - int test() + static int test() { float Dot1 = glm::dot(glm::vec1(1), glm::vec1(1)); float Dot2 = glm::dot(glm::vec2(1), glm::vec2(1)); @@ -73,7 +73,7 @@ namespace dot namespace cross { - int test() + static int test() { glm::vec3 Cross1 = glm::cross(glm::vec3(1, 0, 0), glm::vec3(0, 1, 0)); glm::vec3 Cross2 = glm::cross(glm::vec3(0, 1, 0), glm::vec3(1, 0, 0)); @@ -89,22 +89,23 @@ namespace cross namespace normalize { - int test() + static int test() { + int Error = 0; + glm::vec3 Normalize1 = glm::normalize(glm::vec3(1, 0, 0)); glm::vec3 Normalize2 = glm::normalize(glm::vec3(2, 0, 0)); - glm::vec3 Normalize3 = glm::normalize(glm::vec3(-0.6, 0.7, -0.5)); + Error += glm::all(glm::lessThan(glm::abs(Normalize1 - glm::vec3(1, 0, 0)), glm::vec3(std::numeric_limits::epsilon()))) ? 0 : 1; + Error += glm::all(glm::lessThan(glm::abs(Normalize2 - glm::vec3(1, 0, 0)), glm::vec3(std::numeric_limits::epsilon()))) ? 0 : 1; glm::vec3 ro = glm::vec3(glm::cos(5.f) * 3.f, 2.f, glm::sin(5.f) * 3.f); glm::vec3 w = glm::normalize(glm::vec3(0, -0.2f, 0) - ro); glm::vec3 u = glm::normalize(glm::cross(w, glm::vec3(0, 1, 0))); glm::vec3 v = glm::cross(u, w); + glm::vec3 x = glm::cross(w, u); - int Error = 0; - - Error += glm::all(glm::lessThan(glm::abs(Normalize1 - glm::vec3(1, 0, 0)), glm::vec3(std::numeric_limits::epsilon()))) ? 0 : 1; - Error += glm::all(glm::lessThan(glm::abs(Normalize2 - glm::vec3(1, 0, 0)), glm::vec3(std::numeric_limits::epsilon()))) ? 0 : 1; + Error += glm::all(glm::equal(x + v, glm::vec3(0), 0.01f)) ? 0 : 1; return Error; } @@ -112,7 +113,7 @@ namespace normalize namespace faceforward { - int test() + static int test() { int Error = 0; @@ -121,6 +122,8 @@ namespace faceforward glm::vec3 I(1.0f, 0.0f, 1.0f); glm::vec3 Nref(0.0f, 0.0f, 1.0f); glm::vec3 F = glm::faceforward(N, I, Nref); + + Error += glm::all(glm::equal(F, glm::vec3(0.0, 0.0, -1.0), 0.0001f)) ? 0 : 1; } return Error; @@ -129,7 +132,7 @@ namespace faceforward namespace reflect { - int test() + static int test() { int Error = 0; @@ -153,7 +156,7 @@ namespace reflect namespace refract { - int test() + static int test() { int Error = 0; diff --git a/test/core/core_func_integer.cpp b/test/core/core_func_integer.cpp index ad733f9de5..0b6d09ce8b 100644 --- a/test/core/core_func_integer.cpp +++ b/test/core/core_func_integer.cpp @@ -251,6 +251,11 @@ namespace bitfieldReverse return bitfieldReverseOps(glm::vec<1, genType, glm::defaultp>(x)).x; } +#if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wpadded" +#endif + template struct type { @@ -259,6 +264,10 @@ namespace bitfieldReverse result Result; }; +#if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic pop +#endif + typedef type typeU32; typeU32 const Data32[] = diff --git a/test/core/core_func_integer_bit_count.cpp b/test/core/core_func_integer_bit_count.cpp index 0fa11fbe3f..e190c05544 100644 --- a/test/core/core_func_integer_bit_count.cpp +++ b/test/core/core_func_integer_bit_count.cpp @@ -5,13 +5,20 @@ #include //To define "exit", req'd by XLC. #include -unsigned rotatel(unsigned x, int n) +#ifdef NDEBUG + +#if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wsign-conversion" +#endif + +static unsigned rotatel(unsigned x, int n) { if (static_cast(n) > 63) { std::printf("rotatel, n out of range.\n"); std::exit(1);} return (x << n) | (x >> (32 - n)); } -int pop0(unsigned x) +static int pop0(unsigned x) { x = (x & 0x55555555) + ((x >> 1) & 0x55555555); x = (x & 0x33333333) + ((x >> 2) & 0x33333333); @@ -21,7 +28,7 @@ int pop0(unsigned x) return x; } -int pop1(unsigned x) +static int pop1(unsigned x) { x = x - ((x >> 1) & 0x55555555); x = (x & 0x33333333) + ((x >> 2) & 0x33333333); @@ -34,7 +41,7 @@ int pop1(unsigned x) return x*0x01010101 >> 24; if your machine has a fast multiplier (suggested by Jari Kirma). */ -int pop2(unsigned x) +static int pop2(unsigned x) { unsigned n; @@ -51,7 +58,7 @@ int pop2(unsigned x) (x >> 30); which runs faster on most machines (suggested by Norbert Juffa). */ -int pop3(unsigned x) +static int pop3(unsigned x) { unsigned n; @@ -66,7 +73,7 @@ int pop3(unsigned x) return x >> 24; } -int pop4(unsigned x) +static int pop4(unsigned x) { int n; @@ -78,7 +85,7 @@ int pop4(unsigned x) return n; } -int pop5(unsigned x) +static int pop5(unsigned x) { int i, sum; @@ -92,7 +99,7 @@ int pop5(unsigned x) return -sum; // return sum; } -int pop5a(unsigned x) +static int pop5a(unsigned x) { int sum; @@ -106,7 +113,7 @@ int pop5a(unsigned x) return sum; } -int pop6(unsigned x) +static int pop6(unsigned x) { // Table lookup. static char table[256] = { 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, @@ -136,7 +143,7 @@ int pop6(unsigned x) } // The following works only for 8-bit quantities. -int pop7(unsigned x) +static int pop7(unsigned x) { x = x*0x08040201; // Make 4 copies. x = x >> 3; // So next step hits proper bits. @@ -147,7 +154,7 @@ int pop7(unsigned x) } // The following works only for 7-bit quantities. -int pop8(unsigned x) +static int pop8(unsigned x) { x = x*0x02040810; // Make 4 copies, left-adjusted. x = x & 0x11111111; // Every 4th bit. @@ -157,7 +164,7 @@ int pop8(unsigned x) } // The following works only for 15-bit quantities. -int pop9(unsigned x) +static int pop9(unsigned x) { unsigned long long y; y = x * 0x0002000400080010ULL; @@ -168,16 +175,19 @@ int pop9(unsigned x) } int errors; -void error(int x, int y) +static void error(int x, int y) { errors = errors + 1; std::printf("Error for x = %08x, got %08x\n", x, y); } +#if defined(_MSC_VER) +# pragma warning(push) +# pragma warning(disable: 4389) // nonstandard extension used : nameless struct/union +#endif + int main() { -# ifdef NDEBUG - int i, n; static unsigned test[] = {0,0, 1,1, 2,1, 3,2, 4,1, 5,2, 6,2, 7,3, 8,1, 9,2, 10,2, 11,3, 12,2, 13,3, 14,3, 15,4, 16,1, 17,2, @@ -286,6 +296,21 @@ int main() if (errors == 0) std::printf("Passed all %d cases.\n", static_cast(sizeof(test)/8)); +} + +#if defined(_MSC_VER) +# pragma warning(pop) +#endif -# endif//NDEBUG +#if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic pop +#endif + +#else + +int main() +{ + return 0; } + +#endif//NDEBUG diff --git a/test/core/core_func_integer_find_lsb.cpp b/test/core/core_func_integer_find_lsb.cpp index 0a3312f29c..4bc88f5408 100644 --- a/test/core/core_func_integer_find_lsb.cpp +++ b/test/core/core_func_integer_find_lsb.cpp @@ -3,19 +3,9 @@ #include //To define "exit", req'd by XLC. #include -int nlz(unsigned x) -{ - int pop(unsigned x); +#ifdef NDEBUG - x = x | (x >> 1); - x = x | (x >> 2); - x = x | (x >> 4); - x = x | (x >> 8); - x = x | (x >>16); - return pop(~x); -} - -int pop(unsigned x) +static int pop(unsigned x) { x = x - ((x >> 1) & 0x55555555); x = (x & 0x33333333) + ((x >> 2) & 0x33333333); @@ -25,17 +15,27 @@ int pop(unsigned x) return x >> 24; } -int ntz1(unsigned x) +static int nlz(unsigned x) +{ + x = x | (x >> 1); + x = x | (x >> 2); + x = x | (x >> 4); + x = x | (x >> 8); + x = x | (x >> 16); + return pop(~x); +} + +static int ntz1(unsigned x) { return 32 - nlz(~x & (x-1)); } -int ntz2(unsigned x) +static int ntz2(unsigned x) { return pop(~x & (x - 1)); } -int ntz3(unsigned x) +static int ntz3(unsigned x) { int n; @@ -48,7 +48,7 @@ int ntz3(unsigned x) return n - (x & 1); } -int ntz4(unsigned x) +static int ntz4(unsigned x) { unsigned y; int n; @@ -63,7 +63,7 @@ int ntz4(unsigned x) return n; } -int ntz4a(unsigned x) +static int ntz4a(unsigned x) { unsigned y; int n; @@ -78,7 +78,7 @@ int ntz4a(unsigned x) return n; } -int ntz5(char x) +static int ntz5(char x) { if (x & 15) { if (x & 3) { @@ -97,7 +97,7 @@ int ntz5(char x) else return 8; } -int ntz6(unsigned x) +static int ntz6(unsigned x) { int n; @@ -111,7 +111,7 @@ int ntz6(unsigned x) return n; // return n; } -int ntz6a(unsigned x) +static int ntz6a(unsigned x) { int n = 32; @@ -143,7 +143,7 @@ could then all run in parallel). */ # pragma warning(disable : 4146) #endif -int ntz7(unsigned x) +static int ntz7(unsigned x) { unsigned y, bz, b4, b3, b2, b1, b0; @@ -168,7 +168,7 @@ int ntz7(unsigned x) # pragma warning(disable : 4146) #endif -int ntz7_christophe(unsigned x) +static int ntz7_christophe(unsigned x) { unsigned y, bz, b4, b3, b2, b1, b0; @@ -188,7 +188,7 @@ entries marked "u" are unused. 6 ops including a multiply, plus an indexed load. */ #define u 99 -int ntz8(unsigned x) +static int ntz8(unsigned x) { static char table[64] = {32, 0, 1,12, 2, 6, u,13, 3, u, 7, u, u, u, u,14, @@ -203,7 +203,7 @@ int ntz8(unsigned x) /* Seal's algorithm with multiply expanded. 9 elementary ops plus an indexed load. */ -int ntz8a(unsigned x) +static int ntz8a(unsigned x) { static char table[64] = {32, 0, 1,12, 2, 6, u,13, 3, u, 7, u, u, u, u,14, @@ -221,7 +221,7 @@ int ntz8a(unsigned x) /* Reiser's algorithm. Three ops including a "remainder," plus an indexed load. */ -int ntz9(unsigned x) +static int ntz9(unsigned x) { static char table[37] = { 32, 0, 1, 26, 2, 23, 27, @@ -239,7 +239,7 @@ table. The de Bruijn sequence used here is obtained from Danny Dube's October 3, 1997, posting in comp.compression.research. Thanks to Norbert Juffa for this reference. */ -int ntz10(unsigned x) { +static int ntz10(unsigned x) { static char table[32] = { 0, 1, 2,24, 3,19, 6,25, 22, 4,20,10,16, 7,12,26, @@ -253,7 +253,7 @@ int ntz10(unsigned x) { /* Norbert Juffa's code, answer to exercise 1 of Chapter 5 (2nd ed). */ #define SLOW_MUL -int ntz11 (unsigned int n) { +static int ntz11(unsigned int n) { static unsigned char tab[32] = { 0, 1, 2, 24, 3, 19, 6, 25, @@ -280,15 +280,18 @@ int ntz11 (unsigned int n) { #endif int errors; -void error(int x, int y) { +static void error(int x, int y) { errors = errors + 1; std::printf("Error for x = %08x, got %d\n", x, y); } +#if defined(_MSC_VER) +# pragma warning(push) +# pragma warning(disable: 4389) // nonstandard extension used : nameless struct/union +#endif + int main() { -# ifdef NDEBUG - int i, m, n; static unsigned test[] = {0,32, 1,0, 2,1, 3,0, 4,2, 5,0, 6,1, 7,0, 8,3, 9,0, 16,4, 32,5, 64,6, 128,7, 255,0, 256,8, 512,9, 1024,10, @@ -424,8 +427,28 @@ int main() std::printf("ntz10: %d clocks\n", static_cast(TimestampEnd - TimestampBeg)); + TimestampBeg = std::clock(); + for (std::size_t k = 0; k < Count; ++k) + for (i = 0; i < n; i += 2) { + if (ntz11(test[i]) != test[i + 1]) error(test[i], ntz11(test[i])); + } + TimestampEnd = std::clock(); + + std::printf("ntz11: %d clocks\n", static_cast(TimestampEnd - TimestampBeg)); + if (errors == 0) std::printf("Passed all %d cases.\n", static_cast(sizeof(test)/8)); +} -# endif//NDEBUG +#if defined(_MSC_VER) +# pragma warning(pop) +#endif + +#else + +int main() +{ + return 0; } + +#endif//NDEBUG diff --git a/test/core/core_func_integer_find_msb.cpp b/test/core/core_func_integer_find_msb.cpp index 61bee61f09..08e3038901 100644 --- a/test/core/core_func_integer_find_msb.cpp +++ b/test/core/core_func_integer_find_msb.cpp @@ -3,9 +3,11 @@ #include // To define "exit", req'd by XLC. #include +#ifdef NDEBUG + #define LE 1 // 1 for little-endian, 0 for big-endian. -int pop(unsigned x) { +static int pop(unsigned x) { x = x - ((x >> 1) & 0x55555555); x = (x & 0x33333333) + ((x >> 2) & 0x33333333); x = (x + (x >> 4)) & 0x0F0F0F0F; @@ -14,7 +16,7 @@ int pop(unsigned x) { return x >> 24; } -int nlz1(unsigned x) { +static int nlz1(unsigned x) { int n; if (x == 0) return(32); @@ -27,7 +29,7 @@ int nlz1(unsigned x) { return n; } -int nlz1a(unsigned x) { +static int nlz1a(unsigned x) { int n; /* if (x == 0) return(32); */ @@ -42,7 +44,7 @@ int nlz1a(unsigned x) { } // On basic Risc, 12 to 20 instructions. -int nlz2(unsigned x) { +static int nlz2(unsigned x) { unsigned y; int n; @@ -57,7 +59,7 @@ int nlz2(unsigned x) { // As above but coded as a loop for compactness: // 23 to 33 basic Risc instructions. -int nlz2a(unsigned x) { +static int nlz2a(unsigned x) { unsigned y; int n, c; @@ -70,7 +72,7 @@ int nlz2a(unsigned x) { return n - x; } -int nlz3(int x) { +static int nlz3(int x) { int y, n; n = 0; @@ -88,7 +90,7 @@ L: if (x < 0) return n; # pragma warning(disable : 4146) #endif -int nlz4(unsigned x) { +static int nlz4(unsigned x) { int y, m, n; y = -(x >> 16); // If left half of x is 0, @@ -120,7 +122,7 @@ int nlz4(unsigned x) { # pragma warning(pop) #endif -int nlz5(unsigned x) { +static int nlz5(unsigned x) { int pop(unsigned x); x = x | (x >> 1); @@ -147,7 +149,7 @@ gcc/AIX, and gcc/NT, at some optimization levels. BTW, these programs use the "anonymous union" feature of C++, not available in C. */ -int nlz6(unsigned k) +static int nlz6(unsigned k) { union { unsigned asInt[2]; @@ -160,7 +162,7 @@ int nlz6(unsigned k) return n; } -int nlz7(unsigned k) +static int nlz7(unsigned k) { union { unsigned asInt[2]; @@ -183,7 +185,7 @@ int nlz7(unsigned k) FFFFFF80 <= k <= FFFFFFFF. For k = 0 it gives 158, and for the other values it is too low by 1. */ -int nlz8(unsigned k) +static int nlz8(unsigned k) { union { unsigned asInt; @@ -205,7 +207,7 @@ expressions (see "Using and Porting GNU CC", by Richard M. Stallman possibility that the macro argument will conflict with one of its local variables, e.g., NLZ(k). */ -int nlz9(unsigned k) +static int nlz9(unsigned k) { union { unsigned asInt; @@ -239,7 +241,7 @@ multiplication expanded into shifts and adds, but the table size is getting a bit large). */ #define u 99 -int nlz10(unsigned x) +static int nlz10(unsigned x) { static char table[64] = {32,31, u,16, u,30, 3, u, 15, u, u, u,29,10, 2, u, @@ -259,7 +261,7 @@ int nlz10(unsigned x) /* Harley's algorithm with multiply expanded. 19 elementary ops plus an indexed load. */ -int nlz10a(unsigned x) +static int nlz10a(unsigned x) { static char table[64] = {32,31, u,16, u,30, 3, u, 15, u, u, u,29,10, 2, u, @@ -283,7 +285,7 @@ int nlz10a(unsigned x) 17 elementary ops plus an indexed load, if the machine has "and not." */ -int nlz10b(unsigned x) +static int nlz10b(unsigned x) { static char table[64] = {32,20,19, u, u,18, u, 7, 10,17, u, u,14, u, 6, u, @@ -304,16 +306,19 @@ int nlz10b(unsigned x) } int errors; -void error(int x, int y) +static void error(int x, int y) { errors = errors + 1; std::printf("Error for x = %08x, got %d\n", x, y); } +#if defined(_MSC_VER) +# pragma warning(push) +# pragma warning(disable: 4389) // nonstandard extension used : nameless struct/union +#endif + int main() { -# ifdef NDEBUG - int i, n; static unsigned test[] = {0,32, 1,31, 2,30, 3,30, 4,29, 5,29, 6,29, 7,29, 8,28, 9,28, 16,27, 32,26, 64,25, 128,24, 255,24, 256,23, @@ -444,6 +449,17 @@ int main() if (errors == 0) std::printf("Passed all %d cases.\n", static_cast(sizeof(test)/8)); +} -# endif//NDEBUG +#if defined(_MSC_VER) +# pragma warning(pop) +#endif + +#else + +int main() +{ + return 0; } + +#endif//NDEBUG diff --git a/test/core/core_func_matrix.cpp b/test/core/core_func_matrix.cpp index b66ee7d66b..c96fc08850 100644 --- a/test/core/core_func_matrix.cpp +++ b/test/core/core_func_matrix.cpp @@ -16,7 +16,7 @@ using namespace glm; -int test_matrixCompMult() +static int test_matrixCompMult() { int Error(0); @@ -86,25 +86,50 @@ int test_matrixCompMult() return Error; } -int test_outerProduct() +static int test_outerProduct() { - { glm::mat2 m = glm::outerProduct(glm::vec2(1.0f), glm::vec2(1.0f)); } - { glm::mat3 m = glm::outerProduct(glm::vec3(1.0f), glm::vec3(1.0f)); } - { glm::mat4 m = glm::outerProduct(glm::vec4(1.0f), glm::vec4(1.0f)); } + int Error = 0; - { glm::mat2x3 m = glm::outerProduct(glm::vec3(1.0f), glm::vec2(1.0f)); } - { glm::mat2x4 m = glm::outerProduct(glm::vec4(1.0f), glm::vec2(1.0f)); } + glm::mat2 m0 = glm::outerProduct(glm::vec2(1.0f), glm::vec2(1.0f)); + glm::mat2 n0(1, 1, 1, 1); + Error += all(equal(m0, n0, epsilon())) ? 0 : 1; - { glm::mat3x2 m = glm::outerProduct(glm::vec2(1.0f), glm::vec3(1.0f)); } - { glm::mat3x4 m = glm::outerProduct(glm::vec4(1.0f), glm::vec3(1.0f)); } - - { glm::mat4x2 m = glm::outerProduct(glm::vec2(1.0f), glm::vec4(1.0f)); } - { glm::mat4x3 m = glm::outerProduct(glm::vec3(1.0f), glm::vec4(1.0f)); } + glm::mat3 m1 = glm::outerProduct(glm::vec3(1.0f), glm::vec3(1.0f)); + glm::mat3 n1(1, 1, 1, 1, 1, 1, 1, 1, 1); + Error += all(equal(m1, n1, epsilon())) ? 0 : 1; - return 0; + glm::mat4 m2 = glm::outerProduct(glm::vec4(1.0f), glm::vec4(1.0f)); + glm::mat4 n2(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); + Error += all(equal(m2, n2, epsilon())) ? 0 : 1; + + glm::mat2x3 m3 = glm::outerProduct(glm::vec3(1.0f), glm::vec2(1.0f)); + glm::mat2x3 n3(1, 1, 1, 1, 1, 1); + Error += all(equal(m3, n3, epsilon())) ? 0 : 1; + + glm::mat2x4 m4 = glm::outerProduct(glm::vec4(1.0f), glm::vec2(1.0f)); + glm::mat2x4 n4(1, 1, 1, 1, 1, 1, 1, 1); + Error += all(equal(m4, n4, epsilon())) ? 0 : 1; + + glm::mat3x2 m5 = glm::outerProduct(glm::vec2(1.0f), glm::vec3(1.0f)); + glm::mat3x2 n5(1, 1, 1, 1, 1, 1); + Error += all(equal(m5, n5, epsilon())) ? 0 : 1; + + glm::mat3x4 m6 = glm::outerProduct(glm::vec4(1.0f), glm::vec3(1.0f)); + glm::mat3x4 n6(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); + Error += all(equal(m6, n6, epsilon())) ? 0 : 1; + + glm::mat4x2 m7 = glm::outerProduct(glm::vec2(1.0f), glm::vec4(1.0f)); + glm::mat4x2 n7(1, 1, 1, 1, 1, 1, 1, 1); + Error += all(equal(m7, n7, epsilon())) ? 0 : 1; + + glm::mat4x3 m8 = glm::outerProduct(glm::vec3(1.0f), glm::vec4(1.0f)); + glm::mat4x3 n8(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); + Error += all(equal(m8, n8, epsilon())) ? 0 : 1; + + return Error; } -int test_transpose() +static int test_transpose() { int Error(0); @@ -174,14 +199,14 @@ int test_transpose() return Error; } -int test_determinant() +static int test_determinant() { return 0; } -int test_inverse() +static int test_inverse() { int Error = 0; @@ -221,7 +246,7 @@ int test_inverse() return Error; } -int test_inverse_simd() +static int test_inverse_simd() { int Error = 0; @@ -240,7 +265,7 @@ int test_inverse_simd() return Error; } -int test_shearing() +static int test_shearing() { int Error = 0; @@ -320,7 +345,7 @@ int test_shearing() } template -int test_inverse_perf(std::size_t Count, std::size_t Instance, char const * Message) +static int test_inverse_perf(std::size_t Count, std::size_t Instance, char const * Message) { std::vector TestInputs; TestInputs.resize(Count); diff --git a/test/core/core_func_packing.cpp b/test/core/core_func_packing.cpp index c3cd14a205..8ec51fd47d 100644 --- a/test/core/core_func_packing.cpp +++ b/test/core/core_func_packing.cpp @@ -4,7 +4,7 @@ #include #include -int test_packUnorm2x16() +static int test_packUnorm2x16() { int Error = 0; @@ -25,7 +25,7 @@ int test_packUnorm2x16() return Error; } -int test_packSnorm2x16() +static int test_packSnorm2x16() { int Error = 0; @@ -46,7 +46,7 @@ int test_packSnorm2x16() return Error; } -int test_packUnorm4x8() +static int test_packUnorm4x8() { int Error = 0; @@ -72,7 +72,7 @@ int test_packUnorm4x8() return Error; } -int test_packSnorm4x8() +static int test_packSnorm4x8() { int Error = 0; @@ -92,7 +92,7 @@ int test_packSnorm4x8() return Error; } -int test_packHalf2x16() +static int test_packHalf2x16() { int Error = 0; /* @@ -119,7 +119,7 @@ int test_packHalf2x16() return Error; } -int test_packDouble2x32() +static int test_packDouble2x32() { int Error = 0; diff --git a/test/core/core_func_swizzle.cpp b/test/core/core_func_swizzle.cpp index 9758533f9d..f7ab67801d 100644 --- a/test/core/core_func_swizzle.cpp +++ b/test/core/core_func_swizzle.cpp @@ -44,7 +44,7 @@ static int test_ivec2_swizzle() return Error; } -int test_ivec3_swizzle() +static int test_ivec3_swizzle() { int Error = 0; @@ -109,7 +109,7 @@ int test_ivec3_swizzle() return Error; } -int test_ivec4_swizzle() +static int test_ivec4_swizzle() { int Error = 0; @@ -127,7 +127,7 @@ int test_ivec4_swizzle() return Error; } -int test_vec4_swizzle() +static int test_vec4_swizzle() { int Error = 0; diff --git a/test/core/core_setup_message.cpp b/test/core/core_setup_message.cpp index 0c7f6a2ec2..fc4cb8a2d4 100644 --- a/test/core/core_setup_message.cpp +++ b/test/core/core_setup_message.cpp @@ -2,7 +2,7 @@ #include #include -int test_compiler() +static int test_compiler() { int Error(0); @@ -220,7 +220,7 @@ int test_compiler() return Error; } -int test_model() +static int test_model() { int Error = 0; @@ -235,7 +235,7 @@ int test_model() return Error; } -int test_instruction_set() +static int test_instruction_set() { int Error = 0; @@ -266,14 +266,14 @@ int test_instruction_set() return Error; } -int test_cpp_version() +static int test_cpp_version() { std::printf("__cplusplus: %d\n", static_cast(__cplusplus)); return 0; } -int test_operators() +static int test_operators() { glm::ivec3 A(1); glm::ivec3 B(1); diff --git a/test/core/core_setup_platform_unknown.cpp b/test/core/core_setup_platform_unknown.cpp index 9feaee3943..6429a0a54c 100644 --- a/test/core/core_setup_platform_unknown.cpp +++ b/test/core/core_setup_platform_unknown.cpp @@ -10,9 +10,33 @@ #ifndef GLM_FORCE_CXX_UNKNOWN # define GLM_FORCE_CXX_UNKNOWN #endif + +#if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wgnu-anonymous-struct" +# pragma clang diagnostic ignored "-Wnested-anon-types" +# pragma clang diagnostic ignored "-Wsign-conversion" +# pragma clang diagnostic ignored "-Wpadded" +# pragma clang diagnostic ignored "-Wc++11-long-long" +#elif defined(__GNUC__) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wpedantic" +#elif defined(_MSC_VER) +# pragma warning(push) +# pragma warning(disable: 4201) // nonstandard extension used : nameless struct/union +#endif + #include #include +#if defined(__clang__) +# pragma clang diagnostic pop +#elif defined(__GNUC__) +# pragma GCC diagnostic pop +#elif defined(_MSC_VER) +# pragma warning(pop) +#endif + int main() { int Error = 0; diff --git a/test/core/core_type_cast.cpp b/test/core/core_type_cast.cpp index 7ff1901e1a..0f136ac432 100644 --- a/test/core/core_type_cast.cpp +++ b/test/core/core_type_cast.cpp @@ -11,33 +11,41 @@ struct my_vec2 float x, y; }; -int test_vec2_cast() +static int test_vec2_cast() { + int Error(0); + glm::vec2 A(1.0f, 2.0f); glm::lowp_vec2 B(A); glm::mediump_vec2 C(A); glm::highp_vec2 D(A); - + glm::vec2 E = static_cast(A); glm::lowp_vec2 F = static_cast(A); glm::mediump_vec2 G = static_cast(A); glm::highp_vec2 H = static_cast(A); - - my_vec2 I; - glm::vec2 J = static_cast(I); - glm::vec2 K(7.8f); - int Error(0); - Error += glm::all(glm::equal(A, E, glm::epsilon())) ? 0 : 1; Error += glm::all(glm::equal(B, F, glm::epsilon())) ? 0 : 1; Error += glm::all(glm::equal(C, G, glm::epsilon())) ? 0 : 1; Error += glm::all(glm::equal(D, H, glm::epsilon())) ? 0 : 1; - + + my_vec2 I; + I.x = 1.0f; + I.y = 2.0f; + glm::vec2 J0 = static_cast(I); + glm::vec2 J1(1.0f, 2.0f); + + Error += glm::all(glm::equal(J1, J0, glm::epsilon())) ? 0 : 1; + + glm::vec2 K(7.8f); + glm::vec2 L(7.8f, 7.8f); + Error += glm::all(glm::equal(K, L, glm::epsilon())) ? 0 : 1; + return Error; } -int test_vec3_cast() +static int test_vec3_cast() { glm::vec3 A(1.0f, 2.0f, 3.0f); glm::lowp_vec3 B(A); @@ -59,7 +67,7 @@ int test_vec3_cast() return Error; } -int test_vec4_cast() +static int test_vec4_cast() { glm::vec4 A(1.0f, 2.0f, 3.0f, 4.0f); glm::lowp_vec4 B(A); @@ -81,7 +89,7 @@ int test_vec4_cast() return Error; } -int test_std_copy() +static int test_std_copy() { int Error = 0; diff --git a/test/core/core_type_mat2x2.cpp b/test/core/core_type_mat2x2.cpp index 2f8b018f69..ac1d876b44 100644 --- a/test/core/core_type_mat2x2.cpp +++ b/test/core/core_type_mat2x2.cpp @@ -15,26 +15,42 @@ #include #include -int test_operators() +static int test_operators() { + int Error = 0; + glm::mat2x2 l(1.0f); glm::mat2x2 m(1.0f); glm::vec2 u(1.0f); glm::vec2 v(1.0f); float x = 1.0f; + glm::vec2 a = m * u; + Error += glm::all(glm::equal(a, glm::vec2(1.0f), glm::epsilon())) ? 0 : 1; + glm::vec2 b = v * m; - glm::mat2x2 n = x / m; + Error += glm::all(glm::equal(b, glm::vec2(1.0f), glm::epsilon())) ? 0 : 1; + + glm::mat2x2 n0(1.0f, 1.0f, 1.0f, 1.0f); + glm::mat2x2 n = x / n0; + Error += glm::all(glm::equal(n, n0, glm::epsilon())) ? 0 : 1; + glm::mat2x2 o = m / x; + Error += glm::all(glm::equal(o, m, glm::epsilon())) ? 0 : 1; + glm::mat2x2 p = x * m; + Error += glm::all(glm::equal(p, m, glm::epsilon())) ? 0 : 1; + glm::mat2x2 q = m * x; bool R = glm::any(glm::notEqual(m, q, glm::epsilon())); bool S = glm::all(glm::equal(m, l, glm::epsilon())); - return (S && !R) ? 0 : 1; + Error += (S && !R) ? 0 : 1; + + return Error; } -int test_inverse() +static int test_inverse() { int Error(0); @@ -58,7 +74,7 @@ int test_inverse() return Error; } -int test_ctr() +static int test_ctr() { int Error = 0; @@ -108,7 +124,7 @@ int test_ctr() namespace cast { template - int entry() + static int entry() { int Error = 0; @@ -121,7 +137,7 @@ namespace cast return Error; } - int test() + static int test() { int Error = 0; @@ -139,7 +155,7 @@ namespace cast } }//namespace cast -int test_size() +static int test_size() { int Error = 0; @@ -153,7 +169,7 @@ int test_size() return Error; } -int test_constexpr() +static int test_constexpr() { #if GLM_HAS_CONSTEXPR static_assert(glm::mat2x2::length() == 2, "GLM: Failed constexpr"); diff --git a/test/core/core_type_mat2x3.cpp b/test/core/core_type_mat2x3.cpp index e3ad76bbca..0e9737df39 100644 --- a/test/core/core_type_mat2x3.cpp +++ b/test/core/core_type_mat2x3.cpp @@ -15,24 +15,40 @@ static int test_operators() { + int Error = 0; + glm::mat2x3 l(1.0f); glm::mat2x3 m(1.0f); glm::vec2 u(1.0f); glm::vec3 v(1.0f); + float x = 1.0f; glm::vec3 a = m * u; + Error += glm::all(glm::equal(a, glm::vec3(u, 0.0f), glm::epsilon())) ? 0 : 1; + glm::vec2 b = v * m; - glm::mat2x3 n = x / m; + Error += glm::all(glm::equal(b, glm::vec2(1.0f), glm::epsilon())) ? 0 : 1; + + glm::mat2x3 n0(1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f); + glm::mat2x3 n = x / n0; + Error += glm::all(glm::equal(n, n0, glm::epsilon())) ? 0 : 1; + glm::mat2x3 o = m / x; + Error += glm::all(glm::equal(o, m, glm::epsilon())) ? 0 : 1; + glm::mat2x3 p = x * m; + Error += glm::all(glm::equal(p, m, glm::epsilon())) ? 0 : 1; + glm::mat2x3 q = m * x; bool R = glm::any(glm::notEqual(m, q, glm::epsilon())); bool S = glm::all(glm::equal(m, l, glm::epsilon())); - return (S && !R) ? 0 : 1; + Error += (S && !R) ? 0 : 1; + + return Error; } -int test_ctr() +static int test_ctr() { int Error(0); @@ -74,7 +90,7 @@ int test_ctr() namespace cast { template - int entry() + static int entry() { int Error = 0; @@ -87,7 +103,7 @@ namespace cast return Error; } - int test() + static int test() { int Error = 0; @@ -105,7 +121,7 @@ namespace cast } }//namespace cast -int test_size() +static int test_size() { int Error = 0; @@ -119,7 +135,7 @@ int test_size() return Error; } -int test_constexpr() +static int test_constexpr() { #if GLM_HAS_CONSTEXPR static_assert(glm::mat2x3::length() == 2, "GLM: Failed constexpr"); diff --git a/test/core/core_type_mat2x4.cpp b/test/core/core_type_mat2x4.cpp index ade3a44441..623f03daa7 100644 --- a/test/core/core_type_mat2x4.cpp +++ b/test/core/core_type_mat2x4.cpp @@ -16,24 +16,40 @@ static int test_operators() { + int Error = 0; + glm::mat2x4 l(1.0f); glm::mat2x4 m(1.0f); glm::vec2 u(1.0f); glm::vec4 v(1.0f); + float x = 1.0f; glm::vec4 a = m * u; + Error += glm::all(glm::equal(a, glm::vec4(u, 0.0f, 0.0f), glm::epsilon())) ? 0 : 1; + glm::vec2 b = v * m; - glm::mat2x4 n = x / m; + Error += glm::all(glm::equal(b, glm::vec2(1.0f), glm::epsilon())) ? 0 : 1; + + glm::mat2x4 n0(1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f); + glm::mat2x4 n = x / n0; + Error += glm::all(glm::equal(n, n0, glm::epsilon())) ? 0 : 1; + glm::mat2x4 o = m / x; + Error += glm::all(glm::equal(o, m, glm::epsilon())) ? 0 : 1; + glm::mat2x4 p = x * m; + Error += glm::all(glm::equal(p, m, glm::epsilon())) ? 0 : 1; + glm::mat2x4 q = m * x; bool R = glm::any(glm::notEqual(m, q, glm::epsilon())); bool S = glm::all(glm::equal(m, l, glm::epsilon())); - return (S && !R) ? 0 : 1; + Error += (S && !R) ? 0 : 1; + + return Error; } -int test_ctr() +static int test_ctr() { int Error(0); @@ -75,7 +91,7 @@ int test_ctr() namespace cast { template - int entry() + static int entry() { int Error = 0; @@ -89,7 +105,7 @@ namespace cast return Error; } - int test() + static int test() { int Error = 0; diff --git a/test/core/core_type_mat3x2.cpp b/test/core/core_type_mat3x2.cpp index 7a40f90f88..a11a4b2177 100644 --- a/test/core/core_type_mat3x2.cpp +++ b/test/core/core_type_mat3x2.cpp @@ -13,26 +13,42 @@ #include #include -static bool test_operators() +static int test_operators() { + int Error = 0; + glm::mat3x2 l(1.0f); glm::mat3x2 m(1.0f); glm::vec3 u(1.0f); glm::vec2 v(1.0f); + float x = 1.0f; glm::vec2 a = m * u; + Error += glm::all(glm::equal(a, glm::vec2(1.0f), glm::epsilon())) ? 0 : 1; + glm::vec3 b = v * m; - glm::mat3x2 n = x / m; + Error += glm::all(glm::equal(b, glm::vec3(v, 0.0f), glm::epsilon())) ? 0 : 1; + + glm::mat3x2 n0(1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f); + glm::mat3x2 n = x / n0; + Error += glm::all(glm::equal(n, n0, glm::epsilon())) ? 0 : 1; + glm::mat3x2 o = m / x; + Error += glm::all(glm::equal(o, m, glm::epsilon())) ? 0 : 1; + glm::mat3x2 p = x * m; + Error += glm::all(glm::equal(p, m, glm::epsilon())) ? 0 : 1; + glm::mat3x2 q = m * x; bool R = glm::any(glm::notEqual(m, q, glm::epsilon())); bool S = glm::all(glm::equal(m, l, glm::epsilon())); - return (S && !R) ? 0 : 1; + Error += (S && !R) ? 0 : 1; + + return Error; } -int test_ctr() +static int test_ctr() { int Error(0); @@ -78,7 +94,7 @@ int test_ctr() namespace cast { template - int entry() + static int entry() { int Error = 0; @@ -91,7 +107,7 @@ namespace cast return Error; } - int test() + static int test() { int Error = 0; diff --git a/test/core/core_type_mat3x3.cpp b/test/core/core_type_mat3x3.cpp index 99e1f41e06..d79ffeedc0 100644 --- a/test/core/core_type_mat3x3.cpp +++ b/test/core/core_type_mat3x3.cpp @@ -29,21 +29,37 @@ static int test_mat3x3() static int test_operators() { + int Error = 0; + glm::mat3x3 l(1.0f); glm::mat3x3 m(1.0f); glm::vec3 u(1.0f); glm::vec3 v(1.0f); + float x = 1.0f; glm::vec3 a = m * u; + Error += glm::all(glm::equal(a, glm::vec3(1.0f), glm::epsilon())) ? 0 : 1; + glm::vec3 b = v * m; - glm::mat3x3 n = x / m; + Error += glm::all(glm::equal(b, glm::vec3(1.0f), glm::epsilon())) ? 0 : 1; + + glm::mat3x3 n0(1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f); + glm::mat3x3 n = x / n0; + Error += glm::all(glm::equal(n, n0, glm::epsilon())) ? 0 : 1; + glm::mat3x3 o = m / x; + Error += glm::all(glm::equal(o, m, glm::epsilon())) ? 0 : 1; + glm::mat3x3 p = x * m; + Error += glm::all(glm::equal(p, m, glm::epsilon())) ? 0 : 1; + glm::mat3x3 q = m * x; bool R = glm::any(glm::notEqual(m, q, glm::epsilon())); bool S = glm::all(glm::equal(m, l, glm::epsilon())); - return (S && !R) ? 0 : 1; + Error += (S && !R) ? 0 : 1; + + return Error; } static int test_inverse() @@ -124,7 +140,7 @@ static int test_ctr() namespace cast { template - int entry() + static int entry() { int Error = 0; @@ -137,7 +153,7 @@ namespace cast return Error; } - int test() + static int test() { int Error = 0; diff --git a/test/core/core_type_mat3x4.cpp b/test/core/core_type_mat3x4.cpp index 97d4574641..75a3addde0 100644 --- a/test/core/core_type_mat3x4.cpp +++ b/test/core/core_type_mat3x4.cpp @@ -14,26 +14,42 @@ #include #include -static bool test_operators() +static int test_operators() { + int Error = 0; + glm::mat3x4 l(1.0f); glm::mat3x4 m(1.0f); glm::vec3 u(1.0f); glm::vec4 v(1.0f); + float x = 1.0f; glm::vec4 a = m * u; + Error += glm::all(glm::equal(a, glm::vec4(u, 0.0f), glm::epsilon())) ? 0 : 1; + glm::vec3 b = v * m; - glm::mat3x4 n = x / m; + Error += glm::all(glm::equal(b, glm::vec3(1.0f), glm::epsilon())) ? 0 : 1; + + glm::mat3x4 n0(1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f); + glm::mat3x4 n = x / n0; + Error += glm::all(glm::equal(n, n0, glm::epsilon())) ? 0 : 1; + glm::mat3x4 o = m / x; + Error += glm::all(glm::equal(o, m, glm::epsilon())) ? 0 : 1; + glm::mat3x4 p = x * m; + Error += glm::all(glm::equal(p, m, glm::epsilon())) ? 0 : 1; + glm::mat3x4 q = m * x; bool R = glm::any(glm::notEqual(m, q, glm::epsilon())); bool S = glm::all(glm::equal(m, l, glm::epsilon())); - return (S && !R) ? 0 : 1; + Error += (S && !R) ? 0 : 1; + + return Error; } -int test_ctr() +static int test_ctr() { int Error(0); @@ -79,7 +95,7 @@ int test_ctr() namespace cast { template - int entry() + static int entry() { int Error = 0; @@ -93,7 +109,7 @@ namespace cast return Error; } - int test() + static int test() { int Error = 0; diff --git a/test/core/core_type_mat4x2.cpp b/test/core/core_type_mat4x2.cpp index 7133edc812..89407f634d 100644 --- a/test/core/core_type_mat4x2.cpp +++ b/test/core/core_type_mat4x2.cpp @@ -15,24 +15,40 @@ static int test_operators() { + int Error = 0; + glm::mat4x2 l(1.0f); glm::mat4x2 m(1.0f); glm::vec4 u(1.0f); glm::vec2 v(1.0f); + float x = 1.0f; glm::vec2 a = m * u; + Error += glm::all(glm::equal(a, glm::vec2(1.0f), glm::epsilon())) ? 0 : 1; + glm::vec4 b = v * m; - glm::mat4x2 n = x / m; + Error += glm::all(glm::equal(b, glm::vec4(v, 0.0f, 0.0f), glm::epsilon())) ? 0 : 1; + + glm::mat4x2 n0(1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f); + glm::mat4x2 n = x / n0; + Error += glm::all(glm::equal(n, n0, glm::epsilon())) ? 0 : 1; + glm::mat4x2 o = m / x; + Error += glm::all(glm::equal(o, m, glm::epsilon())) ? 0 : 1; + glm::mat4x2 p = x * m; + Error += glm::all(glm::equal(p, m, glm::epsilon())) ? 0 : 1; + glm::mat4x2 q = m * x; bool R = glm::any(glm::notEqual(m, q, glm::epsilon())); bool S = glm::all(glm::equal(m, l, glm::epsilon())); - return (S && !R) ? 0 : 1; + Error += (S && !R) ? 0 : 1; + + return Error; } -int test_ctr() +static int test_ctr() { int Error(0); @@ -82,7 +98,7 @@ int test_ctr() namespace cast { template - int entry() + static int entry() { int Error = 0; @@ -95,7 +111,7 @@ namespace cast return Error; } - int test() + static int test() { int Error = 0; diff --git a/test/core/core_type_mat4x3.cpp b/test/core/core_type_mat4x3.cpp index 1c65e7f3ff..36b8e09802 100644 --- a/test/core/core_type_mat4x3.cpp +++ b/test/core/core_type_mat4x3.cpp @@ -15,24 +15,40 @@ static int test_operators() { + int Error = 0; + glm::mat4x3 l(1.0f); glm::mat4x3 m(1.0f); glm::vec4 u(1.0f); glm::vec3 v(1.0f); + float x = 1.0f; glm::vec3 a = m * u; + Error += glm::all(glm::equal(a, glm::vec3(1.0f), glm::epsilon())) ? 0 : 1; + glm::vec4 b = v * m; - glm::mat4x3 n = x / m; + Error += glm::all(glm::equal(b, glm::vec4(v, 0.0f), glm::epsilon())) ? 0 : 1; + + glm::mat4x3 n0(1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f); + glm::mat4x3 n = x / n0; + Error += glm::all(glm::equal(n, n0, glm::epsilon())) ? 0 : 1; + glm::mat4x3 o = m / x; + Error += glm::all(glm::equal(o, m, glm::epsilon())) ? 0 : 1; + glm::mat4x3 p = x * m; + Error += glm::all(glm::equal(p, m, glm::epsilon())) ? 0 : 1; + glm::mat4x3 q = m * x; bool R = glm::any(glm::notEqual(m, q, glm::epsilon())); bool S = glm::all(glm::equal(m, l, glm::epsilon())); - return (S && !R) ? 0 : 1; + Error += (S && !R) ? 0 : 1; + + return Error; } -int test_ctr() +static int test_ctr() { int Error(0); @@ -82,7 +98,7 @@ int test_ctr() namespace cast { template - int entry() + static int entry() { int Error = 0; @@ -95,7 +111,7 @@ namespace cast return Error; } - int test() + static int test() { int Error = 0; diff --git a/test/core/core_type_vec1.cpp b/test/core/core_type_vec1.cpp index 77f3f84d78..f3cd026b10 100644 --- a/test/core/core_type_vec1.cpp +++ b/test/core/core_type_vec1.cpp @@ -5,10 +5,19 @@ #include #include +#if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wglobal-constructors" +#endif + static glm::vec1 g1; static glm::vec1 g2(1); -int test_vec1_operators() +#if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic pop +#endif + +static int test_operators() { int Error = 0; @@ -36,7 +45,7 @@ int test_vec1_operators() return Error; } -int test_vec1_ctor() +static int test_ctor() { int Error = 0; @@ -72,18 +81,28 @@ int test_vec1_ctor() */ { - glm::vec2 A = glm::vec2(2.0f); - glm::vec2 B = glm::vec2(2.0f, 3.0f); - glm::vec2 C = glm::vec2(2.0f, 3.0); - //glm::vec2 D = glm::dvec2(2.0); // Build error TODO: What does the specification says? - glm::vec2 E(glm::dvec2(2.0)); - glm::vec2 F(glm::ivec2(2)); + glm::vec1 A = glm::vec2(2.0f); + Error += glm::all(glm::equal(A, glm::vec1(2.0f), glm::epsilon())) ? 0 : 1; + + glm::vec1 B = glm::vec2(2.0f, 3.0f); + Error += glm::all(glm::equal(B, glm::vec1(2.0f), glm::epsilon())) ? 0 : 1; + + glm::vec1 C = glm::vec2(2.0f, 3.0); + Error += glm::all(glm::equal(C, glm::vec1(2.0f), glm::epsilon())) ? 0 : 1; + + //glm::vec1 D = glm::dvec1(2.0); // Build error TODO: What does the specification says? + + glm::vec1 E(glm::dvec2(2.0)); + Error += glm::all(glm::equal(E, glm::vec1(2.0f), glm::epsilon())) ? 0 : 1; + + glm::vec1 F(glm::ivec2(2)); + Error += glm::all(glm::equal(F, glm::vec1(2.0f), glm::epsilon())) ? 0 : 1; } return Error; } -static int test_vec1_size() +static int test_size() { int Error = 0; @@ -99,7 +118,7 @@ static int test_vec1_size() return Error; } -static int test_vec1_operator_increment() +static int test_operator_increment() { int Error(0); @@ -158,10 +177,10 @@ int main() { int Error = 0; - Error += test_vec1_size(); - Error += test_vec1_ctor(); - Error += test_vec1_operators(); - Error += test_vec1_operator_increment(); + Error += test_size(); + Error += test_ctor(); + Error += test_operators(); + Error += test_operator_increment(); Error += test_swizzle(); Error += test_constexpr(); diff --git a/test/core/core_type_vec2.cpp b/test/core/core_type_vec2.cpp index 308c61f0dd..c82174a220 100644 --- a/test/core/core_type_vec2.cpp +++ b/test/core/core_type_vec2.cpp @@ -10,10 +10,19 @@ # include #endif +#if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wglobal-constructors" +#endif + static glm::ivec2 g1; static glm::ivec2 g2(1); static glm::ivec2 g3(1, 1); +#if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic pop +#endif + static int test_operators() { int Error = 0; @@ -240,11 +249,22 @@ static int test_ctor() { glm::vec2 A = glm::vec2(2.0f); + Error += glm::all(glm::equal(A, glm::vec2(2.0f), glm::epsilon())) ? 0 : 1; + glm::vec2 B = glm::vec2(2.0f, 3.0f); + Error += glm::all(glm::equal(B, glm::vec2(2.0f, 3.0f), glm::epsilon())) ? 0 : 1; + glm::vec2 C = glm::vec2(2.0f, 3.0); + Error += glm::all(glm::equal(C, glm::vec2(2.0f, 3.0f), glm::epsilon())) ? 0 : 1; + //glm::vec2 D = glm::dvec2(2.0); // Build error TODO: What does the specification says? + + glm::vec2 E(glm::dvec2(2.0)); + Error += glm::all(glm::equal(E, glm::vec2(2.0f), glm::epsilon())) ? 0 : 1; + glm::vec2 F(glm::ivec2(2)); + Error += glm::all(glm::equal(F, glm::vec2(2.0f), glm::epsilon())) ? 0 : 1; } { @@ -301,7 +321,7 @@ static int test_size() Error += glm::vec2::length() == 2 ? 0 : 1; Error += glm::dvec2::length() == 2 ? 0 : 1; - GLM_CONSTEXPR std::size_t Length = glm::vec2::length(); + GLM_CONSTEXPR glm::length_t Length = glm::vec2::length(); Error += Length == 2 ? 0 : 1; return Error; diff --git a/test/core/core_type_vec3.cpp b/test/core/core_type_vec3.cpp index 4da8187db9..af7eeee47e 100644 --- a/test/core/core_type_vec3.cpp +++ b/test/core/core_type_vec3.cpp @@ -9,11 +9,20 @@ #include #include +#if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wglobal-constructors" +#endif + static glm::vec3 g1; static glm::vec3 g2(1); static glm::vec3 g3(1, 1, 1); -int test_vec3_ctor() +#if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic pop +#endif + +static int test_vec3_ctor() { int Error = 0; @@ -125,13 +134,6 @@ int test_vec3_ctor() return Error; } -float foo() -{ - glm::vec3 bar = glm::vec3(0.0f, 1.0f, 1.0f); - - return glm::length(bar); -} - static int test_bvec3_ctor() { int Error = 0; @@ -291,7 +293,7 @@ static int test_vec3_operators() return Error; } -int test_vec3_size() +static int test_vec3_size() { int Error = 0; @@ -308,13 +310,13 @@ int test_vec3_size() Error += glm::vec3::length() == 3 ? 0 : 1; Error += glm::dvec3::length() == 3 ? 0 : 1; - GLM_CONSTEXPR std::size_t Length = glm::vec3::length(); + GLM_CONSTEXPR glm::length_t Length = glm::vec3::length(); Error += Length == 3 ? 0 : 1; return Error; } -int test_vec3_swizzle3_2() +static int test_vec3_swizzle3_2() { int Error = 0; @@ -378,7 +380,7 @@ int test_vec3_swizzle3_2() return Error; } -int test_vec3_swizzle3_3() +static int test_vec3_swizzle3_3() { int Error = 0; @@ -406,15 +408,15 @@ int test_vec3_swizzle3_3() return Error; } -int test_vec3_swizzle_operators() +static int test_vec3_swizzle_operators() { int Error = 0; - glm::ivec3 const u = glm::ivec3(1, 2, 3); - glm::ivec3 const v = glm::ivec3(10, 20, 30); - # if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR { + glm::ivec3 const u = glm::ivec3(1, 2, 3); + glm::ivec3 const v = glm::ivec3(10, 20, 30); + glm::ivec3 q; // Swizzle, swizzle binary operators @@ -448,7 +450,7 @@ int test_vec3_swizzle_operators() return Error; } -int test_vec3_swizzle_functions() +static int test_vec3_swizzle_functions() { int Error = 0; @@ -491,7 +493,7 @@ int test_vec3_swizzle_functions() return Error; } -int test_vec3_swizzle_partial() +static int test_vec3_swizzle_partial() { int Error = 0; diff --git a/test/core/core_type_vec4.cpp b/test/core/core_type_vec4.cpp index 5d65259f57..27daea6980 100644 --- a/test/core/core_type_vec4.cpp +++ b/test/core/core_type_vec4.cpp @@ -11,10 +11,19 @@ #include #include +#if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wglobal-constructors" +#endif + static glm::vec4 g1; static glm::vec4 g2(1); static glm::vec4 g3(1, 1, 1, 1); +#if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic pop +#endif + template struct mask { @@ -484,9 +493,9 @@ static int test_swizzle_partial() { int Error = 0; +# if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR glm::vec4 const A(1, 2, 3, 4); -# if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR { glm::vec4 B(A.xy, A.zw); Error += glm::all(glm::equal(A, B, glm::epsilon())) ? 0 : 1; diff --git a/test/ext/ext_matrix_common.cpp b/test/ext/ext_matrix_common.cpp index 2cf1da2640..3a10147ef6 100644 --- a/test/ext/ext_matrix_common.cpp +++ b/test/ext/ext_matrix_common.cpp @@ -66,10 +66,10 @@ static int test_abs() ); glm::mat4 C = glm::matrixCompMult(A, B); // Not * to avoid matrix product. glm::mat4 D = glm::abs(C); - glm::bvec4 const col1 = glm::equal(D[0], A[0]); - glm::bvec4 const col2 = glm::equal(D[1], A[1]); - glm::bvec4 const col3 = glm::equal(D[2], A[2]); - glm::bvec4 const col4 = glm::equal(D[3], A[3]); + glm::bvec4 const col1 = glm::equal(D[0], A[0], 0.001f); + glm::bvec4 const col2 = glm::equal(D[1], A[1], 0.001f); + glm::bvec4 const col3 = glm::equal(D[2], A[2], 0.001f); + glm::bvec4 const col4 = glm::equal(D[3], A[3], 0.001f); Error += glm::all(glm::bvec4(glm::all(col1), glm::all(col2), glm::all(col3), glm::all(col4))) ? 0 : 1; } { @@ -87,10 +87,10 @@ static int test_abs() ); glm::mat4x3 C = glm::matrixCompMult(A, B); // Not * to avoid matrix product. glm::mat4x3 D = glm::abs(C); - glm::bvec3 const col1 = glm::equal(D[0], A[0]); - glm::bvec3 const col2 = glm::equal(D[1], A[1]); - glm::bvec3 const col3 = glm::equal(D[2], A[2]); - glm::bvec3 const col4 = glm::equal(D[3], A[3]); + glm::bvec3 const col1 = glm::equal(D[0], A[0], 0.001f); + glm::bvec3 const col2 = glm::equal(D[1], A[1], 0.001f); + glm::bvec3 const col3 = glm::equal(D[2], A[2], 0.001f); + glm::bvec3 const col4 = glm::equal(D[3], A[3], 0.001f); Error += glm::all(glm::bvec4(glm::all(col1), glm::all(col2), glm::all(col3), glm::all(col4))) ? 0 : 1; } { @@ -108,10 +108,10 @@ static int test_abs() ); glm::mat4x2 C = glm::matrixCompMult(A, B); // Not * to avoid matrix product. glm::mat4x2 D = glm::abs(C); - glm::bvec2 const col1 = glm::equal(D[0], A[0]); - glm::bvec2 const col2 = glm::equal(D[1], A[1]); - glm::bvec2 const col3 = glm::equal(D[2], A[2]); - glm::bvec2 const col4 = glm::equal(D[3], A[3]); + glm::bvec2 const col1 = glm::equal(D[0], A[0], 0.001f); + glm::bvec2 const col2 = glm::equal(D[1], A[1], 0.001f); + glm::bvec2 const col3 = glm::equal(D[2], A[2], 0.001f); + glm::bvec2 const col4 = glm::equal(D[3], A[3], 0.001f); Error += glm::all(glm::bvec4(glm::all(col1), glm::all(col2), glm::all(col3), glm::all(col4))) ? 0 : 1; } @@ -131,9 +131,9 @@ static int test_abs() ); glm::mat3x4 C = glm::matrixCompMult(A, B); // Not * to avoid matrix product. glm::mat3x4 D = glm::abs(C); - glm::bvec4 const col1 = glm::equal(D[0], A[0]); - glm::bvec4 const col2 = glm::equal(D[1], A[1]); - glm::bvec4 const col3 = glm::equal(D[2], A[2]); + glm::bvec4 const col1 = glm::equal(D[0], A[0], 0.001f); + glm::bvec4 const col2 = glm::equal(D[1], A[1], 0.001f); + glm::bvec4 const col3 = glm::equal(D[2], A[2], 0.001f); Error += glm::all(glm::bvec3(glm::all(col1), glm::all(col2), glm::all(col3))) ? 0 : 1; } { @@ -149,9 +149,9 @@ static int test_abs() ); glm::mat3 C = glm::matrixCompMult(A, B); // Not * to avoid matrix product. glm::mat3 D = glm::abs(C); - glm::bvec3 const col1 = glm::equal(D[0], A[0]); - glm::bvec3 const col2 = glm::equal(D[1], A[1]); - glm::bvec3 const col3 = glm::equal(D[2], A[2]); + glm::bvec3 const col1 = glm::equal(D[0], A[0], 0.001f); + glm::bvec3 const col2 = glm::equal(D[1], A[1], 0.001f); + glm::bvec3 const col3 = glm::equal(D[2], A[2], 0.001f); Error += glm::all(glm::bvec3(glm::all(col1), glm::all(col2), glm::all(col3))) ? 0 : 1; } { @@ -167,9 +167,9 @@ static int test_abs() ); glm::mat3x2 C = glm::matrixCompMult(A, B); // Not * to avoid matrix product. glm::mat3x2 D = glm::abs(C); - glm::bvec2 const col1 = glm::equal(D[0], A[0]); - glm::bvec2 const col2 = glm::equal(D[1], A[1]); - glm::bvec2 const col3 = glm::equal(D[2], A[2]); + glm::bvec2 const col1 = glm::equal(D[0], A[0], 0.001f); + glm::bvec2 const col2 = glm::equal(D[1], A[1], 0.001f); + glm::bvec2 const col3 = glm::equal(D[2], A[2], 0.001f); Error += glm::all(glm::bvec3(glm::all(col1), glm::all(col2), glm::all(col3))) ? 0 : 1; } @@ -187,8 +187,8 @@ static int test_abs() ); glm::mat2x4 C = glm::matrixCompMult(A, B); // Not * to avoid matrix product. glm::mat2x4 D = glm::abs(C); - glm::bvec4 const col1 = glm::equal(D[0], A[0]); - glm::bvec4 const col2 = glm::equal(D[1], A[1]); + glm::bvec4 const col1 = glm::equal(D[0], A[0], 0.001f); + glm::bvec4 const col2 = glm::equal(D[1], A[1], 0.001f); Error += glm::all(glm::bvec2(glm::all(col1), glm::all(col2))) ? 0 : 1; } { @@ -202,8 +202,8 @@ static int test_abs() ); glm::mat2x3 C = glm::matrixCompMult(A, B); // Not * to avoid matrix product. glm::mat2x3 D = glm::abs(C); - glm::bvec3 const col1 = glm::equal(D[0], A[0]); - glm::bvec3 const col2 = glm::equal(D[1], A[1]); + glm::bvec3 const col1 = glm::equal(D[0], A[0], 0.001f); + glm::bvec3 const col2 = glm::equal(D[1], A[1], 0.001f); Error += glm::all(glm::bvec2(glm::all(col1), glm::all(col2))) ? 0 : 1; } { @@ -217,8 +217,8 @@ static int test_abs() ); glm::mat2 C = glm::matrixCompMult(A, B); // Not * to avoid matrix product. glm::mat2 D = glm::abs(C); - glm::bvec2 const col1 = glm::equal(D[0], A[0]); - glm::bvec2 const col2 = glm::equal(D[1], A[1]); + glm::bvec2 const col1 = glm::equal(D[0], A[0], 0.001f); + glm::bvec2 const col2 = glm::equal(D[1], A[1], 0.001f); Error += glm::all(glm::bvec2(glm::all(col1), glm::all(col2))) ? 0 : 1; } diff --git a/test/ext/ext_matrix_integer.cpp b/test/ext/ext_matrix_integer.cpp index c26d557f5f..91418d8679 100644 --- a/test/ext/ext_matrix_integer.cpp +++ b/test/ext/ext_matrix_integer.cpp @@ -12,7 +12,7 @@ using namespace glm; -int test_matrixCompMult() +static int test_matrixCompMult() { int Error = 0; @@ -82,7 +82,7 @@ int test_matrixCompMult() return Error; } -int test_outerProduct() +static int test_outerProduct() { int Error = 0; @@ -129,7 +129,7 @@ int test_outerProduct() return Error; } -int test_transpose() +static int test_transpose() { int Error = 0; @@ -199,7 +199,7 @@ int test_transpose() return Error; } -int test_determinant() +static int test_determinant() { int Error = 0; diff --git a/test/ext/ext_quaternion_exponential.cpp b/test/ext/ext_quaternion_exponential.cpp index fbcdbeff74..7cc70dff88 100644 --- a/test/ext/ext_quaternion_exponential.cpp +++ b/test/ext/ext_quaternion_exponential.cpp @@ -11,7 +11,7 @@ #include template -int test_log() +static int test_log() { typedef typename quaType::value_type T; @@ -30,7 +30,7 @@ int test_log() } template -int test_pow() +static int test_pow() { typedef typename quaType::value_type T; diff --git a/test/ext/ext_scalar_common.cpp b/test/ext/ext_scalar_common.cpp index 0e24cf340f..251c519fc5 100644 --- a/test/ext/ext_scalar_common.cpp +++ b/test/ext/ext_scalar_common.cpp @@ -3,12 +3,6 @@ #include #include -#if ((GLM_LANG & GLM_LANG_CXX11_FLAG) || (GLM_COMPILER & GLM_COMPILER_VC)) -# define GLM_NAN(T) NAN -#else -# define GLM_NAN(T) (static_cast(0.0f) / static_cast(0.0f)) -#endif - template static int test_min() { @@ -74,7 +68,7 @@ static int test_min_nan() int Error = 0; T const B = static_cast(1); - T const N = static_cast(GLM_NAN(T)); + T const N = static_cast(NAN); Error += glm::isnan(glm::min(N, B)) ? 0 : 1; Error += !glm::isnan(glm::min(B, N)) ? 0 : 1; @@ -103,7 +97,7 @@ static int test_max_nan() int Error = 0; T const B = static_cast(1); - T const N = static_cast(GLM_NAN(T)); + T const N = static_cast(NAN); Error += glm::isnan(glm::max(N, B)) ? 0 : 1; Error += !glm::isnan(glm::max(B, N)) ? 0 : 1; @@ -132,7 +126,7 @@ static int test_fmin() int Error = 0; T const B = static_cast(1); - T const N = static_cast(GLM_NAN(T)); + T const N = static_cast(NAN); Error += glm::equal(glm::fmin(N, B), B, glm::epsilon()) ? 0 : 1; Error += glm::equal(glm::fmin(B, N), B, glm::epsilon()) ? 0 : 1; @@ -161,7 +155,7 @@ static int test_fmax() int Error = 0; T const B = static_cast(1); - T const N = static_cast(GLM_NAN(T)); + T const N = static_cast(NAN); Error += glm::equal(glm::fmax(N, B), B, glm::epsilon()) ? 0 : 1; Error += glm::equal(glm::fmax(B, N), B, glm::epsilon()) ? 0 : 1; @@ -183,7 +177,7 @@ static int test_fmax() return Error; } -#endif// +#endif//((GLM_LANG & GLM_LANG_CXX11_FLAG) || (GLM_COMPILER & GLM_COMPILER_VC)) static int test_clamp() { diff --git a/test/ext/ext_vec1.cpp b/test/ext/ext_vec1.cpp index fc0b931878..255ab9c280 100644 --- a/test/ext/ext_vec1.cpp +++ b/test/ext/ext_vec1.cpp @@ -3,9 +3,18 @@ #include #include +#if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wglobal-constructors" +#endif + static glm::vec1 g1; static glm::vec1 g2(1); +#if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic pop +#endif + static int test_vec1_operators() { int Error(0); @@ -76,7 +85,7 @@ static int test_vec1_size() Error += glm::vec1::length() == 1 ? 0 : 1; Error += glm::dvec1::length() == 1 ? 0 : 1; - GLM_CONSTEXPR std::size_t Length = glm::vec1::length(); + GLM_CONSTEXPR glm::length_t Length = glm::vec1::length(); Error += Length == 1 ? 0 : 1; return Error; diff --git a/test/ext/ext_vector_common.cpp b/test/ext/ext_vector_common.cpp index 045f292020..1da407993e 100644 --- a/test/ext/ext_vector_common.cpp +++ b/test/ext/ext_vector_common.cpp @@ -30,12 +30,6 @@ #include #include -#if ((GLM_LANG & GLM_LANG_CXX11_FLAG) || (GLM_COMPILER & GLM_COMPILER_VC)) -# define GLM_NAN(T) NAN -#else -# define GLM_NAN(T) (static_cast(0.0f) / static_cast(0.0f)) -#endif - template static int test_min() { @@ -108,7 +102,7 @@ static int test_min_nan() int Error = 0; vecType const B(static_cast(1)); - vecType const N(GLM_NAN(T)); + vecType const N(NAN); Error += glm::all(glm::isnan(glm::min(N, B))) ? 0 : 1; Error += !glm::all(glm::isnan(glm::min(B, N))) ? 0 : 1; @@ -140,7 +134,7 @@ static int test_max_nan() int Error = 0; vecType const B(static_cast(1)); - vecType const N(GLM_NAN(T)); + vecType const N(NAN); Error += glm::all(glm::isnan(glm::max(N, B))) ? 0 : 1; Error += !glm::all(glm::isnan(glm::max(B, N))) ? 0 : 1; @@ -172,7 +166,7 @@ static int test_fmin() int Error = 0; vecType const B(static_cast(1)); - vecType const N(GLM_NAN(T)); + vecType const N(NAN); Error += glm::all(glm::equal(glm::fmin(N, B), B, glm::epsilon())) ? 0 : 1; Error += glm::all(glm::equal(glm::fmin(B, N), B, glm::epsilon())) ? 0 : 1; @@ -204,7 +198,7 @@ static int test_fmax() int Error = 0; vecType const B(static_cast(1)); - vecType const N(GLM_NAN(T)); + vecType const N(NAN); Error += glm::all(glm::equal(glm::fmax(N, B), B, glm::epsilon())) ? 0 : 1; Error += glm::all(glm::equal(glm::fmax(B, N), B, glm::epsilon())) ? 0 : 1; @@ -227,7 +221,7 @@ static int test_fmax() return Error; } -#endif// +#endif//((GLM_LANG & GLM_LANG_CXX11_FLAG) || (GLM_COMPILER & GLM_COMPILER_VC)) static int test_clamp() { diff --git a/test/ext/ext_vector_integer.cpp b/test/ext/ext_vector_integer.cpp index 7c96a3eb83..abd59c9106 100644 --- a/test/ext/ext_vector_integer.cpp +++ b/test/ext/ext_vector_integer.cpp @@ -17,6 +17,11 @@ namespace isPowerOfTwo { +#if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wpadded" +#endif + template struct type { @@ -24,8 +29,12 @@ namespace isPowerOfTwo bool Return; }; +#if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic pop +#endif + template - int test_int16() + static int test_int16() { type const Data[] = { @@ -49,7 +58,7 @@ namespace isPowerOfTwo } template - int test_uint16() + static int test_uint16() { type const Data[] = { @@ -73,7 +82,7 @@ namespace isPowerOfTwo } template - int test_int32() + static int test_int32() { type const Data[] = { @@ -97,7 +106,7 @@ namespace isPowerOfTwo } template - int test_uint32() + static int test_uint32() { type const Data[] = { @@ -120,7 +129,7 @@ namespace isPowerOfTwo return Error; } - int test() + static int test() { int Error = 0; @@ -151,7 +160,7 @@ namespace isPowerOfTwo namespace prevPowerOfTwo { template - int run() + static int run() { int Error = 0; @@ -170,7 +179,7 @@ namespace prevPowerOfTwo return Error; } - int test() + static int test() { int Error = 0; @@ -221,7 +230,7 @@ namespace prevPowerOfTwo namespace nextPowerOfTwo { template - int run() + static int run() { int Error = 0; @@ -240,7 +249,7 @@ namespace nextPowerOfTwo return Error; } - int test() + static int test() { int Error = 0; @@ -299,7 +308,7 @@ namespace prevMultiple }; template - int run() + static int run() { type const Data[] = { @@ -321,7 +330,7 @@ namespace prevMultiple return Error; } - int test() + static int test() { int Error = 0; @@ -380,7 +389,7 @@ namespace nextMultiple }; template - int run() + static int run() { type const Data[] = { @@ -406,7 +415,7 @@ namespace nextMultiple return Error; } - int test() + static int test() { int Error = 0; @@ -456,6 +465,11 @@ namespace nextMultiple namespace findNSB { +#if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wpadded" +#endif + template struct type { @@ -464,8 +478,12 @@ namespace findNSB int Return; }; +#if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic pop +#endif + template - int run() + static int run() { type const Data[] = { @@ -493,7 +511,7 @@ namespace findNSB return Error; } - int test() + static int test() { int Error = 0; @@ -542,6 +560,11 @@ namespace findNSB } }//namespace findNSB +#if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wpadded" +#endif + template struct test_mix_entry { @@ -551,6 +574,10 @@ struct test_mix_entry T Result; }; +#if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic pop +#endif + static int test_mix() { test_mix_entry const TestBool[] = diff --git a/test/gtc/gtc_bitfield.cpp b/test/gtc/gtc_bitfield.cpp index 82d97d54e1..3e72d63801 100644 --- a/test/gtc/gtc_bitfield.cpp +++ b/test/gtc/gtc_bitfield.cpp @@ -15,17 +15,31 @@ namespace mask genType Return; }; - inline int mask_zero(int Bits) +#if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wsign-conversion" +#endif + + static inline int mask_zero(int Bits) { return ~((~0) << Bits); } - inline int mask_mix(int Bits) +#if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wsign-compare" +#endif + + static inline int mask_mix(int Bits) { return Bits >= sizeof(int) * 8 ? 0xffffffff : (static_cast(1) << Bits) - static_cast(1); } - inline int mask_half(int Bits) +#if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic pop +#endif + + static inline int mask_half(int Bits) { // We do the shift in two steps because 1 << 32 on an int is undefined. @@ -38,7 +52,7 @@ namespace mask return ~Reversed; } - inline int mask_loop(int Bits) + static inline int mask_loop(int Bits) { int Mask = 0; for(int Bit = 0; Bit < Bits; ++Bit) @@ -46,7 +60,7 @@ namespace mask return Mask; } - int perf() + static int perf() { int const Count = 100000000; @@ -112,16 +126,19 @@ namespace mask return TimeDefault < TimeLoop ? 0 : 1; } - int test_uint() +#if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic pop +#endif + + static int test_int() { - type const Data[] = + type const Data[] = { { 0, 0x00000000}, { 1, 0x00000001}, { 2, 0x00000003}, { 3, 0x00000007}, - {31, 0x7fffffff}, - {32, 0xffffffff} + {31, 0x7fffffff} }; int Error = 0; @@ -134,41 +151,39 @@ namespace mask */ for(std::size_t i = 0; i < sizeof(Data) / sizeof(type); ++i) { - glm::uint Result = static_cast(mask_mix(Data[i].Value)); + int Result = mask_mix(Data[i].Value); Error += Data[i].Return == Result ? 0 : 1; } for(std::size_t i = 0; i < sizeof(Data) / sizeof(type); ++i) { - glm::uint Result = static_cast(mask_half(Data[i].Value)); + int Result = mask_half(Data[i].Value); Error += Data[i].Return == Result ? 0 : 1; } for(std::size_t i = 0; i < sizeof(Data) / sizeof(type); ++i) { - glm::uint Result = static_cast(mask_loop(Data[i].Value)); + int Result = mask_loop(Data[i].Value); Error += Data[i].Return == Result ? 0 : 1; } for(std::size_t i = 0; i < sizeof(Data) / sizeof(type); ++i) { - glm::uint Result = static_cast(glm::mask(Data[i].Value)); + int Result = glm::mask(Data[i].Value); Error += Data[i].Return == Result ? 0 : 1; } return Error; } - int test_uvec4() + static int test_ivec4() { type const Data[] = { {glm::ivec4( 0), glm::ivec4(0x00000000)}, {glm::ivec4( 1), glm::ivec4(0x00000001)}, {glm::ivec4( 2), glm::ivec4(0x00000003)}, - {glm::ivec4( 3), glm::ivec4(0x00000007)}, - {glm::ivec4(31), glm::ivec4(0x7fffffff)}, - {glm::ivec4(32), glm::ivec4(0xffffffff)} + {glm::ivec4( 3), glm::ivec4(0x00000007)} }; int Error(0); @@ -182,12 +197,12 @@ namespace mask return Error; } - int test() + static int test() { int Error(0); - Error += test_uint(); - Error += test_uvec4(); + Error += test_int(); + Error += test_ivec4(); return Error; } @@ -196,7 +211,7 @@ namespace mask namespace bitfieldInterleave3 { template - inline RET refBitfieldInterleave(PARAM x, PARAM y, PARAM z) + static inline RET refBitfieldInterleave(PARAM x, PARAM y, PARAM z) { RET Result = 0; for(RET i = 0; i < sizeof(PARAM) * 8; ++i) @@ -208,7 +223,7 @@ namespace bitfieldInterleave3 return Result; } - int test() + static int test() { int Error(0); @@ -232,7 +247,7 @@ namespace bitfieldInterleave3 namespace bitfieldInterleave4 { template - inline RET loopBitfieldInterleave(PARAM x, PARAM y, PARAM z, PARAM w) + static inline RET loopBitfieldInterleave(PARAM x, PARAM y, PARAM z, PARAM w) { RET const v[4] = {x, y, z, w}; RET Result = 0; @@ -246,7 +261,7 @@ namespace bitfieldInterleave4 return Result; } - int test() + static int test() { int Error(0); @@ -271,7 +286,7 @@ namespace bitfieldInterleave4 namespace bitfieldInterleave { - inline glm::uint64 fastBitfieldInterleave(glm::uint32 x, glm::uint32 y) + static inline glm::uint64 fastBitfieldInterleave(glm::uint32 x, glm::uint32 y) { glm::uint64 REG1; glm::uint64 REG2; @@ -293,7 +308,7 @@ namespace bitfieldInterleave return REG1 | (REG2 << 1); } - inline glm::uint64 interleaveBitfieldInterleave(glm::uint32 x, glm::uint32 y) + static inline glm::uint64 interleaveBitfieldInterleave(glm::uint32 x, glm::uint32 y) { glm::uint64 REG1; glm::uint64 REG2; @@ -319,7 +334,7 @@ namespace bitfieldInterleave return REG1 | (REG2 << 1); } /* - inline glm::uint64 loopBitfieldInterleave(glm::uint32 x, glm::uint32 y) + static inline glm::uint64 loopBitfieldInterleave(glm::uint32 x, glm::uint32 y) { static glm::uint64 const Mask[5] = { @@ -342,7 +357,7 @@ namespace bitfieldInterleave } */ #if GLM_ARCH & GLM_ARCH_SSE2_BIT - inline glm::uint64 sseBitfieldInterleave(glm::uint32 x, glm::uint32 y) + static inline glm::uint64 sseBitfieldInterleave(glm::uint32 x, glm::uint32 y) { __m128i const Array = _mm_set_epi32(0, y, 0, x); @@ -399,7 +414,7 @@ namespace bitfieldInterleave return *reinterpret_cast(&Result); } - inline glm::uint64 sseUnalignedBitfieldInterleave(glm::uint32 x, glm::uint32 y) + static inline glm::uint64 sseUnalignedBitfieldInterleave(glm::uint32 x, glm::uint32 y) { __m128i const Array = _mm_set_epi32(0, y, 0, x); @@ -457,7 +472,7 @@ namespace bitfieldInterleave } #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT - int test() + static int test() { int Error = 0; @@ -522,7 +537,7 @@ namespace bitfieldInterleave return Error; } - int perf() + static int perf() { glm::uint32 x_max = 1 << 11; glm::uint32 y_max = 1 << 10; @@ -639,7 +654,8 @@ namespace bitfieldInterleave namespace bitfieldInterleave5 { - GLM_FUNC_QUALIFIER glm::uint16 bitfieldInterleave_u8vec2(glm::uint8 x, glm::uint8 y) + GLM_FUNC_QUALIFIER + static glm::uint16 bitfieldInterleave_u8vec2(glm::uint8 x, glm::uint8 y) { glm::uint32 Result = (glm::uint32(y) << 16) | glm::uint32(x); Result = ((Result << 4) | Result) & 0x0F0F0F0F; @@ -648,7 +664,8 @@ namespace bitfieldInterleave5 return static_cast((Result & 0x0000FFFF) | (Result >> 15)); } - GLM_FUNC_QUALIFIER glm::u8vec2 bitfieldDeinterleave_u8vec2(glm::uint16 InterleavedBitfield) + GLM_FUNC_QUALIFIER + static glm::u8vec2 bitfieldDeinterleave_u8vec2(glm::uint16 InterleavedBitfield) { glm::uint32 Result(InterleavedBitfield); Result = ((Result << 15) | Result) & 0x55555555; @@ -657,8 +674,9 @@ namespace bitfieldInterleave5 Result = ((Result >> 4) | Result) & 0x00FF00FF; return glm::u8vec2(Result & 0x0000FFFF, Result >> 16); } - - GLM_FUNC_QUALIFIER glm::uint32 bitfieldInterleave_u8vec4(glm::uint8 x, glm::uint8 y, glm::uint8 z, glm::uint8 w) +/* + GLM_FUNC_QUALIFIER + static glm::uint32 bitfieldInterleave_u8vec4(glm::uint8 x, glm::uint8 y, glm::uint8 z, glm::uint8 w) { glm::uint64 Result = (glm::uint64(w) << 48) | (glm::uint64(z) << 32) | (glm::uint64(y) << 16) | glm::uint64(x); Result = ((Result << 12) | Result) & 0x000F000F000F000Full; @@ -673,7 +691,8 @@ namespace bitfieldInterleave5 return a | b | c | d; } - GLM_FUNC_QUALIFIER glm::u8vec4 bitfieldDeinterleave_u8vec4(glm::uint32 InterleavedBitfield) + GLM_FUNC_QUALIFIER + static glm::u8vec4 bitfieldDeinterleave_u8vec4(glm::uint32 InterleavedBitfield) { glm::uint64 Result(InterleavedBitfield); Result = ((Result << 15) | Result) & 0x9249249249249249ull; @@ -686,12 +705,13 @@ namespace bitfieldInterleave5 (Result >> 32) & 0x0000FFFF00000000ull, (Result >> 48) & 0xFFFF000000000000ull); } - +*/ #if GLM_COMPILER & GLM_COMPILER_VC # pragma warning(disable : 4309) #endif - - GLM_FUNC_QUALIFIER glm::uint32 bitfieldInterleave_u16vec2(glm::uint16 x, glm::uint16 y) +/* + GLM_FUNC_QUALIFIER + static glm::uint32 bitfieldInterleave_u16vec2(glm::uint16 x, glm::uint16 y) { glm::uint64 Result = (glm::uint64(y) << 32) | glm::uint64(x); Result = ((Result << 8) | Result) & static_cast(0x00FF00FF00FF00FFull); @@ -701,7 +721,8 @@ namespace bitfieldInterleave5 return static_cast((Result & 0x00000000FFFFFFFFull) | (Result >> 31)); } - GLM_FUNC_QUALIFIER glm::u16vec2 bitfieldDeinterleave_u16vec2(glm::uint32 InterleavedBitfield) + GLM_FUNC_QUALIFIER + static glm::u16vec2 bitfieldDeinterleave_u16vec2(glm::uint32 InterleavedBitfield) { glm::uint64 Result(InterleavedBitfield); Result = ((Result << 31) | Result) & 0x5555555555555555ull; @@ -711,13 +732,15 @@ namespace bitfieldInterleave5 Result = ((Result >> 8) | Result) & 0x0000FFFF0000FFFFull; return glm::u16vec2(Result & 0x00000000FFFFFFFFull, Result >> 32); } - - int test() +*/ + static int test(glm::size_t divider) { int Error = 0; - for(glm::size_t j = 0; j < 256; ++j) - for(glm::size_t i = 0; i < 256; ++i) + glm::size_t count = 256 / divider; + + for(glm::size_t j = 0; j < count; ++j) + for(glm::size_t i = 0; i < count; ++i) { glm::uint16 A = bitfieldInterleave_u8vec2(glm::uint8(i), glm::uint8(j)); glm::uint16 B = glm::bitfieldInterleave(glm::uint8(i), glm::uint8(j)); @@ -727,43 +750,47 @@ namespace bitfieldInterleave5 Error += C.x == glm::uint8(i) ? 0 : 1; Error += C.y == glm::uint8(j) ? 0 : 1; } - - for(glm::size_t j = 0; j < 256; ++j) - for(glm::size_t i = 0; i < 256; ++i) +/* + for(glm::size_t j = 0; j < count; ++j) + for(glm::size_t i = 0; i < count; ++i) { glm::uint32 A = bitfieldInterleave_u8vec4(glm::uint8(i), glm::uint8(j), glm::uint8(i), glm::uint8(j)); glm::uint32 B = glm::bitfieldInterleave(glm::uint8(i), glm::uint8(j), glm::uint8(i), glm::uint8(j)); Error += A == B ? 0 : 1; -/* + glm::u8vec4 C = bitfieldDeinterleave_u8vec4(A); Error += C.x == glm::uint8(i) ? 0 : 1; Error += C.y == glm::uint8(j) ? 0 : 1; Error += C.z == glm::uint8(i) ? 0 : 1; Error += C.w == glm::uint8(j) ? 0 : 1; -*/ + } +*/ - for(glm::size_t j = 0; j < 256; ++j) - for(glm::size_t i = 0; i < 256; ++i) +/* + for(glm::size_t j = 0; j < count; ++j) + for(glm::size_t i = 0; i < count; ++i) { glm::uint32 A = bitfieldInterleave_u16vec2(glm::uint16(i), glm::uint16(j)); glm::uint32 B = glm::bitfieldInterleave(glm::uint16(i), glm::uint16(j)); Error += A == B ? 0 : 1; } - +*/ return Error; } - int perf_old_u8vec2(std::vector& Result) + static int perf_old_u8vec2(std::vector& Result, glm::size_t divider) { int Error = 0; + glm::size_t count = 256 / divider; + const std::clock_t BeginTime = std::clock(); for(glm::size_t k = 0; k < 10000; ++k) - for(glm::size_t j = 0; j < 256; ++j) - for(glm::size_t i = 0; i < 256; ++i) - Error += Result[j * 256 + i] == glm::bitfieldInterleave(glm::uint8(i), glm::uint8(j)) ? 0 : 1; + for(glm::size_t j = 0; j < count; ++j) + for(glm::size_t i = 0; i < count; ++i) + Error += Result[j * count + i] == glm::bitfieldInterleave(glm::uint8(i), glm::uint8(j)) ? 0 : 1; const std::clock_t EndTime = std::clock(); @@ -772,16 +799,18 @@ namespace bitfieldInterleave5 return Error; } - int perf_new_u8vec2(std::vector& Result) + static int perf_new_u8vec2(std::vector& Result, glm::size_t divider) { int Error = 0; + glm::size_t count = 256 / divider; + const std::clock_t BeginTime = std::clock(); for(glm::size_t k = 0; k < 10000; ++k) - for(glm::size_t j = 0; j < 256; ++j) - for(glm::size_t i = 0; i < 256; ++i) - Error += Result[j * 256 + i] == bitfieldInterleave_u8vec2(glm::uint8(i), glm::uint8(j)) ? 0 : 1; + for(glm::size_t j = 0; j < count; ++j) + for(glm::size_t i = 0; i < count; ++i) + Error += Result[j * count + i] == bitfieldInterleave_u8vec2(glm::uint8(i), glm::uint8(j)) ? 0 : 1; const std::clock_t EndTime = std::clock(); @@ -790,16 +819,18 @@ namespace bitfieldInterleave5 return Error; } - int perf_old_u8vec4(std::vector& Result) + static int perf_old_u8vec4(std::vector& Result, glm::size_t divider) { int Error = 0; + glm::size_t count = 256 / divider; + const std::clock_t BeginTime = std::clock(); for(glm::size_t k = 0; k < 10000; ++k) - for(glm::size_t j = 0; j < 256; ++j) - for(glm::size_t i = 0; i < 256; ++i) - Error += Result[j * 256 + i] == glm::bitfieldInterleave(glm::uint8(i), glm::uint8(j), glm::uint8(i), glm::uint8(j)) ? 0 : 1; + for(glm::size_t j = 0; j < count; ++j) + for(glm::size_t i = 0; i < count; ++i) + Error += Result[j * count + i] == glm::bitfieldInterleave(glm::uint8(i), glm::uint8(j), glm::uint8(i), glm::uint8(j)) ? 0 : 1; const std::clock_t EndTime = std::clock(); @@ -807,17 +838,19 @@ namespace bitfieldInterleave5 return Error; } - - int perf_new_u8vec4(std::vector& Result) +/* + static int perf_new_u8vec4(std::vector& Result, glm::size_t divider) { int Error = 0; + glm::size_t count = 256 / divider; + const std::clock_t BeginTime = std::clock(); for(glm::size_t k = 0; k < 10000; ++k) - for(glm::size_t j = 0; j < 256; ++j) - for(glm::size_t i = 0; i < 256; ++i) - Error += Result[j * 256 + i] == bitfieldInterleave_u8vec4(glm::uint8(i), glm::uint8(j), glm::uint8(i), glm::uint8(j)) ? 0 : 1; + for(glm::size_t j = 0; j < count; ++j) + for(glm::size_t i = 0; i < count; ++i) + Error += Result[j * count + i] == bitfieldInterleave_u8vec4(glm::uint8(i), glm::uint8(j), glm::uint8(i), glm::uint8(j)) ? 0 : 1; const std::clock_t EndTime = std::clock(); @@ -825,17 +858,19 @@ namespace bitfieldInterleave5 return Error; } - - int perf_old_u16vec2(std::vector& Result) +*/ + static int perf_old_u16vec2(std::vector& Result, glm::size_t divider) { int Error = 0; + glm::size_t count = 256 / divider; + const std::clock_t BeginTime = std::clock(); for(glm::size_t k = 0; k < 10000; ++k) - for(glm::size_t j = 0; j < 256; ++j) - for(glm::size_t i = 0; i < 256; ++i) - Error += Result[j * 256 + i] == glm::bitfieldInterleave(glm::uint16(i), glm::uint16(j)) ? 0 : 1; + for(glm::size_t j = 0; j < count; ++j) + for(glm::size_t i = 0; i < count; ++i) + Error += Result[j * count + i] == glm::bitfieldInterleave(glm::uint16(i), glm::uint16(j)) ? 0 : 1; const std::clock_t EndTime = std::clock(); @@ -843,17 +878,19 @@ namespace bitfieldInterleave5 return Error; } - - int perf_new_u16vec2(std::vector& Result) +/* + static int perf_new_u16vec2(std::vector& Result, glm::size_t divider) { int Error = 0; + glm::size_t count = 256 / divider; + const std::clock_t BeginTime = std::clock(); for(glm::size_t k = 0; k < 10000; ++k) - for(glm::size_t j = 0; j < 256; ++j) - for(glm::size_t i = 0; i < 256; ++i) - Error += Result[j * 256 + i] == bitfieldInterleave_u16vec2(glm::uint16(i), glm::uint16(j)) ? 0 : 1; + for(glm::size_t j = 0; j < count; ++j) + for(glm::size_t i = 0; i < count; ++i) + Error += Result[j * count + i] == bitfieldInterleave_u16vec2(glm::uint16(i), glm::uint16(j)) ? 0 : 1; const std::clock_t EndTime = std::clock(); @@ -861,36 +898,38 @@ namespace bitfieldInterleave5 return Error; } - - int perf() +*/ + static int perf(glm::size_t divider) { int Error = 0; + glm::size_t count = 256 / divider; + std::printf("bitfieldInterleave perf: init\r"); - std::vector Result_u8vec2(256 * 256, 0); - for(glm::size_t j = 0; j < 256; ++j) - for(glm::size_t i = 0; i < 256; ++i) - Result_u8vec2[j * 256 + i] = glm::bitfieldInterleave(glm::uint8(i), glm::uint8(j)); + std::vector Result_u8vec2(count * count, 0); + for(glm::size_t j = 0; j < count; ++j) + for(glm::size_t i = 0; i < count; ++i) + Result_u8vec2[j * count + i] = glm::bitfieldInterleave(glm::uint8(i), glm::uint8(j)); - Error += perf_old_u8vec2(Result_u8vec2); - Error += perf_new_u8vec2(Result_u8vec2); + Error += perf_old_u8vec2(Result_u8vec2, divider); + Error += perf_new_u8vec2(Result_u8vec2, divider); - std::vector Result_u8vec4(256 * 256, 0); - for(glm::size_t j = 0; j < 256; ++j) - for(glm::size_t i = 0; i < 256; ++i) - Result_u8vec4[j * 256 + i] = glm::bitfieldInterleave(glm::uint8(i), glm::uint8(j), glm::uint8(i), glm::uint8(j)); + std::vector Result_u8vec4(count * count, 0); + for(glm::size_t j = 0; j < count; ++j) + for(glm::size_t i = 0; i < count; ++i) + Result_u8vec4[j * count + i] = glm::bitfieldInterleave(glm::uint8(i), glm::uint8(j), glm::uint8(i), glm::uint8(j)); - Error += perf_old_u8vec4(Result_u8vec4); - Error += perf_new_u8vec4(Result_u8vec4); + Error += perf_old_u8vec4(Result_u8vec4, divider); + //Error += perf_new_u8vec4(Result_u8vec4, divider); - std::vector Result_u16vec2(256 * 256, 0); - for(glm::size_t j = 0; j < 256; ++j) - for(glm::size_t i = 0; i < 256; ++i) - Result_u16vec2[j * 256 + i] = glm::bitfieldInterleave(glm::uint16(i), glm::uint16(j)); + std::vector Result_u16vec2(count * count, 0); + for(glm::size_t j = 0; j < count; ++j) + for(glm::size_t i = 0; i < count; ++i) + Result_u16vec2[j * count + i] = glm::bitfieldInterleave(glm::uint16(i), glm::uint16(j)); - Error += perf_old_u16vec2(Result_u16vec2); - Error += perf_new_u16vec2(Result_u16vec2); + Error += perf_old_u16vec2(Result_u16vec2, divider); + //Error += perf_new_u16vec2(Result_u16vec2, divider); std::printf("bitfieldInterleave perf: %d Errors\n", Error); @@ -919,10 +958,10 @@ int main() { int Error = 0; -/* Tests for a faster and to reserve bitfieldInterleave - Error += ::bitfieldInterleave5::test(); - Error += ::bitfieldInterleave5::perf(); -*/ + // Tests for a faster and to reserve bitfieldInterleave + Error += ::bitfieldInterleave5::test(64); + Error += ::bitfieldInterleave5::perf(64); + Error += ::mask::test(); Error += ::bitfieldInterleave3::test(); Error += ::bitfieldInterleave4::test(); @@ -931,10 +970,8 @@ int main() Error += test_bitfieldRotateRight(); Error += test_bitfieldRotateLeft(); -# ifdef NDEBUG - Error += ::mask::perf(); - Error += ::bitfieldInterleave::perf(); -# endif//NDEBUG + Error += ::mask::perf(); + Error += ::bitfieldInterleave::perf(); return Error; } diff --git a/test/gtc/gtc_color_space.cpp b/test/gtc/gtc_color_space.cpp index 67650c5eef..82f60d5b9a 100644 --- a/test/gtc/gtc_color_space.cpp +++ b/test/gtc/gtc_color_space.cpp @@ -4,7 +4,7 @@ namespace srgb { - int test() + static int test() { int Error(0); @@ -39,8 +39,6 @@ namespace srgb glm::vec4 const ColorSourceGNI = glm::vec4(107, 107, 104, 131) / glm::vec4(255); { - glm::vec4 const ColorGNA = glm::convertSRGBToLinear(ColorSourceGNI) * glm::vec4(255); - glm::vec4 const ColorGNE = glm::convertLinearToSRGB(ColorSourceGNI) * glm::vec4(255); glm::vec4 const ColorSRGB = glm::convertLinearToSRGB(ColorSourceGNI); glm::vec4 const ColorRGB = glm::convertSRGBToLinear(ColorSRGB); Error += glm::all(glm::epsilonEqual(ColorSourceGNI, ColorRGB, 0.00001f)) ? 0 : 1; @@ -52,7 +50,7 @@ namespace srgb namespace srgb_lowp { - int test() + static int test() { int Error(0); diff --git a/test/gtc/gtc_constants.cpp b/test/gtc/gtc_constants.cpp index 3897cd080b..272080bbc4 100644 --- a/test/gtc/gtc_constants.cpp +++ b/test/gtc/gtc_constants.cpp @@ -1,6 +1,6 @@ #include -int test_epsilon() +static int test_epsilon() { int Error = 0; diff --git a/test/gtc/gtc_epsilon.cpp b/test/gtc/gtc_epsilon.cpp index f0e6c8a479..9c1865db70 100644 --- a/test/gtc/gtc_epsilon.cpp +++ b/test/gtc/gtc_epsilon.cpp @@ -3,7 +3,7 @@ #include #include -int test_defined() +static int test_defined() { glm::epsilonEqual(glm::vec2(), glm::vec2(), glm::vec2()); glm::epsilonEqual(glm::vec3(), glm::vec3(), glm::vec3()); @@ -27,7 +27,7 @@ int test_defined() } template -int test_equal() +static int test_equal() { int Error(0); diff --git a/test/gtc/gtc_integer.cpp b/test/gtc/gtc_integer.cpp index 769d969033..961c51b9ba 100644 --- a/test/gtc/gtc_integer.cpp +++ b/test/gtc/gtc_integer.cpp @@ -16,7 +16,7 @@ namespace log2_ { - int test() + static int test() { int Error = 0; @@ -53,10 +53,15 @@ namespace log2_ return Error; } - int perf(std::size_t Count) + static int perf(std::size_t Count) { int Error = 0; +#if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wsign-conversion" +#endif + { std::vector Result; Result.resize(Count); @@ -85,6 +90,10 @@ namespace log2_ std::printf("glm::log2: %d clocks\n", static_cast(End - Begin)); } +#if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic pop +#endif + # if GLM_HAS_BITSCAN_WINDOWS { std::vector Result; @@ -92,6 +101,11 @@ namespace log2_ std::clock_t Begin = clock(); +#if GLM_COMPILER& GLM_COMPILER_VC +# pragma warning(push) +# pragma warning(disable: 4267) +#endif + for(std::size_t i = 0; i < Count; ++i) { glm::vec<4, unsigned long, glm::defaultp> Tmp; @@ -102,6 +116,10 @@ namespace log2_ Result[i] = glm::ivec4(Tmp); } +#if GLM_COMPILER & GLM_COMPILER_VC +# pragma warning(pop) +#endif + std::clock_t End = clock(); std::printf("glm::log2 inlined: %d clocks\n", static_cast(End - Begin)); @@ -114,6 +132,11 @@ namespace log2_ std::clock_t Begin = clock(); +#if GLM_COMPILER& GLM_COMPILER_VC +# pragma warning(push) +# pragma warning(disable: 4267) +#endif + for(std::size_t i = 0; i < Count; ++i) { _BitScanReverse(&Result[i].x, i); @@ -122,6 +145,10 @@ namespace log2_ _BitScanReverse(&Result[i].w, i); } +#if GLM_COMPILER & GLM_COMPILER_VC +# pragma warning(pop) +#endif + std::clock_t End = clock(); std::printf("glm::log2 inlined no cast: %d clocks\n", static_cast(End - Begin)); @@ -134,6 +161,11 @@ namespace log2_ std::clock_t Begin = clock(); +#if GLM_COMPILER& GLM_COMPILER_VC +# pragma warning(push) +# pragma warning(disable: 4267) +#endif + for(std::size_t i = 0; i < Count; ++i) { _BitScanReverse(reinterpret_cast(&Result[i].x), i); @@ -142,12 +174,20 @@ namespace log2_ _BitScanReverse(reinterpret_cast(&Result[i].w), i); } +#if GLM_COMPILER & GLM_COMPILER_VC +# pragma warning(pop) +#endif + std::clock_t End = clock(); std::printf("glm::log2 reinterpret: %d clocks\n", static_cast(End - Begin)); } # endif//GLM_HAS_BITSCAN_WINDOWS +#if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wsign-conversion" +#endif { std::vector Result; Result.resize(Count); @@ -161,7 +201,14 @@ namespace log2_ std::printf("glm::log2: %d clocks\n", static_cast(End - Begin)); } - +#if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic pop +#endif + +#if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wsign-conversion" +#endif { std::vector Result; Result.resize(Count); @@ -175,6 +222,9 @@ namespace log2_ std::printf("glm::log2: %d clocks\n", static_cast(End - Begin)); } +#if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic pop +#endif return Error; } @@ -182,7 +232,7 @@ namespace log2_ namespace iround { - int test() + static int test() { int Error = 0; @@ -200,7 +250,7 @@ namespace iround namespace uround { - int test() + static int test() { int Error = 0; @@ -224,10 +274,8 @@ int main() Error += ::iround::test(); Error += ::uround::test(); -# ifdef NDEBUG - std::size_t const Samples(1000); - Error += ::log2_::perf(Samples); -# endif//NDEBUG + std::size_t const Samples(1000); + Error += ::log2_::perf(Samples); return Error; } diff --git a/test/gtc/gtc_matrix_access.cpp b/test/gtc/gtc_matrix_access.cpp index 1b966e2288..16dd068d8b 100644 --- a/test/gtc/gtc_matrix_access.cpp +++ b/test/gtc/gtc_matrix_access.cpp @@ -11,7 +11,7 @@ #include #include -int test_mat2x2_row_set() +static int test_mat2x2_row_set() { int Error = 0; @@ -26,7 +26,7 @@ int test_mat2x2_row_set() return Error; } -int test_mat2x2_col_set() +static int test_mat2x2_col_set() { int Error = 0; @@ -41,7 +41,7 @@ int test_mat2x2_col_set() return Error; } -int test_mat2x3_row_set() +static int test_mat2x3_row_set() { int Error = 0; @@ -58,7 +58,7 @@ int test_mat2x3_row_set() return Error; } -int test_mat2x3_col_set() +static int test_mat2x3_col_set() { int Error = 0; @@ -73,7 +73,7 @@ int test_mat2x3_col_set() return Error; } -int test_mat2x4_row_set() +static int test_mat2x4_row_set() { int Error = 0; @@ -92,7 +92,7 @@ int test_mat2x4_row_set() return Error; } -int test_mat2x4_col_set() +static int test_mat2x4_col_set() { int Error = 0; @@ -107,7 +107,7 @@ int test_mat2x4_col_set() return Error; } -int test_mat3x2_row_set() +static int test_mat3x2_row_set() { int Error = 0; @@ -122,7 +122,7 @@ int test_mat3x2_row_set() return Error; } -int test_mat3x2_col_set() +static int test_mat3x2_col_set() { int Error = 0; @@ -139,7 +139,7 @@ int test_mat3x2_col_set() return Error; } -int test_mat3x3_row_set() +static int test_mat3x3_row_set() { int Error = 0; @@ -156,7 +156,7 @@ int test_mat3x3_row_set() return Error; } -int test_mat3x3_col_set() +static int test_mat3x3_col_set() { int Error = 0; @@ -173,7 +173,7 @@ int test_mat3x3_col_set() return Error; } -int test_mat3x4_row_set() +static int test_mat3x4_row_set() { int Error = 0; @@ -192,7 +192,7 @@ int test_mat3x4_row_set() return Error; } -int test_mat3x4_col_set() +static int test_mat3x4_col_set() { int Error = 0; @@ -209,7 +209,7 @@ int test_mat3x4_col_set() return Error; } -int test_mat4x2_row_set() +static int test_mat4x2_row_set() { int Error = 0; @@ -224,7 +224,7 @@ int test_mat4x2_row_set() return Error; } -int test_mat4x2_col_set() +static int test_mat4x2_col_set() { int Error = 0; @@ -243,7 +243,7 @@ int test_mat4x2_col_set() return Error; } -int test_mat4x3_row_set() +static int test_mat4x3_row_set() { int Error = 0; @@ -260,7 +260,7 @@ int test_mat4x3_row_set() return Error; } -int test_mat4x3_col_set() +static int test_mat4x3_col_set() { int Error = 0; @@ -279,7 +279,7 @@ int test_mat4x3_col_set() return Error; } -int test_mat4x4_row_set() +static int test_mat4x4_row_set() { int Error = 0; @@ -298,7 +298,7 @@ int test_mat4x4_row_set() return Error; } -int test_mat4x4_col_set() +static int test_mat4x4_col_set() { int Error = 0; @@ -317,7 +317,7 @@ int test_mat4x4_col_set() return Error; } -int test_mat4x4_row_get() +static int test_mat4x4_row_get() { int Error = 0; @@ -335,7 +335,7 @@ int test_mat4x4_row_get() return Error; } -int test_mat4x4_col_get() +static int test_mat4x4_col_get() { int Error = 0; diff --git a/test/gtc/gtc_matrix_inverse.cpp b/test/gtc/gtc_matrix_inverse.cpp index eaec6e17d1..5b51d0c31f 100644 --- a/test/gtc/gtc_matrix_inverse.cpp +++ b/test/gtc/gtc_matrix_inverse.cpp @@ -1,7 +1,7 @@ #include #include -int test_affine() +static int test_affine() { int Error = 0; diff --git a/test/gtc/gtc_matrix_transform.cpp b/test/gtc/gtc_matrix_transform.cpp index d28d458100..ba8c922cc9 100644 --- a/test/gtc/gtc_matrix_transform.cpp +++ b/test/gtc/gtc_matrix_transform.cpp @@ -3,7 +3,7 @@ #include #include -int test_perspective() +static int test_perspective() { int Error = 0; @@ -56,7 +56,7 @@ int test_perspective() return Error; } -int test_infinitePerspective() +static int test_infinitePerspective() { int Error = 0; @@ -109,27 +109,30 @@ int test_infinitePerspective() return Error; } -int test_pick() +static int test_pick() { int Error = 0; glm::mat4 Pick = glm::pickMatrix(glm::vec2(1, 2), glm::vec2(3, 4), glm::ivec4(0, 0, 320, 240)); + Error += !glm::all(glm::notEqual(Pick, glm::mat4(2.0), 0.001f)); return Error; } -int test_tweakedInfinitePerspective() +static int test_tweakedInfinitePerspective() { int Error = 0; glm::mat4 ProjectionA = glm::tweakedInfinitePerspective(45.f, 640.f/480.f, 1.0f); glm::mat4 ProjectionB = glm::tweakedInfinitePerspective(45.f, 640.f/480.f, 1.0f, 0.001f); + Error += !glm::all(glm::notEqual(ProjectionA, glm::mat4(1.0), 0.001f)); + Error += !glm::all(glm::notEqual(ProjectionB, glm::mat4(1.0), 0.001f)); return Error; } -int test_translate() +static int test_translate() { int Error = 0; @@ -137,6 +140,10 @@ int test_translate() glm::lowp_mat4 m(0); glm::lowp_mat4 t = glm::translate(m, v); + glm::bvec4 b = glm::notEqual(t, glm::lowp_mat4(1.0), 0.001f); + + Error += !glm::all(b); + return Error; } diff --git a/test/gtc/gtc_packing.cpp b/test/gtc/gtc_packing.cpp index df5b3bb1a9..b3fd8547d2 100644 --- a/test/gtc/gtc_packing.cpp +++ b/test/gtc/gtc_packing.cpp @@ -5,7 +5,8 @@ #include #include -void print_bits(float const& s) +/* +static void print_bits(float const& s) { union { @@ -24,7 +25,7 @@ void print_bits(float const& s) } } -void print_10bits(glm::uint const& s) +static void print_10bits(glm::uint const& s) { std::printf("10b: "); for(std::size_t j = 10; j > 0; --j) @@ -35,7 +36,7 @@ void print_10bits(glm::uint const& s) } } -void print_11bits(glm::uint const& s) +static void print_11bits(glm::uint const& s) { std::printf("11b: "); for(std::size_t j = 11; j > 0; --j) @@ -46,7 +47,7 @@ void print_11bits(glm::uint const& s) } } -void print_value(float const& s) +static void print_value(float const& s) { std::printf("%2.5f, ", static_cast(s)); print_bits(s); @@ -56,8 +57,8 @@ void print_value(float const& s) // print_10bits(detail::floatTo10bit(s)); std::printf("\n"); } - -int test_Half1x16() +*/ +static int test_Half1x16() { int Error = 0; @@ -81,7 +82,7 @@ int test_Half1x16() return Error; } -int test_Half4x16() +static int test_Half4x16() { int Error = 0; @@ -109,7 +110,7 @@ int test_Half4x16() return Error; } -int test_I3x10_1x2() +static int test_I3x10_1x2() { int Error = 0; @@ -133,7 +134,7 @@ int test_I3x10_1x2() return Error; } -int test_U3x10_1x2() +static int test_U3x10_1x2() { int Error = 0; @@ -169,7 +170,7 @@ int test_U3x10_1x2() return Error; } -int test_Snorm3x10_1x2() +static int test_Snorm3x10_1x2() { int Error = 0; @@ -194,7 +195,7 @@ int test_Snorm3x10_1x2() return Error; } -int test_Unorm3x10_1x2() +static int test_Unorm3x10_1x2() { int Error = 0; @@ -219,7 +220,7 @@ int test_Unorm3x10_1x2() return Error; } -int test_F2x11_1x10() +static int test_F2x11_1x10() { int Error = 0; @@ -243,7 +244,7 @@ int test_F2x11_1x10() return Error; } -int test_F3x9_E1x5() +static int test_F3x9_E1x5() { int Error = 0; @@ -267,7 +268,7 @@ int test_F3x9_E1x5() return Error; } -int test_RGBM() +static int test_RGBM() { int Error = 0; @@ -283,7 +284,7 @@ int test_RGBM() return Error; } -int test_packUnorm1x16() +static int test_packUnorm1x16() { int Error = 0; @@ -305,7 +306,7 @@ int test_packUnorm1x16() return Error; } -int test_packSnorm1x16() +static int test_packSnorm1x16() { int Error = 0; @@ -326,7 +327,7 @@ int test_packSnorm1x16() return Error; } -int test_packUnorm2x16() +static int test_packUnorm2x16() { int Error = 0; @@ -347,7 +348,7 @@ int test_packUnorm2x16() return Error; } -int test_packSnorm2x16() +static int test_packSnorm2x16() { int Error = 0; @@ -368,7 +369,7 @@ int test_packSnorm2x16() return Error; } -int test_packUnorm4x16() +static int test_packUnorm4x16() { int Error = 0; @@ -390,7 +391,7 @@ int test_packUnorm4x16() return Error; } -int test_packSnorm4x16() +static int test_packSnorm4x16() { int Error = 0; @@ -411,7 +412,7 @@ int test_packSnorm4x16() return Error; } -int test_packUnorm1x8() +static int test_packUnorm1x8() { int Error = 0; @@ -432,7 +433,7 @@ int test_packUnorm1x8() return Error; } -int test_packSnorm1x8() +static int test_packSnorm1x8() { int Error = 0; @@ -452,7 +453,7 @@ int test_packSnorm1x8() return Error; } -int test_packUnorm2x8() +static int test_packUnorm2x8() { int Error = 0; @@ -472,7 +473,7 @@ int test_packUnorm2x8() return Error; } -int test_packSnorm2x8() +static int test_packSnorm2x8() { int Error = 0; @@ -491,7 +492,7 @@ int test_packSnorm2x8() return Error; } -int test_packUnorm4x8() +static int test_packUnorm4x8() { int Error = 0; @@ -511,7 +512,7 @@ int test_packUnorm4x8() return Error; } -int test_packSnorm4x8() +static int test_packSnorm4x8() { int Error = 0; @@ -531,7 +532,7 @@ int test_packSnorm4x8() return Error; } -int test_packUnorm() +static int test_packUnorm() { int Error = 0; @@ -551,7 +552,7 @@ int test_packUnorm() return Error; } -int test_packSnorm() +static int test_packSnorm() { int Error = 0; @@ -572,7 +573,7 @@ int test_packSnorm() return Error; } -int test_packUnorm2x4() +static int test_packUnorm2x4() { int Error = 0; @@ -592,7 +593,7 @@ int test_packUnorm2x4() return Error; } -int test_packUnorm4x4() +static int test_packUnorm4x4() { int Error = 0; @@ -612,7 +613,7 @@ int test_packUnorm4x4() return Error; } -int test_packUnorm3x5_1x1() +static int test_packUnorm3x5_1x1() { int Error = 0; @@ -632,7 +633,7 @@ int test_packUnorm3x5_1x1() return Error; } -int test_packUnorm1x5_1x6_1x5() +static int test_packUnorm1x5_1x6_1x5() { int Error = 0; @@ -652,7 +653,7 @@ int test_packUnorm1x5_1x6_1x5() return Error; } -int test_packUnorm2x3_1x2() +static int test_packUnorm2x3_1x2() { int Error = 0; @@ -672,7 +673,7 @@ int test_packUnorm2x3_1x2() return Error; } -int test_packUint2x8() +static int test_packUint2x8() { int Error = 0; @@ -687,7 +688,7 @@ int test_packUint2x8() return Error; } -int test_packUint4x8() +static int test_packUint4x8() { int Error = 0; @@ -702,7 +703,7 @@ int test_packUint4x8() return Error; } -int test_packUint2x16() +static int test_packUint2x16() { int Error = 0; @@ -717,7 +718,7 @@ int test_packUint2x16() return Error; } -int test_packUint4x16() +static int test_packUint4x16() { int Error = 0; @@ -732,7 +733,7 @@ int test_packUint4x16() return Error; } -int test_packUint2x32() +static int test_packUint2x32() { int Error = 0; @@ -747,7 +748,7 @@ int test_packUint2x32() return Error; } -int test_packInt2x8() +static int test_packInt2x8() { int Error = 0; @@ -762,7 +763,7 @@ int test_packInt2x8() return Error; } -int test_packInt4x8() +static int test_packInt4x8() { int Error = 0; @@ -777,7 +778,7 @@ int test_packInt4x8() return Error; } -int test_packInt2x16() +static int test_packInt2x16() { int Error = 0; @@ -792,7 +793,7 @@ int test_packInt2x16() return Error; } -int test_packInt4x16() +static int test_packInt4x16() { int Error = 0; @@ -807,7 +808,7 @@ int test_packInt4x16() return Error; } -int test_packInt2x32() +static int test_packInt2x32() { int Error = 0; diff --git a/test/gtc/gtc_quaternion.cpp b/test/gtc/gtc_quaternion.cpp index eef11270e7..58446ae56e 100644 --- a/test/gtc/gtc_quaternion.cpp +++ b/test/gtc/gtc_quaternion.cpp @@ -7,7 +7,7 @@ #include #include -int test_quat_angle() +static int test_quat_angle() { int Error = 0; @@ -39,7 +39,7 @@ int test_quat_angle() return Error; } -int test_quat_angleAxis() +static int test_quat_angleAxis() { int Error = 0; @@ -56,7 +56,7 @@ int test_quat_angleAxis() return Error; } -int test_quat_mix() +static int test_quat_mix() { int Error = 0; @@ -73,7 +73,7 @@ int test_quat_mix() return Error; } -int test_quat_normalize() +static int test_quat_normalize() { int Error(0); @@ -99,7 +99,7 @@ int test_quat_normalize() return Error; } -int test_quat_euler() +static int test_quat_euler() { int Error = 0; @@ -124,7 +124,7 @@ int test_quat_euler() return Error; } -int test_quat_slerp() +static int test_quat_slerp() { int Error = 0; @@ -148,6 +148,7 @@ int test_quat_slerp() // Testing standard, easy case // Must be 45 degrees rotation on Y : 0 0.38 0 0.92 glm::quat Y45rot1 = glm::slerp(id, Y90rot, 0.5f); + Error += glm::all(glm::equal(Y45rot1, glm::quat(0.924f, 0.0f, 0.383f, 0.0f), 0.01f)) ? 0 : 1; // Testing reverse case // Must be 45 degrees rotation on Y : 0 0.38 0 0.92 @@ -181,6 +182,7 @@ int test_quat_slerp() // Testing almost equal quaternions (this test should pass through the linear interpolation) // Must be 0 0.00X 0 0.99999 glm::quat almostid = glm::slerp(id, glm::angleAxis(0.1f, glm::vec3(0.0f, 1.0f, 0.0f)), 0.5f); + Error += glm::all(glm::equal(almostid, glm::quat(1.0f, 0.0f, 0.0f, 0.0f), 0.1f)) ? 0 : 1; // Testing quaternions with opposite sign { @@ -194,7 +196,7 @@ int test_quat_slerp() return Error; } -int test_quat_slerp_spins() +static int test_quat_slerp_spins() { int Error = 0; @@ -295,9 +297,11 @@ static int test_mul() glm::vec3 transformed0 = (temp1 * glm::vec3(0.0, 1.0, 0.0) * glm::inverse(temp1)); glm::vec3 temp4 = temp2 * transformed0 * glm::inverse(temp2); + Error += glm::all(glm::equal(temp4, glm::vec3(0.0f, -0.28f, -0.96f), 0.01f)) ? 0 : 1; glm::quat temp5 = glm::normalize(temp1 * temp2); glm::vec3 temp6 = temp5 * glm::vec3(0.0, 1.0, 0.0) * glm::inverse(temp5); + Error += glm::all(glm::equal(temp6, glm::vec3(-0.48f, 0.36f, -0.8f), 0.01f)) ? 0 : 1; glm::quat temp7(1.0f, glm::vec3(0.0, 1.0, 0.0)); @@ -309,7 +313,7 @@ static int test_mul() return Error; } -int test_identity() +static int test_identity() { int Error = 0; diff --git a/test/gtc/gtc_random.cpp b/test/gtc/gtc_random.cpp index 60fb60c429..0c8346179e 100644 --- a/test/gtc/gtc_random.cpp +++ b/test/gtc/gtc_random.cpp @@ -8,7 +8,7 @@ std::size_t const TestSamples = 10000; -int test_linearRand() +static int test_linearRand() { int Error = 0; @@ -220,7 +220,7 @@ int test_linearRand() return Error; } -int test_circularRand() +static int test_circularRand() { int Error = 0; @@ -244,7 +244,7 @@ int test_circularRand() return Error; } -int test_sphericalRand() +static int test_sphericalRand() { int Error = 0; @@ -279,7 +279,7 @@ int test_sphericalRand() return Error; } -int test_diskRand() +static int test_diskRand() { int Error = 0; @@ -301,7 +301,7 @@ int test_diskRand() return Error; } -int test_ballRand() +static int test_ballRand() { int Error = 0; diff --git a/test/gtc/gtc_round.cpp b/test/gtc/gtc_round.cpp index 60d9a8572c..6bf25aac10 100644 --- a/test/gtc/gtc_round.cpp +++ b/test/gtc/gtc_round.cpp @@ -8,6 +8,11 @@ namespace isPowerOfTwo { +#if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wpadded" +#endif + template struct type { @@ -15,7 +20,11 @@ namespace isPowerOfTwo bool Return; }; - int test_int16() +#if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic pop +#endif + + static int test_int16() { type const Data[] = { @@ -38,7 +47,7 @@ namespace isPowerOfTwo return Error; } - int test_uint16() + static int test_uint16() { type const Data[] = { @@ -61,7 +70,7 @@ namespace isPowerOfTwo return Error; } - int test_int32() + static int test_int32() { type const Data[] = { @@ -108,7 +117,7 @@ namespace isPowerOfTwo return Error; } - int test_uint32() + static int test_uint32() { type const Data[] = { @@ -131,7 +140,7 @@ namespace isPowerOfTwo return Error; } - int test() + static int test() { int Error(0); @@ -147,7 +156,8 @@ namespace isPowerOfTwo namespace ceilPowerOfTwo_advanced { template - GLM_FUNC_QUALIFIER genIUType highestBitValue(genIUType Value) + GLM_FUNC_QUALIFIER + static genIUType highestBitValue(genIUType Value) { genIUType tmp = Value; genIUType result = genIUType(0); @@ -160,7 +170,8 @@ namespace ceilPowerOfTwo_advanced } template - GLM_FUNC_QUALIFIER genType ceilPowerOfTwo_loop(genType value) + GLM_FUNC_QUALIFIER + static genType ceilPowerOfTwo_loop(genType value) { return glm::isPowerOfTwo(value) ? value : highestBitValue(value) << 1; } @@ -172,7 +183,7 @@ namespace ceilPowerOfTwo_advanced genType Return; }; - int test_int32() + static int test_int32() { type const Data[] = { @@ -201,7 +212,7 @@ namespace ceilPowerOfTwo_advanced return Error; } - int test_uint32() + static int test_uint32() { type const Data[] = { @@ -228,7 +239,7 @@ namespace ceilPowerOfTwo_advanced return Error; } - int perf() + static int perf() { int Error(0); @@ -253,7 +264,7 @@ namespace ceilPowerOfTwo_advanced return Error; } - int test() + static int test() { int Error(0); @@ -266,7 +277,7 @@ namespace ceilPowerOfTwo_advanced namespace roundPowerOfTwo { - int test() + static int test() { int Error = 0; @@ -294,7 +305,7 @@ namespace roundPowerOfTwo namespace floorPowerOfTwo { - int test() + static int test() { int Error = 0; @@ -313,7 +324,7 @@ namespace floorPowerOfTwo namespace ceilPowerOfTwo { - int test() + static int test() { int Error = 0; @@ -341,7 +352,7 @@ namespace floorMultiple genType Epsilon; }; - int test_float() + static int test_float() { type const Data[] = { @@ -360,7 +371,7 @@ namespace floorMultiple return Error; } - int test() + static int test() { int Error(0); @@ -381,7 +392,7 @@ namespace ceilMultiple genType Epsilon; }; - int test_float() + static int test_float() { type const Data[] = { @@ -400,7 +411,7 @@ namespace ceilMultiple return Error; } - int test_int() + static int test_int() { type const Data[] = { @@ -426,7 +437,7 @@ namespace ceilMultiple return Error; } - int test() + static int test() { int Error(0); @@ -447,9 +458,7 @@ int main() Error += ceilPowerOfTwo::test(); Error += ceilPowerOfTwo_advanced::test(); -# ifdef NDEBUG - Error += ceilPowerOfTwo_advanced::perf(); -# endif//NDEBUG + Error += ceilPowerOfTwo_advanced::perf(); Error += floorMultiple::test(); Error += ceilMultiple::test(); diff --git a/test/gtc/gtc_type_precision.cpp b/test/gtc/gtc_type_precision.cpp index 77f0686645..27dbb6948b 100644 --- a/test/gtc/gtc_type_precision.cpp +++ b/test/gtc/gtc_type_precision.cpp @@ -976,13 +976,16 @@ static int test_fvec_conversion() { glm::highp_vec4 a = glm::vec4(1, 2, 3, 4); + Error += glm::all(glm::equal(a, glm::vec4(1, 2, 3, 4), glm::epsilon())) ? 0 : 1; + glm::mediump_vec4 b = glm::vec4(1, 2, 3, 4); glm::lowp_vec4 c = b; glm::mediump_vec4 d = c; + Error += glm::all(glm::equal(b, d, glm::epsilon())) ? 0 : 1; + glm::lowp_ivec4 e = glm::ivec4(d); glm::lowp_ivec3 f = glm::ivec3(e); - - Error += glm::all(glm::equal(b, d, glm::epsilon())) ? 0 : 1; + Error += glm::all(glm::equal(f, glm::lowp_ivec3(1, 2, 3))) ? 0 : 1; } return Error; diff --git a/test/gtc/gtc_type_ptr.cpp b/test/gtc/gtc_type_ptr.cpp index 6fcd305415..c69f4f919a 100644 --- a/test/gtc/gtc_type_ptr.cpp +++ b/test/gtc/gtc_type_ptr.cpp @@ -2,8 +2,9 @@ #include #include #include +#include -int test_value_ptr_vec() +static int test_value_ptr_vec() { int Error = 0; @@ -42,7 +43,7 @@ int test_value_ptr_vec() return Error; } -int test_value_ptr_vec_const() +static int test_value_ptr_vec_const() { int Error = 0; @@ -81,7 +82,7 @@ int test_value_ptr_vec_const() return Error; } -int test_value_ptr_mat() +static int test_value_ptr_mat() { int Error = 0; @@ -134,7 +135,7 @@ int test_value_ptr_mat() return Error; } -int test_value_ptr_mat_const() +static int test_value_ptr_mat_const() { int Error = 0; @@ -187,7 +188,7 @@ int test_value_ptr_mat_const() return Error; } -int test_make_pointer_mat() +static int test_make_pointer_mat() { int Error = 0; @@ -195,29 +196,65 @@ int test_make_pointer_mat() double ArrayB[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}; glm::mat2x2 Mat2x2A = glm::make_mat2x2(ArrayA); + Error += glm::all(glm::equal(Mat2x2A, glm::mat2x2(0, 1, 2, 3), 0.001f)) ? 0 : 1; + glm::mat2x3 Mat2x3A = glm::make_mat2x3(ArrayA); + Error += glm::all(glm::equal(Mat2x3A, glm::mat2x3(0, 1, 2, 3, 4, 5), 0.001f)) ? 0 : 1; + glm::mat2x4 Mat2x4A = glm::make_mat2x4(ArrayA); + Error += glm::all(glm::equal(Mat2x4A, glm::mat2x4(0, 1, 2, 3, 4, 5, 6, 7), 0.001f)) ? 0 : 1; + glm::mat3x2 Mat3x2A = glm::make_mat3x2(ArrayA); + Error += glm::all(glm::equal(Mat3x2A, glm::mat3x2(0, 1, 2, 3, 4, 5), 0.001f)) ? 0 : 1; + glm::mat3x3 Mat3x3A = glm::make_mat3x3(ArrayA); + Error += glm::all(glm::equal(Mat3x3A, glm::mat3x3(0, 1, 2, 3, 4, 5, 6, 7, 8), 0.001f)) ? 0 : 1; + glm::mat3x4 Mat3x4A = glm::make_mat3x4(ArrayA); + Error += glm::all(glm::equal(Mat3x4A, glm::mat3x4(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11), 0.001f)) ? 0 : 1; + glm::mat4x2 Mat4x2A = glm::make_mat4x2(ArrayA); + Error += glm::all(glm::equal(Mat4x2A, glm::mat4x2(0, 1, 2, 3, 4, 5, 6, 7), 0.001f)) ? 0 : 1; + glm::mat4x3 Mat4x3A = glm::make_mat4x3(ArrayA); + Error += glm::all(glm::equal(Mat4x3A, glm::mat4x3(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11), 0.001f)) ? 0 : 1; + glm::mat4x4 Mat4x4A = glm::make_mat4x4(ArrayA); + Error += glm::all(glm::equal(Mat4x4A, glm::mat4x4(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15), 0.001f)) ? 0 : 1; + + glm::dmat2x2 Mat2x2B = glm::make_mat2x2(ArrayB); + Error += glm::all(glm::equal(Mat2x2B, glm::dmat2x2(0, 1, 2, 3), 0.001)) ? 0 : 1; + glm::dmat2x3 Mat2x3B = glm::make_mat2x3(ArrayB); + Error += glm::all(glm::equal(Mat2x3B, glm::dmat2x3(0, 1, 2, 3, 4, 5), 0.001)) ? 0 : 1; + glm::dmat2x4 Mat2x4B = glm::make_mat2x4(ArrayB); + Error += glm::all(glm::equal(Mat2x4B, glm::dmat2x4(0, 1, 2, 3, 4, 5, 6, 7), 0.001)) ? 0 : 1; + glm::dmat3x2 Mat3x2B = glm::make_mat3x2(ArrayB); + Error += glm::all(glm::equal(Mat3x2B, glm::dmat3x2(0, 1, 2, 3, 4, 5), 0.001)) ? 0 : 1; + glm::dmat3x3 Mat3x3B = glm::make_mat3x3(ArrayB); + Error += glm::all(glm::equal(Mat3x3B, glm::dmat3x3(0, 1, 2, 3, 4, 5, 6, 7, 8), 0.001)) ? 0 : 1; + glm::dmat3x4 Mat3x4B = glm::make_mat3x4(ArrayB); + Error += glm::all(glm::equal(Mat3x4B, glm::dmat3x4(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11), 0.001)) ? 0 : 1; + glm::dmat4x2 Mat4x2B = glm::make_mat4x2(ArrayB); + Error += glm::all(glm::equal(Mat4x2B, glm::dmat4x2(0, 1, 2, 3, 4, 5, 6, 7), 0.001)) ? 0 : 1; + glm::dmat4x3 Mat4x3B = glm::make_mat4x3(ArrayB); + Error += glm::all(glm::equal(Mat4x3B, glm::dmat4x3(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11), 0.001)) ? 0 : 1; + glm::dmat4x4 Mat4x4B = glm::make_mat4x4(ArrayB); + Error += glm::all(glm::equal(Mat4x4B, glm::dmat4x4(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15), 0.001)) ? 0 : 1; return Error; } -int test_make_pointer_vec() +static int test_make_pointer_vec() { int Error = 0; @@ -226,21 +263,36 @@ int test_make_pointer_vec() bool ArrayC[] = {true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false}; glm::vec2 Vec2A = glm::make_vec2(ArrayA); + Error += glm::all(glm::equal(Vec2A, glm::vec2(0, 1), 0.001f)) ? 0 : 1; + glm::vec3 Vec3A = glm::make_vec3(ArrayA); + Error += glm::all(glm::equal(Vec3A, glm::vec3(0, 1, 2), 0.001f)) ? 0 : 1; + glm::vec4 Vec4A = glm::make_vec4(ArrayA); + Error += glm::all(glm::equal(Vec4A, glm::vec4(0, 1, 2, 3), 0.001f)) ? 0 : 1; glm::ivec2 Vec2B = glm::make_vec2(ArrayB); + Error += glm::all(glm::equal(Vec2B, glm::ivec2(0, 1))) ? 0 : 1; + glm::ivec3 Vec3B = glm::make_vec3(ArrayB); + Error += glm::all(glm::equal(Vec3B, glm::ivec3(0, 1, 2))) ? 0 : 1; + glm::ivec4 Vec4B = glm::make_vec4(ArrayB); + Error += glm::all(glm::equal(Vec4B, glm::ivec4(0, 1, 2, 3))) ? 0 : 1; glm::bvec2 Vec2C = glm::make_vec2(ArrayC); + Error += glm::all(glm::equal(Vec2C, glm::bvec2(true, false))) ? 0 : 1; + glm::bvec3 Vec3C = glm::make_vec3(ArrayC); + Error += glm::all(glm::equal(Vec3C, glm::bvec3(true, false, true))) ? 0 : 1; + glm::bvec4 Vec4C = glm::make_vec4(ArrayC); + Error += glm::all(glm::equal(Vec4C, glm::bvec4(true, false, true, false))) ? 0 : 1; return Error; } -int test_make_vec1() +static int test_make_vec1() { int Error = 0; @@ -254,12 +306,12 @@ int test_make_vec1() Error += v3 == glm::ivec1(2) ? 0 : 1; glm::ivec1 const v4 = glm::make_vec1(glm::ivec4(2)); - Error += v3 == glm::ivec1(2) ? 0 : 1; + Error += v4 == glm::ivec1(2) ? 0 : 1; return Error; } -int test_make_vec2() +static int test_make_vec2() { int Error = 0; @@ -273,12 +325,12 @@ int test_make_vec2() Error += v3 == glm::ivec2(2, 2) ? 0 : 1; glm::ivec2 const v4 = glm::make_vec2(glm::ivec4(2)); - Error += v3 == glm::ivec2(2, 2) ? 0 : 1; + Error += v4 == glm::ivec2(2, 2) ? 0 : 1; return Error; } -int test_make_vec3() +static int test_make_vec3() { int Error = 0; @@ -292,12 +344,12 @@ int test_make_vec3() Error += v3 == glm::ivec3(2, 2, 2) ? 0 : 1; glm::ivec3 const v4 = glm::make_vec3(glm::ivec4(2)); - Error += v3 == glm::ivec3(2, 2, 2) ? 0 : 1; + Error += v4 == glm::ivec3(2, 2, 2) ? 0 : 1; return Error; } -int test_make_vec4() +static int test_make_vec4() { int Error = 0; diff --git a/test/gtc/gtc_ulp.cpp b/test/gtc/gtc_ulp.cpp index d5074a3d20..f148c9af20 100644 --- a/test/gtc/gtc_ulp.cpp +++ b/test/gtc/gtc_ulp.cpp @@ -2,7 +2,7 @@ #include #include -int test_ulp_float_dist() +static int test_ulp_float_dist() { int Error = 0; @@ -21,7 +21,7 @@ int test_ulp_float_dist() return Error; } -int test_ulp_float_step() +static int test_ulp_float_step() { int Error = 0; @@ -43,7 +43,7 @@ int test_ulp_float_step() return Error; } -int test_ulp_double_dist() +static int test_ulp_double_dist() { int Error = 0; @@ -62,7 +62,7 @@ int test_ulp_double_dist() return Error; } -int test_ulp_double_step() +static int test_ulp_double_step() { int Error = 0; diff --git a/test/gtx/gtx_color_encoding.cpp b/test/gtx/gtx_color_encoding.cpp index 8b499be3a8..e344403946 100644 --- a/test/gtx/gtx_color_encoding.cpp +++ b/test/gtx/gtx_color_encoding.cpp @@ -1,3 +1,4 @@ +#define GLM_ENABLE_EXPERIMENTAL #include #include #include @@ -5,7 +6,7 @@ namespace srgb { - int test() + static int test() { int Error(0); diff --git a/test/gtx/gtx_color_space.cpp b/test/gtx/gtx_color_space.cpp index a23d2c86b1..50e1eaa6c7 100644 --- a/test/gtx/gtx_color_space.cpp +++ b/test/gtx/gtx_color_space.cpp @@ -1,11 +1,27 @@ +#include +#include + #define GLM_ENABLE_EXPERIMENTAL #include -int test_saturation() +static int test_hsv() { - int Error(0); + int Error = 0; + + glm::vec3 colorHSV = glm::hsvColor(glm::vec3(1.0f, 0.5f, 0.0f)); + glm::vec3 colorRGB = glm::rgbColor(colorHSV); + + Error += glm::all(glm::equal(colorRGB, glm::vec3(1.0f, 0.5f, 0.0f), glm::epsilon())) ? 0 : 1; + + return Error; +} + +static int test_saturation() +{ + int Error = 0; glm::vec4 Color = glm::saturation(1.0f, glm::vec4(1.0, 0.5, 0.0, 1.0)); + Error += glm::all(glm::equal(Color, glm::vec4(1.0, 0.5, 0.0, 1.0), glm::epsilon())) ? 0 : 1; return Error; } @@ -14,6 +30,7 @@ int main() { int Error(0); + Error += test_hsv(); Error += test_saturation(); return Error; diff --git a/test/gtx/gtx_color_space_YCoCg.cpp b/test/gtx/gtx_color_space_YCoCg.cpp index 2ca131dc1d..d46981f7c4 100644 --- a/test/gtx/gtx_color_space_YCoCg.cpp +++ b/test/gtx/gtx_color_space_YCoCg.cpp @@ -1,9 +1,17 @@ +#include +#include + #define GLM_ENABLE_EXPERIMENTAL #include int main() { - int Error(0); + int Error = 0; + + glm::vec3 colorYCoCg = glm::rgb2YCoCg(glm::vec3(1.0f, 0.5f, 0.0f)); + glm::vec3 colorRGB1 = glm::YCoCg2rgb(colorYCoCg); + + Error += glm::all(glm::equal(colorRGB1, glm::vec3(1.0f, 0.5f, 0.0f), glm::epsilon())) ? 0 : 1; return Error; } diff --git a/test/gtx/gtx_common.cpp b/test/gtx/gtx_common.cpp index fd4fa99bdd..3dd88f871f 100644 --- a/test/gtx/gtx_common.cpp +++ b/test/gtx/gtx_common.cpp @@ -13,7 +13,7 @@ namespace fmod_ return a - b * glm::trunc(a / b); } - int test() + static int test() { int Error(0); @@ -104,7 +104,7 @@ namespace fmod_ } }//namespace fmod_ -int test_isdenormal() +static int test_isdenormal() { int Error = 0; @@ -126,7 +126,7 @@ int test_isdenormal() return Error; } -int test_openBounded() +static int test_openBounded() { int Error = 0; @@ -137,7 +137,7 @@ int test_openBounded() return Error; } -int test_closeBounded() +static int test_closeBounded() { int Error = 0; diff --git a/test/gtx/gtx_component_wise.cpp b/test/gtx/gtx_component_wise.cpp index 29c81af4c7..9fab86f8fe 100644 --- a/test/gtx/gtx_component_wise.cpp +++ b/test/gtx/gtx_component_wise.cpp @@ -7,7 +7,7 @@ namespace compNormalize { - int run() + static int run() { int Error(0); @@ -61,7 +61,7 @@ namespace compNormalize namespace compScale { - int run() + static int run() { int Error(0); diff --git a/test/gtx/gtx_dual_quaternion.cpp b/test/gtx/gtx_dual_quaternion.cpp index ceedc2c2e3..e6b6757823 100644 --- a/test/gtx/gtx_dual_quaternion.cpp +++ b/test/gtx/gtx_dual_quaternion.cpp @@ -9,18 +9,18 @@ # include #endif -int myrand() +static int myrand() { static int holdrand = 1; return (((holdrand = holdrand * 214013L + 2531011L) >> 16) & 0x7fff); } -float myfrand() // returns values from -1 to 1 inclusive +static float myfrand() // returns values from -1 to 1 inclusive { return float(double(myrand()) / double( 0x7ffff )) * 2.0f - 1.0f; } -int test_dquat_type() +static int test_dquat_type() { glm::dvec3 vA; glm::dquat dqA, dqB; @@ -30,7 +30,7 @@ int test_dquat_type() return 0; } -int test_scalars() +static int test_scalars() { float const Epsilon = 0.0001f; @@ -62,7 +62,7 @@ int test_scalars() return Error; } -int test_inverse() +static int test_inverse() { int Error(0); @@ -102,7 +102,7 @@ int test_inverse() return Error; } -int test_mul() +static int test_mul() { int Error(0); @@ -157,7 +157,7 @@ int test_mul() return Error; } -int test_dual_quat_ctr() +static int test_dual_quat_ctr() { int Error(0); @@ -176,7 +176,7 @@ int test_dual_quat_ctr() return Error; } -int test_size() +static int test_size() { int Error = 0; diff --git a/test/gtx/gtx_easing.cpp b/test/gtx/gtx_easing.cpp index 0e98cd53dc..e99173d450 100644 --- a/test/gtx/gtx_easing.cpp +++ b/test/gtx/gtx_easing.cpp @@ -5,9 +5,8 @@ namespace { - template - void _test_easing() + static void _test_easing() { T a = static_cast(0.5); T r; @@ -50,7 +49,6 @@ namespace r = glm::bounceEaseOut(a); r = glm::bounceEaseInOut(a); } - } int main() diff --git a/test/gtx/gtx_euler_angle.cpp b/test/gtx/gtx_euler_angle.cpp index 348f581874..086f04d8c4 100644 --- a/test/gtx/gtx_euler_angle.cpp +++ b/test/gtx/gtx_euler_angle.cpp @@ -13,7 +13,7 @@ namespace test_eulerAngleX { - int test() + static int test() { int Error = 0; @@ -56,7 +56,7 @@ namespace test_eulerAngleX namespace test_eulerAngleY { - int test() + static int test() { int Error = 0; @@ -99,7 +99,7 @@ namespace test_eulerAngleY namespace test_eulerAngleZ { - int test() + static int test() { int Error = 0; @@ -142,7 +142,7 @@ namespace test_eulerAngleZ namespace test_derivedEulerAngles { - bool epsilonEqual(glm::mat4 const& mat1, glm::mat4 const& mat2, glm::mat4::value_type const& epsilon) + static bool epsilonEqual(glm::mat4 const& mat1, glm::mat4 const& mat2, glm::mat4::value_type const& epsilon) { return glm::all(glm::epsilonEqual(mat1[0], mat2[0], epsilon)) ? ( @@ -157,7 +157,7 @@ namespace test_derivedEulerAngles } template - int test(RotationFunc rotationFunc, TestDerivedFunc testDerivedFunc, const glm::vec3& basis) + static int test(RotationFunc rotationFunc, TestDerivedFunc testDerivedFunc, const glm::vec3& basis) { int Error = 0; @@ -198,7 +198,7 @@ namespace test_derivedEulerAngles namespace test_eulerAngleXY { - int test() + static int test() { int Error = 0; @@ -222,7 +222,7 @@ namespace test_eulerAngleXY namespace test_eulerAngleYX { - int test() + static int test() { int Error = 0; @@ -246,7 +246,7 @@ namespace test_eulerAngleYX namespace test_eulerAngleXZ { - int test() + static int test() { int Error = 0; @@ -270,7 +270,7 @@ namespace test_eulerAngleXZ namespace test_eulerAngleZX { - int test() + static int test() { int Error = 0; @@ -294,7 +294,7 @@ namespace test_eulerAngleZX namespace test_eulerAngleYZ { - int test() + static int test() { int Error = 0; @@ -319,7 +319,7 @@ namespace test_eulerAngleYZ namespace test_eulerAngleZY { - int test() + static int test() { int Error = 0; @@ -344,7 +344,7 @@ namespace test_eulerAngleZY namespace test_eulerAngleYXZ { - int test() + static int test() { glm::f32 first = 1.046f; glm::f32 second = 0.52f; @@ -373,7 +373,7 @@ namespace test_eulerAngleYXZ namespace test_eulerAngles { template - int test(TestRotationFunc testRotationFunc, glm::vec3 const& I, glm::vec3 const& J, glm::vec3 const& K) + static int test(TestRotationFunc testRotationFunc, glm::vec3 const& I, glm::vec3 const& J, glm::vec3 const& K) { int Error = 0; @@ -432,7 +432,7 @@ namespace test_eulerAngles namespace test_extractsEulerAngles { template - int test(RotationFunc rotationFunc, TestExtractionFunc testExtractionFunc) + static int test(RotationFunc rotationFunc, TestExtractionFunc testExtractionFunc) { int Error = 0; diff --git a/test/gtx/gtx_extended_min_max.cpp b/test/gtx/gtx_extended_min_max.cpp index 3d20f10e26..dcd6fb3178 100644 --- a/test/gtx/gtx_extended_min_max.cpp +++ b/test/gtx/gtx_extended_min_max.cpp @@ -54,7 +54,7 @@ namespace fmax_ Error += glm::equal(A0.x, 1.0f, glm::epsilon()) ? 0 : 1; glm::vec1 A1 = glm::fmax(glm::vec1(Zero_f / 0.0f), glm::vec1(1)); - Error += glm::equal(A0.x, 1.0f, glm::epsilon()) ? 0 : 1; + Error += glm::equal(A1.x, 1.0f, glm::epsilon()) ? 0 : 1; glm::vec2 B0 = glm::fmax(glm::vec2(1), glm::vec2(1)); glm::vec2 B1 = glm::fmax(glm::vec2(1), 1.0f); diff --git a/test/gtx/gtx_exterior_product.cpp b/test/gtx/gtx_exterior_product.cpp index a02c98303d..7fd8b1d534 100644 --- a/test/gtx/gtx_exterior_product.cpp +++ b/test/gtx/gtx_exterior_product.cpp @@ -1,3 +1,4 @@ +#define GLM_ENABLE_EXPERIMENTAL #include #include #include diff --git a/test/gtx/gtx_fast_square_root.cpp b/test/gtx/gtx_fast_square_root.cpp index 80d7fe4b79..07ca30cb7c 100644 --- a/test/gtx/gtx_fast_square_root.cpp +++ b/test/gtx/gtx_fast_square_root.cpp @@ -4,7 +4,7 @@ #include #include -int test_fastInverseSqrt() +static int test_fastInverseSqrt() { int Error = 0; @@ -17,7 +17,7 @@ int test_fastInverseSqrt() return Error; } -int test_fastDistance() +static int test_fastDistance() { int Error = 0; diff --git a/test/gtx/gtx_fast_trigonometry.cpp b/test/gtx/gtx_fast_trigonometry.cpp index e58ac9ccaa..b91cee957b 100644 --- a/test/gtx/gtx_fast_trigonometry.cpp +++ b/test/gtx/gtx_fast_trigonometry.cpp @@ -15,7 +15,7 @@ namespace fastCos { - int perf(bool NextFloat) + static int perf(bool NextFloat) { const float begin = -glm::pi(); const float end = glm::pi(); @@ -51,7 +51,7 @@ namespace fastSin } */ - int perf(bool NextFloat) + static int perf(bool NextFloat) { const float begin = -glm::pi(); const float end = glm::pi(); @@ -79,7 +79,7 @@ namespace fastSin namespace fastTan { - int perf(bool NextFloat) + static int perf(bool NextFloat) { const float begin = -glm::pi(); const float end = glm::pi(); @@ -107,7 +107,7 @@ namespace fastTan namespace fastAcos { - int perf(bool NextFloat) + static int perf(bool NextFloat) { const float begin = -glm::pi(); const float end = glm::pi(); @@ -136,7 +136,7 @@ namespace fastAcos namespace fastAsin { - int perf(bool NextFloat) + static int perf(bool NextFloat) { const float begin = -glm::pi(); const float end = glm::pi(); @@ -161,7 +161,7 @@ namespace fastAsin namespace fastAtan { - int perf(bool NextFloat) + static int perf(bool NextFloat) { const float begin = -glm::pi(); const float end = glm::pi(); @@ -188,11 +188,20 @@ namespace taylorCos { using glm::qualifier; using glm::length_t; - + +# if (GLM_COMPILER & GLM_COMPILER_CLANG) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wglobal-constructors" +# endif + glm::vec4 const AngleShift(0.0f, glm::half_pi(), glm::pi(), glm::three_over_two_pi()); +# if (GLM_COMPILER & GLM_COMPILER_CLANG) +# pragma clang diagnostic pop +# endif + template - GLM_FUNC_QUALIFIER glm::vec taylorSeriesNewCos(glm::vec const& x) + static GLM_FUNC_QUALIFIER glm::vec taylorSeriesNewCos(glm::vec const& x) { glm::vec const Powed2(x * x); glm::vec const Powed4(Powed2 * Powed2); @@ -205,9 +214,9 @@ namespace taylorCos - Powed6 * static_cast(0.00138888888888888888888888888889) + Powed8 * static_cast(2.4801587301587301587301587301587e-5); } - +/* template - GLM_FUNC_QUALIFIER glm::vec taylorSeriesNewCos6(glm::vec const& x) + static GLM_FUNC_QUALIFIER glm::vec taylorSeriesNewCos6(glm::vec const& x) { glm::vec const Powed2(x * x); glm::vec const Powed4(Powed2 * Powed2); @@ -218,9 +227,10 @@ namespace taylorCos + Powed4 * static_cast(0.04166666666666666666666666666667) - Powed6 * static_cast(0.00138888888888888888888888888889); } - +*/ +/* template - GLM_FUNC_QUALIFIER glm::vec fastAbs(glm::vec x) + static GLM_FUNC_QUALIFIER glm::vec fastAbs(glm::vec x) { int* Pointer = reinterpret_cast(&x[0]); Pointer[0] &= 0x7fffffff; @@ -231,22 +241,21 @@ namespace taylorCos } template - GLM_FUNC_QUALIFIER glm::vec fastCosNew(glm::vec const& x) + static GLM_FUNC_QUALIFIER glm::vec fastCosNew(glm::vec const& x) { glm::vec const Angle0_PI(fastAbs(fmod(x + glm::pi(), glm::two_pi()) - glm::pi())); return taylorSeriesNewCos6(x); -/* - vec const FirstQuarterPi(lessThanEqual(Angle0_PI, vec(glm::half_pi()))); +// vec const FirstQuarterPi(lessThanEqual(Angle0_PI, vec(glm::half_pi()))); - vec const RevertAngle(mix(vec(glm::pi()), vec(0), FirstQuarterPi)); - vec const ReturnSign(mix(vec(-1), vec(1), FirstQuarterPi)); - vec const SectionAngle(RevertAngle - Angle0_PI); +// vec const RevertAngle(mix(vec(glm::pi()), vec(0), FirstQuarterPi)); +// vec const ReturnSign(mix(vec(-1), vec(1), FirstQuarterPi)); +// vec const SectionAngle(RevertAngle - Angle0_PI); - return ReturnSign * taylorSeriesNewCos(SectionAngle); -*/ +// return ReturnSign * taylorSeriesNewCos(SectionAngle); } - - int perf_fastCosNew(float Begin, float End, std::size_t Samples) +*/ +/* + static int perf_fastCosNew(float Begin, float End, std::size_t Samples) { std::vector Results; Results.resize(Samples); @@ -267,15 +276,15 @@ namespace taylorCos Error += Results[i].x >= -1.0f && Results[i].x <= 1.0f ? 0 : 1; return Error; } - +*/ template - GLM_FUNC_QUALIFIER glm::vec deterministic_fmod(glm::vec const& x, T y) + static GLM_FUNC_QUALIFIER glm::vec deterministic_fmod(glm::vec const& x, T y) { return x - y * trunc(x / y); } template - GLM_FUNC_QUALIFIER glm::vec fastCosDeterminisctic(glm::vec const& x) + static GLM_FUNC_QUALIFIER glm::vec fastCosDeterminisctic(glm::vec const& x) { glm::vec const Angle0_PI(abs(deterministic_fmod(x + glm::pi(), glm::two_pi()) - glm::pi())); glm::vec const FirstQuarterPi(lessThanEqual(Angle0_PI, glm::vec(glm::half_pi()))); @@ -287,7 +296,7 @@ namespace taylorCos return ReturnSign * taylorSeriesNewCos(SectionAngle); } - int perf_fastCosDeterminisctic(float Begin, float End, std::size_t Samples) + static int perf_fastCosDeterminisctic(float Begin, float End, std::size_t Samples) { std::vector Results; Results.resize(Samples); @@ -310,7 +319,7 @@ namespace taylorCos } template - GLM_FUNC_QUALIFIER glm::vec taylorSeriesRefCos(glm::vec const& x) + static GLM_FUNC_QUALIFIER glm::vec taylorSeriesRefCos(glm::vec const& x) { return static_cast(1) - (x * x) / glm::factorial(static_cast(2)) @@ -320,7 +329,7 @@ namespace taylorCos } template - GLM_FUNC_QUALIFIER glm::vec fastRefCos(glm::vec const& x) + static GLM_FUNC_QUALIFIER glm::vec fastRefCos(glm::vec const& x) { glm::vec const Angle0_PI(glm::abs(fmod(x + glm::pi(), glm::two_pi()) - glm::pi())); // return taylorSeriesRefCos(Angle0_PI); @@ -334,7 +343,7 @@ namespace taylorCos return ReturnSign * taylorSeriesRefCos(SectionAngle); } - int perf_fastCosRef(float Begin, float End, std::size_t Samples) + static int perf_fastCosRef(float Begin, float End, std::size_t Samples) { std::vector Results; Results.resize(Samples); @@ -356,7 +365,7 @@ namespace taylorCos return Error; } - int perf_fastCosOld(float Begin, float End, std::size_t Samples) + static int perf_fastCosOld(float Begin, float End, std::size_t Samples) { std::vector Results; Results.resize(Samples); @@ -378,7 +387,7 @@ namespace taylorCos return Error; } - int perf_cos(float Begin, float End, std::size_t Samples) + static int perf_cos(float Begin, float End, std::size_t Samples) { std::vector Results; Results.resize(Samples); @@ -400,7 +409,7 @@ namespace taylorCos return Error; } - int perf(std::size_t const Samples) + static int perf(std::size_t const Samples) { int Error = 0; @@ -416,7 +425,7 @@ namespace taylorCos return Error; } - int test() + static int test() { int Error = 0; @@ -444,9 +453,18 @@ namespace taylorCos namespace taylor2 { +# if (GLM_COMPILER & GLM_COMPILER_CLANG) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wglobal-constructors" +# endif + glm::vec4 const AngleShift(0.0f, glm::pi() * 0.5f, glm::pi() * 1.0f, glm::pi() * 1.5f); - float taylorCosA(float x) +# if (GLM_COMPILER & GLM_COMPILER_CLANG) +# pragma clang diagnostic pop +# endif + + static float taylorCosA(float x) { return 1.f - (x * x) * (1.f / 2.f) @@ -455,7 +473,7 @@ namespace taylor2 + (x * x * x * x * x * x * x * x) * (1.f / 40320.f); } - float taylorCosB(float x) + static float taylorCosB(float x) { return 1.f - (x * x) * (1.f / 2.f) @@ -464,7 +482,7 @@ namespace taylor2 + (x * x * x * x * x * x * x * x) * (1.f / 40320.f); } - float taylorCosC(float x) + static float taylorCosC(float x) { return 1.f - (x * x) * (1.f / 2.f) @@ -473,7 +491,7 @@ namespace taylor2 + (((x * x) * (x * x)) * ((x * x) * (x * x))) * (1.f / 40320.f); } - int perf_taylorCosA(float Begin, float End, std::size_t Samples) + static int perf_taylorCosA(float Begin, float End, std::size_t Samples) { std::vector Results; Results.resize(Samples); @@ -495,7 +513,7 @@ namespace taylor2 return Error; } - int perf_taylorCosB(float Begin, float End, std::size_t Samples) + static int perf_taylorCosB(float Begin, float End, std::size_t Samples) { std::vector Results; Results.resize(Samples); @@ -517,7 +535,7 @@ namespace taylor2 return Error; } - int perf_taylorCosC(float Begin, float End, std::size_t Samples) + static int perf_taylorCosC(float Begin, float End, std::size_t Samples) { std::vector Results; Results.resize(Samples); @@ -539,7 +557,7 @@ namespace taylor2 return Error; } - int perf(std::size_t Samples) + static int perf(std::size_t Samples) { int Error = 0; @@ -563,14 +581,12 @@ int main() Error += ::taylorCos::test(); Error += ::taylorCos::perf(1000); -# ifdef NDEBUG - ::fastCos::perf(false); - ::fastSin::perf(false); - ::fastTan::perf(false); - ::fastAcos::perf(false); - ::fastAsin::perf(false); - ::fastAtan::perf(false); -# endif//NDEBUG + ::fastCos::perf(false); + ::fastSin::perf(false); + ::fastTan::perf(false); + ::fastAcos::perf(false); + ::fastAsin::perf(false); + ::fastAtan::perf(false); return Error; } diff --git a/test/gtx/gtx_functions.cpp b/test/gtx/gtx_functions.cpp index 48a6af0e9b..9b2caaa927 100644 --- a/test/gtx/gtx_functions.cpp +++ b/test/gtx/gtx_functions.cpp @@ -1,8 +1,9 @@ +#define GLM_ENABLE_EXPERIMENTAL #include #include #include -int test_gauss_1d() +static int test_gauss_1d() { int Error = 0; @@ -13,7 +14,7 @@ int test_gauss_1d() return Error; } -int test_gauss_2d() +static int test_gauss_2d() { int Error = 0; diff --git a/test/gtx/gtx_gradient_paint.cpp b/test/gtx/gtx_gradient_paint.cpp index 01f521bf24..baa0fa0722 100644 --- a/test/gtx/gtx_gradient_paint.cpp +++ b/test/gtx/gtx_gradient_paint.cpp @@ -1,7 +1,7 @@ #define GLM_ENABLE_EXPERIMENTAL #include -int test_radialGradient() +static int test_radialGradient() { int Error = 0; @@ -11,7 +11,7 @@ int test_radialGradient() return Error; } -int test_linearGradient() +static int test_linearGradient() { int Error = 0; diff --git a/test/gtx/gtx_integer.cpp b/test/gtx/gtx_integer.cpp index 4c4225d95e..9bc510d286 100644 --- a/test/gtx/gtx_integer.cpp +++ b/test/gtx/gtx_integer.cpp @@ -4,7 +4,7 @@ #include #include /* -int test_floor_log2() +static int test_floor_log2() { int Error = 0; @@ -20,7 +20,7 @@ int test_floor_log2() return Error; } */ -int test_log2() +static int test_log2() { int Error = 0; @@ -41,18 +41,18 @@ int test_log2() return Error; } -int test_nlz() +static int test_nlz() { int Error = 0; for(glm::uint i = 1; i < glm::uint(33); ++i) - Error += glm::nlz(i) == glm::uint(31u) - glm::findMSB(i) ? 0 : 1; + Error += glm::nlz(i) == 31u - static_cast(glm::findMSB(i)) ? 0 : 1; //printf("%d, %d\n", glm::nlz(i), 31u - glm::findMSB(i)); return Error; } -int test_pow_uint() +static int test_pow_uint() { int Error = 0; @@ -68,7 +68,7 @@ int test_pow_uint() return Error; } -int test_pow_int() +static int test_pow_int() { int Error = 0; diff --git a/test/gtx/gtx_intersect.cpp b/test/gtx/gtx_intersect.cpp index c4a1b2a50c..1e141c5dd4 100644 --- a/test/gtx/gtx_intersect.cpp +++ b/test/gtx/gtx_intersect.cpp @@ -3,7 +3,7 @@ #include #include -int test_intersectRayPlane() +static int test_intersectRayPlane() { int Error = 0; glm::vec3 const PlaneOrigin(0, 0, 1); @@ -36,7 +36,7 @@ int test_intersectRayPlane() return Error; } -int test_intersectRayTriangle() +static int test_intersectRayTriangle() { int Error = 0; @@ -57,7 +57,7 @@ int test_intersectRayTriangle() return Error; } -int test_intersectLineTriangle() +static int test_intersectLineTriangle() { int Error = 0; diff --git a/test/gtx/gtx_io.cpp b/test/gtx/gtx_io.cpp index 7d90fd7805..2d3f87334e 100644 --- a/test/gtx/gtx_io.cpp +++ b/test/gtx/gtx_io.cpp @@ -1,7 +1,7 @@ -#define GLM_ENABLE_EXPERIMENTAL #include #if GLM_LANG & GLM_LANG_CXXMS_FLAG #include +#define GLM_ENABLE_EXPERIMENTAL #include #include #include @@ -10,7 +10,7 @@ namespace { template - std::basic_ostream& operator<<(std::basic_ostream& os, glm::qualifier const& a) + static std::basic_ostream& operator<<(std::basic_ostream& os, glm::qualifier const& a) { typename std::basic_ostream::sentry const cerberus(os); @@ -32,7 +32,7 @@ namespace } template - std::basic_string type_name(std::basic_ostream&, T const&) + static std::basic_string type_name(std::basic_ostream&, T const&) { std::basic_ostringstream ostr; @@ -58,7 +58,7 @@ namespace } // namespace { template -int test_io_quat(OS& os) +static int test_io_quat(OS& os) { os << '\n' << typeid(OS).name() << '\n'; @@ -82,7 +82,7 @@ int test_io_quat(OS& os) } template -int test_io_vec(OS& os) +static int test_io_vec(OS& os) { os << '\n' << typeid(OS).name() << '\n'; @@ -105,7 +105,7 @@ int test_io_vec(OS& os) } template -int test_io_mat(OS& os, glm::io::order_type otype) +static int test_io_mat(OS& os, glm::io::order_type otype) { os << '\n' << typeid(OS).name() << '\n'; diff --git a/test/gtx/gtx_load.cpp b/test/gtx/gtx_load.cpp index 1467b9b137..7c39b79525 100644 --- a/test/gtx/gtx_load.cpp +++ b/test/gtx/gtx_load.cpp @@ -1,8 +1,8 @@ -#define GLM_ENABLE_EXPERIMENTAL #include /* #if GLM_CONFIG_SIMD == GLM_ENABLE +#define GLM_ENABLE_EXPERIMENTAL #include #include #include diff --git a/test/gtx/gtx_log_base.cpp b/test/gtx/gtx_log_base.cpp index 37c746439d..cbe9a11669 100644 --- a/test/gtx/gtx_log_base.cpp +++ b/test/gtx/gtx_log_base.cpp @@ -6,7 +6,7 @@ namespace test_log { - int run() + static int run() { int Error = 0; diff --git a/test/gtx/gtx_matrix_factorisation.cpp b/test/gtx/gtx_matrix_factorisation.cpp index 6771dbac08..1ff8353195 100644 --- a/test/gtx/gtx_matrix_factorisation.cpp +++ b/test/gtx/gtx_matrix_factorisation.cpp @@ -4,7 +4,7 @@ #include template -int test_qr(glm::mat m) +static int test_qr(glm::mat m) { int Error = 0; @@ -41,7 +41,7 @@ int test_qr(glm::mat m) } template -int test_rq(glm::mat m) +static int test_rq(glm::mat m) { int Error = 0; diff --git a/test/gtx/gtx_matrix_interpolation.cpp b/test/gtx/gtx_matrix_interpolation.cpp index 108f02e975..4d37cb33c1 100644 --- a/test/gtx/gtx_matrix_interpolation.cpp +++ b/test/gtx/gtx_matrix_interpolation.cpp @@ -39,7 +39,7 @@ static int test_axisAngle() } template -int testForAxisAngle(glm::vec<3, T, glm::defaultp> const axisTrue, T const angleTrue) +static int testForAxisAngle(glm::vec<3, T, glm::defaultp> const axisTrue, T const angleTrue) { T const eps = std::sqrt(std::numeric_limits::epsilon()); diff --git a/test/gtx/gtx_matrix_operation.cpp b/test/gtx/gtx_matrix_operation.cpp index 79c95c5285..eabb3abf83 100644 --- a/test/gtx/gtx_matrix_operation.cpp +++ b/test/gtx/gtx_matrix_operation.cpp @@ -4,7 +4,7 @@ #include #include -int test_adjugate() +static int test_adjugate() { int Error = 0; diff --git a/test/gtx/gtx_matrix_query.cpp b/test/gtx/gtx_matrix_query.cpp index 744d3e587d..26808916f4 100644 --- a/test/gtx/gtx_matrix_query.cpp +++ b/test/gtx/gtx_matrix_query.cpp @@ -1,7 +1,7 @@ #define GLM_ENABLE_EXPERIMENTAL #include -int test_isNull() +static int test_isNull() { int Error(0); @@ -11,7 +11,7 @@ int test_isNull() return Error; } -int test_isIdentity() +static int test_isIdentity() { int Error(0); @@ -31,7 +31,7 @@ int test_isIdentity() return Error; } -int test_isNormalized() +static int test_isNormalized() { int Error(0); @@ -41,7 +41,7 @@ int test_isNormalized() return Error; } -int test_isOrthogonal() +static int test_isOrthogonal() { int Error(0); diff --git a/test/gtx/gtx_norm.cpp b/test/gtx/gtx_norm.cpp index e82102ac57..cc5fe4fc26 100644 --- a/test/gtx/gtx_norm.cpp +++ b/test/gtx/gtx_norm.cpp @@ -1,8 +1,7 @@ #define GLM_ENABLE_EXPERIMENTAL #include - -int test_lMaxNorm() +static int test_lMaxNorm() { int Error(0); @@ -19,7 +18,7 @@ int test_lMaxNorm() return Error; } -int test_lxNorm() +static int test_lxNorm() { int Error(0); diff --git a/test/gtx/gtx_pca.cpp b/test/gtx/gtx_pca.cpp index c56dc8c947..95de31234d 100644 --- a/test/gtx/gtx_pca.cpp +++ b/test/gtx/gtx_pca.cpp @@ -18,7 +18,7 @@ template<> GLM_INLINE GLM_CONSTEXPR double myEpsilon() { return 0.000001; } template -bool vectorEpsilonEqual(glm::vec const& a, glm::vec const& b, T epsilon) +static bool vectorEpsilonEqual(glm::vec const& a, glm::vec const& b, T epsilon) { for (int c = 0; c < D; ++c) if (!glm::epsilonEqual(a[c], b[c], epsilon)) @@ -35,7 +35,7 @@ bool vectorEpsilonEqual(glm::vec const& a, glm::vec const& b, } template -bool matrixEpsilonEqual(glm::mat const& a, glm::mat const& b, T epsilon) +static bool matrixEpsilonEqual(glm::mat const& a, glm::mat const& b, T epsilon) { for (int c = 0; c < D; ++c) for (int r = 0; r < D; ++r) @@ -59,7 +59,7 @@ GLM_INLINE bool sameSign(T const& a, T const& b) } template -T failReport(T line) +static T failReport(T line) { fprintf(stderr, "Failed in line %d\n", static_cast(line)); return line; @@ -74,7 +74,7 @@ namespace agarose // Fills `outTestData` with hard-coded atom positions from 1AGA // The fourth coordinate is randomized template - void fillTestData(std::vector& outTestData) + static void fillTestData(std::vector& outTestData) { // x,y,z coordinates copied from RCSB PDB file of 1AGA // w coordinate randomized with standard normal distribution @@ -337,7 +337,7 @@ namespace agarose // Compute center of gravity template -vec computeCenter(const std::vector& testData) +static vec computeCenter(const std::vector& testData) { double c[4]; std::fill(c, c + vec::length(), 0.0); @@ -355,7 +355,7 @@ vec computeCenter(const std::vector& testData) // Test sorting of Eigenvalue&Eigenvector lists. Use exhaustive search. template -int testEigenvalueSort() +static int testEigenvalueSort() { // Test input data: four arbitrary values static const glm::vec refVal( @@ -438,7 +438,7 @@ int testEigenvalueSort() // Test covariance matrix creation functions template -int testCovar( +static int testCovar( #if GLM_HAS_CXX11_STL == 1 glm::length_t dataSize, unsigned int randomEngineSeed #else // GLM_HAS_CXX11_STL == 1 @@ -501,7 +501,7 @@ int testCovar( // Computes eigenvalues and eigenvectors from well-known covariance matrix template -int testEigenvectors(T epsilon) +static int testEigenvectors(T epsilon) { typedef glm::vec vec; typedef glm::mat mat; @@ -536,7 +536,7 @@ int testEigenvectors(T epsilon) // - a uniformly sampled block // - reconstruct main axes // - check order of eigenvalues equals order of extends of block in direction of main axes -int smokeTest() +static int smokeTest() { using glm::vec3; using glm::mat3; @@ -583,7 +583,7 @@ int smokeTest() } #if GLM_HAS_CXX11_STL == 1 -int rndTest(unsigned int randomEngineSeed) +static int rndTest(unsigned int randomEngineSeed) { std::default_random_engine rndEng(randomEngineSeed); std::normal_distribution normalDist; diff --git a/test/gtx/gtx_quaternion.cpp b/test/gtx/gtx_quaternion.cpp index ed90faa335..68e30716cc 100644 --- a/test/gtx/gtx_quaternion.cpp +++ b/test/gtx/gtx_quaternion.cpp @@ -6,7 +6,7 @@ #include #include -int test_quat_fastMix() +static int test_quat_fastMix() { int Error = 0; @@ -23,7 +23,7 @@ int test_quat_fastMix() return Error; } -int test_quat_shortMix() +static int test_quat_shortMix() { int Error(0); @@ -40,7 +40,7 @@ int test_quat_shortMix() return Error; } -int test_orientation() +static int test_orientation() { int Error = 0; @@ -65,7 +65,7 @@ int test_orientation() return Error; } -int test_rotation() +static int test_rotation() { int Error(0); @@ -81,7 +81,7 @@ int test_rotation() return Error; } -int test_log() +static int test_log() { int Error(0); diff --git a/test/gtx/gtx_range.cpp b/test/gtx/gtx_range.cpp index 434731b9ac..39c207ecbb 100644 --- a/test/gtx/gtx_range.cpp +++ b/test/gtx/gtx_range.cpp @@ -8,7 +8,7 @@ #include -int test_vec() +static int test_vec() { int Error = 0; @@ -36,7 +36,7 @@ int test_vec() return Error; } -int test_mat() +static int test_mat() { int Error = 0; diff --git a/test/gtx/gtx_rotate_vector.cpp b/test/gtx/gtx_rotate_vector.cpp index becd63f4e3..0d7c7b5f7b 100644 --- a/test/gtx/gtx_rotate_vector.cpp +++ b/test/gtx/gtx_rotate_vector.cpp @@ -3,60 +3,71 @@ #include #include -int test_rotate() +static int test_rotate() { int Error = 0; glm::vec2 A = glm::rotate(glm::vec2(1, 0), glm::pi() * 0.5f); + Error += glm::all(glm::equal(A, glm::vec2(0.0f, 1.0f), glm::epsilon())) ? 0 : 1; + glm::vec3 B = glm::rotate(glm::vec3(1, 0, 0), glm::pi() * 0.5f, glm::vec3(0, 0, 1)); + Error += glm::all(glm::equal(B, glm::vec3(0.0f, 1.0f, 0.0f), glm::epsilon())) ? 0 : 1; + glm::vec4 C = glm::rotate(glm::vec4(1, 0, 0, 1), glm::pi() * 0.5f, glm::vec3(0, 0, 1)); - glm::vec3 D = glm::rotateX(glm::vec3(1, 0, 0), glm::pi() * 0.5f); - glm::vec4 E = glm::rotateX(glm::vec4(1, 0, 0, 1), glm::pi() * 0.5f); - glm::vec3 F = glm::rotateY(glm::vec3(1, 0, 0), glm::pi() * 0.5f); - glm::vec4 G = glm::rotateY(glm::vec4(1, 0, 0, 1), glm::pi() * 0.5f); - glm::vec3 H = glm::rotateZ(glm::vec3(1, 0, 0), glm::pi() * 0.5f); - glm::vec4 I = glm::rotateZ(glm::vec4(1, 0, 0,1 ), glm::pi() * 0.5f); - glm::mat4 O = glm::orientation(glm::normalize(glm::vec3(1)), glm::vec3(0, 0, 1)); + Error += glm::all(glm::equal(C, glm::vec4(0.0f, 1.0f, 0.0f, 1.0f), glm::epsilon())) ? 0 : 1; return Error; } -int test_rotateX() +static int test_rotateX() { int Error = 0; glm::vec3 D = glm::rotateX(glm::vec3(1, 0, 0), glm::pi() * 0.5f); + Error += glm::all(glm::equal(D, glm::vec3(1.0f, 0.0f, 0.0f), glm::epsilon())) ? 0 : 1; + glm::vec4 E = glm::rotateX(glm::vec4(1, 0, 0, 1), glm::pi() * 0.5f); + Error += glm::all(glm::equal(E, glm::vec4(1.0f, 0.0f, 0.0f, 1.0f), glm::epsilon())) ? 0 : 1; return Error; } -int test_rotateY() +static int test_rotateY() { int Error = 0; glm::vec3 F = glm::rotateY(glm::vec3(1, 0, 0), glm::pi() * 0.5f); + Error += glm::all(glm::equal(F, glm::vec3(0.0f, 0.0f, -1.0f), glm::epsilon())) ? 0 : 1; + glm::vec4 G = glm::rotateY(glm::vec4(1, 0, 0, 1), glm::pi() * 0.5f); + Error += glm::all(glm::equal(G, glm::vec4(0.0f, 0.0f, -1.0f, 1.0f), glm::epsilon())) ? 0 : 1; return Error; } -int test_rotateZ() +static int test_rotateZ() { int Error = 0; glm::vec3 H = glm::rotateZ(glm::vec3(1, 0, 0), glm::pi() * 0.5f); - glm::vec4 I = glm::rotateZ(glm::vec4(1, 0, 0,1 ), glm::pi() * 0.5f); + Error += glm::all(glm::equal(H, glm::vec3(0.0f, 1.0f, 0.0f), glm::epsilon())) ? 0 : 1; + + glm::vec4 I = glm::rotateZ(glm::vec4(1, 0, 0, 1), glm::pi() * 0.5f); + Error += glm::all(glm::equal(I, glm::vec4(0.0f, 1.0f, 0.0f, 1.0f), glm::epsilon())) ? 0 : 1; return Error; } -int test_orientation() +static int test_orientation() { int Error = 0; glm::mat4 O = glm::orientation(glm::normalize(glm::vec3(1)), glm::vec3(0, 0, 1)); + Error += glm::all(glm::equal(O[0], glm::vec4(0.79f, -0.21f,-0.58f, 0.0f), 0.1f)) ? 0 : 1; + Error += glm::all(glm::equal(O[1], glm::vec4(-0.21f, 0.79f,-0.58f, 0.0f), 0.1f)) ? 0 : 1; + Error += glm::all(glm::equal(O[2], glm::vec4(0.58f, 0.58f, 0.58f, 0.0f), 0.1f)) ? 0 : 1; + Error += glm::all(glm::equal(O[3], glm::vec4(0.0f, 0.0f, 0.0f, 1.0f), 0.1f)) ? 0 : 1; return Error; } diff --git a/test/gtx/gtx_spline.cpp b/test/gtx/gtx_spline.cpp index c93ee17aed..06d9dfb103 100644 --- a/test/gtx/gtx_spline.cpp +++ b/test/gtx/gtx_spline.cpp @@ -6,7 +6,7 @@ namespace catmullRom { - int test() + static int test() { int Error(0); @@ -34,7 +34,7 @@ namespace catmullRom namespace hermite { - int test() + static int test() { int Error(0); @@ -62,7 +62,7 @@ namespace hermite namespace cubic { - int test() + static int test() { int Error(0); diff --git a/test/gtx/gtx_string_cast.cpp b/test/gtx/gtx_string_cast.cpp index b04c8700fb..ff15760422 100644 --- a/test/gtx/gtx_string_cast.cpp +++ b/test/gtx/gtx_string_cast.cpp @@ -3,7 +3,7 @@ #include #include -int test_string_cast_vector() +static int test_string_cast_vector() { int Error = 0; @@ -106,7 +106,7 @@ int test_string_cast_vector() return Error; } -int test_string_cast_matrix() +static int test_string_cast_matrix() { int Error = 0; @@ -117,7 +117,7 @@ int test_string_cast_matrix() return Error; } -int test_string_cast_quaternion() +static int test_string_cast_quaternion() { int Error = 0; @@ -129,7 +129,7 @@ int test_string_cast_quaternion() } -int test_string_cast_dual_quaternion() +static int test_string_cast_dual_quaternion() { int Error = 0; diff --git a/test/gtx/gtx_texture.cpp b/test/gtx/gtx_texture.cpp index 0b98ed7536..530bbdef9e 100644 --- a/test/gtx/gtx_texture.cpp +++ b/test/gtx/gtx_texture.cpp @@ -2,7 +2,7 @@ #include #include -int test_levels() +static int test_levels() { int Error = 0; diff --git a/test/gtx/gtx_type_aligned.cpp b/test/gtx/gtx_type_aligned.cpp index bf391d5189..187fbc49e6 100644 --- a/test/gtx/gtx_type_aligned.cpp +++ b/test/gtx/gtx_type_aligned.cpp @@ -2,7 +2,7 @@ #include #include -int test_decl() +static int test_decl() { int Error(0); @@ -107,7 +107,7 @@ int test_decl() } template -void print(genType const& Mat0) +static void print(genType const& Mat0) { std::printf("mat4(\n"); std::printf("\tvec4(%2.9f, %2.9f, %2.9f, %2.9f)\n", static_cast(Mat0[0][0]), static_cast(Mat0[0][1]), static_cast(Mat0[0][2]), static_cast(Mat0[0][3])); @@ -116,7 +116,7 @@ void print(genType const& Mat0) std::printf("\tvec4(%2.9f, %2.9f, %2.9f, %2.9f))\n\n", static_cast(Mat0[3][0]), static_cast(Mat0[3][1]), static_cast(Mat0[3][2]), static_cast(Mat0[3][3])); } -int perf_mul() +static int perf_mul() { int Error = 0; diff --git a/test/gtx/gtx_type_trait.cpp b/test/gtx/gtx_type_trait.cpp index 9b96a3631c..1c4b18859d 100644 --- a/test/gtx/gtx_type_trait.cpp +++ b/test/gtx/gtx_type_trait.cpp @@ -6,8 +6,6 @@ int main() { int Error = 0; - - return Error; } diff --git a/test/gtx/gtx_vector_angle.cpp b/test/gtx/gtx_vector_angle.cpp index 4e8172b076..0c485f677f 100644 --- a/test/gtx/gtx_vector_angle.cpp +++ b/test/gtx/gtx_vector_angle.cpp @@ -3,7 +3,7 @@ #include #include -int test_angle() +static int test_angle() { int Error = 0; @@ -17,7 +17,7 @@ int test_angle() return Error; } -int test_orientedAngle_vec2() +static int test_orientedAngle_vec2() { int Error = 0; @@ -31,7 +31,7 @@ int test_orientedAngle_vec2() return Error; } -int test_orientedAngle_vec3() +static int test_orientedAngle_vec3() { int Error = 0; diff --git a/test/gtx/gtx_vector_query.cpp b/test/gtx/gtx_vector_query.cpp index 729f9e18a3..5ed826da16 100644 --- a/test/gtx/gtx_vector_query.cpp +++ b/test/gtx/gtx_vector_query.cpp @@ -4,7 +4,7 @@ #include #include -int test_areCollinear() +static int test_areCollinear() { int Error(0); @@ -26,7 +26,7 @@ int test_areCollinear() return Error; } -int test_areOrthogonal() +static int test_areOrthogonal() { int Error(0); @@ -36,7 +36,7 @@ int test_areOrthogonal() return Error; } -int test_isNormalized() +static int test_isNormalized() { int Error(0); @@ -46,7 +46,7 @@ int test_isNormalized() return Error; } -int test_isNull() +static int test_isNull() { int Error(0); @@ -56,7 +56,7 @@ int test_isNull() return Error; } -int test_areOrthonormal() +static int test_areOrthonormal() { int Error(0); diff --git a/test/gtx/gtx_wrap.cpp b/test/gtx/gtx_wrap.cpp index 2354cc8bc4..c755e4b11c 100644 --- a/test/gtx/gtx_wrap.cpp +++ b/test/gtx/gtx_wrap.cpp @@ -5,7 +5,7 @@ namespace clamp { - int test() + static int test() { int Error(0); @@ -42,7 +42,7 @@ namespace clamp namespace repeat { - int test() + static int test() { int Error(0); @@ -82,7 +82,7 @@ namespace repeat namespace mirrorClamp { - int test() + static int test() { int Error(0); @@ -131,7 +131,7 @@ namespace mirrorClamp namespace mirrorRepeat { - int test() + static int test() { int Error(0);