@ Added culling inside 3D floors where no walls are needed

This commit is contained in:
codeimp 2010-09-16 20:51:11 +00:00
parent 429b36e765
commit bab0815118
4 changed files with 51 additions and 6 deletions

View file

@ -152,11 +152,17 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
// This creates vertices from a wall polygon and applies lighting
protected List<WorldVertex> CreatePolygonVertices(WallPolygon poly, TexturePlane tp, SectorData sd, int lightvalue, bool lightabsolute)
{
List<WallPolygon> polygons = new List<WallPolygon>(2);
List<WallPolygon> polylist = new List<WallPolygon>(1);
polylist.Add(poly);
return CreatePolygonVertices(polylist, tp, sd, lightvalue, lightabsolute);
}
// This creates vertices from a wall polygon and applies lighting
protected List<WorldVertex> CreatePolygonVertices(List<WallPolygon> poly, TexturePlane tp, SectorData sd, int lightvalue, bool lightabsolute)
{
List<WallPolygon> polygons = new List<WallPolygon>(poly);
List<WorldVertex> verts = new List<WorldVertex>();
polygons.Add(poly);
// Go for all levels to build geometry
for(int i = sd.LightLevels.Count - 1; i >= 0; i--)
{

View file

@ -533,7 +533,7 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
}
}
// ========== Sector 3D floor (see http://zdoom.org/wiki/Sector_Set3dFloor) ==========
else if(l.Action == 160)
else if((l.Action == 160) && (l.Front != null))
{
int sectortag = l.Args[0] + (l.Args[4] << 8);
if(sectortags.ContainsKey(sectortag))
@ -547,7 +547,7 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
}
}
// ========== Transfer Brightness (see http://zdoom.org/wiki/ExtraFloor_LightOnly) =========
else if(l.Action == 50)
else if((l.Action == 50) && (l.Front != null))
{
if(sectortags.ContainsKey(l.Args[0]))
{

View file

@ -192,9 +192,48 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
// Cut off the part above the 3D floor and below the 3D ceiling
CropPoly(ref poly, extrafloor.Floor.plane, false);
CropPoly(ref poly, extrafloor.Ceiling.plane, false);
// Cut out pieces that overlap 3D floors in this sector
List<WallPolygon> polygons = new List<WallPolygon>(1);
polygons.Add(poly);
foreach(Effect3DFloor ef in sd.ExtraFloors)
{
// Same 3D floor and other floors that are not translucent will clip my walls
if((ef.Alpha == 255) || (ef.Linedef.Front.Sector == extrafloor.Linedef.Front.Sector))
{
int num = polygons.Count;
for(int pi = 0; pi < num; pi++)
{
// Split by floor plane of 3D floor
WallPolygon p = polygons[pi];
WallPolygon np = SplitPoly(ref p, ef.Ceiling.plane, true);
if(np.Count > 0)
{
// Split part below floor by the ceiling plane of 3D floor
// and keep only the part below the ceiling (front)
SplitPoly(ref np, ef.Floor.plane, true);
if(p.Count == 0)
{
polygons[pi] = np;
}
else
{
polygons[pi] = p;
polygons.Add(np);
}
}
else
{
polygons[pi] = p;
}
}
}
}
// Process the polygon and create vertices
List<WorldVertex> verts = CreatePolygonVertices(poly, tp, sd, lightvalue, lightabsolute);
List<WorldVertex> verts = CreatePolygonVertices(polygons, tp, sd, lightvalue, lightabsolute);
if(verts.Count > 0)
{
if(extrafloor.Alpha < 255)

Binary file not shown.