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

Revision 2756, 895 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 CHCDemo
10{
11
12/** Represents drawable geometry consisting of triangles
13*/
14class Geometry
15{
16public:
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
29protected:
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.