0
0
Fork 0
mirror of https://git.code.sf.net/p/quake/quakeforge synced 2025-03-21 18:01:15 +00:00

The lighthalf qboolean is no more - replaced with a gl_lightmode callback

to do the job much more simply.  Also replaced lighthalf_v with white_v on
the QW side.
This commit is contained in:
Joseph Carter 2001-04-05 17:28:28 +00:00
parent e0c11b2f87
commit c9ecc7a9d2
19 changed files with 94 additions and 127 deletions

View file

@ -206,6 +206,7 @@ extern cvar_t *gl_particles;
extern cvar_t *gl_fires;
extern cvar_t *gl_fb_models;
extern cvar_t *gl_fb_bmodels;
extern cvar_t *gl_lightmode;
extern int gl_lightmap_format;
extern int gl_solid_format;
@ -219,7 +220,6 @@ extern cvar_t *gl_skymultipass;
extern int mirrortexturenum; // quake texturenum, not gltexturenum
extern qboolean mirror;
extern qboolean lighthalf;
extern mplane_t *mirror_plane;
extern float r_world_matrix[16];

View file

@ -63,7 +63,6 @@ static int GL_LoadPicTexture (qpic_t *pic);
extern byte *host_basepal;
extern unsigned char d_15to8table[65536];
extern cvar_t *crosshair, *cl_crossx, *cl_crossy, *crosshaircolor;
extern qboolean lighthalf;
cvar_t *gl_nobind;
cvar_t *gl_max_size;
@ -401,6 +400,7 @@ Draw_TextureMode_f (void)
}
}
extern void R_ForceLightUpdate (cvar_t *gl_lightmode);
extern void glrmain_init ();
extern void glrsurf_init ();
@ -415,8 +415,9 @@ Draw_Init (void)
int i;
// LordHavoc: lighting mode
gl_lightmode = Cvar_Get ("gl_lightmode", "0", CVAR_ARCHIVE, 0,
"Lighting mode (0 = GLQuake style, 1 = new style)");
gl_lightmode = Cvar_Get ("gl_lightmode", "0", CVAR_ARCHIVE,
R_ForceLightUpdate,
"Lighting mode (0 = GLQuake style, 1 = new style)");
gl_nobind = Cvar_Get ("gl_nobind", "0", CVAR_NONE, 0,
"whether or not to inhibit texture binding");
gl_max_size = Cvar_Get ("gl_max_size", "1024", CVAR_NONE, 0, "None"); // CVAR_FIXME
@ -452,8 +453,6 @@ Draw_Init (void)
// lightmode 1
if (!strncasecmp ((char *) gl_renderer, "3dfx", 4))
Cvar_Set (gl_lightmode, "0");
lighthalf = gl_lightmode->int_val != 0; // to avoid re-rendering all
// lightmaps on first frame
Cmd_AddCommand ("gl_texturemode", &Draw_TextureMode_f, "No Description");
@ -536,7 +535,7 @@ Draw_Character8 (int x, int y, int num)
glBindTexture (GL_TEXTURE_2D, char_texture);
if (lighthalf)
if (gl_lightmode->int_val)
glColor3f (0.5, 0.5, 0.5);
else
glColor3f (1, 1, 1);
@ -595,7 +594,7 @@ Draw_Crosshair (void)
pColor =
(unsigned char *) &d_8to24table[(byte) crosshaircolor->int_val];
if (lighthalf)
if (gl_lightmode->int_val)
glColor4ub ((byte) ((int) pColor[0] >> 1),
(byte) ((int) pColor[1] >> 1),
(byte) ((int) pColor[2] >> 1), pColor[3]);
@ -635,7 +634,7 @@ Draw_Pic (int x, int y, qpic_t *pic)
Scrap_Upload ();
#endif
gl = (glpic_t *) pic->data;
if (lighthalf)
if (gl_lightmode->int_val)
glColor3f (0.4, 0.4, 0.4);
else
glColor3f (0.8, 0.8, 0.8);
@ -675,7 +674,7 @@ Draw_SubPic (int x, int y, qpic_t *pic, int srcx, int srcy, int width,
newtl = gl->tl + (srcy * oldglheight) / pic->height;
newth = newtl + (height * oldglheight) / pic->height;
if (lighthalf)
if (gl_lightmode->int_val)
glColor3f (0.4, 0.4, 0.4);
else
glColor3f (0.8, 0.8, 0.8);
@ -747,7 +746,7 @@ Draw_TransPicTranslate (int x, int y, qpic_t *pic, byte * translation)
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
if (lighthalf)
if (gl_lightmode->int_val)
glColor3f (0.4, 0.4, 0.4);
else
glColor3f (0.8, 0.8, 0.8);
@ -814,7 +813,7 @@ Draw_ConsoleBackground (int lines)
alpha = (float) (gl_conalpha->value * lines) / y;
}
if (lighthalf)
if (gl_lightmode->int_val)
glColor4f (0.4, 0.4, 0.4, alpha);
else
glColor4f (0.8, 0.8, 0.8, alpha);
@ -834,7 +833,7 @@ Draw_ConsoleBackground (int lines)
// turn off alpha blending
if (alpha < 1.0) {
if (lighthalf)
if (gl_lightmode->int_val)
glColor3f (0.4, 0.4, 0.4);
else
glColor3f (0.8, 0.8, 0.8);
@ -859,7 +858,7 @@ refresh window.
void
Draw_TileClear (int x, int y, int w, int h)
{
if (lighthalf)
if (gl_lightmode->int_val)
glColor3f (0.4, 0.4, 0.4);
else
glColor3f (0.8, 0.8, 0.8);
@ -888,7 +887,7 @@ void
Draw_Fill (int x, int y, int w, int h, int c)
{
glDisable (GL_TEXTURE_2D);
if (lighthalf)
if (gl_lightmode->int_val)
glColor3f (host_basepal[c * 3] / 510.0, host_basepal[c * 3 + 1] / 510.0,
host_basepal[c * 3 + 2] / 510.0);
else
@ -903,7 +902,7 @@ Draw_Fill (int x, int y, int w, int h, int c)
glVertex2f (x, y + h);
glEnd ();
if (lighthalf)
if (gl_lightmode->int_val)
glColor3f (0.5, 0.5, 0.5);
else
glColor3f (1, 1, 1);
@ -930,7 +929,7 @@ Draw_FadeScreen (void)
glVertex2f (0, vid.height);
glEnd ();
if (lighthalf)
if (gl_lightmode->int_val)
glColor3f (0.5, 0.5, 0.5);
else
glColor3f (1, 1, 1);
@ -994,7 +993,7 @@ GL_Set2D (void)
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
if (lighthalf)
if (gl_lightmode->int_val)
glColor3f (0.5, 0.5, 0.5);
else
glColor3f (1, 1, 1);

View file

@ -125,7 +125,7 @@ R_DrawParticles (void)
theAlpha = 255 * (6 - p->ramp) / 6;
else
theAlpha = 255;
if (lighthalf)
if (gl_lightmode->int_val)
glColor4ub ((byte) ((int) at[0] >> 1), (byte) ((int) at[1] >> 1),
(byte) ((int) at[2] >> 1), theAlpha);
else
@ -319,7 +319,7 @@ R_DrawFire (fire_t *f)
}
// we're not - draw it
glBegin (GL_TRIANGLE_FAN);
if (lighthalf)
if (gl_lightmode->int_val)
glColor3f (f->color[0] * 0.5, f->color[1] * 0.5, f->color[2] * 0.5);
else
glColor3fv (f->color);

View file

@ -129,7 +129,7 @@ R_RenderDlight (dlight_t *light)
glBegin (GL_TRIANGLE_FAN);
// glColor3f (0.2,0.1,0.0);
// glColor3f (0.2,0.1,0.05); // changed dimlight effect
if (lighthalf)
if (gl_lightmode->int_val)
glColor3f (light->color[0] * 0.5, light->color[1] * 0.5,
light->color[2] * 0.5);
else

View file

@ -141,7 +141,6 @@ cvar_t *gl_fb_bmodels;
extern cvar_t *scr_fov;
extern byte gammatable[256];
extern qboolean lighthalf;
static float vid_gamma = 1.0;
// LordHavoc: place for gl_rmain setup code
@ -306,7 +305,7 @@ R_DrawSpriteModel (entity_t *e)
right = vright;
}
if (lighthalf)
if (gl_lightmode->int_val)
glColor4f (0.5, 0.5, 0.5, 1);
else
glColor4f (1, 1, 1, 1);
@ -390,7 +389,7 @@ GL_DrawAliasFrame (aliashdr_t *paliashdr, int posenum, qboolean fb)
if (fb)
glColor3f (1, 1, 1);
else if (lighthalf)
else if (gl_lightmode->int_val)
shadelight *= 2;
while (1) {
// get the vertex count and primitive type

View file

@ -96,8 +96,6 @@ byte *lightmaps[MAX_LIGHTMAPS];
msurface_t *waterchain = NULL;
extern qboolean lighthalf;
// LordHavoc: place for gl_rsurf setup code
void
glrsurf_init ()
@ -122,7 +120,7 @@ recursivelightupdate (mnode_t *node)
// LordHavoc: function to force all lightmaps to be updated
void
R_ForceLightUpdate ()
R_ForceLightUpdate (cvar_t *gl_lightmode)
{
if (cl.worldmodel && cl.worldmodel->nodes
&& cl.worldmodel->nodes->contents >= 0)
@ -312,7 +310,7 @@ R_BuildLightMap (msurface_t *surf, byte * dest, int stride)
if (gl_colorlights->int_val) {
stride -= smax * 3;
bl = blocklights;
if (lighthalf) {
if (gl_lightmode->int_val) {
for (i = 0; i < tmax; i++, dest += stride)
for (j = 0; j < smax; j++) {
t = (int) *bl++ >> 8;
@ -336,7 +334,7 @@ R_BuildLightMap (msurface_t *surf, byte * dest, int stride)
} else {
stride -= smax;
bl = blocklights;
if (lighthalf) {
if (gl_lightmode->int_val) {
for (i = 0; i < tmax; i++, dest += stride)
for (j = 0; j < smax; j++) {
t = (int) *bl++ >> 8;
@ -658,7 +656,7 @@ GL_WaterSurface (msurface_t *s)
int i;
glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
if (lighthalf)
if (gl_lightmode->int_val)
glColor4f (0.5, 0.5, 0.5, r_wateralpha->value);
else
glColor4f (1, 1, 1, r_wateralpha->value);
@ -692,7 +690,7 @@ R_DrawWaterSurfaces (void)
glLoadMatrixf (r_world_matrix);
glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
if (lighthalf)
if (gl_lightmode->int_val)
glColor4f (0.5, 0.5, 0.5, r_wateralpha->value);
else
glColor4f (1, 1, 1, r_wateralpha->value);

View file

@ -918,9 +918,6 @@ SCR_TileClear (void)
}
float oldsbar = 0;
extern void R_ForceLightUpdate ();
qboolean lighthalf;
extern cvar_t *gl_lightmode;
/*
==================
@ -986,12 +983,6 @@ SCR_UpdateScreen (void)
// do 3D refresh drawing, and then update the screen
//
// LordHavoc: set lighthalf based on gl_lightmode cvar
if (lighthalf != (gl_lightmode->int_val != 0)) {
lighthalf = gl_lightmode->int_val != 0;
R_ForceLightUpdate ();
}
SCR_SetUpToDrawConsole ();
V_RenderView ();
@ -1043,10 +1034,8 @@ SCR_UpdateScreen (void)
glDisable (GL_TEXTURE_2D);
glEnable (GL_BLEND);
Cvar_SetValue (brightness, bound (1, brightness->value, 5));
if (lighthalf) // LordHavoc: render was done at half
//
//
// brightness
if (gl_lightmode->int_val) // LordHavoc: render was done at half
// brightness
f = brightness->value * 2;
else
f = brightness->value;

View file

@ -49,7 +49,6 @@ extern double realtime;
extern model_t *loadmodel;
extern int skytexturenum;
extern qboolean lighthalf;
int solidskytexture;
int alphaskytexture;
@ -580,7 +579,7 @@ R_DrawSkyBox (void)
// glDisable (GL_BLEND);
// glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glDepthRange (gldepthmax, gldepthmax);
if (lighthalf)
if (gl_lightmode->int_val)
glColor3f (0.5, 0.5, 0.5);
else
glColor3f (1, 1, 1);
@ -656,7 +655,7 @@ R_DrawSkyDome (void)
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDepthRange (gldepthmax, gldepthmax);
glDisable (GL_BLEND);
if (lighthalf)
if (gl_lightmode->int_val)
glColor3f (0.5, 0.5, 0.5);
else
glColor3f (1, 1, 1);

View file

@ -177,6 +177,7 @@ extern cvar_t *r_skyname;
extern cvar_t *gl_skymultipass;
extern cvar_t *gl_sky_clip;
extern cvar_t *gl_sky_divide;
extern cvar_t *gl_lightmode;
extern int gl_lightmap_format;
extern int gl_solid_format;
@ -277,8 +278,7 @@ void R_StoreEfrags (efrag_t **ppefrag);
// gl_screen.c
//
extern qboolean lighthalf;
extern unsigned char lighthalf_v[3];
extern unsigned char white_v[3];
//
// gl_rsurf.c

View file

@ -248,6 +248,7 @@ Draw_TextBox (int x, int y, int width, int lines)
}
extern void R_ForceLightUpdate (cvar_t *gl_lightmode);
extern void glrmain_init (void);
extern void glrsurf_init (void);
extern void GL_TextureMode_f (void);
@ -266,13 +267,10 @@ Draw_Init (void)
Cvar_Set (gl_lightmode, "0");
}
lighthalf = gl_lightmode->int_val != 0; // to avoid re-rendering all
// lightmaps on first frame
if (lighthalf) {
lighthalf_v[0] = lighthalf_v[1] = lighthalf_v[2] = 128;
if (gl_lightmode->int_val) {
white_v[0] = white_v[1] = white_v[2] = 128;
} else {
lighthalf_v[0] = lighthalf_v[1] = lighthalf_v[2] = 255;
white_v[0] = white_v[1] = white_v[2] = 255;
}
Cmd_AddCommand ("gl_texturemode", &GL_TextureMode_f, "Texture mipmap quality.");
@ -309,8 +307,9 @@ Draw_Init (void)
void
Draw_Init_Cvars (void)
{
gl_lightmode = Cvar_Get ("gl_lightmode", "1", CVAR_ARCHIVE, 0,
"Lighting mode (0 = GLQuake style, 1 = new style)");
gl_lightmode = Cvar_Get ("gl_lightmode", "1", CVAR_ARCHIVE,
R_ForceLightUpdate,
"Lighting mode (0 = GLQuake style, 1 = new style)");
gl_max_size = Cvar_Get ("gl_max_size", "1024", CVAR_NONE, 0, "Texture dimension");
gl_picmip = Cvar_Get ("gl_picmip", "0", CVAR_NONE, 0, "Dimensions of displayed textures. 0 is normal, 1 is half, 2 is 1/4");
gl_constretch = Cvar_Get ("gl_constretch", "0", CVAR_ARCHIVE, 0,
@ -412,7 +411,7 @@ Draw_Crosshair (void)
y = scr_vrect.y + scr_vrect.height / 2 - 3 + cl_crossy->int_val;
pColor = (unsigned char *) &d_8to24table[crosshaircolor->int_val];
if (lighthalf)
if (gl_lightmode->int_val)
glColor4ub ((byte) ((int) pColor[0] >> 1),
(byte) ((int) pColor[1] >> 1),
(byte) ((int) pColor[2] >> 1), pColor[3]);
@ -430,7 +429,7 @@ Draw_Crosshair (void)
glTexCoord2f (0, 1);
glVertex2f (x - 4, y + 12);
glEnd ();
glColor3ubv (lighthalf_v);
glColor3ubv (white_v);
break;
}
}
@ -476,7 +475,7 @@ Draw_SubPic (int x, int y, qpic_t *pic, int srcx, int srcy, int width,
newtl = gl->tl + (srcy * oldglheight) / pic->height;
newth = newtl + (height * oldglheight) / pic->height;
if (lighthalf)
if (gl_lightmode->int_val)
glColor3f (0.4, 0.4, 0.4);
else
glColor3f (0.8, 0.8, 0.8);
@ -491,7 +490,7 @@ Draw_SubPic (int x, int y, qpic_t *pic, int srcx, int srcy, int width,
glTexCoord2f (newsl, newth);
glVertex2f (x, y + height);
glEnd ();
glColor3ubv (lighthalf_v);
glColor3ubv (white_v);
}
@ -532,7 +531,7 @@ Draw_TransPicTranslate (int x, int y, qpic_t *pic, byte * translation)
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
if (lighthalf)
if (gl_lightmode->int_val)
glColor3f (0.4, 0.4, 0.4);
else
glColor3f (0.8, 0.8, 0.8);
@ -546,7 +545,7 @@ Draw_TransPicTranslate (int x, int y, qpic_t *pic, byte * translation)
glTexCoord2f (0, 1);
glVertex2f (x, y + pic->height);
glEnd ();
glColor3ubv (lighthalf_v);
glColor3ubv (white_v);
}
@ -600,7 +599,7 @@ Draw_ConsoleBackground (int lines)
alpha = (float) (gl_conalpha->value * lines) / y;
}
if (lighthalf)
if (gl_lightmode->int_val)
glColor4f (0.4, 0.4, 0.4, alpha);
else
glColor4f (0.8, 0.8, 0.8, alpha);
@ -620,7 +619,7 @@ Draw_ConsoleBackground (int lines)
// turn off alpha blending
if (alpha < 1.0) {
if (lighthalf)
if (gl_lightmode->int_val)
glColor3f (0.4, 0.4, 0.4);
else
glColor3f (0.8, 0.8, 0.8);
@ -635,7 +634,7 @@ Draw_ConsoleBackground (int lines)
if (!cls.download)
Draw_AltString8 (vid.conwidth - strlen (cl_verstring->string) * 8 - 11,
lines - 14, cl_verstring->string);
glColor3ubv (lighthalf_v);
glColor3ubv (white_v);
}
@ -648,7 +647,7 @@ Draw_ConsoleBackground (int lines)
void
Draw_TileClear (int x, int y, int w, int h)
{
if (lighthalf)
if (gl_lightmode->int_val)
glColor3f (0.4, 0.4, 0.4);
else
glColor3f (0.8, 0.8, 0.8);
@ -663,7 +662,7 @@ Draw_TileClear (int x, int y, int w, int h)
glTexCoord2f (x / 64.0, (y + h) / 64.0);
glVertex2f (x, y + h);
glEnd ();
glColor3ubv (lighthalf_v);
glColor3ubv (white_v);
}
@ -676,7 +675,7 @@ void
Draw_Fill (int x, int y, int w, int h, int c)
{
glDisable (GL_TEXTURE_2D);
if (lighthalf)
if (gl_lightmode->int_val)
glColor3f (host_basepal[c * 3] / 510.0, host_basepal[c * 3 + 1] / 510.0,
host_basepal[c * 3 + 2] / 510.0);
else
@ -691,7 +690,7 @@ Draw_Fill (int x, int y, int w, int h, int c)
glVertex2f (x, y + h);
glEnd ();
glColor3ubv (lighthalf_v);
glColor3ubv (white_v);
glEnable (GL_TEXTURE_2D);
}
@ -713,7 +712,7 @@ Draw_FadeScreen (void)
glVertex2f (0, vid.height);
glEnd ();
glColor3ubv (lighthalf_v);
glColor3ubv (white_v);
glEnable (GL_TEXTURE_2D);
Sbar_Changed ();
@ -765,5 +764,5 @@ GL_Set2D (void)
glDisable (GL_DEPTH_TEST);
glDisable (GL_CULL_FACE);
glColor3ubv (lighthalf_v);
glColor3ubv (white_v);
}

View file

@ -146,7 +146,7 @@ R_DrawFire (fire_t *f)
}
// we're not - draw it
glBegin (GL_TRIANGLE_FAN);
if (lighthalf)
if (gl_lightmode->int_val)
glColor3f (f->color[0] * 0.5, f->color[1] * 0.5, f->color[2] * 0.5);
else
glColor3fv (f->color);
@ -170,7 +170,7 @@ R_DrawFire (fire_t *f)
b_cos += 2;
}
glEnd ();
glColor3ubv (lighthalf_v);
glColor3ubv (white_v);
}
/*

View file

@ -70,8 +70,6 @@ typedef struct particle_s {
static particle_t *particles, **freeparticles;
static short r_numparticles, numparticles;
extern qboolean lighthalf;
extern cvar_t *cl_max_particles;
extern int part_tex_smoke[8];
@ -592,7 +590,7 @@ R_DrawParticles (void)
at = (byte *) & d_8to24table[(byte) part->color];
alpha = part->alpha;
if (lighthalf)
if (gl_lightmode->int_val)
glColor4ub ((byte) ((int) at[0] >> 1),
(byte) ((int) at[1] >> 1),
(byte) ((int) at[2] >> 1), alpha);
@ -703,6 +701,6 @@ R_DrawParticles (void)
}
numparticles = activeparticles;
glColor3ubv (lighthalf_v);
glColor3ubv (white_v);
glDepthMask (GL_TRUE);
}

View file

@ -45,7 +45,6 @@
#include "sbar.h"
extern byte *draw_chars; // 8*8 graphic characters
extern qboolean lighthalf;
extern cvar_t *r_netgraph;
extern cvar_t *r_netgraph_alpha;
@ -174,5 +173,5 @@ R_NetGraph (void)
glVertex2f (x, y + NET_GRAPHHEIGHT);
glEnd ();
glColor3ubv (lighthalf_v);
glColor3ubv (white_v);
}

View file

@ -42,7 +42,6 @@
#include "glquake.h"
int r_dlightframecount;
extern qboolean lighthalf;
/*
@ -126,7 +125,7 @@ R_RenderDlight (dlight_t *light)
glBegin (GL_TRIANGLE_FAN);
if (lighthalf)
if (gl_lightmode->int_val)
glColor3f (light->color[0] * 0.5, light->color[1] * 0.5,
light->color[2] * 0.5);
else
@ -152,7 +151,7 @@ R_RenderDlight (dlight_t *light)
glEnd ();
// Don't glColor3ubv(lighthalf_v), as we reset in the function which
// Don't glColor3ubv(white_v), as we reset in the function which
// calls this one, because this is called in a big loop.
}
@ -184,7 +183,7 @@ R_RenderDlights (void)
if (!gl_dlight_smooth->int_val)
glShadeModel (GL_FLAT);
glColor3ubv (lighthalf_v);
glColor3ubv (white_v);
glEnable (GL_TEXTURE_2D);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDepthMask (GL_TRUE);

View file

@ -136,7 +136,6 @@ cvar_t *brighten;
extern cvar_t *scr_fov;
extern byte gammatable[256];
extern qboolean lighthalf;
// LordHavoc: place for gl_rmain setup code
void
@ -371,7 +370,7 @@ GL_DrawAliasFrame (aliashdr_t *paliashdr, int posenum, qboolean fb)
glDepthMask (GL_FALSE);
if (fb) { // don't do this in the loop, it doesn't change
if (lighthalf)
if (gl_lightmode->int_val)
glColor4f (0.5, 0.5, 0.5, modelalpha);
else
glColor4f (1, 1, 1, modelalpha);
@ -410,7 +409,7 @@ GL_DrawAliasFrame (aliashdr_t *paliashdr, int posenum, qboolean fb)
if (modelalpha != 1.0)
glDepthMask (GL_TRUE);
glColor3ubv (lighthalf_v);
glColor3ubv (white_v);
}
/*
@ -443,7 +442,7 @@ GL_DrawAliasBlendedFrame (aliashdr_t *paliashdr, int pose1, int pose2, float ble
glDepthMask (GL_FALSE);
if (fb) { // don't do this in the loop, it doesn't change
if (lighthalf)
if (gl_lightmode->int_val)
glColor4f (0.5, 0.5, 0.5, modelalpha);
else
glColor4f (1, 1, 1, modelalpha);
@ -486,7 +485,7 @@ GL_DrawAliasBlendedFrame (aliashdr_t *paliashdr, int pose1, int pose2, float ble
if (modelalpha != 1.0)
glDepthMask (GL_TRUE);
glColor3ubv (lighthalf_v);
glColor3ubv (white_v);
}
@ -730,7 +729,7 @@ R_DrawAliasModel (entity_t *e)
shadecolor[0] = currententity->colormod[0];
shadecolor[1] = currententity->colormod[1];
shadecolor[2] = currententity->colormod[2];
if (!lighthalf) {
if (!gl_lightmode->int_val) {
shadecolor[0] *= 2.0;
shadecolor[1] *= 2.0;
shadecolor[2] *= 2.0;
@ -890,7 +889,7 @@ R_DrawAliasModel (entity_t *e)
}
glEnable (GL_TEXTURE_2D);
glColor3ubv (lighthalf_v);
glColor3ubv (white_v);
glPopMatrix ();
}
}

View file

@ -85,8 +85,6 @@ byte *lightmaps[MAX_LIGHTMAPS];
msurface_t *waterchain = NULL;
msurface_t *sky_chain;
extern qboolean lighthalf;
// LordHavoc: place for gl_rsurf setup code
void
glrsurf_init (void)
@ -111,11 +109,16 @@ R_RecursiveLightUpdate (mnode_t *node)
// LordHavoc: function to force all lightmaps to be updated
void
R_ForceLightUpdate (void)
R_ForceLightUpdate (cvar_t *gl_lightmode)
{
if (cl.worldmodel && cl.worldmodel->nodes
&& cl.worldmodel->nodes->contents >= 0)
R_RecursiveLightUpdate (cl.worldmodel->nodes);
if (gl_lightmode->int_val) {
white_v[0] = white_v[1] = white_v[2] = 128;
} else {
white_v[0] = white_v[1] = white_v[2] = 255;
}
}
/*
@ -267,7 +270,7 @@ R_BuildLightMap (msurface_t *surf, byte * dest, int stride)
bl = blocklights;
switch (lightmap_bytes) {
case 4:
if (lighthalf) {
if (gl_lightmode->int_val) {
for (i = 0; i < tmax; i++, dest += stride) {
for (j = 0; j < smax; j++) {
t = (int) *bl++ >> 8;
@ -294,7 +297,7 @@ R_BuildLightMap (msurface_t *surf, byte * dest, int stride)
}
break;
case 3:
if (lighthalf) {
if (gl_lightmode->int_val) {
for (i = 0; i < tmax; i++, dest += stride) {
for (j = 0; j < smax; j++) {
t = (int) *bl++ >> 8;
@ -319,7 +322,7 @@ R_BuildLightMap (msurface_t *surf, byte * dest, int stride)
}
break;
case 1:
if (lighthalf) {
if (gl_lightmode->int_val) {
for (i = 0; i < tmax; i++, dest += stride) {
for (j = 0; j < smax; j++) {
t = (int) *bl++ >> 8;
@ -471,7 +474,7 @@ R_DrawMultitexturePoly (msurface_t *s)
s->polys->fb_chain = fullbright_polys[texture->gl_fb_texturenum];
fullbright_polys[texture->gl_fb_texturenum] = s->polys;
}
glColor3ubv (lighthalf_v);
glColor3ubv (white_v);
glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
}
@ -514,7 +517,7 @@ R_BlendLightmaps (void)
}
// Return to normal blending --KB
glColor3ubv (lighthalf_v);
glColor3ubv (white_v);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDepthMask (GL_TRUE); // back to normal Z buffering
@ -620,7 +623,7 @@ R_RenderBrushPoly (msurface_t *fa)
R_BuildLightMap (fa, base, BLOCK_WIDTH * lightmap_bytes);
}
}
glColor3ubv (lighthalf_v);
glColor3ubv (white_v);
}
void
@ -632,13 +635,13 @@ GL_WaterSurface (msurface_t *s)
glBindTexture (GL_TEXTURE_2D, i);
if (r_wateralpha->value < 1.0) {
glDepthMask (GL_FALSE);
if (lighthalf) {
if (gl_lightmode->int_val) {
glColor4f (0.5, 0.5, 0.5, r_wateralpha->value);
} else {
glColor4f (1, 1, 1, r_wateralpha->value);
}
EmitWaterPolys (s);
glColor3ubv (lighthalf_v);
glColor3ubv (white_v);
glDepthMask (GL_TRUE);
} else
EmitWaterPolys (s);
@ -662,7 +665,7 @@ R_DrawWaterSurfaces (void)
if (r_wateralpha->value < 1.0) {
glDepthMask (GL_FALSE);
if (lighthalf) {
if (gl_lightmode->int_val) {
glColor4f (0.5, 0.5, 0.5, r_wateralpha->value);
} else {
glColor4f (1, 1, 1, r_wateralpha->value);
@ -682,7 +685,7 @@ R_DrawWaterSurfaces (void)
if (r_wateralpha->value < 1.0) {
glDepthMask (GL_TRUE);
glColor3ubv (lighthalf_v);
glColor3ubv (white_v);
}
}

View file

@ -906,12 +906,8 @@ SCR_TileClear (void)
}
}
extern void R_ForceLightUpdate (void);
int oldviewsize = 0;
unsigned char lighthalf_v[3];
qboolean lighthalf;
extern cvar_t *gl_lightmode;
unsigned char white_v[3];
extern cvar_t *brightness;
/*
SCR_UpdateScreen
@ -976,15 +972,6 @@ SCR_UpdateScreen (void)
// do 3D refresh drawing, and then update the screen
if (lighthalf != gl_lightmode->int_val) {
lighthalf = gl_lightmode->int_val;
if (lighthalf)
lighthalf_v[0] = lighthalf_v[1] = lighthalf_v[2] = 128;
else
lighthalf_v[0] = lighthalf_v[1] = lighthalf_v[2] = 255;
R_ForceLightUpdate ();
}
SCR_SetUpToDrawConsole ();
V_RenderView ();
@ -1024,7 +1011,7 @@ SCR_UpdateScreen (void)
glDisable (GL_TEXTURE_2D);
Cvar_SetValue (brightness, bound (1, brightness->value, 5));
if (lighthalf) // LordHavoc: render was done at half
if (gl_lightmode->int_val) // LordHavoc: render was done at half
//
// brightness
f = brightness->value * 2;
@ -1046,7 +1033,7 @@ SCR_UpdateScreen (void)
f *= 0.5;
}
glEnd ();
glColor3ubv (lighthalf_v);
glColor3ubv (white_v);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
@ -1060,7 +1047,7 @@ SCR_UpdateScreen (void)
glVertex2f (0, vid.height);
glEnd ();
glColor3ubv (lighthalf_v);
glColor3ubv (white_v);
}
glEnable (GL_TEXTURE_2D);

View file

@ -45,7 +45,6 @@ extern double realtime;
extern model_t *loadmodel;
extern int skytexturenum;
extern qboolean lighthalf;
int solidskytexture;
int alphaskytexture;
@ -260,14 +259,14 @@ R_DrawSky (void)
{
float l = 1 / (256 * brightness->value);
glColor3f (lighthalf_v[0] * l, lighthalf_v[1] * l, lighthalf_v[2] * l);
glColor3f (white_v[0] * l, white_v[1] * l, white_v[2] * l);
if (skyloaded)
R_DrawSkyBox ();
else
R_DrawSkyDome ();
glColor3ubv (lighthalf_v);
glColor3ubv (white_v);
}

View file

@ -662,7 +662,7 @@ R_DrawSkyChain (msurface_t *sky_chain)
msurface_t *sc = sky_chain;
float l = 1 / (256 * brightness->value);
glColor3f (lighthalf_v[0] * l, lighthalf_v[1] * l, lighthalf_v[2] * l);
glColor3f (white_v[0] * l, white_v[1] * l, white_v[2] * l);
if (skyloaded) {
glDepthRange (gldepthmax, gldepthmax);
while (sc) {
@ -710,7 +710,7 @@ R_DrawSkyChain (msurface_t *sky_chain)
sc = sc->texturechain;
}
#endif
glColor3ubv (lighthalf_v);
glColor3ubv (white_v);
#if 0
glDisable (GL_TEXTURE_2D);
sc = sky_chain;
@ -768,7 +768,7 @@ R_DrawSkyChain (msurface_t *sky_chain)
glEnd ();
}
}
glColor3ubv (lighthalf_v);
glColor3ubv (white_v);
glEnable (GL_TEXTURE_2D);
#endif
}