Merge branch 'main' of git.h3cx.dev:h3cx/fphysics
This commit is contained in:
2 files changed
+1
-2
No files matched your search
@@ -29,9 +29,9 @@ void *physics(void *args) {
|
|||||||
universe_t *uni = (universe_t *)args;
|
universe_t *uni = (universe_t *)args;
|
||||||
struct timespec ot, ct;
|
struct timespec ot, ct;
|
||||||
while (true) {
|
while (true) {
|
||||||
|
clock_gettime(CLOCK_MONOTONIC, &ct);
|
||||||
mechanics(uni);
|
mechanics(uni);
|
||||||
ot = ct;
|
ot = ct;
|
||||||
clock_gettime(CLOCK_MONOTONIC, &ct);
|
|
||||||
long long elapsed = timespec_diff_ns(ct, ot);
|
long long elapsed = timespec_diff_ns(ct, ot);
|
||||||
long long remaining = TIMESTEP / simx - elapsed;
|
long long remaining = TIMESTEP / simx - elapsed;
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,6 @@ void mechanics(universe_t* uni){
|
|||||||
body_1 = uni->bodies[i];
|
body_1 = uni->bodies[i];
|
||||||
scaled_speed = vec2_scale(&body_1.speed, 1.0 / simx);
|
scaled_speed = vec2_scale(&body_1.speed, 1.0 / simx);
|
||||||
body_1.position = vec2_sum(&body_1.position, &scaled_speed);
|
body_1.position = vec2_sum(&body_1.position, &scaled_speed);
|
||||||
printf("aaa");
|
|
||||||
if (i < uni->num_bodies - 1) {
|
if (i < uni->num_bodies - 1) {
|
||||||
for (unsigned int y = i + 1; y < uni->num_bodies; y++) {
|
for (unsigned int y = i + 1; y < uni->num_bodies; y++) {
|
||||||
body_2 = uni->bodies[y];
|
body_2 = uni->bodies[y];
|
||||||
|
|||||||
Reference in new issue
Block a user