preventing name conflicts

This commit is contained in:
ikpil 2023-05-06 11:44:57 +09:00
parent e8e328d6af
commit 0f9e61f51e
22 changed files with 66 additions and 66 deletions

View File

@ -4,21 +4,21 @@ namespace DotRecast.Core
{ {
public class FRand public class FRand
{ {
private readonly Random r; private readonly Random _r;
public FRand() public FRand()
{ {
r = new Random(); _r = new Random();
} }
public FRand(long seed) public FRand(long seed)
{ {
r = new Random((int)seed); // TODO : 랜덤 시드 확인 필요 _r = new Random((int)seed); // TODO : 랜덤 시드 확인 필요
} }
public float Frand() public float Next()
{ {
return (float)r.NextDouble(); return (float)_r.NextDouble();
} }
} }
} }

View File

@ -2,7 +2,7 @@
namespace DotRecast.Core namespace DotRecast.Core
{ {
public class AtomicBoolean public class RcAtomicBoolean
{ {
private volatile int _location; private volatile int _location;

View File

@ -2,11 +2,11 @@
namespace DotRecast.Core namespace DotRecast.Core
{ {
public class AtomicFloat public class RcAtomicFloat
{ {
private volatile float _location; private volatile float _location;
public AtomicFloat(float location) public RcAtomicFloat(float location)
{ {
_location = location; _location = location;
} }

View File

@ -2,15 +2,15 @@
namespace DotRecast.Core namespace DotRecast.Core
{ {
public class AtomicInteger public class RcAtomicInteger
{ {
private volatile int _location; private volatile int _location;
public AtomicInteger() : this(0) public RcAtomicInteger() : this(0)
{ {
} }
public AtomicInteger(int location) public RcAtomicInteger(int location)
{ {
_location = location; _location = location;
} }

View File

@ -2,15 +2,15 @@
namespace DotRecast.Core namespace DotRecast.Core
{ {
public class AtomicLong public class RcAtomicLong
{ {
private long _location; private long _location;
public AtomicLong() : this(0) public RcAtomicLong() : this(0)
{ {
} }
public AtomicLong(long location) public RcAtomicLong(long location)
{ {
_location = location; _location = location;
} }

View File

@ -3,7 +3,7 @@ using System.Diagnostics;
namespace DotRecast.Core namespace DotRecast.Core
{ {
public static class FrequencyWatch public static class RcFrequency
{ {
public static readonly double Frequency = (double)TimeSpan.TicksPerSecond / Stopwatch.Frequency; public static readonly double Frequency = (double)TimeSpan.TicksPerSecond / Stopwatch.Frequency;
public static long Ticks => unchecked((long)(Stopwatch.GetTimestamp() * Frequency)); public static long Ticks => unchecked((long)(Stopwatch.GetTimestamp() * Frequency));

View File

@ -142,7 +142,7 @@ namespace DotRecast.Detour.Crowd
/// dtCrowdAgentParams::queryFilterType /// dtCrowdAgentParams::queryFilterType
public const int DT_CROWD_MAX_QUERY_FILTER_TYPE = 16; public const int DT_CROWD_MAX_QUERY_FILTER_TYPE = 16;
private readonly AtomicInteger _agentId = new AtomicInteger(); private readonly RcAtomicInteger _agentId = new RcAtomicInteger();
private readonly List<CrowdAgent> _agents; private readonly List<CrowdAgent> _agents;
private readonly PathQueue _pathQ; private readonly PathQueue _pathQ;
private readonly ObstacleAvoidanceParams[] _obstacleQueryParams = new ObstacleAvoidanceParams[DT_CROWD_MAX_OBSTAVOIDANCE_PARAMS]; private readonly ObstacleAvoidanceParams[] _obstacleQueryParams = new ObstacleAvoidanceParams[DT_CROWD_MAX_OBSTAVOIDANCE_PARAMS];

View File

@ -66,12 +66,12 @@ namespace DotRecast.Detour.Crowd
public void Start(string name) public void Start(string name)
{ {
_executionTimings.Add(name, FrequencyWatch.Ticks); _executionTimings.Add(name, RcFrequency.Ticks);
} }
public void Stop(string name) public void Stop(string name)
{ {
long duration = FrequencyWatch.Ticks - _executionTimings[name]; long duration = RcFrequency.Ticks - _executionTimings[name];
if (!_executionTimingSamples.TryGetValue(name, out var s)) if (!_executionTimingSamples.TryGetValue(name, out var s))
{ {
s = new List<long>(); s = new List<long>();

View File

@ -38,7 +38,7 @@ namespace DotRecast.Detour.Dynamic
private readonly Telemetry telemetry; private readonly Telemetry telemetry;
private readonly NavMeshParams navMeshParams; private readonly NavMeshParams navMeshParams;
private readonly BlockingCollection<IUpdateQueueItem> updateQueue = new BlockingCollection<IUpdateQueueItem>(); private readonly BlockingCollection<IUpdateQueueItem> updateQueue = new BlockingCollection<IUpdateQueueItem>();
private readonly AtomicLong currentColliderId = new AtomicLong(0); private readonly RcAtomicLong currentColliderId = new RcAtomicLong(0);
private NavMesh _navMesh; private NavMesh _navMesh;
private bool dirty = true; private bool dirty = true;

View File

@ -74,8 +74,8 @@ namespace DotRecast.Detour.Extras.Jumplink
{ {
Vector3f halfExtents = new Vector3f { x = cs, y = heightRange, z = cs }; Vector3f halfExtents = new Vector3f { x = cs, y = heightRange, z = cs };
float maxHeight = pt.y + heightRange; float maxHeight = pt.y + heightRange;
AtomicBoolean found = new AtomicBoolean(); RcAtomicBoolean found = new RcAtomicBoolean();
AtomicFloat minHeight = new AtomicFloat(pt.y); RcAtomicFloat minHeight = new RcAtomicFloat(pt.y);
navMeshQuery.QueryPolygons(pt, halfExtents, filter, new PolyQueryInvoker((tile, poly, refs) => navMeshQuery.QueryPolygons(pt, halfExtents, filter, new PolyQueryInvoker((tile, poly, refs) =>
{ {
Result<float> h = navMeshQuery.GetPolyHeight(refs, pt); Result<float> h = navMeshQuery.GetPolyHeight(refs, pt);

View File

@ -104,7 +104,7 @@ namespace DotRecast.Detour
// Choose random tile using reservoi sampling. // Choose random tile using reservoi sampling.
float area = 1.0f; // Could be tile area too. float area = 1.0f; // Could be tile area too.
tsum += area; tsum += area;
float u = frand.Frand(); float u = frand.Next();
if (u * tsum <= area) if (u * tsum <= area)
{ {
tile = mt; tile = mt;
@ -150,7 +150,7 @@ namespace DotRecast.Detour
// Choose random polygon weighted by area, using reservoi sampling. // Choose random polygon weighted by area, using reservoi sampling.
areaSum += polyArea; areaSum += polyArea;
float u = frand.Frand(); float u = frand.Next();
if (u * areaSum <= polyArea) if (u * areaSum <= polyArea)
{ {
poly = p; poly = p;
@ -172,8 +172,8 @@ namespace DotRecast.Detour
Array.Copy(tile.data.verts, poly.verts[j] * 3, verts, j * 3, 3); Array.Copy(tile.data.verts, poly.verts[j] * 3, verts, j * 3, 3);
} }
float s = frand.Frand(); float s = frand.Next();
float t = frand.Frand(); float t = frand.Next();
var pt = RandomPointInConvexPoly(verts, poly.vertCount, areas, s, t); var pt = RandomPointInConvexPoly(verts, poly.vertCount, areas, s, t);
ClosestPointOnPolyResult closest = ClosestPointOnPoly(polyRef, pt).result; ClosestPointOnPolyResult closest = ClosestPointOnPoly(polyRef, pt).result;
@ -297,7 +297,7 @@ namespace DotRecast.Detour
// Choose random polygon weighted by area, using reservoi sampling. // Choose random polygon weighted by area, using reservoi sampling.
areaSum += polyArea; areaSum += polyArea;
float u = frand.Frand(); float u = frand.Next();
if (u * areaSum <= polyArea) if (u * areaSum <= polyArea)
{ {
randomPoly = bestPoly; randomPoly = bestPoly;
@ -398,8 +398,8 @@ namespace DotRecast.Detour
} }
// Randomly pick point on polygon. // Randomly pick point on polygon.
float s = frand.Frand(); float s = frand.Next();
float t = frand.Frand(); float t = frand.Next();
float[] areas = new float[randomPolyVerts.Length / 3]; float[] areas = new float[randomPolyVerts.Length / 3];
Vector3f pt = RandomPointInConvexPoly(randomPolyVerts, randomPolyVerts.Length / 3, areas, s, t); Vector3f pt = RandomPointInConvexPoly(randomPolyVerts, randomPolyVerts.Length / 3, areas, s, t);

View File

@ -459,7 +459,7 @@ public class RecastDemo
cameraPos.y += (float)((_moveUp - _moveDown) * keySpeed * dt); cameraPos.y += (float)((_moveUp - _moveDown) * keySpeed * dt);
long time = FrequencyWatch.Ticks; long time = RcFrequency.Ticks;
prevFrameTime = time; prevFrameTime = time;
// Update sample simulation. // Update sample simulation.
@ -525,7 +525,7 @@ public class RecastDemo
float m_detailSampleDist = settingsUI.GetDetailSampleDist(); float m_detailSampleDist = settingsUI.GetDetailSampleDist();
float m_detailSampleMaxError = settingsUI.GetDetailSampleMaxError(); float m_detailSampleMaxError = settingsUI.GetDetailSampleMaxError();
int m_tileSize = settingsUI.GetTileSize(); int m_tileSize = settingsUI.GetTileSize();
long t = FrequencyWatch.Ticks; long t = RcFrequency.Ticks;
Logger.Information($"build"); Logger.Information($"build");
@ -549,7 +549,7 @@ public class RecastDemo
sample.Update(sample.GetInputGeom(), buildResult.Item1, buildResult.Item2); sample.Update(sample.GetInputGeom(), buildResult.Item1, buildResult.Item2);
sample.SetChanged(false); sample.SetChanged(false);
settingsUI.SetBuildTime((FrequencyWatch.Ticks - t) / TimeSpan.TicksPerMillisecond); settingsUI.SetBuildTime((RcFrequency.Ticks - t) / TimeSpan.TicksPerMillisecond);
//settingsUI.SetBuildTelemetry(buildResult.Item1.Select(x => x.GetTelemetry()).ToList()); //settingsUI.SetBuildTelemetry(buildResult.Item1.Select(x => x.GetTelemetry()).ToList());
toolsUI.SetSample(sample); toolsUI.SetSample(sample);

View File

@ -86,12 +86,12 @@ public class CrowdProfilingTool
IQueryFilter filter = new DefaultQueryFilter(); IQueryFilter filter = new DefaultQueryFilter();
for (int i = 0; i < agents; i++) for (int i = 0; i < agents; i++)
{ {
float tr = rnd.Frand(); float tr = rnd.Next();
AgentType type = AgentType.MOB; AgentType type = AgentType.MOB;
float mobsPcnt = percentMobs / 100f; float mobsPcnt = percentMobs / 100f;
if (tr > mobsPcnt) if (tr > mobsPcnt)
{ {
tr = rnd.Frand(); tr = rnd.Next();
float travellerPcnt = percentTravellers / 100f; float travellerPcnt = percentTravellers / 100f;
if (tr > travellerPcnt) if (tr > travellerPcnt)
{ {
@ -161,7 +161,7 @@ public class CrowdProfilingTool
{ {
if (0 < zones.Count) if (0 < zones.Count)
{ {
int zone = (int)(rnd.Frand() * zones.Count); int zone = (int)(rnd.Next() * zones.Count);
Result<FindRandomPointResult> result = navquery.FindRandomPointWithinCircle(zones[zone].GetRandomRef(), Result<FindRandomPointResult> result = navquery.FindRandomPointWithinCircle(zones[zone].GetRandomRef(),
zones[zone].GetRandomPt(), zoneRadius, filter, rnd); zones[zone].GetRandomPt(), zoneRadius, filter, rnd);
if (result.Succeeded()) if (result.Succeeded())
@ -240,7 +240,7 @@ public class CrowdProfilingTool
public void Update(float dt) public void Update(float dt)
{ {
long startTime = FrequencyWatch.Ticks; long startTime = RcFrequency.Ticks;
if (crowd != null) if (crowd != null)
{ {
crowd.Config().pathQueueSize = pathQueueSize; crowd.Config().pathQueueSize = pathQueueSize;
@ -248,7 +248,7 @@ public class CrowdProfilingTool
crowd.Update(dt, null); crowd.Update(dt, null);
} }
long endTime = FrequencyWatch.Ticks; long endTime = RcFrequency.Ticks;
if (crowd != null) if (crowd != null)
{ {
NavMeshQuery navquery = new NavMeshQuery(navMesh); NavMeshQuery navquery = new NavMeshQuery(navMesh);

View File

@ -677,9 +677,9 @@ public class CrowdTool : Tool
if (nav == null) if (nav == null)
return; return;
long startTime = FrequencyWatch.Ticks; long startTime = RcFrequency.Ticks;
crowd.Update(dt, m_agentDebug); crowd.Update(dt, m_agentDebug);
long endTime = FrequencyWatch.Ticks; long endTime = RcFrequency.Ticks;
// Update agent trails // Update agent trails
foreach (CrowdAgent ag in crowd.GetActiveAgents()) foreach (CrowdAgent ag in crowd.GetActiveAgents())

View File

@ -205,9 +205,9 @@ public class DynamicUpdateTool : Tool
{ {
Vector3f sp = Vector3f.Of(spos.x, spos.y + 1.3f, spos.z); Vector3f sp = Vector3f.Of(spos.x, spos.y + 1.3f, spos.z);
Vector3f ep = Vector3f.Of(epos.x, epos.y + 1.3f, epos.z); Vector3f ep = Vector3f.Of(epos.x, epos.y + 1.3f, epos.z);
long t1 = FrequencyWatch.Ticks; long t1 = RcFrequency.Ticks;
float? hitPos = dynaMesh.VoxelQuery().Raycast(sp, ep); float? hitPos = dynaMesh.VoxelQuery().Raycast(sp, ep);
long t2 = FrequencyWatch.Ticks; long t2 = RcFrequency.Ticks;
raycastTime = (t2 - t1) / TimeSpan.TicksPerMillisecond; raycastTime = (t2 - t1) / TimeSpan.TicksPerMillisecond;
raycastHit = hitPos.HasValue; raycastHit = hitPos.HasValue;
raycastHitPos = hitPos.HasValue raycastHitPos = hitPos.HasValue
@ -499,13 +499,13 @@ public class DynamicUpdateTool : Tool
private void UpdateDynaMesh() private void UpdateDynaMesh()
{ {
long t = FrequencyWatch.Ticks; long t = RcFrequency.Ticks;
try try
{ {
bool updated = dynaMesh.Update(executor).Result; bool updated = dynaMesh.Update(executor).Result;
if (updated) if (updated)
{ {
buildTime = (FrequencyWatch.Ticks - t) / TimeSpan.TicksPerMillisecond; buildTime = (RcFrequency.Ticks - t) / TimeSpan.TicksPerMillisecond;
sample.Update(null, dynaMesh.RecastResults(), dynaMesh.NavMesh()); sample.Update(null, dynaMesh.RecastResults(), dynaMesh.NavMesh());
sample.SetChanged(false); sample.SetChanged(false);
} }
@ -728,7 +728,7 @@ public class DynamicUpdateTool : Tool
private void BuildDynaMesh() private void BuildDynaMesh()
{ {
ConfigDynaMesh(); ConfigDynaMesh();
long t = FrequencyWatch.Ticks; long t = RcFrequency.Ticks;
try try
{ {
var _ = dynaMesh.Build(executor).Result; var _ = dynaMesh.Build(executor).Result;
@ -738,7 +738,7 @@ public class DynamicUpdateTool : Tool
Console.WriteLine(e); Console.WriteLine(e);
} }
buildTime = (FrequencyWatch.Ticks - t) / TimeSpan.TicksPerMillisecond; buildTime = (RcFrequency.Ticks - t) / TimeSpan.TicksPerMillisecond;
sample.Update(null, dynaMesh.RecastResults(), dynaMesh.NavMesh()); sample.Update(null, dynaMesh.RecastResults(), dynaMesh.NavMesh());
} }

View File

@ -90,7 +90,7 @@ namespace DotRecast.Recast
private Task BuildSingleThreadAsync(IInputGeomProvider geom, RecastConfig cfg, Vector3f bmin, Vector3f bmax, private Task BuildSingleThreadAsync(IInputGeomProvider geom, RecastConfig cfg, Vector3f bmin, Vector3f bmax,
int tw, int th, List<RecastBuilderResult> results) int tw, int th, List<RecastBuilderResult> results)
{ {
AtomicInteger counter = new AtomicInteger(0); RcAtomicInteger counter = new RcAtomicInteger(0);
for (int y = 0; y < th; ++y) for (int y = 0; y < th; ++y)
{ {
for (int x = 0; x < tw; ++x) for (int x = 0; x < tw; ++x)
@ -105,7 +105,7 @@ namespace DotRecast.Recast
private Task BuildMultiThreadAsync(IInputGeomProvider geom, RecastConfig cfg, Vector3f bmin, Vector3f bmax, private Task BuildMultiThreadAsync(IInputGeomProvider geom, RecastConfig cfg, Vector3f bmin, Vector3f bmax,
int tw, int th, List<RecastBuilderResult> results, TaskFactory taskFactory, CancellationToken cancellationToken) int tw, int th, List<RecastBuilderResult> results, TaskFactory taskFactory, CancellationToken cancellationToken)
{ {
AtomicInteger counter = new AtomicInteger(0); RcAtomicInteger counter = new RcAtomicInteger(0);
CountdownEvent latch = new CountdownEvent(tw * th); CountdownEvent latch = new CountdownEvent(tw * th);
List<Task> tasks = new List<Task>(); List<Task> tasks = new List<Task>();
@ -153,7 +153,7 @@ namespace DotRecast.Recast
} }
private RecastBuilderResult BuildTile(IInputGeomProvider geom, RecastConfig cfg, Vector3f bmin, Vector3f bmax, int tx, private RecastBuilderResult BuildTile(IInputGeomProvider geom, RecastConfig cfg, Vector3f bmin, Vector3f bmax, int tx,
int ty, AtomicInteger counter, int total) int ty, RcAtomicInteger counter, int total)
{ {
RecastBuilderResult result = Build(geom, new RecastBuilderConfig(cfg, bmin, bmax, tx, ty)); RecastBuilderResult result = Build(geom, new RecastBuilderConfig(cfg, bmin, bmax, tx, ty));
if (progressListener != null) if (progressListener != null)

View File

@ -162,7 +162,7 @@ namespace DotRecast.Recast
} }
private static bool CircumCircle(float[] verts, int p1, int p2, int p3, ref Vector3f c, AtomicFloat r) private static bool CircumCircle(float[] verts, int p1, int p2, int p3, ref Vector3f c, RcAtomicFloat r)
{ {
float EPS = 1e-6f; float EPS = 1e-6f;
// Calculate the circle relative to p1, to avoid some precision issues. // Calculate the circle relative to p1, to avoid some precision issues.
@ -545,7 +545,7 @@ namespace DotRecast.Recast
// Find best point on left of edge. // Find best point on left of edge.
int pt = npts; int pt = npts;
Vector3f c = new Vector3f(); Vector3f c = new Vector3f();
AtomicFloat r = new AtomicFloat(-1f); RcAtomicFloat r = new RcAtomicFloat(-1f);
for (int u = 0; u < npts; ++u) for (int u = 0; u < npts; ++u)
{ {
if (u == s || u == t) if (u == s || u == t)

View File

@ -28,19 +28,19 @@ namespace DotRecast.Recast
{ {
public class Telemetry public class Telemetry
{ {
private readonly ThreadLocal<Dictionary<string, AtomicLong>> timerStart = new ThreadLocal<Dictionary<string, AtomicLong>>(() => new Dictionary<string, AtomicLong>()); private readonly ThreadLocal<Dictionary<string, RcAtomicLong>> timerStart = new ThreadLocal<Dictionary<string, RcAtomicLong>>(() => new Dictionary<string, RcAtomicLong>());
private readonly ConcurrentDictionary<string, AtomicLong> timerAccum = new ConcurrentDictionary<string, AtomicLong>(); private readonly ConcurrentDictionary<string, RcAtomicLong> timerAccum = new ConcurrentDictionary<string, RcAtomicLong>();
public void StartTimer(string name) public void StartTimer(string name)
{ {
timerStart.Value[name] = new AtomicLong(FrequencyWatch.Ticks); timerStart.Value[name] = new RcAtomicLong(RcFrequency.Ticks);
} }
public void StopTimer(string name) public void StopTimer(string name)
{ {
timerAccum timerAccum
.GetOrAdd(name, _ => new AtomicLong(0)) .GetOrAdd(name, _ => new RcAtomicLong(0))
.AddAndGet(FrequencyWatch.Ticks - timerStart.Value?[name].Read() ?? 0); .AddAndGet(RcFrequency.Ticks - timerStart.Value?[name].Read() ?? 0);
} }
public void Warn(string @string) public void Warn(string @string)

View File

@ -123,19 +123,19 @@ public class RandomPointTest : AbstractDetourTest
query.FindRandomPointWithinCircle(point.GetRandomRef(), point.GetRandomPt(), radius, filter, f); query.FindRandomPointWithinCircle(point.GetRandomRef(), point.GetRandomPt(), radius, filter, f);
} }
long t1 = FrequencyWatch.Ticks; long t1 = RcFrequency.Ticks;
for (int i = 0; i < 10000; i++) for (int i = 0; i < 10000; i++)
{ {
query.FindRandomPointAroundCircle(point.GetRandomRef(), point.GetRandomPt(), radius, filter, f); query.FindRandomPointAroundCircle(point.GetRandomRef(), point.GetRandomPt(), radius, filter, f);
} }
long t2 = FrequencyWatch.Ticks; long t2 = RcFrequency.Ticks;
for (int i = 0; i < 10000; i++) for (int i = 0; i < 10000; i++)
{ {
query.FindRandomPointWithinCircle(point.GetRandomRef(), point.GetRandomPt(), radius, filter, f); query.FindRandomPointWithinCircle(point.GetRandomRef(), point.GetRandomPt(), radius, filter, f);
} }
long t3 = FrequencyWatch.Ticks; long t3 = RcFrequency.Ticks;
Console.WriteLine("Random point around circle: " + (t2 - t1) / TimeSpan.TicksPerMillisecond + "ms"); Console.WriteLine("Random point around circle: " + (t2 - t1) / TimeSpan.TicksPerMillisecond + "ms");
Console.WriteLine("Random point within circle: " + (t3 - t2) / TimeSpan.TicksPerMillisecond + "ms"); Console.WriteLine("Random point within circle: " + (t3 - t2) / TimeSpan.TicksPerMillisecond + "ms");
} }

View File

@ -189,20 +189,20 @@ public class TileCacheTest : AbstractTileCacheTest
layerBuilder.Build(order, cCompatibility, threads); layerBuilder.Build(order, cCompatibility, threads);
} }
long t1 = FrequencyWatch.Ticks; long t1 = RcFrequency.Ticks;
List<byte[]> layers = null; List<byte[]> layers = null;
for (int i = 0; i < 8; i++) for (int i = 0; i < 8; i++)
{ {
layers = layerBuilder.Build(order, cCompatibility, 1); layers = layerBuilder.Build(order, cCompatibility, 1);
} }
long t2 = FrequencyWatch.Ticks; long t2 = RcFrequency.Ticks;
for (int i = 0; i < 8; i++) for (int i = 0; i < 8; i++)
{ {
layers = layerBuilder.Build(order, cCompatibility, threads); layers = layerBuilder.Build(order, cCompatibility, threads);
} }
long t3 = FrequencyWatch.Ticks; long t3 = RcFrequency.Ticks;
Console.WriteLine(" Time ST : " + (t2 - t1) / TimeSpan.TicksPerMillisecond); Console.WriteLine(" Time ST : " + (t2 - t1) / TimeSpan.TicksPerMillisecond);
Console.WriteLine(" Time MT : " + (t3 - t2) / TimeSpan.TicksPerMillisecond); Console.WriteLine(" Time MT : " + (t3 - t2) / TimeSpan.TicksPerMillisecond);
TileCache tc = GetTileCache(geom, order, cCompatibility); TileCache tc = GetTileCache(geom, order, cCompatibility);

View File

@ -97,7 +97,7 @@ public class RecastSoloMeshTest
{ {
m_partitionType = partitionType; m_partitionType = partitionType;
IInputGeomProvider geomProvider = ObjImporter.Load(Loader.ToBytes(filename)); IInputGeomProvider geomProvider = ObjImporter.Load(Loader.ToBytes(filename));
long time = FrequencyWatch.Ticks; long time = RcFrequency.Ticks;
Vector3f bmin = geomProvider.GetMeshBoundsMin(); Vector3f bmin = geomProvider.GetMeshBoundsMin();
Vector3f bmax = geomProvider.GetMeshBoundsMax(); Vector3f bmax = geomProvider.GetMeshBoundsMax();
Telemetry m_ctx = new Telemetry(); Telemetry m_ctx = new Telemetry();
@ -205,7 +205,7 @@ public class RecastSoloMeshTest
// you use tiles) // you use tiles)
// * good choice to use for tiled navmesh with medium and small sized // * good choice to use for tiled navmesh with medium and small sized
// tiles // tiles
long time3 = FrequencyWatch.Ticks; long time3 = RcFrequency.Ticks;
if (m_partitionType == PartitionType.WATERSHED) if (m_partitionType == PartitionType.WATERSHED)
{ {
@ -257,7 +257,7 @@ public class RecastSoloMeshTest
Assert.That(m_dmesh.nmeshes, Is.EqualTo(expDetMeshes), "Mesh Detail Meshes"); Assert.That(m_dmesh.nmeshes, Is.EqualTo(expDetMeshes), "Mesh Detail Meshes");
Assert.That(m_dmesh.nverts, Is.EqualTo(expDetVerts), "Mesh Detail Verts"); Assert.That(m_dmesh.nverts, Is.EqualTo(expDetVerts), "Mesh Detail Verts");
Assert.That(m_dmesh.ntris, Is.EqualTo(expDetTris), "Mesh Detail Tris"); Assert.That(m_dmesh.ntris, Is.EqualTo(expDetTris), "Mesh Detail Tris");
long time2 = FrequencyWatch.Ticks; long time2 = RcFrequency.Ticks;
Console.WriteLine(filename + " : " + partitionType + " " + (time2 - time) / TimeSpan.TicksPerMillisecond + " ms"); Console.WriteLine(filename + " : " + partitionType + " " + (time2 - time) / TimeSpan.TicksPerMillisecond + " ms");
Console.WriteLine(" " + (time3 - time) / TimeSpan.TicksPerMillisecond + " ms"); Console.WriteLine(" " + (time3 - time) / TimeSpan.TicksPerMillisecond + " ms");
SaveObj(filename.Substring(0, filename.LastIndexOf('.')) + "_" + partitionType + "_detail.obj", m_dmesh); SaveObj(filename.Substring(0, filename.LastIndexOf('.')) + "_" + partitionType + "_detail.obj", m_dmesh);

View File

@ -107,19 +107,19 @@ public class RecastTileMeshTest
Build(geom, builder, cfg, 4, true); Build(geom, builder, cfg, 4, true);
} }
long t1 = FrequencyWatch.Ticks; long t1 = RcFrequency.Ticks;
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
Build(geom, builder, cfg, 1, false); Build(geom, builder, cfg, 1, false);
} }
long t2 = FrequencyWatch.Ticks; long t2 = RcFrequency.Ticks;
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
Build(geom, builder, cfg, 4, false); Build(geom, builder, cfg, 4, false);
} }
long t3 = FrequencyWatch.Ticks; long t3 = RcFrequency.Ticks;
Console.WriteLine(" Time ST : " + (t2 - t1) / TimeSpan.TicksPerMillisecond); Console.WriteLine(" Time ST : " + (t2 - t1) / TimeSpan.TicksPerMillisecond);
Console.WriteLine(" Time MT : " + (t3 - t2) / TimeSpan.TicksPerMillisecond); Console.WriteLine(" Time MT : " + (t3 - t2) / TimeSpan.TicksPerMillisecond);
} }