Recast: draw original navmesh bounds if changed

This is useful when a project file (.GSET) has been loaded with predetermined navmesh bounds, which allows you to check the new bounds to the old, and also see what you will be resetting too if mistakes were made during the modification thereof.
This commit is contained in:
Kawe Mazidjatari 2024-07-16 13:59:12 +02:00
parent 62a65df532
commit be50fa5cb5

View File

@ -34,14 +34,23 @@ static void EditorCommon_DrawInputGeometry(duDebugDraw* const dd, const InputGeo
static void EditorCommon_DrawBoundingBox(duDebugDraw* const dd, const InputGeom* const geom)
{
// Draw bounds
const float* const origBmin = geom->getMeshBoundsMin();
const float* const origBmax = geom->getMeshBoundsMax();
// Draw Mesh bounds
duDebugDrawBoxWire(dd, origBmin[0], origBmin[1], origBmin[2], origBmax[0], origBmax[1], origBmax[2], duRGBA(255, 255, 255, 170), 1.0f, nullptr);
const float* const origNavBmin = geom->getOriginalNavMeshBoundsMin();
const float* const origNavBmax = geom->getOriginalNavMeshBoundsMax();
const float* const navBmin = geom->getNavMeshBoundsMin();
const float* const navBmax = geom->getNavMeshBoundsMax();
// Draw Original NavMesh bounds (e.g. when loading from a .gset with a predetermined NavMesh bound that differs from the mesh bound)
if ((!rdVequal(origBmin, origNavBmin) || !rdVequal(origBmax, origNavBmax)) && (!rdVequal(navBmin, origNavBmin) || !rdVequal(navBmax, origNavBmax)))
duDebugDrawBoxWire(dd, origNavBmin[0], origNavBmin[1], origNavBmin[2], origNavBmax[0], origNavBmax[1], origNavBmax[2], duRGBA(0, 80, 255, 215), 1.0f, nullptr);
// Draw NavMesh bounds
if (!rdVequal(origBmin, navBmin) || !rdVequal(origBmax, navBmax))
duDebugDrawBoxWire(dd, navBmin[0], navBmin[1], navBmin[2], navBmax[0], navBmax[1], navBmax[2], duRGBA(0, 255, 0, 215), 1.0f, nullptr);
}