+ for (i = 0, rd = r_dlight;i < r_numdlights;i++, rd++)
+ {
+ if (ent != rd->ent)
+ {
+ VectorSubtract(ent->origin, rd->origin, temp);
+ f = DotProduct(temp,temp);
+ if (f < (ent->model->radius2 + rd->cullradius2))
+ {
+ model = ent->model;
+ R_Mesh_ResizeCheck(model->numverts * 2);
+ R_LerpMDLMD2Vertices(ent, varray_vertex, aliasvert_normals);
+ Matrix4x4_Transform(&ent->inversematrix, rd->origin, temp);
+ GL_Color(0.1 * r_colorscale, 0.025 * r_colorscale, 0.0125 * r_colorscale, 1);
+ R_Shadow_Volume(model->numverts, model->numtris, varray_vertex, model->mdlmd2data_indices, model->mdlmd2data_triangleneighbors, temp, rd->cullradius + model->radius - sqrt(f), true);
+ GL_UseColorArray();
+ R_Shadow_VertexLight(model->numverts, varray_vertex, aliasvert_normals, temp, rd->cullradius2, LIGHTOFFSET, rd->subtract, rd->light);
+ R_Mesh_Draw(model->numverts, model->numtris, model->mdlmd2data_indices);
+ }
+ }
+ }
+ return;
+ }
+ */
+
+ lightdirection[0] = 0.5;
+ lightdirection[1] = 0.2;
+ lightdirection[2] = -1;
+ VectorNormalizeFast(lightdirection);
+
+ VectorMA(ent->origin, 65536.0f, lightdirection, v2);
+ if (CL_TraceLine(ent->origin, v2, floororigin, surfnormal, 0, false, NULL) == 1)
+ return;
+
+ R_Mesh_Matrix(&ent->matrix);
+
+ model = ent->model;
+ R_Mesh_ResizeCheck(model->numverts);
+
+ memset(&m, 0, sizeof(m));
+ m.blendfunc1 = GL_SRC_ALPHA;
+ m.blendfunc2 = GL_ONE_MINUS_SRC_ALPHA;
+ R_Mesh_State(&m);
+
+ c_alias_polys += model->numtris;
+ R_LerpMDLMD2Vertices(ent, varray_vertex, aliasvert_normals);
+
+ // put a light direction in the entity's coordinate space
+ Matrix4x4_Transform3x3(&ent->inversematrix, lightdirection, projection);
+ VectorNormalizeFast(projection);
+
+ // put the plane's normal in the entity's coordinate space
+ Matrix4x4_Transform3x3(&ent->inversematrix, surfnormal, planenormal);
+ VectorNormalizeFast(planenormal);
+
+ // put the plane's distance in the entity's coordinate space
+ VectorSubtract(floororigin, ent->origin, floororigin);
+ planedist = DotProduct(floororigin, surfnormal) + 2;
+
+ dist = -1.0f / DotProduct(projection, planenormal);
+ VectorScale(projection, dist, projection);
+ for (i = 0, v = varray_vertex;i < model->numverts;i++, v += 4)
+ {
+ dist = DotProduct(v, planenormal) - planedist;
+ if (dist > 0)
+ //if (i & 1)
+ VectorMA(v, dist, projection, v);