0x77b35947…cc7dsent to0x2758442e…81ae·#25,448,159·view on Etherscan
getWorldPosition":"(vec3 position) { return position; }","vec3 getLocalNormal":"(vec3 normal) { return normal; }","vec3 getWorldNormal":"(vec3 normal) { return normal; }","vec2 getUV":"(vec2 uv) { return uv; }","vec4 getVertexColor":"(vec4 color) { return color; }","void afterVertex":"() {}"},fragment:{"void beforeFragment":"() {}","vec4 getFinalColor":"(vec4 color) { return color; }","void afterFragment":"() {}"}})),this._defaultNormalShader}},{key:"baseColorShader",value:function(){return this._getColorShader()}},{key:"_getColorShader",value:function(){return this._defaultColorShader||(this._defaultColorShader=new g.default.Shader(this,this._webGL2CompatibilityPrefix("vert","mediump")+E.normalVert,this._webGL2CompatibilityPrefix("frag","mediump")+E.basicFrag,{vertex:{"void beforeVertex":"() {}","vec3 getLocalPosition":"(vec3 position) { return position; }","vec3 getWorldPosition":"(vec3 position) { return position; }","vec3 getLocalNormal":"(vec3 normal) { return normal; }","vec3 getWorldNormal":"(vec3 normal) { return normal; }","vec2 getUV":"(vec2 uv) { return uv; }","vec4 getVertexColor":"(vec4 color) { return color; }","void afterVertex":"() {}"},fragment:{"void beforeFragment":"() {}","vec4 getFinalColor":"(vec4 color) { return color; }","void afterFragment":"() {}"}})),this._defaultColorShader}},{key:"pointShader",value:function(){return this._getPointShader()}},{key:"_getPointShader",value:function(){return this._defaultPointShader||(this._defaultPointShader=new g.default.Shader(this,this._webGL2CompatibilityPrefix("vert","mediump")+E.pointVert,this._webGL2CompatibilityPrefix("frag","mediump")+E.pointFrag,{vertex:{"void beforeVertex":"() {}","vec3 getLocalPosition":"(vec3 position) { return position; }","vec3 getWorldPosition":"(vec3 position) { return position; }","float getPointSize":"(float size) { return size; }","vec4 getVertexColor":"(vec4 color) { return color; }","void afterVertex":"() {}"},fragment:{"void beforeFragment":"() {}","vec4 getFinalColor":"(vec4 color) { return color; }","bool shouldDiscard":"(bool outside) { return outside; }","void afterFragment":"() {}"}})),this._defaultPointShader}},{key:"baseStrokeShader",value:function(){return this._getLineShader()}},{key:"_getLineShader",value:function(){return this._defaultLineShader||(this._defaultLineShader=new g.default.Shader(this,this._webGL2CompatibilityPrefix("vert","mediump")+E.lineVert,this._webGL2CompatibilityPrefix("frag","mediump")+E.lineFrag,{vertex:{"void beforeVertex":"() {}","vec3 getLocalPosition":"(vec3 position) { return position; }","vec3 getWorldPosition":"(vec3 position) { return position; }","float getStrokeWeight":"(float weight) { return weight; }","vec2 getLineCenter":"(vec2 center) { return center; }","vec2 getLinePosition":"(vec2 position) { return position; }","vec4 getVertexColor":"(vec4 color) { return color; }","void afterVertex":"() {}"},fragment:{"void beforeFragment":"() {}","Inputs getPixelInputs":"(Inputs inputs) { return inputs; }","vec4 getFinalColor":"(vec4 color) { return color; }","bool shouldDiscard":"(bool outside) { return outside; }","void afterFragment":"() {}"}})),this._defaultLineShader}},{key:"_getFontShader",value:function(){return this._defaultFontShader||(this.webglVersion===l.WEBGL&&this.GL.getExtension("OES_standard_derivatives"),this._defaultFontShader=new g.default.Shader(this,this._webGL2CompatibilityPrefix("vert","highp")+E.fontVert,this._webGL2CompatibilityPrefix("frag","highp")+E.fontFrag)),this._defaultFontShader}},{key:"_webGL2CompatibilityPrefix",value:function(e,t){var r="";return this.webglVersion===l.WEBGL2&&(r+="#version 300 es\n#define WEBGL2\n"),"vert"===e?r+="#define VERTEX_SHADER\n":"frag"===e&&(r+="#define FRAGMENT_SHADER\n"),t&&(r+="precision ".concat(t," float;\n")),r}},{key:"_getEmptyTexture",value:function(){var e;return this._emptyTexture||((e=new g.default.Image(1,1)).set(0,0,255),this._emptyTexture=new g.default.Texture(this,e)),this._emptyTexture}},{key:"getTexture",value:function(e){e instanceof g.default.Framebuffer&&(e=e.color);var t=this.textures.get(e);return t||(t=new g.default.Texture(this,e),this.textures.set(e,t),t)}},{key:"getDiffusedTexture",value:function(e){var t,r,o=this;return null!=this.diffusedTextures.get(e)?this.diffusedTextures.get(e):(0,t=Math.floor(e.height/e.width*200),r=this._pInst.createFramebuffer({width:200,height:t,density:1}),this.diffusedShader||(this.diffusedShader=this._pInst.createShader(E.imageLightVert,E.imageLightDiffusedFrag)),r.draw(function(){o._pInst.shader(o.diffusedShader),o.diffusedShader.setUniform("environmentMap",e),o._pInst.noStroke(),o._pInst.rectMode(l.CENTER),o._pInst.noLights(),o._pInst.rect(0,0,200,t)}),this.diffusedTextures.set(e,r),r)}},{key:"getSpecularTexture",value:function(r){var o=this;if(null!=this.specularTextures.get(r))return this.specularTextures.get(r);for(var e,n=[],s=this._pInst.createFramebuffer({width:512,height:512,density:1}),i=Math.log(512)/Math.log(2),t=(this.specularShader||(this.specularShader=this._pInst.createShader(E.imageLightVert,E.imageLightSpecularFrag)),512);1<=t;t/=2)!function(e){s.resize(e,e);var t=1-Math.log(e)/Math.log(2)/i;s.draw(function(){o._pInst.shader(o.specularShader),o._pInst.clear(),o.specularShader.setUniform("environmentMap",r),o.specularShader.setUniform("roughness",t),o._pInst.noStroke(),o._pInst.noLights(),o._pInst.plane(e,e)}),n.push(s.get().drawingContext.getImageData(0,0,e,e))}(t);return s.remove(),e=new c.MipmapTexture(this,n,{}),this.specularTextures.set(r,e),e}},{key:"activeFramebuffer",value:function(){return this.activeFramebuffers[this.activeFramebuffers.length-1]||null}},{key:"createFramebuffer",value:function(e){return new g.default.Framebuffer(this,e)}},{key:"_setStrokeUniforms",value:function(e){e.bindShader(),e.setUniform("uUseLineColor",this._useLineColor),e.setUniform("uMaterialColor",this.curStrokeColor),e.setUniform("uStrokeWeight",this.curStrokeWeight),e.setUniform("uStrokeCap",w[this.curStrokeCap]),e.setUniform("uStrokeJoin",S[this.curStrokeJoin])}},{key:"_setFillUniforms",value:function(e){var r=this,t=(e.bindShader(),this.mixedSpecularColor=h(this.curSpecularColor),0<this._useMetalness&&(this.mixedSpecularColor=this.mixedSpecularColor.map(function(e,t){return r.curFillColor[t]*r._useMetalness+e*(1-r._useMetalness)})),e.setUniform("uUseVertexColor",this._useVertexColor),e.setUniform("uMaterialColor",this.curFillColor),e.setUniform("isTexture",!!this._tex),this._tex&&e.setUniform("uSampler",this._tex),e.setUniform("uTint",this._tint),e.setUniform("uHasSetAmbient",this._hasSetAmbient),e.setUniform("uAmbientMatColor",this.curAmbientColor),e.setUniform("uSpecularMatColor",this.mixedSpecularColor),e.setUniform("uEmissiveMatColor",this.curEmissiveColor),e.setUniform("uSpecular",this._useSpecularMaterial),e.setUniform("uEmissive",this._useEmissiveMaterial),e.setUniform("uShininess",this._useShininess),e.setUniform("uMetallic",this._useMetalness),this._setImageLightUniforms(e),e.setUniform("uUseLighting",this._enableLighting),this.pointLightDiffuseColors.length/3),t=(e.setUniform("uPointLightCount",t),e.setUniform("uPointLightLocation",this.pointLightPositions),e.setUniform("uPointLightDiffuseColors",this.pointLightDiffuseColors),e.setUniform("uPointLightSpecularColors",this.pointLightSpecularColors),this.directionalLightDiffuseColors.length/3),t=(e.setUniform("uDirectionalLightCount",t),e.setUniform("uLightingDirection",this.directionalLightDirections),e.setUniform("uDirectionalDiffuseColors",this.directionalLightDiffuseColors),e.setUniform("uDirectionalSpecularColors",this.directionalLightSpecularColors),this.ambientLightColors.length/3),t=(this.mixedAmbientLight=h(this.ambientLightColors),0<this._useMetalness&&(this.mixedAmbientLight=this.mixedAmbientLight.map(function(e){e-=r._useMetalness;return Math.max(0,e)})),e.setUniform("uAmbientLightCount",t),e.setUniform("uAmbientColor",this.mixedAmbientLight),this.spotLightDiffuseColors.length/3);e.setUniform("uSpotLightCount",t),e.setUniform("uSpotLightAngle",this.spotLightAngle),e.setUniform("uSpotLightConc",this.spotLightConc),e.setUniform("uSpotLightDiffuseColors",this.spotLightDiffuseColors),e.setUniform("uSpotLightSpecularColors",this.spotLightSpecularColors),e.setUniform("uSpotLightLocation",this.spotLightPositions),e.setUniform("uSpotLightDirection",this.spotLightDirections),e.setUniform("uConstantAttenuation",this.constantAttenuation),e.setUniform("uLinearAttenuation",this.linearAttenuation),e.setUniform("uQuadraticAttenuation",this.quadraticAttenuation),e.bindTextures()}},{key:"_setImageLightUniforms",value:function(e){var t;e.setUniform("uUseImageLight",null!=this.activeImageLight),this.activeImageLight&&(t=this.getDiffusedTexture(this.activeImageLight),e.setUniform("environmentMapDiffused",t),t=this.getSpecularTexture(this.activeImageLight),e.setUniform("environmentMapSpecular",t))}},{key:"_setPointUniforms",value:function(e){e.bindShader(),e.setUniform("uMaterialColor",this.curStrokeColor),e.setUniform("uPointSize",this.pointSize*this._pInst._pixelDensity);var t=this.immediateMode&&this.immediateMode.geometry&&this.immediateMode.geometry.vertexStrokeColors&&0<this.immediateMode.geometry.vertexStrokeColors.length;e.setUniform("uUseVertexColor",!!t)}},{key:"_bindBuffer",value:function(e,t,r,o,n){t=t||this.GL.ARRAY_BUFFER,this.GL.bindBuffer(t,e),void 0!==r&&((e=r)instanceof g.default.DataArray?e=r.dataArray():e instanceof(o||Float32Array)||(e=new(o||Float32Array)(e)),this.GL.bufferData(t,e,n||this.GL.STATIC_DRAW))}},{key:"_arraysEqual",value:function(e,r){return e.length===r.length&&e.every(function(e,t){return e===r[t]})}},{key:"_isTypedArray",value:function(t){return[Float32Array,Float64Array,Int16Array,Uint16Array,Uint32Array].some(function(e){return t instanceof e})}},{key:"_flatten",value:function(e){return e.flat()}},{key:"_vToNArray",value:function(e){return e.flatMap(function(e){return[e.x,e.y,e.z]})}},{key:"_bezierCoefficients",value:function(e){var t=e*e,r=1-e,o=r*r;return[o*r,3*o*e,3*r*t,t*e]}},{key:"_quadraticCoefficients",value:function(e){var t=1-e;return[t*t,2*t*e,e*e]}},{key:"_bezierToCatmull",value:function(e){return[e[1],e[1]+(e[2]-e[0])/this._curveTightness,e[2]-(e[3]-e[1])/this._curveTightness,e[2]]}},{key:"_initTessy",value:function(){var e=new u.default.GluTesselator;return e.gluTessCallback(u.default.gluEnum.GLU_TESS_VERTEX_DATA,function(e,t){var r=!0,o=!1,n=void 0;try{for(var s,i=e[Symbol.iterator]();!(r=(s=i.next()).done);r=!0){var a=s.value;t.push(a)}}catch(e){o=!0,n=e}finally{try{r||null==i.return||i.return()}finally{if(o)throw n}}}),e.gluTessCallback(u.default.gluEnum.GLU_TESS_BEGIN,function(e){e!==u.default.primitiveType.GL_TRIANGLES&&console.log("expected TRIANGLES but got type: ".concat(e))}),e.gluTessCallback(u.default.gluEnum.GLU_TESS_ERROR,function(e){console.log("error callback"),console.log("error number: ".concat(e))}),e.gluTessCallback(u.default.gluEnum.GLU_TESS_COMBINE,function(e,t,r){for(var o=new Array(g.default.RendererGL.prototype.tessyVertexSize).fill(0),n=0;n<r.length;n++)for(var s=0;s<o.length;s++)0!==r[n]&&t[n]&&(o[s]+=t[n][s]*r[n]);return o}),e.gluTessCallback(u.default.gluEnum.GLU_TESS_EDGE_FLAG,function(e){}),e.gluTessProperty(u.default.gluEnum.GLU_TESS_WINDING_RULE,u.default.windingRule.GLU_TESS_WINDING_NONZERO),e}},{key:"_triangulate",value:function(e){var t=e[0]?e[0][2]:void 0,r=!0,o=!0,n=!1,s=void 0;try{for(var i,a=e[Symbol.iterator]();!(o=(i=a.next()).done);o=!0)for(var l=i.value,u=0;u<l.length;u+=g.default.RendererGL.prototype.tessyVertexSize)if(l[u+2]!==t){r=!1;break}}catch(e){n=!0,s=e}finally{try{o||null==a.return||a.return()}finally{if(n)throw s}}r?this._tessy.gluTessNormal(0,0,1):this._tessy.gluTessNormal(0,0,0);var n=[],c=(this._tessy.gluTessBeginPolygon(n),!0),s=!1,d=void 0;try{for(var h,f=e[Symbol.iterator]();!(c=(h=f.next()).done);c=!0){var p=h.value;this._tessy.gluTessBeginContour();for(var m=0;m<p.length;m+=g.default.RendererGL.prototype.tessyVertexSize){var y=p.slice(m,m+g.default.RendererGL.prototype.tessyVertexSize);this._tessy.gluTessVertex(y,y)}this._tessy.gluTessEndContour()}}catch(e){s=!0,d=e}finally{try{c||null==f.return||f.return()}finally{if(s)throw d}}return this._tessy.gluTessEndPolygon(),n}}])&&f(t.prototype,e),r&&f(t,r),s}(g.default.Renderer),g.default.prototype._assert3d=function(e){if(!this._renderer.isP3D)throw new Error("".concat(e,"() is only supported in WEBGL mode. If you'd like to use 3D graphics and WebGL, see https://p5js.org/examples/3d-geometries/ for more information."))},g.default.RendererGL.prototype.tessyVertexSize=12;e=g.default.RendererGL;r.default=e},{"../core/constants":272,"../core/main":283,"../core/p5.Renderer":286,"./GeometryBuilder":327,"./p5.Camera":332,"./p5.Framebuffer":334,"./p5.Matrix":336,"./p5.Shader":342,"./p5.Texture":343,"core-js/modules/es.array.concat":153,"core-js/modules/es.array.copy-within":154,"core-js/modules/es.array.every":155,"core-js/modules/es.array.fill":156,"core-js/modules/es.array.flat":160,"core-js/modules/es.array.flat-map":159,"core-js/modules/es.array.from":162,"core-js/modules/es.array.includes":163,"core-js/modules/es.array.iterator":165,"core-js/modules/es.array.map":168,"core-js/modules/es.array.slice":169,"core-js/modules/es.array.some":170,"core-js/modules/es.array.unscopables.flat":173,"core-js/modules/es.array.unscopables.flat-map":172,"core-js/modules/es.map":175,"core-js/modules/es.object.assign":183,"core-js/modules/es.object.get-own-property-descriptor":186,"core-js/modules/es.object.get-prototype-of":188,"core-js/modules/es.object.to-string":190,"core-js/modules/es.reflect.construct":192,"core-js/modules/es.reflect.get":193,"core-js/modules/es.regexp.to-string":196,"core-js/modules/es.set":197,"core-js/modules/es.string.includes":199,"core-js/modules/es.string.iterator":200,"core-js/modules/es.symbol":212,"core-js/modules/es.symbol.description":210,"core-js/modules/es.symbol.iterator":211,"core-js/modules/es.typed-array.copy-within":213,"core-js/modules/es.typed-array.every":214,"core-js/modules/es.typed-array.fill":215,"core-js/modules/es.typed-array.filter":216,"core-js/modules/es.typed-array.find":218,"core-js/modules/es.typed-array.find-index":217,"core-js/modules/es.typed-array.float32-array":219,"core-js/modules/es.typed-array.float64-array":220,"core-js/modules/es.typed-array.for-each":221,"core-js/modules/es.typed-array.includes":222,"core-js/modules/es.typed-array.index-of":223,"core-js/modules/es.typed-array.int16-array":224,"core-js/modules/es.typed-array.iterator":226,"core-js/modules/es.typed-array.join":227,"core-js/modules/es.typed-array.last-index-of":228,"core-js/modules/es.typed-array.map":229,"core-js/modules/es.typed-array.reduce":231,"core-js/modules/es.typed-array.reduce-right":230,"core-js/modules/es.typed-array.reverse":232,"core-js/modules/es.typed-array.set":233,"core-js/modules/es.typed-array.slice":234,"core-js/modules/es.typed-array.some":235,"core-js/modules/es.typed-array.sort":236,"core-js/modules/es.typed-array.subarray":237,"core-js/modules/es.typed-array.to-locale-string":238,"core-js/modules/es.typed-array.to-string":239,"core-js/modules/es.typed-array.uint16-array":240,"core-js/modules/es.typed-array.uint32-array":241,"core-js/modules/es.typed-array.uint8-array":242,"core-js/modules/es.weak-map":244,"core-js/modules/web.dom-collections.iterator":246,libtess:255,path:258}],342:[function(e,t,r){"use strict";e("core-js/modules/es.symbol"),e("core-js/modules/es.symbol.description"),e("core-js/modules/es.symbol.iterator"),e("core-js/modules/es.array.concat"),e("core-js/modules/es.array.index-of"),e("core-js/modules/es.array.iterator"),e("core-js/modules/es.array.slice"),e("core-js/modules/es.array.some"),e("core-js/modules/es.function.name"),e("core-js/modules/es.object.assign"),e("core-js/modules/es.object.keys"),e("core-js/modules/es.object.to-string"),e("core-js/modules/es.regexp.exec"),e("core-js/modules/es.regexp.to-string"),e("core-js/modules/es.string.iterator"),e("core-js/modules/es.string.split"),e("core-js/modules/web.dom-collections.iterator"),e("core-js/modules/es.symbol"),e("core-js/modules/es.symbol.description"),e("core-js/modules/es.symbol.iterator"),e("core-js/modules/es.array.concat"),e("core-js/modules/es.array.index-of"),e("core-js/modules/es.array.iterator"),e("core-js/modules/es.array.slice"),e("core-js/modules/es.array.some"),e("core-js/modules/es.function.name"),e("core-js/modules/es.object.assign"),e("core-js/modules/es.object.keys"),e("core-js/modules/es.object.to-string"),e("core-js/modules/es.regexp.exec"),e("core-js/modules/es.string.iterator"),e("core-js/modules/es.string.split"),e("core-js/modules/web.dom-collections.iterator"),Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var a=(e=e("../core/main"))&&e.__esModule?e:{default:e};function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)){var r=[],o=!0,n=!1,s=void 0;try{for(var i,a=e[Symbol.iterator]();!(o=(i=a.next()).done)&&(r.push(i.value),!t||r.length!==t);o=!0);}catch(e){n=!0,s=e}finally{try{o||null==a.return||a.return()}finally{if(n)throw s}}return r}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function o(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}a.default.Shader=function(){function i(e,t,r){var o=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{},n=this,s=i;if(!(n instanceof s))throw new TypeError("Cannot call a class as a function");this._renderer=e,this._vertSrc=t,this._fragSrc=r,this._vertShader=-1,this._fragShader=-1,this._glProgram=0,this._loadedAttributes=!1,this.attributes={},this._loadedUniforms=!1,this.uniforms={},this._bound=!1,this.samplers=[],this.hooks={uniforms:o.uniforms||{},declarations:o.declarations,helpers:o.helpers||{},vertex:o.vertex||{},fragment:o.fragment||{},modified:{vertex:o.modified&&o.modified.vertex||{},fragment:o.modified&&o.modified.fragment||{}}}}var e,t,r;return e=i,(t=[{key:"shaderSrc",value:function(e,t){var r,o,n,s,i,e=u(e.split("void main"),2),a=e[0],e=e[1],l="";for(r in this.hooks.uniforms)l+="uniform ".concat(r,";\n");for(o in this.hooks.declarations&&(l+=this.hooks.declarations+"\n"),this.hooks[t].declarations&&(l+=this.hooks[t].declarations+"\n"),this.hooks.helpers)l+="".concat(o).concat(this.hooks.helpers[o],"\n");for(n in this.hooks[t])"declarations"!==n&&(s=(i=u(n.split(" "),2))[0],i=i[1],this.hooks.modified[t][n]&&(l+="#define AUGMENTED_HOOK_"+i+"\n"),l+=s+" HOOK_"+i+this.hooks[t][n]+"\n");return a+l+"void main"+e}},{key:"version",value:function(){var e=/#version (.+)$/.exec(this.vertSrc());return e?e[1]:"100 es"}},{key:"vertSrc",value:function(){return this.shaderSrc(this._vertSrc,"vertex")}},{key:"fragSrc",value:function(){return this.shaderSrc(this._fragSrc,"fragment")}},{key:"inspectHooks",value:function(){for(var e in console.log("==== Vertex shader hooks: ===="),this.hooks.vertex)console.log((this.hooks.modified.vertex[e]?"[MODIFIED] ":"")+e+this.hooks.vertex[e]);for(var t in console.log(""),console.log("==== Fragment shader hooks: ===="),this.hooks.fragment)console.log((this.hooks.modified.fragment[t]?"[MODIFIED] ":"")+t+this.hooks.fragment[t]);for(var r in console.log(""),console.log("==== Helper functions: ===="),this.hooks.helpers)console.log(r+this.hooks.helpers[r])}},{key:"modify",value:function(e){a.default._validateParameters("p5.Shader.modify",arguments);var t,r={vertex:{},fragment:{},helpers:{}};for(t in e)"declarations"!==t&&"uniforms"!==t&&("vertexDeclarations"===t?r.vertex.declarations=(r.vertex.declarations||"")+"\n"+e[t]:"fragmentDeclarations"===t?r.fragment.declarations=(r.fragment.declarations||"")+"\n"+e[t]:this.hooks.vertex[t]?r.vertex[t]=e[t]:this.hooks.fragment[t]?r.fragment[t]=e[t]:r.helpers[t]=e[t]);var o,n,s=Object.assign({},this.hooks.modified.vertex),i=Object.assign({},this.hooks.modified.fragment);for(o in r.vertex||{})"declarations"!==o&&(s[o]=!0);for(n in r.fragment||{})"declarations"!==n&&(i[n]=!0);return new a.default.Shader(this._renderer,this._vertSrc,this._fragSrc,{declarations:(this.hooks.declarations||"")+"\n"+(e.declarations||""),uniforms:Object.assign({},this.hooks.uniforms,e.uniforms||{}),fragment:Object.assign({},this.hooks.fragment,r.fragment||{}),vertex:Object.assign({},this.hooks.vertex,r.vertex||{}),helpers:Object.assign({},this.hooks.helpers,r.helpers||{}),modified:{vertex:s,fragment:i}})}},{key:"init",value:function(){if(0===this._glProgram){var e,t=this._renderer.GL;if(this._vertShader=t.createShader(t.VERTEX_SHADER),t.shaderSource(this._vertShader,this.vertSrc()),t.compileShader(this._vertShader),!t.getShaderParameter(this._vertShader,t.COMPILE_STATUS))return e=t.getShaderInfoLog(this._vertShader),console.error(e),null;if(this._fragShader=t.createShader(t.FRAGMENT_SHADER),t.shaderSource(this._fragShader,this.fragSrc()),t.compileShader(this._fragShader),!t.getShaderParameter(this._fragShader,t.COMPILE_STATUS))return e=t.getShaderInfoLog(this._fragShader),console.error(e),null;this._glProgram=t.createProgram(),t.attachShader(this._glProgram,this._vertShader),t.attachShader(this._glProgram,this._fragShader),t.linkProgram(this._glProgram),t.getProgramParameter(this._glProgram,t.LINK_STATUS)||a.default._friendlyError("Snap! Error linking shader program: ".concat(t.getProgramInfoLog(this._glProgram))),this._loadAttributes(),this._loadUniforms()}return this}},{key:"setDefaultUniforms",value:function(){for(var e in this.hooks.uniforms){var t=u(e.split(" "),2)[1],e=this.hooks.uniforms[e],r=void 0;null!=(r=e instanceof Function?e():e)&&this.setUniform(t,r)}}},{key:"copyToContext",value:function(e){var t=new a.default.Shader(e._renderer,this._vertSrc,this._fragSrc);return t.ensureCompiledOnContext(e),t}},{key:"ensureCompiledOnContext",value:function(e){if(0!==this._glProgram&&this._renderer!==e._renderer)throw new Error("The shader being run is attached to a different context. Do you need to copy it to this context first with .copyToContext()?");0===this._glProgram&&(this._renderer=e._renderer,this.init())}},{key:"_loadAttributes",value:function(){if(!this._loadedAttributes){this.attributes={};for(var e=this._renderer.GL,t=e.getProgramParameter(this._glProgram,e.ACTIVE_ATTRIBUTES),r=0;r<t;++r){var o=e.getActiveAttrib(this._glProgram,r),n=o.name,s=e.getAttribLocation(this._glProgram,n),i={};i.name=n,i.location=s,i.index=r,i.type=o.type,i.size=o.size,this.attributes[n]=i}this._loadedAttributes=!0}}},{key:"_loadUniforms",value:function(){if(!this._loadedUniforms){for(var e=this._renderer.GL,t=e.getProgramParameter(this._glProgram,e.ACTIVE_UNIFORMS),r=0,o=0;o<t;++o){var n=e.getActiveUniform(this._glProgram,o),s={},i=(s.location=e.getUniformLocation(this._glProgram,n.name),s.size=n.size,n.name);1<n.size&&(i=i.substring(0,i.indexOf("[0]"))),s.name=i,s.type=n.type,s._cachedData=void 0,s.type===e.SAMPLER_2D&&(s.samplerIndex=r,r++,this.samplers.push(s)),s.isArray=1<n.size||s.type===e.FLOAT_MAT3||s.type===e.FLOAT_MAT4||s.type===e.FLOAT_VEC2||s.type===e.FLOAT_VEC3||s.type===e.FLOAT_VEC4||s.type===e.INT_VEC2||s.type===e.INT_VEC4||s.type===e.INT_VEC3,this.uniforms[i]=s}this._loadedUniforms=!0}}},{key:"compile",value:function(){}},{key:"bindShader",value:function(){this.init(),this._bound||(this.useProgram(),this._bound=!0,this._setMatrixUniforms(),this.setUniform("uViewport",this._renderer._viewport))}},{key:"unbindShader",value:function(){return this._bound&&(this.unbindTextures(),this._bound=!1),this}},{key:"bindTextures",value:function(){var e=this._renderer.GL,t=!0,r=!1,o=void 0;try{for(var n,s=this.samplers[Symbol.iterator]();!(t=(n=s.next()).done);t=!0){var i=n.value,a=i.texture;void 0===a&&(a=this._renderer._getEmptyTexture()),e.activeTexture(e.TEXTURE0+i.samplerIndex),a.bindTexture(),a.update(),e.uniform1i(i.location,i.samplerIndex)}}catch(e){r=!0,o=e}finally{try{t||null==s.return||s.return()}finally{if(r)throw o}}}},{key:"updateTextures",value:function(){var e=!0,t=!1,r=void 0;try{for(var o,n=this.samplers[Symbol.iterator]();!(e=(o=n.next()).done);e=!0){var s=o.value.texture;s&&s.update()}}catch(e){t=!0,r=e}finally{try{e||null==n.return||n.return()}finally{if(t)throw r}}}},{key:"unbindTextures",value:function(){var e=!0,t=!1,r=void 0;try{for(var o,n=this.samplers[Symbol.iterator]();!(e=(o=n.next()).done);e=!0){var s=o.value;this.setUniform(s.name,this._renderer._getEmptyTexture())}}catch(e){t=!0,r=e}finally{try{e||null==n.return||n.return()}finally{if(t)throw r}}}},{key:"_setMatrixUniforms",value:function(){var e=this._renderer.uModelMatrix,t=this._renderer.uViewMatrix,r=this._renderer.uPMatrix,o=e.copy().mult(t),n=(this._renderer.uMVMatrix=o).copy();n.mult(r),this.isStrokeShader()&&this.setUniform("uPerspective",this._renderer._curCamera.useLinePerspective?1:0),this.setUniform("uViewMatrix",t.mat4),this.setUniform("uProjectionMatrix",r.mat4),this.setUniform("uModelMatrix",e.mat4),this.setUniform("uModelViewMatrix",o.mat4),this.setUniform("uModelViewProjectionMatrix",n.mat4),this.uniforms.uNormalMatrix&&(this._renderer.uNMatrix.inverseTranspose(this._renderer.uMVMatrix),this.setUniform("uNormalMatrix",this._renderer.uNMatrix.mat3)),this.uniforms.uCameraRotation&&(this._renderer.curMatrix.inverseTranspose(this._renderer.uViewMatrix),this.setUniform("uCameraRotation",this._renderer.curMatrix.mat3))}},{key:"useProgram",value:function(){var e=this._renderer.GL;return this._renderer._curShader!==this&&(e.useProgram(this._glProgram),this._renderer._curShader=this),this}},{key:"setUniform",value:function(e,t){var r=this.uniforms[e];if(r){var o=this._renderer.GL;if(r.isArray){if(r._cachedData&&this._renderer._arraysEqual(r._cachedData,t))return;r._cachedData=t.slice(0)}else{if(r._cachedData&&r._cachedData===t)return;Array.isArray(t)?r._cachedData=t.slice(0):r._cachedData=t}var n=r.location;switch(this.useProgram(),r.type){case o.BOOL:!0===t?o.uniform1i(n,1):o.uniform1i(n,0);break;case o.INT:1<r.size?t.length&&o.uniform1iv(n,t):o.uniform1i(n,t);break;case o.FLOAT:1<r.size?t.length&&o.uniform1fv(n,t):o.uniform1f(n,t);break;case o.FLOAT_MAT3:o.uniformMatrix3fv(n,!1,t);break;case o.FLOAT_MAT4:o.uniformMatrix4fv(n,!1,t);break;case o.FLOAT_VEC2:1<r.size?t.length&&o.uniform2fv(n,t):o.uniform2f(n,t[0],t[1]);break;case o.FLOAT_VEC3:1<r.size?t.length&&o.uniform3fv(n,t):o.uniform3f(n,t[0],t[1],t[2]);break;case o.FLOAT_VEC4:1<r.size?t.length&&o.uniform4fv(n,t):o.uniform4f(n,t[0],t[1],t[2],t[3]);break;case o.INT_VEC2:1<r.size?t.length&&o.uniform2iv(n,t):o.uniform2i(n,t[0],t[1]);break;case o.INT_VEC3:1<r.size?t.length&&o.uniform3iv(n,t):o.uniform3i(n,t[0],t[1],t[2]);break;case o.INT_VEC4:1<r.size?t.length&&o.uniform4iv(n,t):o.uniform4i(n,t[0],t[1],t[2],t[3]);break;case o.SAMPLER_2D:if("number"==typeof t){if(t<o.TEXTURE0||t>o.TEXTURE31||t!==Math.ceil(t))return console.log("🌸 p5.js says: You're trying to use a number as the data for a texture.Please use a texture."),this;o.activeTexture(t),o.uniform1i(n,t)}else o.activeTexture(o.TEXTURE0+r.samplerIndex),r.texture=t instanceof a.default.Texture?t:this._renderer.getTexture(t),o.uniform1i(n,r.samplerIndex),r.texture.src.gifProperties&&r.texture.src._animateGif(this._renderer._pInst);break;case o.SAMPLER_CUBE:case o.SAMPLER_3D:case o.SAMPLER_2D_SHADOW:case o.SAMPLER_2D_ARRAY:case o.SAMPLER_2D_ARRAY_SHADOW:case o.SAMPLER_CUBE_SHADOW:case o.INT_SAMPLER_2D:case o.INT_SAMPLER_3D:case o.INT_SAMPLER_CUBE:case o.INT_SAMPLER_2D_ARRAY:case o.UNSIGNED_INT_SAMPLER_2D:case o.UNSIGNED_INT_SAMPLER_3D:case o.UNSIGNED_INT_SAMPLER_CUBE:case o.UNSIGNED_INT_SAMPLER_2D_ARRAY:"number"==typeof t&&(t<o.TEXTURE0||t>o.TEXTURE31||t!==Math.ceil(t)?console.log("🌸 p5.js says: You're trying to use a number as the data for a texture.Please use a texture."):(o.activeTexture(t),o.uniform1i(n,t)))}return this}}},{key:"isLightShader",value:function(){return[this.attributes.aNormal,this.uniforms.uUseLighting,this.uniforms.uAmbientLightCount,this.uniforms.uDirectionalLightCount,this.uniforms.uPointLightCount,this.uniforms.uAmbientColor,this.uniforms.uDirectionalDiffuseColors,this.uniforms.uDirectionalSpecularColors,this.uniforms.uPointLightLocation,this.uniforms.uPointLightDiffuseColors,this.uniforms.uPointLightSpecularColors,this.uniforms.uLightingDirection,this.uniforms.uSpecular].some(function(e){return void 0!==e})}},{key:"isNormalShader",value:function(){return void 0!==this.attributes.aNormal}},{key:"isTextureShader",value:function(){return 0<this.samplers.length}},{key:"isColorShader",value:function(){return void 0!==this.attributes.aVertexColor||void 0!==this.uniforms.uMaterialColor}},{key:"isTexLightShader",value:function(){return this.isLightShader()&&this.isTextureShader()}},{key:"isStrokeShader",value:function(){return void 0!==this.uniforms.uStrokeWeight}},{key:"enableAttrib",value:function(e,t,r,o,n,s){var i;return e&&-1!==(e=e.location)&&(i=this._renderer.GL,this._renderer.registerEnabled.has(e)||(i.enableVertexAttribArray(e),this._renderer.registerEnabled.add(e)),this._renderer.GL.vertexAttribPointer(e,t,r||i.FLOAT,o||!1,n||0,s||0)),this}},{key:"disableRemainingAttributes",value:function(){var r=this,e=!0,t=!1,o=void 0;try{for(var n,s=this._renderer.registerEnabled.values()[Symbol.iterator]();!(e=(n=s.next()).done);e=!0)!function(){var t=n.value;Object.keys(r.attributes).some(function(e){return r.attributes[e].location===t})||(r._renderer.GL.disableVertexAttribArray(t),r._renderer.registerEnabled.delete(t))}()}catch(e){t=!0,o=e}finally{try{e||null==s.return||s.return()}finally{if(t)throw o}}}},{key:"remove",value:function(){var e;0!==this._glProgram&&(e=this._renderer.GL,this._bound&&this.unbindShader(),-1!==this._vertShader&&(e.detachShader(this._glProgram,this._vertShader),e.deleteShader(this._vertShader),this._vertShader=-1),-1!==this._fragShader&&(e.detachShader(this._glProgram,this._fragShader),e.deleteShader(this._fragShader),this._fragShader=-1),e.deleteProgram(this._glProgram),this._glProgram=0,this._loadedAttributes=!1,this._loadedUniforms=!1,this.attributes={},this.uniforms={},this.samplers=[])}}])&&o(e.prototype,t),r&&o(e,r),i}();e=a.default.Shader;r.default=e},{"../core/main":283,"core-js/modules/es.array.concat":153,"core-js/modules/es.array.index-of":164,"core-js/modules/es.array.iterator":165,"core-js/modules/es.array.slice":169,"core-js/modules/es.array.some":170,"core-js/modules/es.function.name":174,"core-js/modules/es.object.assign":183,"core-js/modules/es.object.keys":189,"core-js/modules/es.object.to-string":190,"core-js/modules/es.regexp.exec":195,"core-js/modules/es.regexp.to-string":196,"core-js/modules/es.string.iterator":200,"core-js/modules/es.string.split":206,"core-js/modules/es.symbol":212,"core-js/modules/es.symbol.description":210,"core-js/modules/es.symbol.iterator":211,"core-js/modules/web.dom-collections.iterator":246}],343:[function(e,t,r){"use strict";function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e){return(i="function"==typeof Symbol&&"symbol"===o(Symbol.iterator)?function(e){return o(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":o(e)})(e)}e("core-js/modules/es.symbol"),e("core-js/modules/es.symbol.description"),e("core-js/modules/es.symbol.iterator"),e("core-js/modules/es.array.iterator"),e("core-js/modules/es.object.get-own-property-descriptor"),e("core-js/modules/es.object.get-prototype-of"),e("core-js/modules/es.object.to-string"),e("core-js/modules/es.reflect.construct"),e("core-js/modules/es.regexp.to-string"),e("core-js/modules/es.string.iterator"),e("core-js/modules/es.typed-array.uint8-array"),e("core-js/modules/es.typed-array.copy-within"),e("core-js/modules/es.typed-array.every"),e("core-js/modules/es.typed-array.fill"),e("core-js/modules/es.typed-array.filter"),e("core-js/modules/es.typed-array.find"),e("core-js/modules/es.typed-array.find-index"),e("core-js/modules/es.typed-array.for-each"),e("core-js/modules/es.typed-array.includes"),e("core-js/modules/es.typed-array.index-of"),e("core-js/modules/es.typed-array.iterator"),e("core-js/modules/es.typed-array.join"),e("core-js/modules/es.typed-array.last-index-of"),e("core-js/modules/es.typed-array.map"),e("core-js/modules/es.typed-array.reduce"),e("core-js/modules/es.typed-array.reduce-right"),e("core-js/modules/es.typed-array.reverse"),e("core-js/modules/es.typed-array.set"),e("core-js/modules/es.typed-array.slice"),e("core-js/modules/es.typed-array.some"),e("core-js/modules/es.typed-array.sort"),e("core-js/modules/es.typed-array.subarray"),e("core-js/modules/es.typed-array.to-locale-string"),e("core-js/modules/es.typed-array.to-string"),e("core-js/modules/es.weak-map"),e("core-js/modules/web.dom-collections.iterator"),e("core-js/modules/es.array.iterator"),e("core-js/modules/es.object.to-string"),e("core-js/modules/es.typed-array.uint8-array"),e("core-js/modules/es.typed-array.copy-within"),e("core-js/modules/es.typed-array.every"),e("core-js/modules/es.typed-array.fill"),e("core-js/modules/es.typed-array.filter"),e("core-js/modules/es.typed-array.find"),e("core-js/modules/es.typed-array.find-index"),e("core-js/modules/es.typed-array.for-each"),e("core-js/modules/es.typed-array.includes"),e("core-js/modules/es.typed-array.index-of"),e("core-js/modules/es.typed-array.iterator"),e("core-js/modules/es.typed-array.join"),e("core-js/modules/es.typed-array.last-index-of"),e("core-js/modules/es.typed-array.map"),e("core-js/modules/es.typed-array.reduce"),e("core-js/modules/es.typed-array.reduce-right"),e("core-js/modules/es.typed-array.reverse"),e("core-js/modules/es.typed-array.set"),e("core-js/modules/es.typed-array.slice"),e("core-js/modules/es.typed-array.some"),e("core-js/modules/es.typed-array.sort"),e("core-js/modules/es.typed-array.subarray"),e("core-js/modules/es.typed-array.to-locale-string"),e("core-js/modules/es.typed-array.to-string"),Object.defineProperty(r,"__esModule",{value:!0}),r.checkWebGLCapabilities=m,r.default=r.MipmapTexture=void 0;var s=(p=e("../core/main"))&&p.__esModule?p:{default:p},a=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!==i(e)&&"function"!=typeof e)return{default:e};var t=l();if(t&&t.has(e))return t.get(e);var r,o={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(r in e){var s;Object.prototype.hasOwnProperty.call(e,r)&&((s=n?Object.getOwnPropertyDescriptor(e,r):null)&&(s.get||s.set)?Object.defineProperty(o,r,s):o[r]=e[r])}o.default=e,t&&t.set(e,o);return o}(e("../core/constants"));function l(){var e;return"function"!=typeof WeakMap?null:(e=new WeakMap,l=function(){return e},e)}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(r){return function(){var e,t=n(r),t=(e=function(){if("undefined"!=typeof Reflect&&Reflect.construct&&!Reflect.construct.sham){if("function"==typeof Proxy)return 1;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),1}catch(e){}}}()?(e=n(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments),this);if(!e||"object"!==i(e)&&"function"!=typeof e){if(void 0!==t)return t;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return e}}function n(e){return(n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function h(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function f(e,t,r){t&&h(e.prototype,t),r&&h(e,r)}s.default.Texture=function(){function n(e,t,r){d(this,n),this._renderer=e;var o=this._renderer.GL,r=(r=r||{},this.src=t,this.glTex=void 0,this.glTarget=o.TEXTURE_2D,this.glFormat=r.format||o.RGBA,this.mipmaps=!1,this.glMinFilter=r.minFilter||o.LINEAR,this.glMagFilter=r.magFilter||o.LINEAR,this.glWrapS=r.wrapS||o.CLAMP_TO_EDGE,this.glWrapT=r.wrapT||o.CLAMP_TO_EDGE,this.glDataType=r.dataType||o.UNSIGNED_BYTE,m(e)),e=(this.glFormat!==o.HALF_FLOAT||r.halfFloat||(console.log("This device does not support dataType HALF_FLOAT. Falling back to FLOAT."),this.glDataType=o.FLOAT),this.glFormat!==o.HALF_FLOAT||this.glMinFilter!==o.LINEAR&&this.glMagFilter!==o.LINEAR||r.halfFloatLinear||(console.log("This device does not support linear filtering for dataType FLOAT. Falling back to NEAREST."),this.glMinFilter===o.LINEAR&&(this.glMinFilter=o.NEAREST),this.glMagFilter===o.LINEAR&&(this.glMagFilter=o.NEAREST)),this.glFormat!==o.FLOAT||r.float||(console.log("This device does not support dataType FLOAT. Falling back to UNSIGNED_BYTE."),this.glDataType=o.UNSIGNED_BYTE),this.glFormat!==o.FLOAT||this.glMinFilter!==o.LINEAR&&this.glMagFilter!==o.LINEAR||r.floatLinear||(console.log("This device does not support linear filtering for dataType FLOAT. Falling back to NEAREST."),this.glMinFilter===o.LINEAR&&(this.glMinFilter=o.NEAREST),this.glMagFilter===o.LINEAR&&(this.glMagFilter=o.NEAREST)),this.isSrcMediaElement=void 0!==s.default.MediaElement&&t instanceof s.default.MediaElement,this._videoPrevUpdateTime=0,this.isSrcHTMLElement=void 0!==s.default.Element&&t instanceof s.default.Element&&!(t instanceof s.default.Graphics)&&!(t instanceof s.default.Renderer),this.isSrcP5Image=t instanceof s.default.Image,this.isSrcP5Graphics=t instanceof s.default.Graphics,this.isSrcP5Renderer=t instanceof s.default.Renderer,this.isImageData="undefined"!=typeof ImageData&&t instanceof ImageData,this.isFramebufferTexture=t instanceof s.default.FramebufferTexture,this._getTextureDataFromSource());return this.width=e.width,this.height=e.height,this.init(e),this}return f(n,[{key:"_getTextureDataFromSource",value:function(){var e;return this.isFramebufferTexture?e=this.src.rawTexture():this.isSrcP5Image?e=this.src.canvas:this.isSrcMediaElement||this.isSrcP5Graphics||this.isSrcP5Renderer||this.isSrcHTMLElement?(this.src._ensureCanvas&&this.src._ensureCanvas(),e=this.src.canvas||this.src.elt):this.isImageData&&(e=this.src),e}},{key:"init",value:function(e){var t,r=this._renderer.GL;this.isFramebufferTexture||(this.glTex=r.createTexture()),this.glWrapS=this._renderer.textureWrapX,this.glWrapT=this._renderer.textureWrapY,this.setWrapMode(this.glWrapS,this.glWrapT),this.bindTexture(),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,this.glMagFilter),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,this.glMinFilter),this.isFramebufferTexture||(0===this.width||0===this.height||this.isSrcMediaElement&&!this.src.loadedmetadata?(t=new Uint8Array([1,1,1,1]),r.texImage2D(this.glTarget,0,r.RGBA,1,1,0,this.glFormat,this.glDataType,t)):r.texImage2D(this.glTarget,0,this.glFormat,this.glFormat,this.glDataType,e))}},{key:"update",value:function(){var e,t,r,o=this.src;return 0!==o.width&&0!==o.height&&(!this.isFramebufferTexture&&(e=this._getTextureDataFromSource(),t=!1,r=this._renderer.GL,e.width!==this.width||e.height!==this.height?(t=!0,this.width=e.width||o.width,this.height=e.height||o.height,this.isSrcP5Image?o.setModified(!1):(this.isSrcMediaElement||this.isSrcHTMLElement)&&o.setModified(!0)):this.isSrcP5Image?o.isModified()&&o.setModified(!(t=!0)):this.isSrcMediaElement?o.isModified()?o.setModified(!(t=!0)):o.loadedmetadata&&this._videoPrevUpdateTime!==o.time()&&(this._videoPrevUpdateTime=o.time(),t=!0):this.isImageData?o._dirty&&(t=!(o._dirty=!1)):t=!0,t&&(this.bindTexture(),r.texImage2D(this.glTarget,0,this.glFormat,this.glFormat,this.glDataType,e)),t))}},{key:"bindTexture",value:function(){return this._renderer.GL.bindTexture(this.glTarget,this.getTexture()),this}},{key:"unbindTexture",value:function(){this._renderer.GL.bindTexture(this.glTarget,null)}},{key:"getTexture",value:function(){return this.isFramebufferTexture?this.src.rawTexture():this.glTex}},{key:"setInterpolation",value:function(e,t){var r=this._renderer.GL;this.glMinFilter=this.glFilter(e),this.glMagFilter=this.glFilter(t),this.bindTexture(),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,this.glMinFilter),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,this.glMagFilter),this.unbindTexture()}},{key:"glFilter",value:function(e){var t=this._renderer.GL;return e===a.NEAREST?t.NEAREST:t.LINEAR}},{key:"setWrapMode",value:function(e,t){function r(e){return 0==(e&e-1)}var o=this._renderer.GL,n=this._getTextureDataFromSource(),n=n.naturalWidth&&n.naturalHeight?(s=n.naturalWidth,n.naturalHeight):(s=this.width,this.height),s=r(s),n=r(n);e===a.REPEAT?this._renderer.webglVersion===a.WEBGL2||s&&n?this.glWrapS=o.REPEAT:(console.warn("You tried to set the wrap mode to REPEAT but the texture size is not a power of two. Setting to CLAMP instead"),this.glWrapS=o.CLAMP_TO_EDGE):e===a.MIRROR?this._renderer.webglVersion===a.WEBGL2||s&&n?this.glWrapS=o.MIRRORED_REPEAT:(console.warn("You tried to set the wrap mode to MIRROR but the texture size is not a power of two. Setting to CLAMP instead"),this.glWrapS=o.CLAMP_TO_EDGE):this.glWrapS=o.CLAMP_TO_EDGE,t===a.REPEAT?this._renderer.webglVersion===a.WEBGL2||s&&n?this.glWrapT=o.REPEAT:(console.warn("You tried to set the wrap mode to REPEAT but the texture size is not a power of two. Setting to CLAMP instead"),this.glWrapT=o.CLAMP_TO_EDGE):t===a.MIRROR?this._renderer.webglVersion===a.WEBGL2||s&&n?this.glWrapT=o.MIRRORED_REPEAT:(console.warn("You tried to set the wrap mode to MIRROR but the texture size is not a power of two. Setting to CLAMP instead"),this.glWrapT=o.CLAMP_TO_EDGE):this.glWrapT=o.CLAMP_TO_EDGE,this.bindTexture(),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,this.glWrapS),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,this.glWrapT),this.unbindTexture()}},{key:"remove",value:function(){this.isFramebufferTexture||void 0===this.glTex||(this._renderer.GL.deleteTexture(this.glTex),this.glTex=void 0)}}]),n}();var p=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&u(t,e);var o=c(n);function n(e,t,r){d(this,n);t=(e=o.call(this,e,t,r))._renderer.GL;return e.glMinFilter===t.LINEAR&&(e.glMinFilter=t.LINEAR_MIPMAP_LINEAR),e}return f(n,[{key:"glFilter",value:function(e){return this._renderer.GL.LINEAR_MIPMAP_LINEAR}},{key:"_getTextureDataFromSource",value:function(){return this.src}},{key:"init",value:function(e){var t=this._renderer.GL;this.glTex=t.createTexture(),this.bindTexture();for(var r=0;r<e.length;r++)t.texImage2D(this.glTarget,r,this.glFormat,this.glFormat,this.glDataType,e[r]);this.glMinFilter=t.LINEAR_MIPMAP_LINEAR,t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,this.glMagFilter),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,this.glMinFilter),this.unbindTexture()}},{key:"update",value:function(){}}]),n}(s.default.Texture);function m(e){var t=e.GL,e=e.webglVersion,r=e===a.WEBGL2?t.getExtension("EXT_color_buffer_float")&&t.getExtension("EXT_float_blend"):t.getExtension("OES_texture_float"),o=r&&t.getExtension("OES_texture_float_linear"),e=e===a.WEBGL2?t.getExtension("EXT_color_buffer_float"):t.getExtension("OES_texture_half_float");return{float:r,floatLinear:o,halfFloat:e,halfFloatLinear:e&&t.getExtension("OES_texture_half_float_linear")}}r.MipmapTexture=p;e=s.default.Texture;r.default=e},{"../core/constants":272,"../core/main":283,"core-js/modules/es.array.iterator":165,"core-js/modules/es.object.get-own-property-descriptor":186,"core-js/modules/es.object.get-prototype-of":188,"core-js/modules/es.object.to-string":190,"core-js/modules/es.reflect.construct":192,"core-js/modules/es.regexp.to-string":196,"core-js/modules/es.string.iterator":200,"core-js/modules/es.symbol":212,"core-js/modules/es.symbol.description":210,"core-js/modules/es.symbol.iterator":211,"core-js/modules/es.typed-array.copy-within":213,"core-js/modules/es.typed-array.every":214,"core-js/modules/es.typed-array.fill":215,"core-js/modules/es.typed-array.filter":216,"core-js/modules/es.typed-array.find":218,"core-js/modules/es.typed-array.find-index":217,"core-js/modules/es.typed-array.for-each":221,"core-js/modules/es.typed-array.includes":222,"core-js/modules/es.typed-array.index-of":223,"core-js/modules/es.typed-array.iterator":226,"core-js/modules/es.typed-array.join":227,"core-js/modules/es.typed-array.last-index-of":228,"core-js/modules/es.typed-array.map":229,"core-js/modules/es.typed-array.reduce":231,"core-js/modules/es.typed-array.reduce-right":230,"core-js/modules/es.typed-array.reverse":232,"core-js/modules/es.typed-array.set":233,"core-js/modules/es.typed-array.slice":234,"core-js/modules/es.typed-array.some":235,"core-js/modules/es.typed-array.sort":236,"core-js/modules/es.typed-array.subarray":237,"core-js/modules/es.typed-array.to-locale-string":238,"core-js/modules/es.typed-array.to-string":239,"core-js/modules/es.typed-array.uint8-array":242,"core-js/modules/es.weak-map":244,"core-js/modules/web.dom-collections.iterator":246}],344:[function(e,t,r){"use strict";function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e){return(i="function"==typeof Symbol&&"symbol"===o(Symbol.iterator)?function(e){return o(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":o(e)})(e)}e("core-js/modules/es.symbol"),e("core-js/modules/es.symbol.description"),e("core-js/modules/es.symbol.iterator"),e("core-js/modules/es.array.iterator"),e("core-js/modules/es.object.get-own-property-descriptor"),e("core-js/modules/es.object.to-string"),e("core-js/modules/es.regexp.exec"),e("core-js/modules/es.string.iterator"),e("core-js/modules/es.string.split"),e("core-js/modules/es.string.sub"),e("core-js/modules/es.weak-map"),e("core-js/modules/web.dom-collections.iterator"),e("core-js/modules/es.symbol"),e("core-js/modules/es.symbol.description"),e("core-js/modules/es.symbol.iterator"),e("core-js/modules/es.array.iterator"),e("core-js/modules/es.object.to-string"),e("core-js/modules/es.regexp.exec"),e("core-js/modules/es.string.iterator"),e("core-js/modules/es.string.split"),e("core-js/modules/es.string.sub"),e("core-js/modules/web.dom-collections.iterator");var n,B=(n=e("../core/main"))&&n.__esModule?n:{default:n},E=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!==i(e)&&"function"!=typeof e)return{default:e};var t=a();if(t&&t.has(e))return t.get(e);var r,o={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(r in e){var s;Object.prototype.hasOwnProperty.call(e,r)&&((s=n?Object.getOwnPropertyDescriptor(e,r):null)&&(s.get||s.set)?Object.defineProperty(o,r,s):o[r]=e[r])}o.default=e,t&&t.set(e,o);return o}(e("../core/constants"));function a(){var e;return"function"!=typeof WeakMap?null:(e=new WeakMap,a=function(){return e},e)}function G(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function V(e,t,r){t&&s(e.prototype,t),r&&s(e,r)}e("./p5.Shader"),e("./p5.RendererGL.Retained"),B.default.RendererGL.prototype._applyTextProperties=function(){this._setProperty("_textAscent",null),this._setProperty("_textDescent",null)},B.default.RendererGL.prototype.textWidth=function(e){return this._isOpenType()?this._textFont._textWidth(e,this._textSize):0};var l=function(){function r(e,t){G(this,r),this.width=e,this.height=t,this.infos=[]}return V(r,[{key:"findImage",value:function(e){var t,r,o=this.width*this.height;if(o<e)throw new Error("font is too complex to rende