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

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