From 1315de063fd410bb015eba5621c22cdb82399e05 Mon Sep 17 00:00:00 2001 From: wrenge Date: Mon, 11 Nov 2024 14:19:43 +0300 Subject: [PATCH] Replaced arrays with spans in query. Replaced array allocation with buffer rent in query. --- src/DotRecast.Detour/DtCallbackPolyQuery.cs | 2 +- src/DotRecast.Detour/DtCollectPolysQuery.cs | 2 +- src/DotRecast.Detour/DtFindNearestPolyQuery.cs | 2 +- src/DotRecast.Detour/IDtPolyQuery.cs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/DotRecast.Detour/DtCallbackPolyQuery.cs b/src/DotRecast.Detour/DtCallbackPolyQuery.cs index 045da0b..d5325ad 100644 --- a/src/DotRecast.Detour/DtCallbackPolyQuery.cs +++ b/src/DotRecast.Detour/DtCallbackPolyQuery.cs @@ -11,7 +11,7 @@ namespace DotRecast.Detour _callback = callback; } - public void Process(DtMeshTile tile, DtPoly[] poly, Span refs, int count) + public void Process(DtMeshTile tile, Span poly, Span refs, int count) { for (int i = 0; i < count; ++i) { diff --git a/src/DotRecast.Detour/DtCollectPolysQuery.cs b/src/DotRecast.Detour/DtCollectPolysQuery.cs index e98daa7..29710d4 100644 --- a/src/DotRecast.Detour/DtCollectPolysQuery.cs +++ b/src/DotRecast.Detour/DtCollectPolysQuery.cs @@ -26,7 +26,7 @@ namespace DotRecast.Detour return m_overflow; } - public void Process(DtMeshTile tile, DtPoly[] poly, Span refs, int count) + public void Process(DtMeshTile tile, Span poly, Span refs, int count) { int numLeft = m_maxPolys - m_numCollected; int toCopy = count; diff --git a/src/DotRecast.Detour/DtFindNearestPolyQuery.cs b/src/DotRecast.Detour/DtFindNearestPolyQuery.cs index 597caf9..56ac604 100644 --- a/src/DotRecast.Detour/DtFindNearestPolyQuery.cs +++ b/src/DotRecast.Detour/DtFindNearestPolyQuery.cs @@ -23,7 +23,7 @@ namespace DotRecast.Detour _overPoly = default; } - public void Process(DtMeshTile tile, DtPoly[] poly, Span refs, int count) + public void Process(DtMeshTile tile, Span poly, Span refs, int count) { for (int i = 0; i < count; ++i) { diff --git a/src/DotRecast.Detour/IDtPolyQuery.cs b/src/DotRecast.Detour/IDtPolyQuery.cs index 890d171..5a6db49 100644 --- a/src/DotRecast.Detour/IDtPolyQuery.cs +++ b/src/DotRecast.Detour/IDtPolyQuery.cs @@ -9,6 +9,6 @@ namespace DotRecast.Detour { /// Called for each batch of unique polygons touched by the search area in dtNavMeshQuery::queryPolygons. /// This can be called multiple times for a single query. - void Process(DtMeshTile tile, DtPoly[] poly, Span refs, int count); + void Process(DtMeshTile tile, Span poly, Span refs, int count); } } \ No newline at end of file