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"
16 template<
typename T, qualifier Q>
22 typedef vec<1, T, Q> type;
23 typedef vec<1, bool, Q> bool_type;
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
41 # if GLM_CONFIG_XYZW_ONLY
43 # elif GLM_CONFIG_ANONYMOUS_STRUCT == GLM_ENABLE
50 typename detail::storage<1, T, detail::is_aligned<Q>::value>::type data;
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
87 typedef length_t length_type;
88 GLM_FUNC_DECL
static GLM_CONSTEXPR length_type
length(){
return 1;}
90 GLM_FUNC_DECL GLM_CONSTEXPR T & operator[](length_type i);
91 GLM_FUNC_DECL GLM_CONSTEXPR T
const& operator[](length_type i)
const;
95 GLM_FUNC_DECL GLM_CONSTEXPR vec() GLM_DEFAULT;
96 GLM_FUNC_DECL GLM_CONSTEXPR vec(vec const& v) GLM_DEFAULT;
98 GLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, T, P> const& v);
102 GLM_FUNC_DECL GLM_CONSTEXPR explicit vec(T scalar);
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);
117 template<typename U, qualifier P>
118 GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT vec(vec<1, U, P> const& v);
132 GLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator=(vec const& v) GLM_DEFAULT;
135 GLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator=(vec<1, U, Q> const& v);
137 GLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator+=(U scalar);
139 GLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator+=(vec<1, U, Q> const& v);
141 GLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator-=(U scalar);
143 GLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator-=(vec<1, U, Q> const& v);
145 GLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator*=(U scalar);
147 GLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator*=(vec<1, U, Q> const& v);
149 GLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator/=(U scalar);
151 GLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator/=(vec<1, U, Q> const& v);
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);
163 GLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator%=(U scalar);
165 GLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator%=(vec<1, U, Q> const& v);
167 GLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator&=(U scalar);
169 GLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator&=(vec<1, U, Q> const& v);
171 GLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator|=(U scalar);
173 GLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator|=(vec<1, U, Q> const& v);
175 GLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator^=(U scalar);
177 GLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator^=(vec<1, U, Q> const& v);
179 GLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator<<=(U scalar);
181 GLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator<<=(vec<1, U, Q> const& v);
183 GLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator>>=(U scalar);
185 GLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator>>=(vec<1, U, Q> const& v);
190 template<typename T, qualifier Q>
191 GLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator+(vec<1, T, Q> const& v);
193 template<typename T, qualifier Q>
194 GLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator-(vec<1, T, Q> const& v);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
288 template<typename T, qualifier Q>
289 GLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator~(vec<1, T, Q> const& v);
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);
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);
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);
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);
306 #ifndef GLM_EXTERNAL_TEMPLATE
307 #include "type_vec1.inl"
308 #endif//GLM_EXTERNAL_TEMPLATE
GLM_FUNC_DECL T length(qua< T, Q > const &q)
Returns the norm of a quaternions.