| 0.9.9 API documentation

- Main Page
- Modules
- Files

- File List

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