Skip to content

Commit

Permalink
Add optional pooling of objects.
Browse files Browse the repository at this point in the history
  • Loading branch information
speps committed Feb 14, 2016
1 parent 48afef4 commit 42beb99
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions LibTessDotNet/Sources/Tess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,16 @@ public partial class Tess
public float SUnitY = 0.0f;
public float SentinelCoord = 4e30f;

/// <summary>
/// If true, will remove empty (zero area) polygons.
/// </summary>
public bool NoEmptyPolygons = false;

/// <summary>
/// If true, will use pooling to reduce GC (compare performance with/without, can vary wildly).
/// </summary>
public bool UsePooling = false;

public ContourVertex[] Vertices { get { return _vertices; } }
public int VertexCount { get { return _vertexCount; } }

Expand Down Expand Up @@ -722,8 +730,10 @@ public void Tessellate(WindingRule windingRule, ElementType elementType, int pol
OutputPolymesh(elementType, polySize);
}

// Pooling disabled, performance is worse with pooling
//_mesh.Free();
if (UsePooling)
{
_mesh.Free();
}
_mesh = null;
}
}
Expand Down

0 comments on commit 42beb99

Please sign in to comment.