define(["./AttributeCompression-8f752c03","./BoundingSphere-9a3b5656","./Cartesian2-bd414876","./Cartesian3-e0307675","./defaultValue-81eec7ed","./TerrainEncoding-0f7ffc20","./IndexDatatype-3f3c99e8","./Check-741c5f3c","./Math-e73894ab","./OrientedBoundingBox-c5d2adb7","./Rectangle-cf3e0e3e","./createTaskProcessorWorker","./ComponentDatatype-aaeec80f","./WebGLConstants-508b9636","./Matrix4-4c545f70","./RuntimeError-26acdd3b","./Matrix2-dc0c61cc","./GeographicProjection-c931c7fb","./EllipsoidTangentPlane-4d138901","./AxisAlignedBoundingBox-8774439c","./IntersectionTests-80510c7b","./Plane-bc8b6777","./Transforms-5b829630","./when-422ea0ae","./Resource-8ae1a924","./combine-3c023bda"],(function(e,t,n,i,s,r,h,o,u,d,p,a,c,l,f,g,m,x,C,w,B,y,b,I,A,v){"use strict";const T={clipTriangleAtAxisAlignedThreshold:function(e,t,n,i,r,h){let o,u,d;s.defined(h)?h.length=0:h=[],t?(o=ne,u=i>e,d=r>e);const p=o+u+d;let a,c,l,f,g,m;return 1===p?o?(a=(e-n)/(i-n),c=(e-n)/(r-n),h.push(1),h.push(2),1!==c&&(h.push(-1),h.push(0),h.push(2),h.push(c)),1!==a&&(h.push(-1),h.push(0),h.push(1),h.push(a))):u?(l=(e-i)/(r-i),f=(e-i)/(n-i),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))):d&&(g=(e-r)/(n-r),m=(e-r)/(i-r),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===p?o||n===e?u||i===e?d||r===e||(c=(e-n)/(r-n),l=(e-i)/(r-i),h.push(2),h.push(-1),h.push(0),h.push(2),h.push(c),h.push(-1),h.push(1),h.push(2),h.push(l)):(m=(e-r)/(i-r),a=(e-n)/(i-n),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)):(f=(e-i)/(n-i),g=(e-r)/(n-r),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(g)):3!==p&&(h.push(0),h.push(1),h.push(2)),h},computeBarycentricCoordinates:function(e,t,n,r,h,o,u,d,p){const a=n-u,c=u-h,l=o-d,f=r-d,g=1/(l*a+c*f),m=t-d,x=e-u,C=(l*x+c*m)*g,w=(-f*x+a*m)*g,B=1-C-w;return s.defined(p)?(p.x=C,p.y=w,p.z=B,p):new i.Cartesian3(C,w,B)},computeLineSegmentLineSegmentIntersection:function(e,t,i,r,h,o,u,d,p){const a=(d-o)*(i-e)-(u-h)*(r-t);if(0===a)return;const c=((u-h)*(t-o)-(d-o)*(e-h))/a,l=((i-e)*(t-o)-(r-t)*(e-h))/a;return c>=0&&c<=1&&l>=0&&l<=1?(s.defined(p)||(p=new n.Cartesian2),p.x=e+c*(i-e),p.y=t+c*(r-t),p):void 0}},M=32767,z=16383,V=[],N=[],R=[],E=new n.Cartographic;let H=new i.Cartesian3;const O=[],S=[],P=[],U=[],F=[],k=new i.Cartesian3,D=new t.BoundingSphere,W=new d.OrientedBoundingBox,X=new n.Cartesian2,K=new i.Cartesian3;function L(){this.vertexBuffer=void 0,this.index=void 0,this.first=void 0,this.second=void 0,this.ratio=void 0}L.prototype.clone=function(e){return s.defined(e)||(e=new L),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},L.prototype.initializeIndexed=function(e,t,n,i,s){this.uBuffer=e,this.vBuffer=t,this.heightBuffer=n,this.normalBuffer=i,this.index=s,this.first=void 0,this.second=void 0,this.ratio=void 0},L.prototype.initializeFromClipResult=function(e,t,n){let i=t+1;return-1!==e[t]?n[e[t]].clone(this):(this.vertexBuffer=void 0,this.index=void 0,this.first=n[e[i]],++i,this.second=n[e[i]],++i,this.ratio=e[i],++i),i},L.prototype.getKey=function(){return this.isIndexed()?this.index:JSON.stringify({first:this.first.getKey(),second:this.second.getKey(),ratio:this.ratio})},L.prototype.isIndexed=function(){return s.defined(this.index)},L.prototype.getH=function(){return s.defined(this.index)?this.heightBuffer[this.index]:u.CesiumMath.lerp(this.first.getH(),this.second.getH(),this.ratio)},L.prototype.getU=function(){return s.defined(this.index)?this.uBuffer[this.index]:u.CesiumMath.lerp(this.first.getU(),this.second.getU(),this.ratio)},L.prototype.getV=function(){return s.defined(this.index)?this.vBuffer[this.index]:u.CesiumMath.lerp(this.first.getV(),this.second.getV(),this.ratio)};let Y=new n.Cartesian2,G=-1;const _=[new i.Cartesian3,new i.Cartesian3],j=[new i.Cartesian3,new i.Cartesian3];function J(t,n){++G;let s=_[G],r=j[G];return s=e.AttributeCompression.octDecode(t.first.getNormalX(),t.first.getNormalY(),s),r=e.AttributeCompression.octDecode(t.second.getNormalX(),t.second.getNormalY(),r),H=i.Cartesian3.lerp(s,r,t.ratio,H),i.Cartesian3.normalize(H,H),e.AttributeCompression.octEncode(H,n),--G,n}L.prototype.getNormalX=function(){return s.defined(this.index)?this.normalBuffer[2*this.index]:(Y=J(this,Y),Y.x)},L.prototype.getNormalY=function(){return s.defined(this.index)?this.normalBuffer[2*this.index+1]:(Y=J(this,Y),Y.y)};const Z=[];function q(e,t,n,i,r,h,o,u,d){if(0===o.length)return;let p=0,a=0;for(;a=z||!o&&ie<=z)&&(a&&se>=z||!a&&se<=z)&&(y[te]=Y,m.push(ie),x.push(se),C.push(Q[te]),v&&(w.push($[ne]),w.push($[ne+1])),++Y)}const re=[];re.push(new L),re.push(new L),re.push(new L);const he=[];let oe,ue;for(he.push(new L),he.push(new L),he.push(new L),te=0;te=h.length||(oe=he[0].initializeFromClipResult(h,oe,re),oe>=h.length||(oe=he[1].initializeFromClipResult(h,oe,re),oe>=h.length||(oe=he[2].initializeFromClipResult(h,oe,re),ue=T.clipTriangleAtAxisAlignedThreshold(z,a,he[0].getV(),he[1].getV(),he[2].getV(),N),q(m,x,C,w,B,y,ue,he,v),oe=l?(le.push(te),ie=M):ie=2*ie+de,m[te]=ie,se=Math.round(x[te]),se<=f?(ce.push(te),se=0):se>=g?(fe.push(te),se=M):se=2*se+pe,x[te]=se,ee=u.CesiumMath.lerp(_,j,C[te]/M),eeme&&(me=ee),C[te]=ee,E.longitude=u.CesiumMath.lerp(Ie,be,ie/M),E.latitude=u.CesiumMath.lerp(ye,Be,se/M),E.height=ee,Ce.cartographicToCartesian(E,H),xe.push(H.x),xe.push(H.y),xe.push(H.z);const Ae=t.BoundingSphere.fromVertices(xe,i.Cartesian3.ZERO,3,D),ve=d.OrientedBoundingBox.fromRectangle(we,ge,me,Ce,W),Te=new r.EllipsoidalOccluder(Ce).computeHorizonCullingPointFromVerticesPossiblyUnderEllipsoid(Ae.center,xe,3,Ae.center,ge,k),Me=me-ge,ze=new Uint16Array(m.length+x.length+C.length);for(te=0;te