Box3D 0.1.0
A 3D physics engine for games
Loading...
Searching...
No Matches

These ids serve as handles to internal Box3D objects. More...

Data Structures

struct  b3WorldId
 World id references a world instance. This should be treated as an opaque handle. More...
struct  b3BodyId
 Body id references a body instance. This should be treated as an opaque handle. More...
struct  b3ShapeId
 Shape id references a shape instance. This should be treated as an opaque handle. More...
struct  b3JointId
 Joint id references a joint instance. This should be treated as an opaque handle. More...
struct  b3ContactId
 Contact id references a contact instance. This should be treated as an opaque handle. More...

Macros

#define B3_NULL_ID   { 0 }
 A null id. Works for any id type.
#define B3_ID_INLINE   static inline
 This macro bridges C and C++ inline functions. C++ has the one definition rule that C lacks.
#define B3_IS_NULL(id)
 Macro to determine if any id is null.
#define B3_IS_NON_NULL(id)
 Macro to determine if any id is non-null.
#define B3_ID_EQUALS(id1, id2)
 Compare two ids for equality. Doesn't work for b3WorldId. Don't mix types.

Functions

B3_ID_INLINE uint32_t b3StoreWorldId (b3WorldId id)
 Store a world id into a uint32_t.
B3_ID_INLINE b3WorldId b3LoadWorldId (uint32_t x)
 Load a uint32_t into a world id.
B3_ID_INLINE uint64_t b3StoreBodyId (b3BodyId id)
 Store a body id into a uint64_t.
B3_ID_INLINE b3BodyId b3LoadBodyId (uint64_t x)
 Load a uint64_t into a body id.
B3_ID_INLINE uint64_t b3StoreShapeId (b3ShapeId id)
 Store a shape id into a uint64_t.
B3_ID_INLINE b3ShapeId b3LoadShapeId (uint64_t x)
 Load a uint64_t into a shape id.
B3_ID_INLINE uint64_t b3StoreJointId (b3JointId id)
 Store a joint id into a uint64_t.
B3_ID_INLINE b3JointId b3LoadJointId (uint64_t x)
 Load a uint64_t into a joint id.
B3_ID_INLINE void b3StoreContactId (b3ContactId id, uint32_t values[3])
 Store a contact id into three uint32 values.
B3_ID_INLINE b3ContactId b3LoadContactId (uint32_t values[3])
 Load a contact id from three uint32 values.

Detailed Description

These ids serve as handles to internal Box3D objects.

These should be considered opaque data and passed by value. Include this header if you need the id types and not the whole Box3D API. All ids are considered null if initialized to zero.

For example in C++:

b3WorldId worldId = {};
World id references a world instance. This should be treated as an opaque handle.
Definition id.h:38

Or in C:

b3WorldId worldId = {0};

These are both considered null.

Warning
Do not use the internals of these ids. They are subject to change. Ids should be treated as opaque objects.
You should use ids to access objects in Box3D. Do not access files within the src folder. Such usage is unsupported.

Data Structure Documentation

◆ b3WorldId

struct b3WorldId

World id references a world instance. This should be treated as an opaque handle.

Data Fields
uint16_t generation
uint16_t index1

◆ b3BodyId

struct b3BodyId

Body id references a body instance. This should be treated as an opaque handle.

Data Fields
uint16_t generation
int32_t index1
uint16_t world0

◆ b3ShapeId

struct b3ShapeId

Shape id references a shape instance. This should be treated as an opaque handle.

Data Fields
uint16_t generation
int32_t index1
uint16_t world0

◆ b3JointId

struct b3JointId

Joint id references a joint instance. This should be treated as an opaque handle.

Data Fields
uint16_t generation
int32_t index1
uint16_t world0

◆ b3ContactId

struct b3ContactId

Contact id references a contact instance. This should be treated as an opaque handle.

Data Fields
uint32_t generation
int32_t index1
int16_t padding
uint16_t world0

Macro Definition Documentation

◆ B3_ID_EQUALS

#define B3_ID_EQUALS ( id1,
id2 )
Value:
( id1.index1 == id2.index1 && id1.world0 == id2.world0 && id1.generation == id2.generation )

Compare two ids for equality. Doesn't work for b3WorldId. Don't mix types.

◆ B3_IS_NON_NULL

#define B3_IS_NON_NULL ( id)
Value:
( id.index1 != 0 )

Macro to determine if any id is non-null.

◆ B3_IS_NULL

#define B3_IS_NULL ( id)
Value:
( id.index1 == 0 )

Macro to determine if any id is null.