Agriculture-front-end/dist/Cesium/Workers/createRectangleGeometry.js

2 lines
16 KiB
JavaScript
Raw Normal View History

2023-09-11 21:56:39 +08:00
define(["./when-b60132fc","./Cartesian2-47311507","./arrayFill-4513d7ad","./BoundingSphere-561b54d0","./Cartographic-3309dd0d","./Check-7b2a090c","./ComponentDatatype-c140a87d","./GeometryAttribute-3a42bbdc","./GeometryAttributes-252e9929","./GeometryInstance-41780fb6","./GeometryOffsetAttribute-fbeb6f1a","./GeometryPipeline-e1b82a4e","./IndexDatatype-8a5eead4","./Math-119be1a3","./PolygonPipeline-f49953b9","./PrimitiveType-39acab88","./Transforms-cb0006b0","./RectangleGeometryLibrary-8761458c","./VertexFormat-6446fca0","./Cartesian4-3ca25aab","./RuntimeError-4a5c8994","./WebGLConstants-4ae0db90","./AttributeCompression-90851096","./EncodedCartesian3-f1396b05","./IntersectionTests-0c6d0a14","./Plane-097b3a8f","./earcut-2.2.1-20c8012f","./EllipsoidRhumbLine-ed1a6bf4","./buildModuleUrl-3addfe33","./FeatureDetection-c3b71206"],(function(t,e,a,r,n,i,o,s,l,u,c,m,d,p,g,y,f,h,b,v,_,A,x,w,C,R,F,E,G,P){"use strict";var V=new n.Cartesian3,L=new n.Cartesian3,D=new n.Cartesian3,M=new n.Cartesian3,T=new e.Rectangle,O=new e.Cartesian2,N=new r.BoundingSphere,S=new r.BoundingSphere;function I(t,e){var a=new s.Geometry({attributes:new l.GeometryAttributes,primitiveType:y.PrimitiveType.TRIANGLES});return a.attributes.position=new s.GeometryAttribute({componentDatatype:o.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:e.positions}),t.normal&&(a.attributes.normal=new s.GeometryAttribute({componentDatatype:o.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:e.normals})),t.tangent&&(a.attributes.tangent=new s.GeometryAttribute({componentDatatype:o.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:e.tangents})),t.bitangent&&(a.attributes.bitangent=new s.GeometryAttribute({componentDatatype:o.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:e.bitangents})),a}var k=new n.Cartesian3,H=new n.Cartesian3;function z(t,e){var a=t._vertexFormat,i=t._ellipsoid,l=e.height,u=e.width,c=e.northCap,m=e.southCap,p=0,g=l,y=l,f=0;c&&(p=1,y-=1,f+=1),m&&(g-=1,y-=1,f+=1),f+=u*y;for(var b=a.position?new Float64Array(3*f):void 0,v=a.st?new Float32Array(2*f):void 0,_=0,A=0,x=V,w=O,C=Number.MAX_VALUE,R=Number.MAX_VALUE,F=-Number.MAX_VALUE,E=-Number.MAX_VALUE,G=p;G<g;++G)for(var P=0;P<u;++P)h.RectangleGeometryLibrary.computePosition(e,i,a.st,G,P,x,w),b[_++]=x.x,b[_++]=x.y,b[_++]=x.z,a.st&&(v[A++]=w.x,v[A++]=w.y,C=Math.min(C,w.x),R=Math.min(R,w.y),F=Math.max(F,w.x),E=Math.max(E,w.y));if(c&&(h.RectangleGeometryLibrary.computePosition(e,i,a.st,0,0,x,w),b[_++]=x.x,b[_++]=x.y,b[_++]=x.z,a.st&&(v[A++]=w.x,v[A++]=w.y,C=w.x,R=w.y,F=w.x,E=w.y)),m&&(h.RectangleGeometryLibrary.computePosition(e,i,a.st,l-1,0,x,w),b[_++]=x.x,b[_++]=x.y,b[_]=x.z,a.st&&(v[A++]=w.x,v[A]=w.y,C=Math.min(C,w.x),R=Math.min(R,w.y),F=Math.max(F,w.x),E=Math.max(E,w.y))),a.st&&(C<0||R<0||F>1||E>1))for(var T=0;T<v.length;T+=2)v[T]=(v[T]-C)/(F-C),v[T+1]=(v[T+1]-R)/(E-R);var N=function(t,e,a,i){var o=t.length,s=e.normal?new Float32Array(o):void 0,l=e.tangent?new Float32Array(o):void 0,u=e.bitangent?new Float32Array(o):void 0,c=0,m=M,d=D,p=L;if(e.normal||e.tangent||e.bitangent)for(var g=0;g<o;g+=3){var y=n.Cartesian3.fromArray(t,g,V),f=c+1,h=c+2;p=a.geodeticSurfaceNormal(y,p),(e.tangent||e.bitangent)&&(n.Cartesian3.cross(n.Cartesian3.UNIT_Z,p,d),r.Matrix3.multiplyByVector(i,d,d),n.Cartesian3.normalize(d,d),e.bitangent&&n.Cartesian3.normalize(n.Cartesian3.cross(p,d,m),m)),e.normal&&(s[c]=p.x,s[f]=p.y,s[h]=p.z),e.tangent&&(l[c]=d.x,l[f]=d.y,l[h]=d.z),e.bitangent&&(u[c]=m.x,u[f]=m.y,u[h]=m.z),c+=3}return I(e,{positions:t,normals:s,tangents:l,bitangents:u})}(b,a,i,e.tangentRotationMatrix),S=6*(u-1)*(y-1);c&&(S+=3*(u-1)),m&&(S+=3*(u-1));var k,H=d.IndexDatatype.createTypedArray(f,S),z=0,B=0;for(k=0;k<y-1;++k){for(var U=0;U<u-1;++U){var Y=z,q=Y+u,X=q+1,Q=Y+1;H[B++]=Y,H[B++]=q,H[B++]=Q,H[B++]=Q,H[B++]=q,H[B++]=X,++z}++z}if(c||m){var W,J,j=f-1,Z=f-1;if(c&&m&&(j=f-2),z=0,c)for(k=0;k<u-1;k++)J=(W=z)+1,H[B++]=j,H[B++]=W,H[B++]=J,++z;if(m)for(z=(y-1)*u,k=0;k<u-1;k++)J=(W=z)+1,H[B++]=W,H[B++]=Z,H[B++]=J,++z}return N.indices=H,a.st&&(N.attributes.st=new s.GeometryAttribute({componentDatatype:o.Compo