define(["./when-208fe5b0","./Transforms-73e77b72","./Cartesian2-b4b7b0b3","./Check-5e798bbf","./ComponentDatatype-2da3a966","./FrustumGeometry-65f50f2b","./GeometryAttribute-b541caa6","./GeometryAttributes-b0b294d8","./Math-8386669c","./RuntimeError-7f634f5d","./WebGLConstants-5e2a49ab","./Plane-b91bfb59","./VertexFormat-7e57a3bd"],function(o,m,s,e,h,f,d,g,t,r,n,a,u){"use strict";var c=0,i=1;function p(e){var t,r,n=e.frustum,a=e.orientation,u=e.origin,e=o.defaultValue(e._drawNearPlane,!0);n instanceof f.PerspectiveFrustum?(t=c,r=f.PerspectiveFrustum.packedLength):n instanceof f.OrthographicFrustum&&(t=i,r=f.OrthographicFrustum.packedLength),this._frustumType=t,this._frustum=n.clone(),this._origin=s.Cartesian3.clone(u),this._orientation=m.Quaternion.clone(a),this._drawNearPlane=e,this._workerName="createFrustumOutlineGeometry",this.packedLength=2+r+s.Cartesian3.packedLength+m.Quaternion.packedLength}p.pack=function(e,t,r){r=o.defaultValue(r,0);var n=e._frustumType,a=e._frustum;return(t[r++]=n)===c?(f.PerspectiveFrustum.pack(a,t,r),r+=f.PerspectiveFrustum.packedLength):(f.OrthographicFrustum.pack(a,t,r),r+=f.OrthographicFrustum.packedLength),s.Cartesian3.pack(e._origin,t,r),r+=s.Cartesian3.packedLength,m.Quaternion.pack(e._orientation,t,r),t[r+=m.Quaternion.packedLength]=e._drawNearPlane?1:0,t};var _=new f.PerspectiveFrustum,k=new f.OrthographicFrustum,b=new m.Quaternion,l=new s.Cartesian3;return p.unpack=function(e,t,r){t=o.defaultValue(t,0);var n,a=e[t++];a===c?(n=f.PerspectiveFrustum.unpack(e,t,_),t+=f.PerspectiveFrustum.packedLength):(n=f.OrthographicFrustum.unpack(e,t,k),t+=f.OrthographicFrustum.packedLength);var u=s.Cartesian3.unpack(e,t,l);t+=s.Cartesian3.packedLength;var i=m.Quaternion.unpack(e,t,b),e=1===e[t+=m.Quaternion.packedLength];if(!o.defined(r))return new p({frustum:n,origin:u,orientation:i,_drawNearPlane:e});t=a===r._frustumType?r._frustum:void 0;return r._frustum=n.clone(t),r._frustumType=a,r._origin=s.Cartesian3.clone(u,r._origin),r._orientation=m.Quaternion.clone(i,r._orientation),r._drawNearPlane=e,r},p.createGeometry=function(e){var t=e._frustumType,r=e._frustum,n=e._origin,a=e._orientation,u=e._drawNearPlane,e=new Float64Array(24);f.FrustumGeometry._computeNearFarPlanes(n,a,t,r,e);for(var i,o,r=new g.GeometryAttributes({position:new d.GeometryAttribute({componentDatatype:h.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:e})}),s=u?2:1,c=new Uint16Array(8*(1+s)),p=u?0:1;p<2;++p)c[i=u?8*p:0]=o=4*p,c[i+1]=o+1,c[i+2]=o+1,c[i+3]=o+2,c[i+4]=o+2,c[i+5]=o+3,c[i+6]=o+3,c[i+7]=o;for(p=0;p<2;++p)c[i=8*(s+p)]=o=4*p,c[i+1]=o+4,c[i+2]=o+1,c[i+3]=o+5,c[i+4]=o+2,c[i+5]=o+6,c[i+6]=o+3,c[i+7]=o+7;return new d.Geometry({attributes:r,indices:c,primitiveType:d.PrimitiveType.LINES,boundingSphere:m.BoundingSphere.fromVertices(e)})},function(e,t){return o.defined(t)&&(e=p.unpack(e,t)),p.createGeometry(e)}});
