1
Surpriseplus
2022-09-16 a7e5110ef3f5fe3c9205f7d1a526b9fbbb55d826
1
define(["./AxisAlignedBoundingBox-699685f5","./Matrix2-ae0e0b05","./when-e3a49219","./TerrainEncoding-d0dbd995","./IndexDatatype-e12e2493","./ComponentDatatype-64cf6611","./RuntimeError-ffc802eb","./Transforms-a6362ad2","./WebMercatorProjection-043b7eb3","./createTaskProcessorWorker","./PixelFormat-83d70a69","./WebGLConstants-1c8239cc","./AttributeCompression-8cb78525","./combine-c7a1ec8a"],(function(e,t,r,i,n,o,a,s,d,c,h,u,I,l){"use strict";function g(){a.DeveloperError.throwInstantiationError()}Object.defineProperties(g.prototype,{errorEvent:{get:a.DeveloperError.throwInstantiationError},credit:{get:a.DeveloperError.throwInstantiationError},tilingScheme:{get:a.DeveloperError.throwInstantiationError},ready:{get:a.DeveloperError.throwInstantiationError},readyPromise:{get:a.DeveloperError.throwInstantiationError},hasWaterMask:{get:a.DeveloperError.throwInstantiationError},hasVertexNormals:{get:a.DeveloperError.throwInstantiationError},availability:{get:a.DeveloperError.throwInstantiationError}});var m=[];g.getRegularGridIndices=function(e,t){var i=m[e];r.defined(i)||(m[e]=i=[]);var n=i[t];return r.defined(n)||f(e,t,n=e*t<o.CesiumMath.SIXTY_FOUR_KILOBYTES?i[t]=new Uint16Array((e-1)*(t-1)*6):i[t]=new Uint32Array((e-1)*(t-1)*6),0),n};var T=[];g.getRegularGridIndicesAndEdgeIndices=function(e,t){var i=T[e];r.defined(i)||(T[e]=i=[]);var n=i[t];if(!r.defined(n)){var o=g.getRegularGridIndices(e,t),a=v(e,t),s=a.westIndicesSouthToNorth,d=a.southIndicesEastToWest,c=a.eastIndicesNorthToSouth,h=a.northIndicesWestToEast;n=i[t]={indices:o,westIndicesSouthToNorth:s,southIndicesEastToWest:d,eastIndicesNorthToSouth:c,northIndicesWestToEast:h}}return n};var E=[];function v(e,t){var r,i=new Array(t),n=new Array(e),o=new Array(t),a=new Array(e);for(r=0;r<e;++r)a[r]=r,n[r]=e*t-1-r;for(r=0;r<t;++r)o[r]=(r+1)*e-1,i[r]=(t-r-1)*e;return{westIndicesSouthToNorth:i,southIndicesEastToWest:n,eastIndicesNorthToSouth:o,northIndicesWestToEast:a}}function f(e,t,r,i){for(var n=0,o=0;o<t-1;++o){for(var a=0;a<e-1;++a){var s=n,d=s+e,c=d+1,h=s+1;r[i++]=s,r[i++]=d,r[i++]=h,r[i++]=h,r[i++]=d,r[i++]=c,++n}++n}}function p(e,t,r,i){for(var n=e[0],o=e.length,a=1;a<o;++a){var s=e[a];r[i++]=n,r[i++]=s,r[i++]=t,r[i++]=t,r[i++]=s,r[i++]=t+1,n=s,++t}return i}g.getRegularGridAndSkirtIndicesAndEdgeIndices=function(e,t){var i=E[e];r.defined(i)||(E[e]=i=[]);var o=i[t];if(!r.defined(o)){var a=e*t,s=(e-1)*(t-1)*6,d=2*e+2*t,c=a+d,h=s+6*Math.max(0,d-4),u=v(e,t),I=u.westIndicesSouthToNorth,l=u.southIndicesEastToWest,m=u.eastIndicesNorthToSouth,T=u.northIndicesWestToEast,p=n.IndexDatatype.createTypedArray(c,h);f(e,t,p,0),g.addSkirtIndices(I,l,m,T,a,p,s),o=i[t]={indices:p,westIndicesSouthToNorth:I,southIndicesEastToWest:l,eastIndicesNorthToSouth:m,northIndicesWestToEast:T,indexCountWithoutSkirts:s}}return o},g.addSkirtIndices=function(e,t,r,i,n,o,a){var s=n;a=p(e,s,o,a),a=p(t,s+=e.length,o,a),a=p(r,s+=t.length,o,a),p(i,s+=r.length,o,a)},g.heightmapTerrainQuality=.25,g.getEstimatedLevelZeroGeometricErrorForAHeightmap=function(e,t,r){return 2*e.maximumRadius*Math.PI*g.heightmapTerrainQuality/(t*r)},g.prototype.requestTileGeometry=a.DeveloperError.throwInstantiationError,g.prototype.getLevelMaximumGeometricError=a.DeveloperError.throwInstantiationError,g.prototype.getTileDataAvailable=a.DeveloperError.throwInstantiationError,g.prototype.loadTileDataAvailability=a.DeveloperError.throwInstantiationError;var y=32767,N=new t.Cartesian3,w=new t.Cartesian3,S=new t.Cartesian3,x=new t.Cartographic,M=new t.Cartesian2;function b(e,r,i,n,a,s,d,c,h){var u=Number.POSITIVE_INFINITY,I=a.north,l=a.south,g=a.east,m=a.west;g<m&&(g+=o.CesiumMath.TWO_PI);for(var T=e.length,E=0;E<T;++E){var v=e[E],f=i[v],p=n[v];x.longitude=o.CesiumMath.lerp(m,g,p.x),x.latitude=o.CesiumMath.lerp(l,I,p.y),x.height=f-r;var y=s.cartographicToCartesian(x,N);t.Matrix4.multiplyByPoint(d,y,y),t.Cartesian3.minimumByComponent(y,c,c),t.Cartesian3.maximumByComponent(y,h,h),u=Math.min(u,x.height)}return u}function A(e,t,i,n,a,s,c,h,u,I,l,g,m,T){var E=r.defined(c),v=u.north,f=u.south,p=u.east,y=u.west;p<y&&(p+=o.CesiumMath.TWO_PI);for(var w=i.length,S=0;S<w;++S){var b=i[S],A=a[b],C=s[b];x.longitude=o.CesiumMath.lerp(y,p,C.x)+m,x.latitude=o.CesiumMath.lerp(f,v,C.y)+T,x.height=A-I;var W,P,D=h.cartographicToCartesian(x,N);if(E){var k=2*b;M.x=c[k],M.y=c[k+1]}n.hasWebMercatorT&&(W=(d.WebMercatorProjection.geodeticLatitudeToMercatorAngle(x.latitude)-l)*g),n.hasGeodeticSurfaceNormals&&(P=h.geodeticSurfaceNormal(D)),t=n.encode(e,t,D,C,x.height,M,W,P)}}function C(e,t){var i;return"function"==typeof e.slice&&"function"!=typeof(i=e.slice()).sort&&(i=void 0),r.defined(i)||(i=Array.prototype.slice.call(e)),i.sort(t),i}return c((function(a,c){var h,u,I=a.quantizedVertices,l=I.length/3,m=a.octEncodedNormals,T=a.westIndices.length+a.eastIndices.length+a.southIndices.length+a.northIndices.length,E=a.includeWebMercatorT,v=a.exaggeration,f=a.exaggerationRelativeHeight,p=1!==v,W=t.Rectangle.clone(a.rectangle),P=W.west,D=W.south,k=W.east,F=W.north,H=t.Ellipsoid.clone(a.ellipsoid),_=a.minimumHeight,G=a.maximumHeight,V=a.relativeToCenter,Y=s.Transforms.eastNorthUpToFixedFrame(V,H),O=t.Matrix4.inverseTransformation(Y,new t.Matrix4);E&&(h=d.WebMercatorProjection.geodeticLatitudeToMercatorAngle(D),u=1/(d.WebMercatorProjection.geodeticLatitudeToMercatorAngle(F)-h));var B=I.subarray(0,l),R=I.subarray(l,2*l),L=I.subarray(2*l,3*l),j=r.defined(m),U=new Array(l),z=new Array(l),q=new Array(l),Q=E?new Array(l):[],K=p?new Array(l):[],X=w;X.x=Number.POSITIVE_INFINITY,X.y=Number.POSITIVE_INFINITY,X.z=Number.POSITIVE_INFINITY;var Z=S;Z.x=Number.NEGATIVE_INFINITY,Z.y=Number.NEGATIVE_INFINITY,Z.z=Number.NEGATIVE_INFINITY;for(var J=Number.POSITIVE_INFINITY,$=Number.NEGATIVE_INFINITY,ee=Number.POSITIVE_INFINITY,te=Number.NEGATIVE_INFINITY,re=0;re<l;++re){var ie=B[re],ne=R[re],oe=ie/y,ae=ne/y,se=o.CesiumMath.lerp(_,G,L[re]/y);x.longitude=o.CesiumMath.lerp(P,k,oe),x.latitude=o.CesiumMath.lerp(D,F,ae),x.height=se,J=Math.min(x.longitude,J),$=Math.max(x.longitude,$),ee=Math.min(x.latitude,ee),te=Math.max(x.latitude,te);var de=H.cartographicToCartesian(x);U[re]=new t.Cartesian2(oe,ae),z[re]=se,q[re]=de,E&&(Q[re]=(d.WebMercatorProjection.geodeticLatitudeToMercatorAngle(x.latitude)-h)*u),p&&(K[re]=H.geodeticSurfaceNormal(de)),t.Matrix4.multiplyByPoint(O,de,N),t.Cartesian3.minimumByComponent(N,X,X),t.Cartesian3.maximumByComponent(N,Z,Z)}var ce,he=C(a.westIndices,(function(e,t){return U[e].y-U[t].y})),ue=C(a.eastIndices,(function(e,t){return U[t].y-U[e].y})),Ie=C(a.southIndices,(function(e,t){return U[t].x-U[e].x})),le=C(a.northIndices,(function(e,t){return U[e].x-U[t].x}));_<0&&(ce=new i.EllipsoidalOccluder(H).computeHorizonCullingPointPossiblyUnderEllipsoid(V,q,_));var ge=_;ge=Math.min(ge,b(a.westIndices,a.westSkirtHeight,z,U,W,H,O,X,Z)),ge=Math.min(ge,b(a.southIndices,a.southSkirtHeight,z,U,W,H,O,X,Z)),ge=Math.min(ge,b(a.eastIndices,a.eastSkirtHeight,z,U,W,H,O,X,Z)),ge=Math.min(ge,b(a.northIndices,a.northSkirtHeight,z,U,W,H,O,X,Z));for(var me=new e.AxisAlignedBoundingBox(X,Z,V),Te=new i.TerrainEncoding(V,me,ge,G,Y,j,E,p,v,f),Ee=Te.stride,ve=new Float32Array(l*Ee+T*Ee),fe=0,pe=0;pe<l;++pe){if(j){var ye=2*pe;M.x=m[ye],M.y=m[ye+1]}fe=Te.encode(ve,fe,q[pe],U[pe],z[pe],M,Q[pe],K[pe])}var Ne=Math.max(0,2*(T-4)),we=a.indices.length+3*Ne,Se=n.IndexDatatype.createTypedArray(l+T,we);Se.set(a.indices,0);var xe=1e-4,Me=($-J)*xe,be=(te-ee)*xe,Ae=-Me,Ce=Me,We=be,Pe=-be,De=l*Ee;return A(ve,De,he,Te,z,U,m,H,W,a.westSkirtHeight,h,u,Ae,0),A(ve,De+=a.westIndices.length*Ee,Ie,Te,z,U,m,H,W,a.southSkirtHeight,h,u,0,Pe),A(ve,De+=a.southIndices.length*Ee,ue,Te,z,U,m,H,W,a.eastSkirtHeight,h,u,Ce,0),A(ve,De+=a.eastIndices.length*Ee,le,Te,z,U,m,H,W,a.northSkirtHeight,h,u,0,We),g.addSkirtIndices(he,Ie,ue,le,l,Se,a.indices.length),c.push(ve.buffer,Se.buffer),{vertices:ve.buffer,indices:Se.buffer,westIndicesSouthToNorth:he,southIndicesEastToWest:Ie,eastIndicesNorthToSouth:ue,northIndicesWestToEast:le,vertexStride:Ee,center:V,minimumHeight:_,maximumHeight:G,occludeePointInScaledSpace:ce,encoding:Te,indexCountWithoutSkirts:a.indices.length}}))}));