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 #ifndef glm_core_type_gentype3
00030 #define glm_core_type_gentype3
00031 
00032 #include "type_vec.hpp"
00033 #include "type_float.hpp"
00034 #include "type_int.hpp"
00035 #include "type_size.hpp"
00036 #include "_swizzle.hpp"
00037 
00038 namespace glm{
00039 namespace detail
00040 {
00041         template <typename T> struct tref2;
00042         template <typename T> struct tref3;
00043         template <typename T> struct tref4;
00044         template <typename T> struct tvec2;
00045         template <typename T> struct tvec4;
00046 
00047         
00048         
00049         template <typename T>
00050         struct tvec3
00051         {       
00052                 enum ctor{null};
00053 
00054                 typedef T value_type;
00055                 typedef std::size_t size_type;
00056                 GLM_FUNC_DECL size_type length() const;
00057 
00058                 typedef tvec3<T> type;
00059                 typedef tvec3<bool> bool_type;
00060 
00062                 
00063 
00064 #       if(GLM_COMPONENT == GLM_COMPONENT_CXX11)
00065                 union 
00066                 {
00067 #               if(defined(GLM_SWIZZLE))
00068                         _GLM_SWIZZLE3_2_MEMBERS(value_type, glm::detail::tvec2<value_type>, x, y, z)
00069                         _GLM_SWIZZLE3_2_MEMBERS(value_type, glm::detail::tvec2<value_type>, r, g, b)
00070                         _GLM_SWIZZLE3_2_MEMBERS(value_type, glm::detail::tvec2<value_type>, s, t, p)
00071                         _GLM_SWIZZLE3_3_MEMBERS(value_type, glm::detail::tvec3<value_type>, x, y, z)
00072                         _GLM_SWIZZLE3_3_MEMBERS(value_type, glm::detail::tvec3<value_type>, r, g, b)
00073                         _GLM_SWIZZLE3_3_MEMBERS(value_type, glm::detail::tvec3<value_type>, s, t, p)
00074                         _GLM_SWIZZLE3_4_MEMBERS(value_type, glm::detail::tvec4<value_type>, x, y, z)
00075                         _GLM_SWIZZLE3_4_MEMBERS(value_type, glm::detail::tvec4<value_type>, r, g, b)
00076                         _GLM_SWIZZLE3_4_MEMBERS(value_type, glm::detail::tvec4<value_type>, s, t, p)
00077 #               endif//(defined(GLM_SWIZZLE))
00078 
00079                         struct{value_type r, g, b;};
00080                         struct{value_type s, t, p;};
00081                         struct{value_type x, y, z;};
00082                 };
00083 #       elif(GLM_COMPONENT == GLM_COMPONENT_CXX98)
00084                 union {value_type x, r, s;};
00085                 union {value_type y, g, t;};
00086                 union {value_type z, b, p;};
00087 
00088 #               if(defined(GLM_SWIZZLE))
00089                         
00090                         GLM_SWIZZLE_GEN_REF_FROM_VEC3(T, detail::tvec3, detail::tref2, detail::tref3)
00091                         GLM_SWIZZLE_GEN_VEC_FROM_VEC3(T, detail::tvec3, detail::tvec2, detail::tvec3, detail::tvec4)
00092 #               endif//(defined(GLM_SWIZZLE))
00093 #       else //(GLM_COMPONENT == GLM_COMPONENT_ONLY_XYZW)
00094                 value_type x, y, z;
00095 
00096 #               if(defined(GLM_SWIZZLE))
00097                         
00098                         GLM_SWIZZLE_GEN_REF_FROM_VEC3_COMP(T, detail::tvec3, detail::tref2, detail::tref3, x, y, z)
00099                         GLM_SWIZZLE_GEN_VEC_FROM_VEC3_COMP(T, detail::tvec3, detail::tvec2, detail::tvec3, detail::tvec4, x, y, z)
00100 #               endif//(defined(GLM_SWIZZLE))
00101 #       endif//GLM_COMPONENT
00102 
00104                 
00105 
00106                 GLM_FUNC_DECL value_type & operator[](size_type i);
00107                 GLM_FUNC_DECL value_type const & operator[](size_type i) const;
00108 
00110                 
00111 
00112                 GLM_FUNC_DECL tvec3();
00113                 GLM_FUNC_DECL tvec3(tvec3<T> const & v);
00114 
00116                 
00117 
00118                 GLM_FUNC_DECL explicit tvec3(
00119                         ctor);
00120                 GLM_FUNC_DECL explicit tvec3(
00121                         value_type const & s);
00122                 GLM_FUNC_DECL explicit tvec3(
00123                         value_type const & s1, 
00124                         value_type const & s2, 
00125                         value_type const & s3);
00126 
00128                 
00129 
00131                 template <typename U> 
00132                 GLM_FUNC_DECL explicit tvec3(
00133                         U const & x);
00135                 template <typename U, typename V, typename W> 
00136                 GLM_FUNC_DECL explicit tvec3(
00137                         U const & x, 
00138                         V const & y, 
00139                         W const & z);                   
00140 
00142                 
00143 
00145                 template <typename A, typename B> 
00146                 GLM_FUNC_DECL explicit tvec3(tvec2<A> const & v, B const & s);
00148                 template <typename A, typename B> 
00149                 GLM_FUNC_DECL explicit tvec3(A const & s, tvec2<B> const & v);
00151                 template <typename U> 
00152                 GLM_FUNC_DECL explicit tvec3(tvec3<U> const & v);
00154                 template <typename U> 
00155                 GLM_FUNC_DECL explicit tvec3(tvec4<U> const & v);
00156 
00158                 
00159 
00160                 GLM_FUNC_DECL tvec3(tref3<T> const & r);
00161 
00162                 template <typename A, typename B> 
00163                 GLM_FUNC_DECL explicit tvec3(tref2<A> const & v, B const & s);
00164 
00165                 template <typename A, typename B> 
00166                 GLM_FUNC_DECL explicit tvec3(A const & s, tref2<B> const & v);
00167 
00168         template <int E0, int E1, int E2>
00169         GLM_FUNC_DECL tvec3(glm::detail::swizzle<3, T, tvec3<T>, E0, E1, E2, -1> const & that)
00170         {
00171             *this = that();
00172         }
00173 
00174         template <int E0, int E1>
00175         GLM_FUNC_DECL tvec3(glm::detail::swizzle<2, T, tvec2<T>, E0, E1, -1, -2> const & v, T const & s)
00176         {
00177             *this = tvec3<T>(v(), s);
00178         }
00179 
00180         template <int E0, int E1>
00181         GLM_FUNC_DECL tvec3(T const & s, glm::detail::swizzle<2, T, tvec2<T>, E0, E1, -1, -2> const & v)
00182         {
00183             *this = tvec3<T>(s, v());
00184         }
00185 
00187                 
00188 
00189                 GLM_FUNC_DECL tvec3<T> & operator= (tvec3<T> const & v);
00190                 template <typename U> 
00191                 GLM_FUNC_DECL tvec3<T> & operator= (tvec3<U> const & v);
00192 
00193                 template <typename U> 
00194                 GLM_FUNC_DECL tvec3<T> & operator+=(U const & s);
00195                 template <typename U> 
00196                 GLM_FUNC_DECL tvec3<T> & operator+=(tvec3<U> const & v);
00197                 template <typename U> 
00198                 GLM_FUNC_DECL tvec3<T> & operator-=(U const & s);
00199                 template <typename U> 
00200                 GLM_FUNC_DECL tvec3<T> & operator-=(tvec3<U> const & v);
00201                 template <typename U> 
00202                 GLM_FUNC_DECL tvec3<T> & operator*=(U const & s);
00203                 template <typename U> 
00204                 GLM_FUNC_DECL tvec3<T> & operator*=(tvec3<U> const & v);
00205                 template <typename U> 
00206                 GLM_FUNC_DECL tvec3<T> & operator/=(U const & s);
00207                 template <typename U> 
00208                 GLM_FUNC_DECL tvec3<T> & operator/=(tvec3<U> const & v);
00209                 GLM_FUNC_DECL tvec3<T> & operator++();
00210                 GLM_FUNC_DECL tvec3<T> & operator--();
00211 
00213                 
00214 
00215                 template <typename U>
00216                 GLM_FUNC_DECL tvec3<T> & operator%= (U const & s);
00217                 template <typename U>
00218                 GLM_FUNC_DECL tvec3<T> & operator%= (tvec3<U> const & v);
00219                 template <typename U>
00220                 GLM_FUNC_DECL tvec3<T> & operator&= (U const & s);
00221                 template <typename U>
00222                 GLM_FUNC_DECL tvec3<T> & operator&= (tvec3<U> const & v);
00223                 template <typename U>
00224                 GLM_FUNC_DECL tvec3<T> & operator|= (U const & s);
00225                 template <typename U>
00226                 GLM_FUNC_DECL tvec3<T> & operator|= (tvec3<U> const & v);
00227                 template <typename U>
00228                 GLM_FUNC_DECL tvec3<T> & operator^= (U const & s);
00229                 template <typename U>
00230                 GLM_FUNC_DECL tvec3<T> & operator^= (tvec3<U> const & v);
00231                 template <typename U>
00232                 GLM_FUNC_DECL tvec3<T> & operator<<=(U const & s);
00233                 template <typename U>
00234                 GLM_FUNC_DECL tvec3<T> & operator<<=(tvec3<U> const & v);
00235                 template <typename U>
00236                 GLM_FUNC_DECL tvec3<T> & operator>>=(U const & s);
00237                 template <typename U>
00238                 GLM_FUNC_DECL tvec3<T> & operator>>=(tvec3<U> const & v);
00239 
00241                 
00242 
00243                 GLM_FUNC_DECL value_type swizzle(comp X) const;
00244                 GLM_FUNC_DECL tvec2<T> swizzle(comp X, comp Y) const;
00245                 GLM_FUNC_DECL tvec3<T> swizzle(comp X, comp Y, comp Z) const;
00246                 GLM_FUNC_DECL tvec4<T> swizzle(comp X, comp Y, comp Z, comp W) const;
00247                 GLM_FUNC_DECL tref2<T> swizzle(comp X, comp Y);
00248                 GLM_FUNC_DECL tref3<T> swizzle(comp X, comp Y, comp Z);
00249         };
00250 
00251         template <typename T>
00252         struct tref3
00253         {
00254                 GLM_FUNC_DECL tref3(T & x, T & y, T & z);
00255                 GLM_FUNC_DECL tref3(tref3<T> const & r);
00256                 GLM_FUNC_DECL explicit tref3(tvec3<T> const & v);
00257 
00258                 GLM_FUNC_DECL tref3<T> & operator= (tref3<T> const & r);
00259                 GLM_FUNC_DECL tref3<T> & operator= (tvec3<T> const & v);
00260 
00261                 GLM_FUNC_DECL tvec3<T> operator() ();
00262 
00263                 T & x;
00264                 T & y;
00265                 T & z;
00266         };
00267 
00268         GLM_DETAIL_IS_VECTOR(tvec3);
00269 } 
00270 
00273 
00279         typedef detail::tvec3<highp_float>              highp_vec3;
00280 
00286         typedef detail::tvec3<mediump_float>    mediump_vec3;
00287 
00293         typedef detail::tvec3<lowp_float>               lowp_vec3;
00294 
00300         typedef detail::tvec3<highp_int>                highp_ivec3;
00301 
00307         typedef detail::tvec3<mediump_int>              mediump_ivec3;
00308 
00314         typedef detail::tvec3<lowp_int>                 lowp_ivec3;
00315 
00321         typedef detail::tvec3<highp_uint>               highp_uvec3;
00322 
00328         typedef detail::tvec3<mediump_uint>             mediump_uvec3;
00329 
00335         typedef detail::tvec3<lowp_uint>                lowp_uvec3;
00336 
00338 }
00339 
00340 #ifndef GLM_EXTERNAL_TEMPLATE
00341 #include "type_vec3.inl"
00342 #endif//GLM_EXTERNAL_TEMPLATE
00343 
00344 #endif//glm_core_type_gentype3