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

Revision 2980, 1.2 KB checked in by mattausch, 16 years ago (diff)
RevLine 
[2840]1#ifndef __GEOMETRY_H
2#define __GEOMETRY_H
[2642]3
[2752]4#include "common.h"
5#include "AxisAlignedBox3.h"
[2755]6#include "Triangle3.h"
[2751]7
[2752]8
[2776]9namespace CHCDemoEngine
[2642]10{
11
[2773]12class RenderState;
13
[2980]14
15/** Represents drawable geometry consisting of triangles.
[2642]16*/
17class Geometry
18{
[2980]19        friend class ResourceManager;
20        friend class EntityMerger;
[2823]21
[2642]22public:
[2953]23        /** Constructs a geometry from the given data.
24                The vertices are interpreted as triangles.
25
[2951]26                If delData is true, the vertex / normal / texture is deleted when
27                after it was transferred into a vbo
[2751]28        */
[2823]29        Geometry(Vector3 *vertices,
30                     Vector3 *normals,
[2980]31                         Texcoord2 *texcoords,
[2823]32                         int numVertices,
33                         bool delData);
[2793]34
[2781]35        ~Geometry();
[2756]36        /** Render the geometry
37        */
[2773]38        void Render(RenderState *state);
[2642]39
[2773]40        int GetNumTriangles() const { return mNumVertices / 3; }
[2755]41
[2795]42        inline bool HasTexture() const { return mHasTexture; }
[2842]43       
[2756]44        const AxisAlignedBox3& GetBoundingBox() const;
[2755]45
[2751]46protected:
[2642]47
[2756]48        void CalcBoundingBox();
49        /** Prepare vbos for rendering
50        */
51        void Prepare();
[2751]52
53
[2756]54        //////////
[2755]55
[2756]56        Vector3 *mVertices;
[2755]57
[2756]58        Vector3 *mNormals;
[2746]59
[2980]60        Texcoord2 *mTexCoords;
[2642]61
[2793]62        unsigned int mVboId;
63
[2756]64        int mNumVertices;
65
[2751]66        AxisAlignedBox3 mBoundingBox;
[2795]67
68        bool mHasTexture;
[2642]69};
70
[2756]71
[2751]72}
[2752]73
[2642]74#endif // GEOMETRY_H
Note: See TracBrowser for help on using the repository browser.