qd-changjing/public/static/Build/Cesium/Workers/createFrustumOutlineGeometr...

2 lines
2.8 KiB
JavaScript
Raw Normal View History

2022-07-05 16:56:29 +08:00
define(["./when-4bbc8319","./Transforms-f15de320","./Matrix2-c6c16658","./RuntimeError-5b082e8f","./ComponentDatatype-3d0a0aac","./FrustumGeometry-3c5b2b26","./GeometryAttribute-8350368e","./GeometryAttributes-7827a6c2","./combine-e9466e32","./WebGLConstants-508b9636","./Plane-26e67b94","./VertexFormat-7b982b01"],(function(e,t,r,n,a,i,u,o,c,s,p,m){"use strict";function h(n){const a=n.frustum,u=n.orientation,o=n.origin,c=e.defaultValue(n._drawNearPlane,!0);let s,p;a instanceof i.PerspectiveFrustum?(s=0,p=i.PerspectiveFrustum.packedLength):a instanceof i.OrthographicFrustum&&(s=1,p=i.OrthographicFrustum.packedLength),this._frustumType=s,this._frustum=a.clone(),this._origin=r.Cartesian3.clone(o),this._orientation=t.Quaternion.clone(u),this._drawNearPlane=c,this._workerName="createFrustumOutlineGeometry",this.packedLength=2+p+r.Cartesian3.packedLength+t.Quaternion.packedLength}h.pack=function(n,a,u){u=e.defaultValue(u,0);const o=n._frustumType,c=n._frustum;return a[u++]=o,0===o?(i.PerspectiveFrustum.pack(c,a,u),u+=i.PerspectiveFrustum.packedLength):(i.OrthographicFrustum.pack(c,a,u),u+=i.OrthographicFrustum.packedLength),r.Cartesian3.pack(n._origin,a,u),u+=r.Cartesian3.packedLength,t.Quaternion.pack(n._orientation,a,u),a[u+=t.Quaternion.packedLength]=n._drawNearPlane?1:0,a};const d=new i.PerspectiveFrustum,f=new i.OrthographicFrustum,g=new t.Quaternion,_=new r.Cartesian3;return h.unpack=function(n,a,u){a=e.defaultValue(a,0);const o=n[a++];let c;0===o?(c=i.PerspectiveFrustum.unpack(n,a,d),a+=i.PerspectiveFrustum.packedLength):(c=i.OrthographicFrustum.unpack(n,a,f),a+=i.OrthographicFrustum.packedLength);const s=r.Cartesian3.unpack(n,a,_);a+=r.Cartesian3.packedLength;const p=t.Quaternion.unpack(n,a,g),m=1===n[a+=t.Quaternion.packedLength];if(!e.defined(u))return new h({frustum:c,origin:s,orientation:p,_drawNearPlane:m});const l=o===u._frustumType?u._frustum:void 0;return u._frustum=c.clone(l),u._frustumType=o,u._origin=r.Cartesian3.clone(s,u._origin),u._orientation=t.Quaternion.clone(p,u._orientation),u._drawNearPlane=m,u},h.createGeometry=function(e){const r=e._frustumType,n=e._frustum,c=e._origin,s=e._orientation,p=e._drawNearPlane,m=new Float64Array(24);i.FrustumGeometry._computeNearFarPlanes(c,s,r,n,m);const h=new o.GeometryAttributes({position:new u.GeometryAttribute({componentDatatype:a.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:m})});let d,f;const g=p?2:1,_=new Uint16Array(8*(g+1));let l=p?0:1;for(;l<2;++l)d=p?8*l:0,f=4*l,_[d]=f,_[d+1]=f+1,_[d+2]=f+1,_[d+3]=f+2,_[d+4]=f+2,_[d+5]=f+3,_[d+6]=f+3,_[d+7]=f;for(l=0;l<2;++l)d=8*(g+l),f=4*l,_[d]=f,_[d+1]=f+4,_[d+2]=f+1,_[d+3]=f+5,_[d+4]=f+2,_[d+5]=f+6,_[d+6]=f+3,_[d+7]=f+7;return new u.Geometry({attributes:h,indices:_,primitiveType:u.PrimitiveType.LINES,boundingSphere:t.BoundingSphere.fromVertices(m)})},function(t,r){return e.defined(r)&&(t=h.unpack(t,r)),h.createGeometry(t)}}));