From ce334547f0f0560386ca8b97f354d83da68019a5 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Sun, 16 Dec 2018 22:09:17 +0100 Subject: Generate fluid display using geometry shaders This should provide much more flexibility. For our purpose it would be useful if the vertex shader was executed after the geometry shader (to apply the projection matrix) but alas this is not the case. Thus the MVP matrix is applied during geometry construction and the vertex shader only provides density extraction. --- src/shader/code/collide.glsl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/shader/code/collide.glsl') diff --git a/src/shader/code/collide.glsl b/src/shader/code/collide.glsl index 90af535..936ca89 100644 --- a/src/shader/code/collide.glsl +++ b/src/shader/code/collide.glsl @@ -13,7 +13,7 @@ uniform uint nY; const uint q = 9; const float omega = 0.6; -const float velocityDisplayScalar = 500.; +const float displayAmplifier = 50.; float get(uint x, uint y, int i, int j) { return collideCells[q*nX*y + q*x + (i+1)*3 + j+1]; @@ -24,8 +24,8 @@ void set(uint x, uint y, int i, int j, float v) { } void setFluid(uint x, uint y, vec2 v, float d) { - fluidCells[3*nX*y + 3*x + 0] = float(x)-nX/2 + velocityDisplayScalar*v.x; - fluidCells[3*nX*y + 3*x + 1] = float(y)-nY/2 + velocityDisplayScalar*v.y; + fluidCells[3*nX*y + 3*x + 0] = float(x)-nX/2 + displayAmplifier*v.x; + fluidCells[3*nX*y + 3*x + 1] = float(y)-nY/2 + displayAmplifier*v.y; fluidCells[3*nX*y + 3*x + 2] = d; } -- cgit v1.2.3