babylonjs-serializers
Advanced tools
Comparing version 3.3.0-alpha.1 to 3.3.0-alpha.2
@@ -1,2 +0,2 @@ | ||
!(function(e,t){var r=[],a=e.BABYLON||this.BABYLON;"object"==typeof exports&&"object"==typeof module?(a=a||require("babylonjs"),module.exports=t(a)):"function"==typeof define&&define.amd?(r.push("babylonjs"),define("babylonjs-serializers",r,t)):"object"==typeof exports?(a=a||require("babylonjs"),exports["babylonjs-serializers"]=t(a)):e.BABYLON=t(a)})(this,(function(e){e=e||this.BABYLON;var e;this&&this.__decorate,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])}})();!(function(e){var t=(function(){function t(){}return t.OBJ=function(t,r,a,i){var n=[],o=1;r&&(a||(a="mat"),n.push("mtllib "+a+".mtl"));for(var s=0;s<t.length;s++){n.push("g object"+s),n.push("o object_"+s);var l=null;if(i){var u=e.Matrix.Translation(t[s].position.x,t[s].position.y,t[s].position.z);l=e.Matrix.Translation(-t[s].position.x,-t[s].position.y,-t[s].position.z),t[s].bakeTransformIntoVertices(u)}if(r){var f=t[s].material;f&&n.push("usemtl "+f.id)}var c=t[s].geometry;if(c){var h=c.getVerticesData("position"),d=c.getVerticesData("normal"),m=c.getVerticesData("uv"),p=c.getIndices(),g=0;if(h&&d&&m&&p){for(var T=0;T<h.length;T+=3)n.push("v "+h[T]+" "+h[T+1]+" "+h[T+2]),g++;for(T=0;T<d.length;T+=3)n.push("vn "+d[T]+" "+d[T+1]+" "+d[T+2]);for(T=0;T<m.length;T+=2)n.push("vt "+m[T]+" "+m[T+1]);for(T=0;T<p.length;T+=3)n.push("f "+(p[T+2]+o)+"/"+(p[T+2]+o)+"/"+(p[T+2]+o)+" "+(p[T+1]+o)+"/"+(p[T+1]+o)+"/"+(p[T+1]+o)+" "+(p[T]+o)+"/"+(p[T]+o)+"/"+(p[T]+o));i&&l&&t[s].bakeTransformIntoVertices(l),o+=g}}}return n.join("\n")},t.MTL=function(e){var t=[],r=e.material;t.push("newmtl mat1"),t.push(" Ns "+r.specularPower.toFixed(4)),t.push(" Ni 1.5000"),t.push(" d "+r.alpha.toFixed(4)),t.push(" Tr 0.0000"),t.push(" Tf 1.0000 1.0000 1.0000"),t.push(" illum 2"),t.push(" Ka "+r.ambientColor.r.toFixed(4)+" "+r.ambientColor.g.toFixed(4)+" "+r.ambientColor.b.toFixed(4)),t.push(" Kd "+r.diffuseColor.r.toFixed(4)+" "+r.diffuseColor.g.toFixed(4)+" "+r.diffuseColor.b.toFixed(4)),t.push(" Ks "+r.specularColor.r.toFixed(4)+" "+r.specularColor.g.toFixed(4)+" "+r.specularColor.b.toFixed(4)),t.push(" Ke "+r.emissiveColor.r.toFixed(4)+" "+r.emissiveColor.g.toFixed(4)+" "+r.emissiveColor.b.toFixed(4));return r.ambientTexture&&t.push(" map_Ka "+r.ambientTexture.name),r.diffuseTexture&&t.push(" map_Kd "+r.diffuseTexture.name),r.specularTexture&&t.push(" map_Ks "+r.specularTexture.name),r.bumpTexture&&t.push(" map_bump -imfchan z "+r.bumpTexture.name),r.opacityTexture&&t.push(" map_d "+r.opacityTexture.name),t.join("\n")},t})();e.OBJExport=t})(e||(e={}));var e;!(function(e){var t=(function(){function t(){}return t.GLTF=function(t,r,a){var i=r.replace(/\.[^\/.]+$/,"");return new e.GLTF2._Exporter(t,a)._generateGLTF(i)},t.GLTFAsync=function(e,r,a){return Promise.resolve(e.whenReadyAsync()).then((function(){return t.GLTF(e,r,a)}))},t.GLB=function(t,r,a){var i=r.replace(/\.[^\/.]+$/,"");return new e.GLTF2._Exporter(t,a)._generateGLB(i)},t.GLBAsync=function(e,r,a){return Promise.resolve(e.whenReadyAsync()).then((function(){return t.GLB(e,r,a)}))},t})();e.GLTF2Export=t})(e||(e={}));var e;!(function(e){!(function(t){var r=(function(){function r(e,t){this.asset={generator:"BabylonJS",version:"2.0"},this.babylonScene=e,this.bufferViews=[],this.accessors=[],this.meshes=[],this.scenes=[],this.nodes=[],this.images=[],this.materials=[],this.textures=[],this.samplers=[],this.animations=[],this.imageData={},this.convertToRightHandedSystem=!this.babylonScene.useRightHandedSystem;var r=t||{};this.shouldExportTransformNode=r.shouldExportTransformNode?r.shouldExportTransformNode:function(e){return!0},this.animationSampleRate=r.animationSampleRate?r.animationSampleRate:1/60}return r.prototype.reorderIndicesBasedOnPrimitiveMode=function(t,r,a,i,n){switch(r){case e.Material.TriangleFillMode:i||(i=0);for(var o=t.indexStart,s=t.indexStart+t.indexCount;o<s;o+=3){var l=i+4*o,u=n.getUInt32(l+4),f=n.getUInt32(l+8);n.setUInt32(f,l+4),n.setUInt32(u,l+8)}break;case e.Material.TriangleFanDrawMode:for(var o=t.indexStart+t.indexCount-1,c=t.indexStart;o>=c;--o)n.setUInt32(a[o],i),i+=4;break;case e.Material.TriangleStripDrawMode:t.indexCount>=3&&(n.setUInt32(a[t.indexStart+2],i+4),n.setUInt32(a[t.indexStart+1],i+8))}},r.prototype.reorderVertexAttributeDataBasedOnPrimitiveMode=function(t,r,a,i,n,o,s){if(this.convertToRightHandedSystem&&a===e.Material.ClockWiseSideOrientation)switch(r){case e.Material.TriangleFillMode:this.reorderTriangleFillMode(t,r,a,i,n,o,s);break;case e.Material.TriangleStripDrawMode:this.reorderTriangleStripDrawMode(t,r,a,i,n,o,s);break;case e.Material.TriangleFanDrawMode:this.reorderTriangleFanMode(t,r,a,i,n,o,s)}},r.prototype.reorderTriangleFillMode=function(t,r,a,i,n,o,s){var l=this.getVertexBufferFromMesh(i,t.getMesh());if(l){var u=l.byteStride/e.VertexBuffer.GetTypeByteLength(l.type);if(t.verticesCount%3!=0)e.Tools.Error("The submesh vertices for the triangle fill mode is not divisible by 3!");else{var f=[],c=0;switch(i){case e.VertexBuffer.PositionKind:case e.VertexBuffer.NormalKind:for(var h=t.verticesStart;h<t.verticesStart+t.verticesCount;h+=3)c=h*u,f.push(e.Vector3.FromArray(n,c)),f.push(e.Vector3.FromArray(n,c+2*u)),f.push(e.Vector3.FromArray(n,c+u));break;case e.VertexBuffer.TangentKind:for(var h=t.verticesStart;h<t.verticesStart+t.verticesCount;h+=3)c=h*u,f.push(e.Vector4.FromArray(n,c)),f.push(e.Vector4.FromArray(n,c+2*u)),f.push(e.Vector4.FromArray(n,c+u));break;case e.VertexBuffer.ColorKind:for(var d=l.getSize(),h=t.verticesStart;h<t.verticesStart+t.verticesCount;h+=d)c=h*u,4===d?(f.push(e.Vector4.FromArray(n,c)),f.push(e.Vector4.FromArray(n,c+2*u)),f.push(e.Vector4.FromArray(n,c+u))):(f.push(e.Vector3.FromArray(n,c)),f.push(e.Vector3.FromArray(n,c+2*u)),f.push(e.Vector3.FromArray(n,c+u)));break;case e.VertexBuffer.UVKind:case e.VertexBuffer.UV2Kind:for(var h=t.verticesStart;h<t.verticesStart+t.verticesCount;h+=3)c=h*u,f.push(e.Vector2.FromArray(n,c)),f.push(e.Vector2.FromArray(n,c+2*u)),f.push(e.Vector2.FromArray(n,c+u));break;default:e.Tools.Error("Unsupported Vertex Buffer type: "+i)}this.writeVertexAttributeData(f,o,i,n,s)}}else e.Tools.Warn("reorderTriangleFillMode: Vertex Buffer Kind "+i+" not present!")},r.prototype.reorderTriangleStripDrawMode=function(t,r,a,i,n,o,s){var l=this.getVertexBufferFromMesh(i,t.getMesh());if(l){var u=l.byteStride/e.VertexBuffer.GetTypeByteLength(l.type),f=[],c=0;switch(i){case e.VertexBuffer.PositionKind:case e.VertexBuffer.NormalKind:c=t.verticesStart,f.push(e.Vector3.FromArray(n,c+2*u)),f.push(e.Vector3.FromArray(n,c+u));break;case e.VertexBuffer.TangentKind:for(var h=t.verticesStart+t.verticesCount-1;h>=t.verticesStart;--h)c=h*u,f.push(e.Vector4.FromArray(n,c));break;case e.VertexBuffer.ColorKind:for(var h=t.verticesStart+t.verticesCount-1;h>=t.verticesStart;--h)c=h*u,4===l.getSize()?f.push(e.Vector4.FromArray(n,c)):f.push(e.Vector3.FromArray(n,c));break;case e.VertexBuffer.UVKind:case e.VertexBuffer.UV2Kind:for(var h=t.verticesStart+t.verticesCount-1;h>=t.verticesStart;--h)c=h*u,f.push(e.Vector2.FromArray(n,c));break;default:e.Tools.Error("Unsupported Vertex Buffer type: "+i)}this.writeVertexAttributeData(f,o+12,i,n,s)}else e.Tools.Warn("reorderTriangleStripDrawMode: Vertex buffer kind "+i+" not present!")},r.prototype.reorderTriangleFanMode=function(t,r,a,i,n,o,s){var l=this.getVertexBufferFromMesh(i,t.getMesh());if(l){var u=l.byteStride/e.VertexBuffer.GetTypeByteLength(l.type),f=[],c=0;switch(i){case e.VertexBuffer.PositionKind:case e.VertexBuffer.NormalKind:for(var h=t.verticesStart+t.verticesCount-1;h>=t.verticesStart;--h)c=h*u,f.push(e.Vector3.FromArray(n,c));break;case e.VertexBuffer.TangentKind:for(var h=t.verticesStart+t.verticesCount-1;h>=t.verticesStart;--h)c=h*u,f.push(e.Vector4.FromArray(n,c));break;case e.VertexBuffer.ColorKind:for(var h=t.verticesStart+t.verticesCount-1;h>=t.verticesStart;--h)c=h*u,f.push(e.Vector4.FromArray(n,c)),4===l.getSize()?f.push(e.Vector4.FromArray(n,c)):f.push(e.Vector3.FromArray(n,c));break;case e.VertexBuffer.UVKind:case e.VertexBuffer.UV2Kind:for(var h=t.verticesStart+t.verticesCount-1;h>=t.verticesStart;--h)c=h*u,f.push(e.Vector2.FromArray(n,c));break;default:e.Tools.Error("Unsupported Vertex Buffer type: "+i)}this.writeVertexAttributeData(f,o,i,n,s)}else e.Tools.Warn("reorderTriangleFanMode: Vertex buffer kind "+i+" not present!")},r.prototype.writeVertexAttributeData=function(r,a,i,n,o){for(var s=0,l=r;s<l.length;s++){var u=l[s];!this.convertToRightHandedSystem||i===e.VertexBuffer.ColorKind||u instanceof e.Vector2||(u instanceof e.Vector3?i===e.VertexBuffer.PositionKind?t._GLTFUtilities.GetRightHandedPositionVector3FromRef(u):t._GLTFUtilities.GetRightHandedNormalVector3FromRef(u):t._GLTFUtilities.GetRightHandedVector4FromRef(u));for(var f=0,c=u.asArray();f<c.length;f++){var h=c[f];o.setFloat32(h,a),a+=4}}},r.prototype.writeAttributeData=function(r,a,i,n){var o,s=i/4,l=[];switch(r){case e.VertexBuffer.PositionKind:for(var u=0,f=a.length/s;u<f;++u){o=u*s;var c=e.Vector3.FromArray(a,o);this.convertToRightHandedSystem&&t._GLTFUtilities.GetRightHandedPositionVector3FromRef(c),l.push(c.asArray())}break;case e.VertexBuffer.NormalKind:for(var u=0,h=a.length/s;u<h;++u){o=u*s;var c=e.Vector3.FromArray(a,o);this.convertToRightHandedSystem&&t._GLTFUtilities.GetRightHandedNormalVector3FromRef(c),l.push(c.asArray())}break;case e.VertexBuffer.TangentKind:for(var u=0,d=a.length/s;u<d;++u){o=u*s;var c=e.Vector4.FromArray(a,o);this.convertToRightHandedSystem&&t._GLTFUtilities.GetRightHandedVector4FromRef(c),l.push(c.asArray())}break;case e.VertexBuffer.ColorKind:for(var u=0,m=a.length/s;u<m;++u){o=u*s;var c=3===s?e.Vector3.FromArray(a,o):e.Vector4.FromArray(a,o);l.push(c.asArray())}break;case e.VertexBuffer.UVKind:case e.VertexBuffer.UV2Kind:for(var u=0,p=a.length/s;u<p;++u)o=u*s,l.push((this.convertToRightHandedSystem,[a[o],a[o+1]]));break;default:e.Tools.Warn("Unsupported Vertex Buffer Type: "+r),l=[]}for(var g=0,T=l;g<T.length;g++)for(var y=T[g],v=0,x=y;v<x.length;v++){var b=x[v];n.setFloat32(b)}},r.prototype.generateJSON=function(e,r,a){var i,n,o,s=this,l={byteLength:this.totalByteLength},u=this.totalByteLength,f={asset:this.asset};return l.byteLength&&(f.buffers=[l]),this.nodes&&this.nodes.length&&(f.nodes=this.nodes),this.meshes&&this.meshes.length&&(f.meshes=this.meshes),this.scenes&&this.scenes.length&&(f.scenes=this.scenes,f.scene=0),this.bufferViews&&this.bufferViews.length&&(f.bufferViews=this.bufferViews),this.accessors&&this.accessors.length&&(f.accessors=this.accessors),this.animations&&this.animations.length&&(f.animations=this.animations),this.materials&&this.materials.length&&(f.materials=this.materials),this.textures&&this.textures.length&&(f.textures=this.textures),this.samplers&&this.samplers.length&&(f.samplers=this.samplers),this.images&&this.images.length&&(e?(f.images=[],this.images.forEach((function(e){e.uri&&(n=s.imageData[e.uri],i=e.uri.split(".")[0]+" image",o=t._GLTFUtilities.CreateBufferView(0,u,n.data.length,void 0,i),u+=n.data.buffer.byteLength,s.bufferViews.push(o),e.bufferView=s.bufferViews.length-1,e.name=i,e.mimeType=n.mimeType,e.uri=void 0,f.images||(f.images=[]),f.images.push(e))})),l.byteLength=u):f.images=this.images),e||(l.uri=r+".bin"),a?JSON.stringify(f,null,2):JSON.stringify(f)},r.prototype._generateGLTF=function(t){var r=this.generateBinary(),a=this.generateJSON(!1,t,!0),i=new Blob([r],{type:"application/octet-stream"}),n=t+".gltf",o=t+".bin",s=new e.GLTFData;if(s.glTFFiles[n]=a,s.glTFFiles[o]=i,this.imageData)for(var l in this.imageData)s.glTFFiles[l]=new Blob([this.imageData[l].data],{type:this.imageData[l].mimeType});return s},r.prototype.generateBinary=function(){var e=new a(4);return this.createScene(this.babylonScene,e),e.getArrayBuffer()},r.prototype._getPadding=function(e){var t=e%4;return 0===t?t:4-t},r.prototype._generateGLB=function(t){var r=this.generateBinary(),a=this.generateJSON(!0),i=t+".glb",n=a.length,o=0;for(var s in this.imageData)o+=this.imageData[s].data.byteLength;var l=this._getPadding(n),u=this._getPadding(r.byteLength),f=this._getPadding(o),c=28+n+l+r.byteLength+u+o+f,h=new ArrayBuffer(12),d=new DataView(h);d.setUint32(0,1179937895,!0),d.setUint32(4,2,!0),d.setUint32(8,c,!0);var m=new ArrayBuffer(8+n+l),p=new DataView(m);p.setUint32(0,n+l,!0),p.setUint32(4,1313821514,!0);for(var g=new Uint8Array(m,8),T=0;T<n;++T)g[T]=a.charCodeAt(T);for(var y=new Uint8Array(m,8+n),T=0;T<l;++T)y[T]=32;var v=new ArrayBuffer(8),x=new DataView(v);x.setUint32(0,r.byteLength+o+f,!0),x.setUint32(4,5130562,!0);for(var b=new ArrayBuffer(u),F=new Uint8Array(b),T=0;T<u;++T)F[T]=0;for(var A=new ArrayBuffer(f),_=new Uint8Array(A),T=0;T<f;++T)_[T]=0;var R=[h,m,v,r];for(var s in this.imageData)R.push(this.imageData[s].data.buffer);R.push(b),R.push(A);var C=new Blob(R,{type:"application/octet-stream"}),M=new e.GLTFData;return M.glTFFiles[i]=C,M},r.prototype.setNodeTransformation=function(r,a){a.position.equalsToFloats(0,0,0)||(r.translation=this.convertToRightHandedSystem?t._GLTFUtilities.GetRightHandedPositionVector3(a.position).asArray():a.position.asArray()),a.scaling.equalsToFloats(1,1,1)||(r.scale=a.scaling.asArray());var i=e.Quaternion.RotationYawPitchRoll(a.rotation.y,a.rotation.x,a.rotation.z);a.rotationQuaternion&&i.multiplyInPlace(a.rotationQuaternion),0===i.x&&0===i.y&&0===i.z&&1===i.w||(this.convertToRightHandedSystem&&t._GLTFUtilities.GetRightHandedQuaternionFromRef(i),r.rotation=i.normalize().asArray())},r.prototype.getVertexBufferFromMesh=function(e,t){if(t.isVerticesDataPresent(e)){var r=t.getVertexBuffer(e);if(r)return r}return null},r.prototype.createBufferViewKind=function(r,a,i,n){var o=a instanceof e.Mesh?a:a instanceof e.InstancedMesh?a.sourceMesh:null;if(o){var s=o.getVerticesData(r);if(s){var l=4*s.length,u=t._GLTFUtilities.CreateBufferView(0,i.getByteOffset(),l,n,r+" - "+o.name);this.bufferViews.push(u),this.writeAttributeData(r,s,n,i)}}},r.prototype.getMeshPrimitiveMode=function(t){return t.material?t.material.fillMode:e.Material.TriangleFanDrawMode},r.prototype.setPrimitiveMode=function(t,r){switch(r){case e.Material.TriangleFillMode:break;case e.Material.TriangleStripDrawMode:t.mode=5;break;case e.Material.TriangleFanDrawMode:t.mode=6;break;case e.Material.PointListDrawMode:t.mode=0;case e.Material.PointFillMode:t.mode=0;break;case e.Material.LineLoopDrawMode:t.mode=2;break;case e.Material.LineListDrawMode:t.mode=1;break;case e.Material.LineStripDrawMode:t.mode=3}},r.prototype.setAttributeKind=function(t,r){switch(r){case e.VertexBuffer.PositionKind:t.attributes.POSITION=this.accessors.length-1;break;case e.VertexBuffer.NormalKind:t.attributes.NORMAL=this.accessors.length-1;break;case e.VertexBuffer.ColorKind:t.attributes.COLOR_0=this.accessors.length-1;break;case e.VertexBuffer.TangentKind:t.attributes.TANGENT=this.accessors.length-1;break;case e.VertexBuffer.UVKind:t.attributes.TEXCOORD_0=this.accessors.length-1;break;case e.VertexBuffer.UV2Kind:t.attributes.TEXCOORD_1=this.accessors.length-1;break;default:e.Tools.Warn("Unsupported Vertex Buffer Type: "+r)}},r.prototype.setPrimitiveAttributes=function(r,a,i){var n,o,s,l=null;a instanceof e.Mesh?l=a:a instanceof e.InstancedMesh&&(l=a.sourceMesh);var u=[{kind:e.VertexBuffer.PositionKind,accessorType:"VEC3",byteStride:12},{kind:e.VertexBuffer.NormalKind,accessorType:"VEC3",byteStride:12},{kind:e.VertexBuffer.ColorKind,accessorType:"VEC4",byteStride:16},{kind:e.VertexBuffer.TangentKind,accessorType:"VEC4",byteStride:16},{kind:e.VertexBuffer.UVKind,accessorType:"VEC2",byteStride:8},{kind:e.VertexBuffer.UV2Kind,accessorType:"VEC2",byteStride:8}];if(l){for(var f=null,c=this.getMeshPrimitiveMode(l),h={},d=0,m=u;d<m.length;d++){var p=m[d],g=p.kind;if(l.isVerticesDataPresent(g)){var T=this.getVertexBufferFromMesh(g,l);p.byteStride=T?4*T.getSize():4*e.VertexBuffer.DeduceStride(g),12===p.byteStride&&(p.accessorType="VEC3"),this.createBufferViewKind(g,a,i,p.byteStride),p.bufferViewIndex=this.bufferViews.length-1,h[g]=p.bufferViewIndex}}if(l.getTotalIndices()){var y=l.getIndices();if(y){var v=4*y.length;n=t._GLTFUtilities.CreateBufferView(0,i.getByteOffset(),v,void 0,"Indices - "+l.name),this.bufferViews.push(n),f=this.bufferViews.length-1;for(var x=0,b=y.length;x<b;++x)i.setUInt32(y[x])}}if(l.subMeshes){o=!1;for(var F=0,A=l.subMeshes;F<A.length;F++){for(var _=A[F],R={attributes:{}},C=0,M=u;C<M.length;C++){var p=M[C],g=p.kind,S=l.getVerticesData(g);if(S){var T=this.getVertexBufferFromMesh(g,l);if(T){var V=T.getSize(),B=p.bufferViewIndex;if(void 0!=B){s={min:null,max:null},g==e.VertexBuffer.PositionKind&&(s=t._GLTFUtilities.CalculateMinMaxPositions(S,0,S.length/V,this.convertToRightHandedSystem));var E=t._GLTFUtilities.CreateAccessor(B,g+" - "+a.name,p.accessorType,5126,S.length/V,0,s.min,s.max);this.accessors.push(E),this.setAttributeKind(R,g),null==R.attributes.TEXCOORD_0&&null==R.attributes.TEXCOORD_1||(o=!0)}}}}if(f){var E=t._GLTFUtilities.CreateAccessor(f,"indices - "+a.name,"SCALAR",5125,_.indexCount,4*_.indexStart,null,null);this.accessors.push(E),R.indices=this.accessors.length-1}if(l.material){var w=null;if(l.material instanceof e.StandardMaterial||l.material instanceof e.PBRMetallicRoughnessMaterial||l.material instanceof e.PBRMaterial)w=a.getScene().materials.indexOf(l.material);else if(l.material instanceof e.MultiMaterial){var L=l.material,G=L.subMaterials[_.materialIndex];G&&(w=a.getScene().materials.indexOf(G))}else e.Tools.Warn("Material type "+l.material.getClassName()+" for material "+l.material.name+" is not yet implemented in glTF serializer.");if(null!=w&&Object.keys(R.attributes).length>0){var P=this.babylonScene.materials[w].sideOrientation;if(this.setPrimitiveMode(R,c),this.convertToRightHandedSystem&&P===e.Material.ClockWiseSideOrientation){var N=null!=f?this.bufferViews[f].byteOffset:null;null==N&&(N=0);var I=null;if(null!=f&&(I=l.getIndices()),I)this.reorderIndicesBasedOnPrimitiveMode(_,c,I,N,i);else for(var U=0,O=u;U<O.length;U++){var p=O[U],S=l.getVerticesData(p.kind);if(S){var k=this.bufferViews[h[p.kind]].byteOffset;k||(k=0),this.reorderVertexAttributeDataBasedOnPrimitiveMode(_,c,P,p.kind,S,k,i)}}}if(o)t._GLTFMaterial._HasTexturesPresent(this.materials[w])||(delete R.attributes.TEXCOORD_0,delete R.attributes.TEXCOORD_1),R.material=w;else if(t._GLTFMaterial._HasTexturesPresent(this.materials[w])){var D=t._GLTFMaterial._StripTexturesFromMaterial(this.materials[w]);this.materials.push(D),R.material=this.materials.length-1}else R.material=w}}else{var P=this.babylonScene.defaultMaterial.sideOrientation,N=null!=f?this.bufferViews[f].byteOffset:null;null==N&&(N=0);var I=null;if(null!=f&&(I=l.getIndices()),I)P===e.Material.ClockWiseSideOrientation&&this.reorderIndicesBasedOnPrimitiveMode(_,c,I,N,i);else for(var K=0,z=u;K<z.length;K++){var p=z[K],S=l.getVerticesData(p.kind);if(S){var H=this.bufferViews[h[p.kind]].byteOffset;H||(H=0),this.reorderVertexAttributeDataBasedOnPrimitiveMode(_,c,P,p.kind,S,H,i)}}}r.primitives.push(R)}}}},r.prototype.createScene=function(r,a){if(this.setNodeTransformation.length){var i={nodes:[]},n=void 0,o=void 0,s=void 0,l=r.transformNodes.concat(r.meshes);t._GLTFMaterial._ConvertMaterialsToGLTF(r.materials,"image/png",this.images,this.textures,this.samplers,this.materials,this.imageData,!0),this.nodeMap=this.createNodeMapAndAnimations(r,l,this.shouldExportTransformNode,a),this.totalByteLength=a.getByteOffset();for(var u=0,f=l;u<f.length;u++){var c=f[u];if(null!=(n=this.nodeMap[c.uniqueId])&&(o=this.nodes[n],c.parent||(this.shouldExportTransformNode(c)?(this.convertToRightHandedSystem&&(o.translation&&(o.translation[2]*=-1,o.translation[0]*=-1),o.rotation=o.rotation?e.Quaternion.FromArray([0,1,0,0]).multiply(e.Quaternion.FromArray(o.rotation)).asArray():e.Quaternion.FromArray([0,1,0,0]).asArray()),i.nodes.push(n)):e.Tools.Log("Omitting "+c.name+" from scene.")),s=c.getDescendants(!0),!o.children&&s&&s.length)){o.children=[];for(var h=0,d=s;h<d.length;h++){var m=d[h];null!=this.nodeMap[m.uniqueId]&&o.children.push(this.nodeMap[m.uniqueId])}}}i.nodes.length&&this.scenes.push(i)}},r.prototype.createNodeMapAndAnimations=function(e,r,a,i){for(var n,o,s=this,l={},u={name:"runtime animations",channels:[],samplers:[]},f=[],c=0,h=r;c<h.length;c++){var d=h[c];a(d)?(o=this.createNode(d,i),this.nodes.push(o),n=this.nodes.length-1,l[d.uniqueId]=n,!e.animationGroups.length&&d.animations.length&&t._GLTFAnimation._CreateNodeAnimationFromTransformNodeAnimations(d,u,f,l,this.nodes,i,this.bufferViews,this.accessors,this.convertToRightHandedSystem,this.animationSampleRate)):d.name}return u.channels.length&&u.samplers.length&&this.animations.push(u),f.forEach((function(e){e.channels.length&&e.samplers.length&&s.animations.push(e)})),e.animationGroups.length&&t._GLTFAnimation._CreateNodeAnimationFromAnimationGroups(e,this.animations,l,this.nodes,i,this.bufferViews,this.accessors,this.convertToRightHandedSystem,this.animationSampleRate),l},r.prototype.createNode=function(e,t){var r={},a={primitives:[]};return e.name&&(r.name=e.name),this.setNodeTransformation(r,e),this.setPrimitiveAttributes(a,e,t),a.primitives.length&&(this.meshes.push(a),r.mesh=this.meshes.length-1),r},r})();t._Exporter=r;var a=(function(){function t(e){this._arrayBuffer=new ArrayBuffer(e),this._dataView=new DataView(this._arrayBuffer),this._byteOffset=0}return t.prototype.resizeBuffer=function(e){for(var t=new ArrayBuffer(e),r=new Uint8Array(this._arrayBuffer),a=new Uint8Array(t),i=0,n=a.byteLength;i<n;++i)a[i]=r[i];this._arrayBuffer=t,this._dataView=new DataView(this._arrayBuffer)},t.prototype.getArrayBuffer=function(){return this.resizeBuffer(this.getByteOffset()),this._arrayBuffer},t.prototype.getByteOffset=function(){return this._byteOffset},t.prototype.setUInt8=function(t,r){null!=r?r<this._byteOffset?this._dataView.setUint8(r,t):e.Tools.Error("BinaryWriter: byteoffset is greater than the current binary buffer length!"):(this._byteOffset+1>this._arrayBuffer.byteLength&&this.resizeBuffer(2*this._arrayBuffer.byteLength),this._dataView.setUint8(this._byteOffset++,t))},t.prototype.getUInt32=function(t){if(t<this._byteOffset)return this._dataView.getUint32(t,!0);throw e.Tools.Error("BinaryWriter: byteoffset is greater than the current binary buffer length!"),new Error("BinaryWriter: byteoffset is greater than the current binary buffer length!")},t.prototype.getVector3Float32FromRef=function(t,r){r+8>this._byteOffset?e.Tools.Error("BinaryWriter: byteoffset is greater than the current binary buffer length!"):(t.x=this._dataView.getFloat32(r,!0),t.y=this._dataView.getFloat32(r+4,!0),t.z=this._dataView.getFloat32(r+8,!0))},t.prototype.setVector3Float32FromRef=function(t,r){r+8>this._byteOffset?e.Tools.Error("BinaryWriter: byteoffset is greater than the current binary buffer length!"):(this._dataView.setFloat32(r,t.x,!0),this._dataView.setFloat32(r+4,t.y,!0),this._dataView.setFloat32(r+8,t.z,!0))},t.prototype.getVector4Float32FromRef=function(t,r){r+12>this._byteOffset?e.Tools.Error("BinaryWriter: byteoffset is greater than the current binary buffer length!"):(t.x=this._dataView.getFloat32(r,!0),t.y=this._dataView.getFloat32(r+4,!0),t.z=this._dataView.getFloat32(r+8,!0),t.w=this._dataView.getFloat32(r+12,!0))},t.prototype.setVector4Float32FromRef=function(t,r){r+12>this._byteOffset?e.Tools.Error("BinaryWriter: byteoffset is greater than the current binary buffer length!"):(this._dataView.setFloat32(r,t.x,!0),this._dataView.setFloat32(r+4,t.y,!0),this._dataView.setFloat32(r+8,t.z,!0),this._dataView.setFloat32(r+12,t.w,!0))},t.prototype.setFloat32=function(t,r){isNaN(t)&&e.Tools.Error("Invalid data being written!"),null!=r&&(r<this._byteOffset?this._dataView.setFloat32(r,t,!0):e.Tools.Error("BinaryWriter: byteoffset is greater than the current binary length!")),this._byteOffset+4>this._arrayBuffer.byteLength&&this.resizeBuffer(2*this._arrayBuffer.byteLength),this._dataView.setFloat32(this._byteOffset,t,!0),this._byteOffset+=4},t.prototype.setUInt32=function(t,r){null!=r?r<this._byteOffset?this._dataView.setUint32(r,t,!0):e.Tools.Error("BinaryWriter: byteoffset is greater than the current binary buffer length!"):(this._byteOffset+4>this._arrayBuffer.byteLength&&this.resizeBuffer(2*this._arrayBuffer.byteLength),this._dataView.setUint32(this._byteOffset,t,!0),this._byteOffset+=4)},t})();t._BinaryWriter=a})(e.GLTF2||(e.GLTF2={}))})(e||(e={}));var e;!(function(e){var t=(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 a=this.glTFFiles[t],i=void 0;e(t,".glb")?i={type:"model/gltf-binary"}:e(t,".bin")?i={type:"application/octet-stream"}:e(t,".gltf")?i={type:"model/gltf+json"}:e(t,".jpeg")?i={type:"image/jpeg"}:e(t,".png")&&(i={type:"image/png"}),r.href=window.URL.createObjectURL(new Blob([a],i)),r.click()}},e})();e.GLTFData=t})(e||(e={}));var e;!(function(e){!(function(t){var r=(function(){function t(){}return t.FuzzyEquals=function(t,r,a){return e.Scalar.WithinEpsilon(t.r,r.r,a)&&e.Scalar.WithinEpsilon(t.g,r.g,a)&&e.Scalar.WithinEpsilon(t.b,r.b,a)},t._ConvertMaterialsToGLTF=function(r,a,i,n,o,s,l,u){for(var f=0,c=r;f<c.length;f++){var h=c[f];h instanceof e.StandardMaterial?t._ConvertStandardMaterial(h,a,i,n,o,s,l,u):h instanceof e.PBRMetallicRoughnessMaterial?t._ConvertPBRMetallicRoughnessMaterial(h,a,i,n,o,s,l,u):h instanceof e.PBRMaterial?t._ConvertPBRMaterial(h,a,i,n,o,s,l,u):e.Tools.Error("Unsupported material type: "+h.name)}},t._StripTexturesFromMaterial=function(e){var t={};if(e){t.name=e.name,t.doubleSided=e.doubleSided,t.alphaMode=e.alphaMode,t.alphaCutoff=e.alphaCutoff,t.emissiveFactor=e.emissiveFactor;var r=e.pbrMetallicRoughness;r&&(t.pbrMetallicRoughness={},t.pbrMetallicRoughness.baseColorFactor=r.baseColorFactor,t.pbrMetallicRoughness.metallicFactor=r.metallicFactor,t.pbrMetallicRoughness.roughnessFactor=r.roughnessFactor)}return t},t._HasTexturesPresent=function(e){if(e.emissiveTexture||e.normalTexture||e.occlusionTexture)return!0;var t=e.pbrMetallicRoughness;return!(!t||!t.baseColorTexture&&!t.metallicRoughnessTexture)},t._ConvertToGLTFPBRMetallicRoughness=function(t){function r(e,t,r,a,i){return(1-e)*(1-e)*(1-e)*t+3*(1-e)*(1-e)*e*r+3*(1-e)*e*e*a+e*e*e*i}var a=new e.Vector2(0,1),i=new e.Vector2(0,.1),n=new e.Vector2(0,.1),o=new e.Vector2(1300,.1),s=t.diffuseColor.toLinearSpace().scale(.5),l=t.alpha,u=e.Scalar.Clamp(t.specularPower,0,this._maxSpecularPower),f=(function(e){return r(Math.pow(e/o.x,.333333),a.y,i.y,n.y,o.y)})(u);return{baseColorFactor:[s.r,s.g,s.b,l],metallicFactor:0,roughnessFactor:f}},t._SolveMetallic=function(r,a,i){if(a<t._dielectricSpecular.r)return t._dielectricSpecular,0;var n=t._dielectricSpecular.r,o=r*i/(1-t._dielectricSpecular.r)+a-2*t._dielectricSpecular.r,s=t._dielectricSpecular.r-a,l=o*o-4*n*s;return e.Scalar.Clamp((-o+Math.sqrt(l))/(2*n),0,1)},t._GetAlphaMode=function(t){if(t instanceof e.StandardMaterial){var r=t;return 1!=r.alpha||null!=r.diffuseTexture&&r.diffuseTexture.hasAlpha||null!=r.opacityTexture?"BLEND":"OPAQUE"}if(t instanceof e.PBRMetallicRoughnessMaterial){var a=t;switch(a.transparencyMode){case e.PBRMaterial.PBRMATERIAL_OPAQUE:return"OPAQUE";case e.PBRMaterial.PBRMATERIAL_ALPHABLEND:return"BLEND";case e.PBRMaterial.PBRMATERIAL_ALPHATEST:return"MASK";case e.PBRMaterial.PBRMATERIAL_ALPHATESTANDBLEND:return e.Tools.Warn(t.name+": GLTF Exporter | Alpha test and blend mode not supported in glTF. Alpha blend used instead."),"BLEND";default:return e.Tools.Error("Unsupported alpha mode "+a.transparencyMode),null}}else{if(!(t instanceof e.PBRMaterial))return e.Tools.Error("Unsupported Babylon material type"),null;var i=t;switch(i.transparencyMode){case e.PBRMaterial.PBRMATERIAL_OPAQUE:return"OPAQUE";case e.PBRMaterial.PBRMATERIAL_ALPHABLEND:return"BLEND";case e.PBRMaterial.PBRMATERIAL_ALPHATEST:return"MASK";case e.PBRMaterial.PBRMATERIAL_ALPHATESTANDBLEND:return e.Tools.Warn(t.name+": GLTF Exporter | Alpha test and blend mode not supported in glTF. Alpha blend used instead."),"BLEND";default:return e.Tools.Error("Unsupported alpha mode "+i.transparencyMode),null}}},t._ConvertStandardMaterial=function(r,a,i,n,o,s,l,u){var f=t._ConvertToGLTFPBRMetallicRoughness(r),c={name:r.name};if(null==r.backFaceCulling||r.backFaceCulling||(r.twoSidedLighting||e.Tools.Warn(r.name+": Back-face culling enabled and two-sided lighting disabled is not supported in glTF."),c.doubleSided=!0),u){if(r.diffuseTexture){var h=t._ExportTexture(r.diffuseTexture,a,i,n,o,l);null!=h&&(f.baseColorTexture=h)}if(r.bumpTexture){var h=t._ExportTexture(r.bumpTexture,a,i,n,o,l);h&&(c.normalTexture=h,1!==r.bumpTexture.level&&(c.normalTexture.scale=r.bumpTexture.level))}if(r.emissiveTexture){var d=t._ExportTexture(r.emissiveTexture,a,i,n,o,l);d&&(c.emissiveTexture=d),c.emissiveFactor=[1,1,1]}if(r.ambientTexture){var h=t._ExportTexture(r.ambientTexture,a,i,n,o,l);if(h){var m={index:h.index};c.occlusionTexture=m,m.strength=1}}}(r.alpha<1||r.opacityTexture)&&(r.alphaMode===e.Engine.ALPHA_COMBINE?c.alphaMode="BLEND":e.Tools.Warn(r.name+": glTF 2.0 does not support alpha mode: "+r.alphaMode.toString())),r.emissiveColor&&!this.FuzzyEquals(r.emissiveColor,e.Color3.Black(),this._epsilon)&&(c.emissiveFactor=r.emissiveColor.asArray()),c.pbrMetallicRoughness=f,s.push(c)},t._ConvertPBRMetallicRoughnessMaterial=function(r,a,i,n,o,s,l,u){var f={};r.baseColor&&(f.baseColorFactor=[r.baseColor.r,r.baseColor.g,r.baseColor.b,r.alpha]),null!=r.metallic&&1!==r.metallic&&(f.metallicFactor=r.metallic),null!=r.roughness&&1!==r.roughness&&(f.roughnessFactor=r.roughness);var c={name:r.name};if(r.doubleSided&&(c.doubleSided=r.doubleSided),u){if(null!=r.baseTexture){var h=t._ExportTexture(r.baseTexture,a,i,n,o,l);null!=h&&(f.baseColorTexture=h)}if(r.normalTexture){var h=t._ExportTexture(r.normalTexture,a,i,n,o,l);h&&(c.normalTexture=h,1!==r.normalTexture.level&&(c.normalTexture.scale=r.normalTexture.level))}if(r.occlusionTexture){var h=t._ExportTexture(r.occlusionTexture,a,i,n,o,l);h&&(c.occlusionTexture=h,null!=r.occlusionStrength&&(c.occlusionTexture.strength=r.occlusionStrength))}if(r.emissiveTexture){var h=t._ExportTexture(r.emissiveTexture,a,i,n,o,l);null!=h&&(c.emissiveTexture=h)}}if(this.FuzzyEquals(r.emissiveColor,e.Color3.Black(),this._epsilon)&&(c.emissiveFactor=r.emissiveColor.asArray()),null!=r.transparencyMode){var d=t._GetAlphaMode(r);d&&"OPAQUE"!==d&&(c.alphaMode=d,"MASK"===d&&(c.alphaCutoff=r.alphaCutOff))}c.pbrMetallicRoughness=f,s.push(c)},t._CreateBase64FromCanvas=function(e,t,r,a){var i=document.createElement("canvas");i.width=t,i.height=r,i.id="WriteCanvas";var n=i.getContext("2d"),o=n.createImageData(t,r);return o.data.set(e),n.putImageData(o,0,0),i.toDataURL(a)},t._CreateWhiteTexture=function(t,r,a){for(var i=new Uint8Array(t*r*4),n=0;n<i.length;n+=4)i[n]=i[n+1]=i[n+2]=i[n+3]=255;return e.RawTexture.CreateRGBATexture(i,t,r,a)},t._ResizeTexturesToSameDimensions=function(t,r,a){var i,n,o=t?t.getSize():{width:0,height:0},s=r?r.getSize():{width:0,height:0};return o.width<s.width?(i=t?e.TextureTools.CreateResizedCopy(t,s.width,s.height,!0):this._CreateWhiteTexture(s.width,s.height,a),n=r):o.width>s.width?(n=r?e.TextureTools.CreateResizedCopy(r,o.width,o.height,!0):this._CreateWhiteTexture(o.width,o.height,a),i=t):(i=t,n=r),{texture1:i,texture2:n}},t._ConvertSpecularGlossinessTexturesToMetallicRoughness=function(t,r,a,i){if(!t&&!r)return null;var n=t?t.getScene():r.getScene();if(!n)return e.Tools.Error("_ConvertSpecularGlossinessTexturesToMetallicRoughness: Scene from textures is missing!"),null;var o,s,l=this._ResizeTexturesToSameDimensions(t,r,n),u=l.texture1.getSize(),f=u.width,c=u.height,h=l.texture1.readPixels() | ||
;if(!(h instanceof Uint8Array))return e.Tools.Error("_ConvertSpecularGlossinessTexturesToMetallicRoughness: Pixel array buffer type not supported for texture: "+l.texture1.name),null;if(o=l.texture1.readPixels(),!((h=l.texture2.readPixels())instanceof Uint8Array))return e.Tools.Error("_ConvertSpecularGlossinessTexturesToMetallicRoughness: Pixel array buffer type not supported for texture: "+l.texture2.name),null;s=l.texture2.readPixels();for(var d=s.byteLength,m=new Uint8Array(d),p=new Uint8Array(d),g=e.Color3.Black(),T=0,y=0,v=0;v<c;++v)for(var x=0;x<f;++x){var b=4*(f*v+x),F=e.Color3.FromInts(o[b],o[b+1],o[b+2]).toLinearSpace().multiply(a.diffuseColor),A=e.Color3.FromInts(s[b],s[b+1],s[b+2]).toLinearSpace().multiply(a.specularColor),_=s[b+3]/255*a.glossiness,R={diffuseColor:F,specularColor:A,glossiness:_},C=this._ConvertSpecularGlossinessToMetallicRoughness(R);g.r=Math.max(g.r,C.baseColor.r),g.g=Math.max(g.g,C.baseColor.g),g.b=Math.max(g.b,C.baseColor.b),T=Math.max(T,C.metallic),y=Math.max(y,C.roughness),p[b]=255*C.baseColor.r,p[b+1]=255*C.baseColor.g,p[b+2]=255*C.baseColor.b,p[b+3]=l.texture1.hasAlpha?o[b+3]:255,m[b]=0,m[b+1]=255*C.roughness,m[b+2]=255*C.metallic,m[b+3]=255}for(var M={baseColor:g,metallic:T,roughness:y},S=!1,V=!1,v=0;v<c;++v)for(var x=0;x<f;++x){var B=4*(f*v+x);p[B]/=M.baseColor.r>this._epsilon?M.baseColor.r:1,p[B+1]/=M.baseColor.g>this._epsilon?M.baseColor.g:1,p[B+2]/=M.baseColor.b>this._epsilon?M.baseColor.b:1;var E=e.Color3.FromInts(p[B],p[B+1],p[B+2]),w=E.toGammaSpace();p[B]=255*w.r,p[B+1]=255*w.g,p[B+2]=255*w.b,this.FuzzyEquals(w,e.Color3.White(),this._epsilon)||(V=!0),m[B+1]/=M.roughness>this._epsilon?M.roughness:1,m[B+2]/=M.metallic>this._epsilon?M.metallic:1;var L=e.Color3.FromInts(255,m[B+1],m[B+2]);this.FuzzyEquals(L,e.Color3.White(),this._epsilon)||(S=!0)}if(S){var G=this._CreateBase64FromCanvas(m,f,c,i);M.metallicRoughnessTextureBase64=G}if(V){var P=this._CreateBase64FromCanvas(p,f,c,i);M.baseColorTextureBase64=P}return M},t._ConvertSpecularGlossinessToMetallicRoughness=function(r){var a=t._GetPerceivedBrightness(r.diffuseColor),i=t._GetPerceivedBrightness(r.specularColor),n=1-t._GetMaxComponent(r.specularColor),o=t._SolveMetallic(a,i,n),s=r.diffuseColor.scale(n/(1-this._dielectricSpecular.r)/Math.max(1-o,this._epsilon)),l=r.specularColor.subtract(this._dielectricSpecular.scale(1-o)).scale(1/Math.max(o,this._epsilon)),u=e.Color3.Lerp(s,l,o*o);return u=u.clampToRef(0,1,u),{baseColor:u,metallic:o,roughness:1-r.glossiness}},t._GetPerceivedBrightness=function(e){return e?Math.sqrt(.299*e.r*e.r+.587*e.g*e.g+.114*e.b*e.b):0},t._GetMaxComponent=function(e){return e?Math.max(e.r,Math.max(e.g,e.b)):0},t._ConvertMetalRoughFactorsToMetallicRoughness=function(e,r,a,i,n,o,s,l){var u={baseColor:e.albedoColor,metallic:e.metallic,roughness:e.roughness};if(l){if(e.albedoTexture){var f=t._ExportTexture(e.albedoTexture,r,a,i,n,s);f&&(o.baseColorTexture=f)}if(e.metallicTexture){var f=t._ExportTexture(e.metallicTexture,r,a,i,n,s);null!=f&&(o.metallicRoughnessTexture=f)}}return u},t._GetGLTFTextureSampler=function(r){var a=t._GetGLTFTextureWrapModesSampler(r),i=r instanceof e.Texture?r.samplingMode:null;if(null!=i)switch(i){case e.Texture.LINEAR_LINEAR:a.magFilter=9729,a.minFilter=9729;break;case e.Texture.LINEAR_NEAREST:a.magFilter=9729,a.minFilter=9728;break;case e.Texture.NEAREST_LINEAR:a.magFilter=9728,a.minFilter=9729;break;case e.Texture.NEAREST_LINEAR_MIPLINEAR:a.magFilter=9728,a.minFilter=9987;break;case e.Texture.NEAREST_NEAREST:a.magFilter=9728,a.minFilter=9728;break;case e.Texture.NEAREST_LINEAR_MIPNEAREST:a.magFilter=9728,a.minFilter=9985;break;case e.Texture.LINEAR_NEAREST_MIPNEAREST:a.magFilter=9729,a.minFilter=9984;break;case e.Texture.LINEAR_NEAREST_MIPLINEAR:a.magFilter=9729,a.minFilter=9986;break;case e.Texture.NEAREST_NEAREST_MIPLINEAR:a.magFilter=9728,a.minFilter=9986;break;case e.Texture.LINEAR_LINEAR_MIPLINEAR:a.magFilter=9729,a.minFilter=9987;break;case e.Texture.LINEAR_LINEAR_MIPNEAREST:a.magFilter=9729,a.minFilter=9985;break;case e.Texture.NEAREST_NEAREST_MIPNEAREST:a.magFilter=9728,a.minFilter=9984}return a},t._GetGLTFTextureWrapMode=function(t){switch(t){case e.Texture.WRAP_ADDRESSMODE:return 10497;case e.Texture.CLAMP_ADDRESSMODE:return 33071;case e.Texture.MIRROR_ADDRESSMODE:return 33648;default:return e.Tools.Error("Unsupported Texture Wrap Mode "+t+"!"),10497}},t._GetGLTFTextureWrapModesSampler=function(r){var a=t._GetGLTFTextureWrapMode(r instanceof e.Texture?r.wrapU:e.Texture.WRAP_ADDRESSMODE),i=t._GetGLTFTextureWrapMode(r instanceof e.Texture?r.wrapV:e.Texture.WRAP_ADDRESSMODE);return 10497===a&&10497===i?{}:{wrapS:a,wrapT:i}},t._ConvertSpecGlossFactorsToMetallicRoughness=function(r,a,i,n,o,s,l,u){var f={diffuseColor:r.albedoColor||e.Color3.White(),specularColor:r.reflectivityColor||e.Color3.White(),glossiness:r.microSurface||1},c=null,h=this._GetGLTFTextureSampler(r.albedoTexture);if(null!=h.magFilter&&null!=h.minFilter&&null!=h.wrapS&&null!=h.wrapT&&(o.push(h),c=o.length-1),r.reflectivityTexture&&!r.useMicroSurfaceFromReflectivityMapAlpha)return e.Tools.Error("_ConvertPBRMaterial: Glossiness values not included in the reflectivity texture currently not supported"),null;var d=this._ConvertSpecularGlossinessTexturesToMetallicRoughness(r.albedoTexture,r.reflectivityTexture,f,a);if(d){if(u){if(d.baseColorTextureBase64){var m=t._GetTextureInfoFromBase64(d.baseColorTextureBase64,"bjsBaseColorTexture_"+n.length+".png",a,i,n,r.albedoTexture.coordinatesIndex,c,l);null!=m&&(s.baseColorTexture=m)}if(d.metallicRoughnessTextureBase64){var p=t._GetTextureInfoFromBase64(d.metallicRoughnessTextureBase64,"bjsMetallicRoughnessTexture_"+n.length+".png",a,i,n,r.reflectivityTexture.coordinatesIndex,c,l);null!=p&&(s.metallicRoughnessTexture=p)}}}else d=this._ConvertSpecularGlossinessToMetallicRoughness(f);return d},t._ConvertPBRMaterial=function(r,a,i,n,o,s,l,u){var f,c={},h={name:r.name};if(f=r.isMetallicWorkflow()?this._ConvertMetalRoughFactorsToMetallicRoughness(r,a,i,n,o,c,l,u):this._ConvertSpecGlossFactorsToMetallicRoughness(r,a,i,n,o,c,l,u)){if(this.FuzzyEquals(f.baseColor,e.Color3.White(),this._epsilon)&&r.alpha>=this._epsilon||(c.baseColorFactor=[f.baseColor.r,f.baseColor.g,f.baseColor.b,r.alpha]),null!=f.metallic&&1!==f.metallic&&(c.metallicFactor=f.metallic),null!=f.roughness&&1!==f.roughness&&(c.roughnessFactor=f.roughness),null==r.backFaceCulling||r.backFaceCulling||(r.twoSidedLighting||e.Tools.Warn(r.name+": Back-face culling enabled and two-sided lighting disabled is not supported in glTF."),h.doubleSided=!0),u){if(r.bumpTexture){var d=t._ExportTexture(r.bumpTexture,a,i,n,o,l);d&&(h.normalTexture=d,1!==r.bumpTexture.level&&(h.normalTexture.scale=r.bumpTexture.level))}if(r.ambientTexture){var d=t._ExportTexture(r.ambientTexture,a,i,n,o,l);if(d){var m={index:d.index};h.occlusionTexture=m,r.ambientTextureStrength&&(m.strength=r.ambientTextureStrength)}}if(r.emissiveTexture){var d=t._ExportTexture(r.emissiveTexture,a,i,n,o,l);null!=d&&(h.emissiveTexture=d)}}if(this.FuzzyEquals(r.emissiveColor,e.Color3.Black(),this._epsilon)||(h.emissiveFactor=r.emissiveColor.asArray()),null!=r.transparencyMode){var p=t._GetAlphaMode(r);p&&"OPAQUE"!==p&&(h.alphaMode=p,"MASK"===p&&(h.alphaCutoff=r.alphaCutOff))}h.pbrMetallicRoughness=c,s.push(h)}},t.GetPixelsFromTexture=function(t){return t.textureType,e.Engine.TEXTURETYPE_UNSIGNED_INT,t.readPixels()},t._ExportTexture=function(r,a,i,n,o,s){for(var l=t._GetGLTFTextureSampler(r),u=null,f=null,c=0;c<o.length;++c){var h=o[c];if(h.minFilter===l.minFilter&&h.magFilter===l.magFilter&&h.wrapS===l.wrapS&&h.wrapT===l.wrapT){f=c;break}}null==f?(o.push(l),u=o.length-1):u=f;var d="texture_"+(n.length-1).toString(),m=r.getInternalTexture();null!=m&&(d=m.url||d),d=e.Tools.GetFilename(d);var p=d.split(".")[0],g="";if("image/jpeg"===a)g=".jpg";else{if("image/png"!==a)return e.Tools.Error("Unsupported mime type "+a),null;g=".png"}d=p+g;var T=t.GetPixelsFromTexture(r),y=r.getSize(),v=this._CreateBase64FromCanvas(T,y.width,y.height,a);return this._GetTextureInfoFromBase64(v,d,a,i,n,r.coordinatesIndex,u,s)},t._GetTextureInfoFromBase64=function(e,t,r,a,i,n,o,s){var l=null,u={source:a.length,name:t};null!=o&&(u.sampler=o);for(var f=atob(e.split(",")[1]),c=new ArrayBuffer(f.length),h=new Uint8Array(c),d=0,m=f.length;d<m;++d)h[d]=f.charCodeAt(d);var p={data:h,mimeType:r};if(s[t]=p,"image/jpeg"===r||"image/png"===r){for(var g={uri:t},T=null,d=0;d<a.length;++d)if(a[d].uri===t){T=d;break}null==T?(a.push(g),u.source=a.length-1):u.source=T,i.push(u),l={index:i.length-1},n&&(l.texCoord=n)}return l},t._dielectricSpecular=new e.Color3(.04,.04,.04),t._maxSpecularPower=1024,t._epsilon=1e-6,t})();t._GLTFMaterial=r})(e.GLTF2||(e.GLTF2={}))})(e||(e={}));var e;!(function(e){!(function(t){var r;!(function(e){e[e.INTANGENT=0]="INTANGENT",e[e.OUTTANGENT=1]="OUTTANGENT"})(r||(r={}));var a=(function(){function a(){}return a._CreateNodeAnimation=function(t,r,i,n,o,s){var l=[],u=[],f=r.getKeys(),c=a.calculateMinMaxKeyFrames(f),h=a._DeduceInterpolation(f,i,o),d=c.max-c.min,m=h.interpolationType,p=h.shouldBakeAnimation;if(p?a._CreateBakedAnimation(t,r,i,c.min,c.max,r.framePerSecond,s,l,u,c,n,o):"LINEAR"===m||"STEP"===m?a._CreateLinearOrStepAnimation(t,r,i,d,l,u,n,o):"CUBICSPLINE"===m?a._CreateCubicSplineAnimation(t,r,i,d,l,u,n,o):a._CreateBakedAnimation(t,r,i,c.min,c.max,r.framePerSecond,s,l,u,c,n,o),l.length&&u.length){return{inputs:l,outputs:u,samplerInterpolation:m,inputsMin:p?c.min:e.Tools.FloatRound(c.min/r.framePerSecond),inputsMax:p?c.max:e.Tools.FloatRound(c.max/r.framePerSecond)}}return null},a._DeduceAnimationInfo=function(t){var r=null,a="VEC3",i=!1,n=t.targetProperty.split(".");switch(n[0]){case"scaling":r="scale";break;case"position":r="translation";break;case"rotation":a="VEC4",r="rotation";break;case"rotationQuaternion":a="VEC4",i=!0,r="rotation";break;default:e.Tools.Error("Unsupported animatable property "+n[0])}return r?{animationChannelTargetPath:r,dataAccessorType:a,useQuaternion:i}:(e.Tools.Error("animation channel target path and data accessor type could be deduced"),null)},a._CreateNodeAnimationFromTransformNodeAnimations=function(e,t,r,i,n,o,s,l,u,f){var c;if(e.animations)for(var h=0,d=e.animations;h<d.length;h++){var m=d[h],p=a._DeduceAnimationInfo(m);p&&(c={name:m.name,samplers:[],channels:[]},a.AddAnimation(""+m.name,m.hasRunningRuntimeAnimations?t:c,e,m,p.dataAccessorType,p.animationChannelTargetPath,i,o,s,l,u,p.useQuaternion,f),c.samplers.length&&c.channels.length&&r.push(c))}},a._CreateNodeAnimationFromAnimationGroups=function(t,r,i,n,o,s,l,u,f){var c;if(t.animationGroups)for(var h=t.animationGroups,d=0,m=h;d<m.length;d++){var p=m[d];c={name:p.name,channels:[],samplers:[]};for(var g=0,T=p.targetedAnimations;g<T.length;g++){var y=T[g],v=y.target,x=y.animation;if(v instanceof e.Mesh||1===v.length&&v[0]instanceof e.Mesh){var b=a._DeduceAnimationInfo(y.animation);if(b){var F=v instanceof e.Mesh?v:v[0];a.AddAnimation(""+x.name,c,F,x,b.dataAccessorType,b.animationChannelTargetPath,i,o,s,l,u,b.useQuaternion,f)}}}c.channels.length&&c.samplers.length&&r.push(c)}},a.AddAnimation=function(e,r,i,n,o,s,l,u,f,c,h,d,m){var p,g,T,y,v,x,b,F=a._CreateNodeAnimation(i,n,s,h,d,m);if(F){var A=l[i.uniqueId],_=4*F.inputs.length;p=t._GLTFUtilities.CreateBufferView(0,u.getByteOffset(),_,void 0,e+" keyframe data view"),f.push(p),F.inputs.forEach((function(e){u.setFloat32(e)})),g=t._GLTFUtilities.CreateAccessor(f.length-1,e+" keyframes","SCALAR",5126,F.inputs.length,null,[F.inputsMin],[F.inputsMax]),c.push(g),T=c.length-1,v=F.outputs.length,_="VEC3"===o?12*F.outputs.length:16*F.outputs.length,p=t._GLTFUtilities.CreateBufferView(0,u.getByteOffset(),_,void 0,e+" data view"),f.push(p),F.outputs.forEach((function(e){e.forEach((function(e){u.setFloat32(e)}))})),g=t._GLTFUtilities.CreateAccessor(f.length-1,e+" data",o,5126,v,null,null,null),c.push(g),y=c.length-1,x={interpolation:F.samplerInterpolation,input:T,output:y},r.samplers.push(x),b={sampler:r.samplers.length-1,target:{node:A,path:s}},r.channels.push(b)}},a._CreateBakedAnimation=function(t,r,i,n,o,s,l,u,f,c,h,d){var m,p,g=e.Quaternion.Identity(),T=null,y=null,v=null,x=null,b=null,F=null;c.min=e.Tools.FloatRound(n/s);for(var A=r.getKeys(),_=0,R=A.length;_<R;++_){if(F=null,v=A[_],_+1<R)if(x=A[_+1],v.value.equals(x.value)){if(0!==_)continue;F=v.frame}else F=x.frame;else{if(b=A[_-1],v.value.equals(b.value))continue;F=o}if(F)for(var C=v.frame;C<=F;C+=l)(p=e.Tools.FloatRound(C/s))!==T&&(T=p,y=p,m=r._interpolate(C,0,void 0,r.loopMode),a._SetInterpolatedValue(t,m,p,r,i,g,u,f,h,d))}y&&(c.max=y)},a._ConvertFactorToVector3OrQuaternion=function(t,r,i,n,o,s,l){var u,f,c=null,h=a._GetBasePositionRotationOrScale(r,o,s,l);if(n===e.Animation.ANIMATIONTYPE_FLOAT)switch(u=i.targetProperty.split("."),f=u?u[1]:"",c=l?e.Quaternion.FromArray(h).normalize():e.Vector3.FromArray(h),f){case"x":case"y":c[f]=s&&l&&"scale"!==o?-t:t;break;case"z":c[f]=s&&!l&&"scale"!==o?-t:t;break;case"w":c.w=t;break;default:e.Tools.Error('glTFAnimation: Unsupported component type "'+f+'" for scale animation!')}return c},a._SetInterpolatedValue=function(r,a,i,n,o,s,l,u,f,c){var h,d=n.dataType;l.push(i),"number"==typeof a&&(a=this._ConvertFactorToVector3OrQuaternion(a,r,n,d,o,f,c)),a&&("rotation"===o?(c?s=a:(h=a,e.Quaternion.RotationYawPitchRollToRef(h.y,h.x,h.z,s)),f&&(t._GLTFUtilities.GetRightHandedQuaternionFromRef(s),r.parent||(s=e.Quaternion.FromArray([0,1,0,0]).multiply(s))),u.push(s.asArray())):(h=a,f&&"scale"!==o&&(t._GLTFUtilities.GetRightHandedPositionVector3FromRef(h),r.parent||(h.x*=-1,h.z*=-1)),u.push(h.asArray())))},a._CreateLinearOrStepAnimation=function(e,t,r,i,n,o,s,l){for(var u=0,f=t.getKeys();u<f.length;u++){var c=f[u];n.push(c.frame/t.framePerSecond),a._AddKeyframeValue(c,t,o,r,e,s,l)}},a._CreateCubicSplineAnimation=function(e,t,i,n,o,s,l,u){t.getKeys().forEach((function(f){o.push(f.frame/t.framePerSecond),a.AddSplineTangent(e,r.INTANGENT,s,i,"CUBICSPLINE",f,n,u,l),a._AddKeyframeValue(f,t,s,i,e,l,u),a.AddSplineTangent(e,r.OUTTANGENT,s,i,"CUBICSPLINE",f,n,u,l)}))},a._GetBasePositionRotationOrScale=function(r,a,i,n){var o;return"rotation"===a?n?r.rotationQuaternion?(o=r.rotationQuaternion.asArray(),i&&(t._GLTFUtilities.GetRightHandedQuaternionArrayFromRef(o),r.parent||(o=e.Quaternion.FromArray([0,1,0,0]).multiply(e.Quaternion.FromArray(o)).asArray()))):o=e.Quaternion.Identity().asArray():(o=r.rotation.asArray(),t._GLTFUtilities.GetRightHandedNormalArray3FromRef(o)):"translation"===a?(o=r.position.asArray(),i&&t._GLTFUtilities.GetRightHandedPositionArray3FromRef(o)):o=r.scaling.asArray(),o},a._AddKeyframeValue=function(r,a,i,n,o,s,l){var u,f,c=a.dataType;if(c===e.Animation.ANIMATIONTYPE_VECTOR3){if(u=r.value.asArray(),"rotation"===n){var h=e.Vector3.FromArray(u),d=e.Quaternion.RotationYawPitchRoll(h.y,h.x,h.z);s&&(t._GLTFUtilities.GetRightHandedQuaternionFromRef(d),o.parent||(d=e.Quaternion.FromArray([0,1,0,0]).multiply(d))),u=d.asArray()}else"translation"===n&&s&&(t._GLTFUtilities.GetRightHandedNormalArray3FromRef(u),o.parent||(u[0]*=-1,u[2]*=-1));i.push(u)}else if(c===e.Animation.ANIMATIONTYPE_FLOAT){if(f=this._ConvertFactorToVector3OrQuaternion(r.value,o,a,c,n,s,l)){if("rotation"===n){var m=l?f:e.Quaternion.RotationYawPitchRoll(f.y,f.x,f.z).normalize();s&&(t._GLTFUtilities.GetRightHandedQuaternionFromRef(m),o.parent||(m=e.Quaternion.FromArray([0,1,0,0]).multiply(m))),i.push(m.asArray())}else"translation"===n&&s&&(t._GLTFUtilities.GetRightHandedNormalVector3FromRef(f),o.parent||(f.x*=-1,f.z*=-1));i.push(f.asArray())}}else c===e.Animation.ANIMATIONTYPE_QUATERNION?(u=r.value.normalize().asArray(),s&&(t._GLTFUtilities.GetRightHandedQuaternionArrayFromRef(u),o.parent||(u=e.Quaternion.FromArray([0,1,0,0]).multiply(e.Quaternion.FromArray(u)).asArray())),i.push(u)):e.Tools.Error("glTFAnimation: Unsupported key frame values for animation!")},a._DeduceInterpolation=function(t,r,a){var i,n,o=!1;if("rotation"===r&&!a)return{interpolationType:"LINEAR",shouldBakeAnimation:!0};for(var s=0,l=t.length;s<l;++s)if(n=t[s],n.inTangent||n.outTangent)if(i){if("CUBICSPLINE"!==i){i="LINEAR",o=!0;break}}else i="CUBICSPLINE";else if(i){if("CUBICSPLINE"===i||n.interpolation&&n.interpolation===e.AnimationKeyInterpolation.STEP&&"STEP"!==i){i="LINEAR",o=!0;break}}else i=n.interpolation&&n.interpolation===e.AnimationKeyInterpolation.STEP?"STEP":"LINEAR";return i||(i="LINEAR"),{interpolationType:i,shouldBakeAnimation:o}},a.AddSplineTangent=function(a,i,n,o,s,l,u,f,c){var h,d=i===r.INTANGENT?l.inTangent:l.outTangent;if("CUBICSPLINE"===s){if("rotation"===o)if(d){if(f)h=d.scale(u).asArray();else{var m=d.scale(u);h=e.Quaternion.RotationYawPitchRoll(m.y,m.x,m.z).asArray()}c&&(t._GLTFUtilities.GetRightHandedQuaternionArrayFromRef(h),a.parent||(h=e.Quaternion.FromArray([0,1,0,0]).multiply(e.Quaternion.FromArray(h)).asArray()))}else h=[0,0,0,0];else d?(h=d.scale(u).asArray(),c&&"translation"===o&&(t._GLTFUtilities.GetRightHandedPositionArray3FromRef(h),a.parent||(h[0]*=-1,h[2]*=-1))):h=[0,0,0];n.push(h)}},a.calculateMinMaxKeyFrames=function(e){var t=1/0,r=-1/0;return e.forEach((function(e){t=Math.min(t,e.frame),r=Math.max(r,e.frame)})),{min:t,max:r}},a})();t._GLTFAnimation=a})(e.GLTF2||(e.GLTF2={}))})(e||(e={}));var e;return (function(e){!(function(t){var r=(function(){function t(){}return t.CreateBufferView=function(e,t,r,a,i){var n={buffer:e,byteLength:r};return t&&(n.byteOffset=t),i&&(n.name=i),a&&(n.byteStride=a),n},t.CreateAccessor=function(e,t,r,a,i,n,o,s){var l={name:t,bufferView:e,componentType:a,count:i,type:r};return null!=o&&(l.min=o),null!=s&&(l.max=s),null!=n&&(l.byteOffset=n),l},t.CalculateMinMaxPositions=function(r,a,i,n){var o,s,l,u=[1/0,1/0,1/0],f=[-1/0,-1/0,-1/0];if(i)for(var c=a,h=a+i;c<h;++c){o=3*c,s=e.Vector3.FromArray(r,o),n&&t.GetRightHandedPositionVector3FromRef(s),l=s.asArray();for(var d=0;d<3;++d){var m=l[d];m<u[d]&&(u[d]=m),m>f[d]&&(f[d]=m),++o}}return{min:u,max:f}},t.GetRightHandedPositionVector3=function(t){return new e.Vector3(t.x,t.y,-t.z)},t.GetRightHandedPositionVector3FromRef=function(e){e.z*=-1},t.GetRightHandedPositionArray3FromRef=function(e){e[2]*=-1},t.GetRightHandedNormalVector3=function(t){return new e.Vector3(t.x,t.y,-t.z)},t.GetRightHandedNormalVector3FromRef=function(e){e.z*=-1},t.GetRightHandedNormalArray3FromRef=function(e){e[2]*=-1},t.GetRightHandedVector4FromRef=function(e){e.z*=-1,e.w*=-1},t.GetRightHandedArray4FromRef=function(e){e[2]*=-1,e[3]*=-1},t.GetRightHandedQuaternionFromRef=function(e){e.x*=-1,e.y*=-1},t.GetRightHandedQuaternionArrayFromRef=function(e){e[0]*=-1,e[1]*=-1},t})();t._GLTFUtilities=r})(e.GLTF2||(e.GLTF2={}))})(e||(e={})),e})); | ||
!(function(e,t){var r=[],a=e.BABYLON||this.BABYLON;"object"==typeof exports&&"object"==typeof module?(a=a||require("babylonjs"),module.exports=t(a)):"function"==typeof define&&define.amd?(r.push("babylonjs"),define("babylonjs-serializers",r,t)):"object"==typeof exports?(a=a||require("babylonjs"),exports["babylonjs-serializers"]=t(a)):e.BABYLON=t(a)})(this,(function(e){e=e||this.BABYLON;var e;this&&this.__decorate,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])}})();!(function(e){var t=(function(){function t(){}return t.OBJ=function(t,r,a,i){var n=[],o=1;r&&(a||(a="mat"),n.push("mtllib "+a+".mtl"));for(var s=0;s<t.length;s++){n.push("g object"+s),n.push("o object_"+s);var l=null;if(i){var u=e.Matrix.Translation(t[s].position.x,t[s].position.y,t[s].position.z);l=e.Matrix.Translation(-t[s].position.x,-t[s].position.y,-t[s].position.z),t[s].bakeTransformIntoVertices(u)}if(r){var c=t[s].material;c&&n.push("usemtl "+c.id)}var f=t[s].geometry;if(f){var h=f.getVerticesData("position"),d=f.getVerticesData("normal"),p=f.getVerticesData("uv"),m=f.getIndices(),g=0;if(h&&d&&p&&m){for(var T=0;T<h.length;T+=3)n.push("v "+h[T]+" "+h[T+1]+" "+h[T+2]),g++;for(T=0;T<d.length;T+=3)n.push("vn "+d[T]+" "+d[T+1]+" "+d[T+2]);for(T=0;T<p.length;T+=2)n.push("vt "+p[T]+" "+p[T+1]);for(T=0;T<m.length;T+=3)n.push("f "+(m[T+2]+o)+"/"+(m[T+2]+o)+"/"+(m[T+2]+o)+" "+(m[T+1]+o)+"/"+(m[T+1]+o)+"/"+(m[T+1]+o)+" "+(m[T]+o)+"/"+(m[T]+o)+"/"+(m[T]+o));i&&l&&t[s].bakeTransformIntoVertices(l),o+=g}}}return n.join("\n")},t.MTL=function(e){var t=[],r=e.material;t.push("newmtl mat1"),t.push(" Ns "+r.specularPower.toFixed(4)),t.push(" Ni 1.5000"),t.push(" d "+r.alpha.toFixed(4)),t.push(" Tr 0.0000"),t.push(" Tf 1.0000 1.0000 1.0000"),t.push(" illum 2"),t.push(" Ka "+r.ambientColor.r.toFixed(4)+" "+r.ambientColor.g.toFixed(4)+" "+r.ambientColor.b.toFixed(4)),t.push(" Kd "+r.diffuseColor.r.toFixed(4)+" "+r.diffuseColor.g.toFixed(4)+" "+r.diffuseColor.b.toFixed(4)),t.push(" Ks "+r.specularColor.r.toFixed(4)+" "+r.specularColor.g.toFixed(4)+" "+r.specularColor.b.toFixed(4)),t.push(" Ke "+r.emissiveColor.r.toFixed(4)+" "+r.emissiveColor.g.toFixed(4)+" "+r.emissiveColor.b.toFixed(4));return r.ambientTexture&&t.push(" map_Ka "+r.ambientTexture.name),r.diffuseTexture&&t.push(" map_Kd "+r.diffuseTexture.name),r.specularTexture&&t.push(" map_Ks "+r.specularTexture.name),r.bumpTexture&&t.push(" map_bump -imfchan z "+r.bumpTexture.name),r.opacityTexture&&t.push(" map_d "+r.opacityTexture.name),t.join("\n")},t})();e.OBJExport=t})(e||(e={})),e.Effect.ShadersStore.setAlphaToOnePixelShader="precision highp float;\nuniform sampler2D textureSampler;\nvarying vec2 vUV;\nvoid main(void) {\nvec4 color=texture2D(textureSampler,vUV);\ngl_FragColor=vec4(color.rgb,1.0);\n}";var e;!(function(e){var t=(function(){function t(){}return t.GLTFAsync=function(t,r,a){return t.whenReadyAsync().then((function(){var i=r.replace(/\.[^\/.]+$/,"");return new e.GLTF2._Exporter(t,a)._generateGLTFAsync(i)}))},t.GLBAsync=function(t,r,a){return t.whenReadyAsync().then((function(){var i=r.replace(/\.[^\/.]+$/,"");return new e.GLTF2._Exporter(t,a)._generateGLBAsync(i)}))},t})();e.GLTF2Export=t})(e||(e={}));var e;!(function(e){!(function(t){var r=(function(){function r(e,t){this.asset={generator:"BabylonJS",version:"2.0"},this.babylonScene=e,this.bufferViews=[],this.accessors=[],this.meshes=[],this.scenes=[],this.nodes=[],this.images=[],this.materials=[],this.textures=[],this.samplers=[],this.animations=[],this.imageData={},this.convertToRightHandedSystem=!this.babylonScene.useRightHandedSystem;var r=t||{};this.shouldExportTransformNode=r.shouldExportTransformNode?r.shouldExportTransformNode:function(e){return!0},this.animationSampleRate=r.animationSampleRate?r.animationSampleRate:1/60}return r.prototype.reorderIndicesBasedOnPrimitiveMode=function(t,r,a,i,n){switch(r){case e.Material.TriangleFillMode:i||(i=0);for(var o=t.indexStart,s=t.indexStart+t.indexCount;o<s;o+=3){var l=i+4*o,u=n.getUInt32(l+4),c=n.getUInt32(l+8);n.setUInt32(c,l+4),n.setUInt32(u,l+8)}break;case e.Material.TriangleFanDrawMode:for(var o=t.indexStart+t.indexCount-1,f=t.indexStart;o>=f;--o)n.setUInt32(a[o],i),i+=4;break;case e.Material.TriangleStripDrawMode:t.indexCount>=3&&(n.setUInt32(a[t.indexStart+2],i+4),n.setUInt32(a[t.indexStart+1],i+8))}},r.prototype.reorderVertexAttributeDataBasedOnPrimitiveMode=function(t,r,a,i,n,o,s){if(this.convertToRightHandedSystem&&a===e.Material.ClockWiseSideOrientation)switch(r){case e.Material.TriangleFillMode:this.reorderTriangleFillMode(t,r,a,i,n,o,s);break;case e.Material.TriangleStripDrawMode:this.reorderTriangleStripDrawMode(t,r,a,i,n,o,s);break;case e.Material.TriangleFanDrawMode:this.reorderTriangleFanMode(t,r,a,i,n,o,s)}},r.prototype.reorderTriangleFillMode=function(t,r,a,i,n,o,s){var l=this.getVertexBufferFromMesh(i,t.getMesh());if(l){var u=l.byteStride/e.VertexBuffer.GetTypeByteLength(l.type);if(t.verticesCount%3!=0)e.Tools.Error("The submesh vertices for the triangle fill mode is not divisible by 3!");else{var c=[],f=0;switch(i){case e.VertexBuffer.PositionKind:case e.VertexBuffer.NormalKind:for(var h=t.verticesStart;h<t.verticesStart+t.verticesCount;h+=3)f=h*u,c.push(e.Vector3.FromArray(n,f)),c.push(e.Vector3.FromArray(n,f+2*u)),c.push(e.Vector3.FromArray(n,f+u));break;case e.VertexBuffer.TangentKind:for(var h=t.verticesStart;h<t.verticesStart+t.verticesCount;h+=3)f=h*u,c.push(e.Vector4.FromArray(n,f)),c.push(e.Vector4.FromArray(n,f+2*u)),c.push(e.Vector4.FromArray(n,f+u));break;case e.VertexBuffer.ColorKind:for(var d=l.getSize(),h=t.verticesStart;h<t.verticesStart+t.verticesCount;h+=d)f=h*u,4===d?(c.push(e.Vector4.FromArray(n,f)),c.push(e.Vector4.FromArray(n,f+2*u)),c.push(e.Vector4.FromArray(n,f+u))):(c.push(e.Vector3.FromArray(n,f)),c.push(e.Vector3.FromArray(n,f+2*u)),c.push(e.Vector3.FromArray(n,f+u)));break;case e.VertexBuffer.UVKind:case e.VertexBuffer.UV2Kind:for(var h=t.verticesStart;h<t.verticesStart+t.verticesCount;h+=3)f=h*u,c.push(e.Vector2.FromArray(n,f)),c.push(e.Vector2.FromArray(n,f+2*u)),c.push(e.Vector2.FromArray(n,f+u));break;default:e.Tools.Error("Unsupported Vertex Buffer type: "+i)}this.writeVertexAttributeData(c,o,i,n,s)}}else e.Tools.Warn("reorderTriangleFillMode: Vertex Buffer Kind "+i+" not present!")},r.prototype.reorderTriangleStripDrawMode=function(t,r,a,i,n,o,s){var l=this.getVertexBufferFromMesh(i,t.getMesh());if(l){var u=l.byteStride/e.VertexBuffer.GetTypeByteLength(l.type),c=[],f=0;switch(i){case e.VertexBuffer.PositionKind:case e.VertexBuffer.NormalKind:f=t.verticesStart,c.push(e.Vector3.FromArray(n,f+2*u)),c.push(e.Vector3.FromArray(n,f+u));break;case e.VertexBuffer.TangentKind:for(var h=t.verticesStart+t.verticesCount-1;h>=t.verticesStart;--h)f=h*u,c.push(e.Vector4.FromArray(n,f));break;case e.VertexBuffer.ColorKind:for(var h=t.verticesStart+t.verticesCount-1;h>=t.verticesStart;--h)f=h*u,4===l.getSize()?c.push(e.Vector4.FromArray(n,f)):c.push(e.Vector3.FromArray(n,f));break;case e.VertexBuffer.UVKind:case e.VertexBuffer.UV2Kind:for(var h=t.verticesStart+t.verticesCount-1;h>=t.verticesStart;--h)f=h*u,c.push(e.Vector2.FromArray(n,f));break;default:e.Tools.Error("Unsupported Vertex Buffer type: "+i)}this.writeVertexAttributeData(c,o+12,i,n,s)}else e.Tools.Warn("reorderTriangleStripDrawMode: Vertex buffer kind "+i+" not present!")},r.prototype.reorderTriangleFanMode=function(t,r,a,i,n,o,s){var l=this.getVertexBufferFromMesh(i,t.getMesh());if(l){var u=l.byteStride/e.VertexBuffer.GetTypeByteLength(l.type),c=[],f=0;switch(i){case e.VertexBuffer.PositionKind:case e.VertexBuffer.NormalKind:for(var h=t.verticesStart+t.verticesCount-1;h>=t.verticesStart;--h)f=h*u,c.push(e.Vector3.FromArray(n,f));break;case e.VertexBuffer.TangentKind:for(var h=t.verticesStart+t.verticesCount-1;h>=t.verticesStart;--h)f=h*u,c.push(e.Vector4.FromArray(n,f));break;case e.VertexBuffer.ColorKind:for(var h=t.verticesStart+t.verticesCount-1;h>=t.verticesStart;--h)f=h*u,c.push(e.Vector4.FromArray(n,f)),4===l.getSize()?c.push(e.Vector4.FromArray(n,f)):c.push(e.Vector3.FromArray(n,f));break;case e.VertexBuffer.UVKind:case e.VertexBuffer.UV2Kind:for(var h=t.verticesStart+t.verticesCount-1;h>=t.verticesStart;--h)f=h*u,c.push(e.Vector2.FromArray(n,f));break;default:e.Tools.Error("Unsupported Vertex Buffer type: "+i)}this.writeVertexAttributeData(c,o,i,n,s)}else e.Tools.Warn("reorderTriangleFanMode: Vertex buffer kind "+i+" not present!")},r.prototype.writeVertexAttributeData=function(r,a,i,n,o){for(var s=0,l=r;s<l.length;s++){var u=l[s];!this.convertToRightHandedSystem||i===e.VertexBuffer.ColorKind||u instanceof e.Vector2||(u instanceof e.Vector3?i===e.VertexBuffer.PositionKind?t._GLTFUtilities.GetRightHandedPositionVector3FromRef(u):t._GLTFUtilities.GetRightHandedNormalVector3FromRef(u):t._GLTFUtilities.GetRightHandedVector4FromRef(u));for(var c=0,f=u.asArray();c<f.length;c++){var h=f[c];o.setFloat32(h,a),a+=4}}},r.prototype.writeAttributeData=function(r,a,i,n){var o,s=i/4,l=[];switch(r){case e.VertexBuffer.PositionKind:for(var u=0,c=a.length/s;u<c;++u){o=u*s;var f=e.Vector3.FromArray(a,o);this.convertToRightHandedSystem&&t._GLTFUtilities.GetRightHandedPositionVector3FromRef(f),l.push(f.asArray())}break;case e.VertexBuffer.NormalKind:for(var u=0,h=a.length/s;u<h;++u){o=u*s;var f=e.Vector3.FromArray(a,o);this.convertToRightHandedSystem&&t._GLTFUtilities.GetRightHandedNormalVector3FromRef(f),l.push(f.asArray())}break;case e.VertexBuffer.TangentKind:for(var u=0,d=a.length/s;u<d;++u){o=u*s;var f=e.Vector4.FromArray(a,o);this.convertToRightHandedSystem&&t._GLTFUtilities.GetRightHandedVector4FromRef(f),l.push(f.asArray())}break;case e.VertexBuffer.ColorKind:for(var u=0,p=a.length/s;u<p;++u){o=u*s;var f=3===s?e.Vector3.FromArray(a,o):e.Vector4.FromArray(a,o);l.push(f.asArray())}break;case e.VertexBuffer.UVKind:case e.VertexBuffer.UV2Kind:for(var u=0,m=a.length/s;u<m;++u)o=u*s,l.push((this.convertToRightHandedSystem,[a[o],a[o+1]]));break;default:e.Tools.Warn("Unsupported Vertex Buffer Type: "+r),l=[]}for(var g=0,T=l;g<T.length;g++)for(var y=T[g],v=0,x=y;v<x.length;v++){var b=x[v];n.setFloat32(b)}},r.prototype.generateJSON=function(e,r,a){var i,n,o,s=this,l={byteLength:this.totalByteLength},u=this.totalByteLength,c={asset:this.asset};return l.byteLength&&(c.buffers=[l]),this.nodes&&this.nodes.length&&(c.nodes=this.nodes),this.meshes&&this.meshes.length&&(c.meshes=this.meshes),this.scenes&&this.scenes.length&&(c.scenes=this.scenes,c.scene=0),this.bufferViews&&this.bufferViews.length&&(c.bufferViews=this.bufferViews),this.accessors&&this.accessors.length&&(c.accessors=this.accessors),this.animations&&this.animations.length&&(c.animations=this.animations),this.materials&&this.materials.length&&(c.materials=this.materials),this.textures&&this.textures.length&&(c.textures=this.textures),this.samplers&&this.samplers.length&&(c.samplers=this.samplers),this.images&&this.images.length&&(e?(c.images=[],this.images.forEach((function(e){e.uri&&(n=s.imageData[e.uri],i=e.uri.split(".")[0]+" image",o=t._GLTFUtilities.CreateBufferView(0,u,n.data.length,void 0,i),u+=n.data.buffer.byteLength,s.bufferViews.push(o),e.bufferView=s.bufferViews.length-1,e.name=i,e.mimeType=n.mimeType,e.uri=void 0,c.images||(c.images=[]),c.images.push(e))})),l.byteLength=u):c.images=this.images),e||(l.uri=r+".bin"),a?JSON.stringify(c,null,2):JSON.stringify(c)},r.prototype._generateGLTFAsync=function(t){var r=this;return this._generateBinaryAsync().then((function(a){var i=r.generateJSON(!1,t,!0),n=new Blob([a],{type:"application/octet-stream"}),o=t+".gltf",s=t+".bin",l=new e.GLTFData;if(l.glTFFiles[o]=i,l.glTFFiles[s]=n,r.imageData)for(var u in r.imageData)l.glTFFiles[u]=new Blob([r.imageData[u].data],{type:r.imageData[u].mimeType});return l}))},r.prototype._generateBinaryAsync=function(){var e=new a(4);return this.createSceneAsync(this.babylonScene,e).then((function(){return e.getArrayBuffer()}))},r.prototype._getPadding=function(e){var t=e%4;return 0===t?t:4-t},r.prototype._generateGLBAsync=function(t){var r=this;return this._generateBinaryAsync().then((function(a){var i=r.generateJSON(!0),n=t+".glb",o=i.length,s=0;for(var l in r.imageData)s+=r.imageData[l].data.byteLength;var u=r._getPadding(o),c=r._getPadding(a.byteLength),f=r._getPadding(s),h=28+o+u+a.byteLength+c+s+f,d=new ArrayBuffer(12),p=new DataView(d);p.setUint32(0,1179937895,!0),p.setUint32(4,2,!0),p.setUint32(8,h,!0);var m=new ArrayBuffer(8+o+u),g=new DataView(m);g.setUint32(0,o+u,!0),g.setUint32(4,1313821514,!0);for(var T=new Uint8Array(m,8),y=0;y<o;++y)T[y]=i.charCodeAt(y);for(var v=new Uint8Array(m,8+o),y=0;y<u;++y)v[y]=32;var x=new ArrayBuffer(8),b=new DataView(x);b.setUint32(0,a.byteLength+s+f,!0),b.setUint32(4,5130562,!0);for(var A=new ArrayBuffer(c),F=new Uint8Array(A),y=0;y<c;++y)F[y]=0;for(var _=new ArrayBuffer(f),R=new Uint8Array(_),y=0;y<f;++y)R[y]=0;var C=[d,m,x,a];for(var l in r.imageData)C.push(r.imageData[l].data.buffer);C.push(A),C.push(_);var S=new Blob(C,{type:"application/octet-stream"}),M=new e.GLTFData;return M.glTFFiles[n]=S,M}))},r.prototype.setNodeTransformation=function(r,a){a.position.equalsToFloats(0,0,0)||(r.translation=this.convertToRightHandedSystem?t._GLTFUtilities.GetRightHandedPositionVector3(a.position).asArray():a.position.asArray()),a.scaling.equalsToFloats(1,1,1)||(r.scale=a.scaling.asArray());var i=e.Quaternion.RotationYawPitchRoll(a.rotation.y,a.rotation.x,a.rotation.z);a.rotationQuaternion&&i.multiplyInPlace(a.rotationQuaternion),0===i.x&&0===i.y&&0===i.z&&1===i.w||(this.convertToRightHandedSystem&&t._GLTFUtilities.GetRightHandedQuaternionFromRef(i),r.rotation=i.normalize().asArray())},r.prototype.getVertexBufferFromMesh=function(e,t){if(t.isVerticesDataPresent(e)){var r=t.getVertexBuffer(e);if(r)return r}return null},r.prototype.createBufferViewKind=function(r,a,i,n){var o=a instanceof e.Mesh?a:a instanceof e.InstancedMesh?a.sourceMesh:null;if(o){var s=o.getVerticesData(r);if(s){var l=4*s.length,u=t._GLTFUtilities.CreateBufferView(0,i.getByteOffset(),l,n,r+" - "+o.name);this.bufferViews.push(u),this.writeAttributeData(r,s,n,i)}}},r.prototype.getMeshPrimitiveMode=function(t){return t.material?t.material.fillMode:e.Material.TriangleFillMode},r.prototype.setPrimitiveMode=function(t,r){switch(r){case e.Material.TriangleFillMode:break;case e.Material.TriangleStripDrawMode:t.mode=5;break;case e.Material.TriangleFanDrawMode:t.mode=6;break;case e.Material.PointListDrawMode:t.mode=0;case e.Material.PointFillMode:t.mode=0;break;case e.Material.LineLoopDrawMode:t.mode=2;break;case e.Material.LineListDrawMode:t.mode=1;break;case e.Material.LineStripDrawMode:t.mode=3}},r.prototype.setAttributeKind=function(t,r){switch(r){case e.VertexBuffer.PositionKind:t.attributes.POSITION=this.accessors.length-1;break;case e.VertexBuffer.NormalKind:t.attributes.NORMAL=this.accessors.length-1;break;case e.VertexBuffer.ColorKind:t.attributes.COLOR_0=this.accessors.length-1;break;case e.VertexBuffer.TangentKind:t.attributes.TANGENT=this.accessors.length-1;break;case e.VertexBuffer.UVKind:t.attributes.TEXCOORD_0=this.accessors.length-1;break;case e.VertexBuffer.UV2Kind:t.attributes.TEXCOORD_1=this.accessors.length-1;break;default:e.Tools.Warn("Unsupported Vertex Buffer Type: "+r)}},r.prototype.setPrimitiveAttributes=function(r,a,i){var n,o,s,l=null;a instanceof e.Mesh?l=a:a instanceof e.InstancedMesh&&(l=a.sourceMesh);var u=[{kind:e.VertexBuffer.PositionKind,accessorType:"VEC3",byteStride:12},{kind:e.VertexBuffer.NormalKind,accessorType:"VEC3",byteStride:12},{kind:e.VertexBuffer.ColorKind,accessorType:"VEC4",byteStride:16},{kind:e.VertexBuffer.TangentKind,accessorType:"VEC4",byteStride:16},{kind:e.VertexBuffer.UVKind,accessorType:"VEC2",byteStride:8},{kind:e.VertexBuffer.UV2Kind,accessorType:"VEC2",byteStride:8}];if(l){for(var c=null,f=this.getMeshPrimitiveMode(l),h={},d=0,p=u;d<p.length;d++){var m=p[d],g=m.kind;if(l.isVerticesDataPresent(g)){var T=this.getVertexBufferFromMesh(g,l);m.byteStride=T?4*T.getSize():4*e.VertexBuffer.DeduceStride(g),12===m.byteStride&&(m.accessorType="VEC3"),this.createBufferViewKind(g,a,i,m.byteStride),m.bufferViewIndex=this.bufferViews.length-1,h[g]=m.bufferViewIndex}}if(l.getTotalIndices()){var y=l.getIndices();if(y){var v=4*y.length;n=t._GLTFUtilities.CreateBufferView(0,i.getByteOffset(),v,void 0,"Indices - "+l.name),this.bufferViews.push(n),c=this.bufferViews.length-1;for(var x=0,b=y.length;x<b;++x)i.setUInt32(y[x])}}if(l.subMeshes)for(var A=0,F=l.subMeshes;A<F.length;A++){var _=F[A];o=!1;var R=_.getMaterial(),C=null;R&&(R instanceof e.MultiMaterial?(R=R.subMaterials[_.materialIndex])&&(C=this.babylonScene.materials.indexOf(R)):C=this.babylonScene.materials.indexOf(R));for(var S=null!=C?this.materials[C]:null,M={attributes:{}},V=0,B=u;V<B.length;V++){var m=B[V],g=m.kind;if(g!==e.VertexBuffer.UVKind&&g!==e.VertexBuffer.UV2Kind||!S||t._GLTFMaterial._HasTexturesPresent(S)){var E=l.getVerticesData(g);if(E){var T=this.getVertexBufferFromMesh(g,l);if(T){var w=T.getSize(),L=m.bufferViewIndex;if(void 0!=L){s={min:null,max:null},g==e.VertexBuffer.PositionKind&&(s=t._GLTFUtilities.CalculateMinMaxPositions(E,0,E.length/w,this.convertToRightHandedSystem));var P=t._GLTFUtilities.CreateAccessor(L,g+" - "+a.name,m.accessorType,5126,E.length/w,0,s.min,s.max);this.accessors.push(P),this.setAttributeKind(M,g),null==M.attributes.TEXCOORD_0&&null==M.attributes.TEXCOORD_1||(o=!0)}}}}}if(c){var P=t._GLTFUtilities.CreateAccessor(c,"indices - "+a.name,"SCALAR",5125,_.indexCount,4*_.indexStart,null,null);this.accessors.push(P),M.indices=this.accessors.length-1}if(R&&null!=C&&Object.keys(M.attributes).length>0){var G=this.babylonScene.materials[C].sideOrientation;if(this.setPrimitiveMode(M,f),this.convertToRightHandedSystem&&G===e.Material.ClockWiseSideOrientation){var N=null!=c?this.bufferViews[c].byteOffset:null;null==N&&(N=0);var I=null;if(null!=c&&(I=l.getIndices()),I)this.reorderIndicesBasedOnPrimitiveMode(_,f,I,N,i);else for(var U=0,O=u;U<O.length;U++){var m=O[U],E=l.getVerticesData(m.kind);if(E){var k=this.bufferViews[h[m.kind]].byteOffset;k||(k=0),this.reorderVertexAttributeDataBasedOnPrimitiveMode(_,f,G,m.kind,E,k,i)}}}if(!o&&t._GLTFMaterial._HasTexturesPresent(this.materials[C])){var D=t._GLTFMaterial._StripTexturesFromMaterial(this.materials[C]);this.materials.push(D),C=this.materials.length-1}M.material=C}r.primitives.push(M)}}},r.prototype.createSceneAsync=function(r,a){var i,n,o,s=this,l={nodes:[]},u=r.transformNodes.concat(r.meshes);return t._GLTFMaterial._ConvertMaterialsToGLTFAsync(r.materials,"image/png",this.images,this.textures,this.samplers,this.materials,this.imageData,!0).then((function(){s.nodeMap=s.createNodeMapAndAnimations(r,u,s.shouldExportTransformNode,a),s.totalByteLength=a.getByteOffset();for(var t=0,c=u;t<c.length;t++){var f=c[t];if(null!=(i=s.nodeMap[f.uniqueId])&&(n=s.nodes[i],f.parent||(s.shouldExportTransformNode(f)?(s.convertToRightHandedSystem&&(n.translation&&(n.translation[2]*=-1,n.translation[0]*=-1),n.rotation=n.rotation?e.Quaternion.FromArray([0,1,0,0]).multiply(e.Quaternion.FromArray(n.rotation)).asArray():e.Quaternion.FromArray([0,1,0,0]).asArray()),l.nodes.push(i)):e.Tools.Log("Omitting "+f.name+" from scene.")),o=f.getDescendants(!0),!n.children&&o&&o.length)){n.children=[];for(var h=0,d=o;h<d.length;h++){var p=d[h];null!=s.nodeMap[p.uniqueId]&&n.children.push(s.nodeMap[p.uniqueId])}}}l.nodes.length&&s.scenes.push(l)}))},r.prototype.createNodeMapAndAnimations=function(e,r,a,i){for(var n,o,s=this,l={},u={name:"runtime animations",channels:[],samplers:[]},c=[],f=0,h=r;f<h.length;f++){var d=h[f];a(d)?(o=this.createNode(d,i),this.nodes.push(o),n=this.nodes.length-1,l[d.uniqueId]=n,!e.animationGroups.length&&d.animations.length&&t._GLTFAnimation._CreateNodeAnimationFromTransformNodeAnimations(d,u,c,l,this.nodes,i,this.bufferViews,this.accessors,this.convertToRightHandedSystem,this.animationSampleRate)):d.name}return u.channels.length&&u.samplers.length&&this.animations.push(u),c.forEach((function(e){e.channels.length&&e.samplers.length&&s.animations.push(e)})),e.animationGroups.length&&t._GLTFAnimation._CreateNodeAnimationFromAnimationGroups(e,this.animations,l,this.nodes,i,this.bufferViews,this.accessors,this.convertToRightHandedSystem,this.animationSampleRate),l},r.prototype.createNode=function(e,t){var r={},a={primitives:[]};return e.name&&(r.name=e.name),this.setNodeTransformation(r,e),this.setPrimitiveAttributes(a,e,t),a.primitives.length&&(this.meshes.push(a),r.mesh=this.meshes.length-1),r},r})();t._Exporter=r;var a=(function(){function t(e){this._arrayBuffer=new ArrayBuffer(e),this._dataView=new DataView(this._arrayBuffer),this._byteOffset=0}return t.prototype.resizeBuffer=function(e){for(var t=new ArrayBuffer(e),r=new Uint8Array(this._arrayBuffer),a=new Uint8Array(t),i=0,n=a.byteLength;i<n;++i)a[i]=r[i];this._arrayBuffer=t,this._dataView=new DataView(this._arrayBuffer)},t.prototype.getArrayBuffer=function(){return this.resizeBuffer(this.getByteOffset()),this._arrayBuffer},t.prototype.getByteOffset=function(){return this._byteOffset},t.prototype.setUInt8=function(t,r){null!=r?r<this._byteOffset?this._dataView.setUint8(r,t):e.Tools.Error("BinaryWriter: byteoffset is greater than the current binary buffer length!"):(this._byteOffset+1>this._arrayBuffer.byteLength&&this.resizeBuffer(2*this._arrayBuffer.byteLength),this._dataView.setUint8(this._byteOffset++,t))},t.prototype.getUInt32=function(t){if(t<this._byteOffset)return this._dataView.getUint32(t,!0);throw e.Tools.Error("BinaryWriter: byteoffset is greater than the current binary buffer length!"),new Error("BinaryWriter: byteoffset is greater than the current binary buffer length!")},t.prototype.getVector3Float32FromRef=function(t,r){r+8>this._byteOffset?e.Tools.Error("BinaryWriter: byteoffset is greater than the current binary buffer length!"):(t.x=this._dataView.getFloat32(r,!0),t.y=this._dataView.getFloat32(r+4,!0),t.z=this._dataView.getFloat32(r+8,!0))},t.prototype.setVector3Float32FromRef=function(t,r){r+8>this._byteOffset?e.Tools.Error("BinaryWriter: byteoffset is greater than the current binary buffer length!"):(this._dataView.setFloat32(r,t.x,!0),this._dataView.setFloat32(r+4,t.y,!0),this._dataView.setFloat32(r+8,t.z,!0))},t.prototype.getVector4Float32FromRef=function(t,r){r+12>this._byteOffset?e.Tools.Error("BinaryWriter: byteoffset is greater than the current binary buffer length!"):(t.x=this._dataView.getFloat32(r,!0),t.y=this._dataView.getFloat32(r+4,!0),t.z=this._dataView.getFloat32(r+8,!0),t.w=this._dataView.getFloat32(r+12,!0))},t.prototype.setVector4Float32FromRef=function(t,r){r+12>this._byteOffset?e.Tools.Error("BinaryWriter: byteoffset is greater than the current binary buffer length!"):(this._dataView.setFloat32(r,t.x,!0),this._dataView.setFloat32(r+4,t.y,!0),this._dataView.setFloat32(r+8,t.z,!0),this._dataView.setFloat32(r+12,t.w,!0))},t.prototype.setFloat32=function(t,r){isNaN(t)&&e.Tools.Error("Invalid data being written!"),null!=r&&(r<this._byteOffset?this._dataView.setFloat32(r,t,!0):e.Tools.Error("BinaryWriter: byteoffset is greater than the current binary length!")),this._byteOffset+4>this._arrayBuffer.byteLength&&this.resizeBuffer(2*this._arrayBuffer.byteLength),this._dataView.setFloat32(this._byteOffset,t,!0),this._byteOffset+=4},t.prototype.setUInt32=function(t,r){null!=r?r<this._byteOffset?this._dataView.setUint32(r,t,!0):e.Tools.Error("BinaryWriter: byteoffset is greater than the current binary buffer length!"):(this._byteOffset+4>this._arrayBuffer.byteLength&&this.resizeBuffer(2*this._arrayBuffer.byteLength),this._dataView.setUint32(this._byteOffset,t,!0),this._byteOffset+=4)},t})();t._BinaryWriter=a})(e.GLTF2||(e.GLTF2={}))})(e||(e={}));var e;!(function(e){var t=(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 a=this.glTFFiles[t],i=void 0;e(t,".glb")?i={type:"model/gltf-binary"}:e(t,".bin")?i={type:"application/octet-stream"}:e(t,".gltf")?i={type:"model/gltf+json"}:e(t,".jpeg")?i={type:"image/jpeg"}:e(t,".png")&&(i={type:"image/png"}),r.href=window.URL.createObjectURL(new Blob([a],i)),r.click()}},e})();e.GLTFData=t})(e||(e={}));var e;!(function(e){!(function(t){var r=(function(){function t(){}return t.FuzzyEquals=function(t,r,a){return e.Scalar.WithinEpsilon(t.r,r.r,a)&&e.Scalar.WithinEpsilon(t.g,r.g,a)&&e.Scalar.WithinEpsilon(t.b,r.b,a)},t._ConvertMaterialsToGLTFAsync=function(r,a,i,n,o,s,l,u){for(var c=[],f=0,h=r;f<h.length;f++){var d=h[f];d instanceof e.StandardMaterial?c.push(t._ConvertStandardMaterialAsync(d,a,i,n,o,s,l,u)):d instanceof e.PBRMetallicRoughnessMaterial?c.push(t._ConvertPBRMetallicRoughnessMaterialAsync(d,a,i,n,o,s,l,u)):d instanceof e.PBRMaterial?c.push(t._ConvertPBRMaterialAsync(d,a,i,n,o,s,l,u)):e.Tools.Warn("Unsupported material type: "+d.name)}return Promise.all(c).then((function(){}))},t._StripTexturesFromMaterial=function(e){var t={};if(e){t.name=e.name,t.doubleSided=e.doubleSided,t.alphaMode=e.alphaMode,t.alphaCutoff=e.alphaCutoff,t.emissiveFactor=e.emissiveFactor;var r=e.pbrMetallicRoughness;r&&(t.pbrMetallicRoughness={},t.pbrMetallicRoughness.baseColorFactor=r.baseColorFactor,t.pbrMetallicRoughness.metallicFactor=r.metallicFactor,t.pbrMetallicRoughness.roughnessFactor=r.roughnessFactor)}return t},t._HasTexturesPresent=function(e){if(e.emissiveTexture||e.normalTexture||e.occlusionTexture)return!0;var t=e.pbrMetallicRoughness;return!(!t||!t.baseColorTexture&&!t.metallicRoughnessTexture)},t._ConvertToGLTFPBRMetallicRoughness=function(t){function r(e,t,r,a,i){return(1-e)*(1-e)*(1-e)*t+3*(1-e)*(1-e)*e*r+3*(1-e)*e*e*a+e*e*e*i}var a=new e.Vector2(0,1),i=new e.Vector2(0,.1),n=new e.Vector2(0,.1),o=new e.Vector2(1300,.1),s=t.diffuseColor.toLinearSpace().scale(.5),l=t.alpha,u=e.Scalar.Clamp(t.specularPower,0,this._maxSpecularPower),c=(function(e){return r(Math.pow(e/o.x,.333333),a.y,i.y,n.y,o.y)})(u);return{baseColorFactor:[s.r,s.g,s.b,l],metallicFactor:0,roughnessFactor:c}},t._SolveMetallic=function(r,a,i){if(a<t._dielectricSpecular.r)return t._dielectricSpecular,0;var n=t._dielectricSpecular.r,o=r*i/(1-t._dielectricSpecular.r)+a-2*t._dielectricSpecular.r,s=t._dielectricSpecular.r-a,l=o*o-4*n*s;return e.Scalar.Clamp((-o+Math.sqrt(l))/(2*n),0,1)},t._GetAlphaMode=function(t){if(t instanceof e.StandardMaterial){var r=t;return 1!==r.alpha||null!=r.diffuseTexture&&r.diffuseTexture.hasAlpha||null!=r.opacityTexture?"BLEND":"OPAQUE"}if(t instanceof e.PBRMetallicRoughnessMaterial){var a=t;switch(a.transparencyMode){case e.PBRMaterial.PBRMATERIAL_OPAQUE:return"OPAQUE";case e.PBRMaterial.PBRMATERIAL_ALPHABLEND:return"BLEND";case e.PBRMaterial.PBRMATERIAL_ALPHATEST:return"MASK";case e.PBRMaterial.PBRMATERIAL_ALPHATESTANDBLEND:return e.Tools.Warn(t.name+": GLTF Exporter | Alpha test and blend mode not supported in glTF. Alpha blend used instead."),"BLEND";default:return e.Tools.Error("Unsupported alpha mode "+a.transparencyMode),null}}else{if(!(t instanceof e.PBRMaterial))return e.Tools.Error("Unsupported Babylon material type"),null;var i=t;switch(i.transparencyMode){case e.PBRMaterial.PBRMATERIAL_OPAQUE:return"OPAQUE";case e.PBRMaterial.PBRMATERIAL_ALPHABLEND:return"BLEND";case e.PBRMaterial.PBRMATERIAL_ALPHATEST:return"MASK";case e.PBRMaterial.PBRMATERIAL_ALPHATESTANDBLEND:return e.Tools.Warn(t.name+": GLTF Exporter | Alpha test and blend mode not supported in glTF. Alpha blend used instead."),"BLEND";default:return e.Tools.Error("Unsupported alpha mode "+i.transparencyMode),null}}},t._ConvertStandardMaterialAsync=function(r,a,i,n,o,s,l,u){var c=this._GetAlphaMode(r),f="OPAQUE"!==c,h=[],d=t._ConvertToGLTFPBRMetallicRoughness(r),p={name:r.name};if(null==r.backFaceCulling||r.backFaceCulling||(r.twoSidedLighting||e.Tools.Warn(r.name+": Back-face culling enabled and two-sided lighting disabled is not supported in glTF."),p.doubleSided=!0),u){if(r.diffuseTexture){var m=t._ExportTextureAsync(r.diffuseTexture,a,i,n,o,l,f).then((function(e){e&&(d.baseColorTexture=e)}));h.push(m)}if(r.bumpTexture){var m=t._ExportTextureAsync(r.bumpTexture,a,i,n,o,l,f).then((function(e){e&&(p.normalTexture=e,null!=r.bumpTexture&&1!==r.bumpTexture.level&&(p.normalTexture.scale=r.bumpTexture.level))}));h.push(m)}if(r.emissiveTexture){var m=t._ExportTextureAsync(r.emissiveTexture,a,i,n,o,l,f).then((function(e){e&&(p.emissiveTexture=e),p.emissiveFactor=[1,1,1]}));h.push(m)}if(r.ambientTexture){var m=t._ExportTextureAsync(r.ambientTexture,a,i,n,o,l,f).then((function(e){if(e){var t={index:e.index};p.occlusionTexture=t,t.strength=1}}));h.push(m)}}return(r.alpha<1||r.opacityTexture)&&(r.alphaMode===e.Engine.ALPHA_COMBINE?p.alphaMode="BLEND":e.Tools.Warn(r.name+": glTF 2.0 does not support alpha mode: "+r.alphaMode.toString())),r.emissiveColor&&!this.FuzzyEquals(r.emissiveColor,e.Color3.Black(),this._epsilon)&&(p.emissiveFactor=r.emissiveColor.asArray()),p.pbrMetallicRoughness=d,s.push(p),Promise.all(h).then((function(){}))},t._SetAlphaToOneAsync=function(t,r){return new Promise(function(a,i){if(r)a(t);else{var n=t.getScene();if(n){var o=new e.ProceduralTexture("texture",t.getSize(),"setAlphaToOne",n);o?(o.setTexture("textureSampler",t),o.onLoadObservable.add((function(){a(o)}))):i("Cannot create procedural texture for "+t.name+"!")}else i("Scene not available for texture "+t.name)}})},t._ConvertPBRMetallicRoughnessMaterialAsync=function(r,a,i,n,o,s,l,u){var c=[],f={};r.baseColor&&(f.baseColorFactor=[r.baseColor.r,r.baseColor.g,r.baseColor.b,r.alpha]),null!=r.metallic&&1!==r.metallic&&(f.metallicFactor=r.metallic),null!=r.roughness&&1!==r.roughness&&(f.roughnessFactor=r.roughness);var h={name:r.name};r.doubleSided&&(h.doubleSided=r.doubleSided);var d=null,p=!1;if(null!=r.transparencyMode&&(d=t._GetAlphaMode(r))&&"OPAQUE"!==d&&(h.alphaMode=d,"MASK"===d&&(h.alphaCutoff=r.alphaCutOff)),"OPAQUE"!==d&&(p=!0),u){if(null!=r.baseTexture){var m=t._ExportTextureAsync(r.baseTexture,a,i,n,o,l,p).then((function(e){e&&(f.baseColorTexture=e)}));c.push(m)}if(r.normalTexture){var m=t._ExportTextureAsync(r.normalTexture,a,i,n,o,l,p).then((function(e){e&&(h.normalTexture=e,1!==r.normalTexture.level&&(h.normalTexture.scale=r.normalTexture.level))}));c.push(m)}if(r.occlusionTexture){var m=t._ExportTextureAsync(r.occlusionTexture,a,i,n,o,l,p).then((function(e){e&&(h.occlusionTexture=e,null!=r.occlusionStrength&&(h.occlusionTexture.strength=r.occlusionStrength))}));c.push(m)}if(r.emissiveTexture){var m=t._ExportTextureAsync(r.emissiveTexture,a,i,n,o,l,p).then((function(e){e&&(h.emissiveTexture=e)}));c.push(m)}}return this.FuzzyEquals(r.emissiveColor,e.Color3.Black(),this._epsilon)&&(h.emissiveFactor=r.emissiveColor.asArray()),h.pbrMetallicRoughness=f,s.push(h),Promise.all(c).then((function(){}))},t._CreateBase64FromCanvas=function(e,t,r,a){var i=document.createElement("canvas");i.width=t,i.height=r,i.id="WriteCanvas";var n=i.getContext("2d"),o=n.createImageData(t,r);return o.data.set(e),n.putImageData(o,0,0),i.toDataURL(a)},t._CreateWhiteTexture=function(t,r,a){for(var i=new Uint8Array(t*r*4),n=0;n<i.length;n+=4)i[n]=i[n+1]=i[n+2]=i[n+3]=255;return e.RawTexture.CreateRGBATexture(i,t,r,a)},t._ResizeTexturesToSameDimensions=function(t,r,a){var i,n,o=t?t.getSize():{width:0,height:0},s=r?r.getSize():{width:0,height:0};return o.width<s.width?(i=t?e.TextureTools.CreateResizedCopy(t,s.width,s.height,!0):this._CreateWhiteTexture(s.width,s.height,a),n=r):o.width>s.width?(n=r?e.TextureTools.CreateResizedCopy(r,o.width,o.height,!0):this._CreateWhiteTexture(o.width,o.height,a),i=t):(i=t,n=r),{texture1:i,texture2:n}},t._ConvertSpecularGlossinessTexturesToMetallicRoughness=function(t,r,a,i){if(!t&&!r)return e.Tools.Warn("_ConvertSpecularGlosinessTexturesToMetallicRoughness: diffuse and specular glossiness textures are not defined!"),null | ||
;var n=t?t.getScene():r?r.getScene():null;if(n){var o=this._ResizeTexturesToSameDimensions(t,r,n),s=o.texture1.getSize(),l=void 0,u=void 0,c=s.width,f=s.height,h=o.texture1.readPixels();if(h instanceof Uint8Array){if(l=o.texture1.readPixels(),(h=o.texture2.readPixels())instanceof Uint8Array){u=o.texture2.readPixels();for(var d=u.byteLength,p=new Uint8Array(d),m=new Uint8Array(d),g=e.Color3.Black(),T=0,y=0,v=0;v<f;++v)for(var x=0;x<c;++x){var b=4*(c*v+x),A=e.Color3.FromInts(l[b],l[b+1],l[b+2]).toLinearSpace().multiply(a.diffuseColor),F=e.Color3.FromInts(u[b],u[b+1],u[b+2]).toLinearSpace().multiply(a.specularColor),_=u[b+3]/255*a.glossiness,R={diffuseColor:A,specularColor:F,glossiness:_},C=this._ConvertSpecularGlossinessToMetallicRoughness(R);g.r=Math.max(g.r,C.baseColor.r),g.g=Math.max(g.g,C.baseColor.g),g.b=Math.max(g.b,C.baseColor.b),T=Math.max(T,C.metallic),y=Math.max(y,C.roughness),m[b]=255*C.baseColor.r,m[b+1]=255*C.baseColor.g,m[b+2]=255*C.baseColor.b,m[b+3]=o.texture1.hasAlpha?l[b+3]:255,p[b]=0,p[b+1]=255*C.roughness,p[b+2]=255*C.metallic,p[b+3]=255}for(var S={baseColor:g,metallic:T,roughness:y},M=!1,V=!1,v=0;v<f;++v)for(var x=0;x<c;++x){var B=4*(c*v+x);m[B]/=S.baseColor.r>this._epsilon?S.baseColor.r:1,m[B+1]/=S.baseColor.g>this._epsilon?S.baseColor.g:1,m[B+2]/=S.baseColor.b>this._epsilon?S.baseColor.b:1;var E=e.Color3.FromInts(m[B],m[B+1],m[B+2]),w=E.toGammaSpace();m[B]=255*w.r,m[B+1]=255*w.g,m[B+2]=255*w.b,this.FuzzyEquals(w,e.Color3.White(),this._epsilon)||(V=!0),p[B+1]/=S.roughness>this._epsilon?S.roughness:1,p[B+2]/=S.metallic>this._epsilon?S.metallic:1;var L=e.Color3.FromInts(255,p[B+1],p[B+2]);this.FuzzyEquals(L,e.Color3.White(),this._epsilon)||(M=!0)}if(M){var P=this._CreateBase64FromCanvas(p,c,f,i);S.metallicRoughnessTextureBase64=P}if(V){var G=this._CreateBase64FromCanvas(m,c,f,i);S.baseColorTextureBase64=G}return S}e.Tools.Error("_ConvertSpecularGlossinessTexturesToMetallicRoughness: Pixel array buffer type not supported for texture: "+o.texture2.name)}else e.Tools.Error("_ConvertSpecularGlossinessTexturesToMetallicRoughness: Pixel array buffer type not supported for texture: "+o.texture1.name)}else e.Tools.Error("_ConvertSpecularGlossinessTexturesToMetallicRoughness: Scene from textures is missing!");return null},t._ConvertSpecularGlossinessToMetallicRoughness=function(r){var a=t._GetPerceivedBrightness(r.diffuseColor),i=t._GetPerceivedBrightness(r.specularColor),n=1-t._GetMaxComponent(r.specularColor),o=t._SolveMetallic(a,i,n),s=r.diffuseColor.scale(n/(1-this._dielectricSpecular.r)/Math.max(1-o,this._epsilon)),l=r.specularColor.subtract(this._dielectricSpecular.scale(1-o)).scale(1/Math.max(o,this._epsilon)),u=e.Color3.Lerp(s,l,o*o);return u=u.clampToRef(0,1,u),{baseColor:u,metallic:o,roughness:1-r.glossiness}},t._GetPerceivedBrightness=function(e){return e?Math.sqrt(.299*e.r*e.r+.587*e.g*e.g+.114*e.b*e.b):0},t._GetMaxComponent=function(e){return e?Math.max(e.r,Math.max(e.g,e.b)):0},t._ConvertMetalRoughFactorsToMetallicRoughnessAsync=function(e,r,a,i,n,o,s,l){var u=this._GetAlphaMode(e),c="OPAQUE"!==u,f=[],h={baseColor:e.albedoColor,metallic:e.metallic,roughness:e.roughness};if(l){if(e.albedoTexture){var d=t._ExportTextureAsync(e.albedoTexture,r,a,i,n,s,c).then((function(e){e&&(o.baseColorTexture=e)}));f.push(d)}if(e.metallicTexture){var d=t._ExportTextureAsync(e.metallicTexture,r,a,i,n,s,c).then((function(e){e&&(o.metallicRoughnessTexture=e)}));f.push(d)}}return Promise.all(f).then((function(){return h}))},t._GetGLTFTextureSampler=function(r){var a=t._GetGLTFTextureWrapModesSampler(r),i=r instanceof e.Texture?r.samplingMode:null;if(null!=i)switch(i){case e.Texture.LINEAR_LINEAR:a.magFilter=9729,a.minFilter=9729;break;case e.Texture.LINEAR_NEAREST:a.magFilter=9729,a.minFilter=9728;break;case e.Texture.NEAREST_LINEAR:a.magFilter=9728,a.minFilter=9729;break;case e.Texture.NEAREST_LINEAR_MIPLINEAR:a.magFilter=9728,a.minFilter=9987;break;case e.Texture.NEAREST_NEAREST:a.magFilter=9728,a.minFilter=9728;break;case e.Texture.NEAREST_LINEAR_MIPNEAREST:a.magFilter=9728,a.minFilter=9985;break;case e.Texture.LINEAR_NEAREST_MIPNEAREST:a.magFilter=9729,a.minFilter=9984;break;case e.Texture.LINEAR_NEAREST_MIPLINEAR:a.magFilter=9729,a.minFilter=9986;break;case e.Texture.NEAREST_NEAREST_MIPLINEAR:a.magFilter=9728,a.minFilter=9986;break;case e.Texture.LINEAR_LINEAR_MIPLINEAR:a.magFilter=9729,a.minFilter=9987;break;case e.Texture.LINEAR_LINEAR_MIPNEAREST:a.magFilter=9729,a.minFilter=9985;break;case e.Texture.NEAREST_NEAREST_MIPNEAREST:a.magFilter=9728,a.minFilter=9984}return a},t._GetGLTFTextureWrapMode=function(t){switch(t){case e.Texture.WRAP_ADDRESSMODE:return 10497;case e.Texture.CLAMP_ADDRESSMODE:return 33071;case e.Texture.MIRROR_ADDRESSMODE:return 33648;default:return e.Tools.Error("Unsupported Texture Wrap Mode "+t+"!"),10497}},t._GetGLTFTextureWrapModesSampler=function(r){var a=t._GetGLTFTextureWrapMode(r instanceof e.Texture?r.wrapU:e.Texture.WRAP_ADDRESSMODE),i=t._GetGLTFTextureWrapMode(r instanceof e.Texture?r.wrapV:e.Texture.WRAP_ADDRESSMODE);return 10497===a&&10497===i?{}:{wrapS:a,wrapT:i}},t._ConvertSpecGlossFactorsToMetallicRoughness=function(r,a,i,n,o,s,l,u){var c={diffuseColor:r.albedoColor||e.Color3.White(),specularColor:r.reflectivityColor||e.Color3.White(),glossiness:r.microSurface||1},f=null,h=this._GetGLTFTextureSampler(r.albedoTexture);if(null!=h.magFilter&&null!=h.minFilter&&null!=h.wrapS&&null!=h.wrapT&&(o.push(h),f=o.length-1),r.reflectivityTexture&&!r.useMicroSurfaceFromReflectivityMapAlpha)return e.Tools.Error("_ConvertPBRMaterial: Glossiness values not included in the reflectivity texture are currently not supported"),null;var d=this._ConvertSpecularGlossinessTexturesToMetallicRoughness(r.albedoTexture,r.reflectivityTexture,c,a);if(d&&u){if(d.baseColorTextureBase64){var p=t._GetTextureInfoFromBase64(d.baseColorTextureBase64,"bjsBaseColorTexture_"+n.length+".png",a,i,n,r.albedoTexture?r.albedoTexture.coordinatesIndex:null,f,l);null!=p&&(s.baseColorTexture=p)}if(d.metallicRoughnessTextureBase64){var m=t._GetTextureInfoFromBase64(d.metallicRoughnessTextureBase64,"bjsMetallicRoughnessTexture_"+n.length+".png",a,i,n,r.reflectivityTexture?r.reflectivityTexture.coordinatesIndex:null,f,l);null!=m&&(s.metallicRoughnessTexture=m)}return d}return this._ConvertSpecularGlossinessToMetallicRoughness(c)},t._ConvertPBRMaterialAsync=function(e,r,a,i,n,o,s,l){var u={},c={name:e.name};if(e.isMetallicWorkflow())return e.albedoColor&&(u.baseColorFactor=[e.albedoColor.r,e.albedoColor.g,e.albedoColor.b,e.alpha]),this._ConvertMetalRoughFactorsToMetallicRoughnessAsync(e,r,a,i,n,u,s,l).then((function(f){return t.SetMetallicRoughnessPbrMaterial(f,e,c,u,r,a,i,n,o,s,l)}));var f=this._ConvertSpecGlossFactorsToMetallicRoughness(e,r,a,i,n,u,s,l);return t.SetMetallicRoughnessPbrMaterial(f,e,c,u,r,a,i,n,o,s,l)},t.SetMetallicRoughnessPbrMaterial=function(r,a,i,n,o,s,l,u,c,f,h){var d=[];if(r){var p=null,m=!1;if(null!=a.transparencyMode&&(p=t._GetAlphaMode(a))&&"OPAQUE"!==p&&(m=!0,i.alphaMode=p,"MASK"===p&&(i.alphaCutoff=a.alphaCutOff)),this.FuzzyEquals(r.baseColor,e.Color3.White(),this._epsilon)&&a.alpha>=this._epsilon||(n.baseColorFactor=[r.baseColor.r,r.baseColor.g,r.baseColor.b,a.alpha]),null!=r.metallic&&1!==r.metallic&&(n.metallicFactor=r.metallic),null!=r.roughness&&1!==r.roughness&&(n.roughnessFactor=r.roughness),null==a.backFaceCulling||a.backFaceCulling||(a.twoSidedLighting||e.Tools.Warn(a.name+": Back-face culling enabled and two-sided lighting disabled is not supported in glTF."),i.doubleSided=!0),h){if(a.bumpTexture){var g=t._ExportTextureAsync(a.bumpTexture,o,s,l,u,f,m).then((function(e){e&&(i.normalTexture=e,1!==a.bumpTexture.level&&(i.normalTexture.scale=a.bumpTexture.level))}));d.push(g)}if(a.ambientTexture){var g=t._ExportTextureAsync(a.ambientTexture,o,s,l,u,f,m).then((function(e){if(e){var t={index:e.index};i.occlusionTexture=t,a.ambientTextureStrength&&(t.strength=a.ambientTextureStrength)}}));d.push(g)}if(a.emissiveTexture){var g=t._ExportTextureAsync(a.emissiveTexture,o,s,l,u,f,m).then((function(e){e&&(i.emissiveTexture=e)}));d.push(g)}}this.FuzzyEquals(a.emissiveColor,e.Color3.Black(),this._epsilon)||(i.emissiveFactor=a.emissiveColor.asArray()),i.pbrMetallicRoughness=n,c.push(i)}return Promise.all(d).then((function(e){}))},t.GetPixelsFromTexture=function(t){return t.textureType,e.Engine.TEXTURETYPE_UNSIGNED_INT,t.readPixels()},t._ExportTextureAsync=function(r,a,i,n,o,s,l){for(var u=this,c=t._GetGLTFTextureSampler(r),f=null,h=null,d=0;d<o.length;++d){var p=o[d];if(p.minFilter===c.minFilter&&p.magFilter===c.magFilter&&p.wrapS===c.wrapS&&p.wrapT===c.wrapT){h=d;break}}null==h?(o.push(c),f=o.length-1):f=h;var m="texture_"+(n.length-1).toString(),g=r.getInternalTexture();null!=g&&(m=g.url||m),m=e.Tools.GetFilename(m);var T=m.split(".")[0],y="";if("image/jpeg"===a)y=".jpg";else{if("image/png"!==a)return Promise.reject("Unsupported mime type "+a);y=".png"}return m=T+y,this._SetAlphaToOneAsync(r,l).then((function(e){var o=t.GetPixelsFromTexture(e),l=r.getSize(),c=u._CreateBase64FromCanvas(o,l.width,l.height,a);return u._GetTextureInfoFromBase64(c,m,a,i,n,r.coordinatesIndex,f,s)}))},t._GetTextureInfoFromBase64=function(e,t,r,a,i,n,o,s){var l=null,u={source:a.length,name:t};null!=o&&(u.sampler=o);for(var c=atob(e.split(",")[1]),f=new ArrayBuffer(c.length),h=new Uint8Array(f),d=0,p=c.length;d<p;++d)h[d]=c.charCodeAt(d);var m={data:h,mimeType:r};if(s[t]=m,"image/jpeg"===r||"image/png"===r){for(var g={uri:t},T=null,d=0;d<a.length;++d)if(a[d].uri===t){T=d;break}null==T?(a.push(g),u.source=a.length-1):u.source=T,i.push(u),l={index:i.length-1},null!=n&&(l.texCoord=n)}return l},t._dielectricSpecular=new e.Color3(.04,.04,.04),t._maxSpecularPower=1024,t._epsilon=1e-6,t})();t._GLTFMaterial=r})(e.GLTF2||(e.GLTF2={}))})(e||(e={}));var e;!(function(e){!(function(t){var r;!(function(e){e[e.INTANGENT=0]="INTANGENT",e[e.OUTTANGENT=1]="OUTTANGENT"})(r||(r={}));var a=(function(){function a(){}return a._CreateNodeAnimation=function(t,r,i,n,o,s){var l=[],u=[],c=r.getKeys(),f=a.calculateMinMaxKeyFrames(c),h=a._DeduceInterpolation(c,i,o),d=f.max-f.min,p=h.interpolationType,m=h.shouldBakeAnimation;if(m?a._CreateBakedAnimation(t,r,i,f.min,f.max,r.framePerSecond,s,l,u,f,n,o):"LINEAR"===p||"STEP"===p?a._CreateLinearOrStepAnimation(t,r,i,d,l,u,n,o):"CUBICSPLINE"===p?a._CreateCubicSplineAnimation(t,r,i,d,l,u,n,o):a._CreateBakedAnimation(t,r,i,f.min,f.max,r.framePerSecond,s,l,u,f,n,o),l.length&&u.length){return{inputs:l,outputs:u,samplerInterpolation:p,inputsMin:m?f.min:e.Tools.FloatRound(f.min/r.framePerSecond),inputsMax:m?f.max:e.Tools.FloatRound(f.max/r.framePerSecond)}}return null},a._DeduceAnimationInfo=function(t){var r=null,a="VEC3",i=!1,n=t.targetProperty.split(".");switch(n[0]){case"scaling":r="scale";break;case"position":r="translation";break;case"rotation":a="VEC4",r="rotation";break;case"rotationQuaternion":a="VEC4",i=!0,r="rotation";break;default:e.Tools.Error("Unsupported animatable property "+n[0])}return r?{animationChannelTargetPath:r,dataAccessorType:a,useQuaternion:i}:(e.Tools.Error("animation channel target path and data accessor type could be deduced"),null)},a._CreateNodeAnimationFromTransformNodeAnimations=function(e,t,r,i,n,o,s,l,u,c){var f;if(e.animations)for(var h=0,d=e.animations;h<d.length;h++){var p=d[h],m=a._DeduceAnimationInfo(p);m&&(f={name:p.name,samplers:[],channels:[]},a.AddAnimation(""+p.name,p.hasRunningRuntimeAnimations?t:f,e,p,m.dataAccessorType,m.animationChannelTargetPath,i,o,s,l,u,m.useQuaternion,c),f.samplers.length&&f.channels.length&&r.push(f))}},a._CreateNodeAnimationFromAnimationGroups=function(t,r,i,n,o,s,l,u,c){var f;if(t.animationGroups)for(var h=t.animationGroups,d=0,p=h;d<p.length;d++){var m=p[d];f={name:m.name,channels:[],samplers:[]};for(var g=0,T=m.targetedAnimations;g<T.length;g++){var y=T[g],v=y.target,x=y.animation;if(v instanceof e.Mesh||1===v.length&&v[0]instanceof e.Mesh){var b=a._DeduceAnimationInfo(y.animation);if(b){var A=v instanceof e.Mesh?v:v[0];a.AddAnimation(""+x.name,f,A,x,b.dataAccessorType,b.animationChannelTargetPath,i,o,s,l,u,b.useQuaternion,c)}}}f.channels.length&&f.samplers.length&&r.push(f)}},a.AddAnimation=function(e,r,i,n,o,s,l,u,c,f,h,d,p){var m,g,T,y,v,x,b,A=a._CreateNodeAnimation(i,n,s,h,d,p);if(A){var F=l[i.uniqueId],_=4*A.inputs.length;m=t._GLTFUtilities.CreateBufferView(0,u.getByteOffset(),_,void 0,e+" keyframe data view"),c.push(m),A.inputs.forEach((function(e){u.setFloat32(e)})),g=t._GLTFUtilities.CreateAccessor(c.length-1,e+" keyframes","SCALAR",5126,A.inputs.length,null,[A.inputsMin],[A.inputsMax]),f.push(g),T=f.length-1,v=A.outputs.length,_="VEC3"===o?12*A.outputs.length:16*A.outputs.length,m=t._GLTFUtilities.CreateBufferView(0,u.getByteOffset(),_,void 0,e+" data view"),c.push(m),A.outputs.forEach((function(e){e.forEach((function(e){u.setFloat32(e)}))})),g=t._GLTFUtilities.CreateAccessor(c.length-1,e+" data",o,5126,v,null,null,null),f.push(g),y=f.length-1,x={interpolation:A.samplerInterpolation,input:T,output:y},r.samplers.push(x),b={sampler:r.samplers.length-1,target:{node:F,path:s}},r.channels.push(b)}},a._CreateBakedAnimation=function(t,r,i,n,o,s,l,u,c,f,h,d){var p,m,g=e.Quaternion.Identity(),T=null,y=null,v=null,x=null,b=null,A=null;f.min=e.Tools.FloatRound(n/s);for(var F=r.getKeys(),_=0,R=F.length;_<R;++_){if(A=null,v=F[_],_+1<R)if(x=F[_+1],v.value.equals(x.value)){if(0!==_)continue;A=v.frame}else A=x.frame;else{if(b=F[_-1],v.value.equals(b.value))continue;A=o}if(A)for(var C=v.frame;C<=A;C+=l)(m=e.Tools.FloatRound(C/s))!==T&&(T=m,y=m,p=r._interpolate(C,0,void 0,r.loopMode),a._SetInterpolatedValue(t,p,m,r,i,g,u,c,h,d))}y&&(f.max=y)},a._ConvertFactorToVector3OrQuaternion=function(t,r,i,n,o,s,l){var u,c,f=null,h=a._GetBasePositionRotationOrScale(r,o,s,l);if(n===e.Animation.ANIMATIONTYPE_FLOAT)switch(u=i.targetProperty.split("."),c=u?u[1]:"",f=l?e.Quaternion.FromArray(h).normalize():e.Vector3.FromArray(h),c){case"x":case"y":f[c]=s&&l&&"scale"!==o?-t:t;break;case"z":f[c]=s&&!l&&"scale"!==o?-t:t;break;case"w":f.w=t;break;default:e.Tools.Error('glTFAnimation: Unsupported component type "'+c+'" for scale animation!')}return f},a._SetInterpolatedValue=function(r,a,i,n,o,s,l,u,c,f){var h,d=n.dataType;l.push(i),"number"==typeof a&&(a=this._ConvertFactorToVector3OrQuaternion(a,r,n,d,o,c,f)),a&&("rotation"===o?(f?s=a:(h=a,e.Quaternion.RotationYawPitchRollToRef(h.y,h.x,h.z,s)),c&&(t._GLTFUtilities.GetRightHandedQuaternionFromRef(s),r.parent||(s=e.Quaternion.FromArray([0,1,0,0]).multiply(s))),u.push(s.asArray())):(h=a,c&&"scale"!==o&&(t._GLTFUtilities.GetRightHandedPositionVector3FromRef(h),r.parent||(h.x*=-1,h.z*=-1)),u.push(h.asArray())))},a._CreateLinearOrStepAnimation=function(e,t,r,i,n,o,s,l){for(var u=0,c=t.getKeys();u<c.length;u++){var f=c[u];n.push(f.frame/t.framePerSecond),a._AddKeyframeValue(f,t,o,r,e,s,l)}},a._CreateCubicSplineAnimation=function(e,t,i,n,o,s,l,u){t.getKeys().forEach((function(c){o.push(c.frame/t.framePerSecond),a.AddSplineTangent(e,r.INTANGENT,s,i,"CUBICSPLINE",c,n,u,l),a._AddKeyframeValue(c,t,s,i,e,l,u),a.AddSplineTangent(e,r.OUTTANGENT,s,i,"CUBICSPLINE",c,n,u,l)}))},a._GetBasePositionRotationOrScale=function(r,a,i,n){var o;return"rotation"===a?n?r.rotationQuaternion?(o=r.rotationQuaternion.asArray(),i&&(t._GLTFUtilities.GetRightHandedQuaternionArrayFromRef(o),r.parent||(o=e.Quaternion.FromArray([0,1,0,0]).multiply(e.Quaternion.FromArray(o)).asArray()))):o=e.Quaternion.Identity().asArray():(o=r.rotation.asArray(),t._GLTFUtilities.GetRightHandedNormalArray3FromRef(o)):"translation"===a?(o=r.position.asArray(),i&&t._GLTFUtilities.GetRightHandedPositionArray3FromRef(o)):o=r.scaling.asArray(),o},a._AddKeyframeValue=function(r,a,i,n,o,s,l){var u,c,f=a.dataType;if(f===e.Animation.ANIMATIONTYPE_VECTOR3){if(u=r.value.asArray(),"rotation"===n){var h=e.Vector3.FromArray(u),d=e.Quaternion.RotationYawPitchRoll(h.y,h.x,h.z);s&&(t._GLTFUtilities.GetRightHandedQuaternionFromRef(d),o.parent||(d=e.Quaternion.FromArray([0,1,0,0]).multiply(d))),u=d.asArray()}else"translation"===n&&s&&(t._GLTFUtilities.GetRightHandedNormalArray3FromRef(u),o.parent||(u[0]*=-1,u[2]*=-1));i.push(u)}else if(f===e.Animation.ANIMATIONTYPE_FLOAT){if(c=this._ConvertFactorToVector3OrQuaternion(r.value,o,a,f,n,s,l)){if("rotation"===n){var p=l?c:e.Quaternion.RotationYawPitchRoll(c.y,c.x,c.z).normalize();s&&(t._GLTFUtilities.GetRightHandedQuaternionFromRef(p),o.parent||(p=e.Quaternion.FromArray([0,1,0,0]).multiply(p))),i.push(p.asArray())}else"translation"===n&&s&&(t._GLTFUtilities.GetRightHandedNormalVector3FromRef(c),o.parent||(c.x*=-1,c.z*=-1));i.push(c.asArray())}}else f===e.Animation.ANIMATIONTYPE_QUATERNION?(u=r.value.normalize().asArray(),s&&(t._GLTFUtilities.GetRightHandedQuaternionArrayFromRef(u),o.parent||(u=e.Quaternion.FromArray([0,1,0,0]).multiply(e.Quaternion.FromArray(u)).asArray())),i.push(u)):e.Tools.Error("glTFAnimation: Unsupported key frame values for animation!")},a._DeduceInterpolation=function(t,r,a){var i,n,o=!1;if("rotation"===r&&!a)return{interpolationType:"LINEAR",shouldBakeAnimation:!0};for(var s=0,l=t.length;s<l;++s)if(n=t[s],n.inTangent||n.outTangent)if(i){if("CUBICSPLINE"!==i){i="LINEAR",o=!0;break}}else i="CUBICSPLINE";else if(i){if("CUBICSPLINE"===i||n.interpolation&&n.interpolation===e.AnimationKeyInterpolation.STEP&&"STEP"!==i){i="LINEAR",o=!0;break}}else i=n.interpolation&&n.interpolation===e.AnimationKeyInterpolation.STEP?"STEP":"LINEAR";return i||(i="LINEAR"),{interpolationType:i,shouldBakeAnimation:o}},a.AddSplineTangent=function(a,i,n,o,s,l,u,c,f){var h,d=i===r.INTANGENT?l.inTangent:l.outTangent;if("CUBICSPLINE"===s){if("rotation"===o)if(d){if(c)h=d.scale(u).asArray();else{var p=d.scale(u);h=e.Quaternion.RotationYawPitchRoll(p.y,p.x,p.z).asArray()}f&&(t._GLTFUtilities.GetRightHandedQuaternionArrayFromRef(h),a.parent||(h=e.Quaternion.FromArray([0,1,0,0]).multiply(e.Quaternion.FromArray(h)).asArray()))}else h=[0,0,0,0];else d?(h=d.scale(u).asArray(),f&&"translation"===o&&(t._GLTFUtilities.GetRightHandedPositionArray3FromRef(h),a.parent||(h[0]*=-1,h[2]*=-1))):h=[0,0,0];n.push(h)}},a.calculateMinMaxKeyFrames=function(e){var t=1/0,r=-1/0;return e.forEach((function(e){t=Math.min(t,e.frame),r=Math.max(r,e.frame)})),{min:t,max:r}},a})();t._GLTFAnimation=a})(e.GLTF2||(e.GLTF2={}))})(e||(e={}));var e;return (function(e){!(function(t){var r=(function(){function t(){}return t.CreateBufferView=function(e,t,r,a,i){var n={buffer:e,byteLength:r};return t&&(n.byteOffset=t),i&&(n.name=i),a&&(n.byteStride=a),n},t.CreateAccessor=function(e,t,r,a,i,n,o,s){var l={name:t,bufferView:e,componentType:a,count:i,type:r};return null!=o&&(l.min=o),null!=s&&(l.max=s),null!=n&&(l.byteOffset=n),l},t.CalculateMinMaxPositions=function(r,a,i,n){var o,s,l,u=[1/0,1/0,1/0],c=[-1/0,-1/0,-1/0];if(i)for(var f=a,h=a+i;f<h;++f){o=3*f,s=e.Vector3.FromArray(r,o),n&&t.GetRightHandedPositionVector3FromRef(s),l=s.asArray();for(var d=0;d<3;++d){var p=l[d];p<u[d]&&(u[d]=p),p>c[d]&&(c[d]=p),++o}}return{min:u,max:c}},t.GetRightHandedPositionVector3=function(t){return new e.Vector3(t.x,t.y,-t.z)},t.GetRightHandedPositionVector3FromRef=function(e){e.z*=-1},t.GetRightHandedPositionArray3FromRef=function(e){e[2]*=-1},t.GetRightHandedNormalVector3=function(t){return new e.Vector3(t.x,t.y,-t.z)},t.GetRightHandedNormalVector3FromRef=function(e){e.z*=-1},t.GetRightHandedNormalArray3FromRef=function(e){e[2]*=-1},t.GetRightHandedVector4FromRef=function(e){e.z*=-1,e.w*=-1},t.GetRightHandedArray4FromRef=function(e){e[2]*=-1,e[3]*=-1},t.GetRightHandedQuaternionFromRef=function(e){e.x*=-1,e.y*=-1},t.GetRightHandedQuaternionArrayFromRef=function(e){e[0]*=-1,e[1]*=-1},t})();t._GLTFUtilities=r})(e.GLTF2||(e.GLTF2={}))})(e||(e={})),e})); |
@@ -38,11 +38,2 @@ /// <reference types="babylonjs"/> | ||
/** | ||
* Exports the geometry of the scene to .gltf file format synchronously | ||
* @param scene Babylon scene with scene hierarchy information | ||
* @param filePrefix File prefix to use when generating the glTF file | ||
* @param options Exporter options | ||
* @returns Returns an object with a .gltf file and associates texture names | ||
* as keys and their data and paths as values | ||
*/ | ||
private static GLTF(scene, filePrefix, options?); | ||
/** | ||
* Exports the geometry of the scene to .gltf file format asynchronously | ||
@@ -57,10 +48,2 @@ * @param scene Babylon scene with scene hierarchy information | ||
/** | ||
* Exports the geometry of the scene to .glb file format synchronously | ||
* @param scene Babylon scene with scene hierarchy information | ||
* @param filePrefix File prefix to use when generating glb file | ||
* @param options Exporter options | ||
* @returns Returns an object with a .glb filename as key and data as value | ||
*/ | ||
private static GLB(scene, filePrefix, options?); | ||
/** | ||
* Exports the geometry of the scene to .glb file format asychronously | ||
@@ -159,2 +142,5 @@ * @param scene Babylon scene with scene hierarchy information | ||
private animationSampleRate; | ||
/** | ||
* Callback which specifies if a transform node should be exported or not | ||
*/ | ||
private shouldExportTransformNode; | ||
@@ -247,3 +233,3 @@ /** | ||
*/ | ||
_generateGLTF(glTFPrefix: string): GLTFData; | ||
_generateGLTFAsync(glTFPrefix: string): Promise<GLTFData>; | ||
/** | ||
@@ -253,3 +239,3 @@ * Creates a binary buffer for glTF | ||
*/ | ||
private generateBinary(); | ||
private _generateBinaryAsync(); | ||
/** | ||
@@ -267,3 +253,3 @@ * Pads the number to a multiple of 4 | ||
*/ | ||
_generateGLB(glTFPrefix: string): GLTFData; | ||
_generateGLBAsync(glTFPrefix: string): Promise<GLTFData>; | ||
/** | ||
@@ -314,6 +300,8 @@ * Sets the TRS for each node | ||
*/ | ||
private createScene(babylonScene, binaryWriter); | ||
private createSceneAsync(babylonScene, binaryWriter); | ||
/** | ||
* Creates a mapping of Node unique id to node index and handles animations | ||
* @param babylonScene Babylon Scene | ||
* @param nodes Babylon transform nodes | ||
* @param shouldExportTransformNode Callback specifying if a transform node should be exported | ||
* @param binaryWriter Buffer to write binary data to | ||
@@ -458,3 +446,3 @@ * @returns Node mapping of unique id to index | ||
*/ | ||
static _ConvertMaterialsToGLTF(babylonMaterials: Material[], mimeType: ImageMimeType, images: IImage[], textures: ITexture[], samplers: ISampler[], materials: IMaterial[], imageData: { | ||
static _ConvertMaterialsToGLTFAsync(babylonMaterials: Material[], mimeType: ImageMimeType, images: IImage[], textures: ITexture[], samplers: ISampler[], materials: IMaterial[], imageData: { | ||
[fileName: string]: { | ||
@@ -464,3 +452,3 @@ data: Uint8Array; | ||
}; | ||
}, hasTextureCoords: boolean): void; | ||
}, hasTextureCoords: boolean): Promise<void>; | ||
/** | ||
@@ -508,3 +496,3 @@ * Makes a copy of the glTF material without the texture parameters | ||
*/ | ||
static _ConvertStandardMaterial(babylonStandardMaterial: StandardMaterial, mimeType: ImageMimeType, images: IImage[], textures: ITexture[], samplers: ISampler[], materials: IMaterial[], imageData: { | ||
static _ConvertStandardMaterialAsync(babylonStandardMaterial: StandardMaterial, mimeType: ImageMimeType, images: IImage[], textures: ITexture[], samplers: ISampler[], materials: IMaterial[], imageData: { | ||
[fileName: string]: { | ||
@@ -514,4 +502,11 @@ data: Uint8Array; | ||
}; | ||
}, hasTextureCoords: boolean): void; | ||
}, hasTextureCoords: boolean): Promise<void>; | ||
/** | ||
* | ||
* @param texture Texture with alpha to overwrite to one | ||
* @param useAlpha Specifies if alpha should be preserved or not | ||
* @returns Promise with texture | ||
*/ | ||
static _SetAlphaToOneAsync(texture: BaseTexture, useAlpha: boolean): Promise<Texture>; | ||
/** | ||
* Converts a Babylon PBR Metallic Roughness Material to a glTF Material | ||
@@ -526,3 +521,3 @@ * @param babylonPBRMetalRoughMaterial BJS PBR Metallic Roughness Material | ||
*/ | ||
static _ConvertPBRMetallicRoughnessMaterial(babylonPBRMetalRoughMaterial: PBRMetallicRoughnessMaterial, mimeType: ImageMimeType, images: IImage[], textures: ITexture[], samplers: ISampler[], materials: IMaterial[], imageData: { | ||
static _ConvertPBRMetallicRoughnessMaterialAsync(babylonPBRMetalRoughMaterial: PBRMetallicRoughnessMaterial, mimeType: ImageMimeType, images: IImage[], textures: ITexture[], samplers: ISampler[], materials: IMaterial[], imageData: { | ||
[fileName: string]: { | ||
@@ -532,3 +527,3 @@ data: Uint8Array; | ||
}; | ||
}, hasTextureCoords: boolean): void; | ||
}, hasTextureCoords: boolean): Promise<void>; | ||
/** | ||
@@ -599,3 +594,3 @@ * Converts an image typed array buffer to a base64 image | ||
*/ | ||
private static _ConvertMetalRoughFactorsToMetallicRoughness(babylonPBRMaterial, mimeType, images, textures, samplers, glTFPbrMetallicRoughness, imageData, hasTextureCoords); | ||
private static _ConvertMetalRoughFactorsToMetallicRoughnessAsync(babylonPBRMaterial, mimeType, images, textures, samplers, glTFPbrMetallicRoughness, imageData, hasTextureCoords); | ||
private static _GetGLTFTextureSampler(texture); | ||
@@ -626,3 +621,3 @@ private static _GetGLTFTextureWrapMode(wrapMode); | ||
*/ | ||
static _ConvertPBRMaterial(babylonPBRMaterial: PBRMaterial, mimeType: ImageMimeType, images: IImage[], textures: ITexture[], samplers: ISampler[], materials: IMaterial[], imageData: { | ||
static _ConvertPBRMaterialAsync(babylonPBRMaterial: PBRMaterial, mimeType: ImageMimeType, images: IImage[], textures: ITexture[], samplers: ISampler[], materials: IMaterial[], imageData: { | ||
[fileName: string]: { | ||
@@ -632,3 +627,4 @@ data: Uint8Array; | ||
}; | ||
}, hasTextureCoords: boolean): void; | ||
}, hasTextureCoords: boolean): Promise<void>; | ||
private static SetMetallicRoughnessPbrMaterial(metallicRoughness, babylonPBRMaterial, glTFMaterial, glTFPbrMetallicRoughness, mimeType, images, textures, samplers, materials, imageData, hasTextureCoords); | ||
private static GetPixelsFromTexture(babylonTexture); | ||
@@ -644,3 +640,3 @@ /** | ||
*/ | ||
private static _ExportTexture(babylonTexture, mimeType, images, textures, samplers, imageData); | ||
private static _ExportTextureAsync(babylonTexture, mimeType, images, textures, samplers, imageData, useAlpha); | ||
/** | ||
@@ -647,0 +643,0 @@ * Builds a texture from base64 string |
@@ -7,3 +7,3 @@ { | ||
"description": "The Babylon.js serializers library is an extension you can use to serialize Babylon scenes.", | ||
"version": "3.3.0-alpha.1", | ||
"version": "3.3.0-alpha.2", | ||
"repository": { | ||
@@ -31,3 +31,3 @@ "type": "git", | ||
"dependencies": { | ||
"babylonjs-gltf2interface": "3.3.0-alpha.1" | ||
"babylonjs-gltf2interface": "3.3.0-alpha.2" | ||
}, | ||
@@ -34,0 +34,0 @@ "peerDependencies": { |
Sorry, the diff of this file is too big to display
293713
4372
+ Addedbabylonjs-gltf2interface@3.3.0-alpha.2(transitive)
- Removedbabylonjs-gltf2interface@3.3.0-alpha.1(transitive)