forked from bit/DotRecastNetSim
refactor: revert this part due to a mix of C# and C++ style in array and interface usage
This commit is contained in:
parent
99cbba7586
commit
2245f70fcf
|
@ -61,9 +61,9 @@ namespace DotRecast.Recast.Toolset.Builder
|
||||||
|
|
||||||
public static RcAreaModification OfValue(int value)
|
public static RcAreaModification OfValue(int value)
|
||||||
{
|
{
|
||||||
foreach(var v in Values)
|
foreach (var v in Values)
|
||||||
{
|
{
|
||||||
if(v.Value == value)
|
if (v.Value == value)
|
||||||
{
|
{
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ namespace DotRecast.Recast
|
||||||
/// @param[in] span The span to update.
|
/// @param[in] span The span to update.
|
||||||
/// @param[in] direction The direction to set. [Limits: 0 <= value < 4]
|
/// @param[in] direction The direction to set. [Limits: 0 <= value < 4]
|
||||||
/// @param[in] neighborIndex The index of the neighbor span.
|
/// @param[in] neighborIndex The index of the neighbor span.
|
||||||
public static void SetCon(ref RcCompactSpan span, int direction, int neighborIndex)
|
public static void SetCon(RcCompactSpan span, int direction, int neighborIndex)
|
||||||
{
|
{
|
||||||
int shift = direction * 6;
|
int shift = direction * 6;
|
||||||
int con = span.con;
|
int con = span.con;
|
||||||
|
|
|
@ -21,7 +21,7 @@ freely, subject to the following restrictions:
|
||||||
namespace DotRecast.Recast
|
namespace DotRecast.Recast
|
||||||
{
|
{
|
||||||
/** Represents a span of unobstructed space within a compact heightfield. */
|
/** Represents a span of unobstructed space within a compact heightfield. */
|
||||||
public struct RcCompactSpan
|
public class RcCompactSpan
|
||||||
{
|
{
|
||||||
/** The lower extent of the span. (Measured from the heightfield's base.) */
|
/** The lower extent of the span. (Measured from the heightfield's base.) */
|
||||||
public int y;
|
public int y;
|
||||||
|
|
|
@ -115,11 +115,11 @@ namespace DotRecast.Recast
|
||||||
RcCompactCell c = chf.cells[x + y * w];
|
RcCompactCell c = chf.cells[x + y * w];
|
||||||
for (int i = c.index, ni = c.index + c.count; i < ni; ++i)
|
for (int i = c.index, ni = c.index + c.count; i < ni; ++i)
|
||||||
{
|
{
|
||||||
ref RcCompactSpan s = ref chf.spans[i];
|
RcCompactSpan s = chf.spans[i];
|
||||||
|
|
||||||
for (int dir = 0; dir < 4; ++dir)
|
for (int dir = 0; dir < 4; ++dir)
|
||||||
{
|
{
|
||||||
SetCon(ref s, dir, RC_NOT_CONNECTED);
|
SetCon(s, dir, RC_NOT_CONNECTED);
|
||||||
int nx = x + GetDirOffsetX(dir);
|
int nx = x + GetDirOffsetX(dir);
|
||||||
int ny = y + GetDirOffsetY(dir);
|
int ny = y + GetDirOffsetY(dir);
|
||||||
// First check that the neighbour cell is in bounds.
|
// First check that the neighbour cell is in bounds.
|
||||||
|
@ -131,7 +131,7 @@ namespace DotRecast.Recast
|
||||||
RcCompactCell nc = chf.cells[nx + ny * w];
|
RcCompactCell nc = chf.cells[nx + ny * w];
|
||||||
for (int k = nc.index, nk = nc.index + nc.count; k < nk; ++k)
|
for (int k = nc.index, nk = nc.index + nc.count; k < nk; ++k)
|
||||||
{
|
{
|
||||||
ref RcCompactSpan ns = ref chf.spans[k];
|
RcCompactSpan ns = chf.spans[k];
|
||||||
int bot = Math.Max(s.y, ns.y);
|
int bot = Math.Max(s.y, ns.y);
|
||||||
int top = Math.Min(s.y + s.h, ns.y + ns.h);
|
int top = Math.Min(s.y + s.h, ns.y + ns.h);
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ namespace DotRecast.Recast
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetCon(ref s, dir, lidx);
|
SetCon(s, dir, lidx);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,10 @@ namespace DotRecast.Recast
|
||||||
|
|
||||||
public static class RcLayers
|
public static class RcLayers
|
||||||
{
|
{
|
||||||
|
const int RC_MAX_LAYERS = RcConstants.RC_NOT_CONNECTED;
|
||||||
|
const int RC_MAX_NEIS = 16;
|
||||||
|
|
||||||
|
|
||||||
private static void AddUnique(List<int> a, int v)
|
private static void AddUnique(List<int> a, int v)
|
||||||
{
|
{
|
||||||
if (!a.Contains(v))
|
if (!a.Contains(v))
|
||||||
|
@ -59,6 +63,10 @@ namespace DotRecast.Recast
|
||||||
Array.Fill(srcReg, 0xFF);
|
Array.Fill(srcReg, 0xFF);
|
||||||
int nsweeps = chf.width; // Math.Max(chf.width, chf.height);
|
int nsweeps = chf.width; // Math.Max(chf.width, chf.height);
|
||||||
RcSweepSpan[] sweeps = new RcSweepSpan[nsweeps];
|
RcSweepSpan[] sweeps = new RcSweepSpan[nsweeps];
|
||||||
|
for (int i = 0; i < sweeps.Length; i++)
|
||||||
|
{
|
||||||
|
sweeps[i] = new RcSweepSpan();
|
||||||
|
}
|
||||||
|
|
||||||
// Partition walkable area into monotone regions.
|
// Partition walkable area into monotone regions.
|
||||||
int[] prevCount = new int[256];
|
int[] prevCount = new int[256];
|
||||||
|
@ -297,7 +305,7 @@ namespace DotRecast.Recast
|
||||||
|
|
||||||
int newId = ri.layerId;
|
int newId = ri.layerId;
|
||||||
|
|
||||||
while (true)
|
for (;;)
|
||||||
{
|
{
|
||||||
int oldId = 0xff;
|
int oldId = 0xff;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
namespace DotRecast.Recast
|
namespace DotRecast.Recast
|
||||||
{
|
{
|
||||||
public struct RcSweepSpan
|
public class RcSweepSpan
|
||||||
{
|
{
|
||||||
public int rid; // row id
|
public int rid; // row id
|
||||||
public int id; // region id
|
public int id; // region id
|
||||||
|
|
Loading…
Reference in New Issue