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 #pragma once 00030 00031 namespace glm 00032 { 00033 enum profile 00034 { 00035 nice, 00036 fast, 00037 simd 00038 }; 00039 00040 typedef std::size_t sizeType; 00041 00042 namespace detail 00043 { 00044 template 00045 < 00046 typename VALTYPE, 00047 template <typename> class TYPE 00048 > 00049 struct genType 00050 { 00051 public: 00052 enum ctor{null}; 00053 00054 typedef VALTYPE value_type; 00055 typedef VALTYPE & value_reference; 00056 typedef VALTYPE * value_pointer; 00057 typedef VALTYPE const * value_const_pointer; 00058 typedef TYPE<bool> bool_type; 00059 00060 typedef sizeType size_type; 00061 static bool is_vector(); 00062 static bool is_matrix(); 00063 00064 typedef TYPE<VALTYPE> type; 00065 typedef TYPE<VALTYPE> * pointer; 00066 typedef TYPE<VALTYPE> const * const_pointer; 00067 typedef TYPE<VALTYPE> const * const const_pointer_const; 00068 typedef TYPE<VALTYPE> * const pointer_const; 00069 typedef TYPE<VALTYPE> & reference; 00070 typedef TYPE<VALTYPE> const & const_reference; 00071 typedef TYPE<VALTYPE> const & param_type; 00072 00074 // Address (Implementation details) 00075 00076 value_const_pointer value_address() const{return value_pointer(this);} 00077 value_pointer value_address(){return value_pointer(this);} 00078 00079 //protected: 00080 // enum kind 00081 // { 00082 // GEN_TYPE, 00083 // VEC_TYPE, 00084 // MAT_TYPE 00085 // }; 00086 00087 // typedef typename TYPE::kind kind; 00088 }; 00089 00090 template 00091 < 00092 typename VALTYPE, 00093 template <typename> class TYPE 00094 > 00095 bool genType<VALTYPE, TYPE>::is_vector() 00096 { 00097 return true; 00098 } 00099 /* 00100 template <typename valTypeT, unsigned int colT, unsigned int rowT, profile proT = nice> 00101 class base 00102 { 00103 public: 00105 // Traits 00106 00107 typedef sizeType size_type; 00108 typedef valTypeT value_type; 00109 00110 typedef base<value_type, colT, rowT> class_type; 00111 00112 typedef base<bool, colT, rowT> bool_type; 00113 typedef base<value_type, rowT, 1> col_type; 00114 typedef base<value_type, colT, 1> row_type; 00115 typedef base<value_type, rowT, colT> transpose_type; 00116 00117 static size_type col_size(); 00118 static size_type row_size(); 00119 static size_type value_size(); 00120 static bool is_scalar(); 00121 static bool is_vector(); 00122 static bool is_matrix(); 00123 00124 private: 00125 // Data 00126 col_type value[colT]; 00127 00128 public: 00130 // Constructors 00131 base(); 00132 base(class_type const & m); 00133 00134 explicit base(T const & x); 00135 explicit base(value_type const * const x); 00136 explicit base(col_type const * const x); 00137 00139 // Conversions 00140 template <typename vU, uint cU, uint rU, profile pU> 00141 explicit base(base<vU, cU, rU, pU> const & m); 00142 00144 // Accesses 00145 col_type& operator[](size_type i); 00146 col_type const & operator[](size_type i) const; 00147 00149 // Unary updatable operators 00150 class_type& operator= (class_type const & x); 00151 class_type& operator+= (T const & x); 00152 class_type& operator+= (class_type const & x); 00153 class_type& operator-= (T const & x); 00154 class_type& operator-= (class_type const & x); 00155 class_type& operator*= (T const & x); 00156 class_type& operator*= (class_type const & x); 00157 class_type& operator/= (T const & x); 00158 class_type& operator/= (class_type const & x); 00159 class_type& operator++ (); 00160 class_type& operator-- (); 00161 }; 00162 */ 00163 00164 //template <typename T> 00165 //struct traits 00166 //{ 00167 // static const bool is_signed = false; 00168 // static const bool is_float = false; 00169 // static const bool is_vector = false; 00170 // static const bool is_matrix = false; 00171 // static const bool is_genType = false; 00172 // static const bool is_genIType = false; 00173 // static const bool is_genUType = false; 00174 //}; 00175 00176 //template <> 00177 //struct traits<half> 00178 //{ 00179 // static const bool is_float = true; 00180 // static const bool is_genType = true; 00181 //}; 00182 00183 //template <> 00184 //struct traits<float> 00185 //{ 00186 // static const bool is_float = true; 00187 // static const bool is_genType = true; 00188 //}; 00189 00190 //template <> 00191 //struct traits<double> 00192 //{ 00193 // static const bool is_float = true; 00194 // static const bool is_genType = true; 00195 //}; 00196 00197 //template <typename genType> 00198 //struct desc 00199 //{ 00200 // typedef genType type; 00201 // typedef genType * pointer; 00202 // typedef genType const* const_pointer; 00203 // typedef genType const *const const_pointer_const; 00204 // typedef genType *const pointer_const; 00205 // typedef genType & reference; 00206 // typedef genType const& const_reference; 00207 // typedef genType const& param_type; 00208 00209 // typedef typename genType::value_type value_type; 00210 // typedef typename genType::size_type size_type; 00211 // static const typename size_type value_size; 00212 //}; 00213 00214 //template <typename genType> 00215 //const typename desc<genType>::size_type desc<genType>::value_size = genType::value_size(); 00216 00217 }//namespace detail 00218 }//namespace glm 00219 00220 //#include "type_gentype.inl"