Changeset 2087 for GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs
- Timestamp:
- 02/05/07 13:28:27 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/SimplificationMethod.h
r1526 r2087 10 10 11 11 using namespace Geometry; 12 12 using namespace std; 13 14 //------------------------------------------------------------------------- 15 // Class to create a map without repeated vertices 16 //------------------------------------------------------------------------- 17 class _float3_ 18 { 19 public: 20 21 float x,y,z; 22 23 _float3_(float x=0.0f, float y=0.0f, float z=0.0f) 24 { 25 this->x = x; this->y = y; this->z = z; 26 } 27 28 _float3_(const _float3_ &f) 29 { 30 x=f.x; y=f.y; z=f.z; 31 } 32 33 _float3_ & operator=(const _float3_ &f) 34 { 35 x=f.x; y=f.y; z=f.z; return *this; 36 } 37 38 bool operator<(const _float3_ &f) const 39 { 40 if (x<f.x) return true; 41 if (x>f.x) return false; 42 if (y<f.y) return true; 43 if (y>f.y) return false; 44 if (z<f.z) return true; 45 if (z>f.z) return false; 46 return false; 47 } 48 }; 49 50 //------------------------------------------------------------------------- 51 // Class to perform mesh simplification. 52 //------------------------------------------------------------------------- 13 53 class SimplificationMethod 14 54 { … … 21 61 simplif::Model M0; 22 62 23 simplif:: array<simplif::vert_info> vinfo;63 simplif::buffer<simplif::vert_info> vinfo; 24 64 25 65 simplif::Heap *heap; … … 90 130 std::map< int, std::vector<int> > vertexbuffermap; 91 131 132 // Multimap to store current vertex in a simplification state. 133 typedef multimap<_float3_, int> vertex_map; 134 typedef vertex_map::iterator vertex_map_str; 135 typedef vertex_map::value_type vertex_pair; 136 137 // Store unique vertices by submesh (without repetitions). 138 typedef std::map<int,int> MAPAINDIND; 139 140 // Store all the indices by submesh (with repetitions). 141 typedef std::vector<int> REPINDLIST; 142 143 vertex_map vertexMultimap; 144 92 145 // Simplification sequence of the simplification method. 93 146 std::vector<Geometry::MeshSimplificationSequence::Step> decim_data; … … 101 154 int indexMeshLeaves; 102 155 103 // Contract lonely vertices that have same coords than the contracted one. 156 // Contract lonely vertices that have same coords 157 // than the contracted one. 104 158 void contractLonelyVertices( simplif::Model &m, 105 159 simplif::Vertex *v0, … … 107 161 simplif::Vec3 candidate); 108 162 109 // Remove twin edges. 110 void removeTwinEdges(simplif::Model &m, 111 simplif::Vertex *v0, 112 simplif::Vertex *v1, 113 simplif::Vec3 candidate); 163 // Find twin vertices to the contracted one and contract them. 164 void removeTwinVertices( simplif::Model &m, 165 simplif::Vertex *v0, 166 simplif::Vertex *v1, 167 simplif::Vec3 candidate); 168 169 void fillUpSharedVertices( MAPAINDIND &shared_vertex_map, 170 REPINDLIST *ver_inds_rep_by_geo); 171 172 void fillUpVertices( MAPAINDIND *unique_verts_inds_by_geo, 173 REPINDLIST *ver_inds_rep_by_geo); 174 175 void addNewBoneAssignments(); 176 177 void eraseVoidSubMeshes(Mesh *geoMesh); 114 178 115 179 public: 116 180 117 const Geometry::Mesh *objmesh;181 Mesh *mInitialMesh; 118 182 119 183 // Total number of triangles of all the submeshes. 120 184 int number_of_triangles; 121 185 122 SimplificationMethod(const Geometry::Mesh *m); 123 124 void generateSimplifModel(void); 125 126 Geometry::MeshSimplificationSequence *Decimate( float lod, 127 int simpliftype, 128 Geometry::TIPOFUNC upb=0); 129 130 void setMeshLeaves(int meshLeaves); 131 132 /// Gets mesh simplified. 133 Geometry::Mesh * GetMesh(); 186 /// Constructor. 187 SimplificationMethod(const Mesh *m); 134 188 135 189 /// Destructor. 136 190 ~SimplificationMethod(); 191 192 void generateSimplifModel(void); 193 194 MeshSimplificationSequence *Decimate( float lod, 195 int simpliftype, 196 TIPOFUNC upb=0); 197 198 void setMeshLeaves(int meshLeaves); 199 200 /// Gets mesh simplified. 201 Mesh * GetMesh(); 202 137 203 }; 138 204
Note: See TracChangeset
for help on using the changeset viewer.