]> git.tdb.fi Git - libs/gl.git/blobdiff - source/meshbuilder.cpp
Add the meshbuilder.* files too
[libs/gl.git] / source / meshbuilder.cpp
diff --git a/source/meshbuilder.cpp b/source/meshbuilder.cpp
new file mode 100644 (file)
index 0000000..cd3be66
--- /dev/null
@@ -0,0 +1,35 @@
+/* $Id$
+
+This file is part of libmspgl
+Copyright © 2007  Mikko Rasa, Mikkosoft Productions
+Distributed under the LGPL
+*/
+
+#include "mesh.h"
+#include "meshbuilder.h"
+
+namespace Msp {
+namespace GL {
+
+MeshBuilder::MeshBuilder(Mesh &m):
+       PrimitiveBuilder(m.vertices),
+       mesh(m),
+       first(0)
+{ }
+
+void MeshBuilder::begin_()
+{
+       first=array.size();
+}
+
+void MeshBuilder::end_()
+{
+       Batch batch(type);
+       unsigned last=array.size();
+       for(unsigned i=first; i<last; ++i)
+               batch.append(i);
+       mesh.add_batch(batch);
+}
+
+} // namespace GL
+} // namespace Msp