mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Recast: properly tag unlinked poly's to disable them
In the future we actually want to get rid of unlinked polygons, see https://groups.google.com/g/recastnavigation/c/WLMRcDjsxFc for reference.
This commit is contained in:
parent
06b673dc84
commit
91d36cf007
@ -169,9 +169,13 @@ static void disableUnvisitedPolys(dtNavMesh* nav, NavmeshFlags* flags)
|
||||
const dtPolyRef ref = base | (unsigned int)j;
|
||||
if (!flags->getFlags(ref))
|
||||
{
|
||||
unsigned short f = 0;
|
||||
nav->getPolyFlags(ref, &f);
|
||||
nav->setPolyFlags(ref, f | EDITOR_POLYFLAGS_DISABLED);
|
||||
const dtMeshTile* targetTile;
|
||||
dtPoly* targetPoly;
|
||||
|
||||
nav->getTileAndPolyByRefUnsafe(ref, &targetTile, (const dtPoly**)&targetPoly);
|
||||
targetPoly->groupId = DT_UNLINKED_POLY_GROUP;
|
||||
targetPoly->firstLink = DT_NULL_LINK;
|
||||
targetPoly->flags = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -218,6 +222,7 @@ void NavMeshPruneTool::handleMenu()
|
||||
if (ImGui::Button("Prune Unselected"))
|
||||
{
|
||||
disableUnvisitedPolys(nav, m_flags);
|
||||
m_editor->updateStaticPathingData();
|
||||
delete m_flags;
|
||||
m_flags = 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user