forked from bit/DotRecastNetSim
remove new int[3] -> out salt, it, ip
This commit is contained in:
parent
f1b6798ccb
commit
5bcacd8e7c
|
@ -7,8 +7,7 @@ namespace DotRecast.Detour.Extras.Jumplink
|
||||||
{
|
{
|
||||||
public abstract class AbstractGroundSampler : IGroundSampler
|
public abstract class AbstractGroundSampler : IGroundSampler
|
||||||
{
|
{
|
||||||
protected void SampleGround(JumpLinkBuilderConfig acfg, EdgeSampler es,
|
protected void SampleGround(JumpLinkBuilderConfig acfg, EdgeSampler es, Func<Vector3f, float, Tuple<bool, float>> heightFunc)
|
||||||
Func<Vector3f, float, Tuple<bool, float>> heightFunc)
|
|
||||||
{
|
{
|
||||||
float cs = acfg.cellSize;
|
float cs = acfg.cellSize;
|
||||||
float dist = (float)Math.Sqrt(Vector3f.Dist2DSqr(es.start.p, es.start.q));
|
float dist = (float)Math.Sqrt(Vector3f.Dist2DSqr(es.start.p, es.start.q));
|
||||||
|
|
|
@ -141,18 +141,14 @@ namespace DotRecast.Detour
|
||||||
/// @param[out] it The index of the tile.
|
/// @param[out] it The index of the tile.
|
||||||
/// @param[out] ip The index of the polygon within the tile.
|
/// @param[out] ip The index of the polygon within the tile.
|
||||||
/// @see #encodePolyId
|
/// @see #encodePolyId
|
||||||
static int[] DecodePolyId(long refs)
|
static void DecodePolyId(long refs, out int salt, out int it, out int ip)
|
||||||
{
|
{
|
||||||
int salt;
|
|
||||||
int it;
|
|
||||||
int ip;
|
|
||||||
long saltMask = (1L << DT_SALT_BITS) - 1;
|
long saltMask = (1L << DT_SALT_BITS) - 1;
|
||||||
long tileMask = (1L << DT_TILE_BITS) - 1;
|
long tileMask = (1L << DT_TILE_BITS) - 1;
|
||||||
long polyMask = (1L << DT_POLY_BITS) - 1;
|
long polyMask = (1L << DT_POLY_BITS) - 1;
|
||||||
salt = (int)((refs >> (DT_POLY_BITS + DT_TILE_BITS)) & saltMask);
|
salt = (int)((refs >> (DT_POLY_BITS + DT_TILE_BITS)) & saltMask);
|
||||||
it = (int)((refs >> DT_POLY_BITS) & tileMask);
|
it = (int)((refs >> DT_POLY_BITS) & tileMask);
|
||||||
ip = (int)(refs & polyMask);
|
ip = (int)(refs & polyMask);
|
||||||
return new int[] { salt, it, ip };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Extracts a tile's salt value from the specified polygon reference.
|
/// Extracts a tile's salt value from the specified polygon reference.
|
||||||
|
@ -228,10 +224,7 @@ namespace DotRecast.Detour
|
||||||
return Results.InvalidParam<Tuple<MeshTile, Poly>>("ref = 0");
|
return Results.InvalidParam<Tuple<MeshTile, Poly>>("ref = 0");
|
||||||
}
|
}
|
||||||
|
|
||||||
int[] saltitip = DecodePolyId(refs);
|
DecodePolyId(refs, out var salt, out var it, out var ip);
|
||||||
int salt = saltitip[0];
|
|
||||||
int it = saltitip[1];
|
|
||||||
int ip = saltitip[2];
|
|
||||||
if (it >= m_maxTiles)
|
if (it >= m_maxTiles)
|
||||||
{
|
{
|
||||||
return Results.InvalidParam<Tuple<MeshTile, Poly>>("tile > m_maxTiles");
|
return Results.InvalidParam<Tuple<MeshTile, Poly>>("tile > m_maxTiles");
|
||||||
|
@ -258,9 +251,7 @@ namespace DotRecast.Detour
|
||||||
/// it does not validate the reference.
|
/// it does not validate the reference.
|
||||||
public Tuple<MeshTile, Poly> GetTileAndPolyByRefUnsafe(long refs)
|
public Tuple<MeshTile, Poly> GetTileAndPolyByRefUnsafe(long refs)
|
||||||
{
|
{
|
||||||
int[] saltitip = DecodePolyId(refs);
|
DecodePolyId(refs, out var salt, out var it, out var ip);
|
||||||
int it = saltitip[1];
|
|
||||||
int ip = saltitip[2];
|
|
||||||
return Tuple.Create(m_tiles[it], m_tiles[it].data.polys[ip]);
|
return Tuple.Create(m_tiles[it], m_tiles[it].data.polys[ip]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -271,10 +262,7 @@ namespace DotRecast.Detour
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int[] saltitip = DecodePolyId(refs);
|
DecodePolyId(refs, out var salt, out var it, out var ip);
|
||||||
int salt = saltitip[0];
|
|
||||||
int it = saltitip[1];
|
|
||||||
int ip = saltitip[2];
|
|
||||||
if (it >= m_maxTiles)
|
if (it >= m_maxTiles)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -1523,10 +1511,7 @@ namespace DotRecast.Detour
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get current polygon
|
// Get current polygon
|
||||||
int[] saltitip = DecodePolyId(polyRef);
|
DecodePolyId(polyRef, out var salt, out var it, out var ip);
|
||||||
int salt = saltitip[0];
|
|
||||||
int it = saltitip[1];
|
|
||||||
int ip = saltitip[2];
|
|
||||||
if (it >= m_maxTiles)
|
if (it >= m_maxTiles)
|
||||||
{
|
{
|
||||||
return Results.InvalidParam<Tuple<Vector3f, Vector3f>>("Invalid tile ID > max tiles");
|
return Results.InvalidParam<Tuple<Vector3f, Vector3f>>("Invalid tile ID > max tiles");
|
||||||
|
@ -1593,10 +1578,7 @@ namespace DotRecast.Detour
|
||||||
return Status.FAILURE;
|
return Status.FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int[] saltTilePoly = DecodePolyId(refs);
|
DecodePolyId(refs, out var salt, out var it, out var ip);
|
||||||
int salt = saltTilePoly[0];
|
|
||||||
int it = saltTilePoly[1];
|
|
||||||
int ip = saltTilePoly[2];
|
|
||||||
if (it >= m_maxTiles)
|
if (it >= m_maxTiles)
|
||||||
{
|
{
|
||||||
return Status.FAILURE_INVALID_PARAM;
|
return Status.FAILURE_INVALID_PARAM;
|
||||||
|
@ -1627,10 +1609,7 @@ namespace DotRecast.Detour
|
||||||
return Results.Failure<int>();
|
return Results.Failure<int>();
|
||||||
}
|
}
|
||||||
|
|
||||||
int[] saltTilePoly = DecodePolyId(refs);
|
DecodePolyId(refs, out var salt, out var it, out var ip);
|
||||||
int salt = saltTilePoly[0];
|
|
||||||
int it = saltTilePoly[1];
|
|
||||||
int ip = saltTilePoly[2];
|
|
||||||
if (it >= m_maxTiles)
|
if (it >= m_maxTiles)
|
||||||
{
|
{
|
||||||
return Results.InvalidParam<int>();
|
return Results.InvalidParam<int>();
|
||||||
|
@ -1659,10 +1638,7 @@ namespace DotRecast.Detour
|
||||||
return Status.FAILURE;
|
return Status.FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int[] saltTilePoly = DecodePolyId(refs);
|
DecodePolyId(refs, out var salt, out var it, out var ip);
|
||||||
int salt = saltTilePoly[0];
|
|
||||||
int it = saltTilePoly[1];
|
|
||||||
int ip = saltTilePoly[2];
|
|
||||||
if (it >= m_maxTiles)
|
if (it >= m_maxTiles)
|
||||||
{
|
{
|
||||||
return Status.FAILURE;
|
return Status.FAILURE;
|
||||||
|
@ -1693,10 +1669,7 @@ namespace DotRecast.Detour
|
||||||
return Results.Failure<int>();
|
return Results.Failure<int>();
|
||||||
}
|
}
|
||||||
|
|
||||||
int[] saltTilePoly = DecodePolyId(refs);
|
DecodePolyId(refs, out var salt, out var it, out var ip);
|
||||||
int salt = saltTilePoly[0];
|
|
||||||
int it = saltTilePoly[1];
|
|
||||||
int ip = saltTilePoly[2];
|
|
||||||
if (it >= m_maxTiles)
|
if (it >= m_maxTiles)
|
||||||
{
|
{
|
||||||
return Results.InvalidParam<int>();
|
return Results.InvalidParam<int>();
|
||||||
|
|
Loading…
Reference in New Issue