#include "client/rendering/Mesh.h"
#include "rendering/Attributes.h"

Mesh::Mesh() : vertices(0) {
    vertexBuffer.init(Attributes().addFloat(3).addFloat(2).addFloat(3));
}

void Mesh::build(const TypedBuffer<Triangle>& buffer) {
    vertices = buffer.getLength() * 3;
    vertexBuffer.setStaticData(buffer.getByteLength(), buffer);
}

void Mesh::draw() {
    vertexBuffer.draw(vertices);
}