define(["./AttributeCompression-90851096","./buildModuleUrl-57a32107","./Cartesian2-47311507","./Cartographic-3309dd0d","./when-b60132fc","./TerrainEncoding-dd15c157","./IndexDatatype-8a5eead4","./Check-7b2a090c","./Math-119be1a3","./OrientedBoundingBox-fcba62fd","./createTaskProcessorWorker","./Matrix4-cde86d0e","./Cartesian4-3ca25aab","./RuntimeError-4a5c8994","./WebGLConstants-4ae0db90","./ComponentDatatype-c140a87d","./EllipsoidTangentPlane-ceab6aaa","./IntersectionTests-5e35c2ab","./Plane-ca0357f4","./GeometryAttribute-c42d25b7","./FeatureDetection-c3b71206","./PolygonPipeline-805ba13c","./earcut-2.2.1-20c8012f","./EllipsoidRhumbLine-ed1a6bf4"],(function(e,i,t,n,r,s,h,u,a,o,d,p,l,f,c,g,m,x,v,C,w,B,y,b){"use strict";var A={clipTriangleAtAxisAlignedThreshold:function(e,i,t,n,s,h){var u,a,o;r.defined(h)?h.length=0:h=[],i?(u=te,a=n>e,o=s>e);var d,p,l,f,c,g,m=u+a+o;return 1===m?u?(d=(e-t)/(n-t),p=(e-t)/(s-t),h.push(1),h.push(2),1!==p&&(h.push(-1),h.push(0),h.push(2),h.push(p)),1!==d&&(h.push(-1),h.push(0),h.push(1),h.push(d))):a?(l=(e-n)/(s-n),f=(e-n)/(t-n),h.push(2),h.push(0),1!==f&&(h.push(-1),h.push(1),h.push(0),h.push(f)),1!==l&&(h.push(-1),h.push(1),h.push(2),h.push(l))):o&&(c=(e-s)/(t-s),g=(e-s)/(n-s),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||t===e?a||n===e?o||s===e||(p=(e-t)/(s-t),l=(e-n)/(s-n),h.push(2),h.push(-1),h.push(0),h.push(2),h.push(p),h.push(-1),h.push(1),h.push(2),h.push(l)):(g=(e-s)/(n-s),d=(e-t)/(n-t),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(d)):(f=(e-n)/(t-n),c=(e-s)/(t-s),h.push(0),h.push(-1),h.push(1),h.push(0),h.push(f),h.push(-1),h.push(2),h.push(0),h.push(c)):3!==m&&(h.push(0),h.push(1),h.push(2)),h},computeBarycentricCoordinates:function(e,i,t,s,h,u,a,o,d){var p=t-a,l=a-h,f=u-o,c=s-o,g=1/(f*p+l*c),m=i-o,x=e-a,v=(f*x+l*m)*g,C=(-c*x+p*m)*g,w=1-v-C;return r.defined(d)?(d.x=v,d.y=C,d.z=w,d):new n.Cartesian3(v,C,w)},computeLineSegmentLineSegmentIntersection:function(e,i,n,s,h,u,a,o,d){var p=(o-u)*(n-e)-(a-h)*(s-i);if(0!==p){var l=((a-h)*(i-u)-(o-u)*(e-h))/p,f=((n-e)*(i-u)-(s-i)*(e-h))/p;return l>=0&&l<=1&&f>=0&&f<=1?(r.defined(d)||(d=new t.Cartesian2),d.x=e+l*(n-e),d.y=i+l*(s-i),d):void 0}}},I=32767,M=16383,H=[],T=[],z=[],N=new n.Cartographic,V=new n.Cartesian3,E=[],R=[],O=[],U=[],P=[],F=new n.Cartesian3,S=new i.BoundingSphere,D=new o.OrientedBoundingBox,L=new t.Cartesian2,X=new n.Cartesian3;function k(){this.vertexBuffer=void 0,this.index=void 0,this.first=void 0,this.second=void 0,this.ratio=void 0}k.prototype.clone=function(e){return r.defined(e)||(e=new k),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},k.prototype.initializeIndexed=function(e,i,t,n,r){this.uBuffer=e,this.vBuffer=i,this.heightBuffer=t,this.normalBuffer=n,this.index=r,this.first=void 0,this.second=void 0,this.ratio=void 0},k.prototype.initializeFromClipResult=function(e,i,t){var n=i+1;return-1!==e[i]?t[e[i]].clone(this):(this.vertexBuffer=void 0,this.index=void 0,this.first=t[e[n]],++n,this.second=t[e[n]],++n,this.ratio=e[n],++n),n},k.prototype.getKey=function(){return this.isIndexed()?this.index:JSON.stringify({first:this.first.getKey(),second:this.second.getKey(),ratio:this.ratio})},k.prototype.isIndexed=function(){return r.defined(this.index)},k.prototype.getH=function(e,i){if(r.defined(this.index))return this.heightBuffer[this.index];var t=this.first.getH(e,i),n=this.second.getH(e,i);return 0===i+t/I*e||0===i+n/I*e?0:a.CesiumMath.lerp(this.first.getH(),this.second.getH(),this.ratio)},k.prototype.getU=function(){return r.defined(this.index)?this.uBuffer[this.index]:a.CesiumMath.lerp(this.first.getU(),this.second.getU(),this.ratio)},k.prototype.getV=function(){return r.defined(this.index)?this.vBuffer[this.index]:a.CesiumMath.lerp(this.first.getV(),this.second.getV(),this.ratio)};var W=new t.Cartesian2,K=-1,Y=[new n.Cartesian3,new n.Cartesian3],_=[new n.Cartesian3,new n.Cartesian3];function G(i,t){++K;var r=Y[K],s=_[K];return r=e.AttributeCompression.octDecode(i.first.getNormalX(),i.first.getNormalY(),r),s=e.AttributeCompression.octDecode(i.second.getNormalX(),i.second.getNormalY(),s),V=n.Cartesian3.lerp(r,s,i.ratio,V),n.Cartesian3.normalize(V,V),e.AttributeCompression.octEncode(V,t),--K,t}k.prototype.getNormalX=function(){return r.defined(this.index)?this.normalBuffer[2*this.index]:(W=G(this,W)).x},k.prototype.getNormalY=function(){return r.defined(this.index)?this.normalBuffer[2*this.index+1]:(W=G(this,W)).y};var J=[];function Z(e,i,t,n,s,h,u,a,o,d,p){if(0!==u.length){for(var l=0,f=0;f=M||!d&&_<=M)&&(p&&G>=M||!p&&G<=M)&&(B[K]=Q,m.push(_),x.push(G),v.push(he[K]),j&&(C.push(ue[Y]),C.push(ue[Y+1])),++Q)}var de=[];de.push(new k),de.push(new k),de.push(new k);var pe,le=[];for(le.push(new k),le.push(new k),le.push(new k),K=0;K=Ce.length||((pe=le[0].initializeFromClipResult(Ce,pe,de))>=Ce.length||(pe=le[1].initializeFromClipResult(Ce,pe,de))>=Ce.length||(pe=le[2].initializeFromClipResult(Ce,pe,de),Z(m,x,v,C,w,B,A.clipTriangleAtAxisAlignedThreshold(M,p,le[0].getV(),le[1].getV(),le[2].getV(),T),le,j,ie,ee),pe=f?(Ae.push(K),_=I):_=2*_+we,m[K]=_,(G=Math.round(x[K]))<=c?(be.push(K),G=0):G>=g?(Ie.push(K),G=I):G=2*G+Be,x[K]=G,(W=a.CesiumMath.lerp(ee,ie,v[K]/I))He&&(He=W);var Fe=W;(Fe=a.CesiumMath.clamp(Fe,te,ne))ze&&(ze=Fe),v[K]=W,N.longitude=a.CesiumMath.lerp(Pe,Ue,_/I),N.latitude=a.CesiumMath.lerp(Oe,Re,G/I),N.height=W,Ve.cartographicToCartesian(N,V),Ne.push(V.x),Ne.push(V.y),Ne.push(V.z)}var Se=i.BoundingSphere.fromVertices(Ne,n.Cartesian3.ZERO,3,S),De=o.OrientedBoundingBox.fromRectangle(Ee,Me,He,Ve,D),Le=o.OrientedBoundingBox.fromRectangle(Ee,Te,ze,Ve,D),Xe=new s.EllipsoidalOccluder(Ve).computeHorizonCullingPointFromVerticesPossiblyUnderEllipsoid(Se.center,Ne,3,Se.center,Me,F),ke=He-Me,We=new Uint16Array(m.length+x.length+v.length);for(K=0;K