- if(t!=UNSIGNED_BYTE && t!=UNSIGNED_SHORT && t!=UNSIGNED_INT)
- throw InvalidParameterValue("Batch data type must be an unsigned integer");
- if(t==UNSIGNED_BYTE && max_index>0xFE)
- throw InvalidState("UNSIGNED_BYTE can't hold all indices in Batch");
- else if(t==UNSIGNED_SHORT && max_index>0xFFFE)
- throw InvalidState("UNSIGNED_SHORT can't hold all indices in Batch");
-
- if(data_type==UNSIGNED_BYTE && t==UNSIGNED_SHORT)
- expand_data<unsigned char, unsigned short>();
- else if(data_type==UNSIGNED_BYTE && t==UNSIGNED_INT)
- expand_data<unsigned char, unsigned>();
- else if(data_type==UNSIGNED_SHORT && t==UNSIGNED_INT)
- expand_data<unsigned short, unsigned>();
- else if(data_type==UNSIGNED_INT && t==UNSIGNED_BYTE)
- shrink_data<unsigned, unsigned char>();
- else if(data_type==UNSIGNED_INT && t==UNSIGNED_SHORT)
- shrink_data<unsigned, unsigned short>();
- else if(data_type==UNSIGNED_SHORT && t==UNSIGNED_BYTE)
- shrink_data<unsigned short, unsigned char>();
-
- data_type = t;
- update_ibuf_offsets();
- dirty = true;
-}
-
-void Batch::use_index_buffer(Buffer *buf, Batch *prev)
-{
- if(buf && prev && prev->ibuf!=buf)
- throw InvalidParameterValue("Previous batch is not in the same buffer");
-
- if(!buf)
- {
- prev = 0;
- unlink_from_ibuf();
- }
+ if(t!=UNSIGNED_SHORT && t!=UNSIGNED_INT)
+ throw invalid_argument("Batch::set_data_type");
+ if(t==UNSIGNED_SHORT && max_index>0xFFFE)
+ throw invalid_operation("Batch::set_data_type");