- added the missing handling for the basepal tinting.

This commit is contained in:
Christoph Oelckers 2020-02-11 20:55:47 +01:00
parent 56092759ff
commit 286d53d3bf
7 changed files with 17 additions and 7 deletions

View file

@ -3482,6 +3482,7 @@ void viewDrawScreen(bool sceneonly)
} }
#endif #endif
PspTwoDSetter p2set;
if (gViewPos == 0) if (gViewPos == 0)
{ {
if (cl_crosshair) if (cl_crosshair)
@ -3533,6 +3534,7 @@ void viewDrawScreen(bool sceneonly)
rotatesprite(0, 200 << 16, 65536, 0, 2358, 0, 0, 256 + 22, gViewX0, gViewY0, gViewX1, gViewY1); rotatesprite(0, 200 << 16, 65536, 0, 2358, 0, 0, 256 + 22, gViewX0, gViewY0, gViewX1, gViewY1);
rotatesprite(320 << 16, 200 << 16, 65536, 1024, 2358, 0, 0, 512 + 18, gViewX0, gViewY0, gViewX1, gViewY1); rotatesprite(320 << 16, 200 << 16, 65536, 1024, 2358, 0, 0, 512 + 18, gViewX0, gViewY0, gViewX1, gViewY1);
} }
p2set.clear();
if (v4 && gNetPlayers > 1) if (v4 && gNetPlayers > 1)
{ {
DoLensEffect(); DoLensEffect();

View file

@ -3166,12 +3166,6 @@ void polymost_drawrooms()
{ {
if (videoGetRenderMode() == REND_CLASSIC) return; if (videoGetRenderMode() == REND_CLASSIC) return;
// This is a global setting for the entire scene, so let's do it here, right at the start.
auto& hh = hictinting[MAXPALOOKUPS - 1];
// This sets a tinting color for global palettes, e.g. water or slime - only used for hires replacements (also an option for low-resource hardware where duplicating the textures may be problematic.)
GLInterface.SetBasepalTint(hh.tint);
polymost_outputGLDebugMessage(3, "polymost_drawrooms()"); polymost_outputGLDebugMessage(3, "polymost_drawrooms()");
videoBeginDrawing(); videoBeginDrawing();

View file

@ -144,6 +144,7 @@ bool PolymostShader::Load(const char * name, const char * vert_prog, const char
Brightness.Init(hShader, "u_brightness"); Brightness.Init(hShader, "u_brightness");
FogColor.Init(hShader, "u_fogColor"); FogColor.Init(hShader, "u_fogColor");
AlphaThreshold.Init(hShader, "u_alphaThreshold"); AlphaThreshold.Init(hShader, "u_alphaThreshold");
FullscreenTint.Init(hShader, "u_fullscreenTint");
TintModulate.Init(hShader, "u_tintModulate"); TintModulate.Init(hShader, "u_tintModulate");
TintOverlay.Init(hShader, "u_tintOverlay"); TintOverlay.Init(hShader, "u_tintOverlay");
TintFlags.Init(hShader, "u_tintFlags"); TintFlags.Init(hShader, "u_tintFlags");

View file

@ -45,6 +45,7 @@ public:
FBufferedUniform1f Brightness; FBufferedUniform1f Brightness;
FBufferedUniform1f AlphaThreshold; FBufferedUniform1f AlphaThreshold;
FBufferedUniformPalEntry FogColor; FBufferedUniformPalEntry FogColor;
FBufferedUniformPalEntry FullscreenTint;
FBufferedUniformPalEntry TintModulate; FBufferedUniformPalEntry TintModulate;
FBufferedUniformPalEntry TintOverlay; FBufferedUniformPalEntry TintOverlay;
FBufferedUniform1i TintFlags; FBufferedUniform1i TintFlags;

View file

@ -165,12 +165,21 @@ bool GLInstance::SetTextureInternal(int picnum, FTexture* tex, int palette, int
int lookuppal = 0; int lookuppal = 0;
VSMatrix texmat; VSMatrix texmat;
GLInterface.SetBasepalTint(0xffffff);
auto& h = hictinting[palette]; auto& h = hictinting[palette];
bool applytint = false; bool applytint = false;
auto rep = (hw_hightile && !(h.f & HICTINT_ALWAYSUSEART)) ? tex->FindReplacement(palette) : nullptr; auto rep = (hw_hightile && !(h.f & HICTINT_ALWAYSUSEART)) ? tex->FindReplacement(palette) : nullptr;
if (rep) if (rep)
{ {
// Hightile replacements have only one texture representation and it is always the base. if (usepalette != 0)
{
// This is a global setting for the entire scene, so let's do it here, right at the start. (Fixme: Store this in a static table instead of reusing the same entry for all palettes.)
auto& hh = hictinting[MAXPALOOKUPS - 1];
// This sets a tinting color for global palettes, e.g. water or slime - only used for hires replacements (also an option for low-resource hardware where duplicating the textures may be problematic.)
GLInterface.SetBasepalTint(hh.tint);
}
tex = rep->faces[0]; tex = rep->faces[0];
TextureType = TT_HICREPLACE; TextureType = TT_HICREPLACE;
if (rep->palnum != palette || (h.f & HICTINT_APPLYOVERALTPAL)) applytint = true; if (rep->palnum != palette || (h.f & HICTINT_APPLYOVERALTPAL)) applytint = true;

View file

@ -473,6 +473,7 @@ void PolymostRenderState::Apply(PolymostShader* shader, GLState &oldState)
shader->TintFlags.Set(hictint_flags); shader->TintFlags.Set(hictint_flags);
shader->TintModulate.Set(hictint); shader->TintModulate.Set(hictint);
shader->TintOverlay.Set(hictint_overlay); shader->TintOverlay.Set(hictint_overlay);
shader->FullscreenTint.Set(fullscreenTint);
if (matrixIndex[Matrix_View] != -1) if (matrixIndex[Matrix_View] != -1)
shader->RotMatrix.Set(matrixArray[matrixIndex[Matrix_View]].get()); shader->RotMatrix.Set(matrixArray[matrixIndex[Matrix_View]].get());
if (matrixIndex[Matrix_Projection] != -1) if (matrixIndex[Matrix_Projection] != -1)

View file

@ -38,6 +38,7 @@ uniform float u_alphaThreshold;
uniform vec4 u_tintOverlay, u_tintModulate; uniform vec4 u_tintOverlay, u_tintModulate;
uniform int u_tintFlags; uniform int u_tintFlags;
uniform vec4 u_fullscreenTint;
uniform float u_npotEmulationFactor; uniform float u_npotEmulationFactor;
uniform float u_npotEmulationXOffset; uniform float u_npotEmulationXOffset;
@ -243,6 +244,7 @@ void main()
} }
color.rgb = pow(color.rgb, vec3(u_brightness)); color.rgb = pow(color.rgb, vec3(u_brightness));
color.rgb *= u_fullscreenTint.rgb; // must be the last thing to be done.
fragColor = color; fragColor = color;
fragFog = vec4(0.0, 0.0, 0.0, 1.0); // Does build have colored fog? fragFog = vec4(0.0, 0.0, 0.0, 1.0); // Does build have colored fog?
vec3 normal = normalize(cross(dFdx(v_eyeCoordPosition.xyz), dFdy(v_eyeCoordPosition.xyz))); vec3 normal = normalize(cross(dFdx(v_eyeCoordPosition.xyz), dFdy(v_eyeCoordPosition.xyz)));