aboutsummaryrefslogtreecommitdiff
path: root/src/shader/code
diff options
context:
space:
mode:
authorAdrian Kummerlaender2018-12-18 21:08:20 +0100
committerAdrian Kummerlaender2018-12-18 21:08:20 +0100
commit6f6073be5de8c8598c4af7f38c90c3f83b5bf1bf (patch)
tree4dabb7259102afe4ddca25293ed3cc77640f95f8 /src/shader/code
parentd58c4cbeb95e25ea08994e4d39f657d078a33782 (diff)
downloadcompustream-6f6073be5de8c8598c4af7f38c90c3f83b5bf1bf.tar
compustream-6f6073be5de8c8598c4af7f38c90c3f83b5bf1bf.tar.gz
compustream-6f6073be5de8c8598c4af7f38c90c3f83b5bf1bf.tar.bz2
compustream-6f6073be5de8c8598c4af7f38c90c3f83b5bf1bf.tar.lz
compustream-6f6073be5de8c8598c4af7f38c90c3f83b5bf1bf.tar.xz
compustream-6f6073be5de8c8598c4af7f38c90c3f83b5bf1bf.tar.zst
compustream-6f6073be5de8c8598c4af7f38c90c3f83b5bf1bf.zip
Hacky mouse-based fluid interaction
Diffstat (limited to 'src/shader/code')
-rw-r--r--src/shader/code/collide.glsl10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/shader/code/collide.glsl b/src/shader/code/collide.glsl
index 78d3936..2626c70 100644
--- a/src/shader/code/collide.glsl
+++ b/src/shader/code/collide.glsl
@@ -7,6 +7,10 @@ layout (std430, binding=1) buffer bufferCollide{ float collideCells[]; };
layout (std430, binding=2) buffer bufferStream{ float streamCells[]; };
layout (std430, binding=3) buffer bufferFluid{ float fluidCells[]; };
+uniform int mouseClicked;
+uniform int mouseX;
+uniform int mouseY;
+
/// LBM constants
uniform uint nX;
@@ -103,7 +107,11 @@ void main() {
return;
}
- const float d = density(x,y);
+ float d = density(x,y);
+ if ( mouseClicked == 1 && abs(x - mouseX) < 3 && abs(y - mouseY) < 3 ) {
+ d = 1.5;
+ }
+
const vec2 v = velocity(x,y,d);
setFluid(x,y,v,d);