Guest User

smoke vs structure (Fell^RiFT)

a guest
Jul 2nd, 2012
90
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. with(document.body){
  2.     innerHTML='<canvas id=c>';
  3.     style.margin=0
  4. }
  5. c.width=w=innerWidth;
  6. c.height=h=innerHeight;
  7.  
  8. for(k in g=c.getContext('experimental-webgl'))
  9.     g[k.match(/^..|[A-Z]|1f$/g).join('')]=g[k];
  10.  
  11. with(g){
  12.     p=crP();
  13.     s=function(n,t){
  14.         a=crS(t);
  15.         shS(a,n);
  16.         coS(a);
  17.         atS(p,a)
  18.     }  
  19.    
  20.     s('attribute vec4 p;void main(){gl_Position=p;}',t=35633);
  21.     s('precision lowp float;uniform float t;float b(vec3 p,vec3 b){vec3 q=abs(p)-b;return min(max(q.x,max(q.y,q.z)),length(max(q,0.)));}float h(vec3 p){vec3 q=vec3(2.5),a,r,k=vec3(1e2,1,0);p=mod(p,q)-q/2.;float d=b(p,vec3(1)),s=1.;for(int i=0;i<3;i++){a=mod(p*s,2.)-1.;s*=(2.+t)/3.;r=1.5-3.0*abs(a);d=max(d,-min(b(r,k.xyy),min(b(r.yzx,k.yxy),b(r.zxy,k.yyx)))/s);}return d;}void main(){vec2 q=-1.+2.*gl_FragCoord.xy/vec2('+w+','+h+');q.x*='+(w/h)+';float d=0.;vec3 p=vec3(.1*sin(t),.5,6.*t),w=normalize(-p),u=normalize(cross(vec3(cos(6.*t),sin(6.*t),0),w)),r=normalize(q.x*u+q.y*normalize(cross(w,u))+w);for(int i=0;i<64;i++){d=h(p)-.001;if(d<.001)break;p+=r*d/4.;}d=0.;for(float i=0.;i<9.;i++)d+=h(p+vec3(cos(i),sin(i),-cos(i))/4.);t<1.?d*=t:d;gl_FragColor=vec4(h(p+.1)*vec3(1,.4,.2)*d*d,1);}',--t);
  22.  
  23.     biB(t-=670,crB(liP(p)));
  24.     buD(t,new Float32Array([1,1,1,-3,-3,1]),t+82);
  25.    
  26.     t=0;
  27.     setInterval(function(){
  28.         drA(4,enVAA(veAP(usP(p),2,5126,false,un1f(geUL(p,'t'),t+=.006),0)),3)
  29.     },20)
  30. }
RAW Paste Data