aboutsummaryrefslogtreecommitdiff
path: root/template
diff options
context:
space:
mode:
authorAdrian Kummerlaender2019-09-06 22:29:05 +0200
committerAdrian Kummerlaender2019-09-06 22:29:05 +0200
commitbf967631c146997d7673798318d94b0a186ec89d (patch)
treeef3721d80ec65561fb2af1e371e9e501e5819765 /template
parent3b2d08e57a272f14c1385ebc458f0c2b431414b9 (diff)
downloadsymlbm_playground-bf967631c146997d7673798318d94b0a186ec89d.tar
symlbm_playground-bf967631c146997d7673798318d94b0a186ec89d.tar.gz
symlbm_playground-bf967631c146997d7673798318d94b0a186ec89d.tar.bz2
symlbm_playground-bf967631c146997d7673798318d94b0a186ec89d.tar.lz
symlbm_playground-bf967631c146997d7673798318d94b0a186ec89d.tar.xz
symlbm_playground-bf967631c146997d7673798318d94b0a186ec89d.tar.zst
symlbm_playground-bf967631c146997d7673798318d94b0a186ec89d.zip
Add a fun little fake bonfire _simulation_
…using appropriately colored aging particles
Diffstat (limited to 'template')
-rw-r--r--template/kernel.mako13
1 files changed, 9 insertions, 4 deletions
diff --git a/template/kernel.mako b/template/kernel.mako
index 1ee39cd..d0d6d30 100644
--- a/template/kernel.mako
+++ b/template/kernel.mako
@@ -141,7 +141,9 @@ __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)
+ __global __write_only float4* particles,
+ __global __read_only float2* init_particles,
+ float aging)
{
const unsigned int pid = get_global_id(0);
@@ -151,12 +153,15 @@ __kernel void update_particles(__global __read_only float4* moments,
float4 moment = moments[gid];
- if (material[gid] == 1) {
+ if (material[gid] == 1 && particle.z < 1.0) {
particle.x += moment.y;
particle.y += moment.z;
+ particle.z += min(particle.x, particle.y) * aging;
} else {
- particle.x = particle.z;
- particle.y = particle.w;
+ float2 orig = init_particles[pid];
+ particle.x = orig.x;
+ particle.y = orig.y;
+ particle.z = particle.z-1.0;
}
particles[pid] = particle;