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