Agriculture-front-end/dist/Cesium/Workers/createVectorTileGeometries.js
2023-09-11 21:56:39 +08:00

2 lines
5.4 KiB
JavaScript

define(["./BoundingSphere-561b54d0","./BoxGeometry-0dd3f663","./Cartographic-3309dd0d","./Color-5008547b","./CylinderGeometry-3c6f6674","./when-b60132fc","./EllipsoidGeometry-0bb3b822","./IndexDatatype-8a5eead4","./createTaskProcessorWorker","./Check-7b2a090c","./Cartesian2-47311507","./Math-119be1a3","./Cartesian4-3ca25aab","./RuntimeError-4a5c8994","./arrayFill-4513d7ad","./ComponentDatatype-c140a87d","./WebGLConstants-4ae0db90","./GeometryAttribute-3a42bbdc","./PrimitiveType-39acab88","./Transforms-cb0006b0","./buildModuleUrl-3addfe33","./FeatureDetection-c3b71206","./GeometryAttributes-252e9929","./GeometryOffsetAttribute-fbeb6f1a","./VertexFormat-6446fca0","./CylinderGeometryLibrary-aa453214"],(function(e,t,a,r,n,i,o,d,s,c,f,l,u,h,b,p,y,g,v,x,C,m,I,k,M,B){"use strict";function w(e){this.offset=e.offset,this.count=e.count,this.color=e.color,this.batchIds=e.batchIds}var A=new a.Cartesian3,O=e.Matrix4.packedLength+a.Cartesian3.packedLength,L=e.Matrix4.packedLength+2,E=e.Matrix4.packedLength+a.Cartesian3.packedLength,U=a.Cartesian3.packedLength+1,G={modelMatrix:new e.Matrix4,boundingVolume:new e.BoundingSphere};function S(t,r){var n=r*O,i=a.Cartesian3.unpack(t,n,A);n+=a.Cartesian3.packedLength;var o=e.Matrix4.unpack(t,n,G.modelMatrix);e.Matrix4.multiplyByScale(o,i,o);var d=G.boundingVolume;return a.Cartesian3.clone(a.Cartesian3.ZERO,d.center),d.radius=Math.sqrt(3),G}function F(t,r){var n=r*L,i=t[n++],o=t[n++],d=a.Cartesian3.fromElements(i,i,o,A),s=e.Matrix4.unpack(t,n,G.modelMatrix);e.Matrix4.multiplyByScale(s,d,s);var c=G.boundingVolume;return a.Cartesian3.clone(a.Cartesian3.ZERO,c.center),c.radius=Math.sqrt(2),G}function T(t,r){var n=r*E,i=a.Cartesian3.unpack(t,n,A);n+=a.Cartesian3.packedLength;var o=e.Matrix4.unpack(t,n,G.modelMatrix);e.Matrix4.multiplyByScale(o,i,o);var d=G.boundingVolume;return a.Cartesian3.clone(a.Cartesian3.ZERO,d.center),d.radius=1,G}function V(t,r){var n=r*U,i=t[n++],o=a.Cartesian3.unpack(t,n,A),d=e.Matrix4.fromTranslation(o,G.modelMatrix);e.Matrix4.multiplyByUniformScale(d,i,d);var s=G.boundingVolume;return a.Cartesian3.clone(a.Cartesian3.ZERO,s.center),s.radius=1,G}var R=new a.Cartesian3;function D(t,n,o,d,s){if(i.defined(n)){for(var c=o.length,f=d.attributes.position.values,l=d.indices,u=t.positions,h=t.vertexBatchIds,b=t.indices,p=t.batchIds,y=t.batchTableColors,g=t.batchedIndices,v=t.indexOffsets,x=t.indexCounts,C=t.boundingVolumes,m=t.modelMatrix,I=t.center,k=t.positionOffset,M=t.batchIdIndex,B=t.indexOffset,A=t.batchedIndicesOffset,O=0;O<c;++O){var L=s(n,O),E=L.modelMatrix;e.Matrix4.multiply(m,E,E);for(var U=o[O],G=f.length,S=0;S<G;S+=3){var F=a.Cartesian3.unpack(f,S,R);e.Matrix4.multiplyByPoint(E,F,F),a.Cartesian3.subtract(F,I,F),a.Cartesian3.pack(F,u,3*k+S),h[M++]=U}for(var T=l.length,V=0;V<T;++V)b[B+V]=l[V]+k;var D=O+A;g[D]=new w({offset:B,count:T,color:r.Color.fromRgba(y[U]),batchIds:[U]}),p[D]=U,v[D]=B,x[D]=T,C[D]=e.BoundingSphere.transform(L.boundingVolume,E),k+=G/3,B+=T}t.positionOffset=k,t.batchIdIndex=M,t.indexOffset=B,t.batchedIndicesOffset+=c}}var P=new a.Cartesian3,Z=new e.Matrix4;function q(t,a,n){var i=n.length,o=2+i*e.BoundingSphere.packedLength+1+function(e){for(var t=e.length,a=0,n=0;n<t;++n)a+=r.Color.packedLength+3+e[n].batchIds.length;return a}(a),d=new Float64Array(o),s=0;d[s++]=t,d[s++]=i;for(var c=0;c<i;++c)e.BoundingSphere.pack(n[c],d,s),s+=e.BoundingSphere.packedLength;var f=a.length;d[s++]=f;for(var l=0;l<f;++l){var u=a[l];r.Color.pack(u.color,d,s),s+=r.Color.packedLength,d[s++]=u.offset,d[s++]=u.count;var h=u.batchIds,b=h.length;d[s++]=b;for(var p=0;p<b;++p)d[s++]=h[p]}return d}return s((function(r,s){var c=i.defined(r.boxes)?new Float32Array(r.boxes):void 0,f=i.defined(r.boxBatchIds)?new Uint16Array(r.boxBatchIds):void 0,l=i.defined(r.cylinders)?new Float32Array(r.cylinders):void 0,u=i.defined(r.cylinderBatchIds)?new Uint16Array(r.cylinderBatchIds):void 0,h=i.defined(r.ellipsoids)?new Float32Array(r.ellipsoids):void 0,b=i.defined(r.ellipsoidBatchIds)?new Uint16Array(r.ellipsoidBatchIds):void 0,p=i.defined(r.spheres)?new Float32Array(r.spheres):void 0,y=i.defined(r.sphereBatchIds)?new Uint16Array(r.sphereBatchIds):void 0,g=i.defined(c)?f.length:0,v=i.defined(l)?u.length:0,x=i.defined(h)?b.length:0,C=i.defined(p)?y.length:0,m=t.BoxGeometry.getUnitBox(),I=n.CylinderGeometry.getUnitCylinder(),k=o.EllipsoidGeometry.getUnitEllipsoid(),M=m.attributes.position.values,B=I.attributes.position.values,w=k.attributes.position.values,A=M.length*g;A+=B.length*v,A+=w.length*(x+C);var O=m.indices,L=I.indices,E=k.indices,U=O.length*g;U+=L.length*v,U+=E.length*(x+C);var G=new Float32Array(A),R=new Uint16Array(A/3),W=d.IndexDatatype.createTypedArray(A/3,U),_=g+v+x+C,N=new Uint16Array(_),Y=new Array(_),j=new Uint32Array(_),z=new Uint32Array(_),H=new Array(_);!function(t){var r=new Float64Array(t),n=0;a.Cartesian3.unpack(r,n,P),n+=a.Cartesian3.packedLength,e.Matrix4.unpack(r,n,Z)}(r.packedBuffer);var J={batchTableColors:new Uint32Array(r.batchTableColors),positions:G,vertexBatchIds:R,indices:W,batchIds:N,batchedIndices:Y,indexOffsets:j,indexCounts:z,boundingVolumes:H,positionOffset:0,batchIdIndex:0,indexOffset:0,batchedIndicesOffset:0,modelMatrix:Z,center:P};D(J,c,f,m,S),D(J,l,u,I,F),D(J,h,b,k,T),D(J,p,y,k,V);var K=q(W.BYTES_PER_ELEMENT,Y,H);return s.push(G.buffer,R.buffer,W.buffer),s.push(N.buffer,j.buffer,z.buffer),s.push(K.buffer),{positions:G.buffer,vertexBatchIds:R.buffer,indices:W.buffer,indexOffsets:j.buffer,indexCounts:z.buffer,batchIds:N.buffer,packedBuffer:K.buffer}}))}));