2 lines
19 KiB
JavaScript
2 lines
19 KiB
JavaScript
|
define(["exports","./Transforms-f15de320","./Matrix2-c6c16658","./RuntimeError-5b082e8f","./ComponentDatatype-3d0a0aac","./when-4bbc8319","./GeometryAttribute-8350368e","./GeometryAttributes-7827a6c2","./Plane-26e67b94","./VertexFormat-7b982b01"],(function(t,e,a,n,i,r,o,s,f,u){"use strict";function l(t){this.planes=r.defaultValue(t,[])}const c=[new a.Cartesian3,new a.Cartesian3,new a.Cartesian3];a.Cartesian3.clone(a.Cartesian3.UNIT_X,c[0]),a.Cartesian3.clone(a.Cartesian3.UNIT_Y,c[1]),a.Cartesian3.clone(a.Cartesian3.UNIT_Z,c[2]);const h=new a.Cartesian3,p=new a.Cartesian3,d=new f.Plane(new a.Cartesian3(1,0,0),0);function m(t){t=r.defaultValue(t,r.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=r.defaultValue(t.near,1),this._near=this.near,this.far=r.defaultValue(t.far,5e8),this._far=this.far,this._cullingVolume=new l,this._orthographicMatrix=new a.Matrix4}function C(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))}l.fromBoundingSphere=function(t,e){r.defined(e)||(e=new l);const n=c.length,i=e.planes;i.length=2*n;const o=t.center,s=t.radius;let f=0;for(let t=0;t<n;++t){const e=c[t];let n=i[f],u=i[f+1];r.defined(n)||(n=i[f]=new a.Cartesian4),r.defined(u)||(u=i[f+1]=new a.Cartesian4),a.Cartesian3.multiplyByScalar(e,-s,h),a.Cartesian3.add(o,h,h),n.x=e.x,n.y=e.y,n.z=e.z,n.w=-a.Cartesian3.dot(e,h),a.Cartesian3.multiplyByScalar(e,s,h),a.Cartesian3.add(o,h,h),u.x=-e.x,u.y=-e.y,u.z=-e.z,u.w=-a.Cartesian3.dot(a.Cartesian3.negate(e,p),h),f+=2}return e},l.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(f.Plane.fromCartesian4(a[i],d));if(r===e.Intersect.OUTSIDE)return e.Intersect.OUTSIDE;r===e.Intersect.INTERSECTING&&(n=!0)}return n?e.Intersect.INTERSECTING:e.Intersect.INSIDE},l.prototype.computeVisibilityWithPlaneMask=function(t,a){if(a===l.MASK_OUTSIDE||a===l.MASK_INSIDE)return a;let n=l.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&&0==(a&o))continue;const s=t.intersectPlane(f.Plane.fromCartesian4(i[r],d));if(s===e.Intersect.OUTSIDE)return l.MASK_OUTSIDE;s===e.Intersect.INTERSECTING&&(n|=o)}return n},l.MASK_OUTSIDE=4294967295,l.MASK_INSIDE=0,l.MASK_INDETERMINATE=2147483647,Object.defineProperties(m.prototype,{projectionMatrix:{get:function(){return C(this),this._orthographicMatrix}}});const _=new a.Cartesian3,y=new a.Cartesian3,g=new a.Cartesian3,w=new a.Cartesian3;function x(t){t=r.defaultValue(t,r.defaultValue.EMPTY_OBJECT),this._offCenterFrustum=new m,this.width=t.width,this._width=void 0,this.aspectRatio=t.aspectRatio,this._aspectRatio=void 0,this.near=r.defaultValue(t.near,1),this._near=this.near,this.far=r.defaultValue(t.far,5e8),this._far=this.far}function v(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 b(t){t=r.defaultValue(t,r.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=r.defaultValue(t.near,1),this._near=this.near,this.far=r.defaultValue(t.far,5e8),this._far=this.far,this._cullingVolume=new l,this._perspectiveMatrix=new a.Matrix4,this._infinitePerspective=new a.Matrix4}function M(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,
|