Optimizations (#168)
- Optimize contact prepare - Back to post restitution stage - Optimize solver math - Bug fixes
This commit is contained in:
parent
9e5a4cde86
commit
79fc55976a
55 changed files with 3248 additions and 1519 deletions
|
|
@ -151,6 +151,19 @@ B3_API void b3World_SetRestitutionThreshold( b3WorldId worldId, float value );
|
|||
/// Get the restitution speed threshold. Usually in meters per second.
|
||||
B3_API float b3World_GetRestitutionThreshold( b3WorldId worldId );
|
||||
|
||||
/// Set the number of iterations used by the restitution solver.
|
||||
/// @see B3_MAX_RESTITUTION_ITERATIONS
|
||||
B3_API void b3World_SetRestitutionIterations( b3WorldId worldId, int iterations );
|
||||
|
||||
/// Get the number of iterations used by the restitution solver.
|
||||
B3_API int b3World_GetRestitutionIterations( b3WorldId worldId );
|
||||
|
||||
/// Enable restitution propagation.
|
||||
B3_API void b3World_EnableRestitutionPropagation( b3WorldId worldId, bool flag );
|
||||
|
||||
/// Is restitution propagation enabled?
|
||||
B3_API bool b3World_IsRestitutionPropagationEnabled( b3WorldId worldId );
|
||||
|
||||
/// Adjust the hit event threshold. This controls the collision speed needed to generate a b3ContactHitEvent.
|
||||
/// Usually in meters per second.
|
||||
/// @see b3WorldDef::hitEventThreshold
|
||||
|
|
@ -242,9 +255,6 @@ B3_API void b3World_DumpMemoryStats( b3WorldId worldId );
|
|||
/// Dump shape bounds to box3d_bounds.txt
|
||||
B3_API void b3World_DumpShapeBounds( b3WorldId worldId, b3BodyType type );
|
||||
|
||||
/// This is for internal testing
|
||||
B3_API void b3World_RebuildStaticTree( b3WorldId worldId );
|
||||
|
||||
/// This is for internal testing
|
||||
B3_API void b3World_EnableSpeculative( b3WorldId worldId, bool flag );
|
||||
|
||||
|
|
|
|||
|
|
@ -105,6 +105,9 @@ 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
|
||||
|
||||
/// The maximum number of restitution iterations. Needed to avoid a solver overflow.
|
||||
#define B3_MAX_RESTITUTION_ITERATIONS 63
|
||||
|
||||
/// The maximum number of contact points between two touching shapes.
|
||||
/// The default and minimum is 4 and this case uses a fast approximate hull to reduce the
|
||||
/// point count. A larger value builds a 2D convex hull of the candidate points and then
|
||||
|
|
@ -141,7 +144,6 @@ B3_API float b3GetStallThreshold( void );
|
|||
#define B3_MAX_SHAPES ( 1 << B3_SHAPE_POWER )
|
||||
#define B3_MAX_CHILD_SHAPES ( 1 << B3_CHILD_POWER )
|
||||
|
||||
|
||||
/// This is the limit on how many mesh or heightfield triangles a single convex shape can collide with.
|
||||
/// Increasing this will increase stack usage, so be careful. I recommend to simplify your collision data
|
||||
/// before increasing this. For example, using render mesh for collision often leads to poor performance.
|
||||
|
|
|
|||
|
|
@ -147,6 +147,13 @@ typedef struct b3WorldDef
|
|||
/// speed have restitution applied (will bounce).
|
||||
float restitutionThreshold;
|
||||
|
||||
/// Number of iterations of the restitution solver. More iterations can lead to less box spinning.
|
||||
/// @see B3_MAX_RESTITUTION_ITERATIONS
|
||||
int restitutionIterations;
|
||||
|
||||
/// Enable full contact propagation in the restitution solver. Expensive.
|
||||
bool enableRestitutionPropagation;
|
||||
|
||||
/// Hit event speed threshold, usually in m/s. Collisions above this
|
||||
/// speed can generate hit events if the shape also enables hit events.
|
||||
float hitEventThreshold;
|
||||
|
|
@ -553,6 +560,7 @@ typedef struct b3Profile
|
|||
float solveImpulses; //
|
||||
float integratePositions; //
|
||||
float relaxImpulses; //
|
||||
float restitution; //
|
||||
float storeImpulses; //
|
||||
float splitIslands; //
|
||||
float transforms; //
|
||||
|
|
@ -2645,9 +2653,6 @@ typedef struct b3ManifoldPoint
|
|||
/// The separation of the contact point, negative if penetrating
|
||||
float separation;
|
||||
|
||||
/// Cached separation used for contact recycling
|
||||
float baseSeparation;
|
||||
|
||||
/// The impulse along the manifold normal vector. Since Box3D uses sub-stepping, this is
|
||||
/// result from the final sub-step.
|
||||
float normalImpulse;
|
||||
|
|
@ -2662,6 +2667,9 @@ typedef struct b3ManifoldPoint
|
|||
/// computed if hit events are enabled.
|
||||
float normalVelocity;
|
||||
|
||||
/// Cached separation used for contact recycling
|
||||
float baseSeparation;
|
||||
|
||||
/// Local point for matching
|
||||
/// Uniquely identifies a contact point between two shapes
|
||||
uint32_t featureId;
|
||||
|
|
|
|||
Loading…
Reference in a new issue