Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions aephysics/dynamics/module.ae
Original file line number Diff line number Diff line change
Expand Up @@ -1035,6 +1035,15 @@ struct SphericalJoint {
index_a: int
index_b: int
linear_impulse: Vec3
// The point's anchors (frame A's and B's origins, world rotation,
// relative to the centres of mass) and the centres' offset, single
// precision as the reference keeps them: a plain ball joint's point
// is solved in single precision from these (spherical_point_f). Beside
// the flags, the indices and the impulse, so that solve's every pass
// reads one span of the joint, not that and a line 700 bytes on.
anchor_a: Vec3f
anchor_b: Vec3f
delta_center_f: Vec3f
frame_a: Transform
frame_b: Transform
delta_center: Vec3
Expand Down Expand Up @@ -1078,13 +1087,6 @@ struct SphericalJoint {
twist_limit_hertz: float
twist_limit_damping_ratio: float
twist_limit_softness: Softness // made each prepare, as the joint's limit_softness
// The point's anchors (frame A's and B's origins, world rotation,
// relative to the centres of mass) and the centres' offset, single
// precision as the reference keeps them: a plain ball joint's point
// is solved in single precision from these (spherical_point_f).
anchor_a: Vec3f
anchor_b: Vec3f
delta_center_f: Vec3f
}

struct WeldJoint {
Expand Down
2 changes: 1 addition & 1 deletion aephysics/snapshot/module.ae
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ extern memcpy(dst: ptr, src: ptr, size: int) -> ptr
extern memset(block: ptr, value: int, size: int) -> ptr

const SNAPSHOT_MAGIC = 0x4E535041 // "APSN", little-endian
const SNAPSHOT_VERSION = 12
const SNAPSHOT_VERSION = 13
const NULL_INDEX = 0 - 1

// --- the bytes written -------------------------------------------------------------------------------
Expand Down
8 changes: 8 additions & 0 deletions bench/suite.ae
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ run(name: string, world_id: WorldId, scene_steps: int, scene: int) {
refit_ms = 0.0
sleep_ms = 0.0
sensors_ms = 0.0
setup_ms = 0.0
constraints_ms = 0.0
bullets_ms = 0.0
t0 = clock()
s = 1
while s < steps {
Expand All @@ -150,6 +153,9 @@ run(name: string, world_id: WorldId, scene_steps: int, scene: int) {
refit_ms = refit_ms + seen.refit
sleep_ms = sleep_ms + seen.sleep_islands
sensors_ms = sensors_ms + seen.sensors
setup_ms = setup_ms + seen.solver_setup
constraints_ms = constraints_ms + seen.constraints
bullets_ms = bullets_ms + seen.bullets
s = s + 1
}
t1 = clock()
Expand All @@ -159,6 +165,8 @@ run(name: string, world_id: WorldId, scene_steps: int, scene: int) {
println("aephysics suite: ${name}: ${steps} steps of ${counters.body_count} bodies ${ms(t1 - t0)} ms, ${ms(t1 - t0) / timed} ms per step (height sum ${height_sum(world_id)}, ${counters.contact_count} contacts, ${counters.joint_count} joints, ${awake} awake)")
println("aephysics phases ms/step: pairs ${pairs_ms / timed} collide ${collide_ms / timed}")
println("aephysics stages ms/step: solve ${solve_ms / timed} transforms ${transforms_ms / timed} refit ${refit_ms / timed} sleep ${sleep_ms / timed} sensors ${sensors_ms / timed}")
// Inside the solve, as the reference's b3Profile splits it.
println("aephysics solve parts ms/step: setup ${setup_ms / timed} constraints ${constraints_ms / timed} transforms ${transforms_ms / timed} bullets ${bullets_ms / timed}")
// The graph's colours, each one's contacts and joints (the overflow
// last), as bench/suite_box3d.c prints the reference's.
colors = "aephysics colors:"
Expand Down
6 changes: 6 additions & 0 deletions bench/suite_box3d.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ static void Run( const Scene* scene )
double pairs = 0.0, collide = 0.0, solve = 0.0, transforms = 0.0, refit = 0.0, sleep = 0.0, sensors = 0.0;
// The solve's own stages, as bench/physics_world_box3d.c sums them, to
// read beside ours (AEPHYSICS_STAGES=1).
double setup = 0.0, constraints = 0.0, bullets = 0.0;
double prepare = 0.0, integrateV = 0.0, warm = 0.0, impulses = 0.0, integrateP = 0.0, relax = 0.0, restitution = 0.0, store = 0.0;
double t0 = now_ms();
for ( int stepIndex = 1; stepIndex < steps; ++stepIndex )
Expand All @@ -108,6 +109,9 @@ static void Run( const Scene* scene )
refit += p.refit;
sleep += p.sleepIslands;
sensors += p.sensors;
setup += p.solverSetup;
constraints += p.constraints;
bullets += p.bullets;
prepare += p.prepareConstraints;
integrateV += p.integrateVelocities;
warm += p.warmStart;
Expand All @@ -127,6 +131,8 @@ static void Run( const Scene* scene )
printf( "box3d phases ms/step: pairs %.6f collide %.6f\n", pairs / timed, collide / timed );
printf( "box3d stages ms/step: solve %.6f transforms %.6f refit %.6f sleep %.6f sensors %.6f\n", solve / timed, transforms / timed,
refit / timed, sleep / timed, sensors / timed );
printf( "box3d solve parts ms/step: setup %.6f constraints %.6f transforms %.6f bullets %.6f\n", setup / timed, constraints / timed,
transforms / timed, bullets / timed );
printf( "box3d colors:" );
for ( int i = 0; i < 24; ++i )
{
Expand Down
Loading