optimize - 4094

This commit is contained in:
2024-08-01 21:28:21 +03:00
parent 3760f1faac
commit 5ca0074855
2 changed files with 14 additions and 18 deletions

View File

@ -135,8 +135,7 @@ float prismAnim(vec2 i) {
float sea_octave(vec2 uv, float choppy) {
uv += noise(uv, 1., 1);
vec2 wv = 1.0-abs(sin(uv));
vec2 swv = abs(cos(uv));
wv = mix(wv,swv,wv);
wv = mix(wv, abs(cos(uv)),wv);
return pow(1.0-pow(wv.x * wv.y,0.65),choppy);
}
@ -156,8 +155,7 @@ vec3 map(vec3 p, int displace)
d = min(d,d2);
// Inner ring
d2 = abs(length(p.xy) - 1.75) - .08;
d2 = smax( d2, abs(p.z - .1)-.04, .005 );
d2 = smax( abs(length(p.xy) - 1.75) - .08, abs(p.z - .1)-.04, .005 );
d = max(-d2,d);
// Depth slice rings
@ -211,9 +209,8 @@ vec3 map(vec3 p, int displace)
if (d==d2) mat=3.;
// Prisms
for(float i = 0.; i < 8.; i++ ) {
an = 24.67 / (PI * 2.); // sector size
q = p;
anRot = an + (i+1.) * PI / 4.;
anRot = 24.67 / (PI * 2.) + (i+1.) * PI / 4.;
// Nudge first and the last prism out of the ground
if (i == 1.) anRot += .2;

View File

@ -98,8 +98,7 @@ const char *__temp_cleaned_shader_glsl =
"{"
"v+=x(v,1.,1);"
"vec2 f=1.-abs(sin(v));"
"v=abs(cos(v));"
"f=mix(f,v,f);"
"f=mix(f,abs(cos(v)),f);"
"return pow(1.-pow(f.x*f.y,.65),y);"
"}"
"vec3 w(vec3 v,int f)"
@ -119,9 +118,10 @@ const char *__temp_cleaned_shader_glsl =
"if(c==l)"
"z=6.;"
"l=1e3;"
"float C=1.5,e=0.,b,E=4.,D=.6,B=.2;"
"r=1.5;"
"float e=0.,b,C=4.,E=.6,D=.2;"
"for(int i=0;i<4;i++)"
"a=n(vec3(v.x,v.y+C+.05,v.z),vec3(2,.2,C))-.05,l=min(l,a),C+=.2;"
"a=n(vec3(v.x,v.y+r+.05,v.z),vec3(2,.2,r))-.05,l=min(l,a),r+=.2;"
"l+=x(v.xz*50.+2e2,.007,0);"
"c=min(c,l);"
"if(c==l)"
@ -130,7 +130,7 @@ const char *__temp_cleaned_shader_glsl =
"{"
"vec2 f=v.xy;"
"for(int i=0;i<4;i++)"
"b=t((f+y)*D,E)+t((f-y)*D,E),e+=b*B,f*=mat2(1.6,1.2,-1.2,1.6),D*=1.9,B*=.22,E=mix(E,1.,.4);"
"b=t((f+y)*E,C)+t((f-y)*E,C),e+=b*D,f*=mat2(1.6,1.2,-1.2,1.6),E*=1.9,D*=.22,C=mix(C,1.,.4);"
"}"
"l=max(max(-s(v,2.,min(2.-(y-23.)*3.,2.3)),s(v,.025,1.6)-e*.15),s(v,.3,1.7));"
"c=min(c,l);"
@ -146,28 +146,27 @@ const char *__temp_cleaned_shader_glsl =
"z=3.;"
"for(float f=0.;f<8.;f++)"
"{"
"r=24.67/(m*2.);"
"p=v;"
"d=r+(f+1.)*m/4.;"
"d=24.67/(m*2.)+(f+1.)*m/4.;"
"if(f==1.)"
"d+=.2;"
"if(f==7.)"
"d-=.2;"
"p.xy=n(d)*p.xy;"
"float x=9.+(f-1.)*2.+1.5;"
"float r=9.+(f-1.)*2.+1.5;"
"if(f>0.)"
"{"
"p.x-=1.95;"
"vec3 v=p;"
"if(y>x)"
"v.x=w(vec2(v.x,x));"
"if(y>r)"
"v.x=w(vec2(v.x,r));"
"float f=s(vec3(p.x-.06,p.yz),vec2(.1,.15))-.01;"
"l=min(max(-s(vec3(v.x-.14,v.yz),vec2(.22))-.01,s(vec3(v),vec2(.2,.12))-.02),f);"
"c=min(c,l);"
"if(c==l)"
"z=4.;"
"if(c==f)"
"if(y>x+.2)"
"if(y>r+.2)"
"z=5.,i=min(l,f);"
"}"
"}"
@ -177,7 +176,7 @@ const char *__temp_cleaned_shader_glsl =
"{"
"vec3 m;"
"float i=0.;"
"for(int c=0;c<100;c++)"
"for(int r=0;r<100;r++)"
"{"
"m=w(v+y*i,0);"
"if(f==0&&m.z<.3)"