type_vec1.hpp
Go to the documentation of this file.
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_gentype1
00030 #define glm_core_type_gentype1
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 tref1;
00042         template <typename T> struct tref2;
00043         template <typename T> struct tref3;
00044         template <typename T> struct tref4;
00045         template <typename T> struct tvec1;
00046         template <typename T> struct tvec2;
00047         template <typename T> struct tvec3;
00048         template <typename T> struct tvec4;
00049 
00050         template <typename T>
00051         struct tvec1
00052         {
00053                 enum ctor{null};
00054 
00055                 typedef T value_type;
00056                 typedef std::size_t size_type;
00057                 GLM_FUNC_DECL size_type length() const;
00058                 static GLM_FUNC_DECL size_type value_size();
00059 
00060                 typedef tvec1<T> type;
00061                 typedef tvec1<bool> bool_type;
00062 
00064                 // Data
00065 
00066 #               if(GLM_COMPONENT == GLM_COMPONENT_ONLY_XYZW)
00067                         value_type x;
00068 #               else//(GLM_COMPONENT == GLM_COMPONENT_GLSL_NAMES)
00069                         union {value_type x, r, s;};
00070 #               endif//GLM_COMPONENT
00071 
00073                 // Accesses
00074 
00075                 GLM_FUNC_DECL value_type & operator[](size_type i);
00076                 GLM_FUNC_DECL value_type const & operator[](size_type i) const;
00077 
00079                 // Implicit basic constructors
00080 
00081                 GLM_FUNC_DECL tvec1();
00082                 GLM_FUNC_DECL tvec1(tvec1<T> const & v);
00083 
00085                 // Explicit basic constructors
00086 
00087                 GLM_FUNC_DECL explicit tvec1(
00088                         ctor);
00089                 GLM_FUNC_DECL explicit tvec1(
00090                         value_type const & s);
00091 
00093                 // Swizzle constructors
00094 
00095                 GLM_FUNC_DECL tvec1(tref1<T> const & r);
00096 
00098                 // Convertion scalar constructors
00099 
00101                 template <typename U> 
00102                 GLM_FUNC_DECL explicit tvec1(U const & s);
00103 
00105                 // Convertion vector constructors
00106 
00108                 template <typename U> 
00109                 GLM_FUNC_DECL explicit tvec1(tvec2<U> const & v);
00111                 template <typename U> 
00112                 GLM_FUNC_DECL explicit tvec1(tvec3<U> const & v);
00114                 template <typename U> 
00115                 GLM_FUNC_DECL explicit tvec1(tvec4<U> const & v);
00116 
00118                 // Unary arithmetic operators
00119 
00120                 GLM_FUNC_DECL tvec1<T> & operator= (tvec1<T> const & v);
00121 
00122                 GLM_FUNC_DECL tvec1<T> & operator+=(value_type const & s);
00123                 GLM_FUNC_DECL tvec1<T> & operator+=(tvec1<T> const & v);
00124                 GLM_FUNC_DECL tvec1<T> & operator-=(value_type const & s);
00125                 GLM_FUNC_DECL tvec1<T> & operator-=(tvec1<T> const & v);
00126                 GLM_FUNC_DECL tvec1<T> & operator*=(value_type const & s);
00127                 GLM_FUNC_DECL tvec1<T> & operator*=(tvec1<T> const & v);
00128                 GLM_FUNC_DECL tvec1<T> & operator/=(value_type const & s);
00129                 GLM_FUNC_DECL tvec1<T> & operator/=(tvec1<T> const & v);
00130                 GLM_FUNC_DECL tvec1<T> & operator++();
00131                 GLM_FUNC_DECL tvec1<T> & operator--();
00132 
00134                 // Unary bit operators
00135 
00136                 GLM_FUNC_DECL tvec1<T> & operator%=(value_type const & s);
00137                 GLM_FUNC_DECL tvec1<T> & operator%=(tvec1<T> const & v);
00138                 GLM_FUNC_DECL tvec1<T> & operator&=(value_type const & s);
00139                 GLM_FUNC_DECL tvec1<T> & operator&=(tvec1<T> const & v);
00140                 GLM_FUNC_DECL tvec1<T> & operator|=(value_type const & s);
00141                 GLM_FUNC_DECL tvec1<T> & operator|=(tvec1<T> const & v);
00142                 GLM_FUNC_DECL tvec1<T> & operator^=(value_type const & s);
00143                 GLM_FUNC_DECL tvec1<T> & operator^=(tvec1<T> const & v);
00144                 GLM_FUNC_DECL tvec1<T> & operator<<=(value_type const & s);
00145                 GLM_FUNC_DECL tvec1<T> & operator<<=(tvec1<T> const & v);
00146                 GLM_FUNC_DECL tvec1<T> & operator>>=(value_type const & s);
00147                 GLM_FUNC_DECL tvec1<T> & operator>>=(tvec1<T> const & v);
00148 
00150                 // Swizzle operators
00151 
00152                 GLM_FUNC_DECL value_type swizzle(comp X) const;
00153                 GLM_FUNC_DECL tvec2<T> swizzle(comp X, comp Y) const;
00154                 GLM_FUNC_DECL tvec3<T> swizzle(comp X, comp Y, comp Z) const;
00155                 GLM_FUNC_DECL tvec4<T> swizzle(comp X, comp Y, comp Z, comp W) const;
00156                 GLM_FUNC_DECL tref1<T> swizzle(comp X);
00157         };
00158 
00159         template <typename T>
00160         struct tref1
00161         {
00162                 GLM_FUNC_DECL tref1(T & x);
00163                 GLM_FUNC_DECL tref1(tref1<T> const & r);
00164                 GLM_FUNC_DECL tref1(tvec1<T> const & v);
00165 
00166                 GLM_FUNC_DECL tref1<T> & operator= (tref1<T> const & r);
00167                 GLM_FUNC_DECL tref1<T> & operator= (tvec1<T> const & v);
00168 
00169                 T& x;
00170         };
00171 
00172         GLM_DETAIL_IS_VECTOR(tvec1);
00173 
00174         typedef detail::tvec1<highp_float>              highp_vec1_t;
00175         typedef detail::tvec1<mediump_float>    mediump_vec1_t;
00176         typedef detail::tvec1<lowp_float>               lowp_vec1_t;
00177         typedef detail::tvec1<highp_int>                highp_ivec1_t;
00178         typedef detail::tvec1<mediump_int>              mediump_ivec1_t;
00179         typedef detail::tvec1<lowp_int>                 lowp_ivec1_t;
00180         typedef detail::tvec1<highp_uint>               highp_uvec1_t;
00181         typedef detail::tvec1<mediump_uint>             mediump_uvec1_t;
00182         typedef detail::tvec1<lowp_uint>                lowp_uvec1_t;
00183 
00184 }//namespace detail
00185 }//namespace glm
00186 
00187 #ifndef GLM_EXTERNAL_TEMPLATE
00188 #include "type_vec1.inl"
00189 #endif//GLM_EXTERNAL_TEMPLATE
00190 
00191 #endif//glm_core_type_gentype1