mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-24 02:01:17 +00:00
Revert "Remove OpenGL-only fake contrast cvars"
This reverts commit 64aefe7322
.
This commit is contained in:
parent
4378b29627
commit
b58ad6492b
2 changed files with 86 additions and 7 deletions
|
@ -226,17 +226,87 @@ 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) // TODO: improve "fake contrast" system
|
||||
static FUINT HWR_CalcWallLight(FUINT lightnum, fixed_t v1x, fixed_t v1y, fixed_t v2x, fixed_t v2y)
|
||||
{
|
||||
INT16 finallight = lightnum;
|
||||
const UINT8 contrast = 8;
|
||||
|
||||
if (v1y == v2y)
|
||||
finallight -= contrast;
|
||||
else if (v1x == v2x)
|
||||
finallight += contrast;
|
||||
if (cv_glfakecontrast.value != 0)
|
||||
{
|
||||
const UINT8 contrast = 8;
|
||||
fixed_t extralight = 0;
|
||||
|
||||
return (FUINT)max(0, min(255, finallight));
|
||||
if (cv_glfakecontrast.value == 2) // Smooth setting
|
||||
{
|
||||
extralight = (-(contrast<<FRACBITS) +
|
||||
FixedDiv(AngleFixed(R_PointToAngle2(0, 0,
|
||||
abs(v1x - v2x),
|
||||
abs(v1y - v2y))), 90<<FRACBITS)
|
||||
* (contrast * 2)) >> 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), 180<<FRACBITS));
|
||||
|
||||
extralight = -(contrast<<FRACBITS) + (dirmul * (contrast * 2));
|
||||
|
||||
extralight = FixedMul(extralight, delta*4) >> 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;
|
||||
}
|
||||
|
||||
static UINT8 HWR_SideLightLevel(side_t *side, INT16 base_lightlevel)
|
||||
|
@ -428,6 +498,9 @@ 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))
|
||||
|
@ -5603,6 +5676,7 @@ 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);
|
||||
|
@ -5636,6 +5710,8 @@ 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);
|
||||
|
@ -5717,6 +5793,7 @@ void HWR_AddCommands(void)
|
|||
|
||||
CV_RegisterVar(&cv_glskydome);
|
||||
CV_RegisterVar(&cv_glspritebillboarding);
|
||||
CV_RegisterVar(&cv_glfakecontrast);
|
||||
CV_RegisterVar(&cv_glshearing);
|
||||
CV_RegisterVar(&cv_glshaders);
|
||||
|
||||
|
|
|
@ -91,6 +91,8 @@ 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;
|
||||
|
|
Loading…
Reference in a new issue