Fix 'Building a vbo with too many verticies' error.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4061 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2012-07-07 02:52:39 +00:00
parent 765642b1e2
commit eaae31aec1
1 changed files with 6 additions and 3 deletions

View File

@ -297,6 +297,7 @@ void GLBE_GenBatchVBOs(vbo_t **vbochain, batch_t *firstbatch, batch_t *stopbatch
void GLBE_GenBrushModelVBO(model_t *mod)
{
unsigned int vcount;
unsigned int cvcount;
batch_t *batch, *fbatch;
@ -312,16 +313,18 @@ void GLBE_GenBrushModelVBO(model_t *mod)
for (fbatch = batch = mod->batches[sortid]; batch != NULL; batch = batch->next)
{
for (i = 0, cvcount = 0; i < batch->maxmeshes; i++)
cvcount += batch->mesh[i]->numvertexes;
//firstmesh got reused as the number of verticies in each batch
if (vcount + batch->firstmesh > MAX_INDICIES)
if (vcount + cvcount > MAX_INDICIES)
{
GLBE_GenBatchVBOs(&mod->vbos, fbatch, batch);
fbatch = batch;
vcount = 0;
}
for (i = 0; i < batch->maxmeshes; i++)
vcount += batch->mesh[i]->numvertexes;
vcount += cvcount;
}
GLBE_GenBatchVBOs(&mod->vbos, fbatch, batch);