From adb03bee5cf430824a2e08c5d175311694a27397 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sun, 3 Jan 2016 16:03:30 +0100 Subject: [PATCH 01/15] Fixed ICC on Linux build errors #449 --- glm/detail/func_common.inl | 16 +++++++++++----- readme.md | 3 ++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/glm/detail/func_common.inl b/glm/detail/func_common.inl index 83252de4..338700b1 100644 --- a/glm/detail/func_common.inl +++ b/glm/detail/func_common.inl @@ -548,14 +548,16 @@ namespace detail # if GLM_HAS_CXX11_STL return std::isnan(x); -# elif GLM_COMPILER & (GLM_COMPILER_VC | GLM_COMPILER_INTEL) +# elif GLM_COMPILER & GLM_COMPILER_VC return _isnan(x) != 0; -# elif GLM_COMPILER & (GLM_COMPILER_GCC | (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM)) -# if GLM_PLATFORM & GLM_PLATFORM_ANDROID && __cplusplus < 201103L +# elif GLM_COMPILER & GLM_COMPILER_INTEL +# if GLM_PLATFORM & GLM_PLATFORM_WINDOWS return _isnan(x) != 0; # else - return std::isnan(x); + return ::isnan(x) != 0; # endif +# elif (GLM_COMPILER & (GLM_COMPILER_GCC | (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM))) && (GLM_PLATFORM & GLM_PLATFORM_ANDROID) && __cplusplus < 201103L + return _isnan(x) != 0; # elif GLM_COMPILER & GLM_COMPILER_CUDA return isnan(x) != 0; # else @@ -583,7 +585,11 @@ namespace detail # if GLM_HAS_CXX11_STL return std::isinf(x); # elif GLM_COMPILER & (GLM_COMPILER_INTEL | GLM_COMPILER_VC) - return _fpclass(x) == _FPCLASS_NINF || _fpclass(x) == _FPCLASS_PINF; +# if(GLM_PLATFORM & GLM_PLATFORM_WINDOWS) + return _fpclass(x) == _FPCLASS_NINF || _fpclass(x) == _FPCLASS_PINF; +# else + return ::isinf(x); +# endif # elif GLM_COMPILER & (GLM_COMPILER_GCC | (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM)) # if(GLM_PLATFORM & GLM_PLATFORM_ANDROID && __cplusplus < 201103L) return _isinf(x) != 0; diff --git a/readme.md b/readme.md index 8097856f..093dd0d1 100644 --- a/readme.md +++ b/readme.md @@ -51,11 +51,12 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate) ## Release notes -#### [GLM 0.9.7.2](https://github.com/g-truc/glm/tree/0.9.7) - 2015-XX-XX +#### [GLM 0.9.7.2](https://github.com/g-truc/glm/tree/0.9.7) - 2016-01-XX ##### Fixes: - Fixed GTC_round floorMultiple/ceilMultiple #412 - Fixed GTC_packing unpackUnorm3x10_1x2 #414 - Fixed GTC_matrix_inverse affineInverse #192 +- Fixed ICC on Linux build errors #449 #### [GLM 0.9.7.1](https://github.com/g-truc/glm/releases/tag/0.9.7.1) - 2015-09-07 ##### Improvements: From a754ab2e7eb522bf50629687d0208bae287d95ca Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sun, 3 Jan 2016 17:10:24 +0100 Subject: [PATCH 02/15] Fixed ICC on Linux build errors #449 --- glm/detail/setup.hpp | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index ebbdd45d..71a7b098 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -577,29 +577,20 @@ # endif # elif GLM_COMPILER & GLM_COMPILER_INTEL # ifdef _MSC_EXTENSIONS -# if __cplusplus >= 201402L -# define GLM_LANG (GLM_LANG_CXX14 | GLM_LANG_CXXMS_FLAG) -# elif __cplusplus >= 201103L -# define GLM_LANG (GLM_LANG_CXX11 | GLM_LANG_CXXMS_FLAG) -# elif GLM_COMPILER >= GLM_COMPILER_INTEL13 -# define GLM_LANG (GLM_LANG_CXX0X | GLM_LANG_CXXMS_FLAG) -# elif __cplusplus >= 199711L -# define GLM_LANG (GLM_LANG_CXX98 | GLM_LANG_CXXMS_FLAG) -# else -# define GLM_LANG (GLM_LANG_CXX | GLM_LANG_CXXMS_FLAG) -# endif +# define GLM_MSC_EXT GLM_LANG_CXXMS_FLAG # else -# if __cplusplus >= 201402L -# define GLM_LANG (GLM_LANG_CXX14 | GLM_LANG_CXXMS_FLAG) -# elif __cplusplus >= 201103L -# define GLM_LANG (GLM_LANG_CXX11 | GLM_LANG_CXXMS_FLAG) -# elif GLM_COMPILER >= GLM_COMPILER_INTEL13 -# define GLM_LANG (GLM_LANG_CXX0X | GLM_LANG_CXXMS_FLAG) -# elif __cplusplus >= 199711L -# define GLM_LANG (GLM_LANG_CXX98 | GLM_LANG_CXXMS_FLAG) -# else -# define GLM_LANG (GLM_LANG_CXX | GLM_LANG_CXXMS_FLAG) -# endif +# define GLM_MSC_EXT 0 +# endif +# if __cplusplus >= 201402L +# define GLM_LANG (GLM_LANG_CXX14 | GLM_MSC_EXT) +# elif __cplusplus >= 201103L +# define GLM_LANG (GLM_LANG_CXX11 | GLM_MSC_EXT) +# elif __INTEL_CXX11_MODE__ +# define GLM_LANG (GLM_LANG_CXX0X | GLM_MSC_EXT) +# elif __cplusplus >= 199711L +# define GLM_LANG (GLM_LANG_CXX98 | GLM_MSC_EXT) +# else +# define GLM_LANG (GLM_LANG_CXX | GLM_MSC_EXT) # endif # else // Unkown compiler # if __cplusplus >= 201402L From a827b248ef50a2623ae5cf893a4d89f417eeae4c Mon Sep 17 00:00:00 2001 From: Sven-Hendrik Haase Date: Wed, 23 Dec 2015 01:24:48 +0100 Subject: [PATCH 03/15] Fix wrong docs The function this function is a helper of is using radians. In fact, glm is using radians everywhere! --- glm/gtx/transform.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glm/gtx/transform.hpp b/glm/gtx/transform.hpp index 7e6a4a73..5d22fba5 100644 --- a/glm/gtx/transform.hpp +++ b/glm/gtx/transform.hpp @@ -64,7 +64,7 @@ namespace glm GLM_FUNC_DECL tmat4x4 translate( tvec3 const & v); - /// Builds a rotation 4 * 4 matrix created from an axis of 3 scalars and an angle expressed in degrees. + /// Builds a rotation 4 * 4 matrix created from an axis of 3 scalars and an angle expressed in radians. /// @see gtc_matrix_transform /// @see gtx_transform template From 1936921ec7db980ee001c4b898fc689aca36ebf6 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Fri, 1 Jan 2016 14:30:14 +0100 Subject: [PATCH 04/15] Fixed log from GTX_lob_base build error with tests #470, #471 --- glm/gtx/log_base.hpp | 12 +++++------ test/gtx/gtx_log_base.cpp | 45 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 6 deletions(-) diff --git a/glm/gtx/log_base.hpp b/glm/gtx/log_base.hpp index 94d03472..e6c89ea2 100644 --- a/glm/gtx/log_base.hpp +++ b/glm/gtx/log_base.hpp @@ -53,15 +53,15 @@ namespace glm /// @addtogroup gtx_log_base /// @{ - //! Logarithm for any base. - //! From GLM_GTX_log_base. + /// Logarithm for any base. + /// From GLM_GTX_log_base. template GLM_FUNC_DECL genType log( - genType x, - genType base); + genType const & x, + genType const & base); - //! Logarithm for any base. - //! From GLM_GTX_log_base. + /// Logarithm for any base. + /// From GLM_GTX_log_base. template class vecType> GLM_FUNC_DECL vecType sign( vecType const & x, diff --git a/test/gtx/gtx_log_base.cpp b/test/gtx/gtx_log_base.cpp index b7cc9ae0..464b6eb1 100644 --- a/test/gtx/gtx_log_base.cpp +++ b/test/gtx/gtx_log_base.cpp @@ -30,10 +30,55 @@ /////////////////////////////////////////////////////////////////////////////////// #include +#include +#include +#include + +namespace test_log +{ + int run() + { + int Error = 0; + + { + float A = glm::log(10.f, 2.0f); + float B = glm::log2(10.f); + Error += glm::epsilonEqual(A, B, 0.00001f) ? 0 : 1; + } + + { + glm::vec1 A = glm::log(glm::vec1(10.f), glm::vec1(2.0f)); + glm::vec1 B = glm::log2(glm::vec1(10.f)); + Error += glm::all(glm::epsilonEqual(A, B, glm::vec1(0.00001f))) ? 0 : 1; + } + + { + glm::vec2 A = glm::log(glm::vec2(10.f), glm::vec2(2.0f)); + glm::vec2 B = glm::log2(glm::vec2(10.f)); + Error += glm::all(glm::epsilonEqual(A, B, glm::vec2(0.00001f))) ? 0 : 1; + } + + { + glm::vec3 A = glm::log(glm::vec3(10.f), glm::vec3(2.0f)); + glm::vec3 B = glm::log2(glm::vec3(10.f)); + Error += glm::all(glm::epsilonEqual(A, B, glm::vec3(0.00001f))) ? 0 : 1; + } + + { + glm::vec4 A = glm::log(glm::vec4(10.f), glm::vec4(2.0f)); + glm::vec4 B = glm::log2(glm::vec4(10.f)); + Error += glm::all(glm::epsilonEqual(A, B, glm::vec4(0.00001f))) ? 0 : 1; + } + + return Error; + } +}//namespace test_log int main() { int Error(0); + Error += test_log::run(); + return Error; } From 52c9f124e3cc9c3287d2f32299cae15a7996ef98 Mon Sep 17 00:00:00 2001 From: humbletim Date: Sat, 19 Dec 2015 19:22:33 -0500 Subject: [PATCH 05/15] Fixed ldexp and frexp compilation errors --- glm/detail/func_common.inl | 2 +- readme.md | 1 + test/core/core_func_common.cpp | 91 ++++++++++++++++++++++++++++++++++ 3 files changed, 93 insertions(+), 1 deletion(-) diff --git a/glm/detail/func_common.inl b/glm/detail/func_common.inl index 338700b1..9634255d 100644 --- a/glm/detail/func_common.inl +++ b/glm/detail/func_common.inl @@ -712,7 +712,7 @@ namespace detail frexp(x.w, exp.w)); } - template + template GLM_FUNC_QUALIFIER genType ldexp(genType const & x, int const & exp) { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'ldexp' only accept floating-point inputs"); diff --git a/readme.md b/readme.md index 093dd0d1..256e65ac 100644 --- a/readme.md +++ b/readme.md @@ -57,6 +57,7 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate) - Fixed GTC_packing unpackUnorm3x10_1x2 #414 - Fixed GTC_matrix_inverse affineInverse #192 - Fixed ICC on Linux build errors #449 +- Fixed ldexp and frexp compilation errors #### [GLM 0.9.7.1](https://github.com/g-truc/glm/releases/tag/0.9.7.1) - 2015-09-07 ##### Improvements: diff --git a/test/core/core_func_common.cpp b/test/core/core_func_common.cpp index ed4e5d5d..ec86ec76 100644 --- a/test/core/core_func_common.cpp +++ b/test/core/core_func_common.cpp @@ -1153,6 +1153,95 @@ namespace sign } }//namespace sign +namespace frexp_ +{ + int test() + { + int Error(0); + + { + glm::vec1 x(1024); + glm::ivec1 exp; + glm::vec1 A = glm::frexp(x, exp); + Error += glm::all(glm::epsilonEqual(A, glm::vec1(0.5), 0.00001f)) ? 0 : 1; + Error += glm::all(glm::equal(exp, glm::ivec1(11))) ? 0 : 1; + } + + { + glm::vec2 x(1024, 0.24); + glm::ivec2 exp; + glm::vec2 A = glm::frexp(x, exp); + Error += glm::all(glm::epsilonEqual(A, glm::vec2(0.5, 0.96), 0.00001f)) ? 0 : 1; + Error += glm::all(glm::equal(exp, glm::ivec2(11, -2))) ? 0 : 1; + } + + { + glm::vec3 x(1024, 0.24, 0); + glm::ivec3 exp; + glm::vec3 A = glm::frexp(x, exp); + Error += glm::all(glm::epsilonEqual(A, glm::vec3(0.5, 0.96, 0.0), 0.00001f)) ? 0 : 1; + Error += glm::all(glm::equal(exp, glm::ivec3(11, -2, 0))) ? 0 : 1; + } + + { + glm::vec4 x(1024, 0.24, 0, -1.33); + glm::ivec4 exp; + glm::vec4 A = glm::frexp(x, exp); + Error += glm::all(glm::epsilonEqual(A, glm::vec4(0.5, 0.96, 0.0, -0.665), 0.00001f)) ? 0 : 1; + Error += glm::all(glm::equal(exp, glm::ivec4(11, -2, 0, 1))) ? 0 : 1; + } + + return Error; + } +}//namespace frexp_ + +namespace ldexp_ +{ + int test() + { + int Error(0); + + { + glm::vec1 A = glm::vec1(0.5); + glm::ivec1 exp = glm::ivec1(11); + glm::vec1 x = glm::ldexp(A, exp); + Error += glm::all(glm::epsilonEqual(x, glm::vec1(1024),0.00001f)) ? 0 : 1; + } + + { + glm::vec2 A = glm::vec2(0.5, 0.96); + glm::ivec2 exp = glm::ivec2(11, -2); + glm::vec2 x = glm::ldexp(A, exp); + Error += glm::all(glm::epsilonEqual(x, glm::vec2(1024, .24),0.00001f)) ? 0 : 1; + } + + { + glm::vec3 A = glm::vec3(0.5, 0.96, 0.0); + glm::ivec3 exp = glm::ivec3(11, -2, 0); + glm::vec3 x = glm::ldexp(A, exp); + Error += glm::all(glm::epsilonEqual(x, glm::vec3(1024, .24, 0),0.00001f)) ? 0 : 1; + } + + { + glm::vec4 A = glm::vec4(0.5, 0.96, 0.0, -0.665); + glm::ivec4 exp = glm::ivec4(11, -2, 0, 1); + glm::vec4 x = glm::ldexp(A, exp); + Error += glm::all(glm::epsilonEqual(x, glm::vec4(1024, .24, 0, -1.33),0.00001f)) ? 0 : 1; + } + + + { + glm::vec4 x(1024, 0.24, 0, -1.33); + glm::ivec4 exp; + glm::vec4 A = glm::frexp(x, exp); + Error += glm::all(glm::epsilonEqual(A, glm::vec4(0.5, 0.96, 0.0, -0.665), 0.00001f)) ? 0 : 1; + Error += glm::all(glm::equal(exp, glm::ivec4(11, -2, 0, 1))) ? 0 : 1; + } + + return Error; + } +}//namespace ldexp_ + int main() { int Error(0); @@ -1171,6 +1260,8 @@ int main() Error += roundEven::test(); Error += isnan_::test(); Error += isinf_::test(); + Error += frexp_::test(); + Error += ldexp_::test(); # ifdef NDEBUG std::size_t Samples = 1000; From c9400562ecd3bc8e66fd557efb352fe07b9770cd Mon Sep 17 00:00:00 2001 From: Adrian Krupa Date: Sun, 29 Nov 2015 20:53:04 +0100 Subject: [PATCH 06/15] Fixed build --- glm/detail/func_common.inl | 4 ++-- test/core/core_func_common.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/glm/detail/func_common.inl b/glm/detail/func_common.inl index 9634255d..2c32626f 100644 --- a/glm/detail/func_common.inl +++ b/glm/detail/func_common.inl @@ -668,7 +668,7 @@ namespace detail { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'frexp' only accept floating-point inputs"); - return std::frexp(x, exp); + return std::frexp(x, &exp); } template @@ -676,7 +676,7 @@ namespace detail { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'frexp' only accept floating-point inputs"); - return tvec1(std::frexp(x.x, exp.x)); + return tvec1(std::frexp(x.x, &exp.x)); } template diff --git a/test/core/core_func_common.cpp b/test/core/core_func_common.cpp index ec86ec76..780151e5 100644 --- a/test/core/core_func_common.cpp +++ b/test/core/core_func_common.cpp @@ -1100,7 +1100,7 @@ namespace sign { int Error = 0; - glm::uint32 const Count = Samples; + glm::int32 const Count = static_cast(Samples); std::clock_t Timestamp0 = std::clock(); glm::int32 Sum = 0; From 4bb352b6280bc65cf13349baf018f4c4bd5d72c8 Mon Sep 17 00:00:00 2001 From: Stephen Hill Date: Wed, 23 Dec 2015 12:16:31 -0500 Subject: [PATCH 07/15] Fixed "Declaration shadows a field" warning --- glm/detail/type_half.inl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/glm/detail/type_half.inl b/glm/detail/type_half.inl index ff8740c8..b9f9f0ed 100644 --- a/glm/detail/type_half.inl +++ b/glm/detail/type_half.inl @@ -52,12 +52,12 @@ namespace detail i(0) {} - GLM_FUNC_QUALIFIER uif32(float f) : - f(f) + GLM_FUNC_QUALIFIER uif32(float f_) : + f(f_) {} - GLM_FUNC_QUALIFIER uif32(uint32 i) : - i(i) + GLM_FUNC_QUALIFIER uif32(uint32 i_) : + i(i_) {} float f; From ba46e0500e4b5b130303108626aabc55d2fb4234 Mon Sep 17 00:00:00 2001 From: Stephen Hill Date: Wed, 23 Dec 2015 12:18:14 -0500 Subject: [PATCH 08/15] Fixed 'GLM_COMPILER_VC2005 is not defined' warning This GLM compiler version isn't defined, so I just removed the legacy functions. --- glm/detail/setup.hpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index 71a7b098..34244ee9 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -455,13 +455,6 @@ #endif//GLM_ARCH #if GLM_ARCH & GLM_ARCH_SSE2 # include -# if(GLM_COMPILER == GLM_COMPILER_VC2005) // VC2005 is missing some intrinsics, workaround - inline float _mm_cvtss_f32(__m128 A) { return A.m128_f32[0]; } - inline __m128 _mm_castpd_ps(__m128d PD) { union { __m128 ps; __m128d pd; } c; c.pd = PD; return c.ps; } - inline __m128d _mm_castps_pd(__m128 PS) { union { __m128 ps; __m128d pd; } c; c.ps = PS; return c.pd; } - inline __m128i _mm_castps_si128(__m128 PS) { union { __m128 ps; __m128i pi; } c; c.ps = PS; return c.pi; } - inline __m128 _mm_castsi128_ps(__m128i PI) { union { __m128 ps; __m128i pi; } c; c.pi = PI; return c.ps; } -# endif #endif//GLM_ARCH #if defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_ARCH_DISPLAYED) From c83add59b30efc7f952d23ea0adee8dfc332fd48 Mon Sep 17 00:00:00 2001 From: Stephen Hill Date: Wed, 23 Dec 2015 12:19:13 -0500 Subject: [PATCH 09/15] Fixed various 'X is not defined' warnings --- glm/detail/setup.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index 34244ee9..05b3780c 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -393,13 +393,13 @@ #elif defined(GLM_FORCE_SSE2) # define GLM_ARCH (GLM_ARCH_SSE2) #elif (GLM_COMPILER & (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM | GLM_COMPILER_GCC)) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_LINUX)) -# if(__AVX2__) +# if defined(__AVX2__) # define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2) -# elif(__AVX__) +# elif defined(__AVX__) # define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2) -# elif(__SSE3__) +# elif defined(__SSE3__) # define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2) -# elif(__SSE2__) +# elif defined(__SSE2__) # define GLM_ARCH (GLM_ARCH_SSE2) # else # define GLM_ARCH GLM_ARCH_PURE @@ -995,7 +995,7 @@ namespace detail } }//namespace glm # define GLM_COUNTOF(arr) glm::countof(arr) -#elif _MSC_VER +#elif defined(_MSC_VER) # define GLM_COUNTOF(arr) _countof(arr) #else # define GLM_COUNTOF(arr) sizeof(arr) / sizeof(arr[0]) From fc1e45bbde231fbdf529b3a88763455c4f8aa280 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sun, 3 Jan 2016 18:30:08 +0100 Subject: [PATCH 10/15] Updated readme --- readme.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/readme.md b/readme.md index 256e65ac..b4c261d3 100644 --- a/readme.md +++ b/readme.md @@ -58,6 +58,9 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate) - Fixed GTC_matrix_inverse affineInverse #192 - Fixed ICC on Linux build errors #449 - Fixed ldexp and frexp compilation errors +- Fixed "Declaration shadows a field" warning #468 +- Fixed 'GLM_COMPILER_VC2005 is not defined' warning #468 +- Fixed various 'X is not defined' warnings #468 #### [GLM 0.9.7.1](https://github.com/g-truc/glm/releases/tag/0.9.7.1) - 2015-09-07 ##### Improvements: From 5d46e5186d55310df6108b36829669a8156fc3bf Mon Sep 17 00:00:00 2001 From: humbletim Date: Sat, 19 Dec 2015 19:30:00 -0500 Subject: [PATCH 11/15] remove extraneous test block --- test/core/core_func_common.cpp | 9 --------- 1 file changed, 9 deletions(-) diff --git a/test/core/core_func_common.cpp b/test/core/core_func_common.cpp index 780151e5..a610dd51 100644 --- a/test/core/core_func_common.cpp +++ b/test/core/core_func_common.cpp @@ -1229,15 +1229,6 @@ namespace ldexp_ Error += glm::all(glm::epsilonEqual(x, glm::vec4(1024, .24, 0, -1.33),0.00001f)) ? 0 : 1; } - - { - glm::vec4 x(1024, 0.24, 0, -1.33); - glm::ivec4 exp; - glm::vec4 A = glm::frexp(x, exp); - Error += glm::all(glm::epsilonEqual(A, glm::vec4(0.5, 0.96, 0.0, -0.665), 0.00001f)) ? 0 : 1; - Error += glm::all(glm::equal(exp, glm::ivec4(11, -2, 0, 1))) ? 0 : 1; - } - return Error; } }//namespace ldexp_ From 4ea72b312872597cebc01dde8e31a47e1c6bc939 Mon Sep 17 00:00:00 2001 From: Sven-Hendrik Haase Date: Sun, 22 Nov 2015 06:48:23 +0100 Subject: [PATCH 12/15] Fix docs --- glm/gtx/vector_angle.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/glm/gtx/vector_angle.hpp b/glm/gtx/vector_angle.hpp index 80288701..a05b988f 100644 --- a/glm/gtx/vector_angle.hpp +++ b/glm/gtx/vector_angle.hpp @@ -58,15 +58,15 @@ namespace glm /// @addtogroup gtx_vector_angle /// @{ - //! Returns the absolute angle between two vectors + //! Returns the absolute angle between two vectors. //! Parameters need to be normalized. - /// @see gtx_vector_angle extension + /// @see gtx_vector_angle extension. template GLM_FUNC_DECL typename vecType::value_type angle( vecType const & x, vecType const & y); - //! Returns the oriented angle between two 2d vectors + //! Returns the oriented angle between two 2d vectors. //! Parameters need to be normalized. /// @see gtx_vector_angle extension. template From 268af877ab767b1ddab792cc583cf7d529ce1c23 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Thu, 22 Oct 2015 00:27:10 +0200 Subject: [PATCH 13/15] Cygwin GCC doesn't have a C++11 STL library --- glm/detail/setup.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index 05b3780c..51375cc5 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -65,6 +65,8 @@ #ifdef GLM_FORCE_PLATFORM_UNKNOWN # define GLM_PLATFORM GLM_PLATFORM_UNKNOWN +#elif defined(__CYGWIN__) +# define GLM_PLATFORM GLM_PLATFORM_CYGWIN #elif defined(__QNXNTO__) # define GLM_PLATFORM GLM_PLATFORM_QNXNTO #elif defined(__APPLE__) @@ -634,7 +636,7 @@ // http://gcc.gnu.org/projects/cxx0x.html // http://msdn.microsoft.com/en-us/library/vstudio/hh567368(v=vs.120).aspx -#if GLM_PLATFORM == GLM_PLATFORM_ANDROID +#if GLM_PLATFORM == GLM_PLATFORM_ANDROID || GLM_PLATFORM == GLM_PLATFORM_CYGWIN # define GLM_HAS_CXX11_STL 0 #elif GLM_COMPILER & (GLM_COMPILER_LLVM | GLM_COMPILER_APPLE_CLANG) # if __has_include(<__config>) // libc++ From 7db048b851c967a85fe20a1524085c90e1802b95 Mon Sep 17 00:00:00 2001 From: Jesse Talavera-Greenberg Date: Mon, 28 Sep 2015 19:33:35 -0400 Subject: [PATCH 14/15] Move dependencies from intersect.inl to intersect.hpp --- glm/gtx/intersect.hpp | 4 ++++ glm/gtx/intersect.inl | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/glm/gtx/intersect.hpp b/glm/gtx/intersect.hpp index d35b4c54..3bce7081 100644 --- a/glm/gtx/intersect.hpp +++ b/glm/gtx/intersect.hpp @@ -43,8 +43,12 @@ #pragma once // Dependency: +#include +#include #include "../glm.hpp" +#include "../geometric.hpp" #include "../gtx/closest_point.hpp" +#include "../gtx/vector_query.hpp" #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED)) # pragma message("GLM: GLM_GTX_closest_point extension included") diff --git a/glm/gtx/intersect.inl b/glm/gtx/intersect.inl index 0c1cc935..3b1b9e8c 100644 --- a/glm/gtx/intersect.inl +++ b/glm/gtx/intersect.inl @@ -7,10 +7,6 @@ // File : glm/gtx/intersect.inl /////////////////////////////////////////////////////////////////////////////////////////////////// -#include "../geometric.hpp" -#include -#include - namespace glm { template From 1709e9abcabb5c1a2655cd85f27cee13d8f0aa3b Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sat, 17 Oct 2015 04:11:52 +0200 Subject: [PATCH 15/15] Added unary + operator #435 --- glm/detail/type_mat2x2.hpp | 5 ++++- glm/detail/type_mat2x2.inl | 8 +++++++- glm/detail/type_mat2x3.hpp | 5 ++++- glm/detail/type_mat2x3.inl | 8 +++++++- glm/detail/type_mat2x4.hpp | 5 ++++- glm/detail/type_mat2x4.inl | 8 +++++++- glm/detail/type_mat3x2.hpp | 5 ++++- glm/detail/type_mat3x2.inl | 8 +++++++- glm/detail/type_mat3x3.hpp | 5 ++++- glm/detail/type_mat3x3.inl | 8 +++++++- glm/detail/type_mat3x4.hpp | 5 ++++- glm/detail/type_mat3x4.inl | 8 +++++++- glm/detail/type_mat4x2.hpp | 5 ++++- glm/detail/type_mat4x2.inl | 8 +++++++- glm/detail/type_mat4x3.hpp | 5 ++++- glm/detail/type_mat4x3.inl | 8 +++++++- glm/detail/type_mat4x4.hpp | 5 ++++- glm/detail/type_mat4x4.inl | 8 +++++++- glm/detail/type_vec1.hpp | 3 +++ glm/detail/type_vec1.inl | 6 ++++++ glm/detail/type_vec2.hpp | 3 +++ glm/detail/type_vec2.inl | 6 ++++++ glm/detail/type_vec3.hpp | 3 +++ glm/detail/type_vec3.inl | 6 ++++++ glm/detail/type_vec4.hpp | 3 +++ glm/detail/type_vec4.inl | 6 ++++++ glm/gtc/quaternion.hpp | 3 +++ glm/gtc/quaternion.inl | 6 ++++++ glm/gtx/dual_quaternion.hpp | 5 ++++- glm/gtx/dual_quaternion.inl | 2 +- readme.md | 1 + 31 files changed, 150 insertions(+), 20 deletions(-) diff --git a/glm/detail/type_mat2x2.hpp b/glm/detail/type_mat2x2.hpp index aa0c81d7..9761adfe 100644 --- a/glm/detail/type_mat2x2.hpp +++ b/glm/detail/type_mat2x2.hpp @@ -157,7 +157,10 @@ namespace glm // -- Unary operators -- template - GLM_FUNC_DECL tmat2x2 const operator-(tmat2x2 const & m); + GLM_FUNC_DECL tmat2x2 operator+(tmat2x2 const & m); + + template + GLM_FUNC_DECL tmat2x2 operator-(tmat2x2 const & m); // -- Binary operators -- diff --git a/glm/detail/type_mat2x2.inl b/glm/detail/type_mat2x2.inl index 202839f4..960fee57 100644 --- a/glm/detail/type_mat2x2.inl +++ b/glm/detail/type_mat2x2.inl @@ -367,7 +367,13 @@ namespace detail // -- Unary arithmetic operators -- template - GLM_FUNC_QUALIFIER tmat2x2 const operator-(tmat2x2 const & m) + GLM_FUNC_QUALIFIER tmat2x2 operator+(tmat2x2 const & m) + { + return m; + } + + template + GLM_FUNC_QUALIFIER tmat2x2 operator-(tmat2x2 const & m) { return tmat2x2( -m[0], diff --git a/glm/detail/type_mat2x3.hpp b/glm/detail/type_mat2x3.hpp index 4cacc46c..eeb69ad2 100644 --- a/glm/detail/type_mat2x3.hpp +++ b/glm/detail/type_mat2x3.hpp @@ -149,7 +149,10 @@ namespace glm // -- Unary operators -- template - GLM_FUNC_DECL tmat2x3 const operator-(tmat2x3 const & m); + GLM_FUNC_DECL tmat2x3 operator+(tmat2x3 const & m); + + template + GLM_FUNC_DECL tmat2x3 operator-(tmat2x3 const & m); // -- Binary operators -- diff --git a/glm/detail/type_mat2x3.inl b/glm/detail/type_mat2x3.inl index 267f0c0c..76c00f50 100644 --- a/glm/detail/type_mat2x3.inl +++ b/glm/detail/type_mat2x3.inl @@ -337,7 +337,13 @@ namespace glm // -- Unary arithmetic operators -- template - GLM_FUNC_QUALIFIER tmat2x3 const operator-(tmat2x3 const & m) + GLM_FUNC_QUALIFIER tmat2x3 operator+(tmat2x3 const & m) + { + return m; + } + + template + GLM_FUNC_QUALIFIER tmat2x3 operator-(tmat2x3 const & m) { return tmat2x3( -m[0], diff --git a/glm/detail/type_mat2x4.hpp b/glm/detail/type_mat2x4.hpp index d87ce074..8e3c616a 100644 --- a/glm/detail/type_mat2x4.hpp +++ b/glm/detail/type_mat2x4.hpp @@ -151,7 +151,10 @@ namespace glm // -- Unary operators -- template - GLM_FUNC_DECL tmat2x4 const operator-(tmat2x4 const & m); + GLM_FUNC_DECL tmat2x4 operator+(tmat2x4 const & m); + + template + GLM_FUNC_DECL tmat2x4 operator-(tmat2x4 const & m); // -- Binary operators -- diff --git a/glm/detail/type_mat2x4.inl b/glm/detail/type_mat2x4.inl index 766640e4..42299787 100644 --- a/glm/detail/type_mat2x4.inl +++ b/glm/detail/type_mat2x4.inl @@ -338,7 +338,13 @@ namespace glm // -- Unary arithmetic operators -- template - GLM_FUNC_QUALIFIER tmat2x4 const operator-(tmat2x4 const & m) + GLM_FUNC_QUALIFIER tmat2x4 operator+(tmat2x4 const & m) + { + return m; + } + + template + GLM_FUNC_QUALIFIER tmat2x4 operator-(tmat2x4 const & m) { return tmat2x4( -m[0], diff --git a/glm/detail/type_mat3x2.hpp b/glm/detail/type_mat3x2.hpp index ac2ea0d4..fedf8c9e 100644 --- a/glm/detail/type_mat3x2.hpp +++ b/glm/detail/type_mat3x2.hpp @@ -156,7 +156,10 @@ namespace glm // -- Unary operators -- template - GLM_FUNC_DECL tmat3x2 const operator-(tmat3x2 const & m); + GLM_FUNC_DECL tmat3x2 operator+(tmat3x2 const & m); + + template + GLM_FUNC_DECL tmat3x2 operator-(tmat3x2 const & m); // -- Binary operators -- diff --git a/glm/detail/type_mat3x2.inl b/glm/detail/type_mat3x2.inl index d112a054..f497e395 100644 --- a/glm/detail/type_mat3x2.inl +++ b/glm/detail/type_mat3x2.inl @@ -376,8 +376,14 @@ namespace glm // -- Unary arithmetic operators -- + template + GLM_FUNC_QUALIFIER tmat3x2 operator+(tmat3x2 const & m) + { + return m; + } + template - GLM_FUNC_QUALIFIER tmat3x2 const operator-(tmat3x2 const & m) + GLM_FUNC_QUALIFIER tmat3x2 operator-(tmat3x2 const & m) { return tmat3x2( -m[0], diff --git a/glm/detail/type_mat3x3.hpp b/glm/detail/type_mat3x3.hpp index 7b0945ac..e7e2e6de 100644 --- a/glm/detail/type_mat3x3.hpp +++ b/glm/detail/type_mat3x3.hpp @@ -164,7 +164,10 @@ namespace glm // -- Unary operators -- template - GLM_FUNC_DECL tmat3x3 const operator-(tmat3x3 const & m); + GLM_FUNC_DECL tmat3x3 operator+(tmat3x3 const & m); + + template + GLM_FUNC_DECL tmat3x3 operator-(tmat3x3 const & m); // -- Binary operators -- diff --git a/glm/detail/type_mat3x3.inl b/glm/detail/type_mat3x3.inl index 6f936036..9ee0111e 100644 --- a/glm/detail/type_mat3x3.inl +++ b/glm/detail/type_mat3x3.inl @@ -415,7 +415,13 @@ namespace detail // -- Unary arithmetic operators -- template - GLM_FUNC_QUALIFIER tmat3x3 const operator-(tmat3x3 const & m) + GLM_FUNC_QUALIFIER tmat3x3 operator+(tmat3x3 const & m) + { + return m; + } + + template + GLM_FUNC_QUALIFIER tmat3x3 operator-(tmat3x3 const & m) { return tmat3x3( -m[0], diff --git a/glm/detail/type_mat3x4.hpp b/glm/detail/type_mat3x4.hpp index 8f59f2ad..11261589 100644 --- a/glm/detail/type_mat3x4.hpp +++ b/glm/detail/type_mat3x4.hpp @@ -156,7 +156,10 @@ namespace glm // -- Unary operators -- template - GLM_FUNC_DECL tmat3x4 const operator-(tmat3x4 const & m); + GLM_FUNC_DECL tmat3x4 operator+(tmat3x4 const & m); + + template + GLM_FUNC_DECL tmat3x4 operator-(tmat3x4 const & m); // -- Binary operators -- diff --git a/glm/detail/type_mat3x4.inl b/glm/detail/type_mat3x4.inl index 8862df47..3991d95d 100644 --- a/glm/detail/type_mat3x4.inl +++ b/glm/detail/type_mat3x4.inl @@ -377,7 +377,13 @@ namespace glm // -- Unary arithmetic operators -- template - GLM_FUNC_QUALIFIER tmat3x4 const operator-(tmat3x4 const & m) + GLM_FUNC_QUALIFIER tmat3x4 operator+(tmat3x4 const & m) + { + return m; + } + + template + GLM_FUNC_QUALIFIER tmat3x4 operator-(tmat3x4 const & m) { return tmat3x4( -m[0], diff --git a/glm/detail/type_mat4x2.hpp b/glm/detail/type_mat4x2.hpp index 65666d5c..62cd7aed 100644 --- a/glm/detail/type_mat4x2.hpp +++ b/glm/detail/type_mat4x2.hpp @@ -161,7 +161,10 @@ namespace glm // -- Unary operators -- template - GLM_FUNC_DECL tmat4x2 const operator-(tmat4x2 const & m); + GLM_FUNC_DECL tmat4x2 operator+(tmat4x2 const & m); + + template + GLM_FUNC_DECL tmat4x2 operator-(tmat4x2 const & m); // -- Binary operators -- diff --git a/glm/detail/type_mat4x2.inl b/glm/detail/type_mat4x2.inl index d012b884..811f4622 100644 --- a/glm/detail/type_mat4x2.inl +++ b/glm/detail/type_mat4x2.inl @@ -409,7 +409,13 @@ namespace glm // -- Unary arithmetic operators -- template - GLM_FUNC_QUALIFIER tmat4x2 const operator-(tmat4x2 const & m) + GLM_FUNC_QUALIFIER tmat4x2 operator+(tmat4x2 const & m) + { + return m; + } + + template + GLM_FUNC_QUALIFIER tmat4x2 operator-(tmat4x2 const & m) { return tmat4x2( -m[0], diff --git a/glm/detail/type_mat4x3.hpp b/glm/detail/type_mat4x3.hpp index 55c0b516..eea24667 100644 --- a/glm/detail/type_mat4x3.hpp +++ b/glm/detail/type_mat4x3.hpp @@ -161,7 +161,10 @@ namespace glm // -- Unary operators -- template - GLM_FUNC_DECL tmat4x3 const operator-(tmat4x3 const & m); + GLM_FUNC_DECL tmat4x3 operator+(tmat4x3 const & m); + + template + GLM_FUNC_DECL tmat4x3 operator-(tmat4x3 const & m); // -- Binary operators -- diff --git a/glm/detail/type_mat4x3.inl b/glm/detail/type_mat4x3.inl index e7368619..c2979782 100644 --- a/glm/detail/type_mat4x3.inl +++ b/glm/detail/type_mat4x3.inl @@ -409,7 +409,13 @@ namespace glm // -- Unary arithmetic operators -- template - GLM_FUNC_QUALIFIER tmat4x3 const operator-(tmat4x3 const & m) + GLM_FUNC_QUALIFIER tmat4x3 operator+(tmat4x3 const & m) + { + return m; + } + + template + GLM_FUNC_QUALIFIER tmat4x3 operator-(tmat4x3 const & m) { return tmat4x3( -m[0], diff --git a/glm/detail/type_mat4x4.hpp b/glm/detail/type_mat4x4.hpp index 5d36b490..1690bf1d 100644 --- a/glm/detail/type_mat4x4.hpp +++ b/glm/detail/type_mat4x4.hpp @@ -169,7 +169,10 @@ namespace glm // -- Unary operators -- template - GLM_FUNC_DECL tmat4x4 const operator-(tmat4x4 const & m); + GLM_FUNC_DECL tmat4x4 operator+(tmat4x4 const & m); + + template + GLM_FUNC_DECL tmat4x4 operator-(tmat4x4 const & m); // -- Binary operators -- diff --git a/glm/detail/type_mat4x4.inl b/glm/detail/type_mat4x4.inl index c075122b..319325a7 100644 --- a/glm/detail/type_mat4x4.inl +++ b/glm/detail/type_mat4x4.inl @@ -515,7 +515,13 @@ namespace detail // -- Unary constant operators -- template - GLM_FUNC_QUALIFIER tmat4x4 const operator-(tmat4x4 const & m) + GLM_FUNC_QUALIFIER tmat4x4 operator+(tmat4x4 const & m) + { + return m; + } + + template + GLM_FUNC_QUALIFIER tmat4x4 operator-(tmat4x4 const & m) { return tmat4x4( -m[0], diff --git a/glm/detail/type_vec1.hpp b/glm/detail/type_vec1.hpp index e18c8a3a..6c30a438 100644 --- a/glm/detail/type_vec1.hpp +++ b/glm/detail/type_vec1.hpp @@ -204,6 +204,9 @@ namespace glm // -- Unary operators -- + template + GLM_FUNC_DECL tvec1 operator+(tvec1 const & v); + template GLM_FUNC_DECL tvec1 operator-(tvec1 const & v); diff --git a/glm/detail/type_vec1.inl b/glm/detail/type_vec1.inl index 39485782..effac06f 100644 --- a/glm/detail/type_vec1.inl +++ b/glm/detail/type_vec1.inl @@ -352,6 +352,12 @@ namespace glm // -- Unary constant operators -- + template + GLM_FUNC_QUALIFIER tvec1 operator+(tvec1 const & v) + { + return v; + } + template GLM_FUNC_QUALIFIER tvec1 operator-(tvec1 const & v) { diff --git a/glm/detail/type_vec2.hpp b/glm/detail/type_vec2.hpp index 2f78c67e..76029f49 100644 --- a/glm/detail/type_vec2.hpp +++ b/glm/detail/type_vec2.hpp @@ -230,6 +230,9 @@ namespace glm // -- Unary operators -- + template + GLM_FUNC_DECL tvec2 operator+(tvec2 const & v); + template GLM_FUNC_DECL tvec2 operator-(tvec2 const & v); diff --git a/glm/detail/type_vec2.inl b/glm/detail/type_vec2.inl index 39d0549e..b8cb1ff8 100644 --- a/glm/detail/type_vec2.inl +++ b/glm/detail/type_vec2.inl @@ -480,6 +480,12 @@ namespace glm // -- Unary arithmetic operators -- + template + GLM_FUNC_QUALIFIER tvec2 operator+(tvec2 const & v) + { + return v; + } + template GLM_FUNC_QUALIFIER tvec2 operator-(tvec2 const & v) { diff --git a/glm/detail/type_vec3.hpp b/glm/detail/type_vec3.hpp index 4b7fa1a6..f155b076 100644 --- a/glm/detail/type_vec3.hpp +++ b/glm/detail/type_vec3.hpp @@ -252,6 +252,9 @@ namespace glm // -- Unary operators -- + template + GLM_FUNC_DECL tvec3 operator+(tvec3 const & v); + template GLM_FUNC_DECL tvec3 operator-(tvec3 const & v); diff --git a/glm/detail/type_vec3.inl b/glm/detail/type_vec3.inl index 1e5081d4..fa8102c8 100644 --- a/glm/detail/type_vec3.inl +++ b/glm/detail/type_vec3.inl @@ -547,6 +547,12 @@ namespace glm // -- Unary arithmetic operators -- + template + GLM_FUNC_QUALIFIER tvec3 operator+(tvec3 const & v) + { + return v; + } + template GLM_FUNC_QUALIFIER tvec3 operator-(tvec3 const & v) { diff --git a/glm/detail/type_vec4.hpp b/glm/detail/type_vec4.hpp index ffe8066f..e9fe6c1d 100644 --- a/glm/detail/type_vec4.hpp +++ b/glm/detail/type_vec4.hpp @@ -351,6 +351,9 @@ namespace detail // -- Unary operators -- + template + GLM_FUNC_DECL tvec4 operator+(tvec4 const & v); + template GLM_FUNC_DECL tvec4 operator-(tvec4 const & v); diff --git a/glm/detail/type_vec4.inl b/glm/detail/type_vec4.inl index 80c75945..8e215d00 100644 --- a/glm/detail/type_vec4.inl +++ b/glm/detail/type_vec4.inl @@ -645,6 +645,12 @@ namespace glm // -- Unary constant operators -- + template + GLM_FUNC_QUALIFIER tvec4 operator+(tvec4 const & v) + { + return v; + } + template GLM_FUNC_QUALIFIER tvec4 operator-(tvec4 const & v) { diff --git a/glm/gtc/quaternion.hpp b/glm/gtc/quaternion.hpp index 71817dfa..6fae5cc6 100644 --- a/glm/gtc/quaternion.hpp +++ b/glm/gtc/quaternion.hpp @@ -149,6 +149,9 @@ namespace glm // -- Unary bit operators -- + template + GLM_FUNC_DECL tquat operator+(tquat const & q); + template GLM_FUNC_DECL tquat operator-(tquat const & q); diff --git a/glm/gtc/quaternion.inl b/glm/gtc/quaternion.inl index 4c8565bc..83a1b66f 100644 --- a/glm/gtc/quaternion.inl +++ b/glm/gtc/quaternion.inl @@ -296,6 +296,12 @@ namespace detail // -- Unary bit operators -- + template + GLM_FUNC_QUALIFIER tquat operator+(tquat const & q) + { + return q; + } + template GLM_FUNC_QUALIFIER tquat operator-(tquat const & q) { diff --git a/glm/gtx/dual_quaternion.hpp b/glm/gtx/dual_quaternion.hpp index 1c26b34d..0b083295 100644 --- a/glm/gtx/dual_quaternion.hpp +++ b/glm/gtx/dual_quaternion.hpp @@ -130,7 +130,10 @@ namespace glm // -- Unary bit operators -- template - GLM_FUNC_DECL tquat operator-(tquat const & q); + GLM_FUNC_DECL tdualquat operator+(tdualquat const & q); + + template + GLM_FUNC_DECL tdualquat operator-(tdualquat const & q); // -- Binary operators -- diff --git a/glm/gtx/dual_quaternion.inl b/glm/gtx/dual_quaternion.inl index c6b057f2..961dd1ca 100644 --- a/glm/gtx/dual_quaternion.inl +++ b/glm/gtx/dual_quaternion.inl @@ -196,7 +196,7 @@ namespace glm template GLM_FUNC_QUALIFIER tdualquat operator-(tdualquat const & q) { - return tdualquat(-q.real,-q.dual); + return q; } // -- Binary operators -- diff --git a/readme.md b/readme.md index b4c261d3..17134d10 100644 --- a/readme.md +++ b/readme.md @@ -61,6 +61,7 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate) - Fixed "Declaration shadows a field" warning #468 - Fixed 'GLM_COMPILER_VC2005 is not defined' warning #468 - Fixed various 'X is not defined' warnings #468 +- Fixed missing unary + operator #435 #### [GLM 0.9.7.1](https://github.com/g-truc/glm/releases/tag/0.9.7.1) - 2015-09-07 ##### Improvements: