]> git.tdb.fi Git - libs/gl.git/blob - source/builders/meshbuilder.cpp
Move ProgramData to materials
[libs/gl.git] / source / builders / meshbuilder.cpp
1 #include "mesh.h"
2 #include "meshbuilder.h"
3
4 using namespace std;
5
6 namespace Msp {
7 namespace GL {
8
9 MeshBuilder::MeshBuilder(Mesh &m):
10         PrimitiveBuilder(m.vertices),
11         mesh(m),
12         batch(0)
13 { }
14
15 MeshBuilder::~MeshBuilder()
16 {
17         mesh.check_buffers(Mesh::VERTEX_BUFFER);
18 }
19
20 void MeshBuilder::auto_offset()
21 {
22         offset(mesh.get_vertices().size());
23 }
24
25 void MeshBuilder::begin_()
26 {
27         batch = new Batch(type);
28 }
29
30 void MeshBuilder::end_()
31 {
32         mesh.add_batch(move(*batch));
33         delete batch;
34         batch = 0;
35 }
36
37 void MeshBuilder::element_(unsigned i)
38 {
39         batch->append(i);
40 }
41
42 } // namespace GL
43 } // namespace Msp