+}
+
+void Batch::set_data_type(DataType t)
+{
+ if(t!=UNSIGNED_BYTE && t!=UNSIGNED_SHORT && t!=UNSIGNED_INT)
+ throw invalid_argument("Batch::set_data_type");
+ if(t==UNSIGNED_BYTE && max_index>0xFE)
+ throw invalid_operation("Batch::set_data_type");
+ else if(t==UNSIGNED_SHORT && max_index>0xFFFE)
+ throw invalid_operation("Batch::set_data_type");
+
+ if(data_type==UNSIGNED_BYTE && t==UNSIGNED_SHORT)
+ expand<unsigned char, unsigned short>(data);
+ else if(data_type==UNSIGNED_BYTE && t==UNSIGNED_INT)
+ expand<unsigned char, unsigned>(data);
+ else if(data_type==UNSIGNED_SHORT && t==UNSIGNED_INT)
+ expand<unsigned short, unsigned>(data);
+ else if(data_type==UNSIGNED_INT && t==UNSIGNED_BYTE)
+ shrink<unsigned, unsigned char>(data);
+ else if(data_type==UNSIGNED_INT && t==UNSIGNED_SHORT)
+ shrink<unsigned, unsigned short>(data);
+ else if(data_type==UNSIGNED_SHORT && t==UNSIGNED_BYTE)
+ shrink<unsigned short, unsigned char>(data);
+
+ data_type = t;
+ update_offset();
+ dirty = true;
+}
+
+Batch &Batch::append(unsigned i)
+{
+ 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;
+}
+
+bool Batch::can_append(PrimitiveType other_type)
+{
+ if(other_type!=prim_type)
+ return false;
+ else if(prim_type==LINE_STRIP || prim_type==LINE_LOOP || prim_type==TRIANGLE_FAN || prim_type==POLYGON)
+ return NV_primitive_restart;