+ if(ibuf)
+ {
+ ibuf->bind();
+ unsigned offset=0;
+ for(list<Batch>::const_iterator i=batches.begin(); i!=batches.end(); ++i)
+ {
+ i->draw_with_buffer(offset);
+ offset+=i->size();
+ }
+ ibuf->unbind();
+ }
+ else
+ {
+ for(list<Batch>::const_iterator i=batches.begin(); i!=batches.end(); ++i)
+ i->draw();
+ }
+}
+
+void Mesh::update_index_buffer()
+{
+ if(!ibuf)
+ return;
+
+ unsigned total=0;
+ for(list<Batch>::const_iterator i=batches.begin(); i!=batches.end(); ++i)
+ total+=i->size();
+
+ ibuf->data(total*sizeof(unsigned), 0);
+ unsigned offset=0;