#ifndef __GEOMETRY_H #define __GEOMETRY_H #include "common.h" #include "AxisAlignedBox3.h" #include "Triangle3.h" namespace CHCDemoEngine { class RenderState; /** Represents drawable geometry consisting of triangles. */ class Geometry { friend class ResourceManager; friend class EntityMerger; public: /** Constructs a geometry from the given data. The vertices are interpreted as triangles. If delData is true, the vertex / normal / texture is deleted when after it was transferred into a vbo */ Geometry(Vector3 *vertices, Vector3 *normals, Texcoord2 *texcoords, int numVertices, bool delData); ~Geometry(); /** Render the geometry */ void Render(RenderState *state); int GetNumTriangles() const { return mNumVertices / 3; } inline bool HasTexture() const { return mHasTexture; } const AxisAlignedBox3& GetBoundingBox() const; protected: void CalcBoundingBox(); /** Prepare vbos for rendering */ void Prepare(); ////////// Vector3 *mVertices; Vector3 *mNormals; Texcoord2 *mTexCoords; unsigned int mVboId; int mNumVertices; AxisAlignedBox3 mBoundingBox; bool mHasTexture; }; } #endif // GEOMETRY_H