memoscan
← all memos

Memo 0x4ab992a4…f3baea on Ethereum

urn}this.onResizeWithoutDelay()}update=()=>{let s=Date.now(),t=s-this.lastTime;this.lastTime=s,requestAnimationFrame(this.update),!(this.skipActivated&&t>this.skipLimit||this.pause)&&this.onUpdate.dispatch(t)}},B=new B0;var E0={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:` varying vec2 vUv; void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); }`,fragmentShader:` uniform float opacity; uniform sampler2D tDiffuse; varying vec2 vUv; void main() { vec4 texel = texture2D( tDiffuse, vUv ); gl_FragColor = opacity * texel; }`};var E=class{constructor(){this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}},gt=new THREE.OrthographicCamera(-1,1,1,-1,0,1),k0=new THREE.BufferGeometry;k0.setAttribute("position",new THREE.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3));k0.setAttribute("uv",new THREE.Float32BufferAttribute([0,2,0,0,2,0],2));var v0=class{constructor(s){this._mesh=new THREE.Mesh(k0,s)}dispose(){this._mesh.geometry.dispose()}render(s){s.render(this._mesh,gt)}get material(){return this._mesh.material}set material(s){this._mesh.material=s}};var G=class extends E{constructor(s,t){super(),this.textureID=t!==void 0?t:"tDiffuse",s instanceof THREE.ShaderMaterial?(this.uniforms=s.uniforms,this.material=s):s&&(this.uniforms=THREE.UniformsUtils.clone(s.uniforms),this.material=new THREE.ShaderMaterial({defines:Object.assign({},s.defines),uniforms:this.uniforms,vertexShader:s.vertexShader,fragmentShader:s.fragmentShader})),this.fsQuad=new v0(this.material)}render(s,t,e){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=e.texture),this.fsQuad.material=this.material,this.renderToScreen?(s.setRenderTarget(null),this.fsQuad.render(s)):(s.setRenderTarget(t),this.clear&&s.clear(s.autoClearColor,s.autoClearDepth,s.autoClearStencil),this.fsQuad.render(s))}};var b0=class{constructor(s,t){this.renderer=s;let e={minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat},a=s.getSize(new THREE.Vector2);this._pixelRatio=s.getPixelRatio(),this._width=a.width,this._height=a.height,t=new THREE.WebGLRenderTarget(this._width*this._pixelRatio,this._height*this._pixelRatio,e),t.texture.name="EffectComposer.rt1",this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],E0===void 0&&console.error("THREE.EffectComposer relies on CopyShader"),G===void 0&&console.error("THREE.EffectComposer relies on ShaderPass"),this.copyPass=new G(E0),this.clock=new THREE.Clock}swapBuffers(){let s=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=s}addPass(s){this.passes.push(s),s.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(s,t){this.passes.splice(t,0,s),s.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(s){let t=this.passes.indexOf(s);t!==-1&&this.passes.splice(t,1)}isLastEnabledPass(s){for(let t=s+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}render(s){s===void 0&&(s=this.clock.getDelta());let t=this.renderer.getRenderTarget(),e=!1;for(let a=0,l=this.passes.length;a<l;a++){let i=this.passes[a];i.enabled!==!1&&(i.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(a),i.render(this.renderer,this.writeBuffer,this.readBuffer,s,e),i.needsSwap&&this.swapBuffers())}this.renderer.setRenderTarget(t)}setSize(s,t){this._width=s,this._height=t;let e=this._width*this._pixelRatio,a=this._height*this._pixelRatio;this.renderTarget1.setSize(e,a),this.renderTarget2.setSize(e,a);for(let l=0;l<this.passes.length;l++)this.passes[l].setSize(e,a)}setPixelRatio(s){this._pixelRatio=s,this.setSize(this._width,this._height)}};var _0=class extends E{constructor(s,t,e,a,l){super(),this.scene=s,this.camera=t,this.overrideMaterial=e,this.clearColor=a,this.clearAlpha=l!==void 0?l:0,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this._oldClearColor=new THREE.Color}render(s,t,e){let a=s.autoClear;s.autoClear=!1;let l,i;this.overrideMaterial!==void 0&&(i=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor&&(s.getClearColor(this._oldClearColor),l=s.getClearAlpha(),s.setClearColor(this.clearColor,this.clearAlpha)),this.clearDepth&&s.clearDepth(),s.setRenderTarget(this.renderToScreen?null:e),this.clear&&s.clear(s.autoClearColor,s.autoClearDepth,s.autoClearStencil),s.render(this.scene,this.camera),this.clearColor&&s.setClearColor(this._oldClearColor,l),this.overrideMaterial!==void 0&&(this.scene.overrideMaterial=i),s.autoClear=a}};var K0=`precision highp float;uniform vec2 uArtworkSize;uniform sampler2D tArtwork;uniform float uBrightness;uniform float uContrast;uniform float uSaturation;uniform float uHighlights;uniform float uShadows;uniform float uHueAdjust;uniform float uSharpenBlur;uniform float uSharpenSize;uniform float uNormalStr;uniform vec2 uLightPos;uniform float uLightStr;varying vec2 vUv; #import color/contrast #import color/brightness float blendOverlay(float base,float blend){return base<0.5?(2.0*base*blend):(1.0-2.0*(1.0-base)*(1.0-blend));}vec3 blendOverlay(vec3 base,vec3 blend){return vec3(blendOverlay(base.r,blend.r),blendOverlay(base.g,blend.g),blendOverlay(base.b,blend.b));}vec3 blendOverlay(vec3 base,vec3 blend,float opacity){return(blendOverlay(base,blend)*opacity+base*(1.0-opacity));}void make_kernel(inout vec4 n[9],sampler2D tex,vec2 coord){float w=1.0/uArtworkSize.x;float h=1.0/uArtworkSize.y;n[0]=texture2D(tex,coord+vec2(-w,-h));n[1]=texture2D(tex,coord+vec2(0.0,-h));n[2]=texture2D(tex,coord+vec2(w,-h));n[3]=texture2D(tex,coord+vec2(-w,0.0));n[4]=texture2D(tex,coord);n[5]=texture2D(tex,coord+vec2(w,0.0));n[6]=texture2D(tex,coord+vec2(-w,h));n[7]=texture2D(tex,coord+vec2(0.0,h));n[8]=texture2D(tex,coord+vec2(w,h));}vec2 stdNormalMap(float height){return-vec2(dFdx(height),dFdy(height));}float Lum(vec3 c){return 0.299*c.r+0.587*c.g+0.114*c.b;}vec3 ClipColor(vec3 c){float l=Lum(c);float n=min(min(c.r,c.g),c.b);float x=max(max(c.r,c.g),c.b);if(n<0.0)c=max((c-l)*l/(l-n)+l,0.0);if(x>1.0)c=min((c-l)*(1.0-l)/(x-l)+l,1.0);return c;}vec3 SetLum(vec3 c,float l){c+=l-Lum(c);return ClipColor(c);}float Sat(vec3 c){float n=min(min(c.r,c.g),c.b);float x=max(max(c.r,c.g),c.b);return x-n;}vec3 SetSat(vec3 c,float s){float cmin=min(min(c.r,c.g),c.b);float cmax=max(max(c.r,c.g),c.b);vec3 res=vec3(0.0);if(cmax>cmin){if(c.r==cmin&&c.b==cmax){res.r=0.0;res.g=((c.g-cmin)*s)/(cmax-cmin);res.b=s;}else if(c.r==cmin&&c.g==cmax){res.r=0.0;res.b=((c.b-cmin)*s)/(cmax-cmin);res.g=s;}else if(c.g==cmin&&c.b==cmax){res.g=0.0;res.r=((c.r-cmin)*s)/(cmax-cmin);res.b=s;}else if(c.g==cmin&&c.r==cmax){res.g=0.0;res.b=((c.b-cmin)*s)/(cmax-cmin);res.r=s;}else if(c.b==cmin&&c.r==cmax){res.b=0.0;res.g=((c.g-cmin)*s)/(cmax-cmin);res.r=s;}else{res.b=0.0;res.r=((c.r-cmin)*s)/(cmax-cmin);res.g=s;}}return res;}vec3 applyHue(vec3 col,float hueAdjust){vec3 k=vec3(0.57735,0.57735,0.57735);float cosAngle=cos(hueAdjust);return col*cosAngle+cross(k,col)*sin(hueAdjust)+k*dot(k,col)*(1.0-cosAngle);}vec3 blendMultiply(vec3 base,vec3 blend){return base*blend;}vec3 blendMultiply(vec3 base,vec3 blend,float opacity){return(blendMultiply(base,blend)*opacity+base*(1.0-opacity));}void main(){vec2 uv=vUv;vec4 artwork=texture2D(tArtwork,uv).rgba;vec2 areaSize=uSharpenSize/uArtworkSize;vec4 c1=texture2D(tArtwork,mod(uv-areaSize,1.));vec4 c2=texture2D(tArtwork,mod(vec2(uv.x,uv.y-areaSize.y),1.));vec4 c3=texture2D(tArtwork,mod(vec2(uv.x+areaSize.x,uv.y-areaSize.y),1.));vec4 c4=texture2D(tArtwork,mod(vec2(uv.x-areaSize.x,uv.y),1.));vec4 c5=texture2D(tArtwork,mod(vec2(uv.x+areaSize.x,uv.y),1.));vec4 c6=texture2D(tArtwork,mod(vec2(uv.x-areaSize.x,uv.y+areaSize.y),1.));vec4 c7=texture2D(tArtwork,mod(vec2(uv.x,uv.y+areaSize.y),1.));vec4 c8=texture2D(tArtwork,mod(uv+areaSize,1.));vec4 blur=(c1+c3+c6+c8+2.*(c2+c4+c5+c7)+4.*artwork)/16.;artwork=(1.+uSharpenBlur)*artwork-uSharpenBlur*blur;float brightness=uBrightness;artwork=brightnessMatrix(brightness)*contrastMatrix(uContrast)*artwork;float amt=mix(uHighlights,uShadows,1.0-Lum(artwork.rgb))*artwork.a;if(amt<0.0)amt*=2.0;vec3 res=mix(artwork.rgb,vec3(1.0),amt);vec3 blend=mix(vec3(1.0),pow(artwork.rgb,vec3(1.0/0.7)),amt);res=max(1.0-((1.0-res)/blend),0.0);res=SetLum(SetSat(artwork.rgb,Sat(res)),Lum(res));res=applyHue(res,uHueAdjust);const vec3 W=vec3(0.2125,0.7154,0.0721);vec3 intensity=vec3(dot(res,W));res=mix(intensity,res,uSaturation);artwork.rgb=res;float height=(artwork.r+artwork.g+artwork.b)/3.;vec2 normal=stdNormalMap(height);normal*=uNormalStr;normal+=.5;float lighting=dot(normal,normalize(uLightPos));artwork.rgb+=lighting*uLightStr*.5;gl_FragColor=artwork;}`;var D="precision highp float;varying vec2 vUv;void main(){vUv=uv;gl_Position=vec4(position,1.0);}";var M=class{constructor(){this.useA=!1;let s=function(t){let e=parseInt(t.substr(0,8),16),a=parseInt(t.substr(8,8),16),l=parseInt(t.substr(16,8),16),i=parseInt(t.substr(24,8),16);return function(){e|=0,a|=0,l|=0,i|=0;let m=(e+a|0)+i|0;return i=i+1|0,e=a^a>>>9,a=l+(l<<3)|0,l=l<<21|l>>>11,l=l+m|0,(m>>>0)/4294967296}};this.prngA=new s(tokenData.hash.substr(2,32)),this.prngB=new s(tokenData.hash.substr(34,32));for(let t=0;t<1e6;t+=2)this.prngA(),this.prngB()}random_dec=()=>(this.useA=!this.useA,this.useA?this.prngA():this.prngB());random_num(s,t){return s+(t-s)*this.random_dec()}random_int(s,t){return Math.floor(this.random_num(s,t+1))}random_bool(s){return this.random_dec()<s}random_choice(s){return s[this.random_int(0,s.length-1)]}};var ss="mat4 brightnessMatrix(float brightness){return mat4(1,0,0,0,0,1,0,0,0,0,1,0,brightness,brightness,brightness,1);}";var ts="mat4 contrastMatrix(float contrast){float t=(1.0-contrast)/2.0;return mat4(contrast,0,0,0,0,contrast,0,0,0,0,contrast,0,t,t,t,1);}";var es="float cubicIn(float t){return t*t*t;}float cubicOut(float t){float f=t-1.0;return f*f*f+1.0;}";var rs="float exponentialOut(float t){return t==1.0?t:1.0-pow(2.0,-10.0*t);}float exponentialIn(float t){return t==0.0?t:pow(2.0,10.0*(t-1.0));}";var as="float hue2rgb(float f1,float f2,float hue){if(hue<0.0)hue+=1.0;else if(hue>1.0)hue-=1.0;float res;if((6.0*hue)<1.0)res=f1+(f2-f1)*6.0*hue;else if((2.0*hue)<1.0)res=f2;else if((3.0*hue)<2.0)res=f1+(f2-f1)*((2.0/3.0)-hue)*6.0;else r