X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=demos%2Fforestpond%2Fdata%2Ffluidsim.glsl;h=0f58a9b225e815963f2dc194f1835dc2a94650e0;hb=1da53713b7fc7a69e37263e194686a805db56fcb;hp=c44002689a5d0a9d318746fe10f9bab9b54dfab1;hpb=7efe2d35f5d53c0f086a1b85b7d3dea6a6c709ab;p=libs%2Fgl.git diff --git a/demos/forestpond/data/fluidsim.glsl b/demos/forestpond/data/fluidsim.glsl index c4400268..0f58a9b2 100644 --- a/demos/forestpond/data/fluidsim.glsl +++ b/demos/forestpond/data/fluidsim.glsl @@ -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)); }