Mesh.cpp 391 B

123456789101112131415
  1. #include "client/rendering/Mesh.h"
  2. #include "rendering/Attributes.h"
  3. Mesh::Mesh() : vertices(0) {
  4. vertexBuffer.init(Attributes().addFloat(3).addFloat(2).addFloat(3));
  5. }
  6. void Mesh::build(const TypedBuffer<Triangle>& buffer) {
  7. vertices = buffer.getLength() * 3;
  8. vertexBuffer.setStaticData(buffer.getByteLength(), buffer);
  9. }
  10. void Mesh::draw() {
  11. vertexBuffer.draw(vertices);
  12. }