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