add gl_lightmap_shift (needs to handle renderer swap), fix linux building

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2086 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
TimeServ 2006-03-11 18:33:56 +00:00
parent 09998a6f7a
commit e82a8ac9aa
3 changed files with 36 additions and 27 deletions

View File

@ -246,6 +246,7 @@ cvar_t r_menutint = SCVAR("r_menutint", "0.68 0.4 0.13");
cvar_t gl_schematics = SCVAR("gl_schematics","0");
cvar_t gl_ztrick = SCVAR("gl_ztrick","0");
cvar_t gl_lerpimages = SCVAR("gl_lerpimages", "1");
cvar_t gl_lightmap_shift = SCVARF("gl_lightmap_shift", "0", CVAR_ARCHIVE | CVAR_LATCH);
extern cvar_t r_waterlayers;
cvar_t gl_triplebuffer = SCVARF("gl_triplebuffer", "1", CVAR_ARCHIVE);
cvar_t vid_hardwaregamma = SCVARF("vid_hardwaregamma", "1", CVAR_ARCHIVE);
@ -364,6 +365,8 @@ void GLRenderer_Init(void)
Cvar_Register (&gl_mylumassuck, GLRENDEREROPTIONS);
Cvar_Register (&gl_lightmap_shift, GLRENDEREROPTIONS);
R_BloomRegister();
}
#endif

View File

@ -724,6 +724,7 @@ void GLR_BuildLightMap (msurface_t *surf, qbyte *dest, qbyte *deluxdest, stmap *
unsigned *bl;
qboolean isstained;
extern cvar_t r_ambient;
extern cvar_t gl_lightmap_shift;
#ifdef PEXT_LIGHTSTYLECOL
unsigned *blg;
unsigned *blb;
@ -732,6 +733,14 @@ void GLR_BuildLightMap (msurface_t *surf, qbyte *dest, qbyte *deluxdest, stmap *
int cr, cg, cb;
#endif
int stride = LMBLOCK_WIDTH*lightmap_bytes;
int shift;
if (gl_lightmap_shift.value >= 2)
shift = 9;
else if (gl_lightmap_shift.value == 1)
shift = 8;
else
shift = 7;
surf->cached_dlight = (surf->dlightframe == r_framecount);
@ -1000,14 +1009,13 @@ store:
for (j=0 ; j<smax ; j++)
{
r = *bl++;
r >>= 7;
g = *blg++;
g >>= 7;
b = *blb++;
b >>= 7;
r >>= shift;
g >>= shift;
b >>= shift;
if (isstained) // merge in stain
{
r = (127+r*(*stain++)) >> 8;
@ -1158,13 +1166,12 @@ store:
for (j=0 ; j<smax ; j++)
{
r = *bl++;
r >>= 7;
g = *blg++;
g >>= 7;
b = *blb++;
b >>= 7;
r >>= shift;
g >>= shift;
b >>= shift;
if (isstained) // merge in stain
{
@ -1263,7 +1270,7 @@ store:
for (j=0 ; j<smax ; j++)
{
t = *bl++;
t >>= 7;
t >>= shift;
if (t > 255)
t = 255;
dest[3] = 255-t;
@ -1281,7 +1288,7 @@ store:
for (j=0 ; j<smax ; j++)
{
t = *bl++;
t >>= 7;
t >>= shift;
if (t > 255)
t = 255;
dest[j] = 255-t;
@ -1353,14 +1360,13 @@ store:
for (j=0 ; j<smax ; j++)
{
r = *bl++;
r >>= 7;
g = *blg++;
g >>= 7;
b = *blb++;
b >>= 7;
r >>= shift;
g >>= shift;
b >>= shift;
if (isstained) // merge in stain
{
r = (127+r*(*stain++)) >> 8;
@ -1511,14 +1517,13 @@ store:
for (j=0 ; j<smax ; j++)
{
r = *bl++;
r >>= 7;
g = *blg++;
g >>= 7;
b = *blb++;
b >>= 7;
r >>= shift;
g >>= shift;
b >>= shift;
if (isstained) // merge in stain
{
r = (127+r*(*stain++)) >> 8;
@ -1616,7 +1621,7 @@ store:
for (j=0 ; j<smax ; j++)
{
t = *bl++;
t >>= 7;
t >>= shift;
if (t > 255)
t = 255;
dest[3] = t;
@ -1634,7 +1639,7 @@ store:
for (j=0 ; j<smax ; j++)
{
t = *bl++;
t >>= 7;
t >>= shift;
if (t > 255)
t = 255;
dest[j] = t;

View File

@ -691,6 +691,7 @@ printf("%8x\n", (int)vid_dpy);
extern qbyte gammatable[256];
int j, i;
float f;
int r, g, b;
unsigned short *data;
unsigned char *pal = host_basepal;