createVectorTileGeometries.js 4.9 KB

1
  1. define(["./buildModuleUrl-3d15f25c","./BoxGeometry-c0ece396","./Cartographic-67e73ef9","./Color-45274500","./CylinderGeometry-6f090f14","./when-92c6cf3c","./EllipsoidGeometry-6c2860c7","./IndexDatatype-4c0e98b8","./PrimitiveType-cdfe443e","./createTaskProcessorWorker","./Check-52a7d806","./Rectangle-bab7abf0","./Math-92c3b5f7","./Intersect-b97e930a","./Event-3390cd7d","./RuntimeError-c6a62a80","./arrayFill-0358accf","./ComponentDatatype-81047f82","./WebGLConstants-71f10989","./GeometryAttribute-ef657318","./Cartesian2-6033fa5d","./FeatureDetection-067cb23c","./Cartesian4-ad128b5d","./GeometryAttributes-7f66ea53","./GeometryOffsetAttribute-b4d599f5","./VertexFormat-f496a3f1","./CylinderGeometryLibrary-6601cb33"],(function(e,t,n,r,a,i,o,c,s,d,f,l,u,h,b,y,p,v,g,m,I,x,k,w,A,B,O){"use strict";function C(e){this.offset=e.offset,this.count=e.count,this.color=e.color,this.batchIds=e.batchIds}var L=new n.t,E=s.y.packedLength+n.t.packedLength,U=s.y.packedLength+2,M=s.y.packedLength+n.t.packedLength,F=n.t.packedLength+1,T={modelMatrix:new s.y,boundingVolume:new e.i};function V(e,t){var r=t*E,a=n.t.unpack(e,r,L);r+=n.t.packedLength;var i=s.y.unpack(e,r,T.modelMatrix);s.y.multiplyByScale(i,a,i);var o=T.boundingVolume;return n.t.clone(n.t.ZERO,o.center),o.radius=Math.sqrt(3),T}function G(e,t){var r=t*U,a=e[r++],i=e[r++],o=n.t.fromElements(a,a,i,L),c=s.y.unpack(e,r,T.modelMatrix);s.y.multiplyByScale(c,o,c);var d=T.boundingVolume;return n.t.clone(n.t.ZERO,d.center),d.radius=Math.sqrt(2),T}function R(e,t){var r=t*M,a=n.t.unpack(e,r,L);r+=n.t.packedLength;var i=s.y.unpack(e,r,T.modelMatrix);s.y.multiplyByScale(i,a,i);var o=T.boundingVolume;return n.t.clone(n.t.ZERO,o.center),o.radius=1,T}function S(e,t){var r=t*F,a=e[r++],i=n.t.unpack(e,r,L),o=s.y.fromTranslation(i,T.modelMatrix);s.y.multiplyByUniformScale(o,a,o);var c=T.boundingVolume;return n.t.clone(n.t.ZERO,c.center),c.radius=1,T}var D=new n.t;function P(t,a,o,c,d){if(i.e(a)){for(var f=o.length,l=c.attributes.position.values,u=c.indices,h=t.positions,b=t.vertexBatchIds,y=t.indices,p=t.batchIds,v=t.batchTableColors,g=t.batchedIndices,m=t.indexOffsets,I=t.indexCounts,x=t.boundingVolumes,k=t.modelMatrix,w=t.center,A=t.positionOffset,B=t.batchIdIndex,O=t.indexOffset,L=t.batchedIndicesOffset,E=0;E<f;++E){var U=d(a,E),M=U.modelMatrix;s.y.multiply(k,M,M);for(var F=o[E],T=l.length,V=0;V<T;V+=3){var G=n.t.unpack(l,V,D);s.y.multiplyByPoint(M,G,G),n.t.subtract(G,w,G),n.t.pack(G,h,3*A+V),b[B++]=F}for(var R=u.length,S=0;S<R;++S)y[O+S]=u[S]+A;var P=E+L;g[P]=new C({offset:O,count:R,color:r.e.fromRgba(v[F]),batchIds:[F]}),p[P]=F,m[P]=O,I[P]=R,x[P]=e.i.transform(U.boundingVolume,M),A+=T/3,O+=R}t.positionOffset=A,t.batchIdIndex=B,t.indexOffset=O,t.batchedIndicesOffset+=f}}var Z=new n.t,q=new s.y;function W(t,n,a){var i=a.length,o=2+i*e.i.packedLength+1+function(e){for(var t=e.length,n=0,a=0;a<t;++a)n+=r.e.packedLength+3+e[a].batchIds.length;return n}(n),c=new Float64Array(o),s=0;c[s++]=t,c[s++]=i;for(var d=0;d<i;++d)e.i.pack(a[d],c,s),s+=e.i.packedLength;var f=n.length;c[s++]=f;for(var l=0;l<f;++l){var u=n[l];r.e.pack(u.color,c,s),s+=r.e.packedLength,c[s++]=u.offset,c[s++]=u.count;var h=u.batchIds,b=h.length;c[s++]=b;for(var y=0;y<b;++y)c[s++]=h[y]}return c}return d((function(e,r){var d=i.e(e.boxes)?new Float32Array(e.boxes):void 0,f=i.e(e.boxBatchIds)?new Uint16Array(e.boxBatchIds):void 0,l=i.e(e.cylinders)?new Float32Array(e.cylinders):void 0,u=i.e(e.cylinderBatchIds)?new Uint16Array(e.cylinderBatchIds):void 0,h=i.e(e.ellipsoids)?new Float32Array(e.ellipsoids):void 0,b=i.e(e.ellipsoidBatchIds)?new Uint16Array(e.ellipsoidBatchIds):void 0,y=i.e(e.spheres)?new Float32Array(e.spheres):void 0,p=i.e(e.sphereBatchIds)?new Uint16Array(e.sphereBatchIds):void 0,v=i.e(d)?f.length:0,g=i.e(l)?u.length:0,m=i.e(h)?b.length:0,I=i.e(y)?p.length:0,x=t.O.getUnitBox(),k=a.l.getUnitCylinder(),w=o.b.getUnitEllipsoid(),A=x.attributes.position.values,B=k.attributes.position.values,O=w.attributes.position.values,C=A.length*v;C+=B.length*g,C+=O.length*(m+I);var L=x.indices,E=k.indices,U=w.indices,M=L.length*v;M+=E.length*g,M+=U.length*(m+I);var F=new Float32Array(C),T=new Uint16Array(C/3),D=c.IndexDatatype.createTypedArray(C/3,M),_=v+g+m+I,N=new Uint16Array(_),Y=new Array(_),j=new Uint32Array(_),z=new Uint32Array(_),H=new Array(_);!function(e){var t=new Float64Array(e),r=0;n.t.unpack(t,r,Z),r+=n.t.packedLength,s.y.unpack(t,r,q)}(e.packedBuffer);var J={batchTableColors:new Uint32Array(e.batchTableColors),positions:F,vertexBatchIds:T,indices:D,batchIds:N,batchedIndices:Y,indexOffsets:j,indexCounts:z,boundingVolumes:H,positionOffset:0,batchIdIndex:0,indexOffset:0,batchedIndicesOffset:0,modelMatrix:q,center:Z};P(J,d,f,x,V),P(J,l,u,k,G),P(J,h,b,w,R),P(J,y,p,w,S);var K=W(D.BYTES_PER_ELEMENT,Y,H);return r.push(F.buffer,T.buffer,D.buffer),r.push(N.buffer,j.buffer,z.buffer),r.push(K.buffer),{positions:F.buffer,vertexBatchIds:T.buffer,indices:D.buffer,indexOffsets:j.buffer,indexCounts:z.buffer,batchIds:N.buffer,packedBuffer:K.buffer}}))}));