forked from mirror/DotRecast
typo for unity3d
This commit is contained in:
parent
36746745b7
commit
c2e954b70a
|
@ -28,16 +28,16 @@ namespace DotRecast.Recast.Demo
|
||||||
{
|
{
|
||||||
public class DemoSample
|
public class DemoSample
|
||||||
{
|
{
|
||||||
private DemoInputGeomProvider _inputGeom;
|
private DemoInputGeomProvider _geom;
|
||||||
private DtNavMesh _navMesh;
|
private DtNavMesh _navMesh;
|
||||||
private DtNavMeshQuery _navMeshQuery;
|
private DtNavMeshQuery _navMeshQuery;
|
||||||
private readonly RcNavMeshBuildSettings _settings;
|
private readonly RcNavMeshBuildSettings _settings;
|
||||||
private IList<RecastBuilderResult> _recastResults;
|
private IList<RecastBuilderResult> _recastResults;
|
||||||
private bool _changed;
|
private bool _changed;
|
||||||
|
|
||||||
public DemoSample(DemoInputGeomProvider inputGeom, IList<RecastBuilderResult> recastResults, DtNavMesh navMesh)
|
public DemoSample(DemoInputGeomProvider geom, IList<RecastBuilderResult> recastResults, DtNavMesh navMesh)
|
||||||
{
|
{
|
||||||
_inputGeom = inputGeom;
|
_geom = geom;
|
||||||
_recastResults = recastResults;
|
_recastResults = recastResults;
|
||||||
_navMesh = navMesh;
|
_navMesh = navMesh;
|
||||||
_settings = new RcNavMeshBuildSettings();
|
_settings = new RcNavMeshBuildSettings();
|
||||||
|
@ -53,7 +53,7 @@ namespace DotRecast.Recast.Demo
|
||||||
|
|
||||||
public DemoInputGeomProvider GetInputGeom()
|
public DemoInputGeomProvider GetInputGeom()
|
||||||
{
|
{
|
||||||
return _inputGeom;
|
return _geom;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IList<RecastBuilderResult> GetRecastResults()
|
public IList<RecastBuilderResult> GetRecastResults()
|
||||||
|
@ -88,7 +88,7 @@ namespace DotRecast.Recast.Demo
|
||||||
|
|
||||||
public void Update(DemoInputGeomProvider geom, IList<RecastBuilderResult> recastResults, DtNavMesh navMesh)
|
public void Update(DemoInputGeomProvider geom, IList<RecastBuilderResult> recastResults, DtNavMesh navMesh)
|
||||||
{
|
{
|
||||||
_inputGeom = geom;
|
_geom = geom;
|
||||||
_recastResults = recastResults;
|
_recastResults = recastResults;
|
||||||
_navMesh = navMesh;
|
_navMesh = navMesh;
|
||||||
SetQuery(navMesh);
|
SetQuery(navMesh);
|
||||||
|
|
|
@ -381,14 +381,14 @@ public class RecastDemo : IRecastDemoChannel
|
||||||
settingsView.SetSample(_sample);
|
settingsView.SetSample(_sample);
|
||||||
|
|
||||||
toolset = new RcToolsetView(
|
toolset = new RcToolsetView(
|
||||||
new TestNavmeshDemoTool(),
|
new TestNavmeshSampleTool(),
|
||||||
new TileDemoTool(),
|
new TileSampleTool(),
|
||||||
new ObstacleDemoTool(),
|
new ObstacleSampleTool(),
|
||||||
new OffMeshConnectionDemoTool(),
|
new OffMeshConnectionSampleTool(),
|
||||||
new ConvexVolumeDemoTool(),
|
new ConvexVolumeSampleTool(),
|
||||||
new CrowdDemoTool(),
|
new CrowdSampleTool(),
|
||||||
new JumpLinkBuilderDemoTool(),
|
new JumpLinkBuilderSampleTool(),
|
||||||
new DynamicUpdateDemoTool()
|
new DynamicUpdateSampleTool()
|
||||||
);
|
);
|
||||||
toolset.SetEnabled(true);
|
toolset.SetEnabled(true);
|
||||||
logView = new RcLogView();
|
logView = new RcLogView();
|
||||||
|
@ -610,10 +610,10 @@ public class RecastDemo : IRecastDemoChannel
|
||||||
dd.Fog(camr * 0.1f, camr * 1.25f);
|
dd.Fog(camr * 0.1f, camr * 1.25f);
|
||||||
renderer.Render(_sample, settingsView.GetDrawMode());
|
renderer.Render(_sample, settingsView.GetDrawMode());
|
||||||
|
|
||||||
IRcDemoTool demoTool = toolset.GetTool();
|
ISampleTool sampleTool = toolset.GetTool();
|
||||||
if (demoTool != null)
|
if (sampleTool != null)
|
||||||
{
|
{
|
||||||
demoTool.HandleRender(renderer);
|
sampleTool.HandleRender(renderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
dd.Fog(false);
|
dd.Fog(false);
|
||||||
|
@ -788,12 +788,12 @@ public class RecastDemo : IRecastDemoChannel
|
||||||
}
|
}
|
||||||
|
|
||||||
RcVec3f rayDir = RcVec3f.Of(rayEnd.x - rayStart.x, rayEnd.y - rayStart.y, rayEnd.z - rayStart.z);
|
RcVec3f rayDir = RcVec3f.Of(rayEnd.x - rayStart.x, rayEnd.y - rayStart.y, rayEnd.z - rayStart.z);
|
||||||
IRcDemoTool rayDemoTool = toolset.GetTool();
|
ISampleTool raySampleTool = toolset.GetTool();
|
||||||
rayDir.Normalize();
|
rayDir.Normalize();
|
||||||
if (rayDemoTool != null)
|
if (raySampleTool != null)
|
||||||
{
|
{
|
||||||
Logger.Information($"click ray - tool({rayDemoTool.GetTool().GetName()}) rayStart({rayStart.x:0.#},{rayStart.y:0.#},{rayStart.z:0.#}) pos({rayDir.x:0.#},{rayDir.y:0.#},{rayDir.z:0.#}) shift({processHitTestShift})");
|
Logger.Information($"click ray - tool({raySampleTool.GetTool().GetName()}) rayStart({rayStart.x:0.#},{rayStart.y:0.#},{rayStart.z:0.#}) pos({rayDir.x:0.#},{rayDir.y:0.#},{rayDir.z:0.#}) shift({processHitTestShift})");
|
||||||
rayDemoTool.HandleClickRay(rayStart, rayDir, processHitTestShift);
|
raySampleTool.HandleClickRay(rayStart, rayDir, processHitTestShift);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hit)
|
if (hit)
|
||||||
|
@ -812,10 +812,10 @@ public class RecastDemo : IRecastDemoChannel
|
||||||
pos.x = rayStart.x + (rayEnd.x - rayStart.x) * hitTime;
|
pos.x = rayStart.x + (rayEnd.x - rayStart.x) * hitTime;
|
||||||
pos.y = rayStart.y + (rayEnd.y - rayStart.y) * hitTime;
|
pos.y = rayStart.y + (rayEnd.y - rayStart.y) * hitTime;
|
||||||
pos.z = rayStart.z + (rayEnd.z - rayStart.z) * hitTime;
|
pos.z = rayStart.z + (rayEnd.z - rayStart.z) * hitTime;
|
||||||
if (rayDemoTool != null)
|
if (raySampleTool != null)
|
||||||
{
|
{
|
||||||
Logger.Information($"click - tool({rayDemoTool.GetTool().GetName()}) rayStart({rayStart.x:0.#},{rayStart.y:0.#},{rayStart.z:0.#}) pos({pos.x:0.#},{pos.y:0.#},{pos.z:0.#}) shift({processHitTestShift})");
|
Logger.Information($"click - tool({raySampleTool.GetTool().GetName()}) rayStart({rayStart.x:0.#},{rayStart.y:0.#},{rayStart.z:0.#}) pos({pos.x:0.#},{pos.y:0.#},{pos.z:0.#}) shift({processHitTestShift})");
|
||||||
rayDemoTool.HandleClick(rayStart, pos, processHitTestShift);
|
raySampleTool.HandleClick(rayStart, pos, processHitTestShift);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,9 +34,9 @@ using static DotRecast.Recast.Demo.Draw.DebugDrawPrimitives;
|
||||||
|
|
||||||
namespace DotRecast.Recast.Demo.Tools;
|
namespace DotRecast.Recast.Demo.Tools;
|
||||||
|
|
||||||
public class ConvexVolumeDemoTool : IRcDemoTool
|
public class ConvexVolumeSampleTool : ISampleTool
|
||||||
{
|
{
|
||||||
private static readonly ILogger Logger = Log.ForContext<ConvexVolumeDemoTool>();
|
private static readonly ILogger Logger = Log.ForContext<ConvexVolumeSampleTool>();
|
||||||
|
|
||||||
private DemoSample _sample;
|
private DemoSample _sample;
|
||||||
private readonly ConvexVolumeToolImpl _impl;
|
private readonly ConvexVolumeToolImpl _impl;
|
||||||
|
@ -49,7 +49,7 @@ public class ConvexVolumeDemoTool : IRcDemoTool
|
||||||
private readonly List<RcVec3f> pts = new();
|
private readonly List<RcVec3f> pts = new();
|
||||||
private readonly List<int> hull = new();
|
private readonly List<int> hull = new();
|
||||||
|
|
||||||
public ConvexVolumeDemoTool()
|
public ConvexVolumeSampleTool()
|
||||||
{
|
{
|
||||||
_impl = new ConvexVolumeToolImpl();
|
_impl = new ConvexVolumeToolImpl();
|
||||||
}
|
}
|
|
@ -35,9 +35,9 @@ using static DotRecast.Recast.Demo.Draw.DebugDrawPrimitives;
|
||||||
|
|
||||||
namespace DotRecast.Recast.Demo.Tools;
|
namespace DotRecast.Recast.Demo.Tools;
|
||||||
|
|
||||||
public class CrowdDemoTool : IRcDemoTool
|
public class CrowdSampleTool : ISampleTool
|
||||||
{
|
{
|
||||||
private static readonly ILogger Logger = Log.ForContext<CrowdDemoTool>();
|
private static readonly ILogger Logger = Log.ForContext<CrowdSampleTool>();
|
||||||
|
|
||||||
private DemoSample _sample;
|
private DemoSample _sample;
|
||||||
private readonly CrowdToolImpl _impl;
|
private readonly CrowdToolImpl _impl;
|
||||||
|
@ -54,7 +54,7 @@ public class CrowdDemoTool : IRcDemoTool
|
||||||
private int m_modeIdx = CrowdToolMode.CREATE.Idx;
|
private int m_modeIdx = CrowdToolMode.CREATE.Idx;
|
||||||
private long crowdUpdateTime;
|
private long crowdUpdateTime;
|
||||||
|
|
||||||
public CrowdDemoTool()
|
public CrowdSampleTool()
|
||||||
{
|
{
|
||||||
m_agentDebug.vod = new DtObstacleAvoidanceDebugData(2048);
|
m_agentDebug.vod = new DtObstacleAvoidanceDebugData(2048);
|
||||||
profilingTool = new CrowdProfilingTool(GetAgentParams);
|
profilingTool = new CrowdProfilingTool(GetAgentParams);
|
|
@ -40,9 +40,9 @@ using static DotRecast.Recast.Demo.Draw.DebugDrawPrimitives;
|
||||||
|
|
||||||
namespace DotRecast.Recast.Demo.Tools;
|
namespace DotRecast.Recast.Demo.Tools;
|
||||||
|
|
||||||
public class DynamicUpdateDemoTool : IRcDemoTool
|
public class DynamicUpdateSampleTool : ISampleTool
|
||||||
{
|
{
|
||||||
private static readonly ILogger Logger = Log.ForContext<DynamicUpdateDemoTool>();
|
private static readonly ILogger Logger = Log.ForContext<DynamicUpdateSampleTool>();
|
||||||
|
|
||||||
private DemoSample _sample;
|
private DemoSample _sample;
|
||||||
private readonly DynamicUpdateToolImpl _impl;
|
private readonly DynamicUpdateToolImpl _impl;
|
||||||
|
@ -89,7 +89,7 @@ public class DynamicUpdateDemoTool : IRcDemoTool
|
||||||
private bool raycastHit;
|
private bool raycastHit;
|
||||||
private RcVec3f raycastHitPos;
|
private RcVec3f raycastHitPos;
|
||||||
|
|
||||||
public DynamicUpdateDemoTool()
|
public DynamicUpdateSampleTool()
|
||||||
{
|
{
|
||||||
_impl = new();
|
_impl = new();
|
||||||
executor = Task.Factory;
|
executor = Task.Factory;
|
|
@ -24,7 +24,7 @@ using DotRecast.Recast.Toolset;
|
||||||
|
|
||||||
namespace DotRecast.Recast.Demo.Tools;
|
namespace DotRecast.Recast.Demo.Tools;
|
||||||
|
|
||||||
public interface IRcDemoTool
|
public interface ISampleTool
|
||||||
{
|
{
|
||||||
void SetSample(DemoSample sample);
|
void SetSample(DemoSample sample);
|
||||||
void OnSampleChanged();
|
void OnSampleChanged();
|
|
@ -28,15 +28,15 @@ using static DotRecast.Recast.Demo.Draw.DebugDrawPrimitives;
|
||||||
|
|
||||||
namespace DotRecast.Recast.Demo.Tools;
|
namespace DotRecast.Recast.Demo.Tools;
|
||||||
|
|
||||||
public class JumpLinkBuilderDemoTool : IRcDemoTool
|
public class JumpLinkBuilderSampleTool : ISampleTool
|
||||||
{
|
{
|
||||||
private static readonly ILogger Logger = Log.ForContext<JumpLinkBuilderDemoTool>();
|
private static readonly ILogger Logger = Log.ForContext<JumpLinkBuilderSampleTool>();
|
||||||
private DemoSample _sample;
|
private DemoSample _sample;
|
||||||
|
|
||||||
private readonly JumpLinkBuilderToolImpl _impl;
|
private readonly JumpLinkBuilderToolImpl _impl;
|
||||||
private readonly JumpLinkBuilderToolOption _option;
|
private readonly JumpLinkBuilderToolOption _option;
|
||||||
|
|
||||||
public JumpLinkBuilderDemoTool()
|
public JumpLinkBuilderSampleTool()
|
||||||
{
|
{
|
||||||
_impl = new();
|
_impl = new();
|
||||||
_option = new();
|
_option = new();
|
|
@ -8,9 +8,9 @@ using Serilog;
|
||||||
|
|
||||||
namespace DotRecast.Recast.Demo.Tools;
|
namespace DotRecast.Recast.Demo.Tools;
|
||||||
|
|
||||||
public class ObstacleDemoTool : IRcDemoTool
|
public class ObstacleSampleTool : ISampleTool
|
||||||
{
|
{
|
||||||
private static readonly ILogger Logger = Log.ForContext<ObstacleDemoTool>();
|
private static readonly ILogger Logger = Log.ForContext<ObstacleSampleTool>();
|
||||||
|
|
||||||
private DemoSample _sample;
|
private DemoSample _sample;
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ public class ObstacleDemoTool : IRcDemoTool
|
||||||
private bool _hitPosSet;
|
private bool _hitPosSet;
|
||||||
private RcVec3f _hitPos;
|
private RcVec3f _hitPos;
|
||||||
|
|
||||||
public ObstacleDemoTool()
|
public ObstacleSampleTool()
|
||||||
{
|
{
|
||||||
_impl = new(DtTileCacheCompressorFactory.Shared);
|
_impl = new(DtTileCacheCompressorFactory.Shared);
|
||||||
}
|
}
|
|
@ -30,9 +30,9 @@ using static DotRecast.Recast.Demo.Draw.DebugDraw;
|
||||||
|
|
||||||
namespace DotRecast.Recast.Demo.Tools;
|
namespace DotRecast.Recast.Demo.Tools;
|
||||||
|
|
||||||
public class OffMeshConnectionDemoTool : IRcDemoTool
|
public class OffMeshConnectionSampleTool : ISampleTool
|
||||||
{
|
{
|
||||||
private static readonly ILogger Logger = Log.ForContext<OffMeshConnectionDemoTool>();
|
private static readonly ILogger Logger = Log.ForContext<OffMeshConnectionSampleTool>();
|
||||||
|
|
||||||
private DemoSample _sample;
|
private DemoSample _sample;
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ public class OffMeshConnectionDemoTool : IRcDemoTool
|
||||||
private bool hitPosSet;
|
private bool hitPosSet;
|
||||||
private RcVec3f hitPos;
|
private RcVec3f hitPos;
|
||||||
|
|
||||||
public OffMeshConnectionDemoTool()
|
public OffMeshConnectionSampleTool()
|
||||||
{
|
{
|
||||||
_impl = new();
|
_impl = new();
|
||||||
}
|
}
|
|
@ -13,9 +13,9 @@ using static DotRecast.Recast.Demo.Draw.DebugDrawPrimitives;
|
||||||
|
|
||||||
namespace DotRecast.Recast.Demo.Tools;
|
namespace DotRecast.Recast.Demo.Tools;
|
||||||
|
|
||||||
public class TestNavmeshDemoTool : IRcDemoTool
|
public class TestNavmeshSampleTool : ISampleTool
|
||||||
{
|
{
|
||||||
private static readonly ILogger Logger = Log.ForContext<TestNavmeshDemoTool>();
|
private static readonly ILogger Logger = Log.ForContext<TestNavmeshSampleTool>();
|
||||||
|
|
||||||
private const int MAX_POLYS = 256;
|
private const int MAX_POLYS = 256;
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ public class TestNavmeshDemoTool : IRcDemoTool
|
||||||
private DtStatus m_pathFindStatus = DtStatus.DT_FAILURE;
|
private DtStatus m_pathFindStatus = DtStatus.DT_FAILURE;
|
||||||
private readonly List<RcVec3f> randomPoints = new();
|
private readonly List<RcVec3f> randomPoints = new();
|
||||||
|
|
||||||
public TestNavmeshDemoTool()
|
public TestNavmeshSampleTool()
|
||||||
{
|
{
|
||||||
_impl = new();
|
_impl = new();
|
||||||
m_filter = new DtQueryDefaultFilter(
|
m_filter = new DtQueryDefaultFilter(
|
|
@ -10,9 +10,9 @@ using static DotRecast.Recast.Demo.Draw.DebugDraw;
|
||||||
|
|
||||||
namespace DotRecast.Recast.Demo.Tools;
|
namespace DotRecast.Recast.Demo.Tools;
|
||||||
|
|
||||||
public class TileDemoTool : IRcDemoTool
|
public class TileSampleTool : ISampleTool
|
||||||
{
|
{
|
||||||
private static readonly ILogger Logger = Log.ForContext<TileDemoTool>();
|
private static readonly ILogger Logger = Log.ForContext<TileSampleTool>();
|
||||||
|
|
||||||
private DemoSample _sample;
|
private DemoSample _sample;
|
||||||
private readonly TileToolImpl _impl;
|
private readonly TileToolImpl _impl;
|
||||||
|
@ -20,7 +20,7 @@ public class TileDemoTool : IRcDemoTool
|
||||||
private bool _hitPosSet;
|
private bool _hitPosSet;
|
||||||
private RcVec3f _hitPos;
|
private RcVec3f _hitPos;
|
||||||
|
|
||||||
public TileDemoTool()
|
public TileSampleTool()
|
||||||
{
|
{
|
||||||
_impl = new();
|
_impl = new();
|
||||||
}
|
}
|
|
@ -31,15 +31,15 @@ public class RcToolsetView : IRcView
|
||||||
{
|
{
|
||||||
//private readonly NkColor white = NkColor.Create();
|
//private readonly NkColor white = NkColor.Create();
|
||||||
private int _currentToolIdx = 0;
|
private int _currentToolIdx = 0;
|
||||||
private IRcDemoTool _currentDemoTool;
|
private ISampleTool _currentSampleTool;
|
||||||
private bool enabled;
|
private bool enabled;
|
||||||
private readonly IRcDemoTool[] tools;
|
private readonly ISampleTool[] tools;
|
||||||
private bool _isHovered;
|
private bool _isHovered;
|
||||||
public bool IsHovered() => _isHovered;
|
public bool IsHovered() => _isHovered;
|
||||||
|
|
||||||
private RcCanvas _canvas;
|
private RcCanvas _canvas;
|
||||||
|
|
||||||
public RcToolsetView(params IRcDemoTool[] tools)
|
public RcToolsetView(params ISampleTool[] tools)
|
||||||
{
|
{
|
||||||
this.tools = tools;
|
this.tools = tools;
|
||||||
}
|
}
|
||||||
|
@ -82,10 +82,10 @@ public class RcToolsetView : IRcView
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_currentDemoTool = tools[_currentToolIdx];
|
_currentSampleTool = tools[_currentToolIdx];
|
||||||
ImGui.Text(_currentDemoTool.GetTool().GetName());
|
ImGui.Text(_currentSampleTool.GetTool().GetName());
|
||||||
ImGui.Separator();
|
ImGui.Separator();
|
||||||
_currentDemoTool.Layout();
|
_currentSampleTool.Layout();
|
||||||
|
|
||||||
ImGui.End();
|
ImGui.End();
|
||||||
}
|
}
|
||||||
|
@ -95,9 +95,9 @@ public class RcToolsetView : IRcView
|
||||||
this.enabled = enabled;
|
this.enabled = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IRcDemoTool GetTool()
|
public ISampleTool GetTool()
|
||||||
{
|
{
|
||||||
return _currentDemoTool;
|
return _currentSampleTool;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetSample(DemoSample sample)
|
public void SetSample(DemoSample sample)
|
||||||
|
|
Loading…
Reference in New Issue