OpenMesh
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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 
107 
108  // get face data
109  virtual unsigned int
110  get_vhandles(FaceHandle _fh,
111  std::vector<VertexHandle>& _vhandles) const=0;
112  virtual Vec3f normal(FaceHandle _fh) const = 0;
113  virtual Vec3uc color (FaceHandle _fh) const = 0;
114  virtual Vec4uc colorA(FaceHandle _fh) const = 0;
115  virtual Vec3ui colori(FaceHandle _fh) const = 0;
116  virtual Vec4ui colorAi(FaceHandle _fh) const = 0;
117  virtual Vec3f colorf(FaceHandle _fh) const = 0;
118  virtual Vec4f colorAf(FaceHandle _fh) const = 0;
119 
120  // get edge data
121  virtual Vec3uc color(EdgeHandle _eh) const = 0;
122  virtual Vec4uc colorA(EdgeHandle _eh) const = 0;
123  virtual Vec3ui colori(EdgeHandle _eh) const = 0;
124  virtual Vec4ui colorAi(EdgeHandle _eh) const = 0;
125  virtual Vec3f colorf(EdgeHandle _eh) const = 0;
126  virtual Vec4f colorAf(EdgeHandle _eh) const = 0;
127 
128  // get reference to base kernel
129  virtual const BaseKernel* kernel() { return 0; }
130 
131 
132  // query number of faces, vertices, normals, texcoords
133  virtual size_t n_vertices() const = 0;
134  virtual size_t n_faces() const = 0;
135  virtual size_t n_edges() const = 0;
136 
137 
138  // property information
139  virtual bool is_triangle_mesh() const { return false; }
140  virtual bool has_vertex_normals() const { return false; }
141  virtual bool has_vertex_colors() const { return false; }
142  virtual bool has_vertex_texcoords() const { return false; }
143  virtual bool has_edge_colors() const { return false; }
144  virtual bool has_face_normals() const { return false; }
145  virtual bool has_face_colors() const { return false; }
146 };
147 
148 
149 //=============================================================================
150 } // namespace IO
151 } // namespace OpenMesh
152 //=============================================================================
153 #endif
154 //=============================================================================
Handle for a vertex entity.
Definition: Handles.hh:125
This class provides the basic property management like adding/removing properties and access to prope...
Definition: BaseKernel.hh:99
Handle for a edge entity.
Definition: Handles.hh:139
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:64
Base class for exporter modules.
Definition: BaseExporter.hh:89
Handle for a face entity.
Definition: Handles.hh:146

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