manifold cap

This commit is contained in:
Erin Catto 2026-11-17 10:00:53 -08:00
commit 146966401f
13 changed files with 565 additions and 120 deletions

View file

@ -1088,9 +1088,8 @@ void Sample::DrawMetrics()
ImGui::Text( "toi %d / %d / %d", s.distanceIterations, s.pushBackIterations, s.rootIterations );
ImGui::SetItemTooltip( "TOI distance / push back / root iterations" );
// The world clamps into the second to last bucket, so the last is always empty and the
// second to last means that many or more
constexpr int manifoldBarCount = manifoldBucketCount - 1;
// One bucket per manifold count, up to the cap
constexpr int manifoldBarCount = manifoldBucketCount;
int totalManifolds = 0;
int maxManifolds = 0;
ImU32 manifoldColors[manifoldBarCount];
@ -1107,8 +1106,7 @@ void Sample::DrawMetrics()
DrawBarChart( "##manifolds", s.manifoldCounts, manifoldColors, manifoldBarCount, maxManifolds, manifoldSize );
if ( hoveredBucket >= 0 )
{
const char* plus = hoveredBucket == manifoldBarCount - 1 ? "+" : "";
ImGui::SetTooltip( "%d%s manifolds: %d of %d pairs", hoveredBucket + 1, plus, s.manifoldCounts[hoveredBucket],
ImGui::SetTooltip( "%d manifolds: %d of %d pairs", hoveredBucket + 1, s.manifoldCounts[hoveredBucket],
totalManifolds );
}