@loaders.gl/terrain
Advanced tools
Comparing version 3.0.0-alpha.14 to 3.0.0-alpha.15
@@ -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 n=t();for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([,function(e,t,n){(function(t){const r=n(3),i="undefined"==typeof window?t:window;i.loaders=i.loaders||{},e.exports=Object.assign(i.loaders,r)}).call(this,n(2))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";n.r(t),n.d(t,"TerrainLoader",(function(){return c})),n.d(t,"TerrainWorkerLoader",(function(){return s})),n.d(t,"QuantizedMeshLoader",(function(){return m})),n.d(t,"QuantizedMeshWorkerLoader",(function(){return S}));class r{constructor(e=257){this.gridSize=e;const t=e-1;if(t&t-1)throw new Error(`Expected grid size to be 2^n+1, got ${e}.`);this.numTriangles=t*t*2-2,this.numParentTriangles=this.numTriangles-t*t,this.indices=new Uint32Array(this.gridSize*this.gridSize),this.coords=new Uint16Array(4*this.numTriangles);for(let e=0;e<this.numTriangles;e++){let n=e+2,r=0,i=0,o=0,a=0,s=0,c=0;for(1&n?o=a=s=t:r=i=c=t;(n>>=1)>1;){const e=r+o>>1,t=i+a>>1;1&n?(o=r,a=i,r=s,i=c):(r=o,i=a,o=s,a=c),s=e,c=t}const u=4*e;this.coords[u+0]=r,this.coords[u+1]=i,this.coords[u+2]=o,this.coords[u+3]=a}}createTile(e){return new i(e,this)}}class i{constructor(e,t){const n=t.gridSize;if(e.length!==n*n)throw new Error(`Expected terrain data of length ${n*n} (${n} x ${n}), got ${e.length}.`);this.terrain=e,this.martini=t,this.errors=new Float32Array(e.length),this.update()}update(){const{numTriangles:e,numParentTriangles:t,coords:n,gridSize:r}=this.martini,{terrain:i,errors:o}=this;for(let a=e-1;a>=0;a--){const e=4*a,s=n[e+0],c=n[e+1],u=n[e+2],l=n[e+3],d=s+u>>1,E=c+l>>1,f=d+E-c,h=E+s-d,g=(i[c*r+s]+i[l*r+u])/2,T=E*r+d,y=Math.abs(g-i[T]);if(o[T]=Math.max(o[T],y),a<t){const e=(c+h>>1)*r+(s+f>>1),t=(l+h>>1)*r+(u+f>>1);o[T]=Math.max(o[T],o[e],o[t])}}}getMesh(e=0){const{gridSize:t,indices:n}=this.martini,{errors:r}=this;let i=0,o=0;const a=t-1;function s(a,c,u,l,d,E){const f=a+u>>1,h=c+l>>1;Math.abs(a-d)+Math.abs(c-E)>1&&r[h*t+f]>e?(s(d,E,a,c,f,h),s(u,l,d,E,f,h)):(n[c*t+a]=n[c*t+a]||++i,n[l*t+u]=n[l*t+u]||++i,n[E*t+d]=n[E*t+d]||++i,o++)}n.fill(0),s(0,0,a,a,a,0),s(a,a,0,0,0,a);const c=new Uint16Array(2*i),u=new Uint32Array(3*o);let l=0;function d(i,o,a,s,E,f){const h=i+a>>1,g=o+s>>1;if(Math.abs(i-E)+Math.abs(o-f)>1&&r[g*t+h]>e)d(E,f,i,o,h,g),d(a,s,E,f,h,g);else{const e=n[o*t+i]-1,r=n[s*t+a]-1,d=n[f*t+E]-1;c[2*e]=i,c[2*e+1]=o,c[2*r]=a,c[2*r+1]=s,c[2*d]=E,c[2*d+1]=f,u[l++]=e,u[l++]=r,u[l++]=d}}return d(0,0,a,a,a,0),d(a,a,0,0,0,a),{vertices:c,triangles:u}}}function o(e){if(!e||!e.POSITION)return null;let t=1/0,n=1/0,r=1/0,i=-1/0,o=-1/0,a=-1/0;const s=e.POSITION.value,c=s&&s.length;if(!c)return null;for(let e=0;e<c;e+=3){const c=s[e],u=s[e+1],l=s[e+2];t=c<t?c:t,n=u<n?u:n,r=l<r?l:r,i=c>i?c:i,o=u>o?u:o,a=l>a?l:a}return[[t,n,r],[i,o,a]]}function a(e,t){if(null===e)return null;const{meshMaxError:n,bounds:i,elevationDecoder:a}=t,s=e.data,c=e.width,u=c+1,l=function(e,t,n){const{rScaler:r,bScaler:i,gScaler:o,offset:a}=n,s=t+1,c=new Float32Array(s*s);for(let n=0,s=0;s<t;s++)for(let u=0;u<t;u++,n++){const t=4*n,u=e[t+0],l=e[t+1],d=e[t+2];c[n+s]=u*r+l*o+d*i+a}for(let e=s*(s-1),t=0;t<s-1;t++,e++)c[e]=c[e-s];for(let e=s-1,t=0;t<s;t++,e+=s)c[e]=c[e-1];return c}(s,c,a),d=new r(u).createTile(l),{vertices:E,triangles:f}=d.getMesh(n),h=function(e,t,n,r){const i=n+1,o=e.length/2,a=new Float32Array(3*o),s=new Float32Array(2*o),[c,u,l,d]=r||[0,0,n,n],E=(l-c)/n,f=(d-u)/n;for(let r=0;r<o;r++){const o=e[2*r],u=e[2*r+1],l=u*i+o;a[3*r+0]=o*E+c,a[3*r+1]=-u*f+d,a[3*r+2]=t[l],s[2*r+0]=o/n,s[2*r+1]=u/n}return{POSITION:{value:a,size:3},TEXCOORD_0:{value:s,size:2}}}(E,l,c,i);return{loaderData:{header:{}},header:{vertexCount:f.length,boundingBox:o(h)},mode:4,indices:{value:f,size:1},attributes:h}}const s={name:"Terrain",id:"terrain",module:"terrain",version:"3.0.0-alpha.14",worker:!0,extensions:["png","pngraw"],mimeTypes:["image/png"],options:{terrain:{bounds:null,meshMaxError:10,elevationDecoder:{rScaler:1,gScaler:0,bScaler:0,offset:0}}}},c={...s,parse:async function(e,t,n){return t.image=t.image||{},t.image.type="data",a(await n.parse(e,t,t.baseUri),t.terrain)}},u=new Map([["centerX",Float64Array.BYTES_PER_ELEMENT],["centerY",Float64Array.BYTES_PER_ELEMENT],["centerZ",Float64Array.BYTES_PER_ELEMENT],["minHeight",Float32Array.BYTES_PER_ELEMENT],["maxHeight",Float32Array.BYTES_PER_ELEMENT],["boundingSphereCenterX",Float64Array.BYTES_PER_ELEMENT],["boundingSphereCenterY",Float64Array.BYTES_PER_ELEMENT],["boundingSphereCenterZ",Float64Array.BYTES_PER_ELEMENT],["boundingSphereRadius",Float64Array.BYTES_PER_ELEMENT],["horizonOcclusionPointX",Float64Array.BYTES_PER_ELEMENT],["horizonOcclusionPointY",Float64Array.BYTES_PER_ELEMENT],["horizonOcclusionPointZ",Float64Array.BYTES_PER_ELEMENT]]);function l(e){return e>>1^-(1&e)}function d(e,t,n,r,i=!0){let o;if(o=2===r?new Uint16Array(e,t,n):new Uint32Array(e,t,n),!i)return o;let a=0;for(let e=0;e<o.length;++e){const t=o[e];o[e]=a-t,0===t&&++a}return o}function E(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}const f=1,h=2,g=3,T=4,y={maxDecodingStep:T};function p(e,t){const n=Object.assign({},y,t),r=new DataView(e),{header:i,headerEndPosition:o}=function(e){let t=0;const n={};for(const[r,i]of u){const o=8===i?e.getFloat64:e.getFloat32;n[r]=o.call(e,t,!0),t+=i}return{header:n,headerEndPosition:t}}(r);if(n.maxDecodingStep<f)return{header:i};const{vertexData:a,vertexDataEndPosition:s}=function(e,t){let n=t;const r=e.getUint32(n,!0),i=new Uint16Array(3*r);n+=Uint32Array.BYTES_PER_ELEMENT;const o=Uint16Array.BYTES_PER_ELEMENT,a=r*o,s=n,c=s+a,u=c+a;let d=0,E=0,f=0;for(let t=0;t<r;t++)d+=l(e.getUint16(s+o*t,!0)),E+=l(e.getUint16(c+o*t,!0)),f+=l(e.getUint16(u+o*t,!0)),i[t]=d,i[t+r]=E,i[t+2*r]=f;return n+=3*a,{vertexData:i,vertexDataEndPosition:n}}(r,o);if(n.maxDecodingStep<h)return{header:i,vertexData:a};const{triangleIndices:c,triangleIndicesEndPosition:p}=function(e,t,n){let r=n;const i=t.length/3>65536?Uint32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT;r%i!=0&&(r+=i-r%i);const o=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;const a=3*o,s=d(e.buffer,r,a,i);return r+=a*i,{triangleIndicesEndPosition:r,triangleIndices:s}}(r,a,s);if(n.maxDecodingStep<g)return{header:i,vertexData:a,triangleIndices:c};const{westIndices:_,southIndices:b,eastIndices:S,northIndices:m,edgeIndicesEndPosition:P}=function(e,t,n){let r=n;const i=t.length/3>65536?Uint32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT,o=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;const a=d(e.buffer,r,o,i,!1);r+=o*i;const s=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;const c=d(e.buffer,r,s,i,!1);r+=s*i;const u=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;const l=d(e.buffer,r,u,i,!1);r+=u*i;const E=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;const f=d(e.buffer,r,E,i,!1);return r+=E*i,{edgeIndicesEndPosition:r,westIndices:a,southIndices:c,eastIndices:l,northIndices:f}}(r,a,p);if(n.maxDecodingStep<T)return{header:i,vertexData:a,triangleIndices:c,westIndices:_,northIndices:m,eastIndices:S,southIndices:b};const{extensions:w}=function(e,t){const n={};if(e.byteLength<=t)return{extensions:n,extensionsEndPosition:t};let r=t;for(;r<e.byteLength;){const t=e.getUint8(r,!0);r+=Uint8Array.BYTES_PER_ELEMENT;const o=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;const a=new DataView(e.buffer,r,o);switch(t){case 1:n.vertexNormals=(i=a,new Uint8Array(i.buffer,i.byteOffset,i.byteLength));break;case 2:n.waterMask=E(a)}r+=o}var i;return{extensions:n,extensionsEndPosition:r}}(r,P);return{header:i,vertexData:a,triangleIndices:c,westIndices:_,northIndices:m,eastIndices:S,southIndices:b,extensions:w}}function _(e,t){if(!e)return null;const{bounds:n}=t,{header:r,vertexData:i,triangleIndices:a}=p(e,h),s=function(e,t,n){const{minHeight:r,maxHeight:i}=t,[o,a,s,c]=n||[0,0,1,1],u=s-o,l=c-a,d=i-r,E=e.length/3,f=new Float32Array(3*E),h=new Float32Array(2*E);for(let t=0;t<E;t++){const n=e[t]/32767,i=e[t+E]/32767,s=e[t+2*E]/32767;f[3*t+0]=n*u+o,f[3*t+1]=i*l+a,f[3*t+2]=s*d+r,h[2*t+0]=n,h[2*t+1]=i}return{POSITION:{value:f,size:3},TEXCOORD_0:{value:h,size:2}}}(i,r,n);return{loaderData:{header:{}},header:{vertexCount:a.length,boundingBox:o(s)},mode:4,indices:{value:a,size:1},attributes:s}}function b(e,t){return _(e,t["quantized-mesh"])}const S={name:"Quantized Mesh",id:"quantized-mesh",module:"terrain",version:"3.0.0-alpha.14",worker:!0,extensions:["terrain"],mimeTypes:["application/vnd.quantized-mesh"],options:{"quantized-mesh":{bounds:[0,0,1,1]}}},m={...S,parseSync:b,parse:async(e,t)=>b(e,t)}}])})); | ||
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([,function(e,t,n){(function(t){const r=n(3),i="undefined"==typeof window?t:window;i.loaders=i.loaders||{},e.exports=Object.assign(i.loaders,r)}).call(this,n(2))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";n.r(t),n.d(t,"TerrainLoader",(function(){return c})),n.d(t,"TerrainWorkerLoader",(function(){return s})),n.d(t,"QuantizedMeshLoader",(function(){return m})),n.d(t,"QuantizedMeshWorkerLoader",(function(){return S}));class r{constructor(e=257){this.gridSize=e;const t=e-1;if(t&t-1)throw new Error(`Expected grid size to be 2^n+1, got ${e}.`);this.numTriangles=t*t*2-2,this.numParentTriangles=this.numTriangles-t*t,this.indices=new Uint32Array(this.gridSize*this.gridSize),this.coords=new Uint16Array(4*this.numTriangles);for(let e=0;e<this.numTriangles;e++){let n=e+2,r=0,i=0,o=0,a=0,s=0,c=0;for(1&n?o=a=s=t:r=i=c=t;(n>>=1)>1;){const e=r+o>>1,t=i+a>>1;1&n?(o=r,a=i,r=s,i=c):(r=o,i=a,o=s,a=c),s=e,c=t}const u=4*e;this.coords[u+0]=r,this.coords[u+1]=i,this.coords[u+2]=o,this.coords[u+3]=a}}createTile(e){return new i(e,this)}}class i{constructor(e,t){const n=t.gridSize;if(e.length!==n*n)throw new Error(`Expected terrain data of length ${n*n} (${n} x ${n}), got ${e.length}.`);this.terrain=e,this.martini=t,this.errors=new Float32Array(e.length),this.update()}update(){const{numTriangles:e,numParentTriangles:t,coords:n,gridSize:r}=this.martini,{terrain:i,errors:o}=this;for(let a=e-1;a>=0;a--){const e=4*a,s=n[e+0],c=n[e+1],u=n[e+2],l=n[e+3],d=s+u>>1,E=c+l>>1,f=d+E-c,h=E+s-d,g=(i[c*r+s]+i[l*r+u])/2,T=E*r+d,y=Math.abs(g-i[T]);if(o[T]=Math.max(o[T],y),a<t){const e=(c+h>>1)*r+(s+f>>1),t=(l+h>>1)*r+(u+f>>1);o[T]=Math.max(o[T],o[e],o[t])}}}getMesh(e=0){const{gridSize:t,indices:n}=this.martini,{errors:r}=this;let i=0,o=0;const a=t-1;function s(a,c,u,l,d,E){const f=a+u>>1,h=c+l>>1;Math.abs(a-d)+Math.abs(c-E)>1&&r[h*t+f]>e?(s(d,E,a,c,f,h),s(u,l,d,E,f,h)):(n[c*t+a]=n[c*t+a]||++i,n[l*t+u]=n[l*t+u]||++i,n[E*t+d]=n[E*t+d]||++i,o++)}n.fill(0),s(0,0,a,a,a,0),s(a,a,0,0,0,a);const c=new Uint16Array(2*i),u=new Uint32Array(3*o);let l=0;function d(i,o,a,s,E,f){const h=i+a>>1,g=o+s>>1;if(Math.abs(i-E)+Math.abs(o-f)>1&&r[g*t+h]>e)d(E,f,i,o,h,g),d(a,s,E,f,h,g);else{const e=n[o*t+i]-1,r=n[s*t+a]-1,d=n[f*t+E]-1;c[2*e]=i,c[2*e+1]=o,c[2*r]=a,c[2*r+1]=s,c[2*d]=E,c[2*d+1]=f,u[l++]=e,u[l++]=r,u[l++]=d}}return d(0,0,a,a,a,0),d(a,a,0,0,0,a),{vertices:c,triangles:u}}}function o(e){if(!e||!e.POSITION)return null;let t=1/0,n=1/0,r=1/0,i=-1/0,o=-1/0,a=-1/0;const s=e.POSITION.value,c=s&&s.length;if(!c)return null;for(let e=0;e<c;e+=3){const c=s[e],u=s[e+1],l=s[e+2];t=c<t?c:t,n=u<n?u:n,r=l<r?l:r,i=c>i?c:i,o=u>o?u:o,a=l>a?l:a}return[[t,n,r],[i,o,a]]}function a(e,t){if(null===e)return null;const{meshMaxError:n,bounds:i,elevationDecoder:a}=t,s=e.data,c=e.width,u=c+1,l=function(e,t,n){const{rScaler:r,bScaler:i,gScaler:o,offset:a}=n,s=t+1,c=new Float32Array(s*s);for(let n=0,s=0;s<t;s++)for(let u=0;u<t;u++,n++){const t=4*n,u=e[t+0],l=e[t+1],d=e[t+2];c[n+s]=u*r+l*o+d*i+a}for(let e=s*(s-1),t=0;t<s-1;t++,e++)c[e]=c[e-s];for(let e=s-1,t=0;t<s;t++,e+=s)c[e]=c[e-1];return c}(s,c,a),d=new r(u).createTile(l),{vertices:E,triangles:f}=d.getMesh(n),h=function(e,t,n,r){const i=n+1,o=e.length/2,a=new Float32Array(3*o),s=new Float32Array(2*o),[c,u,l,d]=r||[0,0,n,n],E=(l-c)/n,f=(d-u)/n;for(let r=0;r<o;r++){const o=e[2*r],u=e[2*r+1],l=u*i+o;a[3*r+0]=o*E+c,a[3*r+1]=-u*f+d,a[3*r+2]=t[l],s[2*r+0]=o/n,s[2*r+1]=u/n}return{POSITION:{value:a,size:3},TEXCOORD_0:{value:s,size:2}}}(E,l,c,i);return{loaderData:{header:{}},header:{vertexCount:f.length,boundingBox:o(h)},mode:4,indices:{value:f,size:1},attributes:h}}const s={name:"Terrain",id:"terrain",module:"terrain",version:"3.0.0-alpha.15",worker:!0,extensions:["png","pngraw"],mimeTypes:["image/png"],options:{terrain:{bounds:null,meshMaxError:10,elevationDecoder:{rScaler:1,gScaler:0,bScaler:0,offset:0}}}},c={...s,parse:async function(e,t,n){return t.image=t.image||{},t.image.type="data",a(await n.parse(e,t,t.baseUri),t.terrain)}},u=new Map([["centerX",Float64Array.BYTES_PER_ELEMENT],["centerY",Float64Array.BYTES_PER_ELEMENT],["centerZ",Float64Array.BYTES_PER_ELEMENT],["minHeight",Float32Array.BYTES_PER_ELEMENT],["maxHeight",Float32Array.BYTES_PER_ELEMENT],["boundingSphereCenterX",Float64Array.BYTES_PER_ELEMENT],["boundingSphereCenterY",Float64Array.BYTES_PER_ELEMENT],["boundingSphereCenterZ",Float64Array.BYTES_PER_ELEMENT],["boundingSphereRadius",Float64Array.BYTES_PER_ELEMENT],["horizonOcclusionPointX",Float64Array.BYTES_PER_ELEMENT],["horizonOcclusionPointY",Float64Array.BYTES_PER_ELEMENT],["horizonOcclusionPointZ",Float64Array.BYTES_PER_ELEMENT]]);function l(e){return e>>1^-(1&e)}function d(e,t,n,r,i=!0){let o;if(o=2===r?new Uint16Array(e,t,n):new Uint32Array(e,t,n),!i)return o;let a=0;for(let e=0;e<o.length;++e){const t=o[e];o[e]=a-t,0===t&&++a}return o}function E(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}const f=1,h=2,g=3,T=4,y={maxDecodingStep:T};function p(e,t){const n=Object.assign({},y,t),r=new DataView(e),{header:i,headerEndPosition:o}=function(e){let t=0;const n={};for(const[r,i]of u){const o=8===i?e.getFloat64:e.getFloat32;n[r]=o.call(e,t,!0),t+=i}return{header:n,headerEndPosition:t}}(r);if(n.maxDecodingStep<f)return{header:i};const{vertexData:a,vertexDataEndPosition:s}=function(e,t){let n=t;const r=e.getUint32(n,!0),i=new Uint16Array(3*r);n+=Uint32Array.BYTES_PER_ELEMENT;const o=Uint16Array.BYTES_PER_ELEMENT,a=r*o,s=n,c=s+a,u=c+a;let d=0,E=0,f=0;for(let t=0;t<r;t++)d+=l(e.getUint16(s+o*t,!0)),E+=l(e.getUint16(c+o*t,!0)),f+=l(e.getUint16(u+o*t,!0)),i[t]=d,i[t+r]=E,i[t+2*r]=f;return n+=3*a,{vertexData:i,vertexDataEndPosition:n}}(r,o);if(n.maxDecodingStep<h)return{header:i,vertexData:a};const{triangleIndices:c,triangleIndicesEndPosition:p}=function(e,t,n){let r=n;const i=t.length/3>65536?Uint32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT;r%i!=0&&(r+=i-r%i);const o=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;const a=3*o,s=d(e.buffer,r,a,i);return r+=a*i,{triangleIndicesEndPosition:r,triangleIndices:s}}(r,a,s);if(n.maxDecodingStep<g)return{header:i,vertexData:a,triangleIndices:c};const{westIndices:_,southIndices:b,eastIndices:S,northIndices:m,edgeIndicesEndPosition:P}=function(e,t,n){let r=n;const i=t.length/3>65536?Uint32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT,o=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;const a=d(e.buffer,r,o,i,!1);r+=o*i;const s=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;const c=d(e.buffer,r,s,i,!1);r+=s*i;const u=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;const l=d(e.buffer,r,u,i,!1);r+=u*i;const E=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;const f=d(e.buffer,r,E,i,!1);return r+=E*i,{edgeIndicesEndPosition:r,westIndices:a,southIndices:c,eastIndices:l,northIndices:f}}(r,a,p);if(n.maxDecodingStep<T)return{header:i,vertexData:a,triangleIndices:c,westIndices:_,northIndices:m,eastIndices:S,southIndices:b};const{extensions:w}=function(e,t){const n={};if(e.byteLength<=t)return{extensions:n,extensionsEndPosition:t};let r=t;for(;r<e.byteLength;){const t=e.getUint8(r,!0);r+=Uint8Array.BYTES_PER_ELEMENT;const o=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;const a=new DataView(e.buffer,r,o);switch(t){case 1:n.vertexNormals=(i=a,new Uint8Array(i.buffer,i.byteOffset,i.byteLength));break;case 2:n.waterMask=E(a)}r+=o}var i;return{extensions:n,extensionsEndPosition:r}}(r,P);return{header:i,vertexData:a,triangleIndices:c,westIndices:_,northIndices:m,eastIndices:S,southIndices:b,extensions:w}}function _(e,t){if(!e)return null;const{bounds:n}=t,{header:r,vertexData:i,triangleIndices:a}=p(e,h),s=function(e,t,n){const{minHeight:r,maxHeight:i}=t,[o,a,s,c]=n||[0,0,1,1],u=s-o,l=c-a,d=i-r,E=e.length/3,f=new Float32Array(3*E),h=new Float32Array(2*E);for(let t=0;t<E;t++){const n=e[t]/32767,i=e[t+E]/32767,s=e[t+2*E]/32767;f[3*t+0]=n*u+o,f[3*t+1]=i*l+a,f[3*t+2]=s*d+r,h[2*t+0]=n,h[2*t+1]=i}return{POSITION:{value:f,size:3},TEXCOORD_0:{value:h,size:2}}}(i,r,n);return{loaderData:{header:{}},header:{vertexCount:a.length,boundingBox:o(s)},mode:4,indices:{value:a,size:1},attributes:s}}function b(e,t){return _(e,t["quantized-mesh"])}const S={name:"Quantized Mesh",id:"quantized-mesh",module:"terrain",version:"3.0.0-alpha.15",worker:!0,extensions:["terrain"],mimeTypes:["application/vnd.quantized-mesh"],options:{"quantized-mesh":{bounds:[0,0,1,1]}}},m={...S,parseSync:b,parse:async(e,t)=>b(e,t)}}])})); |
@@ -7,4 +7,4 @@ "use strict"; | ||
exports.VERSION = void 0; | ||
var VERSION = typeof "3.0.0-alpha.14" !== 'undefined' ? "3.0.0-alpha.14" : 'latest'; | ||
var VERSION = typeof "3.0.0-alpha.15" !== 'undefined' ? "3.0.0-alpha.15" : 'latest'; | ||
exports.VERSION = VERSION; | ||
//# sourceMappingURL=version.js.map |
@@ -1,2 +0,2 @@ | ||
export var VERSION = typeof "3.0.0-alpha.14" !== 'undefined' ? "3.0.0-alpha.14" : 'latest'; | ||
export var VERSION = typeof "3.0.0-alpha.15" !== 'undefined' ? "3.0.0-alpha.15" : 'latest'; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@loaders.gl/terrain", | ||
"version": "3.0.0-alpha.14", | ||
"version": "3.0.0-alpha.15", | ||
"description": "Framework-independent loader for terrain raster formats", | ||
@@ -37,6 +37,6 @@ "license": "MIT", | ||
"@babel/runtime": "^7.3.1", | ||
"@loaders.gl/loader-utils": "3.0.0-alpha.14", | ||
"@loaders.gl/loader-utils": "3.0.0-alpha.15", | ||
"@mapbox/martini": "^0.2.0" | ||
}, | ||
"gitHead": "fe9717732559902e25911b6e575d14f731b1ce7d" | ||
"gitHead": "c4ad9755e5f58c995bf6e7f7eca0d34f0adbd0dd" | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
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
743585
+ Added@loaders.gl/loader-utils@3.0.0-alpha.15(transitive)
+ Added@loaders.gl/worker-utils@3.0.0-alpha.15(transitive)
- Removed@loaders.gl/loader-utils@3.0.0-alpha.14(transitive)
- Removed@loaders.gl/worker-utils@3.0.0-alpha.14(transitive)