tile selecting

This commit is contained in:
ikpil 2023-07-27 00:30:01 +09:00
parent 1ff0f85b1f
commit 9381b5b8ff
1 changed files with 18 additions and 7 deletions

View File

@ -4,6 +4,7 @@ using DotRecast.Recast.Demo.Draw;
using DotRecast.Recast.DemoTool;
using DotRecast.Recast.DemoTool.Tools;
using ImGuiNET;
using Silk.NET.Vulkan;
using static DotRecast.Recast.Demo.Draw.DebugDraw;
using static DotRecast.Recast.Demo.Draw.DebugDrawPrimitives;
@ -64,19 +65,29 @@ public class TileTool : IRcTool
public void HandleRender(NavMeshRenderer renderer)
{
var dd = renderer.GetDebugDraw();
if (_hitPosSet)
{
RecastDebugDraw dd = renderer.GetDebugDraw();
var s = _impl.GetSample().GetSettings().agentRadius;
dd.Begin(LINES, 2.0f);
dd.Vertex(_hitPos[0] - s, _hitPos[1] + 0.1f, _hitPos[2], DuRGBA(0, 0, 0, 128));
dd.Vertex(_hitPos[0] + s, _hitPos[1] + 0.1f, _hitPos[2], DuRGBA(0, 0, 0, 128));
dd.Vertex(_hitPos[0], _hitPos[1] - s + 0.1f, _hitPos[2], DuRGBA(0, 0, 0, 128));
dd.Vertex(_hitPos[0], _hitPos[1] + s + 0.1f, _hitPos[2], DuRGBA(0, 0, 0, 128));
dd.Vertex(_hitPos[0], _hitPos[1] + 0.1f, _hitPos[2] - 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 - s, _hitPos.y + 0.1f, _hitPos.z, DuRGBA(0, 0, 0, 128));
dd.Vertex(_hitPos.x + s, _hitPos.y + 0.1f, _hitPos.z, DuRGBA(0, 0, 0, 128));
dd.Vertex(_hitPos.x, _hitPos.y - s + 0.1f, _hitPos.z, DuRGBA(0, 0, 0, 128));
dd.Vertex(_hitPos.x, _hitPos.y + s + 0.1f, _hitPos.z, DuRGBA(0, 0, 0, 128));
dd.Vertex(_hitPos.x, _hitPos.y + 0.1f, _hitPos.z - s, DuRGBA(0, 0, 0, 128));
dd.Vertex(_hitPos.x, _hitPos.y + 0.1f, _hitPos.z + s, DuRGBA(0, 0, 0, 128));
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)