Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@gltf-transform/core

Package Overview
Dependencies
Maintainers
1
Versions
208
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gltf-transform/core - npm Package Compare versions

Comparing version 0.2.3 to 0.2.4

dist/core.modern.js

2

dist/core.umd.js

@@ -1,2 +0,2 @@

!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("gl-matrix/mat4"),require("gl-matrix")):"function"==typeof define&&define.amd?define(["exports","gl-matrix/mat4","gl-matrix"],n):n(t.core={},t.mat4,t.glMatrix)}(this,function(t,n,r){function i(t,n,r,i){var e,u=arguments.length,s=u<3?n:null===i?i=Object.getOwnPropertyDescriptor(n,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,n,r,i);else for(var o=t.length-1;o>=0;o--)(e=t[o])&&(s=(u<3?e(s):u>3?e(n,r,s):e(n,r))||s);return u>3&&s&&Object.defineProperty(n,r,s),s}var e=function(t,n,r){this.name=t,this.parent=n,this.child=r,this.disposed=!1,this.listeners=[]};e.prototype.getName=function(){return this.name},e.prototype.getParent=function(){return this.parent},e.prototype.getChild=function(){return this.child},e.prototype.setChild=function(t){return this.child=t,this},e.prototype.dispose=function(){this.disposed||(this.disposed=!0,this.listeners.forEach(function(t){return t()}),this.listeners.length=0)},e.prototype.onDispose=function(t){return this.listeners.push(t),this},e.prototype.isDisposed=function(){return this.disposed};var u=function(){this.links=[]};function s(t,n){Object.defineProperty(t,n,{get:function(){return this["_"+n]},set:function(t){var r=this,i=this["_"+n];i&&!Array.isArray(i)&&i.dispose(),t&&!Array.isArray(t)&&t.onDispose(function(){r["_"+n]=null}),this["_"+n]=t},enumerable:!0})}function o(t,n){}u.prototype.getLinks=function(){return this.links},u.prototype.listParents=function(t){return this.links.filter(function(n){return n.getChild()===t}).map(function(t){return t.getParent()})},u.prototype.listChildren=function(t){return this.links.filter(function(n){return n.getParent()===t}).map(function(t){return t.getChild()})},u.prototype.disconnectChildren=function(t){return this.links.filter(function(n){return n.getParent()===t}).forEach(function(t){return t.dispose()}),this},u.prototype.disconnectParents=function(t,n){var r=this.links.filter(function(n){return n.getChild()===t});return n&&(r=r.filter(function(t){return n(t.getParent())})),r.forEach(function(t){return t.dispose()}),this},u.prototype.link=function(t,n,r){if(!r)return null;var i=new e(t,n,r);return this.registerLink(i),i},u.prototype.registerLink=function(t){var n=this;return this.links.push(t),t.onDispose(function(){return n.unlink(t)}),t},u.prototype.unlink=function(t){return this.links=this.links.filter(function(n){return n!==t}),this};var h=function(t){this.disposed=!1,this.graph=t};h.prototype.isDisposed=function(){return this.disposed},h.prototype.dispose=function(){this.graph.disconnectChildren(this),this.graph.disconnectParents(this),this.disposed=!0},h.prototype.detach=function(){return this.graph.disconnectParents(this),this},h.prototype.swap=function(t,n){var r=this;return this.graph.getLinks().filter(function(n){return n.getParent()===r&&n.getChild()===t}).forEach(function(t){return t.setChild(n)}),this},h.prototype.addGraphChild=function(t,n){return t.push(n),n.onDispose(function(){var r=t.filter(function(t){return t!==n});t.length=0,t.push.apply(t,r)}),this},h.prototype.removeGraphChild=function(t,n){return t.filter(function(t){return t.getChild()===n}).forEach(function(t){return t.dispose()}),this},h.prototype.listGraphParents=function(){return this.graph.listParents(this)};var f="v0.2",c="__glb.bin",a=function(t){function n(){t.call(this,"@gltf-transform/core: Not implemented.")}return t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n,n}(Error),v=function(t){function n(n,r){void 0===r&&(r=""),t.call(this,n),this.name="",this.extras={},this.extensions={},this.name=r}return t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n,n.prototype.getName=function(){return this.name},n.prototype.setName=function(t){return this.name=t,this},n.prototype.getExtras=function(){return this.extras},n.prototype.setExtras=function(t){return this.extras=t,this},n.prototype.getExtensions=function(){return this.extensions},n.prototype.setExtensions=function(t){return this.extensions=t,this},n.prototype.clone=function(){throw new a},n.prototype.detach=function(){return this.graph.disconnectParents(this,function(t){return"Root"!==t.propertyType}),this},n.prototype.listParents=function(){return this.listGraphParents()},n}(h),l=function(t){function n(){t.apply(this,arguments),this.propertyType="Accessor",this.array=null,this.type="SCALAR",this.componentType=null,this.normalized=!1,this.in=d,this.out=d,this.buffer=null}return t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n,n.getElementSize=function(t){switch(t){case"SCALAR":return 1;case"VEC2":return 2;case"VEC3":return 3;case"VEC4":case"MAT2":return 4;case"MAT3":return 9;case"MAT4":return 16;default:throw new Error("Unexpected type: "+t)}},n.getComponentSize=function(t){switch(t){case 5120:case 5121:return 1;case 5122:case 5123:return 2;case 5125:case 5126:return 4;default:throw new Error("Unexpected component type: "+t)}},n.prototype.getMin=function(t){for(var n=this.getCount(),r=this.getElementSize(),i=0;i<r;i++)t[i]=Infinity;for(var e=0;e<n*r;e+=r)for(var u=0;u<r;u++)t[u]=Math.min(t[u],this.array[e+u]);for(var s=0;s<r;s++)t[s]=this.out(t[s]);return t},n.prototype.getMax=function(t){for(var n=this.getCount(),r=this.getElementSize(),i=0;i<r;i++)t[i]=-Infinity;for(var e=0;e<n*r;e+=r)for(var u=0;u<r;u++)t[u]=Math.max(t[u],this.array[e+u]);for(var s=0;s<r;s++)t[s]=this.out(t[s]);return t},n.prototype.getCount=function(){return this.array.length/this.getElementSize()},n.prototype.getType=function(){return this.type},n.prototype.setType=function(t){return this.type=t,this},n.prototype.getElementSize=function(){return n.getElementSize(this.type)},n.prototype.getComponentSize=function(){return this.array.BYTES_PER_ELEMENT},n.prototype.getComponentType=function(){return this.componentType},n.prototype.getNormalized=function(){return this.normalized},n.prototype.setNormalized=function(t){var n=this;return this.normalized=t,t?(this.out=function(t){return function(t,r){switch(n.componentType){case 5126:return t;case 5123:return t/65535;case 5121:return t/255;case 5122:return Math.max(t/32767,-1);case 5120:return Math.max(t/127,-1)}}(t)},this.in=function(t){return function(t,r){switch(n.componentType){case 5126:return t;case 5123:return Math.round(65535*t);case 5121:return Math.round(255*t);case 5122:return Math.round(32767*t);case 5120:return Math.round(127*t)}}(t)}):(this.out=d,this.in=d),this},n.prototype.getScalar=function(t){var n=this.getElementSize();return this.out(this.array[t*n])},n.prototype.setScalar=function(t,n){return this.array[t*this.getElementSize()]=this.in(n),this},n.prototype.getElement=function(t,n){for(var r=this.getElementSize(),i=0;i<r;i++)n[i]=this.out(this.array[t*r+i]);return n},n.prototype.setElement=function(t,n){for(var r=this.getElementSize(),i=0;i<r;i++)this.array[t*r+i]=this.in(n[i]);return this},n.prototype.getBuffer=function(){return this.buffer.getChild()},n.prototype.setBuffer=function(t){return this.buffer=this.graph.link("buffer",this,t),this},n.prototype.getArray=function(){return this.array},n.prototype.setArray=function(t){return this.componentType=function(t){switch(t.constructor){case Float32Array:return 5126;case Uint32Array:return 5125;case Uint16Array:return 5123;case Uint8Array:return 5121;case Int16Array:return 5122;case Int8Array:return 5120;default:throw new Error("Unknown accessor componentType.")}}(t),this.array=t,this},n.prototype.getByteLength=function(){return this.array.byteLength},n}(v);function d(t){return t}l.Type={SCALAR:"SCALAR",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT3:"MAT3",MAT4:"MAT4"},l.ComponentType={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125,FLOAT:5126},i([s],l.prototype,"buffer",void 0);var w=function(t){function n(){t.apply(this,arguments),this.propertyType="Buffer"}return t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n,n.prototype.getURI=function(){return this.uri},n.prototype.setURI=function(t){return this.uri=t,this},n}(v),b=function(){};b.createBufferFromDataURI=function(t){if("undefined"==typeof Buffer){for(var n=atob(t.split(",")[1]),r=new Uint8Array(n.length),i=0;i<n.length;i++)r[i]=n.charCodeAt(i);return r.buffer}var e=t.split(",")[1],u=t.indexOf("base64")>=0;return this.trim(Buffer.from(e,u?"base64":"utf8"))},b.encodeText=function(t){return"undefined"!=typeof TextEncoder?(new TextEncoder).encode(t).buffer:this.trim(Buffer.from(t))},b.decodeText=function(t){return"undefined"!=typeof TextDecoder?(new TextDecoder).decode(t):Buffer.from(t).toString("utf8")},b.trim=function(t){var n=t.byteOffset;return t.buffer.slice(n,n+t.byteLength)},b.concat=function(t){for(var n=0,r=0,i=t;r<i.length;r+=1)n+=i[r].byteLength;for(var e=new Uint8Array(n),u=0,s=0,o=t;s<o.length;s+=1){var h=o[s];e.set(new Uint8Array(h),u),u+=h.byteLength}return e.buffer},b.pad=function(t,n){void 0===n&&(n=0);var r=this.padNumber(t.byteLength);if(r!==t.byteLength){var i=new Uint8Array(r);if(i.set(new Uint8Array(t)),0!==n)for(var e=t.byteLength;e<r;e++)i[e]=n;return i.buffer}return t},b.padNumber=function(t){return 4*Math.ceil(t/4)},b.equals=function(t,n){if(t===n)return!0;if(t.byteLength!==n.byteLength)return!1;for(var r=new DataView(t),i=new DataView(n),e=t.byteLength;e--;)if(r.getUint8(e)!==i.getUint8(e))return!1;return!0};var A=function(){};A.basename=function(t){return t.split(/[\\\/]/).pop().split(/[.]/).shift()},A.extension=function(t){return 0!==t.indexOf("data:")?t.split(/[\\\/]/).pop().split(/[.]/).pop():0===t.indexOf("data:image/png")?"png":0===t.indexOf("data:image/jpeg")?"jpeg":"bin"};var p=function(){};function y(t,n){if(n>t.length)throw new TypeError("Corrupt JPG, exceeded buffer limits");if(255!==t[n])throw new TypeError("Invalid JPG, marker table corrupted")}p.getSizeJPEG=function(t){var n,r;for(t=t.slice(4);t.length;){if(n=t.readUInt16BE(0),y(t,n),192===(r=t[n+1])||193===r||194===r)return[t.readUInt16BE(n+7),t.readUInt16BE(n+5)];t=t.slice(n+2)}throw new TypeError("Invalid JPG, no size found")},p.getSizePNG=function(t){return"CgBI"===t.toString("ascii",12,16)?[t.readUInt32BE(32),t.readUInt32BE(36)]:[t.readUInt32BE(16),t.readUInt32BE(20)]};var E=function(t){this.verbosity=t};E.prototype.debug=function(t){this.verbosity<=E.Verbosity.DEBUG&&console.debug(t)},E.prototype.info=function(t){this.verbosity<=E.Verbosity.INFO&&console.info(t)},E.prototype.warn=function(t){this.verbosity<=E.Verbosity.WARN&&console.warn(t)},E.prototype.error=function(t){this.verbosity<=E.Verbosity.ERROR&&console.error(t)},E.Verbosity={SILENT:4,ERROR:3,WARN:2,INFO:1,DEBUG:0};var m="23456789abdegjkmnpqrvwxyzABDEGJKMNPQRVWXYZ",T=new Set,g=function(){for(var t="",n=0;n<6;n++)t+=m.charAt(Math.floor(Math.random()*m.length));return t},O=function(){for(var t=0;t<999;t++){var n=g();if(!T.has(n))return n}return""},M=function(t){function n(){t.apply(this,arguments),this.propertyType="Texture",this.image=null,this.mimeType="",this.uri=""}return t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n,n.prototype.getMimeType=function(){return this.mimeType},n.prototype.setMimeType=function(t){return this.mimeType=t,this},n.prototype.getURI=function(){return this.uri},n.prototype.setURI=function(t){return this.uri=t,this},n.prototype.getImage=function(){return this.image},n.prototype.setImage=function(t){return this.image=t,this},n.prototype.getSize=function(){return(this.mimeType?"image/png"===this.mimeType:this.uri.match(/\.png$/))?p.getSizePNG(Buffer.from(this.image)):p.getSizeJPEG(Buffer.from(this.image))},n}(v),R=function(){this.propertyType="TextureInfo",this.texCoord=0};R.prototype.getTexCoord=function(){return this.texCoord},R.prototype.setTexCoord=function(t){return this.texCoord=t,this};var x=function(){this.propertyType="TextureSampler",this.magFilter=null,this.minFilter=null,this.wrapS=10497,this.wrapT=10497};x.prototype.getMagFilter=function(){return this.magFilter},x.prototype.setMagFilter=function(t){return this.magFilter=t,this},x.prototype.getMinFilter=function(){return this.minFilter},x.prototype.setMinFilter=function(t){return this.minFilter=t,this},x.prototype.getWrapS=function(){return this.wrapS},x.prototype.setWrapS=function(t){return this.wrapS=t,this},x.prototype.getWrapT=function(){return this.wrapT},x.prototype.setWrapT=function(t){return this.wrapT=t,this},x.TextureWrapMode={CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497},x.TextureMagFilter={NEAREST:9728,LINEAR:9729},x.TextureMinFilter={NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987};var j=function(t){function n(){t.apply(this,arguments),this.textureInfo=new R,this.sampler=new x}return t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n,n}(e),U=function(t){function n(){t.apply(this,arguments),this.semantic=""}return t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n,n}(e),_=function(t){function n(){t.apply(this,arguments)}return t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n,n}(e),N=function(t){function n(){t.apply(this,arguments)}return t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n,n.prototype.linkTexture=function(t,n,r){var i=new j(t,n,r);return this.registerLink(i),i},n.prototype.linkAttribute=function(t,n,r){var i=new U(t,n,r);return this.registerLink(i),i},n.prototype.linkIndex=function(t,n,r){var i=new _(t,n,r);return this.registerLink(i),i},n}(u),S=function(t){function n(){t.apply(this,arguments),this.propertyType="Material",this.t="OPAQUE",this.i=.5,this.u=!1,this.s=[1,1,1,1],this.o=[0,0,0],this.h=1,this.v=1,this.l=1,this.A=1,this.baseColorTexture=null,this.emissiveTexture=null,this.normalTexture=null,this.occlusionTexture=null,this.metallicRoughnessTexture=null}return t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n,n.prototype.getDoubleSided=function(){return this.u},n.prototype.setDoubleSided=function(t){return this.u=t,this},n.prototype.getAlphaMode=function(){return this.t},n.prototype.setAlphaMode=function(t){return this.t=t,this},n.prototype.getAlphaCutoff=function(){return this.i},n.prototype.setAlphaCutoff=function(t){return this.i=t,this},n.prototype.getBaseColorFactor=function(){return this.s},n.prototype.setBaseColorFactor=function(t){return this.s=t,this},n.prototype.getBaseColorTexture=function(){return this.baseColorTexture?this.baseColorTexture.getChild():null},n.prototype.getBaseColorTextureInfo=function(){return this.baseColorTexture?this.baseColorTexture.textureInfo:null},n.prototype.getBaseColorTextureSampler=function(){return this.baseColorTexture?this.baseColorTexture.sampler:null},n.prototype.setBaseColorTexture=function(t){return this.baseColorTexture=this.graph.linkTexture("baseColorTexture",this,t),this},n.prototype.getEmissiveFactor=function(){return this.o},n.prototype.setEmissiveFactor=function(t){return this.o=t,this},n.prototype.getEmissiveTexture=function(){return this.emissiveTexture?this.emissiveTexture.getChild():null},n.prototype.getEmissiveTextureInfo=function(){return this.emissiveTexture?this.emissiveTexture.textureInfo:null},n.prototype.getEmissiveTextureSampler=function(){return this.emissiveTexture?this.emissiveTexture.sampler:null},n.prototype.setEmissiveTexture=function(t){return this.emissiveTexture=this.graph.linkTexture("emissiveTexture",this,t),this},n.prototype.getNormalScale=function(){return this.h},n.prototype.setNormalScale=function(t){return this.h=t,this},n.prototype.getNormalTexture=function(){return this.normalTexture?this.normalTexture.getChild():null},n.prototype.getNormalTextureInfo=function(){return this.normalTexture?this.normalTexture.textureInfo:null},n.prototype.getNormalTextureSampler=function(){return this.normalTexture?this.normalTexture.sampler:null},n.prototype.setNormalTexture=function(t){return this.normalTexture=this.graph.linkTexture("normalTexture",this,t),this},n.prototype.getOcclusionStrength=function(){return this.v},n.prototype.setOcclusionStrength=function(t){return this.v=t,this},n.prototype.getOcclusionTexture=function(){return this.occlusionTexture?this.occlusionTexture.getChild():null},n.prototype.getOcclusionTextureInfo=function(){return this.occlusionTexture?this.occlusionTexture.textureInfo:null},n.prototype.getOcclusionTextureSampler=function(){return this.occlusionTexture?this.occlusionTexture.sampler:null},n.prototype.setOcclusionTexture=function(t){return this.occlusionTexture=this.graph.linkTexture("occlusionTexture",this,t),this},n.prototype.getRoughnessFactor=function(){return this.l},n.prototype.setRoughnessFactor=function(t){return this.l=t,this},n.prototype.getMetallicFactor=function(){return this.A},n.prototype.setMetallicFactor=function(t){return this.A=t,this},n.prototype.getMetallicRoughnessTexture=function(){return this.metallicRoughnessTexture?this.metallicRoughnessTexture.getChild():null},n.prototype.getMetallicRoughnessTextureInfo=function(){return this.metallicRoughnessTexture?this.metallicRoughnessTexture.textureInfo:null},n.prototype.getMetallicRoughnessTextureSampler=function(){return this.metallicRoughnessTexture?this.metallicRoughnessTexture.sampler:null},n.prototype.setMetallicRoughnessTexture=function(t){return this.metallicRoughnessTexture=this.graph.linkTexture("metallicRoughnessTexture",this,t),this},n}(v);i([s],S.prototype,"baseColorTexture",void 0),i([s],S.prototype,"emissiveTexture",void 0),i([s],S.prototype,"normalTexture",void 0),i([s],S.prototype,"occlusionTexture",void 0),i([s],S.prototype,"metallicRoughnessTexture",void 0);var I=function(t){function n(){t.apply(this,arguments),this.propertyType="Mesh",this.p=[]}return t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n,n.prototype.addPrimitive=function(t){return this.addGraphChild(this.p,this.graph.link("primitive",this,t))},n.prototype.removePrimitive=function(t){return this.removeGraphChild(this.p,t)},n.prototype.listPrimitives=function(){return this.p.map(function(t){return t.getChild()})},n}(v);i([o],I.prototype,"_primitives",void 0);var L=function(t){function n(){t.apply(this,arguments),this.propertyType="Primitive",this.m=4,this.T=null,this.g=[],this.O=null}return t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n,n.prototype.getIndices=function(){return this.T?this.T.getChild():null},n.prototype.setIndices=function(t){return this.T=this.graph.linkIndex("index",this,t),this},n.prototype.getAttribute=function(t){var n=this.g.find(function(n){return n.semantic===t});return n?n.getChild():null},n.prototype.setAttribute=function(t,n){var r=this.graph.linkAttribute(t.toLowerCase(),this,n);return r.semantic=t,this.addGraphChild(this.g,r)},n.prototype.listAttributes=function(){return this.g.map(function(t){return t.getChild()})},n.prototype.listSemantics=function(){return this.g.map(function(t){return t.semantic})},n.prototype.listTargets=function(){throw new a},n.prototype.listTargetNames=function(){throw new a},n.prototype.getMaterial=function(){return this.O?this.O.getChild():null},n.prototype.setMaterial=function(t){return this.O=this.graph.link("material",this,t),this},n.prototype.getMode=function(){return this.m},n.prototype.setMode=function(t){return this.m=t,this},n}(v);i([s],L.prototype,"_indices",void 0),i([o],L.prototype,"_attributes",void 0),i([s],L.prototype,"_material",void 0);var B=function(t){function n(){t.apply(this,arguments),this.propertyType="Node",this.translation=[0,0,0],this.rotation=[0,0,0,1],this.scale=[1,1,1],this.mesh=null,this.children=[]}return t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n,n.prototype.getTranslation=function(){return this.translation},n.prototype.getRotation=function(){return this.rotation},n.prototype.getScale=function(){return this.scale},n.prototype.setTranslation=function(t){return this.translation=t,this},n.prototype.setRotation=function(t){return this.rotation=t,this},n.prototype.setScale=function(t){return this.scale=t,this},n.prototype.addChild=function(t){var n=this.graph.link("child",this,t);return this.addGraphChild(this.children,n)},n.prototype.removeChild=function(t){return this.removeGraphChild(this.children,t)},n.prototype.listChildren=function(){return this.children.map(function(t){return t.getChild()})},n.prototype.getMesh=function(){return this.mesh?this.mesh.getChild():null},n.prototype.setMesh=function(t){return this.mesh=this.graph.link("mesh",this,t),this},n}(v);i([s],B.prototype,"mesh",void 0),i([o],B.prototype,"children",void 0);var C=function(t){function n(){t.apply(this,arguments),this.propertyType="Root",this.asset={generator:"glTF-Transform "+f,version:"2.0"},this.scenes=[],this.nodes=[],this.meshes=[],this.materials=[],this.textures=[],this.accessors=[],this.buffers=[]}return t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n,n.prototype.getAsset=function(){return this.asset},n.prototype.addScene=function(t){return this.addGraphChild(this.scenes,this.graph.link("scene",this,t))},n.prototype.removeScene=function(t){return this.removeGraphChild(this.scenes,t)},n.prototype.listScenes=function(){return this.scenes.map(function(t){return t.getChild()})},n.prototype.addNode=function(t){return this.addGraphChild(this.nodes,this.graph.link("node",this,t))},n.prototype.removeNode=function(t){return this.removeGraphChild(this.nodes,t)},n.prototype.listNodes=function(){return this.nodes.map(function(t){return t.getChild()})},n.prototype.addMesh=function(t){return this.addGraphChild(this.meshes,this.graph.link("mesh",this,t))},n.prototype.removeMesh=function(t){return this.removeGraphChild(this.meshes,t)},n.prototype.listMeshes=function(){return this.meshes.map(function(t){return t.getChild()})},n.prototype.addMaterial=function(t){return this.addGraphChild(this.materials,this.graph.link("material",this,t))},n.prototype.removeMaterial=function(t){return this.removeGraphChild(this.materials,t)},n.prototype.listMaterials=function(){return this.materials.map(function(t){return t.getChild()})},n.prototype.addTexture=function(t){return this.addGraphChild(this.textures,this.graph.link("texture",this,t))},n.prototype.removeTexture=function(t){return this.removeGraphChild(this.textures,t)},n.prototype.listTextures=function(){return this.textures.map(function(t){return t.getChild()})},n.prototype.addAccessor=function(t){return this.addGraphChild(this.accessors,this.graph.link("accessor",this,t))},n.prototype.removeAccessor=function(t){return this.removeGraphChild(this.accessors,t)},n.prototype.listAccessors=function(){return this.accessors.map(function(t){return t.getChild()})},n.prototype.addBuffer=function(t){return this.addGraphChild(this.buffers,this.graph.link("buffer",this,t))},n.prototype.removeBuffer=function(t){return this.removeGraphChild(this.buffers,t)},n.prototype.listBuffers=function(){return this.buffers.map(function(t){return t.getChild()})},n}(v);i([o],C.prototype,"scenes",void 0),i([o],C.prototype,"nodes",void 0),i([o],C.prototype,"meshes",void 0),i([o],C.prototype,"materials",void 0),i([o],C.prototype,"textures",void 0),i([o],C.prototype,"accessors",void 0),i([o],C.prototype,"buffers",void 0);var P=function(t){function n(){t.apply(this,arguments),this.propertyType="Scene",this.nodes=[]}return t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n,n.prototype.addNode=function(t){return this.addGraphChild(this.nodes,this.graph.link("node",this,t))},n.prototype.removeNode=function(t){return this.removeGraphChild(this.nodes,t)},n.prototype.listNodes=function(){return this.nodes.map(function(t){return t.getChild()})},n}(v);i([o],P.prototype,"nodes",void 0);var k=function(){this.graph=new N,this.root=new C(this.graph),this.logger=new E(E.Verbosity.INFO)};k.prototype.getRoot=function(){return this.root},k.prototype.getGraph=function(){return this.graph},k.prototype.getLogger=function(){return this.logger},k.prototype.setLogger=function(t){return this.logger=t,this},k.prototype.clone=function(){throw new Error("Not implemented.")},k.prototype.transform=function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];for(var r=0,i=t;r<i.length;r+=1)(0,i[r])(this);return this},k.prototype.createScene=function(t){var n=new P(this.graph,t);return this.root.addScene(n),n},k.prototype.createNode=function(t){var n=new B(this.graph,t);return this.root.addNode(n),n},k.prototype.createMesh=function(t){var n=new I(this.graph,t);return this.root.addMesh(n),n},k.prototype.createPrimitive=function(){return new L(this.graph)},k.prototype.createMaterial=function(t){var n=new S(this.graph,t);return this.root.addMaterial(n),n},k.prototype.createTexture=function(t){var n=new M(this.graph,t);return this.root.addTexture(n),n},k.prototype.createAccessor=function(t,n){void 0===n&&(n=null),n||(n=this.getRoot().listBuffers()[0]);var r=new l(this.graph,t).setBuffer(n);return this.root.addAccessor(r),r},k.prototype.createBuffer=function(t){var n=new w(this.graph,t);return this.root.addBuffer(n),n};var F={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},V=function(){};function D(t,n){void 0!==n.texCoord&&t.setTexCoord(n.texCoord)}function G(t,n,r){var i=r.json.textures[n.index];if(void 0!==i.sampler){var e=r.json.samplers[i.sampler];void 0!==e.magFilter&&t.setMagFilter(e.magFilter),void 0!==e.minFilter&&t.setMinFilter(e.minFilter),void 0!==e.wrapS&&t.setWrapS(e.wrapS),void 0!==e.wrapT&&t.setWrapT(e.wrapT)}}function J(t,n){var r=n.json.bufferViews[t.bufferView],i=n.json.buffers[r.buffer],e=i.uri?n.resources[i.uri]:n.resources[c],u=F[t.componentType],s=l.getElementSize(t.type);if(void 0!==r.byteStride&&r.byteStride!==s*u.BYTES_PER_ELEMENT)return function(t,n){for(var r=n.json.bufferViews[t.bufferView],i=n.json.buffers[r.buffer],e=i.uri?n.resources[i.uri]:n.resources[c],u=F[t.componentType],s=l.getElementSize(t.type),o=u.BYTES_PER_ELEMENT,h=t.byteOffset||0,f=new u(t.count*s),a=new DataView(e,r.byteOffset,r.byteLength),v=r.byteStride,d=0;d<t.count;d++)for(var w=0;w<s;w++){var b=h+d*v+w*o,A=void 0;switch(t.componentType){case 5126:A=a.getFloat32(b,!0);break;case 5125:A=a.getUint32(b,!0);break;case 5123:A=a.getUint16(b,!0);break;case 5121:A=a.getUint8(b);break;case 5122:A=a.getInt16(b,!0);break;case 5120:A=a.getInt8(b);break;default:throw new Error('Unexpected componentType "'+t.componentType+'".')}f[d*s+w]=A}return f}(t,n);var o=(r.byteOffset||0)+(t.byteOffset||0);switch(t.componentType){case 5126:return new Float32Array(e,o,t.count*s);case 5125:return new Uint32Array(e,o,t.count*s);case 5123:return new Uint16Array(e,o,t.count*s);case 5121:return new Uint8Array(e,o,t.count*s);case 5122:return new Int16Array(e,o,t.count*s);case 5120:return new Int8Array(e,o,t.count*s);default:throw new Error('Unexpected componentType "'+t.componentType+'".')}}V.read=function(t){var r=t.json,i=new k;if("2.0"!==r.asset.version)throw new Error('Unsupported glTF version: "'+r.asset.version+'".');var e=(r.buffers||[]).map(function(t){var n=i.createBuffer(t.name);return t.uri&&0!==t.uri.indexOf("__")&&n.setURI(t.uri),n}),u=(r.bufferViews||[]).map(function(t){return e[t.buffer]}),s=(r.accessors||[]).map(function(n){var r,e=i.createAccessor(n.name,u[n.bufferView]);return e.setType(n.type),r=void 0!==n.sparse?function(t,n){var r,i=F[t.componentType],e=l.getElementSize(t.type);r=void 0!==t.bufferView?J(t,n).slice():new i(t.count*e);for(var u=t.sparse.count,s=Object.assign({},t,t.sparse.indices,{count:u,type:"SCALAR"}),o=Object.assign({},t,t.sparse.values,{count:u}),h=J(s,n),f=J(o,n),c=0;c<s.count;c++)for(var a=0;a<e;a++)r[h[c]*e+a]=f[c*e+a];return r}(n,t):J(n,t).slice(),void 0!==n.normalized&&e.setNormalized(n.normalized),e.setArray(r),e}),o=r.textures||[],h=(r.images||[]).map(function(n){var e=i.createTexture(n.name);if(void 0!==n.bufferView){var u=r.bufferViews[n.bufferView],s=t.json.buffers[u.buffer],o=u.byteOffset||0,h=(s.uri?t.resources[s.uri]:t.resources[c]).slice(o,o+u.byteLength);e.setImage(h)}else void 0!==n.uri&&(e.setImage(t.resources[n.uri]),0!==n.uri.indexOf("__")&&e.setURI(n.uri));if(void 0!==n.mimeType)e.setMimeType(n.mimeType);else if(n.uri){var f=A.extension(n.uri);e.setMimeType("png"===f?"image/png":"image/jpeg")}return e}),f=(r.materials||[]).map(function(n){var r=i.createMaterial(n.name);void 0!==n.alphaMode&&r.setAlphaMode(n.alphaMode),void 0!==n.alphaCutoff&&r.setAlphaCutoff(n.alphaCutoff),void 0!==n.doubleSided&&r.setDoubleSided(n.doubleSided);var e=n.pbrMetallicRoughness||{};if(void 0!==e.baseColorFactor&&r.setBaseColorFactor(e.baseColorFactor),void 0!==n.emissiveFactor&&r.setEmissiveFactor(n.emissiveFactor),void 0!==e.metallicFactor&&r.setMetallicFactor(e.metallicFactor),void 0!==e.roughnessFactor&&r.setRoughnessFactor(e.roughnessFactor),void 0!==e.baseColorTexture){var u=e.baseColorTexture;r.setBaseColorTexture(h[o[u.index].source]),D(r.getBaseColorTextureInfo(),u),G(r.getBaseColorTextureSampler(),u,t)}if(void 0!==n.emissiveTexture){var s=n.emissiveTexture;r.setEmissiveTexture(h[o[s.index].source]),D(r.getEmissiveTextureInfo(),s),G(r.getEmissiveTextureSampler(),s,t)}if(void 0!==n.normalTexture){var f=n.normalTexture;r.setNormalTexture(h[o[f.index].source]),D(r.getNormalTextureInfo(),f),G(r.getNormalTextureSampler(),f,t),void 0!==n.normalTexture.scale&&r.setNormalScale(n.normalTexture.scale)}if(void 0!==n.occlusionTexture){var c=n.occlusionTexture;r.setOcclusionTexture(h[o[c.index].source]),D(r.getOcclusionTextureInfo(),c),G(r.getOcclusionTextureSampler(),c,t),void 0!==n.occlusionTexture.strength&&r.setOcclusionStrength(n.occlusionTexture.strength)}if(void 0!==e.metallicRoughnessTexture){var a=e.metallicRoughnessTexture;r.setMetallicRoughnessTexture(h[o[a.index].source]),D(r.getMetallicRoughnessTextureInfo(),a),G(r.getMetallicRoughnessTextureSampler(),a,t)}return r}),a=(r.meshes||[]).map(function(t){var n=i.createMesh(t.name);return t.primitives.forEach(function(t){var r=i.createPrimitive();void 0!==t.material&&r.setMaterial(f[t.material]),void 0!==t.mode&&r.setMode(t.mode);for(var e=0,u=Object.entries(t.attributes||{});e<u.length;e+=1){var o=u[e];r.setAttribute(o[0],s[o[1]])}void 0!==t.indices&&r.setIndices(s[t.indices]),n.addPrimitive(r)}),n}),v=((r.skins||[]).map(function(t){return null}),(r.cameras||[]).map(function(t){return null}),r.nodes||[]),d=v.map(function(t){var r=i.createNode(t.name);return void 0!==t.mesh&&r.setMesh(a[t.mesh]),void 0!==t.translation&&r.setTranslation(t.translation),void 0!==t.rotation&&r.setRotation(t.rotation),void 0!==t.scale&&r.setScale(t.scale),void 0!==t.matrix&&(r.setTranslation(n.getTranslation([],t.matrix)),r.setRotation(n.getRotation([],t.matrix)),r.setScale(n.getScaling([],t.matrix))),r});return v.map(function(t,n){(t.children||[]).forEach(function(t){return d[n].addChild(d[t])})}),(r.animations||[]).map(function(t){return null}),(r.scenes||[]).map(function(t){var n=i.createScene(t.name);return(t.nodes||[]).map(function(t){return d[t]}).forEach(function(t){return n.addNode(t)}),n}),i};var Y={ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963},$=function(){};function q(t){var n={};return t.getName()&&(n.name=t.getName()),Object.keys(t.getExtras()).length>0&&(n.extras=t.getExtras()),Object.keys(t.getExtensions()).length>0&&(n.extras=t.getExtensions()),n}function z(t){var n=q(t);return n.type=t.getType(),n.componentType=t.getComponentType(),n.count=t.getCount(),t.getMax(n.max=[]),t.getMin(n.min=[]),n.normalized=t.getNormalized(),n}$.write=function(t,n){var r=t.getRoot(),i={json:{asset:r.getAsset()},resources:{}},e=i.json,u=t.getLogger(),s=r.listBuffers().length,o=r.listTextures().length,h=new H(s>1,n.basename),f=new H(o>1,n.basename),a=new Map,v=new Map,d=new Map,w=new Map,A=new Map,p=new Map,y=new Map,E=[];function m(t,n,r,i){for(var u=[],s=0,o=0,h=t;o<h.length;o+=1){var f=h[o],c=z(f);c.bufferView=e.bufferViews.length;var v=b.pad(f.getArray().buffer);c.byteOffset=s,s+=v.byteLength,u.push(v),a.set(f,e.accessors.length),e.accessors.push(c)}var l={buffer:n,byteOffset:r,byteLength:b.concat(u).byteLength};return i&&(l.target=i),e.bufferViews.push(l),{buffers:u,byteLength:s}}function T(t,n,r){for(var i=t[0].getCount(),u=0,s=0,o=t;s<o.length;s+=1){var h=o[s],f=z(h);f.bufferView=e.bufferViews.length,f.byteOffset=u;var c=h.getElementSize(),v=h.getComponentSize();u+=b.padNumber(c*v),a.set(h,e.accessors.length),e.accessors.push(f)}for(var l=i*u,d=new ArrayBuffer(l),w=new DataView(d),A=0;A<i;A++)for(var p=0,y=0,E=t;y<E.length;y+=1){for(var m=E[y],T=m.getElementSize(),g=m.getComponentSize(),O=m.getComponentType(),M=m.getArray(),R=0;R<T;R++){var x=A*u+p+R*g,j=M[A*T+R];switch(O){case 5126:w.setFloat32(x,j,!0);break;case 5120:w.setInt8(x,j);break;case 5122:w.setInt16(x,j,!0);break;case 5121:w.setUint8(x,j);break;case 5123:w.setUint16(x,j,!0);break;case 5125:w.setUint32(x,j,!0);break;default:throw new Error("Unexpected component type: "+O)}}p+=b.padNumber(T*g)}return e.bufferViews.push({buffer:n,byteOffset:r,byteLength:l,byteStride:u,target:Y.ARRAY_BUFFER}),{byteLength:l,buffers:[d]}}function g(t,n,r){var i={magFilter:r.getMagFilter()||void 0,minFilter:r.getMinFilter()||void 0,wrapS:r.getWrapS(),wrapT:r.getWrapT()},u=JSON.stringify(i);y.has(u)||(y.set(u,e.samplers.length),e.samplers.push(i));var s={source:A.get(t),sampler:y.get(u)},o=JSON.stringify(s);return p.has(o)||(p.set(o,e.textures.length),e.textures.push(s)),{index:p.get(o),texCoord:n.getTexCoord()}}for(var O=new Map,M=0,R=t.getGraph().getLinks();M<R.length;M+=1){var x=R[M];if(x.getParent()!==r){var j=x.getChild();if(j instanceof l){var N=O.get(j)||[];N.push(x),O.set(j,N)}}}return e.accessors=[],e.bufferViews=[],e.samplers=[],e.textures=[],e.images=r.listTextures().map(function(t,r){var u=q(t);if(t.getMimeType()&&(u.mimeType=t.getMimeType()),n.isGLB)E.push(t.getImage()),u.bufferView=e.bufferViews.length,e.bufferViews.push({buffer:0,byteOffset:-1,byteLength:t.getImage().byteLength});else{var s="image/png"===t.getMimeType()?"png":"jpeg";u.uri=f.createURI(t,s),i.resources[u.uri]=t.getImage()}return A.set(t,r),u}),e.buffers=[],r.listBuffers().forEach(function(t){for(var r=q(t),s=new Map,o=new Set,f=new Set,a=0,v=t.listParents().filter(function(t){return!(t instanceof C)});a<v.length;a+=1){var d=v[a];if(!(d instanceof l))throw new Error("Unimplemented buffer reference: "+d);for(var w=!1,A=!1,p=!1,y=O.get(d)||[],g=0,M=y;g<M.length;g+=1){var R=M[g];R instanceof U?w=!0:R instanceof _?A=!0:p=!0}if(w||A||p||(p=!0),!w||A||p)if(!A||w||p){if(!p||w||A)throw new Error("Attribute or index accessors must be used only for that purpose.");f.add(d)}else o.add(d);else{var x=y[0].getParent(),j=s.get(x)||new Set;j.add(d),s.set(x,j)}}var N,S=[],I=e.buffers.length,L=0;if(o.size){var B=m(Array.from(o),I,L,Y.ELEMENT_ARRAY_BUFFER);L+=B.byteLength,S.push.apply(S,B.buffers)}for(var P=0,k=Array.from(s.values());P<k.length;P+=1){var F=k[P];if(F.size){var V=T(Array.from(F),I,L);L+=V.byteLength,S.push.apply(S,V.buffers)}}if(f.size){var D=m(Array.from(f),I,L);L+=D.byteLength,S.push.apply(S,D.buffers)}if(E.length)for(var G=0;G<E.length;G++)e.bufferViews[e.images[G].bufferView].byteOffset=L,L+=E[G].byteLength,S.push(E[G]);L?(n.isGLB?N=c:(N=h.createURI(t,"bin"),r.uri=N),r.byteLength=L,i.resources[N]=b.concat(S),e.buffers.push(r)):u.warn('@gltf-transform/core: Skipping empty buffer, "'+t.getName()+'".')}),e.materials=r.listMaterials().map(function(t,n){var r=q(t);if(r.alphaMode=t.getAlphaMode(),"MASK"===t.getAlphaMode()&&(r.alphaCutoff=t.getAlphaCutoff()),r.doubleSided=t.getDoubleSided(),r.pbrMetallicRoughness={},r.pbrMetallicRoughness.baseColorFactor=t.getBaseColorFactor(),r.emissiveFactor=t.getEmissiveFactor(),r.pbrMetallicRoughness.roughnessFactor=t.getRoughnessFactor(),r.pbrMetallicRoughness.metallicFactor=t.getMetallicFactor(),t.getBaseColorTexture()){var i=t.getBaseColorTexture(),e=t.getBaseColorTextureInfo(),u=t.getBaseColorTextureSampler();r.pbrMetallicRoughness.baseColorTexture=g(i,e,u)}if(t.getEmissiveTexture()){var s=t.getEmissiveTexture(),o=t.getEmissiveTextureInfo(),h=t.getEmissiveTextureSampler();r.emissiveTexture=g(s,o,h)}if(t.getNormalTexture()){var f=g(t.getNormalTexture(),t.getNormalTextureInfo(),t.getNormalTextureSampler());1!==t.getNormalScale()&&(f.scale=t.getNormalScale()),r.normalTexture=f}if(t.getOcclusionTexture()){var c=g(t.getOcclusionTexture(),t.getOcclusionTextureInfo(),t.getOcclusionTextureSampler());1!==t.getOcclusionStrength()&&(c.strength=t.getOcclusionStrength()),r.occlusionTexture=c}if(t.getMetallicRoughnessTexture()){var a=t.getMetallicRoughnessTexture(),l=t.getMetallicRoughnessTextureInfo(),d=t.getMetallicRoughnessTextureSampler();r.pbrMetallicRoughness.metallicRoughnessTexture=g(a,l,d)}return v.set(t,n),r}),e.meshes=r.listMeshes().map(function(t,n){var r=q(t);return r.primitives=t.listPrimitives().map(function(t){var n={attributes:{}};n.material=v.get(t.getMaterial()),n.mode=t.getMode(),t.getIndices()&&(n.indices=a.get(t.getIndices()));for(var r=0,i=t.listSemantics();r<i.length;r+=1){var e=i[r];n.attributes[e]=a.get(t.getAttribute(e))}return n}),d.set(t,n),r}),e.nodes=r.listNodes().map(function(t,n){var r=q(t);return r.translation=t.getTranslation(),r.rotation=t.getRotation(),r.scale=t.getScale(),t.getMesh()&&(r.mesh=d.get(t.getMesh())),w.set(t,n),r}),r.listNodes().forEach(function(t,n){0!==t.listChildren().length&&(e.nodes[n].children=t.listChildren().map(function(t){return w.get(t)}))}),e.scenes=r.listScenes().map(function(t){var n=q(t);return n.nodes=t.listNodes().map(function(t){return w.get(t)}),n}),function(t){var n=[];for(var r in t){var i=t[r];Array.isArray(i)&&0===i.length?n.push(r):null!==i&&""!==i||n.push(i)}for(var e=0,u=n;e<u.length;e+=1)delete t[u[e]]}(e),i};var H=function(t,n){this.multiple=t,this.basename=n,this.counter=1};H.prototype.createURI=function(t,n){return t.getURI()?t.getURI():this.multiple?this.basename+"_"+this.counter+++"."+n:this.basename+"."+n};var K=function(){};K.prototype.createDocument=function(t){return V.read(t)},K.prototype.createNativeDocument=function(t,n){if(n.isGLB&&1!==t.getRoot().listBuffers().length)throw new Error("GLB must have exactly 1 buffer.");return $.write(t,n)},K.prototype.unpackGLB=function(t){var n,r=new Uint32Array(t,0,3);if(1179937895!==r[0])throw new Error("Invalid glTF asset.");if(2!==r[1])throw new Error('Unsupported glTF binary version, "'+r[1]+'".');var i=new Uint32Array(t,12,2),e=i[0],u=new Uint32Array(t,20+e,2);if(1313821514!==i[1]||5130562!==u[1])throw new Error("Unexpected GLB layout.");var s=b.decodeText(t.slice(20,20+e)),o=JSON.parse(s),h=20+e+8,f=t.slice(h,h+u[0]);return this.createDocument({json:o,resources:(n={},n[c]=f,n)})},K.prototype.packGLB=function(t){var n=this.createNativeDocument(t,{basename:"",isGLB:!0}),r=n.resources,i=JSON.stringify(n.json),e=b.pad(b.encodeText(i),32),u=new Uint32Array([e.byteLength,1313821514]).buffer,s=b.concat([u,e]),o=b.pad(Object.values(r)[0],0),h=new Uint32Array([o.byteLength,5130562]).buffer,f=b.concat([h,o]),c=new Uint32Array([1179937895,2,12+s.byteLength+f.byteLength]).buffer;return b.concat([c,s,f])};var Q=function(t){function n(n,r){t.call(this),this.fs=n,this.path=r}return t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n,n.prototype.read=function(t){return t.match(/\.glb$/)?this.readGLB(t):this.readGLTF(t)},n.prototype.write=function(t,n){t.match(/\.glb$/)?this.writeGLB(t,n):this.writeGLTF(t,n)},n.prototype.readGLB=function(t){var n=this.fs.readFileSync(t),r=b.trim(n);return this.unpackGLB(r)},n.prototype.readGLTF=function(t){var n=this,r=this.path.dirname(t),i={json:JSON.parse(this.fs.readFileSync(t,"utf8")),resources:{}};return(i.json.images||[]).concat(i.json.buffers||[]).forEach(function(t){if(t.uri&&!t.uri.match(/data:/)){var e=n.path.resolve(r,t.uri);i.resources[t.uri]=b.trim(n.fs.readFileSync(e))}else{var u="__"+O()+"."+A.extension(t.uri);i.resources[u]=b.createBufferFromDataURI(t.uri),t.uri=u}}),V.read(i)},n.prototype.writeGLTF=function(t,n){var r={basename:A.basename(t),isGLB:!1},i=$.write(n,r),e=i.json,u=i.resources,s=this.fs,o=this.path,h=o.dirname(t);s.writeFileSync(t,JSON.stringify(e,null,2)),Object.keys(u).forEach(function(t){var n=Buffer.from(u[t]);s.writeFileSync(o.join(h,t),n)})},n.prototype.writeGLB=function(t,n){var r=Buffer.from(this.packGLB(n));this.fs.writeFileSync(t,r)},n}(K),W=function(t){function n(n){t.call(this),this.fetchConfig=n}return t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n,n.prototype.read=function(t){return t.match(/\.glb$/)?this.readGLB(t):this.readGLTF(t)},n.prototype.readGLTF=function(t){var n=this,r={json:{},resources:{}};return fetch(t,this.fetchConfig).then(function(t){return t.json()}).then(function(t){r.json=t;var i=t.images.concat(t.buffers).map(function(t){if(t.uri)return fetch(t.uri,n.fetchConfig).then(function(t){return t.arrayBuffer()}).then(function(n){r.resources[t.uri]=n})});return Promise.all(i).then(function(){return n.createDocument(r)})})},n.prototype.readGLB=function(t){var n=this;return fetch(t,this.fetchConfig).then(function(t){return t.arrayBuffer()}).then(function(t){return n.unpackGLB(t)})},n}(K);r.glMatrix.setMatrixArrayType(Array),t.Document=k,t.Accessor=l,t.Buffer=w,t.Property=v,t.Material=S,t.Mesh=I,t.Node=B,t.Primitive=L,t.Root=C,t.Scene=P,t.Texture=M,t.TextureInfo=R,t.TextureSampler=x,t.Graph=u,t.NodeIO=Q,t.WebIO=W,t.BufferUtils=b,t.FileUtils=A,t.ImageUtils=p,t.Logger=E,t.uuid=O});
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("gl-matrix/mat4"),require("gl-matrix")):"function"==typeof define&&define.amd?define(["exports","gl-matrix/mat4","gl-matrix"],n):n((t=t||self).core={},t.mat4,t.glMatrix)}(this,function(t,n,r){function i(){return(i=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t}).apply(this,arguments)}function e(t,n){t.prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n}function u(t){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function o(t,n){return(o=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}function s(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}function f(t,n,r){return(f=s()?Reflect.construct:function(t,n,r){var i=[null];i.push.apply(i,n);var e=new(Function.bind.apply(t,i));return r&&o(e,r.prototype),e}).apply(null,arguments)}function c(t){var n="function"==typeof Map?new Map:void 0;return(c=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(t))return n.get(t);n.set(t,r)}function r(){return f(t,arguments,u(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),o(r,t)})(t)}function h(t,n){(null==n||n>t.length)&&(n=t.length);for(var r=0,i=new Array(n);r<n;r++)i[r]=t[r];return i}function a(t){var n=0;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(t=function(t,n){if(t){if("string"==typeof t)return h(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?h(t,void 0):void 0}}(t)))return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=t[Symbol.iterator]()).next.bind(n)}function v(t,n,r,i){var e,u=arguments.length,o=u<3?n:null===i?i=Object.getOwnPropertyDescriptor(n,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,n,r,i);else for(var s=t.length-1;s>=0;s--)(e=t[s])&&(o=(u<3?e(o):u>3?e(n,r,o):e(n,r))||o);return u>3&&o&&Object.defineProperty(n,r,o),o}var l=function(){function t(t,n,r){this.t=t,this.i=n,this.u=r,this.o=!1,this.s=[]}var n=t.prototype;return n.getName=function(){return this.t},n.getParent=function(){return this.i},n.getChild=function(){return this.u},n.setChild=function(t){return this.u=t,this},n.dispose=function(){this.o||(this.o=!0,this.s.forEach(function(t){return t()}),this.s.length=0)},n.onDispose=function(t){return this.s.push(t),this},n.isDisposed=function(){return this.o},t}(),d=function(){function t(){this.h=[]}var n=t.prototype;return n.getLinks=function(){return this.h},n.listParents=function(t){return this.h.filter(function(n){return n.getChild()===t}).map(function(t){return t.getParent()})},n.listChildren=function(t){return this.h.filter(function(n){return n.getParent()===t}).map(function(t){return t.getChild()})},n.disconnectChildren=function(t){return this.h.filter(function(n){return n.getParent()===t}).forEach(function(t){return t.dispose()}),this},n.disconnectParents=function(t,n){var r=this.h.filter(function(n){return n.getChild()===t});return n&&(r=r.filter(function(t){return n(t.getParent())})),r.forEach(function(t){return t.dispose()}),this},n.link=function(t,n,r){if(!r)return null;var i=new l(t,n,r);return this.registerLink(i),i},n.registerLink=function(t){var n=this;return this.h.push(t),t.onDispose(function(){return n.unlink(t)}),t},n.unlink=function(t){return this.h=this.h.filter(function(n){return n!==t}),this},t}();function w(t,n){Object.defineProperty(t,n,{get:function(){return this["__"+n]},set:function(t){var r=this,i=this["__"+n];i&&!Array.isArray(i)&&i.dispose(),t&&!Array.isArray(t)&&t.onDispose(function(){r["__"+n]=null}),this["__"+n]=t},enumerable:!0})}function y(t,n){}var p=function(){function t(t){this.o=!1,this.v=t}var n=t.prototype;return n.isDisposed=function(){return this.o},n.dispose=function(){this.v.disconnectChildren(this),this.v.disconnectParents(this),this.o=!0},n.detach=function(){return this.v.disconnectParents(this),this},n.swap=function(t,n){var r=this;return this.v.getLinks().filter(function(n){return n.getParent()===r&&n.getChild()===t}).forEach(function(t){return t.setChild(n)}),this},n.addGraphChild=function(t,n){return t.push(n),n.onDispose(function(){var r=t.filter(function(t){return t!==n});t.length=0,t.push.apply(t,r)}),this},n.removeGraphChild=function(t,n){return t.filter(function(t){return t.getChild()===n}).forEach(function(t){return t.dispose()}),this},n.listGraphParents=function(){return this.v.listParents(this)},t}(),b=function(t){function n(){return t.call(this,"@gltf-transform/core: Not implemented.")||this}return e(n,t),n}(c(Error)),A=function(t){function n(n,r){var i;return void 0===r&&(r=""),(i=t.call(this,n)||this).t="",i.l={},i.p={},i.t=r,i}e(n,t);var r=n.prototype;return r.getName=function(){return this.t},r.setName=function(t){return this.t=t,this},r.getExtras=function(){return this.l},r.setExtras=function(t){return this.l=t,this},r.getExtensions=function(){return this.p},r.setExtensions=function(t){return this.p=t,this},r.clone=function(){throw new b},r.detach=function(){return this.v.disconnectParents(this,function(t){return"Root"!==t.propertyType}),this},r.listParents=function(){return this.listGraphParents()},n}(p),m=function(t){function n(){var n;return(n=t.apply(this,arguments)||this).propertyType="Accessor",n.A=null,n.m="SCALAR",n.T=null,n.g=!1,n.M=E,n.R=E,n.buffer=null,n}e(n,t),n.getElementSize=function(t){switch(t){case"SCALAR":return 1;case"VEC2":return 2;case"VEC3":return 3;case"VEC4":case"MAT2":return 4;case"MAT3":return 9;case"MAT4":return 16;default:throw new Error("Unexpected type: "+t)}},n.getComponentSize=function(t){switch(t){case 5120:case 5121:return 1;case 5122:case 5123:return 2;case 5125:case 5126:return 4;default:throw new Error("Unexpected component type: "+t)}};var r=n.prototype;return r.getMinNormalized=function(t){var n=this.getElementSize();this.getMin(t);for(var r=0;r<n;r++)t[r]=this.R(t[r]);return t},r.getMin=function(t){for(var n=this.getCount(),r=this.getElementSize(),i=0;i<r;i++)t[i]=Infinity;for(var e=0;e<n*r;e+=r)for(var u=0;u<r;u++)t[u]=Math.min(t[u],this.A[e+u]);return t},r.getMaxNormalized=function(t){var n=this.getElementSize();this.getMax(t);for(var r=0;r<n;r++)t[r]=this.R(t[r]);return t},r.getMax=function(t){for(var n=this.getCount(),r=this.getElementSize(),i=0;i<r;i++)t[i]=-Infinity;for(var e=0;e<n*r;e+=r)for(var u=0;u<r;u++)t[u]=Math.max(t[u],this.A[e+u]);return t},r.getCount=function(){return this.A.length/this.getElementSize()},r.getType=function(){return this.m},r.setType=function(t){return this.m=t,this},r.getElementSize=function(){return n.getElementSize(this.m)},r.getComponentSize=function(){return this.A.BYTES_PER_ELEMENT},r.getComponentType=function(){return this.T},r.getNormalized=function(){return this.g},r.setNormalized=function(t){var n=this;return this.g=t,t?(this.R=function(t){return function(t,n){switch(n){case 5126:return t;case 5123:return t/65535;case 5121:return t/255;case 5122:return Math.max(t/32767,-1);case 5120:return Math.max(t/127,-1)}}(t,n.T)},this.M=function(t){return function(t,n){switch(n){case 5126:return t;case 5123:return Math.round(65535*t);case 5121:return Math.round(255*t);case 5122:return Math.round(32767*t);case 5120:return Math.round(127*t)}}(t,n.T)}):(this.R=E,this.M=E),this},r.getScalar=function(t){var n=this.getElementSize();return this.R(this.A[t*n])},r.setScalar=function(t,n){return this.A[t*this.getElementSize()]=this.M(n),this},r.getElement=function(t,n){for(var r=this.getElementSize(),i=0;i<r;i++)n[i]=this.R(this.A[t*r+i]);return n},r.setElement=function(t,n){for(var r=this.getElementSize(),i=0;i<r;i++)this.A[t*r+i]=this.M(n[i]);return this},r.getBuffer=function(){return this.buffer.getChild()},r.setBuffer=function(t){return this.buffer=this.v.link("buffer",this,t),this},r.getArray=function(){return this.A},r.setArray=function(t){return this.T=function(t){switch(t.constructor){case Float32Array:return 5126;case Uint32Array:return 5125;case Uint16Array:return 5123;case Uint8Array:return 5121;case Int16Array:return 5122;case Int8Array:return 5120;default:throw new Error("Unknown accessor componentType.")}}(t),this.A=t,this},r.getByteLength=function(){return this.A.byteLength},n}(A);function E(t){return t}m.Type={SCALAR:"SCALAR",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT3:"MAT3",MAT4:"MAT4"},m.ComponentType={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125,FLOAT:5126},v([w],m.prototype,"buffer",void 0);var T=function(t){function n(){var n;return(n=t.apply(this,arguments)||this).propertyType="Buffer",n}e(n,t);var r=n.prototype;return r.getURI=function(){return this.S},r.setURI=function(t){return this.S=t,this},n}(A),g=function(){function t(){}return t.createBufferFromDataURI=function(t){if("undefined"==typeof Buffer){for(var n=atob(t.split(",")[1]),r=new Uint8Array(n.length),i=0;i<n.length;i++)r[i]=n.charCodeAt(i);return r.buffer}var e=t.split(",")[1],u=t.indexOf("base64")>=0;return this.trim(Buffer.from(e,u?"base64":"utf8"))},t.encodeText=function(t){return"undefined"!=typeof TextEncoder?(new TextEncoder).encode(t).buffer:this.trim(Buffer.from(t))},t.decodeText=function(t){return"undefined"!=typeof TextDecoder?(new TextDecoder).decode(t):Buffer.from(t).toString("utf8")},t.trim=function(t){var n=t.byteOffset;return t.buffer.slice(n,n+t.byteLength)},t.concat=function(t){for(var n,r=0,i=a(t);!(n=i()).done;)r+=n.value.byteLength;for(var e,u=new Uint8Array(r),o=0,s=a(t);!(e=s()).done;){var f=e.value;u.set(new Uint8Array(f),o),o+=f.byteLength}return u.buffer},t.pad=function(t,n){void 0===n&&(n=0);var r=this.padNumber(t.byteLength);if(r!==t.byteLength){var i=new Uint8Array(r);if(i.set(new Uint8Array(t)),0!==n)for(var e=t.byteLength;e<r;e++)i[e]=n;return i.buffer}return t},t.padNumber=function(t){return 4*Math.ceil(t/4)},t.equals=function(t,n){if(t===n)return!0;if(t.byteLength!==n.byteLength)return!1;for(var r=new DataView(t),i=new DataView(n),e=t.byteLength;e--;)if(r.getUint8(e)!==i.getUint8(e))return!1;return!0},t}(),M=function(){function t(){}return t.basename=function(t){return t.split(/[\\/]/).pop().split(/[.]/).shift()},t.extension=function(t){return 0!==t.indexOf("data:")?t.split(/[\\/]/).pop().split(/[.]/).pop():0===t.indexOf("data:image/png")?"png":0===t.indexOf("data:image/jpeg")?"jpeg":"bin"},t}(),x=function(){function t(){}return t.getSizeJPEG=function(t){var n,r;for(t=t.slice(4);t.length;){if(n=t.readUInt16BE(0),R(t,n),192===(r=t[n+1])||193===r||194===r)return[t.readUInt16BE(n+7),t.readUInt16BE(n+5)];t=t.slice(n+2)}throw new TypeError("Invalid JPG, no size found")},t.getSizePNG=function(t){return"CgBI"===t.toString("ascii",12,16)?[t.readUInt32BE(32),t.readUInt32BE(36)]:[t.readUInt32BE(16),t.readUInt32BE(20)]},t}();function R(t,n){if(n>t.length)throw new TypeError("Corrupt JPG, exceeded buffer limits");if(255!==t[n])throw new TypeError("Invalid JPG, marker table corrupted")}var S=function(){function t(t){this.verbosity=t}var n=t.prototype;return n.debug=function(n){this.verbosity<=t.Verbosity.DEBUG&&console.debug(n)},n.info=function(n){this.verbosity<=t.Verbosity.INFO&&console.info(n)},n.warn=function(n){this.verbosity<=t.Verbosity.WARN&&console.warn(n)},n.error=function(n){this.verbosity<=t.Verbosity.ERROR&&console.error(n)},t}();S.Verbosity={SILENT:4,ERROR:3,WARN:2,INFO:1,DEBUG:0};var U="23456789abdegjkmnpqrvwxyzABDEGJKMNPQRVWXYZ",O=new Set,_=function(){for(var t="",n=0;n<6;n++)t+=U.charAt(Math.floor(Math.random()*U.length));return t},I=function(){for(var t=0;t<999;t++){var n=_();if(!O.has(n))return n}return""},N=function(t){function n(){var n;return(n=t.apply(this,arguments)||this).propertyType="Texture",n.image=null,n.mimeType="",n.uri="",n}e(n,t);var r=n.prototype;return r.getMimeType=function(){return this.mimeType},r.setMimeType=function(t){return this.mimeType=t,this},r.getURI=function(){return this.uri},r.setURI=function(t){return this.uri=t,this},r.getImage=function(){return this.image},r.setImage=function(t){return this.image=t,this},r.getSize=function(){return(this.mimeType?"image/png"===this.mimeType:this.uri.match(/\.png$/))?x.getSizePNG(Buffer.from(this.image)):x.getSizeJPEG(Buffer.from(this.image))},n}(A),j=function(){function t(){this.propertyType="TextureInfo",this.texCoord=0}var n=t.prototype;return n.getTexCoord=function(){return this.texCoord},n.setTexCoord=function(t){return this.texCoord=t,this},t}(),L=function(){function t(){this.propertyType="TextureSampler",this.U=null,this.O=null,this._=10497,this.I=10497}var n=t.prototype;return n.getMagFilter=function(){return this.U},n.setMagFilter=function(t){return this.U=t,this},n.getMinFilter=function(){return this.O},n.setMinFilter=function(t){return this.O=t,this},n.getWrapS=function(){return this._},n.setWrapS=function(t){return this._=t,this},n.getWrapT=function(){return this.I},n.setWrapT=function(t){return this.I=t,this},t}();L.TextureWrapMode={CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497},L.TextureMagFilter={NEAREST:9728,LINEAR:9729},L.TextureMinFilter={NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987};var C=function(t){function n(){var n;return(n=t.apply(this,arguments)||this).textureInfo=new j,n.sampler=new L,n}return e(n,t),n}(l),B=function(t){function n(){var n;return(n=t.apply(this,arguments)||this).semantic="",n}return e(n,t),n}(l),P=function(t){function n(){return t.apply(this,arguments)||this}return e(n,t),n}(l),k=function(t){function n(){return t.apply(this,arguments)||this}e(n,t);var r=n.prototype;return r.linkTexture=function(t,n,r){var i=new C(t,n,r);return this.registerLink(i),i},r.linkAttribute=function(t,n,r){var i=new B(t,n,r);return this.registerLink(i),i},r.linkIndex=function(t,n,r){var i=new P(t,n,r);return this.registerLink(i),i},n}(d),D=function(t){function n(){var n;return(n=t.apply(this,arguments)||this).propertyType="Material",n.N="OPAQUE",n.j=.5,n.L=!1,n.C=[1,1,1,1],n.B=[0,0,0],n.P=1,n.k=1,n.D=1,n.V=1,n.baseColorTexture=null,n.emissiveTexture=null,n.normalTexture=null,n.occlusionTexture=null,n.metallicRoughnessTexture=null,n}e(n,t);var r=n.prototype;return r.getDoubleSided=function(){return this.L},r.setDoubleSided=function(t){return this.L=t,this},r.getAlphaMode=function(){return this.N},r.setAlphaMode=function(t){return this.N=t,this},r.getAlphaCutoff=function(){return this.j},r.setAlphaCutoff=function(t){return this.j=t,this},r.getBaseColorFactor=function(){return this.C},r.setBaseColorFactor=function(t){return this.C=t,this},r.getBaseColorTexture=function(){return this.baseColorTexture?this.baseColorTexture.getChild():null},r.getBaseColorTextureInfo=function(){return this.baseColorTexture?this.baseColorTexture.textureInfo:null},r.getBaseColorTextureSampler=function(){return this.baseColorTexture?this.baseColorTexture.sampler:null},r.setBaseColorTexture=function(t){return this.baseColorTexture=this.v.linkTexture("baseColorTexture",this,t),this},r.getEmissiveFactor=function(){return this.B},r.setEmissiveFactor=function(t){return this.B=t,this},r.getEmissiveTexture=function(){return this.emissiveTexture?this.emissiveTexture.getChild():null},r.getEmissiveTextureInfo=function(){return this.emissiveTexture?this.emissiveTexture.textureInfo:null},r.getEmissiveTextureSampler=function(){return this.emissiveTexture?this.emissiveTexture.sampler:null},r.setEmissiveTexture=function(t){return this.emissiveTexture=this.v.linkTexture("emissiveTexture",this,t),this},r.getNormalScale=function(){return this.P},r.setNormalScale=function(t){return this.P=t,this},r.getNormalTexture=function(){return this.normalTexture?this.normalTexture.getChild():null},r.getNormalTextureInfo=function(){return this.normalTexture?this.normalTexture.textureInfo:null},r.getNormalTextureSampler=function(){return this.normalTexture?this.normalTexture.sampler:null},r.setNormalTexture=function(t){return this.normalTexture=this.v.linkTexture("normalTexture",this,t),this},r.getOcclusionStrength=function(){return this.k},r.setOcclusionStrength=function(t){return this.k=t,this},r.getOcclusionTexture=function(){return this.occlusionTexture?this.occlusionTexture.getChild():null},r.getOcclusionTextureInfo=function(){return this.occlusionTexture?this.occlusionTexture.textureInfo:null},r.getOcclusionTextureSampler=function(){return this.occlusionTexture?this.occlusionTexture.sampler:null},r.setOcclusionTexture=function(t){return this.occlusionTexture=this.v.linkTexture("occlusionTexture",this,t),this},r.getRoughnessFactor=function(){return this.D},r.setRoughnessFactor=function(t){return this.D=t,this},r.getMetallicFactor=function(){return this.V},r.setMetallicFactor=function(t){return this.V=t,this},r.getMetallicRoughnessTexture=function(){return this.metallicRoughnessTexture?this.metallicRoughnessTexture.getChild():null},r.getMetallicRoughnessTextureInfo=function(){return this.metallicRoughnessTexture?this.metallicRoughnessTexture.textureInfo:null},r.getMetallicRoughnessTextureSampler=function(){return this.metallicRoughnessTexture?this.metallicRoughnessTexture.sampler:null},r.setMetallicRoughnessTexture=function(t){return this.metallicRoughnessTexture=this.v.linkTexture("metallicRoughnessTexture",this,t),this},n}(A);v([w],D.prototype,"baseColorTexture",void 0),v([w],D.prototype,"emissiveTexture",void 0),v([w],D.prototype,"normalTexture",void 0),v([w],D.prototype,"occlusionTexture",void 0),v([w],D.prototype,"metallicRoughnessTexture",void 0);var V=function(t){function n(){var n;return(n=t.apply(this,arguments)||this).propertyType="Mesh",n.primitives=[],n}e(n,t);var r=n.prototype;return r.addPrimitive=function(t){return this.addGraphChild(this.primitives,this.v.link("primitive",this,t))},r.removePrimitive=function(t){return this.removeGraphChild(this.primitives,t)},r.listPrimitives=function(){return this.primitives.map(function(t){return t.getChild()})},n}(A);v([y],V.prototype,"primitives",void 0);var F=function(t){function n(){var n;return(n=t.apply(this,arguments)||this).propertyType="Primitive",n.F=4,n.G=null,n.J=[],n.$=null,n}e(n,t);var r=n.prototype;return r.getIndices=function(){return this.G?this.G.getChild():null},r.setIndices=function(t){return this.G=this.v.linkIndex("index",this,t),this},r.getAttribute=function(t){var n=this.J.find(function(n){return n.semantic===t});return n?n.getChild():null},r.setAttribute=function(t,n){var r=this.v.linkAttribute(t.toLowerCase(),this,n);return r.semantic=t,this.addGraphChild(this.J,r)},r.listAttributes=function(){return this.J.map(function(t){return t.getChild()})},r.listSemantics=function(){return this.J.map(function(t){return t.semantic})},r.listTargets=function(){throw new b},r.listTargetNames=function(){throw new b},r.getMaterial=function(){return this.$?this.$.getChild():null},r.setMaterial=function(t){return this.$=this.v.link("material",this,t),this},r.getMode=function(){return this.F},r.setMode=function(t){return this.F=t,this},n}(A);v([w],F.prototype,"_indices",void 0),v([y],F.prototype,"_attributes",void 0),v([w],F.prototype,"_material",void 0);var G=function(t){function n(){var n;return(n=t.apply(this,arguments)||this).propertyType="Node",n.q=[0,0,0],n.Y=[0,0,0,1],n.H=[1,1,1],n.mesh=null,n.children=[],n}e(n,t);var r=n.prototype;return r.getTranslation=function(){return this.q},r.getRotation=function(){return this.Y},r.getScale=function(){return this.H},r.setTranslation=function(t){return this.q=t,this},r.setRotation=function(t){return this.Y=t,this},r.setScale=function(t){return this.H=t,this},r.addChild=function(t){var n=this.v.link("child",this,t);return this.addGraphChild(this.children,n)},r.removeChild=function(t){return this.removeGraphChild(this.children,t)},r.listChildren=function(){return this.children.map(function(t){return t.getChild()})},r.getMesh=function(){return this.mesh?this.mesh.getChild():null},r.setMesh=function(t){return this.mesh=this.v.link("mesh",this,t),this},n}(A);v([w],G.prototype,"mesh",void 0),v([y],G.prototype,"children",void 0);var J=function(t){function n(){var n;return(n=t.apply(this,arguments)||this).propertyType="Root",n.K={generator:"glTF-Transform v0.2",version:"2.0"},n.scenes=[],n.nodes=[],n.meshes=[],n.materials=[],n.textures=[],n.accessors=[],n.buffers=[],n}e(n,t);var r=n.prototype;return r.getAsset=function(){return this.K},r.addScene=function(t){return this.addGraphChild(this.scenes,this.v.link("scene",this,t))},r.removeScene=function(t){return this.removeGraphChild(this.scenes,t)},r.listScenes=function(){return this.scenes.map(function(t){return t.getChild()})},r.addNode=function(t){return this.addGraphChild(this.nodes,this.v.link("node",this,t))},r.removeNode=function(t){return this.removeGraphChild(this.nodes,t)},r.listNodes=function(){return this.nodes.map(function(t){return t.getChild()})},r.addMesh=function(t){return this.addGraphChild(this.meshes,this.v.link("mesh",this,t))},r.removeMesh=function(t){return this.removeGraphChild(this.meshes,t)},r.listMeshes=function(){return this.meshes.map(function(t){return t.getChild()})},r.addMaterial=function(t){return this.addGraphChild(this.materials,this.v.link("material",this,t))},r.removeMaterial=function(t){return this.removeGraphChild(this.materials,t)},r.listMaterials=function(){return this.materials.map(function(t){return t.getChild()})},r.addTexture=function(t){return this.addGraphChild(this.textures,this.v.link("texture",this,t))},r.removeTexture=function(t){return this.removeGraphChild(this.textures,t)},r.listTextures=function(){return this.textures.map(function(t){return t.getChild()})},r.addAccessor=function(t){return this.addGraphChild(this.accessors,this.v.link("accessor",this,t))},r.removeAccessor=function(t){return this.removeGraphChild(this.accessors,t)},r.listAccessors=function(){return this.accessors.map(function(t){return t.getChild()})},r.addBuffer=function(t){return this.addGraphChild(this.buffers,this.v.link("buffer",this,t))},r.removeBuffer=function(t){return this.removeGraphChild(this.buffers,t)},r.listBuffers=function(){return this.buffers.map(function(t){return t.getChild()})},n}(A);v([y],J.prototype,"scenes",void 0),v([y],J.prototype,"nodes",void 0),v([y],J.prototype,"meshes",void 0),v([y],J.prototype,"materials",void 0),v([y],J.prototype,"textures",void 0),v([y],J.prototype,"accessors",void 0),v([y],J.prototype,"buffers",void 0);var $=function(t){function n(){var n;return(n=t.apply(this,arguments)||this).propertyType="Scene",n.nodes=[],n}e(n,t);var r=n.prototype;return r.addNode=function(t){return this.addGraphChild(this.nodes,this.v.link("node",this,t))},r.removeNode=function(t){return this.removeGraphChild(this.nodes,t)},r.listNodes=function(){return this.nodes.map(function(t){return t.getChild()})},n}(A);v([y],$.prototype,"nodes",void 0);var q=function(){function t(){this.graph=new k,this.root=new J(this.graph),this.logger=new S(S.Verbosity.INFO)}var n=t.prototype;return n.getRoot=function(){return this.root},n.getGraph=function(){return this.graph},n.getLogger=function(){return this.logger},n.setLogger=function(t){return this.logger=t,this},n.clone=function(){throw new Error("Not implemented.")},n.transform=function(){for(var t,n=a([].slice.call(arguments));!(t=n()).done;){var r=t.value;r(this)}return this},n.createScene=function(t){var n=new $(this.graph,t);return this.root.addScene(n),n},n.createNode=function(t){var n=new G(this.graph,t);return this.root.addNode(n),n},n.createMesh=function(t){var n=new V(this.graph,t);return this.root.addMesh(n),n},n.createPrimitive=function(){return new F(this.graph)},n.createMaterial=function(t){var n=new D(this.graph,t);return this.root.addMaterial(n),n},n.createTexture=function(t){var n=new N(this.graph,t);return this.root.addTexture(n),n},n.createAccessor=function(t,n){void 0===n&&(n=null),n||(n=this.getRoot().listBuffers()[0]);var r=new m(this.graph,t).setBuffer(n);return this.root.addAccessor(r),r},n.createBuffer=function(t){var n=new T(this.graph,t);return this.root.addBuffer(n),n},t}(),Y={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},z=function(){function t(){}return t.read=function(t){var r=t.json,e=new q;if("2.0"!==r.asset.version)throw new Error('Unsupported glTF version: "'+r.asset.version+'".');var u=(r.buffers||[]).map(function(t){var n=e.createBuffer(t.name);return t.uri&&0!==t.uri.indexOf("__")&&n.setURI(t.uri),n}),o=(r.bufferViews||[]).map(function(t){return u[t.buffer]}),s=(r.accessors||[]).map(function(n){var r,u=e.createAccessor(n.name,o[n.bufferView]);return u.setType(n.type),r=void 0!==n.sparse?function(t,n){var r,e=Y[t.componentType],u=m.getElementSize(t.type);r=void 0!==t.bufferView?Q(t,n).slice():new e(t.count*u);for(var o=t.sparse.count,s=i(i(i({},t),t.sparse.indices),{},{count:o,type:"SCALAR"}),f=i(i(i({},t),t.sparse.values),{},{count:o}),c=Q(s,n),h=Q(f,n),a=0;a<s.count;a++)for(var v=0;v<u;v++)r[c[a]*u+v]=h[a*u+v];return r}(n,t):Q(n,t).slice(),void 0!==n.normalized&&u.setNormalized(n.normalized),u.setArray(r),u}),f=r.textures||[],c=(r.images||[]).map(function(n){var i=e.createTexture(n.name);if(void 0!==n.bufferView){var u=r.bufferViews[n.bufferView],o=t.json.buffers[u.buffer],s=u.byteOffset||0,f=(o.uri?t.resources[o.uri]:t.resources["W"]).slice(s,s+u.byteLength);i.setImage(f)}else void 0!==n.uri&&(i.setImage(t.resources[n.uri]),0!==n.uri.indexOf("__")&&i.setURI(n.uri));if(void 0!==n.mimeType)i.setMimeType(n.mimeType);else if(n.uri){var c=M.extension(n.uri);i.setMimeType("png"===c?"image/png":"image/jpeg")}return i}),h=(r.materials||[]).map(function(n){var r=e.createMaterial(n.name);void 0!==n.alphaMode&&r.setAlphaMode(n.alphaMode),void 0!==n.alphaCutoff&&r.setAlphaCutoff(n.alphaCutoff),void 0!==n.doubleSided&&r.setDoubleSided(n.doubleSided);var i=n.pbrMetallicRoughness||{};if(void 0!==i.baseColorFactor&&r.setBaseColorFactor(i.baseColorFactor),void 0!==n.emissiveFactor&&r.setEmissiveFactor(n.emissiveFactor),void 0!==i.metallicFactor&&r.setMetallicFactor(i.metallicFactor),void 0!==i.roughnessFactor&&r.setRoughnessFactor(i.roughnessFactor),void 0!==i.baseColorTexture){var u=i.baseColorTexture;r.setBaseColorTexture(c[f[u.index].source]),H(r.getBaseColorTextureInfo(),u),K(r.getBaseColorTextureSampler(),u,t)}if(void 0!==n.emissiveTexture){var o=n.emissiveTexture;r.setEmissiveTexture(c[f[o.index].source]),H(r.getEmissiveTextureInfo(),o),K(r.getEmissiveTextureSampler(),o,t)}if(void 0!==n.normalTexture){var s=n.normalTexture;r.setNormalTexture(c[f[s.index].source]),H(r.getNormalTextureInfo(),s),K(r.getNormalTextureSampler(),s,t),void 0!==n.normalTexture.scale&&r.setNormalScale(n.normalTexture.scale)}if(void 0!==n.occlusionTexture){var h=n.occlusionTexture;r.setOcclusionTexture(c[f[h.index].source]),H(r.getOcclusionTextureInfo(),h),K(r.getOcclusionTextureSampler(),h,t),void 0!==n.occlusionTexture.strength&&r.setOcclusionStrength(n.occlusionTexture.strength)}if(void 0!==i.metallicRoughnessTexture){var a=i.metallicRoughnessTexture;r.setMetallicRoughnessTexture(c[f[a.index].source]),H(r.getMetallicRoughnessTextureInfo(),a),K(r.getMetallicRoughnessTextureSampler(),a,t)}return r}),a=(r.meshes||[]).map(function(t){var n=e.createMesh(t.name);return t.primitives.forEach(function(t){var r=e.createPrimitive();void 0!==t.material&&r.setMaterial(h[t.material]),void 0!==t.mode&&r.setMode(t.mode);for(var i=0,u=Object.entries(t.attributes||{});i<u.length;i++){var o=u[i];r.setAttribute(o[0],s[o[1]])}void 0!==t.indices&&r.setIndices(s[t.indices]),n.addPrimitive(r)}),n}),v=((r.skins||[]).map(function(t){return null}),(r.cameras||[]).map(function(t){return null}),r.nodes||[]),l=v.map(function(t){var r=e.createNode(t.name);return void 0!==t.mesh&&r.setMesh(a[t.mesh]),void 0!==t.translation&&r.setTranslation(t.translation),void 0!==t.rotation&&r.setRotation(t.rotation),void 0!==t.scale&&r.setScale(t.scale),void 0!==t.matrix&&(r.setTranslation(n.getTranslation([],t.matrix)),r.setRotation(n.getRotation([],t.matrix)),r.setScale(n.getScaling([],t.matrix))),r});return v.map(function(t,n){(t.children||[]).forEach(function(t){return l[n].addChild(l[t])})}),(r.animations||[]).map(function(t){return null}),(r.scenes||[]).map(function(t){var n=e.createScene(t.name);return(t.nodes||[]).map(function(t){return l[t]}).forEach(function(t){return n.addNode(t)}),n}),e},t}();function H(t,n){void 0!==n.texCoord&&t.setTexCoord(n.texCoord)}function K(t,n,r){var i=r.json.textures[n.index];if(void 0!==i.sampler){var e=r.json.samplers[i.sampler];void 0!==e.magFilter&&t.setMagFilter(e.magFilter),void 0!==e.minFilter&&t.setMinFilter(e.minFilter),void 0!==e.wrapS&&t.setWrapS(e.wrapS),void 0!==e.wrapT&&t.setWrapT(e.wrapT)}}function Q(t,n){var r=n.json.bufferViews[t.bufferView],i=n.json.buffers[r.buffer],e=i.uri?n.resources[i.uri]:n.resources["W"],u=Y[t.componentType],o=m.getElementSize(t.type);if(void 0!==r.byteStride&&r.byteStride!==o*u.BYTES_PER_ELEMENT)return function(t,n){for(var r=n.json.bufferViews[t.bufferView],i=n.json.buffers[r.buffer],e=i.uri?n.resources[i.uri]:n.resources["W"],u=Y[t.componentType],o=m.getElementSize(t.type),s=u.BYTES_PER_ELEMENT,f=t.byteOffset||0,c=new u(t.count*o),h=new DataView(e,r.byteOffset,r.byteLength),a=r.byteStride,v=0;v<t.count;v++)for(var l=0;l<o;l++){var d=f+v*a+l*s,w=void 0;switch(t.componentType){case 5126:w=h.getFloat32(d,!0);break;case 5125:w=h.getUint32(d,!0);break;case 5123:w=h.getUint16(d,!0);break;case 5121:w=h.getUint8(d);break;case 5122:w=h.getInt16(d,!0);break;case 5120:w=h.getInt8(d);break;default:throw new Error('Unexpected componentType "'+t.componentType+'".')}c[v*o+l]=w}return c}(t,n);var s=(r.byteOffset||0)+(t.byteOffset||0);switch(t.componentType){case 5126:return new Float32Array(e,s,t.count*o);case 5125:return new Uint32Array(e,s,t.count*o);case 5123:return new Uint16Array(e,s,t.count*o);case 5121:return new Uint8Array(e,s,t.count*o);case 5122:return new Int16Array(e,s,t.count*o);case 5120:return new Int8Array(e,s,t.count*o);default:throw new Error('Unexpected componentType "'+t.componentType+'".')}}var W=function(){function t(){}return t.write=function(t,n){var r=t.getRoot(),i={json:{asset:r.getAsset()},resources:{}},e=i.json,u=t.getLogger(),o=r.listBuffers().length,s=r.listTextures().length,f=new tt(o>1,n.basename),c=new tt(s>1,n.basename),h=new Map,v=new Map,l=new Map,d=new Map,w=new Map,y=new Map,p=new Map,b=[];function A(t,n,r,i){for(var u,o=[],s=0,f=a(t);!(u=f()).done;){var c=u.value,v=Z(c);v.bufferView=e.bufferViews.length;var l=g.pad(c.getArray().buffer);v.byteOffset=s,s+=l.byteLength,o.push(l),h.set(c,e.accessors.length),e.accessors.push(v)}var d={buffer:n,byteOffset:r,byteLength:g.concat(o).byteLength};return i&&(d.target=i),e.bufferViews.push(d),{buffers:o,byteLength:s}}function E(t,n,r){for(var i,u=t[0].getCount(),o=0,s=a(t);!(i=s()).done;){var f=i.value,c=Z(f);c.bufferView=e.bufferViews.length,c.byteOffset=o;var v=f.getElementSize(),l=f.getComponentSize();o+=g.padNumber(v*l),h.set(f,e.accessors.length),e.accessors.push(c)}for(var d=u*o,w=new ArrayBuffer(d),y=new DataView(w),p=0;p<u;p++)for(var b,A=0,m=a(t);!(b=m()).done;){for(var E=b.value,T=E.getElementSize(),M=E.getComponentSize(),x=E.getComponentType(),R=E.getArray(),S=0;S<T;S++){var U=p*o+A+S*M,O=R[p*T+S];switch(x){case 5126:y.setFloat32(U,O,!0);break;case 5120:y.setInt8(U,O);break;case 5122:y.setInt16(U,O,!0);break;case 5121:y.setUint8(U,O);break;case 5123:y.setUint16(U,O,!0);break;case 5125:y.setUint32(U,O,!0);break;default:throw new Error("Unexpected component type: "+x)}}A+=g.padNumber(T*M)}return e.bufferViews.push({buffer:n,byteOffset:r,byteLength:d,byteStride:o,target:34962}),{byteLength:d,buffers:[w]}}function T(t,n,r){var i={magFilter:r.getMagFilter()||void 0,minFilter:r.getMinFilter()||void 0,wrapS:r.getWrapS(),wrapT:r.getWrapT()},u=JSON.stringify(i);p.has(u)||(p.set(u,e.samplers.length),e.samplers.push(i));var o={source:w.get(t),sampler:p.get(u)},s=JSON.stringify(o);return y.has(s)||(y.set(s,e.textures.length),e.textures.push(o)),{index:y.get(s),texCoord:n.getTexCoord()}}for(var M,x=new Map,R=a(t.getGraph().getLinks());!(M=R()).done;){var S=M.value;if(S.getParent()!==r){var U=S.getChild();if(U instanceof m){var O=x.get(U)||[];O.push(S),x.set(U,O)}}}return e.accessors=[],e.bufferViews=[],e.samplers=[],e.textures=[],e.images=r.listTextures().map(function(t,r){var u=X(t);if(t.getMimeType()&&(u.mimeType=t.getMimeType()),n.isGLB)b.push(t.getImage()),u.bufferView=e.bufferViews.length,e.bufferViews.push({buffer:0,byteOffset:-1,byteLength:t.getImage().byteLength});else{var o="image/png"===t.getMimeType()?"png":"jpeg";u.uri=c.createURI(t,o),i.resources[u.uri]=t.getImage()}return w.set(t,r),u}),e.buffers=[],r.listBuffers().forEach(function(t){for(var r,o=X(t),s=new Map,c=new Set,h=new Set,v=a(t.listParents().filter(function(t){return!(t instanceof J)}));!(r=v()).done;){var l=r.value;if(!(l instanceof m))throw new Error("Unimplemented buffer reference: "+l);for(var d,w=!1,y=!1,p=!1,T=x.get(l)||[],M=a(T);!(d=M()).done;){var R=d.value;R instanceof B?w=!0:R instanceof P?y=!0:p=!0}if(w||y||p||(p=!0),!w||y||p)if(!y||w||p){if(!p||w||y)throw new Error("Attribute or index accessors must be used only for that purpose.");h.add(l)}else c.add(l);else{var S=T[0].getParent(),U=s.get(S)||new Set;U.add(l),s.set(S,U)}}var O,_=[],I=e.buffers.length,N=0;if(c.size){var j=A(Array.from(c),I,N,34963);N+=j.byteLength,_.push.apply(_,j.buffers)}for(var L=0,C=Array.from(s.values());L<C.length;L++){var k=C[L];if(k.size){var D=E(Array.from(k),I,N);N+=D.byteLength,_.push.apply(_,D.buffers)}}if(h.size){var V=A(Array.from(h),I,N);N+=V.byteLength,_.push.apply(_,V.buffers)}if(b.length)for(var F=0;F<b.length;F++)e.bufferViews[e.images[F].bufferView].byteOffset=N,N+=b[F].byteLength,_.push(b[F]);N?(n.isGLB?O="__glb.bin":(O=f.createURI(t,"bin"),o.uri=O),o.byteLength=N,i.resources[O]=g.concat(_),e.buffers.push(o)):u.warn('@gltf-transform/core: Skipping empty buffer, "'+t.getName()+'".')}),e.materials=r.listMaterials().map(function(t,n){var r=X(t);if(r.alphaMode=t.getAlphaMode(),"MASK"===t.getAlphaMode()&&(r.alphaCutoff=t.getAlphaCutoff()),r.doubleSided=t.getDoubleSided(),r.pbrMetallicRoughness={},r.pbrMetallicRoughness.baseColorFactor=t.getBaseColorFactor(),r.emissiveFactor=t.getEmissiveFactor(),r.pbrMetallicRoughness.roughnessFactor=t.getRoughnessFactor(),r.pbrMetallicRoughness.metallicFactor=t.getMetallicFactor(),t.getBaseColorTexture()){var i=t.getBaseColorTexture(),e=t.getBaseColorTextureInfo(),u=t.getBaseColorTextureSampler();r.pbrMetallicRoughness.baseColorTexture=T(i,e,u)}if(t.getEmissiveTexture()){var o=t.getEmissiveTexture(),s=t.getEmissiveTextureInfo(),f=t.getEmissiveTextureSampler();r.emissiveTexture=T(o,s,f)}if(t.getNormalTexture()){var c=T(t.getNormalTexture(),t.getNormalTextureInfo(),t.getNormalTextureSampler());1!==t.getNormalScale()&&(c.scale=t.getNormalScale()),r.normalTexture=c}if(t.getOcclusionTexture()){var h=T(t.getOcclusionTexture(),t.getOcclusionTextureInfo(),t.getOcclusionTextureSampler());1!==t.getOcclusionStrength()&&(h.strength=t.getOcclusionStrength()),r.occlusionTexture=h}if(t.getMetallicRoughnessTexture()){var a=t.getMetallicRoughnessTexture(),l=t.getMetallicRoughnessTextureInfo(),d=t.getMetallicRoughnessTextureSampler();r.pbrMetallicRoughness.metallicRoughnessTexture=T(a,l,d)}return v.set(t,n),r}),e.meshes=r.listMeshes().map(function(t,n){var r=X(t);return r.primitives=t.listPrimitives().map(function(t){var n={attributes:{}};n.material=v.get(t.getMaterial()),n.mode=t.getMode(),t.getIndices()&&(n.indices=h.get(t.getIndices()));for(var r,i=a(t.listSemantics());!(r=i()).done;){var e=r.value;n.attributes[e]=h.get(t.getAttribute(e))}return n}),l.set(t,n),r}),e.nodes=r.listNodes().map(function(t,n){var r=X(t);return r.translation=t.getTranslation(),r.rotation=t.getRotation(),r.scale=t.getScale(),t.getMesh()&&(r.mesh=l.get(t.getMesh())),d.set(t,n),r}),r.listNodes().forEach(function(t,n){0!==t.listChildren().length&&(e.nodes[n].children=t.listChildren().map(function(t){return d.get(t)}))}),e.scenes=r.listScenes().map(function(t){var n=X(t);return n.nodes=t.listNodes().map(function(t){return d.get(t)}),n}),function(t){var n=[];for(var r in t){var i=t[r];Array.isArray(i)&&0===i.length?n.push(r):null!==i&&""!==i||n.push(i)}for(var e=0,u=n;e<u.length;e++)delete t[u[e]]}(e),i},t}();function X(t){var n={};return t.getName()&&(n.name=t.getName()),Object.keys(t.getExtras()).length>0&&(n.extras=t.getExtras()),Object.keys(t.getExtensions()).length>0&&(n.extras=t.getExtensions()),n}function Z(t){var n=X(t);return n.type=t.getType(),n.componentType=t.getComponentType(),n.count=t.getCount(),t.getMax(n.max=[]),t.getMin(n.min=[]),n.normalized=t.getNormalized(),n}var tt=function(){function t(t,n){this.multiple=t,this.basename=n,this.counter=1}return t.prototype.createURI=function(t,n){return t.getURI()?t.getURI():this.multiple?this.basename+"_"+this.counter+++"."+n:this.basename+"."+n},t}(),nt=function(){function t(){}var n=t.prototype;return n.createDocument=function(t){return z.read(t)},n.createNativeDocument=function(t,n){if(n.isGLB&&1!==t.getRoot().listBuffers().length)throw new Error("GLB must have exactly 1 buffer.");return W.write(t,n)},n.unpackGLB=function(t){var n,r=new Uint32Array(t,0,3);if(1179937895!==r[0])throw new Error("Invalid glTF asset.");if(2!==r[1])throw new Error('Unsupported glTF binary version, "'+r[1]+'".');var i=new Uint32Array(t,12,2),e=i[0],u=new Uint32Array(t,20+e,2);if(1313821514!==i[1]||5130562!==u[1])throw new Error("Unexpected GLB layout.");var o=g.decodeText(t.slice(20,20+e)),s=JSON.parse(o),f=20+e+8,c=t.slice(f,f+u[0]);return this.createDocument({json:s,resources:(n={},n["W"]=c,n)})},n.packGLB=function(t){var n=this.createNativeDocument(t,{basename:"",isGLB:!0}),r=n.resources,i=JSON.stringify(n.json),e=g.pad(g.encodeText(i),32),u=new Uint32Array([e.byteLength,1313821514]).buffer,o=g.concat([u,e]),s=g.pad(Object.values(r)[0],0),f=new Uint32Array([s.byteLength,5130562]).buffer,c=g.concat([f,s]),h=new Uint32Array([1179937895,2,12+o.byteLength+c.byteLength]).buffer;return g.concat([h,o,c])},t}(),rt=function(t){function n(n,r){var i;return(i=t.call(this)||this).fs=n,i.path=r,i}e(n,t);var r=n.prototype;return r.read=function(t){return t.match(/\.glb$/)?this.readGLB(t):this.readGLTF(t)},r.write=function(t,n){t.match(/\.glb$/)?this.writeGLB(t,n):this.writeGLTF(t,n)},r.readGLB=function(t){var n=this.fs.readFileSync(t),r=g.trim(n);return this.unpackGLB(r)},r.readGLTF=function(t){var n=this,r=this.path.dirname(t),i={json:JSON.parse(this.fs.readFileSync(t,"utf8")),resources:{}};return[].concat(i.json.images||[],i.json.buffers||[]).forEach(function(t){if(t.uri&&!t.uri.match(/data:/)){var e=n.path.resolve(r,t.uri);i.resources[t.uri]=g.trim(n.fs.readFileSync(e))}else{var u="__"+I()+"."+M.extension(t.uri);i.resources[u]=g.createBufferFromDataURI(t.uri),t.uri=u}}),z.read(i)},r.writeGLTF=function(t,n){var r={basename:M.basename(t),isGLB:!1},i=W.write(n,r),e=i.json,u=i.resources,o=this.fs,s=this.path,f=s.dirname(t);o.writeFileSync(t,JSON.stringify(e,null,2)),Object.keys(u).forEach(function(t){var n=Buffer.from(u[t]);o.writeFileSync(s.join(f,t),n)})},r.writeGLB=function(t,n){var r=Buffer.from(this.packGLB(n));this.fs.writeFileSync(t,r)},n}(nt),it=function(t){function n(n){var r;return(r=t.call(this)||this).fetchConfig=n,r}e(n,t);var r=n.prototype;return r.read=function(t){return t.match(/\.glb$/)?this.readGLB(t):this.readGLTF(t)},r.readGLTF=function(t){var n=this,r={json:{},resources:{}};return fetch(t,this.fetchConfig).then(function(t){return t.json()}).then(function(t){r.json=t;var i=[].concat(t.images,t.buffers).map(function(t){if(t.uri)return fetch(t.uri,n.fetchConfig).then(function(t){return t.arrayBuffer()}).then(function(n){r.resources[t.uri]=n})});return Promise.all(i).then(function(){return n.createDocument(r)})})},r.readGLB=function(t){var n=this;return fetch(t,this.fetchConfig).then(function(t){return t.arrayBuffer()}).then(function(t){return n.unpackGLB(t)})},n}(nt);r.glMatrix.setMatrixArrayType(Array),t.Accessor=m,t.Buffer=T,t.BufferUtils=g,t.Document=q,t.FileUtils=M,t.Graph=d,t.ImageUtils=x,t.Logger=S,t.Material=D,t.Mesh=V,t.Node=G,t.NodeIO=rt,t.Primitive=F,t.Property=A,t.Root=J,t.Scene=$,t.Texture=N,t.TextureInfo=j,t.TextureSampler=L,t.WebIO=it,t.uuid=I});
//# sourceMappingURL=core.umd.js.map

@@ -10,7 +10,8 @@ import { Accessor, Buffer, Material, Mesh, Node, Primitive, PropertyGraph, Root, Scene, Texture } from './properties/index';

* Documents manage glTF assets and the relationships among dependencies. The document wrapper
* allow tools to read and write changes without dealing with array indices, which are likely to
* change over the course of a file modification. An internal graph structure allows any property
* in the glTF file to maintain references to its dependencies, and makes it easy to determine
* where a particular property dependency is being used. For example, finding a list of materials
* that use a particular texture is as simple as calling {@link Texture.listParents}().
* allow tools to read and write changes without dealing with array indices or byte offsets, which
* would otherwise require careful management over the course of a file modification. An internal
* graph structure allows any property in the glTF file to maintain references to its dependencies,
* and makes it easy to determine where a particular property dependency is being used. For
* example, finding a list of materials that use a particular texture is as simple as calling
* {@link Texture.listParents}().
*

@@ -17,0 +18,0 @@ * A new resource {@link Property} (e.g. a {@link Mesh} or {@link Material}) is created by calling

@@ -14,8 +14,8 @@ import { GraphNode } from './graph-node';

export declare class Link<Parent extends GraphNode, Child extends GraphNode> {
private readonly name;
private readonly parent;
private child;
private disposed;
private readonly listeners;
constructor(name: string, parent: Parent, child: Child);
private readonly _name;
private readonly _parent;
private _child;
private _disposed;
private readonly _listeners;
constructor(_name: string, _parent: Parent, _child: Child);
/** Name. */

@@ -22,0 +22,0 @@ getName(): string;

@@ -10,4 +10,4 @@ import { Graph } from './graph';

export declare abstract class GraphNode {
protected readonly graph: Graph;
private disposed;
protected readonly _graph: Graph;
private _disposed;
constructor(graph: Graph);

@@ -14,0 +14,0 @@ /** Returns true if the node has been permanently removed from the graph. */

@@ -11,3 +11,3 @@ import { Link } from './graph-links';

export declare class Graph {
private links;
private _links;
getLinks(): Link<GraphNode, GraphNode>[];

@@ -14,0 +14,0 @@ listParents(node: GraphNode): GraphNode[];

@@ -82,13 +82,13 @@ import { TypedArray } from '../constants';

/** Raw data of the accessor. */
private array;
private _array;
/** Type of element represented. */
private type;
private _type;
/** Numeric type of each component in an element. */
private componentType;
private _componentType;
/** Whether data in the raw array should be considered normalized. */
private normalized;
private _normalized;
/** Inbound transform to normalized representation, if applicable. */
private in;
private _in;
/** Outbound transform from normalized representation, if applicable. */
private out;
private _out;
/** The {@link Buffer} to which this accessor's data will be written. */

@@ -129,2 +129,7 @@ private buffer;

*/
getMinNormalized(target: number[]): number[];
/**
* Minimum value of each component in this attribute. Values returned by this method do not
* reflect normalization: use {@link .getMinNormalized} in that case.
*/
getMin(target: number[]): number[];

@@ -136,2 +141,7 @@ /**

*/
getMaxNormalized(target: number[]): number[];
/**
* Maximum value of each component in this attribute. Values returned by this method do not
* reflect normalization: use {@link .getMinNormalized} in that case.
*/
getMax(target: number[]): number[];

@@ -138,0 +148,0 @@ /**********************************************************************************************

@@ -60,3 +60,3 @@ import { Property } from './property';

/** URI (or filename) of the buffer. */
private uri;
private _uri;
/**

@@ -63,0 +63,0 @@ * Returns the URI (or filename) of this buffer (e.g. 'myBuffer.bin'). URIs are strongly

@@ -40,3 +40,3 @@ import { Accessor } from './accessor';

/** Primitive GPU draw call list. */
private _primitives;
private primitives;
/** Adds a {@link Primitive} to the mesh's draw call list. */

@@ -43,0 +43,0 @@ addPrimitive(primitive: Primitive): this;

@@ -34,5 +34,5 @@ import { vec3, vec4 } from '../constants';

readonly propertyType = "Node";
private translation;
private rotation;
private scale;
private _translation;
private _rotation;
private _scale;
private mesh;

@@ -39,0 +39,0 @@ private children;

@@ -41,6 +41,6 @@ import { GraphNode } from '../graph';

readonly propertyType: string;
protected readonly graph: PropertyGraph;
protected name: string;
protected extras: object;
protected extensions: object;
protected readonly _graph: PropertyGraph;
protected _name: string;
protected _extras: object;
protected _extensions: object;
/** @hidden */

@@ -47,0 +47,0 @@ constructor(graph: PropertyGraph, name?: string);

@@ -43,3 +43,3 @@ import { Accessor } from './accessor';

readonly propertyType = "Root";
private readonly asset;
private readonly _asset;
private scenes;

@@ -46,0 +46,0 @@ private nodes;

@@ -98,6 +98,6 @@ import { vec2 } from '../constants';

readonly propertyType = "TextureSampler";
private magFilter;
private minFilter;
private wrapS;
private wrapT;
private _magFilter;
private _minFilter;
private _wrapS;
private _wrapT;
/** UV wrapping mode. Values correspond to WebGL enums. */

@@ -104,0 +104,0 @@ static TextureWrapMode: {

{
"name": "@gltf-transform/core",
"version": "0.2.3",
"version": "0.2.4",
"repository": "github:donmccurdy/glTF-Transform",
"description": "glTF 2.0 SDK for JavaScript, TypeScript, and Node.js",
"main": "dist/core.js",
"module": "dist/core.module.js",
"main": "dist/core.umd.js",
"module": "dist/core.modern.js",
"source": "src/core.ts",
"types": "dist/core.d.ts",
"scripts": {
"dist": "microbundle",
"watch": "microbundle watch",
"watch:debug": "microbundle watch --no-compress"
"dist": "microbundle --format modern,umd",
"watch": "microbundle watch --format modern,umd",
"watch:debug": "microbundle watch --no-compress --format modern,umd"
},

@@ -37,3 +37,3 @@ "keywords": [

},
"gitHead": "85d9c4412cbe860736c26b1bc6007e2dfe4a40b6"
"gitHead": "409abd1d5f6c00cd8a3252e8673a7bcad170bd11"
}

@@ -12,7 +12,8 @@ import { Accessor, Buffer, Material, Mesh, Node, Primitive, PropertyGraph, Root, Scene, Texture } from './properties/index';

* Documents manage glTF assets and the relationships among dependencies. The document wrapper
* allow tools to read and write changes without dealing with array indices, which are likely to
* change over the course of a file modification. An internal graph structure allows any property
* in the glTF file to maintain references to its dependencies, and makes it easy to determine
* where a particular property dependency is being used. For example, finding a list of materials
* that use a particular texture is as simple as calling {@link Texture.listParents}().
* allow tools to read and write changes without dealing with array indices or byte offsets, which
* would otherwise require careful management over the course of a file modification. An internal
* graph structure allows any property in the glTF file to maintain references to its dependencies,
* and makes it easy to determine where a particular property dependency is being used. For
* example, finding a list of materials that use a particular texture is as simple as calling
* {@link Texture.listParents}().
*

@@ -19,0 +20,0 @@ * A new resource {@link Property} (e.g. a {@link Mesh} or {@link Material}) is created by calling

/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/no-unused-vars */
const DECORATOR_PREFIX = '__';
/**

@@ -11,6 +13,6 @@ * @hidden

get: function () {
return this['_' + propertyKey];
return this[DECORATOR_PREFIX + propertyKey];
},
set: function (value) {
const link = this['_' + propertyKey];
const link = this[DECORATOR_PREFIX + propertyKey];

@@ -27,3 +29,3 @@ if (link && !Array.isArray(link)) {

// console.log('[GraphChild] Unassigning link: ' + propertyKey, link);
this['_' + propertyKey] = null;
this[DECORATOR_PREFIX + propertyKey] = null;
});

@@ -33,3 +35,3 @@ }

// if (value) console.log('[GraphChild] Assigning link: ' + propertyKey, value);
this['_' + propertyKey] = value;
this[DECORATOR_PREFIX + propertyKey] = value;
},

@@ -36,0 +38,0 @@ enumerable: true

@@ -15,21 +15,21 @@ import { GraphNode } from './graph-node';

export class Link<Parent extends GraphNode, Child extends GraphNode> {
private disposed = false;
private readonly listeners: (() => void)[] = [];
private _disposed = false;
private readonly _listeners: (() => void)[] = [];
constructor(
private readonly name: string,
private readonly parent: Parent,
private child: Child) {}
private readonly _name: string,
private readonly _parent: Parent,
private _child: Child) {}
/** Name. */
getName(): string { return this.name; }
getName(): string { return this._name; }
/** Owner node. */
getParent(): Parent { return this.parent; }
getParent(): Parent { return this._parent; }
/** Resource node. */
getChild(): Child { return this.child; }
getChild(): Child { return this._child; }
/** Sets the child node. */
setChild(child: Child): this {
this.child = child;
this._child = child;
return this;

@@ -40,6 +40,6 @@ }

dispose(): void {
if (this.disposed) return;
this.disposed = true;
this.listeners.forEach((fn) => fn());
this.listeners.length = 0;
if (this._disposed) return;
this._disposed = true;
this._listeners.forEach((fn) => fn());
this._listeners.length = 0;
}

@@ -49,3 +49,3 @@

onDispose(fn: () => void): this {
this.listeners.push(fn);
this._listeners.push(fn);
return this;

@@ -55,3 +55,3 @@ }

/** Whether this link has been destroyed. */
isDisposed(): boolean { return this.disposed; }
isDisposed(): boolean { return this._disposed; }
}

@@ -11,10 +11,10 @@ import { Graph } from './graph';

export abstract class GraphNode {
protected readonly graph: Graph;
private disposed = false;
protected readonly _graph: Graph;
private _disposed = false;
constructor(graph: Graph) {
this.graph = graph;
this._graph = graph;
}
/** Returns true if the node has been permanently removed from the graph. */
public isDisposed(): boolean { return this.disposed; }
public isDisposed(): boolean { return this._disposed; }

@@ -27,5 +27,5 @@ /**

public dispose(): void {
this.graph.disconnectChildren(this);
this.graph.disconnectParents(this);
this.disposed = true;
this._graph.disconnectChildren(this);
this._graph.disconnectParents(this);
this._disposed = true;
}

@@ -39,3 +39,3 @@

public detach(): this {
this.graph.disconnectParents(this);
this._graph.disconnectParents(this);
return this;

@@ -52,3 +52,3 @@ }

public swap(old: GraphNode, replacement: GraphNode): this {
this.graph.getLinks()
this._graph.getLinks()
.filter((link) => link.getParent() === this && link.getChild() === old)

@@ -96,4 +96,4 @@ .forEach((link) => (link.setChild(replacement)));

protected listGraphParents(): GraphNode[] {
return this.graph.listParents(this) as GraphNode[];
return this._graph.listParents(this) as GraphNode[];
}
}

@@ -12,6 +12,6 @@ import { Link } from './graph-links';

export class Graph {
private links: Link<GraphNode, GraphNode>[] = [];
private _links: Link<GraphNode, GraphNode>[] = [];
public getLinks(): Link<GraphNode, GraphNode>[] {
return this.links;
return this._links;
}

@@ -21,3 +21,3 @@

// TODO(optimize)
return this.links
return this._links
.filter((link) => link.getChild() === node)

@@ -29,3 +29,3 @@ .map((link) => link.getParent());

// TODO(optimize)
return this.links
return this._links
.filter((link) => link.getParent() === node)

@@ -37,3 +37,3 @@ .map((link) => link.getChild());

// TODO(optimize)
this.links
this._links
.filter((link) => link.getParent() === node)

@@ -46,3 +46,3 @@ .forEach((link) => link.dispose());

// TODO(optimize)
let links = this.links.filter((link) => link.getChild() === node);
let links = this._links.filter((link) => link.getChild() === node);
if (filter) {

@@ -71,3 +71,3 @@ links = links.filter((link) => filter(link.getParent()));

protected registerLink(link: Link<GraphNode, GraphNode>): Link<GraphNode, GraphNode> {
this.links.push(link);
this._links.push(link);
link.onDispose(() => this.unlink(link));

@@ -84,5 +84,5 @@ return link;

private unlink(link: Link<GraphNode, GraphNode>): this {
this.links = this.links.filter((l) => l !== link);
this._links = this._links.filter((l) => l !== link);
return this;
}
}

@@ -85,18 +85,18 @@ import { TypedArray } from '../constants';

/** Raw data of the accessor. */
private array: TypedArray = null;
private _array: TypedArray = null;
/** Type of element represented. */
private type: GLTF.AccessorType = GLTF.AccessorType.SCALAR;
private _type: GLTF.AccessorType = GLTF.AccessorType.SCALAR;
/** Numeric type of each component in an element. */
private componentType: GLTF.AccessorComponentType = null;
private _componentType: GLTF.AccessorComponentType = null;
/** Whether data in the raw array should be considered normalized. */
private normalized = false;
private _normalized = false;
/** Inbound transform to normalized representation, if applicable. */
private in = identity;
private _in = identity;
/** Outbound transform from normalized representation, if applicable. */
private out = identity;
private _out = identity;

@@ -168,2 +168,16 @@ /** The {@link Buffer} to which this accessor's data will be written. */

*/
public getMinNormalized(target: number[]): number[] {
const elementSize = this.getElementSize();
this.getMin(target);
for (let j = 0; j < elementSize; j++) target[j] = this._out(target[j]);
return target;
}
/**
* Minimum value of each component in this attribute. Values returned by this method do not
* reflect normalization: use {@link .getMinNormalized} in that case.
*/
public getMin(target: number[]): number[] {

@@ -177,8 +191,6 @@ const count = this.getCount();

for (let j = 0; j < elementSize; j++) {
target[j] = Math.min(target[j], this.array[i + j]);
target[j] = Math.min(target[j], this._array[i + j]);
}
}
for (let j = 0; j < elementSize; j++) target[j] = this.out(target[j]);
return target;

@@ -192,2 +204,16 @@ }

*/
public getMaxNormalized(target: number[]): number[] {
const elementSize = this.getElementSize();
this.getMax(target);
for (let j = 0; j < elementSize; j++) target[j] = this._out(target[j]);
return target;
}
/**
* Maximum value of each component in this attribute. Values returned by this method do not
* reflect normalization: use {@link .getMinNormalized} in that case.
*/
public getMax(target: number[]): number[] {

@@ -201,8 +227,6 @@ const count = this.getCount();

for (let j = 0; j < elementSize; j++) {
target[j] = Math.max(target[j], this.array[i + j]);
target[j] = Math.max(target[j], this._array[i + j]);
}
}
for (let j = 0; j < elementSize; j++) target[j] = this.out(target[j]);
return target;

@@ -220,7 +244,7 @@ }

public getCount(): number {
return this.array.length / this.getElementSize();
return this._array.length / this.getElementSize();
}
/** Type of element stored in the accessor. `VEC2`, `VEC3`, etc. */
public getType(): GLTF.AccessorType { return this.type; }
public getType(): GLTF.AccessorType { return this._type; }

@@ -232,3 +256,3 @@ /**

public setType(type: GLTF.AccessorType): Accessor {
this.type = type;
this._type = type;
return this;

@@ -243,3 +267,3 @@ }

public getElementSize(): number {
return Accessor.getElementSize(this.type);
return Accessor.getElementSize(this._type);
}

@@ -252,3 +276,3 @@

public getComponentSize(): number {
return this.array.BYTES_PER_ELEMENT;
return this._array.BYTES_PER_ELEMENT;
}

@@ -261,3 +285,3 @@

public getComponentType(): GLTF.AccessorComponentType {
return this.componentType;
return this._componentType;
}

@@ -275,3 +299,3 @@

*/
public getNormalized(): boolean { return this.normalized; }
public getNormalized(): boolean { return this._normalized; }

@@ -285,10 +309,10 @@ /**

public setNormalized(normalized: boolean): this {
this.normalized = normalized;
this._normalized = normalized;
if (normalized) {
this.out = (c: number): number => intToFloat(c, this.componentType);
this.in = (f: number): number => floatToInt(f, this.componentType);
this._out = (c: number): number => intToFloat(c, this._componentType);
this._in = (f: number): number => floatToInt(f, this._componentType);
} else {
this.out = identity;
this.in = identity;
this._out = identity;
this._in = identity;
}

@@ -309,3 +333,3 @@

const elementSize = this.getElementSize();
return this.out(this.array[index * elementSize]);
return this._out(this._array[index * elementSize]);
}

@@ -318,3 +342,3 @@

public setScalar(index: number, x: number): this {
this.array[index * this.getElementSize()] = this.in(x);
this._array[index * this.getElementSize()] = this._in(x);
return this;

@@ -330,3 +354,3 @@ }

for (let i = 0; i < elementSize; i++) {
target[i] = this.out(this.array[index * elementSize + i]);
target[i] = this._out(this._array[index * elementSize + i]);
}

@@ -343,3 +367,3 @@ return target;

for (let i = 0; i < elementSize; i++) {
this.array[index * elementSize + i] = this.in(value[i]);
this._array[index * elementSize + i] = this._in(value[i]);
}

@@ -358,3 +382,3 @@ return this;

public setBuffer(buffer: Buffer): this {
this.buffer = this.graph.link('buffer', this, buffer) as Link<Accessor, Buffer>;
this.buffer = this._graph.link('buffer', this, buffer) as Link<Accessor, Buffer>;
return this;

@@ -364,8 +388,8 @@ }

/** Returns the raw typed array underlying this accessor. */
public getArray(): TypedArray { return this.array; }
public getArray(): TypedArray { return this._array; }
/** Assigns the raw typed array underlying this accessor. */
public setArray(array: TypedArray): this {
this.componentType = arrayToComponentType(array);
this.array = array;
this._componentType = arrayToComponentType(array);
this._array = array;
return this;

@@ -376,3 +400,3 @@ }

public getByteLength(): number {
return this.array.byteLength;
return this._array.byteLength;
}

@@ -379,0 +403,0 @@ }

@@ -62,3 +62,3 @@ import { Property } from './property';

/** URI (or filename) of the buffer. */
private uri: string;
private _uri: string;

@@ -74,3 +74,3 @@ /**

public getURI(): string {
return this.uri;
return this._uri;
}

@@ -87,5 +87,5 @@

public setURI(uri: string): this {
this.uri = uri;
this._uri = uri;
return this;
}
}

@@ -200,3 +200,3 @@ import { vec3, vec4 } from '../constants';

public setBaseColorTexture(texture: Texture): this {
this.baseColorTexture = this.graph.linkTexture('baseColorTexture', this, texture);
this.baseColorTexture = this._graph.linkTexture('baseColorTexture', this, texture);
return this;

@@ -249,3 +249,3 @@ }

public setEmissiveTexture(texture: Texture): this {
this.emissiveTexture = this.graph.linkTexture('emissiveTexture', this, texture);
this.emissiveTexture = this._graph.linkTexture('emissiveTexture', this, texture);
return this;

@@ -301,3 +301,3 @@ }

public setNormalTexture(texture: Texture): this {
this.normalTexture = this.graph.linkTexture('normalTexture', this, texture);
this.normalTexture = this._graph.linkTexture('normalTexture', this, texture);
return this;

@@ -353,3 +353,3 @@ }

public setOcclusionTexture(texture: Texture): this {
this.occlusionTexture = this.graph.linkTexture('occlusionTexture', this, texture);
this.occlusionTexture = this._graph.linkTexture('occlusionTexture', this, texture);
return this;

@@ -423,5 +423,5 @@ }

public setMetallicRoughnessTexture(texture: Texture): this {
this.metallicRoughnessTexture = this.graph.linkTexture('metallicRoughnessTexture', this, texture);
this.metallicRoughnessTexture = this._graph.linkTexture('metallicRoughnessTexture', this, texture);
return this;
}
}

@@ -47,7 +47,7 @@ import { NotImplementedError } from '../constants';

/** Primitive GPU draw call list. */
@GraphChildList private _primitives: Link<Mesh, Primitive>[] = [];
@GraphChildList private primitives: Link<Mesh, Primitive>[] = [];
/** Adds a {@link Primitive} to the mesh's draw call list. */
public addPrimitive(primitive: Primitive): this {
return this.addGraphChild(this._primitives, this.graph.link('primitive', this, primitive));
return this.addGraphChild(this.primitives, this._graph.link('primitive', this, primitive));
}

@@ -57,3 +57,3 @@

public removePrimitive(primitive: Primitive): this {
return this.removeGraphChild(this._primitives, primitive);
return this.removeGraphChild(this.primitives, primitive);
}

@@ -63,3 +63,3 @@

public listPrimitives(): Primitive[] {
return this._primitives.map((p) => p.getChild());
return this.primitives.map((p) => p.getChild());
}

@@ -127,3 +127,3 @@ }

public setIndices(indices: Accessor): this {
this._indices = this.graph.linkIndex('index', this, indices) as Link<Primitive, Accessor>;
this._indices = this._graph.linkIndex('index', this, indices) as Link<Primitive, Accessor>;
return this;

@@ -143,3 +143,3 @@ }

public setAttribute(semantic: string, accessor: Accessor): this {
const link = this.graph.linkAttribute(semantic.toLowerCase(), this, accessor) as AttributeLink;
const link = this._graph.linkAttribute(semantic.toLowerCase(), this, accessor) as AttributeLink;
link.semantic = semantic;

@@ -182,3 +182,3 @@ return this.addGraphChild(this._attributes, link);

public setMaterial(material: Material): this {
this._material = this.graph.link('material', this, material) as Link<Primitive, Material>;
this._material = this._graph.link('material', this, material) as Link<Primitive, Material>;
return this;

@@ -185,0 +185,0 @@ }

@@ -38,5 +38,5 @@ import { vec3, vec4 } from '../constants';

public readonly propertyType = 'Node';
private translation: vec3 = [0, 0, 0];
private rotation: vec4 = [0, 0, 0, 1];
private scale: vec3 = [1, 1, 1];
private _translation: vec3 = [0, 0, 0];
private _rotation: vec4 = [0, 0, 0, 1];
private _scale: vec3 = [1, 1, 1];

@@ -47,13 +47,13 @@ @GraphChild private mesh: Link<Node, Mesh> = null;

/** Returns the translation (position) of this node in local space. */
public getTranslation(): vec3 { return this.translation; }
public getTranslation(): vec3 { return this._translation; }
/** Returns the rotation (quaternion) of this node in local space. */
public getRotation(): vec4 { return this.rotation; }
public getRotation(): vec4 { return this._rotation; }
/** Returns the scale of this node in local space. */
public getScale(): vec3 { return this.scale; }
public getScale(): vec3 { return this._scale; }
/** Sets the translation (position) of this node in local space. */
public setTranslation(translation: vec3): this {
this.translation = translation;
this._translation = translation;
return this;

@@ -64,3 +64,3 @@ }

public setRotation(rotation: vec4): this {
this.rotation = rotation;
this._rotation = rotation;
return this;

@@ -71,3 +71,3 @@ }

public setScale(scale: vec3): this {
this.scale = scale;
this._scale = scale;
return this;

@@ -78,3 +78,3 @@ }

public addChild(child: Node): this {
const link = this.graph.link('child', this, child) as Link<Root, Node>;
const link = this._graph.link('child', this, child) as Link<Root, Node>;
return this.addGraphChild(this.children, link);

@@ -101,5 +101,5 @@ }

public setMesh(mesh: Mesh): this {
this.mesh = this.graph.link('mesh', this, mesh) as Link<Node, Mesh>;
this.mesh = this._graph.link('mesh', this, mesh) as Link<Node, Mesh>;
return this;
}
}

@@ -44,10 +44,10 @@ import { NotImplementedError } from '../constants';

protected readonly graph: PropertyGraph;
protected name = '';
protected readonly _graph: PropertyGraph;
protected _name = '';
// TODO(feat): Extras should be Properties.
protected extras: object = {};
protected _extras: object = {};
// TODO(feat): Extensions should be Properties.
protected extensions: object = {};
protected _extensions: object = {};

@@ -57,3 +57,3 @@ /** @hidden */

super(graph);
this.name = name;
this._name = name;
}

@@ -66,3 +66,3 @@

*/
public getName(): string { return this.name; }
public getName(): string { return this._name; }

@@ -75,3 +75,3 @@ /**

public setName(name: string): this {
this.name = name;
this._name = name;
return this;

@@ -81,7 +81,7 @@ }

/** @hidden */
public getExtras(): object { return this.extras; }
public getExtras(): object { return this._extras; }
/** @hidden */
public setExtras(extras: object): this {
this.extras = extras;
this._extras = extras;
return this;

@@ -91,7 +91,7 @@ }

/** @hidden */
public getExtensions(): object { return this.extensions; }
public getExtensions(): object { return this._extensions; }
/** @hidden */
public setExtensions(extensions: object): this {
this.extensions = extensions;
this._extensions = extensions;
return this;

@@ -110,3 +110,3 @@ }

// Detaching should keep properties in the same Document, and attached to its root.
this.graph.disconnectParents(this, (n: Property) => n.propertyType !== 'Root');
this._graph.disconnectParents(this, (n: Property) => n.propertyType !== 'Root');
return this;

@@ -113,0 +113,0 @@ }

@@ -47,3 +47,3 @@ import { NotImplementedError, VERSION } from '../constants';

private readonly asset: GLTF.IAsset = {
private readonly _asset: GLTF.IAsset = {
generator: `glTF-Transform ${VERSION}`,

@@ -67,3 +67,3 @@ version: '2.0'

*/
public getAsset(): GLTF.IAsset { return this.asset; }
public getAsset(): GLTF.IAsset { return this._asset; }

@@ -75,3 +75,3 @@ /**

public addScene(scene: Scene): this {
return this.addGraphChild(this.scenes, this.graph.link('scene', this, scene) as Link<Root, Scene>);
return this.addGraphChild(this.scenes, this._graph.link('scene', this, scene) as Link<Root, Scene>);
}

@@ -97,3 +97,3 @@

public addNode(node: Node): this {
return this.addGraphChild(this.nodes, this.graph.link('node', this, node) as Link<Root, Node>);
return this.addGraphChild(this.nodes, this._graph.link('node', this, node) as Link<Root, Node>);
}

@@ -119,3 +119,3 @@

public addMesh(mesh: Mesh): this {
return this.addGraphChild(this.meshes, this.graph.link('mesh', this, mesh) as Link<Root, Mesh>);
return this.addGraphChild(this.meshes, this._graph.link('mesh', this, mesh) as Link<Root, Mesh>);
}

@@ -141,3 +141,3 @@

public addMaterial(material: Material): this {
return this.addGraphChild(this.materials, this.graph.link('material', this, material) as Link<Root, Material>);
return this.addGraphChild(this.materials, this._graph.link('material', this, material) as Link<Root, Material>);
}

@@ -163,3 +163,3 @@

public addTexture(texture: Texture): this {
return this.addGraphChild(this.textures, this.graph.link('texture', this, texture) as Link<Root, Texture>);
return this.addGraphChild(this.textures, this._graph.link('texture', this, texture) as Link<Root, Texture>);
}

@@ -185,3 +185,3 @@

public addAccessor(accessor: Accessor): this {
return this.addGraphChild(this.accessors, this.graph.link('accessor', this, accessor) as Link<Root, Accessor>);
return this.addGraphChild(this.accessors, this._graph.link('accessor', this, accessor) as Link<Root, Accessor>);
}

@@ -207,3 +207,3 @@

public addBuffer(buffer: Buffer): this {
return this.addGraphChild(this.buffers, this.graph.link('buffer', this, buffer) as Link<Root, Buffer>);
return this.addGraphChild(this.buffers, this._graph.link('buffer', this, buffer) as Link<Root, Buffer>);
}

@@ -210,0 +210,0 @@

@@ -29,3 +29,3 @@ import { GraphChildList, Link } from '../graph/index';

public addNode(node: Node): this {
return this.addGraphChild(this.nodes, this.graph.link('node', this, node) as Link<Root, Node>);
return this.addGraphChild(this.nodes, this._graph.link('node', this, node) as Link<Root, Node>);
}

@@ -32,0 +32,0 @@

@@ -143,6 +143,6 @@ import { vec2 } from '../constants';

private magFilter: GLTF.TextureMagFilter = null;
private minFilter: GLTF.TextureMinFilter = null;
private wrapS: GLTF.TextureWrapMode = GLTF.TextureWrapMode.REPEAT;
private wrapT: GLTF.TextureWrapMode = GLTF.TextureWrapMode.REPEAT;
private _magFilter: GLTF.TextureMagFilter = null;
private _minFilter: GLTF.TextureMinFilter = null;
private _wrapS: GLTF.TextureWrapMode = GLTF.TextureWrapMode.REPEAT;
private _wrapT: GLTF.TextureWrapMode = GLTF.TextureWrapMode.REPEAT;

@@ -177,7 +177,7 @@ /** UV wrapping mode. Values correspond to WebGL enums. */

/** Returns the magnification filter applied to the texture. */
public getMagFilter(): GLTF.TextureMagFilter { return this.magFilter; }
public getMagFilter(): GLTF.TextureMagFilter { return this._magFilter; }
/** Sets the magnification filter applied to the texture. */
public setMagFilter(magFilter: GLTF.TextureMagFilter): this {
this.magFilter = magFilter;
this._magFilter = magFilter;
return this;

@@ -187,7 +187,7 @@ }

/** Sets the minification filter applied to the texture. */
public getMinFilter(): GLTF.TextureMinFilter { return this.minFilter; }
public getMinFilter(): GLTF.TextureMinFilter { return this._minFilter; }
/** Returns the minification filter applied to the texture. */
public setMinFilter(minFilter: GLTF.TextureMinFilter): this {
this.minFilter = minFilter;
this._minFilter = minFilter;
return this;

@@ -201,7 +201,7 @@ }

/** Returns the S (U) wrapping mode for UVs used by the texture. */
public getWrapS(): GLTF.TextureWrapMode { return this.wrapS; }
public getWrapS(): GLTF.TextureWrapMode { return this._wrapS; }
/** Sets the S (U) wrapping mode for UVs used by the texture. */
public setWrapS(wrapS: GLTF.TextureWrapMode): this {
this.wrapS = wrapS;
this._wrapS = wrapS;
return this;

@@ -211,9 +211,9 @@ }

/** Returns the T (V) wrapping mode for UVs used by the texture. */
public getWrapT(): GLTF.TextureWrapMode { return this.wrapT; }
public getWrapT(): GLTF.TextureWrapMode { return this._wrapT; }
/** Sets the T (V) wrapping mode for UVs used by the texture. */
public setWrapT(wrapT: GLTF.TextureWrapMode): this {
this.wrapT = wrapT;
this._wrapT = wrapT;
return this;
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc