52 #ifndef __EXPORTERT_HH__ 
   53 #define __EXPORTERT_HH__ 
   62 #include <OpenMesh/Core/System/config.h> 
   63 #include <OpenMesh/Core/Geometry/VectorT.hh> 
   64 #include <OpenMesh/Core/Utils/GenProg.hh> 
   65 #include <OpenMesh/Core/Utils/vector_cast.hh> 
   66 #include <OpenMesh/Core/Utils/color_cast.hh> 
   67 #include <OpenMesh/Core/IO/exporter/BaseExporter.hh> 
   68 #include <OpenMesh/Core/IO/OMFormat.hh> 
   95     return vector_cast<Vec3f>(mesh_.point(_vh));
 
  100     return vector_cast<Vec3d>(mesh_.point(_vh));
 
  103   bool is_point_double()
 const override 
  105     return OMFormat::is_double(
typename Mesh::Point()[0]);
 
  108   bool is_normal_double()
 const override 
  115     return (mesh_.has_vertex_normals()
 
  116       ? vector_cast<Vec3f>(mesh_.normal(_vh))
 
  117       : 
Vec3f(0.0f, 0.0f, 0.0f));
 
  122     return (mesh_.has_vertex_normals()
 
  123       ? vector_cast<Vec3d>(mesh_.normal(_vh))
 
  124       : 
Vec3d(0.0f, 0.0f, 0.0f));
 
  129     return (mesh_.has_vertex_colors()
 
  130             ? color_cast<Vec3uc>(mesh_.color(_vh))
 
  136     return (mesh_.has_vertex_colors()
 
  137       ? color_cast<Vec4uc>(mesh_.color(_vh))
 
  143     return (mesh_.has_vertex_colors()
 
  144             ? color_cast<Vec3ui>(mesh_.color(_vh))
 
  150     return (mesh_.has_vertex_colors()
 
  151       ? color_cast<Vec4ui>(mesh_.color(_vh))
 
  157     return (mesh_.has_vertex_colors()
 
  158             ? color_cast<Vec3f>(mesh_.color(_vh))
 
  164     return (mesh_.has_vertex_colors()
 
  165       ? color_cast<Vec4f>(mesh_.color(_vh))
 
  166       : 
Vec4f(0, 0, 0, 0));
 
  171 #if defined(OM_CC_GCC) && (OM_CC_VERSION<30000) 
  175     if (mesh_.has_vertex_texcoords2D())
 
  176       return vector_cast<Vec2f>(mesh_.texcoord2D(_vh));
 
  177     return Vec2f(0.0f, 0.0f);
 
  179     return (mesh_.has_vertex_texcoords2D()
 
  180             ? vector_cast<Vec2f>(mesh_.texcoord2D(_vh))
 
  181             : 
Vec2f(0.0f, 0.0f));
 
  187     return (mesh_.has_halfedge_texcoords2D()
 
  188         ? vector_cast<Vec2f>(mesh_.texcoord2D(_heh))
 
  189         : 
Vec2f(0.0f, 0.0f));
 
  194     if (mesh_.has_vertex_status())
 
  195       return mesh_.status(_vh);
 
  203       return (mesh_.has_edge_colors()
 
  204       ? color_cast<Vec3uc>(mesh_.color(_eh))
 
  210       return (mesh_.has_edge_colors()
 
  211       ? color_cast<Vec4uc>(mesh_.color(_eh))
 
  217       return (mesh_.has_edge_colors()
 
  218       ? color_cast<Vec3ui>(mesh_.color(_eh))
 
  224       return (mesh_.has_edge_colors()
 
  225       ? color_cast<Vec4ui>(mesh_.color(_eh))
 
  231     return (mesh_.has_vertex_colors()
 
  232             ? color_cast<Vec3f>(mesh_.color(_eh))
 
  238     return (mesh_.has_vertex_colors()
 
  239       ? color_cast<Vec4f>(mesh_.color(_eh))
 
  240       : 
Vec4f(0, 0, 0, 0));
 
  245     if (mesh_.has_edge_status())
 
  246       return mesh_.status(_eh);
 
  254     return mesh_.halfedge_handle(_vh).idx();
 
  259     return mesh_.halfedge_handle(_fh).idx();
 
  264     return mesh_.next_halfedge_handle(_heh).idx();
 
  269     return mesh_.to_vertex_handle(_heh).idx();
 
  274     return mesh_.face_handle(_heh).idx();
 
  279     if (mesh_.has_halfedge_status())
 
  280       return mesh_.status(_heh);
 
  287                             std::vector<VertexHandle>& _vhandles)
 const override 
  289     unsigned int count(0);
 
  291     for (
typename Mesh::CFVIter fv_it=mesh_.cfv_iter(_fh); fv_it.is_valid(); ++fv_it)
 
  293       _vhandles.push_back(*fv_it);
 
  299   unsigned int get_face_texcoords(std::vector<Vec2f>& _hehandles)
 const override 
  301     unsigned int count(0);
 
  303     for(
typename Mesh::CHIter he_it=mesh_.halfedges_begin();
 
  304         he_it != mesh_.halfedges_end(); ++he_it)
 
  306       _hehandles.push_back(vector_cast<Vec2f>(mesh_.texcoord2D( *he_it)));
 
  316     for(fh_it = mesh_.cfh_iter(_fh); fh_it.is_valid();++fh_it)
 
  318       if(mesh_.to_vertex_handle(*fh_it) == _vh)
 
  326     return (mesh_.has_face_normals()
 
  327             ? vector_cast<Vec3f>(mesh_.normal(_fh))
 
  328             : 
Vec3f(0.0f, 0.0f, 0.0f));
 
  333     return (mesh_.has_face_normals()
 
  334             ? vector_cast<Vec3d>(mesh_.normal(_fh))
 
  335             : 
Vec3d(0.0, 0.0, 0.0));
 
  338   Vec3uc  color(FaceHandle _fh)
   const override 
  340     return (mesh_.has_face_colors()
 
  341             ? color_cast<Vec3uc>(mesh_.color(_fh))
 
  345   Vec4uc  colorA(FaceHandle _fh)
   const override 
  347     return (mesh_.has_face_colors()
 
  348             ? color_cast<Vec4uc>(mesh_.color(_fh))
 
  352   Vec3ui  colori(FaceHandle _fh)
   const override 
  354     return (mesh_.has_face_colors()
 
  355             ? color_cast<Vec3ui>(mesh_.color(_fh))
 
  359   Vec4ui  colorAi(FaceHandle _fh)
   const override 
  361     return (mesh_.has_face_colors()
 
  362             ? color_cast<Vec4ui>(mesh_.color(_fh))
 
  366   Vec3f colorf(FaceHandle _fh)
    const override 
  368     return (mesh_.has_face_colors()
 
  369             ? color_cast<Vec3f>(mesh_.color(_fh))
 
  373   Vec4f colorAf(FaceHandle _fh)
   const override 
  375     return (mesh_.has_face_colors()
 
  376       ? color_cast<Vec4f>(mesh_.color(_fh))
 
  377       : 
Vec4f(0, 0, 0, 0));
 
  382     if (mesh_.has_face_status())
 
  383       return mesh_.status(_fh);
 
  387   virtual const BaseKernel* kernel()
 override { 
return &mesh_; }
 
  391   size_t n_vertices()
  const override { 
return mesh_.n_vertices(); }
 
  392   size_t n_faces()
     const override { 
return mesh_.n_faces(); }
 
  393   size_t n_edges()
     const override { 
return mesh_.n_edges(); }
 
  397   bool is_triangle_mesh()
 const override 
  398   { 
return Mesh::is_triangles(); }
 
  400   bool has_vertex_normals()
   const override { 
return mesh_.has_vertex_normals();   }
 
  401   bool has_vertex_colors()
    const override { 
return mesh_.has_vertex_colors();    }
 
  402   bool has_vertex_texcoords()
 const override { 
return mesh_.has_vertex_texcoords2D(); }
 
  403   bool has_vertex_status()
    const override { 
return mesh_.has_vertex_status();    }
 
  404   bool has_edge_colors()
      const override { 
return mesh_.has_edge_colors();      }
 
  405   bool has_edge_status()
      const override { 
return mesh_.has_edge_status();      }
 
  406   bool has_halfedge_status()
  const override { 
return mesh_.has_halfedge_status();  }
 
  407   bool has_face_normals()
     const override { 
return mesh_.has_face_normals();     }
 
  408   bool has_face_colors()
      const override { 
return mesh_.has_face_colors();      }
 
  409   bool has_face_status()
      const override { 
return mesh_.has_face_status();      }
 
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:59
 
VectorT< float, 2 > Vec2f
2-float vector
Definition: Vector11T.hh:833
 
VectorT< unsigned int, 4 > Vec4ui
4-int unsigned vector
Definition: Vector11T.hh:867
 
VectorT< unsigned char, 3 > Vec3uc
3-byte unsigned vector
Definition: Vector11T.hh:840
 
VectorT< float, 4 > Vec4f
4-float vector
Definition: Vector11T.hh:869
 
VectorT< unsigned char, 4 > Vec4uc
4-byte unsigned vector
Definition: Vector11T.hh:859
 
VectorT< unsigned int, 3 > Vec3ui
3-int unsigned vector
Definition: Vector11T.hh:848
 
VectorT< float, 3 > Vec3f
3-float vector
Definition: Vector11T.hh:850
 
Base class for exporter modules.
Definition: BaseExporter.hh:85
 
This class template provides an exporter module for OpenMesh meshes.
Definition: ExporterT.hh:84
 
HalfedgeHandle getHeh(FaceHandle _fh, VertexHandle _vh) const override
getHeh returns the HalfEdgeHandle that belongs to the face specified by _fh and has a toVertexHandle ...
Definition: ExporterT.hh:313
 
Handle for a vertex entity.
Definition: Handles.hh:121
 
Handle for a halfedge entity.
Definition: Handles.hh:128
 
Handle for a edge entity.
Definition: Handles.hh:135
 
Handle for a face entity.
Definition: Handles.hh:142
 
Polygonal mesh based on the ArrayKernel.
Definition: PolyMesh_ArrayKernelT.hh:96
 
Kernel::ConstFaceHalfedgeIter ConstFaceHalfedgeIter
Circulator.
Definition: PolyMeshT.hh:178
 
Kernel::Normal Normal
Normal type.
Definition: PolyMeshT.hh:114
 
Kernel::Point Point
Coordinate type.
Definition: PolyMeshT.hh:112
 
Add status information to a base class.
Definition: Status.hh:95