2 lines
7.0 KiB
JavaScript
2 lines
7.0 KiB
JavaScript
|
define(["exports","./GeometryOffsetAttribute-ed56ff58","./BoundingSphere-9a3b5656","./Cartesian2-bd414876","./Cartesian3-e0307675","./ComponentDatatype-aaeec80f","./defaultValue-81eec7ed","./Check-741c5f3c","./GeometryAttribute-2b42a913","./GeometryAttributes-32b29525","./IndexDatatype-3f3c99e8","./Math-e73894ab","./VertexFormat-d50a69ba"],(function(t,e,a,n,i,r,o,s,m,u,c,l,f){"use strict";const d=new i.Cartesian3,C=new i.Cartesian3,p=new i.Cartesian3,y=new i.Cartesian3,_=new i.Cartesian3,h=new i.Cartesian3(1,1,1),A=Math.cos,x=Math.sin;function b(t){t=o.defaultValue(t,o.defaultValue.EMPTY_OBJECT);const e=o.defaultValue(t.radii,h),a=o.defaultValue(t.innerRadii,e),n=o.defaultValue(t.minimumClock,0),r=o.defaultValue(t.maximumClock,l.CesiumMath.TWO_PI),s=o.defaultValue(t.minimumCone,0),m=o.defaultValue(t.maximumCone,l.CesiumMath.PI),u=Math.round(o.defaultValue(t.stackPartitions,64)),c=Math.round(o.defaultValue(t.slicePartitions,64)),d=o.defaultValue(t.vertexFormat,f.VertexFormat.DEFAULT);this._radii=i.Cartesian3.clone(e),this._innerRadii=i.Cartesian3.clone(a),this._minimumClock=n,this._maximumClock=r,this._minimumCone=s,this._maximumCone=m,this._stackPartitions=u,this._slicePartitions=c,this._vertexFormat=f.VertexFormat.clone(d),this._offsetAttribute=t.offsetAttribute,this._workerName="createEllipsoidGeometry"}b.packedLength=2*i.Cartesian3.packedLength+f.VertexFormat.packedLength+7,b.pack=function(t,e,a){return a=o.defaultValue(a,0),i.Cartesian3.pack(t._radii,e,a),a+=i.Cartesian3.packedLength,i.Cartesian3.pack(t._innerRadii,e,a),a+=i.Cartesian3.packedLength,f.VertexFormat.pack(t._vertexFormat,e,a),a+=f.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]=o.defaultValue(t._offsetAttribute,-1),e};const k=new i.Cartesian3,w=new i.Cartesian3,F=new f.VertexFormat,g={radii:k,innerRadii:w,vertexFormat:F,minimumClock:void 0,maximumClock:void 0,minimumCone:void 0,maximumCone:void 0,stackPartitions:void 0,slicePartitions:void 0,offsetAttribute:void 0};let P;b.unpack=function(t,e,a){e=o.defaultValue(e,0);const n=i.Cartesian3.unpack(t,e,k);e+=i.Cartesian3.packedLength;const r=i.Cartesian3.unpack(t,e,w);e+=i.Cartesian3.packedLength;const s=f.VertexFormat.unpack(t,e,F);e+=f.VertexFormat.packedLength;const m=t[e++],u=t[e++],c=t[e++],l=t[e++],d=t[e++],C=t[e++],p=t[e];return o.defined(a)?(a._radii=i.Cartesian3.clone(n,a._radii),a._innerRadii=i.Cartesian3.clone(r,a._innerRadii),a._vertexFormat=f.VertexFormat.clone(s,a._vertexFormat),a._minimumClock=m,a._maximumClock=u,a._minimumCone=c,a._maximumCone=l,a._stackPartitions=d,a._slicePartitions=C,a._offsetAttribute=-1===p?void 0:p,a):(g.minimumClock=m,g.maximumClock=u,g.minimumCone=c,g.maximumCone=l,g.stackPartitions=d,g.slicePartitions=C,g.offsetAttribute=-1===p?void 0:p,new b(g))},b.createGeometry=function(t){const s=t._radii;if(s.x<=0||s.y<=0||s.z<=0)return;const f=t._innerRadii;if(f.x<=0||f.y<=0||f.z<=0)return;const h=t._minimumClock,b=t._maximumClock,k=t._minimumCone,w=t._maximumCone,F=t._vertexFormat;let g,P,v=t._slicePartitions+1,V=t._stackPartitions+1;v=Math.round(v*Math.abs(b-h)/l.CesiumMath.TWO_PI),V=Math.round(V*Math.abs(w-k)/l.CesiumMath.PI),v<2&&(v=2),V<2&&(V=2);let M=0;const T=[k],D=[h];for(g=0;g<V;g++)T.push(k+g*(w-k)/(V-1));for(T.push(w),P=0;P<v;P++)D.push(h+P*(b-h)/(v-1));D.push(b);const G=T.length,L=D.length;let O=0,I=1;const E=f.x!==s.x||f.y!==s.y||f.z!==s.z;let z=!1,N=!1,R=!1;E&&(I=2,k>0&&(z=!0,O+=v-1),w<Math.PI&&(N=!0,O+=v-1),(b-h)%l.CesiumMath.TWO_PI?(R=!0,O+=2*(V-1)+1):O+=1);const S=L*G*I,U=new Float64Array(3*S),B=e.arrayFill(new Array(S),!1),W=e.arrayFill(new Array(S),!1),Y=v*V*I,J=6*(Y+O+1-(v+V)*I),X=c.IndexDatatype.createTypedArray(Y,J),Z=F.normal?new Float32Array(3*S):void 0,j=F.tangent?new Float32Array(3*S):void 0,q=F.bitangent?new Float32Array(3*S):void 0,H=F.st?new Float32Array(2*S):void 0,K=new Array(G),Q=new Array(G);for(g=0;g<G;g++)K[g]=x(T[g]),Q[g]=A(T[g]);const $=new Array(L),tt=new Array(L);for(P=0;P<L;P++)tt[P]=A(D[P]),$[P]=x(D[P]);for(g=0;g<
|