@galacean/engine-math 0.0.0-experimental-animator-additive.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +1 -0
- package/dist/browser.js +4847 -0
- package/dist/browser.min.js +1 -0
- package/dist/main.js +4860 -0
- package/dist/main.js.map +1 -0
- package/dist/miniprogram.js +4859 -0
- package/dist/module.js +4841 -0
- package/dist/module.js.map +1 -0
- package/package.json +21 -0
- package/types/BoundingBox.d.ts +91 -0
- package/types/BoundingFrustum.d.ts +63 -0
- package/types/BoundingSphere.d.ts +43 -0
- package/types/CollisionUtil.d.ts +115 -0
- package/types/Color.d.ts +150 -0
- package/types/IClone.d.ts +10 -0
- package/types/ICopy.d.ts +10 -0
- package/types/MathUtil.d.ts +45 -0
- package/types/Matrix.d.ts +298 -0
- package/types/Matrix3x3.d.ts +228 -0
- package/types/Plane.d.ts +48 -0
- package/types/Quaternion.d.ts +327 -0
- package/types/Ray.d.ts +44 -0
- package/types/Rect.d.ts +40 -0
- package/types/SphericalHarmonics3.d.ts +56 -0
- package/types/Vector2.d.ts +213 -0
- package/types/Vector3.d.ts +316 -0
- package/types/Vector4.d.ts +247 -0
- package/types/enums/ContainmentType.d.ts +11 -0
- package/types/enums/FrustumFace.d.ts +17 -0
- package/types/enums/PlaneIntersectionType.d.ts +11 -0
- package/types/index.d.ts +19 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@swc/helpers/_/_create_class")):"function"==typeof define&&define.amd?define(["exports","@swc/helpers/_/_create_class"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self)["@oasisEngine/math"]={},t._create_class)}(this,function(t,n){"use strict";t.ContainmentType=void 0,(e=t.ContainmentType||(t.ContainmentType={}))[e.Disjoint=0]="Disjoint",e[e.Contains=1]="Contains",e[e.Intersects=2]="Intersects",t.PlaneIntersectionType=void 0,(i=t.PlaneIntersectionType||(t.PlaneIntersectionType={}))[i.Back=0]="Back",i[i.Front=1]="Front",i[i.Intersecting=2]="Intersecting",t.FrustumFace=void 0,(a=t.FrustumFace||(t.FrustumFace={}))[a.Near=0]="Near",a[a.Far=1]="Far",a[a.Left=2]="Left",a[a.Right=3]="Right",a[a.Bottom=4]="Bottom",a[a.Top=5]="Top";var e,i,a,_=function(){function t(){}return t.clamp=function(t,n,e){return Math.max(n,Math.min(e,t))},t.equals=function(n,e){return Math.abs(n-e)<=t.zeroTolerance},t.isPowerOf2=function(t){return(t&t-1)==0},t.radianToDegree=function(n){return n*t.radToDegreeFactor},t.degreeToRadian=function(n){return n*t.degreeToRadFactor},t}();_.zeroTolerance=1e-6,_.radToDegreeFactor=180/Math.PI,_.degreeToRadFactor=Math.PI/180;var r=function(){function t(t,n,e){void 0===t&&(t=0),void 0===n&&(n=0),void 0===e&&(e=0),this._onValueChanged=null,this._x=t,this._y=n,this._z=e}var e=t.prototype;return e.set=function(t,n,e){return this._x=t,this._y=n,this._z=e,this._onValueChanged&&this._onValueChanged(),this},e.add=function(t){return this._x+=t._x,this._y+=t._y,this._z+=t._z,this._onValueChanged&&this._onValueChanged(),this},e.subtract=function(t){return this._x-=t._x,this._y-=t._y,this._z-=t._z,this._onValueChanged&&this._onValueChanged(),this},e.multiply=function(t){return this._x*=t._x,this._y*=t._y,this._z*=t._z,this._onValueChanged&&this._onValueChanged(),this},e.divide=function(t){return this._x/=t._x,this._y/=t._y,this._z/=t._z,this._onValueChanged&&this._onValueChanged(),this},e.length=function(){var t=this._x,n=this._y,e=this._z;return Math.sqrt(t*t+n*n+e*e)},e.lengthSquared=function(){var t=this._x,n=this._y,e=this._z;return t*t+n*n+e*e},e.negate=function(){return this._x=-this._x,this._y=-this._y,this._z=-this._z,this._onValueChanged&&this._onValueChanged(),this},e.normalize=function(){return t.normalize(this,this),this},e.scale=function(t){return this._x*=t,this._y*=t,this._z*=t,this._onValueChanged&&this._onValueChanged(),this},e.transformNormal=function(n){return t.transformNormal(this,n,this),this},e.transformToVec3=function(n){return t.transformToVec3(this,n,this),this},e.transformCoordinate=function(n){return t.transformCoordinate(this,n,this),this},e.transformByQuat=function(n){return t.transformByQuat(this,n,this),this},e.clone=function(){return new t(this._x,this._y,this._z)},e.copyFrom=function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._onValueChanged&&this._onValueChanged(),this},e.copyFromArray=function(t,n){return void 0===n&&(n=0),this._x=t[n],this._y=t[n+1],this._z=t[n+2],this._onValueChanged&&this._onValueChanged(),this},e.copyToArray=function(t,n){void 0===n&&(n=0),t[n]=this._x,t[n+1]=this._y,t[n+2]=this._z},e.toJSON=function(){return{x:this._x,y:this._y,z:this._z}},t.add=function(t,n,e){e._x=t._x+n._x,e._y=t._y+n._y,e._z=t._z+n._z,e._onValueChanged&&e._onValueChanged()},t.subtract=function(t,n,e){e._x=t._x-n._x,e._y=t._y-n._y,e._z=t._z-n._z,e._onValueChanged&&e._onValueChanged()},t.multiply=function(t,n,e){e._x=t._x*n._x,e._y=t._y*n._y,e._z=t._z*n._z,e._onValueChanged&&e._onValueChanged()},t.divide=function(t,n,e){e._x=t._x/n._x,e._y=t._y/n._y,e._z=t._z/n._z,e._onValueChanged&&e._onValueChanged()},t.dot=function(t,n){return t._x*n._x+t._y*n._y+t._z*n._z},t.cross=function(t,n,e){var i=t._x,a=t._y,_=t._z,r=n._x,s=n._y,o=n._z;e.set(a*o-_*s,_*r-i*o,i*s-a*r)},t.distance=function(t,n){var e=n._x-t._x,i=n._y-t._y,a=n._z-t._z;return Math.sqrt(e*e+i*i+a*a)},t.distanceSquared=function(t,n){var e=n._x-t._x,i=n._y-t._y,a=n._z-t._z;return e*e+i*i+a*a},t.equals=function(t,n){return _.equals(t._x,n._x)&&_.equals(t._y,n._y)&&_.equals(t._z,n._z)},t.lerp=function(t,n,e,i){var a=t._x,_=t._y,r=t._z;i._x=a+(n._x-a)*e,i._y=_+(n._y-_)*e,i._z=r+(n._z-r)*e,i._onValueChanged&&i._onValueChanged()},t.max=function(t,n,e){e._x=Math.max(t._x,n._x),e._y=Math.max(t._y,n._y),e._z=Math.max(t._z,n._z),e._onValueChanged&&e._onValueChanged()},t.min=function(t,n,e){e._x=Math.min(t._x,n._x),e._y=Math.min(t._y,n._y),e._z=Math.min(t._z,n._z),e._onValueChanged&&e._onValueChanged()},t.negate=function(t,n){n._x=-t._x,n._y=-t._y,n._z=-t._z,n._onValueChanged&&n._onValueChanged()},t.normalize=function(t,n){var e=t._x,i=t._y,a=t._z,r=Math.sqrt(e*e+i*i+a*a);r>_.zeroTolerance&&(r=1/r,n.set(e*r,i*r,a*r))},t.scale=function(t,n,e){e._x=t._x*n,e._y=t._y*n,e._z=t._z*n,e._onValueChanged&&e._onValueChanged()},t.transformNormal=function(t,n,e){var i=t._x,a=t._y,_=t._z,r=n.elements;e._x=i*r[0]+a*r[4]+_*r[8],e._y=i*r[1]+a*r[5]+_*r[9],e._z=i*r[2]+a*r[6]+_*r[10],e._onValueChanged&&e._onValueChanged()},t.transformToVec3=function(t,n,e){var i=t._x,a=t._y,_=t._z,r=n.elements;e._x=i*r[0]+a*r[4]+_*r[8]+r[12],e._y=i*r[1]+a*r[5]+_*r[9]+r[13],e._z=i*r[2]+a*r[6]+_*r[10]+r[14],e._onValueChanged&&e._onValueChanged()},t.transformToVec4=function(t,n,e){var i=t._x,a=t._y,_=t._z,r=n.elements;e._x=i*r[0]+a*r[4]+_*r[8]+r[12],e._y=i*r[1]+a*r[5]+_*r[9]+r[13],e._z=i*r[2]+a*r[6]+_*r[10]+r[14],e._w=i*r[3]+a*r[7]+_*r[11]+r[15],e._onValueChanged&&e._onValueChanged()},t.transformCoordinate=function(t,n,e){var i=t._x,a=t._y,_=t._z,r=n.elements,s=i*r[3]+a*r[7]+_*r[11]+r[15];s=1/s,e._x=(i*r[0]+a*r[4]+_*r[8]+r[12])*s,e._y=(i*r[1]+a*r[5]+_*r[9]+r[13])*s,e._z=(i*r[2]+a*r[6]+_*r[10]+r[14])*s,e._onValueChanged&&e._onValueChanged()},t.transformByQuat=function(t,n,e){var i=t._x,a=t._y,_=t._z,r=n._x,s=n._y,o=n._z,h=n._w,u=h*i+s*_-o*a,c=h*a+o*i-r*_,l=h*_+r*a-s*i,y=-r*i-s*a-o*_;e._x=u*h-y*r-c*o+l*s,e._y=c*h-y*s-l*r+u*o,e._z=l*h-y*o-u*s+c*r,e._onValueChanged&&e._onValueChanged()},n._(t,[{key:"x",get:function(){return this._x},set:function(t){this._x=t,this._onValueChanged&&this._onValueChanged()}},{key:"y",get:function(){return this._y},set:function(t){this._y=t,this._onValueChanged&&this._onValueChanged()}},{key:"z",get:function(){return this._z},set:function(t){this._z=t,this._onValueChanged&&this._onValueChanged()}}]),t}();r._zero=new r(0,0,0),r._one=new r(1,1,1);var s=function(){function t(t,n){void 0===t&&(t=null),void 0===n&&(n=0),this.center=new r,this.radius=0,t&&this.center.copyFrom(t),this.radius=n}var n=t.prototype;return n.clone=function(){return new t(this.center,this.radius)},n.copyFrom=function(t){return this.center.copyFrom(t.center),this.radius=t.radius,this},t.fromPoints=function(n,e){if(!n||0===n.length)throw Error("points must be array and length must > 0");var i=n.length,a=t._tempVec30;a.x=a.y=a.z=0;for(var _=0;_<i;++_)r.add(n[_],a,a);r.scale(a,1/i,e.center);for(var s=0,o=0;o<i;++o){var h=r.distanceSquared(a,n[o]);h>s&&(s=h)}e.radius=Math.sqrt(s)},t.fromBox=function(t,n){var e=n.center,i=t.min,a=t.max;e.x=(i.x+a.x)*.5,e.y=(i.y+a.y)*.5,e.z=(i.z+a.z)*.5,n.radius=r.distance(e,a)},t}();s._tempVec30=new r;var o=function(){function t(t,n){void 0===t&&(t=null),void 0===n&&(n=null),this.min=new r,this.max=new r,t&&this.min.copyFrom(t),n&&this.max.copyFrom(n)}var n=t.prototype;return n.getCenter=function(t){return r.add(this.min,this.max,t),r.scale(t,.5,t),t},n.getExtent=function(t){return r.subtract(this.max,this.min,t),r.scale(t,.5,t),t},n.getCorners=function(t){void 0===t&&(t=[]);var n=this.min,e=this.max,i=n.x,a=n.y,_=n.z,s=e.x,o=e.y,h=e.z,u=t.length;if(u<8)for(var c=0,l=8-u;c<l;++c)t[u+c]=new r;return t[0].set(i,o,h),t[1].set(s,o,h),t[2].set(s,a,h),t[3].set(i,a,h),t[4].set(i,o,_),t[5].set(s,o,_),t[6].set(s,a,_),t[7].set(i,a,_),t},n.transform=function(n){return t.transform(this,n,this),this},n.clone=function(){return new t(this.min,this.max)},n.copyFrom=function(t){return this.min.copyFrom(t.min),this.max.copyFrom(t.max),this},t.fromCenterAndExtent=function(t,n,e){r.subtract(t,n,e.min),r.add(t,n,e.max)},t.fromPoints=function(t,n){if(!t||0===t.length)throw Error("points must be array and length must > 0");var e=n.min,i=n.max;e.x=e.y=e.z=Number.MAX_VALUE,i.x=i.y=i.z=-Number.MAX_VALUE;for(var a=0,_=t.length;a<_;++a){var s=t[a];r.min(e,s,e),r.max(i,s,i)}},t.fromSphere=function(t,n){var e=t.center,i=t.radius,a=n.min,_=n.max;a.x=e.x-i,a.y=e.y-i,a.z=e.z-i,_.x=e.x+i,_.y=e.y+i,_.z=e.z+i},t.transform=function(n,e,i){var a=t._tempVec30,_=t._tempVec31;n.getCenter(a),n.getExtent(_),r.transformCoordinate(a,e,a);var s=_.x,o=_.y,h=_.z,u=e.elements;_.x=Math.abs(s*u[0])+Math.abs(o*u[4])+Math.abs(h*u[8]),_.y=Math.abs(s*u[1])+Math.abs(o*u[5])+Math.abs(h*u[9]),_.z=Math.abs(s*u[2])+Math.abs(o*u[6])+Math.abs(h*u[10]),r.subtract(a,_,i.min),r.add(a,_,i.max)},t.merge=function(t,n,e){return r.min(t.min,n.min,e.min),r.max(t.max,n.max,e.max),e},t}();o._tempVec30=new r,o._tempVec31=new r;var h=function(){function n(){}return n.intersectionPointThreePlanes=function(t,e,i,a){var _=t.normal,s=e.normal,o=i.normal;r.cross(s,o,n._tempVec30),r.cross(o,_,n._tempVec31),r.cross(_,s,n._tempVec32);var h=-r.dot(_,n._tempVec30),u=-r.dot(s,n._tempVec31),c=-r.dot(o,n._tempVec32);r.scale(n._tempVec30,t.distance/h,n._tempVec30),r.scale(n._tempVec31,e.distance/u,n._tempVec31),r.scale(n._tempVec32,i.distance/c,n._tempVec32),r.add(n._tempVec30,n._tempVec31,a),r.add(a,n._tempVec32,a)},n.distancePlaneAndPoint=function(t,n){return r.dot(t.normal,n)+t.distance},n.intersectsPlaneAndPoint=function(e,i){var a=n.distancePlaneAndPoint(e,i);return a>0?t.PlaneIntersectionType.Front:a<0?t.PlaneIntersectionType.Back:t.PlaneIntersectionType.Intersecting},n.intersectsPlaneAndBox=function(e,i){var a=i.min,_=i.max,r=e.normal,s=n._tempVec30,o=n._tempVec31;return(r.x>=0?(s.x=_.x,o.x=a.x):(s.x=a.x,o.x=_.x),r.y>=0?(s.y=_.y,o.y=a.y):(s.y=a.y,o.y=_.y),r.z>=0?(s.z=_.z,o.z=a.z):(s.z=a.z,o.z=_.z),0>n.distancePlaneAndPoint(e,s))?t.PlaneIntersectionType.Back:n.distancePlaneAndPoint(e,o)>0?t.PlaneIntersectionType.Front:t.PlaneIntersectionType.Intersecting},n.intersectsPlaneAndSphere=function(e,i){var a=i.center,_=i.radius,r=n.distancePlaneAndPoint(e,a);return r>_?t.PlaneIntersectionType.Front:r<-_?t.PlaneIntersectionType.Back:t.PlaneIntersectionType.Intersecting},n.intersectsRayAndPlane=function(t,n){var e=n.normal,i=_.zeroTolerance,a=r.dot(e,t.direction);if(Math.abs(a)<i)return -1;var s=r.dot(e,t.origin),o=(-n.distance-s)/a;if(o<0){if(o<-i)return -1;o=0}return o},n.intersectsRayAndBox=function(t,n){var e=_.zeroTolerance,i=t.origin,a=t.direction,r=n.min,s=n.max,o=a.x,h=a.y,u=a.z,c=i.x,l=i.y,y=i.z,d=0,f=Number.MAX_VALUE;if(Math.abs(o)<e){if(c<r.x||c>s.x)return -1}else{var m=1/o,x=(r.x-c)*m,g=(s.x-c)*m;if(x>g){var z=x;x=g,g=z}if((d=Math.max(x,d))>(f=Math.min(g,f)))return -1}if(Math.abs(h)<e){if(l<r.y||l>s.y)return -1}else{var V=1/h,v=(r.y-l)*V,C=(s.y-l)*V;if(v>C){var p=v;v=C,C=p}if((d=Math.max(v,d))>(f=Math.min(C,f)))return -1}if(Math.abs(u)<e){if(y<r.z||y>s.z)return -1}else{var w=1/u,M=(r.z-y)*w,q=(s.z-y)*w;if(M>q){var b=M;M=q,q=b}if((d=Math.max(M,d))>(f=Math.min(q,f)))return -1}return d},n.intersectsRayAndSphere=function(t,e){var i=t.origin,a=t.direction,_=e.center,s=e.radius,o=n._tempVec30;r.subtract(i,_,o);var h=r.dot(o,a),u=r.dot(o,o)-s*s;if(h>0&&u>0)return -1;var c=h*h-u;if(c<0)return -1;var l=-h-Math.sqrt(c);return l<0&&(l=0),l},n.intersectsBoxAndBox=function(t,n){return!(t.min.x>n.max.x)&&!(n.min.x>t.max.x)&&!(t.min.y>n.max.y)&&!(n.min.y>t.max.y)&&!(t.min.z>n.max.z||n.min.z>t.max.z)},n.intersectsSphereAndSphere=function(t,n){var e=t.radius+n.radius;return r.distanceSquared(t.center,n.center)<e*e},n.intersectsSphereAndBox=function(t,e){var i=t.center,a=e.max,_=e.min,s=n._tempVec30;return s.set(Math.max(_.x,Math.min(i.x,a.x)),Math.max(_.y,Math.min(i.y,a.y)),Math.max(_.z,Math.min(i.z,a.z))),r.distanceSquared(i,s)<=t.radius*t.radius},n.intersectsFrustumAndBox=function(t,e){for(var i=e.min,a=e.max,_=n._tempVec30,s=0;s<6;++s){var o=t.getPlane(s),h=o.normal;if(_.set(h.x>=0?a.x:i.x,h.y>=0?a.y:i.y,h.z>=0?a.z:i.z),r.dot(h,_)<-o.distance)return!1}return!0},n.frustumContainsBox=function(e,i){for(var a=i.min,_=i.max,r=n._tempVec30,s=n._tempVec31,o=t.ContainmentType.Contains,h=0;h<6;++h){var u=e.getPlane(h),c=u.normal;if(c.x>=0?(r.x=_.x,s.x=a.x):(r.x=a.x,s.x=_.x),c.y>=0?(r.y=_.y,s.y=a.y):(r.y=a.y,s.y=_.y),c.z>=0?(r.z=_.z,s.z=a.z):(r.z=a.z,s.z=_.z),n.intersectsPlaneAndPoint(u,r)===t.PlaneIntersectionType.Back)return t.ContainmentType.Disjoint;n.intersectsPlaneAndPoint(u,s)===t.PlaneIntersectionType.Back&&(o=t.ContainmentType.Intersects)}return o},n.frustumContainsSphere=function(e,i){for(var a=t.ContainmentType.Contains,_=0;_<6;++_){var r=e.getPlane(_),s=n.intersectsPlaneAndSphere(r,i);if(s===t.PlaneIntersectionType.Back)return t.ContainmentType.Disjoint;if(s===t.PlaneIntersectionType.Intersecting){a=t.ContainmentType.Intersects;break}}return a},n}();h._tempVec30=new r,h._tempVec31=new r,h._tempVec32=new r;var u=function(){function t(t,n){void 0===t&&(t=null),void 0===n&&(n=0),this.normal=new r,this.distance=0,t&&this.normal.copyFrom(t),this.distance=n}var n=t.prototype;return n.normalize=function(){return t.normalize(this,this),this},n.clone=function(){var n=new t;return n.copyFrom(this),n},n.copyFrom=function(t){return this.normal.copyFrom(t.normal),this.distance=t.distance,this},t.normalize=function(t,n){var e=t.normal,i=1/e.length();r.scale(e,i,n.normal),n.distance=t.distance*i},t.fromPoints=function(t,n,e,i){var a=t.x,_=t.y,r=t.z,s=n.x-a,o=n.y-_,h=n.z-r,u=e.x-a,c=e.y-_,l=e.z-r,y=o*l-h*c,d=h*u-s*l,f=s*c-o*u,m=1/Math.sqrt(y*y+d*d+f*f),x=y*m,g=d*m,z=f*m,V=i.normal;V.x=x,V.y=g,V.z=z,i.distance=-(x*a+g*_+z*r)},t}(),c=function(){function n(t){void 0===t&&(t=null),this.near=new u,this.far=new u,this.left=new u,this.right=new u,this.top=new u,this.bottom=new u,t&&this.calculateFromMatrix(t)}var e=n.prototype;return e.getPlane=function(n){switch(n){case t.FrustumFace.Near:return this.near;case t.FrustumFace.Far:return this.far;case t.FrustumFace.Left:return this.left;case t.FrustumFace.Right:return this.right;case t.FrustumFace.Bottom:return this.bottom;case t.FrustumFace.Top:return this.top;default:return null}},e.calculateFromMatrix=function(t){var n=t.elements,e=n[0],i=n[1],a=n[2],_=n[3],r=n[4],s=n[5],o=n[6],h=n[7],u=n[8],c=n[9],l=n[10],y=n[11],d=n[12],f=n[13],m=n[14],x=n[15];this.near.normal.set(_+a,h+o,y+l),this.near.distance=x+m,this.near.normalize(),this.far.normal.set(_-a,h-o,y-l),this.far.distance=x-m,this.far.normalize(),this.left.normal.set(_+e,h+r,y+u),this.left.distance=x+d,this.left.normalize(),this.right.normal.set(_-e,h-r,y-u),this.right.distance=x-d,this.right.normalize(),this.bottom.normal.set(_+i,h+s,y+c),this.bottom.distance=x+f,this.bottom.normalize(),this.top.normal.set(_-i,h-s,y-c),this.top.distance=x-f,this.top.normalize()},e.intersectsBox=function(t){return h.intersectsFrustumAndBox(this,t)},e.intersectsSphere=function(n){return h.frustumContainsSphere(this,n)!==t.ContainmentType.Disjoint},e.clone=function(){var t=new n;return t.copyFrom(this),t},e.copyFrom=function(t){return this.near.copyFrom(t.near),this.far.copyFrom(t.far),this.left.copyFrom(t.left),this.right.copyFrom(t.right),this.bottom.copyFrom(t.bottom),this.top.copyFrom(t.top),this},n}(),l=function(){function t(t,n,e,i,a,_,r,s,o){void 0===t&&(t=1),void 0===n&&(n=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===a&&(a=1),void 0===_&&(_=0),void 0===r&&(r=0),void 0===s&&(s=0),void 0===o&&(o=1),this.elements=new Float32Array(9);var h=this.elements;h[0]=t,h[1]=n,h[2]=e,h[3]=i,h[4]=a,h[5]=_,h[6]=r,h[7]=s,h[8]=o}var n=t.prototype;return n.set=function(t,n,e,i,a,_,r,s,o){var h=this.elements;return h[0]=t,h[1]=n,h[2]=e,h[3]=i,h[4]=a,h[5]=_,h[6]=r,h[7]=s,h[8]=o,this},n.add=function(n){return t.add(this,n,this),this},n.subtract=function(n){return t.subtract(this,n,this),this},n.multiply=function(n){return t.multiply(this,n,this),this},n.determinant=function(){var t=this.elements,n=t[0],e=t[1],i=t[2],a=t[3],_=t[4],r=t[5],s=t[6],o=t[7],h=t[8];return n*(h*_-r*o)+e*(-h*a+r*s)+i*(o*a-_*s)},n.identity=function(){var t=this.elements;return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,this},n.invert=function(){return t.invert(this,this),this},n.rotate=function(n){return t.rotate(this,n,this),this},n.scale=function(n){return t.scale(this,n,this),this},n.translate=function(n){return t.translate(this,n,this),this},n.transpose=function(){return t.transpose(this,this),this},n.clone=function(){var n=this.elements;return new t(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8])},n.copyFrom=function(t){var n=this.elements,e=t.elements;return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],this},n.copyFromArray=function(t,n){void 0===n&&(n=0);for(var e=this.elements,i=0;i<12;i++)e[i]=t[i+n];return this},n.copyToArray=function(t,n){void 0===n&&(n=0);var e=this.elements;t[n]=e[0],t[n+1]=e[1],t[n+2]=e[2],t[n+3]=e[3],t[n+4]=e[4],t[n+5]=e[5],t[n+6]=e[6],t[n+7]=e[7],t[n+8]=e[8]},n.copyFromMatrix=function(t){var n=t.elements,e=this.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[4],e[4]=n[5],e[5]=n[6],e[6]=n[8],e[7]=n[9],e[8]=n[10],this},t.add=function(t,n,e){var i=t.elements,a=n.elements,_=e.elements;_[0]=i[0]+a[0],_[1]=i[1]+a[1],_[2]=i[2]+a[2],_[3]=i[3]+a[3],_[4]=i[4]+a[4],_[5]=i[5]+a[5],_[6]=i[6]+a[6],_[7]=i[7]+a[7],_[8]=i[8]+a[8]},t.subtract=function(t,n,e){var i=t.elements,a=n.elements,_=e.elements;_[0]=i[0]-a[0],_[1]=i[1]-a[1],_[2]=i[2]-a[2],_[3]=i[3]-a[3],_[4]=i[4]-a[4],_[5]=i[5]-a[5],_[6]=i[6]-a[6],_[7]=i[7]-a[7],_[8]=i[8]-a[8]},t.multiply=function(t,n,e){var i=t.elements,a=n.elements,_=e.elements,r=i[0],s=i[1],o=i[2],h=i[3],u=i[4],c=i[5],l=i[6],y=i[7],d=i[8],f=a[0],m=a[1],x=a[2],g=a[3],z=a[4],V=a[5],v=a[6],C=a[7],p=a[8];_[0]=r*f+h*m+l*x,_[1]=s*f+u*m+y*x,_[2]=o*f+c*m+d*x,_[3]=r*g+h*z+l*V,_[4]=s*g+u*z+y*V,_[5]=o*g+c*z+d*V,_[6]=r*v+h*C+l*p,_[7]=s*v+u*C+y*p,_[8]=o*v+c*C+d*p},t.equals=function(t,n){var e=t.elements,i=n.elements;return _.equals(e[0],i[0])&&_.equals(e[1],i[1])&&_.equals(e[2],i[2])&&_.equals(e[3],i[3])&&_.equals(e[4],i[4])&&_.equals(e[5],i[5])&&_.equals(e[6],i[6])&&_.equals(e[7],i[7])&&_.equals(e[8],i[8])},t.lerp=function(t,n,e,i){var a=t.elements,_=n.elements,r=i.elements,s=1-e;r[0]=a[0]*s+_[0]*e,r[1]=a[1]*s+_[1]*e,r[2]=a[2]*s+_[2]*e,r[3]=a[3]*s+_[3]*e,r[4]=a[4]*s+_[4]*e,r[5]=a[5]*s+_[5]*e,r[6]=a[6]*s+_[6]*e,r[7]=a[7]*s+_[7]*e,r[8]=a[8]*s+_[8]*e},t.rotationQuaternion=function(t,n){var e=n.elements,i=t._x,a=t._y,_=t._z,r=t._w,s=i+i,o=a+a,h=_+_,u=i*s,c=a*s,l=a*o,y=_*s,d=_*o,f=_*h,m=r*s,x=r*o,g=r*h;e[0]=1-l-f,e[3]=c-g,e[6]=y+x,e[1]=c+g,e[4]=1-u-f,e[7]=d-m,e[2]=y-x,e[5]=d+m,e[8]=1-u-l},t.scaling=function(t,n){var e=n.elements;e[0]=t._x,e[1]=0,e[2]=0,e[3]=0,e[4]=t._y,e[5]=0,e[6]=0,e[7]=0,e[8]=1},t.translation=function(t,n){var e=n.elements;e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=t._x,e[7]=t._y,e[8]=1},t.invert=function(t,n){var e=t.elements,i=n.elements,a=e[0],_=e[1],r=e[2],s=e[3],o=e[4],h=e[5],u=e[6],c=e[7],l=e[8],y=l*o-h*c,d=-l*s+h*u,f=c*s-o*u,m=a*y+_*d+r*f;m&&(m=1/m,i[0]=y*m,i[1]=(-l*_+r*c)*m,i[2]=(h*_-r*o)*m,i[3]=d*m,i[4]=(l*a-r*u)*m,i[5]=(-h*a+r*s)*m,i[6]=f*m,i[7]=(-c*a+_*u)*m,i[8]=(o*a-_*s)*m)},t.normalMatrix=function(t,n){var e=t.elements,i=n.elements,a=e[0],_=e[1],r=e[2],s=e[3],o=e[4],h=e[5],u=e[6],c=e[7],l=e[8],y=e[9],d=e[10],f=e[11],m=e[12],x=e[13],g=e[14],z=e[15],V=a*h-_*o,v=a*u-r*o,C=a*c-s*o,p=_*u-r*h,w=_*c-s*h,M=r*c-s*u,q=l*x-y*m,b=l*g-d*m,T=l*z-f*m,F=y*g-d*x,A=y*z-f*x,P=d*z-f*g,S=V*P-v*A+C*F+p*T-w*b+M*q;if(!S)return null;S=1/S,i[0]=(h*P-u*A+c*F)*S,i[1]=(u*T-o*P-c*b)*S,i[2]=(o*A-h*T+c*q)*S,i[3]=(r*A-_*P-s*F)*S,i[4]=(a*P-r*T+s*b)*S,i[5]=(_*T-a*A-s*q)*S,i[6]=(x*M-g*w+z*p)*S,i[7]=(g*C-m*M-z*v)*S,i[8]=(m*w-x*C+z*V)*S},t.rotate=function(t,n,e){var i=t.elements,a=e.elements,_=Math.sin(n),r=Math.cos(n),s=i[0],o=i[1],h=i[2],u=i[3],c=i[4],l=i[5],y=i[6],d=i[7],f=i[8];a[0]=r*s+_*u,a[1]=r*o+_*c,a[2]=r*h+_*l,a[3]=r*u-_*s,a[4]=r*c-_*o,a[5]=r*l-_*h,a[6]=y,a[7]=d,a[8]=f},t.scale=function(t,n,e){var i=n._x,a=n._y,_=t.elements,r=e.elements;r[0]=i*_[0],r[1]=i*_[1],r[2]=i*_[2],r[3]=a*_[3],r[4]=a*_[4],r[5]=a*_[5],r[6]=_[6],r[7]=_[7],r[8]=_[8]},t.translate=function(t,n,e){var i=n._x,a=n._y,_=t.elements,r=e.elements,s=_[0],o=_[1],h=_[2],u=_[3],c=_[4],l=_[5],y=_[6],d=_[7],f=_[8];r[0]=s,r[1]=o,r[2]=h,r[3]=u,r[4]=c,r[5]=l,r[6]=i*s+a*u+y,r[7]=i*o+a*c+d,r[8]=i*h+a*l+f},t.transpose=function(t,n){var e=t.elements,i=n.elements;if(n===t){var a=e[1],_=e[2],r=e[5];i[1]=e[3],i[2]=e[6],i[3]=a,i[5]=e[7],i[6]=_,i[7]=r}else i[0]=e[0],i[1]=e[3],i[2]=e[6],i[3]=e[1],i[4]=e[4],i[5]=e[7],i[6]=e[2],i[7]=e[5],i[8]=e[8]},t}(),y=function(){function t(t,n,e,i){void 0===t&&(t=0),void 0===n&&(n=0),void 0===e&&(e=0),void 0===i&&(i=1),this._onValueChanged=null,this._x=t,this._y=n,this._z=e,this._w=i}var e=t.prototype;return e.set=function(t,n,e,i){return this._x=t,this._y=n,this._z=e,this._w=i,this._onValueChanged&&this._onValueChanged(),this},e.conjugate=function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onValueChanged&&this._onValueChanged(),this},e.getAxisAngle=function(t){var n=this._x,e=this._y,i=this._z,a=n*n+e*e+i*i;if(a<_.zeroTolerance)return t._x=1,t._y=0,t._z=0,0;var r=1/a;return t._x=this._x*r,t._y=this._y*r,t._z=this._z*r,2*Math.acos(this._w)},e.identity=function(){return this._x=0,this._y=0,this._z=0,this._w=1,this._onValueChanged&&this._onValueChanged(),this},e.length=function(){var t=this._x,n=this._y,e=this._z,i=this._w;return Math.sqrt(t*t+n*n+e*e+i*i)},e.lengthSquared=function(){var t=this._x,n=this._y,e=this._z,i=this._w;return t*t+n*n+e*e+i*i},e.normalize=function(){return t.normalize(this,this),this},e.toEuler=function(t){this._toYawPitchRoll(t);var n=t._x;return t._x=t._y,t._y=n,t._onValueChanged&&t._onValueChanged(),t},e.toYawPitchRoll=function(t){return this._toYawPitchRoll(t),t._onValueChanged&&t._onValueChanged(),t},e.rotateX=function(n){return t.rotateX(this,n,this),this},e.rotateY=function(n){return t.rotateY(this,n,this),this},e.rotateZ=function(n){return t.rotateZ(this,n,this),this},e.rotationAxisAngle=function(n,e){return t.rotationAxisAngle(n,e,this),this},e.multiply=function(n){return t.multiply(this,n,this),this},e.invert=function(){return t.invert(this,this),this},e.dot=function(n){return t.dot(this,n)},e.lerp=function(n,e){return t.lerp(this,n,e,this),this},e.rotateAxisAngle=function(n,e){return t._tempQuat1.rotationAxisAngle(n,e),this.multiply(t._tempQuat1),this},e.clone=function(){return new t(this._x,this._y,this._z,this._w)},e.copyFrom=function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onValueChanged&&this._onValueChanged(),this},e.copyFromArray=function(t,n){return void 0===n&&(n=0),this._x=t[n],this._y=t[n+1],this._z=t[n+2],this._w=t[n+3],this._onValueChanged&&this._onValueChanged(),this},e.copyToArray=function(t,n){void 0===n&&(n=0),t[n]=this._x,t[n+1]=this._y,t[n+2]=this._z,t[n+3]=this._w},e.toJSON=function(){return{x:this._x,y:this._y,z:this._z,w:this._w}},e._toYawPitchRoll=function(t){var n=this._x,e=this._y,i=this._z,a=this._w,_=n*n,r=2*(n*a-e*i);t._y=Math.abs(r)>=1?Math.sign(r)*(Math.PI/2):Math.asin(r),t._x=Math.atan2(2*(i*n+e*a),1-2*(e*e+_)),t._z=Math.atan2(2*(n*e+i*a),1-2*(i*i+_))},t.add=function(t,n,e){e._x=t._x+n._x,e._y=t._y+n._y,e._z=t._z+n._z,e._w=t._w+n._w,e._onValueChanged&&e._onValueChanged()},t.multiply=function(t,n,e){var i=t._x,a=t._y,_=t._z,r=t._w,s=n._x,o=n._y,h=n._z,u=n._w;e._x=i*u+r*s+a*h-_*o,e._y=a*u+r*o+_*s-i*h,e._z=_*u+r*h+i*o-a*s,e._w=r*u-i*s-a*o-_*h,e._onValueChanged&&e._onValueChanged()},t.conjugate=function(t,n){n._x=-t._x,n._y=-t._y,n._z=-t._z,n._w=t._w,n._onValueChanged&&n._onValueChanged()},t.dot=function(t,n){return t._x*n._x+t._y*n._y+t._z*n._z+t._w*n._w},t.equals=function(t,n){return _.equals(t._x,n._x)&&_.equals(t._y,n._y)&&_.equals(t._z,n._z)&&_.equals(t._w,n._w)},t.rotationAxisAngle=function(n,e,i){var a=t._tempVector3;r.normalize(n,a);var _=Math.sin(e*=.5);i._x=a._x*_,i._y=a._y*_,i._z=a._z*_,i._w=Math.cos(e),i._onValueChanged&&i._onValueChanged()},t.rotationEuler=function(n,e,i,a){t.rotationYawPitchRoll(e,n,i,a)},t.rotationYawPitchRoll=function(t,n,e,i){var a=.5*e,_=.5*n,r=.5*t,s=Math.sin(a),o=Math.cos(a),h=Math.sin(_),u=Math.cos(_),c=Math.sin(r),l=Math.cos(r),y=l*u,d=c*h;i._x=l*h*o+c*u*s,i._y=c*u*o-l*h*s,i._z=y*s-d*o,i._w=y*o+d*s,i._onValueChanged&&i._onValueChanged()},t.rotationMatrix3x3=function(t,n){var e,i,a=t.elements,_=a[0],r=a[1],s=a[2],o=a[3],h=a[4],u=a[5],c=a[6],l=a[7],y=a[8],d=_+h+y;d>0?(e=Math.sqrt(d+1),n._w=.5*e,e=.5/e,n._x=(u-l)*e,n._y=(c-s)*e,n._z=(r-o)*e):_>=h&&_>=y?(i=.5/(e=Math.sqrt(1+_-h-y)),n._x=.5*e,n._y=(r+o)*i,n._z=(s+c)*i,n._w=(u-l)*i):h>y?(i=.5/(e=Math.sqrt(1+h-_-y)),n._x=(o+r)*i,n._y=.5*e,n._z=(l+u)*i,n._w=(c-s)*i):(i=.5/(e=Math.sqrt(1+y-_-h)),n._x=(s+c)*i,n._y=(u+l)*i,n._z=.5*e,n._w=(r-o)*i),n._onValueChanged&&n._onValueChanged()},t.invert=function(t,n){var e=t._x,i=t._y,a=t._z,r=t._w,s=e*e+i*i+a*a+r*r;if(s>_.zeroTolerance){var o=1/s;n._x=-e*o,n._y=-i*o,n._z=-a*o,n._w=r*o,n._onValueChanged&&n._onValueChanged()}},t.lerp=function(n,e,i,a){var _=1-i;t.dot(n,e)>=0?(a._x=n._x*_+e._x*i,a._y=n._y*_+e._y*i,a._z=n._z*_+e._z*i,a._w=n._w*_+e._w*i):(a._x=n._x*_-e._x*i,a._y=n._y*_-e._y*i,a._z=n._z*_-e._z*i,a._w=n._w*_-e._w*i),a.normalize()},t.slerp=function(n,e,i,a){var r,s,o=t.dot(n,e);if(Math.abs(o)>1-_.zeroTolerance)s=1-i,r=i*Math.sign(o);else{var h=Math.acos(Math.abs(o)),u=1/Math.sin(h);s=Math.sin((1-i)*h)*u,r=Math.sin(i*h)*u*Math.sign(o)}a.x=s*n.x+r*e.x,a.y=s*n.y+r*e.y,a.z=s*n.z+r*e.z,a.w=s*n.w+r*e.w,a._onValueChanged&&a._onValueChanged()},t.normalize=function(t,n){var e=t._x,i=t._y,a=t._z,r=t._w,s=Math.sqrt(e*e+i*i+a*a+r*r);s>_.zeroTolerance&&(s=1/s,n._x=e*s,n._y=i*s,n._z=a*s,n._w=r*s,n._onValueChanged&&n._onValueChanged())},t.rotationX=function(t,n){var e=Math.sin(t*=.5),i=Math.cos(t);n._x=e,n._y=0,n._z=0,n._w=i,n._onValueChanged&&n._onValueChanged()},t.rotationY=function(t,n){var e=Math.sin(t*=.5),i=Math.cos(t);n._x=0,n._y=e,n._z=0,n._w=i,n._onValueChanged&&n._onValueChanged()},t.rotationZ=function(t,n){var e=Math.sin(t*=.5),i=Math.cos(t);n._x=0,n._y=0,n._z=e,n._w=i,n._onValueChanged&&n._onValueChanged()},t.rotateX=function(t,n,e){var i=t._x,a=t._y,_=t._z,r=t._w,s=Math.sin(n*=.5),o=Math.cos(n);e._x=i*o+r*s,e._y=a*o+_*s,e._z=_*o-a*s,e._w=r*o-i*s,e._onValueChanged&&e._onValueChanged()},t.rotateY=function(t,n,e){var i=t._x,a=t._y,_=t._z,r=t._w,s=Math.sin(n*=.5),o=Math.cos(n);e._x=i*o-_*s,e._y=a*o+r*s,e._z=_*o+i*s,e._w=r*o-a*s,e._onValueChanged&&e._onValueChanged()},t.rotateZ=function(t,n,e){var i=t._x,a=t._y,_=t._z,r=t._w,s=Math.sin(n*=.5),o=Math.cos(n);e._x=i*o+a*s,e._y=a*o-i*s,e._z=_*o+r*s,e._w=r*o-_*s,e._onValueChanged&&e._onValueChanged()},t.scale=function(t,n,e){e._x=t._x*n,e._y=t._y*n,e._z=t._z*n,e._w=t._w*n,e._onValueChanged&&e._onValueChanged()},n._(t,[{key:"x",get:function(){return this._x},set:function(t){this._x=t,this._onValueChanged&&this._onValueChanged()}},{key:"y",get:function(){return this._y},set:function(t){this._y=t,this._onValueChanged&&this._onValueChanged()}},{key:"z",get:function(){return this._z},set:function(t){this._z=t,this._onValueChanged&&this._onValueChanged()}},{key:"normalized",get:function(){return Math.abs(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w-1)<_.zeroTolerance}},{key:"w",get:function(){return this._w},set:function(t){this._w=t,this._onValueChanged&&this._onValueChanged()}}]),t}();y._tempVector3=new r,y._tempQuat1=new y;var d=function(){function t(t,n,e,i,a,_,r,s,o,h,u,c,l,y,d,f){void 0===t&&(t=1),void 0===n&&(n=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===a&&(a=0),void 0===_&&(_=1),void 0===r&&(r=0),void 0===s&&(s=0),void 0===o&&(o=0),void 0===h&&(h=0),void 0===u&&(u=1),void 0===c&&(c=0),void 0===l&&(l=0),void 0===y&&(y=0),void 0===d&&(d=0),void 0===f&&(f=1),this.elements=new Float32Array(16);var m=this.elements;m[0]=t,m[1]=n,m[2]=e,m[3]=i,m[4]=a,m[5]=_,m[6]=r,m[7]=s,m[8]=o,m[9]=h,m[10]=u,m[11]=c,m[12]=l,m[13]=y,m[14]=d,m[15]=f}var n=t.prototype;return n.set=function(t,n,e,i,a,_,r,s,o,h,u,c,l,y,d,f){var m=this.elements;return m[0]=t,m[1]=n,m[2]=e,m[3]=i,m[4]=a,m[5]=_,m[6]=r,m[7]=s,m[8]=o,m[9]=h,m[10]=u,m[11]=c,m[12]=l,m[13]=y,m[14]=d,m[15]=f,this},n.multiply=function(n){return t.multiply(this,n,this),this},n.determinant=function(){var t=this.elements,n=t[0],e=t[1],i=t[2],a=t[3],_=t[4],r=t[5],s=t[6],o=t[7],h=t[8],u=t[9],c=t[10],l=t[11],y=t[12],d=t[13],f=t[14],m=t[15];return(n*r-e*_)*(c*m-l*f)-(n*s-i*_)*(u*m-l*d)+(n*o-a*_)*(u*f-c*d)+(e*s-i*r)*(h*m-l*y)-(e*o-a*r)*(h*f-c*y)+(i*o-a*s)*(h*d-u*y)},n.decompose=function(n,e,i){var a=t._tempMat30,r=this.elements,s=a.elements,o=r[0],h=r[1],u=r[2],c=r[3],l=r[4],d=r[5],f=r[6],m=r[7],x=r[8],g=r[9],z=r[10],V=r[11];n.set(r[12],r[13],r[14]);var v=(0>Math.sign(o*h*u*c)?-1:1)*Math.sqrt(o*o+h*h+u*u),C=(0>Math.sign(l*d*f*m)?-1:1)*Math.sqrt(l*l+d*d+f*f),p=(0>Math.sign(x*g*z*V)?-1:1)*Math.sqrt(x*x+g*g+z*z);if(i.set(v,C,p),Math.abs(v)<_.zeroTolerance||Math.abs(C)<_.zeroTolerance||Math.abs(p)<_.zeroTolerance)return e.identity(),!1;var w=1/v,M=1/C,q=1/p;return s[0]=o*w,s[1]=h*w,s[2]=u*w,s[3]=l*M,s[4]=d*M,s[5]=f*M,s[6]=x*q,s[7]=g*q,s[8]=z*q,y.rotationMatrix3x3(a,e),!0},n.getRotation=function(t){var n=this.elements,e=n[0]+n[5]+n[10];if(e>_.zeroTolerance){var i=2*Math.sqrt(e+1);t._w=.25*i,t._x=(n[6]-n[9])/i,t._y=(n[8]-n[2])/i,t._z=(n[1]-n[4])/i}else if(n[0]>n[5]&&n[0]>n[10]){var a=2*Math.sqrt(1+n[0]-n[5]-n[10]);t._w=(n[6]-n[9])/a,t._x=.25*a,t._y=(n[1]+n[4])/a,t._z=(n[8]+n[2])/a}else if(n[5]>n[10]){var r=2*Math.sqrt(1+n[5]-n[0]-n[10]);t._w=(n[8]-n[2])/r,t._x=(n[1]+n[4])/r,t._y=.25*r,t._z=(n[6]+n[9])/r}else{var s=2*Math.sqrt(1+n[10]-n[0]-n[5]);t._w=(n[1]-n[4])/s,t._x=(n[8]+n[2])/s,t._y=(n[6]+n[9])/s,t._z=.25*s}return t._onValueChanged&&t._onValueChanged(),t},n.getScaling=function(t){var n=this.elements,e=n[0],i=n[1],a=n[2],_=n[4],r=n[5],s=n[6],o=n[8],h=n[9],u=n[10];return t.set(Math.sqrt(e*e+i*i+a*a),Math.sqrt(_*_+r*r+s*s),Math.sqrt(o*o+h*h+u*u)),t},n.getTranslation=function(t){var n=this.elements;return t.set(n[12],n[13],n[14]),t},n.identity=function(){var t=this.elements;return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},n.invert=function(){return t.invert(this,this),this},n.rotateAxisAngle=function(n,e){return t.rotateAxisAngle(this,n,e,this),this},n.scale=function(n){return t.scale(this,n,this),this},n.translate=function(n){return t.translate(this,n,this),this},n.transpose=function(){return t.transpose(this,this),this},n.clone=function(){var n=this.elements;return new t(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8],n[9],n[10],n[11],n[12],n[13],n[14],n[15])},n.copyFrom=function(t){var n=this.elements,e=t.elements;return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],this},n.copyFromArray=function(t,n){void 0===n&&(n=0);for(var e=this.elements,i=0;i<16;i++)e[i]=t[i+n];return this},n.copyToArray=function(t,n){void 0===n&&(n=0);var e=this.elements;t[n]=e[0],t[n+1]=e[1],t[n+2]=e[2],t[n+3]=e[3],t[n+4]=e[4],t[n+5]=e[5],t[n+6]=e[6],t[n+7]=e[7],t[n+8]=e[8],t[n+9]=e[9],t[n+10]=e[10],t[n+11]=e[11],t[n+12]=e[12],t[n+13]=e[13],t[n+14]=e[14],t[n+15]=e[15]},t.multiply=function(t,n,e){var i=t.elements,a=n.elements,_=e.elements,r=i[0],s=i[1],o=i[2],h=i[3],u=i[4],c=i[5],l=i[6],y=i[7],d=i[8],f=i[9],m=i[10],x=i[11],g=i[12],z=i[13],V=i[14],v=i[15],C=a[0],p=a[1],w=a[2],M=a[3],q=a[4],b=a[5],T=a[6],F=a[7],A=a[8],P=a[9],S=a[10],B=a[11],I=a[12],k=a[13],R=a[14],N=a[15];_[0]=r*C+u*p+d*w+g*M,_[1]=s*C+c*p+f*w+z*M,_[2]=o*C+l*p+m*w+V*M,_[3]=h*C+y*p+x*w+v*M,_[4]=r*q+u*b+d*T+g*F,_[5]=s*q+c*b+f*T+z*F,_[6]=o*q+l*b+m*T+V*F,_[7]=h*q+y*b+x*T+v*F,_[8]=r*A+u*P+d*S+g*B,_[9]=s*A+c*P+f*S+z*B,_[10]=o*A+l*P+m*S+V*B,_[11]=h*A+y*P+x*S+v*B,_[12]=r*I+u*k+d*R+g*N,_[13]=s*I+c*k+f*R+z*N,_[14]=o*I+l*k+m*R+V*N,_[15]=h*I+y*k+x*R+v*N},t.equals=function(t,n){var e=t.elements,i=n.elements;return _.equals(e[0],i[0])&&_.equals(e[1],i[1])&&_.equals(e[2],i[2])&&_.equals(e[3],i[3])&&_.equals(e[4],i[4])&&_.equals(e[5],i[5])&&_.equals(e[6],i[6])&&_.equals(e[7],i[7])&&_.equals(e[8],i[8])&&_.equals(e[9],i[9])&&_.equals(e[10],i[10])&&_.equals(e[11],i[11])&&_.equals(e[12],i[12])&&_.equals(e[13],i[13])&&_.equals(e[14],i[14])&&_.equals(e[15],i[15])},t.lerp=function(t,n,e,i){var a=t.elements,_=n.elements,r=i.elements,s=1-e;r[0]=a[0]*s+_[0]*e,r[1]=a[1]*s+_[1]*e,r[2]=a[2]*s+_[2]*e,r[3]=a[3]*s+_[3]*e,r[4]=a[4]*s+_[4]*e,r[5]=a[5]*s+_[5]*e,r[6]=a[6]*s+_[6]*e,r[7]=a[7]*s+_[7]*e,r[8]=a[8]*s+_[8]*e,r[9]=a[9]*s+_[9]*e,r[10]=a[10]*s+_[10]*e,r[11]=a[11]*s+_[11]*e,r[12]=a[12]*s+_[12]*e,r[13]=a[13]*s+_[13]*e,r[14]=a[14]*s+_[14]*e,r[15]=a[15]*s+_[15]*e},t.add=function(t,n,e){var i=t.elements,a=n.elements,_=e.elements;_[0]=i[0]+a[0],_[1]=i[1]+a[1],_[2]=i[2]+a[2],_[3]=i[3]+a[3],_[4]=i[4]+a[4],_[5]=i[5]+a[5],_[6]=i[6]+a[6],_[7]=i[7]+a[7],_[8]=i[8]+a[8],_[9]=i[9]+a[9],_[10]=i[10]+a[10],_[11]=i[11]+a[11],_[12]=i[12]+a[12],_[13]=i[13]+a[13],_[14]=i[14]+a[14],_[15]=i[15]+a[15]},t.multiplyScalar=function(t,n,e){var i=t.elements,a=e.elements;a[0]=i[0]*n,a[1]=i[1]*n,a[2]=i[2]*n,a[3]=i[3]*n,a[4]=i[4]*n,a[5]=i[5]*n,a[6]=i[6]*n,a[7]=i[7]*n,a[8]=i[8]*n,a[9]=i[9]*n,a[10]=i[10]*n,a[11]=i[11]*n,a[12]=i[12]*n,a[13]=i[13]*n,a[14]=i[14]*n,a[15]=i[15]*n},t.rotationQuaternion=function(t,n){var e=n.elements,i=t._x,a=t._y,_=t._z,r=t._w,s=i+i,o=a+a,h=_+_,u=i*s,c=a*s,l=a*o,y=_*s,d=_*o,f=_*h,m=r*s,x=r*o,g=r*h;e[0]=1-l-f,e[1]=c+g,e[2]=y-x,e[3]=0,e[4]=c-g,e[5]=1-u-f,e[6]=d+m,e[7]=0,e[8]=y+x,e[9]=d-m,e[10]=1-u-l,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1},t.rotationAxisAngle=function(t,n,e){var i,a,r,s=e.elements,o=t._x,h=t._y,u=t._z,c=Math.sqrt(o*o+h*h+u*u);Math.abs(c)<_.zeroTolerance||(o*=c=1/c,h*=c,u*=c,i=Math.sin(n),r=1-(a=Math.cos(n)),s[0]=o*o*r+a,s[1]=h*o*r+u*i,s[2]=u*o*r-h*i,s[3]=0,s[4]=o*h*r-u*i,s[5]=h*h*r+a,s[6]=u*h*r+o*i,s[7]=0,s[8]=o*u*r+h*i,s[9]=h*u*r-o*i,s[10]=u*u*r+a,s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1)},t.rotationTranslation=function(n,e,i){t.rotationQuaternion(n,i);var a=i.elements;a[12]=e._x,a[13]=e._y,a[14]=e._z},t.affineTransformation=function(t,n,e,i){var a=i.elements,_=n._x,r=n._y,s=n._z,o=n._w,h=_+_,u=r+r,c=s+s,l=_*h,y=_*u,d=_*c,f=r*u,m=r*c,x=s*c,g=o*h,z=o*u,V=o*c,v=t._x,C=t._y,p=t._z;a[0]=(1-(f+x))*v,a[1]=(y+V)*v,a[2]=(d-z)*v,a[3]=0,a[4]=(y-V)*C,a[5]=(1-(l+x))*C,a[6]=(m+g)*C,a[7]=0,a[8]=(d+z)*p,a[9]=(m-g)*p,a[10]=(1-(l+f))*p,a[11]=0,a[12]=e._x,a[13]=e._y,a[14]=e._z,a[15]=1},t.scaling=function(t,n){var e=n.elements;e[0]=t._x,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t._y,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t._z,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1},t.translation=function(t,n){var e=n.elements;e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=t._x,e[13]=t._y,e[14]=t._z,e[15]=1},t.invert=function(t,n){var e=t.elements,i=n.elements,a=e[0],_=e[1],r=e[2],s=e[3],o=e[4],h=e[5],u=e[6],c=e[7],l=e[8],y=e[9],d=e[10],f=e[11],m=e[12],x=e[13],g=e[14],z=e[15],V=a*h-_*o,v=a*u-r*o,C=a*c-s*o,p=_*u-r*h,w=_*c-s*h,M=r*c-s*u,q=l*x-y*m,b=l*g-d*m,T=l*z-f*m,F=y*g-d*x,A=y*z-f*x,P=d*z-f*g,S=V*P-v*A+C*F+p*T-w*b+M*q;if(!S)return null;S=1/S,i[0]=(h*P-u*A+c*F)*S,i[1]=(r*A-_*P-s*F)*S,i[2]=(x*M-g*w+z*p)*S,i[3]=(d*w-y*M-f*p)*S,i[4]=(u*T-o*P-c*b)*S,i[5]=(a*P-r*T+s*b)*S,i[6]=(g*C-m*M-z*v)*S,i[7]=(l*M-d*C+f*v)*S,i[8]=(o*A-h*T+c*q)*S,i[9]=(_*T-a*A-s*q)*S,i[10]=(m*w-x*C+z*V)*S,i[11]=(y*C-l*w-f*V)*S,i[12]=(h*b-o*F-u*q)*S,i[13]=(a*F-_*b+r*q)*S,i[14]=(x*v-m*p-g*V)*S,i[15]=(l*p-y*v+d*V)*S},t.lookAt=function(n,e,i,a){var _=a.elements,s=t._tempVec30,o=t._tempVec31,h=t._tempVec32;r.subtract(n,e,h),h.normalize(),r.cross(i,h,s),s.normalize(),r.cross(h,s,o),_[0]=s._x,_[1]=o._x,_[2]=h._x,_[3]=0,_[4]=s._y,_[5]=o._y,_[6]=h._y,_[7]=0,_[8]=s._z,_[9]=o._z,_[10]=h._z,_[11]=0,_[12]=-r.dot(s,n),_[13]=-r.dot(o,n),_[14]=-r.dot(h,n),_[15]=1},t.ortho=function(t,n,e,i,a,_,r){var s=r.elements,o=1/(t-n),h=1/(e-i),u=1/(a-_);s[0]=-2*o,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=-2*h,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=2*u,s[11]=0,s[12]=(t+n)*o,s[13]=(i+e)*h,s[14]=(_+a)*u,s[15]=1},t.perspective=function(t,n,e,i,a){var _=a.elements,r=1/Math.tan(t/2),s=1/(e-i);_[0]=r/n,_[1]=0,_[2]=0,_[3]=0,_[4]=0,_[5]=r,_[6]=0,_[7]=0,_[8]=0,_[9]=0,_[10]=(i+e)*s,_[11]=-1,_[12]=0,_[13]=0,_[14]=2*i*e*s,_[15]=0},t.rotateAxisAngle=function(t,n,e,i){var a,r,s,o=n._x,h=n._y,u=n._z,c=Math.sqrt(o*o+h*h+u*u);if(!(Math.abs(c)<_.zeroTolerance)){var l=t.elements,y=i.elements;o*=c=1/c,h*=c,u*=c,a=Math.sin(e),s=1-(r=Math.cos(e));var d=l[0],f=l[1],m=l[2],x=l[3],g=l[4],z=l[5],V=l[6],v=l[7],C=l[8],p=l[9],w=l[10],M=l[11],q=o*o*s+r,b=h*o*s+u*a,T=u*o*s-h*a,F=o*h*s-u*a,A=h*h*s+r,P=u*h*s+o*a,S=o*u*s+h*a,B=h*u*s-o*a,I=u*u*s+r;y[0]=d*q+g*b+C*T,y[1]=f*q+z*b+p*T,y[2]=m*q+V*b+w*T,y[3]=x*q+v*b+M*T,y[4]=d*F+g*A+C*P,y[5]=f*F+z*A+p*P,y[6]=m*F+V*A+w*P,y[7]=x*F+v*A+M*P,y[8]=d*S+g*B+C*I,y[9]=f*S+z*B+p*I,y[10]=m*S+V*B+w*I,y[11]=x*S+v*B+M*I,t!==i&&(y[12]=l[12],y[13]=l[13],y[14]=l[14],y[15]=l[15])}},t.scale=function(t,n,e){var i=t.elements,a=e.elements,_=n._x,r=n._y,s=n._z;a[0]=i[0]*_,a[1]=i[1]*_,a[2]=i[2]*_,a[3]=i[3]*_,a[4]=i[4]*r,a[5]=i[5]*r,a[6]=i[6]*r,a[7]=i[7]*r,a[8]=i[8]*s,a[9]=i[9]*s,a[10]=i[10]*s,a[11]=i[11]*s,a[12]=i[12],a[13]=i[13],a[14]=i[14],a[15]=i[15]},t.translate=function(t,n,e){var i=t.elements,a=e.elements,_=n._x,r=n._y,s=n._z;if(t===e)a[12]=i[0]*_+i[4]*r+i[8]*s+i[12],a[13]=i[1]*_+i[5]*r+i[9]*s+i[13],a[14]=i[2]*_+i[6]*r+i[10]*s+i[14],a[15]=i[3]*_+i[7]*r+i[11]*s+i[15];else{var o=i[0],h=i[1],u=i[2],c=i[3],l=i[4],y=i[5],d=i[6],f=i[7],m=i[8],x=i[9],g=i[10],z=i[11];a[0]=o,a[1]=h,a[2]=u,a[3]=c,a[4]=l,a[5]=y,a[6]=d,a[7]=f,a[8]=m,a[9]=x,a[10]=g,a[11]=z,a[12]=o*_+l*r+m*s+i[12],a[13]=h*_+y*r+x*s+i[13],a[14]=u*_+d*r+g*s+i[14],a[15]=c*_+f*r+z*s+i[15]}},t.transpose=function(t,n){var e=t.elements,i=n.elements;if(n===t){var a=e[1],_=e[2],r=e[3],s=e[6],o=e[7],h=e[11];i[1]=e[4],i[2]=e[8],i[3]=e[12],i[4]=a,i[6]=e[9],i[7]=e[13],i[8]=_,i[9]=s,i[11]=e[14],i[12]=r,i[13]=o,i[14]=h}else i[0]=e[0],i[1]=e[4],i[2]=e[8],i[3]=e[12],i[4]=e[1],i[5]=e[5],i[6]=e[9],i[7]=e[13],i[8]=e[2],i[9]=e[6],i[10]=e[10],i[11]=e[14],i[12]=e[3],i[13]=e[7],i[14]=e[11],i[15]=e[15]},t}();d._tempVec30=new r,d._tempVec31=new r,d._tempVec32=new r,d._tempMat30=new l,d._identity=new d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);var f=function(){function t(t,n){void 0===t&&(t=null),void 0===n&&(n=null),this.origin=new r,this.direction=new r,t&&this.origin.copyFrom(t),n&&this.direction.copyFrom(n)}var n=t.prototype;return n.intersectPlane=function(t){return h.intersectsRayAndPlane(this,t)},n.intersectSphere=function(t){return h.intersectsRayAndSphere(this,t)},n.intersectBox=function(t){return h.intersectsRayAndBox(this,t)},n.getPoint=function(t,n){return r.scale(this.direction,t,n),n.add(this.origin)},t}(),m=function(){function t(t,n){void 0===t&&(t=0),void 0===n&&(n=0),this._onValueChanged=null,this._x=t,this._y=n}var e=t.prototype;return e.set=function(t,n){return this._x=t,this._y=n,this._onValueChanged&&this._onValueChanged(),this},e.add=function(t){return this._x+=t._x,this._y+=t._y,this._onValueChanged&&this._onValueChanged(),this},e.subtract=function(t){return this._x-=t._x,this._y-=t._y,this._onValueChanged&&this._onValueChanged(),this},e.multiply=function(t){return this._x*=t._x,this._y*=t._y,this._onValueChanged&&this._onValueChanged(),this},e.divide=function(t){return this._x/=t._x,this._y/=t._y,this._onValueChanged&&this._onValueChanged(),this},e.length=function(){var t=this._x,n=this._y;return Math.sqrt(t*t+n*n)},e.lengthSquared=function(){var t=this._x,n=this._y;return t*t+n*n},e.negate=function(){return this._x=-this._x,this._y=-this._y,this._onValueChanged&&this._onValueChanged(),this},e.normalize=function(){return t.normalize(this,this),this},e.scale=function(t){return this._x*=t,this._y*=t,this._onValueChanged&&this._onValueChanged(),this},e.clone=function(){return new t(this._x,this._y)},e.copyFrom=function(t){return this._x=t.x,this._y=t.y,this._onValueChanged&&this._onValueChanged(),this},e.copyFromArray=function(t,n){return void 0===n&&(n=0),this._x=t[n],this._y=t[n+1],this._onValueChanged&&this._onValueChanged(),this},e.copyToArray=function(t,n){void 0===n&&(n=0),t[n]=this._x,t[n+1]=this._y},e.toJSON=function(){return{x:this._x,y:this._y}},t.add=function(t,n,e){e._x=t._x+n._x,e._y=t._y+n._y,e._onValueChanged&&e._onValueChanged()},t.subtract=function(t,n,e){e._x=t._x-n._x,e._y=t._y-n._y,e._onValueChanged&&e._onValueChanged()},t.multiply=function(t,n,e){e._x=t._x*n._x,e._y=t._y*n._y,e._onValueChanged&&e._onValueChanged()},t.divide=function(t,n,e){e._x=t._x/n._x,e._y=t._y/n._y,e._onValueChanged&&e._onValueChanged()},t.dot=function(t,n){return t._x*n._x+t._y*n._y},t.distance=function(t,n){var e=n._x-t._x,i=n._y-t._y;return Math.sqrt(e*e+i*i)},t.distanceSquared=function(t,n){var e=n._x-t._x,i=n._y-t._y;return e*e+i*i},t.equals=function(t,n){return _.equals(t._x,n._x)&&_.equals(t._y,n._y)},t.lerp=function(t,n,e,i){var a=t._x,_=t._y;i._x=a+(n._x-a)*e,i._y=_+(n._y-_)*e,i._onValueChanged&&i._onValueChanged()},t.max=function(t,n,e){e._x=Math.max(t._x,n._x),e._y=Math.max(t._y,n._y),e._onValueChanged&&e._onValueChanged()},t.min=function(t,n,e){e._x=Math.min(t._x,n._x),e._y=Math.min(t._y,n._y),e._onValueChanged&&e._onValueChanged()},t.negate=function(t,n){n._x=-t._x,n._y=-t._y,n._onValueChanged&&n._onValueChanged()},t.normalize=function(t,n){var e=t._x,i=t._y,a=Math.sqrt(e*e+i*i);a>_.zeroTolerance&&(a=1/a,n._x=e*a,n._y=i*a,n._onValueChanged&&n._onValueChanged())},t.scale=function(t,n,e){e._x=t._x*n,e._y=t._y*n,e._onValueChanged&&e._onValueChanged()},n._(t,[{key:"x",get:function(){return this._x},set:function(t){this._x=t,this._onValueChanged&&this._onValueChanged()}},{key:"y",get:function(){return this._y},set:function(t){this._y=t,this._onValueChanged&&this._onValueChanged()}}]),t}();m._zero=new m(0,0),m._one=new m(1,1);var x=function(){function t(t,n,e,i){void 0===t&&(t=0),void 0===n&&(n=0),void 0===e&&(e=0),void 0===i&&(i=0),this._onValueChanged=null,this._x=t,this._y=n,this._z=e,this._w=i}var e=t.prototype;return e.set=function(t,n,e,i){return this._x=t,this._y=n,this._z=e,this._w=i,this._onValueChanged&&this._onValueChanged(),this},e.add=function(t){return this._x+=t._x,this._y+=t._y,this._z+=t._z,this._w+=t._w,this._onValueChanged&&this._onValueChanged(),this},e.subtract=function(t){return this._x-=t._x,this._y-=t._y,this._z-=t._z,this._w-=t._w,this._onValueChanged&&this._onValueChanged(),this},e.multiply=function(t){return this._x*=t._x,this._y*=t._y,this._z*=t._z,this._w*=t._w,this._onValueChanged&&this._onValueChanged(),this},e.divide=function(t){return this._x/=t._x,this._y/=t._y,this._z/=t._z,this._w/=t._w,this._onValueChanged&&this._onValueChanged(),this},e.length=function(){var t=this._x,n=this._y,e=this._z,i=this._w;return Math.sqrt(t*t+n*n+e*e+i*i)},e.lengthSquared=function(){var t=this._x,n=this._y,e=this._z,i=this._w;return t*t+n*n+e*e+i*i},e.negate=function(){return this._x=-this._x,this._y=-this._y,this._z=-this._z,this._w=-this._w,this._onValueChanged&&this._onValueChanged(),this},e.normalize=function(){return t.normalize(this,this),this},e.scale=function(t){return this._x*=t,this._y*=t,this._z*=t,this._w*=t,this._onValueChanged&&this._onValueChanged(),this},e.clone=function(){return new t(this._x,this._y,this._z,this._w)},e.copyFrom=function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onValueChanged&&this._onValueChanged(),this},e.copyFromArray=function(t,n){return void 0===n&&(n=0),this._x=t[n],this._y=t[n+1],this._z=t[n+2],this._w=t[n+3],this._onValueChanged&&this._onValueChanged(),this},e.copyToArray=function(t,n){void 0===n&&(n=0),t[n]=this._x,t[n+1]=this._y,t[n+2]=this._z,t[n+3]=this._w},e.toJSON=function(){return{x:this._x,y:this._y,z:this._z,w:this._w}},t.add=function(t,n,e){e._x=t._x+n._x,e._y=t._y+n._y,e._z=t._z+n._z,e._w=t._w+n._w,e._onValueChanged&&e._onValueChanged()},t.subtract=function(t,n,e){e._x=t._x-n._x,e._y=t._y-n._y,e._z=t._z-n._z,e._w=t._w-n._w,e._onValueChanged&&e._onValueChanged()},t.multiply=function(t,n,e){e._x=t._x*n._x,e._y=t._y*n._y,e._z=t._z*n._z,e._w=t._w*n._w,e._onValueChanged&&e._onValueChanged()},t.divide=function(t,n,e){e._x=t._x/n._x,e._y=t._y/n._y,e._z=t._z/n._z,e._w=t._w/n._w,e._onValueChanged&&e._onValueChanged()},t.dot=function(t,n){return t._x*n._x+t._y*n._y+t._z*n._z+t._w*n._w},t.distance=function(t,n){var e=n._x-t._x,i=n._y-t._y,a=n._z-t._z,_=n._w-t._w;return Math.sqrt(e*e+i*i+a*a+_*_)},t.distanceSquared=function(t,n){var e=n._x-t._x,i=n._y-t._y,a=n._z-t._z,_=n._w-t._w;return e*e+i*i+a*a+_*_},t.equals=function(t,n){return _.equals(t._x,n._x)&&_.equals(t._y,n._y)&&_.equals(t._z,n._z)&&_.equals(t._w,n._w)},t.lerp=function(t,n,e,i){var a=t._x,_=t._y,r=t._z,s=t._w;i._x=a+(n._x-a)*e,i._y=_+(n._y-_)*e,i._z=r+(n._z-r)*e,i._w=s+(n._w-s)*e,i._onValueChanged&&i._onValueChanged()},t.max=function(t,n,e){e._x=Math.max(t._x,n._x),e._y=Math.max(t._y,n._y),e._z=Math.max(t._z,n._z),e._w=Math.max(t._w,n._w),e._onValueChanged&&e._onValueChanged()},t.min=function(t,n,e){e._x=Math.min(t._x,n._x),e._y=Math.min(t._y,n._y),e._z=Math.min(t._z,n._z),e._w=Math.min(t._w,n._w),e._onValueChanged&&e._onValueChanged()},t.negate=function(t,n){n._x=-t._x,n._y=-t._y,n._z=-t._z,n._w=-t._w,n._onValueChanged&&n._onValueChanged()},t.normalize=function(t,n){var e=t._x,i=t._y,a=t._z,r=t._w,s=Math.sqrt(e*e+i*i+a*a+r*r);s>_.zeroTolerance&&(s=1/s,n._x=e*s,n._y=i*s,n._z=a*s,n._w=r*s,n._onValueChanged&&n._onValueChanged())},t.scale=function(t,n,e){e._x=t._x*n,e._y=t._y*n,e._z=t._z*n,e._w=t._w*n,e._onValueChanged&&e._onValueChanged()},t.transform=function(t,n,e){var i=t._x,a=t._y,_=t._z,r=t._w,s=n.elements;e._x=i*s[0]+a*s[4]+_*s[8]+r*s[12],e._y=i*s[1]+a*s[5]+_*s[9]+r*s[13],e._z=i*s[2]+a*s[6]+_*s[10]+r*s[14],e._w=i*s[3]+a*s[7]+_*s[11]+r*s[15],e._onValueChanged&&e._onValueChanged()},t.transformByQuat=function(t,n,e){var i=t._x,a=t._y,_=t._z,r=t._w,s=n._x,o=n._y,h=n._z,u=n._w,c=u*i+o*_-h*a,l=u*a+h*i-s*_,y=u*_+s*a-o*i,d=-s*i-o*a-h*_;e._x=c*u-d*s-l*h+y*o,e._y=l*u-d*o-y*s+c*h,e._z=y*u-d*h-c*o+l*s,e._w=r,e._onValueChanged&&e._onValueChanged()},n._(t,[{key:"x",get:function(){return this._x},set:function(t){this._x=t,this._onValueChanged&&this._onValueChanged()}},{key:"y",get:function(){return this._y},set:function(t){this._y=t,this._onValueChanged&&this._onValueChanged()}},{key:"z",get:function(){return this._z},set:function(t){this._z=t,this._onValueChanged&&this._onValueChanged()}},{key:"w",get:function(){return this._w},set:function(t){this._w=t,this._onValueChanged&&this._onValueChanged()}}]),t}();x._zero=new x(0,0,0,0),x._one=new x(1,1,1,1);var g=function(){function t(t,n,e,i){void 0===t&&(t=1),void 0===n&&(n=1),void 0===e&&(e=1),void 0===i&&(i=1),this._onValueChanged=null,this._r=t,this._g=n,this._b=e,this._a=i}var e=t.prototype;return e.set=function(t,n,e,i){return this._r=t,this._g=n,this._b=e,this._a=i,this._onValueChanged&&this._onValueChanged(),this},e.add=function(t){return this._r+=t._r,this._g+=t._g,this._b+=t._b,this._a+=t._a,this._onValueChanged&&this._onValueChanged(),this},e.scale=function(t){return this._r*=t,this._g*=t,this._b*=t,this._a*=t,this._onValueChanged&&this._onValueChanged(),this},e.clone=function(){return new t(this._r,this._g,this._b,this._a)},e.copyFrom=function(t){return this._r=t.r,this._g=t.g,this._b=t.b,this._a=t.a,this._onValueChanged&&this._onValueChanged(),this},e.toLinear=function(n){return n._r=t.gammaToLinearSpace(this._r),n._g=t.gammaToLinearSpace(this._g),n._b=t.gammaToLinearSpace(this._b),this._onValueChanged&&this._onValueChanged(),n},e.toGamma=function(n){return n._r=t.linearToGammaSpace(this._r),n._g=t.linearToGammaSpace(this._g),n._b=t.linearToGammaSpace(this._b),this._onValueChanged&&this._onValueChanged(),n},e.getBrightness=function(){var t=this.r,n=this.g,e=this.b,i=t,a=t;return n>i&&(i=n),e>i&&(i=e),n<a&&(a=n),e<a&&(a=e),(i+a)/2},e.toJSON=function(){return{r:this._r,g:this._g,b:this._b,a:this._a}},t.gammaToLinearSpace=function(t){return t<=0?0:t<=.04045?t/12.92:t<1?Math.pow((t+.055)/1.055,2.4):Math.pow(t,2.4)},t.linearToGammaSpace=function(t){return t<=0?0:t<.0031308?12.92*t:t<1?1.055*Math.pow(t,.41666)-.055:Math.pow(t,.41666)},t.equals=function(t,n){return _.equals(t._r,n._r)&&_.equals(t._g,n._g)&&_.equals(t._b,n._b)&&_.equals(t._a,n._a)},t.add=function(t,n,e){return e._r=t._r+n._r,e._g=t._g+n._g,e._b=t._b+n._b,e._a=t._a+n._a,e._onValueChanged&&e._onValueChanged(),e},t.subtract=function(t,n,e){e._r=t._r-n._r,e._g=t._g-n._g,e._b=t._b-n._b,e._a=t._a-n._a,e._onValueChanged&&e._onValueChanged()},t.scale=function(t,n,e){return e._r=t._r*n,e._g=t._g*n,e._b=t._b*n,e._a=t._a*n,e._onValueChanged&&e._onValueChanged(),e},t.lerp=function(t,n,e,i){var a=t._r,_=t._g,r=t._b,s=t._a;return i._r=a+(n._r-a)*e,i._g=_+(n._g-_)*e,i._b=r+(n._b-r)*e,i._a=s+(n._a-s)*e,i._onValueChanged&&i._onValueChanged(),i},n._(t,[{key:"r",get:function(){return this._r},set:function(t){this._r=t,this._onValueChanged&&this._onValueChanged()}},{key:"g",get:function(){return this._g},set:function(t){this._g=t,this._onValueChanged&&this._onValueChanged()}},{key:"b",get:function(){return this._b},set:function(t){this._b=t,this._onValueChanged&&this._onValueChanged()}},{key:"a",get:function(){return this._a},set:function(t){this._a=t,this._onValueChanged&&this._onValueChanged()}}]),t}(),z=function(){function t(t,n,e,i){void 0===t&&(t=0),void 0===n&&(n=0),void 0===e&&(e=0),void 0===i&&(i=0),this.x=t,this.y=n,this.width=e,this.height=i}var n=t.prototype;return n.set=function(t,n,e,i){return this.x=t,this.y=n,this.width=e,this.height=i,this},n.clone=function(){return new t(this.x,this.y,this.width,this.height)},n.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this},t}(),V=function(){function t(){this.coefficients=new Float32Array(27)}var n=t.prototype;return n.addLight=function(t,n,e){n.scale(e);var i=this.coefficients,a=t._x,_=t._y,r=t._z,s=n.r,o=n.g,h=n.b,u=-.488603*_,c=.488603*r,l=-.488603*a,y=1.092548*(a*_),d=-1.092548*(_*r),f=.315392*(3*r*r-1),m=-1.092548*(a*r),x=.546274*(a*a-_*_);i[0]+=.282095*s,i[1]+=.282095*o,i[2]+=.282095*h,i[3]+=s*u,i[4]+=o*u,i[5]+=h*u,i[6]+=s*c,i[7]+=o*c,i[8]+=h*c,i[9]+=s*l,i[10]+=o*l,i[11]+=h*l,i[12]+=s*y,i[13]+=o*y,i[14]+=h*y,i[15]+=s*d,i[16]+=o*d,i[17]+=h*d,i[18]+=s*f,i[19]+=o*f,i[20]+=h*f,i[21]+=s*m,i[22]+=o*m,i[23]+=h*m,i[24]+=s*x,i[25]+=o*x,i[26]+=h*x},n.evaluate=function(t,n){var e=this.coefficients,i=t._x,a=t._y,_=t._z,r=-1.023327*a,s=1.023327*_,o=-1.023327*i,h=.858086*a*i,u=-.858086*a*_,c=.247708*(3*_*_-1),l=-.858086*_*i,y=.429042*(i*i-a*a),d=.886227*e[0],f=.886227*e[1],m=.886227*e[2];return d+=e[3]*r+e[6]*s+e[9]*o,f+=e[4]*r+e[7]*s+e[10]*o,m+=e[5]*r+e[8]*s+e[11]*o,d+=e[12]*h+e[15]*u+e[18]*c+e[21]*l+e[24]*y,f+=e[13]*h+e[16]*u+e[19]*c+e[22]*l+e[25]*y,m+=e[14]*h+e[17]*u+e[20]*c+e[23]*l+e[26]*y,n.set(d,f,m,1),n},n.scale=function(t){var n=this.coefficients;n[0]*=t,n[1]*=t,n[2]*=t,n[3]*=t,n[4]*=t,n[5]*=t,n[6]*=t,n[7]*=t,n[8]*=t,n[9]*=t,n[10]*=t,n[11]*=t,n[12]*=t,n[13]*=t,n[14]*=t,n[15]*=t,n[16]*=t,n[17]*=t,n[18]*=t,n[19]*=t,n[20]*=t,n[21]*=t,n[22]*=t,n[23]*=t,n[24]*=t,n[25]*=t,n[26]*=t},n.clone=function(){var n=new t;return n.copyFrom(this),n},n.copyFrom=function(t){return t.copyToArray(this.coefficients),this},n.copyFromArray=function(t,n){void 0===n&&(n=0);var e=this.coefficients;e[0]=t[n],e[1]=t[1+n],e[2]=t[2+n],e[3]=t[3+n],e[4]=t[4+n],e[5]=t[5+n],e[6]=t[6+n],e[7]=t[7+n],e[8]=t[8+n],e[9]=t[9+n],e[10]=t[10+n],e[11]=t[11+n],e[12]=t[12+n],e[13]=t[13+n],e[14]=t[14+n],e[15]=t[15+n],e[16]=t[16+n],e[17]=t[17+n],e[18]=t[18+n],e[19]=t[19+n],e[20]=t[20+n],e[21]=t[21+n],e[22]=t[22+n],e[23]=t[23+n],e[24]=t[24+n],e[25]=t[25+n],e[26]=t[26+n]},n.copyToArray=function(t,n){void 0===n&&(n=0);var e=this.coefficients;t[0+n]=e[0],t[1+n]=e[1],t[2+n]=e[2],t[3+n]=e[3],t[4+n]=e[4],t[5+n]=e[5],t[6+n]=e[6],t[7+n]=e[7],t[8+n]=e[8],t[9+n]=e[9],t[10+n]=e[10],t[11+n]=e[11],t[12+n]=e[12],t[13+n]=e[13],t[14+n]=e[14],t[15+n]=e[15],t[16+n]=e[16],t[17+n]=e[17],t[18+n]=e[18],t[19+n]=e[19],t[20+n]=e[20],t[21+n]=e[21],t[22+n]=e[22],t[23+n]=e[23],t[24+n]=e[24],t[25+n]=e[25],t[26+n]=e[26]},t}();t.BoundingBox=o,t.BoundingFrustum=c,t.BoundingSphere=s,t.CollisionUtil=h,t.Color=g,t.MathUtil=_,t.Matrix=d,t.Matrix3x3=l,t.Plane=u,t.Quaternion=y,t.Ray=f,t.Rect=z,t.SphericalHarmonics3=V,t.Vector2=m,t.Vector3=r,t.Vector4=x,Object.defineProperty(t,"__esModule",{value:!0})});
|