7 #if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
8 # if GLM_HAS_UNRESTRICTED_UNIONS
13 #endif //GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
18 template<
typename T, qualifier Q>
25 typedef vec<3, bool, Q> bool_type;
29 # if GLM_HAS_ONLY_XYZW
32 # elif GLM_HAS_ALIGNED_TYPE
33 # if GLM_COMPILER & GLM_COMPILER_GCC
34 # pragma GCC diagnostic push
35 # pragma GCC diagnostic ignored "-Wpedantic"
37 # if GLM_COMPILER & GLM_COMPILER_CLANG
38 # pragma clang diagnostic push
39 # pragma clang diagnostic ignored "-Wgnu-anonymous-struct"
40 # pragma clang diagnostic ignored "-Wnested-anon-types"
49 # if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
50 GLM_SWIZZLE3_2_MEMBERS(T, Q, x, y, z)
51 GLM_SWIZZLE3_2_MEMBERS(T, Q, r, g, b)
52 GLM_SWIZZLE3_2_MEMBERS(T, Q, s, t, p)
53 GLM_SWIZZLE3_3_MEMBERS(T, Q, x, y, z)
54 GLM_SWIZZLE3_3_MEMBERS(T, Q, r, g, b)
55 GLM_SWIZZLE3_3_MEMBERS(T, Q, s, t, p)
56 GLM_SWIZZLE3_4_MEMBERS(T, Q, x, y, z)
57 GLM_SWIZZLE3_4_MEMBERS(T, Q, r, g, b)
58 GLM_SWIZZLE3_4_MEMBERS(T, Q, s, t, p)
62 # if GLM_COMPILER & GLM_COMPILER_CLANG
63 # pragma clang diagnostic pop
65 # if GLM_COMPILER & GLM_COMPILER_GCC
66 # pragma GCC diagnostic pop
73 # if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
74 GLM_SWIZZLE_GEN_VEC_FROM_VEC3(T, P)
81 typedef length_t length_type;
82 GLM_FUNC_DECL
static GLM_CONSTEXPR length_type
length(){
return 3;}
84 GLM_FUNC_DECL T & operator[](length_type i);
85 GLM_FUNC_DECL T
const& operator[](length_type i)
const;
89 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec() GLM_DEFAULT;
90 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec const& v) GLM_DEFAULT;
92 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec<3, T, P> const& v);
96 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit vec(T scalar);
97 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(T a, T b, T c);
102 template<typename X, typename Y, typename Z>
103 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(X x, Y y, Z z);
104 template<typename X, typename Y, typename Z>
105 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec<1, X, Q> const& _x, vec<1, Y, Q> const& _y, vec<1, Z, Q> const& _z);
110 template<typename A, typename B, qualifier P>
111 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec<2, A, P> const& _xy, B _z);
113 template<typename A, typename B, qualifier P>
114 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec<2, A, P> const& _xy, vec<1, B, P> const& _z);
116 template<typename A, typename B, qualifier P>
117 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(A _x, vec<2, B, P> const& _yz);
119 template<typename A, typename B, qualifier P>
120 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec<1, A, P> const& _x, vec<2, B, P> const& _yz);
122 template<typename U, qualifier P>
123 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR GLM_EXPLICIT vec(vec<4, U, P> const& v);
126 template<typename U, qualifier P>
127 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR GLM_EXPLICIT vec(vec<3, U, P> const& v);
130 # if GLM_HAS_UNRESTRICTED_UNIONS && (GLM_SWIZZLE == GLM_SWIZZLE_ENABLED)
131 template<
int E0,
int E1,
int E2>
132 GLM_FUNC_DECL vec(detail::_swizzle<3, T, Q, E0, E1, E2, -1>
const& that)
137 template<
int E0,
int E1>
138 GLM_FUNC_DECL vec(detail::_swizzle<2, T, Q, E0, E1, -1, -2>
const& v, T
const& scalar)
140 *
this = vec(v(), scalar);
143 template<
int E0,
int E1>
144 GLM_FUNC_DECL vec(T
const& scalar, detail::_swizzle<2, T, Q, E0, E1, -1, -2>
const& v)
146 *
this = vec(scalar, v());
148 # endif// GLM_HAS_UNRESTRICTED_UNIONS && (GLM_SWIZZLE == GLM_SWIZZLE_ENABLED)
152 GLM_FUNC_DECL vec & operator=(vec
const& v) GLM_DEFAULT;
155 GLM_FUNC_DECL vec & operator=(vec<3, U, Q>
const& v);
157 GLM_FUNC_DECL vec & operator+=(U scalar);
159 GLM_FUNC_DECL vec & operator+=(vec<1, U, Q>
const& v);
161 GLM_FUNC_DECL vec & operator+=(vec<3, U, Q>
const& v);
163 GLM_FUNC_DECL vec & operator-=(U scalar);
165 GLM_FUNC_DECL vec & operator-=(vec<1, U, Q>
const& v);
167 GLM_FUNC_DECL vec & operator-=(vec<3, U, Q>
const& v);
169 GLM_FUNC_DECL vec & operator*=(U scalar);
171 GLM_FUNC_DECL vec & operator*=(vec<1, U, Q>
const& v);
173 GLM_FUNC_DECL vec & operator*=(vec<3, U, Q>
const& v);
175 GLM_FUNC_DECL vec & operator/=(U scalar);
177 GLM_FUNC_DECL vec & operator/=(vec<1, U, Q>
const& v);
179 GLM_FUNC_DECL vec & operator/=(vec<3, U, Q>
const& v);
183 GLM_FUNC_DECL vec & operator++();
184 GLM_FUNC_DECL vec & operator--();
185 GLM_FUNC_DECL vec operator++(
int);
186 GLM_FUNC_DECL vec operator--(
int);
191 GLM_FUNC_DECL vec & operator%=(U scalar);
193 GLM_FUNC_DECL vec & operator%=(vec<1, U, Q>
const& v);
195 GLM_FUNC_DECL vec & operator%=(vec<3, U, Q>
const& v);
197 GLM_FUNC_DECL vec & operator&=(U scalar);
199 GLM_FUNC_DECL vec & operator&=(vec<1, U, Q>
const& v);
201 GLM_FUNC_DECL vec & operator&=(vec<3, U, Q>
const& v);
203 GLM_FUNC_DECL vec & operator|=(U scalar);
205 GLM_FUNC_DECL vec & operator|=(vec<1, U, Q>
const& v);
207 GLM_FUNC_DECL vec & operator|=(vec<3, U, Q>
const& v);
209 GLM_FUNC_DECL vec & operator^=(U scalar);
211 GLM_FUNC_DECL vec & operator^=(vec<1, U, Q>
const& v);
213 GLM_FUNC_DECL vec & operator^=(vec<3, U, Q>
const& v);
215 GLM_FUNC_DECL vec & operator<<=(U scalar);
217 GLM_FUNC_DECL vec & operator<<=(vec<1, U, Q>
const& v);
219 GLM_FUNC_DECL vec & operator<<=(vec<3, U, Q>
const& v);
221 GLM_FUNC_DECL vec & operator>>=(U scalar);
223 GLM_FUNC_DECL vec & operator>>=(vec<1, U, Q>
const& v);
225 GLM_FUNC_DECL vec & operator>>=(vec<3, U, Q>
const& v);
230 template<
typename T, qualifier Q>
231 GLM_FUNC_DECL vec<3, T, Q> operator+(vec<3, T, Q>
const& v);
233 template<
typename T, qualifier Q>
234 GLM_FUNC_DECL vec<3, T, Q> operator-(vec<3, T, Q>
const& v);
238 template<
typename T, qualifier Q>
239 GLM_FUNC_DECL vec<3, T, Q> operator+(vec<3, T, Q>
const& v, T scalar);
241 template<
typename T, qualifier Q>
242 GLM_FUNC_DECL vec<3, T, Q> operator+(vec<3, T, Q>
const& v, vec<1, T, Q>
const& scalar);
244 template<
typename T, qualifier Q>
245 GLM_FUNC_DECL vec<3, T, Q> operator+(T scalar, vec<3, T, Q>
const& v);
247 template<
typename T, qualifier Q>
248 GLM_FUNC_DECL vec<3, T, Q> operator+(vec<1, T, Q>
const& v1, vec<3, T, Q>
const& v2);
250 template<
typename T, qualifier Q>
251 GLM_FUNC_DECL vec<3, T, Q> operator+(vec<3, T, Q>
const& v1, vec<3, T, Q>
const& v2);
253 template<
typename T, qualifier Q>
254 GLM_FUNC_DECL vec<3, T, Q> operator-(vec<3, T, Q>
const& v, T scalar);
256 template<
typename T, qualifier Q>
257 GLM_FUNC_DECL vec<3, T, Q> operator-(vec<3, T, Q>
const& v1, vec<1, T, Q>
const& v2);
259 template<
typename T, qualifier Q>
260 GLM_FUNC_DECL vec<3, T, Q> operator-(T scalar, vec<3, T, Q>
const& v);
262 template<
typename T, qualifier Q>
263 GLM_FUNC_DECL vec<3, T, Q> operator-(vec<1, T, Q>
const& v1, vec<3, T, Q>
const& v2);
265 template<
typename T, qualifier Q>
266 GLM_FUNC_DECL vec<3, T, Q> operator-(vec<3, T, Q>
const& v1, vec<3, T, Q>
const& v2);
268 template<
typename T, qualifier Q>
269 GLM_FUNC_DECL vec<3, T, Q> operator*(vec<3, T, Q>
const& v, T scalar);
271 template<
typename T, qualifier Q>
272 GLM_FUNC_DECL vec<3, T, Q> operator*(vec<3, T, Q>
const& v1, vec<1, T, Q>
const& v2);
274 template<
typename T, qualifier Q>
275 GLM_FUNC_DECL vec<3, T, Q> operator*(T scalar, vec<3, T, Q>
const& v);
277 template<
typename T, qualifier Q>
278 GLM_FUNC_DECL vec<3, T, Q> operator*(vec<1, T, Q>
const& v1, vec<3, T, Q>
const& v2);
280 template<
typename T, qualifier Q>
281 GLM_FUNC_DECL vec<3, T, Q> operator*(vec<3, T, Q>
const& v1, vec<3, T, Q>
const& v2);
283 template<
typename T, qualifier Q>
284 GLM_FUNC_DECL vec<3, T, Q> operator/(vec<3, T, Q>
const& v, T scalar);
286 template<
typename T, qualifier Q>
287 GLM_FUNC_DECL vec<3, T, Q> operator/(vec<3, T, Q>
const& v1, vec<1, T, Q>
const& v2);
289 template<
typename T, qualifier Q>
290 GLM_FUNC_DECL vec<3, T, Q> operator/(T scalar, vec<3, T, Q>
const& v);
292 template<
typename T, qualifier Q>
293 GLM_FUNC_DECL vec<3, T, Q> operator/(vec<1, T, Q>
const& v1, vec<3, T, Q>
const& v2);
295 template<
typename T, qualifier Q>
296 GLM_FUNC_DECL vec<3, T, Q> operator/(vec<3, T, Q>
const& v1, vec<3, T, Q>
const& v2);
298 template<
typename T, qualifier Q>
299 GLM_FUNC_DECL vec<3, T, Q> operator%(vec<3, T, Q>
const& v, T scalar);
301 template<
typename T, qualifier Q>
302 GLM_FUNC_DECL vec<3, T, Q> operator%(vec<3, T, Q>
const& v1, vec<1, T, Q>
const& v2);
304 template<
typename T, qualifier Q>
305 GLM_FUNC_DECL vec<3, T, Q> operator%(T
const& scalar, vec<3, T, Q>
const& v);
307 template<
typename T, qualifier Q>
308 GLM_FUNC_DECL vec<3, T, Q> operator%(vec<1, T, Q>
const& v1, vec<3, T, Q>
const& v2);
310 template<
typename T, qualifier Q>
311 GLM_FUNC_DECL vec<3, T, Q> operator%(vec<3, T, Q>
const& v1, vec<3, T, Q>
const& v2);
313 template<
typename T, qualifier Q>
314 GLM_FUNC_DECL vec<3, T, Q> operator&(vec<3, T, Q>
const& v1, T scalar);
316 template<
typename T, qualifier Q>
317 GLM_FUNC_DECL vec<3, T, Q> operator&(vec<3, T, Q>
const& v1, vec<1, T, Q>
const& v2);
319 template<
typename T, qualifier Q>
320 GLM_FUNC_DECL vec<3, T, Q> operator&(T scalar, vec<3, T, Q>
const& v);
322 template<
typename T, qualifier Q>
323 GLM_FUNC_DECL vec<3, T, Q> operator&(vec<1, T, Q>
const& v1, vec<3, T, Q>
const& v2);
325 template<
typename T, qualifier Q>
326 GLM_FUNC_DECL vec<3, T, Q> operator&(vec<3, T, Q>
const& v1, vec<3, T, Q>
const& v2);
328 template<
typename T, qualifier Q>
329 GLM_FUNC_DECL vec<3, T, Q> operator|(vec<3, T, Q>
const& v, T scalar);
331 template<
typename T, qualifier Q>
332 GLM_FUNC_DECL vec<3, T, Q> operator|(vec<3, T, Q>
const& v1, vec<1, T, Q>
const& v2);
334 template<
typename T, qualifier Q>
335 GLM_FUNC_DECL vec<3, T, Q> operator|(T scalar, vec<3, T, Q>
const& v);
337 template<
typename T, qualifier Q>
338 GLM_FUNC_DECL vec<3, T, Q> operator|(vec<1, T, Q>
const& v1, vec<3, T, Q>
const& v2);
340 template<
typename T, qualifier Q>
341 GLM_FUNC_DECL vec<3, T, Q> operator|(vec<3, T, Q>
const& v1, vec<3, T, Q>
const& v2);
343 template<
typename T, qualifier Q>
344 GLM_FUNC_DECL vec<3, T, Q> operator^(vec<3, T, Q>
const& v, T scalar);
346 template<
typename T, qualifier Q>
347 GLM_FUNC_DECL vec<3, T, Q> operator^(vec<3, T, Q>
const& v1, vec<1, T, Q>
const& v2);
349 template<
typename T, qualifier Q>
350 GLM_FUNC_DECL vec<3, T, Q> operator^(T scalar, vec<3, T, Q>
const& v);
352 template<
typename T, qualifier Q>
353 GLM_FUNC_DECL vec<3, T, Q> operator^(vec<1, T, Q>
const& v1, vec<3, T, Q>
const& v2);
355 template<
typename T, qualifier Q>
356 GLM_FUNC_DECL vec<3, T, Q> operator^(vec<3, T, Q>
const& v1, vec<3, T, Q>
const& v2);
358 template<
typename T, qualifier Q>
359 GLM_FUNC_DECL vec<3, T, Q> operator<<(vec<3, T, Q>
const& v, T scalar);
361 template<
typename T, qualifier Q>
362 GLM_FUNC_DECL vec<3, T, Q> operator<<(vec<3, T, Q>
const& v1, vec<1, T, Q>
const& v2);
364 template<
typename T, qualifier Q>
365 GLM_FUNC_DECL vec<3, T, Q> operator<<(T scalar, vec<3, T, Q>
const& v);
367 template<
typename T, qualifier Q>
368 GLM_FUNC_DECL vec<3, T, Q> operator<<(vec<1, T, Q>
const& v1, vec<3, T, Q>
const& v2);
370 template<
typename T, qualifier Q>
371 GLM_FUNC_DECL vec<3, T, Q> operator<<(vec<3, T, Q>
const& v1, vec<3, T, Q>
const& v2);
373 template<
typename T, qualifier Q>
374 GLM_FUNC_DECL vec<3, T, Q> operator>>(vec<3, T, Q>
const& v, T scalar);
376 template<
typename T, qualifier Q>
377 GLM_FUNC_DECL vec<3, T, Q> operator>>(vec<3, T, Q>
const& v1, vec<1, T, Q>
const& v2);
379 template<
typename T, qualifier Q>
380 GLM_FUNC_DECL vec<3, T, Q> operator>>(T scalar, vec<3, T, Q>
const& v);
382 template<
typename T, qualifier Q>
383 GLM_FUNC_DECL vec<3, T, Q> operator>>(vec<1, T, Q>
const& v1, vec<3, T, Q>
const& v2);
385 template<
typename T, qualifier Q>
386 GLM_FUNC_DECL vec<3, T, Q> operator>>(vec<3, T, Q>
const& v1, vec<3, T, Q>
const& v2);
388 template<
typename T, qualifier Q>
389 GLM_FUNC_DECL vec<3, T, Q> operator~(vec<3, T, Q>
const& v);
393 template<
typename T, qualifier Q>
394 GLM_FUNC_DECL
bool operator==(vec<3, T, Q>
const& v1, vec<3, T, Q>
const& v2);
396 template<
typename T, qualifier Q>
397 GLM_FUNC_DECL
bool operator!=(vec<3, T, Q>
const& v1, vec<3, T, Q>
const& v2);
399 template<qualifier Q>
400 GLM_FUNC_DECL vec<3, bool, Q> operator&&(vec<3, bool, Q>
const& v1, vec<3, bool, Q>
const& v2);
402 template<qualifier Q>
403 GLM_FUNC_DECL vec<3, bool, Q> operator||(vec<3, bool, Q>
const& v1, vec<3, bool, Q>
const& v2);
406 #ifndef GLM_EXTERNAL_TEMPLATE
407 #include "type_vec3.inl"
408 #endif//GLM_EXTERNAL_TEMPLATE
GLM_FUNC_DECL T length(vec< L, T, Q > const &x)
Returns the length of x, i.e., sqrt(x * x).