+ else if (numsurfaces && r_refdef.worldmodel->brush.shadowmesh && r_shadow_culltriangles.integer)
+ {
+ int t, tend;
+ int surfacelistindex;
+ msurface_t *surface;
+ R_Shadow_PrepareShadowMark(r_refdef.worldmodel->brush.shadowmesh->numtriangles);
+ for (surfacelistindex = 0;surfacelistindex < numsurfaces;surfacelistindex++)
+ {
+ surface = r_refdef.worldmodel->data_surfaces + surfacelist[surfacelistindex];
+ for (t = surface->num_firstshadowmeshtriangle, tend = t + surface->num_triangles;t < tend;t++)
+ if (CHECKPVSBIT(trispvs, t))
+ shadowmarklist[numshadowmark++] = t;
+ }
+ R_Shadow_VolumeFromList(r_refdef.worldmodel->brush.shadowmesh->numverts, r_refdef.worldmodel->brush.shadowmesh->numtriangles, r_refdef.worldmodel->brush.shadowmesh->vertex3f, r_refdef.worldmodel->brush.shadowmesh->element3i, r_refdef.worldmodel->brush.shadowmesh->neighbor3i, r_shadow_rtlight->shadoworigin, NULL, r_shadow_rtlight->radius + r_refdef.worldmodel->radius*2 + r_shadow_projectdistance.value, numshadowmark, shadowmarklist);
+ }
+ else if (numsurfaces)
+ r_refdef.worldmodel->DrawShadowVolume(r_refdef.worldentity, r_shadow_rtlight->shadoworigin, NULL, r_shadow_rtlight->radius, numsurfaces, surfacelist, r_shadow_rtlight_cullmins, r_shadow_rtlight_cullmaxs);
+}
+
+void R_Shadow_DrawEntityShadow(entity_render_t *ent)
+{
+ vec3_t relativeshadoworigin, relativeshadowmins, relativeshadowmaxs;
+ vec_t relativeshadowradius;
+ RSurf_ActiveModelEntity(ent, false, false);
+ Matrix4x4_Transform(&ent->inversematrix, r_shadow_rtlight->shadoworigin, relativeshadoworigin);
+ relativeshadowradius = r_shadow_rtlight->radius / ent->scale;
+ relativeshadowmins[0] = relativeshadoworigin[0] - relativeshadowradius;
+ relativeshadowmins[1] = relativeshadoworigin[1] - relativeshadowradius;
+ relativeshadowmins[2] = relativeshadoworigin[2] - relativeshadowradius;
+ relativeshadowmaxs[0] = relativeshadoworigin[0] + relativeshadowradius;
+ relativeshadowmaxs[1] = relativeshadoworigin[1] + relativeshadowradius;
+ relativeshadowmaxs[2] = relativeshadoworigin[2] + relativeshadowradius;
+ ent->model->DrawShadowVolume(ent, relativeshadoworigin, NULL, relativeshadowradius, ent->model->nummodelsurfaces, ent->model->surfacelist, relativeshadowmins, relativeshadowmaxs);