Slope contrast
Off by default
This commit is contained in:
parent
ef81bf810b
commit
56f96674b0
|
@ -242,6 +242,89 @@ UINT8 HWR_FogBlockAlpha(INT32 light, extracolormap_t *colormap) // Let's see if
|
||||||
return surfcolor.s.alpha;
|
return surfcolor.s.alpha;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static FUINT HWR_CalcWallLight(FUINT lightnum, fixed_t v1x, fixed_t v1y, fixed_t v2x, fixed_t v2y)
|
||||||
|
{
|
||||||
|
INT16 finallight = lightnum;
|
||||||
|
|
||||||
|
if (cv_grfakecontrast.value != 0)
|
||||||
|
{
|
||||||
|
const UINT8 contrast = 8;
|
||||||
|
fixed_t extralight = 0;
|
||||||
|
|
||||||
|
if (cv_grfakecontrast.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_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/CEILING GENERATION FROM SUBSECTORS
|
// FLOOR/CEILING GENERATION FROM SUBSECTORS
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
@ -459,6 +542,11 @@ static void HWR_RenderPlane(extrasubsector_t *xsub, boolean isceiling, fixed_t f
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#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);
|
HWR_Lighting(&Surf, lightlevel, planecolormap);
|
||||||
|
|
||||||
if (PolyFlags & (PF_Translucent|PF_Fog))
|
if (PolyFlags & (PF_Translucent|PF_Fog))
|
||||||
|
@ -682,45 +770,6 @@ static float HWR_ClipViewSegment(INT32 x, polyvertex_t *v1, polyvertex_t *v2)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static FUINT HWR_CalcWallLight(FUINT lightnum, fixed_t v1x, fixed_t v1y, fixed_t v2x, fixed_t v2y)
|
|
||||||
{
|
|
||||||
INT16 finallight = lightnum;
|
|
||||||
|
|
||||||
if (cv_grfakecontrast.value != 0)
|
|
||||||
{
|
|
||||||
const UINT8 contrast = 8;
|
|
||||||
fixed_t extralight = 0;
|
|
||||||
|
|
||||||
if (cv_grfakecontrast.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;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// HWR_SplitWall
|
// HWR_SplitWall
|
||||||
//
|
//
|
||||||
|
@ -6105,6 +6154,7 @@ consvar_t cv_grshearing = {"gr_shearing", "Off", CV_SAVE, CV_OnOff, NULL, 0, NUL
|
||||||
consvar_t cv_grspritebillboarding = {"gr_spritebillboarding", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_grspritebillboarding = {"gr_spritebillboarding", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
consvar_t cv_grskydome = {"gr_skydome", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_grskydome = {"gr_skydome", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
consvar_t cv_grfakecontrast = {"gr_fakecontrast", "Smooth", CV_SAVE, grfakecontrast_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_grfakecontrast = {"gr_fakecontrast", "Smooth", 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};
|
||||||
|
|
||||||
consvar_t cv_grrounddown = {"gr_rounddown", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_grrounddown = {"gr_rounddown", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
consvar_t cv_grfogdensity = {"gr_fogdensity", "150", CV_CALL|CV_NOINIT, CV_Unsigned,
|
consvar_t cv_grfogdensity = {"gr_fogdensity", "150", CV_CALL|CV_NOINIT, CV_Unsigned,
|
||||||
|
|
|
@ -104,6 +104,7 @@ extern consvar_t cv_grshearing;
|
||||||
extern consvar_t cv_grspritebillboarding;
|
extern consvar_t cv_grspritebillboarding;
|
||||||
extern consvar_t cv_grskydome;
|
extern consvar_t cv_grskydome;
|
||||||
extern consvar_t cv_grfakecontrast;
|
extern consvar_t cv_grfakecontrast;
|
||||||
|
extern consvar_t cv_grslopecontrast;
|
||||||
|
|
||||||
extern float gr_viewwidth, gr_viewheight, gr_baseviewwindowy;
|
extern float gr_viewwidth, gr_viewheight, gr_baseviewwindowy;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue