remove CornerHeight class

This commit is contained in:
ikpil 2023-07-11 23:06:22 +09:00
parent c604ff1ac5
commit 43cf1c12ba
2 changed files with 7 additions and 21 deletions

View File

@ -1,14 +0,0 @@
namespace DotRecast.Recast
{
public class CornerHeight
{
public readonly int height;
public readonly bool borderVertex;
public CornerHeight(int height, bool borderVertex)
{
this.height = height;
this.borderVertex = borderVertex;
}
}
}

View File

@ -28,9 +28,10 @@ namespace DotRecast.Recast
public static class RecastContour public static class RecastContour
{ {
private static CornerHeight GetCornerHeight(int x, int y, int i, int dir, RcCompactHeightfield chf) private static int GetCornerHeight(int x, int y, int i, int dir, RcCompactHeightfield chf, out bool isBorderVertex)
{ {
bool isBorderVertex = false; isBorderVertex = false;
RcCompactSpan s = chf.spans[i]; RcCompactSpan s = chf.spans[i];
int ch = s.y; int ch = s.y;
int dirp = (dir + 1) & 0x3; int dirp = (dir + 1) & 0x3;
@ -103,7 +104,7 @@ namespace DotRecast.Recast
} }
} }
return new CornerHeight(ch, isBorderVertex); return ch;
} }
private static void WalkContour(int x, int y, int i, RcCompactHeightfield chf, int[] flags, List<int> points) private static void WalkContour(int x, int y, int i, RcCompactHeightfield chf, int[] flags, List<int> points)
@ -124,11 +125,10 @@ namespace DotRecast.Recast
if ((flags[i] & (1 << dir)) != 0) if ((flags[i] & (1 << dir)) != 0)
{ {
// Choose the edge corner // Choose the edge corner
bool isBorderVertex = false;
bool isAreaBorder = false; bool isAreaBorder = false;
CornerHeight cornerHeight = GetCornerHeight(x, y, i, dir, chf);
bool isBorderVertex = cornerHeight.borderVertex;
int px = x; int px = x;
int py = cornerHeight.height; int py = GetCornerHeight(x, y, i, dir, chf, out isBorderVertex);
int pz = y; int pz = y;
switch (dir) switch (dir)
{ {