aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)));
}
)";