qd-changjing/public/static/Build/Cesium/Workers/createCoplanarPolygonGeomet...

2 lines
6.2 KiB
JavaScript
Raw Normal View History

2022-07-05 16:56:29 +08:00
define(["./arrayRemoveDuplicates-80a91d16","./BoundingRectangle-a97789b6","./Transforms-f15de320","./Matrix2-c6c16658","./RuntimeError-5b082e8f","./ComponentDatatype-3d0a0aac","./CoplanarPolygonGeometryLibrary-0078be3d","./when-4bbc8319","./GeometryAttribute-8350368e","./GeometryAttributes-7827a6c2","./GeometryInstance-0b07c761","./GeometryPipeline-0fb7cb2c","./IndexDatatype-ddbc25a7","./PolygonGeometryLibrary-a02d6b0b","./PolygonPipeline-ff4d4077","./VertexFormat-7b982b01","./combine-e9466e32","./WebGLConstants-508b9636","./OrientedBoundingBox-f3d80bd4","./EllipsoidTangentPlane-41514392","./AxisAlignedBoundingBox-a572809f","./IntersectionTests-a4e54d9a","./Plane-26e67b94","./AttributeCompression-f7a901f9","./EncodedCartesian3-b1495e46","./ArcType-fc72c06c","./EllipsoidRhumbLine-c6741351"],(function(e,t,n,o,a,r,i,s,l,c,p,y,u,m,d,g,b,h,f,x,C,P,A,w,F,G,L){"use strict";const E=new o.Cartesian3,v=new t.BoundingRectangle,T=new o.Cartesian2,D=new o.Cartesian2,_=new o.Cartesian3,V=new o.Cartesian3,k=new o.Cartesian3,R=new o.Cartesian3,I=new o.Cartesian3,M=new o.Cartesian3,B=new n.Quaternion,H=new o.Matrix3,O=new o.Matrix3,z=new o.Cartesian3;function S(e,t,a,i,s,p,y,m){const g=e.positions;let b=d.PolygonPipeline.triangulate(e.positions2D,e.holes);b.length<3&&(b=[0,1,2]);const h=u.IndexDatatype.createTypedArray(g.length,b.length);h.set(b);let f=H;if(0!==i){let e=n.Quaternion.fromAxisAngle(p,i,B);if(f=o.Matrix3.fromQuaternion(e,f),t.tangent||t.bitangent){e=n.Quaternion.fromAxisAngle(p,-i,B);const a=o.Matrix3.fromQuaternion(e,O);y=o.Cartesian3.normalize(o.Matrix3.multiplyByVector(a,y,y),y),t.bitangent&&(m=o.Cartesian3.normalize(o.Cartesian3.cross(p,y,m),m))}}else f=o.Matrix3.clone(o.Matrix3.IDENTITY,f);const x=D;t.st&&(x.x=a.x,x.y=a.y);const C=g.length,P=3*C,A=new Float64Array(P),w=t.normal?new Float32Array(P):void 0,F=t.tangent?new Float32Array(P):void 0,G=t.bitangent?new Float32Array(P):void 0,L=t.st?new Float32Array(2*C):void 0;let v=0,_=0,V=0,k=0,R=0;for(let e=0;e<C;e++){const n=g[e];if(A[v++]=n.x,A[v++]=n.y,A[v++]=n.z,t.st){const e=s(o.Matrix3.multiplyByVector(f,n,E),T);o.Cartesian2.subtract(e,x,e);const t=r.CesiumMath.clamp(e.x/a.width,0,1),i=r.CesiumMath.clamp(e.y/a.height,0,1);L[R++]=t,L[R++]=i}t.normal&&(w[_++]=p.x,w[_++]=p.y,w[_++]=p.z),t.tangent&&(F[k++]=y.x,F[k++]=y.y,F[k++]=y.z),t.bitangent&&(G[V++]=m.x,G[V++]=m.y,G[V++]=m.z)}const I=new c.GeometryAttributes;return t.position&&(I.position=new l.GeometryAttribute({componentDatatype:r.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:A})),t.normal&&(I.normal=new l.GeometryAttribute({componentDatatype:r.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:w})),t.tangent&&(I.tangent=new l.GeometryAttribute({componentDatatype:r.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:F})),t.bitangent&&(I.bitangent=new l.GeometryAttribute({componentDatatype:r.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:G})),t.st&&(I.st=new l.GeometryAttribute({componentDatatype:r.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:L})),new l.Geometry({attributes:I,indices:h,primitiveType:l.PrimitiveType.TRIANGLES})}function N(e){const t=(e=s.defaultValue(e,s.defaultValue.EMPTY_OBJECT)).polygonHierarchy,n=s.defaultValue(e.vertexFormat,g.VertexFormat.DEFAULT);this._vertexFormat=g.VertexFormat.clone(n),this._polygonHierarchy=t,this._stRotation=s.defaultValue(e.stRotation,0),this._ellipsoid=o.Ellipsoid.clone(s.defaultValue(e.ellipsoid,o.Ellipsoid.WGS84)),this._workerName="createCoplanarPolygonGeometry",this.packedLength=m.PolygonGeometryLibrary.computeHierarchyPackedLength(t)+g.VertexFormat.packedLength+o.Ellipsoid.packedLength+2}N.fromPositions=function(e){return new N({polygonHierarchy:{positions:(e=s.defaultValue(e,s.defaultValue.EMPTY_OBJECT)).positions},vertexFormat:e.vertexFormat,stRotation:e.stRotation,ellipsoid:e.ellipsoid})},N.pack=function(e,t,n){return n=s.defaultValue(n,0),n=m.PolygonGeometryLibrary.packPolygonHierarchy(e._polygonHierarchy,t,n),o.Ellipsoid.pack(e._ellipsoid,t,n),n+=o.Ellipsoid.packedLength,g.VertexFormat.pack(e._vertexFormat,t,n),n+=g.Vertex