Improve convex volume creation/drawing

* Improved ground convex visibility (changed to red as this acts as deletion).
* Default m_areaType to SAMPLE_POLYAREA_GROUND.
This commit is contained in:
Kawe Mazidjatari 2022-07-27 14:44:42 +02:00
parent 0576749de0
commit 369c92e358
2 changed files with 15 additions and 3 deletions

View File

@ -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),

View File

@ -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];