createCylinderOutlineGeometry.js 3.1 KB

1
  1. define(["./arrayFill-0358accf","./buildModuleUrl-3d15f25c","./Cartesian2-6033fa5d","./Cartographic-67e73ef9","./Check-52a7d806","./ComponentDatatype-81047f82","./CylinderGeometryLibrary-6601cb33","./when-92c6cf3c","./GeometryAttribute-ef657318","./GeometryAttributes-7f66ea53","./GeometryOffsetAttribute-b4d599f5","./IndexDatatype-4c0e98b8","./PrimitiveType-cdfe443e","./Rectangle-bab7abf0","./Math-92c3b5f7","./Intersect-b97e930a","./Event-3390cd7d","./RuntimeError-c6a62a80","./WebGLConstants-71f10989","./FeatureDetection-067cb23c","./Cartesian4-ad128b5d"],(function(t,e,i,o,r,a,n,s,u,f,c,b,d,p,m,l,y,_,h,v,O){"use strict";var A=new i.o;function R(t){var e=(t=s.u(t,s.u.EMPTY_OBJECT)).length,i=t.topRadius,o=t.bottomRadius,a=s.u(t.slices,128),n=Math.max(s.u(t.numberOfVerticalLines,16),0);if(r.o.typeOf.number("options.positions",e),r.o.typeOf.number("options.topRadius",i),r.o.typeOf.number("options.bottomRadius",o),r.o.typeOf.number.greaterThanOrEquals("options.slices",a,3),s.e(t.offsetAttribute)&&t.offsetAttribute===c.z.TOP)throw new r.t("GeometryOffsetAttribute.TOP is not a supported options.offsetAttribute for this geometry.");this._length=e,this._topRadius=i,this._bottomRadius=o,this._slices=a,this._numberOfVerticalLines=n,this._offsetAttribute=t.offsetAttribute,this._workerName="createCylinderOutlineGeometry"}R.packedLength=6,R.pack=function(t,e,i){return r.o.typeOf.object("value",t),r.o.defined("array",e),i=s.u(i,0),e[i++]=t._length,e[i++]=t._topRadius,e[i++]=t._bottomRadius,e[i++]=t._slices,e[i++]=t._numberOfVerticalLines,e[i]=s.u(t._offsetAttribute,-1),e};var g={length:void 0,topRadius:void 0,bottomRadius:void 0,slices:void 0,numberOfVerticalLines:void 0,offsetAttribute:void 0};return R.unpack=function(t,e,i){r.o.defined("array",t),e=s.u(e,0);var o=t[e++],a=t[e++],n=t[e++],u=t[e++],f=t[e++],c=t[e];return s.e(i)?(i._length=o,i._topRadius=a,i._bottomRadius=n,i._slices=u,i._numberOfVerticalLines=f,i._offsetAttribute=-1===c?void 0:c,i):(g.length=o,g.topRadius=a,g.bottomRadius=n,g.slices=u,g.numberOfVerticalLines=f,g.offsetAttribute=-1===c?void 0:c,new R(g))},R.createGeometry=function(r){var p=r._length,m=r._topRadius,l=r._bottomRadius,y=r._slices,_=r._numberOfVerticalLines;if(!(p<=0||m<0||l<0||0===m&&0===l)){var h,v=2*y,O=n.I.computePositions(p,m,l,y,!1),R=2*y;if(_>0){var g=Math.min(_,y);h=Math.round(y/g),R+=g}var w,L=b.IndexDatatype.createTypedArray(v,2*R),C=0;for(w=0;w<y-1;w++)L[C++]=w,L[C++]=w+1,L[C++]=w+y,L[C++]=w+1+y;if(L[C++]=y-1,L[C++]=0,L[C++]=y+y-1,L[C++]=y,_>0)for(w=0;w<y;w+=h)L[C++]=w,L[C++]=w+y;var E=new f.a;E.position=new u.o({componentDatatype:a.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:O}),A.x=.5*p,A.y=Math.max(l,m);var D=new e.i(o.t.ZERO,i.o.magnitude(A));if(s.e(r._offsetAttribute)){p=O.length;var G=new Uint8Array(p/3),T=r._offsetAttribute===c.z.NONE?0:1;t.d(G,T),E.applyOffset=new u.o({componentDatatype:a.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:G})}return new u.I({attributes:E,indices:L,primitiveType:d._0x29ba75.LINES,boundingSphere:D,offsetAttribute:r._offsetAttribute})}},function(t,e){return s.e(e)&&(t=R.unpack(t,e)),R.createGeometry(t)}}));