diff options
author | hwc487 | 2012-07-09 16:08:02 -0700 |
---|---|---|
committer | hwc487 | 2012-07-09 16:08:02 -0700 |
commit | 5085d0f67df89a21715308956004164597a6ba79 (patch) | |
tree | 2c896163143a66331205a39b0a3b1b45d51bf12a /assets/shaders/linearGradient.frag.glsl | |
parent | 51f1691f792dbda9b740ded8aa0457c9406db156 (diff) | |
parent | 84b3327bd92faafab7954b5eb64c7abe24a3fe13 (diff) | |
download | ninja-5085d0f67df89a21715308956004164597a6ba79.tar.gz |
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal into GridFixes
Conflicts:
js/helper-classes/3D/StageLine.js
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 | } |