1234567891011121314151617181920212223242526 |
- #include "client/rendering/Mesh.h"
- Mesh::Mesh() {
- vertexBuffer.bind();
- vertexBuffer.setFloatAttribute(0, 3, 0, 8);
- vertexBuffer.setFloatAttribute(1, 2, 3, 8);
- vertexBuffer.setFloatAttribute(2, 3, 5, 8);
- }
- void Mesh::add(const VertexData& data) {
- buffer.add(data);
- }
- void Mesh::clear() {
- buffer.clear();
- }
- void Mesh::build() {
- vertexBuffer.bindBuffer();
- vertexBuffer.setData(sizeof (VertexData) * buffer.getLength(), buffer.getData());
- }
- void Mesh::draw() const {
- vertexBuffer.bindArray();
- vertexBuffer.draw(buffer.getLength());
- }
|