PageSourceSearch

https://fineenvs-trackio-latex-ocr.hf.space/assets/scene-gn_hoGMy.js

js fineenvs-trackio-latex-ocr.hf.space collected 2026-10-04 16:52:13 UTC 131,932 bytes, 1 lines download raw bytes

vendor: 29,068 bytes, line 1
1import{T as P}from"./tools-D01N7ptR.js";import{S as N,M as Z,b as Y,c as Pe,P as H,T as $,L as ye,d as Te,e as Oe}from"./decorators.serialization-C7d7ykGG.js";import{O as f,a as X,E as B,M as _e,V as x,b as me}from"./math.vector-C1xyPDEl.js";import{S as G,a as z}from"./smartArray-CO6iJ0u5.js";import{_ as p,s as v,h as Ee,i as Ae,j as Re,e as k,f as ke,L as I}from"./bufferUtils-DTRdUD8L.js";import{Color4 as S,Color3 as Q}from"./math.color-CzLaKyb6.js";import{R as pe,_ as we}from"./math.scalar.functions-DkeaWAWz.js";import{U as xe,L as De}from"./lightConstants-B1TSTh-k.js";import{P as K,S as y,F as J,R as Se,O as Ie,a as ee}from"./sceneComponent-Dflhczui.js";import{R as Be,P as te}from"./renderingManager-CiY2OUrf.js";import{E as Ne,P as b,a as D,b as Le,c as ie,K as se,d as re}from"./deviceInputEvents-BTza-zoR.js";import{P as q}from"./perfCounter-DusmGz8t.js";class ne{constructor(){this._count=0,this._data={}}copyFrom(e){this.clear(),e.forEach((t,i)=>this.add(t,i))}get(e){const t=this._data[e];if(t!==void 0)return t}getOrAddWithFactory(e,t){let i=this.get(e);return i!==void 0||(i=t(e),i&&this.add(e,i)),i}getOrAdd(e,t){const i=this.get(e);return i!==void 0?i:(this.add(e,t),t)}contains(e){return this._data[e]!==void 0}add(e,t){return this._data[e]!==void 0?!1:(this._data[e]=t,++this._count,!0)}set(e,t){return this._data[e]===void 0?!1:(this._data[e]=t,!0)}getAndRemove(e){const t=this.get(e);return t!==void 0?(delete this._data[e],--this._count,t):null}remove(e){return this.contains(e)?(delete this._data[e],--this._count,!0):!1}clear(){this._data={},this._count=0}get count(){return this._count}forEach(e){for(const t in this._data){const i=this._data[t];e(t,i)}}first(e){for(const t in this._data){const i=this._data[t],r=e(t,i);if(r)return r}return null}}function ve(a){a.push("vCameraColorCurveNeutral","vCameraColorCurvePositive","vCameraColorCurveNegative")}class C{constructor(){this._dirty=!0,this._tempColor=new S(0,0,0,0),this._globalCurve=new S(0,0,0,0),this._highlightsCurve=new S(0,0,0,0),this._midtonesCurve=new S(0,0,0,0),this._shadowsCurve=new S(0,0,0,0),this._positiveCurve=new S(0,0,0,0),this._negativeCurve=new S(0,0,0,0),this._globalHue=30,this._globalDensity=0,this._globalSaturation=0,this._globalExposure=0,this._highlightsHue=30,this._highlightsDensity=0,this._highlightsSaturation=0,this._highlightsExposure=0,this._midtonesHue=30,this._midtonesDensity=0,this._midtonesSaturation=0,this._midtonesExposure=0,this._shadowsHue=30,this._shadowsDensity=0,this._shadowsSaturation=0,this._shadowsExposure=0}get globalHue(){return this._globalHue}set globalHue(e){this._globalHue=e,this._dirty=!0}get globalDensity(){return this._globalDensity}set globalDensity(e){this._globalDensity=e,this._dirty=!0}get globalSaturation(){return this._globalSaturation}set globalSaturation(e){this._globalSaturation=e,this._dirty=!0}get globalExposure(){return this._globalExposure}set globalExposure(e){this._globalExposure=e,this._dirty=!0}get highlightsHue(){return this._highlightsHue}set highlightsHue(e){this._highlightsHue=e,this._dirty=!0}get highlightsDensity(){return this._highlightsDensity}set highlightsDensity(e){this._highlightsDensity=e,this._dirty=!0}get highlightsSaturation(){return this._highlightsSaturation}set highlightsSaturation(e){this._highlightsSaturation=e,this._dirty=!0}get highlightsExposure(){return this._highlightsExposure}set highlightsExposure(e){this._highlightsExposure=e,this._dirty=!0}get midtonesHue(){return this._midtonesHue}set midtonesHue(e){this._midtonesHue=e,this._dirty=!0}get midtonesDensity(){return this._midtonesDensity}set midtonesDensity(e){this._midtonesDensity=e,this._dirty=!0}get midtonesSaturation(){return this._midtonesSaturation}set midtonesSaturation(e){this._midtonesSaturation=e,this._dirty=!0}get midtonesExposure(){return this._midtonesExposure}set midtonesExposure(e){this._midtonesExposure=e,this._dirty=!0}get shadowsHue(){return this._shadowsHue}set shadowsHue(e){this._shadowsHue=e,this._dirty=!0}get shadowsDensity(){return this._shadowsDensity}set shadowsDensity(e){this._shadowsDensity=e,this._dirty=!0}get shadowsSaturation(){return this._shadowsSaturation}set shadowsSaturation(e){this._shadowsSaturation=e,this._dirty=!0}get shadowsExposure(){return this._shadowsExposure}set shadowsExposure(e){this._shadowsExposure=e,this._dirty=!0}getClassName(){return"ColorCurves"}static Bind(e,t,i="vCameraColorCurvePositive",r="vCameraColorCurveNeutral",s="vCameraColorCurveNegative"){e._dirty&&(e._dirty=!1,e._getColorGradingDataToRef(e._globalHue,e._globalDensity,e._globalSaturation,e._globalExposure,e._globalCurve),e._getColorGradingDataToRef(e._highlightsHue,e._highlightsDensity,e._highlightsSaturation,e._highlightsExposure,e._tempColor),e._tempColor.multiplyToRef(e._globalCurve,e._highlightsCurve),e._getColorGradingDataToRef(e._midtonesHue,e._midtonesDensity,e._midtonesSaturation,e._midtonesExposure,e._tempColor),e._tempColor.multiplyToRef(e._globalCurve,e._midtonesCurve),e._getColorGradingDataToRef(e._shadowsHue,e._shadowsDensity,e._shadowsSaturation,e._shadowsExposure,e._tempColor),e._tempColor.multiplyToRef(e._globalCurve,e._shadowsCurve),e._highlightsCurve.subtractToRef(e._midtonesCurve,e._positiveCurve),e._midtonesCurve.subtractToRef(e._shadowsCurve,e._negativeCurve)),t&&(t.setFloat4(i,e._positiveCurve.r,e._positiveCurve.g,e._positiveCurve.b,e._positiveCurve.a),t.setFloat4(r,e._midtonesCurve.r,e._midtonesCurve.g,e._midtonesCurve.b,e._midtonesCurve.a),t.setFloat4(s,e._negativeCurve.r,e._negativeCurve.g,e._negativeCurve.b,e._negativeCurve.a))}_getColorGradingDataToRef(e,t,i,r,s){e!=null&&(e=C._Clamp(e,0,360),t=C._Clamp(t,-100,100),i=C._Clamp(i,-100,100),r=C._Clamp(r,-100,100),t=C._ApplyColorGradingSliderNonlinear(t),t*=.5,r=C._ApplyColorGradingSliderNonlinear(r),t<0&&(t*=-1,e=(e+180)%360),C._FromHSBToRef(e,t,50+.25*r,s),s.scaleToRef(2,s),s.a=1+.01*i)}static _ApplyColorGradingSliderNonlinear(e){e/=100;let t=Math.abs(e);return t=Math.pow(t,2),e<0&&(t*=-1),t*=100,t}static _FromHSBToRef(e,t,i,r){let s=C._Clamp(e,0,360);const o=C._Clamp(t/100,0,1),n=C._Clamp(i/100,0,1);if(o===0)r.r=n,r.g=n,r.b=n;else{s/=60;const h=Math.floor(s),l=s-h,d=n*(1-o),u=n*(1-o*l),m=n*(1-o*(1-l));switch(h){case 0:r.r=n,r.g=m,r.b=d;break;case 1:r.r=u,r.g=n,r.b=d;break;case 2:r.r=d,r.g=n,r.b=m;break;case 3:r.r=d,r.g=u,r.b=n;break;case 4:r.r=m,r.g=d,r.b=n;break;default:r.r=n,r.g=d,r.b=u;break}}r.a=1}static _Clamp(e,t,i){return Math.min(Math.max(e,t),i)}clone(){return N.Clone(()=>new C,this)}serialize(){return N.Serialize(this)}static Parse(e){return N.Parse(()=>new C,e,null,null)}}C.PrepareUniforms=ve;p([v()],C.prototype,"_globalHue",void 0);p([v()],C.prototype,"_globalDensity",void 0);p([v()],C.prototype,"_globalSaturation",void 0);p([v()],C.prototype,"_globalExposure",void 0);p([v()],C.prototype,"_highlightsHue",void 0);p([v()],C.prototype,"_highlightsDensity",void 0);p([v()],C.prototype,"_highlightsSaturation",void 0);p([v()],C.prototype,"_highlightsExposure",void 0);p([v()],C.prototype,"_midtonesHue",void 0);p([v()],C.prototype,"_midtonesDensity",void 0);p([v()],C.prototype,"_midtonesSaturation",void 0);p([v()],C.prototype,"_midtonesExposure",void 0);N._ColorCurvesParser=C.Parse;function Fe(a,e){e.EXPOSURE&&a.push("exposureLinear"),e.CONTRAST&&a.push("contrast"),e.COLORGRADING&&a.push("colorTransformSettings"),(e.VIGNETTE||e.DITHER)&&a.push("vInverseScreenSize"),e.VIGNETTE&&(a.push("vignetteSettings1"),a.push("vignetteSettings2")),e.COLORCURVES&&ve(a),e.DITHER&&a.push("ditherIntensity")}function Ue(a,e){e.COLORGRADING&&a.push("txColorTransform")}class _{constructor(){this.colorCurves=new C,this._colorCurvesEnabled=!1,this._colorGradingEnabled=!1,this._colorGradingWithGreenDepth=!0,this._colorGradingBGR=!0,this._exposure=1,this._toneMappingEnabled=!1,this._toneMappingType=_.TONEMAPPING_STANDARD,this._contrast=1,this.vignetteStretch=0,this.vignetteCenterX=0,this.vignetteCenterY=0,this.vignetteWeight=1.5,this.vignetteColor=new S(0,0,0,0),this.vignetteCameraFov=.5,this._vignetteBlendMode=_.VIGNETTEMODE_MULTIPLY,this._vignetteEnabled=!1,this._ditheringEnabled=!1,this._ditheringIntensity=1/255,this._skipFinalColorClamp=!1,this._applyByPostProcess=!1,this._isEnabled=!0,this.outputTextureWidth=0,this.outputTextureHeight=0,this.onUpdateParameters=new f}get colorCurvesEnabled(){return this._colorCurvesEnabled}set colorCurvesEnabled(e){this._colorCurvesEnabled!==e&&(this._colorCurvesEnabled=e,this._updateParameters())}get colorGradingTexture(){return this._colorGradingTexture}set colorGradingTexture(e){this._colorGradingTexture!==e&&(this._colorGradingTexture=e,this._updateParameters())}get colorGradingEnabled(){return this._colorGradingEnabled}set colorGradingEnabled(e){this._colorGradingEnabled!==e&&(this._colorGradingEnabled=e,this._updateParameters())}get colorGradingWithGreenDepth(){return this._colorGradingWithGreenDepth}set colorGradingWithGreenDepth(e){this._colorGradingWithGreenDepth!==e&&(this._colorGradingWithGreenDepth=e,this._updateParameters())}get colorGradingBGR(){return this._colorGradingBGR}set colorGradingBGR(e){this._colorGradingBGR!==e&&(this._colorGradingBGR=e,this._updateParameters())}get exposure(){return this._exposure}set exposure(e){this._exposure!==e&&(this._exposure=e,this._updateParameters())}get toneMappingEnabled(){return this._toneMappingEnabled}set toneMappingEnabled(e){this._toneMappingEnabled!==e&&(this._toneMappingEnabled=e,this._updateParameters())}get toneMappingType(){return this._toneMappingType}set toneMappingType(e){this._toneMappingType!==e&&(this._toneMappingType=e,this._updateParameters())}get contrast(){return this._contrast}set contrast(e){this._contrast!==e&&(this._contrast=e,this._updateParameters())}get vignetteCentreY(){return this.vignetteCenterY}set vignetteCentreY(e){this.vignetteCenterY=e}get vignetteCentreX(){return this.vignetteCenterX}set vignetteCentreX(e){this.vignetteCenterX=e}get vignetteBlendMode(){return this._vignetteBlendMode}set vignetteBlendMode(e){this._vignetteBlendMode!==e&&(this._vignetteBlendMode=e,this._updateParameters())}get vignetteEnabled(){return this._vignetteEnabled}set vignetteEnabled(e){this._vignetteEnabled!==e&&(this._vignetteEnabled=e,this._updateParameters())}get ditheringEnabled(){return this._ditheringEnabled}set ditheringEnabled(e){this._ditheringEnabled!==e&&(this._ditheringEnabled=e,this._updateParameters())}get ditheringIntensity(){return this._ditheringIntensity}set ditheringIntensity(e){this._ditheringIntensity!==e&&(this._ditheringIntensity=e,this._updateParameters())}get skipFinalColorClamp(){return this._skipFinalColorClamp}set skipFinalColorClamp(e){this._skipFinalColorClamp!==e&&(this._skipFinalColorClamp=e,this._updateParameters())}get applyByPostProcess(){return this._applyByPostProcess}set applyByPostProcess(e){this._applyByPostProcess!==e&&(this._applyByPostProcess=e,this._updateParameters())}get isEnabled(){return this._isEnabled}set isEnabled(e){this._isEnabled!==e&&(this._isEnabled=e,this._updateParameters())}_updateParameters(){this.onUpdateParameters.notifyObservers(this)}getClassName(){return"ImageProcessingConfiguration"}prepareDefines(e,t=!1){if(t!==this.applyByPostProcess||!this._isEnabled){e.VIGNETTE=!1,e.TONEMAPPING=0,e.CONTRAST=!1,e.EXPOSURE=!1,e.COLORCURVES=!1,e.COLORGRADING=!1,e.COLORGRADING3D=!1,e.DITHER=!1,e.IMAGEPROCESSING=!1,e.SKIPFINALCOLORCLAMP=this.skipFinalColorClamp,e.IMAGEPROCESSINGPOSTPROCESS=this.applyByPostProcess&&this._isEnabled;return}if(e.VIGNETTE=this.vignetteEnabled,e.VIGNETTEBLENDMODEMULTIPLY=this.vignetteBlendMode===_._VIGNETTEMODE_MULTIPLY,e.VIGNETTEBLENDMODEOPAQUE=!e.VIGNETTEBLENDMODEMULTIPLY,!this._toneMappingEnabled)e.TONEMAPPING=0;else switch(this._toneMappingType){case _.TONEMAPPING_KHR_PBR_NEUTRAL:e.TONEMAPPING=3;break;case _.TONEMAPPING_ACES:e.TONEMAPPING=2;break;default:e.TONEMAPPING=1;break}e.CONTRAST=this.contrast!==1,e.EXPOSURE=this.exposure!==1,e.COLORCURVES=this.colorCurvesEnabled&&!!this.colorCurves,e.COLORGRADING=this.colorGradingEnabled&&!!this.colorGradingTexture,e.COLORGRADING?e.COLORGRADING3D=this.colorGradingTexture.is3D:e.COLORGRADING3D=!1,e.SAMPLER3DGREENDEPTH=this.colorGradingWithGreenDepth,e.SAMPLER3DBGRMAP=this.colorGradingBGR,e.DITHER=this._ditheringEnabled,e.IMAGEPROCESSINGPOSTPROCESS=this.applyByPostProcess,e.SKIPFINALCOLORCLAMP=this.skipFinalColorClamp,e.IMAGEPROCESSING=e.VIGNETTE||!!e.TONEMAPPING||e.CONTRAST||e.EXPOSURE||e.COLORCURVES||e.COLORGRADING||e.DITHER}isReady(){return!this.colorGradingEnabled||!this.colorGradingTexture||this.colorGradingTexture.isReady()}bind(e,t){if(this._colorCurvesEnabled&&this.colorCurves&&C.Bind(this.colorCurves,e),this._vignetteEnabled||this._ditheringEnabled){const i=1/(this.outputTextureWidth||e.getEngine().getRenderWidth()),r=1/(this.outputTextureHeight||e.getEngine().getRenderHeight());if(e.setFloat2("vInverseScreenSize",i,r),this._ditheringEnabled&&e.setFloat("ditherIntensity",.5*this._ditheringIntensity),this._vignetteEnabled){const s=t??r/i;let o=Math.tan(this.vignetteCameraFov*.5),n=o*s;const h=Math.sqrt(n*o);n=Z(n,h,this.vignetteStretch),o=Z(o,h,this.vignetteStretch),e.setFloat4("vignetteSettings1",n,o,-n*this.vignetteCenterX,-o*this.vignetteCenterY);const l=-2*this.vignetteWeight;e.setFloat4("vignetteSettings2",this.vignetteColor.r,this.vignetteColor.g,this.vignetteColor.b,l)}}if(e.setFloat("exposureLinear",this.exposure),e.setFloat("contrast",this.contrast),this.colorGradingTexture){e.setTexture("txColorTransform",this.colorGradingTexture);const i=this.colorGradingTexture.getSize().height;e.setFloat4("colorTransformSettings",(i-1)/i,.5/i,i,this.colorGradingTexture.level)}}clone(){return N.Clone(()=>new _,this)}serialize(){return N.Serialize(this)}static Parse(e){const t=N.Parse(()=>new _,e,null,null);return e.vignetteCentreX!==void 0&&(t.vignetteCenterX=e.vignetteCentreX),e.vignetteCentreY!==void 0&&(t.vignetteCenterY=e.vignetteCentreY),t}static get VIGNETTEMODE_MULTIPLY(){return this._VIGNETTEMODE_MULTIPLY}static get VIGNETTEMODE_OPAQUE(){return this._VIGNETTEMODE_OPAQUE}}_.TONEMAPPING_STANDARD=0;_.TONEMAPPING_ACES=1;_.TONEMAPPING_KHR_PBR_NEUTRAL=2;_.PrepareUniforms=Fe;_.PrepareSamplers=Ue;_._VIGNETTEMODE_MULTIPLY=0;_._VIGNETTEMODE_OPAQUE=1;p([Ee()],_.prototype,"colorCurves",void 0);p([v()],_.prototype,"_colorCurvesEnabled",void 0);p([Ae("colorGradingTexture")],_.prototype,"_colorGradingTexture",void 0);p([v()],_.prototype,"_colorGradingEnabled",void 0);p([v()],_.prototype,"_colorGradingWithGreenDepth",void 0);p([v()],_.prototype,"_colorGradingBGR",void 0);p([v()],_.prototype,"_exposure",void 0);p([v()],_.prototype,"_toneMappingEnabled",void 0);p([v()],_.prototype,"_toneMappingType",void 0);p([v()],_.prototype,"_contrast",void 0);p([v()],_.prototype,"vignetteStretch",void 0);p([v()],_.prototype,"vignetteCenterX",void 0);p([v()],_.prototype,"vignetteCenterY",void 0);p([v()],_.prototype,"vignetteWeight",void 0);p([Re()],_.prototype,"vignetteColor",void 0);p([v()],_.prototype,"vignetteCameraFov",void 0);p([v()],_.prototype,"_vignetteBlendMode",void 0);p([v()],_.prototype,"_vignetteEnabled",void 0);p([v()],_.prototype,"_ditheringEnabled",void 0);p([v()],_.prototype,"_ditheringIntensity",void 0);p([v()],_.prototype,"_skipFinalColorClamp",void 0);p([v()],_.prototype,"_applyByPostProcess",void 0);p([v()],_.prototype,"_isEnabled",void 0);p([v()],_.prototype,"outputTextureWidth",void 0);p([v()],_.prototype,"outputTextureHeight",void 0);N._ImageProcessingConfigurationParser=_.Parse;pe("BABYLON.ImageProcessingConfiguration",_);class T{constructor(e,t,i,r,s,o){this.source=e,this.pointerX=t,this.pointerY=i,this.meshUnderPointer=r,this.sourceEvent=s,this.additionalData=o}static CreateNew(e,t,i){const r=e.getScene();return new T(e,r.pointerX,r.pointerY,r.meshUnderPointer||e,t,i)}static CreateNewFromSprite(e,t,i,r){return new T(e,t.pointerX,t.pointerY,t.meshUnderPointer,i,r)}static CreateNewFromScene(e,t){return new T(null,e.pointerX,e.pointerY,e.meshUnderPointer,t)}static CreateNewFromPrimitive(e,t,i,r){return new T(e,t.x,t.y,null,i,r)}}class A{constructor(){this.hoverCursor="",this.actions=[],this.isRecursive=!1,this.disposeWhenUnowned=!0}static get HasTriggers(){for(const e in A.Triggers)if(Object.prototype.hasOwnProperty.call(A.Triggers,e))return!0;return!1}static get HasPickTriggers(){for(const e in A.Triggers)if(Object.prototype.hasOwnProperty.call(A.Triggers,e)){const t=parseInt(e);if(t>=1&&t<=7)return!0}return!1}static HasSpecificTrigger(e){for(const t in A.Triggers)if(Object.prototype.hasOwnProperty.call(A.Triggers,t)&&parseInt(t)===e)return!0;return!1}}A.Triggers={};var c;(function(a){a[a.Generic=0]="Generic",a[a.Keyboard=1]="Keyboard",a[a.Mouse=2]="Mouse",a[a.Touch=3]="Touch",a[a.DualShock=4]="DualShock",a[a.Xbox=5]="Xbox",a[a.Switch=6]="Switch",a[a.DualSense=7]="DualSense"})(c||(c={}));var g;(function(a){a[a.Horizontal=0]="Horizontal",a[a.Vertical=1]="Vertical",a[a.LeftClick=2]="LeftClick",a[a.MiddleClick=3]="MiddleClick",a[a.RightClick=4]="RightClick",a[a.BrowserBack=5]="BrowserBack",a[a.BrowserForward=6]="BrowserForward",a[a.MouseWheelX=7]="MouseWheelX",a[a.MouseWheelY=8]="MouseWheelY",a[a.MouseWheelZ=9]="MouseWheelZ",a[a.Move=12]="Move"})(g||(g={}));var ae;(function(a){a[a.Horizontal=0]="Horizontal",a[a.Vertical=1]="Vertical",a[a.LeftClick=2]="LeftClick",a[a.MiddleClick=3]="MiddleClick",a[a.RightClick=4]="RightClick",a[a.BrowserBack=5]="BrowserBack",a[a.BrowserForward=6]="BrowserForward",a[a.MouseWheelX=7]="MouseWheelX",a[a.MouseWheelY=8]="MouseWheelY",a[a.MouseWheelZ=9]="MouseWheelZ",a[a.DeltaHorizontal=10]="DeltaHorizontal",a[a.DeltaVertical=11]="DeltaVertical"})(ae||(ae={}));var oe;(function(a){a[a.Cross=0]="Cross",a[a.Circle=1]="Circle",a[a.Square=2]="Square",a[a.Triangle=3]="Triangle",a[a.L1=4]="L1",a[a.R1=5]="R1",a[a.L2=6]="L2",a[a.R2=7]="R2",a[a.Share=8]="Share",a[a.Options=9]="Options",a[a.L3=10]="L3",a[a.R3=11]="R3",a[a.DPadUp=12]="DPadUp",a[a.DPadDown=13]="DPadDown",a[a.DPadLeft=14]="DPadLeft",a[a.DPadRight=15]="DPadRight",a[a.Home=16]="Home",a[a.TouchPad=17]="TouchPad",a[a.LStickXAxis=18]="LStickXAxis",a[a.LStickYAxis=19]="LStickYAxis",a[a.RStickXAxis=20]="RStickXAxis",a[a.RStickYAxis=21]="RStickYAxis"})(oe||(oe={}));var he;(function(a){a[a.Cross=0]="Cross",a[a.Circle=1]="Circle",a[a.Square=2]="Square",a[a.Triangle=3]="Triangle",a[a.L1=4]="L1",a[a.R1=5]="R1",a[a.L2=6]="L2",a[a.R2=7]="R2",a[a.Create=8]="Create",a[a.Options=9]="Options",a[a.L3=10]="L3",a[a.R3=11]="R3",a[a.DPadUp=12]="DPadUp",a[a.DPadDown=13]="DPadDown",a[a.DPadLeft=14]="DPadLeft",a[a.DPadRight=15]="DPadRight",a[a.Home=16]="Home",a[a.TouchPad=17]="TouchPad",a[a.LStickXAxis=18]="LStickXAxis",a[a.LStickYAxis=19]="LStickYAxis",a[a.RStickXAxis=20]="RStickXAxis",a[a.RStickYAxis=21]="RStickYAxis"})(he||(he={}));var le;(function(a){a[a.A=0]="A",a[a.B=1]="B",a[a.X=2]="X",a[a.Y=3]="Y",a[a.LB=4]="LB",a[a.RB=5]="RB",a[a.LT=6]="LT",a[a.RT=7]="RT",a[a.Back=8]="Back",a[a.Start=9]="Start",a[a.LS=10]="LS",a[a.RS=11]="RS",a[a.DPadUp=12]="DPadUp",a[a.DPadDown=13]="DPadDown",a[a.DPadLeft=14]="DPadLeft",a[a.DPadRight=15]="DPadRight",a[a.Home=16]="Home",a[a.LStickXAxis=17]="LStickXAxis",a[a.LStickYAxis=18]="LStickYAxis",a[a.RStickXAxis=19]="RStickXAxis",a[a.RStickYAxis=20]="RStickYAxis"})(le||(le={}));var de;(function(a){a[a.B=0]="B",a[a.A=1]="A",a[a.Y=2]="Y",a[a.X=3]="X",a[a.L=4]="L",a[a.R=5]="R",a[a.ZL=6]="ZL",a[a.ZR=7]="ZR",a[a.Minus=8]="Minus",a[a.Plus=9]="Plus",a[a.LS=10]="LS",a[a.RS=11]="RS",a[a.DPadUp=12]="DPadUp",a[a.DPadDown=13]="DPadDown",a[a.DPadLeft=14]="DPadLeft",a[a.DPadRight=15]="DPadRight",a[a.Home=16]="Home",a[a.Capture=17]="Capture",a[a.LStickXAxis=18]="LStickXAxis",a[a.LStickYAxis=19]="LStickYAxis",a[a.RStickXAxis=20]="RStickXAxis",a[a.RStickYAxis=21]="RStickYAxis"})(de||(de={}));class F{static CreateDeviceEvent(e,t,i,r,s,o,n){switch(e){case c.Keyboard:return this._CreateKeyboardEvent(i,r,s,o);case c.Mouse:if(i===g.MouseWheelX||i===g.MouseWheelY||i===g.MouseWheelZ)return this._CreateWheelEvent(e,t,i,r,s,o);case c.Touch:return this._CreatePointerEvent(e,t,i,r,s,o,n);default:throw`Unable to generate event for device ${c[e]}`}}static _CreatePointerEvent(e,t,i,r,s,o,n){const h=this._CreateMouseEvent(e,t,i,r,s,o);e===c.Mouse?(h.deviceType=c.Mouse,h.pointerId=1,h.pointerType="mouse"):(h.deviceType=c.Touch,h.pointerId=n??t,h.pointerType="touch");let l=0;return l+=s.pollInput(e,t,g.LeftClick),l+=s.pollInput(e,t,g.RightClick)*2,l+=s.pollInput(e,t,g.MiddleClick)*4,h.buttons=l,i===g.Move?h.type="pointermove":i>=g.LeftClick&&i<=g.RightClick&&(h.type=r===1?"pointerdown":"pointerup",h.button=i-2),h}static _CreateWheelEvent(e,t,i,r,s,o){const n=this._CreateMouseEvent(e,t,i,r,s,o);switch(n.pointerId=1,n.type="wheel",n.deltaMode=Ne.DOM_DELTA_PIXEL,n.deltaX=0,n.deltaY=0,n.deltaZ=0,i){case g.MouseWheelX:n.deltaX=r;break;case g.MouseWheelY:n.deltaY=r;break;case g.MouseWheelZ:n.deltaZ=r;break}return n}static _CreateMouseEvent(e,t,i,r,s,o){const n=this._CreateEvent(o),h=s.pollInput(e,t,g.Horizontal),l=s.pollInput(e,t,g.Vertical);return o?(n.movementX=0,n.movementY=0,n.offsetX=n.movementX-o.getBoundingClientRect().x,n.offsetY=n.movementY-o.getBoundingClientRect().y):(n.movementX=s.pollInput(e,t,10),n.movementY=s.pollInput(e,t,11),n.offsetX=0,n.offsetY=0),this._CheckNonCharacterKeys(n,s),n.clientX=h,n.clientY=l,n.x=h,n.y=l,n.deviceType=e,n.deviceSlot=t,n.inputIndex=i,n}static _CreateKeyboardEvent(e,t,i,r){const s=this._CreateEvent(r);return this._CheckNonCharacterKeys(s,i),s.deviceType=c.Keyboard,s.deviceSlot=0,s.inputIndex=e,s.type=t===1?"keydown":"keyup",s.key=String.fromCharCode(e),s.keyCode=e,s}static _CheckNonCharacterKeys(e,t){const i=t.isDeviceAvailable(c.Keyboard),r=i&&t.pollInput(c.Keyboard,0,18)===1,s=i&&t.pollInput(c.Keyboard,0,17)===1,o=i&&(t.pollInput(c.Keyboard,0,91)===1||t.pollInput(c.Keyboard,0,92)===1||t.pollInput(c.Keyboard,0,93)===1),n=i&&t.pollInput(c.Keyboard,0,16)===1;e.altKey=r,e.ctrlKey=s,e.metaKey=o,e.shiftKey=n}static _CreateEvent(e){const t={};return t.preventDefault=()=>{},t.target=e,t}}class Ge{constructor(e,t,i){this._nativeInput=_native.DeviceInputSystem?new _native.DeviceInputSystem(e,t,(r,s,o,n)=>{const h=F.CreateDeviceEvent(r,s,o,n,this);i(r,s,h)}):this._createDummyNativeInput()}pollInput(e,t,i){return this._nativeInput.pollInput(e,t,i)}isDeviceAvailable(e){return e===c.Mouse||e===c.Touch}dispose(){this._nativeInput.dispose()}_createDummyNativeInput(){return{pollInput:()=>0,isDeviceAvailable:()=>!1,dispose:()=>{}}}}const ce=255,ue=Object.keys(g).length/2;class We{constructor(e,t,i,r){this._inputs=[],this._keyboardActive=!1,this._pointerActive=!1,this._usingSafari=P.IsSafari(),this._usingMacOs=Y()&&/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform),this._keyboardDownEvent=s=>{},this._keyboardUpEvent=s=>{},this._keyboardBlurEvent=s=>{},this._pointerMoveEvent=s=>{},this._pointerDownEvent=s=>{},this._pointerUpEvent=s=>{},this._pointerCancelEvent=s=>{},this._pointerCancelTouch=s=>{},this._pointerLeaveEvent=s=>{},this._pointerWheelEvent=s=>{},this._pointerBlurEvent=s=>{},this._pointerMacOsChromeOutEvent=s=>{},this._eventsAttached=!1,this._mouseId=-1,this._isUsingFirefox=Y()&&navigator.userAgent&&navigator.userAgent.indexOf("Firefox")!==-1,this._isUsingChromium=Y()&&navigator.userAgent&&navigator.userAgent.indexOf("Chrome")!==-1,this._maxTouchPoints=0,this._pointerInputClearObserver=null,this._gamepadConnectedEvent=s=>{},this._gamepadDisconnectedEvent=s=>{},this._eventPrefix=P.GetPointerPrefix(e),this._engine=e,this._onDeviceConnected=t,this._onDeviceDisconnected=i,this._onInputChanged=r,this._mouseId=this._isUsingFirefox?0:1,this._enableEvents(),this._usingMacOs&&(this._metaKeys=[]),this._engine._onEngineViewChanged||(this._engine._onEngineViewChanged=()=>{this._enableEvents()})}pollInput(e,t,i){const r=this._inputs[e][t];if(!r)throw`Unable to find device ${c[e]}`;e>=c.DualShock&&e<=c.DualSense&&this._updateDevice(e,t,i);const s=r[i];if(s===void 0)throw`Unable to find input ${i} for device ${c[e]} in slot ${t}`;return i===g.Move&&P.Warn("Unable to provide information for PointerInput.Move.  Try using PointerInput.Horizontal or PointerInput.Vertical for move data."),s}isDeviceAvailable(e){return this._inputs[e]!==void 0}dispose(){this._onDeviceConnected=()=>{},this._onDeviceDisconnected=()=>{},this._onInputChanged=()=>{},delete this._engine._onEngineViewChanged,this._elementToAttachTo&&this._disableEvents()}_enableEvents(){const e=this==null?void 0:this._engine.getInputElement();if(e&&(!this._eventsAttached||this._elementToAttachTo!==e)){if(this._disableEvents(),this._inputs){for(const t of this._inputs)if(t)for(const i in t){const r=+i,s=t[r];if(s)for(let o=0;o<s.length;o++)s[o]=0}}this._elementToAttachTo=e,this._elementToAttachTo.tabIndex=this._elementToAttachTo.tabIndex!==-1?this._elementToAttachTo.tabIndex:this._engine.canvasTabIndex,this._handleKeyActions(),this._handlePointerActions(),this._handleGamepadActions(),this._eventsAttached=!0,this._checkForConnectedDevices()}}_disableEvents(){this._elementToAttachTo&&(this._elementToAttachTo.removeEventListener("blur",this._keyboardBlurEvent),this._elementToAttachTo.removeEventListener("blur",this._pointerBlurEvent),this._elementToAttachTo.removeEventListener("keydown",this._keyboardDownEvent),this._elementToAttachTo.removeEventListener("keyup",this._keyboardUpEvent),this._elementToAttachTo.removeEventListener(this._eventPrefix+"move",this._pointerMoveEvent),this._elementToAttachTo.removeEventListener(this._eventPrefix+"down",this._pointerDownEvent),this._elementToAttachTo.removeEventListener(this._eventPrefix+"up",this._pointerUpEvent),this._elementToAttachTo.removeEventListener(this._eventPrefix+"cancel",this._pointerCancelEvent),this._elementToAttachTo.removeEventListener(this._eventPrefix+"leave",this._pointerLeaveEvent),this._elementToAttachTo.removeEventListener(this._wheelEventName,this._pointerWheelEvent),this._usingMacOs&&this._isUsingChromium&&this._elementToAttachTo.removeEventListener("lostpointercapture",this._pointerMacOsChromeOutEvent),window.removeEventListener("gamepadconnected",this._gamepadConnectedEvent),window.removeEventListener("gamepaddisconnected",this._gamepadDisconnectedEvent)),this._pointerInputClearObserver&&this._engine.onEndFrameObservable.remove(this._pointerInputClearObserver),this._eventsAttached=!1}_checkForConnectedDevices(){if(navigator.getGamepads){const e=navigator.getGamepads();for(const t of e)t&&this._addGamePad(t)}typeof matchMedia=="function"&&matchMedia("(pointer:fine)").matches&&this._addPointerDevice(c.Mouse,0,0,0)}_addGamePad(e){const t=this._getGamepadDeviceType(e.id),i=e.index;this._gamepads=this._gamepads||new Array(e.index+1),this._registerDevice(t,i,e.buttons.length+e.axes.length),this._gamepads[i]=t}_addPointerDevice(e,t,i,r){this._pointerActive||(this._pointerActive=!0),this._registerDevice(e,t,ue);const s=this._inputs[e][t];s[0]=i,s[1]=r}_registerDevice(e,t,i){if(t===void 0)throw`Unable to register device ${c[e]} to undefined slot.`;if(this._inputs[e]||(this._inputs[e]={}),!this._inputs[e][t]){const r=new Array(i);r.fill(0),this._inputs[e][t]=r,this._onDeviceConnected(e,t)}}_unregisterDevice(e,t){this._inputs[e][t]&&(delete this._inputs[e][t],this._onDeviceDisconnected(e,t))}_handleKeyActions(){this._keyboardDownEvent=e=>{this._keyboardActive||(this._keyboardActive=!0,this._registerDevice(c.Keyboard,0,ce));const t=this._inputs[c.Keyboard][0];if(t){t[e.keyCode]=1;const i=e;i.inputIndex=e.keyCode,this._usingMacOs&&e.metaKey&&e.key!=="Meta"&&(this._metaKeys.includes(e.keyCode)||this._metaKeys.push(e.keyCode)),this._onInputChanged(c.Keyboard,0,i)}},this._keyboardUpEvent=e=>{this._keyboardActive||(this._keyboardActive=!0,this._registerDevice(c.Keyboard,0,ce));const t=this._inputs[c.Keyboard][0];if(t){t[e.keyCode]=0;const i=e;if(i.inputIndex=e.keyCode,this._usingMacOs&&e.key==="Meta"&&this._metaKeys.length>0){for(const r of this._metaKeys){const s=F.CreateDeviceEvent(c.Keyboard,0,r,0,this,this._elementToAttachTo);t[r]=0,this._onInputChanged(c.Keyboard,0,s)}this._metaKeys.splice(0,this._metaKeys.length)}this._onInputChanged(c.Keyboard,0,i)}},this._keyboardBlurEvent=()=>{if(this._keyboardActive){const e=this._inputs[c.Keyboard][0];for(let t=0;t<e.length;t++)if(e[t]!==0){e[t]=0;const i=F.CreateDeviceEvent(c.Keyboard,0,t,0,this,this._elementToAttachTo);this._onInputChanged(c.Keyboard,0,i)}this._usingMacOs&&this._metaKeys.splice(0,this._metaKeys.length)}},this._elementToAttachTo.addEventListener("keydown",this._keyboardDownEvent),this._elementToAttachTo.addEventListener("keyup",this._keyboardUpEvent),this._elementToAttachTo.addEventListener("blur",this._keyboardBlurEvent)}_handlePointerActions(){this._maxTouchPoints=Y()&&navigator.maxTouchPoints||2,this._activeTouchIds||(this._activeTouchIds=new Array(this._maxTouchPoints));for(let i=0;i<this._maxTouchPoints;i++)this._activeTouchIds[i]=-1;this._pointerMoveEvent=i=>{const r=this._getPointerType(i);let s=r===c.Mouse?0:this._activeTouchIds.indexOf(i.pointerId);if(r===c.Touch&&s===-1){const n=this._activeTouchIds.indexOf(-1);if(n>=0)s=n,this._activeTouchIds[n]=i.pointerId,this._onDeviceConnected(r,s);
1else{P.Warn(`Max number of touches exceeded.  Ignoring touches in excess of ${this._maxTouchPoints}`);return}}this._inputs[r]||(this._inputs[r]={}),this._inputs[r][s]||this._addPointerDevice(r,s,i.clientX,i.clientY);const o=this._inputs[r][s];if(o){const n=i;n.inputIndex=g.Move,o[g.Horizontal]=i.clientX,o[g.Vertical]=i.clientY,r===c.Touch&&o[g.LeftClick]===0&&(o[g.LeftClick]=1),i.pointerId===void 0&&(i.pointerId=this._mouseId),this._onInputChanged(r,s,n),!this._usingSafari&&i.button!==-1&&(n.inputIndex=i.button+2,o[i.button+2]=o[i.button+2]?0:1,this._onInputChanged(r,s,n))}},this._pointerDownEvent=i=>{const r=this._getPointerType(i);let s=r===c.Mouse?0:i.pointerId;if(r===c.Touch){let n=this._activeTouchIds.indexOf(i.pointerId);if(n===-1&&(n=this._activeTouchIds.indexOf(-1)),n>=0)s=n,this._activeTouchIds[n]=i.pointerId;else{P.Warn(`Max number of touches exceeded.  Ignoring touches in excess of ${this._maxTouchPoints}`);return}}this._inputs[r]||(this._inputs[r]={}),this._inputs[r][s]?r===c.Touch&&this._onDeviceConnected(r,s):this._addPointerDevice(r,s,i.clientX,i.clientY);const o=this._inputs[r][s];if(o){const n=o[g.Horizontal],h=o[g.Vertical];if(r===c.Mouse){if(i.pointerId===void 0&&(i.pointerId=this._mouseId),!document.pointerLockElement)try{this._elementToAttachTo.setPointerCapture(this._mouseId)}catch{}}else if(i.pointerId&&!document.pointerLockElement)try{this._elementToAttachTo.setPointerCapture(i.pointerId)}catch{}o[g.Horizontal]=i.clientX,o[g.Vertical]=i.clientY,o[i.button+2]=1;const l=i;l.inputIndex=i.button+2,this._onInputChanged(r,s,l),(n!==i.clientX||h!==i.clientY)&&(l.inputIndex=g.Move,this._onInputChanged(r,s,l))}},this._pointerUpEvent=i=>{var l,d,u,m,E;const r=this._getPointerType(i),s=r===c.Mouse?0:this._activeTouchIds.indexOf(i.pointerId);if(r===c.Touch){if(s===-1)return;this._activeTouchIds[s]=-1}const o=(l=this._inputs[r])==null?void 0:l[s];let n=i.button,h=o&&o[n+2]!==0;if(!h&&this._isUsingFirefox&&this._usingMacOs&&o&&(n=n===2?0:2,h=o[n+2]!==0),h){const w=o[g.Horizontal],U=o[g.Vertical];o[g.Horizontal]=i.clientX,o[g.Vertical]=i.clientY,o[n+2]=0;const L=i;i.pointerId===void 0&&(i.pointerId=this._mouseId),(w!==i.clientX||U!==i.clientY)&&(L.inputIndex=g.Move,this._onInputChanged(r,s,L)),L.inputIndex=n+2,r===c.Mouse&&this._mouseId>=0&&((u=(d=this._elementToAttachTo).hasPointerCapture)!=null&&u.call(d,this._mouseId))?this._elementToAttachTo.releasePointerCapture(this._mouseId):i.pointerId&&((E=(m=this._elementToAttachTo).hasPointerCapture)!=null&&E.call(m,i.pointerId))&&this._elementToAttachTo.releasePointerCapture(i.pointerId),this._onInputChanged(r,s,L),r===c.Touch&&this._onDeviceDisconnected(r,s)}},this._pointerCancelTouch=i=>{var o,n;const r=this._activeTouchIds.indexOf(i);if(r===-1)return;(n=(o=this._elementToAttachTo).hasPointerCapture)!=null&&n.call(o,i)&&this._elementToAttachTo.releasePointerCapture(i),this._inputs[c.Touch][r][g.LeftClick]=0;const s=F.CreateDeviceEvent(c.Touch,r,g.LeftClick,0,this,this._elementToAttachTo,i);this._onInputChanged(c.Touch,r,s),this._activeTouchIds[r]=-1,this._onDeviceDisconnected(c.Touch,r)},this._pointerCancelEvent=i=>{var r,s;if(i.pointerType==="mouse"){const o=this._inputs[c.Mouse][0];this._mouseId>=0&&((s=(r=this._elementToAttachTo).hasPointerCapture)!=null&&s.call(r,this._mouseId))&&this._elementToAttachTo.releasePointerCapture(this._mouseId);for(let n=g.LeftClick;n<=g.BrowserForward;n++)if(o[n]===1){o[n]=0;const h=F.CreateDeviceEvent(c.Mouse,0,n,0,this,this._elementToAttachTo);this._onInputChanged(c.Mouse,0,h)}}else this._pointerCancelTouch(i.pointerId)},this._pointerLeaveEvent=i=>{i.pointerType==="pen"&&this._pointerCancelTouch(i.pointerId)}
vendor: 24,679 bytes, line 1
1,this._wheelEventName="onwheel"in document.createElement("div")?"wheel":document.onmousewheel!==void 0?"mousewheel":"DOMMouseScroll";let e=!1;const t=function(){};try{const i=Object.defineProperty({},"passive",{get:function(){e=!0}});this._elementToAttachTo.addEventListener("test",t,i),this._elementToAttachTo.removeEventListener("test",t,i)}catch{}this._pointerBlurEvent=()=>{var i,r,s,o,n;if(this.isDeviceAvailable(c.Mouse)){const h=this._inputs[c.Mouse][0];this._mouseId>=0&&((r=(i=this._elementToAttachTo).hasPointerCapture)!=null&&r.call(i,this._mouseId))&&this._elementToAttachTo.releasePointerCapture(this._mouseId);for(let l=g.LeftClick;l<=g.BrowserForward;l++)if(h[l]===1){h[l]=0;const d=F.CreateDeviceEvent(c.Mouse,0,l,0,this,this._elementToAttachTo);this._onInputChanged(c.Mouse,0,d)}}if(this.isDeviceAvailable(c.Touch)){const h=this._inputs[c.Touch];for(let l=0;l<this._activeTouchIds.length;l++){const d=this._activeTouchIds[l];if((o=(s=this._elementToAttachTo).hasPointerCapture)!=null&&o.call(s,d)&&this._elementToAttachTo.releasePointerCapture(d),d!==-1&&((n=h[l])==null?void 0:n[g.LeftClick])===1){h[l][g.LeftClick]=0;const u=F.CreateDeviceEvent(c.Touch,l,g.LeftClick,0,this,this._elementToAttachTo,d);this._onInputChanged(c.Touch,l,u),this._activeTouchIds[l]=-1,this._onDeviceDisconnected(c.Touch,l)}}}},this._pointerWheelEvent=i=>{const r=c.Mouse,s=0;this._inputs[r]||(this._inputs[r]=[]),this._inputs[r][s]||(this._pointerActive=!0,this._registerDevice(r,s,ue));const o=this._inputs[r][s];if(o){o[g.MouseWheelX]=i.deltaX||0,o[g.MouseWheelY]=i.deltaY||i.wheelDelta||0,o[g.MouseWheelZ]=i.deltaZ||0;const n=i;i.pointerId===void 0&&(i.pointerId=this._mouseId),o[g.MouseWheelX]!==0&&(n.inputIndex=g.MouseWheelX,this._onInputChanged(r,s,n)),o[g.MouseWheelY]!==0&&(n.inputIndex=g.MouseWheelY,this._onInputChanged(r,s,n)),o[g.MouseWheelZ]!==0&&(n.inputIndex=g.MouseWheelZ,this._onInputChanged(r,s,n))}},this._usingMacOs&&this._isUsingChromium&&(this._pointerMacOsChromeOutEvent=i=>{i.buttons>1&&this._pointerCancelEvent(i)},this._elementToAttachTo.addEventListener("lostpointercapture",this._pointerMacOsChromeOutEvent)),this._elementToAttachTo.addEventListener(this._eventPrefix+"move",this._pointerMoveEvent),this._elementToAttachTo.addEventListener(this._eventPrefix+"down",this._pointerDownEvent),this._elementToAttachTo.addEventListener(this._eventPrefix+"up",this._pointerUpEvent),this._elementToAttachTo.addEventListener(this._eventPrefix+"cancel",this._pointerCancelEvent),this._elementToAttachTo.addEventListener(this._eventPrefix+"leave",this._pointerLeaveEvent),this._elementToAttachTo.addEventListener("blur",this._pointerBlurEvent),this._elementToAttachTo.addEventListener(this._wheelEventName,this._pointerWheelEvent,e?{passive:!1}:!1),this._pointerInputClearObserver=this._engine.onEndFrameObservable.add(()=>{if(this.isDeviceAvailable(c.Mouse)){const i=this._inputs[c.Mouse][0];i[g.MouseWheelX]=0,i[g.MouseWheelY]=0,i[g.MouseWheelZ]=0}})}_handleGamepadActions(){this._gamepadConnectedEvent=e=>{this._addGamePad(e.gamepad)},this._gamepadDisconnectedEvent=e=>{if(this._gamepads){const t=this._getGamepadDeviceType(e.gamepad.id),i=e.gamepad.index;this._unregisterDevice(t,i),delete this._gamepads[i]}},window.addEventListener("gamepadconnected",this._gamepadConnectedEvent),window.addEventListener("gamepaddisconnected",this._gamepadDisconnectedEvent)}_updateDevice(e,t,i){const r=navigator.getGamepads()[t];if(r&&e===this._gamepads[t]){const s=this._inputs[e][t];i>=r.buttons.length?s[i]=r.axes[i-r.buttons.length].valueOf():s[i]=r.buttons[i].value}}_getGamepadDeviceType(e){return e.indexOf("054c")!==-1?e.indexOf("0ce6")!==-1?c.DualSense:c.DualShock:e.indexOf("Xbox One")!==-1||e.search("Xbox 360")!==-1||e.search("xinput")!==-1?c.Xbox:e.indexOf("057e")!==-1?c.Switch:c.Generic}_getPointerType(e){let t=c.Mouse;return(e.pointerType==="touch"||e.pointerType==="pen"||e.touches)&&(t=c.Touch),t}}class ge{constructor(e,t,i=0){this.deviceType=t,this.deviceSlot=i,this.onInputChangedObservable=new f,this._deviceInputSystem=e}getInput(e){return this._deviceInputSystem.pollInput(this.deviceType,this.deviceSlot,e)}}class Ye{constructor(e){this._registeredManagers=new Array,this._refCount=0,this.registerManager=o=>{for(let n=0;n<this._devices.length;n++){const h=this._devices[n];for(const l in h){const d=+l;o._addDevice(new ge(this._deviceInputSystem,n,d))}}this._registeredManagers.push(o)},this.unregisterManager=o=>{const n=this._registeredManagers.indexOf(o);n>-1&&this._registeredManagers.splice(n,1)};const t=Object.keys(c).length/2;this._devices=new Array(t);const i=(o,n)=>{this._devices[o]||(this._devices[o]=new Array),this._devices[o][n]||(this._devices[o][n]=n);for(const h of this._registeredManagers){const l=new ge(this._deviceInputSystem,o,n);h._addDevice(l)}},r=(o,n)=>{var h;(h=this._devices[o])!=null&&h[n]&&delete this._devices[o][n];for(const l of this._registeredManagers)l._removeDevice(o,n)},s=(o,n,h)=>{if(h)for(const l of this._registeredManagers)l._onInputChanged(o,n,h)};typeof _native<"u"?this._deviceInputSystem=new Ge(i,r,s):this._deviceInputSystem=new We(e,i,r,s)}dispose(){this._deviceInputSystem.dispose()}}class qe{getDeviceSource(e,t){if(t===void 0){if(this._firstDevice[e]===void 0)return null;t=this._firstDevice[e]}return!this._devices[e]||this._devices[e][t]===void 0?null:this._devices[e][t]}getDeviceSources(e){return this._devices[e]?this._devices[e].filter(t=>!!t):[]}constructor(e){const t=Object.keys(c).length/2;this._devices=new Array(t),this._firstDevice=new Array(t),this._engine=e,this._engine._deviceSourceManager||(this._engine._deviceSourceManager=new Ye(e)),this._engine._deviceSourceManager._refCount++,this.onDeviceConnectedObservable=new f(i=>{for(const r of this._devices)if(r)for(const s of r)s&&this.onDeviceConnectedObservable.notifyObserver(i,s)}),this.onDeviceDisconnectedObservable=new f,this._engine._deviceSourceManager.registerManager(this),this._onDisposeObserver=e.onDisposeObservable.add(()=>{this.dispose()})}dispose(){this.onDeviceConnectedObservable.clear(),this.onDeviceDisconnectedObservable.clear(),this._engine._deviceSourceManager&&(this._engine._deviceSourceManager.unregisterManager(this),--this._engine._deviceSourceManager._refCount<1&&(this._engine._deviceSourceManager.dispose(),delete this._engine._deviceSourceManager)),this._engine.onDisposeObservable.remove(this._onDisposeObserver)}_addDevice(e){this._devices[e.deviceType]||(this._devices[e.deviceType]=[]),this._devices[e.deviceType][e.deviceSlot]||(this._devices[e.deviceType][e.deviceSlot]=e,this._updateFirstDevices(e.deviceType)),this.onDeviceConnectedObservable.notifyObservers(e)}_removeDevice(e,t){var r,s;const i=(r=this._devices[e])==null?void 0:r[t];this.onDeviceDisconnectedObservable.notifyObservers(i),(s=this._devices[e])!=null&&s[t]&&delete this._devices[e][t],this._updateFirstDevices(e)}_onInputChanged(e,t,i){var r,s;(s=(r=this._devices[e])==null?void 0:r[t])==null||s.onInputChangedObservable.notifyObservers(i)}_updateFirstDevices(e){switch(e){case c.Keyboard:case c.Mouse:this._firstDevice[e]=0;break;case c.Touch:case c.DualSense:case c.DualShock:case c.Xbox:case c.Switch:case c.Generic:{delete this._firstDevice[e];const t=this._devices[e];if(t){for(let i=0;i<t.length;i++)if(t[i]){this._firstDevice[e]=i;break}}break}}}}class be{}be._IsPickingAvailable=!1;class fe{constructor(){this._singleClick=!1,this._doubleClick=!1,this._hasSwiped=!1,this._ignore=!1}get singleClick(){return this._singleClick}get doubleClick(){return this._doubleClick}get hasSwiped(){return this._hasSwiped}get ignore(){return this._ignore}set singleClick(e){this._singleClick=e}set doubleClick(e){this._doubleClick=e}set hasSwiped(e){this._hasSwiped=e}set ignore(e){this._ignore=e}}class M{constructor(e){this._alreadyAttached=!1,this._meshPickProceed=!1,this._currentPickResult=null,this._previousPickResult=null,this._activePointerIds=new Array,this._activePointerIdsCount=0,this._doubleClickOccured=!1,this._isSwiping=!1,this._swipeButtonPressed=-1,this._skipPointerTap=!1,this._isMultiTouchGesture=!1,this._pointerX=0,this._pointerY=0,this._startingPointerPosition=new X(0,0),this._previousStartingPointerPosition=new X(0,0),this._startingPointerTime=0,this._previousStartingPointerTime=0,this._pointerCaptures={},this._meshUnderPointerId={},this._movePointerInfo=null,this._cameraObserverCount=0,this._delayedClicks=[null,null,null,null,null],this._deviceSourceManager=null,this._scene=e||B.LastCreatedScene,this._scene}get meshUnderPointer(){return this._movePointerInfo&&(this._movePointerInfo._generatePickInfo(),this._movePointerInfo=null),this._pointerOverMesh}getMeshUnderPointerByPointerId(e){return this._meshUnderPointerId[e]||null}get unTranslatedPointer(){return new X(this._unTranslatedPointerX,this._unTranslatedPointerY)}get pointerX(){return this._pointerX}set pointerX(e){this._pointerX=e}get pointerY(){return this._pointerY}set pointerY(e){this._pointerY=e}_updatePointerPosition(e){const t=this._scene.getEngine().getInputElementClientRect();t&&(this._pointerX=e.clientX-t.left,this._pointerY=e.clientY-t.top,this._unTranslatedPointerX=this._pointerX,this._unTranslatedPointerY=this._pointerY)}_processPointerMove(e,t){const i=this._scene,r=i.getEngine(),s=r.getInputElement();s&&(s.tabIndex=r.canvasTabIndex,i.doNotHandleCursors||(s.style.cursor=i.defaultCursor)),this._setCursorAndPointerOverMesh(e,t,i);for(const h of i._pointerMoveStage){e=e||this._pickMove(t);const l=!!(e!=null&&e.pickedMesh);e=h.action(this._unTranslatedPointerX,this._unTranslatedPointerY,e,l,s)}const o=t.inputIndex>=g.MouseWheelX&&t.inputIndex<=g.MouseWheelZ?b.POINTERWHEEL:b.POINTERMOVE;i.onPointerMove&&(e=e||this._pickMove(t),i.onPointerMove(t,e,o));let n;e?(n=new D(o,t,e),this._setRayOnPointerInfo(e,t)):(n=new D(o,t,null,this),this._movePointerInfo=n),i.onPointerObservable.hasObservers()&&i.onPointerObservable.notifyObservers(n,o)}_setRayOnPointerInfo(e,t){const i=this._scene;e&&be._IsPickingAvailable&&(e.ray||(e.ray=i.createPickingRay(t.offsetX,t.offsetY,_e.Identity(),i.activeCamera)))}_addCameraPointerObserver(e,t){return this._cameraObserverCount++,this._scene.onPointerObservable.add(e,t)}_removeCameraPointerObserver(e){return this._cameraObserverCount--,this._scene.onPointerObservable.remove(e)}_checkForPicking(){return!!(this._scene.onPointerObservable.observers.length>this._cameraObserverCount||this._scene.onPointerPick)}_checkPrePointerObservable(e,t,i){const r=this._scene,s=new Le(i,t,this._unTranslatedPointerX,this._unTranslatedPointerY);return e&&(s.originalPickingInfo=e,s.ray=e.ray,t.pointerType==="xr-near"&&e.originMesh&&(s.nearInteractionPickingInfo=e)),r.onPrePointerObservable.notifyObservers(s,i),!!s.skipOnPointerObservable}_pickMove(e){const t=this._scene,i=t.pick(this._unTranslatedPointerX,this._unTranslatedPointerY,t.pointerMovePredicate,t.pointerMoveFastCheck,t.cameraToUseForPointers,t.pointerMoveTrianglePredicate);return this._setCursorAndPointerOverMesh(i,e,t),i}_setCursorAndPointerOverMesh(e,t,i){const s=i.getEngine().getInputElement();if(e!=null&&e.pickedMesh){if(this.setPointerOverMesh(e.pickedMesh,t.pointerId,e,t),!i.doNotHandleCursors&&s&&this._pointerOverMesh){const o=this._pointerOverMesh._getActionManagerForTrigger();o&&o.hasPointerTriggers&&(s.style.cursor=o.hoverCursor||i.hoverCursor)}}else this.setPointerOverMesh(null,t.pointerId,e,t)}simulatePointerMove(e,t){const i=new PointerEvent("pointermove",t);i.inputIndex=g.Move,!this._checkPrePointerObservable(e,i,b.POINTERMOVE)&&this._processPointerMove(e,i)}simulatePointerDown(e,t){const i=new PointerEvent("pointerdown",t);i.inputIndex=i.button+2,!this._checkPrePointerObservable(e,i,b.POINTERDOWN)&&this._processPointerDown(e,i)}_processPointerDown(e,t){const i=this._scene;if(e!=null&&e.pickedMesh){this._pickedDownMesh=e.pickedMesh;const o=e.pickedMesh._getActionManagerForTrigger();if(o){if(o.hasPickTriggers)switch(o.processTrigger(5,new T(e.pickedMesh,i.pointerX,i.pointerY,e.pickedMesh,t,e)),t.button){case 0:o.processTrigger(2,new T(e.pickedMesh,i.pointerX,i.pointerY,e.pickedMesh,t,e));break;case 1:o.processTrigger(4,new T(e.pickedMesh,i.pointerX,i.pointerY,e.pickedMesh,t,e));break;case 2:o.processTrigger(3,new T(e.pickedMesh,i.pointerX,i.pointerY,e.pickedMesh,t,e));break}o.hasSpecificTrigger(8)&&window.setTimeout(()=>{const n=i.pick(this._unTranslatedPointerX,this._unTranslatedPointerY,h=>h.isPickable&&h.isVisible&&h.isReady()&&h.actionManager&&h.actionManager.hasSpecificTrigger(8)&&h===this._pickedDownMesh,!1,i.cameraToUseForPointers);n!=null&&n.pickedMesh&&o&&this._activePointerIdsCount!==0&&Date.now()-this._startingPointerTime>M.LongPressDelay&&!this._isPointerSwiping()&&(this._startingPointerTime=0,o.processTrigger(8,T.CreateNew(n.pickedMesh,t)))},M.LongPressDelay)}}else for(const o of i._pointerDownStage)e=o.action(this._unTranslatedPointerX,this._unTranslatedPointerY,e,t,!1);let r;const s=b.POINTERDOWN;e?(i.onPointerDown&&i.onPointerDown(t,e,s),r=new D(s,t,e),this._setRayOnPointerInfo(e,t)):r=new D(s,t,null,this),i.onPointerObservable.hasObservers()&&i.onPointerObservable.notifyObservers(r,s)}_isPointerSwiping(){return this._isSwiping}simulatePointerUp(e,t,i){const r=new PointerEvent("pointerup",t);r.inputIndex=g.Move;const s=new fe;i?s.doubleClick=!0:s.singleClick=!0,!this._checkPrePointerObservable(e,r,b.POINTERUP)&&this._processPointerUp(e,r,s)}_processPointerUp(e,t,i){const r=this._scene;if(e!=null&&e.pickedMesh){if(this._pickedUpMesh=e.pickedMesh,this._pickedDownMesh===this._pickedUpMesh&&(r.onPointerPick&&r.onPointerPick(t,e),i.singleClick&&!i.ignore&&r.onPointerObservable.observers.length>this._cameraObserverCount)){const o=b.POINTERPICK,n=new D(o,t,e);this._setRayOnPointerInfo(e,t),r.onPointerObservable.notifyObservers(n,o)}const s=e.pickedMesh._getActionManagerForTrigger();if(s&&!i.ignore){s.processTrigger(7,T.CreateNew(e.pickedMesh,t,e)),!i.hasSwiped&&i.singleClick&&s.processTrigger(1,T.CreateNew(e.pickedMesh,t,e));const o=e.pickedMesh._getActionManagerForTrigger(6);i.doubleClick&&o&&o.processTrigger(6,T.CreateNew(e.pickedMesh,t,e))}}else if(!i.ignore)for(const s of r._pointerUpStage)e=s.action(this._unTranslatedPointerX,this._unTranslatedPointerY,e,t,i.doubleClick);if(this._pickedDownMesh&&this._pickedDownMesh!==this._pickedUpMesh){const s=this._pickedDownMesh._getActionManagerForTrigger(16);s&&s.processTrigger(16,T.CreateNew(this._pickedDownMesh,t))}if(!i.ignore){const s=new D(b.POINTERUP,t,e);if(this._setRayOnPointerInfo(e,t),r.onPointerObservable.notifyObservers(s,b.POINTERUP),r.onPointerUp&&r.onPointerUp(t,e,b.POINTERUP),!i.hasSwiped&&!this._skipPointerTap&&!this._isMultiTouchGesture){let o=0;if(i.singleClick?o=b.POINTERTAP:i.doubleClick&&(o=b.POINTERDOUBLETAP),o){const n=new D(o,t,e);r.onPointerObservable.hasObservers()&&r.onPointerObservable.hasSpecificMask(o)&&r.onPointerObservable.notifyObservers(n,o)}}}}isPointerCaptured(e=0){return this._pointerCaptures[e]}attachControl(e=!0,t=!0,i=!0,r=null){const s=this._scene,o=s.getEngine();r||(r=o.getInputElement()),this._alreadyAttached&&this.detachControl(),r&&(this._alreadyAttachedTo=r),this._deviceSourceManager=new qe(o),this._initActionManager=n=>{if(!this._meshPickProceed){const h=s.skipPointerUpPicking||s._registeredActions===0&&!this._checkForPicking()&&!s.onPointerUp?null:s.pick(this._unTranslatedPointerX,this._unTranslatedPointerY,s.pointerUpPredicate,s.pointerUpFastCheck,s.cameraToUseForPointers,s.pointerUpTrianglePredicate);this._currentPickResult=h,h&&(n=h.hit&&h.pickedMesh?h.pickedMesh._getActionManagerForTrigger():null),this._meshPickProceed=!0}return n},this._delayedSimpleClick=(n,h,l)=>{if((Date.now()-this._previousStartingPointerTime>M.DoubleClickDelay&&!this._doubleClickOccured||n!==this._previousButtonPressed)&&(this._doubleClickOccured=!1,h.singleClick=!0,h.ignore=!1,this._delayedClicks[n])){const d=this._delayedClicks[n].evt,u=b.POINTERTAP,m=new D(u,d,this._currentPickResult);s.onPointerObservable.hasObservers()&&s.onPointerObservable.hasSpecificMask(u)&&s.onPointerObservable.notifyObservers(m,u),this._delayedClicks[n]=null}},this._initClickEvent=(n,h,l,d)=>{var U,L;const u=new fe;this._currentPickResult=null;let m=null,E=n.hasSpecificMask(b.POINTERPICK)||h.hasSpecificMask(b.POINTERPICK)||n.hasSpecificMask(b.POINTERTAP)||h.hasSpecificMask(b.POINTERTAP)||n.hasSpecificMask(b.POINTERDOUBLETAP)||h.hasSpecificMask(b.POINTERDOUBLETAP);!E&&A&&(m=this._initActionManager(m,u),m&&(E=m.hasPickTriggers));let w=!1;if(E=E&&!this._isMultiTouchGesture,E){const R=l.button;if(u.hasSwiped=this._isPointerSwiping(),!u.hasSwiped){let W=!M.ExclusiveDoubleClickMode;if(W||(W=!n.hasSpecificMask(b.POINTERDOUBLETAP)&&!h.hasSpecificMask(b.POINTERDOUBLETAP),W&&!A.HasSpecificTrigger(6)&&(m=this._initActionManager(m,u),m&&(W=!m.hasSpecificTrigger(6)))),W)(Date.now()-this._previousStartingPointerTime>M.DoubleClickDelay||R!==this._previousButtonPressed)&&(u.singleClick=!0,d(u,this._currentPickResult),w=!0);else{const Me={evt:l,clickInfo:u,timeoutId:window.setTimeout(this._delayedSimpleClick.bind(this,R,u,d),M.DoubleClickDelay)};this._delayedClicks[R]=Me}let V=n.hasSpecificMask(b.POINTERDOUBLETAP)||h.hasSpecificMask(b.POINTERDOUBLETAP);!V&&A.HasSpecificTrigger(6)&&(m=this._initActionManager(m,u),m&&(V=m.hasSpecificTrigger(6))),V&&(R===this._previousButtonPressed&&Date.now()-this._previousStartingPointerTime<M.DoubleClickDelay&&!this._doubleClickOccured?(!u.hasSwiped&&!this._isPointerSwiping()?(this._previousStartingPointerTime=0,this._doubleClickOccured=!0,u.doubleClick=!0,u.ignore=!1,M.ExclusiveDoubleClickMode&&this._delayedClicks[R]&&(clearTimeout((U=this._delayedClicks[R])==null?void 0:U.timeoutId),this._delayedClicks[R]=null),d(u,this._currentPickResult)):(this._doubleClickOccured=!1,this._previousStartingPointerTime=this._startingPointerTime,this._previousStartingPointerPosition.x=this._startingPointerPosition.x,this._previousStartingPointerPosition.y=this._startingPointerPosition.y,this._previousButtonPressed=R,M.ExclusiveDoubleClickMode?(this._delayedClicks[R]&&(clearTimeout((L=this._delayedClicks[R])==null?void 0:L.timeoutId),this._delayedClicks[R]=null),d(u,this._previousPickResult)):d(u,this._currentPickResult)),w=!0):(this._doubleClickOccured=!1,this._previousStartingPointerTime=this._startingPointerTime,this._previousStartingPointerPosition.x=this._startingPointerPosition.x,this._previousStartingPointerPosition.y=this._startingPointerPosition.y,this._previousButtonPressed=R))}}w||d(u,this._currentPickResult)},this._onPointerMove=n=>{if(this._updatePointerPosition(n),!this._isSwiping&&this._swipeButtonPressed!==-1&&(this._isSwiping=Math.abs(this._startingPointerPosition.x-this._pointerX)>M.DragMovementThreshold||Math.abs(this._startingPointerPosition.y-this._pointerY)>M.DragMovementThreshold),o.isPointerLock&&o._verifyPointerLock(),this._checkPrePointerObservable(null,n,n.inputIndex>=g.MouseWheelX&&n.inputIndex<=g.MouseWheelZ?b.POINTERWHEEL:b.POINTERMOVE)||!s.cameraToUseForPointers&&!s.activeCamera)return;if(s.skipPointerMovePicking){this._processPointerMove(new K,n);return}s.pointerMovePredicate||(s.pointerMovePredicate=l=>l.isPickable&&l.isVisible&&l.isReady()&&l.isEnabled()&&(l.enablePointerMoveEvents||s.constantlyUpdateMeshUnderPointer||l._getActionManagerForTrigger()!==null)&&(!s.cameraToUseForPointers||(s.cameraToUseForPointers.layerMask&l.layerMask)!==0));const h=s._registeredActions>0||s.constantlyUpdateMeshUnderPointer?this._pickMove(n):null;this._processPointerMove(h,n)},this._onPointerDown=n=>{var d;const h=this._activePointerIds.indexOf(-1);if(h===-1?this._activePointerIds.push(n.pointerId):this._activePointerIds[h]=n.pointerId,this._activePointerIdsCount++,this._pickedDownMesh=null,this._meshPickProceed=!1,M.ExclusiveDoubleClickMode){for(let u=0;u<this._delayedClicks.length;u++)if(this._delayedClicks[u])if(n.button===u)clearTimeout((d=this._delayedClicks[u])==null?void 0:d.timeoutId);else{const m=this._delayedClicks[u].clickInfo;this._doubleClickOccured=!1,m.singleClick=!0,m.ignore=!1;const E=this._delayedClicks[u].evt,w=b.POINTERTAP,U=new D(w,E,this._currentPickResult);s.onPointerObservable.hasObservers()&&s.onPointerObservable.hasSpecificMask(w)&&s.onPointerObservable.notifyObservers(U,w),this._delayedClicks[u]=null}}if(this._updatePointerPosition(n),this._swipeButtonPressed===-1&&(this._swipeButtonPressed=n.button),s.preventDefaultOnPointerDown&&r&&(n.preventDefault(),r.focus()),this._startingPointerPosition.x=this._pointerX,this._startingPointerPosition.y=this._pointerY,this._startingPointerTime=Date.now(),this._checkPrePointerObservable(null,n,b.POINTERDOWN)||!s.cameraToUseForPointers&&!s.activeCamera)return;this._pointerCaptures[n.pointerId]=!0,s.pointerDownPredicate||(s.pointerDownPredicate=u=>u.isPickable&&u.isVisible&&u.isReady()&&u.isEnabled()&&(!s.cameraToUseForPointers||(s.cameraToUseForPointers.layerMask&u.layerMask)!==0)),this._pickedDownMesh=null;let l;s.skipPointerDownPicking||s._registeredActions===0&&!this._checkForPicking()&&!s.onPointerDown?l=new K:l=s.pick(this._unTranslatedPointerX,this._unTranslatedPointerY,s.pointerDownPredicate,s.pointerDownFastCheck,s.cameraToUseForPointers,s.pointerDownTrianglePredicate),this._processPointerDown(l,n)},this._onPointerUp=n=>{const h=this._activePointerIds.indexOf(n.pointerId);h!==-1&&(this._activePointerIds[h]=-1,this._activePointerIdsCount--,this._pickedUpMesh=null,this._meshPickProceed=!1,this._updatePointerPosition(n),s.preventDefaultOnPointerUp&&r&&(n.preventDefault(),r.focus()),this._initClickEvent(s.onPrePointerObservable,s.onPointerObservable,n,(l,d)=>{if(s.onPrePointerObservable.hasObservers()&&(this._skipPointerTap=!1,!l.ignore)){if(this._checkPrePointerObservable(null,n,b.POINTERUP)){this._swipeButtonPressed===n.button&&(this._isSwiping=!1,this._swipeButtonPressed=-1),n.buttons===0&&(this._pointerCaptures[n.pointerId]=!1);return}l.hasSwiped||(l.singleClick&&s.onPrePointerObservable.hasSpecificMask(b.POINTERTAP)&&this._checkPrePointerObservable(null,n,b.POINTERTAP)&&(this._skipPointerTap=!0),l.doubleClick&&s.onPrePointerObservable.hasSpecificMask(b.POINTERDOUBLETAP)&&this._checkPrePointerObservable(null,n,b.POINTERDOUBLETAP)&&(this._skipPointerTap=!0))}if(!this._pointerCaptures[n.pointerId]){this._swipeButtonPressed===n.button&&(this._isSwiping=!1,this._swipeButtonPressed=-1);return}n.buttons===0&&(this._pointerCaptures[n.pointerId]=!1),!(!s.cameraToUseForPointers&&!s.activeCamera)&&(s.pointerUpPredicate||(s.pointerUpPredicate=u=>u.isPickable&&u.isVisible&&u.isReady()&&u.isEnabled()&&(!s.cameraToUseForPointers||(s.cameraToUseForPointers.layerMask&u.layerMask)!==0)),!this._meshPickProceed&&(A&&A.HasTriggers||this._checkForPicking()||s.onPointerUp)&&this._initActionManager(null,l),d||(d=this._currentPickResult),this._processPointerUp(d,n,l),this._previousPickResult=this._currentPickResult,this._swipeButtonPressed===n.button&&(this._isSwiping=!1,this._swipeButtonPressed=-1))}))},this._onKeyDown=n=>{const h=se.KEYDOWN;if(s.onPreKeyboardObservable.hasObservers()){const l=new ie(h,n);if(s.onPreKeyboardObservable.notifyObservers(l,h),l.skipOnKeyboardObservable)return}if(s.onKeyboardObservable.hasObservers()){const l=new re(h,n);s.onKeyboardObservable.notifyObservers(l,h)}s.actionManager&&s.actionManager.processTrigger(14,T.CreateNewFromScene(s,n))},this._onKeyUp=n=>{const h=se.KEYUP;if(s.onPreKeyboardObservable.hasObservers()){const l=new ie(h,n);if(s.onPreKeyboardObservable.notifyObservers(l,h),l.skipOnKeyboardObservable)return}if(s.onKeyboardObservable.hasObservers()){const l=new re(h,n);s.onKeyboardObservable.notifyObservers(l,h)}s.actionManager&&s.actionManager.processTrigger(15,T.CreateNewFromScene(s,n))},this._deviceSourceManager.onDeviceConnectedObservable.add(n=>{n.deviceType===c.Mouse?n.onInputChangedObservable.add(h=>{this._originMouseEvent=h,h.inputIndex===g.LeftClick||h.inputIndex===g.MiddleClick||h.inputIndex===g.RightClick||h.inputIndex===g.BrowserBack||h.inputIndex===g.BrowserForward?t&&n.getInput(h.inputIndex)===1?this._onPointerDown(h):e&&n.getInput(h.inputIndex)===0&&this._onPointerUp(h):i&&(h.inputIndex===g.Move?this._onPointerMove(h):(h.inputIndex===g.MouseWheelX||h.inputIndex===g.MouseWheelY||h.inputIndex===g.MouseWheelZ)&&this._onPointerMove(h))}):n.deviceType===c.Touch?n.onInputChangedObservable.add(h=>{h.inputIndex===g.LeftClick&&(t&&n.getInput(h.inputIndex)===1?(this._onPointerDown(h),this._activePointerIdsCount>1&&(this._isMultiTouchGesture=!0)):e&&n.getInput(h.inputIndex)===0&&(this._onPointerUp(h),this._activePointerIdsCount===0&&(this._isMultiTouchGesture=!1))),i&&h.inputIndex===g.Move&&this._onPointerMove(h)}):n.deviceType===c.Keyboard&&n.onInputChangedObservable.add(h=>
1{h.type==="keydown"?this._onKeyDown(h):h.type==="keyup"&&this._onKeyUp(h)})}),this._alreadyAttached=!0}detachControl(){this._alreadyAttached&&(this._deviceSourceManager.dispose(),this._deviceSourceManager=null,this._alreadyAttachedTo&&!this._scene.doNotHandleCursors&&(this._alreadyAttachedTo.style.cursor=this._scene.defaultCursor),this._alreadyAttached=!1,this._alreadyAttachedTo=null)}setPointerOverMesh(e,t=0,i,r){if(this._meshUnderPointerId[t]===e&&(!e||!e._internalAbstractMeshDataInfo._pointerOverDisableMeshTesting))return;const s=this._meshUnderPointerId[t];let o;s&&(o=s._getActionManagerForTrigger(10),o&&o.processTrigger(10,new T(s,this._pointerX,this._pointerY,e,r,{pointerId:t}))),e?(this._meshUnderPointerId[t]=e,this._pointerOverMesh=e,o=e._getActionManagerForTrigger(9),o&&o.processTrigger(9,new T(e,this._pointerX,this._pointerY,e,r,{pointerId:t,pickResult:i}))):(delete this._meshUnderPointerId[t],this._pointerOverMesh=null),this._scene.onMeshUnderPointerUpdatedObservable.hasObservers()&&this._scene.onMeshUnderPointerUpdatedObservable.notifyObservers({mesh:e,pointerId:t})}getPointerOverMesh(){return this.meshUnderPointer}_invalidateMesh(e){this._pointerOverMesh===e&&(this._pointerOverMesh=null),this._pickedDownMesh===e&&(this._pickedDownMesh=null),this._pickedUpMesh===e&&(this._pickedUpMesh=null);for(const t in this._meshUnderPointerId)this._meshUnderPointerId[t]===e&&delete this._meshUnderPointerId[t]}}M.DragMovementThreshold=10;M.LongPressDelay=500;M.DoubleClickDelay=300;M.ExclusiveDoubleClickMode=!1;class Ce{static get UniqueId(){const e=this._UniqueIdCounter;return this._UniqueIdCounter++,e}}Ce._UniqueIdCounter=1;class Ke{constructor(){this.pointerDownFastCheck=!1,this.pointerUpFastCheck=!1,this.pointerMoveFastCheck=!1,this.skipPointerMovePicking=!1,this.skipPointerDownPicking=!1,this.skipPointerUpPicking=!1}}const Ve=new me,He=new me;var j;(function(a){a[a.BackwardCompatible=0]="BackwardCompatible",a[a.Intermediate=1]="Intermediate",a[a.Aggressive=2]="Aggressive"})(j||(j={}));class O{static DefaultMaterialFactory(e){throw k("StandardMaterial")}static CollisionCoordinatorFactory(){throw k("DefaultCollisionCoordinator")}get clearColor(){return this._clearColor}set clearColor(e){e!==this._clearColor&&(this._clearColor=e,this.onClearColorChangedObservable.notifyObservers(this._clearColor))}get imageProcessingConfiguration(){return this._imageProcessingConfiguration}get performancePriority(){return this._performancePriority}set performancePriority(e){if(e!==this._performancePriority){switch(this._performancePriority=e,e){case 0:this.skipFrustumClipping=!1,this._renderingManager.maintainStateBetweenFrames=!1,this.skipPointerMovePicking=!1,this.autoClear=!0;break;case 1:this.skipFrustumClipping=!1,this._renderingManager.maintainStateBetweenFrames=!1,this.skipPointerMovePicking=!0,this.autoClear=!1;break;case 2:this.skipFrustumClipping=!0,this._renderingManager.maintainStateBetweenFrames=!0,this.skipPointerMovePicking=!0,this.autoClear=!1;break}this.onScenePerformancePriorityChangedObservable.notifyObservers(e)}}set forceWireframe(e){this._forceWireframe!==e&&(this._forceWireframe=e,this.markAllMaterialsAsDirty(16))}get forceWireframe(){return this._forceWireframe}set skipFrustumClipping(e){this._skipFrustumClipping!==e&&(this._skipFrustumClipping=e)}get skipFrustumClipping(){return this._skipFrustumClipping}set forcePointsCloud(e){this._forcePointsCloud!==e&&(this._forcePointsCloud=e,this.markAllMaterialsAsDirty(16))}get forcePointsCloud(){return this._forcePointsCloud}get environmentTexture(){return this._environmentTexture}set environmentTexture(e){this._environmentTexture!==e&&(this._environmentTexture=e,this.onEnvironmentTextureChangedObservable.notifyObservers(e),this.markAllMaterialsAsDirty(1))}getNodes(){let e=[];e=e.concat(this.meshes),e=e.concat(this.lights),e=e.concat(this.cameras),e=e.concat(this.transformNodes);for(const t of this.skeletons)e=e.concat(t.bones);return e}get animationPropertiesOverride(){return this._animationPropertiesOverride}set animationPropertiesOverride(e){this._animationPropertiesOverride=e}set onDispose(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)}set beforeRender(e){this._onBeforeRenderObserver&&this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver),e&&(this._onBeforeRenderObserver=this.onBeforeRenderObservable.add(e))}set afterRender(e){this._onAfterRenderObserver&&this.onAfterRenderObservable.remove(this._onAfterRenderObserver),e&&(this._onAfterRenderObserver=this.onAfterRenderObservable.add(e))}set beforeCameraRender(e){this._onBeforeCameraRenderObserver&&this.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver),this._onBeforeCameraRenderObserver=this.onBeforeCameraRenderObservable.add(e)}set afterCameraRender(e){this._onAfterCameraRenderObserver&&this.onAfterCameraRenderObservable.remove(this._onAfterCameraRenderObserver),this._onAfterCameraRenderObserver=this.onAfterCameraRenderObservable.add(e)}get pointerDownPredicate(){return this._pointerPickingConfiguration.pointerDownPredicate}set pointerDownPredicate(e){this._pointerPickingConfiguration.pointerDownPredicate=e}get pointerUpPredicate(){return this._pointerPickingConfiguration.pointerUpPredicate}set pointerUpPredicate(e){this._pointerPickingConfiguration.pointerUpPredicate=e}get pointerMovePredicate(){return this._pointerPickingConfiguration.pointerMovePredicate}set pointerMovePredicate(e){this._pointerPickingConfiguration.pointerMovePredicate=e}get pointerDownFastCheck(){return this._pointerPickingConfiguration.pointerDownFastCheck}set pointerDownFastCheck(e){this._pointerPickingConfiguration.pointerDownFastCheck=e}get pointerUpFastCheck(){return this._pointerPickingConfiguration.pointerUpFastCheck}set pointerUpFastCheck(e){this._pointerPickingConfiguration.pointerUpFastCheck=e}get pointerMoveFastCheck(){return this._pointerPickingConfiguration.pointerMoveFastCheck}set pointerMoveFastCheck(e){this._pointerPickingConfiguration.pointerMoveFastCheck=e}get skipPointerMovePicking(){return this._pointerPickingConfiguration.skipPointerMovePicking}set skipPointerMovePicking(e){this._pointerPickingConfiguration.skipPointerMovePicking=e}get skipPointerDownPicking(){return this._pointerPickingConfiguration.skipPointerDownPicking}set skipPointerDownPicking(e){this._pointerPickingConfiguration.skipPointerDownPicking=e}get skipPointerUpPicking(){return this._pointerPickingConfiguration.skipPointerUpPicking}set skipPointerUpPicking(e){this._pointerPickingConfiguration.skipPointerUpPicking=e}get unTranslatedPointer(){return this._inputManager.unTranslatedPointer}static get DragMovementThreshold(){return M.DragMovementThreshold}static set DragMovementThreshold(e){M.DragMovementThreshold=e}static get LongPressDelay(){return M.LongPressDelay}static set LongPressDelay(e){M.LongPressDelay=e}static get DoubleClickDelay(){return M.DoubleClickDelay}static set DoubleClickDelay(e){M.DoubleClickDelay=e}static get ExclusiveDoubleClickMode(){return M.ExclusiveDoubleClickMode}static set ExclusiveDoubleClickMode(e){M.ExclusiveDoubleClickMode=e}get _eyePosition(){var e;return this._forcedViewPosition??((e=this.activeCamera)==null?void 0:e.globalPosition)??x.ZeroReadOnly}bindEyePosition(e,t="vEyePosition",i=!1){const r=this._eyePosition,s=this.useRightHandedSystem===(this._mirroredCameraPosition!=null),o=this.floatingOriginOffset,n=Ve.set(r.x,r.y,r.z,s?-1:1),h=n.subtractFromFloatsToRef(o.x,o.y,o.z,0,He);return e&&(i?e.setFloat3(t,h.x,h.y,h.z):e.setVector4(t,h)),n}finalizeSceneUbo(){const e=this.getSceneUniformBuffer(),t=this.bindEyePosition(null),i=this.floatingOriginOffset;return e.updateFloat4("vEyePosition",t.x-i.x,t.y-i.y,t.z-i.z,t.w),e.update(
vendor: 4,184 bytes, line 1
1),e}set useRightHandedSystem(e){this._useRightHandedSystem!==e&&(this._useRightHandedSystem=e,this.markAllMaterialsAsDirty(16))}get useRightHandedSystem(){return this._useRightHandedSystem}setStepId(e){this._currentStepId=e}getStepId(){return this._currentStepId}getInternalStep(){return this._currentInternalStep}set fogEnabled(e){this._fogEnabled!==e&&(this._fogEnabled=e,this.markAllMaterialsAsDirty(16))}get fogEnabled(){return this._fogEnabled}set fogMode(e){this._fogMode!==e&&(this._fogMode=e,this.markAllMaterialsAsDirty(16))}get fogMode(){return this._fogMode}get prePass(){return!!this.prePassRenderer&&this.prePassRenderer.defaultRT.enabled}set shadowsEnabled(e){this._shadowsEnabled!==e&&(this._shadowsEnabled=e,this.markAllMaterialsAsDirty(2))}get shadowsEnabled(){return this._shadowsEnabled}set lightsEnabled(e){this._lightsEnabled!==e&&(this._lightsEnabled=e,this.markAllMaterialsAsDirty(2))}get lightsEnabled(){return this._lightsEnabled}get activeCameras(){return this._activeCameras}set activeCameras(e){this._unObserveActiveCameras&&(this._unObserveActiveCameras(),this._unObserveActiveCameras=null),e&&(this._unObserveActiveCameras=we(e,()=>{this.onActiveCamerasChanged.notifyObservers(this)})),this._activeCameras=e}get activeCamera(){return this._activeCamera}set activeCamera(e){e!==this._activeCamera&&(this._activeCamera=e,this.onActiveCameraChanged.notifyObservers(this))}get _hasDefaultMaterial(){return O.DefaultMaterialFactory!==O._OriginalDefaultMaterialFactory}get defaultMaterial(){return this._defaultMaterial||(this._defaultMaterial=O.DefaultMaterialFactory(this)),this._defaultMaterial}set defaultMaterial(e){this._defaultMaterial=e}set texturesEnabled(e){this._texturesEnabled!==e&&(this._texturesEnabled=e,this.markAllMaterialsAsDirty(1))}get texturesEnabled(){return this._texturesEnabled}get frameGraph(){return this._frameGraph}set frameGraph(e){if(this._frameGraph){this._frameGraph=e,e||(this.customRenderFunction=this._currentCustomRenderFunction);return}this._frameGraph=e,e&&(this._currentCustomRenderFunction=this.customRenderFunction,this.customRenderFunction=this._renderWithFrameGraph,this.activeCamera=null)}set skeletonsEnabled(e){this._skeletonsEnabled!==e&&(this._skeletonsEnabled=e,this.markAllMaterialsAsDirty(8))}get skeletonsEnabled(){return this._skeletonsEnabled}get collisionCoordinator(){return this._collisionCoordinator||(this._collisionCoordinator=O.CollisionCoordinatorFactory(),this._collisionCoordinator.init(this)),this._collisionCoordinator}get renderingManager(){return this._renderingManager}get frustumPlanes(){return this._frustumPlanes}_registerTransientComponents(){if(this._transientComponents.length>0){for(const e of this._transientComponents)e.register();this._transientComponents.length=0}}_addComponent(e){this._components.push(e),this._transientComponents.push(e);const t=e;t.addFromContainer&&t.serialize&&this._serializableComponents.push(t)}_getComponent(e){for(const t of this._components)if(t.name===e)return t;return null}get uniqueId(){return this._uniqueId}constructor(e,t){this._inputManager=new M(this),this.cameraToUseForPointers=null,this._isScene=!0,this._blockEntityCollection=!1,this.autoClear=!0,this.autoClearDepthAndStencil=!0,this._clearColor=new S(.2,.2,.3,1),this.onClearColorChangedObservable=new f,this.ambientColor=new Q(0,0,0),this.environmentIntensity=1,this.iblIntensity=1,this._performancePriority=0,this.onScenePerformancePriorityChangedObservable=new f,this._forceWireframe=!1,this._skipFrustumClipping=!1,this._forcePointsCloud=!1,this.rootNodes=[],this.cameras=[],this.lights=[],this.meshes=[],this.skeletons=[],this.particleSystems=[],this.animations=[],this.animationGroups=[],this.multiMaterials=[],this.materials=[],this.morphTargetManagers=[],this.geometries=[],this.transformNodes=[],this.actionManagers=[],this.objectRenderers=[],this.textures=[],this._environmentTexture=null,this.postProcesses=[],this.effectLayers=[],this.sounds=null,this.layers=[],this.lensFlareSystems=[],this.proceduralTextures=[],this.animationsEnabled=!0,this._animationPropertiesOverride=null,this.useConstantAnimationDeltaTime=!1,this.constantlyUpdateMeshUnderPointer=!1,this.hoverCurs
1or="pointer",this.defaultCursor="",this.doNotHandleCursors=!1,this.preventDefaultOnPointerDown=!0,this.preventDefaultOnPointerUp=!0,this.metadata=null,this.reservedDataStore=null,this.disableOfflineSupportExceptionRules=[],this.onDisposeObservable=new f,this._onDisposeObserver=null,this.onBeforeRenderObservable=new f,this._onBeforeRenderObserver=null,this.onAfterRenderObservable=new f,this.onAfterRenderCameraObservable=new f,this._onAfterRenderObserver=null,this.onBeforeAnimationsObservable=new f,this.onAfterAnimationsObservable=new f,this.onBeforeDrawPhaseObservable=new f,this.onAfterDrawPhaseObservable=new f,this.onReadyObservable=new f,this.onBeforeCameraRenderObservable=new f,this._onBeforeCameraRenderObserver=null,this.onAfterCameraRenderObservable=new f,this._onAfterCameraRenderObserver=null,this.onBeforeActiveMeshesEvaluationObservable=new f,this.onAfterActiveMeshesEvaluationObservable=new f,this.onBeforeParticlesRenderingObservable=new f,this.onAfterParticlesRenderingObservable=new f,this.onDataLoadedObservable=new f,this.onNewCameraAddedObservable=new f,this.onCameraRemovedObservable=new f,this.onNewLightAddedObservable=new f,this.onLightRemovedObservable=new f,this.onNewGeometryAddedObservable=new f,this.onGeometryRemovedObservable=new f,this.onNewTransformNodeAddedObservable=new f,this.onTransformNodeRemovedObservable=new f,this.onNewMeshAddedObservable=new f,this.onMeshRemovedObservable=new f,this.onNewSkeletonAddedObservable=new f,this.onSkeletonRemovedObservable=new f,this.onNewParticleSystemAddedObservable=new f,this.onParticleSystemRemovedObservable=new f,this.onNewAnimationGroupAddedObservable=new f,this.onAnimationGroupRemovedObservable=new f,this.onNewMaterialAddedObservable=new f,this.onNewMultiMaterialAddedObservable=new f,this.onMaterialRemovedObservable=new f,this.onMultiMaterialRemovedObservable=new f,this.onNewTextureAddedObservable=new f,this.onTextureRemovedObservable=new f,this.onNewFrameGraphAddedObservable=new f,this.onFrameGraphRemovedObservable=new f,this.onNewObjectRendererAddedObservable=new f,this.onObjectRendererRemovedObservable=new f,this.onNewPostProcessAddedObservable=new f,this.onPostProcessRemovedObservable=new f,this.onNewEffectLayerAddedObservable=new f,this.onEffectLayerRemovedObservable=new f,this.onBeforeRenderTargetsRenderObservable=new f,this.onAfterRenderTargetsRenderObservable=new f,this.onBeforeStepObservable=new f,this.onAfterStepObservable=new f,this.onActiveCameraChanged=new f,this.onActiveCamerasChanged=new f,this.onBeforeRenderingGroupObservable=new f,this.onAfterRenderingGroupObservable=new f,this.onMeshImportedObservable=new f,this.onAnimationFileImportedObservable=new f,this.onEnvironmentTextureChangedObservable=new f,this.onMeshUnderPointerUpdatedObservable=new f,this._registeredForLateAnimationBindings=new G(256),this._pointerPickingConfiguration=new Ke,this.onPrePointerObservable=new f,this.onPointerObservable=new f,this.onPreKeyboardObservable=new f,this.onKeyboardObservable=new f,this._useRightHandedSystem=!1,this._timeAccumulator=0,this._currentStepId=0,this._currentInternalStep=0,this._fogEnabled=!0,this._fogMode=O.FOGMODE_NONE,this.fogColor=new Q(.2,.2,.3),this.fogDensity=.1,this.fogStart=0,this.fogEnd=1e3,this.needsPreviousWorldMatrices=!1,this._shadowsEnabled=!0,this._lightsEnabled=!0,this._unObserveActiveCameras=null,this._texturesEnabled=!0,this._frameGraph=null,this.frameGraphs=[],this.physicsEnabled=!0,this.particlesEnabled=!0,this.spritesEnabled=!0,this._skeletonsEnabled=!0,this.lensFlaresEnabled=!0,this.collisionsEnabled=!0,this.gravity=new x(0,-9.807,0),this.postProcessesEnabled=!0,this.renderTargetsEnabled=!0,this.dumpNextRenderTargets=!1,this.customRenderTargets=[],this.importedMeshesFiles=[],this.probesEnabled=!0,this._meshesForIntersections=new G(256),this.proceduralTexturesEnabled=!0,this._totalVertices=new q,this._activeIndices=new q,this._activeParticles=new q,this._activeBones=new q,this._animationTime=0,this.animationTimeScale=1,this._renderId=0,this._frameId=0,this._executeWhenReadyTimeoutId=null,this._intermediateRendering=!1,this._defaultFrameBufferCleared=!1,this._viewUpdateFlag=-1,this._projectionUpdateFlag=-1,this._toBeDisposed=new Array(256),this._activeRequests=new Array,this._pendingData=[],this._isDisposed=!1,this._isReadyChecks=[],this.dispatchAllSubMeshesOfActiveMeshes=!1,this._activeMeshes=new z(256),this._processedMaterials=new z(256),this._renderTargets=new G(256),this._materialsRenderTargets=new G(256),this._activeParticleSystems=new z(256),this._activeSkeletons=new G(32),this._softwareSkinnedMeshes=new G(32),this._activeAnimatables=new Array,this._transformMatrix=_e.Zero(),this.requireLightSorting=!1,this._components=[],this._serializableComponents=[],this._transientComponents=[],this._beforeCameraUpdateStage=y.Create(),this._beforeClearStage=y.Create(),this._beforeRenderTargetClearStage=y.Create(),this._gatherRenderTargetsStage=y.Create(),this._gatherActiveCameraRenderTargetsStage=y.Create(),this._isReadyForMeshStage=y.Create(),this._beforeEvaluateActiveMeshStage=y.Create(),this._evaluateSubMeshStage=y.Create(),this._preActiveMeshStage=y.Create(),this._cameraDrawRenderTargetStage=y.Create(),this._beforeCameraDrawStage=y.Create(),this._beforeRenderTargetDrawStage=y.Create(),this._beforeRenderingGroupDrawStage=y.Create(),this._beforeRenderingMeshStage=y.Create(),this._afterRenderingMeshStage=y.Create(),this._afterRenderingGroupDrawStage=y.Create(),this._afterCameraDrawStage=y.Create(),this._afterCameraPostProcessStage=y.Create(),this._afterRenderTargetDrawStage=y.Create(),this._afterRenderTargetPostProcessStage=y.Create(),this._afterRenderStage=y.Create(),this._pointerMoveStage=y.Create(),this._pointerDownStage=y.Create(),this._pointerUpStage=y.Create(),this._geometriesByUniqueId=null,this._uniqueId=0,this._defaultMeshCandidates={data:[],length:0},this._defaultSubMeshCandidates={data:[],length:0},this.onReadyTimeoutObservable=new f,this.onReadyTimeoutDuration=120*1e3,this._timeoutChecksStartTime=0,this._floatingOriginScene=void 0,this._preventFreeActiveMeshesAndRenderingGroups=!1,this._activeMeshesFrozen=!1,this._activeMeshesFrozenButKeepClipping=!1,this._skipEvaluateActiveMeshesCompletely=!1,this._freezeActiveMeshesCancel=null,this._useCurrentFrameBuffer=!1,this._allowPostProcessClearColor=!0,this.getDeterministicFrameTime=()=>this._engine.getTimeStep(),this._getFloatingOriginScene=()=>this._floatingOriginScene,this._registeredActions=0,this._blockMaterialDirtyMechanism=!1,this._perfCollector=null,this.activeCameras=[],this._uniqueId=this.getUniqueId();const i={useGeometryUniqueIdsMap:!0,useMaterialMeshMap:!0,useClonedMeshMap:!0,virtual:!1,...t};e=this._engine=e||B.LastCreatedEngine,i.virtual?e._virtualScenes.push(this):(B._LastCreatedScene=this,e.scenes.push(this)),(e.getCreationOptions().useLargeWorldRendering||t!=null&&t.useFloatingOrigin)&&(Ie(),this._floatingOriginScene=this,ee.getSce
vendor: 4,927 bytes, line 1
1ne=this._getFloatingOriginScene),this._uid=null,this._renderingManager=new Be(this),te&&(this.postProcessManager=new te(this)),Pe()&&this.attachControl(),this._createUbo(),_&&(this._imageProcessingConfiguration=new _),this.setDefaultCandidateProviders(),i.useGeometryUniqueIdsMap&&(this._geometriesByUniqueId={}),this.useMaterialMeshMap=i.useMaterialMeshMap,this.useClonedMeshMap=i.useClonedMeshMap,(!t||!t.virtual)&&e.onNewSceneAddedObservable.notifyObservers(this)}getClassName(){return"Scene"}_getDefaultMeshCandidates(){return this._defaultMeshCandidates.data=this.meshes,this._defaultMeshCandidates.length=this.meshes.length,this._defaultMeshCandidates}_getDefaultSubMeshCandidates(e){return this._defaultSubMeshCandidates.data=e.subMeshes,this._defaultSubMeshCandidates.length=e.subMeshes.length,this._defaultSubMeshCandidates}setDefaultCandidateProviders(){this.getActiveMeshCandidates=()=>this._getDefaultMeshCandidates(),this.getActiveSubMeshCandidates=e=>this._getDefaultSubMeshCandidates(e),this.getIntersectingSubMeshCandidates=(e,t)=>this._getDefaultSubMeshCandidates(e),this.getCollidingSubMeshCandidates=(e,t)=>this._getDefaultSubMeshCandidates(e)}get meshUnderPointer(){return this._inputManager.meshUnderPointer}get pointerX(){return this._inputManager.pointerX}set pointerX(e){this._inputManager.pointerX=e}get pointerY(){return this._inputManager.pointerY}set pointerY(e){this._inputManager.pointerY=e}getCachedMaterial(){return this._cachedMaterial}getCachedEffect(){return this._cachedEffect}getCachedVisibility(){return this._cachedVisibility}isCachedMaterialInvalid(e,t,i=1){return this._cachedEffect!==t||this._cachedMaterial!==e||this._cachedVisibility!==i}getEngine(){return this._engine}getTotalVertices(){return this._totalVertices.current}get totalVerticesPerfCounter(){return this._totalVertices}getActiveIndices(){return this._activeIndices.current}get totalActiveIndicesPerfCounter(){return this._activeIndices}getActiveParticles(){return this._activeParticles.current}get activeParticlesPerfCounter(){return this._activeParticles}getActiveBones(){return this._activeBones.current}get activeBonesPerfCounter(){return this._activeBones}getActiveMeshes(){return this._activeMeshes}getAnimationRatio(){return this._animationRatio!==void 0?this._animationRatio:1}getRenderId(){return this._renderId}getFrameId(){return this._frameId}incrementRenderId(){this._renderId++}_createUbo(){this.setSceneUniformBuffer(this.createSceneUniformBuffer())}simulatePointerMove(e,t){return this._inputManager.simulatePointerMove(e,t),this}simulatePointerDown(e,t){return this._inputManager.simulatePointerDown(e,t),this}simulatePointerUp(e,t,i){return this._inputManager.simulatePointerUp(e,t,i),this}isPointerCaptured(e=0){return this._inputManager.isPointerCaptured(e)}attachControl(e=!0,t=!0,i=!0){this._inputManager.attachControl(e,t,i)}detachControl(){this._inputManager.detachControl()}isReady(e=!0){var o,n;if(this._isDisposed)return!1;let t;const i=this.getEngine(),r=i.currentRenderPassId;i.currentRenderPassId=((o=this.activeCamera)==null?void 0:o.renderPassId)??r;let s=!0;for(this._pendingData.length>0&&(s=!1),(n=this.prePassRenderer)==null||n.update(),this.useOrderIndependentTransparency&&this.depthPeelingRenderer&&s&&(s=this.depthPeelingRenderer.isReady()),e&&(this._processedMaterials.reset(),this._materialsRenderTargets.reset()),t=0;t<this.meshes.length;t++){const h=this.meshes[t];if(!h.subMeshes||h.subMeshes.length===0)continue;if(!h.isReady(!0)){s=!1;continue}const l=h.hasThinInstances||h.getClassName()==="InstancedMesh"||h.getClassName()==="InstancedLinesMesh"||i.getCaps().instancedArrays&&h.instances.length>0;for(const u of this._isReadyForMeshStage)u.action(h,l)||(s=!1);if(!e)continue;const d=h.material||this.defaultMaterial;if(d)if(d._storeEffectOnSubMeshes)for(const u of h.subMeshes){const m=u.getMaterial();m&&m.hasRenderTargetTextures&&m.getRenderTargetTextures!=null&&this._processedMaterials.indexOf(m)===-1&&(this._processedMaterials.push(m),this._materialsRenderTargets.concatWithNoDuplicate(m.getRenderTargetTextures()))}else d.hasRenderTargetTextures&&d.getRenderTargetTextures!=null&&this._processedMaterials.indexOf(d)===-1&&(this._processedMaterials.push(d),this._materialsRenderTargets.concatWithNoDuplicate(d.getRenderTargetTextures()))}if(e)for(t=0;t<this._materialsRenderTargets.length;++t)this._materialsRenderTargets.data[t].isReadyForRendering()||(s=!1);for(t=0;t<this.geometries.length;t++)this.geometries[t].delayLoadState===2&&(s=!1);if(this.activeCameras&&this.activeCameras.length>0)for(const h of this.activeCameras)h.isReady(!0)||(s=!1);else this.activeCamera&&(this.activeCamera.isReady(!0)||(s=!1));for(const h of this.particleSystems)h.isReady()||(s=!1);if(this.layers)for(const h of this.layers)h.isReady()||(s=!1);if(this.effectLayers)for(const h of this.effectLayers)h.isLayerReady()||(s=!1);for(const h of this._isReadyChecks)h.isReady()||(s=!1);
1return i.areAllEffectsReady()||(s=!1),i.currentRenderPassId=r,s}resetCachedMaterial(){this._cachedMaterial=null,this._cachedEffect=null,this._cachedVisibility=null}registerBeforeRender(e){this.onBeforeRenderObservable.add(e)}unregisterBeforeRender(e){this.onBeforeRenderObservable.removeCallback(e)}registerAfterRender(e){this.onAfterRenderObservable.add(e)}unregisterAfterRender(e){this.onAfterRenderObservable.removeCallback(e)}_executeOnceBeforeRender(e){const t=()=>{e(),setTimeout(()=>{this.unregisterBeforeRender(t)})};this.registerBeforeRender(t)}executeOnceBeforeRender(e,t){t!==void 0?setTimeout(()=>{this._executeOnceBeforeRender(e)},t):this._executeOnceBeforeRender(e)}addPendingData(e){this._pendingData.push(e)}removePendingData(e){const t=this.isLoading,i=this._pendingData.indexOf(e);i!==-1&&this._pendingData.splice(i,1),t&&!this.isLoading&&this.onDataLoadedObservable.notifyObservers(this)}getWaitingItemsCount(){return this._pendingData.length}get isLoading(){return this._pendingData.length>0}addIsReadyCheck(e){this._isReadyChecks.indexOf(e)===-1&&this._isReadyChecks.push(e)}removeIsReadyCheck(e){const t=this._isReadyChecks.indexOf(e);t!==-1&&this._isReadyChecks.splice(t,1)}executeWhenReady(e,t=!1){this.onReadyObservable.addOnce(e),this._executeWhenReadyTimeoutId===null&&this._checkIsReady(t)}async whenReadyAsync(e=!1){return await new Promise(t=>{this.executeWhenReady(()=>{t()},e)})}_clearReadynessChecksData(){this._timeoutChecksStartTime=0,this.onReadyTimeoutObservable.clear(),this.onReadyObservable.clear(),this._executeWhenReadyTimeoutId=null}_checkIsReady(e=!1){if(this._registerTransientComponents(),this._timeoutChecksStartTime===0)this._timeoutChecksStartTime=H.Now;else if(this.onReadyTimeoutDuration>0&&H.Now-this._timeoutChecksStartTime>this.onReadyTimeoutDuration){this.onReadyTimeoutObservable.notifyObservers(this),this._clearReadynessChecksData();return}if(this.isReady(e)){this.onReadyObservable.notifyObservers(this),this._clearReadynessChecksData();return}if(this._isDisposed){this._clearReadynessChecksData();return}this._executeWhenReadyTimeoutId=setTimeout(()=>{this.incrementRenderId(),this._checkIsReady(e)},100)}get animatables(){return this._activeAnimatables}resetLastAnimationTimeFrame(){this._animationTimeLast=H.Now}getViewMatrix(){return this._viewMatrix}getProjectionMatrix(){return this._projectionMatrix}getTransformMatrix(){return this._transformMatrix}setTransformMatrix(e,t,i,r){this._multiviewSceneUboIsActive=!!(i&&r&&this._multiviewSceneUbo),!(this._viewUpdateFlag===e.updateFlag&&this._projectionUpdateFlag===t.updateFlag)&&(this._viewUpdateFlag=e.updateFlag,this._projectionUpdateFlag=t.updateFlag,this._viewMatrix=e,this._projectionMatrix=t,this._viewMatrix.multiplyToRef(this._projectionMatrix,this._transformMatrix),this._frustumPlanes?J.GetPlanesToRef(this._transformMatrix,this._frustumPlanes):this._frustumPlanes=J.GetPlanes(this._transformMatrix),this._multiviewSceneUboIsActive&&this._multiviewSceneUbo.useUbo?this._updateMultiviewUbo(i,r):this._sceneUbo.useUbo&&(this._sceneUbo.updateMatrix("viewProjection",this._transformMatrix),this._sceneUbo.updateMatrix("view",this._viewMatrix),this._sceneUbo.updateMatrix("projection",this._projectionMatrix)))}getSceneUniformBuffer(){return this._multiviewSceneUboIsActive&&this._multiviewSceneUbo?this._multiviewSceneUbo:this._sceneUbo}createSceneUniformBuffer(e,t){const i=typeof t=="boolean"?t:t==null?void 0:t.trackUBOsInFrame,r=new xe(this._engine,void 0,!1,e??"scene",void 0,i);return r.addUniform("viewProjection",16),r.addUniform("view",16),r.addUniform("projection",16),r.addUniform("vEyePosition",4),r}setSceneUniformBuffer(e){this._sceneUbo=e,this._viewUpdateFlag=-1,this._projectionUpdateFlag=-1}get floatingOriginMode(){return this._floatingOriginScene!==void 0}get floatingOriginOffset(){return this.floatingOriginMode?this._eyePosition:x.ZeroReadOnly}getUniqueId(){return Ce.UniqueId}addMesh(e,t=!1){if(!this._blockEntityCollection&&(this.meshes.push(e),e._resyncLightSources(),e.parent||e._addToSceneRootNodes(),P.SetImmediate(()=>{this.onNewMeshAddedObservable.notifyObservers(e)}),t)){const i=e.getChildMeshes();for(const r of i)this.addMesh(r)}}removeMesh(e,t=!1){const i=this.meshes.indexOf(e);if(i!==-1&&(this.meshes.splice(i,1),e.parent||e._removeFromSceneRootNodes()),this._inputManager._invalidateMesh(e),this.onMeshRemovedObservable.notifyObservers(e),t){const r=e.getChildMeshes();for(const s of r)this.removeMesh(s)}return i}
vendor: 11,833 bytes, line 1
1addTransformNode(e){this._blockEntityCollection||e.getScene()===this&&e._indexInSceneTransformNodesArray!==-1||(e._indexInSceneTransformNodesArray=this.transformNodes.length,this.transformNodes.push(e),e.parent||e._addToSceneRootNodes(),this.onNewTransformNodeAddedObservable.notifyObservers(e))}removeTransformNode(e){const t=e._indexInSceneTransformNodesArray;if(t!==-1){if(t!==this.transformNodes.length-1){const i=this.transformNodes[this.transformNodes.length-1];this.transformNodes[t]=i,i._indexInSceneTransformNodesArray=t}e._indexInSceneTransformNodesArray=-1,this.transformNodes.pop(),e.parent||e._removeFromSceneRootNodes()}return this.onTransformNodeRemovedObservable.notifyObservers(e),t}removeSkeleton(e){const t=this.skeletons.indexOf(e);return t!==-1&&(this.skeletons.splice(t,1),this.onSkeletonRemovedObservable.notifyObservers(e),this._executeActiveContainerCleanup(this._activeSkeletons)),t}removeMorphTargetManager(e){const t=this.morphTargetManagers.indexOf(e);return t!==-1&&this.morphTargetManagers.splice(t,1),t}removeLight(e){const t=this.lights.indexOf(e);if(t!==-1){for(const i of this.meshes)i._removeLightSource(e,!1);this.lights.splice(t,1),this.sortLightsByPriority(),e.parent||e._removeFromSceneRootNodes(),this.onLightRemovedObservable.notifyObservers(e)}return t}removeCamera(e){const t=this.cameras.indexOf(e);if(t!==-1&&(this.cameras.splice(t,1),e.parent||e._removeFromSceneRootNodes()),this.activeCameras){const i=this.activeCameras.indexOf(e);i!==-1&&this.activeCameras.splice(i,1)}return this.activeCamera===e&&(this.cameras.length>0?this.activeCamera=this.cameras[0]:this.activeCamera=null),this.onCameraRemovedObservable.notifyObservers(e),t}removeParticleSystem(e){const t=this.particleSystems.indexOf(e);return t!==-1&&(this.particleSystems.splice(t,1),this._executeActiveContainerCleanup(this._activeParticleSystems)),this.onParticleSystemRemovedObservable.notifyObservers(e),t}removeAnimation(e){const t=this.animations.indexOf(e);return t!==-1&&this.animations.splice(t,1),t}stopAnimation(e,t,i){}removeAnimationGroup(e){const t=this.animationGroups.indexOf(e);return t!==-1&&this.animationGroups.splice(t,1),this.onAnimationGroupRemovedObservable.notifyObservers(e),t}removeMultiMaterial(e){const t=this.multiMaterials.indexOf(e);return t!==-1&&this.multiMaterials.splice(t,1),this.onMultiMaterialRemovedObservable.notifyObservers(e),t}removeMaterial(e){const t=e._indexInSceneMaterialArray;if(t!==-1&&t<this.materials.length){if(t!==this.materials.length-1){const i=this.materials[this.materials.length-1];this.materials[t]=i,i._indexInSceneMaterialArray=t}e._indexInSceneMaterialArray=-1,this.materials.pop()}return this.onMaterialRemovedObservable.notifyObservers(e),t}removeActionManager(e){const t=this.actionManagers.indexOf(e);return t!==-1&&this.actionManagers.splice(t,1),t}removeTexture(e){const t=this.textures.indexOf(e);return t!==-1&&this.textures.splice(t,1),this.onTextureRemovedObservable.notifyObservers(e),t}removeFrameGraph(e){const t=this.frameGraphs.indexOf(e);return t!==-1&&this.frameGraphs.splice(t,1),this.onFrameGraphRemovedObservable.notifyObservers(e),t}removeObjectRenderer(e){const t=this.objectRenderers.indexOf(e);return t!==-1&&this.objectRenderers.splice(t,1),this.onObjectRendererRemovedObservable.notifyObservers(e),t}removePostProcess(e){const t=this.postProcesses.indexOf(e);return t!==-1&&this.postProcesses.splice(t,1),this.onPostProcessRemovedObservable.notifyObservers(e),t}removeEffectLayer(e){const t=this.effectLayers.indexOf(e);return t!==-1&&this.effectLayers.splice(t,1),this.onEffectLayerRemovedObservable.notifyObservers(e),t}addLight(e){if(!this._blockEntityCollection){this.lights.push(e),this.sortLightsByPriority(),e.parent||e._addToSceneRootNodes();for(const t of this.meshes)t.lightSources.indexOf(e)===-1&&(t.lightSources.push(e),t._resyncLightSources());P.SetImmediate(()=>{this.onNewLightAddedObservable.notifyObservers(e)})}}sortLightsByPriority(){this.requireLightSorting&&this.lights.sort(De.CompareLightsPriority)}addCamera(e){this._blockEntityCollection||(this.cameras.push(e),P.SetImmediate(()=>{this.onNewCameraAddedObservable.notifyObservers(e)}),e.parent||e._addToSceneRootNodes())}addSkeleton(e){this._blockEntityCollection||(this.skeletons.push(e),P.SetImmediate(()=>{this.onNewSkeletonAddedObservable.notifyObservers(e)}))}addParticleSystem(e){this._blockEntityCollection||(this.particleSystems.push(e),P.SetImmediate(()=>{this.onNewParticleSystemAddedObservable.notifyObservers(e)}))}addAnimation(e){this._blockEntityCollection||this.animations.push(e)}addAnimationGroup(e){this._blockEntityCollection||(this.animationGroups.push(e),P.SetImmediate(()=>{this.onNewAnimationGroupAddedObservable.notifyObservers(e)}))}addMultiMaterial(e){this._blockEntityCollection||(this.multiMaterials.push(e),P.SetImmediate(()=>{this.onNewMultiMaterialAddedObservable.notifyObservers(e)}))}addMaterial(e){this._blockEntityCollection||e.getScene()===this&&e._indexInSceneMaterialArray!==-1||(e._indexInSceneMaterialArray=this.materials.length,this.materials.push(e),P.SetImmediate(()=>{this.onNewMaterialAddedObservable.notifyObservers(e)}))}addMorphTargetManager(e){this._blockEntityCollection||this.morphTargetManagers.push(e)}addGeometry(e){this._blockEntityCollection||(this._geometriesByUniqueId&&(this._geometriesByUniqueId[e.uniqueId]=this.geometries.length),this.geometries.push(e))}addActionManager(e){this.actionManagers.push(e)}addTexture(e){this._blockEntityCollection||(this.textures.push(e),this.onNewTextureAddedObservable.notifyObservers(e))}addFrameGraph(e){this.frameGraphs.push(e),P.SetImmediate(()=>{this.onNewFrameGraphAddedObservable.notifyObservers(e)})}addObjectRenderer(e){this.objectRenderers.push(e),P.SetImmediate(()=>{this.onNewObjectRendererAddedObservable.notifyObservers(e)})}addPostProcess(e){this._blockEntityCollection||(this.postProcesses.push(e),P.SetImmediate(()=>{this.onNewPostProcessAddedObservable.notifyObservers(e)}))}addEffectLayer(e){this._blockEntityCollection||(this.effectLayers.push(e),P.SetImmediate(()=>{this.onNewEffectLayerAddedObservable.notifyObservers(e)}))}switchActiveCamera(e,t=!0){this._engine.getInputElement()&&(this.activeCamera&&this.activeCamera.detachControl(),this.activeCamera=e,t&&e.attachControl())}setActiveCameraById(e){const t=this.getCameraById(e);return t?(this.activeCamera=t,t):null}setActiveCameraByName(e){const t=this.getCameraByName(e);return t?(this.activeCamera=t,t):null}getAnimationGroupByName(e){for(let t=0;t<this.animationGroups.length;t++)if(this.animationGroups[t].name===e)return this.animationGroups[t];return null}_getMaterial(e,t){for(let i=0;i<this.materials.length;i++){const r=this.materials[i];if(t(r))return r}if(e)for(let i=0;i<this.multiMaterials.length;i++){const r=this.multiMaterials[i];if(t(r))return r}return null}getMaterialByUniqueID(e,t=!1){return this.getMaterialByUniqueId(e,t)}getMaterialByUniqueId(e,t=!1){return this._getMaterial(t,i=>i.uniqueId===e)}getMaterialById(e,t=!1){return this._getMaterial(t,i=>i.id===e)}getMaterialByName(e,t=!1){return this._getMaterial(t,i=>i.name===e)}getLastMaterialById(e,t=!1){for(let i=this.materials.length-1;i>=0;i--)if(this.materials[i].id===e)return this.materials[i];if(t){for(let i=this.multiMaterials.length-1;i>=0;i--)if(this.multiMaterials[i].id===e)return this.multiMaterials[i]}return null}getTextureByUniqueId(e){for(let t=0;t<this.textures.length;t++)if(this.textures[t].uniqueId===e)return this.textures[t];return null}getTextureByName(e){for(let t=0;t<this.textures.length;t++)if(this.textures[t].name===e)return this.textures[t];return null}getCameraById(e){for(let t=0;t<this.cameras.length;t++)if(this.cameras[t].id===e)return this.cameras[t];return null}getCameraByUniqueId(e){for(let t=0;t<this.cameras.length;t++)if(this.cameras[t].uniqueId===e)return this.cameras[t];return null}getCameraByName(e){for(let t=0;t<this.cameras.length;t++)if(this.cameras[t].name===e)return this.cameras[t];return null}getBoneById(e){for(let t=0;t<this.skeletons.length;t++){const i=this.skeletons[t];for(let r=0;r<i.bones.length;r++)if(i.bones[r].id===e)return i.bones[r]}return null}getBoneByName(e){for(let t=0;t<this.skeletons.length;t++){const i=this.skeletons[t];for(let r=0;r<i.bones.length;r++)if(i.bones[r].name===e)return i.bones[r]}return null}getLightByName(e){for(let t=0;t<this.lights.length;t++)if(this.lights[t].name===e)return this.lights[t];return null}getLightById(e){for(let t=0;t<this.lights.length;t++)if(this.lights[t].id===e)return this.lights[t];return null}getLightByUniqueId(e){for(let t=0;t<this.lights.length;t++)if(this.lights[t].uniqueId===e)return this.lights[t];return null}getParticleSystemById(e){for(let t=0;t<this.particleSystems.length;t++)if(this.particleSystems[t].id===e)return this.particleSystems[t];return null}getGeometryById(e){for(let t=0;t<this.geometries.length;t++)if(this.geometries[t].id===e)return this.geometries[t];return null}_getGeometryByUniqueId(e){if(this._geometriesByUniqueId){const t=this._geometriesByUniqueId[e];if(t!==void 0)return this.geometries[t]}else for(let t=0;t<this.geometries.length;t++)if(this.geometries[t].uniqueId===e)return this.geometries[t];return null}getFrameGraphByName(e){for(let t=0;t<this.frameGraphs.length;t++)if(this.frameGraphs[t].name===e)return this.frameGraphs[t];return null}pushGeometry(e,t){return!t&&this._getGeometryByUniqueId(e.uniqueId)?!1:(this.addGeometry(e),P.SetImmediate(()=>{this.onNewGeometryAddedObservable.notifyObservers(e)}),!0)}removeGeometry(e){let t;if(this._geometriesByUniqueId){if(t=this._geometriesByUniqueId[e.uniqueId],t===void 0)return!1}else if(t=this.geometries.indexOf(e),t<0)return!1;if(t!==this.geometries.length-1){const i=this.geometries[this.geometries.length-1];i&&(this.geometries[t]=i,this._geometriesByUniqueId&&(this._geometriesByUniqueId[i.uniqueId]=t))}return this._geometriesByUniqueId&&(this._geometriesByUniqueId[e.uniqueId]=void 0),this.geometries.pop(),this.onGeometryRemovedObservable.notifyObservers(e),!0}getGeometries(){return this.geometries}getMeshById(e){for(let t=0;t<this.meshes.length;t++)if(this.meshes[t].id===e)return this.meshes[t];return null}getMeshesById(e){return this.meshes.filter(function(t){return t.id===e})}getTransformNodeById(e){for(let t=0;t<this.transformNodes.length;t++)if(this.transformNodes[t].id===e)return this.transformNodes[t];return null}getTransformNodeByUniqueId(e){for(let t=0;t<this.transformNodes.length;t++)if(this.transformNodes[t].uniqueId===e)return this.transformNodes[t];return null}getTransformNodesById(e){return this.transformNodes.filter(function(t){return t.id===e})}getMeshByUniqueId(e){for(let t=0;t<this.meshes.length;t++)if(this.meshes[t].uniqueId===e)return this.meshes[t];return null}getLastMeshById(e){for(let t=this.meshes.length-1;t>=0;t--)if(this.meshes[t].id===e)return this.meshes[t];return null}getLastTransformNodeById(e){for(let t=this.transformNodes.length-1;t>=0;t--)if(this.transformNodes[t].id===e)return this.transformNodes[t];return null}getLastEntryById(e){let t;for(t=this.meshes.length-1;t>=0;t--)if(this.meshes[t].id===e)return this.meshes[t];for(t=this.transformNodes.length-1;t>=0;t--)if(this.transformNodes[t].id===e)return this.transformNodes[t];for(t=this.cameras.length-1;t>=0;t--)if(this.cameras[t].id===e)return this.cameras[t];for(t=this.lights.length-1;t>=0;t--)if(this.lights[t].id===e)return this.lights[t];for(t=this.skeletons.length-1;t>=0;t--){const i=this.skeletons[t];for(let r=i.bones.length-1;r>=0;r--)if(i.bones[r].id===e)return i.bones[r]}return null}getNodeById(e){const t=this.getMeshById(e);if(t)return t;const i=this.getTransformNodeById(e);if(i)return i;const r=this.getLightById(e);if(r)return r;const s=this.getCameraById(e);if(s)return s;const o=this.getBoneById(e);return o||null}getNodeByName(e){const t=this.getMeshByName(e);
1if(t)return t;const i=this.getTransformNodeByName(e);if(i)return i;const r=this.getLightByName(e);if(r)return r;const s=this.getCameraByName(e);if(s)return s;const o=this.getBoneByName(e);return o||null}getMeshByName(e){for(let t=0;t<this.meshes.length;t++)if(this.meshes[t].name===e)return this.meshes[t];return null}getTransformNodeByName(e){for(let t=0;t<this.transformNodes.length;t++)if(this.transformNodes[t].name===e)return this.transformNodes[t];return null}getLastSkeletonById(e){for(let t=this.skeletons.length-1;t>=0;t--)if(this.skeletons[t].id===e)return this.skeletons[t];return null}getSkeletonByUniqueId(e){for(let t=0;t<this.skeletons.length;t++)if(this.skeletons[t].uniqueId===e)return this.skeletons[t];return null}getSkeletonById(e){for(let t=0;t<this.skeletons.length;t++)if(this.skeletons[t].id===e)return this.skeletons[t];return null}getSkeletonByName(e){for(let t=0;t<this.skeletons.length;t++)if(this.skeletons[t].name===e)return this.skeletons[t];return null}getMorphTargetManagerById(e){for(let t=0;t<this.morphTargetManagers.length;t++)if(this.morphTargetManagers[t].uniqueId===e)return this.morphTargetManagers[t];return null}getMorphTargetById(e){for(let t=0;t<this.morphTargetManagers.length;++t){const i=this.morphTargetManagers[t];for(let r=0;r<i.numTargets;++r){const s=i.getTarget(r);if(s.id===e)return s}}return null}getMorphTargetByName(e){for(let t=0;t<this.morphTargetManagers.length;++t){const i=this.morphTargetManagers[t];for(let r=0;r<i.numTargets;++r){const s=i.getTarget(r);if(s.name===e)return s}}return null}getPostProcessByName(e){for(let t=0;t<this.postProcesses.length;++t){const i=this.postProcesses[t];if(i.name===e)return i}return null}isActiveMesh(e){return this._activeMeshes.indexOf(e)!==-1}get uid(){return this._uid||(this._uid=P.RandomId()),this._uid}addExternalData(e,t){return this._externalData||(this._externalData=new ne),this._externalData.add(e,t)}getExternalData(e){return this._externalData?this._externalData.get(e):null}getOrAddExternalDataWithFactory(e,t){return this._externalData||(this._externalData=new ne),this._externalData.getOrAddWithFactory(e,t)}removeExternalData(e){return this._externalData.remove(e)}_evaluateSubMesh(e,t,i,r){if(r||e.isInFrustum(this._frustumPlanes)){for(const o of this._evaluateSubMeshStage)o.action(t,e);const s=e.getMaterial();s!=null&&(s.hasRenderTargetTextures&&s.getRenderTargetTextures!=null&&this._processedMaterials.indexOf(s)===-1&&(this._processedMaterials.push(s),this._materialsRenderTargets.concatWithNoDuplicate(s.getRenderTargetTextures())),this._renderingManager.dispatch(e,t,s))}}freeProcessedMaterials(){this._processedMaterials.dispose()}get blockfreeActiveMeshesAndRenderingGroups(){return this._preventFreeActiveMeshesAndRenderingGroups}set blockfreeActiveMeshesAndRenderingGroups(e){this._preventFreeActiveMeshesAndRenderingGroups!==e&&(e&&(this.freeActiveMeshes(),this.freeRenderingGroups()),this._preventFreeActiveMeshesAndRenderingGroups=e)}freeActiveMeshes(){if(!this.blockfreeActiveMeshesAndRenderingGroups&&(this._activeMeshes.dispose(),this.activeCamera&&this.activeCamera._activeMeshes&&this.activeCamera._activeMeshes.dispose(),this.activeCameras))for(let e=0;e<this.activeCameras.length;e++){const t=this.activeCameras[e];t&&t._activeMeshes&&t._activeMeshes.dispose()}}freeRenderingGroups(){if(!this.blockfreeActiveMeshesAndRenderingGroups&&(this._renderingManager&&this._renderingManager.freeRenderingGroups(),this.textures))for(let e=0;e<this.textures.length;e++){const t=this.textures[e];t&&t.renderList&&t.freeRenderingGroups()}}_isInIntermediateRendering(){return this._intermediateRendering}freezeActiveMeshes(e=!1,t,i,r=!0,s=!1){if(this.frameGraph){this._renderWithFrameGraph(!0,!1,!0);const o=this.frameGraph.getTasksByClassName(["FrameGraphObjectRendererTask","FrameGraphGeometryRendererTask"]);for(const n of o)n.objectRenderer._freezeActiveMeshes(r);return this._freezeActiveMeshesCancel=ke(()=>{let n=!0,h=!0;for(const l of o)n&&(n=l.objectRenderer._isFrozen),h&&(h=l.objectRenderer._freezeActiveMeshesCancel!==null);if(n)return!0;if(!h)throw new Error("Freezing active meshes was cancelled");return!1},()=>{this._freezeActiveMeshesCancel=null,this._activeMeshesFrozen=!0,this._activeMeshesFrozenButKeepClipping=s,this._skipEvaluateActiveMeshesCompletely=e,t==null||t()},(n,h)=>{if(this._freezeActiveMeshesCancel=null,this.unfreezeActiveMeshes(),h){const l="Scene: Timeout while waiting for meshes to be frozen.";i?i(l):(I.Error(l),n&&I.Error(n))}else{const l="Scene: An unexpected error occurred while trying to freeze active meshes.";i?i(l):(I.Error(l),n&&(I.Error(n),n.stack&&I.Error(n.stack)))}}),this}return this.executeWhenReady(()=>
1{if(!this.activeCamera){i&&i("No active camera found");return}if(this._frustumPlanes||this.updateTransformMatrix(),this._evaluateActiveMeshes(),this._activeMeshesFrozen=!0,this._activeMeshesFrozenButKeepClipping=s,this._skipEvaluateActiveMeshesCompletely=e,r)for(let o=0;o<this._activeMeshes.length;o++)this._activeMeshes.data[o]._freeze();t&&t()}),this}unfreezeActiveMeshes(){var e;for(let t=0;t<this.meshes.length;t++){const i=this.meshes[t];i._internalAbstractMeshDataInfo&&(i._internalAbstractMeshDataInfo._isActive=!1)}if((e=this._freezeActiveMeshesCancel)==null||e.call(this),this._freezeActiveMeshesCancel=null,this.frameGraph){const t=this.frameGraph.getTasksByClassName(["FrameGraphObjectRendererTask","FrameGraphGeometryRendererTask"]);for(const i of t)i.objectRenderer._unfreezeActiveMeshes()}else for(let t=0;t<this._activeMeshes.length;t++)this._activeMeshes.data[t]._unFreeze();return this._activeMeshesFrozen=!1,this}_executeActiveContainerCleanup(e){!(this._engine.snapshotRendering&&this._engine.snapshotRenderingMode===1)&&this._activeMeshesFrozen&&this._activeMeshes.length||this.onBeforeRenderObservable.addOnce(()=>e.dispose())}_evaluateActiveMeshes(){var i;if(this._engine.snapshotRendering&&this._engine.snapshotRenderingMode===1){this._activeMeshes.length>0&&((i=this.activeCamera)==null||i._activeMeshes.reset(),this._activeMeshes.reset(),this._renderingManager.reset(),this._processedMaterials.reset(),this._activeParticleSystems.reset(),this._activeSkeletons.reset(),this._softwareSkinnedMeshes.reset());return}if(this._activeMeshesFrozen&&this._activeMeshes.length){if(!this._skipEvaluateActiveMeshesCompletely){const r=this._activeMeshes.length;for(let s=0;s<r;s++)this._activeMeshes.data[s].computeWorldMatrix()}if(this._activeParticleSystems){const r=this._activeParticleSystems.length;for(let s=0;s<r;s++)this._activeParticleSystems.data[s].animate()}this._renderingManager.resetSprites();return}if(!this.activeCamera)return;this.onBeforeActiveMeshesEvaluationObservable.notifyObservers(this),this.activeCamera._activeMeshes.reset(),this._activeMeshes.reset(),this._renderingManager.reset(),this._processedMaterials.reset(),this._activeParticleSystems.reset(),this._activeSkeletons.reset(),this._softwareSkinnedMeshes.reset(),this._materialsRenderTargets.reset();for(const r of this._beforeEvaluateActiveMeshStage)r.action();const e=this.getActiveMeshCandidates(),t=e.length;for(let r=0;r<t;r++){const s=e.data[r];let o=s._internalAbstractMeshDataInfo._currentLOD.get(this.activeCamera);if(o?o[1]=-1:(o=[s,-1],s._internalAbstractMeshDataInfo._currentLOD.set(this.activeCamera,o)),s.isBlocked||(this._totalVertices.addCount(s.getTotalVertices(),!1),!s.isReady()||!s.isEnabled()||s.scaling.hasAZeroComponent))continue;s.computeWorldMatrix(),s.actionManager&&s.actionManager.hasSpecificTriggers2(12,13)&&this._meshesForIntersections.pushNoDuplicate(s);let n=this.customLODSelector?this.customLODSelector(s,this.activeCamera):s.getLOD(this.activeCamera);if(o[0]=n,o[1]=this._frameId,n!=null&&(n!==s&&n.billboardMode!==0&&n.computeWorldMatrix(),s._preActivate(),s.isVisible&&s.visibility>0&&(s.layerMask&this.activeCamera.layerMask)!==0&&(this._skipFrustumClipping||s.alwaysSelectAsActiveMesh||s.isInFrustum(this._frustumPlanes)))){this._activeMeshes.push(s),this.activeCamera._activeMeshes.push(s),n!==s&&n._activate(this._renderId,!1);for(const h of this._preActiveMeshStage)h.action(s);s._activate(this._renderId,!1)&&(s.isAnInstance?s._internalAbstractMeshDataInfo._actAsRegularMesh&&(n=s):n._internalAbstractMeshDataInfo._onlyForInstances=!1,n._internalAbstractMeshDataInfo._isActive=!0,this._activeMesh(s,n)),s._postActivate()}}if(this.onAfterActiveMeshesEvaluationObservable.notifyObservers(this),this.particlesEnabled){this.onBeforeParticlesRenderingObservable.notifyObservers(this);for(let r=0;r<this.particleSystems.length;r++){const s=this.particleSystems[r];if(!s.isStarted()||!s.emitter)continue;const o=s.emitter;(!o.position||o.isEnabled())&&(this._activeParticleSystems.push(s),s.animate(),this._renderingManager.dispatchParticles(s))}this.onAfterParticlesRenderingObservable.notifyObservers(this)}}_prepareSkeleton(e){!this._skeletonsEnabled||!e.skeleton||(this._activeSkeletons.pushNo
1Duplicate(e.skeleton)&&(e.skeleton.prepare(),this._activeBones.addCount(e.skeleton.bones.length,!1)),e.computeBonesUsingShaders||this._softwareSkinnedMeshes.pushNoDuplicate(e)&&this.frameGraph&&e.applySkeleton(e.skeleton))}_activeMesh(e,t){this._prepareSkeleton(t);let i=e.hasInstances||e.isAnInstance||this.dispatchAllSubMeshesOfActiveMeshes||this._skipFrustumClipping||t.alwaysSelectAsActiveMesh;if(t&&t.subMeshes&&t.subMeshes.length>0){const r=this.getActiveSubMeshCandidates(t),s=r.length;i=i||s===1;for(let o=0;o<s;o++){const n=r.data[o];this._evaluateSubMesh(n,t,e,i)}}}updateTransformMatrix(e){const t=this.activeCamera;if(t)if(t._renderingMultiview){const i=t._rigCameras[0],r=t._rigCameras[1];this.setTransformMatrix(i.getViewMatrix(),i.getProjectionMatrix(e),r.getViewMatrix(),r.getProjectionMatrix(e))}else this.setTransformMatrix(t.getViewMatrix(),t.getProjectionMatrix(e))}_bindFrameBuffer(e,t=!0){this._useCurrentFrameBuffer||(e&&e._multiviewTexture?e._multiviewTexture._bindFrameBuffer():e&&e.outputRenderTarget?e.outputRenderTarget._bindFrameBuffer():this._engine._currentFrameBufferIsDefaultFrameBuffer()||this._engine.restoreDefaultFramebuffer()),t&&this._clearFrameBuffer(e)}_clearFrameBuffer(e){if(!(e&&e._multiviewTexture))if(e&&e.outputRenderTarget&&!e._renderingMultiview){const t=e.outputRenderTarget;t.onClearObservable.hasObservers()?t.onClearObservable.notifyObservers(this._engine):!t.skipInitialClear&&!e.isRightCamera&&(this.autoClear&&this._engine.clear(t.clearColor||this._clearColor,!t._cleared,!0,!0),t._cleared=!0)}else this._defaultFrameBufferCleared?this._engine.clear(null,!1,!0,!0):(this._defaultFrameBufferCleared=!0,this._clear())}_renderForCamera(e,t,i=!0){var n,h,l;if(e&&e._skipRendering)return;const r=this._engine;if(this._activeCamera=e,!this.activeCamera)throw new Error("Active camera not set");if(r.setViewport(this.activeCamera.viewport),this.resetCachedMaterial(),this._renderId++,!this.prePass&&i){let d=!0;e._renderingMultiview&&e.outputRenderTarget&&(d=e.outputRenderTarget.skipInitialClear,this.autoClear&&(this._defaultFrameBufferCleared=!1,e.outputRenderTarget.skipInitialClear=!1)),this._bindFrameBuffer(this._activeCamera),e._renderingMultiview&&e.outputRenderTarget&&(e.outputRenderTarget.skipInitialClear=d)}this.updateTransformMatrix(),this.onBeforeCameraRenderObservable.notifyObservers(this.activeCamera),this._engine.currentRenderPassId=((n=e.outputRenderTarget)==null?void 0:n.renderPassId)??e.renderPassId??0,this._evaluateActiveMeshes();for(let d=0;d<this._softwareSkinnedMeshes.length;d++){const u=this._softwareSkinnedMeshes.data[d];u.applySkeleton(u.skeleton)}this.onBeforeRenderTargetsRenderObservable.notifyObservers(this),this._renderTargets.concatWithNoDuplicate(this._materialsRenderTargets),e.customRenderTargets&&e.customRenderTargets.length>0&&this._renderTargets.concatWithNoDuplicate(e.customRenderTargets),t&&t.customRenderTargets&&t.customRenderTargets.length>0&&this._renderTargets.concatWithNoDuplicate(t.customRenderTargets),this.environmentTexture&&this.environmentTexture.isRenderTarget&&this._renderTargets.pushNoDuplicate(this.environmentTexture);for(const d of this._gatherActiveCameraRenderTargetsStage)d.action(this._renderTargets);let s=!1;if(this.renderTargetsEnabled){this._intermediateRendering=!0;let d;if(this._renderTargets.length>0){P.StartPerformanceCounter("Render targets",this._renderTargets.length>0);const u=(h=this.getBoundingBoxRenderer)==null?void 0:h.call(this);for(let m=0;m<this._renderTargets.length;m++){const E=this._renderTargets.data[m];if(E._shouldRender()){this._renderId++;const w=E.activeCamera&&E.activeCamera!==this.activeCamera;u&&!d&&(d=u.renderList.length>0?u.renderList.data.slice():[],d.length=u.renderList.length),E.render(w,this.dumpNextRenderTargets),s=!0}}u&&d&&(u.renderList.data=d,u.renderList.length=d.length),P.EndPerformanceCounter("Render targets",this._renderTargets.length>0),this._renderId++}if(this._cameraDrawRenderTargetStage.length>0){const u=(l=this.getBoundingBoxRenderer)==null?void 0:l.call(this);u&&!d&&(d=u.renderList.length>0?u.renderList.data.slice():[],d.length=u.renderList.length);for(const m of this._cameraDrawRenderTargetStage)s=m.action(this.activeCamera)||s;u&&d&&(u.renderList.data=d,u.renderList.length=d.length)}this._intermediateRendering=!1}s&&!this.prePass&&(this._bindFrameBuffer(this._activeCamera,!1),this.updateTransformMatrix()),this.onAfterRenderTargetsRenderObservable.notifyObservers(this),this.postProcessManager&&!e._multiviewTexture&&!this.prePass&&this.postProcessManager._prepareFrame();for(const d of this._beforeCameraDrawStage)d.action(this.activeCamera);this.onBeforeDrawPhaseObservable.notifyObservers(this);const o=r.snapshotRendering&&r.snapshotRenderingMode===1;o&&this.finalizeSceneUbo(),this._renderingManager.render(null,null,!0,!o),this.onAfterDrawPhaseObservable.notifyObservers(this);for(const d of this._afterCameraDrawStage)d.action(this.activeCamera);if(this.postProcessManager&&!e._multiviewTexture){const d=e.outputRenderTarget?e.outputRenderTarget.renderTarget:void 0;this.postProcessManager._finalizeFrame(e.isIntermediate,d)}for(const d of this._afterCameraPostProcessStage)d.action(this.activeCamera);this._renderTargets.reset(),this.onAfterCameraRenderObservable.notifyObservers(this.activeCamera)}_processSubCameras(e,t=!0){if(e.cameraRigMode===0||e._renderingMultiview){e._renderingMultiview&&!this._multiviewSceneUbo&&this._createMultiviewUbo(),this._renderForCamera(e,void 0,t),this.onAfterRenderCameraObservable.notifyObservers(e);return}if(e._useMultiviewToSingleView)this._renderMultiviewToSingleView(e);else{this.onBeforeCameraRenderObservable.notifyObservers(e);for(let i=0;i<e._rigCameras.length;i++)this._renderForCamera(e._rigCameras[i],e)}this._activeCamera=e,this.updateTransformMatrix(),this.onAfterRenderCameraObservable.notifyObservers(e)}_checkIntersections(){for(let e=0;e<this._meshesForIntersections.length;e++){const t=this._meshesForIntersections.data[e];if(t.actionManager)for(let i=0;t.actionManager&&i<t.actionManager.actions.length;i++){const r=t.actionManager.actions[i];if(r.trigger===12||r.trigger===13){const s=r.getTriggerParameter(),o=s.mesh?s.mesh:s,n=o.intersectsMesh(t,s.usePre
1ciseIntersection),h=t._intersectionsInProgress.indexOf(o);n&&h===-1?r.trigger===12?(r._executeCurrent(T.CreateNew(t,void 0,o)),t._intersectionsInProgress.push(o)):r.trigger===13&&t._intersectionsInProgress.push(o):!n&&h>-1&&(r.trigger===13&&r._executeCurrent(T.CreateNew(t,void 0,o)),(!t.actionManager.hasSpecificTrigger(13,l=>{const d=l.mesh?l.mesh:l;return o===d})||r.trigger===13)&&t._intersectionsInProgress.splice(h,1))}}}}_advancePhysicsEngineStep(e){}_animate(e){}animate(){if(this._engine.isDeterministicLockStep()){let e=Math.max(O.MinDeltaTime,Math.min(this._engine.getDeltaTime(),O.MaxDeltaTime))+this._timeAccumulator;const t=this._engine.getTimeStep(),i=1e3/t/1e3;let r=0;const s=this._engine.getLockstepMaxSteps();let o=Math.floor(e/t);for(o=Math.min(o,s);e>0&&r<o;)this.onBeforeStepObservable.notifyObservers(this),this._animationRatio=t*i,this._animate(t),this.onAfterAnimationsObservable.notifyObservers(this),this.physicsEnabled&&this._advancePhysicsEngineStep(t),this.onAfterStepObservable.notifyObservers(this),this._currentStepId++,r++,e-=t;this._timeAccumulator=e<0?0:e}else{const e=this.useConstantAnimationDeltaTime?16:Math.max(O.MinDeltaTime,Math.min(this._engine.getDeltaTime(),O.MaxDeltaTime));this._animationRatio=e*(60/1e3),this._animate(),this.onAfterAnimationsObservable.notifyObservers(this),this.physicsEnabled&&this._advancePhysicsEngineStep(e)}}_clear(){(this.autoClearDepthAndStencil||this.autoClear)&&this._engine.clear(this._clearColor,this.autoClear||this.forceWireframe||this.forcePointsCloud,this.autoClearDepthAndStencil,this.autoClearDepthAndStencil)}_checkCameraRenderTarget(e){var t;if(e!=null&&e.outputRenderTarget&&!(e!=null&&e.isRigCamera)&&(e.outputRenderTarget._cleared=!1),(t=e==null?void 0:e.rigCameras)!=null&&t.length)for(let i=0;i<e.rigCameras.length;++i){const r=e.rigCameras[i].outputRenderTarget;r&&(r._cleared=!1)}}resetDrawCache(e){if(this.meshes)for(const t of this.meshes)t.resetDrawCache(e)}_renderWithFrameGraph(e=!0,t=!1,i=!1){var s,o;if(this.activeCamera=null,this.activeCameras=null,e){for(const n of this.cameras)if(n.update(),n.cameraRigMode!==0)for(let h=0;h<n._rigCameras.length;h++)n._rigCameras[h].update()}this.onBeforeRenderObservable.notifyObservers(this),this.onBeforeRenderTargetsRenderObservable.notifyObservers(this),this._renderTargets.reset();const r=((s=this._frameGraph)==null?void 0:s.findMainCamera())??null;if(this.renderTargetsEnabled){this.environmentTexture&&this.environmentTexture.isRenderTarget&&this._renderTargets.pushNoDuplicate(this.environmentTexture),this._renderTargets.concatWithNoDuplicate(this.customRenderTargets),P.StartPerformanceCounter("Custom render targets",this._renderTargets.length>0);for(let n=0;n<this._renderTargets.length;n++){const h=this._renderTargets.data[n],l=h.activeCamera||r;this._renderRenderTarget(h,l,!0,this.dumpNextRenderTargets)}P.EndPerformanceCounter("Custom render targets",this._renderTargets.length>0),this._renderId++}this.onAfterRenderTargetsRenderObservable.notifyObservers(this);for(const n of this._beforeClearStage)n.action();if(this._engine.snapshotRendering&&this._engine.snapshotRenderingMode===1)this._activeParticleSystems.reset(),this._activeSkeletons.reset(),this._softwareSkinnedMeshes.reset();else{const n=this.getActiveMeshCandidates(),h=n.length;if(this._activeMeshesFrozen){if(!this._skipEvaluateActiveMeshesCompletely)for(let l=0;l<h;l++){const d=n.data[l];d._internalAbstractMeshDataInfo._wasActiveLastFrame&&d.computeWorldMatrix()}if(this.particlesEnabled){const l=this._activeParticleSystems.length;for(let d=0;d<l;d++)this._activeParticleSystems.data[d].animate()}}else{this._activeParticleSystems.reset(),this._activeSkeletons.reset(),this._softwareSkinnedMeshes.reset();for(let l=0;l<h;l++){const d=n.data[l];d._internalAbstractMeshDataInfo._wasActiveLastFrame=!1,!d.isBlocked&&(this._totalVertices.addCount(d.getTotalVertices(),!1),!(!d.isReady()||!d.isEnabled()||d.scaling.hasAZeroComponent)&&(d.computeWorldMatrix(i),d.actionManager&&d.actionManager.hasSpecificTriggers2(12,13)&&this._meshesForIntersections.pushNoDuplicate(d)))}if(this.particlesEnabled)for(let l=0;l<this.particleSystems.length;l++){const d=this.particleSystems[l];if(!d.isStarted()||!d.emitter)continue;const u=d.emitter;(!u.position||u.isEnabled())&&(this._activeParticleSystems.push(d),d.animate())}}}(o=this.frameGraph)==null||o.execute()}_renderRenderTarget(e,t,i=!1,r=!1){if(this._intermediateRendering=!0,e._shouldRender()){if(this._renderId++,this.activeCamera=t,!this.activeCamera)throw new Error("Active camera not set");this._engine.setViewport(this.activeCamera.viewport),this.updateTransformMatrix(),e.render(i,r)}this._intermediateRendering=!1}render(e=!0,t=!1){var i,r;if(!this.isDisposed){if(this.onReadyObservable.hasObservers()&&this._executeWhenReadyTimeoutId===null&&this._checkIsReady(),ee.getSce
1ne=this._getFloatingOriginScene,this._frameId++,this._defaultFrameBufferCleared=!1,this._checkCameraRenderTarget(this.activeCamera),(i=this.activeCameras)!=null&&i.length)for(const s of this.activeCameras)this._checkCameraRenderTarget(s);this._registerTransientComponents(),this._activeParticles.fetchNewFrame(),this._totalVertices.fetchNewFrame(),this._activeIndices.fetchNewFrame(),this._activeBones.fetchNewFrame(),this._meshesForIntersections.reset(),this.resetCachedMaterial(),this.onBeforeAnimationsObservable.notifyObservers(this),this.actionManager&&this.actionManager.processTrigger(11),t||this.animate();for(const s of this._beforeCameraUpdateStage)s.action();if(e){if(this.activeCameras&&this.activeCameras.length>0)for(let s=0;s<this.activeCameras.length;s++){const o=this.activeCameras[s];if(o.update(),o.cameraRigMode!==0)for(let n=0;n<o._rigCameras.length;n++)o._rigCameras[n].update()}else if(this.activeCamera&&(this.activeCamera.update(),this.activeCamera.cameraRigMode!==0))for(let s=0;s<this.activeCamera._rigCameras.length;s++)this.activeCamera._rigCameras[s].update()}if(this.customRenderFunction)this._renderId++,this._engine.currentRenderPassId=0,this.customRenderFunction(e,t);else{this.onBeforeRenderObservable.notifyObservers(this),this.onBeforeRenderTargetsRenderObservable.notifyObservers(this);const s=(r=this.activeCameras)!=null&&r.length?this.activeCameras[0]:this.activeCamera;if(this.renderTargetsEnabled){P.StartPerformanceCounter("Custom render targets",this.customRenderTargets.length>0);for(let o=0;o<this.customRenderTargets.length;o++){const n=this.customRenderTargets[o],h=n.activeCamera||this.activeCamera;this._renderRenderTarget(n,h,s!==h,this.dumpNextRenderTargets)}P.EndPerformanceCounter("Custom render targets",this.customRenderTargets.length>0),this._renderId++}this._engine.currentRenderPassId=(s==null?void 0:s.renderPassId)??0,this.activeCamera=s,this._activeCamera&&this._activeCamera.cameraRigMode!==22&&!this.prePass&&this._bindFrameBuffer(this._activeCamera,!1),this.onAfterRenderTargetsRenderObservable.notifyObservers(this);for(const o of this._beforeClearStage)o.action();this._clearFrameBuffer(this.activeCamera);for(const o of this._gatherRenderTargetsStage)o.action(this._renderTargets);if(this.activeCameras&&this.activeCameras.length>0)for(let o=0;o<this.activeCameras.length;o++)this._processSubCameras(this.activeCameras[o],o>0);else{if(!this.activeCamera)throw new Error("No camera defined");this._processSubCameras(this.activeCamera,!!this.activeCamera.outputRenderTarget)}}this._checkIntersections();for(const s of this._afterRenderStage)s.action();if(this.afterRender&&this.afterRender(),this.onAfterRenderObservable.notifyObservers(this),this._toBeDisposed.length){for(let s=0;s<this._toBeDisposed.length;s++){const o=this._toBeDisposed[s];o&&o.dispose()}this._toBeDisposed.length=0}this.dumpNextRenderTargets&&(this.dumpNextRenderTargets=!1),this._activeBones.addCount(0,!0),this._activeIndices.addCount(0,!0),this._activeParticles.addCount(0,!0),this._engine.restoreDefaultFramebuffer()}}freezeMaterials(){for(let e=0;e<this.materials.length;e++)this.materials[e].freeze()}unfreezeMaterials(){for(let e=0;e<this.materials.length;e++)this.materials[e].unfreeze()}dispose(){if(this.isDisposed)return;if(this.beforeRender=null,this.afterRender=null,this.metadata=null,this.skeletons.length=0,this.morphTargetManagers.length=0,this._transientComponents.length=0,this._isReadyForMeshStage.clear(),this._beforeEvaluateActiveMeshStage.clear(),this._evaluateSubMeshStage.clear(),this._preActiveMeshStage.clear(),this._cameraDrawRenderTargetStage.clear(),this._beforeCameraDrawStage.clear(),this._beforeRenderTargetDrawStage.clear(),this._beforeRenderingGroupDrawStage.clear(),this._beforeRenderingMeshStage.clear(),this._afterRenderingMeshStage.clear(),this._afterRenderingGroupDrawStage.clear(),this._afterCameraDrawStage.clear(),this._afterRenderTargetDrawStage.clear(),this._afterRenderStage.clear(),this._beforeCameraUpdateStage.clear(),this._beforeClearStage.clear(),this._gatherRenderTargetsStage.clear(),this._gatherActiveCameraRenderTargetsStage.clear(),this._pointerMoveStage.clear(),this._pointerDownStage.clear(),this._pointerUpStage.clear(),this._isReadyChecks.length=0,this.importedMeshesFiles=[],this._activeAnimatables&&this.stopAllAnimations){for(const s of this._activeAnimatables)s.onAnimationEndObservable.clear(),s.onAnimationEnd=null;this.stopAllAnimations()}this.resetCachedMaterial(),this.activeCamera&&(this.activeCamera._activeMeshes.dispose(),this.activeCamera=null),this.activeCameras=null,this._activeMeshes.dispose(),this._renderingManager.dispose(),this._processedMaterials.dispose(),this._activeParticleSystems.dispose(),this._activeSkeletons.dispose(),this._softwareSkinnedMeshes.dispose(),this._renderTargets.dispose(),this._materialsRenderTargets.dispose(),this._registeredForLateAnimationBindings.dispose(),this._meshesForIntersections.dispose(),this._toBeDisposed.length=0;const e=this._activeRequests.slice();for(const s of e)s.abort();this._activeRequests.length=0;try{this.onDisposeObservable.notifyObservers(this)}catch(s){I.Error("An error occurred while calling onDisposeObservable!",s)}if(this.detachControl(),this._engine.getInputElement())for(let s=0;s<this.cameras.length;s++)this.cameras[s].detachControl();this._disposeList(this.animationGroups),this._disposeList(this.lights),this._defaultMaterial&&this._defaultMaterial.dispose(),this._disposeList(this.multiMaterials),this._disposeList(this.materials),this._disposeList(this.meshes,s=>s.dispose(!0)),this._disposeList(this.transformNodes,s=>s.dispose(!0));const i=this.cameras;this._disposeList(i),this._disposeList(this.particleSystems),this._disposeList(this.postProcesses),this._disposeList(this.textures),this._disposeList(this.morphTargetManagers),this._disposeList(this.frameGraphs),this._sceneUbo.dispose(),this._multiviewSceneUbo&&this._multiviewSceneUbo.dispose(),this.postProcessManager.dispose(),this._disposeList(this._components);let r=this._engine.scenes.indexOf(this);if(r>-1&&this._engine.scenes.splice(r,1),this._floatingOriginScene=void 0,this._engine.scenes.length===0&&Se(),B._LastCreatedScene===this){B._LastCreatedScene=null;let s=B.Instances.length-1;for(;s>=0;){const o=B.Instances[s];if(o.scenes.length>0){B._LastCreatedScene=o.scenes[this._engine.scenes.length-1];break}s--}}r=this._engine._virtualScenes.indexOf(this),r>-1&&this._engine._virtualScenes.splice(r,1),this._engine.wipeCaches(!0),this.onDisposeObservable.clear(),this.onBeforeRenderObservable.clear(),this.onAfterRenderObservable.clear(),this.onBeforeRenderTargetsRenderObservable.clear(),this.onAfterRenderTargetsRenderObservable.clear(),this.onAfterStepObservable.clear(),this.onBeforeStepObservable.clear(),this.onBeforeActiveMeshesEvaluationObservable.clear(),this.onAfterActiveMeshesEvaluationObservable.clear(),this.onBeforeParticlesRenderingObservable.clear(),this.onAfterParticlesRenderingObservable.clear(),this.onBeforeDrawPhaseObservable.clear(),this.onAfterDrawPhaseObservable.clear(),this.onBeforeAnimationsObservable.clear(),this.onAfterAnimationsObservable.clear(),this.onDataLoadedObservable.clear(),this.onBeforeRenderingGroupObservable.clear(),this.onAfterRenderingGroupObservable.clear(),this.onMeshImportedObservable.clear(),this.onBeforeCameraRenderObservable.clear(),this.onAfterCameraRenderObservable.clear(),this.onAfterRenderCameraObservable.clear(),this.onReadyObservable.clear(),this.onNewCameraAddedObservable.clear(),this.onCameraRemovedObservable.clear(),this.onNewLightAddedObservable.clear(),this.onLightRemovedObservable.clear(),this.onNewGeometryAddedObservable.clear(),this.onGeometryRemovedObservable.clear(),this.onNewTransformNodeAddedObservable.clear(),this.onTransformNodeRemovedObservable.clear(),this.onNewMeshAddedObservable.clear(),this.onMeshRemovedObservable.clear(),this.onNewSkeletonAddedObservable.clear(),this.onSkeletonRemovedObservable.clear(),this.onNewMaterialAddedObservable.clear(),this.onNewMultiMaterialAddedObservable.clear(),this.onMaterialRemovedObservable.clear(),this.onMultiMaterialRemovedObservable.clear(),this.onNewTextureAddedObservable.clear(),this.onTextureRemovedObservable.clear(),this.onNewFrameGraphAddedObservable.clear(),this.onFrameGraphRemovedObservable.clear(),this.onNewObjectRendererAddedObservable.clear(),this.onObjectRendererRemovedObservable.clear(),this.onPrePointerObservable.clear(),this.onPointerObservable.clear(),this.onPreKeyboardObservable.clear(),this.onKeyboardObservable.clear(),this.onActiveCameraChanged.clear(),this.onScenePerformancePriorityChangedObservable.clear(),this.onClearColorChangedObservable.clear(),this.onEnvironmentTextureChangedObservable.clear(),this.onMeshUnderPointerUpdatedObservable.clear(),this._isDisposed=!0}
1_disposeList(e,t){const i=e.slice(0);t=t??(r=>r.dispose());for(const r of i)t(r);e.length=0}get isDisposed(){return this._isDisposed}clearCachedVertexData(){for(let e=0;e<this.meshes.length;e++){const i=this.meshes[e].geometry;i&&i.clearCachedData()}}cleanCachedTextureBuffer(){for(const e of this.textures)e._buffer&&(e._buffer=null)}getWorldExtends(e){const t=new x(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),i=new x(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);e=e||(()=>!0);const r=this.meshes.filter(e);for(const s of r){if(s.computeWorldMatrix(!0),!s.subMeshes||s.subMeshes.length===0||s.infiniteDistance)continue;const o=s.getBoundingInfo(),n=o.boundingBox.minimumWorld,h=o.boundingBox.maximumWorld;x.CheckExtends(n,t,i),x.CheckExtends(h,t,i)}return t.x===Number.MAX_VALUE?{min:x.Zero(),max:x.Zero()}:{min:t,max:i}}createPickingRay(e,t,i,r,s=!1){throw k("Ray")}createPickingRayToRef(e,t,i,r,s,o=!1,n=!1){throw k("Ray")}createPickingRayInCameraSpace(e,t,i){throw k("Ray")}createPickingRayInCameraSpaceToRef(e,t,i,r){throw k("Ray")}pick(e,t,i,r,s,o){const n=k("Ray",!0);return n&&I.Warn(n),new K}pickWithBoundingInfo(e,t,i,r,s){const o=k("Ray",!0);return o&&I.Warn(o),new K}pickWithRay(e,t,i,r){throw k("Ray")}multiPick(e,t,i,r,s){throw k("Ray")}multiPickWithRay(e,t,i){throw k("Ray")}setPointerOverMesh(e,t,i){this._inputManager.setPointerOverMesh(e,t,i)}getPointerOverMesh(){return this._inputManager.getPointerOverMesh()}_rebuildGeometries(){for(const e of this.geometries)e._rebuild();for(const e of this.meshes)e._rebuild();this.postProcessManager&&this.postProcessManager._rebuild();for(const e of this._components)e.rebuild();for(const e of this.particleSystems)e.rebuild();if(this.spriteManagers)for(const e of this.spriteManagers)e.rebuild()}_rebuildTextures(){for(const e of this.textures)e._rebuild(!0);this.markAllMaterialsAsDirty(1)}_getByTags(e,t,i){if(t===void 0)return e;const r=[];for(const s in e){const o=e[s];$&&$.MatchesQuery(o,t)&&(!i||i(o))&&r.push(o)}return r}getMeshesByTags(e,t){return this._getByTags(this.meshes,e,t)}getCamerasByTags(e,t){return this._getByTags(this.cameras,e,t)}getLightsByTags(e,t){return this._getByTags(this.lights,e,t)}getMaterialByTags(e,t){return this._getByTags(this.materials,e,t).concat(this._getByTags(this.multiMaterials,e,t))}getTransformNodesByTags(e,t){return this._getByTags(this.transformNodes,e,t)}setRenderingOrder(e,t=null,i=null,r=null){this._renderingManager.setRenderingOrder(e,t,i,r)}setRenderingAutoClearDepthStencil(e,t,i=!0,r=!0){this._renderingManager.setRenderingAutoClearDepthStencil(e,t,i,r)}getAutoClearDepthStencilSetup(e){return this._renderingManager.getAutoClearDepthStencilSetup(e)}_forceBlockMaterialDirtyMechanism(e){this._blockMaterialDirtyMechanism=e}get blockMaterialDirtyMechanism(){return this._blockMaterialDirtyMechanism}set blockMaterialDirtyMechanism(e){this._blockMaterialDirtyMechanism!==e&&(this._blockMaterialDirtyMechanism=e,e||this.markAllMaterialsAsDirty(127))}markAllMaterialsAsDirty(e,t){if(!this._blockMaterialDirtyMechanism)for(const i of this.materials)t&&!t(i)||i.markAsDirty(e)}_loadFile(e,t,i,r,s,o,n){const h=ye(e,t,i,r?this.offlineProvider:void 0,s,o,n);return this._activeRequests.push(h),h.onCompleteObservable.add(l=>{this._activeRequests.splice(this._activeRequests.indexOf(l),1)}),h}async _loadFileAsync(e,t,i,r,s){return await new Promise((o,n)=>{this._loadFile(e,h=>{o(h)},t,i,r,(h,l)=>{n(l)},s)})}_requestFile(e,t,i,r,s,o,n){const h=Te(e,t,i,r?this.offlineProvider:void 0,s,o,n);return this._activeRequests.push(h),h.onCompleteObservable.add(l=>{this._activeRequests.splice(this._activeRequests.indexOf(l),1)}),h}async _requestFileAsync(e,t,i,r,s){return await new Promise((o,n)=>{this._requestFile(e,h=>{o(h)},t,i,r,h=>{n(h)},s)})}_readFile(e,t,i,r,s){const o=Oe(e,t,i,r,s);return this._activeRequests.push(o),o.onCompleteObservable.add(n=>{this._activeRequests.splice(this._activeRequests.indexOf(n),1)}),o}async _readFileAsync(e,t,i){return await new Promise((r,s)=>{this._readFile(e,o=>{r(o)},t,i,o=>{s(o)})})}getPerfCollector(){throw k("performanceViewerSceneExtension")}setActiveCameraByID(e){return this.setActiveCameraById(e)}getMaterialByID(e){return this.getMaterialById(e)}getLastMaterialByID(e){return this.getLastMaterialById(e)}getTextureByUniqueID(e){return this.getTextureByUniqueId(e)}getCameraByID(e){return this.getCameraById(e)}getCameraByUniqueID(e){return this.getCameraByUniqueId(e)}getBoneByID(e){return this.getBoneById(e)}getLightByID(e){return this.getLightById(e)}getLightByUniqueID(e){return this.getLightByUniqueId(e)}getParticleSystemByID(e){return this.getParticleSystemById(e)}getGeometryByID(e){return this.getGeometryById(e)}getMeshByID(e){return this.getMeshById(e)}getMeshByUniqueID(e){return this.getMeshByUniqueId(e)}getLastMeshByID(e){return this.getLastMeshById(e)}getMeshesByID(e){return this.getMeshesById(e)}getTransformNodeByID(e){return this.getTransformNodeById(e)}getTransformNodeByUniqueID(e){return this.getTransformNodeByUniqueId(e)}getTransformNodesByID(e){return this.getTransformNodesById(e)}getNodeByID(e){return this.getNodeById(e)}getLastEntryByID(e){return this.getLastEntryById(e)}getLastSkeletonByID(e){return this.getLastSkeletonById(e)}}O.FOGMODE_NONE=0;O.FOGMODE_EXP=1;O.FOGMODE_EXP2=2;O.FOGMODE_LINEAR=3;O.MinDeltaTime=1;O.MaxDeltaTime=1e3;O._OriginalDefaultMaterialFactory=O.DefaultMaterialFactory;pe("BABYLON.Scene",O);const nt=Object.freeze(Object.defineProperty({__proto__:null,Scene:O,get ScenePerformancePriority(){return j}},Symbol.toStringTag,{value:"Module"}));
1export{_ as I,O as S,Ce as U,be as _,nt as s};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.