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:
parent
765642b1e2
commit
eaae31aec1
1 changed files with 6 additions and 3 deletions
|
@ -297,6 +297,7 @@ void GLBE_GenBatchVBOs(vbo_t **vbochain, batch_t *firstbatch, batch_t *stopbatch
|
||||||
void GLBE_GenBrushModelVBO(model_t *mod)
|
void GLBE_GenBrushModelVBO(model_t *mod)
|
||||||
{
|
{
|
||||||
unsigned int vcount;
|
unsigned int vcount;
|
||||||
|
unsigned int cvcount;
|
||||||
|
|
||||||
|
|
||||||
batch_t *batch, *fbatch;
|
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 (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
|
//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);
|
GLBE_GenBatchVBOs(&mod->vbos, fbatch, batch);
|
||||||
fbatch = batch;
|
fbatch = batch;
|
||||||
vcount = 0;
|
vcount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < batch->maxmeshes; i++)
|
vcount += cvcount;
|
||||||
vcount += batch->mesh[i]->numvertexes;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GLBE_GenBatchVBOs(&mod->vbos, fbatch, batch);
|
GLBE_GenBatchVBOs(&mod->vbos, fbatch, batch);
|
||||||
|
|
Loading…
Reference in a new issue