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

Revision 3126, 1.5 KB checked in by mattausch, 16 years ago (diff)

started to include normal mapping

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. The vertices are
24                interpreted as triangles. If delData is true, the
25                vertex / normal / texture is deleted when after it was
26                transferred into a vbo
27        */
28        Geometry(Vector3 *vertices,
29                     Vector3 *normals,
30                         Texcoord2 *texcoords,
31                         int numVertices,
32                         bool delData,
33                         Vector3 *tangents);
34        /** Detructor destroying the opengl resources.
35        */
36        ~Geometry();
37        /** Render the geometry
38        */
39        void Render(RenderState *state);
40        /** Return bounding box.
41        */
42        const AxisAlignedBox3& GetBoundingBox() const;
43        /** Returns the number of triangles in this geometry.
44        */
45        inline int GetNumTriangles() const { return mNumVertices / 3; }
46        /** Returns true if this geometry has a texture
47        */
48        inline bool HasTexture() const { return mHasTexture; }
49       
50
51protected:
52        /** Calculates the bounding box from the vertices.
53        */
54        void CalcBoundingBox();
55        /** Prepare vbos for rendering
56        */
57        void Prepare();
58
59
60        //////////
61
62        Vector3 *mVertices;
63
64        Vector3 *mNormals;
65
66        Vector3 *mTangents;
67
68        Texcoord2 *mTexCoords;
69
70        unsigned int mVboId;
71
72        int mNumVertices;
73
74        AxisAlignedBox3 mBoundingBox;
75
76        bool mHasTexture;
77
78        bool mHasTangents;
79};
80
81
82}
83
84#endif // GEOMETRY_H
Note: See TracBrowser for help on using the repository browser.