00001
00002
00004
00005
00006
00007
00009
00010 #ifndef glm_core_type_gentype2
00011 #define glm_core_type_gentype2
00012
00013 #include "type_float.hpp"
00014 #include "type_int.hpp"
00015 #include "type_size.hpp"
00016 #include "_swizzle.hpp"
00017
00018 namespace glm
00019 {
00020 namespace test
00021 {
00022 void main_vec2();
00023 }
00024
00025
00026 namespace detail
00027 {
00028 template <typename T> struct tref2;
00029 template <typename T> struct tref3;
00030 template <typename T> struct tref4;
00031 template <typename T> struct tvec3;
00032 template <typename T> struct tvec4;
00033
00034 template <typename valType>
00035 struct tvec2
00036 {
00038
00039
00040 typedef valType value_type;
00041 typedef valType& value_reference;
00042 typedef valType* value_pointer;
00043 typedef tvec2<bool> bool_type;
00044
00045 typedef glm::sizeType size_type;
00046 static size_type value_size();
00047 static bool is_vector();
00048
00049 typedef tvec2<valType> type;
00050 typedef tvec2<valType>* pointer;
00051 typedef const tvec2<valType>* const_pointer;
00052 typedef const tvec2<valType>*const const_pointer_const;
00053 typedef tvec2<valType>*const pointer_const;
00054 typedef tvec2<valType>& reference;
00055 typedef const tvec2<valType>& const_reference;
00056 typedef const tvec2<valType>& param_type;
00057
00059
00060
00061 # if defined(GLM_USE_ONLY_XYZW)
00062 value_type x, y;
00063 # else//GLM_USE_ONLY_XYZW
00064 # ifdef GLM_USE_ANONYMOUS_UNION
00065 union
00066 {
00067 struct{value_type x, y;};
00068 struct{value_type r, g;};
00069 struct{value_type s, t;};
00070 };
00071 # else//GLM_USE_ANONYMOUS_UNION
00072 union {value_type x, r, s;};
00073 union {value_type y, g, t;};
00074 # endif//GLM_USE_ANONYMOUS_UNION
00075 # endif//GLM_USE_ONLY_XYZW
00076
00078
00079
00080 valType & operator[](size_type i);
00081 valType const & operator[](size_type i) const;
00082
00084
00085
00086 value_type const * const _address() const{return (value_type*)(this);}
00087 value_type * _address(){return (value_type*)(this);}
00088
00090
00091
00092 tvec2();
00093 tvec2(tvec2<valType> const & v);
00094
00096
00097
00098 explicit tvec2(valType s);
00099 explicit tvec2(valType s1, valType s2);
00100
00102
00103
00104 tvec2(tref2<valType> const & r);
00105
00107
00108
00110 template <typename U>
00111 explicit tvec2(U x);
00113 template <typename U, typename V>
00114 explicit tvec2(U x, V y);
00115
00117
00118
00120 template <typename U>
00121 explicit tvec2(tvec2<U> const & v);
00123 template <typename U>
00124 explicit tvec2(tvec3<U> const & v);
00126 template <typename U>
00127 explicit tvec2(tvec4<U> const & v);
00128
00130
00131
00132 tvec2<valType>& operator= (tvec2<valType> const & v);
00133
00134 tvec2<valType>& operator+=(valType const & s);
00135 tvec2<valType>& operator+=(tvec2<valType> const & v);
00136 tvec2<valType>& operator-=(valType const & s);
00137 tvec2<valType>& operator-=(tvec2<valType> const & v);
00138 tvec2<valType>& operator*=(valType const & s);
00139 tvec2<valType>& operator*=(tvec2<valType> const & v);
00140 tvec2<valType>& operator/=(valType const & s);
00141 tvec2<valType>& operator/=(tvec2<valType> const & v);
00142 tvec2<valType>& operator++();
00143 tvec2<valType>& operator--();
00144
00146
00147
00148 tvec2<valType>& operator%=(valType const & s);
00149 tvec2<valType>& operator%=(tvec2<valType> const & v);
00150 tvec2<valType>& operator&=(valType const & s);
00151 tvec2<valType>& operator&=(tvec2<valType> const & v);
00152 tvec2<valType>& operator|=(valType const & s);
00153 tvec2<valType>& operator|=(tvec2<valType> const & v);
00154 tvec2<valType>& operator^=(valType const & s);
00155 tvec2<valType>& operator^=(tvec2<valType> const & v);
00156 tvec2<valType>& operator<<=(valType const & s);
00157 tvec2<valType>& operator<<=(tvec2<valType> const & v);
00158 tvec2<valType>& operator>>=(valType const & s);
00159 tvec2<valType>& operator>>=(tvec2<valType> const & v);
00160
00162
00163
00164 valType swizzle(comp X) const;
00165 tvec2<valType> swizzle(comp X, comp Y) const;
00166 tvec3<valType> swizzle(comp X, comp Y, comp Z) const;
00167 tvec4<valType> swizzle(comp X, comp Y, comp Z, comp W) const;
00168 tref2<valType> swizzle(comp X, comp Y);
00169 };
00170
00171
00172
00173
00174
00175
00176 template <typename T>
00177 struct tref2
00178 {
00179 tref2(T& x, T& y);
00180 tref2(tref2<T> const & r);
00181 tref2(tvec2<T> const & v);
00182
00183 tref2<T>& operator= (tref2<T> const & r);
00184 tref2<T>& operator= (tvec2<T> const & v);
00185
00186 T& x;
00187 T& y;
00188 };
00189 }
00190
00191 namespace core{
00192 namespace type{
00193 namespace vector{
00194
00196
00197
00200 typedef detail::tvec2<bool> bvec2;
00201
00203
00204
00205 #ifndef GLM_PRECISION
00208 typedef detail::tvec2<mediump_float> vec2;
00209 #elif(GLM_PRECISION & GLM_PRECISION_HIGHP_FLOAT)
00210 typedef detail::tvec2<highp_float> vec2;
00211 #elif(GLM_PRECISION & GLM_PRECISION_MEDIUMP_FLOAT)
00212 typedef detail::tvec2<mediump_float> vec2;
00213 #elif(GLM_PRECISION & GLM_PRECISION_LOWP_FLOAT)
00214 typedef detail::tvec2<lowp_float> vec2;
00215 #else
00216 typedef detail::tvec2<mediump_float> vec2;
00217 #endif//GLM_PRECISION
00218
00219 namespace precision
00220 {
00224 typedef detail::tvec2<highp_float> highp_vec2;
00228 typedef detail::tvec2<mediump_float> mediump_vec2;
00232 typedef detail::tvec2<lowp_float> lowp_vec2;
00233 }
00234
00235
00237
00238
00239 #ifndef GLM_PRECISION
00242 typedef detail::tvec2<mediump_int> ivec2;
00243 #elif(GLM_PRECISION & GLM_PRECISION_HIGHP_INT)
00244 typedef detail::tvec2<highp_int> ivec2;
00245 #elif(GLM_PRECISION & GLM_PRECISION_MEDIUMP_INT)
00246 typedef detail::tvec2<mediump_int> ivec2;
00247 #elif(GLM_PRECISION & GLM_PRECISION_LOWP_INT)
00248 typedef detail::tvec2<lowp_int> ivec2;
00249 #else
00250 typedef detail::tvec2<mediump_int> ivec2;
00251 #endif//GLM_PRECISION
00252
00253 namespace precision
00254 {
00258 typedef detail::tvec2<highp_int> highp_ivec2;
00262 typedef detail::tvec2<mediump_int> mediump_ivec2;
00266 typedef detail::tvec2<lowp_int> lowp_ivec2;
00267 }
00268
00269
00271
00272
00273 #ifndef GLM_PRECISION
00276 typedef detail::tvec2<mediump_uint> uvec2;
00277 #elif(GLM_PRECISION & GLM_PRECISION_HIGHP_UINT)
00278 typedef detail::tvec2<highp_uint> uvec2;
00279 #elif(GLM_PRECISION & GLM_PRECISION_MEDIUMP_UINT)
00280 typedef detail::tvec2<mediump_uint> uvec2;
00281 #elif(GLM_PRECISION & GLM_PRECISION_LOWP_UINT)
00282 typedef detail::tvec2<lowp_uint> uvec2;
00283 #else
00284 typedef detail::tvec2<mediump_uint> uvec2;
00285 #endif//GLM_PRECISION
00286
00287 namespace precision
00288 {
00292 typedef detail::tvec2<highp_uint> highp_uvec2;
00296 typedef detail::tvec2<mediump_uint> mediump_uvec2;
00300 typedef detail::tvec2<lowp_uint> lowp_uvec2;
00301 }
00302
00303
00304 }
00305 }
00306 }
00307 }
00308
00309 #include "type_vec2.inl"
00310
00311 #endif//glm_core_type_gentype2