Hull sharing (#13)

Save memory when there are many duplicate hulls. Can improve performance
in some cases.

For consistency with b3MeshData, b3Hull is renamed to b3HullData.
This commit is contained in:
Erin Catto 2026-06-11 22:39:26 -07:00 • committed by GitHub
commit a252f03b19
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
66 changed files with 881 additions and 549 deletions

View file

@ -1119,7 +1119,7 @@ void Sample::MouseDown( b3Vec2 p, int button, int modifiers )
bodyDef.linearVelocity = ( 10.0f * m_launchSpeedScale ) * direction;
b3BodyId bodyId = b3CreateBody( m_worldId, &bodyDef );
b3Hull* hull = b3CreateCylinder( 2.0f, 0.15f, 0.0f, 6 );
b3HullData* hull = b3CreateCylinder( 2.0f, 0.15f, 0.0f, 6 );
b3CreateHullShape( bodyId, &shapeDef, hull );
b3DestroyHull( hull );
}
@ -1465,13 +1465,9 @@ static void DrawMenuBar( SampleContext* context )
{
context->sample->ResetProfile();
}
if ( ImGui::MenuItem( "Dump" ) )
if ( ImGui::MenuItem( "Dump Mem Stats" ) )
{
b3World_Dump( context->sample->m_worldId );
}
if ( ImGui::MenuItem( "Dump Awake" ) )
{
b3World_DumpAwake( context->sample->m_worldId );
b3World_DumpMemoryStats( context->sample->m_worldId );
}
ImGui::Separator();
if ( ImGui::MenuItem( "Quit", "Esc" ) )