#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; public: /** Constructor taking an array of triangles. */ Geometry(Vector3 *vertices, Vector3 *normals, float *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; float *mTexCoords; unsigned int mVboId; int mNumVertices; AxisAlignedBox3 mBoundingBox; bool mHasTexture; }; } #endif // GEOMETRY_H