00001 #pragma once
00002
00003 class Mesh;
00004 class MeshIterator;
00005 class visPolygon;
00006
00007 #include "Vis.hpp"
00008 #include <vector>
00009
00010 class Mesh;
00011 class MeshIterator;
00012
00016 class visPolygon
00017 {
00018 friend class Mesh;
00019 friend class MeshIterator;
00020
00024 V3f vertices[10];
00025
00029 int corners;
00030
00039 void clip( V3f point,
00040 vector<V3f> &first, vector<V3f> &s,
00041 vector<Plane3f> &clipPlanes, int plane,
00042 visPolygon* result);
00043
00051 void closeClip( vector<V3f> &first, vector<V3f> &s,
00052 vector<Plane3f> &clipPlanes,
00053 visPolygon* result);
00054
00055 public:
00056
00061 visPolygon() : corners(0) {};
00062
00068 void addVertex(V3f vertex);
00069
00073 void clear();
00074
00080 void clip(vector<Plane3f> &clipPlanes, visPolygon* result);
00081
00085 void draw();
00086
00090 visPolygon(const visPolygon &polygon);
00091 };
00092
00093 class MeshIterator
00094 {
00095 int polygon;
00096 int vertex;
00097 Mesh* parent;
00098
00099 public:
00100
00101 MeshIterator(Mesh* parent);
00102
00103 V3f operator* ();
00104
00105 void operator++ (int);
00106
00107 bool operator== (MeshIterator i);
00108 bool operator!= (MeshIterator i)
00109 {
00110 return !(*this == i);
00111 };
00112
00113 void reset();
00114 };
00115
00119 class Mesh
00120 {
00121 friend class MeshIterator;
00122
00126 vector<visPolygon> polygons;
00127
00128 public:
00129
00133 void addPolygon(visPolygon &polygon);
00134
00139 void clip(vector<Plane3f> &clipPlanes);
00140
00144 void clear();
00145
00149 void draw();
00150
00154 MeshIterator begin()
00155 {
00156 return MeshIterator(this);
00157 };
00158
00162 static MeshIterator end()
00163 {
00164 return MeshIterator(NULL);
00165 };
00166
00167 };