00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #pragma once
00030
00031
00032 #include "type_vec.hpp"
00033 #ifdef GLM_SWIZZLE
00034 # if GLM_HAS_ANONYMOUS_UNION
00035 # include "_swizzle.hpp"
00036 # else
00037 # include "_swizzle_func.hpp"
00038 # endif
00039 #endif //GLM_SWIZZLE
00040 #include <cstddef>
00041
00042 namespace glm{
00043 namespace detail
00044 {
00045 template <typename T, precision P>
00046 struct tvec2
00047 {
00049
00050
00051 enum ctor{_null};
00052
00053 typedef tvec2<T, P> type;
00054 typedef tvec2<bool, P> bool_type;
00055 typedef T value_type;
00056 typedef int size_type;
00057
00059
00060
00061 GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
00062
00064
00065
00066 # if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
00067 union
00068 {
00069 struct{ T x, y; };
00070 struct{ T r, g; };
00071 struct{ T s, t; };
00072
00073 _GLM_SWIZZLE2_2_MEMBERS(T, P, tvec2, x, y)
00074 _GLM_SWIZZLE2_2_MEMBERS(T, P, tvec2, r, g)
00075 _GLM_SWIZZLE2_2_MEMBERS(T, P, tvec2, s, t)
00076 _GLM_SWIZZLE2_3_MEMBERS(T, P, tvec3, x, y)
00077 _GLM_SWIZZLE2_3_MEMBERS(T, P, tvec3, r, g)
00078 _GLM_SWIZZLE2_3_MEMBERS(T, P, tvec3, s, t)
00079 _GLM_SWIZZLE2_4_MEMBERS(T, P, tvec4, x, y)
00080 _GLM_SWIZZLE2_4_MEMBERS(T, P, tvec4, r, g)
00081 _GLM_SWIZZLE2_4_MEMBERS(T, P, tvec4, s, t)
00082 };
00083 # else
00084 union {T x, r, s;};
00085 union {T y, g, t;};
00086
00087 # ifdef GLM_SWIZZLE
00088 GLM_SWIZZLE_GEN_VEC_FROM_VEC2(T, P, detail::tvec2, detail::tvec2, detail::tvec3, detail::tvec4)
00089 # endif
00090 # endif
00091
00093
00094
00095 GLM_FUNC_DECL T & operator[](length_t i);
00096 GLM_FUNC_DECL T const & operator[](length_t i) const;
00097
00099
00100
00101 GLM_FUNC_DECL tvec2();
00102 GLM_FUNC_DECL tvec2(tvec2<T, P> const & v);
00103 template <precision Q>
00104 GLM_FUNC_DECL tvec2(tvec2<T, Q> const & v);
00105
00107
00108
00109 GLM_FUNC_DECL explicit tvec2(ctor);
00110 GLM_FUNC_DECL explicit tvec2(T const & s);
00111 GLM_FUNC_DECL tvec2(T const & s1, T const & s2);
00112
00114
00115
00116 # if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
00117 template <int E0, int E1>
00118 GLM_FUNC_DECL tvec2(_swizzle<2, T, P, tvec2<T, P>, E0, E1,-1,-2> const & that)
00119 {
00120 *this = that();
00121 }
00122 # endif//(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
00123
00125
00126
00128 template <typename U, typename V>
00129 GLM_FUNC_DECL tvec2(U const & x, V const & y);
00130 template <typename U, typename V>
00131 GLM_FUNC_DECL tvec2(tvec1<U, P> const & v1, tvec1<V, P> const & v2);
00132
00134
00135
00137 template <typename U, precision Q>
00138 GLM_FUNC_DECL tvec2(tvec2<U, Q> const & v);
00140 template <typename U, precision Q>
00141 GLM_FUNC_DECL explicit tvec2(tvec3<U, Q> const & v);
00143 template <typename U, precision Q>
00144 GLM_FUNC_DECL explicit tvec2(tvec4<U, Q> const & v);
00145
00147
00148
00149 GLM_FUNC_DECL tvec2<T, P> & operator= (tvec2<T, P> const & v);
00150
00151 template <typename U>
00152 GLM_FUNC_DECL tvec2<T, P> & operator= (tvec2<U, P> const & v);
00153 template <typename U>
00154 GLM_FUNC_DECL tvec2<T, P> & operator+=(U s);
00155 template <typename U>
00156 GLM_FUNC_DECL tvec2<T, P> & operator+=(tvec1<U, P> const & v);
00157 template <typename U>
00158 GLM_FUNC_DECL tvec2<T, P> & operator+=(tvec2<U, P> const & v);
00159 template <typename U>
00160 GLM_FUNC_DECL tvec2<T, P> & operator-=(U s);
00161 template <typename U>
00162 GLM_FUNC_DECL tvec2<T, P> & operator-=(tvec1<U, P> const & v);
00163 template <typename U>
00164 GLM_FUNC_DECL tvec2<T, P> & operator-=(tvec2<U, P> const & v);
00165 template <typename U>
00166 GLM_FUNC_DECL tvec2<T, P> & operator*=(U s);
00167 template <typename U>
00168 GLM_FUNC_DECL tvec2<T, P> & operator*=(tvec1<U, P> const & v);
00169 template <typename U>
00170 GLM_FUNC_DECL tvec2<T, P> & operator*=(tvec2<U, P> const & v);
00171 template <typename U>
00172 GLM_FUNC_DECL tvec2<T, P> & operator/=(U s);
00173 template <typename U>
00174 GLM_FUNC_DECL tvec2<T, P> & operator/=(tvec1<U, P> const & v);
00175 template <typename U>
00176 GLM_FUNC_DECL tvec2<T, P> & operator/=(tvec2<U, P> const & v);
00177
00179
00180
00181 GLM_FUNC_DECL tvec2<T, P> & operator++();
00182 GLM_FUNC_DECL tvec2<T, P> & operator--();
00183 GLM_FUNC_DECL tvec2<T, P> operator++(int);
00184 GLM_FUNC_DECL tvec2<T, P> operator--(int);
00185
00187
00188
00189 template <typename U>
00190 GLM_FUNC_DECL tvec2<T, P> & operator%= (U s);
00191 template <typename U>
00192 GLM_FUNC_DECL tvec2<T, P> & operator%= (tvec1<U, P> const & v);
00193 template <typename U>
00194 GLM_FUNC_DECL tvec2<T, P> & operator%= (tvec2<U, P> const & v);
00195 template <typename U>
00196 GLM_FUNC_DECL tvec2<T, P> & operator&= (U s);
00197 template <typename U>
00198 GLM_FUNC_DECL tvec2<T, P> & operator&= (tvec1<U, P> const & v);
00199 template <typename U>
00200 GLM_FUNC_DECL tvec2<T, P> & operator&= (tvec2<U, P> const & v);
00201 template <typename U>
00202 GLM_FUNC_DECL tvec2<T, P> & operator|= (U s);
00203 template <typename U>
00204 GLM_FUNC_DECL tvec2<T, P> & operator|= (tvec1<U, P> const & v);
00205 template <typename U>
00206 GLM_FUNC_DECL tvec2<T, P> & operator|= (tvec2<U, P> const & v);
00207 template <typename U>
00208 GLM_FUNC_DECL tvec2<T, P> & operator^= (U s);
00209 template <typename U>
00210 GLM_FUNC_DECL tvec2<T, P> & operator^= (tvec1<U, P> const & v);
00211 template <typename U>
00212 GLM_FUNC_DECL tvec2<T, P> & operator^= (tvec2<U, P> const & v);
00213 template <typename U>
00214 GLM_FUNC_DECL tvec2<T, P> & operator<<=(U s);
00215 template <typename U>
00216 GLM_FUNC_DECL tvec2<T, P> & operator<<=(tvec1<U, P> const & v);
00217 template <typename U>
00218 GLM_FUNC_DECL tvec2<T, P> & operator<<=(tvec2<U, P> const & v);
00219 template <typename U>
00220 GLM_FUNC_DECL tvec2<T, P> & operator>>=(U s);
00221 template <typename U>
00222 GLM_FUNC_DECL tvec2<T, P> & operator>>=(tvec1<U, P> const & v);
00223 template <typename U>
00224 GLM_FUNC_DECL tvec2<T, P> & operator>>=(tvec2<U, P> const & v);
00225 };
00226
00227 template <typename T, precision P>
00228 GLM_FUNC_DECL tvec2<T, P> operator+(tvec2<T, P> const & v, T const & s);
00229
00230 template <typename T, precision P>
00231 GLM_FUNC_DECL tvec2<T, P> operator+(tvec2<T, P> const & v1, tvec1<T, P> const & v2);
00232
00233 template <typename T, precision P>
00234 GLM_FUNC_DECL tvec2<T, P> operator+(T const & s, tvec2<T, P> const & v);
00235
00236 template <typename T, precision P>
00237 GLM_FUNC_DECL tvec2<T, P> operator+(tvec1<T, P> const & v1, tvec2<T, P> const & v2);
00238
00239 template <typename T, precision P>
00240 GLM_FUNC_DECL tvec2<T, P> operator+(tvec2<T, P> const & v1, tvec2<T, P> const & v2);
00241
00242 template <typename T, precision P>
00243 GLM_FUNC_DECL tvec2<T, P> operator-(tvec2<T, P> const & v, T const & s);
00244
00245 template <typename T, precision P>
00246 GLM_FUNC_DECL tvec2<T, P> operator-(tvec2<T, P> const & v1, tvec1<T, P> const & v2);
00247
00248 template <typename T, precision P>
00249 GLM_FUNC_DECL tvec2<T, P> operator-(T const & s, tvec2<T, P> const & v);
00250
00251 template <typename T, precision P>
00252 GLM_FUNC_DECL tvec2<T, P> operator-(tvec1<T, P> const & v1, tvec2<T, P> const & v2);
00253
00254 template <typename T, precision P>
00255 GLM_FUNC_DECL tvec2<T, P> operator-(tvec2<T, P> const & v1, tvec2<T, P> const & v2);
00256
00257 template <typename T, precision P>
00258 GLM_FUNC_DECL tvec2<T, P> operator*(tvec2<T, P> const & v, T const & s);
00259
00260 template <typename T, precision P>
00261 GLM_FUNC_DECL tvec2<T, P> operator*(tvec2<T, P> const & v1, tvec1<T, P> const & v2);
00262
00263 template <typename T, precision P>
00264 GLM_FUNC_DECL tvec2<T, P> operator*(T const & s, tvec2<T, P> const & v);
00265
00266 template <typename T, precision P>
00267 GLM_FUNC_DECL tvec2<T, P> operator*(tvec1<T, P> const & v1, tvec2<T, P> const & v2);
00268
00269 template <typename T, precision P>
00270 GLM_FUNC_DECL tvec2<T, P> operator*(tvec2<T, P> const & v1, tvec2<T, P> const & v2);
00271
00272 template <typename T, precision P>
00273 GLM_FUNC_DECL tvec2<T, P> operator/(tvec2<T, P> const & v, T const & s);
00274
00275 template <typename T, precision P>
00276 GLM_FUNC_DECL tvec2<T, P> operator/(tvec2<T, P> const & v1, tvec1<T, P> const & v2);
00277
00278 template <typename T, precision P>
00279 GLM_FUNC_DECL tvec2<T, P> operator/(T const & s, tvec2<T, P> const & v);
00280
00281 template <typename T, precision P>
00282 GLM_FUNC_DECL tvec2<T, P> operator/(tvec1<T, P> const & v1, tvec2<T, P> const & v2);
00283
00284 template <typename T, precision P>
00285 GLM_FUNC_DECL tvec2<T, P> operator/(tvec2<T, P> const & v1, tvec2<T, P> const & v2);
00286
00287 template <typename T, precision P>
00288 GLM_FUNC_DECL tvec2<T, P> operator-(tvec2<T, P> const & v);
00289
00290 template <typename T, precision P>
00291 GLM_FUNC_DECL tvec2<T, P> operator%(tvec2<T, P> const & v, T const & s);
00292
00293 template <typename T, precision P>
00294 GLM_FUNC_DECL tvec2<T, P> operator%(tvec2<T, P> const & v1, tvec1<T, P> const & v2);
00295
00296 template <typename T, precision P>
00297 GLM_FUNC_DECL tvec2<T, P> operator%(T const & s, tvec2<T, P> const & v);
00298
00299 template <typename T, precision P>
00300 GLM_FUNC_DECL tvec2<T, P> operator%(tvec1<T, P> const & v1, tvec2<T, P> const & v2);
00301
00302 template <typename T, precision P>
00303 GLM_FUNC_DECL tvec2<T, P> operator%(tvec2<T, P> const & v1, tvec2<T, P> const & v2);
00304
00305 template <typename T, precision P>
00306 GLM_FUNC_DECL tvec2<T, P> operator&(tvec2<T, P> const & v, T const & s);
00307
00308 template <typename T, precision P>
00309 GLM_FUNC_DECL tvec2<T, P> operator&(tvec2<T, P> const & v1, tvec1<T, P> const & v2);
00310
00311 template <typename T, precision P>
00312 GLM_FUNC_DECL tvec2<T, P> operator&(T const & s, tvec2<T, P> const & v);
00313
00314 template <typename T, precision P>
00315 GLM_FUNC_DECL tvec2<T, P> operator&(tvec1<T, P> const & v1, tvec2<T, P> const & v2);
00316
00317 template <typename T, precision P>
00318 GLM_FUNC_DECL tvec2<T, P> operator&(tvec2<T, P> const & v1, tvec2<T, P> const & v2);
00319
00320 template <typename T, precision P>
00321 GLM_FUNC_DECL tvec2<T, P> operator|(tvec2<T, P> const & v, T const & s);
00322
00323 template <typename T, precision P>
00324 GLM_FUNC_DECL tvec2<T, P> operator|(tvec2<T, P> const & v1, tvec1<T, P> const & v2);
00325
00326 template <typename T, precision P>
00327 GLM_FUNC_DECL tvec2<T, P> operator|(T const & s, tvec2<T, P> const & v);
00328
00329 template <typename T, precision P>
00330 GLM_FUNC_DECL tvec2<T, P> operator|(tvec1<T, P> const & v1, tvec2<T, P> const & v2);
00331
00332 template <typename T, precision P>
00333 GLM_FUNC_DECL tvec2<T, P> operator|(tvec2<T, P> const & v1, tvec2<T, P> const & v2);
00334
00335 template <typename T, precision P>
00336 GLM_FUNC_DECL tvec2<T, P> operator^(tvec2<T, P> const & v, T const & s);
00337
00338 template <typename T, precision P>
00339 GLM_FUNC_DECL tvec2<T, P> operator^(tvec2<T, P> const & v1, tvec1<T, P> const & v2);
00340
00341 template <typename T, precision P>
00342 GLM_FUNC_DECL tvec2<T, P> operator^(T const & s, tvec2<T, P> const & v);
00343
00344 template <typename T, precision P>
00345 GLM_FUNC_DECL tvec2<T, P> operator^(tvec1<T, P> const & v1, tvec2<T, P> const & v2);
00346
00347 template <typename T, precision P>
00348 GLM_FUNC_DECL tvec2<T, P> operator^(tvec2<T, P> const & v1, tvec2<T, P> const & v2);
00349
00350 template <typename T, precision P>
00351 GLM_FUNC_DECL tvec2<T, P> operator<<(tvec2<T, P> const & v, T const & s);
00352
00353 template <typename T, precision P>
00354 GLM_FUNC_DECL tvec2<T, P> operator<<(tvec2<T, P> const & v1, tvec1<T, P> const & v2);
00355
00356 template <typename T, precision P>
00357 GLM_FUNC_DECL tvec2<T, P> operator<<(T const & s, tvec2<T, P> const & v);
00358
00359 template <typename T, precision P>
00360 GLM_FUNC_DECL tvec2<T, P> operator<<(tvec1<T, P> const & v1, tvec2<T, P> const & v2);
00361
00362 template <typename T, precision P>
00363 GLM_FUNC_DECL tvec2<T, P> operator<<(tvec2<T, P> const & v1, tvec2<T, P> const & v2);
00364
00365 template <typename T, precision P>
00366 GLM_FUNC_DECL tvec2<T, P> operator>>(tvec2<T, P> const & v, T const & s);
00367
00368 template <typename T, precision P>
00369 GLM_FUNC_DECL tvec2<T, P> operator>>(tvec2<T, P> const & v1, tvec1<T, P> const & v2);
00370
00371 template <typename T, precision P>
00372 GLM_FUNC_DECL tvec2<T, P> operator>>(T const & s, tvec2<T, P> const & v);
00373
00374 template <typename T, precision P>
00375 GLM_FUNC_DECL tvec2<T, P> operator>>(tvec1<T, P> const & v1, tvec2<T, P> const & v2);
00376
00377 template <typename T, precision P>
00378 GLM_FUNC_DECL tvec2<T, P> operator>>(tvec2<T, P> const & v1, tvec2<T, P> const & v2);
00379
00380 template <typename T, precision P>
00381 GLM_FUNC_DECL tvec2<T, P> operator~(tvec2<T, P> const & v);
00382
00383 }
00384 }
00385
00386 #ifndef GLM_EXTERNAL_TEMPLATE
00387 #include "type_vec2.inl"
00388 #endif//GLM_EXTERNAL_TEMPLATE