chunk-Z26YYIFB.js 21 KB

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