aboutsummaryrefslogtreecommitdiff
path: root/src/shader
diff options
context:
space:
mode:
Diffstat (limited to 'src/shader')
-rw-r--r--src/shader/code/collide.glsl2
-rw-r--r--src/shader/code/extra.glsl14
2 files changed, 15 insertions, 1 deletions
diff --git a/src/shader/code/collide.glsl b/src/shader/code/collide.glsl
index d32bf78..0f9b2bd 100644
--- a/src/shader/code/collide.glsl
+++ b/src/shader/code/collide.glsl
@@ -133,7 +133,7 @@ float equilibrium(float d, vec2 v, int i, int j) {
/// Material number meaning (geometry is only changed by the interaction shader)
bool isBulkFluidCell(int material) {
- return material == 1 || material == 4 || material == 5 || material == 6;
+ return material == 1 || material == 5 || material == 6;
}
bool isBounceBackCell(int material) {
diff --git a/src/shader/code/extra.glsl b/src/shader/code/extra.glsl
index 3fec976..b8483ae 100644
--- a/src/shader/code/extra.glsl
+++ b/src/shader/code/extra.glsl
@@ -23,6 +23,11 @@ uint indexOfFluidVertex(uint x, uint y) {
/// Data access
+int getMaterial(uint x, uint y) {
+ const uint idx = indexOfFluidVertex(x, y);
+ return int(extraCells[idx + 2]);
+}
+
vec2 getFluidVelocity(uint x, uint y) {
const uint idx = indexOfFluidVertex(x, y);
return vec2(
@@ -44,6 +49,15 @@ void main() {
return;
}
+ if ( getMaterial(x,y) != 1
+ || getMaterial(x-1,y) != 1
+ || getMaterial(x+1,y) != 1
+ || getMaterial(x,y-1) != 1
+ || getMaterial(x,y+1) != 1 ) {
+ setFluidExtra(x, y, 0.0);
+ return;
+ }
+
// simple central difference discretization of the 2d curl operator
const float dxvy = (getFluidVelocity(x+1,y).y - getFluidVelocity(x-1,y).y)
/ (2*convLength);