babylonjs-loaders 7.19.1 → 7.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("babylonjs")):"function"==typeof define&&define.amd?define("babylonjs-loaders",["babylonjs"],e):"object"==typeof exports?exports["babylonjs-loaders"]=e(require("babylonjs")):t.LOADERS=e(t.BABYLON)}("undefined"!=typeof self?self:"undefined"!=typeof global?global:this,(t=>(()=>{"use strict";var e={597:e=>{e.exports=t}},s={};function i(t){var r=s[t];if(void 0!==r)return r.exports;var o=s[t]={exports:{}};return e[t](o,o.exports,i),o.exports}i.d=(t,e)=>{for(var s in e)i.o(e,s)&&!i.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:e[s]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};i.d(r,{default:()=>u});var o={};i.r(o),i.d(o,{MTLFileLoader:()=>l,OBJFileLoader:()=>p,SolidParser:()=>h});var a={};i.r(a),i.d(a,{MTLFileLoader:()=>l,OBJFileLoader:()=>p,SolidParser:()=>h});var n=i(597),l=function(){function t(){this.materials=[]}return t.prototype.parseMTL=function(e,s,i,r){if(!(s instanceof ArrayBuffer)){for(var o,a=s.split("\n"),l=/\s+/,h=null,p=0;p<a.length;p++){var _=a[p].trim();if(0!==_.length&&"#"!==_.charAt(0)){var d=_.indexOf(" "),u=d>=0?_.substring(0,d):_;u=u.toLowerCase();var m=d>=0?_.substring(d+1).trim():"";if("newmtl"===u)h&&this.materials.push(h),e._blockEntityCollection=!!r,(h=new n.StandardMaterial(m,e))._parentContainer=r,e._blockEntityCollection=!1;else if("kd"===u&&h)o=m.split(l,3).map(parseFloat),h.diffuseColor=n.Color3.FromArray(o);else if("ka"===u&&h)o=m.split(l,3).map(parseFloat),h.ambientColor=n.Color3.FromArray(o);else if("ks"===u&&h)o=m.split(l,3).map(parseFloat),h.specularColor=n.Color3.FromArray(o);else if("ke"===u&&h)o=m.split(l,3).map(parseFloat),h.emissiveColor=n.Color3.FromArray(o);else if("ns"===u&&h)h.specularPower=parseFloat(m);else if("d"===u&&h)h.alpha=parseFloat(m);else if("map_ka"===u&&h)h.ambientTexture=t._GetTexture(i,m,e);else if("map_kd"===u&&h)h.diffuseTexture=t._GetTexture(i,m,e);else if("map_ks"===u&&h)h.specularTexture=t._GetTexture(i,m,e);else if("map_ns"===u);else if("map_bump"===u&&h){var c=m.split(l),f=c.indexOf("-bm"),g=null;f>=0&&(g=c[f+1],c.splice(f,2)),h.bumpTexture=t._GetTexture(i,c.join(" "),e),h.bumpTexture&&null!==g&&(h.bumpTexture.level=parseFloat(g))}else"map_d"===u&&h&&(h.opacityTexture=t._GetTexture(i,m,e))}}h&&this.materials.push(h)}},t._GetTexture=function(e,s,i){if(!s)return null;var r=e;if("file:"===e){var o=s.lastIndexOf("\\");-1===o&&(o=s.lastIndexOf("/")),r+=o>-1?s.substr(o+1):s}else r+=s;return new n.Texture(r,i,!1,t.INVERT_TEXTURE_Y)},t.INVERT_TEXTURE_Y=!0,t}(),h=function(){function t(t,e,s){this._positions=[],this._normals=[],this._uvs=[],this._colors=[],this._meshesFromObj=[],this._indicesForBabylon=[],this._wrappedPositionForBabylon=[],this._wrappedUvsForBabylon=[],this._wrappedColorsForBabylon=[],this._wrappedNormalsForBabylon=[],this._tuplePosNorm=[],this._curPositionInIndices=0,this._hasMeshes=!1,this._unwrappedPositionsForBabylon=[],this._unwrappedColorsForBabylon=[],this._unwrappedNormalsForBabylon=[],this._unwrappedUVForBabylon=[],this._triangles=[],this._materialNameFromObj="",this._objMeshName="",this._increment=1,this._isFirstMaterial=!0,this._grayColor=new n.Color4(.5,.5,.5,1),this._hasLineData=!1,this._materialToUse=t,this._babylonMeshesArray=e,this._loadingOptions=s}return t.prototype._isInArray=function(t,e){t[e[0]]||(t[e[0]]={normals:[],idx:[]});var s=t[e[0]].normals.indexOf(e[1]);return-1===s?-1:t[e[0]].idx[s]},t.prototype._isInArrayUV=function(t,e){t[e[0]]||(t[e[0]]={normals:[],idx:[],uv:[]});var s=t[e[0]].normals.indexOf(e[1]);return 1!=s&&e[2]===t[e[0]].uv[s]?t[e[0]].idx[s]:-1},t.prototype._setData=function(t,e,s,i,r,o,a){var n;-1===(n=this._loadingOptions.optimizeWithUV?this._isInArrayUV(this._tuplePosNorm,[t,s,e]):this._isInArray(this._tuplePosNorm,[t,s]))?(this._indicesForBabylon.push(this._wrappedPositionForBabylon.length),this._wrappedPositionForBabylon.push(i),this._wrappedUvsForBabylon.push(r),this._wrappedNormalsForBabylon.push(o),void 0!==a&&this._wrappedColorsForBabylon.push(a),this._tuplePosNorm[t].normals.push(s),this._tuplePosNorm[t].idx.push(this._curPositionInIndices++),this._loadingOptions.optimizeWithUV&&this._tuplePosNorm[t].uv.push(e)):this._indicesForBabylon.push(n)},t.prototype._unwrapData=function(){for(var t=0;t<this._wrappedPositionForBabylon.length;t++)this._unwrappedPositionsForBabylon.push(this._wrappedPositionForBabylon[t].x*this._handednessSign,this._wrappedPositionForBabylon[t].y,this._wrappedPositionForBabylon[t].z),this._unwrappedNormalsForBabylon.push(this._wrappedNormalsForBabylon[t].x*this._handednessSign,this._wrappedNormalsForBabylon[t].y,this._wrappedNormalsForBabylon[t].z),this._unwrappedUVForBabylon.push(this._wrappedUvsForBabylon[t].x,this._wrappedUvsForBabylon[t].y),this._loadingOptions.importVertexColors&&this._unwrappedColorsForBabylon.push(this._wrappedColorsForBabylon[t].r,this._wrappedColorsForBabylon[t].g,this._wrappedColorsForBabylon[t].b,this._wrappedColorsForBabylon[t].a);this._wrappedPositionForBabylon.length=0,this._wrappedNormalsForBabylon.length=0,this._wrappedUvsForBabylon.length=0,this._wrappedColorsForBabylon.length=0,this._tuplePosNorm.length=0,this._curPositionInIndices=0},t.prototype._getTriangles=function(t,e){for(var s=e;s<t.length-1;s++)this._pushTriangle(t,s)},t.prototype._setDataForCurrentFaceWithPattern1=function(t,e){this._getTriangles(t,e);for(var s=0;s<this._triangles.length;s++){var i=parseInt(this._triangles[s])-1;this._setData(i,0,0,this._positions[i],n.Vector2.Zero(),n.Vector3.Up(),this._loadingOptions.importVertexColors?this._colors[i]:void 0)}this._triangles.length=0},t.prototype._setDataForCurrentFaceWithPattern2=function(t,e){this._getTriangles(t,e);for(var s=0;s<this._triangles.length;s++){var i=this._triangles[s].split("/"),r=parseInt(i[0])-1,o=parseInt(i[1])-1;this._setData(r,o,0,this._positions[r],this._uvs[o],n.Vector3.Up(),this._loadingOptions.importVertexColors?this._colors[r]:void 0)}this._triangles.length=0},t.prototype._setDataForCurrentFaceWithPattern3=function(t,e){this._getTriangles(t,e);for(var s=0;s<this._triangles.length;s++){var i=this._triangles[s].split("/"),r=parseInt(i[0])-1,o=parseInt(i[1])-1,a=parseInt(i[2])-1;this._setData(r,o,a,this._positions[r],this._uvs[o],this._normals[a])}this._triangles.length=0},t.prototype._setDataForCurrentFaceWithPattern4=function(t,e){this._getTriangles(t,e);for(var s=0;s<this._triangles.length;s++){var i=this._triangles[s].split("//"),r=parseInt(i[0])-1,o=parseInt(i[1])-1;this._setData(r,1,o,this._positions[r],n.Vector2.Zero(),this._normals[o],this._loadingOptions.importVertexColors?this._colors[r]:void 0)}this._triangles.length=0},t.prototype._setDataForCurrentFaceWithPattern5=function(t,e){this._getTriangles(t,e);for(var s=0;s<this._triangles.length;s++){var i=this._triangles[s].split("/"),r=this._positions.length+parseInt(i[0]),o=this._uvs.length+parseInt(i[1]),a=this._normals.length+parseInt(i[2]);this._setData(r,o,a,this._positions[r],this._uvs[o],this._normals[a],this._loadingOptions.importVertexColors?this._colors[r]:void 0)}this._triangles.length=0},t.prototype._addPreviousObjMesh=function(){this._meshesFromObj.length>0&&(this._handledMesh=this._meshesFromObj[this._meshesFromObj.length-1],this._unwrapData(),this._loadingOptions.useLegacyBehavior&&this._indicesForBabylon.reverse(),this._handledMesh.indices=this._indicesForBabylon.slice(),this._handledMesh.positions=this._unwrappedPositionsForBabylon.slice(),this._handledMesh.normals=this._unwrappedNormalsForBabylon.slice(),this._handledMesh.uvs=this._unwrappedUVForBabylon.slice(),this._handledMesh.hasLines=this._hasLineData,this._loadingOptions.importVertexColors&&(this._handledMesh.colors=this._unwrappedColorsForBabylon.slice()),this._indicesForBabylon.length=0,this._unwrappedPositionsForBabylon.length=0,this._unwrappedColorsForBabylon.length=0,this._unwrappedNormalsForBabylon.length=0,this._unwrappedUVForBabylon.length=0,this._hasLineData=!1)},t.prototype._optimizeNormals=function(t){var e=t.getVerticesData(n.VertexBuffer.PositionKind),s=t.getVerticesData(n.VertexBuffer.NormalKind),i={};if(e&&s){for(var r=0;r<e.length/3;r++)(l=i[a=e[3*r+0]+"_"+e[3*r+1]+"_"+e[3*r+2]])||(l=[],i[a]=l),l.push(r);var o=new n.Vector3;for(var a in i){var l;if(!((l=i[a]).length<2)){var h=l[0];for(r=1;r<l.length;++r){var p=l[r];s[3*h+0]+=s[3*p+0],s[3*h+1]+=s[3*p+1],s[3*h+2]+=s[3*p+2]}for(o.copyFromFloats(s[3*h+0],s[3*h+1],s[3*h+2]),o.normalize(),r=0;r<l.length;++r)s[3*(p=l[r])+0]=o.x,s[3*p+1]=o.y,s[3*p+2]=o.z}}t.setVerticesData(n.VertexBuffer.NormalKind,s)}},t.prototype.parse=function(e,s,i,r,o){var a,l,h=this;this._loadingOptions.useLegacyBehavior?(this._pushTriangle=function(t,e){return h._triangles.push(t[0],t[e],t[e+1])},this._handednessSign=1):i.useRightHandedSystem?(this._pushTriangle=function(t,e){return h._triangles.push(t[0],t[e+1],t[e])},this._handednessSign=1):(this._pushTriangle=function(t,e){return h._triangles.push(t[0],t[e],t[e+1])},this._handednessSign=-1);for(var p=s.split("\n"),_=0;_<p.length;_++){var d=p[_].trim().replace(/\s\s/g," "),u=void 0;if(0!==d.length&&"#"!==d.charAt(0))if(t.VertexPattern.test(d)){if(u=d.match(/[^ ]+/g),this._positions.push(new n.Vector3(parseFloat(u[1]),parseFloat(u[2]),parseFloat(u[3]))),this._loadingOptions.importVertexColors)if(u.length>=7){var m=parseFloat(u[4]),c=parseFloat(u[5]),f=parseFloat(u[6]);this._colors.push(new n.Color4(m>1?m/255:m,c>1?c/255:c,f>1?f/255:f,7===u.length||void 0===u[7]?1:parseFloat(u[7])))}else this._colors.push(this._grayColor)}else if(null!==(u=t.NormalPattern.exec(d)))this._normals.push(new n.Vector3(parseFloat(u[1]),parseFloat(u[2]),parseFloat(u[3])));else if(null!==(u=t.UVPattern.exec(d)))this._uvs.push(new n.Vector2(parseFloat(u[1])*this._loadingOptions.UVScaling.x,parseFloat(u[2])*this._loadingOptions.UVScaling.y));else if(null!==(u=t.FacePattern3.exec(d)))this._setDataForCurrentFaceWithPattern3(u[1].trim().split(" "),1);else if(null!==(u=t.FacePattern4.exec(d)))this._setDataForCurrentFaceWithPattern4(u[1].trim().split(" "),1);else if(null!==(u=t.FacePattern5.exec(d)))this._setDataForCurrentFaceWithPattern5(u[1].trim().split(" "),1);else if(null!==(u=t.FacePattern2.exec(d)))this._setDataForCurrentFaceWithPattern2(u[1].trim().split(" "),1);else if(null!==(u=t.FacePattern1.exec(d)))this._setDataForCurrentFaceWithPattern1(u[1].trim().split(" "),1);else if(null!==(u=t.LinePattern1.exec(d)))this._setDataForCurrentFaceWithPattern1(u[1].trim().split(" "),0),this._hasLineData=!0;else if(null!==(u=t.LinePattern2.exec(d)))this._setDataForCurrentFaceWithPattern2(u[1].trim().split(" "),0),this._hasLineData=!0;else if(null!==(u=t.LinePattern3.exec(d)))this._setDataForCurrentFaceWithPattern3(u[1].trim().split(" "),0),this._hasLineData=!0;else if(t.GroupDescriptor.test(d)||t.ObjectDescriptor.test(d)){var g={name:d.substring(2).trim(),indices:null,positions:null,normals:null,uvs:null,colors:null,materialName:this._materialNameFromObj,isObject:t.ObjectDescriptor.test(d)};this._addPreviousObjMesh(),this._meshesFromObj.push(g),this._hasMeshes=!0,this._isFirstMaterial=!0,this._increment=1}else t.UseMtlDescriptor.test(d)?(this._materialNameFromObj=d.substring(7).trim(),this._isFirstMaterial&&this._hasMeshes||(this._addPreviousObjMesh(),g={name:(this._objMeshName||"mesh")+"_mm"+this._increment.toString(),indices:null,positions:null,normals:null,uvs:null,colors:null,materialName:this._materialNameFromObj,isObject:!1},this._increment++,this._meshesFromObj.push(g),this._hasMeshes=!0),this._hasMeshes&&this._isFirstMaterial&&(this._meshesFromObj[this._meshesFromObj.length-1].materialName=this._materialNameFromObj,this._isFirstMaterial=!1)):t.MtlLibGroupDescriptor.test(d)?o(d.substring(7).trim()):t.SmoothDescriptor.test(d)||n.Logger.Log("Unhandled expression at line : "+d)}if(this._hasMeshes&&(this._handledMesh=this._meshesFromObj[this._meshesFromObj.length-1],this._loadingOptions.useLegacyBehavior&&this._indicesForBabylon.reverse(),this._unwrapData(),this._handledMesh.indices=this._indicesForBabylon,this._handledMesh.positions=this._unwrappedPositionsForBabylon,this._handledMesh.normals=this._unwrappedNormalsForBabylon,this._handledMesh.uvs=this._unwrappedUVForBabylon,this._handledMesh.hasLines=this._hasLineData,this._loadingOptions.importVertexColors&&(this._handledMesh.colors=this._unwrappedColorsForBabylon)),!this._hasMeshes){var b=null;if(this._indicesForBabylon.length)this._loadingOptions.useLegacyBehavior&&this._indicesForBabylon.reverse(),this._unwrapData();else{for(var F=0,y=this._positions;F<y.length;F++){var v=y[F];this._unwrappedPositionsForBabylon.push(v.x,v.y,v.z)}if(this._normals.length)for(var O=0,M=this._normals;O<M.length;O++){var w=M[O];this._unwrappedNormalsForBabylon.push(w.x,w.y,w.z)}if(this._uvs.length)for(var P=0,B=this._uvs;P<B.length;P++){var T=B[P];this._unwrappedUVForBabylon.push(T.x,T.y)}if(this._colors.length)for(var x=0,L=this._colors;x<L.length;x++){var C=L[x];this._unwrappedColorsForBabylon.push(C.r,C.g,C.b,C.a)}this._materialNameFromObj||((b=new n.StandardMaterial(n.Geometry.RandomId(),i)).pointsCloud=!0,this._materialNameFromObj=b.name,this._normals.length||(b.disableLighting=!0,b.emissiveColor=n.Color3.White()))}this._meshesFromObj.push({name:n.Geometry.RandomId(),indices:this._indicesForBabylon,positions:this._unwrappedPositionsForBabylon,colors:this._unwrappedColorsForBabylon,normals:this._unwrappedNormalsForBabylon,uvs:this._unwrappedUVForBabylon,materialName:this._materialNameFromObj,directMaterial:b,isObject:!0})}for(var N=0;N<this._meshesFromObj.length;N++){if(e&&this._meshesFromObj[N].name)if(e instanceof Array){if(-1===e.indexOf(this._meshesFromObj[N].name))continue}else if(this._meshesFromObj[N].name!==e)continue;this._handledMesh=this._meshesFromObj[N],i._blockEntityCollection=!!r;var I=new n.Mesh(this._meshesFromObj[N].name,i);if(I._parentContainer=r,i._blockEntityCollection=!1,this._handledMesh._babylonMesh=I,!this._handledMesh.isObject)for(var V=N-1;V>=0;--V)if(this._meshesFromObj[V].isObject&&this._meshesFromObj[V]._babylonMesh){I.parent=this._meshesFromObj[V]._babylonMesh;break}if(this._materialToUse.push(this._meshesFromObj[N].materialName),this._handledMesh.hasLines&&(null!==(a=I._internalMetadata)&&void 0!==a||(I._internalMetadata={}),I._internalMetadata._isLine=!0),0!==(null===(l=this._handledMesh.positions)||void 0===l?void 0:l.length)){var j=new n.VertexData;if(j.uvs=this._handledMesh.uvs,j.indices=this._handledMesh.indices,j.positions=this._handledMesh.positions,this._loadingOptions.computeNormals){var E=new Array;n.VertexData.ComputeNormals(this._handledMesh.positions,this._handledMesh.indices,E),j.normals=E}else j.normals=this._handledMesh.normals;this._loadingOptions.importVertexColors&&(j.colors=this._handledMesh.colors),j.applyToMesh(I),this._loadingOptions.invertY&&(I.scaling.y*=-1),this._loadingOptions.optimizeNormals&&this._optimizeNormals(I),this._babylonMeshesArray.push(I),this._handledMesh.directMaterial&&(I.material=this._handledMesh.directMaterial)}else this._babylonMeshesArray.push(I)}},t.ObjectDescriptor=/^o/,t.GroupDescriptor=/^g/,t.MtlLibGroupDescriptor=/^mtllib /,t.UseMtlDescriptor=/^usemtl /,t.SmoothDescriptor=/^s /,t.VertexPattern=/^v(\s+[\d|.|+|\-|e|E]+){3,7}/,t.NormalPattern=/^vn(\s+[\d|.|+|\-|e|E]+)( +[\d|.|+|\-|e|E]+)( +[\d|.|+|\-|e|E]+)/,t.UVPattern=/^vt(\s+[\d|.|+|\-|e|E]+)( +[\d|.|+|\-|e|E]+)/,t.FacePattern1=/^f\s+(([\d]{1,}[\s]?){3,})+/,t.FacePattern2=/^f\s+((([\d]{1,}\/[\d]{1,}[\s]?){3,})+)/,t.FacePattern3=/^f\s+((([\d]{1,}\/[\d]{1,}\/[\d]{1,}[\s]?){3,})+)/,t.FacePattern4=/^f\s+((([\d]{1,}\/\/[\d]{1,}[\s]?){3,})+)/,t.FacePattern5=/^f\s+(((-[\d]{1,}\/-[\d]{1,}\/-[\d]{1,}[\s]?){3,})+)/,t.LinePattern1=/^l\s+(([\d]{1,}[\s]?){2,})+/,t.LinePattern2=/^l\s+((([\d]{1,}\/[\d]{1,}[\s]?){2,})+)/,t.LinePattern3=/^l\s+((([\d]{1,}\/[\d]{1,}\/[\d]{1,}[\s]?){2,})+)/,t}(),p=function(){function t(e){this.name="obj",this.extensions=".obj",this._assetContainer=null,this._loadingOptions=e||t._DefaultLoadingOptions}return Object.defineProperty(t,"INVERT_TEXTURE_Y",{get:function(){return l.INVERT_TEXTURE_Y},set:function(t){l.INVERT_TEXTURE_Y=t},enumerable:!1,configurable:!0}),Object.defineProperty(t,"_DefaultLoadingOptions",{get:function(){return{computeNormals:t.COMPUTE_NORMALS,optimizeNormals:t.OPTIMIZE_NORMALS,importVertexColors:t.IMPORT_VERTEX_COLORS,invertY:t.INVERT_Y,invertTextureY:t.INVERT_TEXTURE_Y,UVScaling:t.UV_SCALING,materialLoadingFailsSilently:t.MATERIAL_LOADING_FAILS_SILENTLY,optimizeWithUV:t.OPTIMIZE_WITH_UV,skipMaterials:t.SKIP_MATERIALS,useLegacyBehavior:t.USE_LEGACY_BEHAVIOR}},enumerable:!1,configurable:!0}),t.prototype._loadMTL=function(t,e,s,i){var r=e+t;n.Tools.LoadFile(r,s,void 0,void 0,!1,(function(t,e){i(r,e)}))},t.prototype.createPlugin=function(){return new t(t._DefaultLoadingOptions)},t.prototype.canDirectLoad=function(){return!1},t.prototype.importMeshAsync=function(t,e,s,i){return this._parseSolid(t,e,s,i).then((function(t){return{meshes:t,particleSystems:[],skeletons:[],animationGroups:[],transformNodes:[],geometries:[],lights:[],spriteManagers:[]}}))},t.prototype.loadAsync=function(t,e,s){return this.importMeshAsync(null,t,e,s).then((function(){}))},t.prototype.loadAssetContainerAsync=function(t,e,s){var i=this,r=new n.AssetContainer(t);return this._assetContainer=r,this.importMeshAsync(null,t,e,s).then((function(t){return t.meshes.forEach((function(t){return r.meshes.push(t)})),t.meshes.forEach((function(t){var e=t.material;e&&-1==r.materials.indexOf(e)&&(r.materials.push(e),e.getActiveTextures().forEach((function(t){-1==r.textures.indexOf(t)&&r.textures.push(t)})))})),i._assetContainer=null,r})).catch((function(t){throw i._assetContainer=null,t}))},t.prototype._parseSolid=function(t,e,s,i){var r=this,o="",a=new l,p=[],_=[];new h(p,_,this._loadingOptions).parse(t,s,e,this._assetContainer,(function(t){o=t}));var d=[];return""===o||this._loadingOptions.skipMaterials||d.push(new Promise((function(t,s){r._loadMTL(o,i,(function(l){try{a.parseMTL(e,l,i,r._assetContainer);for(var h=0;h<a.materials.length;h++){for(var d=0,u=[],m=void 0;(m=p.indexOf(a.materials[h].name,d))>-1;)u.push(m),d=m+1;if(-1===m&&0===u.length)a.materials[h].dispose();else for(var c=0;c<u.length;c++){var f=_[u[c]],g=a.materials[h];f.material=g,f.getTotalIndices()||(g.pointsCloud=!0)}}t()}catch(e){n.Tools.Warn("Error processing MTL file: '".concat(o,"'")),r._loadingOptions.materialLoadingFailsSilently?t():s(e)}}),(function(e,i){n.Tools.Warn("Error downloading MTL file: '".concat(o,"'")),r._loadingOptions.materialLoadingFailsSilently?t():s(i)}))}))),Promise.all(d).then((function(){var t=function(t){var e,s;return Boolean(null!==(s=null===(e=t._internalMetadata)||void 0===e?void 0:e._isLine)&&void 0!==s&&s)};return _.forEach((function(s){var i,r;if(t(s)){var o=null!==(i=s.material)&&void 0!==i?i:new n.StandardMaterial(s.name+"_line",e);o.getBindedMeshes().filter((function(e){return!t(e)})).length>0&&(o=null!==(r=o.clone(o.name+"_line"))&&void 0!==r?r:o),o.wireframe=!0,s.material=o,s._internalMetadata&&(s._internalMetadata._isLine=void 0)}})),_}))},t.OPTIMIZE_WITH_UV=!0,t.INVERT_Y=!1,t.IMPORT_VERTEX_COLORS=!1,t.COMPUTE_NORMALS=!1,t.OPTIMIZE_NORMALS=!1,t.UV_SCALING=new n.Vector2(1,1),t.SKIP_MATERIALS=!1,t.MATERIAL_LOADING_FAILS_SILENTLY=!0,t.USE_LEGACY_BEHAVIOR=!1,t}();n.SceneLoader&&n.SceneLoader.RegisterPlugin(new p);var _=void 0!==i.g?i.g:"undefined"!=typeof window?window:void 0;if(void 0!==_)for(var d in o)_.BABYLON[d]||(_.BABYLON[d]=o[d]);const u=a;return r.default})()));
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("babylonjs")):"function"==typeof define&&define.amd?define("babylonjs-loaders",["babylonjs"],e):"object"==typeof exports?exports["babylonjs-loaders"]=e(require("babylonjs")):t.LOADERS=e(t.BABYLON)}("undefined"!=typeof self?self:"undefined"!=typeof global?global:this,(t=>(()=>{"use strict";var e={597:e=>{e.exports=t}},s={};function i(t){var r=s[t];if(void 0!==r)return r.exports;var o=s[t]={exports:{}};return e[t](o,o.exports,i),o.exports}i.d=(t,e)=>{for(var s in e)i.o(e,s)&&!i.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:e[s]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};i.d(r,{default:()=>u});var o={};i.r(o),i.d(o,{MTLFileLoader:()=>l,OBJFileLoader:()=>p,SolidParser:()=>h});var a={};i.r(a),i.d(a,{MTLFileLoader:()=>l,OBJFileLoader:()=>p,SolidParser:()=>h});var n=i(597),l=function(){function t(){this.materials=[]}return t.prototype.parseMTL=function(e,s,i,r){if(!(s instanceof ArrayBuffer)){for(var o,a=s.split("\n"),l=/\s+/,h=null,p=0;p<a.length;p++){var _=a[p].trim();if(0!==_.length&&"#"!==_.charAt(0)){var d=_.indexOf(" "),u=d>=0?_.substring(0,d):_;u=u.toLowerCase();var m=d>=0?_.substring(d+1).trim():"";if("newmtl"===u)h&&this.materials.push(h),e._blockEntityCollection=!!r,(h=new n.StandardMaterial(m,e))._parentContainer=r,e._blockEntityCollection=!1;else if("kd"===u&&h)o=m.split(l,3).map(parseFloat),h.diffuseColor=n.Color3.FromArray(o);else if("ka"===u&&h)o=m.split(l,3).map(parseFloat),h.ambientColor=n.Color3.FromArray(o);else if("ks"===u&&h)o=m.split(l,3).map(parseFloat),h.specularColor=n.Color3.FromArray(o);else if("ke"===u&&h)o=m.split(l,3).map(parseFloat),h.emissiveColor=n.Color3.FromArray(o);else if("ns"===u&&h)h.specularPower=parseFloat(m);else if("d"===u&&h)h.alpha=parseFloat(m);else if("map_ka"===u&&h)h.ambientTexture=t._GetTexture(i,m,e);else if("map_kd"===u&&h)h.diffuseTexture=t._GetTexture(i,m,e);else if("map_ks"===u&&h)h.specularTexture=t._GetTexture(i,m,e);else if("map_ns"===u);else if("map_bump"===u&&h){var c=m.split(l),f=c.indexOf("-bm"),g=null;f>=0&&(g=c[f+1],c.splice(f,2)),h.bumpTexture=t._GetTexture(i,c.join(" "),e),h.bumpTexture&&null!==g&&(h.bumpTexture.level=parseFloat(g))}else"map_d"===u&&h&&(h.opacityTexture=t._GetTexture(i,m,e))}}h&&this.materials.push(h)}},t._GetTexture=function(e,s,i){if(!s)return null;var r=e;if("file:"===e){var o=s.lastIndexOf("\\");-1===o&&(o=s.lastIndexOf("/")),r+=o>-1?s.substr(o+1):s}else r+=s;return new n.Texture(r,i,!1,t.INVERT_TEXTURE_Y)},t.INVERT_TEXTURE_Y=!0,t}(),h=function(){function t(t,e,s){this._positions=[],this._normals=[],this._uvs=[],this._colors=[],this._meshesFromObj=[],this._indicesForBabylon=[],this._wrappedPositionForBabylon=[],this._wrappedUvsForBabylon=[],this._wrappedColorsForBabylon=[],this._wrappedNormalsForBabylon=[],this._tuplePosNorm=[],this._curPositionInIndices=0,this._hasMeshes=!1,this._unwrappedPositionsForBabylon=[],this._unwrappedColorsForBabylon=[],this._unwrappedNormalsForBabylon=[],this._unwrappedUVForBabylon=[],this._triangles=[],this._materialNameFromObj="",this._objMeshName="",this._increment=1,this._isFirstMaterial=!0,this._grayColor=new n.Color4(.5,.5,.5,1),this._hasLineData=!1,this._materialToUse=t,this._babylonMeshesArray=e,this._loadingOptions=s}return t.prototype._isInArray=function(t,e){t[e[0]]||(t[e[0]]={normals:[],idx:[]});var s=t[e[0]].normals.indexOf(e[1]);return-1===s?-1:t[e[0]].idx[s]},t.prototype._isInArrayUV=function(t,e){t[e[0]]||(t[e[0]]={normals:[],idx:[],uv:[]});var s=t[e[0]].normals.indexOf(e[1]);return 1!=s&&e[2]===t[e[0]].uv[s]?t[e[0]].idx[s]:-1},t.prototype._setData=function(t,e,s,i,r,o,a){var n;-1===(n=this._loadingOptions.optimizeWithUV?this._isInArrayUV(this._tuplePosNorm,[t,s,e]):this._isInArray(this._tuplePosNorm,[t,s]))?(this._indicesForBabylon.push(this._wrappedPositionForBabylon.length),this._wrappedPositionForBabylon.push(i),this._wrappedUvsForBabylon.push(r),this._wrappedNormalsForBabylon.push(o),void 0!==a&&this._wrappedColorsForBabylon.push(a),this._tuplePosNorm[t].normals.push(s),this._tuplePosNorm[t].idx.push(this._curPositionInIndices++),this._loadingOptions.optimizeWithUV&&this._tuplePosNorm[t].uv.push(e)):this._indicesForBabylon.push(n)},t.prototype._unwrapData=function(){for(var t=0;t<this._wrappedPositionForBabylon.length;t++)this._unwrappedPositionsForBabylon.push(this._wrappedPositionForBabylon[t].x*this._handednessSign,this._wrappedPositionForBabylon[t].y,this._wrappedPositionForBabylon[t].z),this._unwrappedNormalsForBabylon.push(this._wrappedNormalsForBabylon[t].x*this._handednessSign,this._wrappedNormalsForBabylon[t].y,this._wrappedNormalsForBabylon[t].z),this._unwrappedUVForBabylon.push(this._wrappedUvsForBabylon[t].x,this._wrappedUvsForBabylon[t].y),this._loadingOptions.importVertexColors&&this._unwrappedColorsForBabylon.push(this._wrappedColorsForBabylon[t].r,this._wrappedColorsForBabylon[t].g,this._wrappedColorsForBabylon[t].b,this._wrappedColorsForBabylon[t].a);this._wrappedPositionForBabylon.length=0,this._wrappedNormalsForBabylon.length=0,this._wrappedUvsForBabylon.length=0,this._wrappedColorsForBabylon.length=0,this._tuplePosNorm.length=0,this._curPositionInIndices=0},t.prototype._getTriangles=function(t,e){for(var s=e;s<t.length-1;s++)this._pushTriangle(t,s)},t.prototype._setDataForCurrentFaceWithPattern1=function(t,e){this._getTriangles(t,e);for(var s=0;s<this._triangles.length;s++){var i=parseInt(this._triangles[s])-1;this._setData(i,0,0,this._positions[i],n.Vector2.Zero(),n.Vector3.Up(),this._loadingOptions.importVertexColors?this._colors[i]:void 0)}this._triangles.length=0},t.prototype._setDataForCurrentFaceWithPattern2=function(t,e){this._getTriangles(t,e);for(var s=0;s<this._triangles.length;s++){var i=this._triangles[s].split("/"),r=parseInt(i[0])-1,o=parseInt(i[1])-1;this._setData(r,o,0,this._positions[r],this._uvs[o],n.Vector3.Up(),this._loadingOptions.importVertexColors?this._colors[r]:void 0)}this._triangles.length=0},t.prototype._setDataForCurrentFaceWithPattern3=function(t,e){this._getTriangles(t,e);for(var s=0;s<this._triangles.length;s++){var i=this._triangles[s].split("/"),r=parseInt(i[0])-1,o=parseInt(i[1])-1,a=parseInt(i[2])-1;this._setData(r,o,a,this._positions[r],this._uvs[o],this._normals[a])}this._triangles.length=0},t.prototype._setDataForCurrentFaceWithPattern4=function(t,e){this._getTriangles(t,e);for(var s=0;s<this._triangles.length;s++){var i=this._triangles[s].split("//"),r=parseInt(i[0])-1,o=parseInt(i[1])-1;this._setData(r,1,o,this._positions[r],n.Vector2.Zero(),this._normals[o],this._loadingOptions.importVertexColors?this._colors[r]:void 0)}this._triangles.length=0},t.prototype._setDataForCurrentFaceWithPattern5=function(t,e){this._getTriangles(t,e);for(var s=0;s<this._triangles.length;s++){var i=this._triangles[s].split("/"),r=this._positions.length+parseInt(i[0]),o=this._uvs.length+parseInt(i[1]),a=this._normals.length+parseInt(i[2]);this._setData(r,o,a,this._positions[r],this._uvs[o],this._normals[a],this._loadingOptions.importVertexColors?this._colors[r]:void 0)}this._triangles.length=0},t.prototype._addPreviousObjMesh=function(){this._meshesFromObj.length>0&&(this._handledMesh=this._meshesFromObj[this._meshesFromObj.length-1],this._unwrapData(),this._loadingOptions.useLegacyBehavior&&this._indicesForBabylon.reverse(),this._handledMesh.indices=this._indicesForBabylon.slice(),this._handledMesh.positions=this._unwrappedPositionsForBabylon.slice(),this._handledMesh.normals=this._unwrappedNormalsForBabylon.slice(),this._handledMesh.uvs=this._unwrappedUVForBabylon.slice(),this._handledMesh.hasLines=this._hasLineData,this._loadingOptions.importVertexColors&&(this._handledMesh.colors=this._unwrappedColorsForBabylon.slice()),this._indicesForBabylon.length=0,this._unwrappedPositionsForBabylon.length=0,this._unwrappedColorsForBabylon.length=0,this._unwrappedNormalsForBabylon.length=0,this._unwrappedUVForBabylon.length=0,this._hasLineData=!1)},t.prototype._optimizeNormals=function(t){var e=t.getVerticesData(n.VertexBuffer.PositionKind),s=t.getVerticesData(n.VertexBuffer.NormalKind),i={};if(e&&s){for(var r=0;r<e.length/3;r++)(l=i[a=e[3*r+0]+"_"+e[3*r+1]+"_"+e[3*r+2]])||(l=[],i[a]=l),l.push(r);var o=new n.Vector3;for(var a in i){var l;if(!((l=i[a]).length<2)){var h=l[0];for(r=1;r<l.length;++r){var p=l[r];s[3*h+0]+=s[3*p+0],s[3*h+1]+=s[3*p+1],s[3*h+2]+=s[3*p+2]}for(o.copyFromFloats(s[3*h+0],s[3*h+1],s[3*h+2]),o.normalize(),r=0;r<l.length;++r)s[3*(p=l[r])+0]=o.x,s[3*p+1]=o.y,s[3*p+2]=o.z}}t.setVerticesData(n.VertexBuffer.NormalKind,s)}},t.prototype.parse=function(e,s,i,r,o){var a,l,h=this;this._loadingOptions.useLegacyBehavior?(this._pushTriangle=function(t,e){return h._triangles.push(t[0],t[e],t[e+1])},this._handednessSign=1):i.useRightHandedSystem?(this._pushTriangle=function(t,e){return h._triangles.push(t[0],t[e+1],t[e])},this._handednessSign=1):(this._pushTriangle=function(t,e){return h._triangles.push(t[0],t[e],t[e+1])},this._handednessSign=-1);for(var p=s.split("\n"),_=0;_<p.length;_++){var d=p[_].trim().replace(/\s\s/g," "),u=void 0;if(0!==d.length&&"#"!==d.charAt(0))if(t.VertexPattern.test(d)){if(u=d.match(/[^ ]+/g),this._positions.push(new n.Vector3(parseFloat(u[1]),parseFloat(u[2]),parseFloat(u[3]))),this._loadingOptions.importVertexColors)if(u.length>=7){var m=parseFloat(u[4]),c=parseFloat(u[5]),f=parseFloat(u[6]);this._colors.push(new n.Color4(m>1?m/255:m,c>1?c/255:c,f>1?f/255:f,7===u.length||void 0===u[7]?1:parseFloat(u[7])))}else this._colors.push(this._grayColor)}else if(null!==(u=t.NormalPattern.exec(d)))this._normals.push(new n.Vector3(parseFloat(u[1]),parseFloat(u[2]),parseFloat(u[3])));else if(null!==(u=t.UVPattern.exec(d)))this._uvs.push(new n.Vector2(parseFloat(u[1])*this._loadingOptions.UVScaling.x,parseFloat(u[2])*this._loadingOptions.UVScaling.y));else if(null!==(u=t.FacePattern3.exec(d)))this._setDataForCurrentFaceWithPattern3(u[1].trim().split(" "),1);else if(null!==(u=t.FacePattern4.exec(d)))this._setDataForCurrentFaceWithPattern4(u[1].trim().split(" "),1);else if(null!==(u=t.FacePattern5.exec(d)))this._setDataForCurrentFaceWithPattern5(u[1].trim().split(" "),1);else if(null!==(u=t.FacePattern2.exec(d)))this._setDataForCurrentFaceWithPattern2(u[1].trim().split(" "),1);else if(null!==(u=t.FacePattern1.exec(d)))this._setDataForCurrentFaceWithPattern1(u[1].trim().split(" "),1);else if(null!==(u=t.LinePattern1.exec(d)))this._setDataForCurrentFaceWithPattern1(u[1].trim().split(" "),0),this._hasLineData=!0;else if(null!==(u=t.LinePattern2.exec(d)))this._setDataForCurrentFaceWithPattern2(u[1].trim().split(" "),0),this._hasLineData=!0;else if(null!==(u=t.LinePattern3.exec(d)))this._setDataForCurrentFaceWithPattern3(u[1].trim().split(" "),0),this._hasLineData=!0;else if(t.GroupDescriptor.test(d)||t.ObjectDescriptor.test(d)){var g={name:d.substring(2).trim(),indices:null,positions:null,normals:null,uvs:null,colors:null,materialName:this._materialNameFromObj,isObject:t.ObjectDescriptor.test(d)};this._addPreviousObjMesh(),this._meshesFromObj.push(g),this._hasMeshes=!0,this._isFirstMaterial=!0,this._increment=1}else t.UseMtlDescriptor.test(d)?(this._materialNameFromObj=d.substring(7).trim(),this._isFirstMaterial&&this._hasMeshes||(this._addPreviousObjMesh(),g={name:(this._objMeshName||"mesh")+"_mm"+this._increment.toString(),indices:null,positions:null,normals:null,uvs:null,colors:null,materialName:this._materialNameFromObj,isObject:!1},this._increment++,this._meshesFromObj.push(g),this._hasMeshes=!0),this._hasMeshes&&this._isFirstMaterial&&(this._meshesFromObj[this._meshesFromObj.length-1].materialName=this._materialNameFromObj,this._isFirstMaterial=!1)):t.MtlLibGroupDescriptor.test(d)?o(d.substring(7).trim()):t.SmoothDescriptor.test(d)||n.Logger.Log("Unhandled expression at line : "+d)}if(this._hasMeshes&&(this._handledMesh=this._meshesFromObj[this._meshesFromObj.length-1],this._loadingOptions.useLegacyBehavior&&this._indicesForBabylon.reverse(),this._unwrapData(),this._handledMesh.indices=this._indicesForBabylon,this._handledMesh.positions=this._unwrappedPositionsForBabylon,this._handledMesh.normals=this._unwrappedNormalsForBabylon,this._handledMesh.uvs=this._unwrappedUVForBabylon,this._handledMesh.hasLines=this._hasLineData,this._loadingOptions.importVertexColors&&(this._handledMesh.colors=this._unwrappedColorsForBabylon)),!this._hasMeshes){var b=null;if(this._indicesForBabylon.length)this._loadingOptions.useLegacyBehavior&&this._indicesForBabylon.reverse(),this._unwrapData();else{for(var F=0,y=this._positions;F<y.length;F++){var v=y[F];this._unwrappedPositionsForBabylon.push(v.x,v.y,v.z)}if(this._normals.length)for(var O=0,M=this._normals;O<M.length;O++){var w=M[O];this._unwrappedNormalsForBabylon.push(w.x,w.y,w.z)}if(this._uvs.length)for(var P=0,B=this._uvs;P<B.length;P++){var T=B[P];this._unwrappedUVForBabylon.push(T.x,T.y)}if(this._colors.length)for(var x=0,L=this._colors;x<L.length;x++){var C=L[x];this._unwrappedColorsForBabylon.push(C.r,C.g,C.b,C.a)}this._materialNameFromObj||((b=new n.StandardMaterial(n.Geometry.RandomId(),i)).pointsCloud=!0,this._materialNameFromObj=b.name,this._normals.length||(b.disableLighting=!0,b.emissiveColor=n.Color3.White()))}this._meshesFromObj.push({name:n.Geometry.RandomId(),indices:this._indicesForBabylon,positions:this._unwrappedPositionsForBabylon,colors:this._unwrappedColorsForBabylon,normals:this._unwrappedNormalsForBabylon,uvs:this._unwrappedUVForBabylon,materialName:this._materialNameFromObj,directMaterial:b,isObject:!0})}for(var N=0;N<this._meshesFromObj.length;N++){if(e&&this._meshesFromObj[N].name)if(e instanceof Array){if(-1===e.indexOf(this._meshesFromObj[N].name))continue}else if(this._meshesFromObj[N].name!==e)continue;this._handledMesh=this._meshesFromObj[N],i._blockEntityCollection=!!r;var I=new n.Mesh(this._meshesFromObj[N].name,i);if(I._parentContainer=r,i._blockEntityCollection=!1,this._handledMesh._babylonMesh=I,!this._handledMesh.isObject)for(var V=N-1;V>=0;--V)if(this._meshesFromObj[V].isObject&&this._meshesFromObj[V]._babylonMesh){I.parent=this._meshesFromObj[V]._babylonMesh;break}if(this._materialToUse.push(this._meshesFromObj[N].materialName),this._handledMesh.hasLines&&(null!==(a=I._internalMetadata)&&void 0!==a||(I._internalMetadata={}),I._internalMetadata._isLine=!0),0!==(null===(l=this._handledMesh.positions)||void 0===l?void 0:l.length)){var j=new n.VertexData;if(j.uvs=this._handledMesh.uvs,j.indices=this._handledMesh.indices,j.positions=this._handledMesh.positions,this._loadingOptions.computeNormals){var E=new Array;n.VertexData.ComputeNormals(this._handledMesh.positions,this._handledMesh.indices,E),j.normals=E}else j.normals=this._handledMesh.normals;this._loadingOptions.importVertexColors&&(j.colors=this._handledMesh.colors),j.applyToMesh(I),this._loadingOptions.invertY&&(I.scaling.y*=-1),this._loadingOptions.optimizeNormals&&this._optimizeNormals(I),this._babylonMeshesArray.push(I),this._handledMesh.directMaterial&&(I.material=this._handledMesh.directMaterial)}else this._babylonMeshesArray.push(I)}},t.ObjectDescriptor=/^o/,t.GroupDescriptor=/^g/,t.MtlLibGroupDescriptor=/^mtllib /,t.UseMtlDescriptor=/^usemtl /,t.SmoothDescriptor=/^s /,t.VertexPattern=/^v(\s+[\d|.|+|\-|e|E]+){3,7}/,t.NormalPattern=/^vn(\s+[\d|.|+|\-|e|E]+)( +[\d|.|+|\-|e|E]+)( +[\d|.|+|\-|e|E]+)/,t.UVPattern=/^vt(\s+[\d|.|+|\-|e|E]+)( +[\d|.|+|\-|e|E]+)/,t.FacePattern1=/^f\s+(([\d]{1,}[\s]?){3,})+/,t.FacePattern2=/^f\s+((([\d]{1,}\/[\d]{1,}[\s]?){3,})+)/,t.FacePattern3=/^f\s+((([\d]{1,}\/[\d]{1,}\/[\d]{1,}[\s]?){3,})+)/,t.FacePattern4=/^f\s+((([\d]{1,}\/\/[\d]{1,}[\s]?){3,})+)/,t.FacePattern5=/^f\s+(((-[\d]{1,}\/-[\d]{1,}\/-[\d]{1,}[\s]?){3,})+)/,t.LinePattern1=/^l\s+(([\d]{1,}[\s]?){2,})+/,t.LinePattern2=/^l\s+((([\d]{1,}\/[\d]{1,}[\s]?){2,})+)/,t.LinePattern3=/^l\s+((([\d]{1,}\/[\d]{1,}\/[\d]{1,}[\s]?){2,})+)/,t}(),p=function(){function t(e){this.name="obj",this.extensions=".obj",this._assetContainer=null,this._loadingOptions=e||t._DefaultLoadingOptions}return Object.defineProperty(t,"INVERT_TEXTURE_Y",{get:function(){return l.INVERT_TEXTURE_Y},set:function(t){l.INVERT_TEXTURE_Y=t},enumerable:!1,configurable:!0}),Object.defineProperty(t,"_DefaultLoadingOptions",{get:function(){return{computeNormals:t.COMPUTE_NORMALS,optimizeNormals:t.OPTIMIZE_NORMALS,importVertexColors:t.IMPORT_VERTEX_COLORS,invertY:t.INVERT_Y,invertTextureY:t.INVERT_TEXTURE_Y,UVScaling:t.UV_SCALING,materialLoadingFailsSilently:t.MATERIAL_LOADING_FAILS_SILENTLY,optimizeWithUV:t.OPTIMIZE_WITH_UV,skipMaterials:t.SKIP_MATERIALS,useLegacyBehavior:t.USE_LEGACY_BEHAVIOR}},enumerable:!1,configurable:!0}),t.prototype._loadMTL=function(t,e,s,i){var r=e+t;n.Tools.LoadFile(r,s,void 0,void 0,!1,(function(t,e){i(r,e)}))},t.prototype.createPlugin=function(){return new t(t._DefaultLoadingOptions)},t.prototype.canDirectLoad=function(){return!1},t.prototype.importMeshAsync=function(t,e,s,i){return this._parseSolid(t,e,s,i).then((function(t){return{meshes:t,particleSystems:[],skeletons:[],animationGroups:[],transformNodes:[],geometries:[],lights:[],spriteManagers:[]}}))},t.prototype.loadAsync=function(t,e,s){return this.importMeshAsync(null,t,e,s).then((function(){}))},t.prototype.loadAssetContainerAsync=function(t,e,s){var i=this,r=new n.AssetContainer(t);return this._assetContainer=r,this.importMeshAsync(null,t,e,s).then((function(t){return t.meshes.forEach((function(t){return r.meshes.push(t)})),t.meshes.forEach((function(t){var e=t.material;e&&-1==r.materials.indexOf(e)&&(r.materials.push(e),e.getActiveTextures().forEach((function(t){-1==r.textures.indexOf(t)&&r.textures.push(t)})))})),i._assetContainer=null,r})).catch((function(t){throw i._assetContainer=null,t}))},t.prototype._parseSolid=function(t,e,s,i){var r=this,o="",a=new l,p=[],_=[];s=s.replace(/#.*$/gm,"").trim(),new h(p,_,this._loadingOptions).parse(t,s,e,this._assetContainer,(function(t){o=t}));var d=[];return""===o||this._loadingOptions.skipMaterials||d.push(new Promise((function(t,s){r._loadMTL(o,i,(function(l){try{a.parseMTL(e,l,i,r._assetContainer);for(var h=0;h<a.materials.length;h++){for(var d=0,u=[],m=void 0;(m=p.indexOf(a.materials[h].name,d))>-1;)u.push(m),d=m+1;if(-1===m&&0===u.length)a.materials[h].dispose();else for(var c=0;c<u.length;c++){var f=_[u[c]],g=a.materials[h];f.material=g,f.getTotalIndices()||(g.pointsCloud=!0)}}t()}catch(e){n.Tools.Warn("Error processing MTL file: '".concat(o,"'")),r._loadingOptions.materialLoadingFailsSilently?t():s(e)}}),(function(e,i){n.Tools.Warn("Error downloading MTL file: '".concat(o,"'")),r._loadingOptions.materialLoadingFailsSilently?t():s(i)}))}))),Promise.all(d).then((function(){var t=function(t){var e,s;return Boolean(null!==(s=null===(e=t._internalMetadata)||void 0===e?void 0:e._isLine)&&void 0!==s&&s)};return _.forEach((function(s){var i,r;if(t(s)){var o=null!==(i=s.material)&&void 0!==i?i:new n.StandardMaterial(s.name+"_line",e);o.getBindedMeshes().filter((function(e){return!t(e)})).length>0&&(o=null!==(r=o.clone(o.name+"_line"))&&void 0!==r?r:o),o.wireframe=!0,s.material=o,s._internalMetadata&&(s._internalMetadata._isLine=void 0)}})),_}))},t.OPTIMIZE_WITH_UV=!0,t.INVERT_Y=!1,t.IMPORT_VERTEX_COLORS=!1,t.COMPUTE_NORMALS=!1,t.OPTIMIZE_NORMALS=!1,t.UV_SCALING=new n.Vector2(1,1),t.SKIP_MATERIALS=!1,t.MATERIAL_LOADING_FAILS_SILENTLY=!0,t.USE_LEGACY_BEHAVIOR=!1,t}();n.SceneLoader&&n.SceneLoader.RegisterPlugin(new p);var _=void 0!==i.g?i.g:"undefined"!=typeof window?window:void 0;if(void 0!==_)for(var d in o)_.BABYLON[d]||(_.BABYLON[d]=o[d]);const u=a;return r.default})()));
2
2
  //# sourceMappingURL=babylon.objFileLoader.min.js.map