1
Surpriseplus
2022-09-16 a7e5110ef3f5fe3c9205f7d1a526b9fbbb55d826
1
define(["./AttributeCompression-8cb78525","./Matrix2-ae0e0b05","./Color-341b20f8","./when-e3a49219","./IndexDatatype-e12e2493","./ComponentDatatype-64cf6611","./OrientedBoundingBox-d2fffacc","./createTaskProcessorWorker","./RuntimeError-ffc802eb","./PixelFormat-83d70a69","./WebGLConstants-1c8239cc","./Transforms-a6362ad2","./combine-c7a1ec8a","./EllipsoidTangentPlane-e3af9e65","./AxisAlignedBoundingBox-699685f5","./IntersectionTests-8be403d7","./Plane-2bf1bb80"],(function(e,a,n,r,t,i,o,s,f,d,c,u,h,l,g,p,b){"use strict";var m=new a.Cartesian3,y=new a.Ellipsoid,v=new a.Rectangle,C={min:void 0,max:void 0,indexBytesPerElement:void 0};function I(e,a,r){var t=a.length,i=2+t*o.OrientedBoundingBox.packedLength+1+function(e){for(var a=e.length,r=0,t=0;t<a;++t)r+=n.Color.packedLength+3+e[t].batchIds.length;return r}(r),s=new Float64Array(i),f=0;s[f++]=e,s[f++]=t;for(var d=0;d<t;++d)o.OrientedBoundingBox.pack(a[d],s,f),f+=o.OrientedBoundingBox.packedLength;var c=r.length;s[f++]=c;for(var u=0;u<c;++u){var h=r[u];n.Color.pack(h.color,s,f),f+=n.Color.packedLength,s[f++]=h.offset,s[f++]=h.count;var l=h.batchIds,g=l.length;s[f++]=g;for(var p=0;p<g;++p)s[f++]=l[p]}return s}var x=new a.Cartesian3,w=new a.Cartesian3,A=new a.Cartesian3,E=new a.Cartesian3,N=new a.Cartesian3,T=new a.Cartographic,B=new a.Rectangle;return s((function(s,f){var d;!function(e){var n=new Float64Array(e),r=0;C.indexBytesPerElement=n[r++],C.min=n[r++],C.max=n[r++],a.Cartesian3.unpack(n,r,m),r+=a.Cartesian3.packedLength,a.Ellipsoid.unpack(n,r,y),r+=a.Ellipsoid.packedLength,a.Rectangle.unpack(n,r,v)}(s.packedBuffer),d=2===C.indexBytesPerElement?new Uint16Array(s.indices):new Uint32Array(s.indices);var c,u,h,l=new Uint16Array(s.positions),g=new Uint32Array(s.counts),p=new Uint32Array(s.indexCounts),b=new Uint32Array(s.batchIds),k=new Uint32Array(s.batchTableColors),L=new Array(g.length),O=m,P=y,U=v,F=C.min,S=C.max,D=s.minimumHeights,R=s.maximumHeights;r.defined(D)&&r.defined(R)&&(D=new Float32Array(D),R=new Float32Array(R));var M=l.length/2,_=l.subarray(0,M),G=l.subarray(M,2*M);e.AttributeCompression.zigZagDeltaDecode(_,G);var Y=new Float64Array(3*M);for(c=0;c<M;++c){var V=_[c],H=G[c],W=i.CesiumMath.lerp(U.west,U.east,V/32767),z=i.CesiumMath.lerp(U.south,U.north,H/32767),Z=a.Cartographic.fromRadians(W,z,0,T),j=P.cartographicToCartesian(Z,x);a.Cartesian3.pack(j,Y,3*c)}var q=g.length,J=new Array(q),K=new Array(q),Q=0,X=0;for(c=0;c<q;++c)J[c]=Q,K[c]=X,Q+=g[c],X+=p[c];var $,ee=new Float32Array(3*M*2),ae=new Uint16Array(2*M),ne=new Uint32Array(K.length),re=new Uint32Array(p.length),te=[],ie={};for(c=0;c<q;++c)h=k[c],r.defined(ie[h])?(ie[h].positionLength+=g[c],ie[h].indexLength+=p[c],ie[h].batchIds.push(c)):ie[h]={positionLength:g[c],indexLength:p[c],offset:0,indexOffset:0,batchIds:[c]};var oe=0,se=0;for(h in ie)if(ie.hasOwnProperty(h)){($=ie[h]).offset=oe,$.indexOffset=se;var fe=2*$.positionLength,de=2*$.indexLength+6*$.positionLength;oe+=fe,se+=de,$.indexLength=de}var ce=[];for(h in ie)ie.hasOwnProperty(h)&&($=ie[h],ce.push({color:n.Color.fromRgba(parseInt(h)),offset:$.indexOffset,count:$.indexLength,batchIds:$.batchIds}));for(c=0;c<q;++c){var ue=($=ie[h=k[c]]).offset,he=3*ue,le=ue,ge=J[c],pe=g[c],be=b[c],me=F,ye=S;r.defined(D)&&r.defined(R)&&(me=D[c],ye=R[c]);var ve=Number.POSITIVE_INFINITY,Ce=Number.NEGATIVE_INFINITY,Ie=Number.POSITIVE_INFINITY,xe=Number.NEGATIVE_INFINITY;for(u=0;u<pe;++u){var we=a.Cartesian3.unpack(Y,3*ge+3*u,x);P.scaleToGeodeticSurface(we,we);var Ae=P.cartesianToCartographic(we,T),Ee=Ae.latitude,Ne=Ae.longitude;ve=Math.min(Ee,ve),Ce=Math.max(Ee,Ce),Ie=Math.min(Ne,Ie),xe=Math.max(Ne,xe);var Te=P.geodeticSurfaceNormal(we,w),Be=a.Cartesian3.multiplyByScalar(Te,me,A),ke=a.Cartesian3.add(we,Be,E);Be=a.Cartesian3.multiplyByScalar(Te,ye,Be);var Le=a.Cartesian3.add(we,Be,N);a.Cartesian3.subtract(Le,O,Le),a.Cartesian3.subtract(ke,O,ke),a.Cartesian3.pack(Le,ee,he),a.Cartesian3.pack(ke,ee,he+3),ae[le]=be,ae[le+1]=be,he+=6,le+=2}(U=B).west=Ie,U.east=xe,U.south=ve,U.north=Ce,L[c]=o.OrientedBoundingBox.fromRectangle(U,F,S,P);var Oe=$.indexOffset,Pe=K[c],Ue=p[c];for(ne[c]=Oe,u=0;u<Ue;u+=3){var Fe=d[Pe+u]-ge,Se=d[Pe+u+1]-ge,De=d[Pe+u+2]-ge;te[Oe++]=2*Fe+ue,te[Oe++]=2*Se+ue,te[Oe++]=2*De+ue,te[Oe++]=2*De+1+ue,te[Oe++]=2*Se+1+ue,te[Oe++]=2*Fe+1+ue}for(u=0;u<pe;++u){var Re=u,Me=(u+1)%pe;te[Oe++]=2*Re+1+ue,te[Oe++]=2*Me+ue,te[Oe++]=2*Re+ue,te[Oe++]=2*Re+1+ue,te[Oe++]=2*Me+1+ue,te[Oe++]=2*Me+ue}$.offset+=2*pe,$.indexOffset=Oe,re[c]=Oe-ne[c]}te=t.IndexDatatype.createTypedArray(ee.length/3,te);for(var _e=ce.length,Ge=0;Ge<_e;++Ge){for(var Ye=ce[Ge].batchIds,Ve=0,He=Ye.length,We=0;We<He;++We)Ve+=re[Ye[We]];ce[Ge].count=Ve}var ze=I(2===te.BYTES_PER_ELEMENT?t.IndexDatatype.UNSIGNED_SHORT:t.IndexDatatype.UNSIGNED_INT,L,ce);return f.push(ee.buffer,te.buffer,ne.buffer,re.buffer,ae.buffer,ze.buffer),{positions:ee.buffer,indices:te.buffer,indexOffsets:ne.buffer,indexCounts:re.buffer,batchIds:ae.buffer,packedBuffer:ze.buffer}}))}));