From 5457bb04e5bc33f99fce01a3c62ed4b4890f5553 Mon Sep 17 00:00:00 2001 From: ikpil Date: Thu, 8 Jun 2023 21:38:02 +0900 Subject: [PATCH] changed class names by c++ recastnavigation --- .../{Crowd.cs => DtCrowd.cs} | 186 +++--- .../{CrowdAgent.cs => DtCrowdAgent.cs} | 26 +- ...tAnimation.cs => DtCrowdAgentAnimation.cs} | 2 +- ...wdAgentParams.cs => DtCrowdAgentParams.cs} | 2 +- .../{CrowdConfig.cs => DtCrowdConfig.cs} | 4 +- ...{CrowdNeighbour.cs => DtCrowdNeighbour.cs} | 6 +- ...{CrowdTelemetry.cs => DtCrowdTelemetry.cs} | 2 +- .../{LocalBoundary.cs => DtLocalBoundary.cs} | 14 +- ...Params.cs => DtObstacleAvoidanceParams.cs} | 6 +- ...ceQuery.cs => DtObstacleAvoidanceQuery.cs} | 44 +- ...{ObstacleCircle.cs => DtObstacleCircle.cs} | 2 +- ...bstacleSegment.cs => DtObstacleSegment.cs} | 2 +- .../{PathCorridor.cs => DtPathCorridor.cs} | 28 +- .../{PathQuery.cs => DtPathQuery.cs} | 8 +- ...athQueryResult.cs => DtPathQueryResult.cs} | 4 +- .../{PathQueue.cs => DtPathQueue.cs} | 20 +- .../{ProximityGrid.cs => DtProximityGrid.cs} | 16 +- .../{Segment.cs => DtSegment.cs} | 2 +- ...tDebugInfo.cs => DtCrowdAgentDebugInfo.cs} | 6 +- ...ata.cs => DtObstacleAvoidanceDebugData.cs} | 6 +- .../DynamicNavMesh.cs | 12 +- src/DotRecast.Detour.Dynamic/DynamicTile.cs | 10 +- src/DotRecast.Detour.Extras/BVTreeBuilder.cs | 6 +- .../Jumplink/NavMeshGroundSampler.cs | 12 +- .../Jumplink/NoOpFilter.cs | 18 - .../Jumplink/PolyQueryInvoker.cs | 8 +- src/DotRecast.Detour.Extras/ObjExporter.cs | 8 +- src/DotRecast.Detour.Extras/PolyUtils.cs | 4 +- .../Unity/Astar/BVTreeCreator.cs | 2 +- .../Unity/Astar/GraphMeshData.cs | 14 +- .../Unity/Astar/GraphMeshDataReader.cs | 18 +- .../Unity/Astar/LinkBuilder.cs | 20 +- .../Unity/Astar/OffMeshLinkCreator.cs | 16 +- .../Astar/UnityAStarPathfindingImporter.cs | 10 +- .../ITileCacheMeshProcess.cs | 2 +- .../Io/TileCacheReader.cs | 2 +- .../Io/TileCacheSetHeader.cs | 2 +- src/DotRecast.Detour.TileCache/TileCache.cs | 18 +- src/DotRecast.Detour/DetourBuilder.cs | 4 +- .../{BVNode.cs => DtBVNode.cs} | 2 +- ...PolyQuery.cs => DtFindNearestPolyQuery.cs} | 8 +- src/DotRecast.Detour/{Link.cs => DtLink.cs} | 2 +- .../{MeshData.cs => DtMeshData.cs} | 12 +- .../{MeshHeader.cs => DtMeshHeader.cs} | 2 +- .../{MeshTile.cs => DtMeshTile.cs} | 10 +- .../{NavMesh.cs => DtNavMesh.cs} | 210 +++--- ...eateParams.cs => DtNavMeshCreateParams.cs} | 2 +- .../{NavMeshParams.cs => DtNavMeshParams.cs} | 2 +- .../{NavMeshQuery.cs => DtNavMeshQuery.cs} | 622 +++++++++--------- src/DotRecast.Detour/{Node.cs => DtNode.cs} | 4 +- .../{NodePool.cs => DtNodePool.cs} | 32 +- .../{NodeQueue.cs => DtNodeQueue.cs} | 12 +- ...shConnection.cs => DtOffMeshConnection.cs} | 2 +- src/DotRecast.Detour/{Poly.cs => DtPoly.cs} | 4 +- .../{PolyDetail.cs => DtPolyDetail.cs} | 2 +- .../{QueryData.cs => DtQueryData.cs} | 8 +- ...QueryFilter.cs => DtQueryDefaultFilter.cs} | 22 +- src/DotRecast.Detour/DtQueryEmptyFilter.cs | 18 + src/DotRecast.Detour/DtQueryNoOpFilter.cs | 18 + .../{RaycastHit.cs => DtRaycastHit.cs} | 2 +- .../{SegInterval.cs => DtSegInterval.cs} | 4 +- .../{Status.cs => DtStatus.cs} | 14 +- src/DotRecast.Detour/DtStatusExtension.cs | 25 + src/DotRecast.Detour/IDtPolyQuery.cs | 7 + .../{IQueryFilter.cs => IDtQueryFilter.cs} | 8 +- src/DotRecast.Detour/IPolyQuery.cs | 7 - src/DotRecast.Detour/Io/MeshDataReader.cs | 56 +- src/DotRecast.Detour/Io/MeshDataWriter.cs | 16 +- src/DotRecast.Detour/Io/MeshSetReader.cs | 24 +- src/DotRecast.Detour/Io/MeshSetWriter.cs | 10 +- src/DotRecast.Detour/Io/NavMeshParamReader.cs | 4 +- src/DotRecast.Detour/Io/NavMeshParamWriter.cs | 2 +- src/DotRecast.Detour/Io/NavMeshSetHeader.cs | 2 +- src/DotRecast.Detour/LegacyNavMeshQuery.cs | 206 +++--- src/DotRecast.Detour/NavMeshBuilder.cs | 50 +- src/DotRecast.Detour/NavMeshRaycast.cs | 12 +- src/DotRecast.Detour/NavMeshUtils.cs | 4 +- src/DotRecast.Detour/PathUtils.cs | 16 +- src/DotRecast.Detour/QueryResults/Result.cs | 22 +- src/DotRecast.Detour/StatusEx.cs | 25 - src/DotRecast.Detour/StraightPathItem.cs | 2 - .../StrictPolygonByCircleConstraint.cs | 2 - .../Draw/NavMeshRenderer.cs | 4 +- .../Draw/RecastDebugDraw.cs | 94 +-- src/DotRecast.Recast.Demo/RecastDemo.cs | 4 +- src/DotRecast.Recast.Demo/Sample.cs | 16 +- .../Tools/CrowdProfilingTool.cs | 56 +- src/DotRecast.Recast.Demo/Tools/CrowdTool.cs | 100 +-- .../Tools/TestNavmeshTool.cs | 50 +- .../Builder/AbstractNavMeshBuilder.cs | 6 +- .../Builder/SoloNavMeshBuilder.cs | 10 +- .../Builder/TileNavMeshBuilder.cs | 16 +- .../AbstractCrowdTest.cs | 40 +- .../DotRecast.Detour.Crowd.Test/Crowd1Test.cs | 46 +- .../DotRecast.Detour.Crowd.Test/Crowd4Test.cs | 18 +- .../Crowd4VelocityTest.cs | 6 +- .../PathCorridorTest.cs | 12 +- .../RecastTestMeshBuilder.cs | 6 +- .../DynamicNavMeshTest.cs | 14 +- .../UnityAStarPathfindingImporterTest.cs | 34 +- .../AbstractDetourTest.cs | 10 +- .../FindDistanceToWallTest.cs | 2 +- .../FindLocalNeighbourhoodTest.cs | 2 +- .../FindNearestPolyTest.cs | 17 +- test/DotRecast.Detour.Test/FindPathTest.cs | 18 +- .../FindPolysAroundCircleTest.cs | 2 +- .../FindPolysAroundShapeTest.cs | 2 +- .../GetPolyWallSegmentsTest.cs | 2 +- .../Io/MeshDataReaderWriterTest.cs | 4 +- .../Io/MeshSetReaderTest.cs | 12 +- .../Io/MeshSetReaderWriterTest.cs | 6 +- .../MoveAlongSurfaceTest.cs | 2 +- .../NavMeshBuilderTest.cs | 6 +- test/DotRecast.Detour.Test/RandomPointTest.cs | 12 +- .../RecastTestMeshBuilder.cs | 6 +- .../TestDetourBuilder.cs | 8 +- .../TestTiledNavMeshBuilder.cs | 10 +- .../TiledFindPathTest.cs | 12 +- .../AbstractTileCacheTest.cs | 6 +- .../Io/TileCacheReaderTest.cs | 12 +- .../Io/TileCacheReaderWriterTest.cs | 6 +- .../TempObstaclesTest.cs | 8 +- .../TileCacheFindPathTest.cs | 8 +- .../TileCacheNavigationTest.cs | 12 +- .../TileCacheTest.cs | 12 +- 125 files changed, 1406 insertions(+), 1409 deletions(-) rename src/DotRecast.Detour.Crowd/{Crowd.cs => DtCrowd.cs} (88%) rename src/DotRecast.Detour.Crowd/{CrowdAgent.cs => DtCrowdAgent.cs} (90%) rename src/DotRecast.Detour.Crowd/{CrowdAgentAnimation.cs => DtCrowdAgentAnimation.cs} (97%) rename src/DotRecast.Detour.Crowd/{CrowdAgentParams.cs => DtCrowdAgentParams.cs} (98%) rename src/DotRecast.Detour.Crowd/{CrowdConfig.cs => DtCrowdConfig.cs} (96%) rename src/DotRecast.Detour.Crowd/{CrowdNeighbour.cs => DtCrowdNeighbour.cs} (74%) rename src/DotRecast.Detour.Crowd/{CrowdTelemetry.cs => DtCrowdTelemetry.cs} (98%) rename src/DotRecast.Detour.Crowd/{LocalBoundary.cs => DtLocalBoundary.cs} (93%) rename src/DotRecast.Detour.Crowd/{ObstacleAvoidanceParams.cs => DtObstacleAvoidanceParams.cs} (88%) rename src/DotRecast.Detour.Crowd/{ObstacleAvoidanceQuery.cs => DtObstacleAvoidanceQuery.cs} (92%) rename src/DotRecast.Detour.Crowd/{ObstacleCircle.cs => DtObstacleCircle.cs} (94%) rename src/DotRecast.Detour.Crowd/{ObstacleSegment.cs => DtObstacleSegment.cs} (88%) rename src/DotRecast.Detour.Crowd/{PathCorridor.cs => DtPathCorridor.cs} (95%) rename src/DotRecast.Detour.Crowd/{PathQuery.cs => DtPathQuery.cs} (87%) rename src/DotRecast.Detour.Crowd/{PathQueryResult.cs => DtPathQueryResult.cs} (93%) rename src/DotRecast.Detour.Crowd/{PathQueue.cs => DtPathQueue.cs} (84%) rename src/DotRecast.Detour.Crowd/{ProximityGrid.cs => DtProximityGrid.cs} (87%) rename src/DotRecast.Detour.Crowd/{Segment.cs => DtSegment.cs} (88%) rename src/DotRecast.Detour.Crowd/Tracking/{CrowdAgentDebugInfo.cs => DtCrowdAgentDebugInfo.cs} (90%) rename src/DotRecast.Detour.Crowd/Tracking/{ObstacleAvoidanceDebugData.cs => DtObstacleAvoidanceDebugData.cs} (96%) delete mode 100644 src/DotRecast.Detour.Extras/Jumplink/NoOpFilter.cs rename src/DotRecast.Detour/{BVNode.cs => DtBVNode.cs} (98%) rename src/DotRecast.Detour/{FindNearestPolyQuery.cs => DtFindNearestPolyQuery.cs} (86%) rename src/DotRecast.Detour/{Link.cs => DtLink.cs} (98%) rename src/DotRecast.Detour/{MeshData.cs => DtMeshData.cs} (89%) rename src/DotRecast.Detour/{MeshHeader.cs => DtMeshHeader.cs} (99%) rename src/DotRecast.Detour/{MeshTile.cs => DtMeshTile.cs} (86%) rename src/DotRecast.Detour/{NavMesh.cs => DtNavMesh.cs} (89%) rename src/DotRecast.Detour/{NavMeshDataCreateParams.cs => DtNavMeshCreateParams.cs} (99%) rename src/DotRecast.Detour/{NavMeshParams.cs => DtNavMeshParams.cs} (98%) rename src/DotRecast.Detour/{NavMeshQuery.cs => DtNavMeshQuery.cs} (86%) rename src/DotRecast.Detour/{Node.cs => DtNode.cs} (97%) rename src/DotRecast.Detour/{NodePool.cs => DtNodePool.cs} (76%) rename src/DotRecast.Detour/{NodeQueue.cs => DtNodeQueue.cs} (84%) rename src/DotRecast.Detour/{OffMeshConnection.cs => DtOffMeshConnection.cs} (98%) rename src/DotRecast.Detour/{Poly.cs => DtPoly.cs} (97%) rename src/DotRecast.Detour/{PolyDetail.cs => DtPolyDetail.cs} (97%) rename src/DotRecast.Detour/{QueryData.cs => DtQueryData.cs} (90%) rename src/DotRecast.Detour/{DefaultQueryFilter.cs => DtQueryDefaultFilter.cs} (82%) create mode 100644 src/DotRecast.Detour/DtQueryEmptyFilter.cs create mode 100644 src/DotRecast.Detour/DtQueryNoOpFilter.cs rename src/DotRecast.Detour/{RaycastHit.cs => DtRaycastHit.cs} (98%) rename src/DotRecast.Detour/{SegInterval.cs => DtSegInterval.cs} (71%) rename src/DotRecast.Detour/{Status.cs => DtStatus.cs} (72%) create mode 100644 src/DotRecast.Detour/DtStatusExtension.cs create mode 100644 src/DotRecast.Detour/IDtPolyQuery.cs rename src/DotRecast.Detour/{IQueryFilter.cs => IDtQueryFilter.cs} (77%) delete mode 100644 src/DotRecast.Detour/IPolyQuery.cs delete mode 100644 src/DotRecast.Detour/StatusEx.cs diff --git a/src/DotRecast.Detour.Crowd/Crowd.cs b/src/DotRecast.Detour.Crowd/DtCrowd.cs similarity index 88% rename from src/DotRecast.Detour.Crowd/Crowd.cs rename to src/DotRecast.Detour.Crowd/DtCrowd.cs index 3334043..2bf80af 100644 --- a/src/DotRecast.Detour.Crowd/Crowd.cs +++ b/src/DotRecast.Detour.Crowd/DtCrowd.cs @@ -121,7 +121,7 @@ namespace DotRecast.Detour.Crowd * * @see DtAllocCrowd(), DtFreeCrowd(), Init(), dtCrowdAgent */ - public class Crowd + public class DtCrowd { /// The maximum number of corners a crowd agent will look ahead in the path. /// This value is used for sizing the crowd agent corner buffers. @@ -144,30 +144,30 @@ namespace DotRecast.Detour.Crowd public const int DT_CROWD_MAX_QUERY_FILTER_TYPE = 16; private readonly RcAtomicInteger _agentId = new RcAtomicInteger(); - private readonly List _agents; - private readonly PathQueue _pathQ; - private readonly ObstacleAvoidanceParams[] _obstacleQueryParams = new ObstacleAvoidanceParams[DT_CROWD_MAX_OBSTAVOIDANCE_PARAMS]; - private readonly ObstacleAvoidanceQuery _obstacleQuery; - private ProximityGrid _grid; + private readonly List _agents; + private readonly DtPathQueue _pathQ; + private readonly DtObstacleAvoidanceParams[] _obstacleQueryParams = new DtObstacleAvoidanceParams[DT_CROWD_MAX_OBSTAVOIDANCE_PARAMS]; + private readonly DtObstacleAvoidanceQuery _obstacleQuery; + private DtProximityGrid _grid; private readonly RcVec3f _ext = new RcVec3f(); - private readonly IQueryFilter[] _filters = new IQueryFilter[DT_CROWD_MAX_QUERY_FILTER_TYPE]; - private NavMeshQuery _navQuery; - private NavMesh _navMesh; - private readonly CrowdConfig _config; - private readonly CrowdTelemetry _telemetry = new CrowdTelemetry(); + private readonly IDtQueryFilter[] _filters = new IDtQueryFilter[DT_CROWD_MAX_QUERY_FILTER_TYPE]; + private DtNavMeshQuery _navQuery; + private DtNavMesh _navMesh; + private readonly DtCrowdConfig _config; + private readonly DtCrowdTelemetry _telemetry = new DtCrowdTelemetry(); private int _velocitySampleCount; - public Crowd(CrowdConfig config, NavMesh nav) : - this(config, nav, i => new DefaultQueryFilter()) + public DtCrowd(DtCrowdConfig config, DtNavMesh nav) : + this(config, nav, i => new DtQueryDefaultFilter()) { } - public Crowd(CrowdConfig config, NavMesh nav, Func queryFilterFactory) + public DtCrowd(DtCrowdConfig config, DtNavMesh nav, Func queryFilterFactory) { _config = config; _ext.Set(config.maxAgentRadius * 2.0f, config.maxAgentRadius * 1.5f, config.maxAgentRadius * 2.0f); - _obstacleQuery = new ObstacleAvoidanceQuery(config.maxObstacleAvoidanceCircles, config.maxObstacleAvoidanceSegments); + _obstacleQuery = new DtObstacleAvoidanceQuery(config.maxObstacleAvoidanceCircles, config.maxObstacleAvoidanceSegments); for (int i = 0; i < DT_CROWD_MAX_QUERY_FILTER_TYPE; i++) { @@ -177,33 +177,33 @@ namespace DotRecast.Detour.Crowd // Init obstacle query option. for (int i = 0; i < DT_CROWD_MAX_OBSTAVOIDANCE_PARAMS; ++i) { - _obstacleQueryParams[i] = new ObstacleAvoidanceParams(); + _obstacleQueryParams[i] = new DtObstacleAvoidanceParams(); } // Allocate temp buffer for merging paths. - _pathQ = new PathQueue(config); - _agents = new List(); + _pathQ = new DtPathQueue(config); + _agents = new List(); // The navQuery is mostly used for local searches, no need for large node pool. _navMesh = nav; - _navQuery = new NavMeshQuery(nav); + _navQuery = new DtNavMeshQuery(nav); } - public void SetNavMesh(NavMesh nav) + public void SetNavMesh(DtNavMesh nav) { _navMesh = nav; - _navQuery = new NavMeshQuery(nav); + _navQuery = new DtNavMeshQuery(nav); } /// Sets the shared avoidance configuration for the specified index. /// @param[in] idx The index. [Limits: 0 <= value < /// #DT_CROWD_MAX_OBSTAVOIDANCE_PARAMS] /// @param[in] option The new configuration. - public void SetObstacleAvoidanceParams(int idx, ObstacleAvoidanceParams option) + public void SetObstacleAvoidanceParams(int idx, DtObstacleAvoidanceParams option) { if (idx >= 0 && idx < DT_CROWD_MAX_OBSTAVOIDANCE_PARAMS) { - _obstacleQueryParams[idx] = new ObstacleAvoidanceParams(option); + _obstacleQueryParams[idx] = new DtObstacleAvoidanceParams(option); } } @@ -211,7 +211,7 @@ namespace DotRecast.Detour.Crowd /// @param[in] idx The index of the configuration to retreive. /// [Limits: 0 <= value < #DT_CROWD_MAX_OBSTAVOIDANCE_PARAMS] /// @return The requested configuration. - public ObstacleAvoidanceParams GetObstacleAvoidanceParams(int idx) + public DtObstacleAvoidanceParams GetObstacleAvoidanceParams(int idx) { if (idx >= 0 && idx < DT_CROWD_MAX_OBSTAVOIDANCE_PARAMS) { @@ -224,7 +224,7 @@ namespace DotRecast.Detour.Crowd /// Updates the specified agent's configuration. /// @param[in] idx The agent index. [Limits: 0 <= value < #GetAgentCount()] /// @param[in] params The new agent configuration. - public void UpdateAgentParameters(CrowdAgent agent, CrowdAgentParams option) + public void UpdateAgentParameters(DtCrowdAgent agent, DtCrowdAgentParams option) { agent.option = option; } @@ -238,9 +238,9 @@ namespace DotRecast.Detour.Crowd * The configutation of the agent. * @return The newly created agent object */ - public CrowdAgent AddAgent(RcVec3f pos, CrowdAgentParams option) + public DtCrowdAgent AddAgent(RcVec3f pos, DtCrowdAgentParams option) { - CrowdAgent ag = new CrowdAgent(_agentId.GetAndIncrement()); + DtCrowdAgent ag = new DtCrowdAgent(_agentId.GetAndIncrement()); _agents.Add(ag); UpdateAgentParameters(ag, option); @@ -283,12 +283,12 @@ namespace DotRecast.Detour.Crowd * @param agent * Agent to be removed */ - public void RemoveAgent(CrowdAgent agent) + public void RemoveAgent(DtCrowdAgent agent) { _agents.Remove(agent); } - private bool RequestMoveTargetReplan(CrowdAgent ag, long refs, RcVec3f pos) + private bool RequestMoveTargetReplan(DtCrowdAgent ag, long refs, RcVec3f pos) { ag.SetTarget(refs, pos); ag.targetReplan = true; @@ -306,7 +306,7 @@ namespace DotRecast.Detour.Crowd /// The position will be constrained to the surface of the navigation mesh. /// /// The request will be processed during the next #Update(). - public bool RequestMoveTarget(CrowdAgent agent, long refs, RcVec3f pos) + public bool RequestMoveTarget(DtCrowdAgent agent, long refs, RcVec3f pos) { if (refs == 0) { @@ -323,7 +323,7 @@ namespace DotRecast.Detour.Crowd /// @param[in] idx The agent index. [Limits: 0 <= value < #GetAgentCount()] /// @param[in] vel The movement velocity. [(x, y, z)] /// @return True if the request was successfully submitted. - public bool RequestMoveVelocity(CrowdAgent agent, RcVec3f vel) + public bool RequestMoveVelocity(DtCrowdAgent agent, RcVec3f vel) { // Initialize request. agent.targetRef = 0; @@ -338,7 +338,7 @@ namespace DotRecast.Detour.Crowd /// Resets any request for the specified agent. /// @param[in] idx The agent index. [Limits: 0 <= value < #GetAgentCount()] /// @return True if the request was successfully reseted. - public bool ResetMoveTarget(CrowdAgent agent) + public bool ResetMoveTarget(DtCrowdAgent agent) { // Initialize request. agent.targetRef = 0; @@ -355,7 +355,7 @@ namespace DotRecast.Detour.Crowd * * @return List of active agents */ - public IList GetActiveAgents() + public IList GetActiveAgents() { return _agents; } @@ -365,38 +365,38 @@ namespace DotRecast.Detour.Crowd return _ext; } - public IQueryFilter GetFilter(int i) + public IDtQueryFilter GetFilter(int i) { return i >= 0 && i < DT_CROWD_MAX_QUERY_FILTER_TYPE ? _filters[i] : null; } - public ProximityGrid GetGrid() + public DtProximityGrid GetGrid() { return _grid; } - public PathQueue GetPathQueue() + public DtPathQueue GetPathQueue() { return _pathQ; } - public CrowdTelemetry Telemetry() + public DtCrowdTelemetry Telemetry() { return _telemetry; } - public CrowdConfig Config() + public DtCrowdConfig Config() { return _config; } - public CrowdTelemetry Update(float dt, CrowdAgentDebugInfo debug) + public DtCrowdTelemetry Update(float dt, DtCrowdAgentDebugInfo debug) { _velocitySampleCount = 0; _telemetry.Start(); - IList agents = GetActiveAgents(); + IList agents = GetActiveAgents(); // Check that all agents still have valid paths. CheckPathValidity(agents, dt); @@ -439,11 +439,11 @@ namespace DotRecast.Detour.Crowd } - private void CheckPathValidity(IList agents, float dt) + private void CheckPathValidity(IList agents, float dt) { _telemetry.Start("checkPathValidity"); - foreach (CrowdAgent ag in agents) + foreach (DtCrowdAgent ag in agents) { if (ag.state != CrowdAgentState.DT_CROWDAGENT_STATE_WALKING) { @@ -561,14 +561,14 @@ namespace DotRecast.Detour.Crowd _telemetry.Stop("checkPathValidity"); } - private void UpdateMoveRequest(IList agents, float dt) + private void UpdateMoveRequest(IList agents, float dt) { _telemetry.Start("updateMoveRequest"); - RcSortedQueue queue = new RcSortedQueue((a1, a2) => a2.targetReplanTime.CompareTo(a1.targetReplanTime)); + RcSortedQueue queue = new RcSortedQueue((a1, a2) => a2.targetReplanTime.CompareTo(a1.targetReplanTime)); // Fire off new requests. - foreach (CrowdAgent ag in agents) + foreach (DtCrowdAgent ag in agents) { if (ag.state == CrowdAgentState.DT_CROWDAGENT_STATE_INVALID) { @@ -666,7 +666,7 @@ namespace DotRecast.Detour.Crowd while (!queue.IsEmpty()) { - CrowdAgent ag = queue.Dequeue(); + DtCrowdAgent ag = queue.Dequeue(); ag.targetPathQueryResult = _pathQ.Request(ag.corridor.GetLastPoly(), ag.targetRef, ag.corridor.GetTarget(), ag.targetPos, _filters[ag.option.queryFilterType]); if (ag.targetPathQueryResult != null) @@ -686,7 +686,7 @@ namespace DotRecast.Detour.Crowd _telemetry.Stop("pathQueueUpdate"); // Process path results. - foreach (CrowdAgent ag in agents) + foreach (DtCrowdAgent ag in agents) { if (ag.targetState == MoveRequestState.DT_CROWDAGENT_TARGET_NONE || ag.targetState == MoveRequestState.DT_CROWDAGENT_TARGET_VELOCITY) @@ -698,7 +698,7 @@ namespace DotRecast.Detour.Crowd { // _telemetry.RecordPathWaitTime(ag.targetReplanTime); // Poll path queue. - Status status = ag.targetPathQueryResult.status; + DtStatus status = ag.targetPathQueryResult.status; if (status != null && status.IsFailed()) { // Path find failed, retry if the target location is still @@ -821,13 +821,13 @@ namespace DotRecast.Detour.Crowd _telemetry.Stop("updateMoveRequest"); } - private void UpdateTopologyOptimization(IList agents, float dt) + private void UpdateTopologyOptimization(IList agents, float dt) { _telemetry.Start("updateTopologyOptimization"); - RcSortedQueue queue = new RcSortedQueue((a1, a2) => a2.topologyOptTime.CompareTo(a1.topologyOptTime)); + RcSortedQueue queue = new RcSortedQueue((a1, a2) => a2.topologyOptTime.CompareTo(a1.topologyOptTime)); - foreach (CrowdAgent ag in agents) + foreach (DtCrowdAgent ag in agents) { if (ag.state != CrowdAgentState.DT_CROWDAGENT_STATE_WALKING) { @@ -840,7 +840,7 @@ namespace DotRecast.Detour.Crowd continue; } - if ((ag.option.updateFlags & CrowdAgentParams.DT_CROWD_OPTIMIZE_TOPO) == 0) + if ((ag.option.updateFlags & DtCrowdAgentParams.DT_CROWD_OPTIMIZE_TOPO) == 0) { continue; } @@ -854,7 +854,7 @@ namespace DotRecast.Detour.Crowd while (!queue.IsEmpty()) { - CrowdAgent ag = queue.Dequeue(); + DtCrowdAgent ag = queue.Dequeue(); ag.corridor.OptimizePathTopology(_navQuery, _filters[ag.option.queryFilterType], _config.maxTopologyOptimizationIterations); ag.topologyOptTime = 0; } @@ -862,12 +862,12 @@ namespace DotRecast.Detour.Crowd _telemetry.Stop("updateTopologyOptimization"); } - private void BuildProximityGrid(IList agents) + private void BuildProximityGrid(IList agents) { _telemetry.Start("buildProximityGrid"); - _grid = new ProximityGrid(_config.maxAgentRadius * 3); + _grid = new DtProximityGrid(_config.maxAgentRadius * 3); - foreach (CrowdAgent ag in agents) + foreach (DtCrowdAgent ag in agents) { RcVec3f p = ag.npos; float r = ag.option.radius; @@ -877,10 +877,10 @@ namespace DotRecast.Detour.Crowd _telemetry.Stop("buildProximityGrid"); } - private void BuildNeighbours(IList agents) + private void BuildNeighbours(IList agents) { _telemetry.Start("buildNeighbours"); - foreach (CrowdAgent ag in agents) + foreach (DtCrowdAgent ag in agents) { if (ag.state != CrowdAgentState.DT_CROWDAGENT_STATE_WALKING) { @@ -905,11 +905,11 @@ namespace DotRecast.Detour.Crowd } - private List GetNeighbours(RcVec3f pos, float height, float range, CrowdAgent skip, ProximityGrid grid) + private List GetNeighbours(RcVec3f pos, float height, float range, DtCrowdAgent skip, DtProximityGrid grid) { - HashSet proxAgents = grid.QueryItems(pos.x - range, pos.z - range, pos.x + range, pos.z + range); - List result = new List(proxAgents.Count); - foreach (CrowdAgent ag in proxAgents) + HashSet proxAgents = grid.QueryItems(pos.x - range, pos.z - range, pos.x + range, pos.z + range); + List result = new List(proxAgents.Count); + foreach (DtCrowdAgent ag in proxAgents) { if (ag == skip) { @@ -930,18 +930,18 @@ namespace DotRecast.Detour.Crowd continue; } - result.Add(new CrowdNeighbour(ag, distSqr)); + result.Add(new DtCrowdNeighbour(ag, distSqr)); } result.Sort((o1, o2) => o1.dist.CompareTo(o2.dist)); return result; } - private void FindCorners(IList agents, CrowdAgentDebugInfo debug) + private void FindCorners(IList agents, DtCrowdAgentDebugInfo debug) { _telemetry.Start("findCorners"); - CrowdAgent debugAgent = debug != null ? debug.agent : null; - foreach (CrowdAgent ag in agents) + DtCrowdAgent debugAgent = debug != null ? debug.agent : null; + foreach (DtCrowdAgent ag in agents) { if (ag.state != CrowdAgentState.DT_CROWDAGENT_STATE_WALKING) { @@ -959,7 +959,7 @@ namespace DotRecast.Detour.Crowd // Check to see if the corner after the next corner is directly visible, // and short cut to there. - if ((ag.option.updateFlags & CrowdAgentParams.DT_CROWD_OPTIMIZE_VIS) != 0 && ag.corners.Count > 0) + if ((ag.option.updateFlags & DtCrowdAgentParams.DT_CROWD_OPTIMIZE_VIS) != 0 && ag.corners.Count > 0) { RcVec3f target = ag.corners[Math.Min(1, ag.corners.Count - 1)].GetPos(); ag.corridor.OptimizePathVisibility(target, ag.option.pathOptimizationRange, _navQuery, @@ -986,10 +986,10 @@ namespace DotRecast.Detour.Crowd _telemetry.Stop("findCorners"); } - private void TriggerOffMeshConnections(IList agents) + private void TriggerOffMeshConnections(IList agents) { _telemetry.Start("triggerOffMeshConnections"); - foreach (CrowdAgent ag in agents) + foreach (DtCrowdAgent ag in agents) { if (ag.state != CrowdAgentState.DT_CROWDAGENT_STATE_WALKING) { @@ -1007,7 +1007,7 @@ namespace DotRecast.Detour.Crowd if (ag.OverOffmeshConnection(triggerRadius)) { // Prepare to off-mesh connection. - CrowdAgentAnimation anim = ag.animation; + DtCrowdAgentAnimation anim = ag.animation; // Adjust the path over the off-mesh connection. long[] refs = new long[2]; @@ -1035,10 +1035,10 @@ namespace DotRecast.Detour.Crowd _telemetry.Stop("triggerOffMeshConnections"); } - private void CalculateSteering(IList agents) + private void CalculateSteering(IList agents) { _telemetry.Start("calculateSteering"); - foreach (CrowdAgent ag in agents) + foreach (DtCrowdAgent ag in agents) { if (ag.state != CrowdAgentState.DT_CROWDAGENT_STATE_WALKING) { @@ -1060,7 +1060,7 @@ namespace DotRecast.Detour.Crowd else { // Calculate steering direction. - if ((ag.option.updateFlags & CrowdAgentParams.DT_CROWD_ANTICIPATE_TURNS) != 0) + if ((ag.option.updateFlags & DtCrowdAgentParams.DT_CROWD_ANTICIPATE_TURNS) != 0) { dvel = ag.CalcSmoothSteerDirection(); } @@ -1078,7 +1078,7 @@ namespace DotRecast.Detour.Crowd } // Separation - if ((ag.option.updateFlags & CrowdAgentParams.DT_CROWD_SEPARATION) != 0) + if ((ag.option.updateFlags & DtCrowdAgentParams.DT_CROWD_SEPARATION) != 0) { float separationDist = ag.option.collisionQueryRange; float invSeparationDist = 1.0f / separationDist; @@ -1089,7 +1089,7 @@ namespace DotRecast.Detour.Crowd for (int j = 0; j < ag.neis.Count; ++j) { - CrowdAgent nei = ag.neis[j].agent; + DtCrowdAgent nei = ag.neis[j].agent; RcVec3f diff = ag.npos.Subtract(nei.npos); diff.y = 0; @@ -1133,25 +1133,25 @@ namespace DotRecast.Detour.Crowd _telemetry.Stop("calculateSteering"); } - private void PlanVelocity(CrowdAgentDebugInfo debug, IList agents) + private void PlanVelocity(DtCrowdAgentDebugInfo debug, IList agents) { _telemetry.Start("planVelocity"); - CrowdAgent debugAgent = debug != null ? debug.agent : null; - foreach (CrowdAgent ag in agents) + DtCrowdAgent debugAgent = debug != null ? debug.agent : null; + foreach (DtCrowdAgent ag in agents) { if (ag.state != CrowdAgentState.DT_CROWDAGENT_STATE_WALKING) { continue; } - if ((ag.option.updateFlags & CrowdAgentParams.DT_CROWD_OBSTACLE_AVOIDANCE) != 0) + if ((ag.option.updateFlags & DtCrowdAgentParams.DT_CROWD_OBSTACLE_AVOIDANCE) != 0) { _obstacleQuery.Reset(); // Add neighbours as obstacles. for (int j = 0; j < ag.neis.Count; ++j) { - CrowdAgent nei = ag.neis[j].agent; + DtCrowdAgent nei = ag.neis[j].agent; _obstacleQuery.AddCircle(nei.npos, nei.option.radius, nei.vel, nei.dvel); } @@ -1169,7 +1169,7 @@ namespace DotRecast.Detour.Crowd _obstacleQuery.AddSegment(s[0], s3); } - ObstacleAvoidanceDebugData vod = null; + DtObstacleAvoidanceDebugData vod = null; if (debugAgent == ag) { vod = debug.vod; @@ -1179,7 +1179,7 @@ namespace DotRecast.Detour.Crowd bool adaptive = true; int ns = 0; - ObstacleAvoidanceParams option = _obstacleQueryParams[ag.option.obstacleAvoidanceType]; + DtObstacleAvoidanceParams option = _obstacleQueryParams[ag.option.obstacleAvoidanceType]; if (adaptive) { @@ -1206,10 +1206,10 @@ namespace DotRecast.Detour.Crowd _telemetry.Stop("planVelocity"); } - private void Integrate(float dt, IList agents) + private void Integrate(float dt, IList agents) { _telemetry.Start("integrate"); - foreach (CrowdAgent ag in agents) + foreach (DtCrowdAgent ag in agents) { if (ag.state != CrowdAgentState.DT_CROWDAGENT_STATE_WALKING) { @@ -1222,12 +1222,12 @@ namespace DotRecast.Detour.Crowd _telemetry.Stop("integrate"); } - private void HandleCollisions(IList agents) + private void HandleCollisions(IList agents) { _telemetry.Start("handleCollisions"); for (int iter = 0; iter < 4; ++iter) { - foreach (CrowdAgent ag in agents) + foreach (DtCrowdAgent ag in agents) { long idx0 = ag.idx; if (ag.state != CrowdAgentState.DT_CROWDAGENT_STATE_WALKING) @@ -1241,7 +1241,7 @@ namespace DotRecast.Detour.Crowd for (int j = 0; j < ag.neis.Count; ++j) { - CrowdAgent nei = ag.neis[j].agent; + DtCrowdAgent nei = ag.neis[j].agent; long idx1 = nei.idx; RcVec3f diff = ag.npos.Subtract(nei.npos); diff.y = 0; @@ -1285,7 +1285,7 @@ namespace DotRecast.Detour.Crowd } } - foreach (CrowdAgent ag in agents) + foreach (DtCrowdAgent ag in agents) { if (ag.state != CrowdAgentState.DT_CROWDAGENT_STATE_WALKING) { @@ -1299,10 +1299,10 @@ namespace DotRecast.Detour.Crowd _telemetry.Stop("handleCollisions"); } - private void MoveAgents(IList agents) + private void MoveAgents(IList agents) { _telemetry.Start("moveAgents"); - foreach (CrowdAgent ag in agents) + foreach (DtCrowdAgent ag in agents) { if (ag.state != CrowdAgentState.DT_CROWDAGENT_STATE_WALKING) { @@ -1326,12 +1326,12 @@ namespace DotRecast.Detour.Crowd _telemetry.Stop("moveAgents"); } - private void UpdateOffMeshConnections(IList agents, float dt) + private void UpdateOffMeshConnections(IList agents, float dt) { _telemetry.Start("updateOffMeshConnections"); - foreach (CrowdAgent ag in agents) + foreach (DtCrowdAgent ag in agents) { - CrowdAgentAnimation anim = ag.animation; + DtCrowdAgentAnimation anim = ag.animation; if (!anim.active) { continue; diff --git a/src/DotRecast.Detour.Crowd/CrowdAgent.cs b/src/DotRecast.Detour.Crowd/DtCrowdAgent.cs similarity index 90% rename from src/DotRecast.Detour.Crowd/CrowdAgent.cs rename to src/DotRecast.Detour.Crowd/DtCrowdAgent.cs index 5a94ac6..81d6957 100644 --- a/src/DotRecast.Detour.Crowd/CrowdAgent.cs +++ b/src/DotRecast.Detour.Crowd/DtCrowdAgent.cs @@ -26,7 +26,7 @@ namespace DotRecast.Detour.Crowd { /// Represents an agent managed by a #dtCrowd object. /// @ingroup crowd - public class CrowdAgent + public class DtCrowdAgent { public readonly long idx; @@ -38,16 +38,16 @@ namespace DotRecast.Detour.Crowd public bool partial; /// The path corridor the agent is using. - public PathCorridor corridor; + public DtPathCorridor corridor; /// The local boundary data for the agent. - public LocalBoundary boundary; + public DtLocalBoundary boundary; /// Time since the agent's path corridor was optimized. public float topologyOptTime; /// The known neighbors of the agent. - public List neis = new List(); + public List neis = new List(); /// The desired speed. public float desiredSpeed; @@ -73,7 +73,7 @@ namespace DotRecast.Detour.Crowd /// < The actual velocity of the agent. The change from nvel -> vel is /// constrained by max acceleration. [(x, y, z)] /// The agent's configuration parameters. - public CrowdAgentParams option; + public DtCrowdAgentParams option; /// The local path corridor corners for the agent. public List corners = new List(); @@ -88,7 +88,7 @@ namespace DotRecast.Detour.Crowd /// < Target position of the movement request (or velocity in case of /// DT_CROWDAGENT_TARGET_VELOCITY). - public PathQueryResult targetPathQueryResult; + public DtPathQueryResult targetPathQueryResult; /// < Path finder query public bool targetReplan; @@ -99,14 +99,14 @@ namespace DotRecast.Detour.Crowd ///