-
Notifications
You must be signed in to change notification settings - Fork 0
/
twgl-full.min.js
7 lines (7 loc) · 56.3 KB
/
twgl-full.min.js
1
2
3
4
5
6
7
/*!
* @license twgl.js 2.8.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()}(this,function(){return function(e){function r(n){if(t[n])return t[n].exports;var o=t[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,r),o.loaded=!0,o.exports}var t={};return r.m=e,r.c=t,r.p="",r(0)}([function(e,r,t){var n,o;n=[t(1),t(10),t(11),t(12)],o=function(e,r,t,n){"use strict";return e.m4=r,e.v3=t,e.primitives=n,e}.apply(r,n),!(void 0!==o&&(e.exports=o))},function(e,r,t){var n,o;n=[t(2),t(5),t(7),t(6),t(8),t(3),t(9),t(4)],o=function(e,r,t,n,o,a,i,u){"use strict";function f(r){u.copyExistingProperties(r,d),e.setDefaults_(r),o.setDefaults_(r)}function s(e){if(e&&d.enableVertexArrayObjects&&u.isWebGL1(e)){var r=e.getExtension("OES_vertex_array_object");r&&(e.createVertexArray=function(){return r.createVertexArrayOES()},e.deleteVertexArray=function(e){r.deleteVertexArrayOES(e)},e.isVertexArray=function(e){return r.isVertexArrayOES(e)},e.bindVertexArray=function(e){r.bindVertexArrayOES(e)},e.VERTEX_ARRAY_BINDING=r.VERTEX_ARRAY_BINDING_OES)}}function c(e,r){for(var t=["webgl","experimental-webgl"],n=null,o=0;o<t.length;++o){try{n=e.getContext(t[o],r)}catch(e){}if(n)break}return n}function l(e,r){var t=c(e,r);return s(t),t}function m(e,r){for(var t=["webgl2","webgl","experimental-webgl"],n=null,o=0;o<t.length;++o){try{n=e.getContext(t[o],r)}catch(e){}if(n)break}return n}function y(e,r){var t=m(e,r);return s(t),t}function p(e,r){r=r||1,r=Math.max(1,r);var t=e.clientWidth*r|0,n=e.clientHeight*r|0;return(e.width!==t||e.height!==n)&&(e.width=t,e.height=n,!0)}function E(e){return"_"!==e[e.length-1]}function b(e,r){return Object.keys(e).filter(E).forEach(function(t){r[t]=e[t]}),r}var d={enableVertexArrayObjects:!0},v={getContext:y,getWebGLContext:l,isWebGL1:u.isWebGL1,isWebGL2:u.isWebGL2,resizeCanvasToDisplaySize:p,setDefaults:f},h={attributes:e,draw:r,framebuffers:t,programs:n,textures:o,typedArrays:a,vertexArrays:i};return Object.keys(h).forEach(function(e){var r=h[e];b(r,v),v[e]=b(r,{})}),v}.apply(r,n),!(void 0!==o&&(e.exports=o))},function(e,r,t){var n,o;n=[t(3),t(4)],o=function(e,r){"use strict";function t(e){d.attribPrefix=e}function n(e){r.copyExistingProperties(e,d)}function o(e,r,t,n,o){e.bindBuffer(r,t),e.bufferData(r,n,o||e.STATIC_DRAW)}function a(e,r,t,n){if(r instanceof WebGLBuffer)return r;t=t||e.ARRAY_BUFFER;var a=e.createBuffer();return o(e,t,a,r,n),a}function i(e){return"indices"===e}function u(e){return e instanceof Int8Array||e instanceof Uint8Array}function f(e){return e.length?e:e.data}function s(e,r){var t;if(t=v.test(e)?2:h.test(e)?4:3,r%t>0)throw"Can not guess numComponents for attribute '"+e+"'. Tried "+t+" but "+r+" values is not evenly divisible by "+t+". You should specify it.";return t}function c(e,r){return e.numComponents||e.size||s(r,f(e).length)}function l(r,t){if(e.isArrayBuffer(r))return r;if(e.isArrayBuffer(r.data))return r.data;Array.isArray(r)&&(r={data:r});var n=r.type;return n||(n=i(t)?Uint16Array:Float32Array),new n(r.data)}function m(r,t){var n={};return Object.keys(t).forEach(function(o){if(!i(o)){var f=t[o],s=f.attrib||f.name||f.attribName||d.attribPrefix+o,m=l(f,o);n[s]={buffer:a(r,m,void 0,f.drawType),numComponents:c(f,o),type:e.getGLTypeForTypedArray(m),normalize:void 0!==f.normalize?f.normalize:u(m),stride:f.stride||0,offset:f.offset||0,drawType:f.drawType}}}),n}function y(e,r,t,n){t=l(t),void 0!==n?(e.bindBuffer(e.ARRAY_BUFFER,r.buffer),e.bufferSubData(e.ARRAY_BUFFER,n,t)):o(e,e.ARRAY_BUFFER,r.buffer,t,r.drawType)}function p(r,t){var n={attribs:m(r,t)},o=t.indices;return o?(o=l(o,"indices"),n.indices=a(r,o,r.ELEMENT_ARRAY_BUFFER),n.numElements=o.length,n.elementType=e.getGLTypeForTypedArray(o)):n.numElements=A(t),n}function E(e,r,t){var n="indices"===t?e.ELEMENT_ARRAY_BUFFER:e.ARRAY_BUFFER,o=l(r,t);return a(e,o,n)}function b(r,t){var n={};return Object.keys(t).forEach(function(e){n[e]=E(r,t[e],e)}),t.indices?(n.numElements=t.indices.length,n.elementType=e.getGLTypeForTypedArray(l(t.indices),"indices")):n.numElements=A(t),n}var d={attribPrefix:""},v=/coord|texture/i,h=/color|colour/i,A=function(){var e=["position","positions","a_position"];return function(r){for(var t,n=0;n<e.length&&(t=e[n],!(t in r));++n);n===e.length&&(t=Object.keys(r)[0]);var o=r[t],a=f(o).length,i=c(o,t),u=a/i;if(a%i>0)throw"numComponents "+i+" not correct for length "+a;return u}}();return{createAttribsFromArrays:m,createBuffersFromArrays:b,createBufferFromArray:E,createBufferFromTypedArray:a,createBufferInfoFromArrays:p,setAttribInfoBufferFromArray:y,setAttributePrefix:t,setDefaults_:n,getNumComponents_:c,getArray_:f}}.apply(r,n),!(void 0!==o&&(e.exports=o))},function(e,r,t){var n,o;n=[],o=function(){"use strict";function e(e){if(e instanceof Int8Array)return n;if(e instanceof Uint8Array)return o;if(e instanceof Uint8ClampedArray)return o;if(e instanceof Int16Array)return a;if(e instanceof Uint16Array)return i;if(e instanceof Int32Array)return u;if(e instanceof Uint32Array)return f;if(e instanceof Float32Array)return s;throw"unsupported typed array type"}function r(e){var r=h[e];if(!r)throw"unknown gl type";return r}function t(e){return e&&e.buffer&&e.buffer instanceof ArrayBuffer}var n=5120,o=5121,a=5122,i=5123,u=5124,f=5125,s=5126,c=32819,l=32820,m=33635,y=5131,p=33640,E=35899,b=35902,d=36269,v=34042,h={},A=h;return A[n]=Int8Array,A[o]=Uint8Array,A[a]=Int16Array,A[i]=Uint16Array,A[u]=Int32Array,A[f]=Uint32Array,A[s]=Float32Array,A[c]=Uint16Array,A[l]=Uint16Array,A[m]=Uint16Array,A[y]=Uint16Array,A[p]=Uint32Array,A[E]=Uint32Array,A[b]=Uint32Array,A[d]=Uint32Array,A[v]=Uint32Array,{getGLTypeForTypedArray:e,getTypedArrayTypeForGLType:r,isArrayBuffer:t}}.apply(r,n),!(void 0!==o&&(e.exports=o))},function(e,r,t){var n,o;n=[],o=function(){"use strict";function e(e){var r={};return Object.keys(e).forEach(function(t){r[t]=e[t]}),r}function r(e,r,t){e.forEach(function(e){var n=r[e];void 0!==n&&(t[e]=n)})}function t(e,r){Object.keys(r).forEach(function(t){r.hasOwnProperty(t)&&e.hasOwnProperty(t)&&(r[t]=e[t])})}function n(e){return!!e.texStorage2D}function o(e){return!e.texStorage2D}var a=window.console&&window.console.error&&"function"==typeof window.console.error?window.console.error.bind(window.console):function(){},i=window.console&&window.console.warn&&"function"==typeof window.console.warn?window.console.warn.bind(window.console):function(){};return{copyExistingProperties:t,copyNamedProperties:r,shallowCopy:e,isWebGL1:o,isWebGL2:n,error:a,warn:i}}.apply(r,n),!(void 0!==o&&(e.exports=o))},function(e,r,t){var n,o;n=[t(6)],o=function(e){"use strict";function r(e,r,t,n,o){t=void 0===t?e.TRIANGLES:t;var a=r.indices,i=r.elementType,u=void 0===n?r.numElements:n;o=void 0===o?0:o,i||a?e.drawElements(t,u,void 0===i?e.UNSIGNED_SHORT:r.elementType,o):e.drawArrays(t,o,u)}function t(t,n){var o=null,a=null;n.forEach(function(n){if(n.active!==!1){var i=n.programInfo,u=n.vertexArrayInfo||n.bufferInfo,f=!1,s=void 0===n.type?t.TRIANGLES:n.type;i!==o&&(o=i,t.useProgram(i.program),f=!0),(f||u!==a)&&(a&&a.vertexArrayObject&&!u.vertexArrayObject&&t.bindVertexArray(null),a=u,e.setBuffersAndAttributes(t,i,u)),e.setUniforms(i,n.uniforms),r(t,u,s,n.count,n.offset)}}),a.vertexArrayObject&&t.bindVertexArray(null)}return{drawBufferInfo:r,drawObjectList:t}}.apply(r,n),!(void 0!==o&&(e.exports=o))},function(e,r,t){var n,o;n=[t(4)],o=function(e){"use strict";function r(e,r){return ke[r].bindPoint}function t(e,r){return function(t){e.uniform1f(r,t)}}function n(e,r){return function(t){e.uniform1fv(r,t)}}function o(e,r){return function(t){e.uniform2fv(r,t)}}function a(e,r){return function(t){e.uniform3fv(r,t)}}function i(e,r){return function(t){e.uniform4fv(r,t)}}function u(e,r){return function(t){e.uniform1i(r,t)}}function f(e,r){return function(t){e.uniform1iv(r,t)}}function s(e,r){return function(t){e.uniform2iv(r,t)}}function c(e,r){return function(t){e.uniform3iv(r,t)}}function l(e,r){return function(t){e.uniform4iv(r,t)}}function m(e,r){return function(t){e.uniform1ui(r,t)}}function y(e,r){return function(t){e.uniform1uiv(r,t)}}function p(e,r){return function(t){e.uniform2uiv(r,t)}}function E(e,r){return function(t){e.uniform3uiv(r,t)}}function b(e,r){return function(t){e.uniform4uiv(r,t)}}function d(e,r){return function(t){e.uniformMatrix2fv(r,!1,t)}}function v(e,r){return function(t){e.uniformMatrix3fv(r,!1,t)}}function h(e,r){return function(t){e.uniformMatrix4fv(r,!1,t)}}function A(e,r){return function(t){e.uniformMatrix2x3fv(r,!1,t)}}function x(e,r){return function(t){e.uniformMatrix3x2fv(r,!1,t)}}function T(e,r){return function(t){e.uniformMatrix2x4fv(r,!1,t)}}function R(e,r){return function(t){e.uniformMatrix4x2fv(r,!1,t)}}function F(e,r){return function(t){e.uniformMatrix3x4fv(r,!1,t)}}function g(e,r){return function(t){e.uniformMatrix4x3fv(r,!1,t)}}function _(e,t,n,o){var a=r(e,t);return function(r){var t=void 0;r instanceof WebGLTexture?t=r:(t=r.texture,e.bindSampler(n,r.sampler)),e.uniform1i(o,n),e.activeTexture(e.TEXTURE0+n),e.bindTexture(a,t)}}function P(e,t,n,o,a){for(var i=r(e,t),u=new Int32Array(a),f=0;f<a;++f)u[f]=n+f;return function(r){e.uniform1iv(o,u),r.forEach(function(r,t){e.activeTexture(e.TEXTURE0+u[t]);var o=void 0;r instanceof WebGLTexture?o=r:(o=r.texture,e.bindSampler(n,r.sampler)),e.bindTexture(i,o)})}}function w(e,r){return function(t){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)}}function U(e,r){return function(t){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)}}function B(e,r,t){var n=t.size,o=t.count;return function(t){e.bindBuffer(e.ARRAY_BUFFER,t.buffer);for(var a=t.size||t.numComponents||n,i=a/o,u=t.type||e.FLOAT,f=ke[u],s=f.size*a,c=t.normalize||!1,l=t.offset||0,m=s/o,y=0;y<o;++y)e.enableVertexAttribArray(r+y),e.vertexAttribPointer(r+y,i,u,c,s,l+m*y)}}function I(e,r){return r=r||0,++r,e.split("\n").map(function(e,t){return t+r+": "+e}).join("\n")}function C(e,r,t,n){var o=n||Q,a=e.createShader(t),i=0;We.test(r)&&(i=1,r=r.replace(We,"")),e.shaderSource(a,r),e.compileShader(a);var u=e.getShaderParameter(a,e.COMPILE_STATUS);if(!u){var f=e.getShaderInfoLog(a);return o(I(r,i)+"\n*** Error compiling shader: "+f),e.deleteShader(a),null}return a}function S(e,r,t){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 n=e;t=n.errorCallback,e=n.attribLocations}var o={errorCallback:t||Q};if(e){var a={};Array.isArray(e)?e.forEach(function(e,t){a[e]=r?r[t]:t}):a=e,o.attribLocations=a}return o}function M(e,r,t,n,o){var a=S(t,n,o),i=e.createProgram();r.forEach(function(r){e.attachShader(i,r)}),a.attribLocations&&Object.keys(a.attribLocations).forEach(function(r){e.bindAttribLocation(i,a.attribLocations[r],r)}),e.linkProgram(i);var u=e.getProgramParameter(i,e.LINK_STATUS);if(!u){var f=e.getProgramInfoLog(i);return a.errorCallback("Error in program linking:"+f),e.deleteProgram(i),null}return i}function L(e,r,t,n){var o,a="",i=document.getElementById(r);if(!i)throw"*** Error: unknown script element"+r;if(a=i.text,!t)if("x-shader/x-vertex"===i.type)o=e.VERTEX_SHADER;else if("x-shader/x-fragment"===i.type)o=e.FRAGMENT_SHADER;else if(o!==e.VERTEX_SHADER&&o!==e.FRAGMENT_SHADER)throw"*** Error: unknown shader type";return C(e,a,t?t:o,n)}function D(e,r,t,n,o){for(var a=S(t,n,o),i=[],u=0;u<r.length;++u){var f=L(e,r[u],e[je[u]],a.errorCallback);if(!f)return null;i.push(f)}return M(e,i,a)}function O(e,r,t,n,o){for(var a=S(t,n,o),i=[],u=0;u<r.length;++u){var f=C(e,r[u],e[je[u]],a.errorCallback);if(!f)return null;i.push(f)}return M(e,i,a)}function N(e,r){function t(r,t){var o=e.getUniformLocation(r,t.name),a=t.size>1&&"[0]"===t.name.substr(-3),i=t.type,u=ke[i];if(!u)throw"unknown type: 0x"+i.toString(16);if(u.bindPoint){var f=n;return n+=t.size,a?u.arraySetter(e,i,f,o,t.size):u.setter(e,i,f,o,t.size)}return u.arraySetter&&a?u.arraySetter(e,o):u.setter(e,o)}for(var n=0,o={},a=e.getProgramParameter(r,e.ACTIVE_UNIFORMS),i=0;i<a;++i){var u=e.getActiveUniform(r,i);if(!u)break;var f=u.name;"[0]"===f.substr(-3)&&(f=f.substr(0,f.length-3));var s=t(r,u);o[f]=s}return o}function z(e,r){for(var t=e.getProgramParameter(r,e.ACTIVE_UNIFORMS),n=[],o=[],a=0;a<t;++a){o.push(a),n.push({});var i=e.getActiveUniform(r,a);if(!i)break;n[a].name=i.name}[["UNIFORM_TYPE","type"],["UNIFORM_SIZE","size"],["UNIFORM_BLOCK_INDEX","blockNdx"],["UNIFORM_OFFSET","offset"]].forEach(function(t){var a=t[0],i=t[1];e.getActiveUniforms(r,o,e[a]).forEach(function(e,r){n[r][i]=e})});var u={},f=e.getProgramParameter(r,e.ACTIVE_UNIFORM_BLOCKS);for(a=0;a<f;++a){var s=e.getActiveUniformBlockName(r,a),c={index:a,usedByVertexShader:e.getActiveUniformBlockParameter(r,a,e.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER),usedByFragmentShader:e.getActiveUniformBlockParameter(r,a,e.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER),size:e.getActiveUniformBlockParameter(r,a,e.UNIFORM_BLOCK_DATA_SIZE),uniformIndices:e.getActiveUniformBlockParameter(r,a,e.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES)};c.used=c.usedByVertexSahder||c.usedByFragmentShader,u[s]=c}return{blockSpecs:u,uniformData:n}}function X(e,r,t,n){var o=t.blockSpecs,a=t.uniformData,i=o[n];if(!i)return $("no uniform block object named:",n),{name:n,uniforms:{}};var u=new ArrayBuffer(i.size),f=e.createBuffer(),s=i.index;e.bindBuffer(e.UNIFORM_BUFFER,f),e.uniformBlockBinding(r,i.index,s);var c=n+".";He.test(c)&&(c=c.replace(He,"."));var l={};return i.uniformIndices.forEach(function(e){var r=a[e],t=ke[r.type],n=t.Type,o=r.size*t.size,i=r.name;i.substr(0,c.length)===c&&(i=i.substr(c.length)),l[i]=new n(u,r.offset,o/n.BYTES_PER_ELEMENT)}),{name:n,array:u,asFloat:new Float32Array(u),buffer:f,uniforms:l}}function G(e,r,t){return X(e,r.program,r.uniformBlockSpec,t)}function V(e,r,t){var n=r.uniformBlockSpec||r,o=n.blockSpecs[t.name];if(o){var a=o.index;return e.bindBufferRange(e.UNIFORM_BUFFER,a,t.buffer,t.offset||0,t.array.byteLength),!0}return!1}function k(e,r,t){V(e,r,t)&&e.bufferData(e.UNIFORM_BUFFER,t.array,e.DYNAMIC_DRAW)}function Y(e,r){var t=e.uniforms;for(var n in r){var o=t[n];if(o){var a=r[n];a.length?o.set(a):o[0]=a}}}function W(e,r){for(var t=e.uniformSetters||e,n=arguments.length,o=1;o<n;++o){var a=arguments[o];if(Array.isArray(a))for(var i=a.length,u=0;u<i;++u)W(t,a[u]);else for(var f in a){var s=t[f];s&&s(a[f])}}}function j(e,r){for(var t={},n=e.getProgramParameter(r,e.ACTIVE_ATTRIBUTES),o=0;o<n;++o){var a=e.getActiveAttrib(r,o);if(!a)break;var i=e.getAttribLocation(r,a.name),u=Ye[a.type];t[a.name]=u.setter(e,i,u)}return t}function H(e,r){for(var t in r){var n=e[t];n&&n(r[t])}}function K(e,r,t){t.vertexArrayObject?e.bindVertexArray(t.vertexArrayObject):(H(r.attribSetters||r,t.attribs),t.indices&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.indices))}function q(r,t){var n=N(r,t),o=j(r,t),a={program:t,uniformSetters:n,attribSetters:o};return e.isWebGL2(r)&&(a.uniformBlockSpec=z(r,t)),a}function Z(e,r,t,n,o){var a=S(t,n,o),i=!0;if(r=r.map(function(e){if(e.indexOf("\n")<0){var r=document.getElementById(e);r?e=r.text:(a.errorCallback("no element with id: "+e),i=!1)}return e}),!i)return null;var u=O(e,r,a);return u?q(e,u):null}var Q=e.error,$=e.warn,J=5126,ee=35664,re=35665,te=35666,ne=5124,oe=35667,ae=35668,ie=35669,ue=35670,fe=35671,se=35672,ce=35673,le=35674,me=35675,ye=35676,pe=35678,Ee=35680,be=35679,de=35682,ve=35685,he=35686,Ae=35687,xe=35688,Te=35689,Re=35690,Fe=36289,ge=36292,_e=36293,Pe=5125,we=36294,Ue=36295,Be=36296,Ie=36298,Ce=36299,Se=36300,Me=36303,Le=36306,De=36307,Oe=36308,Ne=36311,ze=3553,Xe=34067,Ge=32879,Ve=35866,ke={};ke[J]={Type:Float32Array,size:4,setter:t,arraySetter:n},ke[ee]={Type:Float32Array,size:8,setter:o},ke[re]={Type:Float32Array,size:12,setter:a},ke[te]={Type:Float32Array,size:16,setter:i},ke[ne]={Type:Int32Array,size:4,setter:u,arraySetter:f},ke[oe]={Type:Int32Array,size:8,setter:s},ke[ae]={Type:Int32Array,size:12,setter:c},ke[ie]={Type:Int32Array,size:16,setter:l},ke[Pe]={Type:Uint32Array,size:4,setter:m,arraySetter:y},ke[we]={Type:Uint32Array,size:8,setter:p},ke[Ue]={Type:Uint32Array,size:12,setter:E},ke[Be]={Type:Uint32Array,size:16,setter:b},ke[ue]={Type:Uint32Array,size:4,setter:u,arraySetter:f},ke[fe]={Type:Uint32Array,size:8,setter:s},ke[se]={Type:Uint32Array,size:12,setter:c},ke[ce]={Type:Uint32Array,size:16,setter:l},ke[le]={Type:Float32Array,size:16,setter:d},ke[me]={Type:Float32Array,size:36,setter:v},ke[ye]={Type:Float32Array,size:64,setter:h},ke[ve]={Type:Float32Array,size:24,setter:A},ke[he]={Type:Float32Array,size:32,setter:T},ke[Ae]={Type:Float32Array,size:24,setter:x},ke[xe]={Type:Float32Array,size:48,setter:F},ke[Te]={Type:Float32Array,size:32,setter:R},ke[Re]={Type:Float32Array,size:48,setter:g},ke[pe]={Type:null,size:0,setter:_,arraySetter:P,bindPoint:ze},ke[Ee]={Type:null,size:0,setter:_,arraySetter:P,bindPoint:Xe},ke[be]={Type:null,size:0,setter:_,arraySetter:P,bindPoint:Ge},ke[de]={Type:null,size:0,setter:_,arraySetter:P,bindPoint:ze},ke[Fe]={Type:null,size:0,setter:_,arraySetter:P,bindPoint:Ve},ke[ge]={Type:null,size:0,setter:_,arraySetter:P,bindPoint:Ve},ke[_e]={Type:null,size:0,setter:_,arraySetter:P,bindPoint:Xe},ke[Ie]={Type:null,size:0,setter:_,arraySetter:P,bindPoint:ze},ke[Ce]={Type:null,size:0,setter:_,arraySetter:P,bindPoint:Ge},ke[Se]={Type:null,size:0,setter:_,arraySetter:P,bindPoint:Xe},ke[Me]={Type:null,size:0,setter:_,arraySetter:P,bindPoint:Ve},ke[Le]={Type:null,size:0,setter:_,arraySetter:P,bindPoint:ze},ke[De]={Type:null,size:0,setter:_,arraySetter:P,bindPoint:Ge},ke[Oe]={Type:null,size:0,setter:_,arraySetter:P,bindPoint:Xe},ke[Ne]={Type:null,size:0,setter:_,arraySetter:P,bindPoint:Ve};var Ye={};Ye[J]={size:4,setter:w},Ye[ee]={size:8,setter:w},Ye[re]={size:12,setter:w},Ye[te]={size:16,setter:w},Ye[ne]={size:4,setter:U},Ye[oe]={size:8,setter:U},Ye[ae]={size:12,setter:U},Ye[ie]={size:16,setter:U},Ye[Pe]={size:4,setter:U},Ye[we]={size:8,setter:U},Ye[Ue]={size:12,setter:U},Ye[Be]={size:16,setter:U},Ye[ue]={size:4,setter:U},Ye[fe]={size:8,setter:U},Ye[se]={size:12,setter:U},Ye[ce]={size:16,setter:U},Ye[le]={size:4,setter:B,count:2},Ye[me]={size:9,setter:B,count:3},Ye[ye]={size:16,setter:B,count:4};var We=/^[ \t]*\n/,je=["VERTEX_SHADER","FRAGMENT_SHADER"],He=/\[\d+\]\.$/;return{createAttributeSetters:j,createProgram:M,createProgramFromScripts:D,createProgramFromSources:O,createProgramInfo:Z,createProgramInfoFromProgram:q,createUniformSetters:N,createUniformBlockSpecFromProgram:z,createUniformBlockInfoFromProgram:X,createUniformBlockInfo:G,setAttributes:H,setBuffersAndAttributes:K,setUniforms:W,setUniformBlock:k,setBlockUniforms:Y,bindUniformBlock:V}}.apply(r,n),!(void 0!==o&&(e.exports=o))},function(e,r,t){var n,o;n=[t(8),t(4)],o=function(e,r){"use strict";function t(e){return F[e]}function n(e){return g[e]}function o(o,a,i,u){var f=o.FRAMEBUFFER,s=o.createFramebuffer();o.bindFramebuffer(f,s),i=i||o.drawingBufferWidth,u=u||o.drawingBufferHeight,a=a||R;var c=0,l={framebuffer:s,attachments:[],width:i,height:u};return a.forEach(function(a){var s=a.attachment,m=a.format,y=t(m);if(y||(y=d+c++),!s)if(n(m))s=o.createRenderbuffer(),o.bindRenderbuffer(o.RENDERBUFFER,s),o.renderbufferStorage(o.RENDERBUFFER,m,i,u);else{var p=r.shallowCopy(a);p.width=i,p.height=u,void 0===p.auto&&(p.auto=!1,p.min=p.min||o.LINEAR,p.mag=p.mag||o.LINEAR,p.wrapS=p.wrapS||p.wrap||o.CLAMP_TO_EDGE,p.wrapT=p.wrapT||p.wrap||o.CLAMP_TO_EDGE),s=e.createTexture(o,p)}if(s instanceof WebGLRenderbuffer)o.framebufferRenderbuffer(f,y,o.RENDERBUFFER,s);else{if(!(s instanceof WebGLTexture))throw"unknown attachment type";o.framebufferTexture2D(f,y,a.texTarget||o.TEXTURE_2D,s,a.level||0)}l.attachments.push(s)}),l}function a(r,t,n,o,a){o=o||r.drawingBufferWidth,a=a||r.drawingBufferHeight,t.width=o,t.height=a,n=n||R,n.forEach(function(n,i){var u=t.attachments[i],f=n.format;if(u instanceof WebGLRenderbuffer)r.bindRenderbuffer(r.RENDERBUFFER,u),r.renderbufferStorage(r.RENDERBUFFER,f,o,a);else{if(!(u instanceof WebGLTexture))throw"unknown attachment type";e.resizeTexture(r,u,n,o,a)}})}function i(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))}var u=5121,f=6402,s=6408,c=32854,l=32855,m=36194,y=33189,p=6401,E=36168,b=34041,d=36064,v=36096,h=36128,A=33306,x=33071,T=9729,R=[{format:s,type:u,min:T,wrap:x},{format:b}],F={};F[b]=A,F[p]=h,F[E]=h,F[f]=v,F[y]=v;var g={};return g[c]=!0,g[l]=!0,g[m]=!0,g[b]=!0,g[y]=!0,g[p]=!0,g[E]=!0,{bindFramebufferInfo:i,createFramebufferInfo:o,resizeFramebufferInfo:a}}.apply(r,n),!(void 0!==o&&(e.exports=o))},function(e,r,t){var n,o;n=[t(3),t(4)],o=function(e,r){"use strict";function t(e,r){var t=br[e];if(!t)throw"unknown internal format";var n=t.bytesPerElementMap[r];if(void 0===n)throw"unknown internal format";return n}function n(e){var r=br[e];if(!r)throw"unknown internal format";return{format:r.e,type:Array.isArray(r.type)?r.type[0]:r.type}}function o(e){return 0===(e&e-1)}function a(e,t,n,a){if(!r.isWebGL2(e))return o(t)&&o(n);var i=br[a];if(!i)throw"unknown internal format";return i.r&&i.t}function i(e){var r=br[e];if(!r)throw"unknown internal format";return r.t}function u(e){var r=pr[e];if(!r)throw"unknown format: "+e;return r.n}function f(r,t,n){return O(t)?e.getGLTypeForTypedArray(t):n||r.UNSIGNED_BYTE}function s(e,r,t,n,o){if(o%1!==0)throw"can't guess dimensions";if(t||n){if(n){if(!t&&(t=o/n,t%1))throw"can't guess dimensions"}else if(n=o/t,n%1)throw"can't guess dimensions"}else{var a=Math.sqrt(o/(r===e.TEXTURE_CUBE_MAP?6:1));a%1===0?(t=a,n=a):(t=o,n=1)}return{width:t,height:n}}function c(e){D.textureColor=new Uint8Array([255*e[0],255*e[1],255*e[2],255*e[3]])}function l(e){r.copyExistingProperties(e,D),e.textureColor&&c(e.textureColor)}function m(e,r){void 0!==r.colorspaceConversion&&(vr.colorspaceConversion=e.getParameter(e.UNPACK_COLORSPACE_CONVERSION_WEBGL),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,r.colorspaceConversion)),void 0!==r.premultiplyAlpha&&(vr.premultiplyAlpha=e.getParameter(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha)),void 0!==r.flipY&&(vr.flipY=e.getParameter(e.UNPACK_FLIP_Y_WEBGL),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,r.flipY))}function y(e,r){void 0!==r.colorspaceConversion&&e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,vr.colorspaceConversion),void 0!==r.premultiplyAlpha&&e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,vr.premultiplyAlpha),void 0!==r.flipY&&e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,vr.flipY)}function p(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||r instanceof WebGLSampler)&&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 E(e,r,t){var n=t.target||e.TEXTURE_2D;e.bindTexture(n,r),p(e,n,e.texParameteri,t)}function b(e,r,t){p(e,r,e.samplerParameteri,t)}function d(e,r){var t=e.createSampler();return b(e,t,r),t}function v(e,r){var t={};return Object.keys(r).forEach(function(n){t[n]=d(e,r[n])}),t}function h(e){return e=e||D.textureColor,O(e)?e:new Uint8Array([255*e[0],255*e[1],255*e[2],255*e[3]])}function A(e,r,t,n,o,u,f){t=t||D.textureOptions,u=u||e.RGBA,f=f||e.UNSIGNED_BYTE;var s=t.target||e.TEXTURE_2D;if(n=n||t.width,o=o||t.height,e.bindTexture(s,r),a(e,n,o,u,f))e.generateMipmap(s);else{var c=i(u,f)?e.LINEAR:e.NEAREST;e.texParameteri(s,e.TEXTURE_MIN_FILTER,c),e.texParameteri(s,e.TEXTURE_MAG_FILTER,c),e.texParameteri(s,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(s,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)}}function x(e,r){return r=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 T(e,r){var t=x(e,r),n=t.map(function(e,r){return{face:e,ndx:r}});return n.sort(function(e,r){return e.face-r.face}),n}function R(e,r,t,o){o=o||D.textureOptions;var a=o.target||e.TEXTURE_2D,i=t.width,u=t.height,f=o.internalFormat||o.format||e.RGBA,s=n(f),c=o.format||s.format,l=o.type||s.type;if(m(e,o),e.bindTexture(a,r),a===e.TEXTURE_CUBE_MAP){var p,b,d=t.width,v=t.height;if(d/6===v)p=v,b=[0,0,1,0,2,0,3,0,4,0,5,0];else if(v/6===d)p=d,b=[0,0,0,1,0,2,0,3,0,4,0,5];else if(d/3===v/2)p=d/3,b=[0,0,1,0,2,0,0,1,1,1,2,1];else{if(d/2!==v/3)throw"can't figure out cube map from element: "+(t.src?t.src:t.nodeName);p=d/2,b=[0,0,1,0,0,1,1,1,0,2,1,2]}N.canvas.width=p,N.canvas.height=p,i=p,u=p,T(e,o).forEach(function(r){var n=b[2*r.ndx+0]*p,o=b[2*r.ndx+1]*p;N.drawImage(t,n,o,p,p,0,0,p,p),e.texImage2D(r.face,0,f,c,l,N.canvas)}),N.canvas.width=1,N.canvas.height=1}else if(a===e.TEXTURE_3D){var h=Math.min(t.width,t.height),x=Math.max(t.width,t.height),R=x/h;if(R%1!==0)throw"can not compute 3D dimensions of element";var F=t.width===x?1:0,g=t.height===x?1:0;e.texImage3D(a,0,f,h,h,h,0,c,l,null),N.canvas.width=h,N.canvas.height=h;for(var _=0;_<R;++_){var P=_*h*F,w=_*h*g,U=h,B=h,I=0,C=0,S=h,M=h;N.drawImage(t,P,w,U,B,I,C,S,M),e.texSubImage3D(a,0,0,0,_,h,h,1,c,l,N.canvas)}N.canvas.width=0,N.canvas.height=0}else e.texImage2D(a,0,f,c,l,t);y(e,o),o.auto!==!1&&A(e,r,o,i,u,f,l),E(e,r,o)}function F(){}function g(e,t,n){function o(){u.removeEventListener("error",a),u.removeEventListener("load",i),u=null}function a(){var t="couldn't load image: "+e;r.error(t),n(t,u),o()}function i(){n(null,u),o()}n=n||F;var u=new Image;return t=void 0!==t?t:D.crossOrigin,void 0!==t&&(u.crossOrigin=t),u.addEventListener("error",a),u.addEventListener("load",i),u.src=e,u}function _(e,r,t){t=t||D.textureOptions;var n=t.target||e.TEXTURE_2D;if(e.bindTexture(n,r),t.color!==!1){var o=h(t.color);if(n===e.TEXTURE_CUBE_MAP)for(var a=0;a<6;++a)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+a,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 P(e,t,n,o){o=o||F,n=n||D.textureOptions,_(e,t,n),n=r.shallowCopy(n);var a=g(n.src,n.crossOrigin,function(r,a){r?o(r,t,a):(R(e,t,a,n),o(null,t,a))});return a}function w(e,t,o,a){function i(r){return function(n,i){--b,n?d.push(n):i.width!==i.height?d.push("cubemap face img is not a square: "+i.src):(m(e,o),e.bindTexture(p,t),5===b?x(e).forEach(function(r){e.texImage2D(r,0,f,c,l,i)}):e.texImage2D(r,0,f,c,l,i),y(e,o),e.generateMipmap(p)),0===b&&a(d.length?d:void 0,E,t)}}a=a||F;var u=o.src;if(6!==u.length)throw"there must be 6 urls for a cubemap";var f=o.internalFormat||o.format||e.RGBA,s=n(f),c=o.format||s.format,l=o.type||e.UNSIGNED_BYTE,p=o.target||e.TEXTURE_2D;if(p!==e.TEXTURE_CUBE_MAP)throw"target must be TEXTURE_CUBE_MAP";_(e,t,o),o=r.shallowCopy(o);var E,b=6,d=[],v=x(e,o);E=u.map(function(e,r){return g(e,o.crossOrigin,i(v[r]))})}function U(e,t,o,a){function i(r){return function(n,i){if(--b,n)d.push(n);else{if(m(e,o),e.bindTexture(p,t),x){x=!1,v=o.width||i.width,h=o.height||i.height,e.texImage3D(p,0,f,v,h,A,0,c,l,null);for(var u=0;u<A;++u)e.texSubImage3D(p,0,0,0,u,v,h,1,c,l,i)}else{var s=i;i.width===v&&i.height===h||(s=N.canvas,N.canvas.width=v,N.canvas.height=h,N.drawImage(i,0,0,v,h)),e.texSubImage3D(p,0,0,0,r,v,h,1,c,l,s),s===N.canvas&&(N.canvas.width=0,N.canvas.height=0)}y(e,o),e.generateMipmap(p)}0===b&&a(d.length?d:void 0,E,t)}}a=a||F;var u=o.src,f=o.internalFormat||o.format||e.RGBA,s=n(f),c=o.format||s.format,l=o.type||e.UNSIGNED_BYTE,p=o.target||e.TEXTURE_2D_ARRAY;if(p!==e.TEXTURE_3D&&p!==e.TEXTURE_2D_ARRAY)throw"target must be TEXTURE_3D or TEXTURE_2D_ARRAY";_(e,t,o),o=r.shallowCopy(o);var E,b=u.length,d=[],v=o.width,h=o.height,A=u.length,x=!0;E=u.map(function(e,r){return g(e,o.crossOrigin,i(r))})}function B(r,o,a,i){i=i||D.textureOptions;var u=i.target||r.TEXTURE_2D;r.bindTexture(u,o);var c=i.width,l=i.height,p=i.depth,E=i.internalFormat||i.format||r.RGBA,b=n(E),d=i.format||b.format,v=i.type||f(r,a,b.type);if(O(a))a instanceof Uint8ClampedArray&&(a=new Uint8Array(a.buffer));else{var h=e.getTypedArrayTypeForGLType(v);a=new h(a)}var A=t(E,v),x=a.byteLength/A;if(x%1)throw"length wrong size for format: "+dr(r,d);var R;if(u===r.TEXTURE_3D)if(c||l||p)!c||l&&p?!l||c&&p?(R=s(r,u,c,l,x/p),c=R.width,l=R.height):(R=s(r,u,c,p,x/l),c=R.width,p=R.height):(R=s(r,u,l,p,x/c),l=R.width,p=R.height);else{var F=Math.cbrt(x);if(F%1!==0)throw"can't guess cube size of array of numElements: "+x;c=F,l=F,p=F}else R=s(r,u,c,l,x),c=R.width,l=R.height;return r.pixelStorei(r.UNPACK_ALIGNMENT,i.unpackAlignment||1),m(r,i),u===r.TEXTURE_CUBE_MAP?!function(){var e=A/a.BYTES_PER_ELEMENT,t=x/6*e;T(r,i).forEach(function(e){var n=t*e.ndx,o=a.subarray(n,n+t);r.texImage2D(e.face,0,E,c,l,0,d,v,o)})}():u===r.TEXTURE_3D?r.texImage3D(u,0,E,c,l,p,0,d,v,a):r.texImage2D(u,0,E,c,l,0,d,v,a),y(r,i),{width:c,height:l,depth:p,type:v}}function I(e,r,t){var o=t.target||e.TEXTURE_2D;e.bindTexture(o,r);var a=t.internalFormat||t.format||e.RGBA,i=n(a),u=t.format||i.format,f=t.type||i.type;if(m(e,t),o===e.TEXTURE_CUBE_MAP)for(var s=0;s<6;++s)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,a,t.width,t.height,0,u,f,null);else o===e.TEXTURE_3D?e.texImage3D(o,0,a,t.width,t.height,t.depth,0,u,f,null):e.texImage2D(o,0,a,t.width,t.height,0,u,f,null);y(e,t)}function C(e,r,t){t=t||F,r=r||D.textureOptions;var o=e.createTexture(),a=r.target||e.TEXTURE_2D,i=r.width||1,u=r.height||1,f=r.internalFormat||e.RGBA,s=n(f),c=r.type||s.type;e.bindTexture(a,o),a===e.TEXTURE_CUBE_MAP&&(e.texParameteri(a,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(a,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE));var l=r.src;if(l)if("function"==typeof l&&(l=l(e,r)),"string"==typeof l)P(e,o,r,t);else if(O(l)||Array.isArray(l)&&("number"==typeof l[0]||Array.isArray(l[0])||O(l[0]))){var m=B(e,o,l,r);i=m.width,u=m.height,c=m.type}else if(Array.isArray(l)&&"string"==typeof l[0])a===e.TEXTURE_CUBE_MAP?w(e,o,r,t):U(e,o,r,t);else{if(!(l instanceof HTMLElement))throw"unsupported src type";R(e,o,l,r),i=l.width,u=l.height}else I(e,o,r);return r.auto!==!1&&A(e,o,r,i,u,f,c),E(e,o,r),o}function S(e,r,t,o,a){o=o||t.width,a=a||t.height;var i=t.target||e.TEXTURE_2D;e.bindTexture(i,r);var u,s=t.internalFormat||t.format||e.RGBA,c=n(s),l=t.format||c.format,m=t.src;if(u=m&&(O(m)||Array.isArray(m)&&"number"==typeof m[0])?t.type||f(e,m,c.type):t.type||c.type,i===e.TEXTURE_CUBE_MAP)for(var y=0;y<6;++y)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+y,0,l,o,a,0,l,u,null);else e.texImage2D(i,0,l,o,a,0,l,u,null)}function M(e){return"string"==typeof e||Array.isArray(e)&&"string"==typeof e[0]}function L(e,r,t){function n(){0===o&&setTimeout(function(){t(a.length?a:void 0,i,u)},0)}t=t||F;var o=0,a=[],i={},u={};return Object.keys(r).forEach(function(t){var f,s=r[t];M(s.src)&&(f=function(e,r,i){u[t]=i,--o,e&&a.push(e),n()},++o),i[t]=C(e,s,f)}),n(),i}var D={textureColor:new Uint8Array([128,192,255,255]),textureOptions:{},crossOrigin:void 0},O=e.isArrayBuffer,N=document.createElement("canvas").getContext("2d"),z=6406,X=6407,G=6408,V=6409,k=6410,Y=6402,W=34041,j=33321,H=36756,K=33325,q=33326,Z=33330,Q=33329,$=33338,J=33337,ee=33340,re=33339,te=33323,ne=36757,oe=33327,ae=33328,ie=33336,ue=33335,fe=33332,se=33331,ce=33334,le=33333,me=32849,ye=35905,pe=36194,Ee=36758,be=35898,de=35901,ve=34843,he=34837,Ae=36221,xe=36239,Te=36215,Re=36233,Fe=36209,ge=36227,_e=32856,Pe=35907,we=36759,Ue=32855,Be=32854,Ie=32857,Ce=34842,Se=34836,Me=36220,Le=36238,De=36975,Oe=36214,Ne=36232,ze=36226,Xe=36208,Ge=33189,Ve=33190,ke=36012,Ye=36013,We=35056,je=5120,He=5121,Ke=5122,qe=5123,Ze=5124,Qe=5125,$e=5126,Je=32819,er=32820,rr=33635,tr=5131,nr=33640,or=35899,ar=35902,ir=36269,ur=34042,fr=33319,sr=33320,cr=6403,lr=36244,mr=36248,yr=36249,pr={},Er=pr;
Er[z]={n:1},Er[V]={n:1},Er[k]={n:2},Er[X]={n:3},Er[G]={n:4},Er[cr]={n:1},Er[lr]={n:1},Er[fr]={n:2},Er[sr]={n:2},Er[X]={n:3},Er[mr]={n:3},Er[G]={n:4},Er[yr]={n:4},Er[Y]={n:1},Er[W]={n:2};var br={};!function(){var e=br;e[z]={e:z,r:!0,t:!0,o:[1,2,4],type:[He,tr,$e]},e[V]={e:V,r:!0,t:!0,o:[1,2,4],type:[He,tr,$e]},e[k]={e:k,r:!0,t:!0,o:[2,4,8],type:[He,tr,$e]},e[X]={e:X,r:!0,t:!0,o:[3,6,12,2],type:[He,tr,$e,rr]},e[G]={e:G,r:!0,t:!0,o:[4,8,16,2,2],type:[He,tr,$e,Je,er]},e[j]={e:cr,r:!0,t:!0,o:1,type:He},e[H]={e:cr,r:!1,t:!0,o:1,type:je},e[K]={e:cr,r:!1,t:!0,o:[4,2],type:[$e,tr]},e[q]={e:cr,r:!1,t:!1,o:4,type:$e},e[Z]={e:lr,r:!0,t:!1,o:1,type:He},e[Q]={e:lr,r:!0,t:!1,o:1,type:je},e[fe]={e:lr,r:!0,t:!1,o:2,type:qe},e[se]={e:lr,r:!0,t:!1,o:2,type:Ke},e[ce]={e:lr,r:!0,t:!1,o:4,type:Qe},e[le]={e:lr,r:!0,t:!1,o:4,type:Ze},e[te]={e:fr,r:!0,t:!0,o:2,type:He},e[ne]={e:fr,r:!1,t:!0,o:2,type:je},e[oe]={e:fr,r:!1,t:!0,o:[8,4],type:[$e,tr]},e[ae]={e:fr,r:!1,t:!1,o:8,type:$e},e[ie]={e:sr,r:!0,t:!1,o:2,type:He},e[ue]={e:sr,r:!0,t:!1,o:2,type:je},e[$]={e:sr,r:!0,t:!1,o:4,type:qe},e[J]={e:sr,r:!0,t:!1,o:4,type:Ke},e[ee]={e:sr,r:!0,t:!1,o:8,type:Qe},e[re]={e:sr,r:!0,t:!1,o:8,type:Ze},e[me]={e:X,r:!0,t:!0,o:3,type:He},e[ye]={e:X,r:!1,t:!0,o:3,type:He},e[pe]={e:X,r:!0,t:!0,o:[3,2],type:[He,rr]},e[Ee]={e:X,r:!1,t:!0,o:3,type:je},e[be]={e:X,r:!1,t:!0,o:[12,6,4],type:[$e,tr,or]},e[de]={e:X,r:!1,t:!0,o:[12,6,4],type:[$e,tr,ar]},e[ve]={e:X,r:!1,t:!0,o:[12,6],type:[$e,tr]},e[he]={e:X,r:!1,t:!1,o:12,type:$e},e[Ae]={e:mr,r:!1,t:!1,o:3,type:He},e[xe]={e:mr,r:!1,t:!1,o:3,type:je},e[Te]={e:mr,r:!1,t:!1,o:6,type:qe},e[Re]={e:mr,r:!1,t:!1,o:6,type:Ke},e[Fe]={e:mr,r:!1,t:!1,o:12,type:Qe},e[ge]={e:mr,r:!1,t:!1,o:12,type:Ze},e[_e]={e:G,r:!0,t:!0,o:4,type:He},e[Pe]={e:G,r:!0,t:!0,o:4,type:He},e[we]={e:G,r:!1,t:!0,o:4,type:je},e[Ue]={e:G,r:!0,t:!0,o:[4,2,4],type:[He,er,nr]},e[Be]={e:G,r:!0,t:!0,o:[4,2],type:[He,Je]},e[Ie]={e:G,r:!0,t:!0,o:4,type:nr},e[Ce]={e:G,r:!1,t:!0,o:[16,8],type:[$e,tr]},e[Se]={e:G,r:!1,t:!1,o:16,type:$e},e[Me]={e:yr,r:!0,t:!1,o:4,type:He},e[Le]={e:yr,r:!0,t:!1,o:4,type:je},e[De]={e:yr,r:!0,t:!1,o:4,type:nr},e[Oe]={e:yr,r:!0,t:!1,o:8,type:qe},e[Ne]={e:yr,r:!0,t:!1,o:8,type:Ke},e[ze]={e:yr,r:!0,t:!1,o:16,type:Ze},e[Xe]={e:yr,r:!0,t:!1,o:16,type:Qe},e[Ge]={e:Y,r:!0,t:!1,o:[2,4],type:[qe,Qe]},e[Ve]={e:Y,r:!0,t:!1,o:4,type:Qe},e[ke]={e:Y,r:!0,t:!1,o:4,type:$e},e[We]={e:W,r:!0,t:!1,o:4,type:ur},e[Ye]={e:W,r:!0,t:!1,o:4,type:ir},Object.keys(e).forEach(function(r){var t=e[r];if(t.bytesPerElementMap={},Array.isArray(t.o))t.o.forEach(function(e,r){var n=t.type[r];t.bytesPerElementMap[n]=e});else{var n=t.type;t.bytesPerElementMap[n]=t.o}})}();var dr=function(){function e(e){if(!r){r={};for(var t in e)"number"==typeof e[t]&&(r[e[t]]=t)}}var r;return function(t,n){return e(t),r[n]||"0x"+n.toString(16)}}(),vr={};return{setDefaults_:l,createSampler:d,createSamplers:v,setSamplerParameters:b,createTexture:C,setEmptyTexture:I,setTextureFromArray:B,loadTextureFromUrl:P,setTextureFromElement:R,setTextureFilteringForSize:A,setTextureParameters:E,setDefaultTextureColor:c,createTextures:L,resizeTexture:S,getNumComponentsForFormat:u,getBytesPerElementForInternalFormat:t}}.apply(r,n),!(void 0!==o&&(e.exports=o))},function(e,r,t){var n,o;n=[t(6)],o=function(e){"use strict";function r(r,t,n){var o=r.createVertexArray();return r.bindVertexArray(o),t.length||(t=[t]),t.forEach(function(t){e.setBuffersAndAttributes(r,t,n)}),r.bindVertexArray(null),{numElements:n.numElements,elementType:n.elementType,vertexArrayObject:o}}function t(r,t,n,o){var a=r.createVertexArray();return r.bindVertexArray(a),e.setAttributes(t,n),o&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,o),r.bindVertexArray(null),a}function n(e,r,n){return t(e,r.attribSetters||r,n.attribs,n.indices)}return{createVertexArrayInfo:r,createVAOAndSetAttributes:t,createVAOFromBufferInfo:n}}.apply(r,n),!(void 0!==o&&(e.exports=o))},function(e,r,t){var n,o;n=[t(11)],o=function(e){"use strict";function r(e){var r=I;return I=e,r}function t(e,r){return r=r||new I(16),r[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 n(e,r){return r=r||new I(16),r[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 o(e){return e=e||new I(16),e[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 a(e,r){if(r=r||new I(16),r===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],o=e[1],a=e[2],i=e[3],u=e[4],f=e[5],s=e[6],c=e[7],l=e[8],m=e[9],y=e[10],p=e[11],E=e[12],b=e[13],d=e[14],v=e[15];return r[0]=n,r[1]=u,r[2]=l,r[3]=E,r[4]=o,r[5]=f,r[6]=m,r[7]=b,r[8]=a,r[9]=s,r[10]=y,r[11]=d,r[12]=i,r[13]=c,r[14]=p,r[15]=v,r}function i(e,r){r=r||new I(16);var t=e[0],n=e[1],o=e[2],a=e[3],i=e[4],u=e[5],f=e[6],s=e[7],c=e[8],l=e[9],m=e[10],y=e[11],p=e[12],E=e[13],b=e[14],d=e[15],v=m*d,h=b*y,A=f*d,x=b*s,T=f*y,R=m*s,F=o*d,g=b*a,_=o*y,P=m*a,w=o*s,U=f*a,B=c*E,C=p*l,S=i*E,M=p*u,L=i*l,D=c*u,O=t*E,N=p*n,z=t*l,X=c*n,G=t*u,V=i*n,k=v*u+x*l+T*E-(h*u+A*l+R*E),Y=h*n+F*l+P*E-(v*n+g*l+_*E),W=A*n+g*u+w*E-(x*n+F*u+U*E),j=R*n+_*u+U*l-(T*n+P*u+w*l),H=1/(t*k+i*Y+c*W+p*j);return r[0]=H*k,r[1]=H*Y,r[2]=H*W,r[3]=H*j,r[4]=H*(h*i+A*c+R*p-(v*i+x*c+T*p)),r[5]=H*(v*t+g*c+_*p-(h*t+F*c+P*p)),r[6]=H*(x*t+F*i+U*p-(A*t+g*i+w*p)),r[7]=H*(T*t+P*i+w*c-(R*t+_*i+U*c)),r[8]=H*(B*s+M*y+L*d-(C*s+S*y+D*d)),r[9]=H*(C*a+O*y+X*d-(B*a+N*y+z*d)),r[10]=H*(S*a+N*s+G*d-(M*a+O*s+V*d)),r[11]=H*(D*a+z*s+V*y-(L*a+X*s+G*y)),r[12]=H*(S*m+D*b+C*f-(L*b+B*f+M*m)),r[13]=H*(z*b+B*o+N*m-(O*m+X*b+C*o)),r[14]=H*(O*f+V*b+M*o-(G*b+S*o+N*f)),r[15]=H*(G*m+L*o+X*f-(z*f+V*m+D*o)),r}function u(e,r,t){t=t||new I(16);var n=e[0],o=e[1],a=e[2],i=e[3],u=e[4],f=e[5],s=e[6],c=e[7],l=e[8],m=e[9],y=e[10],p=e[11],E=e[12],b=e[13],d=e[14],v=e[15],h=r[0],A=r[1],x=r[2],T=r[3],R=r[4],F=r[5],g=r[6],_=r[7],P=r[8],w=r[9],U=r[10],B=r[11],C=r[12],S=r[13],M=r[14],L=r[15];return t[0]=n*h+u*A+l*x+E*T,t[1]=o*h+f*A+m*x+b*T,t[2]=a*h+s*A+y*x+d*T,t[3]=i*h+c*A+p*x+v*T,t[4]=n*R+u*F+l*g+E*_,t[5]=o*R+f*F+m*g+b*_,t[6]=a*R+s*F+y*g+d*_,t[7]=i*R+c*F+p*g+v*_,t[8]=n*P+u*w+l*U+E*B,t[9]=o*P+f*w+m*U+b*B,t[10]=a*P+s*w+y*U+d*B,t[11]=i*P+c*w+p*U+v*B,t[12]=n*C+u*S+l*M+E*L,t[13]=o*C+f*S+m*M+b*L,t[14]=a*C+s*S+y*M+d*L,t[15]=i*C+c*S+p*M+v*L,t}function f(e,r,t){return t=t||o(),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]),t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}function s(r,t){return t=t||e.create(),t[0]=r[12],t[1]=r[13],t[2]=r[14],t}function c(r,t,n){n=n||e.create();var o=4*t;return n[0]=r[o+0],n[1]=r[o+1],n[2]=r[o+2],n}function l(e,r,t,o){o!==e&&(o=n(e,o));var a=4*t;return o[a+0]=r[0],o[a+1]=r[1],o[a+2]=r[2],o}function m(e,r,t,n,o){o=o||new I(16);var a=Math.tan(.5*Math.PI-.5*e),i=1/(t-n);return o[0]=a/r,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=a,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=(t+n)*i,o[11]=-1,o[12]=0,o[13]=0,o[14]=t*n*i*2,o[15]=0,o}function y(e,r,t,n,o,a,i){return i=i||new I(16),i[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]=-1/(a-o),i[11]=0,i[12]=(r+e)/(e-r),i[13]=(n+t)/(t-n),i[14]=-o/(o-a),i[15]=1,i}function p(e,r,t,n,o,a,i){i=i||new I(16);var u=r-e,f=n-t,s=o-a;return i[0]=2*o/u,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=2*o/f,i[6]=0,i[7]=0,i[8]=(e+r)/u,i[9]=(n+t)/f,i[10]=a/s,i[11]=-1,i[12]=0,i[13]=0,i[14]=o*a/s,i[15]=0,i}function E(r,t,n,o){o=o||new I(16);var a=C,i=S,u=M;return e.normalize(e.subtract(r,t,u),u),e.normalize(e.cross(n,u,a),a),e.normalize(e.cross(u,a,i),i),o[0]=a[0],o[1]=a[1],o[2]=a[2],o[3]=0,o[4]=i[0],o[5]=i[1],o[6]=i[2],o[7]=0,o[8]=u[0],o[9]=u[1],o[10]=u[2],o[11]=0,o[12]=r[0],o[13]=r[1],o[14]=r[2],o[15]=1,o}function b(e,r){return r=r||new I(16),r[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}function d(e,r,t){t=t||new I(16);var n=r[0],o=r[1],a=r[2],i=e[0],u=e[1],f=e[2],s=e[3],c=e[4],l=e[5],m=e[6],y=e[7],p=e[8],E=e[9],b=e[10],d=e[11],v=e[12],h=e[13],A=e[14],x=e[15];return e!==t&&(t[0]=i,t[1]=u,t[2]=f,t[3]=s,t[4]=c,t[5]=l,t[6]=m,t[7]=y,t[8]=p,t[9]=E,t[10]=b,t[11]=d),t[12]=i*n+c*o+p*a+v,t[13]=u*n+l*o+E*a+h,t[14]=f*n+m*o+b*a+A,t[15]=s*n+y*o+d*a+x,t}function v(e,r){r=r||new I(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}function h(e,r,t){t=t||new I(16);var n=e[4],o=e[5],a=e[6],i=e[7],u=e[8],f=e[9],s=e[10],c=e[11],l=Math.cos(r),m=Math.sin(r);return t[4]=l*n+m*u,t[5]=l*o+m*f,t[6]=l*a+m*s,t[7]=l*i+m*c,t[8]=l*u-m*n,t[9]=l*f-m*o,t[10]=l*s-m*a,t[11]=l*c-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]),t}function A(e,r){r=r||new I(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}function x(e,r,t){t=t||new I(16);var n=e[0],o=e[1],a=e[2],i=e[3],u=e[8],f=e[9],s=e[10],c=e[11],l=Math.cos(r),m=Math.sin(r);return t[0]=l*n-m*u,t[1]=l*o-m*f,t[2]=l*a-m*s,t[3]=l*i-m*c,t[8]=l*u+m*n,t[9]=l*f+m*o,t[10]=l*s+m*a,t[11]=l*c+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]),t}function T(e,r){r=r||new I(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}function R(e,r,t){t=t||new I(16);var n=e[0],o=e[1],a=e[2],i=e[3],u=e[4],f=e[5],s=e[6],c=e[7],l=Math.cos(r),m=Math.sin(r);return t[0]=l*n+m*u,t[1]=l*o+m*f,t[2]=l*a+m*s,t[3]=l*i+m*c,t[4]=l*u-m*n,t[5]=l*f-m*o,t[6]=l*s-m*a,t[7]=l*c-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]),t}function F(e,r,t){t=t||new I(16);var n=e[0],o=e[1],a=e[2],i=Math.sqrt(n*n+o*o+a*a);n/=i,o/=i,a/=i;var u=n*n,f=o*o,s=a*a,c=Math.cos(r),l=Math.sin(r),m=1-c;return t[0]=u+(1-u)*c,t[1]=n*o*m+a*l,t[2]=n*a*m-o*l,t[3]=0,t[4]=n*o*m-a*l,t[5]=f+(1-f)*c,t[6]=o*a*m+n*l,t[7]=0,t[8]=n*a*m+o*l,t[9]=o*a*m-n*l,t[10]=s+(1-s)*c,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function g(e,r,t,n){n=n||new I(16);var o=r[0],a=r[1],i=r[2],u=Math.sqrt(o*o+a*a+i*i);o/=u,a/=u,i/=u;var f=o*o,s=a*a,c=i*i,l=Math.cos(t),m=Math.sin(t),y=1-l,p=f+(1-f)*l,E=o*a*y+i*m,b=o*i*y-a*m,d=o*a*y-i*m,v=s+(1-s)*l,h=a*i*y+o*m,A=o*i*y+a*m,x=a*i*y-o*m,T=c+(1-c)*l,R=e[0],F=e[1],g=e[2],_=e[3],P=e[4],w=e[5],U=e[6],B=e[7],C=e[8],S=e[9],M=e[10],L=e[11];return n[0]=p*R+E*P+b*C,n[1]=p*F+E*w+b*S,n[2]=p*g+E*U+b*M,n[3]=p*_+E*B+b*L,n[4]=d*R+v*P+h*C,n[5]=d*F+v*w+h*S,n[6]=d*g+v*U+h*M,n[7]=d*_+v*B+h*L,n[8]=A*R+x*P+T*C,n[9]=A*F+x*w+T*S,n[10]=A*g+x*U+T*M,n[11]=A*_+x*B+T*L,e!==n&&(n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15]),n}function _(e,r){return r=r||new I(16),r[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}function P(e,r,t){t=t||new I(16);var n=r[0],o=r[1],a=r[2];return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=n*e[3],t[4]=o*e[4],t[5]=o*e[5],t[6]=o*e[6],t[7]=o*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]),t}function w(r,t,n){n=n||e.create();var o=t[0],a=t[1],i=t[2],u=o*r[3]+a*r[7]+i*r[11]+r[15];return n[0]=(o*r[0]+a*r[4]+i*r[8]+r[12])/u,n[1]=(o*r[1]+a*r[5]+i*r[9]+r[13])/u,n[2]=(o*r[2]+a*r[6]+i*r[10]+r[14])/u,n}function U(r,t,n){n=n||e.create();var o=t[0],a=t[1],i=t[2];return n[0]=o*r[0]+a*r[4]+i*r[8],n[1]=o*r[1]+a*r[5]+i*r[9],n[2]=o*r[2]+a*r[6]+i*r[10],n}function B(r,t,n){n=n||e.create();var o=i(r),a=t[0],u=t[1],f=t[2];return n[0]=a*o[0]+u*o[1]+f*o[2],n[1]=a*o[4]+u*o[5]+f*o[6],n[2]=a*o[8]+u*o[9]+f*o[10],n}var I=Float32Array,C=e.create(),S=e.create(),M=e.create();return{axisRotate:g,axisRotation:F,create:o,copy:n,frustum:p,getAxis:c,getTranslation:s,identity:o,inverse:i,lookAt:E,multiply:u,negate:t,ortho:y,perspective:m,rotateX:h,rotateY:x,rotateZ:R,rotateAxis:g,rotationX:v,rotationY:A,rotationZ:T,scale:P,scaling:_,setAxis:l,setDefaultType:r,setTranslation:f,transformDirection:U,transformNormal:B,transformPoint:w,translate:d,translation:b,transpose:a}}.apply(r,n),!(void 0!==o&&(e.exports=o))},function(e,r,t){var n,o;n=[],o=function(){"use strict";function e(e){var r=b;return b=e,r}function r(e,r,t){var n=new b(3);return e&&(n[0]=e),r&&(n[1]=r),t&&(n[2]=t),n}function t(e,r,t){return t=t||new b(3),t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t}function n(e,r,t){return t=t||new b(3),t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t}function o(e,r,t,n){return n=n||new b(3),n[0]=(1-t)*e[0]+t*r[0],n[1]=(1-t)*e[1]+t*r[1],n[2]=(1-t)*e[2]+t*r[2],n}function a(e,r,t){return t=t||new b(3),t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t}function i(e,r,t){return t=t||new b(3),t[0]=e[0]/r,t[1]=e[1]/r,t[2]=e[2]/r,t}function u(e,r,t){return t=t||new b(3),t[0]=e[1]*r[2]-e[2]*r[1],t[1]=e[2]*r[0]-e[0]*r[2],t[2]=e[0]*r[1]-e[1]*r[0],t}function f(e,r){return e[0]*r[0]+e[1]*r[1]+e[2]*r[2]}function s(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2])}function c(e){return e[0]*e[0]+e[1]*e[1]+e[2]*e[2]}function l(e,r){r=r||new b(3);var t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=Math.sqrt(t);return n>1e-5?(r[0]=e[0]/n,r[1]=e[1]/n,r[2]=e[2]/n):(r[0]=0,r[1]=0,r[2]=0),r}function m(e,r){return r=r||new b(3),r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r}function y(e,r){return r=r||new b(3),r[0]=e[0],r[1]=e[1],r[2]=e[2],r}function p(e,r,t){return t=t||new b(3),t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t}function E(e,r,t){return t=t||new b(3),t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t}var b=Float32Array;return{add:t,copy:y,create:r,cross:u,divide:E,divScalar:i,dot:f,lerp:o,length:s,lengthSq:c,mulScalar:a,multiply:p,negate:m,normalize:l,setDefaultType:e,subtract:n}}.apply(r,n),!(void 0!==o&&(e.exports=o))},function(e,r,t){var n,o;n=[t(2),t(4),t(10),t(11)],o=function(e,r,t,n){"use strict";function o(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||n.buffer&&n.buffer instanceof ArrayBuffer)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 a(e,r,t){var n=t||Float32Array;return o(new n(e*r),e)}function i(e){return"indices"!==e}function u(e){function r(r){for(var i=e[r],u=i.numComponents,f=a(u,o,i.constructor),s=0;s<o;++s)for(var c=t[s],l=c*u,m=0;m<u;++m)f.push(i[l+m]);n[r]=f}var t=e.indices,n={},o=t.length;return Object.keys(e).filter(i).forEach(r),n}function f(e){if(e.indices)throw"can't 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],a=r[n+1],i=r[n+2],u=r[n+3],f=r[n+4],s=r[n+5],c=r[n+6],l=r[n+7],m=r[n+8],y=o+u+c,p=a+f+l,E=i+s+m,b=Math.sqrt(y*y+p*p+E*E);y/=b,p/=b,E/=b,r[n+0]=y,r[n+1]=p,r[n+2]=E,r[n+3]=y,r[n+4]=p,r[n+5]=E,r[n+6]=y,r[n+7]=p,r[n+8]=E}return e}function s(e,r,t){for(var n=e.length,o=new Float32Array(3),a=0;a<n;a+=3)t(r,[e[a],e[a+1],e[a+2]],o),e[a]=o[0],e[a+1]=o[1],e[a+2]=o[2]}function c(e,r,t){t=t||n.create();var o=r[0],a=r[1],i=r[2];return t[0]=o*e[0]+a*e[1]+i*e[2],t[1]=o*e[4]+a*e[5]+i*e[6],t[2]=o*e[8]+a*e[9]+i*e[10],t}function l(e,r){return s(e,r,t.transformDirection),e}function m(e,r){return s(e,t.inverse(r),c),e}function y(e,r){return s(e,r,t.transformPoint),e}function p(e,r){return Object.keys(e).forEach(function(t){var n=e[t];t.indexOf("pos")>=0?y(n,r):t.indexOf("tan")>=0||t.indexOf("binorm")>=0?l(n,r):t.indexOf("norm")>=0&&m(n,r)}),e}function E(e,r,t){return e=e||2,r=r||0,t=t||0,e*=.5,{position:{numComponents:2,data:[r+-1*e,t+-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 b(e,r,n,o,i){e=e||1,r=r||1,n=n||1,o=o||1,i=i||t.identity();for(var u=(n+1)*(o+1),f=a(3,u),s=a(3,u),c=a(2,u),l=0;l<=o;l++)for(var m=0;m<=n;m++){var y=m/n,E=l/o;f.push(e*y-.5*e,0,r*E-.5*r),s.push(0,1,0),c.push(y,E)}for(var b=n+1,d=a(3,n*o*2,Uint16Array),l=0;l<o;l++)for(var m=0;m<n;m++)d.push((l+0)*b+m,(l+1)*b+m,(l+0)*b+m+1),d.push((l+1)*b+m,(l+1)*b+m+1,(l+0)*b+m+1);var v=p({position:f,normal:s,texcoord:c,indices:d},i);return v}function d(e,r,t,n,o,i,u){if(r<=0||t<=0)throw Error("subdivisionAxis and subdivisionHeight must be > 0");n=n||0,o=o||Math.PI,i=i||0,u=u||2*Math.PI;for(var f=o-n,s=u-i,c=(r+1)*(t+1),l=a(3,c),m=a(3,c),y=a(2,c),p=0;p<=t;p++)for(var E=0;E<=r;E++){var b=E/r,d=p/t,v=s*b,h=f*d,A=Math.sin(v),x=Math.cos(v),T=Math.sin(h),R=Math.cos(h),F=x*T,g=R,_=A*T;l.push(e*F,e*g,e*_),m.push(F,g,_),y.push(1-b,d)}for(var P=r+1,w=a(3,r*t*2,Uint16Array),E=0;E<r;E++)for(var p=0;p<t;p++)w.push((p+0)*P+E,(p+0)*P+E+1,(p+1)*P+E),w.push((p+1)*P+E,(p+0)*P+E+1,(p+1)*P+E+1);return{position:l,normal:m,texcoord:y,indices:w}}function v(e){e=e||1;for(var r=e/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=24,u=a(3,i),f=a(3,i),s=a(2,i),c=a(3,12,Uint16Array),l=0;l<6;++l){for(var m=D[l],y=0;y<4;++y){var p=t[m[y]],E=n[l],b=o[y];u.push(p),f.push(E),s.push(b)}var d=4*l;c.push(d+0,d+1,d+2),c.push(d+0,d+2,d+3)}return{position:u,normal:f,texcoord:s,indices:c}}function h(e,r,t,n,o,i,u){if(n<3)throw Error("radialSubdivisions must be 3 or greater");if(o<1)throw Error("verticalSubdivisions must be 1 or greater");for(var f=void 0===i||i,s=void 0===u||u,c=(f?2:0)+(s?2:0),l=(n+1)*(o+1+c),m=a(3,l),y=a(3,l),p=a(2,l),E=a(3,n*(o+c)*2,Uint16Array),b=n+1,d=Math.atan2(e-r,t),v=Math.cos(d),h=Math.sin(d),A=f?-2:0,x=o+(s?2:0),T=A;T<=x;++T){var R,F=T/o,g=t*F;T<0?(g=0,F=1,R=e):T>o?(g=t,F=1,R=r):R=e+(r-e)*(T/o),T!==-2&&T!==o+2||(R=0,F=0),g-=t/2;for(var _=0;_<b;++_){var P=Math.sin(_*Math.PI*2/n),w=Math.cos(_*Math.PI*2/n);m.push(P*R,g,w*R),y.push(T<0||T>o?0:P*v,T<0?-1:T>o?1:h,T<0||T>o?0:w*v),p.push(_/n,1-F)}}for(var T=0;T<o+c;++T)for(var _=0;_<n;++_)E.push(b*(T+0)+0+_,b*(T+0)+1+_,b*(T+1)+1+_),E.push(b*(T+0)+0+_,b*(T+1)+1+_,b*(T+1)+0+_);return{position:m,normal:y,texcoord:p,indices:E}}function A(e,r){r=r||[];for(var t=[],n=0;n<e.length;n+=4){var o=e[n],a=e.slice(n+1,n+4);a.push.apply(a,r);for(var i=0;i<o;++i)t.push.apply(t,a)}return t}function x(){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=[.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],t=A([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]),n=A([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]),o=e.length/3,i={position:a(3,o),texcoord:a(2,o),normal:a(3,o),color:a(4,o,Uint8Array),indices:a(3,o/3,Uint16Array)};i.position.push(e),i.texcoord.push(r),i.normal.push(t),i.color.push(n);for(var u=0;u<o;++u)i.indices.push(u);return i}function T(e,r,t,o,i,u,f){function s(e,r,t){return e+(r-e)*t}function c(r,t,a,f,c,l){for(var p=0;p<=i;p++){var v=t/(m-1),h=p/i,A=2*(v-.5),x=(u+h*y)*Math.PI,T=Math.sin(x),R=Math.cos(x),F=s(e,r,T),g=A*o,_=R*e,P=T*F;E.push(g,_,P);var w=n.add(n.multiply([0,T,R],a),f);b.push(w),d.push(v*c+l,h)}}function l(e,r){for(var t=0;t<i;++t)A.push(e+t+0,e+t+1,r+t+0),A.push(e+t+1,r+t+1,r+t+0)}if(i<=0)throw Error("subdivisionDown must be > 0");u=u||0,f=f||1;for(var m=2,y=f-u,p=2*(i+1)*(2+m),E=a(3,p),b=a(3,p),d=a(2,p),v=0;v<m;v++){var h=2*(v/(m-1)-.5);c(r,v,[1,1,1],[0,0,0],1,0),c(r,v,[0,0,0],[h,0,0],0,0),c(t,v,[1,1,1],[0,0,0],1,0),c(t,v,[0,0,0],[h,0,0],0,1)}var A=a(3,2*i*(2+m),Uint16Array),x=i+1;return l(0*x,4*x),l(5*x,7*x),l(6*x,2*x),l(3*x,1*x),{position:E,normal:b,texcoord:d,indices:A}}function R(e,r,t,n,o,a){return h(e,e,r,t,n,o,a)}function F(e,r,t,n,o,i){if(t<3)throw Error("radialSubdivisions must be 3 or greater");if(n<3)throw Error("verticalSubdivisions must be 3 or greater");o=o||0,i=i||2*Math.PI;for(var u=i-o,f=t+1,s=n+1,c=f*s,l=a(3,c),m=a(3,c),y=a(2,c),p=a(3,t*n*2,Uint16Array),E=0;E<s;++E)for(var b=E/n,d=b*Math.PI*2,v=Math.sin(d),h=e+v*r,A=Math.cos(d),x=A*r,T=0;T<f;++T){var R=T/t,F=o+R*u,g=Math.sin(F),_=Math.cos(F),P=g*h,w=_*h,U=g*v,B=_*v;l.push(P,x,w),m.push(U,A,B),y.push(R,1-b)}for(var E=0;E<n;++E)for(var T=0;T<t;++T){var I=1+T,C=1+E;p.push(f*E+T,f*C+T,f*E+I),p.push(f*C+T,f*C+I,f*E+I)}return{position:l,normal:m,texcoord:y,indices:p}}function g(e,r,t,n,o){if(r<3)throw Error("divisions must be at least 3");t=t?t:1,o=o?o:1,n=n?n:0;for(var i=(r+1)*(t+1),u=a(3,i),f=a(3,i),s=a(2,i),c=a(3,t*r*2,Uint16Array),l=0,m=e-n,y=r+1,p=0;p<=t;++p){for(var E=n+m*Math.pow(p/t,o),b=0;b<=r;++b){var d=2*Math.PI*b/r,v=E*Math.cos(d),h=E*Math.sin(d);if(u.push(v,0,h),f.push(0,1,0),s.push(1-b/r,p/t),p>0&&b!==r){var A=l+(b+1),x=l+b,T=l+b-y,R=l+(b+1)-y;c.push(A,x,T),c.push(A,T,R)}}l+=r+1}return{position:u,normal:f,texcoord:s,indices:c}}function _(e){return Math.random()*e|0}function P(e,r){r=r||{};var t=e.position.numElements,n=a(4,t,Uint8Array),o=r.rand||function(e,r){return r<3?_(256):255};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 u=r.vertsPerColor||3,f=t/u,i=0;i<f;++i)for(var s=[o(i,0),o(i,1),o(i,2),o(i,3)],c=0;c<u;++c)n.push(s);return e}function w(r){return function(t){var n=r.apply(this,Array.prototype.slice.call(arguments,1));return e.createBuffersFromArrays(t,n)}}function U(r){return function(t){var n=r.apply(null,Array.prototype.slice.call(arguments,1));return e.createBufferInfoFromArrays(t,n)}}function B(e,r,t,n){n=n||0;for(var o=e.length,a=0;a<o;++a)r[t+a]=e[a]+n}function I(e,t){var n=M(e),a=new n.constructor(t),i=a;return n.numComponents&&n.numElements&&o(a,n.numComponents),e.data&&(i={data:a},r.copyNamedProperties(O,e,i)),i}function C(e){function r(r){for(var t,n=0,o=0;o<e.length;++o){var a=e[o],i=a[r],u=M(i);n+=u.length,t&&!i.data||(t=i)}return{length:n,spec:t}}function t(r,t,n){for(var o=0,a=0,i=0;i<e.length;++i){var u=e[i],f=u[r],s=M(f);"indices"===r?(B(s,n,a,o),o+=t[i]):B(s,n,a),a+=s.length}}for(var n,o={},a=0;a<e.length;++a){var i=e[a];Object.keys(i).forEach(function(e){o[e]||(o[e]=[]),n||"indices"===e||(n=e);var r=i[e],t=L(r,e),a=M(r),u=a.length/t;o[e].push(u)})}var u=o[n],f={};return Object.keys(o).forEach(function(e){var n=r(e),o=I(n.spec,n.length);t(e,u,M(o)),f[e]=o}),f}function S(e){var r={};return Object.keys(e).forEach(function(t){var n=e[t],o=M(n),a=I(n,o.length);B(o,M(a),0),r[t]=a}),r}var M=e.getArray_,L=e.getNumComponents_,D=[[3,7,5,1],[6,2,0,4],[6,7,3,2],[0,1,5,4],[7,6,4,5],[2,3,1,0]],O=["numComponents","size","type","normalize","stride","offset","attrib","name","attribName"];return{create3DFBufferInfo:U(x),create3DFBuffers:w(x),create3DFVertices:x,createAugmentedTypedArray:a,createCubeBufferInfo:U(v),createCubeBuffers:w(v),createCubeVertices:v,createPlaneBufferInfo:U(b),createPlaneBuffers:w(b),createPlaneVertices:b,createSphereBufferInfo:U(d),createSphereBuffers:w(d),createSphereVertices:d,createTruncatedConeBufferInfo:U(h),createTruncatedConeBuffers:w(h),createTruncatedConeVertices:h,createXYQuadBufferInfo:U(E),createXYQuadBuffers:w(E),createXYQuadVertices:E,createCresentBufferInfo:U(T),createCresentBuffers:w(T),createCresentVertices:T,createCylinderBufferInfo:U(R),createCylinderBuffers:w(R),createCylinderVertices:R,createTorusBufferInfo:U(F),createTorusBuffers:w(F),createTorusVertices:F,createDiscBufferInfo:U(g),createDiscBuffers:w(g),createDiscVertices:g,deindexVertices:u,flattenNormals:f,makeRandomVertexColors:P,reorientDirections:l,reorientNormals:m,reorientPositions:y,reorientVertices:p,concatVertices:C,duplicateVertices:S}}.apply(r,n),!(void 0!==o&&(e.exports=o))}])});