Mesh.h 642 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #ifndef MESH_H
  2. #define MESH_H
  3. #include "math/Vector.h"
  4. #include "rendering/VertexBuffer.h"
  5. #include "utils/TypedBuffer.h"
  6. class Mesh final {
  7. VertexBuffer vertexBuffer;
  8. int vertices;
  9. public:
  10. struct Vertex final {
  11. Vector3 position;
  12. Vector2 texture;
  13. };
  14. class Triangle final {
  15. Vertex a;
  16. Vector3 normalA;
  17. Vertex b;
  18. Vector3 normalB;
  19. Vertex c;
  20. Vector3 normalC;
  21. public:
  22. Triangle(const Vertex& a, const Vertex& b, const Vertex& c);
  23. };
  24. Mesh();
  25. bool init();
  26. void build(const TypedBuffer<Triangle>& buffer);
  27. void draw();
  28. };
  29. #endif