integrated_traffic_vue/public/lib/Cesium/Workers/createPolygonGeometry.js

2 lines
16 KiB
JavaScript
Raw Normal View History

2024-01-31 09:03:02 +08:00
define(["./defaultValue-0a909f67","./Matrix3-b6f074fa","./ArcType-ce2e50ab","./BoundingRectangle-47fd0937","./Transforms-713aa3a8","./Matrix2-163b5a1d","./ComponentDatatype-77274976","./EllipsoidGeodesic-b00a0416","./EllipsoidTangentPlane-8eee3c2f","./GeometryAttribute-0b8b7b82","./GeometryInstance-9b27c40d","./GeometryOffsetAttribute-04332ce7","./GeometryPipeline-b6eb7525","./IndexDatatype-2149f06c","./Math-e97915da","./PolygonGeometryLibrary-af483c87","./PolygonPipeline-1b86ab0c","./VertexFormat-ab2e00e6","./combine-ca22a614","./RuntimeError-06c93819","./WebGLConstants-a8cc3e8c","./AxisAlignedBoundingBox-c7183545","./IntersectionTests-87baf287","./Plane-1c5a21a3","./AttributeCompression-e18a879a","./EncodedCartesian3-de837603","./arrayRemoveDuplicates-e9673044","./EllipsoidRhumbLine-7f84cca0","./GeometryAttributes-f06a2792"],(function(e,t,o,i,r,n,a,s,l,c,u,p,y,d,m,g,h,f,b,_,P,C,x,w,T,I,A,v,E){"use strict";const G=new t.Cartographic,O=new t.Cartographic;function L(e,t,o,i){const r=i.cartesianToCartographic(e,G).height,n=i.cartesianToCartographic(t,O);n.height=r,i.cartographicToCartesian(n,t);const a=i.cartesianToCartographic(o,O);a.height=r-100,i.cartographicToCartesian(a,o)}const V=new i.BoundingRectangle,H=new t.Cartesian3,D=new t.Cartesian3,N=new t.Cartesian3,F=new t.Cartesian3,R=new t.Cartesian3,M=new t.Cartesian3;let S=new t.Cartesian3,B=new t.Cartesian3,k=new t.Cartesian3;const z=new n.Cartesian2,W=new n.Cartesian2,Y=new t.Cartesian3,U=new r.Quaternion,j=new t.Matrix3,Q=new t.Matrix3;function q(o){const i=o.vertexFormat,s=o.geometry,l=o.shadowVolume,u=s.attributes.position.values,y=e.defined(s.attributes.st)?s.attributes.st.values:void 0;let d=u.length;const g=o.wall,h=o.top||g,f=o.bottom||g;if(i.st||i.normal||i.tangent||i.bitangent||l){const p=o.boundingRectangle,b=o.tangentPlane,_=o.ellipsoid,P=o.stRotation,C=o.perPositionHeight,x=z;x.x=p.x,x.y=p.y;const w=i.st?new Float32Array(d/3*2):void 0;let T;i.normal&&(T=C&&h&&!g?s.attributes.normal.values:new Float32Array(d));const I=i.tangent?new Float32Array(d):void 0,A=i.bitangent?new Float32Array(d):void 0,v=l?new Float32Array(d):void 0;let E=0,G=0,O=D,V=N,q=F,K=!0,Z=j,J=Q;if(0!==P){let e=r.Quaternion.fromAxisAngle(b._plane.normal,P,U);Z=t.Matrix3.fromQuaternion(e,Z),e=r.Quaternion.fromAxisAngle(b._plane.normal,-P,U),J=t.Matrix3.fromQuaternion(e,J)}else Z=t.Matrix3.clone(t.Matrix3.IDENTITY,Z),J=t.Matrix3.clone(t.Matrix3.IDENTITY,J);let X=0,$=0;h&&f&&(X=d/2,$=d/3,d/=2);for(let r=0;r<d;r+=3){const a=t.Cartesian3.fromArray(u,r,Y);if(i.st&&!e.defined(y)){let e=t.Matrix3.multiplyByVector(Z,a,H);e=_.scaleToGeodeticSurface(e,e);const o=b.projectPointOntoPlane(e,W);n.Cartesian2.subtract(o,x,o);const i=m.CesiumMath.clamp(o.x/p.width,0,1),r=m.CesiumMath.clamp(o.y/p.height,0,1);f&&(w[E+$]=i,w[E+1+$]=r),h&&(w[E]=i,w[E+1]=r),E+=2}if(i.normal||i.tangent||i.bitangent||l){const e=G+1,n=G+2;if(g){if(r+3<d){const e=t.Cartesian3.fromArray(u,r+3,R);if(K){const o=t.Cartesian3.fromArray(u,r+d,M);C&&L(a,e,o,_),t.Cartesian3.subtract(e,a,e),t.Cartesian3.subtract(o,a,o),O=t.Cartesian3.normalize(t.Cartesian3.cross(o,e,O),O),K=!1}t.Cartesian3.equalsEpsilon(e,a,m.CesiumMath.EPSILON10)&&(K=!0)}(i.tangent||i.bitangent)&&(q=_.geodeticSurfaceNormal(a,q),i.tangent&&(V=t.Cartesian3.normalize(t.Cartesian3.cross(q,O,V),V)))}else O=_.geodeticSurfaceNormal(a,O),(i.tangent||i.bitangent)&&(C&&(S=t.Cartesian3.fromArray(T,G,S),B=t.Cartesian3.cross(t.Cartesian3.UNIT_Z,S,B),B=t.Cartesian3.normalize(t.Matrix3.multiplyByVector(J,B,B),B),i.bitangent&&(k=t.Cartesian3.normalize(t.Cartesian3.cross(S,B,k),k))),V=t.Cartesian3.cross(t.Cartesian3.UNIT_Z,O,V),V=t.Cartesian3.normalize(t.Matrix3.multiplyByVector(J,V,V),V),i.bitangent&&(q=t.Cartesian3.normalize(t.Cartesian3.cross(O,V,q),q)));i.normal&&(o.wall?(T[G+X]=O.x,T[e+X]=O.y,T[n+X]=O.z):f&&(T[G+X]=-O.x,T[e+X]=-O.y,T[n+X]=-O.z),(h&&!C||g)&&(T[G]=O.x,T[e]=O.y,T[n]=O.z)),l&&(g&&(O=_.geodeticSurfaceNormal(a,O)),v[G+X]=-O.x,v[e+X]=-O.y,v[n+X]=-O.z),i.tangent&&(o.wall?(I[G+X]=V.x,I[e+X]=V.y,I[n+X]=V.z):f&&(I[G+X]=-V.x,I[e+X]=-V.y,I[n+X]=-V.z),h&&(C?(I[G]=B.x,I[e]=B.y,I[n]=B