#ifndef MESH_H #define MESH_H #include #include class Mesh { public: Mesh(int mode); 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(bool print = false); void draw(); void draw(int start, int count); 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; }; class NormalTextureMesh : public Mesh { public: NormalTextureMesh() : Mesh(Mesh::TEXTURE | Mesh::NORMAL) {}; }; #endif