[774] | 1 | #include "GeoMeshSimplifier.h"
|
---|
| 2 | #include "GeoMeshSimpSequence.h"
|
---|
| 3 | #include "SimplificationMethod.h"
|
---|
| 4 | #include <iostream>
|
---|
| 5 | #include <fstream>
|
---|
| 6 |
|
---|
| 7 | using namespace Geometry;
|
---|
| 8 | using namespace std;
|
---|
| 9 |
|
---|
| 10 | MeshSimplifier::MeshSimplifier( const Geometry::Mesh *m,
|
---|
| 11 | Geometry::TIPOFUNC upb)
|
---|
| 12 | {
|
---|
| 13 | objmesh = m;
|
---|
| 14 | meshsalida = NULL;
|
---|
| 15 | msimpsequence = NULL;
|
---|
| 16 | indexMeshLeaves = -1;
|
---|
| 17 |
|
---|
| 18 | // Sets the actual progress bar function.
|
---|
| 19 | mUPB = upb;
|
---|
| 20 | }
|
---|
| 21 |
|
---|
| 22 | MeshSimplifier::~MeshSimplifier()
|
---|
| 23 | {
|
---|
| 24 | delete msimpsequence;
|
---|
| 25 | }
|
---|
| 26 |
|
---|
| 27 | // Returns the simplified mesh.
|
---|
| 28 | Geometry::Mesh *MeshSimplifier::GetMesh ()
|
---|
| 29 | {
|
---|
| 30 | return meshsalida;
|
---|
| 31 | }
|
---|
| 32 |
|
---|
| 33 | void MeshSimplifier::setMeshLeaves(Geometry::Index index)
|
---|
| 34 | {
|
---|
| 35 | indexMeshLeaves = index;
|
---|
| 36 | }
|
---|
| 37 |
|
---|
| 38 | // Returns the simplification sequence for general meshes.
|
---|
| 39 | Geometry::MeshSimplificationSequence *MeshSimplifier::GetSimplificationSequence()
|
---|
| 40 | {
|
---|
| 41 | return msimpsequence;
|
---|
| 42 | }
|
---|
| 43 |
|
---|
[891] | 44 | GeometryBasedSimplifier::GeometryBasedSimplifier (const Geometry::Mesh *m,
|
---|
[774] | 45 | Geometry::TIPOFUNC upb)
|
---|
| 46 | :MeshSimplifier(m,upb)
|
---|
| 47 | {
|
---|
| 48 | }
|
---|
| 49 |
|
---|
[891] | 50 | GeometryBasedSimplifier::~GeometryBasedSimplifier()
|
---|
[774] | 51 | {
|
---|
| 52 | }
|
---|
| 53 |
|
---|
| 54 | // Starts the simplification process. Receives as a parameter the LOD factor in a range of [0,1]. Implements the Simplifier::Simplify method to perform an image based simplification.
|
---|
[891] | 55 | void GeometryBasedSimplifier::Simplify (Geometry::Real paramlod)
|
---|
[774] | 56 | {
|
---|
| 57 | SimplificationMethod *m_qslim = new SimplificationMethod(objmesh);
|
---|
| 58 |
|
---|
| 59 | m_qslim->setMeshLeaves(indexMeshLeaves);
|
---|
| 60 |
|
---|
| 61 | msimpsequence = m_qslim->Decimate(paramlod,&meshsalida,0,mUPB);
|
---|
| 62 |
|
---|
| 63 | delete m_qslim;
|
---|
| 64 | }
|
---|
| 65 |
|
---|
| 66 | // Starts the simplification process. Receives as a parameter the number of vertices of the resulting mesh. Implements the Simplifier::Simplify method to perform an image based simplification.
|
---|
[891] | 67 | void GeometryBasedSimplifier::Simplify (Geometry::uint32 numvertices)
|
---|
[774] | 68 | {
|
---|
| 69 | SimplificationMethod *m_qslim = new SimplificationMethod(objmesh);
|
---|
| 70 |
|
---|
| 71 | m_qslim->setMeshLeaves(indexMeshLeaves);
|
---|
| 72 |
|
---|
| 73 | msimpsequence = m_qslim->Decimate((float)numvertices,&meshsalida,1,mUPB);
|
---|
| 74 |
|
---|
| 75 | delete m_qslim;
|
---|
| 76 | }
|
---|
| 77 |
|
---|