memoscan
← all memos

Memo 0x44d96898…fd2dc2 on Ethereum

peration="lighter",s.fillStyle=n,this._fillRect(s,t.x-t.size,t.y-t.size,t.size*2,t.size*2),s.restore()}}renderFlowers(e){this.clear(),this._renderFlowers(e),this.texture.needsUpdate=!0}_renderFlowers(e){const t=this.ctx;for(const s of e){const i=s.size,n=this._createLinearGradient(t,s.x-i,s.y,s.x+i,s.y);n.addColorStop(0,"rgba(0,0,255,1)"),n.addColorStop(1,"rgba(255,0,255,1)");const l=this._createLinearGradient(t,s.x,s.y-i,s.x,s.y+i);l.addColorStop(0,"rgba(0,0,255,1)"),l.addColorStop(1,"rgba(0,255,255,1)"),t.save(),t.beginPath(),this._rect(t,s.x-i,s.y-i,i*2,i*2),t.clip(),t.fillStyle=n,this._fillRect(t,s.x-i,s.y-i,i*2,i*2),t.globalCompositeOperation="lighter",t.fillStyle=l,this._fillRect(t,s.x-i,s.y-i,i*2,i*2),t.restore()}}_createLinearGradient(e,t,s,i,n){return e.createLinearGradient(t*this._ratio,s*this._ratio,i*this._ratio,n*this._ratio)}_fillRect(e,t,s,i,n){e.fillRect(t*this._ratio,s*this._ratio,i*this._ratio,n*this._ratio)}_rect(e,t,s,i,n){e.rect(t*this._ratio,s*this._ratio,i*this._ratio,n*this._ratio)}get textureOrientation(){return this.texture}get textureTrees(){return this._canvasTrees.texture}}var Hr=`#i_ noiseUtils #i_ snoise2d #injectUniforms _u _f uDecal;in _v2 vUv;out _v4 outColor0;void main(){_f a=snoise2d(vUv*10.+uDecal);_v2 uv=vUv+_v2(cos(a),sin(a))*.002*uDecal;outColor0=texture(tToDeform,uv);}`;class Ue extends j{constructor(e={},t=1,s={}){super(1,s,{ratio:.25}),this.init({textures:e,fs:Hr}),this.uniforms.uDecal={value:t}}}var Wr=`#injectUniforms in vec2 vUv;out vec4 outColor0;void main(){vec4 gridPattern=texture(tGridPattern,vUv);float alphagrid=gridPattern.r;outColor0=vec4(uLinesGridColor,alphagrid*uLinesGridAlpha);}`;class Yr extends j{constructor(e={},t={}){super(1,t,{ratio:.5}),this.init({textures:e,fs:Wr,dataFroms:[c.gridPatternData]})}}class Xr extends G{constructor(){const e={flipY:!1};super({renderTargetOpts:e,ratio:.05})}prepare(e){this._ryokanCellSize=e}generate(){let e=2+a.rand2()*3>>0;a.generator.isSmallTrees&&(e*=4),this._trees=[];for(let t=0;t<e;t++){const s=this._generateStraight(t);s&&this._trees.push(s)}this._generateOrientationsData()}_generateStraight(e=0){let t=this._findStartingX();if(t==-1)return null;let s=-Math.PI*.6+a.rand2()*Math.PI*.3,i=-200,n=!1;const l=[{x:t,y:i}];let o=100,h=.1,d=1.075,u=.5,f=0;for(;this._isStillIn(t,i,n);){const g=50+a.rand2()*50,_=t+Math.cos(s)*g,m=i+g;if(l.push({x:_,y:m}),t=_,i=m,f%6==0&&(s+=(a.rand()*Math.PI*.2-Math.PI*.1)*h),h*=d,h=Math.min(h,u),i>0&&(n=!0),f++,o--<0)break}return l.push({x:t+Math.cos(s)*200,y:i+200}),{path:l}}_findStartingX(){let e=0;return this._trees.length==0?e=this._getFirstX():e=this._getNewX(),e}_getFirstX(){const e=[.25,.382,.5,.618,.75],t=e.length*a.rand2()>>0;return a.size.width*e[t]}_getNewX(){let e=a.rand()*a.size.width;const t=c.treesData.treeThickness*(this._trees.length>2?3.5:5);let s=10;for(;this._isTooCloseFromOtherTrees(e,t);)if(e=a.rand()*a.size.width,s--<0)return-1;return e}_isTooCloseFromOtherTrees(e,t){for(const s of this._trees){const n=s.path[0].x;if(Math.abs(n-e)<t)return!0}return!1}_isStillIn(e,t,s=!1){return!(e<0||e>a.size.width||t>a.size.height||s&&t<0)}_generateOrientationsData(){for(const e of this._trees){const t=e.path,s=[],i=c.treesData.treeThickness,n=t[0];let l={x:n.x+i,y:n.y},o={x:n.x-i,y:n.y};const h=[],d=[],u=t.length;for(let f=1;f<u;f++){const g=t[f],_=t[f-1],m=g.x-_.x,p=g.y-_.y,w=Math.atan2(p,m);let v=i*1.4-i*.4*(f/u);a.generator.isSmallTrees&&(v*=.25);const x={x:g.x+Math.cos(w-Math.PI*.5)*v,y:g.y+Math.sin(w-Math.PI*.5)*v},y={x:g.x+Math.cos(w+Math.PI*.5)*v,y:g.y+Math.sin(w+Math.PI*.5)*v};h.push(x),d.push(y);const M=(Math.cos(w)*.5+.5)*255>>0,k=(Math.sin(w)*.5+.5)*255>>0,S=255;s.push({color:`rgb(${M}, ${k}, ${S})`,coords:[{...l},{...o},{...y},{...x}]}),l=x,o=y}e.blocks=s,e.pointsLeft=h,e.pointsRight=d}}render(){this.clear();for(const e of this._trees)this._renderTree(e);this.texture.needsUpdate=!0}_renderTree(e){const t=e.blocks;for(let s=0;s<t.length;s++){const i=t[s];this.ctx.fillStyle=i.color,this.ctx.beginPath(),this.ctx.moveTo(i.coords[0].x*this._ratio,i.coords[0].y*this._ratio);for(let n=1;n<i.coords.length;n++)this.ctx.lineTo(i.coords[n].x*this._ratio,i.coords[n].y*this._ratio);this.ctx.fill()}}get textureOrientation(){return this.texture}}let Ee=performance.now(),ce=0;const Kr=a.isRender?240:60,ve=1e3/Kr,me=[];function It(r){let e=r-Ee;if(e>ve*100?(e=0,ce=0,Ee=r):(ce+=e,Ee=r),ce>=ve){for(const t of me)t(e);ce=0}requestAnimationFrame(It)}requestAnimationFrame(It);const Be={add:r=>{me.push(r)},remove:r=>{const e=me.indexOf(r);e!==-1&&me.splice(e,1)},useDeltaTime:r=>{useDeltaTime=r},resume:()=>{},pause:()=>{}},Gt=new V,Nt=()=>new Promise(r=>{let e=performance.now(),t=0;function s(i){let n=i-e;n>ve*100?(n=0,t=0,e=i):(t+=n,e=i),t>=ve?(Gt.dispatch(),r()):requestAnimationFrame(s)}requestAnimationFrame(s)});var Jr=`#i_ blendmodes #injectUniforms _u _f uMin1;_u _f uMax1;_u bool uMinMax2Activated;_u _f uMin2;_u _f uMax2;_u _v3 uColor;_u bool uClearBG;_u _f uPercent;in _v2 vUv;out _v4 outColor0;_vm_v4 gridLines=_t(tGridLines,vUv);_v4 grid=_t(tGrid,vUv);_v4 result=_v4(uColor,1.);result.rgb=blendMode(2,result.rgb,_v3(grid.r),.5);result.rgb=blendMode(2,result.rgb,uLinesGridColor,gridLines.r*2.);if(uClearBG==true){outColor0=result;return;}_v4 gridScene=_t(tGridScene,vUv);_v4 vegeLines=_t(tVegeLines,vUv);_v4 assembler=_t(tAssembler,vUv);_f gridVal=gridScene.g;_v4 sb=assembler;bool isVegelinesOk=false;if(gridVal>=uMin1&&gridVal<=uMax1){sb.rgb=vegeLines.rgb;sb.a=1.;isVegelinesOk=true;}if(uMinMax2Activated==true){if(gridVal>=uMin2&&gridVal<=uMax2){sb.rgb=vegeLines.rgb;sb.a=1.;isVegelinesOk=true;}}_f vegeLinesLuminance=dot(vegeLines.rgb,_v3(0.299,0.587,0.114));result.rgb=mix(result.rgb,_v3(vegeLinesLuminance),(0.15+(0.35*(1.-uPercent)))*(1.-grid.b));if(uPercent<1.){outColor0=grid.b<uPercent ? sb : result;outColor0.rgb=blendMode(2,outColor0.rgb,uLinesGridColor,gridLines.r*2.*(1.-uPercent));}else{outColor0=sb;}}`;class Zr extends j{constructor(e){super(),this.init({fs:Jr,textures:e,dataFroms:[c.gridPatternData]}),this.uniforms.uMin1={value:1e-4},this.uniforms.uMax1={value:1.0001},this.uniforms.uMinMax2Activated={value:!1},this.uniforms.uMin2={value:1e-4},this.uniforms.uMax2={value:1.0001},this.uniforms.uColor={value:new E(16711935)},this.uniforms.uClearBG={value:!1},this.uniforms.uPercent={value:0}}render({hasToClear:e=!0,min1:t=0,max1:s=1,minMax2Activated:i=!1,min2:n=0,max2:l=1,clearBG:o=!1}={}){this.uniforms.uMin1.value=t,this.uniforms.uMax1.value=s,this.uniforms.uMinMax2Activated.value=i,this.uniforms.uMin2.value=n,this.uniforms.uMax2.value=l,this.uniforms.uColor.value.set(c.backgroundData.globalBackgroundColor),this.uniforms.uClearBG.value=o,this.uniforms.uPercent.value=a.loader.progressRender,super.render({hasToClear:e})}setPercent(e){this.uniforms.uPercent.value=e}}var Qr=`#injectUniforms _u _s2 tMoment;_u _f uMin;_u _f uMax;_u _v2 uScreenRatioV2;in _v2 vUv;out _v4 outColor0;_vm_v4 flow=_t(tFlow,vUv);_v4 grid=_t(tGrid,vUv);_v4 moment=_t(tMoment,vUv);_v4 sb=_v4(0.);if(grid.g>=uMin&&grid.g<=uMax){sb.rgb=moment.rgb;sb.a=1.;}outColor0=sb;}`;class ea extends j{constructor(e){super(),this.init({fs:Qr,textures:e,dataFroms:[c.composerData]}),this.uniforms.tMoment={value:null},this.uniforms.uMin={value:1e-4},this.uniforms.uMax={value:1.0001}}render({hasToClear:e=!0,texture:t=null,min:s=0,max:i=1,color:n=null}={}){this.uniforms.tMoment.value=t,this.uniforms.uMin.value=s,this.uniforms.uMax.value=i,super.render({hasToClear:e})}}a.rand;function ie(r,e,t,s,i){return s+(r-e)*(i-s)/(t-e)}var ta=`#injectUniforms _u _v2 uDirMultiplier;in _v2 vUv;out _v4 outColor0;_vm_v2 uvGrid=vUv;float percent=texture(tGrid,uvGrid).r*2.-1.;_v2 offset=_v2(uDispX,uDispY)*uDirMultiplier*uStrength;offset*=percent;_v4 pattern=texture(tPattern,mod(vUv+offset,1.));outColor0=pattern;}`;class sa extends j{constructor(e={},t={}){super(1,t,{ratio:.25});const s=.25;this._grid=new G({ratio:.25}),e.tGrid=this._grid.texture,this._grid.clear();const i=4,n=4;for(let l=0;l<a.size.width;l+=i)for(let o=0;o<a.size.height;o+=n){const h=a.rand2()*255>>0;this._grid.ctx.fillStyle=`rgba( ${h}, ${h}, ${h}, 1 )`,this._grid.ctx.fillRect(l*s,o*s,i*s,n*s)}this._grid.texture.needsUpdate=!0,this.init({textures:e,fs:ta,dataFroms:[a.data.compositionsData.deformer,a.data.gridData]}),this.uniforms.uDirMultiplier={value:new F(1,1)}}render(e,t){this.uniforms.tPattern.value=e,this.uniforms.uDirMultiplier.value=t,super.render()}get textureGrid(){return this._grid.texture}}class ia{constructor(e,t){this.reset(e,t)}reset(e,t){this.width=e,this.height=t,this.count=this.width*this.height>>0,this.count4=this.count<<2,this.data=new Float32Array(this.count4);const s=a.gl;this.textureMain=new oe(s,{image:this.data,width:this.width,height:this.height,type:s.FLOAT,generateMipmaps:!1,target:s.TEXTURE_2D,format:s.RGBA,internalFormat:s.renderer.isWebgl2?s.RGBA32F:s.RGBA,wrapS:s.CLAMP_TO_EDGE,wrapT:s.CLAMP_TO_EDGE,minFilter:s.NEAREST,magFilter:s.NEAREST,flipY:!1});for(let i=0;i<this.count4;i+=4)this.textureMain.image[i+0]=0,this.textureMain.image[i+1]=0,this.textureMain.image[i+2]=0,this.textureMain.image[i+3]=1;this.textureMain.needsUpdate=!0}init(){this.uniforms={tData:{value:this.textureMain}}}setX(e,t){this.textureMain.image[t*4+0]=e,this.textureMain.needsUpdate=!0}setY(e,t){this.textureMain.image[t*4+1]=e,this.textureMain.needsUpdate=!0}setZ(e,t){this.textureMain.image[t*4+2]=e,this.textureMain.needsUpdate=!0}setW(e,t){this.textureMain.image[t*4+3]=e,this.textureMain.needsUpdate=!0}}class ra extends be{constructor(e){e=e;const t=a.linesPerGeometry,s=t<<1,i=t<<2;let n=0,l=0,o=0,h=0,d=0;const u=new Float32Array(i);for(let y=0;y<i;y++){const M=y;for(let k=0;k<4;k++)u[n]=M,n+=1,l+=2;d+=1,d>e.width-1&&(d=0)}n=0,l=0;let f=1,g=1;const _=new Float32Array(i*2),m=new Float32Array(i*2);for(let y=0;y<s;y++)_[h+0]=-1*f,_[h+1]=-1*g,m[h+0]=0,m[h+1]=0,_[h+2]=-1*f,_[h+3]=1*g,m[h+2]=0,m[h+3]=1,_[h+4]=1*f,_[h+5]=-1*g,m[h+4]=1,m[h+5]=0,_[h+6]=1*f,_[h+7]=1*g,m[h+6]=1,m[h+7]=1,h+=8;const p=new Float32Array(i);let w=0;for(let y=0;y<s;y++){const M=y;p[w]=M,p[w+1]=M,p[w+2]=M,p[w+3]=M,w+=4}l=0;const v=new Uint32Array(i*3);for(let y=0;y<t;y++)v[o+0]=l,v[o+1]=v[o+4]=l+1,v[o+2]=v[o+3]=l+2,v[o+5]=l+3,l+=4,o+=12;const x={uid:{data:u},side:{size:2,data:_},uv:{size:2,data:m},index:{data:v},zs:{size:1,data:p}};super(a.gl,x),this.count=t}generate(){const e=this.attributes.zs.data;for(let t=0;t<this.count;t++){const s=a.rand(),i=t*4;e[i]=s,e[i+1]=s,e[i+2]=s,e[i+3]=s}this.attributes.zs.needsUpdate=!0}}class aa{constructor(e,t,s){this.idx=e,this.data=t,this.dataColors=s,this._x=0,this._y=0}reset(){this.x=0,this.y=0,this.alpha=0}setRGB(e,t=-1){this.dataColors.setRGB(e,this.idx),t!=-1&&this.dataColors.setAlpha(t,this.idx)}set x(e){this._x=e,this.data.setX(this._x,this.idx)}get x(){return this._x}set y(e){this._y=e,this.data.setY(this._y,this.idx)}get y(){return this._y}set z(e){this._z=e,this.data.setZ(this._z,this.idx)}get z(){return this._z}set w(e){this._w=e,this.data.setW(this._w,this.idx)}get w(){return this._w}}class na extends Le{constructor(e,t){const s=new ra(e);super(a.gl,{geometry:s,program:t}),this.lines=[];for(let i=0;i<e.count;i++)this.lines.push(new aa(i,e));this.idxLine=0}generate(){this.geometry.generate()}get(){if(!this.helpers)throw new Error("Property 'helpers' set to false. Switch to true to be able to target lines through objects.");if(this.lines.length<=0)throw new Error("No more line available.");return this.lines.pop()}}var oa=`#define M_PI 3.1415 #define HALF_PI 1.5707 _u _f ugenhash; #injectUniforms _u _v2 uResolution;_u _f uScreenRatio;_u _v2 uScreenRatioV2;_u _v2 uOffset;_u _f uPercentGrid;_u bool uSkipMask;_u _v3 uLineColor;_u bool uIsFlower;_u _s2 tColor;_u bool hasToCheckColor;_u _f uIDAdd;_u _f uMarg;in _f uid;in _v2 side;in _v2 uv;in _f zs;out _v2 vUv;out _v3 vColor;out _f isVisible;out _f isVisibles[4];out _f vUid;out _f vModColor1;out _f vModColor2;out _f vAlpha;out _v3 vLineColor; #i_ noiseUtils #i_ snoise2d #i_ rgb2hsl #i_ hsl2rgb #i_ cubic _f _getUID(){return uid+uIDAdd;}_f vhash(_v3 p){p=fract(p*0.3183099+.1);p*=17.0;return fract(p.x*p.y*p.z*(p.x+p.y+p.z));}_f vnoise(in _v3 x){_v3 i=floor(x);_v3 f=fract(x);f=f*f*(3.0-2.0*f);return mix(mix(mix(vhash(i+_v3(0,0,0)),vhash(i+_v3(1,0,0)),f.x),mix(vhash(i+_v3(0,1,0)),vhash(i+_v3(1,1,0)),f.x),f.y),mix(mix(vhash(i+_v3(0,0,1)),vhash(i+_v3(1,0,1)),f.x),mix(vhash(i+_v3(0,1,1)),vhash(i+_v3(1,1,1)),f.x),f.y),f.z);}_f hash12(_v2 p){_v3 p3=fract(_v3(p.xyx)*.1031);p3+=dot(p3,p3.yzx+33.33);return fract((p3.x+p3.y)*p3.z);}_f cbv(_v3 p1,_v3 p2,_v3 rgbToCompare){_f dx=p2.x-p1.x;_f dy=p2.y-p1.y;_f a=atan(dy,dx);_f dist=sqrt(dx*dx+dy*dy);_f acc=dist/2.;_f x=p1.x;_f y=p1.y;for(int i=0;i<2;i++){_v3 p=_t(tPattern,_v2(x,y)).rgb;_f diff=abs(p.z-rgbToCompare.z);if(diff>uVisibleThreshold){return 0.;}x+=cos(a)*acc;y+=sin(a)*acc;}return 1.;}_f mapToPower(_f value,_f minValue,_f maxValue,_f power){_f valueSign=sign(value);value=(value-minValue)/(maxValue-minValue);value=valueSign>0. ? value : value-1.;value=pow(value*valueSign,abs(power));value=valueSign>0. ? value : 1.-value;return value*(maxValue-minValue)+minValue;}_f rbp(_f minValue,_f maxValue,_f power){if(minValue==maxValue){return minValue;}_f value=hash12(_v2(_getUID(),ugenhash))*(maxValue-minValue)+minValue;return mapToPower(value,minValue,maxValue,power);}_v3 iqhash3(_v2 p){_v3 q=_v3(dot(p,_v2(127.1,311.7)),dot(p,_v2(269.5,183.3)),dot(p,_v2(419.2,371.9)));return fract(sin(q)*43758.5453);}_f iqnoise(in _v3 P,_f u,_f v){_v2 x=P.xy;_v2 p=floor(x);_v2 f=fract(x);_f k=1.0+63.0*pow(1.0-v,4.0);_f va=0.0;_f wt=0.0;for(int j=-2;j<=2;j++)for(int i=-2;i<=2;i++){_v2 g=_v2(_f(i),_f(j));_v3 o=iqhash3(p+g)*_v3(u,u,1.0);o=0.5+0.5*sin(P.z+6.2831*o);_v2 r=g-f+o.xy;_f d=dot(r,r);_f ww=pow(1.0-smoothstep(0.0,1.414,sqrt(d)),k);va+=o.z*ww;wt+=ww;}return va/wt;}_f fxrand(){return hash12(_v2(_getUID(),ugenhash));}_f _fxrandInc=0.;_f fxrandInc(){_fxrandInc+=.1;return hash12(_v2(_getUID()+_fxrandInc,ugenhash+_fxrandInc));}out _v3 vDebug;void main(){vUv=uv;_f id=_getUID();_f width=1000.0;_f height=1000.0;_f x=mod(id,width);_f y=floor(id/width);_v2 uvDataTexture=_v2((x+0.5)/width,(y+0.5)/height);vec4 dataMain=_t(tDataMain,uvDataTexture);vec4 dataMain2=dataMain.xyzw;dataMain2.x=mod(dataMain2.x+uOffset.x,1.);dataMain2.y=mod(dataMain2.y+uOffset.y,1.);_f mrgo=uMarg;dataMain2.x=(dataMain2.x*1.-.5)*(2.-mrgo*uScreenRatioV2.x);dataMain2.y=(dataMain2.y*1.-.5)*(2.-mrgo*uScreenRatioV2.y);_v2 uvFlow=dataMain2.xy*.5+.5;vec4 colorValue=_t(tPattern,dataMain2.xy);vec4 flow=_t(tFlow,uvFlow);_f valueFlow=(flow.r+flow.g)*0.5*uValueFlowAdjust;_f angleFlow=atan(flow.y,flow.x);_f rt=0.;_f canAdd=0.;_f rotationType=uRotType;\${rotation}_f segmentLength=uLengthM+rbp(0.,uLengthA,uLengthP);_f segmentTh=uThM+rbp(0.,uThA,uThP);_v3 posBase=_v3(0.);posBase.x+=side.x*(segmentLength/uResolution.x);posBase.y+=side.y*(segmentTh/uResolution.y)*(2.*1./uScreenRatio);_f sinRot=sin(rt);_f cosRot=cos(rt);_v3 p1=_v3(0.);p1.x=-1.*(segmentLength/uResolution.x);p1.x=0.;_f p1x=p1.x;_f p1y=p1.y;p1.x=cosRot*p1x-sinRot*p1y;p1.y=sinRot*p1x+cosRot*p1y;p1.y*=uScreenRatio;p1+=(dataMain2.xyz*.5+.5);_v3 p2=_v3(0.);p2.x=1.*(segmentLength/uResolution.x);_f p2x=p2.x;_f p2y=p2.y;p2.x=cosRot*p2x-sinRot*p2y;p2.y=sinRot*p2x+cosRot*p2y;p2.y*=uScreenRatio;p2+=(dataMain2.xyz*.5+.5);if(uDontUsePattern==true){isVisible=1.;isVisibles[3]=1.;}else{isVisibles[3]=cbv(p1,p2,_v3(1.,1.,1.));_f isVisibleSum=isVisibles[3];isVisible=isVisibleSum>0. ? 1. : 0.;}vec4 valueGrid=_t(tGrid,p1.xy);if(uSkipMask==false){isVisibles[3]*=valueGrid.r<uPercentGrid ? 0. : 1.;}_f posBasex=posBase.x;_f posBasey=posBase.y;posBase.x=cosRot*posBasex-sinRot*posBasey;posBase.y=sinRot*posBasex+cosRot*posBasey;posBase.y*=uScreenRatio;_v2 pUV=posBase.xy;pUV+=(dataMain2.xy*.5+.5);_f hue=rbp(-.03,.06,1.);_f saturation=rbp(-.05,.05,1.);_f luminosity=rbp(-.1,.1,1.);vAlpha=rbp(uAlpha.x,uAlpha.y,4.);vColor=_v3(hue,saturation,luminosity);vLineColor=uLineColor;posBase+=_v3(dataMain2.x,dataMain2.y,0.);_v4 pos=_v4(posBase,1.);vModColor1=vnoise(_v3((dataMain2.x)*uCaScale,(dataMain2.y)*uCaScale,0.))*uCaValue;vModColor2=vnoise(_v3((dataMain2.x)*uCaScale,(dataMain2.y)*uCaScale,0.))*uCaValue;_f percentModColor=snoise2d(_v2((dataMain2.x)*uCaScale2,(dataMain2.y)*uCaScale2));_f baseValue2=1.-uCaValue2;vModColor1*=(baseValue2+percentModColor*uCaValue2);vModColor2*=(baseValue2+percentModColor*uCaValue2);if(valueGrid.r<.9){_f rx=1.-mrgo*(.5-mrgo)*uScreenRatioV2.x;_f ry=1.-mrgo*(.5-mrgo)*uScreenRatioV2.y;pos.x=max(-rx,min(pos.x,rx));pos.y=max(-ry,min(pos.y,ry));}else{_f rx=1.-mrgo*.5*(.5-mrgo*.5)*uScreenRatioV2.x;_f ry=1.-mrgo*.5*(.5-mrgo*.5)*uScreenRatioV2.y;pos.x=max(-rx,min(pos.x,rx));pos.y=max(-ry,min(pos.y,ry));}gl_Position=pos;vUid=_getUID();}`,la=`#ifndef PI #define PI 3.141592653589793 #endif #injectUniforms _u _v3 uLineColor;_u bool uIsNormal;in _v2 vUv;in _v3 vColor;in _f isVisible;in _f isVisibles[4];in _f vUid;in _f vModColor1;in _f vModColor2;in _f vAlpha;in _f vBrush; #i_ rgb2hsl #i_ hsl2rgb #i_ cubic #i_ exponential layout(location=0)out vec4 outColor0;_v3 applyMod(_v3 color,_v3 mod){_f hue=color.r+mod.r;_f sat=color.g+mod.g;_f lum=color.b+mod.b;color=hsl2rgb(hue,sat,lum);return color;}in _v3 vDebug;in _v3 vLineColor;void main(){if(vUid>uCountLines){discard;}_v3 color=rgb2hsl(vLineColor);_f hue=color.r+vColor.r;_f sat=color.g+vColor.g-vModColor1*.2+uCaSat*exponentialOut(vUv.y);_f lum=color.b+vColor.b-vModColor2*.4-uCaLum*cubicIn(vUv.y);color=hsl2rgb(hue,sat,lum);_f a=1.;outColor0=vec4(color,vAlpha)*isVisibles[3];if(uDontUsePattern==true){outColor0=vec4(color,vAlpha);}outColor0.a*=a;}`;const Qe={0:` rt = fxrandInc() * M_PI * 2.; canAdd = 1.; `,1:` if( fxrandInc() < .75 ) { rt = fxrandInc() * M_PI * 2.; canAdd = 1.; } else { if( fxrandInc() < .5 ) { rt = 0.; } else { rt = M_PI * .5; } } `,2:` if( fxrandInc() < .3 ) { rt = fxrandInc() * M_PI * 2.; canAdd = 1.; } else { if( fxrandInc() < .5 ) { rt = 0.; } else { rt = M_PI * .5; } } `,3:` rt = vnoise( vec3( ( dataMain.x + ugenhash * .001 ) * uRotNoise.x, ( dataMain.y + ugenhash * .001 ) * uRotNoise.y, 0. ) ); rt *= M_PI * 2.; rt += mix( angleFlow * uAngleFlowBoost, fxrandInc() * M_PI * 2., valueFlow * .1 ); `,4:` if( fxrandInc() < .675 ) { rt = iqnoise( vec3( ( dataMain.x + ugenhash * .001 ) * uRotNoise.x, ( dataMain.y + ugenhash * .001 ) * uRotNoise.y, 0. ), .2, .0 ) * M_PI * 2.; } else { if( fxrandInc() < .5 ) { rt = 0.; } else { rt = M_PI * .5; } } `,6:` rt = mix( angleFlow * uAngleFlowBoost, fxrandInc() * M_PI * 2., valueFlow * .1 ); rt += mix( angleFlow * uAngleFlowBoost, fxrandInc() * M_PI * 2., valueFlow * .1 ); `,7:` vec2 treesOrientations = texture( tTreesOrientation, uvFlow ).rg; treesOrientations.rg -= .5; rt = atan( treesOrientations.y, treesOrientations.x ); rt += mix( angleFlow * uAngleFlowBoost * .1, fxrandInc() * M_PI * 2., valueFlow * .1 ); `,8:` vec2 treesOrientations = texture( tTreesOrientation, uvFlow ).rg; treesOrientations.rg -= .5; rt = atan( treesOrientations.y, treesOrientations.x ) + M_PI * .5; rt += mix( angleFlow * uAngleFlowBoost, fxrandInc() * M_PI * 2., valueFlow * .1 ); `},et=new E(1,1,1);class ha extends j{constructor(e={},t=!1){super(1),this._skipMask=t;const s=1e3;this._texData=new ia(s,s),e.tDataMain=this._texData.textureMain,this._programLinker=new Bt,this._programLinker.init({uniforms:{ugenhash:{value:0},sizePlanes:{value:10}},vs:oa,fs:la,textures:e,dataFroms:c.vegeLinesData});const i=this.u;i.uLineColor={value:et},i.uOffset={value:new F(0,0)},i.uPercentGrid={value:1},i.uSkipMask={value:!1},i.uIsNormal={value:!0},i.uIsFlower={value:!1},i.tBrushes={value:a.textureBrushes},i.tColor={value:a.textureBrushes},i.hasToCheckColor={value:!1},i.uIDAdd={value:0},i.uMarg={value:a.isPrint?.017:0},this._programs={};for(const n in Qe){const l=Qe[n],o=this._programLinker.vs.replace("${rotation}",l);this._programs[n]=new ae(a.gl,{vertex:o,fragment:this._programLinker.fs,uniforms:this._programLinker.uniforms,transparent:!0,cullFace:a.gl.FRONT,depthWrite:!1})}this._program=this._programs[0]||new ae(a.gl,{vertex:this._programLinker.vs,fragment:this._programLinker.fs,uniforms:this._programLinker.uniforms,transparent:!0,cullFace:a.gl.FRONT,depthWrite:!1}),this._mesh=new na(this._texData,this._program),this.addChild(this._mesh),this._hasLineBeenGenerated=!1}async generate(){if(!this._hasLineBeenGenerated){let e=0;const t=this._mesh.lines;for(const s of t)s.x=a.rand(),s.y=a.rand(),s.z=a.rand(),s.w=a.rand(),e++,e%25e3===0&&await P();this._hasLineBeenGenerated=!0}this._mesh.generate()}render({hasToClear:e=!0,hasToUpdateUniforms:t=!0}={}){e||(a.gl.renderer.autoClear=!1,a.gl.clearColor(0,0,0,0));const s=this._programs[this.u.uRotType.value]||this._program;this._mesh.program=s,super.render({hasToClear:e,hasToUpdateUniforms:t})}clear(){a.gl.clearColor(a.bgColor.r,a.bgColor.g,a.bgColor.b,0),a.gl.renderer.autoClear=!0,this._render(this,this._renderTarget,!0),a.gl.renderer.autoClear=!1}prepare({uDontUsePattern:e=!1,uRotType:t=0,uLengthA:s=100,uCountLines:i=1e6,uLineColor:n=et,uAlpha:l=null,uOffset:o=new F(0,0)}){const h=this.u;l&&(h.uAlpha.value.x=l.min,h.uAlpha.value.y=l.max),h.uLengthA.value=s,h.uRotType.value=t,h.uCountLines.value=i,h.uDontUsePattern.value=e,h.uLineColor.value=n,h.uOffset.value=o}updateForTrees(e,t=!0,s=!1){const i=this.u;i.tPattern.value=i.tTrees.value,i.uDontUsePattern.value=!1,i.uLengthM.value=c.treesData.lengthM+(s?20:-10),i.uLengthA.value=c.treesData.lengthA,i.uLengthP.value=c.treesData.lengthP,i.uThM.value=c.treesData.thM+(s?.1:-.1),i.uThA.value=c.treesData.thA,i.uThP.value=c.treesData.thP,i.uRotType.value=7,i.uAlpha.value.x=c.treesData.alpha,i.uAlpha.value.y=c.treesData.alpha+.01,i.ugenhash.value=a.seed+1234,i.uLineColor.value=new E(c.treesData.color),i.uCountLines.value=c.treesData.countLines,i.uSkipMask.value=t,i.uPercentGrid.value=e,i.uIsFlower.value=!1}updateForFlowers(e,t,s=null,i=!0){const n=this.u,l=c.treesData.flowers;n.tPattern.value=n.tTrees.value,n.uDontUsePattern.value=!1,n.uLengthM.value=l.lengthM,n.uLengthA.value=l.lengthA,n.uLengthP.value=l.lengthP,n.uThM.value=l.thM,n.uThA.value=l.thA,n.uThP.value=l.thP,n.uRotType.value=8,n.uAlpha.value.x=l.alpha,n.uAlpha.value.y=l.alpha+.01,n.ugenhash.value=a.seed+1234,n.uLineColor.value=new E(s||l.color),n.uCountLines.value=l.countLines,n.uAngleFlowBoost.value=l.angleFlowBoost,i?(n.uSkipMa