aboutsummaryrefslogtreecommitdiff
path: root/src/main.cc
diff options
context:
space:
mode:
authorAdrian Kummerlaender2019-02-25 21:29:03 +0100
committerAdrian Kummerlaender2019-02-25 21:29:03 +0100
commit9ed8efcc53f54dce8ec34279e47df851693854ec (patch)
treeae21515cc6c7ef64ad31e712ce3990ae8296ac0d /src/main.cc
parent26c1cf58f483e64d80703fe37c4bd3923d1ff5b7 (diff)
downloadcompustream-9ed8efcc53f54dce8ec34279e47df851693854ec.tar
compustream-9ed8efcc53f54dce8ec34279e47df851693854ec.tar.gz
compustream-9ed8efcc53f54dce8ec34279e47df851693854ec.tar.bz2
compustream-9ed8efcc53f54dce8ec34279e47df851693854ec.tar.lz
compustream-9ed8efcc53f54dce8ec34279e47df851693854ec.tar.xz
compustream-9ed8efcc53f54dce8ec34279e47df851693854ec.tar.zst
compustream-9ed8efcc53f54dce8ec34279e47df851693854ec.zip
Add cylinder and dampened inflow to open geometry
Diffstat (limited to 'src/main.cc')
-rw-r--r--src/main.cc19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/main.cc b/src/main.cc
index fb3bfd0..0b4df95 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -23,10 +23,10 @@
#include "timer.h"
-constexpr GLuint nX = 256;
+constexpr GLuint nX = 512;
constexpr GLuint nY = 128;
-constexpr int lups = 50; // max lattice updates per second
+constexpr int lups = 100; // max lattice updates per second
float getWorldHeight(int window_width, int window_height, float world_width) {
return world_width / window_width * window_height;
@@ -64,10 +64,10 @@ int setupOpenGeometry(int x, int y) {
return 0; // disable end of world
}
if ( (x == 1 || x == nX-2) && (y > 0 && y < nY-1) ) {
- if ( x == 1 && y > nY/4 && y < 3*nY/4 ) {
+ if ( x == 1 && y > 1 && y < nY-2 ) {
return 5; // inflow
}
- if ( x == nX-2 && y > nY/4 && y < 3*nY/4 ) {
+ if ( x == nX-2 && y > 1 && y < nY-2 ) {
return 6; // outflow
}
return 2; // bounce back outer walls
@@ -75,6 +75,9 @@ int setupOpenGeometry(int x, int y) {
if ( (y == 1 || y == nY-2) && (x > 0 && x < nX-1) ) {
return 2; // bounce back outer walls
}
+ if ( (x-50)*(x-50) + (y-nY/2)*(y-nY/2) < 200 ) {
+ return 3; // bounce back cylinder
+ }
return 1; // everything else shall be bulk fluid
}
@@ -86,7 +89,7 @@ int render(bool open_boundaries) {
return -1;
}
- float world_width = 1*nX;
+ float world_width = 1.1*nX;
float world_height = getWorldHeight(window.getWidth(), window.getHeight(), world_width);
glm::mat4 MVP = getMVP(world_width, world_height);
@@ -124,6 +127,8 @@ int render(bool open_boundaries) {
auto pause_key = window.getKeyWatcher(GLFW_KEY_SPACE);
+ GLuint iT = 0;
+
int prevMouseState = 0;
float prevLatticeMouseX;
float prevLatticeMouseY;
@@ -186,6 +191,10 @@ int render(bool open_boundaries) {
/// Perform collide & stream steps
{
auto guard = collide_shader->use();
+
+ collide_shader->setUniform("iT", iT);
+ iT += 1;
+
collide_shader->dispatch(nX, nY);
}