Fixed quatLookAt #659

This commit is contained in:
Christophe Riccio 2017-07-26 02:32:40 +02:00
parent 950d226154
commit 6c70e74f3c
2 changed files with 37 additions and 37 deletions

View File

@ -60,42 +60,42 @@ namespace glm
/// @see gtx_quaternion /// @see gtx_quaternion
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_DECL tquat<T, P> squad( GLM_FUNC_DECL tquat<T, P> squad(
tquat<T, P> const & q1, tquat<T, P> const& q1,
tquat<T, P> const & q2, tquat<T, P> const& q2,
tquat<T, P> const & s1, tquat<T, P> const& s1,
tquat<T, P> const & s2, tquat<T, P> const& s2,
T const & h); T const& h);
//! Returns an intermediate control point for squad interpolation. //! Returns an intermediate control point for squad interpolation.
/// ///
/// @see gtx_quaternion /// @see gtx_quaternion
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_DECL tquat<T, P> intermediate( GLM_FUNC_DECL tquat<T, P> intermediate(
tquat<T, P> const & prev, tquat<T, P> const& prev,
tquat<T, P> const & curr, tquat<T, P> const& curr,
tquat<T, P> const & next); tquat<T, P> const& next);
//! Returns a exp of a quaternion. //! Returns a exp of a quaternion.
/// ///
/// @see gtx_quaternion /// @see gtx_quaternion
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_DECL tquat<T, P> exp( GLM_FUNC_DECL tquat<T, P> exp(
tquat<T, P> const & q); tquat<T, P> const& q);
//! Returns a log of a quaternion. //! Returns a log of a quaternion.
/// ///
/// @see gtx_quaternion /// @see gtx_quaternion
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_DECL tquat<T, P> log( GLM_FUNC_DECL tquat<T, P> log(
tquat<T, P> const & q); tquat<T, P> const& q);
/// Returns x raised to the y power. /// Returns x raised to the y power.
/// ///
/// @see gtx_quaternion /// @see gtx_quaternion
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_DECL tquat<T, P> pow( GLM_FUNC_DECL tquat<T, P> pow(
tquat<T, P> const & x, tquat<T, P> const& x,
T const & y); T const& y);
//! Returns quarternion square root. //! Returns quarternion square root.
/// ///
@ -109,37 +109,37 @@ namespace glm
/// @see gtx_quaternion /// @see gtx_quaternion
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_DECL vec<3, T, P> rotate( GLM_FUNC_DECL vec<3, T, P> rotate(
tquat<T, P> const & q, tquat<T, P> const& q,
vec<3, T, P> const & v); vec<3, T, P> const& v);
/// Rotates a 4 components vector by a quaternion. /// Rotates a 4 components vector by a quaternion.
/// ///
/// @see gtx_quaternion /// @see gtx_quaternion
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_DECL vec<4, T, P> rotate( GLM_FUNC_DECL vec<4, T, P> rotate(
tquat<T, P> const & q, tquat<T, P> const& q,
vec<4, T, P> const & v); vec<4, T, P> const& v);
/// Extract the real component of a quaternion. /// Extract the real component of a quaternion.
/// ///
/// @see gtx_quaternion /// @see gtx_quaternion
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_DECL T extractRealComponent( GLM_FUNC_DECL T extractRealComponent(
tquat<T, P> const & q); tquat<T, P> const& q);
/// Converts a quaternion to a 3 * 3 matrix. /// Converts a quaternion to a 3 * 3 matrix.
/// ///
/// @see gtx_quaternion /// @see gtx_quaternion
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_DECL mat<3, 3, T, P> toMat3( GLM_FUNC_DECL mat<3, 3, T, P> toMat3(
tquat<T, P> const & x){return mat3_cast(x);} tquat<T, P> const& x){return mat3_cast(x);}
/// Converts a quaternion to a 4 * 4 matrix. /// Converts a quaternion to a 4 * 4 matrix.
/// ///
/// @see gtx_quaternion /// @see gtx_quaternion
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_DECL mat<4, 4, T, P> toMat4( GLM_FUNC_DECL mat<4, 4, T, P> toMat4(
tquat<T, P> const & x){return mat4_cast(x);} tquat<T, P> const& x){return mat4_cast(x);}
/// Converts a 3 * 3 matrix to a quaternion. /// Converts a 3 * 3 matrix to a quaternion.
/// ///
@ -160,18 +160,18 @@ namespace glm
/// @see gtx_quaternion /// @see gtx_quaternion
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_DECL tquat<T, P> shortMix( GLM_FUNC_DECL tquat<T, P> shortMix(
tquat<T, P> const & x, tquat<T, P> const& x,
tquat<T, P> const & y, tquat<T, P> const& y,
T const & a); T const& a);
/// Quaternion normalized linear interpolation. /// Quaternion normalized linear interpolation.
/// ///
/// @see gtx_quaternion /// @see gtx_quaternion
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_DECL tquat<T, P> fastMix( GLM_FUNC_DECL tquat<T, P> fastMix(
tquat<T, P> const & x, tquat<T, P> const& x,
tquat<T, P> const & y, tquat<T, P> const& y,
T const & a); T const& a);
/// Compute the rotation between two vectors. /// Compute the rotation between two vectors.
/// param orig vector, needs to be normalized /// param orig vector, needs to be normalized
@ -180,8 +180,8 @@ namespace glm
/// @see gtx_quaternion /// @see gtx_quaternion
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_DECL tquat<T, P> rotation( GLM_FUNC_DECL tquat<T, P> rotation(
vec<3, T, P> const & orig, vec<3, T, P> const& orig,
vec<3, T, P> const & dest); vec<3, T, P> const& dest);
/// Build a look at quaternion based on the default handedness. /// Build a look at quaternion based on the default handedness.
/// ///
@ -189,8 +189,8 @@ namespace glm
/// @param up Up vector, how the camera is oriented. Typically (0, 1, 0). /// @param up Up vector, how the camera is oriented. Typically (0, 1, 0).
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_DECL tquat<T, P> quatLookAt( GLM_FUNC_DECL tquat<T, P> quatLookAt(
tvec3<T, P> const & direction, vec<3, T, P> const& direction,
tvec3<T, P> const & up); vec<3, T, P> const& up);
/// Build a right-handed look at quaternion. /// Build a right-handed look at quaternion.
/// ///
@ -198,8 +198,8 @@ namespace glm
/// @param up Up vector, how the camera is oriented. Typically (0, 1, 0). /// @param up Up vector, how the camera is oriented. Typically (0, 1, 0).
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_DECL tquat<T, P> quatLookAtRH( GLM_FUNC_DECL tquat<T, P> quatLookAtRH(
tvec3<T, P> const & direction, vec<3, T, P> const& direction,
tvec3<T, P> const & up); vec<3, T, P> const& up);
/// Build a left-handed look at quaternion. /// Build a left-handed look at quaternion.
/// ///
@ -208,8 +208,8 @@ namespace glm
/// @param up Up vector, how the camera is oriented. Typically (0, 1, 0). /// @param up Up vector, how the camera is oriented. Typically (0, 1, 0).
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_DECL tquat<T, P> quatLookAtLH( GLM_FUNC_DECL tquat<T, P> quatLookAtLH(
tvec3<T, P> const & direction, vec<3, T, P> const& direction,
tvec3<T, P> const & up); vec<3, T, P> const& up);
/// Returns the squared length of x. /// Returns the squared length of x.
/// ///

View File

@ -84,7 +84,7 @@ namespace glm
} }
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER tquat<T, P> pow(tquat<T, P> const & x, T const & y) GLM_FUNC_QUALIFIER tquat<T, P> pow(tquat<T, P> const& x, T const& y)
{ {
//Raising to the power of 0 should yield 1 //Raising to the power of 0 should yield 1
//Needed to prevent a division by 0 error later on //Needed to prevent a division by 0 error later on
@ -216,7 +216,7 @@ namespace glm
} }
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER tquat<T, P> quatLookAt(tvec3<T, P> const& direction, tvec3<T, P> const& up) GLM_FUNC_QUALIFIER tquat<T, P> quatLookAt(vec<3, T, P> const& direction, vec<3, T, P> const& up)
{ {
# if GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED # if GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED
return quatLookAtLH(direction, up); return quatLookAtLH(direction, up);
@ -226,7 +226,7 @@ namespace glm
} }
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER tquat<T, P> quatLookAtRH(tvec3<T, P> const& direction, tvec3<T, P> const& up) GLM_FUNC_QUALIFIER tquat<T, P> quatLookAtRH(vec<3, T, P> const& direction, vec<3, T, P> const& up)
{ {
tmat3x3<T, P> Result; tmat3x3<T, P> Result;
@ -238,7 +238,7 @@ namespace glm
} }
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER tquat<T, P> quatLookAtLH(tvec3<T, P> const& direction, tvec3<T, P> const& up) GLM_FUNC_QUALIFIER tquat<T, P> quatLookAtLH(vec<3, T, P> const& direction, vec<3, T, P> const& up)
{ {
tmat3x3<T, P> Result; tmat3x3<T, P> Result;