From d24e28f28b03bde1c987a6c107b855f4247c7e70 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 4 Jul 2000 07:04:46 +0000 Subject: [PATCH] speed up R_RenderBrushPoly ever so slightly --- source/gl_rsurf.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/source/gl_rsurf.c b/source/gl_rsurf.c index 010a584..b49bc60 100644 --- a/source/gl_rsurf.c +++ b/source/gl_rsurf.c @@ -750,8 +750,13 @@ dynamic: theRect->w = (fa->light_s-theRect->l)+smax; if ((theRect->h + theRect->t) < (fa->light_t + tmax)) theRect->h = (fa->light_t-theRect->t)+tmax; - base = lightmaps[fa->lightmaptexturenum] + (fa->light_t * BLOCK_WIDTH + fa->light_s) * lightmap_bytes; - R_BuildLightMap (fa, base, BLOCK_WIDTH*lightmap_bytes); + if (lightmap_bytes==3) { + base = lightmaps[fa->lightmaptexturenum] + (fa->light_t * BLOCK_WIDTH + fa->light_s) * 3; + R_BuildLightMap (fa, base, BLOCK_WIDTH*3); + } else { + base = lightmaps[fa->lightmaptexturenum] + (fa->light_t * BLOCK_WIDTH + fa->light_s); + R_BuildLightMap (fa, base, BLOCK_WIDTH); + } } } } @@ -807,8 +812,13 @@ dynamic: theRect->w = (fa->light_s-theRect->l)+smax; if ((theRect->h + theRect->t) < (fa->light_t + tmax)) theRect->h = (fa->light_t-theRect->t)+tmax; - base = lightmaps[fa->lightmaptexturenum] + (fa->light_t * BLOCK_WIDTH + fa->light_s) * lightmap_bytes; - R_BuildLightMap (fa, base, BLOCK_WIDTH*lightmap_bytes); + if (lightmap_bytes==3) { + base = lightmaps[fa->lightmaptexturenum] + (fa->light_t * BLOCK_WIDTH + fa->light_s) * 3; + R_BuildLightMap (fa, base, BLOCK_WIDTH*3); + } else { + base = lightmaps[fa->lightmaptexturenum] + (fa->light_t * BLOCK_WIDTH + fa->light_s); + R_BuildLightMap (fa, base, BLOCK_WIDTH); + } } } } @@ -1454,8 +1464,13 @@ void GL_CreateSurfaceLightmap (msurface_t *surf) tmax = (surf->extents[1]>>4)+1; surf->lightmaptexturenum = AllocBlock (smax, tmax, &surf->light_s, &surf->light_t); - base = lightmaps[surf->lightmaptexturenum] + (surf->light_t * BLOCK_WIDTH + surf->light_s) * lightmap_bytes; - R_BuildLightMap (surf, base, BLOCK_WIDTH*lightmap_bytes); + if (lightmap_bytes==3) { + base = lightmaps[surf->lightmaptexturenum] + (surf->light_t * BLOCK_WIDTH + surf->light_s) * 3; + R_BuildLightMap (surf, base, BLOCK_WIDTH*3); + } else { + base = lightmaps[surf->lightmaptexturenum] + (surf->light_t * BLOCK_WIDTH + surf->light_s); + R_BuildLightMap (surf, base, BLOCK_WIDTH); + } }