1 |
- define(["./AttributeCompression-e2e3f0dd","./Cartesian3-7e9cc2ff","./Matrix2-e3fb4559","./Color-3aa7f38b","./defaultValue-81eec7ed","./IndexDatatype-f1e3f799","./Math-5f585871","./OrientedBoundingBox-3db45505","./createTaskProcessorWorker","./ComponentDatatype-aaeec80f","./Check-741c5f3c","./WebGLConstants-508b9636","./Matrix4-d34187af","./RuntimeError-26acdd3b","./Transforms-98ffa11d","./_commonjsHelpers-3aae1032-26891ab7","./combine-3c023bda","./EllipsoidTangentPlane-fa1337e1","./AxisAlignedBoundingBox-37250ed6","./IntersectionTests-73b87d72","./Plane-4f75b3df"],(function(e,t,n,a,r,o,s,i,c,f,d,l,u,h,g,p,b,m,C,y,I){"use strict";const x=new t.Cartesian3,w=new n.Ellipsoid,A=new n.Rectangle,E={min:void 0,max:void 0,indexBytesPerElement:void 0};function N(e,t,n){const r=t.length,o=2+r*i.OrientedBoundingBox.packedLength+1+function(e){const t=e.length;let n=0;for(let r=0;r<t;++r)n+=a.Color.packedLength+3+e[r].batchIds.length;return n}(n),s=new Float64Array(o);let c=0;s[c++]=e,s[c++]=r;for(let e=0;e<r;++e)i.OrientedBoundingBox.pack(t[e],s,c),c+=i.OrientedBoundingBox.packedLength;const f=n.length;s[c++]=f;for(let e=0;e<f;++e){const t=n[e];a.Color.pack(t.color,s,c),c+=a.Color.packedLength,s[c++]=t.offset,s[c++]=t.count;const r=t.batchIds,o=r.length;s[c++]=o;for(let e=0;e<o;++e)s[c++]=r[e]}return s}const T=new t.Cartesian3,k=new t.Cartesian3,B=new t.Cartesian3,L=new t.Cartesian3,O=new t.Cartesian3,U=new n.Cartographic,P=new n.Rectangle;return c((function(c,f){let d;!function(e){const a=new Float64Array(e);let r=0;E.indexBytesPerElement=a[r++],E.min=a[r++],E.max=a[r++],t.Cartesian3.unpack(a,r,x),r+=t.Cartesian3.packedLength,n.Ellipsoid.unpack(a,r,w),r+=n.Ellipsoid.packedLength,n.Rectangle.unpack(a,r,A)}(c.packedBuffer),d=2===E.indexBytesPerElement?new Uint16Array(c.indices):new Uint32Array(c.indices);const l=new Uint16Array(c.positions),u=new Uint32Array(c.counts),h=new Uint32Array(c.indexCounts),g=new Uint32Array(c.batchIds),p=new Uint32Array(c.batchTableColors),b=new Array(u.length),m=x,C=w;let y=A;const I=E.min,F=E.max;let M,S,D,R=c.minimumHeights,_=c.maximumHeights;r.defined(R)&&r.defined(_)&&(R=new Float32Array(R),_=new Float32Array(_));const G=l.length/2,V=l.subarray(0,G),Y=l.subarray(G,2*G);e.AttributeCompression.zigZagDeltaDecode(V,Y);const H=new Float64Array(3*G);for(M=0;M<G;++M){const e=V[M],a=Y[M],r=s.CesiumMath.lerp(y.west,y.east,e/32767),o=s.CesiumMath.lerp(y.south,y.north,a/32767),i=n.Cartographic.fromRadians(r,o,0,U),c=C.cartographicToCartesian(i,T);t.Cartesian3.pack(c,H,3*M)}const v=u.length,W=new Array(v),j=new Array(v);let z=0,Z=0;for(M=0;M<v;++M)W[M]=z,j[M]=Z,z+=u[M],Z+=h[M];const q=new Float32Array(3*G*2),J=new Uint16Array(2*G),K=new Uint32Array(j.length),Q=new Uint32Array(h.length);let X=[];const $={};for(M=0;M<v;++M)D=p[M],r.defined($[D])?($[D].positionLength+=u[M],$[D].indexLength+=h[M],$[D].batchIds.push(M)):$[D]={positionLength:u[M],indexLength:h[M],offset:0,indexOffset:0,batchIds:[M]};let ee,te=0,ne=0;for(D in $)if($.hasOwnProperty(D)){ee=$[D],ee.offset=te,ee.indexOffset=ne;const e=2*ee.positionLength,t=2*ee.indexLength+6*ee.positionLength;te+=e,ne+=t,ee.indexLength=t}const ae=[];for(D in $)$.hasOwnProperty(D)&&(ee=$[D],ae.push({color:a.Color.fromRgba(parseInt(D)),offset:ee.indexOffset,count:ee.indexLength,batchIds:ee.batchIds}));for(M=0;M<v;++M){D=p[M],ee=$[D];const e=ee.offset;let n=3*e,a=e;const o=W[M],s=u[M],c=g[M];let f=I,l=F;r.defined(R)&&r.defined(_)&&(f=R[M],l=_[M]);let x=Number.POSITIVE_INFINITY,w=Number.NEGATIVE_INFINITY,A=Number.POSITIVE_INFINITY,E=Number.NEGATIVE_INFINITY;for(S=0;S<s;++S){const e=t.Cartesian3.unpack(H,3*o+3*S,T);C.scaleToGeodeticSurface(e,e);const r=C.cartesianToCartographic(e,U),s=r.latitude,i=r.longitude;x=Math.min(s,x),w=Math.max(s,w),A=Math.min(i,A),E=Math.max(i,E);const d=C.geodeticSurfaceNormal(e,k);let u=t.Cartesian3.multiplyByScalar(d,f,B);const h=t.Cartesian3.add(e,u,L);u=t.Cartesian3.multiplyByScalar(d,l,u);const g=t.Cartesian3.add(e,u,O);t.Cartesian3.subtract(g,m,g),t.Cartesian3.subtract(h,m,h),t.Cartesian3.pack(g,q,n),t.Cartesian3.pack(h,q,n+3),J[a]=c,J[a+1]=c,n+=6,a+=2}y=P,y.west=A,y.east=E,y.south=x,y.north=w,b[M]=i.OrientedBoundingBox.fromRectangle(y,I,F,C);let N=ee.indexOffset;const G=j[M],V=h[M];for(K[M]=N,S=0;S<V;S+=3){const t=d[G+S]-o,n=d[G+S+1]-o,a=d[G+S+2]-o;X[N++]=2*t+e,X[N++]=2*n+e,X[N++]=2*a+e,X[N++]=2*a+1+e,X[N++]=2*n+1+e,X[N++]=2*t+1+e}for(S=0;S<s;++S){const t=S,n=(S+1)%s;X[N++]=2*t+1+e,X[N++]=2*n+e,X[N++]=2*t+e,X[N++]=2*t+1+e,X[N++]=2*n+1+e,X[N++]=2*n+e}ee.offset+=2*s,ee.indexOffset=N,Q[M]=N-K[M]}X=o.IndexDatatype.createTypedArray(q.length/3,X);const re=ae.length;for(let e=0;e<re;++e){const t=ae[e].batchIds;let n=0;const a=t.length;for(let e=0;e<a;++e)n+=Q[t[e]];ae[e].count=n}const oe=N(2===X.BYTES_PER_ELEMENT?o.IndexDatatype.UNSIGNED_SHORT:o.IndexDatatype.UNSIGNED_INT,b,ae);return f.push(q.buffer,X.buffer,K.buffer,Q.buffer,J.buffer,oe.buffer),{positions:q.buffer,indices:X.buffer,indexOffsets:K.buffer,indexCounts:Q.buffer,batchIds:J.buffer,packedBuffer:oe.buffer}}))}));
|