-
Notifications
You must be signed in to change notification settings - Fork 0
/
088d5a4e-4f2cb64570bdf3425971.js
2 lines (2 loc) · 53 KB
/
088d5a4e-4f2cb64570bdf3425971.js
1
2
"use strict";(self.webpackChunkcode_cave=self.webpackChunkcode_cave||[]).push([[770],{5412:function(t,r,e){e.d(r,{FM:function(){return _},Lt:function(){return u},P:function(){return y},_f:function(){return l},jp:function(){return R},y3:function(){return m}});var s=e(1226),i=e(4551),o=e(2554),n=e(646),a=e(1716),c=e(5953);const h=t=>parseInt(t.toString().replace(/\W/g,""));class _{constructor(t=0,r=0){this.x=t,this.y=r}toString(){return`{X: ${this.x} Y: ${this.y}}`}getClassName(){return"Vector2"}getHashCode(){let t=h(this.x);return t=397*t^h(this.y),t}toArray(t,r=0){return t[r]=this.x,t[r 1]=this.y,this}fromArray(t,r=0){return _.FromArrayToRef(t,r,this),this}asArray(){const t=new Array;return this.toArray(t,0),t}copyFrom(t){return this.x=t.x,this.y=t.y,this}copyFromFloats(t,r){return this.x=t,this.y=r,this}set(t,r){return this.copyFromFloats(t,r)}add(t){return new this.constructor(this.x t.x,this.y t.y)}addToRef(t,r){return r.x=this.x t.x,r.y=this.y t.y,r}addInPlace(t){return this.x =t.x,this.y =t.y,this}addVector3(t){return new this.constructor(this.x t.x,this.y t.y)}subtract(t){return new this.constructor(this.x-t.x,this.y-t.y)}subtractToRef(t,r){return r.x=this.x-t.x,r.y=this.y-t.y,r}subtractInPlace(t){return this.x-=t.x,this.y-=t.y,this}multiplyInPlace(t){return this.x*=t.x,this.y*=t.y,this}multiply(t){return new this.constructor(this.x*t.x,this.y*t.y)}multiplyToRef(t,r){return r.x=this.x*t.x,r.y=this.y*t.y,r}multiplyByFloats(t,r){return new this.constructor(this.x*t,this.y*r)}divide(t){return new this.constructor(this.x/t.x,this.y/t.y)}divideToRef(t,r){return r.x=this.x/t.x,r.y=this.y/t.y,r}divideInPlace(t){return this.divideToRef(t,this)}negate(){return new this.constructor(-this.x,-this.y)}negateInPlace(){return this.x*=-1,this.y*=-1,this}negateToRef(t){return t.copyFromFloats(-1*this.x,-1*this.y)}scaleInPlace(t){return this.x*=t,this.y*=t,this}scale(t){const r=new this.constructor(0,0);return this.scaleToRef(t,r),r}scaleToRef(t,r){return r.x=this.x*t,r.y=this.y*t,r}scaleAndAddToRef(t,r){return r.x =this.x*t,r.y =this.y*t,r}equals(t){return t&&this.x===t.x&&this.y===t.y}equalsWithEpsilon(t,r=i.kn){return t&&s.R.WithinEpsilon(this.x,t.x,r)&&s.R.WithinEpsilon(this.y,t.y,r)}floor(){return new this.constructor(Math.floor(this.x),Math.floor(this.y))}fract(){return new this.constructor(this.x-Math.floor(this.x),this.y-Math.floor(this.y))}rotateToRef(t,r){const e=Math.cos(t),s=Math.sin(t),i=e*this.x-s*this.y,o=s*this.x e*this.y;return r.x=i,r.y=o,r}length(){return Math.sqrt(this.x*this.x this.y*this.y)}lengthSquared(){return this.x*this.x this.y*this.y}normalize(){return _.NormalizeToRef(this,this),this}clone(){return new this.constructor(this.x,this.y)}static Zero(){return new _(0,0)}static One(){return new _(1,1)}static Random(t=0,r=1){return new _(s.R.RandomRange(t,r),s.R.RandomRange(t,r))}static get ZeroReadOnly(){return _._ZeroReadOnly}static FromArray(t,r=0){return new _(t[r],t[r 1])}static FromArrayToRef(t,r,e){return e.x=t[r],e.y=t[r 1],e}static CatmullRom(t,r,e,s,i){const o=i*i,n=i*o,a=.5*(2*r.x (-t.x e.x)*i (2*t.x-5*r.x 4*e.x-s.x)*o (-t.x 3*r.x-3*e.x s.x)*n),c=.5*(2*r.y (-t.y e.y)*i (2*t.y-5*r.y 4*e.y-s.y)*o (-t.y 3*r.y-3*e.y s.y)*n);return new t.constructor(a,c)}static Clamp(t,r,e){let s=t.x;s=s>e.x?e.x:s,s=s<r.x?r.x:s;let i=t.y;return i=i>e.y?e.y:i,i=i<r.y?r.y:i,new t.constructor(s,i)}static Hermite(t,r,e,s,i){const o=i*i,n=i*o,a=2*n-3*o 1,c=-2*n 3*o,h=n-2*o i,_=n-o,y=t.x*a e.x*c r.x*h s.x*_,u=t.y*a e.y*c r.y*h s.y*_;return new t.constructor(y,u)}static Hermite1stDerivative(t,r,e,s,i){const o=new t.constructor;return this.Hermite1stDerivativeToRef(t,r,e,s,i,o),o}static Hermite1stDerivativeToRef(t,r,e,s,i,o){const n=i*i;return o.x=6*(n-i)*t.x (3*n-4*i 1)*r.x 6*(-n i)*e.x (3*n-2*i)*s.x,o.y=6*(n-i)*t.y (3*n-4*i 1)*r.y 6*(-n i)*e.y (3*n-2*i)*s.y,o}static Lerp(t,r,e){const s=t.x (r.x-t.x)*e,i=t.y (r.y-t.y)*e;return new t.constructor(s,i)}static Dot(t,r){return t.x*r.x t.y*r.y}static Normalize(t){const r=new t.constructor;return this.NormalizeToRef(t,r),r}static NormalizeToRef(t,r){const e=t.length();return 0===e||(r.x=t.x/e,r.y=t.y/e),r}static Minimize(t,r){const e=t.x<r.x?t.x:r.x,s=t.y<r.y?t.y:r.y;return new t.constructor(e,s)}static Maximize(t,r){const e=t.x>r.x?t.x:r.x,s=t.y>r.y?t.y:r.y;return new t.constructor(e,s)}static Transform(t,r){const e=new t.constructor;return _.TransformToRef(t,r,e),e}static TransformToRef(t,r,e){const s=r.m,i=t.x*s[0] t.y*s[4] s[12],o=t.x*s[1] t.y*s[5] s[13];return e.x=i,e.y=o,e}static PointInTriangle(t,r,e,s){const i=.5*(-e.y*s.x r.y*(-e.x s.x) r.x*(e.y-s.y) e.x*s.y),o=i<0?-1:1,n=(r.y*s.x-r.x*s.y (s.y-r.y)*t.x (r.x-s.x)*t.y)*o,a=(r.x*e.y-r.y*e.x (r.y-e.y)*t.x (e.x-r.x)*t.y)*o;return n>0&&a>0&&n a<2*i*o}static Distance(t,r){return Math.sqrt(_.DistanceSquared(t,r))}static DistanceSquared(t,r){const e=t.x-r.x,s=t.y-r.y;return e*e s*s}static Center(t,r){const e=new t.constructor;return _.CenterToRef(t,r,e)}static CenterToRef(t,r,e){return e.copyFromFloats((t.x r.x)/2,(t.y r.y)/2)}static DistanceOfPointFromSegment(t,r,e){const s=_.DistanceSquared(r,e);if(0===s)return _.Distance(t,r);const i=e.subtract(r),o=Math.max(0,Math.min(1,_.Dot(t.subtract(r),i)/s)),n=r.add(i.multiplyByFloats(o,o));return _.Distance(t,n)}}_._ZeroReadOnly=_.Zero();class y{get x(){return this._x}set x(t){this._x=t,this._isDirty=!0}get y(){return this._y}set y(t){this._y=t,this._isDirty=!0}get z(){return this._z}set z(t){this._z=t,this._isDirty=!0}constructor(t=0,r=0,e=0){this._isDirty=!0,this._x=t,this._y=r,this._z=e}toString(){return`{X: ${this._x} Y: ${this._y} Z: ${this._z}}`}getClassName(){return"Vector3"}getHashCode(){let t=h(this._x);return t=397*t^h(this._y),t=397*t^h(this._z),t}asArray(){const t=[];return this.toArray(t,0),t}toArray(t,r=0){return t[r]=this._x,t[r 1]=this._y,t[r 2]=this._z,this}fromArray(t,r=0){return y.FromArrayToRef(t,r,this),this}toQuaternion(){return l.RotationYawPitchRoll(this._y,this._x,this._z)}addInPlace(t){return this.addInPlaceFromFloats(t._x,t._y,t._z)}addInPlaceFromFloats(t,r,e){return this._x =t,this._y =r,this._z =e,this._isDirty=!0,this}add(t){return new this.constructor(this._x t._x,this._y t._y,this._z t._z)}addToRef(t,r){return r.copyFromFloats(this._x t._x,this._y t._y,this._z t._z)}subtractInPlace(t){return this._x-=t._x,this._y-=t._y,this._z-=t._z,this._isDirty=!0,this}subtract(t){return new this.constructor(this._x-t._x,this._y-t._y,this._z-t._z)}subtractToRef(t,r){return this.subtractFromFloatsToRef(t._x,t._y,t._z,r)}subtractFromFloats(t,r,e){return new this.constructor(this._x-t,this._y-r,this._z-e)}subtractFromFloatsToRef(t,r,e,s){return s.copyFromFloats(this._x-t,this._y-r,this._z-e)}negate(){return new this.constructor(-this._x,-this._y,-this._z)}negateInPlace(){return this._x*=-1,this._y*=-1,this._z*=-1,this._isDirty=!0,this}negateToRef(t){return t.copyFromFloats(-1*this._x,-1*this._y,-1*this._z)}scaleInPlace(t){return this._x*=t,this._y*=t,this._z*=t,this._isDirty=!0,this}scale(t){return new this.constructor(this._x*t,this._y*t,this._z*t)}scaleToRef(t,r){return r.copyFromFloats(this._x*t,this._y*t,this._z*t)}getNormalToRef(t){const r=this.length();let e=Math.acos(this.y/r);const s=Math.atan2(this.z,this.x);e>Math.PI/2?e-=Math.PI/2:e =Math.PI/2;const i=r*Math.sin(e)*Math.cos(s),o=r*Math.cos(e),n=r*Math.sin(e)*Math.sin(s);return t.set(i,o,n),t}applyRotationQuaternionToRef(t,r){const e=t._w*this._x t._y*this._z-t._z*this._y,s=t._w*this._y t._z*this._x-t._x*this._z,i=t._w*this._z t._x*this._y-t._y*this._x,o=-t._x*this._x-t._y*this._y-t._z*this._z;return r._x=e*t._w o*-t._x s*-t._z-i*-t._y,r._y=s*t._w o*-t._y i*-t._x-e*-t._z,r._z=i*t._w o*-t._z e*-t._y-s*-t._x,r._isDirty=!0,r}applyRotationQuaternionInPlace(t){return this.applyRotationQuaternionToRef(t,this)}applyRotationQuaternion(t){return this.applyRotationQuaternionToRef(t,new this.constructor)}scaleAndAddToRef(t,r){return r.addInPlaceFromFloats(this._x*t,this._y*t,this._z*t)}projectOnPlane(t,r){const e=new this.constructor;return this.projectOnPlaneToRef(t,r,e),e}projectOnPlaneToRef(t,r,e){const s=t.normal,i=t.d,o=x.Vector3[0];this.subtractToRef(r,o),o.normalize();const n=y.Dot(o,s);if(Math.abs(n)<Math.pow(10,-10))e.setAll(1/0);else{const t=-(y.Dot(r,s) i)/n,a=o.scaleInPlace(t);r.addToRef(a,e)}return e}equals(t){return t&&this._x===t._x&&this._y===t._y&&this._z===t._z}equalsWithEpsilon(t,r=i.kn){return t&&s.R.WithinEpsilon(this._x,t._x,r)&&s.R.WithinEpsilon(this._y,t._y,r)&&s.R.WithinEpsilon(this._z,t._z,r)}equalsToFloats(t,r,e){return this._x===t&&this._y===r&&this._z===e}multiplyInPlace(t){return this._x*=t._x,this._y*=t._y,this._z*=t._z,this._isDirty=!0,this}multiply(t){return this.multiplyByFloats(t._x,t._y,t._z)}multiplyToRef(t,r){return r.copyFromFloats(this._x*t._x,this._y*t._y,this._z*t._z)}multiplyByFloats(t,r,e){return new this.constructor(this._x*t,this._y*r,this._z*e)}divide(t){return new this.constructor(this._x/t._x,this._y/t._y,this._z/t._z)}divideToRef(t,r){return r.copyFromFloats(this._x/t._x,this._y/t._y,this._z/t._z)}divideInPlace(t){return this.divideToRef(t,this)}minimizeInPlace(t){return this.minimizeInPlaceFromFloats(t._x,t._y,t._z)}maximizeInPlace(t){return this.maximizeInPlaceFromFloats(t._x,t._y,t._z)}minimizeInPlaceFromFloats(t,r,e){return t<this._x&&(this.x=t),r<this._y&&(this.y=r),e<this._z&&(this.z=e),this}maximizeInPlaceFromFloats(t,r,e){return t>this._x&&(this.x=t),r>this._y&&(this.y=r),e>this._z&&(this.z=e),this}isNonUniformWithinEpsilon(t){const r=Math.abs(this._x),e=Math.abs(this._y);if(!s.R.WithinEpsilon(r,e,t))return!0;const i=Math.abs(this._z);return!s.R.WithinEpsilon(r,i,t)||!s.R.WithinEpsilon(e,i,t)}get isNonUniform(){const t=Math.abs(this._x);if(t!==Math.abs(this._y))return!0;return t!==Math.abs(this._z)}floor(){return new this.constructor(Math.floor(this._x),Math.floor(this._y),Math.floor(this._z))}fract(){return new this.constructor(this._x-Math.floor(this._x),this._y-Math.floor(this._y),this._z-Math.floor(this._z))}length(){return Math.sqrt(this._x*this._x this._y*this._y this._z*this._z)}lengthSquared(){return this._x*this._x this._y*this._y this._z*this._z}get hasAZeroComponent(){return this._x*this._y*this._z==0}normalize(){return this.normalizeFromLength(this.length())}reorderInPlace(t){return"xyz"===(t=t.toLowerCase())||(x.Vector3[0].copyFrom(this),["x","y","z"].forEach(((r,e)=>{this[r]=x.Vector3[0][t[e]]}))),this}rotateByQuaternionToRef(t,r){return t.toRotationMatrix(x.Matrix[0]),y.TransformCoordinatesToRef(this,x.Matrix[0],r),r}rotateByQuaternionAroundPointToRef(t,r,e){return this.subtractToRef(r,x.Vector3[0]),x.Vector3[0].rotateByQuaternionToRef(t,x.Vector3[0]),r.addToRef(x.Vector3[0],e),e}cross(t){const r=new this.constructor;return y.CrossToRef(this,t,r)}normalizeFromLength(t){return 0===t||1===t?this:this.scaleInPlace(1/t)}normalizeToNew(){const t=new this.constructor(0,0,0);return this.normalizeToRef(t),t}normalizeToRef(t){const r=this.length();return 0===r||1===r?t.copyFromFloats(this._x,this._y,this._z):this.scaleToRef(1/r,t)}clone(){return new this.constructor(this._x,this._y,this._z)}copyFrom(t){return this.copyFromFloats(t._x,t._y,t._z)}copyFromFloats(t,r,e){return this._x=t,this._y=r,this._z=e,this._isDirty=!0,this}set(t,r,e){return this.copyFromFloats(t,r,e)}setAll(t){return this._x=this._y=this._z=t,this._isDirty=!0,this}static GetClipFactor(t,r,e,s){const i=y.Dot(t,e)-s;return i/(i-(y.Dot(r,e)-s))}static GetAngleBetweenVectors(t,r,e){const i=t.normalizeToRef(x.Vector3[1]),o=r.normalizeToRef(x.Vector3[2]);let n=y.Dot(i,o);n=s.R.Clamp(n,-1,1);const a=Math.acos(n),c=x.Vector3[3];return y.CrossToRef(i,o,c),y.Dot(c,e)>0?isNaN(a)?0:a:isNaN(a)?-Math.PI:-Math.acos(n)}static GetAngleBetweenVectorsOnPlane(t,r,e){x.Vector3[0].copyFrom(t);const i=x.Vector3[0];x.Vector3[1].copyFrom(r);const o=x.Vector3[1];x.Vector3[2].copyFrom(e);const n=x.Vector3[2],a=x.Vector3[3],c=x.Vector3[4];i.normalize(),o.normalize(),n.normalize(),y.CrossToRef(n,i,a),y.CrossToRef(a,n,c);const h=Math.atan2(y.Dot(o,a),y.Dot(o,c));return s.R.NormalizeRadians(h)}static PitchYawRollToMoveBetweenPointsToRef(t,r,e){const s=R.Vector3[0];return r.subtractToRef(t,s),e._y=Math.atan2(s.x,s.z)||0,e._x=Math.atan2(Math.sqrt(s.x**2 s.z**2),s.y)||0,e._z=0,e._isDirty=!0,e}static PitchYawRollToMoveBetweenPoints(t,r){const e=y.Zero();return y.PitchYawRollToMoveBetweenPointsToRef(t,r,e)}static SlerpToRef(t,r,e,o){e=s.R.Clamp(e,0,1);const n=x.Vector3[0],a=x.Vector3[1];n.copyFrom(t);const c=n.length();n.normalizeFromLength(c),a.copyFrom(r);const h=a.length();a.normalizeFromLength(h);const _=y.Dot(n,a);let u,l;if(_<1-i.kn){const t=Math.acos(_),r=1/Math.sin(t);u=Math.sin((1-e)*t)*r,l=Math.sin(e*t)*r}else u=1-e,l=e;return n.scaleInPlace(u),a.scaleInPlace(l),o.copyFrom(n).addInPlace(a),o.scaleInPlace(s.R.Lerp(c,h,e)),o}static SmoothToRef(t,r,e,s,i){return y.SlerpToRef(t,r,0===s?1:e/s,i),i}static FromArray(t,r=0){return new y(t[r],t[r 1],t[r 2])}static FromFloatArray(t,r){return y.FromArray(t,r)}static FromArrayToRef(t,r,e){return e._x=t[r],e._y=t[r 1],e._z=t[r 2],e._isDirty=!0,e}static FromFloatArrayToRef(t,r,e){return y.FromArrayToRef(t,r,e)}static FromFloatsToRef(t,r,e,s){return s.copyFromFloats(t,r,e),s}static Zero(){return new y(0,0,0)}static One(){return new y(1,1,1)}static Up(){return new y(0,1,0)}static get UpReadOnly(){return y._UpReadOnly}static get DownReadOnly(){return y._DownReadOnly}static get RightReadOnly(){return y._RightReadOnly}static get LeftReadOnly(){return y._LeftReadOnly}static get LeftHandedForwardReadOnly(){return y._LeftHandedForwardReadOnly}static get RightHandedForwardReadOnly(){return y._RightHandedForwardReadOnly}static get LeftHandedBackwardReadOnly(){return y._LeftHandedBackwardReadOnly}static get RightHandedBackwardReadOnly(){return y._RightHandedBackwardReadOnly}static get ZeroReadOnly(){return y._ZeroReadOnly}static get OneReadOnly(){return y._OneReadOnly}static Down(){return new y(0,-1,0)}static Forward(t=!1){return new y(0,0,t?-1:1)}static Backward(t=!1){return new y(0,0,t?1:-1)}static Right(){return new y(1,0,0)}static Left(){return new y(-1,0,0)}static Random(t=0,r=1){return new y(s.R.RandomRange(t,r),s.R.RandomRange(t,r),s.R.RandomRange(t,r))}static TransformCoordinates(t,r){const e=y.Zero();return y.TransformCoordinatesToRef(t,r,e),e}static TransformCoordinatesToRef(t,r,e){return y.TransformCoordinatesFromFloatsToRef(t._x,t._y,t._z,r,e),e}static TransformCoordinatesFromFloatsToRef(t,r,e,s,i){const o=s.m,n=t*o[0] r*o[4] e*o[8] o[12],a=t*o[1] r*o[5] e*o[9] o[13],c=t*o[2] r*o[6] e*o[10] o[14],h=1/(t*o[3] r*o[7] e*o[11] o[15]);return i._x=n*h,i._y=a*h,i._z=c*h,i._isDirty=!0,i}static TransformNormal(t,r){const e=y.Zero();return y.TransformNormalToRef(t,r,e),e}static TransformNormalToRef(t,r,e){return this.TransformNormalFromFloatsToRef(t._x,t._y,t._z,r,e),e}static TransformNormalFromFloatsToRef(t,r,e,s,i){const o=s.m;return i._x=t*o[0] r*o[4] e*o[8],i._y=t*o[1] r*o[5] e*o[9],i._z=t*o[2] r*o[6] e*o[10],i._isDirty=!0,i}static CatmullRom(t,r,e,s,i){const o=i*i,n=i*o,a=.5*(2*r._x (-t._x e._x)*i (2*t._x-5*r._x 4*e._x-s._x)*o (-t._x 3*r._x-3*e._x s._x)*n),c=.5*(2*r._y (-t._y e._y)*i (2*t._y-5*r._y 4*e._y-s._y)*o (-t._y 3*r._y-3*e._y s._y)*n),h=.5*(2*r._z (-t._z e._z)*i (2*t._z-5*r._z 4*e._z-s._z)*o (-t._z 3*r._z-3*e._z s._z)*n);return new t.constructor(a,c,h)}static Clamp(t,r,e){const s=new t.constructor;return y.ClampToRef(t,r,e,s),s}static ClampToRef(t,r,e,s){let i=t._x;i=i>e._x?e._x:i,i=i<r._x?r._x:i;let o=t._y;o=o>e._y?e._y:o,o=o<r._y?r._y:o;let n=t._z;return n=n>e._z?e._z:n,n=n<r._z?r._z:n,s.copyFromFloats(i,o,n),s}static CheckExtends(t,r,e){r.minimizeInPlace(t),e.maximizeInPlace(t)}static Hermite(t,r,e,s,i){const o=i*i,n=i*o,a=2*n-3*o 1,c=-2*n 3*o,h=n-2*o i,_=n-o,y=t._x*a e._x*c r._x*h s._x*_,u=t._y*a e._y*c r._y*h s._y*_,l=t._z*a e._z*c r._z*h s._z*_;return new t.constructor(y,u,l)}static Hermite1stDerivative(t,r,e,s,i){const o=new t.constructor;return this.Hermite1stDerivativeToRef(t,r,e,s,i,o),o}static Hermite1stDerivativeToRef(t,r,e,s,i,o){const n=i*i;return o._x=6*(n-i)*t._x (3*n-4*i 1)*r._x 6*(-n i)*e._x (3*n-2*i)*s._x,o._y=6*(n-i)*t._y (3*n-4*i 1)*r._y 6*(-n i)*e._y (3*n-2*i)*s._y,o._z=6*(n-i)*t._z (3*n-4*i 1)*r._z 6*(-n i)*e._z (3*n-2*i)*s._z,o._isDirty=!0,o}static Lerp(t,r,e){const s=new t.constructor(0,0,0);return y.LerpToRef(t,r,e,s),s}static LerpToRef(t,r,e,s){return s._x=t._x (r._x-t._x)*e,s._y=t._y (r._y-t._y)*e,s._z=t._z (r._z-t._z)*e,s._isDirty=!0,s}static Dot(t,r){return t._x*r._x t._y*r._y t._z*r._z}static Cross(t,r){const e=new t.constructor;return y.CrossToRef(t,r,e),e}static CrossToRef(t,r,e){const s=t._y*r._z-t._z*r._y,i=t._z*r._x-t._x*r._z,o=t._x*r._y-t._y*r._x;return e.copyFromFloats(s,i,o),e}static Normalize(t){const r=y.Zero();return y.NormalizeToRef(t,r),r}static NormalizeToRef(t,r){return t.normalizeToRef(r),r}static Project(t,r,e,s){const i=new t.constructor;return y.ProjectToRef(t,r,e,s,i),i}static ProjectToRef(t,r,e,s,i){const o=s.width,n=s.height,a=s.x,c=s.y,h=x.Matrix[1];m.FromValuesToRef(o/2,0,0,0,0,-n/2,0,0,0,0,.5,0,a o/2,n/2 c,.5,1,h);const _=x.Matrix[0];return r.multiplyToRef(e,_),_.multiplyToRef(h,_),y.TransformCoordinatesToRef(t,_,i),i}static Reflect(t,r){return this.ReflectToRef(t,r,new y)}static ReflectToRef(t,r,e){const s=R.Vector3[0];return s.copyFrom(r).scaleInPlace(2*y.Dot(t,r)),e.copyFrom(t).subtractInPlace(s)}static _UnprojectFromInvertedMatrixToRef(t,r,e){y.TransformCoordinatesToRef(t,r,e);const i=r.m,o=t._x*i[3] t._y*i[7] t._z*i[11] i[15];return s.R.WithinEpsilon(o,1)&&e.scaleInPlace(1/o),e}static UnprojectFromTransform(t,r,e,s,i){return this.Unproject(t,r,e,s,i,m.IdentityReadOnly)}static Unproject(t,r,e,s,i,o){const n=new t.constructor;return y.UnprojectToRef(t,r,e,s,i,o,n),n}static UnprojectToRef(t,r,e,s,i,o,n){return y.UnprojectFloatsToRef(t._x,t._y,t._z,r,e,s,i,o,n),n}static UnprojectFloatsToRef(t,r,e,s,i,o,n,a,h){var _;const u=x.Matrix[0];o.multiplyToRef(n,u),u.multiplyToRef(a,u),u.invert();const l=x.Vector3[0];return l.x=t/s*2-1,l.y=-(r/i*2-1),(null===(_=c.l.LastCreatedEngine)||void 0===_?void 0:_.isNDCHalfZRange)?l.z=e:l.z=2*e-1,y._UnprojectFromInvertedMatrixToRef(l,u,h),h}static Minimize(t,r){const e=new t.constructor;return e.copyFrom(t),e.minimizeInPlace(r),e}static Maximize(t,r){const e=new t.constructor;return e.copyFrom(t),e.maximizeInPlace(r),e}static Distance(t,r){return Math.sqrt(y.DistanceSquared(t,r))}static DistanceSquared(t,r){const e=t._x-r._x,s=t._y-r._y,i=t._z-r._z;return e*e s*s i*i}static ProjectOnTriangleToRef(t,r,e,o,n){const a=x.Vector3[0],c=x.Vector3[1],h=x.Vector3[2],_=x.Vector3[3],u=x.Vector3[4];e.subtractToRef(r,a),o.subtractToRef(r,c),o.subtractToRef(e,h);const l=a.length(),m=c.length(),R=h.length();if(l<i.kn||m<i.kn||R<i.kn)return n.copyFrom(r),y.Distance(t,r);t.subtractToRef(r,u),y.CrossToRef(a,c,_);const f=_.length();if(f<i.kn)return n.copyFrom(r),y.Distance(t,r);_.normalizeFromLength(f);let d=u.length();if(d<i.kn)return n.copyFrom(r),0;u.normalizeFromLength(d);const z=y.Dot(_,u),T=x.Vector3[5],w=x.Vector3[6];T.copyFrom(_).scaleInPlace(-d*z),w.copyFrom(t).addInPlace(T);const p=x.Vector3[4],F=x.Vector3[5],M=x.Vector3[7],I=x.Vector3[8];p.copyFrom(a).scaleInPlace(1/l),I.copyFrom(c).scaleInPlace(1/m),p.addInPlace(I).scaleInPlace(-1),F.copyFrom(a).scaleInPlace(-1/l),I.copyFrom(h).scaleInPlace(1/R),F.addInPlace(I).scaleInPlace(-1),M.copyFrom(h).scaleInPlace(-1/R),I.copyFrom(c).scaleInPlace(-1/m),M.addInPlace(I).scaleInPlace(-1);const g=x.Vector3[9];let D;g.copyFrom(w).subtractInPlace(r),y.CrossToRef(p,g,I),D=y.Dot(I,_);const P=D;g.copyFrom(w).subtractInPlace(e),y.CrossToRef(F,g,I),D=y.Dot(I,_);const A=D;g.copyFrom(w).subtractInPlace(o),y.CrossToRef(M,g,I),D=y.Dot(I,_);const V=D,C=x.Vector3[10];let L,k;P>0&&A<0?(C.copyFrom(a),L=r,k=e):A>0&&V<0?(C.copyFrom(h),L=e,k=o):(C.copyFrom(c).scaleInPlace(-1),L=o,k=r);const v=x.Vector3[9],H=x.Vector3[4];L.subtractToRef(w,I),k.subtractToRef(w,v),y.CrossToRef(I,v,H);if(!(y.Dot(H,_)<0))return n.copyFrom(w),Math.abs(d*z);const O=x.Vector3[5];y.CrossToRef(C,H,O),O.normalize();const S=x.Vector3[9];S.copyFrom(L).subtractInPlace(w);const B=S.length();if(B<i.kn)return n.copyFrom(L),y.Distance(t,L);S.normalizeFromLength(B);const U=y.Dot(O,S),b=x.Vector3[7];b.copyFrom(w).addInPlace(O.scaleInPlace(B*U)),I.copyFrom(b).subtractInPlace(L),d=C.length(),C.normalizeFromLength(d);let Z=y.Dot(I,C)/Math.max(d,i.kn);return Z=s.R.Clamp(Z,0,1),b.copyFrom(L).addInPlace(C.scaleInPlace(Z*d)),n.copyFrom(b),y.Distance(t,b)}static Center(t,r){return y.CenterToRef(t,r,y.Zero())}static CenterToRef(t,r,e){return e.copyFromFloats((t._x r._x)/2,(t._y r._y)/2,(t._z r._z)/2)}static RotationFromAxis(t,r,e){const s=new t.constructor;return y.RotationFromAxisToRef(t,r,e,s),s}static RotationFromAxisToRef(t,r,e,s){const i=x.Quaternion[0];return l.RotationQuaternionFromAxisToRef(t,r,e,i),i.toEulerAnglesToRef(s),s}}y._UpReadOnly=y.Up(),y._DownReadOnly=y.Down(),y._LeftHandedForwardReadOnly=y.Forward(!1),y._RightHandedForwardReadOnly=y.Forward(!0),y._LeftHandedBackwardReadOnly=y.Backward(!1),y._RightHandedBackwardReadOnly=y.Backward(!0),y._RightReadOnly=y.Right(),y._LeftReadOnly=y.Left(),y._ZeroReadOnly=y.Zero(),y._OneReadOnly=y.One();class u{constructor(t=0,r=0,e=0,s=0){this.x=t,this.y=r,this.z=e,this.w=s}toString(){return`{X: ${this.x} Y: ${this.y} Z: ${this.z} W: ${this.w}}`}getClassName(){return"Vector4"}getHashCode(){let t=h(this.x);return t=397*t^h(this.y),t=397*t^h(this.z),t=397*t^h(this.w),t}asArray(){const t=new Array;return this.toArray(t,0),t}toArray(t,r){return void 0===r&&(r=0),t[r]=this.x,t[r 1]=this.y,t[r 2]=this.z,t[r 3]=this.w,this}fromArray(t,r=0){return u.FromArrayToRef(t,r,this),this}addInPlace(t){return this.x =t.x,this.y =t.y,this.z =t.z,this.w =t.w,this}add(t){return new this.constructor(this.x t.x,this.y t.y,this.z t.z,this.w t.w)}addToRef(t,r){return r.x=this.x t.x,r.y=this.y t.y,r.z=this.z t.z,r.w=this.w t.w,r}subtractInPlace(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subtract(t){return new this.constructor(this.x-t.x,this.y-t.y,this.z-t.z,this.w-t.w)}subtractToRef(t,r){return r.x=this.x-t.x,r.y=this.y-t.y,r.z=this.z-t.z,r.w=this.w-t.w,r}subtractFromFloats(t,r,e,s){return new this.constructor(this.x-t,this.y-r,this.z-e,this.w-s)}subtractFromFloatsToRef(t,r,e,s,i){return i.x=this.x-t,i.y=this.y-r,i.z=this.z-e,i.w=this.w-s,i}negate(){return new this.constructor(-this.x,-this.y,-this.z,-this.w)}negateInPlace(){return this.x*=-1,this.y*=-1,this.z*=-1,this.w*=-1,this}negateToRef(t){return t.copyFromFloats(-1*this.x,-1*this.y,-1*this.z,-1*this.w)}scaleInPlace(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}scale(t){return new this.constructor(this.x*t,this.y*t,this.z*t,this.w*t)}scaleToRef(t,r){return r.x=this.x*t,r.y=this.y*t,r.z=this.z*t,r.w=this.w*t,r}scaleAndAddToRef(t,r){return r.x =this.x*t,r.y =this.y*t,r.z =this.z*t,r.w =this.w*t,r}equals(t){return t&&this.x===t.x&&this.y===t.y&&this.z===t.z&&this.w===t.w}equalsWithEpsilon(t,r=i.kn){return t&&s.R.WithinEpsilon(this.x,t.x,r)&&s.R.WithinEpsilon(this.y,t.y,r)&&s.R.WithinEpsilon(this.z,t.z,r)&&s.R.WithinEpsilon(this.w,t.w,r)}equalsToFloats(t,r,e,s){return this.x===t&&this.y===r&&this.z===e&&this.w===s}multiplyInPlace(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiply(t){return new this.constructor(this.x*t.x,this.y*t.y,this.z*t.z,this.w*t.w)}multiplyToRef(t,r){return r.x=this.x*t.x,r.y=this.y*t.y,r.z=this.z*t.z,r.w=this.w*t.w,r}multiplyByFloats(t,r,e,s){return new this.constructor(this.x*t,this.y*r,this.z*e,this.w*s)}divide(t){return new this.constructor(this.x/t.x,this.y/t.y,this.z/t.z,this.w/t.w)}divideToRef(t,r){return r.x=this.x/t.x,r.y=this.y/t.y,r.z=this.z/t.z,r.w=this.w/t.w,r}divideInPlace(t){return this.divideToRef(t,this)}minimizeInPlace(t){return t.x<this.x&&(this.x=t.x),t.y<this.y&&(this.y=t.y),t.z<this.z&&(this.z=t.z),t.w<this.w&&(this.w=t.w),this}maximizeInPlace(t){return t.x>this.x&&(this.x=t.x),t.y>this.y&&(this.y=t.y),t.z>this.z&&(this.z=t.z),t.w>this.w&&(this.w=t.w),this}floor(){return new this.constructor(Math.floor(this.x),Math.floor(this.y),Math.floor(this.z),Math.floor(this.w))}fract(){return new this.constructor(this.x-Math.floor(this.x),this.y-Math.floor(this.y),this.z-Math.floor(this.z),this.w-Math.floor(this.w))}length(){return Math.sqrt(this.x*this.x this.y*this.y this.z*this.z this.w*this.w)}lengthSquared(){return this.x*this.x this.y*this.y this.z*this.z this.w*this.w}normalize(){const t=this.length();return 0===t?this:this.scaleInPlace(1/t)}toVector3(){return new y(this.x,this.y,this.z)}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copyFrom(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this}copyFromFloats(t,r,e,s){return this.x=t,this.y=r,this.z=e,this.w=s,this}set(t,r,e,s){return this.copyFromFloats(t,r,e,s)}setAll(t){return this.x=this.y=this.z=this.w=t,this}static FromArray(t,r){return r||(r=0),new u(t[r],t[r 1],t[r 2],t[r 3])}static FromArrayToRef(t,r,e){return e.x=t[r],e.y=t[r 1],e.z=t[r 2],e.w=t[r 3],e}static FromFloatArrayToRef(t,r,e){return u.FromArrayToRef(t,r,e),e}static FromFloatsToRef(t,r,e,s,i){return i.x=t,i.y=r,i.z=e,i.w=s,i}static Zero(){return new u(0,0,0,0)}static One(){return new u(1,1,1,1)}static Random(t=0,r=1){return new u(s.R.RandomRange(t,r),s.R.RandomRange(t,r),s.R.RandomRange(t,r),s.R.RandomRange(t,r))}static get ZeroReadOnly(){return u._ZeroReadOnly}static Normalize(t){const r=u.Zero();return u.NormalizeToRef(t,r),r}static NormalizeToRef(t,r){return r.copyFrom(t),r.normalize(),r}static Minimize(t,r){const e=new t.constructor;return e.copyFrom(t),e.minimizeInPlace(r),e}static Maximize(t,r){const e=new t.constructor;return e.copyFrom(t),e.maximizeInPlace(r),e}static Distance(t,r){return Math.sqrt(u.DistanceSquared(t,r))}static DistanceSquared(t,r){const e=t.x-r.x,s=t.y-r.y,i=t.z-r.z,o=t.w-r.w;return e*e s*s i*i o*o}static Center(t,r){return u.CenterToRef(t,r,u.Zero())}static CenterToRef(t,r,e){return e.copyFromFloats((t.x r.x)/2,(t.y r.y)/2,(t.z r.z)/2,(t.w r.w)/2)}static TransformCoordinates(t,r){const e=u.Zero();return u.TransformCoordinatesToRef(t,r,e),e}static TransformCoordinatesToRef(t,r,e){return u.TransformCoordinatesFromFloatsToRef(t._x,t._y,t._z,r,e),e}static TransformCoordinatesFromFloatsToRef(t,r,e,s,i){const o=s.m,n=t*o[0] r*o[4] e*o[8] o[12],a=t*o[1] r*o[5] e*o[9] o[13],c=t*o[2] r*o[6] e*o[10] o[14],h=t*o[3] r*o[7] e*o[11] o[15];return i.x=n,i.y=a,i.z=c,i.w=h,i}static TransformNormal(t,r){const e=new t.constructor;return u.TransformNormalToRef(t,r,e),e}static TransformNormalToRef(t,r,e){const s=r.m,i=t.x*s[0] t.y*s[4] t.z*s[8],o=t.x*s[1] t.y*s[5] t.z*s[9],n=t.x*s[2] t.y*s[6] t.z*s[10];return e.x=i,e.y=o,e.z=n,e.w=t.w,e}static TransformNormalFromFloatsToRef(t,r,e,s,i,o){const n=i.m;return o.x=t*n[0] r*n[4] e*n[8],o.y=t*n[1] r*n[5] e*n[9],o.z=t*n[2] r*n[6] e*n[10],o.w=s,o}static FromVector3(t,r=0){return new u(t._x,t._y,t._z,r)}}u._ZeroReadOnly=u.Zero();class l{get x(){return this._x}set x(t){this._x=t,this._isDirty=!0}get y(){return this._y}set y(t){this._y=t,this._isDirty=!0}get z(){return this._z}set z(t){this._z=t,this._isDirty=!0}get w(){return this._w}set w(t){this._w=t,this._isDirty=!0}constructor(t=0,r=0,e=0,s=1){this._isDirty=!0,this._x=t,this._y=r,this._z=e,this._w=s}toString(){return`{X: ${this._x} Y: ${this._y} Z: ${this._z} W: ${this._w}}`}getClassName(){return"Quaternion"}getHashCode(){let t=h(this._x);return t=397*t^h(this._y),t=397*t^h(this._z),t=397*t^h(this._w),t}asArray(){return[this._x,this._y,this._z,this._w]}toArray(t,r=0){return t[r]=this._x,t[r 1]=this._y,t[r 2]=this._z,t[r 3]=this._w,this}equals(t){return t&&this._x===t._x&&this._y===t._y&&this._z===t._z&&this._w===t._w}equalsWithEpsilon(t,r=i.kn){return t&&s.R.WithinEpsilon(this._x,t._x,r)&&s.R.WithinEpsilon(this._y,t._y,r)&&s.R.WithinEpsilon(this._z,t._z,r)&&s.R.WithinEpsilon(this._w,t._w,r)}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copyFrom(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._w=t._w,this._isDirty=!0,this}copyFromFloats(t,r,e,s){return this._x=t,this._y=r,this._z=e,this._w=s,this._isDirty=!0,this}set(t,r,e,s){return this.copyFromFloats(t,r,e,s)}add(t){return new this.constructor(this._x t._x,this._y t._y,this._z t._z,this._w t._w)}addInPlace(t){return this._x =t._x,this._y =t._y,this._z =t._z,this._w =t._w,this._isDirty=!0,this}subtract(t){return new this.constructor(this._x-t._x,this._y-t._y,this._z-t._z,this._w-t._w)}subtractInPlace(t){return this._x-=t._x,this._y-=t._y,this._z-=t._z,this._w-=t._w,this._isDirty=!0,this}scale(t){return new this.constructor(this._x*t,this._y*t,this._z*t,this._w*t)}scaleToRef(t,r){return r._x=this._x*t,r._y=this._y*t,r._z=this._z*t,r._w=this._w*t,r._isDirty=!0,r}scaleInPlace(t){return this._x*=t,this._y*=t,this._z*=t,this._w*=t,this._isDirty=!0,this}scaleAndAddToRef(t,r){return r._x =this._x*t,r._y =this._y*t,r._z =this._z*t,r._w =this._w*t,r._isDirty=!0,r}multiply(t){const r=new this.constructor(0,0,0,1);return this.multiplyToRef(t,r),r}multiplyToRef(t,r){const e=this._x*t._w this._y*t._z-this._z*t._y this._w*t._x,s=-this._x*t._z this._y*t._w this._z*t._x this._w*t._y,i=this._x*t._y-this._y*t._x this._z*t._w this._w*t._z,o=-this._x*t._x-this._y*t._y-this._z*t._z this._w*t._w;return r.copyFromFloats(e,s,i,o),r}multiplyInPlace(t){return this.multiplyToRef(t,this),this}conjugateToRef(t){return t.copyFromFloats(-this._x,-this._y,-this._z,this._w),t}conjugateInPlace(){return this._x*=-1,this._y*=-1,this._z*=-1,this._isDirty=!0,this}conjugate(){return new this.constructor(-this._x,-this._y,-this._z,this._w)}invert(){const t=this.conjugate(),r=this.lengthSquared();return 0==r||1==r||t.scaleInPlace(1/r),t}invertInPlace(){this.conjugateInPlace();const t=this.lengthSquared();return 0==t||1==t||this.scaleInPlace(1/t),this}lengthSquared(){return this._x*this._x this._y*this._y this._z*this._z this._w*this._w}length(){return Math.sqrt(this.lengthSquared())}normalize(){const t=this.length();if(0===t)return this;const r=1/t;return this.scaleInPlace(r),this}normalizeToNew(){const t=this.length();if(0===t)return this.clone();const r=1/t;return this.scale(r)}toEulerAngles(){const t=y.Zero();return this.toEulerAnglesToRef(t),t}toEulerAnglesToRef(t){const r=this._z,e=this._x,s=this._y,i=this._w,o=s*r-e*i,n=.4999999;if(o<-n)t._y=2*Math.atan2(s,i),t._x=Math.PI/2,t._z=0,t._isDirty=!0;else if(o>n)t._y=2*Math.atan2(s,i),t._x=-Math.PI/2,t._z=0,t._isDirty=!0;else{const n=i*i,a=r*r,c=e*e,h=s*s;t._z=Math.atan2(2*(e*s r*i),-a-c h n),t._x=Math.asin(-2*o),t._y=Math.atan2(2*(r*e s*i),a-c-h n),t._isDirty=!0}return t}toRotationMatrix(t){return m.FromQuaternionToRef(this,t),t}fromRotationMatrix(t){return l.FromRotationMatrixToRef(t,this),this}static FromRotationMatrix(t){const r=new l;return l.FromRotationMatrixToRef(t,r),r}static FromRotationMatrixToRef(t,r){const e=t.m,s=e[0],i=e[4],o=e[8],n=e[1],a=e[5],c=e[9],h=e[2],_=e[6],y=e[10],u=s a y;let l;return u>0?(l=.5/Math.sqrt(u 1),r._w=.25/l,r._x=(_-c)*l,r._y=(o-h)*l,r._z=(n-i)*l,r._isDirty=!0):s>a&&s>y?(l=2*Math.sqrt(1 s-a-y),r._w=(_-c)/l,r._x=.25*l,r._y=(i n)/l,r._z=(o h)/l,r._isDirty=!0):a>y?(l=2*Math.sqrt(1 a-s-y),r._w=(o-h)/l,r._x=(i n)/l,r._y=.25*l,r._z=(c _)/l,r._isDirty=!0):(l=2*Math.sqrt(1 y-s-a),r._w=(n-i)/l,r._x=(o h)/l,r._y=(c _)/l,r._z=.25*l,r._isDirty=!0),r}static Dot(t,r){return t._x*r._x t._y*r._y t._z*r._z t._w*r._w}static AreClose(t,r,e=.1){const s=l.Dot(t,r);return 1-s*s<=e}static SmoothToRef(t,r,e,i,o){let n=0===i?1:e/i;return n=s.R.Clamp(n,0,1),l.SlerpToRef(t,r,n,o),o}static Zero(){return new l(0,0,0,0)}static Inverse(t){return new t.constructor(-t._x,-t._y,-t._z,t._w)}static InverseToRef(t,r){return r.set(-t._x,-t._y,-t._z,t._w),r}static Identity(){return new l(0,0,0,1)}static IsIdentity(t){return t&&0===t._x&&0===t._y&&0===t._z&&1===t._w}static RotationAxis(t,r){return l.RotationAxisToRef(t,r,new l)}static RotationAxisToRef(t,r,e){const s=Math.sin(r/2);return t.normalize(),e._w=Math.cos(r/2),e._x=t._x*s,e._y=t._y*s,e._z=t._z*s,e._isDirty=!0,e}static FromArray(t,r){return r||(r=0),new l(t[r],t[r 1],t[r 2],t[r 3])}static FromArrayToRef(t,r,e){return e._x=t[r],e._y=t[r 1],e._z=t[r 2],e._w=t[r 3],e._isDirty=!0,e}static FromEulerAngles(t,r,e){const s=new l;return l.RotationYawPitchRollToRef(r,t,e,s),s}static FromEulerAnglesToRef(t,r,e,s){return l.RotationYawPitchRollToRef(r,t,e,s),s}static FromEulerVector(t){const r=new l;return l.RotationYawPitchRollToRef(t._y,t._x,t._z,r),r}static FromEulerVectorToRef(t,r){return l.RotationYawPitchRollToRef(t._y,t._x,t._z,r),r}static FromUnitVectorsToRef(t,r,e,s=i.kn){const o=y.Dot(t,r) 1;return o<s?Math.abs(t.x)>Math.abs(t.z)?e.set(-t.y,t.x,0,0):e.set(0,-t.z,t.y,0):(y.CrossToRef(t,r,R.Vector3[0]),e.set(R.Vector3[0].x,R.Vector3[0].y,R.Vector3[0].z,o)),e.normalize()}static RotationYawPitchRoll(t,r,e){const s=new l;return l.RotationYawPitchRollToRef(t,r,e,s),s}static RotationYawPitchRollToRef(t,r,e,s){const i=.5*e,o=.5*r,n=.5*t,a=Math.sin(i),c=Math.cos(i),h=Math.sin(o),_=Math.cos(o),y=Math.sin(n),u=Math.cos(n);return s._x=u*h*c y*_*a,s._y=y*_*c-u*h*a,s._z=u*_*a-y*h*c,s._w=u*_*c y*h*a,s._isDirty=!0,s}static RotationAlphaBetaGamma(t,r,e){const s=new l;return l.RotationAlphaBetaGammaToRef(t,r,e,s),s}static RotationAlphaBetaGammaToRef(t,r,e,s){const i=.5*(e t),o=.5*(e-t),n=.5*r;return s._x=Math.cos(o)*Math.sin(n),s._y=Math.sin(o)*Math.sin(n),s._z=Math.sin(i)*Math.cos(n),s._w=Math.cos(i)*Math.cos(n),s._isDirty=!0,s}static RotationQuaternionFromAxis(t,r,e){const s=new l(0,0,0,0);return l.RotationQuaternionFromAxisToRef(t,r,e,s),s}static RotationQuaternionFromAxisToRef(t,r,e,s){const i=x.Matrix[0];return m.FromXYZAxesToRef(t.normalize(),r.normalize(),e.normalize(),i),l.FromRotationMatrixToRef(i,s),s}static FromLookDirectionLH(t,r){const e=new l;return l.FromLookDirectionLHToRef(t,r,e),e}static FromLookDirectionLHToRef(t,r,e){const s=x.Matrix[0];return m.LookDirectionLHToRef(t,r,s),l.FromRotationMatrixToRef(s,e),e}static FromLookDirectionRH(t,r){const e=new l;return l.FromLookDirectionRHToRef(t,r,e),e}static FromLookDirectionRHToRef(t,r,e){const s=x.Matrix[0];return m.LookDirectionRHToRef(t,r,s),l.FromRotationMatrixToRef(s,e)}static Slerp(t,r,e){const s=l.Identity();return l.SlerpToRef(t,r,e,s),s}static SlerpToRef(t,r,e,s){let i,o,n=t._x*r._x t._y*r._y t._z*r._z t._w*r._w,a=!1;if(n<0&&(a=!0,n=-n),n>.999999)o=1-e,i=a?-e:e;else{const t=Math.acos(n),r=1/Math.sin(t);o=Math.sin((1-e)*t)*r,i=a?-Math.sin(e*t)*r:Math.sin(e*t)*r}return s._x=o*t._x i*r._x,s._y=o*t._y i*r._y,s._z=o*t._z i*r._z,s._w=o*t._w i*r._w,s._isDirty=!0,s}static Hermite(t,r,e,s,i){const o=i*i,n=i*o,a=2*n-3*o 1,c=-2*n 3*o,h=n-2*o i,_=n-o,y=t._x*a e._x*c r._x*h s._x*_,u=t._y*a e._y*c r._y*h s._y*_,l=t._z*a e._z*c r._z*h s._z*_,m=t._w*a e._w*c r._w*h s._w*_;return new t.constructor(y,u,l,m)}static Hermite1stDerivative(t,r,e,s,i){const o=new t.constructor;return this.Hermite1stDerivativeToRef(t,r,e,s,i,o),o}static Hermite1stDerivativeToRef(t,r,e,s,i,o){const n=i*i;return o._x=6*(n-i)*t._x (3*n-4*i 1)*r._x 6*(-n i)*e._x (3*n-2*i)*s._x,o._y=6*(n-i)*t._y (3*n-4*i 1)*r._y 6*(-n i)*e._y (3*n-2*i)*s._y,o._z=6*(n-i)*t._z (3*n-4*i 1)*r._z 6*(-n i)*e._z (3*n-2*i)*s._z,o._w=6*(n-i)*t._w (3*n-4*i 1)*r._w 6*(-n i)*e._w (3*n-2*i)*s._w,o._isDirty=!0,o}}class m{static get Use64Bits(){return a.Z.MatrixUse64Bits}get m(){return this._m}markAsUpdated(){this.updateFlag=m._UpdateFlagSeed ,this._isIdentity=!1,this._isIdentity3x2=!1,this._isIdentityDirty=!0,this._isIdentity3x2Dirty=!0}_updateIdentityStatus(t,r=!1,e=!1,s=!0){this._isIdentity=t,this._isIdentity3x2=t||e,this._isIdentityDirty=!this._isIdentity&&r,this._isIdentity3x2Dirty=!this._isIdentity3x2&&s}constructor(){this._isIdentity=!1,this._isIdentityDirty=!0,this._isIdentity3x2=!0,this._isIdentity3x2Dirty=!0,this.updateFlag=-1,a.Z.MatrixTrackPrecisionChange&&a.Z.MatrixTrackedMatrices.push(this),this._m=new a.Z.MatrixCurrentType(16),this.markAsUpdated()}isIdentity(){if(this._isIdentityDirty){this._isIdentityDirty=!1;const t=this._m;this._isIdentity=1===t[0]&&0===t[1]&&0===t[2]&&0===t[3]&&0===t[4]&&1===t[5]&&0===t[6]&&0===t[7]&&0===t[8]&&0===t[9]&&1===t[10]&&0===t[11]&&0===t[12]&&0===t[13]&&0===t[14]&&1===t[15]}return this._isIdentity}isIdentityAs3x2(){return this._isIdentity3x2Dirty&&(this._isIdentity3x2Dirty=!1,1!==this._m[0]||1!==this._m[5]||1!==this._m[15]||0!==this._m[1]||0!==this._m[2]||0!==this._m[3]||0!==this._m[4]||0!==this._m[6]||0!==this._m[7]||0!==this._m[8]||0!==this._m[9]||0!==this._m[10]||0!==this._m[11]||0!==this._m[12]||0!==this._m[13]||0!==this._m[14]?this._isIdentity3x2=!1:this._isIdentity3x2=!0),this._isIdentity3x2}determinant(){if(!0===this._isIdentity)return 1;const t=this._m,r=t[0],e=t[1],s=t[2],i=t[3],o=t[4],n=t[5],a=t[6],c=t[7],h=t[8],_=t[9],y=t[10],u=t[11],l=t[12],m=t[13],x=t[14],R=t[15],f=y*R-x*u,d=_*R-m*u,z=_*x-m*y,T=h*R-l*u,w=h*x-y*l,p=h*m-l*_;return r* (n*f-a*d c*z) e*-(o*f-a*T c*w) s* (o*d-n*T c*p) i*-(o*z-n*w a*p)}toArray(){return this._m}asArray(){return this._m}invert(){return this.invertToRef(this),this}reset(){return m.FromValuesToRef(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,this),this._updateIdentityStatus(!1),this}add(t){const r=new this.constructor;return this.addToRef(t,r),r}addToRef(t,r){const e=this._m,s=r._m,i=t.m;for(let o=0;o<16;o )s[o]=e[o] i[o];return r.markAsUpdated(),r}addToSelf(t){const r=this._m,e=t.m;for(let s=0;s<16;s )r[s] =e[s];return this.markAsUpdated(),this}invertToRef(t){if(!0===this._isIdentity)return m.IdentityToRef(t),t;const r=this._m,e=r[0],s=r[1],i=r[2],o=r[3],n=r[4],a=r[5],c=r[6],h=r[7],_=r[8],y=r[9],u=r[10],l=r[11],x=r[12],R=r[13],f=r[14],d=r[15],z=u*d-f*l,T=y*d-R*l,w=y*f-R*u,p=_*d-x*l,F=_*f-u*x,M=_*R-x*y,I= (a*z-c*T h*w),g=-(n*z-c*p h*F),D= (n*T-a*p h*M),P=-(n*w-a*F c*M),A=e*I s*g i*D o*P;if(0===A)return t.copyFrom(this),t;const V=1/A,C=c*d-f*h,L=a*d-R*h,k=a*f-R*c,v=n*d-x*h,H=n*f-x*c,O=n*R-x*a,S=c*l-u*h,B=a*l-y*h,U=a*u-y*c,b=n*l-_*h,Z=n*u-_*c,q=n*y-_*a,N=-(s*z-i*T o*w),E= (e*z-i*p o*F),Y=-(e*T-s*p o*M),Q= (e*w-s*F i*M),W= (s*C-i*L o*k),j=-(e*C-i*v o*H),$= (e*L-s*v o*O),G=-(e*k-s*H i*O),X=-(s*S-i*B o*U),J= (e*S-i*b o*Z),K=-(e*B-s*b o*q),tt= (e*U-s*Z i*q);return m.FromValuesToRef(I*V,N*V,W*V,X*V,g*V,E*V,j*V,J*V,D*V,Y*V,$*V,K*V,P*V,Q*V,G*V,tt*V,t),t}addAtIndex(t,r){return this._m[t] =r,this.markAsUpdated(),this}multiplyAtIndex(t,r){return this._m[t]*=r,this.markAsUpdated(),this}setTranslationFromFloats(t,r,e){return this._m[12]=t,this._m[13]=r,this._m[14]=e,this.markAsUpdated(),this}addTranslationFromFloats(t,r,e){return this._m[12] =t,this._m[13] =r,this._m[14] =e,this.markAsUpdated(),this}setTranslation(t){return this.setTranslationFromFloats(t._x,t._y,t._z)}getTranslation(){return new y(this._m[12],this._m[13],this._m[14])}getTranslationToRef(t){return t.x=this._m[12],t.y=this._m[13],t.z=this._m[14],t}removeRotationAndScaling(){const t=this.m;return m.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,t[12],t[13],t[14],t[15],this),this._updateIdentityStatus(0===t[12]&&0===t[13]&&0===t[14]&&1===t[15]),this}multiply(t){const r=new this.constructor;return this.multiplyToRef(t,r),r}copyFrom(t){t.copyToArray(this._m);const r=t;return this.updateFlag=r.updateFlag,this._updateIdentityStatus(r._isIdentity,r._isIdentityDirty,r._isIdentity3x2,r._isIdentity3x2Dirty),this}copyToArray(t,r=0){const e=this._m;return t[r]=e[0],t[r 1]=e[1],t[r 2]=e[2],t[r 3]=e[3],t[r 4]=e[4],t[r 5]=e[5],t[r 6]=e[6],t[r 7]=e[7],t[r 8]=e[8],t[r 9]=e[9],t[r 10]=e[10],t[r 11]=e[11],t[r 12]=e[12],t[r 13]=e[13],t[r 14]=e[14],t[r 15]=e[15],this}multiplyToRef(t,r){return this._isIdentity?(r.copyFrom(t),r):t._isIdentity?(r.copyFrom(this),r):(this.multiplyToArray(t,r._m,0),r.markAsUpdated(),r)}multiplyToArray(t,r,e){const s=this._m,i=t.m,o=s[0],n=s[1],a=s[2],c=s[3],h=s[4],_=s[5],y=s[6],u=s[7],l=s[8],m=s[9],x=s[10],R=s[11],f=s[12],d=s[13],z=s[14],T=s[15],w=i[0],p=i[1],F=i[2],M=i[3],I=i[4],g=i[5],D=i[6],P=i[7],A=i[8],V=i[9],C=i[10],L=i[11],k=i[12],v=i[13],H=i[14],O=i[15];return r[e]=o*w n*I a*A c*k,r[e 1]=o*p n*g a*V c*v,r[e 2]=o*F n*D a*C c*H,r[e 3]=o*M n*P a*L c*O,r[e 4]=h*w _*I y*A u*k,r[e 5]=h*p _*g y*V u*v,r[e 6]=h*F _*D y*C u*H,r[e 7]=h*M _*P y*L u*O,r[e 8]=l*w m*I x*A R*k,r[e 9]=l*p m*g x*V R*v,r[e 10]=l*F m*D x*C R*H,r[e 11]=l*M m*P x*L R*O,r[e 12]=f*w d*I z*A T*k,r[e 13]=f*p d*g z*V T*v,r[e 14]=f*F d*D z*C T*H,r[e 15]=f*M d*P z*L T*O,this}equals(t){const r=t;if(!r)return!1;if((this._isIdentity||r._isIdentity)&&!this._isIdentityDirty&&!r._isIdentityDirty)return this._isIdentity&&r._isIdentity;const e=this.m,s=r.m;return e[0]===s[0]&&e[1]===s[1]&&e[2]===s[2]&&e[3]===s[3]&&e[4]===s[4]&&e[5]===s[5]&&e[6]===s[6]&&e[7]===s[7]&&e[8]===s[8]&&e[9]===s[9]&&e[10]===s[10]&&e[11]===s[11]&&e[12]===s[12]&&e[13]===s[13]&&e[14]===s[14]&&e[15]===s[15]}clone(){const t=new this.constructor;return t.copyFrom(this),t}getClassName(){return"Matrix"}getHashCode(){let t=h(this._m[0]);for(let r=1;r<16;r )t=397*t^h(this._m[r]);return t}decomposeToTransformNode(t){return t.rotationQuaternion=t.rotationQuaternion||new l,this.decompose(t.scaling,t.rotationQuaternion,t.position)}decompose(t,r,e,s){if(this._isIdentity)return e&&e.setAll(0),t&&t.setAll(1),r&&r.copyFromFloats(0,0,0,1),!0;const i=this._m;if(e&&e.copyFromFloats(i[12],i[13],i[14]),(t=t||x.Vector3[0]).x=Math.sqrt(i[0]*i[0] i[1]*i[1] i[2]*i[2]),t.y=Math.sqrt(i[4]*i[4] i[5]*i[5] i[6]*i[6]),t.z=Math.sqrt(i[8]*i[8] i[9]*i[9] i[10]*i[10]),s){const r=s.scaling.x<0?-1:1,e=s.scaling.y<0?-1:1,i=s.scaling.z<0?-1:1;t.x*=r,t.y*=e,t.z*=i}else this.determinant()<=0&&(t.y*=-1);if(0===t._x||0===t._y||0===t._z)return r&&r.copyFromFloats(0,0,0,1),!1;if(r){const e=1/t._x,s=1/t._y,o=1/t._z;m.FromValuesToRef(i[0]*e,i[1]*e,i[2]*e,0,i[4]*s,i[5]*s,i[6]*s,0,i[8]*o,i[9]*o,i[10]*o,0,0,0,0,1,x.Matrix[0]),l.FromRotationMatrixToRef(x.Matrix[0],r)}return!0}getRow(t){if(t<0||t>3)return null;const r=4*t;return new u(this._m[r 0],this._m[r 1],this._m[r 2],this._m[r 3])}getRowToRef(t,r){if(t>=0&&t<3){const e=4*t;r.x=this._m[e 0],r.y=this._m[e 1],r.z=this._m[e 2],r.w=this._m[e 3]}return r}setRow(t,r){return this.setRowFromFloats(t,r.x,r.y,r.z,r.w)}transpose(){const t=new this.constructor;return m.TransposeToRef(this,t),t}transposeToRef(t){return m.TransposeToRef(this,t),t}setRowFromFloats(t,r,e,s,i){if(t<0||t>3)return this;const o=4*t;return this._m[o 0]=r,this._m[o 1]=e,this._m[o 2]=s,this._m[o 3]=i,this.markAsUpdated(),this}scale(t){const r=new this.constructor;return this.scaleToRef(t,r),r}scaleToRef(t,r){for(let e=0;e<16;e )r._m[e]=this._m[e]*t;return r.markAsUpdated(),r}scaleAndAddToRef(t,r){for(let e=0;e<16;e )r._m[e] =this._m[e]*t;return r.markAsUpdated(),r}toNormalMatrix(t){const r=x.Matrix[0];this.invertToRef(r),r.transposeToRef(t);const e=t._m;return m.FromValuesToRef(e[0],e[1],e[2],0,e[4],e[5],e[6],0,e[8],e[9],e[10],0,0,0,0,1,t),t}getRotationMatrix(){const t=new this.constructor;return this.getRotationMatrixToRef(t),t}getRotationMatrixToRef(t){const r=x.Vector3[0];if(!this.decompose(r))return m.IdentityToRef(t),t;const e=this._m,s=1/r._x,i=1/r._y,o=1/r._z;return m.FromValuesToRef(e[0]*s,e[1]*s,e[2]*s,0,e[4]*i,e[5]*i,e[6]*i,0,e[8]*o,e[9]*o,e[10]*o,0,0,0,0,1,t),t}toggleModelMatrixHandInPlace(){const t=this._m;return t[2]*=-1,t[6]*=-1,t[8]*=-1,t[9]*=-1,t[14]*=-1,this.markAsUpdated(),this}toggleProjectionMatrixHandInPlace(){const t=this._m;return t[8]*=-1,t[9]*=-1,t[10]*=-1,t[11]*=-1,this.markAsUpdated(),this}static FromArray(t,r=0){const e=new m;return m.FromArrayToRef(t,r,e),e}static FromArrayToRef(t,r,e){for(let s=0;s<16;s )e._m[s]=t[s r];return e.markAsUpdated(),e}static FromFloat32ArrayToRefScaled(t,r,e,s){for(let i=0;i<16;i )s._m[i]=t[i r]*e;return s.markAsUpdated(),s}static get IdentityReadOnly(){return m._IdentityReadOnly}static FromValuesToRef(t,r,e,s,i,o,n,a,c,h,_,y,u,l,m,x,R){const f=R._m;f[0]=t,f[1]=r,f[2]=e,f[3]=s,f[4]=i,f[5]=o,f[6]=n,f[7]=a,f[8]=c,f[9]=h,f[10]=_,f[11]=y,f[12]=u,f[13]=l,f[14]=m,f[15]=x,R.markAsUpdated()}static FromValues(t,r,e,s,i,o,n,a,c,h,_,y,u,l,x,R){const f=new m,d=f._m;return d[0]=t,d[1]=r,d[2]=e,d[3]=s,d[4]=i,d[5]=o,d[6]=n,d[7]=a,d[8]=c,d[9]=h,d[10]=_,d[11]=y,d[12]=u,d[13]=l,d[14]=x,d[15]=R,f.markAsUpdated(),f}static Compose(t,r,e){const s=new m;return m.ComposeToRef(t,r,e,s),s}static ComposeToRef(t,r,e,s){const i=s._m,o=r._x,n=r._y,a=r._z,c=r._w,h=o o,_=n n,y=a a,u=o*h,l=o*_,m=o*y,x=n*_,R=n*y,f=a*y,d=c*h,z=c*_,T=c*y,w=t._x,p=t._y,F=t._z;return i[0]=(1-(x f))*w,i[1]=(l T)*w,i[2]=(m-z)*w,i[3]=0,i[4]=(l-T)*p,i[5]=(1-(u f))*p,i[6]=(R d)*p,i[7]=0,i[8]=(m z)*F,i[9]=(R-d)*F,i[10]=(1-(u x))*F,i[11]=0,i[12]=e._x,i[13]=e._y,i[14]=e._z,i[15]=1,s.markAsUpdated(),s}static Identity(){const t=m.FromValues(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return t._updateIdentityStatus(!0),t}static IdentityToRef(t){return m.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,t),t._updateIdentityStatus(!0),t}static Zero(){const t=m.FromValues(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);return t._updateIdentityStatus(!1),t}static RotationX(t){const r=new m;return m.RotationXToRef(t,r),r}static Invert(t){const r=new t.constructor;return t.invertToRef(r),r}static RotationXToRef(t,r){const e=Math.sin(t),s=Math.cos(t);return m.FromValuesToRef(1,0,0,0,0,s,e,0,0,-e,s,0,0,0,0,1,r),r._updateIdentityStatus(1===s&&0===e),r}static RotationY(t){const r=new m;return m.RotationYToRef(t,r),r}static RotationYToRef(t,r){const e=Math.sin(t),s=Math.cos(t);return m.FromValuesToRef(s,0,-e,0,0,1,0,0,e,0,s,0,0,0,0,1,r),r._updateIdentityStatus(1===s&&0===e),r}static RotationZ(t){const r=new m;return m.RotationZToRef(t,r),r}static RotationZToRef(t,r){const e=Math.sin(t),s=Math.cos(t);return m.FromValuesToRef(s,e,0,0,-e,s,0,0,0,0,1,0,0,0,0,1,r),r._updateIdentityStatus(1===s&&0===e),r}static RotationAxis(t,r){const e=new m;return m.RotationAxisToRef(t,r,e),e}static RotationAxisToRef(t,r,e){const s=Math.sin(-r),i=Math.cos(-r),o=1-i;t.normalize();const n=e._m;return n[0]=t._x*t._x*o i,n[1]=t._x*t._y*o-t._z*s,n[2]=t._x*t._z*o t._y*s,n[3]=0,n[4]=t._y*t._x*o t._z*s,n[5]=t._y*t._y*o i,n[6]=t._y*t._z*o-t._x*s,n[7]=0,n[8]=t._z*t._x*o-t._y*s,n[9]=t._z*t._y*o t._x*s,n[10]=t._z*t._z*o i,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,e.markAsUpdated(),e}static RotationAlignToRef(t,r,e){const s=y.Dot(r,t),o=e._m;if(s<-1 i.kn)o[0]=-1,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=-1,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=1,o[11]=0;else{const e=y.Cross(r,t),i=1/(1 s);o[0]=e._x*e._x*i s,o[1]=e._y*e._x*i-e._z,o[2]=e._z*e._x*i e._y,o[3]=0,o[4]=e._x*e._y*i e._z,o[5]=e._y*e._y*i s,o[6]=e._z*e._y*i-e._x,o[7]=0,o[8]=e._x*e._z*i-e._y,o[9]=e._y*e._z*i e._x,o[10]=e._z*e._z*i s,o[11]=0}return o[12]=0,o[13]=0,o[14]=0,o[15]=1,e.markAsUpdated(),e}static RotationYawPitchRoll(t,r,e){const s=new m;return m.RotationYawPitchRollToRef(t,r,e,s),s}static RotationYawPitchRollToRef(t,r,e,s){return l.RotationYawPitchRollToRef(t,r,e,x.Quaternion[0]),x.Quaternion[0].toRotationMatrix(s),s}static Scaling(t,r,e){const s=new m;return m.ScalingToRef(t,r,e,s),s}static ScalingToRef(t,r,e,s){return m.FromValuesToRef(t,0,0,0,0,r,0,0,0,0,e,0,0,0,0,1,s),s._updateIdentityStatus(1===t&&1===r&&1===e),s}static Translation(t,r,e){const s=new m;return m.TranslationToRef(t,r,e,s),s}static TranslationToRef(t,r,e,s){return m.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,t,r,e,1,s),s._updateIdentityStatus(0===t&&0===r&&0===e),s}static Lerp(t,r,e){const s=new t.constructor;return m.LerpToRef(t,r,e,s),s}static LerpToRef(t,r,e,s){const i=s._m,o=t.m,n=r.m;for(let a=0;a<16;a )i[a]=o[a]*(1-e) n[a]*e;return s.markAsUpdated(),s}static DecomposeLerp(t,r,e){const s=new t.constructor;return m.DecomposeLerpToRef(t,r,e,s),s}static DecomposeLerpToRef(t,r,e,s){const i=x.Vector3[0],o=x.Quaternion[0],n=x.Vector3[1];t.decompose(i,o,n);const a=x.Vector3[2],c=x.Quaternion[1],h=x.Vector3[3];r.decompose(a,c,h);const _=x.Vector3[4];y.LerpToRef(i,a,e,_);const u=x.Quaternion[2];l.SlerpToRef(o,c,e,u);const R=x.Vector3[5];return y.LerpToRef(n,h,e,R),m.ComposeToRef(_,u,R,s),s}static LookAtLH(t,r,e){const s=new m;return m.LookAtLHToRef(t,r,e,s),s}static LookAtLHToRef(t,r,e,s){const i=x.Vector3[0],o=x.Vector3[1],n=x.Vector3[2];r.subtractToRef(t,n),n.normalize(),y.CrossToRef(e,n,i);const a=i.lengthSquared();0===a?i.x=1:i.normalizeFromLength(Math.sqrt(a)),y.CrossToRef(n,i,o),o.normalize();const c=-y.Dot(i,t),h=-y.Dot(o,t),_=-y.Dot(n,t);m.FromValuesToRef(i._x,o._x,n._x,0,i._y,o._y,n._y,0,i._z,o._z,n._z,0,c,h,_,1,s)}static LookAtRH(t,r,e){const s=new m;return m.LookAtRHToRef(t,r,e,s),s}static LookAtRHToRef(t,r,e,s){const i=x.Vector3[0],o=x.Vector3[1],n=x.Vector3[2];t.subtractToRef(r,n),n.normalize(),y.CrossToRef(e,n,i);const a=i.lengthSquared();0===a?i.x=1:i.normalizeFromLength(Math.sqrt(a)),y.CrossToRef(n,i,o),o.normalize();const c=-y.Dot(i,t),h=-y.Dot(o,t),_=-y.Dot(n,t);return m.FromValuesToRef(i._x,o._x,n._x,0,i._y,o._y,n._y,0,i._z,o._z,n._z,0,c,h,_,1,s),s}static LookDirectionLH(t,r){const e=new m;return m.LookDirectionLHToRef(t,r,e),e}static LookDirectionLHToRef(t,r,e){const s=x.Vector3[0];s.copyFrom(t),s.scaleInPlace(-1);const i=x.Vector3[1];return y.CrossToRef(r,s,i),m.FromValuesToRef(i._x,i._y,i._z,0,r._x,r._y,r._z,0,s._x,s._y,s._z,0,0,0,0,1,e),e}static LookDirectionRH(t,r){const e=new m;return m.LookDirectionRHToRef(t,r,e),e}static LookDirectionRHToRef(t,r,e){const s=x.Vector3[2];return y.CrossToRef(r,t,s),m.FromValuesToRef(s._x,s._y,s._z,0,r._x,r._y,r._z,0,t._x,t._y,t._z,0,0,0,0,1,e),e}static OrthoLH(t,r,e,s,i){const o=new m;return m.OrthoLHToRef(t,r,e,s,o,i),o}static OrthoLHToRef(t,r,e,s,i,o){const n=2/t,a=2/r,c=2/(s-e),h=-(s e)/(s-e);return m.FromValuesToRef(n,0,0,0,0,a,0,0,0,0,c,0,0,0,h,1,i),o&&i.multiplyToRef(f,i),i._updateIdentityStatus(1===n&&1===a&&1===c&&0===h),i}static OrthoOffCenterLH(t,r,e,s,i,o,n){const a=new m;return m.OrthoOffCenterLHToRef(t,r,e,s,i,o,a,n),a}static OrthoOffCenterLHToRef(t,r,e,s,i,o,n,a){const c=2/(r-t),h=2/(s-e),_=2/(o-i),y=-(o i)/(o-i),u=(t r)/(t-r),l=(s e)/(e-s);return m.FromValuesToRef(c,0,0,0,0,h,0,0,0,0,_,0,u,l,y,1,n),a&&n.multiplyToRef(f,n),n.markAsUpdated(),n}static OrthoOffCenterRH(t,r,e,s,i,o,n){const a=new m;return m.OrthoOffCenterRHToRef(t,r,e,s,i,o,a,n),a}static OrthoOffCenterRHToRef(t,r,e,s,i,o,n,a){return m.OrthoOffCenterLHToRef(t,r,e,s,i,o,n,a),n._m[10]*=-1,n}static PerspectiveLH(t,r,e,s,i,o=0){const n=new m,a=2*e/t,c=2*e/r,h=(s e)/(s-e),_=-2*s*e/(s-e),y=Math.tan(o);return m.FromValuesToRef(a,0,0,0,0,c,0,y,0,0,h,1,0,0,_,0,n),i&&n.multiplyToRef(f,n),n._updateIdentityStatus(!1),n}static PerspectiveFovLH(t,r,e,s,i,o=0,n=!1){const a=new m;return m.PerspectiveFovLHToRef(t,r,e,s,a,!0,i,o,n),a}static PerspectiveFovLHToRef(t,r,e,s,i,o=!0,n,a=0,c=!1){const h=e,_=s,y=1/Math.tan(.5*t),u=o?y/r:y,l=o?y:y*r,x=c&&0===h?-1:0!==_?(_ h)/(_-h):1,R=c&&0===h?2*_:0!==_?-2*_*h/(_-h):-2*h,d=Math.tan(a);return m.FromValuesToRef(u,0,0,0,0,l,0,d,0,0,x,1,0,0,R,0,i),n&&i.multiplyToRef(f,i),i._updateIdentityStatus(!1),i}static PerspectiveFovReverseLHToRef(t,r,e,s,i,o=!0,n,a=0){const c=1/Math.tan(.5*t),h=o?c/r:c,_=o?c:c*r,y=Math.tan(a);return m.FromValuesToRef(h,0,0,0,0,_,0,y,0,0,-e,1,0,0,1,0,i),n&&i.multiplyToRef(f,i),i._updateIdentityStatus(!1),i}static PerspectiveFovRH(t,r,e,s,i,o=0,n=!1){const a=new m;return m.PerspectiveFovRHToRef(t,r,e,s,a,!0,i,o,n),a}static PerspectiveFovRHToRef(t,r,e,s,i,o=!0,n,a=0,c=!1){const h=e,_=s,y=1/Math.tan(.5*t),u=o?y/r:y,l=o?y:y*r,x=c&&0===h?1:0!==_?-(_ h)/(_-h):-1,R=c&&0===h?2*_:0!==_?-2*_*h/(_-h):-2*h,d=Math.tan(a);return m.FromValuesToRef(u,0,0,0,0,l,0,d,0,0,x,-1,0,0,R,0,i),n&&i.multiplyToRef(f,i),i._updateIdentityStatus(!1),i}static PerspectiveFovReverseRHToRef(t,r,e,s,i,o=!0,n,a=0){const c=1/Math.tan(.5*t),h=o?c/r:c,_=o?c:c*r,y=Math.tan(a);return m.FromValuesToRef(h,0,0,0,0,_,0,y,0,0,-e,-1,0,0,-1,0,i),n&&i.multiplyToRef(f,i),i._updateIdentityStatus(!1),i}static PerspectiveFovWebVRToRef(t,r,e,s,i=!1,o,n=0){const a=i?-1:1,c=Math.tan(t.upDegrees*Math.PI/180),h=Math.tan(t.downDegrees*Math.PI/180),_=Math.tan(t.leftDegrees*Math.PI/180),y=Math.tan(t.rightDegrees*Math.PI/180),u=2/(_ y),l=2/(c h),m=Math.tan(n),x=s._m;return x[0]=u,x[1]=x[2]=x[3]=x[4]=0,x[5]=l,x[6]=0,x[7]=m,x[8]=(_-y)*u*.5,x[9]=-(c-h)*l*.5,x[10]=-e/(r-e),x[11]=1*a,x[12]=x[13]=x[15]=0,x[14]=-2*e*r/(e-r),o&&s.multiplyToRef(f,s),s.markAsUpdated(),s}static GetFinalMatrix(t,r,e,s,i,o){const n=t.width,a=t.height,c=t.x,h=t.y,_=m.FromValues(n/2,0,0,0,0,-a/2,0,0,0,0,o-i,0,c n/2,a/2 h,i,1),y=new r.constructor;return r.multiplyToRef(e,y),y.multiplyToRef(s,y),y.multiplyToRef(_,y)}static GetAsMatrix2x2(t){const r=t.m,e=[r[0],r[1],r[4],r[5]];return a.Z.MatrixUse64Bits?e:new Float32Array(e)}static GetAsMatrix3x3(t){const r=t.m,e=[r[0],r[1],r[2],r[4],r[5],r[6],r[8],r[9],r[10]];return a.Z.MatrixUse64Bits?e:new Float32Array(e)}static Transpose(t){const r=new t.constructor;return m.TransposeToRef(t,r),r}static TransposeToRef(t,r){const e=r._m,s=t.m;return e[0]=s[0],e[1]=s[4],e[2]=s[8],e[3]=s[12],e[4]=s[1],e[5]=s[5],e[6]=s[9],e[7]=s[13],e[8]=s[2],e[9]=s[6],e[10]=s[10],e[11]=s[14],e[12]=s[3],e[13]=s[7],e[14]=s[11],e[15]=s[15],r.markAsUpdated(),r._updateIdentityStatus(t._isIdentity,t._isIdentityDirty),r}static Reflection(t){const r=new m;return m.ReflectionToRef(t,r),r}static ReflectionToRef(t,r){t.normalize();const e=t.normal.x,s=t.normal.y,i=t.normal.z,o=-2*e,n=-2*s,a=-2*i;return m.FromValuesToRef(o*e 1,n*e,a*e,0,o*s,n*s 1,a*s,0,o*i,n*i,a*i 1,0,o*t.d,n*t.d,a*t.d,1,r),r}static FromXYZAxesToRef(t,r,e,s){return m.FromValuesToRef(t._x,t._y,t._z,0,r._x,r._y,r._z,0,e._x,e._y,e._z,0,0,0,0,1,s),s}static FromQuaternionToRef(t,r){const e=t._x*t._x,s=t._y*t._y,i=t._z*t._z,o=t._x*t._y,n=t._z*t._w,a=t._z*t._x,c=t._y*t._w,h=t._y*t._z,_=t._x*t._w;return r._m[0]=1-2*(s i),r._m[1]=2*(o n),r._m[2]=2*(a-c),r._m[3]=0,r._m[4]=2*(o-n),r._m[5]=1-2*(i e),r._m[6]=2*(h _),r._m[7]=0,r._m[8]=2*(a c),r._m[9]=2*(h-_),r._m[10]=1-2*(s e),r._m[11]=0,r._m[12]=0,r._m[13]=0,r._m[14]=0,r._m[15]=1,r.markAsUpdated(),r}}m._UpdateFlagSeed=0,m._IdentityReadOnly=m.Identity();class x{}x.Vector3=o.B.BuildTuple(11,y.Zero),x.Matrix=o.B.BuildTuple(2,m.Identity),x.Quaternion=o.B.BuildTuple(3,l.Zero);class R{}R.Vector2=o.B.BuildTuple(3,_.Zero),R.Vector3=o.B.BuildTuple(13,y.Zero),R.Vector4=o.B.BuildTuple(3,u.Zero),R.Quaternion=o.B.BuildTuple(2,l.Zero),R.Matrix=o.B.BuildTuple(8,m.Identity),(0,n.H)("BABYLON.Vector2",_),(0,n.H)("BABYLON.Vector3",y),(0,n.H)("BABYLON.Vector4",u),(0,n.H)("BABYLON.Matrix",m);const f=m.FromValues(1,0,0,0,0,1,0,0,0,0,.5,0,0,0,.5,1)}}]);
//# sourceMappingURL=088d5a4e-4f2cb64570bdf3425971.js.map