diff --git a/glm/core/func_common.inl b/glm/core/func_common.inl index f98fd411..17d0a62b 100644 --- a/glm/core/func_common.inl +++ b/glm/core/func_common.inl @@ -803,19 +803,19 @@ namespace detail { GLM_STATIC_ASSERT(detail::type::is_float, "'isnan' only accept floating-point inputs"); -# if(GLM_COMPILER & (GLM_COMPILER_VC | GLM_COMPILER_INTEL)) +# if(GLM_COMPILER & (GLM_COMPILER_VC | GLM_COMPILER_INTEL)) return _isnan(x) != 0; -# elif(GLM_COMPILER & GLM_COMPILER_GCC) +# elif(GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG)) # if(GLM_PLATFORM & GLM_PLATFORM_ANDROID) return _isnan(x) != 0; # else return std::isnan(x); # endif # elif(GLM_COMPILER & GLM_COMPILER_CUDA) - return isnan(x) != 0; -# else + return isnan(x) != 0; +# else return std::isnan(x); -# endif +# endif } template @@ -860,35 +860,20 @@ namespace detail { GLM_STATIC_ASSERT(detail::type::is_float, "'isinf' only accept floating-point inputs"); -# if(GLM_COMPILER & (GLM_COMPILER_INTEL | GLM_COMPILER_VC)) +# if(GLM_COMPILER & (GLM_COMPILER_INTEL | GLM_COMPILER_VC)) return _fpclass(x) == _FPCLASS_NINF || _fpclass(x) == _FPCLASS_PINF; -# elif(GLM_COMPILER & GLM_COMPILER_GCC) +# elif(GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG)) # if(GLM_PLATFORM & GLM_PLATFORM_ANDROID) return _isinf(x) != 0; # else return std::isinf(x); # endif # elif(GLM_COMPILER & GLM_COMPILER_CUDA) - // http://developer.download.nvidia.com/compute/cuda/4_2/rel/toolkit/docs/online/group__CUDA__MATH__DOUBLE_g13431dd2b40b51f9139cbb7f50c18fab.html#g13431dd2b40b51f9139cbb7f50c18fab - return isinf(double(x)) != 0; -# else + // http://developer.download.nvidia.com/compute/cuda/4_2/rel/toolkit/docs/online/group__CUDA__MATH__DOUBLE_g13431dd2b40b51f9139cbb7f50c18fab.html#g13431dd2b40b51f9139cbb7f50c18fab + return isinf(double(x)) != 0; +# else return std::isinf(x); -# endif -/* -# if(GLM_COMPILER & GLM_COMPILER_VC) - return _fpclass(x) == _FPCLASS_NINF || _fpclass(x) == _FPCLASS_PINF; -# elif(GLM_COMPILER & GLM_COMPILER_GCC) -# if(GLM_PLATFORM & GLM_PLATFORM_ANDROID) - return _isinf(x) != 0; -# else - return std::isinf(x); -# endif -# elif(GLM_COMPILER & GLM_COMPILER_INTEL) - return isinf(x) != 0; -# else - return std::isinf(x); -# endif -*/ +# endif } template diff --git a/glm/gtx/matrix_interpolation.inl b/glm/gtx/matrix_interpolation.inl index b77f34eb..8ab13435 100644 --- a/glm/gtx/matrix_interpolation.inl +++ b/glm/gtx/matrix_interpolation.inl @@ -117,11 +117,12 @@ namespace glm T const delta ) { - detail::tmat4x4 dltRotation = m2 * transpose(m1); + detail::tmat4x4 m1rot = extractMatrixRotation(m1); + detail::tmat4x4 dltRotation = m2 * transpose(m1rot); detail::tvec3 dltAxis; T dltAngle; axisAngle(dltRotation, dltAxis, dltAngle); - detail::tmat4x4 out = axisAngleMatrix(dltAxis, dltAngle * delta) * extractMatrixRotation(m1); + detail::tmat4x4 out = axisAngleMatrix(dltAxis, dltAngle * delta) * m1rot; out[3][0] = m1[3][0] + delta * (m2[3][0] - m1[3][0]); out[3][1] = m1[3][1] + delta * (m2[3][1] - m1[3][1]); out[3][2] = m1[3][2] + delta * (m2[3][2] - m1[3][2]); diff --git a/glm/gtx/ocl_type.inl b/glm/gtx/ocl_type.inl index e69de29b..ac151458 100644 --- a/glm/gtx/ocl_type.inl +++ b/glm/gtx/ocl_type.inl @@ -0,0 +1,27 @@ +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// of this software and associated documentation files (the "Software"), to deal +/// in the Software without restriction, including without limitation the rights +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +/// copies of the Software, and to permit persons to whom the Software is +/// furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +/// THE SOFTWARE. +/// +/// @ref gtx_ocl_type +/// @file glm/gtx/ocl_type.inl +/// @date 2013-03-16 / 2013-03-16 +/// @author Christophe Riccio +/////////////////////////////////////////////////////////////////////////////////// diff --git a/glm/gtx/vec1.inl b/glm/gtx/vec1.inl index e69de29b..782a8ec2 100644 --- a/glm/gtx/vec1.inl +++ b/glm/gtx/vec1.inl @@ -0,0 +1,27 @@ +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// of this software and associated documentation files (the "Software"), to deal +/// in the Software without restriction, including without limitation the rights +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +/// copies of the Software, and to permit persons to whom the Software is +/// furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +/// THE SOFTWARE. +/// +/// @ref gtx_vec1 +/// @file glm/gtx/vec1.inl +/// @date 2013-03-16 / 2013-03-16 +/// @author Christophe Riccio +/////////////////////////////////////////////////////////////////////////////////// diff --git a/readme.txt b/readme.txt index 4cd2f111..69135c16 100644 --- a/readme.txt +++ b/readme.txt @@ -46,7 +46,7 @@ GLM 0.9.5.0: 2013-XX-XX - Added rotation function to GTX_quaternion (#22) ================================================================================ -GLM 0.9.4.3: 2013-0X-XX +GLM 0.9.4.3: 2013-03-17 -------------------------------------------------------------------------------- - Detected qualifier for Clang - Fixed C++11 mode for GCC, couldn't be enabled without MS extensions @@ -54,6 +54,9 @@ GLM 0.9.4.3: 2013-0X-XX - Fixed GTX_polar_coordinates euclidean function, takes a vec2 instead of a vec3 - Clarify the license applying on the manual - Added a docx copy of the manual +- Fixed GLM_GTX_matrix_interpolation +- Fixed isnan and isinf on Android with Clang + ================================================================================ GLM 0.9.4.2: 2013-02-14 diff --git a/test/core/core_func_common.cpp b/test/core/core_func_common.cpp index ecd64ef3..21e5cc0e 100644 --- a/test/core/core_func_common.cpp +++ b/test/core/core_func_common.cpp @@ -11,6 +11,7 @@ //#include //#include #include +#include #include #include @@ -148,26 +149,94 @@ int test_floatBitsToUint() return Error; } -int test_mix() +namespace test_mix { - int Error = 0; - - { - float A = glm::mix(0.f, 1.f, true); - Error += A == 1.f ? 0 : 1; - float B = glm::mix(0.f, 1.f, false); - Error += B == 0.f ? 0 : 1; - } - - { - float A = glm::mix(0.f, 1.f, 1.f); - Error += A == 1.f ? 0 : 1; - float B = glm::mix(0.f, 1.f, 0.f); - Error += B == 0.f ? 0 : 1; - } - - return Error; -} + template + struct test + { + T x; + T y; + B a; + T Result; + }; + + test TestBool[] = + { + {0.0f, 1.0f, false, 0.0f}, + {0.0f, 1.0f, true, 1.0f}, + {-1.0f, 1.0f, false, -1.0f}, + {-1.0f, 1.0f, true, 1.0f} + }; + + test TestFloat[] = + { + {0.0f, 1.0f, 0.0f, 0.0f}, + {0.0f, 1.0f, 1.0f, 1.0f}, + {-1.0f, 1.0f, 0.0f, -1.0f}, + {-1.0f, 1.0f, 1.0f, 1.0f} + }; + + test 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)}, + {glm::vec2(-1.0f), glm::vec2(1.0f), false, glm::vec2(-1.0f)}, + {glm::vec2(-1.0f), glm::vec2(1.0f), true, glm::vec2(1.0f)} + }; + + test 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)}, + {glm::vec2(-1.0f), glm::vec2(1.0f), glm::bvec2(false), glm::vec2(-1.0f)}, + {glm::vec2(-1.0f), glm::vec2(1.0f), glm::bvec2(true), glm::vec2(1.0f)} + }; + + int run() + { + int Error = 0; + + // Float with bool + { + for(std::size_t i = 0; i < sizeof(TestBool) / sizeof(test); ++i) + { + float Result = glm::mix(TestBool[i].x, TestBool[i].y, TestBool[i].a); + Error += glm::epsilonEqual(Result, TestBool[i].Result, glm::epsilon()) ? 0 : 1; + } + } + + // Float with float + { + for(std::size_t i = 0; i < sizeof(TestFloat) / sizeof(test); ++i) + { + float Result = glm::mix(TestFloat[i].x, TestFloat[i].y, TestFloat[i].a); + Error += glm::epsilonEqual(Result, TestFloat[i].Result, glm::epsilon()) ? 0 : 1; + } + } + + // vec2 with bool + { + for(std::size_t i = 0; i < sizeof(TestVec2Bool) / sizeof(test); ++i) + { + glm::vec2 Result = glm::mix(TestVec2Bool[i].x, TestVec2Bool[i].y, TestVec2Bool[i].a); + Error += glm::epsilonEqual(Result.x, TestVec2Bool[i].Result.x, glm::epsilon()) ? 0 : 1; + Error += glm::epsilonEqual(Result.y, TestVec2Bool[i].Result.y, glm::epsilon()) ? 0 : 1; + } + } + + // vec2 with bvec2 + { + for(std::size_t i = 0; i < sizeof(TestBVec2) / sizeof(test); ++i) + { + glm::vec2 Result = glm::mix(TestBVec2[i].x, TestBVec2[i].y, TestBVec2[i].a); + Error += glm::epsilonEqual(Result.x, TestBVec2[i].Result.x, glm::epsilon()) ? 0 : 1; + Error += glm::epsilonEqual(Result.y, TestBVec2[i].Result.y, glm::epsilon()) ? 0 : 1; + } + } + + return Error; + } +}//namespace test_mix int test_round() { @@ -414,7 +483,7 @@ int main() Error += test_modf(); Error += test_floatBitsToInt(); Error += test_floatBitsToUint(); - Error += test_mix(); + Error += test_mix::run(); Error += test_round(); Error += test_roundEven(); Error += test_isnan();