17 #include "../gtc/quaternion.hpp"
18 #include "../gtx/fast_trigonometry.hpp"
20 #if GLM_ARCH != GLM_ARCH_PURE
22 #if GLM_ARCH & GLM_ARCH_SSE2_BIT
23 # include "../gtx/simd_mat4.hpp"
25 # error "GLM: GLM_GTX_simd_quat requires compiler support of SSE2 through intrinsics"
28 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED)
29 # pragma message("GLM: GLM_GTX_simd_quat extension included")
30 # pragma message("GLM: GLM_GTX_simd_quat extension is deprecated and will be removed in GLM 0.9.9. Use GLM_GTC_quaternion instead and use compiler SIMD arguments.")
34 #if (GLM_COMPILER & GLM_COMPILER_VC)
35 # pragma warning(push)
36 # pragma warning(disable:4201) // warning C4201: nonstandard extension used : nameless struct/union
42 GLM_ALIGNED_STRUCT(16) fquatSIMD
44 typedef float value_type;
45 typedef std::size_t size_type;
47 typedef fquatSIMD type;
48 typedef tquat<bool, defaultp> bool_type;
49 typedef tquat<float, defaultp> pure_type;
51 #ifdef GLM_SIMD_ENABLE_XYZW_UNION
55 struct {
float x, y, z, w;};
64 fquatSIMD() GLM_DEFAULT_CTOR;
65 fquatSIMD(fquatSIMD const & q) GLM_DEFAULT;
66 fquatSIMD(__m128 const & Data);
87 fquatSIMD& operator= (fquatSIMD const & q) GLM_DEFAULT;
88 fquatSIMD& operator*=(
float const & s);
89 fquatSIMD& operator/=(
float const & s);
96 detail::fquatSIMD operator- (
97 detail::fquatSIMD const & q);
99 detail::fquatSIMD operator+ (
100 detail::fquatSIMD const & q,
101 detail::fquatSIMD const & p);
103 detail::fquatSIMD operator* (
104 detail::fquatSIMD const & q,
105 detail::fquatSIMD const & p);
107 detail::fvec4SIMD operator* (
108 detail::fquatSIMD const & q,
109 detail::fvec4SIMD const & v);
111 detail::fvec4SIMD operator* (
112 detail::fvec4SIMD const & v,
113 detail::fquatSIMD const & q);
115 detail::fquatSIMD operator* (
116 detail::fquatSIMD const & q,
119 detail::fquatSIMD operator* (
121 detail::fquatSIMD const & q);
123 detail::fquatSIMD operator/ (
124 detail::fquatSIMD const & q,
132 typedef
glm::detail::fquatSIMD simdQuat;
137 detail::fquatSIMD const & x);
141 detail::fquatSIMD quatSIMD_cast(
142 detail::fmat4x4SIMD const & m);
146 template <typename T, precision P>
147 detail::fquatSIMD quatSIMD_cast(
148 tmat4x4<T, P> const & m);
152 template <typename T, precision P>
153 detail::fquatSIMD quatSIMD_cast(
154 tmat3x3<T, P> const & m);
158 detail::fmat4x4SIMD mat4SIMD_cast(
159 detail::fquatSIMD const & q);
164 detail::fquatSIMD const & q);
171 detail::fquatSIMD const & x);
177 detail::fquatSIMD const & x);
183 detail::fquatSIMD const & q1,
184 detail::fquatSIMD const & q2);
196 detail::fquatSIMD
mix(
197 detail::fquatSIMD const & x,
198 detail::fquatSIMD const & y,
209 detail::fquatSIMD
lerp(
210 detail::fquatSIMD const & x,
211 detail::fquatSIMD const & y,
222 detail::fquatSIMD
slerp(
223 detail::fquatSIMD const & x,
224 detail::fquatSIMD const & y,
239 detail::fquatSIMD const & x,
240 detail::fquatSIMD const & y,
250 detail::fquatSIMD fastSlerp(
251 detail::fquatSIMD const & x,
252 detail::fquatSIMD const & y,
260 detail::fquatSIMD const & q);
266 detail::fquatSIMD const & q);
274 detail::fquatSIMD angleAxisSIMD(
286 detail::fquatSIMD angleAxisSIMD(
299 #include "simd_quat.inl"
302 #if (GLM_COMPILER & GLM_COMPILER_VC)
303 # pragma warning(pop)
307 #endif//(GLM_ARCH != GLM_ARCH_PURE)
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.
GLM_FUNC_DECL matType< T, P > inverse(matType< T, P > const &m)
Return the inverse of a squared matrix.
mat4x4 mat4
4 columns of 4 components matrix of floating-point numbers.
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.
GLM_FUNC_DECL tquat< T, P > lerp(tquat< T, P > const &x, tquat< T, P > const &y, T a)
Linear interpolation of two quaternions.
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 fastSin(T angle)
Faster than the common sin function but less accurate.
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 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 tvec3< T, P > axis(tquat< T, P > const &x)
Returns the q rotation axis.
GLM_FUNC_DECL tvec3< T, P > eulerAngles(tquat< T, P > const &x)
Returns euler angles, pitch as x, yaw as y, roll as z.
GLM_FUNC_DECL T angle(tquat< T, P > const &x)
Returns the quaternion rotation angle.
GLM_FUNC_DECL tquat< T, P > quat_cast(tmat3x3< T, P > const &x)
Converts a 3 * 3 matrix to a quaternion.
GLM_FUNC_DECL tquat< T, P > slerp(tquat< T, P > const &x, tquat< T, P > const &y, T a)
Spherical linear interpolation of two quaternions.
GLM_FUNC_DECL T length(vecType< T, P > const &x)
Returns the length of x, i.e., sqrt(x * x).
highp_vec3 vec3
3 components vector of floating-point numbers.