Main Page | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals

/Users/blackie/Documents/myRepository/phobosengine-vc2005/phobosengine/phobosengine/Mesh.h

Go to the documentation of this file.
00001 
00002 
00003 #ifndef MESH_H
00004 #define MESH_H
00005 
00006 
00007 #include "RenderableObject.h"
00008 #include "Triangle.h"
00009 
00010 #include <vector>
00011 
00012 
00013 namespace pge {
00014 
00015         class AABB;
00016         class Sphere;
00017 
00018         class Mesh : public IRenderableObject {
00019 
00020         public:
00021                 //************************************************************************
00022                 //
00023                 // Data structures
00024                 //
00025                 //************************************************************************
00026                 enum RenderMode {
00027                         Immediate, DisplayList, VertexBufferObject
00028                 };
00029 
00030 
00031                 //************************************************************************
00032                 //
00033                 // Constructor
00034                 //
00035                 //************************************************************************
00037                 Mesh(void);
00038 
00039 
00040                 //************************************************************************
00041                 //
00042                 // Destructor
00043                 //
00044                 //************************************************************************
00046                 virtual ~Mesh(void);
00047 
00048 
00049                 //************************************************************************
00050                 //
00051                 // Functions
00052                 //
00053                 //************************************************************************
00054                 bool init(void);
00055                 void render(void);
00056                 void timer(unsigned int delay);
00057 
00058                 std::vector<Triangle*>* getTriangles(void);
00059                 int getTriangleNum(void);
00060                 int getVertexNum(void);
00061                 AABB* getBoundingBox(void);
00062                 Sphere* getBoundingSphere(void);
00063                 void setAlphaColor(float alpha);
00064                 bool addTriangle(Triangle triangle);
00065                 bool getHeightAt(float posX, float posZ, float *result);
00066                 bool isHeightQueryInside(float posX, float posZ);
00067 
00068 
00069         private:
00070                 //************************************************************************
00071                 //
00072                 // Functions
00073                 //
00074                 //************************************************************************
00075                 void buildBoundingBox(void);
00076                 void buildBoundingSphere(void);
00077                 void buildDisplayList(void);
00078 
00079                 void renderImmediate(void);
00080                 void renderDisplayList(void);
00081 
00082 
00083                 //************************************************************************
00084                 //
00085                 // Variables
00086                 //
00087                 //************************************************************************
00088 
00089 
00090         protected:
00091                 //************************************************************************
00092                 //
00093                 // Variables
00094                 //
00095                 //************************************************************************
00096                 std::vector<Triangle*> *m_triangles;
00097 
00098                 float m_alphaColor;
00099 
00100                 // Display list.
00101                 unsigned int m_displayList;
00102 
00103                 // Render mode for the mesh.
00104                 RenderMode m_renderMode;
00105 
00106                 // Bounding box.
00107                 AABB *m_boundingBox;
00108 
00109                 // Bounding sphere.
00110                 Sphere *m_boundingSphere;
00111 
00112                 // Debug info / output switches.
00113                 bool m_debugRender;
00114         };
00115 };
00116 
00117 #endif

Generated on Mon Oct 16 12:08:10 2006 for Phobosengine by doxygen 1.3.4