Name cache (#53)

Removed B3_BODY_NAME_LENGTH and B3_SHAPE_NAME_LENGTH.
Now using a name cache instead to save memory and make recordings more
universal.
This is a recording version bump.
This commit is contained in:
Erin Catto 2026-07-06 17:33:45 -07:00 • committed by GitHub
commit 52f1a254ad
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
31 changed files with 759 additions and 824 deletions

View file

@ -186,8 +186,4 @@ B3_API void b3Sleep( int milliseconds );
#define B3_HASH_INIT 5381
B3_API uint32_t b3Hash( uint32_t hash, const uint8_t* data, int count );
// Dump file support functions
B3_API void b3WriteBinaryFile( void* data, int size, const char* fileName );
B3_API void* b3ReadBinaryFile( const char* prefix, const char* fileName, int* memSize );
//! @endcond

View file

@ -245,13 +245,6 @@ B3_API void b3World_RebuildStaticTree( b3WorldId worldId );
/// This is for internal testing
B3_API void b3World_EnableSpeculative( b3WorldId worldId, bool flag );
/// Dump world to a text file. Saves only awake bodies and associated static bodies.
/// Meshes are saved to binary b3m files.
B3_API void b3World_DumpAwake( b3WorldId worldId );
/// Dump world to a text file. Meshes are saved to binary b3m files.
B3_API void b3World_Dump( b3WorldId worldId );
/**
* @defgroup recording Recording
* @brief Record and replay world state for debugging.
@ -508,10 +501,10 @@ B3_API b3BodyType b3Body_GetType( b3BodyId bodyId );
/// properties regardless of the automatic mass setting.
B3_API void b3Body_SetType( b3BodyId bodyId, b3BodyType type );
/// Set the body name. Up to B3_BODY_NAME_LENGTH characters excluding null termination.
/// Set the body name.
B3_API void b3Body_SetName( b3BodyId bodyId, const char* name );
/// Get the body name.
/// Get the body name. Returns an empty string if the name isn't set.
B3_API const char* b3Body_GetName( b3BodyId bodyId );
/// Set the user data for a body
@ -846,10 +839,10 @@ B3_API b3WorldId b3Shape_GetWorld( b3ShapeId shapeId );
/// Returns true if the shape is a sensor
B3_API bool b3Shape_IsSensor( b3ShapeId shapeId );
/// Set the shape name. Up to B3_SHAPE_NAME_LENGTH characters excluding null termination.
/// Set the shape name.
B3_API void b3Shape_SetName( b3ShapeId shapeId, const char* name );
/// Get the shape name.
/// Get the shape name. Returns an empty string if the name isn't set.
B3_API const char* b3Shape_GetName( b3ShapeId shapeId );
/// Set the user data for a shape

View file

@ -97,16 +97,6 @@ B3_API float b3GetStallThreshold( void );
/// The time that a body must be still before it will go to sleep. In seconds.
#define B3_TIME_TO_SLEEP 0.5f
/// Maximum length of the body name. Can be 0 if you don't need names.
#ifndef B3_BODY_NAME_LENGTH
#define B3_BODY_NAME_LENGTH 18
#endif
/// Maximum length of the shape name. Can be 0 if you don't need names.
#ifndef B3_SHAPE_NAME_LENGTH
#define B3_SHAPE_NAME_LENGTH 0
#endif
/// The maximum number of contact points between two touching shapes.
#define B3_MAX_MANIFOLD_POINTS 4

View file

@ -302,7 +302,7 @@ typedef struct b3BodyDef
/// Sleep speed threshold, default is 0.05 meters per second
float sleepThreshold;
/// Optional body name for debugging. Up to B3_BODY_NAME_LENGTH characters (including null termination)
/// Optional body name for debugging.
const char* name;
/// Use this to store application specific body data.