From 960825287337319bc419685324028b319a47f253 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 15 Feb 2016 13:11:31 +0100 Subject: [PATCH] - copied over some stuff from the abandoned portals branch. --- src/gl/scene/gl_fakeflat.cpp | 2 ++ src/gl/scene/gl_flats.cpp | 22 ++++++++++++++++++---- src/gl/scene/gl_sky.cpp | 20 ++++++++++++-------- src/gl/scene/gl_walls.cpp | 2 +- 4 files changed, 33 insertions(+), 13 deletions(-) diff --git a/src/gl/scene/gl_fakeflat.cpp b/src/gl/scene/gl_fakeflat.cpp index 6ff6bd113..8399526da 100644 --- a/src/gl/scene/gl_fakeflat.cpp +++ b/src/gl/scene/gl_fakeflat.cpp @@ -212,6 +212,8 @@ sector_t * gl_FakeFlat(sector_t * sec, sector_t * dest, area_t in_area, bool bac dest->ceilingplane=sec->floorplane; dest->ceilingplane.FlipVert(); dest->planes[sector_t::ceiling].TexZ = dest->planes[sector_t::floor].TexZ; + dest->portals[sector_t::ceiling] = NULL; + dest->portals[sector_t::floor] = NULL; return dest; } } diff --git a/src/gl/scene/gl_flats.cpp b/src/gl/scene/gl_flats.cpp index c747236d2..104452953 100644 --- a/src/gl/scene/gl_flats.cpp +++ b/src/gl/scene/gl_flats.cpp @@ -525,8 +525,15 @@ void GLFlat::ProcessSector(sector_t * frontsector) Colormap=frontsector->ColorMap; if ((stack = (frontsector->portals[sector_t::floor] != NULL))) { - gl_drawinfo->AddFloorStack(sector); - alpha = frontsector->GetAlpha(sector_t::floor)/65536.0f; + if (!frontsector->PortalBlocksView(sector_t::floor)) + { + gl_drawinfo->AddFloorStack(sector); + alpha = frontsector->GetAlpha(sector_t::floor) / 65536.0f; + } + else + { + alpha = 1.f; + } } else { @@ -576,8 +583,15 @@ void GLFlat::ProcessSector(sector_t * frontsector) Colormap=frontsector->ColorMap; if ((stack = (frontsector->portals[sector_t::ceiling] != NULL))) { - gl_drawinfo->AddCeilingStack(sector); - alpha = frontsector->GetAlpha(sector_t::ceiling)/65536.0f; + if (!frontsector->PortalBlocksView(sector_t::ceiling)) + { + gl_drawinfo->AddCeilingStack(sector); + alpha = frontsector->GetAlpha(sector_t::ceiling) / 65536.0f; + } + else + { + alpha = 1.f; + } } else { diff --git a/src/gl/scene/gl_sky.cpp b/src/gl/scene/gl_sky.cpp index 5a5a10a26..0a26e285d 100644 --- a/src/gl/scene/gl_sky.cpp +++ b/src/gl/scene/gl_sky.cpp @@ -142,6 +142,8 @@ void GLWall::SkyPlane(sector_t *sector, int plane, bool allowreflect) FPortal *portal = sector->portals[plane]; if (portal != NULL) { + if (sector->PortalBlocksView(plane)) return; + if (GLPortal::instack[1 - plane]) return; ptype = PORTALTYPE_SECTORSTACK; this->portal = portal; @@ -302,8 +304,6 @@ void GLWall::SkyTop(seg_t * seg,sector_t * fs,sector_t * bs,vertex_t * v1,vertex } else { - FPortal *pfront = fs->portals[sector_t::ceiling]; - FPortal *pback = bs->portals[sector_t::ceiling]; float frontreflect = fs->GetReflect(sector_t::ceiling); if (frontreflect > 0) { @@ -314,9 +314,12 @@ void GLWall::SkyTop(seg_t * seg,sector_t * fs,sector_t * bs,vertex_t * v1,vertex return; } } - else if (pfront == NULL || pfront == pback) + else { - return; + FPortal *pfront = fs->portals[sector_t::ceiling]; + FPortal *pback = bs->portals[sector_t::ceiling]; + if (pfront == NULL || fs->PortalBlocksView(sector_t::ceiling)) return; + if (pfront == pback && !bs->PortalBlocksView(sector_t::ceiling)) return; } // stacked sectors @@ -378,8 +381,6 @@ void GLWall::SkyBottom(seg_t * seg,sector_t * fs,sector_t * bs,vertex_t * v1,ver } else { - FPortal *pfront = fs->portals[sector_t::floor]; - FPortal *pback = bs->portals[sector_t::floor]; float frontreflect = fs->GetReflect(sector_t::floor); if (frontreflect > 0) { @@ -390,9 +391,12 @@ void GLWall::SkyBottom(seg_t * seg,sector_t * fs,sector_t * bs,vertex_t * v1,ver return; } } - else if (pfront == NULL || pfront == pback) + else { - return; + FPortal *pfront = fs->portals[sector_t::floor]; + FPortal *pback = bs->portals[sector_t::floor]; + if (pfront == NULL || fs->PortalBlocksView(sector_t::floor)) return; + if (pfront == pback && !bs->PortalBlocksView(sector_t::floor)) return; } // stacked sectors diff --git a/src/gl/scene/gl_walls.cpp b/src/gl/scene/gl_walls.cpp index 5d3fe4f37..132745563 100644 --- a/src/gl/scene/gl_walls.cpp +++ b/src/gl/scene/gl_walls.cpp @@ -175,7 +175,7 @@ void GLWall::PutPortal(int ptype) portal = GLPortal::FindPortal(skybox); if (!portal) { - // either a regulat skybox or an Eternity-style horizon + // either a regular skybox or an Eternity-style horizon if (skybox->special1 != SKYBOX_MAP) portal = new GLEEHorizonPortal(skybox); else portal = new GLSkyboxPortal(skybox); }