0x18b75119…b783sent to0x381233d5…7acd·#19,667,766·view on Etherscan
[0 ,()=>{console.log("Artist 57. Spongenuity -- platform 0 ");function e(e,t,n){const r=window.innerWidth/t,a=window.innerHeight/n,i=Math.min(r,a);e.style.width=`${t*i}px`,e.style.height=`${n*i}px`}function t(e){if(null==(E=v.getContext("webgl",e))){if(null==(E=v.getContext("experimental-webgl",e))){return setError("Your browser or device does not seem to support WebGL."),!1}setError("Your browser or device only supports experimental WebGL.\n The simulation may not run as expected.")}return E.disable(E.CULL_FACE),E.disable(E.DEPTH_TEST),E.disable(E.BLEND),E.clearColor(1,1,1,1),!0}function n(){const e=E.canvas;1620===e.width&&2880===e.height||(e.width=1620,e.height=2880)}function r(e,t,n){Array.isArray(n)?e.uniform1fv(t,n):e.uniform1f(t,n)}function a(e,t,n){e.uniform2fv(t,n)}function i(e,t,n){e.uniform4fv(t,n)}function s(e,t,n,r){e.uniform1i(t,n),e.activeTexture(e["TEXTURE"+n]),e.bindTexture(e.TEXTURE_2D,r)}function u(e,t,n){e.uniform1i(t,+n)}function o({vertexSource:e,fragmentSource:t,injected:n},r){const a=e?e.replace(/#INJECT\(([^)]*)\)/gm,(e,t)=>n[t]||e):null,i=t?t.replace(/#INJECT\(([^)]*)\)/gm,(e,t)=>n[t]||e):null;let s=null;a&&i&&(s=new A(E,a,i)),r(s)}function l(e){Object.keys(_),_[e]=!1}function d(e){delete _[e],Object.keys(_)}function c(){try{return new ImageData(new Uint8ClampedArray([0,0,0,0]),1,1)}catch(e){const t=document.createElement("canvas").getContext("2d").createImageData(1,1);for(let e=0;e<t.data.length;e++){t.data[e]=0}return t}}function h(e,t,n){return.21*e+.72*t+.07*n}function f(e){const t=Math.min(1,G/Math.max(e.width,e.height)),n=Math.ceil(t*e.width),r=Math.ceil(t*e.height);O.width=n,O.height=r,V.drawImage(e,0,0,n,r);const a=V.getImageData(0,0,O.width,O.height),i=new Uint8ClampedArray(a.data);let s=0;for(let e=a.height-1;e>=0;e--){for(let t=0;t<a.width;t++){const n=i[4*(t+e*a.width)],r=i[4*(t+e*a.width)+1],u=i[4*(t+e*a.width)+2],o=h(n,r,u);a.data[s++]=n,a.data[s++]=r,a.data[s++]=u,a.data[s++]=o}}return a}function m(){return null===Y&&(Y=new X(z)),Y}function p(){if(!t({alpha:!1,antialias:!1,depth:!1,stencil:!1,preserveDrawingBuffer:!1})){return}E.clearColor(1,1,1,1),E.disable(E.CULL_FACE),E.disable(E.BLEND),E.disable(E.DEPTH_TEST),E.disable(E.STENCIL_TEST);let e=!0;M.push(()=>{e=!0});let r=!0;y.push(()=>{r=!0});let a=!1;U.push(()=>{a=!0});const i=new W;!function t(){a&&(i.drawToCanvas(),download(v),a=!1),e&&(n(!1),i.resize(v.width,v.height),e=!1),r&&(i.reset(),r=!1),i.update(),i.drawToCanvas(),requestAnimationFrame(t)}()}const T={enDe16:"\n float de16(vec2 v) {\n return dot(v, vec2(255.0 / 256.0, 1.0 / 256.0));\n }\n vec2 en16(float f) {\n f = 255.99 * clamp(f, 0.0, 1.0);\n return vec2(floor(f) / 255.0, fract(f));\n }\n ",samT:"\n vec2 de(vec4 encoded) {\n return vec2(de16(encoded.rg), de16(encoded.ba));\n }\n vec4 en(vec2 decoded) {\n return vec4(en16(decoded.x), en16(decoded.y));\n }\n float samT(sampler2D texture, vec2 position) {\n vec4 sTex = texture2D(texture, position);\n return de(sTex).y;\n }\n "},g={disVert:"\n uniform vec2 s;\n uniform float z;\n attribute vec2 co;\n varying vec2 vS;\n void main(void) {\n gl_Position = vec4(co * s * z, 0, 1);\n vS = 0.5 + 0.5 * co;\n }\n ",disColFrag:`\n precision mediump float;\n uniform sampler2D uR, uG, uB;\n varying vec2 vS; \n ${T.enDe16}\n ${T.samT}\n \n void main() {\n float red = samT(uR, vS);\n float green = samT(uG, vS);\n float blue = samT(uB, vS);\n \n float edge0 = 0.21; // Lower limit\n float edge1 = 0.26; // Upper limit \n\n if(#INJECT(uInvert) == 1.0) {\n gl_FragColor = vec4(1.0 - step(edge0, vec3(red, green, blue)), 1);\n } else {\n gl_FragColor = vec4(step(edge0, vec3(red, green, blue)), 1);\n }\n }\n \n `,upVert:"\n attribute vec2 co; // in {-1,+1}^2\n \n varying vec2 vS; // in [0,1]^2 \n void main(void) {\n gl_Position = vec4(co, 0, 1);\n vS = 0.5 + 0.5 * co;\n }\n ",resFrag:` \n \n precision mediump float;\n uniform vec2 uPat;\n \n varying vec2 vS; // in [0,1]^2\n ${T.enDe16}\n ${T.samT}\n void main() {\n \n float margin = 100.0; // 50px margin\n float width = 1620.0;\n float height = 2880.0;\n \n \n float RezX = width - (margin * 2.0);\n float RezY = height - (margin * 2.0);\n float offsetX = margin / width;\n float offsetY = margin / height;\n \n int numberOfDots = #INJECT(PATTERN_SPLIT);\n int uNumDots = (numberOfDots)*2;\n \n \n float aspectRatio = RezX / RezY;\n \n // Dot parameters\n \n float dotRadius = 0.0075; // Radius of dots\n \n // Column parameters\n const int numberOfColumns = 1;\n float columnSpacing = 1.0 / float(numberOfColumns + 1); // Spacing between columns\n \n float dotSpacing = (1.0 - offsetY * 2.0) / (float(uNumDots)-0.005);// Adjust for margin\n \n \n // Calculate vertical position in repeating pattern\n float modY = mod(vS.y * aspectRatio, dotSpacing);\n float isInsideDotVertically = step(modY, dotRadius) + step(dotSpacing - dotRadius, modY);\n \n float starter = 0.0; // Initialize starter as not inside any dot\n\n float adjustedY = vS.y;\n if(adjustedY + dotSpacing > 1.0) { // Adjust last dot\n adjustedY -= dotSpacing * 2.; // Example adjustment, tweak as necessary\n }\n if(adjustedY < dotSpacing) { // Adjust first dot\n adjustedY += dotSpacing * 0.1; // Example adjustment, tweak as necessary\n }\n \n // Loop through columns to check if inside a dot\n for(int i = 1; i <= numberOfColumns; ++i) {\n float columnX = float(i) * columnSpacing; // X position of current column\n float distanceFromColumnX = abs(vS.x - columnX);\n float isInsideDotHorizontally = step(distanceFromColumnX, dotRadius);\n starter += isInsideDotVertically * isInsideDotHorizontally; // Accumulate if inside a dot\n }\n \n // Ensure starter is either 0.0 or 1.0\n starter = step(1.0, starter);\n \n const float A = 1.0;\n float B = dot(uPat, vec2(starter, 0));\n vec2 values = vec2(A, B);\n \n gl_FragColor = en(values);\n }\n \n `,imageMapFrag:`\n precision mediump float;\n \n uniform sampler2D uPI;\n uniform vec2 uTex;\n \n varying vec2 vS; // in [0,1]^2\n ${T.enDe16}\n ${T.samT}\n vec2 kernel(vec2 decodedCenter) {\n return\n de(texture2D(uPI, vS + vec2(-1, -1) * uTex)) * 0.05 +\n de(texture2D(uPI, vS + vec2(+0, -1) * uTex)) * 0.20 +\n de(texture2D(uPI, vS + vec2(+1, -1) * uTex)) * 0.05 +\n \n de(texture2D(uPI, vS + vec2(-1, +0) * uTex)) * 0.20 -\n decodedCenter +\n de(texture2D(uPI, vS + vec2(+1, +0) * uTex)) * 0.20 +\n \n de(texture2D(uPI, vS + vec2(-1, +1) * uTex)) * 0.05 +\n de(texture2D(uPI, vS + vec2(+0, +1) * uTex)) * 0.20 +\n de(texture2D(uPI, vS + vec2(+1, +1) * uTex)) * 0.05;\n }\n \n vec4 computeNewValue(const float feedA, const float killB, const float diffA, const float diffB) {\n vec2 values = de(texture2D(uPI, vS));\n vec2 laplace = kernel(values);\n \n \n float A = values.x;\n float B = values.y;\n float reaction = A * B * B;\n const float dt = 1.0;\n values = vec2(\n values.x + dt * (diffA * laplace.x - reaction + feedA * (1.0 - A)),\n values.y + dt * (diffB * laplace.y + reaction - (killB + feedA) * B)\n );\n \n return en(values);\n }\n uniform sampler2D uImageMapTexture;\n uniform vec4 uSampledChannel;\n uniform float uDiffuseScaling;\n \n void main() {\n float mapValue = dot(uSampledChannel, texture2D(uImageMapTexture, vS));\n mapValue = sqrt(clamp(mapValue - 0.1, 0.0, 1.0));\n \n float feedA = mix(0.02220, 0.04470, mapValue);\n float killB = mix(0.06516, 0.05789, mapValue);\n float diffA = 0.210;\n float diffB = 0.105;\n \n gl_FragColor = computeNewValue(feedA, killB, uDiffuseScaling * diffA, uDiffuseScaling * diffB);\n }`,updateMapFrag:`\n precision mediump float;\n \n uniform sampler2D uPI;\n uniform vec2 uTex;\n \n varying vec2 vS; // in [0,1]^2\n ${T.enDe16}\n ${T.samT}\n vec2 kernel(vec2 decodedCenter) {\n return\n de(texture2D(uPI, vS + vec2(-1, -1) * uTex)) * 0.05 +\n de(texture2D(uPI, vS + vec2(+0, -1) * uTex)) * 0.20 +\n de(texture2D(uPI, vS + vec2(+1, -1) * uTex)) * 0.05 +\n \n de(texture2D(uPI, vS + vec2(-1, +0) * uTex)) * 0.20 -\n decodedCenter +\n de(texture2D(uPI, vS + vec2(+1, +0) * uTex)) * 0.20 +\n \n de(texture2D(uPI, vS + vec2(-1, +1) * uTex)) * 0.05 +\n de(texture2D(uPI, vS + vec2(+0, +1) * uTex)) * 0.20 +\n de(texture2D(uPI, vS + vec2(+1, +1) * uTex)) * 0.05;\n }\n \n vec4 computeNewValue(const float feedA, const float killB, const float diffA, const float diffB) {\n vec2 values = de(texture2D(uPI, vS));\n vec2 laplace = kernel(values);\n \n \n float A = values.x;\n float B = values.y;\n float reaction = A * B * B;\n const float dt = 1.0;\n values = vec2(\n values.x + dt * (diffA * laplace.x - reaction + feedA * (1.0 - A)),\n values.y + dt * (diffB * laplace.y + reaction - (killB + feedA) * B)\n );\n \n return en(values);\n }\n uniform vec2 uRates;\n \n void main() {\n float feedA = mix(#INJECT(FEED_MIN), #INJECT(FEED_MAX), vS.y);\n float killB = mix(#INJECT(KILL_MIN), #INJECT(KILL_MAX), vS.x);\n \n gl_FragColor = computeNewValue(feedA, killB, uRates.x, uRates.y);\n }`};let v=document.createElement("canvas");document.documentElement.appendChild(v),e(v,1620,2880);let E=null;class x{constructor(e){this._gl=e}gl(){return this._gl}}const S={35664:{str:"FLOAT_VEC2",binder:a},35666:{str:"FLOAT_VEC4",binder:i},35670:{str:"BOOL",binder:u},35678:{str:"SAMPLER_2D",binder:s},5126:{str:"FLOAT",binder:r}};class A extends x{constructor(e,t,n){function r(t,n){const r=e.createShader(t);return e.shaderSource(r,n),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS)?r:(e.deleteShader(r),null)}super(e),this.id=null,this.uCount=0,this.aCount=0;const a=r(e.VERTEX_SHADER,t),i=r(e.FRAGMENT_SHADER,n),s=e.createProgram();e.attachShader(s,a),e.attachShader(s,i),e.linkProgram(s),e.getProgramParameter(s,e.LINK_STATUS)?(this.id=s,this.introspection()):e.deleteProgram(s)}freeGLResources(){super.gl().deleteProgram(this.id),this.id=null}use(){super.gl().useProgram(this.id)}bindUniforms(){const e=super.gl();let t=0;Object.keys(this.u).forEach(n=>{const r=this.u[n];null!==r.value&&(35678===r.type||35680===r.type?(S[r.type].binder(e,r.loc,t,r.value),t++):S[r.type].binder(e,r.loc,r.value))})}bindAttributes(){Object.keys(this.a).forEach(e=>{const t=this.a[e];null!==t.VBO&&t.VBO.bind(t.loc)})}bindUniformsAndAttributes(){this.bindUniforms(),this.bindAttributes()}introspection(){const e=super.gl();this.uCount=e.getProgramParameter(this.id,e.ACTIVE_UNIFORMS),this.u={};for(let t=0;t<this.uCount;t++){const n=e.getActiveUniform(this.id,t),r=n.name;this.u[r]={loc:e.getUniformLocation(this.id,r),size:n.size,type:n.type,value:null}}this.aCount=e.getProgramParameter(this.id,e.ACTIVE_ATTRIBUTES),this.a={};for(let t=0;t<this.aCount;t++){const n=e.getActiveAttrib(this.id,t),r=n.name;this.a[r]={VBO:null,loc:e.getAttribLocation(this.id,r),size:n.size,type:n.type}}}}class I extends x{static createQuad(e,t,n,r,a){return new I(e,new Float32Array([t,n,r,n,t,a,r,a]),2,e.FLOAT,!0)}constructor(e,t,n,r,a=!0){super(e),this.id=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,this.id),e.bufferData(e.ARRAY_BUFFER,t,e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,null),this.size=n,this.type=r,this.normalize=!1,this.stride=0,this.offset=0}freeGLResources(){this.gl().deleteBuffer(this.id),this.id=null}bind(e){const t=super.gl();t.enableVertexAttribArray(e),t.bindBuffer(t.ARRAY_BUFFER,this.id),t.vertexAttribPointer(e,this.size,this.type,this.normalize,this.stride,this.offset)}setData(e){const t=super.gl();t.bindBuffer(t.ARRAY_BUFFER,this.id),this.usage===Usage.STATIC?t.bufferData(t.ARRAY_BUFFER,e,t.STATIC_DRAW):t.bufferData(t.ARRAY_BUFFER,e,t.DYNAMIC_DRAW),t.bindBuffer(t.ARRAY_BUFFER,null)}}const _={},b=new URLSearchParams(window.location.search),D=R.random_choice([7,9,11]),F=R.random_choice([0,1]),w=R.random_choice([0,1]),C={randomPatternScale:4,zoom:b.has("z")?parseFloat(b.get("z")):1,interface:"image",initState:"starter",maxResolution:1024,invert:F,speed:60,patternSplit:D,chaos:w};document.body.style.backgroundColor=1===C.invert?"white":"black";const P=[],U=[],M=[],y=[];createGenerativeImage=(()=>{function e(e,t){for(let n=e.length-1;n>0;n--){let r=Math.floor(t()*(n+1));[e[n],e[r]]=[e[r],e[n]]}return e}function t(e,t,n,r,i,s){let u=a.createLinearGradient(e,t,e,t+r);u.addColorStop(0,i),u.addColorStop(1,s),a.fillStyle=u,a.fillRect(e,t,n,r)}let n=C.patternSplit;const r=document.createElement("canvas"),a=r.getContext("2d");let i;r.width=1080,r.height=1920;let s=(i=1===C.invert?R.random_choice([["#673ab7","#ce4257","#ff5400","#ffbd00","#ffffff"],["#182923","#cfb991","#ffffff","#4488ac"],["#e91e63","#ff8198","#4bd3e5","#ffd919","#ff4f19","#ffffff"],["#b42c1a","#0026e6","#00b0e6","#0f9d58","#4285f4","#ffffff"],["#b42c1a","#0026e6","#00b0e6","#ffffff"]]):R.random_choice([["#cfb991","#1a6aff","#0f9d6d","#b22f1e","#459737","#ffffff"],["#16e19c","#007e67","#b42c1a","#0026e6","#00b0e6","#ffffff"],["#00fbcd","#1a6aff","#0026e6","#16e19c","#007e67","#ffffff"],["#c6ff66","#61ffa6","#ff5400","#00abff","#0042ff","#000000"],["#333428","#cfb991","#ffffff","#4488ac"]])).map(function(e){const t=e.slice(1);return"#"+((1<<24)+(255-parseInt(t.substring(0,2),16)<<16)+(255-parseInt(t.substring(2,4),16)<<8)+(255-parseInt(t.substring(4,6),16))).toString(16).slice(1)});e(s,R.random_dec);let u=980/n,o=910;for(let n=50;n<1030;n+=u){let r=s.slice();1===C.chaos&&e(r,R.random_dec);for(let e=50;e<1870;e+=o){r.unshift(r.pop()),t(n,e,u,o,r[1],r[0])}n<540-u?o/=2:o*=2}return r});const L=createGenerativeImage(),B=new Image;B.onload=(()=>{for(const e of P){e(B)}}),B.src=L.toDataURL();const N=c();class X{constructor(e){this._width=-1,this._height=-1,this.id=E.createTexture(),this.uploadToGPU(null!=e?e:N)}loadFromUrl(e){l(e=`${e}?v=${version}`);const t=new Image;t.addEventListener("load",()=>{d(e),this.uploadToGPU(t)}),t.src=e}uploadToGPU(e){this._width=e.width,this._height=e.height,E.bindTexture(E.TEXTURE_2D,this.id),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_WRAP_S,E.CLAMP_TO_EDGE),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_WRAP_T,E.CLAMP_TO_EDGE),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_MIN_FILTER,E.LINEAR),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_MAG_FILTER,E.LINEAR),E.texImage2D(E.TEXTURE_2D,0,E.RGBA,E.RGBA,E.UNSIGNED_BYTE,e),E.bindTexture(E.TEXTURE_2D,null)}get width(){return this._width}get height(){return this._height}}const G=C.maxResolution,O=document.createElement("canvas"),V=O.getContext("2d");let z,Y=null;P.push(e=>{z=f(e),null!==Y&&Y.uploadToGPU(z)});class k{constructor(){this.texture=E.createTexture(),this.framebuffer=E.createFramebuffer(),this._width=-1,this._height=-1}reserveSpace(e,t){if(e=Math.ceil(e),t=Math.ceil(t),this.width!==e||this.height!==t){E.bindTexture(E.TEXTURE_2D,this.texture);const n=E.RGBA;E.texImage2D(E.TEXTURE_2D,0,n,e,t,0,n,E.UNSIGNED_BYTE,null),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_MAG_FILTER,E.LINEAR),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_MIN_FILTER,E.LINEAR),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_WRAP_S,E.CLAMP_TO_EDGE),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_WRAP_T,E.CLAMP_TO_EDGE),E.bindFramebuffer(E.FRAMEBUFFER,this.framebuffer),E.framebufferTexture2D(E.FRAMEBUFFER,E.COLOR_ATTACHMENT0,E.TEXTURE_2D,this.texture,0),E.bindFramebuffer(E.FRAMEBUFFER,null),E.bindTexture(E.TEXTURE_2D,null),this._width=e,this._height=t}}get width(){return this._width}get height(){return this._height}}class j{constructor(){this.previousTexture=new k,this.currentTexture=new k}get previous(){return this.previousTexture.texture}get current(){return this.currentTexture.texture}get currentFramebuffer(){return this.currentTexture.framebuffer}get width(){return this.previousTexture.width}get height(){return this.previousTexture.height}reserveSpace(e,t){this.previousTexture.reserveSpace(e,t),this.currentTexture.reserveSpace(e,t)}swap(){const e=this.currentTexture;this.currentTexture=this.previousTexture,this.previousTexture=e}}class W{constructor(){this.lastUpdateTimestamp=0,this.targetWidth=1,this.targetHeight=1,this.squareVBO=I.createQuad(E,-1,-1,1,1),this.internalTextures=[new j,new j,new j],this.needToReset=!0,this.lastIterationUpdate=performance.now()-5e3,this.iteration=0,this.asyncLoadShader("display-tricolor",g.disVert,g.disColFrag,e=>{this.displayTricolorShader=e},{uInvert:W.uInvert.toFixed(1)}),this.asyncLoadShader("update-map",g.upVert,g.updateMapFrag,e=>{this.updateMapShader=e},{FEED_MIN:W.FEED_MIN.toFixed(5),FEED_MAX:W.FEED_MAX.toFixed(5),KILL_MIN:W.KILL_MIN.toFixed(5),KILL_MAX:W.KILL_MAX.toFixed(5)}),this.asyncLoadShader("update-image",g.upVert,g.imageMapFrag,e=>{this.updateImageMapShader=e}),this.asyncLoadShader("reset",g.upVert,g.resFrag,e=>{this.resetShader=e},{PATTERN_SPLIT:`int(${C.patternSplit})`})}resize(e,t){this.targetWidth=e,this.targetHeight=t}reset(){this.needToReset=!0}drawToCanvas(){let e;E.viewport(0,0,this.targetWidth,this.targetHeight),this.displayTricolorShader&&(this.displayTricolorShader.u.uR.value=this.internalTextures[0].current,this.displayTricolorShader.u.uG.value=this.internalTextures[1].current,this.displayTricolorShader.u.uB.value=this.internalTextures[2].current,e=this.displayTricolorShader),e&&(e.u.s.value=[this.internalTextures[0].width/this.internalTextures[0].height/(this.targetWidth/this.targetHeight),1],e.u.z.value=C.zoom,E.bindFramebuffer(E.FRAMEBUFFER,null),e.use(),e.bindUniformsAndAttributes(),E.drawArrays(E.TRIANGLE_STRIP,0,4))}update(){if(this.adjustInternalTextureSize()&&(this.needToReset=!0),E.viewport(0,0,this.internalTextures[0].width,this.internalTextures[0].height),this.needToReset){if(this.iteration=0,!this.clearInternalTextures()){return}this.needToReset=!1}const e=this.computeNbIterationsForThisFrame();if(!(e<=0)){if("image"===C.interface){if(this.updateImageMapShader){const t=m();this.updateImageMapShader.u.uImageMapTexture.value=t.id,this.updateImageMapShader.u.uDiffuseScaling.value=C.randomPatternScale,this.updateImageMapShader.u.uTex.value=[1/this.internalTextures[0].width,1/this.internalTextures[0].height],this.updateImageMapShader.use(),this.updateImageMapShader.bindAttributes();const n=Math.ceil(e/3);this.updateImageMapShader.u.uSampledChannel.value=[1,0,0,0],this.updateInternal(this.updateImageMapShader,n,this.internalTextures[0]),this.updateImageMapShader.u.uSampledChannel.value=[0,1,0,0],this.updateInternal(this.updateImageMapShader,n,this.internalTextures[1]),this.updateImageMapShader.u.uSampledChannel.value=[0,0,1,0],this.updateInternal(this.updateImageMapShader,n,this.internalTextures[2])}}else{let t;t&&(t.use(),t.bindAttributes(),t.u.uTex.value=[1/this.internalTextures[0].width,1/this.internalTextures[0].height],this.updateInternal(t,e,this.internalTextures[0]))}}}updateInternal(e,t,n){for(let r=t;r>0;r--){n.swap(),E.bindFramebuffer(E.FRAMEBUFFER,n.currentFramebuffer),e.u.uPI.value=n.previous,e.bindUniforms(),E.drawArrays(E.TRIANGLE_STRIP,0,4)}this.iteration=this._iteration+t}clearInternalTextures(){if(this.resetShader){this.resetShader.u.uPat.value=["starter"===C.initState,0],this.resetShader.use(),this.resetShader.bindUniformsAndAttributes();for(const e of this.internalTextures){E.bindFramebuffer(E.FRAMEBUFFER,e.currentFramebuffer),E.drawArrays(E.TRIANGLE_STRIP,0,4)}return!0}return!1}adjustInternalTextureSize(){let e=this.targetWidth,t=this.targetHeight;if("image"===C.interface){const n=this.targetWidth/this.targetHeight,r=m().width/m().height;n>r?e=Math.ceil(r/n*this.targetWidth):n<r&&(t=Math.ceil(n/r*this.targetHeight))}if(this.internalTextures[0].width!==e||this.internalTextures[0].height!==t){for(const n of this.internalTextures){n.reserveSpace(e,t)}return!0}return!1}set iteration(e){this._iteration=e;const t=performance.now();t-this.lastIterationUpdate>200&&(this.lastIterationUpdate=t)}computeNbIterationsForThisFrame(){const e=C.speed,t=performance.now(),n=1e3/(.1+t-this.lastUpdateTimestamp);return this.lastUpdateTimestamp=t,n>60?Math.ceil(60/n*e):n<10?Math.ceil(n/10*e):e}asyncLoadShader(e,t,n,r,a={}){const i=`shader-${e}`;l(i),o({fragmentSource:n,vertexSource:t,injected:a},e=>{d(i),null!==e&&(e.a.co.VBO=this.squareVBO,r(e))})}}W.FEED_MIN=.01,W.FEED_MAX=.1,W.KILL_MIN=.045,W.KILL_MAX=.07,W.uInvert=C.invert,p();
}],