#ifndef MESH_H #define MESH_H #include #include #include #include class Mesh { protected: enum { // required buffers INDICES_BUFFER, POSITION_BUFFER, // optionnal buffers : NORMAL_BUFFER, TEXCOORD_BUFFER, TANGENT_BUFFER, NB_BUFFERS }; typedef struct { glm::vec3 tangent; glm::vec3 binormal; } Tangents; std::vector positions; std::vector normals; std::vector texCoords; std::vector tangents; std::vector indices; GLuint vao; GLuint vbo[NB_BUFFERS]; bool locked; public: ~Mesh(); bool hasNormals(); bool hasTexCoords(); bool hasTangents(); /* * When the mesh is locked, addFace and addVertex do nothing, but the mesh can be drawn * initGL locks the mesh * destroyGL unlocks the mesh */ void initGL(bool isDynamic = false); void destroyGL(); void draw(); bool isLocked(){return locked;} }; #endif // MESH_H