Correct component amounts for simqQuat and simdVec4

This commit is contained in:
Jesse Talavera-Greenberg 2015-07-03 15:00:37 -04:00
parent a9c26d065b
commit 5d05c8c1f7
2 changed files with 99 additions and 99 deletions

View File

@ -8,14 +8,14 @@
/// 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.
///
///
/// Restrictions:
/// By making use of the Software for military purposes, you choose to make
/// a Bunny unhappy.
///
///
/// 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
@ -33,9 +33,9 @@
///
/// @defgroup gtx_simd_quat GLM_GTX_simd_quat
/// @ingroup gtx
///
///
/// @brief SIMD implementation of quat type.
///
///
/// <glm/gtx/simd_quat.hpp> need to be included to use these functionalities.
///////////////////////////////////////////////////////////////////////////////////
@ -76,10 +76,10 @@ namespace detail
typedef fquatSIMD type;
typedef tquat<bool, defaultp> bool_type;
# if GLM_HAS_CONSTEXPR
static GLM_CONSTEXPR length_t components = 1;
static GLM_CONSTEXPR length_t components = 4;
static GLM_CONSTEXPR precision prec = defaultp;
# else
static const length_t components = 1;
static const length_t components = 4;
static const precision prec = defaultp;
# endif
@ -106,15 +106,15 @@ namespace detail
explicit fquatSIMD(
ctor);
explicit fquatSIMD(
float const & w,
float const & x,
float const & y,
float const & w,
float const & x,
float const & y,
float const & z);
explicit fquatSIMD(
quat const & v);
explicit fquatSIMD(
vec3 const & eulerAngles);
//////////////////////////////////////
// Unary arithmetic operators
@ -131,16 +131,16 @@ namespace detail
detail::fquatSIMD operator- (
detail::fquatSIMD const & q);
detail::fquatSIMD operator+ (
detail::fquatSIMD const & q,
detail::fquatSIMD const & p);
detail::fquatSIMD operator+ (
detail::fquatSIMD const & q,
detail::fquatSIMD const & p);
detail::fquatSIMD operator* (
detail::fquatSIMD const & q,
detail::fquatSIMD const & p);
detail::fquatSIMD operator* (
detail::fquatSIMD const & q,
detail::fquatSIMD const & p);
detail::fvec4SIMD operator* (
detail::fquatSIMD const & q,
detail::fquatSIMD const & q,
detail::fvec4SIMD const & v);
detail::fvec4SIMD operator* (
@ -148,7 +148,7 @@ namespace detail
detail::fquatSIMD const & q);
detail::fquatSIMD operator* (
detail::fquatSIMD const & q,
detail::fquatSIMD const & q,
float s);
detail::fquatSIMD operator* (
@ -156,7 +156,7 @@ namespace detail
detail::fquatSIMD const & q);
detail::fquatSIMD operator/ (
detail::fquatSIMD const & q,
detail::fquatSIMD const & q,
float s);
}//namespace detail
@ -199,64 +199,64 @@ namespace detail
detail::fquatSIMD const & q);
/// Returns the length of the quaternion.
///
/// Returns the length of the quaternion.
///
/// @see gtx_simd_quat
float length(
detail::fquatSIMD const & x);
/// Returns the normalized quaternion.
///
/// Returns the normalized quaternion.
///
/// @see gtx_simd_quat
detail::fquatSIMD normalize(
detail::fquatSIMD const & x);
/// Returns dot product of q1 and q2, i.e., q1[0] * q2[0] + q1[1] * q2[1] + ...
///
/// Returns dot product of q1 and q2, i.e., q1[0] * q2[0] + q1[1] * q2[1] + ...
///
/// @see gtx_simd_quat
float dot(
detail::fquatSIMD const & q1,
detail::fquatSIMD const & q1,
detail::fquatSIMD const & q2);
/// 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 gtx_simd_quat
/// @see - slerp(detail::fquatSIMD const & x, detail::fquatSIMD const & y, T const & a)
/// @see - slerp(detail::fquatSIMD const & x, detail::fquatSIMD const & y, T const & a)
detail::fquatSIMD mix(
detail::fquatSIMD const & x,
detail::fquatSIMD const & y,
detail::fquatSIMD const & x,
detail::fquatSIMD const & y,
float const & a);
/// Linear interpolation of two quaternions.
/// 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 gtx_simd_quat
detail::fquatSIMD lerp(
detail::fquatSIMD const & x,
detail::fquatSIMD const & y,
detail::fquatSIMD const & x,
detail::fquatSIMD const & y,
float 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 gtx_simd_quat
detail::fquatSIMD slerp(
detail::fquatSIMD const & x,
detail::fquatSIMD const & y,
detail::fquatSIMD const & x,
detail::fquatSIMD const & y,
float const & a);
@ -269,10 +269,10 @@ namespace detail
/// This will use the equivalent to fastAcos() and fastSin().
///
/// @see gtx_simd_quat
/// @see - mix(detail::fquatSIMD const & x, detail::fquatSIMD const & y, T const & a)
/// @see - mix(detail::fquatSIMD const & x, detail::fquatSIMD const & y, T const & a)
detail::fquatSIMD fastMix(
detail::fquatSIMD const & x,
detail::fquatSIMD const & y,
detail::fquatSIMD const & x,
detail::fquatSIMD const & y,
float const & a);
/// Identical to fastMix() except takes the shortest path.
@ -280,22 +280,22 @@ namespace detail
/// The same rules apply here as those in fastMix(). Both quaternions must be unit length and 'a' must be
/// in the range [0, 1].
///
/// @see - fastMix(detail::fquatSIMD const & x, detail::fquatSIMD const & y, T const & a)
/// @see - slerp(detail::fquatSIMD const & x, detail::fquatSIMD const & y, T const & a)
/// @see - fastMix(detail::fquatSIMD const & x, detail::fquatSIMD const & y, T const & a)
/// @see - slerp(detail::fquatSIMD const & x, detail::fquatSIMD const & y, T const & a)
detail::fquatSIMD fastSlerp(
detail::fquatSIMD const & x,
detail::fquatSIMD const & y,
detail::fquatSIMD const & x,
detail::fquatSIMD const & y,
float const & a);
/// Returns the q conjugate.
///
/// Returns the q conjugate.
///
/// @see gtx_simd_quat
detail::fquatSIMD conjugate(
detail::fquatSIMD const & q);
/// Returns the q inverse.
///
/// Returns the q inverse.
///
/// @see gtx_simd_quat
detail::fquatSIMD inverse(
detail::fquatSIMD const & q);
@ -303,14 +303,14 @@ namespace detail
/// Build a quaternion from an angle and a normalized axis.
///
/// @param angle Angle expressed in radians.
/// @param axis Axis of the quaternion, must be normalized.
/// @param axis Axis of the quaternion, must be normalized.
///
/// @see gtx_simd_quat
detail::fquatSIMD angleAxisSIMD(
float const & angle,
float const & angle,
vec3 const & axis);
/// Build a quaternion from an angle and a normalized axis.
/// Build a quaternion from an angle and a normalized axis.
///
/// @param angle Angle expressed in radians.
/// @param x x component of the x-axis, x, y, z must be a normalized axis
@ -319,9 +319,9 @@ namespace detail
///
/// @see gtx_simd_quat
detail::fquatSIMD angleAxisSIMD(
float const & angle,
float const & x,
float const & y,
float const & angle,
float const & x,
float const & y,
float const & z);
// TODO: Move this to somewhere more appropriate. Used with fastMix() and fastSlerp().

View File

@ -8,14 +8,14 @@
/// 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.
///
///
/// Restrictions:
/// By making use of the Software for military purposes, you choose to make
/// a Bunny unhappy.
///
///
/// 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
@ -33,9 +33,9 @@
///
/// @defgroup gtx_simd_vec4 GLM_GTX_simd_vec4
/// @ingroup gtx
///
///
/// @brief SIMD implementation of vec4 type.
///
///
/// <glm/gtx/simd_vec4.hpp> need to be included to use these functionalities.
///////////////////////////////////////////////////////////////////////////////////
@ -99,10 +99,10 @@ namespace detail
typedef fvec4SIMD type;
typedef tvec4<bool, highp> bool_type;
# if GLM_HAS_CONSTEXPR
static GLM_CONSTEXPR length_t components = 1;
static GLM_CONSTEXPR length_t components = 4;
static GLM_CONSTEXPR precision prec = defaultp;
# else
static const length_t components = 1;
static const length_t components = 4;
static const precision prec = defaultp;
# endif
@ -131,9 +131,9 @@ namespace detail
explicit fvec4SIMD(
float const & s);
explicit fvec4SIMD(
float const & x,
float const & y,
float const & z,
float const & x,
float const & y,
float const & z,
float const & w);
explicit fvec4SIMD(
vec4 const & v);
@ -220,13 +220,13 @@ namespace detail
//! Returns a value equal to the nearest integer to x.
//! A fractional part of 0.5 will round toward the nearest even
//! integer. (Both 3.5 and 4.5 for x will return 4.0.)
//! integer. (Both 3.5 and 4.5 for x will return 4.0.)
///
/// @see gtx_simd_vec4
//detail::fvec4SIMD roundEven(detail::fvec4SIMD const & x);
//! Returns a value equal to the nearest integer
//! that is greater than or equal to x.
//! Returns a value equal to the nearest integer
//! that is greater than or equal to x.
/// @see gtx_simd_vec4
detail::fvec4SIMD ceil(detail::fvec4SIMD const & x);
@ -240,7 +240,7 @@ namespace detail
///
/// @see gtx_simd_vec4
detail::fvec4SIMD mod(
detail::fvec4SIMD const & x,
detail::fvec4SIMD const & x,
detail::fvec4SIMD const & y);
//! Modulus. Returns x - y * floor(x / y)
@ -248,7 +248,7 @@ namespace detail
///
/// @see gtx_simd_vec4
detail::fvec4SIMD mod(
detail::fvec4SIMD const & x,
detail::fvec4SIMD const & x,
float const & y);
//! Returns the fractional part of x and sets i to the integer
@ -257,51 +257,51 @@ namespace detail
//! sign as x.
//! (From GLM_GTX_simd_vec4 extension, common function)
//detail::fvec4SIMD modf(
// detail::fvec4SIMD const & x,
// detail::fvec4SIMD const & x,
// detail::fvec4SIMD & i);
//! Returns y if y < x; otherwise, it returns x.
///
///
/// @see gtx_simd_vec4
detail::fvec4SIMD min(
detail::fvec4SIMD const & x,
detail::fvec4SIMD const & x,
detail::fvec4SIMD const & y);
detail::fvec4SIMD min(
detail::fvec4SIMD const & x,
detail::fvec4SIMD const & x,
float const & y);
//! Returns y if x < y; otherwise, it returns x.
///
/// @see gtx_simd_vec4
detail::fvec4SIMD max(
detail::fvec4SIMD const & x,
detail::fvec4SIMD const & x,
detail::fvec4SIMD const & y);
detail::fvec4SIMD max(
detail::fvec4SIMD const & x,
detail::fvec4SIMD const & x,
float const & y);
//! Returns min(max(x, minVal), maxVal) for each component in x
//! Returns min(max(x, minVal), maxVal) for each component in x
//! using the floating-point values minVal and maxVal.
///
/// @see gtx_simd_vec4
detail::fvec4SIMD clamp(
detail::fvec4SIMD const & x,
detail::fvec4SIMD const & minVal,
detail::fvec4SIMD const & maxVal);
detail::fvec4SIMD const & x,
detail::fvec4SIMD const & minVal,
detail::fvec4SIMD const & maxVal);
detail::fvec4SIMD clamp(
detail::fvec4SIMD const & x,
float const & minVal,
float const & maxVal);
detail::fvec4SIMD const & x,
float const & minVal,
float const & maxVal);
//! \return If genTypeU is a floating scalar or vector:
//! Returns x * (1.0 - a) + y * a, i.e., the linear blend of
//! x and y using the floating-point value a.
//! \return If genTypeU is a floating scalar or vector:
//! Returns x * (1.0 - a) + y * a, i.e., the linear blend of
//! x and y using the floating-point value a.
//! The value for a is not restricted to the range [0, 1].
//!
//! \return If genTypeU is a boolean scalar or vector:
//! \return If genTypeU is a boolean scalar or vector:
//! Selects which vector each returned component comes
//! from. For a component of a that is false, the
//! corresponding component of x is returned. For a
@ -312,9 +312,9 @@ namespace detail
//! provides different functionality than
//! genType mix(genType x, genType y, genType(a))
//! where a is a Boolean vector.
//!
//!
//! From GLSL 1.30.08 specification, section 8.3
//!
//!
//! \param[in] x Floating point scalar or vector.
//! \param[in] y Floating point scalar or vector.
//! \param[in] a Floating point or boolean scalar or vector.
@ -323,19 +323,19 @@ namespace detail
///
/// @see gtx_simd_vec4
detail::fvec4SIMD mix(
detail::fvec4SIMD const & x,
detail::fvec4SIMD const & y,
detail::fvec4SIMD const & x,
detail::fvec4SIMD const & y,
detail::fvec4SIMD const & a);
//! Returns 0.0 if x < edge, otherwise it returns 1.0.
///
/// @see gtx_simd_vec4
detail::fvec4SIMD step(
detail::fvec4SIMD const & edge,
detail::fvec4SIMD const & edge,
detail::fvec4SIMD const & x);
detail::fvec4SIMD step(
float const & edge,
float const & edge,
detail::fvec4SIMD const & x);
//! Returns 0.0 if x <= edge0 and 1.0 if x >= edge1 and
@ -350,13 +350,13 @@ namespace detail
///
/// @see gtx_simd_vec4
detail::fvec4SIMD smoothstep(
detail::fvec4SIMD const & edge0,
detail::fvec4SIMD const & edge1,
detail::fvec4SIMD const & edge0,
detail::fvec4SIMD const & edge1,
detail::fvec4SIMD const & x);
detail::fvec4SIMD smoothstep(
float const & edge0,
float const & edge1,
float const & edge0,
float const & edge1,
detail::fvec4SIMD const & x);
//! Returns true if x holds a NaN (not a number)
@ -397,8 +397,8 @@ namespace detail
///
/// @see gtx_simd_vec4
detail::fvec4SIMD fma(
detail::fvec4SIMD const & a,
detail::fvec4SIMD const & b,
detail::fvec4SIMD const & a,
detail::fvec4SIMD const & b,
detail::fvec4SIMD const & c);
//! Splits x into a floating-point significand in the range