+ append_index(i);
+
+ update_offset();
+ dirty = true;
+
+ return *this;
+}
+
+void Batch::append(const vector<unsigned> &ind)
+{
+ if(ind.empty())
+ return;
+
+ data.reserve(data.size()+ind.size()*get_index_size());
+ for(vector<unsigned>::const_iterator i=ind.begin(); i!=ind.end(); ++i)
+ append_index(*i);
+
+ update_offset();
+ dirty = true;
+}
+
+void Batch::append(const Batch &other)
+{
+ if(other.prim_type!=prim_type)
+ throw invalid_argument("Batch::append");
+ if(prim_type==LINE_STRIP || prim_type==LINE_LOOP || prim_type==TRIANGLE_FAN || prim_type==POLYGON)
+ static Require _req(NV_primitive_restart);
+
+ if(other.data.empty())
+ return;
+
+ if(prim_type==POINTS || prim_type==LINES || prim_type==TRIANGLES || prim_type==QUADS)
+ ;
+ else if(NV_primitive_restart)
+ {
+ restart = true;
+ if(data_type==UNSIGNED_SHORT)
+ ::append<unsigned short>(data, 0xFFFF);
+ else if(data_type==UNSIGNED_INT)
+ ::append<unsigned>(data, 0xFFFFFFFF);
+ else
+ data.push_back(0xFF);
+ }
+ else if(prim_type==TRIANGLE_STRIP)
+ {
+ append(get_index(size()-1));
+ append(other.get_index(0));
+ if(size()&1)
+ append(other.get_index(0));
+ }
+ else if(prim_type==QUAD_STRIP)
+ {
+ append(get_index(size()-1));
+ append(get_index(size()-1));
+ append(other.get_index(0));
+ append(other.get_index(0));
+ }
+
+ unsigned count = other.size();
+ for(unsigned i=0; i<count; ++i)
+ append_index(other.get_index(i));
+
+ update_offset();
+ dirty = true;
+}
+
+void Batch::append_index(unsigned i)
+{
+ if(data.empty())