aboutsummaryrefslogtreecommitdiff
path: root/assets/shaders/Mandel.frag.glsl
diff options
context:
space:
mode:
authorKruti Shah2012-07-17 12:40:00 -0700
committerKruti Shah2012-07-17 12:40:00 -0700
commitbf2d7bdb22c28089dc1067bc9094ebc590daac87 (patch)
tree2156d9920ea1b7db49ed6460545fea7cda121bae /assets/shaders/Mandel.frag.glsl
parent7e2c2dbd040ed79a3f0678f91bd4b6db9cf69231 (diff)
parentb4b3e45d6684e77d361b4f8ca5be4889428320c5 (diff)
downloadninja-bf2d7bdb22c28089dc1067bc9094ebc590daac87.tar.gz
Merge branch 'refs/heads/TimelineUberJD' into Timeline-local-kruti
Diffstat (limited to 'assets/shaders/Mandel.frag.glsl')
-rw-r--r--assets/shaders/Mandel.frag.glsl58
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
2precision highp float;
3#endif
4
5uniform vec2 u_resolution;
6uniform float u_time;
7uniform float u_speed;
8
9void 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