7 #if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
8 # if GLM_HAS_UNRESTRICTED_UNIONS
18 template<
typename T, qualifier Q>
25 typedef vec<2, 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_SWIZZLE2_2_MEMBERS(T, Q, x, y)
51 GLM_SWIZZLE2_2_MEMBERS(T, Q, r, g)
52 GLM_SWIZZLE2_2_MEMBERS(T, Q, s, t)
53 GLM_SWIZZLE2_3_MEMBERS(T, Q, x, y)
54 GLM_SWIZZLE2_3_MEMBERS(T, Q, r, g)
55 GLM_SWIZZLE2_3_MEMBERS(T, Q, s, t)
56 GLM_SWIZZLE2_4_MEMBERS(T, Q, x, y)
57 GLM_SWIZZLE2_4_MEMBERS(T, Q, r, g)
58 GLM_SWIZZLE2_4_MEMBERS(T, Q, s, t)
63 # if GLM_COMPILER & GLM_COMPILER_CLANG
64 # pragma clang diagnostic pop
66 # if GLM_COMPILER & GLM_COMPILER_GCC
67 # pragma GCC diagnostic pop
73 # if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
74 GLM_SWIZZLE_GEN_VEC_FROM_VEC2(T, P)
81 typedef length_t length_type;
82 GLM_FUNC_DECL
static GLM_CONSTEXPR length_type
length(){
return 2;}
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<2, T, P> const& v);
96 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit vec(T scalar);
97 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(T x, T y);
102 template<typename A, typename B>
103 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(A x, B y);
104 template<typename A, typename B>
105 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec<1, A, Q> const& x, vec<1, B, Q> const& y);
110 template<typename U, qualifier P>
111 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR GLM_EXPLICIT vec(vec<3, U, P> const& v);
113 template<typename U, qualifier P>
114 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR GLM_EXPLICIT vec(vec<4, U, P> const& v);
117 template<typename U, qualifier P>
118 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR GLM_EXPLICIT vec(vec<2, U, P> const& v);
121 # if GLM_HAS_UNRESTRICTED_UNIONS && (GLM_SWIZZLE == GLM_SWIZZLE_ENABLED)
122 template<
int E0,
int E1>
123 GLM_FUNC_DECL vec(detail::_swizzle<2, T, Q, E0, E1,-1,-2>
const& that)
127 # endif// GLM_HAS_UNRESTRICTED_UNIONS && (GLM_SWIZZLE == GLM_SWIZZLE_ENABLED)
131 GLM_FUNC_DECL vec& operator=(vec
const& v) GLM_DEFAULT;
134 GLM_FUNC_DECL vec& operator=(vec<2, U, Q>
const& v);
136 GLM_FUNC_DECL vec& operator+=(U scalar);
138 GLM_FUNC_DECL vec& operator+=(vec<1, U, Q>
const& v);
140 GLM_FUNC_DECL vec& operator+=(vec<2, U, Q>
const& v);
142 GLM_FUNC_DECL vec& operator-=(U scalar);
144 GLM_FUNC_DECL vec& operator-=(vec<1, U, Q>
const& v);
146 GLM_FUNC_DECL vec& operator-=(vec<2, U, Q>
const& v);
148 GLM_FUNC_DECL vec& operator*=(U scalar);
150 GLM_FUNC_DECL vec& operator*=(vec<1, U, Q>
const& v);
152 GLM_FUNC_DECL vec& operator*=(vec<2, U, Q>
const& v);
154 GLM_FUNC_DECL vec& operator/=(U scalar);
156 GLM_FUNC_DECL vec& operator/=(vec<1, U, Q>
const& v);
158 GLM_FUNC_DECL vec& operator/=(vec<2, U, Q>
const& v);
162 GLM_FUNC_DECL vec & operator++();
163 GLM_FUNC_DECL vec & operator--();
164 GLM_FUNC_DECL vec operator++(
int);
165 GLM_FUNC_DECL vec operator--(
int);
170 GLM_FUNC_DECL vec & operator%=(U scalar);
172 GLM_FUNC_DECL vec & operator%=(vec<1, U, Q>
const& v);
174 GLM_FUNC_DECL vec & operator%=(vec<2, U, Q>
const& v);
176 GLM_FUNC_DECL vec & operator&=(U scalar);
178 GLM_FUNC_DECL vec & operator&=(vec<1, U, Q>
const& v);
180 GLM_FUNC_DECL vec & operator&=(vec<2, U, Q>
const& v);
182 GLM_FUNC_DECL vec & operator|=(U scalar);
184 GLM_FUNC_DECL vec & operator|=(vec<1, U, Q>
const& v);
186 GLM_FUNC_DECL vec & operator|=(vec<2, U, Q>
const& v);
188 GLM_FUNC_DECL vec & operator^=(U scalar);
190 GLM_FUNC_DECL vec & operator^=(vec<1, U, Q>
const& v);
192 GLM_FUNC_DECL vec & operator^=(vec<2, U, Q>
const& v);
194 GLM_FUNC_DECL vec & operator<<=(U scalar);
196 GLM_FUNC_DECL vec & operator<<=(vec<1, U, Q>
const& v);
198 GLM_FUNC_DECL vec & operator<<=(vec<2, U, Q>
const& v);
200 GLM_FUNC_DECL vec & operator>>=(U scalar);
202 GLM_FUNC_DECL vec & operator>>=(vec<1, U, Q>
const& v);
204 GLM_FUNC_DECL vec & operator>>=(vec<2, U, Q>
const& v);
209 template<
typename T, qualifier Q>
210 GLM_FUNC_DECL vec<2, T, Q> operator+(vec<2, T, Q>
const& v);
212 template<
typename T, qualifier Q>
213 GLM_FUNC_DECL vec<2, T, Q> operator-(vec<2, T, Q>
const& v);
217 template<
typename T, qualifier Q>
218 GLM_FUNC_DECL vec<2, T, Q> operator+(vec<2, T, Q>
const& v, T scalar);
220 template<
typename T, qualifier Q>
221 GLM_FUNC_DECL vec<2, T, Q> operator+(vec<2, T, Q>
const& v1, vec<1, T, Q>
const& v2);
223 template<
typename T, qualifier Q>
224 GLM_FUNC_DECL vec<2, T, Q> operator+(T scalar, vec<2, T, Q>
const& v);
226 template<
typename T, qualifier Q>
227 GLM_FUNC_DECL vec<2, T, Q> operator+(vec<1, T, Q>
const& v1, vec<2, T, Q>
const& v2);
229 template<
typename T, qualifier Q>
230 GLM_FUNC_DECL vec<2, T, Q> operator+(vec<2, T, Q>
const& v1, vec<2, T, Q>
const& v2);
232 template<
typename T, qualifier Q>
233 GLM_FUNC_DECL vec<2, T, Q> operator-(vec<2, T, Q>
const& v, T scalar);
235 template<
typename T, qualifier Q>
236 GLM_FUNC_DECL vec<2, T, Q> operator-(vec<2, T, Q>
const& v1, vec<1, T, Q>
const& v2);
238 template<
typename T, qualifier Q>
239 GLM_FUNC_DECL vec<2, T, Q> operator-(T scalar, vec<2, T, Q>
const& v);
241 template<
typename T, qualifier Q>
242 GLM_FUNC_DECL vec<2, T, Q> operator-(vec<1, T, Q>
const& v1, vec<2, T, Q>
const& v2);
244 template<
typename T, qualifier Q>
245 GLM_FUNC_DECL vec<2, T, Q> operator-(vec<2, T, Q>
const& v1, vec<2, T, Q>
const& v2);
247 template<
typename T, qualifier Q>
248 GLM_FUNC_DECL vec<2, T, Q> operator*(vec<2, T, Q>
const& v, T scalar);
250 template<
typename T, qualifier Q>
251 GLM_FUNC_DECL vec<2, T, Q> operator*(vec<2, T, Q>
const& v1, vec<1, T, Q>
const& v2);
253 template<
typename T, qualifier Q>
254 GLM_FUNC_DECL vec<2, T, Q> operator*(T scalar, vec<2, T, Q>
const& v);
256 template<
typename T, qualifier Q>
257 GLM_FUNC_DECL vec<2, T, Q> operator*(vec<1, T, Q>
const& v1, vec<2, T, Q>
const& v2);
259 template<
typename T, qualifier Q>
260 GLM_FUNC_DECL vec<2, T, Q> operator*(vec<2, T, Q>
const& v1, vec<2, T, Q>
const& v2);
262 template<
typename T, qualifier Q>
263 GLM_FUNC_DECL vec<2, T, Q> operator/(vec<2, T, Q>
const& v, T scalar);
265 template<
typename T, qualifier Q>
266 GLM_FUNC_DECL vec<2, T, Q> operator/(vec<2, T, Q>
const& v1, vec<1, T, Q>
const& v2);
268 template<
typename T, qualifier Q>
269 GLM_FUNC_DECL vec<2, T, Q> operator/(T scalar, vec<2, T, Q>
const& v);
271 template<
typename T, qualifier Q>
272 GLM_FUNC_DECL vec<2, T, Q> operator/(vec<1, T, Q>
const& v1, vec<2, T, Q>
const& v2);
274 template<
typename T, qualifier Q>
275 GLM_FUNC_DECL vec<2, T, Q> operator/(vec<2, T, Q>
const& v1, vec<2, T, Q>
const& v2);
277 template<
typename T, qualifier Q>
278 GLM_FUNC_DECL vec<2, T, Q> operator%(vec<2, T, Q>
const& v, T scalar);
280 template<
typename T, qualifier Q>
281 GLM_FUNC_DECL vec<2, T, Q> operator%(vec<2, T, Q>
const& v1, vec<1, T, Q>
const& v2);
283 template<
typename T, qualifier Q>
284 GLM_FUNC_DECL vec<2, T, Q> operator%(T scalar, vec<2, T, Q>
const& v);
286 template<
typename T, qualifier Q>
287 GLM_FUNC_DECL vec<2, T, Q> operator%(vec<1, T, Q>
const& v1, vec<2, T, Q>
const& v2);
289 template<
typename T, qualifier Q>
290 GLM_FUNC_DECL vec<2, T, Q> operator%(vec<2, T, Q>
const& v1, vec<2, T, Q>
const& v2);
292 template<
typename T, qualifier Q>
293 GLM_FUNC_DECL vec<2, T, Q> operator&(vec<2, T, Q>
const& v, T scalar);
295 template<
typename T, qualifier Q>
296 GLM_FUNC_DECL vec<2, T, Q> operator&(vec<2, T, Q>
const& v1, vec<1, T, Q>
const& v2);
298 template<
typename T, qualifier Q>
299 GLM_FUNC_DECL vec<2, T, Q> operator&(T scalar, vec<2, T, Q>
const& v);
301 template<
typename T, qualifier Q>
302 GLM_FUNC_DECL vec<2, T, Q> operator&(vec<1, T, Q>
const& v1, vec<2, T, Q>
const& v2);
304 template<
typename T, qualifier Q>
305 GLM_FUNC_DECL vec<2, T, Q> operator&(vec<2, T, Q>
const& v1, vec<2, T, Q>
const& v2);
307 template<
typename T, qualifier Q>
308 GLM_FUNC_DECL vec<2, T, Q> operator|(vec<2, T, Q>
const& v, T scalar);
310 template<
typename T, qualifier Q>
311 GLM_FUNC_DECL vec<2, T, Q> operator|(vec<2, T, Q>
const& v1, vec<1, T, Q>
const& v2);
313 template<
typename T, qualifier Q>
314 GLM_FUNC_DECL vec<2, T, Q> operator|(T scalar, vec<2, T, Q>
const& v);
316 template<
typename T, qualifier Q>
317 GLM_FUNC_DECL vec<2, T, Q> operator|(vec<1, T, Q>
const& v1, vec<2, T, Q>
const& v2);
319 template<
typename T, qualifier Q>
320 GLM_FUNC_DECL vec<2, T, Q> operator|(vec<2, T, Q>
const& v1, vec<2, T, Q>
const& v2);
322 template<
typename T, qualifier Q>
323 GLM_FUNC_DECL vec<2, T, Q> operator^(vec<2, T, Q>
const& v, T scalar);
325 template<
typename T, qualifier Q>
326 GLM_FUNC_DECL vec<2, T, Q> operator^(vec<2, T, Q>
const& v1, vec<1, T, Q>
const& v2);
328 template<
typename T, qualifier Q>
329 GLM_FUNC_DECL vec<2, T, Q> operator^(T scalar, vec<2, T, Q>
const& v);
331 template<
typename T, qualifier Q>
332 GLM_FUNC_DECL vec<2, T, Q> operator^(vec<1, T, Q>
const& v1, vec<2, T, Q>
const& v2);
334 template<
typename T, qualifier Q>
335 GLM_FUNC_DECL vec<2, T, Q> operator^(vec<2, T, Q>
const& v1, vec<2, T, Q>
const& v2);
337 template<
typename T, qualifier Q>
338 GLM_FUNC_DECL vec<2, T, Q> operator<<(vec<2, T, Q>
const& v, T scalar);
340 template<
typename T, qualifier Q>
341 GLM_FUNC_DECL vec<2, T, Q> operator<<(vec<2, T, Q>
const& v1, vec<1, T, Q>
const& v2);
343 template<
typename T, qualifier Q>
344 GLM_FUNC_DECL vec<2, T, Q> operator<<(T scalar, vec<2, T, Q>
const& v);
346 template<
typename T, qualifier Q>
347 GLM_FUNC_DECL vec<2, T, Q> operator<<(vec<1, T, Q>
const& v1, vec<2, T, Q>
const& v2);
349 template<
typename T, qualifier Q>
350 GLM_FUNC_DECL vec<2, T, Q> operator<<(vec<2, T, Q>
const& v1, vec<2, T, Q>
const& v2);
352 template<
typename T, qualifier Q>
353 GLM_FUNC_DECL vec<2, T, Q> operator>>(vec<2, T, Q>
const& v, T scalar);
355 template<
typename T, qualifier Q>
356 GLM_FUNC_DECL vec<2, T, Q> operator>>(vec<2, T, Q>
const& v1, vec<1, T, Q>
const& v2);
358 template<
typename T, qualifier Q>
359 GLM_FUNC_DECL vec<2, T, Q> operator>>(T scalar, vec<2, T, Q>
const& v);
361 template<
typename T, qualifier Q>
362 GLM_FUNC_DECL vec<2, T, Q> operator>>(vec<1, T, Q>
const& v1, vec<2, T, Q>
const& v2);
364 template<
typename T, qualifier Q>
365 GLM_FUNC_DECL vec<2, T, Q> operator>>(vec<2, T, Q>
const& v1, vec<2, T, Q>
const& v2);
367 template<
typename T, qualifier Q>
368 GLM_FUNC_DECL vec<2, T, Q> operator~(vec<2, T, Q>
const& v);
372 template<
typename T, qualifier Q>
373 GLM_FUNC_DECL
bool operator==(vec<2, T, Q>
const& v1, vec<2, T, Q>
const& v2);
375 template<
typename T, qualifier Q>
376 GLM_FUNC_DECL
bool operator!=(vec<2, T, Q>
const& v1, vec<2, T, Q>
const& v2);
378 template<qualifier Q>
379 GLM_FUNC_DECL vec<2, bool, Q> operator&&(vec<2, bool, Q>
const& v1, vec<2, bool, Q>
const& v2);
381 template<qualifier Q>
382 GLM_FUNC_DECL vec<2, bool, Q> operator||(vec<2, bool, Q>
const& v1, vec<2, bool, Q>
const& v2);
385 #ifndef GLM_EXTERNAL_TEMPLATE
386 #include "type_vec2.inl"
387 #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).