bimland/dist/Cesium/Workers/createCorridorGeometry.js

2 lines
16 KiB
JavaScript
Raw Normal View History

2023-07-26 17:04:38 +08:00
define(["./arrayFill-4513d7ad","./arrayRemoveDuplicates-d2f048c5","./buildModuleUrl-4e1b81e7","./Cartographic-3309dd0d","./Check-7b2a090c","./ComponentDatatype-c140a87d","./PolylineVolumeGeometryLibrary-9eff1196","./CorridorGeometryLibrary-3fc03967","./when-b60132fc","./Cartesian2-47311507","./GeometryAttribute-3a88ba31","./GeometryAttributes-252e9929","./GeometryOffsetAttribute-fbeb6f1a","./IndexDatatype-8a5eead4","./Math-119be1a3","./PolygonPipeline-660e1625","./PrimitiveType-a54dc62f","./VertexFormat-6446fca0","./Event-16a2dfbf","./RuntimeError-4a5c8994","./WebGLConstants-4ae0db90","./Cartesian4-3ca25aab","./EllipsoidTangentPlane-edb321d3","./IntersectionTests-7386ffbf","./Plane-7ae8294c","./PolylinePipeline-2fe9092e","./EllipsoidGeodesic-0f19ac62","./EllipsoidRhumbLine-ed1a6bf4","./FeatureDetection-c3b71206","./earcut-2.2.1-20c8012f"],(function(t,e,r,a,i,o,n,s,l,d,u,m,f,y,c,p,h,g,C,b,v,A,_,w,T,G,E,V,F,L){"use strict";var P=new a.Cartesian3,x=new a.Cartesian3,N=new a.Cartesian3,D=new a.Cartesian3,M=new a.Cartesian3,O=new a.Cartesian3,I=new a.Cartesian3,S=new a.Cartesian3;function R(t,e){for(var r=0;r<t.length;r++)t[r]=e.scaleToGeodeticSurface(t[r],t[r]);return t}function k(t,e,r,i,o,n){var l=t.normals,d=t.tangents,u=t.bitangents,m=a.Cartesian3.normalize(a.Cartesian3.cross(r,e,I),I);n.normal&&s.CorridorGeometryLibrary.addAttribute(l,e,i,o),n.tangent&&s.CorridorGeometryLibrary.addAttribute(d,m,i,o),n.bitangent&&s.CorridorGeometryLibrary.addAttribute(u,r,i,o)}function H(t,e,r){var i,n,d,f=t.positions,p=t.corners,h=t.endPositions,g=t.lefts,C=t.normals,b=new m.GeometryAttributes,v=0,A=0,_=0;for(n=0;n<f.length;n+=2)v+=d=f[n].length-3,_+=2*d,A+=f[n+1].length-3;for(v+=3,A+=3,n=0;n<p.length;n++){i=p[n];var w=p[n].leftPositions;l.defined(w)?(v+=d=w.length,_+=d):(A+=d=p[n].rightPositions.length,_+=d)}var T,G=l.defined(h);G&&(v+=T=h[0].length-3,A+=T,_+=6*(T/=3));var E,V,F,L,M,R,H=v+A,z=new Float64Array(H),U={normals:e.normal?new Float32Array(H):void 0,tangents:e.tangent?new Float32Array(H):void 0,bitangents:e.bitangent?new Float32Array(H):void 0},B=0,Y=H-1,W=P,q=x,J=T/2,j=y.IndexDatatype.createTypedArray(H/3,_),K=0;if(G){R=N,M=D;var Q=h[0];for(W=a.Cartesian3.fromArray(C,0,W),q=a.Cartesian3.fromArray(g,0,q),n=0;n<J;n++)R=a.Cartesian3.fromArray(Q,3*(J-1-n),R),M=a.Cartesian3.fromArray(Q,3*(J+n),M),s.CorridorGeometryLibrary.addAttribute(z,M,B),s.CorridorGeometryLibrary.addAttribute(z,R,void 0,Y),k(U,W,q,B,Y,e),L=(V=B/3)+1,F=(E=(Y-2)/3)-1,j[K++]=E,j[K++]=V,j[K++]=F,j[K++]=F,j[K++]=V,j[K++]=L,B+=3,Y-=3}var X,Z,$=0,tt=0,et=f[$++],rt=f[$++];for(z.set(et,B),z.set(rt,Y-rt.length+1),q=a.Cartesian3.fromArray(g,tt,q),d=rt.length-3,n=0;n<d;n+=3)X=r.geodeticSurfaceNormal(a.Cartesian3.fromArray(et,n,I),I),Z=r.geodeticSurfaceNormal(a.Cartesian3.fromArray(rt,d-n,S),S),k(U,W=a.Cartesian3.normalize(a.Cartesian3.add(X,Z,W),W),q,B,Y,e),L=(V=B/3)+1,F=(E=(Y-2)/3)-1,j[K++]=E,j[K++]=V,j[K++]=F,j[K++]=F,j[K++]=V,j[K++]=L,B+=3,Y-=3;for(X=r.geodeticSurfaceNormal(a.Cartesian3.fromArray(et,d,I),I),Z=r.geodeticSurfaceNormal(a.Cartesian3.fromArray(rt,d,S),S),W=a.Cartesian3.normalize(a.Cartesian3.add(X,Z,W),W),tt+=3,n=0;n<p.length;n++){var at,it,ot,nt=(i=p[n]).leftPositions,st=i.rightPositions,lt=O,dt=N,ut=D;if(W=a.Cartesian3.fromArray(C,tt,W),l.defined(nt)){for(k(U,W,q,void 0,Y,e),Y-=3,it=L,ot=F,at=0;at<nt.length/3;at++)lt=a.Cartesian3.fromArray(nt,3*at,lt),j[K++]=it,j[K++]=ot-at-1,j[K++]=ot-at,s.CorridorGeometryLibrary.addAttribute(z,lt,void 0,Y),dt=a.Cartesian3.fromArray(z,3*(ot-at-1),dt),ut=a.Cartesian3.fromArray(z,3*it,ut),k(U,W,q=a.Cartesian3.normalize(a.Cartesian3.subtract(dt,ut,q),q),void 0,Y,e),Y-=3;lt=a.Cartesian3.fromArray(z,3*it,lt),dt=a.Cartesian3.subtract(a.Cartesian3.fromArray(z,3*ot,dt),lt,dt),ut=a.Cartesian3.subtract(a.Cartesian3.fromArray(z,3*(ot-at),ut),lt,ut),k(U,W,q=a.Cartesian3.normalize(a.Cartesian3.add(dt,ut,q),q),B,void 0,e),B+=3}else{for(k(U,W,q,B,void 0,e),B+=3,it=F,ot=L,at=0;at<st.length/3;at++)lt=a.Cartesian3.fromArray(st,3*at,lt),j[K++]=it,j[K++]=ot+at,j[K++]=ot+at+1,s.CorridorGeometryLibrary.addAttribute(z,lt,B),dt=a.Cartesian3.fro