1 |
- define(["./AxisAlignedBoundingBox-37250ed6","./Matrix2-e3fb4559","./Cartesian3-7e9cc2ff","./defaultValue-81eec7ed","./TerrainEncoding-2e2628a7","./IndexDatatype-f1e3f799","./Math-5f585871","./Matrix4-d34187af","./Check-741c5f3c","./Transforms-98ffa11d","./WebMercatorProjection-f5706bbf","./createTaskProcessorWorker","./AttributeCompression-e2e3f0dd","./ComponentDatatype-aaeec80f","./WebGLConstants-508b9636","./RuntimeError-26acdd3b","./_commonjsHelpers-3aae1032-26891ab7","./combine-3c023bda"],(function(e,t,r,n,o,i,a,s,c,d,h,u,l,I,g,m,f,T){"use strict";function E(){c.DeveloperError.throwInstantiationError()}Object.defineProperties(E.prototype,{errorEvent:{get:c.DeveloperError.throwInstantiationError},credit:{get:c.DeveloperError.throwInstantiationError},tilingScheme:{get:c.DeveloperError.throwInstantiationError},ready:{get:c.DeveloperError.throwInstantiationError},readyPromise:{get:c.DeveloperError.throwInstantiationError},hasWaterMask:{get:c.DeveloperError.throwInstantiationError},hasVertexNormals:{get:c.DeveloperError.throwInstantiationError},availability:{get:c.DeveloperError.throwInstantiationError}});const p=[];E.getRegularGridIndices=function(e,t){let r=p[e];n.defined(r)||(p[e]=r=[]);let o=r[t];return n.defined(o)||(o=e*t<a.CesiumMath.SIXTY_FOUR_KILOBYTES?r[t]=new Uint16Array((e-1)*(t-1)*6):r[t]=new Uint32Array((e-1)*(t-1)*6),M(e,t,o,0)),o};const y=[];E.getRegularGridIndicesAndEdgeIndices=function(e,t){let r=y[e];n.defined(r)||(y[e]=r=[]);let o=r[t];if(!n.defined(o)){const n=E.getRegularGridIndices(e,t),i=w(e,t),a=i.westIndicesSouthToNorth,s=i.southIndicesEastToWest,c=i.eastIndicesNorthToSouth,d=i.northIndicesWestToEast;o=r[t]={indices:n,westIndicesSouthToNorth:a,southIndicesEastToWest:s,eastIndicesNorthToSouth:c,northIndicesWestToEast:d}}return o};const N=[];function w(e,t){const r=new Array(t),n=new Array(e),o=new Array(t),i=new Array(e);let a;for(a=0;a<e;++a)i[a]=a,n[a]=e*t-1-a;for(a=0;a<t;++a)o[a]=(a+1)*e-1,r[a]=(t-a-1)*e;return{westIndicesSouthToNorth:r,southIndicesEastToWest:n,eastIndicesNorthToSouth:o,northIndicesWestToEast:i}}function M(e,t,r,n){let o=0;for(let i=0;i<t-1;++i){for(let t=0;t<e-1;++t){const t=o,i=t+e,a=i+1,s=t+1;r[n++]=t,r[n++]=i,r[n++]=s,r[n++]=s,r[n++]=i,r[n++]=a,++o}++o}}function S(e,t,r,n){let o=e[0];const i=e.length;for(let a=1;a<i;++a){const i=e[a];r[n++]=o,r[n++]=i,r[n++]=t,r[n++]=t,r[n++]=i,r[n++]=t+1,o=i,++t}return n}E.getRegularGridAndSkirtIndicesAndEdgeIndices=function(e,t){let r=N[e];n.defined(r)||(N[e]=r=[]);let o=r[t];if(!n.defined(o)){const n=e*t,a=(e-1)*(t-1)*6,s=2*e+2*t,c=n+s,d=a+6*Math.max(0,s-4),h=w(e,t),u=h.westIndicesSouthToNorth,l=h.southIndicesEastToWest,I=h.eastIndicesNorthToSouth,g=h.northIndicesWestToEast,m=i.IndexDatatype.createTypedArray(c,d);M(e,t,m,0),E.addSkirtIndices(u,l,I,g,n,m,a),o=r[t]={indices:m,westIndicesSouthToNorth:u,southIndicesEastToWest:l,eastIndicesNorthToSouth:I,northIndicesWestToEast:g,indexCountWithoutSkirts:a}}return o},E.addSkirtIndices=function(e,t,r,n,o,i,a){let s=o;a=S(e,s,i,a),s+=e.length,a=S(t,s,i,a),s+=t.length,a=S(r,s,i,a),s+=r.length,S(n,s,i,a)},E.heightmapTerrainQuality=.25,E.getEstimatedLevelZeroGeometricErrorForAHeightmap=function(e,t,r){return 2*e.maximumRadius*Math.PI*E.heightmapTerrainQuality/(t*r)},E.prototype.requestTileGeometry=c.DeveloperError.throwInstantiationError,E.prototype.getLevelMaximumGeometricError=c.DeveloperError.throwInstantiationError,E.prototype.getTileDataAvailable=c.DeveloperError.throwInstantiationError,E.prototype.loadTileDataAvailability=c.DeveloperError.throwInstantiationError;const b=32767,x=new r.Cartesian3,C=new r.Cartesian3,A=new r.Cartesian3,W=new t.Cartographic,v=new t.Cartesian2;function P(e,t,n,o,i,c,d,h,u){let l=Number.POSITIVE_INFINITY;const I=i.north,g=i.south;let m=i.east;const f=i.west;m<f&&(m+=a.CesiumMath.TWO_PI);const T=e.length;for(let i=0;i<T;++i){const T=e[i],E=n[T],p=o[T];W.longitude=a.CesiumMath.lerp(f,m,p.x),W.latitude=a.CesiumMath.lerp(g,I,p.y),W.height=E-t;const y=c.cartographicToCartesian(W,x);s.Matrix4.multiplyByPoint(d,y,y),r.Cartesian3.minimumByComponent(y,h,h),r.Cartesian3.maximumByComponent(y,u,u),l=Math.min(l,W.height)}return l}function D(e,t,r,o,i,s,c,d,u,l,I,g,m,f){const T=n.defined(c),E=u.north,p=u.south;let y=u.east;const N=u.west;y<N&&(y+=a.CesiumMath.TWO_PI);const w=r.length;for(let n=0;n<w;++n){const u=r[n],w=i[u],M=s[u];W.longitude=a.CesiumMath.lerp(N,y,M.x)+m,W.latitude=a.CesiumMath.lerp(p,E,M.y)+f,W.height=w-l;const S=d.cartographicToCartesian(W,x);if(T){const e=2*u;v.x=c[e],v.y=c[e+1]}let b,C;o.hasWebMercatorT&&(b=(h.WebMercatorProjection.geodeticLatitudeToMercatorAngle(W.latitude)-I)*g),o.hasGeodeticSurfaceNormals&&(C=d.geodeticSurfaceNormal(S)),t=o.encode(e,t,S,M,W.height,v,b,C)}}function k(e,t){let r;return"function"==typeof e.slice&&(r=e.slice(),"function"!=typeof r.sort&&(r=void 0)),n.defined(r)||(r=Array.prototype.slice.call(e)),r.sort(t),r}return u((function(c,u){const l=c.quantizedVertices,I=l.length/3,g=c.octEncodedNormals,m=c.westIndices.length+c.eastIndices.length+c.southIndices.length+c.northIndices.length,f=c.includeWebMercatorT,T=c.exaggeration,p=c.exaggerationRelativeHeight,y=1!==T,N=t.Rectangle.clone(c.rectangle),w=N.west,M=N.south,S=N.east,F=N.north,H=t.Ellipsoid.clone(c.ellipsoid),_=c.minimumHeight,G=c.maximumHeight,V=c.relativeToCenter,Y=d.Transforms.eastNorthUpToFixedFrame(V,H),O=s.Matrix4.inverseTransformation(Y,new s.Matrix4);let B,R;f&&(B=h.WebMercatorProjection.geodeticLatitudeToMercatorAngle(M),R=1/(h.WebMercatorProjection.geodeticLatitudeToMercatorAngle(F)-B));const L=l.subarray(0,I),j=l.subarray(I,2*I),U=l.subarray(2*I,3*I),z=n.defined(g),q=new Array(I),Q=new Array(I),K=new Array(I),X=f?new Array(I):[],Z=y?new Array(I):[],J=C;J.x=Number.POSITIVE_INFINITY,J.y=Number.POSITIVE_INFINITY,J.z=Number.POSITIVE_INFINITY;const $=A;$.x=Number.NEGATIVE_INFINITY,$.y=Number.NEGATIVE_INFINITY,$.z=Number.NEGATIVE_INFINITY;let ee=Number.POSITIVE_INFINITY,te=Number.NEGATIVE_INFINITY,re=Number.POSITIVE_INFINITY,ne=Number.NEGATIVE_INFINITY;for(let e=0;e<I;++e){const n=L[e],o=j[e],i=n/b,c=o/b,d=a.CesiumMath.lerp(_,G,U[e]/b);W.longitude=a.CesiumMath.lerp(w,S,i),W.latitude=a.CesiumMath.lerp(M,F,c),W.height=d,ee=Math.min(W.longitude,ee),te=Math.max(W.longitude,te),re=Math.min(W.latitude,re),ne=Math.max(W.latitude,ne);const u=H.cartographicToCartesian(W);q[e]=new t.Cartesian2(i,c),Q[e]=d,K[e]=u,f&&(X[e]=(h.WebMercatorProjection.geodeticLatitudeToMercatorAngle(W.latitude)-B)*R),y&&(Z[e]=H.geodeticSurfaceNormal(u)),s.Matrix4.multiplyByPoint(O,u,x),r.Cartesian3.minimumByComponent(x,J,J),r.Cartesian3.maximumByComponent(x,$,$)}const oe=k(c.westIndices,(function(e,t){return q[e].y-q[t].y})),ie=k(c.eastIndices,(function(e,t){return q[t].y-q[e].y})),ae=k(c.southIndices,(function(e,t){return q[t].x-q[e].x})),se=k(c.northIndices,(function(e,t){return q[e].x-q[t].x}));let ce;if(_<0){ce=new o.EllipsoidalOccluder(H).computeHorizonCullingPointPossiblyUnderEllipsoid(V,K,_)}let de=_;de=Math.min(de,P(c.westIndices,c.westSkirtHeight,Q,q,N,H,O,J,$)),de=Math.min(de,P(c.southIndices,c.southSkirtHeight,Q,q,N,H,O,J,$)),de=Math.min(de,P(c.eastIndices,c.eastSkirtHeight,Q,q,N,H,O,J,$)),de=Math.min(de,P(c.northIndices,c.northSkirtHeight,Q,q,N,H,O,J,$));const he=new e.AxisAlignedBoundingBox(J,$,V),ue=new o.TerrainEncoding(V,he,de,G,Y,z,f,y,T,p),le=ue.stride,Ie=new Float32Array(I*le+m*le);let ge=0;for(let e=0;e<I;++e){if(z){const t=2*e;v.x=g[t],v.y=g[t+1]}ge=ue.encode(Ie,ge,K[e],q[e],Q[e],v,X[e],Z[e])}const me=Math.max(0,2*(m-4)),fe=c.indices.length+3*me,Te=i.IndexDatatype.createTypedArray(I+m,fe);Te.set(c.indices,0);const Ee=1e-4,pe=(te-ee)*Ee,ye=(ne-re)*Ee,Ne=-pe,we=pe,Me=ye,Se=-ye;let be=I*le;return D(Ie,be,oe,ue,Q,q,g,H,N,c.westSkirtHeight,B,R,Ne,0),be+=c.westIndices.length*le,D(Ie,be,ae,ue,Q,q,g,H,N,c.southSkirtHeight,B,R,0,Se),be+=c.southIndices.length*le,D(Ie,be,ie,ue,Q,q,g,H,N,c.eastSkirtHeight,B,R,we,0),be+=c.eastIndices.length*le,D(Ie,be,se,ue,Q,q,g,H,N,c.northSkirtHeight,B,R,0,Me),E.addSkirtIndices(oe,ae,ie,se,I,Te,c.indices.length),u.push(Ie.buffer,Te.buffer),{vertices:Ie.buffer,indices:Te.buffer,westIndicesSouthToNorth:oe,southIndicesEastToWest:ae,eastIndicesNorthToSouth:ie,northIndicesWestToEast:se,vertexStride:le,center:V,minimumHeight:_,maximumHeight:G,occludeePointInScaledSpace:ce,encoding:ue,indexCountWithoutSkirts:c.indices.length}}))}));
|