diff options
Diffstat (limited to 'examples/quickcl/particles/particles.cl')
-rw-r--r-- | examples/quickcl/particles/particles.cl | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/examples/quickcl/particles/particles.cl b/examples/quickcl/particles/particles.cl new file mode 100644 index 0000000..47a8013 --- /dev/null +++ b/examples/quickcl/particles/particles.cl @@ -0,0 +1,13 @@ +kernel void updateParticles(global float *buf, float t, float dt, global float *info) +{ + int idx = get_global_id(0) * 2; + if (t < 0.000001f) { + buf[idx] = -1.0f; + buf[idx + 1] = -1.0f; + } else { + float2 dir = (float2)(info[idx], info[idx + 1]); + float2 speed = (float2)(info[idx + 2], info[idx + 3]); + buf[idx] += dir.x * dt * speed.x; + buf[idx + 1] += dir.y * dt * speed.y; + } +} |