3 This file is part of libmspgl
4 Copyright © 2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
10 #include "vertexarray.h"
17 Batch::Batch(PrimitiveType t):
23 Batch &Batch::append(unsigned i)
26 min_index = max_index = i;
29 min_index = min(min_index, i);
30 max_index = max(max_index, i);
37 void Batch::append(const vector<unsigned> &ind)
39 indices.reserve(indices.size()+ind.size());
40 for(vector<unsigned>::const_iterator i=ind.begin(); i!=ind.end(); ++i)
44 void Batch::draw() const
46 draw_range_elements(type, min_index, max_index, indices.size(), &indices[0]);
49 void Batch::draw_with_buffer(unsigned offset) const
51 draw_range_elements(type, min_index, max_index, indices.size(), (unsigned *)0+offset);
55 Batch::Loader::Loader(Batch &b):
56 DataFile::ObjectLoader<Batch>(b)
58 add("indices", &Loader::indices);
61 void Batch::Loader::indices(const vector<unsigned> &ind)