aboutsummaryrefslogtreecommitdiff
path: root/src/shader/code
diff options
context:
space:
mode:
authorAdrian Kummerlaender2018-12-19 19:31:10 +0100
committerAdrian Kummerlaender2018-12-19 19:31:10 +0100
commit8df8940bced82cad259bc8144aa3668871222d22 (patch)
tree97a28fbbf181a6b21a0a44936638950bdbb55cb2 /src/shader/code
parent994f70f0dd8fff208fab050a8a58f7fdf7bcfb24 (diff)
downloadcompustream-8df8940bced82cad259bc8144aa3668871222d22.tar
compustream-8df8940bced82cad259bc8144aa3668871222d22.tar.gz
compustream-8df8940bced82cad259bc8144aa3668871222d22.tar.bz2
compustream-8df8940bced82cad259bc8144aa3668871222d22.tar.lz
compustream-8df8940bced82cad259bc8144aa3668871222d22.tar.xz
compustream-8df8940bced82cad259bc8144aa3668871222d22.tar.zst
compustream-8df8940bced82cad259bc8144aa3668871222d22.zip
Use GLSL's mix function for color scaling
Diffstat (limited to 'src/shader/code')
-rw-r--r--src/shader/code/vertex.glsl11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/shader/code/vertex.glsl b/src/shader/code/vertex.glsl
index 1051d8f..700a9b7 100644
--- a/src/shader/code/vertex.glsl
+++ b/src/shader/code/vertex.glsl
@@ -24,17 +24,12 @@ 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);
-}
-
vec2 fluidVertexAtIndex(uint i) {
const float y = floor(float(i) / float(nX));
return vec2(
i - nX*y,
y
);
-
}
void main() {
@@ -47,6 +42,10 @@ void main() {
1.
);
- vs_out.color = getColor(unit(displayAmplifier * VertexPosition.z * norm(VertexPosition.xy)));
+ vs_out.color = mix(
+ vec3(-0.5, 0.0, 1.0),
+ vec3( 1.0, 0.0, 0.0),
+ displayAmplifier * VertexPosition.z * norm(VertexPosition.xy)
+ );
}
)";