mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-11 02:46:12 -05:00
2 lines
2.7 KiB
JavaScript
2 lines
2.7 KiB
JavaScript
|
define(["./GeometryOffsetAttribute-4f901209","./Transforms-ab7258fe","./Matrix2-46444433","./RuntimeError-608565a6","./ComponentDatatype-692a36d3","./CylinderGeometryLibrary-471159cb","./when-229515d6","./GeometryAttribute-d3bef603","./GeometryAttributes-b253752a","./IndexDatatype-7c683b18","./combine-35b6d9cb","./WebGLConstants-f63312fc"],(function(t,e,i,n,o,r,a,s,u,f,d,c){"use strict";const l=new i.Cartesian2;function b(t){const e=(t=a.defaultValue(t,a.defaultValue.EMPTY_OBJECT)).length,i=t.topRadius,n=t.bottomRadius,o=a.defaultValue(t.slices,128),r=Math.max(a.defaultValue(t.numberOfVerticalLines,16),0);this._length=e,this._topRadius=i,this._bottomRadius=n,this._slices=o,this._numberOfVerticalLines=r,this._offsetAttribute=t.offsetAttribute,this._workerName="createCylinderOutlineGeometry"}b.packedLength=6,b.pack=function(t,e,i){return i=a.defaultValue(i,0),e[i++]=t._length,e[i++]=t._topRadius,e[i++]=t._bottomRadius,e[i++]=t._slices,e[i++]=t._numberOfVerticalLines,e[i]=a.defaultValue(t._offsetAttribute,-1),e};const m={length:void 0,topRadius:void 0,bottomRadius:void 0,slices:void 0,numberOfVerticalLines:void 0,offsetAttribute:void 0};return b.unpack=function(t,e,i){e=a.defaultValue(e,0);const n=t[e++],o=t[e++],r=t[e++],s=t[e++],u=t[e++],f=t[e];return a.defined(i)?(i._length=n,i._topRadius=o,i._bottomRadius=r,i._slices=s,i._numberOfVerticalLines=u,i._offsetAttribute=-1===f?void 0:f,i):(m.length=n,m.topRadius=o,m.bottomRadius=r,m.slices=s,m.numberOfVerticalLines=u,m.offsetAttribute=-1===f?void 0:f,new b(m))},b.createGeometry=function(n){let d=n._length;const c=n._topRadius,b=n._bottomRadius,m=n._slices,p=n._numberOfVerticalLines;if(d<=0||c<0||b<0||0===c&&0===b)return;const y=2*m,_=r.CylinderGeometryLibrary.computePositions(d,c,b,m,!1);let h,A=2*m;if(p>0){const t=Math.min(p,m);h=Math.round(m/t),A+=t}const R=f.IndexDatatype.createTypedArray(y,2*A);let G,O=0;for(G=0;G<m-1;G++)R[O++]=G,R[O++]=G+1,R[O++]=G+m,R[O++]=G+1+m;if(R[O++]=m-1,R[O++]=0,R[O++]=m+m-1,R[O++]=m,p>0)for(G=0;G<m;G+=h)R[O++]=G,R[O++]=G+m;const V=new u.GeometryAttributes;V.position=new s.GeometryAttribute({componentDatatype:o.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:_}),l.x=.5*d,l.y=Math.max(b,c);const L=new e.BoundingSphere(i.Cartesian3.ZERO,i.Cartesian2.magnitude(l));if(a.defined(n._offsetAttribute)){d=_.length;const e=new Uint8Array(d/3),i=n._offsetAttribute===t.GeometryOffsetAttribute.NONE?0:1;t.arrayFill(e,i),V.applyOffset=new s.GeometryAttribute({componentDatatype:o.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:e})}return new s.Geometry({attributes:V,indices:R,primitiveType:s.PrimitiveType.LINES,boundingSphere:L,offsetAttribute:n._offsetAttribute})},function(t,e){return a.defined(e)&&(t=b.unpack(t,e)),b.createGeometry(t)}}));
|