upload all q1bsp lightmaps on first frame, rather than waiting for
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 2 Jan 2010 17:03:26 +0000 (17:03 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 2 Jan 2010 17:03:26 +0000 (17:03 +0000)
surfaces to become visible

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9769 d7cf8633-e32d-0410-b094-e92efae38249

gl_rmain.c
model_brush.c
model_shared.h

index f959c6c..1323fef 100644 (file)
@@ -11823,20 +11823,19 @@ void R_DrawWorldSurfaces(qboolean skysurfaces, qboolean writedepth, qboolean dep
                        r_surfacelist[numsurfacelist++] = surfaces + j;
        }
        // update lightmaps if needed
-       if (update)
+       if (model->brushq1.firstrender)
+       {
+               model->brushq1.firstrender = false;
+               for (j = model->firstmodelsurface, endj = model->firstmodelsurface + model->nummodelsurfaces;j < endj;j++)
+                       if (update[j])
+                               R_BuildLightMap(r_refdef.scene.worldentity, surfaces + j);
+       }
+       else if (update)
        {
-               int updated = 0;
                for (j = model->firstmodelsurface, endj = model->firstmodelsurface + model->nummodelsurfaces;j < endj;j++)
-               {
                        if (r_refdef.viewcache.world_surfacevisible[j])
-                       {
                                if (update[j])
-                               {
-                                       updated++;
                                        R_BuildLightMap(r_refdef.scene.worldentity, surfaces + j);
-                               }
-                       }
-               }
        }
        // don't do anything if there were no surfaces
        if (!numsurfacelist)
index 4e9ac3a..93c1bbf 100644 (file)
@@ -2248,6 +2248,7 @@ static void Mod_Q1BSP_LoadFaces(lump_t *l)
 
        loadmodel->num_surfaces = count;
 
+       loadmodel->brushq1.firstrender = true;
        loadmodel->brushq1.lightmapupdateflags = (unsigned char *)Mem_Alloc(loadmodel->mempool, count*sizeof(unsigned char));
 
        totalverts = 0;
index cdf8e17..04233dd 100644 (file)
@@ -747,6 +747,7 @@ typedef struct model_brushq1_s
 
        // this contains bytes that are 1 if a surface needs its lightmap rebuilt
        unsigned char *lightmapupdateflags;
+       qboolean firstrender; // causes all surface lightmaps to be loaded in first frame
 }
 model_brushq1_t;