NONGYESHUZIDIZUO/public/Cesium/Workers/FrustumGeometry-372b2787.js

2 lines
21 KiB
JavaScript

define(["exports","./buildModuleUrl-d920237a","./Cartographic-1d953166","./Cartesian4-3408960c","./Check-2514d21d","./ComponentDatatype-07894a2b","./when-d186add7","./GeometryAttribute-95780fd1","./GeometryAttributes-9c67dd14","./FeatureDetection-4281d393","./Math-7f5f2992","./Plane-d9914d3c","./VertexFormat-769ac289"],(function(t,e,r,i,n,o,a,s,f,h,u,p,l){"use strict";function c(t){this.planes=a.u(t,[])}var m=[new r.t,new r.t,new r.t];r.t.clone(r.t.UNIT_X,m[0]),r.t.clone(r.t.UNIT_Y,m[1]),r.t.clone(r.t.UNIT_Z,m[2]);var w=new r.t,d=new r.t,_=new p.o(new r.t(1,0,0),0);function y(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 c,this._orthographicMatrix=new h.y}function g(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)}}c.fromBoundingSphere=function(t,e){if(!a.e(t))throw new n.t("boundingSphere is required.");a.e(e)||(e=new c);var o=m.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=m[p],_=s[u],y=s[u+1];a.e(_)||(_=s[u]=new i.e),a.e(y)||(y=s[u+1]=new i.e),r.t.multiplyByScalar(l,-h,w),r.t.add(f,w,w),_.x=l.x,_.y=l.y,_.z=l.z,_.w=-r.t.dot(l,w),r.t.multiplyByScalar(l,h,w),r.t.add(f,w,w),y.x=-l.x,y.y=-l.y,y.z=-l.z,y.w=-r.t.dot(r.t.negate(l,d),w),u+=2}return e},c.prototype.computeVisibility=function(t){if(!a.e(t))throw new n.t("boundingVolume is required.");for(var r=this.planes,i=!1,o=0,s=r.length;o<s;++o){var f=t.intersectPlane(p.o.fromCartesian4(r[o],_));if(f===e.S.OUTSIDE)return e.S.OUTSIDE;f===e.S.INTERSECTING&&(i=!0)}return i?e.S.INTERSECTING:e.S.INSIDE},c.prototype.computeVisibilityWithPlaneMask=function(t,r){if(!a.e(t))throw new n.t("boundingVolume is required.");if(!a.e(r))throw new n.t("parentPlaneMask is required.");if(r===c.MASK_OUTSIDE||r===c.MASK_INSIDE)return r;for(var i=c.MASK_INSIDE,o=this.planes,s=0,f=o.length;s<f;++s){var h=s<31?1<<s:0;if(!(s<31&&0==(r&h))){var u=t.intersectPlane(p.o.fromCartesian4(o[s],_));if(u===e.S.OUTSIDE)return c.MASK_OUTSIDE;u===e.S.INTERSECTING&&(i|=h)}}return i},c.MASK_OUTSIDE=4294967295,c.MASK_INSIDE=0,c.MASK_INDETERMINATE=2147483647,Object.defineProperties(y.prototype,{projectionMatrix:{get:function(){return g(this),this._orthographicMatrix}}});var v=new r.t,x=new r.t,b=new r.t,z=new r.t;function C(t){t=a.u(t,a.u.EMPTY_OBJECT),this._offCenterFrustum=new y,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 O(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 P(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 c,this._perspectiveMatrix=new h.y,this._infinitePerspective=new h.y}function R(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)}}y.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,v);r.t.normalize(m,m);var w=x;r.t.multiplyByScalar(e,l,w),r.t.add(t,w,w);var d=b;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,z),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,z),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,z),d),this._cullingVolume},y.prototype.getPixelDimensions=function(t,e,r,i,o){if(g(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},y.prototype.clone=function(t){return a.e(t)||(t=new y),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},y.prototype.equals=function(t){return a.e(t)&&t instanceof y&&this.right===t.right&&this.left===t.left&&this.top===t.top&&this.bottom===t.bottom&&this.near===t.near&&this.far===t.far},y.prototype.equalsEpsilon=function(t,e,r){return t===this||a.e(t)&&t instanceof y&&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)},C.packedLength=4,C.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},C.unpack=function(t,e,r){return n.o.defined("array",t),e=a.u(e,0),a.e(r)||(r=new C),r.width=t[e++],r.aspectRatio=t[e++],r.near=t[e++],r.far=t[e],r},Object.defineProperties(C.prototype,{projectionMatrix:{get:function(){return O(this),this._offCenterFrustum.projectionMatrix}}}),C.prototype.computeCullingVolume=function(t,e,r){return O(this),this._offCenterFrustum.computeCullingVolume(t,e,r)},C.prototype.getPixelDimensions=function(t,e,r,i,n){return O(this),this._offCenterFrustum.getPixelDimensions(t,e,r,i,n)},C.prototype.clone=function(t){return a.e(t)||(t=new C),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},C.prototype.equals=function(t){return!!(a.e(t)&&t instanceof C)&&(O(this),O(t),this.width===t.width&&this.aspectRatio===t.aspectRatio&&this._offCenterFrustum.equals(t._offCenterFrustum))},C.prototype.equalsEpsilon=function(t,e,r){return!!(a.e(t)&&t instanceof C)&&(O(this),O(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(P.prototype,{projectionMatrix:{get:function(){return R(this),this._perspectiveMatrix}},infiniteProjectionMatrix:{get:function(){return R(this),this._infinitePerspective}}});var E=new r.t,M=new r.t,F=new r.t,S=new r.t;function q(t){t=a.u(t,a.u.EMPTY_OBJECT),this._offCenterFrustum=new P,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 T(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}}P.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)},P.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,E),_=M;r.t.multiplyByScalar(e,m,_),r.t.add(t,_,_);var y=F;r.t.multiplyByScalar(e,w,y),r.t.add(t,y,y);var g=S;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},P.prototype.getPixelDimensions=function(t,e,r,i,o){if(R(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},P.prototype.clone=function(t){return a.e(t)||(t=new P),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},P.prototype.equals=function(t){return a.e(t)&&t instanceof P&&this.right===t.right&&this.left===t.left&&this.top===t.top&&this.bottom===t.bottom&&this.near===t.near&&this.far===t.far},P.prototype.equalsEpsilon=function(t,e,r){return t===this||a.e(t)&&t instanceof P&&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)},q.packedLength=6,q.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},q.unpack=function(t,e,r){return n.o.defined("array",t),e=a.u(e,0),a.e(r)||(r=new q),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(q.prototype,{projectionMatrix:{get:function(){return T(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,k),B.x=(u.e.sign(k.normal.x)+r[8])/r[0],B.y=(u.e.sign(k.normal.y)+r[9])/r[5],B.z=-1,B.w=(1+r[10])/r[14],D.x=k.normal.x,D.y=k.normal.y,D.z=k.normal.z,D.w=k.distance,i.e.multiplyByScalar(D,2/i.e.dot(D,B),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 T(this),this._offCenterFrustum.infiniteProjectionMatrix}},fovy:{get:function(){return T(this),this._fovy}},sseDenominator:{get:function(){return T(this),this._sseDenominator}}}),q.prototype.resetProjectionMatrix=function(){return this._offCenterFrustum.resetProjectionMatrix()},q.prototype.computeCullingVolume=function(t,e,r,i){return T(this),this._offCenterFrustum.computeCullingVolume(t,e,r,i)},q.prototype.getPixelDimensions=function(t,e,r,i,n){return T(this),this._offCenterFrustum.getPixelDimensions(t,e,r,i,n)},q.prototype.clone=function(t){return a.e(t)||(t=new q),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},q.prototype.equals=function(t){return!!(a.e(t)&&t instanceof q)&&(T(this),T(t),this.fov===t.fov&&this.aspectRatio===t.aspectRatio&&this._offCenterFrustum.equals(t._offCenterFrustum))},q.prototype.equalsEpsilon=function(t,e,r){return!!(a.e(t)&&t instanceof q)&&(T(this),T(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 k=new p.o(r.t.UNIT_Z,1),B=new i.e,D=new i.e,A=new i.e;function I(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,l.n.DEFAULT),p=a.u(t._drawNearPlane,!0);o instanceof q?(e=0,i=q.packedLength):o instanceof C&&(e=1,i=C.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+l.n.packedLength}I.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?(q.pack(f,e,i),i+=q.packedLength):(C.pack(f,e,i),i+=C.packedLength),r.t.pack(t._origin,e,i),i+=r.t.packedLength,s.n.pack(t._orientation,e,i),i+=s.n.packedLength,l.n.pack(t._vertexFormat,e,i),e[i+=l.n.packedLength]=t._drawNearPlane?1:0,e};var j=new q,N=new C,L=new s.n,V=new r.t,U=new l.n;function G(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}I.unpack=function(t,e,i){n.o.defined("array",t),e=a.u(e,0);var o,f=t[e++];0===f?(o=q.unpack(t,e,j),e+=q.packedLength):(o=C.unpack(t,e,N),e+=C.packedLength);var h=r.t.unpack(t,e,V);e+=r.t.packedLength;var u=s.n.unpack(t,e,L);e+=s.n.packedLength;var p=l.n.unpack(t,e,U),c=1===t[e+=l.n.packedLength];if(!a.e(i))return new I({frustum:o,origin:h,orientation:u,vertexFormat:p,_drawNearPlane:c});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=l.n.clone(p,i._vertexFormat),i._drawNearPlane=c,i};var K=new h.p,W=new h.y,Y=new h.y,H=new r.t,J=new r.t,Z=new r.t,Q=new r.t,X=new r.t,$=new r.t,tt=new Array(3),et=new Array(4);et[0]=new i.e(-1,-1,1,1),et[1]=new i.e(1,-1,1,1),et[2]=new i.e(1,1,1,1),et[3]=new i.e(-1,1,1,1);for(var rt=new Array(4),it=0;it<4;++it)rt[it]=new i.e;I._computeNearFarPlanes=function(t,e,n,o,s,f,u,p){var l=h.p.fromQuaternion(e,K),c=a.u(f,H),m=a.u(u,J),w=a.u(p,Z);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,W);if(0===n){var g=o.projectionMatrix,v=h.y.multiply(g,y,Y);_=h.y.inverse(v,Y)}else d=h.y.inverseTransformation(y,Y);a.e(_)?(tt[0]=o.near,tt[1]=o.far):(tt[0]=0,tt[1]=o.near,tt[2]=o.far);for(var x=0;x<2;++x)for(var b=0;b<4;++b){var z=i.e.clone(et[b],rt[b]);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,tt[x]/O,z),r.t.add(z,t,z)}else{a.e(o._offCenterFrustum)&&(o=o._offCenterFrustum);var P=tt[x],R=tt[x+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*x+3*b]=z.x,s[12*x+3*b+1]=z.y,s[12*x+3*b+2]=z.z}},I.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);I._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,x=a.e(c.st)?new Float32Array(8*m):void 0,b=H,z=J,C=Z,O=r.t.negate(b,Q),P=r.t.negate(z,X),R=r.t.negate(C,$);d=0,l&&(G(d,y,g,v,x,R,b,z),d+=12),G(d,y,g,v,x,C,O,z),G(d+=12,y,g,v,x,O,R,z),G(d+=12,y,g,v,x,P,R,O),G(d+=12,y,g,v,x,b,C,z),G(d+=12,y,g,v,x,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(x)&&(_.st=new s.o({componentDatatype:o.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:x}))}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._0x12cc5d.TRIANGLES,boundingSphere:e.i.fromVertices(w)})},t.a=C,t.o=q,t.z=I}));