Line | |
---|
1 | #ifndef GEOMETRY_H
|
---|
2 | #define GEOMETRY_H
|
---|
3 |
|
---|
4 | #include "common.h"
|
---|
5 | #include "AxisAlignedBox3.h"
|
---|
6 | #include "Triangle3.h"
|
---|
7 |
|
---|
8 |
|
---|
9 | namespace CHCDemoEngine
|
---|
10 | {
|
---|
11 |
|
---|
12 | class RenderState;
|
---|
13 |
|
---|
14 | /** Represents drawable geometry consisting of triangles
|
---|
15 | */
|
---|
16 | class Geometry
|
---|
17 | {
|
---|
18 | public:
|
---|
19 | /** Constructor taking an array of triangles.
|
---|
20 | */
|
---|
21 | Geometry(Vector3 *vertices, Vector3 *normals, float *texcoords, int numVertices, bool delData);
|
---|
22 |
|
---|
23 | ~Geometry();
|
---|
24 | /** Render the geometry
|
---|
25 | */
|
---|
26 | void Render(RenderState *state);
|
---|
27 |
|
---|
28 | int GetNumTriangles() const { return mNumVertices / 3; }
|
---|
29 |
|
---|
30 | inline bool HasTexture() const { return mHasTexture; }
|
---|
31 | const AxisAlignedBox3& GetBoundingBox() const;
|
---|
32 |
|
---|
33 | protected:
|
---|
34 |
|
---|
35 | void CalcBoundingBox();
|
---|
36 | /** Prepare vbos for rendering
|
---|
37 | */
|
---|
38 | void Prepare();
|
---|
39 |
|
---|
40 |
|
---|
41 | //////////
|
---|
42 |
|
---|
43 | Vector3 *mVertices;
|
---|
44 |
|
---|
45 | Vector3 *mNormals;
|
---|
46 |
|
---|
47 | float *mTexCoords;
|
---|
48 |
|
---|
49 | unsigned int mVboId;
|
---|
50 |
|
---|
51 | int mNumVertices;
|
---|
52 |
|
---|
53 | AxisAlignedBox3 mBoundingBox;
|
---|
54 |
|
---|
55 | bool mHasTexture;
|
---|
56 | };
|
---|
57 |
|
---|
58 |
|
---|
59 | }
|
---|
60 |
|
---|
61 | #endif // GEOMETRY_H |
---|
Note: See
TracBrowser
for help on using the repository browser.