1 |
- define(["./AttributeCompression-1f045b73","./Matrix2-ccd5b911","./Color-d6975cd2","./when-4bbc8319","./IndexDatatype-b7d979a6","./ComponentDatatype-93750d1a","./OrientedBoundingBox-0a826a8b","./createTaskProcessorWorker","./RuntimeError-346a3079","./Transforms-d5c6ad6e","./combine-83860057","./WebGLConstants-1c8239cc","./EllipsoidTangentPlane-e000bae1","./AxisAlignedBoundingBox-883f9c89","./IntersectionTests-4d6f5c54","./Plane-18bb00f8"],function(ye,Ce,Ie,xe,we,ve,Ae,e,a,n,r,t,i,o,s,d){"use strict";var Ee=new Ce.Cartesian3,Ne=new Ce.Ellipsoid,Te=new Ce.Rectangle,Be={min:void 0,max:void 0,indexBytesPerElement:void 0};function ke(e,a,n){var r=a.length,t=2+r*Ae.OrientedBoundingBox.packedLength+1+function(e){for(var a=e.length,n=0,r=0;r<a;++r)n+=Ie.Color.packedLength+3+e[r].batchIds.length;return n}(n),i=new Float64Array(t),o=0;i[o++]=e,i[o++]=r;for(var s=0;s<r;++s)Ae.OrientedBoundingBox.pack(a[s],i,o),o+=Ae.OrientedBoundingBox.packedLength;var d=n.length;i[o++]=d;for(var f=0;f<d;++f){var c=n[f];Ie.Color.pack(c.color,i,o),o+=Ie.Color.packedLength,i[o++]=c.offset,i[o++]=c.count;var u=c.batchIds,h=u.length;i[o++]=h;for(var l=0;l<h;++l)i[o++]=u[l]}return i}var Le=new Ce.Cartesian3,Oe=new Ce.Cartesian3,Ue=new Ce.Cartesian3,Pe=new Ce.Cartesian3,Fe=new Ce.Cartesian3,Se=new Ce.Cartographic,De=new Ce.Rectangle;return e(function(e,a){var n;t=e.packedBuffer,n=new Float64Array(t),t=0,Be.indexBytesPerElement=n[t++],Be.min=n[t++],Be.max=n[t++],Ce.Cartesian3.unpack(n,3,Ee),t+=Ce.Cartesian3.packedLength,Ce.Ellipsoid.unpack(n,t,Ne),t+=Ce.Ellipsoid.packedLength,Ce.Rectangle.unpack(n,t,Te);var r=new(2===Be.indexBytesPerElement?Uint16Array:Uint32Array)(e.indices),t=new Uint16Array(e.positions),i=new Uint32Array(e.counts),o=new Uint32Array(e.indexCounts),s=new Uint32Array(e.batchIds),d=new Uint32Array(e.batchTableColors),f=new Array(i.length),c=Ee,u=Ne,h=Te,l=Be.min,g=Be.max,p=e.minimumHeights,b=e.maximumHeights;xe.defined(p)&&xe.defined(b)&&(p=new Float32Array(p),b=new Float32Array(b));var m=t.length/2,y=t.subarray(0,m),C=t.subarray(m,2*m);ye.AttributeCompression.zigZagDeltaDecode(y,C);for(var I=new Float64Array(3*m),x=0;x<m;++x){var w=y[x],v=C[x],w=ve.CesiumMath.lerp(h.west,h.east,w/32767),v=ve.CesiumMath.lerp(h.south,h.north,v/32767),v=Ce.Cartographic.fromRadians(w,v,0,Se),v=u.cartographicToCartesian(v,Le);Ce.Cartesian3.pack(v,I,3*x)}var A=i.length,E=new Array(A),N=new Array(A),T=0,B=0;for(x=0;x<A;++x)E[x]=T,N[x]=B,T+=i[x],B+=o[x];var k=new Float32Array(3*m*2),L=new Uint16Array(2*m),O=new Uint32Array(N.length),U=new Uint32Array(o.length),P=[],F={};for(x=0;x<A;++x)_=d[x],xe.defined(F[_])?(F[_].positionLength+=i[x],F[_].indexLength+=o[x],F[_].batchIds.push(x)):F[_]={positionLength:i[x],indexLength:o[x],offset:0,indexOffset:0,batchIds:[x]};var S,D=0,R=0;for(_ in F)F.hasOwnProperty(_)&&((G=F[_]).offset=D,G.indexOffset=R,D+=2*G.positionLength,R+=S=2*G.indexLength+6*G.positionLength,G.indexLength=S);var M=[];for(_ in F)F.hasOwnProperty(_)&&(G=F[_],M.push({color:Ie.Color.fromRgba(parseInt(_)),offset:G.indexOffset,count:G.indexLength,batchIds:G.batchIds}));for(x=0;x<A;++x){var _,G,Y=(G=F[_=d[x]]).offset,V=3*Y,H=Y,W=E[x],z=i[x],Z=s[x],j=l,q=g;xe.defined(p)&&xe.defined(b)&&(j=p[x],q=b[x]);for(var J=Number.POSITIVE_INFINITY,K=Number.NEGATIVE_INFINITY,Q=Number.POSITIVE_INFINITY,X=Number.NEGATIVE_INFINITY,$=0;$<z;++$){var ee=Ce.Cartesian3.unpack(I,3*W+3*$,Le);u.scaleToGeodeticSurface(ee,ee);var ae=u.cartesianToCartographic(ee,Se),ne=ae.latitude,re=ae.longitude,J=Math.min(ne,J),K=Math.max(ne,K),Q=Math.min(re,Q),X=Math.max(re,X),ae=u.geodeticSurfaceNormal(ee,Oe),ne=Ce.Cartesian3.multiplyByScalar(ae,j,Ue),re=Ce.Cartesian3.add(ee,ne,Pe),ne=Ce.Cartesian3.multiplyByScalar(ae,q,ne),ne=Ce.Cartesian3.add(ee,ne,Fe);Ce.Cartesian3.subtract(ne,c,ne),Ce.Cartesian3.subtract(re,c,re),Ce.Cartesian3.pack(ne,k,V),Ce.Cartesian3.pack(re,k,V+3),L[H]=Z,L[H+1]=Z,V+=6,H+=2}(h=De).west=Q,h.east=X,h.south=J,h.north=K,f[x]=Ae.OrientedBoundingBox.fromRectangle(h,l,g,u);var te=G.indexOffset,ie=N[x],oe=o[x];for(O[x]=te,$=0;$<oe;$+=3){var se=r[ie+$]-W,de=r[ie+$+1]-W,fe=r[ie+$+2]-W;P[te++]=2*se+Y,P[te++]=2*de+Y,P[te++]=2*fe+Y,P[te++]=2*fe+1+Y,P[te++]=2*de+1+Y,P[te++]=2*se+1+Y}for($=0;$<z;++$){var ce=$,ue=($+1)%z;P[te++]=2*ce+1+Y,P[te++]=2*ue+Y,P[te++]=2*ce+Y,P[te++]=2*ce+1+Y,P[te++]=2*ue+1+Y,P[te++]=2*ue+Y}G.offset+=2*z,G.indexOffset=te,U[x]=te-O[x]}for(var P=we.IndexDatatype.createTypedArray(k.length/3,P),he=M.length,le=0;le<he;++le){for(var ge=M[le].batchIds,pe=0,be=ge.length,me=0;me<be;++me)pe+=U[ge[me]];M[le].count=pe}return t=ke(2===P.BYTES_PER_ELEMENT?we.IndexDatatype.UNSIGNED_SHORT:we.IndexDatatype.UNSIGNED_INT,f,M),a.push(k.buffer,P.buffer,O.buffer,U.buffer,L.buffer,t.buffer),{positions:k.buffer,indices:P.buffer,indexOffsets:O.buffer,indexCounts:U.buffer,batchIds:L.buffer,packedBuffer:t.buffer}})});
|