diff --git a/src/DotRecast.Recast/RcBuildContoursFlags.cs b/src/DotRecast.Recast/RcBuildContoursFlags.cs new file mode 100644 index 0000000..adcdc37 --- /dev/null +++ b/src/DotRecast.Recast/RcBuildContoursFlags.cs @@ -0,0 +1,10 @@ +namespace DotRecast.Recast +{ + /// Contour build flags. + /// @see rcBuildContours + public static class RcBuildContoursFlags + { + public const int RC_CONTOUR_TESS_WALL_EDGES = 0x01; //< Tessellate solid (impassable) edges during contour simplification. + public const int RC_CONTOUR_TESS_AREA_EDGES = 0x02; //< Tessellate edges between areas during contour simplification. + } +} \ No newline at end of file diff --git a/src/DotRecast.Recast/RcBuilder.cs b/src/DotRecast.Recast/RcBuilder.cs index e2bd465..e66f831 100644 --- a/src/DotRecast.Recast/RcBuilder.cs +++ b/src/DotRecast.Recast/RcBuilder.cs @@ -237,7 +237,7 @@ namespace DotRecast.Recast // // Create contours. - RcContourSet cset = RcContours.BuildContours(ctx, chf, cfg.MaxSimplificationError, cfg.MaxEdgeLen, RcConstants.RC_CONTOUR_TESS_WALL_EDGES); + RcContourSet cset = RcContours.BuildContours(ctx, chf, cfg.MaxSimplificationError, cfg.MaxEdgeLen, RcBuildContoursFlags.RC_CONTOUR_TESS_WALL_EDGES); // // Step 6. Build polygons mesh from contours. diff --git a/src/DotRecast.Recast/RcConstants.cs b/src/DotRecast.Recast/RcConstants.cs index aebf84c..d3fd945 100644 --- a/src/DotRecast.Recast/RcConstants.cs +++ b/src/DotRecast.Recast/RcConstants.cs @@ -84,13 +84,6 @@ namespace DotRecast.Recast /// @see rcPolyMesh::polys public const int RC_MESH_NULL_IDX = 0xffff; - public const int RC_CONTOUR_TESS_WALL_EDGES = 0x01; - - /// < Tessellate solid (impassable) edges during contour - /// simplification. - public const int RC_CONTOUR_TESS_AREA_EDGES = 0x02; - - public const int RC_LOG_WARNING = 1; } } \ No newline at end of file diff --git a/src/DotRecast.Recast/RcContours.cs b/src/DotRecast.Recast/RcContours.cs index 0c7887b..5fc2584 100644 --- a/src/DotRecast.Recast/RcContours.cs +++ b/src/DotRecast.Recast/RcContours.cs @@ -374,7 +374,7 @@ namespace DotRecast.Recast } // Split too long edges. - if (maxEdgeLen > 0 && (buildFlags & (RC_CONTOUR_TESS_WALL_EDGES | RC_CONTOUR_TESS_AREA_EDGES)) != 0) + if (maxEdgeLen > 0 && (buildFlags & (RcBuildContoursFlags.RC_CONTOUR_TESS_WALL_EDGES | RcBuildContoursFlags.RC_CONTOUR_TESS_AREA_EDGES)) != 0) { for (int i = 0; i < simplified.Count / 4;) { @@ -395,11 +395,16 @@ namespace DotRecast.Recast // Tessellate only outer edges or edges between areas. bool tess = false; // Wall edges. - if ((buildFlags & RC_CONTOUR_TESS_WALL_EDGES) != 0 && (points[ci * 4 + 3] & RC_CONTOUR_REG_MASK) == 0) + if ((buildFlags & RcBuildContoursFlags.RC_CONTOUR_TESS_WALL_EDGES) != 0 && (points[ci * 4 + 3] & RC_CONTOUR_REG_MASK) == 0) + { tess = true; + } + // Edges between areas. - if ((buildFlags & RC_CONTOUR_TESS_AREA_EDGES) != 0 && (points[ci * 4 + 3] & RC_AREA_BORDER) != 0) + if ((buildFlags & RcBuildContoursFlags.RC_CONTOUR_TESS_AREA_EDGES) != 0 && (points[ci * 4 + 3] & RC_AREA_BORDER) != 0) + { tess = true; + } if (tess) { diff --git a/test/DotRecast.Recast.Test/RecastSoloMeshTest.cs b/test/DotRecast.Recast.Test/RecastSoloMeshTest.cs index 0e9ac47..ffbbd22 100644 --- a/test/DotRecast.Recast.Test/RecastSoloMeshTest.cs +++ b/test/DotRecast.Recast.Test/RecastSoloMeshTest.cs @@ -239,8 +239,7 @@ public class RecastSoloMeshTest // // Create contours. - RcContourSet m_cset = RcContours.BuildContours(m_ctx, m_chf, cfg.MaxSimplificationError, cfg.MaxEdgeLen, - RcConstants.RC_CONTOUR_TESS_WALL_EDGES); + RcContourSet m_cset = RcContours.BuildContours(m_ctx, m_chf, cfg.MaxSimplificationError, cfg.MaxEdgeLen, RcBuildContoursFlags.RC_CONTOUR_TESS_WALL_EDGES); Assert.That(m_cset.conts.Count, Is.EqualTo(expContours), "Contours"); //