57 #ifndef __EXPORTERT_HH__
58 #define __EXPORTERT_HH__
67 #include <OpenMesh/Core/System/config.h>
68 #include <OpenMesh/Core/Geometry/VectorT.hh>
69 #include <OpenMesh/Core/Utils/GenProg.hh>
70 #include <OpenMesh/Core/Utils/vector_cast.hh>
71 #include <OpenMesh/Core/Utils/color_cast.hh>
72 #include <OpenMesh/Core/IO/exporter/BaseExporter.hh>
92 ExporterT(
const Mesh& _mesh) : mesh_(_mesh) {}
104 return (mesh_.has_vertex_normals()
106 :
Vec3f(0.0f, 0.0f, 0.0f));
111 return (mesh_.has_vertex_colors()
112 ? color_cast<
Vec3uc>(mesh_.color(_vh))
118 return (mesh_.has_vertex_colors()
119 ? color_cast<
Vec4uc>(mesh_.color(_vh))
125 return (mesh_.has_vertex_colors()
126 ? color_cast<
Vec3ui>(mesh_.color(_vh))
132 return (mesh_.has_vertex_colors()
133 ? color_cast<
Vec4ui>(mesh_.color(_vh))
139 return (mesh_.has_vertex_colors()
140 ? color_cast<
Vec3f>(mesh_.color(_vh))
146 return (mesh_.has_vertex_colors()
147 ? color_cast<
Vec4f>(mesh_.color(_vh))
148 :
Vec4f(0, 0, 0, 0));
153 #if defined(OM_CC_GCC) && (OM_CC_VERSION<30000)
157 if (mesh_.has_vertex_texcoords2D())
158 return vector_cast<Vec2f>(mesh_.texcoord2D(_vh));
159 return Vec2f(0.0f, 0.0f);
161 return (mesh_.has_vertex_texcoords2D()
163 :
Vec2f(0.0f, 0.0f));
171 return (mesh_.has_edge_colors()
172 ? color_cast<
Vec3uc>(mesh_.color(_eh))
178 return (mesh_.has_edge_colors()
179 ? color_cast<
Vec4uc>(mesh_.color(_eh))
185 return (mesh_.has_edge_colors()
186 ? color_cast<
Vec3ui>(mesh_.color(_eh))
192 return (mesh_.has_edge_colors()
193 ? color_cast<
Vec4ui>(mesh_.color(_eh))
199 return (mesh_.has_vertex_colors()
200 ? color_cast<
Vec3f>(mesh_.color(_eh))
206 return (mesh_.has_vertex_colors()
207 ? color_cast<
Vec4f>(mesh_.color(_eh))
208 :
Vec4f(0, 0, 0, 0));
214 std::vector<VertexHandle>& _vhandles)
const
216 unsigned int count(0);
218 for (
typename Mesh::CFVIter fv_it=mesh_.cfv_iter(_fh); fv_it.is_valid(); ++fv_it)
220 _vhandles.push_back(*fv_it);
228 return (mesh_.has_face_normals()
230 :
Vec3f(0.0f, 0.0f, 0.0f));
235 return (mesh_.has_face_colors()
236 ? color_cast<
Vec3uc>(mesh_.color(_fh))
242 return (mesh_.has_face_colors()
243 ? color_cast<
Vec4uc>(mesh_.color(_fh))
249 return (mesh_.has_face_colors()
250 ? color_cast<
Vec3ui>(mesh_.color(_fh))
256 return (mesh_.has_face_colors()
257 ? color_cast<
Vec4ui>(mesh_.color(_fh))
263 return (mesh_.has_vertex_colors()
264 ? color_cast<
Vec3f>(mesh_.color(_fh))
270 return (mesh_.has_vertex_colors()
271 ? color_cast<
Vec4f>(mesh_.color(_fh))
272 :
Vec4f(0, 0, 0, 0));
275 virtual const BaseKernel* kernel() {
return &mesh_; }
279 size_t n_vertices()
const {
return mesh_.n_vertices(); }
280 size_t n_faces()
const {
return mesh_.n_faces(); }
281 size_t n_edges()
const {
return mesh_.n_edges(); }
285 bool is_triangle_mesh()
const
286 {
return Mesh::is_triangles(); }
288 bool has_vertex_normals()
const {
return mesh_.has_vertex_normals(); }
289 bool has_vertex_colors()
const {
return mesh_.has_vertex_colors(); }
290 bool has_vertex_texcoords()
const {
return mesh_.has_vertex_texcoords2D(); }
291 bool has_edge_colors()
const {
return mesh_.has_edge_colors(); }
292 bool has_face_normals()
const {
return mesh_.has_face_normals(); }
293 bool has_face_colors()
const {
return mesh_.has_face_colors(); }
VectorT< unsigned char, 3 > Vec3uc
3-byte unsigned vector
Definition: Vector11T.hh:759
VectorT< float, 3 > Vec3f
3-float vector
Definition: Vector11T.hh:769
VectorT< unsigned char, 4 > Vec4uc
4-byte unsigned vector
Definition: Vector11T.hh:778
VectorT< float, 4 > Vec4f
4-float vector
Definition: Vector11T.hh:788
VectorT< unsigned int, 3 > Vec3ui
3-int unsigned vector
Definition: Vector11T.hh:767
Handle for a vertex entity.
Definition: Handles.hh:123
This class provides the basic property management like adding/removing properties and access to prope...
Definition: BaseKernel.hh:99
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.
Definition: vector_cast.hh:86
This class template provides an exporter module for OpenMesh meshes.
Definition: ExporterT.hh:87
Handle for a edge entity.
Definition: Handles.hh:137
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:64
VectorT< float, 2 > Vec2f
2-float vector
Definition: Vector11T.hh:752
VectorT< unsigned int, 4 > Vec4ui
4-int unsigned vector
Definition: Vector11T.hh:786
Base class for exporter modules.
Definition: BaseExporter.hh:89
Handle for a face entity.
Definition: Handles.hh:144