memset(&m, 0, sizeof(m));
m.blendfunc1 = GL_ONE;
m.blendfunc2 = GL_ONE;
- m.wantoverbright = false;
m.depthdisable = true; // magic
m.tex[0] = R_GetTexture(lightcorona);
- Matrix4x4_CreateIdentity(&m.matrix);
+ R_Mesh_Matrix(&r_identitymatrix);
R_Mesh_State(&m);
viewdist = DotProduct(r_origin, vpn);
for (i = 0;i < r_numdlights;i++)
dist = (DotProduct(rd->origin, vpn) - viewdist);
if (dist >= 24.0f && CL_TraceLine(rd->origin, r_origin, NULL, NULL, 0, true) == 1)
{
- scale = mesh_colorscale * (1.0f / 131072.0f);
+ scale = r_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));
}
- varray_element[0] = 0;
- varray_element[1] = 1;
- varray_element[2] = 2;
- varray_element[3] = 0;
- varray_element[4] = 2;
- varray_element[5] = 3;
varray_color[ 0] = varray_color[ 4] = varray_color[ 8] = varray_color[12] = rd->light[0] * scale;
varray_color[ 1] = varray_color[ 5] = varray_color[ 9] = varray_color[13] = rd->light[1] * scale;
varray_color[ 2] = varray_color[ 6] = varray_color[10] = varray_color[14] = rd->light[2] * scale;
varray_vertex[12] = rd->origin[0] + vright[0] * scale - vup[0] * scale;
varray_vertex[13] = rd->origin[1] + vright[1] * scale - vup[1] * scale;
varray_vertex[14] = rd->origin[2] + vright[2] * scale - vup[2] * scale;
- R_Mesh_Draw(4, 2);
+ R_Mesh_Draw(4, 2, polygonelements);
}
}
}
R_MarkLights
=============
*/
+extern int r_pvsframecount;
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 i, *surfacepvsframes;
int d, impacts, impactt;
float dist, dist2, impact[3];
// for comparisons to minimum acceptable light
maxdist = rd->cullradius2;
+ surfacepvsframes = ent->model->surfacepvsframes;
loc0:
if (node->contents < 0)
return;
surf = ent->model->surfaces + node->firstsurface;
for (i = 0;i < node->numsurfaces;i++, surf++)
{
- if (surf->visframe != r_framecount)
+ if (surfacepvsframes[surf->number] != r_pvsframecount)
continue;
dist = ndist;
if (surf->flags & SURF_PLANEBACK)
mleaf_t *pvsleaf;
vec3_t lightorigin;
model_t *model;
- int i, k, m, c, leafnum;
- msurface_t *surf, **mark;
+ int i, k, m, c, leafnum, *surfacepvsframes, *mark;
+ msurface_t *surf;
mleaf_t *leaf;
qbyte *in;
int row;
maxdist = rd->cullradius2;
row = (model->numleafs+7)>>3;
+ surfacepvsframes = model->surfacepvsframes;
k = 0;
while (k < row)
mark = leaf->firstmarksurface;
do
{
- surf = *mark++;
+ surf = model->surfaces + *mark++;
// if not visible in current frame, or already marked because it was in another leaf we passed, skip
if (surf->lightframe == lightframe)
continue;
surf->lightframe = lightframe;
- if (surf->visframe != r_framecount)
+ if (surfacepvsframes[surf->number] != r_pvsframecount)
continue;
dist = PlaneDiff(lightorigin, surf->plane);
if (surf->flags & SURF_PLANEBACK)