source:
GTP/trunk/App/Demos/Vis/CHC_revisited/Geometry.h
@
2773
Revision 2773, 936 bytes checked in by mattausch, 16 years ago (diff) |
---|
Rev | Line | |
---|---|---|
[2642] | 1 | #ifndef GEOMETRY_H |
2 | #define GEOMETRY_H | |
3 | ||
[2752] | 4 | #include "common.h" |
5 | #include "AxisAlignedBox3.h" | |
[2755] | 6 | #include "Triangle3.h" |
[2751] | 7 | |
[2752] | 8 | |
[2751] | 9 | namespace CHCDemo |
[2642] | 10 | { |
11 | ||
[2773] | 12 | class RenderState; |
13 | ||
[2751] | 14 | /** Represents drawable geometry consisting of triangles |
[2642] | 15 | */ |
16 | class Geometry | |
17 | { | |
18 | public: | |
[2756] | 19 | /** Constructor taking an array of triangles. |
[2751] | 20 | */ |
[2756] | 21 | Geometry(Vector3 *vertices, Vector3 *normals, float *texcoords, int numVertices); |
22 | /** Render the geometry | |
23 | */ | |
[2773] | 24 | void Render(RenderState *state); |
[2642] | 25 | |
[2773] | 26 | int GetNumTriangles() const { return mNumVertices / 3; } |
[2755] | 27 | |
[2756] | 28 | inline bool HasTexture() const { return mTexCoords != NULL; } |
29 | const AxisAlignedBox3& GetBoundingBox() const; | |
[2755] | 30 | |
[2751] | 31 | protected: |
[2642] | 32 | |
[2756] | 33 | void CalcBoundingBox(); |
34 | /** Prepare vbos for rendering | |
35 | */ | |
36 | void Prepare(); | |
[2751] | 37 | |
38 | ||
[2756] | 39 | ////////// |
[2755] | 40 | |
[2756] | 41 | unsigned int mVboId; |
[2642] | 42 | |
[2756] | 43 | Vector3 *mVertices; |
[2755] | 44 | |
[2756] | 45 | Vector3 *mNormals; |
[2746] | 46 | |
[2756] | 47 | float *mTexCoords; |
[2642] | 48 | |
[2756] | 49 | int mNumVertices; |
50 | ||
[2751] | 51 | AxisAlignedBox3 mBoundingBox; |
[2642] | 52 | }; |
53 | ||
[2756] | 54 | |
[2751] | 55 | } |
[2752] | 56 | |
[2642] | 57 | #endif // GEOMETRY_H |
Note: See TracBrowser
for help on using the repository browser.