46 #include "../gtc/quaternion.hpp"
47 #include "../gtx/fast_trigonometry.hpp"
49 #if(GLM_ARCH != GLM_ARCH_PURE)
51 #if(GLM_ARCH & GLM_ARCH_SSE2)
52 # include "../gtx/simd_mat4.hpp"
54 # error "GLM: GLM_GTX_simd_quat requires compiler support of SSE2 through intrinsics"
57 #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
58 # pragma message("GLM: GLM_GTX_simd_quat extension included")
62 #if (GLM_COMPILER & GLM_COMPILER_VC)
63 # pragma warning(push)
64 # pragma warning(disable:4201) // warning C4201: nonstandard extension used : nameless struct/union
70 GLM_ALIGNED_STRUCT(16) fquatSIMD
72 typedef __m128 value_type;
73 typedef std::size_t size_type;
74 static size_type value_size();
76 typedef fquatSIMD type;
77 typedef tquat<bool, defaultp> bool_type;
79 #ifdef GLM_SIMD_ENABLE_XYZW_UNION
83 struct {
float x, y, z, w;};
93 fquatSIMD(__m128
const & Data);
94 fquatSIMD(fquatSIMD
const & q);
115 fquatSIMD& operator =(fquatSIMD
const & q);
116 fquatSIMD& operator*=(
float const & s);
117 fquatSIMD& operator/=(
float const & s);
124 detail::fquatSIMD operator- (
125 detail::fquatSIMD
const & q);
127 detail::fquatSIMD operator+ (
128 detail::fquatSIMD
const & q,
129 detail::fquatSIMD
const & p);
131 detail::fquatSIMD operator* (
132 detail::fquatSIMD
const & q,
133 detail::fquatSIMD
const & p);
135 detail::fvec4SIMD operator* (
136 detail::fquatSIMD
const & q,
137 detail::fvec4SIMD
const & v);
139 detail::fvec4SIMD operator* (
140 detail::fvec4SIMD
const & v,
141 detail::fquatSIMD
const & q);
143 detail::fquatSIMD operator* (
144 detail::fquatSIMD
const & q,
147 detail::fquatSIMD operator* (
149 detail::fquatSIMD
const & q);
151 detail::fquatSIMD operator/ (
152 detail::fquatSIMD
const & q,
160 typedef glm::detail::fquatSIMD simdQuat;
165 detail::fquatSIMD
const & x);
169 detail::fquatSIMD quatSIMD_cast(
170 detail::fmat4x4SIMD
const & m);
174 template <
typename T, precision P>
175 detail::fquatSIMD quatSIMD_cast(
176 tmat4x4<T, P>
const & m);
180 template <
typename T, precision P>
181 detail::fquatSIMD quatSIMD_cast(
182 tmat3x3<T, P>
const & m);
186 detail::fmat4x4SIMD mat4SIMD_cast(
187 detail::fquatSIMD
const & q);
192 detail::fquatSIMD
const & q);
199 detail::fquatSIMD
const & x);
205 detail::fquatSIMD
const & x);
211 detail::fquatSIMD
const & q1,
212 detail::fquatSIMD
const & q2);
224 detail::fquatSIMD
mix(
225 detail::fquatSIMD
const & x,
226 detail::fquatSIMD
const & y,
237 detail::fquatSIMD
lerp(
238 detail::fquatSIMD
const & x,
239 detail::fquatSIMD
const & y,
250 detail::fquatSIMD
slerp(
251 detail::fquatSIMD
const & x,
252 detail::fquatSIMD
const & y,
267 detail::fquatSIMD
const & x,
268 detail::fquatSIMD
const & y,
278 detail::fquatSIMD fastSlerp(
279 detail::fquatSIMD
const & x,
280 detail::fquatSIMD
const & y,
288 detail::fquatSIMD
const & q);
294 detail::fquatSIMD
const & q);
302 detail::fquatSIMD angleAxisSIMD(
314 detail::fquatSIMD angleAxisSIMD(
327 #include "simd_quat.inl"
330 #if (GLM_COMPILER & GLM_COMPILER_VC)
331 # pragma warning(pop)
335 #endif//(GLM_ARCH != GLM_ARCH_PURE)
GLM_FUNC_DECL T fastSin(T angle)
Faster than the common sin function but less accurate.
GLM_FUNC_DECL tquat< T, P > quat_cast(tmat3x3< T, P > const &x)
Converts a 3 * 3 matrix to a quaternion.
GLM_FUNC_DECL tvec3< T, P > axis(tquat< T, P > const &x)
Returns the q rotation axis.
GLM_FUNC_DECL tquat< T, P > slerp(tquat< T, P > const &x, tquat< T, P > const &y, T const &a)
Spherical linear interpolation of two quaternions.
GLM_FUNC_DECL T angle(tquat< T, P > const &x)
Returns the quaternion rotation angle.
GLM_FUNC_DECL tvec3< T, P > eulerAngles(tquat< T, P > const &x)
Returns euler angles, yitch as x, yaw as y, roll as z.
GLM_FUNC_DECL T dot(vecType< T, P > const &x, vecType< T, P > const &y)
Returns the dot product of x and y, i.e., result = x * y.
mat4x4 mat4
4 columns of 4 components matrix of floating-point numbers.
GLM_FUNC_DECL T length(vecType< T, P > const &x)
Returns the length of x, i.e., sqrt(x * x).
GLM_FUNC_DECL vecType< T, P > normalize(vecType< T, P > const &x)
Returns a vector in the same direction as x but with length of 1.
GLM_FUNC_DECL vecType< T, P > mix(vecType< T, P > const &x, vecType< T, P > const &y, vecType< U, P > const &a)
If genTypeU is a floating scalar or vector: Returns x * (1.0 - a) + y * a, i.e., the linear blend of ...
GLM_FUNC_DECL tquat< T, P > conjugate(tquat< T, P > const &q)
Returns the q conjugate.
highp_vec3 vec3
3 components vector of floating-point numbers.
GLM_FUNC_DECL matType< T, P > inverse(matType< T, P > const &m)
Return the inverse of a squared matrix.
GLM_FUNC_DECL tmat4x4< T, P > mat4_cast(tquat< T, P > const &x)
Converts a quaternion to a 4 * 4 matrix.
GLM_FUNC_DECL tquat< T, P > fastMix(tquat< T, P > const &x, tquat< T, P > const &y, T const &a)
Quaternion normalized linear interpolation.
GLM_FUNC_DECL tquat< T, P > lerp(tquat< T, P > const &x, tquat< T, P > const &y, T const &a)
Linear interpolation of two quaternions.