mirror of
https://git.do.srb2.org/STJr/ZoneBuilder.git
synced 2025-02-10 17:51:17 +00:00
Speed up linedef processing by not relying on a hashmap
This commit is contained in:
parent
e44debce82
commit
026324779e
2 changed files with 17 additions and 9 deletions
|
@ -77,6 +77,9 @@ namespace CodeImp.DoomBuilder.Map
|
||||||
|
|
||||||
// Clone
|
// Clone
|
||||||
private int serializedindex;
|
private int serializedindex;
|
||||||
|
|
||||||
|
// Rendering
|
||||||
|
private int lastProcessed;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -111,7 +114,8 @@ namespace CodeImp.DoomBuilder.Map
|
||||||
public RectangleF Rect { get { return rect; } }
|
public RectangleF Rect { get { return rect; } }
|
||||||
public int[] Args { get { return args; } }
|
public int[] Args { get { return args; } }
|
||||||
internal int SerializedIndex { get { return serializedindex; } set { serializedindex = value; } }
|
internal int SerializedIndex { get { return serializedindex; } set { serializedindex = value; } }
|
||||||
internal bool FrontInterior { get { return frontinterior; } set { frontinterior = value; } }
|
internal int LastProcessed { get { return lastProcessed; } set { lastProcessed = value; } }
|
||||||
|
internal bool FrontInterior { get { return frontinterior; } set { frontinterior = value; } }
|
||||||
internal bool ImpassableFlag { get { return impassableflag; } }
|
internal bool ImpassableFlag { get { return impassableflag; } }
|
||||||
internal int ColorPresetIndex { get { return colorPresetIndex; } } //mxd
|
internal int ColorPresetIndex { get { return colorPresetIndex; } } //mxd
|
||||||
internal bool ExtraFloorFlag; //mxd
|
internal bool ExtraFloorFlag; //mxd
|
||||||
|
|
|
@ -510,15 +510,18 @@ namespace CodeImp.DoomBuilder.VisualModes
|
||||||
|
|
||||||
//mxd. Should move selected things in specified direction
|
//mxd. Should move selected things in specified direction
|
||||||
protected virtual void MoveSelectedThings(Vector2D direction, bool absolutePosition) { }
|
protected virtual void MoveSelectedThings(Vector2D direction, bool absolutePosition) { }
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region ================== Visibility Culling
|
#endregion
|
||||||
|
|
||||||
|
#region ================== Visibility Culling
|
||||||
|
|
||||||
|
int lastProcessed = 0;
|
||||||
|
|
||||||
// This preforms visibility culling
|
// This preforms visibility culling
|
||||||
protected void DoCulling()
|
protected void DoCulling()
|
||||||
{
|
{
|
||||||
HashSet<Linedef> visiblelines = new HashSet<Linedef>();
|
lastProcessed++;
|
||||||
|
List<Linedef> visiblelines = new List<Linedef>();
|
||||||
Vector2D campos2d = General.Map.VisualCamera.Position;
|
Vector2D campos2d = General.Map.VisualCamera.Position;
|
||||||
|
|
||||||
// Make collections
|
// Make collections
|
||||||
|
@ -538,10 +541,11 @@ namespace CodeImp.DoomBuilder.VisualModes
|
||||||
foreach(Linedef ld in block.Lines)
|
foreach(Linedef ld in block.Lines)
|
||||||
{
|
{
|
||||||
// Line not already processed?
|
// Line not already processed?
|
||||||
if(!visiblelines.Contains(ld))
|
if (ld.LastProcessed != lastProcessed)//if(!visiblelines.Contains(ld))
|
||||||
{
|
{
|
||||||
// Add line if not added yet
|
// Add line if not added yet
|
||||||
visiblelines.Add(ld);
|
ld.LastProcessed = lastProcessed;
|
||||||
|
visiblelines.Add(ld);
|
||||||
|
|
||||||
// Which side of the line is the camera on?
|
// Which side of the line is the camera on?
|
||||||
if(ld.SideOfLine(campos2d) < 0)
|
if(ld.SideOfLine(campos2d) < 0)
|
||||||
|
|
Loading…
Reference in a new issue