/** * Minified by jsDelivr using Terser v3.14.1. * Original file: /npm/twgl.js@4.15.0/dist/4.x/twgl-full.js * * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files */ !function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.twgl=r():e.twgl=r()}("undefined"!=typeof self?self:this,function(){return function(e){var r={};function t(n){if(r[n])return r[n].exports;var a=r[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,t),a.l=!0,a.exports}return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var a in e)t.d(n,a,function(r){return e[r]}.bind(null,a));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="",t(t.s="./src/twgl-full.js")}({"./src/attributes.js":function(e,r,t){"use strict";r.__esModule=!0,r.createAttribsFromArrays=_,r.createBuffersFromArrays=function(e,r){var t={};Object.keys(r).forEach(function(n){t[n]=M(e,r[n],n)}),r.indices?(t.numElements=r.indices.length,t.elementType=n.getGLTypeForTypedArray(O(r.indices),"indices")):t.numElements=function(e){var r,t;for(t=0;t0)throw new Error("numComponents ".concat(o," not correct for length ").concat(a));return i}(r);return t},r.createBufferFromArray=M,r.createBufferFromTypedArray=x,r.createBufferInfoFromArrays=function(e,r,t){var a=_(e,r),o=Object.assign({},t||{});o.attribs=Object.assign({},t?t.attribs:{},a);var i=r.indices;if(i){var u=O(i,"indices");o.indices=x(e,u,s),o.numElements=u.length,o.elementType=n.getGLTypeForTypedArray(u)}else o.numElements||(o.numElements=function(e,r){var t,n;for(n=0;n0)throw new Error("Can not guess numComponents for attribute '".concat(e,"'. Tried ").concat(t," but ").concat(r," values is not evenly divisible by ").concat(t,". You should specify it."));return t}function T(e,r){return e.numComponents||e.size||E(r,A(e).length)}function O(e,r){if(n.isArrayBuffer(e))return e;if(n.isArrayBuffer(e.data))return e.data;Array.isArray(e)&&(e={data:e});var t=e.type;return t||(t=w(r)?Uint16Array:Float32Array),new t(e.data)}function _(e,r){var t={};return Object.keys(r).forEach(function(a){if(!w(a)){var o=r[a],i=o.attrib||o.name||o.attribName||h.attribPrefix+a;if(o.value){if(!Array.isArray(o.value)&&!n.isArrayBuffer(o.value))throw new Error("array.value is not array or typedarray");t[i]={value:o.value}}else{var s,c,l,p;if(o.buffer&&o.buffer instanceof WebGLBuffer)s=o.buffer,p=o.numComponents||o.size,c=o.type,l=o.normalize;else if("number"==typeof o||"number"==typeof o.data){var m=o.data||o,y=o.type||Float32Array,d=m*y.BYTES_PER_ELEMENT;c=n.getGLTypeForTypedArrayType(y),l=void 0!==o.normalize?o.normalize:(b=y)===Int8Array||b===Uint8Array,p=o.numComponents||o.size||E(a,m),s=e.createBuffer(),e.bindBuffer(f,s),e.bufferData(f,d,o.drawType||u)}else{var v=O(o,a);s=x(e,v,void 0,o.drawType),c=n.getGLTypeForTypedArray(v),l=void 0!==o.normalize?o.normalize:function(e){return e instanceof Int8Array||e instanceof Uint8Array}(v),p=T(o,a)}t[i]={buffer:s,numComponents:p,type:c,normalize:l,stride:o.stride||0,offset:o.offset||0,divisor:void 0===o.divisor?void 0:o.divisor,drawType:o.drawType}}}var b}),e.bindBuffer(f,null),t}var j=["position","positions","a_position"];function M(e,r,t){var n="indices"===t?s:f;return x(e,O(r,t),n)}},"./src/draw.js":function(e,r,t){"use strict";r.__esModule=!0,r.drawBufferInfo=u,r.drawObjectList=function(e,r){var t=null,a=null;r.forEach(function(r){if(!1!==r.active){var i=r.programInfo,f=r.vertexArrayInfo||r.bufferInfo,s=!1,c=void 0===r.type?o:r.type;i!==t&&(t=i,e.useProgram(i.program),s=!0),(s||f!==a)&&(a&&a.vertexArrayObject&&!f.vertexArrayObject&&e.bindVertexArray(null),a=f,n.setBuffersAndAttributes(e,i,f)),n.setUniforms(i,r.uniforms),u(e,f,c,r.count,r.offset,r.instanceCount)}}),a&&a.vertexArrayObject&&e.bindVertexArray(null)};var n=function(e){if(e&&e.__esModule)return e;var r=a();if(r&&r.has(e))return r.get(e);var t={};if(null!=e){var n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var i=n?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(t,o,i):t[o]=e[o]}}t.default=e,r&&r.set(e,t);return t}(t("./src/programs.js"));function a(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return a=function(){return e},e}var o=4,i=5123;function u(e,r,t,n,a,u){t=void 0===t?o:t;var f=r.indices,s=r.elementType,c=void 0===n?r.numElements:n;a=void 0===a?0:a,s||f?void 0!==u?e.drawElementsInstanced(t,c,void 0===s?i:r.elementType,a,u):e.drawElements(t,c,void 0===s?i:r.elementType,a):void 0!==u?e.drawArraysInstanced(t,a,c,u):e.drawArrays(t,a,c)}},"./src/framebuffers.js":function(e,r,t){"use strict";r.__esModule=!0,r.bindFramebufferInfo=function(e,r,t){t=t||u,r?(e.bindFramebuffer(t,r.framebuffer),e.viewport(0,0,r.width,r.height)):(e.bindFramebuffer(t,null),e.viewport(0,0,e.drawingBufferWidth,e.drawingBufferHeight))},r.createFramebufferInfo=function(e,r,t,o){var i=u,v=e.createFramebuffer();e.bindFramebuffer(i,v),t=t||e.drawingBufferWidth,o=o||e.drawingBufferHeight;var b=0,h={framebuffer:v,attachments:[],width:t,height:o};return(r=r||m).forEach(function(r){var u=r.attachment,m=r.format,v=function(e){return y[e]}(m);if(v||(v=c+b++),!u)if(function(e){return d[e]}(m))u=e.createRenderbuffer(),e.bindRenderbuffer(f,u),e.renderbufferStorage(f,m,t,o);else{var g=Object.assign({},r);g.width=t,g.height=o,void 0===g.auto&&(g.auto=!1,g.min=g.min||g.minMag||p,g.mag=g.mag||g.minMag||p,g.wrapS=g.wrapS||g.wrap||l,g.wrapT=g.wrapT||g.wrap||l),u=n.createTexture(e,g)}if(a.isRenderbuffer(e,u))e.framebufferRenderbuffer(i,v,f,u);else{if(!a.isTexture(e,u))throw new Error("unknown attachment type");void 0!==r.layer?e.framebufferTextureLayer(i,v,u,r.level||0,r.layer):e.framebufferTexture2D(i,v,r.texTarget||s,u,r.level||0)}h.attachments.push(u)}),h},r.resizeFramebufferInfo=function(e,r,t,o,i){o=o||e.drawingBufferWidth,i=i||e.drawingBufferHeight,r.width=o,r.height=i,(t=t||m).forEach(function(t,u){var s=r.attachments[u],c=t.format;if(a.isRenderbuffer(e,s))e.bindRenderbuffer(f,s),e.renderbufferStorage(f,c,o,i);else{if(!a.isTexture(e,s))throw new Error("unknown attachment type");n.resizeTexture(e,s,t,o,i)}})};var n=i(t("./src/textures.js")),a=i(t("./src/helper.js"));function o(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return o=function(){return e},e}function i(e){if(e&&e.__esModule)return e;var r=o();if(r&&r.has(e))return r.get(e);var t={};if(null!=e){var n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){var i=n?Object.getOwnPropertyDescriptor(e,a):null;i&&(i.get||i.set)?Object.defineProperty(t,a,i):t[a]=e[a]}}return t.default=e,r&&r.set(e,t),t}var u=36160,f=36161,s=3553,c=36064,l=33071,p=9729,m=[{format:6408,type:5121,min:p,wrap:l},{format:34041}],y={};y[34041]=33306,y[6401]=36128,y[36168]=36128,y[6402]=36096,y[33189]=36096;var d={};d[32854]=!0,d[32855]=!0,d[36194]=!0,d[34041]=!0,d[33189]=!0,d[6401]=!0,d[36168]=!0},"./src/helper.js":function(e,r,t){"use strict";r.__esModule=!0,r.copyExistingProperties=function(e,r){Object.keys(r).forEach(function(t){r.hasOwnProperty(t)&&e.hasOwnProperty(t)&&(r[t]=e[t])})},r.copyNamedProperties=function(e,r,t){e.forEach(function(e){var n=r[e];void 0!==n&&(t[e]=n)})},r.error=function(){var e;(e=console).error.apply(e,arguments)},r.warn=function(){var e;(e=console).warn.apply(e,arguments)},r.isBuffer=function(e,r){return"undefined"!=typeof WebGLBuffer&&r instanceof WebGLBuffer},r.isRenderbuffer=function(e,r){return"undefined"!=typeof WebGLRenderbuffer&&r instanceof WebGLRenderbuffer},r.isShader=function(e,r){return"undefined"!=typeof WebGLShader&&r instanceof WebGLShader},r.isTexture=function(e,r){return"undefined"!=typeof WebGLTexture&&r instanceof WebGLTexture},r.isSampler=function(e,r){return"undefined"!=typeof WebGLSampler&&r instanceof WebGLSampler}},"./src/m4.js":function(e,r,t){"use strict";r.__esModule=!0,r.axisRotate=function(e,r,t,n){n=n||new f(16);var a=r[0],o=r[1],i=r[2],u=Math.sqrt(a*a+o*o+i*i),s=(a/=u)*a,c=(o/=u)*o,l=(i/=u)*i,p=Math.cos(t),m=Math.sin(t),y=1-p,d=s+(1-s)*p,v=a*o*y+i*m,b=a*i*y-o*m,h=a*o*y-i*m,g=c+(1-c)*p,x=o*i*y+a*m,w=a*i*y+o*m,A=o*i*y-a*m,P=l+(1-l)*p,F=e[0],E=e[1],T=e[2],O=e[3],_=e[4],j=e[5],M=e[6],S=e[7],B=e[8],k=e[9],C=e[10],I=e[11];n[0]=d*F+v*_+b*B,n[1]=d*E+v*j+b*k,n[2]=d*T+v*M+b*C,n[3]=d*O+v*S+b*I,n[4]=h*F+g*_+x*B,n[5]=h*E+g*j+x*k,n[6]=h*T+g*M+x*C,n[7]=h*O+g*S+x*I,n[8]=w*F+A*_+P*B,n[9]=w*E+A*j+P*k,n[10]=w*T+A*M+P*C,n[11]=w*O+A*S+P*I,e!==n&&(n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15]);return n},r.axisRotation=function(e,r,t){t=t||new f(16);var n=e[0],a=e[1],o=e[2],i=Math.sqrt(n*n+a*a+o*o),u=(n/=i)*n,s=(a/=i)*a,c=(o/=i)*o,l=Math.cos(r),p=Math.sin(r),m=1-l;return t[0]=u+(1-u)*l,t[1]=n*a*m+o*p,t[2]=n*o*m-a*p,t[3]=0,t[4]=n*a*m-o*p,t[5]=s+(1-s)*l,t[6]=a*o*m+n*p,t[7]=0,t[8]=n*o*m+a*p,t[9]=a*o*m-n*p,t[10]=c+(1-c)*l,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},r.copy=s,r.frustum=function(e,r,t,n,a,o,i){i=i||new f(16);var u=r-e,s=n-t,c=a-o;return i[0]=2*a/u,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=2*a/s,i[6]=0,i[7]=0,i[8]=(e+r)/u,i[9]=(n+t)/s,i[10]=o/c,i[11]=-1,i[12]=0,i[13]=0,i[14]=a*o/c,i[15]=0,i},r.getAxis=function(e,r,t){t=t||n.create();var a=4*r;return t[0]=e[a+0],t[1]=e[a+1],t[2]=e[a+2],t},r.getTranslation=function(e,r){return(r=r||n.create())[0]=e[12],r[1]=e[13],r[2]=e[14],r},r.identity=c,r.inverse=l,r.lookAt=function(e,r,t,a){return a=a||new f(16),o=o||n.create(),i=i||n.create(),u=u||n.create(),n.normalize(n.subtract(e,r,u),u),n.normalize(n.cross(t,u,o),o),n.normalize(n.cross(u,o,i),i),a[0]=o[0],a[1]=o[1],a[2]=o[2],a[3]=0,a[4]=i[0],a[5]=i[1],a[6]=i[2],a[7]=0,a[8]=u[0],a[9]=u[1],a[10]=u[2],a[11]=0,a[12]=e[0],a[13]=e[1],a[14]=e[2],a[15]=1,a},r.multiply=function(e,r,t){t=t||new f(16);var n=e[0],a=e[1],o=e[2],i=e[3],u=e[4],s=e[5],c=e[6],l=e[7],p=e[8],m=e[9],y=e[10],d=e[11],v=e[12],b=e[13],h=e[14],g=e[15],x=r[0],w=r[1],A=r[2],P=r[3],F=r[4],E=r[5],T=r[6],O=r[7],_=r[8],j=r[9],M=r[10],S=r[11],B=r[12],k=r[13],C=r[14],I=r[15];return t[0]=n*x+u*w+p*A+v*P,t[1]=a*x+s*w+m*A+b*P,t[2]=o*x+c*w+y*A+h*P,t[3]=i*x+l*w+d*A+g*P,t[4]=n*F+u*E+p*T+v*O,t[5]=a*F+s*E+m*T+b*O,t[6]=o*F+c*E+y*T+h*O,t[7]=i*F+l*E+d*T+g*O,t[8]=n*_+u*j+p*M+v*S,t[9]=a*_+s*j+m*M+b*S,t[10]=o*_+c*j+y*M+h*S,t[11]=i*_+l*j+d*M+g*S,t[12]=n*B+u*k+p*C+v*I,t[13]=a*B+s*k+m*C+b*I,t[14]=o*B+c*k+y*C+h*I,t[15]=i*B+l*k+d*C+g*I,t},r.negate=function(e,r){return(r=r||new f(16))[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r[3]=-e[3],r[4]=-e[4],r[5]=-e[5],r[6]=-e[6],r[7]=-e[7],r[8]=-e[8],r[9]=-e[9],r[10]=-e[10],r[11]=-e[11],r[12]=-e[12],r[13]=-e[13],r[14]=-e[14],r[15]=-e[15],r},r.ortho=function(e,r,t,n,a,o,i){return(i=i||new f(16))[0]=2/(r-e),i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=2/(n-t),i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2/(a-o),i[11]=0,i[12]=(r+e)/(e-r),i[13]=(n+t)/(t-n),i[14]=(o+a)/(a-o),i[15]=1,i},r.perspective=function(e,r,t,n,a){a=a||new f(16);var o=Math.tan(.5*Math.PI-.5*e),i=1/(t-n);return a[0]=o/r,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=o,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=(t+n)*i,a[11]=-1,a[12]=0,a[13]=0,a[14]=t*n*i*2,a[15]=0,a},r.rotateX=function(e,r,t){t=t||new f(16);var n=e[4],a=e[5],o=e[6],i=e[7],u=e[8],s=e[9],c=e[10],l=e[11],p=Math.cos(r),m=Math.sin(r);t[4]=p*n+m*u,t[5]=p*a+m*s,t[6]=p*o+m*c,t[7]=p*i+m*l,t[8]=p*u-m*n,t[9]=p*s-m*a,t[10]=p*c-m*o,t[11]=p*l-m*i,e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]);return t},r.rotateY=function(e,r,t){t=t||new f(16);var n=e[0],a=e[1],o=e[2],i=e[3],u=e[8],s=e[9],c=e[10],l=e[11],p=Math.cos(r),m=Math.sin(r);t[0]=p*n-m*u,t[1]=p*a-m*s,t[2]=p*o-m*c,t[3]=p*i-m*l,t[8]=p*u+m*n,t[9]=p*s+m*a,t[10]=p*c+m*o,t[11]=p*l+m*i,e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]);return t},r.rotateZ=function(e,r,t){t=t||new f(16);var n=e[0],a=e[1],o=e[2],i=e[3],u=e[4],s=e[5],c=e[6],l=e[7],p=Math.cos(r),m=Math.sin(r);t[0]=p*n+m*u,t[1]=p*a+m*s,t[2]=p*o+m*c,t[3]=p*i+m*l,t[4]=p*u-m*n,t[5]=p*s-m*a,t[6]=p*c-m*o,t[7]=p*l-m*i,e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]);return t},r.rotationX=function(e,r){r=r||new f(16);var t=Math.cos(e),n=Math.sin(e);return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=t,r[6]=n,r[7]=0,r[8]=0,r[9]=-n,r[10]=t,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r},r.rotationY=function(e,r){r=r||new f(16);var t=Math.cos(e),n=Math.sin(e);return r[0]=t,r[1]=0,r[2]=-n,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=n,r[9]=0,r[10]=t,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r},r.rotationZ=function(e,r){r=r||new f(16);var t=Math.cos(e),n=Math.sin(e);return r[0]=t,r[1]=n,r[2]=0,r[3]=0,r[4]=-n,r[5]=t,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r},r.scale=function(e,r,t){t=t||new f(16);var n=r[0],a=r[1],o=r[2];t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=n*e[3],t[4]=a*e[4],t[5]=a*e[5],t[6]=a*e[6],t[7]=a*e[7],t[8]=o*e[8],t[9]=o*e[9],t[10]=o*e[10],t[11]=o*e[11],e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]);return t},r.scaling=function(e,r){return(r=r||new f(16))[0]=e[0],r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=e[1],r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=e[2],r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r},r.setAxis=function(e,r,t,n){n!==e&&(n=s(e,n));var a=4*t;return n[a+0]=r[0],n[a+1]=r[1],n[a+2]=r[2],n},r.setDefaultType=function(e){var r=f;return f=e,r},r.setTranslation=function(e,r,t){t=t||c(),e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11]);return t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t},r.transformDirection=function(e,r,t){t=t||n.create();var a=r[0],o=r[1],i=r[2];return t[0]=a*e[0]+o*e[4]+i*e[8],t[1]=a*e[1]+o*e[5]+i*e[9],t[2]=a*e[2]+o*e[6]+i*e[10],t},r.transformNormal=function(e,r,t){t=t||n.create();var a=l(e),o=r[0],i=r[1],u=r[2];return t[0]=o*a[0]+i*a[1]+u*a[2],t[1]=o*a[4]+i*a[5]+u*a[6],t[2]=o*a[8]+i*a[9]+u*a[10],t},r.transformPoint=function(e,r,t){t=t||n.create();var a=r[0],o=r[1],i=r[2],u=a*e[3]+o*e[7]+i*e[11]+e[15];return t[0]=(a*e[0]+o*e[4]+i*e[8]+e[12])/u,t[1]=(a*e[1]+o*e[5]+i*e[9]+e[13])/u,t[2]=(a*e[2]+o*e[6]+i*e[10]+e[14])/u,t},r.translate=function(e,r,t){t=t||new f(16);var n=r[0],a=r[1],o=r[2],i=e[0],u=e[1],s=e[2],c=e[3],l=e[4],p=e[5],m=e[6],y=e[7],d=e[8],v=e[9],b=e[10],h=e[11],g=e[12],x=e[13],w=e[14],A=e[15];e!==t&&(t[0]=i,t[1]=u,t[2]=s,t[3]=c,t[4]=l,t[5]=p,t[6]=m,t[7]=y,t[8]=d,t[9]=v,t[10]=b,t[11]=h);return t[12]=i*n+l*a+d*o+g,t[13]=u*n+p*a+v*o+x,t[14]=s*n+m*a+b*o+w,t[15]=c*n+y*a+h*o+A,t},r.translation=function(e,r){return(r=r||new f(16))[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=e[0],r[13]=e[1],r[14]=e[2],r[15]=1,r},r.transpose=function(e,r){if((r=r||new f(16))===e){var t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,r}var n=e[0],a=e[1],o=e[2],i=e[3],u=e[4],s=e[5],c=e[6],l=e[7],p=e[8],m=e[9],y=e[10],d=e[11],v=e[12],b=e[13],h=e[14],g=e[15];return r[0]=n,r[1]=u,r[2]=p,r[3]=v,r[4]=a,r[5]=s,r[6]=m,r[7]=b,r[8]=o,r[9]=c,r[10]=y,r[11]=h,r[12]=i,r[13]=l,r[14]=d,r[15]=g,r};var n=function(e){if(e&&e.__esModule)return e;var r=a();if(r&&r.has(e))return r.get(e);var t={};if(null!=e){var n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var i=n?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(t,o,i):t[o]=e[o]}}t.default=e,r&&r.set(e,t);return t}(t("./src/v3.js"));function a(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return a=function(){return e},e}var o,i,u,f=Float32Array;function s(e,r){return(r=r||new f(16))[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r}function c(e){return(e=e||new f(16))[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function l(e,r){r=r||new f(16);var t=e[0],n=e[1],a=e[2],o=e[3],i=e[4],u=e[5],s=e[6],c=e[7],l=e[8],p=e[9],m=e[10],y=e[11],d=e[12],v=e[13],b=e[14],h=e[15],g=m*h,x=b*y,w=s*h,A=b*c,P=s*y,F=m*c,E=a*h,T=b*o,O=a*y,_=m*o,j=a*c,M=s*o,S=l*v,B=d*p,k=i*v,C=d*u,I=i*p,z=l*u,R=t*v,D=d*n,U=t*p,L=l*n,W=t*u,V=i*n,G=g*u+A*p+P*v-(x*u+w*p+F*v),N=x*n+E*p+_*v-(g*n+T*p+O*v),X=w*n+T*u+j*v-(A*n+E*u+M*v),Y=F*n+O*u+M*p-(P*n+_*u+j*p),q=1/(t*G+i*N+l*X+d*Y);return r[0]=q*G,r[1]=q*N,r[2]=q*X,r[3]=q*Y,r[4]=q*(x*i+w*l+F*d-(g*i+A*l+P*d)),r[5]=q*(g*t+T*l+O*d-(x*t+E*l+_*d)),r[6]=q*(A*t+E*i+M*d-(w*t+T*i+j*d)),r[7]=q*(P*t+_*i+j*l-(F*t+O*i+M*l)),r[8]=q*(S*c+C*y+I*h-(B*c+k*y+z*h)),r[9]=q*(B*o+R*y+L*h-(S*o+D*y+U*h)),r[10]=q*(k*o+D*c+W*h-(C*o+R*c+V*h)),r[11]=q*(z*o+U*c+V*y-(I*o+L*c+W*y)),r[12]=q*(k*m+z*b+B*s-(I*b+S*s+C*m)),r[13]=q*(U*b+S*a+D*m-(R*m+L*b+B*a)),r[14]=q*(R*s+V*b+C*a-(W*b+k*a+D*s)),r[15]=q*(W*m+I*a+L*s-(U*s+V*m+z*a)),r}},"./src/primitives.js":function(e,r,t){"use strict";r.__esModule=!0,r.create3DFVertices=_,r.createAugmentedTypedArray=m,r.createCubeVertices=E,r.createPlaneVertices=A,r.createSphereVertices=P,r.createTruncatedConeVertices=T,r.createXYQuadVertices=w,r.createCrescentVertices=j,r.createCylinderVertices=M,r.createTorusVertices=S,r.createDiscVertices=B,r.deindexVertices=function(e){var r=e.indices,t={},n=r.length;return Object.keys(e).filter(y).forEach(function(a){for(var o=e[a],i=o.numComponents,u=m(i,n,o.constructor),f=0;f=0?g(n,r):t.indexOf("tan")>=0||t.indexOf("binorm")>=0?b(n,r):t.indexOf("norm")>=0&&h(n,r)}),e}function w(e,r,t){return e=e||2,{position:{numComponents:2,data:[(r=r||0)+-1*(e*=.5),(t=t||0)+-1*e,r+1*e,t+-1*e,r+-1*e,t+1*e,r+1*e,t+1*e]},normal:[0,0,1,0,0,1,0,0,1,0,0,1],texcoord:[0,0,1,0,0,1,1,1],indices:[0,1,2,2,1,3]}}function A(e,r,t,n,a){e=e||1,r=r||1,t=t||1,n=n||1,a=a||i.identity();for(var o=(t+1)*(n+1),u=m(3,o),f=m(3,o),s=m(2,o),c=0;c<=n;c++)for(var l=0;l<=t;l++){var p=l/t,y=c/n;u.push(e*p-.5*e,0,r*y-.5*r),f.push(0,1,0),s.push(p,y)}for(var d=t+1,v=m(3,t*n*2,Uint16Array),b=0;b 0");n=n||0,o=o||0;for(var u=(a=a||Math.PI)-n,f=(i=i||2*Math.PI)-o,s=(r+1)*(t+1),c=m(3,s),l=m(3,s),p=m(2,s),y=0;y<=t;y++)for(var d=0;d<=r;d++){var v=d/r,b=y/t,h=f*v+o,g=u*b+n,x=Math.sin(h),w=Math.cos(h),A=Math.sin(g),P=w*A,F=Math.cos(g),E=x*A;c.push(e*P,e*F,e*E),l.push(P,F,E),p.push(1-v,b)}for(var T=r+1,O=m(3,r*t*2,Uint16Array),_=0;_a?(P=t,A=1,F=r):F=e+w/a*(r-e),-2!==w&&w!==a+2||(F=0,A=0),P-=t/2;for(var E=0;Ea?p.push(0,1,0):0===F?p.push(0,0,0):p.push(T*h,g,O*h),y.push(E/n,1-A)}}for(var _=0;_ 0");var f=2,s=(i=i||1)-(o=o||0),c=2*(a+1)*(2+f),l=m(3,c),p=m(3,c),y=m(2,c);function d(e,r,t){return e+(r-e)*t}function v(r,t,i,c,m,v){for(var b=0;b<=a;b++){var h=t/(f-1),g=b/a,x=2*(h-.5),w=(o+g*s)*Math.PI,A=Math.sin(w),P=Math.cos(w),F=d(e,r,A),E=x*n,T=P*e,O=A*F;l.push(E,T,O);var _=u.add(u.multiply([0,A,P],i),c);p.push(_),y.push(h*m+v,g)}}for(var b=0;b0&&v!==r){var x=c+(v+1),w=c+v,A=c+v-p,P=c+(v+1)-p;s.push(x,w,A),s.push(x,A,P)}}c+=r+1}return{position:i,normal:u,texcoord:f,indices:s}}function k(e){return function(r){var t=e.apply(this,Array.prototype.slice.call(arguments,1));return n.createBuffersFromArrays(r,t)}}function C(e){return function(r){var t=e.apply(null,Array.prototype.slice.call(arguments,1));return n.createBufferInfoFromArrays(r,t)}}var I=["numComponents","size","type","normalize","stride","offset","attrib","name","attribName"];function z(e,r,t,n){n=n||0;for(var a=e.length,o=0;o=0?g:r.indexOf("vert")>=0?x:void 0}function $(e,r){r.forEach(function(r){e.deleteShader(r)})}function J(e,r,t,n,o){for(var i=Q(t,n,o),u=[],f=[],c=0;c1&&"[0]"===n.name.substr(-3),u=n.type,f=k[u];if(!f)throw new Error("unknown type: 0x".concat(u.toString(16)));if(f.bindPoint){var s=t;t+=n.size,a=i?f.arraySetter(e,u,s,o,n.size):f.setter(e,u,s,o,n.size)}else a=f.arraySetter&&i?f.arraySetter(e,o):f.setter(e,o);return a.location=o,a}for(var a={},o=e.getProgramParameter(r,A),i=0;i1e-5?(r[0]=e[0]/a,r[1]=e[1]/a,r[2]=e[2]/a):(r[0]=0,r[1]=0,r[2]=0);return r},r.setDefaultType=function(e){var r=n;return n=e,r},r.subtract=function(e,r,t){return(t=t||new n(3))[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t};var n=Float32Array},"./src/vertex-arrays.js":function(e,r,t){"use strict";r.__esModule=!0,r.createVertexArrayInfo=function(e,r,t){var a=e.createVertexArray();e.bindVertexArray(a),r.length||(r=[r]);return r.forEach(function(r){n.setBuffersAndAttributes(e,r,t)}),e.bindVertexArray(null),{numElements:t.numElements,elementType:t.elementType,vertexArrayObject:a}},r.createVAOAndSetAttributes=i,r.createVAOFromBufferInfo=function(e,r,t){return i(e,r.attribSetters||r,t.attribs,t.indices)};var n=function(e){if(e&&e.__esModule)return e;var r=a();if(r&&r.has(e))return r.get(e);var t={};if(null!=e){var n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var i=n?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(t,o,i):t[o]=e[o]}}t.default=e,r&&r.set(e,t);return t}(t("./src/programs.js"));function a(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return a=function(){return e},e}var o=34963;function i(e,r,t,a){var i=e.createVertexArray();return e.bindVertexArray(i),n.setAttributes(r,t),a&&e.bindBuffer(o,a),e.bindVertexArray(null),i}}})});