mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-11 10:56:12 -05:00
2 lines
15 KiB
JavaScript
2 lines
15 KiB
JavaScript
|
define(["./when-229515d6","./Matrix2-46444433","./ArcType-e1641d8d","./GeometryOffsetAttribute-4f901209","./BoundingRectangle-a0be4c02","./Transforms-ab7258fe","./RuntimeError-608565a6","./ComponentDatatype-692a36d3","./EllipsoidGeodesic-94d72244","./EllipsoidTangentPlane-4deba134","./GeometryAttribute-d3bef603","./GeometryInstance-f781740f","./GeometryPipeline-dfaf2218","./IndexDatatype-7c683b18","./PolygonGeometryLibrary-34c93283","./PolygonPipeline-259e0bdf","./VertexFormat-7272aabd","./combine-35b6d9cb","./WebGLConstants-f63312fc","./AxisAlignedBoundingBox-8f6cec20","./IntersectionTests-4cf437d5","./Plane-1f2a7880","./AttributeCompression-95366034","./EncodedCartesian3-d9d33966","./arrayRemoveDuplicates-ee080d9d","./EllipsoidRhumbLine-9cd85d72","./GeometryAttributes-b253752a"],(function(t,e,o,i,n,r,a,s,l,c,u,p,m,y,d,g,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,d=o.bottom||m;if(n.st||n.normal||n.tangent||n.bitangent||l){const t=o.boundingRectangle,i=o.tangentPlane,g=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&&d&&(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=g.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);d&&(_[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,g),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=g.geodeticSurfaceNormal(a,v),n.tangent&&(E=e.Cartesian3.normalize(e.Cartesian3.cross(v,A,E),E)))}else A=g.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):d&&(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=g.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):d&&(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&&(d&&(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[
|