mirror of
https://git.code.sf.net/p/quake/newtree
synced 2024-11-21 19:51:18 +00:00
Gamma cleanups. Software gamma still doesn't work in GL.
This commit is contained in:
parent
72d8bd6af7
commit
bfc25fa462
6 changed files with 20 additions and 53 deletions
|
@ -201,20 +201,3 @@ V_UpdatePalette (void)
|
|||
|
||||
V_CalcBlend ();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
BuildGammaTable
|
||||
|
||||
In software mode, this function gets the palette ready for changing...in
|
||||
in GL, it does very little as you can see.
|
||||
*/
|
||||
void
|
||||
BuildGammaTable (float b, float c)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
gammatable[i] = i;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -80,8 +80,6 @@ extern int in_forward, in_forward2, in_back;
|
|||
frame_t *view_frame;
|
||||
player_state_t *view_message;
|
||||
|
||||
void BuildGammaTable (float, float);
|
||||
|
||||
/*
|
||||
V_CalcRoll
|
||||
*/
|
||||
|
@ -732,8 +730,6 @@ V_Init (void)
|
|||
Cmd_AddCommand ("bf", V_BonusFlash_f, "Background flash, used when you pick up an item");
|
||||
Cmd_AddCommand ("centerview", V_StartPitchDrift, "Centers the player's view ahead after +lookup or +lookdown \n"
|
||||
"Will not work while mlook is active or freelook is 1.");
|
||||
|
||||
BuildGammaTable (1.0, 1.0); // no gamma yet
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -761,7 +757,4 @@ V_Init_Cvars (void)
|
|||
v_kicktime = Cvar_Get ("v_kicktime", "0.5", CVAR_NONE, "How long the kick from an attack lasts");
|
||||
v_kickroll = Cvar_Get ("v_kickroll", "0.6", CVAR_NONE, "How much you lean when hit");
|
||||
v_kickpitch = Cvar_Get ("v_kickpitch", "0.6", CVAR_NONE, "How much you look up when hit");
|
||||
|
||||
brightness = Cvar_Get ("brightness", "1", CVAR_ARCHIVE, "Brightness level");
|
||||
contrast = Cvar_Get ("contrast", "1", CVAR_ARCHIVE, "Contrast level");
|
||||
}
|
||||
|
|
|
@ -137,12 +137,9 @@ V_UpdatePalette (void)
|
|||
basepal += 3;
|
||||
|
||||
for (j = 0; j < NUM_CSHIFTS; j++) {
|
||||
r +=
|
||||
(cl.cshifts[j].percent * (cl.cshifts[j].destcolor[0] - r)) >> 8;
|
||||
g +=
|
||||
(cl.cshifts[j].percent * (cl.cshifts[j].destcolor[1] - g)) >> 8;
|
||||
b +=
|
||||
(cl.cshifts[j].percent * (cl.cshifts[j].destcolor[2] - b)) >> 8;
|
||||
r += (cl.cshifts[j].percent * (cl.cshifts[j].destcolor[0] - r)) >> 8;
|
||||
g += (cl.cshifts[j].percent * (cl.cshifts[j].destcolor[1] - g)) >> 8;
|
||||
b += (cl.cshifts[j].percent * (cl.cshifts[j].destcolor[2] - b)) >> 8;
|
||||
}
|
||||
|
||||
newpal[0] = gammatable[r];
|
||||
|
@ -152,22 +149,3 @@ V_UpdatePalette (void)
|
|||
}
|
||||
VID_ShiftPalette (pal);
|
||||
}
|
||||
|
||||
void
|
||||
BuildGammaTable (float b, float c)
|
||||
{
|
||||
int i, inf;
|
||||
// int p = (int) c;
|
||||
|
||||
if ((b == 1.0) && (c == 1.0)) {
|
||||
for (i = 0; i < 256; i++)
|
||||
gammatable[i] = i;
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < 256; i++) { // weighted average toward the median, 127
|
||||
inf = (i * b); // gamma is brightness now, and positive
|
||||
inf = bound (0, inf, 255);
|
||||
gammatable[i] = inf + (int) ((127 - inf) * (1 - c));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -170,7 +170,6 @@ VID_InitGamma (unsigned char *pal)
|
|||
|
||||
vid_gamma = Cvar_Get ("vid_gamma", va ("%f", gamma), CVAR_ARCHIVE,
|
||||
"Gamma correction");
|
||||
VID_UpdateGamma (vid_gamma);
|
||||
|
||||
VID_BuildGammaTable (vid_gamma->value);
|
||||
VID_UpdateGamma (vid_gamma);
|
||||
}
|
||||
|
|
|
@ -77,12 +77,24 @@ GLenum gl_mtex_enum = GL_TEXTURE0_ARB;
|
|||
|
||||
QF_glColorTableEXT qglColorTableEXT = NULL;
|
||||
qboolean is8bit = false;
|
||||
|
||||
cvar_t *vid_use8bit;
|
||||
cvar_t *brightness;
|
||||
cvar_t *contrast;
|
||||
|
||||
extern int gl_filter_min, gl_filter_max;
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
GL_Common_Init_Cvars (void)
|
||||
{
|
||||
vid_use8bit = Cvar_Get ("vid_use8bit", "0", CVAR_ROM, "Use 8-bit shared palettes.");
|
||||
brightness = Cvar_Get ("brightness", "1", CVAR_ARCHIVE, "Brightness level");
|
||||
contrast = Cvar_Get ("contrast", "1", CVAR_ARCHIVE, "Contrast level");
|
||||
gl_multitexture = Cvar_Get ("gl_multitexture", "0", CVAR_ARCHIVE, "Use multitexture when available");
|
||||
}
|
||||
|
||||
/*
|
||||
CheckMultiTextureExtensions
|
||||
|
||||
|
@ -198,6 +210,8 @@ VID_SetPalette (unsigned char *palette)
|
|||
void
|
||||
GL_Init_Common (void)
|
||||
{
|
||||
GL_Common_Init_Cvars ();
|
||||
|
||||
gl_vendor = glGetString (GL_VENDOR);
|
||||
Con_Printf ("GL_VENDOR: %s\n", gl_vendor);
|
||||
gl_renderer = glGetString (GL_RENDERER);
|
||||
|
|
|
@ -203,7 +203,7 @@ VID_Init (unsigned char *palette)
|
|||
|
||||
GL_Init ();
|
||||
|
||||
GL_CheckBrightness (palette);
|
||||
// GL_CheckBrightness (palette);
|
||||
VID_InitGamma (palette);
|
||||
VID_SetPalette (palette);
|
||||
|
||||
|
|
Loading…
Reference in a new issue