Agriculture-front-end/public/Cesium/Workers/GeometryPipeline-fcaf4d4d.js

2 lines
30 KiB
JavaScript
Raw Normal View History

2023-04-23 09:41:12 +08:00
define(["exports","./AttributeCompression-48e336db","./Matrix2-413c4048","./Matrix3-81054f0f","./defaultValue-f6d5e6da","./Math-2ce22ee9","./Transforms-20461479","./ComponentDatatype-ab629b88","./EncodedCartesian3-5e2017ab","./GeometryAttribute-b8117bde","./IndexDatatype-d3db4e7d","./IntersectionTests-a57eed59","./Plane-6add0ae1"],(function(e,t,n,i,r,a,s,o,u,c,l,p,d){"use strict";const y=new i.Cartesian3,f=new i.Cartesian3,m=new i.Cartesian3;const C={calculateACMR:function(e){const t=(e=r.defaultValue(e,r.defaultValue.EMPTY_OBJECT)).indices;let n=e.maximumIndex;const i=r.defaultValue(e.cacheSize,24),a=t.length;if(!r.defined(n)){n=0;let e=0,i=t[e];for(;e<a;)i>n&&(n=i),++e,i=t[e]}const s=[];for(let e=0;e<n+1;e++)s[e]=0;let o=i+1;for(let e=0;e<a;++e)o-s[t[e]]>i&&(s[t[e]]=o,++o);return(o-i+1)/(a/3)}};C.tipsify=function(e){const t=(e=r.defaultValue(e,r.defaultValue.EMPTY_OBJECT)).indices,n=e.maximumIndex,i=r.defaultValue(e.cacheSize,24);let a;function s(e,t,n,i,r,s,o){let u,c=-1,l=-1,p=0;for(;p<n.length;){const e=n[p];i[e].numLiveTriangles&&(u=0,r-i[e].timeStamp+2*i[e].numLiveTriangles<=t&&(u=r-i[e].timeStamp),(u>l||-1===l)&&(l=u,c=e)),++p}return-1===c?function(e,t,n,i){for(;t.length>=1;){const n=t[t.length-1];if(t.splice(t.length-1,1),e[n].numLiveTriangles>0)return n}for(;a<i;){if(e[a].numLiveTriangles>0)return++a,a-1;++a}return-1}(i,s,0,o):c}const o=t.length;let u=0,c=0,l=t[c];const p=o;if(r.defined(n))u=n+1;else{for(;c<p;)l>u&&(u=l),++c,l=t[c];if(-1===u)return 0;++u}const d=[];let y;for(y=0;y<u;y++)d[y]={numLiveTriangles:0,timeStamp:0,vertexTriangles:[]};c=0;let f=0;for(;c<p;)d[t[c]].vertexTriangles.push(f),++d[t[c]].numLiveTriangles,d[t[c+1]].vertexTriangles.push(f),++d[t[c+1]].numLiveTriangles,d[t[c+2]].vertexTriangles.push(f),++d[t[c+2]].numLiveTriangles,++f,c+=3;let m=0,C=i+1;a=1;let h=[];const v=[];let b,g,A=0;const T=[],x=o/3,P=[];for(y=0;y<x;y++)P[y]=!1;let w,S;for(;-1!==m;){h=[],g=d[m],S=g.vertexTriangles.length;for(let e=0;e<S;++e)if(f=g.vertexTriangles[e],!P[f]){P[f]=!0,c=f+f+f;for(let e=0;e<3;++e)w=t[c],h.push(w),v.push(w),T[A]=w,++A,b=d[w],--b.numLiveTriangles,C-b.timeStamp>i&&(b.timeStamp=C,++C),++c}m=s(0,i,h,d,C,v,u)}return T};var h=C;const v={};function b(e,t,n,i,r){e[t++]=n,e[t++]=i,e[t++]=i,e[t++]=r,e[t++]=r,e[t]=n}function g(e){const t={};for(const n in e)if(e.hasOwnProperty(n)&&r.defined(e[n])&&r.defined(e[n].values)){const i=e[n];t[n]=new c.GeometryAttribute({componentDatatype:i.componentDatatype,componentsPerAttribute:i.componentsPerAttribute,normalize:i.normalize,values:[]})}return t}function A(e,t,n){for(const i in t)if(t.hasOwnProperty(i)&&r.defined(t[i])&&r.defined(t[i].values)){const r=t[i];for(let t=0;t<r.componentsPerAttribute;++t)e[i].values.push(r.values[n*r.componentsPerAttribute+t])}}v.toWireframe=function(e){const t=e.indices;if(r.defined(t)){switch(e.primitiveType){case c.PrimitiveType.TRIANGLES:e.indices=function(e){const t=e.length,n=t/3*6,i=l.IndexDatatype.createTypedArray(t,n);let r=0;for(let n=0;n<t;n+=3,r+=6)b(i,r,e[n],e[n+1],e[n+2]);return i}(t);break;case c.PrimitiveType.TRIANGLE_STRIP:e.indices=function(e){const t=e.length;if(t>=3){const n=6*(t-2),i=l.IndexDatatype.createTypedArray(t,n);b(i,0,e[0],e[1],e[2]);let r=6;for(let n=3;n<t;++n,r+=6)b(i,r,e[n-1],e[n],e[n-2]);return i}return new Uint16Array}(t);break;case c.PrimitiveType.TRIANGLE_FAN:e.indices=function(e){if(e.length>0){const t=e.length-1,n=6*(t-1),i=l.IndexDatatype.createTypedArray(t,n),r=e[0];let a=0;for(let n=1;n<t;++n,a+=6)b(i,a,r,e[n],e[n+1]);return i}return new Uint16Array}(t)}e.primitiveType=c.PrimitiveType.LINES}return e},v.createLineSegmentsForVectors=function(e,t,n){t=r.defaultValue(t,"normal"),n=r.defaultValue(n,1e4);const i=e.attributes.position.values,a=e.attributes[t].values,u=i.length,l=new Float64Array(2*u);let p,d=0;for(let e=0;e<u;e+=3)l[d++]=i[e],l[d++]=i[e+1],l[d++]=i[e+2],l[d++]=i[e]+a[e]*n,l[d++]=i[e+1]+a[e+1]*n,l[d++]=i[e+2]+a[e+2]*n;const y=e.boundingSphere;return r.defined(y)&&(p=new s.BoundingSphere(y.center,y.radius+n)),new c.Geometry({attributes:{position:new c.GeometryAttribute({componentDataty