aboutsummaryrefslogtreecommitdiff
path: root/src/shader
diff options
context:
space:
mode:
authorAdrian Kummerlaender2019-04-17 20:50:49 +0200
committerAdrian Kummerlaender2019-04-17 20:50:49 +0200
commit303025eda4e10a0d962231c7b3349f8b9cb8cfa1 (patch)
treeb20e3037cde3a0362003513a0a9f155214b9093f /src/shader
parente40114aad7fb5665c97c1b048515f0443cda5700 (diff)
downloadcompustream-303025eda4e10a0d962231c7b3349f8b9cb8cfa1.tar
compustream-303025eda4e10a0d962231c7b3349f8b9cb8cfa1.tar.gz
compustream-303025eda4e10a0d962231c7b3349f8b9cb8cfa1.tar.bz2
compustream-303025eda4e10a0d962231c7b3349f8b9cb8cfa1.tar.lz
compustream-303025eda4e10a0d962231c7b3349f8b9cb8cfa1.tar.xz
compustream-303025eda4e10a0d962231c7b3349f8b9cb8cfa1.tar.zst
compustream-303025eda4e10a0d962231c7b3349f8b9cb8cfa1.zip
Improve color palette of Knudsen criterion mode
Diffstat (limited to 'src/shader')
-rw-r--r--src/shader/code/collide.glsl2
-rw-r--r--src/shader/code/vertex.glsl22
2 files changed, 18 insertions, 6 deletions
diff --git a/src/shader/code/collide.glsl b/src/shader/code/collide.glsl
index 45e06f8..d3d004d 100644
--- a/src/shader/code/collide.glsl
+++ b/src/shader/code/collide.glsl
@@ -34,7 +34,7 @@ const float relaxationFrequency = 1 / relaxationTime;
/// Unit conversion
-const float convLength = physCharLength / nX;
+const float convLength = physCharLength / max(nX,nY);
const float convTime = (relaxationTime - 0.5) / invCs2 * convLength*convLength / physViscosity;
const float convVelocity = convLength / convTime;
const float convViscosity = convLength * convLength / convTime;
diff --git a/src/shader/code/vertex.glsl b/src/shader/code/vertex.glsl
index 8958600..e64a983 100644
--- a/src/shader/code/vertex.glsl
+++ b/src/shader/code/vertex.glsl
@@ -51,6 +51,22 @@ float restrictedQuality(float quality) {
}
}
+vec3 trafficLightPalette(float x) {
+ if ( x < 0.5 ) {
+ return mix(
+ vec3(0.0, 1.0, 0.0),
+ vec3(1.0, 1.0, 0.0),
+ 2*x
+ );
+ } else {
+ return mix(
+ vec3(1.0, 1.0, 0.0),
+ vec3(1.0, 0.0, 0.0),
+ 2*(x - 0.5)
+ );
+ }
+}
+
void main() {
const vec2 idx = fluidVertexAtIndex(gl_VertexID);
@@ -69,11 +85,7 @@ void main() {
vs_out.color = vec3(0.0, 0.0, 0.0);
} else {
if ( fluidQuality ) {
- vs_out.color = mix(
- vec3(0.0, 1.0, 0.0),
- vec3(1.0, 0.0, 0.0),
- restrictedQuality(VertexPosition.y)
- );
+ vs_out.color = trafficLightPalette(restrictedQuality(VertexPosition.y));
} else {
vs_out.color = mix(
vec3(-0.5, 0.0, 1.0),