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 | friend class ResourceManager;
|
---|
19 |
|
---|
20 | public:
|
---|
21 | /** Constructor taking an array of triangles.
|
---|
22 | */
|
---|
23 | Geometry(Vector3 *vertices,
|
---|
24 | Vector3 *normals,
|
---|
25 | float *texcoords,
|
---|
26 | int numVertices,
|
---|
27 | bool delData);
|
---|
28 |
|
---|
29 | ~Geometry();
|
---|
30 | /** Render the geometry
|
---|
31 | */
|
---|
32 | void Render(RenderState *state);
|
---|
33 |
|
---|
34 | int GetNumTriangles() const { return mNumVertices / 3; }
|
---|
35 |
|
---|
36 | inline bool HasTexture() const { return mHasTexture; }
|
---|
37 |
|
---|
38 | const AxisAlignedBox3& GetBoundingBox() const;
|
---|
39 |
|
---|
40 | protected:
|
---|
41 |
|
---|
42 | void CalcBoundingBox();
|
---|
43 | /** Prepare vbos for rendering
|
---|
44 | */
|
---|
45 | void Prepare();
|
---|
46 |
|
---|
47 |
|
---|
48 | //////////
|
---|
49 |
|
---|
50 | Vector3 *mVertices;
|
---|
51 |
|
---|
52 | Vector3 *mNormals;
|
---|
53 |
|
---|
54 | float *mTexCoords;
|
---|
55 |
|
---|
56 | unsigned int mVboId;
|
---|
57 |
|
---|
58 | int mNumVertices;
|
---|
59 |
|
---|
60 | AxisAlignedBox3 mBoundingBox;
|
---|
61 |
|
---|
62 | bool mHasTexture;
|
---|
63 | };
|
---|
64 |
|
---|
65 |
|
---|
66 | }
|
---|
67 |
|
---|
68 | #endif // GEOMETRY_H |
---|
Note: See
TracBrowser
for help on using the repository browser.