Fixed merge
This commit is contained in:
@@ -57,11 +57,11 @@ namespace glm
|
||||
/// Returns the component-wise compare of |x - y| < epsilon.
|
||||
/// @see gtc_epsilon
|
||||
template <typename genType>
|
||||
typename genType::boolType epsilonEqual(
|
||||
genType const & x,
|
||||
genType const & y,
|
||||
typename genType::value_type const & epsilon);
|
||||
|
||||
typename genType::boolType epsilonEqual(
|
||||
genType const & x,
|
||||
genType const & y,
|
||||
typename genType::value_type const & epsilon);
|
||||
|
||||
/// Returns the component-wise compare of |x - y| < epsilon.
|
||||
/// @see gtc_epsilon
|
||||
template <typename genType>
|
||||
@@ -73,11 +73,11 @@ namespace glm
|
||||
/// Returns the component-wise compare of |x - y| < epsilon.
|
||||
/// @see gtc_epsilon
|
||||
template <typename genType>
|
||||
typename genType::boolType epsilonNotEqual(
|
||||
genType const & x,
|
||||
genType const & y,
|
||||
typename genType::value_type const & epsilon);
|
||||
|
||||
typename genType::boolType epsilonNotEqual(
|
||||
genType const & x,
|
||||
genType const & y,
|
||||
typename genType::value_type const & epsilon);
|
||||
|
||||
/// Returns the component-wise compare of |x - y| >= epsilon.
|
||||
/// @see gtc_epsilon
|
||||
template <typename genType>
|
||||
|
||||
@@ -269,21 +269,6 @@ namespace glm
|
||||
abs(x.w - y.w) < epsilon);
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<bool> epsilonEqual
|
||||
(
|
||||
detail::tquat<valType> const & x,
|
||||
detail::tquat<valType> const & y,
|
||||
detail::tquat<valType> const & epsilon
|
||||
)
|
||||
{
|
||||
return detail::tvec4<bool>(
|
||||
abs(x.x - y.x) < epsilon.x,
|
||||
abs(x.y - y.y) < epsilon.y,
|
||||
abs(x.z - y.z) < epsilon.z,
|
||||
abs(x.w - y.w) < epsilon.w);
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<bool> epsilonNotEqual
|
||||
(
|
||||
@@ -298,19 +283,4 @@ namespace glm
|
||||
abs(x.z - y.z) >= epsilon,
|
||||
abs(x.w - y.w) >= epsilon);
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<bool> epsilonNotEqual
|
||||
(
|
||||
detail::tquat<valType> const & x,
|
||||
detail::tquat<valType> const & y,
|
||||
detail::tquat<valType> const & epsilon
|
||||
)
|
||||
{
|
||||
return detail::tvec4<bool>(
|
||||
abs(x.x - y.x) >= epsilon.x,
|
||||
abs(x.y - y.y) >= epsilon.y,
|
||||
abs(x.z - y.z) >= epsilon.z,
|
||||
abs(x.w - y.w) >= epsilon.w);
|
||||
}
|
||||
}//namespace glm
|
||||
|
||||
@@ -87,8 +87,8 @@ namespace glm
|
||||
///
|
||||
/// @param m Input matrix multiplied by this rotation matrix.
|
||||
/// @param angle Rotation angle expressed in radians if GLM_FORCE_RADIANS is define or degrees otherwise.
|
||||
/// @param axis Rotation axis.
|
||||
/// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double.
|
||||
/// @param axis Rotation axis, recommanded to be normalized.
|
||||
/// @tparam T Value type used to build the matrix. Supported: half, float or double.
|
||||
/// @see gtc_matrix_transform
|
||||
/// @see gtx_transform
|
||||
/// @see - rotate(T angle, T x, T y, T z)
|
||||
@@ -143,7 +143,7 @@ namespace glm
|
||||
/// @param top
|
||||
/// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double.
|
||||
/// @see gtc_matrix_transform
|
||||
/// @see - glm::ortho(T const & left, T const & right, T const & bottom, T const & top, T const & zNear, T const & zFar)
|
||||
/// @see - glm::ortho(T const & left, T const & right, T const & bottom, T const & top, T const & zNear, T const & zFar)
|
||||
template <typename T>
|
||||
detail::tmat4x4<T> ortho(
|
||||
T const & left,
|
||||
@@ -209,7 +209,7 @@ namespace glm
|
||||
/// @param near
|
||||
/// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double.
|
||||
/// @see gtc_matrix_transform
|
||||
template <typename T>
|
||||
template <typename T>
|
||||
detail::tmat4x4<T> infinitePerspective(
|
||||
T fovy, T aspect, T near);
|
||||
|
||||
@@ -220,7 +220,7 @@ namespace glm
|
||||
/// @param near
|
||||
/// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double.
|
||||
/// @see gtc_matrix_transform
|
||||
template <typename T>
|
||||
template <typename T>
|
||||
detail::tmat4x4<T> tweakedInfinitePerspective(
|
||||
T fovy, T aspect, T near);
|
||||
|
||||
|
||||
@@ -236,7 +236,13 @@ namespace glm
|
||||
valType const & zFar
|
||||
)
|
||||
{
|
||||
valType range = tan(radians(fovy / valType(2))) * zNear;
|
||||
#ifdef GLM_FORCE_RADIANS
|
||||
valType const rad = fovy;
|
||||
#else
|
||||
valType const rad = glm::radians(fovy);
|
||||
#endif
|
||||
|
||||
valType range = tan(radians(rad / valType(2))) * zNear;
|
||||
valType left = -range * aspect;
|
||||
valType right = range * aspect;
|
||||
valType bottom = -range;
|
||||
|
||||
@@ -22,12 +22,13 @@
|
||||
///
|
||||
/// @ref gtc_quaternion
|
||||
/// @file glm/gtc/quaternion.hpp
|
||||
/// @date 2009-05-21 / 2011-06-05
|
||||
/// @date 2009-05-21 / 2012-12-20
|
||||
/// @author Christophe Riccio
|
||||
///
|
||||
/// @see core (dependence)
|
||||
/// @see gtc_half_float (dependence)
|
||||
///
|
||||
/// @see gtc_constants (dependence)
|
||||
///
|
||||
/// @defgroup gtc_quaternion GLM_GTC_quaternion
|
||||
/// @ingroup gtc
|
||||
///
|
||||
@@ -42,6 +43,7 @@
|
||||
// Dependency:
|
||||
#include "../glm.hpp"
|
||||
#include "../gtc/half_float.hpp"
|
||||
#include "../gtc/constants.hpp"
|
||||
|
||||
#if(defined(GLM_MESSAGES) && !defined(glm_ext))
|
||||
# pragma message("GLM: GLM_GTC_quaternion extension included")
|
||||
@@ -169,15 +171,50 @@ namespace detail
|
||||
detail::tquat<T> const & q1,
|
||||
detail::tquat<T> const & q2);
|
||||
|
||||
/// Returns a SLERP interpolated quaternion of x and y according a.
|
||||
/// Spherical linear interpolation of two quaternions.
|
||||
/// The interpolation is oriented and the rotation is performed at constant speed.
|
||||
/// For short path spherical linear interpolation, use the slerp function.
|
||||
///
|
||||
/// @param x A quaternion
|
||||
/// @param y A quaternion
|
||||
/// @param a Interpolation factor. The interpolation is defined beyond the range [0, 1].
|
||||
/// @tparam T Value type used to build the quaternion. Supported: half, float or double.
|
||||
/// @see gtc_quaternion
|
||||
/// @see - slerp(detail::tquat<T> const & x, detail::tquat<T> const & y, T const & a)
|
||||
template <typename T>
|
||||
detail::tquat<T> mix(
|
||||
detail::tquat<T> const & x,
|
||||
detail::tquat<T> const & y,
|
||||
T const & a);
|
||||
|
||||
|
||||
/// Linear interpolation of two quaternions.
|
||||
/// The interpolation is oriented.
|
||||
///
|
||||
/// @param x A quaternion
|
||||
/// @param y A quaternion
|
||||
/// @param a Interpolation factor. The interpolation is defined in the range [0, 1].
|
||||
/// @tparam T Value type used to build the quaternion. Supported: half, float or double.
|
||||
/// @see gtc_quaternion
|
||||
template <typename T>
|
||||
detail::tquat<T> lerp(
|
||||
detail::tquat<T> const & x,
|
||||
detail::tquat<T> const & y,
|
||||
T const & a);
|
||||
|
||||
/// Spherical linear interpolation of two quaternions.
|
||||
/// The interpolation always take the short path and the rotation is performed at constant speed.
|
||||
///
|
||||
/// @param x A quaternion
|
||||
/// @param y A quaternion
|
||||
/// @param a Interpolation factor. The interpolation is defined beyond the range [0, 1].
|
||||
/// @tparam T Value type used to build the quaternion. Supported: half, float or double.
|
||||
/// @see gtc_quaternion
|
||||
template <typename T>
|
||||
detail::tquat<T> slerp(
|
||||
detail::tquat<T> const & x,
|
||||
detail::tquat<T> const & y,
|
||||
T const & a);
|
||||
|
||||
/// Returns the q conjugate.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
|
||||
@@ -443,6 +443,7 @@ namespace detail
|
||||
return normalize(beta * x + alpha * y);
|
||||
}
|
||||
*/
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tquat<T> mix
|
||||
(
|
||||
@@ -451,8 +452,77 @@ namespace detail
|
||||
T const & a
|
||||
)
|
||||
{
|
||||
T angle = acos(dot(x, y));
|
||||
return (glm::sin((T(1) - a) * angle) * x + glm::sin(a * angle) * y) / glm::sin(angle);
|
||||
T cosTheta = dot(x, y);
|
||||
|
||||
// Perform a linear interpolation when cosTheta is close to 1 to avoid side effect of sin(angle) becoming a zero denominator
|
||||
if(cosTheta > T(1) - epsilon<T>())
|
||||
{
|
||||
// Linear interpolation
|
||||
return detail::tquat<T>(
|
||||
mix(x.w, y.w, a),
|
||||
mix(x.x, y.x, a),
|
||||
mix(x.y, y.y, a),
|
||||
mix(x.z, y.z, a));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Essential Mathematics, page 467
|
||||
T angle = acos(cosTheta);
|
||||
return (sin((T(1) - a) * angle) * x + sin(a * angle) * y) / sin(angle);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tquat<T> lerp
|
||||
(
|
||||
detail::tquat<T> const & x,
|
||||
detail::tquat<T> const & y,
|
||||
T const & a
|
||||
)
|
||||
{
|
||||
// Lerp is only defined in [0, 1]
|
||||
assert(a >= T(0));
|
||||
assert(a <= T(1));
|
||||
|
||||
return x * (T(1) - a) + (y * a);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tquat<T> slerp
|
||||
(
|
||||
detail::tquat<T> const & x,
|
||||
detail::tquat<T> const & y,
|
||||
T const & a
|
||||
)
|
||||
{
|
||||
detail::tquat<T> z = y;
|
||||
|
||||
T cosTheta = dot(x, y);
|
||||
|
||||
// If cosTheta < 0, the interpolation will take the long way around the sphere.
|
||||
// To fix this, one quat must be negated.
|
||||
if (cosTheta < T(0))
|
||||
{
|
||||
z = -y;
|
||||
cosTheta = -cosTheta;
|
||||
}
|
||||
|
||||
// Perform a linear interpolation when cosTheta is close to 1 to avoid side effect of sin(angle) becoming a zero denominator
|
||||
if(cosTheta > T(1) - epsilon<T>())
|
||||
{
|
||||
// Linear interpolation
|
||||
return detail::tquat<T>(
|
||||
mix(x.w, y.w, a),
|
||||
mix(x.x, y.x, a),
|
||||
mix(x.y, y.y, a),
|
||||
mix(x.z, y.z, a));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Essential Mathematics, page 467
|
||||
T angle = acos(cosTheta);
|
||||
return (sin((T(1) - a) * angle) * x + sin(a * angle) * z) / sin(angle);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@@ -592,7 +662,7 @@ namespace detail
|
||||
typename detail::tquat<T>::value_type fourYSquaredMinus1 = m[1][1] - m[0][0] - m[2][2];
|
||||
typename detail::tquat<T>::value_type fourZSquaredMinus1 = m[2][2] - m[0][0] - m[1][1];
|
||||
typename detail::tquat<T>::value_type fourWSquaredMinus1 = m[0][0] + m[1][1] + m[2][2];
|
||||
|
||||
|
||||
int biggestIndex = 0;
|
||||
typename detail::tquat<T>::value_type fourBiggestSquaredMinus1 = fourWSquaredMinus1;
|
||||
if(fourXSquaredMinus1 > fourBiggestSquaredMinus1)
|
||||
@@ -641,6 +711,10 @@ namespace detail
|
||||
Result.y = (m[1][2] + m[2][1]) * mult;
|
||||
Result.z = biggestVal;
|
||||
break;
|
||||
|
||||
default: // Silence a -Wswitch-default warning in GCC. Should never actually get here. Assert is just for sanity.
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
||||
@@ -36,8 +36,10 @@
|
||||
#include <cmath>
|
||||
#include <cfloat>
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4127)
|
||||
#if(GLM_COMPILER & GLM_COMPILER_VC)
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4127)
|
||||
#endif
|
||||
|
||||
typedef union
|
||||
{
|
||||
@@ -186,7 +188,9 @@ namespace detail
|
||||
}//namespace detail
|
||||
}//namespace glm
|
||||
|
||||
#pragma warning(pop)
|
||||
#if(GLM_COMPILER & GLM_COMPILER_VC)
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#if((GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS)))
|
||||
# define GLM_NEXT_AFTER_FLT(x, toward) glm::detail::nextafterf((x), (toward))
|
||||
|
||||
Reference in New Issue
Block a user