mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-23 04:22:34 +00:00
- fixed: Desaturation factor was applied incorrectly.
- Also fixed some very strange thing in the shader's desaturate function. For unknown reasons using the 'mix' function there did not work. - fixed: The fog boundary special shader could not be used.
This commit is contained in:
parent
0cf37f2e51
commit
54425ee2ef
2 changed files with 9 additions and 4 deletions
|
@ -125,7 +125,7 @@ bool FRenderState::ApplyShader()
|
|||
if (gl.hasGLSL())
|
||||
{
|
||||
FShader *activeShader;
|
||||
if (mSpecialEffect > 0)
|
||||
if (mSpecialEffect > EFF_NONE)
|
||||
{
|
||||
activeShader = GLRenderer->mShaderManager->BindEffect(mSpecialEffect);
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ bool FRenderState::ApplyShader()
|
|||
|
||||
glColor4fv(mColor.vec);
|
||||
|
||||
activeShader->muDesaturation.Set(mDesaturation);
|
||||
activeShader->muDesaturation.Set(mDesaturation / 255.f);
|
||||
activeShader->muFogEnabled.Set(fogset);
|
||||
activeShader->muTextureMode.Set(mTextureMode);
|
||||
activeShader->muCameraPos.Set(mCameraPos.vec);
|
||||
|
|
|
@ -31,8 +31,13 @@ vec4 desaturate(vec4 texel)
|
|||
{
|
||||
if (uDesaturationFactor > 0.0)
|
||||
{
|
||||
float gray = (texel.r * 0.3 + texel.g * 0.56 + texel.b * 0.14);
|
||||
return mix (vec4(gray,gray,gray,texel.a), texel, uDesaturationFactor);
|
||||
float gray = (texel.r * 0.3 + texel.g * 0.56 + texel.b * 0.14) * uDesaturationFactor;
|
||||
|
||||
vec4 desaturated = vec4(gray,gray,gray,texel.a);
|
||||
// I have absolutely no idea why this works and 'mix' doesn't...
|
||||
texel *= (1.0-uDesaturationFactor);
|
||||
return texel + desaturated;
|
||||
//return mix (desaturated, texel, uDesaturationFactor);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue