1 #ifndef MSP_GL_BATCH_H_
2 #define MSP_GL_BATCH_H_
5 #include <msp/datafile/objectloader.h>
7 #include "primitivetype.h"
15 Stores primitive type and element indices for a single GL draw call. Data
16 type for indices is automatically chosen to accommodate the largest index in
19 This is a pretty low-level class and mainly intended to be used by the Mesh
25 class Loader: public DataFile::ObjectLoader<Batch>
30 void indices(const std::vector<unsigned> &);
34 PrimitiveType prim_type;
36 std::vector<unsigned char> data;
46 static unsigned restart_index;
49 Batch(PrimitiveType t);
52 PrimitiveType get_type() const { return prim_type; }
53 void set_data_type(DataType);
54 DataType get_data_type() const { return data_type; }
55 void use_index_buffer(Buffer *, Batch * = 0);
56 Batch &append(unsigned);
57 void append(const std::vector<unsigned> &);
58 void append(const Batch &);
59 unsigned size() const { return data.size()/get_index_size(); }
60 unsigned get_index(unsigned) const;
64 unsigned get_index_size() const;
69 template<typename T, typename U>
72 template<typename T, typename U>
75 template<typename T, typename U>
78 void unlink_from_ibuf();
79 void update_ibuf_offsets();