rename RcTelemetry to RcContext

This commit is contained in:
ikpil 2024-01-07 12:59:33 +09:00 committed by Ikpil
parent 648d7bd703
commit 2edabd3d44
28 changed files with 97 additions and 84 deletions

View File

@ -25,12 +25,25 @@ using System.Threading;
namespace DotRecast.Core namespace DotRecast.Core
{ {
public class RcTelemetry /// Provides an interface for optional logging and performance tracking of the Recast
/// build process.
///
/// This class does not provide logging or timer functionality on its
/// own. Both must be provided by a concrete implementation
/// by overriding the protected member functions. Also, this class does not
/// provide an interface for extracting log messages. (Only adding them.)
/// So concrete implementations must provide one.
///
/// If no logging or timers are required, just pass an instance of this
/// class through the Recast build process.
///
/// @ingroup recast
public class RcContext
{ {
private readonly ThreadLocal<Dictionary<string, RcAtomicLong>> _timerStart; private readonly ThreadLocal<Dictionary<string, RcAtomicLong>> _timerStart;
private readonly ConcurrentDictionary<string, RcAtomicLong> _timerAccum; private readonly ConcurrentDictionary<string, RcAtomicLong> _timerAccum;
public RcTelemetry() public RcContext()
{ {
_timerStart = new ThreadLocal<Dictionary<string, RcAtomicLong>>(() => new Dictionary<string, RcAtomicLong>()); _timerStart = new ThreadLocal<Dictionary<string, RcAtomicLong>>(() => new Dictionary<string, RcAtomicLong>());
_timerAccum = new ConcurrentDictionary<string, RcAtomicLong>(); _timerAccum = new ConcurrentDictionary<string, RcAtomicLong>();
@ -41,7 +54,7 @@ namespace DotRecast.Core
StartTimer(label); StartTimer(label);
return new RcAnonymousDisposable(() => StopTimer(label)); return new RcAnonymousDisposable(() => StopTimer(label));
} }
public void StartTimer(RcTimerLabel label) public void StartTimer(RcTimerLabel label)
{ {
_timerStart.Value[label.Name] = new RcAtomicLong(RcFrequency.Ticks); _timerStart.Value[label.Name] = new RcAtomicLong(RcFrequency.Ticks);

View File

@ -62,10 +62,10 @@ namespace DotRecast.Detour.Dynamic.Colliders
return bounds; return bounds;
} }
public override void Rasterize(RcHeightfield hf, RcTelemetry telemetry) public override void Rasterize(RcHeightfield hf, RcContext context)
{ {
RcFilledVolumeRasterization.RasterizeBox( RcFilledVolumeRasterization.RasterizeBox(
hf, center, halfEdges, area, (int)MathF.Floor(flagMergeThreshold / hf.ch), telemetry); hf, center, halfEdges, area, (int)MathF.Floor(flagMergeThreshold / hf.ch), context);
} }
public static RcVec3f[] GetHalfEdges(RcVec3f up, RcVec3f forward, RcVec3f extent) public static RcVec3f[] GetHalfEdges(RcVec3f up, RcVec3f forward, RcVec3f extent)

View File

@ -38,9 +38,9 @@ namespace DotRecast.Detour.Dynamic.Colliders
this.radius = radius; this.radius = radius;
} }
public override void Rasterize(RcHeightfield hf, RcTelemetry telemetry) public override void Rasterize(RcHeightfield hf, RcContext context)
{ {
RcFilledVolumeRasterization.RasterizeCapsule(hf, start, end, radius, area, (int)MathF.Floor(flagMergeThreshold / hf.ch), telemetry); RcFilledVolumeRasterization.RasterizeCapsule(hf, start, end, radius, area, (int)MathF.Floor(flagMergeThreshold / hf.ch), context);
} }
private static float[] Bounds(RcVec3f start, RcVec3f end, float radius) private static float[] Bounds(RcVec3f start, RcVec3f end, float radius)

View File

@ -40,6 +40,6 @@ namespace DotRecast.Detour.Dynamic.Colliders
return _bounds; return _bounds;
} }
public abstract void Rasterize(RcHeightfield hf, RcTelemetry telemetry); public abstract void Rasterize(RcHeightfield hf, RcContext context);
} }
} }

View File

@ -68,10 +68,10 @@ namespace DotRecast.Detour.Dynamic.Colliders
return bounds; return bounds;
} }
public void Rasterize(RcHeightfield hf, RcTelemetry telemetry) public void Rasterize(RcHeightfield hf, RcContext context)
{ {
foreach (var c in colliders) foreach (var c in colliders)
c.Rasterize(hf, telemetry); c.Rasterize(hf, context);
} }
} }
} }

View File

@ -42,10 +42,10 @@ namespace DotRecast.Detour.Dynamic.Colliders
this.triangles = triangles; this.triangles = triangles;
} }
public override void Rasterize(RcHeightfield hf, RcTelemetry telemetry) public override void Rasterize(RcHeightfield hf, RcContext context)
{ {
RcFilledVolumeRasterization.RasterizeConvex(hf, vertices, triangles, area, RcFilledVolumeRasterization.RasterizeConvex(hf, vertices, triangles, area,
(int)MathF.Floor(flagMergeThreshold / hf.ch), telemetry); (int)MathF.Floor(flagMergeThreshold / hf.ch), context);
} }
} }
} }

View File

@ -38,10 +38,10 @@ namespace DotRecast.Detour.Dynamic.Colliders
this.radius = radius; this.radius = radius;
} }
public override void Rasterize(RcHeightfield hf, RcTelemetry telemetry) public override void Rasterize(RcHeightfield hf, RcContext context)
{ {
RcFilledVolumeRasterization.RasterizeCylinder(hf, start, end, radius, area, (int)MathF.Floor(flagMergeThreshold / hf.ch), RcFilledVolumeRasterization.RasterizeCylinder(hf, start, end, radius, area, (int)MathF.Floor(flagMergeThreshold / hf.ch),
telemetry); context);
} }
private static float[] Bounds(RcVec3f start, RcVec3f end, float radius) private static float[] Bounds(RcVec3f start, RcVec3f end, float radius)

View File

@ -36,10 +36,10 @@ namespace DotRecast.Detour.Dynamic.Colliders
this.radius = radius; this.radius = radius;
} }
public override void Rasterize(RcHeightfield hf, RcTelemetry telemetry) public override void Rasterize(RcHeightfield hf, RcContext context)
{ {
RcFilledVolumeRasterization.RasterizeSphere(hf, center, radius, area, (int)MathF.Floor(flagMergeThreshold / hf.ch), RcFilledVolumeRasterization.RasterizeSphere(hf, center, radius, area, (int)MathF.Floor(flagMergeThreshold / hf.ch),
telemetry); context);
} }
private static float[] Bounds(RcVec3f center, float radius) private static float[] Bounds(RcVec3f center, float radius)

View File

@ -58,11 +58,11 @@ namespace DotRecast.Detour.Dynamic.Colliders
return bounds; return bounds;
} }
public override void Rasterize(RcHeightfield hf, RcTelemetry telemetry) public override void Rasterize(RcHeightfield hf, RcContext context)
{ {
for (int i = 0; i < triangles.Length; i += 3) for (int i = 0; i < triangles.Length; i += 3)
{ {
RcRasterizations.RasterizeTriangle(telemetry, vertices, triangles[i], triangles[i + 1], triangles[i + 2], area, RcRasterizations.RasterizeTriangle(context, vertices, triangles[i], triangles[i + 1], triangles[i + 2], area,
hf, (int)MathF.Floor(flagMergeThreshold / hf.ch)); hf, (int)MathF.Floor(flagMergeThreshold / hf.ch));
} }
} }

View File

@ -25,6 +25,6 @@ namespace DotRecast.Detour.Dynamic.Colliders
public interface IDtCollider public interface IDtCollider
{ {
float[] Bounds(); float[] Bounds();
void Rasterize(RcHeightfield hf, RcTelemetry telemetry); void Rasterize(RcHeightfield hf, RcContext context);
} }
} }

View File

@ -35,7 +35,7 @@ namespace DotRecast.Detour.Dynamic
public readonly DtDynamicNavMeshConfig config; public readonly DtDynamicNavMeshConfig config;
private readonly RcBuilder builder; private readonly RcBuilder builder;
private readonly Dictionary<long, DtDynamicTile> _tiles = new Dictionary<long, DtDynamicTile>(); private readonly Dictionary<long, DtDynamicTile> _tiles = new Dictionary<long, DtDynamicTile>();
private readonly RcTelemetry telemetry; private readonly RcContext _context;
private readonly DtNavMeshParams navMeshParams; private readonly DtNavMeshParams navMeshParams;
private readonly BlockingCollection<IDtDaynmicTileJob> updateQueue = new BlockingCollection<IDtDaynmicTileJob>(); private readonly BlockingCollection<IDtDaynmicTileJob> updateQueue = new BlockingCollection<IDtDaynmicTileJob>();
private readonly RcAtomicLong currentColliderId = new RcAtomicLong(0); private readonly RcAtomicLong currentColliderId = new RcAtomicLong(0);
@ -72,7 +72,7 @@ namespace DotRecast.Detour.Dynamic
} }
; ;
telemetry = new RcTelemetry(); _context = new RcContext();
} }
public DtNavMesh NavMesh() public DtNavMesh NavMesh()
@ -218,7 +218,7 @@ namespace DotRecast.Detour.Dynamic
{ {
DtNavMeshCreateParams option = new DtNavMeshCreateParams(); DtNavMeshCreateParams option = new DtNavMeshCreateParams();
option.walkableHeight = config.walkableHeight; option.walkableHeight = config.walkableHeight;
dirty = dirty | tile.Build(builder, config, telemetry); dirty = dirty | tile.Build(builder, config, _context);
} }
private bool UpdateNavMesh() private bool UpdateNavMesh()

View File

@ -44,12 +44,12 @@ namespace DotRecast.Detour.Dynamic
this.voxelTile = voxelTile; this.voxelTile = voxelTile;
} }
public bool Build(RcBuilder builder, DtDynamicNavMeshConfig config, RcTelemetry telemetry) public bool Build(RcBuilder builder, DtDynamicNavMeshConfig config, RcContext context)
{ {
if (dirty) if (dirty)
{ {
RcHeightfield heightfield = BuildHeightfield(config, telemetry); RcHeightfield heightfield = BuildHeightfield(config, context);
RcBuilderResult r = BuildRecast(builder, config, voxelTile, heightfield, telemetry); RcBuilderResult r = BuildRecast(builder, config, voxelTile, heightfield, context);
DtNavMeshCreateParams option = NavMeshCreateParams(voxelTile.tileX, voxelTile.tileZ, voxelTile.cellSize, DtNavMeshCreateParams option = NavMeshCreateParams(voxelTile.tileX, voxelTile.tileZ, voxelTile.cellSize,
voxelTile.cellHeight, config, r); voxelTile.cellHeight, config, r);
meshData = DtNavMeshBuilder.CreateNavMeshData(option); meshData = DtNavMeshBuilder.CreateNavMeshData(option);
@ -59,7 +59,7 @@ namespace DotRecast.Detour.Dynamic
return false; return false;
} }
private RcHeightfield BuildHeightfield(DtDynamicNavMeshConfig config, RcTelemetry telemetry) private RcHeightfield BuildHeightfield(DtDynamicNavMeshConfig config, RcContext context)
{ {
ICollection<long> rasterizedColliders = checkpoint != null ICollection<long> rasterizedColliders = checkpoint != null
? checkpoint.colliders as ICollection<long> ? checkpoint.colliders as ICollection<long>
@ -74,7 +74,7 @@ namespace DotRecast.Detour.Dynamic
if (!rasterizedColliders.Contains(cid)) if (!rasterizedColliders.Contains(cid))
{ {
heightfield.bmax.Y = Math.Max(heightfield.bmax.Y, c.Bounds()[4] + heightfield.ch * 2); heightfield.bmax.Y = Math.Max(heightfield.bmax.Y, c.Bounds()[4] + heightfield.ch * 2);
c.Rasterize(heightfield, telemetry); c.Rasterize(heightfield, context);
} }
} }
@ -87,7 +87,7 @@ namespace DotRecast.Detour.Dynamic
} }
private RcBuilderResult BuildRecast(RcBuilder builder, DtDynamicNavMeshConfig config, DtVoxelTile vt, private RcBuilderResult BuildRecast(RcBuilder builder, DtDynamicNavMeshConfig config, DtVoxelTile vt,
RcHeightfield heightfield, RcTelemetry telemetry) RcHeightfield heightfield, RcContext context)
{ {
RcConfig rcConfig = new RcConfig( RcConfig rcConfig = new RcConfig(
config.useTiles, config.tileSizeX, config.tileSizeZ, config.useTiles, config.tileSizeX, config.tileSizeZ,
@ -100,7 +100,7 @@ namespace DotRecast.Detour.Dynamic
Math.Min(DtDynamicNavMesh.MAX_VERTS_PER_POLY, config.vertsPerPoly), Math.Min(DtDynamicNavMesh.MAX_VERTS_PER_POLY, config.vertsPerPoly),
config.detailSampleDistance, config.detailSampleMaxError, config.detailSampleDistance, config.detailSampleMaxError,
true, true, true, default, true); true, true, true, default, true);
RcBuilderResult r = builder.Build(vt.tileX, vt.tileZ, null, rcConfig, heightfield, telemetry); RcBuilderResult r = builder.Build(vt.tileX, vt.tileZ, null, rcConfig, heightfield, context);
if (config.keepIntermediateResults) if (config.keepIntermediateResults)
{ {
recastResult = r; recastResult = r;

View File

@ -44,7 +44,7 @@ namespace DotRecast.Recast
/// @param[in] erosionRadius The radius of erosion. [Limits: 0 < value < 255] [Units: vx] /// @param[in] erosionRadius The radius of erosion. [Limits: 0 < value < 255] [Units: vx]
/// @param[in,out] compactHeightfield The populated compact heightfield to erode. /// @param[in,out] compactHeightfield The populated compact heightfield to erode.
/// @returns True if the operation completed successfully. /// @returns True if the operation completed successfully.
public static void ErodeWalkableArea(RcTelemetry context, int erosionRadius, RcCompactHeightfield compactHeightfield) public static void ErodeWalkableArea(RcContext context, int erosionRadius, RcCompactHeightfield compactHeightfield)
{ {
int xSize = compactHeightfield.width; int xSize = compactHeightfield.width;
int zSize = compactHeightfield.height; int zSize = compactHeightfield.height;
@ -261,7 +261,7 @@ namespace DotRecast.Recast
/// @param[in,out] context The build context to use during the operation. /// @param[in,out] context The build context to use during the operation.
/// @param[in,out] compactHeightfield A populated compact heightfield. /// @param[in,out] compactHeightfield A populated compact heightfield.
/// @returns True if the operation completed successfully. /// @returns True if the operation completed successfully.
public static bool MedianFilterWalkableArea(RcTelemetry context, RcCompactHeightfield compactHeightfield) public static bool MedianFilterWalkableArea(RcContext context, RcCompactHeightfield compactHeightfield)
{ {
int xSize = compactHeightfield.width; int xSize = compactHeightfield.width;
int zSize = compactHeightfield.height; int zSize = compactHeightfield.height;
@ -344,7 +344,7 @@ namespace DotRecast.Recast
/// @param[in] boxMaxBounds The maximum extents of the bounding box. [(x, y, z)] [Units: wu] /// @param[in] boxMaxBounds The maximum extents of the bounding box. [(x, y, z)] [Units: wu]
/// @param[in] areaId The area id to apply. [Limit: <= #RC_WALKABLE_AREA] /// @param[in] areaId The area id to apply. [Limit: <= #RC_WALKABLE_AREA]
/// @param[in,out] compactHeightfield A populated compact heightfield. /// @param[in,out] compactHeightfield A populated compact heightfield.
public static void MarkBoxArea(RcTelemetry context, float[] boxMinBounds, float[] boxMaxBounds, RcAreaModification areaId, RcCompactHeightfield compactHeightfield) public static void MarkBoxArea(RcContext context, float[] boxMinBounds, float[] boxMaxBounds, RcAreaModification areaId, RcCompactHeightfield compactHeightfield)
{ {
using var timer = context.ScopedTimer(RcTimerLabel.RC_TIMER_MARK_BOX_AREA); using var timer = context.ScopedTimer(RcTimerLabel.RC_TIMER_MARK_BOX_AREA);
@ -446,7 +446,7 @@ namespace DotRecast.Recast
/// @param[in] maxY The height of the top of the polygon. [Units: wu] /// @param[in] maxY The height of the top of the polygon. [Units: wu]
/// @param[in] areaId The area id to apply. [Limit: <= #RC_WALKABLE_AREA] /// @param[in] areaId The area id to apply. [Limit: <= #RC_WALKABLE_AREA]
/// @param[in,out] compactHeightfield A populated compact heightfield. /// @param[in,out] compactHeightfield A populated compact heightfield.
public static void MarkConvexPolyArea(RcTelemetry context, float[] verts, public static void MarkConvexPolyArea(RcContext context, float[] verts,
float minY, float maxY, RcAreaModification areaId, float minY, float maxY, RcAreaModification areaId,
RcCompactHeightfield compactHeightfield) RcCompactHeightfield compactHeightfield)
{ {
@ -567,7 +567,7 @@ namespace DotRecast.Recast
/// @param[in] height The height of the cylinder. [Units: wu] [Limit: > 0] /// @param[in] height The height of the cylinder. [Units: wu] [Limit: > 0]
/// @param[in] areaId The area id to apply. [Limit: <= #RC_WALKABLE_AREA] /// @param[in] areaId The area id to apply. [Limit: <= #RC_WALKABLE_AREA]
/// @param[in,out] compactHeightfield A populated compact heightfield. /// @param[in,out] compactHeightfield A populated compact heightfield.
public static void MarkCylinderArea(RcTelemetry context, float[] position, float radius, float height, public static void MarkCylinderArea(RcContext context, float[] position, float radius, float height,
RcAreaModification areaId, RcCompactHeightfield compactHeightfield) RcAreaModification areaId, RcCompactHeightfield compactHeightfield)
{ {
using var timer = context.ScopedTimer(RcTimerLabel.RC_TIMER_MARK_CYLINDER_AREA); using var timer = context.ScopedTimer(RcTimerLabel.RC_TIMER_MARK_CYLINDER_AREA);

View File

@ -162,7 +162,7 @@ namespace DotRecast.Recast
public RcBuilderResult Build(IInputGeomProvider geom, RcBuilderConfig builderCfg) public RcBuilderResult Build(IInputGeomProvider geom, RcBuilderConfig builderCfg)
{ {
RcConfig cfg = builderCfg.cfg; RcConfig cfg = builderCfg.cfg;
RcTelemetry ctx = new RcTelemetry(); RcContext ctx = new RcContext();
// //
// Step 1. Rasterize input polygon soup. // Step 1. Rasterize input polygon soup.
// //
@ -170,7 +170,7 @@ namespace DotRecast.Recast
return Build(builderCfg.tileX, builderCfg.tileZ, geom, cfg, solid, ctx); return Build(builderCfg.tileX, builderCfg.tileZ, geom, cfg, solid, ctx);
} }
public RcBuilderResult Build(int tileX, int tileZ, IInputGeomProvider geom, RcConfig cfg, RcHeightfield solid, RcTelemetry ctx) public RcBuilderResult Build(int tileX, int tileZ, IInputGeomProvider geom, RcConfig cfg, RcHeightfield solid, RcContext ctx)
{ {
FilterHeightfield(solid, cfg, ctx); FilterHeightfield(solid, cfg, ctx);
RcCompactHeightfield chf = BuildCompactHeightfield(geom, cfg, ctx, solid); RcCompactHeightfield chf = BuildCompactHeightfield(geom, cfg, ctx, solid);
@ -259,7 +259,7 @@ namespace DotRecast.Recast
/* /*
* Step 2. Filter walkable surfaces. * Step 2. Filter walkable surfaces.
*/ */
private void FilterHeightfield(RcHeightfield solid, RcConfig cfg, RcTelemetry ctx) private void FilterHeightfield(RcHeightfield solid, RcConfig cfg, RcContext ctx)
{ {
// Once all geometry is rasterized, we do initial pass of filtering to // Once all geometry is rasterized, we do initial pass of filtering to
// remove unwanted overhangs caused by the conservative rasterization // remove unwanted overhangs caused by the conservative rasterization
@ -283,7 +283,7 @@ namespace DotRecast.Recast
/* /*
* Step 3. Partition walkable surface to simple regions. * Step 3. Partition walkable surface to simple regions.
*/ */
private RcCompactHeightfield BuildCompactHeightfield(IInputGeomProvider geom, RcConfig cfg, RcTelemetry ctx, RcHeightfield solid) private RcCompactHeightfield BuildCompactHeightfield(IInputGeomProvider geom, RcConfig cfg, RcContext ctx, RcHeightfield solid)
{ {
// Compact the heightfield so that it is faster to handle from now on. // Compact the heightfield so that it is faster to handle from now on.
// This will result more cache coherent data as well as the neighbours // This will result more cache coherent data as well as the neighbours
@ -306,7 +306,7 @@ namespace DotRecast.Recast
public RcHeightfieldLayerSet BuildLayers(IInputGeomProvider geom, RcBuilderConfig builderCfg) public RcHeightfieldLayerSet BuildLayers(IInputGeomProvider geom, RcBuilderConfig builderCfg)
{ {
RcTelemetry ctx = new RcTelemetry(); RcContext ctx = new RcContext();
RcHeightfield solid = RcVoxelizations.BuildSolidHeightfield(geom, builderCfg, ctx); RcHeightfield solid = RcVoxelizations.BuildSolidHeightfield(geom, builderCfg, ctx);
FilterHeightfield(solid, builderCfg.cfg, ctx); FilterHeightfield(solid, builderCfg.cfg, ctx);
RcCompactHeightfield chf = BuildCompactHeightfield(geom, builderCfg.cfg, ctx, solid); RcCompactHeightfield chf = BuildCompactHeightfield(geom, builderCfg.cfg, ctx, solid);

View File

@ -12,9 +12,9 @@ namespace DotRecast.Recast
private readonly RcPolyMesh pmesh; private readonly RcPolyMesh pmesh;
private readonly RcPolyMeshDetail dmesh; private readonly RcPolyMeshDetail dmesh;
private readonly RcHeightfield solid; private readonly RcHeightfield solid;
private readonly RcTelemetry telemetry; private readonly RcContext _context;
public RcBuilderResult(int tileX, int tileZ, RcHeightfield solid, RcCompactHeightfield chf, RcContourSet cs, RcPolyMesh pmesh, RcPolyMeshDetail dmesh, RcTelemetry ctx) public RcBuilderResult(int tileX, int tileZ, RcHeightfield solid, RcCompactHeightfield chf, RcContourSet cs, RcPolyMesh pmesh, RcPolyMeshDetail dmesh, RcContext ctx)
{ {
this.tileX = tileX; this.tileX = tileX;
this.tileZ = tileZ; this.tileZ = tileZ;
@ -23,7 +23,7 @@ namespace DotRecast.Recast
this.cs = cs; this.cs = cs;
this.pmesh = pmesh; this.pmesh = pmesh;
this.dmesh = dmesh; this.dmesh = dmesh;
telemetry = ctx; _context = ctx;
} }
public RcPolyMesh GetMesh() public RcPolyMesh GetMesh()
@ -51,9 +51,9 @@ namespace DotRecast.Recast
return solid; return solid;
} }
public RcTelemetry GetTelemetry() public RcContext GetTelemetry()
{ {
return telemetry; return _context;
} }
} }
} }

View File

@ -119,7 +119,7 @@ namespace DotRecast.Recast
/// See the #rcConfig documentation for more information on the configuration parameters. /// See the #rcConfig documentation for more information on the configuration parameters.
/// ///
/// @see rcHeightfield, rcClearUnwalkableTriangles, rcRasterizeTriangles /// @see rcHeightfield, rcClearUnwalkableTriangles, rcRasterizeTriangles
public static int[] MarkWalkableTriangles(RcTelemetry ctx, float walkableSlopeAngle, float[] verts, int[] tris, int nt, RcAreaModification areaMod) public static int[] MarkWalkableTriangles(RcContext ctx, float walkableSlopeAngle, float[] verts, int[] tris, int nt, RcAreaModification areaMod)
{ {
int[] areas = new int[nt]; int[] areas = new int[nt];
float walkableThr = MathF.Cos(walkableSlopeAngle / 180.0f * MathF.PI); float walkableThr = MathF.Cos(walkableSlopeAngle / 180.0f * MathF.PI);
@ -153,7 +153,7 @@ namespace DotRecast.Recast
/// See the #rcConfig documentation for more information on the configuration parameters. /// See the #rcConfig documentation for more information on the configuration parameters.
/// ///
/// @see rcHeightfield, rcClearUnwalkableTriangles, rcRasterizeTriangles /// @see rcHeightfield, rcClearUnwalkableTriangles, rcRasterizeTriangles
public static void ClearUnwalkableTriangles(RcTelemetry ctx, float walkableSlopeAngle, float[] verts, int nv, int[] tris, int nt, int[] areas) public static void ClearUnwalkableTriangles(RcContext ctx, float walkableSlopeAngle, float[] verts, int nv, int[] tris, int nt, int[] areas)
{ {
float walkableThr = MathF.Cos(walkableSlopeAngle / 180.0f * MathF.PI); float walkableThr = MathF.Cos(walkableSlopeAngle / 180.0f * MathF.PI);

View File

@ -57,7 +57,7 @@ namespace DotRecast.Recast
/// @param[in] heightfield The heightfield to be compacted. /// @param[in] heightfield The heightfield to be compacted.
/// @param[out] compactHeightfield The resulting compact heightfield. (Must be pre-allocated.) /// @param[out] compactHeightfield The resulting compact heightfield. (Must be pre-allocated.)
/// @returns True if the operation completed successfully. /// @returns True if the operation completed successfully.
public static RcCompactHeightfield BuildCompactHeightfield(RcTelemetry context, int walkableHeight, int walkableClimb, RcHeightfield heightfield) public static RcCompactHeightfield BuildCompactHeightfield(RcContext context, int walkableHeight, int walkableClimb, RcHeightfield heightfield)
{ {
using var timer = context.ScopedTimer(RcTimerLabel.RC_TIMER_BUILD_COMPACTHEIGHTFIELD); using var timer = context.ScopedTimer(RcTimerLabel.RC_TIMER_BUILD_COMPACTHEIGHTFIELD);
@ -187,7 +187,7 @@ namespace DotRecast.Recast
/// @param[in,out] context The build context to use during the operation. /// @param[in,out] context The build context to use during the operation.
/// @param[in] heightfield An initialized heightfield. /// @param[in] heightfield An initialized heightfield.
/// @returns The number of spans in the heightfield. /// @returns The number of spans in the heightfield.
private static int GetHeightFieldSpanCount(RcTelemetry context, RcHeightfield heightfield) private static int GetHeightFieldSpanCount(RcContext context, RcHeightfield heightfield)
{ {
int w = heightfield.width; int w = heightfield.width;
int h = heightfield.height; int h = heightfield.height;

View File

@ -614,7 +614,7 @@ namespace DotRecast.Recast
return new int[] { minx, minz, leftmost }; return new int[] { minx, minz, leftmost };
} }
private static void MergeRegionHoles(RcTelemetry ctx, RcContourRegion region) private static void MergeRegionHoles(RcContext ctx, RcContourRegion region)
{ {
// Sort holes from left to right. // Sort holes from left to right.
for (int i = 0; i < region.nholes; i++) for (int i = 0; i < region.nholes; i++)
@ -715,7 +715,7 @@ namespace DotRecast.Recast
/// See the #rcConfig documentation for more information on the configuration parameters. /// See the #rcConfig documentation for more information on the configuration parameters.
/// ///
/// @see rcAllocContourSet, rcCompactHeightfield, rcContourSet, rcConfig /// @see rcAllocContourSet, rcCompactHeightfield, rcContourSet, rcConfig
public static RcContourSet BuildContours(RcTelemetry ctx, RcCompactHeightfield chf, float maxError, int maxEdgeLen, public static RcContourSet BuildContours(RcContext ctx, RcCompactHeightfield chf, float maxError, int maxEdgeLen,
int buildFlags) int buildFlags)
{ {
int w = chf.width; int w = chf.width;

View File

@ -30,7 +30,7 @@ namespace DotRecast.Recast
private const float EPSILON = 0.00001f; private const float EPSILON = 0.00001f;
private static readonly int[] BOX_EDGES = new[] { 0, 1, 0, 2, 0, 4, 1, 3, 1, 5, 2, 3, 2, 6, 3, 7, 4, 5, 4, 6, 5, 7, 6, 7 }; private static readonly int[] BOX_EDGES = new[] { 0, 1, 0, 2, 0, 4, 1, 3, 1, 5, 2, 3, 2, 6, 3, 7, 4, 5, 4, 6, 5, 7, 6, 7 };
public static void RasterizeSphere(RcHeightfield hf, RcVec3f center, float radius, int area, int flagMergeThr, RcTelemetry ctx) public static void RasterizeSphere(RcHeightfield hf, RcVec3f center, float radius, int area, int flagMergeThr, RcContext ctx)
{ {
using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_RASTERIZE_SPHERE); using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_RASTERIZE_SPHERE);
float[] bounds = float[] bounds =
@ -42,7 +42,7 @@ namespace DotRecast.Recast
rectangle => IntersectSphere(rectangle, center, radius * radius)); rectangle => IntersectSphere(rectangle, center, radius * radius));
} }
public static void RasterizeCapsule(RcHeightfield hf, RcVec3f start, RcVec3f end, float radius, int area, int flagMergeThr, RcTelemetry ctx) public static void RasterizeCapsule(RcHeightfield hf, RcVec3f start, RcVec3f end, float radius, int area, int flagMergeThr, RcContext ctx)
{ {
using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_RASTERIZE_CAPSULE); using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_RASTERIZE_CAPSULE);
float[] bounds = float[] bounds =
@ -56,7 +56,7 @@ namespace DotRecast.Recast
rectangle => IntersectCapsule(rectangle, start, end, axis, radius * radius)); rectangle => IntersectCapsule(rectangle, start, end, axis, radius * radius));
} }
public static void RasterizeCylinder(RcHeightfield hf, RcVec3f start, RcVec3f end, float radius, int area, int flagMergeThr, RcTelemetry ctx) public static void RasterizeCylinder(RcHeightfield hf, RcVec3f start, RcVec3f end, float radius, int area, int flagMergeThr, RcContext ctx)
{ {
using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_RASTERIZE_CYLINDER); using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_RASTERIZE_CYLINDER);
float[] bounds = float[] bounds =
@ -70,7 +70,7 @@ namespace DotRecast.Recast
rectangle => IntersectCylinder(rectangle, start, end, axis, radius * radius)); rectangle => IntersectCylinder(rectangle, start, end, axis, radius * radius));
} }
public static void RasterizeBox(RcHeightfield hf, RcVec3f center, RcVec3f[] halfEdges, int area, int flagMergeThr, RcTelemetry ctx) public static void RasterizeBox(RcHeightfield hf, RcVec3f center, RcVec3f[] halfEdges, int area, int flagMergeThr, RcContext ctx)
{ {
using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_RASTERIZE_BOX); using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_RASTERIZE_BOX);
RcVec3f[] normals = RcVec3f[] normals =
@ -120,7 +120,7 @@ namespace DotRecast.Recast
RasterizationFilledShape(hf, bounds, area, flagMergeThr, rectangle => IntersectBox(rectangle, vertices, planes)); RasterizationFilledShape(hf, bounds, area, flagMergeThr, rectangle => IntersectBox(rectangle, vertices, planes));
} }
public static void RasterizeConvex(RcHeightfield hf, float[] vertices, int[] triangles, int area, int flagMergeThr, RcTelemetry ctx) public static void RasterizeConvex(RcHeightfield hf, float[] vertices, int[] triangles, int area, int flagMergeThr, RcContext ctx)
{ {
using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_RASTERIZE_CONVEX); using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_RASTERIZE_CONVEX);
float[] bounds = new float[] { vertices[0], vertices[1], vertices[2], vertices[0], vertices[1], vertices[2] }; float[] bounds = new float[] { vertices[0], vertices[1], vertices[2], vertices[0], vertices[1], vertices[2] };

View File

@ -45,7 +45,7 @@ namespace DotRecast.Recast
/// @param[in] walkableClimb Maximum ledge height that is considered to still be traversable. /// @param[in] walkableClimb Maximum ledge height that is considered to still be traversable.
/// [Limit: >=0] [Units: vx] /// [Limit: >=0] [Units: vx]
/// @param[in,out] heightfield A fully built heightfield. (All spans have been added.) /// @param[in,out] heightfield A fully built heightfield. (All spans have been added.)
public static void FilterLowHangingWalkableObstacles(RcTelemetry context, int walkableClimb, RcHeightfield heightfield) public static void FilterLowHangingWalkableObstacles(RcContext context, int walkableClimb, RcHeightfield heightfield)
{ {
using var timer = context.ScopedTimer(RcTimerLabel.RC_TIMER_FILTER_LOW_OBSTACLES); using var timer = context.ScopedTimer(RcTimerLabel.RC_TIMER_FILTER_LOW_OBSTACLES);
@ -98,7 +98,7 @@ namespace DotRecast.Recast
/// @param[in] walkableClimb Maximum ledge height that is considered to still be traversable. /// @param[in] walkableClimb Maximum ledge height that is considered to still be traversable.
/// [Limit: >=0] [Units: vx] /// [Limit: >=0] [Units: vx]
/// @param[in,out] heightfield A fully built heightfield. (All spans have been added.) /// @param[in,out] heightfield A fully built heightfield. (All spans have been added.)
public static void FilterLedgeSpans(RcTelemetry context, int walkableHeight, int walkableClimb, RcHeightfield heightfield) public static void FilterLedgeSpans(RcContext context, int walkableHeight, int walkableClimb, RcHeightfield heightfield)
{ {
using var timer = context.ScopedTimer(RcTimerLabel.RC_TIMER_FILTER_BORDER); using var timer = context.ScopedTimer(RcTimerLabel.RC_TIMER_FILTER_BORDER);
@ -219,7 +219,7 @@ namespace DotRecast.Recast
/// @param[in] walkableHeight Minimum floor to 'ceiling' height that will still allow the floor area to /// @param[in] walkableHeight Minimum floor to 'ceiling' height that will still allow the floor area to
/// be considered walkable. [Limit: >= 3] [Units: vx] /// be considered walkable. [Limit: >= 3] [Units: vx]
/// @param[in,out] heightfield A fully built heightfield. (All spans have been added.) /// @param[in,out] heightfield A fully built heightfield. (All spans have been added.)
public static void FilterWalkableLowHeightSpans(RcTelemetry context, int walkableHeight, RcHeightfield heightfield) public static void FilterWalkableLowHeightSpans(RcContext context, int walkableHeight, RcHeightfield heightfield)
{ {
using var timer = context.ScopedTimer(RcTimerLabel.RC_TIMER_FILTER_WALKABLE); using var timer = context.ScopedTimer(RcTimerLabel.RC_TIMER_FILTER_WALKABLE);

View File

@ -52,7 +52,7 @@ namespace DotRecast.Recast
return (amin > bmax || amax < bmin) ? false : true; return (amin > bmax || amax < bmin) ? false : true;
} }
public static RcHeightfieldLayerSet BuildHeightfieldLayers(RcTelemetry ctx, RcCompactHeightfield chf, int walkableHeight) public static RcHeightfieldLayerSet BuildHeightfieldLayers(RcContext ctx, RcCompactHeightfield chf, int walkableHeight)
{ {
using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_BUILD_LAYERS); using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_BUILD_LAYERS);

View File

@ -439,7 +439,7 @@ namespace DotRecast.Recast
return EV_UNDEF; return EV_UNDEF;
} }
private static void AddEdge(RcTelemetry ctx, List<int> edges, int maxEdges, int s, int t, int l, int r) private static void AddEdge(RcContext ctx, List<int> edges, int maxEdges, int s, int t, int l, int r)
{ {
if (edges.Count / 4 >= maxEdges) if (edges.Count / 4 >= maxEdges)
{ {
@ -507,7 +507,7 @@ namespace DotRecast.Recast
return false; return false;
} }
static int CompleteFacet(RcTelemetry ctx, float[] pts, int npts, List<int> edges, int maxEdges, int nfaces, int e) static int CompleteFacet(RcContext ctx, float[] pts, int npts, List<int> edges, int maxEdges, int nfaces, int e)
{ {
const float EPS = 1e-5f; const float EPS = 1e-5f;
@ -624,7 +624,7 @@ namespace DotRecast.Recast
return nfaces; return nfaces;
} }
private static void DelaunayHull(RcTelemetry ctx, int npts, float[] pts, int nhull, int[] hull, List<int> tris) private static void DelaunayHull(RcContext ctx, int npts, float[] pts, int nhull, int[] hull, List<int> tris)
{ {
int nfaces = 0; int nfaces = 0;
int maxEdges = npts * 10; int maxEdges = npts * 10;
@ -828,7 +828,7 @@ namespace DotRecast.Recast
return (((i * 0xd8163841) & 0xffff) / 65535.0f * 2.0f) - 1.0f; return (((i * 0xd8163841) & 0xffff) / 65535.0f * 2.0f) - 1.0f;
} }
static int BuildPolyDetail(RcTelemetry ctx, float[] @in, int nin, float sampleDist, float sampleMaxError, static int BuildPolyDetail(RcContext ctx, float[] @in, int nin, float sampleDist, float sampleMaxError,
int heightSearchRadius, RcCompactHeightfield chf, RcHeightPatch hp, float[] verts, List<int> tris) int heightSearchRadius, RcCompactHeightfield chf, RcHeightPatch hp, float[] verts, List<int> tris)
{ {
List<int> samples = new List<int>(512); List<int> samples = new List<int>(512);
@ -1140,7 +1140,7 @@ namespace DotRecast.Recast
} }
static void SeedArrayWithPolyCenter(RcTelemetry ctx, RcCompactHeightfield chf, int[] meshpoly, int poly, int npoly, static void SeedArrayWithPolyCenter(RcContext ctx, RcCompactHeightfield chf, int[] meshpoly, int poly, int npoly,
int[] verts, int bs, RcHeightPatch hp, List<int> array) int[] verts, int bs, RcHeightPatch hp, List<int> array)
{ {
// Note: Reads to the compact heightfield are offset by border size (bs) // Note: Reads to the compact heightfield are offset by border size (bs)
@ -1298,7 +1298,7 @@ namespace DotRecast.Recast
queue.Add(v3); queue.Add(v3);
} }
static void GetHeightData(RcTelemetry ctx, RcCompactHeightfield chf, int[] meshpolys, int poly, int npoly, int[] verts, static void GetHeightData(RcContext ctx, RcCompactHeightfield chf, int[] meshpolys, int poly, int npoly, int[] verts,
int bs, RcHeightPatch hp, int region) int bs, RcHeightPatch hp, int region)
{ {
// Note: Reads to the compact heightfield are offset by border size (bs) // Note: Reads to the compact heightfield are offset by border size (bs)
@ -1424,7 +1424,7 @@ namespace DotRecast.Recast
/// See the #rcConfig documentation for more information on the configuration parameters. /// See the #rcConfig documentation for more information on the configuration parameters.
/// ///
/// @see rcAllocPolyMeshDetail, rcPolyMesh, rcCompactHeightfield, rcPolyMeshDetail, rcConfig /// @see rcAllocPolyMeshDetail, rcPolyMesh, rcCompactHeightfield, rcPolyMeshDetail, rcConfig
public static RcPolyMeshDetail BuildPolyMeshDetail(RcTelemetry ctx, RcPolyMesh mesh, RcCompactHeightfield chf, public static RcPolyMeshDetail BuildPolyMeshDetail(RcContext ctx, RcPolyMesh mesh, RcCompactHeightfield chf,
float sampleDist, float sampleMaxError) float sampleDist, float sampleMaxError)
{ {
using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_BUILD_POLYMESHDETAIL); using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_BUILD_POLYMESHDETAIL);
@ -1614,7 +1614,7 @@ namespace DotRecast.Recast
} }
/// @see rcAllocPolyMeshDetail, rcPolyMeshDetail /// @see rcAllocPolyMeshDetail, rcPolyMeshDetail
private static RcPolyMeshDetail MergePolyMeshDetails(RcTelemetry ctx, RcPolyMeshDetail[] meshes, int nmeshes) private static RcPolyMeshDetail MergePolyMeshDetails(RcContext ctx, RcPolyMeshDetail[] meshes, int nmeshes)
{ {
using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_MERGE_POLYMESHDETAIL); using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_MERGE_POLYMESHDETAIL);

View File

@ -577,7 +577,7 @@ namespace DotRecast.Recast
return an; return an;
} }
private static bool CanRemoveVertex(RcTelemetry ctx, RcPolyMesh mesh, int rem) private static bool CanRemoveVertex(RcContext ctx, RcPolyMesh mesh, int rem)
{ {
int nvp = mesh.nvp; int nvp = mesh.nvp;
@ -680,7 +680,7 @@ namespace DotRecast.Recast
return true; return true;
} }
private static void RemoveVertex(RcTelemetry ctx, RcPolyMesh mesh, int rem, int maxTris) private static void RemoveVertex(RcContext ctx, RcPolyMesh mesh, int rem, int maxTris)
{ {
int nvp = mesh.nvp; int nvp = mesh.nvp;
@ -967,7 +967,7 @@ namespace DotRecast.Recast
/// limit must be restricted to <= #DT_VERTS_PER_POLYGON. /// limit must be restricted to <= #DT_VERTS_PER_POLYGON.
/// ///
/// @see rcAllocPolyMesh, rcContourSet, rcPolyMesh, rcConfig /// @see rcAllocPolyMesh, rcContourSet, rcPolyMesh, rcConfig
public static RcPolyMesh BuildPolyMesh(RcTelemetry ctx, RcContourSet cset, int nvp) public static RcPolyMesh BuildPolyMesh(RcContext ctx, RcContourSet cset, int nvp)
{ {
using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_BUILD_POLYMESH); using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_BUILD_POLYMESH);
@ -1212,7 +1212,7 @@ namespace DotRecast.Recast
} }
/// @see rcAllocPolyMesh, rcPolyMesh /// @see rcAllocPolyMesh, rcPolyMesh
public static RcPolyMesh MergePolyMeshes(RcTelemetry ctx, RcPolyMesh[] meshes, int nmeshes) public static RcPolyMesh MergePolyMeshes(RcContext ctx, RcPolyMesh[] meshes, int nmeshes)
{ {
if (nmeshes == 0 || meshes == null) if (nmeshes == 0 || meshes == null)
return null; return null;
@ -1340,7 +1340,7 @@ namespace DotRecast.Recast
return mesh; return mesh;
} }
public static RcPolyMesh CopyPolyMesh(RcTelemetry ctx, RcPolyMesh src) public static RcPolyMesh CopyPolyMesh(RcContext ctx, RcPolyMesh src)
{ {
RcPolyMesh dst = new RcPolyMesh(); RcPolyMesh dst = new RcPolyMesh();

View File

@ -393,7 +393,7 @@ namespace DotRecast.Recast
/// @param[in] flagMergeThreshold The distance where the walkable flag is favored over the non-walkable flag. /// @param[in] flagMergeThreshold The distance where the walkable flag is favored over the non-walkable flag.
/// [Limit: >= 0] [Units: vx] /// [Limit: >= 0] [Units: vx]
/// @returns True if the operation completed successfully. /// @returns True if the operation completed successfully.
public static void RasterizeTriangle(RcTelemetry context, float[] verts, int v0, int v1, int v2, int areaID, public static void RasterizeTriangle(RcContext context, float[] verts, int v0, int v1, int v2, int areaID,
RcHeightfield heightfield, int flagMergeThreshold) RcHeightfield heightfield, int flagMergeThreshold)
{ {
using var timer = context.ScopedTimer(RcTimerLabel.RC_TIMER_RASTERIZE_TRIANGLES); using var timer = context.ScopedTimer(RcTimerLabel.RC_TIMER_RASTERIZE_TRIANGLES);
@ -421,7 +421,7 @@ namespace DotRecast.Recast
/// @param[in] flagMergeThreshold The distance where the walkable flag is favored over the non-walkable flag. /// @param[in] flagMergeThreshold The distance where the walkable flag is favored over the non-walkable flag.
/// [Limit: >= 0] [Units: vx] /// [Limit: >= 0] [Units: vx]
/// @returns True if the operation completed successfully. /// @returns True if the operation completed successfully.
public static void RasterizeTriangles(RcTelemetry context, float[] verts, int[] tris, int[] triAreaIDs, int numTris, public static void RasterizeTriangles(RcContext context, float[] verts, int[] tris, int[] triAreaIDs, int numTris,
RcHeightfield heightfield, int flagMergeThreshold) RcHeightfield heightfield, int flagMergeThreshold)
{ {
using var timer = context.ScopedTimer(RcTimerLabel.RC_TIMER_RASTERIZE_TRIANGLES); using var timer = context.ScopedTimer(RcTimerLabel.RC_TIMER_RASTERIZE_TRIANGLES);
@ -454,7 +454,7 @@ namespace DotRecast.Recast
/// @param[in] flagMergeThreshold The distance where the walkable flag is favored over the non-walkable flag. /// @param[in] flagMergeThreshold The distance where the walkable flag is favored over the non-walkable flag.
/// [Limit: >= 0] [Units: vx] /// [Limit: >= 0] [Units: vx]
/// @returns True if the operation completed successfully. /// @returns True if the operation completed successfully.
public static void RasterizeTriangles(RcTelemetry context, float[] verts, int[] triAreaIDs, int numTris, RcHeightfield heightfield, int flagMergeThreshold) public static void RasterizeTriangles(RcContext context, float[] verts, int[] triAreaIDs, int numTris, RcHeightfield heightfield, int flagMergeThreshold)
{ {
using var timer = context.ScopedTimer(RcTimerLabel.RC_TIMER_RASTERIZE_TRIANGLES); using var timer = context.ScopedTimer(RcTimerLabel.RC_TIMER_RASTERIZE_TRIANGLES);

View File

@ -847,7 +847,7 @@ namespace DotRecast.Recast
} }
} }
private static int MergeAndFilterRegions(RcTelemetry ctx, int minRegionArea, int mergeRegionSize, int maxRegionId, private static int MergeAndFilterRegions(RcContext ctx, int minRegionArea, int mergeRegionSize, int maxRegionId,
RcCompactHeightfield chf, int[] srcReg, List<int> overlaps) RcCompactHeightfield chf, int[] srcReg, List<int> overlaps)
{ {
int w = chf.width; int w = chf.width;
@ -1169,7 +1169,7 @@ namespace DotRecast.Recast
} }
} }
private static int MergeAndFilterLayerRegions(RcTelemetry ctx, int minRegionArea, int maxRegionId, RcCompactHeightfield chf, int[] srcReg, List<int> overlaps) private static int MergeAndFilterLayerRegions(RcContext ctx, int minRegionArea, int maxRegionId, RcCompactHeightfield chf, int[] srcReg, List<int> overlaps)
{ {
int w = chf.width; int w = chf.width;
int h = chf.height; int h = chf.height;
@ -1417,7 +1417,7 @@ namespace DotRecast.Recast
/// and rcCompactHeightfield::dist fields. /// and rcCompactHeightfield::dist fields.
/// ///
/// @see rcCompactHeightfield, rcBuildRegions, rcBuildRegionsMonotone /// @see rcCompactHeightfield, rcBuildRegions, rcBuildRegionsMonotone
public static void BuildDistanceField(RcTelemetry ctx, RcCompactHeightfield chf) public static void BuildDistanceField(RcContext ctx, RcCompactHeightfield chf)
{ {
using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_BUILD_DISTANCEFIELD); using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_BUILD_DISTANCEFIELD);
@ -1478,7 +1478,7 @@ namespace DotRecast.Recast
/// @warning The distance field must be created using #rcBuildDistanceField before attempting to build regions. /// @warning The distance field must be created using #rcBuildDistanceField before attempting to build regions.
/// ///
/// @see rcCompactHeightfield, rcCompactSpan, rcBuildDistanceField, rcBuildRegionsMonotone, rcConfig /// @see rcCompactHeightfield, rcCompactSpan, rcBuildDistanceField, rcBuildRegionsMonotone, rcConfig
public static void BuildRegionsMonotone(RcTelemetry ctx, RcCompactHeightfield chf, int minRegionArea, public static void BuildRegionsMonotone(RcContext ctx, RcCompactHeightfield chf, int minRegionArea,
int mergeRegionArea) int mergeRegionArea)
{ {
using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_BUILD_REGIONS); using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_BUILD_REGIONS);
@ -1660,7 +1660,7 @@ namespace DotRecast.Recast
/// @warning The distance field must be created using #rcBuildDistanceField before attempting to build regions. /// @warning The distance field must be created using #rcBuildDistanceField before attempting to build regions.
/// ///
/// @see rcCompactHeightfield, rcCompactSpan, rcBuildDistanceField, rcBuildRegionsMonotone, rcConfig /// @see rcCompactHeightfield, rcCompactSpan, rcBuildDistanceField, rcBuildRegionsMonotone, rcConfig
public static void BuildRegions(RcTelemetry ctx, RcCompactHeightfield chf, int minRegionArea, public static void BuildRegions(RcContext ctx, RcCompactHeightfield chf, int minRegionArea,
int mergeRegionArea) int mergeRegionArea)
{ {
using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_BUILD_REGIONS); using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_BUILD_REGIONS);
@ -1786,7 +1786,7 @@ namespace DotRecast.Recast
} }
} }
public static void BuildLayerRegions(RcTelemetry ctx, RcCompactHeightfield chf, int minRegionArea) public static void BuildLayerRegions(RcContext ctx, RcCompactHeightfield chf, int minRegionArea)
{ {
using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_BUILD_REGIONS); using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_BUILD_REGIONS);

View File

@ -25,7 +25,7 @@ namespace DotRecast.Recast
{ {
public static class RcVoxelizations public static class RcVoxelizations
{ {
public static RcHeightfield BuildSolidHeightfield(IInputGeomProvider geomProvider, RcBuilderConfig builderCfg, RcTelemetry ctx) public static RcHeightfield BuildSolidHeightfield(IInputGeomProvider geomProvider, RcBuilderConfig builderCfg, RcContext ctx)
{ {
RcConfig cfg = builderCfg.cfg; RcConfig cfg = builderCfg.cfg;

View File

@ -101,7 +101,7 @@ public class RecastSoloMeshTest
long time = RcFrequency.Ticks; long time = RcFrequency.Ticks;
RcVec3f bmin = geomProvider.GetMeshBoundsMin(); RcVec3f bmin = geomProvider.GetMeshBoundsMin();
RcVec3f bmax = geomProvider.GetMeshBoundsMax(); RcVec3f bmax = geomProvider.GetMeshBoundsMax();
RcTelemetry m_ctx = new RcTelemetry(); RcContext m_ctx = new RcContext();
// //
// Step 1. Initialize build config. // Step 1. Initialize build config.
// //

View File

@ -36,7 +36,7 @@ public class RecastTest
int[] unwalkable_tri = { 0, 2, 1 }; int[] unwalkable_tri = { 0, 2, 1 };
int nt = 1; int nt = 1;
RcTelemetry ctx = new RcTelemetry(); RcContext ctx = new RcContext();
{ {
int[] areas = { 42 }; int[] areas = { 42 };
RcCommons.ClearUnwalkableTriangles(ctx, walkableSlopeAngle, verts, nv, unwalkable_tri, nt, areas); RcCommons.ClearUnwalkableTriangles(ctx, walkableSlopeAngle, verts, nv, unwalkable_tri, nt, areas);