@dp_unity/dpu-gis-viewer
Version:
DPU GIS Viewer version Beta
2 lines • 4.94 kB
JavaScript
/*! For license information please see createVectorTileGeometries.js.LICENSE.txt */
import{a as P}from"./chunk-JXLT7VPX.js";import{a as z}from"./chunk-ZFYLUAMF.js";import"./chunk-OTRIIEF3.js";import{a as H}from"./chunk-HQXG4R4L.js";import{a as Y}from"./chunk-4BYMTYMT.js";import{a as j}from"./chunk-ZHF7X3YD.js";import"./chunk-5CC3QRYS.js";import"./chunk-6HIVPZ7K.js";import{a as W}from"./chunk-34ULWVZF.js";import"./chunk-24JYWT5N.js";import"./chunk-LH3SUUXG.js";import{d as E}from"./chunk-K2M3OJ7Z.js";import{b as d}from"./chunk-M3A6SPGI.js";import"./chunk-D5HNP2LB.js";import{a as o}from"./chunk-S4VBGY2U.js";import"./chunk-UCTPWOTZ.js";import"./chunk-54PMPXZ4.js";import"./chunk-R62IKKEC.js";import"./chunk-N3A5CZ2S.js";import"./chunk-G75U3WZT.js";import{e as l}from"./chunk-3THTQ4QB.js";function X(e){this.offset=e.offset,this.count=e.count,this.color=e.color,this.batchIds=e.batchIds}var J=X,S=new o,$=d.packedLength+o.packedLength,ee=d.packedLength+2,ne=d.packedLength+o.packedLength,te=o.packedLength+1,u={modelMatrix:new d,boundingVolume:new E};function oe(e,t){let n=t*$,r=o.unpack(e,n,S);n+=o.packedLength;let i=d.unpack(e,n,u.modelMatrix);d.multiplyByScale(i,r,i);let s=u.boundingVolume;return o.clone(o.ZERO,s.center),s.radius=Math.sqrt(3),u}function ce(e,t){let n=t*ee,r=e[n++],i=e[n++],s=o.fromElements(r,r,i,S),a=d.unpack(e,n,u.modelMatrix);d.multiplyByScale(a,s,a);let l=u.boundingVolume;return o.clone(o.ZERO,l.center),l.radius=Math.sqrt(2),u}function se(e,t){let n=t*ne,r=o.unpack(e,n,S);n+=o.packedLength;let i=d.unpack(e,n,u.modelMatrix);d.multiplyByScale(i,r,i);let s=u.boundingVolume;return o.clone(o.ZERO,s.center),s.radius=1,u}function ie(e,t){let n=t*te,r=e[n++],i=o.unpack(e,n,S),s=d.fromTranslation(i,u.modelMatrix);d.multiplyByUniformScale(s,r,s);let a=u.boundingVolume;return o.clone(o.ZERO,a.center),a.radius=1,u}var de=new o;function R(e,t,n,r,i){if(!l(t))return;let s=n.length,a=r.attributes.position.values,c=r.indices,u=e.positions,f=e.vertexBatchIds,h=e.indices,p=e.batchIds,m=e.batchTableColors,b=e.batchedIndices,k=e.indexOffsets,g=e.indexCounts,y=e.boundingVolumes,I=e.modelMatrix,x=e.center,w=e.positionOffset,B=e.batchIdIndex,j=e.indexOffset,A=e.batchedIndicesOffset;for(let e=0;e<s;++e){let r=i(t,e),s=r.modelMatrix;d.multiply(I,s,s);let l=n[e],O=a.length;for(let e=0;e<O;e+=3){let t=o.unpack(a,e,de);d.multiplyByPoint(s,t,t),o.subtract(t,x,t),o.pack(t,u,3*w+e),f[B++]=l}let L=c.length;for(let e=0;e<L;++e)h[j+e]=c[e]+w;let U=e+A;b[U]=new J({offset:j,count:L,color:P.fromRgba(m[l]),batchIds:[l]}),p[U]=l,k[U]=j,g[U]=L,y[U]=E.transform(r.boundingVolume,s),w+=O/3,j+=L}e.positionOffset=w,e.batchIdIndex=B,e.indexOffset=j,e.batchedIndicesOffset+=s}var K=new o,Q=new d;function re(e){let t=new Float64Array(e),n=0;o.unpack(t,n,K),n+=o.packedLength,d.unpack(t,n,Q)}function le(e){let t=e.length,n=0;for(let o=0;o<t;++o)n+=P.packedLength+3+e[o].batchIds.length;return n}function ae(e,t,n){let o=n.length,r=2+o*E.packedLength+1+le(t),i=new Float64Array(r),s=0;i[s++]=e,i[s++]=o;for(let e=0;e<o;++e)E.pack(n[e],i,s),s+=E.packedLength;let a=t.length;i[s++]=a;for(let e=0;e<a;++e){let n=t[e];P.pack(n.color,i,s),s+=P.packedLength,i[s++]=n.offset,i[s++]=n.count;let o=n.batchIds,r=o.length;i[s++]=r;for(let e=0;e<r;++e)i[s++]=o[e]}return i}function fe(e,t){let n=l(e.boxes)?new Float32Array(e.boxes):void 0,o=l(e.boxBatchIds)?new Uint16Array(e.boxBatchIds):void 0,r=l(e.cylinders)?new Float32Array(e.cylinders):void 0,i=l(e.cylinderBatchIds)?new Uint16Array(e.cylinderBatchIds):void 0,s=l(e.ellipsoids)?new Float32Array(e.ellipsoids):void 0,a=l(e.ellipsoidBatchIds)?new Uint16Array(e.ellipsoidBatchIds):void 0,c=l(e.spheres)?new Float32Array(e.spheres):void 0,d=l(e.sphereBatchIds)?new Uint16Array(e.sphereBatchIds):void 0,u=l(n)?o.length:0,f=l(r)?i.length:0,h=l(s)?a.length:0,p=l(c)?d.length:0,m=j.getUnitBox(),b=z.getUnitCylinder(),k=H.getUnitEllipsoid(),g=m.attributes.position.values,y=b.attributes.position.values,I=k.attributes.position.values,x=g.length*u;x+=y.length*f,x+=I.length*(h+p);let w=m.indices,B=b.indices,A=k.indices,O=w.length*u;O+=B.length*f,O+=A.length*(h+p);let L=new Float32Array(x),U=new Uint16Array(x/3),v=W.createTypedArray(x/3,O),E=u+f+h+p,M=new Uint16Array(E),T=new Array(E),S=new Uint32Array(E),P=new Uint32Array(E),Z=new Array(E);re(e.packedBuffer);let C={batchTableColors:new Uint32Array(e.batchTableColors),positions:L,vertexBatchIds:U,indices:v,batchIds:M,batchedIndices:T,indexOffsets:S,indexCounts:P,boundingVolumes:Z,positionOffset:0,batchIdIndex:0,indexOffset:0,batchedIndicesOffset:0,modelMatrix:Q,center:K};R(C,n,o,m,oe),R(C,r,i,b,ce),R(C,s,a,k,se),R(C,c,d,k,ie);let F=ae(v.BYTES_PER_ELEMENT,T,Z);return t.push(L.buffer,U.buffer,v.buffer),t.push(M.buffer,S.buffer,P.buffer),t.push(F.buffer),{positions:L.buffer,vertexBatchIds:U.buffer,indices:v.buffer,indexOffsets:S.buffer,indexCounts:P.buffer,batchIds:M.buffer,packedBuffer:F.buffer}}var Oe=Y(fe);export{Oe as default};