Moved nav mesh generation button onto navmeshVolume component.
This commit is contained in:
@@ -48,6 +48,26 @@ public:
|
||||
ImGui::PopStyleColor();
|
||||
}
|
||||
ImGui::TableNextColumn();
|
||||
{
|
||||
CompononentPropertyName("Only include map");
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
Vector3 volumeSize = component.VolumeSize;
|
||||
|
||||
UI::CheckBox("##onlyIncludeMapGeo", component.OnlyIncludeMapGeometry);
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(1, 1, 1, 0));
|
||||
std::string resetLabel = std::string(ICON_FA_UNDO) + "##ResetOnlyIncludeGeo";
|
||||
if (ImGui::Button(resetLabel.c_str()))
|
||||
{
|
||||
component.OnlyIncludeMapGeometry = true;
|
||||
}
|
||||
|
||||
ImGui::PopStyleColor();
|
||||
}
|
||||
ImGui::TableNextColumn();
|
||||
{
|
||||
CompononentPropertyName("Generate");
|
||||
|
||||
@@ -55,7 +75,28 @@ public:
|
||||
|
||||
if (UI::SecondaryButton("Generate"))
|
||||
{
|
||||
if (component.OnlyIncludeMapGeometry)
|
||||
{
|
||||
auto view = Engine::GetCurrentScene()->m_Registry.view<TransformComponent, QuakeMapComponent>();
|
||||
for (auto e : view)
|
||||
{
|
||||
auto [transform, map] = view.get<TransformComponent, QuakeMapComponent>(e);
|
||||
|
||||
for (auto& b : map.m_Brushes)
|
||||
{
|
||||
if (b.HasComponent<ModelComponent>())
|
||||
{
|
||||
TransformComponent& transformComponent = b.GetComponent<TransformComponent>();
|
||||
for (auto& mesh : b.GetComponent<ModelComponent>().ModelResource->GetMeshes())
|
||||
{
|
||||
Nuake::NavManager::Get().PushMesh(mesh, transformComponent.GetGlobalTransform());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NavManager::Get().BuildNavMesh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
Reference in New Issue
Block a user