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

Traits.hh

Go to the documentation of this file.
00001 //=============================================================================
00002 //                                                                            
00003 //                               OpenMesh                                     
00004 //        Copyright (C) 2003 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.16 $
00027 //   $Date: 2004/01/13 15:28:49 $
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.h>
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 Vec2f  TexCoord;
00118 
00120   typedef Vec3uc Color;
00121 
00122 #ifndef DOXY_IGNORE_THIS
00123   VertexTraits    {};
00124   HalfedgeTraits  {};
00125   EdgeTraits      {};
00126   FaceTraits      {};
00127 #endif
00128   
00129   VertexAttributes(0);
00130   HalfedgeAttributes(Attributes::PrevHalfedge);
00131   EdgeAttributes(0);
00132   FaceAttributes(0);
00133 };
00134 
00135 
00136 //== CLASS DEFINITION =========================================================
00137 
00138 
00150 template <class _Traits1, class _Traits2> struct MergeTraits
00151 {
00152 #ifndef DOXY_IGNORE_THIS
00153   struct Result
00154   {
00155     // Mipspro needs this (strange) typedef
00156     typedef _Traits1  T1;
00157     typedef _Traits2  T2;
00158 
00159 
00160     VertexAttributes   ( T1::VertexAttributes   | T2::VertexAttributes   );
00161     HalfedgeAttributes ( T1::HalfedgeAttributes | T2::HalfedgeAttributes );
00162     EdgeAttributes     ( T1::EdgeAttributes     | T2::EdgeAttributes     );
00163     FaceAttributes     ( T1::FaceAttributes     | T2::FaceAttributes     );
00164 
00165 
00166     typedef typename T1::Point    Point;
00167     typedef typename T1::Normal   Normal;
00168     typedef typename T1::Color    Color;
00169     typedef typename T1::TexCoord TexCoord;
00170 
00171     template <class Base, class Refs> class VertexT :
00172       public T1::template VertexT<
00173       typename T2::template VertexT<Base, Refs>, Refs>
00174     {};
00175 
00176     template <class Base, class Refs> class HalfedgeT :
00177       public T1::template HalfedgeT<
00178       typename T2::template HalfedgeT<Base, Refs>, Refs>
00179     {};
00180 
00181 
00182     template <class Base, class Refs> class EdgeT :
00183       public T1::template EdgeT<
00184       typename T2::template EdgeT<Base, Refs>, Refs>
00185     {};
00186 
00187 
00188     template <class Base, class Refs> class FaceT :
00189       public T1::template FaceT<
00190       typename T2::template FaceT<Base, Refs>, Refs>
00191     {};
00192   };
00193 #endif
00194 };
00195 
00196 
00203 #define OM_Merge_Traits(_S1, _S2, _D) \
00204   typedef OpenMesh::MergeTraits<_S1, _S2>::Result _D;
00205 
00206 
00211 #define OM_Merge_Traits_In_Template(_S1, _S2, _D) \
00212   typedef typename OpenMesh::MergeTraits<_S1, _S2>::Result _D;
00213 
00214 
00215 //=============================================================================
00216 } // namespace OpenMesh
00217 //=============================================================================
00218 #endif // OPENMESH_TRAITS_HH defined
00219 //=============================================================================
00220 

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