00001
00002
00003
00004
00005
00006 #ifndef POLYGONALMODEL_H
00007 #define POLYGONALMODEL_H
00008
00009 #include<Object.h>
00010 #include<AABoundingBox.h>
00011 #include<Mesh.h>
00012 #include<vector>
00013
00014 class Matrix4;
00015 class CollisionHull;
00016
00019 class PolygonalModel : public Object
00020 {
00021 public:
00022 PolygonalModel();
00023 PolygonalModel(const Mesh &mesh);
00024
00025 int size() {
00026 return mesh.size();
00027 }
00028 int nVertices();
00029 int nFaces();
00030 vector<Mesh> &meshArray() {
00031 return mesh;
00032 }
00033 bool empty() {
00034 return mesh.empty();
00035 }
00036 void clear() {
00037 bound.clear();
00038 mesh.clear();
00039 }
00040 void merge(PolygonalModel &poly);
00041 Mesh &addMesh();
00042 void deleteMesh(Mesh *mesh);
00043 void splitMesh(Mesh &mesh);
00044 void calculate();
00045 void calculateBound();
00046
00047 real intersect(const Ray &ray, real t, real);
00048 void transform(Matrix4 &M);
00049
00050
00051 float collide(const CollisionHull &hull, Vertex3 &nearestIntersection);
00052 void render(
00053 RenderContext &rc,
00054 RenderContext::Visibility visibility = RenderContext::PartlyVisible);
00055 real intersect(const Ray &ray) const;
00056
00057 void write(WDFFile &f);
00058 void readChunk(WDFFile::Chunk &chunk, WDFFile &f);
00059
00060 private:
00061 typedef Object super;
00062 typedef vector<Mesh> MeshList;
00063
00064 void createSymbols();
00065
00066 MeshList mesh;
00067 };
00068 #endif