diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2024-10-28 11:46:02 -0400 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2024-10-28 11:46:02 -0400 |
| commit | cab4376cc78dd9ffb13a7965cf2615ba1648c8f1 (patch) | |
| tree | b29a25b367d1448ba854586d87d488443a22ea20 | |
| parent | 35a094792d28eaf31bcf0502746e211685d7573e (diff) | |
| download | balls-cab4376cc78dd9ffb13a7965cf2615ba1648c8f1.zip | |
gravity
| -rw-r--r-- | balls.cl | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -1,3 +1,6 @@ +#define G_FACTOR 3600.0 +#define G (9.81 / G_FACTOR) + float min(float a, float b) { if (a < b) @@ -22,6 +25,7 @@ move(__global float2 *positions, __global float2 *velocities) { size_t id; id = get_global_id(0); + velocities[id].y -= G; positions[id] += velocities[id]; } |