X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fcore%2Fmesh.cpp;h=38642d4e26ee7459896429a03775eba3736f1700;hp=4414a90e6577910e7881dee65877134e7cd1ba69;hb=6955c16bb123f3b795186c99442dc4d92be0ebc9;hpb=b466adff89db080c304ac3178ce1f4fef844cb28 diff --git a/source/core/mesh.cpp b/source/core/mesh.cpp index 4414a90e..38642d4e 100644 --- a/source/core/mesh.cpp +++ b/source/core/mesh.cpp @@ -146,6 +146,19 @@ void Mesh::add_batch(const Batch &b) batches.back().use_buffer(ibuf, prev); } + DataType existing_type = batches.front().get_index_type(); + DataType added_type = batches.back().get_index_type(); + if(existing_type!=added_type) + { + if(get_type_size(existing_type)>get_type_size(added_type)) + batches.back().set_index_type(existing_type); + else + { + for(vector::iterator i=batches.begin(); i!=batches.end(); ++i) + i->set_index_type(added_type); + } + } + check_buffers(INDEX_BUFFER); }