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 float value_type;
73 typedef std::size_t size_type;
75 typedef fquatSIMD type;
76 typedef tquat<bool, defaultp> bool_type;
77 typedef tquat<float, defaultp> pure_type;
79 # ifdef GLM_META_PROG_HELPERS
80 static GLM_RELAXED_CONSTEXPR length_t components = 4;
81 static GLM_RELAXED_CONSTEXPR precision prec = defaultp;
82 # endif//GLM_META_PROG_HELPERS
84 #ifdef GLM_SIMD_ENABLE_XYZW_UNION
88 struct {
float x, y, z, w;};
97 fquatSIMD() GLM_DEFAULT_CTOR;
98 fquatSIMD(fquatSIMD const & q) GLM_DEFAULT;
99 fquatSIMD(__m128 const & Data);
120 fquatSIMD& operator= (fquatSIMD const & q) GLM_DEFAULT;
121 fquatSIMD& operator*=(
float const & s);
122 fquatSIMD& operator/=(
float const & s);
129 detail::fquatSIMD operator- (
130 detail::fquatSIMD const & q);
132 detail::fquatSIMD operator+ (
133 detail::fquatSIMD const & q,
134 detail::fquatSIMD const & p);
136 detail::fquatSIMD operator* (
137 detail::fquatSIMD const & q,
138 detail::fquatSIMD const & p);
140 detail::fvec4SIMD operator* (
141 detail::fquatSIMD const & q,
142 detail::fvec4SIMD const & v);
144 detail::fvec4SIMD operator* (
145 detail::fvec4SIMD const & v,
146 detail::fquatSIMD const & q);
148 detail::fquatSIMD operator* (
149 detail::fquatSIMD const & q,
152 detail::fquatSIMD operator* (
154 detail::fquatSIMD const & q);
156 detail::fquatSIMD operator/ (
157 detail::fquatSIMD const & q,
165 typedef
glm::detail::fquatSIMD simdQuat;
170 detail::fquatSIMD const & x);
174 detail::fquatSIMD quatSIMD_cast(
175 detail::fmat4x4SIMD const & m);
179 template <typename T, precision P>
180 detail::fquatSIMD quatSIMD_cast(
181 tmat4x4<T, P> const & m);
185 template <typename T, precision P>
186 detail::fquatSIMD quatSIMD_cast(
187 tmat3x3<T, P> const & m);
191 detail::fmat4x4SIMD mat4SIMD_cast(
192 detail::fquatSIMD const & q);
197 detail::fquatSIMD const & q);
204 detail::fquatSIMD const & x);
210 detail::fquatSIMD const & x);
216 detail::fquatSIMD const & q1,
217 detail::fquatSIMD const & q2);
229 detail::fquatSIMD
mix(
230 detail::fquatSIMD const & x,
231 detail::fquatSIMD const & y,
242 detail::fquatSIMD
lerp(
243 detail::fquatSIMD const & x,
244 detail::fquatSIMD const & y,
255 detail::fquatSIMD
slerp(
256 detail::fquatSIMD const & x,
257 detail::fquatSIMD const & y,
272 detail::fquatSIMD const & x,
273 detail::fquatSIMD const & y,
283 detail::fquatSIMD fastSlerp(
284 detail::fquatSIMD const & x,
285 detail::fquatSIMD const & y,
293 detail::fquatSIMD const & q);
299 detail::fquatSIMD const & q);
307 detail::fquatSIMD angleAxisSIMD(
319 detail::fquatSIMD angleAxisSIMD(
332 #include "simd_quat.inl"
335 #if (GLM_COMPILER & GLM_COMPILER_VC)
336 # pragma warning(pop)
340 #endif//(GLM_ARCH != GLM_ARCH_PURE)
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 T length(vecType< T, P > const &x)
Returns the length of x, i.e., sqrt(x * x).
GLM_FUNC_DECL tquat< T, P > conjugate(tquat< T, P > const &q)
Returns the q conjugate.
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 > lerp(tquat< T, P > const &x, tquat< T, P > const &y, T a)
Linear interpolation of two quaternions.
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, yitch as x, yaw as y, roll as z.
GLM_FUNC_DECL T angle(tquat< T, P > const &x)
Returns the quaternion rotation angle.
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 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 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 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 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 ...
mat4x4 mat4
4 columns of 4 components matrix of floating-point numbers.