|
|
|
|
define(["./defaultValue-ac2201bb","./Matrix2-6555478a","./ArcType-5c683766","./BoundingRectangle-6bfae79e","./Transforms-6c4dd71f","./RuntimeError-d45af186","./ComponentDatatype-43ab226f","./EllipsoidGeodesic-a67aa524","./EllipsoidTangentPlane-764a8df1","./GeometryAttribute-a34d86d0","./GeometryInstance-9c4e19d7","./GeometryOffsetAttribute-a17b96d9","./GeometryPipeline-f5483757","./IndexDatatype-88be9f5a","./PolygonGeometryLibrary-c5c437c2","./PolygonPipeline-666b269f","./VertexFormat-d53ce9da","./_commonjsHelpers-3aae1032-ac53d93e","./combine-0dce9b0f","./WebGLConstants-e12cdc8a","./AxisAlignedBoundingBox-b6ec0c56","./IntersectionTests-4db2368e","./Plane-a0b66c27","./AttributeCompression-d9dabbfc","./EncodedCartesian3-3f5898d8","./arrayRemoveDuplicates-75feaa04","./EllipsoidRhumbLine-e7a75836","./GeometryAttributes-d060f8b5"],(function(e,t,o,r,i,n,a,s,l,c,u,d,p,y,m,g,h,f,b,_,P,C,x,w,T,I,A,v){"use strict";const E=new t.Cartographic,G=new t.Cartographic;function O(e,t,o,r){const i=r.cartesianToCartographic(e,E).height,n=r.cartesianToCartographic(t,G);n.height=i,r.cartographicToCartesian(n,t);const a=r.cartesianToCartographic(o,G);a.height=i-100,r.cartographicToCartesian(a,o)}const L=new r.BoundingRectangle,V=new t.Cartesian3,H=new t.Cartesian3,D=new t.Cartesian3,N=new t.Cartesian3,F=new t.Cartesian3,R=new t.Cartesian3;let M=new t.Cartesian3,S=new t.Cartesian3,B=new t.Cartesian3;const k=new t.Cartesian2,z=new t.Cartesian2,W=new t.Cartesian3,Y=new i.Quaternion,U=new t.Matrix3,j=new t.Matrix3;function Q(o){const r=o.vertexFormat,n=o.geometry,s=o.shadowVolume,l=n.attributes.position.values,u=e.defined(n.attributes.st)?n.attributes.st.values:void 0;let p=l.length;const y=o.wall,m=o.top||y,g=o.bottom||y;if(r.st||r.normal||r.tangent||r.bitangent||s){const d=o.boundingRectangle,h=o.tangentPlane,f=o.ellipsoid,b=o.stRotation,_=o.perPositionHeight,P=k;P.x=d.x,P.y=d.y;const C=r.st?new Float32Array(p/3*2):void 0;let x;r.normal&&(x=_&&m&&!y?n.attributes.normal.values:new Float32Array(p));const w=r.tangent?new Float32Array(p):void 0,T=r.bitangent?new Float32Array(p):void 0,I=s?new Float32Array(p):void 0;let A=0,v=0,E=H,G=D,L=N,Q=!0,q=U,K=j;if(0!==b){let e=i.Quaternion.fromAxisAngle(h._plane.normal,b,Y);q=t.Matrix3.fromQuaternion(e,q),e=i.Quaternion.fromAxisAngle(h._plane.normal,-b,Y),K=t.Matrix3.fromQuaternion(e,K)}else q=t.Matrix3.clone(t.Matrix3.IDENTITY,q),K=t.Matrix3.clone(t.Matrix3.IDENTITY,K);let Z=0,J=0;m&&g&&(Z=p/2,J=p/3,p/=2);for(let i=0;i<p;i+=3){const n=t.Cartesian3.fromArray(l,i,W);if(r.st&&!e.defined(u)){let e=t.Matrix3.multiplyByVector(q,n,V);e=f.scaleToGeodeticSurface(e,e);const o=h.projectPointOntoPlane(e,z);t.Cartesian2.subtract(o,P,o);const r=a.CesiumMath.clamp(o.x/d.width,0,1),i=a.CesiumMath.clamp(o.y/d.height,0,1);g&&(C[A+J]=r,C[A+1+J]=i),m&&(C[A]=r,C[A+1]=i),A+=2}if(r.normal||r.tangent||r.bitangent||s){const e=v+1,c=v+2;if(y){if(i+3<p){const e=t.Cartesian3.fromArray(l,i+3,F);if(Q){const o=t.Cartesian3.fromArray(l,i+p,R);_&&O(n,e,o,f),t.Cartesian3.subtract(e,n,e),t.Cartesian3.subtract(o,n,o),E=t.Cartesian3.normalize(t.Cartesian3.cross(o,e,E),E),Q=!1}t.Cartesian3.equalsEpsilon(e,n,a.CesiumMath.EPSILON10)&&(Q=!0)}(r.tangent||r.bitangent)&&(L=f.geodeticSurfaceNormal(n,L),r.tangent&&(G=t.Cartesian3.normalize(t.Cartesian3.cross(L,E,G),G)))}else E=f.geodeticSurfaceNormal(n,E),(r.tangent||r.bitangent)&&(_&&(M=t.Cartesian3.fromArray(x,v,M),S=t.Cartesian3.cross(t.Cartesian3.UNIT_Z,M,S),S=t.Cartesian3.normalize(t.Matrix3.multiplyByVector(K,S,S),S),r.bitangent&&(B=t.Cartesian3.normalize(t.Cartesian3.cross(M,S,B),B))),G=t.Cartesian3.cross(t.Cartesian3.UNIT_Z,E,G),G=t.Cartesian3.normalize(t.Matrix3.multiplyByVector(K,G,G),G),r.bitangent&&(L=t.Cartesian3.normalize(t.Cartesian3.cross(E,G,L),L)));r.normal&&(o.wall?(x[v+Z]=E.x,x[e+Z]=E.y,x[c+Z]=E.z):g&&(x[v+Z]=-E.x,x[e+Z]=-E.y,x[c+Z]=-E.z),(m&&!_||y)&&(x[v]=E.x,x[e]=E.y,x[c]=E.z)),s&&(y&&(E=f.geodeticSurfaceNormal(n,E)),I[v+Z]=-E.x,I[e+Z]=-E.y,I[c+Z]=-E.z),r.tangent&&(o.wall?(w[v+Z]=G.x,w[e+Z]=G.y,w[c+Z]=G.z):g&&(w[v+Z]=-G.x,w[e+Z]=-G.y,w[c+Z]=-G.z),m&&(_?(w[v]=S.x,w[e]=S.y,w[c]=S.z
|