Loading...
Searching...
No Matches
ModProgMeshT.hh
Go to the documentation of this file.
/* ========================================================================= *
* *
* OpenMesh *
* Copyright (c) 2001-2025, RWTH-Aachen University *
* Department of Computer Graphics and Multimedia *
* All rights reserved. *
* www.openmesh.org *
* *
*---------------------------------------------------------------------------*
* This file is part of OpenMesh. *
*---------------------------------------------------------------------------*
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright notice, *
* this list of conditions and the following disclaimer. *
* *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* 3. Neither the name of the copyright holder nor the names of its *
* contributors may be used to endorse or promote products derived from *
* this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
* *
* ========================================================================= */
//=============================================================================
//
// CLASS ModProgMeshT
//
//=============================================================================
#ifndef OPENMESH_TOOLS_MODPROGMESHT_HH
#define OPENMESH_TOOLS_MODPROGMESHT_HH
//== INCLUDES =================================================================
#include <OpenMesh/Tools/Decimater/ModBaseT.hh>
#include <OpenMesh/Core/Utils/Property.hh>
//== NAMESPACE ================================================================
namespace OpenMesh {
namespace Decimater {
//== CLASS DEFINITION =========================================================
template <class MeshT>
class ModProgMeshT : public ModBaseT<MeshT>
{
public:
DECIMATING_MODULE( ModProgMeshT, MeshT, ProgMesh );
struct Info
{
explicit Info( const CollapseInfo& _ci )
: v0(_ci.v0), v1(_ci.v1), vl(_ci.vl),vr(_ci.vr)
{}
typename Mesh::VertexHandle v0;
typename Mesh::VertexHandle v1;
typename Mesh::VertexHandle vl;
typename Mesh::VertexHandle vr;
};
typedef std::vector<Info> InfoList;
public:
explicit ModProgMeshT( MeshT &_mesh ) : Base(_mesh, true)
{
Base::mesh().add_property( idx_ );
}
~ModProgMeshT()
{
Base::mesh().remove_property( idx_ );
}
const InfoList& pmi() const
{
return pmi_;
}
public: // inherited
void postprocess_collapse(const CollapseInfo& _ci) override
{
pmi_.push_back( Info( _ci ) );
}
bool is_binary(void) const { return true; }
public: // specific methods
bool write( const std::string& _ofname );
const InfoList& infolist() const { return pmi_; }
private:
InfoList pmi_;
VPropHandleT<size_t> idx_;
};
//=============================================================================
} // END_NS_DECIMATER
} // END_NS_OPENMESH
//=============================================================================
#if defined(OM_INCLUDE_TEMPLATES) && !defined(OPENMESH_DECIMATER_MODPROGMESH_CC)
#define OSG_MODPROGMESH_TEMPLATES
#include "ModProgMeshT_impl.hh"
#endif
//=============================================================================
#endif // OPENMESH_TOOLS_PROGMESHT_HH defined
//=============================================================================
ModBaseT.hh
Base class for all decimation modules.
DECIMATING_MODULE
#define DECIMATING_MODULE(Classname, MeshT, Name)
Convenience macro, to be used in derived modules The macro defines the types.
Definition ModBaseT.hh:149
ModProgMeshT_impl.hh
OpenMesh
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition MeshItems.hh:59
OpenMesh::Decimater
Software related to mesh decimation.
OpenMesh::PolyMeshT< AttribKernel >::VertexHandle
AttribKernel::VertexHandle VertexHandle
Definition PolyMeshT.hh:136
OpenMesh::VPropHandleT
Handle representing a vertex property.
Definition Property.hh:417
OpenMesh::Decimater::ModBaseT::ModBaseT
ModBaseT(MeshT &_mesh, bool _is_binary)
Default constructor.
Definition ModBaseT.hh:207
OpenMesh::Decimater::ModProgMeshT::write
bool write(const std::string &_ofname)
Write progressive mesh data to a file in proprietary binary format .pm.
Definition ModProgMeshT_impl.hh:82
OpenMesh::Decimater::ModProgMeshT::postprocess_collapse
void postprocess_collapse(const CollapseInfo &_ci) override
Stores collapse information in a queue.
Definition ModProgMeshT.hh:133
OpenMesh::Decimater::ModProgMeshT< Mesh >::InfoList
std::vector< Info > InfoList
Definition ModProgMeshT.hh:105
OpenMesh::Decimater::ModProgMeshT::infolist
const InfoList & infolist() const
Reference to collected information.
Definition ModProgMeshT.hh:170
OpenMesh::Decimater::ModProgMeshT::~ModProgMeshT
~ModProgMeshT()
Destructor.
Definition ModProgMeshT.hh:118
OpenMesh::Decimater::ModProgMeshT::ModProgMeshT
ModProgMeshT(MeshT &_mesh)
Constructor.
Definition ModProgMeshT.hh:111
OpenMesh::Decimater::ModProgMeshT::Info::vl
Mesh::VertexHandle vl
See CollapseInfoT::vl.
Definition ModProgMeshT.hh:99
OpenMesh::Decimater::ModProgMeshT::Info::v1
Mesh::VertexHandle v1
See CollapseInfoT::v1.
Definition ModProgMeshT.hh:98
OpenMesh::Decimater::ModProgMeshT::Info::vr
Mesh::VertexHandle vr
See CollapseInfoT::vr.
Definition ModProgMeshT.hh:100
OpenMesh::Decimater::ModProgMeshT::Info::v0
Mesh::VertexHandle v0
See CollapseInfoT::v0.
Definition ModProgMeshT.hh:97
OpenMesh::Decimater::ModProgMeshT::Info::Info
Info(const CollapseInfo &_ci)
Initializing constructor copies appropriate handles from collapse information _ci.
Definition ModProgMeshT.hh:93