The website is coming soon

Join upcoming Breath Medicine Ceremony

"),e.print("")}e.close(),e.clear()},i.prototype.writeFile=function(a,b,c){var d="application/octet-stream";i.prototype._isSafari()&&(d="text/plain");var e=new Blob(a,{type:d});i.prototype.downloadFile(e,b,c)},i.prototype.downloadFile=function(b,c,d){var e=g(c,d),f=e[0];if(b instanceof Blob){return void a("file-saver").saveAs(b,f)}var j=document.createElement("a");if(j.href=b,j.download=f,j.onclick=function(a){h(a),a.stopPropagation()},j.style.display="none",document.body.appendChild(j),i.prototype._isSafari()){var k="Hello, Safari user! To download this file...\n";k+="1. Go to File --\x3e Save As.\n",k+='2. Choose "Page Source" as the Format.\n',k+='3. Name it with this extension: ."'+e[1]+'"',alert(k)}j.click()},i.prototype._checkFileExtension=g,i.prototype._isSafari=function(){return Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>0},b.exports=i},{"../core/core":21,"../core/error_helpers":24,"es6-promise":4,"fetch-jsonp":5,"file-saver":6,"whatwg-fetch":11}],46:[function(a,b,c){"use strict";var d=a("../core/core");d.Table=function(a){this.columns=[],this.rows=[]},d.Table.prototype.addRow=function(a){var b=a||new d.TableRow;if(void 0===b.arr||void 0===b.obj)throw"invalid TableRow: "+b;return b.table=this,this.rows.push(b),b},d.Table.prototype.removeRow=function(a){this.rows[a].table=null;var b=this.rows.splice(a+1,this.rows.length);this.rows.pop(),this.rows=this.rows.concat(b)},d.Table.prototype.getRow=function(a){return this.rows[a]},d.Table.prototype.getRows=function(){return this.rows},d.Table.prototype.findRow=function(a,b){if("string"==typeof b){for(var c=0;c=0))throw'This table has no column named "'+a+'"';c=b[a],d[c]=b}else d[e]=this.rows[e].obj;return d},d.Table.prototype.getArray=function(){for(var a=[],b=0;b=0))throw'This table has no column named "'+a+'"';this.obj[a]=b,this.arr[c]=b}else{if(!(a0},d.XML.prototype.listChildren=function(){return this.children.map(function(a){return a.name})},d.XML.prototype.getChildren=function(a){return a?this.children.filter(function(b){return b.name===a}):this.children},d.XML.prototype.getChild=function(a){if("string"!=typeof a)return this.children[a];for(var b=0;bf&&(f=h),e[g]=h}0===f&&(f=1);for(var i=0,j=0,k=0;k=1&&(s++,v--),w>=1&&(t++,w--),x>=1&&(u++,x--)}return y},e.prototype.noiseDetail=function(a,b){a>0&&(k=a),b>0&&(l=b)},e.prototype.noiseSeed=function(a){var b=function(){var a,b,c=4294967296,d=1664525,e=1013904223;return{setSeed:function(d){b=a=(null==d?Math.random()*c:d)>>>0},getSeed:function(){return a},rand:function(){return(b=(d*b+e)%c)/c}}}();b.setSeed(a),d=new Array(j+1);for(var c=0;ca*a&&this.div(Math.sqrt(b)).mult(a),this},d.Vector.prototype.setMag=function(a){return this.normalize().mult(a)},d.Vector.prototype.heading=function(){var a=Math.atan2(this.y,this.x);return this.p5?this.p5._fromRadians(a):a},d.Vector.prototype.rotate=function(a){var b=this.heading()+a;this.p5&&(b=this.p5._toRadians(b));var c=this.mag();return this.x=Math.cos(b)*c,this.y=Math.sin(b)*c,this},d.Vector.prototype.angleBetween=function(a){var b=this.dot(a)/(this.mag()*a.mag()),c=Math.acos(Math.min(1,Math.max(-1,b)));return this.p5?this.p5._fromRadians(c):c},d.Vector.prototype.lerp=function(a,b,c,e){return a instanceof d.Vector?this.lerp(a.x,a.y,a.z,b):(this.x+=(a-this.x)*e||0,this.y+=(b-this.y)*e||0,this.z+=(c-this.z)*e||0,this)},d.Vector.prototype.array=function(){return[this.x||0,this.y||0,this.z||0]},d.Vector.prototype.equals=function(a,b,c){var e,f,g;return a instanceof d.Vector?(e=a.x||0,f=a.y||0,g=a.z||0):a instanceof Array?(e=a[0]||0,f=a[1]||0,g=a[2]||0):(e=a||0,f=b||0,g=c||0),this.x===e&&this.y===f&&this.z===g},d.Vector.fromAngle=function(a,b){return void 0===b&&(b=1),new d.Vector(b*Math.cos(a),b*Math.sin(a),0)},d.Vector.fromAngles=function(a,b,c){void 0===c&&(c=1);var e=Math.cos(b),f=Math.sin(b),g=Math.cos(a),h=Math.sin(a);return new d.Vector(c*h*f,-c*g,c*h*e)},d.Vector.random2D=function(){return this.fromAngle(Math.random()*e.TWO_PI)},d.Vector.random3D=function(){var a=Math.random()*e.TWO_PI,b=2*Math.random()-1,c=Math.sqrt(1-b*b),f=c*Math.cos(a),g=c*Math.sin(a);return new d.Vector(f,g,b)},d.Vector.add=function(a,b,c){return c?c.set(a):c=a.copy(),c.add(b),c},d.Vector.sub=function(a,b,c){return c?c.set(a):c=a.copy(),c.sub(b),c},d.Vector.mult=function(a,b,c){return c?c.set(a):c=a.copy(),c.mult(b),c},d.Vector.div=function(a,b,c){return c?c.set(a):c=a.copy(),c.div(b),c},d.Vector.dot=function(a,b){return a.dot(b)},d.Vector.cross=function(a,b){return a.cross(b)},d.Vector.dist=function(a,b){return a.dist(b)},d.Vector.lerp=function(a,b,c,d){return d?d.set(a):d=a.copy(),d.lerp(b,c),d},d.Vector.mag=function(a){var b=a.x,c=a.y,d=a.z,e=b*b+c*c+d*d;return Math.sqrt(e)},b.exports=d.Vector},{"../core/constants":20,"../core/core":21}],53:[function(a,b,c){"use strict";var d=a("../core/core"),e=!1,f=!1,g=0,h=function(){var a,b,c=4294967296,d=1664525,e=1013904223;return{setSeed:function(d){b=a=(null==d?Math.random()*c:d)>>>0},getSeed:function(){return a},rand:function(){return(b=(d*b+e)%c)/c}}}();d.prototype.randomSeed=function(a){h.setSeed(a),e=!0,f=!1},d.prototype.random=function(a,b){var c;if(c=e?h.rand():Math.random(),void 0===a)return c;if(void 0===b)return a instanceof Array?a[Math.floor(c*a.length)]:c*a;if(a>b){var d=a;a=b,b=d}return c*(b-a)+a},d.prototype.randomGaussian=function(a,b){var c,d,e,h;if(f)c=g,f=!1;else{do{d=this.random(2)-1,e=this.random(2)-1,h=d*d+e*e}while(h>=1);h=Math.sqrt(-2*Math.log(h)/h),c=d*h,g=e*h,f=!0}var i=a||0;return c*(b||1)+i},b.exports=d},{"../core/core":21}],54:[function(a,b,c){"use strict";var d=a("../core/core"),e=a("../core/constants");d.prototype._angleMode=e.RADIANS,d.prototype.acos=function(a){return this._fromRadians(Math.acos(a))},d.prototype.asin=function(a){return this._fromRadians(Math.asin(a))},d.prototype.atan=function(a){return this._fromRadians(Math.atan(a))},d.prototype.atan2=function(a,b){return this._fromRadians(Math.atan2(a,b))},d.prototype.cos=function(a){return Math.cos(this._toRadians(a))},d.prototype.sin=function(a){return Math.sin(this._toRadians(a))},d.prototype.tan=function(a){return Math.tan(this._toRadians(a))},d.prototype.degrees=function(a){return a*e.RAD_TO_DEG},d.prototype.radians=function(a){return a*e.DEG_TO_RAD},d.prototype.angleMode=function(a){a!==e.DEGREES&&a!==e.RADIANS||(this._angleMode=a)},d.prototype._toRadians=function(a){return this._angleMode===e.DEGREES?a*e.DEG_TO_RAD:a},d.prototype._toDegrees=function(a){return this._angleMode===e.RADIANS?a*e.RAD_TO_DEG:a},d.prototype._fromRadians=function(a){return this._angleMode===e.DEGREES?a*e.RAD_TO_DEG:a},b.exports=d},{"../core/constants":20,"../core/core":21}],55:[function(a,b,c){"use strict";var d=a("../core/core");d.prototype.textAlign=function(a,b){return d._validateParameters("textAlign",arguments),this._renderer.textAlign.apply(this._renderer,arguments)},d.prototype.textLeading=function(a){return d._validateParameters("textLeading",arguments),this._renderer.textLeading.apply(this._renderer,arguments)},d.prototype.textSize=function(a){return d._validateParameters("textSize",arguments),this._renderer.textSize.apply(this._renderer,arguments)},d.prototype.textStyle=function(a){return d._validateParameters("textStyle",arguments),this._renderer.textStyle.apply(this._renderer,arguments)},d.prototype.textWidth=function(a){return d._validateParameters("textWidth",arguments),0===a.length?0:this._renderer.textWidth.apply(this._renderer,arguments)},d.prototype.textAscent=function(){return d._validateParameters("textAscent",arguments),this._renderer.textAscent()},d.prototype.textDescent=function(){return d._validateParameters("textDescent",arguments),this._renderer.textDescent()},d.prototype._updateTextMetrics=function(){return this._renderer._updateTextMetrics()},b.exports=d},{"../core/core":21}],56:[function(a,b,c){"use strict";var d=a("../core/core"),e=a("../core/constants"),f=a("opentype.js");a("../core/error_helpers"),d.prototype.loadFont=function(a,b,c){d._validateParameters("loadFont",arguments);var e=new d.Font(this),g=this;return f.load(a,function(f,h){if(f)return void 0!==c?c(f):(d._friendlyFileLoadError(4,a),void console.error(f,a));e.font=h,void 0!==b&&b(e),g._decrementPreload();var i,j,k=["ttf","otf","woff","woff2"],l=a.split("\\").pop().split("/").pop(),m=l.lastIndexOf("."),n=m<1?null:l.substr(m+1);k.indexOf(n)>-1&&(i=l.substr(0,m),j=document.createElement("style"),j.appendChild(document.createTextNode("\n@font-face {\nfont-family: "+i+";\nsrc: url("+a+");\n}\n")),document.head.appendChild(j))}),e},d.prototype.text=function(a,b,c,e,f){return d._validateParameters("text",arguments),this._renderer._doFill||this._renderer._doStroke?this._renderer.text.apply(this._renderer,arguments):this},d.prototype.textFont=function(a,b){if(d._validateParameters("textFont",arguments),arguments.length){if(!a)throw Error("null font passed to textFont");return this._renderer._setProperty("_textFont",a),b&&(this._renderer._setProperty("_textSize",b),this._renderer._setProperty("_textLeading",b*e._DEFAULT_LEADMULT)),this._renderer._applyTextProperties()}return this._renderer._textFont},b.exports=d},{"../core/constants":20,"../core/core":21,"../core/error_helpers":24,"opentype.js":9}],57:[function(a,b,c){"use strict";function d(a,b){for(var c=h(b,{sampleFactor:.1,simplifyThreshold:0}),d=n(a,0,1),f=d/(d*c.sampleFactor),g=[],i=0;i3&&d>=0;--d)j(i(a,d-1),i(a,d),i(a,d+1),b)&&(a.splice(d%a.length,1),c++);return c}function f(a){for(var b,c=[],d=0;ds||rb&&!c)return h=m(d,e,f[1],f[2],f[3],f[4],f[5],f[6],b-k),{x:h.x,y:h.y,alpha:h.alpha};k+=g,d=+f[5],e=+f[6]}i+=f.shift()+f}return j.end=i,h=c?k:l(d,e,f[0],f[1],f[2],f[3],f[4],f[5],1),h.alpha&&(h={x:h.x,y:h.y,alpha:h.alpha}),h}function o(a){var b=[],c=0,d=0,e=0,f=0,g=0;if(!a)return b;"M"===a[0][0]&&(c=+a[0][1],d=+a[0][2],e=c,f=d,g++,b[0]=["M",c,d]);for(var h,i,j,k=3===a.length&&"M"===a[0][0]&&"R"===a[1][0].toUpperCase()&&"Z"===a[2][0].toUpperCase(),l=g,m=a.length;l7){a[b].shift();for(var f=a[b];f.length;)h[b]="A",e&&(i[b]="A"),a.splice(b++,0,["C"].concat(f.splice(0,6)));a.splice(b,1),c=Math.max(d.length,e&&e.length||0)}},l=function(a,b,f,g,h){a&&b&&"M"===a[h][0]&&"M"!==b[h][0]&&(b.splice(h,0,["M",g.x,g.y]),f.bx=0,f.by=0,f.x=a[h][1],f.y=a[h][2],c=Math.max(d.length,e&&e.length||0))},m="",n="";c=Math.max(d.length,e&&e.length||0);for(var p=0;p1&&(x=Math.sqrt(x),c*=x,d*=x);var y=c*c,z=d*d,A=(f===g?-1:1)*Math.sqrt(Math.abs((y*z-y*w*w-z*v*v)/(y*w*w+z*v*v)));m=A*c*w/d+(a+h)/2,n=A*-d*v/c+(b+i)/2,k=Math.asin(((b-n)/d).toFixed(9)),l=Math.asin(((i-n)/d).toFixed(9)),k=al&&(k-=2*p),!g&&l>k&&(l-=2*p)}var B=l-k;if(Math.abs(B)>r){var C=l,D=h,E=i;l=k+r*(g&&l>k?1:-1),h=m+c*Math.cos(l),i=n+d*Math.sin(l),t=q(h,i,c,d,e,0,g,D,E,[l,C,m,n])}B=l-k;var F=Math.cos(k),G=Math.sin(k),H=Math.cos(l),I=Math.sin(l),J=Math.tan(B/4),K=4/3*c*J,L=4/3*d*J,M=[a,b],N=[a+K*G,b-L*F],O=[h+K*I,i-L*H],P=[h,i];if(N[0]=2*M[0]-N[0],N[1]=2*M[1]-N[1],j)return[N,O,P].concat(t);t=[N,O,P].concat(t).join().split(",");for(var Q=[],R=0,S=t.length;Rd;d+=2){var f=[{x:+a[d-2],y:+a[d-1]},{x:+a[d],y:+a[d+1]},{x:+a[d+2],y:+a[d+3]},{x:+a[d+4],y:+a[d+5]}];b?d?e-4===d?f[3]={x:+a[0],y:+a[1]}:e-2===d&&(f[2]={x:+a[0],y:+a[1]},f[3]={x:+a[2],y:+a[3]}):f[0]={x:+a[e-2],y:+a[e-1]}:e-4===d?f[3]=f[2]:d||(f[0]={x:+a[d],y:+a[d+1]}),c.push(["C",(-f[0].x+6*f[1].x+f[2].x)/6,(-f[0].y+6*f[1].y+f[2].y)/6,(f[1].x+6*f[2].x-f[3].x)/6,(f[1].y+6*f[2].y-f[3].y)/6,f[2].x,f[2].y])}return c}function s(a,b,c,d){return[a,b,c,d,c,d]}function t(a,b,c,d,e,f){var g=1/3,h=2/3;return[g*a+h*c,g*b+h*d,g*e+h*c,g*f+h*d,e,f]}function u(a,b,c,d,e,f,g,h,i){null==i&&(i=1),i=i>1?1:i<0?0:i;for(var j=i/2,k=12,l=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],m=0,n=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],o=0;on;)l/=2,m+=(j=0;--b){var c=arguments[b];a+=c===Object(c)?JSON.stringify(c):c}return a}var y=a("../core/core"),z=a("../core/constants");y.Font=function(a){this.parent=a,this.cache={},this.font=void 0},y.Font.prototype.list=function(){throw"not yet implemented"},y.Font.prototype.textBounds=function(a,b,c,d,e){b=void 0!==b?b:0,c=void 0!==c?c:0,d=d||this.parent._renderer._textSize ;var f=e&&e.renderer&&e.renderer._pInst||this.parent,g=f._renderer.drawingContext,h=g.textAlign||z.LEFT,i=g.textBaseline||z.BASELINE,j=x("textBounds",a,b,c,d,h,i),k=this.cache[j];if(!k){var l,m,n,o,p,q=[],r=[],s=this._scale(d);this.font.forEachGlyph(a,b,c,d,e,function(a,b,c,d){var e=a.getMetrics();q.push(b+e.xMin*s),q.push(b+e.xMax*s),r.push(c+-e.yMin*s),r.push(c+-e.yMax*s)}),l=Math.min.apply(null,q),m=Math.min.apply(null,r),n=Math.max.apply(null,q),o=Math.max.apply(null,r),k={x:l,y:m,h:o-m,w:n-l,advance:l-b},p=this._handleAlignment(f,g,a,k.x,k.y,k.w+k.advance),k.x=p.x,k.y=p.y,this.cache[x("textBounds",a,b,c,d,h,i)]=k}return k},y.Font.prototype.textToPoints=function(a,b,c,e,g){function h(b){return k[b].name&&"space"===k[b].name||a.length===k.length&&" "===a[b]||k[b].index&&3===k[b].index}var i=0,j=[],k=this._getGlyphs(a);e=e||this.parent._renderer._textSize;for(var l=0;l2?a=this._getPath(a,b,c,d):"object"==typeof b&&(d=b),d&&"number"==typeof d.decimals&&(e=d.decimals),a.toPathData(e)},y.Font.prototype._getSVG=function(a,b,c,d){var e=3;return"string"==typeof a&&arguments.length>2?a=this._getPath(a,b,c,d):"object"==typeof b&&(d=b),d&&("number"==typeof d.decimals&&(e=d.decimals),"number"==typeof d.strokeWidth&&(a.strokeWidth=d.strokeWidth),void 0!==d.fill&&(a.fill=d.fill),void 0!==d.stroke&&(a.stroke=d.stroke)),a.toSVG(e)},y.Font.prototype._renderPath=function(a,b,c,d){var e,f=d&&d.renderer||this.parent._renderer,g=f.drawingContext;e="object"==typeof a&&a.commands?a.commands:this._getPath(a,b,c,d).commands,g.beginPath();for(var h=0;h1;)d=Math.random()*f|0,e=a[--f],a[f]=a[d],a[d]=e;return a},d.prototype.sort=function(a,b){var c=b?a.slice(0,Math.min(b,a.length)):a,d=b?a.slice(Math.min(b,a.length)):[];return c="string"==typeof c[0]?c.sort():c.sort(function(a,b){return a-b}),c.concat(d)},d.prototype.splice=function(a,b,c){return Array.prototype.splice.apply(a,[c,0].concat(b)),a},d.prototype.subset=function(a,b,c){return void 0!==c?a.slice(b,b+c):a.slice(b,a.length)},b.exports=d},{"../core/core":21}],59:[function(a,b,c){"use strict";var d=a("../core/core");d.prototype.float=function(a){return a instanceof Array?a.map(parseFloat):parseFloat(a)},d.prototype.int=function(a,b){return b=b||10,"string"==typeof a?parseInt(a,b):"number"==typeof a?0|a:"boolean"==typeof a?a?1:0:a instanceof Array?a.map(function(a){return d.prototype.int(a,b)}):void 0},d.prototype.str=function(a){return a instanceof Array?a.map(d.prototype.str):String(a)},d.prototype.boolean=function(a){return"number"==typeof a?0!==a:"string"==typeof a?"true"===a.toLowerCase():"boolean"==typeof a?a:a instanceof Array?a.map(d.prototype.boolean):void 0},d.prototype.byte=function(a){var b=d.prototype.int(a,10);return"number"==typeof b?(b+128)%256-128:b instanceof Array?b.map(d.prototype.byte):void 0},d.prototype.char=function(a){return"number"!=typeof a||isNaN(a)?a instanceof Array?a.map(d.prototype.char):"string"==typeof a?d.prototype.char(parseInt(a,10)):void 0:String.fromCharCode(a)},d.prototype.unchar=function(a){return"string"==typeof a&&1===a.length?a.charCodeAt(0):a instanceof Array?a.map(d.prototype.unchar):void 0},d.prototype.hex=function(a,b){if(b=void 0===b||null===b?b=8:b,a instanceof Array)return a.map(function(a){return d.prototype.hex(a,b)});if("number"==typeof a){a<0&&(a=4294967295+a+1);for(var c=Number(a).toString(16).toUpperCase();c.length=b&&(c=c.substring(c.length-b,c.length)),c}},d.prototype.unhex=function(a){return a instanceof Array?a.map(d.prototype.unhex):parseInt("0x"+a,16)},b.exports=d},{"../core/core":21}],60:[function(a,b,c){"use strict";function d(a,b,c){var d=a<0,e=d?a.toString().substring(1):a.toString(),f=e.indexOf("."),g=-1!==f?e.substring(0,f):e,h=-1!==f?e.substring(f+1):"",i=d?"-":"";if(void 0!==c){var j="";(-1!==f||c-h.length>0)&&(j="."),h.length>c&&(h=h.substring(0,c));for(var k=0;kd.length){d+=-1===c?".":"";for(var f=b-d.length+1,g=0;g0?"+"+a.toString():a.toString()}function g(a){return parseFloat(a)>0?" "+a.toString():a.toString()}var h=a("../core/core");a("../core/error_helpers"),h.prototype.join=function(a,b){return h._validateParameters("join",arguments),a.join(b)},h.prototype.match=function(a,b){return h._validateParameters("match",arguments),a.match(b)},h.prototype.matchAll=function(a,b){h._validateParameters("matchAll",arguments);for(var c=new RegExp(b,"g"),d=c.exec(a),e=[];null!==d;)e.push(d),d=c.exec(a);return e},h.prototype.nf=function(a,b,c){return h._validateParameters("nf",arguments),a instanceof Array?a.map(function(a){return d(a,b,c)}):"[object Arguments]"===Object.prototype.toString.call(a)?3===a.length?this.nf(a[0],a[1],a[2]):2===a.length?this.nf(a[0],a[1]):this.nf(a[0]):d(a,b,c)},h.prototype.nfc=function(a,b){return h._validateParameters("nfc",arguments),a instanceof Array?a.map(function(a){return e(a,b)}):e(a,b)},h.prototype.nfp=function(){h._validateParameters("nfp",arguments);var a=h.prototype.nf.apply(this,arguments);return a instanceof Array?a.map(f):f(a)},h.prototype.nfs=function(){h._validateParameters("nfs",arguments);var a=h.prototype.nf.apply(this,arguments);return a instanceof Array?a.map(g):g(a)},h.prototype.split=function(a,b){return h._validateParameters("split",arguments),a.split(b)},h.prototype.splitTokens=function(a,b){h._validateParameters("splitTokens",arguments);var c;if(void 0!==b){var d=b,e=/\]/g.exec(d),f=/\[/g.exec(d);f&&e?(d=d.slice(0,e.index)+d.slice(e.index+1),f=/\[/g.exec(d),d=d.slice(0,f.index)+d.slice(f.index+1),c=new RegExp("[\\["+d+"\\]]","g")):e?(d=d.slice(0,e.index)+d.slice(e.index+1),c=new RegExp("["+d+"\\]]","g")):f?(d=d.slice(0,f.index)+d.slice(f.index+1),c=new RegExp("["+d+"\\[]","g")):c=new RegExp("["+d+"]","g")}else c=/\s/g;return a.split(c).filter(function(a){return a})},h.prototype.trim=function(a){return h._validateParameters("trim",arguments),a instanceof Array?a.map(this.trim):a.trim()},b.exports=h},{"../core/core":21,"../core/error_helpers":24}],61:[function(a,b,c){"use strict";var d=a("../core/core");d.prototype.day=function(){return(new Date).getDate()},d.prototype.hour=function(){return(new Date).getHours()},d.prototype.minute=function(){return(new Date).getMinutes()},d.prototype.millis=function(){return window.performance.now()},d.prototype.month=function(){return(new Date).getMonth()+1},d.prototype.second=function(){return(new Date).getSeconds()},d.prototype.year=function(){return(new Date).getFullYear()},b.exports=d},{"../core/core":21}],62:[function(a,b,c){"use strict";var d=a("../core/core");d.prototype.camera=function(){return this._assert3d("camera"),d._validateParameters("camera",arguments),this._renderer.camera.apply(this._renderer,arguments),this},d.RendererGL.prototype.camera=function(a,b,c,d,e,f,g,h,i){void 0===a&&(a=this.defaultCameraX,b=this.defaultCameraY,c=this.defaultCameraZ,d=a,e=b,f=0,g=0,h=1,i=0),this.cameraX=a,this.cameraY=b,this.cameraZ=c;var j=a-d,k=b-e,l=c-f;this.eyeDist=Math.sqrt(j*j+k*k+l*l),0!==this.eyeDist&&(j/=this.eyeDist,k/=this.eyeDist,l/=this.eyeDist);var m=g,n=h,o=i,p=n*l-o*k,q=-m*l+o*j,r=m*k-n*j;m=k*r-l*q,n=-j*r+l*p,o=j*q-k*p;var s=Math.sqrt(p*p+q*q+r*r);0!==s&&(p/=s,q/=s,r/=s);var t=Math.sqrt(m*m+n*n+o*o);0!==t&&(m/=t,n/=t,o/=t),this.cameraMatrix.set(p,m,j,0,q,n,k,0,r,o,l,0,0,0,0,1);var u=-a,v=-b,w=-c;return this.cameraMatrix.translate([u,v,w]),this.uMVMatrix.set(this.cameraMatrix.mat4[0],this.cameraMatrix.mat4[1],this.cameraMatrix.mat4[2],this.cameraMatrix.mat4[3],this.cameraMatrix.mat4[4],this.cameraMatrix.mat4[5],this.cameraMatrix.mat4[6],this.cameraMatrix.mat4[7],this.cameraMatrix.mat4[8],this.cameraMatrix.mat4[9],this.cameraMatrix.mat4[10],this.cameraMatrix.mat4[11],this.cameraMatrix.mat4[12],this.cameraMatrix.mat4[13],this.cameraMatrix.mat4[14],this.cameraMatrix.mat4[15]),this},d.prototype.perspective=function(){return this._assert3d("perspective"),d._validateParameters("perspective",arguments),this._renderer.perspective.apply(this._renderer,arguments),this},d.RendererGL.prototype.perspective=function(a,b,c,e){void 0===a&&(a=this.defaultCameraFOV),void 0===b&&(b=this.defaultCameraAspect),void 0===c&&(c=this.defaultCameraNear),void 0===e&&(e=this.defaultCameraFar),this.cameraFOV=this._pInst._toRadians(a),this.cameraAspect=b,this.cameraNear=c,this.cameraFar=e,this.uPMatrix=d.Matrix.identity();var f=1/Math.tan(this.cameraFOV/2),g=1/(this.cameraNear-this.cameraFar);this.uPMatrix.set(f/b,0,0,0,0,-f,0,0,0,0,(e+c)*g,-1,0,0,2*e*c*g,0),this._curCamera="custom"},d.prototype.ortho=function(){return this._assert3d("ortho"),d._validateParameters("ortho",arguments),this._renderer.ortho.apply(this._renderer,arguments),this},d.RendererGL.prototype.ortho=function(a,b,c,e,f,g){void 0===a&&(a=-this.width/2),void 0===b&&(b=+this.width/2),void 0===c&&(c=-this.height/2),void 0===e&&(e=+this.height/2),void 0===f&&(f=0),void 0===g&&(g=Math.max(this.width,this.height));var h=b-a,i=e-c,j=g-f,k=2/h,l=2/i,m=-2/j,n=-(b+a)/h,o=-(e+c)/i,p=-(g+f)/j;this.uPMatrix=d.Matrix.identity(),this.uPMatrix.set(k,0,0,0,0,-l,0,0,0,0,m,0,n,o,p,1),this._curCamera="custom"},b.exports=d},{"../core/core":21}],63:[function(a,b,c){"use strict";var d=a("../core/core");d.prototype.orbitControl=function(){return this._assert3d("orbitControl"),d._validateParameters("orbitControl",arguments),this.mouseIsPressed&&(this.rotateY((this.mouseX-this.width/2)/(this.width/2)),this.rotateX((this.mouseY-this.height/2)/(this.width/2))),this},b.exports=d},{"../core/core":21}],64:[function(a,b,c){"use strict";var d=a("../core/core");d.prototype.ambientLight=function(a,b,c,e){this._assert3d("ambientLight"),d._validateParameters("ambientLight",arguments);var f=this.color.apply(this,arguments),g=this._renderer._useLightShader();return g.setUniform("uUseLighting",!0),g.setUniform("uMaterialColor",this._renderer.curFillColor),this._renderer.ambientLightColors.push(f._array[0],f._array[1],f._array[2]),g.setUniform("uAmbientColor",this._renderer.ambientLightColors),g.setUniform("uAmbientLightCount",this._renderer.ambientLightColors.length/3),this},d.prototype.directionalLight=function(a,b,c,e,f,g){this._assert3d("directionalLight"),d._validateParameters("directionalLight",arguments);var h,i,j,k=this._renderer._useLightShader(),l=this.color.apply(this,[a,b,c]),m=arguments[arguments.length-1];"number"==typeof m?(h=arguments[arguments.length-3],i=arguments[arguments.length-2],j=arguments[arguments.length-1]):(h=m.x,i=m.y,j=m.z),k.setUniform("uUseLighting",!0),k.setUniform("uMaterialColor",this._renderer.curFillColor);var n=Math.sqrt(h*h+i*i+j*j);return this._renderer.directionalLightDirections.push(h/n,i/n,j/n),k.setUniform("uLightingDirection",this._renderer.directionalLightDirections),this._renderer.directionalLightColors.push(l._array[0],l._array[1],l._array[2]),k.setUniform("uDirectionalColor",this._renderer.directionalLightColors),k.setUniform("uDirectionalLightCount",this._renderer.directionalLightColors.length/3),this},d.prototype.pointLight=function(a,b,c,e,f,g){this._assert3d("pointLight"),d._validateParameters("pointLight",arguments);var h,i,j,k=this._renderer._pInst.color.apply(this,[a,b,c]),l=arguments[arguments.length-1];"number"==typeof l?(h=arguments[arguments.length-3],i=arguments[arguments.length-2],j=arguments[arguments.length-1]):(h=l.x,i=l.y,j=l.z);var m=this._renderer._useLightShader();return m.setUniform("uUseLighting",!0),m.setUniform("uMaterialColor",this._renderer.curFillColor),this._renderer.pointLightPositions.push(h,i,j),m.setUniform("uPointLightLocation",this._renderer.pointLightPositions),this._renderer.pointLightColors.push(k._array[0],k._array[1],k._array[2]),m.setUniform("uPointLightColor",this._renderer.pointLightColors),m.setUniform("uPointLightCount",this._renderer.pointLightColors.length/3),this},b.exports=d},{"../core/core":21}],65:[function(a,b,c){"use strict";function d(a,b){for(var c={v:[],vt:[],vn:[]},d={},f=0;f0)if("v"===g[0]||"vn"===g[0]){var h=new e.Vector(parseFloat(g[1]),parseFloat(g[2]),parseFloat(g[3]));c[g[0]].push(h)}else if("vt"===g[0]){var i=[parseFloat(g[1]),parseFloat(g[2])];c[g[0]].push(i)}else if("f"===g[0])for(var j=3;j0&&(this._renderer.geometryInHash(a.gid)||(a._makeTriangleEdges()._edgesToVertices(),this._renderer.createBuffers(a.gid,a)),this._renderer.drawBuffers(a.gid))},b.exports=e},{"../core/core":21,"./p5.Geometry":67}],66:[function(a,b,c){"use strict";var d=a("../core/core"),e=a("../core/constants");a("./p5.Texture"),d.prototype.loadShader=function(a,b){d._validateParameters("loadShader",arguments);var c=new d.Shader,e=this,f=!1,g=!1;return this.loadStrings(b,function(a){c._fragSrc=a.join("\n"),f=!0,g&&e._decrementPreload()}),this.loadStrings(a,function(a){c._vertSrc=a.join("\n"),g=!0,f&&e._decrementPreload()}),c},d.prototype.createShader=function(a,b){return this._assert3d("createShader"),d._validateParameters("createShader",arguments),new d.Shader(this._renderer,a,b)},d.prototype.shader=function(a){return this._assert3d("shader"),d._validateParameters("shader",arguments),void 0===a._renderer&&(a._renderer=this._renderer),a.isStrokeShader()?this._renderer.setStrokeShader(a):this._renderer.setFillShader(a),this},d.prototype.normalMaterial=function(){return this._assert3d("normalMaterial"),d._validateParameters("normalMaterial",arguments),this._renderer.drawMode=e.FILL,this._renderer.setFillShader(this._renderer._getNormalShader()),this._renderer.curFillColor=[1,1,1,1],this.noStroke(),this},d.prototype.texture=function(a){this._assert3d("texture"),d._validateParameters("texture",arguments),this._renderer.drawMode=e.TEXTURE;var b=this._renderer._useLightShader();return b.setUniform("uSpecular",!1),b.setUniform("isTexture",!0),b.setUniform("uSampler",a),this.noStroke(),this},d.prototype.ambientMaterial=function(a,b,c,e){this._assert3d("ambientMaterial"),d._validateParameters("ambientMaterial",arguments);var f=d.prototype.color.apply(this,arguments);this._renderer.curFillColor=f._array;var g=this._renderer._useLightShader();return g.setUniform("uMaterialColor",this._renderer.curFillColor),g.setUniform("uSpecular",!1),g.setUniform("isTexture",!1),this},d.prototype.specularMaterial=function(a,b,c,e){this._assert3d("specularMaterial"),d._validateParameters("specularMaterial",arguments);var f=d.prototype.color.apply(this,arguments);this._renderer.curFillColor=f._array;var g=this._renderer._useLightShader();return g.setUniform("uMaterialColor",this._renderer.curFillColor),g.setUniform("uSpecular",!0),g.setUniform("isTexture",!1),this},d.RendererGL.prototype._applyColorBlend=function(a){var b=this.GL,c=this.drawMode===e.TEXTURE;return c||a[a.length-1]<1?(b.depthMask(c),b.enable(b.BLEND),b.blendEquation(b.FUNC_ADD),b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA)):(b.depthMask(!0),b.disable(b.BLEND)),a},b.exports=d},{"../core/constants":20,"../core/core":21,"./p5.Texture":73}],67:[function(a,b,c){"use strict";var d=a("../core/core");d.Geometry=function(a,b,c){return this.vertices=[],this.lineVertices=[],this.lineNormals=[],this.vertexNormals=[],this.faces=[],this.uvs=[],this.edges=[],this.detailX=void 0!==a?a:1,this.detailY=void 0!==b?b:1,c instanceof Function&&c.call(this),this},d.Geometry.prototype.computeFaces=function(){this.faces.length=0;for(var a,b,c,d,e=this.detailX+1,f=0;f1&&(k=1),i.mult(Math.asin(k)/j))},d.Geometry.prototype.computeNormals=function(){var a,b=this.vertexNormals,c=this.vertices,e=this.faces;for(b.length=0,a=0;athis.vertices.length-1-this.detailX;b--)a.add(this.vertexNormals[b]);for(a=d.Vector.div(a,this.detailX),b=this.vertices.length-1;b>this.vertices.length-1-this.detailX;b--)this.vertexNormals[b]=a;return this},d.Geometry.prototype._makeTriangleEdges=function(){if(this.edges.length=0,Array.isArray(this.strokeIndices))for(var a=0,b=this.strokeIndices.length;a0){for(var a=this.vertices[0].copy(),b=this.vertices[0].copy(),c=0;c1e3){var b=Object.keys(this.gHash)[0];delete this.gHash[b],e--}this.gHash[a]={}},d.RendererGL.prototype._freeBuffers=function(a){var b=this.gHash[a];if(b){delete this.gHash[a],e--;var c=this.GL;b.vertexBuffer&&c.deleteBuffer(b.vertexBuffer),b.normalBuffer&&c.deleteBuffer(b.normalBuffer),b.lineNormalBuffer&&c.deleteBuffer(b.lineNormalBuffer),b.uvBuffer&&c.deleteBuffer(b.uvBuffer),b.indexBuffer&&c.deleteBuffer(b.indexBuffer),b.lineVertexBuffer&&c.deleteBuffer(b.lineVertexBuffer)}},d.RendererGL.prototype.createBuffers=function(a,b){var c=this.GL;this._setDefaultCamera(),this._initBufferDefaults(a);var d=this.gHash[a];d.numberOfItems=3*b.faces.length,d.lineVertexCount=b.lineVertices.length,this._useColorShader(),this.curStrokeShader.attributes.aPosition&&(d.lineVertexBuffer=c.createBuffer(),this._bindBuffer(d.lineVertexBuffer,c.ARRAY_BUFFER,this._flatten(b.lineVertices),Float32Array,c.STATIC_DRAW),this.curStrokeShader.enableAttrib(this.curStrokeShader.attributes.aPosition.location,3,c.FLOAT,!1,0,0)),this.curStrokeShader.attributes.aDirection&&(d.lineNormalBuffer=c.createBuffer(),this._bindBuffer(d.lineNormalBuffer,c.ARRAY_BUFFER,this._flatten(b.lineNormals),Float32Array,c.STATIC_DRAW),this.curStrokeShader.enableAttrib(this.curStrokeShader.attributes.aDirection.location,4,c.FLOAT,!1,0,0)),this.curFillShader.attributes.aPosition&&(d.vertexBuffer=c.createBuffer(),this._bindBuffer(d.vertexBuffer,c.ARRAY_BUFFER,this._vToNArray(b.vertices),Float32Array,c.STATIC_DRAW),this.curFillShader.enableAttrib(this.curFillShader.attributes.aPosition.location,3,c.FLOAT,!1,0,0)),d.indexBuffer=c.createBuffer(),this._bindBuffer(d.indexBuffer,c.ELEMENT_ARRAY_BUFFER,this._flatten(b.faces),Uint16Array,c.STATIC_DRAW),this.curFillShader.attributes.aNormal&&(d.normalBuffer=c.createBuffer(),this._bindBuffer(d.normalBuffer,c.ARRAY_BUFFER,this._vToNArray(b.vertexNormals),Float32Array,c.STATIC_DRAW),this.curFillShader.enableAttrib(this.curFillShader.attributes.aNormal.location,3,c.FLOAT,!1,0,0)),this.curFillShader.attributes.aTexCoord&&(d.uvBuffer=c.createBuffer(),this._bindBuffer(d.uvBuffer,c.ARRAY_BUFFER,this._flatten(b.uvs),Float32Array,c.STATIC_DRAW),this.curFillShader.enableAttrib(this.curFillShader.attributes.aTexCoord.location,2,c.FLOAT,!1,0,0))},d.RendererGL.prototype.drawBuffers=function(a){this._setDefaultCamera();var b=this.GL;this._useColorShader();var c=this.gHash[a];return this._doStroke&&c.lineVertexCount>0&&(this.curStrokeShader.bindShader(),c.lineVertexBuffer&&(this._bindBuffer(c.lineVertexBuffer,b.ARRAY_BUFFER),this.curStrokeShader.enableAttrib(this.curStrokeShader.attributes.aPosition.location,3,b.FLOAT,!1,0,0)),c.lineNormalBuffer&&(this._bindBuffer(c.lineNormalBuffer,b.ARRAY_BUFFER),this.curStrokeShader.enableAttrib(this.curStrokeShader.attributes.aDirection.location,4,b.FLOAT,!1,0,0)),this._applyColorBlend(this.curStrokeColor),this._drawArrays(b.TRIANGLES,a),this.curStrokeShader.unbindShader()),!1!==this._doFill&&(this.curFillShader.bindShader(),c.vertexBuffer&&(this._bindBuffer(c.vertexBuffer,b.ARRAY_BUFFER),this.curFillShader.enableAttrib(this.curFillShader.attributes.aPosition.location,3,b.FLOAT,!1,0,0)),c.indexBuffer&&this._bindBuffer(c.indexBuffer,b.ELEMENT_ARRAY_BUFFER),c.normalBuffer&&(this._bindBuffer(c.normalBuffer,b.ARRAY_BUFFER),this.curFillShader.enableAttrib(this.curFillShader.attributes.aNormal.location,3,b.FLOAT,!1,0,0)),c.uvBuffer&&(this._bindBuffer(c.uvBuffer,b.ARRAY_BUFFER),this.curFillShader.enableAttrib(this.curFillShader.attributes.aTexCoord.location,2,b.FLOAT,!1,0,0)),this._applyColorBlend(this.curFillColor),this._drawElements(b.TRIANGLES,a),this.curFillShader.unbindShader()),this},d.RendererGL.prototype.drawBuffersScaled=function(a,b,c,d){var e=this.uMVMatrix.copy();try{this.uMVMatrix.scale(b,c,d),this.drawBuffers(a)}finally{this.uMVMatrix=e}},d.RendererGL.prototype._drawArrays=function(a,b){return this.GL.drawArrays(a,0,this.gHash[b].lineVertexCount),this},d.RendererGL.prototype._drawElements=function(a,b){this.GL.drawElements(a,this.gHash[b].numberOfItems,this.GL.UNSIGNED_SHORT,0)},b.exports=d.RendererGL},{"../core/core":21}],71:[function(a,b,c){"use strict";var d=a("../core/core"),e=a("../core/constants");a("./p5.Shader"),a("../core/p5.Renderer"),a("./p5.Matrix");var f={immediateVert:"attribute vec3 aPosition;\nattribute vec4 aVertexColor;\n\nuniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\nuniform float uResolution;\nuniform float uPointSize;\n\nvarying vec4 vColor;\nvoid main(void) {\n vec4 positionVec4 = vec4(aPosition, 1.0);\n gl_Position = uProjectionMatrix * uModelViewMatrix * positionVec4;\n vColor = aVertexColor;\n gl_PointSize = uPointSize;\n}\n",vertexColorVert:"attribute vec3 aPosition;\nattribute vec4 aVertexColor;\n\nuniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\n\nvarying vec4 vColor;\n\nvoid main(void) {\n vec4 positionVec4 = vec4(aPosition, 1.0);\n gl_Position = uProjectionMatrix * uModelViewMatrix * positionVec4;\n vColor = aVertexColor;\n}\n",vertexColorFrag:"precision mediump float;\nvarying vec4 vColor;\nvoid main(void) {\n gl_FragColor = vColor;\n}",normalVert:"attribute vec3 aPosition;\nattribute vec3 aNormal;\nattribute vec2 aTexCoord;\n\nuniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\nuniform mat3 uNormalMatrix;\n\nvarying vec3 vVertexNormal;\nvarying highp vec2 vVertTexCoord;\n\nvoid main(void) {\n vec4 positionVec4 = vec4(aPosition, 1.0);\n gl_Position = uProjectionMatrix * uModelViewMatrix * positionVec4;\n vVertexNormal = normalize(vec3( uNormalMatrix * aNormal ));\n vVertTexCoord = aTexCoord;\n}\n",normalFrag:"precision mediump float;\nvarying vec3 vVertexNormal;\nvoid main(void) {\n gl_FragColor = vec4(vVertexNormal, 1.0);\n}",basicFrag:"precision mediump float;\nvarying vec3 vVertexNormal;\nuniform vec4 uMaterialColor;\nvoid main(void) {\n gl_FragColor = uMaterialColor;\n}",lightVert:"attribute vec3 aPosition;\nattribute vec3 aNormal;\nattribute vec2 aTexCoord;\n\nuniform mat4 uViewMatrix;\nuniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\nuniform mat3 uNormalMatrix;\nuniform int uAmbientLightCount;\nuniform int uDirectionalLightCount;\nuniform int uPointLightCount;\n\nuniform vec3 uAmbientColor[8];\nuniform vec3 uLightingDirection[8];\nuniform vec3 uDirectionalColor[8];\nuniform vec3 uPointLightLocation[8];\nuniform vec3 uPointLightColor[8];\nuniform bool uSpecular;\n\nvarying vec3 vVertexNormal;\nvarying vec2 vVertTexCoord;\nvarying vec3 vLightWeighting;\n\nvoid main(void){\n\n vec4 positionVec4 = vec4(aPosition, 1.0);\n gl_Position = uProjectionMatrix * uModelViewMatrix * positionVec4;\n\n vec3 vertexNormal = normalize(vec3( uNormalMatrix * aNormal ));\n vVertexNormal = vertexNormal;\n vVertTexCoord = aTexCoord;\n\n vec4 mvPosition = uModelViewMatrix * vec4(aPosition, 1.0);\n vec3 eyeDirection = normalize(-mvPosition.xyz);\n\n float shininess = 32.0;\n float specularFactor = 2.0;\n float diffuseFactor = 0.3;\n\n vec3 ambientLightFactor = vec3(0.0);\n\n for (int i = 0; i < 8; i++) {\n if (uAmbientLightCount == i) break;\n ambientLightFactor += uAmbientColor[i];\n }\n\n\n vec3 directionalLightFactor = vec3(0.0);\n\n for (int j = 0; j < 8; j++) {\n if (uDirectionalLightCount == j) break;\n vec3 dir = uLightingDirection[j];\n float directionalLightWeighting = max(dot(vertexNormal, -dir), 0.0);\n directionalLightFactor += uDirectionalColor[j] * directionalLightWeighting;\n }\n\n\n vec3 pointLightFactor = vec3(0.0);\n\n for (int k = 0; k < 8; k++) {\n if (uPointLightCount == k) break;\n vec3 loc = (uViewMatrix * vec4(uPointLightLocation[k], 1.0)).xyz;\n vec3 lightDirection = normalize(loc - mvPosition.xyz);\n\n float directionalLightWeighting = max(dot(vertexNormal, lightDirection), 0.0);\n\n float specularLightWeighting = 0.0;\n if (uSpecular ){\n vec3 reflectionDirection = reflect(-lightDirection, vertexNormal);\n specularLightWeighting = pow(max(dot(reflectionDirection, eyeDirection), 0.0), shininess);\n }\n\n pointLightFactor += uPointLightColor[k] * (specularFactor * specularLightWeighting\n + directionalLightWeighting * diffuseFactor);\n }\n\n vLightWeighting = ambientLightFactor + directionalLightFactor + pointLightFactor;\n}\n",lightTextureFrag:"precision mediump float;\n\nuniform vec4 uMaterialColor;\nuniform sampler2D uSampler;\nuniform bool isTexture;\nuniform bool uUseLighting;\n\nvarying vec3 vLightWeighting;\nvarying highp vec2 vVertTexCoord;\n\nvoid main(void) {\n gl_FragColor = isTexture ? texture2D(uSampler, vVertTexCoord) : uMaterialColor;\n if (uUseLighting)\n gl_FragColor.rgb *= vLightWeighting;\n}",phongVert:"precision mediump float;\n\nattribute vec3 aPosition;\nattribute vec3 aNormal;\nattribute vec2 aTexCoord;\n\nuniform vec3 uAmbientColor[8];\n\nuniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\nuniform mat3 uNormalMatrix;\nuniform int uAmbientLightCount;\n\nvarying vec3 vNormal;\nvarying vec2 vTexCoord;\nvarying vec3 vViewPosition;\nvarying vec3 vAmbientColor;\n\nvoid main(void){\n\n vec4 viewModelPosition = uModelViewMatrix * vec4(aPosition, 1.0);\n\n // Pass varyings to fragment shader\n vViewPosition = viewModelPosition.xyz;\n gl_Position = uProjectionMatrix * viewModelPosition; \n\n vNormal = normalize(uNormalMatrix * normalize(aNormal));\n vTexCoord = aTexCoord;\n\n vAmbientColor = vec3(0.0);\n for (int i = 0; i < 8; i++) {\n if (uAmbientLightCount == i) break;\n vAmbientColor += uAmbientColor[i];\n }\n}\n",phongFrag:"precision mediump float;\n\n//uniform mat4 uModelViewMatrix;\nuniform mat4 uViewMatrix;\n\nuniform vec4 uMaterialColor;\nuniform sampler2D uSampler;\nuniform bool isTexture;\nuniform bool uUseLighting;\n\nuniform vec3 uLightingDirection[8];\nuniform vec3 uDirectionalColor[8];\nuniform vec3 uPointLightLocation[8];\nuniform vec3 uPointLightColor[8];\nuniform bool uSpecular;\n\nuniform int uDirectionalLightCount;\nuniform int uPointLightCount;\n\nvarying vec3 vNormal;\nvarying vec2 vTexCoord;\nvarying vec3 vViewPosition;\nvarying vec3 vAmbientColor;\n\nvec3 V;\nvec3 N;\n\nconst float shininess = 32.0;\nconst float specularFactor = 2.0;\nconst float diffuseFactor = 0.73;\n\nstruct LightResult {\n\tfloat specular;\n\tfloat diffuse;\n};\n\nfloat phongSpecular(\n vec3 lightDirection,\n vec3 viewDirection,\n vec3 surfaceNormal,\n float shininess) {\n\n vec3 R = normalize(reflect(-lightDirection, surfaceNormal)); \n return pow(max(0.0, dot(R, viewDirection)), shininess);\n}\n\nfloat lambertDiffuse(\n vec3 lightDirection,\n vec3 surfaceNormal) {\n return max(0.0, dot(-lightDirection, surfaceNormal));\n}\n\nLightResult light(vec3 lightVector) {\n\n vec3 L = normalize(lightVector);\n\n //compute our diffuse & specular terms\n LightResult lr;\n if (uSpecular)\n lr.specular = phongSpecular(L, V, N, shininess);\n lr.diffuse = lambertDiffuse(L, N);\n return lr;\n}\n\nvoid main(void) {\n\n V = normalize(vViewPosition);\n N = vNormal;\n\n vec3 diffuse = vec3(0.0);\n float specular = 0.0;\n\n for (int j = 0; j < 8; j++) {\n if (uDirectionalLightCount == j) break;\n\n LightResult result = light(uLightingDirection[j]);\n diffuse += result.diffuse * uDirectionalColor[j];\n specular += result.specular;\n }\n\n for (int k = 0; k < 8; k++) {\n if (uPointLightCount == k) break;\n\n vec3 lightPosition = (uViewMatrix * vec4(uPointLightLocation[k], 1.0)).xyz;\n vec3 lightVector = vViewPosition - lightPosition;\n\t\n //calculate attenuation\n float lightDistance = length(lightVector);\n float falloff = 500.0 / (lightDistance + 500.0);\n\n LightResult result = light(lightVector);\n diffuse += result.diffuse * falloff * uPointLightColor[k];\n specular += result.specular * falloff;\n }\n\n gl_FragColor = isTexture ? texture2D(uSampler, vTexCoord) : uMaterialColor;\n gl_FragColor.rgb = gl_FragColor.rgb * (diffuse * diffuseFactor + vAmbientColor) + specular * specularFactor;\n}",lineVert:"/*\n Part of the Processing project - http://processing.org\n Copyright (c) 2012-15 The Processing Foundation\n Copyright (c) 2004-12 Ben Fry and Casey Reas\n Copyright (c) 2001-04 Massachusetts Institute of Technology\n This library is free software; you can redistribute it and/or\n modify it under the terms of the GNU Lesser General Public\n License as published by the Free Software Foundation, version 2.1.\n This library is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n Lesser General Public License for more details.\n You should have received a copy of the GNU Lesser General\n Public License along with this library; if not, write to the\n Free Software Foundation, Inc., 59 Temple Place, Suite 330,\n Boston, MA 02111-1307 USA\n*/\n\n#define PROCESSING_LINE_SHADER\n\nuniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\nuniform float uStrokeWeight;\n\nuniform vec4 uViewport;\nvec3 scale = vec3(1.0);\n\nattribute vec4 aPosition;\nattribute vec4 aDirection;\n \nvoid main() {\n vec4 posp = uModelViewMatrix * aPosition;\n vec4 posq = uModelViewMatrix * (aPosition + vec4(aDirection.xyz, 0));\n\n // Moving vertices slightly toward the camera\n // to avoid depth-fighting with the fill triangles.\n // Discussed here:\n // http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=252848 \n posp.xyz = posp.xyz * scale;\n posq.xyz = posq.xyz * scale;\n\n vec4 p = uProjectionMatrix * posp;\n vec4 q = uProjectionMatrix * posq;\n\n // formula to convert from clip space (range -1..1) to screen space (range 0..[width or height])\n // screen_p = (p.xy/p.w + <1,1>) * 0.5 * uViewport.zw\n\n // prevent division by W by transforming the tangent formula (div by 0 causes\n // the line to disappear, see https://github.com/processing/processing/issues/5183)\n // t = screen_q - screen_p\n //\n // tangent is normalized and we don't care which aDirection it points to (+-)\n // t = +- normalize( screen_q - screen_p )\n // t = +- normalize( (q.xy/q.w+<1,1>)*0.5*uViewport.zw - (p.xy/p.w+<1,1>)*0.5*uViewport.zw )\n //\n // extract common factor, <1,1> - <1,1> cancels out\n // t = +- normalize( (q.xy/q.w - p.xy/p.w) * 0.5 * uViewport.zw )\n //\n // convert to common divisor\n // t = +- normalize( ((q.xy*p.w - p.xy*q.w) / (p.w*q.w)) * 0.5 * uViewport.zw )\n //\n // remove the common scalar divisor/factor, not needed due to normalize and +-\n // (keep uViewport - can't remove because it has different components for x and y\n // and corrects for aspect ratio, see https://github.com/processing/processing/issues/5181)\n // t = +- normalize( (q.xy*p.w - p.xy*q.w) * uViewport.zw )\n\n vec2 tangent = normalize((q.xy*p.w - p.xy*q.w) * uViewport.zw);\n\n // flip tangent to normal (it's already normalized)\n vec2 normal = vec2(-tangent.y, tangent.x);\n\n float thickness = aDirection.w * uStrokeWeight;\n vec2 offset = normal * thickness / 2.0;\n\n // Perspective ---\n // convert from world to clip by multiplying with projection scaling factor\n // to get the right thickness (see https://github.com/processing/processing/issues/5182)\n // invert Y, projections in Processing invert Y\n vec2 perspScale = (uProjectionMatrix * vec4(1, -1, 0, 0)).xy;\n\n // No Perspective ---\n // multiply by W (to cancel out division by W later in the pipeline) and\n // convert from screen to clip (derived from clip to screen above)\n vec2 noPerspScale = p.w / (0.5 * uViewport.zw);\n\n //gl_Position.xy = p.xy + offset.xy * mix(noPerspScale, perspScale, float(perspective > 0));\n gl_Position.xy = p.xy + offset.xy * perspScale;\n gl_Position.zw = p.zw;\n}\n",lineFrag:"precision mediump float;\nprecision mediump int;\n\nuniform vec4 uMaterialColor;\n\nvoid main() {\n gl_FragColor = uMaterialColor;\n}"};d.RendererGL=function(a,b,c,e){return d.Renderer.call(this,a,b,c),this.attributes={},e=e||{},this.attributes.alpha=void 0===e.alpha||e.alpha,this.attributes.depth=void 0===e.depth||e.depth,this.attributes.stencil=void 0===e.stencil||e.stencil,this.attributes.antialias=void 0!==e.antialias&&e.antialias,this.attributes.premultipliedAlpha=void 0!==e.premultipliedAlpha&&e.premultipliedAlpha,this.attributes.preserveDrawingBuffer=void 0===e.preserveDrawingBuffer||e.preserveDrawingBuffer,this.attributes.perPixelLighting=void 0!==e.perPixelLighting&&e.perPixelLighting,this._initContext(),this.isP3D=!0,this.GL=this.drawingContext,this.ambientLightColors=[],this.directionalLightDirections=[],this.directionalLightColors=[],this.pointLightPositions=[],this.pointLightColors=[],this.uMVMatrix=new d.Matrix,this.uPMatrix=new d.Matrix,this.uNMatrix=new d.Matrix("mat3"),this._curCamera=null,this._computeCameraDefaultSettings(),this.cameraFOV=this.defaultCameraFOV,this.cameraAspect=this.defaultAspect,this.cameraX=this.defaultCameraX,this.cameraY=this.defaultCameraY,this.cameraZ=this.defaultCameraZ,this.cameraNear=this.defaultCameraNear,this.cameraFar=this.defaultCameraFar,this.cameraMatrix=new d.Matrix,this.camera(),this.gHash={},this._defaultLightShader=void 0,this._defaultImmediateModeShader=void 0,this._defaultNormalShader=void 0,this._defaultColorShader=void 0,this.curFillShader=void 0,this.curStrokeShader=void 0,this._useColorShader(),this.setStrokeShader(this._getLineShader()),this.isImmediateDrawing=!1,this.immediateMode={},this.fill(255,255,255,255),this.pointSize=5,this.strokeWeight(2),this.stroke(0,0,0),this.textures=[],this},d.RendererGL.prototype=Object.create(d.Renderer.prototype),d.RendererGL.prototype._initContext=function(){try{if(this.drawingContext=this.canvas.getContext("webgl",this.attributes)||this.canvas.getContext("experimental-webgl",this.attributes),null===this.drawingContext)throw new Error("Error creating webgl context");console.log("p5.RendererGL: enabled webgl context");var a=this.drawingContext;a.enable(a.DEPTH_TEST),a.depthFunc(a.LEQUAL),a.viewport(0,0,a.drawingBufferWidth,a.drawingBufferHeight),this._viewport=this.drawingContext.getParameter(this.drawingContext.VIEWPORT)}catch(a){throw new Error(a)}},d.RendererGL.prototype._resetContext=function(a,b,c){var e=this.width,f=this.height,g=this.canvas.id,h=this.canvas;h&&h.parentNode.removeChild(h),h=document.createElement("canvas"),h.id=g,this._pInst._userNode?this._pInst._userNode.appendChild(h):document.body.appendChild(h),this._pInst.canvas=h;var i=new d.RendererGL(this._pInst.canvas,this._pInst,!0,a);this._pInst._setProperty("_renderer",i),i.resize(e,f),i._applyDefaults(),this._pInst._elements.push(i),"function"==typeof c&&setTimeout(function(){c.apply(window._renderer,b)},0)},d.prototype.setAttributes=function(a,b){this._assert3d("setAttributes");var c;void 0!==b?(c={},c[a]=b):a instanceof Object&&(c=a),this.push(),this._renderer._resetContext(c),this.pop()},d.RendererGL.prototype._computeCameraDefaultSettings=function(){this.defaultCameraFOV=60/180*Math.PI,this.defaultCameraAspect=this.width/this.height,this.defaultCameraX=0,this.defaultCameraY=0,this.defaultCameraZ=this.height/2/Math.tan(this.defaultCameraFOV/2),this.defaultCameraNear=.1*this.defaultCameraZ,this.defaultCameraFar=10*this.defaultCameraZ},d.RendererGL.prototype._setDefaultCamera=function(){null===this._curCamera&&(this._computeCameraDefaultSettings(),this.cameraFOV=this.defaultCameraFOV,this.cameraAspect=this.defaultAspect,this.cameraX=this.defaultCameraX,this.cameraY=this.defaultCameraY,this.cameraZ=this.defaultCameraZ,this.cameraNear=this.defaultCameraNear,this.cameraFar=this.defaultCameraFar,this.perspective(),this.camera(),this._curCamera="default")},d.RendererGL.prototype._update=function(){this.uMVMatrix.set(this.cameraMatrix.mat4[0],this.cameraMatrix.mat4[1],this.cameraMatrix.mat4[2],this.cameraMatrix.mat4[3],this.cameraMatrix.mat4[4],this.cameraMatrix.mat4[5],this.cameraMatrix.mat4[6],this.cameraMatrix.mat4[7],this.cameraMatrix.mat4[8],this.cameraMatrix.mat4[9],this.cameraMatrix.mat4[10],this.cameraMatrix.mat4[11],this.cameraMatrix.mat4[12],this.cameraMatrix.mat4[13],this.cameraMatrix.mat4[14],this.cameraMatrix.mat4[15]),this.ambientLightColors.length=0,this.directionalLightDirections.length=0,this.directionalLightColors.length=0,this.pointLightPositions.length=0,this.pointLightColors.length=0},d.RendererGL.prototype.background=function(){var a=this._pInst.color.apply(this._pInst,arguments),b=a.levels[0]/255,c=a.levels[1]/255,d=a.levels[2]/255,e=a.levels[3]/255;this.GL.clearColor(b,c,d,e),this.GL.depthMask(!0),this.GL.clear(this.GL.COLOR_BUFFER_BIT|this.GL.DEPTH_BUFFER_BIT)},d.RendererGL.prototype.fill=function(a,b,c,f){var g=d.prototype.color.apply(this._pInst,arguments);this.curFillColor=g._array,this.isImmediateDrawing?this.setFillShader(this._getImmediateModeShader()):this.setFillShader(this._getColorShader()),this.drawMode=e.FILL,this.curFillShader.setUniform("uMaterialColor",this.curFillColor)},d.RendererGL.prototype.stroke=function(a,b,c,e){arguments[3]=255;var f=d.prototype.color.apply(this._pInst,arguments);this.curStrokeColor=f._array,this.curStrokeShader.setUniform("uMaterialColor",this.curStrokeColor)},d.RendererGL.prototype.strokeWeight=function(a){this.curStrokeWeight!==a&&(this.pointSize=a,this.curStrokeWeight=a,this.curStrokeShader.setUniform("uStrokeWeight",a))},d.RendererGL.prototype.get=function(a,b,c,e){return d.Renderer2D.prototype.get.apply(this,[a,b,c,e])},d.RendererGL.prototype.loadPixels=function(){if(!0!==this.attributes.preserveDrawingBuffer)return void console.log("loadPixels only works in WebGL when preserveDrawingBuffer is true.");var a=this._pInst._pixelDensity,b=this.width,c=this.height;b*=a,c*=a,void 0===this.pixels&&(this.pixels=new Uint8Array(this.GL.drawingBufferWidth*this.GL.drawingBufferHeight*4)),this.GL.readPixels(0,0,b,c,this.GL.RGBA,this.GL.UNSIGNED_BYTE,this.pixels),this._pInst._setProperty("pixels",this.pixels)},d.RendererGL.prototype.geometryInHash=function(a){return void 0!==this.gHash[a]},d.RendererGL.prototype.resize=function(a,b){d.Renderer.prototype.resize.call(this,a,b),this.GL.viewport(0,0,this.GL.drawingBufferWidth,this.GL.drawingBufferHeight),this._viewport=this.GL.getParameter(this.GL.VIEWPORT),null!==this._curCamera&&"default"!==this._curCamera||(this._curCamera=null,this._setDefaultCamera()),void 0!==this.pixels&&(this.pixels=new Uint8Array(this.GL.drawingBufferWidth*this.GL.drawingBufferHeight*4))},d.RendererGL.prototype.clear=function(){var a=arguments[0]||0,b=arguments[1]||0,c=arguments[2]||0,d=arguments[3]||0;this.GL.clearColor(a,b,c,d),this.GL.clear(this.GL.COLOR_BUFFER_BIT|this.GL.DEPTH_BUFFER_BIT)},d.RendererGL.prototype.translate=function(a,b,c){return a instanceof d.Vector&&(c=a.z,b=a.y,a=a.x),this.uMVMatrix.translate([a,b,c]),this},d.RendererGL.prototype.scale=function(a,b,c){return this.uMVMatrix.scale(a,b,c),this},d.RendererGL.prototype.rotate=function(a,b){return void 0===b?this.rotateZ(a):(d.Matrix.prototype.rotate.apply(this.uMVMatrix,arguments),this)},d.RendererGL.prototype.rotateX=function(a){return this.rotate(a,1,0,0),this},d.RendererGL.prototype.rotateY=function(a){return this.rotate(a,0,1,0),this},d.RendererGL.prototype.rotateZ=function(a){return this.rotate(a,0,0,1),this},d.RendererGL.prototype.push=function(){var a=d.Renderer.prototype.push.apply(this),b=a.properties;return b.uMVMatrix=this.uMVMatrix.copy(),b.cameraMatrix=this.cameraMatrix.copy(),a},d.RendererGL.prototype.resetMatrix=function(){return this.uMVMatrix=d.Matrix.identity(this._pInst),this},d.RendererGL.prototype._applyTextProperties=function(){console.error("text commands not yet implemented in webgl")},d.RendererGL.prototype.setFillShader=function(a){return this.curFillShader!==a&&(this.curFillShader=a,this.curFillShader.init()),this.curFillShader},d.RendererGL.prototype.setStrokeShader=function(a){return this.curStrokeShader!==a&&(this.curStrokeShader=a,this.curStrokeShader.init()),this.curStrokeShader},d.RendererGL.prototype._useLightShader=function(){return this.curFillShader&&this.curFillShader.isLightShader()||this.setFillShader(this._getLightShader()),this.curFillShader},d.RendererGL.prototype._useColorShader=function(){return this.curFillShader&&this.curFillShader!==this._defaultImmediateModeShader||this.setFillShader(this._getColorShader()),this.curFillShader},d.RendererGL.prototype._useImmediateModeShader=function(){return this.curFillShader&&this.curFillShader!==this._defaultColorShader||this.setFillShader(this._getImmediateModeShader()),this.curFillShader},d.RendererGL.prototype._getLightShader=function(){return this._defaultLightShader||(this.attributes.perPixelLighting?this._defaultLightShader=new d.Shader(this,f.phongVert,f.phongFrag):this._defaultLightShader=new d.Shader(this,f.lightVert,f.lightTextureFrag)),this._defaultLightShader},d.RendererGL.prototype._getImmediateModeShader=function(){return this._defaultImmediateModeShader||(this._defaultImmediateModeShader=new d.Shader(this,f.immediateVert,f.vertexColorFrag)),this._defaultImmediateModeShader},d.RendererGL.prototype._getNormalShader=function(){return this._defaultNormalShader||(this._defaultNormalShader=new d.Shader(this,f.normalVert,f.normalFrag)),this._defaultNormalShader},d.RendererGL.prototype._getColorShader=function(){return this._defaultColorShader||(this._defaultColorShader=new d.Shader(this,f.normalVert,f.basicFrag)),this._defaultColorShader},d.RendererGL.prototype._getLineShader=function(){return this._defaultLineShader||(this._defaultLineShader=new d.Shader(this,f.lineVert,f.lineFrag)),this._defaultLineShader},d.RendererGL.prototype._getEmptyTexture=function(){if(!this._emptyTexture){var a=new d.Image(1,1);a.set(0,0,255),this._emptyTexture=new d.Texture(this,a)}return this._emptyTexture},d.RendererGL.prototype.getTexture=function(a){var b=function(b){return b.src===a},c=this.textures.find(b);return c||(c=new d.Texture(this,a),this.textures.push(c)),c},d.RendererGL.prototype._bindBuffer=function(a,b,c,d,e){if(this.GL.bindBuffer(b,a),void 0!==c){var f=new d(c);this.GL.bufferData(b,f,e)}},d.RendererGL.prototype.smooth=function(){console.log("smoothing not yet implemented in webgl")},d.RendererGL.prototype.noSmooth=function(){console.log("smoothing not yet implemented in webgl")},d.RendererGL.prototype._flatten=function(a){if(0===a.length)return[];if(a.length>2e4){var b,c=Object.prototype.toString,d="[object Array]",e=[],f=a.slice();b=f.pop();do{c.call(b)===d?f.push.apply(f,b):e.push(b)}while(f.length&&void 0!==(b=f.pop()));return e.reverse(),e}return[].concat.apply([],a)},d.RendererGL.prototype._vToNArray=function(a){return this._flatten(a.map(function(a){return[a.x,a.y,a.z]}))},d.prototype._assert3d=function(a){if(!this._renderer.isP3D)throw new Error(a+"() is only supported in WEBGL mode. If you'd like to use 3D graphics and WebGL, see https://p5js.org/examples/form-3d-primitives.html for more information.")},b.exports=d.RendererGL},{"../core/constants":20,"../core/core":21,"../core/p5.Renderer":28,"./p5.Matrix":68,"./p5.Shader":72}],72:[function(a,b,c){"use strict";var d=a("../core/core");d.Shader=function(a,b,c){return this._renderer=a,this._vertSrc=b,this._fragSrc=c,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},d.Shader.prototype.init=function(){if(0===this._glProgram){var a=this._renderer.GL;if(this._vertShader=a.createShader(a.VERTEX_SHADER),a.shaderSource(this._vertShader,this._vertSrc),a.compileShader(this._vertShader),!a.getShaderParameter(this._vertShader,a.COMPILE_STATUS))return console.error("Yikes! An error occurred compiling the vertex shader:"+a.getShaderInfoLog(this._vertShader)),null;if(this._fragShader=a.createShader(a.FRAGMENT_SHADER),a.shaderSource(this._fragShader,this._fragSrc),a.compileShader(this._fragShader),!a.getShaderParameter(this._fragShader,a.COMPILE_STATUS))return console.error("Darn! An error occurred compiling the fragment shader:"+a.getShaderInfoLog(this._fragShader)),null;this._glProgram=a.createProgram(),a.attachShader(this._glProgram,this._vertShader),a.attachShader(this._glProgram,this._fragShader),a.linkProgram(this._glProgram), a.getProgramParameter(this._glProgram,a.LINK_STATUS)||console.error("Snap! Error linking shader program: "+a.getProgramInfoLog(this._glProgram)),this._loadAttributes(),this._loadUniforms()}return this},d.Shader.prototype._loadAttributes=function(){if(!this._loadedAttributes){this.attributes={};for(var a=this._renderer.GL,b=a.getProgramParameter(this._glProgram,a.ACTIVE_ATTRIBUTES),c=0;c1&&(g=g.substring(0,g.indexOf("[0]"))),f.name=g,f.type=e.type,f.type===a.SAMPLER_2D&&(f.samplerIndex=c,c++,this.samplers.push(f)),this.uniforms[g]=f}this._loadedUniforms=!0}},d.Shader.prototype.compile=function(){},d.Shader.prototype.bindShader=function(){this.init(),this._bound||(this.useProgram(),this._bound=!0,this.bindTextures(),this._loadAttributes(),this._loadUniforms(),this._renderer._setDefaultCamera(),this._setMatrixUniforms(),this===this._renderer.curStrokeShader&&this._setViewportUniform())},d.Shader.prototype.unbindShader=function(){return this._bound&&(this.unbindTextures(),this._bound=!1),this},d.Shader.prototype.bindTextures=function(){for(var a=this._renderer.GL,b=0;b1?b.length&&e.uniform1iv(d,b):e.uniform1i(d,b);break;case e.FLOAT:c.size>1?b.length&&e.uniform1fv(d,b):e.uniform1f(d,b);break;case e.FLOAT_MAT3:e.uniformMatrix3fv(d,!1,b);break;case e.FLOAT_MAT4:e.uniformMatrix4fv(d,!1,b);break;case e.FLOAT_VEC2:c.size>1?b.length&&e.uniform2fv(d,b):e.uniform2f(d,b[0],b[1]);break;case e.FLOAT_VEC3:c.size>1?b.length&&e.uniform3fv(d,b):e.uniform3f(d,b[0],b[1],b[2]);break;case e.FLOAT_VEC4:c.size>1?b.length&&e.uniform4fv(d,b):e.uniform4f(d,b[0],b[1],b[2],b[3]);break;case e.SAMPLER_2D:e.activeTexture(e.TEXTURE0+c.samplerIndex),c.texture=this._renderer.getTexture(b),e.uniform1i(c.location,c.samplerIndex)}return this}},d.Shader.prototype.isLightShader=function(){return void 0!==this.uniforms.uUseLighting||void 0!==this.uniforms.uAmbientLightCount||void 0!==this.uniforms.uDirectionalLightCount||void 0!==this.uniforms.uPointLightCount||void 0!==this.uniforms.uAmbientColor||void 0!==this.uniforms.uDirectionalColor||void 0!==this.uniforms.uPointLightLocation||void 0!==this.uniforms.uPointLightColor||void 0!==this.uniforms.uLightingDirection||void 0!==this.uniforms.uSpecular},d.Shader.prototype.isTextureShader=function(){return this.samplerIndex>0},d.Shader.prototype.isColorShader=function(){return void 0!==this.attributes.aVertexColor||void 0!==this.uniforms.uMaterialColor},d.Shader.prototype.isTexLightShader=function(){return this.isLightShader()&&this.isTextureShader()},d.Shader.prototype.isStrokeShader=function(){return void 0!==this.uniforms.uStrokeWeight},d.Shader.prototype.enableAttrib=function(a,b,c,d,e,f){var g=this._renderer.GL;return-1!==a&&(g.enableVertexAttribArray(a),g.vertexAttribPointer(a,b,c,d,e,f)),this},b.exports=d.Shader},{"../core/core":21}],73:[function(a,b,c){"use strict";var d=a("../core/core");d.Texture=function(a,b){this._renderer=a;var c=this._renderer.GL;this.src=b,this.glTex=void 0,this.glTarget=c.TEXTURE_2D,this.glFormat=c.RGBA,this.mipmaps=!1,this.glMinFilter=c.LINEAR,this.glMagFilter=c.LINEAR,this.glWrapS=c.CLAMP_TO_EDGE,this.glWrapT=c.CLAMP_TO_EDGE,this.isSrcMediaElement=void 0!==d.MediaElement&&b instanceof d.MediaElement,this._videoPrevUpdateTime=0,this.isSrcHTMLElement=void 0!==d.Element&&b instanceof d.Element&&!(b instanceof d.Graphics),this.isSrcP5Image=b instanceof d.Image,this.isSrcP5Graphics=b instanceof d.Graphics;var e=this._getTextureDataFromSource();return this.width=e.width,this.height=e.height,this.init(e),this},d.Texture.prototype._getTextureDataFromSource=function(){var a;return this.isSrcP5Image?a=this.src.canvas:(this.isSrcMediaElement||this.isSrcP5Graphics||this.isSrcHTMLElement)&&(a=this.src.elt),a},d.Texture.prototype.init=function(a){var b=this._renderer.GL;if(this.glTex=b.createTexture(),this.bindTexture(),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,this.glMagFilter),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,this.glMinFilter),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,this.glWrapS),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,this.glWrapT),0===this.width||0===this.height||this.isSrcMediaElement&&!this.src.loadedmetadata){var c=new Uint8Array([1,1,1,1]);b.texImage2D(this.glTarget,0,b.RGBA,1,1,0,this.glFormat,b.UNSIGNED_BYTE,c)}else b.texImage2D(this.glTarget,0,this.glFormat,this.glFormat,b.UNSIGNED_BYTE,a)},d.Texture.prototype.update=function(){var a=this.src;if(0!==a.width&&0!==a.height){var b=this._getTextureDataFromSource(),c=this._renderer.GL;if(b.width!==this.width||b.height!==this.height)this.width=b.width,this.height=b.height,this.bindTexture(),c.texImage2D(this.glTarget,0,this.glFormat,this.glFormat,c.UNSIGNED_BYTE,b),this.isSrcP5Image?a.setModified(!1):(this.isSrcMediaElement||this.isSrcHTMLElement)&&a.setModified(!0);else if(this.isSrcP5Image)a.isModified()&&(this.bindTexture(),c.texImage2D(this.glTarget,0,this.glFormat,this.glFormat,c.UNSIGNED_BYTE,b),a.setModified(!1));else if(this.isSrcMediaElement){var d=!1;a.isModified()?(d=!0,a.setModified(!1)):a.loadedmetadata&&this._videoPrevUpdateTime!==a.time()&&(this._videoPrevUpdateTime=a.time(),d=!0),d&&(this.bindTexture(),c.texImage2D(this.glTarget,0,this.glFormat,this.glFormat,c.UNSIGNED_BYTE,b))}else c.texImage2D(this.glTarget,0,this.glFormat,this.glFormat,c.UNSIGNED_BYTE,b)}},d.Texture.prototype.bindTexture=function(){return this._renderer.GL.bindTexture(this.glTarget,this.glTex),this},d.Texture.prototype.unbindTexture=function(){this._renderer.GL.bindTexture(this.glTarget,null)},b.exports=d.Texture},{"../core/core":21}],74:[function(a,b,c){"use strict";var d=a("../core/core");a("./p5.Geometry"),d.prototype.plane=function(a,b,c,e){this._assert3d("plane"),d._validateParameters("plane",arguments),void 0===a&&(a=50),void 0===b&&(b=a),void 0===c&&(c=1),void 0===e&&(e=1);var f="plane|"+c+"|"+e;if(!this._renderer.geometryInHash(f)){var g=function(){for(var a,b,c,e=0;e<=this.detailY;e++){b=e/this.detailY;for(var f=0;f<=this.detailX;f++)a=f/this.detailX,c=new d.Vector(a-.5,b-.5,0),this.vertices.push(c),this.uvs.push(a,b)}},h=new d.Geometry(c,e,g);h.computeFaces().computeNormals(),c<=1&&e<=1?h._makeTriangleEdges()._edgesToVertices():console.log("Cannot draw stroke on plane objects with more than 1 detailX or 1 detailY"),this._renderer.createBuffers(f,h)}this._renderer.drawBuffersScaled(f,a,b,0)},d.prototype.box=function(a,b,c,e,f){this._assert3d("box"),d._validateParameters("box",arguments),void 0===a&&(a=50),void 0===b&&(b=a),void 0===c&&(c=b);var g=this._renderer.attributes&&this._renderer.attributes.perPixelLighting;void 0===e&&(e=g?1:4),void 0===f&&(f=g?1:4);var h="box|"+e+"|"+f;if(!this._renderer.geometryInHash(h)){var i=function(){var a=[[0,4,2,6],[1,3,5,7],[0,1,4,5],[2,6,3,7],[0,2,1,3],[4,5,6,7]];this.strokeIndices=[[0,1],[1,3],[3,2],[6,7],[8,9],[9,11],[14,15],[16,17],[17,19],[18,19],[20,21],[22,23]];for(var b=0;bf?(t=c,s=1,r=b):r=a+(b-a)*s,-2!==i&&i!==f+2||(r=0),t-=c/2,p[i]=0===r?1:e,j=0;jf?0:Math.sin(2*u*Math.PI)*Math.cos(q),i<0?-1:i>f?1:Math.sin(q),i<0||i>f?0:Math.cos(2*u*Math.PI)*Math.cos(q))),this.uvs.push(u,s)}}var v=0;if(g){for(k=0;kt[Math.floor(Math.random()*t.length)];function r(t,e){return null==t&&(t=0),null==e&&(e=1),t+Math.random()*(e-t)}function h(t,e){return null==t&&(t=0),null==e&&(e=1),Math.floor(t+Math.random()*(e-t+1))}const a=t=>document.querySelector(t),c=t=>"number"==typeof t?"#"+("00000"+t.toString(16)).slice(-6):t,u=(t,e=1)=>{const i=c(t),o=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(i),s=o?{r:parseInt(o[1],16),g:parseInt(o[2],16),b:parseInt(o[3],16)}:null;return"rgba("+s.r+","+s.g+","+s.b+","+e+")"},l=t=>.299*t.r+.587*t.g+.114*t.b},1:function(t,e,i){"use strict";i.d(e,"a",(function(){return r}));var o=i(0);const s="object"==typeof window;let n=s&&window.THREE||{};s&&!window.VANTA&&(window.VANTA={});const r=s&&window.VANTA||{};r.register=(t,e)=>r[t]=t=>new e(t),r.version="0.5.15";const h=function(){return Array.prototype.unshift.call(arguments,"[VANTA]"),console.error.apply(this,arguments)};r.VantaBase=class{constructor(t={}){if(!s)return!1;r.current=this,this.windowMouseMoveWrapper=this.windowMouseMoveWrapper.bind(this),this.windowTouchWrapper=this.windowTouchWrapper.bind(this),this.resize=this.resize.bind(this),this.animationLoop=this.animationLoop.bind(this),this.restart=this.restart.bind(this);const e="function"==typeof this.getDefaultOptions?this.getDefaultOptions():this.defaultOptions;if(this.options=Object(o.c)({mouseControls:!0,touchControls:!0,minHeight:200,minWidth:200,scale:1,scaleMobile:1},e),(t instanceof HTMLElement||"string"==typeof t)&&(t={el:t}),Object(o.c)(this.options,t),this.options.THREE&&(n=this.options.THREE),this.el=this.options.el,null==this.el)h('Instance needs "el" param!');else if(!(this.options.el instanceof HTMLElement)){const t=this.el;if(this.el=Object(o.f)(t),!this.el)return void h("Cannot find element",t)}this.prepareEl(),this.initThree(),this.setSize();try{this.init()}catch(t){return h("Init error",t),this.renderer&&this.renderer.domElement&&this.el.removeChild(this.renderer.domElement),void(this.options.backgroundColor&&(console.log("[VANTA] Falling back to backgroundColor"),this.el.style.background=Object(o.a)(this.options.backgroundColor)))}this.initMouse(),this.resize(),this.animationLoop();const i=window.addEventListener;i("resize",this.resize),window.requestAnimationFrame(this.resize),this.options.mouseControls&&(i("scroll",this.windowMouseMoveWrapper),i("mousemove",this.windowMouseMoveWrapper)),this.options.touchControls&&(i("touchstart",this.windowTouchWrapper),i("touchmove",this.windowTouchWrapper))}setOptions(t={}){Object(o.c)(this.options,t)}prepareEl(){let t,e;if("undefined"!=typeof Node&&Node.TEXT_NODE)for(t=0;t=0&&s>=0&&o<=i.width&&s<=i.height&&(this.mouseX=o,this.mouseY=s,this.options.mouseEase||this.triggerMouseMove(o,s))}windowTouchWrapper(t){if(1===t.touches.length){const e=this.getCanvasElement();if(!e)return!1;const i=e.getBoundingClientRect(),o=t.touches[0].clientX-i.left,s=t.touches[0].clientY-i.top;o>=0&&s>=0&&o<=i.width&&s<=i.height&&(this.mouseX=o,this.mouseY=s,this.options.mouseEase||this.triggerMouseMove(o,s))}}triggerMouseMove(t,e){this.uniforms&&(this.uniforms.iMouse.value.x=t/this.scale,this.uniforms.iMouse.value.y=e/this.scale);const i=t/this.width,o=e/this.height;"function"==typeof this.onMouseMove&&this.onMouseMove(i,o)}setSize(){this.scale||(this.scale=1),Object(o.e)()&&this.options.scaleMobile?this.scale=this.options.scaleMobile:this.options.scale&&(this.scale=this.options.scale),this.width=Math.max(this.el.offsetWidth,this.options.minWidth),this.height=Math.max(this.el.offsetHeight,this.options.minHeight)}initMouse(){(!this.mouseX&&!this.mouseY||this.mouseX===this.options.minWidth/2&&this.mouseY===this.options.minHeight/2)&&(this.mouseX=this.width/2,this.mouseY=this.height/2,this.triggerMouseMove(this.mouseX,this.mouseY))}resize(){this.setSize(),this.camera&&(this.camera.aspect=this.width/this.height,"function"==typeof this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix()),this.renderer&&(this.renderer.setSize(this.width,this.height),this.renderer.setPixelRatio(window.devicePixelRatio/this.scale)),"function"==typeof this.onResize&&this.onResize()}isOnScreen(){const t=this.el.offsetHeight,e=this.el.getBoundingClientRect(),i=window.pageYOffset||(document.documentElement||document.body.parentNode||document.body).scrollTop,o=e.top+i;return o-window.innerHeight<=i&&i<=o+t}animationLoop(){return this.t||(this.t=0),this.t+=1,this.t2||(this.t2=0),this.t2+=this.options.speed||1,this.uniforms&&(this.uniforms.iTime.value=.016667*this.t2),this.options.mouseEase&&(this.mouseEaseX=this.mouseEaseX||this.mouseX||0,this.mouseEaseY=this.mouseEaseY||this.mouseY||0,Math.abs(this.mouseEaseX-this.mouseX)+Math.abs(this.mouseEaseY-this.mouseY)>.1&&(this.mouseEaseX+=.05*(this.mouseX-this.mouseEaseX),this.mouseEaseY+=.05*(this.mouseY-this.mouseEaseY),this.triggerMouseMove(this.mouseEaseX,this.mouseEaseY))),(this.isOnScreen()||this.options.forceAnimate)&&("function"==typeof this.onUpdate&&this.onUpdate(),this.scene&&this.camera&&(this.renderer.render(this.scene,this.camera),this.renderer.setClearColor(this.options.backgroundColor,this.options.backgroundAlpha)),this.fps&&this.fps.update&&this.fps.update(),"function"==typeof this.afterRender&&this.afterRender()),this.req=window.requestAnimationFrame(this.animationLoop)}restart(){if(this.scene)for(;this.scene.children.length;)this.scene.remove(this.scene.children[0]);"function"==typeof this.onRestart&&this.onRestart(),this.init()}init(){"function"==typeof this.onInit&&this.onInit()}destroy(){"function"==typeof this.onDestroy&&this.onDestroy();const t=window.removeEventListener;t("touchstart",this.windowTouchWrapper),t("touchmove",this.windowTouchWrapper),t("scroll",this.windowMouseMoveWrapper),t("mousemove",this.windowMouseMoveWrapper),t("resize",this.resize),window.cancelAnimationFrame(this.req),this.renderer&&(this.renderer.domElement&&this.el.removeChild(this.renderer.domElement),this.renderer=null,this.scene=null)}},e.b=r.VantaBase},15:function(t,e,i){"use strict";i.r(e);var o=i(3),s=i(0);let n="object"==typeof window&&window.p5;class r extends o.b{static initClass(){this.prototype.p5=!0,this.prototype.defaultOptions={color:9016910,backgroundColor:8738}}constructor(t){n=t.p5||n,super(t)}onInit(){const t=this;new n((function(e){let i=t.width,o=t.height,r=100,h=10,a=.003,c=.1,u=(i+2*r)/h,l=(o+2*r)/h,d=[],p=4500,f=[],m=0;function w(t,i,o){let s=0,n=1,r=e.createVector(0,0),h=e.createVector(0,0);for(let a=0;a<100;a++){let c=a/100*e.TAU,u=e.createVector(t+e.cos(c)*o,i+e.sin(c)*o),l=e.noise(u.x,u.y);l>s&&(s=l,r.x=u.x,r.y=u.y),l