Replaced arrays with spans in query. Replaced array allocation with buffer rent in query.

This commit is contained in:
wrenge 2024-11-11 14:19:43 +03:00
parent a6db4344e4
commit 1315de063f
4 changed files with 4 additions and 4 deletions

View File

@ -11,7 +11,7 @@ namespace DotRecast.Detour
_callback = callback; _callback = callback;
} }
public void Process(DtMeshTile tile, DtPoly[] poly, Span<long> refs, int count) public void Process(DtMeshTile tile, Span<DtPoly> poly, Span<long> refs, int count)
{ {
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
{ {

View File

@ -26,7 +26,7 @@ namespace DotRecast.Detour
return m_overflow; return m_overflow;
} }
public void Process(DtMeshTile tile, DtPoly[] poly, Span<long> refs, int count) public void Process(DtMeshTile tile, Span<DtPoly> poly, Span<long> refs, int count)
{ {
int numLeft = m_maxPolys - m_numCollected; int numLeft = m_maxPolys - m_numCollected;
int toCopy = count; int toCopy = count;

View File

@ -23,7 +23,7 @@ namespace DotRecast.Detour
_overPoly = default; _overPoly = default;
} }
public void Process(DtMeshTile tile, DtPoly[] poly, Span<long> refs, int count) public void Process(DtMeshTile tile, Span<DtPoly> poly, Span<long> refs, int count)
{ {
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
{ {

View File

@ -9,6 +9,6 @@ namespace DotRecast.Detour
{ {
/// Called for each batch of unique polygons touched by the search area in dtNavMeshQuery::queryPolygons. /// 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. /// This can be called multiple times for a single query.
void Process(DtMeshTile tile, DtPoly[] poly, Span<long> refs, int count); void Process(DtMeshTile tile, Span<DtPoly> poly, Span<long> refs, int count);
} }
} }