- 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); FVector4 blendcol(0, 0, 0, 0);
int flags = 0; int flags = 0;
if (Flags & RF_ShadeInterpolate) flags |= 16384; // hijack a free bit in here.
if (fullscreenTint != 0xffffff) flags |= 16; if (fullscreenTint != 0xffffff) flags |= 16;
if (hictint_flags != -1) 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! blendcol = modcol; // WTF???, but the tinting code really uses the same color for both!
flags |= (((hictint_flags & TINTF_BLENDMASK) >> 6) + 1) & TextureManipulation::BlendMask; flags |= (((hictint_flags & TINTF_BLENDMASK) >> 6) + 1) & TextureManipulation::BlendMask;
} }
addcol.W = flags;
} }
addcol.W = flags;
state.SetTextureColors(&modcol.X, &addcol.X, &blendcol.X); state.SetTextureColors(&modcol.X, &addcol.X, &blendcol.X);
if (matrixIndex[Matrix_Model] != -1) if (matrixIndex[Matrix_Model] != -1)

View file

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

View file

@ -203,7 +203,7 @@ vec4 getTexel(vec2 st)
// Apply the texture modification colors. // Apply the texture modification colors.
int blendflags = int(uTextureAddColor.a); // this alpha is unused otherwise 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. // only apply the texture manipulation if it contains something.
texel = ApplyTextureManipulation(texel, blendflags); texel = ApplyTextureManipulation(texel, blendflags);