+Mesh::Mesh(const VertexFormat &f):
+ vertices(f),
+ ibuf(0)
+{ }
+
+void Mesh::use_vertex_buffer(bool b)
+{
+ if(b)
+ {
+ vertices.use_vertex_buffer();
+ if(!ibuf)
+ ibuf=new Buffer(ELEMENT_ARRAY_BUFFER);
+ update_index_buffer();
+ }
+ else
+ {
+ vertices.use_vertex_buffer(0);
+ delete ibuf;
+ ibuf=0;
+ }
+}
+
+float *Mesh::get_vertex(unsigned i)
+{
+ return vertices[i];
+}
+
+void Mesh::add_batch(const Batch &b)
+{
+ batches.push_back(b);
+ update_index_buffer();
+}
+
+void Mesh::clear()
+{
+ vertices.clear();
+ batches.clear();
+}
+