Added GLM_FORCE_RADIANS
This commit is contained in:
@@ -83,10 +83,10 @@ namespace glm
|
||||
detail::tmat4x4<T> const & m,
|
||||
detail::tvec3<T> const & v);
|
||||
|
||||
/// Builds a rotation 4 * 4 matrix created from an axis vector and an angle expressed in degrees.
|
||||
/// Builds a rotation 4 * 4 matrix created from an axis vector and an angle.
|
||||
///
|
||||
/// @param m Input matrix multiplied by this rotation matrix.
|
||||
/// @param angle Rotation angle expressed in degrees.
|
||||
/// @param angle Rotation angle expressed in radians if GLM_FORCE_RADIANS is define or degrees otherwise.
|
||||
/// @param axis Rotation axis, recommanded to be normalized.
|
||||
/// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double.
|
||||
/// @see gtc_matrix_transform
|
||||
@@ -172,7 +172,7 @@ namespace glm
|
||||
|
||||
/// Creates a matrix for a symetric perspective-view frustum.
|
||||
///
|
||||
/// @param fovy
|
||||
/// @param fovy Expressed in radians if GLM_FORCE_RADIANS is define or degrees otherwise.
|
||||
/// @param aspect
|
||||
/// @param near
|
||||
/// @param far
|
||||
@@ -187,7 +187,7 @@ namespace glm
|
||||
|
||||
/// Builds a perspective projection matrix based on a field of view.
|
||||
///
|
||||
/// @param fov
|
||||
/// @param fov Expressed in radians if GLM_FORCE_RADIANS is define or degrees otherwise.
|
||||
/// @param width
|
||||
/// @param height
|
||||
/// @param near
|
||||
@@ -204,7 +204,7 @@ namespace glm
|
||||
|
||||
/// Creates a matrix for a symmetric perspective-view frustum with far plane at infinite.
|
||||
///
|
||||
/// @param fovy
|
||||
/// @param fovy Expressed in radians if GLM_FORCE_RADIANS is define or degrees otherwise.
|
||||
/// @param aspect
|
||||
/// @param near
|
||||
/// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double.
|
||||
@@ -215,7 +215,7 @@ namespace glm
|
||||
|
||||
/// Creates a matrix for a symmetric perspective-view frustum with far plane at infinite for graphics hardware that doesn't support depth clamping.
|
||||
///
|
||||
/// @param fovy
|
||||
/// @param fovy Expressed in radians if GLM_FORCE_RADIANS is define or degrees otherwise.
|
||||
/// @param aspect
|
||||
/// @param near
|
||||
/// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double.
|
||||
|
||||
@@ -48,7 +48,11 @@ namespace glm
|
||||
detail::tvec3<T> const & v
|
||||
)
|
||||
{
|
||||
T a = radians(angle);
|
||||
#ifdef GLM_FORCE_RADIANS
|
||||
T a = angle;
|
||||
#else
|
||||
T a = radians(angle);
|
||||
#endif
|
||||
T c = cos(a);
|
||||
T s = sin(a);
|
||||
|
||||
@@ -120,7 +124,11 @@ namespace glm
|
||||
detail::tvec3<T> const & v
|
||||
)
|
||||
{
|
||||
T a = radians(angle);
|
||||
#ifdef GLM_FORCE_RADIANS
|
||||
T const a = angle;
|
||||
#else
|
||||
T const a = radians(angle);
|
||||
#endif
|
||||
T c = cos(a);
|
||||
T s = sin(a);
|
||||
detail::tmat4x4<T> Result;
|
||||
@@ -253,7 +261,11 @@ namespace glm
|
||||
valType const & zFar
|
||||
)
|
||||
{
|
||||
#ifdef GLM_FORCE_RADIANS
|
||||
valType rad = fov;
|
||||
#else
|
||||
valType rad = glm::radians(fov);
|
||||
#endif
|
||||
valType h = glm::cos(valType(0.5) * rad) / glm::sin(valType(0.5) * rad);
|
||||
valType w = h * height / width;
|
||||
|
||||
@@ -274,7 +286,11 @@ namespace glm
|
||||
T zNear
|
||||
)
|
||||
{
|
||||
T range = tan(radians(fovy / T(2))) * zNear;
|
||||
#ifdef GLM_FORCE_RADIANS
|
||||
T const range = tan(fovy / T(2)) * zNear;
|
||||
#else
|
||||
T const range = tan(radians(fovy / T(2))) * zNear;
|
||||
#endif
|
||||
T left = -range * aspect;
|
||||
T right = range * aspect;
|
||||
T bottom = -range;
|
||||
@@ -297,7 +313,11 @@ namespace glm
|
||||
T zNear
|
||||
)
|
||||
{
|
||||
#ifdef GLM_FORCE_RADIANS
|
||||
T range = tan(fovy / T(2)) * zNear;
|
||||
#else
|
||||
T range = tan(radians(fovy / T(2))) * zNear;
|
||||
#endif
|
||||
T left = -range * aspect;
|
||||
T right = range * aspect;
|
||||
T bottom = -range;
|
||||
|
||||
@@ -195,7 +195,9 @@ namespace detail
|
||||
detail::tquat<T> inverse(
|
||||
detail::tquat<T> const & q);
|
||||
|
||||
/// Rotates a quaternion from an vector of 3 components axis and an angle expressed in degrees.
|
||||
/// Rotates a quaternion from an vector of 3 components axis and an angle.
|
||||
///
|
||||
/// @param angle Angle expressed in radians if GLM_FORCE_RADIANS is define or degrees otherwise.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template <typename T>
|
||||
|
||||
@@ -487,10 +487,14 @@ namespace detail
|
||||
Tmp.z *= oneOverLen;
|
||||
}
|
||||
|
||||
typename detail::tquat<T>::value_type AngleRad = radians(angle);
|
||||
typename detail::tquat<T>::value_type fSin = sin(AngleRad * T(0.5));
|
||||
#ifdef GLM_FORCE_RADIANS
|
||||
typename detail::tquat<T>::value_type const AngleRad(angle);
|
||||
#else
|
||||
typename detail::tquat<T>::value_type const AngleRad = radians(angle);
|
||||
#endif
|
||||
typename detail::tquat<T>::value_type const Sin = sin(AngleRad * T(0.5));
|
||||
|
||||
return q * detail::tquat<T>(cos(AngleRad * T(0.5)), Tmp.x * fSin, Tmp.y * fSin, Tmp.z * fSin);
|
||||
return q * detail::tquat<T>(cos(AngleRad * T(0.5)), Tmp.x * Sin, Tmp.y * Sin, Tmp.z * Sin);
|
||||
//return gtc::quaternion::cross(q, detail::tquat<T>(cos(AngleRad * T(0.5)), Tmp.x * fSin, Tmp.y * fSin, Tmp.z * fSin));
|
||||
}
|
||||
|
||||
|
||||
@@ -20,29 +20,29 @@
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref gtx_reciprocal
|
||||
/// @file glm/gtx/reciprocal.hpp
|
||||
/// @date 2008-10-09 / 2011-06-07
|
||||
/// @ref gtc_reciprocal
|
||||
/// @file glm/gtc/reciprocal.hpp
|
||||
/// @date 2008-10-09 / 2012-01-25
|
||||
/// @author Christophe Riccio
|
||||
///
|
||||
/// @see core (dependence)
|
||||
///
|
||||
/// @defgroup gtx_reciprocal GLM_GTX_reciprocal: Reciprocal
|
||||
/// @ingroup gtx
|
||||
/// @defgroup gtc_reciprocal GLM_GTC_reciprocal: Reciprocal
|
||||
/// @ingroup gtc
|
||||
///
|
||||
/// @brief Define secant, cosecant and cotangent functions.
|
||||
///
|
||||
/// <glm/gtx/reciprocal.hpp> need to be included to use these functionalities.
|
||||
/// <glm/gtc/reciprocal.hpp> need to be included to use these functionalities.
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef GLM_GTX_reciprocal
|
||||
#define GLM_GTX_reciprocal GLM_VERSION
|
||||
#ifndef GLM_GTC_reciprocal
|
||||
#define GLM_GTC_reciprocal GLM_VERSION
|
||||
|
||||
// Dependency:
|
||||
#include "../glm.hpp"
|
||||
|
||||
#if(defined(GLM_MESSAGES) && !defined(glm_ext))
|
||||
# pragma message("GLM: GLM_GTX_reciprocal extension included")
|
||||
# pragma message("GLM: GLM_GTC_reciprocal extension included")
|
||||
#endif
|
||||
|
||||
namespace glm
|
||||
@@ -118,4 +118,4 @@ namespace glm
|
||||
|
||||
#include "reciprocal.inl"
|
||||
|
||||
#endif//GLM_GTX_reciprocal
|
||||
#endif//GLM_GTC_reciprocal
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2008-10-09
|
||||
// Updated : 2011-10-14
|
||||
// Updated : 2012-01-25
|
||||
// Licence : This source is under MIT License
|
||||
// File : glm/gtx/reciprocal.inl
|
||||
// File : glm/gtc/reciprocal.inl
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "../core/_vectorize.hpp"
|
||||
|
||||
Reference in New Issue
Block a user