#include "GeoMeshSimplifier.h" #include "GeoMeshSimpSequence.h" #include "SimplificationMethod.h" #include #include using namespace Geometry; using namespace std; MeshSimplifier::MeshSimplifier( const Geometry::Mesh *m, Geometry::TIPOFUNC upb) { objmesh = m; meshsalida = NULL; msimpsequence = NULL; indexMeshLeaves = -1; // Sets the actual progress bar function. mUPB = upb; } MeshSimplifier::~MeshSimplifier() { delete msimpsequence; } // Returns the simplified mesh. Geometry::Mesh *MeshSimplifier::GetMesh () { return meshsalida; } void MeshSimplifier::setMeshLeaves(Geometry::Index index) { indexMeshLeaves = index; } // Returns the simplification sequence for general meshes. Geometry::MeshSimplificationSequence *MeshSimplifier::GetSimplificationSequence() { return msimpsequence; } ImageBasedSimplifier::ImageBasedSimplifier (const Geometry::Mesh *m, Geometry::TIPOFUNC upb) :MeshSimplifier(m,upb) { } ImageBasedSimplifier::~ImageBasedSimplifier() { } // 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. void ImageBasedSimplifier::Simplify (Geometry::Real paramlod) { SimplificationMethod *m_qslim = new SimplificationMethod(objmesh); m_qslim->setMeshLeaves(indexMeshLeaves); msimpsequence = m_qslim->Decimate(paramlod,&meshsalida,0,mUPB); delete m_qslim; } // 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. void ImageBasedSimplifier::Simplify (Geometry::uint32 numvertices) { SimplificationMethod *m_qslim = new SimplificationMethod(objmesh); m_qslim->setMeshLeaves(indexMeshLeaves); msimpsequence = m_qslim->Decimate((float)numvertices,&meshsalida,1,mUPB); delete m_qslim; }