qd-changjing/public/static/Build/Cesium/Workers/createPolygonGeometry.js

2 lines
15 KiB
JavaScript
Raw Normal View History

2022-07-05 16:56:29 +08:00
define(["./when-4bbc8319","./Matrix2-c6c16658","./ArcType-fc72c06c","./GeometryOffsetAttribute-821af768","./BoundingRectangle-a97789b6","./Transforms-f15de320","./RuntimeError-5b082e8f","./ComponentDatatype-3d0a0aac","./EllipsoidGeodesic-2e7ba57d","./EllipsoidTangentPlane-41514392","./GeometryAttribute-8350368e","./GeometryInstance-0b07c761","./GeometryPipeline-0fb7cb2c","./IndexDatatype-ddbc25a7","./PolygonGeometryLibrary-a02d6b0b","./PolygonPipeline-ff4d4077","./VertexFormat-7b982b01","./combine-e9466e32","./WebGLConstants-508b9636","./AxisAlignedBoundingBox-a572809f","./IntersectionTests-a4e54d9a","./Plane-26e67b94","./AttributeCompression-f7a901f9","./EncodedCartesian3-b1495e46","./arrayRemoveDuplicates-80a91d16","./EllipsoidRhumbLine-c6741351","./GeometryAttributes-7827a6c2"],(function(t,e,o,i,n,r,a,s,l,c,u,p,m,y,g,d,h,f,b,_,P,x,w,C,T,I,A){"use strict";const E=new e.Cartographic,v=new e.Cartographic;function G(t,e,o,i){const n=i.cartesianToCartographic(t,E).height,r=i.cartesianToCartographic(e,v);r.height=n,i.cartographicToCartesian(r,e);const a=i.cartesianToCartographic(o,v);a.height=n-100,i.cartographicToCartesian(a,o)}const O=new n.BoundingRectangle,V=new e.Cartesian3,F=new e.Cartesian3,D=new e.Cartesian3,L=new e.Cartesian3,N=new e.Cartesian3,H=new e.Cartesian3;let R=new e.Cartesian3,M=new e.Cartesian3,S=new e.Cartesian3;const B=new e.Cartesian2,k=new e.Cartesian2,z=new e.Cartesian3,W=new r.Quaternion,Y=new e.Matrix3,U=new e.Matrix3;function j(o){const n=o.vertexFormat,a=o.geometry,l=o.shadowVolume,c=a.attributes.position.values;let p=c.length;const m=o.wall,y=o.top||m,g=o.bottom||m;if(n.st||n.normal||n.tangent||n.bitangent||l){const t=o.boundingRectangle,i=o.tangentPlane,d=o.ellipsoid,h=o.stRotation,f=o.perPositionHeight,b=B;b.x=t.x,b.y=t.y;const _=n.st?new Float32Array(p/3*2):void 0;let P;n.normal&&(P=f&&y&&!m?a.attributes.normal.values:new Float32Array(p));const x=n.tangent?new Float32Array(p):void 0,w=n.bitangent?new Float32Array(p):void 0,C=l?new Float32Array(p):void 0;let T=0,I=0,A=F,E=D,v=L,O=!0,j=Y,Q=U;if(0!==h){let t=r.Quaternion.fromAxisAngle(i._plane.normal,h,W);j=e.Matrix3.fromQuaternion(t,j),t=r.Quaternion.fromAxisAngle(i._plane.normal,-h,W),Q=e.Matrix3.fromQuaternion(t,Q)}else j=e.Matrix3.clone(e.Matrix3.IDENTITY,j),Q=e.Matrix3.clone(e.Matrix3.IDENTITY,Q);let q=0,K=0;y&&g&&(q=p/2,K=p/3,p/=2);for(let r=0;r<p;r+=3){const a=e.Cartesian3.fromArray(c,r,z);if(n.st){let o=e.Matrix3.multiplyByVector(j,a,V);o=d.scaleToGeodeticSurface(o,o);const n=i.projectPointOntoPlane(o,k);e.Cartesian2.subtract(n,b,n);const r=s.CesiumMath.clamp(n.x/t.width,0,1),l=s.CesiumMath.clamp(n.y/t.height,0,1);g&&(_[T+K]=r,_[T+1+K]=l),y&&(_[T]=r,_[T+1]=l),T+=2}if(n.normal||n.tangent||n.bitangent||l){const t=I+1,i=I+2;if(m){if(r+3<p){const t=e.Cartesian3.fromArray(c,r+3,N);if(O){const o=e.Cartesian3.fromArray(c,r+p,H);f&&G(a,t,o,d),e.Cartesian3.subtract(t,a,t),e.Cartesian3.subtract(o,a,o),A=e.Cartesian3.normalize(e.Cartesian3.cross(o,t,A),A),O=!1}e.Cartesian3.equalsEpsilon(t,a,s.CesiumMath.EPSILON10)&&(O=!0)}(n.tangent||n.bitangent)&&(v=d.geodeticSurfaceNormal(a,v),n.tangent&&(E=e.Cartesian3.normalize(e.Cartesian3.cross(v,A,E),E)))}else A=d.geodeticSurfaceNormal(a,A),(n.tangent||n.bitangent)&&(f&&(R=e.Cartesian3.fromArray(P,I,R),M=e.Cartesian3.cross(e.Cartesian3.UNIT_Z,R,M),M=e.Cartesian3.normalize(e.Matrix3.multiplyByVector(Q,M,M),M),n.bitangent&&(S=e.Cartesian3.normalize(e.Cartesian3.cross(R,M,S),S))),E=e.Cartesian3.cross(e.Cartesian3.UNIT_Z,A,E),E=e.Cartesian3.normalize(e.Matrix3.multiplyByVector(Q,E,E),E),n.bitangent&&(v=e.Cartesian3.normalize(e.Cartesian3.cross(A,E,v),v)));n.normal&&(o.wall?(P[I+q]=A.x,P[t+q]=A.y,P[i+q]=A.z):g&&(P[I+q]=-A.x,P[t+q]=-A.y,P[i+q]=-A.z),(y&&!f||m)&&(P[I]=A.x,P[t]=A.y,P[i]=A.z)),l&&(m&&(A=d.geodeticSurfaceNormal(a,A)),C[I+q]=-A.x,C[t+q]=-A.y,C[i+q]=-A.z),n.tangent&&(o.wall?(x[I+q]=E.x,x[t+q]=E.y,x[i+q]=E.z):g&&(x[I+q]=-E.x,x[t+q]=-E.y,x[i+q]=-E.z),y&&(f?(x[I]=M.x,x[t]=M.y,x[i]=M.z):(x[I]=E.x,x[t]=E.y,x[i]=E.z))),n.bitangent&&(g&&(w[I+q]=v.x,w[t+q]=v.y,w[i+q]=v.z),y&&(f?(w[I]=S.x,w[t]=S.y,w[i]=S.z):(w[