YZProjectCloud/yanzhu-ui-vue3/public/Engine/Workers/createPolygonGeometry.js

2 lines
15 KiB
JavaScript
Raw Normal View History

2025-04-07 00:55:58 +08:00
define(["./defaultValue-81eec7ed","./Matrix2-e3fb4559","./ArcType-fc72c06c","./GeometryOffsetAttribute-ed56ff58","./BoundingRectangle-b88064b7","./Transforms-98ffa11d","./Cartesian3-7e9cc2ff","./Check-741c5f3c","./ComponentDatatype-aaeec80f","./EllipsoidGeodesic-6de45192","./EllipsoidTangentPlane-fa1337e1","./GeometryAttribute-b025f9a8","./GeometryInstance-ce434bcb","./GeometryPipeline-4b426993","./IndexDatatype-f1e3f799","./Math-5f585871","./Matrix4-d34187af","./PolygonGeometryLibrary-8f834b9d","./PolygonPipeline-6f83d8b1","./VertexFormat-d50a69ba","./_commonjsHelpers-3aae1032-26891ab7","./combine-3c023bda","./RuntimeError-26acdd3b","./WebGLConstants-508b9636","./AxisAlignedBoundingBox-37250ed6","./IntersectionTests-73b87d72","./Plane-4f75b3df","./AttributeCompression-e2e3f0dd","./EncodedCartesian3-aac44514","./arrayRemoveDuplicates-85770175","./EllipsoidRhumbLine-9c6b32ea","./GeometryAttributes-32b29525"],(function(e,t,o,i,n,r,a,s,l,c,u,p,m,y,g,d,h,f,b,_,P,x,C,w,T,I,A,E,v,G,O,V){"use strict";const F=new t.Cartographic,D=new t.Cartographic;function L(e,t,o,i){const n=i.cartesianToCartographic(e,F).height,r=i.cartesianToCartographic(t,D);r.height=n,i.cartographicToCartesian(r,t);const a=i.cartesianToCartographic(o,D);a.height=n-100,i.cartographicToCartesian(a,o)}const N=new n.BoundingRectangle,H=new a.Cartesian3,R=new a.Cartesian3,M=new a.Cartesian3,S=new a.Cartesian3,B=new a.Cartesian3,k=new a.Cartesian3;let z=new a.Cartesian3,W=new a.Cartesian3,Y=new a.Cartesian3;const U=new t.Cartesian2,j=new t.Cartesian2,Q=new a.Cartesian3,q=new r.Quaternion,K=new h.Matrix3,Z=new h.Matrix3;function J(o){const n=o.vertexFormat,s=o.geometry,c=o.shadowVolume,u=s.attributes.position.values;let m=u.length;const y=o.wall,g=o.top||y,f=o.bottom||y;if(n.st||n.normal||n.tangent||n.bitangent||c){const e=o.boundingRectangle,i=o.tangentPlane,b=o.ellipsoid,_=o.stRotation,P=o.perPositionHeight,x=U;x.x=e.x,x.y=e.y;const C=n.st?new Float32Array(m/3*2):void 0;let w;n.normal&&(w=P&&g&&!y?s.attributes.normal.values:new Float32Array(m));const T=n.tangent?new Float32Array(m):void 0,I=n.bitangent?new Float32Array(m):void 0,A=c?new Float32Array(m):void 0;let E=0,v=0,G=R,O=M,V=S,F=!0,D=K,N=Z;if(0!==_){let e=r.Quaternion.fromAxisAngle(i._plane.normal,_,q);D=h.Matrix3.fromQuaternion(e,D),e=r.Quaternion.fromAxisAngle(i._plane.normal,-_,q),N=h.Matrix3.fromQuaternion(e,N)}else D=h.Matrix3.clone(h.Matrix3.IDENTITY,D),N=h.Matrix3.clone(h.Matrix3.IDENTITY,N);let J=0,X=0;g&&f&&(J=m/2,X=m/3,m/=2);for(let r=0;r<m;r+=3){const s=a.Cartesian3.fromArray(u,r,Q);if(n.st){let o=h.Matrix3.multiplyByVector(D,s,H);o=b.scaleToGeodeticSurface(o,o);const n=i.projectPointOntoPlane(o,j);t.Cartesian2.subtract(n,x,n);const r=d.CesiumMath.clamp(n.x/e.width,0,1),a=d.CesiumMath.clamp(n.y/e.height,0,1);f&&(C[E+X]=r,C[E+1+X]=a),g&&(C[E]=r,C[E+1]=a),E+=2}if(n.normal||n.tangent||n.bitangent||c){const e=v+1,t=v+2;if(y){if(r+3<m){const e=a.Cartesian3.fromArray(u,r+3,B);if(F){const t=a.Cartesian3.fromArray(u,r+m,k);P&&L(s,e,t,b),a.Cartesian3.subtract(e,s,e),a.Cartesian3.subtract(t,s,t),G=a.Cartesian3.normalize(a.Cartesian3.cross(t,e,G),G),F=!1}a.Cartesian3.equalsEpsilon(e,s,d.CesiumMath.EPSILON10)&&(F=!0)}(n.tangent||n.bitangent)&&(V=b.geodeticSurfaceNormal(s,V),n.tangent&&(O=a.Cartesian3.normalize(a.Cartesian3.cross(V,G,O),O)))}else G=b.geodeticSurfaceNormal(s,G),(n.tangent||n.bitangent)&&(P&&(z=a.Cartesian3.fromArray(w,v,z),W=a.Cartesian3.cross(a.Cartesian3.UNIT_Z,z,W),W=a.Cartesian3.normalize(h.Matrix3.multiplyByVector(N,W,W),W),n.bitangent&&(Y=a.Cartesian3.normalize(a.Cartesian3.cross(z,W,Y),Y))),O=a.Cartesian3.cross(a.Cartesian3.UNIT_Z,G,O),O=a.Cartesian3.normalize(h.Matrix3.multiplyByVector(N,O,O),O),n.bitangent&&(V=a.Cartesian3.normalize(a.Cartesian3.cross(G,O,V),V)));n.normal&&(o.wall?(w[v+J]=G.x,w[e+J]=G.y,w[t+J]=G.z):f&&(w[v+J]=-G.x,w[e+J]=-G.y,w[t+J]=-G.z),(g&&!P||y)&&(w[v]=G.x,w[e]=G.y,w[t]=G.z)),c&&(y&&(G=b.geodeticSurfaceNormal(s,G)),A[v+J]=-G.x,A[e+J]=-G.y,A[t+J]=-G.z),n.tangent&&(o.wall?(T[v+J]=O.x,T[e+J]=O.y,T[t+J]=O.z):f&&(T[v+J]=-O.x,T[e+J]=-O.y,T[t+J]=-O.z),g&&(P?(T[v]=W.x,T