diff options
author | Nivesh Rajbhandari | 2012-02-22 11:52:31 -0800 |
---|---|---|
committer | Nivesh Rajbhandari | 2012-02-22 11:52:31 -0800 |
commit | d5b216d9d6d2b8cb93106e8f8ca351089d05b41d (patch) | |
tree | 657274b7efd3a930e4d3298ad6c245b975a8224b /assets/shaders/Star.frag.glsl | |
parent | dae612ccef06a18eb7cccc2fd9d0db13ec4ef5f9 (diff) | |
download | ninja-d5b216d9d6d2b8cb93106e8f8ca351089d05b41d.tar.gz |
Integrating canvas-2d and WebGL drawing fixes. Also adding back WebGL materials.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'assets/shaders/Star.frag.glsl')
-rw-r--r-- | assets/shaders/Star.frag.glsl | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/assets/shaders/Star.frag.glsl b/assets/shaders/Star.frag.glsl new file mode 100644 index 00000000..f63fe605 --- /dev/null +++ b/assets/shaders/Star.frag.glsl | |||
@@ -0,0 +1,28 @@ | |||
1 | #ifdef GL_ES | ||
2 | precision highp float; | ||
3 | #endif | ||
4 | |||
5 | uniform float u_time; | ||
6 | uniform vec2 u_resolution; | ||
7 | uniform sampler2D u_tex0; | ||
8 | |||
9 | void main(void) | ||
10 | { | ||
11 | vec2 uv; | ||
12 | |||
13 | vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / u_resolution.xy; | ||
14 | float a = atan(p.y,p.x); | ||
15 | float r = sqrt(dot(p,p)); | ||
16 | float s = r * (1.0+0.8*cos(u_time*1.0)); | ||
17 | |||
18 | uv.x = .02*p.y+.03*cos(-u_time+a*3.0)/s; | ||
19 | uv.y = .1*u_time +.02*p.x+.03*sin(-u_time+a*3.0)/s; | ||
20 | |||
21 | float w = .9 + pow(max(1.5-r,0.0),4.0); | ||
22 | |||
23 | w*=0.6+0.4*cos(u_time+3.0*a); | ||
24 | |||
25 | vec3 col = texture2D(u_tex0,uv).xyz; | ||
26 | |||
27 | gl_FragColor = vec4(col*w,1.0); | ||
28 | } \ No newline at end of file | ||