OpenMesh
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Traits.hh
Go to the documentation of this file.
1 /*===========================================================================*\
2  * *
3  * OpenMesh *
4  * Copyright (C) 2001-2015 by Computer Graphics Group, RWTH Aachen *
5  * www.openmesh.org *
6  * *
7  *---------------------------------------------------------------------------*
8  * This file is part of OpenMesh. *
9  * *
10  * OpenMesh is free software: you can redistribute it and/or modify *
11  * it under the terms of the GNU Lesser General Public License as *
12  * published by the Free Software Foundation, either version 3 of *
13  * the License, or (at your option) any later version with the *
14  * following exceptions: *
15  * *
16  * If other files instantiate templates or use macros *
17  * or inline functions from this file, or you compile this file and *
18  * link it with other files to produce an executable, this file does *
19  * not by itself cause the resulting executable to be covered by the *
20  * GNU Lesser General Public License. This exception does not however *
21  * invalidate any other reasons why the executable file might be *
22  * covered by the GNU Lesser General Public License. *
23  * *
24  * OpenMesh is distributed in the hope that it will be useful, *
25  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
26  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
27  * GNU Lesser General Public License for more details. *
28  * *
29  * You should have received a copy of the GNU LesserGeneral Public *
30  * License along with OpenMesh. If not, *
31  * see <http://www.gnu.org/licenses/>. *
32  * *
33 \*===========================================================================*/
34 
35 /*===========================================================================*\
36  * *
37  * $Revision: 1188 $ *
38  * $Date: 2015-01-05 16:34:10 +0100 (Mo, 05 Jan 2015) $ *
39  * *
40 \*===========================================================================*/
41 
42 
48 //=============================================================================
49 //
50 // CLASS Traits
51 //
52 //=============================================================================
53 
54 #ifndef OPENMESH_TRAITS_HH
55 #define OPENMESH_TRAITS_HH
56 
57 
58 //== INCLUDES =================================================================
59 
60 
61 #include <OpenMesh/Core/System/config.h>
62 #include <OpenMesh/Core/Geometry/VectorT.hh>
64 #include <OpenMesh/Core/Mesh/Handles.hh>
65 
66 
67 //== NAMESPACES ===============================================================
68 
69 
70 namespace OpenMesh {
71 
72 
73 //== CLASS DEFINITION =========================================================
74 
75 
77 #define VertexAttributes(_i) enum { VertexAttributes = _i }
78 
80 #define HalfedgeAttributes(_i) enum { HalfedgeAttributes = _i }
81 
83 #define EdgeAttributes(_i) enum { EdgeAttributes = _i }
84 
86 #define FaceAttributes(_i) enum { FaceAttributes = _i }
87 
89 #define VertexTraits \
90  template <class Base, class Refs> struct VertexT : public Base
91 
93 #define HalfedgeTraits \
94  template <class Base, class Refs> struct HalfedgeT : public Base
95 
97 #define EdgeTraits \
98  template <class Base, class Refs> struct EdgeT : public Base
99 
101 #define FaceTraits \
102  template <class Base, class Refs> struct FaceT : public Base
103 
104 
105 
106 //== CLASS DEFINITION =========================================================
107 
108 
120 {
122  typedef Vec3f Point;
123 
125  typedef Vec3f Normal;
126 
128  typedef float TexCoord1D;
130  typedef Vec2f TexCoord2D;
132  typedef Vec3f TexCoord3D;
133 
135  typedef int TextureIndex;
136 
138  typedef Vec3uc Color;
139 
140 #ifndef DOXY_IGNORE_THIS
141  VertexTraits {};
142  HalfedgeTraits {};
143  EdgeTraits {};
144  FaceTraits {};
145 #endif
146 
147  VertexAttributes(0);
148  HalfedgeAttributes(Attributes::PrevHalfedge);
149  EdgeAttributes(0);
150  FaceAttributes(0);
151 };
152 
153 
154 //== CLASS DEFINITION =========================================================
155 
156 
168 template <class _Traits1, class _Traits2> struct MergeTraits
169 {
170 #ifndef DOXY_IGNORE_THIS
171  struct Result
172  {
173  // Mipspro needs this (strange) typedef
174  typedef _Traits1 T1;
175  typedef _Traits2 T2;
176 
177 
182 
183 
184  typedef typename T1::Point Point;
185  typedef typename T1::Normal Normal;
186  typedef typename T1::Color Color;
187  typedef typename T1::TexCoord TexCoord;
188 
189  template <class Base, class Refs> class VertexT :
190  public T1::template VertexT<
191  typename T2::template VertexT<Base, Refs>, Refs>
192  {};
193 
194  template <class Base, class Refs> class HalfedgeT :
195  public T1::template HalfedgeT<
196  typename T2::template HalfedgeT<Base, Refs>, Refs>
197  {};
198 
199 
200  template <class Base, class Refs> class EdgeT :
201  public T1::template EdgeT<
202  typename T2::template EdgeT<Base, Refs>, Refs>
203  {};
204 
205 
206  template <class Base, class Refs> class FaceT :
207  public T1::template FaceT<
208  typename T2::template FaceT<Base, Refs>, Refs>
209  {};
210  };
211 #endif
212 };
213 
214 
221 #define OM_Merge_Traits(_S1, _S2, _D) \
222  typedef OpenMesh::MergeTraits<_S1, _S2>::Result _D;
223 
224 
229 #define OM_Merge_Traits_In_Template(_S1, _S2, _D) \
230  typedef typename OpenMesh::MergeTraits<_S1, _S2>::Result _D;
231 
232 
233 //=============================================================================
234 } // namespace OpenMesh
235 //=============================================================================
236 #endif // OPENMESH_TRAITS_HH defined
237 //=============================================================================
238 
Add normals to mesh item (vertices/faces)
Definition: Attributes.hh:80
Add colors to mesh item (vertices/faces/edges)
Definition: Attributes.hh:81
Helper class to merge two mesh traits.
Definition: Traits.hh:168
#define FaceAttributes(_i)
Macro for defining the face attributes. See Specifying your MyMesh.
Definition: Traits.hh:86
#define VertexTraits
Macro for defining the vertex traits. See Specifying your MyMesh.
Definition: Traits.hh:89
Vec3f Normal
The default normal type is OpenMesh::Vec3f.
Definition: Traits.hh:125
Add storage for previous halfedge (halfedges). The bit is set by default in the DefaultTraits.
Definition: Attributes.hh:82
#define VertexAttributes(_i)
Macro for defining the vertex attributes. See Specifying your MyMesh.
Definition: Traits.hh:77
Vec3f Point
The default coordinate type is OpenMesh::Vec3f.
Definition: Traits.hh:122
float TexCoord1D
The default 1D texture coordinate type is float.
Definition: Traits.hh:128
#define FaceTraits
Macro for defining the face traits. See Specifying your MyMesh.
Definition: Traits.hh:101
int TextureIndex
The default texture index type.
Definition: Traits.hh:135
#define HalfedgeTraits
Macro for defining the halfedge traits. See Specifying your MyMesh.
Definition: Traits.hh:93
#define EdgeTraits
Macro for defining the edge traits. See Specifying your MyMesh.
Definition: Traits.hh:97
Vec2f TexCoord2D
The default 2D texture coordinate type is OpenMesh::Vec2f.
Definition: Traits.hh:130
This file provides some macros containing attribute usage.
Vec3uc Color
The default color type is OpenMesh::Vec3uc.
Definition: Traits.hh:138
#define HalfedgeAttributes(_i)
Macro for defining the halfedge attributes. See Specifying your MyMesh.
Definition: Traits.hh:80
Base class for all traits.
Definition: Traits.hh:119
Vec3f TexCoord3D
The default 3D texture coordinate type is OpenMesh::Vec3f.
Definition: Traits.hh:132
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:56
#define EdgeAttributes(_i)
Macro for defining the edge attributes. See Specifying your MyMesh.
Definition: Traits.hh:83

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