1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-18 14:21:49 -05:00
sdrangel/plugins/feature/map/Cesium/Workers/createVerticesFromQuantizedTerrainMesh.js

2 lines
8.0 KiB
JavaScript
Raw Normal View History

2022-02-04 15:41:22 -05:00
define(["./AxisAlignedBoundingBox-8f6cec20","./Matrix2-46444433","./when-229515d6","./TerrainEncoding-d4f3205f","./IndexDatatype-7c683b18","./ComponentDatatype-692a36d3","./RuntimeError-608565a6","./Transforms-ab7258fe","./WebMercatorProjection-aa53f15d","./createTaskProcessorWorker","./AttributeCompression-95366034","./WebGLConstants-f63312fc","./combine-35b6d9cb"],(function(e,t,r,n,o,i,a,s,c,d,h,u,l){"use strict";function I(){a.DeveloperError.throwInstantiationError()}Object.defineProperties(I.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}});const g=[];I.getRegularGridIndices=function(e,t){let n=g[e];r.defined(n)||(g[e]=n=[]);let o=n[t];return r.defined(o)||(o=e*t<i.CesiumMath.SIXTY_FOUR_KILOBYTES?n[t]=new Uint16Array((e-1)*(t-1)*6):n[t]=new Uint32Array((e-1)*(t-1)*6),E(e,t,o,0)),o};const m=[];I.getRegularGridIndicesAndEdgeIndices=function(e,t){let n=m[e];r.defined(n)||(m[e]=n=[]);let o=n[t];if(!r.defined(o)){const r=I.getRegularGridIndices(e,t),i=f(e,t),a=i.westIndicesSouthToNorth,s=i.southIndicesEastToWest,c=i.eastIndicesNorthToSouth,d=i.northIndicesWestToEast;o=n[t]={indices:r,westIndicesSouthToNorth:a,southIndicesEastToWest:s,eastIndicesNorthToSouth:c,northIndicesWestToEast:d}}return o};const T=[];function f(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 E(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 p(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}I.getRegularGridAndSkirtIndicesAndEdgeIndices=function(e,t){let n=T[e];r.defined(n)||(T[e]=n=[]);let i=n[t];if(!r.defined(i)){const r=e*t,a=(e-1)*(t-1)*6,s=2*e+2*t,c=r+s,d=a+6*Math.max(0,s-4),h=f(e,t),u=h.westIndicesSouthToNorth,l=h.southIndicesEastToWest,g=h.eastIndicesNorthToSouth,m=h.northIndicesWestToEast,T=o.IndexDatatype.createTypedArray(c,d);E(e,t,T,0),I.addSkirtIndices(u,l,g,m,r,T,a),i=n[t]={indices:T,westIndicesSouthToNorth:u,southIndicesEastToWest:l,eastIndicesNorthToSouth:g,northIndicesWestToEast:m,indexCountWithoutSkirts:a}}return i},I.addSkirtIndices=function(e,t,r,n,o,i,a){let s=o;a=p(e,s,i,a),s+=e.length,a=p(t,s,i,a),s+=t.length,a=p(r,s,i,a),s+=r.length,p(n,s,i,a)},I.heightmapTerrainQuality=.25,I.getEstimatedLevelZeroGeometricErrorForAHeightmap=function(e,t,r){return 2*e.maximumRadius*Math.PI*I.heightmapTerrainQuality/(t*r)},I.prototype.requestTileGeometry=a.DeveloperError.throwInstantiationError,I.prototype.getLevelMaximumGeometricError=a.DeveloperError.throwInstantiationError,I.prototype.getTileDataAvailable=a.DeveloperError.throwInstantiationError,I.prototype.loadTileDataAvailability=a.DeveloperError.throwInstantiationError;const y=32767,N=new t.Cartesian3,w=new t.Cartesian3,S=new t.Cartesian3,M=new t.Cartographic,x=new t.Cartesian2;function b(e,r,n,o,a,s,c,d,h){let u=Number.POSITIVE_INFINITY;const l=a.north,I=a.south;let g=a.east;const m=a.west;g<m&&(g+=i.CesiumMath.TWO_PI);const T=e.length;for(let a=0;a<T;++a){const T=e[a],f=n[T],E=o[T];M.longitude=i.CesiumMath.lerp(m,g,E.x),M.latitude=i.CesiumMath.lerp(I,l,E.y),M.height=f-r;const p=s.cartographicToCartesian(M,N);t.Matrix4.multiplyByPoint(c,p,p),t.Cartesian3.minimumByComponent(p,d,d),t.Cartesian3.maximumByComponent(p,h,h),u=Math.min(u,M.height)}return u}function A(e,t,n,o,a,s,d,h,u,l,I,g,m,T){const f=r.defined(d),E=u.north,p=u.south;let y