Mesh.h 684 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #ifndef MESH_H
  2. #define MESH_H
  3. #include <GL/glew.h>
  4. #include <vector>
  5. class Mesh final
  6. {
  7. public:
  8. struct VertexData final
  9. {
  10. float x;
  11. float y;
  12. float z;
  13. float tx;
  14. float ty;
  15. float nx;
  16. float ny;
  17. float nz;
  18. };
  19. Mesh();
  20. ~Mesh();
  21. void add(const VertexData& data);
  22. void clear();
  23. void build() const;
  24. void draw() const;
  25. private:
  26. Mesh(const Mesh& other) = delete;
  27. Mesh(Mesh&& other) = delete;
  28. Mesh& operator=(const Mesh& other) = delete;
  29. Mesh& operator=(Mesh&& other) = delete;
  30. GLuint vba;
  31. GLuint vbo;
  32. std::vector<VertexData> buffer;
  33. };
  34. #endif