2 lines
5.8 KiB
JavaScript
2 lines
5.8 KiB
JavaScript
|
define(["./AttributeCompression-e2e3f0dd","./Cartesian3-7e9cc2ff","./Matrix2-e3fb4559","./combine-3c023bda","./IndexDatatype-f1e3f799","./Math-5f585871","./createTaskProcessorWorker","./ComponentDatatype-aaeec80f","./defaultValue-81eec7ed","./Check-741c5f3c","./WebGLConstants-508b9636","./Matrix4-d34187af","./RuntimeError-26acdd3b"],(function(t,e,a,s,n,r,i,o,c,d,l,f,h){"use strict";const u=32767,C=Math.cos(r.CesiumMath.toRadians(150)),p=new a.Cartographic,m=new e.Cartesian3;const b=new a.Cartographic,A=new a.Cartographic;function w(t){const e=8*t,a=3*e,s=4*e;this.startEllipsoidNormals=new Float32Array(a),this.endEllipsoidNormals=new Float32Array(a),this.startPositionAndHeights=new Float32Array(s),this.startFaceNormalAndVertexCornerIds=new Float32Array(s),this.endPositionAndHeights=new Float32Array(s),this.endFaceNormalAndHalfWidths=new Float32Array(s),this.vertexBatchIds=new Uint16Array(e),this.indices=n.IndexDatatype.createTypedArray(e,36*t),this.vec3Offset=0,this.vec4Offset=0,this.batchIdOffset=0,this.indexOffset=0,this.volumeStartIndex=0}const g=new e.Cartesian3,y=new e.Cartesian3;function N(t,a,s,n,r){const i=e.Cartesian3.subtract(s,a,y);let o=e.Cartesian3.subtract(a,t,g);return e.Cartesian3.normalize(i,i),e.Cartesian3.normalize(o,o),e.Cartesian3.dot(i,o)<C&&(o=e.Cartesian3.multiplyByScalar(o,-1,g)),e.Cartesian3.add(i,o,r),e.Cartesian3.equals(r,e.Cartesian3.ZERO)&&(r=e.Cartesian3.subtract(t,a)),e.Cartesian3.cross(r,n,r),e.Cartesian3.cross(n,r,r),e.Cartesian3.normalize(r,r),r}const k=[0,2,6,0,6,4,0,1,3,0,3,2,0,4,5,0,5,1,5,3,1,5,7,3,7,5,4,7,4,6,7,6,2,7,2,3],x=k.length,I=new e.Cartesian3,E=new e.Cartesian3,F=new e.Cartesian3,H=new e.Cartesian3,O=new e.Cartesian3;w.prototype.addVolume=function(t,a,s,n,r,i,o,c,d,l){let f=e.Cartesian3.add(a,d,I);const h=l.geodeticSurfaceNormal(f,E);f=e.Cartesian3.add(s,d,I);const u=l.geodeticSurfaceNormal(f,H),C=N(t,a,s,h,F),p=N(n,s,a,u,O),m=this.startEllipsoidNormals,b=this.endEllipsoidNormals,A=this.startPositionAndHeights,w=this.startFaceNormalAndVertexCornerIds,g=this.endPositionAndHeights,y=this.endFaceNormalAndHalfWidths,P=this.vertexBatchIds;let v,D=this.batchIdOffset,M=this.vec3Offset,S=this.vec4Offset;for(v=0;v<8;v++)e.Cartesian3.pack(h,m,M),e.Cartesian3.pack(u,b,M),e.Cartesian3.pack(a,A,S),A[S+3]=r,e.Cartesian3.pack(s,g,S),g[S+3]=i,e.Cartesian3.pack(C,w,S),w[S+3]=v,e.Cartesian3.pack(p,y,S),y[S+3]=o,P[D++]=c,M+=3,S+=4;this.batchIdOffset=D,this.vec3Offset=M,this.vec4Offset=S;const R=this.indices,U=this.volumeStartIndex,B=this.indexOffset;for(v=0;v<x;v++)R[B+v]=k[v]+U;this.volumeStartIndex+=8,this.indexOffset+=x};const P=new a.Rectangle,v=new a.Ellipsoid,D=new e.Cartesian3,M=new e.Cartesian3,S=new e.Cartesian3,R=new e.Cartesian3,U=new e.Cartesian3;return i((function(i,o){const c=new Uint16Array(i.positions),d=new Uint16Array(i.widths),l=new Uint32Array(i.counts),f=new Uint16Array(i.batchIds),h=P,C=v,g=D,y=new Float64Array(i.packedBuffer);let N=0;const k=y[N++],x=y[N++];let I;a.Rectangle.unpack(y,N,h),N+=a.Rectangle.packedLength,a.Ellipsoid.unpack(y,N,C),N+=a.Ellipsoid.packedLength,e.Cartesian3.unpack(y,N,g);let E=c.length/3;const F=c.subarray(0,E),H=c.subarray(E,2*E),O=c.subarray(2*E,3*E);t.AttributeCompression.zigZagDeltaDecode(F,H,O),function(t,e,s,n){const r=n.length,i=t.length,o=new Uint8Array(i),c=b,d=A;let l=0;for(let s=0;s<r;s++){const r=n[s];let i=r;for(let s=1;s<r;s++){const n=l+s,r=n-1;d.longitude=t[n],d.latitude=e[n],c.longitude=t[r],c.latitude=e[r],a.Cartographic.equals(d,c)&&(i--,o[r]=1)}n[s]=i,l+=r}let f=0;for(let a=0;a<i;a++)1!==o[a]&&(t[f]=t[a],e[f]=e[a],s[f]=s[a],f++)}(F,H,O,l);const B=l.length;let V=0;for(I=0;I<B;I++){V+=l[I]-1}const T=new w(V),W=function(t,s,n,i,o,c,d){const l=t.length,f=new Float64Array(3*l);for(let h=0;h<l;++h){const l=t[h],C=s[h],b=n[h],A=r.CesiumMath.lerp(i.west,i.east,l/u),w=r.CesiumMath.lerp(i.south,i.north,C/u),g=r.CesiumMath.lerp(o,c,b/u),y=a.Cartographic.fromRadians(A,w,g,p),N=d.cartographicToCartesian(y,m);e.Cartesian3.pack(N,f,3*h)}return f}(F,H,O,h,k,x,C);E=F.length;const z=new Float32Array(3*E);for(I=0;I<E;++I)z[3*I]=W[3*I]-g.x,z[3*I
|