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<2, T, Q> type;
23 typedef vec<2, 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
41 # if GLM_CONFIG_XYZW_ONLY
43 # if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_FUNCTION
44 GLM_SWIZZLE_GEN_VEC_FROM_VEC2_COMP(T, Q, x, y)
45 # endif//GLM_CONFIG_SWIZZLE
46 # elif GLM_CONFIG_ANONYMOUS_STRUCT == GLM_ENABLE
53 typename detail::storage<2, T, detail::is_aligned<Q>::value>::type data;
55 # if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR
56 GLM_SWIZZLE2_2_MEMBERS(T, Q, x, y)
57 GLM_SWIZZLE2_2_MEMBERS(T, Q, r, g)
58 GLM_SWIZZLE2_2_MEMBERS(T, Q, s, t)
59 GLM_SWIZZLE2_3_MEMBERS(T, Q, x, y)
60 GLM_SWIZZLE2_3_MEMBERS(T, Q, r, g)
61 GLM_SWIZZLE2_3_MEMBERS(T, Q, s, t)
62 GLM_SWIZZLE2_4_MEMBERS(T, Q, x, y)
63 GLM_SWIZZLE2_4_MEMBERS(T, Q, r, g)
64 GLM_SWIZZLE2_4_MEMBERS(T, Q, s, t)
71 # if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_FUNCTION
72 GLM_SWIZZLE_GEN_VEC_FROM_VEC2(T, Q)
73 # endif//GLM_CONFIG_SWIZZLE
76 # if GLM_SILENT_WARNINGS == GLM_ENABLE
77 # if GLM_COMPILER & GLM_COMPILER_CLANG
78 # pragma clang diagnostic pop
79 # elif GLM_COMPILER & GLM_COMPILER_GCC
80 # pragma GCC diagnostic pop
81 # elif GLM_COMPILER & GLM_COMPILER_VC
89 typedef length_t length_type;
90 GLM_FUNC_DECL
static GLM_CONSTEXPR length_type
length(){
return 2;}
92 GLM_FUNC_DECL GLM_CONSTEXPR T& operator[](length_type i);
93 GLM_FUNC_DECL GLM_CONSTEXPR T
const& operator[](length_type i)
const;
97 GLM_DEFAULTED_DEFAULT_CTOR_DECL GLM_CONSTEXPR vec() GLM_DEFAULT_CTOR;
98 GLM_DEFAULTED_FUNC_DECL GLM_CONSTEXPR vec(vec const& v) GLM_DEFAULT;
100 GLM_FUNC_DECL GLM_CONSTEXPR vec(vec<2, T, P> const& v);
104 GLM_FUNC_DECL GLM_CONSTEXPR explicit vec(T scalar);
105 GLM_FUNC_DECL GLM_CONSTEXPR vec(T x, T y);
109 template<typename U, qualifier P>
110 GLM_FUNC_DECL GLM_CONSTEXPR explicit vec(vec<1, U, P> const& v);
113 template<typename A, typename B>
114 GLM_FUNC_DECL GLM_CONSTEXPR vec(A x, B y);
115 template<typename A, typename B>
116 GLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, A, Q> const& x, B y);
117 template<typename A, typename B>
118 GLM_FUNC_DECL GLM_CONSTEXPR vec(A x, vec<1, B, Q> const& y);
119 template<typename A, typename B>
120 GLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, A, Q> const& x, vec<1, B, Q> const& y);
125 template<typename U, qualifier P>
126 GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT vec(vec<3, U, P> const& v);
128 template<typename U, qualifier P>
129 GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT vec(vec<4, U, P> const& v);
132 template<typename U, qualifier P>
133 GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT vec(vec<2, U, P> const& v);
136 # if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR
137 template<
int E0,
int E1>
138 GLM_FUNC_DECL GLM_CONSTEXPR vec(detail::_swizzle<2, T, Q, E0, E1,-1,-2>
const& that)
142 # endif//GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR
146 GLM_DEFAULTED_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator=(vec
const& v) GLM_DEFAULT;
149 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator=(vec<2, U, Q>
const& v);
151 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator+=(U scalar);
153 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator+=(vec<1, U, Q>
const& v);
155 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator+=(vec<2, U, Q>
const& v);
157 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator-=(U scalar);
159 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator-=(vec<1, U, Q>
const& v);
161 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator-=(vec<2, U, Q>
const& v);
163 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator*=(U scalar);
165 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator*=(vec<1, U, Q>
const& v);
167 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator*=(vec<2, U, Q>
const& v);
169 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator/=(U scalar);
171 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator/=(vec<1, U, Q>
const& v);
173 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator/=(vec<2, U, Q>
const& v);
177 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator++();
178 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator--();
179 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator++(
int);
180 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator--(
int);
185 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator%=(U scalar);
187 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator%=(vec<1, U, Q>
const& v);
189 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator%=(vec<2, U, Q>
const& v);
191 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator&=(U scalar);
193 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator&=(vec<1, U, Q>
const& v);
195 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator&=(vec<2, U, Q>
const& v);
197 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator|=(U scalar);
199 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator|=(vec<1, U, Q>
const& v);
201 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator|=(vec<2, U, Q>
const& v);
203 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator^=(U scalar);
205 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator^=(vec<1, U, Q>
const& v);
207 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator^=(vec<2, U, Q>
const& v);
209 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator<<=(U scalar);
211 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator<<=(vec<1, U, Q>
const& v);
213 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator<<=(vec<2, U, Q>
const& v);
215 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator>>=(U scalar);
217 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator>>=(vec<1, U, Q>
const& v);
219 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator>>=(vec<2, U, Q>
const& v);
224 template<
typename T, qualifier Q>
225 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator+(vec<2, T, Q>
const& v);
227 template<
typename T, qualifier Q>
228 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator-(vec<2, T, Q>
const& v);
232 template<
typename T, qualifier Q>
233 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator+(vec<2, T, Q>
const& v, T scalar);
235 template<
typename T, qualifier Q>
236 GLM_FUNC_DECL GLM_CONSTEXPR 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 GLM_CONSTEXPR vec<2, T, Q> operator+(T scalar, vec<2, T, Q>
const& v);
241 template<
typename T, qualifier Q>
242 GLM_FUNC_DECL GLM_CONSTEXPR 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 GLM_CONSTEXPR 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 GLM_CONSTEXPR vec<2, T, Q> operator-(vec<2, T, Q>
const& v, T scalar);
250 template<
typename T, qualifier Q>
251 GLM_FUNC_DECL GLM_CONSTEXPR 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 GLM_CONSTEXPR vec<2, T, Q> operator-(T scalar, vec<2, T, Q>
const& v);
256 template<
typename T, qualifier Q>
257 GLM_FUNC_DECL GLM_CONSTEXPR 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 GLM_CONSTEXPR 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 GLM_CONSTEXPR vec<2, T, Q> operator*(vec<2, T, Q>
const& v, T scalar);
265 template<
typename T, qualifier Q>
266 GLM_FUNC_DECL GLM_CONSTEXPR 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 GLM_CONSTEXPR vec<2, T, Q> operator*(T scalar, vec<2, T, Q>
const& v);
271 template<
typename T, qualifier Q>
272 GLM_FUNC_DECL GLM_CONSTEXPR 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 GLM_CONSTEXPR 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 GLM_CONSTEXPR vec<2, T, Q> operator/(vec<2, T, Q>
const& v, T scalar);
280 template<
typename T, qualifier Q>
281 GLM_FUNC_DECL GLM_CONSTEXPR 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 GLM_CONSTEXPR vec<2, T, Q> operator/(T scalar, vec<2, T, Q>
const& v);
286 template<
typename T, qualifier Q>
287 GLM_FUNC_DECL GLM_CONSTEXPR 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 GLM_CONSTEXPR 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 GLM_CONSTEXPR vec<2, T, Q> operator%(vec<2, T, Q>
const& v, T scalar);
295 template<
typename T, qualifier Q>
296 GLM_FUNC_DECL GLM_CONSTEXPR 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 GLM_CONSTEXPR vec<2, T, Q> operator%(T scalar, vec<2, T, Q>
const& v);
301 template<
typename T, qualifier Q>
302 GLM_FUNC_DECL GLM_CONSTEXPR 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 GLM_CONSTEXPR 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 GLM_CONSTEXPR vec<2, T, Q> operator&(vec<2, T, Q>
const& v, T scalar);
310 template<
typename T, qualifier Q>
311 GLM_FUNC_DECL GLM_CONSTEXPR 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 GLM_CONSTEXPR vec<2, T, Q> operator&(T scalar, vec<2, T, Q>
const& v);
316 template<
typename T, qualifier Q>
317 GLM_FUNC_DECL GLM_CONSTEXPR 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 GLM_CONSTEXPR 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 GLM_CONSTEXPR vec<2, T, Q> operator|(vec<2, T, Q>
const& v, T scalar);
325 template<
typename T, qualifier Q>
326 GLM_FUNC_DECL GLM_CONSTEXPR 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 GLM_CONSTEXPR vec<2, T, Q> operator|(T scalar, vec<2, T, Q>
const& v);
331 template<
typename T, qualifier Q>
332 GLM_FUNC_DECL GLM_CONSTEXPR 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 GLM_CONSTEXPR 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 GLM_CONSTEXPR vec<2, T, Q> operator^(vec<2, T, Q>
const& v, T scalar);
340 template<
typename T, qualifier Q>
341 GLM_FUNC_DECL GLM_CONSTEXPR 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 GLM_CONSTEXPR vec<2, T, Q> operator^(T scalar, vec<2, T, Q>
const& v);
346 template<
typename T, qualifier Q>
347 GLM_FUNC_DECL GLM_CONSTEXPR 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 GLM_CONSTEXPR 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 GLM_CONSTEXPR vec<2, T, Q> operator<<(vec<2, T, Q>
const& v, T scalar);
355 template<
typename T, qualifier Q>
356 GLM_FUNC_DECL GLM_CONSTEXPR 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 GLM_CONSTEXPR vec<2, T, Q> operator<<(T scalar, vec<2, T, Q>
const& v);
361 template<
typename T, qualifier Q>
362 GLM_FUNC_DECL GLM_CONSTEXPR 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 GLM_CONSTEXPR 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 GLM_CONSTEXPR vec<2, T, Q> operator>>(vec<2, T, Q>
const& v, T scalar);
370 template<
typename T, qualifier Q>
371 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator>>(vec<2, T, Q>
const& v1, vec<1, T, Q>
const& v2);
373 template<
typename T, qualifier Q>
374 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator>>(T scalar, vec<2, T, Q>
const& v);
376 template<
typename T, qualifier Q>
377 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator>>(vec<1, T, Q>
const& v1, vec<2, T, Q>
const& v2);
379 template<
typename T, qualifier Q>
380 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator>>(vec<2, T, Q>
const& v1, vec<2, T, Q>
const& v2);
382 template<
typename T, qualifier Q>
383 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator~(vec<2, T, Q>
const& v);
387 template<
typename T, qualifier Q>
388 GLM_FUNC_DECL GLM_CONSTEXPR
bool operator==(vec<2, T, Q>
const& v1, vec<2, T, Q>
const& v2);
390 template<
typename T, qualifier Q>
391 GLM_FUNC_DECL GLM_CONSTEXPR
bool operator!=(vec<2, T, Q>
const& v1, vec<2, T, Q>
const& v2);
393 template<qualifier Q>
394 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, bool, Q> operator&&(vec<2, bool, Q>
const& v1, vec<2, bool, Q>
const& v2);
396 template<qualifier Q>
397 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, bool, Q> operator||(vec<2, bool, Q>
const& v1, vec<2, bool, Q>
const& v2);
400 #ifndef GLM_EXTERNAL_TEMPLATE
401 #include "type_vec2.inl"
402 #endif//GLM_EXTERNAL_TEMPLATE