diff --git a/zoneb/bin/data/shaders/particles/draw.frag b/zoneb/bin/data/shaders/particles/draw.frag index 14ebd56..3b8042a 100755 --- a/zoneb/bin/data/shaders/particles/draw.frag +++ b/zoneb/bin/data/shaders/particles/draw.frag @@ -9,11 +9,12 @@ uniform sampler2DRect imageTexture; in vec2 texCoordVarying; in float vTemperature; +in float vAge; void main() { fragColor = vec4(1);//vec4(texture(u_world, texCoordVarying.st).rgb,1); // fragColor = vec4(texCoordVarying.st/100,1.0,1.0);//vec4(texture(u_world, texCoordVarying.st).rgb,1); // fragColor = vec4(texture(u_v4l2cam, texCoordVarying.st).rgb,1); - fragColor = vec4(texture(imageTexture, vec2(vTemperature*1024, 0.5)).xyz,1); + fragColor = vec4(texture(imageTexture, vec2(vTemperature*1024, 0.5)).xyz,max(0, 1 - vAge)); } diff --git a/zoneb/bin/data/shaders/particles/draw.vert b/zoneb/bin/data/shaders/particles/draw.vert index 5fba653..449e9da 100755 --- a/zoneb/bin/data/shaders/particles/draw.vert +++ b/zoneb/bin/data/shaders/particles/draw.vert @@ -8,10 +8,13 @@ in vec2 texcoord; out vec2 texCoordVarying; out float vTemperature; +out float vAge; void main() { texCoordVarying = texcoord; - vTemperature = texture(particles2, texCoordVarying).x; + vec4 misc = texture(particles2, texCoordVarying); + vTemperature = misc.x; + vAge = misc.y; gl_Position = modelViewProjectionMatrix * vec4(texture(particles0, texCoordVarying).xyz, 1.0); } diff --git a/zoneb/bin/data/shaders/particles/update.frag b/zoneb/bin/data/shaders/particles/update.frag index 532fb5b..2ca62b6 100755 --- a/zoneb/bin/data/shaders/particles/update.frag +++ b/zoneb/bin/data/shaders/particles/update.frag @@ -123,10 +123,17 @@ void main() posWorld.y = ray.y * posWorld.z; vec3 pos = texture(particles0, texCoordVarying.st).xyz; + vec3 vel = texture(particles1, texCoordVarying.st).xyz; + vec3 misc = texture(particles2, texCoordVarying.st).xyz; + float age = misc.y; if(vValid == 1) { pos = posWorld.xyz; + age = 0; + } + else { + age += 0.002; + thermo = misc.x; } - vec3 vel = texture(particles1, texCoordVarying.st).xyz; vec3 force = vec3(0,0,0); float th = 3.1415 * 4 * simplex3d_fractal(vec3(pos.xyz * 0.001)); @@ -146,5 +153,5 @@ void main() posOut = vec4(pos, 1.0); velOut = vec4(vel, 0.0); - misOut = vec4(thermo, 0, 0, 0); + misOut = vec4(thermo, age, 0, 0); } \ No newline at end of file