Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Traits.hh

Go to the documentation of this file.
00001 //=============================================================================
00002 //                                                                            
00003 //                               OpenMesh                                     
00004 //      Copyright (C) 2001-2005 by Computer Graphics Group, RWTH Aachen       
00005 //                           www.openmesh.org                                 
00006 //                                                                            
00007 //-----------------------------------------------------------------------------
00008 //                                                                            
00009 //                                License                                     
00010 //                                                                            
00011 //   This library is free software; you can redistribute it and/or modify it 
00012 //   under the terms of the GNU Library General Public License as published  
00013 //   by the Free Software Foundation, version 2.                             
00014 //                                                                             
00015 //   This library is distributed in the hope that it will be useful, but       
00016 //   WITHOUT ANY WARRANTY; without even the implied warranty of                
00017 //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         
00018 //   Library General Public License for more details.                          
00019 //                                                                            
00020 //   You should have received a copy of the GNU Library General Public         
00021 //   License along with this library; if not, write to the Free Software       
00022 //   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 
00023 //                                                                            
00024 //-----------------------------------------------------------------------------
00025 //                                                                            
00026 //   $Revision: 1.1.1.1 $
00027 //   $Date: 2004/09/06 12:35:15 $
00028 //                                                                            
00029 //=============================================================================
00030 
00031 
00037 //=============================================================================
00038 //
00039 //  CLASS Traits
00040 //
00041 //=============================================================================
00042 
00043 #ifndef OPENMESH_TRAITS_HH
00044 #define OPENMESH_TRAITS_HH
00045 
00046 
00047 //== INCLUDES =================================================================
00048 
00049 
00050 #include <OpenMesh/Core/System/config.hh>
00051 #include <OpenMesh/Core/Math/VectorT.hh>
00052 #include <OpenMesh/Core/Attributes/Attributes.hh>
00053 #include <OpenMesh/Core/Mesh/Kernels/Common/Handles.hh>
00054 
00055 
00056 //== NAMESPACES ===============================================================
00057 
00058 
00059 namespace OpenMesh {
00060 
00061 
00062 //== CLASS DEFINITION =========================================================
00063 
00064 
00066 #define VertexAttributes(_i) enum { VertexAttributes = _i }
00067 
00069 #define HalfedgeAttributes(_i) enum { HalfedgeAttributes = _i }
00070 
00072 #define EdgeAttributes(_i) enum { EdgeAttributes = _i }
00073 
00075 #define FaceAttributes(_i) enum { FaceAttributes = _i }
00076 
00078 #define VertexTraits \
00079   template <class Base, class Refs> struct VertexT : public Base
00080 
00082 #define HalfedgeTraits \
00083   template <class Base, class Refs> struct HalfedgeT : public Base
00084 
00086 #define EdgeTraits \
00087   template <class Base, class Refs> struct EdgeT : public Base
00088 
00090 #define FaceTraits \
00091   template <class Base, class Refs> struct FaceT : public Base
00092 
00093 
00094 
00095 //== CLASS DEFINITION =========================================================
00096 
00097 
00108 struct DefaultTraits
00109 {
00111   typedef Vec3f  Point;
00112 
00114   typedef Vec3f  Normal;
00115 
00117   typedef float  TexCoord1D;
00119   typedef Vec2f  TexCoord2D;
00121   typedef Vec3f  TexCoord3D;
00122 
00124   typedef Vec3uc Color;
00125 
00126 #ifndef DOXY_IGNORE_THIS
00127   VertexTraits    {};
00128   HalfedgeTraits  {};
00129   EdgeTraits      {};
00130   FaceTraits      {};
00131 #endif
00132   
00133   VertexAttributes(0);
00134   HalfedgeAttributes(Attributes::PrevHalfedge);
00135   EdgeAttributes(0);
00136   FaceAttributes(0);
00137 };
00138 
00139 
00140 //== CLASS DEFINITION =========================================================
00141 
00142 
00154 template <class _Traits1, class _Traits2> struct MergeTraits
00155 {
00156 #ifndef DOXY_IGNORE_THIS
00157   struct Result
00158   {
00159     // Mipspro needs this (strange) typedef
00160     typedef _Traits1  T1;
00161     typedef _Traits2  T2;
00162 
00163 
00164     VertexAttributes   ( T1::VertexAttributes   | T2::VertexAttributes   );
00165     HalfedgeAttributes ( T1::HalfedgeAttributes | T2::HalfedgeAttributes );
00166     EdgeAttributes     ( T1::EdgeAttributes     | T2::EdgeAttributes     );
00167     FaceAttributes     ( T1::FaceAttributes     | T2::FaceAttributes     );
00168 
00169 
00170     typedef typename T1::Point    Point;
00171     typedef typename T1::Normal   Normal;
00172     typedef typename T1::Color    Color;
00173     typedef typename T1::TexCoord TexCoord;
00174 
00175     template <class Base, class Refs> class VertexT :
00176       public T1::template VertexT<
00177       typename T2::template VertexT<Base, Refs>, Refs>
00178     {};
00179 
00180     template <class Base, class Refs> class HalfedgeT :
00181       public T1::template HalfedgeT<
00182       typename T2::template HalfedgeT<Base, Refs>, Refs>
00183     {};
00184 
00185 
00186     template <class Base, class Refs> class EdgeT :
00187       public T1::template EdgeT<
00188       typename T2::template EdgeT<Base, Refs>, Refs>
00189     {};
00190 
00191 
00192     template <class Base, class Refs> class FaceT :
00193       public T1::template FaceT<
00194       typename T2::template FaceT<Base, Refs>, Refs>
00195     {};
00196   };
00197 #endif
00198 };
00199 
00200 
00207 #define OM_Merge_Traits(_S1, _S2, _D) \
00208   typedef OpenMesh::MergeTraits<_S1, _S2>::Result _D;
00209 
00210 
00215 #define OM_Merge_Traits_In_Template(_S1, _S2, _D) \
00216   typedef typename OpenMesh::MergeTraits<_S1, _S2>::Result _D;
00217 
00218 
00219 //=============================================================================
00220 } // namespace OpenMesh
00221 //=============================================================================
00222 #endif // OPENMESH_TRAITS_HH defined
00223 //=============================================================================
00224 

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