type_vec2.hpp
Go to the documentation of this file.
1 
29 #pragma once
30 
31 //#include "../fwd.hpp"
32 #include "type_vec.hpp"
33 #ifdef GLM_SWIZZLE
34 # if GLM_HAS_ANONYMOUS_UNION
35 # include "_swizzle.hpp"
36 # else
37 # include "_swizzle_func.hpp"
38 # endif
39 #endif //GLM_SWIZZLE
40 #include <cstddef>
41 
42 namespace glm{
43 namespace detail
44 {
45  template <typename T, precision P>
46  struct tvec2
47  {
49  // Implementation detail
50 
51  enum ctor{_null};
52 
53  typedef tvec2<T, P> type;
55  typedef T value_type;
56  typedef int size_type;
57 
59  // Helper
60 
62 
64  // Data
65 
66 # if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
67  union
68  {
69  struct{ T x, y; };
70  struct{ T r, g; };
71  struct{ T s, t; };
72 
75  _GLM_SWIZZLE2_2_MEMBERS(T, P, tvec2, s, t)
77  _GLM_SWIZZLE2_3_MEMBERS(T, P, tvec3, r, g)
78  _GLM_SWIZZLE2_3_MEMBERS(T, P, tvec3, s, t)
80  _GLM_SWIZZLE2_4_MEMBERS(T, P, tvec4, r, g)
81  _GLM_SWIZZLE2_4_MEMBERS(T, P, tvec4, s, t)
82  };
83 # else
84  union {T x, r, s;};
85  union {T y, g, t;};
86 
87 # ifdef GLM_SWIZZLE
89 # endif
90 # endif
91 
93  // Accesses
94 
96  GLM_FUNC_DECL T const & operator[](length_t i) const;
97 
99  // Implicit basic constructors
100 
102  GLM_FUNC_DECL tvec2(tvec2<T, P> const & v);
103  template <precision Q>
104  GLM_FUNC_DECL tvec2(tvec2<T, Q> const & v);
105 
107  // Explicit basic constructors
108 
109  GLM_FUNC_DECL explicit tvec2(ctor);
110  GLM_FUNC_DECL explicit tvec2(T const & s);
111  GLM_FUNC_DECL tvec2(T const & s1, T const & s2);
112 
114  // Swizzle constructors
115 
116 # if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
117  template <int E0, int E1>
118  GLM_FUNC_DECL tvec2(_swizzle<2, T, P, tvec2<T, P>, E0, E1,-1,-2> const & that)
119  {
120  *this = that();
121  }
122 # endif//(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
123 
125  // Conversion constructors
126 
128  template <typename U, typename V>
129  GLM_FUNC_DECL tvec2(U const & x, V const & y);
130  template <typename U, typename V>
131  GLM_FUNC_DECL tvec2(tvec1<U, P> const & v1, tvec1<V, P> const & v2);
132 
134  // Conversion vector constructors
135 
137  template <typename U, precision Q>
138  GLM_FUNC_DECL tvec2(tvec2<U, Q> const & v);
140  template <typename U, precision Q>
141  GLM_FUNC_DECL explicit tvec2(tvec3<U, Q> const & v);
143  template <typename U, precision Q>
144  GLM_FUNC_DECL explicit tvec2(tvec4<U, Q> const & v);
145 
147  // Unary arithmetic operators
148 
150 
151  template <typename U>
153  template <typename U>
155  template <typename U>
157  template <typename U>
159  template <typename U>
161  template <typename U>
163  template <typename U>
165  template <typename U>
167  template <typename U>
169  template <typename U>
171  template <typename U>
173  template <typename U>
175  template <typename U>
177 
179  // Increment and decrement operators
180 
185 
187  // Unary bit operators
188 
189  template <typename U>
191  template <typename U>
193  template <typename U>
195  template <typename U>
197  template <typename U>
199  template <typename U>
201  template <typename U>
203  template <typename U>
205  template <typename U>
207  template <typename U>
209  template <typename U>
211  template <typename U>
213  template <typename U>
215  template <typename U>
216  GLM_FUNC_DECL tvec2<T, P> & operator<<=(tvec1<U, P> const & v);
217  template <typename U>
218  GLM_FUNC_DECL tvec2<T, P> & operator<<=(tvec2<U, P> const & v);
219  template <typename U>
221  template <typename U>
223  template <typename U>
225  };
226 
227  template <typename T, precision P>
228  GLM_FUNC_DECL tvec2<T, P> operator+(tvec2<T, P> const & v, T const & s);
229 
230  template <typename T, precision P>
232 
233  template <typename T, precision P>
234  GLM_FUNC_DECL tvec2<T, P> operator+(T const & s, tvec2<T, P> const & v);
235 
236  template <typename T, precision P>
238 
239  template <typename T, precision P>
241 
242  template <typename T, precision P>
243  GLM_FUNC_DECL tvec2<T, P> operator-(tvec2<T, P> const & v, T const & s);
244 
245  template <typename T, precision P>
247 
248  template <typename T, precision P>
249  GLM_FUNC_DECL tvec2<T, P> operator-(T const & s, tvec2<T, P> const & v);
250 
251  template <typename T, precision P>
253 
254  template <typename T, precision P>
256 
257  template <typename T, precision P>
258  GLM_FUNC_DECL tvec2<T, P> operator*(tvec2<T, P> const & v, T const & s);
259 
260  template <typename T, precision P>
262 
263  template <typename T, precision P>
264  GLM_FUNC_DECL tvec2<T, P> operator*(T const & s, tvec2<T, P> const & v);
265 
266  template <typename T, precision P>
268 
269  template <typename T, precision P>
271 
272  template <typename T, precision P>
273  GLM_FUNC_DECL tvec2<T, P> operator/(tvec2<T, P> const & v, T const & s);
274 
275  template <typename T, precision P>
277 
278  template <typename T, precision P>
279  GLM_FUNC_DECL tvec2<T, P> operator/(T const & s, tvec2<T, P> const & v);
280 
281  template <typename T, precision P>
283 
284  template <typename T, precision P>
286 
287  template <typename T, precision P>
289 
290  template <typename T, precision P>
291  GLM_FUNC_DECL tvec2<T, P> operator%(tvec2<T, P> const & v, T const & s);
292 
293  template <typename T, precision P>
295 
296  template <typename T, precision P>
297  GLM_FUNC_DECL tvec2<T, P> operator%(T const & s, tvec2<T, P> const & v);
298 
299  template <typename T, precision P>
301 
302  template <typename T, precision P>
304 
305  template <typename T, precision P>
306  GLM_FUNC_DECL tvec2<T, P> operator&(tvec2<T, P> const & v, T const & s);
307 
308  template <typename T, precision P>
310 
311  template <typename T, precision P>
312  GLM_FUNC_DECL tvec2<T, P> operator&(T const & s, tvec2<T, P> const & v);
313 
314  template <typename T, precision P>
316 
317  template <typename T, precision P>
319 
320  template <typename T, precision P>
321  GLM_FUNC_DECL tvec2<T, P> operator|(tvec2<T, P> const & v, T const & s);
322 
323  template <typename T, precision P>
325 
326  template <typename T, precision P>
327  GLM_FUNC_DECL tvec2<T, P> operator|(T const & s, tvec2<T, P> const & v);
328 
329  template <typename T, precision P>
331 
332  template <typename T, precision P>
334 
335  template <typename T, precision P>
336  GLM_FUNC_DECL tvec2<T, P> operator^(tvec2<T, P> const & v, T const & s);
337 
338  template <typename T, precision P>
340 
341  template <typename T, precision P>
342  GLM_FUNC_DECL tvec2<T, P> operator^(T const & s, tvec2<T, P> const & v);
343 
344  template <typename T, precision P>
346 
347  template <typename T, precision P>
349 
350  template <typename T, precision P>
351  GLM_FUNC_DECL tvec2<T, P> operator<<(tvec2<T, P> const & v, T const & s);
352 
353  template <typename T, precision P>
354  GLM_FUNC_DECL tvec2<T, P> operator<<(tvec2<T, P> const & v1, tvec1<T, P> const & v2);
355 
356  template <typename T, precision P>
357  GLM_FUNC_DECL tvec2<T, P> operator<<(T const & s, tvec2<T, P> const & v);
358 
359  template <typename T, precision P>
360  GLM_FUNC_DECL tvec2<T, P> operator<<(tvec1<T, P> const & v1, tvec2<T, P> const & v2);
361 
362  template <typename T, precision P>
363  GLM_FUNC_DECL tvec2<T, P> operator<<(tvec2<T, P> const & v1, tvec2<T, P> const & v2);
364 
365  template <typename T, precision P>
366  GLM_FUNC_DECL tvec2<T, P> operator>>(tvec2<T, P> const & v, T const & s);
367 
368  template <typename T, precision P>
370 
371  template <typename T, precision P>
372  GLM_FUNC_DECL tvec2<T, P> operator>>(T const & s, tvec2<T, P> const & v);
373 
374  template <typename T, precision P>
376 
377  template <typename T, precision P>
379 
380  template <typename T, precision P>
382 
383 }//namespace detail
384 }//namespace glm
385 
386 #ifndef GLM_EXTERNAL_TEMPLATE
387 #include "type_vec2.inl"
388 #endif//GLM_EXTERNAL_TEMPLATE
GLM_FUNC_DECL tvec1< T, P > operator^(tvec1< T, P > const &v, T const &s)
GLM_FUNC_DECL tvec1< T, P > operator&(tvec1< T, P > const &v, T const &s)
#define _GLM_SWIZZLE2_4_MEMBERS(T, P, V, E0, E1)
Definition: _swizzle.hpp:356
GLM_FUNC_DECL tvec2< T, P > & operator++()
GLM_FUNC_DECL tvec2()
int length_t
Definition: setup.hpp:755
GLM_FUNC_DECL tvec2< T, P > & operator<<=(U s)
GLM_FUNC_DECL tvec1< T, P > operator|(tvec1< T, P > const &v, T const &s)
#define GLM_SWIZZLE_GEN_VEC_FROM_VEC2(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE)
GLM_FUNC_DECL tvec1< T, P > operator~(tvec1< T, P > const &v)
GLM_FUNC_DECL tvec2< T, P > & operator^=(U s)
GLM_FUNC_DECL tmat2x2< T, P > operator*(tmat2x2< T, P > const &m, T const &s)
GLM_FUNC_DECL tvec2< T, P > & operator--()
GLM_FUNC_DECL tvec2< T, P > & operator%=(U s)
tvec2< T, P > type
Definition: type_vec2.hpp:53
GLM_FUNC_DECL tvec2< T, P > & operator/=(U s)
#define _GLM_SWIZZLE2_2_MEMBERS(T, P, V, E0, E1)
Definition: _swizzle.hpp:340
GLM_FUNC_DECL tvec2< T, P > & operator*=(U s)
GLM_FUNC_DECL tmat2x2< T, P > operator+(tmat2x2< T, P > const &m, T const &s)
GLM_FUNC_DECL tmat2x2< T, P > operator/(tmat2x2< T, P > const &m, T const &s)
GLM_FUNC_DECL tvec2< T, P > & operator&=(U s)
GLM_FUNC_DECL tmat2x2< T, P > operator-(tmat2x2< T, P > const &m, T const &s)
GLM_FUNC_DECL tvec2< T, P > & operator-=(U s)
GLM_FUNC_DECL tvec1< T, P > operator%(tvec1< T, P > const &v, T const &s)
GLM_FUNC_DECL tvec2< T, P > & operator>>=(U s)
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const
GLM_FUNC_DECL tvec2< T, P > & operator|=(U s)
GLM_FUNC_DECL tvec2< T, P > & operator=(tvec2< T, P > const &v)
tvec2< bool, P > bool_type
Definition: type_vec2.hpp:54
#define _GLM_SWIZZLE2_3_MEMBERS(T, P, V, E0, E1)
Definition: _swizzle.hpp:346
GLM_FUNC_DECL tvec1< T, P > operator>>(tvec1< T, P > const &v, T const &s)
#define GLM_CONSTEXPR
Definition: setup.hpp:801
GLM_FUNC_DECL tvec2< T, P > & operator+=(U s)
#define GLM_FUNC_DECL
Definition: setup.hpp:728
GLM_FUNC_DECL T & operator[](length_t i)


rtabmap
Author(s): Mathieu Labbe
autogenerated on Wed Jun 5 2019 22:43:40