]> git.tdb.fi Git - libs/gl.git/blob - source/meshbuilder.cpp
Move filter heuristic for mipmap levels to Texture::Loader
[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 MeshBuilder::~MeshBuilder()
14 {
15         mesh.check_buffers(Mesh::VERTEX_BUFFER);
16 }
17
18 void MeshBuilder::auto_offset()
19 {
20         offset(mesh.get_vertices().size());
21 }
22
23 void MeshBuilder::begin_()
24 {
25         batch = new Batch(type);
26 }
27
28 void MeshBuilder::end_()
29 {
30         mesh.add_batch(*batch);
31         delete batch;
32         batch = 0;
33 }
34
35 void MeshBuilder::element_(unsigned i)
36 {
37         batch->append(i);
38 }
39
40 } // namespace GL
41 } // namespace Msp