00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00035
00036
00037
00038
00039
00040
00041 #ifndef OPENMESH_TOOLS_MODPROGMESHT_HH
00042 #define OPENMESH_TOOLS_MODPROGMESHT_HH
00043
00044
00045
00046
00047 #include <OpenMesh/Tools/Decimater/ModBaseT.hh>
00048 #include <OpenMesh/Core/Utils/Property.hh>
00049
00050
00051
00052
00053 namespace OpenMesh {
00054 namespace Decimater {
00055
00056
00057
00058
00059
00066 template <class DecimaterType>
00067 class ModProgMeshT : public ModBaseT<DecimaterType>
00068 {
00069 public:
00070
00071 DECIMATING_MODULE( ModProgMeshT, DecimaterType, ProgMesh );
00072
00076 struct Info
00077 {
00080 Info( const CollapseInfo& _ci )
00081 : v0(_ci.v0), v1(_ci.v1), vl(_ci.vl),vr(_ci.vr)
00082 {}
00083
00084 typename Mesh::VertexHandle v0;
00085 typename Mesh::VertexHandle v1;
00086 typename Mesh::VertexHandle vl;
00087 typename Mesh::VertexHandle vr;
00088
00089 };
00090
00092 typedef std::vector<Info> InfoList;
00093
00094
00095 public:
00096
00098 ModProgMeshT( DecimaterType &_dec ) : Base(_dec, true)
00099 {
00100 Self::mesh().add_property( idx_ );
00101 }
00102
00103
00105 ~ModProgMeshT()
00106 {
00107 Self::mesh().remove_property( idx_ );
00108 }
00109
00110 const InfoList& pmi() const
00111 {
00112 return pmi_;
00113 }
00114
00115 public:
00116
00117
00120 void postprocess_collapse(const CollapseInfo& _ci)
00121 {
00122 pmi_.push_back( Info( _ci ) );
00123 }
00124
00125
00126 bool is_binary(void) const { return true; }
00127
00128
00129
00130 void set_binary(bool _b)
00131 {
00132 if (!_b)
00133 {
00134 std::cerr << "ModNormalFlippingT can only be used binary\n";
00135 exit(1);
00136 }
00137 }
00138
00139
00140 public:
00141
00166 bool write( const std::string& _ofname );
00168 const InfoList& infolist() const { return pmi_; }
00169
00170
00171
00172 InfoList pmi_;
00173 VPropHandleT<int> idx_;
00174 };
00175
00176
00177
00178 }
00179 }
00180
00181 #if defined(OM_INCLUDE_TEMPLATES) && !defined(OPENMESH_DECIMATER_MODPROGMESH_CC)
00182 #define OSG_MODPROGMESH_TEMPLATES
00183 #include "ModProgMeshT.cc"
00184 #endif
00185
00186 #endif // OPENMESH_TOOLS_PROGMESHT_HH defined
00187
00188