50 #ifndef __EXPORTERT_HH__
51 #define __EXPORTERT_HH__
60 #include <OpenMesh/Core/System/config.h>
61 #include <OpenMesh/Core/Geometry/VectorT.hh>
62 #include <OpenMesh/Core/Utils/GenProg.hh>
63 #include <OpenMesh/Core/Utils/vector_cast.hh>
64 #include <OpenMesh/Core/Utils/color_cast.hh>
65 #include <OpenMesh/Core/IO/exporter/BaseExporter.hh>
85 ExporterT(
const Mesh& _mesh) : mesh_(_mesh) {}
97 return (mesh_.has_vertex_normals()
99 : Vec3f(0.0f, 0.0f, 0.0f));
104 return (mesh_.has_vertex_colors()
105 ? color_cast<Vec3uc>(mesh_.color(_vh))
111 return (mesh_.has_vertex_colors()
112 ? color_cast<Vec4uc>(mesh_.color(_vh))
113 : Vec4uc(0, 0, 0, 0));
118 #if defined(OM_CC_GCC) && (OM_CC_VERSION<30000)
122 if (mesh_.has_vertex_texcoords2D())
123 return vector_cast<Vec2f>(mesh_.texcoord2D(_vh));
124 return Vec2f(0.0f, 0.0f);
126 return (mesh_.has_vertex_texcoords2D()
128 : Vec2f(0.0f, 0.0f));
136 return (mesh_.has_edge_colors()
137 ? color_cast<Vec3uc>(mesh_.color(_eh))
143 return (mesh_.has_edge_colors()
144 ? color_cast<Vec4uc>(mesh_.color(_eh))
145 : Vec4uc(0, 0, 0, 0));
152 std::vector<VertexHandle>& _vhandles)
const
154 unsigned int count(0);
156 for (
typename Mesh::CFVIter fv_it=mesh_.cfv_iter(_fh); fv_it; ++fv_it)
158 _vhandles.push_back(fv_it.handle());
166 return (mesh_.has_face_normals()
168 : Vec3f(0.0f, 0.0f, 0.0f));
173 return (mesh_.has_face_colors()
174 ? color_cast<Vec3uc>(mesh_.color(_fh))
180 return (mesh_.has_face_colors()
181 ? color_cast<Vec4uc>(mesh_.color(_fh))
182 : Vec4uc(0, 0, 0, 0));
185 virtual const BaseKernel* kernel() {
return &mesh_; }
189 size_t n_vertices()
const {
return mesh_.n_vertices(); }
190 size_t n_faces()
const {
return mesh_.n_faces(); }
191 size_t n_edges()
const {
return mesh_.n_edges(); }
195 bool is_triangle_mesh()
const
196 {
return Mesh::is_triangles(); }
198 bool has_vertex_normals()
const {
return mesh_.has_vertex_normals(); }
199 bool has_vertex_colors()
const {
return mesh_.has_vertex_colors(); }
200 bool has_vertex_texcoords()
const {
return mesh_.has_vertex_texcoords2D(); }
201 bool has_edge_colors()
const {
return mesh_.has_edge_colors(); }
202 bool has_face_normals()
const {
return mesh_.has_face_normals(); }
203 bool has_face_colors()
const {
return mesh_.has_face_colors(); }