createCylinderOutlineGeometry.js 2.8 KB

1
  1. define(["./arrayFill-4513d7ad","./buildModuleUrl-57a32107","./Cartesian2-47311507","./Cartographic-3309dd0d","./Check-7b2a090c","./ComponentDatatype-c140a87d","./CylinderGeometryLibrary-aa453214","./when-b60132fc","./GeometryAttribute-c42d25b7","./GeometryAttributes-252e9929","./GeometryOffsetAttribute-fbeb6f1a","./IndexDatatype-8a5eead4","./Math-119be1a3","./Matrix4-cde86d0e","./Cartesian4-3ca25aab","./RuntimeError-4a5c8994","./WebGLConstants-4ae0db90","./FeatureDetection-c3b71206"],(function(e,t,i,a,r,n,o,u,s,d,f,l,b,c,m,p,y,_){"use strict";var h=new i.Cartesian2;function v(e){var t=(e=u.defaultValue(e,u.defaultValue.EMPTY_OBJECT)).length,i=e.topRadius,a=e.bottomRadius,r=u.defaultValue(e.slices,128),n=Math.max(u.defaultValue(e.numberOfVerticalLines,16),0);this._length=t,this._topRadius=i,this._bottomRadius=a,this._slices=r,this._numberOfVerticalLines=n,this._offsetAttribute=e.offsetAttribute,this._workerName="createCylinderOutlineGeometry"}v.packedLength=6,v.pack=function(e,t,i){return i=u.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]=u.defaultValue(e._offsetAttribute,-1),t};var A={length:void 0,topRadius:void 0,bottomRadius:void 0,slices:void 0,numberOfVerticalLines:void 0,offsetAttribute:void 0};return v.unpack=function(e,t,i){t=u.defaultValue(t,0);var a=e[t++],r=e[t++],n=e[t++],o=e[t++],s=e[t++],d=e[t];return u.defined(i)?(i._length=a,i._topRadius=r,i._bottomRadius=n,i._slices=o,i._numberOfVerticalLines=s,i._offsetAttribute=-1===d?void 0:d,i):(A.length=a,A.topRadius=r,A.bottomRadius=n,A.slices=o,A.numberOfVerticalLines=s,A.offsetAttribute=-1===d?void 0:d,new v(A))},v.createGeometry=function(r){var b=r._length,c=r._topRadius,m=r._bottomRadius,p=r._slices,y=r._numberOfVerticalLines;if(!(b<=0||c<0||m<0||0===c&&0===m)){var _,v=2*p,A=o.CylinderGeometryLibrary.computePositions(b,c,m,p,!1),R=2*p;if(y>0){var C=Math.min(y,p);_=Math.round(p/C),R+=C}var G,O=l.IndexDatatype.createTypedArray(v,2*R),V=0;for(G=0;G<p-1;G++)O[V++]=G,O[V++]=G+1,O[V++]=G+p,O[V++]=G+1+p;if(O[V++]=p-1,O[V++]=0,O[V++]=p+p-1,O[V++]=p,y>0)for(G=0;G<p;G+=_)O[V++]=G,O[V++]=G+p;var g=new d.GeometryAttributes;g.position=new s.GeometryAttribute({componentDatatype:n.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:A}),h.x=.5*b,h.y=Math.max(m,c);var L=new t.BoundingSphere(a.Cartesian3.ZERO,i.Cartesian2.magnitude(h));if(u.defined(r._offsetAttribute)){b=A.length;var w=new Uint8Array(b/3),D=r._offsetAttribute===f.GeometryOffsetAttribute.NONE?0:1;e.arrayFill(w,D),g.applyOffset=new s.GeometryAttribute({componentDatatype:n.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:w})}return new s.Geometry({attributes:g,indices:O,primitiveType:t.PrimitiveType.LINES,boundingSphere:L,offsetAttribute:r._offsetAttribute})}},function(e,t){return u.defined(t)&&(e=v.unpack(e,t)),v.createGeometry(e)}}));