aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2018-12-18 20:04:51 +0100
committerAdrian Kummerlaender2018-12-18 20:04:51 +0100
commitd58c4cbeb95e25ea08994e4d39f657d078a33782 (patch)
tree78c1cd59a55ad17bbb03a516bb3fcf0a105360c7
parentfed710754296111a51b1b99b40a3c5e5dc873895 (diff)
downloadcompustream-d58c4cbeb95e25ea08994e4d39f657d078a33782.tar
compustream-d58c4cbeb95e25ea08994e4d39f657d078a33782.tar.gz
compustream-d58c4cbeb95e25ea08994e4d39f657d078a33782.tar.bz2
compustream-d58c4cbeb95e25ea08994e4d39f657d078a33782.tar.lz
compustream-d58c4cbeb95e25ea08994e4d39f657d078a33782.tar.xz
compustream-d58c4cbeb95e25ea08994e4d39f657d078a33782.tar.zst
compustream-d58c4cbeb95e25ea08994e4d39f657d078a33782.zip
Use pressure as velocity norm display amplifier
-rw-r--r--src/shader/code/collide.glsl2
-rw-r--r--src/shader/code/vertex.glsl12
2 files changed, 11 insertions, 3 deletions
diff --git a/src/shader/code/collide.glsl b/src/shader/code/collide.glsl
index cbddfa9..78d3936 100644
--- a/src/shader/code/collide.glsl
+++ b/src/shader/code/collide.glsl
@@ -68,7 +68,7 @@ void setFluid(uint x, uint y, vec2 v, float d) {
const uint idx = indexOfFluidVertex(x, y);
fluidCells[idx + 0] = v.x;
fluidCells[idx + 1] = v.y;
- fluidCells[idx + 2] = norm(v);
+ fluidCells[idx + 2] = d;
}
/// Moments
diff --git a/src/shader/code/vertex.glsl b/src/shader/code/vertex.glsl
index e132e5f..1051d8f 100644
--- a/src/shader/code/vertex.glsl
+++ b/src/shader/code/vertex.glsl
@@ -10,12 +10,20 @@ out VS_OUT {
uniform uint nX;
uniform uint nY;
-const float displayAmplifier = 10.0;
+const float displayAmplifier = 5.0;
float unit(float x) {
return 1.0/(1.0+exp(-x));
}
+float sq(float x) {
+ return x*x;
+}
+
+float norm(vec2 v) {
+ return sqrt(sq(v.x)+sq(v.y));
+}
+
vec3 getColor(float x) {
return x*vec3(1.0,0.0,0.0) + (1-x)*vec3(-0.5,0.0,1.0);
}
@@ -39,6 +47,6 @@ void main() {
1.
);
- vs_out.color = getColor(unit(displayAmplifier * VertexPosition.z));
+ vs_out.color = getColor(unit(displayAmplifier * VertexPosition.z * norm(VertexPosition.xy)));
}
)";