diff options
Tidy up streaming and bounce back boundary handling
Introduce a inactive receive-only outer boundary to simplify streaming.
Extract and generalize bounce back handling. Further work will require
tracking cell _material_ to enable both easier definition and dynamic
updating of the geometry.
Diffstat (limited to 'src/shader/code/collide.glsl')
| -rw-r--r-- | src/shader/code/collide.glsl | 18 | 
1 files changed, 18 insertions, 0 deletions
diff --git a/src/shader/code/collide.glsl b/src/shader/code/collide.glsl index 23e98f9..cb950cb 100644 --- a/src/shader/code/collide.glsl +++ b/src/shader/code/collide.glsl @@ -110,6 +110,16 @@ float getExternalPressureInflux(uint x, uint y) {  	}  } +/// Domain description + +bool isEndOfWorld(uint x, uint y) { +	return x == 0 || x == nX-1 || y == 0 || y == nY-1; +} + +bool isOuterWall(uint x, uint y) { +	return x == 1 || x == nX-2 || y == 1 || y == nY-2; +} +  /// Actual collide kernel  void main() { @@ -120,6 +130,14 @@ void main() {  		return;  	} +	if ( isEndOfWorld(x,y) ) { +		return; +	} + +	if ( isOuterWall(x,y) ) { +		return; +	} +  	const float d = max(getExternalPressureInflux(x,y), density(x,y));  	const vec2  v = velocity(x,y,d);  | 
