forked from mirror/DotRecast
tile selecting
This commit is contained in:
parent
1ff0f85b1f
commit
9381b5b8ff
|
@ -4,6 +4,7 @@ using DotRecast.Recast.Demo.Draw;
|
||||||
using DotRecast.Recast.DemoTool;
|
using DotRecast.Recast.DemoTool;
|
||||||
using DotRecast.Recast.DemoTool.Tools;
|
using DotRecast.Recast.DemoTool.Tools;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
|
using Silk.NET.Vulkan;
|
||||||
using static DotRecast.Recast.Demo.Draw.DebugDraw;
|
using static DotRecast.Recast.Demo.Draw.DebugDraw;
|
||||||
using static DotRecast.Recast.Demo.Draw.DebugDrawPrimitives;
|
using static DotRecast.Recast.Demo.Draw.DebugDrawPrimitives;
|
||||||
|
|
||||||
|
@ -64,19 +65,29 @@ public class TileTool : IRcTool
|
||||||
|
|
||||||
public void HandleRender(NavMeshRenderer renderer)
|
public void HandleRender(NavMeshRenderer renderer)
|
||||||
{
|
{
|
||||||
|
var dd = renderer.GetDebugDraw();
|
||||||
if (_hitPosSet)
|
if (_hitPosSet)
|
||||||
{
|
{
|
||||||
RecastDebugDraw dd = renderer.GetDebugDraw();
|
|
||||||
var s = _impl.GetSample().GetSettings().agentRadius;
|
var s = _impl.GetSample().GetSettings().agentRadius;
|
||||||
dd.Begin(LINES, 2.0f);
|
dd.Begin(LINES, 2.0f);
|
||||||
dd.Vertex(_hitPos[0] - s, _hitPos[1] + 0.1f, _hitPos[2], DuRGBA(0, 0, 0, 128));
|
dd.Vertex(_hitPos.x - s, _hitPos.y + 0.1f, _hitPos.z, DuRGBA(0, 0, 0, 128));
|
||||||
dd.Vertex(_hitPos[0] + s, _hitPos[1] + 0.1f, _hitPos[2], DuRGBA(0, 0, 0, 128));
|
dd.Vertex(_hitPos.x + s, _hitPos.y + 0.1f, _hitPos.z, DuRGBA(0, 0, 0, 128));
|
||||||
dd.Vertex(_hitPos[0], _hitPos[1] - s + 0.1f, _hitPos[2], DuRGBA(0, 0, 0, 128));
|
dd.Vertex(_hitPos.x, _hitPos.y - s + 0.1f, _hitPos.z, DuRGBA(0, 0, 0, 128));
|
||||||
dd.Vertex(_hitPos[0], _hitPos[1] + s + 0.1f, _hitPos[2], DuRGBA(0, 0, 0, 128));
|
dd.Vertex(_hitPos.x, _hitPos.y + s + 0.1f, _hitPos.z, DuRGBA(0, 0, 0, 128));
|
||||||
dd.Vertex(_hitPos[0], _hitPos[1] + 0.1f, _hitPos[2] - s, DuRGBA(0, 0, 0, 128));
|
dd.Vertex(_hitPos.x, _hitPos.y + 0.1f, _hitPos.z - s, DuRGBA(0, 0, 0, 128));
|
||||||
dd.Vertex(_hitPos[0], _hitPos[1] + 0.1f, _hitPos[2] + s, DuRGBA(0, 0, 0, 128));
|
dd.Vertex(_hitPos.x, _hitPos.y + 0.1f, _hitPos.z + s, DuRGBA(0, 0, 0, 128));
|
||||||
dd.End();
|
dd.End();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_hitPosSet)
|
||||||
|
{
|
||||||
|
RcVec3f m_lastBuiltTileBmin = _hitPos - RcVec3f.One;
|
||||||
|
RcVec3f m_lastBuiltTileBmax = _hitPos + RcVec3f.One;
|
||||||
|
dd.DebugDrawBoxWire(
|
||||||
|
m_lastBuiltTileBmin.x, m_lastBuiltTileBmin.y, m_lastBuiltTileBmin.z,
|
||||||
|
m_lastBuiltTileBmax.x, m_lastBuiltTileBmax.y, m_lastBuiltTileBmax.z,
|
||||||
|
DuRGBA(255, 255, 255, 64), 1.0f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HandleUpdate(float dt)
|
public void HandleUpdate(float dt)
|
||||||
|
|
Loading…
Reference in New Issue