From 0594fa41920addfca23415c7ded37b33e6ed7f60 Mon Sep 17 00:00:00 2001 From: ewasylishen Date: Thu, 12 Sep 2019 06:49:27 +0000 Subject: [PATCH] r_brush.c: rename BLOCK_WIDTH/HEIGHT to LMBLOCK_WIDTH/HEIGHT to match QSS (no other changes) git-svn-id: svn+ssh://svn.code.sf.net/p/quakespasm/code/trunk@1627 af15c1b1-3010-417e-b628-4374ebc0bcbd --- quakespasm/Quake/r_brush.c | 58 +++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/quakespasm/Quake/r_brush.c b/quakespasm/Quake/r_brush.c index 7155e5ef..81083c26 100644 --- a/quakespasm/Quake/r_brush.c +++ b/quakespasm/Quake/r_brush.c @@ -30,12 +30,12 @@ extern cvar_t gl_zfix; // QuakeSpasm z-fighting fix int gl_lightmap_format; int lightmap_bytes; -#define BLOCK_WIDTH 128 -#define BLOCK_HEIGHT 128 +#define LMBLOCK_WIDTH 128 +#define LMBLOCK_HEIGHT 128 gltexture_t *lightmap_textures[MAX_LIGHTMAPS]; //johnfitz -- changed to an array -unsigned blocklights[BLOCK_WIDTH*BLOCK_HEIGHT*3]; //johnfitz -- was 18*18, added lit support (*3) and loosened surface extents maximum (BLOCK_WIDTH*BLOCK_HEIGHT) +unsigned blocklights[LMBLOCK_WIDTH*LMBLOCK_HEIGHT*3]; //johnfitz -- was 18*18, added lit support (*3) and loosened surface extents maximum (LMBLOCK_WIDTH*LMBLOCK_HEIGHT) typedef struct glRect_s { unsigned char l,t,w,h; @@ -45,12 +45,12 @@ glpoly_t *lightmap_polys[MAX_LIGHTMAPS]; qboolean lightmap_modified[MAX_LIGHTMAPS]; glRect_t lightmap_rectchange[MAX_LIGHTMAPS]; -int allocated[MAX_LIGHTMAPS][BLOCK_WIDTH]; +int allocated[MAX_LIGHTMAPS][LMBLOCK_WIDTH]; int last_lightmap_allocated; //ericw -- optimization: remember the index of the last lightmap AllocBlock stored a surf in // the lightmap texture data needs to be kept in // main memory so texsubimage can update properly -byte lightmaps[4*MAX_LIGHTMAPS*BLOCK_WIDTH*BLOCK_HEIGHT]; +byte lightmaps[4*MAX_LIGHTMAPS*LMBLOCK_WIDTH*LMBLOCK_HEIGHT]; /* @@ -709,9 +709,9 @@ 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*lightmap_bytes*BLOCK_WIDTH*BLOCK_HEIGHT; - base += fa->light_t * BLOCK_WIDTH * lightmap_bytes + fa->light_s * lightmap_bytes; - R_BuildLightMap (fa, base, BLOCK_WIDTH*lightmap_bytes); + base = lightmaps + fa->lightmaptexturenum*lightmap_bytes*LMBLOCK_WIDTH*LMBLOCK_HEIGHT; + base += fa->light_t * LMBLOCK_WIDTH * lightmap_bytes + fa->light_s * lightmap_bytes; + R_BuildLightMap (fa, base, LMBLOCK_WIDTH*lightmap_bytes); } } } @@ -734,9 +734,9 @@ int AllocBlock (int w, int h, int *x, int *y) // lightmaps as tightly vs. not doing this (uses ~5% more lightmaps) for (texnum=last_lightmap_allocated ; texnum BLOCK_HEIGHT) + if (best + h > LMBLOCK_HEIGHT) continue; for (i=0 ; iextents[1]>>4)+1; surf->lightmaptexturenum = AllocBlock (smax, tmax, &surf->light_s, &surf->light_t); - base = lightmaps + surf->lightmaptexturenum*lightmap_bytes*BLOCK_WIDTH*BLOCK_HEIGHT; - base += (surf->light_t * BLOCK_WIDTH + surf->light_s) * lightmap_bytes; - R_BuildLightMap (surf, base, BLOCK_WIDTH*lightmap_bytes); + base = lightmaps + surf->lightmaptexturenum*lightmap_bytes*LMBLOCK_WIDTH*LMBLOCK_HEIGHT; + base += (surf->light_t * LMBLOCK_WIDTH + surf->light_s) * lightmap_bytes; + R_BuildLightMap (surf, base, LMBLOCK_WIDTH*lightmap_bytes); } /* @@ -848,13 +848,13 @@ void BuildSurfaceDisplayList (msurface_t *fa) s -= fa->texturemins[0]; s += fa->light_s*16; s += 8; - s /= BLOCK_WIDTH*16; //fa->texinfo->texture->width; + s /= LMBLOCK_WIDTH*16; //fa->texinfo->texture->width; t = DotProduct (vec, fa->texinfo->vecs[1]) + fa->texinfo->vecs[1][3]; t -= fa->texturemins[1]; t += fa->light_t*16; t += 8; - t /= BLOCK_HEIGHT*16; //fa->texinfo->texture->height; + t /= LMBLOCK_HEIGHT*16; //fa->texinfo->texture->height; poly->verts[i][5] = s; poly->verts[i][6] = t; @@ -932,15 +932,15 @@ void GL_BuildLightmaps (void) if (!allocated[i][0]) break; // no more used lightmap_modified[i] = false; - lightmap_rectchange[i].l = BLOCK_WIDTH; - lightmap_rectchange[i].t = BLOCK_HEIGHT; + lightmap_rectchange[i].l = LMBLOCK_WIDTH; + lightmap_rectchange[i].t = LMBLOCK_HEIGHT; lightmap_rectchange[i].w = 0; lightmap_rectchange[i].h = 0; //johnfitz -- use texture manager sprintf(name, "lightmap%03i",i); - data = lightmaps+i*BLOCK_WIDTH*BLOCK_HEIGHT*lightmap_bytes; - lightmap_textures[i] = TexMgr_LoadImage (cl.worldmodel, name, BLOCK_WIDTH, BLOCK_HEIGHT, + data = lightmaps+i*LMBLOCK_WIDTH*LMBLOCK_HEIGHT*lightmap_bytes; + lightmap_textures[i] = TexMgr_LoadImage (cl.worldmodel, name, LMBLOCK_WIDTH, LMBLOCK_HEIGHT, SRC_LIGHTMAP, data, "", (src_offset_t)data, TEXPREF_LINEAR | TEXPREF_NOPICMIP); //johnfitz } @@ -1260,10 +1260,10 @@ static void R_UploadLightmap(int lmap) lightmap_modified[lmap] = false; theRect = &lightmap_rectchange[lmap]; - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, theRect->t, BLOCK_WIDTH, theRect->h, gl_lightmap_format, - GL_UNSIGNED_BYTE, lightmaps+(lmap* BLOCK_HEIGHT + theRect->t) *BLOCK_WIDTH*lightmap_bytes); - theRect->l = BLOCK_WIDTH; - theRect->t = BLOCK_HEIGHT; + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, theRect->t, LMBLOCK_WIDTH, theRect->h, gl_lightmap_format, + GL_UNSIGNED_BYTE, lightmaps+(lmap* LMBLOCK_HEIGHT + theRect->t) *LMBLOCK_WIDTH*lightmap_bytes); + theRect->l = LMBLOCK_WIDTH; + theRect->t = LMBLOCK_HEIGHT; theRect->h = 0; theRect->w = 0; @@ -1309,9 +1309,9 @@ void R_RebuildAllLightmaps (void) { if (fa->flags & SURF_DRAWTILED) continue; - base = lightmaps + fa->lightmaptexturenum*lightmap_bytes*BLOCK_WIDTH*BLOCK_HEIGHT; - base += fa->light_t * BLOCK_WIDTH * lightmap_bytes + fa->light_s * lightmap_bytes; - R_BuildLightMap (fa, base, BLOCK_WIDTH*lightmap_bytes); + base = lightmaps + fa->lightmaptexturenum*lightmap_bytes*LMBLOCK_WIDTH*LMBLOCK_HEIGHT; + base += fa->light_t * LMBLOCK_WIDTH * lightmap_bytes + fa->light_s * lightmap_bytes; + R_BuildLightMap (fa, base, LMBLOCK_WIDTH*lightmap_bytes); } } @@ -1321,7 +1321,7 @@ void R_RebuildAllLightmaps (void) if (!allocated[i][0]) break; GL_Bind (lightmap_textures[i]); - glTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, BLOCK_WIDTH, BLOCK_HEIGHT, gl_lightmap_format, - GL_UNSIGNED_BYTE, lightmaps+i*BLOCK_WIDTH*BLOCK_HEIGHT*lightmap_bytes); + glTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, LMBLOCK_WIDTH, LMBLOCK_HEIGHT, gl_lightmap_format, + GL_UNSIGNED_BYTE, lightmaps+i*LMBLOCK_WIDTH*LMBLOCK_HEIGHT*lightmap_bytes); } }