add slopecontrast

same as wall contrast but for slopes
gives slopes a bit more contrast instead of them having the same brightness as everything else
there to clog up the opengl menu even more :p
This commit is contained in:
Alug committed 2023-11-06 01:13:36 +01:00
1 parent 8d80118a72
commit 39964e995d
3 files changed
+61 -8

No files matched your search

+51
View File
@@ -150,6 +150,7 @@ consvar_t cv_grfallbackplayermodel = {"gr_fallbackplayermodel", "Off", CV_SAVE,
consvar_t cv_grshearing = {"gr_shearing", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_grspritebillboarding = {"gr_spritebillboarding", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_grfakecontrast = {"gr_fakecontrast", "Standard", CV_SAVE, grfakecontrast_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_grslopecontrast = {"gr_slopecontrast", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
static void CV_filtermode_ONChange(void)
{
@@ -615,6 +616,50 @@ static FUINT HWR_CalcWallLight(FUINT lightnum, fixed_t v1x, fixed_t v1y, fixed_t
return (FUINT)finallight;
}
static FUINT HWR_CalcSlopeLight(FUINT lightnum, angle_t dir, fixed_t delta)
{
INT16 finallight = lightnum;
if (cv_grfakecontrast.value != 0 && cv_grslopecontrast.value != 0)
{
const UINT8 contrast = 8;
fixed_t extralight = 0;
if (cv_grfakecontrast.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;
}
// ==========================================================================
// Floor and ceiling generation from subsectors
// ==========================================================================
@@ -801,6 +846,11 @@ void HWR_RenderPlane(extrasubsector_t *xsub, boolean isceiling, fixed_t fixedhei
for (i = 0, v3d = planeVerts; i < nrPlaneVerts; i++,v3d++,pv++)
SETUP3DVERT(v3d, pv->x, pv->y);
#ifdef ESLOPE
if (slope)
lightlevel = HWR_CalcSlopeLight(lightlevel, R_PointToAngle2(0, 0, slope->normal.x, slope->normal.y), abs(slope->zdelta));
#endif
HWR_Lighting(&Surf, lightlevel, planecolormap);
if (PolyFlags & (PF_Translucent|PF_Fog))
@@ -6217,6 +6267,7 @@ void HWR_AddCommands(void)
CV_RegisterVar(&cv_grgammagreen);
CV_RegisterVar(&cv_grgammared);
CV_RegisterVar(&cv_grfakecontrast);
CV_RegisterVar(&cv_grslopecontrast);
CV_RegisterVar(&cv_grfovchange);
+1
View File
@@ -177,6 +177,7 @@ extern consvar_t cv_grfovchange;
extern consvar_t cv_grsolvetjoin;
extern consvar_t cv_grspritebillboarding;
extern consvar_t cv_grfakecontrast;
extern consvar_t cv_grslopecontrast;
extern consvar_t cv_grfallbackplayermodel;
extern consvar_t cv_grbatching;
extern consvar_t cv_grrenderdistance;
+9 -8
View File
@@ -1369,16 +1369,17 @@ static menuitem_t OP_OpenGLOptionsMenu[] =
{IT_STRING | IT_CVAR, NULL, "Flashpals in Palette Renderer", &cv_grflashpal, 45},
{IT_STRING | IT_CVAR, NULL, "Min Shader Brightness", &cv_secbright, 55},
{IT_STRING|IT_CVAR, NULL, "Texture Quality", &cv_scr_depth, 75},
{IT_STRING|IT_CVAR, NULL, "Texture Filter", &cv_grfiltermode, 85},
{IT_STRING|IT_CVAR, NULL, "Anisotropic", &cv_granisotropicmode, 95},
{IT_STRING|IT_CVAR, NULL, "Texture Quality", &cv_scr_depth, 70},
{IT_STRING|IT_CVAR, NULL, "Texture Filter", &cv_grfiltermode, 80},
{IT_STRING|IT_CVAR, NULL, "Anisotropic", &cv_granisotropicmode, 90},
{IT_STRING|IT_CVAR, NULL, "Visual Portals", &cv_grportals, 105},
{IT_STRING|IT_CVAR, NULL, "Visual Portals", &cv_grportals, 100},
{IT_STRING|IT_CVAR, NULL, "Wall Contrast Style", &cv_grfakecontrast, 125},
{IT_STRING|IT_CVAR, NULL, "Sprite Billboarding", &cv_grspritebillboarding, 135},
{IT_STRING|IT_CVAR, NULL, "Software Perspective", &cv_grshearing, 145},
{IT_STRING|IT_CVAR, NULL, "Rendering Distance", &cv_grrenderdistance, 155},
{IT_STRING|IT_CVAR, NULL, "Wall Contrast Style", &cv_grfakecontrast, 120},
{IT_STRING|IT_CVAR, NULL, "Slope Contrast", &cv_grslopecontrast, 130},
{IT_STRING|IT_CVAR, NULL, "Sprite Billboarding", &cv_grspritebillboarding, 140},
{IT_STRING|IT_CVAR, NULL, "Software Perspective", &cv_grshearing, 150},
{IT_STRING|IT_CVAR, NULL, "Rendering Distance", &cv_grrenderdistance, 160},
{IT_SUBMENU|IT_STRING, NULL, "Gamma...", &OP_OpenGLColorDef, 170},
};