This commit is contained in:
micuat 2020-10-20 14:55:48 +02:00
parent dd459dc01b
commit 81d238ad9a
3 changed files with 15 additions and 4 deletions

View file

@ -9,11 +9,12 @@ uniform sampler2DRect imageTexture;
in vec2 texCoordVarying; in vec2 texCoordVarying;
in float vTemperature; in float vTemperature;
in float vAge;
void main() void main()
{ {
fragColor = vec4(1);//vec4(texture(u_world, texCoordVarying.st).rgb,1); 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(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(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));
} }

View file

@ -8,10 +8,13 @@ in vec2 texcoord;
out vec2 texCoordVarying; out vec2 texCoordVarying;
out float vTemperature; out float vTemperature;
out float vAge;
void main() void main()
{ {
texCoordVarying = texcoord; 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); gl_Position = modelViewProjectionMatrix * vec4(texture(particles0, texCoordVarying).xyz, 1.0);
} }

View file

@ -123,10 +123,17 @@ void main()
posWorld.y = ray.y * posWorld.z; posWorld.y = ray.y * posWorld.z;
vec3 pos = texture(particles0, texCoordVarying.st).xyz; 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) { if(vValid == 1) {
pos = posWorld.xyz; 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); vec3 force = vec3(0,0,0);
float th = 3.1415 * 4 * simplex3d_fractal(vec3(pos.xyz * 0.001)); float th = 3.1415 * 4 * simplex3d_fractal(vec3(pos.xyz * 0.001));
@ -146,5 +153,5 @@ void main()
posOut = vec4(pos, 1.0); posOut = vec4(pos, 1.0);
velOut = vec4(vel, 0.0); velOut = vec4(vel, 0.0);
misOut = vec4(thermo, 0, 0, 0); misOut = vec4(thermo, age, 0, 0);
} }