diff options
Diffstat (limited to 'assets/shaders/linearGradient.frag.glsl')
-rwxr-xr-x | assets/shaders/linearGradient.frag.glsl | 68 |
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 | ||
36 | uniform vec4 u_color1; | 36 | uniform vec4 u_color1; |
37 | uniform vec4 u_color2; | 37 | uniform vec4 u_color2; |
38 | uniform vec4 u_color3; | 38 | uniform vec4 u_color3; |
39 | uniform vec4 u_color4; | 39 | uniform vec4 u_color4; |
40 | uniform float u_colorStop1; | 40 | uniform float u_colorStop1; |
41 | uniform float u_colorStop2; | 41 | uniform float u_colorStop2; |
42 | uniform float u_colorStop3; | 42 | uniform float u_colorStop3; |
43 | uniform float u_colorStop4; | 43 | uniform float u_colorStop4; |
44 | uniform vec2 u_cos_sin_angle; | 44 | uniform vec2 u_cos_sin_angle; |
45 | //uniform int u_colorCount; // currently using 4 | 45 | //uniform int u_colorCount; // currently using 4 |
46 | 46 | ||
47 | varying vec2 v_uv; | 47 | varying vec2 v_uv; |
48 | 48 | ||
49 | 49 | ||
50 | void main(void) | 50 | void 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 | } |