From 9779fd7484f7af6d10ae28ca3763c6d938c341e3 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Fri, 22 Feb 2019 22:24:30 +0100 Subject: Tidy up wall drawing and geometry initialization --- src/main.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/main.cc') diff --git a/src/main.cc b/src/main.cc index 0a400a5..f685c8f 100644 --- a/src/main.cc +++ b/src/main.cc @@ -79,7 +79,15 @@ int renderWindow() { lattice_a = std::make_unique(nX, nY); lattice_b = std::make_unique(nX, nY); fluid = std::make_unique< FluidCellBuffer>(nX, nY); - geometry = std::make_unique< MaterialBuffer>(nX, nY); + geometry = std::make_unique< MaterialBuffer>(nX, nY, [](int x, int y) -> int { + if ( x == 0 || y == 0 || x == nX-1 || y == nY-1 ) { + return 0; // disable end of world + } + if ( (x == 1 || x == nX-2) && (y == 1 || y == nY-2) ) { + return 2; // bounce back outer walls + } + return 1; // everything shall be fluid + }); collide_shader = std::make_unique(COLLIDE_SHADER_CODE); stream_shader = std::make_unique(STREAM_SHADER_CODE); -- cgit v1.2.3