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