qa-prevention-gwj-vue/static/map/cesium91/CesiumUnminified/Workers/createVerticesFromQuantized...

2 lines
8.3 KiB
JavaScript

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