Removed GLM_FORCE_RADIANS, now it's the default behaviour

This commit is contained in:
Christophe Riccio 2013-12-26 19:15:48 +01:00
parent 6d6c56f211
commit 0d5deadf02
6 changed files with 29 additions and 152 deletions

View File

@ -17,14 +17,9 @@ namespace glm
)
{
detail::tvec2<T, P> 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<T, P> 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<T, P> 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<T, P> 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<T, P> 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<T, P> 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<T, P> 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, P>(T(1));
detail::tvec3<T, P> 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

View File

@ -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);
}

View File

@ -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

View File

@ -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

View File

@ -17,15 +17,7 @@ namespace glm
)
{
GLM_STATIC_ASSERT(std::numeric_limits<genType>::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 <typename T, precision P, template <typename, precision> class vecType>
@ -36,15 +28,7 @@ namespace glm
)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::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<T>::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<T, P> 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<T>::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

View File

@ -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