Mesh.cpp 421 B

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