diff options
Improvise interactive wall drawing
Internal wall cells need to be disabled to prevent delayed propagation
of the reflected populations.
This is just quickly thrown together - both the visual drawing and the backend's
material handling remain to be improved.
Diffstat (limited to 'src/shader/code/stream.glsl')
-rw-r--r-- | src/shader/code/stream.glsl | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/shader/code/stream.glsl b/src/shader/code/stream.glsl index 345127d..a8aec1d 100644 --- a/src/shader/code/stream.glsl +++ b/src/shader/code/stream.glsl @@ -3,8 +3,9 @@ static const std::string STREAM_SHADER_CODE = R"( layout (local_size_x = 1, local_size_y = 1) in; -layout (std430, binding=1) buffer bufferCollide{ float collideCells[]; }; -layout (std430, binding=2) buffer bufferStream{ float streamCells[]; }; +layout (std430, binding=1) buffer bufferCollide { float collideCells[]; }; +layout (std430, binding=2) buffer bufferStream { float streamCells[]; }; +layout (std430, binding=4) buffer bufferGeometry { int materialCells[]; }; /// LBM constants @@ -33,6 +34,10 @@ void set(uint x, uint y, int i, int j, float v) { streamCells[indexOfLatticeCell(x,y) + indexOfDirection(i,j)] = v; } +int getMaterial(uint x, uint y) { + return materialCells[nX*y + x]; +} + /// Domain description bool isEndOfWorld(uint x, uint y) { @@ -63,11 +68,13 @@ void main() { return; } - if ( isEndOfWorld(x,y) ) { + const int material = getMaterial(x,y); + + if ( material == 0 ) { return; } - if ( isOuterWall(x,y) ) { + if ( material == 2 ) { bounceBack(x,y); } |