1 |
- define(["./when-54c2dc71","./Check-6c0211bc","./Math-fc8cecf5","./Cartesian2-bddc1162","./Transforms-ec27f304","./RuntimeError-2109023a","./WebGLConstants-76bb35d1","./ComponentDatatype-6d99a1ee","./GeometryAttribute-44fb48f1","./GeometryAttributes-4fcfcf40","./IndexDatatype-53503fee","./createTaskProcessorWorker","./GeometryOffsetAttribute-7350d9af","./VertexFormat-7572c785","./BoxGeometry-ee1413aa","./CylinderGeometryLibrary-b0214ab1","./CylinderGeometry-01400a36","./EllipsoidGeometry-ceb731dc","./Color-bc1ab1f9"],function(D,e,t,P,q,n,r,a,i,o,W,s,d,c,_,f,N,Y,S){"use strict";function T(e){this.offset=e.offset,this.count=e.count,this.color=e.color,this.batchIds=e.batchIds}var l=new P.Cartesian3,u=q.Matrix4.packedLength+P.Cartesian3.packedLength,h=q.Matrix4.packedLength+2,b=q.Matrix4.packedLength+P.Cartesian3.packedLength,p=P.Cartesian3.packedLength+1,y={modelMatrix:new q.Matrix4,boundingVolume:new q.BoundingSphere};function j(e,t){var n=t*u,r=P.Cartesian3.unpack(e,n,l);n+=P.Cartesian3.packedLength;var a=q.Matrix4.unpack(e,n,y.modelMatrix);q.Matrix4.multiplyByScale(a,r,a);var i=y.boundingVolume;return P.Cartesian3.clone(P.Cartesian3.ZERO,i.center),i.radius=Math.sqrt(3),y}function z(e,t){var n=t*h,r=e[n++],a=e[n++],i=P.Cartesian3.fromElements(r,r,a,l),o=q.Matrix4.unpack(e,n,y.modelMatrix);q.Matrix4.multiplyByScale(o,i,o);var s=y.boundingVolume;return P.Cartesian3.clone(P.Cartesian3.ZERO,s.center),s.radius=Math.sqrt(2),y}function H(e,t){var n=t*b,r=P.Cartesian3.unpack(e,n,l);n+=P.Cartesian3.packedLength;var a=q.Matrix4.unpack(e,n,y.modelMatrix);q.Matrix4.multiplyByScale(a,r,a);var i=y.boundingVolume;return P.Cartesian3.clone(P.Cartesian3.ZERO,i.center),i.radius=1,y}function J(e,t){var n=t*p,r=e[n++],a=P.Cartesian3.unpack(e,n,l),i=q.Matrix4.fromTranslation(a,y.modelMatrix);q.Matrix4.multiplyByUniformScale(i,r,i);var o=y.boundingVolume;return P.Cartesian3.clone(P.Cartesian3.ZERO,o.center),o.radius=1,y}var V=new P.Cartesian3;function K(e,t,n,r,a){if(D.defined(t)){for(var i=n.length,o=r.attributes.position.values,s=r.indices,d=e.positions,c=e.vertexBatchIds,f=e.indices,l=e.batchIds,u=e.batchTableColors,h=e.batchedIndices,b=e.indexOffsets,p=e.indexCounts,y=e.boundingVolumes,x=e.modelMatrix,g=e.center,v=e.positionOffset,C=e.batchIdIndex,m=e.indexOffset,I=e.batchedIndicesOffset,k=0;k<i;++k){var M=a(t,k),B=M.modelMatrix;q.Matrix4.multiply(x,B,B);for(var w=n[k],A=o.length,O=0;O<A;O+=3){var L=P.Cartesian3.unpack(o,O,V);q.Matrix4.multiplyByPoint(B,L,L),P.Cartesian3.subtract(L,g,L),P.Cartesian3.pack(L,d,3*v+O),c[C++]=w}for(var E=s.length,U=0;U<E;++U)f[m+U]=s[U]+v;var G=k+I;h[G]=new T({offset:m,count:E,color:S.Color.fromRgba(u[w]),batchIds:[w]}),l[G]=w,b[G]=m,p[G]=E,y[G]=q.BoundingSphere.transform(M.boundingVolume,B),v+=A/3,m+=E}e.positionOffset=v,e.batchIdIndex=C,e.indexOffset=m,e.batchedIndicesOffset+=i}}var Q=new P.Cartesian3,X=new q.Matrix4;function $(e,t,n){var r=n.length,a=2+r*q.BoundingSphere.packedLength+1+function(e){for(var t=e.length,n=0,r=0;r<t;++r)n+=S.Color.packedLength+3+e[r].batchIds.length;return n}(t),i=new Float64Array(a),o=0;i[o++]=e,i[o++]=r;for(var s=0;s<r;++s)q.BoundingSphere.pack(n[s],i,o),o+=q.BoundingSphere.packedLength;var d=t.length;i[o++]=d;for(var c=0;c<d;++c){var f=t[c];S.Color.pack(f.color,i,o),o+=S.Color.packedLength,i[o++]=f.offset,i[o++]=f.count;var l=f.batchIds,u=l.length;i[o++]=u;for(var h=0;h<u;++h)i[o++]=l[h]}return i}return s(function(e,t){var n=D.defined(e.boxes)?new Float32Array(e.boxes):void 0,r=D.defined(e.boxBatchIds)?new Uint16Array(e.boxBatchIds):void 0,a=D.defined(e.cylinders)?new Float32Array(e.cylinders):void 0,i=D.defined(e.cylinderBatchIds)?new Uint16Array(e.cylinderBatchIds):void 0,o=D.defined(e.ellipsoids)?new Float32Array(e.ellipsoids):void 0,s=D.defined(e.ellipsoidBatchIds)?new Uint16Array(e.ellipsoidBatchIds):void 0,d=D.defined(e.spheres)?new Float32Array(e.spheres):void 0,c=D.defined(e.sphereBatchIds)?new Uint16Array(e.sphereBatchIds):void 0,f=D.defined(n)?r.length:0,l=D.defined(a)?i.length:0,u=D.defined(o)?s.length:0,h=D.defined(d)?c.length:0,b=_.BoxGeometry.getUnitBox(),p=N.CylinderGeometry.getUnitCylinder(),y=Y.EllipsoidGeometry.getUnitEllipsoid(),x=b.attributes.position.values,g=p.attributes.position.values,v=y.attributes.position.values,C=x.length*f;C+=g.length*l,C+=v.length*(u+h);var m=b.indices,I=p.indices,k=y.indices,M=m.length*f;M+=I.length*l,M+=k.length*(u+h);var B,w,A,O=new Float32Array(C),L=new Uint16Array(C/3),E=W.IndexDatatype.createTypedArray(C/3,M),U=f+l+u+h,G=new Uint16Array(U),S=new Array(U),T=new Uint32Array(U),V=new Uint32Array(U),F=new Array(U);B=e.packedBuffer,w=new Float64Array(B),A=0,P.Cartesian3.unpack(w,0,Q),A+=P.Cartesian3.packedLength,q.Matrix4.unpack(w,A,X);var R={batchTableColors:new Uint32Array(e.batchTableColors),positions:O,vertexBatchIds:L,indices:E,batchIds:G,batchedIndices:S,indexOffsets:T,indexCounts:V,boundingVolumes:F,positionOffset:0,batchIdIndex:0,indexOffset:0,batchedIndicesOffset:0,modelMatrix:X,center:Q};K(R,n,r,b,j),K(R,a,i,p,z),K(R,o,s,y,H),K(R,d,c,y,J);var Z=$(E.BYTES_PER_ELEMENT,S,F);return t.push(O.buffer,L.buffer,E.buffer),t.push(G.buffer,T.buffer,V.buffer),t.push(Z.buffer),{positions:O.buffer,vertexBatchIds:L.buffer,indices:E.buffer,indexOffsets:T.buffer,indexCounts:V.buffer,batchIds:G.buffer,packedBuffer:Z.buffer}})});
|