From 43cf1c12ba3cbd3bc38895f0396e7089338f08a9 Mon Sep 17 00:00:00 2001 From: ikpil Date: Tue, 11 Jul 2023 23:06:22 +0900 Subject: [PATCH] remove CornerHeight class --- src/DotRecast.Recast/CornerHeight.cs | 14 -------------- src/DotRecast.Recast/RecastContour.cs | 14 +++++++------- 2 files changed, 7 insertions(+), 21 deletions(-) delete mode 100644 src/DotRecast.Recast/CornerHeight.cs diff --git a/src/DotRecast.Recast/CornerHeight.cs b/src/DotRecast.Recast/CornerHeight.cs deleted file mode 100644 index 6e57718..0000000 --- a/src/DotRecast.Recast/CornerHeight.cs +++ /dev/null @@ -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; - } - } -} \ No newline at end of file diff --git a/src/DotRecast.Recast/RecastContour.cs b/src/DotRecast.Recast/RecastContour.cs index 1271e22..92d090f 100644 --- a/src/DotRecast.Recast/RecastContour.cs +++ b/src/DotRecast.Recast/RecastContour.cs @@ -28,9 +28,10 @@ namespace DotRecast.Recast 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]; int ch = s.y; 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 points) @@ -124,11 +125,10 @@ namespace DotRecast.Recast if ((flags[i] & (1 << dir)) != 0) { // Choose the edge corner + bool isBorderVertex = false; bool isAreaBorder = false; - CornerHeight cornerHeight = GetCornerHeight(x, y, i, dir, chf); - bool isBorderVertex = cornerHeight.borderVertex; int px = x; - int py = cornerHeight.height; + int py = GetCornerHeight(x, y, i, dir, chf, out isBorderVertex); int pz = y; switch (dir) { @@ -723,7 +723,7 @@ namespace DotRecast.Recast RcContourSet cset = new RcContourSet(); using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_BUILD_CONTOURS); - + cset.bmin = chf.bmin; cset.bmax = chf.bmax; if (borderSize > 0)