- fixed interpolation of palette emulation.

This commit is contained in:
Christoph Oelckers 2020-09-23 17:22:28 +02:00
parent a6c45a8e52
commit f106f35598
3 changed files with 6 additions and 5 deletions

View file

@ -262,6 +262,7 @@ void PolymostRenderState::Apply(FRenderState& state, GLState& oldState)
FVector4 blendcol(0, 0, 0, 0);
int flags = 0;
if (Flags & RF_ShadeInterpolate) flags |= 16384; // hijack a free bit in here.
if (fullscreenTint != 0xffffff) flags |= 16;
if (hictint_flags != -1)
{
@ -283,8 +284,8 @@ void PolymostRenderState::Apply(FRenderState& state, GLState& oldState)
blendcol = modcol; // WTF???, but the tinting code really uses the same color for both!
flags |= (((hictint_flags & TINTF_BLENDMASK) >> 6) + 1) & TextureManipulation::BlendMask;
}
addcol.W = flags;
}
addcol.W = flags;
state.SetTextureColors(&modcol.X, &addcol.X, &blendcol.X);
if (matrixIndex[Matrix_Model] != -1)

View file

@ -9,7 +9,7 @@ const int RF_ShadeInterpolate = 64;
vec4 ProcessTexel()
{
int u_flags = RF_ShadeInterpolate;
int blendflags = int(uTextureAddColor.a);
float fullbright = 0.0;
vec4 color;
float coordX = vTexCoord.x;
@ -30,7 +30,7 @@ vec4 ProcessTexel()
color = texture(tex, newCoord);
float visibility = max(uGlobVis * uLightFactor * z - ((u_flags & RF_ShadeInterpolate) != 0.0? 0.5 : 0.0), 0.0);
float visibility = max(uGlobVis * uLightFactor * z - ((blendflags & 16384) != 0? 0.5 : 0.0), 0.0);
float numShades = float(uPalLightLevels & 255);
float shade = (1.0 - uLightLevel) * (numShades);
shade = clamp((shade + visibility), 0.0, numShades - 1.0);
@ -41,7 +41,7 @@ vec4 ProcessTexel()
int colorIndex = int(colorIndexF * 255.0 + 0.1); // The 0.1 is for roundoff error compensation.
vec4 palettedColor = texelFetch(texture2, ivec2(colorIndex, 0), 0);
if ((u_flags & RF_ShadeInterpolate) != 0)
if ((blendflags & 16384) != 0)
{
// Get the next shaded palette index for interpolation
colorIndexF = texelFetch(texture3, ivec2(palindex, shadeindex+1), 0).r;

View file

@ -203,7 +203,7 @@ vec4 getTexel(vec2 st)
// Apply the texture modification colors.
int blendflags = int(uTextureAddColor.a); // this alpha is unused otherwise
if (blendflags != 0)
if ((blendflags & 0x3fff) != 0) // keep the upper flags for other things.
{
// only apply the texture manipulation if it contains something.
texel = ApplyTextureManipulation(texel, blendflags);