| 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 Vec3f normal(VertexHandle _vh) const = 0;
94 virtual Vec3uc color(VertexHandle _vh) const = 0;
95 virtual Vec4uc colorA(VertexHandle _vh) const = 0;
96 virtual Vec3ui colori(VertexHandle _vh) const = 0;
97 virtual Vec4ui colorAi(VertexHandle _vh) const = 0;
98 virtual Vec3f colorf(VertexHandle _vh) const = 0;
99 virtual Vec4f colorAf(VertexHandle _vh) const = 0;
100 virtual Vec2f texcoord(VertexHandle _vh) const = 0;
101 virtual Vec2f texcoord(HalfedgeHandle _heh) const = 0;
102 virtual OpenMesh::Attributes::StatusInfo status(VertexHandle _vh) const = 0;
103
104
105 // get face data
106 virtual unsigned int
107 get_vhandles(FaceHandle _fh,
108 std::vector<VertexHandle>& _vhandles) const=0;
109
117 virtual HalfedgeHandle getHeh(FaceHandle _fh, VertexHandle _vh) const = 0;
118 virtual unsigned int
119 get_face_texcoords(std::vector<Vec2f>& _hehandles) const = 0;
120 virtual Vec3f normal(FaceHandle _fh) const = 0;
121 virtual Vec3uc color (FaceHandle _fh) const = 0;
122 virtual Vec4uc colorA(FaceHandle _fh) const = 0;
123 virtual Vec3ui colori(FaceHandle _fh) const = 0;
124 virtual Vec4ui colorAi(FaceHandle _fh) const = 0;
125 virtual Vec3f colorf(FaceHandle _fh) const = 0;
126 virtual Vec4f colorAf(FaceHandle _fh) const = 0;
127 virtual OpenMesh::Attributes::StatusInfo status(FaceHandle _fh) const = 0;
128
129 // get edge data
130 virtual Vec3uc color(EdgeHandle _eh) const = 0;
131 virtual Vec4uc colorA(EdgeHandle _eh) const = 0;
132 virtual Vec3ui colori(EdgeHandle _eh) const = 0;
133 virtual Vec4ui colorAi(EdgeHandle _eh) const = 0;
134 virtual Vec3f colorf(EdgeHandle _eh) const = 0;
135 virtual Vec4f colorAf(EdgeHandle _eh) const = 0;
136 virtual OpenMesh::Attributes::StatusInfo status(EdgeHandle _eh) const = 0;
137
138 // get halfedge data
139 virtual int get_halfedge_id(VertexHandle _vh) = 0;
140 virtual int get_halfedge_id(FaceHandle _vh) = 0;
141 virtual int get_next_halfedge_id(HalfedgeHandle _heh) = 0;
142 virtual int get_to_vertex_id(HalfedgeHandle _heh) = 0;
143 virtual int get_face_id(HalfedgeHandle _heh) = 0;
144 virtual OpenMesh::Attributes::StatusInfo status(HalfedgeHandle _heh) const = 0;
145
146 // get reference to base kernel
147 virtual const BaseKernel* kernel() { return 0; }
148
149
150 // query number of faces, vertices, normals, texcoords
151 virtual size_t n_vertices() const = 0;
152 virtual size_t n_faces() const = 0;
153 virtual size_t n_edges() const = 0;
154
155
156 // property information
157 virtual bool is_triangle_mesh() const { return false; }
158 virtual bool has_vertex_normals() const { return false; }
159 virtual bool has_vertex_colors() const { return false; }
160 virtual bool has_vertex_status() const { return false; }
161 virtual bool has_vertex_texcoords() const { return false; }
162 virtual bool has_edge_colors() const { return false; }
163 virtual bool has_edge_status() const { return false; }
164 virtual bool has_halfedge_status() const { return false; }
165 virtual bool has_face_normals() const { return false; }
166 virtual bool has_face_colors() const { return false; }
167 virtual bool has_face_status() const { return false; }
168 };
169
170
171 //=============================================================================
172 } // namespace IO
173 } // namespace OpenMesh
174 //=============================================================================
175 #endif
176 //=============================================================================
OpenMesh::VectorT< float, 3 >
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
OpenMesh::Attributes::StatusInfo
Add status information to a base class.
Definition: Status.hh:94
OpenMesh::VertexHandle
Handle for a vertex entity.
Definition: Handles.hh:120
OpenMesh::EdgeHandle
Handle for a edge entity.
Definition: Handles.hh:134
OpenMesh::IO::BaseExporter
Base class for exporter modules.
Definition: BaseExporter.hh:84
OpenMesh
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:59
OpenMesh::FaceHandle
Handle for a face entity.
Definition: Handles.hh:141
VectorT< float, 4 >