Remove 'Meshbuffer ran out of indices' limitation

This commit is contained in:
Kahrl 2013-04-25 18:32:18 +02:00 committed by PilzAdam
parent 58f036ad1d
commit 9a559eb8cf

@ -1338,12 +1338,20 @@ void MeshCollector::append(const TileSpec &tile,
const video::S3DVertex *vertices, u32 numVertices, const video::S3DVertex *vertices, u32 numVertices,
const u16 *indices, u32 numIndices) const u16 *indices, u32 numIndices)
{ {
if(numIndices > 65535)
{
dstream<<"FIXME: MeshCollector::append() called with numIndices="<<numIndices<<" (limit 65535)"<<std::endl;
return;
}
PreMeshBuffer *p = NULL; PreMeshBuffer *p = NULL;
for(u32 i=0; i<prebuffers.size(); i++) for(u32 i=0; i<prebuffers.size(); i++)
{ {
PreMeshBuffer &pp = prebuffers[i]; PreMeshBuffer &pp = prebuffers[i];
if(pp.tile != tile) if(pp.tile != tile)
continue; continue;
if(pp.indices.size() + numIndices > 65535)
continue;
p = &pp; p = &pp;
break; break;
@ -1361,11 +1369,6 @@ void MeshCollector::append(const TileSpec &tile,
for(u32 i=0; i<numIndices; i++) for(u32 i=0; i<numIndices; i++)
{ {
u32 j = indices[i] + vertex_count; u32 j = indices[i] + vertex_count;
if(j > 65535)
{
dstream<<"FIXME: Meshbuffer ran out of indices"<<std::endl;
// NOTE: Fix is to just add an another MeshBuffer
}
p->indices.push_back(j); p->indices.push_back(j);
} }
for(u32 i=0; i<numVertices; i++) for(u32 i=0; i<numVertices; i++)