Revision 2953,
1.2 KB
checked in by mattausch, 16 years ago
(diff) |
started different stuff
|
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 | /** Constructs a geometry from the given data.
|
---|
22 | The vertices are interpreted as triangles.
|
---|
23 |
|
---|
24 | If delData is true, the vertex / normal / texture is deleted when
|
---|
25 | after it was transferred into a vbo
|
---|
26 | */
|
---|
27 | Geometry(Vector3 *vertices,
|
---|
28 | Vector3 *normals,
|
---|
29 | float *texcoords,
|
---|
30 | int numVertices,
|
---|
31 | bool delData);
|
---|
32 |
|
---|
33 | ~Geometry();
|
---|
34 | /** Render the geometry
|
---|
35 | */
|
---|
36 | void Render(RenderState *state);
|
---|
37 |
|
---|
38 | int GetNumTriangles() const { return mNumVertices / 3; }
|
---|
39 |
|
---|
40 | inline bool HasTexture() const { return mHasTexture; }
|
---|
41 |
|
---|
42 | const AxisAlignedBox3& GetBoundingBox() const;
|
---|
43 |
|
---|
44 | protected:
|
---|
45 |
|
---|
46 | void CalcBoundingBox();
|
---|
47 | /** Prepare vbos for rendering
|
---|
48 | */
|
---|
49 | void Prepare();
|
---|
50 |
|
---|
51 |
|
---|
52 | //////////
|
---|
53 |
|
---|
54 | Vector3 *mVertices;
|
---|
55 |
|
---|
56 | Vector3 *mNormals;
|
---|
57 |
|
---|
58 | float *mTexCoords;
|
---|
59 |
|
---|
60 | unsigned int mVboId;
|
---|
61 |
|
---|
62 | int mNumVertices;
|
---|
63 |
|
---|
64 | AxisAlignedBox3 mBoundingBox;
|
---|
65 |
|
---|
66 | bool mHasTexture;
|
---|
67 | };
|
---|
68 |
|
---|
69 |
|
---|
70 | }
|
---|
71 |
|
---|
72 | #endif // GEOMETRY_H |
---|
Note: See
TracBrowser
for help on using the repository browser.