RSurf_CleanUp();
}
-void R_QueueSurfaceList(int numsurfaces, msurface_t **surfacelist)
+void R_QueueSurfaceList(int numsurfaces, msurface_t **surfacelist, int flagsmask)
{
int i, j;
vec3_t tempcenter, center;
texture = surfacelist[i]->texture;
rsurface_texture = texture->currentframe;
rsurface_uselightmaptexture = surfacelist[i]->lightmaptexture != NULL;
+ if (!(rsurface_texture->currentmaterialflags & flagsmask))
+ {
+ // if this texture is not the kind we want, skip ahead to the next one
+ for (;j < numsurfaces && texture == surfacelist[j]->texture;j++)
+ ;
+ continue;
+ }
if (rsurface_texture->currentmaterialflags & MATERIALFLAG_BLENDED)
{
// transparent surfaces get pushed off into the transparent queue
}
else
{
- // simply scan ahead until we find a different texture
- for (;j < numsurfaces && texture == surfacelist[j]->texture && rsurface_uselightmaptexture == (surfacelist[j]->lightmaptexture != NULL);j++);
+ // simply scan ahead until we find a different texture or lightmap state
+ for (;j < numsurfaces && texture == surfacelist[j]->texture && rsurface_uselightmaptexture == (surfacelist[j]->lightmaptexture != NULL);j++)
+ ;
// render the range of surfaces
R_DrawTextureSurfaceList(j - i, surfacelist + i);
}
// process this surface
surface = model->data_surfaces + j;
// if this surface fits the criteria, add it to the list
- if (surface->texture->basematerialflags & flagsmask && surface->num_triangles)
+ if (surface->num_triangles)
{
// if lightmap parameters changed, rebuild lightmap texture
if (surface->cached_dlight)
counttriangles += surface->num_triangles;
if (numsurfacelist >= maxsurfacelist)
{
- R_QueueSurfaceList(numsurfacelist, surfacelist);
+ R_QueueSurfaceList(numsurfacelist, surfacelist, flagsmask);
numsurfacelist = 0;
}
}
}
}
if (numsurfacelist)
- R_QueueSurfaceList(numsurfacelist, surfacelist);
+ R_QueueSurfaceList(numsurfacelist, surfacelist, flagsmask);
r_refdef.stats.entities_triangles += counttriangles;
RSurf_CleanUp();
for (;surface < endsurface;surface++)
{
// if this surface fits the criteria, add it to the list
- if (surface->texture->basematerialflags & flagsmask && surface->num_triangles)
+ if (surface->num_triangles)
{
// if lightmap parameters changed, rebuild lightmap texture
if (surface->cached_dlight)
counttriangles += surface->num_triangles;
if (numsurfacelist >= maxsurfacelist)
{
- R_QueueSurfaceList(numsurfacelist, surfacelist);
+ R_QueueSurfaceList(numsurfacelist, surfacelist, flagsmask);
numsurfacelist = 0;
}
}
}
if (numsurfacelist)
- R_QueueSurfaceList(numsurfacelist, surfacelist);
+ R_QueueSurfaceList(numsurfacelist, surfacelist, flagsmask);
r_refdef.stats.entities_triangles += counttriangles;
RSurf_CleanUp();