- rsurface_texture = surface->texture->currentframe;
- R_Shadow_RenderSurfacesLighting(1, &surface);
+ t = NULL;
+ batchcount = 0;
+ for (surfacelistindex = 0;surfacelistindex < numsurfaces;surfacelistindex++)
+ {
+ msurface_t *surface = ent->model->data_surfaces + surfacelist[surfacelistindex];
+ if (t != surface->texture)
+ {
+ if (batchcount > 0)
+ R_Shadow_RenderSurfacesLighting(batchcount, batchsurfaces);
+ batchcount = 0;
+ t = surface->texture;
+ R_UpdateTextureInfo(ent, t);
+ rsurface_texture = t->currentframe;
+ }
+ batchsurfaces[batchcount++] = surface;
+ }
+ if (batchcount > 0)
+ R_Shadow_RenderSurfacesLighting(batchcount, batchsurfaces);