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 CHCDemo
|
---|
10 | {
|
---|
11 |
|
---|
12 | /** Represents drawable geometry consisting of triangles
|
---|
13 | */
|
---|
14 | class Geometry
|
---|
15 | {
|
---|
16 | public:
|
---|
17 | /** Constructor taking an array of triangles.
|
---|
18 | */
|
---|
19 | Geometry(Vector3 *vertices, Vector3 *normals, float *texcoords, int numVertices);
|
---|
20 | /** Render the geometry
|
---|
21 | */
|
---|
22 | void Render();
|
---|
23 |
|
---|
24 | int CountTriangles() const { return mNumVertices / 3; }
|
---|
25 |
|
---|
26 | inline bool HasTexture() const { return mTexCoords != NULL; }
|
---|
27 | const AxisAlignedBox3& GetBoundingBox() const;
|
---|
28 |
|
---|
29 | protected:
|
---|
30 |
|
---|
31 | void CalcBoundingBox();
|
---|
32 | /** Prepare vbos for rendering
|
---|
33 | */
|
---|
34 | void Prepare();
|
---|
35 |
|
---|
36 |
|
---|
37 | //////////
|
---|
38 |
|
---|
39 | unsigned int mVboId;
|
---|
40 |
|
---|
41 | Vector3 *mVertices;
|
---|
42 |
|
---|
43 | Vector3 *mNormals;
|
---|
44 |
|
---|
45 | float *mTexCoords;
|
---|
46 |
|
---|
47 | int mNumVertices;
|
---|
48 |
|
---|
49 | AxisAlignedBox3 mBoundingBox;
|
---|
50 | };
|
---|
51 |
|
---|
52 |
|
---|
53 | }
|
---|
54 |
|
---|
55 | #endif // GEOMETRY_H |
---|
Note: See
TracBrowser
for help on using the repository browser.