change name

This commit is contained in:
ikpil 2023-05-10 22:44:51 +09:00
parent 4ded5e0529
commit 0f16874d14
90 changed files with 212 additions and 213 deletions

View File

@ -18,7 +18,7 @@ freely, subject to the following restrictions:
using System;
using DotRecast.Core;
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
namespace DotRecast.Core
{

View File

@ -2,7 +2,7 @@
namespace DotRecast.Core
{
public static class ArrayUtils
public static class RcArrayUtils
{
public static T[] CopyOf<T>(T[] source, int startIdx, int length)
{

View File

@ -3,28 +3,28 @@ using System.Buffers.Binary;
namespace DotRecast.Core
{
public class ByteBuffer
public class RcByteBuffer
{
private ByteOrder _order;
private RcByteOrder _order;
private byte[] _bytes;
private int _position;
public ByteBuffer(byte[] bytes)
public RcByteBuffer(byte[] bytes)
{
_order = BitConverter.IsLittleEndian
? ByteOrder.LITTLE_ENDIAN
: ByteOrder.BIG_ENDIAN;
? RcByteOrder.LITTLE_ENDIAN
: RcByteOrder.BIG_ENDIAN;
_bytes = bytes;
_position = 0;
}
public ByteOrder Order()
public RcByteOrder Order()
{
return _order;
}
public void Order(ByteOrder order)
public void Order(RcByteOrder order)
{
_order = order;
}
@ -68,7 +68,7 @@ namespace DotRecast.Core
public short GetShort()
{
var span = ReadBytes(2);
if (_order == ByteOrder.BIG_ENDIAN)
if (_order == RcByteOrder.BIG_ENDIAN)
{
return BinaryPrimitives.ReadInt16BigEndian(span);
}
@ -82,7 +82,7 @@ namespace DotRecast.Core
public int GetInt()
{
var span = ReadBytes(4);
if (_order == ByteOrder.BIG_ENDIAN)
if (_order == RcByteOrder.BIG_ENDIAN)
{
return BinaryPrimitives.ReadInt32BigEndian(span);
}
@ -95,11 +95,11 @@ namespace DotRecast.Core
public float GetFloat()
{
var span = ReadBytes(4);
if (_order == ByteOrder.BIG_ENDIAN && BitConverter.IsLittleEndian)
if (_order == RcByteOrder.BIG_ENDIAN && BitConverter.IsLittleEndian)
{
span.Reverse();
}
else if (_order == ByteOrder.LITTLE_ENDIAN && !BitConverter.IsLittleEndian)
else if (_order == RcByteOrder.LITTLE_ENDIAN && !BitConverter.IsLittleEndian)
{
span.Reverse();
}
@ -110,7 +110,7 @@ namespace DotRecast.Core
public long GetLong()
{
var span = ReadBytes(8);
if (_order == ByteOrder.BIG_ENDIAN)
if (_order == RcByteOrder.BIG_ENDIAN)
{
return BinaryPrimitives.ReadInt64BigEndian(span);
}

View File

@ -1,6 +1,6 @@
namespace DotRecast.Core
{
public enum ByteOrder
public enum RcByteOrder
{
/// <summary>Default on most Windows systems</summary>
LITTLE_ENDIAN,

View File

@ -23,7 +23,7 @@ using System.Numerics;
namespace DotRecast.Core
{
public static class RecastMath
public static class RcMath
{
public const float EPS = 1e-4f;
private static readonly float EQUAL_THRESHOLD = Sqr(1.0f / 16384.0f);

View File

@ -19,18 +19,17 @@ freely, subject to the following restrictions:
*/
using System;
using System.Collections.Generic;
namespace DotRecast.Core
{
using System.Collections.Generic;
public class SortedQueue<T>
public class RcSortedQueue<T>
{
private bool _dirty;
private readonly List<T> _items;
private readonly Comparison<T> _comparison;
public SortedQueue(Comparison<T> comparison)
public RcSortedQueue(Comparison<T> comparison)
{
_items = new List<T>();
_comparison = (x, y) => comparison.Invoke(x, y) * -1; // reverse

View File

@ -28,7 +28,7 @@ using DotRecast.Detour.QueryResults;
namespace DotRecast.Detour.Crowd
{
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
/**
* Members in this module implement local steering and dynamic avoidance features.
@ -564,7 +564,7 @@ namespace DotRecast.Detour.Crowd
{
_telemetry.Start("updateMoveRequest");
SortedQueue<CrowdAgent> queue = new SortedQueue<CrowdAgent>((a1, a2) => a2.targetReplanTime.CompareTo(a1.targetReplanTime));
RcSortedQueue<CrowdAgent> queue = new RcSortedQueue<CrowdAgent>((a1, a2) => a2.targetReplanTime.CompareTo(a1.targetReplanTime));
// Fire off new requests.
foreach (CrowdAgent ag in agents)
@ -824,7 +824,7 @@ namespace DotRecast.Detour.Crowd
{
_telemetry.Start("updateTopologyOptimization");
SortedQueue<CrowdAgent> queue = new SortedQueue<CrowdAgent>((a1, a2) => a2.topologyOptTime.CompareTo(a1.topologyOptTime));
RcSortedQueue<CrowdAgent> queue = new RcSortedQueue<CrowdAgent>((a1, a2) => a2.topologyOptTime.CompareTo(a1.topologyOptTime));
foreach (CrowdAgent ag in agents)
{

View File

@ -24,7 +24,7 @@ using DotRecast.Core;
namespace DotRecast.Detour.Crowd
{
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
/// Represents an agent managed by a #dtCrowd object.
/// @ingroup crowd

View File

@ -25,7 +25,7 @@ using DotRecast.Detour.QueryResults;
namespace DotRecast.Detour.Crowd
{
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
public class LocalBoundary
{

View File

@ -24,7 +24,7 @@ using DotRecast.Detour.Crowd.Tracking;
namespace DotRecast.Detour.Crowd
{
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
public class ObstacleAvoidanceQuery
{

View File

@ -25,7 +25,7 @@ using DotRecast.Detour.QueryResults;
namespace DotRecast.Detour.Crowd
{
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
/**
* Represents a dynamic polygon corridor used to plan agent movement.

View File

@ -24,7 +24,7 @@ using DotRecast.Detour.QueryResults;
namespace DotRecast.Detour.Crowd
{
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
public class PathQueue
{

View File

@ -23,7 +23,7 @@ using DotRecast.Core;
namespace DotRecast.Detour.Crowd.Tracking
{
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
public class ObstacleAvoidanceDebugData
{

View File

@ -18,7 +18,7 @@ freely, subject to the following restrictions:
using System.Collections.Generic;
using DotRecast.Recast;
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
namespace DotRecast.Detour.Dynamic
{

View File

@ -22,9 +22,9 @@ namespace DotRecast.Detour.Dynamic.Io
{
public static class ByteUtils
{
public static int GetInt(byte[] data, int position, ByteOrder order)
public static int GetInt(byte[] data, int position, RcByteOrder order)
{
return order == ByteOrder.BIG_ENDIAN ? GetIntBE(data, position) : GetIntLE(data, position);
return order == RcByteOrder.BIG_ENDIAN ? GetIntBE(data, position) : GetIntLE(data, position);
}
public static int GetIntBE(byte[] data, int position)
@ -39,9 +39,9 @@ namespace DotRecast.Detour.Dynamic.Io
| (data[position] & 0xff);
}
public static int GetShort(byte[] data, int position, ByteOrder order)
public static int GetShort(byte[] data, int position, RcByteOrder order)
{
return order == ByteOrder.BIG_ENDIAN ? GetShortBE(data, position) : GetShortLE(data, position);
return order == RcByteOrder.BIG_ENDIAN ? GetShortBE(data, position) : GetShortLE(data, position);
}
public static int GetShortBE(byte[] data, int position)
@ -54,9 +54,9 @@ namespace DotRecast.Detour.Dynamic.Io
return ((data[position + 1] & 0xff) << 8) | (data[position] & 0xff);
}
public static int PutInt(int value, byte[] data, int position, ByteOrder order)
public static int PutInt(int value, byte[] data, int position, RcByteOrder order)
{
if (order == ByteOrder.BIG_ENDIAN)
if (order == RcByteOrder.BIG_ENDIAN)
{
data[position] = (byte)((uint)value >> 24);
data[position + 1] = (byte)((uint)value >> 16);
@ -74,9 +74,9 @@ namespace DotRecast.Detour.Dynamic.Io
return position + 4;
}
public static int PutShort(int value, byte[] data, int position, ByteOrder order)
public static int PutShort(int value, byte[] data, int position, RcByteOrder order)
{
if (order == ByteOrder.BIG_ENDIAN)
if (order == RcByteOrder.BIG_ENDIAN)
{
data[position] = (byte)((uint)value >> 8);
data[position + 1] = (byte)(value & 0xFF);

View File

@ -34,7 +34,7 @@ namespace DotRecast.Detour.Dynamic.Io
{
byte[] compressed = LZ4Pickler.Pickle(data, LZ4Level.L12_MAX);
byte[] result = new byte[4 + compressed.Length];
ByteUtils.PutInt(compressed.Length, result, 0, ByteOrder.BIG_ENDIAN);
ByteUtils.PutInt(compressed.Length, result, 0, RcByteOrder.BIG_ENDIAN);
Array.Copy(compressed, 0, result, 4, compressed.Length);
return result;
}

View File

@ -25,7 +25,7 @@ namespace DotRecast.Detour.Dynamic.Io
{
public class VoxelFile
{
public static readonly ByteOrder PREFERRED_BYTE_ORDER = ByteOrder.BIG_ENDIAN;
public static readonly RcByteOrder PREFERRED_BYTE_ORDER = RcByteOrder.BIG_ENDIAN;
public const int MAGIC = 'V' << 24 | 'O' << 16 | 'X' << 8 | 'L';
public const int VERSION_EXPORTER_MASK = 0xF000;
public const int VERSION_COMPRESSION_MASK = 0x0F00;

View File

@ -28,7 +28,7 @@ namespace DotRecast.Detour.Dynamic.Io
public VoxelFile Read(BinaryReader stream)
{
ByteBuffer buf = IOUtils.ToByteBuffer(stream);
RcByteBuffer buf = IOUtils.ToByteBuffer(stream);
VoxelFile file = new VoxelFile();
int magic = buf.GetInt();
if (magic != VoxelFile.MAGIC)
@ -39,7 +39,7 @@ namespace DotRecast.Detour.Dynamic.Io
throw new IOException("Invalid magic");
}
buf.Order(buf.Order() == ByteOrder.BIG_ENDIAN ? ByteOrder.LITTLE_ENDIAN : ByteOrder.BIG_ENDIAN);
buf.Order(buf.Order() == RcByteOrder.BIG_ENDIAN ? RcByteOrder.LITTLE_ENDIAN : RcByteOrder.BIG_ENDIAN);
}
file.version = buf.GetInt();
@ -130,7 +130,7 @@ namespace DotRecast.Detour.Dynamic.Io
bytes = compressor.Decompress(bytes);
}
ByteBuffer data = new ByteBuffer(bytes);
RcByteBuffer data = new RcByteBuffer(bytes);
data.Order(buf.Order());
file.AddTile(new VoxelTile(tileX, tileZ, width, depth, boundsMin, boundsMax, cellSize, cellHeight, borderSize, data));
buf.Position(position + voxelSize);

View File

@ -31,7 +31,7 @@ namespace DotRecast.Detour.Dynamic.Io
Write(stream, f, VoxelFile.PREFERRED_BYTE_ORDER, compression);
}
public void Write(BinaryWriter stream, VoxelFile f, ByteOrder byteOrder, bool compression)
public void Write(BinaryWriter stream, VoxelFile f, RcByteOrder byteOrder, bool compression)
{
Write(stream, VoxelFile.MAGIC, byteOrder);
Write(stream, VoxelFile.VERSION_EXPORTER_RECAST4J | (compression ? VoxelFile.VERSION_COMPRESSION_LZ4 : 0), byteOrder);
@ -67,7 +67,7 @@ namespace DotRecast.Detour.Dynamic.Io
}
}
public void WriteTile(BinaryWriter stream, VoxelTile tile, ByteOrder byteOrder, bool compression)
public void WriteTile(BinaryWriter stream, VoxelTile tile, RcByteOrder byteOrder, bool compression)
{
Write(stream, tile.tileX, byteOrder);
Write(stream, tile.tileZ, byteOrder);

View File

@ -37,7 +37,7 @@ namespace DotRecast.Detour.Dynamic.Io
public readonly byte[] spanData;
public VoxelTile(int tileX, int tileZ, int width, int depth, Vector3f boundsMin, Vector3f boundsMax, float cellSize,
float cellHeight, int borderSize, ByteBuffer buffer)
float cellHeight, int borderSize, RcByteBuffer buffer)
{
this.tileX = tileX;
this.tileZ = tileZ;
@ -67,7 +67,7 @@ namespace DotRecast.Detour.Dynamic.Io
public Heightfield Heightfield()
{
return VoxelFile.PREFERRED_BYTE_ORDER == ByteOrder.BIG_ENDIAN ? HeightfieldBE() : HeightfieldLE();
return VoxelFile.PREFERRED_BYTE_ORDER == RcByteOrder.BIG_ENDIAN ? HeightfieldBE() : HeightfieldLE();
}
private Heightfield HeightfieldBE()
@ -144,7 +144,7 @@ namespace DotRecast.Detour.Dynamic.Io
return hf;
}
private byte[] SerializeSpans(Heightfield heightfield, ByteOrder order)
private byte[] SerializeSpans(Heightfield heightfield, RcByteOrder order)
{
int[] counts = new int[heightfield.width * heightfield.height];
int totalCount = 0;
@ -183,7 +183,7 @@ namespace DotRecast.Detour.Dynamic.Io
return data;
}
private byte[] ToByteArray(ByteBuffer buf, int width, int height, ByteOrder order)
private byte[] ToByteArray(RcByteBuffer buf, int width, int height, RcByteOrder order)
{
byte[] data;
if (buf.Order() == order)

View File

@ -17,7 +17,7 @@ freely, subject to the following restrictions:
*/
using DotRecast.Core;
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
namespace DotRecast.Detour.Extras
{

View File

@ -1,7 +1,7 @@
using System;
using DotRecast.Core;
using DotRecast.Recast;
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
namespace DotRecast.Detour.Extras.Jumplink
{

View File

@ -1,6 +1,6 @@
using System.Collections.Generic;
using DotRecast.Core;
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
namespace DotRecast.Detour.Extras.Jumplink
{

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using DotRecast.Core;
using DotRecast.Recast;
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
namespace DotRecast.Detour.Extras.Jumplink
{
@ -64,8 +64,8 @@ namespace DotRecast.Detour.Extras.Jumplink
{
JumpLink link = new JumpLink();
links.Add(link);
link.startSamples = ArrayUtils.CopyOf(es.start.gsamples, js.startSample, js.samples);
link.endSamples = ArrayUtils.CopyOf(end.gsamples, js.startSample, js.samples);
link.startSamples = RcArrayUtils.CopyOf(es.start.gsamples, js.startSample, js.samples);
link.endSamples = RcArrayUtils.CopyOf(end.gsamples, js.startSample, js.samples);
link.start = es.start;
link.end = end;
link.trajectory = es.trajectory;

View File

@ -9,7 +9,7 @@ namespace DotRecast.Detour.Extras.Jumplink
public JumpSegment[] Build(JumpLinkBuilderConfig acfg, EdgeSampler es)
{
int n = es.end[0].gsamples.Length;
int[][] sampleGrid = ArrayUtils.Of<int>(n, es.end.Count);
int[][] sampleGrid = RcArrayUtils.Of<int>(n, es.end.Count);
for (int j = 0; j < es.end.Count; j++)
{
for (int i = 0; i < n; i++)

View File

@ -1,7 +1,7 @@
using System;
using DotRecast.Core;
using DotRecast.Recast;
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
namespace DotRecast.Detour.Extras.Jumplink
{

View File

@ -27,7 +27,7 @@ namespace DotRecast.Detour.Extras.Unity.Astar
public List<int[]> Read(ZipArchive file, string filename, Meta meta, int[] indexToNode)
{
List<int[]> connections = new List<int[]>();
ByteBuffer buffer = ToByteBuffer(file, filename);
RcByteBuffer buffer = ToByteBuffer(file, filename);
while (buffer.Remaining() > 0)
{
int count = buffer.GetInt();

View File

@ -29,7 +29,7 @@ namespace DotRecast.Detour.Extras.Unity.Astar
public GraphMeshData Read(ZipArchive file, string filename, GraphMeta meta, int maxVertPerPoly)
{
ByteBuffer buffer = ToByteBuffer(file, filename);
RcByteBuffer buffer = ToByteBuffer(file, filename);
int tileXCount = buffer.GetInt();
if (tileXCount < 0)
{

View File

@ -25,7 +25,7 @@ namespace DotRecast.Detour.Extras.Unity.Astar
{
public int[] Read(ZipArchive file, string filename)
{
ByteBuffer buffer = ToByteBuffer(file, filename);
RcByteBuffer buffer = ToByteBuffer(file, filename);
int maxNodeIndex = buffer.GetInt();
int[] int2Node = new int[maxNodeIndex + 1];
int node = 0;

View File

@ -25,7 +25,7 @@ namespace DotRecast.Detour.Extras.Unity.Astar
{
public NodeLink2[] Read(ZipArchive file, string filename, int[] indexToNode)
{
ByteBuffer buffer = ToByteBuffer(file, filename);
RcByteBuffer buffer = ToByteBuffer(file, filename);
int linkCount = buffer.GetInt();
NodeLink2[] links = new NodeLink2[linkCount];
for (int i = 0; i < linkCount; i++)

View File

@ -35,13 +35,13 @@ namespace DotRecast.Detour.Extras.Unity.Astar
if (startNode != null && endNode != null)
{
// FIXME: Optimise
startTile.polys = ArrayUtils.CopyOf(startTile.polys, startTile.polys.Length + 1);
startTile.polys = RcArrayUtils.CopyOf(startTile.polys, startTile.polys.Length + 1);
int poly = startTile.header.polyCount;
startTile.polys[poly] = new Poly(poly, 2);
startTile.polys[poly].verts[0] = startTile.header.vertCount;
startTile.polys[poly].verts[1] = startTile.header.vertCount + 1;
startTile.polys[poly].SetType(Poly.DT_POLYTYPE_OFFMESH_CONNECTION);
startTile.verts = ArrayUtils.CopyOf(startTile.verts, startTile.verts.Length + 6);
startTile.verts = RcArrayUtils.CopyOf(startTile.verts, startTile.verts.Length + 6);
startTile.header.polyCount++;
startTile.header.vertCount += 2;
OffMeshConnection connection = new OffMeshConnection();
@ -63,7 +63,7 @@ namespace DotRecast.Detour.Extras.Unity.Astar
}
else
{
startTile.offMeshCons = ArrayUtils.CopyOf(startTile.offMeshCons, startTile.offMeshCons.Length + 1);
startTile.offMeshCons = RcArrayUtils.CopyOf(startTile.offMeshCons, startTile.offMeshCons.Length + 1);
}
startTile.offMeshCons[startTile.offMeshCons.Length - 1] = connection;

View File

@ -25,13 +25,13 @@ namespace DotRecast.Detour.Extras.Unity.Astar
{
public abstract class ZipBinaryReader
{
protected ByteBuffer ToByteBuffer(ZipArchive file, string filename)
protected RcByteBuffer ToByteBuffer(ZipArchive file, string filename)
{
ZipArchiveEntry graphReferences = file.GetEntry(filename);
using var entryStream = graphReferences.Open();
using var bis = new BinaryReader(entryStream);
ByteBuffer buffer = IOUtils.ToByteBuffer(bis);
buffer.Order(ByteOrder.LITTLE_ENDIAN);
RcByteBuffer buffer = IOUtils.ToByteBuffer(bis);
buffer.Order(RcByteOrder.LITTLE_ENDIAN);
return buffer;
}
}

View File

@ -29,7 +29,7 @@ namespace DotRecast.Detour.TileCache
{
public abstract class AbstractTileLayersBuilder
{
protected List<byte[]> Build(ByteOrder order, bool cCompatibility, int threads, int tw, int th)
protected List<byte[]> Build(RcByteOrder order, bool cCompatibility, int threads, int tw, int th)
{
if (threads == 1)
{
@ -39,7 +39,7 @@ namespace DotRecast.Detour.TileCache
return BuildMultiThread(order, cCompatibility, tw, th, threads);
}
private List<byte[]> BuildSingleThread(ByteOrder order, bool cCompatibility, int tw, int th)
private List<byte[]> BuildSingleThread(RcByteOrder order, bool cCompatibility, int tw, int th)
{
List<byte[]> layers = new List<byte[]>();
for (int y = 0; y < th; ++y)
@ -53,7 +53,7 @@ namespace DotRecast.Detour.TileCache
return layers;
}
private List<byte[]> BuildMultiThread(ByteOrder order, bool cCompatibility, int tw, int th, int threads)
private List<byte[]> BuildMultiThread(RcByteOrder order, bool cCompatibility, int tw, int th, int threads)
{
var tasks = new ConcurrentQueue<Task<Tuple<int, int, List<byte[]>>>>();
for (int y = 0; y < th; ++y)
@ -88,6 +88,6 @@ namespace DotRecast.Detour.TileCache
return layers;
}
protected abstract List<byte[]> Build(int tx, int ty, ByteOrder order, bool cCompatibility);
protected abstract List<byte[]> Build(int tx, int ty, RcByteOrder order, bool cCompatibility);
}
}

View File

@ -35,7 +35,7 @@ namespace DotRecast.Detour.TileCache.Io.Compress
{
byte[] output = new byte[FastLz.CalculateOutputBufferLength(buf.Length)];
int len = FastLz.Compress(buf, 0, buf.Length, output, 0, output.Length);
return ArrayUtils.CopyOf(output, len);
return RcArrayUtils.CopyOf(output, len);
}
}
}

View File

@ -25,7 +25,7 @@ namespace DotRecast.Detour.TileCache.Io
{
public class TileCacheLayerHeaderReader
{
public TileCacheLayerHeader Read(ByteBuffer data, bool cCompatibility)
public TileCacheLayerHeader Read(RcByteBuffer data, bool cCompatibility)
{
TileCacheLayerHeader header = new TileCacheLayerHeader();
header.magic = data.GetInt();

View File

@ -26,7 +26,7 @@ namespace DotRecast.Detour.TileCache.Io
{
public class TileCacheLayerHeaderWriter : DetourWriter
{
public void Write(BinaryWriter stream, TileCacheLayerHeader header, ByteOrder order, bool cCompatibility)
public void Write(BinaryWriter stream, TileCacheLayerHeader header, RcByteOrder order, bool cCompatibility)
{
Write(stream, header.magic, order);
Write(stream, header.version, order);

View File

@ -31,11 +31,11 @@ namespace DotRecast.Detour.TileCache.Io
public TileCache Read(BinaryReader @is, int maxVertPerPoly, ITileCacheMeshProcess meshProcessor)
{
ByteBuffer bb = IOUtils.ToByteBuffer(@is);
RcByteBuffer bb = IOUtils.ToByteBuffer(@is);
return Read(bb, maxVertPerPoly, meshProcessor);
}
public TileCache Read(ByteBuffer bb, int maxVertPerPoly, ITileCacheMeshProcess meshProcessor)
public TileCache Read(RcByteBuffer bb, int maxVertPerPoly, ITileCacheMeshProcess meshProcessor)
{
TileCacheSetHeader header = new TileCacheSetHeader();
header.magic = bb.GetInt();
@ -47,7 +47,7 @@ namespace DotRecast.Detour.TileCache.Io
throw new IOException("Invalid magic");
}
bb.Order(bb.Order() == ByteOrder.BIG_ENDIAN ? ByteOrder.LITTLE_ENDIAN : ByteOrder.BIG_ENDIAN);
bb.Order(bb.Order() == RcByteOrder.BIG_ENDIAN ? RcByteOrder.LITTLE_ENDIAN : RcByteOrder.BIG_ENDIAN);
}
header.version = bb.GetInt();
@ -88,7 +88,7 @@ namespace DotRecast.Detour.TileCache.Io
return tc;
}
private TileCacheParams ReadCacheParams(ByteBuffer bb, bool cCompatibility)
private TileCacheParams ReadCacheParams(RcByteBuffer bb, bool cCompatibility)
{
TileCacheParams option = new TileCacheParams();

View File

@ -29,7 +29,7 @@ namespace DotRecast.Detour.TileCache.Io
private readonly NavMeshParamWriter paramWriter = new NavMeshParamWriter();
private readonly TileCacheBuilder builder = new TileCacheBuilder();
public void Write(BinaryWriter stream, TileCache cache, ByteOrder order, bool cCompatibility)
public void Write(BinaryWriter stream, TileCache cache, RcByteOrder order, bool cCompatibility)
{
Write(stream, TileCacheSetHeader.TILECACHESET_MAGIC, order);
Write(stream, cCompatibility
@ -61,7 +61,7 @@ namespace DotRecast.Detour.TileCache.Io
}
}
private void WriteCacheParams(BinaryWriter stream, TileCacheParams option, ByteOrder order)
private void WriteCacheParams(BinaryWriter stream, TileCacheParams option, RcByteOrder order)
{
Write(stream, option.orig.x, order);
Write(stream, option.orig.y, order);

View File

@ -22,7 +22,7 @@ using System;
using System.Collections.Generic;
using DotRecast.Core;
using DotRecast.Detour.TileCache.Io;
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
namespace DotRecast.Detour.TileCache
{
@ -253,7 +253,7 @@ namespace DotRecast.Detour.TileCache
public long AddTile(byte[] data, int flags)
{
// Make sure the data is in right format.
ByteBuffer buf = new ByteBuffer(data);
RcByteBuffer buf = new RcByteBuffer(data);
buf.Order(m_storageParams.byteOrder);
TileCacheLayerHeader header = tileReader.Read(buf, m_storageParams.cCompatibility);
// Make sure the location is free.

View File

@ -24,7 +24,7 @@ using System.IO;
using DotRecast.Core;
using DotRecast.Detour.TileCache.Io;
using DotRecast.Detour.TileCache.Io.Compress;
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
namespace DotRecast.Detour.TileCache
{
@ -1915,7 +1915,7 @@ namespace DotRecast.Detour.TileCache
}
}
public byte[] CompressTileCacheLayer(TileCacheLayer layer, ByteOrder order, bool cCompatibility)
public byte[] CompressTileCacheLayer(TileCacheLayer layer, RcByteOrder order, bool cCompatibility)
{
using var ms = new MemoryStream();
using var baos = new BinaryWriter(ms);
@ -1942,7 +1942,7 @@ namespace DotRecast.Detour.TileCache
}
public byte[] CompressTileCacheLayer(TileCacheLayerHeader header, int[] heights, int[] areas, int[] cons,
ByteOrder order, bool cCompatibility)
RcByteOrder order, bool cCompatibility)
{
using var ms = new MemoryStream();
using var baos = new BinaryWriter(ms);
@ -1968,10 +1968,10 @@ namespace DotRecast.Detour.TileCache
}
}
public TileCacheLayer DecompressTileCacheLayer(ITileCacheCompressor comp, byte[] compressed, ByteOrder order,
public TileCacheLayer DecompressTileCacheLayer(ITileCacheCompressor comp, byte[] compressed, RcByteOrder order,
bool cCompatibility)
{
ByteBuffer buf = new ByteBuffer(compressed);
RcByteBuffer buf = new RcByteBuffer(compressed);
buf.Order(order);
TileCacheLayer layer = new TileCacheLayer();
try

View File

@ -24,10 +24,10 @@ namespace DotRecast.Detour.TileCache
{
public class TileCacheStorageParams
{
public readonly ByteOrder byteOrder;
public readonly RcByteOrder byteOrder;
public readonly bool cCompatibility;
public TileCacheStorageParams(ByteOrder byteOrder, bool cCompatibility)
public TileCacheStorageParams(RcByteOrder byteOrder, bool cCompatibility)
{
this.byteOrder = byteOrder;
this.cCompatibility = cCompatibility;

View File

@ -21,7 +21,7 @@ using DotRecast.Core;
namespace DotRecast.Detour
{
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
/**
* Convex-convex intersection based on "Computational Geometry in C" by Joseph O'Rourke

View File

@ -23,7 +23,7 @@ using DotRecast.Core;
namespace DotRecast.Detour
{
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
/**
* <b>The Default Implementation</b>

View File

@ -17,7 +17,7 @@ freely, subject to the following restrictions:
*/
using DotRecast.Core;
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
namespace DotRecast.Detour
{

View File

@ -4,7 +4,7 @@ using DotRecast.Detour.QueryResults;
namespace DotRecast.Detour
{
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
public class FindNearestPolyQuery : IPolyQuery
{

View File

@ -24,16 +24,16 @@ namespace DotRecast.Detour.Io
{
public abstract class DetourWriter
{
protected void Write(BinaryWriter stream, float value, ByteOrder order)
protected void Write(BinaryWriter stream, float value, RcByteOrder order)
{
byte[] bytes = BitConverter.GetBytes(value);
int i = BitConverter.ToInt32(bytes, 0);
Write(stream, i, order);
}
protected void Write(BinaryWriter stream, short value, ByteOrder order)
protected void Write(BinaryWriter stream, short value, RcByteOrder order)
{
if (order == ByteOrder.BIG_ENDIAN)
if (order == RcByteOrder.BIG_ENDIAN)
{
stream.Write((byte)((value >> 8) & 0xFF));
stream.Write((byte)(value & 0xFF));
@ -45,9 +45,9 @@ namespace DotRecast.Detour.Io
}
}
protected void Write(BinaryWriter stream, long value, ByteOrder order)
protected void Write(BinaryWriter stream, long value, RcByteOrder order)
{
if (order == ByteOrder.BIG_ENDIAN)
if (order == RcByteOrder.BIG_ENDIAN)
{
Write(stream, (int)((ulong)value >> 32), order);
Write(stream, (int)(value & 0xFFFFFFFF), order);
@ -59,9 +59,9 @@ namespace DotRecast.Detour.Io
}
}
protected void Write(BinaryWriter stream, int value, ByteOrder order)
protected void Write(BinaryWriter stream, int value, RcByteOrder order)
{
if (order == ByteOrder.BIG_ENDIAN)
if (order == RcByteOrder.BIG_ENDIAN)
{
stream.Write((byte)((value >> 24) & 0xFF));
stream.Write((byte)((value >> 16) & 0xFF));

View File

@ -24,7 +24,7 @@ namespace DotRecast.Detour.Io
{
public static class IOUtils
{
public static ByteBuffer ToByteBuffer(BinaryReader @is, bool direct)
public static RcByteBuffer ToByteBuffer(BinaryReader @is, bool direct)
{
byte[] data = ToByteArray(@is);
if (direct)
@ -32,7 +32,7 @@ namespace DotRecast.Detour.Io
Array.Reverse(data);
}
return new ByteBuffer(data);
return new RcByteBuffer(data);
}
public static byte[] ToByteArray(BinaryReader inputStream)
@ -49,10 +49,10 @@ namespace DotRecast.Detour.Io
}
public static ByteBuffer ToByteBuffer(BinaryReader inputStream)
public static RcByteBuffer ToByteBuffer(BinaryReader inputStream)
{
var bytes = ToByteArray(inputStream);
return new ByteBuffer(bytes);
return new RcByteBuffer(bytes);
}
public static int SwapEndianness(int i)

View File

@ -27,27 +27,27 @@ namespace DotRecast.Detour.Io
public MeshData Read(BinaryReader stream, int maxVertPerPoly)
{
ByteBuffer buf = IOUtils.ToByteBuffer(stream);
RcByteBuffer buf = IOUtils.ToByteBuffer(stream);
return Read(buf, maxVertPerPoly, false);
}
public MeshData Read(ByteBuffer buf, int maxVertPerPoly)
public MeshData Read(RcByteBuffer buf, int maxVertPerPoly)
{
return Read(buf, maxVertPerPoly, false);
}
public MeshData Read32Bit(BinaryReader stream, int maxVertPerPoly)
{
ByteBuffer buf = IOUtils.ToByteBuffer(stream);
RcByteBuffer buf = IOUtils.ToByteBuffer(stream);
return Read(buf, maxVertPerPoly, true);
}
public MeshData Read32Bit(ByteBuffer buf, int maxVertPerPoly)
public MeshData Read32Bit(RcByteBuffer buf, int maxVertPerPoly)
{
return Read(buf, maxVertPerPoly, true);
}
public MeshData Read(ByteBuffer buf, int maxVertPerPoly, bool is32Bit)
public MeshData Read(RcByteBuffer buf, int maxVertPerPoly, bool is32Bit)
{
MeshData data = new MeshData();
MeshHeader header = new MeshHeader();
@ -61,7 +61,7 @@ namespace DotRecast.Detour.Io
throw new IOException("Invalid magic");
}
buf.Order(buf.Order() == ByteOrder.BIG_ENDIAN ? ByteOrder.LITTLE_ENDIAN : ByteOrder.BIG_ENDIAN);
buf.Order(buf.Order() == RcByteOrder.BIG_ENDIAN ? RcByteOrder.LITTLE_ENDIAN : RcByteOrder.BIG_ENDIAN);
}
header.version = buf.GetInt();
@ -124,7 +124,7 @@ namespace DotRecast.Detour.Io
return is32Bit ? LINK_SIZEOF32BIT : LINK_SIZEOF;
}
private float[] ReadVerts(ByteBuffer buf, int count)
private float[] ReadVerts(RcByteBuffer buf, int count)
{
float[] verts = new float[count * 3];
for (int i = 0; i < verts.Length; i++)
@ -135,7 +135,7 @@ namespace DotRecast.Detour.Io
return verts;
}
private Poly[] ReadPolys(ByteBuffer buf, MeshHeader header, int maxVertPerPoly)
private Poly[] ReadPolys(RcByteBuffer buf, MeshHeader header, int maxVertPerPoly)
{
Poly[] polys = new Poly[header.polyCount];
for (int i = 0; i < polys.Length; i++)
@ -164,7 +164,7 @@ namespace DotRecast.Detour.Io
return polys;
}
private PolyDetail[] ReadPolyDetails(ByteBuffer buf, MeshHeader header, bool cCompatibility)
private PolyDetail[] ReadPolyDetails(RcByteBuffer buf, MeshHeader header, bool cCompatibility)
{
PolyDetail[] polys = new PolyDetail[header.detailMeshCount];
for (int i = 0; i < polys.Length; i++)
@ -183,7 +183,7 @@ namespace DotRecast.Detour.Io
return polys;
}
private int[] ReadDTris(ByteBuffer buf, MeshHeader header)
private int[] ReadDTris(RcByteBuffer buf, MeshHeader header)
{
int[] tris = new int[4 * header.detailTriCount];
for (int i = 0; i < tris.Length; i++)
@ -194,7 +194,7 @@ namespace DotRecast.Detour.Io
return tris;
}
private BVNode[] ReadBVTree(ByteBuffer buf, MeshHeader header)
private BVNode[] ReadBVTree(RcByteBuffer buf, MeshHeader header)
{
BVNode[] nodes = new BVNode[header.bvNodeCount];
for (int i = 0; i < nodes.Length; i++)
@ -231,7 +231,7 @@ namespace DotRecast.Detour.Io
return nodes;
}
private OffMeshConnection[] ReadOffMeshCons(ByteBuffer buf, MeshHeader header)
private OffMeshConnection[] ReadOffMeshCons(RcByteBuffer buf, MeshHeader header)
{
OffMeshConnection[] cons = new OffMeshConnection[header.offMeshConCount];
for (int i = 0; i < cons.Length; i++)

View File

@ -23,7 +23,7 @@ namespace DotRecast.Detour.Io
{
public class MeshDataWriter : DetourWriter
{
public void Write(BinaryWriter stream, MeshData data, ByteOrder order, bool cCompatibility)
public void Write(BinaryWriter stream, MeshData data, RcByteOrder order, bool cCompatibility)
{
MeshHeader header = data.header;
Write(stream, header.magic, order);
@ -66,7 +66,7 @@ namespace DotRecast.Detour.Io
WriteOffMeshCons(stream, data, order);
}
private void WriteVerts(BinaryWriter stream, float[] verts, int count, ByteOrder order)
private void WriteVerts(BinaryWriter stream, float[] verts, int count, RcByteOrder order)
{
for (int i = 0; i < count * 3; i++)
{
@ -74,7 +74,7 @@ namespace DotRecast.Detour.Io
}
}
private void WritePolys(BinaryWriter stream, MeshData data, ByteOrder order, bool cCompatibility)
private void WritePolys(BinaryWriter stream, MeshData data, RcByteOrder order, bool cCompatibility)
{
for (int i = 0; i < data.header.polyCount; i++)
{
@ -99,7 +99,7 @@ namespace DotRecast.Detour.Io
}
}
private void WritePolyDetails(BinaryWriter stream, MeshData data, ByteOrder order, bool cCompatibility)
private void WritePolyDetails(BinaryWriter stream, MeshData data, RcByteOrder order, bool cCompatibility)
{
for (int i = 0; i < data.header.detailMeshCount; i++)
{
@ -122,7 +122,7 @@ namespace DotRecast.Detour.Io
}
}
private void WriteBVTree(BinaryWriter stream, MeshData data, ByteOrder order, bool cCompatibility)
private void WriteBVTree(BinaryWriter stream, MeshData data, RcByteOrder order, bool cCompatibility)
{
for (int i = 0; i < data.header.bvNodeCount; i++)
{
@ -155,7 +155,7 @@ namespace DotRecast.Detour.Io
}
}
private void WriteOffMeshCons(BinaryWriter stream, MeshData data, ByteOrder order)
private void WriteOffMeshCons(BinaryWriter stream, MeshData data, RcByteOrder order)
{
for (int i = 0; i < data.header.offMeshConCount; i++)
{

View File

@ -22,7 +22,7 @@ using DotRecast.Core;
namespace DotRecast.Detour.Io
{
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
public class MeshSetReader
@ -35,7 +35,7 @@ namespace DotRecast.Detour.Io
return Read(IOUtils.ToByteBuffer(@is), maxVertPerPoly, false);
}
public NavMesh Read(ByteBuffer bb, int maxVertPerPoly)
public NavMesh Read(RcByteBuffer bb, int maxVertPerPoly)
{
return Read(bb, maxVertPerPoly, false);
}
@ -45,7 +45,7 @@ namespace DotRecast.Detour.Io
return Read(IOUtils.ToByteBuffer(@is), maxVertPerPoly, true);
}
public NavMesh Read32Bit(ByteBuffer bb, int maxVertPerPoly)
public NavMesh Read32Bit(RcByteBuffer bb, int maxVertPerPoly)
{
return Read(bb, maxVertPerPoly, true);
}
@ -55,12 +55,12 @@ namespace DotRecast.Detour.Io
return Read(IOUtils.ToByteBuffer(@is));
}
public NavMesh Read(ByteBuffer bb)
public NavMesh Read(RcByteBuffer bb)
{
return Read(bb, -1, false);
}
NavMesh Read(ByteBuffer bb, int maxVertPerPoly, bool is32Bit)
NavMesh Read(RcByteBuffer bb, int maxVertPerPoly, bool is32Bit)
{
NavMeshSetHeader header = ReadHeader(bb, maxVertPerPoly);
if (header.maxVertsPerPoly <= 0)
@ -74,7 +74,7 @@ namespace DotRecast.Detour.Io
return mesh;
}
private NavMeshSetHeader ReadHeader(ByteBuffer bb, int maxVertsPerPoly)
private NavMeshSetHeader ReadHeader(RcByteBuffer bb, int maxVertsPerPoly)
{
NavMeshSetHeader header = new NavMeshSetHeader();
header.magic = bb.GetInt();
@ -86,7 +86,7 @@ namespace DotRecast.Detour.Io
throw new IOException("Invalid magic " + header.magic);
}
bb.Order(bb.Order() == ByteOrder.BIG_ENDIAN ? ByteOrder.LITTLE_ENDIAN : ByteOrder.BIG_ENDIAN);
bb.Order(bb.Order() == RcByteOrder.BIG_ENDIAN ? RcByteOrder.LITTLE_ENDIAN : RcByteOrder.BIG_ENDIAN);
}
header.version = bb.GetInt();
@ -107,7 +107,7 @@ namespace DotRecast.Detour.Io
return header;
}
private void ReadTiles(ByteBuffer bb, bool is32Bit, NavMeshSetHeader header, bool cCompatibility, NavMesh mesh)
private void ReadTiles(RcByteBuffer bb, bool is32Bit, NavMeshSetHeader header, bool cCompatibility, NavMesh mesh)
{
// Read tiles.
for (int i = 0; i < header.numTiles; ++i)

View File

@ -26,13 +26,13 @@ namespace DotRecast.Detour.Io
private readonly MeshDataWriter writer = new MeshDataWriter();
private readonly NavMeshParamWriter paramWriter = new NavMeshParamWriter();
public void Write(BinaryWriter stream, NavMesh mesh, ByteOrder order, bool cCompatibility)
public void Write(BinaryWriter stream, NavMesh mesh, RcByteOrder order, bool cCompatibility)
{
WriteHeader(stream, mesh, order, cCompatibility);
WriteTiles(stream, mesh, order, cCompatibility);
}
private void WriteHeader(BinaryWriter stream, NavMesh mesh, ByteOrder order, bool cCompatibility)
private void WriteHeader(BinaryWriter stream, NavMesh mesh, RcByteOrder order, bool cCompatibility)
{
Write(stream, NavMeshSetHeader.NAVMESHSET_MAGIC, order);
Write(stream, cCompatibility ? NavMeshSetHeader.NAVMESHSET_VERSION : NavMeshSetHeader.NAVMESHSET_VERSION_RECAST4J, order);
@ -56,7 +56,7 @@ namespace DotRecast.Detour.Io
}
}
private void WriteTiles(BinaryWriter stream, NavMesh mesh, ByteOrder order, bool cCompatibility)
private void WriteTiles(BinaryWriter stream, NavMesh mesh, RcByteOrder order, bool cCompatibility)
{
for (int i = 0; i < mesh.GetMaxTiles(); ++i)
{

View File

@ -4,7 +4,7 @@ namespace DotRecast.Detour.Io
{
public class NavMeshParamReader
{
public NavMeshParams Read(ByteBuffer bb)
public NavMeshParams Read(RcByteBuffer bb)
{
NavMeshParams option = new NavMeshParams();
option.orig.x = bb.GetFloat();

View File

@ -5,7 +5,7 @@ namespace DotRecast.Detour.Io
{
public class NavMeshParamWriter : DetourWriter
{
public void Write(BinaryWriter stream, NavMeshParams option, ByteOrder order)
public void Write(BinaryWriter stream, NavMeshParams option, RcByteOrder order)
{
Write(stream, option.orig.x, order);
Write(stream, option.orig.y, order);

View File

@ -23,7 +23,7 @@ using DotRecast.Detour.QueryResults;
namespace DotRecast.Detour
{
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
public class LegacyNavMeshQuery : NavMeshQuery

View File

@ -27,7 +27,7 @@ using DotRecast.Detour.QueryResults;
namespace DotRecast.Detour
{
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
public class NavMesh
{

View File

@ -23,7 +23,7 @@ using DotRecast.Core;
namespace DotRecast.Detour
{
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
public class NavMeshBuilder
{

View File

@ -27,7 +27,7 @@ using DotRecast.Detour.QueryResults;
namespace DotRecast.Detour
{
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
using static Node;
public class NavMeshQuery

View File

@ -26,7 +26,7 @@ namespace DotRecast.Detour
public class NodeQueue
{
private readonly SortedQueue<Node> m_heap = new SortedQueue<Node>((n1, n2) => n1.total.CompareTo(n2.total));
private readonly RcSortedQueue<Node> m_heap = new RcSortedQueue<Node>((n1, n2) => n1.total.CompareTo(n2.total));
public int Count()
{

View File

@ -22,7 +22,7 @@ using DotRecast.Core;
namespace DotRecast.Detour
{
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
//TODO: (PP) Add comments
public class StraightPathItem

View File

@ -3,7 +3,7 @@ using DotRecast.Core;
namespace DotRecast.Detour
{
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
/**
* Calculate the intersection between a polygon and a circle. A dodecagon is used as an approximation of the circle.

View File

@ -22,7 +22,7 @@ using System.Threading.Tasks;
using DotRecast.Core;
using DotRecast.Detour;
using DotRecast.Recast.Demo.Geom;
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
namespace DotRecast.Recast.Demo.Builder;

View File

@ -31,7 +31,7 @@ public class DebugDraw
private readonly IOpenGLDraw openGlDraw;
private readonly int[] boxIndices = { 7, 6, 5, 4, 0, 1, 2, 3, 1, 5, 6, 2, 3, 7, 4, 0, 2, 6, 7, 3, 0, 4, 5, 1, };
private readonly float[][] frustumPlanes = ArrayUtils.Of<float>(6, 4);
private readonly float[][] frustumPlanes = RcArrayUtils.Of<float>(6, 4);
// {
// new[] { 0f, 0f, 0f, 0f },
// new[] { 0f, 0f, 0f, 0f },

View File

@ -128,7 +128,7 @@ public class GLU
// This code comes directly from GLU except that it is for float
static int GlhInvertMatrixf2(float[] m, float[] @out)
{
float[][] wtmp = ArrayUtils.Of<float>(4, 8);
float[][] wtmp = RcArrayUtils.Of<float>(4, 8);
float m0, m1, m2, m3, s;
float[] r0, r1, r2, r3;
r0 = wtmp[0];

View File

@ -40,7 +40,7 @@ using DotRecast.Recast.Demo.Draw;
using DotRecast.Recast.Demo.Geom;
using DotRecast.Recast.Demo.Tools;
using DotRecast.Recast.Demo.UI;
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
using Window = Silk.NET.Windowing.Window;
namespace DotRecast.Recast.Demo;

View File

@ -80,7 +80,7 @@ public class ConvexVolumeTool : Tool
// Create
// If clicked on that last pt, create the shape.
if (pts.Count > 0 && RecastMath.VDistSqr(p, Vector3f.Of(pts[pts.Count - 3], pts[pts.Count - 2], pts[pts.Count - 1])) < 0.2f * 0.2f)
if (pts.Count > 0 && RcMath.VDistSqr(p, Vector3f.Of(pts[pts.Count - 3], pts[pts.Count - 2], pts[pts.Count - 1])) < 0.2f * 0.2f)
{
if (hull.Count > 2)
{
@ -108,7 +108,7 @@ public class ConvexVolumeTool : Tool
int noffset = PolyUtils.OffsetPoly(verts, hull.Count, polyOffset, offset, offset.Length);
if (noffset > 0)
{
geom.AddConvexVolume(ArrayUtils.CopyOf(offset, 0, noffset * 3), minh, maxh, areaType);
geom.AddConvexVolume(RcArrayUtils.CopyOf(offset, 0, noffset * 3), minh, maxh, areaType);
}
}
else

View File

@ -189,7 +189,7 @@ public class CrowdProfilingTool
bool valid = true;
foreach (FindRandomPointResult zone in zones)
{
if (RecastMath.VDistSqr(zone.GetRandomPt(), result.result.GetRandomPt()) < zoneSeparation)
if (RcMath.VDistSqr(zone.GetRandomPt(), result.result.GetRandomPt()) < zoneSeparation)
{
valid = false;
break;
@ -313,7 +313,7 @@ public class CrowdProfilingTool
List<FindRandomPointResult> potentialTargets = new();
foreach (FindRandomPointResult zone in zones)
{
if (RecastMath.VDistSqr(zone.GetRandomPt(), ag.npos) > zoneRadius * zoneRadius)
if (RcMath.VDistSqr(zone.GetRandomPt(), ag.npos) > zoneRadius * zoneRadius)
{
potentialTargets.Add(zone);
}

View File

@ -32,7 +32,7 @@ using DotRecast.Recast.Demo.Geom;
using ImGuiNET;
using static DotRecast.Recast.Demo.Draw.DebugDraw;
using static DotRecast.Recast.Demo.Draw.DebugDrawPrimitives;
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
namespace DotRecast.Recast.Demo.Tools;

View File

@ -40,7 +40,7 @@ using Silk.NET.OpenAL;
using Silk.NET.Windowing;
using static DotRecast.Recast.Demo.Draw.DebugDraw;
using static DotRecast.Recast.Demo.Draw.DebugDrawPrimitives;
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
namespace DotRecast.Recast.Demo.Tools;

View File

@ -1,7 +1,7 @@
using DotRecast.Core;
using DotRecast.Recast.Demo.Draw;
using static DotRecast.Recast.RecastVectors;
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
using static DotRecast.Recast.Demo.Tools.Gizmos.GizmoHelper;
namespace DotRecast.Recast.Demo.Tools.Gizmos;

View File

@ -1,7 +1,7 @@
using DotRecast.Core;
using DotRecast.Recast.Demo.Draw;
using static DotRecast.Recast.RecastVectors;
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
using static DotRecast.Recast.Demo.Tools.Gizmos.GizmoHelper;

View File

@ -1,7 +1,7 @@
using System;
using DotRecast.Core;
using DotRecast.Recast.Demo.Draw;
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
namespace DotRecast.Recast.Demo.Tools.Gizmos;

View File

@ -1,6 +1,6 @@
using DotRecast.Core;
using DotRecast.Recast.Demo.Draw;
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
using static DotRecast.Recast.Demo.Tools.Gizmos.GizmoHelper;

View File

@ -25,7 +25,7 @@ using DotRecast.Recast.Demo.Builder;
using DotRecast.Recast.Demo.Draw;
using DotRecast.Recast.Demo.Geom;
using ImGuiNET;
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
using static DotRecast.Recast.Demo.Draw.DebugDraw;
using static DotRecast.Recast.Demo.Draw.DebugDrawPrimitives;

View File

@ -57,7 +57,7 @@ public class OffMeshConnectionTool : Tool
DemoOffMeshConnection nearestConnection = null;
foreach (DemoOffMeshConnection offMeshCon in geom.GetOffMeshConnections())
{
float d = Math.Min(RecastMath.VDistSqr(p, offMeshCon.verts, 0), RecastMath.VDistSqr(p, offMeshCon.verts, 3));
float d = Math.Min(RcMath.VDistSqr(p, offMeshCon.verts, 0), RcMath.VDistSqr(p, offMeshCon.verts, 3));
if (d < nearestDist && Math.Sqrt(d) < sample.GetSettingsUI().GetAgentRadius())
{
nearestDist = d;

View File

@ -6,7 +6,7 @@ using DotRecast.Detour.QueryResults;
using DotRecast.Recast.Demo.Builder;
using DotRecast.Recast.Demo.Draw;
using ImGuiNET;
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
using static DotRecast.Recast.Demo.Draw.DebugDraw;
using static DotRecast.Recast.Demo.Draw.DebugDrawPrimitives;
@ -168,7 +168,7 @@ public class TestNavmeshTool : Tool
NavMeshQuery m_navQuery = m_sample.GetNavMeshQuery();
if (m_sposSet)
{
m_startRef = m_navQuery.FindNearestPoly(m_spos, m_polyPickExt, m_filter).result.GetNearestRef();
m_startRef = m_navQuery.FindNearestPoly(m_spos, m_polyPickExt, m_filter).result?.GetNearestRef() ?? 0;
}
else
{
@ -177,7 +177,7 @@ public class TestNavmeshTool : Tool
if (m_eposSet)
{
m_endRef = m_navQuery.FindNearestPoly(m_epos, m_polyPickExt, m_filter).result.GetNearestRef();
m_endRef = m_navQuery.FindNearestPoly(m_epos, m_polyPickExt, m_filter).result?.GetNearestRef() ?? 0;
}
else
{
@ -850,7 +850,7 @@ public class TestNavmeshTool : Tool
Vector3f s3 = Vector3f.Of(s[3], s[4], s[5]);
// Skip too distant segments.
Tuple<float, float> distSqr = DistancePtSegSqr2D(m_spos, s, 0, 3);
if (distSqr.Item1 > RecastMath.Sqr(m_neighbourhoodRadius))
if (distSqr.Item1 > RcMath.Sqr(m_neighbourhoodRadius))
{
continue;
}

View File

@ -18,7 +18,7 @@ freely, subject to the following restrictions:
using System;
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
using static DotRecast.Recast.RecastConstants;
using static DotRecast.Recast.RecastVectors;

View File

@ -18,7 +18,7 @@ freely, subject to the following restrictions:
using System;
using DotRecast.Core;
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
using static DotRecast.Recast.RecastConstants;
using static DotRecast.Recast.RecastVectors;
@ -110,7 +110,7 @@ namespace DotRecast.Recast
bounds[5] = Math.Max(bounds[5], vertices[i * 3 + 2]);
}
float[][] planes = ArrayUtils.Of<float>(6, 4);
float[][] planes = RcArrayUtils.Of<float>(6, 4);
for (int i = 0; i < 6; i++)
{
float m = i < 3 ? -1 : 1;
@ -142,8 +142,8 @@ namespace DotRecast.Recast
}
float[][] planes = ArrayUtils.Of<float>(triangles.Length, 4);
float[][] triBounds = ArrayUtils.Of<float>(triangles.Length / 3, 4);
float[][] planes = RcArrayUtils.Of<float>(triangles.Length, 4);
float[][] triBounds = RcArrayUtils.Of<float>(triangles.Length / 3, 4);
for (int i = 0, j = 0; i < triangles.Length; i += 3, j++)
{
int a = triangles[i] * 3;

View File

@ -21,7 +21,7 @@ freely, subject to the following restrictions:
using System;
using System.Collections.Generic;
using DotRecast.Core;
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
using static DotRecast.Recast.RecastCommon;
using static DotRecast.Recast.RecastConstants;

View File

@ -20,7 +20,7 @@ freely, subject to the following restrictions:
using System;
using DotRecast.Core;
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
using static DotRecast.Recast.RecastConstants;
namespace DotRecast.Recast

View File

@ -26,7 +26,7 @@ using NUnit.Framework;
namespace DotRecast.Detour.Crowd.Test;
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
[Parallelizable]
public class AbstractCrowdTest

View File

@ -135,6 +135,6 @@ public class UnityAStarPathfindingImporterTest
string filepath = Path.Combine("test-output", filename);
using var fs = new FileStream(filename, FileMode.Create);
using var os = new BinaryWriter(fs);
writer.Write(os, mesh, ByteOrder.LITTLE_ENDIAN, true);
writer.Write(os, mesh, RcByteOrder.LITTLE_ENDIAN, true);
}
}

View File

@ -39,28 +39,28 @@ public class MeshDataReaderWriterTest
[Test]
public void TestCCompatibility()
{
Test(true, ByteOrder.BIG_ENDIAN);
Test(true, RcByteOrder.BIG_ENDIAN);
}
[Test]
public void TestCompact()
{
Test(false, ByteOrder.BIG_ENDIAN);
Test(false, RcByteOrder.BIG_ENDIAN);
}
[Test]
public void TestCCompatibilityLE()
{
Test(true, ByteOrder.LITTLE_ENDIAN);
Test(true, RcByteOrder.LITTLE_ENDIAN);
}
[Test]
public void TestCompactLE()
{
Test(false, ByteOrder.LITTLE_ENDIAN);
Test(false, RcByteOrder.LITTLE_ENDIAN);
}
public void Test(bool cCompatibility, ByteOrder order)
public void Test(bool cCompatibility, RcByteOrder order)
{
using var ms = new MemoryStream();
using var bwos = new BinaryWriter(ms);

View File

@ -23,7 +23,7 @@ using DotRecast.Detour.Io;
using DotRecast.Recast;
using DotRecast.Recast.Geom;
using NUnit.Framework;
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
namespace DotRecast.Detour.Test.Io;
@ -94,7 +94,7 @@ public class MeshSetReaderWriterTest
using var ms = new MemoryStream();
using var os = new BinaryWriter(ms);
writer.Write(os, mesh, ByteOrder.LITTLE_ENDIAN, true);
writer.Write(os, mesh, RcByteOrder.LITTLE_ENDIAN, true);
ms.Seek(0, SeekOrigin.Begin);
using var @is = new BinaryReader(ms);

View File

@ -21,7 +21,7 @@ using System.Diagnostics;
using DotRecast.Core;
using DotRecast.Detour.QueryResults;
using NUnit.Framework;
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
namespace DotRecast.Detour.Test;

View File

@ -22,7 +22,7 @@ using DotRecast.Core;
using DotRecast.Detour.TileCache.Io.Compress;
using DotRecast.Recast.Geom;
using NUnit.Framework;
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
using static DotRecast.Recast.RecastVectors;
namespace DotRecast.Detour.TileCache.Test;
@ -50,7 +50,7 @@ public class AbstractTileCacheTest
}
}
public TileCache GetTileCache(IInputGeomProvider geom, ByteOrder order, bool cCompatibility)
public TileCache GetTileCache(IInputGeomProvider geom, RcByteOrder order, bool cCompatibility)
{
TileCacheParams option = new TileCacheParams();
int[] twh = Recast.Recast.CalcTileCount(geom.GetMeshBoundsMin(), geom.GetMeshBoundsMax(), m_cellSize, m_tileSize, m_tileSize);

View File

@ -52,8 +52,8 @@ public class TileCacheReaderWriterTest : AbstractTileCacheTest
{
IInputGeomProvider geom = ObjImporter.Load(Loader.ToBytes("dungeon.obj"));
TestTileLayerBuilder layerBuilder = new TestTileLayerBuilder(geom);
List<byte[]> layers = layerBuilder.Build(ByteOrder.LITTLE_ENDIAN, cCompatibility, 1);
TileCache tc = GetTileCache(geom, ByteOrder.LITTLE_ENDIAN, cCompatibility);
List<byte[]> layers = layerBuilder.Build(RcByteOrder.LITTLE_ENDIAN, cCompatibility, 1);
TileCache tc = GetTileCache(geom, RcByteOrder.LITTLE_ENDIAN, cCompatibility);
foreach (byte[] layer in layers)
{
long refs = tc.AddTile(layer, 0);
@ -62,7 +62,7 @@ public class TileCacheReaderWriterTest : AbstractTileCacheTest
using var msout = new MemoryStream();
using var baos = new BinaryWriter(msout);
writer.Write(baos, tc, ByteOrder.LITTLE_ENDIAN, cCompatibility);
writer.Write(baos, tc, RcByteOrder.LITTLE_ENDIAN, cCompatibility);
using var msis = new MemoryStream(msout.ToArray());
using var bais = new BinaryReader(msis);

View File

@ -35,8 +35,8 @@ public class TempObstaclesTest : AbstractTileCacheTest
bool cCompatibility = true;
IInputGeomProvider geom = ObjImporter.Load(Loader.ToBytes("dungeon.obj"));
TestTileLayerBuilder layerBuilder = new TestTileLayerBuilder(geom);
List<byte[]> layers = layerBuilder.Build(ByteOrder.LITTLE_ENDIAN, cCompatibility, 1);
TileCache tc = GetTileCache(geom, ByteOrder.LITTLE_ENDIAN, cCompatibility);
List<byte[]> layers = layerBuilder.Build(RcByteOrder.LITTLE_ENDIAN, cCompatibility, 1);
TileCache tc = GetTileCache(geom, RcByteOrder.LITTLE_ENDIAN, cCompatibility);
foreach (byte[] data in layers)
{
long refs = tc.AddTile(data, 0);
@ -69,8 +69,8 @@ public class TempObstaclesTest : AbstractTileCacheTest
bool cCompatibility = true;
IInputGeomProvider geom = ObjImporter.Load(Loader.ToBytes("dungeon.obj"));
TestTileLayerBuilder layerBuilder = new TestTileLayerBuilder(geom);
List<byte[]> layers = layerBuilder.Build(ByteOrder.LITTLE_ENDIAN, cCompatibility, 1);
TileCache tc = GetTileCache(geom, ByteOrder.LITTLE_ENDIAN, cCompatibility);
List<byte[]> layers = layerBuilder.Build(RcByteOrder.LITTLE_ENDIAN, cCompatibility, 1);
TileCache tc = GetTileCache(geom, RcByteOrder.LITTLE_ENDIAN, cCompatibility);
foreach (byte[] data in layers)
{
long refs = tc.AddTile(data, 0);

View File

@ -22,7 +22,7 @@ using System.Collections.Generic;
using DotRecast.Core;
using DotRecast.Recast;
using DotRecast.Recast.Geom;
using static DotRecast.Core.RecastMath;
using static DotRecast.Core.RcMath;
namespace DotRecast.Detour.TileCache.Test;
@ -63,7 +63,7 @@ public class TestTileLayerBuilder : AbstractTileLayersBuilder
th = twh[1];
}
public List<byte[]> Build(ByteOrder order, bool cCompatibility, int threads)
public List<byte[]> Build(RcByteOrder order, bool cCompatibility, int threads)
{
return Build(order, cCompatibility, threads, tw, th);
}
@ -78,7 +78,7 @@ public class TestTileLayerBuilder : AbstractTileLayersBuilder
return th;
}
protected override List<byte[]> Build(int tx, int ty, ByteOrder order, bool cCompatibility)
protected override List<byte[]> Build(int tx, int ty, RcByteOrder order, bool cCompatibility)
{
HeightfieldLayerSet lset = GetHeightfieldSet(tx, ty);
List<byte[]> result = new();

View File

@ -58,8 +58,8 @@ public class TileCacheNavigationTest : AbstractTileCacheTest
bool cCompatibility = true;
IInputGeomProvider geom = ObjImporter.Load(Loader.ToBytes("dungeon.obj"));
TestTileLayerBuilder layerBuilder = new TestTileLayerBuilder(geom);
List<byte[]> layers = layerBuilder.Build(ByteOrder.LITTLE_ENDIAN, cCompatibility, 1);
TileCache tc = GetTileCache(geom, ByteOrder.LITTLE_ENDIAN, cCompatibility);
List<byte[]> layers = layerBuilder.Build(RcByteOrder.LITTLE_ENDIAN, cCompatibility, 1);
TileCache tc = GetTileCache(geom, RcByteOrder.LITTLE_ENDIAN, cCompatibility);
foreach (byte[] data in layers)
{
tc.AddTile(data, 0);

View File

@ -34,30 +34,30 @@ public class TileCacheTest : AbstractTileCacheTest
[Test]
public void TestFastLz()
{
TestDungeon(ByteOrder.LITTLE_ENDIAN, false);
TestDungeon(ByteOrder.LITTLE_ENDIAN, true);
TestDungeon(ByteOrder.BIG_ENDIAN, false);
TestDungeon(ByteOrder.BIG_ENDIAN, true);
Test(ByteOrder.LITTLE_ENDIAN, false);
Test(ByteOrder.LITTLE_ENDIAN, true);
Test(ByteOrder.BIG_ENDIAN, false);
Test(ByteOrder.BIG_ENDIAN, true);
TestDungeon(RcByteOrder.LITTLE_ENDIAN, false);
TestDungeon(RcByteOrder.LITTLE_ENDIAN, true);
TestDungeon(RcByteOrder.BIG_ENDIAN, false);
TestDungeon(RcByteOrder.BIG_ENDIAN, true);
Test(RcByteOrder.LITTLE_ENDIAN, false);
Test(RcByteOrder.LITTLE_ENDIAN, true);
Test(RcByteOrder.BIG_ENDIAN, false);
Test(RcByteOrder.BIG_ENDIAN, true);
}
[Test]
public void TestLZ4()
{
TestDungeon(ByteOrder.LITTLE_ENDIAN, false);
TestDungeon(ByteOrder.LITTLE_ENDIAN, true);
TestDungeon(ByteOrder.BIG_ENDIAN, false);
TestDungeon(ByteOrder.BIG_ENDIAN, true);
Test(ByteOrder.LITTLE_ENDIAN, false);
Test(ByteOrder.LITTLE_ENDIAN, true);
Test(ByteOrder.BIG_ENDIAN, false);
Test(ByteOrder.BIG_ENDIAN, true);
TestDungeon(RcByteOrder.LITTLE_ENDIAN, false);
TestDungeon(RcByteOrder.LITTLE_ENDIAN, true);
TestDungeon(RcByteOrder.BIG_ENDIAN, false);
TestDungeon(RcByteOrder.BIG_ENDIAN, true);
Test(RcByteOrder.LITTLE_ENDIAN, false);
Test(RcByteOrder.LITTLE_ENDIAN, true);
Test(RcByteOrder.BIG_ENDIAN, false);
Test(RcByteOrder.BIG_ENDIAN, true);
}
private void TestDungeon(ByteOrder order, bool cCompatibility)
private void TestDungeon(RcByteOrder order, bool cCompatibility)
{
IInputGeomProvider geom = ObjImporter.Load(Loader.ToBytes("dungeon.obj"));
TileCache tc = GetTileCache(geom, order, cCompatibility);
@ -153,7 +153,7 @@ public class TileCacheTest : AbstractTileCacheTest
Assert.That(data.detailTris.Length, Is.EqualTo(4 * 3));
}
private void Test(ByteOrder order, bool cCompatibility)
private void Test(RcByteOrder order, bool cCompatibility)
{
IInputGeomProvider geom = ObjImporter.Load(Loader.ToBytes("nav_test.obj"));
TileCache tc = GetTileCache(geom, order, cCompatibility);
@ -179,7 +179,7 @@ public class TileCacheTest : AbstractTileCacheTest
public void TestPerformance()
{
int threads = 4;
ByteOrder order = ByteOrder.LITTLE_ENDIAN;
RcByteOrder order = RcByteOrder.LITTLE_ENDIAN;
bool cCompatibility = false;
IInputGeomProvider geom = ObjImporter.Load(Loader.ToBytes("dungeon.obj"));
TestTileLayerBuilder layerBuilder = new TestTileLayerBuilder(geom);