YZProjectCloud/yanzhu-ui-vue3/public/Engine/Workers/createPolylineVolumeGeometr...

2 lines
7.0 KiB
JavaScript
Raw Normal View History

2025-04-07 00:55:58 +08:00
define(["./defaultValue-81eec7ed","./Matrix2-e3fb4559","./arrayRemoveDuplicates-85770175","./BoundingRectangle-b88064b7","./Transforms-98ffa11d","./Cartesian3-7e9cc2ff","./ComponentDatatype-aaeec80f","./PolylineVolumeGeometryLibrary-22aaee12","./Check-741c5f3c","./GeometryAttribute-b025f9a8","./GeometryAttributes-32b29525","./GeometryPipeline-4b426993","./IndexDatatype-f1e3f799","./Math-5f585871","./Matrix4-d34187af","./PolygonPipeline-6f83d8b1","./VertexFormat-d50a69ba","./_commonjsHelpers-3aae1032-26891ab7","./combine-3c023bda","./RuntimeError-26acdd3b","./WebGLConstants-508b9636","./EllipsoidTangentPlane-fa1337e1","./AxisAlignedBoundingBox-37250ed6","./IntersectionTests-73b87d72","./Plane-4f75b3df","./PolylinePipeline-de59c85a","./EllipsoidGeodesic-6de45192","./EllipsoidRhumbLine-9c6b32ea","./AttributeCompression-e2e3f0dd","./EncodedCartesian3-aac44514"],(function(e,t,n,o,i,r,a,l,s,d,c,p,m,u,g,y,h,f,x,b,P,_,E,L,T,F,G,k,v,C){"use strict";const w={};function V(t,n){e.defined(w[t])||(w[t]=!0)}function A(t,n,o,l,s,u,h){const f=new c.GeometryAttributes;l.position&&(f.position=new d.GeometryAttribute({componentDatatype:a.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:t}));const x=n.length,b=t.length/3;let P=(b-2*x)/(2*x);const _=y.PolygonPipeline.triangulate(n),E=(P-1)*x*6+2*_.length,L=m.IndexDatatype.createTypedArray(b,E);let T,F,G,k,v,C;const w=2*x;let A=0;for(T=0;T<P-1;T++){for(F=0;F<x-1;F++)G=2*F+T*x*2,C=G+w,k=G+1,v=k+w,L[A++]=k,L[A++]=G,L[A++]=v,L[A++]=v,L[A++]=G,L[A++]=C;G=2*x-2+T*x*2,k=G+1,v=k+w,C=G+w,L[A++]=k,L[A++]=G,L[A++]=v,L[A++]=v,L[A++]=G,L[A++]=C}if(l.st||l.tangent||l.bitangent){const e=new Float32Array(2*b),t=1/(P-1),i=1/o.height,r=o.height/2;let l,s,c=0;for(T=0;T<P;T++){for(l=T*t,s=i*(n[0].y+r),e[c++]=l,e[c++]=s,F=1;F<x;F++)s=i*(n[F].y+r),e[c++]=l,e[c++]=s,e[c++]=l,e[c++]=s;s=i*(n[0].y+r),e[c++]=l,e[c++]=s}for(F=0;F<x;F++)l=0,s=i*(n[F].y+r),e[c++]=l,e[c++]=s;for(F=0;F<x;F++)l=(P-1)*t,s=i*(n[F].y+r),e[c++]=l,e[c++]=s;f.st=new d.GeometryAttribute({componentDatatype:a.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:new Float32Array(e)})}const M=b-2*x;for(T=0;T<_.length;T+=3){const e=_[T]+M,t=_[T+1]+M,n=_[T+2]+M;L[A++]=e,L[A++]=t,L[A++]=n,L[A++]=n+x,L[A++]=t+x,L[A++]=e+x}const R=function(t,n,o){const i=[],a=new g.Matrix4;e.defined(n)&&!n.equals(new g.Matrix4)&&g.Matrix4.inverse(n,a);for(let e=0;e<t.length/3;e++){const n=new r.Cartesian3(t[3*e],t[3*e+1],t[3*e+2]);1!==o&&g.Matrix4.multiplyByPoint(a,n,n),i.push(n.x,n.y,n.z)}const l=new r.Cartesian3(-1/0,-1/0,-1/0),s=new r.Cartesian3(1/0,1/0,1/0);for(let e=0;e<i.length/3;e++){const t=new r.Cartesian3(i[3*e],i[3*e+1],i[3*e+2]);l.x=Math.max(l.x,t.x),l.y=Math.max(l.y,t.y),l.z=Math.max(l.z,t.z),s.x=Math.min(s.x,t.x),s.y=Math.min(s.y,t.y),s.z=Math.min(s.z,t.z)}return[l,s]}(t,s,h);let D=new d.Geometry({attributes:f,indices:L,boundingSphere:i.BoundingSphere.fromVertices(t),MaxPoint:R[0],MinPoint:R[1],primitiveType:d.PrimitiveType.TRIANGLES});if(l.normal&&(D=p.GeometryPipeline.computeNormal(D,1===h?s:void 0)),l.tangent||l.bitangent){try{D=p.GeometryPipeline.computeTangentAndBitangent(D)}catch(e){V("polyline-volume-tangent-bitangent")}l.tangent||(D.attributes.tangent=void 0),l.bitangent||(D.attributes.bitangent=void 0),l.st||(D.attributes.st=void 0)}return D}function M(n){const o=(n=e.defaultValue(n,e.defaultValue.EMPTY_OBJECT)).polylinePositions,i=n.shapePositions;let a;this._positions=o,this._shape=i,this._ellipsoid=t.Ellipsoid.clone(e.defaultValue(n.ellipsoid,t.Ellipsoid.WGS84)),this._cornerType=e.defaultValue(n.cornerType,l.CornerType.ROUNDED),this._vertexFormat=h.VertexFormat.clone(e.defaultValue(n.vertexFormat,h.VertexFormat.DEFAULT)),this._granularity=e.defaultValue(n.granularity,u.CesiumMath.RADIANS_PER_DEGREE),e.defined(n.id)&&(a=n.id._polylineVolume.RootTransform,this._rootTransform=a),n.rootTransform&&(this._rootTransform=n.rootTransform),e.defined(n.isFromGLP)&&(this._isFromGLP=n.isFromGLP),this._workerName="createPolylineVolumeGeometry";let s=1+o.length*r.Cartesian3.packedLength;s+=1+i.length*t.Cartesian2.packedLength,e.defined(a)&&(s+=1+a.le