var BABYLON;!(function(e){var t=(function(){function t(){}return t.GLTF=function(t,r){var s=r.replace(/\.[^\/.]+$/,"");return new e._GLTF2Exporter(t)._generateGLTF(s)},t.GLB=function(t,r){var s=r.replace(/\.[^\/.]+$/,"");return new e._GLTF2Exporter(t)._generateGLB(s)},t})();e.GLTF2Export=t})(BABYLON||(BABYLON={}));var BABYLON;!(function(e){var t=(function(){function t(e){this.asset={generator:"BabylonJS",version:"2.0"},this.babylonScene=e,this.bufferViews=new Array,this.accessors=new Array,this.meshes=new Array,this.scenes=new Array,this.nodes=new Array;var t=0;t=this.createScene(this.babylonScene,t),this.totalByteLength=t}return t.prototype.createBufferView=function(e,t,r){var s={buffer:e,byteLength:r};return t>0&&(s.byteOffset=t),s},t.prototype.createAccessor=function(e,t,r,s,i,n,a){var o={name:t,bufferView:e,componentType:s,count:i,type:r};return n&&(o.min=n),a&&(o.max=a),o},t.prototype.calculateMinMax=function(e,t,r,s,i){var n=[1/0,1/0,1/0],a=[-(1/0),-(1/0),-(1/0)],o=t+r;if(r>0)for(var f=t;fa[u]&&(a[u]=e[c]),++c;return{min:n,max:a}},t.prototype.writeAttributeData=function(t,r,s,i,n,a,o){var f=n,c=r.verticesStart+r.verticesCount,u=0;switch(t){case e.VertexBuffer.PositionKind:case e.VertexBuffer.NormalKind:for(var h=r.verticesStart;h0&&(i.scene=0),e||(s.uri=t+".bin"),r?JSON.stringify(i,null,2):JSON.stringify(i)},t.prototype._generateGLTF=function(t){var r=this.generateJSON(!1,t,!0),s=this.generateBinary(),i=new Blob([s],{type:"application/octet-stream"}),n=t+".gltf",a=t+".bin",o=new e._GLTFData;return o._glTFFiles[n]=r,o._glTFFiles[a]=i,o},t.prototype.generateBinary=function(){var e=0,t=new ArrayBuffer(this.totalByteLength),r=new DataView(t);return e=this.createScene(this.babylonScene,e,r),t},t.prototype._generateGLB=function(t){var r=this.generateJSON(!0),s=this.generateBinary(),i=t+".glb",n=r.length,a=n%4,o=s.byteLength%4,f=0===a?a:4-a,c=0===o?o:4-o,u=28+n+f+s.byteLength+c,h=new ArrayBuffer(12),l=new DataView(h);l.setUint32(0,1179937895,!0),l.setUint32(4,2,!0),l.setUint32(8,u,!0);var v=new ArrayBuffer(8+n+f),g=new DataView(v);g.setUint32(0,n+f,!0),g.setUint32(4,1313821514,!0);for(var p=new Uint8Array(v,8),V=0;V0)if(n){for(var K=o.getIndices(),U=f.indexStart,_=f.indexCount+U,E=s,P=U;P<_;P+=3)n.setUint32(E,K[P],!0),E+=4,n.setUint32(E,K[P+1],!0),E+=4,n.setUint32(E,K[P+2],!0),E+=4;var g=4*f.indexCount;s+=g}else{var G=f.indexCount,g=4*G,p=this.createBufferView(0,s,g);s+=g,this.bufferViews.push(p);var B=this.createAccessor(this.bufferViews.length-1,"Indices","SCALAR",5125,G);this.accessors.push(B),c.indices=this.accessors.length-1}o.material,t.primitives.push(c)}return s},t.prototype.createScene=function(e,t,r){if(e.meshes.length>0){for(var s=e.meshes,i={nodes:new Array},n=0;n