2 lines
19 KiB
JavaScript
2 lines
19 KiB
JavaScript
|
define(["exports","./Transforms-20461479","./Matrix3-81054f0f","./Matrix2-413c4048","./ComponentDatatype-ab629b88","./defaultValue-f6d5e6da","./GeometryAttribute-b8117bde","./GeometryAttributes-1e4ddcd2","./Math-2ce22ee9","./Plane-6add0ae1","./VertexFormat-fbdec922"],(function(t,e,a,n,i,r,o,s,f,u,l){"use strict";function c(t){this.planes=r.defaultValue(t,[])}const h=[new a.Cartesian3,new a.Cartesian3,new a.Cartesian3];a.Cartesian3.clone(a.Cartesian3.UNIT_X,h[0]),a.Cartesian3.clone(a.Cartesian3.UNIT_Y,h[1]),a.Cartesian3.clone(a.Cartesian3.UNIT_Z,h[2]);const p=new a.Cartesian3,d=new a.Cartesian3,m=new u.Plane(new a.Cartesian3(1,0,0),0);function C(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 c,this._orthographicMatrix=new n.Matrix4}function _(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=n.Matrix4.computeOrthographicOffCenter(t.left,t.right,t.bottom,t.top,t.near,t.far,t._orthographicMatrix))}c.fromBoundingSphere=function(t,e){r.defined(e)||(e=new c);const i=h.length,o=e.planes;o.length=2*i;const s=t.center,f=t.radius;let u=0;for(let t=0;t<i;++t){const e=h[t];let i=o[u],l=o[u+1];r.defined(i)||(i=o[u]=new n.Cartesian4),r.defined(l)||(l=o[u+1]=new n.Cartesian4),a.Cartesian3.multiplyByScalar(e,-f,p),a.Cartesian3.add(s,p,p),i.x=e.x,i.y=e.y,i.z=e.z,i.w=-a.Cartesian3.dot(e,p),a.Cartesian3.multiplyByScalar(e,f,p),a.Cartesian3.add(s,p,p),l.x=-e.x,l.y=-e.y,l.z=-e.z,l.w=-a.Cartesian3.dot(a.Cartesian3.negate(e,d),p),u+=2}return e},c.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(u.Plane.fromCartesian4(a[i],m));if(r===e.Intersect.OUTSIDE)return e.Intersect.OUTSIDE;r===e.Intersect.INTERSECTING&&(n=!0)}return n?e.Intersect.INTERSECTING:e.Intersect.INSIDE},c.prototype.computeVisibilityWithPlaneMask=function(t,a){if(a===c.MASK_OUTSIDE||a===c.MASK_INSIDE)return a;let n=c.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(u.Plane.fromCartesian4(i[r],m));if(s===e.Intersect.OUTSIDE)return c.MASK_OUTSIDE;s===e.Intersect.INTERSECTING&&(n|=o)}return n},c.MASK_OUTSIDE=4294967295,c.MASK_INSIDE=0,c.MASK_INDETERMINATE=2147483647,Object.defineProperties(C.prototype,{projectionMatrix:{get:function(){return _(this),this._orthographicMatrix}}});const y=new a.Cartesian3,g=new a.Cartesian3,w=new a.Cartesian3,x=new a.Cartesian3;function v(t){t=r.defaultValue(t,r.defaultValue.EMPTY_OBJECT),this._offCenterFrustum=new C,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 M(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 c,this._perspectiveMatrix=new n.Matrix4,this._infinitePerspective=new n.Matrix4}function V(t){const e=t.top,a=t.bottom,i=t.right,r=t.left,o=t.near,s=t.far;e===t._top&&a===t._bottom&&r===t._left&&i===t._right&&o===t._near&&s===t._far||(t._left=r,t._right=i,t._top=e,t._botto
|