mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 15:22:16 +00:00
- when rendering mirrors, discard subsectors lying behind them.
This commit is contained in:
parent
4b0ce7a8db
commit
3c16a23865
3 changed files with 21 additions and 7 deletions
|
@ -361,11 +361,6 @@ static void DoSubsector(subsector_t * sub)
|
|||
sector_t * fakesector;
|
||||
sector_t fake;
|
||||
|
||||
// check for visibility of this entire subsector. This requires GL nodes.
|
||||
// (disabled because it costs more time than it saves.)
|
||||
//if (!clipper.CheckBox(sub->bbox)) return;
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
if (sub->sector-sectors==931)
|
||||
{
|
||||
|
@ -387,6 +382,14 @@ static void DoSubsector(subsector_t * sub)
|
|||
UnclipSubsector(sub);
|
||||
}
|
||||
|
||||
if (GLRenderer->mCurrentPortal)
|
||||
{
|
||||
int clipres = GLRenderer->mCurrentPortal->ClipSubsector(sub);
|
||||
if (clipres == GLPortal::PClip_InFront) return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
fakesector=gl_FakeFlat(sector, &fake, false);
|
||||
|
||||
if (sector->validcount != validcount)
|
||||
|
|
|
@ -750,7 +750,6 @@ void GLSectorStackPortal::DrawContents()
|
|||
viewx += origin->xDisplacement;
|
||||
viewy += origin->yDisplacement;
|
||||
GLRenderer->mViewActor = NULL;
|
||||
GLRenderer->mCurrentPortal = this;
|
||||
|
||||
|
||||
validcount++;
|
||||
|
@ -937,7 +936,7 @@ void GLMirrorPortal::DrawContents()
|
|||
|
||||
int GLMirrorPortal::ClipSeg(seg_t *seg)
|
||||
{
|
||||
// this seg is completely behind the mirror!
|
||||
// this seg is completely behind the mirror.
|
||||
if (P_PointOnLineSide(seg->v1->x, seg->v1->y, linedef) &&
|
||||
P_PointOnLineSide(seg->v2->x, seg->v2->y, linedef))
|
||||
{
|
||||
|
@ -946,6 +945,16 @@ int GLMirrorPortal::ClipSeg(seg_t *seg)
|
|||
return PClip_Inside;
|
||||
}
|
||||
|
||||
int GLMirrorPortal::ClipSubsector(subsector_t *sub)
|
||||
{
|
||||
// this seg is completely behind the mirror!
|
||||
for(int i=0;i<sub->numlines;i++)
|
||||
{
|
||||
if (P_PointOnLineSide(sub->firstline[i].v1->x, sub->firstline[i].v1->y, linedef) == 0) return PClip_Inside;
|
||||
}
|
||||
return PClip_InFront;
|
||||
}
|
||||
|
||||
int GLMirrorPortal::ClipPoint(fixed_t x, fixed_t y)
|
||||
{
|
||||
if (P_PointOnLineSide(x, y, linedef))
|
||||
|
|
|
@ -160,6 +160,7 @@ public:
|
|||
}
|
||||
|
||||
virtual int ClipSeg(seg_t *seg) { return PClip_Inside; }
|
||||
virtual int ClipSubsector(subsector_t *sub) { return PClip_Inside; }
|
||||
virtual int ClipPoint(fixed_t x, fixed_t y) { return PClip_Inside; }
|
||||
|
||||
static void BeginScene();
|
||||
|
@ -189,6 +190,7 @@ public:
|
|||
|
||||
virtual bool NeedCap() { return false; }
|
||||
virtual int ClipSeg(seg_t *seg);
|
||||
virtual int ClipSubsector(subsector_t *sub);
|
||||
virtual int ClipPoint(fixed_t x, fixed_t y);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue