Mesh.cpp 432 B

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