forked from mirror/DotRecast
remove Tuple<DtMeshTile, DtPoly>
This commit is contained in:
parent
776548e916
commit
c42d89003b
|
@ -615,8 +615,7 @@ namespace DotRecast.Detour.Crowd
|
||||||
{
|
{
|
||||||
// Partial path, constrain target position inside the
|
// Partial path, constrain target position inside the
|
||||||
// last polygon.
|
// last polygon.
|
||||||
Result<ClosestPointOnPolyResult> cr = _navQuery.ClosestPointOnPoly(reqPath[reqPath.Count - 1],
|
Result<ClosestPointOnPolyResult> cr = _navQuery.ClosestPointOnPoly(reqPath[reqPath.Count - 1], ag.targetPos);
|
||||||
ag.targetPos);
|
|
||||||
if (cr.Succeeded())
|
if (cr.Succeeded())
|
||||||
{
|
{
|
||||||
reqPos = cr.result.GetClosest();
|
reqPos = cr.result.GetClosest();
|
||||||
|
|
|
@ -243,10 +243,11 @@ namespace DotRecast.Detour
|
||||||
/// reference is valid. This function is faster than #getTileAndPolyByRef,
|
/// reference is valid. This function is faster than #getTileAndPolyByRef,
|
||||||
/// but
|
/// but
|
||||||
/// it does not validate the reference.
|
/// it does not validate the reference.
|
||||||
public Tuple<DtMeshTile, DtPoly> GetTileAndPolyByRefUnsafe(long refs)
|
public void GetTileAndPolyByRefUnsafe(long refs, out DtMeshTile tile, out DtPoly poly)
|
||||||
{
|
{
|
||||||
DecodePolyId(refs, out var salt, out var it, out var ip);
|
DecodePolyId(refs, out var salt, out var it, out var ip);
|
||||||
return Tuple.Create(m_tiles[it], m_tiles[it].data.polys[ip]);
|
tile = m_tiles[it];
|
||||||
|
poly = m_tiles[it].data.polys[ip];
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsValidPolyRef(long refs)
|
public bool IsValidPolyRef(long refs)
|
||||||
|
@ -1302,9 +1303,7 @@ namespace DotRecast.Detour
|
||||||
|
|
||||||
public ClosestPointOnPolyResult ClosestPointOnPoly(long refs, RcVec3f pos)
|
public ClosestPointOnPolyResult ClosestPointOnPoly(long refs, RcVec3f pos)
|
||||||
{
|
{
|
||||||
Tuple<DtMeshTile, DtPoly> tileAndPoly = GetTileAndPolyByRefUnsafe(refs);
|
GetTileAndPolyByRefUnsafe(refs, out var tile, out var poly);
|
||||||
DtMeshTile tile = tileAndPoly.Item1;
|
|
||||||
DtPoly poly = tileAndPoly.Item2;
|
|
||||||
RcVec3f closest = new RcVec3f();
|
RcVec3f closest = new RcVec3f();
|
||||||
closest = pos;
|
closest = pos;
|
||||||
float? h = GetPolyHeight(tile, poly, pos);
|
float? h = GetPolyHeight(tile, poly, pos);
|
||||||
|
|
|
@ -232,9 +232,7 @@ namespace DotRecast.Detour
|
||||||
return Results.InvalidParam<FindRandomPointResult>();
|
return Results.InvalidParam<FindRandomPointResult>();
|
||||||
}
|
}
|
||||||
|
|
||||||
Tuple<DtMeshTile, DtPoly> tileAndPoly = m_nav.GetTileAndPolyByRefUnsafe(startRef);
|
m_nav.GetTileAndPolyByRefUnsafe(startRef, out var startTile, out var startPoly);
|
||||||
DtMeshTile startTile = tileAndPoly.Item1;
|
|
||||||
DtPoly startPoly = tileAndPoly.Item2;
|
|
||||||
if (!filter.PassFilter(startRef, startTile, startPoly))
|
if (!filter.PassFilter(startRef, startTile, startPoly))
|
||||||
{
|
{
|
||||||
return Results.InvalidParam<FindRandomPointResult>("Invalid start ref");
|
return Results.InvalidParam<FindRandomPointResult>("Invalid start ref");
|
||||||
|
@ -267,9 +265,7 @@ namespace DotRecast.Detour
|
||||||
// Get poly and tile.
|
// Get poly and tile.
|
||||||
// The API input has been cheked already, skip checking internal data.
|
// The API input has been cheked already, skip checking internal data.
|
||||||
long bestRef = bestNode.id;
|
long bestRef = bestNode.id;
|
||||||
Tuple<DtMeshTile, DtPoly> bestTilePoly = m_nav.GetTileAndPolyByRefUnsafe(bestRef);
|
m_nav.GetTileAndPolyByRefUnsafe(bestRef, out var bestTile, out var bestPoly);
|
||||||
DtMeshTile bestTile = bestTilePoly.Item1;
|
|
||||||
DtPoly bestPoly = bestTilePoly.Item2;
|
|
||||||
|
|
||||||
// Place random locations on on ground.
|
// Place random locations on on ground.
|
||||||
if (bestPoly.GetPolyType() == DtPoly.DT_POLYTYPE_GROUND)
|
if (bestPoly.GetPolyType() == DtPoly.DT_POLYTYPE_GROUND)
|
||||||
|
@ -324,9 +320,7 @@ namespace DotRecast.Detour
|
||||||
}
|
}
|
||||||
|
|
||||||
// Expand to neighbour
|
// Expand to neighbour
|
||||||
Tuple<DtMeshTile, DtPoly> neighbourTilePoly = m_nav.GetTileAndPolyByRefUnsafe(neighbourRef);
|
m_nav.GetTileAndPolyByRefUnsafe(neighbourRef, out var neighbourTile, out var neighbourPoly);
|
||||||
DtMeshTile neighbourTile = neighbourTilePoly.Item1;
|
|
||||||
DtPoly neighbourPoly = neighbourTilePoly.Item2;
|
|
||||||
|
|
||||||
// Do not advance if the polygon is excluded by the filter.
|
// Do not advance if the polygon is excluded by the filter.
|
||||||
if (!filter.PassFilter(neighbourRef, neighbourTile, neighbourPoly))
|
if (!filter.PassFilter(neighbourRef, neighbourTile, neighbourPoly))
|
||||||
|
@ -818,9 +812,7 @@ namespace DotRecast.Detour
|
||||||
// Get current poly and tile.
|
// Get current poly and tile.
|
||||||
// The API input has been cheked already, skip checking internal data.
|
// The API input has been cheked already, skip checking internal data.
|
||||||
long bestRef = bestNode.id;
|
long bestRef = bestNode.id;
|
||||||
Tuple<DtMeshTile, DtPoly> tileAndPoly = m_nav.GetTileAndPolyByRefUnsafe(bestRef);
|
m_nav.GetTileAndPolyByRefUnsafe(bestRef, out var bestTile, out var bestPoly);
|
||||||
DtMeshTile bestTile = tileAndPoly.Item1;
|
|
||||||
DtPoly bestPoly = tileAndPoly.Item2;
|
|
||||||
|
|
||||||
// Get parent poly and tile.
|
// Get parent poly and tile.
|
||||||
long parentRef = 0, grandpaRef = 0;
|
long parentRef = 0, grandpaRef = 0;
|
||||||
|
@ -839,9 +831,7 @@ namespace DotRecast.Detour
|
||||||
|
|
||||||
if (parentRef != 0)
|
if (parentRef != 0)
|
||||||
{
|
{
|
||||||
tileAndPoly = m_nav.GetTileAndPolyByRefUnsafe(parentRef);
|
m_nav.GetTileAndPolyByRefUnsafe(parentRef, out parentTile, out parentPoly);
|
||||||
parentTile = tileAndPoly.Item1;
|
|
||||||
parentPoly = tileAndPoly.Item2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// decide whether to test raycast to previous nodes
|
// decide whether to test raycast to previous nodes
|
||||||
|
@ -867,9 +857,7 @@ namespace DotRecast.Detour
|
||||||
|
|
||||||
// Get neighbour poly and tile.
|
// Get neighbour poly and tile.
|
||||||
// The API input has been cheked already, skip checking internal data.
|
// The API input has been cheked already, skip checking internal data.
|
||||||
tileAndPoly = m_nav.GetTileAndPolyByRefUnsafe(neighbourRef);
|
m_nav.GetTileAndPolyByRefUnsafe(neighbourRef, out var neighbourTile, out var neighbourPoly);
|
||||||
DtMeshTile neighbourTile = tileAndPoly.Item1;
|
|
||||||
DtPoly neighbourPoly = tileAndPoly.Item2;
|
|
||||||
|
|
||||||
if (!filter.PassFilter(neighbourRef, neighbourTile, neighbourPoly))
|
if (!filter.PassFilter(neighbourRef, neighbourTile, neighbourPoly))
|
||||||
{
|
{
|
||||||
|
@ -1195,9 +1183,7 @@ namespace DotRecast.Detour
|
||||||
// Get neighbour poly and tile.
|
// Get neighbour poly and tile.
|
||||||
// The API input has been cheked already, skip checking internal
|
// The API input has been cheked already, skip checking internal
|
||||||
// data.
|
// data.
|
||||||
Tuple<DtMeshTile, DtPoly> tileAndPolyUns = m_nav.GetTileAndPolyByRefUnsafe(neighbourRef);
|
m_nav.GetTileAndPolyByRefUnsafe(neighbourRef, out var neighbourTile, out var neighbourPoly);
|
||||||
DtMeshTile neighbourTile = tileAndPolyUns.Item1;
|
|
||||||
DtPoly neighbourPoly = tileAndPolyUns.Item2;
|
|
||||||
|
|
||||||
if (!m_query.filter.PassFilter(neighbourRef, neighbourTile, neighbourPoly))
|
if (!m_query.filter.PassFilter(neighbourRef, neighbourTile, neighbourPoly))
|
||||||
{
|
{
|
||||||
|
@ -1540,7 +1526,7 @@ namespace DotRecast.Detour
|
||||||
{
|
{
|
||||||
List<StraightPathItem> straightPath = new List<StraightPathItem>();
|
List<StraightPathItem> straightPath = new List<StraightPathItem>();
|
||||||
if (!RcVec3f.IsFinite(startPos) || !RcVec3f.IsFinite(endPos)
|
if (!RcVec3f.IsFinite(startPos) || !RcVec3f.IsFinite(endPos)
|
||||||
|| null == path || 0 == path.Count || path[0] == 0 || maxStraightPath <= 0)
|
|| null == path || 0 == path.Count || path[0] == 0 || maxStraightPath <= 0)
|
||||||
{
|
{
|
||||||
return Results.InvalidParam<List<StraightPathItem>>();
|
return Results.InvalidParam<List<StraightPathItem>>();
|
||||||
}
|
}
|
||||||
|
@ -1833,9 +1819,7 @@ namespace DotRecast.Detour
|
||||||
// Get poly and tile.
|
// Get poly and tile.
|
||||||
// The API input has been cheked already, skip checking internal data.
|
// The API input has been cheked already, skip checking internal data.
|
||||||
long curRef = curNode.id;
|
long curRef = curNode.id;
|
||||||
Tuple<DtMeshTile, DtPoly> tileAndPoly = m_nav.GetTileAndPolyByRefUnsafe(curRef);
|
m_nav.GetTileAndPolyByRefUnsafe(curRef, out var curTile, out var curPoly);
|
||||||
DtMeshTile curTile = tileAndPoly.Item1;
|
|
||||||
DtPoly curPoly = tileAndPoly.Item2;
|
|
||||||
|
|
||||||
// Collect vertices.
|
// Collect vertices.
|
||||||
int nverts = curPoly.vertCount;
|
int nverts = curPoly.vertCount;
|
||||||
|
@ -1870,9 +1854,7 @@ namespace DotRecast.Detour
|
||||||
{
|
{
|
||||||
if (link.refs != 0)
|
if (link.refs != 0)
|
||||||
{
|
{
|
||||||
tileAndPoly = m_nav.GetTileAndPolyByRefUnsafe(link.refs);
|
m_nav.GetTileAndPolyByRefUnsafe(link.refs, out var neiTile, out var neiPoly);
|
||||||
DtMeshTile neiTile = tileAndPoly.Item1;
|
|
||||||
DtPoly neiPoly = tileAndPoly.Item2;
|
|
||||||
if (filter.PassFilter(link.refs, neiTile, neiPoly))
|
if (filter.PassFilter(link.refs, neiTile, neiPoly))
|
||||||
{
|
{
|
||||||
if (nneis < MAX_NEIS)
|
if (nneis < MAX_NEIS)
|
||||||
|
@ -2206,16 +2188,12 @@ namespace DotRecast.Detour
|
||||||
|
|
||||||
// The API input has been checked already, skip checking internal data.
|
// The API input has been checked already, skip checking internal data.
|
||||||
long curRef = startRef;
|
long curRef = startRef;
|
||||||
Tuple<DtMeshTile, DtPoly> tileAndPolyUns = m_nav.GetTileAndPolyByRefUnsafe(curRef);
|
m_nav.GetTileAndPolyByRefUnsafe(curRef, out tile, out poly);
|
||||||
tile = tileAndPolyUns.Item1;
|
|
||||||
poly = tileAndPolyUns.Item2;
|
|
||||||
nextTile = prevTile = tile;
|
nextTile = prevTile = tile;
|
||||||
nextPoly = prevPoly = poly;
|
nextPoly = prevPoly = poly;
|
||||||
if (prevRef != 0)
|
if (prevRef != 0)
|
||||||
{
|
{
|
||||||
tileAndPolyUns = m_nav.GetTileAndPolyByRefUnsafe(prevRef);
|
m_nav.GetTileAndPolyByRefUnsafe(prevRef, out prevTile, out prevPoly);
|
||||||
prevTile = tileAndPolyUns.Item1;
|
|
||||||
prevPoly = tileAndPolyUns.Item2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while (curRef != 0)
|
while (curRef != 0)
|
||||||
|
@ -2277,9 +2255,8 @@ namespace DotRecast.Detour
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get pointer to the next polygon.
|
// Get pointer to the next polygon.
|
||||||
tileAndPolyUns = m_nav.GetTileAndPolyByRefUnsafe(link.refs);
|
m_nav.GetTileAndPolyByRefUnsafe(link.refs, out nextTile, out nextPoly);
|
||||||
nextTile = tileAndPolyUns.Item1;
|
|
||||||
nextPoly = tileAndPolyUns.Item2;
|
|
||||||
// Skip off-mesh connections.
|
// Skip off-mesh connections.
|
||||||
if (nextPoly.GetPolyType() == DtPoly.DT_POLYTYPE_OFFMESH_CONNECTION)
|
if (nextPoly.GetPolyType() == DtPoly.DT_POLYTYPE_OFFMESH_CONNECTION)
|
||||||
{
|
{
|
||||||
|
@ -2486,9 +2463,7 @@ namespace DotRecast.Detour
|
||||||
// Get poly and tile.
|
// Get poly and tile.
|
||||||
// The API input has been cheked already, skip checking internal data.
|
// The API input has been cheked already, skip checking internal data.
|
||||||
long bestRef = bestNode.id;
|
long bestRef = bestNode.id;
|
||||||
Tuple<DtMeshTile, DtPoly> tileAndPoly = m_nav.GetTileAndPolyByRefUnsafe(bestRef);
|
m_nav.GetTileAndPolyByRefUnsafe(bestRef, out var bestTile, out var bestPoly);
|
||||||
DtMeshTile bestTile = tileAndPoly.Item1;
|
|
||||||
DtPoly bestPoly = tileAndPoly.Item2;
|
|
||||||
|
|
||||||
// Get parent poly and tile.
|
// Get parent poly and tile.
|
||||||
long parentRef = 0;
|
long parentRef = 0;
|
||||||
|
@ -2501,9 +2476,7 @@ namespace DotRecast.Detour
|
||||||
|
|
||||||
if (parentRef != 0)
|
if (parentRef != 0)
|
||||||
{
|
{
|
||||||
tileAndPoly = m_nav.GetTileAndPolyByRefUnsafe(parentRef);
|
m_nav.GetTileAndPolyByRefUnsafe(parentRef, out parentTile, out parentPoly);
|
||||||
parentTile = tileAndPoly.Item1;
|
|
||||||
parentPoly = tileAndPoly.Item2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resultRef.Add(bestRef);
|
resultRef.Add(bestRef);
|
||||||
|
@ -2521,9 +2494,7 @@ namespace DotRecast.Detour
|
||||||
}
|
}
|
||||||
|
|
||||||
// Expand to neighbour
|
// Expand to neighbour
|
||||||
tileAndPoly = m_nav.GetTileAndPolyByRefUnsafe(neighbourRef);
|
m_nav.GetTileAndPolyByRefUnsafe(neighbourRef, out var neighbourTile, out var neighbourPoly);
|
||||||
DtMeshTile neighbourTile = tileAndPoly.Item1;
|
|
||||||
DtPoly neighbourPoly = tileAndPoly.Item2;
|
|
||||||
|
|
||||||
// Do not advance if the polygon is excluded by the filter.
|
// Do not advance if the polygon is excluded by the filter.
|
||||||
if (!filter.PassFilter(neighbourRef, neighbourTile, neighbourPoly))
|
if (!filter.PassFilter(neighbourRef, neighbourTile, neighbourPoly))
|
||||||
|
@ -2673,9 +2644,7 @@ namespace DotRecast.Detour
|
||||||
// Get poly and tile.
|
// Get poly and tile.
|
||||||
// The API input has been cheked already, skip checking internal data.
|
// The API input has been cheked already, skip checking internal data.
|
||||||
long bestRef = bestNode.id;
|
long bestRef = bestNode.id;
|
||||||
Tuple<DtMeshTile, DtPoly> tileAndPoly = m_nav.GetTileAndPolyByRefUnsafe(bestRef);
|
m_nav.GetTileAndPolyByRefUnsafe(bestRef, out var bestTile, out var bestPoly);
|
||||||
DtMeshTile bestTile = tileAndPoly.Item1;
|
|
||||||
DtPoly bestPoly = tileAndPoly.Item2;
|
|
||||||
|
|
||||||
// Get parent poly and tile.
|
// Get parent poly and tile.
|
||||||
long parentRef = 0;
|
long parentRef = 0;
|
||||||
|
@ -2688,9 +2657,7 @@ namespace DotRecast.Detour
|
||||||
|
|
||||||
if (parentRef != 0)
|
if (parentRef != 0)
|
||||||
{
|
{
|
||||||
tileAndPoly = m_nav.GetTileAndPolyByRefUnsafe(parentRef);
|
m_nav.GetTileAndPolyByRefUnsafe(parentRef, out parentTile, out parentPoly);
|
||||||
parentTile = tileAndPoly.Item1;
|
|
||||||
parentPoly = tileAndPoly.Item2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resultRef.Add(bestRef);
|
resultRef.Add(bestRef);
|
||||||
|
@ -2708,9 +2675,7 @@ namespace DotRecast.Detour
|
||||||
}
|
}
|
||||||
|
|
||||||
// Expand to neighbour
|
// Expand to neighbour
|
||||||
tileAndPoly = m_nav.GetTileAndPolyByRefUnsafe(neighbourRef);
|
m_nav.GetTileAndPolyByRefUnsafe(neighbourRef, out var neighbourTile, out var neighbourPoly);
|
||||||
DtMeshTile neighbourTile = tileAndPoly.Item1;
|
|
||||||
DtPoly neighbourPoly = tileAndPoly.Item2;
|
|
||||||
|
|
||||||
// Do not advance if the polygon is excluded by the filter.
|
// Do not advance if the polygon is excluded by the filter.
|
||||||
if (!filter.PassFilter(neighbourRef, neighbourTile, neighbourPoly))
|
if (!filter.PassFilter(neighbourRef, neighbourTile, neighbourPoly))
|
||||||
|
@ -2856,9 +2821,7 @@ namespace DotRecast.Detour
|
||||||
// Get poly and tile.
|
// Get poly and tile.
|
||||||
// The API input has been cheked already, skip checking internal data.
|
// The API input has been cheked already, skip checking internal data.
|
||||||
long curRef = curNode.id;
|
long curRef = curNode.id;
|
||||||
Tuple<DtMeshTile, DtPoly> tileAndPoly = m_nav.GetTileAndPolyByRefUnsafe(curRef);
|
m_nav.GetTileAndPolyByRefUnsafe(curRef, out var curTile, out var curPoly);
|
||||||
DtMeshTile curTile = tileAndPoly.Item1;
|
|
||||||
DtPoly curPoly = tileAndPoly.Item2;
|
|
||||||
|
|
||||||
for (int i = curTile.polyLinks[curPoly.index]; i != DtNavMesh.DT_NULL_LINK; i = curTile.links[i].next)
|
for (int i = curTile.polyLinks[curPoly.index]; i != DtNavMesh.DT_NULL_LINK; i = curTile.links[i].next)
|
||||||
{
|
{
|
||||||
|
@ -2878,9 +2841,7 @@ namespace DotRecast.Detour
|
||||||
}
|
}
|
||||||
|
|
||||||
// Expand to neighbour
|
// Expand to neighbour
|
||||||
tileAndPoly = m_nav.GetTileAndPolyByRefUnsafe(neighbourRef);
|
m_nav.GetTileAndPolyByRefUnsafe(neighbourRef, out var neighbourTile, out var neighbourPoly);
|
||||||
DtMeshTile neighbourTile = tileAndPoly.Item1;
|
|
||||||
DtPoly neighbourPoly = tileAndPoly.Item2;
|
|
||||||
|
|
||||||
// Skip off-mesh connections.
|
// Skip off-mesh connections.
|
||||||
if (neighbourPoly.GetPolyType() == DtPoly.DT_POLYTYPE_OFFMESH_CONNECTION)
|
if (neighbourPoly.GetPolyType() == DtPoly.DT_POLYTYPE_OFFMESH_CONNECTION)
|
||||||
|
@ -2948,9 +2909,7 @@ namespace DotRecast.Detour
|
||||||
}
|
}
|
||||||
|
|
||||||
// Potentially overlapping.
|
// Potentially overlapping.
|
||||||
tileAndPoly = m_nav.GetTileAndPolyByRefUnsafe(pastRef);
|
m_nav.GetTileAndPolyByRefUnsafe(pastRef, out var pastTile, out var pastPoly);
|
||||||
DtMeshTile pastTile = tileAndPoly.Item1;
|
|
||||||
DtPoly pastPoly = tileAndPoly.Item2;
|
|
||||||
|
|
||||||
// Get vertices and test overlap
|
// Get vertices and test overlap
|
||||||
int npb = pastPoly.vertCount;
|
int npb = pastPoly.vertCount;
|
||||||
|
@ -3053,9 +3012,7 @@ namespace DotRecast.Detour
|
||||||
{
|
{
|
||||||
if (link.refs != 0)
|
if (link.refs != 0)
|
||||||
{
|
{
|
||||||
Tuple<DtMeshTile, DtPoly> tileAndPolyUnsafe = m_nav.GetTileAndPolyByRefUnsafe(link.refs);
|
m_nav.GetTileAndPolyByRefUnsafe(link.refs, out var neiTile, out var neiPoly);
|
||||||
DtMeshTile neiTile = tileAndPolyUnsafe.Item1;
|
|
||||||
DtPoly neiPoly = tileAndPolyUnsafe.Item2;
|
|
||||||
if (filter.PassFilter(link.refs, neiTile, neiPoly))
|
if (filter.PassFilter(link.refs, neiTile, neiPoly))
|
||||||
{
|
{
|
||||||
InsertInterval(ints, link.bmin, link.bmax, link.refs);
|
InsertInterval(ints, link.bmin, link.bmax, link.refs);
|
||||||
|
@ -3191,9 +3148,7 @@ namespace DotRecast.Detour
|
||||||
// Get poly and tile.
|
// Get poly and tile.
|
||||||
// The API input has been cheked already, skip checking internal data.
|
// The API input has been cheked already, skip checking internal data.
|
||||||
long bestRef = bestNode.id;
|
long bestRef = bestNode.id;
|
||||||
Tuple<DtMeshTile, DtPoly> tileAndPoly = m_nav.GetTileAndPolyByRefUnsafe(bestRef);
|
m_nav.GetTileAndPolyByRefUnsafe(bestRef, out var bestTile, out var bestPoly);
|
||||||
DtMeshTile bestTile = tileAndPoly.Item1;
|
|
||||||
DtPoly bestPoly = tileAndPoly.Item2;
|
|
||||||
|
|
||||||
// Get parent poly and tile.
|
// Get parent poly and tile.
|
||||||
long parentRef = 0;
|
long parentRef = 0;
|
||||||
|
@ -3217,9 +3172,7 @@ namespace DotRecast.Detour
|
||||||
{
|
{
|
||||||
if (link.refs != 0)
|
if (link.refs != 0)
|
||||||
{
|
{
|
||||||
Tuple<DtMeshTile, DtPoly> linkTileAndPoly = m_nav.GetTileAndPolyByRefUnsafe(link.refs);
|
m_nav.GetTileAndPolyByRefUnsafe(link.refs, out var neiTile, out var neiPoly);
|
||||||
DtMeshTile neiTile = linkTileAndPoly.Item1;
|
|
||||||
DtPoly neiPoly = linkTileAndPoly.Item2;
|
|
||||||
if (filter.PassFilter(link.refs, neiTile, neiPoly))
|
if (filter.PassFilter(link.refs, neiTile, neiPoly))
|
||||||
{
|
{
|
||||||
solid = false;
|
solid = false;
|
||||||
|
@ -3280,9 +3233,7 @@ namespace DotRecast.Detour
|
||||||
}
|
}
|
||||||
|
|
||||||
// Expand to neighbour.
|
// Expand to neighbour.
|
||||||
Tuple<DtMeshTile, DtPoly> neighbourTileAndPoly = m_nav.GetTileAndPolyByRefUnsafe(neighbourRef);
|
m_nav.GetTileAndPolyByRefUnsafe(neighbourRef, out var neighbourTile, out var neighbourPoly);
|
||||||
DtMeshTile neighbourTile = neighbourTileAndPoly.Item1;
|
|
||||||
DtPoly neighbourPoly = neighbourTileAndPoly.Item2;
|
|
||||||
|
|
||||||
// Skip off-mesh connections.
|
// Skip off-mesh connections.
|
||||||
if (neighbourPoly.GetPolyType() == DtPoly.DT_POLYTYPE_OFFMESH_CONNECTION)
|
if (neighbourPoly.GetPolyType() == DtPoly.DT_POLYTYPE_OFFMESH_CONNECTION)
|
||||||
|
|
|
@ -89,9 +89,7 @@ namespace DotRecast.Detour
|
||||||
// Get current poly and tile.
|
// Get current poly and tile.
|
||||||
// The API input has been cheked already, skip checking internal data.
|
// The API input has been cheked already, skip checking internal data.
|
||||||
long bestRef = bestNode.id;
|
long bestRef = bestNode.id;
|
||||||
Tuple<DtMeshTile, DtPoly> tileAndPoly = m_nav.GetTileAndPolyByRefUnsafe(bestRef);
|
m_nav.GetTileAndPolyByRefUnsafe(bestRef, out var bestTile, out var bestPoly);
|
||||||
DtMeshTile bestTile = tileAndPoly.Item1;
|
|
||||||
DtPoly bestPoly = tileAndPoly.Item2;
|
|
||||||
|
|
||||||
// Get parent poly and tile.
|
// Get parent poly and tile.
|
||||||
long parentRef = 0;
|
long parentRef = 0;
|
||||||
|
@ -104,9 +102,7 @@ namespace DotRecast.Detour
|
||||||
|
|
||||||
if (parentRef != 0)
|
if (parentRef != 0)
|
||||||
{
|
{
|
||||||
tileAndPoly = m_nav.GetTileAndPolyByRefUnsafe(parentRef);
|
m_nav.GetTileAndPolyByRefUnsafe(parentRef, out parentTile, out parentPoly);
|
||||||
parentTile = tileAndPoly.Item1;
|
|
||||||
parentPoly = tileAndPoly.Item2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = bestTile.polyLinks[bestPoly.index]; i != DtNavMesh.DT_NULL_LINK; i = bestTile.links[i].next)
|
for (int i = bestTile.polyLinks[bestPoly.index]; i != DtNavMesh.DT_NULL_LINK; i = bestTile.links[i].next)
|
||||||
|
@ -121,10 +117,7 @@ namespace DotRecast.Detour
|
||||||
|
|
||||||
// Get neighbour poly and tile.
|
// Get neighbour poly and tile.
|
||||||
// The API input has been cheked already, skip checking internal data.
|
// The API input has been cheked already, skip checking internal data.
|
||||||
tileAndPoly = m_nav.GetTileAndPolyByRefUnsafe(neighbourRef);
|
m_nav.GetTileAndPolyByRefUnsafe(neighbourRef, out var neighbourTile, out var neighbourPoly);
|
||||||
DtMeshTile neighbourTile = tileAndPoly.Item1;
|
|
||||||
DtPoly neighbourPoly = tileAndPoly.Item2;
|
|
||||||
|
|
||||||
if (!filter.PassFilter(neighbourRef, neighbourTile, neighbourPoly))
|
if (!filter.PassFilter(neighbourRef, neighbourTile, neighbourPoly))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
@ -337,10 +330,7 @@ namespace DotRecast.Detour
|
||||||
// Get neighbour poly and tile.
|
// Get neighbour poly and tile.
|
||||||
// The API input has been cheked already, skip checking internal
|
// The API input has been cheked already, skip checking internal
|
||||||
// data.
|
// data.
|
||||||
Tuple<DtMeshTile, DtPoly> tileAndPolyUns = m_nav.GetTileAndPolyByRefUnsafe(neighbourRef);
|
m_nav.GetTileAndPolyByRefUnsafe(neighbourRef, out var neighbourTile, out var neighbourPoly);
|
||||||
DtMeshTile neighbourTile = tileAndPolyUns.Item1;
|
|
||||||
DtPoly neighbourPoly = tileAndPolyUns.Item2;
|
|
||||||
|
|
||||||
if (!m_query.filter.PassFilter(neighbourRef, neighbourTile, neighbourPoly))
|
if (!m_query.filter.PassFilter(neighbourRef, neighbourTile, neighbourPoly))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
@ -680,9 +670,7 @@ namespace DotRecast.Detour
|
||||||
// Get poly and tile.
|
// Get poly and tile.
|
||||||
// The API input has been cheked already, skip checking internal data.
|
// The API input has been cheked already, skip checking internal data.
|
||||||
long bestRef = bestNode.id;
|
long bestRef = bestNode.id;
|
||||||
Tuple<DtMeshTile, DtPoly> tileAndPoly = m_nav.GetTileAndPolyByRefUnsafe(bestRef);
|
m_nav.GetTileAndPolyByRefUnsafe(bestRef, out var bestTile, out var bestPoly);
|
||||||
DtMeshTile bestTile = tileAndPoly.Item1;
|
|
||||||
DtPoly bestPoly = tileAndPoly.Item2;
|
|
||||||
|
|
||||||
// Get parent poly and tile.
|
// Get parent poly and tile.
|
||||||
long parentRef = 0;
|
long parentRef = 0;
|
||||||
|
@ -706,9 +694,7 @@ namespace DotRecast.Detour
|
||||||
{
|
{
|
||||||
if (link.refs != 0)
|
if (link.refs != 0)
|
||||||
{
|
{
|
||||||
Tuple<DtMeshTile, DtPoly> linkTileAndPoly = m_nav.GetTileAndPolyByRefUnsafe(link.refs);
|
m_nav.GetTileAndPolyByRefUnsafe(link.refs, out var neiTile, out var neiPoly);
|
||||||
DtMeshTile neiTile = linkTileAndPoly.Item1;
|
|
||||||
DtPoly neiPoly = linkTileAndPoly.Item2;
|
|
||||||
if (filter.PassFilter(link.refs, neiTile, neiPoly))
|
if (filter.PassFilter(link.refs, neiTile, neiPoly))
|
||||||
{
|
{
|
||||||
solid = false;
|
solid = false;
|
||||||
|
@ -738,7 +724,7 @@ namespace DotRecast.Detour
|
||||||
// Calc distance to the edge.
|
// Calc distance to the edge.
|
||||||
int vj = bestPoly.verts[j] * 3;
|
int vj = bestPoly.verts[j] * 3;
|
||||||
int vi = bestPoly.verts[i] * 3;
|
int vi = bestPoly.verts[i] * 3;
|
||||||
var distSqr = DetourCommon.DistancePtSegSqr2D(centerPos, bestTile.data.verts, vj, vi, out var tseg);
|
var distSqr = DetourCommon.DistancePtSegSqr2D(centerPos, bestTile.data.verts, vj, vi, out var tseg);
|
||||||
// Edge is too far, skip.
|
// Edge is too far, skip.
|
||||||
if (distSqr > radiusSqr)
|
if (distSqr > radiusSqr)
|
||||||
{
|
{
|
||||||
|
@ -768,9 +754,7 @@ namespace DotRecast.Detour
|
||||||
}
|
}
|
||||||
|
|
||||||
// Expand to neighbour.
|
// Expand to neighbour.
|
||||||
Tuple<DtMeshTile, DtPoly> neighbourTileAndPoly = m_nav.GetTileAndPolyByRefUnsafe(neighbourRef);
|
m_nav.GetTileAndPolyByRefUnsafe(neighbourRef, out var neighbourTile, out var neighbourPoly);
|
||||||
DtMeshTile neighbourTile = neighbourTileAndPoly.Item1;
|
|
||||||
DtPoly neighbourPoly = neighbourTileAndPoly.Item2;
|
|
||||||
|
|
||||||
// Skip off-mesh connections.
|
// Skip off-mesh connections.
|
||||||
if (neighbourPoly.GetPolyType() == DtPoly.DT_POLYTYPE_OFFMESH_CONNECTION)
|
if (neighbourPoly.GetPolyType() == DtPoly.DT_POLYTYPE_OFFMESH_CONNECTION)
|
||||||
|
|
|
@ -334,8 +334,7 @@ public class TestNavmeshTool : ITool
|
||||||
var epos = RcVec3f.Of(m_epos.x, m_epos.y, m_epos.z);
|
var epos = RcVec3f.Of(m_epos.x, m_epos.y, m_epos.z);
|
||||||
if (m_polys[m_polys.Count - 1] != m_endRef)
|
if (m_polys[m_polys.Count - 1] != m_endRef)
|
||||||
{
|
{
|
||||||
Result<ClosestPointOnPolyResult> result = m_navQuery
|
Result<ClosestPointOnPolyResult> result = m_navQuery.ClosestPointOnPoly(m_polys[m_polys.Count - 1], m_epos);
|
||||||
.ClosestPointOnPoly(m_polys[m_polys.Count - 1], m_epos);
|
|
||||||
if (result.Succeeded())
|
if (result.Succeeded())
|
||||||
{
|
{
|
||||||
epos = result.result.GetClosest();
|
epos = result.result.GetClosest();
|
||||||
|
@ -995,8 +994,7 @@ public class TestNavmeshTool : ITool
|
||||||
epos = m_epos;
|
epos = m_epos;
|
||||||
if (m_polys[m_polys.Count - 1] != m_endRef)
|
if (m_polys[m_polys.Count - 1] != m_endRef)
|
||||||
{
|
{
|
||||||
Result<ClosestPointOnPolyResult> result = m_navQuery
|
Result<ClosestPointOnPolyResult> result = m_navQuery.ClosestPointOnPoly(m_polys[m_polys.Count - 1], m_epos);
|
||||||
.ClosestPointOnPoly(m_polys[m_polys.Count - 1], m_epos);
|
|
||||||
if (result.Succeeded())
|
if (result.Succeeded())
|
||||||
{
|
{
|
||||||
epos = result.result.GetClosest();
|
epos = result.result.GetClosest();
|
||||||
|
|
Loading…
Reference in New Issue