summaryrefslogtreecommitdiffstats
path: root/balls.cl
diff options
context:
space:
mode:
authorSam Anthony <sam@samanthony.xyz>2024-10-28 11:46:02 -0400
committerSam Anthony <sam@samanthony.xyz>2024-10-28 11:46:02 -0400
commitcab4376cc78dd9ffb13a7965cf2615ba1648c8f1 (patch)
treeb29a25b367d1448ba854586d87d488443a22ea20 /balls.cl
parent35a094792d28eaf31bcf0502746e211685d7573e (diff)
downloadballs-cab4376cc78dd9ffb13a7965cf2615ba1648c8f1.zip
gravity
Diffstat (limited to 'balls.cl')
-rw-r--r--balls.cl4
1 files changed, 4 insertions, 0 deletions
diff --git a/balls.cl b/balls.cl
index b48e0ab..e3450db 100644
--- a/balls.cl
+++ b/balls.cl
@@ -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];
}