- per-sector plane rendering needs to be disabled when processing a line portal with hardware that has no working clip plane support.

In this case there are no means to discard the parts of the rendered sectors that lie behind the portal so it should only render the parts that are flagged as visible.
This commit is contained in:
Christoph Oelckers 2018-05-20 08:56:29 +02:00
parent 1266339c0f
commit 2d4b8549c6
3 changed files with 14 additions and 3 deletions

View file

@ -62,7 +62,7 @@ static void matrixToGL(const VSMatrix &mat, int loc)
void FRenderState::Reset() void FRenderState::Reset()
{ {
mTextureEnabled = true; mTextureEnabled = true;
mClipLineEnabled = mSplitEnabled = mBrightmapEnabled = mFogEnabled = mGlowEnabled = false; mClipLineShouldBeActive = mClipLineEnabled = mSplitEnabled = mBrightmapEnabled = mFogEnabled = mGlowEnabled = false;
mColorMask[0] = mColorMask[1] = mColorMask[2] = mColorMask[3] = true; mColorMask[0] = mColorMask[1] = mColorMask[2] = mColorMask[3] = true;
currentColorMask[0] = currentColorMask[1] = currentColorMask[2] = currentColorMask[3] = true; currentColorMask[0] = currentColorMask[1] = currentColorMask[2] = currentColorMask[3] = true;
mFogColor.d = -1; mFogColor.d = -1;

View file

@ -81,6 +81,7 @@ class FRenderState
bool mGlowEnabled; bool mGlowEnabled;
bool mSplitEnabled; bool mSplitEnabled;
bool mClipLineEnabled; bool mClipLineEnabled;
bool mClipLineShouldBeActive;
bool mBrightmapEnabled; bool mBrightmapEnabled;
bool mColorMask[4]; bool mColorMask[4];
bool currentColorMask[4]; bool currentColorMask[4];
@ -201,6 +202,11 @@ public:
return mClipLineEnabled; return mClipLineEnabled;
} }
bool GetClipLineShouldBeActive()
{
return mClipLineShouldBeActive;
}
void SetClipHeight(float height, float direction); void SetClipHeight(float height, float direction);
void SetNormal(FVector3 norm) void SetNormal(FVector3 norm)
@ -326,6 +332,11 @@ public:
glDisable(GL_CLIP_DISTANCE0); glDisable(GL_CLIP_DISTANCE0);
} }
} }
else
{
// this needs to be flagged because in this case per-sector plane rendering needs to be disabled if a clip plane is active.
mClipLineShouldBeActive = on;
}
} }
void EnableBrightmap(bool on) void EnableBrightmap(bool on)

View file

@ -167,7 +167,7 @@ void FDrawInfo::ProcessLights(GLFlat *flat, bool istrans)
{ {
flat->dynlightindex = GLRenderer->mLights->GetIndexPtr(); flat->dynlightindex = GLRenderer->mLights->GetIndexPtr();
if (flat->sector->ibocount > 0 && !gl_render_subsectors) if (flat->sector->ibocount > 0 && !gl_render_subsectors && !gl_RenderState.GetClipLineShouldBeActive())
{ {
SetupSectorLights(flat, GLPASS_LIGHTSONLY, nullptr); SetupSectorLights(flat, GLPASS_LIGHTSONLY, nullptr);
} }
@ -214,7 +214,7 @@ void FDrawInfo::DrawSubsectors(GLFlat *flat, int pass, bool processlights, bool
if (gl.legacyMode) processlights = false; if (gl.legacyMode) processlights = false;
auto vcount = flat->sector->ibocount; auto vcount = flat->sector->ibocount;
if (vcount > 0 && !gl_render_subsectors) if (vcount > 0 && !gl_render_subsectors && !gl_RenderState.GetClipLineShouldBeActive())
{ {
if (processlights) SetupSectorLights(flat, GLPASS_ALL, &dli); if (processlights) SetupSectorLights(flat, GLPASS_ALL, &dli);
drawcalls.Clock(); drawcalls.Clock();