From 64aefe7322db8b5b181298c44c60527a112e6138 Mon Sep 17 00:00:00 2001 From: spherallic Date: Thu, 4 Jul 2024 12:42:16 +0200 Subject: [PATCH] Remove OpenGL-only fake contrast cvars --- src/hardware/hw_main.c | 91 ++++-------------------------------------- src/hardware/hw_main.h | 2 - 2 files changed, 7 insertions(+), 86 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 36e80f378..599c39132 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -226,87 +226,17 @@ UINT8 HWR_FogBlockAlpha(INT32 light, extracolormap_t *colormap) // Let's see if return surfcolor.s.alpha; } -static FUINT HWR_CalcWallLight(FUINT lightnum, fixed_t v1x, fixed_t v1y, fixed_t v2x, fixed_t v2y) +static FUINT HWR_CalcWallLight(FUINT lightnum, fixed_t v1x, fixed_t v1y, fixed_t v2x, fixed_t v2y) // TODO: improve "fake contrast" system { INT16 finallight = lightnum; + const UINT8 contrast = 8; - if (cv_glfakecontrast.value != 0) - { - const UINT8 contrast = 8; - fixed_t extralight = 0; + if (v1y == v2y) + finallight -= contrast; + else if (v1x == v2x) + finallight += contrast; - if (cv_glfakecontrast.value == 2) // Smooth setting - { - extralight = (-(contrast<> FRACBITS; - } - else - { - if (v1y == v2y) - extralight = -contrast; - else if (v1x == v2x) - extralight = contrast; - } - - if (extralight != 0) - { - finallight += extralight; - - if (finallight < 0) - finallight = 0; - if (finallight > 255) - finallight = 255; - } - } - - return (FUINT)finallight; -} - -static FUINT HWR_CalcSlopeLight(FUINT lightnum, angle_t dir, fixed_t delta) -{ - INT16 finallight = lightnum; - - if (cv_glfakecontrast.value != 0 && cv_glslopecontrast.value != 0) - { - const UINT8 contrast = 8; - fixed_t extralight = 0; - - if (cv_glfakecontrast.value == 2) // Smooth setting - { - fixed_t dirmul = abs(FixedDiv(AngleFixed(dir) - (180<> FRACBITS; - } - else - { - dir = ((dir + ANGLE_45) / ANGLE_90) * ANGLE_90; - - if (dir == ANGLE_180) - extralight = -contrast; - else if (dir == 0) - extralight = contrast; - - if (delta >= FRACUNIT/2) - extralight *= 2; - } - - if (extralight != 0) - { - finallight += extralight; - - if (finallight < 0) - finallight = 0; - if (finallight > 255) - finallight = 255; - } - } - - return (FUINT)finallight; + return (FUINT)max(0, min(255, finallight)); } static UINT8 HWR_SideLightLevel(side_t *side, INT16 base_lightlevel) @@ -498,9 +428,6 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool for (i = 0, v3d = planeVerts; i < (INT32)nrPlaneVerts; i++,v3d++,pv++) SETUP3DVERT(v3d, pv->x, pv->y); - if (slope) - lightlevel = HWR_CalcSlopeLight(lightlevel, R_PointToAngle2(0, 0, slope->normal.x, slope->normal.y), abs(slope->zdelta)); - HWR_Lighting(&Surf, lightlevel, planecolormap); if (PolyFlags & (PF_Translucent|PF_Fog|PF_Additive|PF_Subtractive|PF_ReverseSubtract|PF_Multiplicative|PF_Environment)) @@ -5665,7 +5592,6 @@ void HWR_LoadLevel(void) static CV_PossibleValue_t glshaders_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Ignore custom shaders"}, {0, NULL}}; static CV_PossibleValue_t glmodelinterpolation_cons_t[] = {{0, "Off"}, {1, "Sometimes"}, {2, "Always"}, {0, NULL}}; -static CV_PossibleValue_t glfakecontrast_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Smooth"}, {0, NULL}}; static CV_PossibleValue_t glshearing_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Third-person"}, {0, NULL}}; static void CV_glfiltermode_OnChange(void); @@ -5699,8 +5625,6 @@ consvar_t cv_glmodellighting = CVAR_INIT ("gr_modellighting", "Off", CV_SAVE|CV_ consvar_t cv_glshearing = CVAR_INIT ("gr_shearing", "Off", CV_SAVE, glshearing_cons_t, NULL); consvar_t cv_glspritebillboarding = CVAR_INIT ("gr_spritebillboarding", "Off", CV_SAVE, CV_OnOff, NULL); consvar_t cv_glskydome = CVAR_INIT ("gr_skydome", "On", CV_SAVE, CV_OnOff, NULL); -consvar_t cv_glfakecontrast = CVAR_INIT ("gr_fakecontrast", "Smooth", CV_SAVE, glfakecontrast_cons_t, NULL); -consvar_t cv_glslopecontrast = CVAR_INIT ("gr_slopecontrast", "Off", CV_SAVE, CV_OnOff, NULL); consvar_t cv_glfiltermode = CVAR_INIT ("gr_filtermode", "Nearest", CV_SAVE|CV_CALL, glfiltermode_cons_t, CV_glfiltermode_OnChange); consvar_t cv_glanisotropicmode = CVAR_INIT ("gr_anisotropicmode", "1", CV_SAVE|CV_CALL, glanisotropicmode_cons_t, CV_glanisotropic_OnChange); @@ -5782,7 +5706,6 @@ void HWR_AddCommands(void) CV_RegisterVar(&cv_glskydome); CV_RegisterVar(&cv_glspritebillboarding); - CV_RegisterVar(&cv_glfakecontrast); CV_RegisterVar(&cv_glshearing); CV_RegisterVar(&cv_glshaders); diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index ea610a48b..2492bf6c8 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -91,8 +91,6 @@ extern consvar_t cv_glsolvetjoin; extern consvar_t cv_glshearing; extern consvar_t cv_glspritebillboarding; extern consvar_t cv_glskydome; -extern consvar_t cv_glfakecontrast; -extern consvar_t cv_glslopecontrast; extern consvar_t cv_glbatching; extern consvar_t cv_glpaletterendering; extern consvar_t cv_glpalettedepth;