var BABYLON;!(function(e){var t=(function(){function t(){}return t.GLTF=function(t,r,i){var a=r.replace(/\.[^\/.]+$/,""),s=new e.GLTF2._Exporter(t,i);if(t.isReady)return s._generateGLTF(a);throw new Error("glTF Serializer: Scene is not ready!")},t.GLB=function(t,r,i){var a=r.replace(/\.[^\/.]+$/,""),s=new e.GLTF2._Exporter(t,i);if(t.isReady)return s._generateGLB(a);throw new Error("glTF Serializer: Scene is not ready!")},t})();e.GLTF2Export=t})(BABYLON||(BABYLON={}));var BABYLON;!(function(e){!(function(t){var r=(function(){function r(e,t){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,this.images=new Array,this.materials=new Array,this.textures=new Array,this.imageData={},void 0!==t&&(this.options=t);var r=0;r=this.createScene(this.babylonScene,r,null),this.totalByteLength=r}return r.prototype.createBufferView=function(e,t,r,i,a){var s={buffer:e,byteLength:r};return t>0&&(s.byteOffset=t),a&&(s.name=a),i&&(s.byteStride=i),s},r.prototype.createAccessor=function(e,t,r,i,a,s,n,o){var l={name:t,bufferView:e,componentType:i,count:a,type:r};return n&&(l.min=n),o&&(l.max=o),s&&(l.byteOffset=s),l},r.prototype.calculateMinMax=function(e,t,r,i,a){var s=[1/0,1/0,1/0],n=[-1/0,-1/0,-1/0],o=t+r;if(r>0)for(var l=t;ln[f]&&(n[f]=c),++u}return{min:s,max:n}},r.prototype.writeAttributeData=function(t,r,i,a,s,n,o){var l=s,u=r.length/i,h=0;switch(t){case e.VertexBuffer.PositionKind:case e.VertexBuffer.NormalKind:for(var f=0;f0&&(a.buffers=[i]),this.nodes&&0!==this.nodes.length&&(a.nodes=this.nodes),this.meshes&&0!==this.meshes.length&&(a.meshes=this.meshes),this.scenes&&0!==this.scenes.length&&(a.scenes=this.scenes,a.scene=0),this.bufferViews&&0!==this.bufferViews.length&&(a.bufferViews=this.bufferViews),this.accessors&&0!==this.accessors.length&&(a.accessors=this.accessors),this.materials&&0!==this.materials.length&&(a.materials=this.materials),this.textures&&0!==this.textures.length&&(a.textures=this.textures),this.images&&0!==this.images.length)if(e){a.images=[];for(var s=this.images.length,n=this.totalByteLength,o=0;o-1)if(l=n.getVertexBuffer(t),u=l.getOffset(),h=l.getData(),f=l.getStrideSize(),s&&h)o=this.writeAttributeData(t,h,f,u,i,s,a),i+=o;else{var c=null;switch(t){case e.VertexBuffer.PositionKind:o=4*h.length,c="Position - "+n.name;break;case e.VertexBuffer.NormalKind:o=4*h.length,c="Normal - "+n.name;break;case e.VertexBuffer.TangentKind:o=4*h.length,c="Tangent - "+n.name;break;case e.VertexBuffer.ColorKind:o=4*h.length,c="Color - "+n.name;break;case e.VertexBuffer.UVKind:o=4*h.length,c="TexCoord 0 - "+n.name;break;case e.VertexBuffer.UV2Kind:o=4*h.length,c="TexCoord 1 - "+n.name;break;default:console.warn("Unsupported VertexBuffer kind: "+t)}if(null!==c){var g=this.createBufferView(0,i,o,4*f,c);i+=o,this.bufferViews.push(g)}}}return o},r.prototype.setPrimitiveAttributes=function(r,i,a,s,n){var o=null;i instanceof e.Mesh?o=i:i instanceof e.InstancedMesh&&(o=i.sourceMesh);var l=null,u=null,h=null,f=null,c=null,g=null;if(null!==o&&(o.isVerticesDataPresent(e.VertexBuffer.PositionKind)&&(a+=this.createBufferViewKind(e.VertexBuffer.PositionKind,i,a,s,n),l=this.bufferViews.length-1),o.isVerticesDataPresent(e.VertexBuffer.NormalKind)&&(a+=this.createBufferViewKind(e.VertexBuffer.NormalKind,i,a,s,n),u=this.bufferViews.length-1),o.isVerticesDataPresent(e.VertexBuffer.ColorKind)&&(a+=this.createBufferViewKind(e.VertexBuffer.ColorKind,i,a,s,n),h=this.bufferViews.length-1),o.isVerticesDataPresent(e.VertexBuffer.TangentKind)&&(a+=this.createBufferViewKind(e.VertexBuffer.TangentKind,i,a,s,n),h=this.bufferViews.length-1),o.isVerticesDataPresent(e.VertexBuffer.UVKind)&&(a+=this.createBufferViewKind(e.VertexBuffer.UVKind,i,a,s,n),f=this.bufferViews.length-1),o.isVerticesDataPresent(e.VertexBuffer.UV2Kind)&&(a+=this.createBufferViewKind(e.VertexBuffer.UV2Kind,i,a,s,n),c=this.bufferViews.length-1),o.getTotalIndices()>0)){var d=o.getIndices();if(n){for(var p=d.length,m=a,v=0;v0){for(var i=e.meshes,a={nodes:new Array},s=0;s