]> git.tdb.fi Git - libs/gl.git/blob - source/meshbuilder.cpp
Add the meshbuilder.* files too
[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         first(0)
18 { }
19
20 void MeshBuilder::begin_()
21 {
22         first=array.size();
23 }
24
25 void MeshBuilder::end_()
26 {
27         Batch batch(type);
28         unsigned last=array.size();
29         for(unsigned i=first; i<last; ++i)
30                 batch.append(i);
31         mesh.add_batch(batch);
32 }
33
34 } // namespace GL
35 } // namespace Msp