This repository was archived by the owner on Nov 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathvgl.min.js
5 lines (5 loc) · 108 KB
/
vgl.min.js
1
2
3
4
5
!function(a,b){"function"==typeof define&&define.amd?define("vgl",[],function(){return a.vgl=b()}):"object"==typeof module&&module.exports?module.exports=b():a.vgl=b()}(this,function(){if("undefined"==typeof a)var a={};a.namespace=function(b){"use strict";var c,d=b.split("."),e=a;for("ogs"===d[0]&&(d=d.slice(1)),c=0;c<d.length;c+=1)"undefined"==typeof e[d[c]]&&(e[d[c]]={}),e=e[d[c]];return e};var b=a.namespace("gl");window.vgl=b,b.inherit=function(a,b){"use strict";var c=inherit.func();c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a},b.inherit.func=function(){"use strict";return function(){}},window.inherit=b.inherit,Object.size=function(a){"use strict";var b,c=0;for(b in a)a.hasOwnProperty(b)&&(c+=1);return c},Math.log2||(Math.log2=function(a){return Math.log(a)/Math.log(2)}),b.version="0.3.11",b.GL={ACTIVE_ATTRIBUTES:35721,ACTIVE_TEXTURE:34016,ACTIVE_UNIFORMS:35718,ALIASED_LINE_WIDTH_RANGE:33902,ALIASED_POINT_SIZE_RANGE:33901,ALPHA:6406,ALPHA_BITS:3413,ALWAYS:519,ARRAY_BUFFER:34962,ARRAY_BUFFER_BINDING:34964,ATTACHED_SHADERS:35717,BACK:1029,BLEND:3042,BLEND_COLOR:32773,BLEND_DST_ALPHA:32970,BLEND_DST_RGB:32968,BLEND_EQUATION:32777,BLEND_EQUATION_ALPHA:34877,BLEND_EQUATION_RGB:32777,BLEND_SRC_ALPHA:32971,BLEND_SRC_RGB:32969,BLUE_BITS:3412,BOOL:35670,BOOL_VEC2:35671,BOOL_VEC3:35672,BOOL_VEC4:35673,BROWSER_DEFAULT_WEBGL:37444,BUFFER_SIZE:34660,BUFFER_USAGE:34661,BYTE:5120,CCW:2305,CLAMP_TO_EDGE:33071,COLOR_ATTACHMENT0:36064,COLOR_BUFFER_BIT:16384,COLOR_CLEAR_VALUE:3106,COLOR_WRITEMASK:3107,COMPILE_STATUS:35713,COMPRESSED_TEXTURE_FORMATS:34467,CONSTANT_ALPHA:32771,CONSTANT_COLOR:32769,CONTEXT_LOST_WEBGL:37442,CULL_FACE:2884,CULL_FACE_MODE:2885,CURRENT_PROGRAM:35725,CURRENT_VERTEX_ATTRIB:34342,CW:2304,DECR:7683,DECR_WRAP:34056,DELETE_STATUS:35712,DEPTH_ATTACHMENT:36096,DEPTH_BITS:3414,DEPTH_BUFFER_BIT:256,DEPTH_CLEAR_VALUE:2931,DEPTH_COMPONENT:6402,DEPTH_COMPONENT16:33189,DEPTH_FUNC:2932,DEPTH_RANGE:2928,DEPTH_STENCIL:34041,DEPTH_STENCIL_ATTACHMENT:33306,DEPTH_TEST:2929,DEPTH_WRITEMASK:2930,DITHER:3024,DONT_CARE:4352,DST_ALPHA:772,DST_COLOR:774,DYNAMIC_DRAW:35048,ELEMENT_ARRAY_BUFFER:34963,ELEMENT_ARRAY_BUFFER_BINDING:34965,EQUAL:514,FASTEST:4353,FLOAT:5126,FLOAT_MAT2:35674,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,FRAGMENT_SHADER:35632,FRAMEBUFFER:36160,FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:36049,FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:36048,FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:36051,FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:36050,FRAMEBUFFER_BINDING:36006,FRAMEBUFFER_COMPLETE:36053,FRAMEBUFFER_INCOMPLETE_ATTACHMENT:36054,FRAMEBUFFER_INCOMPLETE_DIMENSIONS:36057,FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:36055,FRAMEBUFFER_UNSUPPORTED:36061,FRONT:1028,FRONT_AND_BACK:1032,FRONT_FACE:2886,FUNC_ADD:32774,FUNC_REVERSE_SUBTRACT:32779,FUNC_SUBTRACT:32778,GENERATE_MIPMAP_HINT:33170,GEQUAL:518,GREATER:516,GREEN_BITS:3411,HIGH_FLOAT:36338,HIGH_INT:36341,INCR:7682,INCR_WRAP:34055,INT:5124,INT_VEC2:35667,INT_VEC3:35668,INT_VEC4:35669,INVALID_ENUM:1280,INVALID_FRAMEBUFFER_OPERATION:1286,INVALID_OPERATION:1282,INVALID_VALUE:1281,INVERT:5386,KEEP:7680,LEQUAL:515,LESS:513,LINEAR:9729,LINEAR_MIPMAP_LINEAR:9987,LINEAR_MIPMAP_NEAREST:9985,LINES:1,LINE_LOOP:2,LINE_STRIP:3,LINE_WIDTH:2849,LINK_STATUS:35714,LOW_FLOAT:36336,LOW_INT:36339,LUMINANCE:6409,LUMINANCE_ALPHA:6410,MAX_COMBINED_TEXTURE_IMAGE_UNITS:35661,MAX_CUBE_MAP_TEXTURE_SIZE:34076,MAX_FRAGMENT_UNIFORM_VECTORS:36349,MAX_RENDERBUFFER_SIZE:34024,MAX_TEXTURE_IMAGE_UNITS:34930,MAX_TEXTURE_SIZE:3379,MAX_VARYING_VECTORS:36348,MAX_VERTEX_ATTRIBS:34921,MAX_VERTEX_TEXTURE_IMAGE_UNITS:35660,MAX_VERTEX_UNIFORM_VECTORS:36347,MAX_VIEWPORT_DIMS:3386,MEDIUM_FLOAT:36337,MEDIUM_INT:36340,MIRRORED_REPEAT:33648,NEAREST:9728,NEAREST_MIPMAP_LINEAR:9986,NEAREST_MIPMAP_NEAREST:9984,NEVER:512,NICEST:4354,NONE:0,NOTEQUAL:517,NO_ERROR:0,ONE:1,ONE_MINUS_CONSTANT_ALPHA:32772,ONE_MINUS_CONSTANT_COLOR:32770,ONE_MINUS_DST_ALPHA:773,ONE_MINUS_DST_COLOR:775,ONE_MINUS_SRC_ALPHA:771,ONE_MINUS_SRC_COLOR:769,OUT_OF_MEMORY:1285,PACK_ALIGNMENT:3333,POINTS:0,POLYGON_OFFSET_FACTOR:32824,POLYGON_OFFSET_FILL:32823,POLYGON_OFFSET_UNITS:10752,RED_BITS:3410,RENDERBUFFER:36161,RENDERBUFFER_ALPHA_SIZE:36179,RENDERBUFFER_BINDING:36007,RENDERBUFFER_BLUE_SIZE:36178,RENDERBUFFER_DEPTH_SIZE:36180,RENDERBUFFER_GREEN_SIZE:36177,RENDERBUFFER_HEIGHT:36163,RENDERBUFFER_INTERNAL_FORMAT:36164,RENDERBUFFER_RED_SIZE:36176,RENDERBUFFER_STENCIL_SIZE:36181,RENDERBUFFER_WIDTH:36162,RENDERER:7937,REPEAT:10497,REPLACE:7681,RGB:6407,RGB565:36194,RGB5_A1:32855,RGBA:6408,RGBA4:32854,SAMPLER_2D:35678,SAMPLER_CUBE:35680,SAMPLES:32937,SAMPLE_ALPHA_TO_COVERAGE:32926,SAMPLE_BUFFERS:32936,SAMPLE_COVERAGE:32928,SAMPLE_COVERAGE_INVERT:32939,SAMPLE_COVERAGE_VALUE:32938,SCISSOR_BOX:3088,SCISSOR_TEST:3089,SHADER_TYPE:35663,SHADING_LANGUAGE_VERSION:35724,SHORT:5122,SRC_ALPHA:770,SRC_ALPHA_SATURATE:776,SRC_COLOR:768,STATIC_DRAW:35044,STENCIL_ATTACHMENT:36128,STENCIL_BACK_FAIL:34817,STENCIL_BACK_FUNC:34816,STENCIL_BACK_PASS_DEPTH_FAIL:34818,STENCIL_BACK_PASS_DEPTH_PASS:34819,STENCIL_BACK_REF:36003,STENCIL_BACK_VALUE_MASK:36004,STENCIL_BACK_WRITEMASK:36005,STENCIL_BITS:3415,STENCIL_BUFFER_BIT:1024,STENCIL_CLEAR_VALUE:2961,STENCIL_FAIL:2964,STENCIL_FUNC:2962,STENCIL_INDEX:6401,STENCIL_INDEX8:36168,STENCIL_PASS_DEPTH_FAIL:2965,STENCIL_PASS_DEPTH_PASS:2966,STENCIL_REF:2967,STENCIL_TEST:2960,STENCIL_VALUE_MASK:2963,STENCIL_WRITEMASK:2968,STREAM_DRAW:35040,SUBPIXEL_BITS:3408,TEXTURE:5890,TEXTURE0:33984,TEXTURE1:33985,TEXTURE10:33994,TEXTURE11:33995,TEXTURE12:33996,TEXTURE13:33997,TEXTURE14:33998,TEXTURE15:33999,TEXTURE16:34e3,TEXTURE17:34001,TEXTURE18:34002,TEXTURE19:34003,TEXTURE2:33986,TEXTURE20:34004,TEXTURE21:34005,TEXTURE22:34006,TEXTURE23:34007,TEXTURE24:34008,TEXTURE25:34009,TEXTURE26:34010,TEXTURE27:34011,TEXTURE28:34012,TEXTURE29:34013,TEXTURE3:33987,TEXTURE30:34014,TEXTURE31:34015,TEXTURE4:33988,TEXTURE5:33989,TEXTURE6:33990,TEXTURE7:33991,TEXTURE8:33992,TEXTURE9:33993,TEXTURE_2D:3553,TEXTURE_BINDING_2D:32873,TEXTURE_BINDING_CUBE_MAP:34068,TEXTURE_CUBE_MAP:34067,TEXTURE_CUBE_MAP_NEGATIVE_X:34070,TEXTURE_CUBE_MAP_NEGATIVE_Y:34072,TEXTURE_CUBE_MAP_NEGATIVE_Z:34074,TEXTURE_CUBE_MAP_POSITIVE_X:34069,TEXTURE_CUBE_MAP_POSITIVE_Y:34071,TEXTURE_CUBE_MAP_POSITIVE_Z:34073,TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,TRIANGLES:4,TRIANGLE_FAN:6,TRIANGLE_STRIP:5,UNPACK_ALIGNMENT:3317,UNPACK_COLORSPACE_CONVERSION_WEBGL:37443,UNPACK_FLIP_Y_WEBGL:37440,UNPACK_PREMULTIPLY_ALPHA_WEBGL:37441,UNSIGNED_BYTE:5121,UNSIGNED_INT:5125,UNSIGNED_SHORT:5123,UNSIGNED_SHORT_4_4_4_4:32819,UNSIGNED_SHORT_5_5_5_1:32820,UNSIGNED_SHORT_5_6_5:33635,VALIDATE_STATUS:35715,VENDOR:7936,VERSION:7938,VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:34975,VERTEX_ATTRIB_ARRAY_ENABLED:34338,VERTEX_ATTRIB_ARRAY_NORMALIZED:34922,VERTEX_ATTRIB_ARRAY_POINTER:34373,VERTEX_ATTRIB_ARRAY_SIZE:34339,VERTEX_ATTRIB_ARRAY_STRIDE:34340,VERTEX_ATTRIB_ARRAY_TYPE:34341,VERTEX_SHADER:35633,VIEWPORT:2978,ZERO:0};var c=0;b.timestamp=function(){"use strict";if(!(this instanceof b.timestamp))return new b.timestamp;var a=0;this.modified=function(){c+=1,a=c},this.getMTime=function(){return a}},b.object=function(){"use strict";if(!(this instanceof b.object))return new b.object;var a=b.timestamp();return a.modified(),this.modified=function(){a.modified()},this.getMTime=function(){return a.getMTime()},this},b.event=function(){"use strict";return this instanceof b.event?(b.object.call(this),this):new b.event},inherit(b.event,b.object),b.event.keyPress="vgl.event.keyPress",b.event.mousePress="vgl.event.mousePress",b.event.mouseRelease="vgl.event.mouseRelease",b.event.contextMenu="vgl.event.contextMenu",b.event.configure="vgl.event.configure",b.event.enable="vgl.event.enable",b.event.mouseWheel="vgl.event.mouseWheel",b.event.keyRelease="vgl.event.keyRelease",b.event.middleButtonPress="vgl.event.middleButtonPress",b.event.startInteraction="vgl.event.startInteraction",b.event.enter="vgl.event.enter",b.event.rightButtonPress="vgl.event.rightButtonPress",b.event.middleButtonRelease="vgl.event.middleButtonRelease",b.event["char"]="vgl.event.char",b.event.disable="vgl.event.disable",b.event.endInteraction="vgl.event.endInteraction",b.event.mouseMove="vgl.event.mouseMove",b.event.mouseOut="vgl.event.mouseOut",b.event.expose="vgl.event.expose",b.event.timer="vgl.event.timer",b.event.leftButtonPress="vgl.event.leftButtonPress",b.event.leave="vgl.event.leave",b.event.rightButtonRelease="vgl.event.rightButtonRelease",b.event.leftButtonRelease="vgl.event.leftButtonRelease",b.event.click="vgl.event.click",b.event.dblClick="vgl.event.dblClick",b.boundingObject=function(){"use strict";if(!(this instanceof b.boundingObject))return new b.boundingObject;b.object.call(this);var a=[0,0,0,0,0,0],c=b.timestamp(),d=b.timestamp();return c.modified(),d.modified(),this.bounds=function(){return a},this.hasValidBounds=function(a){return a[0]===Number.MAX_VALUE||a[1]===-Number.MAX_VALUE||a[2]===Number.MAX_VALUE||a[3]===-Number.MAX_VALUE||a[4]===Number.MAX_VALUE||a[5]===-Number.MAX_VALUE?!1:!0},this.setBounds=function(b,d,e,f,g,h){return this.hasValidBounds([b,d,e,f,g,h])?(a[0]=b,a[1]=d,a[2]=e,a[3]=f,a[4]=g,a[5]=h,this.modified(),c.modified(),!0):void 0},this.resetBounds=function(){a[0]=Number.MAX_VALUE,a[1]=-Number.MAX_VALUE,a[2]=Number.MAX_VALUE,a[3]=-Number.MAX_VALUE,a[4]=Number.MAX_VALUE,a[5]=-Number.MAX_VALUE,this.modified()},this.computeBounds=function(){},this.computeBoundsTimestamp=function(){return c},this.boundsDirtyTimestamp=function(){return d},this.resetBounds(),this},b.boundingObject.ReferenceFrame={Relative:0,Absolute:1},inherit(b.boundingObject,b.object),b.node=function(){"use strict";if(!(this instanceof b.node))return new b.node;b.boundingObject.call(this);var a=null,c=null,d=!0,e=!1;return this.accept=function(a){a.visit(this)},this.material=function(){return c},this.setMaterial=function(a){return a!==c?(c=a,this.modified(),!0):!1},this.visible=function(){return d},this.setVisible=function(a){return a!==d?(d=a,this.modified(),!0):!1},this.parent=function(){return a},this.setParent=function(b){return b!==a?(null!==a&&a.removeChild(this),a=b,this.modified(),!0):!1},this.overlay=function(){return e},this.setOverlay=function(a){return e!==a?(e=a,this.modified(),!0):!1},this.ascend=function(a){a=a},this.traverse=function(a){a=a},this.boundsModified=function(){this.boundsDirtyTimestamp().modified(),null!==a&&a.boundsModified()},this},inherit(b.node,b.boundingObject),b.groupNode=function(){"use strict";if(!(this instanceof b.groupNode))return new b.groupNode;b.node.call(this);var a=[];return this.b_setVisible=this.setVisible,this.setVisible=function(b){var c;if(this.b_setVisible(b)!==!0)return!1;for(c=0;c<a.length;c+=1)a[c].setVisible(b);return!0},this.addChild=function(c){return c instanceof b.node&&-1===a.indexOf(c)?(c.setParent(this),a.push(c),this.boundsDirtyTimestamp().modified(),!0):!1},this.removeChild=function(b){if(b.parent()===this){var c=a.indexOf(b);if(c>=0)return a.splice(c,1),b.setParent(null),this.boundsDirtyTimestamp().modified(),!0}},this.removeChildren=function(){for(;a.length;)this.removeChild(a[0]);this.modified()},this.children=function(){return a},this.hasChild=function(b){var c=0,d=!1;for(c=0;c<a.length;c+=1)if(a[c]===b){d=!0;break}return d},this.accept=function(a){a.visit(this)},this.traverse=function(a){switch(a.type()){case a.UpdateVisitor:this.traverseChildrenAndUpdateBounds(a);break;case a.CullVisitor:this.traverseChildren(a)}},this.traverseChildrenAndUpdateBounds=function(b){var c;if(this.parent()&&this.boundsDirtyTimestamp().getMTime()>this.computeBoundsTimestamp().getMTime()&&this.parent().boundsDirtyTimestamp().modified(),this.computeBounds(),b.mode()===b.TraverseAllChildren)for(c=0;c<a.length;c+=1)a[c].accept(b),this.updateBounds(a[c]);this.computeBoundsTimestamp().modified()},this.traverseChildren=function(b){var c;if(b.mode()===b.TraverseAllChildren)for(c=0;c<a.length;c+=1)a[c].accept(b)},this.computeBounds=function(){var b=0;if(!(this.computeBoundsTimestamp().getMTime()>this.boundsDirtyTimestamp().getMTime()))for(b=0;b<a.length;b+=1)this.updateBounds(a[b])},this.updateBounds=function(a){if(!a.overlay()){a.computeBounds();var b,c=this.bounds(),d=a.bounds(),e=0,f=0;for(b=0;3>b;b+=1)e=2*b,f=2*b+1,d[e]<c[e]&&(c[e]=d[e]),d[f]>c[f]&&(c[f]=d[f]);this.setBounds(c[0],c[1],c[2],c[3],c[4],c[5])}},this},inherit(b.groupNode,b.node),b.actor=function(){"use strict";if(!(this instanceof b.actor))return new b.actor;b.node.call(this);var a=this,c=mat4.create(),d=b.boundingObject.ReferenceFrame.Relative,e=null;return this.matrix=function(){return c},this.setMatrix=function(b){b!==c&&(c=b,a.modified())},this.referenceFrame=function(){return d},this.setReferenceFrame=function(b){return b!==d?(d=b,a.modified(),!0):!1},this.mapper=function(){return e},this.setMapper=function(b){b!==e&&(e=b,a.boundsModified())},this.accept=function(a){a=a},this.ascend=function(a){a=a},this.computeLocalToWorldMatrix=function(a,b){a=a,b=b},this.computeWorldToLocalMatrix=function(a,b){a=a,b=b},this.computeBounds=function(){if(null===e||void 0===e)return void a.resetBounds();var b,d,f,g,h=a.computeBoundsTimestamp();(a.boundsDirtyTimestamp().getMTime()>h.getMTime()||e.boundsDirtyTimestamp().getMTime()>h.getMTime())&&(e.computeBounds(),b=e.bounds(),d=[b[0],b[2],b[4]],f=[b[1],b[3],b[5]],vec3.transformMat4(d,d,c),vec3.transformMat4(f,f,c),g=[d[0]>f[0]?f[0]:d[0],d[0]>f[0]?d[0]:f[0],d[1]>f[1]?f[1]:d[1],d[1]>f[1]?d[1]:f[1],d[2]>f[2]?f[2]:d[2],d[2]>f[2]?d[2]:f[2]],a.setBounds(g[0],g[1],g[2],g[3],g[4],g[5]),h.modified())},a},inherit(b.actor,b.node),b.freezeObject=function(a){"use strict";var b=Object.freeze?Object.freeze(a):void 0;return"undefined"==typeof b?a:b},b.defaultValue=function(a,b){"use strict";return"undefined"!=typeof a?a:b},b.defaultValue.EMPTY_OBJECT=b.freezeObject({}),b.graphicsObject=function(a){"use strict";if(a=a,!(this instanceof b.graphicsObject))return new b.graphicsObject;b.object.call(this);var c=this;return this._setup=function(a){return a=a,!1},this._cleanup=function(a){return a=a,!1},this.bind=function(a){return a=a,!1},this.undoBind=function(a){return a=a,!1},this.render=function(a){return a=a,!1},this.remove=function(a){c._cleanup(a)},c},inherit(b.graphicsObject,b.object),b.geojsonReader=function(){"use strict";return this instanceof b.geojsonReader?(this.readScalars=function(a,c,d,e){var f=null,g=null,h=null,i=null,j=null;"values"===this.m_scalarFormat&&4===a.length?(g=a[3],f=c.sourceData(b.vertexAttributeKeys.Scalar),f||(f=new b.sourceDataSf,this.m_scalarRange&&f.setScalarRange(this.m_scalarRange[0],this.m_scalarRange[1]),void 0!==d&&(f.data().length=d),c.addSource(f)),void 0===d?f.pushBack(g):f.insertAt(e,g)):"rgb"===this.m_scalarFormat&&6===a.length&&(f=c.sourceData(b.vertexAttributeKeys.Color),f||(f=new b.sourceDataC3fv,void 0!==d&&(f.length=3*d),c.addSource(f)),h=a[3],i=a[4],j=a[5],void 0===d?f.pushBack([h,i,j]):f.insertAt(e,[h,i,j]))},this.readPoint=function(a){var c=new b.geometryData,d=new b.points,e=new b.sourceDataP3fv,f=new Uint16Array(1),g=null,h=null,i=null,j=null;for(c.addSource(e),j=0;1>j;j+=1)f[j]=j,g=a[0],h=a[1],i=0,a.length>2&&(i=a[2]),e.pushBack([g,h,i]),this.readScalars(a,c);return d.setIndices(f),c.addPrimitive(d),c.setName("aPoint"),c},this.readMultiPoint=function(a){var c,d=new b.geometryData,e=new b.points,f=new b.sourceDataP3fv,g=new Uint16Array(a.length),h=0,i=a.length,j=null,k=null,l=null;for(f.data().length=3*i,c=0;c<a.length;c+=1)g[c]=c,j=a[c][0],k=a[c][1],l=0,a[c].length>2&&(l=a[c][2]),f.insertAt(h,[j,k,l]),this.readScalars(a[c],d,i,h),h+=1;return e.setIndices(g),d.addPrimitive(e),d.addSource(f),d.setName("manyPoints"),d},this.readLineString=function(a){var c=new b.geometryData,d=new b.lineStrip,e=new b.sourceDataP3fv,f=[],g=null,h=null,i=null,j=null;for(d.setIndicesPerPrimitive(a.length),g=0;g<a.length;g+=1)f.push(g),h=a[g][0],i=a[g][1],j=0,a[g].length>2&&(j=a[g][2]),e.pushBack([h,i,j]),this.readScalars(a[g],c);return d.setIndices(f),c.addPrimitive(d),c.addSource(e),c.setName("aLineString"),c},this.readMultiLineString=function(a){var c=new b.geometryData,d=new b.sourceDataP3fv,e=0,f=2*a.length,g=null,h=null,i=null,j=null,k=null,l=null,m=null,n=null;for(d.data().length=3*f,h=0;h<a.length;h+=1){for(l=[],m=new b.lineStrip,n=a[h].length,m.setIndicesPerPrimitive(n),g=0;n>g;g+=1)l.push(e),i=a[h][g][0],j=a[h][g][1],k=0,a[h][g].length>2&&(k=a[h][g][2]),d.insertAt(e,[i,j,k]),this.readScalars(a[h][g],c,2*f,e),e+=1;m.setIndices(l),c.addPrimitive(m)}return c.setName("aMultiLineString"),c.addSource(d),c},this.readPolygon=function(a){var c=new b.geometryData,d=new b.sourceDataP3fv,e=null,f=null,g=null,h=a[0].length,i=1,j=null,k=null,l=null;for(j=0;h>j;j+=1)e=a[0][j][0],f=a[0][j][1],g=0,a[0][j].length>2&&(g=a[0][j][2]),d.pushBack([e,f,g]),this.readScalars(a[0][j],c),j>1&&(k=new Uint16Array([0,i,j]),l=new b.triangles,l.setIndices(k),c.addPrimitive(l),i=j);return c.setName("POLY"),c.addSource(d),c},this.readMultiPolygon=function(a){var c=new b.geometryData,d=new b.sourceDataP3fv,e=0,f=a.length,g=0,h=3*f,i=new b.triangles,j=[],k=null,l=null,m=null,n=null,o=null,p=null,q=null,r=null,s=null,t=!1,u=0;for(d.data().length=3*f,l=0;f>l;l+=1)for(p=a[l][0].length,q=e,r=e+1,s=[!1,!1,!1],k=0;p>k;k+=1)m=a[l][0][k][0],n=a[l][0][k][1],o=0,a[l][0][k].length>2&&(o=a[l][0][k][2]),t=!1,m>180&&(t=!0,m-=360),0===k?s[0]=t:s[1+(k-1)%2]=t,d.insertAt(g,[m,n,o]),this.readScalars(a[l][0][k],c,h,g),g+=1,k>1&&(s[0]===s[1]&&s[1]===s[2]&&(j[3*u+0]=q,j[3*u+1]=r,j[3*u+2]=e,u+=1),r=e),e+=1;return i.setIndices(j),c.addPrimitive(i),c.setName("aMultiPoly"),c.addSource(d),c},this.readGJObjectInt=function(a){if(!a.hasOwnProperty("type"))return null;a.properties&&a.properties.ScalarFormat&&"values"===a.properties.ScalarFormat&&(this.m_scalarFormat="values",a.properties.ScalarRange&&(this.m_scalarRange=a.properties.ScalarRange)),a.properties&&a.properties.ScalarFormat&&"rgb"===a.properties.ScalarFormat&&(this.m_scalarFormat="rgb");var b,c=a.type,d=null,e=null,f=null;switch(c){case"Point":b=this.readPoint(a.coordinates);break;case"MultiPoint":b=this.readMultiPoint(a.coordinates);break;case"LineString":b=this.readLineString(a.coordinates);break;case"MultiLineString":b=this.readMultiLineString(a.coordinates);break;case"Polygon":b=this.readPolygon(a.coordinates);break;case"MultiPolygon":b=this.readMultiPolygon(a.coordinates);break;case"GeometryCollection":for(e=[],f=0;f<a.geometries.length;f+=1)d=this.readGJObject(a.geometries[f]),e.push(d);b=e;break;case"Feature":d=this.readGJObject(a.geometry),b=d;break;case"FeatureCollection":for(e=[],f=0;f<a.features.length;f+=1)d=this.readGJObject(a.features[f]),e.push(d);b=e;break;default:console.log("Don't understand type "+c),b=null}return b},this.readGJObject=function(a){var b;return b=this.readGJObjectInt(a)},this.linearizeGeoms=function(a,b){var c=null;if("[object Array]"===Object.prototype.toString.call(b))for(c=0;c<b.length;c+=1)this.linearizeGeoms(a,b[c]);else a.push(b)},this.readGeomObject=function(a){var b,c=[];return b=this.readGJObject(a),this.linearizeGeoms(c,b),c},this.getPrimitives=function(a){if(!a)return[];var b=JSON.parse(a),c=this.readGJObject(b),d=[];return this.m_scalarFormat="none",this.m_scalarRange=null,this.linearizeGeoms(d,c),{geoms:d,scalarFormat:this.m_scalarFormat,scalarRange:this.m_scalarRange}},this):new b.geojsonReader},b.data=function(){"use strict";return this instanceof b.data?void(this.type=function(){}):new b.data},b.data.raster=0,b.data.point=1,b.data.lineString=2,b.data.polygon=3,b.data.geometry=10,b.primitive=function(){"use strict";if(!(this instanceof b.primitive))return new b.primitive;var a=0,c=0,d=0,e=null;return this.indices=function(){return e},this.createIndices=function(a){e=new Uint16Array},this.numberOfIndices=function(){return e.length},this.sizeInBytes=function(){return e.length*Uint16Array.BYTES_PER_ELEMENT},this.primitiveType=function(){return c},this.setPrimitiveType=function(a){c=a},this.indicesPerPrimitive=function(){return a},this.setIndicesPerPrimitive=function(b){a=b},this.indicesValueType=function(){return d},this.setIndicesValueType=function(a){d=a},this.setIndices=function(a){e=new Uint16Array(a)},this},b.triangleStrip=function(){"use strict";return this instanceof b.triangleStrip?(b.primitive.call(this),this.setPrimitiveType(b.GL.TRIANGLE_STRIP),this.setIndicesValueType(b.GL.UNSIGNED_SHORT),this.setIndicesPerPrimitive(3),this):new b.triangleStrip},inherit(b.triangleStrip,b.primitive),b.triangles=function(){"use strict";return this instanceof b.triangles?(b.primitive.call(this),this.setPrimitiveType(b.GL.TRIANGLES),this.setIndicesValueType(b.GL.UNSIGNED_SHORT),this.setIndicesPerPrimitive(3),this):new b.triangles},inherit(b.triangles,b.primitive),b.lines=function(){"use strict";return this instanceof b.lines?(b.primitive.call(this),this.setPrimitiveType(b.GL.LINES),this.setIndicesValueType(b.GL.UNSIGNED_SHORT),this.setIndicesPerPrimitive(2),this):new b.lines},inherit(b.lines,b.primitive),b.lineStrip=function(){"use strict";return this instanceof b.lineStrip?(b.primitive.call(this),this.setPrimitiveType(b.GL.LINE_STRIP),this.setIndicesValueType(b.GL.UNSIGNED_SHORT),this.setIndicesPerPrimitive(2),this):new b.lineStrip},inherit(b.lineStrip,b.primitive),b.points=function(){"use strict";return this instanceof b.points?(b.primitive.call(this),this.setPrimitiveType(b.GL.POINTS),this.setIndicesValueType(b.GL.UNSIGNED_SHORT),this.setIndicesPerPrimitive(1),this):new b.points},inherit(b.points,b.primitive),b.vertexDataP3f=function(){"use strict";return this instanceof b.vertexDataP3f?(this.m_position=[],this):new b.vertexDataP3f},b.vertexDataP3N3f=function(){"use strict";return this instanceof b.vertexDataP3N3f?(this.m_position=[],this.m_normal=[],this):new b.vertexDataP3N3f},b.vertexDataP3T3f=function(){"use strict";return this instanceof b.vertexDataP3T3f?(this.m_position=[],this.m_texCoordinate=[],this):new b.vertexDataP3T3f},b.sourceData=function(a){"use strict";if(!(this instanceof b.sourceData))return new b.sourceData(a);a=a||{};var c={},d=[],e=a.name||"Source "+(new Date).toISOString(),f=function(){this.m_numberOfComponents=0,this.m_dataType=0,this.m_dataTypeSize=0,this.m_normalized=!1,this.m_stride=0,this.m_offset=0};return this.data=function(){return d},this.getData=function(){return this.data()},this.dataToFloat32Array=function(){return d instanceof Float32Array||(d=new Float32Array(d)),d},this.setData=function(a){return a instanceof Array||a instanceof Float32Array?void(d=a instanceof Float32Array?a:a.slice(0)):void console.log("[error] Requires array")},this.addAttribute=function(a,b,d,e,g,h,i){if(!c.hasOwnProperty(a)){var j=new f;j.m_dataType=b,j.m_dataTypeSize=d,j.m_offset=e,j.m_stride=g,j.m_numberOfComponents=h,j.m_normalized=i,c[a]=j}},this.sizeOfArray=function(){return Object.size(d)},this.lengthOfArray=function(){return d.length},this.sizeInBytes=function(){var a,b=0,c=this.keys();for(a=0;a<c.length;a+=1)b+=this.attributeNumberOfComponents(c[a])*this.sizeOfAttributeDataType(c[a]);return b*=this.sizeOfArray()},this.hasKey=function(a){return c.hasOwnProperty(a)},this.keys=function(){return Object.keys(c)},this.numberOfAttributes=function(){return Object.size(c)},this.attributeNumberOfComponents=function(a){return c.hasOwnProperty(a)?c[a].m_numberOfComponents:0},this.normalized=function(a){return c.hasOwnProperty(a)?c[a].m_normalized:!1},this.sizeOfAttributeDataType=function(a){return c.hasOwnProperty(a)?c[a].m_dataTypeSize:0},this.attributeDataType=function(a){return c.hasOwnProperty(a)?c[a].m_dataType:void 0},this.attributeOffset=function(a){return c.hasOwnProperty(a)?c[a].m_offset:0},this.attributeStride=function(a){return c.hasOwnProperty(a)?c[a].m_stride:0},this.pushBack=function(a){},this.insert=function(a){var b;if(!d.length&&a.length&&a instanceof Float32Array)return void(d=a);if(d.slice||!d.length&&a.slice||(d=Array.prototype.slice.call(d)),a.length)if(!d.length&&a.slice)d=a.slice(0);else for(b=0;b<a.length;b+=1)d[d.length]=a[b];else d[d.length]=a},this.insertAt=function(a,b){var c;if(b.length)for(c=0;c<b.length;c+=1)d[a*b.length+c]=b[c];else d[a]=b},this.name=function(){return e},this.setName=function(a){e=a},this},b.sourceDataAnyfv=function(a,c,d){"use strict";return this instanceof b.sourceDataAnyfv?(b.sourceData.call(this,d),this.addAttribute(c,b.GL.FLOAT,4,0,4*a,a,!1),this.pushBack=function(a){this.insert(a)},this):new b.sourceDataAnyfv(a,c,d)},inherit(b.sourceDataAnyfv,b.sourceData),b.sourceDataP3T3f=function(a){"use strict";return this instanceof b.sourceDataP3T3f?(b.sourceData.call(this,a),this.addAttribute(b.vertexAttributeKeys.Position,b.GL.FLOAT,4,0,24,3,!1),this.addAttribute(b.vertexAttributeKeys.TextureCoordinate,b.GL.FLOAT,4,12,24,3,!1),this.pushBack=function(a){this.insert(a.m_position),this.insert(a.m_texCoordinate)},this):new b.sourceDataP3T3f(a)},inherit(b.sourceDataP3T3f,b.sourceData),b.sourceDataP3N3f=function(a){"use strict";return this instanceof b.sourceDataP3N3f?(b.sourceData.call(this,a),this.addAttribute(b.vertexAttributeKeys.Position,b.GL.FLOAT,4,0,24,3,!1),this.addAttribute(b.vertexAttributeKeys.Normal,b.GL.FLOAT,4,12,24,3,!1),this.pushBack=function(a){this.insert(a.m_position),this.insert(a.m_normal)},this):new b.sourceDataP3N3f(a)},inherit(b.sourceDataP3N3f,b.sourceData),b.sourceDataP3fv=function(a){"use strict";return this instanceof b.sourceDataP3fv?(b.sourceData.call(this,a),this.addAttribute(b.vertexAttributeKeys.Position,b.GL.FLOAT,4,0,12,3,!1),this.pushBack=function(a){this.insert(a)},this):new b.sourceDataP3fv(a)},inherit(b.sourceDataP3fv,b.sourceData),b.sourceDataT2fv=function(a){"use strict";return this instanceof b.sourceDataT2fv?(b.sourceData.call(this,a),this.addAttribute(b.vertexAttributeKeys.TextureCoordinate,b.GL.FLOAT,4,0,8,2,!1),this.pushBack=function(a){this.insert(a)},this):new b.sourceDataT2fv(a)},inherit(b.sourceDataT2fv,b.sourceData),b.sourceDataC3fv=function(a){"use strict";return this instanceof b.sourceDataC3fv?(b.sourceData.call(this,a),this.addAttribute(b.vertexAttributeKeys.Color,b.GL.FLOAT,4,0,12,3,!1),this.pushBack=function(a){this.insert(a)},this):new b.sourceDataC3fv(a)},inherit(b.sourceDataC3fv,b.sourceData),b.sourceDataSf=function(a){"use strict";if(!(this instanceof b.sourceDataSf))return new b.sourceDataSf(a);var c=null,d=null,e=null,f=null;return b.sourceData.call(this,a),this.addAttribute(b.vertexAttributeKeys.Scalar,b.GL.FLOAT,4,0,4,1,!1),this.pushBack=function(a){(null===d||a>d)&&(d=a),(null===c||c>a)&&(c=a),this.data()[this.data().length]=a},this.insertAt=function(a,b){(null===d||b>d)&&(d=b),(null===c||c>b)&&(c=b),this.data()[a]=b},this.scalarRange=function(){return null===e||null===f?[c,d]:[e,f]},this.setScalarRange=function(a,b){e=a,f=b},this},inherit(b.sourceDataSf,b.sourceData),b.sourceDataDf=function(a){"use strict";return this instanceof b.sourceDataDf?(b.sourceData.call(this,a),this.addAttribute(b.vertexAttributeKeys.Scalar,b.GL.FLOAT,4,0,4,1,!1),this.pushBack=function(a){this.data()[this.data().length]=a},this.insertAt=function(a,b){this.data()[a]=b},this):new b.sourceDataDf(a)},inherit(b.sourceDataDf,b.sourceData),b.geometryData=function(){"use strict";if(!(this instanceof b.geometryData))return new b.geometryData;b.data.call(this);var a="",c=[],d=[],e=[0,0,0,0,0,0],f=b.timestamp(),g=b.timestamp();return this.type=function(){return b.data.geometry},this.name=function(){return a},this.setName=function(b){a=b},this.addSource=function(a,c){return void 0!==c&&a.setName(c),-1===d.indexOf(a)?(d.push(a),a.hasKey(b.vertexAttributeKeys.Position)&&g.modified(),!0):!1},this.source=function(a){return a<d.length?d[a]:0},this.sourceByName=function(a){for(var b=0;b<d.length;b+=1)if(d[b].name()===a)return d[b];return 0},this.numberOfSources=function(){return d.length},this.sourceData=function(a){var b;for(b=0;b<d.length;b+=1)if(d[b].hasKey(a))return d[b];return null},this.addPrimitive=function(a){return c.push(a),!0},this.primitive=function(a){return a<c.length?c[a]:null},this.numberOfPrimitives=function(){return c.length},this.bounds=function(){return g.getMTime()>f.getMTime()&&this.computeBounds(),e},this.boundsDirty=function(a){return a&&g.modified(),g.getMTime()>f.getMTime()},this.resetBounds=function(){e[0]=0,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=0},this.setBounds=function(a,b,c,d,g,h){return e[0]=a,e[1]=b,e[2]=c,e[3]=d,e[4]=g,e[5]=h,f.modified(),!0},this.computeBounds=function(){if(g.getMTime()>f.getMTime()){var a,c,d,h,i,j,k=b.vertexAttributeKeys.Position,l=this.sourceData(k),m=l.data(),n=l.attributeNumberOfComponents(k),o=l.attributeStride(k),p=l.attributeOffset(k),q=l.sizeOfAttributeDataType(k),r=m.length,s=null;for(o/=q,p/=q,this.resetBounds(),a=0;n>a;a+=1){for(c=2*a,d=2*a+1,h=i=r?e[d]=m[p+a]:0,j=p+o+a;r>j;j+=o)s=m[j],s>h&&(h=s),i>s&&(i=s);e[c]=i,e[d]=h}f.modified()}},this.findClosestVertex=function(a){var c,d,e,f,g,h,i,j=b.vertexAttributeKeys.Position,k=this.sourceData(j),l=k.sizeOfAttributeDataType(j),m=k.attributeNumberOfComponents(j),n=k.data(),o=k.attributeStride(j)/l,p=k.attributeOffset(j)/l,q=Number.MAX_VALUE,r=null;for(3!==m&&console.log("[warning] Find closest vertex assumes threecomponent vertex "),a.z||(a={x:a.x,y:a.y,z:0}),c=p,i=0;c<n.length;c+=o,i+=1)d=[n[c],n[c+1],n[c+2]],e=d[0]-a.x,f=d[1]-a.y,g=d[2]-a.z,h=Math.sqrt(e*e+f*f+g*g),q>h&&(q=h,r=i);return r},this.getPosition=function(a){var c=b.vertexAttributeKeys.Position,d=this.sourceData(c),e=d.sizeOfAttributeDataType(c),f=d.attributeNumberOfComponents(c),g=d.data(),h=d.attributeStride(c)/e,i=d.attributeOffset(c)/e;return 3!==f&&console.log("[warning] getPosition assumes three component data"),[g[i+a*h],g[i+a*h+1],g[i+a*h+2]]},this.getScalar=function(a){var c,d,e,f,g=b.vertexAttributeKeys.Scalar,h=this.sourceData(g);return h?(c=h.sizeOfAttributeDataType(g),d=h.data(),e=h.attributeStride(g)/c,f=h.attributeOffset(g)/c,a*e+f>=d.length&&console.log("access out of bounds in getScalar"),d[a*e+f]):null},this},inherit(b.geometryData,b.data),b.mapper=function(a){"use strict";function c(a){if(g){a&&(l=a.m_context);var c,d,e,f,m,n,o,p=g.numberOfSources(),q=null;for(c=0;p>c;c+=1){for(q=l.createBuffer(),l.bindBuffer(b.GL.ARRAY_BUFFER,q),o=g.source(c).data(),o instanceof Float32Array||(o=new Float32Array(o)),l.bufferData(b.GL.ARRAY_BUFFER,o,j?b.GL.DYNAMIC_DRAW:b.GL.STATIC_DRAW),f=g.source(c).keys(),m=[],d=0;d<f.length;d+=1)m.push(f[d]);i[c]=m,h[c]=q}for(n=g.numberOfPrimitives(),e=0;n>e;e+=1)q=l.createBuffer(),l.bindBuffer(b.GL.ARRAY_BUFFER,q),l.bufferData(b.GL.ARRAY_BUFFER,g.primitive(e).indices(),b.GL.STATIC_DRAW),h[c]=q,c+=1;k.modified()}}function d(a){i={},h=[]}function e(a){m.deleteVertexBufferObjects(a),d(a),c(a)}if(!(this instanceof b.mapper))return new b.mapper(a);b.boundingObject.call(this),a=a||{};var f=[0,1,1],g=null,h=[],i={},j=void 0===a.dynamicDraw?!1:a.dynamicDraw,k=b.timestamp(),l=null,m=this;return this.deleteVertexBufferObjects=function(a){var b,c=l;if(a&&(c=a.m_context),c)for(b=0;b<h.length;b+=1)c.deleteBuffer(h[b])},this._cleanup=function(a){m.deleteVertexBufferObjects(a),d(a),m.modified()},this.computeBounds=function(){if(null===g||"undefined"==typeof g)return void this.resetBounds();var a=this.computeBoundsTimestamp(),b=this.boundsDirtyTimestamp(),c=null;b.getMTime()>a.getMTime()&&(c=g.bounds(),this.setBounds(c[0],c[1],c[2],c[3],c[4],c[5]),a.modified())},this.color=function(){return f},this.setColor=function(a,b,c){f[0]=a,f[1]=b,f[2]=c,this.modified()},this.geometryData=function(){return g},this.setGeometryData=function(a){g!==a&&(g=a,this.modified(),this.boundsDirtyTimestamp().modified())},this.updateSourceBuffer=function(a,c,d){if(d&&(l=d.m_context),!l)return!1;for(var e=-1,f=0;f<g.numberOfSources();f+=1)if(g.source(f).name()===a){e=f;break}return 0>e||e>=h.length?!1:(c||(c=g.source(f).dataToFloat32Array()),l.bindBuffer(b.GL.ARRAY_BUFFER,h[e]),c instanceof Float32Array?l.bufferSubData(b.GL.ARRAY_BUFFER,0,c):l.bufferSubData(b.GL.ARRAY_BUFFER,0,new Float32Array(c)),!0)},this.getSourceBuffer=function(a){
var b=g.sourceByName(a);return b?b.dataToFloat32Array():new Float32Array},this.render=function(a,c){(this.getMTime()>k.getMTime()||a.m_contextChanged)&&e(a),l=a.m_context,l.vertexAttrib3fv(b.vertexAttributeKeys.Color,this.color());var d,f=0,j=0,m=null,n=null;for(d in i)if(i.hasOwnProperty(d)){for(l.bindBuffer(b.GL.ARRAY_BUFFER,h[f]),j=0;j<i[d].length;j+=1)a.m_material.bindVertexData(a,i[d][j]);f+=1}for(m=g.numberOfPrimitives(),j=0;m>j;j+=1,f+=1)if(n=g.primitive(j),n.numberOfIndices()){switch(l.bindBuffer(b.GL.ARRAY_BUFFER,h[f]),n.primitiveType()){case b.GL.POINTS:l.drawArrays(b.GL.POINTS,0,n.numberOfIndices());break;case b.GL.LINES:l.drawArrays(b.GL.LINES,0,n.numberOfIndices());break;case b.GL.LINE_STRIP:l.drawArrays(b.GL.LINE_STRIP,0,n.numberOfIndices());break;case b.GL.TRIANGLES:l.drawArrays(b.GL.TRIANGLES,0,n.numberOfIndices());break;case b.GL.TRIANGLE_STRIP:l.drawArrays(b.GL.TRIANGLE_STRIP,0,n.numberOfIndices())}l.bindBuffer(b.GL.ARRAY_BUFFER,null)}c||this.undoBindVertexData(a)},this.undoBindVertexData=function(a){var b,c;for(b in i)if(i.hasOwnProperty(b))for(c=0;c<i[b].length;c+=1)a.m_material.undoBindVertexData(a,i[b][c])},this},inherit(b.mapper,b.boundingObject),b.groupMapper=function(){"use strict";if(!(this instanceof b.groupMapper))return new b.groupMapper;b.mapper.call(this);var a=b.timestamp(),c=[],d=[];return this.geometryData=function(a){return void 0!==a&&a<d.length?d[a]:d.length>0?d[0]:null},this.setGeometryData=function(a){(1!==d.length||d[0]!==a)&&(d=[],d.push(a),this.modified())},this.geometryDataArray=function(){return d},this.setGeometryDataArray=function(a){if(a instanceof Array){if(d!==a)return d=[],d=a,this.modified(),!0}else console.log("[error] Requies array of geometry data");return!1},this.computeBounds=function(){if(null===d||void 0===d)return void this.resetBounds();var a=this.computeBoundsTimestamp(),b=this.boundsDirtyTimestamp(),c=this.bounds(),e=null,f=null;if(b.getMTime()>a.getMTime()){for(f=0;f<d.length;f+=1)e=d[f].bounds(),c[0]>e[0]&&(c[0]=e[0]),c[1]<e[1]&&(c[1]=e[1]),c[2]>e[2]&&(c[2]=e[2]),c[3]<e[3]&&(c[3]=e[3]),c[4]>e[4]&&(c[4]=e[4]),c[5]<e[5]&&(c[5]=e[5]);this.modified(),a.modified()}},this.render=function(e){var f=null;if(this.getMTime()>a.getMTime()){for(f=0;f<d.length;f+=1)c.push(b.mapper()),c[f].setGeometryData(d[f]);a.modified()}for(f=0;f<c.length;f+=1)c[f].render(e)},this},inherit(b.groupMapper,b.mapper),b.materialAttributeType={Undefined:0,ShaderProgram:1,Texture:2,Blend:3,Depth:4},b.materialAttribute=function(a){"use strict";if(!(this instanceof b.materialAttribute))return new b.materialAttribute(a);b.graphicsObject.call(this);var c=this,d=a,e=!0;return this.type=function(){return d},this.enabled=function(){return e},this.bindVertexData=function(a,b){return a=a,b=b,!1},this.undoBindVertexData=function(a,b){return a=a,b=b,!1},c},inherit(b.materialAttribute,b.graphicsObject),b.blendFunction=function(a,c){"use strict";if(!(this instanceof b.blendFunction))return new b.blendFunction(a,c);var d=a,e=c;return this.apply=function(a){a.m_context.blendFuncSeparate(d,e,b.GL.ONE,b.GL.ONE_MINUS_SRC_ALPHA)},this},b.blend=function(){"use strict";if(!(this instanceof b.blend))return new b.blend;b.materialAttribute.call(this,b.materialAttributeType.Blend);var a=!1,c=b.blendFunction(b.GL.SRC_ALPHA,b.GL.ONE_MINUS_SRC_ALPHA);return this.bind=function(d){return a=d.m_context.isEnabled(b.GL.BLEND),this.enabled()?(d.m_context.enable(b.GL.BLEND),c.apply(d)):d.m_context.disable(b.GL.BLEND),!0},this.undoBind=function(c){return a?c.m_context.enable(b.GL.BLEND):c.m_context.disable(b.GL.BLEND),!0},this},inherit(b.blend,b.materialAttribute),b.material=function(){"use strict";if(!(this instanceof b.material))return new b.material;b.graphicsObject.call(this);var a=this,c=new b.shaderProgram,d=100,e={},f={};return this.binNumber=function(){return d},this.setBinNumber=function(b){d=b,a.modified()},this.exists=function(a){return a.type()===b.materialAttributeType.Texture?e.hasOwnProperty(a.textureUnit()):f.hasOwnProperty(a.type())},this.uniform=function(a){return c?c.uniform(a):null},this.attribute=function(a,c){return f.hasOwnProperty(a)?f[a]:a===b.materialAttributeType.Texture&&e.hasOwnProperty(c)?e[c]:null},this.setAttribute=function(d){return d.type()===b.materialAttributeType.Texture?e[d.textureUnit()]===d?!1:(e[d.textureUnit()]=d,a.modified(),!0):f[d.type()]===d?!1:(d.type()===b.materialAttributeType.ShaderProgram&&(c=d),f[d.type()]=d,a.modified(),!0)},this.addAttribute=function(d){return a.exists(d)?!1:d.type()===b.materialAttributeType.Texture?(e[d.textureUnit()]=d,a.modified(),!0):(d.type()===b.materialAttributeType.ShaderProgram&&(c=d),f[d.type()]=d,a.modified(),!0)},this.shaderProgram=function(){return c},this._setup=function(a){return!1},this._cleanup=function(b){for(var d in f)f.hasOwnProperty(d)&&f[d]._cleanup(b);for(d in e)e.hasOwnProperty(d)&&e[d]._cleanup(b);c._cleanup(b),a.modified()},this.bind=function(a){var b=null;c.bind(a);for(b in f)f.hasOwnProperty(b)&&f[b]!==c&&f[b].bind(a);for(b in e)e.hasOwnProperty(b)&&e[b].bind(a)},this.undoBind=function(a){var b=null;for(b in f)f.hasOwnProperty(b)&&f[b].undoBind(a);for(b in e)e.hasOwnProperty(b)&&e[b].undoBind(a)},this.bindVertexData=function(a,b){var c=null;for(c in f)f.hasOwnProperty(c)&&f[c].bindVertexData(a,b)},this.undoBindVertexData=function(a,b){var c=null;for(c in f)f.hasOwnProperty(c)&&f[c].undoBindVertexData(a,b)},a},b.material.RenderBin={Base:0,Default:100,Opaque:100,Transparent:1e3,Overlay:1e4},inherit(b.material,b.graphicsObject),b.renderState=function(){"use strict";this.m_context=null,this.m_modelViewMatrix=mat4.create(),this.m_normalMatrix=mat4.create(),this.m_projectionMatrix=null,this.m_material=null,this.m_mapper=null},b.renderer=function(a){"use strict";if(!(this instanceof b.renderer))return new b.renderer(a);b.graphicsObject.call(this),a=a||{};var c=this;return c.m_renderWindow=null,c.m_contextChanged=!1,c.m_sceneRoot=new b.groupNode,c.m_camera=new b.camera(a),c.m_nearClippingPlaneTolerance=null,c.m_x=0,c.m_y=0,c.m_width=0,c.m_height=0,c.m_resizable=!0,c.m_resetScene=!0,c.m_layer=0,c.m_renderPasses=null,c.m_resetClippingRange=!0,c.m_depthBits=null,c.m_camera.addChild(c.m_sceneRoot),this.width=function(){return c.m_width},this.height=function(){return c.m_height},this.layer=function(){return c.m_layer},this.setLayer=function(a){c.m_layer=a,c.modified()},this.isResizable=function(){return c.m_resizable},this.setResizable=function(a){c.m_resizable=a},this.renderWindow=function(){return c.m_renderWindow},this.setRenderWindow=function(a){c.m_renderWindow!==a&&(c.m_renderWindow&&c.m_renderWindow.removeRenderer(this),c.m_renderWindow=a,c.m_contextChanged=!0,c.modified())},this.backgroundColor=function(){return c.m_camera.clearColor()},this.setBackgroundColor=function(a,b,d,e){c.m_camera.setClearColor(a,b,d,e),c.modified()},this.sceneRoot=function(){return c.m_sceneRoot},this.camera=function(){return c.m_camera},this.render=function(){var a,d,e,f=null,g=[],h=mat4.create(),i=null;if(d=new b.renderState,d.m_renderer=c,d.m_context=c.renderWindow().context(),(!c.m_depthBits||c.m_contextChanged)&&(c.m_depthBits=d.m_context.getParameter(b.GL.DEPTH_BITS)),d.m_contextChanged=c.m_contextChanged,c.m_renderPasses)for(a=0;a<c.m_renderPasses.length;a+=1){if(c.m_renderPasses[a].render(d))return console.log("returning"),void c.m_renderPasses[a].remove(d);c.m_renderPasses[a].remove(d)}for(d.m_context.enable(b.GL.DEPTH_TEST),d.m_context.depthFunc(b.GL.LEQUAL),c.m_camera.clearMask()&b.GL.COLOR_BUFFER_BIT&&(i=c.m_camera.clearColor(),d.m_context.clearColor(i[0],i[1],i[2],i[3])),c.m_camera.clearMask()&b.GL.DEPTH_BUFFER_BIT&&d.m_context.clearDepth(c.m_camera.clearDepth()),d.m_context.clear(c.m_camera.clearMask()),d.m_context.viewport(c.m_x,c.m_y,c.m_width,c.m_height),e=c.m_sceneRoot.children(),e.length>0&&c.m_resetScene&&(c.resetCamera(),c.m_resetScene=!1),a=0;a<e.length;a+=1)f=e[a],f.computeBounds(),f.visible()&&f.material().binNumber()>=0&&g.push([f.material().binNumber(),f]);for(g.sort(function(a,b){return a[0]-b[0]}),a=0;a<g.length;a+=1){if(f=g[a][1],f.referenceFrame()===b.boundingObject.ReferenceFrame.Relative){var j=c.m_camera.viewMatrix();j instanceof Array&&(d.m_modelViewMatrix=new Array(16)),mat4.multiply(d.m_modelViewMatrix,j,f.matrix()),d.m_projectionMatrix=c.m_camera.projectionMatrix(),d.m_modelViewAlignment=c.m_camera.viewAlignment()}else d.m_modelViewMatrix=f.matrix(),d.m_modelViewAlignment=null,d.m_projectionMatrix=mat4.create(),mat4.ortho(d.m_projectionMatrix,0,c.m_width,0,c.m_height,-1,1);mat4.invert(h,d.m_modelViewMatrix),mat4.transpose(d.m_normalMatrix,h),d.m_material=f.material(),d.m_mapper=f.mapper(),d.m_material.bind(d),d.m_mapper.render(d),d.m_material.undoBind(d)}d.m_context.finish(),c.m_contextChanged=!1,c.m_lastRenderState=d},this.resetCamera=function(){c.m_camera.computeBounds();var a=c.m_camera.directionOfProjection(),b=c.m_camera.bounds(),d=[(b[0]+b[1])/2,(b[2]+b[3])/2,(b[4]+b[5])/2],e=[b[1]-b[0],b[3]-b[2],b[5]-b[4]],f=0,g=c.m_camera.viewAspect(),h=c.m_camera.viewAngle(),i=null,j=null;f=e[0]>e[1]?e[0]>e[2]?e[0]/2:e[2]/2:e[1]>e[2]?e[1]/2:e[2]/2,h=g>=1?2*Math.atan(Math.tan(.5*h)/g):2*Math.atan(Math.tan(.5*h)*g),i=f/Math.sin(.5*h),j=c.m_camera.viewUpDirection(),Math.abs(vec3.dot(j,a))>.999&&c.m_camera.setViewUpDirection(-j[2],j[0],j[1]),c.m_camera.setFocalPoint(d[0],d[1],d[2]),c.m_camera.setPosition(d[0]+i*-a[0],d[1]+i*-a[1],d[2]+i*-a[2]),c.resetCameraClippingRange(b)},this.hasValidBounds=function(a){return a[0]===Number.MAX_VALUE||a[1]===-Number.MAX_VALUE||a[2]===Number.MAX_VALUE||a[3]===-Number.MAX_VALUE||a[4]===Number.MAX_VALUE||a[5]===-Number.MAX_VALUE?!1:!0},this.resetCameraClippingRange=function(a){if("undefined"==typeof a&&(c.m_camera.computeBounds(),a=c.m_camera.bounds()),c.hasValidBounds(a)){var b=c.m_camera.viewPlaneNormal(),d=c.m_camera.position(),e=-b[0],f=-b[1],g=-b[2],h=-(e*d[0]+f*d[1]+g*d[2]),i=vec2.create(),j=null,k=null,l=null,m=null;if(c.m_resetClippingRange){for(i[0]=e*a[0]+f*a[2]+g*a[4]+h,i[1]=1e-18,m=0;2>m;m+=1)for(l=0;2>l;l+=1)for(k=0;2>k;k+=1)j=e*a[k]+f*a[2+l]+g*a[4+m]+h,i[0]=j<i[0]?j:i[0],i[1]=j>i[1]?j:i[1];i[0]<0&&(i[0]=0),i[0]=.99*i[0]-.5*(i[1]-i[0]),i[1]=1.01*i[1]+.5*(i[1]-i[0]),i[0]=i[0]>=i[1]?.01*i[1]:i[0],c.m_nearClippingPlaneTolerance||(c.m_nearClippingPlaneTolerance=.01,c.m_depthBits&&c.m_depthBits>16&&(c.m_nearClippingPlaneTolerance=.001)),i[0]<c.m_nearClippingPlaneTolerance*i[1]&&(i[0]=c.m_nearClippingPlaneTolerance*i[1]),c.m_camera.setClippingRange(i[0],i[1])}}},this.resize=function(a,b){a&&b&&c.positionAndResize(c.m_x,c.m_y,a,b)},this.positionAndResize=function(a,b,d,e){var f;if(0>a||0>b||0>=d||0>=e)return void console.log("[error] Invalid position and resize values",a,b,d,e);if(c.m_resizable&&(c.m_width=d,c.m_height=e,c.m_camera.setViewAspect(d/e),c.m_camera.setParallelExtents({width:d,height:e}),c.modified()),c.m_renderPasses)for(f=0;f<c.m_renderPasses.length;f+=1)c.m_renderPasses[f].resize(d,e),c.m_renderPasses[f].renderer().positionAndResize(a,b,d,e)},this.addActor=function(a){return a instanceof b.actor?(c.m_sceneRoot.addChild(a),c.modified(),!0):!1},this.hasActor=function(a){return c.m_sceneRoot.hasChild(a)},this.addActors=function(a){var b=null;if(a instanceof Array){for(b=0;b<a.length;b+=1)c.m_sceneRoot.addChild(a[b]);c.modified()}},this.removeActor=function(a){return-1!==c.m_sceneRoot.children().indexOf(a)?(c.m_lastRenderState&&(a.mapper()&&a.mapper()._cleanup(c.m_lastRenderState),a.material()&&a.material()._cleanup(c.m_lastRenderState)),a.modified(),c.m_sceneRoot.removeChild(a),c.modified(),!0):!1},this.removeActors=function(a){if(!(a instanceof Array))return!1;var b;for(b=0;b<a.length;b+=1)c.m_sceneRoot.removeChild(a[b]);return c.modified(),!0},this.removeAllActors=function(){return c.m_sceneRoot.removeChildren()},this.worldToDisplay=function(a,b,c,d,e){var f=mat4.create(),g=null,h=null,i=null,j=null,k=null;return mat4.multiply(f,c,b),k=vec4.create(),vec4.transformMat4(k,a,f),0!==k[3]&&(k[0]=k[0]/k[3],k[1]=k[1]/k[3],k[2]=k[2]/k[3],k[3]=1),g=(k[0]+1)/2*d,h=(1-k[1])/2*e,i=k[2],j=k[3],vec4.fromValues(g,h,i,j)},this.displayToWorld=function(a,b,c,d,e){var f=2*a[0]/d-1,g=-(2*a[1]/e)+1,h=a[2],i=mat4.create(),j=null;return mat4.multiply(i,c,b),mat4.invert(i,i),j=vec4.fromValues(f,g,h,1),vec4.transformMat4(j,j,i),0!==j[3]&&(j[0]=j[0]/j[3],j[1]=j[1]/j[3],j[2]=j[2]/j[3],j[3]=1),j},this.focusDisplayPoint=function(){var a=c.m_camera.focalPoint(),b=vec4.fromValues(a[0],a[1],a[2],1);return c.worldToDisplay(b,c.m_camera.viewMatrix(),c.m_camera.projectionMatrix(),c.m_width,c.m_height)},this.resetScene=function(){return c.m_resetScene},this.setResetScene=function(a){c.m_resetScene!==a&&(c.m_resetScene=a,c.modified())},this.resetClippingRange=function(){return c.m_resetClippingRange},this.setResetClippingRange=function(a){c.m_resetClippingRange!==a&&(c.m_resetClippingRange=a,c.modified())},this.addRenderPass=function(a){var b;if(c.m_renderPasses)for(b=0;b<c.m_renderPasses.length;b+=1)if(a===c.m_renderPasses[b])return;c.m_renderPasses=[],c.m_renderPasses.push(a)},this.removeRenderPass=function(a){a=a},this._cleanup=function(a){for(var b=c.m_sceneRoot.children(),d=0;d<b.length;d+=1){var e=b[d];e.material()._cleanup(a),e.mapper()._cleanup(a)}c.m_sceneRoot.removeChildren(),c.modified()},c},inherit(b.renderer,b.graphicsObject),b.renderWindow=function(a){"use strict";if(!(this instanceof b.renderWindow))return new b.renderWindow(a);b.graphicsObject.call(this);var c=this,d=0,e=0,f=400,g=400,h=a,i=null,j=[],k=null;return this.windowSize=function(){return[f,g]},this.setWindowSize=function(a,b){return f!==a||g!==b?(f=a,g=b,c.modified(),!0):!1},this.windowPosition=function(){return[d,e]},this.setWindowPosition=function(a,b){return d!==a||e!==b?(d=a,e=b,c.modified(),!0):!1},this.renderers=function(){return j},this.activeRenderer=function(){return i},this.addRenderer=function(a){return c.hasRenderer(a)===!1?(j.push(a),a.setRenderWindow(c),null===i&&(i=a),0!==a.layer()&&a.camera().setClearMask(b.GL.DepthBufferBit),c.modified(),!0):!1},this.removeRenderer=function(a){var b=j.indexOf(a);return-1!==b?(i===a&&(i=null),j.splice(b,1),c.modified(),!0):!1},this.getRenderer=function(a){return a<j.length?j[a]:(console.log("[WARNING] Out of index array"),null)},this.hasRenderer=function(a){var b;for(b=0;b<j.length;b+=1)if(a===j[b])return!0;return!1},this.resize=function(a,b){c.positionAndResize(d,e,a,b),c.modified()},this.positionAndResize=function(a,b,h,i){d=a,e=b,f=h,g=i;var k;for(k=0;k<j.length;k+=1)j[k].positionAndResize(d,e,f,g);c.modified()},this._setup=function(a){a=a,k=null;try{k=h.getContext("webgl")||h.getContext("experimental-webgl");var b;for(b=0;b<j.length;b+=1)(j[b].width()>f||0===j[b].width()||j[b].height()>g||0===j[b].height())&&j[b].resize(d,e,f,g);return!0}catch(c){}return k||console("[ERROR] Unable to initialize WebGL. Your browser may not support it."),!1},this.context=function(){return k},this._cleanup=function(a){var d;for(d=0;d<j.length;d+=1)j[d]._cleanup(a);b.clearCachedShaders(a?a.m_context:null),c.modified()},this.render=function(){var a;for(j.sort(function(a,b){return a.layer()-b.layer()}),a=0;a<j.length;a+=1)j[a].render()},this.focusDisplayPoint=function(){return i.focusDisplayPoint()},this.displayToWorld=function(a,b,c,d){d=void 0===d?d=i:d;var e=d.camera();return c||(c=d.focusDisplayPoint()),d.displayToWorld(vec4.fromValues(a,b,c[2],1),e.viewMatrix(),e.projectionMatrix(),f,g)},this.worldToDisplay=function(a,b,c,d){d=void 0===d?d=i:d;var e=d.camera();return d.worldToDisplay(vec4.fromValues(a,b,c,1),e.viewMatrix(),e.projectionMatrix(),f,g)},c},inherit(b.renderWindow,b.graphicsObject),b.camera=function(a){"use strict";if(!(this instanceof b.camera))return new b.camera(a);b.groupNode.call(this),a=a||{};var c=30*Math.PI/180,d=vec4.fromValues(0,0,1,1),e=vec4.fromValues(0,0,0,1),f=vec3.fromValues(0,0,0),g=vec4.fromValues(0,1,0,0),h=vec4.fromValues(1,0,0,0),i=.01,j=1e4,k=1,l=vec4.fromValues(0,0,-1,0),m=vec4.fromValues(0,0,1,0),n=mat4.create(),o=mat4.create(),p=b.timestamp(),q=b.timestamp(),r=-1,s=1,t=1,u=-1,v={zoom:1,tilesize:256},w=!0,x=!0,y=!0,z=!1,A=[0,0,0,0],B=1,C=b.GL.COLOR_BUFFER_BIT|b.GL.DEPTH_BUFFER_BIT;return void 0!==a.parallelProjection&&(z=a.parallelProjection?!0:!1),this.viewAngle=function(){return c},this.setViewAngleDegrees=function(a){this.setViewAngle(Math.PI*a/180)},this.setViewAngle=function(a){y&&(c=a,this.modified())},this.position=function(){return d},this.setPosition=function(a,b,c){w&&(d=vec4.fromValues(a,b,c,1),this.modified())},this.focalPoint=function(){return e},this.setFocalPoint=function(a,b,c){x&&w&&(e=vec4.fromValues(a,b,c,1),this.modified())},this.viewUpDirection=function(){return g},this.setViewUpDirection=function(a,b,c){g=vec4.fromValues(a,b,c,0),this.modified()},this.centerOfRotation=function(){return f},this.setCenterOfRotation=function(a){f=a,this.modified()},this.clippingRange=function(){return[i,j]},this.setClippingRange=function(a,b){i=a,j=b,this.modified()},this.viewAspect=function(){return k},this.setViewAspect=function(a){k=a,this.modified()},this.enableScale=function(){return y},this.setEnableScale=function(a){return a!==y?(y=a,this.modified(),!0):y},this.enableRotation=function(){return x},this.setEnableRotation=function(a){return a!==x?(x=a,this.modified(),!0):x},this.enableTranslation=function(){return w},this.setEnableTranslation=function(a){return a!==w?(w=a,this.modified(),!0):w},this.isEnabledParallelProjection=function(){return z},this.enableParallelProjection=function(a){return a!==z?(z=a,this.modified(),!0):z},this.setEnableParallelProjection=function(a){return this.enableParallelProjection(a)},this.parallelProjection=function(){return{left:r,right:s,top:t,bottom:u}},this.setParallelProjection=function(a,b,c,d){r=a,s=b,t=c,u=d,this.modified()},this.parallelExtents=function(){return v},this.setParallelExtents=function(a){var b,c,d=["width","height","zoom","tilesize"],e=!1;for(b=0;b<d.length;b+=1)c=d[b],void 0!==a[c]&&a[c]!==v[c]&&(v[c]=a[c],e=!0);if(e&&v.width&&v.height&&void 0!==v.zoom&&v.tilesize){var f=this.unitsPerPixel(v.zoom,v.tilesize);s=f*v.width/2,r=-s,t=f*v.height/2,u=-t,this.modified()}},this.unitsPerPixel=function(a,b){return b=b||256,360*Math.pow(2,-a)/b},this.directionOfProjection=function(){return this.computeDirectionOfProjection(),l},this.viewPlaneNormal=function(){return this.computeViewPlaneNormal(),m},this.viewMatrix=function(){return this.computeViewMatrix()},this.setViewMatrix=function(a,b){b?n=a.slice():mat4.copy(n,a),p.modified()},this.projectionMatrix=function(){return this.computeProjectionMatrix()},this.setProjectionMatrix=function(a){mat4.copy(o,a),q.modified()},this.clearMask=function(){return C},this.setClearMask=function(a){C=a,this.modified()},this.clearColor=function(){return A},this.setClearColor=function(a,b,c,d){A[0]=a,A[1]=b,A[2]=c,A[3]=d,this.modified()},this.clearDepth=function(){return B},this.setClearDepth=function(a){B=a,this.modified()},this.computeDirectionOfProjection=function(){vec3.subtract(l,e,d),vec3.normalize(l,l),this.modified()},this.computeViewPlaneNormal=function(){m[0]=-l[0],m[1]=-l[1],m[2]=-l[2]},this.zoom=function(a,b){0!==a&&w&&(a*=vec3.distance(e,d),b?(d[0]=d[0]+a*b[0],d[1]=d[1]+a*b[1],d[2]=d[2]+a*b[2]):(b=l,d[0]=e[0]-a*b[0],d[1]=e[1]-a*b[1],d[2]=e[2]-a*b[2]),this.modified())},this.pan=function(a,b,c){w&&(d[0]+=a,d[1]+=b,d[2]+=c,e[0]+=a,e[1]+=b,e[2]+=c,this.modified())},this.computeOrthogonalAxes=function(){this.computeDirectionOfProjection(),vec3.cross(h,l,g),vec3.normalize(h,h),this.modified()},this.rotate=function(a,b){if(x){a=.5*a*(Math.PI/180),b=.5*b*(Math.PI/180);var c=mat4.create(),i=new vec3.create;mat4.identity(c),i[0]=-f[0],i[1]=-f[1],i[2]=-f[2],mat4.translate(c,c,f),mat4.rotate(c,c,a,g),mat4.rotate(c,c,b,h),mat4.translate(c,c,i),vec4.transformMat4(d,d,c),vec4.transformMat4(e,e,c),vec4.transformMat4(g,g,c),vec4.normalize(g,g),this.computeOrthogonalAxes(),this.modified()}},this.computeViewMatrix=function(){return p.getMTime()<this.getMTime()&&(mat4.lookAt(n,d,e,g),p.modified()),n},this.viewAlignment=function(){if(!z){var a=this.projectionMatrix();if(a[1]||a[2]||a[3]||a[4]||a[6]||a[7]||a[8]||a[9]||a[12]||a[13]||a[15])return null}var b=this.unitsPerPixel(v.zoom,v.tilesize);if(!v.width||!v.height||!b)return null;if(parseFloat(v.zoom.toFixed(6))!==parseFloat(v.zoom.toFixed(0)))return null;var c={roundx:b,roundy:b,dx:0,dy:0};return v.width%2&&(c.dx=.5*b),v.height%2&&(c.dy=.5*b),c},this.computeProjectionMatrix=function(){return q.getMTime()<this.getMTime()&&(z?mat4.ortho(o,r,s,u,t,i,j):mat4.perspective(o,c,k,i,j),q.modified()),o},this.zoomToHeight=function(a,d,e){return b.zoomToHeight(a,d,e,c)},this.computeDirectionOfProjection(),this},inherit(b.camera,b.groupNode),b.zoomToHeight=function(a,b,c,d){"use strict";d=d||30*Math.PI/180;var e=360*Math.pow(2,-a);return e/=2*Math.tan(d/2)*256/c},b.heightToZoom=function(a,b,c,d){"use strict";d=d||30*Math.PI/180,a*=2*Math.tan(d/2)*256/c;var e=-Math.log2(a/360);return e},b.interactorStyle=function(){"use strict";if(!(this instanceof b.interactorStyle))return new b.interactorStyle;b.object.call(this);var a=this,c=null;return this.viewer=function(){return c},this.setViewer=function(d){d!==c&&(c=d,$(c).on(b.event.mousePress,a.handleMouseDown),$(c).on(b.event.mouseRelease,a.handleMouseUp),$(c).on(b.event.mouseMove,a.handleMouseMove),$(c).on(b.event.mouseOut,a.handleMouseOut),$(c).on(b.event.mouseWheel,a.handleMouseWheel),$(c).on(b.event.keyPress,a.handleKeyPress),$(c).on(b.event.mouseContextMenu,a.handleContextMenu),$(c).on(b.event.click,a.handleClick),$(c).on(b.event.dblClick,a.handleDoubleClick),this.modified())},this.handleMouseDown=function(a){return a=a,!0},this.handleMouseUp=function(a){return a=a,!0},this.handleMouseMove=function(a){return a=a,!0},this.handleMouseOut=function(a){return a=a,!0},this.handleMouseWheel=function(a){return a=a,!0},this.handleClick=function(a){return a=a,!0},this.handleDoubleClick=function(a){return a=a,!0},this.handleKeyPress=function(a){return a=a,!0},this.handleContextMenu=function(a){return a=a,!0},this.reset=function(){return!0},this},inherit(b.interactorStyle,b.object),b.trackballInteractorStyle=function(){"use strict";if(!(this instanceof b.trackballInteractorStyle))return new b.trackballInteractorStyle;b.interactorStyle.call(this);var a,c=this,d=!1,e=!1,f=!1,g={x:0,y:0},h={x:0,y:0};return this.handleMouseMove=function(b){var i,j,k,l,m,n,o,p,q,r,s,t=c.viewer().renderWindow().windowSize()[0],u=c.viewer().renderWindow().windowSize()[1],v=c.viewer().renderWindow().activeRenderer(),w=v.camera(),x=c.viewer().relMouseCoords(b);return a=!1,g={x:0,y:0},x.x<0||x.x>t?(g.x=0,a=!0):g.x=x.x,x.y<0||x.y>u?(g.y=0,a=!0):g.y=x.y,a!==!0?(i=w.focalPoint(),k=vec4.fromValues(i[0],i[1],i[2],1),j=v.worldToDisplay(k,w.viewMatrix(),w.projectionMatrix(),t,u),l=vec4.fromValues(g.x,g.y,j[2],1),m=vec4.fromValues(h.x,h.y,j[2],1),n=v.displayToWorld(l,w.viewMatrix(),w.projectionMatrix(),t,u),o=v.displayToWorld(m,w.viewMatrix(),w.projectionMatrix(),t,u),p=n[0]-o[0],q=n[1]-o[1],r=n[2]-o[2],f&&(w.pan(-p,-q,-r),c.viewer().render()),d&&(w.rotate(h.x-g.x,h.y-g.y),v.resetCameraClippingRange(),c.viewer().render()),e&&(s=2*(g.y-h.y)/u,s>0?w.zoom(1-Math.abs(s)):w.zoom(1+Math.abs(s)),v.resetCameraClippingRange(),c.viewer().render()),h.x=g.x,h.y=g.y,!1):void 0},this.handleMouseDown=function(a){var b;return 0===a.button&&(d=!0),1===a.button&&(f=!0),2===a.button&&(e=!0),b=c.viewer().relMouseCoords(a),b.x<0?h.x=0:h.x=b.x,b.y<0?h.y=0:h.y=b.y,!1},this.handleMouseUp=function(a){return 0===a.button&&(d=!1),1===a.button&&(f=!1),2===a.button&&(e=!1),!1},this.handleMouseWheel=function(a){var b=c.viewer().renderWindow().activeRenderer(),d=b.camera();return a.originalEvent.wheelDelta<0?d.zoom(.9):d.zoom(1.1),b.resetCameraClippingRange(),c.viewer().render(),!0},this},inherit(b.trackballInteractorStyle,b.interactorStyle),b.viewer=function(a,c){"use strict";if(!(this instanceof b.viewer))return new b.viewer(a,c);b.object.call(this);var d=this,e=a,f=!0,g=null,h=b.renderer(c),i=b.renderWindow(e);return this.canvas=function(){return e},this.renderWindow=function(){return i},this.init=function(){null!==i?i._setup():console.log("[ERROR] No render window attached")},this.exit=function(a){null!==i?i._cleanup(a):console.log("[ERROR] No render window attached")},this.interactorStyle=function(){return g},this.setInteractorStyle=function(a){a!==g&&(g=a,g.setViewer(this),this.modified())},this.handleMouseDown=function(a){if(f===!0){var c=$.event.fix(a||window.event);2===a.button&&c.preventDefault(),c.state="down",c.type=b.event.mousePress,$(d).trigger(c)}return!0},this.handleMouseUp=function(a){if(f===!0){var c=$.event.fix(a||window.event);c.preventDefault(),c.state="up",c.type=b.event.mouseRelease,$(d).trigger(c)}return!0},this.handleMouseMove=function(a){if(f===!0){var c=$.event.fix(a||window.event);c.preventDefault(),c.type=b.event.mouseMove,$(d).trigger(c)}return!0},this.handleMouseWheel=function(a){if(f===!0){var c=$.event.fix(a||window.event);c.preventDefault(),c.type=b.event.mouseWheel,$(d).trigger(c)}return!0},this.handleMouseOut=function(a){if(f===!0){var c=$.event.fix(a||window.event);c.preventDefault(),c.type=b.event.mouseOut,$(d).trigger(c)}return!0},this.handleKeyPress=function(a){if(f===!0){var c=$.event.fix(a||window.event);c.preventDefault(),c.type=b.event.keyPress,$(d).trigger(c)}return!0},this.handleContextMenu=function(a){if(f===!0){var c=$.event.fix(a||window.event);c.preventDefault(),c.type=b.event.contextMenu,$(d).trigger(c)}return!1},this.handleClick=function(a){if(f===!0){var c=$.event.fix(a||window.event);c.preventDefault(),c.type=b.event.click,$(d).trigger(c)}return!1},this.handleDoubleClick=function(a){if(f===!0){var c=$.event.fix(a||window.event);c.preventDefault(),c.type=b.event.dblClick,$(d).trigger(c)}return!1},this.relMouseCoords=function(a){if(void 0===a.pageX||void 0===a.pageY)throw"Missing attributes pageX and pageY on the event";var b=0,c=0,d=0,f=0,g=e;do b+=g.offsetLeft-g.scrollLeft,c+=g.offsetTop-g.scrollTop,g=g.offsetParent;while(g);return d=a.pageX-b,f=a.pageY-c,{x:d,y:f}},this.render=function(){i.render()},this.bindEventHandlers=function(){$(e).on("mousedown",this.handleMouseDown),$(e).on("mouseup",this.handleMouseUp),$(e).on("mousemove",this.handleMouseMove),$(e).on("mousewheel",this.handleMouseWheel),$(e).on("contextmenu",this.handleContextMenu)},this.unbindEventHandlers=function(){$(e).off("mousedown",this.handleMouseDown),$(e).off("mouseup",this.handleMouseUp),$(e).off("mousemove",this.handleMouseMove),$(e).off("mousewheel",this.handleMouseWheel),$(e).off("contextmenu",this.handleContextMenu)},this._init=function(){this.bindEventHandlers(),i.addRenderer(h)},this._init(),this},inherit(b.viewer,b.object),b.shader=function(a){"use strict";if(!(this instanceof b.shader))return new b.shader(a);b.object.call(this);var c=[],d=a,e="";this._getContextEntry=function(a){var d,e,f=a.m_context;for(d=0;d<c.length;d+=1)if(c[d].context===f)return c[d];return e={context:f,compileTimestamp:b.timestamp()},c.push(e),e},this.removeContext=function(a){var b,d=a.m_context;for(b=0;b<c.length;b+=1)if(c[b].context===d)return void c.splice(b,1)},this.shaderHandle=function(a){var b=this._getContextEntry(a);return b.shaderHandle},this.shaderType=function(){return d},this.shaderSource=function(){return e},this.setShaderSource=function(a){e=a,this.modified()},this.compile=function(a){var c=this._getContextEntry(a);return this.getMTime()<c.compileTimestamp.getMTime()?c.shaderHandle:(a.m_context.deleteShader(c.shaderHandle),c.shaderHandle=a.m_context.createShader(d),a.m_context.shaderSource(c.shaderHandle,e),a.m_context.compileShader(c.shaderHandle),a.m_context.getShaderParameter(c.shaderHandle,b.GL.COMPILE_STATUS)?(c.compileTimestamp.modified(),c.shaderHandle):(console.log("[ERROR] An error occurred compiling the shaders: "+a.m_context.getShaderInfoLog(c.shaderHandle)),console.log(e),a.m_context.deleteShader(c.shaderHandle),null))},this.attachShader=function(a,b){a.m_context.attachShader(b,this.shaderHandle(a))}},inherit(b.shader,b.object),function(){"use strict";var a=[],c=10;b.getCachedShader=function(d,e,f){for(var g=0;g<a.length;g+=1)if(a[g].type===d&&a[g].context===e&&a[g].source===f)return g&&a.splice(0,0,a.splice(g,1)[0]),a[0].shader;var h=new b.shader(d);return h.setShaderSource(f),a.unshift({type:d,context:e,source:f,shader:h}),a.length>=c&&a.splice(c,a.length-c),h},b.clearCachedShaders=function(b){for(var c=a.length-1;c>=0;c-=1)(null===b||void 0===b||a[c].context===b)&&a.splice(c,1)}}();var d=function(){"use strict";var a=".",b=document.getElementsByTagName("script");if(b.length>0){var c=b.length-1,d=b[c];c=d.src.lastIndexOf("/"),a=d.src.substring(0,c)}return function(){return a}}();return b.shaderProgram=function(){"use strict";if(!(this instanceof b.shaderProgram))return new b.shaderProgram;b.materialAttribute.call(this,b.materialAttributeType.ShaderProgram);var a=this,c=0,e=b.timestamp(),f=b.timestamp(),g=[],h=[],i={},j={},k={};return this.loadFromFile=function(c,d){var e,f=!1;return $.ajax({url:d,type:"GET",dataType:"text",async:!1,success:function(d){e=b.shader(c),e.setShaderSource(d),a.addShader(e),f=!0}}),f},this.loadShader=function(a,b){return this.loadFromFile(a,d()+"/shaders/"+b)},this.queryUniformLocation=function(a,b){return a.m_context.getUniformLocation(c,b)},this.queryAttributeLocation=function(a,b){return a.m_context.getAttribLocation(c,b)},this.addShader=function(b){if(g.indexOf(b)>-1)return!1;var c;for(c=g.length-2;c>=0;c-=1)g[c].shaderType()===b.shaderType()&&g.splice(c,1);return g.push(b),a.modified(),!0},this.addUniform=function(b){return h.indexOf(b)>-1?!1:(h.push(b),a.modified(),!0)},this.addVertexAttribute=function(b,c){i[c]=b,a.modified()},this.uniformLocation=function(a){return j[a]},this.attributeLocation=function(a){return k[a]},this.uniform=function(a){var b;for(b=0;b<h.length;b+=1)if(h[b].name()===a)return h[b];return null},this.updateUniforms=function(a){var b;for(b=0;b<h.length;b+=1)h[b].callGL(a,j[h[b].name()])},this.link=function(a){return a.m_context.linkProgram(c),a.m_context.getProgramParameter(c,b.GL.LINK_STATUS)?!0:(console.log("[ERROR] Unable to initialize the shader program."),!1)},this.use=function(a){a.m_context.useProgram(c)},this._setup=function(a){0===c&&(c=a.m_context.createProgram())},this._cleanup=function(b){a.deleteVertexAndFragment(b),a.deleteProgram(b),a.modified()},this.deleteProgram=function(a){c&&a.m_context.deleteProgram(c),c=0},this.deleteVertexAndFragment=function(a){var b;for(b=0;b<g.length;b+=1)g[b].shaderHandle(a)&&a.m_context.detachShader(c,g[b].shaderHandle(a)),a.m_context.deleteShader(g[b].shaderHandle(a)),g[b].removeContext(a)},this.compileAndLink=function(b){var d;if(!(e.getMTime()>=this.getMTime())){for(a._setup(b),d=0;d<g.length;d+=1)g[d].compile(b),g[d].attachShader(b,c);a.bindAttributes(b),a.link(b)||(console.log("[ERROR] Failed to link Program"),a._cleanup(b)),e.modified()}},this.bind=function(b){var c=0;for(f.getMTime()<a.getMTime()?(a.compileAndLink(b),a.use(b),a.bindUniforms(b),f.modified()):a.use(b),c=0;c<h.length;c+=1)h[c].update(b,a);a.updateUniforms(b)},this.undoBind=function(a){a.m_context.useProgram(null)},this.bindVertexData=function(a,b){i.hasOwnProperty(b)&&i[b].bindVertexData(a,b)},this.undoBindVertexData=function(a,b){i.hasOwnProperty(b)&&i[b].undoBindVertexData(a,b)},this.bindUniforms=function(a){var b;for(b=0;b<h.length;b+=1)j[h[b].name()]=this.queryUniformLocation(a,h[b].name())},this.bindAttributes=function(a){var b,d;for(b in i)i.hasOwnProperty(b)&&(d=i[b].name(),a.m_context.bindAttribLocation(c,b,d),k[d]=b)},a},inherit(b.shaderProgram,b.materialAttribute),b.texture=function(){"use strict";function a(a){switch(d.m_textureUnit){case 0:a.m_context.activeTexture(b.GL.TEXTURE0);break;case 1:a.m_context.activeTexture(b.GL.TEXTURE1);break;case 2:a.m_context.activeTexture(b.GL.TEXTURE2);break;case 3:a.m_context.activeTexture(b.GL.TEXTURE3);break;case 4:a.m_context.activeTexture(b.GL.TEXTURE4);break;case 5:a.m_context.activeTexture(b.GL.TEXTURE5);
break;case 6:a.m_context.activeTexture(b.GL.TEXTURE6);break;case 7:a.m_context.activeTexture(b.GL.TEXTURE7);break;case 8:a.m_context.activeTexture(b.GL.TEXTURE8);break;case 9:a.m_context.activeTexture(b.GL.TEXTURE9);break;case 10:a.m_context.activeTexture(b.GL.TEXTURE10);break;case 11:a.m_context.activeTexture(b.GL.TEXTURE11);break;case 12:a.m_context.activeTexture(b.GL.TEXTURE12);break;case 13:a.m_context.activeTexture(b.GL.TEXTURE13);break;case 14:a.m_context.activeTexture(b.GL.TEXTURE14);break;case 15:a.m_context.activeTexture(b.GL.TEXTURE15);break;default:throw"[error] Texture unit "+d.m_textureUnit+" is not supported"}}if(!(this instanceof b.texture))return new b.texture;b.materialAttribute.call(this,b.materialAttributeType.Texture),this.m_width=0,this.m_height=0,this.m_depth=0,this.m_textureHandle=null,this.m_textureUnit=0,this.m_pixelFormat=b.GL.RGBA,this.m_pixelDataType=b.GL.UNSIGNED_BYTE,this.m_internalFormat=b.GL.RGBA,this.m_nearestPixel=!1,this.m_image=null;var c=b.timestamp(),d=this;return this.setup=function(d){a(d),d.m_context.deleteTexture(this.m_textureHandle),this.m_textureHandle=d.m_context.createTexture(),d.m_context.bindTexture(b.GL.TEXTURE_2D,this.m_textureHandle),d.m_context.texParameteri(b.GL.TEXTURE_2D,b.GL.TEXTURE_MIN_FILTER,this.m_nearestPixel?b.GL.NEAREST:b.GL.LINEAR),d.m_context.texParameteri(b.GL.TEXTURE_2D,b.GL.TEXTURE_MAG_FILTER,this.m_nearestPixel?b.GL.NEAREST:b.GL.LINEAR),d.m_context.texParameteri(b.GL.TEXTURE_2D,b.GL.TEXTURE_WRAP_S,b.GL.CLAMP_TO_EDGE),d.m_context.texParameteri(b.GL.TEXTURE_2D,b.GL.TEXTURE_WRAP_T,b.GL.CLAMP_TO_EDGE),null!==this.m_image?(d.m_context.pixelStorei(b.GL.UNPACK_ALIGNMENT,1),d.m_context.pixelStorei(b.GL.UNPACK_FLIP_Y_WEBGL,!0),this.updateDimensions(),this.computeInternalFormatUsingImage(),d.m_context.texImage2D(b.GL.TEXTURE_2D,0,this.m_internalFormat,this.m_pixelFormat,this.m_pixelDataType,this.m_image)):d.m_context.texImage2D(b.GL.TEXTURE_2D,0,this.m_internalFormat,this.m_width,this.m_height,0,this.m_pixelFormat,this.m_pixelDataType,null),d.m_context.bindTexture(b.GL.TEXTURE_2D,null),c.modified()},this.bind=function(d){this.getMTime()>c.getMTime()&&this.setup(d),a(d),d.m_context.bindTexture(b.GL.TEXTURE_2D,this.m_textureHandle)},this.undoBind=function(a){a.m_context.bindTexture(b.GL.TEXTURE_2D,null)},this.image=function(){return this.m_image},this.setImage=function(a){return null!==a?(this.m_image=a,this.updateDimensions(),this.modified(),!0):!1},this.nearestPixel=function(){return this.m_nearestPixel},this.setNearestPixel=function(a){return a=a?!0:!1,a!==this.m_nearestPixel?(this.m_nearestPixel=a,this.modified(),!0):!1},this.textureUnit=function(){return this.m_textureUnit},this.setTextureUnit=function(a){return this.m_textureUnit===a?!1:(this.m_textureUnit=a,this.modified(),!0)},this.width=function(){return this.m_width},this.setWidth=function(a){return d.m_width!==a?(d.m_width=a,d.modified(),!0):!1},this.height=function(){return d.m_height},this.setHeight=function(a){return d.m_height!==a?(d.m_height=a,d.modified(),!0):!1},this.depth=function(){return this.m_depth},this.setDepth=function(a){return null===this.m_image?!1:(this.m_depth=a,this.modified(),!0)},this.textureHandle=function(){return this.m_textureHandle},this.internalFormat=function(){return this.m_internalFormat},this.setInternalFormat=function(a){return this.m_internalFormat!==a?(this.m_internalFormat=a,this.modified(),!0):!1},this.pixelFormat=function(){return this.m_pixelFormat},this.setPixelFormat=function(a){return null===this.m_image?!1:(this.m_pixelFormat=a,this.modified(),!0)},this.pixelDataType=function(){return this.m_pixelDataType},this.setPixelDataType=function(a){return null===this.m_image?!1:(this.m_pixelDataType=a,this.modified(),!0)},this.computeInternalFormatUsingImage=function(){this.m_internalFormat=b.GL.RGBA,this.m_pixelFormat=b.GL.RGBA,this.m_pixelDataType=b.GL.UNSIGNED_BYTE},this.updateDimensions=function(){null!==this.m_image&&(this.m_width=this.m_image.width,this.m_height=this.m_image.height,this.m_depth=0)},this},inherit(b.texture,b.materialAttribute),b.lookupTable=function(){"use strict";if(!(this instanceof b.lookupTable))return new b.lookupTable;b.texture.call(this);var a=b.timestamp(),c=[0,0];return this.m_colorTable=[.07514311,.468049805,1,1,.247872569,.498782363,1,1,.339526309,.528909511,1,1,.409505078,.558608486,1,1,.468487184,.588057293,1,1,.520796675,.617435078,1,1,.568724526,.646924167,1,1,.613686735,.676713218,1,1,.656658579,.707001303,1,1,.698372844,.738002964,1,1,.739424025,.769954435,1,1,.780330104,.803121429,1,1,.821573924,.837809045,1,1,.863634967,.874374691,1,1,.907017747,.913245283,1,1,.936129275,.938743558,.983038586,1,.943467973,.943498599,.943398095,1,.990146732,.928791426,.917447482,1,1,.88332677,.861943246,1,1,.833985467,.803839606,1,1,.788626485,.750707739,1,1,.746206642,.701389973,1,1,.70590052,.654994046,1,1,.667019783,.610806959,1,1,.6289553,.568237474,1,1,.591130233,.526775617,1,1,.552955184,.485962266,1,1,.513776083,.445364274,1,1,.472800903,.404551679,1,1,.428977855,.363073592,1,1,.380759558,.320428137,1,.961891484,.313155629,.265499262,1,.916482116,.236630659,.209939162,1].map(function(a){return 255*a}),this.setup=function(c){0===this.textureUnit()?c.m_context.activeTexture(b.GL.TEXTURE0):1===this.textureUnit()&&c.m_context.activeTexture(b.GL.TEXTURE1),c.m_context.deleteTexture(this.m_textureHandle),this.m_textureHandle=c.m_context.createTexture(),c.m_context.bindTexture(b.GL.TEXTURE_2D,this.m_textureHandle),c.m_context.texParameteri(b.GL.TEXTURE_2D,b.GL.TEXTURE_MIN_FILTER,b.GL.LINEAR),c.m_context.texParameteri(b.GL.TEXTURE_2D,b.GL.TEXTURE_MAG_FILTER,b.GL.LINEAR),c.m_context.texParameteri(b.GL.TEXTURE_2D,b.GL.TEXTURE_WRAP_S,b.GL.CLAMP_TO_EDGE),c.m_context.texParameteri(b.GL.TEXTURE_2D,b.GL.TEXTURE_WRAP_T,b.GL.CLAMP_TO_EDGE),c.m_context.pixelStorei(b.GL.UNPACK_ALIGNMENT,1),this.m_width=this.m_colorTable.length/4,this.m_height=1,this.m_depth=0,c.m_context.texImage2D(b.GL.TEXTURE_2D,0,b.GL.RGBA,this.m_width,this.m_height,this.m_depth,b.GL.RGBA,b.GL.UNSIGNED_BYTE,new Uint8Array(this.m_colorTable)),c.m_context.bindTexture(b.GL.TEXTURE_2D,null),a.modified()},this.colorTable=function(){return this.m_colorTable},this.setColorTable=function(a){return this.m_colorTable===a?!1:(this.m_colorTable=a,this.modified(),!0)},this.range=function(){return c},this.setRange=function(a){return c===a?!1:(c=a,this.modified(),!0)},this.updateRange=function(a){a instanceof Array||console.log("[error] Invalid data type for range. Requires array [min,max]"),a[0]<c[0]&&(c[0]=a[0],this.modified()),a[1]>c[1]&&(c[1]=a[1],this.modified())},this},inherit(b.lookupTable,b.texture),b.uniform=function(a,c){"use strict";if(!(this instanceof b.uniform))return new b.uniform(a,c);this.getTypeNumberOfComponents=function(a){switch(a){case b.GL.FLOAT:case b.GL.INT:case b.GL.BOOL:return 1;case b.GL.FLOAT_VEC2:case b.GL.INT_VEC2:case b.GL.BOOL_VEC2:return 2;case b.GL.FLOAT_VEC3:case b.GL.INT_VEC3:case b.GL.BOOL_VEC3:return 3;case b.GL.FLOAT_VEC4:case b.GL.INT_VEC4:case b.GL.BOOL_VEC4:return 4;case b.GL.FLOAT_MAT3:return 9;case b.GL.FLOAT_MAT4:return 16;default:return 0}};var d=a,e=c,f=[];return f.length=this.getTypeNumberOfComponents(d),this.name=function(){return e},this.type=function(){return d},this.get=function(){return f},this.set=function(a){var b=0,c=f.length;if(1!==c)for(b=0;c>b;b+=1)f[b]=a[b];else f[0]=a},this.callGL=function(a,c){switch(d){case b.GL.BOOL:case b.GL.INT:a.m_context.uniform1iv(c,f);break;case b.GL.FLOAT:a.m_context.uniform1fv(c,f);break;case b.GL.BOOL_VEC2:case b.GL.INT_VEC2:a.m_context.uniform2iv(c,f);break;case b.GL.FLOAT_VEC2:a.m_context.uniform2fv(c,f);break;case b.GL.BOOL_VEC3:case b.GL.INT_VEC3:a.m_context.uniform3iv(c,f);break;case b.GL.FLOAT_VEC3:a.m_context.uniform3fv(c,f);break;case b.GL.BOOL_VEC4:case b.GL.INT_VEC4:a.m_context.uniform4iv(c,f);break;case b.GL.FLOAT_VEC4:a.m_context.uniform4fv(c,f);break;case b.GL.FLOAT_MAT3:a.m_context.uniformMatrix3fv(c,b.GL.FALSE,f);break;case b.GL.FLOAT_MAT4:a.m_context.uniformMatrix4fv(c,b.GL.FALSE,f)}},this.update=function(a,b){},this},b.modelViewUniform=function(a){"use strict";return this instanceof b.modelViewUniform?(a||(a="modelViewMatrix"),b.uniform.call(this,b.GL.FLOAT_MAT4,a),this.set(mat4.create()),this.update=function(a,b){this.set(a.m_modelViewMatrix)},this):new b.modelViewUniform(a)},inherit(b.modelViewUniform,b.uniform),b.modelViewOriginUniform=function(a,c){"use strict";if(!(this instanceof b.modelViewOriginUniform))return new b.modelViewOriginUniform(a,c);a||(a="modelViewMatrix"),c=c||[0,0,0];var d=[c[0],c[1],c[2]||0];return b.uniform.call(this,b.GL.FLOAT_MAT4,a),this.set(mat4.create()),this.setOrigin=function(a){a=a||[0,0,0],d=[a[0],a[1],a[2]||0]},this.update=function(a,b){var c=a.m_modelViewMatrix;if(a.m_modelViewAlignment){var e=a.m_modelViewAlignment;c=c.slice?c.slice():Array.prototype.slice.call(c),c[12]=Math.round(c[12]/e.roundx)*e.roundx+e.dx,c[13]=Math.round(c[13]/e.roundy)*e.roundy+e.dy}c=mat4.translate(mat4.create(),c,d),this.set(c)},this},inherit(b.modelViewOriginUniform,b.uniform),b.projectionUniform=function(a){"use strict";return this instanceof b.projectionUniform?(a||(a="projectionMatrix"),b.uniform.call(this,b.GL.FLOAT_MAT4,a),this.set(mat4.create()),this.update=function(a,b){this.set(a.m_projectionMatrix)},this):new b.projectionUniform(a)},inherit(b.projectionUniform,b.uniform),b.floatUniform=function(a,c){"use strict";return this instanceof b.floatUniform?(a||(a="floatUniform"),c=void 0===c?1:c,b.uniform.call(this,b.GL.FLOAT,a),void this.set(c)):new b.floatUniform(a,c)},inherit(b.floatUniform,b.uniform),b.normalMatrixUniform=function(a){"use strict";return this instanceof b.normalMatrixUniform?(a||(a="normalMatrix"),b.uniform.call(this,b.GL.FLOAT_MAT4,a),this.set(mat4.create()),this.update=function(a,b){this.set(a.m_normalMatrix)},this):new b.normalMatrixUniform(a)},inherit(b.normalMatrixUniform,b.uniform),b.vertexAttributeKeys={Position:0,Normal:1,TextureCoordinate:2,Color:3,Scalar:4,CountAttributeIndex:5},b.vertexAttributeKeysIndexed={Zero:0,One:1,Two:2,Three:3,Four:4,Five:5,Six:6,Seven:7,Eight:8,Nine:9},b.vertexAttribute=function(a){"use strict";if(!(this instanceof b.vertexAttribute))return new b.vertexAttribute(a);var c=a;this.name=function(){return c},this.bindVertexData=function(a,b){var d=a.m_mapper.geometryData(),e=d.sourceData(b),f=a.m_material.shaderProgram();a.m_context.vertexAttribPointer(f.attributeLocation(c),e.attributeNumberOfComponents(b),e.attributeDataType(b),e.normalized(b),e.attributeStride(b),e.attributeOffset(b)),a.m_context.enableVertexAttribArray(f.attributeLocation(c))},this.undoBindVertexData=function(a,b){b=b;var d=a.m_material.shaderProgram();a.m_context.disableVertexAttribArray(d.attributeLocation(c))}},b.source=function(){"use strict";return this instanceof b.source?(b.object.call(this),this.create=function(){},this):new b.source},inherit(b.source,b.object),b.planeSource=function(){"use strict";if(!(this instanceof b.planeSource))return new b.planeSource;b.source.call(this);var a=[0,0,0],c=[1,0,0],d=[0,1,0],e=[0,0,1],f=1,g=1,h=null;this.setOrigin=function(b,c,d){a[0]=b,a[1]=c,a[2]=d},this.setPoint1=function(a,b,d){c[0]=a,c[1]=b,c[2]=d},this.setPoint2=function(a,b,c){d[0]=a,d[1]=b,d[2]=c},this.create=function(){h=new b.geometryData;var i,j,k,l,m,n=[],o=[],p=[],q=[],r=[],s=0,t=0,u=0,v=0,w=[],x=[],y=[],z=[],A=[],B=null,C=null,D=null;for(n.length=3,o.length=2,p.length=3,q.length=3,r.length=3,i=0;3>i;i+=1)p[i]=c[i]-a[i],q[i]=d[i]-a[i];for(l=(f+1)*(g+1),w.length=3*l,x.length=3*l,z.length=2*l,A.length=l,i=0;g+1>i;i+=1)for(o[1]=i/g,j=0;f+1>j;j+=1){for(o[0]=j/f,k=0;3>k;k+=1)n[k]=a[k]+o[0]*p[k]+o[1]*q[k];w[s++]=n[0],w[s++]=n[1],w[s++]=n[2],y[u++]=1,y[u++]=1,y[u++]=1,x[t++]=e[0],x[t++]=e[1],x[t++]=e[2],z[v++]=o[0],z[v++]=o[1]}for(i=0;g>i;i+=1)for(j=0;f>j;j+=1)r[0]=j+i*(f+1),r[1]=r[0]+1,r[2]=r[0]+f+2,r[3]=r[0]+f+1;for(i=0;l>i;i+=1)A[i]=i;return B=new b.triangleStrip,B.setIndices(A),C=b.sourceDataP3fv(),C.pushBack(w),D=b.sourceDataC3fv(),D.pushBack(y),m=b.sourceDataT2fv(),m.pushBack(z),h.addSource(C),h.addSource(D),h.addSource(m),h.addPrimitive(B),h}},inherit(b.planeSource,b.source),b.pointSource=function(){"use strict";if(!(this instanceof b.pointSource))return new b.pointSource;b.source.call(this);var a=this,c=[],d=[],e=[],f=[],g=null;this.getPositions=function(){return c},this.setPositions=function(b){b instanceof Array?c=b:console.log("[ERROR] Invalid data type for positions. Array is required."),a.modified()},this.getColors=function(){return d},this.setColors=function(b){b instanceof Array?d=b:console.log("[ERROR] Invalid data type for colors. Array is required."),a.modified()},this.getSize=function(){return f},this.setSize=function(a){f=a,this.modified()},this.setTextureCoordinates=function(b){b instanceof Array?e=b:console.log("[ERROR] Invalid data type for texture coordinates. Array is required."),a.modified()},this.create=function(){if(g=new b.geometryData,c.length%3!==0)return void console.log("[ERROR] Invalid length of the points array");var a,h,i,j,k,l=c.length/3,m=0,n=[];for(n.length=l,m=0;l>m;m+=1)n[m]=m;if(k=b.sourceDataDf(),l!==f.length)for(m=0;l>m;m+=1)k.pushBack(f);else k.setData(f);return g.addSource(k),a=new b.points,a.setIndices(n),h=b.sourceDataP3fv(),h.pushBack(c),g.addSource(h),d.length>0&&d.length===c.length?(i=b.sourceDataC3fv(),i.pushBack(d),g.addSource(i)):d.length>0&&d.length!==c.length&&console.log("[ERROR] Number of colors are different than number of points"),e.length>0&&e.length===c.length?(j=b.sourceDataT2fv(),j.pushBack(e),g.addSource(j)):e.length>0&&e.length/2!==c.length/3&&console.log("[ERROR] Number of texture coordinates are different than number of points"),g.addPrimitive(a),g}},inherit(b.pointSource,b.source),b.lineSource=function(a,c){"use strict";if(!(this instanceof b.lineSource))return new b.lineSource;b.source.call(this);var d=a,e=c;this.setPositions=function(a){return a instanceof Array?(d=a,this.modified(),!0):(console.log("[ERROR] Invalid data type for positions. Array is required."),!1)},this.setColors=function(a){return a instanceof Array?(e=a,this.modified(),!0):(console.log("[ERROR] Invalid data type for colors. Array is required."),!1)},this.create=function(){if(!d)return void console.log("[error] Invalid positions");if(d.length%3!==0)return void console.log("[error] Line source requires 3d points");if(d.length%3!==0)return void console.log("[ERROR] Invalid length of the points array");var a,c,f,g,h=new b.geometryData,i=d.length/3,j=[];for(j.length=i,a=0;i>a;a+=1)j[a]=a;return c=new b.lines,c.setIndices(j),f=b.sourceDataP3fv(),f.pushBack(d),h.addSource(f),e&&e.length>0&&e.length===d.length?(g=b.sourceDataC3fv(),g.pushBack(e),h.addSource(g)):e&&e.length>0&&e.length!==d.length&&console.log("[error] Number of colors are different than number of points"),h.addPrimitive(c),h}},inherit(b.lineSource,b.source),b.utils=function(){"use strict";return this instanceof b.utils?(b.object.call(this),this):new b.utils},inherit(b.utils,b.object),b.utils.computePowerOfTwo=function(a,b){"use strict";for(b=b||1;a>b;)b*=2;return b},b.utils.createTextureVertexShader=function(a){"use strict";var c=["attribute vec3 vertexPosition;","attribute vec3 textureCoord;","uniform mediump float pointSize;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","varying highp vec3 iTextureCoord;","void main(void)","{","gl_PointSize = pointSize;","gl_Position = projectionMatrix * modelViewMatrix * vec4(vertexPosition, 1.0);"," iTextureCoord = textureCoord;","}"].join("\n");return b.getCachedShader(b.GL.VERTEX_SHADER,a,c)},b.utils.createTextureFragmentShader=function(a){"use strict";var c=["varying highp vec3 iTextureCoord;","uniform sampler2D sampler2d;","uniform mediump float opacity;","void main(void) {","gl_FragColor = vec4(texture2D(sampler2d, vec2(iTextureCoord.s, iTextureCoord.t)).xyz, opacity);","}"].join("\n");return b.getCachedShader(b.GL.FRAGMENT_SHADER,a,c)},b.utils.createRgbaTextureFragmentShader=function(a){"use strict";var c=["varying highp vec3 iTextureCoord;","uniform sampler2D sampler2d;","uniform mediump float opacity;","void main(void) {"," mediump vec4 color = vec4(texture2D(sampler2d, vec2(iTextureCoord.s, iTextureCoord.t)).xyzw);"," color.w *= opacity;"," gl_FragColor = color;","}"].join("\n");return b.getCachedShader(b.GL.FRAGMENT_SHADER,a,c)},b.utils.createVertexShader=function(a){"use strict";var c=["attribute vec3 vertexPosition;","attribute vec3 vertexColor;","uniform mediump float pointSize;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","varying mediump vec3 iVertexColor;","varying highp vec3 iTextureCoord;","void main(void)","{","gl_PointSize = pointSize;","gl_Position = projectionMatrix * modelViewMatrix * vec4(vertexPosition, 1.0);"," iVertexColor = vertexColor;","}"].join("\n");return b.getCachedShader(b.GL.VERTEX_SHADER,a,c)},b.utils.createPointVertexShader=function(a){"use strict";var c=["attribute vec3 vertexPosition;","attribute vec3 vertexColor;","attribute float vertexSize;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","varying mediump vec3 iVertexColor;","varying highp vec3 iTextureCoord;","void main(void)","{","gl_PointSize = vertexSize;","gl_Position = projectionMatrix * modelViewMatrix * vec4(vertexPosition, 1.0);"," iVertexColor = vertexColor;","}"].join("\n");return b.getCachedShader(b.GL.VERTEX_SHADER,a,c)},b.utils.createVertexShaderSolidColor=function(a){"use strict";var c=["attribute vec3 vertexPosition;","uniform mediump float pointSize;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","void main(void)","{","gl_PointSize = pointSize;","gl_Position = projectionMatrix * modelViewMatrix * vec4(vertexPosition, 1.0);","}"].join("\n");return b.getCachedShader(b.GL.VERTEX_SHADER,a,c)},b.utils.createVertexShaderColorMap=function(a,c,d){"use strict";c=c,d=d;var e=["attribute vec3 vertexPosition;","attribute float vertexScalar;","uniform mediump float pointSize;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float lutMin;","uniform float lutMax;","varying mediump float iVertexScalar;","void main(void)","{","gl_PointSize = pointSize;","gl_Position = projectionMatrix * modelViewMatrix * vec4(vertexPosition, 1.0);","iVertexScalar = (vertexScalar-lutMin)/(lutMax-lutMin);","}"].join("\n");return b.getCachedShader(b.GL.VERTEX_SHADER,a,e)},b.utils.createFragmentShader=function(a){"use strict";var c=["varying mediump vec3 iVertexColor;","uniform mediump float opacity;","void main(void) {","gl_FragColor = vec4(iVertexColor, opacity);","}"].join("\n");return b.getCachedShader(b.GL.FRAGMENT_SHADER,a,c)},b.utils.createPhongVertexShader=function(a){"use strict";var c=["attribute highp vec3 vertexPosition;","attribute mediump vec3 vertexNormal;","attribute mediump vec3 vertexColor;","uniform highp mat4 projectionMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 normalMatrix;","varying highp vec4 varPosition;","varying mediump vec3 varNormal;","varying mediump vec3 varVertexColor;","void main(void)","{","varPosition = modelViewMatrix * vec4(vertexPosition, 1.0);","gl_Position = projectionMatrix * varPosition;","varNormal = vec3(normalMatrix * vec4(vertexNormal, 0.0));","varVertexColor = vertexColor;","}"].join("\n");return b.getCachedShader(b.GL.VERTEX_SHADER,a,c)},b.utils.createPhongFragmentShader=function(a){"use strict";var c=["uniform mediump float opacity;","precision mediump float;","varying vec3 varNormal;","varying vec4 varPosition;","varying mediump vec3 varVertexColor;","const vec3 lightPos = vec3(0.0, 0.0,10000.0);","const vec3 ambientColor = vec3(0.01, 0.01, 0.01);","const vec3 specColor = vec3(0.0, 0.0, 0.0);","void main() {","vec3 normal = normalize(varNormal);","vec3 lightDir = normalize(lightPos);","vec3 reflectDir = -reflect(lightDir, normal);","vec3 viewDir = normalize(-varPosition.xyz);","float lambertian = max(dot(lightDir, normal), 0.0);","vec3 color = vec3(0.0);","if(lambertian > 0.0) {"," color = lambertian * varVertexColor;","}","gl_FragColor = vec4(color * opacity, 1.0 - opacity);","}"].join("\n");return b.getCachedShader(b.GL.FRAGMENT_SHADER,a,c)},b.utils.createFragmentShaderSolidColor=function(a,c){"use strict";var d=["uniform mediump float opacity;","void main(void) {","gl_FragColor = vec4("+c[0]+","+c[1]+","+c[2]+", opacity);","}"].join("\n");return b.getCachedShader(b.GL.FRAGMENT_SHADER,a,d)},b.utils.createFragmentShaderColorMap=function(a){"use strict";var c=["varying mediump float iVertexScalar;","uniform sampler2D sampler2d;","uniform mediump float opacity;","void main(void) {","gl_FragColor = vec4(texture2D(sampler2d, vec2(iVertexScalar, 0.0)).xyz, opacity);","}"].join("\n");return b.getCachedShader(b.GL.FRAGMENT_SHADER,a,c)},b.utils.createPointSpritesVertexShader=function(a){"use strict";var c=["attribute vec3 vertexPosition;","attribute vec3 vertexColor;","uniform mediump vec2 pointSize;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float height;","varying mediump vec3 iVertexColor;","varying highp float iVertexScalar;","void main(void)","{","mediump float realPointSize = pointSize.y;","if (pointSize.x > pointSize.y) {"," realPointSize = pointSize.x;}","gl_PointSize = realPointSize ;","iVertexScalar = vertexPosition.z;","gl_Position = projectionMatrix * modelViewMatrix * vec4(vertexPosition.xy, height, 1.0);"," iVertexColor = vertexColor;","}"].join("\n");return b.getCachedShader(b.GL.VERTEX_SHADER,a,c)},b.utils.createPointSpritesFragmentShader=function(a){"use strict";var c=["varying mediump vec3 iVertexColor;","varying highp float iVertexScalar;","uniform sampler2D opacityLookup;","uniform highp float lutMin;","uniform highp float lutMax;","uniform sampler2D scalarsToColors;","uniform int useScalarsToColors;","uniform int useVertexColors;","uniform mediump vec2 pointSize;","uniform mediump float vertexColorWeight;","void main(void) {","mediump vec2 realTexCoord;","if (pointSize.x > pointSize.y) {"," realTexCoord = vec2(1.0, pointSize.y/pointSize.x) * gl_PointCoord;","} else {"," realTexCoord = vec2(pointSize.x/pointSize.y, 1.0) * gl_PointCoord;","}","highp float texOpacity = texture2D(opacityLookup, realTexCoord).w;","if (useScalarsToColors == 1) {"," gl_FragColor = vec4(texture2D(scalarsToColors, vec2((iVertexScalar - lutMin)/(lutMax - lutMin), 0.0)).xyz, texOpacity);","} else if (useVertexColors == 1) {"," gl_FragColor = vec4(iVertexColor, texOpacity);","} else {"," gl_FragColor = vec4(texture2D(opacityLookup, realTexCoord).xyz, texOpacity);","}}"].join("\n");return b.getCachedShader(b.GL.FRAGMENT_SHADER,a,c)},b.utils.createTextureMaterial=function(a,c){"use strict";var d,e=new b.material,f=new b.blend,g=new b.shaderProgram,h=b.utils.createTextureVertexShader(b.GL),i=null,j=new b.vertexAttribute("vertexPosition"),k=new b.vertexAttribute("textureCoord"),l=new b.floatUniform("pointSize",5),m=new b.projectionUniform("projectionMatrix"),n=new b.uniform(b.GL.INT,"sampler2d"),o=null;return d=void 0!==c?new b.modelViewOriginUniform("modelViewMatrix",c):new b.modelViewUniform("modelViewMatrix"),n.set(0),g.addVertexAttribute(j,b.vertexAttributeKeys.Position),g.addVertexAttribute(k,b.vertexAttributeKeys.TextureCoordinate),g.addUniform(l),g.addUniform(d),g.addUniform(m),i=a?b.utils.createRgbaTextureFragmentShader(b.GL):b.utils.createTextureFragmentShader(b.GL),o=new b.floatUniform("opacity",1),g.addUniform(o),g.addShader(i),g.addShader(h),e.addAttribute(g),e.addAttribute(f),e},b.utils.createGeometryMaterial=function(){"use strict";var a=new b.material,c=new b.shaderProgram,d=5,e=1,f=b.utils.createVertexShader(b.GL),g=b.utils.createFragmentShader(b.GL),h=new b.vertexAttribute("vertexPosition"),i=new b.vertexAttribute("vertexColor"),j=new b.floatUniform("pointSize",d),k=new b.floatUniform("opacity",e),l=new b.modelViewUniform("modelViewMatrix"),m=new b.projectionUniform("projectionMatrix");return c.addVertexAttribute(h,b.vertexAttributeKeys.Position),c.addVertexAttribute(i,b.vertexAttributeKeys.Color),c.addUniform(j),c.addUniform(k),c.addUniform(l),c.addUniform(m),c.addShader(g),c.addShader(f),a.addAttribute(c),a},b.utils.createPointGeometryMaterial=function(a){"use strict";a=void 0===a?1:a;var c=new b.material,d=new b.blend,e=new b.shaderProgram,f=b.utils.createPointVertexShader(b.GL),g=b.utils.createFragmentShader(b.GL),h=new b.vertexAttribute("vertexPosition"),i=new b.vertexAttribute("vertexColor"),j=new b.vertexAttribute("vertexSize"),k=new b.floatUniform("opacity",a),l=new b.modelViewUniform("modelViewMatrix"),m=new b.projectionUniform("projectionMatrix");return e.addVertexAttribute(h,b.vertexAttributeKeys.Position),e.addVertexAttribute(i,b.vertexAttributeKeys.Color),e.addVertexAttribute(j,b.vertexAttributeKeys.Scalar),e.addUniform(k),e.addUniform(l),e.addUniform(m),e.addShader(g),e.addShader(f),c.addAttribute(e),c.addAttribute(d),c},b.utils.createPhongMaterial=function(){"use strict";var a=new b.material,c=new b.shaderProgram,d=b.utils.createPhongVertexShader(b.GL),e=b.utils.createPhongFragmentShader(b.GL),f=new b.vertexAttribute("vertexPosition"),g=new b.vertexAttribute("vertexNormal"),h=new b.vertexAttribute("vertexColor"),i=new b.floatUniform("opacity",1),j=new b.modelViewUniform("modelViewMatrix"),k=new b.normalMatrixUniform("normalMatrix"),l=new b.projectionUniform("projectionMatrix");return c.addVertexAttribute(f,b.vertexAttributeKeys.Position),c.addVertexAttribute(g,b.vertexAttributeKeys.Normal),c.addVertexAttribute(h,b.vertexAttributeKeys.Color),c.addUniform(i),c.addUniform(j),c.addUniform(l),c.addUniform(k),c.addShader(e),c.addShader(d),a.addAttribute(c),a},b.utils.createColorMaterial=function(){"use strict";var a=new b.material,c=new b.blend,d=new b.shaderProgram,e=b.utils.createVertexShader(b.GL),f=b.utils.createFragmentShader(b.GL),g=new b.vertexAttribute("vertexPosition"),h=new b.vertexAttribute("textureCoord"),i=new b.vertexAttribute("vertexColor"),j=new b.floatUniform("pointSize",5),k=new b.floatUniform("opacity",1),l=new b.modelViewUniform("modelViewMatrix"),m=new b.projectionUniform("projectionMatrix");return d.addVertexAttribute(g,b.vertexAttributeKeys.Position),d.addVertexAttribute(i,b.vertexAttributeKeys.Color),d.addVertexAttribute(h,b.vertexAttributeKeys.TextureCoordinate),d.addUniform(j),d.addUniform(k),d.addUniform(l),d.addUniform(m),d.addShader(f),d.addShader(e),a.addAttribute(d),a.addAttribute(c),a},b.utils.createColorMappedMaterial=function(a){"use strict";a||(a=new b.lookupTable);var c=a.range(),d=new b.material,e=new b.blend,f=new b.shaderProgram,g=b.utils.createVertexShaderColorMap(b.GL,c[0],c[1]),h=b.utils.createFragmentShaderColorMap(b.GL),i=new b.vertexAttribute("vertexPosition"),j=new b.vertexAttribute("vertexScalar"),k=new b.floatUniform("pointSize",5),l=new b.floatUniform("opacity",1),m=new b.floatUniform("lutMin",c[0]),n=new b.floatUniform("lutMax",c[1]),o=new b.modelViewUniform("modelViewMatrix"),p=new b.projectionUniform("projectionMatrix"),q=new b.uniform(b.GL.FLOAT,"sampler2d"),r=a;return q.set(0),f.addVertexAttribute(i,b.vertexAttributeKeys.Position),f.addVertexAttribute(j,b.vertexAttributeKeys.Scalar),f.addUniform(k),f.addUniform(l),f.addUniform(m),f.addUniform(n),f.addUniform(o),f.addUniform(p),f.addShader(h),f.addShader(g),d.addAttribute(f),d.addAttribute(e),d.addAttribute(r),d},b.utils.updateColorMappedMaterial=function(a,b){"use strict";if(!a)return void console.log("[warning] Invalid material. Nothing to update.");if(!b)return void console.log("[warning] Invalid lookup table. Nothing to update.");var c=a.shaderProgram().uniform("lutMin"),d=a.shaderProgram().uniform("lutMax");c.set(b.range()[0]),d.set(b.range()[1]),a.setAttribute(b)},b.utils.createSolidColorMaterial=function(a){"use strict";a||(a=[1,1,1]);var c=new b.material,d=new b.blend,e=new b.shaderProgram,f=b.utils.createVertexShaderSolidColor(b.GL),g=b.utils.createFragmentShaderSolidColor(b.GL,a),h=new b.vertexAttribute("vertexPosition"),i=new b.floatUniform("pointSize",5),j=new b.floatUniform("opacity",1),k=new b.modelViewUniform("modelViewMatrix"),l=new b.projectionUniform("projectionMatrix");return e.addVertexAttribute(h,b.vertexAttributeKeys.Position),e.addUniform(i),e.addUniform(j),e.addUniform(k),e.addUniform(l),e.addShader(g),e.addShader(f),c.addAttribute(e),c.addAttribute(d),c},b.utils.createPointSpritesMaterial=function(a,c){"use strict";var d=void 0===c?[0,1]:c.range(),e=new b.material,f=new b.blend,g=new b.shaderProgram,h=b.utils.createPointSpritesVertexShader(b.GL),i=b.utils.createPointSpritesFragmentShader(b.GL),j=new b.vertexAttribute("vertexPosition"),k=new b.vertexAttribute("vertexColor"),l=new b.floatUniform("height",0),m=new b.floatUniform("vertexColorWeight",0),n=new b.floatUniform("lutMin",d[0]),o=new b.floatUniform("lutMax",d[1]),p=new b.modelViewUniform("modelViewMatrix"),q=new b.projectionUniform("projectionMatrix"),r=new b.uniform(b.GL.INT,"opacityLookup"),s=new b.uniform(b.GL.INT,"scalarsToColors"),t=new b.uniform(b.GL.INT,"useScalarsToColors"),u=new b.uniform(b.GL.INT,"useVertexColors"),v=new b.uniform(b.GL.FLOAT_VEC2,"pointSize"),w=new b.texture;return r.set(0),s.set(1),t.set(0),u.set(0),v.set([1,1]),g.addVertexAttribute(j,b.vertexAttributeKeys.Position),g.addVertexAttribute(k,b.vertexAttributeKeys.Color),g.addUniform(l),g.addUniform(m),g.addUniform(p),g.addUniform(q),g.addUniform(r),g.addUniform(u),g.addUniform(t),g.addUniform(v),g.addShader(i),g.addShader(h),e.addAttribute(g),e.addAttribute(f),c&&(g.addUniform(s),t.set(1),g.addUniform(n),g.addUniform(o),c.setTextureUnit(1),e.addAttribute(c)),w.setImage(a),w.setTextureUnit(0),e.addAttribute(w),e},b.utils.createPlane=function(a,c,d,e,f,g,h,i,j){"use strict";var k=new b.mapper,l=new b.planeSource,m=b.utils.createGeometryMaterial(),n=new b.actor;return l.setOrigin(a,c,d),l.setPoint1(e,f,g),l.setPoint2(h,i,j),k.setGeometryData(l.create()),n.setMapper(k),n.setMaterial(m),n},b.utils.createTexturePlane=function(a,c,d,e,f,g,h,i,j,k){"use strict";var l=new b.mapper,m=new b.planeSource,n=b.utils.createTextureMaterial(k,[a,c,d]),o=new b.actor;return m.setPoint1(e-a,f-c,g-d),m.setPoint2(h-a,i-c,j-d),l.setGeometryData(m.create()),o.setMapper(l),o.setMaterial(n),o},b.utils.createPoints=function(a,c,d,e,f){"use strict";if(!a)return console.log("[ERROR] Cannot create points without positions"),null;f=void 0===f?1:f;var g=new b.mapper,h=new b.pointSource,i=b.utils.createPointGeometryMaterial(f),j=new b.actor;return h.setPositions(a),d&&h.setColors(d),e&&h.setTextureCoordinates(e),c?h.setSize(c):h.setSize(1),g.setGeometryData(h.create()),j.setMapper(g),j.setMaterial(i),j},b.utils.createPointSprites=function(a,c,d,e){"use strict";if(!a)return console.log("[ERROR] Point sprites requires an image"),null;if(!c)return console.log("[ERROR] Cannot create points without positions"),null;var f=new b.mapper,g=new b.pointSource,h=b.utils.createPointSpritesMaterial(a),i=new b.actor;return g.setPositions(c),d&&g.setColors(d),e&&g.setTextureCoordinates(e),f.setGeometryData(g.create()),i.setMapper(f),i.setMaterial(h),i},b.utils.createLines=function(a,c){"use strict";if(!a)return console.log("[ERROR] Cannot create points without positions"),null;var d=new b.mapper,e=new b.lineSource,f=b.utils.createGeometryMaterial(),g=new b.actor;return e.setPositions(a),c&&e.setColors(c),d.setGeometryData(e.create()),g.setMapper(d),g.setMaterial(f),g},b.utils.createColorLegend=function(a,c,d,e,f,g,h){"use strict";function i(a,c,d){if(!c)return void console.log("[error] Create labels requires positions (x,y,z) array");if(c.length%3!==0)return void console.log("[error] Create labels require positions array contain 3d points");if(!d)return void console.log("[error] Create labels requires Valid range");var e,f=null,g=b.utils.computePowerOfTwo(48),h=0,i=[],j=[],k=[],l=[],m=c[6]-c[0],n=4;for(j.length=3,k.length=3,l.length=3,e=0;2>e;e+=1)h=e*(c.length-3),j[0]=c[h]-m,j[1]=c[h+1]-2*m,j[2]=c[h+2],k[0]=c[h]+m,k[1]=j[1],k[2]=j[2],l[0]=j[0],l[1]=c[1],l[2]=j[2],f=b.utils.createTexturePlane(j[0],j[1],j[2],k[0],k[1],k[2],l[0],l[1],l[2],!0),
f.setReferenceFrame(b.boundingObject.ReferenceFrame.Absolute),f.material().setBinNumber(b.material.RenderBin.Overlay),f.material().addAttribute(b.utils.create2DTexture(d[e].toFixed(2).toString(),12,null)),i.push(f);return j[0]=.5*(c[0]+c[c.length-3]-g),j[1]=c[1]+n,j[2]=c[2],k[0]=j[0]+g,k[1]=j[1],k[2]=j[2],l[0]=j[0],l[1]=j[1]+g,l[2]=j[2],f=b.utils.createTexturePlane(j[0],j[1],j[2],k[0],k[1],k[2],l[0],l[1],l[2],!0),f.setReferenceFrame(b.boundingObject.ReferenceFrame.Absolute),f.material().setBinNumber(b.material.RenderBin.Overlay),f.material().addAttribute(b.utils.create2DTexture(a,24,null)),i.push(f),i}function j(a,b,c,d,e,f,g,h,j,k,l,m,n,o,p){p=p;var q=j-f,r=null,s=q/m,t=[],u=[];for(r=0;m>=r;r+=1)t.push(f+s*r),t.push(g),t.push(h),t.push(f+s*r),t.push(g+o),t.push(h);return u=u.concat(i(a,t,b.range()))}if(!c)return console.log("[error] Invalid lookup table"),[];var k=d[0]+e,l=d[1],m=0,n=d[0],o=d[1]+f,p=0,q=[],r=null,s=null,t=b.groupNode();return r=b.utils.createTexturePlane(d[0],d[1],d[2],k,l,m,n,o,p,!0),s=r.material(),s.addAttribute(c),r.setMaterial(s),t.addChild(r),r.material().setBinNumber(b.material.RenderBin.Overlay),r.setReferenceFrame(b.boundingObject.ReferenceFrame.Absolute),q.push(r),q=q.concat(j(a,c,d[0],d[1],d[1],n,l,m,k,l,m,g,h,5,3))},b.utils.create2DTexture=function(a,c,d,e,f,g,h){"use strict";var i=document.getElementById("textRendering"),j=null,k=b.texture();return e=e||"sans-serif",f=f||"center",g=g||"bottom","undefined"==typeof h&&(h=!0),i||(i=document.createElement("canvas")),j=i.getContext("2d"),i.setAttribute("id","textRendering"),i.style.display="none",i.height=b.utils.computePowerOfTwo(8*c),i.width=i.height,j.fillStyle="rgba(0, 0, 0, 0)",j.fillRect(0,0,j.canvas.width,j.canvas.height),j.fillStyle="rgba(200, 85, 10, 1.0)",j.textAlign=f,j.textBaseline=g,j.font=4*c+"px "+e,h&&(j.font="bold "+j.font),j.fillText(a,i.width/2,i.height/2,i.width),k.setImage(i),k.updateDimensions(),k},b.picker=function(){"use strict";if(!(this instanceof b.picker))return new b.picker;b.object.call(this);var a=[];return this.getActors=function(){return a},this.pick=function(b,c,d){if(void 0===b)return 0;if(void 0===c)return 0;if(void 0===d)return 0;a=[];var e,f,g,h,i,j,k,l,m,n,o,p=d.camera(),q=d.width(),r=d.height(),s=p.focalPoint(),t=vec4.fromValues(s[0],s[1],s[2],1),u=d.worldToDisplay(t,p.viewMatrix(),p.projectionMatrix(),q,r),v=vec4.fromValues(b,c,u[2],1),w=d.displayToWorld(v,p.viewMatrix(),p.projectionMatrix(),q,r),x=p.position(),y=[];for(g=0;3>g;g+=1)y[g]=w[g]-x[g];for(e=d.sceneRoot().children(),f=0,g=0;g<e.length;g+=1)if(o=e[g],o.visible()===!0){if(h=o.bounds(),y[0]>=0?(i=(h[0]-x[0])/y[0],j=(h[1]-x[0])/y[0]):(i=(h[1]-x[0])/y[0],j=(h[0]-x[0])/y[0]),y[1]>=0?(k=(h[2]-x[1])/y[1],l=(h[3]-x[1])/y[1]):(k=(h[3]-x[1])/y[1],l=(h[2]-x[1])/y[1]),i>l||k>j)continue;if(k>i&&(i=k),j>l&&(j=l),y[2]>=0?(m=(h[4]-x[2])/y[2],n=(h[5]-x[2])/y[2]):(m=(h[5]-x[2])/y[2],n=(h[4]-x[2])/y[2]),i>n||m>j)continue;m>i&&(i=m),j>n&&(j=n),a[f]=o,f+=1}return f},this},inherit(b.picker,b.object),b.shapefileReader=function(){"use strict";if(!(this instanceof b.shapefileReader))return new b.shapefileReader;var a=this,c=0,d=1,e=5,f=3;return this.int8=function(a,b){return a.charCodeAt(b)},this.bint32=function(a,b){return((255&a.charCodeAt(b))<<24)+((255&a.charCodeAt(b+1))<<16)+((255&a.charCodeAt(b+2))<<8)+(255&a.charCodeAt(b+3))},this.lint32=function(a,b){return((255&a.charCodeAt(b+3))<<24)+((255&a.charCodeAt(b+2))<<16)+((255&a.charCodeAt(b+1))<<8)+(255&a.charCodeAt(b))},this.bint16=function(a,b){return((255&a.charCodeAt(b))<<8)+(255&a.charCodeAt(b+1))},this.lint16=function(a,b){return((255&a.charCodeAt(b+1))<<8)+(255&a.charCodeAt(b))},this.ldbl64=function(a,b){var c=255&a.charCodeAt(b),d=255&a.charCodeAt(b+1),e=255&a.charCodeAt(b+2),f=255&a.charCodeAt(b+3),g=255&a.charCodeAt(b+4),h=255&a.charCodeAt(b+5),i=255&a.charCodeAt(b+6),j=255&a.charCodeAt(b+7),k=1-2*(j>>7),l=((127&j)<<4)+((240&i)>>4)-1023,m=(15&i)*Math.pow(2,48)+h*Math.pow(2,40)+g*Math.pow(2,32)+f*Math.pow(2,24)+e*Math.pow(2,16)+d*Math.pow(2,8)+c;return k*(1+m*Math.pow(2,-52))*Math.pow(2,l)},this.lfloat32=function(a,b){var c=255&a.charCodeAt(b),d=255&a.charCodeAt(b+1),e=255&a.charCodeAt(b+2),f=255&a.charCodeAt(b+3),g=1-2*(f>>7),h=((127&f)<<1)+((254&e)>>7)-127,i=(127&e)*Math.pow(2,16)+d*Math.pow(2,8)+c;return g*(1+i*Math.pow(2,-23))*Math.pow(2,h)},this.str=function(a,b,c){for(var d=[],e=b;b+c>e;){var f=a[e];if(0===f.charCodeAt(0))break;d.push(f),e+=1}return d.join("")},this.readHeader=function(a){var b=this.bint32(a,0),c=this.bint32(a,24),d=this.lint32(a,28),e=this.lint32(a,32);return{code:b,length:c,version:d,shapetype:e}},this.loadShx=function(b){for(var c=[],d=function(d){return c.push(2*a.bint32(b,d)),d+8},e=100;e<b.length;)e=d(e);return c},this.Shapefile=function(a){var b=a.path;$.ajax({url:b+".shx",mimeType:"text/plain; charset=x-user-defined",success:function(c){var d=this.loadShx(c);$.ajax({url:b+".shp",mimeType:"text/plain; charset=x-user-defined",success:function(c){$.ajax({url:b+".dbf",mimeType:"text/plain; charset=x-user-defined",success:function(b){var e=this.loadShp(c,b,d,a);a.success(e)}})}})}})},this.localShapefile=function(b){var c=b.shx,d=b.shp,e=b.dbf,f=new FileReader;f.onloadend=function(){var c=a.loadShx(f.result),g=new FileReader;g.onloadend=function(){var d=g.result,f=new FileReader;f.onloadend=function(){var e=f.result,g=a.loadShp(d,e,c,b);b.success(g)},f.readAsBinaryString(e)},g.readAsBinaryString(d)},f.readAsBinaryString(c)},this.loadDBF=function(b){var c=function(c){var d=a.str(b,c,10),e=a.str(b,c+11,1),f=a.int8(b,c+16);return{name:d,type:e,length:f}},d=a.int8(b,0);if(4===d)throw"Level 7 dBASE not supported";for(var e=a.lint32(b,4),f=a.lint16(b,8),g=a.lint16(b,10),h=32,i=32,j=h,k=[];f-1>j;)k.push(c(j)),j+=i;for(var l=[],m=f;f+e*g>m;){var n=a.str(b,m,1);if("*"===n)m+=g;else{m+=1;for(var o={},p=0;p<k.length;p+=1){var q,r=k[p];"C"===r.type?q=a.str(b,m,r.length).trim():"N"===r.type&&(q=parseFloat(a.str(b,m,r.length))),m+=r.length,o[r.name]=q}l.push(o)}}return l},this.loadShp=function(b,g,h,i){i=i;var j,k=[],l=function(c,d,e){for(var f=[],g=e-1;g>=d;g-=1){var h=a.ldbl64(b,c+16*g),i=a.ldbl64(b,c+16*g+8);f.push([h,i])}return f},m=function(g){var h,i,j,m,n,o,p,q,r,s=g+8,t=a.lint32(b,s);if(t===c)console.log("NULL Shape");else if(t===d){var u=a.ldbl64(b,s+4),v=a.ldbl64(b,s+12);k.push({type:"Point",attr:{},geom:[[u,v]]})}else if(t===e){for(h=a.lint32(b,s+36),i=a.lint32(b,s+40),j=g+52,m=g+52+4*h,r=[],n=0;h>n;n+=1)o=a.lint32(b,j+4*n),p=h>n+1?a.lint32(b,j+4*(n+1)):i,q=l(m,o,p),r.push(q);k.push({type:"Polygon",attr:{},geom:[r]})}else{if(t!==f)throw"Not Implemented: "+t;for(h=a.lint32(b,s+36),i=a.lint32(b,s+40),j=g+52,m=g+52+4*h,r=[],n=0;h>n;n+=1)o=a.lint32(b,j+4*n),p=h>n+1?a.lint32(b,j+4*(n+1)):i,q=l(m,o,p),r.push(q);k.push({type:"Polyline",attr:{},geom:[r]})}},n=this.loadDBF(g);for(j=0;j<h.length;j+=1){var o=h[j];m(o)}var p=[];for(j=0;j<k.length;j+=1){var q=k[j];q.attr=n[j],p.push(q)}return p},this},b.vtkReader=function(){"use strict";if(!(this instanceof b.vtkReader))return new b.vtkReader;var a=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","+","/"],c=[],d={},e=0,f=null,g=null,h=-1,i="",j=0,k=0,l=null,m=0;if(0===c.length)for(m=0;m<a.length;m+=1)c[a[m]]=m;return this.ntos=function(a){var b;return b=a.toString(16),1===b.length&&(b="0"+b),b="%"+b,unescape(b)},this.readReverseBase64=function(){var a;if(!i)return h;for(;;){if(j>=i.length)return h;if(a=i.charAt(j),j+=1,c[a])return c[a];if("A"===a)return 0}return h},this.decode64=function(a){var b="",c=new Array(4),d=!1;for(i=a,j=0;!d&&(c[0]=this.readReverseBase64())!==h&&(c[1]=this.readReverseBase64())!==h;)c[2]=this.readReverseBase64(),c[3]=this.readReverseBase64(),b+=this.ntos(c[0]<<2&255|c[1]>>4),c[2]!==h?(b+=this.ntos(c[1]<<4&255|c[2]>>2),c[3]!==h?b+=this.ntos(c[2]<<6&255|c[3]):d=!0):d=!0;return b},this.readNumber=function(a){var b=a[k++]+(a[k++]<<8)+(a[k++]<<16)+(a[k++]<<24);return b},this.readF3Array=function(a,b){var c,d=4*a*3,e=new Int8Array(d),f=null;for(c=0;d>c;c+=1)e[c]=b[k],k+=1;return f=new Float32Array(e.buffer)},this.readColorArray=function(a,b,c){var d,e=0,f=new Array(3*a);for(d=0;a>d;d+=1)f[e++]=b[k++]/255,f[e++]=b[k++]/255,f[e++]=b[k++]/255,k++;c.insert(f)},this.parseObject=function(a){var c,d,e,f,g,h,i,j,n,o,p,q=new b.geometryData,r=b.mapper(),s=[],t=null,u=null,v=null,w=null;for(u=atob(a.data),m=0;m<u.length;m+=1)s[m]=255&u.charCodeAt(m);if(k=0,c=this.readNumber(s),t=String.fromCharCode(s[k]),k+=1,q.setName(t),"L"===t)v=this.parseLineData(q,s),w=b.utils.createGeometryMaterial();else if("M"===t)v=this.parseMeshData(q,s),w=b.utils.createPhongMaterial();else if("P"===t)v=this.parsePointData(q,s),w=b.utils.createGeometryMaterial();else{if("C"===t){for(e=this.parseColorMapData(q,s,c),i=[],m=0;m<e.colors.length;m+=1)i.push(e.colors[m][1]),i.push(e.colors[m][2]),i.push(e.colors[m][3]),i.push(255*e.colors[m][0]);return h=new b.lookupTable,h.setColorTable(i),j=l.renderWindow().windowSize(),n=e.size[0]*j[0],o=e.size[1]*j[1],p=[e.position[0]*j[0],(1-e.position[1])*j[1],0],p[1]=p[1]-o,o=30,b.utils.createColorLegend(e.title,h,p,n,o,3,0)}console.log("Ignoring unrecognized encoded data type "+t)}return r.setGeometryData(q),a.hasTransparency&&(f=w.shaderProgram(),g=f.uniform("opacity"),console.log("opacity ",a.opacity),g.set(a.opacity),w.setBinNumber(1e3)),d=b.actor(),d.setMapper(r),d.setMaterial(w),d.setMatrix(mat4.transpose(mat4.create(),v)),[d]},this.parseLineData=function(a,c){var d,e,f,g,h,i,j,l,m=null,n=null,o=null,p=mat4.create(),q=null,r=0;for(e=this.readNumber(c),q=new Array(3*e),m=new b.sourceDataP3fv,f=this.readF3Array(e,c),l=0;e>l;l+=1)q[r++]=f[3*l],q[r++]=f[3*l+1],q[r++]=f[3*l+2];for(m.insert(q),a.addSource(m),n=new b.sourceDataC3fv,this.readColorArray(e,c,n),a.addSource(n),o=new b.lines,a.addPrimitive(o),d=this.readNumber(c),g=new Int8Array(2*d),l=0;2*d>l;l+=1)g[l]=c[k],k+=1;for(h=new Uint16Array(g.buffer),o.setIndices(h),o.setPrimitiveType(b.GL.LINES),i=64,g=new Int8Array(i),l=0;i>l;l+=1)g[l]=c[k],k+=1;return j=new Float32Array(g.buffer),mat4.copy(p,j),p},this.parseMeshData=function(a,c){var d,e,f,g,h,i,j,l,m=null,n=null,o=null,p=mat4.create(),q=null,r=null,s=0;for(e=this.readNumber(c),r=new Array(6*e),m=new b.sourceDataP3N3f,f=this.readF3Array(e,c),o=this.readF3Array(e,c),l=0;e>l;l+=1)r[s++]=f[3*l],r[s++]=f[3*l+1],r[s++]=f[3*l+2],r[s++]=o[3*l],r[s++]=o[3*l+1],r[s++]=o[3*l+2];for(m.insert(r),a.addSource(m),n=new b.sourceDataC3fv,this.readColorArray(e,c,n),a.addSource(n),g=[],q=new b.triangles,d=this.readNumber(c),g=new Int8Array(2*d),l=0;2*d>l;l+=1)g[l]=c[k],k+=1;for(h=new Uint16Array(g.buffer),q.setIndices(h),a.addPrimitive(q),i=64,g=new Int8Array(i),l=0;i>l;l+=1)g[l]=c[k],k+=1;return j=new Float32Array(g.buffer),mat4.copy(p,j),p},this.parsePointData=function(a,c){var d,e,f,g,h,i,j=mat4.create(),l=null,n=null,o=null,p=null,q=0;for(d=this.readNumber(c),p=new Array(3*d),l=new b.sourceDataP3fv,e=this.readF3Array(d,c),f=new Uint16Array(d),m=0;d>m;m+=1)f[m]=m,p[q++]=e[3*m],p[q++]=e[3*m+1],p[q++]=e[3*m+2];for(l.insert(p),a.addSource(l),n=new b.sourceDataC3fv,this.readColorArray(d,c,n),a.addSource(n),o=new b.points,o.setIndices(f),a.addPrimitive(o),h=64,g=new Int8Array(h),m=0;h>m;m+=1)g[m]=c[k],k+=1;return i=new Float32Array(g.buffer),mat4.copy(j,i),j},this.parseColorMapData=function(a,b,c){var d,e,f,g,h,i={};for(i.numOfColors=c,e=8,d=new Int8Array(e),g=0;e>g;g+=1)d[g]=b[k],k+=1;for(i.position=new Float32Array(d.buffer),e=8,d=new Int8Array(e),g=0;e>g;g+=1)d[g]=b[k],k+=1;for(i.size=new Float32Array(d.buffer),i.colors=[],h=0;h<i.numOfColors;h+=1){for(d=new Int8Array(4),g=0;4>g;g+=1)d[g]=b[k],k+=1;f=[new Float32Array(d.buffer)[0],b[k++],b[k++],b[k++]],i.colors[h]=f}for(i.orientation=b[k++],i.numOfLabels=b[k++],i.title="";k<b.length;)i.title+=String.fromCharCode(b[k++]);return i},this.parseSceneMetadata=function(a,b){var c,d,e,h=f.Renderers[b],i=a.camera();d=(h.size[0]-h.origin[0])*g.width,e=(h.size[1]-h.origin[1])*g.height,a.resize(d,e),i.setCenterOfRotation([h.LookAt[1],h.LookAt[2],h.LookAt[3]]),i.setViewAngleDegrees(h.LookAt[0]),i.setPosition(h.LookAt[7],h.LookAt[8],h.LookAt[9]),i.setFocalPoint(h.LookAt[1],h.LookAt[2],h.LookAt[3]),i.setViewUpDirection(h.LookAt[4],h.LookAt[5],h.LookAt[6]),0===b?(c=h.Background1,a.setBackgroundColor(c[0],c[1],c[2],1)):a.setResizable(!1),a.setLayer(b)},this.initScene=function(){var a,b;if(null===f)return l;for(b=f.Renderers.length-1;b>=0;b-=1)a=this.getRenderer(b),this.parseSceneMetadata(a,b);return l},this.createViewer=function(a){var c;return null===l&&(g=a,l=b.viewer(a),l.init(),l.renderWindow().removeRenderer(l.renderWindow().activeRenderer()),l.renderWindow().addRenderer(new b.depthPeelRenderer),d[0]=l.renderWindow().activeRenderer(),l.renderWindow().resize(a.width,a.height),c=b.pvwInteractorStyle(),l.setInteractorStyle(c)),l},this.deleteViewer=function(){d={},l=null},this.updateCanvas=function(a){return g=a,l.renderWindow().resize(a.width,a.height),l},this.numObjects=function(){return e},this.getRenderer=function(a){var c;return c=d[a],(null===c||"undefined"==typeof c)&&(c=new b.renderer,c.setResetScene(!1),c.setResetClippingRange(!1),l.renderWindow().addRenderer(c),0!==a&&c.camera().setClearMask(b.GL.DepthBufferBit),d[a]=c),c},this.setVtkScene=function(a){f=a},this},b.DataBuffers=function(a){"use strict";if(!(this instanceof b.DataBuffers))return new b.DataBuffers(a);var c,d={};c=a||0===a?a:256;var e=0,f=function(a,b,c,d){if(!a)throw"No destination";c||(c=0),d||(d=b.length);for(var e=0;d>e;e+=1)a[c+e]=b[e]},g=function(a){var b=c;for(a>2*b&&(b=a);a>b;)b*=2;c=b;for(var e in d)if(d.hasOwnProperty(e)){var g=new Float32Array(b*d[e].len),h=d[e].array;f(g,h),d[e].array=g,d[e].dirty=!0}};this.create=function(a,b){if(!b||0>b)throw"Length of buffer must be a positive integer";var e=new Float32Array(c*b);return d[a]={array:e,len:b,dirty:!1},d[a].array},this.alloc=function(a){e+a>=c&&g(e+a);var b=e;return e+=a,b},this.get=function(a){return d[a].array},this.write=function(a,b,e,g){if(e+g>c)throw"Write would exceed buffer size";f(d[a].array,b,e*d[a].len,g*d[a].len),d[a].dirty=!0},this.repeat=function(a,b,e,g){if(e+g>c)throw"Repeat would exceed buffer size";for(var h=0;g>h;h+=1)f(d[a].array,b,(e+h)*d[a].len,d[a].len);d[a].dirty=!0},this.count=function(){return e},this.data=function(a){return d[a].array}},b});
//# sourceMappingURL=vgl.min.js.map