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 tvec3
00047 {
00049
00050
00051 enum ctor{_null};
00052
00053 typedef tvec3<T, P> type;
00054 typedef tvec3<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, z; };
00070 struct{ T r, g, b; };
00071 struct{ T s, t, p; };
00072
00073 _GLM_SWIZZLE3_2_MEMBERS(T, P, tvec2, x, y, z)
00074 _GLM_SWIZZLE3_2_MEMBERS(T, P, tvec2, r, g, b)
00075 _GLM_SWIZZLE3_2_MEMBERS(T, P, tvec2, s, t, p)
00076 _GLM_SWIZZLE3_3_MEMBERS(T, P, tvec3, x, y, z)
00077 _GLM_SWIZZLE3_3_MEMBERS(T, P, tvec3, r, g, b)
00078 _GLM_SWIZZLE3_3_MEMBERS(T, P, tvec3, s, t, p)
00079 _GLM_SWIZZLE3_4_MEMBERS(T, P, tvec4, x, y, z)
00080 _GLM_SWIZZLE3_4_MEMBERS(T, P, tvec4, r, g, b)
00081 _GLM_SWIZZLE3_4_MEMBERS(T, P, tvec4, s, t, p)
00082 };
00083 # else
00084 union { T x, r, s; };
00085 union { T y, g, t; };
00086 union { T z, b, p; };
00087
00088 # ifdef GLM_SWIZZLE
00089 GLM_SWIZZLE_GEN_VEC_FROM_VEC3(T, P, detail::tvec3, detail::tvec2, detail::tvec3, detail::tvec4)
00090 # endif
00091 # endif//GLM_LANG
00092
00094
00095
00096 GLM_FUNC_DECL T & operator[](length_t i);
00097 GLM_FUNC_DECL T const & operator[](length_t i) const;
00098
00100
00101
00102 GLM_FUNC_DECL tvec3();
00103 GLM_FUNC_DECL tvec3(tvec3<T, P> const & v);
00104 template <precision Q>
00105 GLM_FUNC_DECL tvec3(tvec3<T, Q> const & v);
00106
00108
00109
00110 # if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
00111 template <int E0, int E1, int E2>
00112 GLM_FUNC_DECL tvec3(_swizzle<3, T, P, tvec3<T, P>, E0, E1, E2, -1> const & that)
00113 {
00114 *this = that();
00115 }
00116
00117 template <int E0, int E1>
00118 GLM_FUNC_DECL tvec3(_swizzle<2, T, P, tvec2<T, P>, E0, E1, -1, -2> const & v, T const & s)
00119 {
00120 *this = tvec3<T, P>(v(), s);
00121 }
00122
00123 template <int E0, int E1>
00124 GLM_FUNC_DECL tvec3(T const & s, _swizzle<2, T, P, tvec2<T, P>, E0, E1, -1, -2> const & v)
00125 {
00126 *this = tvec3<T, P>(s, v());
00127 }
00128 # endif//(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
00129
00131
00132
00133 GLM_FUNC_DECL explicit tvec3(ctor);
00134 GLM_FUNC_DECL explicit tvec3(T const & s);
00135 GLM_FUNC_DECL tvec3(T const & s1, T const & s2, T const & s3);
00136
00138
00139
00141 template <typename U, typename V, typename W>
00142 GLM_FUNC_DECL tvec3(
00143 U const & x,
00144 V const & y,
00145 W const & z);
00146
00148
00149
00151 template <typename A, typename B, precision Q>
00152 GLM_FUNC_DECL explicit tvec3(tvec2<A, Q> const & v, B const & s);
00154 template <typename A, typename B, precision Q>
00155 GLM_FUNC_DECL explicit tvec3(A const & s, tvec2<B, Q> const & v);
00157 template <typename U, precision Q>
00158 GLM_FUNC_DECL explicit tvec3(tvec3<U, Q> const & v);
00160 template <typename U, precision Q>
00161 GLM_FUNC_DECL explicit tvec3(tvec4<U, Q> const & v);
00162
00164
00165
00166 GLM_FUNC_DECL tvec3<T, P> & operator= (tvec3<T, P> const & v);
00167
00168 template <typename U>
00169 GLM_FUNC_DECL tvec3<T, P> & operator= (tvec3<U, P> const & v);
00170 template <typename U>
00171 GLM_FUNC_DECL tvec3<T, P> & operator+=(U s);
00172 template <typename U>
00173 GLM_FUNC_DECL tvec3<T, P> & operator+=(tvec3<U, P> const & v);
00174 template <typename U>
00175 GLM_FUNC_DECL tvec3<T, P> & operator-=(U s);
00176 template <typename U>
00177 GLM_FUNC_DECL tvec3<T, P> & operator-=(tvec3<U, P> const & v);
00178 template <typename U>
00179 GLM_FUNC_DECL tvec3<T, P> & operator*=(U s);
00180 template <typename U>
00181 GLM_FUNC_DECL tvec3<T, P> & operator*=(tvec3<U, P> const & v);
00182 template <typename U>
00183 GLM_FUNC_DECL tvec3<T, P> & operator/=(U s);
00184 template <typename U>
00185 GLM_FUNC_DECL tvec3<T, P> & operator/=(tvec3<U, P> const & v);
00186
00188
00189
00190 GLM_FUNC_DECL tvec3<T, P> & operator++();
00191 GLM_FUNC_DECL tvec3<T, P> & operator--();
00192 GLM_FUNC_DECL tvec3<T, P> operator++(int);
00193 GLM_FUNC_DECL tvec3<T, P> operator--(int);
00194
00196
00197
00198 template <typename U>
00199 GLM_FUNC_DECL tvec3<T, P> & operator%= (U s);
00200 template <typename U>
00201 GLM_FUNC_DECL tvec3<T, P> & operator%= (tvec3<U, P> const & v);
00202 template <typename U>
00203 GLM_FUNC_DECL tvec3<T, P> & operator&= (U s);
00204 template <typename U>
00205 GLM_FUNC_DECL tvec3<T, P> & operator&= (tvec3<U, P> const & v);
00206 template <typename U>
00207 GLM_FUNC_DECL tvec3<T, P> & operator|= (U s);
00208 template <typename U>
00209 GLM_FUNC_DECL tvec3<T, P> & operator|= (tvec3<U, P> const & v);
00210 template <typename U>
00211 GLM_FUNC_DECL tvec3<T, P> & operator^= (U s);
00212 template <typename U>
00213 GLM_FUNC_DECL tvec3<T, P> & operator^= (tvec3<U, P> const & v);
00214 template <typename U>
00215 GLM_FUNC_DECL tvec3<T, P> & operator<<=(U s);
00216 template <typename U>
00217 GLM_FUNC_DECL tvec3<T, P> & operator<<=(tvec3<U, P> const & v);
00218 template <typename U>
00219 GLM_FUNC_DECL tvec3<T, P> & operator>>=(U s);
00220 template <typename U>
00221 GLM_FUNC_DECL tvec3<T, P> & operator>>=(tvec3<U, P> const & v);
00222 };
00223
00224 template <typename T, precision P>
00225 GLM_FUNC_DECL tvec3<T, P> operator+(tvec3<T, P> const & v, T const & s);
00226
00227 template <typename T, precision P>
00228 GLM_FUNC_DECL tvec3<T, P> operator+(T const & s, tvec3<T, P> const & v);
00229
00230 template <typename T, precision P>
00231 GLM_FUNC_DECL tvec3<T, P> operator+(tvec3<T, P> const & v1, tvec3<T, P> const & v2);
00232
00233 template <typename T, precision P>
00234 GLM_FUNC_DECL tvec3<T, P> operator-(tvec3<T, P> const & v, T const & s);
00235
00236 template <typename T, precision P>
00237 GLM_FUNC_DECL tvec3<T, P> operator-(T const & s, tvec3<T, P> const & v);
00238
00239 template <typename T, precision P>
00240 GLM_FUNC_DECL tvec3<T, P> operator- (tvec3<T, P> const & v1, tvec3<T, P> const & v2);
00241
00242 template <typename T, precision P>
00243 GLM_FUNC_DECL tvec3<T, P> operator*(tvec3<T, P> const & v, T const & s);
00244
00245 template <typename T, precision P>
00246 GLM_FUNC_DECL tvec3<T, P> operator*(T const & s, tvec3<T, P> const & v);
00247
00248 template <typename T, precision P>
00249 GLM_FUNC_DECL tvec3<T, P> operator*(tvec3<T, P> const & v1, tvec3<T, P> const & v2);
00250
00251 template <typename T, precision P>
00252 GLM_FUNC_DECL tvec3<T, P> operator/(tvec3<T, P> const & v, T const & s);
00253
00254 template <typename T, precision P>
00255 GLM_FUNC_DECL tvec3<T, P> operator/(T const & s, tvec3<T, P> const & v);
00256
00257 template <typename T, precision P>
00258 GLM_FUNC_DECL tvec3<T, P> operator/(tvec3<T, P> const & v1, tvec3<T, P> const & v2);
00259
00260 template <typename T, precision P>
00261 GLM_FUNC_DECL tvec3<T, P> operator-(tvec3<T, P> const & v);
00262
00263 template <typename T, precision P>
00264 GLM_FUNC_DECL tvec3<T, P> operator%(tvec3<T, P> const & v, T const & s);
00265
00266 template <typename T, precision P>
00267 GLM_FUNC_DECL tvec3<T, P> operator%(T const & s, tvec3<T, P> const & v);
00268
00269 template <typename T, precision P>
00270 GLM_FUNC_DECL tvec3<T, P> operator%(tvec3<T, P> const & v1, tvec3<T, P> const & v2);
00271
00272 template <typename T, precision P>
00273 GLM_FUNC_DECL tvec3<T, P> operator&(tvec3<T, P> const & v, T const & s);
00274
00275 template <typename T, precision P>
00276 GLM_FUNC_DECL tvec3<T, P> operator&(T const & s, tvec3<T, P> const & v);
00277
00278 template <typename T, precision P>
00279 GLM_FUNC_DECL tvec3<T, P> operator&(tvec3<T, P> const & v1, tvec3<T, P> const & v2);
00280
00281 template <typename T, precision P>
00282 GLM_FUNC_DECL tvec3<T, P> operator|(tvec3<T, P> const & v, T const & s);
00283
00284 template <typename T, precision P>
00285 GLM_FUNC_DECL tvec3<T, P> operator|(T const & s, tvec3<T, P> const & v);
00286
00287 template <typename T, precision P>
00288 GLM_FUNC_DECL tvec3<T, P> operator|(tvec3<T, P> const & v1, tvec3<T, P> const & v2);
00289
00290 template <typename T, precision P>
00291 GLM_FUNC_DECL tvec3<T, P> operator^(tvec3<T, P> const & v, T const & s);
00292
00293 template <typename T, precision P>
00294 GLM_FUNC_DECL tvec3<T, P> operator^(T const & s, tvec3<T, P> const & v);
00295
00296 template <typename T, precision P>
00297 GLM_FUNC_DECL tvec3<T, P> operator^(tvec3<T, P> const & v1, tvec3<T, P> const & v2);
00298
00299 template <typename T, precision P>
00300 GLM_FUNC_DECL tvec3<T, P> operator<<(tvec3<T, P> const & v, T const & s);
00301
00302 template <typename T, precision P>
00303 GLM_FUNC_DECL tvec3<T, P> operator<<(T const & s, tvec3<T, P> const & v);
00304
00305 template <typename T, precision P>
00306 GLM_FUNC_DECL tvec3<T, P> operator<<(tvec3<T, P> const & v1, tvec3<T, P> const & v2);
00307
00308 template <typename T, precision P>
00309 GLM_FUNC_DECL tvec3<T, P> operator>>(tvec3<T, P> const & v, T const & s);
00310
00311 template <typename T, precision P>
00312 GLM_FUNC_DECL tvec3<T, P> operator>>(T const & s, tvec3<T, P> const & v);
00313
00314 template <typename T, precision P>
00315 GLM_FUNC_DECL tvec3<T, P> operator>>(tvec3<T, P> const & v1, tvec3<T, P> const & v2);
00316
00317 template <typename T, precision P>
00318 GLM_FUNC_DECL tvec3<T, P> operator~(tvec3<T, P> const & v);
00319
00320 }
00321 }
00322
00323 #ifndef GLM_EXTERNAL_TEMPLATE
00324 #include "type_vec3.inl"
00325 #endif//GLM_EXTERNAL_TEMPLATE