2 lines
16 KiB
JavaScript
2 lines
16 KiB
JavaScript
|
define(["./defaultValue-f6d5e6da","./Matrix3-81054f0f","./ArcType-26a3f38d","./BoundingRectangle-1d581417","./Transforms-20461479","./Matrix2-413c4048","./ComponentDatatype-ab629b88","./EllipsoidGeodesic-2723ab86","./EllipsoidTangentPlane-d430e7d5","./GeometryAttribute-b8117bde","./GeometryInstance-0318e0cd","./GeometryOffsetAttribute-2579b8d2","./GeometryPipeline-fcaf4d4d","./IndexDatatype-d3db4e7d","./Math-2ce22ee9","./PolygonGeometryLibrary-d7e504f0","./PolygonPipeline-621b1cb0","./VertexFormat-fbdec922","./combine-0c102d93","./RuntimeError-9b4ce3fb","./WebGLConstants-7f557f93","./AxisAlignedBoundingBox-2c0751ca","./IntersectionTests-a57eed59","./Plane-6add0ae1","./AttributeCompression-48e336db","./EncodedCartesian3-5e2017ab","./arrayRemoveDuplicates-9b636830","./EllipsoidRhumbLine-77eff028","./GeometryAttributes-1e4ddcd2"],(function(t,e,o,i,r,n,a,s,l,u,c,p,y,d,m,g,h,f,b,_,P,x,C,w,T,I,A,v,E){"use strict";const G=new e.Cartographic,O=new e.Cartographic;function L(t,e,o,i){const r=i.cartesianToCartographic(t,G).height,n=i.cartesianToCartographic(e,O);n.height=r,i.cartographicToCartesian(n,e);const a=i.cartesianToCartographic(o,O);a.height=r-100,i.cartographicToCartesian(a,o)}const V=new i.BoundingRectangle,H=new e.Cartesian3,D=new e.Cartesian3,N=new e.Cartesian3,F=new e.Cartesian3,R=new e.Cartesian3,M=new e.Cartesian3;let S=new e.Cartesian3,B=new e.Cartesian3,k=new e.Cartesian3;const z=new n.Cartesian2,W=new n.Cartesian2,Y=new e.Cartesian3,U=new r.Quaternion,j=new e.Matrix3,Q=new e.Matrix3;function q(o){const i=o.vertexFormat,s=o.geometry,l=o.shadowVolume,c=s.attributes.position.values,y=t.defined(s.attributes.st)?s.attributes.st.values:void 0;let d=c.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,x=o.perPositionHeight,C=z;C.x=p.x,C.y=p.y;const w=i.st?new Float32Array(d/3*2):void 0;let T;i.normal&&(T=x&&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 t=r.Quaternion.fromAxisAngle(b._plane.normal,P,U);Z=e.Matrix3.fromQuaternion(t,Z),t=r.Quaternion.fromAxisAngle(b._plane.normal,-P,U),J=e.Matrix3.fromQuaternion(t,J)}else Z=e.Matrix3.clone(e.Matrix3.IDENTITY,Z),J=e.Matrix3.clone(e.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=e.Cartesian3.fromArray(c,r,Y);if(i.st&&!t.defined(y)){let t=e.Matrix3.multiplyByVector(Z,a,H);t=_.scaleToGeodeticSurface(t,t);const o=b.projectPointOntoPlane(t,W);n.Cartesian2.subtract(o,C,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 t=G+1,n=G+2;if(g){if(r+3<d){const t=e.Cartesian3.fromArray(c,r+3,R);if(K){const o=e.Cartesian3.fromArray(c,r+d,M);x&&L(a,t,o,_),e.Cartesian3.subtract(t,a,t),e.Cartesian3.subtract(o,a,o),O=e.Cartesian3.normalize(e.Cartesian3.cross(o,t,O),O),K=!1}e.Cartesian3.equalsEpsilon(t,a,m.CesiumMath.EPSILON10)&&(K=!0)}(i.tangent||i.bitangent)&&(q=_.geodeticSurfaceNormal(a,q),i.tangent&&(V=e.Cartesian3.normalize(e.Cartesian3.cross(q,O,V),V)))}else O=_.geodeticSurfaceNormal(a,O),(i.tangent||i.bitangent)&&(x&&(S=e.Cartesian3.fromArray(T,G,S),B=e.Cartesian3.cross(e.Cartesian3.UNIT_Z,S,B),B=e.Cartesian3.normalize(e.Matrix3.multiplyByVector(J,B,B),B),i.bitangent&&(k=e.Cartesian3.normalize(e.Cartesian3.cross(S,B,k),k))),V=e.Cartesian3.cross(e.Cartesian3.UNIT_Z,O,V),V=e.Cartesian3.normalize(e.Matrix3.multiplyByVector(J,V,V),V),i.bitangent&&(q=e.Cartesian3.normalize(e.Cartesian3.cross(O,V,q),q)));i.normal&&(o.wall?(T[G+X]=O.x,T[t+X]=O.y,T[n+X]=O.z):f&&(T[G+X]=-O.x,T[t+X]=-O.y,T[n+X]=-O.z),(h&&!x||g)&&(T[G]=O.x,T[t]=O.y,T[n]=O.z)),l&&(g&&(O=_.geodeticSurfaceNormal(a,O)),v[G+X]=-O.x,v[t+X]=-O.y,v[n+X]=-O.z),i.tangent&&(o.wall?(I[G+X]=V.x,I[t+X]=V.y,I[n+X]=V.z):f&&(I[G+X]=-V.x,I[t+X]=-V.y,I[n+X]=-V.z),h&&(x?(I[G]=B.x,I[t]=B.y,I[n]=B
|