forked from mirror/DotRecast
C# style
This commit is contained in:
parent
7677add89e
commit
4ded5e0529
|
@ -41,23 +41,23 @@ namespace DotRecast.Detour.TileCache.Io.Compress
|
||||||
|
|
||||||
private static readonly int MIN_RECOMENDED_LENGTH_FOR_LEVEL_2 = 1024 * 64;
|
private static readonly int MIN_RECOMENDED_LENGTH_FOR_LEVEL_2 = 1024 * 64;
|
||||||
|
|
||||||
static readonly int MAGIC_NUMBER = 'F' << 16 | 'L' << 8 | 'Z';
|
private static readonly int MAGIC_NUMBER = 'F' << 16 | 'L' << 8 | 'Z';
|
||||||
|
|
||||||
static readonly byte BLOCK_TYPE_NON_COMPRESSED = 0x00;
|
private static readonly byte BLOCK_TYPE_NON_COMPRESSED = 0x00;
|
||||||
static readonly byte BLOCK_TYPE_COMPRESSED = 0x01;
|
private static readonly byte BLOCK_TYPE_COMPRESSED = 0x01;
|
||||||
static readonly byte BLOCK_WITHOUT_CHECKSUM = 0x00;
|
private static readonly byte BLOCK_WITHOUT_CHECKSUM = 0x00;
|
||||||
static readonly byte BLOCK_WITH_CHECKSUM = 0x10;
|
private static readonly byte BLOCK_WITH_CHECKSUM = 0x10;
|
||||||
|
|
||||||
static readonly int OPTIONS_OFFSET = 3;
|
private static readonly int OPTIONS_OFFSET = 3;
|
||||||
static readonly int CHECKSUM_OFFSET = 4;
|
private static readonly int CHECKSUM_OFFSET = 4;
|
||||||
|
|
||||||
static readonly int MAX_CHUNK_LENGTH = 0xFFFF;
|
private static readonly int MAX_CHUNK_LENGTH = 0xFFFF;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do not call {@link #Compress(byte[], int, int, byte[], int, int)} for input buffers
|
* Do not call {@link #Compress(byte[], int, int, byte[], int, int)} for input buffers
|
||||||
* which length less than this value.
|
* which length less than this value.
|
||||||
*/
|
*/
|
||||||
static readonly int MIN_LENGTH_TO_COMPRESSION = 32;
|
private static readonly int MIN_LENGTH_TO_COMPRESSION = 32;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* In this case {@link #Compress(byte[], int, int, byte[], int, int)} will choose level
|
* In this case {@link #Compress(byte[], int, int, byte[], int, int)} will choose level
|
||||||
|
@ -65,17 +65,17 @@ namespace DotRecast.Detour.TileCache.Io.Compress
|
||||||
* {@link #MIN_RECOMENDED_LENGTH_FOR_LEVEL_2} {@link #LEVEL_1} will be choosen,
|
* {@link #MIN_RECOMENDED_LENGTH_FOR_LEVEL_2} {@link #LEVEL_1} will be choosen,
|
||||||
* otherwise {@link #LEVEL_2}.
|
* otherwise {@link #LEVEL_2}.
|
||||||
*/
|
*/
|
||||||
static readonly int LEVEL_AUTO = 0;
|
private static readonly int LEVEL_AUTO = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Level 1 is the fastest compression and generally useful for short data.
|
* Level 1 is the fastest compression and generally useful for short data.
|
||||||
*/
|
*/
|
||||||
static readonly int LEVEL_1 = 1;
|
private static readonly int LEVEL_1 = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Level 2 is slightly slower but it gives better compression ratio.
|
* Level 2 is slightly slower but it gives better compression ratio.
|
||||||
*/
|
*/
|
||||||
static readonly int LEVEL_2 = 2;
|
private static readonly int LEVEL_2 = 2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The output buffer must be at least 6% larger than the input buffer and can not be smaller than 66 bytes.
|
* The output buffer must be at least 6% larger than the input buffer and can not be smaller than 66 bytes.
|
||||||
|
|
|
@ -35,11 +35,6 @@ namespace DotRecast.Detour.TileCache
|
||||||
const int DT_TILECACHE_NULL_IDX = 0xffff;
|
const int DT_TILECACHE_NULL_IDX = 0xffff;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private readonly TileCacheLayerHeaderReader reader = new TileCacheLayerHeaderReader();
|
private readonly TileCacheLayerHeaderReader reader = new TileCacheLayerHeaderReader();
|
||||||
|
|
||||||
public void BuildTileCacheRegions(TileCacheLayer layer, int walkableClimb)
|
public void BuildTileCacheRegions(TileCacheLayer layer, int walkableClimb)
|
||||||
|
@ -2063,4 +2058,4 @@ namespace DotRecast.Detour.TileCache
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -36,32 +36,6 @@ using static DotRecast.Core.RecastMath;
|
||||||
|
|
||||||
namespace DotRecast.Recast.Demo.Tools;
|
namespace DotRecast.Recast.Demo.Tools;
|
||||||
|
|
||||||
public class CrowdToolMode
|
|
||||||
{
|
|
||||||
public static readonly CrowdToolMode CREATE = new(0, "Create Agents");
|
|
||||||
public static readonly CrowdToolMode MOVE_TARGET = new(1, "Move Target");
|
|
||||||
public static readonly CrowdToolMode SELECT = new(2, "Select Agent");
|
|
||||||
public static readonly CrowdToolMode TOGGLE_POLYS = new(3, "Toggle Polys");
|
|
||||||
public static readonly CrowdToolMode PROFILING = new(4, "Profiling");
|
|
||||||
|
|
||||||
public static readonly ImmutableArray<CrowdToolMode> Values = ImmutableArray.Create(
|
|
||||||
CREATE,
|
|
||||||
MOVE_TARGET,
|
|
||||||
SELECT,
|
|
||||||
TOGGLE_POLYS,
|
|
||||||
PROFILING
|
|
||||||
);
|
|
||||||
|
|
||||||
public int Idx { get; }
|
|
||||||
public string Label { get; }
|
|
||||||
|
|
||||||
private CrowdToolMode(int idx, string label)
|
|
||||||
{
|
|
||||||
Idx = idx;
|
|
||||||
Label = label;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class CrowdTool : Tool
|
public class CrowdTool : Tool
|
||||||
{
|
{
|
||||||
private readonly CrowdToolParams toolParams = new CrowdToolParams();
|
private readonly CrowdToolParams toolParams = new CrowdToolParams();
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
using System.Collections.Immutable;
|
||||||
|
|
||||||
|
namespace DotRecast.Recast.Demo.Tools;
|
||||||
|
|
||||||
|
public class CrowdToolMode
|
||||||
|
{
|
||||||
|
public static readonly CrowdToolMode CREATE = new(0, "Create Agents");
|
||||||
|
public static readonly CrowdToolMode MOVE_TARGET = new(1, "Move Target");
|
||||||
|
public static readonly CrowdToolMode SELECT = new(2, "Select Agent");
|
||||||
|
public static readonly CrowdToolMode TOGGLE_POLYS = new(3, "Toggle Polys");
|
||||||
|
public static readonly CrowdToolMode PROFILING = new(4, "Profiling");
|
||||||
|
|
||||||
|
public static readonly ImmutableArray<CrowdToolMode> Values = ImmutableArray.Create(
|
||||||
|
CREATE,
|
||||||
|
MOVE_TARGET,
|
||||||
|
SELECT,
|
||||||
|
TOGGLE_POLYS,
|
||||||
|
PROFILING
|
||||||
|
);
|
||||||
|
|
||||||
|
public int Idx { get; }
|
||||||
|
public string Label { get; }
|
||||||
|
|
||||||
|
private CrowdToolMode(int idx, string label)
|
||||||
|
{
|
||||||
|
Idx = idx;
|
||||||
|
Label = label;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
using DotRecast.Core;
|
||||||
|
|
||||||
|
namespace DotRecast.Recast.Geom
|
||||||
|
{
|
||||||
|
public class BoundsItem
|
||||||
|
{
|
||||||
|
public Vector2f bmin;
|
||||||
|
public Vector2f bmax;
|
||||||
|
public int i;
|
||||||
|
}
|
||||||
|
}
|
|
@ -24,29 +24,6 @@ using DotRecast.Core;
|
||||||
|
|
||||||
namespace DotRecast.Recast.Geom
|
namespace DotRecast.Recast.Geom
|
||||||
{
|
{
|
||||||
public class BoundsItem
|
|
||||||
{
|
|
||||||
public Vector2f bmin;
|
|
||||||
public Vector2f bmax;
|
|
||||||
public int i;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class CompareItemX : IComparer<BoundsItem>
|
|
||||||
{
|
|
||||||
public int Compare(BoundsItem a, BoundsItem b)
|
|
||||||
{
|
|
||||||
return a.bmin.x.CompareTo(b.bmin.x);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class CompareItemY : IComparer<BoundsItem>
|
|
||||||
{
|
|
||||||
public int Compare(BoundsItem a, BoundsItem b)
|
|
||||||
{
|
|
||||||
return a.bmin.y.CompareTo(b.bmin.y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ChunkyTriMesh
|
public class ChunkyTriMesh
|
||||||
{
|
{
|
||||||
List<ChunkyTriMeshNode> nodes;
|
List<ChunkyTriMeshNode> nodes;
|
||||||
|
@ -315,4 +292,4 @@ namespace DotRecast.Recast.Geom
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace DotRecast.Recast.Geom
|
||||||
|
{
|
||||||
|
public class CompareItemX : IComparer<BoundsItem>
|
||||||
|
{
|
||||||
|
public int Compare(BoundsItem a, BoundsItem b)
|
||||||
|
{
|
||||||
|
return a.bmin.x.CompareTo(b.bmin.x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace DotRecast.Recast.Geom
|
||||||
|
{
|
||||||
|
public class CompareItemY : IComparer<BoundsItem>
|
||||||
|
{
|
||||||
|
public int Compare(BoundsItem a, BoundsItem b)
|
||||||
|
{
|
||||||
|
return a.bmin.y.CompareTo(b.bmin.y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
namespace DotRecast.Recast
|
||||||
|
{
|
||||||
|
public interface IRecastBuilderProgressListener
|
||||||
|
{
|
||||||
|
void OnProgress(int completed, int total);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +0,0 @@
|
||||||
namespace DotRecast.Recast
|
|
||||||
{
|
|
||||||
public class InputGeomReader
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -29,11 +29,6 @@ namespace DotRecast.Recast
|
||||||
{
|
{
|
||||||
public class RecastBuilder
|
public class RecastBuilder
|
||||||
{
|
{
|
||||||
public interface IRecastBuilderProgressListener
|
|
||||||
{
|
|
||||||
void OnProgress(int completed, int total);
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly IRecastBuilderProgressListener progressListener;
|
private readonly IRecastBuilderProgressListener progressListener;
|
||||||
|
|
||||||
public RecastBuilder()
|
public RecastBuilder()
|
||||||
|
@ -321,4 +316,4 @@ namespace DotRecast.Recast
|
||||||
return RecastLayers.BuildHeightfieldLayers(ctx, chf, builderCfg.cfg.walkableHeight);
|
return RecastLayers.BuildHeightfieldLayers(ctx, chf, builderCfg.cfg.walkableHeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue