0.9.9 API documenation: type_vec1.hpp Source File

| 0.9.9 API documenation

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