qa-prevention-gwj-vue/static/map/cesium91/CesiumUnminified/Workers/createFrustumOutlineGeometr...

2 lines
3.1 KiB
JavaScript
Raw Normal View History

2023-12-17 15:30:40 +08:00
define(["./defaultValue-81eec7ed","./BoundingSphere-9a3b5656","./Cartesian3-e0307675","./Check-741c5f3c","./ComponentDatatype-aaeec80f","./FrustumGeometry-5b6f7f2c","./GeometryAttribute-2b42a913","./GeometryAttributes-32b29525","./Transforms-5b829630","./Cartesian2-bd414876","./Math-e73894ab","./GeographicProjection-c931c7fb","./Matrix4-4c545f70","./RuntimeError-26acdd3b","./Rectangle-cf3e0e3e","./WebGLConstants-508b9636","./Plane-bc8b6777","./VertexFormat-d50a69ba","./Matrix2-dc0c61cc","./when-422ea0ae","./Resource-8ae1a924","./combine-3c023bda"],(function(e,t,r,n,a,i,u,o,c,s,p,m,h,d,f,g,l,_,k,b,y,F){"use strict";function w(t){const n=t.frustum,a=t.orientation,u=t.origin,o=e.defaultValue(t._drawNearPlane,!0);let s,p;n instanceof i.PerspectiveFrustum?(s=0,p=i.PerspectiveFrustum.packedLength):n instanceof i.OrthographicFrustum&&(s=1,p=i.OrthographicFrustum.packedLength),this._frustumType=s,this._frustum=n.clone(),this._origin=r.Cartesian3.clone(u),this._orientation=c.Quaternion.clone(a),this._drawNearPlane=o,this._workerName="createFrustumOutlineGeometry",this.packedLength=2+p+r.Cartesian3.packedLength+c.Quaternion.packedLength}w.pack=function(t,n,a){a=e.defaultValue(a,0);const u=t._frustumType,o=t._frustum;return n[a++]=u,0===u?(i.PerspectiveFrustum.pack(o,n,a),a+=i.PerspectiveFrustum.packedLength):(i.OrthographicFrustum.pack(o,n,a),a+=i.OrthographicFrustum.packedLength),r.Cartesian3.pack(t._origin,n,a),a+=r.Cartesian3.packedLength,c.Quaternion.pack(t._orientation,n,a),n[a+=c.Quaternion.packedLength]=t._drawNearPlane?1:0,n};const P=new i.PerspectiveFrustum,L=new i.OrthographicFrustum,C=new c.Quaternion,G=new r.Cartesian3;return w.unpack=function(t,n,a){n=e.defaultValue(n,0);const u=t[n++];let o;0===u?(o=i.PerspectiveFrustum.unpack(t,n,P),n+=i.PerspectiveFrustum.packedLength):(o=i.OrthographicFrustum.unpack(t,n,L),n+=i.OrthographicFrustum.packedLength);const s=r.Cartesian3.unpack(t,n,G);n+=r.Cartesian3.packedLength;const p=c.Quaternion.unpack(t,n,C),m=1===t[n+=c.Quaternion.packedLength];if(!e.defined(a))return new w({frustum:o,origin:s,orientation:p,_drawNearPlane:m});const h=u===a._frustumType?a._frustum:void 0;return a._frustum=o.clone(h),a._frustumType=u,a._origin=r.Cartesian3.clone(s,a._origin),a._orientation=c.Quaternion.clone(p,a._orientation),a._drawNearPlane=m,a},w.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,l=new Uint16Array(8*(g+1));let _=p?0:1;for(;_<2;++_)d=p?8*_:0,f=4*_,l[d]=f,l[d+1]=f+1,l[d+2]=f+1,l[d+3]=f+2,l[d+4]=f+2,l[d+5]=f+3,l[d+6]=f+3,l[d+7]=f;for(_=0;_<2;++_)d=8*(g+_),f=4*_,l[d]=f,l[d+1]=f+4,l[d+2]=f+1,l[d+3]=f+5,l[d+4]=f+2,l[d+5]=f+6,l[d+6]=f+3,l[d+7]=f+7;return new u.Geometry({attributes:h,indices:l,primitiveType:u.PrimitiveType.LINES,boundingSphere:t.BoundingSphere.fromVertices(m)})},function(t,r){return e.defined(r)&&(t=w.unpack(t,r)),w.createGeometry(t)}}));