From f0b536ac93b3a9a49dfff8a7637f09b153a3b955 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Fri, 22 Feb 2019 21:49:07 +0100 Subject: 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. --- src/shader/code/stream.glsl | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/shader/code/stream.glsl') 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); } -- cgit v1.2.3