0.9.9 API documenation

- Main Page
- Modules
- Files

- File List

type_vec1.hpp
Go to the documentation of this file.
1
4 #pragma once
5
6 #include "../fwd.hpp"
7 #include "type_vec.hpp"
8 #if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
9 # if GLM_HAS_UNRESTRICTED_UNIONS
10 # include "_swizzle.hpp"
11 # else
12 # include "_swizzle_func.hpp"
13 # endif
14 #endif //GLM_SWIZZLE
15 #include <cstddef>
16
17 namespace glm
18 {
19 template<typename T, qualifier Q>
20 struct vec<1, T, Q>
21 {
22 // -- Implementation detail --
23
24 typedef T value_type;
25 typedef vec type;
26 typedef vec<1, bool, Q> bool_type;
27
28 // -- Data --
29
30 # if GLM_HAS_ONLY_XYZW
31 T x;
32
33 # elif GLM_HAS_ALIGNED_TYPE
34 # if GLM_COMPILER & GLM_COMPILER_GCC
35 # pragma GCC diagnostic push
36 # pragma GCC diagnostic ignored "-Wpedantic"
37 # endif
38 # if GLM_COMPILER & GLM_COMPILER_CLANG
39 # pragma clang diagnostic push
40 # pragma clang diagnostic ignored "-Wgnu-anonymous-struct"
41 # pragma clang diagnostic ignored "-Wnested-anon-types"
42 # endif
43
44 union
45 {
46 T x;
47 T r;
48 T s;
49 /*
50 # if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
51 _GLM_SWIZZLE1_2_MEMBERS(T, Q, tvec2, x)
52 _GLM_SWIZZLE1_2_MEMBERS(T, Q, tvec2, r)
53 _GLM_SWIZZLE1_2_MEMBERS(T, Q, tvec2, s)
54 _GLM_SWIZZLE1_3_MEMBERS(T, Q, tvec3, x)
55 _GLM_SWIZZLE1_3_MEMBERS(T, Q, tvec3, r)
56 _GLM_SWIZZLE1_3_MEMBERS(T, Q, tvec3, s)
57 _GLM_SWIZZLE1_4_MEMBERS(T, Q, tvec4, x)
58 _GLM_SWIZZLE1_4_MEMBERS(T, Q, tvec4, r)
59 _GLM_SWIZZLE1_4_MEMBERS(T, Q, tvec4, s)
60 # endif//GLM_SWIZZLE*/
61 };
62
63 # if GLM_COMPILER & GLM_COMPILER_CLANG
64 # pragma clang diagnostic pop
65 # endif
66 # if GLM_COMPILER & GLM_COMPILER_GCC
67 # pragma GCC diagnostic pop
68 # endif
69 # else
70 union {T x, r, s;};
71 /*
72 # if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
73 GLM_SWIZZLE_GEN_VEC_FROM_VEC1(T, P, tvec2, tvec2, tvec3, tvec4)
74 # endif//GLM_SWIZZLE*/
75 # endif
76
77 // -- Component accesses --
78
80 typedef length_t length_type;
81 GLM_FUNC_DECL static GLM_CONSTEXPR length_type length(){return 1;}
82
83 GLM_FUNC_DECL T & operator[](length_type i);
84 GLM_FUNC_DECL T const& operator[](length_type i) const;
85
86 // -- Implicit basic constructors --
87
88 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec() GLM_DEFAULT;
89 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec const& v) GLM_DEFAULT;
90 template<qualifier P>
91 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec<1, T, P> const& v);
92
93 // -- Explicit basic constructors --
94
95 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit vec(T scalar);
96
97 // -- Conversion vector constructors --
98
100 template<typename U, qualifier P>
101 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR GLM_EXPLICIT vec(vec<2, U, P> const& v);
103 template<typename U, qualifier P>
104 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR GLM_EXPLICIT vec(vec<3, U, P> const& v);
106 template<typename U, qualifier P>
107 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR GLM_EXPLICIT vec(vec<4, U, P> const& v);
108
110 template<typename U, qualifier P>
111 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR GLM_EXPLICIT vec(vec<1, U, P> const& v);
112
113 // -- Swizzle constructors --
114 /*
115 # if(GLM_HAS_UNRESTRICTED_UNIONS && (GLM_SWIZZLE == GLM_SWIZZLE_ENABLED))
116 template<int E0>
117 GLM_FUNC_DECL tvec(detail::_swizzle<1, T, Q, tvec1, E0, -1,-2,-3> const& that)
118 {
119 *this = that();
120 }
121 # endif//(GLM_HAS_UNRESTRICTED_UNIONS && (GLM_SWIZZLE == GLM_SWIZZLE_ENABLED))
122 */
123 // -- Unary arithmetic operators --
124
125 GLM_FUNC_DECL vec & operator=(vec const& v) GLM_DEFAULT;
126
127 template<typename U>
128 GLM_FUNC_DECL vec & operator=(vec<1, U, Q> const& v);
129 template<typename U>
130 GLM_FUNC_DECL vec & operator+=(U scalar);
131 template<typename U>
132 GLM_FUNC_DECL vec & operator+=(vec<1, U, Q> const& v);
133 template<typename U>
134 GLM_FUNC_DECL vec & operator-=(U scalar);
135 template<typename U>
136 GLM_FUNC_DECL vec & operator-=(vec<1, U, Q> const& v);
137 template<typename U>
138 GLM_FUNC_DECL vec & operator*=(U scalar);
139 template<typename U>
140 GLM_FUNC_DECL vec & operator*=(vec<1, U, Q> const& v);
141 template<typename U>
142 GLM_FUNC_DECL vec & operator/=(U scalar);
143 template<typename U>
144 GLM_FUNC_DECL vec & operator/=(vec<1, U, Q> const& v);
145
146 // -- Increment and decrement operators --
147
148 GLM_FUNC_DECL vec & operator++();
149 GLM_FUNC_DECL vec & operator--();
150 GLM_FUNC_DECL vec operator++(int);
151 GLM_FUNC_DECL vec operator--(int);
152
153 // -- Unary bit operators --
154
155 template<typename U>
156 GLM_FUNC_DECL vec & operator%=(U scalar);
157 template<typename U>
158 GLM_FUNC_DECL vec & operator%=(vec<1, U, Q> const& v);
159 template<typename U>
160 GLM_FUNC_DECL vec & operator&=(U scalar);
161 template<typename U>
162 GLM_FUNC_DECL vec & operator&=(vec<1, U, Q> const& v);
163 template<typename U>
164 GLM_FUNC_DECL vec & operator|=(U scalar);
165 template<typename U>
166 GLM_FUNC_DECL vec & operator|=(vec<1, U, Q> const& v);
167 template<typename U>
168 GLM_FUNC_DECL vec & operator^=(U scalar);
169 template<typename U>
170 GLM_FUNC_DECL vec & operator^=(vec<1, U, Q> const& v);
171 template<typename U>
172 GLM_FUNC_DECL vec & operator<<=(U scalar);
173 template<typename U>
174 GLM_FUNC_DECL vec & operator<<=(vec<1, U, Q> const& v);
175 template<typename U>
176 GLM_FUNC_DECL vec & operator>>=(U scalar);
177 template<typename U>
178 GLM_FUNC_DECL vec & operator>>=(vec<1, U, Q> const& v);
179 };
180
181 // -- Unary operators --
182
183 template<typename T, qualifier Q>
184 GLM_FUNC_DECL vec<1, T, Q> operator+(vec<1, T, Q> const& v);
185
186 template<typename T, qualifier Q>
187 GLM_FUNC_DECL vec<1, T, Q> operator-(vec<1, T, Q> const& v);
188
189 // -- Binary operators --
190
191 template<typename T, qualifier Q>
192 GLM_FUNC_DECL vec<1, T, Q> operator+(vec<1, T, Q> const& v, T scalar);
193
194 template<typename T, qualifier Q>
195 GLM_FUNC_DECL vec<1, T, Q> operator+(T scalar, vec<1, T, Q> const& v);
196
197 template<typename T, qualifier Q>
198 GLM_FUNC_DECL vec<1, T, Q> operator+(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2);
199
200 template<typename T, qualifier Q>
201 GLM_FUNC_DECL vec<1, T, Q> operator-(vec<1, T, Q> const& v, T scalar);
202
203 template<typename T, qualifier Q>
204 GLM_FUNC_DECL vec<1, T, Q> operator-(T scalar, vec<1, T, Q> const& v);
205
206 template<typename T, qualifier Q>
207 GLM_FUNC_DECL vec<1, T, Q> operator-(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2);
208
209 template<typename T, qualifier Q>
210 GLM_FUNC_DECL vec<1, T, Q> operator*(vec<1, T, Q> const& v, T scalar);
211
212 template<typename T, qualifier Q>
213 GLM_FUNC_DECL vec<1, T, Q> operator*(T scalar, vec<1, T, Q> const& v);
214
215 template<typename T, qualifier Q>
216 GLM_FUNC_DECL vec<1, T, Q> operator*(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2);
217
218 template<typename T, qualifier Q>
219 GLM_FUNC_DECL vec<1, T, Q> operator/(vec<1, T, Q> const& v, T scalar);
220
221 template<typename T, qualifier Q>
222 GLM_FUNC_DECL vec<1, T, Q> operator/(T scalar, vec<1, T, Q> const& v);
223
224 template<typename T, qualifier Q>
225 GLM_FUNC_DECL vec<1, T, Q> operator/(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2);
226
227 template<typename T, qualifier Q>
228 GLM_FUNC_DECL vec<1, T, Q> operator%(vec<1, T, Q> const& v, T scalar);
229
230 template<typename T, qualifier Q>
231 GLM_FUNC_DECL vec<1, T, Q> operator%(T scalar, vec<1, T, Q> const& v);
232
233 template<typename T, qualifier Q>
234 GLM_FUNC_DECL vec<1, T, Q> operator%(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2);
235
236 template<typename T, qualifier Q>
237 GLM_FUNC_DECL vec<1, T, Q> operator&(vec<1, T, Q> const& v, T scalar);
238
239 template<typename T, qualifier Q>
240 GLM_FUNC_DECL vec<1, T, Q> operator&(T scalar, vec<1, T, Q> const& v);
241
242 template<typename T, qualifier Q>
243 GLM_FUNC_DECL vec<1, T, Q> operator&(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2);
244
245 template<typename T, qualifier Q>
246 GLM_FUNC_DECL vec<1, T, Q> operator|(vec<1, T, Q> const& v, T scalar);
247
248 template<typename T, qualifier Q>
249 GLM_FUNC_DECL vec<1, T, Q> operator|(T scalar, vec<1, T, Q> const& v);
250
251 template<typename T, qualifier Q>
252 GLM_FUNC_DECL vec<1, T, Q> operator|(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2);
253
254 template<typename T, qualifier Q>
255 GLM_FUNC_DECL vec<1, T, Q> operator^(vec<1, T, Q> const& v, T scalar);
256
257 template<typename T, qualifier Q>
258 GLM_FUNC_DECL vec<1, T, Q> operator^(T scalar, vec<1, T, Q> const& v);
259
260 template<typename T, qualifier Q>
261 GLM_FUNC_DECL vec<1, T, Q> operator^(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2);
262
263 template<typename T, qualifier Q>
264 GLM_FUNC_DECL vec<1, T, Q> operator<<(vec<1, T, Q> const& v, T scalar);
265
266 template<typename T, qualifier Q>
267 GLM_FUNC_DECL vec<1, T, Q> operator<<(T scalar, vec<1, T, Q> const& v);
268
269 template<typename T, qualifier Q>
270 GLM_FUNC_DECL vec<1, T, Q> operator<<(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2);
271
272 template<typename T, qualifier Q>
273 GLM_FUNC_DECL vec<1, T, Q> operator>>(vec<1, T, Q> const& v, T scalar);
274
275 template<typename T, qualifier Q>
276 GLM_FUNC_DECL vec<1, T, Q> operator>>(T scalar, vec<1, T, Q> const& v);
277
278 template<typename T, qualifier Q>
279 GLM_FUNC_DECL vec<1, T, Q> operator>>(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2);
280
281 template<typename T, qualifier Q>
282 GLM_FUNC_DECL vec<1, T, Q> operator~(vec<1, T, Q> const& v);
283
284 // -- Boolean operators --
285
286 template<typename T, qualifier Q>
287 GLM_FUNC_DECL bool operator==(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2);
288
289 template<typename T, qualifier Q>
290 GLM_FUNC_DECL bool operator!=(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2);
291
292 template<qualifier Q>
293 GLM_FUNC_DECL vec<1, bool, Q> operator&&(vec<1, bool, Q> const& v1, vec<1, bool, Q> const& v2);
294
295 template<qualifier Q>
296 GLM_FUNC_DECL vec<1, bool, Q> operator||(vec<1, bool, Q> const& v1, vec<1, bool, Q> const& v2);
297 }//namespace glm
298
299 #ifndef GLM_EXTERNAL_TEMPLATE
300 #include "type_vec1.inl"
301 #endif//GLM_EXTERNAL_TEMPLATE
glm
Definition: common.hpp:20
glm::length
GLM_FUNC_DECL T length(vec< L, T, Q > const &x)
Returns the length of x, i.e., sqrt(x * x).
_swizzle_func.hpp
Core features
type_vec.hpp
Core features
_swizzle.hpp
Core features