aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdrian Kummerlaender2019-04-29 19:42:29 +0200
committerAdrian Kummerlaender2019-04-29 19:42:29 +0200
commit35e2c7a949dedf3221887ffdc14dddb4c5e84f4c (patch)
tree0a5233ca69d0663d1e0414786e46d63ec7ea73f8 /src
parentd290dcd50821308a08aed4b1bcd6087e16b0c1ed (diff)
downloadcompustream-35e2c7a949dedf3221887ffdc14dddb4c5e84f4c.tar
compustream-35e2c7a949dedf3221887ffdc14dddb4c5e84f4c.tar.gz
compustream-35e2c7a949dedf3221887ffdc14dddb4c5e84f4c.tar.bz2
compustream-35e2c7a949dedf3221887ffdc14dddb4c5e84f4c.tar.lz
compustream-35e2c7a949dedf3221887ffdc14dddb4c5e84f4c.tar.xz
compustream-35e2c7a949dedf3221887ffdc14dddb4c5e84f4c.tar.zst
compustream-35e2c7a949dedf3221887ffdc14dddb4c5e84f4c.zip
Approximate curl only if all bases are fluid
Diffstat (limited to 'src')
-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);