#ifndef MESH_H #define MESH_H #include #include class Mesh { public: Mesh(); Mesh(int mode); Mesh(const Mesh& orig); virtual ~Mesh(); void addPosition(float x, float y, float z); void addColor(float r, float g, float b, float a); void addTexture(float tx, float ty); void addNormal(float nx, float ny, float nz); void build(); void draw(); static const int COLOR = 1; static const int TEXTURE = 2; static const int NORMAL = 4; private: void ensureCapacity(unsigned int index); GLuint vba = 0; GLuint vbo = 0; unsigned int positionStartIndex = 0; unsigned int colorStartIndex = 0; unsigned int textureStartIndex = 0; unsigned int normalStartIndex = 0; unsigned int positionIndex = 0; unsigned int colorIndex = 0; unsigned int textureIndex = 0; unsigned int normalIndex = 0; unsigned int vertexSize = 0; unsigned int vertices = 0; unsigned int dataSize = 3; float* data = nullptr; }; #endif