import{a as u}from"./chunk-32UDSAPU.js";import{a as ee}from"./chunk-FBQDLPON.js";import{a as fe}from"./chunk-LH4TAMBV.js";import{b as ae,c as ce,d as W}from"./chunk-WI5KIEME.js";import{b as E,d as re}from"./chunk-ZPW6H6BB.js";import{a as C,b as O,f as N}from"./chunk-HMXXHGCW.js";import{a as J}from"./chunk-NFDMGE7Q.js";import{b as o,f as H}from"./chunk-VDZXURWO.js";import{a as b}from"./chunk-UEFEFMYS.js";import{a as y}from"./chunk-5HWP5DW7.js";import{a as w,b as P}from"./chunk-3K67FZLU.js";import{e as c}from"./chunk-55TU6MJR.js";function R(e){this.planes=y(e,[])}var Z=[new o,new o,new o];o.clone(o.UNIT_X,Z[0]);o.clone(o.UNIT_Y,Z[1]);o.clone(o.UNIT_Z,Z[2]);var A=new o,Pe=new o,se=new ee(new o(1,0,0),0);R.fromBoundingSphere=function(e,n){if(!c(e))throw new w("boundingSphere is required.");c(n)||(n=new R);let i=Z.length,f=n.planes;f.length=2*i;let h=e.center,m=e.radius,l=0;for(let g=0;g<i;++g){let r=Z[g],s=f[l],d=f[l+1];c(s)||(s=f[l]=new C),c(d)||(d=f[l+1]=new C),o.multiplyByScalar(r,-m,A),o.add(h,A,A),s.x=r.x,s.y=r.y,s.z=r.z,s.w=-o.dot(r,A),o.multiplyByScalar(r,m,A),o.add(h,A,A),d.x=-r.x,d.y=-r.y,d.z=-r.z,d.w=-o.dot(o.negate(r,Pe),A),l+=2}return n};R.prototype.computeVisibility=function(e){if(!c(e))throw new w("boundingVolume is required.");let n=this.planes,i=!1;for(let f=0,h=n.length;f<h;++f){let m=e.intersectPlane(ee.fromCartesian4(n[f],se));if(m===E.OUTSIDE)return E.OUTSIDE;m===E.INTERSECTING&&(i=!0)}return i?E.INTERSECTING:E.INSIDE};R.prototype.computeVisibilityWithPlaneMask=function(e,n){if(!c(e))throw new w("boundingVolume is required.");if(!c(n))throw new w("parentPlaneMask is required.");if(n===R.MASK_OUTSIDE||n===R.MASK_INSIDE)return n;let i=R.MASK_INSIDE,f=this.planes;for(let h=0,m=f.length;h<m;++h){let l=h<31?1<<h:0;if(h<31&&!(n&l))continue;let g=e.intersectPlane(ee.fromCartesian4(f[h],se));if(g===E.OUTSIDE)return R.MASK_OUTSIDE;g===E.INTERSECTING&&(i|=l)}return i};R.MASK_OUTSIDE=4294967295;R.MASK_INSIDE=0;R.MASK_INDETERMINATE=2147483647;var Q=R;function V(e){e=y(e,y.EMPTY_OBJECT),this.left=e.left,this._left=void 0,this.right=e.right,this._right=void 0,this.top=e.top,this._top=void 0,this.bottom=e.bottom,this._bottom=void 0,this.near=y(e.near,1),this._near=this.near,this.far=y(e.far,5e8),this._far=this.far,this._cullingVolume=new Q,this._orthographicMatrix=new O}function he(e){if(!c(e.right)||!c(e.left)||!c(e.top)||!c(e.bottom)||!c(e.near)||!c(e.far))throw new w("right, left, top, bottom, near, or far parameters are not set.");if(e.top!==e._top||e.bottom!==e._bottom||e.left!==e._left||e.right!==e._right||e.near!==e._near||e.far!==e._far){if(e.left>e.right)throw new w("right must be greater than left.");if(e.bottom>e.top)throw new w("top must be greater than bottom.");if(e.near<=0||e.near>e.far)throw new w("near must be greater than zero and less than far.");e._left=e.left,e._right=e.right,e._top=e.top,e._bottom=e.bottom,e._near=e.near,e._far=e.far,e._orthographicMatrix=O.computeOrthographicOffCenter(e.left,e.right,e.bottom,e.top,e.near,e.far,e._orthographicMatrix)}}Object.defineProperties(V.prototype,{projectionMatrix:{get:function(){return he(this),this._orthographicMatrix}}});var Oe=new o,ze=new o,Te=new o,ne=new o;V.prototype.computeCullingVolume=function(e,n,i){if(!c(e))throw new w("position is required.");if(!c(n))throw new w("direction is required.");if(!c(i))throw new w("up is required.");let f=this._cullingVolume.planes,h=this.top,m=this.bottom,l=this.right,g=this.left,r=this.near,s=this.far,d=o.cross(n,i,Oe);o.normalize(d,d);let _=ze;o.multiplyByScalar(n,r,_),o.add(e,_,_);let p=Te;o.multiplyByScalar(d,g,p),o.add(_,p,p);let t=f[0];return c(t)||(t=f[0]=new C),t.x=d.x,t.y=d.y,t.z=d.z,t.w=-o.dot(d,p),o.multiplyByScalar(d,l,p),o.add(_,p,p),t=f[1],c(t)||(t=f[1]=new C),t.x=-d.x,t.y=-d.y,t.z=-d.z,t.w=-o.dot(o.negate(d,ne),p),o.multiplyByScalar(i,m,p),o.add(_,p,p),t=f[2],c(t)||(t=f[2]=new C),t.x=i.x,t.y=i.y,t.z=i.z,t.w=-o.dot(i,p),o.multiplyByScalar(i,h,p),o.add(_,p,p),t=f[3],c(t)||(t=f[3]=new C),t.x=-i.x,t.y=-i.y,t.z=-i.z,t.w=-o.dot(o.negate(i,ne),p),t=f[4],c(t)||(t=f[4]=new C),t.x=n.x,t.y=n.y,t.z=n.z,t.w=-o.dot(n,_),o.multiplyByScalar(n,s,p),o.add(e,p,p),t=f[5],c(t)||(t=f[5]=new C),t.x=-n.x,t.y=-n.y,t.z=-n.z,t.w=-o.dot(o.negate(n,ne),p),this._cullingVolume};V.prototype.getPixelDimensions=function(e,n,i,f,h){if(he(this),!c(e)||!c(n))throw new w("Both drawingBufferWidth and drawingBufferHeight are required.");if(e<=0)throw new w("drawingBufferWidth must be greater than zero.");if(n<=0)throw new w("drawingBufferHeight must be greater than zero.");if(!c(i))throw new w("distance is required.");if(!c(f))throw new w("pixelRatio is required.");if(f<=0)throw new w("pixelRatio must be greater than zero.");if(!c(h))throw new w("A result object is required.");let m=this.right-this.left,l=this.top-this.bottom,g=f*m/e,r=f*l/n;return h.x=g,h.y=r,h};V.prototype.clone=function(e){return c(e)||(e=new V),e.left=this.left,e.right=this.right,e.top=this.top,e.bottom=this.bottom,e.near=this.near,e.far=this.far,e._left=void 0,e._right=void 0,e._top=void 0,e._bottom=void 0,e._near=void 0,e._far=void 0,e};V.prototype.equals=function(e){return c(e)&&e instanceof V&&this.right===e.right&&this.left===e.left&&this.top===e.top&&this.bottom===e.bottom&&this.near===e.near&&this.far===e.far};V.prototype.equalsEpsilon=function(e,n,i){return e===this||c(e)&&e instanceof V&&b.equalsEpsilon(this.right,e.right,n,i)&&b.equalsEpsilon(this.left,e.left,n,i)&&b.equalsEpsilon(this.top,e.top,n,i)&&b.equalsEpsilon(this.bottom,e.bottom,n,i)&&b.equalsEpsilon(this.near,e.near,n,i)&&b.equalsEpsilon(this.far,e.far,n,i)};var pe=V;function v(e){e=y(e,y.EMPTY_OBJECT),this._offCenterFrustum=new pe,this.width=e.width,this._width=void 0,this.aspectRatio=e.aspectRatio,this._aspectRatio=void 0,this.near=y(e.near,1),this._near=this.near,this.far=y(e.far,5e8),this._far=this.far}v.packedLength=4;v.pack=function(e,n,i){return P.typeOf.object("value",e),P.defined("array",n),i=y(i,0),n[i++]=e.width,n[i++]=e.aspectRatio,n[i++]=e.near,n[i]=e.far,n};v.unpack=function(e,n,i){return P.defined("array",e),n=y(n,0),c(i)||(i=new v),i.width=e[n++],i.aspectRatio=e[n++],i.near=e[n++],i.far=e[n],i};function B(e){if(!c(e.width)||!c(e.aspectRatio)||!c(e.near)||!c(e.far))throw new w("width, aspectRatio, near, or far parameters are not set.");let n=e._offCenterFrustum;if(e.width!==e._width||e.aspectRatio!==e._aspectRatio||e.near!==e._near||e.far!==e._far){if(e.aspectRatio<0)throw new w("aspectRatio must be positive.");if(e.near<0||e.near>e.far)throw new w("near must be greater than zero and less than far.");e._aspectRatio=e.aspectRatio,e._width=e.width,e._near=e.near,e._far=e.far;let i=1/e.aspectRatio;n.right=e.width*.5,n.left=-n.right,n.top=i*n.right,n.bottom=-n.top,n.near=e.near,n.far=e.far}}Object.defineProperties(v.prototype,{projectionMatrix:{get:function(){return B(this),this._offCenterFrustum.projectionMatrix}},offCenterFrustum:{get:function(){return B(this),this._offCenterFrustum}}});v.prototype.computeCullingVolume=function(e,n,i){return B(this),this._offCenterFrustum.computeCullingVolume(e,n,i)};v.prototype.getPixelDimensions=function(e,n,i,f,h){return B(this),this._offCenterFrustum.getPixelDimensions(e,n,i,f,h)};v.prototype.clone=function(e){return c(e)||(e=new v),e.aspectRatio=this.aspectRatio,e.width=this.width,e.near=this.near,e.far=this.far,e._aspectRatio=void 0,e._width=void 0,e._near=void 0,e._far=void 0,this._offCenterFrustum.clone(e._offCenterFrustum),e};v.prototype.equals=function(e){return!c(e)||!(e instanceof v)?!1:(B(this),B(e),this.width===e.width&&this.aspectRatio===e.aspectRatio&&this._offCenterFrustum.equals(e._offCenterFrustum))};v.prototype.equalsEpsilon=function(e,n,i){return!c(e)||!(e instanceof v)?!1:(B(this),B(e),b.equalsEpsilon(this.width,e.width,n,i)&&b.equalsEpsilon(this.aspectRatio,e.aspectRatio,n,i)&&this._offCenterFrustum.equalsEpsilon(e._offCenterFrustum,n,i))};var L=v;function S(e){e=y(e,y.EMPTY_OBJECT),this.left=e.left,this._left=void 0,this.right=e.right,this._right=void 0,this.top=e.top,this._top=void 0,this.bottom=e.bottom,this._bottom=void 0,this.near=y(e.near,1),this._near=this.near,this.far=y(e.far,5e8),this._far=this.far,this.farForTileset=y(e.farForTileset,5e8),this._farForTileset=this.farForTileset,this._cullingVolumeForTileset=new Q,this._cullingVolume=new Q,this._perspectiveMatrix=new O,this._infinitePerspective=new O}function ie(e){if(!c(e.right)||!c(e.left)||!c(e.top)||!c(e.bottom)||!c(e.near)||!c(e.far))throw new w("right, left, top, bottom, near, or far parameters are not set.");let{top:n,bottom:i,right:f,left:h,near:m,far:l}=e;if(n!==e._top||i!==e._bottom||h!==e._left||f!==e._right||m!==e._near||l!==e._far){if(e.near<=0||e.near>e.far)throw new w("near must be greater than zero and less than far.");if(e._left=h,e._right=f,e._top=n,e._bottom=i,e._near=m,e._far=l,e._perspectiveMatrix=O.computePerspectiveOffCenter(h,f,i,n,m,l,e._perspectiveMatrix),e._infinitePerspective=O.computeInfinitePerspectiveOffCenter(h,f,i,n,m,e._infinitePerspective),e._clipPlane){let r=e._clipPlane;e._perspectiveMatrix=le(e._perspectiveMatrix,r),e._infinitePerspective=le(e._infinitePerspective,r)}}}var $=new C,D=new C;function le(e,n){C.clone(n,D),$.x=b.sign(D.x)+e[8]/e[0],$.y=b.sign(D.y)+e[9]/e[5],$.z=-1,$.w=(1+e[10])/e[14];let i=2/C.dot(D,$);return C.multiplyByScalar(D,i,D),e[2]=D.x,e[6]=D.y,e[10]=D.z+1,e[14]=D.w,e}Object.defineProperties(S.prototype,{projectionMatrix:{get:function(){return ie(this),this._perspectiveMatrix}},infiniteProjectionMatrix:{get:function(){return ie(this),this._infinitePerspective}},clipPlane:{get:function(){return this._clipPlane},set:function(e){this._clipPlane=e}}});var we=new o,de=new o,_e=new o,me=new o;S.prototype.computeCullingVolume=function(e,n,i){if(!c(e))throw new w("position is required.");if(!c(n))throw new w("direction is required.");if(!c(i))throw new w("up is required.");let f=this._cullingVolume.planes,h=this.top,m=this.bottom,l=this.right,g=this.left,r=this.near,s=this.far,d=o.cross(n,i,we),_=de;o.multiplyByScalar(n,r,_),o.add(e,_,_);let p=_e;o.multiplyByScalar(n,s,p),o.add(e,p,p);let t=me;o.multiplyByScalar(d,g,t),o.add(_,t,t),o.subtract(t,e,t),o.normalize(t,t),o.cross(t,i,t),o.normalize(t,t);let a=f[0];return c(a)||(a=f[0]=new C),a.x=t.x,a.y=t.y,a.z=t.z,a.w=-o.dot(t,e),o.multiplyByScalar(d,l,t),o.add(_,t,t),o.subtract(t,e,t),o.cross(i,t,t),o.normalize(t,t),a=f[1],c(a)||(a=f[1]=new C),a.x=t.x,a.y=t.y,a.z=t.z,a.w=-o.dot(t,e),o.multiplyByScalar(i,m,t),o.add(_,t,t),o.subtract(t,e,t),o.cross(d,t,t),o.normalize(t,t),a=f[2],c(a)||(a=f[2]=new C),a.x=t.x,a.y=t.y,a.z=t.z,a.w=-o.dot(t,e),o.multiplyByScalar(i,h,t),o.add(_,t,t),o.subtract(t,e,t),o.cross(t,d,t),o.normalize(t,t),a=f[3],c(a)||(a=f[3]=new C),a.x=t.x,a.y=t.y,a.z=t.z,a.w=-o.dot(t,e),a=f[4],c(a)||(a=f[4]=new C),a.x=n.x,a.y=n.y,a.z=n.z,a.w=-o.dot(n,_),o.negate(n,t),a=f[5],c(a)||(a=f[5]=new C),a.x=t.x,a.y=t.y,a.z=t.z,a.w=-o.dot(t,p),this._cullingVolume};S.prototype.computeCullingVolumeForTileset=function(e,n,i){if(!c(e))throw new w("position is required.");if(!c(n))throw new w("direction is required.");if(!c(i))throw new w("up is required.");let f=this._cullingVolumeForTileset.planes,h=this.top,m=this.bottom,l=this.right,g=this.left,r=this.near,s=this.farForTileset,d=o.cross(n,i,we),_=de;o.multiplyByScalar(n,r,_),o.add(e,_,_);let p=_e;o.multiplyByScalar(n,s,p),o.add(e,p,p);let t=me;o.multiplyByScalar(d,g,t),o.add(_,t,t),o.subtract(t,e,t),o.normalize(t,t),o.cross(t,i,t),o.normalize(t,t);let a=f[0];return c(a)||(a=f[0]=new C),a.x=t.x,a.y=t.y,a.z=t.z,a.w=-o.dot(t,e),o.multiplyByScalar(d,l,t),o.add(_,t,t),o.subtract(t,e,t),o.cross(i,t,t),o.normalize(t,t),a=f[1],c(a)||(a=f[1]=new C),a.x=t.x,a.y=t.y,a.z=t.z,a.w=-o.dot(t,e),o.multiplyByScalar(i,m,t),o.add(_,t,t),o.subtract(t,e,t),o.cross(d,t,t),o.normalize(t,t),a=f[2],c(a)||(a=f[2]=new C),a.x=t.x,a.y=t.y,a.z=t.z,a.w=-o.dot(t,e),o.multiplyByScalar(i,h,t),o.add(_,t,t),o.subtract(t,e,t),o.cross(t,d,t),o.normalize(t,t),a=f[3],c(a)||(a=f[3]=new C),a.x=t.x,a.y=t.y,a.z=t.z,a.w=-o.dot(t,e),a=f[4],c(a)||(a=f[4]=new C),a.x=n.x,a.y=n.y,a.z=n.z,a.w=-o.dot(n,_),o.negate(n,t),a=f[5],c(a)||(a=f[5]=new C),a.x=t.x,a.y=t.y,a.z=t.z,a.w=-o.dot(t,p),this._cullingVolumeForTileset};S.prototype.getPixelDimensions=function(e,n,i,f,h){if(ie(this),!c(e)||!c(n))throw new w("Both drawingBufferWidth and drawingBufferHeight are required.");if(e<=0)throw new w("drawingBufferWidth must be greater than zero.");if(n<=0)throw new w("drawingBufferHeight must be greater than zero.");if(!c(i))throw new w("distance is required.");if(!c(f))throw new w("pixelRatio is required");if(f<=0)throw new w("pixelRatio must be greater than zero.");if(!c(h))throw new w("A result object is required.");let m=1/this.near,l=this.top*m,g=2*f*i*l/n;l=this.right*m;let r=2*f*i*l/e;return h.x=r,h.y=g,h};S.prototype.clone=function(e){return c(e)||(e=new S),e.right=this.right,e.left=this.left,e.top=this.top,e.bottom=this.bottom,e.near=this.near,e.far=this.far,e._left=void 0,e._right=void 0,e._top=void 0,e._bottom=void 0,e._near=void 0,e._far=void 0,e.clipPlane=this.clipPlane,e};S.prototype.equals=function(e){return c(e)&&e instanceof S&&this.right===e.right&&this.left===e.left&&this.top===e.top&&this.bottom===e.bottom&&this.near===e.near&&this.far===e.far};S.prototype.equalsEpsilon=function(e,n,i){return e===this||c(e)&&e instanceof S&&b.equalsEpsilon(this.right,e.right,n,i)&&b.equalsEpsilon(this.left,e.left,n,i)&&b.equalsEpsilon(this.top,e.top,n,i)&&b.equalsEpsilon(this.bottom,e.bottom,n,i)&&b.equalsEpsilon(this.near,e.near,n,i)&&b.equalsEpsilon(this.far,e.far,n,i)};var ye=S;function z(e){e=y(e,y.EMPTY_OBJECT),this._offCenterFrustum=new ye,this.fov=e.fov,this._fov=void 0,this._fovy=void 0,this._sseDenominator=void 0,this.aspectRatio=e.aspectRatio,this._aspectRatio=void 0,this.near=y(e.near,1),this._near=this.near,this.far=y(e.far,5e8),this._far=this.far,this.farForTileset=y(e.farForTileset,5e8),this._farForTileset=this.farForTileset,this.xOffset=y(e.xOffset,0),this._xOffset=this.xOffset,this.yOffset=y(e.yOffset,0),this._yOffset=this.yOffset}z.packedLength=6;z.pack=function(e,n,i){return P.typeOf.object("value",e),P.defined("array",n),i=y(i,0),n[i++]=e.fov,n[i++]=e.aspectRatio,n[i++]=e.near,n[i++]=e.far,n[i++]=e.xOffset,n[i]=e.yOffset,n};z.unpack=function(e,n,i){return P.defined("array",e),n=y(n,0),c(i)||(i=new z),i.fov=e[n++],i.aspectRatio=e[n++],i.near=e[n++],i.far=e[n++],i.xOffset=e[n++],i.yOffset=e[n],i};function q(e){if(!c(e.fov)||!c(e.aspectRatio)||!c(e.near)||!c(e.far))throw new w("fov, aspectRatio, near, or far parameters are not set.");if(!(e.fov!==e._fov||e.aspectRatio!==e._aspectRatio||e.near!==e._near||e.far!==e._far||e.farForTileset!==e._farForTileset||e.xOffset!==e._xOffset||e.yOffset!==e._yOffset))return;if(P.typeOf.number.greaterThanOrEquals("fov",e.fov,0),P.typeOf.number.lessThan("fov",e.fov,Math.PI),P.typeOf.number.greaterThanOrEquals("aspectRatio",e.aspectRatio,0),P.typeOf.number.greaterThanOrEquals("near",e.near,0),e.near>e.far)throw new w("near must be less than far.");e._aspectRatio=e.aspectRatio,e._fov=e.fov,e._fovy=e.aspectRatio<=1?e.fov:Math.atan(Math.tan(e.fov*.5)/e.aspectRatio)*2,e._near=e.near,e._far=e.far,e._farForTileset=e.farForTileset,e._sseDenominator=2*Math.tan(.5*e._fovy),e._xOffset=e.xOffset,e._yOffset=e.yOffset;let i=e._offCenterFrustum;i.top=e.near*Math.tan(.5*e._fovy),i.bottom=-i.top,i.right=e.aspectRatio*i.top,i.left=-i.right,i.near=e.near,i.far=e.far,i.farForTileset=e.farForTileset,i.right+=e.xOffset,i.left+=e.xOffset,i.top+=e.yOffset,i.bottom+=e.yOffset}Object.defineProperties(z.prototype,{projectionMatrix:{get:function(){return q(this),this._offCenterFrustum.projectionMatrix}},infiniteProjectionMatrix:{get:function(){return q(this),this._offCenterFrustum.infiniteProjectionMatrix}},fovy:{get:function(){return q(this),this._fovy}},sseDenominator:{get:function(){return q(this),this._sseDenominator}},offCenterFrustum:{get:function(){return q(this),this._offCenterFrustum}}});z.prototype.computeCullingVolume=function(e,n,i){return q(this),this._offCenterFrustum.computeCullingVolume(e,n,i)};z.prototype.computeCullingVolumeForTileset=function(e,n,i){return q(this),this._offCenterFrustum.computeCullingVolumeForTileset(e,n,i)};z.prototype.getPixelDimensions=function(e,n,i,f,h){return q(this),this._offCenterFrustum.getPixelDimensions(e,n,i,f,h)};z.prototype.clone=function(e){return c(e)||(e=new z),e.aspectRatio=this.aspectRatio,e.fov=this.fov,e.near=this.near,e.far=this.far,e._aspectRatio=void 0,e._fov=void 0,e._near=void 0,e._far=void 0,this._offCenterFrustum.clone(e._offCenterFrustum),e};z.prototype.equals=function(e){return!c(e)||!(e instanceof z)?!1:(q(this),q(e),this.fov===e.fov&&this.aspectRatio===e.aspectRatio&&this._offCenterFrustum.equals(e._offCenterFrustum))};z.prototype.equalsEpsilon=function(e,n,i){return!c(e)||!(e instanceof z)?!1:(q(this),q(e),b.equalsEpsilon(this.fov,e.fov,n,i)&&b.equalsEpsilon(this.aspectRatio,e.aspectRatio,n,i)&&this._offCenterFrustum.equalsEpsilon(e._offCenterFrustum,n,i))};var j=z;var te=0,xe=1;function Y(e){P.typeOf.object("options",e),P.typeOf.object("options.frustum",e.frustum),P.typeOf.object("options.origin",e.origin),P.typeOf.object("options.orientation",e.orientation);let n=e.frustum,i=e.orientation,f=e.origin,h=y(e.vertexFormat,u.DEFAULT),m=y(e._drawNearPlane,!0),l,g;n instanceof j?(l=te,g=j.packedLength):n instanceof L&&(l=xe,g=L.packedLength),this._frustumType=l,this._frustum=n.clone(),this._origin=o.clone(f),this._orientation=N.clone(i),this._drawNearPlane=m,this._vertexFormat=h,this._workerName="createFrustumGeometry",this.packedLength=2+g+o.packedLength+N.packedLength+u.packedLength}Y.pack=function(e,n,i){P.typeOf.object("value",e),P.defined("array",n),i=y(i,0);let f=e._frustumType,h=e._frustum;return n[i++]=f,f===te?(j.pack(h,n,i),i+=j.packedLength):(L.pack(h,n,i),i+=L.packedLength),o.pack(e._origin,n,i),i+=o.packedLength,N.pack(e._orientation,n,i),i+=N.packedLength,u.pack(e._vertexFormat,n,i),i+=u.packedLength,n[i]=e._drawNearPlane?1:0,n};var ve=new j,Re=new L,qe=new N,Se=new o,ke=new u;Y.unpack=function(e,n,i){P.defined("array",e),n=y(n,0);let f=e[n++],h;f===te?(h=j.unpack(e,n,ve),n+=j.packedLength):(h=L.unpack(e,n,Re),n+=L.packedLength);let m=o.unpack(e,n,Se);n+=o.packedLength;let l=N.unpack(e,n,qe);n+=N.packedLength;let g=u.unpack(e,n,ke);n+=u.packedLength;let r=e[n]===1;if(!c(i))return new Y({frustum:h,origin:m,orientation:l,vertexFormat:g,_drawNearPlane:r});let s=f===i._frustumType?i._frustum:void 0;return i._frustum=h.clone(s),i._frustumType=f,i._origin=o.clone(m,i._origin),i._orientation=N.clone(l,i._orientation),i._vertexFormat=u.clone(g,i._vertexFormat),i._drawNearPlane=r,i};function X(e,n,i,f,h,m,l,g){let r=e/3*2;for(let s=0;s<4;++s)c(n)&&(n[e]=m.x,n[e+1]=m.y,n[e+2]=m.z),c(i)&&(i[e]=l.x,i[e+1]=l.y,i[e+2]=l.z),c(f)&&(f[e]=g.x,f[e+1]=g.y,f[e+2]=g.z),e+=3;h[r]=0,h[r+1]=0,h[r+2]=1,h[r+3]=0,h[r+4]=1,h[r+5]=1,h[r+6]=0,h[r+7]=1}var Ve=new H,De=new O,oe=new O,ge=new o,Ce=new o,Fe=new o,Me=new o,Ne=new o,ue=new o,U=new Array(3),I=new Array(4);I[0]=new C(-1,-1,1,1);I[1]=new C(1,-1,1,1);I[2]=new C(1,1,1,1);I[3]=new C(-1,1,1,1);var be=new Array(4);for(let e=0;e<4;++e)be[e]=new C;Y._computeNearFarPlanes=function(e,n,i,f,h,m,l,g){let r=H.fromQuaternion(n,Ve),s=y(m,ge),d=y(l,Ce),_=y(g,Fe);s=H.getColumn(r,0,s),d=H.getColumn(r,1,d),_=H.getColumn(r,2,_),o.normalize(s,s),o.normalize(d,d),o.normalize(_,_),o.negate(s,s);let p=O.computeView(e,_,d,s,De),t,a,k=f.projectionMatrix;if(i===te){let T=O.multiply(k,p,oe);a=O.inverse(T,oe)}else t=O.inverseTransformation(p,oe);c(a)?(U[0]=f.near,U[1]=f.far):(U[0]=0,U[1]=f.near,U[2]=f.far);for(let T=0;T<2;++T)for(let x=0;x<4;++x){let F=C.clone(I[x],be[x]);if(c(a)){F=O.multiplyByVector(a,F,F);let M=1/F.w;o.multiplyByScalar(F,M,F),o.subtract(F,e,F),o.normalize(F,F);let K=o.dot(_,F);o.multiplyByScalar(F,U[T]/K,F),o.add(F,e,F)}else{let M=f.offCenterFrustum;c(M)&&(f=M);let K=U[T],G=U[T+1];F.x=(F.x*(f.right-f.left)+f.left+f.right)*.5,F.y=(F.y*(f.top-f.bottom)+f.bottom+f.top)*.5,F.z=(F.z*(K-G)-K-G)*.5,F.w=1,O.multiplyByVector(t,F,F)}h[12*T+x*3]=F.x,h[12*T+x*3+1]=F.y,h[12*T+x*3+2]=F.z}};Y.createGeometry=function(e){let n=e._frustumType,i=e._frustum,f=e._origin,h=e._orientation,m=e._drawNearPlane,l=e._vertexFormat,g=m?6:5,r=new Float64Array(3*4*6);Y._computeNearFarPlanes(f,h,n,i,r);let s=3*4*2;r[s]=r[3*4],r[s+1]=r[3*4+1],r[s+2]=r[3*4+2],r[s+3]=r[0],r[s+4]=r[1],r[s+5]=r[2],r[s+6]=r[3*3],r[s+7]=r[3*3+1],r[s+8]=r[3*3+2],r[s+9]=r[3*7],r[s+10]=r[3*7+1],r[s+11]=r[3*7+2],s+=3*4,r[s]=r[3*5],r[s+1]=r[3*5+1],r[s+2]=r[3*5+2],r[s+3]=r[3],r[s+4]=r[4],r[s+5]=r[5],r[s+6]=r[0],r[s+7]=r[1],r[s+8]=r[2],r[s+9]=r[3*4],r[s+10]=r[3*4+1],r[s+11]=r[3*4+2],s+=3*4,r[s]=r[3],r[s+1]=r[4],r[s+2]=r[5],r[s+3]=r[3*5],r[s+4]=r[3*5+1],r[s+5]=r[3*5+2],r[s+6]=r[3*6],r[s+7]=r[3*6+1],r[s+8]=r[3*6+2],r[s+9]=r[3*2],r[s+10]=r[3*2+1],r[s+11]=r[3*2+2],s+=3*4,r[s]=r[3*2],r[s+1]=r[3*2+1],r[s+2]=r[3*2+2],r[s+3]=r[3*6],r[s+4]=r[3*6+1],r[s+5]=r[3*6+2],r[s+6]=r[3*7],r[s+7]=r[3*7+1],r[s+8]=r[3*7+2],r[s+9]=r[3*3],r[s+10]=r[3*3+1],r[s+11]=r[3*3+2],m||(r=r.subarray(3*4));let d=new fe({position:new W({componentDatatype:J.DOUBLE,componentsPerAttribute:3,values:r})});if(c(l.normal)||c(l.tangent)||c(l.bitangent)||c(l.st)){let p=c(l.normal)?new Float32Array(12*g):void 0,t=c(l.tangent)?new Float32Array(3*4*g):void 0,a=c(l.bitangent)?new Float32Array(3*4*g):void 0,k=c(l.st)?new Float32Array(2*4*g):void 0,T=ge,x=Ce,F=Fe,M=o.negate(T,Me),K=o.negate(x,Ne),G=o.negate(F,ue);s=0,m&&(X(s,p,t,a,k,G,T,x),s+=3*4),X(s,p,t,a,k,F,M,x),s+=3*4,X(s,p,t,a,k,M,G,x),s+=3*4,X(s,p,t,a,k,K,G,M),s+=3*4,X(s,p,t,a,k,T,F,x),s+=3*4,X(s,p,t,a,k,x,F,M),c(p)&&(d.normal=new W({componentDatatype:J.FLOAT,componentsPerAttribute:3,values:p})),c(t)&&(d.tangent=new W({componentDatatype:J.FLOAT,componentsPerAttribute:3,values:t})),c(a)&&(d.bitangent=new W({componentDatatype:J.FLOAT,componentsPerAttribute:3,values:a})),c(k)&&(d.st=new W({componentDatatype:J.FLOAT,componentsPerAttribute:2,values:k}))}let _=new Uint16Array(6*g);for(let p=0;p<g;++p){let t=p*6,a=p*4;_[t]=a,_[t+1]=a+1,_[t+2]=a+2,_[t+3]=a,_[t+4]=a+2,_[t+5]=a+3}return new ce({attributes:d,indices:_,primitiveType:ae.TRIANGLES,boundingSphere:re.fromVertices(r)})};var Lt=Y;export{L as a,j as b,Lt as c};
|