From 4974c2ccc7f640d6a657c22cc1a3dfa9d114b8f0 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Wed, 4 Sep 2019 22:52:38 +0200 Subject: Reset stuck particles to starting position --- template/kernel.mako | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'template') diff --git a/template/kernel.mako b/template/kernel.mako index f6bac7f..1ee39cd 100644 --- a/template/kernel.mako +++ b/template/kernel.mako @@ -140,6 +140,7 @@ __kernel void collect_gl_moments(__global __read_only ${float_type}* f, } __kernel void update_particles(__global __read_only float4* moments, + __global __read_only int* material, __global __write_only float4* particles) { const unsigned int pid = get_global_id(0); @@ -150,8 +151,13 @@ __kernel void update_particles(__global __read_only float4* moments, float4 moment = moments[gid]; - particle.x += moment.y; - particle.y += moment.z; + if (material[gid] == 1) { + particle.x += moment.y; + particle.y += moment.z; + } else { + particle.x = particle.z; + particle.y = particle.w; + } particles[pid] = particle; } -- cgit v1.2.3