diff --git a/Source/Core/Rendering/Renderer3D.cs b/Source/Core/Rendering/Renderer3D.cs index 4fe75a87..e64642dc 100644 --- a/Source/Core/Rendering/Renderer3D.cs +++ b/Source/Core/Rendering/Renderer3D.cs @@ -780,8 +780,8 @@ namespace CodeImp.DoomBuilder.Rendering // This collects a visual sector's geometry for rendering public void AddSectorGeometry(VisualGeometry g) { - // Must have a texture! - if(g.Texture != null) + // Must have a texture and vertices + if((g.Texture != null) && (g.Triangles > 0)) { // Texture group not yet collected? if(!geometry[g.RenderPassInt].ContainsKey(g.Texture)) diff --git a/Source/Core/VisualModes/VisualMode.cs b/Source/Core/VisualModes/VisualMode.cs index ba9b2d1b..c705b014 100644 --- a/Source/Core/VisualModes/VisualMode.cs +++ b/Source/Core/VisualModes/VisualMode.cs @@ -527,7 +527,12 @@ namespace CodeImp.DoomBuilder.VisualModes if(!sectors.ContainsKey(ld.Front.Sector)) { sectors.Add(ld.Front.Sector, vs); - foreach(VisualGeometry g in vs.FixedGeometry) pickables.Add(g); + foreach(VisualGeometry g in vs.FixedGeometry) + { + // Must have content + if(g.Triangles > 0) + pickables.Add(g); + } } // Add sidedef if on the front side @@ -536,8 +541,12 @@ namespace CodeImp.DoomBuilder.VisualModes List sidedefgeo = vs.GetSidedefGeometry(ld.Front); foreach(VisualGeometry g in sidedefgeo) { - g.SetPickResults(intersect, u); - pickables.Add(g); + // Must have content + if(g.Triangles > 0) + { + g.SetPickResults(intersect, u); + pickables.Add(g); + } } } } @@ -555,7 +564,12 @@ namespace CodeImp.DoomBuilder.VisualModes if(!sectors.ContainsKey(ld.Back.Sector)) { sectors.Add(ld.Back.Sector, vs); - foreach(VisualGeometry g in vs.FixedGeometry) pickables.Add(g); + foreach(VisualGeometry g in vs.FixedGeometry) + { + // Must have content + if(g.Triangles > 0) + pickables.Add(g); + } } // Add sidedef if on the front side @@ -564,8 +578,12 @@ namespace CodeImp.DoomBuilder.VisualModes List sidedefgeo = vs.GetSidedefGeometry(ld.Back); foreach(VisualGeometry g in sidedefgeo) { - g.SetPickResults(intersect, u); - pickables.Add(g); + // Must have content + if(g.Triangles > 0) + { + g.SetPickResults(intersect, u); + pickables.Add(g); + } } } } diff --git a/Source/Plugins/BuilderModes/VisualModes/BaseVisualSector.cs b/Source/Plugins/BuilderModes/VisualModes/BaseVisualSector.cs index cc982898..cf89c31b 100644 --- a/Source/Plugins/BuilderModes/VisualModes/BaseVisualSector.cs +++ b/Source/Plugins/BuilderModes/VisualModes/BaseVisualSector.cs @@ -142,11 +142,13 @@ namespace CodeImp.DoomBuilder.BuilderModes // Create floor if(floor == null) floor = new VisualFloor(mode, this); - if(floor.Setup()) base.AddGeometry(floor); + floor.Setup(); + base.AddGeometry(floor); // Create ceiling if(ceiling == null) ceiling = new VisualCeiling(mode, this); - if(ceiling.Setup()) base.AddGeometry(ceiling); + ceiling.Setup(); + base.AddGeometry(ceiling); // Go for all sidedefs Dictionary oldsides = sides ?? new Dictionary(1); @@ -161,15 +163,18 @@ namespace CodeImp.DoomBuilder.BuilderModes { // Create upper part VisualUpper vu = parts.upper ?? new VisualUpper(mode, this, sd); - if(vu.Setup()) base.AddGeometry(vu); + vu.Setup(); + base.AddGeometry(vu); // Create lower part VisualLower vl = parts.lower ?? new VisualLower(mode, this, sd); - if(vl.Setup()) base.AddGeometry(vl); + vl.Setup(); + base.AddGeometry(vl); // Create middle part VisualMiddleDouble vm = parts.middledouble ?? new VisualMiddleDouble(mode, this, sd); - if(vm.Setup()) base.AddGeometry(vm); + vm.Setup(); + base.AddGeometry(vm); // Store sides.Add(sd, new VisualSidedefParts(vu, vl, vm)); @@ -178,7 +183,8 @@ namespace CodeImp.DoomBuilder.BuilderModes { // Create middle part VisualMiddleSingle vm = parts.middlesingle ?? new VisualMiddleSingle(mode, this, sd); - if(vm.Setup()) base.AddGeometry(vm); + vm.Setup(); + base.AddGeometry(vm); // Store sides.Add(sd, new VisualSidedefParts(vm)); diff --git a/Source/Plugins/BuilderModes/VisualModes/VisualLower.cs b/Source/Plugins/BuilderModes/VisualModes/VisualLower.cs index 949ac9b8..7da56821 100644 --- a/Source/Plugins/BuilderModes/VisualModes/VisualLower.cs +++ b/Source/Plugins/BuilderModes/VisualModes/VisualLower.cs @@ -157,6 +157,10 @@ namespace CodeImp.DoomBuilder.BuilderModes else { // No geometry for invisible wall + base.top = geotop; + base.bottom = geobottom; + WorldVertex[] verts = new WorldVertex[0]; + base.SetVertices(verts); return false; } } diff --git a/Source/Plugins/BuilderModes/VisualModes/VisualMiddleDouble.cs b/Source/Plugins/BuilderModes/VisualModes/VisualMiddleDouble.cs index c1f945cb..0dbb6b49 100644 --- a/Source/Plugins/BuilderModes/VisualModes/VisualMiddleDouble.cs +++ b/Source/Plugins/BuilderModes/VisualModes/VisualMiddleDouble.cs @@ -68,6 +68,8 @@ namespace CodeImp.DoomBuilder.BuilderModes // This builds the geometry. Returns false when no geometry created. public override bool Setup() { + WorldVertex[] verts; + byte brightness = (byte)General.Clamp(Sidedef.Sector.Brightness, 0, 255); // Calculate size of this wall part @@ -148,7 +150,7 @@ namespace CodeImp.DoomBuilder.BuilderModes PixelColor pc = new PixelColor(255, brightness, brightness, brightness); // Make vertices - WorldVertex[] verts = new WorldVertex[6]; + verts = new WorldVertex[6]; verts[0] = new WorldVertex(v1.x, v1.y, texbottom, pc.ToInt(), t1.x, t2.y); verts[1] = new WorldVertex(v1.x, v1.y, textop, pc.ToInt(), t1.x, t1.y); verts[2] = new WorldVertex(v2.x, v2.y, textop, pc.ToInt(), t2.x, t1.y); @@ -166,8 +168,12 @@ namespace CodeImp.DoomBuilder.BuilderModes } } } - + // No geometry for invisible wall + base.top = geotop; + base.bottom = geotop; // bottom same as top so that it has a height of 0 (otherwise it will still be picked up by object picking) + verts = new WorldVertex[0]; + base.SetVertices(verts); return false; } diff --git a/Source/Plugins/BuilderModes/VisualModes/VisualMiddleSingle.cs b/Source/Plugins/BuilderModes/VisualModes/VisualMiddleSingle.cs index 6f9d258e..5a010c5f 100644 --- a/Source/Plugins/BuilderModes/VisualModes/VisualMiddleSingle.cs +++ b/Source/Plugins/BuilderModes/VisualModes/VisualMiddleSingle.cs @@ -76,12 +76,6 @@ namespace CodeImp.DoomBuilder.BuilderModes Vector2D t1 = new Vector2D(); Vector2D t2 = new Vector2D(); - if(Sidedef.MiddleTexture == "FOOBAR") - { - int g = 5; - } - - // Texture given? if((Sidedef.MiddleTexture.Length > 0) && (Sidedef.MiddleTexture[0] != '-')) { @@ -163,6 +157,10 @@ namespace CodeImp.DoomBuilder.BuilderModes else { // No geometry for invisible wall + base.top = geotop; + base.bottom = geobottom; + WorldVertex[] verts = new WorldVertex[0]; + base.SetVertices(verts); return false; } } diff --git a/Source/Plugins/BuilderModes/VisualModes/VisualUpper.cs b/Source/Plugins/BuilderModes/VisualModes/VisualUpper.cs index 016847ba..c7b55e5e 100644 --- a/Source/Plugins/BuilderModes/VisualModes/VisualUpper.cs +++ b/Source/Plugins/BuilderModes/VisualModes/VisualUpper.cs @@ -157,6 +157,10 @@ namespace CodeImp.DoomBuilder.BuilderModes else { // No geometry for invisible wall + base.top = geotop; + base.bottom = geobottom; + WorldVertex[] verts = new WorldVertex[0]; + base.SetVertices(verts); return false; } }