]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
gl_rmain: Instead of avoiding a call to R_BuildLightmap if surface is not visible...
authorcloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 20 Oct 2020 10:58:28 +0000 (10:58 +0000)
committercloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 20 Oct 2020 10:58:28 +0000 (10:58 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13026 d7cf8633-e32d-0410-b094-e92efae38249

gl_rmain.c

index 1b6c3d8ee048245f0cd1647291b9d1b118ed5d3a..0526bc92baa125c9c2bf95e4f3d9fada5cf06da1 100644 (file)
@@ -10026,14 +10026,18 @@ void R_DrawModelSurfaces(entity_render_t *ent, qbool skysurfaces, qbool writedep
        if (!skysurfaces && !depthonly && !prepass && model->brushq1.num_lightstyles && r_refdef.scene.lightmapintensity > 0)
        {
                model_brush_lightstyleinfo_t *style;
+               // Iterate over each active style
                for (i = 0, style = model->brushq1.data_lightstyleinfo;i < model->brushq1.num_lightstyles;i++, style++)
                {
                        if (style->value != r_refdef.scene.lightstylevalue[style->style])
                        {
                                int *list = style->surfacelist;
                                style->value = r_refdef.scene.lightstylevalue[style->style];
+                               // Iterate over every surface this style applies to
                                for (j = 0;j < style->numsurfaces;j++)
-                                       update[list[j]] = true;
+                                       // Update brush entities even if not visible otherwise they'll render solid black.
+                                       if(r_refdef.viewcache.world_surfacevisible[list[j]] || ent != r_refdef.scene.worldentity)
+                                               update[list[j]] = true;
                        }
                }
        }
@@ -10088,8 +10092,7 @@ void R_DrawModelSurfaces(entity_render_t *ent, qbool skysurfaces, qbool writedep
                int updated = 0;
                for (j = model->firstmodelsurface, endj = model->firstmodelsurface + model->nummodelsurfaces;j < endj;j++)
                {
-                       // Update brush entities even if not visible otherwise they'll render solid black.
-                       if (update[j] && (r_refdef.viewcache.world_surfacevisible[j] || ent != r_refdef.scene.worldentity))
+                       if (update[j])
                        {
                                updated++;
                                R_BuildLightMap(ent, surfaces + j);