meface/docs/.vuepress/public/cesium/Workers/createPolygonGeometry.js

2 lines
15 KiB
JavaScript
Raw Normal View History

2023-11-17 10:54:23 +08:00
define(["./when-4bbc8319","./Matrix2-860854d4","./ArcType-fc72c06c","./GeometryOffsetAttribute-24539cee","./BoundingRectangle-aee525c0","./Transforms-0becfc64","./RuntimeError-1349fdaf","./ComponentDatatype-8f55628c","./EllipsoidGeodesic-0a6aa4ee","./EllipsoidTangentPlane-407b38a6","./GeometryAttribute-4590b388","./GeometryInstance-ace7be43","./GeometryPipeline-8721156a","./IndexDatatype-1d853600","./PolygonGeometryLibrary-70493175","./PolygonPipeline-bfbb6016","./VertexFormat-b8b51b88","./combine-e9466e32","./WebGLConstants-508b9636","./AxisAlignedBoundingBox-ebc959c9","./IntersectionTests-1d677ce2","./Plane-0e4269ac","./AttributeCompression-5f6be9e6","./EncodedCartesian3-6e74751e","./arrayRemoveDuplicates-b1a32b72","./EllipsoidRhumbLine-d4d43630","./GeometryAttributes-7827a6c2"],(function(e,t,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 t.Cartographic,v=new t.Cartographic;function G(e,t,o,i){const n=i.cartesianToCartographic(e,E).height,r=i.cartesianToCartographic(t,v);r.height=n,i.cartographicToCartesian(r,t);const a=i.cartesianToCartographic(o,v);a.height=n-100,i.cartographicToCartesian(a,o)}const O=new n.BoundingRectangle,V=new t.Cartesian3,F=new t.Cartesian3,D=new t.Cartesian3,L=new t.Cartesian3,N=new t.Cartesian3,H=new t.Cartesian3;let R=new t.Cartesian3,M=new t.Cartesian3,S=new t.Cartesian3;const B=new t.Cartesian2,k=new t.Cartesian2,z=new t.Cartesian3,W=new r.Quaternion,Y=new t.Matrix3,U=new t.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 e=o.boundingRectangle,i=o.tangentPlane,d=o.ellipsoid,h=o.stRotation,f=o.perPositionHeight,b=B;b.x=e.x,b.y=e.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 e=r.Quaternion.fromAxisAngle(i._plane.normal,h,W);j=t.Matrix3.fromQuaternion(e,j),e=r.Quaternion.fromAxisAngle(i._plane.normal,-h,W),Q=t.Matrix3.fromQuaternion(e,Q)}else j=t.Matrix3.clone(t.Matrix3.IDENTITY,j),Q=t.Matrix3.clone(t.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=t.Cartesian3.fromArray(c,r,z);if(n.st){let o=t.Matrix3.multiplyByVector(j,a,V);o=d.scaleToGeodeticSurface(o,o);const n=i.projectPointOntoPlane(o,k);t.Cartesian2.subtract(n,b,n);const r=s.CesiumMath.clamp(n.x/e.width,0,1),l=s.CesiumMath.clamp(n.y/e.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 e=I+1,i=I+2;if(m){if(r+3<p){const e=t.Cartesian3.fromArray(c,r+3,N);if(O){const o=t.Cartesian3.fromArray(c,r+p,H);f&&G(a,e,o,d),t.Cartesian3.subtract(e,a,e),t.Cartesian3.subtract(o,a,o),A=t.Cartesian3.normalize(t.Cartesian3.cross(o,e,A),A),O=!1}t.Cartesian3.equalsEpsilon(e,a,s.CesiumMath.EPSILON10)&&(O=!0)}(n.tangent||n.bitangent)&&(v=d.geodeticSurfaceNormal(a,v),n.tangent&&(E=t.Cartesian3.normalize(t.Cartesian3.cross(v,A,E),E)))}else A=d.geodeticSurfaceNormal(a,A),(n.tangent||n.bitangent)&&(f&&(R=t.Cartesian3.fromArray(P,I,R),M=t.Cartesian3.cross(t.Cartesian3.UNIT_Z,R,M),M=t.Cartesian3.normalize(t.Matrix3.multiplyByVector(Q,M,M),M),n.bitangent&&(S=t.Cartesian3.normalize(t.Cartesian3.cross(R,M,S),S))),E=t.Cartesian3.cross(t.Cartesian3.UNIT_Z,A,E),E=t.Cartesian3.normalize(t.Matrix3.multiplyByVector(Q,E,E),E),n.bitangent&&(v=t.Cartesian3.normalize(t.Cartesian3.cross(A,E,v),v)));n.normal&&(o.wall?(P[I+q]=A.x,P[e+q]=A.y,P[i+q]=A.z):g&&(P[I+q]=-A.x,P[e+q]=-A.y,P[i+q]=-A.z),(y&&!f||m)&&(P[I]=A.x,P[e]=A.y,P[i]=A.z)),l&&(m&&(A=d.geodeticSurfaceNormal(a,A)),C[I+q]=-A.x,C[e+q]=-A.y,C[i+q]=-A.z),n.tangent&&(o.wall?(x[I+q]=E.x,x[e+q]=E.y,x[i+q]=E.z):g&&(x[I+q]=-E.x,x[e+q]=-E.y,x[i+q]=-E.z),y&&(f?(x[I]=M.x,x[e]=M.y,x[i]=M.z):(x[I]=E.x,x[e]=E.y,x[i]=E.z))),n.bitangent&&(g&&(w[I+q]=v.x,w[e+q]=v.y,w[i+q]=v.z),y&&(f?(w[I]=S.x,w[e]=S.y,w[i]=S.z):(w[