forked from mirror/DotRecast
move Demo.Sample to DemoTool.Sample
This commit is contained in:
parent
06e892b2d8
commit
c069c1fd54
|
@ -24,6 +24,7 @@ using DotRecast.Detour;
|
||||||
using DotRecast.Recast.DemoTool.Builder;
|
using DotRecast.Recast.DemoTool.Builder;
|
||||||
using DotRecast.Recast.DemoTool.Geom;
|
using DotRecast.Recast.DemoTool.Geom;
|
||||||
using DotRecast.Recast.Demo.UI;
|
using DotRecast.Recast.Demo.UI;
|
||||||
|
using DotRecast.Recast.DemoTool;
|
||||||
|
|
||||||
namespace DotRecast.Recast.Demo.Draw;
|
namespace DotRecast.Recast.Demo.Draw;
|
||||||
|
|
||||||
|
|
|
@ -367,7 +367,7 @@ public class RecastDemo
|
||||||
_imgui = new ImGuiController(_gl, window, _input);
|
_imgui = new ImGuiController(_gl, window, _input);
|
||||||
|
|
||||||
DemoInputGeomProvider geom = LoadInputMesh(Loader.ToBytes("nav_test.obj"));
|
DemoInputGeomProvider geom = LoadInputMesh(Loader.ToBytes("nav_test.obj"));
|
||||||
sample = new Sample(geom, ImmutableArray<RecastBuilderResult>.Empty, null, dd);
|
sample = new Sample(geom, ImmutableArray<RecastBuilderResult>.Empty, null);
|
||||||
|
|
||||||
settingsView = new RcSettingsView();
|
settingsView = new RcSettingsView();
|
||||||
settingsView.SetSample(sample);
|
settingsView.SetSample(sample);
|
||||||
|
|
|
@ -1,98 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright (c) 2009-2010 Mikko Mononen memon@inside.org
|
|
||||||
recast4j copyright (c) 2015-2019 Piotr Piastucki piotr@jtilia.org
|
|
||||||
DotRecast Copyright (c) 2023 Choi Ikpil ikpil@naver.com
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
|
||||||
warranty. In no event will the authors be held liable for any damages
|
|
||||||
arising from the use of this software.
|
|
||||||
Permission is granted to anyone to use this software for any purpose,
|
|
||||||
including commercial applications, and to alter it and redistribute it
|
|
||||||
freely, subject to the following restrictions:
|
|
||||||
1. The origin of this software must not be misrepresented; you must not
|
|
||||||
claim that you wrote the original software. If you use this software
|
|
||||||
in a product, an acknowledgment in the product documentation would be
|
|
||||||
appreciated but is not required.
|
|
||||||
2. Altered source versions must be plainly marked as such, and must not be
|
|
||||||
misrepresented as being the original software.
|
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using DotRecast.Detour;
|
|
||||||
using DotRecast.Recast.Demo.Draw;
|
|
||||||
using DotRecast.Recast.DemoTool.Geom;
|
|
||||||
using DotRecast.Recast.Demo.UI;
|
|
||||||
using DotRecast.Recast.DemoTool;
|
|
||||||
|
|
||||||
namespace DotRecast.Recast.Demo;
|
|
||||||
|
|
||||||
public class Sample
|
|
||||||
{
|
|
||||||
private DemoInputGeomProvider _inputGeom;
|
|
||||||
private DtNavMesh _navMesh;
|
|
||||||
private DtNavMeshQuery _navMeshQuery;
|
|
||||||
private readonly RcSampleSettings _settings;
|
|
||||||
private IList<RecastBuilderResult> _recastResults;
|
|
||||||
private bool _changed;
|
|
||||||
|
|
||||||
public Sample(DemoInputGeomProvider inputGeom, IList<RecastBuilderResult> recastResults, DtNavMesh navMesh, RecastDebugDraw debugDraw)
|
|
||||||
{
|
|
||||||
_inputGeom = inputGeom;
|
|
||||||
_recastResults = recastResults;
|
|
||||||
_navMesh = navMesh;
|
|
||||||
_settings = new();
|
|
||||||
|
|
||||||
SetQuery(navMesh);
|
|
||||||
_changed = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SetQuery(DtNavMesh navMesh)
|
|
||||||
{
|
|
||||||
_navMeshQuery = navMesh != null ? new DtNavMeshQuery(navMesh) : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DemoInputGeomProvider GetInputGeom()
|
|
||||||
{
|
|
||||||
return _inputGeom;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IList<RecastBuilderResult> GetRecastResults()
|
|
||||||
{
|
|
||||||
return _recastResults;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DtNavMesh GetNavMesh()
|
|
||||||
{
|
|
||||||
return _navMesh;
|
|
||||||
}
|
|
||||||
|
|
||||||
public RcSampleSettings GetSettings()
|
|
||||||
{
|
|
||||||
return _settings;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DtNavMeshQuery GetNavMeshQuery()
|
|
||||||
{
|
|
||||||
return _navMeshQuery;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsChanged()
|
|
||||||
{
|
|
||||||
return _changed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetChanged(bool changed)
|
|
||||||
{
|
|
||||||
_changed = changed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Update(DemoInputGeomProvider geom, IList<RecastBuilderResult> recastResults, DtNavMesh navMesh)
|
|
||||||
{
|
|
||||||
_inputGeom = geom;
|
|
||||||
_recastResults = recastResults;
|
|
||||||
_navMesh = navMesh;
|
|
||||||
SetQuery(navMesh);
|
|
||||||
_changed = true;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -23,6 +23,7 @@ using System.Collections.Generic;
|
||||||
using DotRecast.Core;
|
using DotRecast.Core;
|
||||||
using DotRecast.Recast.DemoTool.Builder;
|
using DotRecast.Recast.DemoTool.Builder;
|
||||||
using DotRecast.Recast.Demo.Draw;
|
using DotRecast.Recast.Demo.Draw;
|
||||||
|
using DotRecast.Recast.DemoTool;
|
||||||
using DotRecast.Recast.DemoTool.Geom;
|
using DotRecast.Recast.DemoTool.Geom;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
using static DotRecast.Recast.Demo.Draw.DebugDraw;
|
using static DotRecast.Recast.Demo.Draw.DebugDraw;
|
||||||
|
|
|
@ -20,6 +20,7 @@ freely, subject to the following restrictions:
|
||||||
|
|
||||||
using DotRecast.Core;
|
using DotRecast.Core;
|
||||||
using DotRecast.Recast.Demo.Draw;
|
using DotRecast.Recast.Demo.Draw;
|
||||||
|
using DotRecast.Recast.DemoTool;
|
||||||
|
|
||||||
namespace DotRecast.Recast.Demo.Tools;
|
namespace DotRecast.Recast.Demo.Tools;
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ using System;
|
||||||
using DotRecast.Core;
|
using DotRecast.Core;
|
||||||
using DotRecast.Recast.DemoTool.Builder;
|
using DotRecast.Recast.DemoTool.Builder;
|
||||||
using DotRecast.Recast.Demo.Draw;
|
using DotRecast.Recast.Demo.Draw;
|
||||||
|
using DotRecast.Recast.DemoTool;
|
||||||
using DotRecast.Recast.DemoTool.Geom;
|
using DotRecast.Recast.DemoTool.Geom;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
using static DotRecast.Recast.Demo.Draw.DebugDraw;
|
using static DotRecast.Recast.Demo.Draw.DebugDraw;
|
||||||
|
|
|
@ -22,6 +22,7 @@ using System;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using DotRecast.Core;
|
using DotRecast.Core;
|
||||||
using DotRecast.Recast.Demo.Tools;
|
using DotRecast.Recast.Demo.Tools;
|
||||||
|
using DotRecast.Recast.DemoTool;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
|
|
||||||
namespace DotRecast.Recast.Demo.UI;
|
namespace DotRecast.Recast.Demo.UI;
|
||||||
|
|
|
@ -0,0 +1,96 @@
|
||||||
|
/*
|
||||||
|
Copyright (c) 2009-2010 Mikko Mononen memon@inside.org
|
||||||
|
recast4j copyright (c) 2015-2019 Piotr Piastucki piotr@jtilia.org
|
||||||
|
DotRecast Copyright (c) 2023 Choi Ikpil ikpil@naver.com
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using DotRecast.Detour;
|
||||||
|
using DotRecast.Recast.DemoTool.Geom;
|
||||||
|
|
||||||
|
namespace DotRecast.Recast.DemoTool
|
||||||
|
{
|
||||||
|
public class Sample
|
||||||
|
{
|
||||||
|
private DemoInputGeomProvider _inputGeom;
|
||||||
|
private DtNavMesh _navMesh;
|
||||||
|
private DtNavMeshQuery _navMeshQuery;
|
||||||
|
private readonly RcSampleSettings _settings;
|
||||||
|
private IList<RecastBuilderResult> _recastResults;
|
||||||
|
private bool _changed;
|
||||||
|
|
||||||
|
public Sample(DemoInputGeomProvider inputGeom, IList<RecastBuilderResult> recastResults, DtNavMesh navMesh)
|
||||||
|
{
|
||||||
|
_inputGeom = inputGeom;
|
||||||
|
_recastResults = recastResults;
|
||||||
|
_navMesh = navMesh;
|
||||||
|
_settings = new RcSampleSettings();
|
||||||
|
|
||||||
|
SetQuery(navMesh);
|
||||||
|
_changed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetQuery(DtNavMesh navMesh)
|
||||||
|
{
|
||||||
|
_navMeshQuery = navMesh != null ? new DtNavMeshQuery(navMesh) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DemoInputGeomProvider GetInputGeom()
|
||||||
|
{
|
||||||
|
return _inputGeom;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IList<RecastBuilderResult> GetRecastResults()
|
||||||
|
{
|
||||||
|
return _recastResults;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DtNavMesh GetNavMesh()
|
||||||
|
{
|
||||||
|
return _navMesh;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RcSampleSettings GetSettings()
|
||||||
|
{
|
||||||
|
return _settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DtNavMeshQuery GetNavMeshQuery()
|
||||||
|
{
|
||||||
|
return _navMeshQuery;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsChanged()
|
||||||
|
{
|
||||||
|
return _changed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetChanged(bool changed)
|
||||||
|
{
|
||||||
|
_changed = changed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(DemoInputGeomProvider geom, IList<RecastBuilderResult> recastResults, DtNavMesh navMesh)
|
||||||
|
{
|
||||||
|
_inputGeom = geom;
|
||||||
|
_recastResults = recastResults;
|
||||||
|
_navMesh = navMesh;
|
||||||
|
SetQuery(navMesh);
|
||||||
|
_changed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue