27 lines
20 KiB
Java
27 lines
20 KiB
Java
![]() |
/**
|
||
|
* @license
|
||
|
* Cesium - https://github.com/CesiumGS/cesium
|
||
|
* Version 1.109
|
||
|
*
|
||
|
* Copyright 2011-2022 Cesium Contributors
|
||
|
*
|
||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
* you may not use this file except in compliance with the License.
|
||
|
* You may obtain a copy of the License at
|
||
|
*
|
||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
*
|
||
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
* See the License for the specific language governing permissions and
|
||
|
* limitations under the License.
|
||
|
*
|
||
|
* Columbus View (Pat. Pend.)
|
||
|
*
|
||
|
* Portions licensed separately.
|
||
|
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
|
||
|
*/
|
||
|
|
||
|
import{a as A}from"./chunk-M3OLDEEW.js";import{a as Q}from"./chunk-ATQXFTWF.js";import{a as ae}from"./chunk-FUN3J34G.js";import{b as oe,c as re,d as J}from"./chunk-A4RD4IQP.js";import{b as V,d as ie,f as N}from"./chunk-NNIY7VTE.js";import{a as b,b as O}from"./chunk-5EDTRNG5.js";import{a as H}from"./chunk-IO6LETQ6.js";import{a as r,d as u}from"./chunk-C6Y3PRDH.js";import{a as P}from"./chunk-LI57NJAL.js";import{a as m}from"./chunk-P44SUSQU.js";import{a as w,b as F}from"./chunk-FUATUYJ3.js";import{e as a}from"./chunk-ODUTJJQ5.js";function q(e){this.planes=m(e,[])}var X=[new r,new r,new r];r.clone(r.UNIT_X,X[0]);r.clone(r.UNIT_Y,X[1]);r.clone(r.UNIT_Z,X[2]);var E=new r,de=new r,fe=new Q(new r(1,0,0),0);q.fromBoundingSphere=function(e,t){if(!a(e))throw new w("boundingSphere is required.");a(t)||(t=new q);let n=X.length,f=t.planes;f.length=2*n;let p=e.center,_=e.radius,s=0;for(let y=0;y<n;++y){let i=X[y],c=f[s],d=f[s+1];a(c)||(c=f[s]=new b),a(d)||(d=f[s+1]=new b),r.multiplyByScalar(i,-_,E),r.add(p,E,E),c.x=i.x,c.y=i.y,c.z=i.z,c.w=-r.dot(i,E),r.multiplyByScalar(i,_,E),r.add(p,E,E),d.x=-i.x,d.y=-i.y,d.z=-i.z,d.w=-r.dot(r.negate(i,de),E),s+=2}return t};q.prototype.computeVisibility=function(e){if(!a(e))throw new w("boundingVolume is required.");let t=this.planes,n=!1;for(let f=0,p=t.length;f<p;++f){let _=e.intersectPlane(Q.fromCartesian4(t[f],fe));if(_===V.OUTSIDE)return V.OUTSIDE;_===V.INTERSECTING&&(n=!0)}return n?V.INTERSECTING:V.INSIDE};q.prototype.computeVisibilityWithPlaneMask=function(e,t){if(!a(e))throw new w("boundingVolume is required.");if(!a(t))throw new w("parentPlaneMask is required.");if(t===q.MASK_OUTSIDE||t===q.MASK_INSIDE)return t;let n=q.MASK_INSIDE,f=this.planes;for(let p=0,_=f.length;p<_;++p){let s=p<31?1<<p:0;if(p<31&&!(t&s))continue;let y=e.intersectPlane(Q.fromCartesian4(f[p],fe));if(y===V.OUTSIDE)return q.MASK_OUTSIDE;y===V.INTERSECTING&&(n|=s)}return n};q.MASK_OUTSIDE=4294967295;q.MASK_INSIDE=0;q.MASK_INDETERMINATE=2147483647;var $=q;function k(e){e=m(e,m.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=m(e.near,1),this._near=this.near,this.far=m(e.far,5e8),this._far=this.far,this._cullingVolume=new $,this._orthographicMatrix=new O}function ce(e){if(!a(e.right)||!a(e.left)||!a(e.top)||!a(e.bottom)||!a(e.near)||!a(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(k.prototype,{projectionMatrix:{get:function(){return ce(this),this._orthographicMatrix}}});var me=new r,ye=new r,ge=new r,ee=new r;k.prototype.computeCullingVolume=function(e,t,n){if(!a(e))throw new w("position is required.");if(!a(t))throw new w("direction is required.");if(!a(n))throw new w("up is required.");let f=this._cullingVolume.planes,p=this.top,_=this.bottom,s=this.right,y=this.left,i=this.near,c=this.far,d=r.cross(t,n,me);r.normalize(d,d);let g=ye;r.multiplyByScalar(t,i,g),r.add(e,g,g);let l=ge;r.multiplyByScalar(d,y,l),r.add(g,l,l);let o=f[0];return a(o)||(o=f[0]=new b),o.x=d.x,o.y=d.y,o.z=d.z,o.w=-r.dot(d,l),r.multiplyByScalar(d,s,l),r.add(g,l,l),o=f[1],a(o)||(o=f[1]=new b),o.x=-d.x,o.y=-d.y,o.z=-d.z,o.w=-r.dot(r.negate(d,ee),l),r.multiplyByScalar(n,_,l),r.add(g,l,l),o=f[2],a(o)||(o=f[2]=new b),o.x=n.x,o.y=n.y,o.z=n.z,o.w=-r.dot(n,l),r.multiplyByScalar(n,p,l),r.add(g,l,l),o=f[3],a(o)||(o=f[3]=new b),o.x=-n.x,o.y=-n.y,o.z=-n.z,o.w=-r.dot(r.negate(n,ee),l),o=f[4],a(o)||(o=f[4]=new b),o.x=t.x,o.y=t.y,o.z=t.z,o.w=-r.dot(t
|