From 1af79342029c230f3e1832c5c2b0b351674d53b3 Mon Sep 17 00:00:00 2001 From: Brendan Hansen Date: Fri, 13 Nov 2020 17:13:24 -0600 Subject: [PATCH] fixed thread sync error --- src/physics.cpp | 2 +- src/sim.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/physics.cpp b/src/physics.cpp index 9c497f1..38de5f8 100644 --- a/src/physics.cpp +++ b/src/physics.cpp @@ -5,7 +5,7 @@ // NOTE(Brendan): This represents the piecewise function: // // F(d) = { -// 0 < d < 1: (1 / d) - 1 +// 0 < d < 1: r * (1 - d) / d // 1 <= d < distance_range + 1: (-4 * max_force / (distance_range ^ 2)) * (d - (distance_range / 2) - 1) ^ 2 + max_force, // otherwise: 0 // } diff --git a/src/sim.cpp b/src/sim.cpp index cda4e1a..76462f3 100644 --- a/src/sim.cpp +++ b/src/sim.cpp @@ -146,6 +146,7 @@ update_bodies_partial(SimState *state, i32 index) persist const f64 step = 0.01; foreach (i, low, high) body_accumulate_move(&state->bodies[i], &state->qt_bodies, TEMP_dt); + pthread_barrier_wait(&state->thread_sync_barrier); foreach (i, low, high) body_apply_move(&state->bodies[i], TEMP_dt); } -- 2.25.1