diff options
author | Jose Antonio Marquez | 2012-07-10 11:17:45 -0700 |
---|---|---|
committer | Jose Antonio Marquez | 2012-07-10 11:17:45 -0700 |
commit | 7d42a17a67eaec57e78f5fa730c1481515904a44 (patch) | |
tree | 738f5c0bde04ce175766db302922c6a3d70882fe /assets/shaders/Mandel.frag.glsl | |
parent | cdaf0fdf64ddc12cacdc58c357053ff4652b7f46 (diff) | |
parent | 2f81cac4e10f9f4e4b44b6186de0d3d831d75bc4 (diff) | |
download | ninja-7d42a17a67eaec57e78f5fa730c1481515904a44.tar.gz |
Merge branch 'refs/heads/Ninja-Master' into Color
Diffstat (limited to 'assets/shaders/Mandel.frag.glsl')
-rw-r--r-- | assets/shaders/Mandel.frag.glsl | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/assets/shaders/Mandel.frag.glsl b/assets/shaders/Mandel.frag.glsl deleted file mode 100644 index 62be76b9..00000000 --- a/assets/shaders/Mandel.frag.glsl +++ /dev/null | |||
@@ -1,58 +0,0 @@ | |||
1 | #ifdef GL_ES | ||
2 | precision highp float; | ||
3 | #endif | ||
4 | |||
5 | uniform vec2 u_resolution; | ||
6 | uniform float u_time; | ||
7 | uniform float u_speed; | ||
8 | |||
9 | void main(void) | ||
10 | { | ||
11 | vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / u_resolution.xy; | ||
12 | p.x *= u_resolution.x/u_resolution.y; | ||
13 | |||
14 | float time = u_time * u_speed; | ||
15 | |||
16 | float zoo = .62+.38*sin(.1*time); | ||
17 | float coa = cos( 0.1*(1.0-zoo)*time ); | ||
18 | float sia = sin( 0.1*(1.0-zoo)*time ); | ||
19 | zoo = pow( zoo,8.0); | ||
20 | vec2 xy = vec2( p.x*coa-p.y*sia, p.x*sia+p.y*coa); | ||
21 | vec2 cc = vec2(-.745,.186) + xy*zoo; | ||
22 | |||
23 | vec2 z = vec2(0.0); | ||
24 | vec2 z2 = z*z; | ||
25 | float m2; | ||
26 | float co = 0.0; | ||
27 | |||
28 | |||
29 | // chrome/angelproject/nvidia/glslES don't seem to like to "break" a loop... | ||
30 | // so we have to rewrite it in another way | ||
31 | /* | ||
32 | for( int i=0; i<256; i++ ) | ||
33 | { | ||
34 | z = cc + vec2( z.x*z.x - z.y*z.y, 2.0*z.x*z.y ); | ||
35 | m2 = dot(z,z); | ||
36 | if( m2>1024.0 ) break; | ||
37 | co += 1.0; | ||
38 | } | ||
39 | */ | ||
40 | |||
41 | for( int i=0; i<256; i++ ) | ||
42 | { | ||
43 | if( m2<1024.0 ) | ||
44 | { | ||
45 | z = cc + vec2( z.x*z.x - z.y*z.y, 2.0*z.x*z.y ); | ||
46 | m2 = dot(z,z); | ||
47 | co += 1.0; | ||
48 | } | ||
49 | } | ||
50 | |||
51 | co = co + 1.0 - log2(.5*log2(m2)); | ||
52 | |||
53 | co = sqrt(co/256.0); | ||
54 | gl_FragColor = vec4( .5+.5*cos(6.2831*co+0.0), | ||
55 | .5+.5*cos(6.2831*co+0.4), | ||
56 | .5+.5*cos(6.2831*co+0.7), | ||
57 | 1.0 ); | ||
58 | } \ No newline at end of file | ||