Agriculture-front-end/public/Cesium/Workers/createFrustumOutlineGeometry.js
2023-09-11 21:56:39 +08:00

2 lines
3.0 KiB
JavaScript

define(["./when-b60132fc","./BoundingSphere-561b54d0","./Cartographic-3309dd0d","./Check-7b2a090c","./ComponentDatatype-c140a87d","./FrustumGeometry-96291783","./GeometryAttribute-3a42bbdc","./GeometryAttributes-252e9929","./PrimitiveType-39acab88","./Transforms-cb0006b0","./Cartesian2-47311507","./Math-119be1a3","./Cartesian4-3ca25aab","./RuntimeError-4a5c8994","./WebGLConstants-4ae0db90","./Plane-097b3a8f","./VertexFormat-6446fca0","./buildModuleUrl-3addfe33","./FeatureDetection-c3b71206"],(function(e,t,r,a,n,i,u,o,c,s,p,m,d,h,f,g,_,k,l){"use strict";function y(t){var a,n,u=t.frustum,o=t.orientation,c=t.origin,p=e.defaultValue(t._drawNearPlane,!0);u instanceof i.PerspectiveFrustum?(a=0,n=i.PerspectiveFrustum.packedLength):u instanceof i.OrthographicFrustum&&(a=1,n=i.OrthographicFrustum.packedLength),this._frustumType=a,this._frustum=u.clone(),this._origin=r.Cartesian3.clone(c),this._orientation=s.Quaternion.clone(o),this._drawNearPlane=p,this._workerName="createFrustumOutlineGeometry",this.packedLength=2+n+r.Cartesian3.packedLength+s.Quaternion.packedLength}y.pack=function(t,a,n){n=e.defaultValue(n,0);var u=t._frustumType,o=t._frustum;return a[n++]=u,0===u?(i.PerspectiveFrustum.pack(o,a,n),n+=i.PerspectiveFrustum.packedLength):(i.OrthographicFrustum.pack(o,a,n),n+=i.OrthographicFrustum.packedLength),r.Cartesian3.pack(t._origin,a,n),n+=r.Cartesian3.packedLength,s.Quaternion.pack(t._orientation,a,n),a[n+=s.Quaternion.packedLength]=t._drawNearPlane?1:0,a};var b=new i.PerspectiveFrustum,v=new i.OrthographicFrustum,F=new s.Quaternion,w=new r.Cartesian3;return y.unpack=function(t,a,n){a=e.defaultValue(a,0);var u,o=t[a++];0===o?(u=i.PerspectiveFrustum.unpack(t,a,b),a+=i.PerspectiveFrustum.packedLength):(u=i.OrthographicFrustum.unpack(t,a,v),a+=i.OrthographicFrustum.packedLength);var c=r.Cartesian3.unpack(t,a,w);a+=r.Cartesian3.packedLength;var p=s.Quaternion.unpack(t,a,F),m=1===t[a+=s.Quaternion.packedLength];if(!e.defined(n))return new y({frustum:u,origin:c,orientation:p,_drawNearPlane:m});var d=o===n._frustumType?n._frustum:void 0;return n._frustum=u.clone(d),n._frustumType=o,n._origin=r.Cartesian3.clone(c,n._origin),n._orientation=s.Quaternion.clone(p,n._orientation),n._drawNearPlane=m,n},y.createGeometry=function(e){var r=e._frustumType,a=e._frustum,s=e._origin,p=e._orientation,m=e._drawNearPlane,d=new Float64Array(24);i.FrustumGeometry._computeNearFarPlanes(s,p,r,a,d);for(var h,f,g=new o.GeometryAttributes({position:new u.GeometryAttribute({componentDatatype:n.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:d})}),_=m?2:1,k=new Uint16Array(8*(_+1)),l=m?0:1;l<2;++l)f=4*l,k[h=m?8*l:0]=f,k[h+1]=f+1,k[h+2]=f+1,k[h+3]=f+2,k[h+4]=f+2,k[h+5]=f+3,k[h+6]=f+3,k[h+7]=f;for(l=0;l<2;++l)f=4*l,k[h=8*(_+l)]=f,k[h+1]=f+4,k[h+2]=f+1,k[h+3]=f+5,k[h+4]=f+2,k[h+5]=f+6,k[h+6]=f+3,k[h+7]=f+7;return new u.Geometry({attributes:g,indices:k,primitiveType:c.PrimitiveType.LINES,boundingSphere:t.BoundingSphere.fromVertices(d)})},function(t,r){return e.defined(r)&&(t=y.unpack(t,r)),y.createGeometry(t)}}));