Newer
Older
smartwell_front_dz / XLJCYJ / mars3d-cesium / Workers / createPolygonGeometry.js
/**
 * @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 dt}from"./chunk-TPDTXXTZ.js";import{a as F}from"./chunk-IYIAJDXR.js";import{a as at}from"./chunk-O3XIRCSZ.js";import{a as st}from"./chunk-7X5355YR.js";import{a as bt}from"./chunk-343SJCYH.js";import"./chunk-AWTNTFWT.js";import"./chunk-VMUA7QRT.js";import{a as ht}from"./chunk-TRTMI7MU.js";import{a as Q}from"./chunk-7QS2ZEBL.js";import{a as K}from"./chunk-HVRCTCKZ.js";import"./chunk-PCAQWIAU.js";import{a as gt,b as nt}from"./chunk-B7DJSUT3.js";import"./chunk-W3YQL44J.js";import"./chunk-2YTOGJWB.js";import{a as wt,b as yt}from"./chunk-ZZPAAKFL.js";import"./chunk-A2J5OJ74.js";import{a as lt}from"./chunk-VRSMIU2E.js";import"./chunk-WGB3L4DG.js";import{c as mt,d as tt}from"./chunk-VT3S74KG.js";import{d as Tt}from"./chunk-JYT7LKWQ.js";import{f as ct,h as _t}from"./chunk-DPXXHKCX.js";import{a as $}from"./chunk-UTQP35IH.js";import{a as c,b as ot,c as O,d as V,e as U}from"./chunk-S74IVKSO.js";import{a as l}from"./chunk-XQPFZTAL.js";import"./chunk-CYX2VK56.js";import"./chunk-A5LGJSYE.js";import{a as L}from"./chunk-CDFKIAC5.js";import{a as ut,b as q}from"./chunk-DRUYFASX.js";import{e as P}from"./chunk-A4U73JJE.js";function b(t,e){this.position=t,P(this.position)||(this.position=new O),this.tangentPlane=e,P(this.tangentPlane)||(this.tangentPlane=b.NORTH_POLE_TANGENT_PLANE)}Object.defineProperties(b.prototype,{ellipsoid:{get:function(){return this.tangentPlane.ellipsoid}},x:{get:function(){return this.position.x}},y:{get:function(){return this.position.y}},conformalLatitude:{get:function(){let t=O.magnitude(this.position),e=2*this.ellipsoid.maximumRadius;return this.tangentPlane.plane.normal.z*(l.PI_OVER_TWO-2*Math.atan2(t,e))}},longitude:{get:function(){let t=l.PI_OVER_TWO+Math.atan2(this.y,this.x);return t>Math.PI&&(t-=l.TWO_PI),t}}});var it=new ot,Rt=new c;b.prototype.getLatitude=function(t){P(t)||(t=V.default),it.latitude=this.conformalLatitude,it.longitude=this.longitude,it.height=0;let e=this.ellipsoid.cartographicToCartesian(it,Rt);return t.cartesianToCartographic(e,it),it.latitude};var It=new wt,Lt=new c,Ft=new c;b.fromCartesian=function(t,e){q.defined("cartesian",t);let o=l.signNotZero(t.z),i=b.NORTH_POLE_TANGENT_PLANE,n=b.SOUTH_POLE;o<0&&(i=b.SOUTH_POLE_TANGENT_PLANE,n=b.NORTH_POLE);let r=It;r.origin=i.ellipsoid.scaleToGeocentricSurface(t,r.origin),r.direction=c.subtract(r.origin,n,Lt),c.normalize(r.direction,r.direction);let a=yt.rayPlane(r,i.plane,Ft),s=c.subtract(a,n,a),u=c.dot(i.xAxis,s),h=o*c.dot(i.yAxis,s);return P(e)?(e.position=new O(u,h),e.tangentPlane=i,e):new b(new O(u,h),i)},b.fromCartesianArray=function(t,e){q.defined("cartesians",t);let o=t.length;P(e)?e.length=o:e=new Array(o);for(let i=0;i<o;i++)e[i]=b.fromCartesian(t[i],e[i]);return e},b.clone=function(t,e){if(P(t))return P(e)?(e.position=t.position,e.tangentPlane=t.tangentPlane,e):new b(t.position,t.tangentPlane)},b.HALF_UNIT_SPHERE=Object.freeze(new V(.5,.5,.5)),b.NORTH_POLE=Object.freeze(new c(0,0,.5)),b.SOUTH_POLE=Object.freeze(new c(0,0,-.5)),b.NORTH_POLE_TANGENT_PLANE=Object.freeze(new K(b.NORTH_POLE,b.HALF_UNIT_SPHERE)),b.SOUTH_POLE_TANGENT_PLANE=Object.freeze(new K(b.SOUTH_POLE,b.HALF_UNIT_SPHERE));var D=b,vt=new ot,Ot=new ot;function St(t,e,o,i){let n=i.cartesianToCartographic(t,vt).height,r=i.cartesianToCartographic(e,Ot);r.height=n,i.cartographicToCartesian(r,e);let a=i.cartesianToCartographic(o,Ot);a.height=n-100,i.cartographicToCartesian(a,o)}var Et=new dt,Vt=new c,Bt=new c,Mt=new c,jt=new c,kt=new c,zt=new c,ft=new c,Z=new c,rt=new c,Dt=new O,Ut=new O,Wt=new c,At=new ct,Gt=new U,Yt=new U;function pt(t){let e=t.vertexFormat,o=t.geometry,i=t.shadowVolume,n=o.attributes.position.values,r=P(o.attributes.st)?o.attributes.st.values:void 0,a=n.length,s=t.wall,u=t.top||s,h=t.bottom||s;if(e.st||e.normal||e.tangent||e.bitangent||i){let p=t.boundingRectangle,g=t.rotationAxis,m=t.projectTo2d,d=t.ellipsoid,f=t.stRotation,y=t.perPositionHeight,_=Dt;_.x=p.x,_.y=p.y;let T,b=e.st?new Float32Array(a/3*2):void 0;e.normal&&(T=y&&u&&!s?o.attributes.normal.values:new Float32Array(a));let w=e.tangent?new Float32Array(a):void 0,I=e.bitangent?new Float32Array(a):void 0,A=i?new Float32Array(a):void 0,E=0,v=0,x=Bt,H=Mt,N=jt,L=!0,F=Gt,R=Yt;if(0!==f){let t=ct.fromAxisAngle(g,f,At);F=U.fromQuaternion(t,F),t=ct.fromAxisAngle(g,-f,At),R=U.fromQuaternion(t,R)}else F=U.clone(U.IDENTITY,F),R=U.clone(U.IDENTITY,R);let C=0,k=0;u&&h&&(C=a/2,k=a/3,a/=2);for(let o=0;o<a;o+=3){let g=c.fromArray(n,o,Wt);if(e.st&&!P(r)){let t=U.multiplyByVector(F,g,Vt);t=d.scaleToGeodeticSurface(t,t);let e=m([t],Ut)[0];O.subtract(e,_,e);let o=l.clamp(e.x/p.width,0,1),i=l.clamp(e.y/p.height,0,1);h&&(b[E+k]=o,b[E+1+k]=i),u&&(b[E]=o,b[E+1]=i),E+=2}if(e.normal||e.tangent||e.bitangent||i){let r=v+1,p=v+2;if(s){if(o+3<a){let t=c.fromArray(n,o+3,kt);if(L){let e=c.fromArray(n,o+a,zt);y&&St(g,t,e,d),c.subtract(t,g,t),c.subtract(e,g,e),x=c.normalize(c.cross(e,t,x),x),L=!1}c.equalsEpsilon(t,g,l.EPSILON10)&&(L=!0)}(e.tangent||e.bitangent)&&(N=d.geodeticSurfaceNormal(g,N),e.tangent&&(H=c.normalize(c.cross(N,x,H),H)))}else x=d.geodeticSurfaceNormal(g,x),(e.tangent||e.bitangent)&&(y&&(ft=c.fromArray(T,v,ft),Z=c.cross(c.UNIT_Z,ft,Z),Z=c.normalize(U.multiplyByVector(R,Z,Z),Z),e.bitangent&&(rt=c.normalize(c.cross(ft,Z,rt),rt))),H=c.cross(c.UNIT_Z,x,H),H=c.normalize(U.multiplyByVector(R,H,H),H),e.bitangent&&(N=c.normalize(c.cross(x,H,N),N)));e.normal&&(t.wall?(T[v+C]=x.x,T[r+C]=x.y,T[p+C]=x.z):h&&(T[v+C]=-x.x,T[r+C]=-x.y,T[p+C]=-x.z),(u&&!y||s)&&(T[v]=x.x,T[r]=x.y,T[p]=x.z)),i&&(s&&(x=d.geodeticSurfaceNormal(g,x)),A[v+C]=-x.x,A[r+C]=-x.y,A[p+C]=-x.z),e.tangent&&(t.wall?(w[v+C]=H.x,w[r+C]=H.y,w[p+C]=H.z):h&&(w[v+C]=-H.x,w[r+C]=-H.y,w[p+C]=-H.z),u&&(y?(w[v]=Z.x,w[r]=Z.y,w[p]=Z.z):(w[v]=H.x,w[r]=H.y,w[p]=H.z))),e.bitangent&&(h&&(I[v+C]=N.x,I[r+C]=N.y,I[p+C]=N.z),u&&(y?(I[v]=rt.x,I[r]=rt.y,I[p]=rt.z):(I[v]=N.x,I[r]=N.y,I[p]=N.z))),v+=3}}e.st&&!P(r)&&(o.attributes.st=new tt({componentDatatype:$.FLOAT,componentsPerAttribute:2,values:b})),e.normal&&(o.attributes.normal=new tt({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:T})),e.tangent&&(o.attributes.tangent=new tt({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:w})),e.bitangent&&(o.attributes.bitangent=new tt({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:I})),i&&(o.attributes.extrudeDirection=new tt({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:A}))}if(t.extrude&&P(t.offsetAttribute)){let e=n.length/3,i=new Uint8Array(e);if(t.offsetAttribute===ht.TOP)u&&h||s?i=i.fill(1,0,e/2):u&&(i=i.fill(1));else{let e=t.offsetAttribute===ht.NONE?0:1;i=i.fill(e)}o.attributes.applyOffset=new tt({componentDatatype:$.UNSIGNED_BYTE,componentsPerAttribute:1,values:i})}return o}var Ht=[];function qt(t,e,o,i,n,r,a,s,l,c){let u,h={walls:[]};if(a||s){let n,p,g=F.createGeometryFromPositions(t,e,o,i,r,l,c),m=g.attributes.position.values,d=g.indices;if(a&&s){let t=m.concat(m);n=t.length/3,p=lt.createTypedArray(n,2*d.length),p.set(d);let e=d.length,i=n/2;for(u=0;u<e;u+=3){let t=p[u]+i,o=p[u+1]+i,n=p[u+2]+i;p[u+e]=n,p[u+1+e]=o,p[u+2+e]=t}if(g.attributes.position.values=t,r&&l.normal){let e=g.attributes.normal.values;g.attributes.normal.values=new Float32Array(t.length),g.attributes.normal.values.set(e)}if(l.st&&P(o)){let t=g.attributes.st.values;g.attributes.st.values=new Float32Array(2*n),g.attributes.st.values=t.concat(t)}g.indices=p}else if(s){for(n=m.length/3,p=lt.createTypedArray(n,d.length),u=0;u<d.length;u+=3)p[u]=d[u+2],p[u+1]=d[u+1],p[u+2]=d[u];g.indices=p}h.topAndBottom=new st({geometry:g})}let p=n.outerRing,g=K.fromPoints(p,t),m=g.projectPointsOntoPlane(p,Ht),d=nt.computeWindingOrder2D(m);d===gt.CLOCKWISE&&(p=p.slice().reverse());let f=F.computeWallGeometry(p,o,t,i,r,c);h.walls.push(new st({geometry:f}));let y=n.holes;for(u=0;u<y.length;u++){let e=y[u];m=g.projectPointsOntoPlane(e,Ht),d=nt.computeWindingOrder2D(m),d===gt.COUNTER_CLOCKWISE&&(e=e.slice().reverse()),f=F.computeWallGeometry(e,o,t,i,r,c),h.walls.push(new st({geometry:f}))}return h}function G(t){if(q.typeOf.object("options",t),q.typeOf.object("options.polygonHierarchy",t.polygonHierarchy),P(t.perPositionHeight)&&t.perPositionHeight&&P(t.height))throw new ut("Cannot use both options.perPositionHeight and options.height");if(P(t.arcType)&&t.arcType!==at.GEODESIC&&t.arcType!==at.RHUMB)throw new ut("Invalid arcType. Valid options are ArcType.GEODESIC and ArcType.RHUMB.");let e=t.polygonHierarchy,o=L(t.vertexFormat,Q.DEFAULT),i=L(t.ellipsoid,V.default),n=L(t.granularity,l.RADIANS_PER_DEGREE),r=L(t.stRotation,0),a=t.textureCoordinates,s=L(t.perPositionHeight,!1),u=s&&P(t.extrudedHeight),h=L(t.height,0),p=L(t.extrudedHeight,h);if(!u){let t=Math.max(h,p);p=Math.min(h,p),h=t}this._vertexFormat=Q.clone(o),this._ellipsoid=V.clone(i),this._granularity=n,this._stRotation=r,this._height=h,this._extrudedHeight=p,this._closeTop=L(t.closeTop,!0),this._closeBottom=L(t.closeBottom,!0),this._polygonHierarchy=e,this._perPositionHeight=s,this._perPositionHeightExtrude=u,this._shadowVolume=L(t.shadowVolume,!1),this._workerName="createPolygonGeometry",this._offsetAttribute=t.offsetAttribute,this._arcType=L(t.arcType,at.GEODESIC),this._rectangle=void 0,this._textureCoordinateRotationPoints=void 0,this._textureCoordinates=a,this.packedLength=F.computeHierarchyPackedLength(e,c)+V.packedLength+Q.packedLength+(a?F.computeHierarchyPackedLength(a,O):1)+12}G.fromPositions=function(t){t=L(t,L.EMPTY_OBJECT),q.defined("options.positions",t.positions);let e={polygonHierarchy:{positions:t.positions},height:t.height,extrudedHeight:t.extrudedHeight,vertexFormat:t.vertexFormat,stRotation:t.stRotation,ellipsoid:t.ellipsoid,granularity:t.granularity,perPositionHeight:t.perPositionHeight,closeTop:t.closeTop,closeBottom:t.closeBottom,offsetAttribute:t.offsetAttribute,arcType:t.arcType,textureCoordinates:t.textureCoordinates};return new G(e)},G.pack=function(t,e,o){return q.typeOf.object("value",t),q.defined("array",e),o=L(o,0),o=F.packPolygonHierarchy(t._polygonHierarchy,e,o,c),V.pack(t._ellipsoid,e,o),o+=V.packedLength,Q.pack(t._vertexFormat,e,o),o+=Q.packedLength,e[o++]=t._height,e[o++]=t._extrudedHeight,e[o++]=t._granularity,e[o++]=t._stRotation,e[o++]=t._perPositionHeightExtrude?1:0,e[o++]=t._perPositionHeight?1:0,e[o++]=t._closeTop?1:0,e[o++]=t._closeBottom?1:0,e[o++]=t._shadowVolume?1:0,e[o++]=L(t._offsetAttribute,-1),e[o++]=t._arcType,P(t._textureCoordinates)?o=F.packPolygonHierarchy(t._textureCoordinates,e,o,O):e[o++]=-1,e[o++]=t.packedLength,e};var Qt=V.clone(V.UNIT_SPHERE),Zt=new Q,Kt={polygonHierarchy:{}};G.unpack=function(t,e,o){q.defined("array",t),e=L(e,0);let i=F.unpackPolygonHierarchy(t,e,c);e=i.startingIndex,delete i.startingIndex;let n=V.unpack(t,e,Qt);e+=V.packedLength;let r=Q.unpack(t,e,Zt);e+=Q.packedLength;let a=t[e++],s=t[e++],l=t[e++],u=t[e++],h=1===t[e++],p=1===t[e++],g=1===t[e++],m=1===t[e++],d=1===t[e++],f=t[e++],y=t[e++],_=-1===t[e]?void 0:F.unpackPolygonHierarchy(t,e,O);P(_)?(e=_.startingIndex,delete _.startingIndex):e++;let T=t[e++];return P(o)||(o=new G(Kt)),o._polygonHierarchy=i,o._ellipsoid=V.clone(n,o._ellipsoid),o._vertexFormat=Q.clone(r,o._vertexFormat),o._height=a,o._extrudedHeight=s,o._granularity=l,o._stRotation=u,o._perPositionHeightExtrude=h,o._perPositionHeight=p,o._closeTop=g,o._closeBottom=m,o._shadowVolume=d,o._offsetAttribute=-1===f?void 0:f,o._arcType=y,o._textureCoordinates=_,o.packedLength=T,o};var Jt=new O,Xt=new O,$t=new D;function xt(t,e,o,i,n,r){let a=t.longitude,s=a>=0?a:a+l.TWO_PI;n.westOverIdl=Math.min(n.westOverIdl,s),n.eastOverIdl=Math.max(n.eastOverIdl,s),r.west=Math.min(r.west,a),r.east=Math.max(r.east,a);let c=t.getLatitude(o),u=c;if(r.south=Math.min(r.south,c),r.north=Math.max(r.north,c),i!==at.RHUMB){let i=O.subtract(e.position,t.position,Jt),n=O.dot(e.position,i)/O.dot(i,i);if(n>0&&n<1){let t=O.add(e.position,O.multiplyByScalar(i,-n,i),Xt),a=D.clone(e,$t);a.position=t;let s=a.getLatitude(o);r.south=Math.min(r.south,s),r.north=Math.max(r.north,s),Math.abs(c)>Math.abs(s)&&(u=s)}}let h=e.x*t.y-t.x*e.y,p=Math.sign(h);0!==p&&(p*=O.angleBetween(e.position,t.position)),u>=0&&(n.northAngle+=p),u<=0&&(n.southAngle+=p)}var Ct=new D,te=new D,W={northAngle:0,southAngle:0,westOverIdl:0,eastOverIdl:0};G.computeRectangleFromPositions=function(t,e,o,i){if(q.defined("positions",t),P(i)||(i=new _t),t.length<3)return i;i.west=Number.POSITIVE_INFINITY,i.east=Number.NEGATIVE_INFINITY,i.south=Number.POSITIVE_INFINITY,i.north=Number.NEGATIVE_INFINITY,W.northAngle=0,W.southAngle=0,W.westOverIdl=Number.POSITIVE_INFINITY,W.eastOverIdl=Number.NEGATIVE_INFINITY;let n=t.length,r=D.fromCartesian(t[0],te);for(let a=1;a<n;a++){let n=D.fromCartesian(t[a],Ct);xt(n,r,e,o,W,i),r=D.clone(n,r)}return xt(D.fromCartesian(t[0],Ct),r,e,o,W,i),i.east-i.west>W.eastOverIdl-W.westOverIdl&&(i.west=W.westOverIdl,i.east=W.eastOverIdl,i.east>l.PI&&(i.east=i.east-l.TWO_PI),i.west>l.PI&&(i.west=i.west-l.TWO_PI)),l.equalsEpsilon(Math.abs(W.northAngle),l.TWO_PI,l.EPSILON10)&&(i.north=l.PI_OVER_TWO,i.east=l.PI,i.west=-l.PI),l.equalsEpsilon(Math.abs(W.southAngle),l.TWO_PI,l.EPSILON10)&&(i.south=-l.PI_OVER_TWO,i.east=l.PI,i.west=-l.PI),i};var ee=new D;function oe(t,e,o){return t.height>=l.PI||t.width>=l.PI?D.fromCartesian(e[0],ee).tangentPlane:K.fromPoints(e,o)}var Nt=new ot;function ne(t,e,o){return(i,n)=>{if(t.height>=l.PI||t.width>=l.PI){if(t.south<0&&t.north>0){P(n)||(n=[]);for(let t=0;t<i.length;++t){let e=o.cartesianToCartographic(i[t],Nt);n[t]=new O(e.longitude/l.PI,e.latitude/l.PI_OVER_TWO)}return n.length=i.length,n}return D.fromCartesianArray(i,n)}return K.fromPoints(e,o).projectPointsOntoPlane(i,n)}}function ie(t,e,o){if(t.height>=l.PI||t.width>=l.PI)return(e,i)=>{if(t.south<0&&t.north>0){let t=o.cartesianToCartographic(e,Nt);return P(i)||(i=new O),i.x=t.longitude/l.PI,i.y=t.latitude/l.PI_OVER_TWO,i}return D.fromCartesian(e,i)};let i=K.fromPoints(e,o);return(t,e)=>i.projectPointsOntoPlane(t,e)}function re(t,e,o,i){return(n,r)=>!i&&(t.height>=l.PI_OVER_TWO||t.width>=2*l.PI_OVER_THREE)?F.splitPolygonsOnEquator(n,e,o,r):n}function se(t,e,o,i){if(e.height>=l.PI||e.width>=l.PI)return dt.fromRectangle(e,void 0,Et);let n=t,r=K.fromPoints(n,o);return F.computeBoundingRectangle(r.plane.normal,r.projectPointOntoPlane.bind(r),n,i,Et)}function ae(t){let e=-t._stRotation;if(0===e)return[0,0,0,1,1,0];let o=t._ellipsoid,i=t._polygonHierarchy.positions,n=t.rectangle;return mt._textureCoordinateRotationPoints(i,e,o,n)}G.createGeometry=function(t){let e=t._vertexFormat,o=t._ellipsoid,i=t._granularity,n=t._stRotation,r=t._polygonHierarchy,a=t._perPositionHeight,s=t._closeTop,c=t._closeBottom,u=t._arcType,h=t._textureCoordinates,p=P(h),g=r.positions;if(g.length<3)return;let m=t.rectangle,d=F.polygonsFromHierarchy(r,p,ne(m,g,o),!a,o,re(m,o,u,a)),f=d.hierarchy,y=d.polygons,_=function(t){return t},T=p?F.polygonsFromHierarchy(h,!0,_,!1,o).polygons:void 0;if(0===f.length)return;let b,O=f[0].outerRing,w=se(O,m,o,n),I=[],A=t._height,E=t._extrudedHeight,v=t._perPositionHeightExtrude||!l.equalsEpsilon(A,E,0,l.EPSILON2),x={perPositionHeight:a,vertexFormat:e,geometry:void 0,rotationAxis:oe(m,O,o).plane.normal,projectTo2d:ie(m,O,o),boundingRectangle:w,ellipsoid:o,stRotation:n,textureCoordinates:void 0,bottom:!1,top:!0,wall:!1,extrude:!1,arcType:u};if(v)for(x.extrude=!0,x.top=s,x.bottom=c,x.shadowVolume=t._shadowVolume,x.offsetAttribute=t._offsetAttribute,b=0;b<y.length;b++){let t,n=qt(o,y[b],p?T[b]:void 0,i,f[b],a,s,c,e,u);s&&c?(t=n.topAndBottom,x.geometry=F.scaleToGeodeticHeightExtruded(t.geometry,A,E,o,a)):s?(t=n.topAndBottom,t.geometry.attributes.position.values=nt.scaleToGeodeticHeight(t.geometry.attributes.position.values,A,o,!a),x.geometry=t.geometry):c&&(t=n.topAndBottom,t.geometry.attributes.position.values=nt.scaleToGeodeticHeight(t.geometry.attributes.position.values,E,o,!0),x.geometry=t.geometry),(s||c)&&(x.wall=!1,t.geometry=pt(x),I.push(t));let r=n.walls;x.wall=!0;for(let e=0;e<r.length;e++){let t=r[e];x.geometry=F.scaleToGeodeticHeightExtruded(t.geometry,A,E,o,a),t.geometry=pt(x),I.push(t)}}else for(b=0;b<y.length;b++){let n=new st({geometry:F.createGeometryFromPositions(o,y[b],p?T[b]:void 0,i,a,e,u)});if(n.geometry.attributes.position.values=nt.scaleToGeodeticHeight(n.geometry.attributes.position.values,A,o,!a),x.geometry=n.geometry,n.geometry=pt(x),P(t._offsetAttribute)){let e=n.geometry.attributes.position.values.length,o=t._offsetAttribute===ht.NONE?0:1,i=new Uint8Array(e/3).fill(o);n.geometry.attributes.applyOffset=new tt({componentDatatype:$.UNSIGNED_BYTE,componentsPerAttribute:1,values:i})}I.push(n)}let H=bt.combineInstances(I)[0];H.attributes.position.values=new Float64Array(H.attributes.position.values),H.indices=lt.createTypedArray(H.attributes.position.values.length/3,H.indices);let N=H.attributes,L=Tt.fromVertices(N.position.values);return e.position||delete N.position,new mt({attributes:N,indices:H.indices,primitiveType:H.primitiveType,boundingSphere:L,offsetAttribute:t._offsetAttribute})},G.createShadowVolume=function(t,e,o){let i=t._granularity,n=t._ellipsoid,r=e(i,n),a=o(i,n);return new G({polygonHierarchy:t._polygonHierarchy,ellipsoid:n,stRotation:t._stRotation,granularity:i,perPositionHeight:!1,extrudedHeight:r,height:a,vertexFormat:Q.POSITION_ONLY,shadowVolume:!0,arcType:t._arcType})},Object.defineProperties(G.prototype,{rectangle:{get:function(){if(!P(this._rectangle)){let t=this._polygonHierarchy.positions;this._rectangle=G.computeRectangleFromPositions(t,this._ellipsoid,this._arcType)}return this._rectangle}},textureCoordinateRotationPoints:{get:function(){return P(this._textureCoordinateRotationPoints)||(this._textureCoordinateRotationPoints=ae(this)),this._textureCoordinateRotationPoints}}});var Pt=G;function ce(t,e){return P(e)&&(t=Pt.unpack(t,e)),t._ellipsoid=V.clone(t._ellipsoid),Pt.createGeometry(t)}var Xe=ce;export{Xe as default};