From 0d5deadf0240a666cb94fb1aa4b0e699d0c9e78c Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Thu, 26 Dec 2013 19:15:48 +0100 Subject: [PATCH] Removed GLM_FORCE_RADIANS, now it's the default behaviour --- glm/gtx/rotate_vector.inl | 57 +++------------------------------------ glm/gtx/simd_quat.inl | 32 +++++++++------------- glm/gtx/unsigned_int.hpp | 26 ------------------ glm/gtx/unsigned_int.inl | 13 --------- glm/gtx/vector_angle.inl | 44 ++++-------------------------- readme.txt | 9 ++++++- 6 files changed, 29 insertions(+), 152 deletions(-) delete mode 100644 glm/gtx/unsigned_int.hpp delete mode 100644 glm/gtx/unsigned_int.inl diff --git a/glm/gtx/rotate_vector.inl b/glm/gtx/rotate_vector.inl index 6f621fab..4a0506c4 100644 --- a/glm/gtx/rotate_vector.inl +++ b/glm/gtx/rotate_vector.inl @@ -17,14 +17,9 @@ namespace glm ) { detail::tvec2 Result; -#ifdef GLM_FORCE_RADIANS T const Cos(cos(angle)); T const Sin(sin(angle)); -#else -# pragma message("GLM: rotate function taking degrees as parameters is deprecated. #define GLM_FORCE_RADIANS before including GLM headers to remove this message.") - T const Cos = cos(radians(angle)); - T const Sin = sin(radians(angle)); -#endif + Result.x = v.x * Cos - v.y * Sin; Result.y = v.x * Sin + v.y * Cos; return Result; @@ -71,15 +66,8 @@ namespace glm ) { detail::tvec3 Result(v); - -#ifdef GLM_FORCE_RADIANS T const Cos(cos(angle)); T const Sin(sin(angle)); -#else -# pragma message("GLM: rotateX function taking degrees as parameters is deprecated. #define GLM_FORCE_RADIANS before including GLM headers to remove this message.") - T const Cos = cos(radians(angle)); - T const Sin = sin(radians(angle)); -#endif Result.y = v.y * Cos - v.z * Sin; Result.z = v.y * Sin + v.z * Cos; @@ -94,15 +82,8 @@ namespace glm ) { detail::tvec3 Result = v; - -#ifdef GLM_FORCE_RADIANS T const Cos(cos(angle)); T const Sin(sin(angle)); -#else -# pragma message("GLM: rotateY function taking degrees as parameters is deprecated. #define GLM_FORCE_RADIANS before including GLM headers to remove this message.") - T const Cos(cos(radians(angle))); - T const Sin(sin(radians(angle))); -#endif Result.x = v.x * Cos + v.z * Sin; Result.z = -v.x * Sin + v.z * Cos; @@ -117,15 +98,8 @@ namespace glm ) { detail::tvec3 Result = v; - -#ifdef GLM_FORCE_RADIANS T const Cos(cos(angle)); T const Sin(sin(angle)); -#else -# pragma message("GLM: rotateZ function taking degrees as parameters is deprecated. #define GLM_FORCE_RADIANS before including GLM headers to remove this message.") - T const Cos(cos(radians(angle))); - T const Sin(sin(radians(angle))); -#endif Result.x = v.x * Cos - v.y * Sin; Result.y = v.x * Sin + v.y * Cos; @@ -140,15 +114,8 @@ namespace glm ) { detail::tvec4 Result = v; - -#ifdef GLM_FORCE_RADIANS T const Cos(cos(angle)); T const Sin(sin(angle)); -#else -# pragma message("GLM: rotateX function taking degrees as parameters is deprecated. #define GLM_FORCE_RADIANS before including GLM headers to remove this message.") - T const Cos(cos(radians(angle))); - T const Sin(sin(radians(angle))); -#endif Result.y = v.y * Cos - v.z * Sin; Result.z = v.y * Sin + v.z * Cos; @@ -163,15 +130,8 @@ namespace glm ) { detail::tvec4 Result = v; - -#ifdef GLM_FORCE_RADIANS T const Cos(cos(angle)); T const Sin(sin(angle)); -#else -# pragma message("GLM: rotateX function taking degrees as parameters is deprecated. #define GLM_FORCE_RADIANS before including GLM headers to remove this message.") - T const Cos(cos(radians(angle))); - T const Sin(sin(radians(angle))); -#endif Result.x = v.x * Cos + v.z * Sin; Result.z = -v.x * Sin + v.z * Cos; @@ -186,15 +146,8 @@ namespace glm ) { detail::tvec4 Result = v; - -#ifdef GLM_FORCE_RADIANS T const Cos(cos(angle)); T const Sin(sin(angle)); -#else -# pragma message("GLM: rotateZ function taking degrees as parameters is deprecated. #define GLM_FORCE_RADIANS before including GLM headers to remove this message.") - T const Cos(cos(radians(angle))); - T const Sin(sin(radians(angle))); -#endif Result.x = v.x * Cos - v.y * Sin; Result.y = v.x * Sin + v.y * Cos; @@ -212,12 +165,8 @@ namespace glm return detail::tmat4x4(T(1)); detail::tvec3 RotationAxis = cross(Up, Normal); -# ifdef GLM_FORCE_RADIANS - T Angle = acos(dot(Normal, Up)); -# else -# pragma message("GLM: rotateZ function taking degrees as parameters is deprecated. #define GLM_FORCE_RADIANS before including GLM headers to remove this message.") - T Angle = degrees(acos(dot(Normal, Up))); -# endif + T Angle = acos(dot(Normal, Up)); + return rotate(Angle, RotationAxis); } }//namespace glm diff --git a/glm/gtx/simd_quat.inl b/glm/gtx/simd_quat.inl index 7c21e178..f5b222e4 100644 --- a/glm/gtx/simd_quat.inl +++ b/glm/gtx/simd_quat.inl @@ -581,16 +581,10 @@ GLM_FUNC_QUALIFIER detail::fquatSIMD angleAxisSIMD vec3 const & v ) { -#ifdef GLM_FORCE_RADIANS - float a(angle); -#else -# pragma message("GLM: rotateZ function taking degrees as parameters is deprecated. #define GLM_FORCE_RADIANS before including GLM headers to remove this message.") - float a(glm::radians(angle)); -#endif - float s = glm::sin(a * 0.5f); + float s = glm::sin(angle * 0.5f); return _mm_set_ps( - glm::cos(a * 0.5f), + glm::cos(angle * 0.5f), v.z * s, v.y * s, v.x * s); @@ -610,19 +604,19 @@ GLM_FUNC_QUALIFIER detail::fquatSIMD angleAxisSIMD GLM_FUNC_QUALIFIER __m128 fastSin(__m128 x) { - static const __m128 c0 = _mm_set1_ps(0.16666666666666666666666666666667f); - static const __m128 c1 = _mm_set1_ps(0.00833333333333333333333333333333f); - static const __m128 c2 = _mm_set1_ps(0.00019841269841269841269841269841f); + static const __m128 c0 = _mm_set1_ps(0.16666666666666666666666666666667f); + static const __m128 c1 = _mm_set1_ps(0.00833333333333333333333333333333f); + static const __m128 c2 = _mm_set1_ps(0.00019841269841269841269841269841f); - __m128 x3 = _mm_mul_ps(x, _mm_mul_ps(x, x)); - __m128 x5 = _mm_mul_ps(x3, _mm_mul_ps(x, x)); - __m128 x7 = _mm_mul_ps(x5, _mm_mul_ps(x, x)); + __m128 x3 = _mm_mul_ps(x, _mm_mul_ps(x, x)); + __m128 x5 = _mm_mul_ps(x3, _mm_mul_ps(x, x)); + __m128 x7 = _mm_mul_ps(x5, _mm_mul_ps(x, x)); - __m128 y0 = _mm_mul_ps(x3, c0); - __m128 y1 = _mm_mul_ps(x5, c1); - __m128 y2 = _mm_mul_ps(x7, c2); - - return _mm_sub_ps(_mm_add_ps(_mm_sub_ps(x, y0), y1), y2); + __m128 y0 = _mm_mul_ps(x3, c0); + __m128 y1 = _mm_mul_ps(x5, c1); + __m128 y2 = _mm_mul_ps(x7, c2); + + return _mm_sub_ps(_mm_add_ps(_mm_sub_ps(x, y0), y1), y2); } diff --git a/glm/gtx/unsigned_int.hpp b/glm/gtx/unsigned_int.hpp deleted file mode 100644 index 340cfd40..00000000 --- a/glm/gtx/unsigned_int.hpp +++ /dev/null @@ -1,26 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// 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. -/////////////////////////////////////////////////////////////////////////////////// - -#if(defined(GLM_MESSAGES)) -# pragma message("GLM: GLM_GTX_unsigned_int extension is deprecated, include GLM_GTX_integer instead") -#endif diff --git a/glm/gtx/unsigned_int.inl b/glm/gtx/unsigned_int.inl deleted file mode 100644 index b08a3878..00000000 --- a/glm/gtx/unsigned_int.inl +++ /dev/null @@ -1,13 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) -/////////////////////////////////////////////////////////////////////////////////////////////////// -// Created : 2005-12-24 -// Updated : 2008-10-07 -// Licence : This source is under MIT License -// File : glm/gtx/unsigned_int.inl -/////////////////////////////////////////////////////////////////////////////////////////////////// - -namespace glm -{ - -}//namespace glm diff --git a/glm/gtx/vector_angle.inl b/glm/gtx/vector_angle.inl index a6f85a3d..b74d85ba 100644 --- a/glm/gtx/vector_angle.inl +++ b/glm/gtx/vector_angle.inl @@ -17,15 +17,7 @@ namespace glm ) { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'angle' only accept floating-point inputs"); - - genType const Angle(acos(clamp(dot(x, y), genType(0), genType(1)))); - -#ifdef GLM_FORCE_RADIANS - return Angle; -#else -# pragma message("GLM: angle function returning degrees is deprecated. #define GLM_FORCE_RADIANS before including GLM headers to remove this message.") - return degrees(Angle); -#endif + return acos(clamp(dot(x, y), genType(0), genType(1))); } template class vecType> @@ -36,15 +28,7 @@ namespace glm ) { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'angle' only accept floating-point inputs"); - - T const Angle(acos(clamp(dot(x, y), T(0), T(1)))); - -#ifdef GLM_FORCE_RADIANS - return Angle; -#else -# pragma message("GLM: angle function returning degrees is deprecated. #define GLM_FORCE_RADIANS before including GLM headers to remove this message.") - return degrees(Angle); -#endif + return acos(clamp(dot(x, y), T(0), T(1))); } //! \todo epsilon is hard coded to 0.01 @@ -56,15 +40,8 @@ namespace glm ) { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'orientedAngle' only accept floating-point inputs"); + T const Angle(acos(clamp(dot(x, y), T(0), T(1)))); - T const Dot = clamp(dot(x, y), T(0), T(1)); - -#ifdef GLM_FORCE_RADIANS - T const Angle(acos(Dot)); -#else -# pragma message("GLM: orientedAngle function returning degrees is deprecated. #define GLM_FORCE_RADIANS before including GLM headers to remove this message.") - T const Angle(degrees(acos(Dot))); -#endif detail::tvec2 const TransformedVector(glm::rotate(x, Angle)); if(all(epsilonEqual(y, TransformedVector, T(0.01)))) return Angle; @@ -81,19 +58,8 @@ namespace glm ) { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'orientedAngle' only accept floating-point inputs"); + T const Angle(acos(clamp(dot(x, y), T(0), T(1)))); - T const Dot = clamp(dot(x, y), T(0), T(1)); - -#ifdef GLM_FORCE_RADIANS - T const Angle(acos(Dot)); -#else -# pragma message("GLM: orientedAngle function returning degrees is deprecated. #define GLM_FORCE_RADIANS before including GLM headers to remove this message.") - T const Angle(degrees(acos(Dot))); -#endif - - if(dot(ref, cross(x, y)) < T(0)) - return -Angle; - else - return Angle; + return mix(Angle, -Angle, dot(ref, cross(x, y)) < T(0)); } }//namespace glm diff --git a/readme.txt b/readme.txt index 90588369..03251c20 100644 --- a/readme.txt +++ b/readme.txt @@ -36,11 +36,18 @@ GLM is a header only library, there is nothing to build, just include it. More informations in GLM manual: http://glm.g-truc.net/glm.pdf +================================================================================ +GLM 0.9.6.0: 2014-XX-XX +-------------------------------------------------------------------------------- +- Added transparent use of SIMD instructions for vec4 and mat4 types +- Removed degrees for function parameters +- Removed GLM_FORCE_RADIANS, active by default + ================================================================================ GLM 0.9.5.1: 2014-XX-XX -------------------------------------------------------------------------------- - Fixed angle and orientedAngle that sometimes return NaN values (#145) -- Deprecated degrees for function parameters and display a message. +- Deprecated degrees for function parameters and display a message ================================================================================ GLM 0.9.5.0: 2013-12-25