| OpenMesh

BaseExporter.hh
1 /* ========================================================================= *
2 * *
3 * OpenMesh *
4 * Copyright (c) 2001-2015, RWTH-Aachen University *
5 * Department of Computer Graphics and Multimedia *
6 * All rights reserved. *
7 * www.openmesh.org *
8 * *
9 *---------------------------------------------------------------------------*
10 * This file is part of OpenMesh. *
11 *---------------------------------------------------------------------------*
12 * *
13 * Redistribution and use in source and binary forms, with or without *
14 * modification, are permitted provided that the following conditions *
15 * are met: *
16 * *
17 * 1. Redistributions of source code must retain the above copyright notice, *
18 * this list of conditions and the following disclaimer. *
19 * *
20 * 2. Redistributions in binary form must reproduce the above copyright *
21 * notice, this list of conditions and the following disclaimer in the *
22 * documentation and/or other materials provided with the distribution. *
23 * *
24 * 3. Neither the name of the copyright holder nor the names of its *
25 * contributors may be used to endorse or promote products derived from *
26 * this software without specific prior written permission. *
27 * *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39 * *
40 * ========================================================================= */
41
42
43
44
45 //=============================================================================
46 //
47 // Implements the baseclass for MeshWriter exporter modules
48 //
49 //=============================================================================
50
51
52 #ifndef __BASEEXPORTER_HH__
53 #define __BASEEXPORTER_HH__
54
55
56 //=== INCLUDES ================================================================
57
58
59 // STL
60 #include <vector>
61
62 // OpenMesh
63 #include <OpenMesh/Core/System/config.h>
64 #include <OpenMesh/Core/Geometry/VectorT.hh>
65 #include <OpenMesh/Core/Mesh/BaseKernel.hh>
66
67
68 //=== NAMESPACES ==============================================================
69
70
71 namespace OpenMesh {
72 namespace IO {
73
74
75 //=== EXPORTER ================================================================
76
77
84 class OPENMESHDLLEXPORT BaseExporter
85 {
86 public:
87
88 virtual ~BaseExporter() { }
89
90
91 // get vertex data
92 virtual Vec3f point(VertexHandle _vh) const = 0;
93 virtual Vec3d pointd(VertexHandle _vh) const = 0;
94 virtual bool is_point_double() const = 0;
95 virtual Vec3f normal(VertexHandle _vh) const = 0;
96 virtual Vec3d normald(VertexHandle _vh) const = 0;
97 virtual bool is_normal_double() const = 0;
98 virtual Vec3uc color(VertexHandle _vh) const = 0;
99 virtual Vec4uc colorA(VertexHandle _vh) const = 0;
100 virtual Vec3ui colori(VertexHandle _vh) const = 0;
101 virtual Vec4ui colorAi(VertexHandle _vh) const = 0;
102 virtual Vec3f colorf(VertexHandle _vh) const = 0;
103 virtual Vec4f colorAf(VertexHandle _vh) const = 0;
104 virtual Vec2f texcoord(VertexHandle _vh) const = 0;
105 virtual Vec2f texcoord(HalfedgeHandle _heh) const = 0;
106 virtual OpenMesh::Attributes::StatusInfo status(VertexHandle _vh) const = 0;
107
108
109 // get face data
110 virtual unsigned int
111 get_vhandles(FaceHandle _fh,
112 std::vector<VertexHandle>& _vhandles) const=0;
113
121 virtual HalfedgeHandle getHeh(FaceHandle _fh, VertexHandle _vh) const = 0;
122 virtual unsigned int
123 get_face_texcoords(std::vector<Vec2f>& _hehandles) const = 0;
124 virtual Vec3f normal(FaceHandle _fh) const = 0;
125 virtual Vec3d normald(FaceHandle _fh) const = 0;
126 virtual Vec3uc color (FaceHandle _fh) const = 0;
127 virtual Vec4uc colorA(FaceHandle _fh) const = 0;
128 virtual Vec3ui colori(FaceHandle _fh) const = 0;
129 virtual Vec4ui colorAi(FaceHandle _fh) const = 0;
130 virtual Vec3f colorf(FaceHandle _fh) const = 0;
131 virtual Vec4f colorAf(FaceHandle _fh) const = 0;
132 virtual OpenMesh::Attributes::StatusInfo status(FaceHandle _fh) const = 0;
133
134 // get edge data
135 virtual Vec3uc color(EdgeHandle _eh) const = 0;
136 virtual Vec4uc colorA(EdgeHandle _eh) const = 0;
137 virtual Vec3ui colori(EdgeHandle _eh) const = 0;
138 virtual Vec4ui colorAi(EdgeHandle _eh) const = 0;
139 virtual Vec3f colorf(EdgeHandle _eh) const = 0;
140 virtual Vec4f colorAf(EdgeHandle _eh) const = 0;
141 virtual OpenMesh::Attributes::StatusInfo status(EdgeHandle _eh) const = 0;
142
143 // get halfedge data
144 virtual int get_halfedge_id(VertexHandle _vh) = 0;
145 virtual int get_halfedge_id(FaceHandle _vh) = 0;
146 virtual int get_next_halfedge_id(HalfedgeHandle _heh) = 0;
147 virtual int get_to_vertex_id(HalfedgeHandle _heh) = 0;
148 virtual int get_face_id(HalfedgeHandle _heh) = 0;
149 virtual OpenMesh::Attributes::StatusInfo status(HalfedgeHandle _heh) const = 0;
150
151 // get reference to base kernel
152 virtual const BaseKernel* kernel() { return nullptr; }
153
154
155 // query number of faces, vertices, normals, texcoords
156 virtual size_t n_vertices() const = 0;
157 virtual size_t n_faces() const = 0;
158 virtual size_t n_edges() const = 0;
159
160
161 // property information
162 virtual bool is_triangle_mesh() const { return false; }
163 virtual bool has_vertex_normals() const { return false; }
164 virtual bool has_vertex_colors() const { return false; }
165 virtual bool has_vertex_status() const { return false; }
166 virtual bool has_vertex_texcoords() const { return false; }
167 virtual bool has_edge_colors() const { return false; }
168 virtual bool has_edge_status() const { return false; }
169 virtual bool has_halfedge_status() const { return false; }
170 virtual bool has_face_normals() const { return false; }
171 virtual bool has_face_colors() const { return false; }
172 virtual bool has_face_status() const { return false; }
173 };
174
175
176 //=============================================================================
177 } // namespace IO
178 } // namespace OpenMesh
179 //=============================================================================
180 #endif
181 //=============================================================================
OpenMesh::FaceHandle
Handle for a face entity.
Definition: Handles.hh:141
OpenMesh::VectorT< float, 3 >
OpenMesh::VertexHandle
Handle for a vertex entity.
Definition: Handles.hh:120
OpenMesh::IO::BaseExporter
Base class for exporter modules.
Definition: BaseExporter.hh:84
VectorT< float, 4 >
OpenMesh::EdgeHandle
Handle for a edge entity.
Definition: Handles.hh:134
OpenMesh::Attributes::StatusInfo
Add status information to a base class.
Definition: Status.hh:94
OpenMesh
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:59
OpenMesh::HalfedgeHandle
Handle for a halfedge entity.
Definition: Handles.hh:127
OpenMesh::BaseKernel
This class provides low-level property management like adding/removing properties and access to prope...
Definition: BaseKernel.hh:97