qinbo
2022-02-17 575cfc14bf55b4bc0ebfe58349f0b1be7dd8253f
1
define(["./when-7b580518","./Transforms-a7d32f6c","./Cartesian2-40b13f31","./Check-3917d765","./ComponentDatatype-6c2e43c1","./FrustumGeometry-ca24586c","./GeometryAttribute-8f00b923","./GeometryAttributes-fbd9a3fb","./Math-87254c13","./combine-83aa7971","./RuntimeError-fad4d3c6","./WebGLConstants-4e26b85a","./Plane-69fa3eea","./VertexFormat-8d463a4f"],function(o,m,c,e,f,h,d,g,t,r,n,a,i,u){"use strict";var s=0,p=1;function _(e){var t,r,n=e.frustum,a=e.orientation,i=e.origin,e=o.defaultValue(e._drawNearPlane,!0);n instanceof h.PerspectiveFrustum?(t=s,r=h.PerspectiveFrustum.packedLength):n instanceof h.OrthographicFrustum&&(t=p,r=h.OrthographicFrustum.packedLength),this._frustumType=t,this._frustum=n.clone(),this._origin=c.Cartesian3.clone(i),this._orientation=m.Quaternion.clone(a),this._drawNearPlane=e,this._workerName="createFrustumOutlineGeometry",this.packedLength=2+r+c.Cartesian3.packedLength+m.Quaternion.packedLength}_.pack=function(e,t,r){r=o.defaultValue(r,0);var n=e._frustumType,a=e._frustum;return(t[r++]=n)===s?(h.PerspectiveFrustum.pack(a,t,r),r+=h.PerspectiveFrustum.packedLength):(h.OrthographicFrustum.pack(a,t,r),r+=h.OrthographicFrustum.packedLength),c.Cartesian3.pack(e._origin,t,r),r+=c.Cartesian3.packedLength,m.Quaternion.pack(e._orientation,t,r),t[r+=m.Quaternion.packedLength]=e._drawNearPlane?1:0,t};var k=new h.PerspectiveFrustum,l=new h.OrthographicFrustum,y=new m.Quaternion,v=new c.Cartesian3;return _.unpack=function(e,t,r){t=o.defaultValue(t,0);var n,a=e[t++];a===s?(n=h.PerspectiveFrustum.unpack(e,t,k),t+=h.PerspectiveFrustum.packedLength):(n=h.OrthographicFrustum.unpack(e,t,l),t+=h.OrthographicFrustum.packedLength);var i=c.Cartesian3.unpack(e,t,v);t+=c.Cartesian3.packedLength;var u=m.Quaternion.unpack(e,t,y),e=1===e[t+=m.Quaternion.packedLength];if(!o.defined(r))return new _({frustum:n,origin:i,orientation:u,_drawNearPlane:e});t=a===r._frustumType?r._frustum:void 0;return r._frustum=n.clone(t),r._frustumType=a,r._origin=c.Cartesian3.clone(i,r._origin),r._orientation=m.Quaternion.clone(u,r._orientation),r._drawNearPlane=e,r},_.createGeometry=function(e){var t=e._frustumType,r=e._frustum,n=e._origin,a=e._orientation,i=e._drawNearPlane,e=new Float64Array(24);h.FrustumGeometry._computeNearFarPlanes(n,a,t,r,e);for(var u,o,r=new g.GeometryAttributes({position:new d.GeometryAttribute({componentDatatype:f.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:e})}),c=i?2:1,s=new Uint16Array(8*(1+c)),p=i?0:1;p<2;++p)s[u=i?8*p:0]=o=4*p,s[u+1]=o+1,s[u+2]=o+1,s[u+3]=o+2,s[u+4]=o+2,s[u+5]=o+3,s[u+6]=o+3,s[u+7]=o;for(p=0;p<2;++p)s[u=8*(c+p)]=o=4*p,s[u+1]=o+4,s[u+2]=o+1,s[u+3]=o+5,s[u+4]=o+2,s[u+5]=o+6,s[u+6]=o+3,s[u+7]=o+7;return new d.Geometry({attributes:r,indices:s,primitiveType:d.PrimitiveType.LINES,boundingSphere:m.BoundingSphere.fromVertices(e)})},function(e,t){return o.defined(t)&&(e=_.unpack(e,t)),_.createGeometry(e)}});