qd-changjing/public/static/Build/Cesium/Workers/EllipsoidGeometry-1756cc4a.js

2 lines
7.0 KiB
JavaScript
Raw Normal View History

2022-07-05 16:56:29 +08:00
define(["exports","./GeometryOffsetAttribute-821af768","./Transforms-f15de320","./Matrix2-c6c16658","./ComponentDatatype-3d0a0aac","./when-4bbc8319","./RuntimeError-5b082e8f","./GeometryAttribute-8350368e","./GeometryAttributes-7827a6c2","./IndexDatatype-ddbc25a7","./VertexFormat-7b982b01"],(function(t,e,a,n,i,r,o,s,m,u,c){"use strict";const l=new n.Cartesian3,f=new n.Cartesian3,d=new n.Cartesian3,C=new n.Cartesian3,p=new n.Cartesian3,y=new n.Cartesian3(1,1,1),_=Math.cos,h=Math.sin;function x(t){t=r.defaultValue(t,r.defaultValue.EMPTY_OBJECT);const e=r.defaultValue(t.radii,y),a=r.defaultValue(t.innerRadii,e),o=r.defaultValue(t.minimumClock,0),s=r.defaultValue(t.maximumClock,i.CesiumMath.TWO_PI),m=r.defaultValue(t.minimumCone,0),u=r.defaultValue(t.maximumCone,i.CesiumMath.PI),l=Math.round(r.defaultValue(t.stackPartitions,64)),f=Math.round(r.defaultValue(t.slicePartitions,64)),d=r.defaultValue(t.vertexFormat,c.VertexFormat.DEFAULT);this._radii=n.Cartesian3.clone(e),this._innerRadii=n.Cartesian3.clone(a),this._minimumClock=o,this._maximumClock=s,this._minimumCone=m,this._maximumCone=u,this._stackPartitions=l,this._slicePartitions=f,this._vertexFormat=c.VertexFormat.clone(d),this._offsetAttribute=t.offsetAttribute,this._workerName="createEllipsoidGeometry"}x.packedLength=2*n.Cartesian3.packedLength+c.VertexFormat.packedLength+7,x.pack=function(t,e,a){return a=r.defaultValue(a,0),n.Cartesian3.pack(t._radii,e,a),a+=n.Cartesian3.packedLength,n.Cartesian3.pack(t._innerRadii,e,a),a+=n.Cartesian3.packedLength,c.VertexFormat.pack(t._vertexFormat,e,a),a+=c.VertexFormat.packedLength,e[a++]=t._minimumClock,e[a++]=t._maximumClock,e[a++]=t._minimumCone,e[a++]=t._maximumCone,e[a++]=t._stackPartitions,e[a++]=t._slicePartitions,e[a]=r.defaultValue(t._offsetAttribute,-1),e};const A=new n.Cartesian3,b=new n.Cartesian3,k=new c.VertexFormat,w={radii:A,innerRadii:b,vertexFormat:k,minimumClock:void 0,maximumClock:void 0,minimumCone:void 0,maximumCone:void 0,stackPartitions:void 0,slicePartitions:void 0,offsetAttribute:void 0};let F;x.unpack=function(t,e,a){e=r.defaultValue(e,0);const i=n.Cartesian3.unpack(t,e,A);e+=n.Cartesian3.packedLength;const o=n.Cartesian3.unpack(t,e,b);e+=n.Cartesian3.packedLength;const s=c.VertexFormat.unpack(t,e,k);e+=c.VertexFormat.packedLength;const m=t[e++],u=t[e++],l=t[e++],f=t[e++],d=t[e++],C=t[e++],p=t[e];return r.defined(a)?(a._radii=n.Cartesian3.clone(i,a._radii),a._innerRadii=n.Cartesian3.clone(o,a._innerRadii),a._vertexFormat=c.VertexFormat.clone(s,a._vertexFormat),a._minimumClock=m,a._maximumClock=u,a._minimumCone=l,a._maximumCone=f,a._stackPartitions=d,a._slicePartitions=C,a._offsetAttribute=-1===p?void 0:p,a):(w.minimumClock=m,w.maximumClock=u,w.minimumCone=l,w.maximumCone=f,w.stackPartitions=d,w.slicePartitions=C,w.offsetAttribute=-1===p?void 0:p,new x(w))},x.createGeometry=function(t){const o=t._radii;if(o.x<=0||o.y<=0||o.z<=0)return;const c=t._innerRadii;if(c.x<=0||c.y<=0||c.z<=0)return;const y=t._minimumClock,x=t._maximumClock,A=t._minimumCone,b=t._maximumCone,k=t._vertexFormat;let w,F,P=t._slicePartitions+1,g=t._stackPartitions+1;P=Math.round(P*Math.abs(x-y)/i.CesiumMath.TWO_PI),g=Math.round(g*Math.abs(b-A)/i.CesiumMath.PI),P<2&&(P=2),g<2&&(g=2);let v=0;const V=[A],M=[y];for(w=0;w<g;w++)V.push(A+w*(b-A)/(g-1));for(V.push(b),F=0;F<P;F++)M.push(y+F*(x-y)/(P-1));M.push(x);const T=V.length,D=M.length;let G=0,L=1;const O=c.x!==o.x||c.y!==o.y||c.z!==o.z;let I=!1,E=!1,z=!1;O&&(L=2,A>0&&(I=!0,G+=P-1),b<Math.PI&&(E=!0,G+=P-1),(x-y)%i.CesiumMath.TWO_PI?(z=!0,G+=2*(g-1)+1):G+=1);const N=D*T*L,R=new Float64Array(3*N),U=e.arrayFill(new Array(N),!1),S=e.arrayFill(new Array(N),!1),B=P*g*L,W=6*(B+G+1-(P+g)*L),Y=u.IndexDatatype.createTypedArray(B,W),J=k.normal?new Float32Array(3*N):void 0,X=k.tangent?new Float32Array(3*N):void 0,Z=k.bitangent?new Float32Array(3*N):void 0,j=k.st?new Float32Array(2*N):void 0,q=new Array(T),H=new Array(T);for(w=0;w<T;w++)q[w]=h(V[w]),H[w]=_(V[w]);const K=new Array(D),Q=new Array(D);for(F=0;F<D;F++)Q[F]=_(M[F]),K[F]=h(M[F]);for(w=0;w<T;w++)for(F=0;F<D;F++)R[v++]=o.x*q[w]*Q[F],R[v++]=o.y*q[