forked from mirror/DotRecast
fix netstandard21
This commit is contained in:
parent
be1a4915ec
commit
5d0c5db2e7
15
README.md
15
README.md
|
@ -1,3 +1,14 @@
|
|||
# DotRecast
|
||||
- https://github.com/recastnavigation/recastnavigation
|
||||
- https://github.com/ppiastucki/recast4j
|
||||
DotRecast is a port of recast4j(https://github.com/ppiastucki/recast4j) to C# and has been built to target netstandard2.1 to work with both Unity and pure C#.
|
||||
|
||||
If you're using Unity 3D, the following projects have been modified to build with netstandard2.1:
|
||||
|
||||
- DotRecast.Core
|
||||
- DotRecast.Recast
|
||||
- DotRecast.Detour
|
||||
- DotRecast.Detour.Crowd
|
||||
- DotRecast.Detour.Dynamic
|
||||
- DotRecast.Detour.Extras
|
||||
- DotRecast.Detour.TileCache
|
||||
|
||||
Please feel free to copy and use these projects in Unity 3D. We plan to continue improving them as time goes on.
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
using System;
|
||||
|
||||
namespace DotRecast.Core;
|
||||
namespace DotRecast.Core
|
||||
{
|
||||
|
||||
|
||||
public static class ArrayUtils
|
||||
{
|
||||
|
@ -39,3 +41,4 @@ public static class ArrayUtils
|
|||
return temp;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,8 @@
|
|||
using System.Threading;
|
||||
|
||||
namespace DotRecast.Core;
|
||||
namespace DotRecast.Core
|
||||
{
|
||||
|
||||
|
||||
public class AtomicBoolean
|
||||
{
|
||||
|
@ -16,3 +18,4 @@ public class AtomicBoolean
|
|||
return 0 != _location;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,8 @@
|
|||
using System.Threading;
|
||||
|
||||
namespace DotRecast.Core;
|
||||
namespace DotRecast.Core
|
||||
{
|
||||
|
||||
|
||||
public class AtomicFloat
|
||||
{
|
||||
|
@ -26,3 +28,4 @@ public class AtomicFloat
|
|||
return Interlocked.CompareExchange(ref _location, value, comparand);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,8 @@
|
|||
using System.Threading;
|
||||
|
||||
namespace DotRecast.Core;
|
||||
namespace DotRecast.Core
|
||||
{
|
||||
|
||||
|
||||
public class AtomicInteger
|
||||
{
|
||||
|
@ -64,3 +66,4 @@ public class AtomicInteger
|
|||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,6 +1,8 @@
|
|||
using System.Threading;
|
||||
|
||||
namespace DotRecast.Core;
|
||||
namespace DotRecast.Core
|
||||
{
|
||||
|
||||
|
||||
public class AtomicLong
|
||||
{
|
||||
|
@ -50,3 +52,4 @@ public class AtomicLong
|
|||
return Interlocked.Add(ref _location, value);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,9 @@
|
|||
using System;
|
||||
using System.Buffers.Binary;
|
||||
|
||||
namespace DotRecast.Core;
|
||||
namespace DotRecast.Core
|
||||
{
|
||||
|
||||
|
||||
public class ByteBuffer
|
||||
{
|
||||
|
@ -93,14 +95,16 @@ public class ByteBuffer
|
|||
public float getFloat()
|
||||
{
|
||||
var span = ReadBytes(4);
|
||||
if (_order == ByteOrder.BIG_ENDIAN)
|
||||
if (_order == ByteOrder.BIG_ENDIAN && BitConverter.IsLittleEndian)
|
||||
{
|
||||
return BinaryPrimitives.ReadSingleBigEndian(span);
|
||||
span.Reverse();
|
||||
}
|
||||
else
|
||||
else if (_order == ByteOrder.LITTLE_ENDIAN && !BitConverter.IsLittleEndian)
|
||||
{
|
||||
return BinaryPrimitives.ReadSingleLittleEndian(span);
|
||||
span.Reverse();
|
||||
}
|
||||
|
||||
return BitConverter.ToSingle(span);
|
||||
}
|
||||
|
||||
public long getLong()
|
||||
|
@ -126,3 +130,4 @@ public class ByteBuffer
|
|||
// ?
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,6 @@
|
|||
namespace DotRecast.Core;
|
||||
namespace DotRecast.Core
|
||||
{
|
||||
|
||||
|
||||
public enum ByteOrder
|
||||
{
|
||||
|
@ -6,3 +8,5 @@ public enum ByteOrder
|
|||
LITTLE_ENDIAN,
|
||||
BIG_ENDIAN,
|
||||
}
|
||||
|
||||
}
|
|
@ -1,7 +1,9 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DotRecast.Core;
|
||||
namespace DotRecast.Core
|
||||
{
|
||||
|
||||
|
||||
public static class CollectionExtensions
|
||||
{
|
||||
|
@ -27,3 +29,4 @@ public static class CollectionExtensions
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -18,7 +18,9 @@ freely, subject to the following restrictions:
|
|||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DotRecast.Core;
|
||||
namespace DotRecast.Core
|
||||
{
|
||||
|
||||
|
||||
public static class ConvexUtils {
|
||||
|
||||
|
@ -27,7 +29,7 @@ public static class ConvexUtils {
|
|||
// returns number of points on hull.
|
||||
public static List<int> convexhull(List<float> pts) {
|
||||
int npts = pts.Count / 3;
|
||||
List<int> @out = new();
|
||||
List<int> @out = new List<int>();
|
||||
// Find lower-leftmost point.
|
||||
int hull = 0;
|
||||
for (int i = 1; i < npts; ++i) {
|
||||
|
@ -83,3 +85,5 @@ public static class ConvexUtils {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -20,7 +20,9 @@ freely, subject to the following restrictions:
|
|||
|
||||
using System;
|
||||
|
||||
namespace DotRecast.Core;
|
||||
namespace DotRecast.Core
|
||||
{
|
||||
|
||||
|
||||
public class DemoMath {
|
||||
public static float vDistSqr(float[] v1, float[] v2, int i) {
|
||||
|
@ -77,3 +79,5 @@ public class DemoMath {
|
|||
return u * g + (1f - u) * f;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,9 +1,12 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
|
||||
|
||||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.Collections.Immutable" Version="7.0.0" />
|
||||
<PackageReference Include="System.Text.Json" Version="7.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
using System.IO;
|
||||
|
||||
namespace DotRecast.Core;
|
||||
namespace DotRecast.Core
|
||||
{
|
||||
|
||||
|
||||
public static class Loader
|
||||
{
|
||||
|
@ -30,3 +32,4 @@ public static class Loader
|
|||
return filename;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -20,7 +20,9 @@ freely, subject to the following restrictions:
|
|||
|
||||
using System;
|
||||
|
||||
namespace DotRecast.Core;
|
||||
namespace DotRecast.Core
|
||||
{
|
||||
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
@ -32,7 +34,7 @@ public class OrderedQueue<T>
|
|||
|
||||
public OrderedQueue(Comparison<T> comparison)
|
||||
{
|
||||
_items = new();
|
||||
_items = new List<T>();
|
||||
_comparison = comparison;
|
||||
}
|
||||
|
||||
|
@ -71,3 +73,5 @@ public class OrderedQueue<T>
|
|||
return 0 == _items.Count;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -25,7 +25,9 @@ using System.Collections.ObjectModel;
|
|||
using DotRecast.Core;
|
||||
using DotRecast.Detour.Crowd.Tracking;
|
||||
|
||||
namespace DotRecast.Detour.Crowd;
|
||||
namespace DotRecast.Detour.Crowd
|
||||
{
|
||||
|
||||
|
||||
using static DetourCommon;
|
||||
|
||||
|
@ -177,7 +179,7 @@ public class Crowd {
|
|||
|
||||
// Allocate temp buffer for merging paths.
|
||||
m_pathq = new PathQueue(config);
|
||||
m_agents = new();
|
||||
m_agents = new HashSet<CrowdAgent>();
|
||||
|
||||
// The navQuery is mostly used for local searches, no need for large node pool.
|
||||
navMesh = nav;
|
||||
|
@ -334,7 +336,7 @@ public class Crowd {
|
|||
* @return List of active agents
|
||||
*/
|
||||
public List<CrowdAgent> getActiveAgents() {
|
||||
return new(m_agents);
|
||||
return new List<CrowdAgent>(m_agents);
|
||||
}
|
||||
|
||||
public float[] getQueryExtents() {
|
||||
|
@ -516,7 +518,7 @@ public class Crowd {
|
|||
private void updateMoveRequest(ICollection<CrowdAgent> agents, float dt) {
|
||||
_telemetry.start("updateMoveRequest");
|
||||
|
||||
OrderedQueue<CrowdAgent> queue = new((a1, a2) => a2.targetReplanTime.CompareTo(a1.targetReplanTime));
|
||||
OrderedQueue<CrowdAgent> queue = new OrderedQueue<CrowdAgent>((a1, a2) => a2.targetReplanTime.CompareTo(a1.targetReplanTime));
|
||||
|
||||
// Fire off new requests.
|
||||
foreach (CrowdAgent ag in agents) {
|
||||
|
@ -559,7 +561,7 @@ public class Crowd {
|
|||
if (cr.succeeded()) {
|
||||
reqPos = cr.result.getClosest();
|
||||
} else {
|
||||
reqPath = new();
|
||||
reqPath = new List<long>();
|
||||
}
|
||||
} else {
|
||||
vCopy(reqPos, ag.targetPos);
|
||||
|
@ -568,7 +570,7 @@ public class Crowd {
|
|||
// Could not find path, start the request from current
|
||||
// location.
|
||||
vCopy(reqPos, ag.npos);
|
||||
reqPath = new();
|
||||
reqPath = new List<long>();
|
||||
reqPath.Add(path[0]);
|
||||
}
|
||||
|
||||
|
@ -717,7 +719,7 @@ public class Crowd {
|
|||
private void updateTopologyOptimization(ICollection<CrowdAgent> agents, float dt) {
|
||||
_telemetry.start("updateTopologyOptimization");
|
||||
|
||||
OrderedQueue<CrowdAgent> queue = new((a1, a2) => a2.topologyOptTime.CompareTo(a1.topologyOptTime));
|
||||
OrderedQueue<CrowdAgent> queue = new OrderedQueue<CrowdAgent>((a1, a2) => a2.topologyOptTime.CompareTo(a1.topologyOptTime));
|
||||
|
||||
foreach (CrowdAgent ag in agents) {
|
||||
if (ag.state != CrowdAgent.CrowdAgentState.DT_CROWDAGENT_STATE_WALKING) {
|
||||
|
@ -779,7 +781,7 @@ public class Crowd {
|
|||
|
||||
private List<CrowdNeighbour> getNeighbours(float[] pos, float height, float range, CrowdAgent skip, ProximityGrid grid) {
|
||||
|
||||
List<CrowdNeighbour> result = new();
|
||||
List<CrowdNeighbour> result = new List<CrowdNeighbour>();
|
||||
HashSet<CrowdAgent> proxAgents = grid.queryItems(pos[0] - range, pos[2] - range, pos[0] + range, pos[2] + range);
|
||||
|
||||
foreach (CrowdAgent ag in proxAgents) {
|
||||
|
@ -1170,3 +1172,5 @@ public class Crowd {
|
|||
};
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -21,7 +21,9 @@ freely, subject to the following restrictions:
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DotRecast.Detour.Crowd;
|
||||
namespace DotRecast.Detour.Crowd
|
||||
{
|
||||
|
||||
|
||||
using static DetourCommon;
|
||||
|
||||
|
@ -60,7 +62,7 @@ public class CrowdAgent {
|
|||
/// Time since the agent's path corridor was optimized.
|
||||
public float topologyOptTime;
|
||||
/// The known neighbors of the agent.
|
||||
public List<Crowd.CrowdNeighbour> neis = new();
|
||||
public List<Crowd.CrowdNeighbour> neis = new List<Crowd.CrowdNeighbour>();
|
||||
/// The desired speed.
|
||||
public float desiredSpeed;
|
||||
|
||||
|
@ -78,7 +80,7 @@ public class CrowdAgent {
|
|||
/// The agent's configuration parameters.
|
||||
public CrowdAgentParams option;
|
||||
/// The local path corridor corners for the agent.
|
||||
public List<StraightPathItem> corners = new();
|
||||
public List<StraightPathItem> corners = new List<StraightPathItem>();
|
||||
|
||||
public MoveRequestState targetState; /// < State of the movement request.
|
||||
public long targetRef; /// < Target polyref of the movement request.
|
||||
|
@ -190,3 +192,4 @@ public class CrowdAgent {
|
|||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -17,7 +17,9 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Detour.Crowd;
|
||||
namespace DotRecast.Detour.Crowd
|
||||
{
|
||||
|
||||
|
||||
public class CrowdAgentAnimation {
|
||||
public bool active;
|
||||
|
@ -28,3 +30,5 @@ public class CrowdAgentAnimation {
|
|||
public float t, tmax;
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -20,7 +20,9 @@ freely, subject to the following restrictions:
|
|||
|
||||
using System;
|
||||
|
||||
namespace DotRecast.Detour.Crowd;
|
||||
namespace DotRecast.Detour.Crowd
|
||||
{
|
||||
|
||||
|
||||
/// Configuration parameters for a crowd agent.
|
||||
/// @ingroup crowd
|
||||
|
@ -60,3 +62,4 @@ public class CrowdAgentParams {
|
|||
/// User defined data attached to the agent.
|
||||
public object userData;
|
||||
}
|
||||
}
|
|
@ -16,7 +16,9 @@ freely, subject to the following restrictions:
|
|||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
namespace DotRecast.Detour.Crowd;
|
||||
namespace DotRecast.Detour.Crowd
|
||||
{
|
||||
|
||||
|
||||
public class CrowdConfig {
|
||||
|
||||
|
@ -64,3 +66,5 @@ public class CrowdConfig {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -21,7 +21,9 @@ using System.Collections.Generic;
|
|||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
|
||||
namespace DotRecast.Detour.Crowd;
|
||||
namespace DotRecast.Detour.Crowd
|
||||
{
|
||||
|
||||
|
||||
|
||||
public class CrowdTelemetry {
|
||||
|
@ -29,8 +31,8 @@ public class CrowdTelemetry {
|
|||
public const int TIMING_SAMPLES = 10;
|
||||
private float _maxTimeToEnqueueRequest;
|
||||
private float _maxTimeToFindPath;
|
||||
private readonly Dictionary<string, long> _executionTimings = new();
|
||||
private readonly Dictionary<string, List<long>> _executionTimingSamples = new();
|
||||
private readonly Dictionary<string, long> _executionTimings = new Dictionary<string, long>();
|
||||
private readonly Dictionary<string, List<long>> _executionTimingSamples = new Dictionary<string, List<long>>();
|
||||
|
||||
public float maxTimeToEnqueueRequest() {
|
||||
return _maxTimeToEnqueueRequest;
|
||||
|
@ -66,7 +68,7 @@ public class CrowdTelemetry {
|
|||
long duration = Stopwatch.GetTimestamp() - _executionTimings[name];
|
||||
if (!_executionTimingSamples.TryGetValue(name, out var s))
|
||||
{
|
||||
s = new();
|
||||
s = new List<long>();
|
||||
_executionTimingSamples.Add(name, s);
|
||||
}
|
||||
|
||||
|
@ -77,3 +79,5 @@ public class CrowdTelemetry {
|
|||
_executionTimings[name] = (long) s.Average();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
|
@ -21,7 +21,9 @@ freely, subject to the following restrictions:
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DotRecast.Detour.Crowd;
|
||||
namespace DotRecast.Detour.Crowd
|
||||
{
|
||||
|
||||
|
||||
using static DetourCommon;
|
||||
|
||||
|
@ -37,8 +39,8 @@ public class LocalBoundary {
|
|||
}
|
||||
|
||||
float[] m_center = new float[3];
|
||||
List<Segment> m_segs = new();
|
||||
List<long> m_polys = new();
|
||||
List<Segment> m_segs = new List<Segment>();
|
||||
List<long> m_polys = new List<long>();
|
||||
|
||||
public LocalBoundary() {
|
||||
m_center[0] = m_center[1] = m_center[2] = float.MaxValue;
|
||||
|
@ -135,3 +137,5 @@ public class LocalBoundary {
|
|||
return m_segs.Count;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -21,7 +21,9 @@ freely, subject to the following restrictions:
|
|||
using System;
|
||||
using DotRecast.Detour.Crowd.Tracking;
|
||||
|
||||
namespace DotRecast.Detour.Crowd;
|
||||
namespace DotRecast.Detour.Crowd
|
||||
{
|
||||
|
||||
|
||||
using static DetourCommon;
|
||||
|
||||
|
@ -507,3 +509,5 @@ public class ObstacleAvoidanceQuery {
|
|||
return Tuple.Create(ns, nvel);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -21,7 +21,9 @@ freely, subject to the following restrictions:
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DotRecast.Detour.Crowd;
|
||||
namespace DotRecast.Detour.Crowd
|
||||
{
|
||||
|
||||
|
||||
using static DetourCommon;
|
||||
|
||||
|
@ -95,7 +97,7 @@ public class PathCorridor {
|
|||
// Concatenate paths.
|
||||
|
||||
// Adjust beginning of the buffer to include the visited.
|
||||
List<long> result = new();
|
||||
List<long> result = new List<long>();
|
||||
// Store visited
|
||||
for (int i = visited.Count - 1; i > furthestVisited; --i) {
|
||||
result.Add(visited[i]);
|
||||
|
@ -171,7 +173,7 @@ public class PathCorridor {
|
|||
* Allocates the corridor's path buffer.
|
||||
*/
|
||||
public PathCorridor() {
|
||||
m_path = new();
|
||||
m_path = new List<long>();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -209,7 +211,7 @@ public class PathCorridor {
|
|||
* @return Corners
|
||||
*/
|
||||
public List<StraightPathItem> findCorners(int maxCorners, NavMeshQuery navquery, QueryFilter filter) {
|
||||
List<StraightPathItem> path = new();
|
||||
List<StraightPathItem> path = new List<StraightPathItem>();
|
||||
Result<List<StraightPathItem>> result = navquery.findStraightPath(m_pos, m_target, m_path, maxCorners, 0);
|
||||
if (result.succeeded()) {
|
||||
path = result.result;
|
||||
|
@ -441,7 +443,7 @@ public class PathCorridor {
|
|||
|
||||
public void setCorridor(float[] target, List<long> path) {
|
||||
vCopy(m_target, target);
|
||||
m_path = new(path);
|
||||
m_path = new List<long>(path);
|
||||
}
|
||||
|
||||
public void fixPathStart(long safeRef, float[] safePos) {
|
||||
|
@ -560,3 +562,5 @@ public class PathCorridor {
|
|||
return m_path.Count;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -17,7 +17,9 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Detour.Crowd;
|
||||
namespace DotRecast.Detour.Crowd
|
||||
{
|
||||
|
||||
|
||||
public class PathQuery {
|
||||
/// Path find start and end location.
|
||||
|
@ -30,3 +32,5 @@ public class PathQuery {
|
|||
public NavMeshQuery navQuery;
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -18,9 +18,13 @@ freely, subject to the following restrictions:
|
|||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DotRecast.Detour.Crowd;
|
||||
namespace DotRecast.Detour.Crowd
|
||||
{
|
||||
|
||||
|
||||
public class PathQueryResult {
|
||||
public Status status;
|
||||
public List<long> path = new();
|
||||
public List<long> path = new List<long>();
|
||||
}
|
||||
|
||||
}
|
|
@ -20,14 +20,16 @@ freely, subject to the following restrictions:
|
|||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DotRecast.Detour.Crowd;
|
||||
namespace DotRecast.Detour.Crowd
|
||||
{
|
||||
|
||||
|
||||
using static DetourCommon;
|
||||
|
||||
public class PathQueue {
|
||||
|
||||
private readonly CrowdConfig config;
|
||||
private readonly LinkedList<PathQuery> queue = new();
|
||||
private readonly LinkedList<PathQuery> queue = new LinkedList<PathQuery>();
|
||||
|
||||
public PathQueue(CrowdConfig config) {
|
||||
this.config = config;
|
||||
|
@ -81,3 +83,5 @@ public class PathQueue {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -22,7 +22,9 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace DotRecast.Detour.Crowd;
|
||||
namespace DotRecast.Detour.Crowd
|
||||
{
|
||||
|
||||
|
||||
public class ProximityGrid {
|
||||
|
||||
|
@ -33,7 +35,7 @@ public class ProximityGrid {
|
|||
public ProximityGrid(float m_cellSize) {
|
||||
this.m_cellSize = m_cellSize;
|
||||
m_invCellSize = 1.0f / m_cellSize;
|
||||
items = new();
|
||||
items = new Dictionary<ItemKey, List<CrowdAgent>>();
|
||||
}
|
||||
|
||||
void clear() {
|
||||
|
@ -50,7 +52,7 @@ public class ProximityGrid {
|
|||
for (int x = iminx; x <= imaxx; ++x) {
|
||||
ItemKey key = new ItemKey(x, y);
|
||||
if (!items.TryGetValue(key, out var ids)) {
|
||||
ids = new();
|
||||
ids = new List<CrowdAgent>();
|
||||
items.Add(key, ids);
|
||||
}
|
||||
ids.Add(agent);
|
||||
|
@ -64,7 +66,7 @@ public class ProximityGrid {
|
|||
int imaxx = (int) Math.Floor(maxx * m_invCellSize);
|
||||
int imaxy = (int) Math.Floor(maxy * m_invCellSize);
|
||||
|
||||
HashSet<CrowdAgent> result = new();
|
||||
HashSet<CrowdAgent> result = new HashSet<CrowdAgent>();
|
||||
for (int y = iminy; y <= imaxy; ++y) {
|
||||
for (int x = iminx; x <= imaxx; ++x) {
|
||||
ItemKey key = new ItemKey(x, y);
|
||||
|
@ -128,3 +130,5 @@ public class ProximityGrid {
|
|||
|
||||
};
|
||||
}
|
||||
|
||||
}
|
|
@ -17,7 +17,9 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Detour.Crowd;
|
||||
namespace DotRecast.Detour.Crowd
|
||||
{
|
||||
|
||||
|
||||
public class SweepCircleCircleResult {
|
||||
|
||||
|
@ -32,3 +34,5 @@ public class SweepCircleCircleResult {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -17,7 +17,9 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Detour.Crowd.Tracking;
|
||||
namespace DotRecast.Detour.Crowd.Tracking
|
||||
{
|
||||
|
||||
|
||||
public class CrowdAgentDebugInfo {
|
||||
|
||||
|
@ -27,3 +29,5 @@ public class CrowdAgentDebugInfo {
|
|||
public ObstacleAvoidanceDebugData vod;
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -20,7 +20,9 @@ freely, subject to the following restrictions:
|
|||
|
||||
using System;
|
||||
|
||||
namespace DotRecast.Detour.Crowd.Tracking;
|
||||
namespace DotRecast.Detour.Crowd.Tracking
|
||||
{
|
||||
|
||||
|
||||
using static DetourCommon;
|
||||
|
||||
|
@ -123,3 +125,4 @@ public class ObstacleAvoidanceDebugData {
|
|||
return m_tpen[i];
|
||||
}
|
||||
}
|
||||
}
|
|
@ -19,7 +19,9 @@ freely, subject to the following restrictions:
|
|||
using System.Collections.Generic;
|
||||
using DotRecast.Detour.Dynamic.Colliders;
|
||||
|
||||
namespace DotRecast.Detour.Dynamic;
|
||||
namespace DotRecast.Detour.Dynamic
|
||||
{
|
||||
|
||||
|
||||
public class AddColliderQueueItem : UpdateQueueItem {
|
||||
|
||||
|
@ -42,3 +44,5 @@ public class AddColliderQueueItem : UpdateQueueItem {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -18,7 +18,9 @@ freely, subject to the following restrictions:
|
|||
|
||||
using DotRecast.Recast;
|
||||
|
||||
namespace DotRecast.Detour.Dynamic.Colliders;
|
||||
namespace DotRecast.Detour.Dynamic.Colliders
|
||||
{
|
||||
|
||||
|
||||
public abstract class AbstractCollider : Collider {
|
||||
|
||||
|
@ -42,3 +44,5 @@ public abstract class AbstractCollider : Collider {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -19,7 +19,9 @@ freely, subject to the following restrictions:
|
|||
using System;
|
||||
using DotRecast.Recast;
|
||||
|
||||
namespace DotRecast.Detour.Dynamic.Colliders;
|
||||
namespace DotRecast.Detour.Dynamic.Colliders
|
||||
{
|
||||
|
||||
|
||||
public class BoxCollider : AbstractCollider {
|
||||
|
||||
|
@ -77,3 +79,5 @@ public class BoxCollider : AbstractCollider {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -19,7 +19,9 @@ freely, subject to the following restrictions:
|
|||
using System;
|
||||
using DotRecast.Recast;
|
||||
|
||||
namespace DotRecast.Detour.Dynamic.Colliders;
|
||||
namespace DotRecast.Detour.Dynamic.Colliders
|
||||
{
|
||||
|
||||
|
||||
public class CapsuleCollider : AbstractCollider {
|
||||
|
||||
|
@ -47,3 +49,5 @@ public class CapsuleCollider : AbstractCollider {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -18,10 +18,14 @@ freely, subject to the following restrictions:
|
|||
|
||||
using DotRecast.Recast;
|
||||
|
||||
namespace DotRecast.Detour.Dynamic.Colliders;
|
||||
namespace DotRecast.Detour.Dynamic.Colliders
|
||||
{
|
||||
|
||||
|
||||
public interface Collider {
|
||||
|
||||
float[] bounds();
|
||||
void rasterize(Heightfield hf, Telemetry telemetry);
|
||||
}
|
||||
|
||||
}
|
|
@ -21,7 +21,9 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using DotRecast.Recast;
|
||||
|
||||
namespace DotRecast.Detour.Dynamic.Colliders;
|
||||
namespace DotRecast.Detour.Dynamic.Colliders
|
||||
{
|
||||
|
||||
|
||||
public class CompositeCollider : Collider {
|
||||
|
||||
|
@ -63,3 +65,5 @@ public class CompositeCollider : Collider {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -19,7 +19,9 @@ freely, subject to the following restrictions:
|
|||
using System;
|
||||
using DotRecast.Recast;
|
||||
|
||||
namespace DotRecast.Detour.Dynamic.Colliders;
|
||||
namespace DotRecast.Detour.Dynamic.Colliders
|
||||
{
|
||||
|
||||
|
||||
public class ConvexTrimeshCollider : AbstractCollider {
|
||||
|
||||
|
@ -44,3 +46,5 @@ public class ConvexTrimeshCollider : AbstractCollider {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -19,7 +19,9 @@ freely, subject to the following restrictions:
|
|||
using System;
|
||||
using DotRecast.Recast;
|
||||
|
||||
namespace DotRecast.Detour.Dynamic.Colliders;
|
||||
namespace DotRecast.Detour.Dynamic.Colliders
|
||||
{
|
||||
|
||||
|
||||
public class CylinderCollider : AbstractCollider {
|
||||
|
||||
|
@ -46,3 +48,5 @@ public class CylinderCollider : AbstractCollider {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -19,7 +19,9 @@ freely, subject to the following restrictions:
|
|||
using System;
|
||||
using DotRecast.Recast;
|
||||
|
||||
namespace DotRecast.Detour.Dynamic.Colliders;
|
||||
namespace DotRecast.Detour.Dynamic.Colliders
|
||||
{
|
||||
|
||||
|
||||
public class SphereCollider : AbstractCollider {
|
||||
|
||||
|
@ -43,3 +45,5 @@ public class SphereCollider : AbstractCollider {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -19,7 +19,9 @@ freely, subject to the following restrictions:
|
|||
using System;
|
||||
using DotRecast.Recast;
|
||||
|
||||
namespace DotRecast.Detour.Dynamic.Colliders;
|
||||
namespace DotRecast.Detour.Dynamic.Colliders
|
||||
{
|
||||
|
||||
|
||||
public class TrimeshCollider : AbstractCollider {
|
||||
|
||||
|
@ -59,3 +61,5 @@ public class TrimeshCollider : AbstractCollider {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
|
@ -27,17 +27,19 @@ using DotRecast.Detour.Dynamic.Colliders;
|
|||
using DotRecast.Detour.Dynamic.Io;
|
||||
using DotRecast.Recast;
|
||||
|
||||
namespace DotRecast.Detour.Dynamic;
|
||||
namespace DotRecast.Detour.Dynamic
|
||||
{
|
||||
|
||||
|
||||
public class DynamicNavMesh {
|
||||
|
||||
public const int MAX_VERTS_PER_POLY = 6;
|
||||
public readonly DynamicNavMeshConfig config;
|
||||
private readonly RecastBuilder builder;
|
||||
private readonly Dictionary<long, DynamicTile> _tiles = new();
|
||||
private readonly Dictionary<long, DynamicTile> _tiles = new Dictionary<long, DynamicTile>();
|
||||
private readonly Telemetry telemetry;
|
||||
private readonly NavMeshParams navMeshParams;
|
||||
private readonly BlockingCollection<UpdateQueueItem> updateQueue = new();
|
||||
private readonly BlockingCollection<UpdateQueueItem> updateQueue = new BlockingCollection<UpdateQueueItem>();
|
||||
private readonly AtomicLong currentColliderId = new AtomicLong(0);
|
||||
private NavMesh _navMesh;
|
||||
private bool dirty = true;
|
||||
|
@ -127,7 +129,7 @@ public class DynamicNavMesh {
|
|||
}
|
||||
|
||||
private List<UpdateQueueItem> consumeQueue() {
|
||||
List<UpdateQueueItem> items = new();
|
||||
List<UpdateQueueItem> items = new List<UpdateQueueItem>();
|
||||
while (updateQueue.TryTake(out var item)) {
|
||||
items.Add(item);
|
||||
}
|
||||
|
@ -170,7 +172,7 @@ public class DynamicNavMesh {
|
|||
int minz = (int) Math.Floor((bounds[2] - navMeshParams.orig[2]) / navMeshParams.tileHeight);
|
||||
int maxx = (int) Math.Floor((bounds[3] - navMeshParams.orig[0]) / navMeshParams.tileWidth);
|
||||
int maxz = (int) Math.Floor((bounds[5] - navMeshParams.orig[2]) / navMeshParams.tileHeight);
|
||||
List<DynamicTile> tiles = new();
|
||||
List<DynamicTile> tiles = new List<DynamicTile>();
|
||||
for (int z = minz; z <= maxz; ++z) {
|
||||
for (int x = minx; x <= maxx; ++x) {
|
||||
DynamicTile tile = getTileAt(x, z);
|
||||
|
@ -224,3 +226,5 @@ public class DynamicNavMesh {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -18,7 +18,9 @@ freely, subject to the following restrictions:
|
|||
|
||||
using DotRecast.Recast;
|
||||
|
||||
namespace DotRecast.Detour.Dynamic;
|
||||
namespace DotRecast.Detour.Dynamic
|
||||
{
|
||||
|
||||
|
||||
public class DynamicNavMeshConfig {
|
||||
|
||||
|
@ -54,3 +56,5 @@ public class DynamicNavMeshConfig {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -20,13 +20,14 @@ using System;
|
|||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using DotRecast.Detour.Dynamic.Colliders;
|
||||
using DotRecast.Detour.Dynamic.Io;
|
||||
using DotRecast.Recast;
|
||||
|
||||
namespace DotRecast.Detour.Dynamic;
|
||||
namespace DotRecast.Detour.Dynamic
|
||||
{
|
||||
|
||||
|
||||
public class DynamicTile {
|
||||
|
||||
|
@ -34,7 +35,7 @@ public class DynamicTile {
|
|||
public DynamicTileCheckpoint checkpoint;
|
||||
public RecastBuilderResult recastResult;
|
||||
MeshData meshData;
|
||||
private readonly ConcurrentDictionary<long, Collider> colliders = new();
|
||||
private readonly ConcurrentDictionary<long, Collider> colliders = new ConcurrentDictionary<long, Collider>();
|
||||
private bool dirty = true;
|
||||
private long id;
|
||||
|
||||
|
@ -55,7 +56,7 @@ public class DynamicTile {
|
|||
}
|
||||
|
||||
private Heightfield buildHeightfield(DynamicNavMeshConfig config, Telemetry telemetry) {
|
||||
ICollection<long> rasterizedColliders = checkpoint != null ? checkpoint.colliders : ImmutableArray<long>.Empty;
|
||||
ICollection<long> rasterizedColliders = checkpoint != null ? checkpoint.colliders : ImmutableHashSet<long>.Empty;
|
||||
Heightfield heightfield = checkpoint != null ? checkpoint.heightfield : voxelTile.heightfield();
|
||||
foreach (var (cid, c) in colliders) {
|
||||
if (!rasterizedColliders.Contains(cid)) {
|
||||
|
@ -152,3 +153,5 @@ public class DynamicTile {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -21,7 +21,9 @@ using DotRecast.Recast;
|
|||
|
||||
using static DotRecast.Detour.DetourCommon;
|
||||
|
||||
namespace DotRecast.Detour.Dynamic;
|
||||
namespace DotRecast.Detour.Dynamic
|
||||
{
|
||||
|
||||
|
||||
public class DynamicTileCheckpoint {
|
||||
|
||||
|
@ -59,3 +61,5 @@ public class DynamicTileCheckpoint {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -18,7 +18,9 @@ freely, subject to the following restrictions:
|
|||
|
||||
using DotRecast.Core;
|
||||
|
||||
namespace DotRecast.Detour.Dynamic.Io;
|
||||
namespace DotRecast.Detour.Dynamic.Io
|
||||
{
|
||||
|
||||
|
||||
public static class ByteUtils {
|
||||
|
||||
|
@ -50,28 +52,30 @@ public static class ByteUtils {
|
|||
|
||||
public static int putInt(int value, byte[] data, int position, ByteOrder order) {
|
||||
if (order == ByteOrder.BIG_ENDIAN) {
|
||||
data[position] = (byte) (value >>> 24);
|
||||
data[position + 1] = (byte) (value >>> 16);
|
||||
data[position + 2] = (byte) (value >>> 8);
|
||||
data[position] = (byte) ((uint)value >> 24);
|
||||
data[position + 1] = (byte) ((uint)value >> 16);
|
||||
data[position + 2] = (byte) ((uint)value >> 8);
|
||||
data[position + 3] = (byte) (value & 0xFF);
|
||||
} else {
|
||||
data[position] = (byte) (value & 0xFF);
|
||||
data[position + 1] = (byte) (value >>> 8);
|
||||
data[position + 2] = (byte) (value >>> 16);
|
||||
data[position + 3] = (byte) (value >>> 24);
|
||||
data[position + 1] = (byte) ((uint)value >> 8);
|
||||
data[position + 2] = (byte) ((uint)value >> 16);
|
||||
data[position + 3] = (byte) ((uint)value >> 24);
|
||||
}
|
||||
return position + 4;
|
||||
}
|
||||
|
||||
public static int putShort(int value, byte[] data, int position, ByteOrder order) {
|
||||
if (order == ByteOrder.BIG_ENDIAN) {
|
||||
data[position] = (byte) (value >>> 8);
|
||||
data[position] = (byte) ((uint)value >> 8);
|
||||
data[position + 1] = (byte) (value & 0xFF);
|
||||
} else {
|
||||
data[position] = (byte) (value & 0xFF);
|
||||
data[position + 1] = (byte) (value >>> 8);
|
||||
data[position + 1] = (byte) ((uint)value >> 8);
|
||||
}
|
||||
return position + 2;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -20,7 +20,9 @@ using System;
|
|||
using DotRecast.Core;
|
||||
using K4os.Compression.LZ4;
|
||||
|
||||
namespace DotRecast.Detour.Dynamic.Io;
|
||||
namespace DotRecast.Detour.Dynamic.Io
|
||||
{
|
||||
|
||||
|
||||
public class LZ4VoxelTileCompressor {
|
||||
|
||||
|
@ -38,3 +40,5 @@ public class LZ4VoxelTileCompressor {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -21,7 +21,9 @@ using System.Collections.Generic;
|
|||
using DotRecast.Core;
|
||||
using DotRecast.Recast;
|
||||
|
||||
namespace DotRecast.Detour.Dynamic.Io;
|
||||
namespace DotRecast.Detour.Dynamic.Io
|
||||
{
|
||||
|
||||
|
||||
public class VoxelFile {
|
||||
|
||||
|
@ -54,7 +56,7 @@ public class VoxelFile {
|
|||
public int tileSizeZ;
|
||||
public float[] rotation = new float[3];
|
||||
public float[] bounds = new float[6];
|
||||
public readonly List<VoxelTile> tiles = new();
|
||||
public readonly List<VoxelTile> tiles = new List<VoxelTile>();
|
||||
|
||||
public void addTile(VoxelTile tile) {
|
||||
tiles.Add(tile);
|
||||
|
@ -146,3 +148,5 @@ public class VoxelFile {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -20,7 +20,9 @@ using System.IO;
|
|||
using DotRecast.Core;
|
||||
using DotRecast.Detour.Io;
|
||||
|
||||
namespace DotRecast.Detour.Dynamic.Io;
|
||||
namespace DotRecast.Detour.Dynamic.Io
|
||||
{
|
||||
|
||||
|
||||
public class VoxelFileReader {
|
||||
|
||||
|
@ -123,3 +125,5 @@ public class VoxelFileReader {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -20,7 +20,9 @@ using System.IO;
|
|||
using DotRecast.Core;
|
||||
using DotRecast.Detour.Io;
|
||||
|
||||
namespace DotRecast.Detour.Dynamic.Io;
|
||||
namespace DotRecast.Detour.Dynamic.Io
|
||||
{
|
||||
|
||||
|
||||
public class VoxelFileWriter : DetourWriter {
|
||||
|
||||
|
@ -87,3 +89,5 @@ public class VoxelFileWriter : DetourWriter {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -19,7 +19,9 @@ freely, subject to the following restrictions:
|
|||
using DotRecast.Core;
|
||||
using DotRecast.Recast;
|
||||
|
||||
namespace DotRecast.Detour.Dynamic.Io;
|
||||
namespace DotRecast.Detour.Dynamic.Io
|
||||
{
|
||||
|
||||
|
||||
|
||||
public class VoxelTile {
|
||||
|
@ -179,3 +181,5 @@ public class VoxelTile {
|
|||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -18,7 +18,9 @@ freely, subject to the following restrictions:
|
|||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DotRecast.Detour.Dynamic;
|
||||
namespace DotRecast.Detour.Dynamic
|
||||
{
|
||||
|
||||
|
||||
public class RemoveColliderQueueItem : UpdateQueueItem {
|
||||
|
||||
|
@ -39,3 +41,5 @@ public class RemoveColliderQueueItem : UpdateQueueItem {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -18,7 +18,9 @@ freely, subject to the following restrictions:
|
|||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DotRecast.Detour.Dynamic;
|
||||
namespace DotRecast.Detour.Dynamic
|
||||
{
|
||||
|
||||
|
||||
public interface UpdateQueueItem {
|
||||
|
||||
|
@ -27,3 +29,5 @@ public interface UpdateQueueItem {
|
|||
void process(DynamicTile tile);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -19,7 +19,9 @@ freely, subject to the following restrictions:
|
|||
using System;
|
||||
using DotRecast.Recast;
|
||||
|
||||
namespace DotRecast.Detour.Dynamic;
|
||||
namespace DotRecast.Detour.Dynamic
|
||||
{
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
@ -158,3 +160,5 @@ public class VoxelQuery {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -18,7 +18,9 @@ freely, subject to the following restrictions:
|
|||
|
||||
using static DotRecast.Detour.DetourCommon;
|
||||
|
||||
namespace DotRecast.Detour.Extras;
|
||||
namespace DotRecast.Detour.Extras
|
||||
{
|
||||
|
||||
|
||||
public class BVTreeBuilder {
|
||||
|
||||
|
@ -53,3 +55,5 @@ public class BVTreeBuilder {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,8 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
|
||||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -3,7 +3,9 @@ using System;
|
|||
using DotRecast.Recast;
|
||||
using static DotRecast.Detour.DetourCommon;
|
||||
|
||||
namespace DotRecast.Detour.Extras.Jumplink;
|
||||
namespace DotRecast.Detour.Extras.Jumplink
|
||||
{
|
||||
|
||||
|
||||
public abstract class AbstractGroundSampler : GroundSampler {
|
||||
|
||||
|
@ -46,3 +48,5 @@ public abstract class AbstractGroundSampler : GroundSampler {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,6 +1,8 @@
|
|||
using System;
|
||||
|
||||
namespace DotRecast.Detour.Extras.Jumplink;
|
||||
namespace DotRecast.Detour.Extras.Jumplink
|
||||
{
|
||||
|
||||
|
||||
public class ClimbTrajectory : Trajectory {
|
||||
|
||||
|
@ -11,3 +13,5 @@ public class ClimbTrajectory : Trajectory {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,6 +1,10 @@
|
|||
namespace DotRecast.Detour.Extras.Jumplink;
|
||||
namespace DotRecast.Detour.Extras.Jumplink
|
||||
{
|
||||
|
||||
|
||||
public class Edge {
|
||||
public readonly float[] sp = new float[3];
|
||||
public readonly float[] sq = new float[3];
|
||||
}
|
||||
|
||||
}
|
|
@ -3,11 +3,13 @@ using DotRecast.Recast;
|
|||
using static DotRecast.Recast.RecastConstants;
|
||||
|
||||
|
||||
namespace DotRecast.Detour.Extras.Jumplink;
|
||||
namespace DotRecast.Detour.Extras.Jumplink
|
||||
{
|
||||
|
||||
|
||||
public class EdgeExtractor {
|
||||
public Edge[] extractEdges(PolyMesh mesh) {
|
||||
List<Edge> edges = new();
|
||||
List<Edge> edges = new List<Edge>();
|
||||
if (mesh != null) {
|
||||
float[] orig = mesh.bmin;
|
||||
float cs = mesh.cs;
|
||||
|
@ -56,3 +58,5 @@ public class EdgeExtractor {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -2,11 +2,13 @@
|
|||
using System.Collections.Generic;
|
||||
using static DotRecast.Detour.DetourCommon;
|
||||
|
||||
namespace DotRecast.Detour.Extras.Jumplink;
|
||||
namespace DotRecast.Detour.Extras.Jumplink
|
||||
{
|
||||
|
||||
|
||||
public class EdgeSampler {
|
||||
public readonly GroundSegment start = new GroundSegment();
|
||||
public readonly List<GroundSegment> end = new();
|
||||
public readonly List<GroundSegment> end = new List<GroundSegment>();
|
||||
public readonly Trajectory trajectory;
|
||||
|
||||
public readonly float[] ax = new float[3];
|
||||
|
@ -23,3 +25,5 @@ public class EdgeSampler {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,6 +1,8 @@
|
|||
using System;
|
||||
|
||||
namespace DotRecast.Detour.Extras.Jumplink;
|
||||
namespace DotRecast.Detour.Extras.Jumplink
|
||||
{
|
||||
|
||||
|
||||
class EdgeSamplerFactory {
|
||||
|
||||
|
@ -77,3 +79,5 @@ class EdgeSamplerFactory {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,7 +1,11 @@
|
|||
namespace DotRecast.Detour.Extras.Jumplink;
|
||||
namespace DotRecast.Detour.Extras.Jumplink
|
||||
{
|
||||
|
||||
|
||||
public class GroundSample {
|
||||
public readonly float[] p = new float[3];
|
||||
public bool validTrajectory;
|
||||
public bool validHeight;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,9 +1,13 @@
|
|||
using DotRecast.Recast;
|
||||
|
||||
namespace DotRecast.Detour.Extras.Jumplink;
|
||||
namespace DotRecast.Detour.Extras.Jumplink
|
||||
{
|
||||
|
||||
|
||||
public interface GroundSampler {
|
||||
|
||||
void sample(JumpLinkBuilderConfig acfg, RecastBuilderResult result, EdgeSampler es);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,4 +1,6 @@
|
|||
namespace DotRecast.Detour.Extras.Jumplink;
|
||||
namespace DotRecast.Detour.Extras.Jumplink
|
||||
{
|
||||
|
||||
|
||||
public class GroundSegment {
|
||||
public readonly float[] p = new float[3];
|
||||
|
@ -7,3 +9,5 @@ public class GroundSegment {
|
|||
public float height;
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,4 +1,6 @@
|
|||
namespace DotRecast.Detour.Extras.Jumplink;
|
||||
namespace DotRecast.Detour.Extras.Jumplink
|
||||
{
|
||||
|
||||
|
||||
public class JumpLink {
|
||||
|
||||
|
@ -13,3 +15,5 @@ public class JumpLink {
|
|||
public Trajectory trajectory;
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -5,7 +5,9 @@ using DotRecast.Core;
|
|||
using DotRecast.Recast;
|
||||
using static DotRecast.Detour.DetourCommon;
|
||||
|
||||
namespace DotRecast.Detour.Extras.Jumplink;
|
||||
namespace DotRecast.Detour.Extras.Jumplink
|
||||
{
|
||||
|
||||
|
||||
public class JumpLinkBuilder {
|
||||
|
||||
|
@ -24,7 +26,7 @@ public class JumpLinkBuilder {
|
|||
}
|
||||
|
||||
public List<JumpLink> build(JumpLinkBuilderConfig acfg, JumpLinkType type) {
|
||||
List<JumpLink> links = new();
|
||||
List<JumpLink> links = new List<JumpLink>();
|
||||
for (int tile = 0; tile < results.Count; tile++) {
|
||||
Edge[] edges = this.edges[tile];
|
||||
foreach (Edge edge in edges) {
|
||||
|
@ -44,7 +46,7 @@ public class JumpLinkBuilder {
|
|||
|
||||
|
||||
private List<JumpLink> buildJumpLinks(JumpLinkBuilderConfig acfg, EdgeSampler es, JumpSegment[] jumpSegments) {
|
||||
List<JumpLink> links = new();
|
||||
List<JumpLink> links = new List<JumpLink>();
|
||||
foreach (JumpSegment js in jumpSegments) {
|
||||
float[] sp = es.start.gsamples[js.startSample].p;
|
||||
float[] sq = es.start.gsamples[js.startSample + js.samples - 1].p;
|
||||
|
@ -82,3 +84,5 @@ public class JumpLinkBuilder {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,4 +1,6 @@
|
|||
namespace DotRecast.Detour.Extras.Jumplink;
|
||||
namespace DotRecast.Detour.Extras.Jumplink
|
||||
{
|
||||
|
||||
|
||||
public class JumpLinkBuilderConfig {
|
||||
|
||||
|
@ -31,3 +33,5 @@ public class JumpLinkBuilderConfig {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,5 +1,8 @@
|
|||
namespace DotRecast.Detour.Extras.Jumplink;
|
||||
namespace DotRecast.Detour.Extras.Jumplink
|
||||
{
|
||||
|
||||
|
||||
public enum JumpLinkType {
|
||||
EDGE_JUMP, EDGE_CLIMB_DOWN, EDGE_JUMP_OVER
|
||||
}
|
||||
}
|
|
@ -1,7 +1,11 @@
|
|||
namespace DotRecast.Detour.Extras.Jumplink;
|
||||
namespace DotRecast.Detour.Extras.Jumplink
|
||||
{
|
||||
|
||||
|
||||
public class JumpSegment {
|
||||
public int groundSegment;
|
||||
public int startSample;
|
||||
public int samples;
|
||||
}
|
||||
|
||||
}
|
|
@ -3,7 +3,9 @@ using System.Collections.Generic;
|
|||
|
||||
using DotRecast.Core;
|
||||
|
||||
namespace DotRecast.Detour.Extras.Jumplink;
|
||||
namespace DotRecast.Detour.Extras.Jumplink
|
||||
{
|
||||
|
||||
|
||||
class JumpSegmentBuilder {
|
||||
|
||||
|
@ -93,3 +95,5 @@ class JumpSegmentBuilder {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,6 +1,8 @@
|
|||
using System;
|
||||
|
||||
namespace DotRecast.Detour.Extras.Jumplink;
|
||||
namespace DotRecast.Detour.Extras.Jumplink
|
||||
{
|
||||
|
||||
|
||||
public class JumpTrajectory : Trajectory {
|
||||
|
||||
|
@ -39,3 +41,5 @@ public class JumpTrajectory : Trajectory {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -2,7 +2,9 @@ using System;
|
|||
using DotRecast.Core;
|
||||
using DotRecast.Recast;
|
||||
|
||||
namespace DotRecast.Detour.Extras.Jumplink;
|
||||
namespace DotRecast.Detour.Extras.Jumplink
|
||||
{
|
||||
|
||||
|
||||
class NavMeshGroundSampler : AbstractGroundSampler {
|
||||
|
||||
|
@ -89,3 +91,5 @@ class NavMeshGroundSampler : AbstractGroundSampler {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,6 +1,8 @@
|
|||
using System;
|
||||
|
||||
namespace DotRecast.Detour.Extras.Jumplink;
|
||||
namespace DotRecast.Detour.Extras.Jumplink
|
||||
{
|
||||
|
||||
|
||||
public class Trajectory {
|
||||
|
||||
|
@ -14,3 +16,5 @@ public class Trajectory {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -2,7 +2,9 @@ using System;
|
|||
using DotRecast.Recast;
|
||||
using static DotRecast.Detour.DetourCommon;
|
||||
|
||||
namespace DotRecast.Detour.Extras.Jumplink;
|
||||
namespace DotRecast.Detour.Extras.Jumplink
|
||||
{
|
||||
|
||||
|
||||
class TrajectorySampler {
|
||||
|
||||
|
@ -74,3 +76,5 @@ class TrajectorySampler {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -18,7 +18,9 @@ freely, subject to the following restrictions:
|
|||
|
||||
using System.IO;
|
||||
|
||||
namespace DotRecast.Detour.Extras;
|
||||
namespace DotRecast.Detour.Extras
|
||||
{
|
||||
|
||||
|
||||
public class ObjExporter {
|
||||
|
||||
|
@ -62,3 +64,5 @@ public class ObjExporter {
|
|||
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
|
@ -15,7 +15,9 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Detour.Extras;
|
||||
namespace DotRecast.Detour.Extras
|
||||
{
|
||||
|
||||
|
||||
public class PolyUtils {
|
||||
|
||||
|
@ -78,3 +80,5 @@ public class PolyUtils {
|
|||
return edge;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -15,7 +15,9 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Detour.Extras.Unity.Astar;
|
||||
namespace DotRecast.Detour.Extras.Unity.Astar
|
||||
{
|
||||
|
||||
|
||||
public class BVTreeCreator {
|
||||
|
||||
|
@ -28,3 +30,5 @@ public class BVTreeCreator {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -20,12 +20,14 @@ using System.Collections.Generic;
|
|||
using System.IO.Compression;
|
||||
using DotRecast.Core;
|
||||
|
||||
namespace DotRecast.Detour.Extras.Unity.Astar;
|
||||
namespace DotRecast.Detour.Extras.Unity.Astar
|
||||
{
|
||||
|
||||
|
||||
class GraphConnectionReader : ZipBinaryReader {
|
||||
|
||||
public List<int[]> read(ZipArchive file, string filename, Meta meta, int[] indexToNode) {
|
||||
List<int[]> connections = new();
|
||||
List<int[]> connections = new List<int[]>();
|
||||
ByteBuffer buffer = toByteBuffer(file, filename);
|
||||
while (buffer.remaining() > 0) {
|
||||
int count = buffer.getInt();
|
||||
|
@ -45,3 +47,5 @@ class GraphConnectionReader : ZipBinaryReader {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -18,7 +18,9 @@ freely, subject to the following restrictions:
|
|||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DotRecast.Detour.Extras.Unity.Astar;
|
||||
namespace DotRecast.Detour.Extras.Unity.Astar
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -42,3 +44,5 @@ public class GraphData {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -15,7 +15,9 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Detour.Extras.Unity.Astar;
|
||||
namespace DotRecast.Detour.Extras.Unity.Astar
|
||||
{
|
||||
|
||||
|
||||
public class GraphMeshData {
|
||||
|
||||
|
@ -60,3 +62,5 @@ public class GraphMeshData {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -21,7 +21,9 @@ using System.IO.Compression;
|
|||
using System.Numerics;
|
||||
using DotRecast.Core;
|
||||
|
||||
namespace DotRecast.Detour.Extras.Unity.Astar;
|
||||
namespace DotRecast.Detour.Extras.Unity.Astar
|
||||
{
|
||||
|
||||
|
||||
public class GraphMeshDataReader : ZipBinaryReader {
|
||||
|
||||
|
@ -137,10 +139,20 @@ public class GraphMeshDataReader : ZipBinaryReader {
|
|||
return new GraphMeshData(tileXCount, tileZCount, tiles);
|
||||
}
|
||||
|
||||
public static int highestOneBit(uint i)
|
||||
{
|
||||
i |= (i >> 1);
|
||||
i |= (i >> 2);
|
||||
i |= (i >> 4);
|
||||
i |= (i >> 8);
|
||||
i |= (i >> 16);
|
||||
return (int)(i - (i >> 1));
|
||||
}
|
||||
|
||||
// See NavmeshBase.cs: ASTAR_RECAST_LARGER_TILES
|
||||
private int getVertMask(int vertsCount)
|
||||
{
|
||||
int vertMask = 1 << (BitOperations.Log2((uint)vertsCount) + 1);
|
||||
int vertMask = 1 << highestOneBit((uint)vertsCount);
|
||||
if (vertMask != vertsCount) {
|
||||
vertMask *= 2;
|
||||
}
|
||||
|
@ -149,3 +161,5 @@ public class GraphMeshDataReader : ZipBinaryReader {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -15,7 +15,9 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Detour.Extras.Unity.Astar;
|
||||
namespace DotRecast.Detour.Extras.Unity.Astar
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -37,3 +39,5 @@ public class GraphMeta {
|
|||
public Vector3f forcedBoundsCenter { get; set; }
|
||||
public Vector3f forcedBoundsSize { get; set; }
|
||||
}
|
||||
|
||||
}
|
|
@ -20,7 +20,9 @@ using System.IO;
|
|||
using System.IO.Compression;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace DotRecast.Detour.Extras.Unity.Astar;
|
||||
namespace DotRecast.Detour.Extras.Unity.Astar
|
||||
{
|
||||
|
||||
|
||||
public class GraphMetaReader {
|
||||
|
||||
|
@ -36,3 +38,5 @@ public class GraphMetaReader {
|
|||
return JsonSerializer.Deserialize<GraphMeta>(json, options);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -19,7 +19,9 @@ freely, subject to the following restrictions:
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DotRecast.Detour.Extras.Unity.Astar;
|
||||
namespace DotRecast.Detour.Extras.Unity.Astar
|
||||
{
|
||||
|
||||
|
||||
public class LinkBuilder {
|
||||
|
||||
|
@ -64,3 +66,5 @@ public class LinkBuilder {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -19,7 +19,9 @@ freely, subject to the following restrictions:
|
|||
using System;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace DotRecast.Detour.Extras.Unity.Astar;
|
||||
namespace DotRecast.Detour.Extras.Unity.Astar
|
||||
{
|
||||
|
||||
|
||||
public class Meta {
|
||||
|
||||
|
@ -71,3 +73,5 @@ public class Meta {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -23,7 +23,9 @@ using System.Text.Json;
|
|||
using System.Text.Json.Nodes;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace DotRecast.Detour.Extras.Unity.Astar;
|
||||
namespace DotRecast.Detour.Extras.Unity.Astar
|
||||
{
|
||||
|
||||
|
||||
public class MetaReader {
|
||||
|
||||
|
@ -52,3 +54,5 @@ public class MetaReader {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -19,7 +19,9 @@ freely, subject to the following restrictions:
|
|||
using System.IO.Compression;
|
||||
using DotRecast.Core;
|
||||
|
||||
namespace DotRecast.Detour.Extras.Unity.Astar;
|
||||
namespace DotRecast.Detour.Extras.Unity.Astar
|
||||
{
|
||||
|
||||
|
||||
class NodeIndexReader : ZipBinaryReader {
|
||||
|
||||
|
@ -36,3 +38,5 @@ class NodeIndexReader : ZipBinaryReader {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -15,7 +15,9 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Detour.Extras.Unity.Astar;
|
||||
namespace DotRecast.Detour.Extras.Unity.Astar
|
||||
{
|
||||
|
||||
|
||||
public class NodeLink2 {
|
||||
public readonly long linkID;
|
||||
|
@ -33,3 +35,5 @@ public class NodeLink2 {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -19,7 +19,9 @@ freely, subject to the following restrictions:
|
|||
using System.IO.Compression;
|
||||
using DotRecast.Core;
|
||||
|
||||
namespace DotRecast.Detour.Extras.Unity.Astar;
|
||||
namespace DotRecast.Detour.Extras.Unity.Astar
|
||||
{
|
||||
|
||||
|
||||
public class NodeLink2Reader : ZipBinaryReader {
|
||||
|
||||
|
@ -47,3 +49,5 @@ public class NodeLink2Reader : ZipBinaryReader {
|
|||
return links;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -18,7 +18,9 @@ freely, subject to the following restrictions:
|
|||
|
||||
using DotRecast.Core;
|
||||
|
||||
namespace DotRecast.Detour.Extras.Unity.Astar;
|
||||
namespace DotRecast.Detour.Extras.Unity.Astar
|
||||
{
|
||||
|
||||
|
||||
public class OffMeshLinkCreator {
|
||||
|
||||
|
@ -61,3 +63,5 @@ public class OffMeshLinkCreator {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -20,7 +20,9 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace DotRecast.Detour.Extras.Unity.Astar;
|
||||
namespace DotRecast.Detour.Extras.Unity.Astar
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Import navmeshes created with A* Pathfinding Project Unity plugin (https://arongranberg.com/astar/). Graph data is
|
||||
|
@ -73,3 +75,5 @@ public class UnityAStarPathfindingImporter {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -20,7 +20,9 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
|
||||
namespace DotRecast.Detour.Extras.Unity.Astar;
|
||||
namespace DotRecast.Detour.Extras.Unity.Astar
|
||||
{
|
||||
|
||||
|
||||
public class UnityAStarPathfindingReader {
|
||||
|
||||
|
@ -47,9 +49,9 @@ public class UnityAStarPathfindingReader {
|
|||
// Read NodeLink2 data (off-mesh links)
|
||||
NodeLink2[] nodeLinks2 = nodeLink2Reader.read(file, NODE_LINK_2_FILE_NAME, indexToNode);
|
||||
// Read graph by graph
|
||||
List<GraphMeta> metaList = new();
|
||||
List<GraphMeshData> meshDataList = new();
|
||||
List<List<int[]>> connectionsList = new();
|
||||
List<GraphMeta> metaList = new List<GraphMeta>();
|
||||
List<GraphMeshData> meshDataList = new List<GraphMeshData>();
|
||||
List<List<int[]>> connectionsList = new List<List<int[]>>();
|
||||
for (int graphIndex = 0; graphIndex < meta.graphs; graphIndex++) {
|
||||
GraphMeta graphMeta = graphMetaReader.read(file, string.Format(GRAPH_META_FILE_NAME_PATTERN, graphIndex));
|
||||
// First graph mesh data - vertices and polygons
|
||||
|
@ -65,3 +67,5 @@ public class UnityAStarPathfindingReader {
|
|||
return new GraphData(meta, indexToNode, nodeLinks2, metaList, meshDataList, connectionsList);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -21,7 +21,9 @@ using System.IO.Compression;
|
|||
using DotRecast.Core;
|
||||
using DotRecast.Detour.Io;
|
||||
|
||||
namespace DotRecast.Detour.Extras.Unity.Astar;
|
||||
namespace DotRecast.Detour.Extras.Unity.Astar
|
||||
{
|
||||
|
||||
|
||||
public abstract class ZipBinaryReader {
|
||||
|
||||
|
@ -35,3 +37,5 @@ public abstract class ZipBinaryReader {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -15,7 +15,9 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Detour.Extras;
|
||||
namespace DotRecast.Detour.Extras
|
||||
{
|
||||
|
||||
|
||||
public class Vector3f {
|
||||
|
||||
|
@ -33,3 +35,5 @@ public class Vector3f {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -25,7 +25,9 @@ using System.Linq;
|
|||
using System.Threading.Tasks;
|
||||
using DotRecast.Core;
|
||||
|
||||
namespace DotRecast.Detour.TileCache;
|
||||
namespace DotRecast.Detour.TileCache
|
||||
{
|
||||
|
||||
|
||||
public abstract class AbstractTileLayersBuilder {
|
||||
|
||||
|
@ -37,7 +39,7 @@ public abstract class AbstractTileLayersBuilder {
|
|||
}
|
||||
|
||||
private List<byte[]> buildSingleThread(ByteOrder order, bool cCompatibility, int tw, int th) {
|
||||
List<byte[]> layers = new();
|
||||
List<byte[]> layers = new List<byte[]>();
|
||||
for (int y = 0; y < th; ++y) {
|
||||
for (int x = 0; x < tw; ++x) {
|
||||
layers.AddRange(build(x, y, order, cCompatibility));
|
||||
|
@ -64,7 +66,7 @@ public abstract class AbstractTileLayersBuilder {
|
|||
.Select(x => x.Result)
|
||||
.ToDictionary(x => Tuple.Create(x.Item1, x.Item2), x => x.Item3);
|
||||
|
||||
List<byte[]> layers = new();
|
||||
List<byte[]> layers = new List<byte[]>();
|
||||
for (int y = 0; y < th; ++y) {
|
||||
for (int x = 0; x < tw; ++x) {
|
||||
var key = Tuple.Create(x, y);
|
||||
|
@ -76,3 +78,5 @@ public abstract class AbstractTileLayersBuilder {
|
|||
|
||||
protected abstract List<byte[]> build(int tx, int ty, ByteOrder order, bool cCompatibility);
|
||||
}
|
||||
|
||||
}
|
|
@ -17,7 +17,9 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Detour.TileCache;
|
||||
namespace DotRecast.Detour.TileCache
|
||||
{
|
||||
|
||||
|
||||
public class CompressedTile {
|
||||
public readonly int index;
|
||||
|
@ -33,3 +35,5 @@ public class CompressedTile {
|
|||
salt = 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
|
@ -16,7 +16,9 @@
|
|||
|
||||
using System;
|
||||
|
||||
namespace DotRecast.Detour.TileCache.Io.Compress;
|
||||
namespace DotRecast.Detour.TileCache.Io.Compress
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Core of FastLZ compression algorithm.
|
||||
|
@ -311,10 +313,10 @@ public class FastLz {
|
|||
if (level == LEVEL_2) {
|
||||
if (distance < MAX_DISTANCE) {
|
||||
if (len < 7) {
|
||||
output[outOffset + op++] = (byte) ((len << 5) + (distance >>> 8));
|
||||
output[outOffset + op++] = (byte) ((len << 5) + (int)((ulong)distance >> 8));
|
||||
output[outOffset + op++] = (byte) (distance & 255);
|
||||
} else {
|
||||
output[outOffset + op++] = (byte) ((7 << 5) + (distance >>> 8));
|
||||
output[outOffset + op++] = (byte) ((7 << 5) + ((ulong)distance >> 8));
|
||||
for (len -= 7; len >= 255; len -= 255) {
|
||||
output[outOffset + op++] = (byte) 255;
|
||||
}
|
||||
|
@ -327,7 +329,7 @@ public class FastLz {
|
|||
distance -= MAX_DISTANCE;
|
||||
output[outOffset + op++] = (byte) ((len << 5) + 31);
|
||||
output[outOffset + op++] = (byte) 255;
|
||||
output[outOffset + op++] = (byte) (distance >>> 8);
|
||||
output[outOffset + op++] = (byte) ((ulong)distance >> 8);
|
||||
output[outOffset + op++] = (byte) (distance & 255);
|
||||
} else {
|
||||
distance -= MAX_DISTANCE;
|
||||
|
@ -337,14 +339,14 @@ public class FastLz {
|
|||
}
|
||||
output[outOffset + op++] = (byte) len;
|
||||
output[outOffset + op++] = (byte) 255;
|
||||
output[outOffset + op++] = (byte) (distance >>> 8);
|
||||
output[outOffset + op++] = (byte) ((ulong)distance >> 8);
|
||||
output[outOffset + op++] = (byte) (distance & 255);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (len > MAX_LEN - 2) {
|
||||
while (len > MAX_LEN - 2) {
|
||||
output[outOffset + op++] = (byte) ((7 << 5) + (distance >>> 8));
|
||||
output[outOffset + op++] = (byte) ((7 << 5) + ((ulong)distance >> 8));
|
||||
output[outOffset + op++] = (byte) (MAX_LEN - 2 - 7 - 2);
|
||||
output[outOffset + op++] = (byte) (distance & 255);
|
||||
len -= MAX_LEN - 2;
|
||||
|
@ -352,10 +354,10 @@ public class FastLz {
|
|||
}
|
||||
|
||||
if (len < 7) {
|
||||
output[outOffset + op++] = (byte) ((len << 5) + (distance >>> 8));
|
||||
output[outOffset + op++] = (byte) ((len << 5) + (int)((ulong)distance >> 8));
|
||||
output[outOffset + op++] = (byte) (distance & 255);
|
||||
} else {
|
||||
output[outOffset + op++] = (byte) ((7 << 5) + (distance >>> 8));
|
||||
output[outOffset + op++] = (byte) ((7 << 5) + (int)((ulong)distance >> 8));
|
||||
output[outOffset + op++] = (byte) (len - 7);
|
||||
output[outOffset + op++] = (byte) (distance & 255);
|
||||
}
|
||||
|
@ -574,3 +576,4 @@ public class FastLz {
|
|||
|
||||
private FastLz() { }
|
||||
}
|
||||
}
|
|
@ -21,7 +21,9 @@ freely, subject to the following restrictions:
|
|||
using DotRecast.Core;
|
||||
using K4os.Compression.LZ4;
|
||||
|
||||
namespace DotRecast.Detour.TileCache.Io.Compress;
|
||||
namespace DotRecast.Detour.TileCache.Io.Compress
|
||||
{
|
||||
|
||||
|
||||
public class FastLzTileCacheCompressor : TileCacheCompressor {
|
||||
|
||||
|
@ -38,3 +40,5 @@ public class FastLzTileCacheCompressor : TileCacheCompressor {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -20,7 +20,9 @@ freely, subject to the following restrictions:
|
|||
|
||||
using K4os.Compression.LZ4;
|
||||
|
||||
namespace DotRecast.Detour.TileCache.Io.Compress;
|
||||
namespace DotRecast.Detour.TileCache.Io.Compress
|
||||
{
|
||||
|
||||
|
||||
public class LZ4TileCacheCompressor : TileCacheCompressor {
|
||||
|
||||
|
@ -33,3 +35,5 @@ public class LZ4TileCacheCompressor : TileCacheCompressor {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -17,13 +17,21 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Detour.TileCache.Io.Compress;
|
||||
namespace DotRecast.Detour.TileCache.Io.Compress
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
public class TileCacheCompressorFactory {
|
||||
|
||||
public static TileCacheCompressor get(bool cCompatibility) {
|
||||
return cCompatibility ? new FastLzTileCacheCompressor() : new LZ4TileCacheCompressor();
|
||||
public static TileCacheCompressor get(bool cCompatibility)
|
||||
{
|
||||
if (cCompatibility)
|
||||
return new FastLzTileCacheCompressor();
|
||||
|
||||
return new LZ4TileCacheCompressor();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -21,7 +21,9 @@ freely, subject to the following restrictions:
|
|||
using System.IO;
|
||||
using DotRecast.Core;
|
||||
|
||||
namespace DotRecast.Detour.TileCache.Io;
|
||||
namespace DotRecast.Detour.TileCache.Io
|
||||
{
|
||||
|
||||
|
||||
public class TileCacheLayerHeaderReader {
|
||||
|
||||
|
@ -59,3 +61,5 @@ public class TileCacheLayerHeaderReader {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -22,7 +22,9 @@ using System.IO;
|
|||
using DotRecast.Core;
|
||||
using DotRecast.Detour.Io;
|
||||
|
||||
namespace DotRecast.Detour.TileCache.Io;
|
||||
namespace DotRecast.Detour.TileCache.Io
|
||||
{
|
||||
|
||||
|
||||
public class TileCacheLayerHeaderWriter : DetourWriter {
|
||||
|
||||
|
@ -52,3 +54,5 @@ public class TileCacheLayerHeaderWriter : DetourWriter {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -23,7 +23,9 @@ using DotRecast.Core;
|
|||
using DotRecast.Detour.Io;
|
||||
using DotRecast.Detour.TileCache.Io.Compress;
|
||||
|
||||
namespace DotRecast.Detour.TileCache.Io;
|
||||
namespace DotRecast.Detour.TileCache.Io
|
||||
{
|
||||
|
||||
|
||||
public class TileCacheReader {
|
||||
|
||||
|
@ -93,3 +95,5 @@ public class TileCacheReader {
|
|||
return option;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -17,7 +17,9 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Detour.TileCache.Io;
|
||||
namespace DotRecast.Detour.TileCache.Io
|
||||
{
|
||||
|
||||
|
||||
public class TileCacheSetHeader {
|
||||
|
||||
|
@ -32,3 +34,5 @@ public class TileCacheSetHeader {
|
|||
public TileCacheParams cacheParams = new TileCacheParams();
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -22,7 +22,9 @@ using System.IO;
|
|||
using DotRecast.Core;
|
||||
using DotRecast.Detour.Io;
|
||||
|
||||
namespace DotRecast.Detour.TileCache.Io;
|
||||
namespace DotRecast.Detour.TileCache.Io
|
||||
{
|
||||
|
||||
|
||||
public class TileCacheWriter : DetourWriter {
|
||||
|
||||
|
@ -73,3 +75,5 @@ public class TileCacheWriter : DetourWriter {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -17,9 +17,13 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Detour.TileCache;
|
||||
namespace DotRecast.Detour.TileCache
|
||||
{
|
||||
|
||||
|
||||
public class ObstacleRequest {
|
||||
public ObstacleRequestAction action;
|
||||
public long refs;
|
||||
}
|
||||
|
||||
}
|
|
@ -17,8 +17,12 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Detour.TileCache;
|
||||
namespace DotRecast.Detour.TileCache
|
||||
{
|
||||
|
||||
|
||||
public enum ObstacleRequestAction {
|
||||
REQUEST_ADD, REQUEST_REMOVE
|
||||
}
|
||||
|
||||
}
|
|
@ -17,9 +17,13 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Detour.TileCache;
|
||||
namespace DotRecast.Detour.TileCache
|
||||
{
|
||||
|
||||
|
||||
public enum ObstacleState {
|
||||
|
||||
DT_OBSTACLE_EMPTY, DT_OBSTACLE_PROCESSING, DT_OBSTACLE_PROCESSED, DT_OBSTACLE_REMOVING
|
||||
}
|
||||
|
||||
}
|
|
@ -25,7 +25,9 @@ using DotRecast.Detour.TileCache.Io;
|
|||
|
||||
using static DotRecast.Detour.DetourCommon;
|
||||
|
||||
namespace DotRecast.Detour.TileCache;
|
||||
namespace DotRecast.Detour.TileCache
|
||||
{
|
||||
|
||||
|
||||
public class TileCache {
|
||||
|
||||
|
@ -46,11 +48,11 @@ public class TileCache {
|
|||
private readonly TileCacheCompressor m_tcomp;
|
||||
private readonly TileCacheMeshProcess m_tmproc;
|
||||
|
||||
private readonly List<TileCacheObstacle> m_obstacles = new();
|
||||
private readonly List<TileCacheObstacle> m_obstacles = new List<TileCacheObstacle>();
|
||||
private TileCacheObstacle m_nextFreeObstacle;
|
||||
|
||||
private readonly List<ObstacleRequest> m_reqs = new();
|
||||
private readonly List<long> m_update = new();
|
||||
private readonly List<ObstacleRequest> m_reqs = new List<ObstacleRequest>();
|
||||
private readonly List<long> m_update = new List<long>();
|
||||
|
||||
private readonly TileCacheBuilder builder = new TileCacheBuilder();
|
||||
private readonly TileCacheLayerHeaderReader tileReader = new TileCacheLayerHeaderReader();
|
||||
|
@ -137,7 +139,7 @@ public class TileCache {
|
|||
}
|
||||
|
||||
public List<long> getTilesAt(int tx, int ty) {
|
||||
List<long> tiles = new();
|
||||
List<long> tiles = new List<long>();
|
||||
|
||||
// Find tile based on hash.
|
||||
int h = NavMesh.computeTileHash(tx, ty, m_tileLutMask);
|
||||
|
@ -357,7 +359,7 @@ public class TileCache {
|
|||
}
|
||||
|
||||
List<long> queryTiles(float[] bmin, float[] bmax) {
|
||||
List<long> results = new();
|
||||
List<long> results = new List<long>();
|
||||
float tw = m_params.width * m_params.cs;
|
||||
float th = m_params.height * m_params.cs;
|
||||
int tx0 = (int) Math.Floor((bmin[0] - m_params.orig[0]) / tw);
|
||||
|
@ -603,3 +605,5 @@ public class TileCache {
|
|||
return m_navmesh;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -26,7 +26,9 @@ using DotRecast.Detour.TileCache.Io;
|
|||
using DotRecast.Detour.TileCache.Io.Compress;
|
||||
using static DotRecast.Detour.DetourCommon;
|
||||
|
||||
namespace DotRecast.Detour.TileCache;
|
||||
namespace DotRecast.Detour.TileCache
|
||||
{
|
||||
|
||||
|
||||
public class TileCacheBuilder {
|
||||
|
||||
|
@ -42,7 +44,7 @@ public class TileCacheBuilder {
|
|||
|
||||
public class LayerMonotoneRegion {
|
||||
public int area;
|
||||
public List<int> neis = new(16);
|
||||
public List<int> neis = new List<int>(16);
|
||||
public int regId;
|
||||
public int areaId;
|
||||
};
|
||||
|
@ -53,9 +55,9 @@ public class TileCacheBuilder {
|
|||
public List<int> poly;
|
||||
|
||||
public TempContour() {
|
||||
verts = new();
|
||||
verts = new List<int>();
|
||||
nverts = 0;
|
||||
poly = new();
|
||||
poly = new List<int>();
|
||||
}
|
||||
|
||||
public int npoly() {
|
||||
|
@ -1195,7 +1197,7 @@ public class TileCacheBuilder {
|
|||
return false;
|
||||
|
||||
// Find edges which share the removed vertex.
|
||||
List<int> edges = new();
|
||||
List<int> edges = new List<int>();
|
||||
int nedges = 0;
|
||||
|
||||
for (int i = 0; i < mesh.npolys; ++i) {
|
||||
|
@ -1262,10 +1264,10 @@ public class TileCacheBuilder {
|
|||
}
|
||||
|
||||
int nedges = 0;
|
||||
List<int> edges = new();
|
||||
List<int> edges = new List<int>();
|
||||
int nhole = 0;
|
||||
List<int> hole = new();
|
||||
List<int> harea = new();
|
||||
List<int> hole = new List<int>();
|
||||
List<int> harea = new List<int>();
|
||||
|
||||
for (int i = 0; i < mesh.npolys; ++i) {
|
||||
int p = i * maxVertsPerPoly * 2;
|
||||
|
@ -1841,3 +1843,5 @@ public class TileCacheBuilder {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -17,7 +17,9 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Detour.TileCache;
|
||||
namespace DotRecast.Detour.TileCache
|
||||
{
|
||||
|
||||
|
||||
public interface TileCacheCompressor {
|
||||
|
||||
|
@ -25,3 +27,5 @@ public interface TileCacheCompressor {
|
|||
|
||||
byte[] compress(byte[] buf);
|
||||
}
|
||||
|
||||
}
|
|
@ -17,7 +17,9 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Detour.TileCache;
|
||||
namespace DotRecast.Detour.TileCache
|
||||
{
|
||||
|
||||
|
||||
public class TileCacheContour {
|
||||
public int nverts;
|
||||
|
@ -25,3 +27,5 @@ public class TileCacheContour {
|
|||
public int reg;
|
||||
public int area;
|
||||
}
|
||||
|
||||
}
|
|
@ -17,9 +17,13 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Detour.TileCache;
|
||||
namespace DotRecast.Detour.TileCache
|
||||
{
|
||||
|
||||
|
||||
public class TileCacheContourSet {
|
||||
public int nconts;
|
||||
public TileCacheContour[] conts;
|
||||
}
|
||||
|
||||
}
|
|
@ -17,7 +17,9 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Detour.TileCache;
|
||||
namespace DotRecast.Detour.TileCache
|
||||
{
|
||||
|
||||
|
||||
public class TileCacheLayer {
|
||||
public TileCacheLayerHeader header;
|
||||
|
@ -27,3 +29,5 @@ public class TileCacheLayer {
|
|||
public short[] cons; // char
|
||||
public short[] regs; // char
|
||||
}
|
||||
|
||||
}
|
|
@ -17,7 +17,9 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Detour.TileCache;
|
||||
namespace DotRecast.Detour.TileCache
|
||||
{
|
||||
|
||||
|
||||
public class TileCacheLayerHeader {
|
||||
|
||||
|
@ -34,3 +36,5 @@ public class TileCacheLayerHeader {
|
|||
public int minx, maxx, miny, maxy; /// < Usable sub-region.
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -17,9 +17,13 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Detour.TileCache;
|
||||
namespace DotRecast.Detour.TileCache
|
||||
{
|
||||
|
||||
|
||||
public interface TileCacheMeshProcess {
|
||||
|
||||
void process(NavMeshDataCreateParams option);
|
||||
}
|
||||
|
||||
}
|
|
@ -20,7 +20,9 @@ freely, subject to the following restrictions:
|
|||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DotRecast.Detour.TileCache;
|
||||
namespace DotRecast.Detour.TileCache
|
||||
{
|
||||
|
||||
|
||||
public class TileCacheObstacle {
|
||||
|
||||
|
@ -37,8 +39,8 @@ public class TileCacheObstacle {
|
|||
public readonly float[] center = new float[3];
|
||||
public readonly float[] extents = new float[3];
|
||||
public readonly float[] rotAux = new float[2]; // { cos(0.5f*angle)*sin(-0.5f*angle); cos(0.5f*angle)*cos(0.5f*angle) - 0.5 }
|
||||
public List<long> touched = new();
|
||||
public readonly List<long> pending = new();
|
||||
public List<long> touched = new List<long>();
|
||||
public readonly List<long> pending = new List<long>();
|
||||
public int salt;
|
||||
public ObstacleState state = ObstacleState.DT_OBSTACLE_EMPTY;
|
||||
public TileCacheObstacle next;
|
||||
|
@ -49,3 +51,5 @@ public class TileCacheObstacle {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -17,7 +17,9 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Detour.TileCache;
|
||||
namespace DotRecast.Detour.TileCache
|
||||
{
|
||||
|
||||
|
||||
public class TileCacheParams {
|
||||
public readonly float[] orig = new float[3];
|
||||
|
@ -31,3 +33,5 @@ public class TileCacheParams {
|
|||
public int maxObstacles;
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -17,7 +17,9 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Detour.TileCache;
|
||||
namespace DotRecast.Detour.TileCache
|
||||
{
|
||||
|
||||
|
||||
public class TileCachePolyMesh {
|
||||
public int nvp;
|
||||
|
@ -32,3 +34,5 @@ public class TileCachePolyMesh {
|
|||
this.nvp = nvp;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -20,7 +20,9 @@ freely, subject to the following restrictions:
|
|||
|
||||
using DotRecast.Core;
|
||||
|
||||
namespace DotRecast.Detour.TileCache;
|
||||
namespace DotRecast.Detour.TileCache
|
||||
{
|
||||
|
||||
|
||||
public class TileCacheStorageParams {
|
||||
|
||||
|
@ -33,3 +35,5 @@ public class TileCacheStorageParams {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -17,7 +17,9 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Detour;
|
||||
namespace DotRecast.Detour
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Bounding volume node.
|
||||
|
@ -33,3 +35,5 @@ public class BVNode {
|
|||
/** The node's index. (Negative for escape sequence.) */
|
||||
public int i;
|
||||
}
|
||||
|
||||
}
|
|
@ -17,7 +17,9 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Detour;
|
||||
namespace DotRecast.Detour
|
||||
{
|
||||
|
||||
|
||||
public class ClosestPointOnPolyResult {
|
||||
|
||||
|
@ -40,3 +42,5 @@ public class ClosestPointOnPolyResult {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -18,7 +18,9 @@ freely, subject to the following restrictions:
|
|||
|
||||
using System;
|
||||
|
||||
namespace DotRecast.Detour;
|
||||
namespace DotRecast.Detour
|
||||
{
|
||||
|
||||
|
||||
using static DetourCommon;
|
||||
|
||||
|
@ -235,3 +237,5 @@ public static class ConvexConvexIntersection {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -20,7 +20,9 @@ freely, subject to the following restrictions:
|
|||
|
||||
using System;
|
||||
|
||||
namespace DotRecast.Detour;
|
||||
namespace DotRecast.Detour
|
||||
{
|
||||
|
||||
|
||||
using static DetourCommon;
|
||||
|
||||
|
@ -100,3 +102,5 @@ public class DefaultQueryFilter : QueryFilter {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -16,7 +16,9 @@ freely, subject to the following restrictions:
|
|||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
namespace DotRecast.Detour;
|
||||
namespace DotRecast.Detour
|
||||
{
|
||||
|
||||
|
||||
using static DetourCommon;
|
||||
|
||||
|
@ -37,3 +39,5 @@ public class DefaultQueryHeuristic : QueryHeuristic {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -17,7 +17,9 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Detour;
|
||||
namespace DotRecast.Detour
|
||||
{
|
||||
|
||||
|
||||
public class DetourBuilder {
|
||||
|
||||
|
@ -30,3 +32,5 @@ public class DetourBuilder {
|
|||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -20,7 +20,9 @@ freely, subject to the following restrictions:
|
|||
|
||||
using System;
|
||||
|
||||
namespace DotRecast.Detour;
|
||||
namespace DotRecast.Detour
|
||||
{
|
||||
|
||||
|
||||
public static class DetourCommon {
|
||||
|
||||
|
@ -635,3 +637,5 @@ public static class DetourCommon {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
|
@ -17,7 +17,9 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Detour;
|
||||
namespace DotRecast.Detour
|
||||
{
|
||||
|
||||
|
||||
//TODO: (PP) Add comments
|
||||
public class FindDistanceToWallResult {
|
||||
|
@ -44,3 +46,4 @@ public class FindDistanceToWallResult {
|
|||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -20,7 +20,9 @@ freely, subject to the following restrictions:
|
|||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DotRecast.Detour;
|
||||
namespace DotRecast.Detour
|
||||
{
|
||||
|
||||
|
||||
//TODO: (PP) Add comments
|
||||
public class FindLocalNeighbourhoodResult {
|
||||
|
@ -41,3 +43,4 @@ public class FindLocalNeighbourhoodResult {
|
|||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,6 +1,8 @@
|
|||
using System;
|
||||
|
||||
namespace DotRecast.Detour;
|
||||
namespace DotRecast.Detour
|
||||
{
|
||||
|
||||
|
||||
using static DetourCommon;
|
||||
|
||||
|
@ -51,3 +53,5 @@ public class FindNearestPolyQuery : PolyQuery {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -17,7 +17,9 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Detour;
|
||||
namespace DotRecast.Detour
|
||||
{
|
||||
|
||||
|
||||
public class FindNearestPolyResult {
|
||||
private readonly long nearestRef;
|
||||
|
@ -45,3 +47,5 @@ public class FindNearestPolyResult {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -20,7 +20,9 @@ freely, subject to the following restrictions:
|
|||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DotRecast.Detour;
|
||||
namespace DotRecast.Detour
|
||||
{
|
||||
|
||||
|
||||
|
||||
// TODO: (PP) Add comments
|
||||
|
@ -48,3 +50,4 @@ public class FindPolysAroundResult {
|
|||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -17,7 +17,9 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Detour;
|
||||
namespace DotRecast.Detour
|
||||
{
|
||||
|
||||
|
||||
//TODO: (PP) Add comments
|
||||
public class FindRandomPointResult {
|
||||
|
@ -40,3 +42,4 @@ public class FindRandomPointResult {
|
|||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -20,7 +20,9 @@ freely, subject to the following restrictions:
|
|||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DotRecast.Detour;
|
||||
namespace DotRecast.Detour
|
||||
{
|
||||
|
||||
|
||||
|
||||
public class GetPolyWallSegmentsResult {
|
||||
|
@ -42,3 +44,5 @@ public class GetPolyWallSegmentsResult {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -20,7 +20,9 @@ using System;
|
|||
using System.IO;
|
||||
using DotRecast.Core;
|
||||
|
||||
namespace DotRecast.Detour.Io;
|
||||
namespace DotRecast.Detour.Io
|
||||
{
|
||||
|
||||
|
||||
public abstract class DetourWriter {
|
||||
|
||||
|
@ -42,11 +44,11 @@ public abstract class DetourWriter {
|
|||
|
||||
protected void write(BinaryWriter stream, long value, ByteOrder order) {
|
||||
if (order == ByteOrder.BIG_ENDIAN) {
|
||||
write(stream, (int) (value >>> 32), order);
|
||||
write(stream, (int) ((ulong)value >> 32), order);
|
||||
write(stream, (int) (value & 0xFFFFFFFF), order);
|
||||
} else {
|
||||
write(stream, (int) (value & 0xFFFFFFFF), order);
|
||||
write(stream, (int) (value >>> 32), order);
|
||||
write(stream, (int) ((ulong)value >> 32), order);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -80,3 +82,5 @@ public abstract class DetourWriter {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -20,7 +20,9 @@ using System;
|
|||
using System.IO;
|
||||
using DotRecast.Core;
|
||||
|
||||
namespace DotRecast.Detour.Io;
|
||||
namespace DotRecast.Detour.Io
|
||||
{
|
||||
|
||||
|
||||
public static class IOUtils {
|
||||
|
||||
|
@ -51,8 +53,11 @@ public static class IOUtils {
|
|||
return new ByteBuffer(bytes);
|
||||
}
|
||||
|
||||
public static int swapEndianness(int i) {
|
||||
var s = ((i >>> 24) & 0xFF) | ((i>>8) & 0xFF00) | ((i<<8) & 0xFF0000) | ((i << 24) & 0xFF000000);
|
||||
public static int swapEndianness(int i)
|
||||
{
|
||||
var s = (((uint)i >> 24) & 0xFF) | (((uint)i>>8) & 0xFF00) | (((uint)i<<8) & 0xFF0000) | ((i << 24) & 0xFF000000);
|
||||
return (int)s;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -19,7 +19,9 @@ freely, subject to the following restrictions:
|
|||
using System.IO;
|
||||
using DotRecast.Core;
|
||||
|
||||
namespace DotRecast.Detour.Io;
|
||||
namespace DotRecast.Detour.Io
|
||||
{
|
||||
|
||||
|
||||
public class MeshDataReader {
|
||||
|
||||
|
@ -199,3 +201,5 @@ public class MeshDataReader {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -19,7 +19,9 @@ freely, subject to the following restrictions:
|
|||
using System.IO;
|
||||
using DotRecast.Core;
|
||||
|
||||
namespace DotRecast.Detour.Io;
|
||||
namespace DotRecast.Detour.Io
|
||||
{
|
||||
|
||||
|
||||
public class MeshDataWriter : DetourWriter {
|
||||
|
||||
|
@ -140,3 +142,5 @@ public class MeshDataWriter : DetourWriter {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -20,7 +20,9 @@ using System;
|
|||
using System.IO;
|
||||
using DotRecast.Core;
|
||||
|
||||
namespace DotRecast.Detour.Io;
|
||||
namespace DotRecast.Detour.Io
|
||||
{
|
||||
|
||||
|
||||
using static DetourCommon;
|
||||
|
||||
|
@ -125,3 +127,5 @@ public class MeshSetReader {
|
|||
return NavMesh.encodePolyId(salt, it, ip);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -19,7 +19,9 @@ freely, subject to the following restrictions:
|
|||
using System.IO;
|
||||
using DotRecast.Core;
|
||||
|
||||
namespace DotRecast.Detour.Io;
|
||||
namespace DotRecast.Detour.Io
|
||||
{
|
||||
|
||||
|
||||
public class MeshSetWriter : DetourWriter {
|
||||
|
||||
|
@ -76,3 +78,5 @@ public class MeshSetWriter : DetourWriter {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,6 +1,8 @@
|
|||
using DotRecast.Core;
|
||||
|
||||
namespace DotRecast.Detour.Io;
|
||||
namespace DotRecast.Detour.Io
|
||||
{
|
||||
|
||||
|
||||
public class NavMeshParamReader {
|
||||
|
||||
|
@ -17,3 +19,5 @@ public class NavMeshParamReader {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,7 +1,9 @@
|
|||
using System.IO;
|
||||
using DotRecast.Core;
|
||||
|
||||
namespace DotRecast.Detour.Io;
|
||||
namespace DotRecast.Detour.Io
|
||||
{
|
||||
|
||||
|
||||
public class NavMeshParamWriter : DetourWriter {
|
||||
|
||||
|
@ -16,3 +18,5 @@ public class NavMeshParamWriter : DetourWriter {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -15,7 +15,9 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Detour.Io;
|
||||
namespace DotRecast.Detour.Io
|
||||
{
|
||||
|
||||
|
||||
public class NavMeshSetHeader {
|
||||
|
||||
|
@ -31,3 +33,5 @@ public class NavMeshSetHeader {
|
|||
public int maxVertsPerPoly;
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,6 +1,10 @@
|
|||
namespace DotRecast.Detour.Io;
|
||||
namespace DotRecast.Detour.Io
|
||||
{
|
||||
|
||||
|
||||
public class NavMeshTileHeader {
|
||||
public long tileRef;
|
||||
public int dataSize;
|
||||
}
|
||||
|
||||
}
|
|
@ -19,7 +19,9 @@ freely, subject to the following restrictions:
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DotRecast.Detour;
|
||||
namespace DotRecast.Detour
|
||||
{
|
||||
|
||||
|
||||
using static DetourCommon;
|
||||
|
||||
|
@ -45,7 +47,7 @@ public class LegacyNavMeshQuery : NavMeshQuery {
|
|||
}
|
||||
|
||||
if (startRef == endRef) {
|
||||
List<long> singlePath = new(1);
|
||||
List<long> singlePath = new List<long>(1);
|
||||
singlePath.Add(startRef);
|
||||
return Results.success(singlePath);
|
||||
}
|
||||
|
@ -412,7 +414,7 @@ public class LegacyNavMeshQuery : NavMeshQuery {
|
|||
/// @returns The status flags for the query.
|
||||
public override Result<List<long>> finalizeSlicedFindPath() {
|
||||
|
||||
List<long> path = new(64);
|
||||
List<long> path = new List<long>(64);
|
||||
if (m_query.status.isFailed()) {
|
||||
// Reset query.
|
||||
m_query = new QueryData();
|
||||
|
@ -480,7 +482,7 @@ public class LegacyNavMeshQuery : NavMeshQuery {
|
|||
/// @returns The status flags for the query.
|
||||
public override Result<List<long>> finalizeSlicedFindPathPartial(List<long> existing) {
|
||||
|
||||
List<long> path = new(64);
|
||||
List<long> path = new List<long>(64);
|
||||
if (null == existing || existing.Count <= 0) {
|
||||
return Results.failure(path);
|
||||
}
|
||||
|
@ -728,3 +730,5 @@ public class LegacyNavMeshQuery : NavMeshQuery {
|
|||
return Results.success(new FindDistanceToWallResult((float) Math.Sqrt(radiusSqr), hitPos, hitNormal));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -17,7 +17,9 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Detour;
|
||||
namespace DotRecast.Detour
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Defines a link between polygons.
|
||||
|
@ -40,3 +42,5 @@ public class Link {
|
|||
public int bmax;
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -17,7 +17,9 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Detour;
|
||||
namespace DotRecast.Detour
|
||||
{
|
||||
|
||||
|
||||
public class MeshData {
|
||||
|
||||
|
@ -44,3 +46,4 @@ public class MeshData {
|
|||
public OffMeshConnection[] offMeshCons;
|
||||
|
||||
}
|
||||
}
|
|
@ -17,7 +17,9 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Detour;
|
||||
namespace DotRecast.Detour
|
||||
{
|
||||
|
||||
|
||||
/** Provides high level information related to a dtMeshTile object. */
|
||||
public class MeshHeader {
|
||||
|
@ -77,3 +79,5 @@ public class MeshHeader {
|
|||
/** The bounding volume quantization factor. */
|
||||
public float bvQuantFactor;
|
||||
}
|
||||
|
||||
}
|
|
@ -20,7 +20,9 @@ freely, subject to the following restrictions:
|
|||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DotRecast.Detour;
|
||||
namespace DotRecast.Detour
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Defines a navigation mesh tile.
|
||||
|
@ -33,7 +35,7 @@ public class MeshTile {
|
|||
public MeshData data;
|
||||
public int[] polyLinks;
|
||||
/** The tile links. */
|
||||
public readonly List<Link> links = new();
|
||||
public readonly List<Link> links = new List<Link>();
|
||||
/** Index to the next free link. */
|
||||
public int linksFreeList = NavMesh.DT_NULL_LINK; // FIXME: Remove
|
||||
/** Tile flags. (See: #dtTileFlags) */
|
||||
|
@ -44,3 +46,5 @@ public class MeshTile {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -20,7 +20,9 @@ freely, subject to the following restrictions:
|
|||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DotRecast.Detour;
|
||||
namespace DotRecast.Detour
|
||||
{
|
||||
|
||||
|
||||
|
||||
public class MoveAlongSurfaceResult {
|
||||
|
@ -44,3 +46,5 @@ public class MoveAlongSurfaceResult {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -23,7 +23,9 @@ using System.Collections.Generic;
|
|||
using System.Collections.Immutable;
|
||||
using DotRecast.Core;
|
||||
|
||||
namespace DotRecast.Detour;
|
||||
namespace DotRecast.Detour
|
||||
{
|
||||
|
||||
|
||||
using static DetourCommon;
|
||||
|
||||
|
@ -58,8 +60,8 @@ public class NavMesh {
|
|||
float m_tileWidth, m_tileHeight; /// < Dimensions of each tile.
|
||||
int m_maxTiles; /// < Max number of tiles.
|
||||
private readonly int m_tileLutMask; /// < Tile hash lookup mask.
|
||||
private readonly Dictionary<int, List<MeshTile>> posLookup = new();
|
||||
private readonly LinkedList<MeshTile> availableTiles = new();
|
||||
private readonly Dictionary<int, List<MeshTile>> posLookup = new Dictionary<int, List<MeshTile>>();
|
||||
private readonly LinkedList<MeshTile> availableTiles = new LinkedList<MeshTile>();
|
||||
private readonly MeshTile[] m_tiles; /// < List of tiles.
|
||||
/** The maximum number of vertices per navigation polygon. */
|
||||
private readonly int m_maxVertPerPoly;
|
||||
|
@ -285,7 +287,7 @@ public class NavMesh {
|
|||
// for off-mesh connection finding.
|
||||
|
||||
List<long> queryPolygonsInTile(MeshTile tile, float[] qmin, float[] qmax) {
|
||||
List<long> polys = new();
|
||||
List<long> polys = new List<long>();
|
||||
if (tile.data.bvTree != null) {
|
||||
int nodeIndex = 0;
|
||||
float[] tbmin = tile.data.header.bmin;
|
||||
|
@ -756,7 +758,7 @@ public class NavMesh {
|
|||
if (tile == null) {
|
||||
return ImmutableArray<Tuple<long, float, float>>.Empty;
|
||||
}
|
||||
List<Tuple<long, float, float>> result = new();
|
||||
List<Tuple<long, float, float>> result = new List<Tuple<long, float, float>>();
|
||||
float[] amin = new float[2];
|
||||
float[] amax = new float[2];
|
||||
calcSlabEndPoints(verts, va, vb, amin, amax, side);
|
||||
|
@ -1195,7 +1197,7 @@ public class NavMesh {
|
|||
}
|
||||
|
||||
public List<MeshTile> getTilesAt(int x, int y) {
|
||||
List<MeshTile> tiles = new();
|
||||
List<MeshTile> tiles = new List<MeshTile>();
|
||||
foreach (MeshTile tile in getTileListByPos(x, y)) {
|
||||
if (tile.data.header != null && tile.data.header.x == x && tile.data.header.y == y) {
|
||||
tiles.Add(tile);
|
||||
|
@ -1418,10 +1420,12 @@ public class NavMesh {
|
|||
var tileHash = computeTileHash(x, z, m_tileLutMask);
|
||||
if (!posLookup.TryGetValue(tileHash, out var tiles))
|
||||
{
|
||||
tiles = new();
|
||||
tiles = new List<MeshTile>();
|
||||
posLookup.Add(tileHash, tiles);
|
||||
}
|
||||
|
||||
return tiles;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -21,7 +21,9 @@ freely, subject to the following restrictions:
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DotRecast.Detour;
|
||||
namespace DotRecast.Detour
|
||||
{
|
||||
|
||||
|
||||
using static DetourCommon;
|
||||
|
||||
|
@ -600,3 +602,5 @@ public class NavMeshBuilder {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -17,7 +17,9 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Detour;
|
||||
namespace DotRecast.Detour
|
||||
{
|
||||
|
||||
|
||||
/// Represents the source data used to build an navigation mesh tile.
|
||||
public class NavMeshDataCreateParams {
|
||||
|
@ -100,3 +102,4 @@ public class NavMeshDataCreateParams {
|
|||
/// @}
|
||||
|
||||
}
|
||||
}
|
|
@ -17,7 +17,9 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Detour;
|
||||
namespace DotRecast.Detour
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Configuration parameters used to define multi-tile navigation meshes. The values are used to allocate space during
|
||||
|
@ -37,3 +39,5 @@ public class NavMeshParams {
|
|||
/** The maximum number of polygons each tile can contain. */
|
||||
public int maxPolys;
|
||||
}
|
||||
|
||||
}
|
|
@ -22,7 +22,9 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
|
||||
namespace DotRecast.Detour;
|
||||
namespace DotRecast.Detour
|
||||
{
|
||||
|
||||
|
||||
using static DetourCommon;
|
||||
using static Node;
|
||||
|
@ -636,7 +638,7 @@ public class NavMeshQuery {
|
|||
int[] maxxy = m_nav.calcTileLoc(bmax);
|
||||
int maxx = maxxy[0];
|
||||
int maxy = maxxy[1];
|
||||
List<MeshTile> tiles = new();
|
||||
List<MeshTile> tiles = new List<MeshTile>();
|
||||
for (int y = miny; y <= maxy; ++y) {
|
||||
for (int x = minx; x <= maxx; ++x) {
|
||||
tiles.AddRange(m_nav.getTilesAt(x, y));
|
||||
|
@ -694,7 +696,7 @@ public class NavMeshQuery {
|
|||
}
|
||||
|
||||
if (startRef == endRef) {
|
||||
List<long> singlePath = new(1);
|
||||
List<long> singlePath = new List<long>(1);
|
||||
singlePath.Add(startRef);
|
||||
return Results.success(singlePath);
|
||||
}
|
||||
|
@ -1181,7 +1183,7 @@ public class NavMeshQuery {
|
|||
/// @returns The status flags for the query.
|
||||
public virtual Result<List<long>> finalizeSlicedFindPath() {
|
||||
|
||||
List<long> path = new(64);
|
||||
List<long> path = new List<long>(64);
|
||||
if (m_query.status.isFailed()) {
|
||||
// Reset query.
|
||||
m_query = new QueryData();
|
||||
|
@ -1215,7 +1217,7 @@ public class NavMeshQuery {
|
|||
/// @returns The status flags for the query.
|
||||
public virtual Result<List<long>> finalizeSlicedFindPathPartial(List<long> existing) {
|
||||
|
||||
List<long> path = new(64);
|
||||
List<long> path = new List<long>(64);
|
||||
if (null == existing || existing.Count <= 0) {
|
||||
return Results.failure(path);
|
||||
}
|
||||
|
@ -1350,7 +1352,7 @@ public class NavMeshQuery {
|
|||
public virtual Result<List<StraightPathItem>> findStraightPath(float[] startPos, float[] endPos, List<long> path,
|
||||
int maxStraightPath, int options) {
|
||||
|
||||
List<StraightPathItem> straightPath = new();
|
||||
List<StraightPathItem> straightPath = new List<StraightPathItem>();
|
||||
if (null == startPos || !vIsFinite(startPos) || null == endPos || !vIsFinite(endPos)
|
||||
|| null == path || 0 == path.Count || path[0] == 0 || maxStraightPath <= 0) {
|
||||
return Results.invalidParam<List<StraightPathItem>>();
|
||||
|
@ -1578,7 +1580,7 @@ public class NavMeshQuery {
|
|||
startNode.total = 0;
|
||||
startNode.id = startRef;
|
||||
startNode.flags = Node.DT_NODE_CLOSED;
|
||||
LinkedList<Node> stack = new();
|
||||
LinkedList<Node> stack = new LinkedList<Node>();
|
||||
stack.AddLast(startNode);
|
||||
|
||||
float[] bestPos = new float[3];
|
||||
|
@ -1690,7 +1692,7 @@ public class NavMeshQuery {
|
|||
}
|
||||
}
|
||||
|
||||
List<long> visited = new();
|
||||
List<long> visited = new List<long>();
|
||||
if (bestNode != null) {
|
||||
// Reverse the path.
|
||||
Node prev = null;
|
||||
|
@ -2157,9 +2159,9 @@ public class NavMeshQuery {
|
|||
return Results.invalidParam<FindPolysAroundResult>();
|
||||
}
|
||||
|
||||
List<long> resultRef = new();
|
||||
List<long> resultParent = new();
|
||||
List<float> resultCost = new();
|
||||
List<long> resultRef = new List<long>();
|
||||
List<long> resultParent = new List<long>();
|
||||
List<float> resultCost = new List<float>();
|
||||
|
||||
m_nodePool.clear();
|
||||
m_openList.clear();
|
||||
|
@ -2316,9 +2318,9 @@ public class NavMeshQuery {
|
|||
return Results.invalidParam<FindPolysAroundResult>();
|
||||
}
|
||||
|
||||
List<long> resultRef = new();
|
||||
List<long> resultParent = new();
|
||||
List<float> resultCost = new();
|
||||
List<long> resultRef = new List<long>();
|
||||
List<long> resultParent = new List<long>();
|
||||
List<float> resultCost = new List<float>();
|
||||
|
||||
m_nodePool.clear();
|
||||
m_openList.clear();
|
||||
|
@ -2488,8 +2490,8 @@ public class NavMeshQuery {
|
|||
return Results.invalidParam<FindLocalNeighbourhoodResult>();
|
||||
}
|
||||
|
||||
List<long> resultRef = new();
|
||||
List<long> resultParent = new();
|
||||
List<long> resultRef = new List<long>();
|
||||
List<long> resultParent = new List<long>();
|
||||
|
||||
NodePool tinyNodePool = new NodePool();
|
||||
|
||||
|
@ -2497,7 +2499,7 @@ public class NavMeshQuery {
|
|||
startNode.pidx = 0;
|
||||
startNode.id = startRef;
|
||||
startNode.flags = Node.DT_NODE_CLOSED;
|
||||
LinkedList<Node> stack = new();
|
||||
LinkedList<Node> stack = new LinkedList<Node>();
|
||||
stack.AddLast(startNode);
|
||||
|
||||
resultRef.Add(startNode.id);
|
||||
|
@ -2679,9 +2681,9 @@ public class NavMeshQuery {
|
|||
MeshTile tile = tileAndPoly.result.Item1;
|
||||
Poly poly = tileAndPoly.result.Item2;
|
||||
|
||||
List<long> segmentRefs = new();
|
||||
List<float[]> segmentVerts = new();
|
||||
List<SegInterval> ints = new(16);
|
||||
List<long> segmentRefs = new List<long>();
|
||||
List<float[]> segmentVerts = new List<float[]>();
|
||||
List<SegInterval> ints = new List<SegInterval>(16);
|
||||
|
||||
for (int i = 0, j = poly.vertCount - 1; i < poly.vertCount; j = i++) {
|
||||
// Skip non-solid edges.
|
||||
|
@ -3012,7 +3014,7 @@ public class NavMeshQuery {
|
|||
* Gets the path leading to the specified end node.
|
||||
*/
|
||||
protected List<long> getPathToNode(Node endNode) {
|
||||
List<long> path = new();
|
||||
List<long> path = new List<long>();
|
||||
// Reverse the path.
|
||||
Node curNode = endNode;
|
||||
do {
|
||||
|
@ -3054,3 +3056,4 @@ public class NavMeshQuery {
|
|||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -20,7 +20,9 @@ freely, subject to the following restrictions:
|
|||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DotRecast.Detour;
|
||||
namespace DotRecast.Detour
|
||||
{
|
||||
|
||||
|
||||
|
||||
public class Node {
|
||||
|
@ -60,3 +62,5 @@ public class Node {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -20,14 +20,16 @@ freely, subject to the following restrictions:
|
|||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DotRecast.Detour;
|
||||
namespace DotRecast.Detour
|
||||
{
|
||||
|
||||
|
||||
|
||||
public class NodePool
|
||||
{
|
||||
|
||||
private readonly Dictionary<long, List<Node>> m_map = new();
|
||||
private readonly List<Node> m_nodes = new();
|
||||
private readonly Dictionary<long, List<Node>> m_map = new Dictionary<long, List<Node>>();
|
||||
private readonly List<Node> m_nodes = new List<Node>();
|
||||
|
||||
public NodePool() {
|
||||
|
||||
|
@ -41,7 +43,7 @@ public class NodePool
|
|||
public List<Node> findNodes(long id) {
|
||||
var hasNode = m_map.TryGetValue(id, out var nodes);;
|
||||
if (nodes == null) {
|
||||
nodes = new();
|
||||
nodes = new List<Node>();
|
||||
}
|
||||
return nodes;
|
||||
}
|
||||
|
@ -73,7 +75,7 @@ public class NodePool
|
|||
m_nodes.Add(node);
|
||||
var hasNode = m_map.TryGetValue(id, out var nodes);;
|
||||
if (nodes == null) {
|
||||
nodes = new();
|
||||
nodes = new List<Node>();
|
||||
m_map.Add(id, nodes);
|
||||
}
|
||||
nodes.Add(node);
|
||||
|
@ -97,3 +99,5 @@ public class NodePool
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -17,13 +17,15 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Detour;
|
||||
namespace DotRecast.Detour
|
||||
{
|
||||
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class NodeQueue {
|
||||
|
||||
private readonly List<Node> m_heap = new();
|
||||
private readonly List<Node> m_heap = new List<Node>();
|
||||
|
||||
public int count()
|
||||
{
|
||||
|
@ -61,3 +63,5 @@ public class NodeQueue {
|
|||
return 0 == m_heap.Count;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -17,7 +17,9 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Detour;
|
||||
namespace DotRecast.Detour
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Defines an navigation mesh off-mesh connection within a dtMeshTile object. An off-mesh connection is a user defined
|
||||
|
@ -42,3 +44,4 @@ public class OffMeshConnection {
|
|||
/** The id of the offmesh connection. (User assigned when the navigation mesh is built.) */
|
||||
public int userId;
|
||||
}
|
||||
}
|
|
@ -17,7 +17,9 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Detour;
|
||||
namespace DotRecast.Detour
|
||||
{
|
||||
|
||||
|
||||
/** Defines a polygon within a MeshTile object. */
|
||||
public class Poly {
|
||||
|
@ -69,3 +71,5 @@ public class Poly {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -17,7 +17,9 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Detour;
|
||||
namespace DotRecast.Detour
|
||||
{
|
||||
|
||||
|
||||
/** Defines the location of detail sub-mesh data within a dtMeshTile. */
|
||||
public class PolyDetail {
|
||||
|
@ -30,3 +32,5 @@ public class PolyDetail {
|
|||
/** The number of triangles in the sub-mesh. */
|
||||
public int triCount;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,6 +1,10 @@
|
|||
namespace DotRecast.Detour;
|
||||
namespace DotRecast.Detour
|
||||
{
|
||||
|
||||
|
||||
public interface PolyQuery {
|
||||
|
||||
void process(MeshTile tile, Poly poly, long refs);
|
||||
}
|
||||
|
||||
}
|
|
@ -18,7 +18,9 @@ freely, subject to the following restrictions:
|
|||
|
||||
using System;
|
||||
|
||||
namespace DotRecast.Detour;
|
||||
namespace DotRecast.Detour
|
||||
{
|
||||
|
||||
|
||||
using static DetourCommon;
|
||||
|
||||
|
@ -92,3 +94,5 @@ public interface PolygonByCircleConstraint {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -17,7 +17,9 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Detour;
|
||||
namespace DotRecast.Detour
|
||||
{
|
||||
|
||||
|
||||
public class QueryData {
|
||||
public Status status;
|
||||
|
@ -31,3 +33,4 @@ public class QueryData {
|
|||
public float raycastLimitSqr;
|
||||
public QueryHeuristic heuristic;
|
||||
}
|
||||
}
|
|
@ -17,7 +17,9 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Detour;
|
||||
namespace DotRecast.Detour
|
||||
{
|
||||
|
||||
|
||||
public interface QueryFilter {
|
||||
|
||||
|
@ -27,3 +29,5 @@ public interface QueryFilter {
|
|||
Poly curPoly, long nextRef, MeshTile nextTile, Poly nextPoly);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -16,10 +16,14 @@ freely, subject to the following restrictions:
|
|||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
namespace DotRecast.Detour;
|
||||
namespace DotRecast.Detour
|
||||
{
|
||||
|
||||
|
||||
public interface QueryHeuristic {
|
||||
|
||||
float getCost(float[] neighbourPos, float[] endPos);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -20,7 +20,9 @@ freely, subject to the following restrictions:
|
|||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DotRecast.Detour;
|
||||
namespace DotRecast.Detour
|
||||
{
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
@ -32,9 +34,11 @@ public class RaycastHit {
|
|||
/** hitNormal The normal of the nearest wall hit. [(x, y, z)] */
|
||||
public readonly float[] hitNormal = new float[3];
|
||||
/** Visited polygons. */
|
||||
public readonly List<long> path = new();
|
||||
public readonly List<long> path = new List<long>();
|
||||
/** The cost of the path until hit. */
|
||||
public float pathCost;
|
||||
/** The index of the edge on the readonly polygon where the wall was hit. */
|
||||
public int hitEdgeIndex;
|
||||
}
|
||||
|
||||
}
|
|
@ -17,7 +17,9 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Detour;
|
||||
namespace DotRecast.Detour
|
||||
{
|
||||
|
||||
|
||||
public static class Results
|
||||
{
|
||||
|
@ -81,3 +83,5 @@ public class Result<T> {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -17,14 +17,16 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Detour;
|
||||
namespace DotRecast.Detour
|
||||
{
|
||||
|
||||
|
||||
public class Status {
|
||||
public static Status FAILURE = new(0);
|
||||
public static Status SUCCSESS = new(1);
|
||||
public static Status IN_PROGRESS = new(2);
|
||||
public static Status PARTIAL_RESULT = new(3);
|
||||
public static Status FAILURE_INVALID_PARAM = new(4);
|
||||
public static Status FAILURE = new Status(0);
|
||||
public static Status SUCCSESS = new Status(1);
|
||||
public static Status IN_PROGRESS = new Status(2);
|
||||
public static Status PARTIAL_RESULT = new Status(3);
|
||||
public static Status FAILURE_INVALID_PARAM = new Status(4);
|
||||
|
||||
public int Value { get; }
|
||||
|
||||
|
@ -53,3 +55,5 @@ public static class StatusEx
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -17,7 +17,9 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Detour;
|
||||
namespace DotRecast.Detour
|
||||
{
|
||||
|
||||
|
||||
using static DetourCommon;
|
||||
|
||||
|
@ -46,3 +48,4 @@ public class StraightPathItem {
|
|||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -18,7 +18,9 @@ freely, subject to the following restrictions:
|
|||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
namespace DotRecast.Detour;
|
||||
namespace DotRecast.Detour
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Wrapper for 3-element pieces (3D vectors) of a bigger float array.
|
||||
|
@ -45,3 +47,4 @@ public class VectorPtr
|
|||
return array[index + offset];
|
||||
}
|
||||
}
|
||||
}
|
|
@ -18,7 +18,9 @@ freely, subject to the following restrictions:
|
|||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
namespace DotRecast.Recast;
|
||||
namespace DotRecast.Recast
|
||||
{
|
||||
|
||||
|
||||
public class AreaModification
|
||||
{
|
||||
|
@ -68,3 +70,4 @@ public class AreaModification
|
|||
return ((value & mask) | (area & ~mask));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -18,7 +18,9 @@ freely, subject to the following restrictions:
|
|||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
namespace DotRecast.Recast;
|
||||
namespace DotRecast.Recast
|
||||
{
|
||||
|
||||
|
||||
/** Provides information on the content of a cell column in a compact heightfield. */
|
||||
public class CompactCell
|
||||
|
@ -29,3 +31,4 @@ public class CompactCell
|
|||
/** Number of spans in the column. */
|
||||
public int count;
|
||||
}
|
||||
}
|
|
@ -18,7 +18,9 @@ freely, subject to the following restrictions:
|
|||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
namespace DotRecast.Recast;
|
||||
namespace DotRecast.Recast
|
||||
{
|
||||
|
||||
|
||||
/** A compact, static heightfield representing unobstructed space. */
|
||||
public class CompactHeightfield
|
||||
|
@ -71,3 +73,4 @@ public class CompactHeightfield
|
|||
/** Array containing area id data. [Size: #spanCount] */
|
||||
public int[] areas;
|
||||
}
|
||||
}
|
|
@ -18,7 +18,9 @@ freely, subject to the following restrictions:
|
|||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
namespace DotRecast.Recast;
|
||||
namespace DotRecast.Recast
|
||||
{
|
||||
|
||||
|
||||
/** Represents a span of unobstructed space within a compact heightfield. */
|
||||
public class CompactSpan
|
||||
|
@ -35,3 +37,4 @@ public class CompactSpan
|
|||
/** The height of the span. (Measured from #y.) */
|
||||
public int h;
|
||||
}
|
||||
}
|
|
@ -18,7 +18,9 @@ freely, subject to the following restrictions:
|
|||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
namespace DotRecast.Recast;
|
||||
namespace DotRecast.Recast
|
||||
{
|
||||
|
||||
|
||||
/** Represents a simple, non-overlapping contour in field space. */
|
||||
public class Contour
|
||||
|
@ -41,3 +43,4 @@ public class Contour
|
|||
/** The area id of the contour. */
|
||||
public int reg;
|
||||
}
|
||||
}
|
|
@ -20,13 +20,15 @@ freely, subject to the following restrictions:
|
|||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DotRecast.Recast;
|
||||
namespace DotRecast.Recast
|
||||
{
|
||||
|
||||
|
||||
/** Represents a group of related contours. */
|
||||
public class ContourSet
|
||||
{
|
||||
/** A list of the contours in the set. */
|
||||
public List<Contour> conts = new();
|
||||
public List<Contour> conts = new List<Contour>();
|
||||
|
||||
/** The minimum bounds in world space. [(x, y, z)] */
|
||||
public float[] bmin = new float[3];
|
||||
|
@ -52,3 +54,4 @@ public class ContourSet
|
|||
/** The max edge error that this contour set was simplified with. */
|
||||
public float maxError;
|
||||
}
|
||||
}
|
|
@ -18,7 +18,9 @@ freely, subject to the following restrictions:
|
|||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
namespace DotRecast.Recast;
|
||||
namespace DotRecast.Recast
|
||||
{
|
||||
|
||||
|
||||
public class ConvexVolume
|
||||
{
|
||||
|
@ -27,3 +29,4 @@ public class ConvexVolume
|
|||
public float hmax;
|
||||
public AreaModification areaMod;
|
||||
}
|
||||
}
|
|
@ -1,8 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
|
||||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -21,7 +21,9 @@ freely, subject to the following restrictions:
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DotRecast.Recast.Geom;
|
||||
namespace DotRecast.Recast.Geom
|
||||
{
|
||||
|
||||
|
||||
public class ChunkyTriMesh
|
||||
{
|
||||
|
@ -150,7 +152,7 @@ public class ChunkyTriMesh
|
|||
{
|
||||
int nchunks = (ntris + trisPerChunk - 1) / trisPerChunk;
|
||||
|
||||
nodes = new(nchunks);
|
||||
nodes = new List<ChunkyTriMeshNode>(nchunks);
|
||||
this.ntris = ntris;
|
||||
|
||||
// Build tree
|
||||
|
@ -219,7 +221,7 @@ public class ChunkyTriMesh
|
|||
public List<ChunkyTriMeshNode> getChunksOverlappingRect(float[] bmin, float[] bmax)
|
||||
{
|
||||
// Traverse tree
|
||||
List<ChunkyTriMeshNode> ids = new();
|
||||
List<ChunkyTriMeshNode> ids = new List<ChunkyTriMeshNode>();
|
||||
int i = 0;
|
||||
while (i < nodes.Count)
|
||||
{
|
||||
|
@ -245,3 +247,4 @@ public class ChunkyTriMesh
|
|||
return ids;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,6 @@
|
|||
namespace DotRecast.Recast.Geom;
|
||||
namespace DotRecast.Recast.Geom
|
||||
{
|
||||
|
||||
|
||||
public class ChunkyTriMeshNode
|
||||
{
|
||||
|
@ -7,3 +9,5 @@ public class ChunkyTriMeshNode
|
|||
public int i;
|
||||
public int[] tris;
|
||||
}
|
||||
|
||||
}
|
|
@ -18,9 +18,12 @@ freely, subject to the following restrictions:
|
|||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DotRecast.Recast.Geom;
|
||||
namespace DotRecast.Recast.Geom
|
||||
{
|
||||
|
||||
|
||||
public interface ConvexVolumeProvider
|
||||
{
|
||||
IList<ConvexVolume> convexVolumes();
|
||||
}
|
||||
}
|
|
@ -20,7 +20,9 @@ freely, subject to the following restrictions:
|
|||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DotRecast.Recast.Geom;
|
||||
namespace DotRecast.Recast.Geom
|
||||
{
|
||||
|
||||
|
||||
public interface InputGeomProvider : ConvexVolumeProvider
|
||||
{
|
||||
|
@ -30,3 +32,4 @@ public interface InputGeomProvider : ConvexVolumeProvider
|
|||
|
||||
IEnumerable<TriMesh> meshes();
|
||||
}
|
||||
}
|
|
@ -22,7 +22,9 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
|
||||
namespace DotRecast.Recast.Geom;
|
||||
namespace DotRecast.Recast.Geom
|
||||
{
|
||||
|
||||
|
||||
public class SimpleInputGeomProvider : InputGeomProvider
|
||||
{
|
||||
|
@ -31,7 +33,7 @@ public class SimpleInputGeomProvider : InputGeomProvider
|
|||
public readonly float[] normals;
|
||||
readonly float[] bmin;
|
||||
readonly float[] bmax;
|
||||
readonly List<ConvexVolume> volumes = new();
|
||||
readonly List<ConvexVolume> volumes = new List<ConvexVolume>();
|
||||
|
||||
public SimpleInputGeomProvider(List<float> vertexPositions, List<int> meshFaces)
|
||||
: this(mapVertices(vertexPositions), mapFaces(meshFaces))
|
||||
|
@ -102,8 +104,7 @@ public class SimpleInputGeomProvider : InputGeomProvider
|
|||
volumes.Add(vol);
|
||||
}
|
||||
|
||||
public IEnumerable<TriMesh> meshes()
|
||||
{
|
||||
public IEnumerable<TriMesh> meshes() {
|
||||
return ImmutableArray.Create(new TriMesh(vertices, faces));
|
||||
}
|
||||
|
||||
|
@ -135,3 +136,4 @@ public class SimpleInputGeomProvider : InputGeomProvider
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -16,16 +16,19 @@ freely, subject to the following restrictions:
|
|||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
|
||||
namespace DotRecast.Recast.Geom;
|
||||
namespace DotRecast.Recast.Geom
|
||||
{
|
||||
|
||||
|
||||
public class SingleTrimeshInputGeomProvider : InputGeomProvider
|
||||
{
|
||||
private readonly float[] bmin;
|
||||
private readonly float[] bmax;
|
||||
private readonly ImmutableArray<TriMesh> _meshes;
|
||||
private readonly TriMesh[] _meshes;
|
||||
|
||||
public SingleTrimeshInputGeomProvider(float[] vertices, int[] faces)
|
||||
{
|
||||
|
@ -39,7 +42,7 @@ public class SingleTrimeshInputGeomProvider : InputGeomProvider
|
|||
RecastVectors.max(bmax, vertices, i * 3);
|
||||
}
|
||||
|
||||
_meshes = ImmutableArray.Create(new TriMesh(vertices, faces));
|
||||
_meshes = new[] { new TriMesh(vertices, faces) };
|
||||
}
|
||||
|
||||
public float[] getMeshBoundsMin()
|
||||
|
@ -62,3 +65,4 @@ public class SingleTrimeshInputGeomProvider : InputGeomProvider
|
|||
return ImmutableArray<ConvexVolume>.Empty;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -20,7 +20,9 @@ freely, subject to the following restrictions:
|
|||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DotRecast.Recast.Geom;
|
||||
namespace DotRecast.Recast.Geom
|
||||
{
|
||||
|
||||
|
||||
public class TriMesh
|
||||
{
|
||||
|
@ -50,3 +52,4 @@ public class TriMesh
|
|||
return chunkyTriMesh.getChunksOverlappingRect(bmin, bmax);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -18,7 +18,9 @@ freely, subject to the following restrictions:
|
|||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
namespace DotRecast.Recast;
|
||||
namespace DotRecast.Recast
|
||||
{
|
||||
|
||||
|
||||
/** Represents a heightfield layer within a layer set. */
|
||||
public class Heightfield
|
||||
|
@ -59,3 +61,4 @@ public class Heightfield
|
|||
spans = new Span[width * height];
|
||||
}
|
||||
}
|
||||
}
|
|
@ -18,7 +18,9 @@ freely, subject to the following restrictions:
|
|||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
namespace DotRecast.Recast;
|
||||
namespace DotRecast.Recast
|
||||
{
|
||||
|
||||
|
||||
/// Represents a set of heightfield layers.
|
||||
/// @ingroup recast
|
||||
|
@ -76,3 +78,4 @@ public class HeightfieldLayerSet
|
|||
|
||||
public HeightfieldLayer[] layers; /// < The layers in the set. [Size: #nlayers]
|
||||
}
|
||||
}
|
|
@ -1,5 +1,8 @@
|
|||
namespace DotRecast.Recast;
|
||||
namespace DotRecast.Recast
|
||||
{
|
||||
|
||||
|
||||
public class InputGeomReader
|
||||
{
|
||||
}
|
||||
}
|
|
@ -21,14 +21,16 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using DotRecast.Recast.Geom;
|
||||
|
||||
namespace DotRecast.Recast;
|
||||
namespace DotRecast.Recast
|
||||
{
|
||||
|
||||
|
||||
public static class ObjImporter
|
||||
{
|
||||
public class ObjImporterContext
|
||||
{
|
||||
public List<float> vertexPositions = new();
|
||||
public List<int> meshFaces = new();
|
||||
public List<float> vertexPositions = new List<float>();
|
||||
public List<int> meshFaces = new List<int>();
|
||||
}
|
||||
|
||||
public static InputGeomProvider load(byte[] chunck)
|
||||
|
@ -136,3 +138,4 @@ public static class ObjImporter
|
|||
return posi;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,6 @@
|
|||
namespace DotRecast.Recast;
|
||||
namespace DotRecast.Recast
|
||||
{
|
||||
|
||||
|
||||
/// < Tessellate edges between areas during contour
|
||||
/// simplification.
|
||||
|
@ -8,3 +10,4 @@ public enum PartitionType
|
|||
MONOTONE,
|
||||
LAYERS
|
||||
}
|
||||
}
|
|
@ -17,7 +17,9 @@ freely, subject to the following restrictions:
|
|||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
namespace DotRecast.Recast;
|
||||
namespace DotRecast.Recast
|
||||
{
|
||||
|
||||
|
||||
/** Represents a polygon mesh suitable for use in building a navigation mesh. */
|
||||
public class PolyMesh
|
||||
|
@ -67,3 +69,4 @@ public class PolyMesh
|
|||
/** The max error of the polygon edges in the mesh. */
|
||||
public float maxEdgeError;
|
||||
}
|
||||
}
|
|
@ -18,7 +18,9 @@ freely, subject to the following restrictions:
|
|||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
namespace DotRecast.Recast;
|
||||
namespace DotRecast.Recast
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Contains triangle meshes that represent detailed height data associated with the polygons in its associated polygon
|
||||
|
@ -44,3 +46,4 @@ public class PolyMeshDetail
|
|||
/** The number of triangles in #tris. */
|
||||
public int ntris;
|
||||
}
|
||||
}
|
|
@ -20,7 +20,9 @@ freely, subject to the following restrictions:
|
|||
|
||||
using System;
|
||||
|
||||
namespace DotRecast.Recast;
|
||||
namespace DotRecast.Recast
|
||||
{
|
||||
|
||||
|
||||
using static RecastConstants;
|
||||
|
||||
|
@ -120,3 +122,4 @@ public class Recast
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -20,7 +20,9 @@ freely, subject to the following restrictions:
|
|||
|
||||
using System;
|
||||
|
||||
namespace DotRecast.Recast;
|
||||
namespace DotRecast.Recast
|
||||
{
|
||||
|
||||
|
||||
using static RecastConstants;
|
||||
|
||||
|
@ -583,3 +585,4 @@ public class RecastArea
|
|||
ctx.stopTimer("MARK_CYLINDER_AREA");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -25,7 +25,9 @@ using System.Threading.Tasks;
|
|||
using DotRecast.Core;
|
||||
using DotRecast.Recast.Geom;
|
||||
|
||||
namespace DotRecast.Recast;
|
||||
namespace DotRecast.Recast
|
||||
{
|
||||
|
||||
|
||||
public class RecastBuilder
|
||||
{
|
||||
|
@ -52,7 +54,7 @@ public class RecastBuilder
|
|||
int[] twh = Recast.calcTileCount(bmin, bmax, cfg.cs, cfg.tileSizeX, cfg.tileSizeZ);
|
||||
int tw = twh[0];
|
||||
int th = twh[1];
|
||||
List<RecastBuilderResult> results = new();
|
||||
List<RecastBuilderResult> results = new List<RecastBuilderResult>();
|
||||
if (null != taskFactory)
|
||||
{
|
||||
buildMultiThreadAsync(geom, cfg, bmin, bmax, tw, th, results, taskFactory, default);
|
||||
|
@ -104,7 +106,7 @@ public class RecastBuilder
|
|||
{
|
||||
AtomicInteger counter = new AtomicInteger(0);
|
||||
CountdownEvent latch = new CountdownEvent(tw * th);
|
||||
List<Task> tasks = new();
|
||||
List<Task> tasks = new List<Task>();
|
||||
|
||||
for (int x = 0; x < tw; ++x)
|
||||
{
|
||||
|
@ -318,3 +320,4 @@ public class RecastBuilder
|
|||
return RecastLayers.buildHeightfieldLayers(ctx, chf, builderCfg.cfg.walkableHeight);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -18,7 +18,9 @@ freely, subject to the following restrictions:
|
|||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
namespace DotRecast.Recast;
|
||||
namespace DotRecast.Recast
|
||||
{
|
||||
|
||||
|
||||
using static RecastVectors;
|
||||
|
||||
|
@ -98,3 +100,4 @@ public class RecastBuilderConfig
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,6 @@
|
|||
namespace DotRecast.Recast;
|
||||
namespace DotRecast.Recast
|
||||
{
|
||||
|
||||
|
||||
public class RecastBuilderResult
|
||||
{
|
||||
|
@ -54,3 +56,5 @@ public class RecastBuilderResult
|
|||
return telemetry;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -20,7 +20,9 @@ freely, subject to the following restrictions:
|
|||
|
||||
using System;
|
||||
|
||||
namespace DotRecast.Recast;
|
||||
namespace DotRecast.Recast
|
||||
{
|
||||
|
||||
|
||||
public class RecastCommon
|
||||
{
|
||||
|
@ -83,3 +85,4 @@ public class RecastCommon
|
|||
|
||||
|
||||
}
|
||||
}
|
|
@ -18,7 +18,9 @@ freely, subject to the following restrictions:
|
|||
|
||||
using System;
|
||||
|
||||
namespace DotRecast.Recast;
|
||||
namespace DotRecast.Recast
|
||||
{
|
||||
|
||||
|
||||
using static RecastConstants;
|
||||
using static RecastVectors;
|
||||
|
@ -184,3 +186,4 @@ public class RecastCompact
|
|||
return spanCount;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -20,7 +20,9 @@ freely, subject to the following restrictions:
|
|||
|
||||
using System;
|
||||
|
||||
namespace DotRecast.Recast;
|
||||
namespace DotRecast.Recast
|
||||
{
|
||||
|
||||
|
||||
using static RecastConstants;
|
||||
|
||||
|
@ -184,3 +186,4 @@ public class RecastConfig
|
|||
return 3 + (int)Math.Ceiling(agentRadius / cs);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -18,7 +18,9 @@ freely, subject to the following restrictions:
|
|||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
namespace DotRecast.Recast;
|
||||
namespace DotRecast.Recast
|
||||
{
|
||||
|
||||
|
||||
public static class RecastConstants
|
||||
{
|
||||
|
@ -83,3 +85,4 @@ public static class RecastConstants
|
|||
|
||||
public const int RC_LOG_WARNING = 1;
|
||||
}
|
||||
}
|
|
@ -21,7 +21,9 @@ freely, subject to the following restrictions:
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DotRecast.Recast;
|
||||
namespace DotRecast.Recast
|
||||
{
|
||||
|
||||
|
||||
using static RecastConstants;
|
||||
|
||||
|
@ -842,8 +844,8 @@ public class RecastContour
|
|||
|
||||
ctx.stopTimer("CONTOURS_TRACE");
|
||||
|
||||
List<int> verts = new(256);
|
||||
List<int> simplified = new(64);
|
||||
List<int> verts = new List<int>(256);
|
||||
List<int> simplified = new List<int>(64);
|
||||
|
||||
for (int y = 0; y < h; ++y)
|
||||
{
|
||||
|
@ -1018,3 +1020,4 @@ public class RecastContour
|
|||
return cset;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -19,7 +19,9 @@ freely, subject to the following restrictions:
|
|||
using System;
|
||||
using DotRecast.Core;
|
||||
|
||||
namespace DotRecast.Recast;
|
||||
namespace DotRecast.Recast
|
||||
{
|
||||
|
||||
|
||||
using static RecastConstants;
|
||||
using static RecastVectors;
|
||||
|
@ -800,3 +802,4 @@ public class RecastFilledVolumeRasterization
|
|||
return overlap;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -20,7 +20,9 @@ freely, subject to the following restrictions:
|
|||
|
||||
using System;
|
||||
|
||||
namespace DotRecast.Recast;
|
||||
namespace DotRecast.Recast
|
||||
{
|
||||
|
||||
|
||||
using static RecastConstants;
|
||||
|
||||
|
@ -203,3 +205,4 @@ public class RecastFilter
|
|||
ctx.stopTimer("FILTER_WALKABLE");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -21,7 +21,9 @@ freely, subject to the following restrictions:
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DotRecast.Recast;
|
||||
namespace DotRecast.Recast
|
||||
{
|
||||
|
||||
|
||||
using static RecastCommon;
|
||||
using static RecastConstants;
|
||||
|
@ -45,8 +47,8 @@ public class RecastLayers {
|
|||
id = i;
|
||||
ymin = 0xFFFF;
|
||||
layerId = 0xff;
|
||||
layers = new();
|
||||
neis = new();
|
||||
layers = new List<int>();
|
||||
neis = new List<int>();
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -174,7 +176,7 @@ public class RecastLayers {
|
|||
}
|
||||
|
||||
// Find region neighbours and overlapping regions.
|
||||
List<int> lregs = new();
|
||||
List<int> lregs = new List<int>();
|
||||
for (int y = 0; y < h; ++y) {
|
||||
for (int x = 0; x < w; ++x) {
|
||||
CompactCell c = chf.cells[x + y * w];
|
||||
|
@ -225,7 +227,7 @@ public class RecastLayers {
|
|||
// Create 2D layers from regions.
|
||||
int layerId = 0;
|
||||
|
||||
List<int> stack = new();
|
||||
List<int> stack = new List<int>();
|
||||
|
||||
for (int i = 0; i < nregs; ++i) {
|
||||
LayerRegion root = regs[i];
|
||||
|
@ -505,3 +507,5 @@ public class RecastLayers {
|
|||
return lset;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -20,7 +20,9 @@ freely, subject to the following restrictions:
|
|||
|
||||
using System;
|
||||
|
||||
namespace DotRecast.Recast;
|
||||
namespace DotRecast.Recast
|
||||
{
|
||||
|
||||
|
||||
using static RecastConstants;
|
||||
|
||||
|
@ -1212,3 +1214,5 @@ public class RecastMesh {
|
|||
return dst;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -22,7 +22,9 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using DotRecast.Core;
|
||||
|
||||
namespace DotRecast.Recast;
|
||||
namespace DotRecast.Recast
|
||||
{
|
||||
|
||||
|
||||
using static RecastCommon;
|
||||
using static RecastConstants;
|
||||
|
@ -454,7 +456,7 @@ public class RecastMeshDetail {
|
|||
private static void delaunayHull(Telemetry ctx, int npts, float[] pts, int nhull, int[] hull, List<int> tris) {
|
||||
int nfaces = 0;
|
||||
int maxEdges = npts * 10;
|
||||
List<int> edges = new(64);
|
||||
List<int> edges = new List<int>(64);
|
||||
for (int i = 0, j = nhull - 1; i < nhull; j = i++) {
|
||||
addEdge(ctx, edges, maxEdges, hull[j], hull[i], EV_HULL, EV_UNDEF);
|
||||
}
|
||||
|
@ -618,7 +620,7 @@ public class RecastMeshDetail {
|
|||
static int buildPolyDetail(Telemetry ctx, float[] @in, int nin, float sampleDist, float sampleMaxError,
|
||||
int heightSearchRadius, CompactHeightfield chf, HeightPatch hp, float[] verts, List<int> tris) {
|
||||
|
||||
List<int> samples = new(512);
|
||||
List<int> samples = new List<int>(512);
|
||||
|
||||
int nverts = 0;
|
||||
float[] edge = new float[(MAX_VERTS_PER_EDGE + 1) * 3];
|
||||
|
@ -988,7 +990,7 @@ public class RecastMeshDetail {
|
|||
// Note: Reads to the compact heightfield are offset by border size (bs)
|
||||
// since border size offset is already removed from the polymesh vertices.
|
||||
|
||||
List<int> queue = new(512);
|
||||
List<int> queue = new List<int>(512);
|
||||
Array.Fill(hp.data, RC_UNSET_HEIGHT, 0, (hp.width * hp.height) - (0));
|
||||
|
||||
bool empty = true;
|
||||
|
@ -1127,7 +1129,7 @@ public class RecastMeshDetail {
|
|||
int borderSize = mesh.borderSize;
|
||||
int heightSearchRadius = (int) Math.Max(1, Math.Ceiling(mesh.maxEdgeError));
|
||||
|
||||
List<int> tris = new(512);
|
||||
List<int> tris = new List<int>(512);
|
||||
float[] verts = new float[256 * 3];
|
||||
HeightPatch hp = new HeightPatch();
|
||||
int nPolyVerts = 0;
|
||||
|
@ -1333,3 +1335,5 @@ public class RecastMeshDetail {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -20,7 +20,9 @@ freely, subject to the following restrictions:
|
|||
|
||||
using System;
|
||||
|
||||
namespace DotRecast.Recast;
|
||||
namespace DotRecast.Recast
|
||||
{
|
||||
|
||||
|
||||
using static RecastConstants;
|
||||
|
||||
|
@ -482,3 +484,4 @@ public class RecastRasterization
|
|||
ctx.stopTimer("RASTERIZE_TRIANGLES");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -22,7 +22,9 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace DotRecast.Recast;
|
||||
namespace DotRecast.Recast
|
||||
{
|
||||
|
||||
|
||||
using static RecastConstants;
|
||||
|
||||
|
@ -360,7 +362,7 @@ public class RecastRegion {
|
|||
}
|
||||
}
|
||||
|
||||
List<int> dirtyEntries = new();
|
||||
List<int> dirtyEntries = new List<int>();
|
||||
int iter = 0;
|
||||
while (stack.Count > 0) {
|
||||
int failed = 0;
|
||||
|
@ -493,8 +495,8 @@ public class RecastRegion {
|
|||
public Region(int i) {
|
||||
id = i;
|
||||
ymin = 0xFFFF;
|
||||
connections = new();
|
||||
floors = new();
|
||||
connections = new List<int>();
|
||||
floors = new List<int>();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -563,7 +565,7 @@ public class RecastRegion {
|
|||
int bid = regb.id;
|
||||
|
||||
// Duplicate current neighbourhood.
|
||||
List<int> acon = new(rega.connections);
|
||||
List<int> acon = new List<int>(rega.connections);
|
||||
List<int> bcon = regb.connections;
|
||||
|
||||
// Find insertion point on A.
|
||||
|
@ -770,8 +772,8 @@ public class RecastRegion {
|
|||
}
|
||||
|
||||
// Remove too small regions.
|
||||
List<int> stack = new(32);
|
||||
List<int> trace = new(32);
|
||||
List<int> stack = new List<int>(32);
|
||||
List<int> trace = new List<int>(32);
|
||||
for (int i = 0; i < nreg; ++i) {
|
||||
Region reg = regions[i];
|
||||
if (reg.id == 0 || (reg.id & RC_BORDER_REG) != 0) {
|
||||
|
@ -966,7 +968,7 @@ public class RecastRegion {
|
|||
}
|
||||
|
||||
// Find region neighbours and overlapping regions.
|
||||
List<int> lregs = new(32);
|
||||
List<int> lregs = new List<int>(32);
|
||||
for (int y = 0; y < h; ++y) {
|
||||
for (int x = 0; x < w; ++x) {
|
||||
CompactCell c = chf.cells[x + y * w];
|
||||
|
@ -1029,7 +1031,7 @@ public class RecastRegion {
|
|||
}
|
||||
|
||||
// Merge montone regions to create non-overlapping areas.
|
||||
List<int> stack = new(32);
|
||||
List<int> stack = new List<int>(32);
|
||||
for (int i = 1; i < nreg; ++i) {
|
||||
Region root = regions[i];
|
||||
// Skip already visited.
|
||||
|
@ -1333,7 +1335,7 @@ public class RecastRegion {
|
|||
ctx.startTimer("REGIONS_FILTER");
|
||||
|
||||
// Merge regions and filter out small regions.
|
||||
List<int> overlaps = new();
|
||||
List<int> overlaps = new List<int>();
|
||||
chf.maxRegions = mergeAndFilterRegions(ctx, minRegionArea, mergeRegionArea, id, chf, srcReg, overlaps);
|
||||
|
||||
// Monotone partitioning does not generate overlapping regions.
|
||||
|
@ -1380,12 +1382,12 @@ public class RecastRegion {
|
|||
|
||||
int LOG_NB_STACKS = 3;
|
||||
int NB_STACKS = 1 << LOG_NB_STACKS;
|
||||
List<List<int>> lvlStacks = new();
|
||||
List<List<int>> lvlStacks = new List<List<int>>();
|
||||
for (int i = 0; i < NB_STACKS; ++i) {
|
||||
lvlStacks.Add(new (1024));
|
||||
lvlStacks.Add(new List<int>(1024));
|
||||
}
|
||||
|
||||
List<int> stack = new(1024);
|
||||
List<int> stack = new List<int>(1024);
|
||||
|
||||
int[] srcReg = new int[chf.spanCount];
|
||||
int[] srcDist = new int[chf.spanCount];
|
||||
|
@ -1464,7 +1466,7 @@ public class RecastRegion {
|
|||
ctx.startTimer("REGIONS_FILTER");
|
||||
|
||||
// Merge regions and filter out smalle regions.
|
||||
List<int> overlaps = new();
|
||||
List<int> overlaps = new List<int>();
|
||||
chf.maxRegions = mergeAndFilterRegions(ctx, minRegionArea, mergeRegionArea, regionId, chf, srcReg, overlaps);
|
||||
|
||||
// If overlapping regions were found during merging, split those regions.
|
||||
|
@ -1603,7 +1605,7 @@ public class RecastRegion {
|
|||
ctx.startTimer("REGIONS_FILTER");
|
||||
|
||||
// Merge monotone regions to layers and remove small regions.
|
||||
List<int> overlaps = new();
|
||||
List<int> overlaps = new List<int>();
|
||||
chf.maxRegions = mergeAndFilterLayerRegions(ctx, minRegionArea, id, chf, srcReg, overlaps);
|
||||
|
||||
ctx.stopTimer("REGIONS_FILTER");
|
||||
|
@ -1617,3 +1619,5 @@ public class RecastRegion {
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -20,7 +20,9 @@ freely, subject to the following restrictions:
|
|||
|
||||
using System;
|
||||
|
||||
namespace DotRecast.Recast;
|
||||
namespace DotRecast.Recast
|
||||
{
|
||||
|
||||
|
||||
public static class RecastVectors
|
||||
{
|
||||
|
@ -96,3 +98,4 @@ public static class RecastVectors
|
|||
return v1[0] * v2[0] + v1[1] * v2[1] + v1[2] * v2[2];
|
||||
}
|
||||
}
|
||||
}
|
|
@ -19,7 +19,9 @@ freely, subject to the following restrictions:
|
|||
using System.Collections.Generic;
|
||||
using DotRecast.Recast.Geom;
|
||||
|
||||
namespace DotRecast.Recast;
|
||||
namespace DotRecast.Recast
|
||||
{
|
||||
|
||||
|
||||
public class RecastVoxelization {
|
||||
|
||||
|
@ -71,3 +73,5 @@ public class RecastVoxelization {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -17,7 +17,9 @@ freely, subject to the following restrictions:
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
namespace DotRecast.Recast;
|
||||
namespace DotRecast.Recast
|
||||
{
|
||||
|
||||
|
||||
/** Represents a span in a heightfield. */
|
||||
public class Span {
|
||||
|
@ -32,3 +34,5 @@ public class Span {
|
|||
public Span next;
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -23,12 +23,14 @@ using System.Diagnostics;
|
|||
using System.Threading;
|
||||
using DotRecast.Core;
|
||||
|
||||
namespace DotRecast.Recast;
|
||||
namespace DotRecast.Recast
|
||||
{
|
||||
|
||||
|
||||
public class Telemetry
|
||||
{
|
||||
private readonly ThreadLocal<Dictionary<string, AtomicLong>> timerStart = new(() => new Dictionary<string, AtomicLong>());
|
||||
private readonly ConcurrentDictionary<string, AtomicLong> timerAccum = new();
|
||||
private readonly ThreadLocal<Dictionary<string, AtomicLong>> timerStart = new ThreadLocal<Dictionary<string, AtomicLong>>(() => new Dictionary<string, AtomicLong>());
|
||||
private readonly ConcurrentDictionary<string, AtomicLong> timerAccum = new ConcurrentDictionary<string, AtomicLong>();
|
||||
|
||||
public void startTimer(string name)
|
||||
{
|
||||
|
@ -55,3 +57,4 @@ public class Telemetry
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -345,10 +345,10 @@ public class Crowd4Test : AbstractCrowdTest {
|
|||
setMoveTarget(endPoss[0], false);
|
||||
for (int i = 0; i < EXPECTED_A1Q2T.Length; i++)
|
||||
{
|
||||
if (i == 37)
|
||||
{
|
||||
int a = 3;
|
||||
}
|
||||
// if (i == 37)
|
||||
// {
|
||||
// int a = 3;
|
||||
// }
|
||||
|
||||
crowd.update(1 / 5f, null);
|
||||
CrowdAgent ag = agents[2];
|
||||
|
|
|
@ -67,7 +67,7 @@ public class FindNearestPolyTest : AbstractDetourTest {
|
|||
float[] startPos = startPoss[i];
|
||||
Result<FindNearestPolyResult> poly = query.findNearestPoly(startPos, extents, filter);
|
||||
Assert.That(poly.succeeded(), Is.True);
|
||||
Assert.That(0L, Is.EqualTo(poly.result.getNearestRef()));
|
||||
Assert.That(poly.result.getNearestRef(), Is.EqualTo(0L));
|
||||
for (int v = 0; v < POLY_POS[i].Length; v++) {
|
||||
Assert.That(poly.result.getNearestPos()[v], Is.EqualTo(startPos[v]).Within(0.001f));
|
||||
}
|
||||
|
|
|
@ -300,6 +300,7 @@ public class RecastSoloMeshTest
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -332,6 +333,7 @@ public class RecastSoloMeshTest
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -157,6 +157,7 @@ public class RecastTileMeshTest
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue