- float surface = texelFetch(surface_in, coord, 0).x;
- float bottom = texelFetch(bottom_in, coord, 0).x;
- float depth = surface-bottom;
- vec2 velocity = texelFetch(velocity_in, coord, 0).xy;
- float clamping = texelFetch(clamping_in, coord, 0).x;
- float left_depth = get_depth(coord-ivec2(1, 0));
- float left_clamping = texelFetch(clamping_in, coord-ivec2(1, 0), 0).x;
- float left_vx = texelFetch(velocity_in, coord-ivec2(1, 0), 0).x;
- float right_depth = get_depth(coord+ivec2(1, 0));
- float right_clamping = texelFetch(clamping_in, coord+ivec2(1, 0), 0).x;
- float down_depth = get_depth(coord-ivec2(0, 1));
- float down_clamping = texelFetch(clamping_in, coord-ivec2(0, 1), 0).x;
- float down_vy = texelFetch(velocity_in, coord-ivec2(0, 1), 0).y;
- float up_depth = get_depth(coord+ivec2(0, 1));
- float up_clamping = texelFetch(clamping_in, coord+ivec2(0, 1), 0).x;
+ vec4 data = get_data(coord);
+ vec4 right_data = get_data(coord+ivec2(1, 0));
+ vec4 up_data = get_data(coord+ivec2(0, 1));
+ vec4 left_data = get_data(coord-ivec2(1, 0));
+ vec4 down_data = get_data(coord-ivec2(0, 1));
+
+ float ul_vx = texelFetch(velocity_in, coord+ivec2(-1, 1), 0).x;
+ float left2_vx = texelFetch(velocity_in, coord-ivec2(2, 0), 0).x;
+ vec2 dl_velocity = texelFetch(velocity_in, coord-ivec2(1, 1), 0).xy;
+ float down2_vy = texelFetch(velocity_in, coord-ivec2(0, 2), 0).y;
+ float dr_vy = texelFetch(velocity_in, coord+ivec2(1, -1), 0).y;
+
+ float clamping = get_clamping(data.w, data.x, data.y, left_data.x, down_data.y);
+ float right_cl = get_clamping(right_data.w, right_data.x, right_data.y, data.x, dr_vy);
+ float up_cl = get_clamping(up_data.w, up_data.x, up_data.y, ul_vx, data.y);
+ float left_cl = get_clamping(left_data.w, left_data.x, left_data.y, left2_vx, dl_velocity.y);
+ float down_cl = get_clamping(down_data.w, down_data.x, down_data.y, dl_velocity.x, down2_vy);