42 #include "../gtc/quaternion.hpp"
43 #include "../gtx/fast_trigonometry.hpp"
45 #if(GLM_ARCH != GLM_ARCH_PURE)
47 #if(GLM_ARCH & GLM_ARCH_SSE2)
48 # include "../gtx/simd_mat4.hpp"
50 # error "GLM: GLM_GTX_simd_quat requires compiler support of SSE2 through intrinsics"
53 #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
54 # pragma message("GLM: GLM_GTX_simd_quat extension included")
58 #if (GLM_COMPILER & GLM_COMPILER_VC)
59 # pragma warning(push)
60 # pragma warning(disable:4201) // warning C4201: nonstandard extension used : nameless struct/union
66 GLM_ALIGNED_STRUCT(16) fquatSIMD
68 typedef __m128 value_type;
69 typedef std::size_t size_type;
70 static size_type value_size();
72 typedef fquatSIMD type;
73 typedef tquat<bool, defaultp> bool_type;
75 #ifdef GLM_SIMD_ENABLE_XYZW_UNION
79 struct {
float x, y, z, w;};
89 fquatSIMD(__m128
const & Data);
90 fquatSIMD(fquatSIMD
const & q);
111 fquatSIMD& operator =(fquatSIMD
const & q);
112 fquatSIMD& operator*=(
float const & s);
113 fquatSIMD& operator/=(
float const & s);
120 detail::fquatSIMD operator- (
121 detail::fquatSIMD
const & q);
123 detail::fquatSIMD operator+ (
124 detail::fquatSIMD
const & q,
125 detail::fquatSIMD
const & p);
127 detail::fquatSIMD operator* (
128 detail::fquatSIMD
const & q,
129 detail::fquatSIMD
const & p);
131 detail::fvec4SIMD operator* (
132 detail::fquatSIMD
const & q,
133 detail::fvec4SIMD
const & v);
135 detail::fvec4SIMD operator* (
136 detail::fvec4SIMD
const & v,
137 detail::fquatSIMD
const & q);
139 detail::fquatSIMD operator* (
140 detail::fquatSIMD
const & q,
143 detail::fquatSIMD operator* (
145 detail::fquatSIMD
const & q);
147 detail::fquatSIMD operator/ (
148 detail::fquatSIMD
const & q,
156 typedef glm::detail::fquatSIMD simdQuat;
161 detail::fquatSIMD
const & x);
165 detail::fquatSIMD quatSIMD_cast(
166 detail::fmat4x4SIMD
const & m);
170 template <
typename T, precision P>
171 detail::fquatSIMD quatSIMD_cast(
172 tmat4x4<T, P>
const & m);
176 template <
typename T, precision P>
177 detail::fquatSIMD quatSIMD_cast(
178 tmat3x3<T, P>
const & m);
182 detail::fmat4x4SIMD mat4SIMD_cast(
183 detail::fquatSIMD
const & q);
188 detail::fquatSIMD
const & q);
195 detail::fquatSIMD
const & x);
201 detail::fquatSIMD
const & x);
207 detail::fquatSIMD
const & q1,
208 detail::fquatSIMD
const & q2);
220 detail::fquatSIMD
mix(
221 detail::fquatSIMD
const & x,
222 detail::fquatSIMD
const & y,
233 detail::fquatSIMD
lerp(
234 detail::fquatSIMD
const & x,
235 detail::fquatSIMD
const & y,
246 detail::fquatSIMD
slerp(
247 detail::fquatSIMD
const & x,
248 detail::fquatSIMD
const & y,
263 detail::fquatSIMD
const & x,
264 detail::fquatSIMD
const & y,
274 detail::fquatSIMD fastSlerp(
275 detail::fquatSIMD
const & x,
276 detail::fquatSIMD
const & y,
284 detail::fquatSIMD
const & q);
290 detail::fquatSIMD
const & q);
298 detail::fquatSIMD angleAxisSIMD(
310 detail::fquatSIMD angleAxisSIMD(
323 #include "simd_quat.inl"
326 #if (GLM_COMPILER & GLM_COMPILER_VC)
327 # pragma warning(pop)
331 #endif//(GLM_ARCH != GLM_ARCH_PURE)
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 matType< T, P > inverse(matType< T, P > const &m)
Return the inverse of a squared matrix.
highp_vec3 vec3
3 components vector of floating-point numbers.
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.
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 tvec3< T, P > eulerAngles(tquat< T, P > const &x)
Returns euler angles, yitch as x, yaw as y, roll as z.
GLM_FUNC_DECL tquat< T, P > conjugate(tquat< T, P > const &q)
Returns the q conjugate.
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 > slerp(tquat< T, P > const &x, tquat< T, P > const &y, T const &a)
Spherical linear interpolation of two quaternions.
GLM_FUNC_DECL T fastSin(T angle)
Faster than the common sin function but less accurate.
GLM_FUNC_DECL tmat4x4< T, P > mat4_cast(tquat< T, P > const &x)
Converts a quaternion to a 4 * 4 matrix.
GLM_FUNC_DECL T angle(tquat< T, P > const &x)
Returns the quaternion rotation angle.
GLM_FUNC_DECL tvec3< T, P > axis(tquat< T, P > const &x)
Returns the q rotation axis.
GLM_FUNC_DECL tquat< T, P > quat_cast(tmat3x3< T, P > const &x)
Converts a 3 * 3 matrix to a quaternion.
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.