diff options
author | Valerio Virgillito | 2012-07-19 15:59:27 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-07-19 15:59:27 -0700 |
commit | 4b1a4b6b424400080271202800d2de78e5509708 (patch) | |
tree | 6554afcb8c3b8d83d1e9bb33241e239773f396e8 /assets/shaders | |
parent | c97f806fceb2a2e3c668b965e4f8e6fc047a3d9a (diff) | |
parent | 431b6fa7610e59074b4ebb3e9e712672f185b8ad (diff) | |
download | ninja-4b1a4b6b424400080271202800d2de78e5509708.tar.gz |
Merge branch 'RadialBlur' of https://github.com/ericmueller/ninja into v0.7.1
Diffstat (limited to 'assets/shaders')
-rw-r--r-- | assets/shaders/Paris.frag.glsl | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/assets/shaders/Paris.frag.glsl b/assets/shaders/Paris.frag.glsl deleted file mode 100644 index 690b1453..00000000 --- a/assets/shaders/Paris.frag.glsl +++ /dev/null | |||
@@ -1,68 +0,0 @@ | |||
1 | #ifdef GL_ES | ||
2 | precision highp float; | ||
3 | #endif | ||
4 | |||
5 | uniform sampler2D u_tex0; | ||
6 | uniform float u_time; | ||
7 | uniform vec2 u_resolution; | ||
8 | const float PI = 3.1415926535897932; | ||
9 | |||
10 | //speed | ||
11 | |||
12 | const float speed = 0.1; | ||
13 | const float speed_x = 0.075; | ||
14 | const float speed_y = 0.000; | ||
15 | |||
16 | // geometry | ||
17 | const float intensity = 1.5; | ||
18 | const int steps = 8; | ||
19 | //const float frequency = 4.0; | ||
20 | const float frequency = 2.0; | ||
21 | const int angle = 7; // better when a prime | ||
22 | |||
23 | // reflection and emboss | ||
24 | const float delta = 20.; | ||
25 | const float intence = 400.; | ||
26 | const float emboss = 0.3; | ||
27 | |||
28 | //---------- crystals effect | ||
29 | |||
30 | float col(vec2 coord) | ||
31 | { | ||
32 | float delta_theta = 2.0 * PI / float(angle); | ||
33 | float col = 0.0; | ||
34 | float theta = 0.0; | ||
35 | for (int i = 0; i < steps; i++) | ||
36 | { | ||
37 | vec2 adjc = coord; | ||
38 | theta = delta_theta*float(i); | ||
39 | adjc.x += cos(theta)*u_time*speed + u_time * speed_x; | ||
40 | adjc.y -= sin(theta)*u_time*speed - u_time * speed_y; | ||
41 | col = col + cos( (adjc.x*cos(theta) - adjc.y*sin(theta))*frequency)*intensity; | ||
42 | } | ||
43 | |||
44 | return cos(col); | ||
45 | } | ||
46 | |||
47 | //---------- main | ||
48 | |||
49 | void main(void) | ||
50 | { | ||
51 | vec2 p = (gl_FragCoord.xy) / u_resolution.xy, c1 = p, c2 = p; | ||
52 | float cc1 = col(c1); | ||
53 | |||
54 | c2.x += u_resolution.x/delta; | ||
55 | float dx = emboss*(cc1-col(c2))/delta; | ||
56 | |||
57 | c2.x = p.x; | ||
58 | c2.y += u_resolution.y/delta; | ||
59 | float dy = emboss*(cc1-col(c2))/delta; | ||
60 | |||
61 | c1.x += dx; | ||
62 | c1.y = -(c1.y+dy); | ||
63 | |||
64 | float alpha = 1.+dot(dx,dy)*intence; | ||
65 | gl_FragColor = texture2D(u_tex0,c1)*(alpha); | ||
66 | // gl_FragColor = vec4(col(p),0,0,1); | ||
67 | |||
68 | } | ||