Compare commits

..

No commits in common. "ff930712ee2c806753f39b7565f50e03a988691f" and "db0717a77e6f1b501ea2d2c5d6b6a038f538d9d2" have entirely different histories.

7 changed files with 7 additions and 20 deletions

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Buffers;
using System.Runtime.CompilerServices;
@ -43,11 +43,6 @@ namespace DotRecast.Core.Buffers
return _array;
}
public Span<T> AsSpan()
{
return new Span<T>(_array, 0, Length);
}
public void Dispose()
{

View File

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

View File

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

View File

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

View File

@ -1365,11 +1365,6 @@ namespace DotRecast.Detour
}
public int GetTilesAt(int x, int y, DtMeshTile[] tiles, int maxTiles)
{
return GetTilesAt(x, y, (Span<DtMeshTile>)tiles, maxTiles);
}
public int GetTilesAt(int x, int y, Span<DtMeshTile> tiles, int maxTiles)
{
int n = 0;

View File

@ -21,7 +21,6 @@ freely, subject to the following restrictions:
using System;
using System.Collections.Generic;
using DotRecast.Core;
using DotRecast.Core.Buffers;
using DotRecast.Core.Numerics;
namespace DotRecast.Detour
@ -598,8 +597,7 @@ namespace DotRecast.Detour
{
const int batchSize = 32;
Span<long> polyRefs = stackalloc long[batchSize];
using RcRentedArray<DtPoly> polysRent = RcRentedArray.Rent<DtPoly>(batchSize);
Span<DtPoly> polys = polysRent.AsSpan();
DtPoly[] polys = new DtPoly[batchSize];
int n = 0;
if (tile.data.bvTree != null)
@ -788,8 +786,7 @@ namespace DotRecast.Detour
m_nav.CalcTileLoc(bmax, out var maxx, out var maxy);
const int MAX_NEIS = 32;
using RcRentedArray<DtMeshTile> neisRent = RcRentedArray.Rent<DtMeshTile>(MAX_NEIS);
Span<DtMeshTile> neis = neisRent.AsSpan();
DtMeshTile[] neis = new DtMeshTile[MAX_NEIS];
for (int y = miny; y <= maxy; ++y)
{

View File

@ -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, Span<DtPoly> poly, Span<long> refs, int count);
void Process(DtMeshTile tile, DtPoly[] poly, Span<long> refs, int count);
}
}