From 369c92e3589df4b4203ac59d567520033e2724c0 Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Wed, 27 Jul 2022 14:44:42 +0200 Subject: [PATCH] Improve convex volume creation/drawing * Improved ground convex visibility (changed to red as this acts as deletion). * Default m_areaType to SAMPLE_POLYAREA_GROUND. --- r5dev/naveditor/ConvexVolumeTool.cpp | 2 +- r5dev/naveditor/InputGeom.cpp | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/r5dev/naveditor/ConvexVolumeTool.cpp b/r5dev/naveditor/ConvexVolumeTool.cpp index e1234727..fdad5bca 100644 --- a/r5dev/naveditor/ConvexVolumeTool.cpp +++ b/r5dev/naveditor/ConvexVolumeTool.cpp @@ -90,7 +90,7 @@ static int pointInPoly(int nvert, const float* verts, const float* p) ConvexVolumeTool::ConvexVolumeTool() : m_sample(0), - m_areaType(SAMPLE_POLYAREA_GRASS), + m_areaType(SAMPLE_POLYAREA_GROUND), m_polyOffset(0.0f), m_boxHeight(500.0f), m_boxDescent(250.0f), diff --git a/r5dev/naveditor/InputGeom.cpp b/r5dev/naveditor/InputGeom.cpp index 77caf0f9..26314f46 100644 --- a/r5dev/naveditor/InputGeom.cpp +++ b/r5dev/naveditor/InputGeom.cpp @@ -593,7 +593,13 @@ void InputGeom::drawConvexVolumes(struct duDebugDraw* dd, bool /*hilight*/) for (int i = 0; i < m_volumeCount; ++i) { const ConvexVolume* vol = &m_volumes[i]; - unsigned int col = duTransCol(dd->areaToCol(vol->area), 32); + unsigned int col; + + if (vol->area == SAMPLE_POLYAREA_GROUND) + col = duRGBA(255, 0, 0, 32); // Use red for visibility (ground acts as deletion). + else + col = duTransCol(dd->areaToCol(vol->area), 32); + for (int j = 0, k = vol->nverts-1; j < vol->nverts; k = j++) { const float* va = &vol->verts[k*3]; @@ -617,7 +623,13 @@ void InputGeom::drawConvexVolumes(struct duDebugDraw* dd, bool /*hilight*/) for (int i = 0; i < m_volumeCount; ++i) { const ConvexVolume* vol = &m_volumes[i]; - unsigned int col = duTransCol(dd->areaToCol(vol->area), 220); + unsigned int col; + + if (vol->area == SAMPLE_POLYAREA_GROUND) + col = duRGBA(255, 0, 0, 220); // Use red for visibility (ground acts as deletion). + else + col = duTransCol(dd->areaToCol(vol->area), 220); + for (int j = 0, k = vol->nverts-1; j < vol->nverts; k = j++) { const float* va = &vol->verts[k*3];