mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-18 06:51:47 +00:00
lighthalf and gl_lightmode, meet Mr. Chainsaw, he will be your playmate today.
This commit is contained in:
parent
18fd21da77
commit
f988572c4d
13 changed files with 23 additions and 148 deletions
|
@ -141,7 +141,6 @@ extern cvar_t *gl_sky_divide;
|
|||
|
||||
extern int mirrortexturenum; // quake texturenum, not gltexturenum
|
||||
extern qboolean mirror;
|
||||
extern qboolean lighthalf;
|
||||
extern mplane_t *mirror_plane;
|
||||
extern int gl_lightmap_format;
|
||||
extern int gl_solid_format;
|
||||
|
|
|
@ -22,7 +22,6 @@ extern cvar_t *gl_fires;
|
|||
extern cvar_t *gl_keeptjunctions;
|
||||
extern cvar_t *gl_lerp_anim;
|
||||
extern cvar_t *gl_lightmap_components;
|
||||
extern cvar_t *gl_lightmode;
|
||||
extern cvar_t *gl_max_size;
|
||||
extern cvar_t *gl_nocolors;
|
||||
extern cvar_t *gl_picmip;
|
||||
|
|
|
@ -256,12 +256,6 @@ Draw_Init (void)
|
|||
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &texSize);
|
||||
Cvar_Set (gl_max_size, va("%d", texSize));
|
||||
|
||||
// LordHavoc: 3DFX's dithering has terrible artifacts with lightmode 1
|
||||
if (strstr (gl_renderer, "3dfx") || strstr (gl_renderer, "Mesa Glide"))
|
||||
{
|
||||
Cvar_Set (gl_lightmode, "0");
|
||||
}
|
||||
|
||||
Cmd_AddCommand ("gl_texturemode", &GL_TextureMode_f, "Texture mipmap quality.");
|
||||
|
||||
// load the console background and the charset
|
||||
|
@ -380,12 +374,7 @@ Draw_Crosshair (int swap)
|
|||
y = scr_vrect.y + scr_vrect.height / 2 - 3 + cl_crossy->int_val;
|
||||
|
||||
pColor = (unsigned char *) &d_8to24table[crosshaircolor->int_val];
|
||||
if (lighthalf)
|
||||
glColor4ub ((byte) ((int) pColor[0] >> 1),
|
||||
(byte) ((int) pColor[1] >> 1),
|
||||
(byte) ((int) pColor[2] >> 1), pColor[3]);
|
||||
else
|
||||
glColor4ubv (pColor);
|
||||
glColor4ubv (pColor);
|
||||
glBindTexture (GL_TEXTURE_2D, cs_texture);
|
||||
|
||||
glBegin (GL_QUADS);
|
||||
|
@ -444,10 +433,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)
|
||||
glColor3f (0.4, 0.4, 0.4);
|
||||
else
|
||||
glColor3f (0.8, 0.8, 0.8);
|
||||
glColor3f (0.8, 0.8, 0.8);
|
||||
glBindTexture (GL_TEXTURE_2D, gl->texnum);
|
||||
glBegin (GL_QUADS);
|
||||
glTexCoord2f (newsl, newtl);
|
||||
|
@ -498,10 +484,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)
|
||||
glColor3f (0.4, 0.4, 0.4);
|
||||
else
|
||||
glColor3f (0.8, 0.8, 0.8);
|
||||
glColor3f (0.8, 0.8, 0.8);
|
||||
glBegin (GL_QUADS);
|
||||
glTexCoord2f (0, 0);
|
||||
glVertex2f (x, y);
|
||||
|
@ -566,10 +549,7 @@ Draw_ConsoleBackground (int lines)
|
|||
alpha = (float) (gl_conalpha->value * lines) / y;
|
||||
}
|
||||
|
||||
if (lighthalf)
|
||||
glColor4f (0.4, 0.4, 0.4, alpha);
|
||||
else
|
||||
glColor4f (0.8, 0.8, 0.8, alpha);
|
||||
glColor4f (0.8, 0.8, 0.8, alpha);
|
||||
|
||||
// draw the console texture
|
||||
glBindTexture (GL_TEXTURE_2D, gl->texnum);
|
||||
|
@ -586,10 +566,7 @@ Draw_ConsoleBackground (int lines)
|
|||
|
||||
// turn off alpha blending
|
||||
if (alpha < 1.0) {
|
||||
if (lighthalf)
|
||||
glColor3f (0.4, 0.4, 0.4);
|
||||
else
|
||||
glColor3f (0.8, 0.8, 0.8);
|
||||
glColor3f (0.8, 0.8, 0.8);
|
||||
}
|
||||
|
||||
if (gl_conspin->value) {
|
||||
|
@ -613,10 +590,7 @@ Draw_ConsoleBackground (int lines)
|
|||
void
|
||||
Draw_TileClear (int x, int y, int w, int h)
|
||||
{
|
||||
if (lighthalf)
|
||||
glColor3f (0.4, 0.4, 0.4);
|
||||
else
|
||||
glColor3f (0.8, 0.8, 0.8);
|
||||
glColor3f (0.8, 0.8, 0.8);
|
||||
glBindTexture (GL_TEXTURE_2D, *(int *) draw_backtile->data);
|
||||
glBegin (GL_QUADS);
|
||||
glTexCoord2f (x / 64.0, y / 64.0);
|
||||
|
@ -641,12 +615,8 @@ void
|
|||
Draw_Fill (int x, int y, int w, int h, int c)
|
||||
{
|
||||
glDisable (GL_TEXTURE_2D);
|
||||
if (lighthalf)
|
||||
glColor3f (vid_basepal[c * 3] / 510.0, vid_basepal[c * 3 + 1] / 510.0,
|
||||
vid_basepal[c * 3 + 2] / 510.0);
|
||||
else
|
||||
glColor3f (vid_basepal[c * 3] / 255.0, vid_basepal[c * 3 + 1] / 255.0,
|
||||
vid_basepal[c * 3 + 2] / 255.0);
|
||||
glColor3f (vid_basepal[c * 3] / 255.0, vid_basepal[c * 3 + 1] / 255.0,
|
||||
vid_basepal[c * 3 + 2] / 255.0);
|
||||
|
||||
glBegin (GL_QUADS);
|
||||
|
||||
|
|
|
@ -150,10 +150,7 @@ R_DrawFire (fire_t *f)
|
|||
}
|
||||
// we're not - draw it
|
||||
glBegin (GL_TRIANGLE_FAN);
|
||||
if (lighthalf)
|
||||
glColor3f (f->color[0] * 0.5, f->color[1] * 0.5, f->color[2] * 0.5);
|
||||
else
|
||||
glColor3fv (f->color);
|
||||
glColor3fv (f->color);
|
||||
for (i = 0; i < 3; i++)
|
||||
vec[i] = f->origin[i] - vpn[i] * radius;
|
||||
glVertex3fv (vec);
|
||||
|
|
|
@ -54,8 +54,6 @@
|
|||
static particle_t *particles, **freeparticles;
|
||||
static short r_numparticles, numparticles;
|
||||
|
||||
extern qboolean lighthalf;
|
||||
|
||||
extern cvar_t *cl_max_particles;
|
||||
|
||||
extern int part_tex_dot;
|
||||
|
@ -619,15 +617,9 @@ R_DrawParticles (void)
|
|||
memcpy(right, part->right, sizeof(right));
|
||||
}
|
||||
|
||||
if (lighthalf) {
|
||||
varray[0].color[0] = (float) ((int) at[0] >> 1) / 255;
|
||||
varray[0].color[1] = (float) ((int) at[1] >> 1) / 255;
|
||||
varray[0].color[2] = (float) ((int) at[2] >> 1) / 255;
|
||||
} else {
|
||||
varray[0].color[0] = (float) at[0] / 255;
|
||||
varray[0].color[1] = (float) at[1] / 255;
|
||||
varray[0].color[2] = (float) at[2] / 255;
|
||||
}
|
||||
varray[0].color[0] = (float) at[0] / 255;
|
||||
varray[0].color[1] = (float) at[1] / 255;
|
||||
varray[0].color[2] = (float) at[2] / 255;
|
||||
varray[0].color[3] = (float) alpha / 255;
|
||||
|
||||
memcpy(varray[1].color, varray[0].color, sizeof(varray[0].color));
|
||||
|
|
|
@ -47,7 +47,6 @@
|
|||
#include "r_cvar.h"
|
||||
|
||||
extern byte *draw_chars; // 8*8 graphic characters
|
||||
extern qboolean lighthalf;
|
||||
|
||||
extern cvar_t *r_netgraph;
|
||||
extern cvar_t *r_netgraph_alpha;
|
||||
|
|
|
@ -126,11 +126,7 @@ R_RenderDlight (dlight_t *light)
|
|||
|
||||
glBegin (GL_TRIANGLE_FAN);
|
||||
|
||||
if (lighthalf)
|
||||
glColor3f (light->color[0] * 0.5, light->color[1] * 0.5,
|
||||
light->color[2] * 0.5);
|
||||
else
|
||||
glColor3fv (light->color);
|
||||
glColor3fv (light->color);
|
||||
|
||||
VectorSubtract (r_origin, light->origin, v);
|
||||
VectorNormalize (v);
|
||||
|
|
|
@ -99,8 +99,6 @@ void R_MarkLeaves (void);
|
|||
|
||||
extern cvar_t *scr_fov;
|
||||
|
||||
extern qboolean lighthalf;
|
||||
|
||||
|
||||
// LordHavoc: place for gl_rmain setup code
|
||||
void
|
||||
|
@ -261,10 +259,7 @@ GL_DrawAliasFrame (aliashdr_t *paliashdr, int posenum, qboolean fb)
|
|||
glDepthMask (GL_FALSE);
|
||||
|
||||
if (fb) {
|
||||
if (lighthalf)
|
||||
glColor4f (0.5, 0.5, 0.5, modelalpha);
|
||||
else
|
||||
glColor4f (1, 1, 1, modelalpha);
|
||||
glColor4f (1, 1, 1, modelalpha);
|
||||
}
|
||||
|
||||
while ((count = *order++)) {
|
||||
|
@ -334,10 +329,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)
|
||||
glColor4f (0.5, 0.5, 0.5, modelalpha);
|
||||
else
|
||||
glColor4f (1, 1, 1, modelalpha);
|
||||
glColor4f (1, 1, 1, modelalpha);
|
||||
}
|
||||
|
||||
lerp = 1 - blend;
|
||||
|
@ -613,14 +605,9 @@ R_DrawAliasModel (entity_t *e)
|
|||
|
||||
// FIXME: shadecolor is supposed to be the lighting for the model, not
|
||||
// just colormod
|
||||
shadecolor[0] = currententity->colormod[0];
|
||||
shadecolor[1] = currententity->colormod[1];
|
||||
shadecolor[2] = currententity->colormod[2];
|
||||
if (!lighthalf) {
|
||||
shadecolor[0] *= 2.0;
|
||||
shadecolor[1] *= 2.0;
|
||||
shadecolor[2] *= 2.0;
|
||||
}
|
||||
shadecolor[0] = currententity->colormod[0] * 2.0;
|
||||
shadecolor[1] = currententity->colormod[1] * 2.0;
|
||||
shadecolor[2] = currententity->colormod[2] * 2.0;
|
||||
|
||||
VectorCopy (currententity->origin, r_entorigin);
|
||||
VectorSubtract (r_origin, r_entorigin, modelorg);
|
||||
|
|
|
@ -87,8 +87,6 @@ byte *lightmaps[MAX_LIGHTMAPS];
|
|||
msurface_t *waterchain = NULL;
|
||||
msurface_t *sky_chain;
|
||||
|
||||
extern qboolean lighthalf;
|
||||
|
||||
|
||||
// LordHavoc: place for gl_rsurf setup code
|
||||
void
|
||||
|
@ -270,7 +268,7 @@ R_BuildLightMap (msurface_t *surf, byte * dest, int stride)
|
|||
stride -= smax * lightmap_bytes;
|
||||
bl = blocklights;
|
||||
|
||||
if (gl_mtex_active && !lighthalf) {
|
||||
if (gl_mtex_active) {
|
||||
shift = 7; // 0-1 lightmap range.
|
||||
} else {
|
||||
shift = 8; // 0-2 lightmap range.
|
||||
|
@ -452,10 +450,7 @@ R_BlendLightmaps (void)
|
|||
|
||||
glDepthMask (GL_FALSE); // don't bother writing Z
|
||||
|
||||
if (lighthalf)
|
||||
glBlendFunc (GL_ZERO, GL_SRC_COLOR);
|
||||
else
|
||||
glBlendFunc (GL_DST_COLOR, GL_SRC_COLOR);
|
||||
glBlendFunc (GL_DST_COLOR, GL_SRC_COLOR);
|
||||
|
||||
glColor3f (1, 1, 1);
|
||||
|
||||
|
@ -594,11 +589,7 @@ GL_WaterSurface (msurface_t *s)
|
|||
glBindTexture (GL_TEXTURE_2D, i);
|
||||
if (r_wateralpha->value < 1.0) {
|
||||
glDepthMask (GL_FALSE);
|
||||
if (lighthalf) {
|
||||
glColor4f (0.5, 0.5, 0.5, r_wateralpha->value);
|
||||
} else {
|
||||
glColor4f (1, 1, 1, r_wateralpha->value);
|
||||
}
|
||||
glColor4f (1, 1, 1, r_wateralpha->value);
|
||||
EmitWaterPolys (s);
|
||||
glColor3ubv (lighthalf_v);
|
||||
glDepthMask (GL_TRUE);
|
||||
|
@ -621,11 +612,7 @@ R_DrawWaterSurfaces (void)
|
|||
|
||||
if (r_wateralpha->value < 1.0) {
|
||||
glDepthMask (GL_FALSE);
|
||||
if (lighthalf) {
|
||||
glColor4f (0.5, 0.5, 0.5, r_wateralpha->value);
|
||||
} else {
|
||||
glColor4f (1, 1, 1, r_wateralpha->value);
|
||||
}
|
||||
glColor4f (1, 1, 1, r_wateralpha->value);
|
||||
}
|
||||
|
||||
i = -1;
|
||||
|
|
|
@ -803,9 +803,6 @@ SCR_TileClear (void)
|
|||
extern void R_ForceLightUpdate (void);
|
||||
|
||||
int oldviewsize = 0;
|
||||
unsigned char lighthalf_v[3];
|
||||
qboolean lighthalf;
|
||||
extern cvar_t *gl_lightmode;
|
||||
|
||||
/*
|
||||
SCR_UpdateScreen
|
||||
|
@ -820,7 +817,6 @@ void
|
|||
SCR_UpdateScreen (double realtime, SCR_Func *scr_funcs, int swap)
|
||||
{
|
||||
double time1 = 0, time2;
|
||||
float f;
|
||||
|
||||
if (block_drawing)
|
||||
return;
|
||||
|
@ -891,31 +887,6 @@ SCR_UpdateScreen (double realtime, SCR_Func *scr_funcs, int swap)
|
|||
// also makes polyblend apply to whole screen
|
||||
glDisable (GL_TEXTURE_2D);
|
||||
|
||||
if (lighthalf) { // LordHavoc: render was done at half brightness
|
||||
f = 2;
|
||||
} else {
|
||||
f = 1;
|
||||
}
|
||||
|
||||
if (f >= 1.002) { // Make sure we don't get bit by roundoff errors
|
||||
glBlendFunc (GL_DST_COLOR, GL_ONE);
|
||||
glBegin (GL_QUADS);
|
||||
while (f >= 1.002) { // precision
|
||||
if (f >= 2)
|
||||
glColor3f (1, 1, 1);
|
||||
else
|
||||
glColor3f (f - 1, f - 1, f - 1);
|
||||
glVertex2f (0, 0);
|
||||
glVertex2f (vid.width, 0);
|
||||
glVertex2f (vid.width, vid.height);
|
||||
glVertex2f (0, vid.height);
|
||||
f *= 0.5;
|
||||
}
|
||||
glEnd ();
|
||||
glColor3ubv (lighthalf_v);
|
||||
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
|
||||
if (v_blend[3]) {
|
||||
glBegin (GL_QUADS);
|
||||
|
||||
|
|
|
@ -50,7 +50,6 @@
|
|||
extern model_t *loadmodel;
|
||||
|
||||
extern int skytexturenum;
|
||||
extern qboolean lighthalf;
|
||||
|
||||
int solidskytexture;
|
||||
int alphaskytexture;
|
||||
|
|
|
@ -38,8 +38,6 @@
|
|||
|
||||
extern model_t *loadmodel;
|
||||
|
||||
extern qboolean lighthalf;
|
||||
|
||||
msurface_t *warpface;
|
||||
|
||||
extern cvar_t *gl_subdivide_size;
|
||||
|
|
|
@ -27,7 +27,6 @@ cvar_t *gl_fires;
|
|||
cvar_t *gl_keeptjunctions;
|
||||
cvar_t *gl_lerp_anim;
|
||||
cvar_t *gl_lightmap_components;
|
||||
cvar_t *gl_lightmode;
|
||||
cvar_t *gl_max_size;
|
||||
cvar_t *gl_nocolors;
|
||||
cvar_t *gl_picmip;
|
||||
|
@ -81,22 +80,7 @@ cvar_t *scr_showram;
|
|||
cvar_t *scr_showturtle;
|
||||
cvar_t *scr_viewsize;
|
||||
|
||||
unsigned char lighthalf_v[3];
|
||||
qboolean lighthalf;
|
||||
|
||||
void
|
||||
gl_lightmode_callback (cvar_t *cvar)
|
||||
{
|
||||
if (cvar->int_val) {
|
||||
lighthalf_v[0] = lighthalf_v[1] = lighthalf_v[2] = 128;
|
||||
lighthalf = 1;
|
||||
} else {
|
||||
lighthalf_v[0] = lighthalf_v[1] = lighthalf_v[2] = 255;
|
||||
lighthalf = 0;
|
||||
}
|
||||
|
||||
R_ForceLightUpdate ();
|
||||
}
|
||||
unsigned char lighthalf_v[3] = {255, 255, 255};
|
||||
|
||||
void
|
||||
R_Init_Cvars (void)
|
||||
|
@ -150,9 +134,6 @@ R_Init_Cvars (void)
|
|||
gl_lightmap_components = Cvar_Get ("gl_lightmap_components", "4", CVAR_ROM,
|
||||
NULL, "Lightmap texture components. 1 "
|
||||
"is greyscale, 3 is RGB, 4 is RGBA.");
|
||||
gl_lightmode = Cvar_Get ("gl_lightmode", "0", CVAR_ARCHIVE,
|
||||
gl_lightmode_callback, "Lighting mode (0 = "
|
||||
"GLQuake style, 1 = new style)");
|
||||
gl_max_size = Cvar_Get ("gl_max_size", "1024", CVAR_NONE, NULL,
|
||||
"Texture dimension");
|
||||
gl_nocolors = Cvar_Get ("gl_nocolors", "0", CVAR_NONE, NULL,
|
||||
|
|
Loading…
Reference in a new issue