mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-02-12 23:15:33 +00:00
sort vbo contents by texture
This commit is contained in:
parent
6763f8138c
commit
a8103911f7
1 changed files with 22 additions and 6 deletions
|
@ -1008,14 +1008,30 @@ void GL_BuildVBOs (void)
|
|||
if (!m || m->name[0] == '*' || m->type != mod_brush)
|
||||
continue;
|
||||
|
||||
// sort by texture (don't clear chain_world because that needs to persist between pvs updates
|
||||
// and we could be doing a video mode switch)
|
||||
R_ClearTextureChains(m, chain_model);
|
||||
for (i=0 ; i<m->numsurfaces ; i++)
|
||||
{
|
||||
msurface_t *s = &m->surfaces[i];
|
||||
R_ChainSurface(&m->surfaces[i], chain_model);
|
||||
}
|
||||
|
||||
// add the sorted surfaces
|
||||
for (i=0 ; i<m->numtextures ; i++)
|
||||
{
|
||||
texture_t *t;
|
||||
msurface_t *s;
|
||||
|
||||
t = m->textures[i];
|
||||
if (!t) continue;
|
||||
for (s = t->texturechains[chain_model]; s; s = s->texturechain)
|
||||
{
|
||||
s->vbo_firstvert = varray_index;
|
||||
memcpy (&varray[VERTEXSIZE * varray_index], s->polys->verts, VERTEXSIZE * sizeof(float) * s->numedges);
|
||||
varray_index += s->numedges;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// upload to GPU
|
||||
GL_BindBufferFunc (GL_ARRAY_BUFFER, gl_bmodel_vbo);
|
||||
|
|
Loading…
Reference in a new issue