diff --git a/src/rewriter.fs b/src/rewriter.fs index c2cf1e0b..be3df938 100644 --- a/src/rewriter.fs +++ b/src/rewriter.fs @@ -455,10 +455,10 @@ module private RewriterImpl = | None -> Some [] | _ -> None match declElts, (declElts |> List.rev) with - //| [declElt2], _ -> // float d1=f(); ...; float d2=g(); -> ...; d1=g(); - // match findAssignmentReplacementFor declElt2 with - // | Some stmts -> Some stmts // Replace the Decl with the assignment. Largest win - // | None -> None + | [declElt2], _ -> // float d1=f(); ...; float d2=g(); -> ...; d1=g(); + match findAssignmentReplacementFor declElt2 with + | Some stmts -> Some stmts // Replace the Decl with the assignment. Largest win + | None -> None //| (declElt2 :: others), _ -> // float d1=f(); ...; float d2=g(),d3=h(); -> ...; d1=g(); float d3=h(); // match findAssignmentReplacementFor declElt2 with // | Some stmts -> Some (stmts @ [Decl (ty2, others)]) // Keep the Decl, add an assignment before it. diff --git a/tests/compression_results.log b/tests/compression_results.log index ca66654c..d38233f9 100644 --- a/tests/compression_results.log +++ b/tests/compression_results.log @@ -1,24 +1,24 @@ -clod.frag... 8897 => 1528.145 -mouton/mouton.vert... 17026 => 2457.862 -audio-flight-v2.frag 4538 => 891.404 -buoy.frag 4094 => 622.550 +clod.frag... 8864 => 1522.094 +mouton/mouton.vert... 16985 => 2441.964 +audio-flight-v2.frag 4510 => 886.949 +buoy.frag 4070 => 619.904 controllable-machinery.frag 7708 => 1220.329 -ed-209.frag 7766 => 1341.089 +ed-209.frag 7725 => 1336.319 elevated.hlsl 3405 => 603.218 -endeavour.frag 2605 => 534.116 +endeavour.frag 2591 => 531.307 from-the-seas-to-the-stars.frag 14252 => 2317.681 -frozen-wasteland.frag 4578 => 806.452 -kinder_painter.frag 2865 => 445.014 -leizex.frag 2298 => 510.191 -lunaquatic.frag 5247 => 1049.030 -mandelbulb.frag 2370 => 538.322 +frozen-wasteland.frag 4566 => 806.475 +kinder_painter.frag 2847 => 442.771 +leizex.frag 2276 => 509.507 +lunaquatic.frag 5236 => 1044.110 +mandelbulb.frag 2349 => 537.740 ohanami.frag 3256 => 722.517 orchard.frag 5537 => 1022.773 oscars_chair.frag 4651 => 986.364 -robin.frag 6295 => 1052.336 -slisesix.frag 4573 => 931.855 +robin.frag 6268 => 1043.078 +slisesix.frag 4562 => 925.463 terrarium.frag 3611 => 744.367 -the_real_party_is_in_your_pocket.frag 12111 => 1794.687 -valley_ball.glsl 4386 => 888.496 -yx_long_way_from_home.frag 2947 => 606.406 -Total: 135016 => 23615.203 +the_real_party_is_in_your_pocket.frag 12101 => 1787.736 +valley_ball.glsl 4335 => 891.345 +yx_long_way_from_home.frag 2926 => 599.317 +Total: 134631 => 23543.326 diff --git a/tests/real/audio-flight-v2.frag.expected b/tests/real/audio-flight-v2.frag.expected index 563ab304..2806adcd 100644 --- a/tests/real/audio-flight-v2.frag.expected +++ b/tests/real/audio-flight-v2.frag.expected @@ -115,13 +115,15 @@ vec2 map(vec3 p,float sg) float obj=fBox(o,vec3(.15*offWobble))-.015; if(obj0.) reflection=ShadeBoat(pos+t*reflectedRay,reflectedRay); - t=TraceBoat(pos-0.*refractedRay,refractedRay); - vec3 col=vec3(0,.04,.04); + t=TraceBoat(pos-0.*norm,norm); + reflectedRay=vec3(0,.04,.04); if(t>0.) - col=mix(col,ShadeBoat(pos+t*refractedRay,refractedRay),exp(-t)); - col=mix(col,reflection,pow(1.-abs(ndotr),5.)); - return mix(col,vec3(1),WaveCrests(pos,fragCoord)); + reflectedRay=mix(reflectedRay,ShadeBoat(pos+t*norm,norm),exp(-t)); + reflectedRay=mix(reflectedRay,reflection,pow(1.-abs(ndotr),5.)); + return mix(reflectedRay,vec3(1),WaveCrests(pos,fragCoord)); } void mainImage(out vec4 fragColor,vec2 fragCoord) { @@ -204,11 +206,11 @@ void mainImage(out vec4 fragColor,vec2 fragCoord) vec3 pos,ray; CamPolar(pos,ray,camRot,fragCoord); float to=TraceOcean(pos,ray),tb=TraceBoat(pos,ray); - vec3 result=to>0.&&(to0.&&(to0.? ShadeBoat(pos+ray*tb,ray): Sky(ray); - result*=1.1*smoothstep(.35,1.,localRay.z); - fragColor=vec4(pow(result,vec3(1./GAMMA)),1); + pos*=1.1*smoothstep(.35,1.,localRay.z); + fragColor=vec4(pow(pos,vec3(1./GAMMA)),1); } diff --git a/tests/real/ed-209.frag.expected b/tests/real/ed-209.frag.expected index af14e450..6c3db2fc 100644 --- a/tests/real/ed-209.frag.expected +++ b/tests/real/ed-209.frag.expected @@ -118,9 +118,9 @@ MarchData headLower(vec3 p) p=op; p.y=abs(p.y+.16)-.06; p.z-=-1.1; - float cheeks=max(sdCappedCylinder(p.xzy,1.,.03),-sdCappedCylinder(p.xzy,.55,1.)); - cheeks=max(cheeks,p.z+.2); - r.d=max(r.d,-cheeks); + roof=max(sdCappedCylinder(p.xzy,1.,.03),-sdCappedCylinder(p.xzy,.55,1.)); + roof=max(roof,p.z+.2); + r.d=max(r.d,-roof); setBodyMaterial(r); return r; } @@ -146,10 +146,10 @@ MarchData gunPod(vec3 p) d=min(d,sdBox(p+vec3(0,0,.54),vec3(.1,.06,.04))); if(d.5) + bump=fireShock(); + if(bump>.5) { - d=sdCappedCylinder(pp,.01+pp.z*.05,fract(fs*3322.423)*.5+.9); + d=sdCappedCylinder(pp,.01+pp.z*.05,fract(bump*3322.423)*.5+.9); if(d0.&&length(x-artifactPos.xz)0.&&length(x-artifactPos.xz)0) { vec4 p=calcPlanet(ro,rd); - color+=coeff*saturate(1.-p.w)+p.xyz; + color+=theta*saturate(1.-p.w)+p.xyz; } rd.xy+=ro.xy*1e-4; color+=(calculateSkySub(normalize(rd+vec3(sin(Y.z*.1),0,cos(Y.z*.1))*.1)*3.)+calculateSkySub(normalize(rd+vec3(sin(Y.z*.1),0,cos(Y.z*.1))*.2)*5.)*.1+calculateSkySub(normalize(rd+vec3(sin(Y.z*.1),0,cos(Y.z*.1))*.4)*7.)*.1-calculateSkySub(normalize(rd+vec3(sin(Y.z*.2),0,0)*.5))*1.5)*saturate(rd.y+.5); @@ -219,12 +221,13 @@ void main() rd=rotateY(rd,atan(dir.y,dir.x)-pi/2.); } lightDir=normalize(lightPos-ro); - float dist=length(ro-artifactPos.xyz)-1.,isoDistance=artifactPos.w==1.? - traceIso(ro,rd,dist,dist+2.): + t=length(ro-artifactPos.xyz)-1.; + t=artifactPos.w==1.? + traceIso(ro,rd,t,t+2.): FAR; - if(isoDistance1e2)" - "return f=.5*log(x)/pow(8.,0.),o=vec4(1),false;" - "for(int c=1;c<7;c++)" + "vec4 e=vec4(100);" + "vec3 i=v;" + "float o=dot(i,i);" + "if(o>1e2)" + "return f=.5*log(o)/pow(8.,0.),y=vec4(1),false;" + "for(int x=1;x<7;x++)" "{" "\n#if 0\n" - "float z=sqrt(dot(y,y)),s=acos(y.y/z),p=atan(y.x,y.z);" + "float z=sqrt(dot(i,i)),c=acos(i.y/z),s=atan(i.x,i.z);" "z=pow(z,8.);" + "c*=8.;" "s*=8.;" - "p*=8.;" - "y=v+z*vec3(sin(s)*sin(p),cos(s),sin(s)*cos(p));" + "i=v+z*vec3(sin(c)*sin(s),cos(c),sin(c)*cos(s));" "\n#else\n" - "float t=y.x,d=t*t,n=d*d,m=y.y,e=m*m,a=y.z,w=a*a,l=w*w,g=d+w,r=inversesqrt(g*g*g*g*g*g*g),C=n+e*e+l-6.*e*w-6.*d*e+2.*w*d,F=d-e+w;" - "y.x=v.x+64.*t*m*a*(d-w)*F*(n-6.*d*w+l)*C*r;" - "y.y=v.y+-16.*e*g*F*F+C*C;" - "y.z=v.z+-8.*m*F*(n*n-28.*n*d*w+70.*n*l-28.*d*w*l+l*l)*C*r;" + "float t=i.x,d=t*t,n=d*d,m=i.y,l=m*m,p=i.z,w=p*p,g=w*w,r=d+w,C=inversesqrt(r*r*r*r*r*r*r),F=n+l*l+g-6.*l*w-6.*d*l+2.*w*d,G=d-l+w;" + "i.x=v.x+64.*t*m*p*(d-w)*G*(n-6.*d*w+g)*F*C;" + "i.y=v.y+-16.*l*r*G*G+F*F;" + "i.z=v.z+-8.*m*G*(n*n-28.*n*d*w+70.*n*g-28.*d*w*g+g*g)*F*C;" "\n#endif\n" - "x=dot(y,y);" - "i=min(i,vec4(y.xyz*y.xyz,x));" - "if(x>1e2)" - "return o=i,f=.5*log(x)/pow(8.,float(c)),false;" + "o=dot(i,i);" + "e=min(e,vec4(i.xyz*i.xyz,o));" + "if(o>1e2)" + "return y=e,f=.5*log(o)/pow(8.,float(x)),false;" "}" - "o=i;" + "y=e;" "f=0.;" "return true;" "}" - "bool f(vec3 v,vec3 y,out float o,out vec3 x,out vec4 s)" + "bool f(vec3 v,vec3 o,out float y,out vec3 i,out vec4 c)" "{" - "vec4 i=vec4(0,0,0,1.25);" - "vec2 e;" - "if(!f(i,v,y,e))" + "vec4 e=vec4(0,0,0,1.25);" + "vec2 s;" + "if(!f(e,v,o,s))" "return false;" - "if(e.y<.001)" + "if(s.y<.001)" "return false;" - "if(e.x<.001)" - "e.x=.001;" - "if(e.y>1e20)" - "e.y=1e20;" - "float c;" + "if(s.x<.001)" + "s.x=.001;" + "if(s.y>1e20)" + "s.y=1e20;" + "float x;" "vec3 z;" - "vec4 d;" "float t=1./sqrt(2.);" - "for(float w=e.x;w.001)" - "if(f(z,x,r,C,a))" - "n=.1;" - "i=vec3(1);" - "i=mix(i,vec3(.8,.6,.2),sqrt(p.x)*1.25);" - "i=mix(i,vec3(.8,.3,.3),sqrt(p.y)*1.25);" - "i=mix(i,vec3(.7,.4,.3),sqrt(p.z)*1.25);" - "i*=(.5+.5*l.y)*vec3(.14,.15,.16)*.8+n*vec3(1,.85,.4)+.5*t*vec3(.08,.1,.14);" - "i*=vec3(pow(m,.8),pow(m,1.),pow(m,1.1));" - "i=1.5*(i*.15+.85*sqrt(i));" + "vec4 g;" + "if(r>.001)" + "if(f(x,y,p,C,g))" + "r=.1;" + "z=vec3(1);" + "z=mix(z,vec3(.8,.6,.2),sqrt(w.x)*1.25);" + "z=mix(z,vec3(.8,.3,.3),sqrt(w.y)*1.25);" + "z=mix(z,vec3(.7,.4,.3),sqrt(w.z)*1.25);" + "z*=(.5+.5*t.y)*vec3(.14,.15,.16)*.8+r*vec3(1,.85,.4)+.5*l*vec3(.08,.1,.14);" + "z*=vec3(pow(n,.8),pow(n,1.),pow(n,1.1));" + "z=1.5*(z*.15+.85*sqrt(z));" "}" "else" - " i=1.3*vec3(1,.98,.9)*(.7+.3*e.y);" - "vec2 t=v*.5+.5;" - "i*=.7+4.8*t.x*t.y*(1.-t.x)*(1.-t.y);" - "i=clamp(i,0.,1.);" - "gl_FragColor=vec4(i,1);" + " z=1.3*vec3(1,.98,.9)*(.7+.3*d.y);" + "v=v*.5+.5;" + "z*=.7+4.8*v.x*v.y*(1.-v.x)*(1.-v.y);" + "z=clamp(z,0.,1.);" + "gl_FragColor=vec4(z,1);" "}"; #endif // MANDELBULB_EXPECTED_ diff --git a/tests/real/mouton/mouton.expected b/tests/real/mouton/mouton.expected index 3e5edb12..1e679bb9 100644 --- a/tests/real/mouton/mouton.expected +++ b/tests/real/mouton/mouton.expected @@ -22,7 +22,7 @@ # define VAR_panelWarningPos "z" # define VAR_sheepPos "s" # define VAR_sunDir "r" -# define VAR_tex "Y" +# define VAR_tex "k" const char *mouton_vert = "#version 150\n" @@ -342,31 +342,31 @@ const char *mouton_frag = "}" "vec3 h(vec3 v)" "{" - "uvec3 f=uvec3((v+1e2)*1e4);" - "f=(f>>8U^f.yzx)*1103515245U;" - "f=(f>>8U^f.yzx)*1103515245U;" - "f=(f>>8U^f.yzx)*1103515245U;" - "return vec3(f)*(1./float(-1U));" + "uvec3 C=uvec3((v+1e2)*1e4);" + "C=(C>>8U^C.yzx)*1103515245U;" + "C=(C>>8U^C.yzx)*1103515245U;" + "C=(C>>8U^C.yzx)*1103515245U;" + "return vec3(C)*(1./float(-1U));" "}" "float B(vec3 v)" "{" - "vec3 C=floor(v),f=fract(v);" - "f=f*f*f*(f*(f*6.-15.)+10.);" - "return mix(mix(mix(h(C+vec3(0)).x,h(C+vec3(1,0,0)).x,f.x),mix(h(C+vec3(0,1,0)).x,h(C+vec3(1,1,0)).x,f.x),f.y),mix(mix(h(C+vec3(0,0,1)).x,h(C+vec3(1,0,1)).x,f.x),mix(h(C+vec3(0,1,1)).x,h(C+vec3(1)).x,f.x),f.y),f.z)*2.-1.;" + "vec3 C=floor(v),m=fract(v);" + "m=m*m*m*(m*(m*6.-15.)+10.);" + "return mix(mix(mix(h(C+vec3(0)).x,h(C+vec3(1,0,0)).x,m.x),mix(h(C+vec3(0,1,0)).x,h(C+vec3(1,1,0)).x,m.x),m.y),mix(mix(h(C+vec3(0,0,1)).x,h(C+vec3(1,0,1)).x,m.x),mix(h(C+vec3(0,1,1)).x,h(C+vec3(1)).x,m.x),m.y),m.z)*2.-1.;" "}" "vec2 A(vec3 v)" "{" "v.xz-=i.xz;" "v.y-=-i.y;" - "float y=v.y+smoothstep(1.,20.,length(v.xz));" - "return y<.4?" - "(y-=pow((B(v*.9)*.5+B(v*1.6)*.3+B(v*2.7)*.1)*.5+.5,3.)*.45*(1.-exp((-t+137.3)*3.)),vec2(y,12)):" + "float C=v.y+smoothstep(1.,20.,length(v.xz));" + "return C<.4?" + "(C-=pow((B(v*.9)*.5+B(v*1.6)*.3+B(v*2.7)*.1)*.5+.5,3.)*.45*(1.-exp((-t+137.3)*3.)),vec2(C,12)):" "vec2(9e7,0);" "}" "mat3 A(vec3 v,vec3 C)" "{" - "vec3 y=normalize(C-v),f=normalize(cross(y,normalize(vec3(0,1,0))));" - "return mat3(f,cross(f,y),y);" + "vec3 y=normalize(C-v),m=normalize(cross(y,normalize(vec3(0,1,0))));" + "return mat3(m,cross(m,y),y);" "}" "mat2 E(float v)" "{" @@ -376,58 +376,60 @@ const char *mouton_frag = "vec3 A(vec3 i,vec2 v,float C)" "{" "vec2 y=vec2(cos(t*.7+2.),sin(t*.7+2.)*.75);" - "float m=smoothstep(.151,.15,length(v-y)),f=m*smoothstep(.13,.2701,length(v-y-vec2(.05))+.004*B(1e2*vec3(v-y,0)));" + "float m=smoothstep(.151,.15,length(v-y)),s=m*smoothstep(.13,.2701,length(v-y-vec2(.05))+.004*B(1e2*vec3(v-y,0)));" "vec2 x=E(t*2e-4)*v*2e2,c=floor(x);" - "vec3 s=h(vec3(abs(c),abs(c.x)));" - "float U=s.z*.06;" - "return vec3(1,.9,.1)*f*smoothstep(.5,-1.,r.y)+smoothstep(U,U*.01,length(fract(x)-.5+(s.xy-.5)))*(1.-m)+exp(-length(v-y)*2.)*.1+pow(C,2.);" + "vec3 g=h(vec3(abs(c),abs(c.x)));" + "float f=g.z*.06;" + "return vec3(1,.9,.1)*s*smoothstep(.5,-1.,r.y)+smoothstep(f,f*.01,length(fract(x)-.5+(g.xy-.5)))*(1.-m)+exp(-length(v-y)*2.)*.1+pow(C,2.);" "}" "float B(vec3 v,vec3 C)" "{" - "vec3 f=abs(v)-C;" - "return length(max(f,0.))+min(max(f.x,max(f.y,f.z)),0.);" + "vec3 m=abs(v)-C;" + "return length(max(m,0.))+min(max(m.x,max(m.y,m.z)),0.);" "}" "vec2 F(vec3 v)" "{" "v-=i;" "v.xz=E(1.)*v.xz;" - "float y=pow(clamp(v.y-1.,.004,1.),.5),f=B(v-vec3(0,1,0),vec3(1.5-y,1,2.5-y));" - "if(f<10.)" + "float C=pow(clamp(v.y-1.,.004,1.),.5);" + "C=B(v-vec3(0,1,0),vec3(1.5-C,1,2.5-C));" + "if(C<10.)" "{" - "f=min(f,B(v-vec3(0,3,0),vec3(2,1,3)));" - "float C=length((v.yz-vec2(4.5,3))*vec2(1,.8))-2.;" - "C=max(C,abs(v.x)-.5);" - "C=max(C,v.y-3.5);" - "f=min(f,C);" - "return vec2(f-.1,11);" + "C=min(C,B(v-vec3(0,3,0),vec3(2,1,3)));" + "float f=length((v.yz-vec2(4.5,3))*vec2(1,.8))-2.;" + "f=max(f,abs(v.x)-.5);" + "f=max(f,v.y-3.5);" + "C=min(C,f);" + "return vec2(C-.1,11);" "}" "return vec2(9e7,0);" "}" "vec2 G(vec3 v)" "{" "v-=x;" - "float f=B(v-vec3(0,7.5,-5),vec3(.8,.8,.1))-.2;" - "if(f<7.)" + "float C=B(v-vec3(0,7.5,-5),vec3(.8,.8,.1))-.2;" + "if(C<7.)" "{" - "f=max(f,abs(v.z+5.)-.1);" - "float C=B(v-vec3(0,4,-5.1),vec3(.11,4,.08));" - "return h(vec2(C,5),vec2(f,7));" + "C=max(C,abs(v.z+5.)-.1);" + "float y=B(v-vec3(0,4,-5.1),vec3(.11,4,.08));" + "return h(vec2(y,5),vec2(C,7));" "}" "return vec2(9e7,0);" "}" "float A(vec3 v,float C,float i,float y)" "{" - "vec2 f=vec2(length(v.xz),v.y),c=vec2(y,C),x=vec2(y-i,2.*C),d=vec2(f.x-min(f.x,f.y<0.?" + "vec2 m=vec2(length(v.xz),v.y),c=vec2(y,C),f=vec2(y-i,2.*C),x=vec2(m.x-min(m.x,m.y<0.?" "i:" - "y),abs(f.y)-C),U=f-c+x*clamp(dot(c-f,x)/dot(x,x),0.,1.);" - "return(U.x<0.&&d.y<0.?" + "y),abs(m.y)-C);" + "f=m-c+f*clamp(dot(c-m,f)/dot(f,f),0.,1.);" + "return(f.x<0.&&x.y<0.?" "-1.:" - "1.)*sqrt(min(dot(d,d),dot(U,U)));" + "1.)*sqrt(min(dot(x,x),dot(f,f)));" "}" "float E(vec3 v,vec3 C)" "{" - "vec3 y=v-C,f=vec3(0,2,4.9)-C;" - "return length(y-f*clamp(dot(y,f)/dot(f,f),0.,1.))-.2;" + "vec3 y=v-C,x=vec3(0,2,4.9)-C;" + "return length(y-x*clamp(dot(y,x)/dot(x,x),0.,1.))-.2;" "}" "float F(vec3 v,vec2 C)" "{" @@ -441,38 +443,38 @@ const char *mouton_frag = "vec2 H(vec3 v)" "{" "v-=y;" - "vec3 f=v;" - "f.x+=cos(.775+t)*3.1*.2;" - "f.y-=2.8;" - "f.zy=E(.7)*f.zy;" - "float C=G(f-vec3(0,.3,0),vec3(1,.2+cos(f.x*150.)*sin(f.z*150.)*.05,1)*.25);" + "vec3 m=v;" + "m.x+=cos(.775+t)*3.1*.2;" + "m.y-=2.8;" + "m.zy=E(.7)*m.zy;" + "float C=G(m-vec3(0,.3,0),vec3(1,.2+cos(m.x*150.)*sin(m.z*150.)*.05,1)*.25);" "if(C<5.)" "{" "vec2 i=vec2(C,8);" - "vec3 c=f;" - "float x=U*.2,d=atan(c.z,c.x),s=length(c.xz);" - "d=mod(d-x/2.,x)-x/2.;" - "c.xz=vec2(cos(d),sin(d))*s;" - "float m=G(c-vec3(.5,.2+sin(c.x*2.)*.2,0),vec3(2,.1+sin(c.z*40.)*.02,.75)*.25);" - "if(m1e2||abs(m)<.001)" + "float m=K(v+C*y).x;" + "y+=m;" + "if(y>1e2||abs(m)<.001)" "break;" "}" - "return f;" + "return y;" "}" "float I(vec3 v,vec3 C)" "{" @@ -615,27 +617,27 @@ const char *mouton_frag = "}" "return clamp(f,0.,1.);" "}" - "float E(vec2 v,float C,float y,float f)" + "float E(vec2 v,float C,float y,float x)" "{" "v.x=abs(v.x);" - "float x=(C-y)/f,c=sqrt(1.-x*x),i=dot(v,vec2(-x,c));" - "return i<0.?" + "float m=(C-y)/x,f=sqrt(1.-m*m),c=dot(v,vec2(-m,f));" + "return c<0.?" "length(v)-C:" - "i>c*f?" - "length(v-vec2(0,f))-y:" - "dot(v,vec2(c,x))-C;" + "c>f*x?" + "length(v-vec2(0,x))-y:" + "dot(v,vec2(f,m))-C;" "}" "float J(vec2 v,float C)" "{" - "vec2 f=vec2(.81,-.59),y=vec2(-f.x,f.y);" + "vec2 y=vec2(.81,-.59),f=vec2(-y.x,y.y);" "v.x=abs(v.x);" - "v-=2.*max(dot(f,v),0.)*f;" "v-=2.*max(dot(y,v),0.)*y;" + "v-=2.*max(dot(f,v),0.)*f;" "v.x=abs(v.x);" "v.y-=C;" - "vec2 x=.5*vec2(-f.y,f)-vec2(0,1);" - "float i=clamp(dot(v,x)/dot(x,x),0.,C);" - "return length(v-x*i)*sign(v.y*x.x-v.x*x.y);" + "f=.5*vec2(-y.y,y)-vec2(0,1);" + "float m=clamp(dot(v,f)/dot(f,f),0.,C);" + "return length(v-f*m)*sign(v.y*f.x-v.x*f.y);" "}" "void main()" "{" @@ -646,17 +648,17 @@ const char *mouton_frag = "vec3 i=m+s*U;" "vec2 l=K(i),n=vec2(1e-4,0);" "vec3 k=normalize(vec3(l.x-K(i-n.xyy).x,l.x-K(i-n.yxy).x,l.x-K(i-n.yyx).x));" - "float G=smoothstep(0.,.3,r.y)+.1,w=B(i,k,.15,1.)*B(i,k,1.,.1)*.5,P=I(i,r),L=1.+dot(s,k);" - "vec3 Q=vec3(1,.8,.7)*max(dot(k,r),0.)*pow(vec3(P),vec3(1,1.2,1.5)),M=vec3(1,.8,.7)*.1*max(dot(k,-r),0.)*w,O=vec3(.5)*mix(B(i,s,.3,.75),B(i,r,.3,.75),.5),N=vec3(1)*max(dot(reflect(s,k),r),0.),R=vec3(0),S=vec3(.4,.45,.5)*w,T=vec3(0),b=vec3(0);" + "float G=smoothstep(0.,.3,r.y)+.1,w=B(i,k,.15,1.)*B(i,k,1.,.1)*.5,O=I(i,r),L=1.+dot(s,k);" + "vec3 P=vec3(1,.8,.7)*max(dot(k,r),0.)*pow(vec3(O),vec3(1,1.2,1.5)),M=vec3(1,.8,.7)*.1*max(dot(k,-r),0.)*w,N=vec3(.5)*mix(B(i,s,.3,.75),B(i,r,.3,.75),.5),Q=vec3(1)*max(dot(reflect(s,k),r),0.),R=vec3(0),S=vec3(.4,.45,.5)*w,T=vec3(0),b=vec3(0);" "if(l.y==0.)" - "b=vec3(3),O*=0.,N*=0.;" + "b=vec3(3),N*=0.,Q*=0.;" "else if(l.y==1.)" - "b=vec3(.4),O*=L*.5+.5,T=vec3(.35),N=pow(N,vec3(4))*L*.25;" + "b=vec3(.4),N*=L*.5+.5,T=vec3(.35),Q=pow(Q,vec3(4))*L*.25;" "else if(l.y==4.)" - "b=vec3(.025),O*=0.,N=pow(N,vec3(80))*L*10.;" + "b=vec3(.025),N*=0.,Q=pow(Q,vec3(80))*L*10.;" "else if(l.y==3.)" "{" - "O*=.5;" + "N*=.5;" "vec3 V=normalize(d+(B(vec3(t,t*.5,t*1.5))*2.-1.)*.01),W=cross(V,vec3(0,1,0)),X=cross(V,W);" "W=cross(X,V);" "vec3 Y=k.z*V+k.x*W+k.y*X,Z=s.z*d+s.x*W+s.y*X;" @@ -668,26 +670,26 @@ const char *mouton_frag = "b=ay*(ax*.5+.5)*smoothstep(.3,.29,q);" "b*=vec3(1,.8,.7)*pow(max(0.,dot(normalize(vec3(3,1,-1)),Y)),8.)*3e2+.5;" "b*=aC;" - "b+=pow(N,vec3(800))*3;" + "b+=pow(Q,vec3(800))*3;" "b=mix(b,vec3(.8),smoothstep(.29,.3,q));" "b=mix(ay*.3,b,smoothstep(0.,.05,abs(q-.3)+.01));" "k=mix(normalize(k+(d+k)*4.),k,smoothstep(.3,.32,q));" "{" - "vec3 af=reflect(s,k),av=normalize(vec3(1,1.5,-1)),ac=vec3(-av.x,av.y*.5,av.z);" - "float ab=h(af,av,.1)+h(af,ac,2.)*.1+h(af,normalize(av+vec3(.2,0,0)),.3)+h(af,normalize(av+vec3(.2,0,.2)),.5)+h(af,normalize(ac+vec3(.1,0,.2)),8.)*.5;" - "R=(mix(mix(vec3(.3,.3,0),vec3(.1),smoothstep(-.7,.2,af.y)),vec3(.3,.65,1),smoothstep(0.,1.,af.y))+ab*vec3(1,.9,.8))*mix(.15,.2,aC)*sqrt(L)*2.5;" + "vec3 am=reflect(s,k),av=normalize(vec3(1,1.5,-1)),ab=vec3(-av.x,av.y*.5,av.z);" + "float ac=h(am,av,.1)+h(am,ab,2.)*.1+h(am,normalize(av+vec3(.2,0,0)),.3)+h(am,normalize(av+vec3(.2,0,.2)),.5)+h(am,normalize(ab+vec3(.1,0,.2)),8.)*.5;" + "R=(mix(mix(vec3(.3,.3,0),vec3(.1),smoothstep(-.7,.2,am.y)),vec3(.3,.65,1),smoothstep(0.,1.,am.y))+ac*vec3(1,.9,.8))*mix(.15,.2,aC)*sqrt(L)*2.5;" "}" "K(i);" "b*=smoothstep(0.,.015,D)*.4+.6;" - "N*=0.;" + "Q*=0.;" "}" "else if(l.y==5.)" - "b=vec3(.85,.95,1),O*=0.,N=pow(N,vec3(8))*L*2.;" + "b=vec3(.85,.95,1),N*=0.,Q=pow(Q,vec3(8))*L*2.;" "else if(l.y==6.)" "{" "vec3 Y=i-z;" - "O*=0.;" - "N=pow(N,vec3(8))*L*20.;" + "N*=0.;" + "Q=pow(Q,vec3(8))*L*20.;" "if(k.z>.5)" "{" "float q=F(Y-vec3(0,7.5,-5),vec2(1.3,.2),.01);" @@ -703,8 +705,8 @@ const char *mouton_frag = "else if(l.y==7.)" "{" "vec3 Y=i-x;" - "O*=0.;" - "N=pow(N,vec3(8))*L*10.;" + "N*=0.;" + "Q=pow(Q,vec3(8))*L*10.;" "if(k.z>.5)" "{" "b=vec3(0,0,1.5);" @@ -731,11 +733,11 @@ const char *mouton_frag = "Y.y-=2.8;" "Y.zy=E(.75)*Y.zy;" "b=mix(vec3(2,.75,0),vec3(2,2,0),smoothstep(0.,.45,length(Y-vec3(0,.3,0))))*1.8;" - "O=vec3(.01);" - "N*=0.;" + "N=vec3(.01);" + "Q*=0.;" "}" "else if(l.y==10.)" - "b=vec3(0,.05,0),N*=L;" + "b=vec3(0,.05,0),Q*=L;" "else if(l.y==9.)" "{" "vec3 Y=i-y;" @@ -743,54 +745,55 @@ const char *mouton_frag = "Y.y-=2.8;" "Y.zy=E(.75)*Y.zy;" "b=mix(vec3(1)+.5,vec3(.75,.5,1),smoothstep(.5,1.1,length(Y-vec3(0,.3,0))))*2.;" - "O*=0.;" - "N=pow(N,vec3(4))*L;" + "N*=0.;" + "Q=pow(Q,vec3(4))*L;" "}" "else if(l.y==11.)" - "b=vec3(1),Q*=vec3(.1)*L,S*=vec3(.1)*L,M*=0.,O*=0.,N=pow(N,vec3(100))*L*2.;" + "b=vec3(1),P*=vec3(.1)*L,S*=vec3(.1)*L,M*=0.,N*=0.,Q=pow(Q,vec3(100))*L*2.;" "else if(l.y==12.)" - "b=vec3(1,.01,.01)*.3,Q*=vec3(3),S*=vec3(2)*L*L,O*=0.,N=vec3(1,.3,.3)*pow(N,vec3(500))*5.;" + "b=vec3(1,.01,.01)*.3,P*=vec3(3),S*=vec3(2)*L*L,N*=0.,Q=vec3(1,.3,.3)*pow(Q,vec3(500))*5.;" "else if(l.y==2.)" - "b=vec3(1,.7,.5),S*=vec3(1,.75,.75),O=pow(O,vec3(.5,2.5,5)+2.)*2.,N=pow(N,vec3(4))*L*.02;" - "vec3 Y=clamp(mix((b*(S+Q*.5+M*2.+O*2.)+R+N*P+T)*G,A(s,f,G),smoothstep(90.,1e2,U)),0.,1.);" + "b=vec3(1,.7,.5),S*=vec3(1,.75,.75),N=pow(N,vec3(.5,2.5,5)+2.)*2.,Q=pow(Q,vec3(4))*L*.02;" + "b=clamp(mix((b*(S+P*.5+M*2.+N*2.)+R+Q*O+T)*G,A(s,f,G),smoothstep(90.,1e2,U)),0.,1.);" "if(l.y==0.)" "{" - "float q=length(f)*.5,W=cos(atan(f.x,f.y)*15.-t*3.-q*30.*a.y);" - "Y=mix(Y,mix(mix(vec3(1,.5,0),vec3(.8,.5,1),(cos(q*5.+t*5.)*.5+.5)*a.y),vec3(1),smoothstep(-q,q,W)),a.x);" - "}" - "vec2 W=vec2(abs(f.x*5.-.35)-1.8,f.y*5.-1.4);" - "W=E(t*5.)*W;" - "float q=(1.4+.2*sin(t*20.))*smoothstep(.5,1.,a.x),V=J(W,q);" - "vec3 X=mix(vec3(1,.6,0),vec3(1,.2,0),smoothstep(-.1,.6,J(W,q*.5)))*1.3;" - "Y=mix(Y,X,smoothstep(0.,-.01,V)*a.x);" - "Y=pow(pow(Y,vec3(1./2.2)),vec3(1,1.05,1.1));" - "float j=length(gl_FragCoord.xy/g.xx-vec2(.5,.3)),Z=max(.137,smoothstep(147.,146.,t));" - "Y*=smoothstep(Z,Z-.005,j);" - "float _=fract(23.*pow(j,.25));" - "_-=smoothstep(.95,.99,_);" - "Y=mix(Y,mix(vec3(1,.6,0),vec3(1,0,0),pow(_,1.)),smoothstep(.135,.136,j)*smoothstep(147.,148.,t));" - "Y*=smoothstep(0.,8.,t)*smoothstep(153.,150.,t);" - "C=vec4(Y/(1.+pow(length(v*2.-1.),4.)*.04),1);" + "float Y=length(f)*.5,q=cos(atan(f.x,f.y)*15.-t*3.-Y*30.*a.y);" + "b=mix(b,mix(mix(vec3(1,.5,0),vec3(.8,.5,1),(cos(Y*5.+t*5.)*.5+.5)*a.y),vec3(1),smoothstep(-Y,Y,q)),a.x);" + "}" + "l=vec2(abs(f.x*5.-.35)-1.8,f.y*5.-1.4);" + "l=E(t*5.)*l;" + "float q=(1.4+.2*sin(t*20.))*smoothstep(.5,1.,a.x),W=J(l,q);" + "P=mix(vec3(1,.6,0),vec3(1,.2,0),smoothstep(-.1,.6,J(l,q*.5)))*1.3;" + "b=mix(b,P,smoothstep(0.,-.01,W)*a.x);" + "b=pow(pow(b,vec3(1./2.2)),vec3(1,1.05,1.1));" + "float Y=length(gl_FragCoord.xy/g.xx-vec2(.5,.3)),V=max(.137,smoothstep(147.,146.,t));" + "b*=smoothstep(V,V-.005,Y);" + "V=fract(23.*pow(Y,.25));" + "V-=smoothstep(.95,.99,V);" + "b=mix(b,mix(vec3(1,.6,0),vec3(1,0,0),pow(V,1.)),smoothstep(.135,.136,Y)*smoothstep(147.,148.,t));" + "b*=smoothstep(0.,8.,t)*smoothstep(153.,150.,t);" + "C=vec4(b/(1.+pow(length(v*2.-1.),4.)*.04),1);" "}"; const char *fxaa_frag = "#version 150\n" "out vec4 C;" "const vec2 b=vec2(1920,1080);" - "uniform sampler2D Y;" + "uniform sampler2D k;" "void main()" "{" "vec2 v=1./b,f=gl_FragCoord.xy*v;" - "vec4 y=vec4(f,f-v*.5);" - "vec3 x=vec3(.299,.587,.114);" - "float c=dot(textureLod(Y,y.zw,0.).xyz,x),d=dot(textureLod(Y,y.zw+vec2(1,0)*v.xy,0.).xyz,x),s=dot(textureLod(Y,y.zw+vec2(0,1)*v.xy,0.).xyz,x),U=dot(textureLod(Y,y.zw+vec2(1)*v.xy,0.).xyz,x),m=dot(textureLod(Y,y.xy,0.).xyz,x);" - "vec2 i=vec2(-c-d+s+U,c+s-d-U);" - "float z=1./(min(abs(i.x),abs(i.y))+1./128.);" - "i=min(vec2(8),max(vec2(-8),i*z))*v.xy;" - "vec3 g=.5*(textureLod(Y,y.xy+i*(1./3.-.5),0.).xyz+textureLod(Y,y.xy+i*(2./3.-.5),0.).xyz),a=g*.5+.25*(textureLod(Y,y.xy+i*-.5,0.).xyz+textureLod(Y,y.xy+i*.5,0.).xyz);" - "float e=dot(a,x);" - "C=emax(m,max(max(c,d),max(s,U)))?" - "vec4(g,1):" + "vec4 m=vec4(f,f-v*.5);" + "vec3 y=vec3(.299,.587,.114);" + "float s=dot(textureLod(k,m.zw,0.).xyz,y),x=dot(textureLod(k,m.zw+vec2(1,0)*v.xy,0.).xyz,y),c=dot(textureLod(k,m.zw+vec2(0,1)*v.xy,0.).xyz,y),U=dot(textureLod(k,m.zw+vec2(1)*v.xy,0.).xyz,y),d=dot(textureLod(k,m.xy,0.).xyz,y),e=min(d,min(min(s,x),min(c,U)));" + "d=max(d,max(max(s,x),max(c,U)));" + "f=vec2(-s-x+c+U,s+c-x-U);" + "s=1./(min(abs(f.x),abs(f.y))+1./128.);" + "f=min(vec2(8),max(vec2(-8),f*s))*v.xy;" + "vec3 i=.5*(textureLod(k,m.xy+f*(1./3.-.5),0.).xyz+textureLod(k,m.xy+f*(2./3.-.5),0.).xyz),a=i*.5+.25*(textureLod(k,m.xy+f*-.5,0.).xyz+textureLod(k,m.xy+f*.5,0.).xyz);" + "s=dot(a,y);" + "C=sd?" + "vec4(i,1):" "vec4(a,1);" "}"; diff --git a/tests/real/robin.frag.expected b/tests/real/robin.frag.expected index 43b3588e..85e65ec2 100644 --- a/tests/real/robin.frag.expected +++ b/tests/real/robin.frag.expected @@ -30,8 +30,9 @@ float noise(vec3 x) { vec3 p=floor(x),f=fract(x); f=f*f*(3.-2.*f); - vec2 uv=p.xy+vec2(37,17)*p.z+f.xy,rg=textureLod(iChannel1,(uv+.5)/256.,0.).yx; - return mix(rg.x,rg.y,f.z); + vec2 uv=p.xy+vec2(37,17)*p.z+f.xy; + uv=textureLod(iChannel1,(uv+.5)/256.,0.).yx; + return mix(uv.x,uv.y,f.z); } float fbm(vec3 p) { @@ -107,8 +108,8 @@ vec3 Colour(vec3 p,vec3 nor,out float spec) d=sMin(d,Segment(p2,vec3(1.5,-.2,1.7),vec3(1.5,-1,-1.6),.3,.3),.4); vec3 wing=vec3(.4,.32,.2)*texture(iChannel1,p2.zy*vec2(.05,.3)).x; mat=mix(wing*wing,mat,clamp(Segment(p2,vec3(1.3,.2,.2),vec3(1.5+body.y,-1,-1.6),.4,.4),0.,1.)); - vec3 tail=vec3(.4)*texture(iChannel1,p.zy*vec2(.05,.3)).x; - mat=mix(tail*tail,mat,clamp(Segment(p2,vec3(.1,-.5,-1.5),vec3(.15,-1.2,-8),.2,.2),0.,1.)); + wing=vec3(.4)*texture(iChannel1,p.zy*vec2(.05,.3)).x; + mat=mix(wing*wing,mat,clamp(Segment(p2,vec3(.1,-.5,-1.5),vec3(.15,-1.2,-8),.2,.2),0.,1.)); p2=p; p2.xy=Rot2(p2.xy,animParts.y); p2.zy=Rot2(p2.zy,animParts.z); @@ -123,9 +124,9 @@ vec3 Colour(vec3 p,vec3 nor,out float spec) p2.x=abs(p2.x); if(Sphere(p2-vec3(.35,1.1,2.05),.11)=15.) zoomTurn.x=1.-zoomTurn.x; - vec3 col=vec3(0); + cu=vec3(0); for(int i=0;i<2;i++) dStack[i]=vec4(-20),aStack[i]=vec4(0); - float alpha=Scene(cameraPos,dir,fragCoord); + jump=Scene(cameraPos,dir,fragCoord); for(int s=0;s<2;s++) for(int i=0;i<4;i++) { @@ -279,11 +282,11 @@ void mainImage(out vec4 fragColor,vec2 fragCoord) if(d<0.) continue; vec3 pos=cameraPos+dir*d,normal=GetNormal(pos,SphereRadius(d)),alb=Colour(pos,normal,specular); - col+=DoLighting(alb,pos,normal,dir,d,specular)*aStack[s][i]; + cu+=DoLighting(alb,pos,normal,dir,d,specular)*aStack[s][i]; } - float mi=smoothstep(1.9,0.,zoomTurn.y); - vec3 back=mix(CubeMap(iChannel2,dir,128.),CubeMap(iChannel3,dir,64.)*.7,mi); - col+=back*back*SUN_COLOUR*(1.-alpha); - col=PostEffects(col,xy)*smoothstep(0.,2.,iTime); - fragColor=vec4(col,1); + t=smoothstep(1.9,0.,zoomTurn.y); + dir=mix(CubeMap(iChannel2,dir,128.),CubeMap(iChannel3,dir,64.)*.7,t); + cu+=dir*dir*SUN_COLOUR*(1.-jump); + cu=PostEffects(cu,xy)*smoothstep(0.,2.,iTime); + fragColor=vec4(cu,1); } diff --git a/tests/real/slisesix.frag.expected b/tests/real/slisesix.frag.expected index 14b4dc91..4f3afff9 100644 --- a/tests/real/slisesix.frag.expected +++ b/tests/real/slisesix.frag.expected @@ -44,7 +44,8 @@ float columna(float x,float y,float z,float mindist,float offx) float di0=distToBox(p,vec3(.14,1,.14)); if(di0>mindist*mindist) return mindist+1.; - float y2=y-.4,y3=y-.35,di1=distToBox(p,vec3(.1,1,.1)),di2=distToBox(p,vec3(.12,.4,.12)),di3=distToBox(p,vec3(.05,.35,.14)),di4=distToBox(p,vec3(.14,.35,.05)),di9=distToBox(vec3(x,y-1.,z),vec3(.14,.02,.14)),di5=distToBox(vec3((x-y2)*.7071,(y2+x)*.7071,z),vec3(.07071,.07071,.12)),di6=distToBox(vec3(x,(y2+z)*.7071,(z-y2)*.7071),vec3(.12,.07071,.07071)),di7=distToBox(vec3((x-y3)*.7071,(y3+x)*.7071,z),vec3(.07071,.07071,.14)),di8=distToBox(vec3(x,(y3+z)*.7071,(z-y3)*.7071),vec3(.14,.07071,.07071)); + di0=y-.4; + float y3=y-.35,di1=distToBox(p,vec3(.1,1,.1)),di2=distToBox(p,vec3(.12,.4,.12)),di3=distToBox(p,vec3(.05,.35,.14)),di4=distToBox(p,vec3(.14,.35,.05)),di9=distToBox(vec3(x,y-1.,z),vec3(.14,.02,.14)),di5=distToBox(vec3((x-di0)*.7071,(di0+x)*.7071,z),vec3(.07071,.07071,.12)),di6=distToBox(vec3(x,(di0+z)*.7071,(z-di0)*.7071),vec3(.12,.07071,.07071)),di7=distToBox(vec3((x-y3)*.7071,(y3+x)*.7071,z),vec3(.07071,.07071,.14)),di8=distToBox(vec3(x,(y3+z)*.7071,(z-y3)*.7071),vec3(.14,.07071,.07071)); return min(min(min(min(di1,di2),min(di3,di4)),min(min(di5,di6),min(di7,di8))),di9); } float bicho(vec3 x,float mindist) @@ -55,9 +56,10 @@ float bicho(vec3 x,float mindist) x.y*=.8+.2*sa; x.z*=fax; r2=dot(x,x); - float r=sqrt(r2),a1=1.-smoothstep(0.,.75,r); - a1*=.4; - float si1=sin(a1),co1=cos(a1); + fax=sqrt(r2); + r2=1.-smoothstep(0.,.75,fax); + r2*=.4; + float si1=sin(r2),co1=cos(r2); x.xy=mat2(co1,si1,-si1,co1)*x.xy; float mindist2=1e5,rr=.05+sqrt(dot(x.xz,x.xz)),ca=.46625-6.*rr*exp2(-10.*rr); for(int j=1;j<7;j++) @@ -68,8 +70,8 @@ float bicho(vec3 x,float mindist) if(q.x>0.&&q.x<1.5&&dd>10&7)>6) peld=1.; dis+=.005*peld; diff --git a/tests/real/the_real_party_is_in_your_pocket.frag.expected b/tests/real/the_real_party_is_in_your_pocket.frag.expected index 977bd0e0..dc0486f4 100644 --- a/tests/real/the_real_party_is_in_your_pocket.frag.expected +++ b/tests/real/the_real_party_is_in_your_pocket.frag.expected @@ -42,11 +42,11 @@ const char *the_real_party_is_in_your_pocket_frag = "{" "float l=1e4;" "m.x-=m.y*.11;" - "vec2 i=m-vec2(-.26,0);" - "i.x=min(-i.x,0.);" - "l=min(l,max(-m.x-.26,abs(length(i*vec2(.9,1))-.022)-.006));" + "vec2 y=m-vec2(-.26,0);" + "y.x=min(-y.x,0.);" + "l=min(l,max(-m.x-.26,abs(length(y*vec2(.9,1))-.022)-.006));" "l=min(l,v(m-vec2(-.265,0),vec2(.006,.0278)));" - "vec2 y=m;" + "y=m;" "y.x-=-.16;" "y.x=abs(y.x);" "l=min(l,v(y-vec2(y.y/4.+.004,0),vec2(.006,.028)));" @@ -66,14 +66,14 @@ const char *the_real_party_is_in_your_pocket_frag = "m.x-=max(m.y/2.+.002,0.);" "return min(l,v(m-vec2(0),vec2(.0065,.028)));" "}" - "float v(vec2 l)" + "float v(vec2 y)" "{" - "l*=1.05;" - "return max(max(min(min(min(v(max(min(min(max(min(min(min(min(max(min(min(max(max(min(length((l-vec2(-.11,.01))*vec2(1,1.3))-.016,length(vec2(l.x+.11,max(0.,abs(l.y+.02)-.009))*vec2(.8,1))-.013),-length(vec2(l.x+.112,max(0.,abs(l.y-.009)-.004)))+.005),-length(vec2(l.x+.112,max(0.,abs(l.y+.015)-.007)))+.005),v(l-vec2(-.122,0),vec2(.007,.022))),max(-length(vec2(l.x+.074,max(0.,abs(l.y+.006)-.006)))+.005,length((l-vec2(-.074,-.006))*vec2(.9,1))-.015)),-v(l-vec2(-.06,-.008),vec2(.01,.002))),v(l-vec2(-.075,-.0039),vec2(.01,.002))),v(vec2(abs(l.x+.037)-.01-l.y/2.2,l.y+.006),vec2(.006,.015))),v(l-vec2(-.006,0),vec2(.007,.022))),v(l-vec2(.045,0),vec2(.007,.022))),-v(l-vec2(0,.01),vec2(.06,.002))),max(-v(l-vec2(.025,-.005),vec2(.01,.007)),length(vec2(l.x-.019,l.y+.005-.007)*vec2(.65,1))-.009)),max(-v(l-vec2(.01,-.005),vec2(.01,.007)),length(vec2(l.x-.019,l.y+.005+.007)*vec2(.65,1))-.009)),-length(vec2(l.x-.019,max(0.,abs(l.y+.0055)-.007)))+.005),v(m(0.)*(l-vec2(.019,-.005-(l.x-.019)/2.)),vec2(.0047,.004)),1536.),max(-length(vec2(l.x-.0735,max(0.,abs(l.y+.006)-.006)))+.005,length((l-vec2(.0735,-.006))*vec2(.9,1))-.015)),v(l-vec2(.1,-.006),vec2(.007,.015))),length(vec2(l.x-.118,max(0.,abs(l.y+.012)-.009)))-.013),-length(vec2(l.x-.112,max(0.,abs(l.y+.012)-.01)))+.005),-l.y-.021)+3e-4;" + "y*=1.05;" + "return max(max(min(min(min(v(max(min(min(max(min(min(min(min(max(min(min(max(max(min(length((y-vec2(-.11,.01))*vec2(1,1.3))-.016,length(vec2(y.x+.11,max(0.,abs(y.y+.02)-.009))*vec2(.8,1))-.013),-length(vec2(y.x+.112,max(0.,abs(y.y-.009)-.004)))+.005),-length(vec2(y.x+.112,max(0.,abs(y.y+.015)-.007)))+.005),v(y-vec2(-.122,0),vec2(.007,.022))),max(-length(vec2(y.x+.074,max(0.,abs(y.y+.006)-.006)))+.005,length((y-vec2(-.074,-.006))*vec2(.9,1))-.015)),-v(y-vec2(-.06,-.008),vec2(.01,.002))),v(y-vec2(-.075,-.0039),vec2(.01,.002))),v(vec2(abs(y.x+.037)-.01-y.y/2.2,y.y+.006),vec2(.006,.015))),v(y-vec2(-.006,0),vec2(.007,.022))),v(y-vec2(.045,0),vec2(.007,.022))),-v(y-vec2(0,.01),vec2(.06,.002))),max(-v(y-vec2(.025,-.005),vec2(.01,.007)),length(vec2(y.x-.019,y.y+.005-.007)*vec2(.65,1))-.009)),max(-v(y-vec2(.01,-.005),vec2(.01,.007)),length(vec2(y.x-.019,y.y+.005+.007)*vec2(.65,1))-.009)),-length(vec2(y.x-.019,max(0.,abs(y.y+.0055)-.007)))+.005),v(m(0.)*(y-vec2(.019,-.005-(y.x-.019)/2.)),vec2(.0047,.004)),1536.),max(-length(vec2(y.x-.0735,max(0.,abs(y.y+.006)-.006)))+.005,length((y-vec2(.0735,-.006))*vec2(.9,1))-.015)),v(y-vec2(.1,-.006),vec2(.007,.015))),length(vec2(y.x-.118,max(0.,abs(y.y+.012)-.009)))-.013),-length(vec2(y.x-.112,max(0.,abs(y.y+.012)-.01)))+.005),-y.y-.021)+3e-4;" "}" - "float n(vec4 v,vec2 l)" + "float n(vec4 v,vec2 y)" "{" - "return length(max(vec4(0),vec4((m(v.x)*l).x,(m(v.y)*-l).x,length(l)-v.z,-length(l)+v.w)));" + "return length(max(vec4(0),vec4((m(v.x)*y).x,(m(v.y)*-y).x,length(y)-v.z,-length(y)+v.w)));" "}" "float x(vec3 y,bool l)" "{" @@ -94,145 +94,147 @@ const char *the_real_party_is_in_your_pocket_frag = "-.03:" "0.))-.1265);" "}" - "float s(float y,float l)" + "float s(float y,float m)" "{" - "l=clamp(l/y,0.,1.);" - "return(l*-2.+3.)*l*l;" + "m=clamp(m/y,0.,1.);" + "return(m*-2.+3.)*m*m;" "}" - "vec4 s(vec3 l)" + "vec4 s(vec3 y)" "{" - "l.x+=.625;" - "float y=floor(l.x/1.25);" - "if(y==0.)" - "l.z-=.28;" - "l.x=mod(l.x,1.25)-.625;" - "l.xz=l.xz*m(-.5*y);" - "vec2 a=l.xy;" + "y.x+=.625;" + "float l=floor(y.x/1.25);" + "if(l==0.)" + "y.z-=.28;" + "y.x=mod(y.x,1.25)-.625;" + "y.xz=y.xz*m(-.5*l);" + "vec2 a=y.xy;" "a.x=abs(a.x);" - "float f=m(m(a.x-.55,length(a-vec2(0,.8))-1.76,49.),a.y-.95,83.2),z=l.z-.14,i=-l.z-.09-(1.-s(.9,l.y+.3+.1)-s(.55,-l.y-.3-.17))*.17,d=m(m(a.x-.48,length(a-vec2(0,2.5))-2.5,117.),a.y-.87,80.);" - "if(l.z>.01)" - "z+=mix(.02,pow(max(0.,v(l.xy-vec2(0,.25+pow(abs(l.x),3.)),vec2(.32,.94))-.05)*1e2,1.3)/1500.,1.-s(-.001,d));" - "if(l.z<0.)" - "i=v(i,m(l-vec3(0,0,-.1),vec3(.5,.5,.055))-.04,64.);" + "float f=m(m(a.x-.55,length(a-vec2(0,.8))-1.76,49.),a.y-.95,83.2),i=y.z-.14,z=-y.z-.09-(1.-s(.9,y.y+.3+.1)-s(.55,-y.y-.3-.17))*.17,d=m(m(a.x-.48,length(a-vec2(0,2.5))-2.5,117.),a.y-.87,80.);" + "if(y.z>.01)" + "i+=mix(.02,pow(max(0.,v(y.xy-vec2(0,.25+pow(abs(y.x),3.)),vec2(.32,.94))-.05)*1e2,1.3)/1500.,1.-s(-.001,d));" + "if(y.z<0.)" + "z=v(z,m(y-vec3(0,0,-.1),vec3(.5,.5,.055))-.04,64.);" "a.x-=.09;" "a.y+=.635;" - "f=m(f,z,192.);" - "float r=f,c=.001+v(length(a)-.01,v(length(a-vec2(.036,0))-.01,length(a-vec2(-.036,0))-.01,40.),40.);" - "f=m(f,-l.z-.09,64.);" - "if(l.z<0.)" - "f=v(f,m(r+.03,i,64.),256.);" - "r=1.;" - "f=m(m(f,min(l.z,-c+.003),256.),min(l.z,-abs(d)-.001),448.);" - "f=m(f,min(l.z-.13,-v(l.xy-vec2(0,-.118))),512.);" - "f=m(f,min(l.z-.13,-abs(length(vec2(max(abs(l.x)-.12,0.),l.y+.117))-.035)+.003),512.);" - "f=m(m(f,min(1.,-min(1.,max(m(abs(l.x)-.31,abs(l.y-.49)-.29,5e2),abs(l.z-.185)-.1))+.004),576.),-abs(l.z-.01)-1e-4,384.);" - "if(l.y<0.)" + "f=m(f,i,192.);" + "i=f;" + "float c=.001+v(length(a)-.01,v(length(a-vec2(.036,0))-.01,length(a-vec2(-.036,0))-.01,40.),40.);" + "f=m(f,-y.z-.09,64.);" + "if(y.z<0.)" + "f=v(f,m(i+.03,z,64.),256.);" + "i=1.;" + "f=m(m(f,min(y.z,-c+.003),256.),min(y.z,-abs(d)-.001),448.);" + "f=m(f,min(y.z-.13,-v(y.xy-vec2(0,-.118))),512.);" + "f=m(f,min(y.z-.13,-abs(length(vec2(max(abs(y.x)-.12,0.),y.y+.117))-.035)+.003),512.);" + "f=m(m(f,min(1.,-min(1.,max(m(abs(y.x)-.31,abs(y.y-.49)-.29,5e2),abs(y.z-.185)-.1))+.004),576.),-abs(y.z-.01)-1e-4,384.);" + "if(y.y<0.)" "{" - "if(l.y<-.5)" - "f+=(1.-smoothstep(-.001,.002,x(l+vec3(0,.03,-.2),true)))*.005,f=m(f,-x(l+vec3(0,0,-.2),false),1024.);" + "if(y.y<-.5)" + "f+=(1.-smoothstep(-.001,.002,x(y+vec3(0,.03,-.2),true)))*.005,f=m(f,-x(y+vec3(0,0,-.2),false),1024.);" "vec2 k=vec2(-.32,-.314),p=vec2(.124,.033);" - "float b=length(l.xy-vec2(.405,-.28))-.07,o=length(l.xy-vec2(.202,-.345))-.07,e=v(v(l.xy-k,p)-.005,v(l.xy-k,p.yx)-.005,512.);" - "f=m(f,min(l.z,-b+.004),320.);" - "f=m(f,min(l.z,-o+.004),320.);" - "f=m(f,min(l.z,-min(1.,e)+.006),192.);" - "l.xy-=vec2(.405,-.28);" - "float g=(1.-s(.002,min(min(n(l.xy,vec2(0,-.035),vec2(-.014,.024)),n(l.xy,vec2(-.03,-.035),vec2(-.014,.024))),n(l.xy,vec2(-.02),vec2(-.01,-.02)))-.0025))*.002;" - "l.xy+=vec2(.405,-.28);" - "l.xy-=vec2(.202,-.345);" - "float w=min(min(min(n(l.xy,vec2(-.03,-.035),vec2(-.03,.024)),n(l.xy,vec2(-.03,-.035),vec2(-.018,-.035))),n(l.xy,vec2(-.03,.024),vec2(-.018,.024))),n(l.xy,vec2(-.03,-.0055),vec2(-.018,-.0055)));" - "if(l.x>-.018)" - "w=min(min(w,abs(length(l.xy-vec2(-.018,-.02025))-.01475)),abs(length(l.xy-vec2(-.018,.00925))-.01475));" - "w=(1.-s(.002,w-.0025))*.002;" - "l.xy+=vec2(.202,-.345);" - "float h=max(-l.z,m(abs(l.z)-.17,max(-.015,c),96.)),t=min(max(-l.z,m(abs(l.z)-.17+w,o,128.)),max(-l.z,m(abs(l.z)-.17+g,b,128.)));" - "vec3 C=l;" - "C.z-=pow(length(l.xy-k),2.)/2.-.01;" - "t=m(min(t,max(-l.z,m(abs(C.z)-.18,e,768.))),-length(C-vec3(k,.19))+.026,512.);" - "C.xy-=k;" - "C.xy=abs(C.xy);" - "if(C.x-.018)" + "r=min(min(r,abs(length(y.xy-vec2(-.018,-.02025))-.01475)),abs(length(y.xy-vec2(-.018,.00925))-.01475));" + "r=(1.-s(.002,r-.0025))*.002;" + "y.xy+=vec2(.202,-.345);" + "float h=max(-y.z,m(abs(y.z)-.17,max(-.015,c),96.)),t=min(max(-y.z,m(abs(y.z)-.17+r,o,128.)),max(-y.z,m(abs(y.z)-.17+g,b,128.)));" + "vec3 w=y;" + "w.z-=pow(length(y.xy-k),2.)/2.-.01;" + "t=m(min(t,max(-y.z,m(abs(w.z)-.18,e,768.))),-length(w-vec3(k,.19))+.026,512.);" + "w.xy-=k;" + "w.xy=abs(w.xy);" + "if(w.x0.)" - "a=vec2(a.x-D*a.y,-D*a.x-a.y)/2.;" + "a.y=a.y+1./C;" + "if(a.x+C*a.y>0.)" + "a=vec2(a.x-C*a.y,-C*a.x-a.y)/2.;" "a.x-=clamp(a.x,-2.,0.);" - "t=m(t,-max(-C.z,-length(a)*sign(a.y)+.565),512.);" + "t=m(t,-max(-w.z,-length(a)*sign(a.y)+.565),512.);" "if(t0.&&C.x0.&&w.xC.y||abs(d)<1e-5)" + "if(r>w.y||abs(d)<1e-5)" "break;" "r+=d;" "}" - "if(r0.)" - "return y=f,a;" + "return l=f,a;" "m=-1.;" - "vec2 x=vec2(-1,-3);" - "float i=(x.x-l.y)/v.y,r=(x.y-l.z)/v.z;" - "vec2 C=h((l-vec3(0,x+2.))*vec3(0,.5,.5),v*vec3(0,.5,.5)),c=l.yz+v.yz*C.y-x-2.;" - "if(C.x0.&&c.x<0.&&c.y<0.)" - "y=vec3(-c*.5,0).zxy,m=C.y;" - "else if(i>0.&&(i0.&&(r5.||abs(w.y)>2.5||abs(w.z)>3.3?" + "vec2 i=vec2(-1,-3);" + "float x=(i.x-y.y)/v.y,d=(i.y-y.z)/v.z;" + "vec2 w=h((y-vec3(0,i+2.))*vec3(0,.5,.5),v*vec3(0,.5,.5));" + "i=y.yz+v.yz*w.y-i-2.;" + "if(w.x0.&&i.x<0.&&i.y<0.)" + "l=vec3(-i*.5,0).zxy,m=w.y;" + "else if(x>0.&&(x0.&&(d5.||abs(f.y)>2.5||abs(f.z)>3.3?" "vec4(-1):" "vec4(m,0,0,0);" "}" @@ -241,159 +243,159 @@ const char *the_real_party_is_in_your_pocket_frag = "{" "return fract(sin(y++)*43758.5453123);" "}" - "vec3 h(vec3 l)" + "vec3 h(vec3 y)" "{" "vec3 v=vec3(0,0,4.8),f=vec3(0),a=vec3(1);" - "bool y=false;" + "bool l=false;" "for(int i=0;i<4;++i)" "{" - "l=normalize(l);" + "y=normalize(y);" "vec3 x;" - "vec4 C=h(v,l,x);" - "float r=C.x;" - "if(r<0.)" + "vec4 w=h(v,y,x);" + "float d=w.x;" + "if(d<0.)" "{" - "f+=max(a*vec3(.9)*(.5+.5*dot(l,normalize(vec3(-2,4,1))))*.4*1.3*vec3(1,.9,.65)+a*vec3(.9)*step(.9,dot(l,normalize(vec3(6,2,1))))*10.4*2.3+a*vec3(.9)*step(.95,dot(l,normalize(vec3(-2,1,3))))*10.4*1.5,0.)*pow(max(.5+.5*-l.z,0.),.2);" + "f+=max(a*vec3(.9)*(.5+.5*dot(y,normalize(vec3(-2,4,1))))*.4*1.3*vec3(1,.9,.65)+a*vec3(.9)*step(.9,dot(y,normalize(vec3(6,2,1))))*10.4*2.3+a*vec3(.9)*step(.95,dot(y,normalize(vec3(-2,1,3))))*10.4*1.5,0.)*pow(max(.5+.5*-y.z,0.),.2);" "break;" "}" - "float w=floor(C.y/8.);" - "C.y=mod(C.y,8.);" - "vec3 c=v+l*r;" - "vec2 d=vec2(6.28319*h(),h()*2.-1.);" - "vec3 k=x+vec3(sqrt(1.-d.y*d.y)*vec2(cos(d.x),sin(d.x)),d.y);" - "float z=C.y>1.5?" - "mix(c.x>0.?" + "float r=floor(w.y/8.);" + "w.y=mod(w.y,8.);" + "vec3 e=v+y*d;" + "vec2 c=vec2(6.28319*h(),h()*2.-1.);" + "vec3 k=x+vec3(sqrt(1.-c.y*c.y)*vec2(cos(c.x),sin(c.x)),c.y);" + "float z=w.y>1.5?" + "mix(e.x>0.?" ".1:" - ".05,.5,pow(1.-clamp(dot(-l,x),0.,1.),2.)):" - "mix(.2,.8,pow(1.-clamp(dot(-l,x),0.,1.),1.5));" - "if(C.y>5.5&&C.y<6.5)" + ".05,.5,pow(1.-clamp(dot(-y,x),0.,1.),2.)):" + "mix(.2,.8,pow(1.-clamp(dot(-y,x),0.,1.),1.5));" + "if(w.y>5.5&&w.y<6.5)" "{" - "if(y)" + "if(l)" "break;" - "v=c+x*2e-4;" - "a*=mix(.1,.8,pow(1.-clamp(dot(-l,x),0.,1.),3.))*mix(vec3(1),vec3(1,.9,.5),.5);" - "l=reflect(l,x)+(vec3(h(),h(),h())-.5)*.3;" + "v=e+x*2e-4;" + "a*=mix(.1,.8,pow(1.-clamp(dot(-y,x),0.,1.),3.))*mix(vec3(1),vec3(1,.9,.5),.5);" + "y=reflect(y,x)+(vec3(h(),h(),h())-.5)*.3;" "}" - "else if(C.y>4.5&&C.y<5.5)" + "else if(w.y>4.5&&w.y<5.5)" "{" - "if(y)" + "if(l)" "break;" "z=.02;" "if(h()>z)" - "v=c-x*2e-4*-sign(l.z),l+=(vec3(h(),h(),h())-.5)*.1;" + "v=e-x*2e-4*-sign(y.z),y+=(vec3(h(),h(),h())-.5)*.1;" "else" - " v=c+x*2e-4,l=reflect(l,x)+(vec3(h(),h(),h())-.5)*.3;" + " v=e+x*2e-4,y=reflect(y,x)+(vec3(h(),h(),h())-.5)*.3;" "}" - "else if(C.y<.5||C.y>2.5)" + "else if(w.y<.5||w.y>2.5)" "{" - "vec3 t=C.y>2.5?" + "vec3 t=w.y>2.5?" "vec3(.08):" "vec3(.7);" - "if(C.y>3.5)" + "if(w.y>3.5)" "{" "t=vec3(.008);" - "if(!y)" + "if(!l)" "{" - "if(c.y>.5)" + "if(e.y>.5)" "{" - "vec2 e=C.zw-vec2(-.38,.6);" - "float b=min(min(min(min(min(min(max(length(e-vec2(.005))-.0125,-length(e-vec2(-.012,.005))+.025),max(length(e-vec2(-.02,.005))-.0125,-length(e-vec2(-.045,.005))+.03)),max(length(e-vec2(.005))-.0125,-length(e-vec2(-.012,.005))+.025)),max(length(e-vec2(.03,.005))-.0125,-length(e-vec2(.02,.005))+.02)),abs(length(e-vec2(-.037,-.0398))-.0104)),n(e,vec2(-.064,-.05),vec2(-.064,-.03))),max(-e.x-.063,abs(length(vec2(max(0.,e.x+.06),e.y+.035))-.006)));" - "e.x-=.091;" - "b=min(b,n(e,vec2(-.064,-.05),vec2(-.064,-.03)));" - "b=min(b,max(-e.x-.063,abs(length(vec2(max(0.,e.x+.06),e.y+.035))-.006)));" - "b=min(b,n(e,vec2(-.054,-.05),vec2(-.059,-.041)));" - "e.x+=.091;" - "b=min(b,n(e,vec2(.009,-.05),vec2(.009,-.03)));" - "b=min(b,n(e,vec2(.009,-.05),vec2(.018,-.05)));" - "b=min(b,n(e,vec2(.009,-.03),vec2(.018,-.03)));" - "b=min(b,n(e,vec2(.009,-.039),vec2(.018,-.039)));" - "e.x=abs(e.x+.01);" - "e.x=abs(e.x-.006);" - "b=min(b,n(e,vec2(0,-.05),vec2(.006,-.03)));" + "vec2 p=w.zw-vec2(-.38,.6);" + "float b=min(min(min(min(min(min(max(length(p-vec2(.005))-.0125,-length(p-vec2(-.012,.005))+.025),max(length(p-vec2(-.02,.005))-.0125,-length(p-vec2(-.045,.005))+.03)),max(length(p-vec2(.005))-.0125,-length(p-vec2(-.012,.005))+.025)),max(length(p-vec2(.03,.005))-.0125,-length(p-vec2(.02,.005))+.02)),abs(length(p-vec2(-.037,-.0398))-.0104)),n(p,vec2(-.064,-.05),vec2(-.064,-.03))),max(-p.x-.063,abs(length(vec2(max(0.,p.x+.06),p.y+.035))-.006)));" + "p.x-=.091;" + "b=min(b,n(p,vec2(-.064,-.05),vec2(-.064,-.03)));" + "b=min(b,max(-p.x-.063,abs(length(vec2(max(0.,p.x+.06),p.y+.035))-.006)));" + "b=min(b,n(p,vec2(-.054,-.05),vec2(-.059,-.041)));" + "p.x+=.091;" + "b=min(b,n(p,vec2(.009,-.05),vec2(.009,-.03)));" + "b=min(b,n(p,vec2(.009,-.05),vec2(.018,-.05)));" + "b=min(b,n(p,vec2(.009,-.03),vec2(.018,-.03)));" + "b=min(b,n(p,vec2(.009,-.039),vec2(.018,-.039)));" + "p.x=abs(p.x+.01);" + "p.x=abs(p.x-.006);" + "b=min(b,n(p,vec2(0,-.05),vec2(.006,-.03)));" "t=mix(t,vec3(.3),step(b-.0018,0.));" "}" - "if(length(C.zw-vec2(-.43,.605))<.014)" - "f+=a*3.*vec3(1,.01,.01)*(.8+8.*(1.-s(.01,length(C.zw-vec2(-.43,.605)))));" - "if(C.w>0.&&c.y<.2)" + "if(length(w.zw-vec2(-.43,.605))<.014)" + "f+=a*3.*vec3(1,.01,.01)*(.8+8.*(1.-s(.01,length(w.zw-vec2(-.43,.605)))));" + "if(w.w>0.&&e.y<.2)" "{" - "t=mix(t,vec3(.3),step(n(C.zw-vec2(0,.103)),0.));" + "t=mix(t,vec3(.3),step(n(w.zw-vec2(0,.103)),0.));" "{" - "vec2 b=vec2(-.09,.03),e=vec2(-.1,0);" - "t=mix(t,vec3(.520661,.00153787,.064975),step(min(m(C.zw-vec2(.16,.103),e,e+normalize(e-b)*.03,vec2(-.065,-.026)),m(C.zw-vec2(.16,.103),vec2(-.07,.02),b,e))-.007,0.));" + "vec2 p=vec2(-.09,.03),b=vec2(-.1,0);" + "t=mix(t,vec3(.520661,.00153787,.064975),step(min(m(w.zw-vec2(.16,.103),b,b+normalize(b-p)*.03,vec2(-.065,-.026)),m(w.zw-vec2(.16,.103),vec2(-.07,.02),p,b))-.007,0.));" "}" "{" - "vec2 e=C.zw-vec2(.16,.103);" - "e-=vec2(-.029,-.015);" - "e.x+=cos(e.y*30.)*.01;" - "e.y-=cos(e.x*20.)*.01;" - "t=mix(t,vec3(.093564,.0865052,.434048),step(abs(length(e)-.02)-.007,0.));" + "vec2 p=w.zw-vec2(.16,.103);" + "p-=vec2(-.029,-.015);" + "p.x+=cos(p.y*30.)*.01;" + "p.y-=cos(p.x*20.)*.01;" + "t=mix(t,vec3(.093564,.0865052,.434048),step(abs(length(p)-.02)-.007,0.));" "}" "{" - "vec2 e=C.zw-vec2(.16,.103),b=vec2(-.007,0),p=vec2(-.007,-.0205);" - "t=mix(t,vec3(.186082,.481799,.0177778),step(min(m(e,p,p+normalize(p-b)*.01,vec2(.02,-.02)),m(e,vec2(-.01,.02),b,p))-.007,0.));" + "vec2 p=w.zw-vec2(.16,.103),b=vec2(-.007,0),o=vec2(-.007,-.0205);" + "t=mix(t,vec3(.186082,.481799,.0177778),step(min(m(p,o,o+normalize(o-b)*.01,vec2(.02,-.02)),m(p,vec2(-.01,.02),b,o))-.007,0.));" "}" "{" - "vec2 e=C.zw-vec2(.16,.103);" - "e-=vec2(.045,-.015);" - "e.x+=cos(e.y*20.+1.)*.005;" - "e.y-=cos(e.x*20.+25.)*.01;" - "t=mix(t,vec3(.730857,.454964,.000553633),step(abs(length(e)-.02)-.007,0.));" + "vec2 p=w.zw-vec2(.16,.103);" + "p-=vec2(.045,-.015);" + "p.x+=cos(p.y*20.+1.)*.005;" + "p.y-=cos(p.x*20.+25.)*.01;" + "t=mix(t,vec3(.730857,.454964,.000553633),step(abs(length(p)-.02)-.007,0.));" "}" "{" - "vec2 e=C.zw-vec2(.24,.103),b=vec2(-.002,0),p=vec2(-.007,.016),o=p+normalize(p-b)*.012,g=vec2(.02),D=vec2(.002,-.007),B=vec2(.025,-.028);" - "t=mix(t,vec3(0,.332318,.292872),step(min(min(min(m(e,p,o,g),m(e,vec2(-.006,-.026),b,p)),m(e,g,o+normalize(g-o)*.05,D)),m(e,D,(D+B)/2.+vec2(.001),B))-.007,0.));" + "vec2 p=w.zw-vec2(.24,.103),b=vec2(-.002,0),o=vec2(-.007,.016),C=o+normalize(o-b)*.012,g=vec2(.02),D=vec2(.002,-.007),B=vec2(.025,-.028);" + "t=mix(t,vec3(0,.332318,.292872),step(min(min(min(m(p,o,C,g),m(p,vec2(-.006,-.026),b,o)),m(p,g,C+normalize(g-C)*.05,D)),m(p,D,(D+B)/2.+vec2(.001),B))-.007,0.));" "}" "}" "{" - "vec2 e=vec2(160,144)/1.5,b=(C.zw-vec2(-.001,.486))*3.75*vec2(e.y/e.x,1)*.5+.5,p=fract(b*e);" - "b=floor(b*e)/e;" + "vec2 p=vec2(160,144)/1.5,b=(w.zw-vec2(-.001,.486))*3.75*vec2(p.y/p.x,1)*.5+.5,o=fract(b*p);" + "b=floor(b*p)/p;" "if(max(abs(b.x-.5),abs(b.y-.5))<.5)" "{" - "vec3 g=vec3(0);" - "vec2 o=(b*2.-1.)*vec2(e.x/e.y,1);" - "float D=min(min(min(min(min(min(min(min(min(min(min(min(min(min(min(min(min(n(vec4(1.54,.53,.91,.72),o),n(vec4(.63,.78,.91,.72),o)),n(vec4(.61,1.675,.72,.64),o)),n(vec4(2.7,3.11,.72,.64),o)),n(vec4(3.45,3.65,.72,.64),o)),n(vec4(4.71,5.02,.72,.64),o)),n(vec4(5.3,5.51,.72,.64),o)),n(vec4(5.96,6.43,.72,.64),o)),n(vec4(3.2,1.27,.45,.35),o)),n(vec4(1.3,2.3,.45,.35),o)),n(vec4(2.58,4.2,.45,.35),o)),n(vec4(3.2,3.95,.35,.25),o)),n(vec4(5.2,5.93,.35,.25),o)),n(vec4(7.9,8.15,.35,.25),o)),n(vec4(.2,1.16,.32,.17),o)),max(length(o)-.84,-length(o)+.72)),max(length(o)-.52,-length(o)+.45)),max(length(o)-.17,-length(o)+.08)),B=floor(b.y*8.);" - "g=.5+.5*cos(vec3(.8,.3,2)*(B+1.));" - "g=mix(g,vec3(1),step(D,0.));" - "g*=vec3(1,1,.8);" - "g*=smoothstep(.1,.2,p.x)*smoothstep(.1,.2,p.y);" - "f+=a*3.*g;" + "vec3 C=vec3(0);" + "vec2 g=(b*2.-1.)*vec2(p.x/p.y,1);" + "float D=min(min(min(min(min(min(min(min(min(min(min(min(min(min(min(min(min(n(vec4(1.54,.53,.91,.72),g),n(vec4(.63,.78,.91,.72),g)),n(vec4(.61,1.675,.72,.64),g)),n(vec4(2.7,3.11,.72,.64),g)),n(vec4(3.45,3.65,.72,.64),g)),n(vec4(4.71,5.02,.72,.64),g)),n(vec4(5.3,5.51,.72,.64),g)),n(vec4(5.96,6.43,.72,.64),g)),n(vec4(3.2,1.27,.45,.35),g)),n(vec4(1.3,2.3,.45,.35),g)),n(vec4(2.58,4.2,.45,.35),g)),n(vec4(3.2,3.95,.35,.25),g)),n(vec4(5.2,5.93,.35,.25),g)),n(vec4(7.9,8.15,.35,.25),g)),n(vec4(.2,1.16,.32,.17),g)),max(length(g)-.84,-length(g)+.72)),max(length(g)-.52,-length(g)+.45)),max(length(g)-.17,-length(g)+.08)),B=floor(b.y*8.);" + "C=.5+.5*cos(vec3(.8,.3,2)*(B+1.));" + "C=mix(C,vec3(1),step(D,0.));" + "C*=vec3(1,1,.8);" + "C*=smoothstep(.1,.2,o.x)*smoothstep(.1,.2,o.y);" + "f+=a*3.*C;" "t=vec3(.1);" "}" "}" "}" "}" - "if(C.y>3.&&C.y<3.2)" + "if(w.y>3.&&w.y<3.2)" "t=vec3(.4);" "a*=t;" - "v=c+x*2e-4;" - "l=k;" - "y=true;" + "v=e+x*2e-4;" + "y=k;" + "l=true;" "}" "else" "{" - "vec3 e=w>1.5?" + "vec3 p=r>1.5?" "vec3(1,.02,.2):" - "w>.5?" + "r>.5?" "vec3(.2,1,.02):" "vec3(.02,.2,1);" "if(h()>mix(.2,1.,z))" "{" - "if(C.y>1.5)" - "e=vec3(.02);" - "a*=e;" - "v=c+x*2e-4;" - "l=k;" - "y=true;" + "if(w.y>1.5)" + "p=vec3(.02);" + "a*=p;" + "v=e+x*2e-4;" + "y=k;" + "l=true;" "}" "else" "{" - "if(y)" + "if(l)" "break;" - "a*=C.y>1.5?" + "a*=w.y>1.5?" "vec3(.5):" - ".9*mix(e,vec3(1),.25);" - "v=c+x*2e-4;" - "l=reflect(l,x)+(vec3(h(),h(),h())-.5)*.4;" + ".9*mix(p,vec3(1),.25);" + "v=e+x*2e-4;" + "y=reflect(y,x)+(vec3(h(),h(),h())-.5)*.4;" "}" "}" "if(max(a.x,max(a.y,a.z))<.001)" @@ -403,18 +405,18 @@ const char *the_real_party_is_in_your_pocket_frag = "}" "void main()" "{" - "vec3 l=vec3(0);" - "for(int m=0;m<16;++m)" + "vec3 m=vec3(0);" + "for(int v=0;v<16;++v)" "{" - "y=float(m)+gl_TexCoord[0].x*16.;" - "float v=h()*6.28319;" - "vec2 a=vec2(cos(v),sin(v))*sqrt(1.-sqrt(1.-h()))*1.2;" + "y=float(v)+gl_TexCoord[0].x*16.;" + "float l=h()*6.28319;" + "vec2 a=vec2(cos(l),sin(l))*sqrt(1.-sqrt(1.-h()))*1.2;" "if(int(y)%4==0)" "a*=15.*length(a);" - "l+=h(vec3((gl_FragCoord.xy-vec2(960,540)+a)/540.,-3.5))/48.;" + "m+=h(vec3((gl_FragCoord.xy-vec2(960,540)+a)/540.,-3.5))/48.;" "}" - "l/=(l+1.)/2.;" - "gl_FragColor.xyz=pow(l+.01*vec3(1,1,.5),vec3(1./2.2))+h()/1e2;" + "m/=(m+1.)/2.;" + "gl_FragColor.xyz=pow(m+.01*vec3(1,1,.5),vec3(1./2.2))+h()/1e2;" "}"; #endif // THE_REAL_PARTY_IS_IN_YOUR_POCKET_FRAG_EXPECTED_ diff --git a/tests/real/to_the_road_of_ribbon.expected b/tests/real/to_the_road_of_ribbon.expected index 786f6d68..d753f410 100644 --- a/tests/real/to_the_road_of_ribbon.expected +++ b/tests/real/to_the_road_of_ribbon.expected @@ -40,8 +40,8 @@ const char *to_the_road_of_ribbon_frag = "v=max(dot(gn(c),vec3(.1,.1,0)),0.)+vec4(.3,cos(time*.5)*.5+.5,sin(time*.5)*.5+.5,1)*min(length(c-m)*.04,1.);" "if(oa(f)>ob(f))" "v=mix(v,vec4(cos(time*.3)*.5+.5,cos(time*.2)*.5+.5,sin(time*.3)*.5+.5,1),.3);" - "vec4 g=(v+vec4(r)+(1.-min(f.y+1.9,1.))*vec4(1,.8,.7,1))*min(time*.5,1.);" - "gl_FragColor=vec4(g.xyz,1);" + "v=(v+vec4(r)+(1.-min(f.y+1.9,1.))*vec4(1,.8,.7,1))*min(time*.5,1.);" + "gl_FragColor=vec4(v.xyz,1);" "}"; #endif // TO_THE_ROAD_OF_RIBBON_EXPECTED_ diff --git a/tests/real/valley_ball.glsl.expected b/tests/real/valley_ball.glsl.expected index 49c32d64..8dd21780 100644 --- a/tests/real/valley_ball.glsl.expected +++ b/tests/real/valley_ball.glsl.expected @@ -17,8 +17,8 @@ float smoothrnd(vec2 x) x=mod(x,1e3); vec2 a=fract(x); x-=a; - vec2 u=a*a*(3.-2.*a); - return mix(mix(rnd(x+vec2(0)),rnd(x+vec2(1,0)),u.x),mix(rnd(x+vec2(0,1)),rnd(x+vec2(1)),u.x),u.y); + a=a*a*(3.-2.*a); + return mix(mix(rnd(x+vec2(0)),rnd(x+vec2(1,0)),a.x),mix(rnd(x+vec2(0,1)),rnd(x+vec2(1)),a.x),a.y); } float norm(float x) { @@ -202,15 +202,15 @@ void main() interlacing=vec3(1.2,.9,.9); eps=1e-4; bigeps=.01; - float seed=10.; + angle=10.; int scene=int(Y.y); rd=vec3(p.xy-.5,1); if(scene>22&&scene<27) - seed=min(1.,sin((Y.y-23.)*pi*.25)*12.),ro=vec3(.12,.005,Y.y*.08),rd=vec3(mm*vec4(rd,1)),rd.y+=.1*cos(Y.y*4.); + angle=min(1.,sin((Y.y-23.)*pi*.25)*12.),ro=vec3(.12,.005,Y.y*.08),rd=vec3(mm*vec4(rd,1)),rd.y+=.1*cos(Y.y*4.); else if(scene>14&&scene<23) - seed=min(1.,sin((Y.y-15.)*pi*.125)*24.),rd+=vec3(0,.1*cos(Y.y*4.),0),ro=vec3(.08,.01*sin(Y.y*4.)+.002,Y.y*.11); + angle=min(1.,sin((Y.y-15.)*pi*.125)*24.),rd+=vec3(0,.1*cos(Y.y*4.),0),ro=vec3(.08,.01*sin(Y.y*4.)+.002,Y.y*.11); else - ro=vec3(.1,.004,0)+vec3(.1,.005,20)*vec3(rnd(vec2(scene,seed++)),rnd(vec2(scene,seed++)),rnd(vec2(scene,seed++))),ro=mix(ro+vec3(.008)*vec3(rnd(vec2(scene,seed++)),rnd(vec2(scene,seed++)),rnd(vec2(scene,seed++))),ro+vec3(.008)*vec3(rnd(vec2(scene,seed++)),rnd(vec2(scene,seed++)),rnd(vec2(scene,seed++))),Y.y-float(scene)),ro.y+=height(ro.xz)+.02,ro+=.02*getTerrainNormal(ro),seed=min(1.,step(-28.,-Y.y)*sin((Y.y-float(scene))*pi)*3.); + ro=vec3(.1,.004,0)+vec3(.1,.005,20)*vec3(rnd(vec2(scene,angle++)),rnd(vec2(scene,angle++)),rnd(vec2(scene,angle++))),ro=mix(ro+vec3(.008)*vec3(rnd(vec2(scene,angle++)),rnd(vec2(scene,angle++)),rnd(vec2(scene,angle++))),ro+vec3(.008)*vec3(rnd(vec2(scene,angle++)),rnd(vec2(scene,angle++)),rnd(vec2(scene,angle++))),Y.y-float(scene)),ro.y+=height(ro.xz)+.02,ro+=.02*getTerrainNormal(ro),angle=min(1.,step(-28.,-Y.y)*sin((Y.y-float(scene))*pi)*3.); rd=normalize(rd); spherePos=scene>22&&scene<27? ro+.1*vec3(mm*vec4(0,0,1,1)): @@ -228,6 +228,6 @@ void main() vec3 color=shadeRefl(traceRay(ro,rd,0),ro,rd); if(ro.y<=0.) color=godrays(color); - gl_FragColor.xyz=pp(step(2.,Y.y)*seed*color); + gl_FragColor.xyz=pp(step(2.,Y.y)*angle*color); gl_FragColor.w=1.; } diff --git a/tests/real/yx_long_way_from_home.frag.expected b/tests/real/yx_long_way_from_home.frag.expected index a1f39f38..48ef06a3 100644 --- a/tests/real/yx_long_way_from_home.frag.expected +++ b/tests/real/yx_long_way_from_home.frag.expected @@ -37,7 +37,7 @@ const char *yx_long_way_from_home_frag = "vec3 c=i;" "c.x=abs(c.x-1.1)-.2;" "float s=max(length(c.xz+vec2(0,5))-.01,c.y-5.);" - "vec3 n=i;" + "c=i;" "if(i.y<.3)" "{" "i.y+=texture(v,i.xz*.125).x*9e-4;" @@ -55,14 +55,11 @@ const char *yx_long_way_from_home_frag = "i.y-=smoothstep(.05,0.,abs(y-.16))*.004;" "i.y-=(1.-z)*.01*p(i.xz);" "}" - "i.y-=smoothstep(2.,0.,length(n.xz+vec2(-1.5,3.5)))*.2;" - "i.y-=smoothstep(2.,0.,length(n.xz+vec2(1,-2)))*.2;" + "i.y-=smoothstep(2.,0.,length(c.xz+vec2(-1.5,3.5)))*.2;" + "i.y-=smoothstep(2.,0.,length(c.xz+vec2(1,-2)))*.2;" "float y=i.y;" "x=min(x,y);" - "{" - "vec3 r=i;" - "r.xz=mod(r.xz-.5,1.)-.5;" - "}" + "c.xz=mod(c.xz-.5,1.)-.5;" "i.y-=.25;" "f=s=0.?" - "p:" + "vec4 B=vec4(c(r,o),1);" + "gl_FragColor=!isnan(B.x)&&B.x>=0.?" + "B:" "vec4(0);" "}"; diff --git a/tests/unit/inline-fn.aggro.expected b/tests/unit/inline-fn.aggro.expected index 392713f3..c1a0bb2e 100644 --- a/tests/unit/inline-fn.aggro.expected +++ b/tests/unit/inline-fn.aggro.expected @@ -96,11 +96,12 @@ float f() sep++; float _E2=6.+watchout(glob)-glob--*(glob*=10.)+inuit(glob),_E4=E4(),_E5=E5(); sep++; - float o,_F2=F2(o),_F3=F3(o); + float o,_F2=F2(o); + o=F3(o); sep++; shadowedVar++; shadowedFunc++; - return shadowedVar+shadowedFunc+1.+_A3+_A4+_B1+4.+_C1+(3.+sin(0.))+8.+9.+E1()+_E2+E3()+_E4+_E5+7.+_F2+_F3; + return shadowedVar+shadowedFunc+1.+_A3+_A4+_B1+4.+_C1+(3.+sin(0.))+8.+9.+E1()+_E2+E3()+_E4+_E5+7.+_F2+o; } float g() { diff --git a/tests/unit/inline-fn.expected b/tests/unit/inline-fn.expected index 392713f3..c1a0bb2e 100644 --- a/tests/unit/inline-fn.expected +++ b/tests/unit/inline-fn.expected @@ -96,11 +96,12 @@ float f() sep++; float _E2=6.+watchout(glob)-glob--*(glob*=10.)+inuit(glob),_E4=E4(),_E5=E5(); sep++; - float o,_F2=F2(o),_F3=F3(o); + float o,_F2=F2(o); + o=F3(o); sep++; shadowedVar++; shadowedFunc++; - return shadowedVar+shadowedFunc+1.+_A3+_A4+_B1+4.+_C1+(3.+sin(0.))+8.+9.+E1()+_E2+E3()+_E4+_E5+7.+_F2+_F3; + return shadowedVar+shadowedFunc+1.+_A3+_A4+_B1+4.+_C1+(3.+sin(0.))+8.+9.+E1()+_E2+E3()+_E4+_E5+7.+_F2+o; } float g() { diff --git a/tests/unit/inline.no.expected b/tests/unit/inline.no.expected index 954f1086..725dd409 100644 --- a/tests/unit/inline.no.expected +++ b/tests/unit/inline.no.expected @@ -3,8 +3,9 @@ float result; void main() { - float x=.5,a=.6*x*x; - result=a; + float x=.5; + x=.6*x*x; + result=x; } int arithmetic() { @@ -16,13 +17,14 @@ int vars(int arg,int arg2) } int arithmetic2() { - int a=2,b=3,c=a+b; - return 4*a*c; + int a=2,b=3; + b=a+b; + return 4*a*b; } int unusedVars() { - int a=arithmetic(),b=13,c=10; - return c*3; + int a=(arithmetic(),10); + return a*3; } int unusedVars2() { @@ -31,8 +33,9 @@ int unusedVars2() } int multiPass() { - int one=1,two=one*2; - return two+1; + int one=1; + one*=2; + return one+1; } float multiPass2() { @@ -65,8 +68,9 @@ uniform int time; in int sync; int dependOnConst() { - int x=time+sync,y=x*2; - return y*3; + int x=time+sync; + x*=2; + return x*3; } float noinl179(float x) { diff --git a/tests/unit/many_variables.expected b/tests/unit/many_variables.expected index 533d5277..1853e5ee 100644 --- a/tests/unit/many_variables.expected +++ b/tests/unit/many_variables.expected @@ -11,13 +11,13 @@ "{" "float M=L,f=K,N=J,O=I,P=H,Q=G;" "int R=1,S=2,T=3,U=4,V=5,W=6,X=7,Y=8;" - "float Z=F,_=E,a=D,b=C,c=B,d=A;" - "int e=1,g=2,h=3,i=4,j=5,k=6,l=7,m=8;" - "float n=0.;" - "int o=1,p=2,q=3,r=4,s=5,t=6,u=7,v=8;" - "float w=0.;" - "int x=1,y=2,z=3,at=4,aa=5,ab=6,ac=7,aA=8;" - "return Y+m+v+aA;" + "float i=F,Z=E,_=D,a=C,b=B,c=A;" + "int d=1,e=2,g=3,h=4,j=5,k=6,l=7,m=8;" + "i=0.;" + "int n=1,o=2,p=3,q=4,r=5,s=6,t=7,u=8;" + "i=0.;" + "int v=1,w=2,x=3,y=4,z=5,at=6,ai=7,aA=8;" + "return Y+m+u+aA;" "}", #endif diff --git a/tests/unit/reuse-var.frag.expected b/tests/unit/reuse-var.frag.expected index 6bd7ea6b..d101b910 100644 --- a/tests/unit/reuse-var.frag.expected +++ b/tests/unit/reuse-var.frag.expected @@ -6,21 +6,21 @@ float simple_var_decl_reuse(float x) int b2=5+int(a); float c=a; sep+=vec3(0); - float c2=9.+a; + a=9.+a; int d=3+b+b2; sep+=vec3(0); - int d2=d+b2-b; - float e=c*c2; + b2=d+b2-b; + float e=c*a; sep+=vec3(0); - float e2=4.-c-c2; - int f=3*d*d2; + c=4.-c-a; + b=3*d*b2; sep+=vec3(0); - int f2=4/d2-d; - float g=e-float(f)+e2; - int g2=int(4.-g+e2+e),h=3*f-f2; + d=4/b2-d; + a=e-float(b)+c; + int g2=int(4.-a+c+e),h=3*b-d; sep+=vec3(0); - int h2=7*f2-f; - return length(sep)+float(h*h2)*g*float(g2)*x+float(g2/h2-h); + d=7*d-b; + return length(sep)+float(h*d)*a*float(g2)*x+float(g2/d-h); } float multidecl_var_decl_reuse(float x) {