From eb7955694b2699ef4fbdb5bb4298862d29b9156f Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Sun, 5 Mar 2017 16:57:58 +0100 Subject: [PATCH] Disable diminishing light in software renderer --- src/swrenderer/scene/r_light.cpp | 5 +++++ src/swrenderer/scene/r_light.h | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/swrenderer/scene/r_light.cpp b/src/swrenderer/scene/r_light.cpp index 5be847bf8..fa9ae27f9 100644 --- a/src/swrenderer/scene/r_light.cpp +++ b/src/swrenderer/scene/r_light.cpp @@ -145,6 +145,11 @@ namespace swrenderer FloorVisibility = 160.0 * FloorVisibility / viewport->FocalLengthY; TiltVisibility = float(vis * FocalTangent * (16.f * 320.f) / viewwidth); + + // Disable diminishing light (To do: make a cvar control this) + WallVisibility = 0.0; + FloorVisibility = 0.0; + TiltVisibility = 0.0f; } // Controls how quickly light ramps across a 1/z range. Set this, and it diff --git a/src/swrenderer/scene/r_light.h b/src/swrenderer/scene/r_light.h index fd919fba1..7b127acb2 100644 --- a/src/swrenderer/scene/r_light.h +++ b/src/swrenderer/scene/r_light.h @@ -32,7 +32,10 @@ // Convert a light level into an unbounded colormap index (shade). Result is // fixed point. Why the +12? I wish I knew, but experimentation indicates it // is necessary in order to best reproduce Doom's original lighting. -#define LIGHT2SHADE(l) ((NUMCOLORMAPS*2*FRACUNIT)-(((l)+12)*(FRACUNIT*NUMCOLORMAPS/128))) +//#define LIGHT2SHADE(l) ((NUMCOLORMAPS*2*FRACUNIT)-(((l)+12)*(FRACUNIT*NUMCOLORMAPS/128))) + +// Disable diminishing light (To do: merge with LIGHT2SHADE and let a cvar control it, maybe by converting this to a function, like R_ActualExtraLight) +#define LIGHT2SHADE(lightlev) ((MAX(255 - lightlev, 0) * NUMCOLORMAPS) << (FRACBITS - 8)) // MAXLIGHTSCALE from original DOOM, divided by 2. #define MAXLIGHTVIS (24.0)