aboutsummaryrefslogtreecommitdiff
path: root/assets/shaders/Star.frag.glsl
diff options
context:
space:
mode:
authorhwc4872012-06-12 10:28:26 -0700
committerhwc4872012-06-12 10:28:26 -0700
commitd4ca478ad313c6c20834e410ba14ad3a5e7b20bf (patch)
tree28e44c5ab1b2f9dbfd32aedba51402ac2d26a0ff /assets/shaders/Star.frag.glsl
parentdb2bb0ab5d2747f0d07878e3b8a7d2d10c755110 (diff)
downloadninja-d4ca478ad313c6c20834e410ba14ad3a5e7b20bf.tar.gz
Material cleanup & bug fixes.
Diffstat (limited to 'assets/shaders/Star.frag.glsl')
-rw-r--r--assets/shaders/Star.frag.glsl11
1 files changed, 7 insertions, 4 deletions
diff --git a/assets/shaders/Star.frag.glsl b/assets/shaders/Star.frag.glsl
index f63fe605..f61f43c9 100644
--- a/assets/shaders/Star.frag.glsl
+++ b/assets/shaders/Star.frag.glsl
@@ -3,6 +3,7 @@ precision highp float;
3#endif 3#endif
4 4
5uniform float u_time; 5uniform float u_time;
6uniform float u_speed;
6uniform vec2 u_resolution; 7uniform vec2 u_resolution;
7uniform sampler2D u_tex0; 8uniform sampler2D u_tex0;
8 9
@@ -10,17 +11,19 @@ void main(void)
10{ 11{
11 vec2 uv; 12 vec2 uv;
12 13
14 float time = u_time * u_speed;
15
13 vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / u_resolution.xy; 16 vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / u_resolution.xy;
14 float a = atan(p.y,p.x); 17 float a = atan(p.y,p.x);
15 float r = sqrt(dot(p,p)); 18 float r = sqrt(dot(p,p));
16 float s = r * (1.0+0.8*cos(u_time*1.0)); 19 float s = r * (1.0+0.8*cos(time*1.0));
17 20
18 uv.x = .02*p.y+.03*cos(-u_time+a*3.0)/s; 21 uv.x = .02*p.y+.03*cos(-time+a*3.0)/s;
19 uv.y = .1*u_time +.02*p.x+.03*sin(-u_time+a*3.0)/s; 22 uv.y = .1*time +.02*p.x+.03*sin(-time+a*3.0)/s;
20 23
21 float w = .9 + pow(max(1.5-r,0.0),4.0); 24 float w = .9 + pow(max(1.5-r,0.0),4.0);
22 25
23 w*=0.6+0.4*cos(u_time+3.0*a); 26 w*=0.6+0.4*cos(time+3.0*a);
24 27
25 vec3 col = texture2D(u_tex0,uv).xyz; 28 vec3 col = texture2D(u_tex0,uv).xyz;
26 29