6 #include "qualifier.hpp"
7 #if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR
8 # include "_swizzle.hpp"
9 #elif GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_FUNCTION
10 # include "_swizzle_func.hpp"
16 template<
typename T, qualifier Q>
22 typedef vec<3, T, Q> type;
23 typedef vec<3, bool, Q> bool_type;
27 # if GLM_SILENT_WARNINGS == GLM_ENABLE
28 # if GLM_COMPILER & GLM_COMPILER_GCC
29 # pragma GCC diagnostic push
30 # pragma GCC diagnostic ignored "-Wpedantic"
31 # elif GLM_COMPILER & GLM_COMPILER_CLANG
32 # pragma clang diagnostic push
33 # pragma clang diagnostic ignored "-Wgnu-anonymous-struct"
34 # pragma clang diagnostic ignored "-Wnested-anon-types"
35 # elif GLM_COMPILER & GLM_COMPILER_VC
36 # pragma warning(push)
37 # pragma warning(disable: 4201) // nonstandard extension used : nameless struct/union
38 # if GLM_CONFIG_ALIGNED_GENTYPES == GLM_ENABLE
39 # pragma warning(disable: 4324) // structure was padded due to alignment specifier
44 # if GLM_CONFIG_XYZW_ONLY
46 # elif GLM_CONFIG_ANONYMOUS_STRUCT == GLM_ENABLE
53 typename detail::storage<3, T, detail::is_aligned<Q>::value>::type data;
55 # if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR
56 GLM_SWIZZLE3_2_MEMBERS(T, Q, x, y, z)
57 GLM_SWIZZLE3_2_MEMBERS(T, Q, r, g, b)
58 GLM_SWIZZLE3_2_MEMBERS(T, Q, s, t, p)
59 GLM_SWIZZLE3_3_MEMBERS(T, Q, x, y, z)
60 GLM_SWIZZLE3_3_MEMBERS(T, Q, r, g, b)
61 GLM_SWIZZLE3_3_MEMBERS(T, Q, s, t, p)
62 GLM_SWIZZLE3_4_MEMBERS(T, Q, x, y, z)
63 GLM_SWIZZLE3_4_MEMBERS(T, Q, r, g, b)
64 GLM_SWIZZLE3_4_MEMBERS(T, Q, s, t, p)
72 # if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_FUNCTION
73 GLM_SWIZZLE_GEN_VEC_FROM_VEC3(T, Q)
74 # endif//GLM_CONFIG_SWIZZLE
77 # if GLM_SILENT_WARNINGS == GLM_ENABLE
78 # if GLM_COMPILER & GLM_COMPILER_CLANG
79 # pragma clang diagnostic pop
80 # elif GLM_COMPILER & GLM_COMPILER_GCC
81 # pragma GCC diagnostic pop
82 # elif GLM_COMPILER & GLM_COMPILER_VC
90 typedef length_t length_type;
91 GLM_FUNC_DECL
static GLM_CONSTEXPR length_type
length(){
return 3;}
93 GLM_FUNC_DECL GLM_CONSTEXPR T & operator[](length_type i);
94 GLM_FUNC_DECL GLM_CONSTEXPR T
const& operator[](length_type i)
const;
98 GLM_FUNC_DECL GLM_CONSTEXPR vec() GLM_DEFAULT;
99 GLM_FUNC_DECL GLM_CONSTEXPR vec(vec const& v) GLM_DEFAULT;
100 template<qualifier P>
101 GLM_FUNC_DECL GLM_CONSTEXPR vec(vec<3, T, P> const& v);
105 GLM_FUNC_DECL GLM_CONSTEXPR explicit vec(T scalar);
106 GLM_FUNC_DECL GLM_CONSTEXPR vec(T a, T b, T c);
110 template<typename U, qualifier P>
111 GLM_FUNC_DECL GLM_CONSTEXPR explicit vec(vec<1, U, P> const& v);
114 template<typename X, typename Y, typename Z>
115 GLM_FUNC_DECL GLM_CONSTEXPR vec(X x, Y y, Z z);
116 template<typename X, typename Y, typename Z>
117 GLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, X, Q> const& _x, Y _y, Z _z);
118 template<typename X, typename Y, typename Z>
119 GLM_FUNC_DECL GLM_CONSTEXPR vec(X _x, vec<1, Y, Q> const& _y, Z _z);
120 template<typename X, typename Y, typename Z>
121 GLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, X, Q> const& _x, vec<1, Y, Q> const& _y, Z _z);
122 template<typename X, typename Y, typename Z>
123 GLM_FUNC_DECL GLM_CONSTEXPR vec(X _x, Y _y, vec<1, Z, Q> const& _z);
124 template<typename X, typename Y, typename Z>
125 GLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, X, Q> const& _x, Y _y, vec<1, Z, Q> const& _z);
126 template<typename X, typename Y, typename Z>
127 GLM_FUNC_DECL GLM_CONSTEXPR vec(X _x, vec<1, Y, Q> const& _y, vec<1, Z, Q> const& _z);
128 template<typename X, typename Y, typename Z>
129 GLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, X, Q> const& _x, vec<1, Y, Q> const& _y, vec<1, Z, Q> const& _z);
134 template<typename A, typename B, qualifier P>
135 GLM_FUNC_DECL GLM_CONSTEXPR vec(vec<2, A, P> const& _xy, B _z);
137 template<typename A, typename B, qualifier P>
138 GLM_FUNC_DECL GLM_CONSTEXPR vec(vec<2, A, P> const& _xy, vec<1, B, P> const& _z);
140 template<typename A, typename B, qualifier P>
141 GLM_FUNC_DECL GLM_CONSTEXPR vec(A _x, vec<2, B, P> const& _yz);
143 template<typename A, typename B, qualifier P>
144 GLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, A, P> const& _x, vec<2, B, P> const& _yz);
146 template<typename U, qualifier P>
147 GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT vec(vec<4, U, P> const& v);
150 template<typename U, qualifier P>
151 GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT vec(vec<3, U, P> const& v);
154 # if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR
155 template<
int E0,
int E1,
int E2>
156 GLM_FUNC_DECL GLM_CONSTEXPR vec(detail::_swizzle<3, T, Q, E0, E1, E2, -1>
const& that)
161 template<
int E0,
int E1>
162 GLM_FUNC_DECL GLM_CONSTEXPR vec(detail::_swizzle<2, T, Q, E0, E1, -1, -2>
const& v, T
const& scalar)
164 *
this = vec(v(), scalar);
167 template<
int E0,
int E1>
168 GLM_FUNC_DECL GLM_CONSTEXPR vec(T
const& scalar, detail::_swizzle<2, T, Q, E0, E1, -1, -2>
const& v)
170 *
this = vec(scalar, v());
172 # endif//GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR
176 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q>& operator=(vec<3, T, Q>
const& v) GLM_DEFAULT;
179 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator=(vec<3, U, Q>
const& v);
181 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator+=(U scalar);
183 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator+=(vec<1, U, Q>
const& v);
185 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator+=(vec<3, U, Q>
const& v);
187 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator-=(U scalar);
189 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator-=(vec<1, U, Q>
const& v);
191 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator-=(vec<3, U, Q>
const& v);
193 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator*=(U scalar);
195 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator*=(vec<1, U, Q>
const& v);
197 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator*=(vec<3, U, Q>
const& v);
199 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator/=(U scalar);
201 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator/=(vec<1, U, Q>
const& v);
203 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator/=(vec<3, U, Q>
const& v);
207 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator++();
208 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator--();
209 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator++(
int);
210 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator--(
int);
215 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator%=(U scalar);
217 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator%=(vec<1, U, Q>
const& v);
219 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator%=(vec<3, U, Q>
const& v);
221 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator&=(U scalar);
223 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator&=(vec<1, U, Q>
const& v);
225 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator&=(vec<3, U, Q>
const& v);
227 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator|=(U scalar);
229 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator|=(vec<1, U, Q>
const& v);
231 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator|=(vec<3, U, Q>
const& v);
233 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator^=(U scalar);
235 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator^=(vec<1, U, Q>
const& v);
237 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator^=(vec<3, U, Q>
const& v);
239 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator<<=(U scalar);
241 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator<<=(vec<1, U, Q>
const& v);
243 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator<<=(vec<3, U, Q>
const& v);
245 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator>>=(U scalar);
247 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator>>=(vec<1, U, Q>
const& v);
249 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator>>=(vec<3, U, Q>
const& v);
254 template<
typename T, qualifier Q>
255 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator+(vec<3, T, Q>
const& v);
257 template<
typename T, qualifier Q>
258 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator-(vec<3, T, Q>
const& v);
262 template<
typename T, qualifier Q>
263 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator+(vec<3, T, Q>
const& v, T scalar);
265 template<
typename T, qualifier Q>
266 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator+(vec<3, T, Q>
const& v, vec<1, T, Q>
const& scalar);
268 template<
typename T, qualifier Q>
269 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator+(T scalar, vec<3, T, Q>
const& v);
271 template<
typename T, qualifier Q>
272 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator+(vec<1, T, Q>
const& v1, vec<3, T, Q>
const& v2);
274 template<
typename T, qualifier Q>
275 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator+(vec<3, T, Q>
const& v1, vec<3, T, Q>
const& v2);
277 template<
typename T, qualifier Q>
278 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator-(vec<3, T, Q>
const& v, T scalar);
280 template<
typename T, qualifier Q>
281 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator-(vec<3, T, Q>
const& v1, vec<1, T, Q>
const& v2);
283 template<
typename T, qualifier Q>
284 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator-(T scalar, vec<3, T, Q>
const& v);
286 template<
typename T, qualifier Q>
287 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator-(vec<1, T, Q>
const& v1, vec<3, T, Q>
const& v2);
289 template<
typename T, qualifier Q>
290 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator-(vec<3, T, Q>
const& v1, vec<3, T, Q>
const& v2);
292 template<
typename T, qualifier Q>
293 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator*(vec<3, T, Q>
const& v, T scalar);
295 template<
typename T, qualifier Q>
296 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator*(vec<3, T, Q>
const& v1, vec<1, T, Q>
const& v2);
298 template<
typename T, qualifier Q>
299 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator*(T scalar, vec<3, T, Q>
const& v);
301 template<
typename T, qualifier Q>
302 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator*(vec<1, T, Q>
const& v1, vec<3, T, Q>
const& v2);
304 template<
typename T, qualifier Q>
305 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator*(vec<3, T, Q>
const& v1, vec<3, T, Q>
const& v2);
307 template<
typename T, qualifier Q>
308 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator/(vec<3, T, Q>
const& v, T scalar);
310 template<
typename T, qualifier Q>
311 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator/(vec<3, T, Q>
const& v1, vec<1, T, Q>
const& v2);
313 template<
typename T, qualifier Q>
314 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator/(T scalar, vec<3, T, Q>
const& v);
316 template<
typename T, qualifier Q>
317 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator/(vec<1, T, Q>
const& v1, vec<3, T, Q>
const& v2);
319 template<
typename T, qualifier Q>
320 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator/(vec<3, T, Q>
const& v1, vec<3, T, Q>
const& v2);
322 template<
typename T, qualifier Q>
323 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator%(vec<3, T, Q>
const& v, T scalar);
325 template<
typename T, qualifier Q>
326 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator%(vec<3, T, Q>
const& v1, vec<1, T, Q>
const& v2);
328 template<
typename T, qualifier Q>
329 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator%(T scalar, vec<3, T, Q>
const& v);
331 template<
typename T, qualifier Q>
332 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator%(vec<1, T, Q>
const& v1, vec<3, T, Q>
const& v2);
334 template<
typename T, qualifier Q>
335 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator%(vec<3, T, Q>
const& v1, vec<3, T, Q>
const& v2);
337 template<
typename T, qualifier Q>
338 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator&(vec<3, T, Q>
const& v1, T scalar);
340 template<
typename T, qualifier Q>
341 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator&(vec<3, T, Q>
const& v1, vec<1, T, Q>
const& v2);
343 template<
typename T, qualifier Q>
344 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator&(T scalar, vec<3, T, Q>
const& v);
346 template<
typename T, qualifier Q>
347 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator&(vec<1, T, Q>
const& v1, vec<3, T, Q>
const& v2);
349 template<
typename T, qualifier Q>
350 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator&(vec<3, T, Q>
const& v1, vec<3, T, Q>
const& v2);
352 template<
typename T, qualifier Q>
353 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator|(vec<3, T, Q>
const& v, T scalar);
355 template<
typename T, qualifier Q>
356 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator|(vec<3, T, Q>
const& v1, vec<1, T, Q>
const& v2);
358 template<
typename T, qualifier Q>
359 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator|(T scalar, vec<3, T, Q>
const& v);
361 template<
typename T, qualifier Q>
362 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator|(vec<1, T, Q>
const& v1, vec<3, T, Q>
const& v2);
364 template<
typename T, qualifier Q>
365 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator|(vec<3, T, Q>
const& v1, vec<3, T, Q>
const& v2);
367 template<
typename T, qualifier Q>
368 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator^(vec<3, T, Q>
const& v, T scalar);
370 template<
typename T, qualifier Q>
371 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator^(vec<3, T, Q>
const& v1, vec<1, T, Q>
const& v2);
373 template<
typename T, qualifier Q>
374 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator^(T scalar, vec<3, T, Q>
const& v);
376 template<
typename T, qualifier Q>
377 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator^(vec<1, T, Q>
const& v1, vec<3, T, Q>
const& v2);
379 template<
typename T, qualifier Q>
380 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator^(vec<3, T, Q>
const& v1, vec<3, T, Q>
const& v2);
382 template<
typename T, qualifier Q>
383 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator<<(vec<3, T, Q>
const& v, T scalar);
385 template<
typename T, qualifier Q>
386 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator<<(vec<3, T, Q>
const& v1, vec<1, T, Q>
const& v2);
388 template<
typename T, qualifier Q>
389 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator<<(T scalar, vec<3, T, Q>
const& v);
391 template<
typename T, qualifier Q>
392 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator<<(vec<1, T, Q>
const& v1, vec<3, T, Q>
const& v2);
394 template<
typename T, qualifier Q>
395 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator<<(vec<3, T, Q>
const& v1, vec<3, T, Q>
const& v2);
397 template<
typename T, qualifier Q>
398 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator>>(vec<3, T, Q>
const& v, T scalar);
400 template<
typename T, qualifier Q>
401 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator>>(vec<3, T, Q>
const& v1, vec<1, T, Q>
const& v2);
403 template<
typename T, qualifier Q>
404 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator>>(T scalar, vec<3, T, Q>
const& v);
406 template<
typename T, qualifier Q>
407 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator>>(vec<1, T, Q>
const& v1, vec<3, T, Q>
const& v2);
409 template<
typename T, qualifier Q>
410 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator>>(vec<3, T, Q>
const& v1, vec<3, T, Q>
const& v2);
412 template<
typename T, qualifier Q>
413 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator~(vec<3, T, Q>
const& v);
417 template<
typename T, qualifier Q>
418 GLM_FUNC_DECL GLM_CONSTEXPR
bool operator==(vec<3, T, Q>
const& v1, vec<3, T, Q>
const& v2);
420 template<
typename T, qualifier Q>
421 GLM_FUNC_DECL GLM_CONSTEXPR
bool operator!=(vec<3, T, Q>
const& v1, vec<3, T, Q>
const& v2);
423 template<qualifier Q>
424 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, bool, Q> operator&&(vec<3, bool, Q>
const& v1, vec<3, bool, Q>
const& v2);
426 template<qualifier Q>
427 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, bool, Q> operator||(vec<3, bool, Q>
const& v1, vec<3, bool, Q>
const& v2);
430 #ifndef GLM_EXTERNAL_TEMPLATE
431 #include "type_vec3.inl"
432 #endif//GLM_EXTERNAL_TEMPLATE
GLM_FUNC_DECL T length(qua< T, Q > const &q)
Returns the norm of a quaternions.