Files
td_official/public/Cesium/Workers/FrustumGeometry-51b0b347.js

26 lines
20 KiB
JavaScript
Raw Permalink Normal View History

2025-06-18 19:56:54 +08:00
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.98
*
* 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.
*/
define(["exports","./Transforms-c9e418cb","./Matrix2-cf4c6e69","./ComponentDatatype-9b23164a","./defaultValue-50f7432c","./GeometryAttribute-b84ffce6","./GeometryAttributes-8bab1b25","./Plane-b9f0711b","./VertexFormat-fa0c27e8"],(function(t,e,a,n,i,r,o,s,f){"use strict";function u(t){this.planes=i.defaultValue(t,[])}const l=[new a.Cartesian3,new a.Cartesian3,new a.Cartesian3];a.Cartesian3.clone(a.Cartesian3.UNIT_X,l[0]),a.Cartesian3.clone(a.Cartesian3.UNIT_Y,l[1]),a.Cartesian3.clone(a.Cartesian3.UNIT_Z,l[2]);const c=new a.Cartesian3,h=new a.Cartesian3,p=new s.Plane(new a.Cartesian3(1,0,0),0);function d(t){t=i.defaultValue(t,i.defaultValue.EMPTY_OBJECT),this.left=t.left,this._left=void 0,this.right=t.right,this._right=void 0,this.top=t.top,this._top=void 0,this.bottom=t.bottom,this._bottom=void 0,this.near=i.defaultValue(t.near,1),this._near=this.near,this.far=i.defaultValue(t.far,5e8),this._far=this.far,this._cullingVolume=new u,this._orthographicMatrix=new a.Matrix4}function m(t){t.top===t._top&&t.bottom===t._bottom&&t.left===t._left&&t.right===t._right&&t.near===t._near&&t.far===t._far||(t._left=t.left,t._right=t.right,t._top=t.top,t._bottom=t.bottom,t._near=t.near,t._far=t.far,t._orthographicMatrix=a.Matrix4.computeOrthographicOffCenter(t.left,t.right,t.bottom,t.top,t.near,t.far,t._orthographicMatrix))}u.fromBoundingSphere=function(t,e){i.defined(e)||(e=new u);const n=l.length,r=e.planes;r.length=2*n;const o=t.center,s=t.radius;let f=0;for(let t=0;t<n;++t){const e=l[t];let n=r[f],u=r[f+1];i.defined(n)||(n=r[f]=new a.Cartesian4),i.defined(u)||(u=r[f+1]=new a.Cartesian4),a.Cartesian3.multiplyByScalar(e,-s,c),a.Cartesian3.add(o,c,c),n.x=e.x,n.y=e.y,n.z=e.z,n.w=-a.Cartesian3.dot(e,c),a.Cartesian3.multiplyByScalar(e,s,c),a.Cartesian3.add(o,c,c),u.x=-e.x,u.y=-e.y,u.z=-e.z,u.w=-a.Cartesian3.dot(a.Cartesian3.negate(e,h),c),f+=2}return e},u.prototype.computeVisibility=function(t){const a=this.planes;let n=!1;for(let i=0,r=a.length;i<r;++i){const r=t.intersectPlane(s.Plane.fromCartesian4(a[i],p));if(r===e.Intersect.OUTSIDE)return e.Intersect.OUTSIDE;r===e.Intersect.INTERSECTING&&(n=!0)}return n?e.Intersect.INTERSECTING:e.Intersect.INSIDE},u.prototype.computeVisibilityWithPlaneMask=function(t,a){if(a===u.MASK_OUTSIDE||a===u.MASK_INSIDE)return a;let n=u.MASK_INSIDE;const i=this.planes;for(let r=0,o=i.length;r<o;++r){const o=r<31?1<<r:0;if(r<31&&!(a&o))continue;const f=t.intersectPlane(s.Plane.fromCartesian4(i[r],p));if(f===e.Intersect.OUTSIDE)return u.MASK_OUTSIDE;f===e.Intersect.INTERSECTING&&(n|=o)}return n},u.MASK_OUTSIDE=4294967295,u.MASK_INSIDE=0,u.MASK_INDETERMINATE=2147483647,Object.defineProperties(d.prototype,{projectionMatrix:{get:function(){return m(this),this._orthographicMatrix}}});const C=new a.Cartesian3,_=new a.Cartesian3,y=new a.Cartesian3,g=new a.Cartesian3;function w(t){t=i.defaultValue(t,i.defaultValue.EMPTY_OBJECT),this._offCenterFrustum=new d,this.width=t.width,this._width=void 0,this.aspectRatio=t.aspectRatio,this._aspectRatio=void 0,this.near=i.defaultValue(t.near,1),this._near=this.near,this.far=i.defaultValue(t.far,5e8),this._far=this.far}function x(t){const e=t._offCenterFrustum;if(t.width!==t._width||t.aspectRatio!==t._aspectRatio||t.near!==t._near||t.far!==t._far){t._aspectRatio=t.aspectRatio,t._width=t.width,t._near=t.near,t._far=t.far;const a=1/t.aspectRatio;e.right=.5*t.width,e.left=-e.right,e.top=a*e.right,e.bottom=-e.top,e.near=t.near,e.far=t.far}}function v(t){t=i.defaultValue(t,i.defaultValue.EMPTY_OBJECT),this.left=t.left,this._left=void 0,this.right=t.right,this._right=void 0,this.top=t.top,this._top=void 0,this.bottom=t.bottom,this._bottom=void 0,this.near=i.defaultValue(t.near,1),this._near=this.near,this.far=i.defaultValue(t.far,5e8),this._far=this.far,this._cullingVolume=new u,this._perspectiveMatrix=new a.Matrix4,this._infinitePerspective=new a.Matrix4}function b(t){const e=t.top,n=t.bottom,i=t.right,r=t.left,o=t.near,s=t.far;e===t._top&&n===t._bottom&&r===t._left&&i===t._right&&o===t._near&&s===t._far||(t._left=r,t._right=i,t._top=e,t._bottom=n,t._near=o,t._far=s,t._perspectiveMatrix=a