]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - r_light.c
moved brushq1 nodes/leafs/leaffaces/planes/portals fields to brush, along with brushq...
[xonotic/darkplaces.git] / r_light.c
index 0dc8bee068c68829de1e25168317985353f2b90e..805796ed3bdf6e7d431b7ac8466ded28ad48eaa9 100644 (file)
--- a/r_light.c
+++ b/r_light.c
@@ -29,7 +29,7 @@ int r_numdlights = 0;
 cvar_t r_modellights = {CVAR_SAVE, "r_modellights", "4"};
 cvar_t r_vismarklights = {0, "r_vismarklights", "1"};
 cvar_t r_coronas = {CVAR_SAVE, "r_coronas", "1"};
-cvar_t gl_flashblend = {CVAR_SAVE, "gl_flashblend", "1"};
+cvar_t gl_flashblend = {CVAR_SAVE, "gl_flashblend", "0"};
 
 static rtexture_t *lightcorona;
 static rtexturepool_t *lighttexturepool;
@@ -184,7 +184,7 @@ static void R_RecursiveMarkLights(entity_render_t *ent, vec3_t lightorigin, dlig
        float dist;
 
        // for comparisons to minimum acceptable light
-       while(node->contents >= 0)
+       while(node->plane)
        {
                dist = PlaneDiff(lightorigin, node->plane);
                if (dist > light->rtlight.lightmap_cullradius)
@@ -200,19 +200,18 @@ static void R_RecursiveMarkLights(entity_render_t *ent, vec3_t lightorigin, dlig
        // check if leaf is visible according to pvs
        leaf = (mleaf_t *)node;
        i = leaf->clusterindex;
-       if (leaf->nummarksurfaces && (i >= pvsbits || CHECKPVSBIT(pvs, i)))
+       if (leaf->numleaffaces && (i >= pvsbits || CHECKPVSBIT(pvs, i)))
        {
-               int *surfacepvsframes, d, impacts, impactt;
+               int d, impacts, impactt;
                float sdist, maxdist, dist2, impact[3];
                msurface_t *surf;
                // mark the polygons
                maxdist = light->rtlight.lightmap_cullradius2;
-               surfacepvsframes = ent->model->brushq1.surfacepvsframes;
-               for (i = 0;i < leaf->nummarksurfaces;i++)
+               for (i = 0;i < leaf->numleaffaces;i++)
                {
-                       if (surfacepvsframes[leaf->firstmarksurface[i]] != ent->model->brushq1.pvsframecount)
+                       if (ent == r_refdef.worldentity && !r_worldsurfacevisible[leaf->firstleafface[i]])
                                continue;
-                       surf = ent->model->brushq1.surfaces + leaf->firstmarksurface[i];
+                       surf = ent->model->brushq1.surfaces + leaf->firstleafface[i];
                        dist = sdist = PlaneDiff(lightorigin, surf->plane);
                        if (surf->flags & SURF_PLANEBACK)
                                dist = -dist;
@@ -260,7 +259,7 @@ void R_MarkLights(entity_render_t *ent)
        int i, bit, bitindex;
        dlight_t *light;
        vec3_t lightorigin;
-       if (!gl_flashblend.integer && r_dynamic.integer && ent->model && ent->model->brushq1.num_leafs)
+       if (!gl_flashblend.integer && r_dynamic.integer && ent->model && ent->model->brush.num_leafs)
        {
                for (i = 0, light = r_dlight;i < r_numdlights;i++, light++)
                {
@@ -270,7 +269,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, light, bit, bitindex, ent->model->brushq1.nodes + ent->model->brushq1.hulls[0].firstclipnode, lightpvs, min(lightpvsbytes * 8, ent->model->brush.num_pvsclusters));
+                       R_RecursiveMarkLights(ent, lightorigin, light, bit, bitindex, ent->model->brush.data_nodes + ent->model->brushq1.hulls[0].firstclipnode, lightpvs, min(lightpvsbytes * 8, ent->model->brush.num_pvsclusters));
                }
        }
 }