/**
 * @license twgl.js 1.9.0 Copyright (c) 2015, Gregg Tavares All Rights Reserved.
 * Available via the MIT license.
 * see: http://github.com/greggman/twgl.js for details
 */
/**
 * @license almond 0.3.1 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved.
 * Available via the MIT or new BSD license.
 * see: http://github.com/jrburke/almond for details
 */
!function(a,b){"function"==typeof define&&define.amd&&define([],b),"undefined"!=typeof module&&module.exports?module.exports=b():a.twgl=b()}(this,function(){var a,b,c;return function(d){function e(a,b){return u.call(a,b)}function f(a,b){var c,d,e,f,g,h,i,j,k,l,m,n=b&&b.split("/"),o=s.map,p=o&&o["*"]||{};if(a&&"."===a.charAt(0))if(b){for(a=a.split("/"),g=a.length-1,s.nodeIdCompat&&w.test(a[g])&&(a[g]=a[g].replace(w,"")),a=n.slice(0,n.length-1).concat(a),k=0;k<a.length;k+=1)if(m=a[k],"."===m)a.splice(k,1),k-=1;else if(".."===m){if(1===k&&(".."===a[2]||".."===a[0]))break;k>0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((n||p)&&o){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),n)for(l=n.length;l>0;l-=1)if(e=o[n.slice(0,l).join("/")],e&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&p&&p[d]&&(i=p[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function g(a,b){return function(){var c=v.call(arguments,0);return"string"!=typeof c[0]&&1===c.length&&c.push(null),n.apply(d,c.concat([a,b]))}}function h(a){return function(b){return f(b,a)}}function i(a){return function(b){q[a]=b}}function j(a){if(e(r,a)){var b=r[a];delete r[a],t[a]=!0,m.apply(d,b)}if(!e(q,a)&&!e(t,a))throw new Error("No "+a);return q[a]}function k(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function l(a){return function(){return s&&s.config&&s.config[a]||{}}}var m,n,o,p,q={},r={},s={},t={},u=Object.prototype.hasOwnProperty,v=[].slice,w=/\.js$/;o=function(a,b){var c,d=k(a),e=d[0];return a=d[1],e&&(e=f(e,b),c=j(e)),e?a=c&&c.normalize?c.normalize(a,h(b)):f(a,b):(a=f(a,b),d=k(a),e=d[0],a=d[1],e&&(c=j(e))),{f:e?e+"!"+a:a,n:a,pr:e,p:c}},p={notrequirebecasebrowserifymessesup:function(a){return g(a)},exports:function(a){var b=q[a];return"undefined"!=typeof b?b:q[a]={}},module:function(a){return{id:a,uri:"",exports:q[a],config:l(a)}}},m=function(a,b,c,f){var h,k,l,m,n,s,u=[],v=typeof c;if(f=f||a,"undefined"===v||"function"===v){for(b=!b.length&&c.length?["notrequirebecasebrowserifymessesup","exports","module"]:b,n=0;n<b.length;n+=1)if(m=o(b[n],f),k=m.f,"notrequirebecasebrowserifymessesup"===k)u[n]=p.notrequirebecasebrowserifymessesup(a);else if("exports"===k)u[n]=p.exports(a),s=!0;else if("module"===k)h=u[n]=p.module(a);else if(e(q,k)||e(r,k)||e(t,k))u[n]=j(k);else{if(!m.p)throw new Error(a+" missing "+k);m.p.load(m.n,g(f,!0),i(k),{}),u[n]=q[k]}l=c?c.apply(q[a],u):void 0,a&&(h&&h.exports!==d&&h.exports!==q[a]?q[a]=h.exports:l===d&&s||(q[a]=l))}else a&&(q[a]=c)},a=b=n=function(a,b,c,e,f){if("string"==typeof a)return p[a]?p[a](b):j(o(a,b).f);if(!a.splice){if(s=a,s.deps&&n(s.deps,s.callback),!b)return;b.splice?(a=b,b=c,c=null):a=d}return b=b||function(){},"function"==typeof c&&(c=e,e=f),e?m(d,a,b,c):setTimeout(function(){m(d,a,b,c)},4),n},n.config=function(a){return n(a)},a._defined=q,c=function(a,b,c){if("string"!=typeof a)throw new Error("See almond README: incorrect module build, no module name");b.splice||(c=b,b=[]),e(q,a)||e(r,a)||(r[a]=[a,b,c])},c.amd={jQuery:!0}}(),c("node_modules/almond/almond.js",function(){}),c("twgl/typedarrays",[],function(){function a(a){if(a instanceof Int8Array)return d;if(a instanceof Uint8Array)return e;if(a instanceof Uint8ClampedArray)return e;if(a instanceof Int16Array)return f;if(a instanceof Uint16Array)return g;if(a instanceof Int32Array)return h;if(a instanceof Uint32Array)return i;if(a instanceof Float32Array)return j;throw"unsupported typed array type"}function b(a){switch(a){case d:return Int8Array;case e:return Uint8Array;case f:return Int16Array;case g:return Uint16Array;case h:return Int32Array;case i:return Uint32Array;case j:return Float32Array;default:throw"unknown gl type"}}function c(a){return a&&a.buffer&&a.buffer instanceof ArrayBuffer}var d=5120,e=5121,f=5122,g=5123,h=5124,i=5125,j=5126;return{getGLTypeForTypedArray:a,getTypedArrayTypeForGLType:b,isArrayBuffer:c}}),c("twgl/utils",[],function(){function a(a){var b={};return Object.keys(a).forEach(function(c){b[c]=a[c]}),b}function b(a,b,c){a.forEach(function(a){var d=b[a];void 0!==d&&(c[a]=d)})}function c(a,b){Object.keys(b).forEach(function(c){b.hasOwnProperty(c)&&a.hasOwnProperty(c)&&(b[c]=a[c])})}function d(a){return parseFloat(a.getParameter(a.VERSION).substr(6))}function e(a){return 0===a.getParameter(a.VERSION).indexOf("WebGL 2.0")}function f(a){var b=d(a);return b<=1&&b>0}var g=window.console&&window.console.error&&"function"==typeof window.console.error?window.console.error.bind(window.console):function(){},h=window.console&&window.console.warn&&"function"==typeof window.console.warn?window.console.warn.bind(window.console):function(){};return{copyExistingProperties:c,copyNamedProperties:b,shallowCopy:a,isWebGL1:f,isWebGL2:e,error:g,warn:h}}),c("twgl/attributes",["./typedarrays","./utils"],function(a,b){function c(a){s.attribPrefix=a}function d(a){b.copyExistingProperties(a,s)}function e(a,b,c,d,e){a.bindBuffer(b,c),a.bufferData(b,d,e||a.STATIC_DRAW)}function f(a,b,c,d){if(b instanceof WebGLBuffer)return b;c=c||a.ARRAY_BUFFER;var f=a.createBuffer();return e(a,c,f,b,d),f}function g(a){return"indices"===a}function h(a){return a instanceof Int8Array||a instanceof Uint8Array}function i(a){return a.length?a:a.data}function j(a,b){var c;if(c=a.indexOf("coord")>=0?2:a.indexOf("color")>=0?4:3,b%c>0)throw"can not guess numComponents. You should specify it.";return c}function k(a,b){return a.numComponents||a.size||j(b,i(a).length)}function l(b,c){if(a.isArrayBuffer(b))return b;if(a.isArrayBuffer(b.data))return b.data;Array.isArray(b)&&(b={data:b});var d=b.type;return d||(d="indices"===c?Uint16Array:Float32Array),new d(b.data)}function m(b,c){var d={};return Object.keys(c).forEach(function(e){if(!g(e)){var i=c[e],j=i.attrib||i.name||i.attribName||s.attribPrefix+e,m=l(i,e);d[j]={buffer:f(b,m,void 0,i.drawType),numComponents:k(i,e),type:a.getGLTypeForTypedArray(m),normalize:void 0!==i.normalize?i.normalize:h(m),stride:i.stride||0,offset:i.offset||0,drawType:i.drawType}}}),d}function n(a,b,c,d){c=l(c),d?(a.bindBuffer(a.ARRAY_BUFFER,b.buffer),a.bufferSubData(a.ARRAY_BUFFER,d,c)):e(a,a.ARRAY_BUFFER,b.buffer,c,b.drawType)}function o(b,c){var d={attribs:m(b,c)},e=c.indices;return e?(e=l(e,"indices"),d.indices=f(b,e,b.ELEMENT_ARRAY_BUFFER),d.numElements=e.length,d.elementType=a.getGLTypeForTypedArray(e)):d.numElements=t(c),d}function p(a,b,c){var d="indices"===c?a.ELEMENT_ARRAY_BUFFER:a.ARRAY_BUFFER,e=l(b,c);return f(a,e,d)}function q(a,b){var c={};return Object.keys(b).forEach(function(d){c[d]=p(a,b[d],d)}),c}function r(a,b,c){var d=a.createVertexArray();return a.bindVertexArray(d),b.length||(b=[b]),b.forEach(function(b){twgl.setBuffersAndAttributes(a,b,c)}),a.bindVertexArray(null),{numElements:c.numElements,elementType:c.elementType,vertexArrayObject:d}}var s={attribPrefix:""},t=function(){var a=["position","positions","a_position"];return function(b){for(var c,d=0;d<a.length&&(c=a[d],!(c in b));++d);d===a.length&&(c=Object.keys(b)[0]);var e=b[c],f=i(e).length,g=k(e,c),h=f/g;if(f%g>0)throw"numComponents "+g+" not correct for length "+f;return h}}();return{createAttribsFromArrays:m,createBuffersFromArrays:q,createBufferFromArray:p,createBufferFromTypedArray:f,createBufferInfoFromArrays:o,setAttribInfoBufferFromArray:n,createVertexArrayInfo:r,setAttributePrefix:c,setDefaults_:d,getNumComponents_:k,getArray_:i}}),c("twgl/programs",["./utils"],function(a){function b(a,b){return Na[b].bindPoint}function c(a,b){return function(c){a.uniform1f(b,c)}}function d(a,b){return function(c){a.uniform1fv(b,c)}}function e(a,b){return function(c){a.uniform2fv(b,c)}}function f(a,b){return function(c){a.uniform3fv(b,c)}}function g(a,b){return function(c){a.uniform4fv(b,c)}}function h(a,b){return function(c){a.uniform1i(b,c)}}function i(a,b){return function(c){a.uniform1iv(b,c)}}function j(a,b){return function(c){a.uniform2iv(b,c)}}function k(a,b){return function(c){a.uniform3iv(b,c)}}function l(a,b){return function(c){a.uniform4iv(b,c)}}function m(a,b){return function(c){a.uniform1ui(b,c)}}function n(a,b){return function(c){a.uniform1uiv(b,c)}}function o(a,b){return function(c){a.uniform2uiv(b,c)}}function p(a,b){return function(c){a.uniform3uiv(b,c)}}function q(a,b){return function(c){a.uniform4uiv(b,c)}}function r(a,b){return function(c){a.uniformMatrix2fv(b,!1,c)}}function s(a,b){return function(c){a.uniformMatrix3fv(b,!1,c)}}function t(a,b){return function(c){a.uniformMatrix4fv(b,!1,c)}}function u(a,b){return function(c){a.uniformMatrix2x3fv(b,!1,c)}}function v(a,b){return function(c){a.uniformMatrix3x2fv(b,!1,c)}}function w(a,b){return function(c){a.uniformMatrix2x4fv(b,!1,c)}}function x(a,b){return function(c){a.uniformMatrix4x2fv(b,!1,c)}}function y(a,b){return function(c){a.uniformMatrix3x4fv(b,!1,c)}}function z(a,b){return function(c){a.uniformMatrix4x3fv(b,!1,c)}}function A(a,c,d,e){var f=b(a,c);return function(b){a.uniform1i(e,d),a.activeTexture(a.TEXTURE0+d),a.bindTexture(f,b)}}function B(a,c,d,e,f){for(var g=b(a,c),h=new Int32Array(f),i=0;i<f;++i)h[i]=d+i;return function(b){a.uniform1iv(e,h),b.forEach(function(b,c){a.activeTexture(a.TEXTURE0+h[c]),a.bindTexture(g,b)})}}function C(a,b){return b=b||0,++b,a.split("\n").map(function(a,c){return c+b+": "+a}).join("\n")}function D(a,b,c,d){var e=d||V,f=a.createShader(c),g=0;Pa.test(b)&&(g=1,b=b.replace(Pa,"")),a.shaderSource(f,b),a.compileShader(f);var h=a.getShaderParameter(f,a.COMPILE_STATUS);if(!h){var i=a.getShaderInfoLog(f);return e(C(b,g)+"\n*** Error compiling shader: "+i),a.deleteShader(f),null}return f}function E(a,b,c,d,e){"function"==typeof d&&(e=d,d=void 0),"function"==typeof c&&(e=c,c=void 0);var f=e||V,g=a.createProgram();b.forEach(function(b){a.attachShader(g,b)}),c&&c.forEach(function(b,c){a.bindAttribLocation(g,d?d[c]:c,b)}),a.linkProgram(g);var h=a.getProgramParameter(g,a.LINK_STATUS);if(!h){var i=a.getProgramInfoLog(g);return f("Error in program linking:"+i),a.deleteProgram(g),null}return g}function F(a,b,c,d){var e,f="",g=document.getElementById(b);if(!g)throw"*** Error: unknown script element"+b;if(f=g.text,!c)if("x-shader/x-vertex"===g.type)e=a.VERTEX_SHADER;else if("x-shader/x-fragment"===g.type)e=a.FRAGMENT_SHADER;else if(e!==a.VERTEX_SHADER&&e!==a.FRAGMENT_SHADER)throw"*** Error: unknown shader type";return D(a,f,c?c:e,d)}function G(a,b,c,d,e){for(var f=[],g=0;g<b.length;++g){var h=F(a,b[g],a[Qa[g]],e);if(!h)return null;f.push(h)}return E(a,f,c,d,e)}function H(a,b,c,d,e){for(var f=[],g=0;g<b.length;++g){var h=D(a,b[g],a[Qa[g]],e);if(!h)return null;f.push(h)}return E(a,f,c,d,e)}function I(a,b){function c(b,c){var e=a.getUniformLocation(b,c.name),f=c.size>1&&"[0]"===c.name.substr(-3),g=c.type,h=Na[g];if(!h)throw"unknown type: 0x"+g.toString(16);if(h.bindPoint){var i=d;return d+=c.size,f?h.arraySetter(a,g,i,e,c.size):h.setter(a,g,i,e,c.size)}return h.arraySetter&&f?h.arraySetter(a,e):h.setter(a,e)}for(var d=0,e={},f=a.getProgramParameter(b,a.ACTIVE_UNIFORMS),g=0;g<f;++g){var h=a.getActiveUniform(b,g);if(!h)break;var i=h.name;"[0]"===i.substr(-3)&&(i=i.substr(0,i.length-3));var j=c(b,h);e[i]=j}return e}function J(a,b){for(var c=a.getProgramParameter(b,a.ACTIVE_UNIFORMS),d=[],e=[],f=0;f<c;++f){e.push(f),d.push({});var g=a.getActiveUniform(b,f);if(!g)break;d[f].name=g.name}[["UNIFORM_TYPE","type"],["UNIFORM_SIZE","size"],["UNIFORM_BLOCK_INDEX","blockNdx"],["UNIFORM_OFFSET","offset"]].forEach(function(c){var f=c[0],g=c[1];a.getActiveUniforms(b,e,a[f]).forEach(function(a,b){d[b][g]=a})});var h={},i=a.getProgramParameter(b,a.ACTIVE_UNIFORM_BLOCKS);for(f=0;f<i;++f){var j=a.getActiveUniformBlockName(b,f),k={index:f,usedByVertexShader:a.getActiveUniformBlockParameter(b,f,a.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER),usedByFragmentShader:a.getActiveUniformBlockParameter(b,f,a.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER),size:a.getActiveUniformBlockParameter(b,f,a.UNIFORM_BLOCK_DATA_SIZE),uniformIndices:a.getActiveUniformBlockParameter(b,f,a.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES)};k.used=k.usedByVertexSahder||k.usedByFragmentShader,h[j]=k}return{blockSpecs:h,uniformData:d}}function K(a,b,c,d){var e=c.blockSpecs,f=c.uniformData,g=e[d];if(!g)return W("no uniform block object named:",d),{name:d,uniforms:{}};var h=new ArrayBuffer(g.size),i=a.createBuffer(),j=g.index;a.bindBuffer(a.UNIFORM_BUFFER,i),a.uniformBlockBinding(b,g.index,j);var k=d+".";Ra.test(k)&&(k=k.replace(Ra,"."));var l={};return g.uniformIndices.forEach(function(a){var b=f[a],c=Na[b.type],d=c.Type,e=b.size*c.size,g=b.name;g.substr(0,k.length)===k&&(g=g.substr(k.length)),l[g]=new d(h,b.offset,e/d.BYTES_PER_ELEMENT)}),{name:d,array:h,asFloat:new Float32Array(h),buffer:i,uniforms:l}}function L(a,b,c){return K(a,b.program,b.uniformBlockSpec,c)}function M(a,b,c){var d=b.uniformBlockSpec||b,e=d.blockSpecs[c.name];if(e){var f=e.index;return a.bindBufferRange(a.UNIFORM_BUFFER,f,c.buffer,c.offset||0,c.array.byteLength),!0}return!1}function N(a,b,c){M(a,b,c)&&a.bufferData(a.UNIFORM_BUFFER,c.array,a.DYNAMIC_DRAW)}function O(a,b){var c=a.uniforms;for(var d in b){var e=c[d];if(e){var f=b[d];f.length?e.set(f):e[0]=f}}}function P(a,b){for(var c=a.uniformSetters||a,d=arguments.length,e=1;e<d;++e){var f=arguments[e];if(Array.isArray(f))for(var g=f.length,h=0;h<g;++h)P(c,f[h]);else for(var i in f){var j=c[i];j&&j(f[i])}}}function Q(a,b){function c(b){return function(c){a.bindBuffer(a.ARRAY_BUFFER,c.buffer),a.enableVertexAttribArray(b),a.vertexAttribPointer(b,c.numComponents||c.size,c.type||a.FLOAT,c.normalize||!1,c.stride||0,c.offset||0)}}function d(b,c){var d=c.size,e=c.count;return function(c){a.bindBuffer(a.ARRAY_BUFFER,c.buffer);for(var f=c.size||c.numComponents||d,g=f/e,h=c.type||a.FLOAT,i=Na[h],j=i.size*f,k=c.normalize||!1,l=c.offset||0,m=j/e,n=0;n<e;++n)a.enableVertexAttribArray(b+n),a.vertexAttribPointer(b+n,g,h,k,j,l+m*n)}}for(var e={},f=a.getProgramParameter(b,a.ACTIVE_ATTRIBUTES),g=0;g<f;++g){var h=a.getActiveAttrib(b,g);if(!h)break;var i=a.getAttribLocation(b,h.name),j=Oa[h.type];j?e[h.name]=d(i,j):e[h.name]=c(i)}return e}function R(a,b){for(var c in b){var d=a[c];d&&d(b[c])}}function S(a,b,c){c.vertexArrayObject?a.bindVertexArray(c.vertexArrayObject):(R(b.attribSetters||b,c.attribs),c.indices&&a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,c.indices))}function T(b,c){var d=I(b,c),e=Q(b,c),f={program:c,uniformSetters:d,attribSetters:e};return a.isWebGL2(b)&&(f.uniformBlockSpec=J(b,c)),f}function U(a,b,c,d,e){"function"==typeof d&&(e=d,d=void 0),"function"==typeof c&&(e=c,c=void 0);var f=e||V,g=!0;if(b=b.map(function(a){if(a.indexOf("\n")<0){var b=document.getElementById(a);b?a=b.text:(f("no element with id: "+a),g=!1)}return a}),!g)return null;var h=H(a,b,c,d,e);return h?T(a,h):null}var V=a.error,W=a.warn,X=5126,Y=35664,Z=35665,$=35666,_=5124,aa=35667,ba=35668,ca=35669,da=35670,ea=35671,fa=35672,ga=35673,ha=35674,ia=35675,ja=35676,ka=35678,la=35680,ma=35679,na=35682,oa=35685,pa=35686,qa=35687,ra=35688,sa=35689,ta=35690,ua=36289,va=36292,wa=36293,xa=5125,ya=36294,za=36295,Aa=36296,Ba=36298,Ca=36299,Da=36300,Ea=36303,Fa=36306,Ga=36307,Ha=36308,Ia=36311,Ja=3553,Ka=34067,La=32879,Ma=35866,Na={};Na[X]={Type:Float32Array,size:4,setter:c,arraySetter:d},Na[Y]={Type:Float32Array,size:8,setter:e},Na[Z]={Type:Float32Array,size:12,setter:f},Na[$]={Type:Float32Array,size:16,setter:g},Na[_]={Type:Int32Array,size:4,setter:h,arraySetter:i},Na[aa]={Type:Int32Array,size:8,setter:j},Na[ba]={Type:Int32Array,size:12,setter:k},Na[ca]={Type:Int32Array,size:16,setter:l},Na[xa]={Type:Uint32Array,size:4,setter:m,arraySetter:n},Na[ya]={Type:Uint32Array,size:8,setter:o},Na[za]={Type:Uint32Array,size:12,setter:p},Na[Aa]={Type:Uint32Array,size:16,setter:q},Na[da]={Type:Uint32Array,size:4,setter:h,arraySetter:i},Na[ea]={Type:Uint32Array,size:8,setter:j},Na[fa]={Type:Uint32Array,size:12,setter:k},Na[ga]={Type:Uint32Array,size:16,setter:l},Na[ha]={Type:Float32Array,size:16,setter:r},Na[ia]={Type:Float32Array,size:36,setter:s},Na[ja]={Type:Float32Array,size:64,setter:t},Na[oa]={Type:Float32Array,size:24,setter:u},Na[pa]={Type:Float32Array,size:32,setter:w},Na[qa]={Type:Float32Array,size:24,setter:v},Na[ra]={Type:Float32Array,size:48,setter:y},Na[sa]={Type:Float32Array,size:32,setter:x},Na[ta]={Type:Float32Array,size:48,setter:z},Na[ka]={Type:null,size:0,setter:A,arraySetter:B,bindPoint:Ja},Na[la]={Type:null,size:0,setter:A,arraySetter:B,bindPoint:Ka},Na[ma]={Type:null,size:0,setter:A,arraySetter:B,bindPoint:La},Na[na]={Type:null,size:0,setter:A,arraySetter:B,bindPoint:Ja},Na[ua]={Type:null,size:0,setter:A,arraySetter:B,bindPoint:Ma},Na[va]={Type:null,size:0,setter:A,arraySetter:B,bindPoint:Ma},Na[wa]={Type:null,size:0,setter:A,arraySetter:B,bindPoint:Ka},Na[Ba]={Type:null,size:0,setter:A,arraySetter:B,bindPoint:Ja},Na[Ca]={Type:null,size:0,setter:A,arraySetter:B,bindPoint:La},Na[Da]={Type:null,size:0,setter:A,arraySetter:B,bindPoint:Ka},Na[Ea]={Type:null,size:0,setter:A,arraySetter:B,bindPoint:Ma},Na[Fa]={Type:null,size:0,setter:A,arraySetter:B,bindPoint:Ja},Na[Ga]={Type:null,size:0,setter:A,arraySetter:B,bindPoint:La},Na[Ha]={Type:null,size:0,setter:A,arraySetter:B,bindPoint:Ka},Na[Ia]={Type:null,size:0,setter:A,arraySetter:B,bindPoint:Ma};var Oa={};Oa[ha]={size:4,count:2},Oa[ia]={size:9,count:3},Oa[ja]={size:16,count:4};var Pa=/^[ \t]*\n/,Qa=["VERTEX_SHADER","FRAGMENT_SHADER"],Ra=/\[\d+\]\.$/;return{createAttributeSetters:Q,createProgram:E,createProgramFromScripts:G,createProgramFromSources:H,createProgramInfo:U,createProgramInfoFromProgram:T,createUniformSetters:I,createUniformBlockSpecFromProgram:J,createUniformBlockInfoFromProgram:K,createUniformBlockInfo:L,setAttributes:R,setBuffersAndAttributes:S,setUniforms:P,setUniformBlock:N,setBlockUniforms:O,bindUniformBlock:M}}),c("twgl/draw",["./programs"],function(a){function b(a,b,c,d,e){var f=c.indices,g=c.elementType,h=void 0===d?c.numElements:d;e=void 0===e?0:e,g||f?a.drawElements(b,h,void 0===g?a.UNSIGNED_SHORT:c.elementType,e):a.drawArrays(b,e,h)}function c(c,d){var e=null,f=null;d.forEach(function(d){if(d.active!==!1){var g=d.programInfo,h=d.vertexArrayInfo||d.bufferInfo,i=!1,j=void 0===d.type?c.TRIANGLES:d.type;g!==e&&(e=g,c.useProgram(g.program),i=!0),(i||h!==f)&&(f&&f.vertexArrayObject&&!h.vertexArrayObject&&c.bindVertexArray(null),f=h,a.setBuffersAndAttributes(c,g,h)),a.setUniforms(g,d.uniforms),b(c,j,h,d.count,d.offset)}}),f.vertexArrayObject&&c.bindVertexArray(null)}return{drawBufferInfo:b,drawObjectList:c}}),c("twgl/textures",["./typedarrays","./utils"],function(a,b){function c(a){A.textureColor=new Uint8Array([255*a[0],255*a[1],255*a[2],255*a[3]])}function d(a){b.copyExistingProperties(a,A),a.textureColor&&c(a.textureColor)}function e(a,b){void 0!==b.colorspaceConversion&&(I.colorspaceConversion=a.getParameter(a.UNPACK_COLORSPACE_CONVERSION_WEBGL),a.pixelStorei(a.UNPACK_COLORSPACE_CONVERSION_WEBGL,b.colorspaceConversion)),void 0!==b.premultiplyAlpha&&(I.premultiplyAlpha=a.getParameter(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL),a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,b.premultiplyAlpha)),void 0!==b.flipY&&(I.flipY=a.getParameter(a.UNPACK_FLIP_Y_WEBGL),a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,b.flipY))}function f(a,b){void 0!==b.colorspaceConversion&&a.pixelStorei(a.UNPACK_COLORSPACE_CONVERSION_WEBGL,I.colorspaceConversion),void 0!==b.premultiplyAlpha&&a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,I.premultiplyAlpha),void 0!==b.flipY&&a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,I.flipY)}function g(a,b,c){var d=c.target||a.TEXTURE_2D;a.bindTexture(d,b),c.min&&a.texParameteri(d,a.TEXTURE_MIN_FILTER,c.min),c.mag&&a.texParameteri(d,a.TEXTURE_MAG_FILTER,c.mag),c.wrap&&(a.texParameteri(d,a.TEXTURE_WRAP_S,c.wrap),a.texParameteri(d,a.TEXTURE_WRAP_T,c.wrap),d===a.TEXTURE_3D&&a.texParameteri(d,a.TEXTURE_WRAP_R,c.wrap)),c.wrapR&&a.texParameteri(d,a.TEXTURE_WRAP_R,c.wrapR),c.wrapS&&a.texParameteri(d,a.TEXTURE_WRAP_S,c.wrapS),c.wrapT&&a.texParameteri(d,a.TEXTURE_WRAP_T,c.wrapT),c.minLod&&a.texParameteri(d,a.TEXTURE_MIN_LOD,c.minLod),c.maxLod&&a.texParameteri(d,a.TEXTURE_MAX_LOD,c.maxLod),c.baseLevel&&a.texParameteri(d,a.TEXTURE_BASE_LEVEL,c.baseLevel),c.maxLevel&&a.texParameteri(d,a.TEXTURE_MAX_LEVEL,c.maxLevel)}function h(a){return a=a||A.textureColor,B(a)?a:new Uint8Array([255*a[0],255*a[1],255*a[2],255*a[3]])}function i(a){return 0===(a&a-1)}function j(a,b,c,d,e){c=c||A.textureOptions;var f=c.target||a.TEXTURE_2D;d=d||c.width,e=e||c.height,a.bindTexture(f,b),i(d)&&i(e)?a.generateMipmap(f):(a.texParameteri(f,a.TEXTURE_MIN_FILTER,a.LINEAR),a.texParameteri(f,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(f,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE))}function k(a,b){return b=b||{},b.cubeFaceOrder||[a.TEXTURE_CUBE_MAP_POSITIVE_X,a.TEXTURE_CUBE_MAP_NEGATIVE_X,a.TEXTURE_CUBE_MAP_POSITIVE_Y,a.TEXTURE_CUBE_MAP_NEGATIVE_Y,a.TEXTURE_CUBE_MAP_POSITIVE_Z,a.TEXTURE_CUBE_MAP_NEGATIVE_Z]}function l(a,b){var c=k(a,b),d=c.map(function(a,b){return{face:a,ndx:b}});return d.sort(function(a,b){return a.face-b.face}),d}function m(){}function n(a,c,d){function e(){h.removeEventListener("error",f),h.removeEventListener("load",g),h=null}function f(){var c="couldn't load image: "+a;b.error(c),d(c,h),e()}function g(){d(null,h),e()}d=d||m;var h=new Image;return c=void 0!==c?c:A.crossOrigin,void 0!==c&&(h.crossOrigin=c),h.addEventListener("error",f),h.addEventListener("load",g),h.src=a,h}function o(a,b,c){c=c||A.textureOptions;var d=c.target||a.TEXTURE_2D;if(a.bindTexture(d,b),c.color!==!1){var e=h(c.color);if(d===a.TEXTURE_CUBE_MAP)for(var f=0;f<6;++f)a.texImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,a.RGBA,1,1,0,a.RGBA,a.UNSIGNED_BYTE,e);else d===a.TEXTURE_3D?a.texImage3D(d,0,a.RGBA,1,1,1,0,a.RGBA,a.UNSIGNED_BYTE,e):a.texImage2D(d,0,a.RGBA,1,1,0,a.RGBA,a.UNSIGNED_BYTE,e)}}function p(a,c,d,e){e=e||m,d=d||A.textureOptions,o(a,c,d),d=b.shallowCopy(d);var f=n(d.src,d.crossOrigin,function(b,f){b?e(b,c,f):(J(a,c,f,d),e(null,c,f))});return f}function q(a,c,d,g){function h(b){return function(h,i){--r,h?s.push(h):i.width!==i.height?s.push("cubemap face img is not a square: "+i.src):(e(a,d),a.bindTexture(p,c),5===r?k(a).forEach(function(b){a.texImage2D(b,0,j,j,l,i)}):a.texImage2D(b,0,j,j,l,i),f(a,d),a.generateMipmap(p)),0===r&&g(s.length?s:void 0,q,c)}}g=g||m;var i=d.src;if(6!==i.length)throw"there must be 6 urls for a cubemap";var j=d.format||a.RGBA,l=d.type||a.UNSIGNED_BYTE,p=d.target||a.TEXTURE_2D;if(p!==a.TEXTURE_CUBE_MAP)throw"target must be TEXTURE_CUBE_MAP";o(a,c,d),d=b.shallowCopy(d);var q,r=6,s=[],t=k(a,d);q=i.map(function(a,b){return n(a,d.crossOrigin,h(t[b]))})}function r(a){switch(a){case C:case F:return 1;case G:return 2;case D:return 3;case E:return 4;default:throw"unknown type: "+a}}function s(b,c){return B(c)?a.getGLTypeForTypedArray(c):b.UNSIGNED_BYTE}function t(a,b,c,d,e){if(e%1!==0)throw"can't guess dimensions";if(c||d){if(d){if(!c&&(c=e/d,c%1))throw"can't guess dimensions"}else if(d=e/c,d%1)throw"can't guess dimensions"}else{var f=Math.sqrt(e/(b===a.TEXTURE_CUBE_MAP?6:1));f%1===0?(c=f,d=f):(c=e,d=1)}return{width:c,height:d}}function u(b,c,d,g){g=g||A.textureOptions;var h=g.target||b.TEXTURE_2D;b.bindTexture(h,c);var i=g.width,j=g.height,k=g.depth,m=g.format||b.RGBA,n=g.internalFormat||m,o=g.type||s(b,d),p=r(m),q=d.length/p;if(q%1)throw"length wrong size for format: "+H(b,m);var u;if(h===b.TEXTURE_3D)if(i||j||k)!i||j&&k?!j||i&&k?(u=t(b,h,i,j,q/k),i=u.width,j=u.height):(u=t(b,h,i,k,q/j),i=u.width,k=u.height):(u=t(b,h,j,k,q/i),j=u.width,k=u.height);else{var v=Math.cbrt(q);if(v%1!==0)throw"can't guess cube size of array of numElements: "+q;i=v,j=v,k=v}else u=t(b,h,i,j,q),i=u.width,j=u.height;if(B(d))d instanceof Uint8ClampedArray&&(d=new Uint8Array(d.buffer));else{var w=a.getTypedArrayTypeForGLType(o);d=new w(d)}if(b.pixelStorei(b.UNPACK_ALIGNMENT,g.unpackAlignment||1),e(b,g),h===b.TEXTURE_CUBE_MAP){var x=q/6*p;l(b,g).forEach(function(a){var c=x*a.ndx,e=d.subarray(c,c+x);b.texImage2D(a.face,0,n,i,j,0,m,o,e)})}else h===b.TEXTURE_3D?b.texImage3D(h,0,n,i,j,k,0,m,o,d):b.texImage2D(h,0,n,i,j,0,m,o,d);return f(b,g),{width:i,height:j,depth:k}}function v(a,b,c){var d=c.target||a.TEXTURE_2D;a.bindTexture(d,b);var g=c.format||a.RGBA,h=c.internalFormat||g,i=c.type||a.UNSIGNED_BYTE;if(e(a,c),d===a.TEXTURE_CUBE_MAP)for(var j=0;j<6;++j)a.texImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+j,0,h,c.width,c.height,0,g,i,null);else d===a.TEXTURE_3D?a.texImage3D(d,0,h,c.width,c.height,c.depth,0,g,i,null):a.texImage2D(d,0,h,c.width,c.height,0,g,i,null);f(a,c)}function w(a,b,c){c=c||m,b=b||A.textureOptions;var d=a.createTexture(),e=b.target||a.TEXTURE_2D,f=b.width||1,h=b.height||1;a.bindTexture(e,d),e===a.TEXTURE_CUBE_MAP&&(a.texParameteri(e,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(e,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE));var i=b.src;if(i)if("function"==typeof i&&(i=i(a,b)),"string"==typeof i)p(a,d,b,c);else if(B(i)||Array.isArray(i)&&("number"==typeof i[0]||Array.isArray(i[0])||B(i[0]))){var k=u(a,d,i,b);f=k.width,h=k.height}else if(Array.isArray(i)&&"string"==typeof i[0])q(a,d,b,c);else{if(!(i instanceof HTMLElement))throw"unsupported src type";J(a,d,i,b),f=i.width,h=i.height}else v(a,d,b);return b.auto!==!1&&j(a,d,b,f,h),g(a,d,b),d}function x(a,b,c,d,e){d=d||c.width,e=e||c.height;var f=c.target||a.TEXTURE_2D;a.bindTexture(f,b);var g,h=c.format||a.RGBA,i=c.src;if(g=i&&(B(i)||Array.isArray(i)&&"number"==typeof i[0])?c.type||s(a,i):c.type||a.UNSIGNED_BYTE,f===a.TEXTURE_CUBE_MAP)for(var j=0;j<6;++j)a.texImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+j,0,h,d,e,0,h,g,null);else a.texImage2D(f,0,h,d,e,0,h,g,null)}function y(a){return"string"==typeof a||Array.isArray(a)&&"string"==typeof a[0]}function z(a,b,c){function d(){0===e&&setTimeout(function(){c(f.length?f:void 0,g,h)},0)}c=c||m;var e=0,f=[],g={},h={};return Object.keys(b).forEach(function(c){var i,j=b[c];y(j.src)&&(i=function(a,b,g){h[c]=g,--e,a&&f.push(a),d()},++e),g[c]=w(a,j,i)}),d(),g}var A={textureColor:new Uint8Array([128,192,255,255]),textureOptions:{},crossOrigin:void 0},B=a.isArrayBuffer,C=6406,D=6407,E=6408,F=6409,G=6410,H=function(){function a(a){b||(b={},Object.keys(a).forEach(function(c){"number"==typeof a[c]&&(b[a[c]]=c)}))}var b;return function(c,d){return a(),b[d]||"0x"+d.toString(16)}}(),I={},J=function(){var a=document.createElement("canvas").getContext("2d");return function(b,c,d,h){h=h||A.textureOptions;var i=h.target||b.TEXTURE_2D,k=d.width,m=d.height,n=h.format||b.RGBA,o=h.internalFormat||n,p=h.type||b.UNSIGNED_BYTE;if(e(b,h),b.bindTexture(i,c),i===b.TEXTURE_CUBE_MAP){var q,r,s=d.width,t=d.height;if(s/6===t)q=t,r=[0,0,1,0,2,0,3,0,4,0,5,0];else if(t/6===s)q=s,r=[0,0,0,1,0,2,0,3,0,4,0,5];else if(s/3===t/2)q=s/3,r=[0,0,1,0,2,0,0,1,1,1,2,1];else{if(s/2!==t/3)throw"can't figure out cube map from element: "+(d.src?d.src:d.nodeName);q=s/2,r=[0,0,1,0,0,1,1,1,0,2,1,2]}a.canvas.width=q,a.canvas.height=q,k=q,m=q,l(b,h).forEach(function(c){var e=r[2*c.ndx+0]*q,f=r[2*c.ndx+1]*q;a.drawImage(d,e,f,q,q,0,0,q,q),b.texImage2D(c.face,0,o,n,p,a.canvas)}),a.canvas.width=1,a.canvas.height=1}else if(i===b.TEXTURE_3D){var u=Math.min(d.width,d.height),v=Math.max(d.width,d.height),w=v/u;if(w%1!==0)throw"can not compute 3D dimensions of element";var x=d.width===v?1:0,y=d.height===v?1:0;b.texImage3D(i,0,o,u,u,u,0,n,p,null),a.canvas.width=u,a.canvas.height=u;for(var z=0;z<w;++z){var B=z*u*x,C=z*u*y,D=u,E=u,F=0,G=0,H=u,I=u;a.drawImage(d,B,C,D,E,F,G,H,I),b.texSubImage3D(i,0,0,0,z,n,p,a.canvas)}a.canvas.width=0,a.canvas.height=0}else b.texImage2D(i,0,o,n,p,d);f(b,h),h.auto!==!1&&j(b,c,h,k,m),g(b,c,h)}}();return{setDefaults_:d,createTexture:w,setEmptyTexture:v,setTextureFromArray:u,loadTextureFromUrl:p,setTextureFromElement:J,setTextureFilteringForSize:j,setTextureParameters:g,setDefaultTextureColor:c,createTextures:z,resizeTexture:x,getNumComponentsForFormat:r}}),c("twgl/framebuffers",["./textures","./utils"],function(a,b){function c(a){return y[a]}function d(a){return z[a]}function e(e,f,g,h){var i=e.FRAMEBUFFER,j=e.createFramebuffer();e.bindFramebuffer(i,j),g=g||e.drawingBufferWidth,h=h||e.drawingBufferHeight,f=f||x;var k=0,l={framebuffer:j,attachments:[],width:g,height:h};return f.forEach(function(f){var j=f.attachment,m=f.format,n=c(m);if(n||(n=r+k++),!j)if(d(m))j=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,j),e.renderbufferStorage(e.RENDERBUFFER,m,g,h);else{var o=b.shallowCopy(f);o.width=g,o.height=h,void 0===o.auto&&(o.auto=!1,o.min=o.min||e.LINEAR,o.mag=o.mag||e.LINEAR,o.wrapS=o.wrapS||o.wrap||e.CLAMP_TO_EDGE,o.wrapT=o.wrapT||o.wrap||e.CLAMP_TO_EDGE),j=a.createTexture(e,o)}if(j instanceof WebGLRenderbuffer)e.framebufferRenderbuffer(i,n,e.RENDERBUFFER,j);else{if(!(j instanceof WebGLTexture))throw"unknown attachment type";e.framebufferTexture2D(i,n,f.texTarget||e.TEXTURE_2D,j,f.level||0)}l.attachments.push(j)}),l}function f(b,c,d,e,f){e=e||b.drawingBufferWidth,f=f||b.drawingBufferHeight,c.width=e,c.height=f,d=d||x,d.forEach(function(d,g){var h=c.attachments[g],i=d.format;if(h instanceof WebGLRenderbuffer)b.bindRenderbuffer(b.RENDERBUFFER,h),b.renderbufferStorage(b.RENDERBUFFER,i,e,f);else{if(!(h instanceof WebGLTexture))throw"unknown attachment type";a.resizeTexture(b,h,d,e,f)}})}function g(a,b,c){c=c||a.FRAMEBUFFER,b?(a.bindFramebuffer(c,b.framebuffer),a.viewport(0,0,b.width,b.height)):(a.bindFramebuffer(c,null),a.viewport(0,0,a.drawingBufferWidth,a.drawingBufferHeight))}var h=5121,i=6402,j=6408,k=32854,l=32855,m=36194,n=33189,o=6401,p=36168,q=34041,r=36064,s=36096,t=36128,u=33306,v=33071,w=9729,x=[{format:j,type:h,min:w,wrap:v},{format:q}],y={};y[q]=u,y[o]=t,y[p]=t,y[i]=s,y[n]=s;var z={};return z[k]=!0,z[l]=!0,z[m]=!0,z[q]=!0,z[n]=!0,z[o]=!0,z[p]=!0,{bindFramebufferInfo:g,createFramebufferInfo:e,resizeFramebufferInfo:f}}),c("twgl/twgl",["./attributes","./draw","./framebuffers","./programs","./textures","./typedarrays","./utils"],function(a,b,c,d,e,f,g){function h(b){g.copyExistingProperties(b,q),a.setDefaults_(b),e.setDefaults_(b)}function i(a){if(a&&q.enableVertexArrayObjects&&g.isWebGL1(a)){var b=a.getExtension("OES_vertex_array_object");b&&(a.createVertexArray=function(){return b.createVertexArrayOES()},a.deleteVertexArray=function(a){b.deleteVertexArrayOES(a)},a.isVertexArray=function(a){return b.isVertexArrayOES(a)},a.bindVertexArray=function(a){b.bindVertexArrayOES(a)},a.VERTEX_ARRAY_BINDING=b.VERTEX_ARRAY_BINDING_OES)}}function j(a,b){for(var c=["webgl","experimental-webgl"],d=null,e=0;e<c.length;++e){try{d=a.getContext(c[e],b)}catch(f){}if(d)break}return d}function k(a,b){var c=j(a,b);return i(c),c}function l(a,b){for(var c=["webgl2","experimental-webgl2","webgl","experimental-webgl"],d=null,e=0;e<c.length;++e){try{d=a.getContext(c[e],b)}catch(f){}if(d)break}return d}function m(a,b){var c=l(a,b);return i(c),c}function n(a,b){b=b||1,b=Math.max(1,b);var c=a.clientWidth*b|0,d=a.clientHeight*b|0;return(a.width!==c||a.height!==d)&&(a.width=c,a.height=d,!0)}function o(a){return"_"!==a[a.length-1]}function p(a,b){return Object.keys(a).filter(o).forEach(function(c){b[c]=a[c]}),b}var q={enableVertexArrayObjects:!0},r={getContext:m,getWebGLContext:k,isWebGL1:g.isWebGL1,isWebGL2:g.isWebGL2,resizeCanvasToDisplaySize:n,setDefaults:h},s={attributes:a,draw:b,framebuffers:c,programs:d,textures:e,typedArrays:f};return Object.keys(s).forEach(function(a){var b=s[a];p(b,r),r[a]=p(b,{})}),r}),c("main",["twgl/twgl"],function(a){return a}),b(["main"],function(a){return a},void 0,!0),c("build/js/twgl-includer",function(){}),b("main")});
