define(["./AttributeCompression-af389d04","./Transforms-d13cc04e","./Matrix2-9aa31791","./when-4bbc8319","./TerrainEncoding-ba779f11","./IndexDatatype-b7d979a6","./RuntimeError-346a3079","./ComponentDatatype-93750d1a","./OrientedBoundingBox-4b932f63","./createTaskProcessorWorker","./combine-83860057","./WebGLConstants-1c8239cc","./EllipsoidTangentPlane-eecce7e8","./AxisAlignedBoundingBox-07c6b7f2","./IntersectionTests-96a04219","./Plane-318d6937"],(function(e,t,i,n,s,r,h,u,o,a,p,d,f,l,c,g){"use strict";var m=function(e,t,i,s,r,h){var u,o,a;n.defined(h)?h.length=0:h=[],t?(u=ie,o=s>e,a=r>e);var p,d,f,l,c,g,m=u+o+a;return 1===m?u?(p=(e-i)/(s-i),d=(e-i)/(r-i),h.push(1),h.push(2),1!==d&&(h.push(-1),h.push(0),h.push(2),h.push(d)),1!==p&&(h.push(-1),h.push(0),h.push(1),h.push(p))):o?(f=(e-s)/(r-s),l=(e-s)/(i-s),h.push(2),h.push(0),1!==l&&(h.push(-1),h.push(1),h.push(0),h.push(l)),1!==f&&(h.push(-1),h.push(1),h.push(2),h.push(f))):a&&(c=(e-r)/(i-r),g=(e-r)/(s-r),h.push(0),h.push(1),1!==g&&(h.push(-1),h.push(2),h.push(1),h.push(g)),1!==c&&(h.push(-1),h.push(2),h.push(0),h.push(c))):2===m?u||i===e?o||s===e?a||r===e||(d=(e-i)/(r-i),f=(e-s)/(r-s),h.push(2),h.push(-1),h.push(0),h.push(2),h.push(d),h.push(-1),h.push(1),h.push(2),h.push(f)):(g=(e-r)/(s-r),p=(e-i)/(s-i),h.push(1),h.push(-1),h.push(2),h.push(1),h.push(g),h.push(-1),h.push(0),h.push(1),h.push(p)):(l=(e-s)/(i-s),c=(e-r)/(i-r),h.push(0),h.push(-1),h.push(1),h.push(0),h.push(l),h.push(-1),h.push(2),h.push(0),h.push(c)):3!==m&&(h.push(0),h.push(1),h.push(2)),h},x=32767,v=16383,w=[],C=[],B=[],y=new i.Cartographic,I=new i.Cartesian3,b=[],A=[],z=[],M=[],N=[],V=new i.Cartesian3,E=new t.BoundingSphere,R=new o.OrientedBoundingBox,H=new i.Cartesian2,T=new i.Cartesian3;function O(){this.vertexBuffer=void 0,this.index=void 0,this.first=void 0,this.second=void 0,this.ratio=void 0}O.prototype.clone=function(e){return n.defined(e)||(e=new O),e.uBuffer=this.uBuffer,e.vBuffer=this.vBuffer,e.heightBuffer=this.heightBuffer,e.normalBuffer=this.normalBuffer,e.index=this.index,e.first=this.first,e.second=this.second,e.ratio=this.ratio,e},O.prototype.initializeIndexed=function(e,t,i,n,s){this.uBuffer=e,this.vBuffer=t,this.heightBuffer=i,this.normalBuffer=n,this.index=s,this.first=void 0,this.second=void 0,this.ratio=void 0},O.prototype.initializeFromClipResult=function(e,t,i){var n=t+1;return-1!==e[t]?i[e[t]].clone(this):(this.vertexBuffer=void 0,this.index=void 0,this.first=i[e[n]],++n,this.second=i[e[n]],++n,this.ratio=e[n],++n),n},O.prototype.getKey=function(){return this.isIndexed()?this.index:JSON.stringify({first:this.first.getKey(),second:this.second.getKey(),ratio:this.ratio})},O.prototype.isIndexed=function(){return n.defined(this.index)},O.prototype.getH=function(){return n.defined(this.index)?this.heightBuffer[this.index]:u.CesiumMath.lerp(this.first.getH(),this.second.getH(),this.ratio)},O.prototype.getU=function(){return n.defined(this.index)?this.uBuffer[this.index]:u.CesiumMath.lerp(this.first.getU(),this.second.getU(),this.ratio)},O.prototype.getV=function(){return n.defined(this.index)?this.vBuffer[this.index]:u.CesiumMath.lerp(this.first.getV(),this.second.getV(),this.ratio)};var U=new i.Cartesian2,F=-1,P=[new i.Cartesian3,new i.Cartesian3],S=[new i.Cartesian3,new i.Cartesian3];function D(t,n){++F;var s=P[F],r=S[F];return s=e.AttributeCompression.octDecode(t.first.getNormalX(),t.first.getNormalY(),s),r=e.AttributeCompression.octDecode(t.second.getNormalX(),t.second.getNormalY(),r),I=i.Cartesian3.lerp(s,r,t.ratio,I),i.Cartesian3.normalize(I,I),e.AttributeCompression.octEncode(I,n),--F,n}O.prototype.getNormalX=function(){return n.defined(this.index)?this.normalBuffer[2*this.index]:(U=D(this,U)).x},O.prototype.getNormalY=function(){return n.defined(this.index)?this.normalBuffer[2*this.index+1]:(U=D(this,U)).y};var W=[];function X(e,t,i,s,r,h,u,o,a){if(0!==u.length){for(var p=0,d=0;d=v||!h&&L<=v)&&(a&&_>=v||!a&&_<=v)&&(S[K]=Z,c.push(L),g.push(_),U.push(te[K]),J&&(F.push(ie[Y]),F.push(ie[Y+1])),++Z)}var re=[];re.push(new O),re.push(new O),re.push(new O);var he,ue=[];for(ue.push(new O),ue.push(new O),ue.push(new O),K=0;K=ce.length||(he=ue[0].initializeFromClipResult(ce,he,re))>=ce.length||(he=ue[1].initializeFromClipResult(ce,he,re))>=ce.length||(he=ue[2].initializeFromClipResult(ce,he,re),X(c,g,U,F,P,S,m(v,a,ue[0].getV(),ue[1].getV(),ue[2].getV(),C),ue,J),he=d?(we.push(K),L=x):L=2*L+ge,c[K]=L,(_=Math.round(g[K]))<=f?(ve.push(K),_=0):_>=l?(Ce.push(K),_=x):_=2*_+me,g[K]=_,(k=u.CesiumMath.lerp(q,Q,U[K]/x))ye&&(ye=k),U[K]=k,y.longitude=u.CesiumMath.lerp(Ve,Ne,L/x),y.latitude=u.CesiumMath.lerp(Me,ze,_/x),y.height=k,be.cartographicToCartesian(y,I),Ie.push(I.x),Ie.push(I.y),Ie.push(I.z);var Ee=t.BoundingSphere.fromVertices(Ie,i.Cartesian3.ZERO,3,E),Re=o.OrientedBoundingBox.fromRectangle(Ae,Be,ye,be,R),He=new s.EllipsoidalOccluder(be).computeHorizonCullingPointFromVerticesPossiblyUnderEllipsoid(Ee.center,Ie,3,Ee.center,Be,V),Te=ye-Be,Oe=new Uint16Array(c.length+g.length+U.length);for(K=0;K