aboutsummaryrefslogtreecommitdiff
path: root/assets/shaders/linearGradient.frag.glsl
diff options
context:
space:
mode:
Diffstat (limited to 'assets/shaders/linearGradient.frag.glsl')
-rwxr-xr-xassets/shaders/linearGradient.frag.glsl68
1 files changed, 34 insertions, 34 deletions
diff --git a/assets/shaders/linearGradient.frag.glsl b/assets/shaders/linearGradient.frag.glsl
index 111dffbd..03310255 100755
--- a/assets/shaders/linearGradient.frag.glsl
+++ b/assets/shaders/linearGradient.frag.glsl
@@ -33,44 +33,44 @@ precision highp float;
33#endif 33#endif
34 34
35 35
36uniform vec4 u_color1; 36uniform vec4 u_color1;
37uniform vec4 u_color2; 37uniform vec4 u_color2;
38uniform vec4 u_color3; 38uniform vec4 u_color3;
39uniform vec4 u_color4; 39uniform vec4 u_color4;
40uniform float u_colorStop1; 40uniform float u_colorStop1;
41uniform float u_colorStop2; 41uniform float u_colorStop2;
42uniform float u_colorStop3; 42uniform float u_colorStop3;
43uniform float u_colorStop4; 43uniform float u_colorStop4;
44uniform vec2 u_cos_sin_angle; 44uniform vec2 u_cos_sin_angle;
45//uniform int u_colorCount; // currently using 4 45//uniform int u_colorCount; // currently using 4
46 46
47varying vec2 v_uv; 47varying vec2 v_uv;
48 48
49 49
50void main(void) 50void main(void)
51{ 51{
52 float t = dot(v_uv, u_cos_sin_angle); 52 float t = dot(v_uv, u_cos_sin_angle);
53 53
54 vec4 color; 54 vec4 color;
55 if (t < u_colorStop1) 55 if (t < u_colorStop1)
56 color = u_color1; 56 color = u_color1;
57 else if (t < u_colorStop2) 57 else if (t < u_colorStop2)
58 { 58 {
59 float tLocal = (t - u_colorStop1)/(u_colorStop2 - u_colorStop1); 59 float tLocal = (t - u_colorStop1)/(u_colorStop2 - u_colorStop1);
60 color = mix(u_color1,u_color2,tLocal); 60 color = mix(u_color1,u_color2,tLocal);
61 } 61 }
62 else if (t < u_colorStop3) 62 else if (t < u_colorStop3)
63 { 63 {
64 float tLocal = (t - u_colorStop2)/(u_colorStop3 - u_colorStop2); 64 float tLocal = (t - u_colorStop2)/(u_colorStop3 - u_colorStop2);
65 color = mix(u_color2,u_color3,tLocal); 65 color = mix(u_color2,u_color3,tLocal);
66 } 66 }
67 else if (t < u_colorStop4) 67 else if (t < u_colorStop4)
68 { 68 {
69 float tLocal = (t - u_colorStop3)/(u_colorStop4 - u_colorStop3); 69 float tLocal = (t - u_colorStop3)/(u_colorStop4 - u_colorStop3);
70 color = mix(u_color3,u_color4,tLocal); 70 color = mix(u_color3,u_color4,tLocal);
71 } 71 }
72 else 72 else
73 color = u_color4; 73 color = u_color4;
74 74
75 gl_FragColor =color; 75 gl_FragColor =color;
76} 76}