var globalObject="undefined"!=typeof global?global:"undefined"!=typeof window?window:this,babylonDependency=globalObject&&globalObject.BABYLON||BABYLON||"undefined"!=typeof require&&require("babylonjs"),BABYLON=babylonDependency,__decorate=this&&this.__decorate||function(e,t,r,a){var i,n=arguments.length,s=n<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,r):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,a);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(s=(n<3?i(s):n>3?i(t,r,s):i(t,r))||s);return n>3&&s&&Object.defineProperty(t,r,s),s},__extends=this&&this.__extends||(function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function a(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(a.prototype=r.prototype,new a)}})(),BABYLON;!(function(e){var t=(function(){function t(){}return t.OBJ=function(t,r,a,i){var n=[],s=1;r&&(a||(a="mat"),n.push("mtllib "+a+".mtl"));for(var o=0;o0&&(n.byteOffset=t),i&&(n.name=i),a&&(n.byteStride=a),n},r.prototype.createAccessor=function(e,t,r,a,i,n,s,o){var l={name:t,bufferView:e,componentType:a,count:i,type:r};return s&&(l.min=s),o&&(l.max=o),n&&(l.byteOffset=n),l},r.prototype.calculateMinMax=function(e,t,r,a,i){var n=[1/0,1/0,1/0],s=[-1/0,-1/0,-1/0],o=t+r;if(r>0)for(var l=t;ls[c]&&(s[c]=h),++u}return{min:n,max:s}},r.prototype.writeAttributeData=function(t,r,a,i,n,s,o){var l=n,u=r.length/a,f=0;switch(t){case e.VertexBuffer.PositionKind:case e.VertexBuffer.NormalKind:for(var c=0;c0&&(i.buffers=[a]),this.nodes&&0!==this.nodes.length&&(i.nodes=this.nodes),this.meshes&&0!==this.meshes.length&&(i.meshes=this.meshes),this.scenes&&0!==this.scenes.length&&(i.scenes=this.scenes,i.scene=0),this.bufferViews&&0!==this.bufferViews.length&&(i.bufferViews=this.bufferViews),this.accessors&&0!==this.accessors.length&&(i.accessors=this.accessors),this.materials&&0!==this.materials.length&&(i.materials=this.materials),this.textures&&0!==this.textures.length&&(i.textures=this.textures),this.images&&0!==this.images.length)if(e){i.images=[];for(var n=this.images.length,s=this.totalByteLength,o=0;o-1)if(l=s.getVertexBuffer(t),u=l.getOffset(),f=l.getData(),c=l.getStrideSize(),n&&f)o=this.writeAttributeData(t,f,c,u,a,n,i),a+=o;else{var h=null;switch(t){case e.VertexBuffer.PositionKind:o=4*f.length,h="Position - "+s.name;break;case e.VertexBuffer.NormalKind:o=4*f.length,h="Normal - "+s.name;break;case e.VertexBuffer.TangentKind:o=4*f.length,h="Tangent - "+s.name;break;case e.VertexBuffer.ColorKind:o=4*f.length,h="Color - "+s.name;break;case e.VertexBuffer.UVKind:o=4*f.length,h="TexCoord 0 - "+s.name;break;case e.VertexBuffer.UV2Kind:o=4*f.length,h="TexCoord 1 - "+s.name;break;default:e.Tools.Warn("Unsupported VertexBuffer kind: "+t)}if(null!==h){var p=this.createBufferView(0,a,o,4*c,h);a+=o,this.bufferViews.push(p)}}}return o},r.prototype.setPrimitiveAttributes=function(t,r,a,i,n){var s=null;r instanceof e.Mesh?s=r:r instanceof e.InstancedMesh&&(s=r.sourceMesh);var o=null,l=null,u=null,f=null,c=null,h=null;if(null!==s&&(s.isVerticesDataPresent(e.VertexBuffer.PositionKind)&&(a+=this.createBufferViewKind(e.VertexBuffer.PositionKind,r,a,i,n),o=this.bufferViews.length-1),s.isVerticesDataPresent(e.VertexBuffer.NormalKind)&&(a+=this.createBufferViewKind(e.VertexBuffer.NormalKind,r,a,i,n),l=this.bufferViews.length-1),s.isVerticesDataPresent(e.VertexBuffer.ColorKind)&&(a+=this.createBufferViewKind(e.VertexBuffer.ColorKind,r,a,i,n),u=this.bufferViews.length-1),s.isVerticesDataPresent(e.VertexBuffer.TangentKind)&&(a+=this.createBufferViewKind(e.VertexBuffer.TangentKind,r,a,i,n),u=this.bufferViews.length-1),s.isVerticesDataPresent(e.VertexBuffer.UVKind)&&(a+=this.createBufferViewKind(e.VertexBuffer.UVKind,r,a,i,n),f=this.bufferViews.length-1),s.isVerticesDataPresent(e.VertexBuffer.UV2Kind)&&(a+=this.createBufferViewKind(e.VertexBuffer.UV2Kind,r,a,i,n),c=this.bufferViews.length-1),s.getTotalIndices()>0)){var p=s.getIndices();if(n){for(var d=p.length,g=a,m=0;m0){var i=e.meshes,n={nodes:new Array};null==a&&t._GLTFMaterial.ConvertMaterialsToGLTF(e.materials,"image/jpeg",this.images,this.textures,this.materials,this.imageData,!0);for(var s=0;s