16 #include "../detail/type_vec.hpp"
17 #if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
18 # if GLM_HAS_UNRESTRICTED_UNIONS
19 # include "../detail/_swizzle.hpp"
21 # include "../detail/_swizzle_func.hpp"
26 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED)
27 # pragma message("GLM: GLM_EXT_vec1 extension included")
35 template<
typename T, qualifier Q>
42 typedef vec<1, bool, Q> bool_type;
46 # if GLM_HAS_ONLY_XYZW
49 # elif GLM_HAS_ALIGNED_TYPE
50 # if GLM_COMPILER & GLM_COMPILER_GCC
51 # pragma GCC diagnostic push
52 # pragma GCC diagnostic ignored "-Wpedantic"
54 # if GLM_COMPILER & GLM_COMPILER_CLANG
55 # pragma clang diagnostic push
56 # pragma clang diagnostic ignored "-Wgnu-anonymous-struct"
57 # pragma clang diagnostic ignored "-Wnested-anon-types"
79 # if GLM_COMPILER & GLM_COMPILER_CLANG
80 # pragma clang diagnostic pop
82 # if GLM_COMPILER & GLM_COMPILER_GCC
83 # pragma GCC diagnostic pop
96 typedef length_t length_type;
97 GLM_FUNC_DECL
static GLM_CONSTEXPR length_type
length(){
return 1;}
99 GLM_FUNC_DECL T & operator[](length_type i);
100 GLM_FUNC_DECL T
const& operator[](length_type i)
const;
104 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec() GLM_DEFAULT_CTOR;
105 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec const& v) GLM_DEFAULT;
106 template<qualifier P>
107 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec<1, T, P> const& v);
111 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit vec(T scalar);
116 template<typename U, qualifier P>
117 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR GLM_EXPLICIT vec(vec<2, U, P> const& v);
119 template<typename U, qualifier P>
120 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR GLM_EXPLICIT vec(vec<3, U, P> const& v);
122 template<typename U, qualifier P>
123 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR GLM_EXPLICIT vec(vec<4, U, P> const& v);
126 template<typename U, qualifier P>
127 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR GLM_EXPLICIT vec(vec<1, U, P> const& v);
141 GLM_FUNC_DECL GLM_CONSTEXPR_CXX14 vec & operator=(vec const& v) GLM_DEFAULT;
144 GLM_FUNC_DECL GLM_CONSTEXPR_CXX14 vec & operator=(vec<1, U, Q> const& v);
146 GLM_FUNC_DECL vec & operator+=(U scalar);
148 GLM_FUNC_DECL vec & operator+=(vec<1, U, Q> const& v);
150 GLM_FUNC_DECL vec & operator-=(U scalar);
152 GLM_FUNC_DECL vec & operator-=(vec<1, U, Q> const& v);
154 GLM_FUNC_DECL vec & operator*=(U scalar);
156 GLM_FUNC_DECL vec & operator*=(vec<1, U, Q> const& v);
158 GLM_FUNC_DECL vec & operator/=(U scalar);
160 GLM_FUNC_DECL vec & operator/=(vec<1, U, Q> const& v);
164 GLM_FUNC_DECL vec & operator++();
165 GLM_FUNC_DECL vec & operator--();
166 GLM_FUNC_DECL vec operator++(
int);
167 GLM_FUNC_DECL vec operator--(
int);
172 GLM_FUNC_DECL vec & operator%=(U scalar);
174 GLM_FUNC_DECL vec & operator%=(vec<1, U, Q> const& v);
176 GLM_FUNC_DECL vec & operator&=(U scalar);
178 GLM_FUNC_DECL vec & operator&=(vec<1, U, Q> const& v);
180 GLM_FUNC_DECL vec & operator|=(U scalar);
182 GLM_FUNC_DECL vec & operator|=(vec<1, U, Q> const& v);
184 GLM_FUNC_DECL vec & operator^=(U scalar);
186 GLM_FUNC_DECL vec & operator^=(vec<1, U, Q> const& v);
188 GLM_FUNC_DECL vec & operator<<=(U scalar);
190 GLM_FUNC_DECL vec & operator<<=(vec<1, U, Q> const& v);
192 GLM_FUNC_DECL vec & operator>>=(U scalar);
194 GLM_FUNC_DECL vec & operator>>=(vec<1, U, Q> const& v);
199 template<typename T, qualifier Q>
200 GLM_FUNC_DECL vec<1, T, Q> operator+(vec<1, T, Q> const& v);
202 template<typename T, qualifier Q>
203 GLM_FUNC_DECL vec<1, T, Q> operator-(vec<1, T, Q> const& v);
207 template<typename T, qualifier Q>
208 GLM_FUNC_DECL vec<1, T, Q> operator+(vec<1, T, Q> const& v, T scalar);
210 template<typename T, qualifier Q>
211 GLM_FUNC_DECL vec<1, T, Q> operator+(T scalar, vec<1, T, Q> const& v);
213 template<typename T, qualifier Q>
214 GLM_FUNC_DECL 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 vec<1, T, Q> operator-(vec<1, T, Q> const& v, T scalar);
219 template<typename T, qualifier Q>
220 GLM_FUNC_DECL vec<1, T, Q> operator-(T scalar, vec<1, T, Q> const& v);
222 template<typename T, qualifier Q>
223 GLM_FUNC_DECL 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 vec<1, T, Q> operator*(vec<1, T, Q> const& v, T scalar);
228 template<typename T, qualifier Q>
229 GLM_FUNC_DECL vec<1, T, Q> operator*(T scalar, vec<1, T, Q> const& v);
231 template<typename T, qualifier Q>
232 GLM_FUNC_DECL 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 vec<1, T, Q> operator/(vec<1, T, Q> const& v, T scalar);
237 template<typename T, qualifier Q>
238 GLM_FUNC_DECL vec<1, T, Q> operator/(T scalar, vec<1, T, Q> const& v);
240 template<typename T, qualifier Q>
241 GLM_FUNC_DECL 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 vec<1, T, Q> operator%(vec<1, T, Q> const& v, T scalar);
246 template<typename T, qualifier Q>
247 GLM_FUNC_DECL vec<1, T, Q> operator%(T scalar, vec<1, T, Q> const& v);
249 template<typename T, qualifier Q>
250 GLM_FUNC_DECL 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 vec<1, T, Q> operator&(vec<1, T, Q> const& v, T scalar);
255 template<typename T, qualifier Q>
256 GLM_FUNC_DECL vec<1, T, Q> operator&(T scalar, vec<1, T, Q> const& v);
258 template<typename T, qualifier Q>
259 GLM_FUNC_DECL 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 vec<1, T, Q> operator|(vec<1, T, Q> const& v, T scalar);
264 template<typename T, qualifier Q>
265 GLM_FUNC_DECL vec<1, T, Q> operator|(T scalar, vec<1, T, Q> const& v);
267 template<typename T, qualifier Q>
268 GLM_FUNC_DECL 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 vec<1, T, Q> operator^(vec<1, T, Q> const& v, T scalar);
273 template<typename T, qualifier Q>
274 GLM_FUNC_DECL vec<1, T, Q> operator^(T scalar, vec<1, T, Q> const& v);
276 template<typename T, qualifier Q>
277 GLM_FUNC_DECL 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 vec<1, T, Q> operator<<(vec<1, T, Q> const& v, T scalar);
282 template<typename T, qualifier Q>
283 GLM_FUNC_DECL vec<1, T, Q> operator<<(T scalar, vec<1, T, Q> const& v);
285 template<typename T, qualifier Q>
286 GLM_FUNC_DECL 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 vec<1, T, Q> operator>>(vec<1, T, Q> const& v, T scalar);
291 template<typename T, qualifier Q>
292 GLM_FUNC_DECL vec<1, T, Q> operator>>(T scalar, vec<1, T, Q> const& v);
294 template<typename T, qualifier Q>
295 GLM_FUNC_DECL vec<1, T, Q> operator>>(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2);
297 template<typename T, qualifier Q>
298 GLM_FUNC_DECL vec<1, T, Q> operator~(vec<1, T, Q> const& v);
302 template<typename T, qualifier Q>
303 GLM_FUNC_DECL
bool operator==(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2);
305 template<typename T, qualifier Q>
306 GLM_FUNC_DECL
bool operator!=(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2);
308 template<qualifier Q>
309 GLM_FUNC_DECL vec<1,
bool, Q> operator&&(vec<1,
bool, Q> const& v1, vec<1,
bool, Q> const& v2);
311 template<qualifier Q>
312 GLM_FUNC_DECL vec<1,
bool, Q> operator||(vec<1,
bool, Q> const& v1, vec<1,
bool, Q> const& v2);
389 #if GLM_HAS_TEMPLATE_ALIASES
390 template <
typename T, qualifier Q = defaultp>
using tvec1 = vec<1, T, Q>;
391 #endif//GLM_HAS_TEMPLATE_ALIASES
396 #if(defined(GLM_PRECISION_HIGHP_BOOL))
397 typedef highp_bvec1
bvec1;
398 #elif(defined(GLM_PRECISION_MEDIUMP_BOOL))
399 typedef mediump_bvec1
bvec1;
400 #elif(defined(GLM_PRECISION_LOWP_BOOL))
401 typedef lowp_bvec1
bvec1;
403 typedef highp_bvec1
bvec1;
406 #endif//GLM_PRECISION
408 #if(defined(GLM_PRECISION_HIGHP_FLOAT))
409 typedef highp_vec1
vec1;
410 #elif(defined(GLM_PRECISION_MEDIUMP_FLOAT))
411 typedef mediump_vec1
vec1;
412 #elif(defined(GLM_PRECISION_LOWP_FLOAT))
413 typedef lowp_vec1
vec1;
415 typedef highp_vec1
vec1;
418 #endif//GLM_PRECISION
420 #if(defined(GLM_PRECISION_HIGHP_DOUBLE))
421 typedef highp_dvec1
dvec1;
422 #elif(defined(GLM_PRECISION_MEDIUMP_DOUBLE))
423 typedef mediump_dvec1
dvec1;
424 #elif(defined(GLM_PRECISION_LOWP_DOUBLE))
425 typedef lowp_dvec1
dvec1;
427 typedef highp_dvec1
dvec1;
430 #endif//GLM_PRECISION
432 #if(defined(GLM_PRECISION_HIGHP_INT))
433 typedef highp_ivec1
ivec1;
434 #elif(defined(GLM_PRECISION_MEDIUMP_INT))
435 typedef mediump_ivec1
ivec1;
436 #elif(defined(GLM_PRECISION_LOWP_INT))
437 typedef lowp_ivec1
ivec1;
439 typedef highp_ivec1
ivec1;
442 #endif//GLM_PRECISION
444 #if(defined(GLM_PRECISION_HIGHP_UINT))
445 typedef highp_uvec1
uvec1;
446 #elif(defined(GLM_PRECISION_MEDIUMP_UINT))
447 typedef mediump_uvec1
uvec1;
448 #elif(defined(GLM_PRECISION_LOWP_UINT))
449 typedef lowp_uvec1
uvec1;
451 typedef highp_uvec1
uvec1;
454 #endif//GLM_PRECISION
459 #ifndef GLM_EXTERNAL_TEMPLATE
460 #include "../detail/type_vec1.inl"
461 #endif//GLM_EXTERNAL_TEMPLATE
vec< 1, double, mediump > mediump_dvec1
1 component vector of double-precision floating-point numbers using medium precision arithmetic in te...
vec< 1, uint, lowp > lowp_uvec1
1 component vector of unsigned integer numbers.
vec< 1, int, highp > highp_ivec1
1 component vector of signed integer numbers.
vec< 1, int, mediump > mediump_ivec1
1 component vector of signed integer numbers.
vec< 1, bool, lowp > lowp_bvec1
1 component vector of bool values.
highp_uvec1 uvec1
1 component vector of unsigned integer numbers.
vec< 1, int, lowp > lowp_ivec1
1 component vector of signed integer numbers.
vec< 1, bool, mediump > mediump_bvec1
1 component vector of bool values.
vec< 1, uint, highp > highp_uvec1
1 component vector of unsigned integer numbers.
highp_dvec1 dvec1
1 component vector of floating-point numbers.
vec< 1, double, lowp > lowp_dvec1
1 component vector of double-precision floating-point numbers using low precision arithmetic in term ...
vec< 1, double, highp > highp_dvec1
1 component vector of double-precision floating-point numbers using high precision arithmetic in term...
vec< 1, float, mediump > mediump_vec1
1 component vector of single-precision floating-point numbers using medium precision arithmetic in te...
highp_ivec1 ivec1
1 component vector of signed integer numbers.
highp_bvec1 bvec1
1 component vector of boolean.
vec< 1, bool, highp > highp_bvec1
1 component vector of bool values.
GLM_FUNC_DECL T length(vec< L, T, Q > const &x)
Returns the length of x, i.e., sqrt(x * x).
unsigned int uint
Unsigned integer type.
highp_vec1 vec1
1 component vector of floating-point numbers.
vec< 1, uint, mediump > mediump_uvec1
1 component vector of unsigned integer numbers.
vec< 1, float, lowp > lowp_vec1
1 component vector of single-precision floating-point numbers using low precision arithmetic in term ...
vec< 1, float, highp > highp_vec1
1 component vector of single-precision floating-point numbers using high precision arithmetic in term...