bmh_cesium/public/lib/cesiumjs/CesiumUnminified/Workers/FrustumGeometry-d7fac608.js

2 lines
23 KiB
JavaScript
Raw Normal View History

2025-03-09 23:23:50 +00:00
/* 2020-9-22 15:23:25 | 版权所有 军懋国兴 */
define(["exports","./when-cbf8cd21","./Check-35e1a91d","./Math-69007a69","./Cartesian2-43e3a3be","./Transforms-2d1ac5ec","./ComponentDatatype-607c9a0c","./GeometryAttribute-2303bbfb","./GeometryAttributes-90846c5f","./Plane-46b5436f","./VertexFormat-fe64931e"],function(e,M,m,a,D,V,F,O,z,f,d){"use strict";function h(e){this.planes=M.defaultValue(e,[])}var p=[new D.Cartesian3,new D.Cartesian3,new D.Cartesian3];D.Cartesian3.clone(D.Cartesian3.UNIT_X,p[0]),D.Cartesian3.clone(D.Cartesian3.UNIT_Y,p[1]),D.Cartesian3.clone(D.Cartesian3.UNIT_Z,p[2]);var l=new D.Cartesian3,c=new D.Cartesian3,u=new f.Plane(new D.Cartesian3(1,0,0),0);function i(e){e=M.defaultValue(e,M.defaultValue.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.defaultValue(e.near,1),this._near=this.near,this.far=M.defaultValue(e.far,5e8),this._far=this.far,this._cullingVolume=new h,this._orthographicMatrix=new V.Matrix4}function s(e){if(!(M.defined(e.right)&&M.defined(e.left)&&M.defined(e.top)&&M.defined(e.bottom)&&M.defined(e.near)&&M.defined(e.far)))throw new m.DeveloperError("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 m.DeveloperError("right must be greater than left.");if(e.bottom>e.top)throw new m.DeveloperError("top must be greater than bottom.");if(e.near<=0||e.near>e.far)throw new m.DeveloperError("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=V.Matrix4.computeOrthographicOffCenter(e.left,e.right,e.bottom,e.top,e.near,e.far,e._orthographicMatrix)}}h.fromBoundingSphere=function(e,t){if(!M.defined(e))throw new m.DeveloperError("boundingSphere is required.");M.defined(t)||(t=new h);var r=p.length,a=t.planes;a.length=2*r;for(var i=e.center,n=e.radius,o=0,s=0;s<r;++s){var f=p[s],u=a[o],d=a[o+1];M.defined(u)||(u=a[o]=new V.Cartesian4),M.defined(d)||(d=a[o+1]=new V.Cartesian4),D.Cartesian3.multiplyByScalar(f,-n,l),D.Cartesian3.add(i,l,l),u.x=f.x,u.y=f.y,u.z=f.z,u.w=-D.Cartesian3.dot(f,l),D.Cartesian3.multiplyByScalar(f,n,l),D.Cartesian3.add(i,l,l),d.x=-f.x,d.y=-f.y,d.z=-f.z,d.w=-D.Cartesian3.dot(D.Cartesian3.negate(f,c),l),o+=2}return t},h.prototype.computeVisibility=function(e){if(!M.defined(e))throw new m.DeveloperError("boundingVolume is required.");for(var t=this.planes,r=!1,a=0,i=t.length;a<i;++a){var n=e.intersectPlane(f.Plane.fromCartesian4(t[a],u));if(n===V.Intersect.OUTSIDE)return V.Intersect.OUTSIDE;n===V.Intersect.INTERSECTING&&(r=!0)}return r?V.Intersect.INTERSECTING:V.Intersect.INSIDE},h.prototype.computeVisibilityWithPlaneMask=function(e,t){if(!M.defined(e))throw new m.DeveloperError("boundingVolume is required.");if(!M.defined(t))throw new m.DeveloperError("parentPlaneMask is required.");if(t===h.MASK_OUTSIDE||t===h.MASK_INSIDE)return t;for(var r=h.MASK_INSIDE,a=this.planes,i=0,n=a.length;i<n;++i){var o=i<31?1<<i:0;if(!(i<31&&0==(t&o))){var s=e.intersectPlane(f.Plane.fromCartesian4(a[i],u));if(s===V.Intersect.OUTSIDE)return h.MASK_OUTSIDE;s===V.Intersect.INTERSECTING&&(r|=o)}}return r},h.MASK_OUTSIDE=4294967295,h.MASK_INSIDE=0,h.MASK_INDETERMINATE=2147483647,Object.defineProperties(i.prototype,{projectionMatrix:{get:function(){return s(this),this._orthographicMatrix}}});var C=new D.Cartesian3,w=new D.Cartesian3,_=new D.Cartesian3,v=new D.Cartesian3;function y(e){e=M.defaultValue(e,M.defaultValue.EMPTY_OBJECT),this._offCenterFrustum=new i,this.width=e.width,this._width=void 0,this.aspectRatio=e.aspectRatio,this._aspectRatio=void 0,this.near=M.defaultValue(e.near,1),this._near=this.near,this.far=M.defaultValue(e.far,5e8),this._far=this.far}function n(e){if(!(M.defined(e.width)&&M.defined(e.aspectRatio)&&M.defined(e.near)&&M.defined(e.far)))throw new m.DeveloperError("width, aspectRatio, near, or far parameters are not set.");var t=e._offCenterFrustum;