define(["./AttributeCompression-e2e3f0dd","./Transforms-98ffa11d","./Matrix2-e3fb4559","./Cartesian3-7e9cc2ff","./defaultValue-81eec7ed","./TerrainEncoding-2e2628a7","./IndexDatatype-f1e3f799","./Check-741c5f3c","./Math-5f585871","./OrientedBoundingBox-3db45505","./createTaskProcessorWorker","./ComponentDatatype-aaeec80f","./WebGLConstants-508b9636","./Matrix4-d34187af","./RuntimeError-26acdd3b","./_commonjsHelpers-3aae1032-26891ab7","./combine-3c023bda","./EllipsoidTangentPlane-fa1337e1","./AxisAlignedBoundingBox-37250ed6","./IntersectionTests-73b87d72","./Plane-4f75b3df"],(function(e,t,n,i,s,r,h,o,u,d,p,a,l,f,c,g,m,x,C,w,B){"use strict";const y={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,l,f,c,g,m;return 1===p?o?(a=(e-n)/(i-n),l=(e-n)/(r-n),h.push(1),h.push(2),1!==l&&(h.push(-1),h.push(0),h.push(2),h.push(l)),1!==a&&(h.push(-1),h.push(0),h.push(1),h.push(a))):u?(f=(e-i)/(r-i),c=(e-i)/(n-i),h.push(2),h.push(0),1!==c&&(h.push(-1),h.push(1),h.push(0),h.push(c)),1!==f&&(h.push(-1),h.push(1),h.push(2),h.push(f))):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||(l=(e-n)/(r-n),f=(e-i)/(r-i),h.push(2),h.push(-1),h.push(0),h.push(2),h.push(l),h.push(-1),h.push(1),h.push(2),h.push(f)):(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)):(c=(e-i)/(n-i),g=(e-r)/(n-r),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!==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,l=u-h,f=o-d,c=r-d,g=1/(f*a+l*c),m=t-d,x=e-u,C=(f*x+l*m)*g,w=(-c*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 l=((u-h)*(t-o)-(d-o)*(e-h))/a,f=((i-e)*(t-o)-(r-t)*(e-h))/a;return l>=0&&l<=1&&f>=0&&f<=1?(s.defined(p)||(p=new n.Cartesian2),p.x=e+l*(i-e),p.y=t+l*(r-t),p):void 0}},I=32767,A=16383,b=[],v=[],T=[],M=new n.Cartographic;let z=new i.Cartesian3;const V=[],N=[],E=[],H=[],R=[],O=new i.Cartesian3,S=new t.BoundingSphere,U=new d.OrientedBoundingBox,F=new n.Cartesian2,P=new i.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 s.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,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},k.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},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 s.defined(this.index)},k.prototype.getH=function(){return s.defined(this.index)?this.heightBuffer[this.index]:u.CesiumMath.lerp(this.first.getH(),this.second.getH(),this.ratio)},k.prototype.getU=function(){return s.defined(this.index)?this.uBuffer[this.index]:u.CesiumMath.lerp(this.first.getU(),this.second.getU(),this.ratio)},k.prototype.getV=function(){return s.defined(this.index)?this.vBuffer[this.index]:u.CesiumMath.lerp(this.first.getV(),this.second.getV(),this.ratio)};let D=new n.Cartesian2,W=-1;const X=[new i.Cartesian3,new i.Cartesian3],K=[new i.Cartesian3,new i.Cartesian3];function L(t,n){++W;let s=X[W],r=K[W];return s=e.AttributeCompression.octDecode(t.first.getNormalX(),t.first.getNormalY(),s),r=e.AttributeCompression.octDecode(t.second.getNormalX(),t.second.getNormalY(),r),z=i.Cartesian3.lerp(s,r,t.ratio,z),i.Cartesian3.normalize(z,z),e.AttributeCompression.octEncode(z,n),--W,n}k.prototype.getNormalX=function(){return s.defined(this.index)?this.normalBuffer[2*this.index]:(D=L(this,D),D.x)},k.prototype.getNormalY=function(){return s.defined(this.index)?this.normalBuffer[2*this.index+1]:(D=L(this,D),D.y)};const Y=[];function _(e,t,n,i,r,h,o,u,d){if(0===o.length)return;let p=0,a=0;for(;a=A||!o&&ne<=A)&&(p&&ie>=A||!p&&ie<=A)&&(B[ee]=L,g.push(ne),m.push(ie),x.push(q[ee]),K&&(C.push(Q[te]),C.push(Q[te+1])),++L)}const se=[];se.push(new k),se.push(new k),se.push(new k);const re=[];let he,oe;for(re.push(new k),re.push(new k),re.push(new k),ee=0;ee=h.length||(he=re[0].initializeFromClipResult(h,he,se),he>=h.length||(he=re[1].initializeFromClipResult(h,he,se),he>=h.length||(he=re[2].initializeFromClipResult(h,he,se),oe=y.clipTriangleAtAxisAlignedThreshold(A,p,re[0].getV(),re[1].getV(),re[2].getV(),v),_(g,m,x,C,w,B,oe,re,K),he=l?(le.push(ee),ne=I):ne=2*ne+ue,g[ee]=ne,ie=Math.round(m[ee]),ie<=f?(ae.push(ee),ie=0):ie>=c?(fe.push(ee),ie=I):ie=2*ie+de,m[ee]=ie,$=u.CesiumMath.lerp(j,G,x[ee]/I),$ge&&(ge=$),x[ee]=$,M.longitude=u.CesiumMath.lerp(Ie,ye,ne/I),M.latitude=u.CesiumMath.lerp(Be,we,ie/I),M.height=$,xe.cartographicToCartesian(M,z),me.push(z.x),me.push(z.y),me.push(z.z);const Ae=t.BoundingSphere.fromVertices(me,i.Cartesian3.ZERO,3,S),be=d.OrientedBoundingBox.fromRectangle(Ce,ce,ge,xe,U),ve=new r.EllipsoidalOccluder(xe).computeHorizonCullingPointFromVerticesPossiblyUnderEllipsoid(Ae.center,me,3,Ae.center,ce,O),Te=ge-ce,Me=new Uint16Array(g.length+m.length+x.length);for(ee=0;ee