mirror of
https://github.com/g-truc/glm.git
synced 2024-11-26 18:24:35 +00:00
Removed GLM_FORCE_RADIANS, now it's the default behaviour
This commit is contained in:
parent
6d6c56f211
commit
0d5deadf02
@ -17,14 +17,9 @@ namespace glm
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
detail::tvec2<T, P> Result;
|
detail::tvec2<T, P> Result;
|
||||||
#ifdef GLM_FORCE_RADIANS
|
|
||||||
T const Cos(cos(angle));
|
T const Cos(cos(angle));
|
||||||
T const Sin(sin(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.x = v.x * Cos - v.y * Sin;
|
||||||
Result.y = v.x * Sin + v.y * Cos;
|
Result.y = v.x * Sin + v.y * Cos;
|
||||||
return Result;
|
return Result;
|
||||||
@ -71,15 +66,8 @@ namespace glm
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
detail::tvec3<T, P> Result(v);
|
detail::tvec3<T, P> Result(v);
|
||||||
|
|
||||||
#ifdef GLM_FORCE_RADIANS
|
|
||||||
T const Cos(cos(angle));
|
T const Cos(cos(angle));
|
||||||
T const Sin(sin(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.y = v.y * Cos - v.z * Sin;
|
||||||
Result.z = v.y * Sin + v.z * Cos;
|
Result.z = v.y * Sin + v.z * Cos;
|
||||||
@ -94,15 +82,8 @@ namespace glm
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
detail::tvec3<T, P> Result = v;
|
detail::tvec3<T, P> Result = v;
|
||||||
|
|
||||||
#ifdef GLM_FORCE_RADIANS
|
|
||||||
T const Cos(cos(angle));
|
T const Cos(cos(angle));
|
||||||
T const Sin(sin(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.x = v.x * Cos + v.z * Sin;
|
||||||
Result.z = -v.x * Sin + v.z * Cos;
|
Result.z = -v.x * Sin + v.z * Cos;
|
||||||
@ -117,15 +98,8 @@ namespace glm
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
detail::tvec3<T, P> Result = v;
|
detail::tvec3<T, P> Result = v;
|
||||||
|
|
||||||
#ifdef GLM_FORCE_RADIANS
|
|
||||||
T const Cos(cos(angle));
|
T const Cos(cos(angle));
|
||||||
T const Sin(sin(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.x = v.x * Cos - v.y * Sin;
|
||||||
Result.y = v.x * Sin + v.y * Cos;
|
Result.y = v.x * Sin + v.y * Cos;
|
||||||
@ -140,15 +114,8 @@ namespace glm
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
detail::tvec4<T, P> Result = v;
|
detail::tvec4<T, P> Result = v;
|
||||||
|
|
||||||
#ifdef GLM_FORCE_RADIANS
|
|
||||||
T const Cos(cos(angle));
|
T const Cos(cos(angle));
|
||||||
T const Sin(sin(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.y = v.y * Cos - v.z * Sin;
|
||||||
Result.z = v.y * Sin + v.z * Cos;
|
Result.z = v.y * Sin + v.z * Cos;
|
||||||
@ -163,15 +130,8 @@ namespace glm
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
detail::tvec4<T, P> Result = v;
|
detail::tvec4<T, P> Result = v;
|
||||||
|
|
||||||
#ifdef GLM_FORCE_RADIANS
|
|
||||||
T const Cos(cos(angle));
|
T const Cos(cos(angle));
|
||||||
T const Sin(sin(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.x = v.x * Cos + v.z * Sin;
|
||||||
Result.z = -v.x * Sin + v.z * Cos;
|
Result.z = -v.x * Sin + v.z * Cos;
|
||||||
@ -186,15 +146,8 @@ namespace glm
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
detail::tvec4<T, P> Result = v;
|
detail::tvec4<T, P> Result = v;
|
||||||
|
|
||||||
#ifdef GLM_FORCE_RADIANS
|
|
||||||
T const Cos(cos(angle));
|
T const Cos(cos(angle));
|
||||||
T const Sin(sin(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.x = v.x * Cos - v.y * Sin;
|
||||||
Result.y = v.x * Sin + v.y * Cos;
|
Result.y = v.x * Sin + v.y * Cos;
|
||||||
@ -212,12 +165,8 @@ namespace glm
|
|||||||
return detail::tmat4x4<T, P>(T(1));
|
return detail::tmat4x4<T, P>(T(1));
|
||||||
|
|
||||||
detail::tvec3<T, P> RotationAxis = cross(Up, Normal);
|
detail::tvec3<T, P> RotationAxis = cross(Up, Normal);
|
||||||
# ifdef GLM_FORCE_RADIANS
|
|
||||||
T Angle = acos(dot(Normal, Up));
|
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
|
|
||||||
return rotate(Angle, RotationAxis);
|
return rotate(Angle, RotationAxis);
|
||||||
}
|
}
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -581,16 +581,10 @@ GLM_FUNC_QUALIFIER detail::fquatSIMD angleAxisSIMD
|
|||||||
vec3 const & v
|
vec3 const & v
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
#ifdef GLM_FORCE_RADIANS
|
float s = glm::sin(angle * 0.5f);
|
||||||
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);
|
|
||||||
|
|
||||||
return _mm_set_ps(
|
return _mm_set_ps(
|
||||||
glm::cos(a * 0.5f),
|
glm::cos(angle * 0.5f),
|
||||||
v.z * s,
|
v.z * s,
|
||||||
v.y * s,
|
v.y * s,
|
||||||
v.x * s);
|
v.x * s);
|
||||||
|
@ -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
|
|
@ -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
|
|
@ -17,15 +17,7 @@ namespace glm
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'angle' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'angle' only accept floating-point inputs");
|
||||||
|
return acos(clamp(dot(x, y), genType(0), genType(1)));
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, precision P, template <typename, precision> class vecType>
|
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");
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'angle' only accept floating-point inputs");
|
||||||
|
return acos(clamp(dot(x, y), T(0), T(1)));
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//! \todo epsilon is hard coded to 0.01
|
//! \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");
|
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));
|
detail::tvec2<T, P> const TransformedVector(glm::rotate(x, Angle));
|
||||||
if(all(epsilonEqual(y, TransformedVector, T(0.01))))
|
if(all(epsilonEqual(y, TransformedVector, T(0.01))))
|
||||||
return Angle;
|
return Angle;
|
||||||
@ -81,19 +58,8 @@ namespace glm
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'orientedAngle' only accept floating-point inputs");
|
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));
|
return mix(Angle, -Angle, dot(ref, cross(x, y)) < T(0));
|
||||||
|
|
||||||
#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;
|
|
||||||
}
|
}
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -36,11 +36,18 @@ GLM is a header only library, there is nothing to build, just include it.
|
|||||||
More informations in GLM manual:
|
More informations in GLM manual:
|
||||||
http://glm.g-truc.net/glm.pdf
|
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
|
GLM 0.9.5.1: 2014-XX-XX
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
- Fixed angle and orientedAngle that sometimes return NaN values (#145)
|
- 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
|
GLM 0.9.5.0: 2013-12-25
|
||||||
|
Loading…
Reference in New Issue
Block a user