- memset(&m, 0, sizeof(m));
- m.blendfunc1 = GL_ONE;
- m.blendfunc2 = GL_ONE;
- m.depthdisable = true; // magic
- m.numtriangles = 2;
- m.numverts = 4;
- m.tex[0] = R_GetTexture(lightcorona);
- viewdist = DotProduct(r_origin, vpn);
- for (i = 0;i < r_numdlights;i++)
- {
- rd = r_dlight + i;
- dist = (DotProduct(rd->origin, vpn) - viewdist);
- if (dist >= 24.0f)
- {
- if (CL_TraceLine(rd->origin, r_origin, NULL, NULL, 0, true) == 1)
- {
- Matrix4x4_CreateIdentity(&m.matrix);
- if (R_Mesh_Draw_GetBuffer(&m, false))
- {
- scale = m.colorscale * (1.0f / 131072.0f);
- if (gl_flashblend.integer)
- scale *= 4.0f;
- if (fogenabled)
- {
- VectorSubtract(rd->origin, r_origin, diff);
- scale *= 1 - exp(fogdensity/DotProduct(diff,diff));
- }
- m.index[0] = 0;
- m.index[1] = 1;
- m.index[2] = 2;
- m.index[3] = 0;
- m.index[4] = 2;
- m.index[5] = 3;
- m.color[0] = m.color[4] = m.color[8] = m.color[12] = rd->light[0] * scale;
- m.color[1] = m.color[5] = m.color[9] = m.color[13] = rd->light[1] * scale;
- m.color[2] = m.color[6] = m.color[10] = m.color[14] = rd->light[2] * scale;
- m.color[3] = m.color[7] = m.color[11] = m.color[15] = 1;
- m.texcoords[0][0] = 0;
- m.texcoords[0][1] = 0;
- m.texcoords[0][2] = 0;
- m.texcoords[0][3] = 1;
- m.texcoords[0][4] = 1;
- m.texcoords[0][5] = 1;
- m.texcoords[0][6] = 1;
- m.texcoords[0][7] = 0;
- scale = rd->cullradius * 0.25f;
- if (gl_flashblend.integer)
- scale *= 2.0f;
- m.vertex[0] = rd->origin[0] - vright[0] * scale - vup[0] * scale;
- m.vertex[1] = rd->origin[1] - vright[1] * scale - vup[1] * scale;
- m.vertex[2] = rd->origin[2] - vright[2] * scale - vup[2] * scale;
- m.vertex[4] = rd->origin[0] - vright[0] * scale + vup[0] * scale;
- m.vertex[5] = rd->origin[1] - vright[1] * scale + vup[1] * scale;
- m.vertex[6] = rd->origin[2] - vright[2] * scale + vup[2] * scale;
- m.vertex[8] = rd->origin[0] + vright[0] * scale + vup[0] * scale;
- m.vertex[9] = rd->origin[1] + vright[1] * scale + vup[1] * scale;
- m.vertex[10] = rd->origin[2] + vright[2] * scale + vup[2] * scale;
- m.vertex[12] = rd->origin[0] + vright[0] * scale - vup[0] * scale;
- m.vertex[13] = rd->origin[1] + vright[1] * scale - vup[1] * scale;
- m.vertex[14] = rd->origin[2] + vright[2] * scale - vup[2] * scale;
- R_Mesh_Render();
- }
- }
- }
- }
-}
-
-/*
-=============================================================================
-
-DYNAMIC LIGHTS
-
-=============================================================================
-*/
-
-/*
-=============
-R_MarkLights
-=============
-*/
-static void R_OldMarkLights (entity_render_t *ent, vec3_t lightorigin, rdlight_t *rd, int bit, int bitindex, mnode_t *node)
-{
- float ndist, maxdist;
- msurface_t *surf;
- int i;
- int d, impacts, impactt;
- float dist, dist2, impact[3];
-
- if (!r_dynamic.integer)
- return;
-
- // for comparisons to minimum acceptable light
- maxdist = rd->cullradius2;
-
-loc0:
- if (node->contents < 0)
- return;
-
- ndist = PlaneDiff(lightorigin, node->plane);
-
- if (ndist > rd->cullradius)
- {
- node = node->children[0];
- goto loc0;
- }
- if (ndist < -rd->cullradius)