38 #ifndef GLM_GTX_simd_quat
39 #define GLM_GTX_simd_quat
43 #include "../gtc/quaternion.hpp"
44 #include "../gtx/fast_trigonometry.hpp"
46 #if(GLM_ARCH != GLM_ARCH_PURE)
48 #if(GLM_ARCH & GLM_ARCH_SSE2)
49 # include "../core/intrinsic_common.hpp"
50 # include "../core/intrinsic_geometric.hpp"
51 # include "../gtx/simd_mat4.hpp"
53 # error "GLM: GLM_GTX_simd_quat requires compiler support of SSE2 through intrinsics"
56 #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
57 # 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
73 GLM_ALIGNED_STRUCT(16) fquatSIMD
76 typedef __m128 value_type;
77 typedef std::size_t size_type;
78 static size_type value_size();
80 typedef fquatSIMD type;
81 typedef tquat<bool, defaultp> bool_type;
83 #ifdef GLM_SIMD_ENABLE_XYZW_UNION
87 struct {
float x, y, z, w;};
97 fquatSIMD(__m128
const & Data);
98 fquatSIMD(fquatSIMD
const & q);
119 fquatSIMD& operator =(fquatSIMD
const & q);
120 fquatSIMD& operator*=(
float const & s);
121 fquatSIMD& operator/=(
float const & s);
128 detail::fquatSIMD operator- (
129 detail::fquatSIMD
const & q);
131 detail::fquatSIMD operator+ (
132 detail::fquatSIMD
const & q,
133 detail::fquatSIMD
const & p);
135 detail::fquatSIMD operator* (
136 detail::fquatSIMD
const & q,
137 detail::fquatSIMD
const & p);
139 detail::fvec4SIMD operator* (
140 detail::fquatSIMD
const & q,
141 detail::fvec4SIMD
const & v);
143 detail::fvec4SIMD operator* (
144 detail::fvec4SIMD
const & v,
145 detail::fquatSIMD
const & q);
147 detail::fquatSIMD operator* (
148 detail::fquatSIMD
const & q,
151 detail::fquatSIMD operator* (
153 detail::fquatSIMD
const & q);
155 detail::fquatSIMD operator/ (
156 detail::fquatSIMD
const & q,
161 typedef glm::detail::fquatSIMD simdQuat;
169 detail::fquatSIMD
const & x);
173 detail::fquatSIMD quatSIMD_cast(
174 detail::fmat4x4SIMD
const & m);
178 template <
typename T, precision P>
179 detail::fquatSIMD quatSIMD_cast(
180 detail::tmat4x4<T, P>
const & m);
184 template <
typename T, precision P>
185 detail::fquatSIMD quatSIMD_cast(
186 detail::tmat3x3<T, P>
const & m);
190 detail::fmat4x4SIMD mat4SIMD_cast(
191 detail::fquatSIMD
const & q);
196 detail::fquatSIMD
const & q);
203 detail::fquatSIMD
const & x);
209 detail::fquatSIMD
const & x);
215 detail::fquatSIMD
const & q1,
216 detail::fquatSIMD
const & q2);
228 detail::fquatSIMD
mix(
229 detail::fquatSIMD
const & x,
230 detail::fquatSIMD
const & y,
241 detail::fquatSIMD
lerp(
242 detail::fquatSIMD
const & x,
243 detail::fquatSIMD
const & y,
254 detail::fquatSIMD
slerp(
255 detail::fquatSIMD
const & x,
256 detail::fquatSIMD
const & y,
271 detail::fquatSIMD
const & x,
272 detail::fquatSIMD
const & y,
282 detail::fquatSIMD fastSlerp(
283 detail::fquatSIMD
const & x,
284 detail::fquatSIMD
const & y,
292 detail::fquatSIMD
const & q);
298 detail::fquatSIMD
const & q);
306 detail::fquatSIMD angleAxisSIMD(
318 detail::fquatSIMD angleAxisSIMD(
333 #include "simd_quat.inl"
336 #if (GLM_COMPILER & GLM_COMPILER_VC)
337 # pragma warning(pop)
341 #endif//(GLM_ARCH != GLM_ARCH_PURE)
343 #endif//GLM_GTX_simd_quat
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.
highp_vec3 vec3
3 components vector of floating-point numbers.
GLM_FUNC_DECL detail::tquat< T, P > lerp(detail::tquat< T, P > const &x, detail::tquat< T, P > const &y, T const &a)
Linear interpolation of two quaternions.
GLM_FUNC_DECL detail::tquat< T, P > quat_cast(detail::tmat3x3< T, P > const &x)
Converts a 3 * 3 matrix to a quaternion.
GLM_FUNC_DECL genTypeT mix(genTypeT const &x, genTypeT const &y, genTypeU 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 T angle(detail::tquat< T, P > const &x)
Returns the quaternion rotation angle.
GLM_FUNC_DECL detail::tvec3< T, P > eulerAngles(detail::tquat< T, P > const &x)
Returns euler angles, yitch as x, yaw as y, roll as z.
mat4x4 mat4
4 columns of 4 components matrix of floating-point numbers.
T fastSin(const T &angle)
Faster than the common sin function but less accurate.
GLM_FUNC_DECL genType normalize(genType const &x)
Returns a vector in the same direction as x but with length of 1.
GLM_FUNC_DECL detail::tmat4x4< T, P > mat4_cast(detail::tquat< T, P > const &x)
Converts a quaternion to a 4 * 4 matrix.
GLM_FUNC_DECL genType::value_type length(genType const &x)
Returns the length of x, i.e., sqrt(x * x).
highp_quat quat
Quaternion of default single-precision floating-point numbers.
GLM_FUNC_DECL matType< T, P > inverse(matType< T, P > const &m)
Return the inverse of a squared matrix.
detail::tquat< T, P > fastMix(detail::tquat< T, P > const &x, detail::tquat< T, P > const &y, T const &a)
Quaternion normalized linear interpolation.
GLM_FUNC_DECL detail::tvec3< T, P > axis(detail::tquat< T, P > const &x)
Returns the q rotation axis.
GLM_FUNC_DECL detail::tquat< T, P > slerp(detail::tquat< T, P > const &x, detail::tquat< T, P > const &y, T const &a)
Spherical linear interpolation of two quaternions.
GLM_FUNC_DECL detail::tquat< T, P > conjugate(detail::tquat< T, P > const &q)
Returns the q conjugate.