1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-17 22:01:45 -05:00
sdrangel/plugins/feature/map/Cesium/Workers/createVectorTileGeometries.js

2 lines
5.3 KiB
JavaScript
Raw Normal View History

2022-02-04 15:41:22 -05:00
define(["./Transforms-ab7258fe","./BoxGeometry-ba84f4a6","./Matrix2-46444433","./Color-a2310132","./CylinderGeometry-27f14420","./when-229515d6","./EllipsoidGeometry-375a9e5a","./IndexDatatype-7c683b18","./createTaskProcessorWorker","./RuntimeError-608565a6","./ComponentDatatype-692a36d3","./WebGLConstants-f63312fc","./combine-35b6d9cb","./GeometryOffsetAttribute-4f901209","./GeometryAttribute-d3bef603","./GeometryAttributes-b253752a","./VertexFormat-7272aabd","./CylinderGeometryLibrary-471159cb"],(function(e,t,n,r,a,i,o,s,d,c,l,f,u,h,b,p,y,x){"use strict";function g(e){this.offset=e.offset,this.count=e.count,this.color=e.color,this.batchIds=e.batchIds}const m=new n.Cartesian3,C=n.Matrix4.packedLength+n.Cartesian3.packedLength,I=n.Matrix4.packedLength+2,k=n.Matrix4.packedLength+n.Cartesian3.packedLength,M=n.Cartesian3.packedLength+1,B={modelMatrix:new n.Matrix4,boundingVolume:new e.BoundingSphere};function w(e,t){let r=t*C;const a=n.Cartesian3.unpack(e,r,m);r+=n.Cartesian3.packedLength;const i=n.Matrix4.unpack(e,r,B.modelMatrix);n.Matrix4.multiplyByScale(i,a,i);const o=B.boundingVolume;return n.Cartesian3.clone(n.Cartesian3.ZERO,o.center),o.radius=Math.sqrt(3),B}function A(e,t){let r=t*I;const a=e[r++],i=e[r++],o=n.Cartesian3.fromElements(a,a,i,m),s=n.Matrix4.unpack(e,r,B.modelMatrix);n.Matrix4.multiplyByScale(s,o,s);const d=B.boundingVolume;return n.Cartesian3.clone(n.Cartesian3.ZERO,d.center),d.radius=Math.sqrt(2),B}function O(e,t){let r=t*k;const a=n.Cartesian3.unpack(e,r,m);r+=n.Cartesian3.packedLength;const i=n.Matrix4.unpack(e,r,B.modelMatrix);n.Matrix4.multiplyByScale(i,a,i);const o=B.boundingVolume;return n.Cartesian3.clone(n.Cartesian3.ZERO,o.center),o.radius=1,B}function L(e,t){let r=t*M;const a=e[r++],i=n.Cartesian3.unpack(e,r,m),o=n.Matrix4.fromTranslation(i,B.modelMatrix);n.Matrix4.multiplyByUniformScale(o,a,o);const s=B.boundingVolume;return n.Cartesian3.clone(n.Cartesian3.ZERO,s.center),s.radius=1,B}const v=new n.Cartesian3;function E(t,a,o,s,d){if(!i.defined(a))return;const c=o.length,l=s.attributes.position.values,f=s.indices,u=t.positions,h=t.vertexBatchIds,b=t.indices,p=t.batchIds,y=t.batchTableColors,x=t.batchedIndices,m=t.indexOffsets,C=t.indexCounts,I=t.boundingVolumes,k=t.modelMatrix,M=t.center;let B=t.positionOffset,w=t.batchIdIndex,A=t.indexOffset;const O=t.batchedIndicesOffset;for(let t=0;t<c;++t){const i=d(a,t),s=i.modelMatrix;n.Matrix4.multiply(k,s,s);const c=o[t],L=l.length;for(let e=0;e<L;e+=3){const t=n.Cartesian3.unpack(l,e,v);n.Matrix4.multiplyByPoint(s,t,t),n.Cartesian3.subtract(t,M,t),n.Cartesian3.pack(t,u,3*B+e),h[w++]=c}const E=f.length;for(let e=0;e<E;++e)b[A+e]=f[e]+B;const U=t+O;x[U]=new g({offset:A,count:E,color:r.Color.fromRgba(y[c]),batchIds:[c]}),p[U]=c,m[U]=A,C[U]=E,I[U]=e.BoundingSphere.transform(i.boundingVolume,s),B+=L/3,A+=E}t.positionOffset=B,t.batchIdIndex=w,t.indexOffset=A,t.batchedIndicesOffset+=c}const U=new n.Cartesian3,G=new n.Matrix4;function S(t,n,a){const i=a.length,o=2+i*e.BoundingSphere.packedLength+1+function(e){const t=e.length;let n=0;for(let a=0;a<t;++a)n+=r.Color.packedLength+3+e[a].batchIds.length;return n}(n),s=new Float64Array(o);let d=0;s[d++]=t,s[d++]=i;for(let t=0;t<i;++t)e.BoundingSphere.pack(a[t],s,d),d+=e.BoundingSphere.packedLength;const c=n.length;s[d++]=c;for(let e=0;e<c;++e){const t=n[e];r.Color.pack(t.color,s,d),d+=r.Color.packedLength,s[d++]=t.offset,s[d++]=t.count;const a=t.batchIds,i=a.length;s[d++]=i;for(let e=0;e<i;++e)s[d++]=a[e]}return s}return d((function(e,r){const d=i.defined(e.boxes)?new Float32Array(e.boxes):void 0,c=i.defined(e.boxBatchIds)?new Uint16Array(e.boxBatchIds):void 0,l=i.defined(e.cylinders)?new Float32Array(e.cylinders):void 0,f=i.defined(e.cylinderBatchIds)?new Uint16Array(e.cylinderBatchIds):void 0,u=i.defined(e.ellipsoids)?new Float32Array(e.ellipsoids):void 0,h=i.defined(e.ellipsoidBatchIds)?new Uint16Array(e.ellipsoidBatchIds):void 0,b=i.defined(e.spheres)?new Float32Array(e.spheres):void 0,p=i.defined(e.sphereBatchIds)?new Uint16Array(e.sphereBatchIds):void 0,y=i.defined(d)?c.length:0,x=i.defined(l)?f.length:0,