64-bit hashes (#126)

- ContactEvent sample
- Improved shadows
- #120 
- Triangle collision fixes
This commit is contained in:
Erin Catto 2026-08-11 18:08:34 -07:00 • committed by GitHub
commit f42be210a2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
49 changed files with 19835 additions and 17544 deletions

View file

@ -658,6 +658,10 @@ static void b3CollideTask( int startIndex, int endIndex, int workerIndex, void*
if ( ( isFast == false || isMeshContact == false ) && recycleDistance > 0.0f &&
( contact->flags & b3_relativeTransformValid ) && ( contact->flags & b3_contactRecycleFlag ) )
{
// The scalar part of b3InvMulQuat is just the quaternion dot product.
// cos(relative_angle/2) = scalar(conj(q1) * q2) = dot(q1, q2)
// A small relative angle means this value is close to 1. Need to use abs or square
// due to double cover.
float angleA = b3DotQuat( transformA.q, contact->cachedRotationA );
float angleB = b3DotQuat( transformB.q, contact->cachedRotationB );
float angularDistance = b3MinFloat( angleA * angleA, angleB * angleB );
@ -1433,17 +1437,19 @@ void b3World_Draw( b3WorldId worldId, b3DebugDraw* draw, uint64_t maskBits )
}
}
if ( draw->drawMass && body->type == b3_dynamicBody )
if ( draw->drawMass )
{
b3Vec3 offset = { 0.05f, 0.05f, 0.05f };
b3WorldTransform transform = { bodySim->center, bodySim->transform.q };
draw->DrawTransformFcn( transform, draw->context );
b3Pos p = b3TransformWorldPoint( transform, offset );
char buffer[32];
snprintf( buffer, 32, "%.2f", body->mass );
draw->DrawStringFcn( p, buffer, b3_colorWhite, draw->context );
if (body->type == b3_dynamicBody)
{
b3Vec3 offset = { 0.05f, 0.05f, 0.05f };
b3Pos p = b3TransformWorldPoint( transform, offset );
char buffer[32];
snprintf( buffer, 32, "%.2f", body->mass );
draw->DrawStringFcn( p, buffer, b3_colorWhite, draw->context );
}
}
if ( draw->drawSleep )