[774] | 1 | #pragma once
|
---|
| 2 |
|
---|
| 3 | #include <set>
|
---|
| 4 | #include <map>
|
---|
| 5 | #include <vector>
|
---|
| 6 | #include <list>
|
---|
| 7 | #include <iostream>
|
---|
| 8 | #include <qslim.h>
|
---|
| 9 | #include <GeoMeshSimplifier.h>
|
---|
| 10 |
|
---|
| 11 | class SimplificationMethod
|
---|
| 12 | {
|
---|
| 13 | private:
|
---|
| 14 | void compute_pair_info(qslim::pair_info*);
|
---|
| 15 | qslim::Model M0;
|
---|
| 16 | qslim::array<qslim::vert_info> vinfo;
|
---|
| 17 | qslim::Heap *heap;
|
---|
| 18 | qslim::real proximity_limit; // distance threshold squared
|
---|
| 19 | int initialVertCount;
|
---|
| 20 | int initialEdgeCount;
|
---|
| 21 | int initialFaceCount;
|
---|
| 22 |
|
---|
| 23 | inline qslim::vert_info& vertex_info(qslim::Vertex *v){ return vinfo(v->validID()); }
|
---|
| 24 | qslim::real pair_mesh_penalty(qslim::Model& M, qslim::Vertex *v1, qslim::Vertex *v2, qslim::Vec3& vnew);
|
---|
| 25 | int predict_face(qslim::Face& F, qslim::Vertex *v1, qslim::Vertex *v2, qslim::Vec3& vnew, qslim::Vec3& f1, qslim::Vec3& f2, qslim::Vec3& f3);
|
---|
| 26 | bool check_for_pair(qslim::Vertex *v0, qslim::Vertex *v1);
|
---|
| 27 | qslim::pair_info *new_pair(qslim::Vertex *v0, qslim::Vertex *v1);
|
---|
| 28 | void delete_pair(qslim::pair_info *pair);
|
---|
| 29 | void do_contract(qslim::Model& m, qslim::pair_info *pair);
|
---|
| 30 | bool decimate_quadric(qslim::Vertex *v, qslim::Mat4& Q);
|
---|
| 31 | void decimate_contract(qslim::Model& m);
|
---|
| 32 | qslim::real decimate_error(qslim::Vertex *v);
|
---|
| 33 | qslim::real decimate_min_error();
|
---|
| 34 | qslim::real decimate_max_error(qslim::Model& m);
|
---|
| 35 | void decimate_init(qslim::Model& m, qslim::real limit);
|
---|
| 36 | bool pair_is_valid(qslim::Vertex *u, qslim::Vertex *v);
|
---|
| 37 | void simplfmethod_run(int, Geometry::TIPOFUNC upb=0);
|
---|
| 38 | void simplfmethod_runv(int, Geometry::TIPOFUNC upb=0);
|
---|
| 39 | void simplfmethod_init(void);
|
---|
| 40 |
|
---|
| 41 | //To map the mesh with de simplification method structure
|
---|
| 42 | std::map<int,std::vector<int> > submeshmap; //submeshes which pertains each vertex
|
---|
| 43 | std::map<int,std::vector<int> > vertexbuffermap; //vertices of the VertexBuffer that point at this vertex of the simplification method
|
---|
| 44 |
|
---|
| 45 | //simplification sequence of the simplification method
|
---|
| 46 | std::vector<Geometry::MeshSimplificationSequence::Step> decim_data;
|
---|
| 47 | std::string meshName;
|
---|
| 48 | void WriteOBJ(void);
|
---|
| 49 | unsigned int *first_index_submesh;
|
---|
| 50 | //std::vector<qslim::pair_info *> pointers_to_remove;
|
---|
| 51 |
|
---|
| 52 | int indexMeshLeaves;
|
---|
| 53 | public:
|
---|
| 54 | const Geometry::Mesh *objmesh;
|
---|
| 55 | int number_of_triangles; //total number of triangles of all the submeshes
|
---|
| 56 | SimplificationMethod(const Geometry::Mesh *m);
|
---|
| 57 | void geomesh2simplifModel(void);
|
---|
| 58 | Geometry::MeshSimplificationSequence *Decimate(float lod, Geometry::Mesh **mesh, int simpliftype,Geometry::TIPOFUNC upb=0);
|
---|
| 59 | void setMeshLeaves(int meshLeaves);
|
---|
| 60 |
|
---|
| 61 | ///Destructor
|
---|
| 62 | ~SimplificationMethod();
|
---|
| 63 | };
|
---|