]> git.tdb.fi Git - libs/gl.git/blobdiff - source/meshbuilder.cpp
Drop Id tags and copyright notices from files
[libs/gl.git] / source / meshbuilder.cpp
index cd3be666780285da52c0adfff0e69cd1b0833319..57e85fc640ab1a66dc6d5a26187045507d479e1f 100644 (file)
@@ -1,10 +1,3 @@
-/* $Id$
-
-This file is part of libmspgl
-Copyright © 2007  Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
 #include "mesh.h"
 #include "meshbuilder.h"
 
@@ -14,21 +7,29 @@ namespace GL {
 MeshBuilder::MeshBuilder(Mesh &m):
        PrimitiveBuilder(m.vertices),
        mesh(m),
-       first(0)
+       batch(0)
 { }
 
+void MeshBuilder::auto_offset()
+{
+       offset(mesh.get_vertices().size());
+}
+
 void MeshBuilder::begin_()
 {
-       first=array.size();
+       batch = new Batch(type);
 }
 
 void MeshBuilder::end_()
 {
-       Batch batch(type);
-       unsigned last=array.size();
-       for(unsigned i=first; i<last; ++i)
-               batch.append(i);
-       mesh.add_batch(batch);
+       mesh.add_batch(*batch);
+       delete batch;
+       batch = 0;
+}
+
+void MeshBuilder::element_(unsigned i)
+{
+       batch->append(i);
 }
 
 } // namespace GL