From 89f21e0a1fceacea5ed2c2b02dfcaca76249aec2 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Wed, 11 Sep 2019 19:12:29 +0200 Subject: Cleanup --- template/kernel.mako | 6 +++--- trugfeuer_2d_gl_interop.py | 22 ++++++---------------- 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/template/kernel.mako b/template/kernel.mako index d0d6d30..89000a9 100644 --- a/template/kernel.mako +++ b/template/kernel.mako @@ -158,9 +158,9 @@ __kernel void update_particles(__global __read_only float4* moments, particle.y += moment.z; particle.z += min(particle.x, particle.y) * aging; } else { - float2 orig = init_particles[pid]; - particle.x = orig.x; - particle.y = orig.y; + float2 init_particle = init_particles[pid]; + particle.x = init_particle.x; + particle.y = init_particle.y; particle.z = particle.z-1.0; } diff --git a/trugfeuer_2d_gl_interop.py b/trugfeuer_2d_gl_interop.py index c23a355..68944c8 100644 --- a/trugfeuer_2d_gl_interop.py +++ b/trugfeuer_2d_gl_interop.py @@ -18,7 +18,7 @@ pixels_per_cell = 4 updates_per_frame = 40 particle_count = 100000 -inflow = 0.005 +inflow = 0.006 relaxation_time = 0.515 def circle(cx, cy, r): @@ -87,14 +87,6 @@ out vec3 color; uniform mat4 projection; -vec3 blueRedPalette(float x) { - return mix( - vec3(0.0, 0.0, 1.0), - vec3(1.0, 0.0, 0.0), - x - ); -} - vec2 fluidVertexAtIndex(uint i) { const float y = floor(float(i) / $size_x); return vec2( @@ -114,14 +106,12 @@ void main() { ); if (CellMoments[3] > 0.0) { - //color = blueRedPalette(CellMoments[3] / 0.2); color = vec3(0.0,0.0,0.0); } else { color = vec3(0.4,0.4,0.4); } }""").substitute({ - 'size_x': screen_x//pixels_per_cell, - 'inflow': inflow + 'size_x': screen_x//pixels_per_cell }), GL_VERTEX_SHADER) fragment_shader = shaders.compileShader(""" @@ -136,7 +126,7 @@ void main(){ particle_shader = shaders.compileShader(Template(""" #version 430 -layout (location=0) in vec4 Particles; +layout (location=0) in vec4 particles; out vec3 color; @@ -152,13 +142,13 @@ vec3 fire(float x) { void main() { gl_Position = projection * vec4( - Particles[0], - Particles[1], + particles[0], + particles[1], 0., 1. ); - color = fire(1.0-Particles[2]); + color = fire(1.0-particles[2]); }""").substitute({}), GL_VERTEX_SHADER) moment_program = shaders.compileProgram(vertex_shader, fragment_shader) -- cgit v1.2.3