|
Rapier C — 2D / f32 0.36.0+c.0
|
Create a world, configure integration, step, and serialize it. More...
Data Structures | |
| struct | R2IntegrationParameters |
| Plain configuration data; initialize defaults, edit, then apply. More... | |
Typedefs | |
| typedef struct R2Bytes | R2Bytes |
| Immutable owned byte buffer. | |
| typedef struct R2World | R2World |
| Sole owner of simulation state. | |
| typedef struct R2IntegrationParameters | R2IntegrationParameters |
| Plain configuration data; initialize defaults, edit, then apply. | |
Functions | |
| struct R2IntegrationParameters | r2DefaultIntegrationParameters (void) |
| Return native default integration parameters. | |
| struct R2IntegrationParameters | r2IntegrationParameters (const struct R2World *world) |
| Return a copy of all world integration settings. | |
| R2Status | r2SetIntegrationParameters (struct R2World *world, const struct R2IntegrationParameters *data) |
| Copies validated values; does not expose a writable alias to Rust memory. | |
| size_t | r2ActiveRigidBodies (const struct R2World *world, struct R2RigidBodyHandle *buffer, size_t capacity) |
| Copies the island manager's active body handles. | |
| R2Real | r2TimeStep (const struct R2World *world) |
| Return the world setting documented by R2IntegrationParameters::dt. | |
| R2Status | r2SetTimeStep (struct R2World *world, R2Real value) |
| Set the world setting documented by R2IntegrationParameters::dt. | |
| R2Real | r2MinCcdDt (const struct R2World *world) |
| Return the world setting documented by R2IntegrationParameters::minCcdDt. | |
| R2Status | r2SetMinCcdDt (struct R2World *world, R2Real value) |
| Set the world setting documented by R2IntegrationParameters::minCcdDt. | |
| R2Real | r2LengthUnit (const struct R2World *world) |
| Return the world setting documented by R2IntegrationParameters::lengthUnit. | |
| R2Status | r2SetLengthUnit (struct R2World *world, R2Real value) |
| Set the world setting documented by R2IntegrationParameters::lengthUnit. | |
| R2Real | r2WarmstartCoefficient (const struct R2World *world) |
| Return the world setting documented by R2IntegrationParameters::warmstartCoefficient. | |
| R2Status | r2SetWarmstartCoefficient (struct R2World *world, R2Real value) |
| Set the world setting documented by R2IntegrationParameters::warmstartCoefficient. | |
| R2Real | r2NormalizedAllowedLinearError (const struct R2World *world) |
| Return the world setting documented by R2IntegrationParameters::normalizedAllowedLinearError. | |
| R2Status | r2SetNormalizedAllowedLinearError (struct R2World *world, R2Real value) |
| Set the world setting documented by R2IntegrationParameters::normalizedAllowedLinearError. | |
| R2Real | r2NormalizedMaxCorrectiveVelocity (const struct R2World *world) |
| Return the world setting documented by R2IntegrationParameters::normalizedMaxCorrectiveVelocity. | |
| R2Status | r2SetNormalizedMaxCorrectiveVelocity (struct R2World *world, R2Real value) |
| Set the world setting documented by R2IntegrationParameters::normalizedMaxCorrectiveVelocity. | |
| R2Real | r2NormalizedPredictionDistance (const struct R2World *world) |
| Return the world setting documented by R2IntegrationParameters::normalizedPredictionDistance. | |
| R2Status | r2SetNormalizedPredictionDistance (struct R2World *world, R2Real value) |
| Set the world setting documented by R2IntegrationParameters::normalizedPredictionDistance. | |
| R2Real | r2NormalizedMaxLinearVelocity (const struct R2World *world) |
| Return the world setting documented by R2IntegrationParameters::normalizedMaxLinearVelocity. | |
| R2Status | r2SetNormalizedMaxLinearVelocity (struct R2World *world, R2Real value) |
| Set the world setting documented by R2IntegrationParameters::normalizedMaxLinearVelocity. | |
| R2Real | r2NormalizedContactRecycleDistance (const struct R2World *world) |
| Return the world setting documented by R2IntegrationParameters::normalizedContactRecycleDistance. | |
| R2Status | r2SetNormalizedContactRecycleDistance (struct R2World *world, R2Real value) |
| Set the world setting documented by R2IntegrationParameters::normalizedContactRecycleDistance. | |
| size_t | r2NumSolverIterations (const struct R2World *world) |
| Return the world setting documented by R2IntegrationParameters::numSolverIterations. | |
| R2Status | r2SetNumSolverIterations (struct R2World *world, size_t value) |
| Set the world setting documented by R2IntegrationParameters::numSolverIterations. | |
| size_t | r2NumInternalPgsIterations (const struct R2World *world) |
| Return the world setting documented by R2IntegrationParameters::numInternalPgsIterations. | |
| R2Status | r2SetNumInternalPgsIterations (struct R2World *world, size_t value) |
| Set the world setting documented by R2IntegrationParameters::numInternalPgsIterations. | |
| size_t | r2NumInternalStabilizationIterations (const struct R2World *world) |
| Return the world setting documented by R2IntegrationParameters::numInternalStabilizationIterations. | |
| R2Status | r2SetNumInternalStabilizationIterations (struct R2World *world, size_t value) |
| Set the world setting documented by R2IntegrationParameters::numInternalStabilizationIterations. | |
| size_t | r2MaxCcdSubsteps (const struct R2World *world) |
| Return the world setting documented by R2IntegrationParameters::maxCcdSubsteps. | |
| R2Status | r2SetMaxCcdSubsteps (struct R2World *world, size_t value) |
| Set the world setting documented by R2IntegrationParameters::maxCcdSubsteps. | |
| R2Bool | r2ContactClustering (const struct R2World *world) |
| Return the world setting documented by R2IntegrationParameters::contactClustering. | |
| R2Status | r2SetContactClustering (struct R2World *world, R2Bool value) |
| Set the world setting documented by R2IntegrationParameters::contactClustering. | |
| R2Bool | r2ContactRecycling (const struct R2World *world) |
| Return the world setting documented by R2IntegrationParameters::contactRecycling. | |
| R2Status | r2SetContactRecycling (struct R2World *world, R2Bool value) |
| Set the world setting documented by R2IntegrationParameters::contactRecycling. | |
| R2Bool | r2FrictionInBiasPass (const struct R2World *world) |
| Return the world setting documented by R2IntegrationParameters::frictionInBiasPass. | |
| R2Status | r2SetFrictionInBiasPass (struct R2World *world, R2Bool value) |
| Set the world setting documented by R2IntegrationParameters::frictionInBiasPass. | |
| R2Bool | r2WarmstartJoints (const struct R2World *world) |
| Return the world setting documented by R2IntegrationParameters::warmstartJoints. | |
| R2Status | r2SetWarmstartJoints (struct R2World *world, R2Bool value) |
| Set the world setting documented by R2IntegrationParameters::warmstartJoints. | |
| struct R2SpringCoefficients | r2ContactSoftness (const struct R2World *world) |
| Return the world setting documented by R2IntegrationParameters::contactSoftness. | |
| R2Status | r2SetContactSoftness (struct R2World *world, struct R2SpringCoefficients value) |
| Set the world setting documented by R2IntegrationParameters::contactSoftness. | |
| struct R2SpringCoefficients | r2StaticContactSoftness (const struct R2World *world) |
| Return the world setting documented by R2IntegrationParameters::staticContactSoftness. | |
| R2Status | r2SetStaticContactSoftness (struct R2World *world, struct R2SpringCoefficients value) |
| Set the world setting documented by R2IntegrationParameters::staticContactSoftness. | |
| struct R2Vector | r2Gravity (const struct R2World *world) |
| Return the world-space gravitational acceleration. | |
| R2Status | r2SetGravity (struct R2World *world, struct R2Vector value) |
| Set the world-space gravitational acceleration. | |
| R2Status | r2Step (struct R2World *world, const struct R2PhysicsHooks *hooks, const struct R2EventCollector *events) |
| Advance simulation by one timestep. | |
| R2Status | r2DetectCollisions (struct R2World *world, const struct R2PhysicsHooks *hooks, const struct R2EventCollector *events) |
| Refresh collision detection without advancing simulation. | |
| struct R2ByteView | r2Bytes_Data (const struct R2Bytes *bytes) |
| Borrow snapshot bytes without copying; valid until r2FreeBytes. | |
| R2Status | r2FreeBytes (struct R2Bytes *bytes) |
| Release an owned snapshot byte buffer. | |
| struct R2Bytes * | r2SerializeWorld (const struct R2World *world) |
| Return owned snapshot bytes; release them with r2FreeBytes. | |
| struct R2World * | r2DeserializeWorld (const uint8_t *data, size_t count) |
| Restore ONLY trusted snapshots produced by the identical Rapier build. | |
| R2Status | r2SetNumThreads (struct R2World *world, size_t num_threads) |
| Configures a dedicated pool for this world's parallel work. | |
| R2Status | r2ClearThreadPool (struct R2World *world) |
| Removes the world's dedicated pool. | |
| size_t | r2NumThreads (const struct R2World *world) |
| Size of the world's dedicated pool, or zero if a parallel build has no dedicated pool configured. | |
| R2Status | r2SetCountersEnabled (struct R2World *world, R2Bool enabled) |
| Enable or disable the native pipeline profiling counters. | |
| double | r2StepTimeMs (const struct R2World *world) |
| Native engine time of the most recent step, in milliseconds, as in the Rust testbed. | |
| struct R2World * | r2DeserializeRigidState (const uint8_t *data, size_t count) |
| Read ONLY trusted legacy rigid-world snapshots from debug_deserialize3.rs, produced by the identical Rapier build. | |
| struct R2VolumeMeshParameters | r2NewVolumeMeshParameters (R2Real cell_size) |
| Return volume-meshing settings for the supplied cell size; this POD value requires no destructor. | |
| size_t | r2QuarantinedRigidBodies (const struct R2World *world, struct R2RigidBodyHandle *buffer, size_t capacity) |
| Copy the rigid bodies quarantined by the most recent Step because their pose or velocity became non-finite (NaN or infinite). | |
| size_t | r2QuarantinedColliders (const struct R2World *world, struct R2ColliderHandle *buffer, size_t capacity) |
| Copy the colliders quarantined by the most recent Step because their own pose or shape became non-finite, independently of their parent. | |
| size_t | r2QuarantinedSoftBodies (const struct R2World *world, struct R2SoftBodyHandle *buffer, size_t capacity) |
| Copy the soft bodies quarantined by the most recent Step because a particle position or velocity became non-finite. | |
| struct R2World * | r2NewWorld (void) |
| Create an owned world. | |
| R2Status | r2FreeWorld (struct R2World *world) |
| Free a world. | |
Create a world, configure integration, step, and serialize it.
Setters change the named setting for subsequent operations.
Immutable owned byte buffer.
Release with the matching FreeBytes function.
| typedef struct R2IntegrationParameters R2IntegrationParameters |
Plain configuration data; initialize defaults, edit, then apply.
No destructor.
Sole owner of simulation state.
Handles belong to the world that created them. Ordinary reads may overlap. A mutation or step requires exclusive access. Destruction must be externally synchronized with all users of this pointer.
| size_t r2ActiveRigidBodies | ( | const struct R2World * | world, |
| struct R2RigidBodyHandle * | buffer, | ||
| size_t | capacity ) |
Copies the island manager's active body handles.
| struct R2ByteView r2Bytes_Data | ( | const struct R2Bytes * | bytes | ) |
Borrow snapshot bytes without copying; valid until r2FreeBytes.
Never free the returned data pointer.
Removes the world's dedicated pool.
A parallel build then uses the calling context's Rayon pool (normally the global pool), not a single worker. Returns R2_UNSUPPORTED in a build without the parallel feature.
Return the world setting documented by R2IntegrationParameters::contactClustering.
Return the world setting documented by R2IntegrationParameters::contactRecycling.
| struct R2SpringCoefficients r2ContactSoftness | ( | const struct R2World * | world | ) |
Return the world setting documented by R2IntegrationParameters::contactSoftness.
| struct R2IntegrationParameters r2DefaultIntegrationParameters | ( | void | ) |
Return native default integration parameters.
This POD value owns no resources.
| struct R2World * r2DeserializeRigidState | ( | const uint8_t * | data, |
| size_t | count ) |
Read ONLY trusted legacy rigid-world snapshots from debug_deserialize3.rs, produced by the identical Rapier build.
This is not a stable interchange format.
Import trusted legacy Rust testbed rigid-state bytes into a new owned world. Release with r2FreeWorld; see Snapshots.
| struct R2World * r2DeserializeWorld | ( | const uint8_t * | data, |
| size_t | count ) |
Restore ONLY trusted snapshots produced by the identical Rapier build.
Snapshots are not a stable file format.
| R2Status r2DetectCollisions | ( | struct R2World * | world, |
| const struct R2PhysicsHooks * | hooks, | ||
| const struct R2EventCollector * | events ) |
Refresh collision detection without advancing simulation.
Hooks and events may be NULL; events are appended to the collector.
Release an owned snapshot byte buffer.
NULL is allowed. Do not pass borrowed pointers or free the object twice.
Free a world.
NULL is allowed. Rejects destruction from an active callback. The caller must prevent other threads from starting calls during destruction.
Return the world setting documented by R2IntegrationParameters::frictionInBiasPass.
Return the world-space gravitational acceleration.
| struct R2IntegrationParameters r2IntegrationParameters | ( | const struct R2World * | world | ) |
Return a copy of all world integration settings.
Return the world setting documented by R2IntegrationParameters::lengthUnit.
| size_t r2MaxCcdSubsteps | ( | const struct R2World * | world | ) |
Return the world setting documented by R2IntegrationParameters::maxCcdSubsteps.
Return the world setting documented by R2IntegrationParameters::minCcdDt.
| struct R2VolumeMeshParameters r2NewVolumeMeshParameters | ( | R2Real | cell_size | ) |
Return volume-meshing settings for the supplied cell size; this POD value requires no destructor.
| struct R2World * r2NewWorld | ( | void | ) |
Create an owned world.
Release it with FreeWorld.
Return the world setting documented by R2IntegrationParameters::normalizedAllowedLinearError.
Return the world setting documented by R2IntegrationParameters::normalizedContactRecycleDistance.
Return the world setting documented by R2IntegrationParameters::normalizedMaxCorrectiveVelocity.
Return the world setting documented by R2IntegrationParameters::normalizedMaxLinearVelocity.
Return the world setting documented by R2IntegrationParameters::normalizedPredictionDistance.
| size_t r2NumInternalPgsIterations | ( | const struct R2World * | world | ) |
Return the world setting documented by R2IntegrationParameters::numInternalPgsIterations.
| size_t r2NumInternalStabilizationIterations | ( | const struct R2World * | world | ) |
Return the world setting documented by R2IntegrationParameters::numInternalStabilizationIterations.
| size_t r2NumSolverIterations | ( | const struct R2World * | world | ) |
Return the world setting documented by R2IntegrationParameters::numSolverIterations.
| size_t r2NumThreads | ( | const struct R2World * | world | ) |
Size of the world's dedicated pool, or zero if a parallel build has no dedicated pool configured.
Returns one for a build without the parallel feature.
| size_t r2QuarantinedColliders | ( | const struct R2World * | world, |
| struct R2ColliderHandle * | buffer, | ||
| size_t | capacity ) |
Copy the colliders quarantined by the most recent Step because their own pose or shape became non-finite, independently of their parent.
Rapier disabled them; re-enable them with Collider_SetEnabled once fixed. The list is cleared at the start of every Step and may hold handles removed since.
| size_t r2QuarantinedRigidBodies | ( | const struct R2World * | world, |
| struct R2RigidBodyHandle * | buffer, | ||
| size_t | capacity ) |
Copy the rigid bodies quarantined by the most recent Step because their pose or velocity became non-finite (NaN or infinite).
Rapier disabled them, restored their last valid pose when known, and zeroed their velocities and forces; re-enable them with RigidBody_SetEnabled once the cause is fixed. The list is cleared at the start of every Step and may hold handles removed since.
| size_t r2QuarantinedSoftBodies | ( | const struct R2World * | world, |
| struct R2SoftBodyHandle * | buffer, | ||
| size_t | capacity ) |
Copy the soft bodies quarantined by the most recent Step because a particle position or velocity became non-finite.
Rapier disabled them and zeroed their velocities but left the non-finite positions: fix them with SoftBody_SetParticlePosition before SoftBody_SetEnabled. The list is cleared at the start of every Step and may hold handles removed since.
Return owned snapshot bytes; release them with r2FreeBytes.
See Snapshots for restoration and handle lifetimes.
Set the world setting documented by R2IntegrationParameters::contactClustering.
Set the world setting documented by R2IntegrationParameters::contactRecycling.
| R2Status r2SetContactSoftness | ( | struct R2World * | world, |
| struct R2SpringCoefficients | value ) |
Set the world setting documented by R2IntegrationParameters::contactSoftness.
Enable or disable the native pipeline profiling counters.
Enabling returns R2_UNSUPPORTED if the library was built without the profiler feature.
Set the world setting documented by R2IntegrationParameters::frictionInBiasPass.
Set the world-space gravitational acceleration.
| R2Status r2SetIntegrationParameters | ( | struct R2World * | world, |
| const struct R2IntegrationParameters * | data ) |
Copies validated values; does not expose a writable alias to Rust memory.
Set the world setting documented by R2IntegrationParameters::lengthUnit.
Set the world setting documented by R2IntegrationParameters::maxCcdSubsteps.
Set the world setting documented by R2IntegrationParameters::minCcdDt.
Set the world setting documented by R2IntegrationParameters::normalizedAllowedLinearError.
Set the world setting documented by R2IntegrationParameters::normalizedContactRecycleDistance.
Set the world setting documented by R2IntegrationParameters::normalizedMaxCorrectiveVelocity.
Set the world setting documented by R2IntegrationParameters::normalizedMaxLinearVelocity.
Set the world setting documented by R2IntegrationParameters::normalizedPredictionDistance.
Set the world setting documented by R2IntegrationParameters::numInternalPgsIterations.
Set the world setting documented by R2IntegrationParameters::numInternalStabilizationIterations.
Set the world setting documented by R2IntegrationParameters::numSolverIterations.
Configures a dedicated pool for this world's parallel work.
Zero selects Rayon's default. Takes effect on the next step. Reconfiguration must not race with a step or callback. Returns R2_UNSUPPORTED in builds without the parallel feature; keeps the previous pool when constructing the new one fails. The pool is not included in snapshots.
| R2Status r2SetStaticContactSoftness | ( | struct R2World * | world, |
| struct R2SpringCoefficients | value ) |
Set the world setting documented by R2IntegrationParameters::staticContactSoftness.
Set the world setting documented by R2IntegrationParameters::dt.
Set the world setting documented by R2IntegrationParameters::warmstartCoefficient.
Set the world setting documented by R2IntegrationParameters::warmstartJoints.
| struct R2SpringCoefficients r2StaticContactSoftness | ( | const struct R2World * | world | ) |
Return the world setting documented by R2IntegrationParameters::staticContactSoftness.
| R2Status r2Step | ( | struct R2World * | world, |
| const struct R2PhysicsHooks * | hooks, | ||
| const struct R2EventCollector * | events ) |
Advance simulation by one timestep.
Hooks and events may be NULL. Events are appended to the collector, which is never cleared automatically. This call invalidates all borrowed set-element pointers.
| double r2StepTimeMs | ( | const struct R2World * | world | ) |
Native engine time of the most recent step, in milliseconds, as in the Rust testbed.
Enable counters before stepping. Excludes C callbacks outside the step, rendering, and dispatch into a dedicated thread pool; remains unchanged while paused.
Return the world setting documented by R2IntegrationParameters::dt.
Return the world setting documented by R2IntegrationParameters::warmstartCoefficient.
Return the world setting documented by R2IntegrationParameters::warmstartJoints.