qa-regulatory-gwj-vue/static/map/cesium91/CesiumUnminified/Workers/createRectangleGeometry.js

2 lines
16 KiB
JavaScript
Raw Normal View History

2023-11-07 10:04:37 +08:00
define(["./defaultValue-81eec7ed","./Cartesian2-bd414876","./Rectangle-cf3e0e3e","./GeometryOffsetAttribute-ed56ff58","./BoundingSphere-9a3b5656","./Cartesian3-e0307675","./Check-741c5f3c","./ComponentDatatype-aaeec80f","./GeometryAttribute-2b42a913","./GeometryAttributes-32b29525","./GeometryInstance-1b39c9e8","./GeometryPipeline-e7083fea","./IndexDatatype-3f3c99e8","./Math-e73894ab","./Matrix2-dc0c61cc","./Matrix4-4c545f70","./PolygonPipeline-04baeb41","./Transforms-5b829630","./RectangleGeometryLibrary-5373dad7","./VertexFormat-d50a69ba","./GeographicProjection-c931c7fb","./WebGLConstants-508b9636","./AttributeCompression-8f752c03","./EncodedCartesian3-aafcc30f","./IntersectionTests-80510c7b","./Plane-bc8b6777","./RuntimeError-26acdd3b","./EllipsoidRhumbLine-592e8885","./when-422ea0ae","./Resource-8ae1a924","./combine-3c023bda"],(function(t,e,n,a,o,r,i,s,l,c,u,m,p,d,g,y,f,h,b,_,A,x,w,C,v,R,E,F,G,P,V){"use strict";const L=new r.Cartesian3,D=new r.Cartesian3,M=new r.Cartesian3,T=new r.Cartesian3,O=new n.Rectangle,N=new e.Cartesian2,S=new o.BoundingSphere,I=new o.BoundingSphere;function k(t,e){const n=new l.Geometry({attributes:new c.GeometryAttributes,primitiveType:l.PrimitiveType.TRIANGLES});return n.attributes.position=new l.GeometryAttribute({componentDatatype:s.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:e.positions}),t.normal&&(n.attributes.normal=new l.GeometryAttribute({componentDatatype:s.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:e.normals})),t.tangent&&(n.attributes.tangent=new l.GeometryAttribute({componentDatatype:s.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:e.tangents})),t.bitangent&&(n.attributes.bitangent=new l.GeometryAttribute({componentDatatype:s.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:e.bitangents})),n}const H=new r.Cartesian3,z=new r.Cartesian3;function B(t,e){const n=t._vertexFormat,a=t._ellipsoid,o=e.height,i=e.width,c=e.northCap,u=e.southCap;let m=0,d=o,g=o,f=0;c&&(m=1,g-=1,f+=1),u&&(d-=1,g-=1,f+=1),f+=i*g;const h=n.position?new Float64Array(3*f):void 0,_=n.st?new Float32Array(2*f):void 0;let A=0,x=0;const w=L,C=N;let v=Number.MAX_VALUE,R=Number.MAX_VALUE,E=-Number.MAX_VALUE,F=-Number.MAX_VALUE;for(let t=m;t<d;++t)for(let o=0;o<i;++o)b.RectangleGeometryLibrary.computePosition(e,a,n.st,t,o,w,C),h[A++]=w.x,h[A++]=w.y,h[A++]=w.z,n.st&&(_[x++]=C.x,_[x++]=C.y,v=Math.min(v,C.x),R=Math.min(R,C.y),E=Math.max(E,C.x),F=Math.max(F,C.y));if(c&&(b.RectangleGeometryLibrary.computePosition(e,a,n.st,0,0,w,C),h[A++]=w.x,h[A++]=w.y,h[A++]=w.z,n.st&&(_[x++]=C.x,_[x++]=C.y,v=C.x,R=C.y,E=C.x,F=C.y)),u&&(b.RectangleGeometryLibrary.computePosition(e,a,n.st,o-1,0,w,C),h[A++]=w.x,h[A++]=w.y,h[A]=w.z,n.st&&(_[x++]=C.x,_[x]=C.y,v=Math.min(v,C.x),R=Math.min(R,C.y),E=Math.max(E,C.x),F=Math.max(F,C.y))),n.st&&(v<0||R<0||E>1||F>1))for(let t=0;t<_.length;t+=2)_[t]=(_[t]-v)/(E-v),_[t+1]=(_[t+1]-R)/(F-R);const G=function(t,e,n,a){const o=t.length,i=e.normal?new Float32Array(o):void 0,s=e.tangent?new Float32Array(o):void 0,l=e.bitangent?new Float32Array(o):void 0;let c=0;const u=T,m=M;let p=D;if(e.normal||e.tangent||e.bitangent)for(let d=0;d<o;d+=3){const o=r.Cartesian3.fromArray(t,d,L),g=c+1,f=c+2;p=n.geodeticSurfaceNormal(o,p),(e.tangent||e.bitangent)&&(r.Cartesian3.cross(r.Cartesian3.UNIT_Z,p,m),y.Matrix3.multiplyByVector(a,m,m),r.Cartesian3.normalize(m,m),e.bitangent&&r.Cartesian3.normalize(r.Cartesian3.cross(p,m,u),u)),e.normal&&(i[c]=p.x,i[g]=p.y,i[f]=p.z),e.tangent&&(s[c]=m.x,s[g]=m.y,s[f]=m.z),e.bitangent&&(l[c]=u.x,l[g]=u.y,l[f]=u.z),c+=3}return k(e,{positions:t,normals:i,tangents:s,bitangents:l})}(h,n,a,e.tangentRotationMatrix);let P=6*(i-1)*(g-1);c&&(P+=3*(i-1)),u&&(P+=3*(i-1));const V=p.IndexDatatype.createTypedArray(f,P);let O,S=0,I=0;for(O=0;O<g-1;++O){for(let t=0;t<i-1;++t){const t=S,e=t+i,n=e+1,a=t+1;V[I++]=t,V[I++]=e,V[I++]=a,V[I++]=a,V[I++]=e,V[I++]=n,++S}++S}if(c||u){let t=f-1;const e=f-1;let n,a;if(c&&u&&(t=f-2),S=0,c)for(O=0;O<i-1;O++)n=S,a=n+1,V[I++]=t,V[I++]=n,V[I++]=a,++S;if(u)for(S=(g-1)*i,O=0;O<i-1;O++)n=S,a=n+1,V[I++]=n,V[I++]=e,V[I++]=a,++S}return G