Flow Visualisation
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  typedef tvec1<T> type;
59 
60  GLM_FUNC_DECL GLM_CONSTEXPR size_type length() const;
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 
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 
120  template <typename U>
122 
123  template <typename U>
124  GLM_FUNC_DECL tvec1<T> & operator+=(U const & s);
125  template <typename U>
127  template <typename U>
128  GLM_FUNC_DECL tvec1<T> & operator-=(U const & s);
129  template <typename U>
131  template <typename U>
132  GLM_FUNC_DECL tvec1<T> & operator*=(U const & s);
133  template <typename U>
135  template <typename U>
136  GLM_FUNC_DECL tvec1<T> & operator/=(U const & s);
137  template <typename U>
141 
143  // Unary bit operators
144 
145  template <typename U>
146  GLM_FUNC_DECL tvec1<T> & operator%=(U const & s);
147  template <typename U>
149  template <typename U>
150  GLM_FUNC_DECL tvec1<T> & operator&=(U const & s);
151  template <typename U>
153  template <typename U>
154  GLM_FUNC_DECL tvec1<T> & operator|=(U const & s);
155  template <typename U>
157  template <typename U>
158  GLM_FUNC_DECL tvec1<T> & operator^=(U const & s);
159  template <typename U>
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>
169 
171  // Swizzle operators
172 
173  GLM_FUNC_DECL value_type swizzle(comp X) const;
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 
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
GLM_FUNC_DECL value_type swizzle(comp X) const
Definition: type_vec1.inl:437
detail::tvec1< highp_int > highp_ivec1_t
Definition: type_vec1.hpp:198
T value_type
Definition: type_vec1.hpp:55
GLM_FUNC_DECL tref1< T > & operator=(tref1< T > const &r)
Definition: type_vec1.inl:909
GLM_FUNC_DECL value_type & operator[](size_type i)
Definition: type_vec1.inl:43
Definition: type_vec1.hpp:53
GLM_FUNC_DECL tvec1< T > & operator*=(U const &s)
GLM_FUNC_DECL tvec1< T > & operator|=(U const &s)
GLM_FUNC_DECL tvec1< T > & operator/=(U const &s)
#define GLM_CONSTEXPR
Definition: _detail.hpp:479
GLM_FUNC_DECL tvec1()
Definition: type_vec1.inl:65
Definition: _detail.hpp:38
Definition: type_mat2x2.hpp:38
T & x
Definition: type_vec1.hpp:190
Definition: type_vec1.hpp:41
detail::tvec1< highp_float > highp_vec1_t
Definition: type_vec1.hpp:195
ctor
Definition: type_vec1.hpp:53
GLM_FUNC_DECL tvec1< T > & operator<<=(U const &s)
GLM_FUNC_DECL tvec1< T > & operator-=(U const &s)
Definition: _swizzle.hpp:43
GLM_FUNC_DECL tvec1< T > & operator--()
Definition: type_vec1.inl:268
tvec1< T > type
Definition: type_vec1.hpp:57
GLM_FUNC_DECL tref1(T &x)
Definition: type_vec1.inl:885
detail::tvec1< highp_uint > highp_uvec1_t
Definition: type_vec1.hpp:201
Definition: type_vec1.hpp:42
detail::tvec1< mediump_float > mediump_vec1_t
Definition: type_vec1.hpp:196
detail::tvec1< lowp_uint > lowp_uvec1_t
Definition: type_vec1.hpp:203
std::size_t size_type
Definition: type_vec1.hpp:56
GLM_FUNC_DECL tvec1< T > & operator>>=(U const &s)
Definition: type_mat2x2.hpp:39
value_type x
Definition: type_vec1.hpp:66
Definition: _swizzle.hpp:44
detail::tvec1< mediump_uint > mediump_uvec1_t
Definition: type_vec1.hpp:202
GLM_FUNC_DECL tvec1< T > & operator&=(U const &s)
GLM_FUNC_DECL tvec1< T > & operator^=(U const &s)
GLM_FUNC_DECL tvec1< T > & operator++()
Definition: type_vec1.inl:261
GLM_FUNC_DECL GLM_CONSTEXPR size_type length() const
Definition: type_vec1.inl:33
Definition: type_mat2x2.hpp:40
Definition: type_vec1.hpp:43
detail::tvec1< mediump_int > mediump_ivec1_t
Definition: type_vec1.hpp:199
Definition: _swizzle.hpp:47
tvec1< bool > bool_type
Definition: type_vec1.hpp:58
GLM_FUNC_DECL tvec1< T > & operator+=(U const &s)
detail::tvec1< lowp_int > lowp_ivec1_t
Definition: type_vec1.hpp:200
GLM_DETAIL_IS_VECTOR(tvec1)
comp
Definition: _swizzle.hpp:36
#define GLM_FUNC_DECL
Definition: setup.hpp:678
GLM_FUNC_DECL tvec1< T > & operator%=(U const &s)
Definition: _swizzle.hpp:38
GLM_FUNC_DECL tvec1< T > & operator=(tvec1< T > const &v)
Definition: type_vec1.inl:153
Definition: _swizzle.hpp:41
detail::tvec1< lowp_float > lowp_vec1_t
Definition: type_vec1.hpp:197
Definition: type_mat2x2.hpp:37
Definition: type_vec1.hpp:44