]> git.tdb.fi Git - libs/gl.git/blob - source/primitivebuilder.h
Add a MatrixStack to VertexBuilder
[libs/gl.git] / source / primitivebuilder.h
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 #ifndef MSP_GL_PRIMITIVEBUILDER_H_
9 #define MSP_GL_PRIMITIVEBUILDER_H_
10
11 #include "primitivetype.h"
12 #include "vertexarray.h"
13 #include "vertexbuilder.h"
14
15 namespace Msp {
16 namespace GL {
17
18 class VertexArray;
19 class VertexArrayBuilder;
20
21 /**
22 Base class for primitive builders.  This is derived from VertexBuilder and adds
23 begin() and end() functions for specifying batches of primitives instead of
24 just vertices.
25 */
26 class PrimitiveBuilder: public VertexBuilder
27 {
28 protected:
29         VertexArray &array;
30         VertexArrayBuilder vab;
31         PrimitiveType type;
32         bool in_batch;
33
34         PrimitiveBuilder(VertexArray &);
35 public:
36         void begin(PrimitiveType);
37         void end();
38         void element(unsigned);
39         PrimitiveType get_type() const;
40 protected:
41         virtual void vertex_(const Vector4 &);
42         virtual void begin_() =0;
43         virtual void end_() =0;
44         virtual void element_(unsigned) =0;
45 };
46
47 } // namespace GL
48 } // namespace Msp
49
50 #endif