This commit is contained in:
c0nd3v 2023-12-21 11:23:13 -05:00 committed by Ikpil
parent 9c7f34c521
commit b1db6df033
9 changed files with 55 additions and 55 deletions

View File

@ -297,7 +297,7 @@ namespace DotRecast.Detour
tile = m_tiles[it]; tile = m_tiles[it];
poly = m_tiles[it].data.polys[ip]; poly = m_tiles[it].data.polys[ip];
return DtStatus.DT_SUCCSESS; return DtStatus.DT_SUCCESS;
} }
/// @par /// @par
@ -1586,7 +1586,7 @@ namespace DotRecast.Detour
startPos = RcVecUtils.Create(tile.data.verts, poly.verts[idx0] * 3); startPos = RcVecUtils.Create(tile.data.verts, poly.verts[idx0] * 3);
endPos = RcVecUtils.Create(tile.data.verts, poly.verts[idx1] * 3); endPos = RcVecUtils.Create(tile.data.verts, poly.verts[idx1] * 3);
return DtStatus.DT_SUCCSESS; return DtStatus.DT_SUCCESS;
} }
public int GetMaxVertsPerPoly() public int GetMaxVertsPerPoly()
@ -1632,7 +1632,7 @@ namespace DotRecast.Detour
// Change flags. // Change flags.
poly.flags = flags; poly.flags = flags;
return DtStatus.DT_SUCCSESS; return DtStatus.DT_SUCCESS;
} }
/// Gets the user defined flags for the specified polygon. /// Gets the user defined flags for the specified polygon.
@ -1669,7 +1669,7 @@ namespace DotRecast.Detour
resultFlags = poly.flags; resultFlags = poly.flags;
return DtStatus.DT_SUCCSESS; return DtStatus.DT_SUCCESS;
} }
public DtStatus SetPolyArea(long refs, char area) public DtStatus SetPolyArea(long refs, char area)
@ -1700,7 +1700,7 @@ namespace DotRecast.Detour
poly.SetArea(area); poly.SetArea(area);
return DtStatus.DT_SUCCSESS; return DtStatus.DT_SUCCESS;
} }
public DtStatus GetPolyArea(long refs, out int resultArea) public DtStatus GetPolyArea(long refs, out int resultArea)
@ -1732,7 +1732,7 @@ namespace DotRecast.Detour
DtPoly poly = tile.data.polys[ip]; DtPoly poly = tile.data.polys[ip];
resultArea = poly.GetArea(); resultArea = poly.GetArea();
return DtStatus.DT_SUCCSESS; return DtStatus.DT_SUCCESS;
} }
public RcVec3f GetPolyCenter(long refs) public RcVec3f GetPolyCenter(long refs)

View File

@ -151,7 +151,7 @@ namespace DotRecast.Detour
randomRef = polyRef; randomRef = polyRef;
randomPt = closest; randomPt = closest;
return DtStatus.DT_SUCCSESS; return DtStatus.DT_SUCCESS;
} }
/** /**
@ -229,7 +229,7 @@ namespace DotRecast.Detour
startNode.flags = DtNodeFlags.DT_NODE_OPEN; startNode.flags = DtNodeFlags.DT_NODE_OPEN;
m_openList.Push(startNode); m_openList.Push(startNode);
DtStatus status = DtStatus.DT_SUCCSESS; DtStatus status = DtStatus.DT_SUCCESS;
float radiusSqr = maxRadius * maxRadius; float radiusSqr = maxRadius * maxRadius;
float areaSum = 0.0f; float areaSum = 0.0f;
@ -412,7 +412,7 @@ namespace DotRecast.Detour
} }
m_nav.ClosestPointOnPoly(refs, pos, out closest, out posOverPoly); m_nav.ClosestPointOnPoly(refs, pos, out closest, out posOverPoly);
return DtStatus.DT_SUCCSESS; return DtStatus.DT_SUCCESS;
} }
/// @par /// @par
@ -479,7 +479,7 @@ namespace DotRecast.Detour
closest = RcVecUtils.Lerp(verts, va, vb, edget[imin]); closest = RcVecUtils.Lerp(verts, va, vb, edget[imin]);
} }
return DtStatus.DT_SUCCSESS; return DtStatus.DT_SUCCESS;
} }
/// @par /// @par
@ -519,7 +519,7 @@ namespace DotRecast.Detour
DtUtils.DistancePtSegSqr2D(pos, v0, v1, out var t); DtUtils.DistancePtSegSqr2D(pos, v0, v1, out var t);
height = v0.Y + (v1.Y - v0.Y) * t; height = v0.Y + (v1.Y - v0.Y) * t;
return DtStatus.DT_SUCCSESS; return DtStatus.DT_SUCCESS;
} }
if (!m_nav.GetPolyHeight(tile, poly, pos, out var h)) if (!m_nav.GetPolyHeight(tile, poly, pos, out var h))
@ -528,7 +528,7 @@ namespace DotRecast.Detour
} }
height = h; height = h;
return DtStatus.DT_SUCCSESS; return DtStatus.DT_SUCCESS;
} }
/// Finds the polygon nearest to the specified center point. /// Finds the polygon nearest to the specified center point.
@ -560,7 +560,7 @@ namespace DotRecast.Detour
nearestPt = query.NearestPt(); nearestPt = query.NearestPt();
isOverPoly = query.OverPoly(); isOverPoly = query.OverPoly();
return DtStatus.DT_SUCCSESS; return DtStatus.DT_SUCCESS;
} }
// FIXME: (PP) duplicate? // FIXME: (PP) duplicate?
@ -686,7 +686,7 @@ namespace DotRecast.Detour
QueryPolygonsInTile(t, bmin, bmax, filter, query); QueryPolygonsInTile(t, bmin, bmax, filter, query);
} }
return DtStatus.DT_SUCCSESS; return DtStatus.DT_SUCCESS;
} }
/** /**
@ -768,7 +768,7 @@ namespace DotRecast.Detour
if (startRef == endRef) if (startRef == endRef)
{ {
path.Add(startRef); path.Add(startRef);
return DtStatus.DT_SUCCSESS; return DtStatus.DT_SUCCESS;
} }
m_nodePool.Clear(); m_nodePool.Clear();
@ -1037,8 +1037,8 @@ namespace DotRecast.Detour
if (startRef == endRef) if (startRef == endRef)
{ {
m_query.status = DtStatus.DT_SUCCSESS; m_query.status = DtStatus.DT_SUCCESS;
return DtStatus.DT_SUCCSESS; return DtStatus.DT_SUCCESS;
} }
m_nodePool.Clear(); m_nodePool.Clear();
@ -1097,7 +1097,7 @@ namespace DotRecast.Detour
{ {
m_query.lastBestNode = bestNode; m_query.lastBestNode = bestNode;
var details = m_query.status & DtStatus.DT_STATUS_DETAIL_MASK; var details = m_query.status & DtStatus.DT_STATUS_DETAIL_MASK;
m_query.status = DtStatus.DT_SUCCSESS | details; m_query.status = DtStatus.DT_SUCCESS | details;
doneIters = iter; doneIters = iter;
return m_query.status; return m_query.status;
} }
@ -1295,7 +1295,7 @@ namespace DotRecast.Detour
if (m_openList.IsEmpty()) if (m_openList.IsEmpty())
{ {
var details = m_query.status & DtStatus.DT_STATUS_DETAIL_MASK; var details = m_query.status & DtStatus.DT_STATUS_DETAIL_MASK;
m_query.status = DtStatus.DT_SUCCSESS | details; m_query.status = DtStatus.DT_SUCCESS | details;
} }
doneIters = iter; doneIters = iter;
@ -1341,7 +1341,7 @@ namespace DotRecast.Detour
// Reset query. // Reset query.
m_query = new DtQueryData(); m_query = new DtQueryData();
return DtStatus.DT_SUCCSESS | details; return DtStatus.DT_SUCCESS | details;
} }
/// Finalizes and returns the results of an incomplete sliced path query, returning the path to the furthest /// Finalizes and returns the results of an incomplete sliced path query, returning the path to the furthest
@ -1402,7 +1402,7 @@ namespace DotRecast.Detour
// Reset query. // Reset query.
m_query = new DtQueryData(); m_query = new DtQueryData();
return DtStatus.DT_SUCCSESS | details; return DtStatus.DT_SUCCESS | details;
} }
protected DtStatus AppendVertex(RcVec3f pos, int flags, long refs, ref List<DtStraightPath> straightPath, protected DtStatus AppendVertex(RcVec3f pos, int flags, long refs, ref List<DtStraightPath> straightPath,
@ -1424,7 +1424,7 @@ namespace DotRecast.Detour
// If reached end of path or there is no space to append more vertices, return. // If reached end of path or there is no space to append more vertices, return.
if (flags == DtStraightPathFlags.DT_STRAIGHTPATH_END || straightPath.Count >= maxStraightPath) if (flags == DtStraightPathFlags.DT_STRAIGHTPATH_END || straightPath.Count >= maxStraightPath)
{ {
return DtStatus.DT_SUCCSESS; return DtStatus.DT_SUCCESS;
} }
} }
@ -1736,7 +1736,7 @@ namespace DotRecast.Detour
// Ignore status return value as we're just about to return anyway. // Ignore status return value as we're just about to return anyway.
AppendVertex(closestEndPos, DtStraightPathFlags.DT_STRAIGHTPATH_END, 0, ref straightPath, maxStraightPath); AppendVertex(closestEndPos, DtStraightPathFlags.DT_STRAIGHTPATH_END, 0, ref straightPath, maxStraightPath);
return DtStatus.DT_SUCCSESS | (straightPath.Count >= maxStraightPath ? DtStatus.DT_BUFFER_TOO_SMALL : DtStatus.DT_STATUS_NOTHING); return DtStatus.DT_SUCCESS | (straightPath.Count >= maxStraightPath ? DtStatus.DT_BUFFER_TOO_SMALL : DtStatus.DT_STATUS_NOTHING);
} }
/// @par /// @par
@ -1942,7 +1942,7 @@ namespace DotRecast.Detour
resultPos = bestPos; resultPos = bestPos;
return DtStatus.DT_SUCCSESS; return DtStatus.DT_SUCCESS;
} }
protected DtStatus GetPortalPoints(long from, long to, out RcVec3f left, out RcVec3f right, out int fromType, out int toType) protected DtStatus GetPortalPoints(long from, long to, out RcVec3f left, out RcVec3f right, out int fromType, out int toType)
@ -2012,7 +2012,7 @@ namespace DotRecast.Detour
right.Y = fromTile.data.verts[fromPoly.verts[v] * 3 + 1]; right.Y = fromTile.data.verts[fromPoly.verts[v] * 3 + 1];
right.Z = fromTile.data.verts[fromPoly.verts[v] * 3 + 2]; right.Z = fromTile.data.verts[fromPoly.verts[v] * 3 + 2];
return DtStatus.DT_SUCCSESS; return DtStatus.DT_SUCCESS;
} }
} }
@ -2034,7 +2034,7 @@ namespace DotRecast.Detour
right.Y = toTile.data.verts[toPoly.verts[v] * 3 + 1]; right.Y = toTile.data.verts[toPoly.verts[v] * 3 + 1];
right.Z = toTile.data.verts[toPoly.verts[v] * 3 + 2]; right.Z = toTile.data.verts[toPoly.verts[v] * 3 + 2];
return DtStatus.DT_SUCCSESS; return DtStatus.DT_SUCCESS;
} }
} }
@ -2067,7 +2067,7 @@ namespace DotRecast.Detour
} }
} }
return DtStatus.DT_SUCCSESS; return DtStatus.DT_SUCCESS;
} }
protected DtStatus GetEdgeMidPoint(long from, DtPoly fromPoly, DtMeshTile fromTile, long to, protected DtStatus GetEdgeMidPoint(long from, DtPoly fromPoly, DtMeshTile fromTile, long to,
@ -2083,7 +2083,7 @@ namespace DotRecast.Detour
mid.Y = (left.Y + right.Y) * 0.5f; mid.Y = (left.Y + right.Y) * 0.5f;
mid.Z = (left.Z + right.Z) * 0.5f; mid.Z = (left.Z + right.Z) * 0.5f;
return DtStatus.DT_SUCCSESS; return DtStatus.DT_SUCCESS;
} }
protected DtStatus GetEdgeIntersectionPoint(RcVec3f fromPos, long from, DtPoly fromPoly, DtMeshTile fromTile, protected DtStatus GetEdgeIntersectionPoint(RcVec3f fromPos, long from, DtPoly fromPoly, DtMeshTile fromTile,
@ -2103,7 +2103,7 @@ namespace DotRecast.Detour
} }
pt = RcVec3f.Lerp(left, right, t); pt = RcVec3f.Lerp(left, right, t);
return DtStatus.DT_SUCCSESS; return DtStatus.DT_SUCCESS;
} }
@ -2210,7 +2210,7 @@ namespace DotRecast.Detour
if (!intersects) if (!intersects)
{ {
// Could not hit the polygon, keep the old t and report hit. // Could not hit the polygon, keep the old t and report hit.
return DtStatus.DT_SUCCSESS; return DtStatus.DT_SUCCESS;
} }
hit.hitEdgeIndex = segMax; hit.hitEdgeIndex = segMax;
@ -2236,7 +2236,7 @@ namespace DotRecast.Detour
curRef, tile, poly); curRef, tile, poly);
} }
return DtStatus.DT_SUCCSESS; return DtStatus.DT_SUCCESS;
} }
// Follow neighbours. // Follow neighbours.
@ -2364,7 +2364,7 @@ namespace DotRecast.Detour
float dx = verts[b].X - verts[a].X; float dx = verts[b].X - verts[a].X;
float dz = verts[b].Z - verts[a].X; float dz = verts[b].Z - verts[a].X;
hit.hitNormal = RcVec3f.Normalize(new RcVec3f(dz, 0, -dx)); hit.hitNormal = RcVec3f.Normalize(new RcVec3f(dz, 0, -dx));
return DtStatus.DT_SUCCSESS; return DtStatus.DT_SUCCESS;
} }
// No hit, advance to neighbour polygon. // No hit, advance to neighbour polygon.
@ -2376,7 +2376,7 @@ namespace DotRecast.Detour
poly = nextPoly; poly = nextPoly;
} }
return DtStatus.DT_SUCCSESS; return DtStatus.DT_SUCCESS;
} }
/// @par /// @par
@ -2556,7 +2556,7 @@ namespace DotRecast.Detour
} }
} }
return DtStatus.DT_SUCCSESS; return DtStatus.DT_SUCCESS;
} }
/// @par /// @par
@ -2739,7 +2739,7 @@ namespace DotRecast.Detour
} }
} }
return DtStatus.DT_SUCCSESS; return DtStatus.DT_SUCCESS;
} }
/// @par /// @par
@ -2925,7 +2925,7 @@ namespace DotRecast.Detour
} }
} }
return DtStatus.DT_SUCCSESS; return DtStatus.DT_SUCCESS;
} }
@ -3077,7 +3077,7 @@ namespace DotRecast.Detour
} }
} }
return DtStatus.DT_SUCCSESS; return DtStatus.DT_SUCCESS;
} }
/// @par /// @par
@ -3133,7 +3133,7 @@ namespace DotRecast.Detour
var bestvj = RcVec3f.Zero; var bestvj = RcVec3f.Zero;
var bestvi = RcVec3f.Zero; var bestvi = RcVec3f.Zero;
var status = DtStatus.DT_SUCCSESS; var status = DtStatus.DT_SUCCESS;
while (!m_openList.IsEmpty()) while (!m_openList.IsEmpty())
{ {
DtNode bestNode = m_openList.Pop(); DtNode bestNode = m_openList.Pop();
@ -3393,7 +3393,7 @@ namespace DotRecast.Detour
} while (curNode != null); } while (curNode != null);
path.Reverse(); path.Reverse();
return DtStatus.DT_SUCCSESS; return DtStatus.DT_SUCCESS;
} }
/** /**

View File

@ -26,7 +26,7 @@ namespace DotRecast.Detour
{ {
// High level status. // High level status.
public static readonly DtStatus DT_FAILURE = new DtStatus(1u << 31); // Operation failed. public static readonly DtStatus DT_FAILURE = new DtStatus(1u << 31); // Operation failed.
public static readonly DtStatus DT_SUCCSESS = new DtStatus(1u << 30); // Operation succeed. public static readonly DtStatus DT_SUCCESS = new DtStatus(1u << 30); // Operation succeed.
public static readonly DtStatus DT_IN_PROGRESS = new DtStatus(1u << 29); // Operation still in progress. public static readonly DtStatus DT_IN_PROGRESS = new DtStatus(1u << 29); // Operation still in progress.
// Detail information for status. // Detail information for status.
@ -57,7 +57,7 @@ namespace DotRecast.Detour
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Succeeded() public bool Succeeded()
{ {
return 0 != (Value & (DT_SUCCSESS.Value | DT_PARTIAL_RESULT.Value)); return 0 != (Value & (DT_SUCCESS.Value | DT_PARTIAL_RESULT.Value));
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]

View File

@ -160,7 +160,7 @@ namespace DotRecast.Recast.Toolset.Tools
} }
} }
return DtStatus.DT_SUCCSESS; return DtStatus.DT_SUCCESS;
} }
public DtStatus FindStraightPath(DtNavMeshQuery navQuery, long startRef, long endRef, RcVec3f startPt, RcVec3f endPt, IDtQueryFilter filter, bool enableRaycast, public DtStatus FindStraightPath(DtNavMeshQuery navQuery, long startRef, long endRef, RcVec3f startPt, RcVec3f endPt, IDtQueryFilter filter, bool enableRaycast,
@ -196,7 +196,7 @@ namespace DotRecast.Recast.Toolset.Tools
navQuery.FindStraightPath(startPt, epos, polys, ref straightPath, MAX_POLYS, straightPathOptions); navQuery.FindStraightPath(startPt, epos, polys, ref straightPath, MAX_POLYS, straightPathOptions);
return DtStatus.DT_SUCCSESS; return DtStatus.DT_SUCCESS;
} }
public DtStatus InitSlicedFindPath(DtNavMeshQuery navQuery, long startRef, long endRef, RcVec3f startPos, RcVec3f endPos, IDtQueryFilter filter, bool enableRaycast) public DtStatus InitSlicedFindPath(DtNavMeshQuery navQuery, long startRef, long endRef, RcVec3f startPos, RcVec3f endPos, IDtQueryFilter filter, bool enableRaycast)
@ -242,7 +242,7 @@ namespace DotRecast.Recast.Toolset.Tools
navQuery.FindStraightPath(startPos, epos, path, ref straightPath, MAX_POLYS, DtStraightPathOptions.DT_STRAIGHTPATH_ALL_CROSSINGS); navQuery.FindStraightPath(startPos, epos, path, ref straightPath, MAX_POLYS, DtStraightPathOptions.DT_STRAIGHTPATH_ALL_CROSSINGS);
} }
return DtStatus.DT_SUCCSESS; return DtStatus.DT_SUCCESS;
} }
@ -438,7 +438,7 @@ namespace DotRecast.Recast.Toolset.Tools
} }
} }
return DtStatus.DT_SUCCSESS; return DtStatus.DT_SUCCESS;
} }
} }
} }

View File

@ -59,7 +59,7 @@ public class PathCorridorTest
{ {
refStraightPath = straightPath; refStraightPath = straightPath;
}) })
.Returns(() => DtStatus.DT_SUCCSESS); .Returns(() => DtStatus.DT_SUCCESS);
var path = new List<DtStraightPath>(); var path = new List<DtStraightPath>();
corridor.FindCorners(ref path, int.MaxValue, mockQuery.Object, filter); corridor.FindCorners(ref path, int.MaxValue, mockQuery.Object, filter);
@ -90,7 +90,7 @@ public class PathCorridorTest
{ {
refStraightPath = straightPath; refStraightPath = straightPath;
}) })
.Returns(() => DtStatus.DT_SUCCSESS); .Returns(() => DtStatus.DT_SUCCESS);
var path = new List<DtStraightPath>(); var path = new List<DtStraightPath>();
corridor.FindCorners(ref path, int.MaxValue, mockQuery.Object, filter); corridor.FindCorners(ref path, int.MaxValue, mockQuery.Object, filter);

View File

@ -37,7 +37,7 @@ public class UnityAStarPathfindingImporterTest
RcVec3f endPos = new RcVec3f(11.971109f, 0.000000f, 8.663261f); RcVec3f endPos = new RcVec3f(11.971109f, 0.000000f, 8.663261f);
var path = new List<long>(); var path = new List<long>();
var status = FindPath(mesh, startPos, endPos, ref path); var status = FindPath(mesh, startPos, endPos, ref path);
Assert.That(status, Is.EqualTo(DtStatus.DT_SUCCSESS)); Assert.That(status, Is.EqualTo(DtStatus.DT_SUCCESS));
Assert.That(path.Count, Is.EqualTo(57)); Assert.That(path.Count, Is.EqualTo(57));
SaveMesh(mesh, "v4_0_6"); SaveMesh(mesh, "v4_0_6");
} }

View File

@ -27,11 +27,11 @@ public class FindPathTest : AbstractDetourTest
{ {
private static readonly DtStatus[] STATUSES = private static readonly DtStatus[] STATUSES =
{ {
DtStatus.DT_SUCCSESS, DtStatus.DT_SUCCESS,
DtStatus.DT_SUCCSESS | DtStatus.DT_PARTIAL_RESULT, DtStatus.DT_SUCCESS | DtStatus.DT_PARTIAL_RESULT,
DtStatus.DT_SUCCSESS, DtStatus.DT_SUCCESS,
DtStatus.DT_SUCCSESS, DtStatus.DT_SUCCESS,
DtStatus.DT_SUCCSESS DtStatus.DT_SUCCESS
}; };
private static readonly long[][] RESULTS = private static readonly long[][] RESULTS =

View File

@ -26,7 +26,7 @@ namespace DotRecast.Detour.Test;
[Parallelizable] [Parallelizable]
public class TiledFindPathTest public class TiledFindPathTest
{ {
private static readonly DtStatus[] STATUSES = { DtStatus.DT_SUCCSESS }; private static readonly DtStatus[] STATUSES = { DtStatus.DT_SUCCESS };
private static readonly long[][] RESULTS = private static readonly long[][] RESULTS =
{ {

View File

@ -33,7 +33,7 @@ public class TileCacheNavigationTest : AbstractTileCacheTest
protected readonly long[] endRefs = { 281474986147841L }; protected readonly long[] endRefs = { 281474986147841L };
protected readonly RcVec3f[] startPoss = { new RcVec3f(39.447338f, 9.998177f, -0.784811f) }; protected readonly RcVec3f[] startPoss = { new RcVec3f(39.447338f, 9.998177f, -0.784811f) };
protected readonly RcVec3f[] endPoss = { new RcVec3f(19.292645f, 11.611748f, -57.750366f) }; protected readonly RcVec3f[] endPoss = { new RcVec3f(19.292645f, 11.611748f, -57.750366f) };
private readonly DtStatus[] statuses = { DtStatus.DT_SUCCSESS }; private readonly DtStatus[] statuses = { DtStatus.DT_SUCCESS };
private readonly long[][] results = private readonly long[][] results =
{ {