-#define SHADOWSPHERE_SEGMENTS 16
-
-shadowmesh_t *shadowsphere;
-void R_CreateShadowSphere(void)
-{
- int i, j;
- vec3_t angles, angles2, angles3, angles4;
- float verts[12];
- shadowsphere = Mod_ShadowMesh_Begin(zonemempool, SHADOWSPHERE_SEGMENTS * SHADOWSPHERE_SEGMENTS / 2);
- for (i = 0;i < SHADOWSPHERE_SEGMENTS / 2;i++)
- {
- for (j = 0;j < SHADOWSPHERE_SEGMENTS;j++)
- {
- angles[0] = (i * 360.0f / SHADOWSPHERE_SEGMENTS) + 90.0f;
- angles[1] = j * 360.0f / SHADOWSPHERE_SEGMENTS;
- angles[2] = 0;
- VectorCopy(angles, angles2);
- VectorCopy(angles, angles3);
- VectorCopy(angles, angles4);
- angles2[1] += 360.0f / SHADOWSPHERE_SEGMENTS;
- angles3[0] += 360.0f / SHADOWSPHERE_SEGMENTS;
- angles3[1] += 360.0f / SHADOWSPHERE_SEGMENTS;
- angles4[0] += 360.0f / SHADOWSPHERE_SEGMENTS;
- AngleVectorsFLU(angles, verts, NULL, NULL);
- AngleVectorsFLU(angles2, verts + 9, NULL, NULL);
- AngleVectorsFLU(angles3, verts + 6, NULL, NULL);
- AngleVectorsFLU(angles4, verts + 3, NULL, NULL);
- VectorScale(&verts[0], 1.0f, &verts[0]);
- VectorScale(&verts[3], 1.0f, &verts[3]);
- VectorScale(&verts[6], 1.0f, &verts[6]);
- VectorScale(&verts[9], 1.0f, &verts[9]);
- Mod_ShadowMesh_AddPolygon(zonemempool, shadowsphere, 4, verts);
- }
- }
- shadowsphere = Mod_ShadowMesh_Finish(zonemempool, shadowsphere);
-}
-
-
-void R_DrawShadowSphere(vec3_t origin, float cullradius, float lightradius)
-{
- shadowmesh_t *mesh;
- matrix4x4_t matrix;
- if (!shadowsphere)
- R_CreateShadowSphere();
- Matrix4x4_CreateScale(&matrix, lightradius);
- Matrix4x4_ConcatTranslate(&matrix, origin[0], origin[1], origin[2]);
- R_Mesh_Matrix(&matrix);
- for (mesh = shadowsphere;mesh;mesh = mesh->next)
- {
- memcpy(varray_vertex, mesh->verts, mesh->numverts * sizeof(float[4]));
- R_Shadow_RenderVolume(mesh->numverts, mesh->numtriangles, mesh->elements);
- }
- Matrix4x4_CreateScale(&matrix, -cullradius);
- Matrix4x4_ConcatTranslate(&matrix, origin[0], origin[1], origin[2]);
- R_Mesh_Matrix(&matrix);
- for (mesh = shadowsphere;mesh;mesh = mesh->next)
- {
- memcpy(varray_vertex, mesh->verts, mesh->numverts * sizeof(float[4]));
- R_Shadow_RenderVolume(mesh->numverts, mesh->numtriangles, mesh->elements);
- }
-}
-
-extern void R_Model_Brush_DrawLightForSurfaceList(entity_render_t *ent, vec3_t relativelightorigin, vec3_t relativeeyeorigin, float lightradius, float *lightcolor, msurface_t **surflist, int numsurfaces);
-void R_ShadowVolumeLighting (int visiblevolumes)