]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
got rid of all the (no longer used) cached_ fields in the msurface_t struct, except...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 16 Nov 2002 13:52:08 +0000 (13:52 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 16 Nov 2002 13:52:08 +0000 (13:52 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2632 d7cf8633-e32d-0410-b094-e92efae38249

gl_rsurf.c
model_brush.h

index d6d0ccc361e99faccb2677b91fe96ee806f9461c..2318141d5db34f3e81c759c47b234de6f2bd9cb1 100644 (file)
@@ -231,7 +231,7 @@ R_BuildLightMap
 Combine and scale multiple lightmaps into the 8.8 format in blocklights
 ===============
 */
-static void R_BuildLightMap (const entity_render_t *ent, msurface_t *surf, int dlightchanged)
+static void R_BuildLightMap (const entity_render_t *ent, msurface_t *surf)
 {
        if (!r_floatbuildlightmap.integer)
        {
@@ -241,12 +241,6 @@ static void R_BuildLightMap (const entity_render_t *ent, msurface_t *surf, int d
 
                // update cached lighting info
                surf->cached_dlight = 0;
-               surf->cached_lightmapscalebit = r_lightmapscalebit;
-               surf->cached_ambient = r_ambient.value;
-               surf->cached_light[0] = d_lightstylevalue[surf->styles[0]];
-               surf->cached_light[1] = d_lightstylevalue[surf->styles[1]];
-               surf->cached_light[2] = d_lightstylevalue[surf->styles[2]];
-               surf->cached_light[3] = d_lightstylevalue[surf->styles[3]];
 
                smax = (surf->extents[0]>>4)+1;
                tmax = (surf->extents[1]>>4)+1;
@@ -278,8 +272,6 @@ static void R_BuildLightMap (const entity_render_t *ent, msurface_t *surf, int d
                                surf->cached_dlight = R_IntAddDynamicLights(&ent->inversematrix, surf);
                                if (surf->cached_dlight)
                                        c_light_polys++;
-                               else if (dlightchanged)
-                                       return; // don't upload if only updating dlights and none mattered
                        }
 
        // add all the lightmaps
@@ -335,12 +327,6 @@ static void R_BuildLightMap (const entity_render_t *ent, msurface_t *surf, int d
 
                // update cached lighting info
                surf->cached_dlight = 0;
-               surf->cached_lightmapscalebit = r_lightmapscalebit;
-               surf->cached_ambient = r_ambient.value;
-               surf->cached_light[0] = d_lightstylevalue[surf->styles[0]];
-               surf->cached_light[1] = d_lightstylevalue[surf->styles[1]];
-               surf->cached_light[2] = d_lightstylevalue[surf->styles[2]];
-               surf->cached_light[3] = d_lightstylevalue[surf->styles[3]];
 
                smax = (surf->extents[0]>>4)+1;
                tmax = (surf->extents[1]>>4)+1;
@@ -369,8 +355,6 @@ static void R_BuildLightMap (const entity_render_t *ent, msurface_t *surf, int d
                        surf->cached_dlight = R_FloatAddDynamicLights(&ent->inversematrix, surf);
                        if (surf->cached_dlight)
                                c_light_polys++;
-                       else if (dlightchanged)
-                               return; // don't upload if only updating dlights and none mattered
                }
 
                // add all the lightmaps
@@ -1488,28 +1472,8 @@ void R_PrepareSurfaces(entity_render_t *ent)
                        {
                                c_faces++;
                                surf->visframe = r_framecount;
-#if 1
                                if (surf->cached_dlight && surf->lightmaptexture != NULL && !r_vertexsurfaces.integer)
-                                       R_BuildLightMap(ent, surf, false); // base lighting changed
-#else
-                               if (!r_vertexsurfaces.integer && surf->lightmaptexture != NULL)
-                               {
-                                       if (surf->cached_dlight
-                                        || surf->cached_ambient != r_ambient.value
-                                        || surf->cached_lightmapscalebit != r_lightmapscalebit)
-                                               R_BuildLightMap(ent, surf, false); // base lighting changed
-                                       else if (r_dynamic.integer)
-                                       {
-                                               if  (surf->styles[0] != 255 && (d_lightstylevalue[surf->styles[0]] != surf->cached_light[0]
-                                                || (surf->styles[1] != 255 && (d_lightstylevalue[surf->styles[1]] != surf->cached_light[1]
-                                                || (surf->styles[2] != 255 && (d_lightstylevalue[surf->styles[2]] != surf->cached_light[2]
-                                                || (surf->styles[3] != 255 && (d_lightstylevalue[surf->styles[3]] != surf->cached_light[3]))))))))
-                                                       R_BuildLightMap(ent, surf, false); // base lighting changed
-                                               else if (surf->dlightframe == r_framecount && r_dlightmap.integer)
-                                                       R_BuildLightMap(ent, surf, true); // only dlights
-                                       }
-                               }
-#endif
+                                       R_BuildLightMap(ent, surf);
                        }
                }
        }
index 8870e9654e46ed5d1a47fdc33a4cf2e57b12da51..339c699efdf003956ecb141f3fceaac47153e5e0 100644 (file)
@@ -232,18 +232,9 @@ typedef struct msurface_s
        int dlightbits[8];
        // avoid redundent addition of dlights
        int lightframe;
-       // only render each surface once
-       //int worldnodeframe;
-
-       // these cause lightmap updates if regenerated
-       // values currently used in lightmap
-       unsigned short cached_light[MAXLIGHTMAPS];
-       // if lightmap was lit by dynamic lights, force update on next frame
-       short cached_dlight;
-       // to cause lightmap to be rerendered when v_overbrightbits changes
-       short cached_lightmapscalebit;
-       // rerender lightmaps when r_ambient changes
-       float cached_ambient;
+
+       // if lightmap settings changed, this forces update
+       int cached_dlight;
 }
 msurface_t;