- fixed: Camera textures must always be drawn with texture mode opaque, because the contents of their alpha channels are undefined.

This commit is contained in:
Christoph Oelckers 2018-03-01 13:52:23 +01:00
parent b39cb4f095
commit 685e5c1e95
4 changed files with 13 additions and 4 deletions

View File

@ -209,9 +209,10 @@ static bool currentModelMatrixState;
void FRenderState::ApplyFixedFunction()
{
if (mTextureMode != ffTextureMode)
int thistm = mTextureMode == TM_MODULATE && mTempTM == TM_OPAQUE ? TM_OPAQUE : mTextureMode;
if (thistm != ffTextureMode)
{
ffTextureMode = mTextureMode;
ffTextureMode = thistm;
if (ffTextureMode == TM_CLAMPY) ffTextureMode = TM_MODULATE; // this cannot be replicated. Too bad if it creates visual artifacts
gl_SetTextureMode(ffTextureMode);
}

View File

@ -405,7 +405,6 @@ void F2DDrawer::Draw()
gl_SetRenderStyle(dt->mRenderStyle, !dt->mMasked, false);
gl_RenderState.SetMaterial(dt->mTexture, CLAMP_XY_NOMIP, dt->mTranslation, -1, dt->mAlphaTexture);
if (dt->mTexture->tex->bHasCanvas) gl_RenderState.SetTextureMode(TM_OPAQUE);
glEnable(GL_SCISSOR_TEST);
glScissor(dt->mScissor[0], dt->mScissor[1], dt->mScissor[2], dt->mScissor[3]);

View File

@ -164,7 +164,7 @@ bool FRenderState::ApplyShader()
activeShader->muFogEnabled.Set(fogset);
activeShader->muPalLightLevels.Set(static_cast<int>(gl_bandedswlight) | (static_cast<int>(gl_fogmode) << 8));
activeShader->muGlobVis.Set(GLRenderer->mGlobVis / 32.0f);
activeShader->muTextureMode.Set(mTextureMode);
activeShader->muTextureMode.Set(mTextureMode == TM_MODULATE && mTempTM == TM_OPAQUE ? TM_OPAQUE : mTextureMode);
activeShader->muCameraPos.Set(mCameraPos.vec);
activeShader->muLightParms.Set(mLightParms);
activeShader->muFogColor.Set(mFogColor);

View File

@ -112,6 +112,7 @@ class FRenderState
int mEffectState;
int mColormapState;
int mTempTM = TM_MODULATE;
float stAlphaThreshold;
int stSrcBlend, stDstBlend;
@ -150,6 +151,14 @@ public:
{
if (mat->tex->UseBasePalette() || gl.legacyMode) translation = TRANSLATION(TRANSLATION_Standard, 8);
}
if (mat->tex->bHasCanvas)
{
mTempTM = TM_OPAQUE;
}
else
{
mTempTM = TM_MODULATE;
}
mEffectState = overrideshader >= 0? overrideshader : mat->mShaderIndex;
mShaderTimer = mat->tex->gl_info.shaderspeed;
mat->Bind(clampmode, translation);