]> git.tdb.fi Git - libs/gl.git/blob - source/batch.h
Inherit Loaders from the ObjectLoader classes
[libs/gl.git] / source / batch.h
1 /* $Id$
2
3 This file is part of libmspgl
4 Copyright © 2007, 2009-2010 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7
8 #ifndef MSP_GL_BATCH_H_
9 #define MSP_GL_BATCH_H_
10
11 #include <vector>
12 #include <msp/datafile/objectloader.h>
13 #include "primitivetype.h"
14 #include "types.h"
15
16 namespace Msp {
17 namespace GL {
18
19 class Batch
20 {
21 public:
22         class Loader: public DataFile::ObjectLoader<Batch>
23         {
24         public:
25                 Loader(Batch &);
26         private:
27                 void indices(const std::vector<uint> &);
28         };
29
30 private:
31         PrimitiveType type;
32         std::vector<uint> indices;
33         uint min_index;
34         uint max_index;
35
36 public:
37         Batch(PrimitiveType t);
38         Batch &append(uint);
39         void append(const std::vector<uint> &);
40         PrimitiveType get_type() const { return type; }
41         unsigned size() const { return indices.size(); }
42         const std::vector<uint> &get_indices() const { return indices; }
43         void draw() const;
44         void draw_with_buffer(unsigned) const;
45 };
46
47 } // namespace GL
48 } // namespace Msp
49
50 #endif