7 #include "../detail/type_mat3x3.hpp"
8 #include "../detail/type_mat4x4.hpp"
9 #include "../detail/type_vec3.hpp"
10 #include "../detail/type_vec4.hpp"
11 #include "../ext/vector_relational.hpp"
12 #include "../ext/quaternion_relational.hpp"
13 #include "../gtc/constants.hpp"
14 #include "../gtc/matrix_transform.hpp"
18 # if GLM_SILENT_WARNINGS == GLM_ENABLE
19 # if GLM_COMPILER & GLM_COMPILER_GCC
20 # pragma GCC diagnostic push
21 # pragma GCC diagnostic ignored "-Wpedantic"
22 # elif GLM_COMPILER & GLM_COMPILER_CLANG
23 # pragma clang diagnostic push
24 # pragma clang diagnostic ignored "-Wgnu-anonymous-struct"
25 # pragma clang diagnostic ignored "-Wnested-anon-types"
26 # elif GLM_COMPILER & GLM_COMPILER_VC
27 # pragma warning(push)
28 # pragma warning(disable: 4201) // nonstandard extension used : nameless struct/union
32 template<
typename T, qualifier Q>
37 typedef qua<T, Q> type;
42 # if GLM_LANG & GLM_LANG_CXXMS_FLAG
45 # ifdef GLM_FORCE_QUAT_DATA_WXYZ
46 struct { T w, x, y, z; };
48 struct { T x, y, z, w; };
51 typename detail::storage<4, T, detail::is_aligned<Q>::value>::type data;
54 # ifdef GLM_FORCE_QUAT_DATA_WXYZ
63 typedef length_t length_type;
66 GLM_FUNC_DECL
static GLM_CONSTEXPR length_type
length(){
return 4;}
68 GLM_FUNC_DECL GLM_CONSTEXPR T & operator[](length_type i);
69 GLM_FUNC_DECL GLM_CONSTEXPR T
const& operator[](length_type i)
const;
73 GLM_DEFAULTED_DEFAULT_CTOR_DECL GLM_CONSTEXPR qua() GLM_DEFAULT_CTOR;
74 GLM_DEFAULTED_FUNC_DECL GLM_CONSTEXPR qua(qua<T, Q> const& q) GLM_DEFAULT;
76 GLM_FUNC_DECL GLM_CONSTEXPR qua(qua<T, P> const& q);
80 GLM_FUNC_DECL GLM_CONSTEXPR qua(T s, vec<3, T, Q> const& v);
82 # ifdef GLM_FORCE_QUAT_CTOR_XYZW
83 GLM_FUNC_DECL GLM_CONSTEXPR qua(T x, T y, T z, T w);
85 GLM_FUNC_DECL GLM_CONSTEXPR qua(T w, T x, T y, T z);
88 GLM_FUNC_DECL
static GLM_CONSTEXPR qua<T, Q> wxyz(T w, T x, T y, T z);
92 template<
typename U, qualifier P>
93 GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT qua(qua<U, P>
const& q);
96 # if GLM_HAS_EXPLICIT_CONVERSION_OPERATORS
97 GLM_FUNC_DECL
explicit operator mat<3, 3, T, Q>()
const;
98 GLM_FUNC_DECL
explicit operator mat<4, 4, T, Q>()
const;
107 GLM_FUNC_DECL qua(vec<3, T, Q>
const& u, vec<3, T, Q>
const& v);
110 GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT qua(vec<3, T, Q>
const&
eulerAngles);
111 GLM_FUNC_DECL GLM_EXPLICIT qua(mat<3, 3, T, Q>
const& q);
112 GLM_FUNC_DECL GLM_EXPLICIT qua(mat<4, 4, T, Q>
const& q);
116 GLM_DEFAULTED_FUNC_DECL GLM_CONSTEXPR qua<T, Q>& operator=(qua<T, Q>
const& q) GLM_DEFAULT;
119 GLM_FUNC_DECL GLM_CONSTEXPR qua<T, Q>& operator=(qua<U, Q>
const& q);
121 GLM_FUNC_DECL GLM_CONSTEXPR qua<T, Q>& operator+=(qua<U, Q>
const& q);
123 GLM_FUNC_DECL GLM_CONSTEXPR qua<T, Q>& operator-=(qua<U, Q>
const& q);
125 GLM_FUNC_DECL GLM_CONSTEXPR qua<T, Q>& operator*=(qua<U, Q>
const& q);
127 GLM_FUNC_DECL GLM_CONSTEXPR qua<T, Q>& operator*=(U s);
129 GLM_FUNC_DECL GLM_CONSTEXPR qua<T, Q>& operator/=(U s);
132 # if GLM_SILENT_WARNINGS == GLM_ENABLE
133 # if GLM_COMPILER & GLM_COMPILER_CLANG
134 # pragma clang diagnostic pop
135 # elif GLM_COMPILER & GLM_COMPILER_GCC
136 # pragma GCC diagnostic pop
137 # elif GLM_COMPILER & GLM_COMPILER_VC
138 # pragma warning(pop)
144 template<
typename T, qualifier Q>
145 GLM_FUNC_DECL GLM_CONSTEXPR qua<T, Q> operator+(qua<T, Q>
const& q);
147 template<
typename T, qualifier Q>
148 GLM_FUNC_DECL GLM_CONSTEXPR qua<T, Q> operator-(qua<T, Q>
const& q);
152 template<
typename T, qualifier Q>
153 GLM_FUNC_DECL GLM_CONSTEXPR qua<T, Q> operator+(qua<T, Q>
const& q, qua<T, Q>
const& p);
155 template<
typename T, qualifier Q>
156 GLM_FUNC_DECL GLM_CONSTEXPR qua<T, Q> operator-(qua<T, Q>
const& q, qua<T, Q>
const& p);
158 template<
typename T, qualifier Q>
159 GLM_FUNC_DECL GLM_CONSTEXPR qua<T, Q> operator*(qua<T, Q>
const& q, qua<T, Q>
const& p);
161 template<
typename T, qualifier Q>
162 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator*(qua<T, Q>
const& q, vec<3, T, Q>
const& v);
164 template<
typename T, qualifier Q>
165 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator*(vec<3, T, Q>
const& v, qua<T, Q>
const& q);
167 template<
typename T, qualifier Q>
168 GLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator*(qua<T, Q>
const& q, vec<4, T, Q>
const& v);
170 template<
typename T, qualifier Q>
171 GLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator*(vec<4, T, Q>
const& v, qua<T, Q>
const& q);
173 template<
typename T, qualifier Q>
174 GLM_FUNC_DECL GLM_CONSTEXPR qua<T, Q> operator*(qua<T, Q>
const& q, T
const& s);
176 template<
typename T, qualifier Q>
177 GLM_FUNC_DECL GLM_CONSTEXPR qua<T, Q> operator*(T
const& s, qua<T, Q>
const& q);
179 template<
typename T, qualifier Q>
180 GLM_FUNC_DECL GLM_CONSTEXPR qua<T, Q> operator/(qua<T, Q>
const& q, T
const& s);
184 template<
typename T, qualifier Q>
185 GLM_FUNC_DECL GLM_CONSTEXPR
bool operator==(qua<T, Q>
const& q1, qua<T, Q>
const& q2);
187 template<
typename T, qualifier Q>
188 GLM_FUNC_DECL GLM_CONSTEXPR
bool operator!=(qua<T, Q>
const& q1, qua<T, Q>
const& q2);
191 #ifndef GLM_EXTERNAL_TEMPLATE
192 #include "type_quat.inl"
193 #endif//GLM_EXTERNAL_TEMPLATE