Mesh.cpp 410 B

123456789101112131415
  1. #include "client/rendering/Mesh.h"
  2. #include "gaming-core/wrapper/Attributes.h"
  3. Mesh::Mesh() : vertices(0) {
  4. vertexBuffer.setAttributes(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. }