PSMoveService
type_vec1.hpp
Go to the documentation of this file.
1 
29 #ifndef glm_core_type_gentype1
30 #define glm_core_type_gentype1
31 
32 #include "type_vec.hpp"
33 #include "type_float.hpp"
34 #include "type_int.hpp"
35 #include "type_size.hpp"
36 #include "_swizzle.hpp"
37 
38 namespace glm{
39 namespace detail
40 {
41  template <typename T> struct tref1;
42  template <typename T> struct tref2;
43  template <typename T> struct tref3;
44  template <typename T> struct tref4;
45  template <typename T> struct tvec1;
46  template <typename T> struct tvec2;
47  template <typename T> struct tvec3;
48  template <typename T> struct tvec4;
49 
50  template <typename T>
51  struct tvec1
52  {
53  enum ctor{null};
54 
55  typedef T value_type;
56  typedef std::size_t size_type;
57  GLM_FUNC_DECL size_type length() const;
58 
59  typedef tvec1<T> type;
60  typedef tvec1<bool> bool_type;
61 
63  // Data
64 
65 # if(GLM_COMPONENT == GLM_COMPONENT_ONLY_XYZW)
66  value_type x;
67 # else//(GLM_COMPONENT == GLM_COMPONENT_GLSL_NAMES)
68  union {value_type x, r, s;};
69 # endif//GLM_COMPONENT
70 
72  // Accesses
73 
74  GLM_FUNC_DECL value_type & operator[](size_type i);
75  GLM_FUNC_DECL value_type const & operator[](size_type i) const;
76 
78  // Implicit basic constructors
79 
80  GLM_FUNC_DECL tvec1();
81  GLM_FUNC_DECL tvec1(tvec1<T> const & v);
82 
84  // Explicit basic constructors
85 
86  GLM_FUNC_DECL explicit tvec1(
87  ctor);
88  GLM_FUNC_DECL explicit tvec1(
89  value_type const & s);
90 
92  // Swizzle constructors
93 
94  GLM_FUNC_DECL tvec1(tref1<T> const & r);
95 
97  // Convertion scalar constructors
98 
100  template <typename U>
101  GLM_FUNC_DECL explicit tvec1(U const & s);
102 
104  // Convertion vector constructors
105 
107  template <typename U>
108  GLM_FUNC_DECL explicit tvec1(tvec2<U> const & v);
110  template <typename U>
111  GLM_FUNC_DECL explicit tvec1(tvec3<U> const & v);
113  template <typename U>
114  GLM_FUNC_DECL explicit tvec1(tvec4<U> const & v);
115 
117  // Unary arithmetic operators
118 
119  GLM_FUNC_DECL tvec1<T> & operator= (tvec1<T> const & v);
120  template <typename U>
121  GLM_FUNC_DECL tvec1<T> & operator= (tvec1<U> const & v);
122 
123  template <typename U>
124  GLM_FUNC_DECL tvec1<T> & operator+=(U const & s);
125  template <typename U>
126  GLM_FUNC_DECL tvec1<T> & operator+=(tvec1<U> const & v);
127  template <typename U>
128  GLM_FUNC_DECL tvec1<T> & operator-=(U const & s);
129  template <typename U>
130  GLM_FUNC_DECL tvec1<T> & operator-=(tvec1<U> const & v);
131  template <typename U>
132  GLM_FUNC_DECL tvec1<T> & operator*=(U const & s);
133  template <typename U>
134  GLM_FUNC_DECL tvec1<T> & operator*=(tvec1<U> const & v);
135  template <typename U>
136  GLM_FUNC_DECL tvec1<T> & operator/=(U const & s);
137  template <typename U>
138  GLM_FUNC_DECL tvec1<T> & operator/=(tvec1<U> const & v);
139  GLM_FUNC_DECL tvec1<T> & operator++();
140  GLM_FUNC_DECL tvec1<T> & operator--();
141 
143  // Unary bit operators
144 
145  template <typename U>
146  GLM_FUNC_DECL tvec1<T> & operator%=(U const & s);
147  template <typename U>
148  GLM_FUNC_DECL tvec1<T> & operator%=(tvec1<U> const & v);
149  template <typename U>
150  GLM_FUNC_DECL tvec1<T> & operator&=(U const & s);
151  template <typename U>
152  GLM_FUNC_DECL tvec1<T> & operator&=(tvec1<U> const & v);
153  template <typename U>
154  GLM_FUNC_DECL tvec1<T> & operator|=(U const & s);
155  template <typename U>
156  GLM_FUNC_DECL tvec1<T> & operator|=(tvec1<U> const & v);
157  template <typename U>
158  GLM_FUNC_DECL tvec1<T> & operator^=(U const & s);
159  template <typename U>
160  GLM_FUNC_DECL tvec1<T> & operator^=(tvec1<U> const & v);
161  template <typename U>
162  GLM_FUNC_DECL tvec1<T> & operator<<=(U const & s);
163  template <typename U>
164  GLM_FUNC_DECL tvec1<T> & operator<<=(tvec1<U> const & v);
165  template <typename U>
166  GLM_FUNC_DECL tvec1<T> & operator>>=(U const & s);
167  template <typename U>
168  GLM_FUNC_DECL tvec1<T> & operator>>=(tvec1<U> const & v);
169 
171  // Swizzle operators
172 
173  GLM_FUNC_DECL value_type swizzle(comp X) const;
174  GLM_FUNC_DECL tvec2<T> swizzle(comp X, comp Y) const;
175  GLM_FUNC_DECL tvec3<T> swizzle(comp X, comp Y, comp Z) const;
176  GLM_FUNC_DECL tvec4<T> swizzle(comp X, comp Y, comp Z, comp W) const;
177  GLM_FUNC_DECL tref1<T> swizzle(comp X);
178  };
179 
180  template <typename T>
181  struct tref1
182  {
183  GLM_FUNC_DECL tref1(T & x);
184  GLM_FUNC_DECL tref1(tref1<T> const & r);
185  GLM_FUNC_DECL tref1(tvec1<T> const & v);
186 
187  GLM_FUNC_DECL tref1<T> & operator= (tref1<T> const & r);
188  GLM_FUNC_DECL tref1<T> & operator= (tvec1<T> const & v);
189 
190  T& x;
191  };
192 
193  GLM_DETAIL_IS_VECTOR(tvec1);
194 
204 
205 }//namespace detail
206 }//namespace glm
207 
208 #ifndef GLM_EXTERNAL_TEMPLATE
209 #include "type_vec1.inl"
210 #endif//GLM_EXTERNAL_TEMPLATE
211 
212 #endif//glm_core_type_gentype1
OpenGL Mathematics (glm.g-truc.net)
Definition: _swizzle.hpp:204
Definition: _detail.hpp:38
Definition: type_mat2x2.hpp:38
Definition: type_vec1.hpp:41
OpenGL Mathematics (glm.g-truc.net)
Definition: type_vec1.hpp:42
Definition: type_mat2x2.hpp:39
OpenGL Mathematics (glm.g-truc.net)
OpenGL Mathematics (glm.g-truc.net)
OpenGL Mathematics (glm.g-truc.net)
OpenGL Mathematics (glm.g-truc.net)
Definition: _detail.hpp:325
Definition: type_mat2x2.hpp:40
Definition: type_vec1.hpp:43
Definition: type_mat2x2.hpp:37
Definition: type_vec1.hpp:44