forked from bit/DotRecastNetSim
ConvexVolume RcConvexVolume for unity3d
This commit is contained in:
parent
bc14092125
commit
e923e8262a
|
@ -27,7 +27,7 @@ namespace DotRecast.Detour.Dynamic
|
||||||
public readonly int tileSizeZ;
|
public readonly int tileSizeZ;
|
||||||
public readonly float cellSize;
|
public readonly float cellSize;
|
||||||
public PartitionType partitionType = PartitionType.WATERSHED;
|
public PartitionType partitionType = PartitionType.WATERSHED;
|
||||||
public AreaModification walkableAreaModification = new AreaModification(1);
|
public RcAreaModification walkableAreaModification = new RcAreaModification(1);
|
||||||
public float walkableHeight;
|
public float walkableHeight;
|
||||||
public float walkableSlopeAngle;
|
public float walkableSlopeAngle;
|
||||||
public float walkableRadius;
|
public float walkableRadius;
|
||||||
|
|
|
@ -63,7 +63,7 @@ namespace DotRecast.Detour.Dynamic.Io
|
||||||
|
|
||||||
public RcConfig GetConfig(VoxelTile tile, PartitionType partitionType, int maxPolyVerts, int regionMergeSize,
|
public RcConfig GetConfig(VoxelTile tile, PartitionType partitionType, int maxPolyVerts, int regionMergeSize,
|
||||||
bool filterLowHangingObstacles, bool filterLedgeSpans, bool filterWalkableLowHeightSpans,
|
bool filterLowHangingObstacles, bool filterLedgeSpans, bool filterWalkableLowHeightSpans,
|
||||||
AreaModification walkbableAreaMod, bool buildMeshDetail, float detailSampleDist, float detailSampleMaxError)
|
RcAreaModification walkbableAreaMod, bool buildMeshDetail, float detailSampleDist, float detailSampleMaxError)
|
||||||
{
|
{
|
||||||
return new RcConfig(useTiles, tileSizeX, tileSizeZ, tile.borderSize, partitionType, cellSize, tile.cellHeight,
|
return new RcConfig(useTiles, tileSizeX, tileSizeZ, tile.borderSize, partitionType, cellSize, tile.cellHeight,
|
||||||
walkableSlopeAngle, filterLowHangingObstacles, filterLedgeSpans, filterWalkableLowHeightSpans, walkableHeight,
|
walkableSlopeAngle, filterLowHangingObstacles, filterLedgeSpans, filterWalkableLowHeightSpans, walkableHeight,
|
||||||
|
|
|
@ -245,7 +245,7 @@ public class NavMeshRenderer
|
||||||
|
|
||||||
_debugDraw.Begin(DebugDrawPrimitives.TRIS);
|
_debugDraw.Begin(DebugDrawPrimitives.TRIS);
|
||||||
|
|
||||||
foreach (ConvexVolume vol in geom.ConvexVolumes())
|
foreach (RcConvexVolume vol in geom.ConvexVolumes())
|
||||||
{
|
{
|
||||||
int col = DebugDraw.DuTransCol(DebugDraw.AreaToCol(vol.areaMod.GetMaskedValue()), 32);
|
int col = DebugDraw.DuTransCol(DebugDraw.AreaToCol(vol.areaMod.GetMaskedValue()), 32);
|
||||||
for (int j = 0, k = vol.verts.Length - 3; j < vol.verts.Length; k = j, j += 3)
|
for (int j = 0, k = vol.verts.Length - 3; j < vol.verts.Length; k = j, j += 3)
|
||||||
|
@ -270,7 +270,7 @@ public class NavMeshRenderer
|
||||||
_debugDraw.End();
|
_debugDraw.End();
|
||||||
|
|
||||||
_debugDraw.Begin(DebugDrawPrimitives.LINES, 2.0f);
|
_debugDraw.Begin(DebugDrawPrimitives.LINES, 2.0f);
|
||||||
foreach (ConvexVolume vol in geom.ConvexVolumes())
|
foreach (RcConvexVolume vol in geom.ConvexVolumes())
|
||||||
{
|
{
|
||||||
int col = DebugDraw.DuTransCol(DebugDraw.AreaToCol(vol.areaMod.GetMaskedValue()), 220);
|
int col = DebugDraw.DuTransCol(DebugDraw.AreaToCol(vol.areaMod.GetMaskedValue()), 220);
|
||||||
for (int j = 0, k = vol.verts.Length - 3; j < vol.verts.Length; k = j, j += 3)
|
for (int j = 0, k = vol.verts.Length - 3; j < vol.verts.Length; k = j, j += 3)
|
||||||
|
@ -289,7 +289,7 @@ public class NavMeshRenderer
|
||||||
_debugDraw.End();
|
_debugDraw.End();
|
||||||
|
|
||||||
_debugDraw.Begin(DebugDrawPrimitives.POINTS, 3.0f);
|
_debugDraw.Begin(DebugDrawPrimitives.POINTS, 3.0f);
|
||||||
foreach (ConvexVolume vol in geom.ConvexVolumes())
|
foreach (RcConvexVolume vol in geom.ConvexVolumes())
|
||||||
{
|
{
|
||||||
int col = DebugDraw.DuDarkenCol(DebugDraw.DuTransCol(DebugDraw.AreaToCol(vol.areaMod.GetMaskedValue()), 220));
|
int col = DebugDraw.DuDarkenCol(DebugDraw.DuTransCol(DebugDraw.AreaToCol(vol.areaMod.GetMaskedValue()), 220));
|
||||||
for (int j = 0; j < vol.verts.Length; j += 3)
|
for (int j = 0; j < vol.verts.Length; j += 3)
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class ConvexVolumeTool : IRcTool
|
||||||
private readonly ConvexVolumeToolImpl _impl;
|
private readonly ConvexVolumeToolImpl _impl;
|
||||||
|
|
||||||
private int areaTypeValue = SampleAreaModifications.SAMPLE_AREAMOD_GRASS.Value;
|
private int areaTypeValue = SampleAreaModifications.SAMPLE_AREAMOD_GRASS.Value;
|
||||||
private AreaModification areaType = SampleAreaModifications.SAMPLE_AREAMOD_GRASS;
|
private RcAreaModification areaType = SampleAreaModifications.SAMPLE_AREAMOD_GRASS;
|
||||||
private float boxHeight = 6f;
|
private float boxHeight = 6f;
|
||||||
private float boxDescent = 1f;
|
private float boxDescent = 1f;
|
||||||
private float polyOffset = 0f;
|
private float polyOffset = 0f;
|
||||||
|
|
|
@ -35,15 +35,15 @@ namespace DotRecast.Recast.DemoTool.Builder
|
||||||
public const int SAMPLE_POLYAREA_TYPE_JUMP_AUTO = 0x6;
|
public const int SAMPLE_POLYAREA_TYPE_JUMP_AUTO = 0x6;
|
||||||
public const int SAMPLE_POLYAREA_TYPE_WALKABLE = 0x3f;
|
public const int SAMPLE_POLYAREA_TYPE_WALKABLE = 0x3f;
|
||||||
|
|
||||||
public static readonly AreaModification SAMPLE_AREAMOD_WALKABLE = new AreaModification(SAMPLE_POLYAREA_TYPE_WALKABLE);
|
public static readonly RcAreaModification SAMPLE_AREAMOD_WALKABLE = new RcAreaModification(SAMPLE_POLYAREA_TYPE_WALKABLE);
|
||||||
public static readonly AreaModification SAMPLE_AREAMOD_GROUND = new AreaModification(SAMPLE_POLYAREA_TYPE_GROUND);
|
public static readonly RcAreaModification SAMPLE_AREAMOD_GROUND = new RcAreaModification(SAMPLE_POLYAREA_TYPE_GROUND);
|
||||||
public static readonly AreaModification SAMPLE_AREAMOD_WATER = new AreaModification(SAMPLE_POLYAREA_TYPE_WATER);
|
public static readonly RcAreaModification SAMPLE_AREAMOD_WATER = new RcAreaModification(SAMPLE_POLYAREA_TYPE_WATER);
|
||||||
public static readonly AreaModification SAMPLE_AREAMOD_ROAD = new AreaModification(SAMPLE_POLYAREA_TYPE_ROAD);
|
public static readonly RcAreaModification SAMPLE_AREAMOD_ROAD = new RcAreaModification(SAMPLE_POLYAREA_TYPE_ROAD);
|
||||||
public static readonly AreaModification SAMPLE_AREAMOD_GRASS = new AreaModification(SAMPLE_POLYAREA_TYPE_GRASS);
|
public static readonly RcAreaModification SAMPLE_AREAMOD_GRASS = new RcAreaModification(SAMPLE_POLYAREA_TYPE_GRASS);
|
||||||
public static readonly AreaModification SAMPLE_AREAMOD_DOOR = new AreaModification(SAMPLE_POLYAREA_TYPE_DOOR);
|
public static readonly RcAreaModification SAMPLE_AREAMOD_DOOR = new RcAreaModification(SAMPLE_POLYAREA_TYPE_DOOR);
|
||||||
public static readonly AreaModification SAMPLE_AREAMOD_JUMP = new AreaModification(SAMPLE_POLYAREA_TYPE_JUMP);
|
public static readonly RcAreaModification SAMPLE_AREAMOD_JUMP = new RcAreaModification(SAMPLE_POLYAREA_TYPE_JUMP);
|
||||||
|
|
||||||
public static readonly ImmutableArray<AreaModification> Values = ImmutableArray.Create(
|
public static readonly ImmutableArray<RcAreaModification> Values = ImmutableArray.Create(
|
||||||
SAMPLE_AREAMOD_WALKABLE,
|
SAMPLE_AREAMOD_WALKABLE,
|
||||||
SAMPLE_AREAMOD_GROUND,
|
SAMPLE_AREAMOD_GROUND,
|
||||||
SAMPLE_AREAMOD_WATER,
|
SAMPLE_AREAMOD_WATER,
|
||||||
|
@ -53,7 +53,7 @@ namespace DotRecast.Recast.DemoTool.Builder
|
||||||
SAMPLE_AREAMOD_JUMP
|
SAMPLE_AREAMOD_JUMP
|
||||||
);
|
);
|
||||||
|
|
||||||
public static AreaModification OfValue(int value)
|
public static RcAreaModification OfValue(int value)
|
||||||
{
|
{
|
||||||
return Values.FirstOrDefault(x => x.Value == value) ?? SAMPLE_AREAMOD_GRASS;
|
return Values.FirstOrDefault(x => x.Value == value) ?? SAMPLE_AREAMOD_GRASS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace DotRecast.Recast.DemoTool.Geom
|
||||||
public readonly float[] normals;
|
public readonly float[] normals;
|
||||||
private readonly RcVec3f bmin;
|
private readonly RcVec3f bmin;
|
||||||
private readonly RcVec3f bmax;
|
private readonly RcVec3f bmax;
|
||||||
private readonly List<ConvexVolume> _convexVolumes = new List<ConvexVolume>();
|
private readonly List<RcConvexVolume> _convexVolumes = new List<RcConvexVolume>();
|
||||||
private readonly List<DemoOffMeshConnection> offMeshConnections = new List<DemoOffMeshConnection>();
|
private readonly List<DemoOffMeshConnection> offMeshConnections = new List<DemoOffMeshConnection>();
|
||||||
private readonly RcTriMesh _mesh;
|
private readonly RcTriMesh _mesh;
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ namespace DotRecast.Recast.DemoTool.Geom
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IList<ConvexVolume> ConvexVolumes()
|
public IList<RcConvexVolume> ConvexVolumes()
|
||||||
{
|
{
|
||||||
return _convexVolumes;
|
return _convexVolumes;
|
||||||
}
|
}
|
||||||
|
@ -210,9 +210,9 @@ namespace DotRecast.Recast.DemoTool.Geom
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void AddConvexVolume(float[] verts, float minh, float maxh, AreaModification areaMod)
|
public void AddConvexVolume(float[] verts, float minh, float maxh, RcAreaModification areaMod)
|
||||||
{
|
{
|
||||||
ConvexVolume volume = new ConvexVolume();
|
RcConvexVolume volume = new RcConvexVolume();
|
||||||
volume.verts = verts;
|
volume.verts = verts;
|
||||||
volume.hmin = minh;
|
volume.hmin = minh;
|
||||||
volume.hmax = maxh;
|
volume.hmax = maxh;
|
||||||
|
|
|
@ -23,13 +23,13 @@ namespace DotRecast.Recast.DemoTool.Tools
|
||||||
return _sample;
|
return _sample;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConvexVolume RemoveByPos(RcVec3f pos)
|
public RcConvexVolume RemoveByPos(RcVec3f pos)
|
||||||
{
|
{
|
||||||
var geom = _sample.GetInputGeom();
|
var geom = _sample.GetInputGeom();
|
||||||
|
|
||||||
// Delete
|
// Delete
|
||||||
int nearestIndex = -1;
|
int nearestIndex = -1;
|
||||||
IList<ConvexVolume> vols = geom.ConvexVolumes();
|
IList<RcConvexVolume> vols = geom.ConvexVolumes();
|
||||||
for (int i = 0; i < vols.Count; ++i)
|
for (int i = 0; i < vols.Count; ++i)
|
||||||
{
|
{
|
||||||
if (PolyUtils.PointInPoly(vols[i].verts, pos) && pos.y >= vols[i].hmin
|
if (PolyUtils.PointInPoly(vols[i].verts, pos) && pos.y >= vols[i].hmin
|
||||||
|
@ -48,7 +48,7 @@ namespace DotRecast.Recast.DemoTool.Tools
|
||||||
return removal;
|
return removal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Add(List<RcVec3f> pts, List<int> hull, AreaModification areaType, float boxDescent, float boxHeight, float polyOffset)
|
public void Add(List<RcVec3f> pts, List<int> hull, RcAreaModification areaType, float boxDescent, float boxHeight, float polyOffset)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
if (hull.Count <= 2)
|
if (hull.Count <= 2)
|
||||||
|
|
|
@ -22,6 +22,6 @@ namespace DotRecast.Recast.Geom
|
||||||
{
|
{
|
||||||
public interface IConvexVolumeProvider
|
public interface IConvexVolumeProvider
|
||||||
{
|
{
|
||||||
IList<ConvexVolume> ConvexVolumes();
|
IList<RcConvexVolume> ConvexVolumes();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -32,7 +32,7 @@ namespace DotRecast.Recast.Geom
|
||||||
public readonly float[] normals;
|
public readonly float[] normals;
|
||||||
private RcVec3f bmin;
|
private RcVec3f bmin;
|
||||||
private RcVec3f bmax;
|
private RcVec3f bmax;
|
||||||
private readonly List<ConvexVolume> volumes = new List<ConvexVolume>();
|
private readonly List<RcConvexVolume> volumes = new List<RcConvexVolume>();
|
||||||
private readonly RcTriMesh _mesh;
|
private readonly RcTriMesh _mesh;
|
||||||
|
|
||||||
public SimpleInputGeomProvider(List<float> vertexPositions, List<int> meshFaces)
|
public SimpleInputGeomProvider(List<float> vertexPositions, List<int> meshFaces)
|
||||||
|
@ -91,14 +91,14 @@ namespace DotRecast.Recast.Geom
|
||||||
return bmax;
|
return bmax;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IList<ConvexVolume> ConvexVolumes()
|
public IList<RcConvexVolume> ConvexVolumes()
|
||||||
{
|
{
|
||||||
return volumes;
|
return volumes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddConvexVolume(float[] verts, float minh, float maxh, AreaModification areaMod)
|
public void AddConvexVolume(float[] verts, float minh, float maxh, RcAreaModification areaMod)
|
||||||
{
|
{
|
||||||
ConvexVolume vol = new ConvexVolume();
|
RcConvexVolume vol = new RcConvexVolume();
|
||||||
vol.hmin = minh;
|
vol.hmin = minh;
|
||||||
vol.hmax = maxh;
|
vol.hmax = maxh;
|
||||||
vol.verts = verts;
|
vol.verts = verts;
|
||||||
|
|
|
@ -59,9 +59,9 @@ namespace DotRecast.Recast.Geom
|
||||||
return ImmutableArray.Create(_mesh);
|
return ImmutableArray.Create(_mesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IList<ConvexVolume> ConvexVolumes()
|
public IList<RcConvexVolume> ConvexVolumes()
|
||||||
{
|
{
|
||||||
return ImmutableArray<ConvexVolume>.Empty;
|
return ImmutableArray<RcConvexVolume>.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -20,7 +20,7 @@ freely, subject to the following restrictions:
|
||||||
|
|
||||||
namespace DotRecast.Recast
|
namespace DotRecast.Recast
|
||||||
{
|
{
|
||||||
public class AreaModification
|
public class RcAreaModification
|
||||||
{
|
{
|
||||||
public const int RC_AREA_FLAGS_MASK = 0x3F;
|
public const int RC_AREA_FLAGS_MASK = 0x3F;
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ namespace DotRecast.Recast
|
||||||
* @param value
|
* @param value
|
||||||
* The area id to apply. [Limit: <= #RC_AREA_FLAGS_MASK]
|
* The area id to apply. [Limit: <= #RC_AREA_FLAGS_MASK]
|
||||||
*/
|
*/
|
||||||
public AreaModification(int value)
|
public RcAreaModification(int value)
|
||||||
{
|
{
|
||||||
this.Value = value;
|
this.Value = value;
|
||||||
Mask = RC_AREA_FLAGS_MASK;
|
Mask = RC_AREA_FLAGS_MASK;
|
||||||
|
@ -46,13 +46,13 @@ namespace DotRecast.Recast
|
||||||
* @param mask
|
* @param mask
|
||||||
* Bitwise mask used when applying value. [Limit: <= #RC_AREA_FLAGS_MASK]
|
* Bitwise mask used when applying value. [Limit: <= #RC_AREA_FLAGS_MASK]
|
||||||
*/
|
*/
|
||||||
public AreaModification(int value, int mask)
|
public RcAreaModification(int value, int mask)
|
||||||
{
|
{
|
||||||
this.Value = value;
|
this.Value = value;
|
||||||
this.Mask = mask;
|
this.Mask = mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AreaModification(AreaModification other)
|
public RcAreaModification(RcAreaModification other)
|
||||||
{
|
{
|
||||||
Value = other.Value;
|
Value = other.Value;
|
||||||
Mask = other.Mask;
|
Mask = other.Mask;
|
|
@ -93,7 +93,7 @@ namespace DotRecast.Recast
|
||||||
**/
|
**/
|
||||||
public readonly float detailSampleMaxError;
|
public readonly float detailSampleMaxError;
|
||||||
|
|
||||||
public readonly AreaModification walkableAreaMod;
|
public readonly RcAreaModification walkableAreaMod;
|
||||||
public readonly bool filterLowHangingObstacles;
|
public readonly bool filterLowHangingObstacles;
|
||||||
public readonly bool filterLedgeSpans;
|
public readonly bool filterLedgeSpans;
|
||||||
public readonly bool filterWalkableLowHeightSpans;
|
public readonly bool filterWalkableLowHeightSpans;
|
||||||
|
@ -119,7 +119,7 @@ namespace DotRecast.Recast
|
||||||
public RcConfig(PartitionType partitionType, float cellSize, float cellHeight, float agentHeight, float agentRadius,
|
public RcConfig(PartitionType partitionType, float cellSize, float cellHeight, float agentHeight, float agentRadius,
|
||||||
float agentMaxClimb, float agentMaxSlope, int regionMinSize, int regionMergeSize, float edgeMaxLen,
|
float agentMaxClimb, float agentMaxSlope, int regionMinSize, int regionMergeSize, float edgeMaxLen,
|
||||||
float edgeMaxError, int vertsPerPoly, float detailSampleDist, float detailSampleMaxError,
|
float edgeMaxError, int vertsPerPoly, float detailSampleDist, float detailSampleMaxError,
|
||||||
AreaModification walkableAreaMod) : this(partitionType, cellSize, cellHeight, agentMaxSlope, true, true, true, agentHeight, agentRadius, agentMaxClimb,
|
RcAreaModification walkableAreaMod) : this(partitionType, cellSize, cellHeight, agentMaxSlope, true, true, true, agentHeight, agentRadius, agentMaxClimb,
|
||||||
regionMinSize, regionMergeSize, edgeMaxLen, edgeMaxError, vertsPerPoly, detailSampleDist, detailSampleMaxError,
|
regionMinSize, regionMergeSize, edgeMaxLen, edgeMaxError, vertsPerPoly, detailSampleDist, detailSampleMaxError,
|
||||||
walkableAreaMod, true)
|
walkableAreaMod, true)
|
||||||
{
|
{
|
||||||
|
@ -131,7 +131,7 @@ namespace DotRecast.Recast
|
||||||
public RcConfig(PartitionType partitionType, float cellSize, float cellHeight, float agentMaxSlope,
|
public RcConfig(PartitionType partitionType, float cellSize, float cellHeight, float agentMaxSlope,
|
||||||
bool filterLowHangingObstacles, bool filterLedgeSpans, bool filterWalkableLowHeightSpans, float agentHeight,
|
bool filterLowHangingObstacles, bool filterLedgeSpans, bool filterWalkableLowHeightSpans, float agentHeight,
|
||||||
float agentRadius, float agentMaxClimb, int regionMinSize, int regionMergeSize, float edgeMaxLen, float edgeMaxError,
|
float agentRadius, float agentMaxClimb, int regionMinSize, int regionMergeSize, float edgeMaxLen, float edgeMaxError,
|
||||||
int vertsPerPoly, float detailSampleDist, float detailSampleMaxError, AreaModification walkableAreaMod,
|
int vertsPerPoly, float detailSampleDist, float detailSampleMaxError, RcAreaModification walkableAreaMod,
|
||||||
bool buildMeshDetail) : this(false, 0, 0, 0, partitionType, cellSize, cellHeight, agentMaxSlope, filterLowHangingObstacles, filterLedgeSpans,
|
bool buildMeshDetail) : this(false, 0, 0, 0, partitionType, cellSize, cellHeight, agentMaxSlope, filterLowHangingObstacles, filterLedgeSpans,
|
||||||
filterWalkableLowHeightSpans, agentHeight, agentRadius, agentMaxClimb,
|
filterWalkableLowHeightSpans, agentHeight, agentRadius, agentMaxClimb,
|
||||||
regionMinSize * regionMinSize * cellSize * cellSize, regionMergeSize * regionMergeSize * cellSize * cellSize,
|
regionMinSize * regionMinSize * cellSize * cellSize, regionMergeSize * regionMergeSize * cellSize * cellSize,
|
||||||
|
@ -144,7 +144,7 @@ namespace DotRecast.Recast
|
||||||
float cellSize, float cellHeight, float agentMaxSlope, bool filterLowHangingObstacles, bool filterLedgeSpans,
|
float cellSize, float cellHeight, float agentMaxSlope, bool filterLowHangingObstacles, bool filterLedgeSpans,
|
||||||
bool filterWalkableLowHeightSpans, float agentHeight, float agentRadius, float agentMaxClimb, float minRegionArea,
|
bool filterWalkableLowHeightSpans, float agentHeight, float agentRadius, float agentMaxClimb, float minRegionArea,
|
||||||
float mergeRegionArea, float edgeMaxLen, float edgeMaxError, int vertsPerPoly, bool buildMeshDetail,
|
float mergeRegionArea, float edgeMaxLen, float edgeMaxError, int vertsPerPoly, bool buildMeshDetail,
|
||||||
float detailSampleDist, float detailSampleMaxError, AreaModification walkableAreaMod)
|
float detailSampleDist, float detailSampleMaxError, RcAreaModification walkableAreaMod)
|
||||||
{
|
{
|
||||||
this.useTiles = useTiles;
|
this.useTiles = useTiles;
|
||||||
this.tileSizeX = tileSizeX;
|
this.tileSizeX = tileSizeX;
|
||||||
|
|
|
@ -20,11 +20,11 @@ freely, subject to the following restrictions:
|
||||||
|
|
||||||
namespace DotRecast.Recast
|
namespace DotRecast.Recast
|
||||||
{
|
{
|
||||||
public class ConvexVolume
|
public class RcConvexVolume
|
||||||
{
|
{
|
||||||
public float[] verts;
|
public float[] verts;
|
||||||
public float hmin;
|
public float hmin;
|
||||||
public float hmax;
|
public float hmax;
|
||||||
public AreaModification areaMod;
|
public RcAreaModification areaMod;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -67,7 +67,7 @@ namespace DotRecast.Recast
|
||||||
/// See the #rcConfig documentation for more information on the configuration parameters.
|
/// See the #rcConfig documentation for more information on the configuration parameters.
|
||||||
///
|
///
|
||||||
/// @see rcHeightfield, rcClearUnwalkableTriangles, rcRasterizeTriangles
|
/// @see rcHeightfield, rcClearUnwalkableTriangles, rcRasterizeTriangles
|
||||||
public static int[] MarkWalkableTriangles(RcTelemetry ctx, float walkableSlopeAngle, float[] verts, int[] tris, int nt, AreaModification areaMod)
|
public static int[] MarkWalkableTriangles(RcTelemetry ctx, float walkableSlopeAngle, float[] verts, int[] tris, int nt, RcAreaModification areaMod)
|
||||||
{
|
{
|
||||||
int[] areas = new int[nt];
|
int[] areas = new int[nt];
|
||||||
float walkableThr = (float)Math.Cos(walkableSlopeAngle / 180.0f * Math.PI);
|
float walkableThr = (float)Math.Cos(walkableSlopeAngle / 180.0f * Math.PI);
|
||||||
|
|
|
@ -279,7 +279,7 @@ namespace DotRecast.Recast
|
||||||
/// The value of spacial parameters are in world units.
|
/// The value of spacial parameters are in world units.
|
||||||
///
|
///
|
||||||
/// @see rcCompactHeightfield, rcMedianFilterWalkableArea
|
/// @see rcCompactHeightfield, rcMedianFilterWalkableArea
|
||||||
public static void MarkBoxArea(RcTelemetry ctx, float[] bmin, float[] bmax, AreaModification areaMod, RcCompactHeightfield chf)
|
public static void MarkBoxArea(RcTelemetry ctx, float[] bmin, float[] bmax, RcAreaModification areaMod, RcCompactHeightfield chf)
|
||||||
{
|
{
|
||||||
using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_MARK_BOX_AREA);
|
using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_MARK_BOX_AREA);
|
||||||
|
|
||||||
|
@ -351,7 +351,7 @@ namespace DotRecast.Recast
|
||||||
/// projected onto the xz-plane at @p hmin, then extruded to @p hmax.
|
/// projected onto the xz-plane at @p hmin, then extruded to @p hmax.
|
||||||
///
|
///
|
||||||
/// @see rcCompactHeightfield, rcMedianFilterWalkableArea
|
/// @see rcCompactHeightfield, rcMedianFilterWalkableArea
|
||||||
public static void MarkConvexPolyArea(RcTelemetry ctx, float[] verts, float hmin, float hmax, AreaModification areaMod,
|
public static void MarkConvexPolyArea(RcTelemetry ctx, float[] verts, float hmin, float hmax, RcAreaModification areaMod,
|
||||||
RcCompactHeightfield chf)
|
RcCompactHeightfield chf)
|
||||||
{
|
{
|
||||||
using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_MARK_CONVEXPOLY_AREA);
|
using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_MARK_CONVEXPOLY_AREA);
|
||||||
|
@ -427,7 +427,7 @@ namespace DotRecast.Recast
|
||||||
/// The value of spacial parameters are in world units.
|
/// The value of spacial parameters are in world units.
|
||||||
///
|
///
|
||||||
/// @see rcCompactHeightfield, rcMedianFilterWalkableArea
|
/// @see rcCompactHeightfield, rcMedianFilterWalkableArea
|
||||||
public static void MarkCylinderArea(RcTelemetry ctx, float[] pos, float r, float h, AreaModification areaMod, RcCompactHeightfield chf)
|
public static void MarkCylinderArea(RcTelemetry ctx, float[] pos, float r, float h, RcAreaModification areaMod, RcCompactHeightfield chf)
|
||||||
{
|
{
|
||||||
using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_MARK_CYLINDER_AREA);
|
using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_MARK_CYLINDER_AREA);
|
||||||
|
|
||||||
|
|
|
@ -294,7 +294,7 @@ namespace DotRecast.Recast
|
||||||
// (Optional) Mark areas.
|
// (Optional) Mark areas.
|
||||||
if (volumeProvider != null)
|
if (volumeProvider != null)
|
||||||
{
|
{
|
||||||
foreach (ConvexVolume vol in volumeProvider.ConvexVolumes())
|
foreach (RcConvexVolume vol in volumeProvider.ConvexVolumes())
|
||||||
{
|
{
|
||||||
RecastArea.MarkConvexPolyArea(ctx, vol.verts, vol.hmin, vol.hmax, vol.areaMod, chf);
|
RecastArea.MarkConvexPolyArea(ctx, vol.verts, vol.hmin, vol.hmax, vol.areaMod, chf);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,12 +30,12 @@ public class SampleAreaModifications
|
||||||
public const int SAMPLE_POLYAREA_TYPE_GRASS = 0x5;
|
public const int SAMPLE_POLYAREA_TYPE_GRASS = 0x5;
|
||||||
public const int SAMPLE_POLYAREA_TYPE_JUMP = 0x6;
|
public const int SAMPLE_POLYAREA_TYPE_JUMP = 0x6;
|
||||||
|
|
||||||
public static AreaModification SAMPLE_AREAMOD_GROUND = new AreaModification(SAMPLE_POLYAREA_TYPE_GROUND, SAMPLE_POLYAREA_TYPE_MASK);
|
public static RcAreaModification SAMPLE_AREAMOD_GROUND = new RcAreaModification(SAMPLE_POLYAREA_TYPE_GROUND, SAMPLE_POLYAREA_TYPE_MASK);
|
||||||
public static AreaModification SAMPLE_AREAMOD_WATER = new AreaModification(SAMPLE_POLYAREA_TYPE_WATER, SAMPLE_POLYAREA_TYPE_MASK);
|
public static RcAreaModification SAMPLE_AREAMOD_WATER = new RcAreaModification(SAMPLE_POLYAREA_TYPE_WATER, SAMPLE_POLYAREA_TYPE_MASK);
|
||||||
public static AreaModification SAMPLE_AREAMOD_ROAD = new AreaModification(SAMPLE_POLYAREA_TYPE_ROAD, SAMPLE_POLYAREA_TYPE_MASK);
|
public static RcAreaModification SAMPLE_AREAMOD_ROAD = new RcAreaModification(SAMPLE_POLYAREA_TYPE_ROAD, SAMPLE_POLYAREA_TYPE_MASK);
|
||||||
public static AreaModification SAMPLE_AREAMOD_GRASS = new AreaModification(SAMPLE_POLYAREA_TYPE_GRASS, SAMPLE_POLYAREA_TYPE_MASK);
|
public static RcAreaModification SAMPLE_AREAMOD_GRASS = new RcAreaModification(SAMPLE_POLYAREA_TYPE_GRASS, SAMPLE_POLYAREA_TYPE_MASK);
|
||||||
public static AreaModification SAMPLE_AREAMOD_DOOR = new AreaModification(SAMPLE_POLYAREA_TYPE_DOOR, SAMPLE_POLYAREA_TYPE_DOOR);
|
public static RcAreaModification SAMPLE_AREAMOD_DOOR = new RcAreaModification(SAMPLE_POLYAREA_TYPE_DOOR, SAMPLE_POLYAREA_TYPE_DOOR);
|
||||||
public static AreaModification SAMPLE_AREAMOD_JUMP = new AreaModification(SAMPLE_POLYAREA_TYPE_JUMP, SAMPLE_POLYAREA_TYPE_JUMP);
|
public static RcAreaModification SAMPLE_AREAMOD_JUMP = new RcAreaModification(SAMPLE_POLYAREA_TYPE_JUMP, SAMPLE_POLYAREA_TYPE_JUMP);
|
||||||
|
|
||||||
public const int SAMPLE_POLYFLAGS_WALK = 0x01; // Ability to walk (ground, grass, road)
|
public const int SAMPLE_POLYFLAGS_WALK = 0x01; // Ability to walk (ground, grass, road)
|
||||||
public const int SAMPLE_POLYFLAGS_SWIM = 0x02; // Ability to swim (water).
|
public const int SAMPLE_POLYFLAGS_SWIM = 0x02; // Ability to swim (water).
|
||||||
|
|
|
@ -30,22 +30,22 @@ public class SampleAreaModifications
|
||||||
public const int SAMPLE_POLYAREA_TYPE_GRASS = 0x5;
|
public const int SAMPLE_POLYAREA_TYPE_GRASS = 0x5;
|
||||||
public const int SAMPLE_POLYAREA_TYPE_JUMP = 0x6;
|
public const int SAMPLE_POLYAREA_TYPE_JUMP = 0x6;
|
||||||
|
|
||||||
public static AreaModification SAMPLE_AREAMOD_GROUND = new AreaModification(SAMPLE_POLYAREA_TYPE_GROUND,
|
public static RcAreaModification SAMPLE_AREAMOD_GROUND = new RcAreaModification(SAMPLE_POLYAREA_TYPE_GROUND,
|
||||||
SAMPLE_POLYAREA_TYPE_MASK);
|
SAMPLE_POLYAREA_TYPE_MASK);
|
||||||
|
|
||||||
public static AreaModification SAMPLE_AREAMOD_WATER = new AreaModification(SAMPLE_POLYAREA_TYPE_WATER,
|
public static RcAreaModification SAMPLE_AREAMOD_WATER = new RcAreaModification(SAMPLE_POLYAREA_TYPE_WATER,
|
||||||
SAMPLE_POLYAREA_TYPE_MASK);
|
SAMPLE_POLYAREA_TYPE_MASK);
|
||||||
|
|
||||||
public static AreaModification SAMPLE_AREAMOD_ROAD = new AreaModification(SAMPLE_POLYAREA_TYPE_ROAD,
|
public static RcAreaModification SAMPLE_AREAMOD_ROAD = new RcAreaModification(SAMPLE_POLYAREA_TYPE_ROAD,
|
||||||
SAMPLE_POLYAREA_TYPE_MASK);
|
SAMPLE_POLYAREA_TYPE_MASK);
|
||||||
|
|
||||||
public static AreaModification SAMPLE_AREAMOD_GRASS = new AreaModification(SAMPLE_POLYAREA_TYPE_GRASS,
|
public static RcAreaModification SAMPLE_AREAMOD_GRASS = new RcAreaModification(SAMPLE_POLYAREA_TYPE_GRASS,
|
||||||
SAMPLE_POLYAREA_TYPE_MASK);
|
SAMPLE_POLYAREA_TYPE_MASK);
|
||||||
|
|
||||||
public static AreaModification SAMPLE_AREAMOD_DOOR = new AreaModification(SAMPLE_POLYAREA_TYPE_DOOR,
|
public static RcAreaModification SAMPLE_AREAMOD_DOOR = new RcAreaModification(SAMPLE_POLYAREA_TYPE_DOOR,
|
||||||
SAMPLE_POLYAREA_TYPE_DOOR);
|
SAMPLE_POLYAREA_TYPE_DOOR);
|
||||||
|
|
||||||
public static AreaModification SAMPLE_AREAMOD_JUMP = new AreaModification(SAMPLE_POLYAREA_TYPE_JUMP,
|
public static RcAreaModification SAMPLE_AREAMOD_JUMP = new RcAreaModification(SAMPLE_POLYAREA_TYPE_JUMP,
|
||||||
SAMPLE_POLYAREA_TYPE_JUMP);
|
SAMPLE_POLYAREA_TYPE_JUMP);
|
||||||
|
|
||||||
public const int SAMPLE_POLYFLAGS_WALK = 0x01; // Ability to walk (ground, grass, road)
|
public const int SAMPLE_POLYFLAGS_WALK = 0x01; // Ability to walk (ground, grass, road)
|
||||||
|
|
|
@ -30,22 +30,22 @@ public class SampleAreaModifications
|
||||||
public const int SAMPLE_POLYAREA_TYPE_GRASS = 0x5;
|
public const int SAMPLE_POLYAREA_TYPE_GRASS = 0x5;
|
||||||
public const int SAMPLE_POLYAREA_TYPE_JUMP = 0x6;
|
public const int SAMPLE_POLYAREA_TYPE_JUMP = 0x6;
|
||||||
|
|
||||||
public static AreaModification SAMPLE_AREAMOD_GROUND = new AreaModification(SAMPLE_POLYAREA_TYPE_GROUND,
|
public static RcAreaModification SAMPLE_AREAMOD_GROUND = new RcAreaModification(SAMPLE_POLYAREA_TYPE_GROUND,
|
||||||
SAMPLE_POLYAREA_TYPE_MASK);
|
SAMPLE_POLYAREA_TYPE_MASK);
|
||||||
|
|
||||||
public static AreaModification SAMPLE_AREAMOD_WATER = new AreaModification(SAMPLE_POLYAREA_TYPE_WATER,
|
public static RcAreaModification SAMPLE_AREAMOD_WATER = new RcAreaModification(SAMPLE_POLYAREA_TYPE_WATER,
|
||||||
SAMPLE_POLYAREA_TYPE_MASK);
|
SAMPLE_POLYAREA_TYPE_MASK);
|
||||||
|
|
||||||
public static AreaModification SAMPLE_AREAMOD_ROAD = new AreaModification(SAMPLE_POLYAREA_TYPE_ROAD,
|
public static RcAreaModification SAMPLE_AREAMOD_ROAD = new RcAreaModification(SAMPLE_POLYAREA_TYPE_ROAD,
|
||||||
SAMPLE_POLYAREA_TYPE_MASK);
|
SAMPLE_POLYAREA_TYPE_MASK);
|
||||||
|
|
||||||
public static AreaModification SAMPLE_AREAMOD_GRASS = new AreaModification(SAMPLE_POLYAREA_TYPE_GRASS,
|
public static RcAreaModification SAMPLE_AREAMOD_GRASS = new RcAreaModification(SAMPLE_POLYAREA_TYPE_GRASS,
|
||||||
SAMPLE_POLYAREA_TYPE_MASK);
|
SAMPLE_POLYAREA_TYPE_MASK);
|
||||||
|
|
||||||
public static AreaModification SAMPLE_AREAMOD_DOOR = new AreaModification(SAMPLE_POLYAREA_TYPE_DOOR,
|
public static RcAreaModification SAMPLE_AREAMOD_DOOR = new RcAreaModification(SAMPLE_POLYAREA_TYPE_DOOR,
|
||||||
SAMPLE_POLYAREA_TYPE_DOOR);
|
SAMPLE_POLYAREA_TYPE_DOOR);
|
||||||
|
|
||||||
public static AreaModification SAMPLE_AREAMOD_JUMP = new AreaModification(SAMPLE_POLYAREA_TYPE_JUMP,
|
public static RcAreaModification SAMPLE_AREAMOD_JUMP = new RcAreaModification(SAMPLE_POLYAREA_TYPE_JUMP,
|
||||||
SAMPLE_POLYAREA_TYPE_JUMP);
|
SAMPLE_POLYAREA_TYPE_JUMP);
|
||||||
|
|
||||||
public const int SAMPLE_POLYFLAGS_WALK = 0x01; // Ability to walk (ground, grass, road)
|
public const int SAMPLE_POLYFLAGS_WALK = 0x01; // Ability to walk (ground, grass, road)
|
||||||
|
|
|
@ -44,21 +44,21 @@ public class SampleAreaModifications
|
||||||
/// Flag for jump area. Can be combined with area types and door flag.
|
/// Flag for jump area. Can be combined with area types and door flag.
|
||||||
public static int SAMPLE_POLYAREA_FLAG_JUMP = 0x10;
|
public static int SAMPLE_POLYAREA_FLAG_JUMP = 0x10;
|
||||||
|
|
||||||
public static AreaModification SAMPLE_AREAMOD_GROUND = new AreaModification(SAMPLE_POLYAREA_TYPE_GROUND,
|
public static RcAreaModification SAMPLE_AREAMOD_GROUND = new RcAreaModification(SAMPLE_POLYAREA_TYPE_GROUND,
|
||||||
SAMPLE_POLYAREA_TYPE_MASK);
|
SAMPLE_POLYAREA_TYPE_MASK);
|
||||||
|
|
||||||
public static AreaModification SAMPLE_AREAMOD_WATER = new AreaModification(SAMPLE_POLYAREA_TYPE_WATER,
|
public static RcAreaModification SAMPLE_AREAMOD_WATER = new RcAreaModification(SAMPLE_POLYAREA_TYPE_WATER,
|
||||||
SAMPLE_POLYAREA_TYPE_MASK);
|
SAMPLE_POLYAREA_TYPE_MASK);
|
||||||
|
|
||||||
public static AreaModification SAMPLE_AREAMOD_ROAD = new AreaModification(SAMPLE_POLYAREA_TYPE_ROAD,
|
public static RcAreaModification SAMPLE_AREAMOD_ROAD = new RcAreaModification(SAMPLE_POLYAREA_TYPE_ROAD,
|
||||||
SAMPLE_POLYAREA_TYPE_MASK);
|
SAMPLE_POLYAREA_TYPE_MASK);
|
||||||
|
|
||||||
public static AreaModification SAMPLE_AREAMOD_GRASS = new AreaModification(SAMPLE_POLYAREA_TYPE_GRASS,
|
public static RcAreaModification SAMPLE_AREAMOD_GRASS = new RcAreaModification(SAMPLE_POLYAREA_TYPE_GRASS,
|
||||||
SAMPLE_POLYAREA_TYPE_MASK);
|
SAMPLE_POLYAREA_TYPE_MASK);
|
||||||
|
|
||||||
public static AreaModification SAMPLE_AREAMOD_DOOR = new AreaModification(SAMPLE_POLYAREA_FLAG_DOOR,
|
public static RcAreaModification SAMPLE_AREAMOD_DOOR = new RcAreaModification(SAMPLE_POLYAREA_FLAG_DOOR,
|
||||||
SAMPLE_POLYAREA_FLAG_DOOR);
|
SAMPLE_POLYAREA_FLAG_DOOR);
|
||||||
|
|
||||||
public static AreaModification SAMPLE_AREAMOD_JUMP = new AreaModification(SAMPLE_POLYAREA_FLAG_JUMP,
|
public static RcAreaModification SAMPLE_AREAMOD_JUMP = new RcAreaModification(SAMPLE_POLYAREA_FLAG_JUMP,
|
||||||
SAMPLE_POLYAREA_FLAG_JUMP);
|
SAMPLE_POLYAREA_FLAG_JUMP);
|
||||||
}
|
}
|
|
@ -40,21 +40,21 @@ public class SampleAreaModifications
|
||||||
/// Flag for jump area. Can be combined with area types and door flag.
|
/// Flag for jump area. Can be combined with area types and door flag.
|
||||||
public const int SAMPLE_POLYAREA_FLAG_JUMP = 0x10;
|
public const int SAMPLE_POLYAREA_FLAG_JUMP = 0x10;
|
||||||
|
|
||||||
public static readonly AreaModification SAMPLE_AREAMOD_GROUND = new AreaModification(SAMPLE_POLYAREA_TYPE_GROUND,
|
public static readonly RcAreaModification SAMPLE_AREAMOD_GROUND = new RcAreaModification(SAMPLE_POLYAREA_TYPE_GROUND,
|
||||||
SAMPLE_POLYAREA_TYPE_MASK);
|
SAMPLE_POLYAREA_TYPE_MASK);
|
||||||
|
|
||||||
public static readonly AreaModification SAMPLE_AREAMOD_WATER = new AreaModification(SAMPLE_POLYAREA_TYPE_WATER,
|
public static readonly RcAreaModification SAMPLE_AREAMOD_WATER = new RcAreaModification(SAMPLE_POLYAREA_TYPE_WATER,
|
||||||
SAMPLE_POLYAREA_TYPE_MASK);
|
SAMPLE_POLYAREA_TYPE_MASK);
|
||||||
|
|
||||||
public static readonly AreaModification SAMPLE_AREAMOD_ROAD = new AreaModification(SAMPLE_POLYAREA_TYPE_ROAD,
|
public static readonly RcAreaModification SAMPLE_AREAMOD_ROAD = new RcAreaModification(SAMPLE_POLYAREA_TYPE_ROAD,
|
||||||
SAMPLE_POLYAREA_TYPE_MASK);
|
SAMPLE_POLYAREA_TYPE_MASK);
|
||||||
|
|
||||||
public static readonly AreaModification SAMPLE_AREAMOD_GRASS = new AreaModification(SAMPLE_POLYAREA_TYPE_GRASS,
|
public static readonly RcAreaModification SAMPLE_AREAMOD_GRASS = new RcAreaModification(SAMPLE_POLYAREA_TYPE_GRASS,
|
||||||
SAMPLE_POLYAREA_TYPE_MASK);
|
SAMPLE_POLYAREA_TYPE_MASK);
|
||||||
|
|
||||||
public static readonly AreaModification SAMPLE_AREAMOD_DOOR = new AreaModification(SAMPLE_POLYAREA_FLAG_DOOR,
|
public static readonly RcAreaModification SAMPLE_AREAMOD_DOOR = new RcAreaModification(SAMPLE_POLYAREA_FLAG_DOOR,
|
||||||
SAMPLE_POLYAREA_FLAG_DOOR);
|
SAMPLE_POLYAREA_FLAG_DOOR);
|
||||||
|
|
||||||
public static readonly AreaModification SAMPLE_AREAMOD_JUMP = new AreaModification(SAMPLE_POLYAREA_FLAG_JUMP,
|
public static readonly RcAreaModification SAMPLE_AREAMOD_JUMP = new RcAreaModification(SAMPLE_POLYAREA_FLAG_JUMP,
|
||||||
SAMPLE_POLYAREA_FLAG_JUMP);
|
SAMPLE_POLYAREA_FLAG_JUMP);
|
||||||
}
|
}
|
Loading…
Reference in New Issue