@maptalks/gpu 0.118.0 → 0.119.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/maptalksgpu.d.ts +2 -2
- package/dist/maptalksgpu.es.js +10 -9
- package/dist/maptalksgpu.es.js.map +1 -1
- package/dist/maptalksgpu.js +11 -11
- package/dist/maptalksgpu.js.map +1 -1
- package/dist/transcoders.js +2 -2
- package/package.json +4 -4
package/dist/maptalksgpu.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @maptalks/gpu v0.
|
|
2
|
+
* @maptalks/gpu v0.119.0
|
|
3
3
|
* LICENSE : UNLICENSED
|
|
4
|
-
* (c) 2016-
|
|
4
|
+
* (c) 2016-2026 maptalks.com
|
|
5
5
|
*/
|
|
6
6
|
(function (global, factory) {
|
|
7
7
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('maptalks')) :
|
|
@@ -82,9 +82,9 @@
|
|
|
82
82
|
|
|
83
83
|
function gltfLoaderExport(e){var t=function(){return "undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:void 0};if(t().maptalks_gltf_loader)return;
|
|
84
84
|
/*!
|
|
85
|
-
* @maptalks/gltf-loader v0.
|
|
85
|
+
* @maptalks/gltf-loader v0.119.0
|
|
86
86
|
* LICENSE : UNLICENSED
|
|
87
|
-
* (c) 2016-
|
|
87
|
+
* (c) 2016-2026 maptalks.org
|
|
88
88
|
*/var s="undefined"!=typeof Float32Array?Float32Array:Array;function r(e,t,s){var r=t[0],n=t[1],i=t[2],a=t[3],o=t[4],f=t[5],u=t[6],h=t[7],c=t[8],l=t[9],d=t[10],m=t[11],g=t[12],p=t[13],b=t[14],_=t[15],y=s[0],x=s[1],w=s[2],T=s[3];return e[0]=y*r+x*o+w*c+T*g,e[1]=y*n+x*f+w*l+T*p,e[2]=y*i+x*u+w*d+T*b,e[3]=y*a+x*h+w*m+T*_,y=s[4],x=s[5],w=s[6],T=s[7],e[4]=y*r+x*o+w*c+T*g,e[5]=y*n+x*f+w*l+T*p,e[6]=y*i+x*u+w*d+T*b,e[7]=y*a+x*h+w*m+T*_,y=s[8],x=s[9],w=s[10],T=s[11],e[8]=y*r+x*o+w*c+T*g,e[9]=y*n+x*f+w*l+T*p,e[10]=y*i+x*u+w*d+T*b,e[11]=y*a+x*h+w*m+T*_,y=s[12],x=s[13],w=s[14],T=s[15],e[12]=y*r+x*o+w*c+T*g,e[13]=y*n+x*f+w*l+T*p,e[14]=y*i+x*u+w*d+T*b,e[15]=y*a+x*h+w*m+T*_,e}function n(){var e=new s(3);return s!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function i(e,t,r){var n=new s(3);return n[0]=e,n[1]=t,n[2]=r,n}function a(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function o(e,t,s,r){return e[0]=t,e[1]=s,e[2]=r,e}function f(e,t,s){return e[0]=t[0]+s[0],e[1]=t[1]+s[1],e[2]=t[2]+s[2],e}function u(e,t,s){return e[0]=t[0]*s,e[1]=t[1]*s,e[2]=t[2]*s,e}function h(e,t,s,r,n){return e[0]=t,e[1]=s,e[2]=r,e[3]=n,e}function c(e,t,s){var r=t[0],n=t[1],i=t[2],a=t[3];return e[0]=s[0]*r+s[4]*n+s[8]*i+s[12]*a,e[1]=s[1]*r+s[5]*n+s[9]*i+s[13]*a,e[2]=s[2]*r+s[6]*n+s[10]*i+s[14]*a,e[3]=s[3]*r+s[7]*n+s[11]*i+s[15]*a,e}function l(){var e=new s(4);return s!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)}),n(),function(){var e;e=new s(4),s!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0);}();var d,m=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e};n(),i(1,0,0),i(0,1,0),l(),l(),d=new s(9),s!=Float32Array&&(d[1]=0,d[2]=0,d[3]=0,d[5]=0,d[6]=0,d[7]=0),d[0]=1,d[4]=1,d[8]=1;let g=0;function p(e){return null==e}function b(e){return !p(e)}function _(e){return !p(e)&&("string"==typeof e||null!==e.constructor&&e.constructor===String)}function y(e){for(let t=1;t<arguments.length;t++){const s=arguments[t];for(const t in s)e[t]=s[t];}return e}function x(e){switch(e){case 5120:return Int8Array;case 5121:return Uint8Array;case 5122:return Int16Array;case 5123:return Uint16Array;case 5124:return Int32Array;case 5125:return Uint32Array;case 5126:return Float32Array}throw new Error("unsupported bufferView's component type: "+e)}function w(e){return 0===e.indexOf("data:")&&e.indexOf("base64,")>0}function T(e){const t=function(e){return "undefined"!=typeof self?self.atob(e):window.atob(e)}(e.substring(e.indexOf(",")+1)),s=t.length,r=new Uint8Array(s);for(let e=0;e<s;e++)r[e]=t.charCodeAt(e);return r.buffer}const E=[],O=[],I=[],R=[0,0,0],A=function(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}([]),q=[1,1,1];function B(e,t,s,r,n,i,a){const o=x(a),f=o.BYTES_PER_ELEMENT;if((0===n||n===r*f)&&i%f==0){const n=new o(t,i,s*r);return e.set(n),e}0===n&&(n=r*f);const u=new Uint8Array(r*f);for(let a=0;a<s;a++){let s=null;const h=new Uint8Array(t,n*a+i,r*f);u.set(h),s=new o(u.buffer,0,r);for(let t=0;t<r;t++)e[a*r+t]=s[t];}return e}const N="undefined"!=typeof TextDecoder?new TextDecoder("utf-8"):null;function v(e,t,s){const r=new Uint8Array(e,t,s);return N.decode(r)}const P={get:function(e,t={},s){t||(t={});const r=new AbortController,n=r.signal,i=y({},t);i.signal=n,i.method||(i.method="GET"),i.referrerPolicy=i.referrerPolicy||"origin","undefined"==typeof window||i.referrer||(i.referrer=window.location.href),s&&(e=s(e));const a=fetch(e,i).then((e=>{const s=this._parseResponse(e,t.responseType);return s.message?s:s.then((s=>"arraybuffer"===t.responseType?{data:s,cacheControl:e.headers.get("Cache-Control"),expires:e.headers.get("Expires"),contentType:e.headers.get("Content-Type")}:s)).catch((e=>{if(!e.code||e.code!==DOMException.ABORT_ERR)throw e}))})).catch((e=>{if(!e.code||e.code!==DOMException.ABORT_ERR)throw e}));return a.xhr=r,a},_parseResponse:(e,t)=>200!==e.status?{status:e.status,statusText:e.statusText,message:`incorrect http request with status code(${e.status}): ${e.statusText}`}:"arraybuffer"===t?e.arrayBuffer():"json"===t?e.json():e.text(),getArrayBuffer:(e,t={},s)=>(t||(t={}),t.responseType="arraybuffer",P.get(e,t,s)),getJSON:function(e,t={},s){return t&&t.jsonp?P.jsonp(e):((t=t||{}).responseType="json",P.get(e,t,s))},jsonp:function(e){const t="_maptalks_jsonp_"+g++;e.match(/\?/)?e+="&callback="+t:e+="?callback="+t;let s=document.createElement("script");return s.type="text/javascript",s.src=e,new Promise((e=>{window[t]=function(r){document.getElementsByTagName("head")[0].removeChild(s),s=null,delete window[t],e(r);},document.getElementsByTagName("head")[0].appendChild(s);}))}};class M{constructor(e,t,s,r,n){this._requestImage=e,this.decoders=t,this._supportedFormats=s,this.images={},this._imgRequests={},this._fetchOptions=r||{},this._urlModifier=n;}requestImageFromBufferURI(e,t,s){if(this.buffers[e.id]){const r=this.buffers[e.id],n=this._createDataView(t,r);return this.getImageByBuffer(n,s)}if(this._imgRequests[e.id])return this._imgRequests[e.id].then((()=>{const r=this.buffers[e.id],n=this._createDataView(t,r);return this.getImageByBuffer(n,s)}));if(w(e.uri)){const r=this.buffers[e.id]=T(e.uri),n=this._createDataView(t,r);return this.getImageByBuffer(n,s)}let r;const n=e.uri.indexOf("blob:")>=0;return r=e.uri.indexOf("://")>0||n?e.uri:this.rootPath+"/"+e.uri,this._imgRequests[e.id]=P.getArrayBuffer(r,this._fetchOptions,this._urlModifier).then((r=>{const n=this.buffers[e.id]=r.data,i=this._createDataView(t,n);return this.getImageByBuffer(i,s)}))}getImageByBuffer(e,t){if(this.images[t.id])return Promise.resolve(this.images[t.id]);const s=this.decoders;if(s[t.mimeType])return s[t.mimeType](e,{supportedFormats:this._supportedFormats});if("image/crn"===t.mimeType||"image/ktx2"===t.mimeType||"image/cttf"===t.mimeType)throw new Error("missing transcoder for "+t.mimeType,"");return this._getImageInfo(t.id,e)}requestExternalImage(e){if(this.images[e.id])return Promise.resolve(this.images[e.id]);const t=0===e.uri.indexOf("data:image/")?e.uri:this.rootPath+"/"+e.uri;return this._imgRequests[e.id]?this._imgRequests[e.id].then((()=>this.images[e.id])):this._imgRequests[e.id]=this._getImageInfo(e.id,t)}_getImageInfo(e,t){return new Promise(((s,r)=>{let n=t;this._urlModifier&&(n=this._urlModifier(t)),this._requestImage(n,this._fetchOptions,((n,i)=>{n?r(n):(URL.revokeObjectURL(t),this.images[e]=i,s(this.images[e]));}));}))}}const S=["SCALAR",1,"VEC2",2,"VEC3",3,"VEC4",4,"MAT2",4,"MAT3",9,"MAT4",16],V=[];class L{constructor(e,t,s,r,n){this.rootPath=e,this.gltf=t,this._enableInterleave=!1,this.glbBuffer=s,this.buffers={},this.requests={},this.accessors={},this._compareAccessor(),this._fetchOptions=r,this._urlModifier=n;}_requestData(e,t){const s=this.gltf,r=s.accessors[t];if(void 0===r.bufferView)return this.accessors[r.id]=this._toBufferData(e,t,null,0),Promise.resolve(this.accessors[r.id]);if(r&&this.accessors[r.id])return Promise.resolve(this.accessors[r.id]);const n=s.bufferViews[r.bufferView];return this._requestBufferOfBufferView(n).then((s=>{const{buffer:n,byteOffset:i}=s;return this.accessors[r.id]=this._toBufferData(e,t,n,i)}))}_requestBufferOfBufferView(e){const t=this.gltf.buffers[e.buffer];if(this.buffers[t.id]){const e=this.buffers[t.id];return Promise.resolve({buffer:e,byteOffset:0})}if(this.requests[t.id])return this.requests[t.id].then((()=>{const e=this.buffers[t.id];return Promise.resolve({buffer:e,byteOffset:0})}));if("binary_glTF"!==e.buffer&&"KHR_binary_glTF"!==e.buffer&&t.uri){if(w(t.uri)){const e=this.buffers[t.id]=T(t.uri);return Promise.resolve({buffer:e,byteOffset:0})}let e;const s=t.uri.indexOf("blob:")>=0;return e=t.uri.indexOf("://")>0||s?t.uri:this.rootPath+"/"+t.uri,this.requests[t.id]=P.getArrayBuffer(e,this._fetchOptions,!s&&this._urlModifier).then((r=>(s&&URL.revokeObjectURL(e),{buffer:this.buffers[t.id]=r.data,byteOffset:0})))}return Promise.resolve({buffer:this.glbBuffer.buffer,byteOffset:this.glbBuffer.byteOffset})}_toBufferData(e,t,s,r=0){const n=this.gltf,i=n.accessors[t],a=void 0!==i.bufferView?n.bufferViews[i.bufferView]:{},o=(a.byteOffset||0)+r,f=this._getTypeItemSize(i.type),u=x(i.componentType),h=a.byteStride||0,l={array:void 0,name:e,accessorName:t,byteLength:i.count*f*u.BYTES_PER_ELEMENT,componentType:i.componentType,count:i.count,type:i.type,itemSize:f,max:i.max,min:i.min,extensions:i.extensions};if(i.min&&(l.min=i.min),i.max&&(l.max=i.max),s)if(this._enableInterleave)l.byteStride=h,l.byteOffset=o+(i.byteOffset||0),!h||h===f*u.BYTES_PER_ELEMENT||"indices"===e||"input"===e||"output"===e||e.indexOf("morph")>=0?(l.array=this._typedArray(s,i.count,f,o+(i.byteOffset||0),u),l.array.buffer.byteLength===l.byteLength&&(l.byteOffset=0)):l.array=new Uint8Array(s,o,a.byteLength);else if(i.interleaved){l.byteStride=0,l.byteOffset=0;const e=new u(i.count*f);if(l.array=B(e,s,i.count,f,h,o+(i.byteOffset||0),i.componentType),l.extensions&&l.extensions.WEB3D_quantized_attributes&&f>2){const e=new Float32Array(l.array.length),{decodeMatrix:t}=l.extensions.WEB3D_quantized_attributes;for(let s=0;s<l.array.length;s+=f){V[0]=l.array[s],V[1]=l.array[s+1],V[2]=l.array[s+2],V[3]=1;const r=c(V,V,t);e[s]=r[0],e[s+1]=r[1],e[s+2]=r[2];}l.componentType=5126,l.array=e;}}else l.byteStride=0,l.array=this._typedArray(s,i.count,f,o+(i.byteOffset||0),u),l.byteOffset=l.array.byteOffset;else {l.array=new u(i.count);const e=l.min||l.max;e&&(l.array[0]=e[0],l.array[1]=e[1],l.array[2]=e[2]);}return l}_compareAccessor(){const e=this.gltf.accessors;if(Array.isArray(e))for(let t=0;t<e.length;t++)for(let s=0;s<e.length;s++)t!==s&&e[t].bufferView===e[s].bufferView&&(e[t].interleaved=e[s].interleaved=!0);else for(const t in e)for(const s in e)t!==s&&e[t].bufferView===e[s].bufferView&&(e[t].interleaved=e[s].interleaved=!0);}_typedArray(e,t,s,r,n){return r%n.BYTES_PER_ELEMENT!=0&&(e=e.slice(r,r+t*s*n.BYTES_PER_ELEMENT),r=0),new n(e,r,s*t)}_getTypeItemSize(e){const t=S.indexOf(e);return S[t+1]}requestKHRTechniquesWebgl(e){const{shaders:t}=e,s=t.map((e=>{if(void 0!==e.bufferView){const t=this.gltf.bufferViews[e.bufferView],{byteLength:s}=t;return this._requestBufferOfBufferView(t).then((r=>{const{buffer:n,byteOffset:i}=r,a=v(n,i+(t.byteOffset||0),s);return e.content=a,e}))}if(e.uri){if(w(e.uri)){const t=T(e.uri),s=v(t,0,t.byteLength);return e.content=s,Promise.resolve(e)}{const t=this.rootPath+"/"+e.uri;return P.get(t,this._fetchOptions,this._urlModifier).then((t=>(e.content=t,e)))}}return Promise.resolve(e)}));return Promise.all(s).then((()=>e))}}class D extends M{constructor(e,t,s,r,n,i,a,o){super(r,n,i,a,o),this.rootPath=e,this.gltf=t,this.requests={},this.buffers={},this.glbBuffer=s,this.accessor=new L(e,t,s,a,o);}iterate(e,t){const s=this.gltf[t];if(!s)return;let r=0;for(const t in s)e(t,s[t],r++);}createNode(e){const t={};if(b(e.name)&&(t.name=e.name),b(e.children)&&(t.children=e.children),b(e.jointName)&&(t.jointName=e.jointName),b(e.matrix)&&(t.matrix=e.matrix),b(e.rotation)&&(t.rotation=e.rotation),b(e.scale)&&(t.scale=e.scale),b(e.translation)&&(t.translation=e.translation),b(e.extras)&&(t.extras=e.extras),b(e.meshes)&&(t.mesh=e.meshes[0]),t.translation||t.rotation||t.scale){const e=function(e,t){if(t.matrix)return t.matrix;if(t.translation||t.scale||t.rotation){const s=function(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e}(E,t.translation||R),n=function(e,t){var s=t[0],r=t[1],n=t[2],i=t[3],a=s+s,o=r+r,f=n+n,u=s*a,h=r*a,c=r*o,l=n*a,d=n*o,m=n*f,g=i*a,p=i*o,b=i*f;return e[0]=1-c-m,e[1]=h+b,e[2]=l-p,e[3]=0,e[4]=h-b,e[5]=1-u-m,e[6]=d+g,e[7]=0,e[8]=l+p,e[9]=d-g,e[10]=1-u-c,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}(O,t.rotation||A),i=function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}(I,t.scale||q);return r(i,n,i),r(e,s,i)}return function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}(e)}([],t);delete t.translation,delete t.rotation,delete t.scale,t.matrix=e;}return t}_loadMaterials(e){const t={};for(const s in e){const r=e[s];let n,i;r.instanceTechnique&&r.instanceTechnique.values?(n=r.instanceTechnique,i=n.values.diffuse):(n=r,i=n.values.tex||n.values.diffuseTex||n.values.diffuse);const a={baseColorTexture:{index:i}};r.name&&(a.name=r.name),r.extensions&&(a.extensions=r.extensions),r.extras&&(a.extras=r.extras),t[s]=a;}return t}_loadImage(e){if(e.bufferView||e.extensions&&(e.extensions.KHR_binary_glTF||e.extensions.binary_glTF)){const t=e.bufferView?e:e.extensions.KHR_binary_glTF||e.extensions.binary_glTF;e.extensions&&(e.mimeType=t.mimeType,e.width=t.width,e.height=t.height);const s=this.gltf.bufferViews[t.bufferView],r=(s.byteOffset||0)+this.glbBuffer.byteOffset,n=s.byteLength,i=this.buffers[t.bufferView]=new Uint8Array(this.glbBuffer.buffer,r,n);return this.getImageByBuffer(i,e)}return this.requestExternalImage(e)}_getTexture(e){const t=this.gltf.textures[e];if(!t)return null;const s=this.gltf.images[t.source];return this._loadImage(s).then((e=>{const r=this.gltf.samplers[t.sampler];return {image:{array:e.data,width:e.width,height:e.height,index:t.source,mimeType:s.mimeType,name:s.name,extras:s.extras},sampler:r}}))}getBaseColorTexture(e){const t=this.gltf.materials[e];let s,r;if(t.instanceTechnique&&t.instanceTechnique.values?(s=t.instanceTechnique,r=s.values.diffuse):(s=t,r=s.values.tex||s.values.diffuseTex||s.values.diffuse),void 0===r||void 0===this.gltf.textures)return null;const n=this.gltf.textures[r];if(!n)return null;const i=this.gltf.samplers[n.sampler];return {format:n.format||6408,internalFormat:n.internalFormat||6408,type:n.type||5121,sampler:i,source:this.gltf.images[n.source]}}getMaterial(){return null}getAnimations(){return null}}const U=9729;class C extends M{constructor(e,t,s,r,n,i,a,o){super(r,n,i,a,o),this.rootPath=e,this.gltf=t,this.glbBuffer=s,this.buffers={},this.requests={},this.accessor=new L(e,t,s,a,o);}iterate(e,t){const s=this.gltf[t];if(s)for(let t=0;t<s.length;t++)e(t,s[t],t);}createNode(e){const t={};return y(t,e),!b(e.weights)&&this.gltf.meshes&&b(t.mesh)?t.weights=this.gltf.meshes[t.mesh].weights:e.weights&&(t.weights=e.weights),t}_getTexture(e){const t=this.gltf.textures[e];if(!t)return null;let s=t.source;if(t.extensions&&t.extensions.EXT_texture_webp?s=t.extensions.EXT_texture_webp.source:t.extensions&&t.extensions.KHR_texture_basisu&&(s=t.extensions.KHR_texture_basisu.source),!b(s))return null;const r=this.gltf.images[s];return this._loadImage(r).then((e=>{if(!e)return null;const s={image:{array:e.data,mipmap:e.mipmap,width:e.width,height:e.height,index:t.source,mimeType:r.mimeType,name:r.name,extensions:r.extensions,extras:r.extras}};y(s,t);const n=b(t.sampler)?this.gltf.samplers[t.sampler]:void 0;if(n&&(s.sampler=n,s.sampler.magFilter=n.magFilter||U,s.sampler.minFilter=n.minFilter||9987,s.sampler.wrapS=n.wrapS||10497,s.sampler.wrapT=n.wrapT||10497),"image/ktx2"===s.image.mimeType&&!s.image.mipmap&&s.sampler&&s.sampler.minFilter!==U&&9728!==s.sampler.minFilter){const e=s.sampler.minFilter;s.sampler.minFilter=9984===e||9986===e?9728:U;}if(e.format&&(s.format=e.format),6407===s.format){const e=s.image.array&&s.image.array.length;e&&e===s.image.width*s.image.height*4&&(s.format=6408);}return s}))}_loadImage(e){if(!b(e.bufferView))return this.requestExternalImage(e);{const t=this.gltf.bufferViews[e.bufferView],s=this.gltf.buffers[t.buffer];if(s.uri)return this.requestImageFromBufferURI(s,t,e);if(this.glbBuffer)return this._requestFromGlbBuffer(t,e)}return null}_requestFromGlbBuffer(e,t){const s=this._createDataView(e,this.glbBuffer.buffer,this.glbBuffer.byteOffset);return this.getImageByBuffer(s,t)}_createDataView(e,t,s){s=s||0;const r=(e.byteOffset||0)+s,n=e.byteLength;return new Uint8Array(t,r,n)}_transformArrayBufferToBase64(e,t){const s=new Array(e.byteLength);for(let t=0;t<e.byteLength;t++)s[t]=String.fromCharCode(e[t]);s.join("");const r="data:"+(t=t||"image/png")+";base64,"+function(e){return "undefined"!=typeof self?self.btoa(e):window.btoa(e)}(unescape(encodeURIComponent(s)));return r}getAnimations(e){const t=[];return e.forEach((e=>{t.push(this.getSamplers(e.samplers));})),Promise.all(t).then((t=>{for(let s=0;s<t.length;s++)e[s].samplers=t[s];return e}))}getSamplers(e){const t=[];for(let s=0;s<e.length;s++)(b(e[s].input)||b(e[s].output))&&(t.push(this.accessor._requestData("input",e[s].input)),t.push(this.accessor._requestData("output",e[s].output)));return Promise.all(t).then((t=>{for(let s=0;s<t.length/2;s++)e[s].input=t[2*s],e[s].output=t[2*s+1],e[s].interpolation||(e[s].interpolation="LINEAR");return e}))}}const F="undefined"!=typeof TextDecoder?new TextDecoder("utf-8"):null;class k{static read(e,t=0,s=0){s||(s=e.byteLength);const r=new DataView(e,t,s),n=r.getUint32(4,!0);if(1===n)return k.readV1(r,t);if(2===n)return k.readV2(e,t);throw new Error("Unsupported glb version : "+n)}static readV1(e,t){const s=e.getUint32(8,!0),r=e.getUint32(12,!0);if(s!==e.byteLength)throw new Error("Length in GLB header is inconsistent with glb's byte length.");const n=X(e.buffer,20+t,r);return {json:JSON.parse(n),glbBuffer:{byteOffset:20+t+r,buffer:e.buffer,byteLength:s}}}static readV2(e,t){let s,r,n;const i=new DataView(e,t+12);let a=0;for(;a+8<i.byteLength;){const o=i.getUint32(a,!0);a+=4;const f=i.getUint32(a,!0);if(a+=4,1313821514===f)s=X(e,t+12+a,o);else if(5130562===f){n=t+12+a,r=o;break}a+=o;}return {json:JSON.parse(s),glbBuffer:{byteOffset:n,buffer:e,byteLength:r}}}}function X(e,t,s){if(F){const r=new Uint8Array(e,t,s);return F.decode(r)}return function(e){const t=e.length;let s="";for(let r=0;r<t;){let n=e[r++];if(128&n){let s=K[n>>3&7];if(!(64&n)||!s||r+s>t)return null;for(n&=63>>s;s>0;s-=1){const t=e[r++];if(128!=(192&t))return null;n=n<<6|63&t;}}s+=String.fromCharCode(n);}return s}(new Uint8Array(e,t,s))}const K=[1,1,1,1,2,2,3,0],H=[0,0,0],j=[0,0,0,1],z=[1,1,1],W={TRANSLATION:[0,0,0],ROTATION:[0,0,0,1],SCALE:[1,1,1]},G={PREVIOUS:null,NEXT:null,PREINDEX:null,NEXTINDEX:null,INTERPOLATION:null},Y={_getTRSW(e,t,s,r,n,i,o,f){const u=b(e)?t.animations:[t.animations[0]],h={};for(let t=0;t<u.length;t++){const c=u[t],l=c.name||t;if(b(e)&&l!==e)continue;const d=c.channelsMap[s];if(d)for(let e=0;e<d.length;e++){const t=d[e];"translation"===t.target.path?(this._getAnimateData(n,c.samplers[t.sampler],r,1),h.translation=a(H,n)):"rotation"===t.target.path?(this._getQuaternion(i,c.samplers[t.sampler],r,1),h.rotation=m(j,i)):"scale"===t.target.path?(this._getAnimateData(o,c.samplers[t.sampler],r,1),h.scale=a(z,o)):"weights"===t.target.path&&f&&(this._getAnimateData(f,c.samplers[t.sampler],r,f.length),h.weights=f);}}return h},_getAnimateData(e,t,s,r){switch(t.interpolation){case"LINEAR":{const n=this._getPreNext(G,t,s,1*r);n&&(e=function(e,t,s,r){for(let n=0;n<e.length;n++)e[n]=t[n]+r*(s[n]-t[n]);return e}(e,n.PREVIOUS,n.NEXT,n.INTERPOLATION));break}case"STEP":{const n=this._getPreNext(G,t,s,1*r);n&&(e=function(e,t){for(let s=0;s<e.length;s++)e[s]=t[s];return e}(e,...n.PREVIOUS));break}case"CUBICSPLINE":{const n=this._getPreNext(G,t,s,3*r);n&&(e=this._getCubicSpline(e,n,t.input.array,3*r));break}}return e},_getQuaternion(e,t,s){switch(t.interpolation){case"LINEAR":{const r=this._getPreNext(G,t,s,1);r&&function(e,t,s,r){var n,i,a,o,f,u=t[0],h=t[1],c=t[2],l=t[3],d=s[0],m=s[1],g=s[2],p=s[3];(i=u*d+h*m+c*g+l*p)<0&&(i=-i,d=-d,m=-m,g=-g,p=-p),1-i>1e-6?(n=Math.acos(i),a=Math.sin(n),o=Math.sin((1-r)*n)/a,f=Math.sin(r*n)/a):(o=1-r,f=r),e[0]=o*u+f*d,e[1]=o*h+f*m,e[2]=o*c+f*g,e[3]=o*l+f*p;}(e,r.PREVIOUS,r.NEXT,r.INTERPOLATION);break}case"STEP":{const r=this._getPreNext(G,t,s,1);r&&(e=h(e,...r.PREVIOUS));break}case"CUBICSPLINE":{const r=this._getPreNext(G,t,s,3);if(r){for(let e=0;e<r.PREVIOUS.length;e++)r.PREVIOUS[e]=Math.acos(r.PREVIOUS[e]),r.NEXT[e]=Math.acos(r.NEXT[e]);e=this._getCubicSpline(e,r,t.input.array,3);for(let t=0;t<e.length;t++)e[t]=Math.cos(e[t]);}break}}return e},_search(e,t){const s=e.length;let r,n,i,a=0,o=s-1,f=Math.floor((a+o)/2);for(;a<=s-1&&o>=0;){if(a===o)return null;if(e[f]<=t&&t<=e[f+1]){const s=e[f];return r=f,n=f+1,i=(t-s)/(e[f+1]-s),{preIndx:r,nextIndex:n,interpolation:i}}t<e[f]?(o=f,f=Math.floor((a+o)/2)):e[f+1]<t&&(a=f,f=Math.floor((a+o)/2));}return null},_getPreNext(e,t,s,r){const n=t.input.array,i=t.output.array,a=t.output.itemSize;(s<n[0]||s>n[n.length-1])&&(s=Math.max(n[0],Math.min(n[n.length-1],s))),s===n[n.length-1]&&(s=n[0]);const o=this._search(n,s);if(!o||!o.nextIndex)return null;const{preIndx:f,nextIndex:u,interpolation:h}=o;e.PREINDEX=f,e.NEXTINDEX=u,e.INTERPOLATION=h;const c=a*r;return e.PREVIOUS=i.subarray(e.PREINDEX*c,(e.PREINDEX+1)*c),e.NEXT=i.subarray(e.NEXTINDEX*c,(e.NEXTINDEX+1)*c),e},_getCubicSpline(e,t,s,r){const n=t.INTERPOLATION,i=s[t.PREINDEX],a=s[t.NEXTINDEX];for(let s=0;s<3;s++){const o=t.PREVIOUS[r+s],f=(a-i)*t.PREVIOUS[2*r+s],u=t.NEXT[3+s],h=(a-i)*t.NEXT[s],c=(2*Math.pow(n,3)-3*Math.pow(n,2)+1)*o+(Math.pow(n,3)-2*Math.pow(n,2)+n)*f+(2*-Math.pow(n,3)+3*Math.pow(n,2))*u+(Math.pow(n,3)-Math.pow(n,2))*h;e[s]=c;}return e},getAnimationClip(e,t,s,r){const n=e.nodes[t]&&e.nodes[t].weights;return o(H,...W.TRANSLATION),h(j,...W.ROTATION),o(z,...W.SCALE),this._getTRSW(r,e,t,s,H,j,z,n)},getTimeSpan(e){if(!e.animations)return null;if(e.timeSpan)return e.timeSpan;const t=e.animations;return e.timeSpan={},t.forEach(((t,s)=>{let r=-1/0,n=1/0;const i=t.channels;for(let e=0;e<i.length;e++){const s=i[e],a=t.samplers[s.sampler].input.array;a[a.length-1]>r&&(r=a[a.length-1]),a[0]<n&&(n=a[0]);}const a=t.name||s;e.timeSpan[a]={max:r,min:n};})),e.timeSpan},getTimeSpanByName(e,t){const s=this.getTimeSpan(e);return s?b(t)?s[t]:s[Object.keys(s)[0]]:null}};let $=!1;if("undefined"!=typeof OffscreenCanvas){let e;try{e=new OffscreenCanvas(2,2).getContext("2d");}catch(s){}e&&"undefined"!=typeof createImageBitmap&&($=!0);}const J="undefined"==typeof document?null:document.createElement("canvas");function Q(e,t,s){const r=new Image;r.crossOrigin="",r.onload=()=>{if(!J)return void s(new Error("There is no canvas to draw image!"));J.width=r.width,J.height=r.height;const e=J.getContext("2d",{willReadFrequently:!0});e.drawImage(r,0,0,r.width,r.height);const t=e.getImageData(0,0,r.width,r.height),n={width:r.width,height:r.height,data:new Uint8Array(t.data)};s(null,n);},r.onerror=function(e){s(e);},r.src=e;}const Z=[],ee=[],te=30;let se,re;function ne(e,t,s){se||(se=new OffscreenCanvas(2,2),re=se.getContext("2d",{willReadFrequently:!0}));let r=null;if(_(e))this.options.urlModifier&&(e=this.options.urlModifier(e)),Z.push([e,t,s,this]),ie();else {const t=new Blob([e]);r=createImageBitmap(t),r.then(ae.bind(this)).then((e=>{s(null,e);})).catch((e=>{console.warn(e),s(e);}));}}function ie(){if(!Z.length||ee.length>te)return;const e=Z.shift(),[t,s,r,n]=e;ee.push(e),fetch(t,s).then((e=>e.arrayBuffer())).then((e=>{const t=new Blob([new Uint8Array(e)]);return createImageBitmap(t)})).then(ae.bind(n)).then((t=>{r.call(n,null,t);const s=ee.indexOf(e);ee.splice(s,1),ie();})).catch((t=>{console.warn(t),r.call(n,t);const s=ee.indexOf(e);ee.splice(s,1),ie();}));}function ae(e){let{width:t,height:s}=e;oe(t)||(t=fe(t)),oe(s)||(s=fe(s));const r=this.options.maxTextureSize;r&&(t=Math.min(r,t),s=Math.min(r,s)),se.width=t,se.height=s,re.drawImage(e,0,0,t,s),e.close();const n=re.getImageData(0,0,t,s);return {width:t,height:s,data:new Uint8Array(n.data)}}function oe(e){return !(e&e-1)&&0!==e}function fe(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}function ue(e,t){for(const s in e)if(e[s]===t)return s;return t}e.Ajax=P,e.GLTFLoader=class{constructor(e,t,s){if(this.options=s||{},this.options.decoders||(this.options.decoders={}),this._fetchOptions=this.options.fetchOptions||{},t.buffer instanceof ArrayBuffer){const{json:s,glbBuffer:r}=k.read(t.buffer,t.byteOffset,t.byteLength);this._init(e,s,r);}else this._init(e,t);this._accessor=new L(this.rootPath,this.gltf,this.glbBuffer,this._fetchOptions,this.options.urlModifier),this._checkExtensions();}_checkExtensions(){const e=this.gltf.extensionsRequired;if(e){if(e.indexOf("KHR_draco_mesh_compression")>=0&&!this.options.decoders.draco)throw new Error("KHR_draco_mesh_compression is required but @maptalks/transcoders.draco is not loaded");if(e.indexOf("KHR_texture_basisu")>=0&&!this.options.decoders["image/ktx2"])throw new Error("KHR_texture_basisu is required but @maptalks/transcoders.ktx2 is not loaded");if(e.indexOf("EXT_meshopt_compression")>=0)throw new Error("EXT_meshopt_compression extension is not supported yet.")}}_loadExtensions(){const e=this.gltf.extensions;return e&&e.KHR_techniques_webgl?this._accessor.requestKHRTechniquesWebgl(e.KHR_techniques_webgl).then((t=>(e.KHR_techniques_webgl=t,e))):Promise.resolve(e)}_convertKhrTechiqueToTechiques(){if(!Array.isArray(this.gltf.programs))return;const e=this.gltf.materials;for(let t=0;t<e.length;t++)e[t]&&e[t].extensions&&e[t].extensions.KHR_technique_webgl&&(e[t].extensions.KHR_techniques_webgl=e[t].extensions.KHR_technique_webgl,delete e[t].extensions.KHR_technique_webgl);const t=this.gltf.extensions||{},s=this.gltf.techniques;t.KHR_techniques_webgl={programs:this.gltf.programs,shaders:this.gltf.shaders,techniques:s};for(let t=0;t<e.length;t++){const n=(r=e[t])&&r.extensions&&r.extensions.KHR_techniques_webgl;if(n){const{values:e,technique:t}=n,r=s[t];if(!r||!e)continue;const{uniforms:i,parameters:a}=r,o={};for(const t in e){const s=ue(i,t);o[s]=e[t],a[t]&&35678===a[t].type&&(o[s]={index:e[t]});}n.values=o;}}var r;for(let e=0;e<s.length;e++){const t=s[e];if(!t)continue;const{attributes:r,uniforms:n,parameters:i}=t;if(r)for(const e in r){const t=r[e];r[e]=i[t];}if(n)for(const e in n){const t=n[e];n[e]=i[t];}delete t.parameters;}return delete this.gltf.programs,delete this.gltf.shaders,delete this.gltf.techniques,this.gltf.extensions=t,t}load(e){e=e||{},this._convertKhrTechiqueToTechiques();const t=this._loadScene(e),s=this._loadAnimations(),r=this._loadTextures(),n=this._loadExtensions();return Promise.all([t,s,r,n]).then((e=>(e[0].animations=e[1],e[0].textures=e[2],e[0].extensions=e[3],e[0].transferables=this.transferables||[],this.createChannelsMap(e[0]),e[0])))}createChannelsMap(e){const t=e.animations;if(t)for(let e=0;e<t.length;e++){const s=t[e];s.channelsMap={};for(let e=0;e<s.channels.length;e++){const t=s.channels[e];s.channelsMap[t.target.node]||(s.channelsMap[t.target.node]=[]),s.channelsMap[t.target.node].push(t);}}}getExternalResources(){const e=[];if(this.gltf){const{buffers:t,images:s}=this.gltf;for(let s=0;s<t.length;s++)t[s].uri&&t[s].uri.indexOf("data:application/octet-stream;base64")<0&&e.push({type:"buffer",uri:t[s].uri});for(let t=0;t<s.length;t++)s[t].uri&&s[t].uri.indexOf("data:image/")<0&&e.push({type:"image",uri:s[t].uri});}return e}static getAnimationClip(e,t,s,r){return Y.getAnimationClip(e,t,s,r)}static getAnimationTimeSpan(e,t){return Y.getTimeSpanByName(e,t)}static getTypedArrayCtor(e){return x(e)}static readInterleavedArray(e,t,s,r,n,i,a){return B(e,t,s,r,n,i,a)}_init(e,t,s){this.gltf=t,this.glbBuffer=s,this.version=t.asset?+t.asset.version:1,this.rootPath=e,this.buffers={},this.requests={},this.options.requestImage=$?ne.bind(this):this.options.requestImage||Q,this.options.transferable&&(this.transferables=[]),2===this.version?(this.adapter=new C(e,t,s,this.options.requestImage,this.options.decoders||{},this.options.supportedFormats||{},this._fetchOptions,this.options.urlModifier),this.adapter.iterate(((e,t,s)=>{t.id="buffer_"+s;}),"buffers"),this.adapter.iterate(((e,t,s)=>{t.id="image_"+s;}),"images"),this.adapter.iterate(((e,t,s)=>{t.id="accessor_"+s;}),"accessors")):(this.adapter=new D(e,t,s,this.options.requestImage,this.options.decoders||{},this.options.supportedFormats||{},this._fetchOptions,this.options.urlModifier),this.adapter.iterate(((e,t,s)=>{t.id="accessor_"+s;}),"accessors"),this.adapter.iterate(((e,t,s)=>{t.id="image_"+s;}),"images"));}_parseNodes(e,t){if(e.children&&e.children.length>0){if(!("number"==typeof(s=e.children[0])&&isFinite(s)||_(e.children[0])))return e;const r=e.children.map((e=>{const s=t[e];return s.nodeIndex=e,this._parseNodes(s,t)}));e.children=r;}var s;return e}_loadScene(e){return this._loadNodes(e).then((e=>{const t=this.scenes=[];let s;for(const t in e)e[t]=this._parseNodes(e[t],e),e[t].nodeIndex=Number(t)?Number(t):t;this.adapter.iterate(((r,n,i)=>{const a={};n.name&&(a.name=n.name),n.nodes&&(a.nodes=n.nodes.map((t=>e[t]))),this.gltf.scene===r&&(s=i),t.push(a);}),"scenes");const r={textures:this.gltf.textures,asset:this.gltf.asset,scene:s,scenes:t,nodes:e,meshes:this.meshes,materials:this.gltf.materials,skins:this.skins,extensionsRequired:this.gltf.extensionsRequired,extensionsUsed:this.gltf.extensionsUsed};if(this.gltf.extensions&&(r.extensions=this.gltf.extensions),1===this.version){const e=this.adapter._loadMaterials(this.gltf.materials);r.materials=e;}return delete this.gltf.buffers,r.json=this.gltf,r}))}_loadNodes(e){return this._loadMeshes(e).then((()=>{const e=this.nodes={};return this.adapter.iterate(((t,s)=>{const r=this.adapter.createNode(s,this.meshes,this.skins);e[t]=r;}),"nodes"),e}))}_loadSkins(){this.skins=[];const e=[];return this.adapter.iterate(((t,s,r)=>{e.push(this._loadSkin(s).then((e=>{e.index=r,this.skins.push(e);})));}),"skins"),e}_loadSkin(e){const t=e.inverseBindMatrices;return this.adapter.accessor._requestData("inverseBindMatrices",t).then((t=>(e.inverseBindMatrices=t,t&&t.buffer&&this.transferables&&this.transferables.indexOf(t.buffer)<0&&this.transferables.push(t.buffer),e)))}_loadAnimations(){const e=this.gltf.animations;return b(e)?this.adapter.getAnimations(e):null}_loadMeshes(e){this.meshes={};let t=[];return this.adapter.iterate(((s,r,n)=>{t.push(this._loadMesh(r,e).then((e=>{e.index=n,this.meshes[s]=e;})));}),"meshes"),t=t.concat(this._loadSkins()),Promise.all(t)}_loadMesh(e,t){const s=e.primitives.map((e=>this._loadPrimitive(e,t))).filter((e=>!!e));return Promise.all(s).then((t=>{const s={};return y(s,e),s.primitives=t,s}))}_loadTextures(){const e=this.gltf.textures;if(!e)return null;const t=[];for(const s in e)t.push(this.adapter._getTexture(s));return Promise.all(t).then((t=>{if(this.transferables)for(let e=0;e<t.length;e++){const s=t[e]&&t[e].image.array;if(s){let e;e=s instanceof ImageBitmap?s:s.buffer,e&&this.transferables.indexOf(e)<0&&this.transferables.push(e);}}if(!Array.isArray(e)){const s={},r=Object.keys(e);for(let e=0;e<t.length;e++)t[e]&&(s[r[e]]=t[e]);return s}return t}))}_loadPrimitive(e,t){let s;const r=[],n=e.extensions;if(b(e.targets))for(let t=0;t<e.targets.length;t++){const s=e.targets[t];for(const e in s){const n=this.adapter.accessor._requestData(`morphTargets_${e}_${t}`,s[e]);n&&r.push(n);}}if(n&&n.KHR_draco_mesh_compression){if(!this.options.decoders.draco&&(!this.gltf.extensionsRequired||!this.gltf.extensionsRequired.indexOf("KHR_draco_mesh_compression")<0))return null;const e=this.options.decoders.draco,{bufferView:i,attributes:a}=n.KHR_draco_mesh_compression,o=this.gltf.bufferViews[i],f=this._accessor._requestBufferOfBufferView(o).then((s=>{const{buffer:r,byteOffset:n}=s;let{byteOffset:i}=o;const f=o.byteLength;i||(i=0);const u=new DataView(r,n+i,f),h={attributes:a,useUniqueIDs:!1,skipAttributeTransform:t.skipAttributeTransform};return e(u,h).then((e=>{const t=Object.values(e.attributes);return e.indices&&t.push(e.indices),t}))}));r.push(f),s=Promise.all(r);}else {const t=e.attributes;for(const e in t){const s=this.adapter.accessor._requestData(e,t[e]);s&&r.push(s);}if(b(e.indices)){const t=this.adapter.accessor._requestData("indices",e.indices);t&&r.push(t);}s=Promise.all(r);}return s.then((t=>{if(n&&n.KHR_draco_mesh_compression){const s=e.targets?e.targets.length:0;t[s]=t[s].concat(t.slice(0,s)),t=t[s];}let s,r;const i={attributes:t.reduce(((e,t)=>{if("indices"===t.name)s=t;else if(t.name.indexOf("morphTargets_")>-1)r=r||{},r[t.name.slice(13)]=t;else {if(!("POSITION"!==t.name||t.min&&t.max)){const e=[1/0,1/0,1/0],s=[-1/0,-1/0,-1/0],{itemSize:r,array:n}=t,i=n.length/r;for(let t=0;t<i;t++)for(let i=0;i<r;i++){const a=t*r+i;n[a]<e[i]&&(e[i]=n[a]),n[a]>s[i]&&(s[i]=n[a]);}if(t.quantization){const r=t.quantization,n=r.range/(1<<r.quantizationBits),i=r.minValues;u(e,e,n),f(e,e,i),u(s,s,n),f(s,s,i);}t.min=e,t.max=s;}e[t.name]=t;}return this.transferables&&t.array.buffer&&this.transferables.indexOf(t.array.buffer)<0&&this.transferables.push(t.array.buffer),e}),{}),material:e.material};return s&&(i.indices=s),r&&(i.morphTargets=r),i.mode=b(e.mode)?e.mode:4,b(e.extras)&&(i.extras=e.extras),i}))}},t().maptalks_gltf_loader=e;}gltfLoaderExport({});
|
|
89
89
|
|
|
90
90
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
@@ -8922,9 +8922,9 @@
|
|
|
8922
8922
|
var t = /*@__PURE__*/getDefaultExportFromCjs(fastDeepEqual);
|
|
8923
8923
|
|
|
8924
8924
|
/*!
|
|
8925
|
-
* @maptalks/fusiongl v0.
|
|
8925
|
+
* @maptalks/fusiongl v0.119.0
|
|
8926
8926
|
* LICENSE : UNLICENSED
|
|
8927
|
-
* (c) 2016-
|
|
8927
|
+
* (c) 2016-2026 maptalks.com
|
|
8928
8928
|
*/
|
|
8929
8929
|
function i(t){for(let i=1;i<arguments.length;i++){const e=arguments[i];for(const i in e)t[i]=e[i];}return t}function e$1(t,...e){for(let r=0;r<e.length;r++)i(t,e[r]);}class DrawBuffersExt{constructor(t){this.context=t,this.COLOR_ATTACHMENT0_WEBGL=36064,this.COLOR_ATTACHMENT1_WEBGL=36065,this.COLOR_ATTACHMENT2_WEBGL=36066,this.COLOR_ATTACHMENT3_WEBGL=36067,this.COLOR_ATTACHMENT4_WEBGL=36068,this.COLOR_ATTACHMENT5_WEBGL=36069,this.COLOR_ATTACHMENT6_WEBGL=36070,this.COLOR_ATTACHMENT7_WEBGL=36071,this.COLOR_ATTACHMENT8_WEBGL=36072,this.COLOR_ATTACHMENT9_WEBGL=36073,this.COLOR_ATTACHMENT10_WEBGL=577040,this.COLOR_ATTACHMENT11_WEBGL=577041,this.COLOR_ATTACHMENT12_WEBGL=577042,this.COLOR_ATTACHMENT13_WEBGL=577043,this.COLOR_ATTACHMENT14_WEBGL=577044,this.COLOR_ATTACHMENT15_WEBGL=577045,this.DRAW_BUFFER0_WEBGL=34853,this.DRAW_BUFFER1_WEBGL=34854,this.DRAW_BUFFER2_WEBGL=34855,this.DRAW_BUFFER3_WEBGL=34856,this.DRAW_BUFFER4_WEBGL=34857,this.DRAW_BUFFER5_WEBGL=34858,this.DRAW_BUFFER6_WEBGL=34859,this.DRAW_BUFFER7_WEBGL=34860,this.DRAW_BUFFER8_WEBGL=34861,this.DRAW_BUFFER9_WEBGL=34862,this.DRAW_BUFFER10_WEBGL=34863,this.DRAW_BUFFER11_WEBGL=34864,this.DRAW_BUFFER12_WEBGL=34865,this.DRAW_BUFFER13_WEBGL=34866,this.DRAW_BUFFER14_WEBGL=34867,this.DRAW_BUFFER15_WEBGL=34868,this.MAX_COLOR_ATTACHMENTS_WEBGL=36063,this.MAX_DRAW_BUFFERS_WEBGL=2178;}drawBuffersWEBGL(){return this.context.drawBuffers.apply(this.context,arguments)}}class VertexArrayObjectExt{constructor(t){this.context=t,this.VERTEX_ARRAY_BINDING_OES=34229;}createVertexArrayOES(){return this.context.createVertexArray()}deleteVertexArrayOES(){return this.context.deleteVertexArray.apply(this.context,arguments)}isVertexArrayOES(){return this.context.isVertexArray.apply(this.context,arguments)}bindVertexArrayOES(){return this.context.bindVertexArray.apply(this.context,arguments)}}class AngleInstancedArrayExt{constructor(t){this.context=t,this.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE=35070;}drawArraysInstancedANGLE(){return this.context.drawArraysInstanced.apply(this.context,arguments)}drawElementsInstancedANGLE(){return this.context.drawElementsInstanced.apply(this.context,arguments)}vertexAttribDivisorANGLE(){return this.context.vertexAttribDivisor.apply(this.context,arguments)}}const r=36193,s={webgl_depth_texture:{UNSIGNED_INT_24_8_WEBGL:34042},oes_element_index_uint:{},oes_texture_float:{},oes_texture_half_float:{HALF_FLOAT_OES:36193},ext_color_buffer_float:{},oes_standard_derivatives:{},ext_frag_depth:{},ext_blend_minmax:{MIN_EXT:32775,MAX_EXT:32776},ext_shader_texture_lod:{}},h={has(t,i){const e=t.t,r=t.i;return !(!e&&!r.getExtension(i))&&(i=i.toLowerCase(),e&&s[i]||"webgl_draw_buffers"===i||"oes_vertex_array_object"===i||"angle_instanced_arrays"===i)},mock:(t,i)=>(i=i.toLowerCase(),s[i]?t.t?("oes_texture_float"!==i&&"oes_texture_half_float"!==i||t.i.getExtension("EXT_color_buffer_float"),s[i]):t.i.getExtension(i):"webgl_draw_buffers"===i?new DrawBuffersExt(t):"oes_vertex_array_object"===i?new VertexArrayObjectExt(t):"angle_instanced_arrays"===i?new AngleInstancedArrayExt(t):null),getInternalFormat:(t,i,e)=>6402===i?33190:34041===i?35056:e===r&&i===t.RGBA?34842:e===r&&i===t.RGB?34843:e===t.FLOAT&&i===t.RGBA?34836:e===t.FLOAT&&i===t.RGB?34837:i,getTextureType:(t,i)=>i===r?t.HALF_FLOAT:i};let n=1;let WebGL2RenderingContext$1 = class WebGL2RenderingContext{constructor(t){this.uid=n++,this.states=function(t){return {scissor:[0,0,t.canvas.width,t.canvas.height],viewport:[0,0,t.canvas.width,t.canvas.height],blendColor:[0,0,0,0],blendEquationSeparate:[t.FUNC_ADD,t.FUNC_ADD],blendFuncSeparate:[t.ONE,t.ZERO,t.ONE,t.ZERO],clearColor:[0,0,0,0],clearDepth:[1],clearStencil:[0],colorMask:[!0,!0,!0,!0],cullFace:[t.BACK],depthFunc:[t.LESS],depthMask:[!0],depthRange:[0,1],capabilities:{3042:!1,2884:!1,2929:!1,3024:!1,32823:!1,32926:!1,32928:!1,3089:!1,2960:!1},frontFace:[t.CCW],hint:{33170:[t.DONT_CARE],35723:[t.DONT_CARE]},lineWidth:[1],pixelStorei:{3333:[4],3317:[4],37440:[!1],37441:[!1],37443:[t.BROWSER_DEFAULT_WEBGL]},polygonOffset:[0,0],sampleCoverage:[1,!1],stencilFuncSeparate:{1028:[t.ALWAYS,0,4294967295],1029:[t.ALWAYS,0,4294967295]},stencilMaskSeparate:{1028:[4294967295],1029:[4294967295]},stencilOpSeparate:{1028:[t.KEEP,t.KEEP,t.KEEP],1029:[t.KEEP,t.KEEP,t.KEEP]},program:null,framebuffer:{36160:null,36008:null,36009:null},renderbuffer:{36161:null},textures:{active:-1,units:function(){const i=[],e=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);for(let t=0;t<e;t++)i.push({3553:null,34067:null});return i[-1]={3553:null,34067:null},i}()},attributes:{},arrayBuffer:null,elementArrayBuffer:null}}(t),this.i=t,this.i._fusiongl_drawCalls=0,this.t=void 0!==window.WebGL2RenderingContext&&this.i instanceof window.WebGL2RenderingContext;const i=Object.getPrototypeOf(this);this.t?Object.setPrototypeOf(i,window.WebGL2RenderingContext.prototype):Object.setPrototypeOf(i,WebGLRenderingContext.prototype),this.h=t.getParameter(t.MAX_VERTEX_ATTRIBS);}get canvas(){return this.i.canvas}get drawingBufferWidth(){return this.i.drawingBufferWidth}get drawingBufferHeight(){return this.i.drawingBufferHeight}get drawingBufferColorSpace(){return this.i.drawingBufferColorSpace}set drawingBufferColorSpace(t){this.i.drawingBufferColorSpace=t;}get gl(){return this.i}get buffersOES(){return this.u||(this.u=this.i.getExtension("WEBGL_draw_buffers")),this.u}get vaoOES(){return this.o||(this.o=this.i.getExtension("OES_vertex_array_object")),this.o}get angleOES(){return this.l||(this.l=this.i.getExtension("ANGLE_instanced_arrays")),this.l}get standOES(){return this.m||(this.m=this.i.getExtension("OES_standard_derivatives")),this.m}attachShader(t,i){return this.i.attachShader(t,i)}shaderSource(t,i){return this.i.shaderSource(t,i)}compileShader(t){return this.i.compileShader(t)}createShader(t){return this.i.createShader(t)}createProgram(){return this.i.createProgram()}deleteProgram(t){return this.states.program===t&&(this.states.program=null),this.i.deleteProgram(t)}deleteShader(t){return this.i.deleteShader(t)}detachShader(t,i){return this.i.detachShader(t,i)}getAttachedShaders(t){return this.i.getAttachedShaders(t)}linkProgram(t){return this.i.linkProgram(t)}makeXRCompatible(){return this.i.makeXRCompatible()}getShaderParameter(t,i){return this.i.getShaderParameter(t,i)}getShaderPrecisionFormat(t,i){return this.i.getShaderPrecisionFormat(t,i)}getShaderInfoLog(t){return this.i.getShaderInfoLog(t)}getShaderSource(t){return this.i.getShaderSource(t)}getProgramInfoLog(t){return this.i.getProgramInfoLog(t)}getProgramParameter(t,i){return this.i.getProgramParameter(t,i)}getError(){return this.i.getError()}getContextAttributes(){return this.i.getContextAttributes()}getExtension(t){return h.has(this,t)?h.mock(this,t):this.i.getExtension(t)}getSupportedExtensions(){return this.i.getSupportedExtensions()}getParameter(t){return this.i.getParameter(t)}isEnabled(t){return this.i.isEnabled(t)}isProgram(t){return this.i.isProgram(t)}isShader(t){return this.i.isShader(t)}validateProgram(t){return this.i.validateProgram(t)}clear(t){return this.v(),this.i.clear(t)}drawArrays(t,i,e){return this.v(),this._(),this.i.drawArrays(t,i,e)}drawElements(t,i,e,r){return this.v(),this._(),this.i.drawElements(t,i,e,r)}drawBuffers(t){return this.v(),this._(),this.t?this.i.drawBuffers(t):this.buffersOES.drawBuffersWEBGL(t)}_(){this.i._fusiongl_drawCalls++;}resetDrawCalls(){this.i._fusiongl_drawCalls=0;}getDrawCalls(){return this.i._fusiongl_drawCalls}S(){const t=this.i,i=t.getParameter(t.CURRENT_PROGRAM),e=t.getProgramParameter(i,t.ACTIVE_ATTRIBUTES),r=[];for(let i=0;i<e;i++)r.push(t.getVertexAttrib(i,t.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING));this.A={buffers:r,elements:t.getParameter(t.ELEMENT_ARRAY_BUFFER_BINDING),framebuffer:t.getParameter(t.FRAMEBUFFER_BINDING)},window.DEBUGGING&&(console.log(this.uid,this.A),console.log(this.uid,this.states.attributes),console.log(this.states.attributes[0].buffer===this.A.buffers[0]),console.log(this.states.attributes[1].buffer===this.A.buffers[1]),console.log(this.states.attributes[2].buffer===this.A.buffers[2]));}finish(){return this.i.finish()}flush(){return this.v(),this.i.flush()}commit(){return this.v(),this.i.commit()}isContextLost(){return this.i.isContextLost()}getFragDataLocation(t,i){return this.i.getFragDataLocation(t,i)}createSampler(){return this.i.createSampler()}deleteSampler(){return this.i.deleteSampler()}bindSampler(){return this.i.bindSampler()}isSampler(){return this.i.isSampler()}getSamplerParameter(){return this.i.getSamplerParameter()}isQuery(t){return this.i.beginQuery(t)}beginQuery(t,i){return this.i.beginQuery(t,i)}deleteQuery(t){return this.i.query(t)}isTransformFeedback(t){return this.i.isTransformFeedback(t)}beginTransformFeedback(t){return this.i.beginTransformFeedback(t)}deleteTransformFeedback(t){return this.i.deleteTransformFeedback(t)}pauseTransformFeedback(){return this.i.pauseTransformFeedback()}resumeTransformFeedback(){return this.i.resumeTransformFeedback()}transformFeedbackVaryings(t,i,e){return this.i.transformFeedbackVaryings(t,i,e)}bindBufferBase(t,i,e){return this.i.bbindBufferBase(t,i,e)}bindBufferRange(t,i,e,r,s){return this.i.bindBufferRange(t,i,e,r,s)}bindTransformFeedback(t,i){return this.i.bindTransformFeedback(t,i)}fenceSync(t,i){return this.i.fenceSync(t,i)}isSync(t){return this.i.isSync(t)}deleteSync(t){return this.i.deleteSync(t)}clientWaitSync(t,i,e){return this.i.clientWaitSync(t,i,e)}waitSync(t,i,e){return this.i.waitSync(t,i,e)}getSyncParameter(t,i){return this.i.getSyncParameter(t,i)}getIndexedParameter(t,i){return this.i.getIndexedParameter(t,i)}};e$1(WebGL2RenderingContext$1.prototype,{bufferData(...t){return this.v(),this.i.bufferData(...t)},bufferSubData(...t){return this.v(),this.i.bufferSubData(...t)},createBuffer(){return this.i.createBuffer()},deleteBuffer(t){const i=this.states;i.arrayBuffer===t?i.arrayBuffer=null:i.elementArrayBuffer===t&&(i.elementArrayBuffer=null);const e=i.attributes;for(const i in e)e[i].buffer===t&&(e[i].buffer=null);return this.i.deleteBuffer(t)},getBufferParameter(t,i){return this.v(),this.i.getBufferParameter(t,i)},isBuffer(t){return this.i.isBuffer(t)},copyBufferSubData(t,i,e,r,s){return this.i.isBuffer(t,i,e,r,s)},readBuffer(t){return this.i.readBuffer(t)}}),e$1(WebGL2RenderingContext$1.prototype,{checkFramebufferStatus(t){return this.i.checkFramebufferStatus(t)},createFramebuffer(){return this.i.createFramebuffer()},deleteFramebuffer(t){const i=this.states.framebuffer;for(const e in i)i[e]===t&&(i[e]=null);return this.i.deleteFramebuffer(t)},framebufferRenderbuffer(t,i,e,r){return this.v(),this.i.framebufferRenderbuffer(t,i,e,r)},framebufferTexture2D(t,i,e,r,s){return this.v(),this.i.framebufferTexture2D(t,i,e,r,s)},getFramebufferAttachmentParameter(t,i,e){return this.v(),this.i.getFramebufferAttachmentParameter(t,i,e)},isFramebuffer(t){return this.i.isFramebuffer(t)},readPixels(t,i,e,r,s,h,n){return this.v(),this.i.readPixels(t,i,e,r,s,h,n)},blitFramebuffer(t,i,e,r,s,h,n,u,o,a){return this.v(),this.i.blitFramebuffer(t,i,e,r,s,h,n,u,o,a)}}),e$1(WebGL2RenderingContext$1.prototype,{createRenderbuffer(){return this.i.createRenderbuffer()},deleteRenderbuffer(t){const i=this.states.renderbuffer;for(const e in i)i[e]===t&&(i[e]=null);return this.i.deleteRenderbuffer(t)},getRenderbufferParameter(t,i){return this.v(),this.i.getRenderbufferParameter(t,i)},isRenderbuffer(t){return this.i.isRenderbuffer(t)},renderbufferStorage(t,i,e,r){return this.v(),this.i.renderbufferStorage(t,i,e,r)},renderbufferStorageMultisample(t,i,e,r,s){return this.v(),this.i.renderbufferStorageMultisample(t,i,e,r,s)}});const u="_fusion_context";e$1(WebGL2RenderingContext$1.prototype,{scissor(t,i,e,r){this.v();const s=this.states.scissor;s[0]===t&&s[1]===i&&s[2]===e&&s[3]===r||(s[0]=t,s[1]=i,s[2]=e,s[3]=r,this.i.scissor(t,i,e,r));},viewport(t,i,e,r){this.v();const s=this.states.viewport;s[0]===t&&s[1]===i&&s[2]===e&&s[3]===r||(s[0]=t,s[1]=i,s[2]=e,s[3]=r,this.i.viewport(t,i,e,r));},blendColor(t,i,e,r){this.v();const s=this.states.blendColor;s[0]===t&&s[1]===i&&s[2]===e&&s[3]===r||(s[0]=t,s[1]=i,s[2]=e,s[3]=r,this.i.blendColor(t,i,e,r));},blendEquation(t){this.v();const i=this.states.blendEquationSeparate;i[0]===t&&i[1]===t||(i[0]=t,i[1]=t,this.i.blendEquation(t));},blendEquationSeparate(t,i){this.v();const e=this.states.blendEquationSeparate;e[0]===t&&e[1]===i||(e[0]=t,e[1]=i,this.i.blendEquationSeparate(t,i));},blendFunc(t,i){this.v();const e=this.states.blendFuncSeparate;e[0]===t&&e[2]===t&&e[1]===i&&e[3]===i||(e[0]=t,e[1]=i,e[2]=t,e[3]=i,this.i.blendFunc(t,i));},blendFuncSeparate(t,i,e,r){this.v();const s=this.states.blendFuncSeparate;s[0]===t&&s[1]===i&&s[2]===e&&s[3]===r||(s[0]=t,s[1]=i,s[2]=e,s[3]=r,this.i.blendFuncSeparate(t,i,e,r));},clearColor(t,i,e,r){this.v();const s=this.states.clearColor;s[0]===t&&s[1]===i&&s[2]===e&&s[3]===r||(s[0]=t,s[1]=i,s[2]=e,s[3]=r,this.i.clearColor(t,i,e,r));},clearDepth(t){this.v();const i=this.states.clearDepth;i[0]!==t&&(i[0]=t,this.i.clearDepth(t));},clearStencil(t){this.v();const i=this.states.clearStencil;i[0]!==t&&(i[0]=t,this.i.clearStencil(t));},colorMask(t,i,e,r){this.v();const s=this.states.colorMask;s[0]===t&&s[1]===i&&s[2]===e&&s[3]===r||(s[0]=t,s[1]=i,s[2]=e,s[3]=r,this.i.colorMask(t,i,e,r));},cullFace(t){this.v();const i=this.states.cullFace;i[0]!==t&&(i[0]=t,this.i.cullFace(t));},depthFunc(t){this.v();const i=this.states.depthFunc;i[0]!==t&&(i[0]=t,this.i.depthFunc(t));},depthMask(t){this.v();const i=this.states.depthMask;i[0]!==t&&(i[0]=t,this.i.depthMask(t));},depthRange(t,i){this.v();const e=this.states.depthRange;e[0]===t&&e[1]===i||(e[0]=t,e[1]=i,this.i.depthRange(t,i));},disable(t){this.v();const i=this.states.capabilities;i[t]&&(i[t]=!1,this.i.disable(t));},enable(t){this.v();const i=this.states.capabilities;i[t]||(i[t]=!0,this.i.enable(t));},frontFace(t){this.v();const i=this.states.frontFace;i[0]!==t&&(i[0]=t,this.i.frontFace(t));},hint(t,i){this.v();const e=this.states.hint;e[t][0]!==i&&(e[t][0]=i,this.i.hint(t,i));},lineWidth(t){this.v();const i=this.states.lineWidth;i[0]!==t&&(i[0]=t,this.i.lineWidth(t));},pixelStorei(t,i){this.v();const e=this.states.pixelStorei;e[t]!==i&&(e[t]&&(e[t][0]=i),this.i.pixelStorei(t,i));},polygonOffset(t,i){this.v();const e=this.states.polygonOffset;e[0]===t&&e[1]===i||(e[0]=t,e[1]=i,this.i.polygonOffset(t,i));},sampleCoverage(t,i){this.v();const e=this.states.sampleCoverage;e[0]===t&&e[1]===i||(e[0]=t,e[1]=i,this.i.sampleCoverage(t,i));},stencilFunc(t,i,e){this.v();const r=this.states.stencilFuncSeparate,s=this.i;r[s.FRONT][0]===t&&r[s.FRONT][1]===i&&r[s.FRONT][2]===e&&r[s.BACK][0]===t&&r[s.BACK][1]===i&&r[s.BACK][2]===e||(r[s.FRONT][0]=r[s.BACK][0]=t,r[s.FRONT][1]=r[s.BACK][1]=i,r[s.FRONT][2]=r[s.BACK][2]=e,this.i.stencilFunc(t,i,e));},stencilFuncSeparate(t,i,e,r){this.v();if(t===this.i.FRONT_AND_BACK)return void this.stencilFunc(i,e,r);const s=this.states.stencilFuncSeparate;s[t][0]===i&&s[t][1]===e&&s[t][2]===r||(s[t][0]=i,s[t][1]=e,s[t][2]=r,this.i.stencilFuncSeparate(t,i,e,r));},stencilMask(t){this.v();const i=this.i,e=this.states.stencilMaskSeparate;e[i.FRONT][0]===t&&e[i.BACK][0]===t||(e[i.FRONT][0]=t,e[i.BACK][0]=t,this.i.stencilMask(t));},stencilMaskSeparate(t,i){if(this.v(),t===this.i.FRONT_AND_BACK)return void this.stencilMask(i);const e=this.states.stencilMaskSeparate;e[t][0]!==i&&(e[t][0]=i,this.i.stencilMaskSeparate(t,i));},stencilOp(t,i,e){this.v();const r=this.states.stencilOpSeparate,s=this.i;r[s.FRONT][0]===t&&r[s.FRONT][1]===i&&r[s.FRONT][2]===e&&r[s.BACK][0]===t&&r[s.BACK][1]===i&&r[s.BACK][2]===e||(r[s.FRONT][0]=r[s.BACK][0]=t,r[s.FRONT][1]=r[s.BACK][1]=i,r[s.FRONT][2]=r[s.BACK][2]=e,this.i.stencilOp(t,i,e));},stencilOpSeparate(t,i,e,r){if(this.v(),t===this.i.FRONT_AND_BACK)return void this.stencilOp(i,e,r);const s=this.states.stencilOpSeparate;s[t][0]===i&&s[t][1]===e&&s[t][2]===r||(s[t][0]=i,s[t][1]=e,s[t][2]=r,this.i.stencilOpSeparate(t,i,e,r));},bindFramebuffer(t,i){this.v();const e=this.states.framebuffer;e[t]!==i&&(e[t]=i,this.i.bindFramebuffer(t,i));},bindRenderbuffer(t,i){this.v();const e=this.states.renderbuffer;e[t]!==i&&(e[t]=i,this.i.bindRenderbuffer(t,i));},bindTexture(t,i){this.v();const e=this.states.textures,r=-1!==e.active?e.active-33984:-1;e.units[r][t]=i,this.i.bindTexture(t,i);},activeTexture(t){this.v();const i=this.i,e=this.states.textures,r=e.active;e.active=t,this.activeUnit!==t&&(i.activeTexture(t),this.activeUnit=t),-1===r&&(e.units[t-33984][i.TEXTURE_2D]=e.units[-1][i.TEXTURE_2D],e.units[t-33984][i.TEXTURE_CUBE_MAP]=e.units[-1][i.TEXTURE_CUBE_MAP],e.units[-1][i.TEXTURE_2D]=null,e.units[-1][i.TEXTURE_CUBE_MAP]=null);},useProgram(t){this.v();const i=this.states;i.program!==t&&(this.states.activeAttribType=0,i.program=t,void 0===t.fid&&(t.fid=0),this.p(),this.i.useProgram(t));},p(){const t=this.states.program;if(!t)return;const i=t.cachedUniforms=t.cachedUniforms||{};for(const t in i)Array.isArray(i[t])?i[t].fill(null):i[t]=null;},bindBuffer(t,i){this.v();const e=this.i,r=this.states;t===e.ELEMENT_ARRAY_BUFFER?r.elementArrayBuffer=i:r.arrayBuffer=i,e.bindBuffer(t,i);},bindVertexArray(t){this.v(),this.states.activeAttribType=1;const i=this.i,e=this.states;e.vao!==t&&(e.vao=t,this.t?i.bindVertexArray(t):this.vaoOES.bindVertexArrayOES(t));},vertexAttribPointer(t,i,e,r,s,h){this.v(),this.states.attributes[t]||(this.states.attributes[t]={enable:!0});const n=this.states.attributes[t];return n.buffer=this.states.arrayBuffer,n.args?(n.args[0]=t,n.args[1]=i,n.args[2]=e,n.args[3]=r,n.args[4]=s,n.args[5]=h):n.args=[t,i,e,r,s,h],this.i.vertexAttribPointer(t,i,e,r,s,h)},vertexAttribDivisor(t,i){this.v();return this.states.attributes[t].divisor=i,this.t?this.i.vertexAttribDivisor(t,i):this.angleOES.vertexAttribDivisorANGLE(t,i)}},{v(){const t=this.i;if(t[u]!==this)if(t[u]){const i=t[u];this.N(i.states),t[u]=this;}else t[u]=this;},N(i){if(!i)return;delete this.activeUnit;const e=this.states,r=this.i;let s=0;for(const h in e)if("capabilities"!==h&&"textures"!==h&&"attributes"!==h&&"arrayBuffer"!==h&&"elementArrayBuffer"!==h&&"vao"!==h)if("program"===h)e.program!==i.program&&(r.useProgram(e.program),e.program&&(s=r.getProgramParameter(e.program,r.ACTIVE_ATTRIBUTES)));else if("framebuffer"===h)for(const t in e[h])e[h][t]!==i[h][t]&&r.bindFramebuffer(+t,e[h][t]);else if("renderbuffer"===h)for(const t in e[h])e[h][t]!==i[h][t]&&r.bindRenderbuffer(+t,e[h][t]);else if(!t(e[h],i[h]))if(Array.isArray(i[h]))r[h](...e[h]);else if(i[h])for(const s in e[h])t(e[h][s],i[h][s])||r[h](+s,...e[h][s]);this.p();for(const t in e.capabilities)e.capabilities[t]!==i.capabilities[t]&&r[e.capabilities[t]?"enable":"disable"](+t);const h=e.textures,n=i.textures,u=h.units,o=n.units,a=h.active-r.TEXTURE0;for(let t=0;t<u.length;t++)t===a||u[t][r.TEXTURE_2D]===o[t][r.TEXTURE_2D]&&u[t][r.TEXTURE_CUBE_MAP]===o[t][r.TEXTURE_CUBE_MAP]||(r.activeTexture(r.TEXTURE0+t),r.bindTexture(r.TEXTURE_2D,u[t][r.TEXTURE_2D]),r.bindTexture(r.TEXTURE_CUBE_MAP,u[t][r.TEXTURE_CUBE_MAP]));if(h.active>-1){const t=u[a];t[r.TEXTURE_2D]===o[a][r.TEXTURE_2D]&&t[r.TEXTURE_CUBE_MAP]===o[a][r.TEXTURE_CUBE_MAP]||(r.activeTexture(h.active),r.bindTexture(r.TEXTURE_2D,t[r.TEXTURE_2D]),r.bindTexture(r.TEXTURE_CUBE_MAP,t[r.TEXTURE_CUBE_MAP]));}this.t?r.bindVertexArray(null):this.o&&this.o.bindVertexArrayOES(null);const f=this.h;if(this.t||this.angleOES)for(let t=0;t<f;t++)this.t?r.vertexAttribDivisor(t,0):this.angleOES.vertexAttribDivisorANGLE(t,0);r.bindBuffer(r.ARRAY_BUFFER,e.arrayBuffer),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e.elementArrayBuffer),1===e.activeAttribType?this.F(e,r):this.L(e,r,s);},F(t,i){const e=t.vao;e&&(this.t?i.bindVertexArray(e||null):this.o&&this.o.bindVertexArrayOES(e||null));},L(t,i,e){const r=this.h,s=t.attributes;let h=0;for(let t=0;t<r;t++){const r=s[t];if(h<e&&r){if(r.buffer){if(i.bindBuffer(i.ARRAY_BUFFER,r.buffer),i.vertexAttribPointer(...r.args),r.divisor&&(this.t?i.vertexAttribDivisor(t,r.divisor):this.angleOES.vertexAttribDivisorANGLE(t,r.divisor)),r.enable){i.enableVertexAttribArray(t),h++;continue}i.disableVertexAttribArray(t);}i.disableVertexAttribArray(t);}else i.disableVertexAttribArray(t);}}}),e$1(WebGL2RenderingContext$1.prototype,{compressedTexImage2D(t,i,e,r,s,h,n){return this.v(),this.i.compressedTexImage2D(t,i,e,r,s,h,n)},copyTexImage2D(t,i,e,r,s,h,n,u){return this.v(),this.i.copyTexImage2D(t,i,e,r,s,h,n,u)},copyTexSubImage2D(t,i,e,r,s,h,n,u){return this.v(),this.i.copyTexSubImage2D(t,i,e,r,s,h,n,u)},createTexture(){return this.i.createTexture()},deleteTexture(t){const i=this.states.textures.units;for(let e=0;e<i.length;e++)for(const r in i[e])i[e][r]===t&&(i[e][r]=null);return this.i.deleteTexture(t)},generateMipmap(t){return this.v(),this.i.generateMipmap(t)},getTexParameter(t,i){return this.v(),this.i.getTexParameter(t,i)},isTexture(t){return this.i.isTexture(t)},texImage2D(...t){if(this.v(),this.t){const i=t[t.length-2],e=h.getInternalFormat(this.i,t[2],i);e!==t[2]&&(t[2]=e);const r=h.getTextureType(this.i,i);r!==i&&(t[t.length-2]=r);}return this.i.texImage2D(...t)},texSubImage2D(...t){if(this.v(),this.t){const i=t[t.length-2],e=h.getTextureType(this.i,i);e!==i&&(t[t.length-2]=e);}return this.i.texSubImage2D(...t)},texParameterf(t,i,e){return this.v(),this.i.texParameterf(t,i,e)},texParameteri(t,i,e){return this.v(),this.i.texParameteri(t,i,e)},texStorage2D(t,i,e,r,s){return this.v(),this.i.texStorage2D(t,i,e,r,s)},texImage3D(t,i,e,r,s,h,n,u,o,a){return this.v(),this.i.texImage3D(t,i,e,r,s,h,n,u,o,a)},texStorage3D(t,i,e,r,s,h){return this.v(),this.i.texStorage3D(t,i,e,r,s,h)},texSubImage3D(t,i,e,r,s,h,n,u,o,a,f){return this.v(),this.i.texSubImage3D(t,i,e,r,s,h,n,u,o,a,f)},copyTexSubImage3D(t,i,e,r,s,h,n,u,o){return this.v(),this.i.copyTexSubImage3D(t,i,e,r,s,h,n,u,o)},compressedTexSubImage3D(t,i,e,r,s,h,n,u,o,a,f){return this.v(),this.i.compressedTexSubImage3D(t,i,e,r,s,h,n,u,o,a,f)}});const o=[];function a(t,i){const e=i.length;for(let r=0;r<e;r++)t[r]=i[r];return t}e$1(WebGL2RenderingContext$1.prototype,{bindAttribLocation(t,i,e){return this.i.bindAttribLocation(t,i,e)},enableVertexAttribArray(t){return this.v(),this.states.attributes[t]||(this.states.attributes[t]={}),this.states.attributes[t].enable=!0,this.i.enableVertexAttribArray(t)},disableVertexAttribArray(t){return this.v(),this.states.attributes[t]||(this.states.attributes[t]={}),this.states.attributes[t].enable=!1,this.i.disableVertexAttribArray(t)},getActiveAttrib(t,i){return this.i.getActiveAttrib(t,i)},getActiveUniform(t,i){return this.i.getActiveUniform(t,i)},getAttribLocation(t,i){return this.i.getAttribLocation(t,i)},getUniformLocation(t,i){return this.i.getUniformLocation(t,i)},getVertexAttrib(t,i){return this.v(),this.i.getVertexAttrib(t,i)},getVertexAttribOffset(t,i){return this.v(),this.i.getVertexAttribOffset(t,i)},uniformBlockBinding(t,i,e){return this.v(),this.i.uniformBlockBinding(t,i,e)},B(t,...i){const e=this.states.program;if(!e)return !1;let r=t.fid;void 0===r&&(r=t.fid=e.fid++);const s=e.cachedUniforms[r];return !!function(t,i){if(!t)return !1;const e=i.length;for(let r=0;r<e;r++)if(t[r]&&void 0!==t[r].length){const e=t[r].length;for(let s=0;s<e;s++)if(t[r][s]!==i[r][s])return !1}else if(t[r]!==i[r])return !1;return !0}(s,i)||(e.cachedUniforms[r]=function(t,i){t=t||new Array(i.length);const e=i.length;for(let r=0;r<e;r++)t[r]=void 0!==i[r].length?a(t[r]||[],i[r]):i[r];return t}(s,i),!1)},uniformMatrix2fv(t,i,e){this.B(t,i,e)||(this.v(),this.i.uniformMatrix2fv(t,i,e));},uniformMatrix3fv(t,i,e){this.B(t,i,e)||(this.v(),this.i.uniformMatrix3fv(t,i,e));},uniformMatrix4fv(t,i,e){t?(e=this.C(e),this.B(t,i,e)||this.i.uniformMatrix4fv(t,i,e)):console.warn("UniformLocation invalid, null value encountered in browser:",navigator.userAgent);},C:t=>t?(o[0]=isNaN(t[0])?-1e30:t[0],o[1]=isNaN(t[1])?-1e30:t[1],o[2]=isNaN(t[2])?-1e30:t[2],o[3]=isNaN(t[3])?-1e30:t[3],o[4]=isNaN(t[4])?-1e30:t[4],o[5]=isNaN(t[5])?-1e30:t[5],o[6]=isNaN(t[6])?-1e30:t[6],o[7]=isNaN(t[7])?-1e30:t[7],o[8]=isNaN(t[8])?-1e30:t[8],o[9]=isNaN(t[9])?-1e30:t[9],o[10]=isNaN(t[10])?-1e30:t[10],o[11]=isNaN(t[11])?-1e30:t[11],o[12]=isNaN(t[12])?-1e30:t[12],o[13]=isNaN(t[13])?-1e30:t[13],o[14]=isNaN(t[14])?-1e30:t[14],o[15]=isNaN(t[15])?-1e30:t[15],o):t,uniform1f(t,i){return this.v(),this.i.uniform1f(t,i)},uniform1i(t,i){return this.v(),this.i.uniform1i(t,i)},uniform2f(t,i,e){return this.v(),this.i.uniform2f(t,i,e)},uniform2i(t,i,e){return this.v(),this.i.uniform2i(t,i,e)},uniform3f(t,i,e,r){return this.v(),this.i.uniform3f(t,i,e,r)},uniform3i(t,i,e,r){return this.v(),this.i.uniform3i(t,i,e,r)},uniform4f(t,i,e,r,s){return this.v(),this.i.uniform4f(t,i,e,r,s)},uniform4i(t,i,e,r,s){return this.v(),this.i.uniform4i(t,i,e,r,s)},uniform1ui(t,i){return this.v(),this.i.uniform1ui(t,i)},uniform2ui(t,i,e){return this.v(),this.i.uniform2ui(t,i,e)},uniform3ui(t,i,e,r){return this.v(),this.i.uniform3ui(t,i,e,r)},uniform4ui(t,i,e,r,s){return this.v(),this.i.uniform4ui(t,i,e,r,s)},uniform1fv(t,i,e,r){this.v(),void 0!==r?this.i.uniform1fv(t,i,e,r):void 0!==e?this.i.uniform1fv(t,i,e):this.i.uniform1fv(t,i);},uniform2fv(t,i,e,r){this.v(),void 0!==r?this.i.uniform2fv(t,i,e,r):void 0!==e?this.i.uniform2fv(t,i,e):this.i.uniform2fv(t,i);},uniform3fv(t,i,e,r){this.v(),void 0!==r?this.i.uniform3fv(t,i,e,r):void 0!==e?this.i.uniform3fv(t,i,e):this.i.uniform3fv(t,i);},uniform4fv(t,i,e,r){this.v(),void 0!==r?this.i.uniform4fv(t,i,e,r):void 0!==e?this.i.uniform4fv(t,i,e):this.i.uniform4fv(t,i);},uniform1iv(t,i,e,r){this.v(),void 0!==r?this.i.uniform1iv(t,i,e,r):void 0!==e?this.i.uniform1iv(t,i,e):this.i.uniform1iv(t,i);},uniform2iv(t,i,e,r){this.v(),void 0!==r?this.i.uniform2iv(t,i,e,r):void 0!==e?this.i.uniform2iv(t,i,e):this.i.uniform2iv(t,i);},uniform3iv(t,i,e,r){this.v(),void 0!==r?this.i.uniform3iv(t,i,e,r):void 0!==e?this.i.uniform3iv(t,i,e):this.i.uniform3iv(t,i);},uniform4iv(t,i,e,r){this.v(),void 0!==r?this.i.uniform4iv(t,i,e,r):void 0!==e?this.i.uniform4iv(t,i,e):this.i.uniform4iv(t,i);},uniform1uiv(t,i,e,r){this.v(),void 0!==r?this.i.uniform1uiv(t,i,e,r):void 0!==e?this.i.uniform1uiv(t,i,e):this.i.uniform1uiv(t,i);},uniform2uiv(t,i,e,r){this.v(),void 0!==r?this.i.uniform2uiv(t,i,e,r):void 0!==e?this.i.uniform2uiv(t,i,e):this.i.uniform2uiv(t,i);},uniform3uiv(t,i,e,r){this.v(),void 0!==r?this.i.uniform3uiv(t,i,e,r):void 0!==e?this.i.uniform3uiv(t,i,e):this.i.uniform3uiv(t,i);},uniform4uiv(t,i,e,r){this.v(),void 0!==r?this.i.uniform4uiv(t,i,e,r):void 0!==e?this.i.uniform4uiv(t,i,e):this.i.uniform4uiv(t,i);},vertexAttrib1f(t,i){return this.v(),this.i.vertexAttrib1f(t,i)},vertexAttrib2f(t,i,e){return this.v(),this.i.vertexAttrib2f(t,i,e)},vertexAttrib3f(t,i,e,r){return this.v(),this.i.vertexAttrib3f(t,i,e,r)},vertexAttrib4f(t,i,e,r,s){return this.v(),this.i.vertexAttrib4f(t,i,e,r,s)},vertexAttrib1fv(t,i){return this.v(),this.i.vertexAttrib1fv(t,i)},vertexAttrib2fv(t,i){return this.v(),this.i.vertexAttrib2fv(t,i)},vertexAttrib3fv(t,i){return this.v(),this.i.vertexAttrib3fv(t,i)},vertexAttrib4fv(t,i){return this.v(),this.i.vertexAttrib4fv(t,i)},vertexAttribI4i(t,i,e,r,s){return this.v(),this.i.vertexAttribI4i(t,i,e,r,s)},vertexAttribI4ui(t,i,e,r,s){return this.v(),this.i.vertexAttribI4ui(t,i,e,r,s)},vertexAttribI4iv(t,i){return this.v(),this.i.vertexAttribI4iv(t,i)},vertexAttribI4uiv(t,i){return this.v(),this.i.vertexAttribI4uiv(t,i)}}),e$1(WebGL2RenderingContext$1.prototype,{createVertexArray(){return this.t?this.i.createVertexArray():this.vaoOES.createVertexArrayOES()},deleteVertexArray(t){const i=this.states;return i.vao===t&&(i.vao=null),this.t?this.i.deleteVertexArray(t):this.vaoOES.deleteVertexArrayOES(t)},isVertexArray(t){return this.t?this.i.isVertexArray(t):this.vaoOES.isVertexArrayOES(t)}}),e$1(WebGL2RenderingContext$1.prototype,{drawArraysInstanced(t,i,e,r){return this.v(),this._(),this.t?this.i.drawArraysInstanced(t,i,e,r):this.angleOES.drawArraysInstancedANGLE(t,i,e,r)},drawElementsInstanced(t,i,e,r,s){return this.v(),this._(),this.t?this.i.drawElementsInstanced(t,i,e,r,s):this.angleOES.drawElementsInstancedANGLE(t,i,e,r,s)}});
|
|
8930
8930
|
|
|
@@ -21870,7 +21870,7 @@
|
|
|
21870
21870
|
forEachRenderer(e) {
|
|
21871
21871
|
const t = this._getLayers();
|
|
21872
21872
|
for (const n of t) {
|
|
21873
|
-
if (!n.isVisible() || !n.options.
|
|
21873
|
+
if (!n.isVisible() || !n.options.renderBeforeTerrain) continue;
|
|
21874
21874
|
const t = n.getRenderer();
|
|
21875
21875
|
t && e(t, n);
|
|
21876
21876
|
}
|
|
@@ -21880,7 +21880,7 @@
|
|
|
21880
21880
|
t && e(t, n);
|
|
21881
21881
|
}
|
|
21882
21882
|
for (const n of t) {
|
|
21883
|
-
if (!n.isVisible() || n.options.
|
|
21883
|
+
if (!n.isVisible() || n.options.renderBeforeTerrain) continue;
|
|
21884
21884
|
const t = n.getRenderer();
|
|
21885
21885
|
t && e(t, n);
|
|
21886
21886
|
}
|
|
@@ -26417,9 +26417,9 @@
|
|
|
26417
26417
|
|
|
26418
26418
|
const e = "${"; const code = `function(t){
|
|
26419
26419
|
/*!
|
|
26420
|
-
* @maptalks/gltf-loader v0.
|
|
26420
|
+
* @maptalks/gltf-loader v0.119.0
|
|
26421
26421
|
* LICENSE : UNLICENSED
|
|
26422
|
-
* (c) 2016-
|
|
26422
|
+
* (c) 2016-2026 maptalks.org
|
|
26423
26423
|
*/
|
|
26424
26424
|
var e,r,n="undefined"!=typeof Float32Array?Float32Array:Array;function i(){var t=new n(3);return n!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function s(t,e,r){var i=new n(3);return i[0]=t,i[1]=e,i[2]=r,i}function a(){var t=new n(4);return n!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)}),i(),e=new n(4),n!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),i(),s(1,0,0),s(0,1,0),a(),a(),r=new n(9),n!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[5]=0,r[6]=0,r[7]=0),r[0]=1,r[4]=1,r[8]=1;let o=0;!function(t){t[0]=0,t[1]=0,t[2]=0,t[3]=1}([]),"undefined"!=typeof TextDecoder&&new TextDecoder("utf-8");const h={get:function(t,e={},r){e||(e={});const n=new AbortController,i=n.signal,s=function(t){for(let e=1;e<arguments.length;e++){const r=arguments[e];for(const e in r)t[e]=r[e]}return t}({},e);s.signal=i,s.method||(s.method="GET"),s.referrerPolicy=s.referrerPolicy||"origin","undefined"==typeof window||s.referrer||(s.referrer=window.location.href),r&&(t=r(t));const a=fetch(t,s).then((t=>{const r=this._parseResponse(t,e.responseType);return r.message?r:r.then((r=>"arraybuffer"===e.responseType?{data:r,cacheControl:t.headers.get("Cache-Control"),expires:t.headers.get("Expires"),contentType:t.headers.get("Content-Type")}:r)).catch((t=>{if(!t.code||t.code!==DOMException.ABORT_ERR)throw t}))})).catch((t=>{if(!t.code||t.code!==DOMException.ABORT_ERR)throw t}));return a.xhr=n,a},_parseResponse:(t,e)=>200!==t.status?{status:t.status,statusText:t.statusText,message:\`incorrect http request with status code(${e}t.status}): ${e}t.statusText}\`}:"arraybuffer"===e?t.arrayBuffer():"json"===e?t.json():t.text(),getArrayBuffer:(t,e={},r)=>(e||(e={}),e.responseType="arraybuffer",h.get(t,e,r)),getJSON:function(t,e={},r){return e&&e.jsonp?h.jsonp(t):((e=e||{}).responseType="json",h.get(t,e,r))},jsonp:function(t){const e="_maptalks_jsonp_"+o++;t.match(/\\?/)?t+="&callback="+e:t+="?callback="+e;let r=document.createElement("script");return r.type="text/javascript",r.src=t,new Promise((t=>{window[e]=function(n){document.getElementsByTagName("head")[0].removeChild(r),r=null,delete window[e],t(n)},document.getElementsByTagName("head")[0].appendChild(r)}))}};if("undefined"!=typeof TextDecoder&&new TextDecoder("utf-8"),"undefined"!=typeof OffscreenCanvas){let t;try{t=new OffscreenCanvas(2,2).getContext("2d")}catch(n){}}"undefined"!=typeof document&&document.createElement("canvas"),
|
|
26425
26425
|
/** @license zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License */function(){function t(t){throw t}var e=void 0,r=!0,n=this;function i(t,r){var i,s=t.split("."),a=n;!(s[0]in a)&&a.execScript&&a.execScript("var "+s[0]);for(;s.length&&(i=s.shift());)s.length||r===e?a=a[i]?a[i]:a[i]={}:a[i]=r}var s="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array&&"undefined"!=typeof DataView;function a(e,r){this.index="number"==typeof r?r:0,this.i=0,this.buffer=e instanceof(s?Uint8Array:Array)?e:new(s?Uint8Array:Array)(32768),2*this.buffer.length<=this.index&&t(Error("invalid index")),this.buffer.length<=this.index&&this.f()}a.prototype.f=function(){var t,e=this.buffer,r=e.length,n=new(s?Uint8Array:Array)(r<<1);if(s)n.set(e);else for(t=0;t<r;++t)n[t]=e[t];return this.buffer=n},a.prototype.d=function(t,e,r){var n,i=this.buffer,s=this.index,a=this.i,o=i[s];if(r&&1<e&&(t=8<e?(u[255&t]<<24|u[t>>>8&255]<<16|u[t>>>16&255]<<8|u[t>>>24&255])>>32-e:u[t]>>8-e),8>e+a)o=o<<e|t,a+=e;else for(n=0;n<e;++n)o=o<<1|t>>e-n-1&1,8==++a&&(a=0,i[s++]=u[o],o=0,s===i.length&&(i=this.f()));i[s]=o,this.buffer=i,this.i=a,this.index=s},a.prototype.finish=function(){var t,e=this.buffer,r=this.index;return 0<this.i&&(e[r]<<=8-this.i,e[r]=u[e[r]],r++),s?t=e.subarray(0,r):(e.length=r,t=e),t};var o,h=new(s?Uint8Array:Array)(256);for(o=0;256>o;++o){for(var c=l=o,f=7,l=l>>>1;l;l>>>=1)c<<=1,c|=1&l,--f;h[o]=(c<<f&255)>>>0}var u=h;function g(t){this.buffer=new(s?Uint16Array:Array)(2*t),this.length=0}function d(t){var e,r,n,i,a,o,h,c,f,l,u=t.length,g=0,d=Number.POSITIVE_INFINITY;for(c=0;c<u;++c)t[c]>g&&(g=t[c]),t[c]<d&&(d=t[c]);for(e=1<<g,r=new(s?Uint32Array:Array)(e),n=1,i=0,a=2;n<=g;){for(c=0;c<u;++c)if(t[c]===n){for(o=0,h=i,f=0;f<n;++f)o=o<<1|1&h,h>>=1;for(l=n<<16|c,f=o;f<e;f+=a)r[f]=l;++i}++n,i<<=1,a<<=1}return[r,g,d]}function p(t,e){this.h=m,this.w=0,this.input=s&&t instanceof Array?new Uint8Array(t):t,this.b=0,e&&(e.lazy&&(this.w=e.lazy),"number"==typeof e.compressionType&&(this.h=e.compressionType),e.outputBuffer&&(this.a=s&&e.outputBuffer instanceof Array?new Uint8Array(e.outputBuffer):e.outputBuffer),"number"==typeof e.outputIndex&&(this.b=e.outputIndex)),this.a||(this.a=new(s?Uint8Array:Array)(32768))}g.prototype.getParent=function(t){return 2*((t-2)/4|0)},g.prototype.push=function(t,e){var r,n,i,s=this.buffer;for(r=this.length,s[this.length++]=e,s[this.length++]=t;0<r&&(n=this.getParent(r),s[r]>s[n]);)i=s[r],s[r]=s[n],s[n]=i,i=s[r+1],s[r+1]=s[n+1],s[n+1]=i,r=n;return this.length},g.prototype.pop=function(){var t,e,r,n,i,s=this.buffer;for(e=s[0],t=s[1],this.length-=2,s[0]=s[this.length],s[1]=s[this.length+1],i=0;!((n=2*i+2)>=this.length)&&(n+2<this.length&&s[n+2]>s[n]&&(n+=2),s[n]>s[i]);)r=s[i],s[i]=s[n],s[n]=r,r=s[i+1],s[i+1]=s[n+1],s[n+1]=r,i=n;return{index:t,value:e,length:this.length}};var y,m=2,b={NONE:0,r:1,k:m,N:3},w=[];for(y=0;288>y;y++)switch(r){case 143>=y:w.push([y+48,8]);break;case 255>=y:w.push([y-144+400,9]);break;case 279>=y:w.push([y-256+0,7]);break;case 287>=y:w.push([y-280+192,8]);break;default:t("invalid literal: "+y)}function A(t,e){this.length=t,this.G=e}p.prototype.j=function(){var n,i,o,h,c=this.input;switch(this.h){case 0:for(o=0,h=c.length;o<h;){var f,l,u,g=i=s?c.subarray(o,o+65535):c.slice(o,o+65535),d=(o+=i.length)===h,p=e,y=e,b=this.a,A=this.b;if(s){for(b=new Uint8Array(this.a.buffer);b.length<=A+g.length+5;)b=new Uint8Array(b.length<<1);b.set(this.a)}if(f=d?1:0,b[A++]=0|f,u=65536+~(l=g.length)&65535,b[A++]=255&l,b[A++]=l>>>8&255,b[A++]=255&u,b[A++]=u>>>8&255,s)b.set(g,A),A+=g.length,b=b.subarray(0,A);else{for(p=0,y=g.length;p<y;++p)b[A++]=g[p];b.length=A}this.b=A,this.a=b}break;case 1:var v=new a(s?new Uint8Array(this.a.buffer):this.a,this.b);v.d(1,1,r),v.d(1,2,r);var k,x,M,I=E(this,c);for(k=0,x=I.length;k<x;k++)if(M=I[k],a.prototype.d.apply(v,w[M]),256<M)v.d(I[++k],I[++k],r),v.d(I[++k],5),v.d(I[++k],I[++k],r);else if(256===M)break;this.a=v.finish(),this.b=this.a.length;break;case m:var S,D,F,B,z,N,_,C,O,R,P,j,q,L,H,Y=new a(s?new Uint8Array(this.a.buffer):this.a,this.b),W=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],V=Array(19);for(S=m,Y.d(1,1,r),Y.d(S,2,r),D=E(this,c),_=U(N=T(this.L,15)),O=U(C=T(this.K,7)),F=286;257<F&&0===N[F-1];F--);for(B=30;1<B&&0===C[B-1];B--);var Z,G,$,J,K,X,Q=F,tt=B,et=new(s?Uint32Array:Array)(Q+tt),rt=new(s?Uint32Array:Array)(316),nt=new(s?Uint8Array:Array)(19);for(Z=G=0;Z<Q;Z++)et[G++]=N[Z];for(Z=0;Z<tt;Z++)et[G++]=C[Z];if(!s)for(Z=0,J=nt.length;Z<J;++Z)nt[Z]=0;for(Z=K=0,J=et.length;Z<J;Z+=G){for(G=1;Z+G<J&&et[Z+G]===et[Z];++G);if($=G,0===et[Z])if(3>$)for(;0<$--;)rt[K++]=0,nt[0]++;else for(;0<$;)(X=138>$?$:138)>$-3&&X<$&&(X=$-3),10>=X?(rt[K++]=17,rt[K++]=X-3,nt[17]++):(rt[K++]=18,rt[K++]=X-11,nt[18]++),$-=X;else if(rt[K++]=et[Z],nt[et[Z]]++,3>--$)for(;0<$--;)rt[K++]=et[Z],nt[et[Z]]++;else for(;0<$;)(X=6>$?$:6)>$-3&&X<$&&(X=$-3),rt[K++]=16,rt[K++]=X-3,nt[16]++,$-=X}for(n=s?rt.subarray(0,K):rt.slice(0,K),R=T(nt,7),L=0;19>L;L++)V[L]=R[W[L]];for(z=19;4<z&&0===V[z-1];z--);for(P=U(R),Y.d(F-257,5,r),Y.d(B-1,5,r),Y.d(z-4,4,r),L=0;L<z;L++)Y.d(V[L],3,r);for(L=0,H=n.length;L<H;L++)if(j=n[L],Y.d(P[j],R[j],r),16<=j){switch(L++,j){case 16:q=2;break;case 17:q=3;break;case 18:q=7;break;default:t("invalid code: "+j)}Y.d(n[L],q,r)}var it,st,at,ot,ht,ct,ft,lt,ut=[_,N],gt=[O,C];for(ht=ut[0],ct=ut[1],ft=gt[0],lt=gt[1],it=0,st=D.length;it<st;++it)if(at=D[it],Y.d(ht[at],ct[at],r),256<at)Y.d(D[++it],D[++it],r),ot=D[++it],Y.d(ft[ot],lt[ot],r),Y.d(D[++it],D[++it],r);else if(256===at)break;this.a=Y.finish(),this.b=this.a.length;break;default:t("invalid compression type")}return this.a};var v=function(){function e(e){switch(r){case 3===e:return[257,e-3,0];case 4===e:return[258,e-4,0];case 5===e:return[259,e-5,0];case 6===e:return[260,e-6,0];case 7===e:return[261,e-7,0];case 8===e:return[262,e-8,0];case 9===e:return[263,e-9,0];case 10===e:return[264,e-10,0];case 12>=e:return[265,e-11,1];case 14>=e:return[266,e-13,1];case 16>=e:return[267,e-15,1];case 18>=e:return[268,e-17,1];case 22>=e:return[269,e-19,2];case 26>=e:return[270,e-23,2];case 30>=e:return[271,e-27,2];case 34>=e:return[272,e-31,2];case 42>=e:return[273,e-35,3];case 50>=e:return[274,e-43,3];case 58>=e:return[275,e-51,3];case 66>=e:return[276,e-59,3];case 82>=e:return[277,e-67,4];case 98>=e:return[278,e-83,4];case 114>=e:return[279,e-99,4];case 130>=e:return[280,e-115,4];case 162>=e:return[281,e-131,5];case 194>=e:return[282,e-163,5];case 226>=e:return[283,e-195,5];case 257>=e:return[284,e-227,5];case 258===e:return[285,e-258,0];default:t("invalid length: "+e)}}var n,i,s=[];for(n=3;258>=n;n++)i=e(n),s[n]=i[2]<<24|i[1]<<16|i[0];return s}(),k=s?new Uint32Array(v):v;function E(n,i){function a(e,n){var i,s,a,o,h=e.G,c=[],f=0;switch(i=k[e.length],c[f++]=65535&i,c[f++]=i>>16&255,c[f++]=i>>24,r){case 1===h:s=[0,h-1,0];break;case 2===h:s=[1,h-2,0];break;case 3===h:s=[2,h-3,0];break;case 4===h:s=[3,h-4,0];break;case 6>=h:s=[4,h-5,1];break;case 8>=h:s=[5,h-7,1];break;case 12>=h:s=[6,h-9,2];break;case 16>=h:s=[7,h-13,2];break;case 24>=h:s=[8,h-17,3];break;case 32>=h:s=[9,h-25,3];break;case 48>=h:s=[10,h-33,4];break;case 64>=h:s=[11,h-49,4];break;case 96>=h:s=[12,h-65,5];break;case 128>=h:s=[13,h-97,5];break;case 192>=h:s=[14,h-129,6];break;case 256>=h:s=[15,h-193,6];break;case 384>=h:s=[16,h-257,7];break;case 512>=h:s=[17,h-385,7];break;case 768>=h:s=[18,h-513,8];break;case 1024>=h:s=[19,h-769,8];break;case 1536>=h:s=[20,h-1025,9];break;case 2048>=h:s=[21,h-1537,9];break;case 3072>=h:s=[22,h-2049,10];break;case 4096>=h:s=[23,h-3073,10];break;case 6144>=h:s=[24,h-4097,11];break;case 8192>=h:s=[25,h-6145,11];break;case 12288>=h:s=[26,h-8193,12];break;case 16384>=h:s=[27,h-12289,12];break;case 24576>=h:s=[28,h-16385,13];break;case 32768>=h:s=[29,h-24577,13];break;default:t("invalid distance")}for(i=s,c[f++]=i[0],c[f++]=i[1],c[f++]=i[2],a=0,o=c.length;a<o;++a)m[b++]=c[a];A[c[0]]++,v[c[3]]++,w=e.length+n-1,d=null}var o,h,c,f,l,u,g,d,p,y={},m=s?new Uint16Array(2*i.length):[],b=0,w=0,A=new(s?Uint32Array:Array)(286),v=new(s?Uint32Array:Array)(30),E=n.w;if(!s){for(c=0;285>=c;)A[c++]=0;for(c=0;29>=c;)v[c++]=0}for(A[256]=1,o=0,h=i.length;o<h;++o){for(c=l=0,f=3;c<f&&o+c!==h;++c)l=l<<8|i[o+c];if(y[l]===e&&(y[l]=[]),u=y[l],!(0<w--)){for(;0<u.length&&32768<o-u[0];)u.shift();if(o+3>=h){for(d&&a(d,-1),c=0,f=h-o;c<f;++c)p=i[o+c],m[b++]=p,++A[p];break}0<u.length?(g=x(i,o,u),d?d.length<g.length?(p=i[o-1],m[b++]=p,++A[p],a(g,0)):a(d,-1):g.length<E?d=g:a(g,0)):d?a(d,-1):(p=i[o],m[b++]=p,++A[p])}u.push(o)}return m[b++]=256,A[256]++,n.L=A,n.K=v,s?m.subarray(0,b):m}function x(t,e,r){var n,i,s,a,o,h,c=0,f=t.length;a=0,h=r.length;t:for(;a<h;a++){if(n=r[h-a-1],s=3,3<c){for(o=c;3<o;o--)if(t[n+o-1]!==t[e+o-1])continue t;s=c}for(;258>s&&e+s<f&&t[n+s]===t[e+s];)++s;if(s>c&&(i=n,c=s),258===s)break}return new A(c,e-i)}function T(t,e){var r,n,i,a,o,h=t.length,c=new g(572),f=new(s?Uint8Array:Array)(h);if(!s)for(a=0;a<h;a++)f[a]=0;for(a=0;a<h;++a)0<t[a]&&c.push(a,t[a]);if(r=Array(c.length/2),n=new(s?Uint32Array:Array)(c.length/2),1===r.length)return f[c.pop().index]=1,f;for(a=0,o=c.length/2;a<o;++a)r[a]=c.pop(),n[a]=r[a].value;for(i=function(t,e,r){function n(t){var r=d[t][p[t]];r===e?(n(t+1),n(t+1)):--u[r],++p[t]}var i,a,o,h,c,f=new(s?Uint16Array:Array)(r),l=new(s?Uint8Array:Array)(r),u=new(s?Uint8Array:Array)(e),g=Array(r),d=Array(r),p=Array(r),y=(1<<r)-e,m=1<<r-1;for(f[r-1]=e,a=0;a<r;++a)y<m?l[a]=0:(l[a]=1,y-=m),y<<=1,f[r-2-a]=(f[r-1-a]/2|0)+e;for(f[0]=l[0],g[0]=Array(f[0]),d[0]=Array(f[0]),a=1;a<r;++a)f[a]>2*f[a-1]+l[a]&&(f[a]=2*f[a-1]+l[a]),g[a]=Array(f[a]),d[a]=Array(f[a]);for(i=0;i<e;++i)u[i]=r;for(o=0;o<f[r-1];++o)g[r-1][o]=t[o],d[r-1][o]=o;for(i=0;i<r;++i)p[i]=0;for(1===l[r-1]&&(--u[0],++p[r-1]),a=r-2;0<=a;--a){for(h=i=0,c=p[a+1],o=0;o<f[a];o++)(h=g[a+1][c]+g[a+1][c+1])>t[i]?(g[a][o]=h,d[a][o]=e,c+=2):(g[a][o]=t[i],d[a][o]=i,++i);p[a]=0,1===l[a]&&n(a)}return u}(n,n.length,e),a=0,o=r.length;a<o;++a)f[r[a].index]=i[a];return f}function U(t){var e,r,n,i,a=new(s?Uint16Array:Array)(t.length),o=[],h=[],c=0;for(e=0,r=t.length;e<r;e++)o[t[e]]=1+(0|o[t[e]]);for(e=1,r=16;e<=r;e++)h[e]=c,c+=0|o[e],c<<=1;for(e=0,r=t.length;e<r;e++)for(c=h[t[e]],h[t[e]]+=1,n=a[e]=0,i=t[e];n<i;n++)a[e]=a[e]<<1|1&c,c>>>=1;return a}function M(e,r){switch(this.l=[],this.m=32768,this.e=this.g=this.c=this.q=0,this.input=s?new Uint8Array(e):e,this.s=!1,this.n=S,this.B=!1,!r&&(r={})||(r.index&&(this.c=r.index),r.bufferSize&&(this.m=r.bufferSize),r.bufferType&&(this.n=r.bufferType),r.resize&&(this.B=r.resize)),this.n){case I:this.b=32768,this.a=new(s?Uint8Array:Array)(32768+this.m+258);break;case S:this.b=0,this.a=new(s?Uint8Array:Array)(this.m),this.f=this.J,this.t=this.H,this.o=this.I;break;default:t(Error("invalid inflate mode"))}}var I=0,S=1,D={D:I,C:S};M.prototype.p=function(){for(;!this.s;){var n=$(this,3);switch(1&n&&(this.s=r),n>>>=1){case 0:var i=this.input,a=this.c,o=this.a,h=this.b,c=i.length,f=e,l=o.length,u=e;switch(this.e=this.g=0,a+1>=c&&t(Error("invalid uncompressed block header: LEN")),f=i[a++]|i[a++]<<8,a+1>=c&&t(Error("invalid uncompressed block header: NLEN")),f===~(i[a++]|i[a++]<<8)&&t(Error("invalid uncompressed block header: length verify")),a+f>i.length&&t(Error("input buffer is broken")),this.n){case I:for(;h+f>o.length;){if(f-=u=l-h,s)o.set(i.subarray(a,a+u),h),h+=u,a+=u;else for(;u--;)o[h++]=i[a++];this.b=h,o=this.f(),h=this.b}break;case S:for(;h+f>o.length;)o=this.f({v:2});break;default:t(Error("invalid inflate mode"))}if(s)o.set(i.subarray(a,a+f),h),h+=f,a+=f;else for(;f--;)o[h++]=i[a++];this.c=a,this.b=h,this.a=o;break;case 1:this.o(V,G);break;case 2:var g,p,y,m,b=$(this,5)+257,w=$(this,5)+1,A=$(this,4)+4,v=new(s?Uint8Array:Array)(N.length),k=e,E=e,x=e,T=e,U=e;for(U=0;U<A;++U)v[N[U]]=$(this,3);if(!s)for(U=A,A=v.length;U<A;++U)v[N[U]]=0;for(g=d(v),k=new(s?Uint8Array:Array)(b+w),U=0,m=b+w;U<m;)switch(E=J(this,g),E){case 16:for(T=3+$(this,2);T--;)k[U++]=x;break;case 17:for(T=3+$(this,3);T--;)k[U++]=0;x=0;break;case 18:for(T=11+$(this,7);T--;)k[U++]=0;x=0;break;default:x=k[U++]=E}p=d(s?k.subarray(0,b):k.slice(0,b)),y=d(s?k.subarray(b):k.slice(b)),this.o(p,y);break;default:t(Error("unknown BTYPE: "+n))}}return this.t()};var F,B,z=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],N=s?new Uint16Array(z):z,_=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258],C=s?new Uint16Array(_):_,O=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],R=s?new Uint8Array(O):O,P=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],j=s?new Uint16Array(P):P,q=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],L=s?new Uint8Array(q):q,H=new(s?Uint8Array:Array)(288);for(F=0,B=H.length;F<B;++F)H[F]=143>=F?8:255>=F?9:279>=F?7:8;var Y,W,V=d(H),Z=new(s?Uint8Array:Array)(30);for(Y=0,W=Z.length;Y<W;++Y)Z[Y]=5;var G=d(Z);function $(e,r){for(var n,i=e.g,s=e.e,a=e.input,o=e.c,h=a.length;s<r;)o>=h&&t(Error("input buffer is broken")),i|=a[o++]<<s,s+=8;return n=i&(1<<r)-1,e.g=i>>>r,e.e=s-r,e.c=o,n}function J(e,r){for(var n,i,s=e.g,a=e.e,o=e.input,h=e.c,c=o.length,f=r[0],l=r[1];a<l&&!(h>=c);)s|=o[h++]<<a,a+=8;return(i=(n=f[s&(1<<l)-1])>>>16)>a&&t(Error("invalid code length: "+i)),e.g=s>>i,e.e=a-i,e.c=h,65535&n}function K(t){if("string"==typeof t){var e,r,n=t.split("");for(e=0,r=n.length;e<r;e++)n[e]=(255&n[e].charCodeAt(0))>>>0;t=n}for(var i,s=1,a=0,o=t.length,h=0;0<o;){o-=i=1024<o?1024:o;do{a+=s+=t[h++]}while(--i);s%=65521,a%=65521}return(a<<16|s)>>>0}function X(e,r){var n,i;if(this.input=e,this.c=0,!r&&(r={})||(r.index&&(this.c=r.index),r.verify&&(this.M=r.verify)),n=e[this.c++],i=e[this.c++],(15&n)===Q)this.method=Q;else t(Error("unsupported compression method"));0!=((n<<8)+i)%31&&t(Error("invalid fcheck flag:"+((n<<8)+i)%31)),32&i&&t(Error("fdict flag is not supported")),this.A=new M(e,{index:this.c,bufferSize:r.bufferSize,bufferType:r.bufferType,resize:r.resize})}M.prototype.o=function(t,e){var r=this.a,n=this.b;this.u=t;for(var i,s,a,o,h=r.length-258;256!==(i=J(this,t));)if(256>i)n>=h&&(this.b=n,r=this.f(),n=this.b),r[n++]=i;else for(o=C[s=i-257],0<R[s]&&(o+=$(this,R[s])),i=J(this,e),a=j[i],0<L[i]&&(a+=$(this,L[i])),n>=h&&(this.b=n,r=this.f(),n=this.b);o--;)r[n]=r[n++-a];for(;8<=this.e;)this.e-=8,this.c--;this.b=n},M.prototype.I=function(t,e){var r=this.a,n=this.b;this.u=t;for(var i,s,a,o,h=r.length;256!==(i=J(this,t));)if(256>i)n>=h&&(h=(r=this.f()).length),r[n++]=i;else for(o=C[s=i-257],0<R[s]&&(o+=$(this,R[s])),i=J(this,e),a=j[i],0<L[i]&&(a+=$(this,L[i])),n+o>h&&(h=(r=this.f()).length);o--;)r[n]=r[n++-a];for(;8<=this.e;)this.e-=8,this.c--;this.b=n},M.prototype.f=function(){var t,e,r=new(s?Uint8Array:Array)(this.b-32768),n=this.b-32768,i=this.a;if(s)r.set(i.subarray(32768,r.length));else for(t=0,e=r.length;t<e;++t)r[t]=i[t+32768];if(this.l.push(r),this.q+=r.length,s)i.set(i.subarray(n,n+32768));else for(t=0;32768>t;++t)i[t]=i[n+t];return this.b=32768,i},M.prototype.J=function(t){var e,r,n,i=this.input.length/this.c+1|0,a=this.input,o=this.a;return t&&("number"==typeof t.v&&(i=t.v),"number"==typeof t.F&&(i+=t.F)),2>i?r=(n=(a.length-this.c)/this.u[2]/2*258|0)<o.length?o.length+n:o.length<<1:r=o.length*i,s?(e=new Uint8Array(r)).set(o):e=o,this.a=e},M.prototype.t=function(){var t,e,r,n,i,a=0,o=this.a,h=this.l,c=new(s?Uint8Array:Array)(this.q+(this.b-32768));if(0===h.length)return s?this.a.subarray(32768,this.b):this.a.slice(32768,this.b);for(e=0,r=h.length;e<r;++e)for(n=0,i=(t=h[e]).length;n<i;++n)c[a++]=t[n];for(e=32768,r=this.b;e<r;++e)c[a++]=o[e];return this.l=[],this.buffer=c},M.prototype.H=function(){var t,e=this.b;return s?this.B?(t=new Uint8Array(e)).set(this.a.subarray(0,e)):t=this.a.subarray(0,e):(this.a.length>e&&(this.a.length=e),t=this.a),this.buffer=t},X.prototype.p=function(){var e,r=this.input;return e=this.A.p(),this.c=this.A.c,this.M&&((r[this.c++]<<24|r[this.c++]<<16|r[this.c++]<<8|r[this.c++])>>>0!==K(e)&&t(Error("invalid adler-32 checksum"))),e};var Q=8;function tt(t,e){this.input=t,this.a=new(s?Uint8Array:Array)(32768),this.h=et.k;var r,n={};for(r in!e&&(e={})||"number"!=typeof e.compressionType||(this.h=e.compressionType),e)n[r]=e[r];n.outputBuffer=this.a,this.z=new p(this.input,n)}var et=b;function rt(t,e){var r,n,s,a;if(Object.keys)r=Object.keys(e);else for(n in r=[],s=0,e)r[s++]=n;for(s=0,a=r.length;s<a;++s)i(t+"."+(n=r[s]),e[n])}tt.prototype.j=function(){var e,r,n,i,a,o,h,c=0;if(h=this.a,(e=Q)===Q)r=Math.LOG2E*Math.log(32768)-8;else t(Error("invalid compression method"));if(n=r<<4|e,h[c++]=n,e===Q)switch(this.h){case et.NONE:a=0;break;case et.r:a=1;break;case et.k:a=2;break;default:t(Error("unsupported compression type"))}else t(Error("invalid compression method"));return i=a<<6,h[c++]=i|31-(256*n+i)%31,o=K(this.input),this.z.b=c,c=(h=this.z.j()).length,s&&((h=new Uint8Array(h.buffer)).length<=c+4&&(this.a=new Uint8Array(h.length+4),this.a.set(h),h=this.a),h=h.subarray(0,c+4)),h[c++]=o>>24&255,h[c++]=o>>16&255,h[c++]=o>>8&255,h[c++]=255&o,h},i("Zlib.Inflate",X),i("Zlib.Inflate.prototype.decompress",X.prototype.p),rt("Zlib.Inflate.BufferType",{ADAPTIVE:D.C,BLOCK:D.D}),i("Zlib.Deflate",tt),i("Zlib.Deflate.compress",(function(t,e){return new tt(t,e).j()})),i("Zlib.Deflate.prototype.compress",tt.prototype.j),rt("Zlib.Deflate.CompressionType",{NONE:et.NONE,FIXED:et.r,DYNAMIC:et.k})}.call(self);var c="undefined"!=typeof Float32Array?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var f,l=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t};function u(t,e,r){return t[0]=e,t[1]=r,t}f=new c(3),c!=Float32Array&&(f[0]=0,f[1]=0,f[2]=0),function(){var t=function(){var t=new c(2);return c!=Float32Array&&(t[0]=0,t[1]=0),t}()}();class g{constructor(t=257){this.gridSize=t;const e=t-1;if(e&e-1)throw new Error(\`Expected grid size to be 2^n+1, got ${e}t}.\`);this.numTriangles=e*e*2-2,this.numParentTriangles=this.numTriangles-e*e,this.indices=new Uint32Array(this.gridSize*this.gridSize),this.coords=new Uint16Array(4*this.numTriangles);for(let t=0;t<this.numTriangles;t++){let r=t+2,n=0,i=0,s=0,a=0,o=0,h=0;for(1&r?s=a=o=e:n=i=h=e;(r>>=1)>1;){const t=n+s>>1,e=i+a>>1;1&r?(s=n,a=i,n=o,i=h):(n=s,i=a,s=o,a=h),o=t,h=e}const c=4*t;this.coords[c+0]=n,this.coords[c+1]=i,this.coords[c+2]=s,this.coords[c+3]=a}}createTile(t){return new d(t,this)}}class d{constructor(t,e){const r=e.gridSize;if(t.length!==r*r)throw new Error(\`Expected terrain data of length ${e}r*r} (${e}r} x ${e}r}), got ${e}t.length}.\`);this.terrain=t,this.martini=e,this.errors=new Float32Array(t.length),this.update()}update(){const{numTriangles:t,numParentTriangles:e,coords:r,gridSize:n}=this.martini,{terrain:i,errors:s}=this;for(let a=t-1;a>=0;a--){const t=4*a,o=r[t+0],h=r[t+1],c=r[t+2],f=r[t+3],l=o+c>>1,u=h+f>>1,g=l+u-h,d=u+o-l,p=(i[h*n+o]+i[f*n+c])/2,y=u*n+l,m=Math.abs(p-i[y]);if(s[y]=Math.max(s[y],m),a<e){const t=(h+d>>1)*n+(o+g>>1),e=(f+d>>1)*n+(c+g>>1);s[y]=Math.max(s[y],s[t],s[e])}}}getMesh(t=0){const{gridSize:e,indices:r}=this.martini,{errors:n}=this;let i=0,s=0;const a=e-1;function o(a,h,c,f,l,u){const g=a+c>>1,d=h+f>>1;Math.abs(a-l)+Math.abs(h-u)>1&&n[d*e+g]>t?(o(l,u,a,h,g,d),o(c,f,l,u,g,d)):(r[h*e+a]=r[h*e+a]||++i,r[f*e+c]=r[f*e+c]||++i,r[u*e+l]=r[u*e+l]||++i,s++)}r.fill(0),o(0,0,a,a,a,0),o(a,a,0,0,0,a);const h=new Uint16Array(2*i),c=new Uint32Array(3*s);let f=0;function l(i,s,a,o,u,g){const d=i+a>>1,p=s+o>>1;if(Math.abs(i-u)+Math.abs(s-g)>1&&n[p*e+d]>t)l(u,g,i,s,d,p),l(a,o,u,g,d,p);else{const t=r[s*e+i]-1,n=r[o*e+a]-1,l=r[g*e+u]-1;h[2*t]=i,h[2*t+1]=s,h[2*n]=a,h[2*n+1]=o,h[2*l]=u,h[2*l+1]=g,c[f++]=t,c[f++]=n,c[f++]=l}}return l(0,0,a,a,a,0),l(a,a,0,0,0,a),{vertices:h,triangles:c}}getMeshWithSkirts(t=0,e){const{gridSize:r,indices:n}=this.martini,{errors:i}=this;let s=0,a=0;const o=r-1;let h,c,f=0;const l=[],u=[],g=[],d=[];function p(e,y,m,b,w,A){const v=e+m>>1,k=y+b>>1;Math.abs(e-w)+Math.abs(y-A)>1&&i[k*r+v]>t?(p(w,A,e,y,v,k),p(m,b,w,A,v,k)):(h=y*r+e,c=b*r+m,f=A*r+w,0===n[h]&&(0===e?l.push(s):e===o&&u.push(s),0===y?g.push(s):y===o&&d.push(s),n[h]=++s),0===n[c]&&(0===m?l.push(s):m===o&&u.push(s),0===b?g.push(s):b===o&&d.push(s),n[c]=++s),0===n[f]&&(0===w?l.push(s):w===o&&u.push(s),0===A?g.push(s):A===o&&d.push(s),n[f]=++s),a++)}let y;n.fill(0),p(0,0,o,o,o,0),p(o,o,0,0,0,o),y=e?2*(s+3*l.length-2+3*u.length-2+3*g.length-2+3*d.length-2):2*(s+l.length+u.length+g.length+d.length);const m=3*(a+2*(l.length-1)+2*(u.length-1)+2*(g.length-1)+2*(d.length-1)),b=new Uint16Array(y),w=new Uint32Array(m);let A=0;function v(e,s,a,o,h,c){const f=e+a>>1,l=s+o>>1;if(Math.abs(e-h)+Math.abs(s-c)>1&&i[l*r+f]>t)v(h,c,e,s,f,l),v(a,o,h,c,f,l);else{const t=n[s*r+e]-1,i=n[o*r+a]-1,f=n[c*r+h]-1;b[2*t]=e,b[2*t+1]=s,b[2*i]=a,b[2*i+1]=o,b[2*f]=h,b[2*f+1]=c,w[A++]=t,w[A++]=i,w[A++]=f}}v(0,0,o,o,o,0),v(o,o,0,0,0,o),l.sort(((t,e)=>b[2*t+1]-b[2*e+1])),u.sort(((t,e)=>b[2*e+1]-b[2*t+1])),g.sort(((t,e)=>b[2*e]-b[2*t])),d.sort(((t,e)=>b[2*t]-b[2*e]));let k,E,x,T,U=2*s,M=0;function I(t){M=t.length;for(let r=0;r<M-1;r++)k=t[r],E=t[r+1],x=U/2,T=(U+(e?6:2))/2,b[U++]=2*k,b[U++]=2*k+1,e&&(b[U++]=2*k,b[U++]=2*k+1,b[U++]=2*E,b[U++]=2*E+1),e?(w[A++]=x+1,w[A++]=x,w[A++]=x+2,w[A++]=x,w[A++]=T,w[A++]=x+2):(w[A++]=k,w[A++]=x,w[A++]=E,w[A++]=x,w[A++]=T,w[A++]=E);b[U++]=2*t[M-1],b[U++]=2*t[M-1]+1}I(l);const S=U;I(u);const D=U;I(g);const F=U;I(d);return{vertices:b,triangles:w,numVerticesWithoutSkirts:s,numTrianglesWithoutSkirts:a,leftSkirtIndex:S,rightSkirtIndex:D,bottomSkirtIndex:F,topSkirtIndex:U}}}const p={};let y;const m={width:100,height:10};let b=!1;try{const t=new OffscreenCanvas(1,1);t.getContext("2d").fillText("hello",0,0),b=!0}catch(t){b=!1}function w(){if(!y){const{width:t,height:e}=m;b?y=new OffscreenCanvas(t,e):(y=document.createElement("canvas"),y.width=t,y.height=e)}return y}class A{constructor(t,e={}){if(!Array.isArray(t))return void console.error("colors is not array");if(t.length<2)return void console.error("colors.length should >1");this.colors=t;let r=1/0,n=-1/0;for(let e=0,i=t.length;e<i;e++){const i=t[e][0];r=Math.min(i,r),n=Math.max(i,n)}this.min=r,this.max=n,this.valueOffset=this.max-this.min,this.options=Object.assign({},m,e),this._initImgData()}getImageData(){return this.imgData}_initImgData(){const t=w(),{width:e,height:r}=this.options;t.width=e,t.height=r;const n=t.getContext("2d");n.clearRect(0,0,t.width,t.height);const i=n.createLinearGradient(0,0,t.width,0),{colors:s,valueOffset:a}=this;for(let t=0,e=s.length;t<e;t++){const[e,r]=s[t],n=(e-this.min)/a;i.addColorStop(n,r)}n.fillStyle=i,n.fillRect(0,0,t.width,t.height),this.imgData=n.getImageData(0,0,t.width,t.height)}getColor(t){t=Math.max(this.min,t);const e=((t=Math.min(t,this.max))-this.min)/this.valueOffset;let r=Math.round(e*this.imgData.width);r=Math.min(r,this.imgData.width-1);const n=4*r;return[this.imgData.data[n],this.imgData.data[n+1],this.imgData.data[n+2],this.imgData.data[n+3]]}}var v="undefined"!=typeof Float32Array?Float32Array:Array;function k(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function E(t,e,r,n){return t[0]=e,t[1]=r,t[2]=n,t}function x(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t}function T(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}var U=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t};
|
|
@@ -26477,7 +26477,7 @@ function M(t,e,r,n,i){const s=t.length/3,a=new Array(4*s),o=[],h=[];for(let t=0;
|
|
|
26477
26477
|
exports.vec3 = u$1;
|
|
26478
26478
|
exports.vec4 = f;
|
|
26479
26479
|
|
|
26480
|
-
typeof console !== 'undefined' && console.log('@maptalks/gpu v0.
|
|
26480
|
+
typeof console !== 'undefined' && console.log('@maptalks/gpu v0.119.0');
|
|
26481
26481
|
|
|
26482
26482
|
}));
|
|
26483
26483
|
//# sourceMappingURL=maptalksgpu.js.map
|