Newer
Older
smartwell_front_dz / XLJCYJ / mars3d-cesium / Workers / createPolylineVolumeGeometry.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 M}from"./chunk-TPDTXXTZ.js";import{a as W}from"./chunk-343SJCYH.js";import"./chunk-AWTNTFWT.js";import"./chunk-VMUA7QRT.js";import{a as x,b as I,c as j}from"./chunk-MR2QX3X3.js";import"./chunk-FVH3MLC4.js";import"./chunk-SKCOSGUV.js";import{a as g}from"./chunk-7QS2ZEBL.js";import"./chunk-HVRCTCKZ.js";import"./chunk-PCAQWIAU.js";import{a as $,b as V}from"./chunk-B7DJSUT3.js";import{a as Z}from"./chunk-W3YQL44J.js";import"./chunk-2YTOGJWB.js";import"./chunk-ZZPAAKFL.js";import"./chunk-A2J5OJ74.js";import{a as X}from"./chunk-VRSMIU2E.js";import{a as Q}from"./chunk-WGB3L4DG.js";import{b as Y,c as z,d as U}from"./chunk-VT3S74KG.js";import{d as K}from"./chunk-JYT7LKWQ.js";import"./chunk-DPXXHKCX.js";import{a as B}from"./chunk-UTQP35IH.js";import{a as T,c as C,d as f}from"./chunk-S74IVKSO.js";import{a as J}from"./chunk-XQPFZTAL.js";import"./chunk-CYX2VK56.js";import"./chunk-A5LGJSYE.js";import{a as k}from"./chunk-CDFKIAC5.js";import{a as D}from"./chunk-DRUYFASX.js";import{e as _}from"./chunk-A4U73JJE.js";function oe(e,t,n,o){let r=new Q;o.position&&(r.position=new U({componentDatatype:B.DOUBLE,componentsPerAttribute:3,values:e}));let i,a,s,p,c,l,u=t.length,h=e.length/3,m=(h-2*u)/(2*u),k=V.triangulate(t),g=(m-1)*u*6+2*k.length,f=X.createTypedArray(h,g),d=2*u,y=0;for(i=0;i<m-1;i++){for(a=0;a<u-1;a++)s=2*a+i*u*2,l=s+d,p=s+1,c=p+d,f[y++]=p,f[y++]=s,f[y++]=c,f[y++]=c,f[y++]=s,f[y++]=l;s=2*u-2+i*u*2,p=s+1,c=p+d,l=s+d,f[y++]=p,f[y++]=s,f[y++]=c,f[y++]=c,f[y++]=s,f[y++]=l}if(o.st||o.tangent||o.bitangent){let e,o,s=new Float32Array(2*h),p=1/(m-1),c=1/n.height,l=n.height/2,k=0;for(i=0;i<m;i++){for(e=i*p,o=c*(t[0].y+l),s[k++]=e,s[k++]=o,a=1;a<u;a++)o=c*(t[a].y+l),s[k++]=e,s[k++]=o,s[k++]=e,s[k++]=o;o=c*(t[0].y+l),s[k++]=e,s[k++]=o}for(a=0;a<u;a++)e=0,o=c*(t[a].y+l),s[k++]=e,s[k++]=o;for(a=0;a<u;a++)e=(m-1)*p,o=c*(t[a].y+l),s[k++]=e,s[k++]=o;r.st=new U({componentDatatype:B.FLOAT,componentsPerAttribute:2,values:new Float32Array(s)})}let _=h-2*u;for(i=0;i<k.length;i+=3){let e=k[i]+_,t=k[i+1]+_,n=k[i+2]+_;f[y++]=e,f[y++]=t,f[y++]=n,f[y++]=n+u,f[y++]=t+u,f[y++]=e+u}let T=new z({attributes:r,indices:f,boundingSphere:K.fromVertices(e),primitiveType:Y.TRIANGLES});if(o.normal&&(T=W.computeNormal(T)),o.tangent||o.bitangent){try{T=W.computeTangentAndBitangent(T)}catch{I("polyline-volume-tangent-bitangent","Unable to compute tangents and bitangents for polyline volume geometry")}o.tangent||(T.attributes.tangent=void 0),o.bitangent||(T.attributes.bitangent=void 0),o.st||(T.attributes.st=void 0)}return T}function R(e){e=k(e,k.EMPTY_OBJECT);let t=e.polylinePositions,n=e.shapePositions;if(!_(t))throw new D("options.polylinePositions is required.");if(!_(n))throw new D("options.shapePositions is required.");this._positions=t,this._shape=n,this._ellipsoid=f.clone(k(e.ellipsoid,f.default)),this._cornerType=k(e.cornerType,x.ROUNDED),this._vertexFormat=g.clone(k(e.vertexFormat,g.DEFAULT)),this._granularity=k(e.granularity,J.RADIANS_PER_DEGREE),this._workerName="createPolylineVolumeGeometry";let o=1+t.length*T.packedLength;o+=1+n.length*C.packedLength,this.packedLength=o+f.packedLength+g.packedLength+2}R.pack=function(e,t,n){if(!_(e))throw new D("value is required");if(!_(t))throw new D("array is required");n=k(n,0);let o,r=e._positions,i=r.length;for(t[n++]=i,o=0;o<i;++o,n+=T.packedLength)T.pack(r[o],t,n);let a=e._shape;for(i=a.length,t[n++]=i,o=0;o<i;++o,n+=C.packedLength)C.pack(a[o],t,n);return f.pack(e._ellipsoid,t,n),n+=f.packedLength,g.pack(e._vertexFormat,t,n),n+=g.packedLength,t[n++]=e._cornerType,t[n]=e._granularity,t};var ee=f.clone(f.UNIT_SPHERE),te=new g,v={polylinePositions:void 0,shapePositions:void 0,ellipsoid:ee,vertexFormat:te,cornerType:void 0,granularity:void 0};R.unpack=function(e,t,n){if(!_(e))throw new D("array is required");t=k(t,0);let o,r=e[t++],i=new Array(r);for(o=0;o<r;++o,t+=T.packedLength)i[o]=T.unpack(e,t);r=e[t++];let a=new Array(r);for(o=0;o<r;++o,t+=C.packedLength)a[o]=C.unpack(e,t);let s=f.unpack(e,t,ee);t+=f.packedLength;let p=g.unpack(e,t,te);t+=g.packedLength;let c=e[t++],l=e[t];return _(n)?(n._positions=i,n._shape=a,n._ellipsoid=f.clone(s,n._ellipsoid),n._vertexFormat=g.clone(p,n._vertexFormat),n._cornerType=c,n._granularity=l,n):(v.polylinePositions=i,v.shapePositions=a,v.cornerType=c,v.granularity=l,new R(v))};var ne=new M;R.createGeometry=function(e){let t=e._positions,n=Z(t,T.equalsEpsilon),o=e._shape;if(o=j.removeDuplicatesFromShape(o),n.length<2||o.length<3)return;V.computeWindingOrder2D(o)===$.CLOCKWISE&&o.reverse();let r=M.fromPoints(o,ne),i=j.computePositions(n,o,r,e,!0);return oe(i,o,r,e._vertexFormat)};var H=R;function ie(e,t){return _(t)&&(e=H.unpack(e,t)),e._ellipsoid=f.clone(e._ellipsoid),H.createGeometry(e)}var Re=ie;export{Re as default};