]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - r_light.c
fixed GL_Scissor call in rtlight code (apparently I need to feed it a top to bottom...
[xonotic/darkplaces.git] / r_light.c
index 3734eea9eaa67206e2c8c2627f2569c173487e7b..89f36ad05328615ae200ffefe01d3fda792bcf90 100644 (file)
--- a/r_light.c
+++ b/r_light.c
@@ -165,7 +165,7 @@ void R_DrawCoronas(void)
                        {
                                cscale = wl->corona * r_coronas.value * 0.25f;
                                scale = wl->radius * 0.25f;
-                               R_DrawSprite(GL_ONE, GL_ONE, lightcorona, true, rd->origin, r_viewright, r_viewup, scale, -scale, -scale, scale, wl->color[0] * cscale, wl->color[1] * cscale, wl->color[2] * cscale, 1);
+                               R_DrawSprite(GL_ONE, GL_ONE, lightcorona, true, wl->origin, r_viewright, r_viewup, scale, -scale, -scale, scale, wl->color[0] * cscale, wl->color[1] * cscale, wl->color[2] * cscale, 1);
                        }
                }
        }
@@ -224,8 +224,8 @@ static void R_RecursiveMarkLights(entity_render_t *ent, vec3_t lightorigin, rdli
 
        // check if leaf is visible according to pvs
        leaf = (mleaf_t *)node;
-       i = (leaf - ent->model->brushq1.leafs) - 1;
-       if (leaf->nummarksurfaces && (i >= pvsbits || pvs[i >> 3] & (1 << (i & 7))))
+       i = leaf->clusterindex;
+       if (leaf->nummarksurfaces && (i >= pvsbits || CHECKPVSBIT(pvs, i)))
        {
                int *surfacepvsframes, d, impacts, impactt;
                float sdist, maxdist, dist2, impact[3];
@@ -285,7 +285,7 @@ void R_MarkLights(entity_render_t *ent)
        int i, bit, bitindex;
        rdlight_t *rd;
        vec3_t lightorigin;
-       if (!gl_flashblend.integer && r_dynamic.integer && ent->model && ent->model->brushq1.numleafs)
+       if (!gl_flashblend.integer && r_dynamic.integer && ent->model && ent->model->brushq1.num_leafs)
        {
                for (i = 0, rd = r_dlight;i < r_numdlights;i++, rd++)
                {
@@ -295,7 +295,7 @@ void R_MarkLights(entity_render_t *ent)
                        lightpvsbytes = 0;
                        if (r_vismarklights.integer && ent->model->brush.FatPVS)
                                lightpvsbytes = ent->model->brush.FatPVS(ent->model, lightorigin, 0, lightpvs, sizeof(lightpvs));
-                       R_RecursiveMarkLights(ent, lightorigin, rd, bit, bitindex, ent->model->brushq1.nodes + ent->model->brushq1.hulls[0].firstclipnode, lightpvs, min(lightpvsbytes * 8, ent->model->brushq1.visleafs));
+                       R_RecursiveMarkLights(ent, lightorigin, rd, bit, bitindex, ent->model->brushq1.nodes + ent->model->brushq1.hulls[0].firstclipnode, lightpvs, min(lightpvsbytes * 8, ent->model->brushq1.num_pvsclusters));
                }
        }
 }