!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("babylonjs")):"function"==typeof define&&define.amd?define("babylonjs-serializers",["babylonjs"],t):"object"==typeof exports?exports["babylonjs-serializers"]=t(require("babylonjs")):e.SERIALIZERS=t(e.BABYLON)}("undefined"!=typeof self?self:"undefined"!=typeof global?global:this,function(e){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=13)}([function(t,r){t.exports=e},function(e,t,r){"use strict";r.d(t,"a",function(){return a});var n=r(0),a=function(){function e(){}return e._CreateBufferView=function(e,t,r,n,a){var i={buffer:e,byteLength:r};return t&&(i.byteOffset=t),a&&(i.name=a),n&&(i.byteStride=n),i},e._CreateAccessor=function(e,t,r,n,a,i,o,s){var l={name:t,bufferView:e,componentType:n,count:a,type:r};return null!=o&&(l.min=o),null!=s&&(l.max=s),null!=i&&(l.byteOffset=i),l},e._CalculateMinMaxPositions=function(t,r,a,i){var o,s,l,u=[1/0,1/0,1/0],c=[-1/0,-1/0,-1/0];if(a)for(var f=r,h=r+a;fc[p]&&(c[p]=d),++o}}return{min:u,max:c}},e._GetRightHandedPositionVector3=function(e){return new n.Vector3(e.x,e.y,-e.z)},e._GetRightHandedPositionVector3FromRef=function(e){e.z*=-1},e._GetRightHandedPositionArray3FromRef=function(e){e[2]*=-1},e._GetRightHandedNormalVector3=function(e){return new n.Vector3(e.x,e.y,-e.z)},e._GetRightHandedNormalVector3FromRef=function(e){e.z*=-1},e._GetRightHandedNormalArray3FromRef=function(e){e[2]*=-1},e._GetRightHandedVector4FromRef=function(e){e.z*=-1,e.w*=-1},e._GetRightHandedArray4FromRef=function(e){e[2]*=-1,e[3]*=-1},e._GetRightHandedQuaternionFromRef=function(e){e.x*=-1,e.y*=-1},e._GetRightHandedQuaternionArrayFromRef=function(e){e[0]*=-1,e[1]*=-1},e._NormalizeTangentFromRef=function(e){var t=Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z);t>0&&(e.x/=t,e.y/=t,e.z/=t)},e}()},function(e,t,r){"use strict";r.d(t,"b",function(){return l}),r.d(t,"a",function(){return u});var n=r(0),a=r(10),i=r(1),o=r(3),s=r(7),l=function(){function e(e,t){this._extensions={},this._glTF={asset:{generator:"BabylonJS",version:"2.0"}},this._babylonScene=e,this._bufferViews=[],this._accessors=[],this._meshes=[],this._scenes=[],this._nodes=[],this._images=[],this._materials=[],this._materialMap=[],this._textures=[],this._samplers=[],this._animations=[],this._imageData={},this._convertToRightHandedSystem=!this._babylonScene.useRightHandedSystem;var r=t||{};this._shouldExportNode=r.shouldExportNode?r.shouldExportNode:function(e){return!0},this._animationSampleRate=r.animationSampleRate?r.animationSampleRate:1/60,this._glTFMaterialExporter=new a.a(this),this._loadExtensions()}return e.prototype._applyExtensions=function(t,r){for(var n=0,a=e._ExtensionNames;n=f;--o)i.setUInt32(r[o],a),a+=4;break;case n.Material.TriangleStripDrawMode:e.indexCount>=3&&(i.setUInt32(r[e.indexStart+2],a+4),i.setUInt32(r[e.indexStart+1],a+8))}},e.prototype.reorderVertexAttributeDataBasedOnPrimitiveMode=function(e,t,r,a,i,o,s){if(this._convertToRightHandedSystem&&r===n.Material.ClockWiseSideOrientation)switch(t){case n.Material.TriangleFillMode:this.reorderTriangleFillMode(e,t,r,a,i,o,s);break;case n.Material.TriangleStripDrawMode:this.reorderTriangleStripDrawMode(e,t,r,a,i,o,s);break;case n.Material.TriangleFanDrawMode:this.reorderTriangleFanMode(e,t,r,a,i,o,s)}},e.prototype.reorderTriangleFillMode=function(e,t,r,a,i,o,s){var l=this.getVertexBufferFromMesh(a,e.getMesh());if(l){var u=l.byteStride/n.VertexBuffer.GetTypeByteLength(l.type);if(e.verticesCount%3!=0)n.Tools.Error("The submesh vertices for the triangle fill mode is not divisible by 3!");else{var c=[],f=0;switch(a){case n.VertexBuffer.PositionKind:case n.VertexBuffer.NormalKind:for(var h=e.verticesStart;h=e.verticesStart;--h)f=h*u,c.push(n.Vector4.FromArray(i,f));break;case n.VertexBuffer.ColorKind:for(h=e.verticesStart+e.verticesCount-1;h>=e.verticesStart;--h)f=h*u,4===l.getSize()?c.push(n.Vector4.FromArray(i,f)):c.push(n.Vector3.FromArray(i,f));break;case n.VertexBuffer.UVKind:case n.VertexBuffer.UV2Kind:for(h=e.verticesStart+e.verticesCount-1;h>=e.verticesStart;--h)f=h*u,c.push(n.Vector2.FromArray(i,f));break;default:n.Tools.Error("Unsupported Vertex Buffer type: "+a)}this.writeVertexAttributeData(c,o+12,a,i,s)}else n.Tools.Warn("reorderTriangleStripDrawMode: Vertex buffer kind "+a+" not present!")},e.prototype.reorderTriangleFanMode=function(e,t,r,a,i,o,s){var l=this.getVertexBufferFromMesh(a,e.getMesh());if(l){var u=l.byteStride/n.VertexBuffer.GetTypeByteLength(l.type),c=[],f=0;switch(a){case n.VertexBuffer.PositionKind:case n.VertexBuffer.NormalKind:for(var h=e.verticesStart+e.verticesCount-1;h>=e.verticesStart;--h)f=h*u,c.push(n.Vector3.FromArray(i,f));break;case n.VertexBuffer.TangentKind:for(h=e.verticesStart+e.verticesCount-1;h>=e.verticesStart;--h)f=h*u,c.push(n.Vector4.FromArray(i,f));break;case n.VertexBuffer.ColorKind:for(h=e.verticesStart+e.verticesCount-1;h>=e.verticesStart;--h)f=h*u,c.push(n.Vector4.FromArray(i,f)),4===l.getSize()?c.push(n.Vector4.FromArray(i,f)):c.push(n.Vector3.FromArray(i,f));break;case n.VertexBuffer.UVKind:case n.VertexBuffer.UV2Kind:for(h=e.verticesStart+e.verticesCount-1;h>=e.verticesStart;--h)f=h*u,c.push(n.Vector2.FromArray(i,f));break;default:n.Tools.Error("Unsupported Vertex Buffer type: "+a)}this.writeVertexAttributeData(c,o,a,i,s)}else n.Tools.Warn("reorderTriangleFanMode: Vertex buffer kind "+a+" not present!")},e.prototype.writeVertexAttributeData=function(e,t,r,a,o){for(var s=0,l=e;s0){var I=E.sideOrientation;if(this._convertToRightHandedSystem&&I===n.Material.ClockWiseSideOrientation){var G=null!=f?this._bufferViews[f].byteOffset:null;null==G&&(G=0);var O=null;if(null!=f&&(O=u.getIndices()),O)this.reorderIndicesBasedOnPrimitiveMode(F,h,O,G,r);else for(var D=0,U=c;Dthis._arrayBuffer.byteLength&&this.resizeBuffer(2*this._arrayBuffer.byteLength),this._dataView.setUint8(this._byteOffset++,e))},e.prototype.getUInt32=function(e){if(ethis._byteOffset?n.Tools.Error("BinaryWriter: byteoffset is greater than the current binary buffer length!"):(e.x=this._dataView.getFloat32(t,!0),e.y=this._dataView.getFloat32(t+4,!0),e.z=this._dataView.getFloat32(t+8,!0))},e.prototype.setVector3Float32FromRef=function(e,t){t+8>this._byteOffset?n.Tools.Error("BinaryWriter: byteoffset is greater than the current binary buffer length!"):(this._dataView.setFloat32(t,e.x,!0),this._dataView.setFloat32(t+4,e.y,!0),this._dataView.setFloat32(t+8,e.z,!0))},e.prototype.getVector4Float32FromRef=function(e,t){t+12>this._byteOffset?n.Tools.Error("BinaryWriter: byteoffset is greater than the current binary buffer length!"):(e.x=this._dataView.getFloat32(t,!0),e.y=this._dataView.getFloat32(t+4,!0),e.z=this._dataView.getFloat32(t+8,!0),e.w=this._dataView.getFloat32(t+12,!0))},e.prototype.setVector4Float32FromRef=function(e,t){t+12>this._byteOffset?n.Tools.Error("BinaryWriter: byteoffset is greater than the current binary buffer length!"):(this._dataView.setFloat32(t,e.x,!0),this._dataView.setFloat32(t+4,e.y,!0),this._dataView.setFloat32(t+8,e.z,!0),this._dataView.setFloat32(t+12,e.w,!0))},e.prototype.setFloat32=function(e,t){isNaN(e)&&n.Tools.Error("Invalid data being written!"),null!=t&&(tthis._arrayBuffer.byteLength&&this.resizeBuffer(2*this._arrayBuffer.byteLength),this._dataView.setFloat32(this._byteOffset,e,!0),this._byteOffset+=4},e.prototype.setUInt32=function(e,t){null!=t?tthis._arrayBuffer.byteLength&&this.resizeBuffer(2*this._arrayBuffer.byteLength),this._dataView.setUint32(this._byteOffset,e,!0),this._byteOffset+=4)},e}()},function(e,t,r){"use strict";r.r(t),r.d(t,"GLTFData",function(){return n});var n=function(){function e(){this.glTFFiles={}}return e.prototype.downloadFiles=function(){function e(e,t){return-1!==e.indexOf(t,e.length-t.length)}for(var t in this.glTFFiles){var r=document.createElement("a");document.body.appendChild(r),r.setAttribute("type","hidden"),r.download=t;var n=this.glTFFiles[t],a=void 0;e(t,".glb")?a={type:"model/gltf-binary"}:e(t,".bin")?a={type:"application/octet-stream"}:e(t,".gltf")?a={type:"model/gltf+json"}:e(t,".jpeg")?a={type:"image/jpeg"}:e(t,".png")&&(a={type:"image/png"}),r.href=window.URL.createObjectURL(new Blob([n],a)),r.click()}},e}()},function(e,t,r){"use strict";r.r(t),r.d(t,"__IGLTFExporterExtension",function(){return n});var n=0},,function(e,t,r){"use strict";r.r(t);var n=r(7),a=r(3),i=r(2),o=r(10),s=r(8),l=r(1),u=r(9);r.d(t,"_GLTFAnimation",function(){return n.a}),r.d(t,"GLTFData",function(){return a.GLTFData}),r.d(t,"_Exporter",function(){return i.b}),r.d(t,"_BinaryWriter",function(){return i.a}),r.d(t,"__IGLTFExporterExtensionV2",function(){return 0}),r.d(t,"_GLTFMaterialExporter",function(){return o.a}),r.d(t,"GLTF2Export",function(){return s.GLTF2Export}),r.d(t,"_GLTFUtilities",function(){return l.a}),r.d(t,"KHR_texture_transform",function(){return u.KHR_texture_transform}),r.d(t,"KHR_lights_punctual",function(){return u.KHR_lights_punctual})},function(e,t,r){"use strict";r.d(t,"a",function(){return o});var n,a=r(0),i=r(1);!function(e){e[e.INTANGENT=0]="INTANGENT",e[e.OUTTANGENT=1]="OUTTANGENT"}(n||(n={}));var o=function(){function e(){}return e._CreateNodeAnimation=function(t,r,n,i,o,s){var l=[],u=[],c=r.getKeys(),f=e.calculateMinMaxKeyFrames(c),h=e._DeduceInterpolation(c,n,o),p=f.max-f.min,d=h.interpolationType,g=h.shouldBakeAnimation;return g?e._CreateBakedAnimation(t,r,n,f.min,f.max,r.framePerSecond,s,l,u,f,i,o):"LINEAR"===d||"STEP"===d?e._CreateLinearOrStepAnimation(t,r,n,p,l,u,i,o):"CUBICSPLINE"===d?e._CreateCubicSplineAnimation(t,r,n,p,l,u,i,o):e._CreateBakedAnimation(t,r,n,f.min,f.max,r.framePerSecond,s,l,u,f,i,o),l.length&&u.length?{inputs:l,outputs:u,samplerInterpolation:d,inputsMin:g?f.min:a.Tools.FloatRound(f.min/r.framePerSecond),inputsMax:g?f.max:a.Tools.FloatRound(f.max/r.framePerSecond)}:null},e._DeduceAnimationInfo=function(e){var t=null,r="VEC3",n=!1,i=e.targetProperty.split(".");switch(i[0]){case"scaling":t="scale";break;case"position":t="translation";break;case"rotation":r="VEC4",t="rotation";break;case"rotationQuaternion":r="VEC4",n=!0,t="rotation";break;default:a.Tools.Error("Unsupported animatable property "+i[0])}return t?{animationChannelTargetPath:t,dataAccessorType:r,useQuaternion:n}:(a.Tools.Error("animation channel target path and data accessor type could be deduced"),null)},e._CreateNodeAnimationFromNodeAnimations=function(t,r,n,i,o,s,l,u,c,f){var h;if(t instanceof a.TransformNode&&t.animations)for(var p=0,d=t.animations;ps.width?(i=t&&t instanceof n.Texture?n.TextureTools.CreateResizedCopy(t,o.width,o.height,!0):this._createWhiteTexture(o.width,o.height,r),a=e):(a=e,i=t),{texture1:a,texture2:i}},e.prototype._convertPixelArrayToFloat32=function(e){if(e instanceof Uint8Array){for(var t=e.length,r=new Float32Array(e.length),n=0;ne._Epsilon?M.baseColor.r:1,y[w+1]/=M.baseColor.g>e._Epsilon?M.baseColor.g:1,y[w+2]/=M.baseColor.b>e._Epsilon?M.baseColor.b:1;var C=n.Color3.FromInts(y[w],y[w+1],y[w+2]).toGammaSpace();y[w]=255*C.r,y[w+1]=255*C.g,y[w+2]=255*C.b,e.FuzzyEquals(C,n.Color3.White(),e._Epsilon)||(V=!0),_[w+1]/=M.roughness>e._Epsilon?M.roughness:1,_[w+2]/=M.metallic>e._Epsilon?M.metallic:1;var B=n.Color3.FromInts(255,_[w+1],_[w+2]);e.FuzzyEquals(B,n.Color3.White(),e._Epsilon)||(S=!0)}if(S){var P=this._createBase64FromCanvasAsync(_,h,p,i).then(function(e){M.metallicRoughnessTextureBase64=e});o.push(P)}if(V){P=this._createBase64FromCanvasAsync(y,h,p,i).then(function(e){M.baseColorTextureBase64=e});o.push(P)}return Promise.all(o).then(function(){return M})}return Promise.reject("_ConvertSpecularGlossinessTexturesToMetallicRoughness: Scene from textures is missing!")},e.prototype._convertSpecularGlossinessToMetallicRoughness=function(t){var r=this._getPerceivedBrightness(t.diffuseColor),a=this._getPerceivedBrightness(t.specularColor),i=1-this._getMaxComponent(t.specularColor),o=e._SolveMetallic(r,a,i),s=t.diffuseColor.scale(i/(1-e._DielectricSpecular.r)/Math.max(1-o,e._Epsilon)),l=t.specularColor.subtract(e._DielectricSpecular.scale(1-o)).scale(1/Math.max(o,e._Epsilon)),u=n.Color3.Lerp(s,l,o*o);return{baseColor:u=u.clampToRef(0,1,u),metallic:o,roughness:1-t.glossiness}},e.prototype._getPerceivedBrightness=function(e){return e?Math.sqrt(.299*e.r*e.r+.587*e.g*e.g+.114*e.b*e.b):0},e.prototype._getMaxComponent=function(e){return e?Math.max(e.r,Math.max(e.g,e.b)):0},e.prototype._convertMetalRoughFactorsToMetallicRoughnessAsync=function(e,t,r,n){var a=[],i={baseColor:e.albedoColor,metallic:e.metallic,roughness:e.roughness};return n&&(e.albedoTexture&&a.push(this._exportTextureAsync(e.albedoTexture,t).then(function(e){e&&(r.baseColorTexture=e)})),e.metallicTexture&&a.push(this._exportTextureAsync(e.metallicTexture,t).then(function(e){e&&(r.metallicRoughnessTexture=e)}))),Promise.all(a).then(function(){return i})},e.prototype._getGLTFTextureSampler=function(e){var t=this._getGLTFTextureWrapModesSampler(e),r=e instanceof n.Texture?e.samplingMode:null;if(null!=r)switch(r){case n.Texture.LINEAR_LINEAR:t.magFilter=9729,t.minFilter=9729;break;case n.Texture.LINEAR_NEAREST:t.magFilter=9729,t.minFilter=9728;break;case n.Texture.NEAREST_LINEAR:t.magFilter=9728,t.minFilter=9729;break;case n.Texture.NEAREST_LINEAR_MIPLINEAR:t.magFilter=9728,t.minFilter=9987;break;case n.Texture.NEAREST_NEAREST:t.magFilter=9728,t.minFilter=9728;break;case n.Texture.NEAREST_LINEAR_MIPNEAREST:t.magFilter=9728,t.minFilter=9985;break;case n.Texture.LINEAR_NEAREST_MIPNEAREST:t.magFilter=9729,t.minFilter=9984;break;case n.Texture.LINEAR_NEAREST_MIPLINEAR:t.magFilter=9729,t.minFilter=9986;break;case n.Texture.NEAREST_NEAREST_MIPLINEAR:t.magFilter=9728,t.minFilter=9986;break;case n.Texture.LINEAR_LINEAR_MIPLINEAR:t.magFilter=9729,t.minFilter=9987;break;case n.Texture.LINEAR_LINEAR_MIPNEAREST:t.magFilter=9729,t.minFilter=9985;break;case n.Texture.NEAREST_NEAREST_MIPNEAREST:t.magFilter=9728,t.minFilter=9984}return t},e.prototype._getGLTFTextureWrapMode=function(e){switch(e){case n.Texture.WRAP_ADDRESSMODE:return 10497;case n.Texture.CLAMP_ADDRESSMODE:return 33071;case n.Texture.MIRROR_ADDRESSMODE:return 33648;default:return n.Tools.Error("Unsupported Texture Wrap Mode "+e+"!"),10497}},e.prototype._getGLTFTextureWrapModesSampler=function(e){var t=this._getGLTFTextureWrapMode(e instanceof n.Texture?e.wrapU:n.Texture.WRAP_ADDRESSMODE),r=this._getGLTFTextureWrapMode(e instanceof n.Texture?e.wrapV:n.Texture.WRAP_ADDRESSMODE);return 10497===t&&10497===r?{}:{wrapS:t,wrapT:r}},e.prototype._convertSpecGlossFactorsToMetallicRoughnessAsync=function(e,t,r,a){var i=this;return Promise.resolve().then(function(){var o=i._exporter._samplers,s=i._exporter._textures,l={diffuseColor:e.albedoColor||n.Color3.White(),specularColor:e.reflectivityColor||n.Color3.White(),glossiness:e.microSurface||1},u=null,c=i._getGLTFTextureSampler(e.albedoTexture);return null!=c.magFilter&&null!=c.minFilter&&null!=c.wrapS&&null!=c.wrapT&&(o.push(c),u=o.length-1),e.reflectivityTexture&&!e.useMicroSurfaceFromReflectivityMapAlpha?Promise.reject("_ConvertPBRMaterial: Glossiness values not included in the reflectivity texture are currently not supported"):(e.albedoTexture||e.reflectivityTexture)&&a?i._convertSpecularGlossinessTexturesToMetallicRoughnessAsync(e.albedoTexture,e.reflectivityTexture,l,t).then(function(n){if(n.baseColorTextureBase64){var a=i._getTextureInfoFromBase64(n.baseColorTextureBase64,"bjsBaseColorTexture_"+s.length+".png",t,e.albedoTexture?e.albedoTexture.coordinatesIndex:null,u);a&&(r.baseColorTexture=a)}if(n.metallicRoughnessTextureBase64){var o=i._getTextureInfoFromBase64(n.metallicRoughnessTextureBase64,"bjsMetallicRoughnessTexture_"+s.length+".png",t,e.reflectivityTexture?e.reflectivityTexture.coordinatesIndex:null,u);o&&(r.metallicRoughnessTexture=o)}return n}):i._convertSpecularGlossinessToMetallicRoughness(l)})},e.prototype._convertPBRMaterialAsync=function(e,t,r){var n=this,a={},i={name:e.name};return e.isMetallicWorkflow()?(e.albedoColor&&(a.baseColorFactor=[e.albedoColor.r,e.albedoColor.g,e.albedoColor.b,e.alpha]),this._convertMetalRoughFactorsToMetallicRoughnessAsync(e,t,a,r).then(function(o){return n.setMetallicRoughnessPbrMaterial(o,e,i,a,t,r)})):this._convertSpecGlossFactorsToMetallicRoughnessAsync(e,t,a,r).then(function(o){return n.setMetallicRoughnessPbrMaterial(o,e,i,a,t,r)})},e.prototype.setMetallicRoughnessPbrMaterial=function(t,r,a,i,o,s){var l=this._exporter._materialMap,u=this._exporter._materials,c=[];if(t){var f=null;if(null!=r.transparencyMode&&(f=this._getAlphaMode(r))&&"OPAQUE"!==f&&(a.alphaMode=f,"MASK"===f&&(a.alphaCutoff=r.alphaCutOff)),e.FuzzyEquals(t.baseColor,n.Color3.White(),e._Epsilon)&&r.alpha>=e._Epsilon||(i.baseColorFactor=[t.baseColor.r,t.baseColor.g,t.baseColor.b,r.alpha]),null!=t.metallic&&1!==t.metallic&&(i.metallicFactor=t.metallic),null!=t.roughness&&1!==t.roughness&&(i.roughnessFactor=t.roughness),null==r.backFaceCulling||r.backFaceCulling||(r.twoSidedLighting||n.Tools.Warn(r.name+": Back-face culling enabled and two-sided lighting disabled is not supported in glTF."),a.doubleSided=!0),s){if(r.bumpTexture){var h=this._exportTextureAsync(r.bumpTexture,o).then(function(e){e&&(a.normalTexture=e,1!==r.bumpTexture.level&&(a.normalTexture.scale=r.bumpTexture.level))});c.push(h)}if(r.ambientTexture){h=this._exportTextureAsync(r.ambientTexture,o).then(function(e){if(e){var t={index:e.index};a.occlusionTexture=t,r.ambientTextureStrength&&(t.strength=r.ambientTextureStrength)}});c.push(h)}if(r.emissiveTexture){h=this._exportTextureAsync(r.emissiveTexture,o).then(function(e){e&&(a.emissiveTexture=e)});c.push(h)}}e.FuzzyEquals(r.emissiveColor,n.Color3.Black(),e._Epsilon)||(a.emissiveFactor=r.emissiveColor.asArray()),a.pbrMetallicRoughness=i,u.push(a),l[r.uniqueId]=u.length-1}return Promise.all(c).then(function(e){})},e.prototype.getPixelsFromTexture=function(e){return e.textureType,n.Engine.TEXTURETYPE_UNSIGNED_INT,e.readPixels()},e.prototype._exportTextureAsync=function(e,t){var r=this,n=this._exporter._extensionsPreExportTextureAsync("exporter",e,t);return n?n.then(function(n){return n?r._exportTextureInfoAsync(n,t):r._exportTextureInfoAsync(e,t)}):this._exportTextureInfoAsync(e,t)},e.prototype._exportTextureInfoAsync=function(e,t){var r=this;return Promise.resolve().then(function(){var n=e.uid;if(n in r._textureMap)return r._textureMap[n];for(var a=r._exporter._samplers,i=r._getGLTFTextureSampler(e),o=null,s=null,l=0;l-1||(u.GLTF2.Exporter[f]=s[f])}}.call(this,r(11))}])});