From 2b27cb0bbaf95d806337f3b95580524e655128f1 Mon Sep 17 00:00:00 2001 From: drfrag Date: Wed, 4 Sep 2019 16:39:51 +0200 Subject: [PATCH] - Fill the gaps with the sky or ceiling texture. --- src/gl/scene/gl_bsp.cpp | 11 +++++++++-- src/gl/scene/gl_wall.h | 2 +- src/gl/scene/gl_walls.cpp | 21 ++++++++++++++++++++- 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/src/gl/scene/gl_bsp.cpp b/src/gl/scene/gl_bsp.cpp index 382fe8496..f8236a2b3 100644 --- a/src/gl/scene/gl_bsp.cpp +++ b/src/gl/scene/gl_bsp.cpp @@ -77,7 +77,7 @@ void GLSceneDrawer::UnclipSubsector(subsector_t *sub) // //========================================================================== -CVAR(Float, gl_line_distance_cull, 0.0, 0 /*CVAR_ARCHIVE|CVAR_GLOBALCONFIG*/) // this is deactivated, for now +CVAR(Float, gl_line_distance_cull, 0.0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) inline bool IsDistanceCulled(seg_t *line) { @@ -138,7 +138,14 @@ void GLSceneDrawer::AddLine (seg_t *seg, bool portalclip) uint8_t ispoly = uint8_t(seg->sidedef->Flags & WALLF_POLYOBJ); - if (IsDistanceCulled(seg)) { clipper.SafeAddClipRange(startAngle, endAngle); return; } + if (IsDistanceCulled(seg)) + { + GLWall wall(this); + wall.sub = currentsubsector; + wall.Process(seg, seg->frontsector, seg->backsector, true); + clipper.SafeAddClipRange(startAngle, endAngle); + return; + } if (!seg->backsector) { diff --git a/src/gl/scene/gl_wall.h b/src/gl/scene/gl_wall.h index 4a4a04023..cdb561c4b 100644 --- a/src/gl/scene/gl_wall.h +++ b/src/gl/scene/gl_wall.h @@ -271,7 +271,7 @@ public: mDrawer = drawer; } - void Process(seg_t *seg, sector_t *frontsector, sector_t *backsector); + void Process(seg_t *seg, sector_t *frontsector, sector_t *backsector, bool isculled = false); void ProcessLowerMiniseg(seg_t *seg, sector_t *frontsector, sector_t *backsector); void Draw(int pass); diff --git a/src/gl/scene/gl_walls.cpp b/src/gl/scene/gl_walls.cpp index 107477d16..6e72c6c32 100644 --- a/src/gl/scene/gl_walls.cpp +++ b/src/gl/scene/gl_walls.cpp @@ -1425,7 +1425,7 @@ void GLWall::DoFFloorBlocks(seg_t * seg, sector_t * frontsector, sector_t * back // // //========================================================================== -void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector) +void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector, bool isculled) { vertex_t * v1, *v2; float fch1; @@ -1556,6 +1556,25 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector) return; } + if (isculled) + { + if (frontsector->GetTexture(sector_t::ceiling) == skyflatnum) + { + SkyNormal(frontsector, v1, v2); + } + else + { + gltexture = FMaterial::ValidateTexture(frontsector->GetTexture(sector_t::ceiling), false, true); + if (gltexture) + { + DoTexture(RENDERWALL_TOP, seg, true, + crefz, frefz, + fch1, fch2, ffh1, ffh2, 0); + } + } + return; + } + //return; // [GZ] 3D middle textures are necessarily two-sided, even if they lack the explicit two-sided flag if (!backsector || !(seg->linedef->flags&(ML_TWOSIDED | ML_3DMIDTEX))) // one sided