mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-16 21:31:47 -05:00
2 lines
2.9 KiB
JavaScript
2 lines
2.9 KiB
JavaScript
define(["./GeometryOffsetAttribute-4f901209","./Transforms-ab7258fe","./Matrix2-46444433","./RuntimeError-608565a6","./ComponentDatatype-692a36d3","./when-229515d6","./GeometryAttribute-d3bef603","./GeometryAttributes-b253752a","./combine-35b6d9cb","./WebGLConstants-f63312fc"],(function(t,e,n,a,i,r,o,u,s,m){"use strict";const f=new n.Cartesian3;function c(t){const e=(t=r.defaultValue(t,r.defaultValue.EMPTY_OBJECT)).minimum,a=t.maximum;this._min=n.Cartesian3.clone(e),this._max=n.Cartesian3.clone(a),this._offsetAttribute=t.offsetAttribute,this._workerName="createBoxOutlineGeometry"}c.fromDimensions=function(t){const e=(t=r.defaultValue(t,r.defaultValue.EMPTY_OBJECT)).dimensions,a=n.Cartesian3.multiplyByScalar(e,.5,new n.Cartesian3);return new c({minimum:n.Cartesian3.negate(a,new n.Cartesian3),maximum:a,offsetAttribute:t.offsetAttribute})},c.fromAxisAlignedBoundingBox=function(t){return new c({minimum:t.minimum,maximum:t.maximum})},c.packedLength=2*n.Cartesian3.packedLength+1,c.pack=function(t,e,a){return a=r.defaultValue(a,0),n.Cartesian3.pack(t._min,e,a),n.Cartesian3.pack(t._max,e,a+n.Cartesian3.packedLength),e[a+2*n.Cartesian3.packedLength]=r.defaultValue(t._offsetAttribute,-1),e};const d=new n.Cartesian3,p=new n.Cartesian3,y={minimum:d,maximum:p,offsetAttribute:void 0};return c.unpack=function(t,e,a){e=r.defaultValue(e,0);const i=n.Cartesian3.unpack(t,e,d),o=n.Cartesian3.unpack(t,e+n.Cartesian3.packedLength,p),u=t[e+2*n.Cartesian3.packedLength];return r.defined(a)?(a._min=n.Cartesian3.clone(i,a._min),a._max=n.Cartesian3.clone(o,a._max),a._offsetAttribute=-1===u?void 0:u,a):(y.offsetAttribute=-1===u?void 0:u,new c(y))},c.createGeometry=function(a){const s=a._min,m=a._max;if(n.Cartesian3.equals(s,m))return;const c=new u.GeometryAttributes,d=new Uint16Array(24),p=new Float64Array(24);p[0]=s.x,p[1]=s.y,p[2]=s.z,p[3]=m.x,p[4]=s.y,p[5]=s.z,p[6]=m.x,p[7]=m.y,p[8]=s.z,p[9]=s.x,p[10]=m.y,p[11]=s.z,p[12]=s.x,p[13]=s.y,p[14]=m.z,p[15]=m.x,p[16]=s.y,p[17]=m.z,p[18]=m.x,p[19]=m.y,p[20]=m.z,p[21]=s.x,p[22]=m.y,p[23]=m.z,c.position=new o.GeometryAttribute({componentDatatype:i.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:p}),d[0]=4,d[1]=5,d[2]=5,d[3]=6,d[4]=6,d[5]=7,d[6]=7,d[7]=4,d[8]=0,d[9]=1,d[10]=1,d[11]=2,d[12]=2,d[13]=3,d[14]=3,d[15]=0,d[16]=0,d[17]=4,d[18]=1,d[19]=5,d[20]=2,d[21]=6,d[22]=3,d[23]=7;const y=n.Cartesian3.subtract(m,s,f),b=.5*n.Cartesian3.magnitude(y);if(r.defined(a._offsetAttribute)){const e=p.length,n=new Uint8Array(e/3),r=a._offsetAttribute===t.GeometryOffsetAttribute.NONE?0:1;t.arrayFill(n,r),c.applyOffset=new o.GeometryAttribute({componentDatatype:i.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:n})}return new o.Geometry({attributes:c,indices:d,primitiveType:o.PrimitiveType.LINES,boundingSphere:new e.BoundingSphere(n.Cartesian3.ZERO,b),offsetAttribute:a._offsetAttribute})},function(t,e){return r.defined(e)&&(t=c.unpack(t,e)),c.createGeometry(t)}}));
|