Loading...
Searching...
No Matches
Traits.hh
Go to the documentation of this file.
/* ========================================================================= *
* *
* OpenMesh *
* Copyright (c) 2001-2022, RWTH-Aachen University *
* Department of Computer Graphics and Multimedia *
* All rights reserved. *
* www.openmesh.org *
* *
*---------------------------------------------------------------------------*
* This file is part of OpenMesh. *
*---------------------------------------------------------------------------*
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright notice, *
* this list of conditions and the following disclaimer. *
* *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* 3. Neither the name of the copyright holder nor the names of its *
* contributors may be used to endorse or promote products derived from *
* this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
* *
* ========================================================================= */
//=============================================================================
//
// CLASS Traits
//
//=============================================================================
#ifndef OPENMESH_TRAITS_HH
#define OPENMESH_TRAITS_HH
//== INCLUDES =================================================================
#include <OpenMesh/Core/System/config.h>
#include <OpenMesh/Core/Geometry/VectorT.hh>
#include <OpenMesh/Core/Mesh/Attributes.hh>
#include <OpenMesh/Core/Mesh/Handles.hh>
//== NAMESPACES ===============================================================
namespace OpenMesh {
//== CLASS DEFINITION =========================================================
#define VertexAttributes(_i) enum { VertexAttributes = _i }
#define HalfedgeAttributes(_i) enum { HalfedgeAttributes = _i }
#define EdgeAttributes(_i) enum { EdgeAttributes = _i }
#define FaceAttributes(_i) enum { FaceAttributes = _i }
#define VertexTraits \
template <class Base, class Refs> struct VertexT : public Base
#define HalfedgeTraits \
template <class Base, class Refs> struct HalfedgeT : public Base
#define EdgeTraits \
template <class Base, class Refs> struct EdgeT : public Base
#define FaceTraits \
template <class Base, class Refs> struct FaceT : public Base
//== CLASS DEFINITION =========================================================
struct DefaultTraits
{
typedef Vec3f Point;
typedef Vec3f Normal;
typedef float TexCoord1D;
typedef Vec2f TexCoord2D;
typedef Vec3f TexCoord3D;
typedef int TextureIndex;
typedef Vec3uc Color;
#ifndef DOXY_IGNORE_THIS
VertexTraits {};
HalfedgeTraits {};
EdgeTraits {};
FaceTraits {};
#endif
VertexAttributes(0);
HalfedgeAttributes(Attributes::PrevHalfedge);
EdgeAttributes(0);
FaceAttributes(0);
};
struct DefaultTraitsDouble : public DefaultTraits
{
typedef OpenMesh::Vec3d Point;
typedef OpenMesh::Vec3d Normal;
typedef OpenMesh::Vec4f Color;
};
//== CLASS DEFINITION =========================================================
template <class _Traits1, class _Traits2> struct MergeTraits
{
#ifndef DOXY_IGNORE_THIS
struct Result
{
// Mipspro needs this (strange) typedef
typedef _Traits1 T1;
typedef _Traits2 T2;
VertexAttributes ( T1::VertexAttributes | T2::VertexAttributes );
HalfedgeAttributes ( T1::HalfedgeAttributes | T2::HalfedgeAttributes );
EdgeAttributes ( T1::EdgeAttributes | T2::EdgeAttributes );
FaceAttributes ( T1::FaceAttributes | T2::FaceAttributes );
typedef typename T1::Point Point;
typedef typename T1::Normal Normal;
typedef typename T1::Color Color;
typedef typename T1::TexCoord TexCoord;
template <class Base, class Refs> class VertexT :
public T1::template VertexT<
typename T2::template VertexT<Base, Refs>, Refs>
{};
template <class Base, class Refs> class HalfedgeT :
public T1::template HalfedgeT<
typename T2::template HalfedgeT<Base, Refs>, Refs>
{};
template <class Base, class Refs> class EdgeT :
public T1::template EdgeT<
typename T2::template EdgeT<Base, Refs>, Refs>
{};
template <class Base, class Refs> class FaceT :
public T1::template FaceT<
typename T2::template FaceT<Base, Refs>, Refs>
{};
};
#endif
};
#define OM_Merge_Traits(_S1, _S2, _D) \
typedef OpenMesh::MergeTraits<_S1, _S2>::Result _D;
#define OM_Merge_Traits_In_Template(_S1, _S2, _D) \
typedef typename OpenMesh::MergeTraits<_S1, _S2>::Result _D;
//=============================================================================
} // namespace OpenMesh
//=============================================================================
#endif // OPENMESH_TRAITS_HH defined
//=============================================================================
Attributes.hh
This file provides some macros containing attribute usage.
OpenMesh
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition MeshItems.hh:59
OpenMesh::Attributes::PrevHalfedge
@ PrevHalfedge
Add storage for previous halfedge (halfedges). The bit is set by default in the DefaultTraits.
Definition Attributes.hh:84
OpenMesh::VectorT< float, 3 >
VectorT< float, 4 >
OpenMesh::DefaultTraits
Base class for all traits.
Definition Traits.hh:122
OpenMesh::DefaultTraits::TextureIndex
int TextureIndex
The default texture index type.
Definition Traits.hh:137
OpenMesh::DefaultTraits::TexCoord1D
float TexCoord1D
The default 1D texture coordinate type is float.
Definition Traits.hh:130
OpenMesh::DefaultTraits::TexCoord2D
Vec2f TexCoord2D
The default 2D texture coordinate type is OpenMesh::Vec2f.
Definition Traits.hh:132
OpenMesh::DefaultTraits::Point
Vec3f Point
The default coordinate type is OpenMesh::Vec3f.
Definition Traits.hh:124
OpenMesh::DefaultTraits::Color
Vec3uc Color
The default color type is OpenMesh::Vec3uc.
Definition Traits.hh:140
OpenMesh::DefaultTraits::Normal
Vec3f Normal
The default normal type is OpenMesh::Vec3f.
Definition Traits.hh:127
OpenMesh::DefaultTraits::TexCoord3D
Vec3f TexCoord3D
The default 3D texture coordinate type is OpenMesh::Vec3f.
Definition Traits.hh:134
OpenMesh::DefaultTraitsDouble
Version of Default Traits that uses double precision for points and normals as well as floating point...
Definition Traits.hh:164
OpenMesh::DefaultTraitsDouble::Color
OpenMesh::Vec4f Color
Use RGBA Color.
Definition Traits.hh:170
OpenMesh::DefaultTraitsDouble::Normal
OpenMesh::Vec3d Normal
Use double precision Normals.
Definition Traits.hh:168
OpenMesh::DefaultTraitsDouble::Point
OpenMesh::Vec3d Point
Use double precision points.
Definition Traits.hh:166
OpenMesh::MergeTraits
Helper class to merge two mesh traits.
Definition Traits.hh:189
HalfedgeTraits
#define HalfedgeTraits
Macro for defining the halfedge traits. See Specifying your MyMesh.
Definition Traits.hh:95
VertexAttributes
#define VertexAttributes(_i)
Macro for defining the vertex attributes. See Specifying your MyMesh.
Definition Traits.hh:79
FaceTraits
#define FaceTraits
Macro for defining the face traits. See Specifying your MyMesh.
Definition Traits.hh:103
HalfedgeAttributes
#define HalfedgeAttributes(_i)
Macro for defining the halfedge attributes. See Specifying your MyMesh.
Definition Traits.hh:82
FaceAttributes
#define FaceAttributes(_i)
Macro for defining the face attributes. See Specifying your MyMesh.
Definition Traits.hh:88
EdgeAttributes
#define EdgeAttributes(_i)
Macro for defining the edge attributes. See Specifying your MyMesh.
Definition Traits.hh:85
VertexTraits
#define VertexTraits
Macro for defining the vertex traits. See Specifying your MyMesh.
Definition Traits.hh:91
EdgeTraits
#define EdgeTraits
Macro for defining the edge traits. See Specifying your MyMesh.
Definition Traits.hh:99