@loaders.gl/gltf
Advanced tools
Comparing version 1.1.0-beta.1 to 1.1.0
@@ -1,1 +0,1 @@ | ||
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var s=t();for(var r in s)("object"==typeof exports?exports:e)[r]=s[r]}}(window,function(){return function(e){var t={};function s(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,s),n.l=!0,n.exports}return s.m=e,s.c=t,s.d=function(e,t,r){s.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.t=function(e,t){if(1&t&&(e=s(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(s.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)s.d(r,n,function(t){return e[t]}.bind(null,n));return r},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,"a",t),t},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.p="",s(s.s=8)}([function(e,t,s){"use strict";(function(e,r){s.d(t,"b",function(){return n}),s.d(t,"a",function(){return o});const n="object"!=typeof e||"[object process]"!==String(e)||e.browser,i={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:void 0!==r&&r,document:"undefined"!=typeof document&&document},o=i.global||i.self||i.window}).call(this,s(9),s(6))},,,,,,function(e,t){var s;s=function(){return this}();try{s=s||new Function("return this")()}catch(e){"object"==typeof window&&(s=window)}e.exports=s},,function(e,t,s){(function(t){const r=s(10),n="undefined"==typeof window?t:window;n.loaders=n.loaders||{},e.exports=Object.assign(n.loaders,r)}).call(this,s(6))},function(e,t){var s,r,n=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function u(e){if(s===setTimeout)return setTimeout(e,0);if((s===i||!s)&&setTimeout)return s=setTimeout,setTimeout(e,0);try{return s(e,0)}catch(t){try{return s.call(null,e,0)}catch(t){return s.call(this,e,0)}}}!function(){try{s="function"==typeof setTimeout?setTimeout:i}catch(e){s=i}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var a,f=[],c=!1,h=-1;function l(){c&&a&&(c=!1,a.length?f=a.concat(f):h=-1,f.length&&g())}function g(){if(!c){var e=u(l);c=!0;for(var t=f.length;t;){for(a=f,f=[];++h<t;)a&&a[h].run();h=-1,t=f.length}a=null,c=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function d(e,t){this.fun=e,this.array=t}function m(){}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var s=1;s<arguments.length;s++)t[s-1]=arguments[s];f.push(new d(e,t)),1!==f.length||c||u(g)},d.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=m,n.addListener=m,n.once=m,n.off=m,n.removeListener=m,n.removeAllListeners=m,n.emit=m,n.prependListener=m,n.prependOnceListener=m,n.listeners=function(e){return[]},n.binding=function(e){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(e){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},function(e,t,s){"use strict";s.r(t);var r={};s.r(r),s.d(r,"KHR_draco_mesh_compression",function(){return Y}),s.d(r,"KHR_lights_punctual",function(){return Z});const n="KHR_draco_mesh_compression",i="UBER_draco_point_cloud_compression",o="KHR_lights_punctual";const u=e=>"undefined"!=typeof File&&e instanceof File;let a="";const f={};function c(e){for(const t in f)if(e.startsWith(t)){const s=f[t];return e.replace(t,s)}return e+=a}function h(e,t){if(!e)throw new Error(t||"loader assertion failed.")}class l{constructor(e){this._file=e,this._promise=new Promise((e,t)=>{try{this._reader=new FileReader,this._reader.onerror=(e=>t(new Error(e))),this._reader.onabort=(()=>t(new Error("Read aborted."))),this._reader.onload=(()=>e(this._reader.result))}catch(e){t(e)}})}headers(){return{}}url(){return this._file.name}async arrayBuffer(){return this.bodyUsed=!0,this._reader.readAsArrayBuffer(this._file),this._promise}async text(){return this.bodyUsed=!0,this._reader.readAsText(this._file),this._promise}async json(){return JSON.parse(this.text())}get body(){h(!1)}}async function g(e,t){const s=function(e,t){return new l(e,t)}(e,t);return"text"===t.dataType?s.text():s.arrayBuffer()}async function d(e,t){return u(e)?g(e,t):(e=c(e),fetch(e,t))}function m(e,t){if(!e)throw new Error(t||"gltf/glb assertion failed.")}const p=["SCALAR","VEC2","VEC3","VEC4"],y=new Map([[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126]]),b={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},w={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},x={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function j(e){return p[e-1]||p[0]}function _(e){const t=y.get(e.constructor);if(!t)throw new Error("Illegal typed array");return t}function v(e,t){const s=x[e.componentType],r=b[e.type],n=w[e.componentType],i=e.count*r,o=e.count*r*n;return m(o>=0&&o<=t.byteLength),{ArrayType:s,length:i,byteLength:o}}function A(e,t){return e.startsWith("data:")||e.startsWith("http:")||e.startsWith("https:")?e:t.substr(0,t.lastIndexOf("/")+1)+e}new Map;var T=s(0);const B=T.a.TextEncoder,L=T.a.TextDecoder;function V(e){return e+3&-4}const E=1735152710,U=12,S=8,O=1313821514,R=5130562,k=!0,C=!1;function M(e,t=0,s={}){const r=new DataView(e),{magic:n=E}=s,i=r.getUint32(t,!1);return i===n||i===E}function P(e,t,s=0,r={}){const n=new DataView(t);e.byteOffset=s,e.magic=n.getUint32(s+0,C),e.version=n.getUint32(s+4,k),e.byteLength=n.getUint32(s+8,k),e.type=function(e){return`${String.fromCharCode(e.getUint8(0))}${String.fromCharCode(e.getUint8(1))}${String.fromCharCode(e.getUint8(2))}${String.fromCharCode(e.getUint8(3))}`}(n);const{magic:i=E}=r;e.magic===E||e.magic===i||console.warn(`Invalid GLB magic string ${e.type}`),h(2===e.version,`Invalid GLB version ${e.version}. Only .glb v2 supported`),h(e.byteLength>20);const o=n.getUint32(s+12,k),u=n.getUint32(s+16,k);h(u===O||0===u,`JSON chunk format ${u}`);const a=U+S,f=new Uint8Array(t,s+a,o),c=new L("utf8").decode(f);e.json=JSON.parse(c);const l=a+V(o);if(e.hasBinChunk=l+8<=e.byteLength,e.hasBinChunk){const t=n.getUint32(s+l+0,k),r=n.getUint32(s+l+4,k);h(r===R||1===r,`BIN chunk format ${r}`);const i=l+S;e.binChunkByteOffset=i,e.binChunkLength=t}return s+e.byteLength}const D=!1,F=!0,I=new Map([["image/png",{test:function(e){return e.byteLength>=24&&2303741511===e.getUint32(0,D)},getSize:function(e){return{width:e.getUint32(16,D),height:e.getUint32(20,D)}}}],["image/jpeg",{test:function(e){return e.byteLength>=2&&65496===e.getUint16(0,D)},getSize:function(e){if(e.byteLength<2||65496!==e.getUint16(0,D))return null;const{tableMarkers:t,sofMarkers:s}=function(){const e=new Set([65499,65476,65484,65501,65534]);for(let t=65504;t<65520;++t)e.add(t);const t=new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502]);return{tableMarkers:e,sofMarkers:t}}();let r=2;for(;r<e.byteLength;){const n=e.getUint16(r,D);if(s.has(n))return{height:e.getUint16(r+5,D),width:e.getUint16(r+7,D)};if(!t.has(n))return null;r+=2,r+=e.getUint16(r,D)}return null}}],["image/gif",{test:function(e){return e.byteLength>=10&&1195984440===e.getUint32(0,D)},getSize:function(e){return{width:e.getUint16(6,F),height:e.getUint16(8,F)}}}],["image/bmp",{test:function(e){return e.byteLength>=2&&16973===e.getUint16(0,D)},getSize:function(e){return{width:e.getUint32(18,F),height:e.getUint32(22,F)}}}]]);const $=`Invalid MIME type. Supported MIME types are: ${Array.from(I.keys()).join(", ")}`;function q(e){const t=z(e);for(const[e,{test:s}]of I.entries())if(s(t))return e;return null}function G(e,t=null){const s=function(e,t=null){t=t||q(e);const{getSize:s}=N(t),r=s(z(e));if(!r)throw new Error(`invalid image data for type: ${t}`);return r}(e,t=t||q(e));return s.mimeType=t,s}function N(e){const t=I.get(e);if(!t)throw new Error($);return t}function z(e){if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return new DataView(e.buffer||e);throw new Error("toDataView")}function W(e,t,s,r){const n=K(s.byteLength),i=n-s.byteLength;if(e){const r=new Uint8Array(e.buffer,e.byteOffset+t,s.byteLength),n=new Uint8Array(s);r.set(n);for(let r=0;r<i;++r)e.setUint8(t+s.byteLength+r,32)}return t+=n}function K(e){return e+3&-4}function H(e,t,s){let r;if(e instanceof ArrayBuffer)r=new Uint8Array(e);else{const t=e.byteOffset,s=e.byteLength;r=new Uint8Array(e.buffer,t,s)}return t.set(r,s),s+K(r.byteLength)}class J{constructor(e){if(e instanceof J)return e;e||(e={json:{version:2,buffers:[]},binary:null}),this.gltf=e}get json(){return this.gltf.json}getApplicationData(e){return this.json[e]}getExtraData(e){return(this.json.extras||{})[e]}getExtension(e){const t=this.getUsedExtensions().find(t=>t===e),s=this.json.extensions||{};return t?s[e]||!0:null}getRequiredExtension(e){return this.getRequiredExtensions().find(t=>t===e)?this.getExtension(e):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getObjectExtension(e,t){return(e.extensions||{})[t]}getScene(e){return this.getObject("scenes",e)}getNode(e){return this.getObject("nodes",e)}getSkin(e){return this.getObject("skins",e)}getMesh(e){return this.getObject("meshes",e)}getMaterial(e){return this.getObject("materials",e)}getAccessor(e){return this.getObject("accessors",e)}getCamera(e){return null}getTexture(e){return this.getObject("textures",e)}getSampler(e){return this.getObject("samplers",e)}getImage(e){return this.getObject("images",e)}getBufferView(e){return this.getObject("bufferViews",e)}getBuffer(e){return this.getObject("buffers",e)}getObject(e,t){if("object"==typeof t)return t;const s=this.gltf[e]&&this.gltf[e][t];return s||console.warn(`glTF file error: Could not find ${e}[${t}]`),s}getTypedArrayForBufferView(e){e=this.getBufferView(e);const t=this.getBuffer(e.buffer).data,s=e.byteOffset||0;return new Uint8Array(t,s,e.byteLength)}getTypedArrayForAccessor(e){e=this.getAccessor(e);const t=this.getBuffer(e.bufferView),s=this.getBuffer(t.buffer).data,{ArrayType:r,length:n}=v(e,t);return new r(s,t.byteOffset+e.byteOffset,n)}getTypedArrayForImageData(e){e=this.getAccessor(e);const t=this.getBuffer(e.bufferView),s=this.getBuffer(t.buffer).data,r=t.byteOffset||0;return new Uint8Array(s,r,t.byteLength)}addApplicationData(e,t){return this.json[e]=t,this}addExtraData(e,t){return this.json.extras=this.json.extras||{},this.json.extras[e]=t,this}addExtension(e,t){return m(t),this.json.extensions=this.json.extensions||{},this.json.extensions[e]=t,this.registerUsedExtension(e),this}addRequiredExtension(e,t){return m(t),this.addExtension(e,t),this.registerRequiredExtension(e),this}registerUsedExtension(e){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find(t=>t===e)||this.json.extensionsUsed.push(e)}registerRequiredExtension(e){this.registerUsedExtension(e),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find(t=>t===e)||this.json.extensionsRequired.push(e)}removeExtension(e){this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,e),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,e),this.json.extensions&&delete this.json.extensions[e]}setObjectExtension(e,t,s){(e.extensions||{})[t]=s}addMesh(e,t,s=4){const r={primitives:[{attributes:this._addAttributes(e),indices:t,mode:s}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(r),this.json.meshes.length-1}addPointCloud(e){const t={primitives:[{attributes:this._addAttributes(e),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(t),this.json.meshes.length-1}addImage(e,t){t=t||q(e);const s={bufferView:this.addBufferView(e),mimeType:t};return this.json.images=this.json.images||[],this.json.images.push(s),this.json.images.length-1}addBufferView(e){const t=e.byteLength||e.length;this.byteLength+=K(t),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(e);const s={buffer:0,byteOffset:this.byteLength,byteLength:t};return this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(s),this.json.bufferViews.length-1}addAccessor(e,t){const s={bufferView:e,type:j(t.size),componentType:t.componentType,count:t.count};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(s),this.json.accessors.length-1}addBinaryBuffer(e,t={size:3}){const s=this.addBufferView(e),r={size:t.size,componentType:_(e),count:Math.round(e.length/t.size)};return this.addAccessor(s,Object.assign(r,t))}createBinaryChunk(){if(this.arrayBuffer)return;const e=this.byteLength,t=new ArrayBuffer(e),s=new Uint8Array(t);let r=0;for(let e=0;e<this.sourceBuffers.length;e++){r=H(this.sourceBuffers[e],s,r)}this.json.buffers[0].byteLength=e,this.arrayBuffer=t,this.sourceBuffers=[]}_removeStringFromArray(e,t){let s=!0;for(;s;){const r=e.indexOf(t);r>-1?e.splice(r,1):s=!1}}}function X(e){const t={};for(const s in e){const r=e[s];if("indices"!==s){const e=Q(r);t[s]=e}}return t}function Q(e,t){const{buffer:s,size:r,count:n}=function(e,t){let s=e,r=1,n=0;e&&e.value&&(s=e.value,r=e.size||1);s&&(ArrayBuffer.isView(s)||(s=function(e,t,s=!1){if(!e)return null;if(Array.isArray(e))return new t(e);if(s&&!(e instanceof t))return new t(e);return e}(s,Float32Array)),n=s.length/r);return{buffer:s,size:r,count:n}}(e);return{value:s,size:r,bufferView:null,byteOffset:0,count:n,type:j(r),componentType:_(s)}}class Y{static get name(){return n}static decode(e,t){const s=new J(e);for(const e of s.json.meshes||[])Y.decompressMesh(e,t);s.removeExtension(n)}static encode(e,t){const s=new J(e);for(const e of s.json.meshes||[])Y.compressMesh(e,t),s.addRequiredExtension(n)}static compressMesh(e,t,s=4,r={}){if(!r.DracoWriter||!r.DracoLoader)throw new Error("DracoWriter/DracoLoader not available");const i=r.DracoWriter.encodeSync({attributes:e}),o=r.DracoLoader.parseSync({attributes:e}),u=r._addFauxAttributes(o.attributes),a=r.addBufferView(i);return{primitives:[{attributes:u,mode:s,extensions:{[n]:{bufferView:a,attributes:u}}}]}}static decompressMesh(e,t={}){for(const s of e.primitives)if(Y._decompressMeshPrimitive(s,t),!s.attributes||0===Object.keys(s.attributes).length)throw new Error("Empty glTF primitive: decompression failure?")}static _decompressMeshPrimitive(e,t){const s=e.extensions&&e.extensions[n];if(!s)return;if(!t.DracoLoader||!t.decompress)return;delete e.extensions[n];const r=this._getBufferViewArray(s.bufferView),i=t.DracoLoader.parseSync(r);e.attributes=X(i.attributes),i.indices&&(e.indices=Q(i.indices))}}class Z{static get name(){return o}static decode(e,t){const s=new J(e),r=s.getExtension(o);r&&(s.json.lights=r.lights,s.removeExtension(o));for(const e of s.nodes||[]){const t=e.extensions&&e.extensions.KHR_lights_punctual;t&&(e.light=s._get("lights",t.light),delete e.extensions.KHR_lights_punctual)}}static encode(e,t){const s=new J(e),{json:r}=s;if(r.lights){const e=s.addExtensions(o);m(!e.lights),e.lights=r.lights,delete r.lights}if(s.json.lights){for(const e of s.json.lights){const t=e.node;s.addObjectExtension(t,o,e)}delete s.json.lights}}}const ee={fetchLinkedResources:!1,decompress:!1,DracoLoader:null,postProcess:!0,createImages:!1,log:console},te={fetchLinkedResources:!0,fetch:d,decompress:!1,DracoLoader:null,postProcess:!0,createImages:!1,log:console};function se(e,t,s=0,n={}){n=Object.assign({},ee,n);let i=t;if(i instanceof ArrayBuffer&&!M(i,s,n)){i=(new TextDecoder).decode(i)}if(e.buffers=[],"string"==typeof i?e.json=JSON.parse(i):i instanceof ArrayBuffer?(s=P(e,i,s,n),e.hasBinChunk&&e.buffers.push({arrayBuffer:i,byteOffset:e.binChunkByteOffset,byteLength:e.binChunkLength})):e.json=i,n.uri&&(e.baseUri=n.uri),n.fetchLinkedResources)for(const t of e.json.buffers||[])if(t.uri)throw new Error("parseGLTFSync: Cannot decode uri buffers");return function(e,t){for(const s in r){const n=s in t&&!t[s];if(!n){const n=r[s];n.decode(e,t)}}}(e,n),s}async function re(e,t,s=0,r={}){return r=Object.assign({},te,r),se(e,t,s,{...r,fetchLinkedResources:!1,postProcess:!1,decompress:!1}),r.fetchLinkedResources&&await async function(e,t){for(const s of e.json.buffers)if(s.uri){const e=t.fetch||window.fetch;m(e);const r=A(s.uri,t.uri),n=await e(r),i=await n.arrayBuffer();s.data=i,delete s.uri}}(e,r),e}function ne(e,t,s={}){return function e(t,s,r,n={}){const i=t;const o=function(e,t){const s=function(e){if("string"==typeof e){if(0===e.indexOf("##/"))return e.slice(1);let t=e.match(/#\/([a-z]+)\/([0-9]+)/);if(t){const e=parseInt(t[2],10);return[t[1],e]}if(t=e.match(/\$\$\$([0-9]+)/)){const e=parseInt(t[1],10);return["accessors",e]}}return null}(e);if(s){const[r,n]=s,i=t[r]&&t[r][n];if(i)return i;console.error(`Invalid JSON pointer ${e}: #/${r}/${n}`)}return null}(i,r);if(o)return o;if(Array.isArray(i))return i.map(t=>e(t,s,r,n));if(null!==i&&"object"==typeof i){const t={};for(const o in i)t[o]=e(i[o],s,r,n);return t}return i}(e,e,t,s)}function ie(e,t,s){s&&(e=function(e,t){const s=e.byteLength-t,r=new ArrayBuffer(s),n=new Uint8Array(e),i=new Uint8Array(r);for(let e=0;e<s;e++)i[e]=n[t+e];return r}(e,s));const r=t.bufferViews||[];for(let e=0;e<r.length;++e){m(r[e].byteLength>=0)}return{accessors:oe(e,r,t),images:ue(e,r,t)}}function oe(e,t,s){const r=s.accessors||[],n=[];for(let s=0;s<r.length;++s){const i=r[s];m(i);const o=t[i.bufferView];if(o){const{ArrayType:t,length:s}=v(i,o),r=new t(e,o.byteOffset,s);r.accessor=i,n.push(r)}}return n}function ue(e,t,s){const r=s.images||[],n=[];for(let s=0;s<r.length;++s){const i=r[s];m(i);const o=t[i.bufferView];m(o);const u=new Uint8Array(e,o.byteOffset,o.byteLength);u.imate=i,n.push(u)}return n}class ae{static isGLB(e,t={}){return M(e,0)}parse(e,t={}){return this.parseSync(e,t)}parseSync(e,t={}){if(this.glbArrayBuffer=e,this.binaryByteOffset=null,this.packedJson=null,this.json=null,null===this.json&&null===this.binaryByteOffset){const e=0;P(this,this.glbArrayBuffer,e,t),this.binaryByteOffset=this.binChunkByteOffset,this.packedJson=this.json;const s=ie(this.glbArrayBuffer,this.json,this.binaryByteOffset);this.json=ne(this.json,s),this.unpackedBuffers=s}return this}getApplicationData(e){return this.json[e]}getJSON(){return this.json}getArrayBuffer(){return this.glbArrayBuffer}getBinaryByteOffset(){return this.binaryByteOffset}getBufferView(e){const t=(e.byteOffset||0)+this.binaryByteOffset;return new Uint8Array(this.glbArrayBuffer,t,e.byteLength)}getBuffer(e){const t=x[e.componentType],s=b[e.type],r=w[e.componentType],n=e.count*s,i=e.count*s*r,o=this.json.bufferViews[e.bufferView];m(i>=0&&e.byteOffset+i<=o.byteLength);const u=o.byteOffset+this.binaryByteOffset+e.byteOffset;return new t(this.glbArrayBuffer,u,n)}getImageData(e){return{typedArray:this.getBufferView(e.bufferView),mimeType:e.mimeType||"image/jpeg"}}getImage(e){const t=this.getBufferView(e.bufferView),s=e.mimeType||"image/jpeg",r=new Blob([t],{type:s}),n=(self.URL||self.webkitURL).createObjectURL(r),i=new Image;return i.src=n,i}getImageAsync(e){return new Promise(t=>{const s=this.getBufferView(e.bufferView),r=e.mimeType||"image/jpeg",n=new Blob([s],{type:r}),i=(self.URL||self.webkitURL).createObjectURL(n),o=new Image;o.onload=(()=>t(o)),o.src=i})}}const fe={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ce={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},he={magFilter:10240,minFilter:10241,wrapS:10242,wrapT:10243};class le{postProcess(e,t,s={}){return this.gltf=e,this.glbParser=t,this._resolveToTree(s),this.gltf}_resolveToTree(e={}){const{gltf:t}=this;return(t.bufferViews||[]).forEach((e,t)=>this._resolveBufferView(e,t)),(t.images||[]).forEach((t,s)=>this._resolveImage(t,s,e)),(t.samplers||[]).forEach((e,t)=>this._resolveSampler(e,t)),(t.textures||[]).forEach((e,t)=>this._resolveTexture(e,t)),(t.accessors||[]).forEach((e,t)=>this._resolveAccessor(e,t)),(t.materials||[]).forEach((e,t)=>this._resolveMaterial(e,t)),(t.meshes||[]).forEach((e,t)=>this._resolveMesh(e,t)),(t.nodes||[]).forEach((e,t)=>this._resolveNode(e,t)),(t.skins||[]).forEach((e,t)=>this._resolveSkin(e,t)),(t.scenes||[]).forEach((e,t)=>this._resolveScene(e,t)),void 0!==t.scene&&(t.scene=t.scenes[this.gltf.scene]),this._process_extension_KHR_lights_punctual(),t}getScene(e){return this._get("scenes",e)}getNode(e){return this._get("nodes",e)}getSkin(e){return this._get("skins",e)}getMesh(e){return this._get("meshes",e)}getMaterial(e){return this._get("materials",e)}getAccessor(e){return this._get("accessors",e)}getCamera(e){return null}getTexture(e){return this._get("textures",e)}getSampler(e){return this._get("samplers",e)}getImage(e){return this._get("images",e)}getBufferView(e){return this._get("bufferViews",e)}getBuffer(e){return this._get("buffers",e)}_get(e,t){if("object"==typeof t)return t;const s=this.gltf[e]&&this.gltf[e][t];return s||console.warn(`glTF file error: Could not find ${e}[${t}]`),s}_resolveScene(e,t){e.id=`scene-${t}`,e.nodes=(e.nodes||[]).map(e=>this.getNode(e))}_resolveNode(e,t){e.id=`node-${t}`,e.children=(e.children||[]).map(e=>this.getNode(e)),void 0!==e.mesh&&(e.mesh=this.getMesh(e.mesh)),void 0!==e.camera&&(e.camera=this.getCamera(e.camera)),void 0!==e.skin&&(e.skin=this.getSkin(e.skin))}_resolveSkin(e,t){e.id=`skin-${t}`,e.inverseBindMatrices=this.getAccessor(e.inverseBindMatrices)}_resolveMesh(e,t){e.id=`mesh-${t}`;for(const t of e.primitives){for(const e in t.attributes)t.attributes[e]=this.getAccessor(t.attributes[e]);void 0!==t.indices&&(t.indices=this.getAccessor(t.indices)),void 0!==t.material&&(t.material=this.getMaterial(t.material))}}_resolveMaterial(e,t){if(e.id=`material-${t}`,e.normalTexture&&(e.normalTexture.texture=this.getTexture(e.normalTexture.index)),e.occlusionTexture&&(e.occlusionTexture.texture=this.getTexture(e.occlusionTexture.index)),e.emissiveTexture&&(e.emissiveTexture.texture=this.getTexture(e.emissiveTexture.index)),e.pbrMetallicRoughness){const t=e.pbrMetallicRoughness;t.baseColorTexture&&(t.baseColorTexture.texture=this.getTexture(t.baseColorTexture.index)),t.metallicRoughnessTexture&&(t.metallicRoughnessTexture.texture=this.getTexture(t.metallicRoughnessTexture.index))}}_resolveAccessor(e,t){e.id=`accessor-${t}`,void 0!==e.bufferView&&(e.bufferView=this.getBufferView(e.bufferView)),e.bytesPerComponent=ce[e],e.components=fe[e],e.bytesPerElement=e.bytesPerComponent*e.components}_resolveTexture(e,t){e.id=`texture-${t}`,e.sampler=this.getSampler(e.sampler),e.source=this.getImage(e.source)}_resolveSampler(e,t){e.id=`sampler-${t}`,e.parameters={};for(const t in e){const s=this._enumSamplerParameter(t);void 0!==s&&(e.parameters[s]=e[t])}}_enumSamplerParameter(e){return he[e]}_resolveImage(e,t,s){e.id=`image-${t}`,void 0!==e.bufferView&&(e.bufferView=this.getBufferView(e.bufferView));const{createImages:r=!0}=s;r?e.image=this.glbParser.getImage(e):e.getImageAsync=(()=>this.glbParser?this.glbParser.getImageAsync(e):e.uri?new Promise(t=>{const r=new Image;r.crossOrigin="anonymous",r.onload=(()=>t(r)),r.src=A(e.uri,s.uri)}):null)}_resolveBufferView(e,t){if(e.id=`bufferView-${t}`,e.buffer=this.getBuffer(e.buffer),this.glbParser)e.data=this.glbParser.getBufferView(e);else{const t=e.byteOffset||0;e.data=new Uint8Array(e.buffer.data,t,e.byteLength)}}_resolveCamera(e){e.perspective,e.orthographic}_process_extension_KHR_lights_punctual(){const{gltf:e}=this,t=e.extensions&&e.extensions.KHR_lights_punctual;t&&(e.lights=t.lights),this._removeExtension("KHR_lights_punctual");for(const t of e.nodes||[]){const e=t.extensions&&t.extensions.KHR_lights_punctual;e&&(t.light=this._get("lights",e.light),delete t.extensions.KHR_lights_punctual)}delete e.lights}_removeExtension(e){this.gltf.extensionsRequired&&this._removeStringFromArray(this.gltf.extensionsRequired,e),this.gltf.extensionsUsed&&this._removeStringFromArray(this.gltf.extensionsUsed,e),this.gltf.extensions&&delete this.gltf.extensions[e]}_removeStringFromArray(e,t){let s=!0;for(;s;){const r=e.indexOf(t);r>-1?e.splice(r,1):s=!1}}}const ge={fetchLinkedResources:!0,fetch:d,decompress:!1,DracoLoader:null,postProcess:!0,createImages:!1,log:console};class de{async parse(e,t={}){if(t=Object.assign({},ge,t),this.parseSync(e,{...t,postProcess:!1,decompress:!1}),t.fetchLinkedResources&&await this._loadLinkedAssets(t),t.decompress&&this._decompressMeshes(t),t.postProcess){(new le).postProcess(this.gltf,this.glbParser,t)}return this.gltf}parseSync(e,t={}){if(t=Object.assign({},ge,t),e instanceof ArrayBuffer&&!ae.isGLB(e,t)){e=(new L).decode(e)}if("string"==typeof e&&(e=JSON.parse(e)),e instanceof ArrayBuffer?(this.glbParser=new ae,this.gltf=this.glbParser.parseSync(e).json,this.json=this.gltf):(this.glbParser=null,this.gltf=e,this.json=e),t.decompress&&this._decompressMeshes(t),t.postProcess){(new le).postProcess(this.gltf,this.glbParser,t)}return this.gltf}getApplicationData(e){return this.json[e]}getExtraData(e){return(this.json.extras||{})[e]}getExtension(e){const t=this.getUsedExtensions().find(t=>t===e),s=this.json.extensions||{};return t?s[e]||!0:null}getRequiredExtension(e){return this.getRequiredExtensions().find(t=>t===e)?this.getExtension(e):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getScene(e){return this._get("scenes",e)}getNode(e){return this._get("nodes",e)}getSkin(e){return this._get("skins",e)}getMesh(e){return this._get("meshes",e)}getMaterial(e){return this._get("materials",e)}getAccessor(e){return this._get("accessors",e)}getCamera(e){return null}getTexture(e){return this._get("textures",e)}getSampler(e){return this._get("samplers",e)}getImage(e){return this._get("images",e)}getBufferView(e){return this._get("bufferViews",e)}getBuffer(e){return this._get("buffers",e)}_get(e,t){if("object"==typeof t)return t;const s=this.gltf[e]&&this.gltf[e][t];return s||console.warn(`glTF file error: Could not find ${e}[${t}]`),s}async _loadLinkedAssets(e){return await Promise.all(this.gltf.buffers.map(t=>this._loadBuffer(t,e)))}async _loadBuffer(e,t){if(e.uri){const s=t.fetch||window.fetch,r=A(e.uri,t.uri),n=await s(r),i=await n.arrayBuffer();e.data=i,e.uri=null}}_decompressMeshes(e){if(e.DracoLoader&&e.decompress){for(const t of this.gltf.meshes||[])for(const s of t.primitives)if(this._decompressKhronosDracoPrimitive(s,e),this._decompressUberDracoPrimitive(s,e),!s.attributes||0===Object.keys(s.attributes).length)throw new Error("Empty glTF primitive: decompression failure?");this._removeExtension(n),this._removeExtension(i)}}_decompressKhronosDracoPrimitive(e,t){const s=e.extensions&&e.extensions[n];if(!s)return;delete e.extensions[n];const r=this._getBufferViewArray(s.bufferView),i=t.DracoLoader.parseSync(r);e.attributes=X(i.attributes),i.indices&&(e.indices=Q(i.indices))}_decompressUberDracoPrimitive(e,t){const s=e.extensions&&e.extensions[i];if(!s)return;if(0!==e.mode)throw new Error(i);delete e.extensions[i];const r=this._getBufferViewArray(s.bufferView),n=t.DracoLoader.parseSync(r);e.attributes=n.attributes}_getBufferViewArray(e){const t=this.gltf.bufferViews[e];if(this.glbParser)return this.glbParser.getBufferView(t);const s=this.gltf.buffers[t.buffer].data,r=t.byteOffset||0;return new Uint8Array(s,r,t.byteLength)}_removeExtension(e){this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,e),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,e),this.json.extensions&&delete this.json.extensions[e]}_removeStringFromArray(e,t){let s=!0;for(;s;){const r=e.indexOf(t);r>-1?e.splice(r,1):s=!1}}}const me={useGLTFParser:!0};var pe={name:"glTF",extension:["gltf","glb"],text:!0,binary:!0,parse:async function(e,t={}){if((t={...me,...t}).useGLTFParser)return(new de).parse(e,t);const{byteOffset:s=0}=t,r={};return await re(r,e,s,t),r},parseSync:function(e,t={}){if((t={...me,...t}).useGLTFParser)return(new de).parseSync(e,t);const{byteOffset:s=0}=t,r={};return se(r,e,s,t),r},defaultOptions:me};const ye=1179937895,be=1313821514,we=5130562,xe=!0;function je(e,t,s=0,r={}){const{magic:n=ye,version:i=2,json:o={},binary:u}=e,a=s;t&&(t.setUint32(s+0,n,xe),t.setUint32(s+4,i,xe),t.setUint32(s+8,0,xe));const f=s+8,c=s+=12;if(t&&(t.setUint32(s+0,0,xe),t.setUint32(s+4,be,xe)),s=function(e,t,s,r){return t=W(e,t,new B("utf8").encode(s))}(t,s+=8,JSON.stringify(o)),t){const e=s-c-8;t.setUint32(c+0,e,xe)}if(u){const e=s;if(t&&(t.setUint32(s+0,0,xe),t.setUint32(s+4,we,xe)),s=W(t,s+=8,u),t){const r=s-e-8;t.setUint32(e+0,r,xe)}}if(t){const e=s-a;t.setUint32(f,e,xe)}return s}function _e(e,t,s,r){return function(e,{firstBuffer:t=0}={}){if(e.buffers&&e.buffers.length>t)throw new Error("encodeGLTF: multiple buffers not yet implemented")}(e),je(e,t,s,r)}var ve={name:"glTF",extensions:["glb"],encodeSync:function(e,t={}){const{byteOffset:s=0}=t,r=_e(e,null,s,t),n=new ArrayBuffer(r);return _e(e,new DataView(n),s,t),n},binary:!0,defaultOptions:{useGLTFBuilder:!0}},Ae={name:"GLB",extension:["glb"],text:!0,binary:!0,parseSync:function(e,t){const{byteOffset:s=0}=t,r={};return P(r,e,s,t),r}};var Te={name:"GLB",extensions:["glb"],encodeSync:function(e,t){const{byteOffset:s=0}=t,r=je(e,null,s,t),n=new ArrayBuffer(r),i=new DataView(n);return je(e,i,s,t),n},binary:!0};const Be={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Le={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Ve={magFilter:10240,minFilter:10241,wrapS:10242,wrapT:10243};class Ee{postProcess(e,t={}){return this.gltf=e,this.json=e.json,this.buffers=e.buffers,this._resolveTree(e.json,t)}_resolveTree(e,t={}){return e.bufferViews&&(e.bufferViews=e.bufferViews.map((e,t)=>this._resolveBufferView(e,t))),e.images&&(e.images=e.images.map((e,s)=>this._resolveImage(e,s,t))),e.samplers&&(e.samplers=e.samplers.map((e,t)=>this._resolveSampler(e,t))),e.textures&&(e.textures=e.textures.map((e,t)=>this._resolveTexture(e,t))),e.accessors&&(e.accessors=e.accessors.map((e,t)=>this._resolveAccessor(e,t))),e.materials&&(e.materials=e.materials.map((e,t)=>this._resolveMaterial(e,t))),e.meshes&&(e.meshes=e.meshes.map((e,t)=>this._resolveMesh(e,t))),e.nodes&&(e.nodes=e.nodes.map((e,t)=>this._resolveNode(e,t))),e.skins&&(e.skins=e.skins.map((e,t)=>this._resolveSkin(e,t))),e.scenes&&(e.scenes=e.scenes.map((e,t)=>this._resolveScene(e,t))),void 0!==e.scene&&(e.scene=e.scenes[this.json.scene]),e}getScene(e){return this._get("scenes",e)}getNode(e){return this._get("nodes",e)}getSkin(e){return this._get("skins",e)}getMesh(e){return this._get("meshes",e)}getMaterial(e){return this._get("materials",e)}getAccessor(e){return this._get("accessors",e)}getCamera(e){return null}getTexture(e){return this._get("textures",e)}getSampler(e){return this._get("samplers",e)}getImage(e){return this._get("images",e)}getBufferView(e){return this._get("bufferViews",e)}getBuffer(e){return this._get("buffers",e)}_get(e,t){if("object"==typeof t)return t;const s=this.json[e]&&this.json[e][t];return s||console.warn(`glTF file error: Could not find ${e}[${t}]`),s}_resolveScene(e,t){return(e={...e}).id=e.id||`scene-${t}`,e.nodes=(e.nodes||[]).map(e=>this.getNode(e)),e}_resolveNode(e,t){return(e={...e}).id=e.id||`node-${t}`,e.children&&(e.children=e.children.map(e=>this.getNode(e))),void 0!==e.mesh&&(e.mesh=this.getMesh(e.mesh)),void 0!==e.camera&&(e.camera=this.getCamera(e.camera)),void 0!==e.skin&&(e.skin=this.getSkin(e.skin)),e}_resolveSkin(e,t){return(e={...e}).id=e.id||`skin-${t}`,e.inverseBindMatrices=this.getAccessor(e.inverseBindMatrices),e}_resolveMesh(e,t){return(e={...e}).id=e.id||`mesh-${t}`,e.primitives&&(e.primitives=e.primitives.map(e=>{const t=(e={...e}).attributes;e.attributes={};for(const s in t)e.attributes[s]=this.getAccessor(t[s]);return void 0!==e.indices&&(e.indices=this.getAccessor(e.indices)),void 0!==e.material&&(e.material=this.getMaterial(e.material)),e})),e}_resolveMaterial(e,t){if((e={...e}).id=e.id||`material-${t}`,e.normalTexture&&(e.normalTexture={...e.normalTexture},e.normalTexture.texture=this.getTexture(e.normalTexture.index)),e.occlusionTexture&&(e.occlustionTexture={...e.occlustionTexture},e.occlusionTexture.texture=this.getTexture(e.occlusionTexture.index)),e.emissiveTexture&&(e.emmisiveTexture={...e.emmisiveTexture},e.emissiveTexture.texture=this.getTexture(e.emissiveTexture.index)),e.pbrMetallicRoughness){e.pbrMetallicRoughness={...e.pbrMetallicRoughness};const t=e.pbrMetallicRoughness;t.baseColorTexture&&(t.baseColorTexture={...t.baseColorTexture},t.baseColorTexture.texture=this.getTexture(t.baseColorTexture.index)),t.metallicRoughnessTexture&&(t.metallicRoughnessTexture={...t.metallicRoughnessTexture},t.metallicRoughnessTexture.texture=this.getTexture(t.metallicRoughnessTexture.index))}return e}_resolveAccessor(e,t){var s,r;return(e={...e}).id=e.id||`accessor-${t}`,void 0!==e.bufferView&&(e.bufferView=this.getBufferView(e.bufferView)),e.bytesPerComponent=(s=e.componentType,Le[s]),e.components=(r=e.type,Be[r]),e.bytesPerElement=e.bytesPerComponent*e.components,e}_resolveTexture(e,t){return(e={...e}).id=e.id||`texture-${t}`,e.sampler=this.getSampler(e.sampler),e.source=this.getImage(e.source),e}_resolveSampler(e,t){(e={...e}).id=e.id||`sampler-${t}`,e.parameters={};for(const t in e){const s=this._enumSamplerParameter(t);void 0!==s&&(e.parameters[s]=e[t])}return e}_enumSamplerParameter(e){return Ve[e]}_resolveImage(e,t,s){if((e={...e}).id=e.id||`image-${t}`,void 0!==e.bufferView&&(e.bufferView=this.getBufferView(e.bufferView)),"uri"in e){const t=s.uri||this.gltf.baseUri;t&&(e.baseUri=t,e.fullUri=A(e.uri,t))}return e.getImageAsync=function(){return e.uri?new Promise(t=>{const s=new Image;s.crossOrigin="anonymous",s.onload=(()=>t(s)),s.src=e.fullUri||e.uri}):null},e}_resolveBufferView(e,t){(e={...e}).id=e.id||`bufferView-${t}`;const s=e.buffer;e.buffer=this.getBuffer(s);const r=this.buffers[s].arrayBuffer;let n=this.buffers[s].byteOffset||0;return"byteOffset"in e&&(n+=e.byteOffset),e.data=new Uint8Array(r,n,e.byteLength),e}_resolveCamera(e,t){return e.id=e.id||`camera-${t}`,e.perspective,e.orthographic,e}}function Ue(e,t){return(new Ee).postProcess(e,t)}function Se(e,t=Float32Array){if(0===e.length)return new Float32Array(0);if(!function e(t,s=Number.isFinite){let r=-1;for(;++r<t.length;){const n=t[r];if(Array.isArray(n)||ArrayBuffer.isView(n)){if(!e(n,s))return!1}else if(!s(n))return!1}return!0}(e))return null;const s=new t(function e(t,s=3){let r=0;let n=0;let i=-1;for(;++i<t.length;){const s=t[i];Array.isArray(s)||ArrayBuffer.isView(s)?r+=e(s):n++}return r+(0===r&&n<s?s:n)}(e));return function(e,t,s=3){(function e(t,s,r,n){let i=-1,o=0;for(;++i<t.length;){const u=t[i];Array.isArray(u)||ArrayBuffer.isView(u)?n=e(u,s,r,n):o<r&&(s[n++]=u,o++)}return o>0&&o<r&&(s[n++]=0),n})(e,t,s,0)}(e,s),s}function Oe(e,t,s={}){const{flattenArrays:r=!1}=s;let n=e;if("string"==typeof n&&0===n.indexOf("#/"))return`#${n}`;if(Array.isArray(n)){const e=r&&Se(n);if(!e)return n.map(e=>Oe(e,t,s));n=e}if(ArrayBuffer.isView(n)&&t){if(t.isImage(n)){return`#/images/${t.addImage(n)}`}return`#/accessors/${t.addBuffer(n)}`}if(null!==n&&"object"==typeof n){const e={};for(const r in n)e[r]=Oe(n[r],t,s);return e}return n}class Re{constructor(e={}){this.byteLength=0,this.json={buffers:[{byteLength:0}],bufferViews:[],accessors:[],images:[],meshes:[]},this.sourceBuffers=[],this.log=e.log||console}getByteLength(){return this.byteLength}isImage(e){return function(e,t){if(t){const{test:s}=N(t);return s(z(e))}return Boolean(q(e))}(e)}encodeSync(e={}){return this.encodeAsGLB(e)}encodeAsGLB(e={}){this._packBinaryChunk(),e.magic&&console.warn("Custom glTF magic number no longer supported");const t={version:2,json:this.json,binary:this.arrayBuffer},s=je(t,null,0,e),r=new ArrayBuffer(s);return je(t,new DataView(r),0,e),r}addApplicationData(e,t,s={}){const r=s.packTypedArrays?Oe(t,this,s):t;return this.json[e]=r,this}addBuffer(e,t={size:3}){const s=this.addBufferView(e),r={size:t.size,componentType:_(e),count:Math.round(e.length/t.size)};return this.addAccessor(s,Object.assign(r,t))}addBufferView(e){const t=e.byteLength||e.length;return this.json.bufferViews.push({buffer:0,byteOffset:this.byteLength,byteLength:t}),this.byteLength+=K(t),this.sourceBuffers.push(e),this.json.bufferViews.length-1}addAccessor(e,t){return this.json.accessors.push({bufferView:e,type:j(t.size),componentType:t.componentType,count:t.count}),this.json.accessors.length-1}_pack(){return this._packBinaryChunk(),{arrayBuffer:this.arrayBuffer,json:this.json}}_packBinaryChunk(){if(this.arrayBuffer)return;const e=this.byteLength,t=new ArrayBuffer(e),s=new Uint8Array(t);let r=0;for(let e=0;e<this.sourceBuffers.length;e++){r=H(this.sourceBuffers[e],s,r)}this.json.buffers[0].byteLength=e,this.arrayBuffer=t,this.sourceBuffers=[]}_getInternalCounts(){return{buffers:this.json.buffers.length,bufferViews:this.json.bufferViews.length,accessors:this.json.accessors.length,images:this.json.images.length}}}class ke extends Re{constructor(e={}){super(e),this.DracoWriter=e.DracoWriter,this.DracoLoader=e.DracoLoader}addApplicationData(e,t,s={}){const r=s.packTypedArrays?Oe(t,this,s):t;return this.json[e]=r,this}addExtraData(e,t,s={}){const r=s.packedTypedArrays?Oe(t,this,s):t;return this.json.extras=this.json.extras||{},this.json.extras[e]=r,this}addExtension(e,t,s={}){m(t);const r=s.packTypedArrays?Oe(t,this,s):t;return this.json.extensions=this.json.extensions||{},this.json.extensions[e]=r,this.registerUsedExtension(e),this}addRequiredExtension(e,t,s={}){m(t);const r=s.packTypedArrays?Oe(t,this,s):t;return this.addExtension(e,r),this.registerRequiredExtension(e),this}registerUsedExtension(e){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find(t=>t===e)||this.json.extensionsUsed.push(e)}registerRequiredExtension(e){this.registerUsedExtension(e),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find(t=>t===e)||this.json.extensionsRequired.push(e)}addMesh(e,t,s=4){const r={primitives:[{attributes:this._addAttributes(e),indices:t,mode:s}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(r),this.json.meshes.length-1}addPointCloud(e){const t={primitives:[{attributes:this._addAttributes(e),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(t),this.json.meshes.length-1}addCompressedMesh(e,t,s=4){if(!this.DracoWriter||!this.DracoLoader)throw new Error("DracoWriter/DracoLoader not available");this.registerRequiredExtension(n);const r=this.DracoWriter.encodeSync({attributes:e}),i=this.DracoLoader.parseSync({attributes:e}),o=this._addFauxAttributes(i.attributes),u=this.addBufferView(r),a={primitives:[{attributes:o,mode:s,extensions:{[n]:{bufferView:u,attributes:o}}}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(a),this.json.meshes.length-1}addCompressedPointCloud(e){if(!this.DracoWriter||!this.DracoLoader)throw new Error("DracoWriter/DracoLoader not available");e.mode=0;const t=this.DracoWriter.encodeSync(e,{pointcloud:!0}),s=this.addBufferView(t),r={primitives:[{attributes:{},mode:0,extensions:{[i]:{bufferView:s}}}]};return this.registerRequiredExtension(i),this.json.meshes=this.json.meshes||[],this.json.meshes.push(r),this.json.meshes.length-1}addImage(e){const t=this.addBufferView(e),s=G(e)||{};if(s){const{mimeType:e,width:r,height:n}=s;this.json.images.push({bufferView:t,mimeType:e,width:r,height:n})}else this.json.images.push({bufferView:t});return this.json.images.length-1}}s.d(t,"KHR_DRACO_MESH_COMPRESSION",function(){return n}),s.d(t,"UBER_POINT_CLOUD_EXTENSION",function(){return i}),s.d(t,"GLTFLoader",function(){return pe}),s.d(t,"GLTFWriter",function(){return ve}),s.d(t,"GLBLoader",function(){return Ae}),s.d(t,"GLBWriter",function(){return Te}),s.d(t,"GLTFScenegraph",function(){return J}),s.d(t,"postProcessGLTF",function(){return Ue}),s.d(t,"parseGLTFSync",function(){return se}),s.d(t,"encodeGLTFSync",function(){return _e}),s.d(t,"packBinaryJson",function(){return Oe}),s.d(t,"unpackBinaryJson",function(){return ne}),s.d(t,"GLBParser",function(){return ae}),s.d(t,"GLBBuilder",function(){return Re}),s.d(t,"GLTFParser",function(){return de}),s.d(t,"GLTFBuilder",function(){return ke})}])}); | ||
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var s=t();for(var r in s)("object"==typeof exports?exports:e)[r]=s[r]}}(window,function(){return function(e){var t={};function s(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,s),n.l=!0,n.exports}return s.m=e,s.c=t,s.d=function(e,t,r){s.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.t=function(e,t){if(1&t&&(e=s(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(s.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)s.d(r,n,function(t){return e[t]}.bind(null,n));return r},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,"a",t),t},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.p="",s(s.s=10)}([function(e,t,s){"use strict";(function(e,r){s.d(t,"b",function(){return n}),s.d(t,"a",function(){return o});const n="object"!=typeof e||"[object process]"!==String(e)||e.browser,i={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:void 0!==r&&r,document:"undefined"!=typeof document&&document},o=i.global||i.self||i.window}).call(this,s(11),s(8))},,,,,,,,function(e,t){var s;s=function(){return this}();try{s=s||new Function("return this")()}catch(e){"object"==typeof window&&(s=window)}e.exports=s},,function(e,t,s){(function(t){const r=s(12),n="undefined"==typeof window?t:window;n.loaders=n.loaders||{},e.exports=Object.assign(n.loaders,r)}).call(this,s(8))},function(e,t){var s,r,n=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function u(e){if(s===setTimeout)return setTimeout(e,0);if((s===i||!s)&&setTimeout)return s=setTimeout,setTimeout(e,0);try{return s(e,0)}catch(t){try{return s.call(null,e,0)}catch(t){return s.call(this,e,0)}}}!function(){try{s="function"==typeof setTimeout?setTimeout:i}catch(e){s=i}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var a,f=[],c=!1,h=-1;function l(){c&&a&&(c=!1,a.length?f=a.concat(f):h=-1,f.length&&g())}function g(){if(!c){var e=u(l);c=!0;for(var t=f.length;t;){for(a=f,f=[];++h<t;)a&&a[h].run();h=-1,t=f.length}a=null,c=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function d(e,t){this.fun=e,this.array=t}function m(){}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var s=1;s<arguments.length;s++)t[s-1]=arguments[s];f.push(new d(e,t)),1!==f.length||c||u(g)},d.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=m,n.addListener=m,n.once=m,n.off=m,n.removeListener=m,n.removeAllListeners=m,n.emit=m,n.prependListener=m,n.prependOnceListener=m,n.listeners=function(e){return[]},n.binding=function(e){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(e){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},function(e,t,s){"use strict";s.r(t);var r={};s.r(r),s.d(r,"KHR_draco_mesh_compression",function(){return K}),s.d(r,"KHR_lights_punctual",function(){return J});const n="KHR_draco_mesh_compression",i="UBER_draco_point_cloud_compression",o="KHR_lights_punctual";const u=e=>(e=>"undefined"!=typeof File&&e instanceof File)(e)||(e=>"undefined"!=typeof Blob&&e instanceof Blob)(e);let a="";const f={};function c(e){for(const t in f)if(e.startsWith(t)){const s=f[t];return e.replace(t,s)}return e+=a}function h(e,t){if(!e)throw new Error(t||"loader assertion failed.")}class l{constructor(e){this._fileOrBlob=e,this.bodyUsed=!1}get headers(){return new Headers({"Content-Length":this._fileOrBlob.size,"Content-Type":this._fileOrBlob.type})}url(){return this._fileOrBlob.name||""}async arrayBuffer(){const{reader:e,promise:t}=this._getFileReader();return e.readAsArrayBuffer(this._fileOrBlob),t}async text(){const{reader:e,promise:t}=this._getFileReader();return e.readAsText(this._fileOrBlob),t}async json(){const e=await this.text();return JSON.parse(e)}_getFileReader(){let e;h(!this.bodyUsed),this.bodyUsed=!0;const t=new Promise((t,s)=>{try{(e=new FileReader).onerror=e=>s(new Error(e)),e.onabort=()=>s(new Error("Read aborted.")),e.onload=()=>t(e.result)}catch(e){s(e)}});return{reader:e,promise:t}}}function g(e,t){return Promise.resolve(new l(e,t))}async function d(e,t){return u(e)?g(e,t):(e=c(e),fetch(e,t))}function m(e,t){if(!e)throw new Error(t||"gltf/glb assertion failed.")}const p=["SCALAR","VEC2","VEC3","VEC4"],y=new Map([[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126]]),b={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},w={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},x={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function j(e){return p[e-1]||p[0]}function _(e){const t=y.get(e.constructor);if(!t)throw new Error("Illegal typed array");return t}function v(e,t){const s=x[e.componentType],r=b[e.type],n=w[e.componentType],i=e.count*r,o=e.count*r*n;return m(o>=0&&o<=t.byteLength),{ArrayType:s,length:i,byteLength:o}}function A(e,t){return e.startsWith("data:")||e.startsWith("http:")||e.startsWith("https:")?e:t.substr(0,t.lastIndexOf("/")+1)+e}function B(e,t){if(!e)throw new Error(t||"loader assertion failed.")}function T(e){return e+3&-4}function L(e,t,s){let r;if(e instanceof ArrayBuffer)r=new Uint8Array(e);else{const t=e.byteOffset,s=e.byteLength;r=new Uint8Array(e.buffer,t,s)}return t.set(r,s),s+T(r.byteLength)}const V=1735152710,E=12,U=8,O=1313821514,S=5130562,R=!0,k=!1;function C(e,t=0,s={}){const r=new DataView(e),{magic:n=V}=s,i=r.getUint32(t,!1);return i===n||i===V}function M(e,t,s=0,r={}){const n=new DataView(t);e.byteOffset=s,e.magic=n.getUint32(s+0,k),e.version=n.getUint32(s+4,R),e.byteLength=n.getUint32(s+8,R),e.type=function(e){return`${String.fromCharCode(e.getUint8(0))}${String.fromCharCode(e.getUint8(1))}${String.fromCharCode(e.getUint8(2))}${String.fromCharCode(e.getUint8(3))}`}(n);const{magic:i=V}=r;e.magic===V||e.magic===i||console.warn(`Invalid GLB magic string ${e.type}`),B(2===e.version,`Invalid GLB version ${e.version}. Only .glb v2 supported`),B(e.byteLength>20);const o=n.getUint32(s+12,R),u=n.getUint32(s+16,R);B(u===O||0===u,`JSON chunk format ${u}`);const a=E+U,f=new Uint8Array(t,s+a,o),c=new TextDecoder("utf8").decode(f);e.json=JSON.parse(c);const h=a+T(o);if(e.hasBinChunk=h+8<=e.byteLength,e.hasBinChunk){const t=n.getUint32(s+h+0,R),r=n.getUint32(s+h+4,R);B(r===S||1===r,`BIN chunk format ${r}`);const i=h+U;e.binChunkByteOffset=i,e.binChunkLength=t}return s+e.byteLength}const P=!1,D=!0,F=new Map([["image/png",{test:function(e){return e.byteLength>=24&&2303741511===e.getUint32(0,P)},getSize:function(e){return{width:e.getUint32(16,P),height:e.getUint32(20,P)}}}],["image/jpeg",{test:function(e){return e.byteLength>=2&&65496===e.getUint16(0,P)},getSize:function(e){if(e.byteLength<2||65496!==e.getUint16(0,P))return null;const{tableMarkers:t,sofMarkers:s}=function(){const e=new Set([65499,65476,65484,65501,65534]);for(let t=65504;t<65520;++t)e.add(t);const t=new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502]);return{tableMarkers:e,sofMarkers:t}}();let r=2;for(;r<e.byteLength;){const n=e.getUint16(r,P);if(s.has(n))return{height:e.getUint16(r+5,P),width:e.getUint16(r+7,P)};if(!t.has(n))return null;r+=2,r+=e.getUint16(r,P)}return null}}],["image/gif",{test:function(e){return e.byteLength>=10&&1195984440===e.getUint32(0,P)},getSize:function(e){return{width:e.getUint16(6,D),height:e.getUint16(8,D)}}}],["image/bmp",{test:function(e){return e.byteLength>=2&&16973===e.getUint16(0,P)},getSize:function(e){return{width:e.getUint32(18,D),height:e.getUint32(22,D)}}}]]);const I=`Invalid MIME type. Supported MIME types are: ${Array.from(F.keys()).join(", ")}`;function $(e){const t=N(e);for(const[e,{test:s}]of F.entries())if(s(t))return e;return null}function q(e,t=null){const s=function(e,t=null){t=t||$(e);const{getSize:s}=G(t),r=s(N(e));if(!r)throw new Error(`invalid image data for type: ${t}`);return r}(e,t=t||$(e));return s.mimeType=t,s}function G(e){const t=F.get(e);if(!t)throw new Error(I);return t}function N(e){if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return new DataView(e.buffer||e);throw new Error("toDataView")}class z{constructor(e){if(e instanceof z)return e;e||(e={json:{version:2,buffers:[]},binary:null}),this.gltf=e}get json(){return this.gltf.json}getApplicationData(e){return this.json[e]}getExtraData(e){return(this.json.extras||{})[e]}getExtension(e){const t=this.getUsedExtensions().find(t=>t===e),s=this.json.extensions||{};return t?s[e]||!0:null}getRequiredExtension(e){return this.getRequiredExtensions().find(t=>t===e)?this.getExtension(e):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getObjectExtension(e,t){return(e.extensions||{})[t]}getScene(e){return this.getObject("scenes",e)}getNode(e){return this.getObject("nodes",e)}getSkin(e){return this.getObject("skins",e)}getMesh(e){return this.getObject("meshes",e)}getMaterial(e){return this.getObject("materials",e)}getAccessor(e){return this.getObject("accessors",e)}getCamera(e){return null}getTexture(e){return this.getObject("textures",e)}getSampler(e){return this.getObject("samplers",e)}getImage(e){return this.getObject("images",e)}getBufferView(e){return this.getObject("bufferViews",e)}getBuffer(e){return this.getObject("buffers",e)}getObject(e,t){if("object"==typeof t)return t;const s=this.gltf[e]&&this.gltf[e][t];return s||console.warn(`glTF file error: Could not find ${e}[${t}]`),s}getTypedArrayForBufferView(e){e=this.getBufferView(e);const t=this.getBuffer(e.buffer).data,s=e.byteOffset||0;return new Uint8Array(t,s,e.byteLength)}getTypedArrayForAccessor(e){e=this.getAccessor(e);const t=this.getBuffer(e.bufferView),s=this.getBuffer(t.buffer).data,{ArrayType:r,length:n}=v(e,t);return new r(s,t.byteOffset+e.byteOffset,n)}getTypedArrayForImageData(e){e=this.getAccessor(e);const t=this.getBuffer(e.bufferView),s=this.getBuffer(t.buffer).data,r=t.byteOffset||0;return new Uint8Array(s,r,t.byteLength)}addApplicationData(e,t){return this.json[e]=t,this}addExtraData(e,t){return this.json.extras=this.json.extras||{},this.json.extras[e]=t,this}addExtension(e,t){return m(t),this.json.extensions=this.json.extensions||{},this.json.extensions[e]=t,this.registerUsedExtension(e),this}addRequiredExtension(e,t){return m(t),this.addExtension(e,t),this.registerRequiredExtension(e),this}registerUsedExtension(e){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find(t=>t===e)||this.json.extensionsUsed.push(e)}registerRequiredExtension(e){this.registerUsedExtension(e),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find(t=>t===e)||this.json.extensionsRequired.push(e)}removeExtension(e){this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,e),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,e),this.json.extensions&&delete this.json.extensions[e]}setObjectExtension(e,t,s){(e.extensions||{})[t]=s}addMesh(e,t,s=4){const r={primitives:[{attributes:this._addAttributes(e),indices:t,mode:s}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(r),this.json.meshes.length-1}addPointCloud(e){const t={primitives:[{attributes:this._addAttributes(e),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(t),this.json.meshes.length-1}addImage(e,t){t=t||$(e);const s={bufferView:this.addBufferView(e),mimeType:t};return this.json.images=this.json.images||[],this.json.images.push(s),this.json.images.length-1}addBufferView(e){const t=e.byteLength||e.length;this.byteLength+=T(t),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(e);const s={buffer:0,byteOffset:this.byteLength,byteLength:t};return this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(s),this.json.bufferViews.length-1}addAccessor(e,t){const s={bufferView:e,type:j(t.size),componentType:t.componentType,count:t.count};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(s),this.json.accessors.length-1}addBinaryBuffer(e,t={size:3}){const s=this.addBufferView(e),r={size:t.size,componentType:_(e),count:Math.round(e.length/t.size)};return this.addAccessor(s,Object.assign(r,t))}createBinaryChunk(){if(this.arrayBuffer)return;const e=this.byteLength,t=new ArrayBuffer(e),s=new Uint8Array(t);let r=0;for(let e=0;e<this.sourceBuffers.length;e++){r=L(this.sourceBuffers[e],s,r)}this.json.buffers[0].byteLength=e,this.arrayBuffer=t,this.sourceBuffers=[]}_removeStringFromArray(e,t){let s=!0;for(;s;){const r=e.indexOf(t);r>-1?e.splice(r,1):s=!1}}}function W(e){const t={};for(const s in e){const r=e[s];if("indices"!==s){const e=H(r);t[s]=e}}return t}function H(e,t){const{buffer:s,size:r,count:n}=function(e,t){let s=e,r=1,n=0;e&&e.value&&(s=e.value,r=e.size||1);s&&(ArrayBuffer.isView(s)||(s=function(e,t,s=!1){if(!e)return null;if(Array.isArray(e))return new t(e);if(s&&!(e instanceof t))return new t(e);return e}(s,Float32Array)),n=s.length/r);return{buffer:s,size:r,count:n}}(e);return{value:s,size:r,bufferView:null,byteOffset:0,count:n,type:j(r),componentType:_(s)}}class K{static get name(){return n}static decode(e,t){const s=new z(e);for(const e of s.json.meshes||[])K.decompressMesh(e,t);s.removeExtension(n)}static encode(e,t){const s=new z(e);for(const e of s.json.meshes||[])K.compressMesh(e,t),s.addRequiredExtension(n)}static compressMesh(e,t,s=4,r={}){if(!r.DracoWriter||!r.DracoLoader)throw new Error("DracoWriter/DracoLoader not available");const i=r.DracoWriter.encodeSync({attributes:e}),o=r.DracoLoader.parseSync({attributes:e}),u=r._addFauxAttributes(o.attributes),a=r.addBufferView(i);return{primitives:[{attributes:u,mode:s,extensions:{[n]:{bufferView:a,attributes:u}}}]}}static decompressMesh(e,t={}){for(const s of e.primitives)if(K._decompressMeshPrimitive(s,t),!s.attributes||0===Object.keys(s.attributes).length)throw new Error("Empty glTF primitive: decompression failure?")}static _decompressMeshPrimitive(e,t){const s=e.extensions&&e.extensions[n];if(!s)return;if(!t.DracoLoader||!t.decompress)return;delete e.extensions[n];const r=this._getBufferViewArray(s.bufferView),i=t.DracoLoader.parseSync(r);e.attributes=W(i.attributes),i.indices&&(e.indices=H(i.indices))}}class J{static get name(){return o}static decode(e,t){const s=new z(e),r=s.getExtension(o);r&&(s.json.lights=r.lights,s.removeExtension(o));for(const e of s.nodes||[]){const t=e.extensions&&e.extensions.KHR_lights_punctual;t&&(e.light=s._get("lights",t.light),delete e.extensions.KHR_lights_punctual)}}static encode(e,t){const s=new z(e),{json:r}=s;if(r.lights){const e=s.addExtensions(o);m(!e.lights),e.lights=r.lights,delete r.lights}if(s.json.lights){for(const e of s.json.lights){const t=e.node;s.addObjectExtension(t,o,e)}delete s.json.lights}}}const X={fetchLinkedResources:!1,decompress:!1,DracoLoader:null,postProcess:!0,createImages:!1,log:console},Q={fetchLinkedResources:!0,fetch:d,decompress:!1,DracoLoader:null,postProcess:!0,createImages:!1,log:console};function Y(e,t,s=0,n={}){n=Object.assign({},X,n);let i=t;if(i instanceof ArrayBuffer&&!C(i,s,n)){i=(new TextDecoder).decode(i)}if(e.buffers=[],"string"==typeof i?e.json=JSON.parse(i):i instanceof ArrayBuffer?(s=M(e,i,s,n),e.hasBinChunk&&e.buffers.push({arrayBuffer:i,byteOffset:e.binChunkByteOffset,byteLength:e.binChunkLength})):e.json=i,n.uri&&(e.baseUri=n.uri),n.fetchLinkedResources)for(const t of e.json.buffers||[])if(t.uri)throw new Error("parseGLTFSync: Cannot decode uri buffers");return function(e,t){for(const s in r){const n=s in t&&!t[s];if(!n){const n=r[s];n.decode(e,t)}}}(e,n),s}async function Z(e,t,s=0,r={}){return r=Object.assign({},Q,r),Y(e,t,s,{...r,fetchLinkedResources:!1,postProcess:!1,decompress:!1}),r.fetchLinkedResources&&await async function(e,t){for(const s of e.json.buffers)if(s.uri){const e=t.fetch||window.fetch;m(e);const r=A(s.uri,t.uri),n=await e(r),i=await n.arrayBuffer();s.data=i,delete s.uri}}(e,r),e}new Map;var ee=s(0);ee.a.TextEncoder;const te=ee.a.TextDecoder;function se(e,t,s={}){return function e(t,s,r,n={}){const i=t;const o=function(e,t){const s=function(e){if("string"==typeof e){if(0===e.indexOf("##/"))return e.slice(1);let t=e.match(/#\/([a-z]+)\/([0-9]+)/);if(t){const e=parseInt(t[2],10);return[t[1],e]}if(t=e.match(/\$\$\$([0-9]+)/)){const e=parseInt(t[1],10);return["accessors",e]}}return null}(e);if(s){const[r,n]=s,i=t[r]&&t[r][n];if(i)return i;console.error(`Invalid JSON pointer ${e}: #/${r}/${n}`)}return null}(i,r);if(o)return o;if(Array.isArray(i))return i.map(t=>e(t,s,r,n));if(null!==i&&"object"==typeof i){const t={};for(const o in i)t[o]=e(i[o],s,r,n);return t}return i}(e,e,t,s)}function re(e,t,s){s&&(e=function(e,t){const s=e.byteLength-t,r=new ArrayBuffer(s),n=new Uint8Array(e),i=new Uint8Array(r);for(let e=0;e<s;e++)i[e]=n[t+e];return r}(e,s));const r=t.bufferViews||[];for(let e=0;e<r.length;++e){m(r[e].byteLength>=0)}return{accessors:ne(e,r,t),images:ie(e,r,t)}}function ne(e,t,s){const r=s.accessors||[],n=[];for(let s=0;s<r.length;++s){const i=r[s];m(i);const o=t[i.bufferView];if(o){const{ArrayType:t,length:s}=v(i,o),r=new t(e,o.byteOffset,s);r.accessor=i,n.push(r)}}return n}function ie(e,t,s){const r=s.images||[],n=[];for(let s=0;s<r.length;++s){const i=r[s];m(i);const o=t[i.bufferView];m(o);const u=new Uint8Array(e,o.byteOffset,o.byteLength);u.imate=i,n.push(u)}return n}class oe{static isGLB(e,t={}){return C(e,0)}parse(e,t={}){return this.parseSync(e,t)}parseSync(e,t={}){if(this.glbArrayBuffer=e,this.binaryByteOffset=null,this.packedJson=null,this.json=null,null===this.json&&null===this.binaryByteOffset){const e=0;M(this,this.glbArrayBuffer,e,t),this.binaryByteOffset=this.binChunkByteOffset,this.packedJson=this.json;const s=re(this.glbArrayBuffer,this.json,this.binaryByteOffset);this.json=se(this.json,s),this.unpackedBuffers=s}return this}getApplicationData(e){return this.json[e]}getJSON(){return this.json}getArrayBuffer(){return this.glbArrayBuffer}getBinaryByteOffset(){return this.binaryByteOffset}getBufferView(e){const t=(e.byteOffset||0)+this.binaryByteOffset;return new Uint8Array(this.glbArrayBuffer,t,e.byteLength)}getBuffer(e){const t=x[e.componentType],s=b[e.type],r=w[e.componentType],n=e.count*s,i=e.count*s*r,o=this.json.bufferViews[e.bufferView];m(i>=0&&e.byteOffset+i<=o.byteLength);const u=o.byteOffset+this.binaryByteOffset+e.byteOffset;return new t(this.glbArrayBuffer,u,n)}getImageData(e){return{typedArray:this.getBufferView(e.bufferView),mimeType:e.mimeType||"image/jpeg"}}getImage(e){const t=this.getBufferView(e.bufferView),s=e.mimeType||"image/jpeg",r=new Blob([t],{type:s}),n=(self.URL||self.webkitURL).createObjectURL(r),i=new Image;return i.src=n,i}getImageAsync(e){return new Promise(t=>{const s=this.getBufferView(e.bufferView),r=e.mimeType||"image/jpeg",n=new Blob([s],{type:r}),i=(self.URL||self.webkitURL).createObjectURL(n),o=new Image;o.onload=()=>t(o),o.src=i})}}const ue={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ae={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},fe={magFilter:10240,minFilter:10241,wrapS:10242,wrapT:10243};class ce{postProcess(e,t,s={}){return this.gltf=e,this.glbParser=t,this._resolveToTree(s),this.gltf}_resolveToTree(e={}){const{gltf:t}=this;return(t.bufferViews||[]).forEach((e,t)=>this._resolveBufferView(e,t)),(t.images||[]).forEach((t,s)=>this._resolveImage(t,s,e)),(t.samplers||[]).forEach((e,t)=>this._resolveSampler(e,t)),(t.textures||[]).forEach((e,t)=>this._resolveTexture(e,t)),(t.accessors||[]).forEach((e,t)=>this._resolveAccessor(e,t)),(t.materials||[]).forEach((e,t)=>this._resolveMaterial(e,t)),(t.meshes||[]).forEach((e,t)=>this._resolveMesh(e,t)),(t.nodes||[]).forEach((e,t)=>this._resolveNode(e,t)),(t.skins||[]).forEach((e,t)=>this._resolveSkin(e,t)),(t.scenes||[]).forEach((e,t)=>this._resolveScene(e,t)),void 0!==t.scene&&(t.scene=t.scenes[this.gltf.scene]),this._process_extension_KHR_lights_punctual(),t}getScene(e){return this._get("scenes",e)}getNode(e){return this._get("nodes",e)}getSkin(e){return this._get("skins",e)}getMesh(e){return this._get("meshes",e)}getMaterial(e){return this._get("materials",e)}getAccessor(e){return this._get("accessors",e)}getCamera(e){return null}getTexture(e){return this._get("textures",e)}getSampler(e){return this._get("samplers",e)}getImage(e){return this._get("images",e)}getBufferView(e){return this._get("bufferViews",e)}getBuffer(e){return this._get("buffers",e)}_get(e,t){if("object"==typeof t)return t;const s=this.gltf[e]&&this.gltf[e][t];return s||console.warn(`glTF file error: Could not find ${e}[${t}]`),s}_resolveScene(e,t){e.id=`scene-${t}`,e.nodes=(e.nodes||[]).map(e=>this.getNode(e))}_resolveNode(e,t){e.id=`node-${t}`,e.children=(e.children||[]).map(e=>this.getNode(e)),void 0!==e.mesh&&(e.mesh=this.getMesh(e.mesh)),void 0!==e.camera&&(e.camera=this.getCamera(e.camera)),void 0!==e.skin&&(e.skin=this.getSkin(e.skin))}_resolveSkin(e,t){e.id=`skin-${t}`,e.inverseBindMatrices=this.getAccessor(e.inverseBindMatrices)}_resolveMesh(e,t){e.id=`mesh-${t}`;for(const t of e.primitives){for(const e in t.attributes)t.attributes[e]=this.getAccessor(t.attributes[e]);void 0!==t.indices&&(t.indices=this.getAccessor(t.indices)),void 0!==t.material&&(t.material=this.getMaterial(t.material))}}_resolveMaterial(e,t){if(e.id=`material-${t}`,e.normalTexture&&(e.normalTexture.texture=this.getTexture(e.normalTexture.index)),e.occlusionTexture&&(e.occlusionTexture.texture=this.getTexture(e.occlusionTexture.index)),e.emissiveTexture&&(e.emissiveTexture.texture=this.getTexture(e.emissiveTexture.index)),e.pbrMetallicRoughness){const t=e.pbrMetallicRoughness;t.baseColorTexture&&(t.baseColorTexture.texture=this.getTexture(t.baseColorTexture.index)),t.metallicRoughnessTexture&&(t.metallicRoughnessTexture.texture=this.getTexture(t.metallicRoughnessTexture.index))}}_resolveAccessor(e,t){e.id=`accessor-${t}`,void 0!==e.bufferView&&(e.bufferView=this.getBufferView(e.bufferView)),e.bytesPerComponent=ae[e],e.components=ue[e],e.bytesPerElement=e.bytesPerComponent*e.components}_resolveTexture(e,t){e.id=`texture-${t}`,e.sampler=this.getSampler(e.sampler),e.source=this.getImage(e.source)}_resolveSampler(e,t){e.id=`sampler-${t}`,e.parameters={};for(const t in e){const s=this._enumSamplerParameter(t);void 0!==s&&(e.parameters[s]=e[t])}}_enumSamplerParameter(e){return fe[e]}_resolveImage(e,t,s){e.id=`image-${t}`,void 0!==e.bufferView&&(e.bufferView=this.getBufferView(e.bufferView));const{createImages:r=!0}=s;r?e.image=this.glbParser.getImage(e):e.getImageAsync=()=>this.glbParser?this.glbParser.getImageAsync(e):e.uri?new Promise(t=>{const r=new Image;r.crossOrigin="anonymous",r.onload=()=>t(r),r.src=A(e.uri,s.uri)}):null}_resolveBufferView(e,t){if(e.id=`bufferView-${t}`,e.buffer=this.getBuffer(e.buffer),this.glbParser)e.data=this.glbParser.getBufferView(e);else{const t=e.byteOffset||0;e.data=new Uint8Array(e.buffer.data,t,e.byteLength)}}_resolveCamera(e){e.perspective,e.orthographic}_process_extension_KHR_lights_punctual(){const{gltf:e}=this,t=e.extensions&&e.extensions.KHR_lights_punctual;t&&(e.lights=t.lights),this._removeExtension("KHR_lights_punctual");for(const t of e.nodes||[]){const e=t.extensions&&t.extensions.KHR_lights_punctual;e&&(t.light=this._get("lights",e.light),delete t.extensions.KHR_lights_punctual)}delete e.lights}_removeExtension(e){this.gltf.extensionsRequired&&this._removeStringFromArray(this.gltf.extensionsRequired,e),this.gltf.extensionsUsed&&this._removeStringFromArray(this.gltf.extensionsUsed,e),this.gltf.extensions&&delete this.gltf.extensions[e]}_removeStringFromArray(e,t){let s=!0;for(;s;){const r=e.indexOf(t);r>-1?e.splice(r,1):s=!1}}}const he={fetchLinkedResources:!0,fetch:d,decompress:!1,DracoLoader:null,postProcess:!0,createImages:!1,log:console};class le{async parse(e,t={}){if(t=Object.assign({},he,t),this.parseSync(e,{...t,postProcess:!1,decompress:!1}),t.fetchLinkedResources&&await this._loadLinkedAssets(t),t.decompress&&this._decompressMeshes(t),t.postProcess){(new ce).postProcess(this.gltf,this.glbParser,t)}return this.gltf}parseSync(e,t={}){if(t=Object.assign({},he,t),e instanceof ArrayBuffer&&!oe.isGLB(e,t)){e=(new te).decode(e)}if("string"==typeof e&&(e=JSON.parse(e)),e instanceof ArrayBuffer?(this.glbParser=new oe,this.gltf=this.glbParser.parseSync(e).json,this.json=this.gltf):(this.glbParser=null,this.gltf=e,this.json=e),t.decompress&&this._decompressMeshes(t),t.postProcess){(new ce).postProcess(this.gltf,this.glbParser,t)}return this.gltf}getApplicationData(e){return this.json[e]}getExtraData(e){return(this.json.extras||{})[e]}getExtension(e){const t=this.getUsedExtensions().find(t=>t===e),s=this.json.extensions||{};return t?s[e]||!0:null}getRequiredExtension(e){return this.getRequiredExtensions().find(t=>t===e)?this.getExtension(e):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getScene(e){return this._get("scenes",e)}getNode(e){return this._get("nodes",e)}getSkin(e){return this._get("skins",e)}getMesh(e){return this._get("meshes",e)}getMaterial(e){return this._get("materials",e)}getAccessor(e){return this._get("accessors",e)}getCamera(e){return null}getTexture(e){return this._get("textures",e)}getSampler(e){return this._get("samplers",e)}getImage(e){return this._get("images",e)}getBufferView(e){return this._get("bufferViews",e)}getBuffer(e){return this._get("buffers",e)}_get(e,t){if("object"==typeof t)return t;const s=this.gltf[e]&&this.gltf[e][t];return s||console.warn(`glTF file error: Could not find ${e}[${t}]`),s}async _loadLinkedAssets(e){return await Promise.all(this.gltf.buffers.map(t=>this._loadBuffer(t,e)))}async _loadBuffer(e,t){if(e.uri){const s=t.fetch||window.fetch,r=A(e.uri,t.uri),n=await s(r),i=await n.arrayBuffer();e.data=i,e.uri=null}}_decompressMeshes(e){if(e.DracoLoader&&e.decompress){for(const t of this.gltf.meshes||[])for(const s of t.primitives)if(this._decompressKhronosDracoPrimitive(s,e),this._decompressUberDracoPrimitive(s,e),!s.attributes||0===Object.keys(s.attributes).length)throw new Error("Empty glTF primitive: decompression failure?");this._removeExtension(n),this._removeExtension(i)}}_decompressKhronosDracoPrimitive(e,t){const s=e.extensions&&e.extensions[n];if(!s)return;delete e.extensions[n];const r=this._getBufferViewArray(s.bufferView),i=t.DracoLoader.parseSync(r);e.attributes=W(i.attributes),i.indices&&(e.indices=H(i.indices))}_decompressUberDracoPrimitive(e,t){const s=e.extensions&&e.extensions[i];if(!s)return;if(0!==e.mode)throw new Error(i);delete e.extensions[i];const r=this._getBufferViewArray(s.bufferView),n=t.DracoLoader.parseSync(r);e.attributes=n.attributes}_getBufferViewArray(e){const t=this.gltf.bufferViews[e];if(this.glbParser)return this.glbParser.getBufferView(t);const s=this.gltf.buffers[t.buffer].data,r=t.byteOffset||0;return new Uint8Array(s,r,t.byteLength)}_removeExtension(e){this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,e),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,e),this.json.extensions&&delete this.json.extensions[e]}_removeStringFromArray(e,t){let s=!0;for(;s;){const r=e.indexOf(t);r>-1?e.splice(r,1):s=!1}}}const ge={useGLTFParser:!0};var de={name:"glTF",extension:["gltf","glb"],text:!0,binary:!0,parse:async function(e,t={}){if((t={...ge,...t}).useGLTFParser)return(new le).parse(e,t);const{byteOffset:s=0}=t,r={};return await Z(r,e,s,t),r},parseSync:function(e,t={}){if((t={...ge,...t}).useGLTFParser)return(new le).parseSync(e,t);const{byteOffset:s=0}=t,r={};return Y(r,e,s,t),r},defaultOptions:ge};function me(e,t,s,r){const n=T(s.byteLength),i=n-s.byteLength;if(e){const r=new Uint8Array(e.buffer,e.byteOffset+t,s.byteLength),n=new Uint8Array(s);r.set(n);for(let r=0;r<i;++r)e.setUint8(t+s.byteLength+r,32)}return t+=n}const pe=1179937895,ye=1313821514,be=5130562,we=!0;function xe(e,t,s=0,r={}){const{magic:n=pe,version:i=2,json:o={},binary:u}=e,a=s;t&&(t.setUint32(s+0,n,we),t.setUint32(s+4,i,we),t.setUint32(s+8,0,we));const f=s+8,c=s+=12;if(t&&(t.setUint32(s+0,0,we),t.setUint32(s+4,ye,we)),s=function(e,t,s,r){return t=me(e,t,new TextEncoder("utf8").encode(s))}(t,s+=8,JSON.stringify(o)),t){const e=s-c-8;t.setUint32(c+0,e,we)}if(u){const e=s;if(t&&(t.setUint32(s+0,0,we),t.setUint32(s+4,be,we)),s=me(t,s+=8,u),t){const r=s-e-8;t.setUint32(e+0,r,we)}}if(t){const e=s-a;t.setUint32(f,e,we)}return s}function je(e,t,s,r){return function(e,{firstBuffer:t=0}={}){if(e.buffers&&e.buffers.length>t)throw new Error("encodeGLTF: multiple buffers not yet implemented")}(e),xe(e,t,s,r)}var _e={name:"glTF",extensions:["glb"],encodeSync:function(e,t={}){const{byteOffset:s=0}=t,r=je(e,null,s,t),n=new ArrayBuffer(r);return je(e,new DataView(n),s,t),n},binary:!0,defaultOptions:{useGLTFBuilder:!0}},ve={name:"GLB",extension:["glb"],text:!0,binary:!0,parseSync:function(e,t){const{byteOffset:s=0}=t,r={};return M(r,e,s,t),r}};var Ae={name:"GLB",extensions:["glb"],encodeSync:function(e,t){const{byteOffset:s=0}=t,r=xe(e,null,s,t),n=new ArrayBuffer(r),i=new DataView(n);return xe(e,i,s,t),n},binary:!0};const Be={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Te={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Le={magFilter:10240,minFilter:10241,wrapS:10242,wrapT:10243};class Ve{postProcess(e,t={}){return this.gltf=e,this.json=e.json,this.buffers=e.buffers,this._resolveTree(e.json,t)}_resolveTree(e,t={}){return e.bufferViews&&(e.bufferViews=e.bufferViews.map((e,t)=>this._resolveBufferView(e,t))),e.images&&(e.images=e.images.map((e,s)=>this._resolveImage(e,s,t))),e.samplers&&(e.samplers=e.samplers.map((e,t)=>this._resolveSampler(e,t))),e.textures&&(e.textures=e.textures.map((e,t)=>this._resolveTexture(e,t))),e.accessors&&(e.accessors=e.accessors.map((e,t)=>this._resolveAccessor(e,t))),e.materials&&(e.materials=e.materials.map((e,t)=>this._resolveMaterial(e,t))),e.meshes&&(e.meshes=e.meshes.map((e,t)=>this._resolveMesh(e,t))),e.nodes&&(e.nodes=e.nodes.map((e,t)=>this._resolveNode(e,t))),e.skins&&(e.skins=e.skins.map((e,t)=>this._resolveSkin(e,t))),e.scenes&&(e.scenes=e.scenes.map((e,t)=>this._resolveScene(e,t))),void 0!==e.scene&&(e.scene=e.scenes[this.json.scene]),e}getScene(e){return this._get("scenes",e)}getNode(e){return this._get("nodes",e)}getSkin(e){return this._get("skins",e)}getMesh(e){return this._get("meshes",e)}getMaterial(e){return this._get("materials",e)}getAccessor(e){return this._get("accessors",e)}getCamera(e){return null}getTexture(e){return this._get("textures",e)}getSampler(e){return this._get("samplers",e)}getImage(e){return this._get("images",e)}getBufferView(e){return this._get("bufferViews",e)}getBuffer(e){return this._get("buffers",e)}_get(e,t){if("object"==typeof t)return t;const s=this.json[e]&&this.json[e][t];return s||console.warn(`glTF file error: Could not find ${e}[${t}]`),s}_resolveScene(e,t){return(e={...e}).id=e.id||`scene-${t}`,e.nodes=(e.nodes||[]).map(e=>this.getNode(e)),e}_resolveNode(e,t){return(e={...e}).id=e.id||`node-${t}`,e.children&&(e.children=e.children.map(e=>this.getNode(e))),void 0!==e.mesh&&(e.mesh=this.getMesh(e.mesh)),void 0!==e.camera&&(e.camera=this.getCamera(e.camera)),void 0!==e.skin&&(e.skin=this.getSkin(e.skin)),e}_resolveSkin(e,t){return(e={...e}).id=e.id||`skin-${t}`,e.inverseBindMatrices=this.getAccessor(e.inverseBindMatrices),e}_resolveMesh(e,t){return(e={...e}).id=e.id||`mesh-${t}`,e.primitives&&(e.primitives=e.primitives.map(e=>{const t=(e={...e}).attributes;e.attributes={};for(const s in t)e.attributes[s]=this.getAccessor(t[s]);return void 0!==e.indices&&(e.indices=this.getAccessor(e.indices)),void 0!==e.material&&(e.material=this.getMaterial(e.material)),e})),e}_resolveMaterial(e,t){if((e={...e}).id=e.id||`material-${t}`,e.normalTexture&&(e.normalTexture={...e.normalTexture},e.normalTexture.texture=this.getTexture(e.normalTexture.index)),e.occlusionTexture&&(e.occlustionTexture={...e.occlustionTexture},e.occlusionTexture.texture=this.getTexture(e.occlusionTexture.index)),e.emissiveTexture&&(e.emmisiveTexture={...e.emmisiveTexture},e.emissiveTexture.texture=this.getTexture(e.emissiveTexture.index)),e.pbrMetallicRoughness){e.pbrMetallicRoughness={...e.pbrMetallicRoughness};const t=e.pbrMetallicRoughness;t.baseColorTexture&&(t.baseColorTexture={...t.baseColorTexture},t.baseColorTexture.texture=this.getTexture(t.baseColorTexture.index)),t.metallicRoughnessTexture&&(t.metallicRoughnessTexture={...t.metallicRoughnessTexture},t.metallicRoughnessTexture.texture=this.getTexture(t.metallicRoughnessTexture.index))}return e}_resolveAccessor(e,t){var s,r;return(e={...e}).id=e.id||`accessor-${t}`,void 0!==e.bufferView&&(e.bufferView=this.getBufferView(e.bufferView)),e.bytesPerComponent=(s=e.componentType,Te[s]),e.components=(r=e.type,Be[r]),e.bytesPerElement=e.bytesPerComponent*e.components,e}_resolveTexture(e,t){return(e={...e}).id=e.id||`texture-${t}`,e.sampler=this.getSampler(e.sampler),e.source=this.getImage(e.source),e}_resolveSampler(e,t){(e={...e}).id=e.id||`sampler-${t}`,e.parameters={};for(const t in e){const s=this._enumSamplerParameter(t);void 0!==s&&(e.parameters[s]=e[t])}return e}_enumSamplerParameter(e){return Le[e]}_resolveImage(e,t,s){if((e={...e}).id=e.id||`image-${t}`,void 0!==e.bufferView&&(e.bufferView=this.getBufferView(e.bufferView)),"uri"in e){const t=s.uri||this.gltf.baseUri;t&&(e.baseUri=t,e.fullUri=A(e.uri,t))}return e.getImageAsync=function(){return e.uri?new Promise(t=>{const s=new Image;s.crossOrigin="anonymous",s.onload=()=>t(s),s.src=e.fullUri||e.uri}):null},e}_resolveBufferView(e,t){(e={...e}).id=e.id||`bufferView-${t}`;const s=e.buffer;e.buffer=this.getBuffer(s);const r=this.buffers[s].arrayBuffer;let n=this.buffers[s].byteOffset||0;return"byteOffset"in e&&(n+=e.byteOffset),e.data=new Uint8Array(r,n,e.byteLength),e}_resolveCamera(e,t){return e.id=e.id||`camera-${t}`,e.perspective,e.orthographic,e}}function Ee(e,t){return(new Ve).postProcess(e,t)}function Ue(e,t=Float32Array){if(0===e.length)return new Float32Array(0);if(!function e(t,s=Number.isFinite){let r=-1;for(;++r<t.length;){const n=t[r];if(Array.isArray(n)||ArrayBuffer.isView(n)){if(!e(n,s))return!1}else if(!s(n))return!1}return!0}(e))return null;const s=new t(function e(t,s=3){let r=0;let n=0;let i=-1;for(;++i<t.length;){const s=t[i];Array.isArray(s)||ArrayBuffer.isView(s)?r+=e(s):n++}return r+(0===r&&n<s?s:n)}(e));return function(e,t,s=3){(function e(t,s,r,n){let i=-1,o=0;for(;++i<t.length;){const u=t[i];Array.isArray(u)||ArrayBuffer.isView(u)?n=e(u,s,r,n):o<r&&(s[n++]=u,o++)}return o>0&&o<r&&(s[n++]=0),n})(e,t,s,0)}(e,s),s}function Oe(e,t,s={}){const{flattenArrays:r=!1}=s;let n=e;if("string"==typeof n&&0===n.indexOf("#/"))return`#${n}`;if(Array.isArray(n)){const e=r&&Ue(n);if(!e)return n.map(e=>Oe(e,t,s));n=e}if(ArrayBuffer.isView(n)&&t){if(t.isImage(n)){return`#/images/${t.addImage(n)}`}return`#/accessors/${t.addBuffer(n)}`}if(null!==n&&"object"==typeof n){const e={};for(const r in n)e[r]=Oe(n[r],t,s);return e}return n}class Se{constructor(e={}){this.byteLength=0,this.json={buffers:[{byteLength:0}],bufferViews:[],accessors:[],images:[],meshes:[]},this.sourceBuffers=[],this.log=e.log||console}getByteLength(){return this.byteLength}isImage(e){return function(e,t){if(t){const{test:s}=G(t);return s(N(e))}return Boolean($(e))}(e)}encodeSync(e={}){return this.encodeAsGLB(e)}encodeAsGLB(e={}){this._packBinaryChunk(),e.magic&&console.warn("Custom glTF magic number no longer supported");const t={version:2,json:this.json,binary:this.arrayBuffer},s=xe(t,null,0,e),r=new ArrayBuffer(s);return xe(t,new DataView(r),0,e),r}addApplicationData(e,t,s={}){const r=s.packTypedArrays?Oe(t,this,s):t;return this.json[e]=r,this}addBuffer(e,t={size:3}){const s=this.addBufferView(e),r={size:t.size,componentType:_(e),count:Math.round(e.length/t.size)};return this.addAccessor(s,Object.assign(r,t))}addBufferView(e){const t=e.byteLength||e.length;return this.json.bufferViews.push({buffer:0,byteOffset:this.byteLength,byteLength:t}),this.byteLength+=T(t),this.sourceBuffers.push(e),this.json.bufferViews.length-1}addAccessor(e,t){return this.json.accessors.push({bufferView:e,type:j(t.size),componentType:t.componentType,count:t.count}),this.json.accessors.length-1}_pack(){return this._packBinaryChunk(),{arrayBuffer:this.arrayBuffer,json:this.json}}_packBinaryChunk(){if(this.arrayBuffer)return;const e=this.byteLength,t=new ArrayBuffer(e),s=new Uint8Array(t);let r=0;for(let e=0;e<this.sourceBuffers.length;e++){r=L(this.sourceBuffers[e],s,r)}this.json.buffers[0].byteLength=e,this.arrayBuffer=t,this.sourceBuffers=[]}_getInternalCounts(){return{buffers:this.json.buffers.length,bufferViews:this.json.bufferViews.length,accessors:this.json.accessors.length,images:this.json.images.length}}}class Re extends Se{constructor(e={}){super(e),this.DracoWriter=e.DracoWriter,this.DracoLoader=e.DracoLoader}addApplicationData(e,t,s={}){const r=s.packTypedArrays?Oe(t,this,s):t;return this.json[e]=r,this}addExtraData(e,t,s={}){const r=s.packedTypedArrays?Oe(t,this,s):t;return this.json.extras=this.json.extras||{},this.json.extras[e]=r,this}addExtension(e,t,s={}){m(t);const r=s.packTypedArrays?Oe(t,this,s):t;return this.json.extensions=this.json.extensions||{},this.json.extensions[e]=r,this.registerUsedExtension(e),this}addRequiredExtension(e,t,s={}){m(t);const r=s.packTypedArrays?Oe(t,this,s):t;return this.addExtension(e,r),this.registerRequiredExtension(e),this}registerUsedExtension(e){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find(t=>t===e)||this.json.extensionsUsed.push(e)}registerRequiredExtension(e){this.registerUsedExtension(e),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find(t=>t===e)||this.json.extensionsRequired.push(e)}addMesh(e,t,s=4){const r={primitives:[{attributes:this._addAttributes(e),indices:t,mode:s}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(r),this.json.meshes.length-1}addPointCloud(e){const t={primitives:[{attributes:this._addAttributes(e),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(t),this.json.meshes.length-1}addCompressedMesh(e,t,s=4){if(!this.DracoWriter||!this.DracoLoader)throw new Error("DracoWriter/DracoLoader not available");this.registerRequiredExtension(n);const r=this.DracoWriter.encodeSync({attributes:e}),i=this.DracoLoader.parseSync({attributes:e}),o=this._addFauxAttributes(i.attributes),u=this.addBufferView(r),a={primitives:[{attributes:o,mode:s,extensions:{[n]:{bufferView:u,attributes:o}}}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(a),this.json.meshes.length-1}addCompressedPointCloud(e){if(!this.DracoWriter||!this.DracoLoader)throw new Error("DracoWriter/DracoLoader not available");e.mode=0;const t=this.DracoWriter.encodeSync(e,{pointcloud:!0}),s=this.addBufferView(t),r={primitives:[{attributes:{},mode:0,extensions:{[i]:{bufferView:s}}}]};return this.registerRequiredExtension(i),this.json.meshes=this.json.meshes||[],this.json.meshes.push(r),this.json.meshes.length-1}addImage(e){const t=this.addBufferView(e),s=q(e)||{};if(s){const{mimeType:e,width:r,height:n}=s;this.json.images.push({bufferView:t,mimeType:e,width:r,height:n})}else this.json.images.push({bufferView:t});return this.json.images.length-1}}s.d(t,"KHR_DRACO_MESH_COMPRESSION",function(){return n}),s.d(t,"UBER_POINT_CLOUD_EXTENSION",function(){return i}),s.d(t,"GLTFLoader",function(){return de}),s.d(t,"GLTFWriter",function(){return _e}),s.d(t,"GLBLoader",function(){return ve}),s.d(t,"GLBWriter",function(){return Ae}),s.d(t,"GLTFScenegraph",function(){return z}),s.d(t,"postProcessGLTF",function(){return Ee}),s.d(t,"parseGLTFSync",function(){return Y}),s.d(t,"encodeGLTFSync",function(){return je}),s.d(t,"packBinaryJson",function(){return Oe}),s.d(t,"unpackBinaryJson",function(){return se}),s.d(t,"GLBParser",function(){return oe}),s.d(t,"GLBBuilder",function(){return Se}),s.d(t,"GLTFParser",function(){return le}),s.d(t,"GLTFBuilder",function(){return Re})}])}); |
@@ -14,2 +14,4 @@ "use strict"; | ||
var _loaderUtils = require("@loaders.gl/loader-utils"); | ||
var _images = require("@loaders.gl/images"); | ||
@@ -19,4 +21,2 @@ | ||
var _encodeUtils = require("../utils/encode-utils"); | ||
var _encodeGlb = _interopRequireDefault(require("../encode-glb")); | ||
@@ -113,3 +113,3 @@ | ||
}); | ||
this.byteLength += (0, _encodeUtils.padTo4Bytes)(byteLength); | ||
this.byteLength += (0, _loaderUtils.padTo4Bytes)(byteLength); | ||
this.sourceBuffers.push(buffer); | ||
@@ -153,3 +153,3 @@ return this.json.bufferViews.length - 1; | ||
var sourceBuffer = this.sourceBuffers[i]; | ||
dstByteOffset = (0, _encodeUtils.copyToArray)(sourceBuffer, targetArray, dstByteOffset); | ||
dstByteOffset = (0, _loaderUtils.copyToArray)(sourceBuffer, targetArray, dstByteOffset); | ||
} | ||
@@ -156,0 +156,0 @@ |
@@ -8,3 +8,3 @@ "use strict"; | ||
var _encodeUtils = require("./utils/encode-utils"); | ||
var _loaderUtils = require("@loaders.gl/loader-utils"); | ||
@@ -45,3 +45,3 @@ var MAGIC_glTF = 0x46546c67; | ||
var jsonString = JSON.stringify(json); | ||
byteOffset = (0, _encodeUtils.copyPaddedStringToDataView)(dataView, byteOffset, jsonString, 4); | ||
byteOffset = (0, _loaderUtils.copyPaddedStringToDataView)(dataView, byteOffset, jsonString, 4); | ||
@@ -62,3 +62,3 @@ if (dataView) { | ||
byteOffset += 8; | ||
byteOffset = (0, _encodeUtils.copyPaddedArrayBufferToDataView)(dataView, byteOffset, binary, 4); | ||
byteOffset = (0, _loaderUtils.copyPaddedArrayBufferToDataView)(dataView, byteOffset, binary, 4); | ||
@@ -65,0 +65,0 @@ if (dataView) { |
@@ -18,6 +18,6 @@ "use strict"; | ||
var _loaderUtils = require("@loaders.gl/loader-utils"); | ||
var _assert = _interopRequireDefault(require("./utils/assert")); | ||
var _encodeUtils = require("./utils/encode-utils"); | ||
var _gltfUtils = require("./gltf-utils/gltf-utils"); | ||
@@ -324,3 +324,3 @@ | ||
var byteLength = buffer.byteLength || buffer.length; | ||
this.byteLength += (0, _encodeUtils.padTo4Bytes)(byteLength); | ||
this.byteLength += (0, _loaderUtils.padTo4Bytes)(byteLength); | ||
this.sourceBuffers = this.sourceBuffers || []; | ||
@@ -378,3 +378,3 @@ this.sourceBuffers.push(buffer); | ||
var sourceBuffer = this.sourceBuffers[i]; | ||
dstByteOffset = (0, _encodeUtils.copyToArray)(sourceBuffer, targetArray, dstByteOffset); | ||
dstByteOffset = (0, _loaderUtils.copyToArray)(sourceBuffer, targetArray, dstByteOffset); | ||
} | ||
@@ -381,0 +381,0 @@ |
@@ -9,3 +9,3 @@ "use strict"; | ||
var _core = require("@loaders.gl/core"); | ||
var _loaderUtils = require("@loaders.gl/loader-utils"); | ||
@@ -51,14 +51,14 @@ var MAGIC_glTF = 0x676c5446; | ||
(0, _core.assert)(glb.version === 2, "Invalid GLB version ".concat(glb.version, ". Only .glb v2 supported")); | ||
(0, _core.assert)(glb.byteLength > 20); | ||
(0, _loaderUtils.assert)(glb.version === 2, "Invalid GLB version ".concat(glb.version, ". Only .glb v2 supported")); | ||
(0, _loaderUtils.assert)(glb.byteLength > 20); | ||
var jsonChunkLength = dataView.getUint32(byteOffset + 12, LE); | ||
var jsonChunkFormat = dataView.getUint32(byteOffset + 16, LE); | ||
var isJSONChunk = jsonChunkFormat === GLB_CHUNK_TYPE_JSON || jsonChunkFormat === 0; | ||
(0, _core.assert)(isJSONChunk, "JSON chunk format ".concat(jsonChunkFormat)); | ||
(0, _loaderUtils.assert)(isJSONChunk, "JSON chunk format ".concat(jsonChunkFormat)); | ||
var jsonChunkByteOffset = GLB_FILE_HEADER_SIZE + GLB_CHUNK_HEADER_SIZE; | ||
var jsonChunk = new Uint8Array(arrayBuffer, byteOffset + jsonChunkByteOffset, jsonChunkLength); | ||
var textDecoder = new _core.TextDecoder('utf8'); | ||
var textDecoder = new TextDecoder('utf8'); | ||
var jsonText = textDecoder.decode(jsonChunk); | ||
glb.json = JSON.parse(jsonText); | ||
var binChunkStart = jsonChunkByteOffset + (0, _core.padTo4Bytes)(jsonChunkLength); | ||
var binChunkStart = jsonChunkByteOffset + (0, _loaderUtils.padTo4Bytes)(jsonChunkLength); | ||
glb.hasBinChunk = binChunkStart + 8 <= glb.byteLength; | ||
@@ -70,3 +70,3 @@ | ||
var isBinChunk = binChunkFormat === GLB_CHUNK_TYPE_BIN || binChunkFormat === 1; | ||
(0, _core.assert)(isBinChunk, "BIN chunk format ".concat(binChunkFormat)); | ||
(0, _loaderUtils.assert)(isBinChunk, "BIN chunk format ".concat(binChunkFormat)); | ||
var binChunkByteOffset = binChunkStart + GLB_CHUNK_HEADER_SIZE; | ||
@@ -73,0 +73,0 @@ glb.binChunkByteOffset = binChunkByteOffset; |
@@ -11,4 +11,5 @@ import parseGLBSync from './lib/parse-glb'; | ||
function parseSync(arrayBuffer, options) { | ||
const _options$byteOffset = options.byteOffset, | ||
byteOffset = _options$byteOffset === void 0 ? 0 : _options$byteOffset; | ||
const { | ||
byteOffset = 0 | ||
} = options; | ||
const glb = {}; | ||
@@ -15,0 +16,0 @@ parseGLBSync(glb, arrayBuffer, byteOffset, options); |
@@ -10,4 +10,5 @@ import encodeGLBSync from './lib/encode-glb'; | ||
function encodeSync(glb, options) { | ||
const _options$byteOffset = options.byteOffset, | ||
byteOffset = _options$byteOffset === void 0 ? 0 : _options$byteOffset; | ||
const { | ||
byteOffset = 0 | ||
} = options; | ||
const byteLength = encodeGLBSync(glb, null, byteOffset, options); | ||
@@ -14,0 +15,0 @@ const arrayBuffer = new ArrayBuffer(byteLength); |
@@ -22,5 +22,5 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread"; | ||
const _options2 = options, | ||
_options2$byteOffset = _options2.byteOffset, | ||
byteOffset = _options2$byteOffset === void 0 ? 0 : _options2$byteOffset; | ||
const { | ||
byteOffset = 0 | ||
} = options; | ||
const gltf = {}; | ||
@@ -41,5 +41,5 @@ yield parseGLTF(gltf, arrayBuffer, byteOffset, options); | ||
const _options = options, | ||
_options$byteOffset = _options.byteOffset, | ||
byteOffset = _options$byteOffset === void 0 ? 0 : _options$byteOffset; | ||
const { | ||
byteOffset = 0 | ||
} = options; | ||
const gltf = {}; | ||
@@ -46,0 +46,0 @@ parseGLTFSync(gltf, arrayBuffer, byteOffset, options); |
@@ -5,4 +5,5 @@ import { encodeGLTFSync } from './lib/encode-gltf'; | ||
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
const _options$byteOffset = options.byteOffset, | ||
byteOffset = _options$byteOffset === void 0 ? 0 : _options$byteOffset; | ||
const { | ||
byteOffset = 0 | ||
} = options; | ||
const byteLength = encodeGLTFSync(gltf, null, byteOffset, options); | ||
@@ -9,0 +10,0 @@ const arrayBuffer = new ArrayBuffer(byteLength); |
@@ -0,5 +1,4 @@ | ||
import { padTo4Bytes, copyToArray } from '@loaders.gl/loader-utils'; | ||
import { isImage } from '@loaders.gl/images'; | ||
import { getAccessorTypeFromSize, getComponentTypeFromArray } from '../gltf-utils/gltf-utils'; | ||
import { padTo4Bytes } from '../utils/encode-utils'; | ||
import { copyToArray } from '../utils/encode-utils'; | ||
import encodeGLBSync from '../encode-glb'; | ||
@@ -6,0 +5,0 @@ import packBinaryJson from './packed-json/pack-binary-json'; |
@@ -163,5 +163,7 @@ import { getImageMetadata } from '@loaders.gl/images'; | ||
if (sizeAndType) { | ||
const mimeType = sizeAndType.mimeType, | ||
width = sizeAndType.width, | ||
height = sizeAndType.height; | ||
const { | ||
mimeType, | ||
width, | ||
height | ||
} = sizeAndType; | ||
this.json.images.push({ | ||
@@ -168,0 +170,0 @@ bufferView: bufferViewIndex, |
@@ -53,3 +53,5 @@ import { getFullUri } from '../gltf-utils/gltf-utils'; | ||
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
const gltf = this.gltf; | ||
const { | ||
gltf | ||
} = this; | ||
(gltf.bufferViews || []).forEach((bufView, i) => this._resolveBufferView(bufView, i)); | ||
@@ -252,4 +254,5 @@ (gltf.images || []).forEach((image, i) => this._resolveImage(image, i, options)); | ||
const _options$createImages = options.createImages, | ||
createImages = _options$createImages === void 0 ? true : _options$createImages; | ||
const { | ||
createImages = true | ||
} = options; | ||
@@ -297,3 +300,5 @@ if (createImages) { | ||
_process_extension_KHR_lights_punctual() { | ||
const gltf = this.gltf; | ||
const { | ||
gltf | ||
} = this; | ||
const extension = gltf.extensions && gltf.extensions.KHR_lights_punctual; | ||
@@ -300,0 +305,0 @@ |
import { flattenToTypedArray } from './flatten-to-typed-array'; | ||
export default function packBinaryJson(json, glbBuilder) { | ||
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
const _options$flattenArray = options.flattenArrays, | ||
flattenArrays = _options$flattenArray === void 0 ? false : _options$flattenArray; | ||
const { | ||
flattenArrays = false | ||
} = options; | ||
let object = json; | ||
@@ -7,0 +8,0 @@ |
@@ -1,2 +0,1 @@ | ||
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray"; | ||
export default function unpackJsonArrays(json, buffers) { | ||
@@ -37,6 +36,3 @@ let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
if (pointer) { | ||
const _pointer = _slicedToArray(pointer, 2), | ||
field = _pointer[0], | ||
index = _pointer[1]; | ||
const [field, index] = pointer; | ||
const buffer = buffers[field] && buffers[field][index]; | ||
@@ -43,0 +39,0 @@ |
@@ -31,6 +31,6 @@ import assert from '../../utils/assert'; | ||
if (bufferView) { | ||
const _getAccessorArrayType = getAccessorArrayTypeAndLength(accessor, bufferView), | ||
ArrayType = _getAccessorArrayType.ArrayType, | ||
length = _getAccessorArrayType.length; | ||
const { | ||
ArrayType, | ||
length | ||
} = getAccessorArrayTypeAndLength(accessor, bufferView); | ||
const array = new ArrayType(arrayBuffer, bufferView.byteOffset, length); | ||
@@ -37,0 +37,0 @@ array.accessor = accessor; |
@@ -1,2 +0,2 @@ | ||
import { copyPaddedStringToDataView, copyPaddedArrayBufferToDataView } from './utils/encode-utils'; | ||
import { copyPaddedStringToDataView, copyPaddedArrayBufferToDataView } from '@loaders.gl/loader-utils'; | ||
const MAGIC_glTF = 0x46546c67; | ||
@@ -9,9 +9,8 @@ const MAGIC_JSON = 0x4e4f534a; | ||
let options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; | ||
const _glb$magic = glb.magic, | ||
magic = _glb$magic === void 0 ? MAGIC_glTF : _glb$magic, | ||
_glb$version = glb.version, | ||
version = _glb$version === void 0 ? 2 : _glb$version, | ||
_glb$json = glb.json, | ||
json = _glb$json === void 0 ? {} : _glb$json, | ||
binary = glb.binary; | ||
const { | ||
magic = MAGIC_glTF, | ||
version = 2, | ||
json = {}, | ||
binary | ||
} = glb; | ||
const byteOffsetStart = byteOffset; | ||
@@ -18,0 +17,0 @@ |
@@ -8,5 +8,5 @@ import encodeGLBSync from './encode-glb'; | ||
function convertBuffersToBase64(gltf) { | ||
let _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, | ||
_ref$firstBuffer = _ref.firstBuffer, | ||
firstBuffer = _ref$firstBuffer === void 0 ? 0 : _ref$firstBuffer; | ||
let { | ||
firstBuffer = 0 | ||
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
@@ -13,0 +13,0 @@ if (gltf.buffers && gltf.buffers.length > firstBuffer) { |
@@ -30,3 +30,5 @@ import GLTFScenegraph from '../gltf-scenegraph'; | ||
const gltfScenegraph = new GLTFScenegraph(gltfData); | ||
const json = gltfScenegraph.json; | ||
const { | ||
json | ||
} = gltfScenegraph; | ||
@@ -33,0 +35,0 @@ if (json.lights) { |
import { getImageMIMEType } from '@loaders.gl/images'; | ||
import { padTo4Bytes, copyToArray } from '@loaders.gl/loader-utils'; | ||
import assert from './utils/assert'; | ||
import { padTo4Bytes, copyToArray } from './utils/encode-utils'; | ||
import { getAccessorArrayTypeAndLength, getAccessorTypeFromSize, getComponentTypeFromArray } from './gltf-utils/gltf-utils'; | ||
@@ -137,7 +137,6 @@ export default class GLTFScenegraph { | ||
const arrayBuffer = buffer.data; | ||
const _getAccessorArrayType = getAccessorArrayTypeAndLength(accessor, bufferView), | ||
ArrayType = _getAccessorArrayType.ArrayType, | ||
length = _getAccessorArrayType.length; | ||
const { | ||
ArrayType, | ||
length | ||
} = getAccessorArrayTypeAndLength(accessor, bufferView); | ||
const byteOffset = bufferView.byteOffset + accessor.byteOffset; | ||
@@ -144,0 +143,0 @@ return new ArrayType(arrayBuffer, byteOffset, length); |
@@ -17,7 +17,7 @@ import { getAccessorTypeFromSize, getComponentTypeFromArray } from './gltf-utils'; | ||
export function getGLTFAccessor(attribute, gltfAttributeName) { | ||
const _getAccessorData = getAccessorData(attribute, gltfAttributeName), | ||
buffer = _getAccessorData.buffer, | ||
size = _getAccessorData.size, | ||
count = _getAccessorData.count; | ||
const { | ||
buffer, | ||
size, | ||
count | ||
} = getAccessorData(attribute, gltfAttributeName); | ||
const glTFAccessor = { | ||
@@ -24,0 +24,0 @@ value: buffer, |
@@ -1,2 +0,2 @@ | ||
import { TextDecoder, padTo4Bytes, assert } from '@loaders.gl/core'; | ||
import { padTo4Bytes, assert } from '@loaders.gl/loader-utils'; | ||
const MAGIC_glTF = 0x676c5446; | ||
@@ -18,4 +18,5 @@ const GLB_FILE_HEADER_SIZE = 12; | ||
const dataView = new DataView(arrayBuffer); | ||
const _options$magic = options.magic, | ||
magic = _options$magic === void 0 ? MAGIC_glTF : _options$magic; | ||
const { | ||
magic = MAGIC_glTF | ||
} = options; | ||
const magic1 = dataView.getUint32(byteOffset, false); | ||
@@ -33,4 +34,5 @@ return magic1 === magic || magic1 === MAGIC_glTF; | ||
glb.type = getMagicString(dataView); | ||
const _options$magic2 = options.magic, | ||
magic = _options$magic2 === void 0 ? MAGIC_glTF : _options$magic2; | ||
const { | ||
magic = MAGIC_glTF | ||
} = options; | ||
const isMagicValid = glb.magic === MAGIC_glTF || glb.magic === magic; | ||
@@ -37,0 +39,0 @@ |
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck"; | ||
import _createClass from "@babel/runtime/helpers/esm/createClass"; | ||
import { padTo4Bytes, copyToArray } from '@loaders.gl/loader-utils'; | ||
import { isImage as _isImage } from '@loaders.gl/images'; | ||
import { getAccessorTypeFromSize, getComponentTypeFromArray } from '../gltf-utils/gltf-utils'; | ||
import { padTo4Bytes } from '../utils/encode-utils'; | ||
import { copyToArray } from '../utils/encode-utils'; | ||
import encodeGLBSync from '../encode-glb'; | ||
@@ -8,0 +7,0 @@ import packBinaryJson from './packed-json/pack-binary-json'; |
@@ -1,2 +0,2 @@ | ||
import { copyPaddedStringToDataView, copyPaddedArrayBufferToDataView } from './utils/encode-utils'; | ||
import { copyPaddedStringToDataView, copyPaddedArrayBufferToDataView } from '@loaders.gl/loader-utils'; | ||
var MAGIC_glTF = 0x46546c67; | ||
@@ -3,0 +3,0 @@ var MAGIC_JSON = 0x4e4f534a; |
@@ -5,4 +5,4 @@ import _typeof from "@babel/runtime/helpers/esm/typeof"; | ||
import { getImageMIMEType } from '@loaders.gl/images'; | ||
import { padTo4Bytes, copyToArray } from '@loaders.gl/loader-utils'; | ||
import assert from './utils/assert'; | ||
import { padTo4Bytes, copyToArray } from './utils/encode-utils'; | ||
import { getAccessorArrayTypeAndLength, getAccessorTypeFromSize, getComponentTypeFromArray } from './gltf-utils/gltf-utils'; | ||
@@ -9,0 +9,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { TextDecoder, padTo4Bytes, assert } from '@loaders.gl/core'; | ||
import { padTo4Bytes, assert } from '@loaders.gl/loader-utils'; | ||
var MAGIC_glTF = 0x676c5446; | ||
@@ -3,0 +3,0 @@ var GLB_FILE_HEADER_SIZE = 12; |
{ | ||
"name": "@loaders.gl/gltf", | ||
"version": "1.1.0-beta.1", | ||
"version": "1.1.0", | ||
"description": "Framework-independent loader for the glTF format", | ||
@@ -41,5 +41,6 @@ "license": "MIT", | ||
"dependencies": { | ||
"@loaders.gl/core": "1.1.0-beta.1", | ||
"@loaders.gl/images": "1.1.0-beta.1" | ||
} | ||
"@loaders.gl/core": "1.1.0", | ||
"@loaders.gl/images": "1.1.0" | ||
}, | ||
"gitHead": "3e703baf6d39bbefce19a509709f5dc80a1cc428" | ||
} |
# @loaders.gl/gltf | ||
[loaders.gl](https://uber-web.github.io/loaders.gl/#/docs) is a collection of framework independent 3D and geospatial parsers and encoders. | ||
[loaders.gl](https://loaders.gl/docs) is a collection of framework independent 3D and geospatial parsers and encoders. | ||
@@ -5,0 +5,0 @@ This module contains loader and writers for the glTF format. |
/* eslint-disable camelcase, max-statements */ | ||
import {padTo4Bytes, copyToArray} from '@loaders.gl/loader-utils'; | ||
import {isImage} from '@loaders.gl/images'; | ||
import {getAccessorTypeFromSize, getComponentTypeFromArray} from '../gltf-utils/gltf-utils'; | ||
import {padTo4Bytes} from '../utils/encode-utils'; | ||
import {copyToArray} from '../utils/encode-utils'; | ||
import encodeGLBSync from '../encode-glb'; | ||
@@ -7,0 +6,0 @@ import packBinaryJson from './packed-json/pack-binary-json'; |
/* eslint-disable camelcase, max-statements */ | ||
import {copyPaddedStringToDataView, copyPaddedArrayBufferToDataView} from './utils/encode-utils'; | ||
import { | ||
copyPaddedStringToDataView, | ||
copyPaddedArrayBufferToDataView | ||
} from '@loaders.gl/loader-utils'; | ||
@@ -4,0 +7,0 @@ const MAGIC_glTF = 0x46546c67; // glTF in ASCII |
import {getImageMIMEType} from '@loaders.gl/images'; | ||
import {padTo4Bytes, copyToArray} from '@loaders.gl/loader-utils'; | ||
import assert from './utils/assert'; | ||
import {padTo4Bytes, copyToArray} from './utils/encode-utils'; | ||
import { | ||
@@ -5,0 +5,0 @@ getAccessorArrayTypeAndLength, |
/* eslint-disable camelcase, max-statements */ | ||
import {TextDecoder, padTo4Bytes, assert} from '@loaders.gl/core'; | ||
/* global TextDecoder */ | ||
import {padTo4Bytes, assert} from '@loaders.gl/loader-utils'; | ||
@@ -4,0 +5,0 @@ const MAGIC_glTF = 0x676c5446; // glTF in Big-Endian ASCII |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
19
1313179
210
1
17085
+ Added@loaders.gl/core@1.1.0(transitive)
+ Added@loaders.gl/images@1.1.0(transitive)
- Removed@loaders.gl/core@1.1.0-beta.1(transitive)
- Removed@loaders.gl/images@1.1.0-beta.1(transitive)
Updated@loaders.gl/core@1.1.0
Updated@loaders.gl/images@1.1.0