YZProjectCloud/yanzhu-ui-vue3/public/Engine/Workers/FrustumGeometry-83050690.js

2 lines
19 KiB
JavaScript
Raw Normal View History

2025-04-07 00:55:58 +08:00
define(["exports","./Transforms-99272364","./Cartesian3-7e9cc2ff","./Matrix4-d34187af","./Check-741c5f3c","./ComponentDatatype-aaeec80f","./defaultValue-81eec7ed","./GeometryAttribute-088ad91d","./GeometryAttributes-32b29525","./Math-5f585871","./Plane-4f75b3df","./VertexFormat-d50a69ba"],(function(t,e,a,n,i,r,o,s,f,u,l,c){"use strict";function h(t){this.planes=o.defaultValue(t,[])}const p=[new a.Cartesian3,new a.Cartesian3,new a.Cartesian3];a.Cartesian3.clone(a.Cartesian3.UNIT_X,p[0]),a.Cartesian3.clone(a.Cartesian3.UNIT_Y,p[1]),a.Cartesian3.clone(a.Cartesian3.UNIT_Z,p[2]);const d=new a.Cartesian3,m=new a.Cartesian3,C=new l.Plane(new a.Cartesian3(1,0,0),0);function _(t){t=o.defaultValue(t,o.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=o.defaultValue(t.near,1),this._near=this.near,this.far=o.defaultValue(t.far,5e8),this._far=this.far,this._cullingVolume=new h,this._orthographicMatrix=new n.Matrix4}function y(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))}h.fromBoundingSphere=function(t,e){o.defined(e)||(e=new h);const i=p.length,r=e.planes;r.length=2*i;const s=t.center,f=t.radius;let u=0;for(let t=0;t<i;++t){const e=p[t];let i=r[u],l=r[u+1];o.defined(i)||(i=r[u]=new n.Cartesian4),o.defined(l)||(l=r[u+1]=new n.Cartesian4),a.Cartesian3.multiplyByScalar(e,-f,d),a.Cartesian3.add(s,d,d),i.x=e.x,i.y=e.y,i.z=e.z,i.w=-a.Cartesian3.dot(e,d),a.Cartesian3.multiplyByScalar(e,f,d),a.Cartesian3.add(s,d,d),l.x=-e.x,l.y=-e.y,l.z=-e.z,l.w=-a.Cartesian3.dot(a.Cartesian3.negate(e,m),d),u+=2}return e},h.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(l.Plane.fromCartesian4(a[i],C));if(r===e.Intersect.OUTSIDE)return e.Intersect.OUTSIDE;r===e.Intersect.INTERSECTING&&(n=!0)}return n?e.Intersect.INTERSECTING:e.Intersect.INSIDE},h.prototype.computeVisibilityWithPlaneMask=function(t,a){if(a===h.MASK_OUTSIDE||a===h.MASK_INSIDE)return a;let n=h.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(l.Plane.fromCartesian4(i[r],C));if(s===e.Intersect.OUTSIDE)return h.MASK_OUTSIDE;s===e.Intersect.INTERSECTING&&(n|=o)}return n},h.MASK_OUTSIDE=4294967295,h.MASK_INSIDE=0,h.MASK_INDETERMINATE=2147483647,Object.defineProperties(_.prototype,{projectionMatrix:{get:function(){return y(this),this._orthographicMatrix}}});const g=new a.Cartesian3,w=new a.Cartesian3,x=new a.Cartesian3,v=new a.Cartesian3;function M(t){t=o.defaultValue(t,o.defaultValue.EMPTY_OBJECT),this._offCenterFrustum=new _,this.width=t.width,this._width=void 0,this.aspectRatio=t.aspectRatio,this._aspectRatio=void 0,this.near=o.defaultValue(t.near,1),this._near=this.near,this.far=o.defaultValue(t.far,5e8),this._far=this.far}function b(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=o.defaultValue(t,o.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=o.defaultValue(t.near,1),this._near=this.near,this.far=o.defaultValue(t.far,5e8),this._far=this.far,this._cullingVolume=new h,this._perspectiveMatrix=new n.Matrix4,this._infinitePerspective=new n.Matrix4}function F(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._r