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 # if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_FUNCTION
47 GLM_SWIZZLE_GEN_VEC_FROM_VEC3_COMP(T, Q, x, y, z)
48 # endif//GLM_CONFIG_SWIZZLE
49 # elif GLM_CONFIG_ANONYMOUS_STRUCT == GLM_ENABLE
56 typename detail::storage<3, T, detail::is_aligned<Q>::value>::type data;
58 # if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR
59 GLM_SWIZZLE3_2_MEMBERS(T, Q, x, y, z)
60 GLM_SWIZZLE3_2_MEMBERS(T, Q, r, g, b)
61 GLM_SWIZZLE3_2_MEMBERS(T, Q, s, t, p)
62 GLM_SWIZZLE3_3_MEMBERS(T, Q, x, y, z)
63 GLM_SWIZZLE3_3_MEMBERS(T, Q, r, g, b)
64 GLM_SWIZZLE3_3_MEMBERS(T, Q, s, t, p)
65 GLM_SWIZZLE3_4_MEMBERS(T, Q, x, y, z)
66 GLM_SWIZZLE3_4_MEMBERS(T, Q, r, g, b)
67 GLM_SWIZZLE3_4_MEMBERS(T, Q, s, t, p)
75 # if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_FUNCTION
76 GLM_SWIZZLE_GEN_VEC_FROM_VEC3(T, Q)
77 # endif//GLM_CONFIG_SWIZZLE
80 # if GLM_SILENT_WARNINGS == GLM_ENABLE
81 # if GLM_COMPILER & GLM_COMPILER_CLANG
82 # pragma clang diagnostic pop
83 # elif GLM_COMPILER & GLM_COMPILER_GCC
84 # pragma GCC diagnostic pop
85 # elif GLM_COMPILER & GLM_COMPILER_VC
93 typedef length_t length_type;
94 GLM_FUNC_DECL
static GLM_CONSTEXPR length_type
length(){
return 3;}
96 GLM_FUNC_DECL GLM_CONSTEXPR T & operator[](length_type i);
97 GLM_FUNC_DECL GLM_CONSTEXPR T
const& operator[](length_type i)
const;
101 GLM_DEFAULTED_DEFAULT_CTOR_DECL GLM_CONSTEXPR vec() GLM_DEFAULT_CTOR;
102 GLM_DEFAULTED_FUNC_DECL GLM_CONSTEXPR vec(vec const& v) GLM_DEFAULT;
103 template<qualifier P>
104 GLM_FUNC_DECL GLM_CONSTEXPR vec(vec<3, T, P> const& v);
108 GLM_FUNC_DECL GLM_CONSTEXPR explicit vec(T scalar);
109 GLM_FUNC_DECL GLM_CONSTEXPR vec(T a, T b, T c);
113 template<typename U, qualifier P>
114 GLM_FUNC_DECL GLM_CONSTEXPR explicit vec(vec<1, U, P> const& v);
117 template<typename X, typename Y, typename Z>
118 GLM_FUNC_DECL GLM_CONSTEXPR vec(X x, Y y, Z z);
119 template<typename X, typename Y, typename Z>
120 GLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, X, Q> const& _x, Y _y, Z _z);
121 template<typename X, typename Y, typename Z>
122 GLM_FUNC_DECL GLM_CONSTEXPR vec(X _x, vec<1, Y, Q> const& _y, Z _z);
123 template<typename X, typename Y, typename Z>
124 GLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, X, Q> const& _x, vec<1, Y, Q> const& _y, Z _z);
125 template<typename X, typename Y, typename Z>
126 GLM_FUNC_DECL GLM_CONSTEXPR vec(X _x, Y _y, vec<1, Z, Q> const& _z);
127 template<typename X, typename Y, typename Z>
128 GLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, X, Q> const& _x, Y _y, vec<1, Z, Q> const& _z);
129 template<typename X, typename Y, typename Z>
130 GLM_FUNC_DECL GLM_CONSTEXPR vec(X _x, vec<1, Y, Q> const& _y, vec<1, Z, Q> const& _z);
131 template<typename X, typename Y, typename Z>
132 GLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, X, Q> const& _x, vec<1, Y, Q> const& _y, vec<1, Z, Q> const& _z);
137 template<typename A, typename B, qualifier P>
138 GLM_FUNC_DECL GLM_CONSTEXPR vec(vec<2, A, P> const& _xy, B _z);
140 template<typename A, typename B, qualifier P>
141 GLM_FUNC_DECL GLM_CONSTEXPR vec(vec<2, A, P> const& _xy, vec<1, B, P> const& _z);
143 template<typename A, typename B, qualifier P>
144 GLM_FUNC_DECL GLM_CONSTEXPR vec(A _x, vec<2, B, P> const& _yz);
146 template<typename A, typename B, qualifier P>
147 GLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, A, P> const& _x, vec<2, B, P> const& _yz);
149 template<typename U, qualifier P>
150 GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT vec(vec<4, U, P> const& v);
153 template<typename U, qualifier P>
154 GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT vec(vec<3, U, P> const& v);
157 # if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR
158 template<
int E0,
int E1,
int E2>
159 GLM_FUNC_DECL GLM_CONSTEXPR vec(detail::_swizzle<3, T, Q, E0, E1, E2, -1>
const& that)
164 template<
int E0,
int E1>
165 GLM_FUNC_DECL GLM_CONSTEXPR vec(detail::_swizzle<2, T, Q, E0, E1, -1, -2>
const& v, T
const& scalar)
167 *
this = vec(v(), scalar);
170 template<
int E0,
int E1>
171 GLM_FUNC_DECL GLM_CONSTEXPR vec(T
const& scalar, detail::_swizzle<2, T, Q, E0, E1, -1, -2>
const& v)
173 *
this = vec(scalar, v());
175 # endif//GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR
179 GLM_DEFAULTED_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q>& operator=(vec<3, T, Q>
const& v) GLM_DEFAULT;
182 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator=(vec<3, U, Q>
const& v);
184 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator+=(U scalar);
186 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator+=(vec<1, U, Q>
const& v);
188 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator+=(vec<3, U, Q>
const& v);
190 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator-=(U scalar);
192 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator-=(vec<1, U, Q>
const& v);
194 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator-=(vec<3, U, Q>
const& v);
196 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator*=(U scalar);
198 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator*=(vec<1, U, Q>
const& v);
200 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator*=(vec<3, U, Q>
const& v);
202 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator/=(U scalar);
204 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator/=(vec<1, U, Q>
const& v);
206 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator/=(vec<3, U, Q>
const& v);
210 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator++();
211 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator--();
212 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator++(
int);
213 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator--(
int);
218 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator%=(U scalar);
220 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator%=(vec<1, U, Q>
const& v);
222 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator%=(vec<3, U, Q>
const& v);
224 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator&=(U scalar);
226 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator&=(vec<1, U, Q>
const& v);
228 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator&=(vec<3, U, Q>
const& v);
230 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator|=(U scalar);
232 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator|=(vec<1, U, Q>
const& v);
234 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator|=(vec<3, U, Q>
const& v);
236 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator^=(U scalar);
238 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator^=(vec<1, U, Q>
const& v);
240 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator^=(vec<3, U, Q>
const& v);
242 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator<<=(U scalar);
244 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator<<=(vec<1, U, Q>
const& v);
246 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator<<=(vec<3, U, Q>
const& v);
248 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator>>=(U scalar);
250 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator>>=(vec<1, U, Q>
const& v);
252 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator>>=(vec<3, U, 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);
260 template<
typename T, qualifier Q>
261 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator-(vec<3, T, Q>
const& v);
265 template<
typename T, qualifier Q>
266 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator+(vec<3, T, Q>
const& v, T scalar);
268 template<
typename T, qualifier Q>
269 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator+(vec<3, T, Q>
const& v, vec<1, T, Q>
const& scalar);
271 template<
typename T, qualifier Q>
272 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator+(T scalar, vec<3, T, Q>
const& v);
274 template<
typename T, qualifier Q>
275 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator+(vec<1, 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& v1, vec<3, T, Q>
const& v2);
280 template<
typename T, qualifier Q>
281 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator-(vec<3, T, Q>
const& v, T scalar);
283 template<
typename T, qualifier Q>
284 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator-(vec<3, T, Q>
const& v1, vec<1, T, Q>
const& v2);
286 template<
typename T, qualifier Q>
287 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator-(T scalar, vec<3, T, Q>
const& v);
289 template<
typename T, qualifier Q>
290 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator-(vec<1, 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& v1, vec<3, T, Q>
const& v2);
295 template<
typename T, qualifier Q>
296 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator*(vec<3, T, Q>
const& v, T scalar);
298 template<
typename T, qualifier Q>
299 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator*(vec<3, T, Q>
const& v1, vec<1, T, Q>
const& v2);
301 template<
typename T, qualifier Q>
302 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator*(T scalar, vec<3, T, Q>
const& v);
304 template<
typename T, qualifier Q>
305 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator*(vec<1, 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& v1, vec<3, T, Q>
const& v2);
310 template<
typename T, qualifier Q>
311 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator/(vec<3, T, Q>
const& v, T scalar);
313 template<
typename T, qualifier Q>
314 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator/(vec<3, T, Q>
const& v1, vec<1, T, Q>
const& v2);
316 template<
typename T, qualifier Q>
317 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator/(T scalar, vec<3, T, Q>
const& v);
319 template<
typename T, qualifier Q>
320 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator/(vec<1, 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& v1, vec<3, T, Q>
const& v2);
325 template<
typename T, qualifier Q>
326 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator%(vec<3, T, Q>
const& v, T scalar);
328 template<
typename T, qualifier Q>
329 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator%(vec<3, T, Q>
const& v1, vec<1, T, Q>
const& v2);
331 template<
typename T, qualifier Q>
332 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator%(T scalar, vec<3, T, Q>
const& v);
334 template<
typename T, qualifier Q>
335 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator%(vec<1, 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, vec<3, T, Q>
const& v2);
340 template<
typename T, qualifier Q>
341 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator&(vec<3, T, Q>
const& v1, T scalar);
343 template<
typename T, qualifier Q>
344 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator&(vec<3, T, Q>
const& v1, vec<1, T, Q>
const& v2);
346 template<
typename T, qualifier Q>
347 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator&(T scalar, vec<3, T, Q>
const& v);
349 template<
typename T, qualifier Q>
350 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator&(vec<1, 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& v1, vec<3, T, Q>
const& v2);
355 template<
typename T, qualifier Q>
356 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator|(vec<3, T, Q>
const& v, T scalar);
358 template<
typename T, qualifier Q>
359 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator|(vec<3, T, Q>
const& v1, vec<1, T, Q>
const& v2);
361 template<
typename T, qualifier Q>
362 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator|(T scalar, vec<3, T, Q>
const& v);
364 template<
typename T, qualifier Q>
365 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator|(vec<1, 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& v1, vec<3, T, Q>
const& v2);
370 template<
typename T, qualifier Q>
371 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator^(vec<3, T, Q>
const& v, T scalar);
373 template<
typename T, qualifier Q>
374 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator^(vec<3, T, Q>
const& v1, vec<1, T, Q>
const& v2);
376 template<
typename T, qualifier Q>
377 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator^(T scalar, vec<3, T, Q>
const& v);
379 template<
typename T, qualifier Q>
380 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator^(vec<1, 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& v1, vec<3, T, Q>
const& v2);
385 template<
typename T, qualifier Q>
386 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator<<(vec<3, T, Q>
const& v, T scalar);
388 template<
typename T, qualifier Q>
389 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator<<(vec<3, T, Q>
const& v1, vec<1, T, Q>
const& v2);
391 template<
typename T, qualifier Q>
392 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator<<(T scalar, vec<3, T, Q>
const& v);
394 template<
typename T, qualifier Q>
395 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator<<(vec<1, 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& v1, vec<3, T, Q>
const& v2);
400 template<
typename T, qualifier Q>
401 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator>>(vec<3, T, Q>
const& v, T scalar);
403 template<
typename T, qualifier Q>
404 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator>>(vec<3, T, Q>
const& v1, vec<1, T, Q>
const& v2);
406 template<
typename T, qualifier Q>
407 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator>>(T scalar, vec<3, T, Q>
const& v);
409 template<
typename T, qualifier Q>
410 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator>>(vec<1, 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& v1, vec<3, T, Q>
const& v2);
415 template<
typename T, qualifier Q>
416 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator~(vec<3, T, Q>
const& v);
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<
typename T, qualifier Q>
424 GLM_FUNC_DECL GLM_CONSTEXPR
bool operator!=(vec<3, T, Q>
const& v1, vec<3, T, 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);
429 template<qualifier Q>
430 GLM_FUNC_DECL GLM_CONSTEXPR vec<3, bool, Q> operator||(vec<3, bool, Q>
const& v1, vec<3, bool, Q>
const& v2);
433 #ifndef GLM_EXTERNAL_TEMPLATE
434 #include "type_vec3.inl"
435 #endif//GLM_EXTERNAL_TEMPLATE