FrustumGeometry-643144da.js 21 KB

1
  1. define(["exports","./buildModuleUrl-3d15f25c","./Cartographic-67e73ef9","./Cartesian4-ad128b5d","./Check-52a7d806","./ComponentDatatype-81047f82","./when-92c6cf3c","./GeometryAttribute-ef657318","./GeometryAttributes-7f66ea53","./PrimitiveType-cdfe443e","./Math-92c3b5f7","./Intersect-b97e930a","./Plane-f8d22530","./VertexFormat-f496a3f1"],(function(t,e,r,i,n,o,a,s,f,h,u,p,l,c){"use strict";function m(t){this.planes=a.u(t,[])}var w=[new r.t,new r.t,new r.t];r.t.clone(r.t.UNIT_X,w[0]),r.t.clone(r.t.UNIT_Y,w[1]),r.t.clone(r.t.UNIT_Z,w[2]);var d=new r.t,_=new r.t,y=new l.o(new r.t(1,0,0),0);function g(t){t=a.u(t,a.u.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=a.u(t.near,1),this._near=this.near,this.far=a.u(t.far,5e8),this._far=this.far,this._cullingVolume=new m,this._orthographicMatrix=new h.y}function v(t){if(!(a.e(t.right)&&a.e(t.left)&&a.e(t.top)&&a.e(t.bottom)&&a.e(t.near)&&a.e(t.far)))throw new n.t("right, left, top, bottom, near, or far parameters are not set.");if(t.top!==t._top||t.bottom!==t._bottom||t.left!==t._left||t.right!==t._right||t.near!==t._near||t.far!==t._far){if(t.left>t.right)throw new n.t("right must be greater than left.");if(t.bottom>t.top)throw new n.t("top must be greater than bottom.");if(t.near<=0||t.near>t.far)throw new n.t("near must be greater than zero and less than 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=h.y.computeOrthographicOffCenter(t.left,t.right,t.bottom,t.top,t.near,t.far,t._orthographicMatrix)}}m.fromBoundingSphere=function(t,e){if(!a.e(t))throw new n.t("boundingSphere is required.");a.e(e)||(e=new m);var o=w.length,s=e.planes;s.length=2*o;for(var f=t.center,h=t.radius,u=0,p=0;p<o;++p){var l=w[p],c=s[u],y=s[u+1];a.e(c)||(c=s[u]=new i.e),a.e(y)||(y=s[u+1]=new i.e),r.t.multiplyByScalar(l,-h,d),r.t.add(f,d,d),c.x=l.x,c.y=l.y,c.z=l.z,c.w=-r.t.dot(l,d),r.t.multiplyByScalar(l,h,d),r.t.add(f,d,d),y.x=-l.x,y.y=-l.y,y.z=-l.z,y.w=-r.t.dot(r.t.negate(l,_),d),u+=2}return e},m.prototype.computeVisibility=function(t){if(!a.e(t))throw new n.t("boundingVolume is required.");for(var e=this.planes,r=!1,i=0,o=e.length;i<o;++i){var s=t.intersectPlane(l.o.fromCartesian4(e[i],y));if(s===p.S.OUTSIDE)return p.S.OUTSIDE;s===p.S.INTERSECTING&&(r=!0)}return r?p.S.INTERSECTING:p.S.INSIDE},m.prototype.computeVisibilityWithPlaneMask=function(t,e){if(!a.e(t))throw new n.t("boundingVolume is required.");if(!a.e(e))throw new n.t("parentPlaneMask is required.");if(e===m.MASK_OUTSIDE||e===m.MASK_INSIDE)return e;for(var r=m.MASK_INSIDE,i=this.planes,o=0,s=i.length;o<s;++o){var f=o<31?1<<o:0;if(!(o<31&&0==(e&f))){var h=t.intersectPlane(l.o.fromCartesian4(i[o],y));if(h===p.S.OUTSIDE)return m.MASK_OUTSIDE;h===p.S.INTERSECTING&&(r|=f)}}return r},m.MASK_OUTSIDE=4294967295,m.MASK_INSIDE=0,m.MASK_INDETERMINATE=2147483647,Object.defineProperties(g.prototype,{projectionMatrix:{get:function(){return v(this),this._orthographicMatrix}}});var b=new r.t,x=new r.t,z=new r.t,C=new r.t;function O(t){t=a.u(t,a.u.EMPTY_OBJECT),this._offCenterFrustum=new g,this.width=t.width,this._width=void 0,this.aspectRatio=t.aspectRatio,this._aspectRatio=void 0,this.near=a.u(t.near,1),this._near=this.near,this.far=a.u(t.far,5e8),this._far=this.far}function P(t){if(!(a.e(t.width)&&a.e(t.aspectRatio)&&a.e(t.near)&&a.e(t.far)))throw new n.t("width, aspectRatio, near, or far parameters are not set.");var e=t._offCenterFrustum;if(t.width!==t._width||t.aspectRatio!==t._aspectRatio||t.near!==t._near||t.far!==t._far){if(t.aspectRatio<0)throw new n.t("aspectRatio must be positive.");if(t.near<0||t.near>t.far)throw new n.t("near must be greater than zero and less than far.");t._aspectRatio=t.aspectRatio,t._width=t.width,t._near=t.near,t._far=t.far;var r=1/t.aspectRatio;e.right=.5*t.width,e.left=-e.right,e.top=r*e.right,e.bottom=-e.top,e.near=t.near,e.far=t.far}}function R(t){t=a.u(t,a.u.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=a.u(t.near,1),this._near=this.near,this.far=a.u(t.far,5e8),this._far=this.far,this._cullingVolume=new m,this._perspectiveMatrix=new h.y,this._infinitePerspective=new h.y}function E(t){if(!(a.e(t.right)&&a.e(t.left)&&a.e(t.top)&&a.e(t.bottom)&&a.e(t.near)&&a.e(t.far)))throw new n.t("right, left, top, bottom, near, or far parameters are not set.");var e=t.top,r=t.bottom,i=t.right,o=t.left,s=t.near,f=t.far;if(e!==t._top||r!==t._bottom||o!==t._left||i!==t._right||s!==t._near||f!==t._far){if(t.near<=0||t.near>t.far)throw new n.t("near must be greater than zero and less than far.");t._left=o,t._right=i,t._top=e,t._bottom=r,t._near=s,t._far=f,t._perspectiveMatrix=h.y.computePerspectiveOffCenter(o,i,r,e,s,f,t._perspectiveMatrix),t._infinitePerspective=h.y.computeInfinitePerspectiveOffCenter(o,i,r,e,s,t._infinitePerspective)}}g.prototype.computeCullingVolume=function(t,e,o){if(!a.e(t))throw new n.t("position is required.");if(!a.e(e))throw new n.t("direction is required.");if(!a.e(o))throw new n.t("up is required.");var s=this._cullingVolume.planes,f=this.top,h=this.bottom,u=this.right,p=this.left,l=this.near,c=this.far,m=r.t.cross(e,o,b);r.t.normalize(m,m);var w=x;r.t.multiplyByScalar(e,l,w),r.t.add(t,w,w);var d=z;r.t.multiplyByScalar(m,p,d),r.t.add(w,d,d);var _=s[0];return a.e(_)||(_=s[0]=new i.e),_.x=m.x,_.y=m.y,_.z=m.z,_.w=-r.t.dot(m,d),r.t.multiplyByScalar(m,u,d),r.t.add(w,d,d),_=s[1],a.e(_)||(_=s[1]=new i.e),_.x=-m.x,_.y=-m.y,_.z=-m.z,_.w=-r.t.dot(r.t.negate(m,C),d),r.t.multiplyByScalar(o,h,d),r.t.add(w,d,d),_=s[2],a.e(_)||(_=s[2]=new i.e),_.x=o.x,_.y=o.y,_.z=o.z,_.w=-r.t.dot(o,d),r.t.multiplyByScalar(o,f,d),r.t.add(w,d,d),_=s[3],a.e(_)||(_=s[3]=new i.e),_.x=-o.x,_.y=-o.y,_.z=-o.z,_.w=-r.t.dot(r.t.negate(o,C),d),_=s[4],a.e(_)||(_=s[4]=new i.e),_.x=e.x,_.y=e.y,_.z=e.z,_.w=-r.t.dot(e,w),r.t.multiplyByScalar(e,c,d),r.t.add(t,d,d),_=s[5],a.e(_)||(_=s[5]=new i.e),_.x=-e.x,_.y=-e.y,_.z=-e.z,_.w=-r.t.dot(r.t.negate(e,C),d),this._cullingVolume},g.prototype.getPixelDimensions=function(t,e,r,i,o){if(v(this),!a.e(t)||!a.e(e))throw new n.t("Both drawingBufferWidth and drawingBufferHeight are required.");if(t<=0)throw new n.t("drawingBufferWidth must be greater than zero.");if(e<=0)throw new n.t("drawingBufferHeight must be greater than zero.");if(!a.e(r))throw new n.t("distance is required.");if(!a.e(i))throw new n.t("pixelRatio is required.");if(i<=0)throw new n.t("pixelRatio must be greater than zero.");if(!a.e(o))throw new n.t("A result object is required.");var s=i*(this.right-this.left)/t,f=i*(this.top-this.bottom)/e;return o.x=s,o.y=f,o},g.prototype.clone=function(t){return a.e(t)||(t=new g),t.left=this.left,t.right=this.right,t.top=this.top,t.bottom=this.bottom,t.near=this.near,t.far=this.far,t._left=void 0,t._right=void 0,t._top=void 0,t._bottom=void 0,t._near=void 0,t._far=void 0,t},g.prototype.equals=function(t){return a.e(t)&&t instanceof g&&this.right===t.right&&this.left===t.left&&this.top===t.top&&this.bottom===t.bottom&&this.near===t.near&&this.far===t.far},g.prototype.equalsEpsilon=function(t,e,r){return t===this||a.e(t)&&t instanceof g&&u.e.equalsEpsilon(this.right,t.right,e,r)&&u.e.equalsEpsilon(this.left,t.left,e,r)&&u.e.equalsEpsilon(this.top,t.top,e,r)&&u.e.equalsEpsilon(this.bottom,t.bottom,e,r)&&u.e.equalsEpsilon(this.near,t.near,e,r)&&u.e.equalsEpsilon(this.far,t.far,e,r)},O.packedLength=4,O.pack=function(t,e,r){return n.o.typeOf.object("value",t),n.o.defined("array",e),r=a.u(r,0),e[r++]=t.width,e[r++]=t.aspectRatio,e[r++]=t.near,e[r]=t.far,e},O.unpack=function(t,e,r){return n.o.defined("array",t),e=a.u(e,0),a.e(r)||(r=new O),r.width=t[e++],r.aspectRatio=t[e++],r.near=t[e++],r.far=t[e],r},Object.defineProperties(O.prototype,{projectionMatrix:{get:function(){return P(this),this._offCenterFrustum.projectionMatrix}}}),O.prototype.computeCullingVolume=function(t,e,r){return P(this),this._offCenterFrustum.computeCullingVolume(t,e,r)},O.prototype.getPixelDimensions=function(t,e,r,i,n){return P(this),this._offCenterFrustum.getPixelDimensions(t,e,r,i,n)},O.prototype.clone=function(t){return a.e(t)||(t=new O),t.aspectRatio=this.aspectRatio,t.width=this.width,t.near=this.near,t.far=this.far,t._aspectRatio=void 0,t._width=void 0,t._near=void 0,t._far=void 0,this._offCenterFrustum.clone(t._offCenterFrustum),t},O.prototype.equals=function(t){return!!(a.e(t)&&t instanceof O)&&(P(this),P(t),this.width===t.width&&this.aspectRatio===t.aspectRatio&&this._offCenterFrustum.equals(t._offCenterFrustum))},O.prototype.equalsEpsilon=function(t,e,r){return!!(a.e(t)&&t instanceof O)&&(P(this),P(t),u.e.equalsEpsilon(this.width,t.width,e,r)&&u.e.equalsEpsilon(this.aspectRatio,t.aspectRatio,e,r)&&this._offCenterFrustum.equalsEpsilon(t._offCenterFrustum,e,r))},Object.defineProperties(R.prototype,{projectionMatrix:{get:function(){return E(this),this._perspectiveMatrix}},infiniteProjectionMatrix:{get:function(){return E(this),this._infinitePerspective}}});var M=new r.t,F=new r.t,S=new r.t,q=new r.t;function T(t){t=a.u(t,a.u.EMPTY_OBJECT),this._offCenterFrustum=new R,this.fov=t.fov,this._fov=void 0,this._fovy=void 0,this._sseDenominator=void 0,this.aspectRatio=t.aspectRatio,this._aspectRatio=void 0,this.near=a.u(t.near,1),this._near=this.near,this.far=a.u(t.far,5e8),this._far=this.far,this.xOffset=a.u(t.xOffset,0),this._xOffset=this.xOffset,this.yOffset=a.u(t.yOffset,0),this._yOffset=this.yOffset,this.reflect=!1}function k(t){if(!(a.e(t.fov)&&a.e(t.aspectRatio)&&a.e(t.near)&&a.e(t.far)))throw new n.t("fov, aspectRatio, near, or far parameters are not set.");var e=t._offCenterFrustum;if(t.fov!==t._fov||t.aspectRatio!==t._aspectRatio||t.near!==t._near||t.far!==t._far||t.xOffset!==t._xOffset||t.yOffset!==t._yOffset){if(t.fov<0||t.fov>=Math.PI)throw new n.t("fov must be in the range [0, PI).");if(t.aspectRatio<0)throw new n.t("aspectRatio must be positive.");if(t.near<0||t.near>t.far)throw new n.t("near must be greater than zero and less than far.");t._aspectRatio=t.aspectRatio,t._fov=t.fov,t._fovy=t.aspectRatio<=1?t.fov:2*Math.atan(Math.tan(.5*t.fov)/t.aspectRatio),t._near=t.near,t._far=t.far,t._sseDenominator=2*Math.tan(.5*t._fovy),t._xOffset=t.xOffset,t._yOffset=t.yOffset,e.top=t.near*Math.tan(.5*t._fovy),e.bottom=-e.top,e.right=t.aspectRatio*e.top,e.left=-e.right,e.near=t.near,e.far=t.far,e.right+=t.xOffset,e.left+=t.xOffset,e.top+=t.yOffset,e.bottom+=t.yOffset}}R.prototype.resetProjectionMatrix=function(){if(!(a.e(this.right)&&a.e(this.left)&&a.e(this.top)&&a.e(this.bottom)&&a.e(this.near)&&a.e(this.far)))throw new n.t("right, left, top, bottom, near, or far parameters are not set.");var t=this.top,e=this.bottom,r=this.right,i=this.left,o=this.near,s=this.far;if(this.near<=0||this.near>this.far)throw new n.t("near must be greater than zero and less than far.");this._left=i,this._right=r,this._top=t,this._bottom=e,this._near=o,this._far=s,this._perspectiveMatrix=h.y.computePerspectiveOffCenter(i,r,e,t,o,s,this._perspectiveMatrix),this._infinitePerspective=h.y.computeInfinitePerspectiveOffCenter(i,r,e,t,o,this._infinitePerspective)},R.prototype.computeCullingVolume=function(t,e,o,s){if(!a.e(t))throw new n.t("position is required.");if(!a.e(e))throw new n.t("direction is required.");if(!a.e(o))throw new n.t("up is required.");var f=this._cullingVolume.planes,h=a.u(s,0);h=Math.min(h,.5),h=Math.max(h,0);var u=this.top+this.top*h,p=this.bottom-this.top*h,l=this.right+this.right*h,c=this.left-this.right*h,m=this.near,w=this.far,d=r.t.cross(e,o,M),_=F;r.t.multiplyByScalar(e,m,_),r.t.add(t,_,_);var y=S;r.t.multiplyByScalar(e,w,y),r.t.add(t,y,y);var g=q;r.t.multiplyByScalar(d,c,g),r.t.add(_,g,g),r.t.subtract(g,t,g),r.t.normalize(g,g),r.t.cross(g,o,g),r.t.normalize(g,g);var v=f[0];return a.e(v)||(v=f[0]=new i.e),v.x=g.x,v.y=g.y,v.z=g.z,v.w=-r.t.dot(g,t),r.t.multiplyByScalar(d,l,g),r.t.add(_,g,g),r.t.subtract(g,t,g),r.t.cross(o,g,g),r.t.normalize(g,g),v=f[1],a.e(v)||(v=f[1]=new i.e),v.x=g.x,v.y=g.y,v.z=g.z,v.w=-r.t.dot(g,t),r.t.multiplyByScalar(o,p,g),r.t.add(_,g,g),r.t.subtract(g,t,g),r.t.cross(d,g,g),r.t.normalize(g,g),v=f[2],a.e(v)||(v=f[2]=new i.e),v.x=g.x,v.y=g.y,v.z=g.z,v.w=-r.t.dot(g,t),r.t.multiplyByScalar(o,u,g),r.t.add(_,g,g),r.t.subtract(g,t,g),r.t.cross(g,d,g),r.t.normalize(g,g),v=f[3],a.e(v)||(v=f[3]=new i.e),v.x=g.x,v.y=g.y,v.z=g.z,v.w=-r.t.dot(g,t),v=f[4],a.e(v)||(v=f[4]=new i.e),v.x=e.x,v.y=e.y,v.z=e.z,v.w=-r.t.dot(e,_),r.t.negate(e,g),v=f[5],a.e(v)||(v=f[5]=new i.e),v.x=g.x,v.y=g.y,v.z=g.z,v.w=-r.t.dot(g,y),this._cullingVolume},R.prototype.getPixelDimensions=function(t,e,r,i,o){if(E(this),!a.e(t)||!a.e(e))throw new n.t("Both drawingBufferWidth and drawingBufferHeight are required.");if(t<=0)throw new n.t("drawingBufferWidth must be greater than zero.");if(e<=0)throw new n.t("drawingBufferHeight must be greater than zero.");if(!a.e(r))throw new n.t("distance is required.");if(!a.e(i))throw new n.t("pixelRatio is required");if(i<=0)throw new n.t("pixelRatio must be greater than zero.");if(!a.e(o))throw new n.t("A result object is required.");var s=1/this.near,f=this.top*s,h=2*i*r*f/e,u=2*i*r*(f=this.right*s)/t;return o.x=u,o.y=h,o},R.prototype.clone=function(t){return a.e(t)||(t=new R),t.right=this.right,t.left=this.left,t.top=this.top,t.bottom=this.bottom,t.near=this.near,t.far=this.far,t._left=void 0,t._right=void 0,t._top=void 0,t._bottom=void 0,t._near=void 0,t._far=void 0,t},R.prototype.equals=function(t){return a.e(t)&&t instanceof R&&this.right===t.right&&this.left===t.left&&this.top===t.top&&this.bottom===t.bottom&&this.near===t.near&&this.far===t.far},R.prototype.equalsEpsilon=function(t,e,r){return t===this||a.e(t)&&t instanceof R&&u.e.equalsEpsilon(this.right,t.right,e,r)&&u.e.equalsEpsilon(this.left,t.left,e,r)&&u.e.equalsEpsilon(this.top,t.top,e,r)&&u.e.equalsEpsilon(this.bottom,t.bottom,e,r)&&u.e.equalsEpsilon(this.near,t.near,e,r)&&u.e.equalsEpsilon(this.far,t.far,e,r)},T.packedLength=6,T.pack=function(t,e,r){return n.o.typeOf.object("value",t),n.o.defined("array",e),r=a.u(r,0),e[r++]=t.fov,e[r++]=t.aspectRatio,e[r++]=t.near,e[r++]=t.far,e[r++]=t.xOffset,e[r]=t.yOffset,e},T.unpack=function(t,e,r){return n.o.defined("array",t),e=a.u(e,0),a.e(r)||(r=new T),r.fov=t[e++],r.aspectRatio=t[e++],r.near=t[e++],r.far=t[e++],r.xOffset=t[e++],r.yOffset=t[e],r},Object.defineProperties(T.prototype,{projectionMatrix:{get:function(){return k(this),this.reflect&&function(t){if(a.e(t.clipPlane)&&a.e(t.currentViewMatrix)){var e=t.currentViewMatrix,r=t._offCenterFrustum.projectionMatrix;h.y.multiplyByPlane(e,t.clipPlane,B),D.x=(u.e.sign(B.normal.x)+r[8])/r[0],D.y=(u.e.sign(B.normal.y)+r[9])/r[5],D.z=-1,D.w=(1+r[10])/r[14],I.x=B.normal.x,I.y=B.normal.y,I.z=B.normal.z,I.w=B.distance,i.e.multiplyByScalar(I,2/i.e.dot(I,D),A),r[2]=A.x,r[6]=A.y,r[10]=A.z+1,r[14]=A.w}}(this),this._offCenterFrustum.projectionMatrix}},infiniteProjectionMatrix:{get:function(){return k(this),this._offCenterFrustum.infiniteProjectionMatrix}},fovy:{get:function(){return k(this),this._fovy}},sseDenominator:{get:function(){return k(this),this._sseDenominator}}}),T.prototype.resetProjectionMatrix=function(){return this._offCenterFrustum.resetProjectionMatrix()},T.prototype.computeCullingVolume=function(t,e,r,i){return k(this),this._offCenterFrustum.computeCullingVolume(t,e,r,i)},T.prototype.getPixelDimensions=function(t,e,r,i,n){return k(this),this._offCenterFrustum.getPixelDimensions(t,e,r,i,n)},T.prototype.clone=function(t){return a.e(t)||(t=new T),t.aspectRatio=this.aspectRatio,t.fov=this.fov,t.near=this.near,t.far=this.far,t.reflect=this.reflect,t.clipPlane=this.clipPlane,t.currentViewMatrix=this.currentViewMatrix,t._aspectRatio=void 0,t._fov=void 0,t._near=void 0,t._far=void 0,this._offCenterFrustum.clone(t._offCenterFrustum),t},T.prototype.equals=function(t){return!!(a.e(t)&&t instanceof T)&&(k(this),k(t),this.fov===t.fov&&this.aspectRatio===t.aspectRatio&&this._offCenterFrustum.equals(t._offCenterFrustum))},T.prototype.equalsEpsilon=function(t,e,r){return!!(a.e(t)&&t instanceof T)&&(k(this),k(t),u.e.equalsEpsilon(this.fov,t.fov,e,r)&&u.e.equalsEpsilon(this.aspectRatio,t.aspectRatio,e,r)&&this._offCenterFrustum.equalsEpsilon(t._offCenterFrustum,e,r))};var B=new l.o(r.t.UNIT_Z,1),D=new i.e,I=new i.e,A=new i.e;function j(t){n.o.typeOf.object("options",t),n.o.typeOf.object("options.frustum",t.frustum),n.o.typeOf.object("options.origin",t.origin),n.o.typeOf.object("options.orientation",t.orientation);var e,i,o=t.frustum,f=t.orientation,h=t.origin,u=a.u(t.vertexFormat,c.n.DEFAULT),p=a.u(t._drawNearPlane,!0);o instanceof T?(e=0,i=T.packedLength):o instanceof O&&(e=1,i=O.packedLength),this._frustumType=e,this._frustum=o.clone(),this._origin=r.t.clone(h),this._orientation=s.n.clone(f),this._drawNearPlane=p,this._vertexFormat=u,this._workerName="createFrustumGeometry",this.packedLength=2+i+r.t.packedLength+s.n.packedLength+c.n.packedLength}j.pack=function(t,e,i){n.o.typeOf.object("value",t),n.o.defined("array",e),i=a.u(i,0);var o=t._frustumType,f=t._frustum;return e[i++]=o,0===o?(T.pack(f,e,i),i+=T.packedLength):(O.pack(f,e,i),i+=O.packedLength),r.t.pack(t._origin,e,i),i+=r.t.packedLength,s.n.pack(t._orientation,e,i),i+=s.n.packedLength,c.n.pack(t._vertexFormat,e,i),e[i+=c.n.packedLength]=t._drawNearPlane?1:0,e};var N=new T,L=new O,V=new s.n,U=new r.t,G=new c.n;function K(t,e,r,i,n,o,s,f){for(var h=t/3*2,u=0;u<4;++u)a.e(e)&&(e[t]=o.x,e[t+1]=o.y,e[t+2]=o.z),a.e(r)&&(r[t]=s.x,r[t+1]=s.y,r[t+2]=s.z),a.e(i)&&(i[t]=f.x,i[t+1]=f.y,i[t+2]=f.z),t+=3;n[h]=0,n[h+1]=0,n[h+2]=1,n[h+3]=0,n[h+4]=1,n[h+5]=1,n[h+6]=0,n[h+7]=1}j.unpack=function(t,e,i){n.o.defined("array",t),e=a.u(e,0);var o,f=t[e++];0===f?(o=T.unpack(t,e,N),e+=T.packedLength):(o=O.unpack(t,e,L),e+=O.packedLength);var h=r.t.unpack(t,e,U);e+=r.t.packedLength;var u=s.n.unpack(t,e,V);e+=s.n.packedLength;var p=c.n.unpack(t,e,G),l=1===t[e+=c.n.packedLength];if(!a.e(i))return new j({frustum:o,origin:h,orientation:u,vertexFormat:p,_drawNearPlane:l});var m=f===i._frustumType?i._frustum:void 0;return i._frustum=o.clone(m),i._frustumType=f,i._origin=r.t.clone(h,i._origin),i._orientation=s.n.clone(u,i._orientation),i._vertexFormat=c.n.clone(p,i._vertexFormat),i._drawNearPlane=l,i};var W=new h.p,Y=new h.y,H=new h.y,J=new r.t,Z=new r.t,Q=new r.t,X=new r.t,$=new r.t,tt=new r.t,et=new Array(3),rt=new Array(4);rt[0]=new i.e(-1,-1,1,1),rt[1]=new i.e(1,-1,1,1),rt[2]=new i.e(1,1,1,1),rt[3]=new i.e(-1,1,1,1);for(var it=new Array(4),nt=0;nt<4;++nt)it[nt]=new i.e;j._computeNearFarPlanes=function(t,e,n,o,s,f,u,p){var l=h.p.fromQuaternion(e,W),c=a.u(f,J),m=a.u(u,Z),w=a.u(p,Q);c=h.p.getColumn(l,0,c),m=h.p.getColumn(l,1,m),w=h.p.getColumn(l,2,w),r.t.normalize(c,c),r.t.normalize(m,m),r.t.normalize(w,w),r.t.negate(c,c);var d,_,y=h.y.computeView(t,w,m,c,Y);if(0===n){var g=o.projectionMatrix,v=h.y.multiply(g,y,H);_=h.y.inverse(v,H)}else d=h.y.inverseTransformation(y,H);a.e(_)?(et[0]=o.near,et[1]=o.far):(et[0]=0,et[1]=o.near,et[2]=o.far);for(var b=0;b<2;++b)for(var x=0;x<4;++x){var z=i.e.clone(rt[x],it[x]);if(a.e(_)){var C=1/(z=h.y.multiplyByVector(_,z,z)).w;r.t.multiplyByScalar(z,C,z),r.t.subtract(z,t,z),r.t.normalize(z,z);var O=r.t.dot(w,z);r.t.multiplyByScalar(z,et[b]/O,z),r.t.add(z,t,z)}else{a.e(o._offCenterFrustum)&&(o=o._offCenterFrustum);var P=et[b],R=et[b+1];z.x=.5*(z.x*(o.right-o.left)+o.left+o.right),z.y=.5*(z.y*(o.top-o.bottom)+o.bottom+o.top),z.z=.5*(z.z*(P-R)-P-R),z.w=1,h.y.multiplyByVector(d,z,z)}s[12*b+3*x]=z.x,s[12*b+3*x+1]=z.y,s[12*b+3*x+2]=z.z}},j.createGeometry=function(t){var i=t._frustumType,n=t._frustum,u=t._origin,p=t._orientation,l=t._drawNearPlane,c=t._vertexFormat,m=l?6:5,w=new Float64Array(72);j._computeNearFarPlanes(u,p,i,n,w);var d=24;w[d]=w[12],w[d+1]=w[13],w[d+2]=w[14],w[d+3]=w[0],w[d+4]=w[1],w[d+5]=w[2],w[d+6]=w[9],w[d+7]=w[10],w[d+8]=w[11],w[d+9]=w[21],w[d+10]=w[22],w[d+11]=w[23],w[d+=12]=w[15],w[d+1]=w[16],w[d+2]=w[17],w[d+3]=w[3],w[d+4]=w[4],w[d+5]=w[5],w[d+6]=w[0],w[d+7]=w[1],w[d+8]=w[2],w[d+9]=w[12],w[d+10]=w[13],w[d+11]=w[14],w[d+=12]=w[3],w[d+1]=w[4],w[d+2]=w[5],w[d+3]=w[15],w[d+4]=w[16],w[d+5]=w[17],w[d+6]=w[18],w[d+7]=w[19],w[d+8]=w[20],w[d+9]=w[6],w[d+10]=w[7],w[d+11]=w[8],w[d+=12]=w[6],w[d+1]=w[7],w[d+2]=w[8],w[d+3]=w[18],w[d+4]=w[19],w[d+5]=w[20],w[d+6]=w[21],w[d+7]=w[22],w[d+8]=w[23],w[d+9]=w[9],w[d+10]=w[10],w[d+11]=w[11],l||(w=w.subarray(12));var _=new f.a({position:new s.o({componentDatatype:o.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:w})});if(a.e(c.normal)||a.e(c.tangent)||a.e(c.bitangent)||a.e(c.st)){var y=a.e(c.normal)?new Float32Array(12*m):void 0,g=a.e(c.tangent)?new Float32Array(12*m):void 0,v=a.e(c.bitangent)?new Float32Array(12*m):void 0,b=a.e(c.st)?new Float32Array(8*m):void 0,x=J,z=Z,C=Q,O=r.t.negate(x,X),P=r.t.negate(z,$),R=r.t.negate(C,tt);d=0,l&&(K(d,y,g,v,b,R,x,z),d+=12),K(d,y,g,v,b,C,O,z),K(d+=12,y,g,v,b,O,R,z),K(d+=12,y,g,v,b,P,R,O),K(d+=12,y,g,v,b,x,C,z),K(d+=12,y,g,v,b,z,C,O),a.e(y)&&(_.normal=new s.o({componentDatatype:o.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:y})),a.e(g)&&(_.tangent=new s.o({componentDatatype:o.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:g})),a.e(v)&&(_.bitangent=new s.o({componentDatatype:o.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:v})),a.e(b)&&(_.st=new s.o({componentDatatype:o.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:b}))}for(var E=new Uint16Array(6*m),M=0;M<m;++M){var F=6*M,S=4*M;E[F]=S,E[F+1]=S+1,E[F+2]=S+2,E[F+3]=S,E[F+4]=S+2,E[F+5]=S+3}return new s.I({attributes:_,indices:E,primitiveType:h._0x29ba75.TRIANGLES,boundingSphere:e.i.fromVertices(w)})},t.a=O,t.o=T,t.z=j}));