Agriculture-front-end/public/Cesium/Workers/createVerticesFromQuantizedTerrainMesh.js

2 lines
9.9 KiB
JavaScript
Raw Normal View History

2023-09-11 21:56:39 +08:00
define(["./AttributeCompression-90851096","./EllipsoidTangentPlane-b2b18d75","./BoundingSphere-561b54d0","./Cartesian2-47311507","./Cartographic-3309dd0d","./when-b60132fc","./TerrainEncoding-e04be3ba","./IndexDatatype-8a5eead4","./Math-119be1a3","./OrientedBoundingBox-f1d7843f","./Check-7b2a090c","./Transforms-cb0006b0","./WebMercatorProjection-01b1b5e7","./createTaskProcessorWorker","./Cartesian4-3ca25aab","./IntersectionTests-0c6d0a14","./Plane-097b3a8f","./RuntimeError-4a5c8994","./ComponentDatatype-c140a87d","./WebGLConstants-4ae0db90","./buildModuleUrl-3addfe33","./FeatureDetection-c3b71206"],(function(e,t,r,n,i,o,a,s,d,c,u,h,l,I,m,g,T,f,p,v,E,y){"use strict";function w(){u.DeveloperError.throwInstantiationError()}Object.defineProperties(w.prototype,{errorEvent:{get:u.DeveloperError.throwInstantiationError},credit:{get:u.DeveloperError.throwInstantiationError},tilingScheme:{get:u.DeveloperError.throwInstantiationError},ready:{get:u.DeveloperError.throwInstantiationError},readyPromise:{get:u.DeveloperError.throwInstantiationError},hasWaterMask:{get:u.DeveloperError.throwInstantiationError},hasVertexNormals:{get:u.DeveloperError.throwInstantiationError},availability:{get:u.DeveloperError.throwInstantiationError}});var N=[];w.getRegularGridIndices=function(e,t){var r=N[e];o.defined(r)||(N[e]=r=[]);var n=r[t];return o.defined(n)||C(e,t,n=e*t<d.CesiumMath.SIXTY_FOUR_KILOBYTES?r[t]=new Uint16Array((e-1)*(t-1)*6+3*(e+t-2)):r[t]=new Uint32Array((e-1)*(t-1)*6+3*(e+t-2)),0),n},w.getRegularGridIndicesForReproject=function(e,t){var r=N[e];o.defined(r)||(N[e]=r=[]);var n=r[t];return o.defined(n)||C(e,t,n=e*t<d.CesiumMath.SIXTY_FOUR_KILOBYTES?r[t]=new Uint16Array((e-1)*(t-1)*6):r[t]=new Uint32Array((e-1)*(t-1)*6),0),n};var b=[];w.getRegularGridIndicesAndEdgeIndices=function(e,t){var r=b[e];o.defined(r)||(b[e]=r=[]);var n=r[t];if(!o.defined(n)){var i=w.getRegularGridIndices(e,t),a=M(e,t),s=a.westIndicesSouthToNorth,d=a.southIndicesEastToWest,c=a.eastIndicesNorthToSouth,u=a.northIndicesWestToEast;n=r[t]={indices:i,westIndicesSouthToNorth:s,southIndicesEastToWest:d,eastIndicesNorthToSouth:c,northIndicesWestToEast:u}}return n};var x=[];function M(e,t){var r,n=new Array(t),i=new Array(e),o=new Array(t),a=new Array(e);for(r=0;r<e;++r)a[r]=r,i[r]=e*t-1-r;for(r=0;r<t;++r)o[r]=(r+1)*e-1,n[r]=(t-r-1)*e;return{westIndicesSouthToNorth:n,southIndicesEastToWest:i,eastIndicesNorthToSouth:o,northIndicesWestToEast:a}}function C(e,t,r,n){for(var i=0,o=0;o<t-1;++o){for(var a=0;a<e-1;++a){var s=i,d=s+e,c=d+1,u=s+1;r[n++]=s,r[n++]=d,r[n++]=u,r[n++]=u,r[n++]=d,r[n++]=c,++i}++i}var h=(t-1)/2,l=(e-1)/2;i=0;for(a=0;a<l;a++)r[n++]=i,r[n++]=i+1,r[n++]=i+2,i+=2;i=e*(t-1);for(a=0;a<l;a++)r[n++]=i+1,r[n++]=i,r[n++]=i+2,i+=2;i=0;for(a=0;a<h;a++)r[n++]=i+e,r[n++]=i,r[n++]=i+2*e,i+=2*e;i=e-1;for(a=0;a<h;a++)r[n++]=i,r[n++]=i+e,r[n++]=i+2*e,i+=2*e}function S(e,t,r,n,i){for(var a=o.defined(i),s=e[0],d=e.length,c=1;c<d;++c){var u=e[c];!a||i[s+"_"+u]?(r[n++]=s,r[n++]=u,r[n++]=t,r[n++]=t,r[n++]=u,r[n++]=t+1,s=u,++t):(s=u,++t)}return n}w.getRegularGridAndSkirtIndicesAndEdgeIndices=function(e,t){var r=x[e];o.defined(r)||(x[e]=r=[]);var n=r[t];if(!o.defined(n)){var i=e*t,a=(e-1)*(t-1)*6,d=2*e+2*t,c=i+d,u=3*(e+t-2),h=a+6*Math.max(0,d-4)+u,l=M(e,t),I=l.westIndicesSouthToNorth,m=l.southIndicesEastToWest,g=l.eastIndicesNorthToSouth,T=l.northIndicesWestToEast,f=s.IndexDatatype.createTypedArray(c,h);C(e,t,f,0),w.addSkirtIndices(I,m,g,T,i,f,a+u),n=r[t]={indices:f,westIndicesSouthToNorth:I,southIndicesEastToWest:m,eastIndicesNorthToSouth:g,northIndicesWestToEast:T,indexCountWithoutSkirts:a}}return n},w.addSkirtIndices=function(e,t,r,n,i,o,a,s){var d=i;a=S(e,d,o,a,s),a=S(t,d+=e.length,o,a,s),a=S(r,d+=t.length,o,a,s),S(n,d+=r.length,o,a,s)},w.heightmapTerrainQuality=.25,w.getEstimatedLevelZeroGeometricErrorForAHeightmap=function(e,t,r){return 2*e.maximumRadius*Math.PI*w.heightmapTerrainQuality/(t*r)},w.prototype.requestTileGeometry=u.DeveloperError.throwInstantiationError,w.prototype.getLevelMaximumGeometricError=u.DeveloperError.throwInstantiationError,w.prototype.getTileDataA