- 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 invalid_argument("Batch::use_index_buffer");
-
- if(!buf)
- {
- prev = 0;
- unlink_from_ibuf();
- }
-
- ibuf = buf;
- prev_in_ibuf = prev;
- next_in_ibuf = 0;
- if(prev)
- {
- prev->next_in_ibuf = this;
- ibuf_offset = prev->ibuf_offset+prev->data.size();
- }
- else
- ibuf_offset = 0;
+ if(index_type==UNSIGNED_SHORT && t==UNSIGNED_INT)
+ expand<UInt16, UInt32>(data);
+ else if(index_type==UNSIGNED_INT && t==UNSIGNED_SHORT)
+ shrink<UInt32, UInt16>(data);