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  * $Revision$ *
45  * $Date$ *
46  * *
47 \*===========================================================================*/
48 
49 
50 //=============================================================================
51 //
52 // Implements the baseclass for MeshWriter exporter modules
53 //
54 //=============================================================================
55 
56 
57 #ifndef __BASEEXPORTER_HH__
58 #define __BASEEXPORTER_HH__
59 
60 
61 //=== INCLUDES ================================================================
62 
63 
64 // STL
65 #include <vector>
66 
67 // OpenMesh
68 #include <OpenMesh/Core/System/config.h>
69 #include <OpenMesh/Core/Geometry/VectorT.hh>
70 #include <OpenMesh/Core/Mesh/BaseKernel.hh>
71 
72 
73 //=== NAMESPACES ==============================================================
74 
75 
76 namespace OpenMesh {
77 namespace IO {
78 
79 
80 //=== EXPORTER ================================================================
81 
82 
89 class OPENMESHDLLEXPORT BaseExporter
90 {
91 public:
92 
93  virtual ~BaseExporter() { }
94 
95 
96  // get vertex data
97  virtual Vec3f point(VertexHandle _vh) const = 0;
98  virtual Vec3f normal(VertexHandle _vh) const = 0;
99  virtual Vec3uc color(VertexHandle _vh) const = 0;
100  virtual Vec4uc colorA(VertexHandle _vh) const = 0;
101  virtual Vec3ui colori(VertexHandle _vh) const = 0;
102  virtual Vec4ui colorAi(VertexHandle _vh) const = 0;
103  virtual Vec3f colorf(VertexHandle _vh) const = 0;
104  virtual Vec4f colorAf(VertexHandle _vh) const = 0;
105  virtual Vec2f texcoord(VertexHandle _vh) const = 0;
106  virtual Vec2f texcoord(HalfedgeHandle _heh) const = 0;
107 
108 
109  // get face data
110  virtual unsigned int
111  get_vhandles(FaceHandle _fh,
112  std::vector<VertexHandle>& _vhandles) const=0;
120  virtual HalfedgeHandle getHeh(FaceHandle _fh, VertexHandle _vh) const = 0;
121  virtual unsigned int
122  get_face_texcoords(std::vector<Vec2f>& _hehandles) const = 0;
123  virtual Vec3f normal(FaceHandle _fh) const = 0;
124  virtual Vec3uc color (FaceHandle _fh) const = 0;
125  virtual Vec4uc colorA(FaceHandle _fh) const = 0;
126  virtual Vec3ui colori(FaceHandle _fh) const = 0;
127  virtual Vec4ui colorAi(FaceHandle _fh) const = 0;
128  virtual Vec3f colorf(FaceHandle _fh) const = 0;
129  virtual Vec4f colorAf(FaceHandle _fh) const = 0;
130 
131  // get edge data
132  virtual Vec3uc color(EdgeHandle _eh) const = 0;
133  virtual Vec4uc colorA(EdgeHandle _eh) const = 0;
134  virtual Vec3ui colori(EdgeHandle _eh) const = 0;
135  virtual Vec4ui colorAi(EdgeHandle _eh) const = 0;
136  virtual Vec3f colorf(EdgeHandle _eh) const = 0;
137  virtual Vec4f colorAf(EdgeHandle _eh) const = 0;
138 
139  // get reference to base kernel
140  virtual const BaseKernel* kernel() { return 0; }
141 
142 
143  // query number of faces, vertices, normals, texcoords
144  virtual size_t n_vertices() const = 0;
145  virtual size_t n_faces() const = 0;
146  virtual size_t n_edges() const = 0;
147 
148 
149  // property information
150  virtual bool is_triangle_mesh() const { return false; }
151  virtual bool has_vertex_normals() const { return false; }
152  virtual bool has_vertex_colors() const { return false; }
153  virtual bool has_vertex_texcoords() const { return false; }
154  virtual bool has_edge_colors() const { return false; }
155  virtual bool has_face_normals() const { return false; }
156  virtual bool has_face_colors() const { return false; }
157 };
158 
159 
160 //=============================================================================
161 } // namespace IO
162 } // namespace OpenMesh
163 //=============================================================================
164 #endif
165 //=============================================================================
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:64
Handle for a halfedge entity.
Definition: Handles.hh:132
This class provides low-level property management like adding/removing properties and access to prope...
Definition: BaseKernel.hh:102
Handle for a face entity.
Definition: Handles.hh:146
Base class for exporter modules.
Definition: BaseExporter.hh:89
Handle for a vertex entity.
Definition: Handles.hh:125
Handle for a edge entity.
Definition: Handles.hh:139

Project OpenMesh, ©  Computer Graphics Group, RWTH Aachen. Documentation generated using doxygen .