From 9cd5e88f6ff42542c1ede8045058d180f3ceb0ae Mon Sep 17 00:00:00 2001 From: havoc Date: Sat, 2 Jan 2010 17:03:26 +0000 Subject: [PATCH] upload all q1bsp lightmaps on first frame, rather than waiting for surfaces to become visible git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9769 d7cf8633-e32d-0410-b094-e92efae38249 --- gl_rmain.c | 17 ++++++++--------- model_brush.c | 1 + model_shared.h | 1 + 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/gl_rmain.c b/gl_rmain.c index f959c6c1..1323fef2 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -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) diff --git a/model_brush.c b/model_brush.c index 4e9ac3a6..93c1bbf6 100644 --- a/model_brush.c +++ b/model_brush.c @@ -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; diff --git a/model_shared.h b/model_shared.h index cdf8e17f..04233ddc 100644 --- a/model_shared.h +++ b/model_shared.h @@ -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; -- 2.39.2