-
Notifications
You must be signed in to change notification settings - Fork 0
/
twgl-full.min.js
6 lines (6 loc) · 70.2 KB
/
twgl-full.min.js
1
2
3
4
5
6
/*!
* @license twgl.js 4.11.2 Copyright (c) 2015, Gregg Tavares All Rights Reserved.
* Available via the MIT license.
* see: http://github.com/greggman/twgl.js for details
*/
!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 o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.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 o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));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=8)}([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.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},r.warn=r.error=void 0;var n="undefined"!=typeof console&&console.error&&"function"==typeof console.error?console.error.bind(console):function(){};r.error=n;var o="undefined"!=typeof console&&console.warn&&"function"==typeof console.warn?console.warn.bind(console):function(){};r.warn=o},function(e,r,t){"use strict";r.__esModule=!0,r.getGLTypeForTypedArray=function(e){if(e instanceof Int8Array)return n;if(e instanceof Uint8Array)return o;if(e instanceof Uint8ClampedArray)return o;if(e instanceof Int16Array)return i;if(e instanceof Uint16Array)return a;if(e instanceof Int32Array)return u;if(e instanceof Uint32Array)return f;if(e instanceof Float32Array)return c;throw new Error("unsupported typed array type")},r.getGLTypeForTypedArrayType=function(e){if(e===Int8Array)return n;if(e===Uint8Array)return o;if(e===Uint8ClampedArray)return o;if(e===Int16Array)return i;if(e===Uint16Array)return a;if(e===Int32Array)return u;if(e===Uint32Array)return f;if(e===Float32Array)return c;throw new Error("unsupported typed array type")},r.getTypedArrayTypeForGLType=function(e){var r=l[e];if(!r)throw new Error("unknown gl type");return r},r.isArrayBuffer=void 0;var n=5120,o=5121,i=5122,a=5123,u=5124,f=5125,c=5126,l={},s=l;s[n]=Int8Array,s[o]=Uint8Array,s[i]=Int16Array,s[a]=Uint16Array,s[u]=Int32Array,s[f]=Uint32Array,s[c]=Float32Array,s[32819]=Uint16Array,s[32820]=Uint16Array,s[33635]=Uint16Array,s[5131]=Uint16Array,s[33640]=Uint32Array,s[35899]=Uint32Array,s[35902]=Uint32Array,s[36269]=Uint32Array,s[34042]=Uint32Array;var v="undefined"!=typeof SharedArrayBuffer?function(e){return e&&e.buffer&&(e.buffer instanceof ArrayBuffer||e.buffer instanceof SharedArrayBuffer)}:function(e){return e&&e.buffer&&e.buffer instanceof ArrayBuffer};r.isArrayBuffer=v},function(e,r,t){"use strict";r.__esModule=!0,r.add=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},r.copy=function(e,r){return(r=r||new n(3))[0]=e[0],r[1]=e[1],r[2]=e[2],r},r.create=function(e,r,t){var o=new n(3);e&&(o[0]=e);r&&(o[1]=r);t&&(o[2]=t);return o},r.cross=function(e,r,t){t=t||new n(3);var o=e[2]*r[0]-e[0]*r[2],i=e[0]*r[1]-e[1]*r[0];return t[0]=e[1]*r[2]-e[2]*r[1],t[1]=o,t[2]=i,t},r.distance=function(e,r){var t=e[0]-r[0],n=e[1]-r[1],o=e[2]-r[2];return Math.sqrt(t*t+n*n+o*o)},r.distanceSq=function(e,r){var t=e[0]-r[0],n=e[1]-r[1],o=e[2]-r[2];return t*t+n*n+o*o},r.divide=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},r.divScalar=function(e,r,t){return(t=t||new n(3))[0]=e[0]/r,t[1]=e[1]/r,t[2]=e[2]/r,t},r.dot=function(e,r){return e[0]*r[0]+e[1]*r[1]+e[2]*r[2]},r.lerp=function(e,r,t,o){return(o=o||new n(3))[0]=e[0]+t*(r[0]-e[0]),o[1]=e[1]+t*(r[1]-e[1]),o[2]=e[2]+t*(r[2]-e[2]),o},r.lerpV=function(e,r,t,o){return(o=o||new n(3))[0]=e[0]+t[0]*(r[0]-e[0]),o[1]=e[1]+t[1]*(r[1]-e[1]),o[2]=e[2]+t[2]*(r[2]-e[2]),o},r.length=function(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2])},r.lengthSq=function(e){return e[0]*e[0]+e[1]*e[1]+e[2]*e[2]},r.max=function(e,r,t){return(t=t||new n(3))[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t},r.min=function(e,r,t){return(t=t||new n(3))[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t},r.mulScalar=function(e,r,t){return(t=t||new n(3))[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t},r.multiply=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},r.negate=function(e,r){return(r=r||new n(3))[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r},r.normalize=function(e,r){r=r||new n(3);var t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],o=Math.sqrt(t);o>1e-5?(r[0]=e[0]/o,r[1]=e[1]/o,r[2]=e[2]/o):(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},function(e,r,t){"use strict";r.__esModule=!0,r.isWebGL1=function(e){return!e.texStorage2D},r.isWebGL2=function(e){return!!e.texStorage2D},r.glEnumToString=void 0;var n=function(){var e={},r={};return function(t,n){return function(t){var n=t.constructor.name;if(!e[n]){for(var o in t)if("number"==typeof t[o]){var i=r[t[o]];r[t[o]]=i?"".concat(i," | ").concat(o):o}e[n]=!0}}(t),r[n]||"0x"+n.toString(16)}}();r.glEnumToString=n},function(e,r,t){"use strict";r.__esModule=!0,r.createAttributeSetters=G,r.createProgram=R,r.createProgramFromScripts=function(e,r,t,n,o){for(var i=_(t,n,o),a=[],u=0;u<r.length;++u){var f=T(e,r[u],e[j[u]],i.errorCallback);if(!f)return null;a.push(f)}return R(e,a,i)},r.createProgramFromSources=g,r.createProgramInfo=function(e,r,t,n,o){var i=_(t,n,o),a=!0;if(r=r.map(function(e){if(e.indexOf("\n")<0){var r=f(e);r?e=r.text:(i.errorCallback("no element with id: "+e),a=!1)}return e}),!a)return null;var u=g(e,r,i);if(!u)return null;return X(e,u)},r.createProgramInfoFromProgram=X,r.createUniformSetters=U,r.createUniformBlockSpecFromProgram=I,r.createUniformBlockInfoFromProgram=L,r.createUniformBlockInfo=function(e,r,t){return L(e,r.program,r.uniformBlockSpec,t)},r.createTransformFeedback=function(e,r,t){var n=e.createTransformFeedback();return e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,n),e.useProgram(r.program),S(e,r,t),e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null),n},r.createTransformFeedbackInfo=C,r.bindTransformFeedbackInfo=S,r.setAttributes=W,r.setBuffersAndAttributes=function(e,r,t){t.vertexArrayObject?e.bindVertexArray(t.vertexArrayObject):(W(r.attribSetters||r,t.attribs),t.indices&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.indices))},r.setUniforms=function e(r,t){var n=r.uniformSetters||r;var o=arguments.length;for(var i=1;i<o;++i){var a=arguments[i];if(Array.isArray(a))for(var u=a.length,f=0;f<u;++f)e(n,a[f]);else for(var c in a){var l=n[c];l&&l(a[c])}}},r.setUniformBlock=function(e,r,t){k(e,r,t)&&e.bufferData(e.UNIFORM_BUFFER,t.array,e.DYNAMIC_DRAW)},r.setBlockUniforms=function(e,r){var t=e.uniforms;for(var n in r){var o=t[n];if(o){var i=r[n];i.length?o.set(i):o[0]=i}}},r.bindUniformBlock=k;var n=i(t(3)),o=i(t(0));function i(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var n=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,t):{};n.get||n.set?Object.defineProperty(r,t,n):r[t]=e[t]}return r.default=e,r}var a=o.error,u=o.warn,f="undefined"!=typeof document&&document.getElementById?document.getElementById.bind(document):function(){return null},c={};function l(e,r){return c[r].bindPoint}function s(e,r){return function(t){e.uniform1i(r,t)}}function v(e,r){return function(t){e.uniform1iv(r,t)}}function b(e,r){return function(t){e.uniform2iv(r,t)}}function y(e,r){return function(t){e.uniform3iv(r,t)}}function d(e,r){return function(t){e.uniform4iv(r,t)}}function m(e,r,t,i){var a=l(0,r);return n.isWebGL2(e)?function(r){var n,u;o.isTexture(e,r)?(n=r,u=null):(n=r.texture,u=r.sampler),e.uniform1i(i,t),e.activeTexture(e.TEXTURE0+t),e.bindTexture(a,n),e.bindSampler(t,u)}:function(r){e.uniform1i(i,t),e.activeTexture(e.TEXTURE0+t),e.bindTexture(a,r)}}function p(e,r,t,i,a){for(var u=l(0,r),f=new Int32Array(a),c=0;c<a;++c)f[c]=t+c;return n.isWebGL2(e)?function(r){e.uniform1iv(i,f),r.forEach(function(r,n){var i,a;e.activeTexture(e.TEXTURE0+f[n]),o.isTexture(e,r)?(i=r,a=null):(i=r.texture,a=r.sampler),e.bindSampler(t,a),e.bindTexture(u,i)})}:function(r){e.uniform1iv(i,f),r.forEach(function(r,t){e.activeTexture(e.TEXTURE0+f[t]),e.bindTexture(u,r)})}}function x(e,r){return function(t){if(t.value)switch(e.disableVertexAttribArray(r),t.value.length){case 4:e.vertexAttrib4fv(r,t.value);break;case 3:e.vertexAttrib3fv(r,t.value);break;case 2:e.vertexAttrib2fv(r,t.value);break;case 1:e.vertexAttrib1fv(r,t.value);break;default:throw new Error("the length of a float constant value must be between 1 and 4!")}else e.bindBuffer(e.ARRAY_BUFFER,t.buffer),e.enableVertexAttribArray(r),e.vertexAttribPointer(r,t.numComponents||t.size,t.type||e.FLOAT,t.normalize||!1,t.stride||0,t.offset||0),void 0!==t.divisor&&e.vertexAttribDivisor(r,t.divisor)}}function h(e,r){return function(t){if(t.value){if(e.disableVertexAttribArray(r),4!==t.value.length)throw new Error("The length of an integer constant value must be 4!");e.vertexAttrib4iv(r,t.value)}else e.bindBuffer(e.ARRAY_BUFFER,t.buffer),e.enableVertexAttribArray(r),e.vertexAttribIPointer(r,t.numComponents||t.size,t.type||e.INT,t.stride||0,t.offset||0),void 0!==t.divisor&&e.vertexAttribDivisor(r,t.divisor)}}function F(e,r){return function(t){if(t.value){if(e.disableVertexAttribArray(r),4!==t.value.length)throw new Error("The length of an unsigned integer constant value must be 4!");e.vertexAttrib4uiv(r,t.value)}else e.bindBuffer(e.ARRAY_BUFFER,t.buffer),e.enableVertexAttribArray(r),e.vertexAttribIPointer(r,t.numComponents||t.size,t.type||e.UNSIGNED_INT,t.stride||0,t.offset||0),void 0!==t.divisor&&e.vertexAttribDivisor(r,t.divisor)}}function w(e,r,t){var n=t.size,o=t.count;return function(t){e.bindBuffer(e.ARRAY_BUFFER,t.buffer);for(var i=t.size||t.numComponents||n,a=i/o,u=t.type||e.FLOAT,f=c[u].size*i,l=t.normalize||!1,s=t.offset||0,v=f/o,b=0;b<o;++b)e.enableVertexAttribArray(r+b),e.vertexAttribPointer(r+b,a,u,l,f,s+v*b),void 0!==t.divisor&&e.vertexAttribDivisor(r+b,t.divisor)}}c[5126]={Type:Float32Array,size:4,setter:function(e,r){return function(t){e.uniform1f(r,t)}},arraySetter:function(e,r){return function(t){e.uniform1fv(r,t)}}},c[35664]={Type:Float32Array,size:8,setter:function(e,r){return function(t){e.uniform2fv(r,t)}}},c[35665]={Type:Float32Array,size:12,setter:function(e,r){return function(t){e.uniform3fv(r,t)}}},c[35666]={Type:Float32Array,size:16,setter:function(e,r){return function(t){e.uniform4fv(r,t)}}},c[5124]={Type:Int32Array,size:4,setter:s,arraySetter:v},c[35667]={Type:Int32Array,size:8,setter:b},c[35668]={Type:Int32Array,size:12,setter:y},c[35669]={Type:Int32Array,size:16,setter:d},c[5125]={Type:Uint32Array,size:4,setter:function(e,r){return function(t){e.uniform1ui(r,t)}},arraySetter:function(e,r){return function(t){e.uniform1uiv(r,t)}}},c[36294]={Type:Uint32Array,size:8,setter:function(e,r){return function(t){e.uniform2uiv(r,t)}}},c[36295]={Type:Uint32Array,size:12,setter:function(e,r){return function(t){e.uniform3uiv(r,t)}}},c[36296]={Type:Uint32Array,size:16,setter:function(e,r){return function(t){e.uniform4uiv(r,t)}}},c[35670]={Type:Uint32Array,size:4,setter:s,arraySetter:v},c[35671]={Type:Uint32Array,size:8,setter:b},c[35672]={Type:Uint32Array,size:12,setter:y},c[35673]={Type:Uint32Array,size:16,setter:d},c[35674]={Type:Float32Array,size:16,setter:function(e,r){return function(t){e.uniformMatrix2fv(r,!1,t)}}},c[35675]={Type:Float32Array,size:36,setter:function(e,r){return function(t){e.uniformMatrix3fv(r,!1,t)}}},c[35676]={Type:Float32Array,size:64,setter:function(e,r){return function(t){e.uniformMatrix4fv(r,!1,t)}}},c[35685]={Type:Float32Array,size:24,setter:function(e,r){return function(t){e.uniformMatrix2x3fv(r,!1,t)}}},c[35686]={Type:Float32Array,size:32,setter:function(e,r){return function(t){e.uniformMatrix2x4fv(r,!1,t)}}},c[35687]={Type:Float32Array,size:24,setter:function(e,r){return function(t){e.uniformMatrix3x2fv(r,!1,t)}}},c[35688]={Type:Float32Array,size:48,setter:function(e,r){return function(t){e.uniformMatrix3x4fv(r,!1,t)}}},c[35689]={Type:Float32Array,size:32,setter:function(e,r){return function(t){e.uniformMatrix4x2fv(r,!1,t)}}},c[35690]={Type:Float32Array,size:48,setter:function(e,r){return function(t){e.uniformMatrix4x3fv(r,!1,t)}}},c[35678]={Type:null,size:0,setter:m,arraySetter:p,bindPoint:3553},c[35680]={Type:null,size:0,setter:m,arraySetter:p,bindPoint:34067},c[35679]={Type:null,size:0,setter:m,arraySetter:p,bindPoint:32879},c[35682]={Type:null,size:0,setter:m,arraySetter:p,bindPoint:3553},c[36289]={Type:null,size:0,setter:m,arraySetter:p,bindPoint:35866},c[36292]={Type:null,size:0,setter:m,arraySetter:p,bindPoint:35866},c[36293]={Type:null,size:0,setter:m,arraySetter:p,bindPoint:34067},c[36298]={Type:null,size:0,setter:m,arraySetter:p,bindPoint:3553},c[36299]={Type:null,size:0,setter:m,arraySetter:p,bindPoint:32879},c[36300]={Type:null,size:0,setter:m,arraySetter:p,bindPoint:34067},c[36303]={Type:null,size:0,setter:m,arraySetter:p,bindPoint:35866},c[36306]={Type:null,size:0,setter:m,arraySetter:p,bindPoint:3553},c[36307]={Type:null,size:0,setter:m,arraySetter:p,bindPoint:32879},c[36308]={Type:null,size:0,setter:m,arraySetter:p,bindPoint:34067},c[36311]={Type:null,size:0,setter:m,arraySetter:p,bindPoint:35866};var E={};E[5126]={size:4,setter:x},E[35664]={size:8,setter:x},E[35665]={size:12,setter:x},E[35666]={size:16,setter:x},E[5124]={size:4,setter:h},E[35667]={size:8,setter:h},E[35668]={size:12,setter:h},E[35669]={size:16,setter:h},E[5125]={size:4,setter:F},E[36294]={size:8,setter:F},E[36295]={size:12,setter:F},E[36296]={size:16,setter:F},E[35670]={size:4,setter:h},E[35671]={size:8,setter:h},E[35672]={size:12,setter:h},E[35673]={size:16,setter:h},E[35674]={size:4,setter:w,count:2},E[35675]={size:9,setter:w,count:3},E[35676]={size:16,setter:w,count:4};var A=/^[ \t]*\n/;function O(e,r,t,n){var o=n||a,i=e.createShader(t),u=0;if(A.test(r)&&(u=1,r=r.replace(A,"")),e.shaderSource(i,r),e.compileShader(i),!e.getShaderParameter(i,e.COMPILE_STATUS)){var f=e.getShaderInfoLog(i);return o(function(e,r){return r=r||0,++r,e.split("\n").map(function(e,t){return t+r+": "+e}).join("\n")}(r,u)+"\n*** Error compiling shader: "+f),e.deleteShader(i),null}return i}function _(e,r,t){var n;if("function"==typeof r&&(t=r,r=void 0),"function"==typeof e)t=e,e=void 0;else if(e&&!Array.isArray(e)){if(e.errorCallback)return e;var o=e;t=o.errorCallback,e=o.attribLocations,n=o.transformFeedbackVaryings}var i={errorCallback:t||a,transformFeedbackVaryings:n};if(e){var u={};Array.isArray(e)?e.forEach(function(e,t){u[e]=r?r[t]:t}):u=e,i.attribLocations=u}return i}var j=["VERTEX_SHADER","FRAGMENT_SHADER"];function M(e,r){return r.indexOf("frag")>=0?e.FRAGMENT_SHADER:r.indexOf("vert")>=0?e.VERTEX_SHADER:void 0}function P(e,r){r.forEach(function(r){e.deleteShader(r)})}function R(e,r,t,n,i){for(var a=_(t,n,i),u=[],c=[],l=0;l<r.length;++l){var s=r[l];if("string"==typeof s){var v=f(s),b=v?v.text:s,y=e[j[l]];v&&v.type&&(y=M(e,v.type)||y),s=O(e,b,y,a.errorCallback),c.push(s)}o.isShader(e,s)&&u.push(s)}if(u.length!==r.length)return a.errorCallback("not enough shaders for program"),P(e,c),null;var d=e.createProgram();u.forEach(function(r){e.attachShader(d,r)}),a.attribLocations&&Object.keys(a.attribLocations).forEach(function(r){e.bindAttribLocation(d,a.attribLocations[r],r)});var m=a.transformFeedbackVaryings;if(m&&(m.attribs&&(m=m.attribs),Array.isArray(m)||(m=Object.keys(m)),e.transformFeedbackVaryings(d,m,a.transformFeedbackMode||e.SEPARATE_ATTRIBS)),e.linkProgram(d),!e.getProgramParameter(d,e.LINK_STATUS)){var p=e.getProgramInfoLog(d);return a.errorCallback("Error in program linking:"+p),e.deleteProgram(d),P(e,c),null}return d}function T(e,r,t,n){var o,i=f(r);if(!i)throw new Error("unknown script element: ".concat(r));o=i.text;var a=t||M(e,i.type);if(!a)throw new Error("unknown shader type");return O(e,o,a,n)}function g(e,r,t,n,o){for(var i=_(t,n,o),a=[],u=0;u<r.length;++u){var f=O(e,r[u],e[j[u]],i.errorCallback);if(!f)return null;a.push(f)}return R(e,a,i)}function z(e){var r=e.name;return r.startsWith("gl_")||r.startsWith("webgl_")}function U(e,r){var t=0;function n(r,n){var o,i=e.getUniformLocation(r,n.name),a=n.size>1&&"[0]"===n.name.substr(-3),u=n.type,f=c[u];if(!f)throw new Error("unknown type: 0x".concat(u.toString(16)));if(f.bindPoint){var l=t;t+=n.size,o=a?f.arraySetter(e,u,l,i,n.size):f.setter(e,u,l,i,n.size)}else o=f.arraySetter&&a?f.arraySetter(e,i):f.setter(e,i);return o.location=i,o}for(var o={},i=e.getProgramParameter(r,e.ACTIVE_UNIFORMS),a=0;a<i;++a){var u=e.getActiveUniform(r,a);if(!z(u)){var f=u.name;"[0]"===f.substr(-3)&&(f=f.substr(0,f.length-3));var l=n(r,u);o[f]=l}}return o}function C(e,r){for(var t={},n=e.getProgramParameter(r,e.TRANSFORM_FEEDBACK_VARYINGS),o=0;o<n;++o){var i=e.getTransformFeedbackVarying(r,o);t[i.name]={index:o,type:i.type,size:i.size}}return t}function S(e,r,t){for(var n in r.transformFeedbackInfo&&(r=r.transformFeedbackInfo),t.attribs&&(t=t.attribs),t){var o=r[n];if(o){var i=t[n];i.offset?e.bindBufferRange(e.TRANSFORM_FEEDBACK_BUFFER,o.index,i.buffer,i.offset,i.size):e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER,o.index,i.buffer)}}}function I(e,r){for(var t=e.getProgramParameter(r,e.ACTIVE_UNIFORMS),n=[],o=[],i=0;i<t;++i){o.push(i),n.push({});var a=e.getActiveUniform(r,i);if(z(a))break;n[i].name=a.name}[["UNIFORM_TYPE","type"],["UNIFORM_SIZE","size"],["UNIFORM_BLOCK_INDEX","blockNdx"],["UNIFORM_OFFSET","offset"]].forEach(function(t){var i=t[0],a=t[1];e.getActiveUniforms(r,o,e[i]).forEach(function(e,r){n[r][a]=e})});for(var u={},f=e.getProgramParameter(r,e.ACTIVE_UNIFORM_BLOCKS),c=0;c<f;++c){var l=e.getActiveUniformBlockName(r,c),s={index:c,usedByVertexShader:e.getActiveUniformBlockParameter(r,c,e.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER),usedByFragmentShader:e.getActiveUniformBlockParameter(r,c,e.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER),size:e.getActiveUniformBlockParameter(r,c,e.UNIFORM_BLOCK_DATA_SIZE),uniformIndices:e.getActiveUniformBlockParameter(r,c,e.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES)};s.used=s.usedByVertexShader||s.usedByFragmentShader,u[l]=s}return{blockSpecs:u,uniformData:n}}var B=/\[\d+\]\.$/;function L(e,r,t,n){var o=t.blockSpecs,i=t.uniformData,a=o[n];if(!a)return u("no uniform block object named:",n),{name:n,uniforms:{}};var f=new ArrayBuffer(a.size),l=e.createBuffer(),s=a.index;e.bindBuffer(e.UNIFORM_BUFFER,l),e.uniformBlockBinding(r,a.index,s);var v=n+".";B.test(v)&&(v=v.replace(B,"."));var b={};return a.uniformIndices.forEach(function(e){var r=i[e],t=c[r.type],n=t.Type,o=r.size*t.size,a=r.name;a.substr(0,v.length)===v&&(a=a.substr(v.length)),b[a]=new n(f,r.offset,o/n.BYTES_PER_ELEMENT)}),{name:n,array:f,asFloat:new Float32Array(f),buffer:l,uniforms:b}}function k(e,r,t){var n=(r.uniformBlockSpec||r).blockSpecs[t.name];if(n){var o=n.index;return e.bindBufferRange(e.UNIFORM_BUFFER,o,t.buffer,t.offset||0,t.array.byteLength),!0}return!1}function G(e,r){for(var t={},n=e.getProgramParameter(r,e.ACTIVE_ATTRIBUTES),o=0;o<n;++o){var i=e.getActiveAttrib(r,o);if(!z(i)){var a=e.getAttribLocation(r,i.name),u=E[i.type],f=u.setter(e,a,u);f.location=a,t[i.name]=f}}return t}function W(e,r){for(var t in r){var n=e[t];n&&n(r[t])}}function X(e,r){var t={program:r,uniformSetters:U(e,r),attribSetters:G(e,r)};return n.isWebGL2(e)&&(t.uniformBlockSpec=I(e,r),t.transformFeedbackInfo=C(e,r)),t}},function(e,r,t){"use strict";r.__esModule=!0,r.axisRotate=function(e,r,t,n){n=n||new o(16);var i=r[0],a=r[1],u=r[2],f=Math.sqrt(i*i+a*a+u*u),c=(i/=f)*i,l=(a/=f)*a,s=(u/=f)*u,v=Math.cos(t),b=Math.sin(t),y=1-v,d=c+(1-c)*v,m=i*a*y+u*b,p=i*u*y-a*b,x=i*a*y-u*b,h=l+(1-l)*v,F=a*u*y+i*b,w=i*u*y+a*b,E=a*u*y-i*b,A=s+(1-s)*v,O=e[0],_=e[1],j=e[2],M=e[3],P=e[4],R=e[5],T=e[6],g=e[7],z=e[8],U=e[9],C=e[10],S=e[11];n[0]=d*O+m*P+p*z,n[1]=d*_+m*R+p*U,n[2]=d*j+m*T+p*C,n[3]=d*M+m*g+p*S,n[4]=x*O+h*P+F*z,n[5]=x*_+h*R+F*U,n[6]=x*j+h*T+F*C,n[7]=x*M+h*g+F*S,n[8]=w*O+E*P+A*z,n[9]=w*_+E*R+A*U,n[10]=w*j+E*T+A*C,n[11]=w*M+E*g+A*S,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 o(16);var n=e[0],i=e[1],a=e[2],u=Math.sqrt(n*n+i*i+a*a),f=(n/=u)*n,c=(i/=u)*i,l=(a/=u)*a,s=Math.cos(r),v=Math.sin(r),b=1-s;return t[0]=f+(1-f)*s,t[1]=n*i*b+a*v,t[2]=n*a*b-i*v,t[3]=0,t[4]=n*i*b-a*v,t[5]=c+(1-c)*s,t[6]=i*a*b+n*v,t[7]=0,t[8]=n*a*b+i*v,t[9]=i*a*b-n*v,t[10]=l+(1-l)*s,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},r.copy=f,r.frustum=function(e,r,t,n,i,a,u){u=u||new o(16);var f=r-e,c=n-t,l=i-a;return u[0]=2*i/f,u[1]=0,u[2]=0,u[3]=0,u[4]=0,u[5]=2*i/c,u[6]=0,u[7]=0,u[8]=(e+r)/f,u[9]=(n+t)/c,u[10]=a/l,u[11]=-1,u[12]=0,u[13]=0,u[14]=i*a/l,u[15]=0,u},r.getAxis=function(e,r,t){t=t||n.create();var o=4*r;return t[0]=e[o+0],t[1]=e[o+1],t[2]=e[o+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,f){f=f||new o(16);var c=i,l=a,s=u;return n.normalize(n.subtract(e,r,s),s),n.normalize(n.cross(t,s,c),c),n.normalize(n.cross(s,c,l),l),f[0]=c[0],f[1]=c[1],f[2]=c[2],f[3]=0,f[4]=l[0],f[5]=l[1],f[6]=l[2],f[7]=0,f[8]=s[0],f[9]=s[1],f[10]=s[2],f[11]=0,f[12]=e[0],f[13]=e[1],f[14]=e[2],f[15]=1,f},r.multiply=function(e,r,t){t=t||new o(16);var n=e[0],i=e[1],a=e[2],u=e[3],f=e[4],c=e[5],l=e[6],s=e[7],v=e[8],b=e[9],y=e[10],d=e[11],m=e[12],p=e[13],x=e[14],h=e[15],F=r[0],w=r[1],E=r[2],A=r[3],O=r[4],_=r[5],j=r[6],M=r[7],P=r[8],R=r[9],T=r[10],g=r[11],z=r[12],U=r[13],C=r[14],S=r[15];return t[0]=n*F+f*w+v*E+m*A,t[1]=i*F+c*w+b*E+p*A,t[2]=a*F+l*w+y*E+x*A,t[3]=u*F+s*w+d*E+h*A,t[4]=n*O+f*_+v*j+m*M,t[5]=i*O+c*_+b*j+p*M,t[6]=a*O+l*_+y*j+x*M,t[7]=u*O+s*_+d*j+h*M,t[8]=n*P+f*R+v*T+m*g,t[9]=i*P+c*R+b*T+p*g,t[10]=a*P+l*R+y*T+x*g,t[11]=u*P+s*R+d*T+h*g,t[12]=n*z+f*U+v*C+m*S,t[13]=i*z+c*U+b*C+p*S,t[14]=a*z+l*U+y*C+x*S,t[15]=u*z+s*U+d*C+h*S,t},r.negate=function(e,r){return(r=r||new o(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,i,a,u){return(u=u||new o(16))[0]=2/(r-e),u[1]=0,u[2]=0,u[3]=0,u[4]=0,u[5]=2/(n-t),u[6]=0,u[7]=0,u[8]=0,u[9]=0,u[10]=2/(i-a),u[11]=0,u[12]=(r+e)/(e-r),u[13]=(n+t)/(t-n),u[14]=(a+i)/(i-a),u[15]=1,u},r.perspective=function(e,r,t,n,i){i=i||new o(16);var a=Math.tan(.5*Math.PI-.5*e),u=1/(t-n);return i[0]=a/r,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=a,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=(t+n)*u,i[11]=-1,i[12]=0,i[13]=0,i[14]=t*n*u*2,i[15]=0,i},r.rotateX=function(e,r,t){t=t||new o(16);var n=e[4],i=e[5],a=e[6],u=e[7],f=e[8],c=e[9],l=e[10],s=e[11],v=Math.cos(r),b=Math.sin(r);t[4]=v*n+b*f,t[5]=v*i+b*c,t[6]=v*a+b*l,t[7]=v*u+b*s,t[8]=v*f-b*n,t[9]=v*c-b*i,t[10]=v*l-b*a,t[11]=v*s-b*u,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 o(16);var n=e[0],i=e[1],a=e[2],u=e[3],f=e[8],c=e[9],l=e[10],s=e[11],v=Math.cos(r),b=Math.sin(r);t[0]=v*n-b*f,t[1]=v*i-b*c,t[2]=v*a-b*l,t[3]=v*u-b*s,t[8]=v*f+b*n,t[9]=v*c+b*i,t[10]=v*l+b*a,t[11]=v*s+b*u,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 o(16);var n=e[0],i=e[1],a=e[2],u=e[3],f=e[4],c=e[5],l=e[6],s=e[7],v=Math.cos(r),b=Math.sin(r);t[0]=v*n+b*f,t[1]=v*i+b*c,t[2]=v*a+b*l,t[3]=v*u+b*s,t[4]=v*f-b*n,t[5]=v*c-b*i,t[6]=v*l-b*a,t[7]=v*s-b*u,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 o(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 o(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 o(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 o(16);var n=r[0],i=r[1],a=r[2];t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=n*e[3],t[4]=i*e[4],t[5]=i*e[5],t[6]=i*e[6],t[7]=i*e[7],t[8]=a*e[8],t[9]=a*e[9],t[10]=a*e[10],t[11]=a*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 o(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=f(e,n));var o=4*t;return n[o+0]=r[0],n[o+1]=r[1],n[o+2]=r[2],n},r.setDefaultType=function(e){var r=o;return o=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 o=r[0],i=r[1],a=r[2];return t[0]=o*e[0]+i*e[4]+a*e[8],t[1]=o*e[1]+i*e[5]+a*e[9],t[2]=o*e[2]+i*e[6]+a*e[10],t},r.transformNormal=function(e,r,t){t=t||n.create();var o=l(e),i=r[0],a=r[1],u=r[2];return t[0]=i*o[0]+a*o[1]+u*o[2],t[1]=i*o[4]+a*o[5]+u*o[6],t[2]=i*o[8]+a*o[9]+u*o[10],t},r.transformPoint=function(e,r,t){t=t||n.create();var o=r[0],i=r[1],a=r[2],u=o*e[3]+i*e[7]+a*e[11]+e[15];return t[0]=(o*e[0]+i*e[4]+a*e[8]+e[12])/u,t[1]=(o*e[1]+i*e[5]+a*e[9]+e[13])/u,t[2]=(o*e[2]+i*e[6]+a*e[10]+e[14])/u,t},r.translate=function(e,r,t){t=t||new o(16);var n=r[0],i=r[1],a=r[2],u=e[0],f=e[1],c=e[2],l=e[3],s=e[4],v=e[5],b=e[6],y=e[7],d=e[8],m=e[9],p=e[10],x=e[11],h=e[12],F=e[13],w=e[14],E=e[15];e!==t&&(t[0]=u,t[1]=f,t[2]=c,t[3]=l,t[4]=s,t[5]=v,t[6]=b,t[7]=y,t[8]=d,t[9]=m,t[10]=p,t[11]=x);return t[12]=u*n+s*i+d*a+h,t[13]=f*n+v*i+m*a+F,t[14]=c*n+b*i+p*a+w,t[15]=l*n+y*i+x*a+E,t},r.translation=function(e,r){return(r=r||new o(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 o(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],i=e[1],a=e[2],u=e[3],f=e[4],c=e[5],l=e[6],s=e[7],v=e[8],b=e[9],y=e[10],d=e[11],m=e[12],p=e[13],x=e[14],h=e[15];return r[0]=n,r[1]=f,r[2]=v,r[3]=m,r[4]=i,r[5]=c,r[6]=b,r[7]=p,r[8]=a,r[9]=l,r[10]=y,r[11]=x,r[12]=u,r[13]=s,r[14]=d,r[15]=h,r};var n=function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var n=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,t):{};n.get||n.set?Object.defineProperty(r,t,n):r[t]=e[t]}return r.default=e,r}(t(2));var o=Float32Array,i=n.create(),a=n.create(),u=n.create();function f(e,r){return(r=r||new o(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 o(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 o(16);var t=e[0],n=e[1],i=e[2],a=e[3],u=e[4],f=e[5],c=e[6],l=e[7],s=e[8],v=e[9],b=e[10],y=e[11],d=e[12],m=e[13],p=e[14],x=e[15],h=b*x,F=p*y,w=c*x,E=p*l,A=c*y,O=b*l,_=i*x,j=p*a,M=i*y,P=b*a,R=i*l,T=c*a,g=s*m,z=d*v,U=u*m,C=d*f,S=u*v,I=s*f,B=t*m,L=d*n,k=t*v,G=s*n,W=t*f,X=u*n,D=h*f+E*v+A*m-(F*f+w*v+O*m),N=F*n+_*v+P*m-(h*n+j*v+M*m),H=w*n+j*f+R*m-(E*n+_*f+T*m),q=O*n+M*f+T*v-(A*n+P*f+R*v),V=1/(t*D+u*N+s*H+d*q);return r[0]=V*D,r[1]=V*N,r[2]=V*H,r[3]=V*q,r[4]=V*(F*u+w*s+O*d-(h*u+E*s+A*d)),r[5]=V*(h*t+j*s+M*d-(F*t+_*s+P*d)),r[6]=V*(E*t+_*u+T*d-(w*t+j*u+R*d)),r[7]=V*(A*t+P*u+R*s-(O*t+M*u+T*s)),r[8]=V*(g*l+C*y+S*x-(z*l+U*y+I*x)),r[9]=V*(z*a+B*y+G*x-(g*a+L*y+k*x)),r[10]=V*(U*a+L*l+W*x-(C*a+B*l+X*x)),r[11]=V*(I*a+k*l+X*y-(S*a+G*l+W*y)),r[12]=V*(U*b+I*p+z*c-(S*p+g*c+C*b)),r[13]=V*(k*p+g*i+L*b-(B*b+G*p+z*i)),r[14]=V*(B*c+X*p+C*i-(W*p+U*i+L*c)),r[15]=V*(W*b+S*i+G*c-(k*c+X*b+I*i)),r}},function(e,r,t){"use strict";r.__esModule=!0,r.createAttribsFromArrays=m,r.createBuffersFromArrays=function(e,r){var t={};Object.keys(r).forEach(function(n){t[n]=x(e,r[n],n)}),r.indices?(t.numElements=r.indices.length,t.elementType=n.getGLTypeForTypedArray(d(r.indices),"indices")):t.numElements=function(e){var r,t;for(t=0;t<p.length&&!((r=p[t])in e);++t);t===p.length&&(r=Object.keys(e)[0]);var n=e[r],o=l(n).length,i=y(n,r),a=o/i;if(o%i>0)throw new Error("numComponents ".concat(i," not correct for length ").concat(o));return a}(r);return t},r.createBufferFromArray=x,r.createBufferFromTypedArray=f,r.createBufferInfoFromArrays=function(e,r,t){var o=m(e,r),i=Object.assign({},t||{});i.attribs=Object.assign({},t?t.attribs:{},o);var u=r.indices;if(u){var c=d(u,"indices");i.indices=f(e,c,e.ELEMENT_ARRAY_BUFFER),i.numElements=c.length,i.elementType=n.getGLTypeForTypedArray(c)}else i.numElements||(i.numElements=function(e,r){var t,n;for(n=0;n<p.length&&!((t=p[n])in r)&&!((t=a.attribPrefix+t)in r);++n);n===p.length&&(t=Object.keys(r)[0]);var o=r[t];e.bindBuffer(e.ARRAY_BUFFER,o.buffer);var i=e.getBufferParameter(e.ARRAY_BUFFER,e.BUFFER_SIZE);e.bindBuffer(e.ARRAY_BUFFER,null);var u=function(e,r){return r===e.BYTE?1:r===e.UNSIGNED_BYTE?1:r===e.SHORT?2:r===e.UNSIGNED_SHORT?2:r===e.INT?4:r===e.UNSIGNED_INT?4:r===e.FLOAT?4:0}(e,o.type),f=i/u,c=o.numComponents||o.size,l=f/c;if(l%1!=0)throw new Error("numComponents ".concat(c," not correct for length ").concat(length));return l}(e,i.attribs));return i},r.setAttribInfoBufferFromArray=function(e,r,t,n){t=d(t),void 0!==n?(e.bindBuffer(e.ARRAY_BUFFER,r.buffer),e.bufferSubData(e.ARRAY_BUFFER,n,t)):u(e,e.ARRAY_BUFFER,r.buffer,t,r.drawType)},r.setAttributePrefix=function(e){a.attribPrefix=e},r.setAttributeDefaults_=function(e){o.copyExistingProperties(e,a)},r.getNumComponents_=y,r.getArray_=l;var n=i(t(1)),o=i(t(0));function i(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var n=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,t):{};n.get||n.set?Object.defineProperty(r,t,n):r[t]=e[t]}return r.default=e,r}var a={attribPrefix:""};function u(e,r,t,n,o){e.bindBuffer(r,t),e.bufferData(r,n,o||e.STATIC_DRAW)}function f(e,r,t,n){if(o.isBuffer(e,r))return r;t=t||e.ARRAY_BUFFER;var i=e.createBuffer();return u(e,t,i,r,n),i}function c(e){return"indices"===e}function l(e){return e.length?e:e.data}var s=/coord|texture/i,v=/color|colour/i;function b(e,r){var t;if(r%(t=s.test(e)?2:v.test(e)?4:3)>0)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 y(e,r){return e.numComponents||e.size||b(r,l(e).length)}function d(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=c(r)?Uint16Array:Float32Array),new t(e.data)}function m(e,r){var t={};return Object.keys(r).forEach(function(o){if(!c(o)){var i=r[o],u=i.attrib||i.name||i.attribName||a.attribPrefix+o;if(i.value){if(!Array.isArray(i.value)&&!n.isArrayBuffer(i.value))throw new Error("array.value is not array or typedarray");t[u]={value:i.value}}else{var l,s,v,m;if(i.buffer&&i.buffer instanceof WebGLBuffer)l=i.buffer,m=i.numComponents||i.size,s=i.type,v=i.normalize;else if("number"==typeof i||"number"==typeof i.data){var p=i.data||i,x=i.type||Float32Array,h=p*x.BYTES_PER_ELEMENT;s=n.getGLTypeForTypedArrayType(x),v=void 0!==i.normalize?i.normalize:(w=x)===Int8Array||w===Uint8Array,m=i.numComponents||i.size||b(o,p),l=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,l),e.bufferData(e.ARRAY_BUFFER,h,i.drawType||e.STATIC_DRAW)}else{var F=d(i,o);l=f(e,F,void 0,i.drawType),s=n.getGLTypeForTypedArray(F),v=void 0!==i.normalize?i.normalize:function(e){return e instanceof Int8Array||e instanceof Uint8Array}(F),m=y(i,o)}t[u]={buffer:l,numComponents:m,type:s,normalize:v,stride:i.stride||0,offset:i.offset||0,divisor:void 0===i.divisor?void 0:i.divisor,drawType:i.drawType}}}var w}),e.bindBuffer(e.ARRAY_BUFFER,null),t}var p=["position","positions","a_position"];function x(e,r,t){var n="indices"===t?e.ELEMENT_ARRAY_BUFFER:e.ARRAY_BUFFER;return f(e,d(r,t),n)}},function(e,r,t){"use strict";r.__esModule=!0,r.setTextureDefaults_=function(e){i.copyExistingProperties(e,u),e.textureColor&&A(e.textureColor)},r.createSampler=z,r.createSamplers=function(e,r){var t={};return Object.keys(r).forEach(function(n){t[n]=z(e,r[n])}),t},r.setSamplerParameters=g,r.createTexture=Y,r.setEmptyTexture=V,r.setTextureFromArray=q,r.loadTextureFromUrl=D,r.setTextureFromElement=B,r.setTextureFilteringForSize=U,r.setTextureParameters=T,r.setDefaultTextureColor=A,r.createTextures=function(e,r,t){t=t||L;var n=0,o=[],i={},a={};function u(){0===n&&setTimeout(function(){t(o.length?o:void 0,i,a)},0)}return Object.keys(r).forEach(function(t){var f,c,l=r[t];("string"==typeof(c=l.src)||Array.isArray(c)&&"string"==typeof c[0])&&(f=function(e,r,i){a[t]=i,--n,e&&o.push(e),u()},++n),i[t]=Y(e,l,f)}),u(),i},r.resizeTexture=function(e,r,t,n,o){n=n||t.width,o=o||t.height;var i=t.target||e.TEXTURE_2D;e.bindTexture(i,r);var a,u=t.level||0,c=t.internalFormat||t.format||e.RGBA,l=p(c),s=t.format||l.format,v=t.src;a=v&&(f(v)||Array.isArray(v)&&"number"==typeof v[0])?t.type||w(e,v,l.type):t.type||l.type;if(i===e.TEXTURE_CUBE_MAP)for(var b=0;b<6;++b)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+b,u,c,n,o,0,s,a,null);else e.texImage2D(i,u,c,n,o,0,s,a,null)},r.canGenerateMipmap=h,r.canFilter=F,r.getNumComponentsForFormat=function(e){var r=v[e];if(!r)throw"unknown format: "+e;return r.u},r.getBytesPerElementForInternalFormat=m,r.getFormatAndTypeForInternalFormat=p;var n=a(t(3)),o=a(t(1)),i=a(t(0));function a(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var n=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,t):{};n.get||n.set?Object.defineProperty(r,t,n):r[t]=e[t]}return r.default=e,r}var u={textureColor:new Uint8Array([128,192,255,255]),textureOptions:{},crossOrigin:void 0},f=o.isArrayBuffer,c="undefined"!=typeof document&&document.createElement?document.createElement("canvas").getContext("2d"):null,l=6407,s=33319,v={},b=v;b[6406]={u:1},b[6409]={u:1},b[6410]={u:2},b[l]={u:3},b[6408]={u:4},b[6403]={u:1},b[36244]={u:1},b[s]={u:2},b[33320]={u:2},b[l]={u:3},b[36248]={u:3},b[6408]={u:4},b[36249]={u:4},b[6402]={u:1},b[34041]={u:2};var y={},d=y;function m(e,r){var t=y[e];if(!t)throw"unknown internal format";var n=t.bytesPerElementMap[r];if(void 0===n)throw"unknown internal format";return n}function p(e){var r=y[e];if(!r)throw"unknown internal format";return{format:r.v,type:r.type[0]}}function x(e){return 0==(e&e-1)}function h(e,r,t,o){if(!n.isWebGL2(e))return x(r)&&x(t);var i=y[o];if(!i)throw"unknown internal format";return i.h&&i.F}function F(e){var r=y[e];if(!r)throw"unknown internal format";return r.F}function w(e,r,t){return f(r)?o.getGLTypeForTypedArray(r):t||e.UNSIGNED_BYTE}function E(e,r,t,n,o){if(o%1!=0)throw"can't guess dimensions";if(t||n){if(n){if(!t&&(t=o/n)%1)throw"can't guess dimensions"}else if((n=o/t)%1)throw"can't guess dimensions"}else{var i=Math.sqrt(o/(r===e.TEXTURE_CUBE_MAP?6:1));i%1==0?(t=i,n=i):(t=o,n=1)}return{width:t,height:n}}function A(e){u.textureColor=new Uint8Array([255*e[0],255*e[1],255*e[2],255*e[3]])}d[6406]={v:6406,h:!0,F:!0,A:[1,2,2,4],type:[5121,5131,36193,5126]},d[6409]={v:6409,h:!0,F:!0,A:[1,2,2,4],type:[5121,5131,36193,5126]},d[6410]={v:6410,h:!0,F:!0,A:[2,4,4,8],type:[5121,5131,36193,5126]},d[l]={v:l,h:!0,F:!0,A:[3,6,6,12,2],type:[5121,5131,36193,5126,33635]},d[6408]={v:6408,h:!0,F:!0,A:[4,8,8,16,2,2],type:[5121,5131,36193,5126,32819,32820]},d[33321]={v:6403,h:!0,F:!0,A:[1],type:[5121]},d[36756]={v:6403,h:!1,F:!0,A:[1],type:[5120]},d[33325]={v:6403,h:!1,F:!0,A:[4,2],type:[5126,5131]},d[33326]={v:6403,h:!1,F:!1,A:[4],type:[5126]},d[33330]={v:36244,h:!0,F:!1,A:[1],type:[5121]},d[33329]={v:36244,h:!0,F:!1,A:[1],type:[5120]},d[33332]={v:36244,h:!0,F:!1,A:[2],type:[5123]},d[33331]={v:36244,h:!0,F:!1,A:[2],type:[5122]},d[33334]={v:36244,h:!0,F:!1,A:[4],type:[5125]},d[33333]={v:36244,h:!0,F:!1,A:[4],type:[5124]},d[33323]={v:s,h:!0,F:!0,A:[2],type:[5121]},d[36757]={v:s,h:!1,F:!0,A:[2],type:[5120]},d[33327]={v:s,h:!1,F:!0,A:[8,4],type:[5126,5131]},d[33328]={v:s,h:!1,F:!1,A:[8],type:[5126]},d[33336]={v:33320,h:!0,F:!1,A:[2],type:[5121]},d[33335]={v:33320,h:!0,F:!1,A:[2],type:[5120]},d[33338]={v:33320,h:!0,F:!1,A:[4],type:[5123]},d[33337]={v:33320,h:!0,F:!1,A:[4],type:[5122]},d[33340]={v:33320,h:!0,F:!1,A:[8],type:[5125]},d[33339]={v:33320,h:!0,F:!1,A:[8],type:[5124]},d[32849]={v:l,h:!0,F:!0,A:[3],type:[5121]},d[35905]={v:l,h:!1,F:!0,A:[3],type:[5121]},d[36194]={v:l,h:!0,F:!0,A:[3,2],type:[5121,33635]},d[36758]={v:l,h:!1,F:!0,A:[3],type:[5120]},d[35898]={v:l,h:!1,F:!0,A:[12,6,4],type:[5126,5131,35899]},d[35901]={v:l,h:!1,F:!0,A:[12,6,4],type:[5126,5131,35902]},d[34843]={v:l,h:!1,F:!0,A:[12,6],type:[5126,5131]},d[34837]={v:l,h:!1,F:!1,A:[12],type:[5126]},d[36221]={v:36248,h:!1,F:!1,A:[3],type:[5121]},d[36239]={v:36248,h:!1,F:!1,A:[3],type:[5120]},d[36215]={v:36248,h:!1,F:!1,A:[6],type:[5123]},d[36233]={v:36248,h:!1,F:!1,A:[6],type:[5122]},d[36209]={v:36248,h:!1,F:!1,A:[12],type:[5125]},d[36227]={v:36248,h:!1,F:!1,A:[12],type:[5124]},d[32856]={v:6408,h:!0,F:!0,A:[4],type:[5121]},d[35907]={v:6408,h:!0,F:!0,A:[4],type:[5121]},d[36759]={v:6408,h:!1,F:!0,A:[4],type:[5120]},d[32855]={v:6408,h:!0,F:!0,A:[4,2,4],type:[5121,32820,33640]},d[32854]={v:6408,h:!0,F:!0,A:[4,2],type:[5121,32819]},d[32857]={v:6408,h:!0,F:!0,A:[4],type:[33640]},d[34842]={v:6408,h:!1,F:!0,A:[16,8],type:[5126,5131]},d[34836]={v:6408,h:!1,F:!1,A:[16],type:[5126]},d[36220]={v:36249,h:!0,F:!1,A:[4],type:[5121]},d[36238]={v:36249,h:!0,F:!1,A:[4],type:[5120]},d[36975]={v:36249,h:!0,F:!1,A:[4],type:[33640]},d[36214]={v:36249,h:!0,F:!1,A:[8],type:[5123]},d[36232]={v:36249,h:!0,F:!1,A:[8],type:[5122]},d[36226]={v:36249,h:!0,F:!1,A:[16],type:[5124]},d[36208]={v:36249,h:!0,F:!1,A:[16],type:[5125]},d[33189]={v:6402,h:!0,F:!1,A:[2,4],type:[5123,5125]},d[33190]={v:6402,h:!0,F:!1,A:[4],type:[5125]},d[36012]={v:6402,h:!0,F:!1,A:[4],type:[5126]},d[35056]={v:34041,h:!0,F:!1,A:[4],type:[34042]},d[36013]={v:34041,h:!0,F:!1,A:[4],type:[36269]},Object.keys(d).forEach(function(e){var r=d[e];r.bytesPerElementMap={},r.A.forEach(function(e,t){var n=r.type[t];r.bytesPerElementMap[n]=e})});var O={};function _(e,r){void 0!==r.colorspaceConversion&&(O.colorspaceConversion=e.getParameter(e.UNPACK_COLORSPACE_CONVERSION_WEBGL),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,r.colorspaceConversion)),void 0!==r.premultiplyAlpha&&(O.premultiplyAlpha=e.getParameter(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha)),void 0!==r.flipY&&(O.flipY=e.getParameter(e.UNPACK_FLIP_Y_WEBGL),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,r.flipY))}function j(e,r){void 0!==r.colorspaceConversion&&e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,O.colorspaceConversion),void 0!==r.premultiplyAlpha&&e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,O.premultiplyAlpha),void 0!==r.flipY&&e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,O.flipY)}function M(e){O.unpackAlignment=e.getParameter(e.UNPACK_ALIGNMENT),n.isWebGL2(e)&&(O.unpackRowLength=e.getParameter(e.UNPACK_ROW_LENGTH),O.unpackImageHeight=e.getParameter(e.UNPACK_IMAGE_HEIGHT),O.unpackSkipPixels=e.getParameter(e.UNPACK_SKIP_PIXELS),O.unpackSkipRows=e.getParameter(e.UNPACK_SKIP_ROWS),O.unpackSkipImages=e.getParameter(e.UNPACK_SKIP_IMAGES))}function P(e){e.pixelStorei(e.UNPACK_ALIGNMENT,O.unpackAlignment),n.isWebGL2(e)&&(e.pixelStorei(e.UNPACK_ROW_LENGTH,O.unpackRowLength),e.pixelStorei(e.UNPACK_IMAGE_HEIGHT,O.unpackImageHeight),e.pixelStorei(e.UNPACK_SKIP_PIXELS,O.unpackSkipPixels),e.pixelStorei(e.UNPACK_SKIP_ROWS,O.unpackSkipRows),e.pixelStorei(e.UNPACK_SKIP_IMAGES,O.unpackSkipImages))}function R(e,r,t,n){n.minMag&&(t.call(e,r,e.TEXTURE_MIN_FILTER,n.minMag),t.call(e,r,e.TEXTURE_MAG_FILTER,n.minMag)),n.min&&t.call(e,r,e.TEXTURE_MIN_FILTER,n.min),n.mag&&t.call(e,r,e.TEXTURE_MAG_FILTER,n.mag),n.wrap&&(t.call(e,r,e.TEXTURE_WRAP_S,n.wrap),t.call(e,r,e.TEXTURE_WRAP_T,n.wrap),(r===e.TEXTURE_3D||i.isSampler(e,r))&&t.call(e,r,e.TEXTURE_WRAP_R,n.wrap)),n.wrapR&&t.call(e,r,e.TEXTURE_WRAP_R,n.wrapR),n.wrapS&&t.call(e,r,e.TEXTURE_WRAP_S,n.wrapS),n.wrapT&&t.call(e,r,e.TEXTURE_WRAP_T,n.wrapT),n.minLod&&t.call(e,r,e.TEXTURE_MIN_LOD,n.minLod),n.maxLod&&t.call(e,r,e.TEXTURE_MAX_LOD,n.maxLod),n.baseLevel&&t.call(e,r,e.TEXTURE_BASE_LEVEL,n.baseLevel),n.maxLevel&&t.call(e,r,e.TEXTURE_MAX_LEVEL,n.maxLevel)}function T(e,r,t){var n=t.target||e.TEXTURE_2D;e.bindTexture(n,r),R(e,n,e.texParameteri,t)}function g(e,r,t){R(e,r,e.samplerParameteri,t)}function z(e,r){var t=e.createSampler();return g(e,t,r),t}function U(e,r,t,n,o,i,a){t=t||u.textureOptions,i=i||e.RGBA,a=a||e.UNSIGNED_BYTE;var f=t.target||e.TEXTURE_2D;if(n=n||t.width,o=o||t.height,e.bindTexture(f,r),h(e,n,o,i))e.generateMipmap(f);else{var c=F(i)?e.LINEAR:e.NEAREST;e.texParameteri(f,e.TEXTURE_MIN_FILTER,c),e.texParameteri(f,e.TEXTURE_MAG_FILTER,c),e.texParameteri(f,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(f,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)}}function C(e){return!0===e.auto||void 0===e.auto&&void 0===e.level}function S(e,r){return(r=r||{}).cubeFaceOrder||[e.TEXTURE_CUBE_MAP_POSITIVE_X,e.TEXTURE_CUBE_MAP_NEGATIVE_X,e.TEXTURE_CUBE_MAP_POSITIVE_Y,e.TEXTURE_CUBE_MAP_NEGATIVE_Y,e.TEXTURE_CUBE_MAP_POSITIVE_Z,e.TEXTURE_CUBE_MAP_NEGATIVE_Z]}function I(e,r){var t=S(e,r).map(function(e,r){return{face:e,ndx:r}});return t.sort(function(e,r){return e.face-r.face}),t}function B(e,r,t,n){var o=(n=n||u.textureOptions).target||e.TEXTURE_2D,i=n.level||0,a=t.width,f=t.height,l=n.internalFormat||n.format||e.RGBA,s=p(l),v=n.format||s.format,b=n.type||s.type;if(_(e,n),e.bindTexture(o,r),o===e.TEXTURE_CUBE_MAP){var y,d,m=t.width,x=t.height;if(m/6===x)y=x,d=[0,0,1,0,2,0,3,0,4,0,5,0];else if(x/6===m)y=m,d=[0,0,0,1,0,2,0,3,0,4,0,5];else if(m/3==x/2)y=m/3,d=[0,0,1,0,2,0,0,1,1,1,2,1];else{if(m/2!=x/3)throw"can't figure out cube map from element: "+(t.src?t.src:t.nodeName);y=m/2,d=[0,0,1,0,0,1,1,1,0,2,1,2]}c?(c.canvas.width=y,c.canvas.height=y,a=y,f=y,I(e,n).forEach(function(r){var n=d[2*r.ndx+0]*y,o=d[2*r.ndx+1]*y;c.drawImage(t,n,o,y,y,0,0,y,y),e.texImage2D(r.face,i,l,v,b,c.canvas)}),c.canvas.width=1,c.canvas.height=1):"undefined"!=typeof createImageBitmap&&(a=y,f=y,I(e,n).forEach(function(u){var c=d[2*u.ndx+0]*y,s=d[2*u.ndx+1]*y;e.texImage2D(u.face,i,l,y,y,0,v,b,null),createImageBitmap(t,c,s,y,y,{premultiplyAlpha:"none",colorSpaceConversion:"none"}).then(function(t){_(e,n),e.bindTexture(o,r),e.texImage2D(u.face,i,l,v,b,t),j(e,n),C(n)&&U(e,r,n,a,f,l,b)})}))}else if(o===e.TEXTURE_3D||o===e.TEXTURE_2D_ARRAY){var h=Math.min(t.width,t.height),F=Math.max(t.width,t.height),w=F/h;if(w%1!=0)throw"can not compute 3D dimensions of element";var E=t.width===F?1:0,A=t.height===F?1:0;M(e),e.pixelStorei(e.UNPACK_ALIGNMENT,1),e.pixelStorei(e.UNPACK_ROW_LENGTH,t.width),e.pixelStorei(e.UNPACK_IMAGE_HEIGHT,0),e.pixelStorei(e.UNPACK_SKIP_IMAGES,0),e.texImage3D(o,i,l,h,h,h,0,v,b,null);for(var O=0;O<w;++O){var R=O*h*E,g=O*h*A;e.pixelStorei(e.UNPACK_SKIP_PIXELS,R),e.pixelStorei(e.UNPACK_SKIP_ROWS,g),e.texSubImage3D(o,i,0,0,O,h,h,1,v,b,t)}P(e)}else e.texImage2D(o,i,l,v,b,t);j(e,n),C(n)&&U(e,r,n,a,f,l,b),T(e,r,n)}function L(){}function k(e,r){return void 0!==r||function(e){if("undefined"!=typeof document){var r=document.createElement("a");return r.href=e,r.hostname===location.hostname&&r.port===location.port&&r.protocol===location.protocol}var t=new URL(location.href).origin;return new URL(e,location.href).origin===t}(e)?r:"anonymous"}function G(e){return"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof ImageData&&e instanceof ImageData||"undefined"!=typeof HTMLElement&&e instanceof HTMLElement}function W(e,r,t){return G(e)?(setTimeout(function(){t(null,e)}),e):function(e,r,t){var n;if(t=t||L,r=void 0!==r?r:u.crossOrigin,r=k(e,r),"undefined"!=typeof Image){n=new Image,void 0!==r&&(n.crossOrigin=r);var o=function(){n.removeEventListener("error",a),n.removeEventListener("load",f),n=null},a=function(){var r="couldn't load image: "+e;i.error(r),t(r,n),o()},f=function(){t(null,n),o()};return n.addEventListener("error",a),n.addEventListener("load",f),n.src=e,n}if("undefined"!=typeof ImageBitmap){var c,l,s=function(){t(c,l)},v={};r&&(v.mode="cors"),fetch(e,v).then(function(e){if(!e.ok)throw e;return e.blob()}).then(function(e){return createImageBitmap(e,{premultiplyAlpha:"none",colorSpaceConversion:"none"})}).then(function(e){l=e,setTimeout(s)}).catch(function(e){c=e,setTimeout(s)}),n=null}return n}(e,r,t)}function X(e,r,t){var n=(t=t||u.textureOptions).target||e.TEXTURE_2D;if(e.bindTexture(n,r),!1!==t.color){var o=function(e){return e=e||u.textureColor,f(e)?e:new Uint8Array([255*e[0],255*e[1],255*e[2],255*e[3]])}(t.color);if(n===e.TEXTURE_CUBE_MAP)for(var i=0;i<6;++i)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,o);else n===e.TEXTURE_3D||n===e.TEXTURE_2D_ARRAY?e.texImage3D(n,0,e.RGBA,1,1,1,0,e.RGBA,e.UNSIGNED_BYTE,o):e.texImage2D(n,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,o)}}function D(e,r,t,n){return n=n||L,t=t||u.textureOptions,X(e,r,t),W((t=Object.assign({},t)).src,t.crossOrigin,function(o,i){o?n(o,r,i):(B(e,r,i,t),n(null,r,i))})}function N(e,r,t,n){n=n||L;var o=t.src;if(6!==o.length)throw"there must be 6 urls for a cubemap";var i=t.level||0,a=t.internalFormat||t.format||e.RGBA,u=p(a),f=t.format||u.format,c=t.type||e.UNSIGNED_BYTE,l=t.target||e.TEXTURE_2D;if(l!==e.TEXTURE_CUBE_MAP)throw"target must be TEXTURE_CUBE_MAP";X(e,r,t),t=Object.assign({},t);var s,v=6,b=[],y=S(e,t);s=o.map(function(o,u){return W(o,t.crossOrigin,(d=y[u],function(o,u){--v,o?b.push(o):u.width!==u.height?b.push("cubemap face img is not a square: "+u.src):(_(e,t),e.bindTexture(l,r),5===v?S(e).forEach(function(r){e.texImage2D(r,i,a,f,c,u)}):e.texImage2D(d,i,a,f,c,u),j(e,t),C(t)&&e.generateMipmap(l)),0===v&&n(b.length?b:void 0,r,s)}));var d})}function H(e,r,t,n){n=n||L;var o=t.src,i=t.internalFormat||t.format||e.RGBA,a=p(i),u=t.format||a.format,f=t.type||e.UNSIGNED_BYTE,l=t.target||e.TEXTURE_2D_ARRAY;if(l!==e.TEXTURE_3D&&l!==e.TEXTURE_2D_ARRAY)throw"target must be TEXTURE_3D or TEXTURE_2D_ARRAY";X(e,r,t),t=Object.assign({},t);var s,v=o.length,b=[],y=t.level||0,d=t.width,m=t.height,x=o.length,h=!0;s=o.map(function(o,a){return W(o,t.crossOrigin,(p=a,function(o,a){if(--v,o)b.push(o);else{if(_(e,t),e.bindTexture(l,r),h){h=!1,d=t.width||a.width,m=t.height||a.height,e.texImage3D(l,y,i,d,m,x,0,u,f,null);for(var F=0;F<x;++F)e.texSubImage3D(l,y,0,0,F,d,m,1,u,f,a)}else{var w=a;a.width===d&&a.height===m||(w=c.canvas,c.canvas.width=d,c.canvas.height=m,c.drawImage(a,0,0,d,m)),e.texSubImage3D(l,y,0,0,p,d,m,1,u,f,w),w===c.canvas&&(c.canvas.width=0,c.canvas.height=0)}j(e,t),C(t)&&e.generateMipmap(l)}0===v&&n(b.length?b:void 0,r,s)}));var p})}function q(e,r,t,i){var a=(i=i||u.textureOptions).target||e.TEXTURE_2D;e.bindTexture(a,r);var c=i.width,l=i.height,s=i.depth,v=i.level||0,b=i.internalFormat||i.format||e.RGBA,y=p(b),d=i.format||y.format,x=i.type||w(e,t,y.type);if(f(t))t instanceof Uint8ClampedArray&&(t=new Uint8Array(t.buffer));else{var h=o.getTypedArrayTypeForGLType(x);t=new h(t)}var F,A=m(b,x),O=t.byteLength/A;if(O%1)throw"length wrong size for format: "+n.glEnumToString(e,d);if(a===e.TEXTURE_3D)if(c||l||s)!c||l&&s?!l||c&&s?(F=E(e,a,c,l,O/s),c=F.width,l=F.height):(F=E(e,a,c,s,O/l),c=F.width,s=F.height):(F=E(e,a,l,s,O/c),l=F.width,s=F.height);else{var R=Math.cbrt(O);if(R%1!=0)throw"can't guess cube size of array of numElements: "+O;c=R,l=R,s=R}else F=E(e,a,c,l,O),c=F.width,l=F.height;if(M(e),e.pixelStorei(e.UNPACK_ALIGNMENT,i.unpackAlignment||1),_(e,i),a===e.TEXTURE_CUBE_MAP){var T=O/6*(A/t.BYTES_PER_ELEMENT);I(e,i).forEach(function(r){var n=T*r.ndx,o=t.subarray(n,n+T);e.texImage2D(r.face,v,b,c,l,0,d,x,o)})}else a===e.TEXTURE_3D?e.texImage3D(a,v,b,c,l,s,0,d,x,t):e.texImage2D(a,v,b,c,l,0,d,x,t);return j(e,i),P(e),{width:c,height:l,depth:s,type:x}}function V(e,r,t){var n=t.target||e.TEXTURE_2D;e.bindTexture(n,r);var o=t.level||0,i=t.internalFormat||t.format||e.RGBA,a=p(i),u=t.format||a.format,f=t.type||a.type;if(_(e,t),n===e.TEXTURE_CUBE_MAP)for(var c=0;c<6;++c)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+c,o,i,t.width,t.height,0,u,f,null);else n===e.TEXTURE_3D?e.texImage3D(n,o,i,t.width,t.height,t.depth,0,u,f,null):e.texImage2D(n,o,i,t.width,t.height,0,u,f,null);j(e,t)}function Y(e,r,t){t=t||L,r=r||u.textureOptions;var n=e.createTexture(),o=r.target||e.TEXTURE_2D,i=r.width||1,a=r.height||1,c=r.internalFormat||e.RGBA,l=p(c),s=r.type||l.type;e.bindTexture(o,n),o===e.TEXTURE_CUBE_MAP&&(e.texParameteri(o,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(o,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE));var v=r.src;if(v)if("function"==typeof v&&(v=v(e,r)),"string"==typeof v)D(e,n,r,t);else if(f(v)||Array.isArray(v)&&("number"==typeof v[0]||Array.isArray(v[0])||f(v[0]))){var b=q(e,n,v,r);i=b.width,a=b.height,s=b.type}else if(Array.isArray(v)&&("string"==typeof v[0]||G(v[0])))o===e.TEXTURE_CUBE_MAP?N(e,n,r,t):H(e,n,r,t);else{if(!G(v))throw"unsupported src type";B(e,n,v,r),i=v.width,a=v.height}else V(e,n,r);return C(r)&&U(e,n,r,i,a,c,s),T(e,n,r),n}},function(e,r,t){"use strict";r.__esModule=!0;var n={m4:!0,v3:!0,primitives:!0};r.primitives=r.v3=r.m4=void 0;var o=f(t(5));r.m4=o;var i=f(t(2));r.v3=i;var a=f(t(9));r.primitives=a;var u=t(10);function f(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var n=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,t):{};n.get||n.set?Object.defineProperty(r,t,n):r[t]=e[t]}return r.default=e,r}Object.keys(u).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(n,e)||(r[e]=u[e]))})},function(e,r,t){"use strict";r.__esModule=!0,r.create3DFVertices=M,r.createAugmentedTypedArray=v,r.createCubeVertices=O,r.createPlaneVertices=w,r.createSphereVertices=E,r.createTruncatedConeVertices=_,r.createXYQuadVertices=F,r.createCrescentVertices=P,r.createCylinderVertices=R,r.createTorusVertices=T,r.createDiscVertices=g,r.deindexVertices=function(e){var r=e.indices,t={},n=r.length;return Object.keys(e).filter(b).forEach(function(o){for(var i=e[o],a=i.numComponents,u=v(a,n,i.constructor),f=0;f<n;++f)for(var c=r[f],l=c*a,s=0;s<a;++s)u.push(i[l+s]);t[o]=u}),t},r.flattenNormals=function(e){if(e.indices)throw new Error("can not flatten normals of indexed vertices. deindex them first");for(var r=e.normal,t=r.length,n=0;n<t;n+=9){var o=r[n+0],i=r[n+1],a=r[n+2],u=r[n+3],f=r[n+4],c=r[n+5],l=r[n+6],s=r[n+7],v=r[n+8],b=o+u+l,y=i+f+s,d=a+c+v,m=Math.sqrt(b*b+y*y+d*d);b/=m,y/=m,d/=m,r[n+0]=b,r[n+1]=y,r[n+2]=d,r[n+3]=b,r[n+4]=y,r[n+5]=d,r[n+6]=b,r[n+7]=y,r[n+8]=d}return e},r.makeRandomVertexColors=function(e,r){r=r||{};var t=e.position.numElements,n=v(4,t,Uint8Array),o=r.rand||function(e,r){return r<3?(t=256,Math.random()*t|0):255;var t};if(e.color=n,e.indices)for(var i=0;i<t;++i)n.push(o(i,0),o(i,1),o(i,2),o(i,3));else for(var a=r.vertsPerColor||3,u=t/a,f=0;f<u;++f)for(var c=[o(f,0),o(f,1),o(f,2),o(f,3)],l=0;l<a;++l)n.push(c);return e},r.reorientDirections=m,r.reorientNormals=p,r.reorientPositions=x,r.reorientVertices=h,r.concatVertices=function(e){for(var r,t={},n=function(n){var o=e[n];Object.keys(o).forEach(function(e){t[e]||(t[e]=[]),r||"indices"===e||(r=e);var n=o[e],i=l(n,e),a=c(n),u=a.length/i;t[e].push(u)})},o=0;o<e.length;++o)n(o);var i=t[r],a={};return Object.keys(t).forEach(function(r){var t=function(r){for(var t,n=0,o=0;o<e.length;++o){var i=e[o],a=i[r],u=c(a);n+=u.length,t&&!a.data||(t=a)}return{length:n,spec:t}}(r),n=I(t.spec,t.length);!function(r,t,n){for(var o=0,i=0,a=0;a<e.length;++a){var u=e[a],f=u[r],l=c(f);"indices"===r?(S(l,n,i,o),o+=t[a]):S(l,n,i),i+=l.length}}(r,i,c(n)),a[r]=n}),a},r.duplicateVertices=function(e){var r={};return Object.keys(e).forEach(function(t){var n=e[t],o=c(n),i=I(n,o.length);S(o,c(i),0),r[t]=i}),r},r.createDiscBuffers=r.createDiscBufferInfo=r.createTorusBuffers=r.createTorusBufferInfo=r.createCylinderBuffers=r.createCylinderBufferInfo=r.createCrescentBuffers=r.createCrescentBufferInfo=r.createCresentVertices=r.createCresentBuffers=r.createCresentBufferInfo=r.createXYQuadBuffers=r.createXYQuadBufferInfo=r.createTruncatedConeBuffers=r.createTruncatedConeBufferInfo=r.createSphereBuffers=r.createSphereBufferInfo=r.createPlaneBuffers=r.createPlaneBufferInfo=r.createCubeBuffers=r.createCubeBufferInfo=r.create3DFBuffers=r.create3DFBufferInfo=void 0;var n=f(t(6)),o=f(t(0)),i=f(t(1)),a=f(t(5)),u=f(t(2));function f(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var n=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,t):{};n.get||n.set?Object.defineProperty(r,t,n):r[t]=e[t]}return r.default=e,r}var c=n.getArray_,l=n.getNumComponents_;function s(e,r){var t=0;return e.push=function(){for(var r=0;r<arguments.length;++r){var n=arguments[r];if(n instanceof Array||i.isArrayBuffer(n))for(var o=0;o<n.length;++o)e[t++]=n[o];else e[t++]=n}},e.reset=function(e){t=e||0},e.numComponents=r,Object.defineProperty(e,"numElements",{get:function(){return this.length/this.numComponents|0}}),e}function v(e,r,t){return s(new(t||Float32Array)(e*r),e)}function b(e){return"indices"!==e}function y(e,r,t){for(var n=e.length,o=new Float32Array(3),i=0;i<n;i+=3)t(r,[e[i],e[i+1],e[i+2]],o),e[i]=o[0],e[i+1]=o[1],e[i+2]=o[2]}function d(e,r,t){t=t||u.create();var n=r[0],o=r[1],i=r[2];return t[0]=n*e[0]+o*e[1]+i*e[2],t[1]=n*e[4]+o*e[5]+i*e[6],t[2]=n*e[8]+o*e[9]+i*e[10],t}function m(e,r){return y(e,r,a.transformDirection),e}function p(e,r){return y(e,a.inverse(r),d),e}function x(e,r){return y(e,r,a.transformPoint),e}function h(e,r){return Object.keys(e).forEach(function(t){var n=e[t];t.indexOf("pos")>=0?x(n,r):t.indexOf("tan")>=0||t.indexOf("binorm")>=0?m(n,r):t.indexOf("norm")>=0&&p(n,r)}),e}function F(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 w(e,r,t,n,o){e=e||1,r=r||1,t=t||1,n=n||1,o=o||a.identity();for(var i=(t+1)*(n+1),u=v(3,i),f=v(3,i),c=v(2,i),l=0;l<=n;l++)for(var s=0;s<=t;s++){var b=s/t,y=l/n;u.push(e*b-.5*e,0,r*y-.5*r),f.push(0,1,0),c.push(b,y)}for(var d=t+1,m=v(3,t*n*2,Uint16Array),p=0;p<n;p++)for(var x=0;x<t;x++)m.push((p+0)*d+x,(p+1)*d+x,(p+0)*d+x+1),m.push((p+1)*d+x,(p+1)*d+x+1,(p+0)*d+x+1);return h({position:u,normal:f,texcoord:c,indices:m},o)}function E(e,r,t,n,o,i,a){if(r<=0||t<=0)throw new Error("subdivisionAxis and subdivisionHeight must be > 0");n=n||0,i=i||0;for(var u=(o=o||Math.PI)-n,f=(a=a||2*Math.PI)-i,c=(r+1)*(t+1),l=v(3,c),s=v(3,c),b=v(2,c),y=0;y<=t;y++)for(var d=0;d<=r;d++){var m=d/r,p=y/t,x=f*m+i,h=u*p+n,F=Math.sin(x),w=Math.cos(x),E=Math.sin(h),A=w*E,O=Math.cos(h),_=F*E;l.push(e*A,e*O,e*_),s.push(A,O,_),b.push(1-m,p)}for(var j=r+1,M=v(3,r*t*2,Uint16Array),P=0;P<r;P++)for(var R=0;R<t;R++)M.push((R+0)*j+P,(R+0)*j+P+1,(R+1)*j+P),M.push((R+1)*j+P,(R+0)*j+P+1,(R+1)*j+P+1);return{position:l,normal:s,texcoord:b,indices:M}}var A=[[3,7,5,1],[6,2,0,4],[6,7,3,2],[0,1,5,4],[7,6,4,5],[2,3,1,0]];function O(e){for(var r=(e=e||1)/2,t=[[-r,-r,-r],[+r,-r,-r],[-r,+r,-r],[+r,+r,-r],[-r,-r,+r],[+r,-r,+r],[-r,+r,+r],[+r,+r,+r]],n=[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],o=[[1,0],[0,0],[0,1],[1,1]],i=v(3,24),a=v(3,24),u=v(2,24),f=v(3,12,Uint16Array),c=0;c<6;++c){for(var l=A[c],s=0;s<4;++s){var b=t[l[s]],y=n[c],d=o[s];i.push(b),a.push(y),u.push(d)}var m=4*c;f.push(m+0,m+1,m+2),f.push(m+0,m+2,m+3)}return{position:i,normal:a,texcoord:u,indices:f}}function _(e,r,t,n,o,i,a){if(n<3)throw new Error("radialSubdivisions must be 3 or greater");if(o<1)throw new Error("verticalSubdivisions must be 1 or greater");for(var u=void 0===i||i,f=void 0===a||a,c=(u?2:0)+(f?2:0),l=(n+1)*(o+1+c),s=v(3,l),b=v(3,l),y=v(2,l),d=v(3,n*(o+c)*2,Uint16Array),m=n+1,p=Math.atan2(e-r,t),x=Math.cos(p),h=Math.sin(p),F=o+(f?2:0),w=u?-2:0;w<=F;++w){var E=w/o,A=t*E,O=void 0;w<0?(A=0,E=1,O=e):w>o?(A=t,E=1,O=r):O=e+w/o*(r-e),-2!==w&&w!==o+2||(O=0,E=0),A-=t/2;for(var _=0;_<m;++_){var j=Math.sin(_*Math.PI*2/n),M=Math.cos(_*Math.PI*2/n);s.push(j*O,A,M*O),b.push(w<0||w>o?0:j*x,w<0?-1:w>o?1:h,w<0||w>o?0:M*x),y.push(_/n,1-E)}}for(var P=0;P<o+c;++P)for(var R=0;R<n;++R)d.push(m*(P+0)+0+R,m*(P+0)+1+R,m*(P+1)+1+R),d.push(m*(P+0)+0+R,m*(P+1)+1+R,m*(P+1)+0+R);return{position:s,normal:b,texcoord:y,indices:d}}function j(e,r){r=r||[];for(var t=[],n=0;n<e.length;n+=4){var o=e[n],i=e.slice(n+1,n+4);i.push.apply(i,r);for(var a=0;a<o;++a)t.push.apply(t,i)}return t}function M(){var e=[0,0,0,0,150,0,30,0,0,0,150,0,30,150,0,30,0,0,30,0,0,30,30,0,100,0,0,30,30,0,100,30,0,100,0,0,30,60,0,30,90,0,67,60,0,30,90,0,67,90,0,67,60,0,0,0,30,30,0,30,0,150,30,0,150,30,30,0,30,30,150,30,30,0,30,100,0,30,30,30,30,30,30,30,100,0,30,100,30,30,30,60,30,67,60,30,30,90,30,30,90,30,67,60,30,67,90,30,0,0,0,100,0,0,100,0,30,0,0,0,100,0,30,0,0,30,100,0,0,100,30,0,100,30,30,100,0,0,100,30,30,100,0,30,30,30,0,30,30,30,100,30,30,30,30,0,100,30,30,100,30,0,30,30,0,30,60,30,30,30,30,30,30,0,30,60,0,30,60,30,30,60,0,67,60,30,30,60,30,30,60,0,67,60,0,67,60,30,67,60,0,67,90,30,67,60,30,67,60,0,67,90,0,67,90,30,30,90,0,30,90,30,67,90,30,30,90,0,67,90,30,67,90,0,30,90,0,30,150,30,30,90,30,30,90,0,30,150,0,30,150,30,0,150,0,0,150,30,30,150,30,0,150,0,30,150,30,30,150,0,0,0,0,0,0,30,0,150,30,0,0,0,0,150,30,0,150,0],r=j([18,0,0,1,18,0,0,-1,6,0,1,0,6,1,0,0,6,0,-1,0,6,1,0,0,6,0,1,0,6,1,0,0,6,0,-1,0,6,1,0,0,6,0,-1,0,6,-1,0,0]),t=j([18,200,70,120,18,80,70,200,6,70,200,210,6,200,200,70,6,210,100,70,6,210,160,70,6,70,180,210,6,100,70,210,6,76,210,100,6,140,210,80,6,90,130,110,6,160,160,220],[255]),n=e.length/3,o={position:v(3,n),texcoord:v(2,n),normal:v(3,n),color:v(4,n,Uint8Array),indices:v(3,n/3,Uint16Array)};o.position.push(e),o.texcoord.push([.22,.19,.22,.79,.34,.19,.22,.79,.34,.79,.34,.19,.34,.19,.34,.31,.62,.19,.34,.31,.62,.31,.62,.19,.34,.43,.34,.55,.49,.43,.34,.55,.49,.55,.49,.43,0,0,1,0,0,1,0,1,1,0,1,1,0,0,1,0,0,1,0,1,1,0,1,1,0,0,1,0,0,1,0,1,1,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,0,1,1,1,0,0,1,1,1,0,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,0,1,1,1,0,0,1,1,1,0,0,0,1,1,0,1,0,0,1,0,1,1,0,0,0,1,1,1,0,0,1,1,1,0,0,0,0,1,1,1,0,0,1,1,1,0]),o.normal.push(r),o.color.push(t);for(var i=0;i<n;++i)o.indices.push(i);return o}function P(e,r,t,n,o,i,a){if(o<=0)throw new Error("subdivisionDown must be > 0");var f=2,c=(a=a||1)-(i=i||0),l=2*(o+1)*(2+f),s=v(3,l),b=v(3,l),y=v(2,l);function d(e,r,t){return e+(r-e)*t}function m(r,t,a,l,v,m){for(var p=0;p<=o;p++){var x=t/(f-1),h=p/o,F=2*(x-.5),w=(i+h*c)*Math.PI,E=Math.sin(w),A=Math.cos(w),O=d(e,r,E),_=F*n,j=A*e,M=E*O;s.push(_,j,M);var P=u.add(u.multiply([0,E,A],a),l);b.push(P),y.push(x*v+m,h)}}for(var p=0;p<f;p++){var x=2*(p/(f-1)-.5);m(r,p,[1,1,1],[0,0,0],1,0),m(r,p,[0,0,0],[x,0,0],0,0),m(t,p,[1,1,1],[0,0,0],1,0),m(t,p,[0,0,0],[x,0,0],0,1)}var h=v(3,2*o*(2+f),Uint16Array);function F(e,r){for(var t=0;t<o;++t)h.push(e+t+0,e+t+1,r+t+0),h.push(e+t+1,r+t+1,r+t+0)}var w=o+1;return F(0*w,4*w),F(5*w,7*w),F(6*w,2*w),F(3*w,1*w),{position:s,normal:b,texcoord:y,indices:h}}function R(e,r,t,n,o,i){return _(e,e,r,t,n,o,i)}function T(e,r,t,n,o,i){if(t<3)throw new Error("radialSubdivisions must be 3 or greater");if(n<3)throw new Error("verticalSubdivisions must be 3 or greater");o=o||0;for(var a=(i=i||2*Math.PI)-o,u=t+1,f=n+1,c=u*f,l=v(3,c),s=v(3,c),b=v(2,c),y=v(3,t*n*2,Uint16Array),d=0;d<f;++d)for(var m=d/n,p=m*Math.PI*2,x=Math.sin(p),h=e+x*r,F=Math.cos(p),w=F*r,E=0;E<u;++E){var A=E/t,O=o+A*a,_=Math.sin(O),j=Math.cos(O),M=_*h,P=j*h,R=_*x,T=j*x;l.push(M,w,P),s.push(R,F,T),b.push(A,1-m)}for(var g=0;g<n;++g)for(var z=0;z<t;++z){var U=1+z,C=1+g;y.push(u*g+z,u*C+z,u*g+U),y.push(u*C+z,u*C+U,u*g+U)}return{position:l,normal:s,texcoord:b,indices:y}}function g(e,r,t,n,o){if(r<3)throw new Error("divisions must be at least 3");o=o||1,n=n||0;for(var i=(r+1)*((t=t||1)+1),a=v(3,i),u=v(3,i),f=v(2,i),c=v(3,t*r*2,Uint16Array),l=0,s=e-n,b=r+1,y=0;y<=t;++y){for(var d=n+s*Math.pow(y/t,o),m=0;m<=r;++m){var p=2*Math.PI*m/r,x=d*Math.cos(p),h=d*Math.sin(p);if(a.push(x,0,h),u.push(0,1,0),f.push(1-m/r,y/t),y>0&&m!==r){var F=l+(m+1),w=l+m,E=l+m-b,A=l+(m+1)-b;c.push(F,w,E),c.push(F,E,A)}}l+=r+1}return{position:a,normal:u,texcoord:f,indices:c}}function z(e){return function(r){var t=e.apply(this,Array.prototype.slice.call(arguments,1));return n.createBuffersFromArrays(r,t)}}function U(e){return function(r){var t=e.apply(null,Array.prototype.slice.call(arguments,1));return n.createBufferInfoFromArrays(r,t)}}var C=["numComponents","size","type","normalize","stride","offset","attrib","name","attribName"];function S(e,r,t,n){n=n||0;for(var o=e.length,i=0;i<o;++i)r[t+i]=e[i]+n}function I(e,r){var t=c(e),n=new t.constructor(r),i=n;return t.numComponents&&t.numElements&&s(n,t.numComponents),e.data&&(i={data:n},o.copyNamedProperties(C,e,i)),i}var B=U(M);r.create3DFBufferInfo=B;var L=z(M);r.create3DFBuffers=L;var k=U(O);r.createCubeBufferInfo=k;var G=z(O);r.createCubeBuffers=G;var W=U(w);r.createPlaneBufferInfo=W;var X=z(w);r.createPlaneBuffers=X;var D=U(E);r.createSphereBufferInfo=D;var N=z(E);r.createSphereBuffers=N;var H=U(_);r.createTruncatedConeBufferInfo=H;var q=z(_);r.createTruncatedConeBuffers=q;var V=U(F);r.createXYQuadBufferInfo=V;var Y=z(F);r.createXYQuadBuffers=Y;var K=U(P);r.createCrescentBufferInfo=K;var Z=z(P);r.createCrescentBuffers=Z;var $=U(R);r.createCylinderBufferInfo=$;var J=z(R);r.createCylinderBuffers=J;var Q=U(T);r.createTorusBufferInfo=Q;var ee=z(T);r.createTorusBuffers=ee;var re=U(g);r.createDiscBufferInfo=re;var te=z(g);r.createDiscBuffers=te;var ne=K;r.createCresentBufferInfo=ne;var oe=Z;r.createCresentBuffers=oe;var ie=P;r.createCresentVertices=ie},function(e,r,t){"use strict";r.__esModule=!0;var n={addExtensionsToContext:!0,getContext:!0,getWebGLContext:!0,resizeCanvasToDisplaySize:!0,setDefaults:!0,attributes:!0,textures:!0,utils:!0,draw:!0,framebuffers:!0,programs:!0,typedarrays:!0,vertexArrays:!0};r.addExtensionsToContext=x,r.getContext=function(e,r){return function(e,r){for(var t=["webgl2","webgl","experimental-webgl"],n=null,o=0;o<t.length;++o)if(n=e.getContext(t[o],r)){y.addExtensionsToContext&&x(n);break}return n}(e,r)},r.getWebGLContext=function(e,r){return function(e,r){for(var t=["webgl","experimental-webgl"],n=null,o=0;o<t.length;++o)if(n=e.getContext(t[o],r)){y.addExtensionsToContext&&x(n);break}return n}(e,r)},r.resizeCanvasToDisplaySize=function(e,r){r=r||1,r=Math.max(0,r);var t=e.clientWidth*r|0,n=e.clientHeight*r|0;if(e.width!==t||e.height!==n)return e.width=t,e.height=n,!0;return!1},r.setDefaults=function(e){a.copyExistingProperties(e,y),o.setAttributeDefaults_(e),i.setTextureDefaults_(e)},r.vertexArrays=r.typedarrays=r.programs=r.framebuffers=r.draw=r.utils=r.textures=r.attributes=void 0;var o=b(t(6));r.attributes=o,Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(n,e)||(r[e]=o[e]))});var i=b(t(7));r.textures=i,Object.keys(i).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(n,e)||(r[e]=i[e]))});var a=b(t(0)),u=b(t(3));r.utils=u,Object.keys(u).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(n,e)||(r[e]=u[e]))});var f=b(t(11));r.draw=f,Object.keys(f).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(n,e)||(r[e]=f[e]))});var c=b(t(12));r.framebuffers=c,Object.keys(c).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(n,e)||(r[e]=c[e]))});var l=b(t(4));r.programs=l,Object.keys(l).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(n,e)||(r[e]=l[e]))});var s=b(t(1));r.typedarrays=s,Object.keys(s).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(n,e)||(r[e]=s[e]))});var v=b(t(13));function b(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var n=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,t):{};n.get||n.set?Object.defineProperty(r,t,n):r[t]=e[t]}return r.default=e,r}r.vertexArrays=v,Object.keys(v).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(n,e)||(r[e]=v[e]))});var y={addExtensionsToContext:!0};var d=/^(.*?)_/;function m(e,r){u.glEnumToString(e,0);var t=e.getExtension(r);if(t){var n={},o=d.exec(r)[1],i="_"+o;for(var f in t){var c=t[f],l="function"==typeof c,s=l?o:i,v=f;f.endsWith(s)&&(v=f.substring(0,f.length-s.length)),void 0!==e[v]?l||e[v]===c||a.warn(v,e[v],c,f):l?e[v]=function(e){return function(){return e.apply(t,arguments)}}(c):(e[v]=c,n[v]=c)}n.constructor={name:t.constructor.name},u.glEnumToString(n,0)}return t}var p=["ANGLE_instanced_arrays","EXT_blend_minmax","EXT_color_buffer_float","EXT_color_buffer_half_float","EXT_disjoint_timer_query","EXT_disjoint_timer_query_webgl2","EXT_frag_depth","EXT_sRGB","EXT_shader_texture_lod","EXT_texture_filter_anisotropic","OES_element_index_uint","OES_standard_derivatives","OES_texture_float","OES_texture_float_linear","OES_texture_half_float","OES_texture_half_float_linear","OES_vertex_array_object","WEBGL_color_buffer_float","WEBGL_compressed_texture_atc","WEBGL_compressed_texture_etc1","WEBGL_compressed_texture_pvrtc","WEBGL_compressed_texture_s3tc","WEBGL_compressed_texture_s3tc_srgb","WEBGL_depth_texture","WEBGL_draw_buffers"];function x(e){for(var r=0;r<p.length;++r)m(e,p[r])}},function(e,r,t){"use strict";r.__esModule=!0,r.drawBufferInfo=o,r.drawObjectList=function(e,r){var t=null,i=null;r.forEach(function(r){if(!1!==r.active){var a=r.programInfo,u=r.vertexArrayInfo||r.bufferInfo,f=!1,c=void 0===r.type?e.TRIANGLES:r.type;a!==t&&(t=a,e.useProgram(a.program),f=!0),(f||u!==i)&&(i&&i.vertexArrayObject&&!u.vertexArrayObject&&e.bindVertexArray(null),i=u,n.setBuffersAndAttributes(e,a,u)),n.setUniforms(a,r.uniforms),o(e,u,c,r.count,r.offset,r.instanceCount)}}),i.vertexArrayObject&&e.bindVertexArray(null)};var n=function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var n=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,t):{};n.get||n.set?Object.defineProperty(r,t,n):r[t]=e[t]}return r.default=e,r}(t(4));function o(e,r,t,n,o,i){t=void 0===t?e.TRIANGLES:t;var a=r.indices,u=r.elementType,f=void 0===n?r.numElements:n;o=void 0===o?0:o,u||a?void 0!==i?e.drawElementsInstanced(t,f,void 0===u?e.UNSIGNED_SHORT:r.elementType,o,i):e.drawElements(t,f,void 0===u?e.UNSIGNED_SHORT:r.elementType,o):void 0!==i?e.drawArraysInstanced(t,o,f,i):e.drawArrays(t,o,f)}},function(e,r,t){"use strict";r.__esModule=!0,r.bindFramebufferInfo=function(e,r,t){t=t||e.FRAMEBUFFER,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,i){var l=e.FRAMEBUFFER,s=e.createFramebuffer();e.bindFramebuffer(l,s),t=t||e.drawingBufferWidth,i=i||e.drawingBufferHeight;var v=0,b={framebuffer:s,attachments:[],width:t,height:i};return(r=r||u).forEach(function(r){var u=r.attachment,s=r.format,y=function(e){return f[e]}(s);if(y||(y=a+v++),!u)if(function(e){return c[e]}(s))u=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,u),e.renderbufferStorage(e.RENDERBUFFER,s,t,i);else{var d=Object.assign({},r);d.width=t,d.height=i,void 0===d.auto&&(d.auto=!1,d.min=d.min||d.minMag||e.LINEAR,d.mag=d.mag||d.minMag||e.LINEAR,d.wrapS=d.wrapS||d.wrap||e.CLAMP_TO_EDGE,d.wrapT=d.wrapT||d.wrap||e.CLAMP_TO_EDGE),u=n.createTexture(e,d)}if(o.isRenderbuffer(e,u))e.framebufferRenderbuffer(l,y,e.RENDERBUFFER,u);else{if(!o.isTexture(e,u))throw new Error("unknown attachment type");void 0!==r.layer?e.framebufferTextureLayer(l,y,u,r.level||0,r.layer):e.framebufferTexture2D(l,y,r.texTarget||e.TEXTURE_2D,u,r.level||0)}b.attachments.push(u)}),b},r.resizeFramebufferInfo=function(e,r,t,i,a){i=i||e.drawingBufferWidth,a=a||e.drawingBufferHeight,r.width=i,r.height=a,(t=t||u).forEach(function(t,u){var f=r.attachments[u],c=t.format;if(o.isRenderbuffer(e,f))e.bindRenderbuffer(e.RENDERBUFFER,f),e.renderbufferStorage(e.RENDERBUFFER,c,i,a);else{if(!o.isTexture(e,f))throw new Error("unknown attachment type");n.resizeTexture(e,f,t,i,a)}})};var n=i(t(7)),o=i(t(0));function i(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var n=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,t):{};n.get||n.set?Object.defineProperty(r,t,n):r[t]=e[t]}return r.default=e,r}var a=36064,u=[{format:6408,type:5121,min:9729,wrap:33071},{format:34041}],f={};f[34041]=33306,f[6401]=36128,f[36168]=36128,f[6402]=36096,f[33189]=36096;var c={};c[32854]=!0,c[32855]=!0,c[36194]=!0,c[34041]=!0,c[33189]=!0,c[6401]=!0,c[36168]=!0},function(e,r,t){"use strict";r.__esModule=!0,r.createVertexArrayInfo=function(e,r,t){var o=e.createVertexArray();e.bindVertexArray(o),r.length||(r=[r]);return r.forEach(function(r){n.setBuffersAndAttributes(e,r,t)}),e.bindVertexArray(null),{numElements:t.numElements,elementType:t.elementType,vertexArrayObject:o}},r.createVAOAndSetAttributes=o,r.createVAOFromBufferInfo=function(e,r,t){return o(e,r.attribSetters||r,t.attribs,t.indices)};var n=function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var n=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,t):{};n.get||n.set?Object.defineProperty(r,t,n):r[t]=e[t]}return r.default=e,r}(t(4));function o(e,r,t,o){var i=e.createVertexArray();return e.bindVertexArray(i),n.setAttributes(r,t),o&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,o),e.bindVertexArray(null),i}}])});