gee_polygon_mesh.h

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 
00003 /* COPYRIGHT
00004  *
00005  * This file is part of the Visual Effects Engine - VEE
00006  *
00007  * Read the "VEE-LICENSE" file for the license.
00008  *
00009  * Authors & Copyright:   
00010  *
00011  * Tommi Ilmonen, Tuukka Heikura, Marko Myllymaa and 
00012  * Janne Kontkanen 2001-2004
00013  *
00014  * Additional copyrights: Tekes 2003-2004
00015  *
00016  * firstname.lastname@hut.fi
00017  *
00018  */
00019 
00020 #ifndef GEE_POLYGON_MESH_H
00021 #define GEE_POLYGON_MESH_H
00022 
00023 #include <gee_triangle_mesh.h>
00024 
00029 class GEE_PolygonIndices
00030 {
00031 public:
00032 
00033   GEE_PolygonIndices() {}
00034 
00035   void read(GEE_Io *, int);
00036   void write(GEE_Io *, int);
00037   
00038   void addVertex(int v) { m_indices.push_back(v); }
00039 
00040   std::vector<int> m_indices;
00041 };
00042 
00049 class GEE_PolygonMesh : public GEE_Geometry
00050 {
00051 public: 
00052   typedef std::map<int, GEE_PolygonVertex>::iterator  vertexIterator;
00053   typedef std::map<int, GEE_PolygonIndices>::iterator polygonIterator;
00054 
00055   GEE_PolygonMesh();
00056   ~GEE_PolygonMesh();
00057 
00058   virtual GEE_Geometry * clone() const;
00059   virtual void render(GEE_Renderer *);
00060   virtual bool getBoundingBox(VEE_BoundingBox *);
00061   virtual bool move(const VEE_Vector3 & offset);
00062 
00063 
00064   void clear();
00065   int addVertex(const GEE_PolygonVertex &);
00066   int addPolygon(const GEE_PolygonIndices &);
00067 
00068   GEE_PolygonVertex * getVertex(int);
00069 
00070   polygonIterator beginPolygon() { return m_polygons.begin(); }
00071   polygonIterator endPolygon()   { return m_polygons.end(); }
00072 
00073   uint polygonCount() const { return m_polygons.size(); }
00074 
00075   vertexIterator beginVertex() { return m_vertices.begin(); }
00076   vertexIterator endVertex()   { return m_vertices.end(); }
00077 
00078   uint vertexCount() const { return m_vertices.size(); }
00079 
00080   static GEE_PolygonIndices & getPolygon(polygonIterator &it)
00081   { return (*it).second; }
00082 
00083   GEE_TriangleMesh * triangleMesh();
00084 
00085   static GEE_PolygonMesh * cast(GEE_Geometry *d) 
00086   { return dynamic_cast<GEE_PolygonMesh *> (d); }
00087 
00088 protected:
00089 
00090   std::map<int, GEE_PolygonVertex>   m_vertices;
00091   std::map<int, GEE_PolygonIndices>  m_polygons;
00092 
00093   int m_vertexCounter;
00094   int m_polygonCounter;
00095 
00096   VEE_BoundingBox m_bbox;
00097 };
00098 
00099 
00100 #endif

Generated on Mon Mar 12 21:09:00 2007 for VEE - The Visual Effects Engine by  doxygen 1.4.6