]> git.tdb.fi Git - libs/gl.git/blobdiff - demos/forestpond/data/fluidsim.glsl
Remove the separate clamping step from forest pond fluid simulation
[libs/gl.git] / demos / forestpond / data / fluidsim.glsl
index c44002689a5d0a9d318746fe10f9bab9b54dfab1..0f58a9b225e815963f2dc194f1835dc2a94650e0 100644 (file)
@@ -19,13 +19,19 @@ layout(push_constant) uniform Time
 
 uniform sampler2D surface_in;
 uniform sampler2D velocity_in;
-uniform sampler2D clamping_in;
 uniform sampler2D bottom_in;
 layout(r32f) uniform image2D surface_out;
 layout(rg32f) uniform image2D velocity_out;
-layout(r32f) uniform image2D clamping_out;
 
-float get_depth(ivec2 coord)
+vec2 get_depth(ivec2 coord)
 {
-       return texelFetch(surface_in, coord, 0).x-texelFetch(bottom_in, coord, 0).x;
+       float surface = texelFetch(surface_in, coord, 0).x;
+       float bottom = texelFetch(bottom_in, coord, 0).x;
+       return vec2(surface, surface-bottom);
+}
+
+vec4 get_data(ivec2 coord)
+{
+       vec2 velocity = texelFetch(velocity_in, coord, 0).xy;
+       return vec4(velocity, get_depth(coord));
 }