feat: added list pools
This commit is contained in:
@@ -6,7 +6,7 @@ namespace Syntriax.Engine.Physics2D;
|
||||
|
||||
public class RaycastResolver2D : IRaycastResolver2D
|
||||
{
|
||||
private readonly Pool<List<Line2D>> lineCacheQueue = new(() => new List<Line2D>(4));
|
||||
private readonly ListPool<Line2D> lineCacheQueue = new(() => new(4));
|
||||
|
||||
RaycastResult? IRaycastResolver2D.RaycastAgainst<T>(T shape, Ray2D ray, float length)
|
||||
{
|
||||
@@ -21,7 +21,6 @@ public class RaycastResolver2D : IRaycastResolver2D
|
||||
public RaycastResult? RaycastAgainstShape(IShapeCollider2D shapeCollider, Ray2D ray, float length)
|
||||
{
|
||||
List<Line2D> line2Ds = lineCacheQueue.Get();
|
||||
line2Ds.Clear();
|
||||
|
||||
RaycastResult? raycastResult = null;
|
||||
float closestRaycastResultSquared = float.MaxValue;
|
||||
@@ -60,7 +59,6 @@ public class RaycastResolver2D : IRaycastResolver2D
|
||||
}
|
||||
}
|
||||
|
||||
line2Ds.Clear();
|
||||
lineCacheQueue.Return(line2Ds);
|
||||
|
||||
return raycastResult;
|
||||
|
Reference in New Issue
Block a user