52 #ifndef __EXPORTERT_HH__ 53 #define __EXPORTERT_HH__ 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> 99 return (mesh_.has_vertex_normals()
101 :
Vec3f(0.0f, 0.0f, 0.0f));
106 return (mesh_.has_vertex_colors()
107 ? color_cast<
Vec3uc>(mesh_.color(_vh))
113 return (mesh_.has_vertex_colors()
114 ? color_cast<
Vec4uc>(mesh_.color(_vh))
120 return (mesh_.has_vertex_colors()
121 ? color_cast<
Vec3ui>(mesh_.color(_vh))
127 return (mesh_.has_vertex_colors()
128 ? color_cast<
Vec4ui>(mesh_.color(_vh))
134 return (mesh_.has_vertex_colors()
135 ? color_cast<
Vec3f>(mesh_.color(_vh))
141 return (mesh_.has_vertex_colors()
142 ? color_cast<
Vec4f>(mesh_.color(_vh))
143 :
Vec4f(0, 0, 0, 0));
148 #if defined(OM_CC_GCC) && (OM_CC_VERSION<30000) 152 if (mesh_.has_vertex_texcoords2D())
153 return vector_cast<Vec2f>(mesh_.texcoord2D(_vh));
154 return Vec2f(0.0f, 0.0f);
156 return (mesh_.has_vertex_texcoords2D()
158 :
Vec2f(0.0f, 0.0f));
164 return (mesh_.has_halfedge_texcoords2D()
166 :
Vec2f(0.0f, 0.0f));
171 if (mesh_.has_vertex_status())
172 return mesh_.status(_vh);
180 return (mesh_.has_edge_colors()
181 ? color_cast<
Vec3uc>(mesh_.color(_eh))
187 return (mesh_.has_edge_colors()
188 ? color_cast<
Vec4uc>(mesh_.color(_eh))
194 return (mesh_.has_edge_colors()
195 ? color_cast<
Vec3ui>(mesh_.color(_eh))
201 return (mesh_.has_edge_colors()
202 ? color_cast<
Vec4ui>(mesh_.color(_eh))
208 return (mesh_.has_vertex_colors()
209 ? color_cast<
Vec3f>(mesh_.color(_eh))
215 return (mesh_.has_vertex_colors()
216 ? color_cast<
Vec4f>(mesh_.color(_eh))
217 :
Vec4f(0, 0, 0, 0));
222 if (mesh_.has_edge_status())
223 return mesh_.status(_eh);
231 return mesh_.halfedge_handle(_vh).idx();
236 return mesh_.halfedge_handle(_fh).idx();
241 return mesh_.next_halfedge_handle(_heh).idx();
246 return mesh_.to_vertex_handle(_heh).idx();
251 return mesh_.face_handle(_heh).idx();
256 if (mesh_.has_halfedge_status())
257 return mesh_.status(_heh);
264 std::vector<VertexHandle>& _vhandles)
const override 266 unsigned int count(0);
268 for (
typename Mesh::CFVIter fv_it=mesh_.cfv_iter(_fh); fv_it.is_valid(); ++fv_it)
270 _vhandles.push_back(*fv_it);
276 unsigned int get_face_texcoords(std::vector<Vec2f>& _hehandles)
const override 278 unsigned int count(0);
280 for(
typename Mesh::CHIter he_it=mesh_.halfedges_begin();
281 he_it != mesh_.halfedges_end(); ++he_it)
283 _hehandles.push_back(vector_cast<Vec2f>(mesh_.texcoord2D( *he_it)));
293 for(fh_it = mesh_.cfh_iter(_fh); fh_it.is_valid();++fh_it)
295 if(mesh_.to_vertex_handle(*fh_it) == _vh)
303 return (mesh_.has_face_normals()
305 :
Vec3f(0.0f, 0.0f, 0.0f));
310 return (mesh_.has_face_colors()
311 ? color_cast<
Vec3uc>(mesh_.color(_fh))
317 return (mesh_.has_face_colors()
318 ? color_cast<
Vec4uc>(mesh_.color(_fh))
324 return (mesh_.has_face_colors()
325 ? color_cast<
Vec3ui>(mesh_.color(_fh))
331 return (mesh_.has_face_colors()
332 ? color_cast<
Vec4ui>(mesh_.color(_fh))
338 return (mesh_.has_face_colors()
339 ? color_cast<
Vec3f>(mesh_.color(_fh))
345 return (mesh_.has_face_colors()
346 ? color_cast<
Vec4f>(mesh_.color(_fh))
347 :
Vec4f(0, 0, 0, 0));
352 if (mesh_.has_face_status())
353 return mesh_.status(_fh);
357 virtual const BaseKernel* kernel()
override {
return &mesh_; }
361 size_t n_vertices()
const override {
return mesh_.n_vertices(); }
362 size_t n_faces()
const override {
return mesh_.n_faces(); }
363 size_t n_edges()
const override {
return mesh_.n_edges(); }
367 bool is_triangle_mesh()
const override 368 {
return Mesh::is_triangles(); }
370 bool has_vertex_normals()
const override {
return mesh_.has_vertex_normals(); }
371 bool has_vertex_colors()
const override {
return mesh_.has_vertex_colors(); }
372 bool has_vertex_texcoords()
const override {
return mesh_.has_vertex_texcoords2D(); }
373 bool has_vertex_status()
const override {
return mesh_.has_vertex_status(); }
374 bool has_edge_colors()
const override {
return mesh_.has_edge_colors(); }
375 bool has_edge_status()
const override {
return mesh_.has_edge_status(); }
376 bool has_halfedge_status()
const override {
return mesh_.has_halfedge_status(); }
377 bool has_face_normals()
const override {
return mesh_.has_face_normals(); }
378 bool has_face_colors()
const override {
return mesh_.has_face_colors(); }
379 bool has_face_status()
const override {
return mesh_.has_face_status(); }
void vector_cast(const src_t &_src, dst_t &_dst, GenProg::Int2Type< n >)
Cast vector type to another vector type by copying the vector elements.
Handle for a vertex entity.
VectorT< float, 4 > Vec4f
VectorT< float, 3 > Vec3f
Kernel::ConstFaceHalfedgeIter ConstFaceHalfedgeIter
Circulator.
Handle for a halfedge entity.
HalfedgeHandle getHeh(FaceHandle _fh, VertexHandle _vh) const override
getHeh returns the HalfEdgeHandle that belongs to the face specified by _fh and has a toVertexHandle ...
VectorT< float, 2 > Vec2f
VectorT< unsigned char, 3 > Vec3uc
VectorT< unsigned int, 4 > Vec4ui
Handle for a face entity.
Handle for a edge entity.
VectorT< unsigned char, 4 > Vec4uc
VectorT< unsigned int, 3 > Vec3ui