source: GTP/trunk/App/Demos/Vis/CHC_revisited/Geometry.h @ 2776

Revision 2776, 942 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);
22        /** Render the geometry
23        */
24        void Render(RenderState *state);
25
26        int GetNumTriangles() const { return mNumVertices / 3; }
27
28        inline bool HasTexture() const { return mTexCoords != NULL; }
29        const AxisAlignedBox3& GetBoundingBox() const;
30
31protected:
32
33        void CalcBoundingBox();
34        /** Prepare vbos for rendering
35        */
36        void Prepare();
37
38
39        //////////
40
41        unsigned int mVboId;
42
43        Vector3 *mVertices;
44
45        Vector3 *mNormals;
46
47        float *mTexCoords;
48
49        int mNumVertices;
50
51        AxisAlignedBox3 mBoundingBox;
52};
53
54
55}
56
57#endif // GEOMETRY_H
Note: See TracBrowser for help on using the repository browser.