From 10bf4ce1648a7215c02d34629d074b4040beb122 Mon Sep 17 00:00:00 2001 From: ikpil Date: Thu, 4 Jan 2024 23:38:13 +0900 Subject: [PATCH] typo --- src/DotRecast.Recast/RcCompacts.cs | 2 +- src/DotRecast.Recast/RcConstants.cs | 8 ++++++-- src/DotRecast.Recast/RcFilledVolumeRasterization.cs | 4 ++-- src/DotRecast.Recast/RcFilters.cs | 10 +++++----- src/DotRecast.Recast/RcMeshDetails.cs | 2 +- src/DotRecast.Recast/RcRasterizations.cs | 4 ++-- 6 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/DotRecast.Recast/RcCompacts.cs b/src/DotRecast.Recast/RcCompacts.cs index fdb8eff..dccd456 100644 --- a/src/DotRecast.Recast/RcCompacts.cs +++ b/src/DotRecast.Recast/RcCompacts.cs @@ -31,7 +31,7 @@ namespace DotRecast.Recast public static class RcCompacts { private const int MAX_LAYERS = RC_NOT_CONNECTED - 1; - private const int MAX_HEIGHT = RcConstants.SPAN_MAX_HEIGHT; + private const int MAX_HEIGHT = RcConstants.RC_SPAN_MAX_HEIGHT; /// @} /// @name Compact Heightfield Functions diff --git a/src/DotRecast.Recast/RcConstants.cs b/src/DotRecast.Recast/RcConstants.cs index d3fd945..15c99f2 100644 --- a/src/DotRecast.Recast/RcConstants.cs +++ b/src/DotRecast.Recast/RcConstants.cs @@ -37,11 +37,15 @@ namespace DotRecast.Recast public const int RC_NOT_CONNECTED = 0x3f; /// Defines the number of bits allocated to rcSpan::smin and rcSpan::smax. - public const int SPAN_HEIGHT_BITS = 20; + public const int RC_SPAN_HEIGHT_BITS = 20; /// Defines the maximum value for rcSpan::smin and rcSpan::smax. - public const int SPAN_MAX_HEIGHT = (1 << SPAN_HEIGHT_BITS) - 1; + public const int RC_SPAN_MAX_HEIGHT = (1 << RC_SPAN_HEIGHT_BITS) - 1; + /// The number of spans allocated per span spool. + /// @see rcSpanPool + public const int RC_SPANS_PER_POOL = 2048; + /// Heighfield border flag. /// If a heightfield region ID has this bit set, then the region is a border /// region and its spans are considered unwalkable. diff --git a/src/DotRecast.Recast/RcFilledVolumeRasterization.cs b/src/DotRecast.Recast/RcFilledVolumeRasterization.cs index ac0a2c4..4e0b222 100644 --- a/src/DotRecast.Recast/RcFilledVolumeRasterization.cs +++ b/src/DotRecast.Recast/RcFilledVolumeRasterization.cs @@ -221,8 +221,8 @@ namespace DotRecast.Recast int smax = (int)MathF.Ceiling((h[1] - hf.bmin.Y) * ich); if (smin != smax) { - int ismin = Math.Clamp(smin, 0, SPAN_MAX_HEIGHT); - int ismax = Math.Clamp(smax, ismin + 1, SPAN_MAX_HEIGHT); + int ismin = Math.Clamp(smin, 0, RC_SPAN_MAX_HEIGHT); + int ismax = Math.Clamp(smax, ismin + 1, RC_SPAN_MAX_HEIGHT); RcRasterizations.AddSpan(hf, x, z, ismin, ismax, area, flagMergeThr); } } diff --git a/src/DotRecast.Recast/RcFilters.cs b/src/DotRecast.Recast/RcFilters.cs index 7df99fd..09437ee 100644 --- a/src/DotRecast.Recast/RcFilters.cs +++ b/src/DotRecast.Recast/RcFilters.cs @@ -119,12 +119,12 @@ namespace DotRecast.Recast } int floor = (span.smax); - int ceiling = span.next != null ? span.next.smin : SPAN_MAX_HEIGHT; + int ceiling = span.next != null ? span.next.smin : RC_SPAN_MAX_HEIGHT; // The difference between this walkable area and the lowest neighbor walkable area. // This is the difference between the current span and all neighbor spans that have // enough space for an agent to move between, but not accounting at all for surface slope. - int lowestNeighborFloorDifference = SPAN_MAX_HEIGHT; + int lowestNeighborFloorDifference = RC_SPAN_MAX_HEIGHT; // Min and max height of accessible neighbours. int lowestTraversableNeighborFloor = span.smax; @@ -146,7 +146,7 @@ namespace DotRecast.Recast // The most we can step down to the neighbor is the walkableClimb distance. // Start with the area under the neighbor span - int neighborCeiling = neighborSpan != null ? neighborSpan.smin : SPAN_MAX_HEIGHT; + int neighborCeiling = neighborSpan != null ? neighborSpan.smin : RC_SPAN_MAX_HEIGHT; // Skip neightbour if the gap between the spans is too small. if (Math.Min(ceiling, neighborCeiling) - floor >= walkableHeight) @@ -159,7 +159,7 @@ namespace DotRecast.Recast for (; neighborSpan != null; neighborSpan = neighborSpan.next) { int neighborFloor = neighborSpan.smax; - neighborCeiling = neighborSpan.next != null ? neighborSpan.next.smin : SPAN_MAX_HEIGHT; + neighborCeiling = neighborSpan.next != null ? neighborSpan.next.smin : RC_SPAN_MAX_HEIGHT; // Only consider neighboring areas that have enough overlap to be potentially traversable. if (Math.Min(ceiling, neighborCeiling) - Math.Max(floor, neighborFloor) < walkableHeight) @@ -235,7 +235,7 @@ namespace DotRecast.Recast for (RcSpan span = heightfield.spans[x + z * xSize]; span != null; span = span.next) { int floor = (span.smax); - int ceiling = span.next != null ? span.next.smin : SPAN_MAX_HEIGHT; + int ceiling = span.next != null ? span.next.smin : RC_SPAN_MAX_HEIGHT; if ((ceiling - floor) < walkableHeight) { span.area = RC_NULL_AREA; diff --git a/src/DotRecast.Recast/RcMeshDetails.cs b/src/DotRecast.Recast/RcMeshDetails.cs index c1b183e..f83b160 100644 --- a/src/DotRecast.Recast/RcMeshDetails.cs +++ b/src/DotRecast.Recast/RcMeshDetails.cs @@ -35,7 +35,7 @@ namespace DotRecast.Recast public const int MAX_TRIS = 255; // Max tris for delaunay is 2n-2-k (n=num verts, k=num hull verts). public const int MAX_VERTS_PER_EDGE = 32; - public const int RC_UNSET_HEIGHT = RcConstants.SPAN_MAX_HEIGHT; + public const int RC_UNSET_HEIGHT = RcConstants.RC_SPAN_MAX_HEIGHT; public const int EV_UNDEF = -1; public const int EV_HULL = -2; diff --git a/src/DotRecast.Recast/RcRasterizations.cs b/src/DotRecast.Recast/RcRasterizations.cs index 8c2a864..2026cdf 100644 --- a/src/DotRecast.Recast/RcRasterizations.cs +++ b/src/DotRecast.Recast/RcRasterizations.cs @@ -343,8 +343,8 @@ namespace DotRecast.Recast spanMax = by; // Snap the span to the heightfield height grid. - int spanMinCellIndex = Math.Clamp((int)MathF.Floor(spanMin * inverseCellHeight), 0, SPAN_MAX_HEIGHT); - int spanMaxCellIndex = Math.Clamp((int)MathF.Ceiling(spanMax * inverseCellHeight), spanMinCellIndex + 1, SPAN_MAX_HEIGHT); + int spanMinCellIndex = Math.Clamp((int)MathF.Floor(spanMin * inverseCellHeight), 0, RC_SPAN_MAX_HEIGHT); + int spanMaxCellIndex = Math.Clamp((int)MathF.Ceiling(spanMax * inverseCellHeight), spanMinCellIndex + 1, RC_SPAN_MAX_HEIGHT); AddSpan(heightfield, x, z, spanMinCellIndex, spanMaxCellIndex, area, flagMergeThreshold); }