bimland/public/Cesium/Workers/GeometryPipeline-9d1ef0b6.js

2 lines
30 KiB
JavaScript
Raw Normal View History

2023-07-26 17:04:38 +08:00
define(["exports","./AttributeCompression-90851096","./Cartesian2-47311507","./Cartographic-3309dd0d","./Check-7b2a090c","./when-b60132fc","./Math-119be1a3","./buildModuleUrl-4e1b81e7","./Cartesian4-3ca25aab","./ComponentDatatype-c140a87d","./EncodedCartesian3-f1396b05","./GeometryAttribute-3a88ba31","./IndexDatatype-8a5eead4","./IntersectionTests-7386ffbf","./PrimitiveType-a54dc62f","./Plane-7ae8294c"],(function(e,t,r,a,i,n,s,o,u,p,d,l,v,y,f,c){"use strict";var m=new a.Cartesian3,C=new a.Cartesian3,h=new a.Cartesian3;var b={calculateACMR:function(e){var t=(e=n.defaultValue(e,n.defaultValue.EMPTY_OBJECT)).indices,r=e.maximumIndex,a=n.defaultValue(e.cacheSize,24),i=t.length;if(!n.defined(r)){r=0;for(var s=0,o=t[s];s<i;)o>r&&(r=o),o=t[++s]}for(var u=[],p=0;p<r+1;p++)u[p]=0;for(var d=a+1,l=0;l<i;++l)d-u[t[l]]>a&&(u[t[l]]=d,++d);return(d-a+1)/(i/3)}};b.tipsify=function(e){var t,r=(e=n.defaultValue(e,n.defaultValue.EMPTY_OBJECT)).indices,a=e.maximumIndex,i=n.defaultValue(e.cacheSize,24);function s(e,r,a,i,n,s,o){for(var u,p=-1,d=-1,l=0;l<a.length;){var v=a[l];i[v].numLiveTriangles&&(u=0,n-i[v].timeStamp+2*i[v].numLiveTriangles<=r&&(u=n-i[v].timeStamp),(u>d||-1===d)&&(d=u,p=v)),++l}return-1===p?function(e,r,a,i){for(;r.length>=1;){var n=r[r.length-1];if(r.splice(r.length-1,1),e[n].numLiveTriangles>0)return n}for(;t<i;){if(e[t].numLiveTriangles>0)return++t-1;++t}return-1}(i,s,0,o):p}var o=r.length,u=0,p=0,d=r[p],l=o;if(n.defined(a))u=a+1;else{for(;p<l;)d>u&&(u=d),d=r[++p];if(-1===u)return 0;++u}var v,y=[];for(v=0;v<u;v++)y[v]={numLiveTriangles:0,timeStamp:0,vertexTriangles:[]};p=0;for(var f=0;p<l;)y[r[p]].vertexTriangles.push(f),++y[r[p]].numLiveTriangles,y[r[p+1]].vertexTriangles.push(f),++y[r[p+1]].numLiveTriangles,y[r[p+2]].vertexTriangles.push(f),++y[r[p+2]].numLiveTriangles,++f,p+=3;var c=0,m=i+1;t=1;var C,h,b,g,A=[],T=[],x=0,P=[],w=o/3,I=[];for(v=0;v<w;v++)I[v]=!1;for(;-1!==c;){A=[],g=(h=y[c]).vertexTriangles.length;for(var S=0;S<g;++S)if(!I[f=h.vertexTriangles[S]]){I[f]=!0,p=f+f+f;for(var O=0;O<3;++O)b=r[p],A.push(b),T.push(b),P[x]=b,++x,--(C=y[b]).numLiveTriangles,m-C.timeStamp>i&&(C.timeStamp=m,++m),++p}c=s(0,i,A,y,m,T,u)}return P};var g={};function A(e,t,r,a,i){e[t++]=r,e[t++]=a,e[t++]=a,e[t++]=i,e[t++]=i,e[t]=r}function T(e){var t={};for(var r in e)if(e.hasOwnProperty(r)&&n.defined(e[r])&&n.defined(e[r].values)){var a=e[r];t[r]=new l.GeometryAttribute({componentDatatype:a.componentDatatype,componentsPerAttribute:a.componentsPerAttribute,normalize:a.normalize,values:[]})}return t}function x(e,t,r){for(var a in t)if(t.hasOwnProperty(a)&&n.defined(t[a])&&n.defined(t[a].values))for(var i=t[a],s=0;s<i.componentsPerAttribute;++s)e[a].values.push(i.values[r*i.componentsPerAttribute+s])}g.toWireframe=function(e){var t=e.indices;if(n.defined(t)){switch(e.primitiveType){case f.PrimitiveType.TRIANGLES:e.indices=function(e){for(var t=e.length,r=t/3*6,a=v.IndexDatatype.createTypedArray(t,r),i=0,n=0;n<t;n+=3,i+=6)A(a,i,e[n],e[n+1],e[n+2]);return a}(t);break;case f.PrimitiveType.TRIANGLE_STRIP:e.indices=function(e){var t=e.length;if(t>=3){var r=6*(t-2),a=v.IndexDatatype.createTypedArray(t,r);A(a,0,e[0],e[1],e[2]);for(var i=6,n=3;n<t;++n,i+=6)A(a,i,e[n-1],e[n],e[n-2]);return a}return new Uint16Array}(t);break;case f.PrimitiveType.TRIANGLE_FAN:e.indices=function(e){if(e.length>0){for(var t=e.length-1,r=6*(t-1),a=v.IndexDatatype.createTypedArray(t,r),i=e[0],n=0,s=1;s<t;++s,n+=6)A(a,n,i,e[s],e[s+1]);return a}return new Uint16Array}(t)}e.primitiveType=f.PrimitiveType.LINES}return e},g.createLineSegmentsForVectors=function(e,t,r){t=n.defaultValue(t,"normal"),r=n.defaultValue(r,1e4);for(var a,i=e.attributes.position.values,s=e.attributes[t].values,u=i.length,d=new Float64Array(2*u),v=0,y=0;y<u;y+=3)d[v++]=i[y],d[v++]=i[y+1],d[v++]=i[y+2],d[v++]=i[y]+s[y]*r,d[v++]=i[y+1]+s[y+1]*r,d[v++]=i[y+2]+s[y+2]*r;var c=e.boundingSphere;return n.defined(c)&&(a=new o.BoundingSphere(c.center,c.radius+r)),new l.Geometry({attributes:{position:new l.GeometryAttribute({componentDatatype:p.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:d})},primit