+ if (numsurfacelist)
+ R_Q1BSP_DrawShadowVolume_Batch(relativelightorigin, relativelightdirection, lightmins, lightmaxs, numsurfacelist, surfacelist);
+ R_Shadow_VolumeFromList(model->surfmesh.num_vertices, model->surfmesh.num_triangles, rsurface_vertex3f, model->surfmesh.data_element3i, model->surfmesh.data_neighbor3i, relativelightorigin, relativelightdirection, projectdistance, numshadowmark, shadowmarklist);
+ }
+}
+
+#define BATCHSIZE 256
+
+static void R_Q1BSP_DrawLight_TransparentCallback(const entity_render_t *ent, const rtlight_t *rtlight, int numsurfaces, int *surfacelist)
+{
+ int surfacelistindex, batchcount;
+ texture_t *t;
+ msurface_t *batchsurfaces[BATCHSIZE];
+ // note: in practice this never actually batches, oh well
+ R_Shadow_RenderMode_Begin();
+ R_Shadow_RenderMode_ActiveLight((rtlight_t *)rtlight);
+ R_Shadow_RenderMode_Lighting(false, true);
+ R_Shadow_SetupEntityLight(ent);
+ 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);
+ R_Shadow_RenderMode_End();
+}
+
+static void R_Q1BSP_DrawLight_TransparentBatch(int batchnumsurfaces, msurface_t **batchsurfacelist)
+{
+ int batchsurfaceindex;
+ msurface_t *batchsurface;
+ vec3_t tempcenter, center;
+ for (batchsurfaceindex = 0;batchsurfaceindex < batchnumsurfaces;batchsurfaceindex++)
+ {
+ batchsurface = batchsurfacelist[batchsurfaceindex];
+ tempcenter[0] = (batchsurface->mins[0] + batchsurface->maxs[0]) * 0.5f;
+ tempcenter[1] = (batchsurface->mins[1] + batchsurface->maxs[1]) * 0.5f;
+ tempcenter[2] = (batchsurface->mins[2] + batchsurface->maxs[2]) * 0.5f;
+ Matrix4x4_Transform(&rsurface_entity->matrix, tempcenter, center);
+ R_MeshQueue_AddTransparent(rsurface_texture->currentmaterialflags & MATERIALFLAG_NODEPTHTEST ? r_view.origin : center, R_Q1BSP_DrawLight_TransparentCallback, rsurface_entity, batchsurface - rsurface_model->data_surfaces, r_shadow_rtlight);