26 lines
7.8 KiB
JavaScript
26 lines
7.8 KiB
JavaScript
|
|
/**
|
||
|
|
* @license
|
||
|
|
* Cesium - https://github.com/CesiumGS/cesium
|
||
|
|
* Version 1.95
|
||
|
|
*
|
||
|
|
* Copyright 2011-2022 Cesium Contributors
|
||
|
|
*
|
||
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
|
* you may not use this file except in compliance with the License.
|
||
|
|
* You may obtain a copy of the License at
|
||
|
|
*
|
||
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
|
*
|
||
|
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
|
* See the License for the specific language governing permissions and
|
||
|
|
* limitations under the License.
|
||
|
|
*
|
||
|
|
* Columbus View (Pat. Pend.)
|
||
|
|
*
|
||
|
|
* Portions licensed separately.
|
||
|
|
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
|
||
|
|
*/
|
||
|
|
define(["exports","./Transforms-6c4dd71f","./Matrix2-6555478a","./ComponentDatatype-43ab226f","./defaultValue-ac2201bb","./RuntimeError-d45af186","./GeometryAttribute-a34d86d0","./GeometryAttributes-d060f8b5","./GeometryOffsetAttribute-a17b96d9","./IndexDatatype-88be9f5a","./VertexFormat-d53ce9da"],(function(t,e,a,n,i,r,o,s,m,u,c){"use strict";const l=new a.Cartesian3,f=new a.Cartesian3,d=new a.Cartesian3,C=new a.Cartesian3,p=new a.Cartesian3,y=new a.Cartesian3(1,1,1),_=Math.cos,h=Math.sin;function x(t){t=i.defaultValue(t,i.defaultValue.EMPTY_OBJECT);const e=i.defaultValue(t.radii,y),r=i.defaultValue(t.innerRadii,e),o=i.defaultValue(t.minimumClock,0),s=i.defaultValue(t.maximumClock,n.CesiumMath.TWO_PI),m=i.defaultValue(t.minimumCone,0),u=i.defaultValue(t.maximumCone,n.CesiumMath.PI),l=Math.round(i.defaultValue(t.stackPartitions,64)),f=Math.round(i.defaultValue(t.slicePartitions,64)),d=i.defaultValue(t.vertexFormat,c.VertexFormat.DEFAULT);this._radii=a.Cartesian3.clone(e),this._innerRadii=a.Cartesian3.clone(r),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*a.Cartesian3.packedLength+c.VertexFormat.packedLength+7,x.pack=function(t,e,n){return n=i.defaultValue(n,0),a.Cartesian3.pack(t._radii,e,n),n+=a.Cartesian3.packedLength,a.Cartesian3.pack(t._innerRadii,e,n),n+=a.Cartesian3.packedLength,c.VertexFormat.pack(t._vertexFormat,e,n),n+=c.VertexFormat.packedLength,e[n++]=t._minimumClock,e[n++]=t._maximumClock,e[n++]=t._minimumCone,e[n++]=t._maximumCone,e[n++]=t._stackPartitions,e[n++]=t._slicePartitions,e[n]=i.defaultValue(t._offsetAttribute,-1),e};const A=new a.Cartesian3,b=new a.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 P;x.unpack=function(t,e,n){e=i.defaultValue(e,0);const r=a.Cartesian3.unpack(t,e,A);e+=a.Cartesian3.packedLength;const o=a.Cartesian3.unpack(t,e,b);e+=a.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 i.defined(n)?(n._radii=a.Cartesian3.clone(r,n._radii),n._innerRadii=a.Cartesian3.clone(o,n._innerRadii),n._vertexFormat=c.VertexFormat.clone(s,n._vertexFormat),n._minimumClock=m,n._maximumClock=u,n._minimumCone=l,n._maximumCone=f,n._stackPartitions=d,n._slicePartitions=C,n._offsetAttribute=-1===p?void 0:p,n):(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 r=t._radii;if(r.x<=0||r.y<=0||r.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,P,g=t._slicePartitions+1,v=t._stackPartitions+1;g=Math.round(g*Math.abs(x-y)/n.CesiumMath.TWO_PI),v=Math.round(v*Math.abs(b-A)/n.CesiumMath.PI),g<2&&(g=2),v<2&&(v=2);let F=0;const V=[A],M=[y];for(w=0;w<v;w++)V.push(A+w*(b-A)/(v-1));for(V.push(b),P=0;P<g;P++)M.push(y+P*(x-y)/(g-1));M.push(x);const T=V.length,D=M.length;let G=0,L=1;const O=c.x!==r.x||c.y!==r.y||c.z!==r.z;let I=!1,E=!1,z=!1;O&&(L=2,A>0&&(I=!0,G+=g-1),b<Math.PI&&(E=!0,G+=g-1),(x-y)%n.CesiumMath.TWO_PI?(z=!0,G+=2*(v-1)+1):G+=1);const N=D*T*L,R=new Float64Array(3*N),U=new Array(N).fill(!1),S=new Array(N).fill(!1),B=g*v*L,W=6*(B+G+1-(g+v)*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(P=0;P<D;P++)Q[P]=_(M[P]),K[P]=h(M[P]);for(w=0;w<T;w++)for(P=0;P<D;P++)R[F++]=r.x*q[w]*Q[P],R[F++]=r.y*q[w]*K[P
|