ViewerMesh.h

Go to the documentation of this file.
00001 
00008 #ifndef  _VIEWER_MESH_H_
00009 #define  _VIEWER_MESH_H_
00010 
00011 #include <map>
00012 #include <vector>
00013 
00014 #include "Mesh/Vertex.h"
00015 #include "Mesh/Edge.h"
00016 #include "Mesh/Face.h"
00017 #include "Mesh/HalfEdge.h"
00018 
00019 #include "Mesh/BaseMesh.h"
00020 #include "Mesh/boundary.h"
00021 #include "Mesh/iterators.h"
00022 #include "Parser/parser.h"
00023 
00024 namespace MeshLib
00025 {
00031   class CViewerFace: public CFace
00032   {
00033   protected:
00035     CPoint m_normal;
00036   public:
00038           CPoint & normal() { return m_normal; };
00039   };
00040 
00046   class CViewerVertex : public  CVertex
00047   {
00048   protected:
00050     CPoint   m_rgb;
00051         
00052   public:
00054           CViewerVertex()
00055           {
00056                   m_rgb = CPoint(1,1,1); //default color is white
00057           }
00059           CPoint  & rgb()    { return m_rgb;    };
00060         
00062           void _from_string();
00063   };
00064  
00065  // read vertex rgb, uv from vertex string 
00066  inline void CViewerVertex::_from_string()
00067  {
00068                   CParser parser( m_string );
00069                 
00070                   for( std::list<CToken*>::iterator iter = parser.tokens().begin() ; iter != parser.tokens().end(); ++ iter )
00071                   {
00072                           CToken * token = *iter;
00073                           if( token->m_key == "uv" )
00074                           {
00075                                   token->m_value >> m_uv;
00076                           }
00077                           else
00078                           if( token->m_key == "rgb" )
00079                           {
00080                                   token->m_value >> m_rgb;
00081                           }
00082                   }
00083   };
00084 
00085 
00086 
00087 /*-------------------------------------------------------------------------------------------------------------------------------------
00088 
00089         Viewer Mesh
00090 
00091 --------------------------------------------------------------------------------------------------------------------------------------*/
00097  template<typename V, typename E, typename F, typename H>
00098 class CViewerMesh : public CBaseMesh<V,E,F,H>
00099 {
00100 public:
00101         typedef CBoundary<V,E,F,H> CBoundary;
00102         typedef CLoop<V,E,F,H> CLoop;
00103         typedef MeshVertexIterator<V,E,F,H> MeshVertexIterator;
00104         typedef MeshFaceIterator<V,E,F,H>   MeshFaceIterator;
00105         typedef MeshEdgeIterator<V,E,F,H>   MeshEdgeIterator;
00106         typedef VertexVertexIterator<V,E,F,H> VertexVertexIterator;
00107         typedef FaceVertexIterator<V,E,F,H> FaceVertexIterator;
00108         typedef VertexEdgeIterator<V,E,F,H> VertexEdgeIterator;
00109         typedef VertexFaceIterator<V,E,F,H> VertexFaceIterator;
00110         
00111 public:
00112 };
00113 
00114 typedef CViewerMesh<CViewerVertex, CEdge, CViewerFace, CHalfEdge> CVMesh;
00115 
00116 
00117 }
00118 #endif  VIEWER_MESH_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Defines