00001
00002
00004
00005
00006
00007
00009
00010 #ifndef glm_core_type_gentype2
00011 #define glm_core_type_gentype2
00012
00013 #include "type_vec.hpp"
00014 #include "type_float.hpp"
00015 #include "type_int.hpp"
00016 #include "type_size.hpp"
00017 #include "_swizzle.hpp"
00018
00019 namespace glm
00020 {
00021 namespace test
00022 {
00023 void main_vec2();
00024 }
00025
00026
00027 namespace detail
00028 {
00029 template <typename T> struct tref2;
00030 template <typename T> struct tref3;
00031 template <typename T> struct tref4;
00032 template <typename T> struct tvec3;
00033 template <typename T> struct tvec4;
00034
00035 template <typename T>
00036 struct tvec2
00037 {
00038 enum ctor{null};
00039 typedef T value_type;
00040 typedef std::size_t size_type;
00041 static size_type value_size();
00042
00043 typedef tvec2<T> type;
00044 typedef tvec2<bool> bool_type;
00045
00047
00048
00049 # if defined(GLM_USE_ONLY_XYZW)
00050 value_type x, y;
00051 # else//GLM_USE_ONLY_XYZW
00052 # ifdef GLM_USE_ANONYMOUS_UNION
00053 union
00054 {
00055 struct{value_type x, y;};
00056 struct{value_type r, g;};
00057 struct{value_type s, t;};
00058 };
00059 # else//GLM_USE_ANONYMOUS_UNION
00060 union {value_type x, r, s;};
00061 union {value_type y, g, t;};
00062 # endif//GLM_USE_ANONYMOUS_UNION
00063 # endif//GLM_USE_ONLY_XYZW
00064
00066
00067
00068 value_type & operator[](size_type i);
00069 value_type const & operator[](size_type i) const;
00070
00072
00073
00074 tvec2();
00075 tvec2(tvec2<T> const & v);
00076
00078
00079
00080 explicit tvec2(
00081 ctor);
00082 explicit tvec2(
00083 value_type const & s);
00084 explicit tvec2(
00085 value_type const & s1,
00086 value_type const & s2);
00087
00089
00090
00091 tvec2(tref2<T> const & r);
00092
00094
00095
00097 template <typename U>
00098 explicit tvec2(
00099 U const & x);
00101 template <typename U, typename V>
00102 explicit tvec2(
00103 U const & x,
00104 V const & y);
00105
00107
00108
00110 template <typename U>
00111 explicit tvec2(tvec2<U> const & v);
00113 template <typename U>
00114 explicit tvec2(tvec3<U> const & v);
00116 template <typename U>
00117 explicit tvec2(tvec4<U> const & v);
00118
00120
00121
00122 tvec2<T> & operator= (tvec2<T> const & v);
00123 template <typename U>
00124 tvec2<T> & operator= (tvec2<U> const & v);
00125
00126 template <typename U>
00127 tvec2<T> & operator+=(U const & s);
00128 template <typename U>
00129 tvec2<T> & operator+=(tvec2<U> const & v);
00130 template <typename U>
00131 tvec2<T> & operator-=(U const & s);
00132 template <typename U>
00133 tvec2<T> & operator-=(tvec2<U> const & v);
00134 template <typename U>
00135 tvec2<T> & operator*=(U const & s);
00136 template <typename U>
00137 tvec2<T> & operator*=(tvec2<U> const & v);
00138 template <typename U>
00139 tvec2<T> & operator/=(U const & s);
00140 template <typename U>
00141 tvec2<T> & operator/=(tvec2<U> const & v);
00142 tvec2<T> & operator++();
00143 tvec2<T> & operator--();
00144
00146
00147
00148 template <typename U>
00149 tvec2<T> & operator%= (U const & s);
00150 template <typename U>
00151 tvec2<T> & operator%= (tvec2<U> const & v);
00152 template <typename U>
00153 tvec2<T> & operator&= (U const & s);
00154 template <typename U>
00155 tvec2<T> & operator&= (tvec2<U> const & v);
00156 template <typename U>
00157 tvec2<T> & operator|= (U const & s);
00158 template <typename U>
00159 tvec2<T> & operator|= (tvec2<U> const & v);
00160 template <typename U>
00161 tvec2<T> & operator^= (U const & s);
00162 template <typename U>
00163 tvec2<T> & operator^= (tvec2<U> const & v);
00164 template <typename U>
00165 tvec2<T> & operator<<=(U const & s);
00166 template <typename U>
00167 tvec2<T> & operator<<=(tvec2<U> const & v);
00168 template <typename U>
00169 tvec2<T> & operator>>=(U const & s);
00170 template <typename U>
00171 tvec2<T> & operator>>=(tvec2<U> const & v);
00172
00174
00175
00176 value_type swizzle(comp X) const;
00177 tvec2<T> swizzle(comp X, comp Y) const;
00178 tvec3<T> swizzle(comp X, comp Y, comp Z) const;
00179 tvec4<T> swizzle(comp X, comp Y, comp Z, comp W) const;
00180 tref2<T> swizzle(comp X, comp Y);
00181 };
00182
00183 template <typename T>
00184 struct tref2
00185 {
00186 tref2(T & x, T & y);
00187 tref2(tref2<T> const & r);
00188 tref2(tvec2<T> const & v);
00189
00190 tref2<T> & operator= (tref2<T> const & r);
00191 tref2<T> & operator= (tvec2<T> const & v);
00192
00193 T& x;
00194 T& y;
00195 };
00196 }
00197
00198 namespace core{
00199 namespace type{
00200
00201 namespace precision
00202 {
00206 typedef detail::tvec2<highp_float> highp_vec2;
00210 typedef detail::tvec2<mediump_float> mediump_vec2;
00214 typedef detail::tvec2<lowp_float> lowp_vec2;
00215
00219 typedef detail::tvec2<highp_int> highp_ivec2;
00223 typedef detail::tvec2<mediump_int> mediump_ivec2;
00227 typedef detail::tvec2<lowp_int> lowp_ivec2;
00228
00232 typedef detail::tvec2<highp_uint> highp_uvec2;
00236 typedef detail::tvec2<mediump_uint> mediump_uvec2;
00240 typedef detail::tvec2<lowp_uint> lowp_uvec2;
00241 }
00242
00243
00244 }
00245 }
00246 }
00247
00248 #include "type_vec2.inl"
00249
00250 #endif//glm_core_type_gentype2