Add bake button to nav mesh bounds and minor improvements

This commit is contained in:
Wojtek Figat
2026-01-30 13:12:45 +01:00
parent 9fc9382e58
commit e4eb064562
3 changed files with 59 additions and 3 deletions

View File

@@ -5,6 +5,9 @@
#include "NavMesh.h"
#include "Engine/Core/Log.h"
#include "Engine/Core/Random.h"
#if COMPILE_WITH_DEBUG_DRAW
#include "Engine/Level/Scene/Scene.h"
#endif
#include "Engine/Profiler/ProfilerCPU.h"
#include "Engine/Profiler/ProfilerMemory.h"
#include "Engine/Threading/Threading.h"
@@ -603,7 +606,21 @@ void NavMeshRuntime::DebugDraw()
if (!tile->header)
continue;
//DebugDraw::DrawWireBox(*(BoundingBox*)&tile->header->bmin[0], Color::CadetBlue);
#if 0
// Debug draw tile bounds and owner scene name
BoundingBox tileBounds = *(BoundingBox*)&tile->header->bmin[0];
DebugDraw::DrawWireBox(tileBounds, Color::CadetBlue);
// TODO: build map from tile coords to tile data to avoid this loop
for (const auto& e : _tiles)
{
if (e.X == tile->header->x && e.Y == tile->header->y && e.Layer == tile->header->layer)
{
if (e.NavMesh && e.NavMesh->GetScene())
DebugDraw::DrawText(e.NavMesh->GetScene()->GetName(), tileBounds.Minimum + tileBounds.GetSize() * Float3(0.5f, 0.8f, 0.5f), Color::CadetBlue);
break;
}
}
#endif
for (int i = 0; i < tile->header->polyCount; i++)
{