define(["./AttributeCompression-49f7b62a","./buildModuleUrl-3d15f25c","./Cartesian2-6033fa5d","./Cartographic-67e73ef9","./when-92c6cf3c","./Rectangle-bab7abf0","./TerrainEncoding-5d55ad09","./IndexDatatype-4c0e98b8","./Check-52a7d806","./Math-92c3b5f7","./OrientedBoundingBox-513cf61d","./createTaskProcessorWorker","./Intersect-b97e930a","./PrimitiveType-cdfe443e","./Cartesian4-ad128b5d","./RuntimeError-c6a62a80","./WebGLConstants-71f10989","./Event-3390cd7d","./ComponentDatatype-81047f82","./EllipsoidTangentPlane-53184efd","./IntersectionTests-a42760d9","./Plane-f8d22530","./GeometryAttribute-ef657318","./FeatureDetection-067cb23c","./PolygonPipeline-b86e8785","./WindingOrder-1b9c8a87","./EllipsoidRhumbLine-8847d1a1","./Buffer-1d0f8963","./RenderState-94064c70","./BoundingRectangle-418864a2","./Color-45274500"],(function(e,t,i,n,r,s,h,u,o,p,d,a,f,l,c,g,m,x,w,v,y,b,B,I,A,C,H,T,O,z,N){"use strict";var R={clipTriangleAtAxisAlignedThreshold:function(e,t,i,n,s,h){if(!r.e(e))throw new o.t("threshold is required.");if(!r.e(t))throw new o.t("keepAbove is required.");if(!r.e(i))throw new o.t("u0 is required.");if(!r.e(n))throw new o.t("u1 is required.");if(!r.e(s))throw new o.t("u2 is required.");var u,p,d;r.e(h)?h.length=0:h=[],t?(u=ie,p=n>e,d=s>e);var a,f,l,c,g,m,x=u+p+d;return 1===x?u?(a=(e-i)/(n-i),f=(e-i)/(s-i),h.push(1),h.push(2),1!==f&&(h.push(-1),h.push(0),h.push(2),h.push(f)),1!==a&&(h.push(-1),h.push(0),h.push(1),h.push(a))):p?(l=(e-n)/(s-n),c=(e-n)/(i-n),h.push(2),h.push(0),1!==c&&(h.push(-1),h.push(1),h.push(0),h.push(c)),1!==l&&(h.push(-1),h.push(1),h.push(2),h.push(l))):d&&(g=(e-s)/(i-s),m=(e-s)/(n-s),h.push(0),h.push(1),1!==m&&(h.push(-1),h.push(2),h.push(1),h.push(m)),1!==g&&(h.push(-1),h.push(2),h.push(0),h.push(g))):2===x?u||i===e?p||n===e?!d&&s!==e&&(f=(e-i)/(s-i),l=(e-n)/(s-n),h.push(2),h.push(-1),h.push(0),h.push(2),h.push(f),h.push(-1),h.push(1),h.push(2),h.push(l)):(m=(e-s)/(n-s),a=(e-i)/(n-i),h.push(1),h.push(-1),h.push(2),h.push(1),h.push(m),h.push(-1),h.push(0),h.push(1),h.push(a)):(c=(e-n)/(i-n),g=(e-s)/(i-s),h.push(0),h.push(-1),h.push(1),h.push(0),h.push(c),h.push(-1),h.push(2),h.push(0),h.push(g)):3!==x&&(h.push(0),h.push(1),h.push(2)),h},computeBarycentricCoordinates:function(e,t,i,s,h,u,p,d,a){if(!r.e(e))throw new o.t("x is required.");if(!r.e(t))throw new o.t("y is required.");if(!r.e(i))throw new o.t("x1 is required.");if(!r.e(s))throw new o.t("y1 is required.");if(!r.e(h))throw new o.t("x2 is required.");if(!r.e(u))throw new o.t("y2 is required.");if(!r.e(p))throw new o.t("x3 is required.");if(!r.e(d))throw new o.t("y3 is required.");var f=i-p,l=p-h,c=u-d,g=s-d,m=1/(c*f+l*g),x=t-d,w=e-p,v=(c*w+l*x)*m,y=(-g*w+f*x)*m,b=1-v-y;return r.e(a)?(a.x=v,a.y=y,a.z=b,a):new n.t(v,y,b)},computeLineSegmentLineSegmentIntersection:function(e,t,n,s,h,u,p,d,a){o.o.typeOf.number("x00",e),o.o.typeOf.number("y00",t),o.o.typeOf.number("x01",n),o.o.typeOf.number("y01",s),o.o.typeOf.number("x10",h),o.o.typeOf.number("y10",u),o.o.typeOf.number("x11",p),o.o.typeOf.number("y11",d);var f=(d-u)*(n-e)-(p-h)*(s-t);if(0!==f){var l=((p-h)*(t-u)-(d-u)*(e-h))/f,c=((n-e)*(t-u)-(s-t)*(e-h))/f;if(l>=0&&l<=1&&c>=0&&c<=1)return r.e(a)||(a=new i.o),a.x=e+l*(n-e),a.y=t+l*(s-t),a}}},V=32767,q=16383,E=[],M=[],P=[],U=new n.t$1,F=new n.t,S=[],k=[],D=[],L=[],W=[],X=new n.t,K=new t.i,Y=new d.x,_=new i.o,G=new n.t;function J(){this.vertexBuffer=void 0,this.index=void 0,this.first=void 0,this.second=void 0,this.ratio=void 0}J.prototype.clone=function(e){return r.e(e)||(e=new J),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},J.prototype.initializeIndexed=function(e,t,i,n,r){this.uBuffer=e,this.vBuffer=t,this.heightBuffer=i,this.normalBuffer=n,this.index=r,this.first=void 0,this.second=void 0,this.ratio=void 0},J.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},J.prototype.getKey=function(){return this.isIndexed()?this.index:JSON.stringify({first:this.first.getKey(),second:this.second.getKey(),ratio:this.ratio})},J.prototype.isIndexed=function(){return r.e(this.index)},J.prototype.getH=function(e,t){if(r.e(this.index))return this.heightBuffer[this.index];var i=this.first.getH(e,t),n=this.second.getH(e,t);return 0===t+i/V*e||0===t+n/V*e?0:p.e.lerp(this.first.getH(),this.second.getH(),this.ratio)},J.prototype.getU=function(){return r.e(this.index)?this.uBuffer[this.index]:p.e.lerp(this.first.getU(),this.second.getU(),this.ratio)},J.prototype.getV=function(){return r.e(this.index)?this.vBuffer[this.index]:p.e.lerp(this.first.getV(),this.second.getV(),this.ratio)};var Z=new i.o,$=-1,j=[new n.t,new n.t],Q=[new n.t,new n.t];function ee(t,i){++$;var r=j[$],s=Q[$];return r=e.t.octDecode(t.first.getNormalX(),t.first.getNormalY(),r),s=e.t.octDecode(t.second.getNormalX(),t.second.getNormalY(),s),F=n.t.lerp(r,s,t.ratio,F),n.t.normalize(F,F),e.t.octEncode(F,i),--$,i}J.prototype.getNormalX=function(){return r.e(this.index)?this.normalBuffer[2*this.index]:(Z=ee(this,Z)).x},J.prototype.getNormalY=function(){return r.e(this.index)?this.normalBuffer[2*this.index+1]:(Z=ee(this,Z)).y};var te=[];function ie(e,t,i,n,s,h,u,o,p,d,a){if(0!==u.length){for(var f=0,l=0;l=q||!o&&T<=q)&&(a&&O>=q||!a&&O<=q)&&(b[C]=$,m.push(T),x.push(O),w.push(he[C]),N&&(v.push(ue[H]),v.push(ue[H+1])),++$)}var de=[];de.push(new J),de.push(new J),de.push(new J);var ae,fe=[];for(fe.push(new J),fe.push(new J),fe.push(new J),C=0;C=ve.length||((ae=fe[0].initializeFromClipResult(ve,ae,de))>=ve.length||(ae=fe[1].initializeFromClipResult(ve,ae,de))>=ve.length||(ae=fe[2].initializeFromClipResult(ve,ae,de),ie(m,x,w,v,y,b,R.clipTriangleAtAxisAlignedThreshold(q,a,fe[0].getV(),fe[1].getV(),fe[2].getV(),M),fe,N,ee,Q),ae=l?(Ae.push(C),T=V):T=2*T+ye,m[C]=T,(O=Math.round(x[C]))<=c?(Ie.push(C),O=0):O>=g?(Ce.push(C),O=V):O=2*O+be,x[C]=O,(A=p.e.lerp(Q,ee,w[C]/V))Te&&(Te=A);var Ue=A;(Ue=p.e.clamp(Ue,te,ne))ze&&(ze=Ue),w[C]=A,U.longitude=p.e.lerp(Pe,Me,T/V),U.latitude=p.e.lerp(Ee,qe,O/V),U.height=A,Re.cartographicToCartesian(U,F),Ne.push(F.x),Ne.push(F.y),Ne.push(F.z)}var Fe=t.i.fromVertices(Ne,n.t.ZERO,3,K),Se=d.x.fromRectangle(Ve,He,Te,Re,Y),ke=d.x.fromRectangle(Ve,Oe,ze,Re,Y),De=new h.s(Re).computeHorizonCullingPointFromVerticesPossiblyUnderEllipsoid(Fe.center,Ne,3,Fe.center,He,X),Le=Te-He,We=new Uint16Array(m.length+x.length+w.length);for(C=0;C