source: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Geometry.h @ 2782

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