mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-02-23 12:32:08 +00:00
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
This commit is contained in:
parent
fb7b52d44b
commit
0594fa4192
1 changed files with 29 additions and 29 deletions
|
@ -30,12 +30,12 @@ extern cvar_t gl_zfix; // QuakeSpasm z-fighting fix
|
||||||
int gl_lightmap_format;
|
int gl_lightmap_format;
|
||||||
int lightmap_bytes;
|
int lightmap_bytes;
|
||||||
|
|
||||||
#define BLOCK_WIDTH 128
|
#define LMBLOCK_WIDTH 128
|
||||||
#define BLOCK_HEIGHT 128
|
#define LMBLOCK_HEIGHT 128
|
||||||
|
|
||||||
gltexture_t *lightmap_textures[MAX_LIGHTMAPS]; //johnfitz -- changed to an array
|
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 {
|
typedef struct glRect_s {
|
||||||
unsigned char l,t,w,h;
|
unsigned char l,t,w,h;
|
||||||
|
@ -45,12 +45,12 @@ glpoly_t *lightmap_polys[MAX_LIGHTMAPS];
|
||||||
qboolean lightmap_modified[MAX_LIGHTMAPS];
|
qboolean lightmap_modified[MAX_LIGHTMAPS];
|
||||||
glRect_t lightmap_rectchange[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
|
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
|
// the lightmap texture data needs to be kept in
|
||||||
// main memory so texsubimage can update properly
|
// 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;
|
theRect->w = (fa->light_s-theRect->l)+smax;
|
||||||
if ((theRect->h + theRect->t) < (fa->light_t + tmax))
|
if ((theRect->h + theRect->t) < (fa->light_t + tmax))
|
||||||
theRect->h = (fa->light_t-theRect->t)+tmax;
|
theRect->h = (fa->light_t-theRect->t)+tmax;
|
||||||
base = lightmaps + fa->lightmaptexturenum*lightmap_bytes*BLOCK_WIDTH*BLOCK_HEIGHT;
|
base = lightmaps + fa->lightmaptexturenum*lightmap_bytes*LMBLOCK_WIDTH*LMBLOCK_HEIGHT;
|
||||||
base += fa->light_t * BLOCK_WIDTH * lightmap_bytes + fa->light_s * lightmap_bytes;
|
base += fa->light_t * LMBLOCK_WIDTH * lightmap_bytes + fa->light_s * lightmap_bytes;
|
||||||
R_BuildLightMap (fa, base, BLOCK_WIDTH*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)
|
// lightmaps as tightly vs. not doing this (uses ~5% more lightmaps)
|
||||||
for (texnum=last_lightmap_allocated ; texnum<MAX_LIGHTMAPS ; texnum++, last_lightmap_allocated++)
|
for (texnum=last_lightmap_allocated ; texnum<MAX_LIGHTMAPS ; texnum++, last_lightmap_allocated++)
|
||||||
{
|
{
|
||||||
best = BLOCK_HEIGHT;
|
best = LMBLOCK_HEIGHT;
|
||||||
|
|
||||||
for (i=0 ; i<BLOCK_WIDTH-w ; i++)
|
for (i=0 ; i<LMBLOCK_WIDTH-w ; i++)
|
||||||
{
|
{
|
||||||
best2 = 0;
|
best2 = 0;
|
||||||
|
|
||||||
|
@ -754,7 +754,7 @@ int AllocBlock (int w, int h, int *x, int *y)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (best + h > BLOCK_HEIGHT)
|
if (best + h > LMBLOCK_HEIGHT)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (i=0 ; i<w ; i++)
|
for (i=0 ; i<w ; i++)
|
||||||
|
@ -787,9 +787,9 @@ void GL_CreateSurfaceLightmap (msurface_t *surf)
|
||||||
tmax = (surf->extents[1]>>4)+1;
|
tmax = (surf->extents[1]>>4)+1;
|
||||||
|
|
||||||
surf->lightmaptexturenum = AllocBlock (smax, tmax, &surf->light_s, &surf->light_t);
|
surf->lightmaptexturenum = AllocBlock (smax, tmax, &surf->light_s, &surf->light_t);
|
||||||
base = lightmaps + surf->lightmaptexturenum*lightmap_bytes*BLOCK_WIDTH*BLOCK_HEIGHT;
|
base = lightmaps + surf->lightmaptexturenum*lightmap_bytes*LMBLOCK_WIDTH*LMBLOCK_HEIGHT;
|
||||||
base += (surf->light_t * BLOCK_WIDTH + surf->light_s) * lightmap_bytes;
|
base += (surf->light_t * LMBLOCK_WIDTH + surf->light_s) * lightmap_bytes;
|
||||||
R_BuildLightMap (surf, base, BLOCK_WIDTH*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->texturemins[0];
|
||||||
s += fa->light_s*16;
|
s += fa->light_s*16;
|
||||||
s += 8;
|
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 = DotProduct (vec, fa->texinfo->vecs[1]) + fa->texinfo->vecs[1][3];
|
||||||
t -= fa->texturemins[1];
|
t -= fa->texturemins[1];
|
||||||
t += fa->light_t*16;
|
t += fa->light_t*16;
|
||||||
t += 8;
|
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][5] = s;
|
||||||
poly->verts[i][6] = t;
|
poly->verts[i][6] = t;
|
||||||
|
@ -932,15 +932,15 @@ void GL_BuildLightmaps (void)
|
||||||
if (!allocated[i][0])
|
if (!allocated[i][0])
|
||||||
break; // no more used
|
break; // no more used
|
||||||
lightmap_modified[i] = false;
|
lightmap_modified[i] = false;
|
||||||
lightmap_rectchange[i].l = BLOCK_WIDTH;
|
lightmap_rectchange[i].l = LMBLOCK_WIDTH;
|
||||||
lightmap_rectchange[i].t = BLOCK_HEIGHT;
|
lightmap_rectchange[i].t = LMBLOCK_HEIGHT;
|
||||||
lightmap_rectchange[i].w = 0;
|
lightmap_rectchange[i].w = 0;
|
||||||
lightmap_rectchange[i].h = 0;
|
lightmap_rectchange[i].h = 0;
|
||||||
|
|
||||||
//johnfitz -- use texture manager
|
//johnfitz -- use texture manager
|
||||||
sprintf(name, "lightmap%03i",i);
|
sprintf(name, "lightmap%03i",i);
|
||||||
data = lightmaps+i*BLOCK_WIDTH*BLOCK_HEIGHT*lightmap_bytes;
|
data = lightmaps+i*LMBLOCK_WIDTH*LMBLOCK_HEIGHT*lightmap_bytes;
|
||||||
lightmap_textures[i] = TexMgr_LoadImage (cl.worldmodel, name, BLOCK_WIDTH, BLOCK_HEIGHT,
|
lightmap_textures[i] = TexMgr_LoadImage (cl.worldmodel, name, LMBLOCK_WIDTH, LMBLOCK_HEIGHT,
|
||||||
SRC_LIGHTMAP, data, "", (src_offset_t)data, TEXPREF_LINEAR | TEXPREF_NOPICMIP);
|
SRC_LIGHTMAP, data, "", (src_offset_t)data, TEXPREF_LINEAR | TEXPREF_NOPICMIP);
|
||||||
//johnfitz
|
//johnfitz
|
||||||
}
|
}
|
||||||
|
@ -1260,10 +1260,10 @@ static void R_UploadLightmap(int lmap)
|
||||||
lightmap_modified[lmap] = false;
|
lightmap_modified[lmap] = false;
|
||||||
|
|
||||||
theRect = &lightmap_rectchange[lmap];
|
theRect = &lightmap_rectchange[lmap];
|
||||||
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, theRect->t, BLOCK_WIDTH, theRect->h, gl_lightmap_format,
|
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, theRect->t, LMBLOCK_WIDTH, theRect->h, gl_lightmap_format,
|
||||||
GL_UNSIGNED_BYTE, lightmaps+(lmap* BLOCK_HEIGHT + theRect->t) *BLOCK_WIDTH*lightmap_bytes);
|
GL_UNSIGNED_BYTE, lightmaps+(lmap* LMBLOCK_HEIGHT + theRect->t) *LMBLOCK_WIDTH*lightmap_bytes);
|
||||||
theRect->l = BLOCK_WIDTH;
|
theRect->l = LMBLOCK_WIDTH;
|
||||||
theRect->t = BLOCK_HEIGHT;
|
theRect->t = LMBLOCK_HEIGHT;
|
||||||
theRect->h = 0;
|
theRect->h = 0;
|
||||||
theRect->w = 0;
|
theRect->w = 0;
|
||||||
|
|
||||||
|
@ -1309,9 +1309,9 @@ void R_RebuildAllLightmaps (void)
|
||||||
{
|
{
|
||||||
if (fa->flags & SURF_DRAWTILED)
|
if (fa->flags & SURF_DRAWTILED)
|
||||||
continue;
|
continue;
|
||||||
base = lightmaps + fa->lightmaptexturenum*lightmap_bytes*BLOCK_WIDTH*BLOCK_HEIGHT;
|
base = lightmaps + fa->lightmaptexturenum*lightmap_bytes*LMBLOCK_WIDTH*LMBLOCK_HEIGHT;
|
||||||
base += fa->light_t * BLOCK_WIDTH * lightmap_bytes + fa->light_s * lightmap_bytes;
|
base += fa->light_t * LMBLOCK_WIDTH * lightmap_bytes + fa->light_s * lightmap_bytes;
|
||||||
R_BuildLightMap (fa, base, BLOCK_WIDTH*lightmap_bytes);
|
R_BuildLightMap (fa, base, LMBLOCK_WIDTH*lightmap_bytes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1321,7 +1321,7 @@ void R_RebuildAllLightmaps (void)
|
||||||
if (!allocated[i][0])
|
if (!allocated[i][0])
|
||||||
break;
|
break;
|
||||||
GL_Bind (lightmap_textures[i]);
|
GL_Bind (lightmap_textures[i]);
|
||||||
glTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, BLOCK_WIDTH, BLOCK_HEIGHT, gl_lightmap_format,
|
glTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, LMBLOCK_WIDTH, LMBLOCK_HEIGHT, gl_lightmap_format,
|
||||||
GL_UNSIGNED_BYTE, lightmaps+i*BLOCK_WIDTH*BLOCK_HEIGHT*lightmap_bytes);
|
GL_UNSIGNED_BYTE, lightmaps+i*LMBLOCK_WIDTH*LMBLOCK_HEIGHT*lightmap_bytes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue