/** * @license * Cesium - https://github.com/CesiumGS/cesium * Version 1.120.1 * * 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. */ import{a as nt}from"./chunk-X3LK737X.js";import"./chunk-FVH3MLC4.js";import"./chunk-SKCOSGUV.js";import{a as _}from"./chunk-7QS2ZEBL.js";import"./chunk-W3YQL44J.js";import"./chunk-2YTOGJWB.js";import"./chunk-ZZPAAKFL.js";import"./chunk-A2J5OJ74.js";import{a as ot}from"./chunk-VRSMIU2E.js";import{a as it}from"./chunk-WGB3L4DG.js";import{b as tt,c as et,d as S}from"./chunk-VT3S74KG.js";import{d as I}from"./chunk-JYT7LKWQ.js";import"./chunk-DPXXHKCX.js";import{a as R}from"./chunk-UTQP35IH.js";import{a as s,d as l}from"./chunk-S74IVKSO.js";import{a as J}from"./chunk-XQPFZTAL.js";import"./chunk-CYX2VK56.js";import"./chunk-A5LGJSYE.js";import{a as w}from"./chunk-CDFKIAC5.js";import{a as P}from"./chunk-DRUYFASX.js";import{e as r}from"./chunk-A4U73JJE.js";var Q=new s,Y=new s,lt=new s,st=new s,pt=new s,ut=new s,ft=new s;function k(t){t=w(t,w.EMPTY_OBJECT);let e=t.positions,i=t.maximumHeights,n=t.minimumHeights;if(!r(e))throw new P("options.positions is required.");if(r(i)&&i.length!==e.length)throw new P("options.positions and options.maximumHeights must have the same length.");if(r(n)&&n.length!==e.length)throw new P("options.positions and options.minimumHeights must have the same length.");let o=w(t.vertexFormat,_.DEFAULT),a=w(t.granularity,J.RADIANS_PER_DEGREE),m=w(t.ellipsoid,l.default);this._positions=e,this._minimumHeights=n,this._maximumHeights=i,this._vertexFormat=_.clone(o),this._granularity=a,this._ellipsoid=l.clone(m),this._workerName="createWallGeometry";let p=1+e.length*s.packedLength+2;r(n)&&(p+=n.length),r(i)&&(p+=i.length),this.packedLength=p+l.packedLength+_.packedLength+1}k.pack=function(t,e,i){if(!r(t))throw new P("value is required");if(!r(e))throw new P("array is required");i=w(i,0);let n,o=t._positions,a=o.length;for(e[i++]=a,n=0;n<a;++n,i+=s.packedLength)s.pack(o[n],e,i);let m=t._minimumHeights;if(a=r(m)?m.length:0,e[i++]=a,r(m))for(n=0;n<a;++n)e[i++]=m[n];let p=t._maximumHeights;if(a=r(p)?p.length:0,e[i++]=a,r(p))for(n=0;n<a;++n)e[i++]=p[n];return l.pack(t._ellipsoid,e,i),i+=l.packedLength,_.pack(t._vertexFormat,e,i),i+=_.packedLength,e[i]=t._granularity,e};var mt=l.clone(l.UNIT_SPHERE),rt=new _,V={positions:void 0,minimumHeights:void 0,maximumHeights:void 0,ellipsoid:mt,vertexFormat:rt,granularity:void 0};k.unpack=function(t,e,i){if(!r(t))throw new P("array is required");e=w(e,0);let n,o,a,m=t[e++],p=new Array(m);for(n=0;n<m;++n,e+=s.packedLength)p[n]=s.unpack(t,e);if(m=t[e++],m>0)for(o=new Array(m),n=0;n<m;++n)o[n]=t[e++];if(m=t[e++],m>0)for(a=new Array(m),n=0;n<m;++n)a[n]=t[e++];let u=l.unpack(t,e,mt);e+=l.packedLength;let h=_.unpack(t,e,rt);e+=_.packedLength;let c=t[e];return r(i)?(i._positions=p,i._minimumHeights=o,i._maximumHeights=a,i._ellipsoid=l.clone(u,i._ellipsoid),i._vertexFormat=_.clone(h,i._vertexFormat),i._granularity=c,i):(V.positions=p,V.minimumHeights=o,V.maximumHeights=a,V.granularity=c,new k(V))},k.fromConstantHeights=function(t){t=w(t,w.EMPTY_OBJECT);let e=t.positions;if(!r(e))throw new P("options.positions is required.");let i,n,o=t.minimumHeight,s=t.maximumHeight,a=r(o),m=r(s);if(a||m){let t=e.length;i=a?new Array(t):void 0,n=m?new Array(t):void 0;for(let e=0;e<t;++e)a&&(i[e]=o),m&&(n[e]=s)}let l={positions:e,maximumHeights:n,minimumHeights:i,ellipsoid:t.ellipsoid,vertexFormat:t.vertexFormat};return new k(l)},k.createGeometry=function(t){let e=t._positions,i=t._minimumHeights,n=t._maximumHeights,o=t._vertexFormat,a=t._granularity,m=t._ellipsoid,l=nt.computePositions(m,e,n,i,a,!0);if(!r(l))return;let p=l.bottomPositions,u=l.topPositions,h=l.numCorners,c=u.length,g=2*c,f=o.position?new Float64Array(g):void 0,w=o.normal?new Float32Array(g):void 0,k=o.tangent?new Float32Array(g):void 0,d=o.bitangent?new Float32Array(g):void 0,_=o.st?new Float32Array(g/3*2):void 0,y=0,A=0,v=0,x=0,L=0,P=ft,H=ut,F=pt,E=!0;c/=3;let j,b=0,T=1/(c-h-1);for(j=0;j<c;++j){let t=3*j,e=s.fromArray(u,t,Q),i=s.fromArray(p,t,Y);if(o.position&&(f[y++]=i.x,f[y++]=i.y,f[y++]=i.z,f[y++]=e.x,f[y++]=e.y,f[y++]=e.z),o.st&&(_[L++]=b,_[L++]=0,_[L++]=b,_[L++]=1),o.normal||o.tangent||o.bitangent){let i=s.clone(s.ZERO,st),n=s.subtract(e,m.geodeticSurfaceNormal(e,Y),Y);if(j+1<c&&(i=s.fromArray(u,t+3,st)),E){let t=s.subtract(i,e,lt),r=s.subtract(n,e,Q);P=s.normalize(s.cross(r,t,P),P),E=!1}s.equalsEpsilon(e,i,J.EPSILON10)?E=!0:(b+=T,o.tangent&&(H=s.normalize(s.subtract(i,e,H),H)),o.bitangent&&(F=s.normalize(s.cross(P,H,F),F))),o.normal&&(w[A++]=P.x,w[A++]=P.y,w[A++]=P.z,w[A++]=P.x,w[A++]=P.y,w[A++]=P.z),o.tangent&&(k[x++]=H.x,k[x++]=H.y,k[x++]=H.z,k[x++]=H.x,k[x++]=H.y,k[x++]=H.z),o.bitangent&&(d[v++]=F.x,d[v++]=F.y,d[v++]=F.z,d[v++]=F.x,d[v++]=F.y,d[v++]=F.z)}}let O=new it;o.position&&(O.position=new S({componentDatatype:R.DOUBLE,componentsPerAttribute:3,values:f})),o.normal&&(O.normal=new S({componentDatatype:R.FLOAT,componentsPerAttribute:3,values:w})),o.tangent&&(O.tangent=new S({componentDatatype:R.FLOAT,componentsPerAttribute:3,values:k})),o.bitangent&&(O.bitangent=new S({componentDatatype:R.FLOAT,componentsPerAttribute:3,values:d})),o.st&&(O.st=new S({componentDatatype:R.FLOAT,componentsPerAttribute:2,values:_}));let D=g/3;g-=6*(h+1);let V=ot.createTypedArray(D,g),z=0;for(j=0;j<D-2;j+=2){let t=j,e=j+2,i=s.fromArray(f,3*t,Q),n=s.fromArray(f,3*e,Y);if(s.equalsEpsilon(i,n,J.EPSILON10))continue;let r=j+1,o=j+3;V[z++]=r,V[z++]=t,V[z++]=o,V[z++]=o,V[z++]=t,V[z++]=e}return new et({attributes:O,indices:V,primitiveType:tt.TRIANGLES,boundingSphere:new I.fromVertices(f)})};var X=k;function ht(t,e){return r(e)&&(t=X.unpack(t,e)),t._ellipsoid=l.clone(t._ellipsoid),X.createGeometry(t)}var Ot=ht;export{Ot as default};