define(["./AxisAlignedBoundingBox-07c6b7f2","./Transforms-d13cc04e","./Matrix2-9aa31791","./when-4bbc8319","./TerrainEncoding-ba779f11","./ComponentDatatype-93750d1a","./OrientedBoundingBox-4b932f63","./RuntimeError-346a3079","./WebMercatorProjection-58801a11","./createTaskProcessorWorker","./combine-83860057","./AttributeCompression-af389d04","./WebGLConstants-1c8239cc","./EllipsoidTangentPlane-eecce7e8","./IntersectionTests-96a04219","./Plane-318d6937"],(function(e,t,i,n,a,r,o,s,u,h,c,d,g,l,m,p){"use strict";var v=Uint16Array.BYTES_PER_ELEMENT,I=Int32Array.BYTES_PER_ELEMENT,E=Uint32Array.BYTES_PER_ELEMENT,T=Float32Array.BYTES_PER_ELEMENT,f=Float64Array.BYTES_PER_ELEMENT;function C(e,t,i){i=n.defaultValue(i,r.CesiumMath);for(var a=e.length,o=0;o0&&o.push(o[E]),s.length>0&&s.push(s[E]),i.Matrix4.multiplyByPoint(h.toENU,b,x);var S=h.minimum,w=h.maximum;i.Cartesian3.minimumByComponent(x,S,S),i.Cartesian3.maximumByComponent(x,w,w);var B=h.lastBorderPoint;if(n.defined(B)){var P=B.index;u.push(P,T-1,T,T,E,P)}h.lastBorderPoint=v}}return h((function(h,c){h.ellipsoid=i.Ellipsoid.clone(h.ellipsoid),h.rectangle=i.Rectangle.clone(h.rectangle);var d=function(h,c,d,g,l,m,p,B,P,A,y){var R,_,W,F,O,Y;n.defined(g)?(R=g.west,_=g.south,W=g.east,F=g.north,O=g.width,Y=g.height):(R=r.CesiumMath.toRadians(l.west),_=r.CesiumMath.toRadians(l.south),W=r.CesiumMath.toRadians(l.east),F=r.CesiumMath.toRadians(l.north),O=r.CesiumMath.toRadians(g.width),Y=r.CesiumMath.toRadians(g.height));var U,V,k=[_,F],H=[R,W],L=t.Transforms.eastNorthUpToFixedFrame(c,d),D=i.Matrix4.inverseTransformation(L,S);P&&(U=u.WebMercatorProjection.geodeticLatitudeToMercatorAngle(_),V=1/(u.WebMercatorProjection.geodeticLatitudeToMercatorAngle(F)-U));var G=1!==m,j=new DataView(h),z=Number.POSITIVE_INFINITY,q=Number.NEGATIVE_INFINITY,J=N;J.x=Number.POSITIVE_INFINITY,J.y=Number.POSITIVE_INFINITY,J.z=Number.POSITIVE_INFINITY;var K=b;K.x=Number.NEGATIVE_INFINITY,K.y=Number.NEGATIVE_INFINITY,K.z=Number.NEGATIVE_INFINITY;var Q,X,Z=0,$=0,ee=0;for(X=0;X<4;++X){var te=Z;Q=j.getUint32(te,!0),te+=E;var ie=r.CesiumMath.toRadians(180*j.getFloat64(te,!0));te+=f,-1===C(H,ie)&&H.push(ie);var ne=r.CesiumMath.toRadians(180*j.getFloat64(te,!0));te+=f,-1===C(k,ne)&&k.push(ne),te+=2*f;var ae=j.getInt32(te,!0);te+=I,$+=ae,ee+=3*(ae=j.getInt32(te,!0)),Z+=Q+E}var re=[],oe=[],se=new Array($),ue=new Array($),he=new Array($),ce=P?new Array($):[],de=G?new Array($):[],ge=new Array(ee),le=[],me=[],pe=[],ve=[],Ie=0,Ee=0;for(Z=0,X=0;X<4;++X){Q=j.getUint32(Z,!0);var Te=Z+=E,fe=r.CesiumMath.toRadians(180*j.getFloat64(Z,!0));Z+=f;var Ce=r.CesiumMath.toRadians(180*j.getFloat64(Z,!0));Z+=f;var Me=r.CesiumMath.toRadians(180*j.getFloat64(Z,!0)),xe=.5*Me;Z+=f;var Ne=r.CesiumMath.toRadians(180*j.getFloat64(Z,!0)),be=.5*Ne;Z+=f;var Se=j.getInt32(Z,!0);Z+=I;var we=j.getInt32(Z,!0);Z+=I,Z+=I;for(var Be=new Array(Se),Pe=0;Pe0&&ve.length>0){var Ge=le[0].index,je=ke,ze=ve[ve.length-1].index,qe=se.length-1;ge.push(ze,qe,je,je,Ge,ze)}$=se.length;var Je,Ke=t.BoundingSphere.fromPoints(se);n.defined(g)&&(Je=o.OrientedBoundingBox.fromRectangle(g,z,q,d));for(var Qe=new a.EllipsoidalOccluder(d).computeHorizonCullingPointPossiblyUnderEllipsoid(c,se,z),Xe=new e.AxisAlignedBoundingBox(J,K,c),Ze=new a.TerrainEncoding(c,Xe,Le.hMin,q,L,!1,P,G,m,p),$e=new Float32Array($*Ze.stride),et=0,tt=0;tt<$;++tt)et=Ze.encode($e,et,se[tt],ue[tt],he[tt],void 0,ce[tt],de[tt]);var it=le.map((function(e){return e.index})).reverse(),nt=me.map((function(e){return e.index})).reverse(),at=pe.map((function(e){return e.index})).reverse(),rt=ve.map((function(e){return e.index})).reverse();return nt.unshift(at[at.length-1]),nt.push(it[0]),rt.unshift(it[it.length-1]),rt.push(at[0]),{vertices:$e,indices:new Uint16Array(ge),maximumHeight:q,minimumHeight:z,encoding:Ze,boundingSphere3D:Ke,orientedBoundingBox:Je,occludeePointInScaledSpace:Qe,vertexCountWithoutSkirts:ke,indexCountWithoutSkirts:He,westIndicesSouthToNorth:it,southIndicesEastToWest:nt,eastIndicesNorthToSouth:at,northIndicesWestToEast:rt}}(h.buffer,h.relativeToCenter,h.ellipsoid,h.rectangle,h.nativeRectangle,h.exaggeration,h.exaggerationRelativeHeight,h.skirtHeight,h.includeWebMercatorT,h.negativeAltitudeExponentBias,h.negativeElevationThreshold),g=d.vertices;c.push(g.buffer);var l=d.indices;return c.push(l.buffer),{vertices:g.buffer,indices:l.buffer,numberOfAttributes:d.encoding.stride,minimumHeight:d.minimumHeight,maximumHeight:d.maximumHeight,boundingSphere3D:d.boundingSphere3D,orientedBoundingBox:d.orientedBoundingBox,occludeePointInScaledSpace:d.occludeePointInScaledSpace,encoding:d.encoding,vertexCountWithoutSkirts:d.vertexCountWithoutSkirts,indexCountWithoutSkirts:d.indexCountWithoutSkirts,westIndicesSouthToNorth:d.westIndicesSouthToNorth,southIndicesEastToWest:d.southIndicesEastToWest,eastIndicesNorthToSouth:d.eastIndicesNorthToSouth,northIndicesWestToEast:d.northIndicesWestToEast}}))}));