1
Surpriseplus
2022-09-16 a7e5110ef3f5fe3c9205f7d1a526b9fbbb55d826
1
define(["./GeometryOffsetAttribute-9dbaeacc","./Transforms-a6362ad2","./Matrix2-ae0e0b05","./RuntimeError-ffc802eb","./ComponentDatatype-64cf6611","./CylinderGeometryLibrary-17d021e5","./when-e3a49219","./GeometryAttribute-50aef525","./GeometryAttributes-3db3f2c9","./IndexDatatype-e12e2493","./combine-c7a1ec8a","./PixelFormat-83d70a69","./WebGLConstants-1c8239cc"],(function(e,t,i,r,a,n,o,u,s,f,d,c,l){"use strict";var m=new i.Cartesian2;function b(e){var t=(e=o.defaultValue(e,o.defaultValue.EMPTY_OBJECT)).length,i=e.topRadius,r=e.bottomRadius,a=o.defaultValue(e.slices,128),n=Math.max(o.defaultValue(e.numberOfVerticalLines,16),0);this._length=t,this._topRadius=i,this._bottomRadius=r,this._slices=a,this._numberOfVerticalLines=n,this._offsetAttribute=e.offsetAttribute,this._workerName="createCylinderOutlineGeometry"}b.packedLength=6,b.pack=function(e,t,i){return i=o.defaultValue(i,0),t[i++]=e._length,t[i++]=e._topRadius,t[i++]=e._bottomRadius,t[i++]=e._slices,t[i++]=e._numberOfVerticalLines,t[i]=o.defaultValue(e._offsetAttribute,-1),t};var p={length:void 0,topRadius:void 0,bottomRadius:void 0,slices:void 0,numberOfVerticalLines:void 0,offsetAttribute:void 0};return b.unpack=function(e,t,i){t=o.defaultValue(t,0);var r=e[t++],a=e[t++],n=e[t++],u=e[t++],s=e[t++],f=e[t];return o.defined(i)?(i._length=r,i._topRadius=a,i._bottomRadius=n,i._slices=u,i._numberOfVerticalLines=s,i._offsetAttribute=-1===f?void 0:f,i):(p.length=r,p.topRadius=a,p.bottomRadius=n,p.slices=u,p.numberOfVerticalLines=s,p.offsetAttribute=-1===f?void 0:f,new b(p))},b.createGeometry=function(r){var d=r._length,c=r._topRadius,l=r._bottomRadius,b=r._slices,p=r._numberOfVerticalLines;if(!(d<=0||c<0||l<0||0===c&&0===l)){var y,_=2*b,h=n.CylinderGeometryLibrary.computePositions(d,c,l,b,!1),v=2*b;if(p>0){var A=Math.min(p,b);y=Math.round(b/A),v+=A}var R,G=f.IndexDatatype.createTypedArray(_,2*v),O=0;for(R=0;R<b-1;R++)G[O++]=R,G[O++]=R+1,G[O++]=R+b,G[O++]=R+1+b;if(G[O++]=b-1,G[O++]=0,G[O++]=b+b-1,G[O++]=b,p>0)for(R=0;R<b;R+=y)G[O++]=R,G[O++]=R+b;var V=new s.GeometryAttributes;V.position=new u.GeometryAttribute({componentDatatype:a.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:h}),m.x=.5*d,m.y=Math.max(l,c);var L=new t.BoundingSphere(i.Cartesian3.ZERO,i.Cartesian2.magnitude(m));if(o.defined(r._offsetAttribute)){d=h.length;var g=new Uint8Array(d/3),C=r._offsetAttribute===e.GeometryOffsetAttribute.NONE?0:1;e.arrayFill(g,C),V.applyOffset=new u.GeometryAttribute({componentDatatype:a.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:g})}return new u.Geometry({attributes:V,indices:G,primitiveType:u.PrimitiveType.LINES,boundingSphere:L,offsetAttribute:r._offsetAttribute})}},function(e,t){return o.defined(t)&&(e=b.unpack(e,t)),b.createGeometry(e)}}));