- fixed light level setup in palette emulation mode.

This commit is contained in:
Christoph Oelckers 2020-09-13 20:48:54 +02:00
parent 0e58203d92
commit aeeec61f39
2 changed files with 2 additions and 3 deletions

View file

@ -840,8 +840,6 @@ int32_t wallvisible(int32_t const x, int32_t const y, int16_t const wallnum);
#define STATUS2DSIZ 144
#define STATUS2DSIZ2 26
int32_t videoSetRenderMode(int32_t renderer);
#ifdef USE_OPENGL
void renderSetRollAngle(float rolla);
#endif

View file

@ -40,7 +40,8 @@ vec4 ProcessTexel()
float visibility = max(uGlobVis * uLightFactor * z - ((u_flags & RF_ShadeInterpolate) != 0.0? 0.5 : 0.0), 0.0);
float numShades = float(uPalLightLevels & 255);
float shade = clamp((uLightLevel + visibility), 0.0, numShades - 1.0);
float shade = (1.0 - uLightLevel) * (numShades);
shade = clamp((shade + visibility), 0.0, numShades - 1.0);
int palindex = int(color.r * 255.0 + 0.1); // The 0.1 is for roundoff error compensation.
int shadeindex = int(floor(shade));