Revert "- reworked fog uniforms to move the global fog mode setting to the viewpoint buffer."
This reverts commit 8b26b6dd1e.
This was causing problems with light mode 2 because some edge cases were no longer handled properly.
This commit is contained in:
parent
4c13a8df6e
commit
bc1e659c7b
9 changed files with 32 additions and 19 deletions
|
|
@ -119,7 +119,7 @@ bool FRenderState::ApplyShader()
|
|||
static uint64_t firstFrame = 0;
|
||||
// if firstFrame is not yet initialized, initialize it to current time
|
||||
// if we're going to overflow a float (after ~4.6 hours, or 24 bits), re-init to regain precision
|
||||
if ((firstFrame == 0) || (screen->FrameTime - firstFrame >= 1 << 24) || level.ShaderStartTime >= firstFrame)
|
||||
if ((firstFrame == 0) || (screen->FrameTime - firstFrame >= 1<<24) || level.ShaderStartTime >= firstFrame)
|
||||
firstFrame = screen->FrameTime;
|
||||
|
||||
static const float nulvec[] = { 0.f, 0.f, 0.f, 0.f };
|
||||
|
|
@ -133,15 +133,31 @@ bool FRenderState::ApplyShader()
|
|||
activeShader->Bind();
|
||||
}
|
||||
|
||||
int fogset = 0;
|
||||
|
||||
if (mFogEnabled)
|
||||
{
|
||||
if (mFogEnabled == 2)
|
||||
{
|
||||
fogset = -3; // 2D rendering with 'foggy' overlay.
|
||||
}
|
||||
else if ((mFogColor & 0xffffff) == 0)
|
||||
{
|
||||
fogset = gl_fogmode;
|
||||
}
|
||||
else
|
||||
{
|
||||
fogset = -gl_fogmode;
|
||||
}
|
||||
}
|
||||
|
||||
glVertexAttrib4fv(VATTR_COLOR, mColor.vec);
|
||||
glVertexAttrib4fv(VATTR_NORMAL, mNormal.vec);
|
||||
|
||||
activeShader->muDesaturation.Set(mDesaturation / 255.f);
|
||||
activeShader->muFogEnabled.Set(fogset);
|
||||
activeShader->muTextureMode.Set(mTextureMode == TM_MODULATE && mTempTM == TM_OPAQUE ? TM_OPAQUE : mTextureMode);
|
||||
float fds = mLightParms[2];
|
||||
if (!mFogEnabled) mLightParms[2] = 0;
|
||||
activeShader->muLightParms.Set(mLightParms);
|
||||
mLightParms[2] = fds;
|
||||
activeShader->muFogColor.Set(mFogColor);
|
||||
activeShader->muObjectColor.Set(mObjectColor);
|
||||
activeShader->muObjectColor2.Set(mObjectColor2);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue