Added Recast&Detour implementation

- Implemented debug renderer of navigation meshes
- Can now generate navigation meshes from .map files
This commit is contained in:
Antoine Pilote
2024-07-11 04:54:57 -04:00
parent cc87da1001
commit 7b48319ff5
14 changed files with 592 additions and 6 deletions

View File

@@ -3,6 +3,7 @@
#include <src/Scene/Components/QuakeMap.h>
#include "src/Scene/Systems/QuakeMapBuilder.h"
#include <src/Core/FileSystem.h>
#include <src/AI/NavManager.h>
class QuakeMapPanel : ComponentPanel {
@@ -74,6 +75,32 @@ public:
//ComponentTableReset(component.Class, "");
}
ImGui::TableNextColumn();
{
using namespace Nuake;
ImGui::Text("Build Navigation Mesh");
ImGui::TableNextColumn();
if (ImGui::Button("Build Navigation"))
{
for (auto& mesh : component.m_Brushes)
{
if (mesh.HasComponent<ModelComponent>())\
{
TransformComponent& transformComponent = mesh.GetComponent<TransformComponent>();
for (auto& mesh : mesh.GetComponent<ModelComponent>().ModelResource->GetMeshes())
{
Nuake::NavManager::Get().PushMesh(mesh, transformComponent.GetGlobalTransform());
}
}
}
Nuake::NavManager::Get().BuildNavMesh();
}
ImGui::TableNextColumn();
}
}
EndComponentTable();
}