diff --git a/src/naveditor/Editor_Common.cpp b/src/naveditor/Editor_Common.cpp index 2bf545e0..72083af0 100644 --- a/src/naveditor/Editor_Common.cpp +++ b/src/naveditor/Editor_Common.cpp @@ -260,6 +260,11 @@ void Editor_StaticTileMeshCommon::renderRecastDebugMenu() ImGui::EndDisabled(); + isEnabled = getTileMeshDrawFlags() & DU_DRAW_RECASTMESH_SHAPE_VOLUMES; + + if (ImGui::Checkbox("Shape Volumes", &isEnabled)) + toggleTileMeshDrawFlag(DU_DRAW_RECASTMESH_SHAPE_VOLUMES); + //if (intermediateDataUnavailable) // todo(amos): tool tip //{ // ImGui::Separator(); @@ -382,16 +387,20 @@ void Editor_StaticTileMeshCommon::renderTileMeshData() } int selectedVolumeIndex = -1; - if (m_tool->type() == TOOL_SHAPE_VOLUME) + const bool isShapeVolumeTool = (m_tool->type() == TOOL_SHAPE_VOLUME); + + if (isShapeVolumeTool) { const ShapeVolumeTool* volTool = (const ShapeVolumeTool*)m_tool; selectedVolumeIndex = volTool->getSelectedVolumeIndex(); } - // TODO: also add flags for this - m_geom->drawBoxVolumes(&m_dd, recastDrawOffset, selectedVolumeIndex); - m_geom->drawCylinderVolumes(&m_dd, recastDrawOffset, selectedVolumeIndex); - m_geom->drawConvexVolumes(&m_dd, recastDrawOffset, selectedVolumeIndex); + if ((recastDrawFlags & DU_DRAW_RECASTMESH_SHAPE_VOLUMES) || isShapeVolumeTool) + { + m_geom->drawBoxVolumes(&m_dd, recastDrawOffset, selectedVolumeIndex); + m_geom->drawCylinderVolumes(&m_dd, recastDrawOffset, selectedVolumeIndex); + m_geom->drawConvexVolumes(&m_dd, recastDrawOffset, selectedVolumeIndex); + } // NOTE: commented out because this already gets rendered when the off-mesh // connection tool is activated. And if we generated an off-mesh link, this @@ -586,10 +595,21 @@ void Editor_DynamicTileMeshCommon::renderTileMeshData() } } - // TODO: also add flags for this - m_geom->drawBoxVolumes(&m_dd, recastDrawOffset); - m_geom->drawCylinderVolumes(&m_dd, recastDrawOffset); - m_geom->drawConvexVolumes(&m_dd, recastDrawOffset); + int selectedVolumeIndex = -1; + const bool isShapeVolumeTool = (m_tool->type() == TOOL_SHAPE_VOLUME); + + if (isShapeVolumeTool) + { + const ShapeVolumeTool* volTool = (const ShapeVolumeTool*)m_tool; + selectedVolumeIndex = volTool->getSelectedVolumeIndex(); + } + + if ((recastDrawFlags & DU_DRAW_RECASTMESH_SHAPE_VOLUMES) || isShapeVolumeTool) + { + m_geom->drawBoxVolumes(&m_dd, recastDrawOffset, selectedVolumeIndex); + m_geom->drawCylinderVolumes(&m_dd, recastDrawOffset, selectedVolumeIndex); + m_geom->drawConvexVolumes(&m_dd, recastDrawOffset, selectedVolumeIndex); + } // NOTE: commented out because this already gets rendered when the off-mesh // connection tool is activated. And if we generated an off-mesh link, this diff --git a/src/thirdparty/recast/DebugUtils/Include/RecastDebugDraw.h b/src/thirdparty/recast/DebugUtils/Include/RecastDebugDraw.h index 6301c64c..9f1f1ca0 100644 --- a/src/thirdparty/recast/DebugUtils/Include/RecastDebugDraw.h +++ b/src/thirdparty/recast/DebugUtils/Include/RecastDebugDraw.h @@ -33,6 +33,7 @@ enum DrawRecastMeshFlags DU_DRAW_RECASTMESH_CONTOURS = 1<<9, DU_DRAW_RECASTMESH_POLYMESH = 1<<10, DU_DRAW_RECASTMESH_POLYMESH_DETAIL = 1<<11, + DU_DRAW_RECASTMESH_SHAPE_VOLUMES = 1<<12, }; void duDebugDrawTriMesh(struct duDebugDraw* dd, const float* verts, int nverts, const int* tris, const float* normals, int ntris,