]> git.tdb.fi Git - libs/gl.git/blobdiff - source/primitivebuilder.h
Make the use of DevIL optional
[libs/gl.git] / source / primitivebuilder.h
diff --git a/source/primitivebuilder.h b/source/primitivebuilder.h
new file mode 100644 (file)
index 0000000..cfe0a02
--- /dev/null
@@ -0,0 +1,48 @@
+/* $Id$
+
+This file is part of libmspgl
+Copyright © 2007  Mikko Rasa, Mikkosoft Productions
+Distributed under the LGPL
+*/
+
+#ifndef MSP_GL_PRIMITIVEBUILDER_H_
+#define MSP_GL_PRIMITIVEBUILDER_H_
+
+#include "primitivetype.h"
+#include "vertexarray.h"
+#include "vertexbuilder.h"
+
+namespace Msp {
+namespace GL {
+
+class VertexArray;
+class VertexArrayBuilder;
+
+/**
+Base class for primitive builders.  This is derived from VertexBuilder and adds
+begin() and end() functions for specifying batches of primitives instead of
+just vertices.
+*/
+class PrimitiveBuilder: public VertexBuilder
+{
+protected:
+       VertexArray &array;
+       RefPtr<VertexArrayBuilder> builder;
+       PrimitiveType type;
+       bool in_batch;
+
+       PrimitiveBuilder(VertexArray &);
+public:
+       void begin(PrimitiveType);
+       void end();
+       PrimitiveType get_type() const;
+protected:
+       virtual void vertex_(float, float, float, float);
+       virtual void begin_() =0;
+       virtual void end_() =0;
+};
+
+} // namespace GL
+} // namespace Msp
+
+#endif