Skip to content

Commit

Permalink
Replaced arrays with spans in query. Replaced array allocation with b…
Browse files Browse the repository at this point in the history
…uffer rent in query.
  • Loading branch information
wrenge authored and ikpil committed Dec 11, 2024
1 parent 1bfc665 commit 1e55dff
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/DotRecast.Detour/DtCallbackPolyQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public DtCallbackPolyQuery(Action<DtMeshTile, DtPoly, long> 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)
{
Expand Down
2 changes: 1 addition & 1 deletion src/DotRecast.Detour/DtCollectPolysQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public bool Overflowed()
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 toCopy = count;
Expand Down
2 changes: 1 addition & 1 deletion src/DotRecast.Detour/DtFindNearestPolyQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public DtFindNearestPolyQuery(DtNavMeshQuery query, RcVec3f center)
_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)
{
Expand Down
2 changes: 1 addition & 1 deletion src/DotRecast.Detour/IDtPolyQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ public interface IDtPolyQuery
{
/// 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<long> refs, int count);
void Process(DtMeshTile tile, Span<DtPoly> poly, Span<long> refs, int count);
}
}

0 comments on commit 1e55dff

Please sign in to comment.