SIMD hull collision (#93)

SIMD based hull collision inspired by example code from @cairnc in #54 

<img width="1676" height="1332" alt="image"
src="https://github.com/user-attachments/assets/58b137bd-bf7b-4c99-863c-64341b973a3d"
/>

- Fixed #78
- Fixed #85 and fixed CI to error on UB.
- Updated benchmarks
- Added AMD scalar benchmarks
- Added Neon benchmarks
- More determinism unit tests
- Sample leak detection
- Added b3Body_AllowFastRotation
- Added b3Body_IsFastRotationAllowed
- Bumped b3HullData version
- Bumped b3CompoundData version
This commit is contained in:
Erin Catto 2026-07-18 22:43:03 -07:00 • committed by GitHub
commit c37cfe4cd7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
84 changed files with 3898 additions and 1151 deletions

View file

@ -10,8 +10,6 @@
#include <assert.h>
#include <stdlib.h>
#define MESH_DROP_GRID_COUNT 32
MeshDropData CreateMeshDrop( b3WorldId worldId, b3Pos origin )
{
MeshDropData data = { 0 };
@ -61,6 +59,7 @@ MeshDropData CreateMeshDrop( b3WorldId worldId, b3Pos origin )
bodyDef.linearVelocity = linearVelocity;
bodyDef.angularVelocity = angularVelocity;
b3BodyId bodyId = b3CreateBody( worldId, &bodyDef );
data.bodies[i * gridCount + j] = bodyId;
b3CreateHullShape( bodyId, &shapeDef, &box.base );
}
@ -70,6 +69,29 @@ MeshDropData CreateMeshDrop( b3WorldId worldId, b3Pos origin )
return data;
}
bool UpdateMeshDrop( b3WorldId worldId, MeshDropData* data )
{
if ( data->hash == 0 )
{
if ( b3World_GetAwakeBodyCount( worldId ) == 0 )
{
data->hash = B3_HASH_INIT;
int bodyCount = MESH_DROP_GRID_COUNT * MESH_DROP_GRID_COUNT;
for ( int i = 0; i < bodyCount; ++i )
{
b3WorldTransform xf = b3Body_GetTransform( data->bodies[i] );
data->hash = b3Hash( data->hash, (uint8_t*)&xf, sizeof( b3WorldTransform ) );
}
data->sleepStep = data->stepCount;
}
}
data->stepCount += 1;
return data->hash != 0;
}
void DestroyMeshDrop( MeshDropData* data )
{
b3DestroyMesh( data->mesh );