Mesh.h 661 B

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