]> git.tdb.fi Git - libs/gl.git/blob - source/meshbuilder.cpp
Support specifying elements in PrimitiveBuilder
[libs/gl.git] / source / meshbuilder.cpp
1 /* $Id$
2
3 This file is part of libmspgl
4 Copyright © 2007  Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7
8 #include "mesh.h"
9 #include "meshbuilder.h"
10
11 namespace Msp {
12 namespace GL {
13
14 MeshBuilder::MeshBuilder(Mesh &m):
15         PrimitiveBuilder(m.vertices),
16         mesh(m),
17         batch(0)
18 { }
19
20 void MeshBuilder::begin_()
21 {
22         batch=new Batch(type);
23 }
24
25 void MeshBuilder::end_()
26 {
27         mesh.add_batch(*batch);
28         delete batch;
29         batch=0;
30 }
31
32 void MeshBuilder::element_(unsigned i)
33 {
34         batch->append(i);
35 }
36
37 } // namespace GL
38 } // namespace Msp