diff --git a/source/glbackend/glbackend.cpp b/source/glbackend/glbackend.cpp index 6a84e5b7e..2332a67be 100644 --- a/source/glbackend/glbackend.cpp +++ b/source/glbackend/glbackend.cpp @@ -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) diff --git a/wadsrc/static/shaders/glsl/func_paletted.fp b/wadsrc/static/shaders/glsl/func_paletted.fp index 1be496917..a9a4cca86 100644 --- a/wadsrc/static/shaders/glsl/func_paletted.fp +++ b/wadsrc/static/shaders/glsl/func_paletted.fp @@ -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; diff --git a/wadsrc/static/shaders/glsl/main.fp b/wadsrc/static/shaders/glsl/main.fp index 95b01abf2..d12d8affd 100644 --- a/wadsrc/static/shaders/glsl/main.fp +++ b/wadsrc/static/shaders/glsl/main.fp @@ -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);