00001
00002
00004
00005
00006
00007
00009
00010 #ifndef glm_core_type_gentype3
00011 #define glm_core_type_gentype3
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_vec3();
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 tvec2;
00032 template <typename T> struct tvec4;
00033
00034 template <typename T>
00035 struct tvec3
00036 {
00037 enum ctor{null};
00038 typedef T value_type;
00039 typedef std::size_t size_type;
00040 static size_type value_size();
00041
00042 typedef tvec3<T> type;
00043 typedef tvec3<bool> bool_type;
00044
00046
00047
00048 # if defined(GLM_USE_ONLY_XYZW)
00049 value_type x, y, z;
00050 # else//GLM_USE_ONLY_XYZW
00051 # ifdef GLM_USE_ANONYMOUS_UNION
00052 union
00053 {
00054 struct{value_type x, y, z;};
00055 struct{value_type r, g, b;};
00056 struct{value_type s, t, p;};
00057 };
00058 # else//GLM_USE_ANONYMOUS_UNION
00059 union {value_type x, r, s;};
00060 union {value_type y, g, t;};
00061 union {value_type z, b, p;};
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 tvec3();
00075 tvec3(tvec3<T> const & v);
00076
00078
00079
00080 explicit tvec3(
00081 ctor);
00082 explicit tvec3(
00083 value_type const & s);
00084 explicit tvec3(
00085 value_type const & s1,
00086 value_type const & s2,
00087 value_type const & s3);
00088
00090
00091
00092 tvec3(tref3<T> const & r);
00093
00095
00096
00098 template <typename U>
00099 explicit tvec3(
00100 U const & x);
00102 template <typename U, typename V, typename W>
00103 explicit tvec3(
00104 U const & x,
00105 V const & y,
00106 W const & z);
00107
00109
00110
00112 template <typename A, typename B>
00113 explicit tvec3(tvec2<A> const & v, B const & s);
00115 template <typename A, typename B>
00116 explicit tvec3(A const & s, tvec2<B> const & v);
00118 template <typename U>
00119 explicit tvec3(tvec3<U> const & v);
00121 template <typename U>
00122 explicit tvec3(tvec4<U> const & v);
00123
00125
00126
00127 tvec3<T> & operator= (tvec3<T> const & v);
00128 template <typename U>
00129 tvec3<T> & operator= (tvec3<U> const & v);
00130
00131 template <typename U>
00132 tvec3<T> & operator+=(U const & s);
00133 template <typename U>
00134 tvec3<T> & operator+=(tvec3<U> const & v);
00135 template <typename U>
00136 tvec3<T> & operator-=(U const & s);
00137 template <typename U>
00138 tvec3<T> & operator-=(tvec3<U> const & v);
00139 template <typename U>
00140 tvec3<T> & operator*=(U const & s);
00141 template <typename U>
00142 tvec3<T> & operator*=(tvec3<U> const & v);
00143 template <typename U>
00144 tvec3<T> & operator/=(U const & s);
00145 template <typename U>
00146 tvec3<T> & operator/=(tvec3<U> const & v);
00147 tvec3<T> & operator++();
00148 tvec3<T> & operator--();
00149
00151
00152
00153 template <typename U>
00154 tvec3<T> & operator%= (U const & s);
00155 template <typename U>
00156 tvec3<T> & operator%= (tvec3<U> const & v);
00157 template <typename U>
00158 tvec3<T> & operator&= (U const & s);
00159 template <typename U>
00160 tvec3<T> & operator&= (tvec3<U> const & v);
00161 template <typename U>
00162 tvec3<T> & operator|= (U const & s);
00163 template <typename U>
00164 tvec3<T> & operator|= (tvec3<U> const & v);
00165 template <typename U>
00166 tvec3<T> & operator^= (U const & s);
00167 template <typename U>
00168 tvec3<T> & operator^= (tvec3<U> const & v);
00169 template <typename U>
00170 tvec3<T> & operator<<=(U const & s);
00171 template <typename U>
00172 tvec3<T> & operator<<=(tvec3<U> const & v);
00173 template <typename U>
00174 tvec3<T> & operator>>=(U const & s);
00175 template <typename U>
00176 tvec3<T> & operator>>=(tvec3<U> const & v);
00177
00179
00180
00181 value_type swizzle(comp X) const;
00182 tvec2<T> swizzle(comp X, comp Y) const;
00183 tvec3<T> swizzle(comp X, comp Y, comp Z) const;
00184 tvec4<T> swizzle(comp X, comp Y, comp Z, comp W) const;
00185 tref3<T> swizzle(comp X, comp Y, comp Z);
00186 };
00187
00188 template <typename T>
00189 struct tref3
00190 {
00191 tref3(T & x, T & y, T & z);
00192 tref3(tref3<T> const & r);
00193 tref3(tvec3<T> const & v);
00194
00195 tref3<T> & operator= (tref3<T> const & r);
00196 tref3<T> & operator= (tvec3<T> const & v);
00197
00198 T & x;
00199 T & y;
00200 T & z;
00201 };
00202 }
00203
00204 namespace core{
00205 namespace type{
00206
00207 namespace precision
00208 {
00212 typedef detail::tvec3<highp_float> highp_vec3;
00216 typedef detail::tvec3<mediump_float> mediump_vec3;
00220 typedef detail::tvec3<lowp_float> lowp_vec3;
00221
00225 typedef detail::tvec3<highp_int> highp_ivec3;
00229 typedef detail::tvec3<mediump_int> mediump_ivec3;
00233 typedef detail::tvec3<lowp_int> lowp_ivec3;
00234
00238 typedef detail::tvec3<highp_uint> highp_uvec3;
00242 typedef detail::tvec3<mediump_uint> mediump_uvec3;
00246 typedef detail::tvec3<lowp_uint> lowp_uvec3;
00247 }
00248
00249
00250 }
00251 }
00252 }
00253
00254 #include "type_vec3.inl"
00255
00256 #endif//glm_core_type_gentype3