KEMBAR78
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("babylonjs",[],t):"object"==typeof exports?exports.babylonjs=t():e.BABYLON=t()}("undefined"!=typeof self?self:"undefined"!=typeof global?global:this,(()=>(()=>{"use strict";var e={132:(e,t,n)=>{n.r(t),n.d(t,{FlowGraphGetPropertyBlock:()=>a});var r=n(78322),i=n(88099),o=n(34623),a=function(e){function t(t){var n=e.call(this,i.Vv,t)||this;return n.config=t,n.object=n.registerDataInput("object",i.Vv,t.object),n.propertyName=n.registerDataInput("propertyName",i.Vv,t.propertyName),n.customGetFunction=n.registerDataInput("customGetFunction",i.Vv),n}return(0,r.C6)(t,e),t.prototype._doOperation=function(e){var t,n=this.customGetFunction.getValue(e);if(n)t=n(this.object.getValue(e),this.propertyName.getValue(e),e);else{var r=this.object.getValue(e),i=this.propertyName.getValue(e);t=r&&i?this._getPropertyValue(r,i):void 0}return t},t.prototype._getPropertyValue=function(e,t){for(var n=e,r=0,i=t.split(".");r{n.d(t,{n:()=>o});var r=n(7164),i=n(34623),o=function(){function e(){}return e.Instantiate=function(e){if(this.RegisteredExternalClasses&&this.RegisteredExternalClasses[e])return this.RegisteredExternalClasses[e];var t=(0,i.n9)(e);if(t)return t;r.V.Warn(e+" not found, you may have missed an import.");for(var n=e.split("."),o=window||this,a=0,s=n.length;a{var r=n(98519),i="samplerFragmentDeclaration";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="#ifdef _DEFINENAME_\n#if _DEFINENAME_DIRECTUV==1\n#define v_VARYINGNAME_UV vMainUV1\n#elif _DEFINENAME_DIRECTUV==2\n#define v_VARYINGNAME_UV vMainUV2\n#elif _DEFINENAME_DIRECTUV==3\n#define v_VARYINGNAME_UV vMainUV3\n#elif _DEFINENAME_DIRECTUV==4\n#define v_VARYINGNAME_UV vMainUV4\n#elif _DEFINENAME_DIRECTUV==5\n#define v_VARYINGNAME_UV vMainUV5\n#elif _DEFINENAME_DIRECTUV==6\n#define v_VARYINGNAME_UV vMainUV6\n#else\nvarying v_VARYINGNAME_UV: vec2f;\n#endif\nvar _SAMPLERNAME_SamplerSampler: sampler;var _SAMPLERNAME_Sampler: texture_2d;\n#endif\n")},559:(e,t,n)=>{n.d(t,{k:()=>a});var r=n(78322),i=n(81152),o=n(67568),a=function(e){function t(t){return e.call(this,t)||this}return(0,r.C6)(t,e),Object.defineProperty(t.prototype,"depthRenderer",{get:function(){return this._depthRenderer},enumerable:!1,configurable:!0}),t.prototype.setDepthRenderer=function(t,n,r){void 0===t&&(t=null),void 0===n&&(n=i.Y.TEXTURETYPE_HALF_FLOAT),void 0===r&&(r=!0);var a=this._camera.getScene();this._depthRenderer&&(delete a._depthRenderer[this._depthRendererId],this._depthRenderer.dispose(),this._depthRenderer=null),null===t&&(a._depthRenderer||(a._depthRenderer={}),this._depthRendererId="minmax_"+this._camera.id,(t=this._depthRenderer=new o.d(a,n,this._camera,!1,i.Y.TEXTURE_NEAREST_SAMPLINGMODE,!1,"DepthRenderer ".concat(this._depthRendererId))).enabled=!1,a._depthRenderer[this._depthRendererId]=t),e.prototype.setSourceTexture.call(this,t.getDepthMap(),!0,n,r)},t.prototype.setSourceTexture=function(t,n,r,o){void 0===r&&(r=i.Y.TEXTURETYPE_HALF_FLOAT),void 0===o&&(o=!0),e.prototype.setSourceTexture.call(this,t,n,r,o)},t.prototype.activate=function(){this._depthRenderer&&(this._depthRenderer.enabled=!0),e.prototype.activate.call(this)},t.prototype.deactivate=function(){e.prototype.deactivate.call(this),this._depthRenderer&&(this._depthRenderer.enabled=!1)},t.prototype.dispose=function(t){void 0===t&&(t=!0),e.prototype.dispose.call(this,t),this._depthRenderer&&t&&(this._depthRenderer.dispose(),this._depthRenderer=null)},t}(n(73216).R)},583:(e,t,n)=>{n.r(t),n.d(t,{meshUVSpaceRendererFinaliserVertexShaderWGSL:()=>a});var r=n(98519),i="meshUVSpaceRendererFinaliserVertexShader",o="attribute position: vec3f;attribute uv: vec2f;uniform worldViewProjection: mat4x4f;varying vUV: vec2f;@vertex\nfn main(input : VertexInputs)->FragmentInputs {vertexOutputs.position=uniforms.worldViewProjection* vec4f(input.position,1.0);vertexOutputs.positionvUV=input.uv;}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},608:(e,t,n)=>{n.d(t,{BG:()=>s,PR:()=>c,eG:()=>f,g7:()=>p,jf:()=>h,kF:()=>u,kX:()=>l,rT:()=>m,tl:()=>d});var r=n(78322),i=n(5153),o=n(82673),a=n(66614);function s(e,t,n){e._onCanvasFocus=function(){e.onCanvasFocusObservable.notifyObservers(e)},e._onCanvasBlur=function(){e.onCanvasBlurObservable.notifyObservers(e)},e._onCanvasContextMenu=function(t){e.disableContextMenu&&t.preventDefault()},t.addEventListener("focus",e._onCanvasFocus),t.addEventListener("blur",e._onCanvasBlur),t.addEventListener("contextmenu",e._onCanvasContextMenu),e._onBlur=function(){e.disablePerformanceMonitorInBackground&&e.performanceMonitor.disable(),e._windowIsBackground=!0},e._onFocus=function(){e.disablePerformanceMonitorInBackground&&e.performanceMonitor.enable(),e._windowIsBackground=!1},e._onCanvasPointerOut=function(n){document.elementFromPoint(n.clientX,n.clientY)!==t&&e.onCanvasPointerOutObservable.notifyObservers(n)};var r=e.getHostWindow();r&&"function"==typeof r.addEventListener&&(r.addEventListener("blur",e._onBlur),r.addEventListener("focus",e._onFocus)),t.addEventListener("pointerout",e._onCanvasPointerOut),n.doNotHandleTouchAction||function(e){e&&e.setAttribute&&(e.setAttribute("touch-action","none"),e.style.touchAction="none",e.style.webkitTapHighlightColor="transparent")}(t),!o.$.audioEngine&&n.audioEngine&&o.$.AudioEngineFactory&&(o.$.audioEngine=o.$.AudioEngineFactory(e.getRenderingCanvas(),e.getAudioContext(),e.getAudioDestination())),(0,i.Nf)()&&(e._onFullscreenChange=function(){e.isFullscreen=!!document.fullscreenElement,e.isFullscreen&&e._pointerLockRequested&&t&&f(t)},document.addEventListener("fullscreenchange",e._onFullscreenChange,!1),document.addEventListener("webkitfullscreenchange",e._onFullscreenChange,!1),e._onPointerLockChange=function(){e.isPointerLock=document.pointerLockElement===t},document.addEventListener("pointerlockchange",e._onPointerLockChange,!1),document.addEventListener("webkitpointerlockchange",e._onPointerLockChange,!1)),e.enableOfflineSupport=void 0!==o.$.OfflineProviderFactory,e._deterministicLockstep=!!n.deterministicLockstep,e._lockstepMaxSteps=n.lockstepMaxSteps||0,e._timeStep=n.timeStep||1/60}function l(e,t){1===a.q.Instances.length&&o.$.audioEngine&&(o.$.audioEngine.dispose(),o.$.audioEngine=null);var n=e.getHostWindow();n&&"function"==typeof n.removeEventListener&&(n.removeEventListener("blur",e._onBlur),n.removeEventListener("focus",e._onFocus)),t&&(t.removeEventListener("focus",e._onCanvasFocus),t.removeEventListener("blur",e._onCanvasBlur),t.removeEventListener("pointerout",e._onCanvasPointerOut),t.removeEventListener("contextmenu",e._onCanvasContextMenu)),(0,i.Nf)()&&(document.removeEventListener("fullscreenchange",e._onFullscreenChange),document.removeEventListener("mozfullscreenchange",e._onFullscreenChange),document.removeEventListener("webkitfullscreenchange",e._onFullscreenChange),document.removeEventListener("msfullscreenchange",e._onFullscreenChange),document.removeEventListener("pointerlockchange",e._onPointerLockChange),document.removeEventListener("mspointerlockchange",e._onPointerLockChange),document.removeEventListener("mozpointerlockchange",e._onPointerLockChange),document.removeEventListener("webkitpointerlockchange",e._onPointerLockChange))}function c(e){var t=document.createElement("span");t.textContent="Hg",t.style.font=e;var n=document.createElement("div");n.style.display="inline-block",n.style.width="1px",n.style.height="0px",n.style.verticalAlign="bottom";var r=document.createElement("div");r.style.whiteSpace="nowrap",r.appendChild(t),r.appendChild(n),document.body.appendChild(r);var i=0,o=0;try{o=n.getBoundingClientRect().top-t.getBoundingClientRect().top,n.style.verticalAlign="baseline",i=n.getBoundingClientRect().top-t.getBoundingClientRect().top}finally{document.body.removeChild(r)}return{ascent:i,height:o,descent:o-i}}function u(e,t,n){return(0,r.sH)(this,void 0,void 0,(function(){return(0,r.YH)(this,(function(r){switch(r.label){case 0:return[4,new Promise((function(r,i){var o=new Image;o.onload=function(){o.decode().then((function(){e.createImageBitmap(o,n).then((function(e){r(e)}))}))},o.onerror=function(){i("Error loading image ".concat(o.src))},o.src=t}))];case 1:return[2,r.sent()]}}))}))}function h(e,t,n,r){var i=e.createCanvas(n,r).getContext("2d");if(!i)throw new Error("Unable to get 2d context for resizeImageBitmap");return i.drawImage(t,0,0),i.getImageData(0,0,n,r).data}function d(e){var t=e.requestFullscreen||e.webkitRequestFullscreen;t&&t.call(e)}function p(){var e=document;document.exitFullscreen?document.exitFullscreen():e.webkitCancelFullScreen&&e.webkitCancelFullScreen()}function f(e){if(e.requestPointerLock){var t=e.requestPointerLock();t instanceof Promise?t.then((function(){e.focus()})).catch((function(){})):e.focus()}}function m(){document.exitPointerLock&&document.exitPointerLock()}},779:(e,t,n)=>{n.r(t),n.d(t,{geometryVertexShader:()=>l});var r=n(98519),i=(n(36470),n(64400),n(24444),n(67369),n(38615),"geometryVertexDeclaration");r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="uniform mat4 viewProjection;uniform mat4 view;"),n(50851);var o="geometryUboDeclaration";r.l.IncludesShadersStore[o]||(r.l.IncludesShadersStore[o]="#include\n"),n(85637),n(58266),n(84589),n(35397),n(76898),n(49334),n(83057),n(35845);var a="geometryVertexShader",s="precision highp float;\n#include\n#include\n#include\n#include[0..maxSimultaneousMorphTargets]\n#include\n#include<__decl__geometryVertex>\n#include\nattribute vec3 position;\n#ifdef HAS_NORMAL_ATTRIBUTE\nattribute vec3 normal;\n#endif\n#ifdef NEED_UV\nvarying vec2 vUV;\n#ifdef ALPHATEST\nuniform mat4 diffuseMatrix;\n#endif\n#ifdef BUMP\nuniform mat4 bumpMatrix;varying vec2 vBumpUV;\n#endif\n#ifdef REFLECTIVITY\nuniform mat4 reflectivityMatrix;uniform mat4 albedoMatrix;varying vec2 vReflectivityUV;varying vec2 vAlbedoUV;\n#endif\n#ifdef METALLIC_TEXTURE\nvarying vec2 vMetallicUV;uniform mat4 metallicMatrix;\n#endif\n#ifdef ROUGHNESS_TEXTURE\nvarying vec2 vRoughnessUV;uniform mat4 roughnessMatrix;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#endif\n#ifdef BUMP\nvarying mat4 vWorldView;\n#endif\n#ifdef BUMP\nvarying vec3 vNormalW;\n#else\nvarying vec3 vNormalV;\n#endif\nvarying vec4 vViewPos;\n#if defined(POSITION) || defined(BUMP)\nvarying vec3 vPositionW;\n#endif\n#if defined(VELOCITY) || defined(VELOCITY_LINEAR)\nuniform mat4 previousViewProjection;varying vec4 vCurrentPosition;varying vec4 vPreviousPosition;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void)\n{vec3 positionUpdated=position;\n#ifdef HAS_NORMAL_ATTRIBUTE\nvec3 normalUpdated=normal;\n#else\nvec3 normalUpdated=vec3(0.0,0.0,0.0);\n#endif\n#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#ifdef UV2\nvec2 uv2Updated=uv2;\n#endif\n#include\n#include[0..maxSimultaneousMorphTargets]\n#include\n#if (defined(VELOCITY) || defined(VELOCITY_LINEAR)) && !defined(BONES_VELOCITY_ENABLED)\nvCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);vPreviousPosition=previousViewProjection*finalPreviousWorld*vec4(positionUpdated,1.0);\n#endif\n#include\n#include\nvec4 worldPos=vec4(finalWorld*vec4(positionUpdated,1.0));\n#ifdef BUMP\nvWorldView=view*finalWorld;mat3 normalWorld=mat3(finalWorld);vNormalW=normalize(normalWorld*normalUpdated);\n#else\n#ifdef NORMAL_WORLDSPACE\nvNormalV=normalize(vec3(finalWorld*vec4(normalUpdated,0.0)));\n#else\nvNormalV=normalize(vec3((view*finalWorld)*vec4(normalUpdated,0.0)));\n#endif\n#endif\nvViewPos=view*worldPos;\n#if (defined(VELOCITY) || defined(VELOCITY_LINEAR)) && defined(BONES_VELOCITY_ENABLED)\nvCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);\n#if NUM_BONE_INFLUENCERS>0\nmat4 previousInfluence;previousInfluence=mPreviousBones[int(matricesIndices[0])]*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\npreviousInfluence+=mPreviousBones[int(matricesIndices[1])]*matricesWeights[1];\n#endif\n#if NUM_BONE_INFLUENCERS>2\npreviousInfluence+=mPreviousBones[int(matricesIndices[2])]*matricesWeights[2];\n#endif\n#if NUM_BONE_INFLUENCERS>3\npreviousInfluence+=mPreviousBones[int(matricesIndices[3])]*matricesWeights[3];\n#endif\n#if NUM_BONE_INFLUENCERS>4\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0];\n#endif\n#if NUM_BONE_INFLUENCERS>5\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1];\n#endif\n#if NUM_BONE_INFLUENCERS>6\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2];\n#endif\n#if NUM_BONE_INFLUENCERS>7\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3];\n#endif\nvPreviousPosition=previousViewProjection*finalPreviousWorld*previousInfluence*vec4(positionUpdated,1.0);\n#else\nvPreviousPosition=previousViewProjection*finalPreviousWorld*vec4(positionUpdated,1.0);\n#endif\n#endif\n#if defined(POSITION) || defined(BUMP)\nvPositionW=worldPos.xyz/worldPos.w;\n#endif\ngl_Position=viewProjection*finalWorld*vec4(positionUpdated,1.0);\n#include\n#ifdef NEED_UV\n#ifdef UV1\n#if defined(ALPHATEST) && defined(ALPHATEST_UV1)\nvUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));\n#else\nvUV=uvUpdated;\n#endif\n#ifdef BUMP_UV1\nvBumpUV=vec2(bumpMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef REFLECTIVITY_UV1\nvReflectivityUV=vec2(reflectivityMatrix*vec4(uvUpdated,1.0,0.0));\n#else\n#ifdef METALLIC_UV1\nvMetallicUV=vec2(metallicMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef ROUGHNESS_UV1\nvRoughnessUV=vec2(roughnessMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#endif\n#ifdef ALBEDO_UV1\nvAlbedoUV=vec2(albedoMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#endif\n#ifdef UV2\n#if defined(ALPHATEST) && defined(ALPHATEST_UV2)\nvUV=vec2(diffuseMatrix*vec4(uv2Updated,1.0,0.0));\n#else\nvUV=uv2Updated;\n#endif\n#ifdef BUMP_UV2\nvBumpUV=vec2(bumpMatrix*vec4(uv2Updated,1.0,0.0));\n#endif\n#ifdef REFLECTIVITY_UV2\nvReflectivityUV=vec2(reflectivityMatrix*vec4(uv2Updated,1.0,0.0));\n#else\n#ifdef METALLIC_UV2\nvMetallicUV=vec2(metallicMatrix*vec4(uv2Updated,1.0,0.0));\n#endif\n#ifdef ROUGHNESS_UV2\nvRoughnessUV=vec2(roughnessMatrix*vec4(uv2Updated,1.0,0.0));\n#endif\n#endif\n#ifdef ALBEDO_UV2\nvAlbedoUV=vec2(albedoMatrix*vec4(uv2Updated,1.0,0.0));\n#endif\n#endif\n#endif\n#include\n}\n";r.l.ShadersStore[a]||(r.l.ShadersStore[a]=s);var l={name:a,shader:s}},922:(e,t,n)=>{n.r(t),n.d(t,{taaPixelShader:()=>a});var r=n(98519),i="taaPixelShader",o="varying vec2 vUV;uniform sampler2D textureSampler;uniform sampler2D historySampler;\n#ifdef TAA_REPROJECT_HISTORY\nuniform sampler2D velocitySampler;\n#endif\nuniform float factor;void main() {ivec2 pos=ivec2(gl_FragCoord.xy);vec4 c=texelFetch(textureSampler,pos,0);\n#ifdef TAA_REPROJECT_HISTORY\nvec4 v=texelFetch(velocitySampler,pos,0);vec4 h=texture2D(historySampler,vUV+v.xy);\n#else\nvec4 h=texelFetch(historySampler,pos,0);\n#endif\n#ifdef TAA_CLAMP_HISTORY\nvec4 cmin=vec4(1);vec4 cmax=vec4(0);for (int x=-1; x<=1; x+=1) {for (int y=-1; y<=1; y+=1) {vec4 c=texelFetch(textureSampler,pos+ivec2(x,y),0);cmin=min(cmin,c);cmax=max(cmax,c);}}\nh=clamp(h,cmin,cmax);\n#endif\ngl_FragColor=mix(h,c,factor);}\n";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},1235:(e,t,n)=>{n.d(t,{gT:()=>l,hy:()=>s,kf:()=>a});var r=n(78322),i=n(7164),o=new Map;function a(e,t){s(e)&&i.V.Warn("Extension with the name '".concat(e,"' already exists")),o.set(e,t)}function s(e){return o.delete(e)}function l(e,t){var i=this;"image/ktx"!==t&&"image/ktx2"!==t||(e=".ktx"),o.has(e)||(e.endsWith(".ies")&&a(".ies",(function(){return(0,r.sH)(i,void 0,void 0,(function(){return(0,r.YH)(this,(function(e){switch(e.label){case 0:return[4,Promise.resolve().then(n.bind(n,19941)).then((function(e){return new e._IESTextureLoader}))];case 1:return[2,e.sent()]}}))}))})),e.endsWith(".dds")&&a(".dds",(function(){return(0,r.sH)(i,void 0,void 0,(function(){return(0,r.YH)(this,(function(e){switch(e.label){case 0:return[4,Promise.resolve().then(n.bind(n,19135)).then((function(e){return new e._DDSTextureLoader}))];case 1:return[2,e.sent()]}}))}))})),e.endsWith(".basis")&&a(".basis",(function(){return(0,r.sH)(i,void 0,void 0,(function(){return(0,r.YH)(this,(function(e){switch(e.label){case 0:return[4,Promise.resolve().then(n.bind(n,23586)).then((function(e){return new e._BasisTextureLoader}))];case 1:return[2,e.sent()]}}))}))})),e.endsWith(".env")&&a(".env",(function(){return(0,r.sH)(i,void 0,void 0,(function(){return(0,r.YH)(this,(function(e){switch(e.label){case 0:return[4,Promise.resolve().then(n.bind(n,71545)).then((function(e){return new e._ENVTextureLoader}))];case 1:return[2,e.sent()]}}))}))})),e.endsWith(".hdr")&&a(".hdr",(function(){return(0,r.sH)(i,void 0,void 0,(function(){return(0,r.YH)(this,(function(e){switch(e.label){case 0:return[4,Promise.resolve().then(n.bind(n,78750)).then((function(e){return new e._HDRTextureLoader}))];case 1:return[2,e.sent()]}}))}))})),(e.endsWith(".ktx")||e.endsWith(".ktx2"))&&(a(".ktx",(function(){return(0,r.sH)(i,void 0,void 0,(function(){return(0,r.YH)(this,(function(e){switch(e.label){case 0:return[4,Promise.resolve().then(n.bind(n,81867)).then((function(e){return new e._KTXTextureLoader}))];case 1:return[2,e.sent()]}}))}))})),a(".ktx2",(function(){return(0,r.sH)(i,void 0,void 0,(function(){return(0,r.YH)(this,(function(e){switch(e.label){case 0:return[4,Promise.resolve().then(n.bind(n,81867)).then((function(e){return new e._KTXTextureLoader}))];case 1:return[2,e.sent()]}}))}))}))),e.endsWith(".tga")&&a(".tga",(function(){return(0,r.sH)(i,void 0,void 0,(function(){return(0,r.YH)(this,(function(e){switch(e.label){case 0:return[4,Promise.resolve().then(n.bind(n,5996)).then((function(e){return new e._TGATextureLoader}))];case 1:return[2,e.sent()]}}))}))})),e.endsWith(".exr")&&a(".exr",(function(){return(0,r.sH)(i,void 0,void 0,(function(){return(0,r.YH)(this,(function(e){switch(e.label){case 0:return[4,Promise.resolve().then(n.bind(n,93747)).then((function(e){return new e._ExrTextureLoader}))];case 1:return[2,e.sent()]}}))}))})));var s=o.get(e);return s?Promise.resolve(s(t)):null}},1554:(e,t,n)=>{n.d(t,{K:()=>o});var r=n(78322),i=n(81152),o=function(){function e(e,t,n,r){void 0===n&&(n=i.Y.BUFFER_CREATIONFLAG_READWRITE),this._engine=e,this._label=r,this._engine._storageBuffers.push(this),this._create(t,n)}return e.prototype._create=function(e,t){this._bufferSize=e,this._creationFlags=t,this._buffer=this._engine.createStorageBuffer(e,t,this._label)},e.prototype._rebuild=function(){this._create(this._bufferSize,this._creationFlags)},e.prototype.getBuffer=function(){return this._buffer},e.prototype.clear=function(e,t){this._engine.clearStorageBuffer(this._buffer,e,t)},e.prototype.update=function(e,t,n){this._buffer&&this._engine.updateStorageBuffer(this._buffer,e,t,n)},e.prototype.read=function(e,t,n,i){return(0,r.sH)(this,void 0,void 0,(function(){return(0,r.YH)(this,(function(r){switch(r.label){case 0:return[4,this._engine.readFromStorageBuffer(this._buffer,e,t,n,i)];case 1:return[2,r.sent()]}}))}))},e.prototype.dispose=function(){var e=this._engine._storageBuffers,t=e.indexOf(this);-1!==t&&(e[t]=e[e.length-1],e.pop()),this._engine._releaseBuffer(this._buffer),this._buffer=null},e}()},1746:(e,t,n)=>{n.r(t),n.d(t,{tonemapPixelShader:()=>a});var r=n(98519),i="tonemapPixelShader",o="varying vec2 vUV;uniform sampler2D textureSampler;uniform float _ExposureAdjustment;\n#if defined(HABLE_TONEMAPPING)\nconst float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;const float W=11.2;\n#endif\nfloat Luminance(vec3 c)\n{return dot(c,vec3(0.22,0.707,0.071));}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) \n{vec3 colour=texture2D(textureSampler,vUV).rgb;\n#if defined(REINHARD_TONEMAPPING)\nfloat lum=Luminance(colour.rgb); \nfloat lumTm=lum*_ExposureAdjustment;float scale=lumTm/(1.0+lumTm); \ncolour*=scale/lum;\n#elif defined(HABLE_TONEMAPPING)\ncolour*=_ExposureAdjustment;const float ExposureBias=2.0;vec3 x=ExposureBias*colour;vec3 curr=((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;x=vec3(W,W,W);vec3 whiteScale=1.0/(((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F);colour=curr*whiteScale;\n#elif defined(OPTIMIZED_HEJIDAWSON_TONEMAPPING)\ncolour*=_ExposureAdjustment;vec3 X=max(vec3(0.0,0.0,0.0),colour-0.004);vec3 retColor=(X*(6.2*X+0.5))/(X*(6.2*X+1.7)+0.06);colour=retColor*retColor;\n#elif defined(PHOTOGRAPHIC_TONEMAPPING)\ncolour= vec3(1.0,1.0,1.0)-exp2(-_ExposureAdjustment*colour);\n#endif\ngl_FragColor=vec4(colour.rgb,1.0);}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},2362:(e,t,n)=>{n.d(t,{II:()=>h,Lm:()=>p,PD:()=>s,XG:()=>c,gs:()=>d,jm:()=>u,oi:()=>f,w:()=>l});var r=n(81152),i=n(7164);function o(e,t,n,i){switch(t){case r.Y.BYTE:var o=e.getInt8(n);return i&&(o=Math.max(o/127,-1)),o;case r.Y.UNSIGNED_BYTE:return o=e.getUint8(n),i&&(o/=255),o;case r.Y.SHORT:return o=e.getInt16(n,!0),i&&(o=Math.max(o/32767,-1)),o;case r.Y.UNSIGNED_SHORT:return o=e.getUint16(n,!0),i&&(o/=65535),o;case r.Y.INT:return e.getInt32(n,!0);case r.Y.UNSIGNED_INT:return e.getUint32(n,!0);case r.Y.FLOAT:return e.getFloat32(n,!0);default:throw new Error("Invalid component type ".concat(t))}}function a(e,t,n,i,o){switch(t){case r.Y.BYTE:i&&(o=Math.round(127*o)),e.setInt8(n,o);break;case r.Y.UNSIGNED_BYTE:i&&(o=Math.round(255*o)),e.setUint8(n,o);break;case r.Y.SHORT:i&&(o=Math.round(32767*o)),e.setInt16(n,o,!0);break;case r.Y.UNSIGNED_SHORT:i&&(o=Math.round(65535*o)),e.setUint16(n,o,!0);break;case r.Y.INT:e.setInt32(n,o,!0);break;case r.Y.UNSIGNED_INT:e.setUint32(n,o,!0);break;case r.Y.FLOAT:e.setFloat32(n,o,!0);break;default:throw new Error("Invalid component type ".concat(t))}}function s(e){switch(e){case r.Y.BYTE:case r.Y.UNSIGNED_BYTE:return 1;case r.Y.SHORT:case r.Y.UNSIGNED_SHORT:return 2;case r.Y.INT:case r.Y.UNSIGNED_INT:case r.Y.FLOAT:return 4;default:throw new Error("Invalid type '".concat(e,"'"))}}function l(e){switch(e){case r.Y.BYTE:return Int8Array;case r.Y.UNSIGNED_BYTE:return Uint8Array;case r.Y.SHORT:return Int16Array;case r.Y.UNSIGNED_SHORT:return Uint16Array;case r.Y.INT:return Int32Array;case r.Y.UNSIGNED_INT:return Uint32Array;case r.Y.FLOAT:return Float32Array;default:throw new Error("Invalid component type '".concat(e,"'"))}}function c(e,t,n,r,i,l,c,u){var h=new Array(r),d=new Array(r);if(e instanceof Array)for(var p=t/4,f=n/4,m=0;me.length)throw new Error("Last accessed index is out of bounds.");if(_h.byteLength)throw new Error("Last accessed byte is out of bounds.");var y=t*d;if(o65535)return!0;return!1}return 4===e.BYTES_PER_ELEMENT}function f(e,t){var n=t*e.BYTES_PER_ELEMENT;return 3&n?(n=n+3&-4,new e(new ArrayBuffer(n),0,t)):new e(t)}},2495:(e,t,n)=>{var r=n(98519),i="clusteredLightingFunctions";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="struct ClusteredLight {vec4 vLightData;vec4 vLightDiffuse;vec4 vLightSpecular;vec4 vLightDirection;vec4 vLightFalloff;};\n#define inline\nClusteredLight getClusteredLight(sampler2D lightDataTexture,int index) {return ClusteredLight(\ntexelFetch(lightDataTexture,ivec2(0,index),0),\ntexelFetch(lightDataTexture,ivec2(1,index),0),\ntexelFetch(lightDataTexture,ivec2(2,index),0),\ntexelFetch(lightDataTexture,ivec2(3,index),0),\ntexelFetch(lightDataTexture,ivec2(4,index),0)\n);}\nint getClusteredSliceIndex(vec2 sliceData,float viewDepth) {return int(log(viewDepth)*sliceData.x+sliceData.y);}\n")},2613:(e,t,n)=>{n.r(t),n.d(t,{FlowGraphConstantBlock:()=>l});var r=n(78322),i=n(45749),o=n(88099),a=n(34623),s=n(38810),l=function(e){function t(t){var n=e.call(this,t)||this;return n.config=t,n.output=n.registerDataOutput("output",(0,o.k4)(t.value)),n}return(0,r.C6)(t,e),t.prototype._updateOutputs=function(e){this.output.setValue(this.config.value,e)},t.prototype.getClassName=function(){return"FlowGraphConstantBlock"},t.prototype.serialize=function(t,n){void 0===t&&(t={}),void 0===n&&(n=s.X5),e.prototype.serialize.call(this,t),n("value",this.config.value,t.config)},t}(i.e);(0,a.Y5)("FlowGraphConstantBlock",l)},2652:(e,t,n)=>{n.r(t),n.d(t,{layerPixelShaderWGSL:()=>a});var r=n(98519),i=(n(17393),"layerPixelShader"),o="varying vUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d;uniform color: vec4f;\n#include\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\nvar baseColor: vec4f=textureSample(textureSampler,textureSamplerSampler,input.vUV);\n#if defined(CONVERT_TO_GAMMA)\nbaseColor=toGammaSpace(baseColor);\n#elif defined(CONVERT_TO_LINEAR)\nbaseColor=toLinearSpaceVec4(baseColor);\n#endif\n#ifdef ALPHATEST\nif (baseColor.a<0.4) {discard;}\n#endif\nfragmentOutputs.color=baseColor*uniforms.color;\n#define CUSTOM_FRAGMENT_MAIN_END\n}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},2804:(e,t,n)=>{var r=n(98519),i="subSurfaceScatteringFunctions";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="fn testLightingForSSS(diffusionProfile: f32)->bool\n{return diffusionProfile<1.;}")},2835:(e,t,n)=>{n.r(t),n.d(t,{fluidRenderingParticleThicknessPixelShaderWGSL:()=>a});var r=n(98519),i="fluidRenderingParticleThicknessPixelShader",o="uniform particleAlpha: f32;varying uv: vec2f;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var normalxy: vec2f=input.uv*2.0-1.0;var r2: f32=dot(normalxy,normalxy);if (r2>1.0) {discard;}\nvar thickness: f32=sqrt(1.0-r2);fragmentOutputs.color=vec4f(vec3f(uniforms.particleAlpha*thickness),1.0);}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},3072:(e,t,n)=>{n.r(t),n.d(t,{postprocessVertexShaderWGSL:()=>a});var r=n(98519),i="postprocessVertexShader",o="attribute position: vec2;uniform scale: vec2;varying vUV: vec2;const madd=vec2(0.5,0.5);\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvertexOutputs.vUV=(vertexInputs.position*madd+madd)*uniforms.scale;vertexOutputs.position=vec4(vertexInputs.position,0.0,1.0);\n#define CUSTOM_VERTEX_MAIN_END\n}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},3173:(e,t,n)=>{n.r(t),n.d(t,{FlowGraphMultiGateBlock:()=>l});var r=n(78322),i=n(34623),o=n(88677),a=n(88099),s=n(40099),l=function(e){function t(t){var n=e.call(this,t)||this;return n.config=t,n.outputSignals=[],n.reset=n._registerSignalInput("reset"),n.lastIndex=n.registerDataOutput("lastIndex",a.x2,new s.P(-1)),n.setNumberOfOutputSignals(null==t?void 0:t.outputSignalCount),n}return(0,r.C6)(t,e),t.prototype._getNextIndex=function(e){if(e.includes(!1)||this.config.isLoop&&e.fill(!1),this.config.isRandom){var t=e.map((function(e,t){return e?-1:t})).filter((function(e){return-1!==e}));return t.length?t[Math.floor(Math.random()*t.length)]:-1}return e.indexOf(!1)},t.prototype.setNumberOfOutputSignals=function(e){for(void 0===e&&(e=1);this.outputSignals.length>e;){var t=this.outputSignals.pop();t&&(t.disconnectFromAll(),this._unregisterSignalOutput(t.name))}for(;this.outputSignals.length-1&&(this.lastIndex.setValue(new s.P(r),e),n[r]=!0,e._setExecutionVariable(this,"indexesUsed",n),this.outputSignals[r]._activateSignal(e))},t.prototype.getClassName=function(){return"FlowGraphMultiGateBlock"},t.prototype.serialize=function(t){e.prototype.serialize.call(this,t),t.config.outputSignalCount=this.config.outputSignalCount,t.config.isRandom=this.config.isRandom,t.config.loop=this.config.isLoop,t.config.startIndex=this.config.startIndex},t}(o.u);(0,i.Y5)("FlowGraphMultiGateBlock",l)},3429:(e,t,n)=>{n.d(t,{$l:()=>a,GX:()=>o,vl:()=>i});var r=n(81152);function i(e){return e===r.Y.TEXTUREFORMAT_DEPTH24_STENCIL8||e===r.Y.TEXTUREFORMAT_DEPTH32_FLOAT||e===r.Y.TEXTUREFORMAT_DEPTH16||e===r.Y.TEXTUREFORMAT_DEPTH24||e===r.Y.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8||e===r.Y.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8||e===r.Y.TEXTUREFORMAT_STENCIL8}function o(e){switch(e){case r.Y.TEXTUREFORMAT_DEPTH24_STENCIL8:case r.Y.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8:case r.Y.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8:case r.Y.TEXTUREFORMAT_DEPTH32_FLOAT:case r.Y.TEXTUREFORMAT_DEPTH24:return r.Y.TEXTURETYPE_FLOAT;case r.Y.TEXTUREFORMAT_DEPTH16:return r.Y.TEXTURETYPE_UNSIGNED_SHORT;case r.Y.TEXTUREFORMAT_STENCIL8:return r.Y.TEXTURETYPE_UNSIGNED_BYTE}return r.Y.TEXTURETYPE_UNSIGNED_BYTE}function a(e){return e===r.Y.TEXTUREFORMAT_DEPTH24_STENCIL8||e===r.Y.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8||e===r.Y.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8||e===r.Y.TEXTUREFORMAT_STENCIL8}},3638:(e,t,n)=>{n.r(t),n.d(t,{FlowGraphPointerOverEventBlock:()=>l});var r=n(78322),i=n(90279),o=n(88099),a=n(34623),s=n(95803),l=function(e){function t(t){var n=e.call(this,t)||this;return n.type="PointerOver",n.pointerId=n.registerDataOutput("pointerId",o.Es),n.targetMesh=n.registerDataInput("targetMesh",o.Vv,null==t?void 0:t.targetMesh),n.meshUnderPointer=n.registerDataOutput("meshUnderPointer",o.Vv),n}return(0,r.C6)(t,e),t.prototype._executeEvent=function(e,t){var n,r=this.targetMesh.getValue(e);this.meshUnderPointer.setValue(t.mesh,e);var i=t.out&&(0,s.Ah)(t.out,r);return this.pointerId.setValue(t.pointerId,e),!(!i&&(t.mesh===r||(0,s.Ah)(t.mesh,r))&&(this._execute(e),null===(n=this.config)||void 0===n?void 0:n.stopPropagation))},t.prototype._preparePendingTasks=function(e){},t.prototype._cancelPendingTasks=function(e){},t.prototype.getClassName=function(){return"FlowGraphPointerOverEventBlock"},t}(i.i);(0,a.Y5)("FlowGraphPointerOverEventBlock",l)},3641:(e,t,n)=>{n.r(t),n.d(t,{bonesVertexWGSL:()=>a});var r=n(98519),i="bonesVertex",o="#ifndef BAKED_VERTEX_ANIMATION_TEXTURE\n#if NUM_BONE_INFLUENCERS>0\nvar influence : mat4x4;\n#ifdef BONETEXTURE\ninfluence=readMatrixFromRawSampler(boneSampler,vertexInputs.matricesIndices[0])*vertexInputs.matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\ninfluence=influence+readMatrixFromRawSampler(boneSampler,vertexInputs.matricesIndices[1])*vertexInputs.matricesWeights[1];\n#endif \n#if NUM_BONE_INFLUENCERS>2\ninfluence=influence+readMatrixFromRawSampler(boneSampler,vertexInputs.matricesIndices[2])*vertexInputs.matricesWeights[2];\n#endif \n#if NUM_BONE_INFLUENCERS>3\ninfluence=influence+readMatrixFromRawSampler(boneSampler,vertexInputs.matricesIndices[3])*vertexInputs.matricesWeights[3];\n#endif \n#if NUM_BONE_INFLUENCERS>4\ninfluence=influence+readMatrixFromRawSampler(boneSampler,vertexInputs.matricesIndicesExtra[0])*vertexInputs.matricesWeightsExtra[0];\n#endif \n#if NUM_BONE_INFLUENCERS>5\ninfluence=influence+readMatrixFromRawSampler(boneSampler,vertexInputs.matricesIndicesExtra[1])*vertexInputs.matricesWeightsExtra[1];\n#endif \n#if NUM_BONE_INFLUENCERS>6\ninfluence=influence+readMatrixFromRawSampler(boneSampler,vertexInputs.matricesIndicesExtra[2])*vertexInputs.matricesWeightsExtra[2];\n#endif \n#if NUM_BONE_INFLUENCERS>7\ninfluence=influence+readMatrixFromRawSampler(boneSampler,vertexInputs.matricesIndicesExtra[3])*vertexInputs.matricesWeightsExtra[3];\n#endif \n#else \ninfluence=uniforms.mBones[i32(vertexInputs.matricesIndices[0])]*vertexInputs.matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\ninfluence=influence+uniforms.mBones[i32(vertexInputs.matricesIndices[1])]*vertexInputs.matricesWeights[1];\n#endif \n#if NUM_BONE_INFLUENCERS>2\ninfluence=influence+uniforms.mBones[i32(vertexInputs.matricesIndices[2])]*vertexInputs.matricesWeights[2];\n#endif \n#if NUM_BONE_INFLUENCERS>3\ninfluence=influence+uniforms.mBones[i32(vertexInputs.matricesIndices[3])]*vertexInputs.matricesWeights[3];\n#endif \n#if NUM_BONE_INFLUENCERS>4\ninfluence=influence+uniforms.mBones[i32(vertexInputs.matricesIndicesExtra[0])]*vertexInputs.matricesWeightsExtra[0];\n#endif \n#if NUM_BONE_INFLUENCERS>5\ninfluence=influence+uniforms.mBones[i32(vertexInputs.matricesIndicesExtra[1])]*vertexInputs.matricesWeightsExtra[1];\n#endif \n#if NUM_BONE_INFLUENCERS>6\ninfluence=influence+uniforms.mBones[i32(vertexInputs.matricesIndicesExtra[2])]*vertexInputs.matricesWeightsExtra[2];\n#endif \n#if NUM_BONE_INFLUENCERS>7\ninfluence=influence+uniforms.mBones[i32(vertexInputs.matricesIndicesExtra[3])]*vertexInputs.matricesWeightsExtra[3];\n#endif \n#endif\nfinalWorld=finalWorld*influence;\n#endif\n#endif\n";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]=o);var a={name:i,shader:o}},3911:(e,t,n)=>{n.d(t,{K:()=>i});var r=n(81152),i=function(){function e(){this.reset()}return e.prototype.reset=function(){this.enabled=!1,this.mask=255,this.funcRef=1,this.funcMask=255,this.func=e.ALWAYS,this.opStencilFail=e.KEEP,this.opDepthFail=e.KEEP,this.opStencilDepthPass=e.REPLACE,this.backFunc=e.ALWAYS,this.backOpStencilFail=e.KEEP,this.backOpDepthFail=e.KEEP,this.backOpStencilDepthPass=e.REPLACE},Object.defineProperty(e.prototype,"stencilFunc",{get:function(){return this.func},set:function(e){this.func=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilBackFunc",{get:function(){return this.backFunc},set:function(e){this.backFunc=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilFuncRef",{get:function(){return this.funcRef},set:function(e){this.funcRef=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilFuncMask",{get:function(){return this.funcMask},set:function(e){this.funcMask=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilOpStencilFail",{get:function(){return this.opStencilFail},set:function(e){this.opStencilFail=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilOpDepthFail",{get:function(){return this.opDepthFail},set:function(e){this.opDepthFail=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilOpStencilDepthPass",{get:function(){return this.opStencilDepthPass},set:function(e){this.opStencilDepthPass=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilBackOpStencilFail",{get:function(){return this.backOpStencilFail},set:function(e){this.backOpStencilFail=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilBackOpDepthFail",{get:function(){return this.backOpDepthFail},set:function(e){this.backOpDepthFail=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilBackOpStencilDepthPass",{get:function(){return this.backOpStencilDepthPass},set:function(e){this.backOpStencilDepthPass=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilMask",{get:function(){return this.mask},set:function(e){this.mask=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilTest",{get:function(){return this.enabled},set:function(e){this.enabled=e},enumerable:!1,configurable:!0}),e.ALWAYS=r.Y.ALWAYS,e.KEEP=r.Y.KEEP,e.REPLACE=r.Y.REPLACE,e}()},4064:(e,t,n)=>{n.d(t,{P:()=>d});var r=n(78322),i=n(66377),o=n(7931),a=n(81152),s=n(11296),l=n(53695),c=n(7164),u=n(53770),h=n(91946),d=function(){function e(e,t,n){var a=this;this._unObserveRenderList=null,this._renderListHasChanged=function(e,t){var n=a._renderList?a._renderList.length:0;if(0===t&&n>0||0===n)for(var r=0,i=a._scene.meshes;r=this._sceneUBOs.length&&this._createSceneUBO();var e=this._sceneUBOs[this._currentSceneUBOIndex++];return e.unbindEffect(),e},e.prototype.resetRefreshCounter=function(){this._currentRefreshId=-1},Object.defineProperty(e.prototype,"refreshRate",{get:function(){return this._refreshRate},set:function(e){this._refreshRate=e,this.resetRefreshCounter()},enumerable:!1,configurable:!0}),e.prototype.shouldRender=function(){return-1===this._currentRefreshId||this.refreshRate===this._currentRefreshId?(this._currentRefreshId=1,!0):(this._currentRefreshId++,!1)},e.prototype.isReadyForRendering=function(e,t){this.prepareRenderList(),this.initRender(e,t);var n=this._checkReadiness();return this.finishRender(),n},e.prototype.prepareRenderList=function(){var e=this._scene;if(this._waitingRenderList){if(!this.renderListPredicate){this.renderList=[];for(var t=0;t1&&(e.incrementRenderId(),e.resetCachedMaterial())}for(var u=0,h=this.particleSystemList||e.particleSystems;u{n.r(t),n.d(t,{hdrIrradianceFilteringPixelShaderWGSL:()=>a});var r=n(98519),i=(n(17393),n(28469),n(61669),n(31321),"hdrIrradianceFilteringPixelShader"),o="#include\n#include\n#include\n#include\nvar inputTextureSampler: sampler;var inputTexture: texture_cube;\n#ifdef IBL_CDF_FILTERING\nvar icdfTextureSampler: sampler;var icdfTexture: texture_2d;\n#endif\nuniform vFilteringInfo: vec2f;uniform hdrScale: f32;varying direction: vec3f;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var color: vec3f=irradiance(inputTexture,inputTextureSampler,input.direction,uniforms.vFilteringInfo,0.0,vec3f(1.0),input.direction\n#ifdef IBL_CDF_FILTERING\n,icdfTexture,icdfTextureSampler\n#endif\n);fragmentOutputs.color= vec4f(color*uniforms.hdrScale,1.0);}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},4661:(e,t,n)=>{n.r(t),n.d(t,{imageProcessingFunctionsWGSL:()=>a});var r=n(98519),i="imageProcessingFunctions",o="#if TONEMAPPING==3\nconst PBRNeutralStartCompression: f32=0.8-0.04;const PBRNeutralDesaturation: f32=0.15;fn PBRNeutralToneMapping( color: vec3f )->vec3f {var x: f32=min(color.r,min(color.g,color.b));var offset: f32=select(0.04,x-6.25*x*x,x<0.08);var result=color;result-=offset;var peak: f32=max(result.r,max(result.g,result.b));if (peakvec3f\n{var a: vec3f=v*(v+0.0245786)-0.000090537;var b: vec3f=v*(0.983729*v+0.4329510)+0.238081;return a/b;}\nfn ACESFitted(color: vec3f)->vec3f\n{var output=ACESInputMat*color;output=RRTAndODTFit(output);output=ACESOutputMat*output;output=saturateVec3(output);return output;}\n#endif\n#define CUSTOM_IMAGEPROCESSINGFUNCTIONS_DEFINITIONS\nfn applyImageProcessing(result: vec4f)->vec4f {\n#define CUSTOM_IMAGEPROCESSINGFUNCTIONS_UPDATERESULT_ATSTART\nvar rgb=result.rgb;;\n#ifdef EXPOSURE\nrgb*=uniforms.exposureLinear;\n#endif\n#ifdef VIGNETTE\nvar viewportXY: vec2f=fragmentInputs.position.xy*uniforms.vInverseScreenSize;viewportXY=viewportXY*2.0-1.0;var vignetteXY1: vec3f= vec3f(viewportXY*uniforms.vignetteSettings1.xy+uniforms.vignetteSettings1.zw,1.0);var vignetteTerm: f32=dot(vignetteXY1,vignetteXY1);var vignette: f32=pow(vignetteTerm,uniforms.vignetteSettings2.w);var vignetteColor: vec3f=uniforms.vignetteSettings2.rgb;\n#ifdef VIGNETTEBLENDMODEMULTIPLY\nvar vignetteColorMultiplier: vec3f=mix(vignetteColor, vec3f(1,1,1),vignette);rgb*=vignetteColorMultiplier;\n#endif\n#ifdef VIGNETTEBLENDMODEOPAQUE\nrgb=mix(vignetteColor,rgb,vignette);\n#endif\n#endif\n#if TONEMAPPING==3\nrgb=PBRNeutralToneMapping(rgb);\n#elif TONEMAPPING==2\nrgb=ACESFitted(rgb);\n#elif TONEMAPPING==1\nconst tonemappingCalibration: f32=1.590579;rgb=1.0-exp2(-tonemappingCalibration*rgb);\n#endif\nrgb=toGammaSpaceVec3(rgb);rgb=saturateVec3(rgb);\n#ifdef CONTRAST\nvar resultHighContrast: vec3f=rgb*rgb*(3.0-2.0*rgb);if (uniforms.contrast<1.0) {rgb=mix( vec3f(0.5,0.5,0.5),rgb,uniforms.contrast);} else {rgb=mix(rgb,resultHighContrast,uniforms.contrast-1.0);}\nrgb=max(rgb,vec3f(0.));\n#endif\n#ifdef COLORGRADING\nvar colorTransformInput: vec3f=rgb*uniforms.colorTransformSettings.xxx+uniforms.colorTransformSettings.yyy;\n#ifdef COLORGRADING3D\nvar colorTransformOutput: vec3f=textureSample(txColorTransform,txColorTransformSampler,colorTransformInput).rgb;\n#else\nvar colorTransformOutput: vec3f=textureSample(txColorTransform,txColorTransformSampler,colorTransformInput,uniforms.colorTransformSettings.yz).rgb;\n#endif\nrgb=mix(rgb,colorTransformOutput,uniforms.colorTransformSettings.www);\n#endif\n#ifdef COLORCURVES\nvar luma: f32=getLuminance(rgb);var curveMix: vec2f=clamp( vec2f(luma*3.0-1.5,luma*-3.0+1.5), vec2f(0.0), vec2f(1.0));var colorCurve: vec4f=uniforms.vCameraColorCurveNeutral+curveMix.x*uniforms.vCameraColorCurvePositive-curveMix.y*uniforms.vCameraColorCurveNegative;rgb*=colorCurve.rgb;rgb=mix( vec3f(luma),rgb,colorCurve.a);\n#endif\n#ifdef DITHER\nvar rand: f32=getRand(fragmentInputs.position.xy*uniforms.vInverseScreenSize);var dither: f32=mix(-uniforms.ditherIntensity,uniforms.ditherIntensity,rand);rgb=saturateVec3(rgb+ vec3f(dither));\n#endif\n#define CUSTOM_IMAGEPROCESSINGFUNCTIONS_UPDATERESULT_ATEND\nreturn vec4f(rgb,result.a);}";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]=o);var a={name:i,shader:o}},4906:(e,t,n)=>{n.d(t,{H:()=>c});var r=n(78322),i=n(89021),o=n(97247),a=n(4064),s=n(54044),l=n(81152),c=function(e){function t(t,n,r,i,o){var s=e.call(this,t,n)||this;return s.shadowGenerators=[],s.depthTest=!0,s.depthWrite=!0,s.disableShadows=!1,s._disableImageProcessing=!1,s.isMainObjectRenderer=!1,s._renderParticles=!0,s._renderSprites=!0,s._forceLayerMaskCheck=!0,s._enableBoundingBoxRendering=!0,s._enableOutlineRendering=!0,s._onBeforeRenderObservable=null,s._onAfterRenderObservable=null,s._externalObjectRenderer=!1,s._scene=r,s._engine=r.getEngine(),s._externalObjectRenderer=!!o,s._renderer=null!=o?o:new a.P(t,r,i),s.name=t,s._renderer.disableImageProcessing=s._disableImageProcessing,s._renderer.renderParticles=s._renderParticles,s._renderer.renderSprites=s._renderSprites,s._renderer.enableBoundingBoxRendering=s._enableBoundingBoxRendering,s._renderer.forceLayerMaskCheck=s._forceLayerMaskCheck,s._externalObjectRenderer||s._renderer.onBeforeRenderingManagerRenderObservable.add((function(){s._renderer.options.doNotChangeAspectRatio||r.updateTransformMatrix(!0)})),s.outputTexture=s._frameGraph.textureManager.createDanglingHandle(),s.outputDepthTexture=s._frameGraph.textureManager.createDanglingHandle(),s}return(0,r.C6)(t,e),Object.defineProperty(t.prototype,"camera",{get:function(){return this._camera},set:function(e){this._camera=e,this._renderer.activeCamera=this.camera},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"disableImageProcessing",{get:function(){return this._disableImageProcessing},set:function(e){e!==this._disableImageProcessing&&(this._disableImageProcessing=e,this._renderer.disableImageProcessing=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"renderParticles",{get:function(){return this._renderParticles},set:function(e){e!==this._renderParticles&&(this._renderParticles=e,this._renderer.renderParticles=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"renderSprites",{get:function(){return this._renderSprites},set:function(e){e!==this._renderSprites&&(this._renderSprites=e,this._renderer.renderSprites=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"forceLayerMaskCheck",{get:function(){return this._forceLayerMaskCheck},set:function(e){e!==this._forceLayerMaskCheck&&(this._forceLayerMaskCheck=e,this._renderer.forceLayerMaskCheck=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableBoundingBoxRendering",{get:function(){return this._enableBoundingBoxRendering},set:function(e){e!==this._enableBoundingBoxRendering&&(this._enableBoundingBoxRendering=e,this._renderer.enableBoundingBoxRendering=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableOutlineRendering",{get:function(){return this._enableOutlineRendering},set:function(e){e!==this._enableOutlineRendering&&(this._enableOutlineRendering=e,this._renderer.enableOutlineRendering=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"objectRenderer",{get:function(){return this._renderer},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return this._name},set:function(e){this._name=e,this._renderer&&(this._renderer.name=e)},enumerable:!1,configurable:!0}),t.prototype.isReady=function(){return this._renderer.isReadyForRendering(this._textureWidth,this._textureHeight)},t.prototype.record=function(e,t){var n=this;if(void 0===e&&(e=!1),void 0===this.targetTexture||void 0===this.objectList)throw new Error("FrameGraphObjectRendererTask ".concat(this.name,": targetTexture and objectList are required"));this._renderer.renderList=this.objectList.meshes,this._renderer.particleSystemList=this.objectList.particleSystems;var r=Array.isArray(this.targetTexture)?this.targetTexture:[this.targetTexture],o=this._frameGraph.textureManager.getTextureDescription(r[0]),a=!1;if(void 0!==this.depthTexture){if(this.depthTexture===i.m&&(r[0]!==i.O||r.length>1))throw new Error("FrameGraphObjectRendererTask ".concat(this.name,": the back buffer color texture is the only color texture allowed when the depth is the back buffer depth/stencil"));if(this.depthTexture!==i.m&&r[0]===i.O)throw new Error("FrameGraphObjectRendererTask ".concat(this.name,": the back buffer depth/stencil texture is the only depth texture allowed when the target is the back buffer color"));if(this._frameGraph.textureManager.getTextureDescription(this.depthTexture).options.samples!==o.options.samples)throw new Error("FrameGraphObjectRendererTask ".concat(this.name,": the depth texture and the output texture must have the same number of samples"));a=!0}this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture,r[0]),void 0!==this.depthTexture&&this._frameGraph.textureManager.resolveDanglingHandle(this.outputDepthTexture,this.depthTexture),this._textureWidth=o.size.width,this._textureHeight=o.size.height,this._setLightsForShadow();var s=this._frameGraph.addRenderPass(this.name);if(s.setRenderTarget(r),s.setRenderTargetDepth(this.depthTexture),s.setExecuteFunc((function(e){var r,i;n._renderer.renderList=n.objectList.meshes,n._renderer.particleSystemList=n.objectList.particleSystems;var o=null===(i=(r=n).getBoundingBoxRenderer)||void 0===i?void 0:i.call(r),s=o&&o.renderList.length>0?o.renderList.data.slice():[];o&&(s.length=o.renderList.length),e.setDepthStates(n.depthTest&&a,n.depthWrite&&a);var c=n._renderer.activeCamera;if(c&&c.cameraRigMode!==l.Y.RIG_MODE_NONE&&!c._renderingMultiview){for(var u=0;u{function r(){return"undefined"!=typeof window}function i(){return"undefined"!=typeof navigator}function o(){return"undefined"!=typeof document}function a(e){for(var t="",n=e.firstChild;n;)3===n.nodeType&&(t+=n.textContent),n=n.nextSibling;return t}n.d(t,{Az:()=>s,BA:()=>r,Nf:()=>o,XD:()=>i,Zl:()=>a});var s={IsWindowObjectExist:r,IsNavigatorAvailable:i,IsDocumentAvailable:o,GetDOMTextContent:a}},5196:(e,t,n)=>{n.r(t),n.d(t,{FlowGraphSetDelayBlock:()=>u});var r=n(78322),i=n(21379),o=n(88099),a=n(93051),s=n(7164),l=n(34623),c=n(40099),u=function(e){function t(t){var n=e.call(this,t)||this;return n.cancel=n._registerSignalInput("cancel"),n.duration=n.registerDataInput("duration",o.Es),n.lastDelayIndex=n.registerDataOutput("lastDelayIndex",o.x2,new c.P(-1)),n}return(0,r.C6)(t,e),t.prototype._preparePendingTasks=function(e){var n=this,r=this.duration.getValue(e);if(r<0||isNaN(r)||!isFinite(r))return this._reportError(e,"Invalid duration in SetDelay block");if(e._getGlobalContextVariable("activeDelays",0)>=t.MaxParallelDelayCount)return this._reportError(e,"Max parallel delays reached");var i=e._getGlobalContextVariable("lastDelayIndex",-1),o=e._getExecutionVariable(this,"pendingDelays",[]),s=e.configuration.scene,l=new a.Qz({timeout:1e3*r,contextObservable:s.onBeforeRenderObservable,onEnded:function(){return n._onEnded(l,e)}});l.start();var u=i+1;this.lastDelayIndex.setValue(new c.P(u),e),e._setGlobalContextVariable("lastDelayIndex",u),o[u]=l,e._setExecutionVariable(this,"pendingDelays",o),this._updateGlobalTimers(e)},t.prototype._cancelPendingTasks=function(e){for(var t=0,n=e._getExecutionVariable(this,"pendingDelays",[]);t{n.r(t),n.d(t,{blackAndWhitePixelShader:()=>a});var r=n(98519),i="blackAndWhitePixelShader",o="varying vec2 vUV;uniform sampler2D textureSampler;uniform float degree;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) \n{vec3 color=texture2D(textureSampler,vUV).rgb;float luminance=dot(color,vec3(0.3,0.59,0.11)); \nvec3 blackAndWhite=vec3(luminance,luminance,luminance);gl_FragColor=vec4(color-((color-blackAndWhite)*degree),1.0);}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},5447:(e,t,n)=>{var r=n(98519),i="subSurfaceScatteringFunctions";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="bool testLightingForSSS(float diffusionProfile)\n{return diffusionProfile<1.;}")},5519:(e,t,n)=>{n.r(t),n.d(t,{oitFinalPixelShaderWGSL:()=>a});var r=n(98519),i="oitFinalPixelShader",o="var uFrontColor: texture_2d;var uBackColor: texture_2d;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var fragCoord: vec2i=vec2i(fragmentInputs.position.xy);var frontColor: vec4f=textureLoad(uFrontColor,fragCoord,0);var backColor: vec4f=textureLoad(uBackColor,fragCoord,0);var alphaMultiplier: f32=1.0-frontColor.a;fragmentOutputs.color=vec4f(\nfrontColor.rgb+alphaMultiplier*backColor.rgb,\nfrontColor.a+backColor.a\n);}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},5996:(e,t,n)=>{n.r(t),n.d(t,{_TGATextureLoader:()=>i});var r=n(65054),i=function(){function e(){this.supportCascades=!1}return e.prototype.loadCubeData=function(){throw".env not supported in Cube."},e.prototype.loadData=function(e,t,n){var i=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),o=(0,r.O_)(i);n(o.width,o.height,t.generateMipMaps,!1,(function(){(0,r.FA)(t,i)}))},e}()},6115:(e,t,n)=>{n.d(t,{L:()=>i});var r=n(78322),i=function(e){function t(t,n,r){void 0===r&&(r=2);var i=e.call(this,t,n,r)||this;return i._outBus=null,i._onOutBusDisposed=function(){i._outBus=null},i}return(0,r.C6)(t,e),Object.defineProperty(t.prototype,"outBus",{get:function(){return this._outBus},set:function(e){if(this._outBus!==e){if(this._outBus&&(this._outBus.onDisposeObservable.removeCallback(this._onOutBusDisposed),!this._disconnect(this._outBus)))throw new Error("Disconnect failed");if(this._outBus=e,this._outBus&&(this._outBus.onDisposeObservable.add(this._onOutBusDisposed),!this._connect(this._outBus)))throw new Error("Connect failed")}},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){e.prototype.dispose.call(this),this._outBus=null},t}(n(37587).t)},6174:(e,t,n)=>{n.d(t,{$z:()=>o,Cx:()=>y,GG:()=>g,P_:()=>h,WM:()=>u,Y9:()=>c,bR:()=>_,fW:()=>v,jT:()=>l,lK:()=>a,n1:()=>m,qK:()=>f,ru:()=>b,uM:()=>s,wL:()=>p,xG:()=>d});var r=n(36729);function i(e,t){return function(n,i){var o=(0,r.B)(n);o[i]||(o[i]={type:e,sourceName:t})}}function o(e,t){return void 0===t&&(t=null),function(e,t){return void 0===t&&(t=null),function(n,r){var i=t||"_"+r;Object.defineProperty(n,r,{get:function(){return this[i]},set:function(t){var r;"function"==typeof(null===(r=this[i])||void 0===r?void 0:r.equals)&&this[i].equals(t)||this[i]!==t&&(this[i]=t,n[e].apply(this))},enumerable:!0,configurable:!0})}}(e,t)}function a(e){return i(0,e)}function s(e){return i(1,e)}function l(e){return i(2,e)}function c(e){return i(3,e)}function u(e){return i(4,e)}function h(e){return i(5,e)}function d(e){return i(6,e)}function p(e){return i(7,e)}function f(e){return i(8,e)}function m(e){return i(9,e)}function _(e){return i(10,e)}function g(e){return i(12,e)}function v(e){return i(11,e)}function y(e,t,n,r){var i=n.value;n.value=function(){for(var n=[],o=0;o{n.r(t),n.d(t,{FlowGraphStopAnimationBlock:()=>s});var r=n(78322),i=n(88099),o=n(34623),a=n(7164),s=function(e){function t(t){var n=e.call(this,t)||this;return n.animationGroup=n.registerDataInput("animationGroup",i.Vv),n.stopAtFrame=n.registerDataInput("stopAtFrame",i.Es,-1),n}return(0,r.C6)(t,e),t.prototype._preparePendingTasks=function(e){var t,n=this.animationGroup.getValue(e),r=null!==(t=this.stopAtFrame.getValue(e))&&void 0!==t?t:-1,i=e._getGlobalContextVariable("pendingStopAnimations",[]);i.push({uniqueId:n.uniqueId,stopAtFrame:r}),e._setGlobalContextVariable("pendingStopAnimations",i)},t.prototype._cancelPendingTasks=function(e){for(var t=this.animationGroup.getValue(e),n=e._getGlobalContextVariable("pendingStopAnimations",[]),r=0;r0?this._startPendingTasks(e):this._stopAnimation(n,e),void this.out._activateSignal(e)):(a.V.Warn("No animation group provided to stop."),this._reportError(e,"No animation group provided to stop."))},t.prototype._executeOnTick=function(e){for(var t=this.animationGroup.getValue(e),n=e._getGlobalContextVariable("pendingStopAnimations",[]),r=0;r=n[r].stopAtFrame){this._stopAnimation(t,e),n.splice(r,1),e._setGlobalContextVariable("pendingStopAnimations",n),this.done._activateSignal(e),e._removePendingBlock(this);break}},t.prototype.getClassName=function(){return"FlowGraphStopAnimationBlock"},t.prototype._stopAnimation=function(e,t){var n=t._getGlobalContextVariable("currentlyRunningAnimationGroups",[]),r=n.indexOf(e.uniqueId);-1!==r&&(e.stop(),n.splice(r,1),t._setGlobalContextVariable("currentlyRunningAnimationGroups",n))},t}(n(21379).M);(0,o.Y5)("FlowGraphStopAnimationBlock",s)},6451:(e,t,n)=>{n.d(t,{Bu:()=>a,TB:()=>i,W0:()=>o});var r=n(78322),i=function(){function e(){}return e.KEYDOWN=1,e.KEYUP=2,e}(),o=function(e,t){this.type=e,this.event=t},a=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.type=t,r.event=n,r.skipOnKeyboardObservable=!1,r}return(0,r.C6)(t,e),Object.defineProperty(t.prototype,"skipOnPointerObservable",{get:function(){return this.skipOnKeyboardObservable},set:function(e){this.skipOnKeyboardObservable=e},enumerable:!1,configurable:!0}),t}(o)},6777:(e,t,n)=>{n.r(t),n.d(t,{proceduralVertexShader:()=>a});var r=n(98519),i="proceduralVertexShader",o="attribute vec2 position;varying vec2 vPosition;varying vec2 vUV;const vec2 madd=vec2(0.5,0.5);\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvPosition=position;vUV=position*madd+madd;gl_Position=vec4(position,0.0,1.0);\n#define CUSTOM_VERTEX_MAIN_END\n}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},6784:(e,t,n)=>{n.d(t,{$:()=>u,I:()=>r});var r,i=n(66377),o=n(32139),a=n(88677),s=n(64391),l=function(){function e(e){this.onEventTriggeredObservable=new i.cP,this.sceneReadyTriggered=!1,this._pointerUnderMeshState={},this._startingTime=0,this._scene=e,this._initialize()}return e.prototype._initialize=function(){var e=this;this._sceneReadyObserver=this._scene.onReadyObservable.add((function(){e.sceneReadyTriggered||(e.onEventTriggeredObservable.notifyObservers({type:"SceneReady"}),e.sceneReadyTriggered=!0)})),this._sceneDisposeObserver=this._scene.onDisposeObservable.add((function(){e.onEventTriggeredObservable.notifyObservers({type:"SceneDispose"})})),this._sceneOnBeforeRenderObserver=this._scene.onBeforeRenderObservable.add((function(){var t=e._scene.getEngine().getDeltaTime()/1e3;e.onEventTriggeredObservable.notifyObservers({type:"SceneBeforeRender",payload:{timeSinceStart:e._startingTime,deltaTime:t}}),e._startingTime+=t})),this._meshPickedObserver=this._scene.onPointerObservable.add((function(t){e.onEventTriggeredObservable.notifyObservers({type:"MeshPick",payload:t})}),s.Zp.POINTERPICK),this._meshUnderPointerObserver=this._scene.onMeshUnderPointerUpdatedObservable.add((function(t){var n=t.pointerId,r=t.mesh,i=e._pointerUnderMeshState[n];!i&&r?e.onEventTriggeredObservable.notifyObservers({type:"PointerOver",payload:{pointerId:n,mesh:r}}):i&&!r?e.onEventTriggeredObservable.notifyObservers({type:"PointerOut",payload:{pointerId:n,mesh:i}}):i&&r&&i!==r&&(e.onEventTriggeredObservable.notifyObservers({type:"PointerOut",payload:{pointerId:n,mesh:i,over:r}}),e.onEventTriggeredObservable.notifyObservers({type:"PointerOver",payload:{pointerId:n,mesh:r,out:i}})),e._pointerUnderMeshState[n]=r}),s.Zp.POINTERMOVE)},e.prototype.dispose=function(){var e,t,n,r,i;null===(e=this._sceneDisposeObserver)||void 0===e||e.remove(),null===(t=this._sceneReadyObserver)||void 0===t||t.remove(),null===(n=this._sceneOnBeforeRenderObserver)||void 0===n||n.remove(),null===(r=this._meshPickedObserver)||void 0===r||r.remove(),null===(i=this._meshUnderPointerObserver)||void 0===i||i.remove(),this.onEventTriggeredObservable.clear()},e}(),c=n(95803);!function(e){e[e.Stopped=0]="Stopped",e[e.Started=1]="Started"}(r||(r={}));var u=function(){function e(e){var t,n=this;this.onStateChangedObservable=new i.cP,this._eventBlocks=((t={}).SceneReady=[],t.SceneDispose=[],t.SceneBeforeRender=[],t.MeshPick=[],t.PointerDown=[],t.PointerUp=[],t.PointerMove=[],t.PointerOver=[],t.PointerOut=[],t.SceneAfterRender=[],t.NoTrigger=[],t),this._executionContexts=[],this._state=0,this._scene=e.scene,this._sceneEventCoordinator=new l(this._scene),this._coordinator=e.coordinator,this._eventObserver=this._sceneEventCoordinator.onEventTriggeredObservable.add((function(e){for(var t=0,r=n._executionContexts;t0;){e(s=t.pop());for(var l=0,c=s.dataInputs;l{n.d(t,{R:()=>a});var r=n(78322),i=n(10338),o=n(34623),a=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.priority=0,t}return(0,r.C6)(t,e),t.prototype._isSingularConnection=function(){return!1},t.prototype.connectTo=function(t){e.prototype.connectTo.call(this,t),this._connectedPoint.sort((function(e,t){return t.priority-e.priority}))},t.prototype._activateSignal=function(e){var t;if(null===(t=e.logger)||void 0===t||t.addLogItem({action:"ActivateSignal",className:this._ownerBlock.getClassName(),uniqueId:this._ownerBlock.uniqueId,payload:{connectionType:this.connectionType,name:this.name}}),0===this.connectionType)e._notifyExecuteNode(this._ownerBlock),this._ownerBlock._execute(e,this),e._increaseExecutionId();else for(var n=0,r=this._connectedPoint;n{n.d(t,{X5:()=>S,bn:()=>g,fY:()=>_,mA:()=>m,ov:()=>f,pO:()=>y,wF:()=>v});var r=n(78322),i=n(8046),o=n(64726),a=n(48810),s=n(34623),l=n(52714),c=n(85405),u=n(73152),h=n(46799),d=n(81152),p=n(12028),f=Object.freeze(new i.PT(0,0,0,0)),m=Object.freeze(i.Pq.Zero()),_=Object.freeze(i.I9.Zero()),g=Object.freeze(u.o.Zero()),v=Object.freeze(o.v9.Black()),y=Object.freeze(new o.ov(0,0,0,0)),b={key:0,repeatCount:0,loopMode:2},S=function(){function e(t,n,r,i,o,a){this.name=t,this.targetProperty=n,this.framePerSecond=r,this.dataType=i,this.loopMode=o,this.enableBlending=a,this._easingFunction=null,this._runtimeAnimations=new Array,this._events=new Array,this.blendingSpeed=.01,this._ranges={},this._coreAnimation=null,this.targetPropertyPath=n.split("."),this.dataType=i,this.loopMode=void 0===o?e.ANIMATIONLOOPMODE_CYCLE:o,this.uniqueId=e._UniqueIdGenerator++}return e._PrepareAnimation=function(t,n,r,a,s,l,c,h){var d=void 0;if(!isNaN(parseFloat(s))&&isFinite(s)?d=e.ANIMATIONTYPE_FLOAT:s instanceof i.PT?d=e.ANIMATIONTYPE_QUATERNION:s instanceof i.Pq?d=e.ANIMATIONTYPE_VECTOR3:s instanceof i.I9?d=e.ANIMATIONTYPE_VECTOR2:s instanceof o.v9?d=e.ANIMATIONTYPE_COLOR3:s instanceof o.ov?d=e.ANIMATIONTYPE_COLOR4:s instanceof u.o&&(d=e.ANIMATIONTYPE_SIZE),null==d)return null;var p=new e(t,n,r,d,c),f=[{frame:0,value:s},{frame:a,value:l}];return p.setKeys(f),void 0!==h&&p.setEasingFunction(h),p},e.CreateAnimation=function(t,n,r,i){var o=new e(t+"Animation",t,r,n,e.ANIMATIONLOOPMODE_CONSTANT);return o.setEasingFunction(i),o},e.CreateAndStartAnimation=function(t,n,r,i,o,a,s,l,c,u,h){var d=e._PrepareAnimation(t,r,i,o,a,s,l,c);return d?(n.getScene&&(h=n.getScene()),h?h.beginDirectAnimation(n,[d],0,o,d.loopMode!==e.ANIMATIONLOOPMODE_CONSTANT,1,u):null):null},e.CreateAndStartHierarchyAnimation=function(t,n,r,i,o,a,s,l,c,u,h){var d=e._PrepareAnimation(t,i,o,a,s,l,c,u);return d?n.getScene().beginDirectHierarchyAnimation(n,r,[d],0,a,1===d.loopMode,1,h):null},e.CreateMergeAndStartAnimation=function(t,n,r,i,o,a,s,l,c,u){var h=e._PrepareAnimation(t,r,i,o,a,s,l,c);return h?(n.animations.push(h),n.getScene().beginAnimation(n,0,o,1===h.loopMode,1,u)):null},e.MakeAnimationAdditive=function(t,n,r,o,a){var s,l,c;void 0===o&&(o=!1);var u=t;if((c="object"==typeof n?n:{referenceFrame:null!=n?n:0,range:r,cloneOriginalAnimation:o,clonedAnimationName:a}).cloneOriginalAnimation&&((u=t.clone()).name=c.clonedAnimationName||u.name),!u._keys.length)return u;var h=c.referenceFrame&&c.referenceFrame>=0?c.referenceFrame:0,d=0,p=u._keys[0],f=u._keys.length-1,m=u._keys[f],_={referenceValue:p.value,referencePosition:i.AA.Vector3[0],referenceQuaternion:i.AA.Quaternion[0],referenceScaling:i.AA.Vector3[1],keyPosition:i.AA.Vector3[2],keyQuaternion:i.AA.Quaternion[1],keyScaling:i.AA.Vector3[3]},g=p.frame,v=m.frame;if(c.range){var y=u.getRange(c.range);y&&(g=y.from,v=y.to)}else g=null!==(s=c.fromFrame)&&void 0!==s?s:g,v=null!==(l=c.toFrame)&&void 0!==l?l:v;if(g!==p.frame&&(d=u.createKeyForFrame(g)),v!==m.frame&&(f=u.createKeyForFrame(v)),1===u._keys.length){var S=u._getKeyValue(u._keys[0]);_.referenceValue=S.clone?S.clone():S}else h<=p.frame?(S=u._getKeyValue(p.value),_.referenceValue=S.clone?S.clone():S):h>=m.frame?(S=u._getKeyValue(m.value),_.referenceValue=S.clone?S.clone():S):(b.key=0,S=u._interpolate(h,b),_.referenceValue=S.clone?S.clone():S);u.dataType===e.ANIMATIONTYPE_QUATERNION?_.referenceValue.normalize().conjugateInPlace():u.dataType===e.ANIMATIONTYPE_MATRIX&&(_.referenceValue.decompose(_.referenceScaling,_.referenceQuaternion,_.referencePosition),_.referenceQuaternion.normalize().conjugateInPlace());for(var T=Number.MAX_VALUE,E=c.clipKeys?[]:null,x=d;x<=f;x++){var P=u._keys[x];if((E||c.cloneOriginalAnimation)&&(P={frame:P.frame,value:P.value.clone?P.value.clone():P.value,inTangent:P.inTangent,outTangent:P.outTangent,interpolation:P.interpolation,lockedTangent:P.lockedTangent},E&&(T===Number.MAX_VALUE&&(T=P.frame),P.frame-=T,E.push(P))),!x||u.dataType===e.ANIMATIONTYPE_FLOAT||P.value!==p.value)switch(u.dataType){case e.ANIMATIONTYPE_MATRIX:P.value.decompose(_.keyScaling,_.keyQuaternion,_.keyPosition),_.keyPosition.subtractInPlace(_.referencePosition),_.keyScaling.divideInPlace(_.referenceScaling),_.referenceQuaternion.multiplyToRef(_.keyQuaternion,_.keyQuaternion),i.uq.ComposeToRef(_.keyScaling,_.keyQuaternion,_.keyPosition,P.value);break;case e.ANIMATIONTYPE_QUATERNION:_.referenceValue.multiplyToRef(P.value,P.value);break;case e.ANIMATIONTYPE_VECTOR2:case e.ANIMATIONTYPE_VECTOR3:case e.ANIMATIONTYPE_COLOR3:case e.ANIMATIONTYPE_COLOR4:P.value.subtractToRef(_.referenceValue,P.value);break;case e.ANIMATIONTYPE_SIZE:P.value.width-=_.referenceValue.width,P.value.height-=_.referenceValue.height;break;default:P.value-=_.referenceValue}}return E&&u.setKeys(E,!0),u},e.TransitionTo=function(e,t,n,r,i,o,a,s){if(void 0===s&&(s=null),a<=0)return n[e]=t,s&&s(),null;var l=i*(a/1e3);o.setKeys([{frame:0,value:n[e].clone?n[e].clone():n[e]},{frame:l,value:t}]),n.animations||(n.animations=[]),n.animations.push(o);var c=r.beginAnimation(n,0,l,!1);return c.onAnimationEnd=s,c},Object.defineProperty(e.prototype,"runtimeAnimations",{get:function(){return this._runtimeAnimations},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasRunningRuntimeAnimations",{get:function(){for(var e=0,t=this._runtimeAnimations;e=0;o--)this._keys[o].frame>=r&&this._keys[o].frame<=i&&this._keys.splice(o,1);this._ranges[e]=null}},e.prototype.getRange=function(e){return this._ranges[e]},e.prototype.getKeys=function(){return this._keys},e.prototype.getHighestFrame=function(){for(var e=0,t=0,n=this._keys.length;t0)return n.highLimitValue.clone?n.highLimitValue.clone():n.highLimitValue;var o,a=this._keys;if(this._coreAnimation)o=this._coreAnimation._key;else{var s=a.length;for(o=n.key;o>=0&&t=a[o+1].frame;)++o;if(n.key=o,o<0)return r?void 0:this._getKeyValue(a[0].value);if(o+1>s-1)return r?void 0:this._getKeyValue(a[s-1].value);this._key=o}var l=a[o],c=a[o+1];if(!r||t!==l.frame&&t!==c.frame){var u=this._getKeyValue(l.value),h=this._getKeyValue(c.value);if(1===l.interpolation)return c.frame>t?u:h;var d=void 0!==l.outTangent&&void 0!==c.inTangent,p=c.frame-l.frame,b=(t-l.frame)/p,S=l.easingFunction||this.getEasingFunction();switch(S&&(b=S.ease(b)),this.dataType){case e.ANIMATIONTYPE_FLOAT:var T=d?this.floatInterpolateFunctionWithTangents(u,l.outTangent*p,h,c.inTangent*p,b):this.floatInterpolateFunction(u,h,b);switch(n.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:case e.ANIMATIONLOOPMODE_YOYO:return T;case e.ANIMATIONLOOPMODE_RELATIVE:case e.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT:return(null!==(i=n.offsetValue)&&void 0!==i?i:0)*n.repeatCount+T}break;case e.ANIMATIONTYPE_QUATERNION:var E=d?this.quaternionInterpolateFunctionWithTangents(u,l.outTangent.scale(p),h,c.inTangent.scale(p),b):this.quaternionInterpolateFunction(u,h,b);switch(n.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:case e.ANIMATIONLOOPMODE_YOYO:return E;case e.ANIMATIONLOOPMODE_RELATIVE:case e.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT:return E.addInPlace((n.offsetValue||f).scale(n.repeatCount))}return E;case e.ANIMATIONTYPE_VECTOR3:var x=d?this.vector3InterpolateFunctionWithTangents(u,l.outTangent.scale(p),h,c.inTangent.scale(p),b):this.vector3InterpolateFunction(u,h,b);switch(n.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:case e.ANIMATIONLOOPMODE_YOYO:return x;case e.ANIMATIONLOOPMODE_RELATIVE:case e.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT:return x.add((n.offsetValue||m).scale(n.repeatCount))}break;case e.ANIMATIONTYPE_VECTOR2:var P=d?this.vector2InterpolateFunctionWithTangents(u,l.outTangent.scale(p),h,c.inTangent.scale(p),b):this.vector2InterpolateFunction(u,h,b);switch(n.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:case e.ANIMATIONLOOPMODE_YOYO:return P;case e.ANIMATIONLOOPMODE_RELATIVE:case e.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT:return P.add((n.offsetValue||_).scale(n.repeatCount))}break;case e.ANIMATIONTYPE_SIZE:switch(n.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:case e.ANIMATIONLOOPMODE_YOYO:return this.sizeInterpolateFunction(u,h,b);case e.ANIMATIONLOOPMODE_RELATIVE:case e.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT:return this.sizeInterpolateFunction(u,h,b).add((n.offsetValue||g).scale(n.repeatCount))}break;case e.ANIMATIONTYPE_COLOR3:var C=d?this.color3InterpolateFunctionWithTangents(u,l.outTangent.scale(p),h,c.inTangent.scale(p),b):this.color3InterpolateFunction(u,h,b);switch(n.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:case e.ANIMATIONLOOPMODE_YOYO:return C;case e.ANIMATIONLOOPMODE_RELATIVE:case e.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT:return C.add((n.offsetValue||v).scale(n.repeatCount))}break;case e.ANIMATIONTYPE_COLOR4:var R=d?this.color4InterpolateFunctionWithTangents(u,l.outTangent.scale(p),h,c.inTangent.scale(p),b):this.color4InterpolateFunction(u,h,b);switch(n.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:case e.ANIMATIONLOOPMODE_YOYO:return R;case e.ANIMATIONLOOPMODE_RELATIVE:case e.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT:return R.add((n.offsetValue||y).scale(n.repeatCount))}break;case e.ANIMATIONTYPE_MATRIX:switch(n.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:case e.ANIMATIONLOOPMODE_YOYO:return e.AllowMatricesInterpolation?this.matrixInterpolateFunction(u,h,b,n.workValue):u;case e.ANIMATIONLOOPMODE_RELATIVE:case e.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT:return u}}return 0}},e.prototype.matrixInterpolateFunction=function(t,n,r,o){return e.AllowMatrixDecomposeForInterpolation?o?(i.uq.DecomposeLerpToRef(t,n,r,o),o):i.uq.DecomposeLerp(t,n,r):o?(i.uq.LerpToRef(t,n,r,o),o):i.uq.Lerp(t,n,r)},e.prototype.clone=function(){var t=new e(this.name,this.targetPropertyPath.join("."),this.framePerSecond,this.dataType,this.loopMode);if(t.enableBlending=this.enableBlending,t.blendingSpeed=this.blendingSpeed,this._keys&&t.setKeys(this._keys),this._ranges)for(var n in t._ranges={},this._ranges){var r=this._ranges[n];r&&(t._ranges[n]=r.clone())}return t},e.prototype.setKeys=function(e,t){void 0===t&&(t=!1),this._keys=t?e:e.slice(0)},e.prototype.createKeyForFrame=function(e){b.key=0;var t=this._interpolate(e,b,!0);if(!t)return this._keys[b.key].frame===e?b.key:b.key+1;var n={frame:e,value:t.clone?t.clone():t};return this._keys.splice(b.key+1,0,n),b.key+1},e.prototype.serialize=function(){var t={};t.name=this.name,t.property=this.targetProperty,t.framePerSecond=this.framePerSecond,t.dataType=this.dataType,t.loopBehavior=this.loopMode,t.enableBlending=this.enableBlending,t.blendingSpeed=this.blendingSpeed;var n=this.dataType;t.keys=[];for(var r=this.getKeys(),i=0;i=2&&(u=c.values[1]),c.values.length>=3&&(h=c.values[2]),c.values.length>=4&&(d=c.values[3]);break;case e.ANIMATIONTYPE_QUATERNION:if(n=i.PT.FromArray(c.values),c.values.length>=8){var p=i.PT.FromArray(c.values.slice(4,8));p.equals(i.PT.Zero())||(u=p)}if(c.values.length>=12){var f=i.PT.FromArray(c.values.slice(8,12));f.equals(i.PT.Zero())||(h=f)}c.values.length>=13&&(d=c.values[12]);break;case e.ANIMATIONTYPE_MATRIX:n=i.uq.FromArray(c.values),c.values.length>=17&&(d=c.values[16]);break;case e.ANIMATIONTYPE_COLOR3:n=o.v9.FromArray(c.values),c.values[3]&&(u=o.v9.FromArray(c.values[3])),c.values[4]&&(h=o.v9.FromArray(c.values[4])),c.values[5]&&(d=c.values[5]);break;case e.ANIMATIONTYPE_COLOR4:n=o.ov.FromArray(c.values),c.values[4]&&(u=o.ov.FromArray(c.values[4])),c.values[5]&&(h=o.ov.FromArray(c.values[5])),c.values[6]&&(d=o.ov.FromArray(c.values[6]));break;case e.ANIMATIONTYPE_VECTOR3:default:n=i.Pq.FromArray(c.values),c.values[3]&&(u=i.Pq.FromArray(c.values[3])),c.values[4]&&(h=i.Pq.FromArray(c.values[4])),c.values[5]&&(d=c.values[5])}var m={};m.frame=c.frame,m.value=n,null!=u&&(m.inTangent=u),null!=h&&(m.outTangent=h),null!=d&&(m.interpolation=d),l.push(m)}if(a.setKeys(l),t.ranges)for(r=0;r{n.r(t),n.d(t,{fluidRenderingBilateralBlurPixelShaderWGSL:()=>a});var r=n(98519),i="fluidRenderingBilateralBlurPixelShader",o="var textureSamplerSampler: sampler;var textureSampler: texture_2d;uniform maxFilterSize: i32;uniform blurDir: vec2f;uniform projectedParticleConstant: f32;uniform depthThreshold: f32;varying vUV: vec2f;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var depth: f32=textureSampleLevel(textureSampler,textureSamplerSampler,input.vUV,0.).x;if (depth>=1e6 || depth<=0.) {fragmentOutputs.color=vec4f(vec3f(depth),1.);return fragmentOutputs;}\nvar filterSize: i32=min(uniforms.maxFilterSize,i32(ceil(uniforms.projectedParticleConstant/depth)));var sigma: f32=f32(filterSize)/3.0;var two_sigma2: f32=2.0*sigma*sigma;var sigmaDepth: f32=uniforms.depthThreshold/3.0;var two_sigmaDepth2: f32=2.0*sigmaDepth*sigmaDepth;var sum: f32=0.;var wsum: f32=0.;var sumVel: f32=0.;for (var x: i32=-filterSize; x<=filterSize; x++) {var coords: vec2f=vec2f(f32(x));var sampleDepthVel: vec2f=textureSampleLevel(textureSampler,textureSamplerSampler,input.vUV+coords*uniforms.blurDir,0.).rg;var r: f32=dot(coords,coords);var w: f32=exp(-r/two_sigma2);var rDepth: f32=sampleDepthVel.r-depth;var wd: f32=exp(-rDepth*rDepth/two_sigmaDepth2);sum+=sampleDepthVel.r*w*wd;sumVel+=sampleDepthVel.g*w*wd;wsum+=w*wd;}\nfragmentOutputs.color=vec4f(sum/wsum,sumVel/wsum,0.,1.);}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},7164:(e,t,n)=>{n.d(t,{V:()=>i});var r=n(78322),i=function(){function e(){}return e._CheckLimit=function(t,n){var r=e._LogLimitOutputs[t];return r?r.current++:(r={limit:n,current:1},e._LogLimitOutputs[t]=r),r.current<=r.limit},e._GenerateLimitMessage=function(t,n){var r;void 0===n&&(n=1);var i=e._LogLimitOutputs[t];if(i&&e.MessageLimitReached){var o=this._Levels[n];i.current===i.limit&&e[o.name](e.MessageLimitReached.replace(/%LIMIT%/g,""+i.limit).replace(/%TYPE%/g,null!==(r=o.name)&&void 0!==r?r:""))}},e._AddLogEntry=function(t){e._LogCache=t+e._LogCache,e.OnNewCacheEntry&&e.OnNewCacheEntry(t)},e._FormatMessage=function(e){var t=function(e){return e<10?"0"+e:""+e},n=new Date;return"["+t(n.getHours())+":"+t(n.getMinutes())+":"+t(n.getSeconds())+"]: "+e},e._LogDisabled=function(e,t){},e._LogEnabled=function(t,n,i){void 0===t&&(t=1);var o=Array.isArray(n)?n[0]:n;if(void 0===i||e._CheckLimit(o,i)){var a=e._FormatMessage(o),s=this._Levels[t],l=Array.isArray(n)?n.slice(1):[];s.logFunc&&s.logFunc.apply(s,(0,r.fX)(["BJS - "+a],l,!1));var c="
").concat(a,"

");e._AddLogEntry(c),e._GenerateLimitMessage(o,t)}},Object.defineProperty(e,"LogCache",{get:function(){return e._LogCache},enumerable:!1,configurable:!0}),e.ClearLogCache=function(){e._LogCache="",e._LogLimitOutputs={},e.errorsCount=0},Object.defineProperty(e,"LogLevels",{set:function(t){e.Log=e._LogDisabled,e.Warn=e._LogDisabled,e.Error=e._LogDisabled;for(var n=0,r=[e.MessageLogLevel,e.WarningLogLevel,e.ErrorLogLevel];n{n.r(t),n.d(t,{FlowGraphBranchBlock:()=>s});var r=n(78322),i=n(88099),o=n(88677),a=n(34623),s=function(e){function t(t){var n=e.call(this,t)||this;return n.condition=n.registerDataInput("condition",i.RI),n.onTrue=n._registerSignalOutput("onTrue"),n.onFalse=n._registerSignalOutput("onFalse"),n}return(0,r.C6)(t,e),t.prototype._execute=function(e){this.condition.getValue(e)?this.onTrue._activateSignal(e):this.onFalse._activateSignal(e)},t.prototype.getClassName=function(){return"FlowGraphBranchBlock"},t}(o.u);(0,a.Y5)("FlowGraphBranchBlock",s)},7363:(e,t,n)=>{n.r(t),n.d(t,{lightFragment:()=>a});var r=n(98519),i="lightFragment",o="#ifdef LIGHT{X}\n#if defined(SHADOWONLY) || defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X}) && defined(LIGHTMAPNOSPECULAR{X})\n#else\nvec4 diffuse{X}=light{X}.vLightDiffuse;\n#define CUSTOM_LIGHT{X}_COLOR \n#if defined(PBR) && defined(CLUSTLIGHT{X}) && defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\n{int sliceIndex=min(getClusteredSliceIndex(light{X}.vSliceData,vViewDepth),CLUSTLIGHT_SLICES-1);info=computeClusteredLighting(\nlightDataTexture{X},\ntileMaskTexture{X},\nlight{X}.vLightData,\nivec2(light{X}.vSliceRanges[sliceIndex]),\nviewDirectionW,\nnormalW,\nvPositionW,\nsurfaceAlbedo,\nreflectivityOut\n#ifdef IRIDESCENCE\n,iridescenceIntensity\n#endif\n#ifdef SS_TRANSLUCENCY\n,subSurfaceOut\n#endif\n#ifdef SPECULARTERM\n,AARoughnessFactors.x\n#endif\n#ifdef ANISOTROPIC\n,anisotropicOut\n#endif\n#ifdef SHEEN\n,sheenOut\n#endif\n#ifdef CLEARCOAT\n,clearcoatOut\n#endif\n);}\n#elif defined(PBR)\n#ifdef SPOTLIGHT{X}\npreInfo=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW,vPositionW);\n#elif defined(POINTLIGHT{X})\npreInfo=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW,vPositionW);\n#elif defined(HEMILIGHT{X})\npreInfo=computeHemisphericPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\n#elif defined(DIRLIGHT{X})\npreInfo=computeDirectionalPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\n#elif defined(AREALIGHT{X}) && defined(AREALIGHTSUPPORTED)\npreInfo=computeAreaPreLightingInfo(areaLightsLTC1Sampler,areaLightsLTC2Sampler,viewDirectionW,normalW,vPositionW,light{X}.vLightData,light{X}.vLightWidth.xyz,light{X}.vLightHeight.xyz,roughness);\n#endif\npreInfo.NdotV=NdotV;\n#ifdef SPOTLIGHT{X}\n#ifdef LIGHT_FALLOFF_GLTF{X}\npreInfo.attenuation=computeDistanceLightFalloff_GLTF(preInfo.lightDistanceSquared,light{X}.vLightFalloff.y);\n#ifdef IESLIGHTTEXTURE{X}\npreInfo.attenuation*=computeDirectionalLightFalloff_IES(light{X}.vLightDirection.xyz,preInfo.L,iesLightTexture{X});\n#else\npreInfo.attenuation*=computeDirectionalLightFalloff_GLTF(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightFalloff.z,light{X}.vLightFalloff.w);\n#endif\n#elif defined(LIGHT_FALLOFF_PHYSICAL{X})\npreInfo.attenuation=computeDistanceLightFalloff_Physical(preInfo.lightDistanceSquared);\n#ifdef IESLIGHTTEXTURE{X}\npreInfo.attenuation*=computeDirectionalLightFalloff_IES(light{X}.vLightDirection.xyz,preInfo.L,iesLightTexture{X});\n#else\npreInfo.attenuation*=computeDirectionalLightFalloff_Physical(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w);\n#endif\n#elif defined(LIGHT_FALLOFF_STANDARD{X})\npreInfo.attenuation=computeDistanceLightFalloff_Standard(preInfo.lightOffset,light{X}.vLightFalloff.x);\n#ifdef IESLIGHTTEXTURE{X}\npreInfo.attenuation*=computeDirectionalLightFalloff_IES(light{X}.vLightDirection.xyz,preInfo.L,iesLightTexture{X});\n#else\npreInfo.attenuation*=computeDirectionalLightFalloff_Standard(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w,light{X}.vLightData.w);\n#endif\n#else\npreInfo.attenuation=computeDistanceLightFalloff(preInfo.lightOffset,preInfo.lightDistanceSquared,light{X}.vLightFalloff.x,light{X}.vLightFalloff.y);\n#ifdef IESLIGHTTEXTURE{X}\npreInfo.attenuation*=computeDirectionalLightFalloff_IES(light{X}.vLightDirection.xyz,preInfo.L,iesLightTexture{X});\n#else\npreInfo.attenuation*=computeDirectionalLightFalloff(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w,light{X}.vLightData.w,light{X}.vLightFalloff.z,light{X}.vLightFalloff.w);\n#endif\n#endif\n#elif defined(POINTLIGHT{X})\n#ifdef LIGHT_FALLOFF_GLTF{X}\npreInfo.attenuation=computeDistanceLightFalloff_GLTF(preInfo.lightDistanceSquared,light{X}.vLightFalloff.y);\n#elif defined(LIGHT_FALLOFF_PHYSICAL{X})\npreInfo.attenuation=computeDistanceLightFalloff_Physical(preInfo.lightDistanceSquared);\n#elif defined(LIGHT_FALLOFF_STANDARD{X})\npreInfo.attenuation=computeDistanceLightFalloff_Standard(preInfo.lightOffset,light{X}.vLightFalloff.x);\n#else\npreInfo.attenuation=computeDistanceLightFalloff(preInfo.lightOffset,preInfo.lightDistanceSquared,light{X}.vLightFalloff.x,light{X}.vLightFalloff.y);\n#endif\n#else\npreInfo.attenuation=1.0;\n#endif\n#if defined(HEMILIGHT{X}) || defined(AREALIGHT{X})\npreInfo.roughness=roughness;\n#else\npreInfo.roughness=adjustRoughnessFromLightProperties(roughness,light{X}.vLightSpecular.a,preInfo.lightDistance);\n#endif\npreInfo.diffuseRoughness=diffuseRoughness;preInfo.surfaceAlbedo=surfaceAlbedo;\n#ifdef IRIDESCENCE\npreInfo.iridescenceIntensity=iridescenceIntensity;\n#endif\n#ifdef SS_TRANSLUCENCY\ninfo.diffuseTransmission=vec3(0.0);\n#endif\n#ifdef HEMILIGHT{X}\ninfo.diffuse=computeHemisphericDiffuseLighting(preInfo,diffuse{X}.rgb,light{X}.vLightGround);\n#elif defined(AREALIGHT{X})\ninfo.diffuse=computeAreaDiffuseLighting(preInfo,diffuse{X}.rgb);\n#elif defined(SS_TRANSLUCENCY)\n#ifndef SS_TRANSLUCENCY_LEGACY\ninfo.diffuse=computeDiffuseLighting(preInfo,diffuse{X}.rgb)*(1.0-subSurfaceOut.translucencyIntensity);info.diffuseTransmission=computeDiffuseTransmittedLighting(preInfo,diffuse{X}.rgb,subSurfaceOut.transmittance); \n#else\ninfo.diffuse=computeDiffuseTransmittedLighting(preInfo,diffuse{X}.rgb,subSurfaceOut.transmittance);\n#endif\n#else\ninfo.diffuse=computeDiffuseLighting(preInfo,diffuse{X}.rgb);\n#endif\n#ifdef SPECULARTERM\n#if AREALIGHT{X}\ninfo.specular=computeAreaSpecularLighting(preInfo,light{X}.vLightSpecular.rgb,clearcoatOut.specularEnvironmentR0,reflectivityOut.colorReflectanceF90);\n#else\n#if (CONDUCTOR_SPECULAR_MODEL==CONDUCTOR_SPECULAR_MODEL_OPENPBR)\n{vec3 metalFresnel=reflectivityOut.specularWeight*getF82Specular(preInfo.VdotH,clearcoatOut.specularEnvironmentR0,reflectivityOut.colorReflectanceF90,reflectivityOut.roughness);vec3 dielectricFresnel=fresnelSchlickGGX(preInfo.VdotH,reflectivityOut.dielectricColorF0,reflectivityOut.colorReflectanceF90);coloredFresnel=mix(dielectricFresnel,metalFresnel,reflectivityOut.metallic);}\n#else\ncoloredFresnel=fresnelSchlickGGX(preInfo.VdotH,clearcoatOut.specularEnvironmentR0,reflectivityOut.colorReflectanceF90);\n#endif\n#ifndef LEGACY_SPECULAR_ENERGY_CONSERVATION\n{float NdotH=dot(normalW,preInfo.H);vec3 fresnel=fresnelSchlickGGX(NdotH,vec3(reflectanceF0),specularEnvironmentR90);info.diffuse*=(vec3(1.0)-fresnel);}\n#endif\n#ifdef ANISOTROPIC\ninfo.specular=computeAnisotropicSpecularLighting(preInfo,viewDirectionW,normalW,anisotropicOut.anisotropicTangent,anisotropicOut.anisotropicBitangent,anisotropicOut.anisotropy,clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,AARoughnessFactors.x,diffuse{X}.rgb);\n#else\ninfo.specular=computeSpecularLighting(preInfo,normalW,clearcoatOut.specularEnvironmentR0,coloredFresnel,AARoughnessFactors.x,diffuse{X}.rgb);\n#endif\n#endif\n#endif\n#ifndef AREALIGHT{X}\n#ifdef SHEEN\n#ifdef SHEEN_LINKWITHALBEDO\npreInfo.roughness=sheenOut.sheenIntensity;\n#else\n#ifdef HEMILIGHT{X}\npreInfo.roughness=sheenOut.sheenRoughness;\n#else\npreInfo.roughness=adjustRoughnessFromLightProperties(sheenOut.sheenRoughness,light{X}.vLightSpecular.a,preInfo.lightDistance);\n#endif\n#endif\ninfo.sheen=computeSheenLighting(preInfo,normalW,sheenOut.sheenColor,specularEnvironmentR90,AARoughnessFactors.x,diffuse{X}.rgb);\n#endif\n#ifdef CLEARCOAT\n#ifdef HEMILIGHT{X}\npreInfo.roughness=clearcoatOut.clearCoatRoughness;\n#else\npreInfo.roughness=adjustRoughnessFromLightProperties(clearcoatOut.clearCoatRoughness,light{X}.vLightSpecular.a,preInfo.lightDistance);\n#endif\ninfo.clearCoat=computeClearCoatLighting(preInfo,clearcoatOut.clearCoatNormalW,clearcoatOut.clearCoatAARoughnessFactors.x,clearcoatOut.clearCoatIntensity,diffuse{X}.rgb);\n#ifdef CLEARCOAT_TINT\nabsorption=computeClearCoatLightingAbsorption(clearcoatOut.clearCoatNdotVRefract,preInfo.L,clearcoatOut.clearCoatNormalW,clearcoatOut.clearCoatColor,clearcoatOut.clearCoatThickness,clearcoatOut.clearCoatIntensity);info.diffuse*=absorption;\n#ifdef SS_TRANSLUCENCY\ninfo.diffuseTransmission*=absorption;\n#endif\n#ifdef SPECULARTERM\ninfo.specular*=absorption;\n#endif\n#endif\ninfo.diffuse*=info.clearCoat.w;\n#ifdef SS_TRANSLUCENCY\ninfo.diffuseTransmission*=info.clearCoat.w;\n#endif\n#ifdef SPECULARTERM\ninfo.specular*=info.clearCoat.w;\n#endif\n#ifdef SHEEN\ninfo.sheen*=info.clearCoat.w;\n#endif\n#endif\n#endif\n#else\n#ifdef SPOTLIGHT{X}\n#ifdef IESLIGHTTEXTURE{X}\ninfo=computeIESSpotLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDirection,diffuse{X}.rgb,light{X}.vLightSpecular.rgb,diffuse{X}.a,glossiness,iesLightTexture{X});\n#else\ninfo=computeSpotLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDirection,diffuse{X}.rgb,light{X}.vLightSpecular.rgb,diffuse{X}.a,glossiness);\n#endif\n#elif defined(HEMILIGHT{X})\ninfo=computeHemisphericLighting(viewDirectionW,normalW,light{X}.vLightData,diffuse{X}.rgb,light{X}.vLightSpecular.rgb,light{X}.vLightGround,glossiness);\n#elif defined(POINTLIGHT{X}) || defined(DIRLIGHT{X})\ninfo=computeLighting(viewDirectionW,normalW,light{X}.vLightData,diffuse{X}.rgb,light{X}.vLightSpecular.rgb,diffuse{X}.a,glossiness);\n#elif defined(AREALIGHT{X}) && defined(AREALIGHTSUPPORTED)\ninfo=computeAreaLighting(areaLightsLTC1Sampler,areaLightsLTC2Sampler,viewDirectionW,normalW,vPositionW,light{X}.vLightData.xyz,light{X}.vLightWidth.rgb,light{X}.vLightHeight.rgb,diffuse{X}.rgb,light{X}.vLightSpecular.rgb,\n#ifdef AREALIGHTNOROUGHTNESS\n0.5\n#else\nvReflectionInfos.y\n#endif\n);\n#elif defined(CLUSTLIGHT{X}) && CLUSTLIGHT_BATCH>0\n{int sliceIndex=min(getClusteredSliceIndex(light{X}.vSliceData,vViewDepth),CLUSTLIGHT_SLICES-1);info=computeClusteredLighting(lightDataTexture{X},tileMaskTexture{X},viewDirectionW,normalW,light{X}.vLightData,ivec2(light{X}.vSliceRanges[sliceIndex]),glossiness);}\n#endif\n#endif\n#ifdef PROJECTEDLIGHTTEXTURE{X}\ninfo.diffuse*=computeProjectionTextureDiffuseLighting(projectionLightTexture{X},textureProjectionMatrix{X},vPositionW);\n#endif\n#endif\n#ifdef SHADOW{X}\n#ifdef SHADOWCSM{X}\nfor (int i=0; i=0.) {index{X}=i;break;}}\n#ifdef SHADOWCSMUSESHADOWMAXZ{X}\nif (index{X}>=0)\n#endif\n{\n#if defined(SHADOWPCF{X})\n#if defined(SHADOWLOWQUALITY{X})\nshadow=computeShadowWithCSMPCF1(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#elif defined(SHADOWMEDIUMQUALITY{X})\nshadow=computeShadowWithCSMPCF3(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#else\nshadow=computeShadowWithCSMPCF5(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPCSS{X})\n#if defined(SHADOWLOWQUALITY{X})\nshadow=computeShadowWithCSMPCSS16(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthTexture{X},shadowTexture{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#elif defined(SHADOWMEDIUMQUALITY{X})\nshadow=computeShadowWithCSMPCSS32(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthTexture{X},shadowTexture{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#else\nshadow=computeShadowWithCSMPCSS64(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthTexture{X},shadowTexture{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#endif\n#else\nshadow=computeShadowCSM(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#ifdef SHADOWCSMDEBUG{X}\nshadowDebug{X}=vec3(shadow)*vCascadeColorsMultiplier{X}[index{X}];\n#endif\n#ifndef SHADOWCSMNOBLEND{X}\nfloat frustumLength=frustumLengths{X}[index{X}];float diffRatio=clamp(diff{X}/frustumLength,0.,1.)*cascadeBlendFactor{X};if (index{X}<(SHADOWCSMNUM_CASCADES{X}-1) && diffRatio<1.)\n{index{X}+=1;float nextShadow=0.;\n#if defined(SHADOWPCF{X})\n#if defined(SHADOWLOWQUALITY{X})\nnextShadow=computeShadowWithCSMPCF1(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#elif defined(SHADOWMEDIUMQUALITY{X})\nnextShadow=computeShadowWithCSMPCF3(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#else\nnextShadow=computeShadowWithCSMPCF5(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPCSS{X})\n#if defined(SHADOWLOWQUALITY{X})\nnextShadow=computeShadowWithCSMPCSS16(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthTexture{X},shadowTexture{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#elif defined(SHADOWMEDIUMQUALITY{X})\nnextShadow=computeShadowWithCSMPCSS32(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthTexture{X},shadowTexture{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#else\nnextShadow=computeShadowWithCSMPCSS64(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthTexture{X},shadowTexture{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#endif\n#else\nnextShadow=computeShadowCSM(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\nshadow=mix(nextShadow,shadow,diffRatio);\n#ifdef SHADOWCSMDEBUG{X}\nshadowDebug{X}=mix(vec3(nextShadow)*vCascadeColorsMultiplier{X}[index{X}],shadowDebug{X},diffRatio);\n#endif\n}\n#endif\n}\n#elif defined(SHADOWCLOSEESM{X})\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowWithCloseESMCube(vPositionW,light{X}.vLightData.xyz,shadowTexture{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.depthValues);\n#else\nshadow=computeShadowWithCloseESM(vPositionFromLight{X},vDepthMetric{X},shadowTexture{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWESM{X})\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowWithESMCube(vPositionW,light{X}.vLightData.xyz,shadowTexture{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.depthValues);\n#else\nshadow=computeShadowWithESM(vPositionFromLight{X},vDepthMetric{X},shadowTexture{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPOISSON{X})\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowWithPoissonSamplingCube(vPositionW,light{X}.vLightData.xyz,shadowTexture{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.x,light{X}.depthValues);\n#else\nshadow=computeShadowWithPoissonSampling(vPositionFromLight{X},vDepthMetric{X},shadowTexture{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPCF{X})\n#if defined(SHADOWLOWQUALITY{X})\nshadow=computeShadowWithPCF1(vPositionFromLight{X},vDepthMetric{X},shadowTexture{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#elif defined(SHADOWMEDIUMQUALITY{X})\nshadow=computeShadowWithPCF3(vPositionFromLight{X},vDepthMetric{X},shadowTexture{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#else\nshadow=computeShadowWithPCF5(vPositionFromLight{X},vDepthMetric{X},shadowTexture{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPCSS{X})\n#if defined(SHADOWLOWQUALITY{X})\nshadow=computeShadowWithPCSS16(vPositionFromLight{X},vDepthMetric{X},depthTexture{X},shadowTexture{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#elif defined(SHADOWMEDIUMQUALITY{X})\nshadow=computeShadowWithPCSS32(vPositionFromLight{X},vDepthMetric{X},depthTexture{X},shadowTexture{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#else\nshadow=computeShadowWithPCSS64(vPositionFromLight{X},vDepthMetric{X},depthTexture{X},shadowTexture{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#else\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowCube(vPositionW,light{X}.vLightData.xyz,shadowTexture{X},light{X}.shadowsInfo.x,light{X}.depthValues);\n#else\nshadow=computeShadow(vPositionFromLight{X},vDepthMetric{X},shadowTexture{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#endif\n#ifdef SHADOWONLY\n#ifndef SHADOWINUSE\n#define SHADOWINUSE\n#endif\nglobalShadow+=shadow;shadowLightCount+=1.0;\n#endif\n#else\nshadow=1.;\n#endif\naggShadow+=shadow;numLights+=1.0;\n#ifndef SHADOWONLY\n#ifdef CUSTOMUSERLIGHTING\ndiffuseBase+=computeCustomDiffuseLighting(info,diffuseBase,shadow);\n#ifdef SPECULARTERM\nspecularBase+=computeCustomSpecularLighting(info,specularBase,shadow);\n#endif\n#elif defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X})\ndiffuseBase+=lightmapColor.rgb*shadow;\n#ifdef SPECULARTERM\n#ifndef LIGHTMAPNOSPECULAR{X}\nspecularBase+=info.specular*shadow*lightmapColor.rgb;\n#endif\n#endif\n#ifdef CLEARCOAT\n#ifndef LIGHTMAPNOSPECULAR{X}\nclearCoatBase+=info.clearCoat.rgb*shadow*lightmapColor.rgb;\n#endif\n#endif\n#ifdef SHEEN\n#ifndef LIGHTMAPNOSPECULAR{X}\nsheenBase+=info.sheen.rgb*shadow;\n#endif\n#endif\n#else\n#ifdef SHADOWCSMDEBUG{X}\ndiffuseBase+=info.diffuse*shadowDebug{X};\n#else\ndiffuseBase+=info.diffuse*shadow;\n#endif\n#ifdef SS_TRANSLUCENCY\ndiffuseTransmissionBase+=info.diffuseTransmission*shadow;\n#endif\n#ifdef SPECULARTERM\nspecularBase+=info.specular*shadow;\n#endif\n#ifdef CLEARCOAT\nclearCoatBase+=info.clearCoat.rgb*shadow;\n#endif\n#ifdef SHEEN\nsheenBase+=info.sheen.rgb*shadow;\n#endif\n#endif\n#endif\n#endif\n";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]=o);var a={name:i,shader:o}},7621:(e,t,n)=>{n.r(t),n.d(t,{kernelBlurVertexShaderWGSL:()=>s});var r=n(98519),i=(n(14782),"kernelBlurVertex");r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="vertexOutputs.sampleCoord{X}=vertexOutputs.sampleCenter+uniforms.delta*KERNEL_OFFSET{X};");var o="kernelBlurVertexShader",a="attribute position: vec2f;uniform delta: vec2f;varying sampleCenter: vec2f;\n#include[0..varyingCount]\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {const madd: vec2f= vec2f(0.5,0.5);\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvertexOutputs.sampleCenter=(input.position*madd+madd);\n#include[0..varyingCount]\nvertexOutputs.position= vec4f(input.position,0.0,1.0);\n#define CUSTOM_VERTEX_MAIN_END\n}";r.l.ShadersStoreWGSL[o]||(r.l.ShadersStoreWGSL[o]=a);var s={name:o,shader:a}},7726:(e,t,n)=>{n.r(t),n.d(t,{meshUVSpaceRendererFinaliserVertexShader:()=>a});var r=n(98519),i="meshUVSpaceRendererFinaliserVertexShader",o="precision highp float;attribute vec3 position;attribute vec2 uv;uniform mat4 worldViewProjection;varying vec2 vUV;void main() {gl_Position=worldViewProjection*vec4(position,1.0);vUV=uv;}\n";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},7761:(e,t,n)=>{var r=n(98519),i="prePassVertex";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#ifdef PREPASS_DEPTH\nvViewPos=(view*worldPos).rgb;\n#endif\n#ifdef PREPASS_NORMALIZED_VIEW_DEPTH\nvNormViewDepth=((view*worldPos).z-cameraInfo.x)/(cameraInfo.y-cameraInfo.x);\n#endif\n#ifdef PREPASS_LOCAL_POSITION\nvPosition=positionUpdated.xyz;\n#endif\n#if (defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR)) && defined(BONES_VELOCITY_ENABLED)\nvCurrentPosition=viewProjection*worldPos;\n#if NUM_BONE_INFLUENCERS>0\nmat4 previousInfluence;previousInfluence=mPreviousBones[int(matricesIndices[0])]*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\npreviousInfluence+=mPreviousBones[int(matricesIndices[1])]*matricesWeights[1];\n#endif \n#if NUM_BONE_INFLUENCERS>2\npreviousInfluence+=mPreviousBones[int(matricesIndices[2])]*matricesWeights[2];\n#endif \n#if NUM_BONE_INFLUENCERS>3\npreviousInfluence+=mPreviousBones[int(matricesIndices[3])]*matricesWeights[3];\n#endif\n#if NUM_BONE_INFLUENCERS>4\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0];\n#endif \n#if NUM_BONE_INFLUENCERS>5\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1];\n#endif \n#if NUM_BONE_INFLUENCERS>6\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2];\n#endif \n#if NUM_BONE_INFLUENCERS>7\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3];\n#endif\nvPreviousPosition=previousViewProjection*finalPreviousWorld*previousInfluence*vec4(positionUpdated,1.0);\n#else\nvPreviousPosition=previousViewProjection*finalPreviousWorld*vec4(positionUpdated,1.0);\n#endif\n#endif\n")},7779:(e,t,n)=>{var r=n(98519),i="screenSpaceRayTrace";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="fn distanceSquared(a: vec2f,b: vec2f)->f32 { \nvar temp=a-b; \nreturn dot(temp,temp); }\n#ifdef SSRAYTRACE_SCREENSPACE_DEPTH\nfn linearizeDepth(depth: f32,near: f32,far: f32)->f32 {\n#ifdef SSRAYTRACE_RIGHT_HANDED_SCENE\nreturn -(near*far)/(far-depth*(far-near));\n#else\nreturn (near*far)/(far-depth*(far-near));\n#endif\n}\n#endif\n/**\nparam csOrigin Camera-space ray origin,which must be \nwithin the view volume and must have z>0.01 and project within the valid screen rectangle\nparam csDirection Unit length camera-space ray direction\nparam projectToPixelMatrix A projection matrix that maps to **pixel** coordinates \n(**not** [-1,+1] normalized device coordinates).\nparam csZBuffer The camera-space Z buffer\nparam csZBufferSize Dimensions of csZBuffer\nparam csZThickness Camera space csZThickness to ascribe to each pixel in the depth buffer\nparam nearPlaneZ Positive number. Doesn't have to be THE actual near plane,just a reasonable value\nfor clipping rays headed towards the camera. Should be the actual near plane if screen-space depth is enabled.\nparam farPlaneZ The far plane for the camera. Used when screen-space depth is enabled.\nparam stride Step in horizontal or vertical pixels between samples. This is a var because: f32 integer math is slow on GPUs,but should be set to an integer>=1\nparam jitterFraction Number between 0 and 1 for how far to bump the ray in stride units\nto conceal banding artifacts,plus the stride ray offset.\nparam maxSteps Maximum number of iterations. Higher gives better images but may be slow\nparam maxRayTraceDistance Maximum camera-space distance to trace before returning a miss\nparam selfCollisionNumSkip Number of steps to skip at start when raytracing to avar self: voidnull collisions.\n1 is a reasonable value,depending on the scene you may need to set this value to 2\nparam hitPixel Pixel coordinates of the first intersection with the scene\nparam numIterations number of iterations performed\nparam csHitPovar Camera: i32 space location of the ray hit\n*/\nfn traceScreenSpaceRay1(\ncsOrigin: vec3f,\ncsDirection: vec3f,\nprojectToPixelMatrix: mat4x4f,\ncsZBuffer: texture_2d,\ncsZBufferSize: vec2f,\n#ifdef SSRAYTRACE_USE_BACK_DEPTHBUFFER\ncsZBackBuffer: texture_2d,\ncsZBackSizeFactor: f32,\n#endif\ncsZThickness: f32,\nnearPlaneZ: f32,\nfarPlaneZ: f32,\nstride: f32,\njitterFraction: f32,\nmaxSteps: f32,\nmaxRayTraceDistance: f32,\nselfCollisionNumSkip: f32,\nstartPixel: ptr,\nhitPixel: ptr,\ncsHitPoint: ptr,\nnumIterations: ptr\n#ifdef SSRAYTRACE_DEBUG\n,debugColor: ptr\n#endif\n)->bool\n{\n#ifdef SSRAYTRACE_RIGHT_HANDED_SCENE\nvar rayLength: f32=select(maxRayTraceDistance,(-nearPlaneZ-csOrigin.z)/csDirection.z,(csOrigin.z+csDirection.z*maxRayTraceDistance)>-nearPlaneZ);\n#else\nvar rayLength: f32=select(maxRayTraceDistance,(nearPlaneZ-csOrigin.z)/csDirection.z,(csOrigin.z+csDirection.z*maxRayTraceDistance)yMax) || (P1.yyMax)))/(P1.y-P0.y);}\nif ((P1.x>xMax) || (P1.xxMax)))/(P1.x-P0.x));}\nP1=mix(P1,P0,alpha); k1=mix(k1,k0,alpha); Q1=mix(Q1,Q0,alpha);\n#endif\nP1+= vec2f(select(0.0,0.01,distanceSquared(P0,P1)<0.0001));var delta: vec2f=P1-P0;var permute: bool=false;if (abs(delta.x)rayZMax) { \nvar t: f32=rayZMin; rayZMin=rayZMax; rayZMax=t;}\nsceneZMax=textureLoad(csZBuffer,vec2(*hitPixel),0).r;\n#ifdef SSRAYTRACE_SCREENSPACE_DEPTH\nsceneZMax=linearizeDepth(sceneZMax,nearPlaneZ,farPlaneZ);\n#endif\nif (sceneZMax==0.0) { sceneZMax=1e8; }\n#ifdef SSRAYTRACE_RIGHT_HANDED_SCENE\n#ifdef SSRAYTRACE_USE_BACK_DEPTHBUFFER\nvar sceneBackZ: f32=textureLoad(csZBackBuffer,vec2(*hitPixel/csZBackSizeFactor),0).r;\n#ifdef SSRAYTRACE_SCREENSPACE_DEPTH\nsceneBackZ=linearizeDepth(sceneBackZ,nearPlaneZ,farPlaneZ);\n#endif\nif (sceneBackZ==0.0) { sceneBackZ=-1e8; }\nhit=(rayZMax>=sceneBackZ-csZThickness) && (rayZMin<=sceneZMax);\n#else\nhit=(rayZMax>=sceneZMax-csZThickness) && (rayZMin<=sceneZMax);\n#endif\n#else\n#ifdef SSRAYTRACE_USE_BACK_DEPTHBUFFER\nvar sceneBackZ: f32=textureLoad(csZBackBuffer,vec2(*hitPixel/csZBackSizeFactor),0).r;\n#ifdef SSRAYTRACE_SCREENSPACE_DEPTH\nsceneBackZ=linearizeDepth(sceneBackZ,nearPlaneZ,farPlaneZ);\n#endif\nif (sceneBackZ==0.0) { sceneBackZ=1e8; }\nhit=(rayZMin<=sceneBackZ+csZThickness) && (rayZMax>=sceneZMax) && (sceneZMax != 0.0);\n#else\nhit=(rayZMin<=sceneZMax+csZThickness) && (rayZMax>=sceneZMax);\n#endif\n#endif\nstepCount+=1.0;}\npqk-=dPQK;stepCount-=1.0;if (((pqk.x+dPQK.x)*stepDirection)>end || (stepCount+1.0)>=maxSteps || sceneZMax==0.0) {hit=false;}\n#ifdef SSRAYTRACE_ENABLE_REFINEMENT\nif (stride>1.0 && hit) {pqk-=dPQK;stepCount-=1.0;var invStride: f32=1.0/stride;dPQK*=invStride;var refinementStepCount: f32=0.0;prevZMaxEstimate=pqk.z/pqk.w;rayZMax=prevZMaxEstimate;sceneZMax=rayZMax+1e7;for (;refinementStepCount<=1.0 ||\n((refinementStepCount<=stride*1.4) &&\n(rayZMax(*hitPixel),0).r;\n#ifdef SSRAYTRACE_SCREENSPACE_DEPTH\nsceneZMax=linearizeDepth(sceneZMax,nearPlaneZ,farPlaneZ);\n#endif\nrefinementStepCount+=1.0;}\npqk-=dPQK;refinementStepCount-=1.0;stepCount+=refinementStepCount/stride;}\n#endif\nQ0=vec3f(Q0.xy+dQ.xy*stepCount,pqk.z);*csHitPoint=Q0/pqk.w;*numIterations=stepCount+1.0;\n#ifdef SSRAYTRACE_DEBUG\nif (((pqk.x+dPQK.x)*stepDirection)>end) {*debugColor= vec3f(0,0,1);} else if ((stepCount+1.0)>=maxSteps) {*debugColor= vec3f(1,0,0);} else if (sceneZMax==0.0) {*debugColor= vec3f(1,1,0);} else {*debugColor= vec3f(0,stepCount/maxSteps,0);}\n#endif\nreturn hit;}\n/**\ntexCoord: in the [0,1] range\ndepth: depth in view space (range [znear,zfar]])\n*/\nfn computeViewPosFromUVDepth(texCoord: vec2f,depth: f32,projection: mat4x4f,invProjectionMatrix: mat4x4f)->vec3f {var xy=texCoord*2.0-1.0;var z: f32;\n#ifdef SSRAYTRACE_RIGHT_HANDED_SCENE\n#ifdef ORTHOGRAPHIC_CAMERA\nz=-projection[2].z*depth+projection[3].z;\n#else\nz=-projection[2].z-projection[3].z/depth;\n#endif\n#else\n#ifdef ORTHOGRAPHIC_CAMERA\nz=projection[2].z*depth+projection[3].z;\n#else\nz=projection[2].z+projection[3].z/depth;\n#endif\n#endif\nvar w=1.0;var ndc=vec4f(xy,z,w);var eyePos: vec4f=invProjectionMatrix*ndc;var result=eyePos.xyz/eyePos.w;return result;}\n")},7803:(e,t,n)=>{n.r(t),n.d(t,{EasingFunctionType:()=>r,FlowGraphEasingBlock:()=>u});var r,i=n(78322),o=n(84668),a=n(45749),s=n(88099),l=n(34623);function c(e){for(var t=[],n=1;n{n.d(t,{m:()=>o,o:()=>i});var r=n(85043),i=function(){},o=function(){function e(t){this._useSceneAutoClearSetup=!1,this._disableDepthPrePass=!1,this._renderingGroups=new Array,this._autoClearDepthStencil={},this._customOpaqueSortCompareFn={},this._customAlphaTestSortCompareFn={},this._customTransparentSortCompareFn={},this._renderingGroupInfo=new i,this._maintainStateBetweenFrames=!1,this._scene=t;for(var n=e.MIN_RENDERINGGROUPS;n{n.d(t,{G:()=>o});var r=n(8046),i=n(62623),o=function(){function e(){this.hit=!1,this.distance=0,this.pickedPoint=null,this.pickedMesh=null,this.bu=0,this.bv=0,this.faceId=-1,this.subMeshFaceId=-1,this.subMeshId=0,this.pickedSprite=null,this.thinInstanceIndex=-1,this.ray=null,this.originMesh=null,this.aimTransform=null,this.gripTransform=null}return e.prototype.getNormal=function(e,t){var n=this;if(void 0===e&&(e=!1),void 0===t&&(t=!0),!this.pickedMesh||t&&!this.pickedMesh.isVerticesDataPresent(i.R.NormalKind))return null;var o,a=this.pickedMesh.getIndices();0===(null==a?void 0:a.length)&&(a=null);var s=r.AA.Vector3[0],l=r.AA.Vector3[1],c=r.AA.Vector3[2];if(t){var u=this.pickedMesh.getVerticesData(i.R.NormalKind),h=a?r.Pq.FromArrayToRef(u,3*a[3*this.faceId],s):s.copyFromFloats(u[3*this.faceId*3],u[3*this.faceId*3+1],u[3*this.faceId*3+2]),d=a?r.Pq.FromArrayToRef(u,3*a[3*this.faceId+1],l):l.copyFromFloats(u[3*(3*this.faceId+1)],u[3*(3*this.faceId+1)+1],u[3*(3*this.faceId+1)+2]),p=a?r.Pq.FromArrayToRef(u,3*a[3*this.faceId+2],c):c.copyFromFloats(u[3*(3*this.faceId+2)],u[3*(3*this.faceId+2)+1],u[3*(3*this.faceId+2)+2]);h=h.scale(this.bu),d=d.scale(this.bv),p=p.scale(1-this.bu-this.bv),o=new r.Pq(h.x+d.x+p.x,h.y+d.y+p.y,h.z+d.z+p.z)}else{var f=this.pickedMesh.getVerticesData(i.R.PositionKind),m=a?r.Pq.FromArrayToRef(f,3*a[3*this.faceId],s):s.copyFromFloats(f[3*this.faceId*3],f[3*this.faceId*3+1],f[3*this.faceId*3+2]),_=a?r.Pq.FromArrayToRef(f,3*a[3*this.faceId+1],l):l.copyFromFloats(f[3*(3*this.faceId+1)],f[3*(3*this.faceId+1)+1],f[3*(3*this.faceId+1)+2]),g=a?r.Pq.FromArrayToRef(f,3*a[3*this.faceId+2],c):c.copyFromFloats(f[3*(3*this.faceId+2)],f[3*(3*this.faceId+2)+1],f[3*(3*this.faceId+2)+2]),v=m.subtract(_),y=g.subtract(_);o=r.Pq.Cross(v,y)}var b=function(e,t){if(-1!==n.thinInstanceIndex){var i=e.thinInstanceGetWorldMatrices()[n.thinInstanceIndex];i&&r.Pq.TransformNormalToRef(t,i,t)}var o=e.getWorldMatrix();e.nonUniformScaling&&(r.AA.Matrix[0].copyFrom(o),(o=r.AA.Matrix[0]).setTranslationFromFloats(0,0,0),o.invert(),o.transposeToRef(r.AA.Matrix[1]),o=r.AA.Matrix[1]),r.Pq.TransformNormalToRef(t,o,t)};if(e&&b(this.pickedMesh,o),this.ray){var S=r.AA.Vector3[0].copyFrom(o);e||b(this.pickedMesh,S),r.Pq.Dot(S,this.ray.direction)>0&&o.negateInPlace()}return o.normalize(),o},e.prototype.getTextureCoordinates=function(e){if(void 0===e&&(e=i.R.UVKind),!this.pickedMesh||!this.pickedMesh.isVerticesDataPresent(e))return null;var t=this.pickedMesh.getIndices();if(!t)return null;var n=this.pickedMesh.getVerticesData(e);if(!n)return null;var o=r.I9.FromArray(n,2*t[3*this.faceId]),a=r.I9.FromArray(n,2*t[3*this.faceId+1]),s=r.I9.FromArray(n,2*t[3*this.faceId+2]);return o=o.scale(this.bu),a=a.scale(this.bv),s=s.scale(1-this.bu-this.bv),new r.I9(o.x+a.x+s.x,o.y+a.y+s.y)},e}()},8046:(e,t,n)=>{n.d(t,{AA:()=>v,I9:()=>d,IU:()=>f,PT:()=>m,Pq:()=>p,uq:()=>_});var r=n(78322),i=n(56740),o=n(11296),a=n(34623),s=n(16106),l=n(66614),c=n(48810),u=n(19023),h=function(e){return parseInt(e.toString().replace(/\W/g,""))},d=function(){function e(e,t){void 0===e&&(e=0),void 0===t&&(t=0),this.x=e,this.y=t}return e.prototype.toString=function(){return"{X: ".concat(this.x," Y: ").concat(this.y,"}")},e.prototype.getClassName=function(){return"Vector2"},e.prototype.getHashCode=function(){var e=h(this.x);return 397*e^h(this.y)},e.prototype.toArray=function(e,t){return void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,this},e.prototype.fromArray=function(t,n){return void 0===n&&(n=0),e.FromArrayToRef(t,n,this),this},e.prototype.asArray=function(){return[this.x,this.y]},e.prototype.copyFrom=function(e){return this.x=e.x,this.y=e.y,this},e.prototype.copyFromFloats=function(e,t){return this.x=e,this.y=t,this},e.prototype.set=function(e,t){return this.copyFromFloats(e,t)},e.prototype.setAll=function(e){return this.copyFromFloats(e,e)},e.prototype.add=function(t){return new e(this.x+t.x,this.y+t.y)},e.prototype.addToRef=function(e,t){return t.x=this.x+e.x,t.y=this.y+e.y,t},e.prototype.addInPlace=function(e){return this.x+=e.x,this.y+=e.y,this},e.prototype.addInPlaceFromFloats=function(e,t){return this.x+=e,this.y+=t,this},e.prototype.addVector3=function(t){return new e(this.x+t.x,this.y+t.y)},e.prototype.subtract=function(t){return new e(this.x-t.x,this.y-t.y)},e.prototype.subtractToRef=function(e,t){return t.x=this.x-e.x,t.y=this.y-e.y,t},e.prototype.subtractInPlace=function(e){return this.x-=e.x,this.y-=e.y,this},e.prototype.multiplyInPlace=function(e){return this.x*=e.x,this.y*=e.y,this},e.prototype.multiply=function(t){return new e(this.x*t.x,this.y*t.y)},e.prototype.multiplyToRef=function(e,t){return t.x=this.x*e.x,t.y=this.y*e.y,t},e.prototype.multiplyByFloats=function(t,n){return new e(this.x*t,this.y*n)},e.prototype.divide=function(t){return new e(this.x/t.x,this.y/t.y)},e.prototype.divideToRef=function(e,t){return t.x=this.x/e.x,t.y=this.y/e.y,t},e.prototype.divideInPlace=function(e){return this.x=this.x/e.x,this.y=this.y/e.y,this},e.prototype.minimizeInPlace=function(e){return this.minimizeInPlaceFromFloats(e.x,e.y)},e.prototype.maximizeInPlace=function(e){return this.maximizeInPlaceFromFloats(e.x,e.y)},e.prototype.minimizeInPlaceFromFloats=function(e,t){return this.x=Math.min(e,this.x),this.y=Math.min(t,this.y),this},e.prototype.maximizeInPlaceFromFloats=function(e,t){return this.x=Math.max(e,this.x),this.y=Math.max(t,this.y),this},e.prototype.subtractFromFloats=function(t,n){return new e(this.x-t,this.y-n)},e.prototype.subtractFromFloatsToRef=function(e,t,n){return n.x=this.x-e,n.y=this.y-t,n},e.prototype.negate=function(){return new e(-this.x,-this.y)},e.prototype.negateInPlace=function(){return this.x*=-1,this.y*=-1,this},e.prototype.negateToRef=function(e){return e.x=-this.x,e.y=-this.y,e},e.prototype.scaleInPlace=function(e){return this.x*=e,this.y*=e,this},e.prototype.scale=function(t){return new e(this.x*t,this.y*t)},e.prototype.scaleToRef=function(e,t){return t.x=this.x*e,t.y=this.y*e,t},e.prototype.scaleAndAddToRef=function(e,t){return t.x+=this.x*e,t.y+=this.y*e,t},e.prototype.equals=function(e){return e&&this.x===e.x&&this.y===e.y},e.prototype.equalsWithEpsilon=function(e,t){return void 0===t&&(t=i.bH),e&&(0,c.WithinEpsilon)(this.x,e.x,t)&&(0,c.WithinEpsilon)(this.y,e.y,t)},e.prototype.equalsToFloats=function(e,t){return this.x===e&&this.y===t},e.prototype.floor=function(){return new e(Math.floor(this.x),Math.floor(this.y))},e.prototype.floorToRef=function(e){return e.x=Math.floor(this.x),e.y=Math.floor(this.y),e},e.prototype.fract=function(){return new e(this.x-Math.floor(this.x),this.y-Math.floor(this.y))},e.prototype.fractToRef=function(e){return e.x=this.x-Math.floor(this.x),e.y=this.y-Math.floor(this.y),e},e.prototype.rotate=function(t){return this.rotateToRef(t,new e)},e.prototype.rotateToRef=function(e,t){var n=Math.cos(e),r=Math.sin(e);return t.x=n*this.x-r*this.y,t.y=r*this.x+n*this.y,t},e.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},e.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y},e.prototype.normalize=function(){return this.normalizeFromLength(this.length())},e.prototype.normalizeFromLength=function(e){return 0===e||1===e?this:this.scaleInPlace(1/e)},e.prototype.normalizeToNew=function(){var t=new e;return this.normalizeToRef(t),t},e.prototype.normalizeToRef=function(e){var t=this.length();return 0===t&&(e.x=this.x,e.y=this.y),this.scaleToRef(1/t,e)},e.prototype.clone=function(){return new e(this.x,this.y)},e.prototype.dot=function(e){return this.x*e.x+this.y*e.y},e.Zero=function(){return new e(0,0)},e.One=function(){return new e(1,1)},e.Random=function(t,n){return void 0===t&&(t=0),void 0===n&&(n=1),new e((0,c.RandomRange)(t,n),(0,c.RandomRange)(t,n))},e.RandomToRef=function(e,t,n){return void 0===e&&(e=0),void 0===t&&(t=1),n.copyFromFloats((0,c.RandomRange)(e,t),(0,c.RandomRange)(e,t))},Object.defineProperty(e,"ZeroReadOnly",{get:function(){return e._ZeroReadOnly},enumerable:!1,configurable:!0}),e.FromArray=function(t,n){return void 0===n&&(n=0),new e(t[n],t[n+1])},e.FromArrayToRef=function(e,t,n){return n.x=e[t],n.y=e[t+1],n},e.FromFloatsToRef=function(e,t,n){return n.copyFromFloats(e,t),n},e.CatmullRom=function(t,n,r,i,o){var a=o*o,s=o*a;return new e(.5*(2*n.x+(-t.x+r.x)*o+(2*t.x-5*n.x+4*r.x-i.x)*a+(-t.x+3*n.x-3*r.x+i.x)*s),.5*(2*n.y+(-t.y+r.y)*o+(2*t.y-5*n.y+4*r.y-i.y)*a+(-t.y+3*n.y-3*r.y+i.y)*s))},e.ClampToRef=function(e,t,n,r){return r.x=(0,c.Clamp)(e.x,t.x,n.x),r.y=(0,c.Clamp)(e.y,t.y,n.y),r},e.Clamp=function(t,n,r){return new e((0,c.Clamp)(t.x,n.x,r.x),(0,c.Clamp)(t.y,n.y,r.y))},e.Hermite=function(t,n,r,i,o){var a=o*o,s=o*a,l=2*s-3*a+1,c=-2*s+3*a,u=s-2*a+o,h=s-a;return new e(t.x*l+r.x*c+n.x*u+i.x*h,t.y*l+r.y*c+n.y*u+i.y*h)},e.Hermite1stDerivative=function(t,n,r,i,o){return this.Hermite1stDerivativeToRef(t,n,r,i,o,new e)},e.Hermite1stDerivativeToRef=function(e,t,n,r,i,o){var a=i*i;return o.x=6*(a-i)*e.x+(3*a-4*i+1)*t.x+6*(-a+i)*n.x+(3*a-2*i)*r.x,o.y=6*(a-i)*e.y+(3*a-4*i+1)*t.y+6*(-a+i)*n.y+(3*a-2*i)*r.y,o},e.Lerp=function(t,n,r){return e.LerpToRef(t,n,r,new e)},e.LerpToRef=function(e,t,n,r){return r.x=e.x+(t.x-e.x)*n,r.y=e.y+(t.y-e.y)*n,r},e.Dot=function(e,t){return e.x*t.x+e.y*t.y},e.Normalize=function(t){return e.NormalizeToRef(t,new e)},e.NormalizeToRef=function(e,t){return e.normalizeToRef(t),t},e.Minimize=function(t,n){return new e(t.xn.x?t.x:n.x,t.y>n.y?t.y:n.y)},e.Transform=function(t,n){return e.TransformToRef(t,n,new e)},e.TransformToRef=function(e,t,n){var r=t.m,i=e.x*r[0]+e.y*r[4]+r[12],o=e.x*r[1]+e.y*r[5]+r[13];return n.x=i,n.y=o,n},e.PointInTriangle=function(e,t,n,r){var i=.5*(-n.y*r.x+t.y*(-n.x+r.x)+t.x*(n.y-r.y)+n.x*r.y),o=i<0?-1:1,a=(t.y*r.x-t.x*r.y+(r.y-t.y)*e.x+(t.x-r.x)*e.y)*o,s=(t.x*n.y-t.y*n.x+(t.y-n.y)*e.x+(n.x-t.x)*e.y)*o;return a>0&&s>0&&a+s<2*i*o},e.Distance=function(t,n){return Math.sqrt(e.DistanceSquared(t,n))},e.DistanceSquared=function(e,t){var n=e.x-t.x,r=e.y-t.y;return n*n+r*r},e.Center=function(t,n){return e.CenterToRef(t,n,new e)},e.CenterToRef=function(e,t,n){return n.copyFromFloats((e.x+t.x)/2,(e.y+t.y)/2)},e.DistanceOfPointFromSegment=function(t,n,r){var i=e.DistanceSquared(n,r);if(0===i)return e.Distance(t,n);var o=r.subtract(n),a=Math.max(0,Math.min(1,e.Dot(t.subtract(n),o)/i)),s=n.add(o.multiplyByFloats(a,a));return e.Distance(t,s)},e._V8PerformanceHack=new e(.5,.5),e._ZeroReadOnly=e.Zero(),e}();Object.defineProperties(d.prototype,{dimension:{value:[2]},rank:{value:1}});var p=function(){function e(e,t,n){void 0===e&&(e=0),void 0===t&&(t=0),void 0===n&&(n=0),this._isDirty=!0,this._x=e,this._y=t,this._z=n}return Object.defineProperty(e.prototype,"x",{get:function(){return this._x},set:function(e){this._x=e,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y",{get:function(){return this._y},set:function(e){this._y=e,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"z",{get:function(){return this._z},set:function(e){this._z=e,this._isDirty=!0},enumerable:!1,configurable:!0}),e.prototype.toString=function(){return"{X: ".concat(this._x," Y: ").concat(this._y," Z: ").concat(this._z,"}")},e.prototype.getClassName=function(){return"Vector3"},e.prototype.getHashCode=function(){var e=h(this._x);return 397*(e=397*e^h(this._y))^h(this._z)},e.prototype.asArray=function(){return[this._x,this._y,this._z]},e.prototype.toArray=function(e,t){return void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,this},e.prototype.fromArray=function(t,n){return void 0===n&&(n=0),e.FromArrayToRef(t,n,this),this},e.prototype.toQuaternion=function(){return m.RotationYawPitchRoll(this._y,this._x,this._z)},e.prototype.addInPlace=function(e){return this._x+=e._x,this._y+=e._y,this._z+=e._z,this._isDirty=!0,this},e.prototype.addInPlaceFromFloats=function(e,t,n){return this._x+=e,this._y+=t,this._z+=n,this._isDirty=!0,this},e.prototype.add=function(t){return new e(this._x+t._x,this._y+t._y,this._z+t._z)},e.prototype.addToRef=function(e,t){return t._x=this._x+e._x,t._y=this._y+e._y,t._z=this._z+e._z,t._isDirty=!0,t},e.prototype.subtractInPlace=function(e){return this._x-=e._x,this._y-=e._y,this._z-=e._z,this._isDirty=!0,this},e.prototype.subtract=function(t){return new e(this._x-t._x,this._y-t._y,this._z-t._z)},e.prototype.subtractToRef=function(e,t){return this.subtractFromFloatsToRef(e._x,e._y,e._z,t)},e.prototype.subtractFromFloats=function(t,n,r){return new e(this._x-t,this._y-n,this._z-r)},e.prototype.subtractFromFloatsToRef=function(e,t,n,r){return r._x=this._x-e,r._y=this._y-t,r._z=this._z-n,r._isDirty=!0,r},e.prototype.negate=function(){return new e(-this._x,-this._y,-this._z)},e.prototype.negateInPlace=function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._isDirty=!0,this},e.prototype.negateToRef=function(e){return e._x=-1*this._x,e._y=-1*this._y,e._z=-1*this._z,e._isDirty=!0,e},e.prototype.scaleInPlace=function(e){return this._x*=e,this._y*=e,this._z*=e,this._isDirty=!0,this},e.prototype.scale=function(t){return new e(this._x*t,this._y*t,this._z*t)},e.prototype.scaleToRef=function(e,t){return t._x=this._x*e,t._y=this._y*e,t._z=this._z*e,t._isDirty=!0,t},e.prototype.getNormalToRef=function(e){var t=this.length(),n=Math.acos(this._y/t),r=Math.atan2(this._z,this._x);n>Math.PI/2?n-=Math.PI/2:n+=Math.PI/2;var i=t*Math.sin(n)*Math.cos(r),o=t*Math.cos(n),a=t*Math.sin(n)*Math.sin(r);return e.set(i,o,a),e},e.prototype.applyRotationQuaternionToRef=function(e,t){var n=this._x,r=this._y,i=this._z,o=e._x,a=e._y,s=e._z,l=e._w,c=2*(a*i-s*r),u=2*(s*n-o*i),h=2*(o*r-a*n);return t._x=n+l*c+a*h-s*u,t._y=r+l*u+s*c-o*h,t._z=i+l*h+o*u-a*c,t._isDirty=!0,t},e.prototype.applyRotationQuaternionInPlace=function(e){return this.applyRotationQuaternionToRef(e,this)},e.prototype.applyRotationQuaternion=function(t){return this.applyRotationQuaternionToRef(t,new e)},e.prototype.scaleAndAddToRef=function(e,t){return t._x+=this._x*e,t._y+=this._y*e,t._z+=this._z*e,t._isDirty=!0,t},e.prototype.projectOnPlane=function(t,n){return this.projectOnPlaneToRef(t,n,new e)},e.prototype.projectOnPlaneToRef=function(t,n,r){var i=t.normal,o=t.d,a=g.Vector3[0];this.subtractToRef(n,a),a.normalize();var s=e.Dot(a,i);if(Math.abs(s)<1e-10)r.setAll(1/0);else{var l=-(e.Dot(n,i)+o)/s,c=a.scaleInPlace(l);n.addToRef(c,r)}return r},e.prototype.equals=function(e){return e&&this._x===e._x&&this._y===e._y&&this._z===e._z},e.prototype.equalsWithEpsilon=function(e,t){return void 0===t&&(t=i.bH),e&&(0,c.WithinEpsilon)(this._x,e._x,t)&&(0,c.WithinEpsilon)(this._y,e._y,t)&&(0,c.WithinEpsilon)(this._z,e._z,t)},e.prototype.equalsToFloats=function(e,t,n){return this._x===e&&this._y===t&&this._z===n},e.prototype.multiplyInPlace=function(e){return this._x*=e._x,this._y*=e._y,this._z*=e._z,this._isDirty=!0,this},e.prototype.multiply=function(e){return this.multiplyByFloats(e._x,e._y,e._z)},e.prototype.multiplyToRef=function(e,t){return t._x=this._x*e._x,t._y=this._y*e._y,t._z=this._z*e._z,t._isDirty=!0,t},e.prototype.multiplyByFloats=function(t,n,r){return new e(this._x*t,this._y*n,this._z*r)},e.prototype.divide=function(t){return new e(this._x/t._x,this._y/t._y,this._z/t._z)},e.prototype.divideToRef=function(e,t){return t._x=this._x/e._x,t._y=this._y/e._y,t._z=this._z/e._z,t._isDirty=!0,t},e.prototype.divideInPlace=function(e){return this._x=this._x/e._x,this._y=this._y/e._y,this._z=this._z/e._z,this._isDirty=!0,this},e.prototype.minimizeInPlace=function(e){return this.minimizeInPlaceFromFloats(e._x,e._y,e._z)},e.prototype.maximizeInPlace=function(e){return this.maximizeInPlaceFromFloats(e._x,e._y,e._z)},e.prototype.minimizeInPlaceFromFloats=function(e,t,n){return ethis._x&&(this.x=e),t>this._y&&(this.y=t),n>this._z&&(this.z=n),this},e.prototype.isNonUniformWithinEpsilon=function(e){var t=Math.abs(this._x),n=Math.abs(this._y);if(!(0,c.WithinEpsilon)(t,n,e))return!0;var r=Math.abs(this._z);return!(0,c.WithinEpsilon)(t,r,e)||!(0,c.WithinEpsilon)(n,r,e)},Object.defineProperty(e.prototype,"isNonUniform",{get:function(){var e=Math.abs(this._x);return e!==Math.abs(this._y)||e!==Math.abs(this._z)},enumerable:!1,configurable:!0}),e.prototype.floorToRef=function(e){return e._x=Math.floor(this._x),e._y=Math.floor(this._y),e._z=Math.floor(this._z),e._isDirty=!0,e},e.prototype.floor=function(){return new e(Math.floor(this._x),Math.floor(this._y),Math.floor(this._z))},e.prototype.fractToRef=function(e){return e._x=this._x-Math.floor(this._x),e._y=this._y-Math.floor(this._y),e._z=this._z-Math.floor(this._z),e._isDirty=!0,e},e.prototype.fract=function(){return new e(this._x-Math.floor(this._x),this._y-Math.floor(this._y),this._z-Math.floor(this._z))},e.prototype.length=function(){return Math.sqrt(this.lengthSquared())},e.prototype.lengthSquared=function(){return this._x*this._x+this._y*this._y+this._z*this._z},Object.defineProperty(e.prototype,"hasAZeroComponent",{get:function(){return this._x*this._y*this._z===0},enumerable:!1,configurable:!0}),e.prototype.normalize=function(){return this.normalizeFromLength(this.length())},e.prototype.reorderInPlace=function(e){if("xyz"===(e=e.toLowerCase()))return this;var t=g.Vector3[0].copyFrom(this);return this.x=t[e[0]],this.y=t[e[1]],this.z=t[e[2]],this},e.prototype.rotateByQuaternionToRef=function(t,n){return t.toRotationMatrix(g.Matrix[0]),e.TransformCoordinatesToRef(this,g.Matrix[0],n),n},e.prototype.rotateByQuaternionAroundPointToRef=function(e,t,n){return this.subtractToRef(t,g.Vector3[0]),g.Vector3[0].rotateByQuaternionToRef(e,g.Vector3[0]),t.addToRef(g.Vector3[0],n),n},e.prototype.cross=function(t){return e.CrossToRef(this,t,new e)},e.prototype.normalizeFromLength=function(e){return 0===e||1===e?this:this.scaleInPlace(1/e)},e.prototype.normalizeToNew=function(){return this.normalizeToRef(new e)},e.prototype.normalizeToRef=function(e){var t=this.length();return 0===t||1===t?(e._x=this._x,e._y=this._y,e._z=this._z,e._isDirty=!0,e):this.scaleToRef(1/t,e)},e.prototype.clone=function(){return new e(this._x,this._y,this._z)},e.prototype.copyFrom=function(e){return this.copyFromFloats(e._x,e._y,e._z)},e.prototype.copyFromFloats=function(e,t,n){return this._x=e,this._y=t,this._z=n,this._isDirty=!0,this},e.prototype.set=function(e,t,n){return this.copyFromFloats(e,t,n)},e.prototype.setAll=function(e){return this._x=this._y=this._z=e,this._isDirty=!0,this},e.GetClipFactor=function(t,n,r,i){var o=e.Dot(t,r);return(o-i)/(o-e.Dot(n,r))},e.GetAngleBetweenVectors=function(t,n,r){var i=t.normalizeToRef(g.Vector3[1]),o=n.normalizeToRef(g.Vector3[2]),a=e.Dot(i,o);a=(0,c.Clamp)(a,-1,1);var s=Math.acos(a),l=g.Vector3[3];return e.CrossToRef(i,o,l),e.Dot(l,r)>0?isNaN(s)?0:s:isNaN(s)?-Math.PI:-Math.acos(a)},e.GetAngleBetweenVectorsOnPlane=function(t,n,r){g.Vector3[0].copyFrom(t);var i=g.Vector3[0];g.Vector3[1].copyFrom(n);var o=g.Vector3[1];g.Vector3[2].copyFrom(r);var a=g.Vector3[2],s=g.Vector3[3],l=g.Vector3[4];i.normalize(),o.normalize(),a.normalize(),e.CrossToRef(a,i,s),e.CrossToRef(s,a,l);var u=Math.atan2(e.Dot(o,s),e.Dot(o,l));return(0,c.NormalizeRadians)(u)},e.PitchYawRollToMoveBetweenPointsToRef=function(e,t,n){var r=v.Vector3[0];return t.subtractToRef(e,r),n._y=Math.atan2(r.x,r.z)||0,n._x=Math.atan2(Math.sqrt(Math.pow(r.x,2)+Math.pow(r.z,2)),r.y)||0,n._z=0,n._isDirty=!0,n},e.PitchYawRollToMoveBetweenPoints=function(t,n){var r=e.Zero();return e.PitchYawRollToMoveBetweenPointsToRef(t,n,r)},e.SlerpToRef=function(t,n,r,o){r=(0,c.Clamp)(r,0,1);var a=g.Vector3[0],s=g.Vector3[1];a.copyFrom(t);var l=a.length();a.normalizeFromLength(l),s.copyFrom(n);var u=s.length();s.normalizeFromLength(u);var h,d,p=e.Dot(a,s);if(p<1-i.bH){var f=Math.acos(p),m=1/Math.sin(f);h=Math.sin((1-r)*f)*m,d=Math.sin(r*f)*m}else h=1-r,d=r;return a.scaleInPlace(h),s.scaleInPlace(d),o.copyFrom(a).addInPlace(s),o.scaleInPlace((0,c.Lerp)(l,u,r)),o},e.SmoothToRef=function(t,n,r,i,o){return e.SlerpToRef(t,n,0===i?1:r/i,o),o},e.FromArray=function(t,n){return void 0===n&&(n=0),new e(t[n],t[n+1],t[n+2])},e.FromFloatArray=function(t,n){return e.FromArray(t,n)},e.FromArrayToRef=function(e,t,n){return n._x=e[t],n._y=e[t+1],n._z=e[t+2],n._isDirty=!0,n},e.FromFloatArrayToRef=function(t,n,r){return e.FromArrayToRef(t,n,r)},e.FromFloatsToRef=function(e,t,n,r){return r.copyFromFloats(e,t,n),r},e.Zero=function(){return new e(0,0,0)},e.One=function(){return new e(1,1,1)},e.Up=function(){return new e(0,1,0)},Object.defineProperty(e,"UpReadOnly",{get:function(){return e._UpReadOnly},enumerable:!1,configurable:!0}),Object.defineProperty(e,"DownReadOnly",{get:function(){return e._DownReadOnly},enumerable:!1,configurable:!0}),Object.defineProperty(e,"RightReadOnly",{get:function(){return e._RightReadOnly},enumerable:!1,configurable:!0}),Object.defineProperty(e,"LeftReadOnly",{get:function(){return e._LeftReadOnly},enumerable:!1,configurable:!0}),Object.defineProperty(e,"LeftHandedForwardReadOnly",{get:function(){return e._LeftHandedForwardReadOnly},enumerable:!1,configurable:!0}),Object.defineProperty(e,"RightHandedForwardReadOnly",{get:function(){return e._RightHandedForwardReadOnly},enumerable:!1,configurable:!0}),Object.defineProperty(e,"LeftHandedBackwardReadOnly",{get:function(){return e._LeftHandedBackwardReadOnly},enumerable:!1,configurable:!0}),Object.defineProperty(e,"RightHandedBackwardReadOnly",{get:function(){return e._RightHandedBackwardReadOnly},enumerable:!1,configurable:!0}),Object.defineProperty(e,"ZeroReadOnly",{get:function(){return e._ZeroReadOnly},enumerable:!1,configurable:!0}),Object.defineProperty(e,"OneReadOnly",{get:function(){return e._OneReadOnly},enumerable:!1,configurable:!0}),e.Down=function(){return new e(0,-1,0)},e.Forward=function(t){return void 0===t&&(t=!1),new e(0,0,t?-1:1)},e.Backward=function(t){return void 0===t&&(t=!1),new e(0,0,t?1:-1)},e.Right=function(){return new e(1,0,0)},e.Left=function(){return new e(-1,0,0)},e.Random=function(t,n){return void 0===t&&(t=0),void 0===n&&(n=1),new e((0,c.RandomRange)(t,n),(0,c.RandomRange)(t,n),(0,c.RandomRange)(t,n))},e.RandomToRef=function(e,t,n){return void 0===e&&(e=0),void 0===t&&(t=1),n.copyFromFloats((0,c.RandomRange)(e,t),(0,c.RandomRange)(e,t),(0,c.RandomRange)(e,t))},e.TransformCoordinates=function(t,n){var r=e.Zero();return e.TransformCoordinatesToRef(t,n,r),r},e.TransformCoordinatesToRef=function(t,n,r){return e.TransformCoordinatesFromFloatsToRef(t._x,t._y,t._z,n,r),r},e.TransformCoordinatesFromFloatsToRef=function(e,t,n,r,i){var o=r.m,a=e*o[0]+t*o[4]+n*o[8]+o[12],s=e*o[1]+t*o[5]+n*o[9]+o[13],l=e*o[2]+t*o[6]+n*o[10]+o[14],c=1/(e*o[3]+t*o[7]+n*o[11]+o[15]);return i._x=a*c,i._y=s*c,i._z=l*c,i._isDirty=!0,i},e.TransformNormal=function(t,n){var r=e.Zero();return e.TransformNormalToRef(t,n,r),r},e.TransformNormalToRef=function(e,t,n){return this.TransformNormalFromFloatsToRef(e._x,e._y,e._z,t,n),n},e.TransformNormalFromFloatsToRef=function(e,t,n,r,i){var o=r.m;return i._x=e*o[0]+t*o[4]+n*o[8],i._y=e*o[1]+t*o[5]+n*o[9],i._z=e*o[2]+t*o[6]+n*o[10],i._isDirty=!0,i},e.CatmullRom=function(t,n,r,i,o){var a=o*o,s=o*a;return new e(.5*(2*n._x+(-t._x+r._x)*o+(2*t._x-5*n._x+4*r._x-i._x)*a+(-t._x+3*n._x-3*r._x+i._x)*s),.5*(2*n._y+(-t._y+r._y)*o+(2*t._y-5*n._y+4*r._y-i._y)*a+(-t._y+3*n._y-3*r._y+i._y)*s),.5*(2*n._z+(-t._z+r._z)*o+(2*t._z-5*n._z+4*r._z-i._z)*a+(-t._z+3*n._z-3*r._z+i._z)*s))},e.Clamp=function(t,n,r){var i=new e;return e.ClampToRef(t,n,r,i),i},e.ClampToRef=function(e,t,n,r){var i=e._x;i=(i=i>n._x?n._x:i)n._y?n._y:o)n._z?n._z:a)0&&A<0?(D.copyFrom(s),I=n,O=r):A>0&&M<0?(D.copyFrom(u),I=r,O=o):(D.copyFrom(l).scaleInPlace(-1),I=o,O=n);var N=g.Vector3[9],F=g.Vector3[4];if(I.subtractToRef(S,P),O.subtractToRef(S,N),e.CrossToRef(P,N,F),!(e.Dot(F,h)<0))return a.copyFrom(S),Math.abs(v*y);var L=g.Vector3[5];e.CrossToRef(D,F,L),L.normalize();var w=g.Vector3[9];w.copyFrom(I).subtractInPlace(S);var B=w.length();if(Bthis._x&&(this.x=e.x),e.y>this._y&&(this.y=e.y),e.z>this._z&&(this.z=e.z),e.w>this._w&&(this.w=e.w),this},e.prototype.minimizeInPlaceFromFloats=function(e,t,n,r){return this.x=Math.min(e,this._x),this.y=Math.min(t,this._y),this.z=Math.min(n,this._z),this.w=Math.min(r,this._w),this},e.prototype.maximizeInPlaceFromFloats=function(e,t,n,r){return this.x=Math.max(e,this._x),this.y=Math.max(t,this._y),this.z=Math.max(n,this._z),this.w=Math.max(r,this._w),this},e.prototype.floorToRef=function(e){return e.x=Math.floor(this._x),e.y=Math.floor(this._y),e.z=Math.floor(this._z),e.w=Math.floor(this._w),e},e.prototype.floor=function(){return new e(Math.floor(this._x),Math.floor(this._y),Math.floor(this._z),Math.floor(this._w))},e.prototype.fractToRef=function(e){return e.x=this._x-Math.floor(this._x),e.y=this._y-Math.floor(this._y),e.z=this._z-Math.floor(this._z),e.w=this._w-Math.floor(this._w),e},e.prototype.fract=function(){return new e(this._x-Math.floor(this._x),this._y-Math.floor(this._y),this._z-Math.floor(this._z),this._w-Math.floor(this._w))},e.prototype.length=function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},e.prototype.lengthSquared=function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},e.prototype.normalize=function(){return this.normalizeFromLength(this.length())},e.prototype.normalizeFromLength=function(e){return 0===e||1===e?this:this.scaleInPlace(1/e)},e.prototype.normalizeToNew=function(){return this.normalizeToRef(new e)},e.prototype.normalizeToRef=function(e){var t=this.length();return 0===t||1===t?(e.x=this._x,e.y=this._y,e.z=this._z,e.w=this._w,e):this.scaleToRef(1/t,e)},e.prototype.toVector3=function(){return new p(this._x,this._y,this._z)},e.prototype.clone=function(){return new e(this._x,this._y,this._z,this._w)},e.prototype.copyFrom=function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this},e.prototype.copyFromFloats=function(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this},e.prototype.set=function(e,t,n,r){return this.copyFromFloats(e,t,n,r)},e.prototype.setAll=function(e){return this.x=this.y=this.z=this.w=e,this},e.prototype.dot=function(e){return this._x*e.x+this._y*e.y+this._z*e.z+this._w*e.w},e.FromArray=function(t,n){return n||(n=0),new e(t[n],t[n+1],t[n+2],t[n+3])},e.FromArrayToRef=function(e,t,n){return n.x=e[t],n.y=e[t+1],n.z=e[t+2],n.w=e[t+3],n},e.FromFloatArrayToRef=function(t,n,r){return e.FromArrayToRef(t,n,r),r},e.FromFloatsToRef=function(e,t,n,r,i){return i.x=e,i.y=t,i.z=n,i.w=r,i},e.Zero=function(){return new e(0,0,0,0)},e.One=function(){return new e(1,1,1,1)},e.Random=function(t,n){return void 0===t&&(t=0),void 0===n&&(n=1),new e((0,c.RandomRange)(t,n),(0,c.RandomRange)(t,n),(0,c.RandomRange)(t,n),(0,c.RandomRange)(t,n))},e.RandomToRef=function(e,t,n){return void 0===e&&(e=0),void 0===t&&(t=1),n.x=(0,c.RandomRange)(e,t),n.y=(0,c.RandomRange)(e,t),n.z=(0,c.RandomRange)(e,t),n.w=(0,c.RandomRange)(e,t),n},e.Clamp=function(t,n,r){return e.ClampToRef(t,n,r,new e)},e.ClampToRef=function(e,t,n,r){return r.x=(0,c.Clamp)(e.x,t.x,n.x),r.y=(0,c.Clamp)(e.y,t.y,n.y),r.z=(0,c.Clamp)(e.z,t.z,n.z),r.w=(0,c.Clamp)(e.w,t.w,n.w),r},e.CheckExtends=function(e,t,n){t.minimizeInPlace(e),n.maximizeInPlace(e)},Object.defineProperty(e,"ZeroReadOnly",{get:function(){return e._ZeroReadOnly},enumerable:!1,configurable:!0}),e.Normalize=function(t){return e.NormalizeToRef(t,new e)},e.NormalizeToRef=function(e,t){return e.normalizeToRef(t),t},e.Minimize=function(t,n){var r=new e;return r.copyFrom(t),r.minimizeInPlace(n),r},e.Maximize=function(t,n){var r=new e;return r.copyFrom(t),r.maximizeInPlace(n),r},e.Distance=function(t,n){return Math.sqrt(e.DistanceSquared(t,n))},e.DistanceSquared=function(e,t){var n=e.x-t.x,r=e.y-t.y,i=e.z-t.z,o=e.w-t.w;return n*n+r*r+i*i+o*o},e.Center=function(t,n){return e.CenterToRef(t,n,new e)},e.CenterToRef=function(e,t,n){return n.x=(e.x+t.x)/2,n.y=(e.y+t.y)/2,n.z=(e.z+t.z)/2,n.w=(e.w+t.w)/2,n},e.TransformCoordinates=function(t,n){return e.TransformCoordinatesToRef(t,n,new e)},e.TransformCoordinatesToRef=function(t,n,r){return e.TransformCoordinatesFromFloatsToRef(t._x,t._y,t._z,n,r),r},e.TransformCoordinatesFromFloatsToRef=function(e,t,n,r,i){var o=r.m,a=e*o[0]+t*o[4]+n*o[8]+o[12],s=e*o[1]+t*o[5]+n*o[9]+o[13],l=e*o[2]+t*o[6]+n*o[10]+o[14],c=e*o[3]+t*o[7]+n*o[11]+o[15];return i.x=a,i.y=s,i.z=l,i.w=c,i},e.TransformNormal=function(t,n){return e.TransformNormalToRef(t,n,new e)},e.TransformNormalToRef=function(e,t,n){var r=t.m,i=e.x*r[0]+e.y*r[4]+e.z*r[8],o=e.x*r[1]+e.y*r[5]+e.z*r[9],a=e.x*r[2]+e.y*r[6]+e.z*r[10];return n.x=i,n.y=o,n.z=a,n.w=e.w,n},e.TransformNormalFromFloatsToRef=function(e,t,n,r,i,o){var a=i.m;return o.x=e*a[0]+t*a[4]+n*a[8],o.y=e*a[1]+t*a[5]+n*a[9],o.z=e*a[2]+t*a[6]+n*a[10],o.w=r,o},e.FromVector3=function(t,n){return void 0===n&&(n=0),new e(t._x,t._y,t._z,n)},e.Dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},e._V8PerformanceHack=new e(.5,.5,.5,.5),e._ZeroReadOnly=e.Zero(),e}();Object.defineProperties(f.prototype,{dimension:{value:[4]},rank:{value:1}});var m=function(){function e(e,t,n,r){void 0===e&&(e=0),void 0===t&&(t=0),void 0===n&&(n=0),void 0===r&&(r=1),this._isDirty=!0,this._x=e,this._y=t,this._z=n,this._w=r}return Object.defineProperty(e.prototype,"x",{get:function(){return this._x},set:function(e){this._x=e,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y",{get:function(){return this._y},set:function(e){this._y=e,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"z",{get:function(){return this._z},set:function(e){this._z=e,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"w",{get:function(){return this._w},set:function(e){this._w=e,this._isDirty=!0},enumerable:!1,configurable:!0}),e.prototype.toString=function(){return"{X: ".concat(this._x," Y: ").concat(this._y," Z: ").concat(this._z," W: ").concat(this._w,"}")},e.prototype.getClassName=function(){return"Quaternion"},e.prototype.getHashCode=function(){var e=h(this._x);return 397*(e=397*(e=397*e^h(this._y))^h(this._z))^h(this._w)},e.prototype.asArray=function(){return[this._x,this._y,this._z,this._w]},e.prototype.toArray=function(e,t){return void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,this},e.prototype.fromArray=function(t,n){return void 0===n&&(n=0),e.FromArrayToRef(t,n,this)},e.prototype.equals=function(e){return e&&this._x===e._x&&this._y===e._y&&this._z===e._z&&this._w===e._w},e.prototype.equalsWithEpsilon=function(e,t){return void 0===t&&(t=i.bH),e&&(0,c.WithinEpsilon)(this._x,e._x,t)&&(0,c.WithinEpsilon)(this._y,e._y,t)&&(0,c.WithinEpsilon)(this._z,e._z,t)&&(0,c.WithinEpsilon)(this._w,e._w,t)},e.prototype.isApprox=function(e,t){return void 0===t&&(t=i.bH),e&&((0,c.WithinEpsilon)(this._x,e._x,t)&&(0,c.WithinEpsilon)(this._y,e._y,t)&&(0,c.WithinEpsilon)(this._z,e._z,t)&&(0,c.WithinEpsilon)(this._w,e._w,t)||(0,c.WithinEpsilon)(this._x,-e._x,t)&&(0,c.WithinEpsilon)(this._y,-e._y,t)&&(0,c.WithinEpsilon)(this._z,-e._z,t)&&(0,c.WithinEpsilon)(this._w,-e._w,t))},e.prototype.clone=function(){return new e(this._x,this._y,this._z,this._w)},e.prototype.copyFrom=function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._w=e._w,this._isDirty=!0,this},e.prototype.copyFromFloats=function(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._isDirty=!0,this},e.prototype.set=function(e,t,n,r){return this.copyFromFloats(e,t,n,r)},e.prototype.setAll=function(e){return this.copyFromFloats(e,e,e,e)},e.prototype.add=function(t){return new e(this._x+t._x,this._y+t._y,this._z+t._z,this._w+t._w)},e.prototype.addInPlace=function(e){return this._x+=e._x,this._y+=e._y,this._z+=e._z,this._w+=e._w,this._isDirty=!0,this},e.prototype.addToRef=function(e,t){return t._x=this._x+e._x,t._y=this._y+e._y,t._z=this._z+e._z,t._w=this._w+e._w,t._isDirty=!0,t},e.prototype.addInPlaceFromFloats=function(e,t,n,r){return this._x+=e,this._y+=t,this._z+=n,this._w+=r,this._isDirty=!0,this},e.prototype.subtractToRef=function(e,t){return t._x=this._x-e._x,t._y=this._y-e._y,t._z=this._z-e._z,t._w=this._w-e._w,t._isDirty=!0,t},e.prototype.subtractFromFloats=function(t,n,r,i){return this.subtractFromFloatsToRef(t,n,r,i,new e)},e.prototype.subtractFromFloatsToRef=function(e,t,n,r,i){return i._x=this._x-e,i._y=this._y-t,i._z=this._z-n,i._w=this._w-r,i._isDirty=!0,i},e.prototype.subtract=function(t){return new e(this._x-t._x,this._y-t._y,this._z-t._z,this._w-t._w)},e.prototype.subtractInPlace=function(e){return this._x-=e._x,this._y-=e._y,this._z-=e._z,this._w-=e._w,this._isDirty=!0,this},e.prototype.scale=function(t){return new e(this._x*t,this._y*t,this._z*t,this._w*t)},e.prototype.scaleToRef=function(e,t){return t._x=this._x*e,t._y=this._y*e,t._z=this._z*e,t._w=this._w*e,t._isDirty=!0,t},e.prototype.scaleInPlace=function(e){return this._x*=e,this._y*=e,this._z*=e,this._w*=e,this._isDirty=!0,this},e.prototype.scaleAndAddToRef=function(e,t){return t._x+=this._x*e,t._y+=this._y*e,t._z+=this._z*e,t._w+=this._w*e,t._isDirty=!0,t},e.prototype.multiply=function(t){var n=new e(0,0,0,1);return this.multiplyToRef(t,n),n},e.prototype.multiplyToRef=function(e,t){var n=this._x*e._w+this._y*e._z-this._z*e._y+this._w*e._x,r=-this._x*e._z+this._y*e._w+this._z*e._x+this._w*e._y,i=this._x*e._y-this._y*e._x+this._z*e._w+this._w*e._z,o=-this._x*e._x-this._y*e._y-this._z*e._z+this._w*e._w;return t.copyFromFloats(n,r,i,o),t},e.prototype.multiplyInPlace=function(e){return this.multiplyToRef(e,this)},e.prototype.multiplyByFloats=function(e,t,n,r){return this._x*=e,this._y*=t,this._z*=n,this._w*=r,this._isDirty=!0,this},e.prototype.divide=function(e){throw new ReferenceError("Can not divide a quaternion")},e.prototype.divideToRef=function(e,t){throw new ReferenceError("Can not divide a quaternion")},e.prototype.divideInPlace=function(e){throw new ReferenceError("Can not divide a quaternion")},e.prototype.minimizeInPlace=function(){throw new ReferenceError("Can not minimize a quaternion")},e.prototype.minimizeInPlaceFromFloats=function(){throw new ReferenceError("Can not minimize a quaternion")},e.prototype.maximizeInPlace=function(){throw new ReferenceError("Can not maximize a quaternion")},e.prototype.maximizeInPlaceFromFloats=function(){throw new ReferenceError("Can not maximize a quaternion")},e.prototype.negate=function(){return this.negateToRef(new e)},e.prototype.negateInPlace=function(){return this._x=-this._x,this._y=-this._y,this._z=-this._z,this._w=-this._w,this._isDirty=!0,this},e.prototype.negateToRef=function(e){return e._x=-this._x,e._y=-this._y,e._z=-this._z,e._w=-this._w,e._isDirty=!0,e},e.prototype.equalsToFloats=function(e,t,n,r){return this._x===e&&this._y===t&&this._z===n&&this._w===r},e.prototype.floorToRef=function(e){throw new ReferenceError("Can not floor a quaternion")},e.prototype.floor=function(){throw new ReferenceError("Can not floor a quaternion")},e.prototype.fractToRef=function(e){throw new ReferenceError("Can not fract a quaternion")},e.prototype.fract=function(){throw new ReferenceError("Can not fract a quaternion")},e.prototype.conjugateToRef=function(e){return e.copyFromFloats(-this._x,-this._y,-this._z,this._w),e},e.prototype.conjugateInPlace=function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._isDirty=!0,this},e.prototype.conjugate=function(){return new e(-this._x,-this._y,-this._z,this._w)},e.prototype.invert=function(){var e=this.conjugate(),t=this.lengthSquared();return 0==t||1==t||e.scaleInPlace(1/t),e},e.prototype.invertInPlace=function(){this.conjugateInPlace();var e=this.lengthSquared();return 0==e||1==e||this.scaleInPlace(1/e),this},e.prototype.lengthSquared=function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},e.prototype.length=function(){return Math.sqrt(this.lengthSquared())},e.prototype.normalize=function(){return this.normalizeFromLength(this.length())},e.prototype.normalizeFromLength=function(e){return 0===e||1===e?this:this.scaleInPlace(1/e)},e.prototype.normalizeToNew=function(){var t=new e(0,0,0,1);return this.normalizeToRef(t),t},e.prototype.normalizeToRef=function(e){var t=this.length();return 0===t||1===t?e.copyFromFloats(this._x,this._y,this._z,this._w):this.scaleToRef(1/t,e)},e.prototype.toEulerAngles=function(){var e=p.Zero();return this.toEulerAnglesToRef(e),e},e.prototype.toEulerAnglesToRef=function(e){var t=this._z,n=this._x,r=this._y,i=this._w,o=r*t-n*i,a=.4999999;if(o<-a)e._y=2*Math.atan2(r,i),e._x=Math.PI/2,e._z=0,e._isDirty=!0;else if(o>a)e._y=2*Math.atan2(r,i),e._x=-Math.PI/2,e._z=0,e._isDirty=!0;else{var s=i*i,l=t*t,c=n*n,u=r*r;e._z=Math.atan2(2*(n*r+t*i),-l-c+u+s),e._x=Math.asin(-2*o),e._y=Math.atan2(2*(t*n+r*i),l-c-u+s),e._isDirty=!0}return e},e.prototype.toAlphaBetaGammaToRef=function(e){var t=this._z,n=this._x,r=this._y,i=this._w,o=Math.sqrt(n*n+r*r),a=Math.sqrt(t*t+i*i),s=2*Math.atan2(o,a),l=2*Math.atan2(t,i),c=2*Math.atan2(r,n),u=(l+c)/2,h=(l-c)/2;return e.set(h,s,u),e},e.prototype.toRotationMatrix=function(e){return _.FromQuaternionToRef(this,e),e},e.prototype.fromRotationMatrix=function(t){return e.FromRotationMatrixToRef(t,this),this},e.prototype.dot=function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},e.prototype.toAxisAngle=function(){var e=p.Zero();return{axis:e,angle:this.toAxisAngleToRef(e)}},e.prototype.toAxisAngleToRef=function(e){var t=0,n=Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z),r=this._w;return n>0?(t=2*Math.atan2(n,r),e.set(this._x/n,this._y/n,this._z/n)):(t=0,e.set(1,0,0)),t},e.FromRotationMatrix=function(t){var n=new e;return e.FromRotationMatrixToRef(t,n),n},e.FromRotationMatrixToRef=function(e,t){var n,r=e.m,i=r[0],o=r[4],a=r[8],s=r[1],l=r[5],c=r[9],u=r[2],h=r[6],d=r[10],p=i+l+d;return p>0?(n=.5/Math.sqrt(p+1),t._w=.25/n,t._x=(h-c)*n,t._y=(a-u)*n,t._z=(s-o)*n,t._isDirty=!0):i>l&&i>d?(n=2*Math.sqrt(1+i-l-d),t._w=(h-c)/n,t._x=.25*n,t._y=(o+s)/n,t._z=(a+u)/n,t._isDirty=!0):l>d?(n=2*Math.sqrt(1+l-i-d),t._w=(a-u)/n,t._x=(o+s)/n,t._y=.25*n,t._z=(c+h)/n,t._isDirty=!0):(n=2*Math.sqrt(1+d-i-l),t._w=(s-o)/n,t._x=(a+u)/n,t._y=(c+h)/n,t._z=.25*n,t._isDirty=!0),t},e.Dot=function(e,t){return e._x*t._x+e._y*t._y+e._z*t._z+e._w*t._w},e.AreClose=function(t,n,r){void 0===r&&(r=.1);var i=e.Dot(t,n);return 1-i*i<=r},e.SmoothToRef=function(t,n,r,i,o){var a=0===i?1:r/i;return a=(0,c.Clamp)(a,0,1),e.SlerpToRef(t,n,a,o),o},e.Zero=function(){return new e(0,0,0,0)},e.Inverse=function(t){return new e(-t._x,-t._y,-t._z,t._w)},e.InverseToRef=function(e,t){return t.set(-e._x,-e._y,-e._z,e._w),t},e.Identity=function(){return new e(0,0,0,1)},e.IsIdentity=function(e){return e&&0===e._x&&0===e._y&&0===e._z&&1===e._w},e.RotationAxis=function(t,n){return e.RotationAxisToRef(t,n,new e)},e.RotationAxisToRef=function(e,t,n){n._w=Math.cos(t/2);var r=Math.sin(t/2)/e.length();return n._x=e._x*r,n._y=e._y*r,n._z=e._z*r,n._isDirty=!0,n},e.FromArray=function(t,n){return n||(n=0),new e(t[n],t[n+1],t[n+2],t[n+3])},e.FromArrayToRef=function(e,t,n){return n._x=e[t],n._y=e[t+1],n._z=e[t+2],n._w=e[t+3],n._isDirty=!0,n},e.FromFloatsToRef=function(e,t,n,r,i){return i.copyFromFloats(e,t,n,r),i},e.FromEulerAngles=function(t,n,r){var i=new e;return e.RotationYawPitchRollToRef(n,t,r,i),i},e.FromEulerAnglesToRef=function(t,n,r,i){return e.RotationYawPitchRollToRef(n,t,r,i),i},e.FromEulerVector=function(t){var n=new e;return e.RotationYawPitchRollToRef(t._y,t._x,t._z,n),n},e.FromEulerVectorToRef=function(t,n){return e.RotationYawPitchRollToRef(t._y,t._x,t._z,n),n},e.FromUnitVectorsToRef=function(e,t,n,r){void 0===r&&(r=i.bH);var o=p.Dot(e,t)+1;return oMath.abs(e.z)?n.set(-e.y,e.x,0,0):n.set(0,-e.z,e.y,0):(p.CrossToRef(e,t,v.Vector3[0]),n.set(v.Vector3[0].x,v.Vector3[0].y,v.Vector3[0].z,o)),n.normalize()},e.RotationYawPitchRoll=function(t,n,r){var i=new e;return e.RotationYawPitchRollToRef(t,n,r,i),i},e.RotationYawPitchRollToRef=function(e,t,n,r){var i=.5*n,o=.5*t,a=.5*e,s=Math.sin(i),l=Math.cos(i),c=Math.sin(o),u=Math.cos(o),h=Math.sin(a),d=Math.cos(a);return r._x=d*c*l+h*u*s,r._y=h*u*l-d*c*s,r._z=d*u*s-h*c*l,r._w=d*u*l+h*c*s,r._isDirty=!0,r},e.RotationAlphaBetaGamma=function(t,n,r){var i=new e;return e.RotationAlphaBetaGammaToRef(t,n,r,i),i},e.RotationAlphaBetaGammaToRef=function(e,t,n,r){var i=.5*(n+e),o=.5*(n-e),a=.5*t;return r._x=Math.cos(o)*Math.sin(a),r._y=Math.sin(o)*Math.sin(a),r._z=Math.sin(i)*Math.cos(a),r._w=Math.cos(i)*Math.cos(a),r._isDirty=!0,r},e.RotationQuaternionFromAxis=function(t,n,r){var i=new e(0,0,0,0);return e.RotationQuaternionFromAxisToRef(t,n,r,i),i},e.RotationQuaternionFromAxisToRef=function(t,n,r,i){var o=g.Matrix[0];return t=t.normalizeToRef(g.Vector3[0]),n=n.normalizeToRef(g.Vector3[1]),r=r.normalizeToRef(g.Vector3[2]),_.FromXYZAxesToRef(t,n,r,o),e.FromRotationMatrixToRef(o,i),i},e.FromLookDirectionLH=function(t,n){var r=new e;return e.FromLookDirectionLHToRef(t,n,r),r},e.FromLookDirectionLHToRef=function(t,n,r){var i=g.Matrix[0];return _.LookDirectionLHToRef(t,n,i),e.FromRotationMatrixToRef(i,r),r},e.FromLookDirectionRH=function(t,n){var r=new e;return e.FromLookDirectionRHToRef(t,n,r),r},e.FromLookDirectionRHToRef=function(t,n,r){var i=g.Matrix[0];return _.LookDirectionRHToRef(t,n,i),e.FromRotationMatrixToRef(i,r)},e.Slerp=function(t,n,r){var i=e.Identity();return e.SlerpToRef(t,n,r,i),i},e.SlerpToRef=function(e,t,n,r){var i,o,a=e._x*t._x+e._y*t._y+e._z*t._z+e._w*t._w,s=!1;if(a<0&&(s=!0,a=-a),a>.999999)o=1-n,i=s?-n:n;else{var l=Math.acos(a),c=1/Math.sin(l);o=Math.sin((1-n)*l)*c,i=s?-Math.sin(n*l)*c:Math.sin(n*l)*c}return r._x=o*e._x+i*t._x,r._y=o*e._y+i*t._y,r._z=o*e._z+i*t._z,r._w=o*e._w+i*t._w,r._isDirty=!0,r},e.Hermite=function(t,n,r,i,o){var a=o*o,s=o*a,l=2*s-3*a+1,c=-2*s+3*a,u=s-2*a+o,h=s-a;return new e(t._x*l+r._x*c+n._x*u+i._x*h,t._y*l+r._y*c+n._y*u+i._y*h,t._z*l+r._z*c+n._z*u+i._z*h,t._w*l+r._w*c+n._w*u+i._w*h)},e.Hermite1stDerivative=function(t,n,r,i,o){var a=new e;return this.Hermite1stDerivativeToRef(t,n,r,i,o,a),a},e.Hermite1stDerivativeToRef=function(e,t,n,r,i,o){var a=i*i;return o._x=6*(a-i)*e._x+(3*a-4*i+1)*t._x+6*(-a+i)*n._x+(3*a-2*i)*r._x,o._y=6*(a-i)*e._y+(3*a-4*i+1)*t._y+6*(-a+i)*n._y+(3*a-2*i)*r._y,o._z=6*(a-i)*e._z+(3*a-4*i+1)*t._z+6*(-a+i)*n._z+(3*a-2*i)*r._z,o._w=6*(a-i)*e._w+(3*a-4*i+1)*t._w+6*(-a+i)*n._w+(3*a-2*i)*r._w,o._isDirty=!0,o},e.Normalize=function(t){var n=e.Zero();return e.NormalizeToRef(t,n),n},e.NormalizeToRef=function(e,t){return e.normalizeToRef(t),t},e.Clamp=function(t,n,r){var i=new e;return e.ClampToRef(t,n,r,i),i},e.ClampToRef=function(e,t,n,r){return r.copyFromFloats((0,c.Clamp)(e.x,t.x,n.x),(0,c.Clamp)(e.y,t.y,n.y),(0,c.Clamp)(e.z,t.z,n.z),(0,c.Clamp)(e.w,t.w,n.w))},e.Random=function(t,n){return void 0===t&&(t=0),void 0===n&&(n=1),new e((0,c.RandomRange)(t,n),(0,c.RandomRange)(t,n),(0,c.RandomRange)(t,n),(0,c.RandomRange)(t,n))},e.RandomToRef=function(e,t,n){return void 0===e&&(e=0),void 0===t&&(t=1),n.copyFromFloats((0,c.RandomRange)(e,t),(0,c.RandomRange)(e,t),(0,c.RandomRange)(e,t),(0,c.RandomRange)(e,t))},e.Minimize=function(){throw new ReferenceError("Quaternion.Minimize does not make sense")},e.Maximize=function(){throw new ReferenceError("Quaternion.Maximize does not make sense")},e.Distance=function(t,n){return Math.sqrt(e.DistanceSquared(t,n))},e.DistanceSquared=function(e,t){var n=e.x-t.x,r=e.y-t.y,i=e.z-t.z,o=e.w-t.w;return n*n+r*r+i*i+o*o},e.Center=function(t,n){return e.CenterToRef(t,n,e.Zero())},e.CenterToRef=function(e,t,n){return n.copyFromFloats((e.x+t.x)/2,(e.y+t.y)/2,(e.z+t.z)/2,(e.w+t.w)/2)},e._V8PerformanceHack=new e(.5,.5,.5,.5),e}();Object.defineProperties(m.prototype,{dimension:{value:[4]},rank:{value:1}});var _=function(){function e(){this._isIdentity=!1,this._isIdentityDirty=!0,this._isIdentity3x2=!0,this._isIdentity3x2Dirty=!0,this.updateFlag=-1,s.I.MatrixTrackPrecisionChange&&s.I.MatrixTrackedMatrices.push(this),this._m=new s.I.MatrixCurrentType(16),this.markAsUpdated()}return Object.defineProperty(e,"Use64Bits",{get:function(){return s.I.MatrixUse64Bits},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"m",{get:function(){return this._m},enumerable:!1,configurable:!0}),e.prototype.markAsUpdated=function(){this.updateFlag=u.jk._UpdateFlagSeed++,this._isIdentity=!1,this._isIdentity3x2=!1,this._isIdentityDirty=!0,this._isIdentity3x2Dirty=!0},e.prototype._updateIdentityStatus=function(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1),void 0===r&&(r=!0),this._isIdentity=e,this._isIdentity3x2=e||n,this._isIdentityDirty=!this._isIdentity&&t,this._isIdentity3x2Dirty=!this._isIdentity3x2&&r},e.prototype.isIdentity=function(){if(this._isIdentityDirty){this._isIdentityDirty=!1;var e=this._m;this._isIdentity=1===e[0]&&0===e[1]&&0===e[2]&&0===e[3]&&0===e[4]&&1===e[5]&&0===e[6]&&0===e[7]&&0===e[8]&&0===e[9]&&1===e[10]&&0===e[11]&&0===e[12]&&0===e[13]&&0===e[14]&&1===e[15]}return this._isIdentity},e.prototype.isIdentityAs3x2=function(){return this._isIdentity3x2Dirty&&(this._isIdentity3x2Dirty=!1,1!==this._m[0]||1!==this._m[5]||1!==this._m[15]||0!==this._m[1]||0!==this._m[2]||0!==this._m[3]||0!==this._m[4]||0!==this._m[6]||0!==this._m[7]||0!==this._m[8]||0!==this._m[9]||0!==this._m[10]||0!==this._m[11]||0!==this._m[12]||0!==this._m[13]||0!==this._m[14]?this._isIdentity3x2=!1:this._isIdentity3x2=!0),this._isIdentity3x2},e.prototype.determinant=function(){if(!0===this._isIdentity)return 1;var e=this._m,t=e[0],n=e[1],r=e[2],i=e[3],o=e[4],a=e[5],s=e[6],l=e[7],c=e[8],u=e[9],h=e[10],d=e[11],p=e[12],f=e[13],m=e[14],_=e[15],g=h*_-m*d,v=u*_-f*d,y=u*m-f*h,b=c*_-p*d,S=c*m-h*p,T=c*f-p*u;return t*+(a*g-s*v+l*y)+n*-(o*g-s*b+l*S)+r*+(o*v-a*b+l*T)+i*-(o*y-a*S+s*T)},e.prototype.toString=function(){return"{".concat(this.m[0],", ").concat(this.m[1],", ").concat(this.m[2],", ").concat(this.m[3],"\n").concat(this.m[4],", ").concat(this.m[5],", ").concat(this.m[6],", ").concat(this.m[7],"\n").concat(this.m[8],", ").concat(this.m[9],", ").concat(this.m[10],", ").concat(this.m[11],"\n").concat(this.m[12],", ").concat(this.m[13],", ").concat(this.m[14],", ").concat(this.m[15],"}")},e.prototype.toArray=function(e,t){if(void 0===e&&(e=null),void 0===t&&(t=0),!e)return this._m;for(var n=this._m,r=0;r<16;r++)e[t+r]=n[r];return this},e.prototype.asArray=function(){return this._m},e.prototype.fromArray=function(t,n){return void 0===n&&(n=0),e.FromArrayToRef(t,n,this)},e.prototype.copyFromFloats=function(){for(var t=[],n=0;n3)return null;var t=4*e;return new f(this._m[t+0],this._m[t+1],this._m[t+2],this._m[t+3])},e.prototype.getRowToRef=function(e,t){if(e>=0&&e<=3){var n=4*e;t.x=this._m[n+0],t.y=this._m[n+1],t.z=this._m[n+2],t.w=this._m[n+3]}return t},e.prototype.setRow=function(e,t){return this.setRowFromFloats(e,t.x,t.y,t.z,t.w)},e.prototype.transpose=function(){var t=new e;return e.TransposeToRef(this,t),t},e.prototype.transposeToRef=function(t){return e.TransposeToRef(this,t),t},e.prototype.setRowFromFloats=function(e,t,n,r,i){if(e<0||e>3)return this;var o=4*e;return this._m[o+0]=t,this._m[o+1]=n,this._m[o+2]=r,this._m[o+3]=i,this.markAsUpdated(),this},e.prototype.scale=function(t){var n=new e;return this.scaleToRef(t,n),n},e.prototype.scaleToRef=function(e,t){for(var n=0;n<16;n++)t._m[n]=this._m[n]*e;return t.markAsUpdated(),t},e.prototype.scaleAndAddToRef=function(e,t){for(var n=0;n<16;n++)t._m[n]+=this._m[n]*e;return t.markAsUpdated(),t},e.prototype.scaleInPlace=function(e){for(var t=this._m,n=0;n<16;n++)t[n]*=e;return this.markAsUpdated(),this},e.prototype.toNormalMatrix=function(t){var n=g.Matrix[0];this.invertToRef(n),n.transposeToRef(t);var r=t._m;return e.FromValuesToRef(r[0],r[1],r[2],0,r[4],r[5],r[6],0,r[8],r[9],r[10],0,0,0,0,1,t),t},e.prototype.getRotationMatrix=function(){var t=new e;return this.getRotationMatrixToRef(t),t},e.prototype.getRotationMatrixToRef=function(t){var n=g.Vector3[0];if(!this.decompose(n))return e.IdentityToRef(t),t;var r=this._m,i=1/n._x,o=1/n._y,a=1/n._z;return e.FromValuesToRef(r[0]*i,r[1]*i,r[2]*i,0,r[4]*o,r[5]*o,r[6]*o,0,r[8]*a,r[9]*a,r[10]*a,0,0,0,0,1,t),t},e.prototype.toggleModelMatrixHandInPlace=function(){var e=this._m;return e[2]*=-1,e[6]*=-1,e[8]*=-1,e[9]*=-1,e[14]*=-1,this.markAsUpdated(),this},e.prototype.toggleProjectionMatrixHandInPlace=function(){var e=this._m;return e[8]*=-1,e[9]*=-1,e[10]*=-1,e[11]*=-1,this.markAsUpdated(),this},e.FromArray=function(t,n){void 0===n&&(n=0);var r=new e;return e.FromArrayToRef(t,n,r),r},e.FromArrayToRef=function(e,t,n){for(var r=0;r<16;r++)n._m[r]=e[r+t];return n.markAsUpdated(),n},e.FromFloat32ArrayToRefScaled=function(e,t,n,r){return r._m[0]=e[0+t]*n,r._m[1]=e[1+t]*n,r._m[2]=e[2+t]*n,r._m[3]=e[3+t]*n,r._m[4]=e[4+t]*n,r._m[5]=e[5+t]*n,r._m[6]=e[6+t]*n,r._m[7]=e[7+t]*n,r._m[8]=e[8+t]*n,r._m[9]=e[9+t]*n,r._m[10]=e[10+t]*n,r._m[11]=e[11+t]*n,r._m[12]=e[12+t]*n,r._m[13]=e[13+t]*n,r._m[14]=e[14+t]*n,r._m[15]=e[15+t]*n,r.markAsUpdated(),r},Object.defineProperty(e,"IdentityReadOnly",{get:function(){return e._IdentityReadOnly},enumerable:!1,configurable:!0}),e.FromValuesToRef=function(e,t,n,r,i,o,a,s,l,c,u,h,d,p,f,m,_){var g=_._m;g[0]=e,g[1]=t,g[2]=n,g[3]=r,g[4]=i,g[5]=o,g[6]=a,g[7]=s,g[8]=l,g[9]=c,g[10]=u,g[11]=h,g[12]=d,g[13]=p,g[14]=f,g[15]=m,_.markAsUpdated()},e.FromValues=function(t,n,r,i,o,a,s,l,c,u,h,d,p,f,m,_){var g=new e,v=g._m;return v[0]=t,v[1]=n,v[2]=r,v[3]=i,v[4]=o,v[5]=a,v[6]=s,v[7]=l,v[8]=c,v[9]=u,v[10]=h,v[11]=d,v[12]=p,v[13]=f,v[14]=m,v[15]=_,g.markAsUpdated(),g},e.Compose=function(t,n,r){var i=new e;return e.ComposeToRef(t,n,r,i),i},e.ComposeToRef=function(e,t,n,r){var i=r._m,o=t._x,a=t._y,s=t._z,l=t._w,c=o+o,u=a+a,h=s+s,d=o*c,p=o*u,f=o*h,m=a*u,_=a*h,g=s*h,v=l*c,y=l*u,b=l*h,S=e._x,T=e._y,E=e._z;return i[0]=(1-(m+g))*S,i[1]=(p+b)*S,i[2]=(f-y)*S,i[3]=0,i[4]=(p-b)*T,i[5]=(1-(d+g))*T,i[6]=(_+v)*T,i[7]=0,i[8]=(f+y)*E,i[9]=(_-v)*E,i[10]=(1-(d+m))*E,i[11]=0,i[12]=n._x,i[13]=n._y,i[14]=n._z,i[15]=1,r.markAsUpdated(),r},e.Identity=function(){var t=e.FromValues(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return t._updateIdentityStatus(!0),t},e.IdentityToRef=function(t){return e.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,t),t._updateIdentityStatus(!0),t},e.Zero=function(){var t=e.FromValues(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);return t._updateIdentityStatus(!1),t},e.RotationX=function(t){var n=new e;return e.RotationXToRef(t,n),n},e.Invert=function(t){var n=new e;return t.invertToRef(n),n},e.RotationXToRef=function(t,n){var r=Math.sin(t),i=Math.cos(t);return e.FromValuesToRef(1,0,0,0,0,i,r,0,0,-r,i,0,0,0,0,1,n),n._updateIdentityStatus(1===i&&0===r),n},e.RotationY=function(t){var n=new e;return e.RotationYToRef(t,n),n},e.RotationYToRef=function(t,n){var r=Math.sin(t),i=Math.cos(t);return e.FromValuesToRef(i,0,-r,0,0,1,0,0,r,0,i,0,0,0,0,1,n),n._updateIdentityStatus(1===i&&0===r),n},e.RotationZ=function(t){var n=new e;return e.RotationZToRef(t,n),n},e.RotationZToRef=function(t,n){var r=Math.sin(t),i=Math.cos(t);return e.FromValuesToRef(i,r,0,0,-r,i,0,0,0,0,1,0,0,0,0,1,n),n._updateIdentityStatus(1===i&&0===r),n},e.RotationAxis=function(t,n){var r=new e;return e.RotationAxisToRef(t,n,r),r},e.RotationAxisToRef=function(e,t,n){var r=Math.sin(-t),i=Math.cos(-t),o=1-i;e=e.normalizeToRef(g.Vector3[0]);var a=n._m;return a[0]=e._x*e._x*o+i,a[1]=e._x*e._y*o-e._z*r,a[2]=e._x*e._z*o+e._y*r,a[3]=0,a[4]=e._y*e._x*o+e._z*r,a[5]=e._y*e._y*o+i,a[6]=e._y*e._z*o-e._x*r,a[7]=0,a[8]=e._z*e._x*o-e._y*r,a[9]=e._z*e._y*o+e._x*r,a[10]=e._z*e._z*o+i,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,n.markAsUpdated(),n},e.RotationAlignToRef=function(e,t,n,r){void 0===r&&(r=!1);var o=p.Dot(t,e),a=n._m;if(o<-1+i.bH)a[0]=-1,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=r?1:-1,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=r?-1:1,a[11]=0;else{var s=p.Cross(t,e),l=1/(1+o);a[0]=s._x*s._x*l+o,a[1]=s._y*s._x*l-s._z,a[2]=s._z*s._x*l+s._y,a[3]=0,a[4]=s._x*s._y*l+s._z,a[5]=s._y*s._y*l+o,a[6]=s._z*s._y*l-s._x,a[7]=0,a[8]=s._x*s._z*l-s._y,a[9]=s._y*s._z*l+s._x,a[10]=s._z*s._z*l+o,a[11]=0}return a[12]=0,a[13]=0,a[14]=0,a[15]=1,n.markAsUpdated(),n},e.RotationYawPitchRoll=function(t,n,r){var i=new e;return e.RotationYawPitchRollToRef(t,n,r,i),i},e.RotationYawPitchRollToRef=function(e,t,n,r){return m.RotationYawPitchRollToRef(e,t,n,g.Quaternion[0]),g.Quaternion[0].toRotationMatrix(r),r},e.Scaling=function(t,n,r){var i=new e;return e.ScalingToRef(t,n,r,i),i},e.ScalingToRef=function(t,n,r,i){return e.FromValuesToRef(t,0,0,0,0,n,0,0,0,0,r,0,0,0,0,1,i),i._updateIdentityStatus(1===t&&1===n&&1===r),i},e.Translation=function(t,n,r){var i=new e;return e.TranslationToRef(t,n,r,i),i},e.TranslationToRef=function(t,n,r,i){return e.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,t,n,r,1,i),i._updateIdentityStatus(0===t&&0===n&&0===r),i},e.Lerp=function(t,n,r){var i=new e;return e.LerpToRef(t,n,r,i),i},e.LerpToRef=function(e,t,n,r){for(var i=r._m,o=e.m,a=t.m,s=0;s<16;s++)i[s]=o[s]*(1-n)+a[s]*n;return r.markAsUpdated(),r},e.DecomposeLerp=function(t,n,r){var i=new e;return e.DecomposeLerpToRef(t,n,r,i),i},e.DecomposeLerpToRef=function(t,n,r,i){var o=g.Vector3[0],a=g.Quaternion[0],s=g.Vector3[1];t.decompose(o,a,s);var l=g.Vector3[2],c=g.Quaternion[1],u=g.Vector3[3];n.decompose(l,c,u);var h=g.Vector3[4];p.LerpToRef(o,l,r,h);var d=g.Quaternion[2];m.SlerpToRef(a,c,r,d);var f=g.Vector3[5];return p.LerpToRef(s,u,r,f),e.ComposeToRef(h,d,f,i),i},e.LookAtLH=function(t,n,r){var i=new e;return e.LookAtLHToRef(t,n,r,i),i},e.LookAtLHToRef=function(t,n,r,i){var o=g.Vector3[0],a=g.Vector3[1],s=g.Vector3[2];n.subtractToRef(t,s),s.normalize(),p.CrossToRef(r,s,o);var l=o.lengthSquared();0===l?o.x=1:o.normalizeFromLength(Math.sqrt(l)),p.CrossToRef(s,o,a),a.normalize();var c=-p.Dot(o,t),u=-p.Dot(a,t),h=-p.Dot(s,t);return e.FromValuesToRef(o._x,a._x,s._x,0,o._y,a._y,s._y,0,o._z,a._z,s._z,0,c,u,h,1,i),i},e.LookAtRH=function(t,n,r){var i=new e;return e.LookAtRHToRef(t,n,r,i),i},e.LookAtRHToRef=function(t,n,r,i){var o=g.Vector3[0],a=g.Vector3[1],s=g.Vector3[2];t.subtractToRef(n,s),s.normalize(),p.CrossToRef(r,s,o);var l=o.lengthSquared();0===l?o.x=1:o.normalizeFromLength(Math.sqrt(l)),p.CrossToRef(s,o,a),a.normalize();var c=-p.Dot(o,t),u=-p.Dot(a,t),h=-p.Dot(s,t);return e.FromValuesToRef(o._x,a._x,s._x,0,o._y,a._y,s._y,0,o._z,a._z,s._z,0,c,u,h,1,i),i},e.LookDirectionLH=function(t,n){var r=new e;return e.LookDirectionLHToRef(t,n,r),r},e.LookDirectionLHToRef=function(t,n,r){var i=g.Vector3[0];i.copyFrom(t),i.scaleInPlace(-1);var o=g.Vector3[1];return p.CrossToRef(n,i,o),e.FromValuesToRef(o._x,o._y,o._z,0,n._x,n._y,n._z,0,i._x,i._y,i._z,0,0,0,0,1,r),r},e.LookDirectionRH=function(t,n){var r=new e;return e.LookDirectionRHToRef(t,n,r),r},e.LookDirectionRHToRef=function(t,n,r){var i=g.Vector3[2];return p.CrossToRef(n,t,i),e.FromValuesToRef(i._x,i._y,i._z,0,n._x,n._y,n._z,0,t._x,t._y,t._z,0,0,0,0,1,r),r},e.OrthoLH=function(t,n,r,i,o){var a=new e;return e.OrthoLHToRef(t,n,r,i,a,o),a},e.OrthoLHToRef=function(t,n,r,i,o,a){var s=2/t,l=2/n,c=2/(i-r),u=-(i+r)/(i-r);return e.FromValuesToRef(s,0,0,0,0,l,0,0,0,0,c,0,0,0,u,1,o),a&&o.multiplyToRef(y,o),o._updateIdentityStatus(1===s&&1===l&&1===c&&0===u),o},e.OrthoOffCenterLH=function(t,n,r,i,o,a,s){var l=new e;return e.OrthoOffCenterLHToRef(t,n,r,i,o,a,l,s),l},e.OrthoOffCenterLHToRef=function(t,n,r,i,o,a,s,l){var c=2/(n-t),u=2/(i-r),h=2/(a-o),d=-(a+o)/(a-o),p=(t+n)/(t-n),f=(i+r)/(r-i);return e.FromValuesToRef(c,0,0,0,0,u,0,0,0,0,h,0,p,f,d,1,s),l&&s.multiplyToRef(y,s),s.markAsUpdated(),s},e.ObliqueOffCenterLHToRef=function(t,n,r,i,o,a,s,l,c,u,h){var d=-s*Math.cos(l),p=-s*Math.sin(l);return e.TranslationToRef(0,0,-c,g.Matrix[1]),e.FromValuesToRef(1,0,0,0,0,1,0,0,d,p,1,0,0,0,0,1,g.Matrix[0]),g.Matrix[1].multiplyToRef(g.Matrix[0],g.Matrix[0]),e.TranslationToRef(0,0,c,g.Matrix[1]),g.Matrix[0].multiplyToRef(g.Matrix[1],g.Matrix[0]),e.OrthoOffCenterLHToRef(t,n,r,i,o,a,u,h),g.Matrix[0].multiplyToRef(u,u),u},e.OrthoOffCenterRH=function(t,n,r,i,o,a,s){var l=new e;return e.OrthoOffCenterRHToRef(t,n,r,i,o,a,l,s),l},e.OrthoOffCenterRHToRef=function(t,n,r,i,o,a,s,l){return e.OrthoOffCenterLHToRef(t,n,r,i,o,a,s,l),s._m[10]*=-1,s},e.ObliqueOffCenterRHToRef=function(t,n,r,i,o,a,s,l,c,u,h){var d=s*Math.cos(l),p=s*Math.sin(l);return e.TranslationToRef(0,0,c,g.Matrix[1]),e.FromValuesToRef(1,0,0,0,0,1,0,0,d,p,1,0,0,0,0,1,g.Matrix[0]),g.Matrix[1].multiplyToRef(g.Matrix[0],g.Matrix[0]),e.TranslationToRef(0,0,-c,g.Matrix[1]),g.Matrix[0].multiplyToRef(g.Matrix[1],g.Matrix[0]),e.OrthoOffCenterRHToRef(t,n,r,i,o,a,u,h),g.Matrix[0].multiplyToRef(u,u),u},e.PerspectiveLH=function(t,n,r,i,o,a){void 0===a&&(a=0);var s=new e,l=2*r/t,c=2*r/n,u=(i+r)/(i-r),h=-2*i*r/(i-r),d=Math.tan(a);return e.FromValuesToRef(l,0,0,0,0,c,0,d,0,0,u,1,0,0,h,0,s),o&&s.multiplyToRef(y,s),s._updateIdentityStatus(!1),s},e.PerspectiveFovLH=function(t,n,r,i,o,a,s){void 0===a&&(a=0),void 0===s&&(s=!1);var l=new e;return e.PerspectiveFovLHToRef(t,n,r,i,l,!0,o,a,s),l},e.PerspectiveFovLHToRef=function(t,n,r,i,o,a,s,l,c){void 0===a&&(a=!0),void 0===l&&(l=0),void 0===c&&(c=!1);var u=r,h=i,d=1/Math.tan(.5*t),p=a?d/n:d,f=a?d:d*n,m=c&&0===u?-1:0!==h?(h+u)/(h-u):1,_=c&&0===u?2*h:0!==h?-2*h*u/(h-u):-2*u,g=Math.tan(l);return e.FromValuesToRef(p,0,0,0,0,f,0,g,0,0,m,1,0,0,_,0,o),s&&o.multiplyToRef(y,o),o._updateIdentityStatus(!1),o},e.PerspectiveFovReverseLHToRef=function(t,n,r,i,o,a,s,l){void 0===a&&(a=!0),void 0===l&&(l=0);var c=1/Math.tan(.5*t),u=a?c/n:c,h=a?c:c*n,d=Math.tan(l);return e.FromValuesToRef(u,0,0,0,0,h,0,d,0,0,-r,1,0,0,1,0,o),s&&o.multiplyToRef(y,o),o._updateIdentityStatus(!1),o},e.PerspectiveFovRH=function(t,n,r,i,o,a,s){void 0===a&&(a=0),void 0===s&&(s=!1);var l=new e;return e.PerspectiveFovRHToRef(t,n,r,i,l,!0,o,a,s),l},e.PerspectiveFovRHToRef=function(t,n,r,i,o,a,s,l,c){void 0===a&&(a=!0),void 0===l&&(l=0),void 0===c&&(c=!1);var u=r,h=i,d=1/Math.tan(.5*t),p=a?d/n:d,f=a?d:d*n,m=c&&0===u?1:0!==h?-(h+u)/(h-u):-1,_=c&&0===u?2*h:0!==h?-2*h*u/(h-u):-2*u,g=Math.tan(l);return e.FromValuesToRef(p,0,0,0,0,f,0,g,0,0,m,-1,0,0,_,0,o),s&&o.multiplyToRef(y,o),o._updateIdentityStatus(!1),o},e.PerspectiveFovReverseRHToRef=function(t,n,r,i,o,a,s,l){void 0===a&&(a=!0),void 0===l&&(l=0);var c=1/Math.tan(.5*t),u=a?c/n:c,h=a?c:c*n,d=Math.tan(l);return e.FromValuesToRef(u,0,0,0,0,h,0,d,0,0,-r,-1,0,0,-1,0,o),s&&o.multiplyToRef(y,o),o._updateIdentityStatus(!1),o},e.GetFinalMatrix=function(t,n,r,i,o,a){var s=t.width,l=t.height,c=t.x,u=t.y,h=e.FromValues(s/2,0,0,0,0,-l/2,0,0,0,0,a-o,0,c+s/2,l/2+u,o,1),d=new e;return n.multiplyToRef(r,d),d.multiplyToRef(i,d),d.multiplyToRef(h,d)},e.GetAsMatrix2x2=function(e){var t=e.m,n=[t[0],t[1],t[4],t[5]];return s.I.MatrixUse64Bits?n:new Float32Array(n)},e.GetAsMatrix3x3=function(e){var t=e.m,n=[t[0],t[1],t[2],t[4],t[5],t[6],t[8],t[9],t[10]];return s.I.MatrixUse64Bits?n:new Float32Array(n)},e.Transpose=function(t){var n=new e;return e.TransposeToRef(t,n),n},e.TransposeToRef=function(e,t){var n=e.m,r=n[0],i=n[4],o=n[8],a=n[12],s=n[1],l=n[5],c=n[9],u=n[13],h=n[2],d=n[6],p=n[10],f=n[14],m=n[3],_=n[7],g=n[11],v=n[15],y=t._m;return y[0]=r,y[1]=i,y[2]=o,y[3]=a,y[4]=s,y[5]=l,y[6]=c,y[7]=u,y[8]=h,y[9]=d,y[10]=p,y[11]=f,y[12]=m,y[13]=_,y[14]=g,y[15]=v,t.markAsUpdated(),t._updateIdentityStatus(e._isIdentity,e._isIdentityDirty),t},e.Reflection=function(t){var n=new e;return e.ReflectionToRef(t,n),n},e.ReflectionToRef=function(t,n){t.normalize();var r=t.normal.x,i=t.normal.y,o=t.normal.z,a=-2*r,s=-2*i,l=-2*o;return e.FromValuesToRef(a*r+1,s*r,l*r,0,a*i,s*i+1,l*i,0,a*o,s*o,l*o+1,0,a*t.d,s*t.d,l*t.d,1,n),n},e.FromXYZAxesToRef=function(t,n,r,i){return e.FromValuesToRef(t._x,t._y,t._z,0,n._x,n._y,n._z,0,r._x,r._y,r._z,0,0,0,0,1,i),i},e.FromQuaternionToRef=function(e,t){var n=e._x*e._x,r=e._y*e._y,i=e._z*e._z,o=e._x*e._y,a=e._z*e._w,s=e._z*e._x,l=e._y*e._w,c=e._y*e._z,u=e._x*e._w;return t._m[0]=1-2*(r+i),t._m[1]=2*(o+a),t._m[2]=2*(s-l),t._m[3]=0,t._m[4]=2*(o-a),t._m[5]=1-2*(i+n),t._m[6]=2*(c+u),t._m[7]=0,t._m[8]=2*(s+l),t._m[9]=2*(c-u),t._m[10]=1-2*(r+n),t._m[11]=0,t._m[12]=0,t._m[13]=0,t._m[14]=0,t._m[15]=1,t.markAsUpdated(),t},e._IdentityReadOnly=e.Identity(),e}();Object.defineProperties(_.prototype,{dimension:{value:[4,4]},rank:{value:2}});var g=function(){function e(){}return e.Vector3=(0,o.ln)(11,p.Zero),e.Matrix=(0,o.ln)(2,_.Identity),e.Quaternion=(0,o.ln)(3,m.Zero),e}(),v=function(){function e(){}return e.Vector2=(0,o.ln)(3,d.Zero),e.Vector3=(0,o.ln)(13,p.Zero),e.Vector4=(0,o.ln)(3,f.Zero),e.Quaternion=(0,o.ln)(3,m.Zero),e.Matrix=(0,o.ln)(8,_.Identity),e}();(0,a.Y5)("BABYLON.Vector2",d),(0,a.Y5)("BABYLON.Vector3",p),(0,a.Y5)("BABYLON.Vector4",f),(0,a.Y5)("BABYLON.Matrix",_);var y=_.FromValues(1,0,0,0,0,1,0,0,0,0,.5,0,0,0,.5,1)},8102:(e,t,n)=>{n.d(t,{S4:()=>s,VE:()=>c,_k:()=>u,r:()=>l,tg:()=>h});var r=n(50919),i=n(51289),o=n(45109),a=n(25598);function s(e){return new DataView(e.array.buffer,e.offset.value,e.size)}function l(e){var t=e.viewer.buffer.slice(e.offset.value,e.offset.value+e.size),n=new Uint8Array((0,i._)(t)),r=new Uint8Array(n.length);return(0,o.XE)(n),(0,o.KA)(n,r),new DataView(r.buffer)}function c(e){var t=e.array.slice(e.offset.value,e.offset.value+e.size),n=fflate.unzlibSync(t),r=new Uint8Array(n.length);return(0,o.XE)(n),(0,o.KA)(n,r),new DataView(r.buffer)}function u(e){for(var t=e.array.slice(e.offset.value,e.offset.value+e.size),n=fflate.unzlibSync(t),r=e.lines*e.channels*e.width,i=1==e.type?new Uint16Array(r):new Uint32Array(r),o=0,a=0,s=new Array(4),l=0;l=a.cQ)throw new Error("Wrong PIZ_COMPRESSION BITMAP_SIZE");if(h<=d)for(u=0;u{n.r(t),n.d(t,{FlowGraphSwitchBlock:()=>l});var r=n(78322),i=n(88677),o=n(88099),a=n(34623),s=n(95803),l=function(e){function t(t){var n=e.call(this,t)||this;n.config=t,n.default=n._registerSignalOutput("default"),n._caseToOutputFlow=new Map,n.case=n.registerDataInput("case",o.Vv);for(var r=0,i=n.config.cases||[];r{n.r(t),n.d(t,{gaussianSplattingVertexShaderWGSL:()=>a});var r=n(98519),i=(n(36644),n(40647),n(17393),n(9436),n(79716),n(38197),n(68325),n(63002),n(70898),n(55607),"gaussianSplattingVertexShader"),o="#include\n#include\n#include\n#include\n#include\n#include\nattribute splatIndex: f32;attribute position: vec2f;uniform invViewport: vec2f;uniform dataTextureSize: vec2f;uniform focal: vec2f;uniform kernelSize: f32;uniform eyePosition: vec3f;uniform viewDirectionFactor: vec3f;var covariancesATexture: texture_2d;var covariancesBTexture: texture_2d;var centersTexture: texture_2d;var colorsTexture: texture_2d;\n#if SH_DEGREE>0\nvar shTexture0: texture_2d;\n#endif\n#if SH_DEGREE>1\nvar shTexture1: texture_2d;\n#endif\n#if SH_DEGREE>2\nvar shTexture2: texture_2d;\n#endif\nvarying vColor: vec4f;varying vPosition: vec2f;\n#include\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {var splat: Splat=readSplat(input.splatIndex,uniforms.dataTextureSize);var covA: vec3f=splat.covA.xyz;var covB: vec3f=vec3f(splat.covA.w,splat.covB.xy);let worldPos: vec4f=mesh.world*vec4f(splat.center.xyz,1.0);vertexOutputs.vPosition=input.position;\n#if SH_DEGREE>0\nlet worldRot: mat3x3f= mat3x3f(mesh.world[0].xyz,mesh.world[1].xyz,mesh.world[2].xyz);let normWorldRot: mat3x3f=inverseMat3(worldRot);var dir: vec3f=normalize(normWorldRot*(worldPos.xyz-uniforms.eyePosition.xyz));dir*=uniforms.viewDirectionFactor;vertexOutputs.vColor=vec4f(splat.color.xyz+computeSH(splat,dir),splat.color.w);\n#else\nvertexOutputs.vColor=splat.color;\n#endif\nvertexOutputs.position=gaussianSplatting(input.position,worldPos.xyz,vec2f(1.0,1.0),covA,covB,mesh.world,scene.view,scene.projection,uniforms.focal,uniforms.invViewport,uniforms.kernelSize);\n#include\n#include\n#include\n}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},8822:(e,t,n)=>{n.d(t,{c:()=>v});var r=n(78322),i=n(8046),o=n(41085),a=n(81152),s=n(41190),l=n(59784),c=n(64880),u=n(559),h=n(7164),d=n(66614),p=i.Pq.Up(),f=i.Pq.Zero(),m=new i.Pq,_=new i.Pq,g=new i.uq,v=function(e){function t(n,r,i,o,a){void 0===a&&(a=!0);var s=this;return t.IsSupported?((s=e.call(this,n,r,i,o,a)||this).usePercentageCloserFiltering=!0,s):(h.V.Error("CascadedShadowMap is not supported by the current engine."),s)}return(0,r.C6)(t,e),t.prototype._validateFilter=function(e){return e===l.o.FILTER_NONE||e===l.o.FILTER_PCF||e===l.o.FILTER_PCSS?e:(h.V.Error('Unsupported filter "'+e+'"!'),l.o.FILTER_NONE)},Object.defineProperty(t.prototype,"numCascades",{get:function(){return this._numCascades},set:function(e){(e=Math.min(Math.max(e,t.MIN_CASCADES_COUNT),t.MAX_CASCADES_COUNT))!==this._numCascades&&(this._numCascades=e,this.recreateShadowMap(),this._recreateSceneUBOs())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"freezeShadowCastersBoundingInfo",{get:function(){return this._freezeShadowCastersBoundingInfo},set:function(e){var t=this;this._freezeShadowCastersBoundingInfoObservable&&e&&(this._scene.onBeforeRenderObservable.remove(this._freezeShadowCastersBoundingInfoObservable),this._freezeShadowCastersBoundingInfoObservable=null),this._freezeShadowCastersBoundingInfoObservable||e||(this._freezeShadowCastersBoundingInfoObservable=this._scene.onBeforeRenderObservable.add((function(){return t._computeShadowCastersBoundingInfo()}))),this._freezeShadowCastersBoundingInfo=e,e&&this._computeShadowCastersBoundingInfo()},enumerable:!1,configurable:!0}),t.prototype._computeShadowCastersBoundingInfo=function(){if(this._scbiMin.copyFromFloats(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._scbiMax.copyFromFloats(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),this._shadowMap&&this._shadowMap.renderList)for(var e=this._shadowMap.renderList,t=0;tt&&(e=0,t=1),e<0&&(e=0),t>1&&(t=1),this._minDistance=e,this._maxDistance=t,this._breaksAreDirty=!0)},Object.defineProperty(t.prototype,"minDistance",{get:function(){return this._minDistance},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxDistance",{get:function(){return this._maxDistance},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return t.CLASSNAME},t.prototype.getCascadeMinExtents=function(e){return e>=0&&e=0&&et.maxZ&&0!==t.maxZ||(this._shadowMaxZ=e,this._light._markMeshesAsLightDirty(),this._breaksAreDirty=!0):this._shadowMaxZ=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"debug",{get:function(){return this._debug},set:function(e){this._debug=e,this._light._markMeshesAsLightDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"depthClamp",{get:function(){return this._depthClamp},set:function(e){this._depthClamp=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cascadeBlendPercentage",{get:function(){return this._cascadeBlendPercentage},set:function(e){this._cascadeBlendPercentage=e,this._light._markMeshesAsLightDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lambda",{get:function(){return this._lambda},set:function(e){var t=Math.min(Math.max(e,0),1);this._lambda!=t&&(this._lambda=t,this._breaksAreDirty=!0)},enumerable:!1,configurable:!0}),t.prototype.getCascadeViewMatrix=function(e){return e>=0&&e=0&&e=0&&e=r&&(n=0,r=1),n==t._minDistance&&r==t._maxDistance||t.setMinMaxDistance(n,r)})),this._depthReducer.setDepthRenderer(this._depthRenderer)),this._depthReducer.activate()}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"autoCalcDepthBoundsRefreshRate",{get:function(){var e,t,n;return null!==(n=null===(t=null===(e=this._depthReducer)||void 0===e?void 0:e.depthRenderer)||void 0===t?void 0:t.getDepthMap().refreshRate)&&void 0!==n?n:-1},set:function(e){var t;(null===(t=this._depthReducer)||void 0===t?void 0:t.depthRenderer)&&(this._depthReducer.depthRenderer.getDepthMap().refreshRate=e)},enumerable:!1,configurable:!0}),t.prototype.splitFrustum=function(){this._breaksAreDirty=!0},t.prototype._splitFrustum=function(){var e=this._getCamera();if(e){for(var t=e.minZ,n=e.maxZ||this._shadowMaxZ,r=n-t,i=this._minDistance,o=t+i*r,a=t+(this._shadowMaxZ=t?Math.min((this._shadowMaxZ-t)/(n-t),this._maxDistance):this._maxDistance)*r,s=a-o,l=a/o,c=0;co||(this._depthClamp&&this.filter!==l.o.FILTER_PCSS?(o=Math.min(o,c),r=Math.max(r,s),o=Math.max(r+1,o)):(r=Math.min(r,s),this.filter!==l.o.FILTER_PCSS&&(o=Math.min(o,c)))),i.uq.OrthoOffCenterLHToRef(this._cascadeMinExtents[n].x,this._cascadeMaxExtents[n].x,this._cascadeMinExtents[n].y,this._cascadeMaxExtents[n].y,t?o:r,t?r:o,this._projectionMatrices[n],e.getEngine().isNDCHalfZRange),this._cascadeMinExtents[n].z=r,this._cascadeMaxExtents[n].z=o,this._viewMatrices[n].multiplyToRef(this._projectionMatrices[n],this._transformMatrices[n]),i.Pq.TransformCoordinatesToRef(f,this._transformMatrices[n],m),m.scaleInPlace(this._mapSize/2),_.copyFromFloats(Math.round(m.x),Math.round(m.y),Math.round(m.z)),_.subtractInPlace(m).scaleInPlace(2/this._mapSize),i.uq.TranslationToRef(_.x,_.y,0,g),this._projectionMatrices[n].multiplyToRef(g,this._projectionMatrices[n]),this._viewMatrices[n].multiplyToRef(this._projectionMatrices[n],this._transformMatrices[n]),this._transformMatrices[n].copyToArray(this._transformMatricesAsArray,16*n)}}},t.prototype._computeFrustumInWorldSpace=function(e){var n=this._getCamera();if(n){var r=this._cascades[e].prevBreakDistance,o=this._cascades[e].breakDistance,a=this._scene.getEngine().isNDCHalfZRange;n.getViewMatrix();var s=0===n.maxZ,l=n.maxZ;s&&(n.maxZ=this._shadowMaxZ,n.getProjectionMatrix(!0));var c=i.uq.Invert(n.getTransformationMatrix());s&&(n.maxZ=l,n.getProjectionMatrix(!0));for(var u=this._scene.getEngine().useReverseDepthBuffer?4:0,h=0;h{var r=n(78322),i=n(19133),o=n(7164),a=n(81152);n(44256).ThinEngine.prototype.createRenderTargetCubeTexture=function(e,t){var n=this._createHardwareRenderTargetWrapper(!1,!0,e),s=(0,r.Cl)({generateMipMaps:!0,generateDepthBuffer:!0,generateStencilBuffer:!1,type:a.Y.TEXTURETYPE_UNSIGNED_BYTE,samplingMode:a.Y.TEXTURE_TRILINEAR_SAMPLINGMODE,format:a.Y.TEXTUREFORMAT_RGBA},t);s.generateStencilBuffer=s.generateDepthBuffer&&s.generateStencilBuffer,(s.type!==a.Y.TEXTURETYPE_FLOAT||this._caps.textureFloatLinearFiltering)&&(s.type!==a.Y.TEXTURETYPE_HALF_FLOAT||this._caps.textureHalfFloatLinearFiltering)||(s.samplingMode=a.Y.TEXTURE_NEAREST_SAMPLINGMODE);var l=this._gl,c=new i.h(this,5);this._bindTextureDirectly(l.TEXTURE_CUBE_MAP,c,!0);var u=this._getSamplingParameters(s.samplingMode,s.generateMipMaps);s.type!==a.Y.TEXTURETYPE_FLOAT||this._caps.textureFloat||(s.type=a.Y.TEXTURETYPE_UNSIGNED_BYTE,o.V.Warn("Float textures are not supported. Cube render target forced to TEXTURETYPE_UNESIGNED_BYTE type")),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_MAG_FILTER,u.mag),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_MIN_FILTER,u.min),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE);for(var h=0;h<6;h++)l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+h,0,this._getRGBABufferInternalSizedFormat(s.type,s.format),e,e,0,this._getInternalFormat(s.format),this._getWebGLTextureType(s.type),null);var d=l.createFramebuffer();return this._bindUnboundFramebuffer(d),n._depthStencilBuffer=this._setupFramebufferDepthAttachments(s.generateStencilBuffer,s.generateDepthBuffer,e,e),s.generateMipMaps&&l.generateMipmap(l.TEXTURE_CUBE_MAP),this._bindTextureDirectly(l.TEXTURE_CUBE_MAP,null),this._bindUnboundFramebuffer(null),n._framebuffer=d,n._generateDepthBuffer=s.generateDepthBuffer,n._generateStencilBuffer=s.generateStencilBuffer,c.width=e,c.height=e,c.isReady=!0,c.isCube=!0,c.samples=1,c.generateMipMaps=s.generateMipMaps,c.samplingMode=s.samplingMode,c.type=s.type,c.format=s.format,this._internalTexturesCache.push(c),n.setTextures(c),n}},8866:(e,t,n)=>{n.r(t),n.d(t,{iblCombineVoxelGridsPixelShaderWGSL:()=>a});var r=n(98519),i="iblCombineVoxelGridsPixelShader",o="varying vUV: vec2f;var voxelXaxisSamplerSampler: sampler;var voxelXaxisSampler: texture_3d;var voxelYaxisSamplerSampler: sampler;var voxelYaxisSampler: texture_3d;var voxelZaxisSamplerSampler: sampler;var voxelZaxisSampler: texture_3d;uniform layer: f32;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var coordZ: vec3f= vec3f(fragmentInputs.vUV.x,fragmentInputs.vUV.y,uniforms.layer);var voxelZ: f32=textureSample(voxelZaxisSampler,voxelZaxisSamplerSampler,coordZ).r;var coordX: vec3f= vec3f(1.0-uniforms.layer,fragmentInputs.vUV.y,fragmentInputs.vUV.x);var voxelX: f32=textureSample(voxelXaxisSampler,voxelXaxisSamplerSampler,coordX).r;var coordY: vec3f= vec3f(uniforms.layer,fragmentInputs.vUV.x,fragmentInputs.vUV.y);var voxelY: f32=textureSample(voxelYaxisSampler,voxelYaxisSamplerSampler,coordY).r;var voxel=select(0.0,1.0,(voxelX>0.0 || voxelY>0.0 || voxelZ>0.0));fragmentOutputs.color= vec4f( vec3f(voxel),1.0);}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},9151:(e,t,n)=>{n.d(t,{Au:()=>a,Pt:()=>l,y5:()=>s});var r=n(78322),i=n(24943),o=n(27063),a=function(e){function t(t){var n=e.call(this,"Spatial",t)||this;return n._attacherComponent=null,n}return(0,r.C6)(t,e),Object.defineProperty(t.prototype,"isAttached",{get:function(){return null!==this._attacherComponent&&this._attacherComponent.isAttached},enumerable:!1,configurable:!0}),t.prototype.attach=function(e,t,n){this.detach(),this._attacherComponent||(this._attacherComponent=new i.l(this)),this._attacherComponent.attach(e,t,n)},t.prototype.detach=function(){var e;null===(e=this._attacherComponent)||void 0===e||e.detach()},t.prototype.dispose=function(){var t;e.prototype.dispose.call(this),null===(t=this._attacherComponent)||void 0===t||t.dispose(),this._attacherComponent=null},t.prototype.setOptions=function(e){var t,n,r,i,a,s,l,c;this.coneInnerAngle=null!==(t=e.spatialConeInnerAngle)&&void 0!==t?t:o.Qc.coneInnerAngle,this.coneOuterAngle=null!==(n=e.spatialConeOuterAngle)&&void 0!==n?n:o.Qc.coneOuterAngle,this.coneOuterVolume=null!==(r=e.spatialConeOuterVolume)&&void 0!==r?r:o.Qc.coneOuterVolume,this.distanceModel=null!==(i=e.spatialDistanceModel)&&void 0!==i?i:o.Qc.distanceModel,this.maxDistance=null!==(a=e.spatialMaxDistance)&&void 0!==a?a:o.Qc.maxDistance,this.minDistance=null!==(s=e.spatialMinDistance)&&void 0!==s?s:o.Qc.minDistance,this.panningModel=null!==(l=e.spatialPanningModel)&&void 0!==l?l:o.Qc.panningModel,this.rolloffFactor=null!==(c=e.spatialRolloffFactor)&&void 0!==c?c:o.Qc.rolloffFactor,e.spatialPosition&&(this.position=e.spatialPosition.clone()),e.spatialRotationQuaternion?this.rotationQuaternion=e.spatialRotationQuaternion.clone():e.spatialRotation?this.rotation=e.spatialRotation.clone():this.rotationQuaternion=o.Qc.rotationQuaternion.clone(),this.update()},t.prototype.update=function(){var e;this.isAttached?null===(e=this._attacherComponent)||void 0===e||e.update():(this._updatePosition(),this._updateRotation())},t}(n(59465).e);function s(e){return e.getSubNode("Spatial")}function l(e,t,n){e.callOnSubNode("Spatial",(function(e){e[t]=n}))}},9406:(e,t,n)=>{n.r(t),n.d(t,{convolutionPixelShader:()=>a});var r=n(98519),i="convolutionPixelShader",o="varying vec2 vUV;uniform sampler2D textureSampler;uniform vec2 screenSize;uniform float kernel[9];\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{vec2 onePixel=vec2(1.0,1.0)/screenSize;vec4 colorSum =\ntexture2D(textureSampler,vUV+onePixel*vec2(-1,-1))*kernel[0] +\ntexture2D(textureSampler,vUV+onePixel*vec2(0,-1))*kernel[1] +\ntexture2D(textureSampler,vUV+onePixel*vec2(1,-1))*kernel[2] +\ntexture2D(textureSampler,vUV+onePixel*vec2(-1,0))*kernel[3] +\ntexture2D(textureSampler,vUV+onePixel*vec2(0,0))*kernel[4] +\ntexture2D(textureSampler,vUV+onePixel*vec2(1,0))*kernel[5] +\ntexture2D(textureSampler,vUV+onePixel*vec2(-1,1))*kernel[6] +\ntexture2D(textureSampler,vUV+onePixel*vec2(0,1))*kernel[7] +\ntexture2D(textureSampler,vUV+onePixel*vec2(1,1))*kernel[8];float kernelWeight =\nkernel[0] +\nkernel[1] +\nkernel[2] +\nkernel[3] +\nkernel[4] +\nkernel[5] +\nkernel[6] +\nkernel[7] +\nkernel[8];if (kernelWeight<=0.0) {kernelWeight=1.0;}\ngl_FragColor=vec4((colorSum/kernelWeight).rgb,1);}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},9436:(e,t,n)=>{n.r(t),n.d(t,{clipPlaneVertexDeclarationWGSL:()=>a});var r=n(98519),i="clipPlaneVertexDeclaration",o="#ifdef CLIPPLANE\nuniform vClipPlane: vec4;varying fClipDistance: f32;\n#endif\n#ifdef CLIPPLANE2\nuniform vClipPlane2: vec4;varying fClipDistance2: f32;\n#endif\n#ifdef CLIPPLANE3\nuniform vClipPlane3: vec4;varying fClipDistance3: f32;\n#endif\n#ifdef CLIPPLANE4\nuniform vClipPlane4: vec4;varying fClipDistance4: f32;\n#endif\n#ifdef CLIPPLANE5\nuniform vClipPlane5: vec4;varying fClipDistance5: f32;\n#endif\n#ifdef CLIPPLANE6\nuniform vClipPlane6: vec4;varying fClipDistance6: f32;\n#endif\n";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]=o);var a={name:i,shader:o}},9691:(e,t,n)=>{n.d(t,{l:()=>i});var r=n(78322),i=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r._outBus=null,r._onOutBusDisposed=function(){r.outBus=r.engine.defaultMainBus},r}return(0,r.C6)(t,e),Object.defineProperty(t.prototype,"outBus",{get:function(){return this._outBus},set:function(e){if(this._outBus!==e){if(this._outBus&&(this._outBus.onDisposeObservable.removeCallback(this._onOutBusDisposed),!this._disconnect(this._outBus)))throw new Error("Disconnect failed");if(this._outBus=e,this._outBus&&(this._outBus.onDisposeObservable.add(this._onOutBusDisposed),!this._connect(this._outBus)))throw new Error("Connect failed")}},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){e.prototype.dispose.call(this),this._outBus=null},t}(n(99757).t)},9918:(e,t,n)=>{n.d(t,{k:()=>i});var r=n(18285),i=function(){function e(e,t){var n=this;this._deferredRampOptions={duration:0,shape:"linear"},this._deferredTargetValue=-1,this._isObservingUpdates=!1,this._rampEndTime=0,this._applyDeferredRamp=function(){0{var r=n(98519),i="hdrFilteringFunctions";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#if NUM_SAMPLES\n#if NUM_SAMPLES>0\n#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\nfloat radicalInverse_VdC(uint bits) \n{bits=(bits<<16u) | (bits>>16u);bits=((bits & 0x55555555u)<<1u) | ((bits & 0xAAAAAAAAu)>>1u);bits=((bits & 0x33333333u)<<2u) | ((bits & 0xCCCCCCCCu)>>2u);bits=((bits & 0x0F0F0F0Fu)<<4u) | ((bits & 0xF0F0F0F0u)>>4u);bits=((bits & 0x00FF00FFu)<<8u) | ((bits & 0xFF00FF00u)>>8u);return float(bits)*2.3283064365386963e-10; }\nvec2 hammersley(uint i,uint N)\n{return vec2(float(i)/float(N),radicalInverse_VdC(i));}\n#else\nfloat vanDerCorpus(int n,int base)\n{float invBase=1.0/float(base);float denom =1.0;float result =0.0;for(int i=0; i<32; ++i)\n{if(n>0)\n{denom =mod(float(n),2.0);result+=denom*invBase;invBase=invBase/2.0;n =int(float(n)/2.0);}}\nreturn result;}\nvec2 hammersley(int i,int N)\n{return vec2(float(i)/float(N),vanDerCorpus(i,2));}\n#endif\nfloat log4(float x) {return log2(x)/2.;}\nvec3 uv_to_normal(vec2 uv) {vec3 N;vec2 uvRange=uv;float theta=uvRange.x*2.*PI;float phi=uvRange.y*PI;float sinPhi=sin(phi);N.x=cos(theta)*sinPhi;N.z=sin(theta)*sinPhi;N.y=cos(phi);return N;}\nconst float NUM_SAMPLES_FLOAT=float(NUM_SAMPLES);const float NUM_SAMPLES_FLOAT_INVERSED=1./NUM_SAMPLES_FLOAT;const float K=4.;\n#define inline\nvec3 irradiance(\n#ifdef CUSTOM_IRRADIANCE_FILTERING_INPUT\nCUSTOM_IRRADIANCE_FILTERING_INPUT\n#else\nsamplerCube inputTexture,\n#endif\nvec3 inputN,vec2 filteringInfo,\nfloat diffuseRoughness,\nvec3 surfaceAlbedo,\nvec3 inputV\n#if IBL_CDF_FILTERING\n,sampler2D icdfSampler\n#endif\n)\n{vec3 n=normalize(inputN);vec3 result=vec3(0.);\n#ifndef IBL_CDF_FILTERING\nvec3 tangent=abs(n.z)<0.999 ? vec3(0.,0.,1.) : vec3(1.,0.,0.);tangent=normalize(cross(tangent,n));vec3 bitangent=cross(n,tangent);mat3 tbn=mat3(tangent,bitangent,n);mat3 tbnInverse=mat3(tangent.x,bitangent.x,n.x,tangent.y,bitangent.y,n.y,tangent.z,bitangent.z,n.z);\n#endif\nfloat maxLevel=filteringInfo.y;float dim0=filteringInfo.x;float omegaP=(4.*PI)/(6.*dim0*dim0);vec3 clampedAlbedo=clamp(surfaceAlbedo,vec3(0.1),vec3(1.0));\n#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\nfor(uint i=0u; i0.) {\n#if IBL_CDF_FILTERING\nfloat pdf=texture2D(icdfSampler,T).z;vec3 c=textureCubeLodEXT(inputTexture,Ls,0.).rgb;\n#else\nfloat pdf_inversed=PI/NoL;float omegaS=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;float l=log4(omegaS)-log4(omegaP)+log4(K);float mipLevel=clamp(l,0.,maxLevel);\n#ifdef CUSTOM_IRRADIANCE_FILTERING_FUNCTION\nCUSTOM_IRRADIANCE_FILTERING_FUNCTION\n#else\nvec3 c=textureCubeLodEXT(inputTexture,tbn*Ls,mipLevel).rgb;\n#endif\n#endif\n#if GAMMA_INPUT\nc=toLinearSpace(c);\n#endif\nvec3 diffuseRoughnessTerm=vec3(1.0);\n#if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON\ndiffuseRoughnessTerm=diffuseBRDF_EON(clampedAlbedo,diffuseRoughness,NoL,NoV,LoV)*PI;\n#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY\ndiffuseRoughnessTerm=vec3(diffuseBRDF_Burley(NoL,NoV,VoH,diffuseRoughness)*PI);\n#endif\n#if IBL_CDF_FILTERING\nvec3 light=pdf<1e-6 ? vec3(0.0) : vec3(1.0)/vec3(pdf)*c;result+=NoL*diffuseRoughnessTerm*light;\n#else\nresult+=c*diffuseRoughnessTerm;\n#endif\n}}\nresult=result*NUM_SAMPLES_FLOAT_INVERSED;\n#if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON\nresult=result/clampedAlbedo;\n#endif\nreturn result;}\n#define inline\nvec3 radiance(float alphaG,samplerCube inputTexture,vec3 inputN,vec2 filteringInfo)\n{vec3 n=normalize(inputN);vec3 c=textureCube(inputTexture,n).rgb; \nif (alphaG==0.) {\n#if GAMMA_INPUT\nc=toLinearSpace(c);\n#endif\nreturn c;} else {vec3 result=vec3(0.);vec3 tangent=abs(n.z)<0.999 ? vec3(0.,0.,1.) : vec3(1.,0.,0.);tangent=normalize(cross(tangent,n));vec3 bitangent=cross(n,tangent);mat3 tbn=mat3(tangent,bitangent,n);float maxLevel=filteringInfo.y;float dim0=filteringInfo.x;float omegaP=(4.*PI)/(6.*dim0*dim0);float weight=0.;\n#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\nfor(uint i=0u; i0.) {float pdf_inversed=4./normalDistributionFunction_TrowbridgeReitzGGX(NoH,alphaG);float omegaS=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;float l=log4(omegaS)-log4(omegaP)+log4(K);float mipLevel=clamp(float(l),0.0,maxLevel);weight+=NoL;vec3 c=textureCubeLodEXT(inputTexture,tbn*L,mipLevel).rgb;\n#if GAMMA_INPUT\nc=toLinearSpace(c);\n#endif\nresult+=c*NoL;}}\nresult=result/weight;return result;}}\n#ifdef ANISOTROPIC\n#define inline\nvec3 radianceAnisotropic(\nfloat alphaTangent, \nfloat alphaBitangent, \nsamplerCube inputTexture,\nvec3 inputView, \nvec3 inputTangent, \nvec3 inputBitangent, \nvec3 inputNormal, \nvec2 filteringInfo,\nvec2 noiseInput \n)\n{vec3 V=inputView;vec3 N=inputNormal;vec3 T=inputTangent;vec3 B=inputBitangent;vec3 R=reflect(-V,N);if (alphaTangent==0. && alphaBitangent==0.) {vec3 c=textureCube(inputTexture,R).rgb;\n#if GAMMA_INPUT\nc=toLinearSpace(c);\n#endif\nreturn c;}\nvec3 result=vec3(0.);float maxLevel=filteringInfo.y;float dim0=filteringInfo.x;float effectiveDim=dim0*sqrt(alphaTangent*alphaBitangent);float omegaP=(4.*PI)/(6.*effectiveDim*effectiveDim);const float noiseScale=clamp(log2(float(NUM_SAMPLES))/12.0f,0.0f,1.0f);float weight=0.;\n#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\nfor(uint i=0u; i0.) {float pdf_inversed=4./normalDistributionFunction_BurleyGGX_Anisotropic(\nH_tangent.z,H_tangent.x,H_tangent.y,vec2(alphaTangent,alphaBitangent)\n);float omegaS=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;float l=log4(omegaS)-log4(omegaP)+log4(K);float mipLevel=clamp(float(l),0.0,maxLevel);weight+=NoL;vec3 c=textureCubeLodEXT(inputTexture,L,mipLevel).rgb;\n#if GAMMA_INPUT\nc=toLinearSpace(c);\n#endif\nresult+=c*NoL;}}\nresult=result/weight;return result;}\n#endif\n#endif\n#endif\n")},10151:(e,t,n)=>{n.r(t),n.d(t,{fluidRenderingParticleThicknessPixelShader:()=>a});var r=n(98519),i="fluidRenderingParticleThicknessPixelShader",o="uniform float particleAlpha;varying vec2 uv;void main(void) {vec3 normal;normal.xy=uv*2.0-1.0;float r2=dot(normal.xy,normal.xy);if (r2>1.0) discard;float thickness=sqrt(1.0-r2);glFragColor=vec4(vec3(particleAlpha*thickness),1.0);}\n";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},10252:(e,t,n)=>{var r;function i(e,t,n,r){var i,o,a,s,l,c,u,h,d,p,f,m;switch(t){case"Animation":return r?null!==(i=e.animations.find((function(e){return e.uniqueId===n})))&&void 0!==i?i:null:null!==(o=e.animations[n])&&void 0!==o?o:null;case"AnimationGroup":return r?null!==(a=e.animationGroups.find((function(e){return e.uniqueId===n})))&&void 0!==a?a:null:null!==(s=e.animationGroups[n])&&void 0!==s?s:null;case"Mesh":return r?null!==(l=e.meshes.find((function(e){return e.uniqueId===n})))&&void 0!==l?l:null:null!==(c=e.meshes[n])&&void 0!==c?c:null;case"Material":return r?null!==(u=e.materials.find((function(e){return e.uniqueId===n})))&&void 0!==u?u:null:null!==(h=e.materials[n])&&void 0!==h?h:null;case"Camera":return r?null!==(d=e.cameras.find((function(e){return e.uniqueId===n})))&&void 0!==d?d:null:null!==(p=e.cameras[n])&&void 0!==p?p:null;case"Light":return r?null!==(f=e.lights.find((function(e){return e.uniqueId===n})))&&void 0!==f?f:null:null!==(m=e.lights[n])&&void 0!==m?m:null;default:return null}}n.d(t,{$:()=>r,N:()=>i}),function(e){e.Animation="Animation",e.AnimationGroup="AnimationGroup",e.Mesh="Mesh",e.Material="Material",e.Camera="Camera",e.Light="Light"}(r||(r={}))},10338:(e,t,n)=>{n.d(t,{H:()=>r,X:()=>o});var r,i=n(23885);!function(e){e[e.Input=0]="Input",e[e.Output=1]="Output"}(r||(r={}));var o=function(){function e(e,t,n){this._ownerBlock=n,this._connectedPoint=[],this.uniqueId=(0,i.z)(),this.connectedPointIds=[],this.name=e,this._connectionType=t}return Object.defineProperty(e.prototype,"connectionType",{get:function(){return this._connectionType},enumerable:!1,configurable:!0}),e.prototype._isSingularConnection=function(){return!0},e.prototype.isConnected=function(){return this._connectedPoint.length>0},e.prototype.connectTo=function(e){if(this._connectionType===e._connectionType)throw new Error("Cannot connect two points of type ".concat(this.connectionType));if(this._isSingularConnection()&&this._connectedPoint.length>0||e._isSingularConnection()&&e._connectedPoint.length>0)throw new Error("Max number of connections for point reached");this._connectedPoint.push(e),e._connectedPoint.push(this)},e.prototype.disconnectFrom=function(e,t){void 0===t&&(t=!0);var n=this._connectedPoint.indexOf(e),r=e._connectedPoint.indexOf(this);-1!==n&&-1!==r&&(t&&this._connectedPoint.splice(n,1),e._connectedPoint.splice(r,1))},e.prototype.disconnectFromAll=function(){for(var e=0,t=this._connectedPoint;e{var r=n(98519),i="pbrBlockReflectance0";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="var reflectanceF0: f32=reflectivityOut.reflectanceF0;var specularEnvironmentR0: vec3f=reflectivityOut.colorReflectanceF0;var specularEnvironmentR90: vec3f= reflectivityOut.reflectanceF90;\n#ifdef ALPHAFRESNEL\nvar reflectance90: f32=fresnelGrazingReflectance(reflectanceF0);specularEnvironmentR90=specularEnvironmentR90*reflectance90;\n#endif\n")},10534:(e,t,n)=>{n.r(t),n.d(t,{anaglyphPixelShader:()=>a});var r=n(98519),i="anaglyphPixelShader",o="varying vec2 vUV;uniform sampler2D textureSampler;uniform sampler2D leftSampler;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{vec4 leftFrag=texture2D(leftSampler,vUV);leftFrag=vec4(1.0,leftFrag.g,leftFrag.b,1.0);vec4 rightFrag=texture2D(textureSampler,vUV);rightFrag=vec4(rightFrag.r,1.0,1.0,1.0);gl_FragColor=vec4(rightFrag.rgb*leftFrag.rgb,1.0);}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},10721:(e,t,n)=>{n.r(t),n.d(t,{pbrVertexShaderWGSL:()=>a});var r=n(98519),i=(n(14052),n(56213),n(14188),n(17393),n(61669),n(45699),n(27279),n(63866),n(84020),n(12520),n(44467),n(33330),n(9436),n(79716),n(58902),n(73683),n(68478),n(38197),n(98819),n(77320),n(21310),n(3641),n(86615),n(21954),n(28981),n(88380),n(19748),n(63002),n(70898),n(59115),n(50615),n(55607),"pbrVertexShader"),o="#define PBR_VERTEX_SHADER\n#include\n#define CUSTOM_VERTEX_BEGIN\nattribute position: vec3f;\n#ifdef NORMAL\nattribute normal: vec3f;\n#endif\n#ifdef TANGENT\nattribute tangent: vec4f;\n#endif\n#ifdef UV1\nattribute uv: vec2f;\n#endif\n#include[2..7]\n#include[1..7]\n#ifdef VERTEXCOLOR\nattribute color: vec4f;\n#endif\n#include\n#include\n#include\n#include\n#include\n#include\n#include(_DEFINENAME_,ALBEDO,_VARYINGNAME_,Albedo)\n#include(_DEFINENAME_,BASE_WEIGHT,_VARYINGNAME_,BaseWeight)\n#include(_DEFINENAME_,BASE_DIFFUSE_ROUGHNESS,_VARYINGNAME_,BaseDiffuseRoughness)\n#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail)\n#include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient)\n#include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity)\n#include(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive)\n#include(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap)\n#include(_DEFINENAME_,REFLECTIVITY,_VARYINGNAME_,Reflectivity)\n#include(_DEFINENAME_,MICROSURFACEMAP,_VARYINGNAME_,MicroSurfaceSampler)\n#include(_DEFINENAME_,METALLIC_REFLECTANCE,_VARYINGNAME_,MetallicReflectance)\n#include(_DEFINENAME_,REFLECTANCE,_VARYINGNAME_,Reflectance)\n#include(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump)\n#include(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal)\n#ifdef CLEARCOAT\n#include(_DEFINENAME_,CLEARCOAT_TEXTURE,_VARYINGNAME_,ClearCoat)\n#include(_DEFINENAME_,CLEARCOAT_TEXTURE_ROUGHNESS,_VARYINGNAME_,ClearCoatRoughness)\n#include(_DEFINENAME_,CLEARCOAT_BUMP,_VARYINGNAME_,ClearCoatBump)\n#include(_DEFINENAME_,CLEARCOAT_TINT_TEXTURE,_VARYINGNAME_,ClearCoatTint)\n#endif\n#ifdef IRIDESCENCE\n#include(_DEFINENAME_,IRIDESCENCE_TEXTURE,_VARYINGNAME_,Iridescence)\n#include(_DEFINENAME_,IRIDESCENCE_THICKNESS_TEXTURE,_VARYINGNAME_,IridescenceThickness)\n#endif\n#ifdef SHEEN\n#include(_DEFINENAME_,SHEEN_TEXTURE,_VARYINGNAME_,Sheen)\n#include(_DEFINENAME_,SHEEN_TEXTURE_ROUGHNESS,_VARYINGNAME_,SheenRoughness)\n#endif\n#ifdef ANISOTROPIC\n#include(_DEFINENAME_,ANISOTROPIC_TEXTURE,_VARYINGNAME_,Anisotropy)\n#endif\n#ifdef SUBSURFACE\n#include(_DEFINENAME_,SS_THICKNESSANDMASK_TEXTURE,_VARYINGNAME_,Thickness)\n#include(_DEFINENAME_,SS_REFRACTIONINTENSITY_TEXTURE,_VARYINGNAME_,RefractionIntensity)\n#include(_DEFINENAME_,SS_TRANSLUCENCYINTENSITY_TEXTURE,_VARYINGNAME_,TranslucencyIntensity)\n#include(_DEFINENAME_,SS_TRANSLUCENCYCOLOR_TEXTURE,_VARYINGNAME_,TranslucencyColor)\n#endif\nvarying vPositionW: vec3f;\n#if DEBUGMODE>0\nvarying vClipSpacePosition: vec4f;\n#endif\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\nvarying vEnvironmentIrradiance: vec3f;\n#include\n#endif\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vColor: vec4f;\n#endif\n#include\n#include\n#include\n#include[0..maxSimultaneousLights]\n#include\n#include[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vPositionUVW: vec3f;\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vDirectionW: vec3f;\n#endif\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#include\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvar positionUpdated: vec3f=vertexInputs.position;\n#ifdef NORMAL\nvar normalUpdated: vec3f=vertexInputs.normal;\n#endif\n#ifdef TANGENT\nvar tangentUpdated: vec4f=vertexInputs.tangent;\n#endif\n#ifdef UV1\nvar uvUpdated: vec2f=vertexInputs.uv;\n#endif\n#ifdef UV2\nvar uv2Updated: vec2f=vertexInputs.uv2;\n#endif\n#ifdef VERTEXCOLOR\nvar colorUpdated: vec4f=vertexInputs.color;\n#endif\n#include\n#include[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\nvertexOutputs.vPositionUVW=positionUpdated;\n#endif\n#define CUSTOM_VERTEX_UPDATE_POSITION\n#define CUSTOM_VERTEX_UPDATE_NORMAL\n#include\n#if defined(PREPASS) && ((defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR)) && !defined(BONES_VELOCITY_ENABLED)\nvertexOutputs.vCurrentPosition=scene.viewProjection*finalWorld*vec4f(positionUpdated,1.0);vertexOutputs.vPreviousPosition=uniforms.previousViewProjection*finalPreviousWorld*vec4f(positionUpdated,1.0);\n#endif\n#include\n#include\nvar worldPos: vec4f=finalWorld* vec4f(positionUpdated,1.0);vertexOutputs.vPositionW= worldPos.xyz;\n#ifdef PREPASS\n#include\n#endif\n#ifdef NORMAL\nvar normalWorld: mat3x3f= mat3x3f(finalWorld[0].xyz,finalWorld[1].xyz,finalWorld[2].xyz);\n#if defined(INSTANCES) && defined(THIN_INSTANCES)\nvertexOutputs.vNormalW=normalUpdated/ vec3f(dot(normalWorld[0],normalWorld[0]),dot(normalWorld[1],normalWorld[1]),dot(normalWorld[2],normalWorld[2]));vertexOutputs.vNormalW=normalize(normalWorld*vertexOutputs.vNormalW);\n#else\n#ifdef NONUNIFORMSCALING\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\n#endif\nvertexOutputs.vNormalW=normalize(normalWorld*normalUpdated);\n#endif\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\n#if BASE_DIFFUSE_MODEL != BRDF_DIFFUSE_MODEL_LAMBERT && BASE_DIFFUSE_MODEL != BRDF_DIFFUSE_MODEL_LEGACY\nvar viewDirectionW: vec3f=normalize(scene.vEyePosition.xyz-vertexOutputs.vPositionW);var NdotV: f32=max(dot(vertexOutputs.vNormalW,viewDirectionW),0.0);var roughNormal: vec3f=mix(vertexOutputs.vNormalW,viewDirectionW,(0.5*(1.0-NdotV))*uniforms.baseDiffuseRoughness);var reflectionVector: vec3f= (uniforms.reflectionMatrix* vec4f(roughNormal,0)).xyz;\n#else\nvar reflectionVector: vec3f= (uniforms.reflectionMatrix* vec4f(vertexOutputs.vNormalW,0)).xyz;\n#endif\n#ifdef REFLECTIONMAP_OPPOSITEZ\nreflectionVector.z*=-1.0;\n#endif\nvertexOutputs.vEnvironmentIrradiance=computeEnvironmentIrradiance(reflectionVector);\n#endif\n#endif\n#define CUSTOM_VERTEX_UPDATE_WORLDPOS\n#ifdef MULTIVIEW\nif (gl_ViewID_OVR==0u) {vertexOutputs.position=scene.viewProjection*worldPos;} else {vertexOutputs.position=scene.viewProjectionR*worldPos;}\n#else\nvertexOutputs.position=scene.viewProjection*worldPos;\n#endif\n#if DEBUGMODE>0\nvertexOutputs.vClipSpacePosition=vertexOutputs.position;\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvertexOutputs.vDirectionW=normalize((finalWorld*vec4f(positionUpdated,0.0)).xyz);\n#endif\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvertexOutputs.vViewDepth=(scene.view*worldPos).z;\n#endif\n#ifndef UV1\nvar uvUpdated: vec2f= vec2f(0.,0.);\n#endif\n#ifdef MAINUV1\nvertexOutputs.vMainUV1=uvUpdated;\n#endif\n#ifndef UV2\nvar uv2Updated: vec2f= vec2f(0.,0.);\n#endif\n#ifdef MAINUV2\nvertexOutputs.vMainUV2=uv2Updated;\n#endif\n#include[3..7]\n#include(_DEFINENAME_,ALBEDO,_VARYINGNAME_,Albedo,_MATRIXNAME_,albedo,_INFONAME_,AlbedoInfos.x)\n#include(_DEFINENAME_,BASE_WEIGHT,_VARYINGNAME_,BaseWeight,_MATRIXNAME_,baseWeight,_INFONAME_,BaseWeightInfos.x)\n#include(_DEFINENAME_,BASE_DIFFUSE_ROUGHNESS,_VARYINGNAME_,BaseDiffuseRoughness,_MATRIXNAME_,baseDiffuseRoughness,_INFONAME_,BaseDiffuseRoughnessInfos.x)\n#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail,_MATRIXNAME_,detail,_INFONAME_,DetailInfos.x)\n#include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_MATRIXNAME_,ambient,_INFONAME_,AmbientInfos.x)\n#include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_MATRIXNAME_,opacity,_INFONAME_,OpacityInfos.x)\n#include(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_MATRIXNAME_,emissive,_INFONAME_,EmissiveInfos.x)\n#include(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_MATRIXNAME_,lightmap,_INFONAME_,LightmapInfos.x)\n#include(_DEFINENAME_,REFLECTIVITY,_VARYINGNAME_,Reflectivity,_MATRIXNAME_,reflectivity,_INFONAME_,ReflectivityInfos.x)\n#include(_DEFINENAME_,MICROSURFACEMAP,_VARYINGNAME_,MicroSurfaceSampler,_MATRIXNAME_,microSurfaceSampler,_INFONAME_,MicroSurfaceSamplerInfos.x)\n#include(_DEFINENAME_,METALLIC_REFLECTANCE,_VARYINGNAME_,MetallicReflectance,_MATRIXNAME_,metallicReflectance,_INFONAME_,MetallicReflectanceInfos.x)\n#include(_DEFINENAME_,REFLECTANCE,_VARYINGNAME_,Reflectance,_MATRIXNAME_,reflectance,_INFONAME_,ReflectanceInfos.x)\n#include(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump,_MATRIXNAME_,bump,_INFONAME_,BumpInfos.x)\n#include(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_MATRIXNAME_,decal,_INFONAME_,DecalInfos.x)\n#ifdef CLEARCOAT\n#include(_DEFINENAME_,CLEARCOAT_TEXTURE,_VARYINGNAME_,ClearCoat,_MATRIXNAME_,clearCoat,_INFONAME_,ClearCoatInfos.x)\n#include(_DEFINENAME_,CLEARCOAT_TEXTURE_ROUGHNESS,_VARYINGNAME_,ClearCoatRoughness,_MATRIXNAME_,clearCoatRoughness,_INFONAME_,ClearCoatInfos.z)\n#include(_DEFINENAME_,CLEARCOAT_BUMP,_VARYINGNAME_,ClearCoatBump,_MATRIXNAME_,clearCoatBump,_INFONAME_,ClearCoatBumpInfos.x)\n#include(_DEFINENAME_,CLEARCOAT_TINT_TEXTURE,_VARYINGNAME_,ClearCoatTint,_MATRIXNAME_,clearCoatTint,_INFONAME_,ClearCoatTintInfos.x)\n#endif\n#ifdef IRIDESCENCE\n#include(_DEFINENAME_,IRIDESCENCE_TEXTURE,_VARYINGNAME_,Iridescence,_MATRIXNAME_,iridescence,_INFONAME_,IridescenceInfos.x)\n#include(_DEFINENAME_,IRIDESCENCE_THICKNESS_TEXTURE,_VARYINGNAME_,IridescenceThickness,_MATRIXNAME_,iridescenceThickness,_INFONAME_,IridescenceInfos.z)\n#endif\n#ifdef SHEEN\n#include(_DEFINENAME_,SHEEN_TEXTURE,_VARYINGNAME_,Sheen,_MATRIXNAME_,sheen,_INFONAME_,SheenInfos.x)\n#include(_DEFINENAME_,SHEEN_TEXTURE_ROUGHNESS,_VARYINGNAME_,SheenRoughness,_MATRIXNAME_,sheenRoughness,_INFONAME_,SheenInfos.z)\n#endif\n#ifdef ANISOTROPIC\n#include(_DEFINENAME_,ANISOTROPIC_TEXTURE,_VARYINGNAME_,Anisotropy,_MATRIXNAME_,anisotropy,_INFONAME_,AnisotropyInfos.x)\n#endif\n#ifdef SUBSURFACE\n#include(_DEFINENAME_,SS_THICKNESSANDMASK_TEXTURE,_VARYINGNAME_,Thickness,_MATRIXNAME_,thickness,_INFONAME_,ThicknessInfos.x)\n#include(_DEFINENAME_,SS_REFRACTIONINTENSITY_TEXTURE,_VARYINGNAME_,RefractionIntensity,_MATRIXNAME_,refractionIntensity,_INFONAME_,RefractionIntensityInfos.x)\n#include(_DEFINENAME_,SS_TRANSLUCENCYINTENSITY_TEXTURE,_VARYINGNAME_,TranslucencyIntensity,_MATRIXNAME_,translucencyIntensity,_INFONAME_,TranslucencyIntensityInfos.x)\n#include(_DEFINENAME_,SS_TRANSLUCENCYCOLOR_TEXTURE,_VARYINGNAME_,TranslucencyColor,_MATRIXNAME_,translucencyColor,_INFONAME_,TranslucencyColorInfos.x)\n#endif\n#include\n#include\n#include\n#include[0..maxSimultaneousLights]\n#include\n#include\n#define CUSTOM_VERTEX_MAIN_END\n}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},10740:(e,t,n)=>{function r(e){e.push("vCameraColorCurveNeutral","vCameraColorCurvePositive","vCameraColorCurveNegative")}n.d(t,{B:()=>r})},10752:(e,t,n)=>{n.r(t),n.d(t,{openpbrVertexShaderWGSL:()=>l});var r=n(98519),i=(n(97088),n(56213),n(14188),n(17393),n(61669),n(45699),n(27279),n(63866),n(84020),n(12520),n(44467),"openpbrNormalMapVertexDeclaration");r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="#if defined(GEOMETRY_NORMAL) || defined(PARALLAX) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC) || defined(FUZZ)\n#if defined(TANGENT) && defined(NORMAL) \nvarying vTBN0: vec3f;varying vTBN1: vec3f;varying vTBN2: vec3f;\n#endif\n#endif\n"),n(9436),n(79716),n(58902),n(73683),n(68478),n(38197),n(98819),n(77320),n(21310),n(3641),n(86615),n(21954),n(28981),n(88380);var o="openpbrNormalMapVertex";r.l.IncludesShadersStoreWGSL[o]||(r.l.IncludesShadersStoreWGSL[o]="#if defined(GEOMETRY_NORMAL) || defined(PARALLAX) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC) || defined(FUZZ)\n#if defined(TANGENT) && defined(NORMAL)\nvar tbnNormal: vec3f=normalize(normalUpdated);var tbnTangent: vec3f=normalize(tangentUpdated.xyz);var tbnBitangent: vec3f=cross(tbnNormal,tbnTangent)*tangentUpdated.w;var matTemp= mat3x3f(finalWorld[0].xyz,finalWorld[1].xyz,finalWorld[2].xyz)* mat3x3f(tbnTangent,tbnBitangent,tbnNormal);vertexOutputs.vTBN0=matTemp[0];vertexOutputs.vTBN1=matTemp[1];vertexOutputs.vTBN2=matTemp[2];\n#endif\n#endif\n"),n(63002),n(70898),n(59115),n(50615),n(55607);var a="openpbrVertexShader",s="#define OPENPBR_VERTEX_SHADER\n#include\n#define CUSTOM_VERTEX_BEGIN\nattribute position: vec3f;\n#ifdef NORMAL\nattribute normal: vec3f;\n#endif\n#ifdef TANGENT\nattribute tangent: vec4f;\n#endif\n#ifdef UV1\nattribute uv: vec2f;\n#endif\n#include[2..7]\n#include[1..7]\n#ifdef VERTEXCOLOR\nattribute color: vec4f;\n#endif\n#include\n#include\n#include\n#include\n#include\n#include\n#include(_DEFINENAME_,BASE_COLOR,_VARYINGNAME_,BaseColor)\n#include(_DEFINENAME_,BASE_WEIGHT,_VARYINGNAME_,BaseWeight)\n#include(_DEFINENAME_,BASE_DIFFUSE_ROUGHNESS,_VARYINGNAME_,BaseDiffuseRoughness)\n#include(_DEFINENAME_,BASE_METALNESS,_VARYINGNAME_,BaseMetalness)\n#include(_DEFINENAME_,SPECULAR_WEIGHT,_VARYINGNAME_,SpecularWeight)\n#include(_DEFINENAME_,SPECULAR_COLOR,_VARYINGNAME_,SpecularColor)\n#include(_DEFINENAME_,SPECULAR_ROUGHNESS,_VARYINGNAME_,SpecularRoughness)\n#include(_DEFINENAME_,SPECULAR_ROUGHNESS_ANISOTROPY,_VARYINGNAME_,SpecularRoughnessAnisotropy)\n#include(_DEFINENAME_,COAT_WEIGHT,_VARYINGNAME_,CoatWeight)\n#include(_DEFINENAME_,COAT_COLOR,_VARYINGNAME_,CoatColor)\n#include(_DEFINENAME_,COAT_ROUGHNESS,_VARYINGNAME_,CoatRoughness)\n#include(_DEFINENAME_,COAT_ROUGHNESS_ANISOTROPY,_VARYINGNAME_,CoatRoughnessAnisotropy)\n#include(_DEFINENAME_,COAT_DARKENING,_VARYINGNAME_,CoatDarkening)\n#include(_DEFINENAME_,FUZZ_WEIGHT,_VARYINGNAME_,FuzzWeight)\n#include(_DEFINENAME_,FUZZ_COLOR,_VARYINGNAME_,FuzzColor)\n#include(_DEFINENAME_,FUZZ_ROUGHNESS,_VARYINGNAME_,FuzzRoughness)\n#include(_DEFINENAME_,GEOMETRY_NORMAL,_VARYINGNAME_,GeometryNormal)\n#include(_DEFINENAME_,GEOMETRY_TANGENT,_VARYINGNAME_,GeometryTangent)\n#include(_DEFINENAME_,GEOMETRY_COAT_NORMAL,_VARYINGNAME_,GeometryCoatNormal)\n#include(_DEFINENAME_,GEOMETRY_OPACITY,_VARYINGNAME_,GeometryOpacity)\n#include(_DEFINENAME_,EMISSION_COLOR,_VARYINGNAME_,EmissionColor)\n#include(_DEFINENAME_,THIN_FILM_WEIGHT,_VARYINGNAME_,ThinFilmWeight)\n#include(_DEFINENAME_,THIN_FILM_THICKNESS,_VARYINGNAME_,ThinFilmThickness)\n#include(_DEFINENAME_,AMBIENT_OCCLUSION,_VARYINGNAME_,AmbientOcclusion)\n#include(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal)\n#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail)\nvarying vPositionW: vec3f;\n#if DEBUGMODE>0\nvarying vClipSpacePosition: vec4f;\n#endif\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\nvarying vEnvironmentIrradiance: vec3f;\n#include\n#endif\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vColor: vec4f;\n#endif\n#include\n#include\n#include\n#include[0..maxSimultaneousLights]\n#include\n#include[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vPositionUVW: vec3f;\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vDirectionW: vec3f;\n#endif\n#include\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvar positionUpdated: vec3f=vertexInputs.position;\n#ifdef NORMAL\nvar normalUpdated: vec3f=vertexInputs.normal;\n#endif\n#ifdef TANGENT\nvar tangentUpdated: vec4f=vertexInputs.tangent;\n#endif\n#ifdef UV1\nvar uvUpdated: vec2f=vertexInputs.uv;\n#endif\n#ifdef UV2\nvar uv2Updated: vec2f=vertexInputs.uv2;\n#endif\n#ifdef VERTEXCOLOR\nvar colorUpdated: vec4f=vertexInputs.color;\n#endif\n#include\n#include[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\nvertexOutputs.vPositionUVW=positionUpdated;\n#endif\n#define CUSTOM_VERTEX_UPDATE_POSITION\n#define CUSTOM_VERTEX_UPDATE_NORMAL\n#include\n#if defined(PREPASS) && ((defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR)) && !defined(BONES_VELOCITY_ENABLED)\nvertexOutputs.vCurrentPosition=scene.viewProjection*finalWorld*vec4f(positionUpdated,1.0);vertexOutputs.vPreviousPosition=uniforms.previousViewProjection*finalPreviousWorld*vec4f(positionUpdated,1.0);\n#endif\n#include\n#include\nvar worldPos: vec4f=finalWorld* vec4f(positionUpdated,1.0);vertexOutputs.vPositionW= worldPos.xyz;\n#ifdef PREPASS\n#include\n#endif\n#ifdef NORMAL\nvar normalWorld: mat3x3f= mat3x3f(finalWorld[0].xyz,finalWorld[1].xyz,finalWorld[2].xyz);\n#if defined(INSTANCES) && defined(THIN_INSTANCES)\nvertexOutputs.vNormalW=normalUpdated/ vec3f(dot(normalWorld[0],normalWorld[0]),dot(normalWorld[1],normalWorld[1]),dot(normalWorld[2],normalWorld[2]));vertexOutputs.vNormalW=normalize(normalWorld*vertexOutputs.vNormalW);\n#else\n#ifdef NONUNIFORMSCALING\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\n#endif\nvertexOutputs.vNormalW=normalize(normalWorld*normalUpdated);\n#endif\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\n#if BASE_DIFFUSE_MODEL != BRDF_DIFFUSE_MODEL_LAMBERT && BASE_DIFFUSE_MODEL != BRDF_DIFFUSE_MODEL_LEGACY\nvar viewDirectionW: vec3f=normalize(scene.vEyePosition.xyz-vertexOutputs.vPositionW);var NdotV: f32=max(dot(vertexOutputs.vNormalW,viewDirectionW),0.0);var roughNormal: vec3f=mix(vertexOutputs.vNormalW,viewDirectionW,(0.5*(1.0-NdotV))*uniforms.vBaseDiffuseRoughness);var reflectionVector: vec3f= (uniforms.reflectionMatrix* vec4f(roughNormal,0)).xyz;\n#else\nvar reflectionVector: vec3f= (uniforms.reflectionMatrix* vec4f(vertexOutputs.vNormalW,0)).xyz;\n#endif\n#ifdef REFLECTIONMAP_OPPOSITEZ\nreflectionVector.z*=-1.0;\n#endif\nvertexOutputs.vEnvironmentIrradiance=computeEnvironmentIrradiance(reflectionVector);\n#endif\n#endif\n#define CUSTOM_VERTEX_UPDATE_WORLDPOS\n#ifdef MULTIVIEW\nif (gl_ViewID_OVR==0u) {vertexOutputs.position=scene.viewProjection*worldPos;} else {vertexOutputs.position=scene.viewProjectionR*worldPos;}\n#else\nvertexOutputs.position=scene.viewProjection*worldPos;\n#endif\n#if DEBUGMODE>0\nvertexOutputs.vClipSpacePosition=vertexOutputs.position;\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvertexOutputs.vDirectionW=normalize((finalWorld*vec4f(positionUpdated,0.0)).xyz);\n#endif\n#ifndef UV1\nvar uvUpdated: vec2f= vec2f(0.,0.);\n#endif\n#ifdef MAINUV1\nvertexOutputs.vMainUV1=uvUpdated;\n#endif\n#ifndef UV2\nvar uv2Updated: vec2f= vec2f(0.,0.);\n#endif\n#ifdef MAINUV2\nvertexOutputs.vMainUV2=uv2Updated;\n#endif\n#include[3..7]\n#include(_DEFINENAME_,BASE_COLOR,_VARYINGNAME_,BaseColor,_MATRIXNAME_,baseColor,_INFONAME_,BaseColorInfos.x)\n#include(_DEFINENAME_,BASE_WEIGHT,_VARYINGNAME_,BaseWeight,_MATRIXNAME_,baseWeight,_INFONAME_,BaseWeightInfos.x)\n#include(_DEFINENAME_,BASE_DIFFUSE_ROUGHNESS,_VARYINGNAME_,BaseDiffuseRoughness,_MATRIXNAME_,baseDiffuseRoughness,_INFONAME_,BaseDiffuseRoughnessInfos.x)\n#include(_DEFINENAME_,BASE_METALNESS,_VARYINGNAME_,BaseMetalness,_MATRIXNAME_,baseMetalness,_INFONAME_,BaseMetalnessInfos.x)\n#include(_DEFINENAME_,SPECULAR_WEIGHT,_VARYINGNAME_,SpecularWeight,_MATRIXNAME_,specularWeight,_INFONAME_,SpecularWeightInfos.x)\n#include(_DEFINENAME_,SPECULAR_COLOR,_VARYINGNAME_,SpecularColor,_MATRIXNAME_,specularColor,_INFONAME_,SpecularColorInfos.x)\n#include(_DEFINENAME_,SPECULAR_ROUGHNESS,_VARYINGNAME_,SpecularRoughness,_MATRIXNAME_,specularRoughness,_INFONAME_,SpecularRoughnessInfos.x)\n#include(_DEFINENAME_,SPECULAR_ROUGHNESS_ANISOTROPY,_VARYINGNAME_,SpecularRoughnessAnisotropy,_MATRIXNAME_,specularRoughnessAnisotropy,_INFONAME_,SpecularRoughnessAnisotropyInfos.x)\n#include(_DEFINENAME_,COAT_WEIGHT,_VARYINGNAME_,CoatWeight,_MATRIXNAME_,coatWeight,_INFONAME_,CoatWeightInfos.x)\n#include(_DEFINENAME_,COAT_COLOR,_VARYNAME_,CoatColor,_MATRIXNAME_,coatColor,_INFONAME_,CoatColorInfos.x)\n#include(_DEFINENAME_,COAT_ROUGHNESS,_VARYINGNAME_,CoatRoughness,_MATRIXNAME_,coatRoughness,_INFONAME_,CoatRoughnessInfos.x)\n#include(_DEFINENAME_,COAT_ROUGHNESS_ANISOTROPY,_VARYINGNAME_,CoatRoughnessAnisotropy,_MATRIXNAME_,coatRoughnessAnisotropy,_INFONAME_,CoatRoughnessAnisotropyInfos.x)\n#include(_DEFINENAME_,COAT_DARKENING,_VARYINGNAME_,CoatDarkening,_MATRIXNAME_,coatDarkening,_INFONAME_,CoatDarkeningInfos.x)\n#include(_DEFINENAME_,FUZZ_WEIGHT,_VARYINGNAME_,FuzzWeight,_MATRIXNAME_,fuzzWeight,_INFONAME_,FuzzWeightInfos.x)\n#include(_DEFINENAME_,FUZZ_COLOR,_VARYINGNAME_,FuzzColor,_MATRIXNAME_,fuzzColor,_INFONAME_,FuzzColorInfos.x)\n#include(_DEFINENAME_,FUZZ_ROUGHNESS,_VARYINGNAME_,FuzzRoughness,_MATRIXNAME_,fuzzRoughness,_INFONAME_,FuzzRoughnessInfos.x)\n#include(_DEFINENAME_,GEOMETRY_NORMAL,_VARYINGNAME_,GeometryNormal,_MATRIXNAME_,geometryNormal,_INFONAME_,GeometryNormalInfos.x)\n#include(_DEFINENAME_,GEOMETRY_TANGENT,_VARYINGNAME_,GeometryTangent,_MATRIXNAME_,geometryTangent,_INFONAME_,GeometryTangentInfos.x)\n#include(_DEFINENAME_,GEOMETRY_COAT_NORMAL,_VARYINGNAME_,GeometryCoatNormal,_MATRIXNAME_,geometryCoatNormal,_INFONAME_,GeometryCoatNormalInfos.x)\n#include(_DEFINENAME_,GEOMETRY_OPACITY,_VARYINGNAME_,GeometryOpacity,_MATRIXNAME_,geometryOpacity,_INFONAME_,GeometryOpacityInfos.x)\n#include(_DEFINENAME_,EMISSION_COLOR,_VARYINGNAME_,EmissionColor,_MATRIXNAME_,emissionColor,_INFONAME_,EmissionColorInfos.x)\n#include(_DEFINENAME_,THIN_FILM_WEIGHT,_VARYINGNAME_,ThinFilmWeight,_MATRIXNAME_,thinFilmWeight,_INFONAME_,ThinFilmWeightInfos.x)\n#include(_DEFINENAME_,THIN_FILM_THICKNESS,_VARYINGNAME_,ThinFilmThickness,_MATRIXNAME_,thinFilmThickness,_INFONAME_,ThinFilmThicknessInfos.x)\n#include(_DEFINENAME_,AMBIENT_OCCLUSION,_VARYINGNAME_,AmbientOcclusion,_MATRIXNAME_,ambientOcclusion,_INFONAME_,AmbientOcclusionInfos.x)\n#include(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_MATRIXNAME_,decal,_INFONAME_,DecalInfos.x)\n#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail,_MATRIXNAME_,detail,_INFONAME_,DetailInfos.x)\n#include\n#include\n#include\n#include[0..maxSimultaneousLights]\n#include\n#include\n#define CUSTOM_VERTEX_MAIN_END\n}";r.l.ShadersStoreWGSL[a]||(r.l.ShadersStoreWGSL[a]=s);var l={name:a,shader:s}},10809:(e,t,n)=>{n.r(t),n.d(t,{FlowGraphDataSwitchBlock:()=>l});var r=n(78322),i=n(45749),o=n(88099),a=n(95803),s=n(34623),l=function(e){function t(t){var n=e.call(this,t)||this;n.config=t,n._inputCases=new Map,n.case=n.registerDataInput("case",o.Vv,NaN),n.default=n.registerDataInput("default",o.Vv),n.value=n.registerDataOutput("value",o.Vv);for(var r=0,i=n.config.cases||[];r{n.r(t),n.d(t,{lightUboDeclarationWGSL:()=>a});var r=n(98519),i="lightUboDeclaration",o="#ifdef LIGHT{X}\nstruct Light{X}\n{vLightData: vec4f,\nvLightDiffuse: vec4f,\nvLightSpecular: vec4f,\n#ifdef SPOTLIGHT{X}\nvLightDirection: vec4f,\nvLightFalloff: vec4f,\n#elif defined(POINTLIGHT{X})\nvLightFalloff: vec4f,\n#elif defined(HEMILIGHT{X})\nvLightGround: vec3f,\n#elif defined(CLUSTLIGHT{X})\nvSliceData: vec2f,\nvSliceRanges: array,\n#endif\n#if defined(AREALIGHT{X})\nvLightWidth: vec4f,\nvLightHeight: vec4f,\n#endif\nshadowsInfo: vec4f,\ndepthValues: vec2f} ;var light{X} : Light{X};\n#ifdef IESLIGHTTEXTURE{X}\nvar iesLightTexture{X}Sampler: sampler;var iesLightTexture{X}: texture_2d;\n#endif\n#ifdef PROJECTEDLIGHTTEXTURE{X}\nuniform textureProjectionMatrix{X}: mat4x4f;var projectionLightTexture{X}Sampler: sampler;var projectionLightTexture{X}: texture_2d;\n#endif\n#ifdef CLUSTLIGHT{X}\nvar lightDataTexture{X}: texture_2d;var tileMaskBuffer{X}: array;\n#endif\n#ifdef SHADOW{X}\n#ifdef SHADOWCSM{X}\nuniform lightMatrix{X}: array;uniform viewFrustumZ{X}: array;uniform frustumLengths{X}: array;uniform cascadeBlendFactor{X}: f32;varying vPositionFromLight{X}_0: vec4f;varying vDepthMetric{X}_0: f32;varying vPositionFromLight{X}_1: vec4f;varying vDepthMetric{X}_1: f32;varying vPositionFromLight{X}_2: vec4f;varying vDepthMetric{X}_2: f32;varying vPositionFromLight{X}_3: vec4f;varying vDepthMetric{X}_3: f32;varying vPositionFromCamera{X}: vec4f;var vPositionFromLight{X}: array;var vDepthMetric{X} : array;\n#if defined(SHADOWPCSS{X})\nvar shadowTexture{X}Sampler: sampler_comparison; \nvar shadowTexture{X}: texture_depth_2d_array;var depthTexture{X}Sampler: sampler;var depthTexture{X}: texture_2d_array;uniform lightSizeUVCorrection{X}: array;uniform depthCorrection{X}: array;uniform penumbraDarkness{X}: f32;\n#elif defined(SHADOWPCF{X})\nvar shadowTexture{X}Sampler: sampler_comparison;var shadowTexture{X}: texture_depth_2d_array;\n#else \nvar shadowTexture{X}Sampler: sampler; \nvar shadowTexture{X}: texture_2d_array;\n#endif\n#ifdef SHADOWCSMDEBUG{X}\nconst vCascadeColorsMultiplier{X}: array=array\n(\nvec3f ( 1.5,0.0,0.0 ),\nvec3f ( 0.0,1.5,0.0 ),\nvec3f ( 0.0,0.0,5.5 ),\nvec3f ( 1.5,0.0,5.5 ),\nvec3f ( 1.5,1.5,0.0 ),\nvec3f ( 1.0,1.0,1.0 ),\nvec3f ( 0.0,1.0,5.5 ),\nvec3f ( 0.5,3.5,0.75 )\n);\n#endif\n#elif defined(SHADOWCUBE{X})\nvar shadowTexture{X}Sampler: sampler;var shadowTexture{X}: texture_cube;\n#else\nvarying vPositionFromLight{X}: vec4f;varying vDepthMetric{X}: f32;\n#if defined(SHADOWPCSS{X})\nvar shadowTexture{X}Sampler: sampler_comparison; \nvar shadowTexture{X}: texture_depth_2d;var depthTexture{X}Sampler: sampler; \nvar depthTexture{X}: texture_2d;\n#elif defined(SHADOWPCF{X})\nvar shadowTexture{X}Sampler: sampler_comparison;var shadowTexture{X}: texture_depth_2d;\n#else\nvar shadowTexture{X}Sampler: sampler; \nvar shadowTexture{X}: texture_2d;\n#endif\nuniform lightMatrix{X}: mat4x4f;\n#endif\n#endif\n#endif\n";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]=o);var a={name:i,shader:o}},11135:(e,t,n)=>{var r=n(98519),i="oitFragment";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#ifdef ORDER_INDEPENDENT_TRANSPARENCY\nfloat fragDepth=gl_FragCoord.z; \n#ifdef ORDER_INDEPENDENT_TRANSPARENCY_16BITS\nuint halfFloat=packHalf2x16(vec2(fragDepth));vec2 full=unpackHalf2x16(halfFloat);fragDepth=full.x;\n#endif\nivec2 fragCoord=ivec2(gl_FragCoord.xy);vec2 lastDepth=texelFetch(oitDepthSampler,fragCoord,0).rg;vec4 lastFrontColor=texelFetch(oitFrontColorSampler,fragCoord,0);depth.rg=vec2(-MAX_DEPTH);frontColor=lastFrontColor;backColor=vec4(0.0);\n#ifdef USE_REVERSE_DEPTHBUFFER\nfloat furthestDepth=-lastDepth.x;float nearestDepth=lastDepth.y;\n#else\nfloat nearestDepth=-lastDepth.x;float furthestDepth=lastDepth.y;\n#endif\nfloat alphaMultiplier=1.0-lastFrontColor.a;\n#ifdef USE_REVERSE_DEPTHBUFFER\nif (fragDepth>nearestDepth || fragDepthfurthestDepth) {\n#endif\nreturn;}\n#ifdef USE_REVERSE_DEPTHBUFFER\nif (fragDepthfurthestDepth) {\n#else\nif (fragDepth>nearestDepth && fragDepth{function r(e,t){for(var n=[],r=0;ra,ln:()=>i,mI:()=>r});var o=["push","splice","pop","shift","unshift"];function a(e,t){var n=o.map((function(n){return function(e,t,n){var r=e[t];if("function"!=typeof r)return null;var i=function(){var r=e.length,o=i.previous.apply(e,arguments);return n(t,r),o};return r.next=i,i.previous=r,e[t]=i,function(){var n=i.previous;if(n){var r=i.next;r?(n.next=r,r.previous=n):(n.next=void 0,e[t]=n),i.next=void 0,i.previous=void 0}}}(e,n,t)}));return function(){for(var e=0,t=n;e{n.r(t),n.d(t,{iblCdfDebugPixelShader:()=>a});var r=n(98519),i="iblCdfDebugPixelShader",o="precision highp samplerCube;\n#define PI 3.1415927\nvarying vec2 vUV;uniform sampler2D cdfy;uniform sampler2D cdfx;uniform sampler2D icdf;uniform sampler2D pdf;\n#ifdef IBL_USE_CUBE_MAP\nuniform samplerCube iblSource;\n#else\nuniform sampler2D iblSource;\n#endif\nuniform sampler2D textureSampler;\n#define cdfyVSize (0.8/3.0)\n#define cdfxVSize 0.1\n#define cdfyHSize 0.5\nuniform vec4 sizeParams;\n#define offsetX sizeParams.x\n#define offsetY sizeParams.y\n#define widthScale sizeParams.z\n#define heightScale sizeParams.w\n#ifdef IBL_USE_CUBE_MAP\nvec3 equirectangularToCubemapDirection(vec2 uv) {float longitude=uv.x*2.0*PI-PI;float latitude=PI*0.5-uv.y*PI;vec3 direction;direction.x=cos(latitude)*sin(longitude);direction.y=sin(latitude);direction.z=cos(latitude)*cos(longitude);return direction;}\n#endif\nvoid main(void) {vec3 colour=vec3(0.0);vec2 uv =\nvec2((offsetX+vUV.x)*widthScale,(offsetY+vUV.y)*heightScale);vec3 backgroundColour=texture2D(textureSampler,vUV).rgb;int cdfxWidth=textureSize(cdfx,0).x;int cdfyHeight=textureSize(cdfy,0).y;const float iblStart=1.0-cdfyVSize;const float pdfStart=1.0-2.0*cdfyVSize;const float cdfyStart=1.0-3.0*cdfyVSize;const float cdfxStart=1.0-3.0*cdfyVSize-cdfxVSize;const float icdfxStart=1.0-3.0*cdfyVSize-2.0*cdfxVSize;\n#ifdef IBL_USE_CUBE_MAP\nvec3 direction=equirectangularToCubemapDirection(\n(uv-vec2(0.0,iblStart))*vec2(1.0,1.0/cdfyVSize));vec3 iblColour=textureCubeLodEXT(iblSource,direction,0.0).rgb;\n#else\nvec3 iblColour=texture2D(iblSource,(uv-vec2(0.0,iblStart)) *\nvec2(1.0,1.0/cdfyVSize))\n.rgb;\n#endif\nvec3 pdfColour=texture(icdf,(uv-vec2(0.0,pdfStart)) *\nvec2(1.0,1.0/cdfyVSize)).zzz;float cdfyColour =\ntexture2D(cdfy,(uv-vec2(0.0,cdfyStart))*vec2(2.0,1.0/cdfyVSize))\n.r;float icdfyColour =\ntexture2D(icdf,(uv-vec2(0.5,cdfyStart))*vec2(2.0,1.0/cdfyVSize))\n.g;float cdfxColour =\ntexture2D(cdfx,(uv-vec2(0.0,cdfxStart))*vec2(1.0,1.0/cdfxVSize))\n.r;float icdfxColour=texture2D(icdf,(uv-vec2(0.0,icdfxStart)) *\nvec2(1.0,1.0/cdfxVSize))\n.r;if (uv.x<0.0 || uv.x>1.0 || uv.y<0.0 || uv.y>1.0) {colour=backgroundColour;} else if (uv.y>iblStart) {colour+=iblColour;} else if (uv.y>pdfStart) {colour+=pdfColour;} else if (uv.y>cdfyStart && uv.x<0.5) {colour.r+=cdfyColour/float(cdfyHeight);} else if (uv.y>cdfyStart && uv.x>0.5) {colour.r+=icdfyColour;} else if (uv.y>cdfxStart) {colour.r+=cdfxColour/float(cdfxWidth);} else if (uv.y>icdfxStart) {colour.r+=icdfxColour;}\ngl_FragColor=vec4(colour,1.0);glFragColor.rgb=mix(gl_FragColor.rgb,backgroundColour,0.5);}\n";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},11741:(e,t,n)=>{n.d(t,{Qh:()=>d,jK:()=>l});var r,i=n(78322),o=n(66377),a=n(93540),s=n(67367);!function(e){e[e.NormalizedViewDepth=0]="NormalizedViewDepth",e[e.ViewDepth=1]="ViewDepth",e[e.ScreenDepth=2]="ScreenDepth"}(r||(r={}));var l=function(e){function t(n,r,o,a){void 0===r&&(r=null),void 0===o&&(o="");var l=e.call(this,(0,i.Cl)((0,i.Cl)({},a),{name:n,engine:r||s.N.LastCreatedEngine,useShaderStore:!0,useAsPostProcess:!0,fragmentShader:t.FragmentUrl,uniforms:t.Uniforms,defines:o}))||this;return l.textureWidth=0,l.textureHeight=0,l}return(0,i.C6)(t,e),t.prototype._gatherImports=function(e,t){e?(this._webGPUReady=!0,t.push(Promise.resolve().then(n.bind(n,57315)))):t.push(Promise.resolve().then(n.bind(n,40880)))},t.prototype.bind=function(t){void 0===t&&(t=!1),e.prototype.bind.call(this,t);var n=this.drawWrapper.effect;1===this.textureWidth||1===this.textureHeight?n.setInt2("texSize",this.textureWidth,this.textureHeight):n.setFloat2("texSize",this.textureWidth,this.textureHeight)},t.FragmentUrl="minmaxRedux",t.Uniforms=["texSize"],t}(a.$),c=new Float32Array(4),u=new Uint8Array(4),h={min:0,max:0},d=function(){function e(e,t){void 0===t&&(t=!0),this.onAfterReductionPerformed=new o.cP,this._textureWidth=0,this._textureHeight=0,this._scene=e,this._depthRedux=t,this.reductionSteps=[]}return Object.defineProperty(e.prototype,"depthRedux",{get:function(){return this._depthRedux},set:function(e){this._depthRedux!==e&&(this._depthRedux=e,this._recreatePostProcesses())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textureWidth",{get:function(){return this._textureWidth},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textureHeight",{get:function(){return this._textureHeight},enumerable:!1,configurable:!0}),e.prototype.setTextureDimensions=function(e,t,n){return void 0===n&&(n=0),(e!==this._textureWidth||t!==this._textureHeight||n!==this._depthTextureType)&&(this._textureWidth=e,this._textureHeight=t,this._depthTextureType=n,this._recreatePostProcesses(),!0)},e.prototype.readMinMax=function(e){var t=e.type===s.N.TEXTURETYPE_FLOAT||e.type===s.N.TEXTURETYPE_HALF_FLOAT,n=t?c:u;this._scene.getEngine()._readTexturePixels(e,1,1,-1,0,n,!1),h.min=n[0],h.max=n[1],t||(h.min=h.min/255,h.max=h.max/255),h.min>=h.max&&(h.min=0,h.max=1),this.onAfterReductionPerformed.notifyObservers(h)},e.prototype.dispose=function(e){void 0===e&&(e=!0),e&&(this.onAfterReductionPerformed.clear(),this._textureWidth=0,this._textureHeight=0);for(var t=0;t1||n>1;){t=Math.max(Math.round(t/2),1),n=Math.max(Math.round(n/2),1);var o=new l("Reduction phase "+i,e.getEngine(),"#define "+(1==t&&1==n?"LAST":1==t||1==n?"ONEBEFORELAST":"MAIN"));o.textureWidth=t,o.textureHeight=n,this.reductionSteps.push(o),i++}},e}()},11751:(e,t,n)=>{var r=n(98519),i=(n(14236),"pbrDirectLightingSetupFunctions");r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="struct preLightingInfo\n{lightOffset: vec3f,\nlightDistanceSquared: f32,\nlightDistance: f32,\nattenuation: f32,\nL: vec3f,\nH: vec3f,\nNdotV: f32,\nNdotLUnclamped: f32,\nNdotL: f32,\nVdotH: f32,\nLdotV: f32,\nroughness: f32,\ndiffuseRoughness: f32,\nsurfaceAlbedo: vec3f,\n#ifdef IRIDESCENCE\niridescenceIntensity: f32\n#endif\n#if defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)\nareaLightDiffuse: vec3f,\n#ifdef SPECULARTERM\nareaLightSpecular: vec3f,\nareaLightFresnel: vec4f\n#endif\n#endif\n};fn computePointAndSpotPreLightingInfo(lightData: vec4f,V: vec3f,N: vec3f,posW: vec3f)->preLightingInfo {var result: preLightingInfo;result.lightOffset=lightData.xyz-posW;result.lightDistanceSquared=dot(result.lightOffset,result.lightOffset);result.lightDistance=sqrt(result.lightDistanceSquared);result.L=normalize(result.lightOffset);result.H=normalize(V+result.L);result.VdotH=saturate(dot(V,result.H));result.NdotLUnclamped=dot(N,result.L);result.NdotL=saturateEps(result.NdotLUnclamped);return result;}\nfn computeDirectionalPreLightingInfo(lightData: vec4f,V: vec3f,N: vec3f)->preLightingInfo {var result: preLightingInfo;result.lightDistance=length(-lightData.xyz);result.L=normalize(-lightData.xyz);result.H=normalize(V+result.L);result.VdotH=saturate(dot(V,result.H));result.NdotLUnclamped=dot(N,result.L);result.NdotL=saturateEps(result.NdotLUnclamped);result.LdotV=dot(result.L,V);return result;}\nfn computeHemisphericPreLightingInfo(lightData: vec4f,V: vec3f,N: vec3f)->preLightingInfo {var result: preLightingInfo;result.NdotL=dot(N,lightData.xyz)*0.5+0.5;result.NdotL=saturateEps(result.NdotL);result.NdotLUnclamped=result.NdotL;\n#ifdef SPECULARTERM\nresult.L=normalize(lightData.xyz);result.H=normalize(V+result.L);result.VdotH=saturate(dot(V,result.H));\n#endif\nreturn result;}\n#if defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)\n#include\nvar areaLightsLTC1SamplerSampler: sampler;var areaLightsLTC1Sampler: texture_2d;var areaLightsLTC2SamplerSampler: sampler;var areaLightsLTC2Sampler: texture_2d;fn computeAreaPreLightingInfo(ltc1: texture_2d,ltc1Sampler:sampler,ltc2:texture_2d,ltc2Sampler:sampler,viewDirectionW: vec3f,vNormal:vec3f,vPosition:vec3f,lightCenter:vec3f,halfWidth:vec3f, halfHeight:vec3f,roughness:f32)->preLightingInfo {var result: preLightingInfo;var data: areaLightData=computeAreaLightSpecularDiffuseFresnel(ltc1,ltc1Sampler,ltc2,ltc2Sampler,viewDirectionW,vNormal,vPosition,lightCenter,halfWidth,halfHeight,roughness);\n#ifdef SPECULARTERM\nresult.areaLightFresnel=data.Fresnel;result.areaLightSpecular=data.Specular;\n#endif\nresult.areaLightDiffuse+=data.Diffuse;return result;}\n#endif\n")},12028:(e,t,n)=>{n.d(t,{p:()=>c});var r=n(41190),i=n(31985),o=n(64726),a=n(8046),s=n(36729),l=function(e,t,n,r){void 0===r&&(r={});var o=e();i.Y&&i.Y.HasTags(t)&&i.Y.AddTagsTo(o,i.Y.GetTags(t,!0));var a=(0,s.K)(o),l={};for(var u in a){var h=a[u],d=t[u],p=h.type;if(null!=d&&("uniqueId"!==u||c.AllowLoadingUniqueId))switch(p){case 0:case 6:case 9:case 11:o[u]=d;break;case 1:r.cloneTexturesOnlyOnce&&l[d.uniqueId]?o[u]=l[d.uniqueId]:(o[u]=n||d.isRenderTarget?d:d.clone(),l[d.uniqueId]=o[u]);break;case 2:case 3:case 4:case 5:case 7:case 8:case 10:case 12:o[u]=n?d:d.clone()}}return o},c=function(){function e(){}return e.AppendSerializedAnimations=function(e,t){if(e.animations){t.animations=[];for(var n=0;n{n.r(t),n.d(t,{screenSpaceReflection2BlurPixelShader:()=>a});var r=n(98519),i="screenSpaceReflection2BlurPixelShader",o="#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\n#define TEXTUREFUNC(s,c,lod) texture2DLodEXT(s,c,lod)\n#else\n#define TEXTUREFUNC(s,c,bias) texture2D(s,c,bias)\n#endif\nuniform sampler2D textureSampler;varying vec2 vUV;uniform vec2 texelOffsetScale;const float weights[8]=float[8] (0.071303,0.131514,0.189879,0.321392,0.452906, 0.584419,0.715932,0.847445);void processSample(vec2 uv,float i,vec2 stepSize,inout vec4 accumulator,inout float denominator)\n{vec2 offsetUV=stepSize*i+uv;float coefficient=weights[int(2.0-abs(i))];accumulator+=TEXTUREFUNC(textureSampler,offsetUV,0.0)*coefficient;denominator+=coefficient;}\nvoid main()\n{vec4 colorFull=TEXTUREFUNC(textureSampler,vUV,0.0);if (dot(colorFull,vec4(1.0))==0.0) {gl_FragColor=colorFull;return;}\nfloat blurRadius=colorFull.a*255.0; \nvec2 stepSize=texelOffsetScale.xy*blurRadius;vec4 accumulator=TEXTUREFUNC(textureSampler,vUV,0.0)*0.214607;float denominator=0.214607;processSample(vUV,1.0,stepSize,accumulator,denominator);processSample(vUV,1.0*0.2,stepSize,accumulator,denominator);processSample(vUV,1.0*0.4,stepSize,accumulator,denominator);processSample(vUV,1.0*0.6,stepSize,accumulator,denominator);processSample(vUV,1.0*0.8,stepSize,accumulator,denominator);processSample(vUV,1.0*1.2,stepSize,accumulator,denominator);processSample(vUV,1.0*1.4,stepSize,accumulator,denominator);processSample(vUV,1.0*1.6,stepSize,accumulator,denominator);processSample(vUV,1.0*1.8,stepSize,accumulator,denominator);processSample(vUV,1.0*2.0,stepSize,accumulator,denominator);processSample(vUV,-1.0,stepSize,accumulator,denominator);processSample(vUV,-1.0*0.2,stepSize,accumulator,denominator);processSample(vUV,-1.0*0.4,stepSize,accumulator,denominator);processSample(vUV,-1.0*0.6,stepSize,accumulator,denominator);processSample(vUV,-1.0*0.8,stepSize,accumulator,denominator);processSample(vUV,-1.0*1.2,stepSize,accumulator,denominator);processSample(vUV,-1.0*1.4,stepSize,accumulator,denominator);processSample(vUV,-1.0*1.6,stepSize,accumulator,denominator);processSample(vUV,-1.0*1.8,stepSize,accumulator,denominator);processSample(vUV,-1.0*2.0,stepSize,accumulator,denominator);gl_FragColor=vec4(accumulator.rgb/denominator,colorFull.a);}\n";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},12132:(e,t,n)=>{n.r(t),n.d(t,{bilateralBlurQualityPixelShader:()=>a});var r=n(98519),i="bilateralBlurQualityPixelShader",o="uniform sampler2D textureSampler;uniform sampler2D depthSampler;uniform sampler2D normalSampler;uniform int filterSize;uniform vec2 blurDir;uniform float depthThreshold;uniform float normalThreshold;varying vec2 vUV;void main(void) {vec3 color=textureLod(textureSampler,vUV,0.).rgb;float depth=textureLod(depthSampler,vUV,0.).x;if (depth>=1e6 || depth<=0.) {glFragColor=vec4(color,1.);return;}\nvec3 normal=textureLod(normalSampler,vUV,0.).rgb;\n#ifdef DECODE_NORMAL\nnormal=normal*2.0-1.0;\n#endif\nfloat sigma=float(filterSize);float two_sigma2=2.0*sigma*sigma;float sigmaDepth=depthThreshold;float two_sigmaDepth2=2.0*sigmaDepth*sigmaDepth;float sigmaNormal=normalThreshold;float two_sigmaNormal2=2.0*sigmaNormal*sigmaNormal;vec3 sum=vec3(0.);float wsum=0.;for (int x=-filterSize; x<=filterSize; ++x) {for (int y=-filterSize; y<=filterSize; ++y) {vec2 coords=vec2(x,y)*blurDir;vec3 sampleColor=textureLod(textureSampler,vUV+coords,0.).rgb;float sampleDepth=textureLod(depthSampler,vUV+coords,0.).r;vec3 sampleNormal=textureLod(normalSampler,vUV+coords,0.).rgb;\n#ifdef DECODE_NORMAL\nsampleNormal=sampleNormal*2.0-1.0;\n#endif\nfloat r=dot(coords,coords);float w=exp(-r/two_sigma2);float rDepth=sampleDepth-depth;float wd=exp(-rDepth*rDepth/two_sigmaDepth2);float rNormal=abs(sampleNormal.x-normal.x)+abs(sampleNormal.y-normal.y)+abs(sampleNormal.z-normal.z);float wn=exp(-rNormal*rNormal/two_sigmaNormal2);sum+=sampleColor*w*wd*wn;wsum+=w*wd*wn;}}\nglFragColor=vec4(sum/wsum,1.);}\n";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},12191:(e,t,n)=>{var r=n(98519),i="pbrHelperFunctions";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="#define MINIMUMVARIANCE 0.0005\nfn convertRoughnessToAverageSlope(roughness: f32)->f32\n{return roughness*roughness+MINIMUMVARIANCE;}\nfn fresnelGrazingReflectance(reflectance0: f32)->f32 {var reflectance90: f32=saturate(reflectance0*25.0);return reflectance90;}\nfn getAARoughnessFactors(normalVector: vec3f)->vec2f {\n#ifdef SPECULARAA\nvar nDfdx: vec3f=dpdx(normalVector.xyz);var nDfdy: vec3f=dpdy(normalVector.xyz);var slopeSquare: f32=max(dot(nDfdx,nDfdx),dot(nDfdy,nDfdy));var geometricRoughnessFactor: f32=pow(saturate(slopeSquare),0.333);var geometricAlphaGFactor: f32=sqrt(slopeSquare);geometricAlphaGFactor*=0.75;return vec2f(geometricRoughnessFactor,geometricAlphaGFactor);\n#else\nreturn vec2f(0.);\n#endif\n}\n#ifdef ANISOTROPIC\n#ifdef ANISOTROPIC_LEGACY\nfn getAnisotropicRoughness(alphaG: f32,anisotropy: f32)->vec2f {var alphaT: f32=max(alphaG*(1.0+anisotropy),MINIMUMVARIANCE);var alphaB: f32=max(alphaG*(1.0-anisotropy),MINIMUMVARIANCE);return vec2f(alphaT,alphaB);}\nfn getAnisotropicBentNormals(T: vec3f,B: vec3f,N: vec3f,V: vec3f,anisotropy: f32,roughness: f32)->vec3f {var anisotropicFrameDirection: vec3f=select(T,B,anisotropy>=0.0);var anisotropicFrameTangent: vec3f=cross(normalize(anisotropicFrameDirection),V);var anisotropicFrameNormal: vec3f=cross(anisotropicFrameTangent,anisotropicFrameDirection);var anisotropicNormal: vec3f=normalize(mix(N,anisotropicFrameNormal,abs(anisotropy)));return anisotropicNormal;}\n#elif ANISOTROPIC_OPENPBR\nfn getAnisotropicRoughness(alphaG: f32,anisotropy: f32)->vec2f {var alphaT: f32=alphaG*sqrt(2.0/(1.0+(1.0-anisotropy)*(1.0-anisotropy)));var alphaB: f32=max(alphaT*(1.0-anisotropy),MINIMUMVARIANCE);return vec2f(alphaT,alphaB);}\n#else\nfn getAnisotropicRoughness(alphaG: f32,anisotropy: f32)->vec2f {var alphaT: f32=max(mix(alphaG,1.0,anisotropy*anisotropy),MINIMUMVARIANCE);var alphaB: f32=max(alphaG,MINIMUMVARIANCE);return vec2f(alphaT,alphaB);}\nfn getAnisotropicBentNormals(T: vec3f,B: vec3f,N: vec3f,V: vec3f,anisotropy: f32,roughness: f32)->vec3f {var bentNormal: vec3f=cross(B,V);bentNormal=normalize(cross(bentNormal,B));var sq=1.0-anisotropy*(1.0-roughness);var a: f32=sq*sq*sq*sq;bentNormal=normalize(mix(bentNormal,N,a));return bentNormal;}\n#endif\n#endif\n#if defined(CLEARCOAT) || defined(SS_REFRACTION)\nfn cocaLambertVec3(alpha: vec3f,distance: f32)->vec3f {return exp(-alpha*distance);}\nfn cocaLambert(NdotVRefract: f32,NdotLRefract: f32,alpha: vec3f,thickness: f32)->vec3f {return cocaLambertVec3(alpha,(thickness*((NdotLRefract+NdotVRefract)/(NdotLRefract*NdotVRefract))));}\nfn computeColorAtDistanceInMedia(color: vec3f,distance: f32)->vec3f {return -log(color)/distance;}\nfn computeClearCoatAbsorption(NdotVRefract: f32,NdotLRefract: f32,clearCoatColor: vec3f,clearCoatThickness: f32,clearCoatIntensity: f32)->vec3f {var clearCoatAbsorption: vec3f=mix( vec3f(1.0),\ncocaLambert(NdotVRefract,NdotLRefract,clearCoatColor,clearCoatThickness),\nclearCoatIntensity);return clearCoatAbsorption;}\n#endif\n#ifdef MICROSURFACEAUTOMATIC\nfn computeDefaultMicroSurface(microSurface: f32,reflectivityColor: vec3f)->f32\n{const kReflectivityNoAlphaWorkflow_SmoothnessMax: f32=0.95;var reflectivityLuminance: f32=getLuminance(reflectivityColor);var reflectivityLuma: f32=sqrt(reflectivityLuminance);var resultMicroSurface=reflectivityLuma*kReflectivityNoAlphaWorkflow_SmoothnessMax;return resultMicroSurface;}\n#endif\n")},12436:(e,t,n)=>{n.r(t),n.d(t,{meshUVSpaceRendererVertexShaderWGSL:()=>a});var r=n(98519),i=(n(45699),n(27279),n(73683),n(68478),n(63866),n(98819),n(77320),n(21310),n(3641),n(86615),"meshUVSpaceRendererVertexShader"),o="attribute position: vec3f;attribute normal: vec3f;attribute uv: vec2f;uniform projMatrix: mat4x4f;varying vDecalTC: vec2f;\n#include\n#include\n#include\n#include[0..maxSimultaneousMorphTargets]\n#include\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {var positionUpdated: vec3f=input.position;var normalUpdated: vec3f=input.normal;\n#include\n#include[0..maxSimultaneousMorphTargets]\n#include\n#include\n#include\nvar worldPos: vec4f=finalWorld* vec4f(positionUpdated,1.0);var normWorldSM: mat3x3f= mat3x3f(finalWorld[0].xyz,finalWorld[1].xyz,finalWorld[2].xyz);var vNormalW: vec3f;\n#if defined(INSTANCES) && defined(THIN_INSTANCES)\nvNormalW=normalUpdated/ vec3f(dot(normWorldSM[0],normWorldSM[0]),dot(normWorldSM[1],normWorldSM[1]),dot(normWorldSM[2],normWorldSM[2]));vNormalW=normalize(normWorldSM*vNormalW);\n#else\n#ifdef NONUNIFORMSCALING\nnormWorldSM=transposeMat3(inverseMat3(normWorldSM));\n#endif\nvNormalW=normalize(normWorldSM*normalUpdated);\n#endif\nvar normalView: vec3f=normalize((uniforms.projMatrix* vec4f(vNormalW,0.0)).xyz);var decalTC: vec3f=(uniforms.projMatrix*worldPos).xyz;vertexOutputs.vDecalTC=decalTC.xy;vertexOutputs.position=vec4f(input.uv*2.0-1.0,select(decalTC.z,2.,normalView.z>0.0),1.0);}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},12520:(e,t,n)=>{var r=n(98519),i="samplerVertexDeclaration";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="#if defined(_DEFINENAME_) && _DEFINENAME_DIRECTUV==0\nvarying v_VARYINGNAME_UV: vec2f;\n#endif\n")},12592:(e,t,n)=>{n.r(t),n.d(t,{FlowGraphDoNBlock:()=>l});var r=n(78322),i=n(88099),o=n(88469),a=n(34623),s=n(40099),l=function(e){function t(t){var n;void 0===t&&(t={});var r=e.call(this,t)||this;return r.config=t,r.config.startIndex=null!==(n=t.startIndex)&&void 0!==n?n:new s.P(0),r.reset=r._registerSignalInput("reset"),r.maxExecutions=r.registerDataInput("maxExecutions",i.x2),r.executionCount=r.registerDataOutput("executionCount",i.x2,new s.P(0)),r}return(0,r.C6)(t,e),t.prototype._execute=function(e,t){if(t===this.reset)this.executionCount.setValue(this.config.startIndex,e);else{var n=this.executionCount.getValue(e);n.value{var r=n(98519),i="logDepthFragment";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#ifdef LOGARITHMICDEPTH\ngl_FragDepthEXT=log2(vFragmentDepth)*logarithmicDepthConstant*0.5;\n#endif\n")},13424:(e,t,n)=>{n.d(t,{$x:()=>r,_0:()=>a,xp:()=>o});var r,i=n(8046);!function(e){e[e.LOCAL=0]="LOCAL",e[e.WORLD=1]="WORLD",e[e.BONE=2]="BONE"}(r||(r={}));var o,a=function(){function e(){}return e.X=new i.Pq(1,0,0),e.Y=new i.Pq(0,1,0),e.Z=new i.Pq(0,0,1),e}();!function(e){e[e.X=0]="X",e[e.Y=1]="Y",e[e.Z=2]="Z"}(o||(o={}))},13481:(e,t,n)=>{n.r(t),n.d(t,{fxaaVertexShaderWGSL:()=>a});var r=n(98519),i="fxaaVertexShader",o="attribute position: vec2f;uniform texelSize: vec2f;varying vUV: vec2f;varying sampleCoordS: vec2f;varying sampleCoordE: vec2f;varying sampleCoordN: vec2f;varying sampleCoordW: vec2f;varying sampleCoordNW: vec2f;varying sampleCoordSE: vec2f;varying sampleCoordNE: vec2f;varying sampleCoordSW: vec2f;const madd: vec2f= vec2f(0.5,0.5);\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvertexOutputs.vUV=(input.position*madd+madd);vertexOutputs.sampleCoordS=vertexOutputs.vUV+ vec2f( 0.0,1.0)*uniforms.texelSize;vertexOutputs.sampleCoordE=vertexOutputs.vUV+ vec2f( 1.0,0.0)*uniforms.texelSize;vertexOutputs.sampleCoordN=vertexOutputs.vUV+ vec2f( 0.0,-1.0)*uniforms.texelSize;vertexOutputs.sampleCoordW=vertexOutputs.vUV+ vec2f(-1.0,0.0)*uniforms.texelSize;vertexOutputs.sampleCoordNW=vertexOutputs.vUV+ vec2f(-1.0,-1.0)*uniforms.texelSize;vertexOutputs.sampleCoordSE=vertexOutputs.vUV+ vec2f( 1.0,1.0)*uniforms.texelSize;vertexOutputs.sampleCoordNE=vertexOutputs.vUV+ vec2f( 1.0,-1.0)*uniforms.texelSize;vertexOutputs.sampleCoordSW=vertexOutputs.vUV+ vec2f(-1.0,1.0)*uniforms.texelSize;vertexOutputs.position=vec4f(input.position,0.0,1.0);\n#define CUSTOM_VERTEX_MAIN_END\n}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},13803:(e,t,n)=>{n.d(t,{Z:()=>h});var r=n(78322),i=n(6174),o=n(8046),a=n(85405),s=n(49803),l=n(49995),c=n(34623),u=n(81152);a.b.AddNodeConstructor("Light_Type_1",(function(e,t){return function(){return new h(e,o.Pq.Zero(),t)}}));var h=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return i._shadowFrustumSize=0,i._shadowOrthoScale=.1,i.autoUpdateExtends=!0,i.autoCalcShadowZBounds=!1,i._orthoLeft=Number.MAX_VALUE,i._orthoRight=Number.MIN_VALUE,i._orthoTop=Number.MIN_VALUE,i._orthoBottom=Number.MAX_VALUE,i.position=n.scale(-1),i.direction=n,i}return(0,r.C6)(t,e),Object.defineProperty(t.prototype,"shadowFrustumSize",{get:function(){return this._shadowFrustumSize},set:function(e){this._shadowFrustumSize=e,this.forceProjectionMatrixCompute()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shadowOrthoScale",{get:function(){return this._shadowOrthoScale},set:function(e){this._shadowOrthoScale=e,this.forceProjectionMatrixCompute()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"orthoLeft",{get:function(){return this._orthoLeft},set:function(e){this._orthoLeft=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"orthoRight",{get:function(){return this._orthoRight},set:function(e){this._orthoRight=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"orthoTop",{get:function(){return this._orthoTop},set:function(e){this._orthoTop=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"orthoBottom",{get:function(){return this._orthoBottom},set:function(e){this._orthoBottom=e},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"DirectionalLight"},t.prototype.getTypeID=function(){return s.v.LIGHTTYPEID_DIRECTIONALLIGHT},t.prototype._setDefaultShadowProjectionMatrix=function(e,t,n){this.shadowFrustumSize>0?this._setDefaultFixedFrustumShadowProjectionMatrix(e):this._setDefaultAutoExtendShadowProjectionMatrix(e,t,n)},t.prototype._setDefaultFixedFrustumShadowProjectionMatrix=function(e){var t=this.getScene().activeCamera;t&&o.uq.OrthoLHToRef(this.shadowFrustumSize,this.shadowFrustumSize,void 0!==this.shadowMinZ?this.shadowMinZ:t.minZ,void 0!==this.shadowMaxZ?this.shadowMaxZ:t.maxZ,e,this.getScene().getEngine().isNDCHalfZRange)},t.prototype._setDefaultAutoExtendShadowProjectionMatrix=function(e,t,n){var r=this.getScene().activeCamera;if(this.autoUpdateExtends||this._orthoLeft===Number.MAX_VALUE){var i=o.Pq.Zero();this._orthoLeft=Number.MAX_VALUE,this._orthoRight=-Number.MAX_VALUE,this._orthoTop=-Number.MAX_VALUE,this._orthoBottom=Number.MAX_VALUE;for(var a=Number.MAX_VALUE,s=-Number.MAX_VALUE,l=0;lthis._orthoRight&&(this._orthoRight=i.x),i.y>this._orthoTop&&(this._orthoTop=i.y),this.autoCalcShadowZBounds&&(i.zs&&(s=i.z))}this.autoCalcShadowZBounds&&(this._shadowMinZ=a,this._shadowMaxZ=s)}var p=this._orthoRight-this._orthoLeft,f=this._orthoTop-this._orthoBottom,m=void 0!==this.shadowMinZ?this.shadowMinZ:(null==r?void 0:r.minZ)||u.Y.ShadowMinZ,_=void 0!==this.shadowMaxZ?this.shadowMaxZ:(null==r?void 0:r.maxZ)||u.Y.ShadowMaxZ,g=this.getScene().getEngine().useReverseDepthBuffer;o.uq.OrthoOffCenterLHToRef(this._orthoLeft-p*this.shadowOrthoScale,this._orthoRight+p*this.shadowOrthoScale,this._orthoBottom-f*this.shadowOrthoScale,this._orthoTop+f*this.shadowOrthoScale,g?_:m,g?m:_,e,this.getScene().getEngine().isNDCHalfZRange)},t.prototype._buildUniformLayout=function(){this._uniformBuffer.addUniform("vLightData",4),this._uniformBuffer.addUniform("vLightDiffuse",4),this._uniformBuffer.addUniform("vLightSpecular",4),this._uniformBuffer.addUniform("shadowsInfo",3),this._uniformBuffer.addUniform("depthValues",2),this._uniformBuffer.create()},t.prototype.transferToEffect=function(e,t){return this.computeTransformedInformation()?(this._uniformBuffer.updateFloat4("vLightData",this.transformedDirection.x,this.transformedDirection.y,this.transformedDirection.z,1,t),this):(this._uniformBuffer.updateFloat4("vLightData",this.direction.x,this.direction.y,this.direction.z,1,t),this)},t.prototype.transferToNodeMaterialEffect=function(e,t){return this.computeTransformedInformation()?(e.setFloat3(t,this.transformedDirection.x,this.transformedDirection.y,this.transformedDirection.z),this):(e.setFloat3(t,this.direction.x,this.direction.y,this.direction.z),this)},t.prototype.getDepthMinZ=function(e){var t=this._scene.getEngine();return!t.useReverseDepthBuffer&&t.isNDCHalfZRange?0:1},t.prototype.getDepthMaxZ=function(e){var t=this._scene.getEngine();return t.useReverseDepthBuffer&&t.isNDCHalfZRange?0:1},t.prototype.prepareLightSpecificDefines=function(e,t){e["DIRLIGHT"+t]=!0},(0,r.Cg)([(0,i.lK)()],t.prototype,"shadowFrustumSize",null),(0,r.Cg)([(0,i.lK)()],t.prototype,"shadowOrthoScale",null),(0,r.Cg)([(0,i.lK)()],t.prototype,"autoUpdateExtends",void 0),(0,r.Cg)([(0,i.lK)()],t.prototype,"autoCalcShadowZBounds",void 0),(0,r.Cg)([(0,i.lK)("orthoLeft")],t.prototype,"_orthoLeft",void 0),(0,r.Cg)([(0,i.lK)("orthoRight")],t.prototype,"_orthoRight",void 0),(0,r.Cg)([(0,i.lK)("orthoTop")],t.prototype,"_orthoTop",void 0),(0,r.Cg)([(0,i.lK)("orthoBottom")],t.prototype,"_orthoBottom",void 0),t}(l.p);(0,c.Y5)("BABYLON.DirectionalLight",h)},13811:(e,t,n)=>{n.r(t),n.d(t,{FlowGraphReceiveCustomEventBlock:()=>l});var r=n(78322),i=n(90279),o=n(44957),a=n(34623),s=n(80078),l=function(e){function t(t){var n=e.call(this,t)||this;for(var r in n.config=t,n.initPriority=1,n.config.eventData)n.registerDataOutput(r,n.config.eventData[r].type);return n}return(0,r.C6)(t,e),t.prototype._preparePendingTasks=function(e){var t=this,n=e.configuration.coordinator.getCustomEventObservable(this.config.eventId);if(n&&n.hasObservers()&&n.observers.length>s.x.MaxEventsPerType)this._reportError(e,"FlowGraphReceiveCustomEventBlock: Too many observers for event ".concat(this.config.eventId,". Max is ").concat(s.x.MaxEventsPerType,"."));else{var r=n.add((function(n){for(var r,i=0,o=Object.keys(n);i{n.r(t),n.d(t,{_WebAudioStreamingSound:()=>f});var r=n(78322),i=n(7164),o=n(44957),a=n(46436),s=n(66377),l=function(e){function t(t){var n=e.call(this,t)||this;return n.onReadyObservable=new s.cP,n.preloadedPromise=new Promise((function(e,t){n._rejectPreloadedProimse=t,n._resolvePreloadedPromise=e})),n.onErrorObservable.add(n._rejectPreloadedProimse),n.onReadyObservable.add(n._resolvePreloadedPromise),n}return(0,r.C6)(t,e),Object.defineProperty(t.prototype,"startOffset",{set:function(e){this._options.startOffset=e},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){e.prototype.dispose.call(this),this.onErrorObservable.clear(),this.onReadyObservable.clear(),this._resolvePreloadedPromise()},t}(n(18333).g),c=n(27063),u=n(82145),h=n(18285),d=n(85182),p=n(63982),f=function(e){function t(n,r,i){var o,a,s,l,c,u=e.call(this,n,r)||this;return u._spatial=null,u._spatialAutoUpdate=!0,u._spatialMinUpdateTime=0,u._stereo=null,"boolean"==typeof i.spatialAutoUpdate&&(u._spatialAutoUpdate=i.spatialAutoUpdate),"number"==typeof i.spatialMinUpdateTime&&(u._spatialMinUpdateTime=i.spatialMinUpdateTime),u._options={autoplay:null!==(o=i.autoplay)&&void 0!==o&&o,loop:null!==(a=i.loop)&&void 0!==a&&a,maxInstances:null!==(s=i.maxInstances)&&void 0!==s?s:1/0,preloadCount:null!==(l=i.preloadCount)&&void 0!==l?l:1,startOffset:null!==(c=i.startOffset)&&void 0!==c?c:0},u._subGraph=new t._SubGraph(u),u}return(0,r.C6)(t,e),t.prototype._initAsync=function(e,t){return(0,r.sH)(this,void 0,void 0,(function(){var n;return(0,r.YH)(this,(function(r){switch(r.label){case 0:if(!((n=this.engine._audioContext)instanceof AudioContext))throw new Error("Unsupported audio context type.");return this._audioContext=n,this._source=e,t.outBus?(this.outBus=t.outBus,[3,3]):[3,1];case 1:return!1===t.outBusAutoDefault?[3,3]:[4,this.engine.isReadyPromise];case 2:r.sent(),this.outBus=this.engine.defaultMainBus,r.label=3;case 3:return[4,this._subGraph.initAsync(t)];case 4:return r.sent(),(0,c.GB)(t)&&this._initSpatialProperty(),this.preloadCount?[4,this.preloadInstancesAsync(this.preloadCount)]:[3,6];case 5:r.sent(),r.label=6;case 6:return t.autoplay&&this.play(t),this.engine._addNode(this),[2]}}))}))},Object.defineProperty(t.prototype,"_inNode",{get:function(){return this._subGraph._inNode},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_outNode",{get:function(){return this._subGraph._outNode},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"spatial",{get:function(){return this._spatial?this._spatial:this._initSpatialProperty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stereo",{get:function(){var e;return null!==(e=this._stereo)&&void 0!==e?e:this._stereo=new u.i(this._subGraph)},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){e.prototype.dispose.call(this),this._spatial=null,this._stereo=null,this._subGraph.dispose(),this.engine._removeNode(this)},t.prototype.getClassName=function(){return"_WebAudioStreamingSound"},t.prototype._createInstance=function(){return new m(this,this._options)},t.prototype._connect=function(t){var n;return!!e.prototype._connect.call(this,t)&&(t._inNode&&(null===(n=this._outNode)||void 0===n||n.connect(t._inNode)),!0)},t.prototype._disconnect=function(t){var n;return!!e.prototype._disconnect.call(this,t)&&(t._inNode&&(null===(n=this._outNode)||void 0===n||n.disconnect(t._inNode)),!0)},t.prototype._initSpatialProperty=function(){return this._spatial||(this._spatial=new p.i(this._subGraph,this._spatialAutoUpdate,this._spatialMinUpdateTime)),this._spatial},t._SubGraph=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,r.C6)(t,e),Object.defineProperty(t.prototype,"_downstreamNodes",{get:function(){var e;return null!==(e=this._owner._downstreamNodes)&&void 0!==e?e:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_upstreamNodes",{get:function(){var e;return null!==(e=this._owner._upstreamNodes)&&void 0!==e?e:null},enumerable:!1,configurable:!0}),t}(d.Q),t}(a.G),m=function(e){function t(t,n){var r=e.call(this,t)||this;return r._currentTimeChangedWhilePaused=!1,r._enginePlayTime=1/0,r._enginePauseTime=0,r._isReady=!1,r._isReadyPromise=new Promise((function(e,t){r._resolveIsReadyPromise=e,r._rejectIsReadyPromise=t})),r._onCanPlayThrough=function(){r._isReady=!0,r._resolveIsReadyPromise(r._mediaElement),r.onReadyObservable.notifyObservers(r)},r._onEnded=function(){r.onEndedObservable.notifyObservers(r),r.dispose()},r._onError=function(e){r._setState(4),r.onErrorObservable.notifyObservers(e),r._rejectIsReadyPromise(e),r.dispose()},r._onEngineStateChanged=function(){"running"===r.engine.state&&(r._options.loop&&2===r.state&&r.play(),r.engine.stateChangedObservable.removeCallback(r._onEngineStateChanged))},r._onUserGesture=function(){r.play()},r._options=n,r._volumeNode=new GainNode(t._audioContext),"string"==typeof t._source?r._initFromUrl(t._source):Array.isArray(t._source)?r._initFromUrls(t._source):t._source instanceof HTMLMediaElement&&r._initFromMediaElement(t._source),r}return(0,r.C6)(t,e),Object.defineProperty(t.prototype,"currentTime",{get:function(){if(1===this._state)return 0;var e=5===this._state?0:this.engine.currentTime-this._enginePlayTime;return this._enginePauseTime+e+this._options.startOffset},set:function(e){var t=2===this._state||3===this._state;t&&(this._mediaElement.pause(),this._setState(1)),this._options.startOffset=e,t?this.play({startOffset:e}):5===this._state&&(this._currentTimeChangedWhilePaused=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_outNode",{get:function(){return this._volumeNode},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startTime",{get:function(){return 1===this._state?0:this._enginePlayTime},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){var t;e.prototype.dispose.call(this),this.stop(),null===(t=this._sourceNode)||void 0===t||t.disconnect(this._volumeNode),this._sourceNode=null,this._mediaElement.removeEventListener("error",this._onError),this._mediaElement.removeEventListener("ended",this._onEnded),this._mediaElement.removeEventListener("canplaythrough",this._onCanPlayThrough);for(var n=0,r=Array.from(this._mediaElement.children);n0&&(this._mediaElement.currentTime=n),this._volumeNode.gain.value=null!==(t=e.volume)&&void 0!==t?t:1,this._play()}},t.prototype.pause=function(){2!==this._state&&3!==this._state||(this._setState(5),this._enginePauseTime+=this.engine.currentTime-this._enginePlayTime,this._mediaElement.pause())},t.prototype.resume=function(){(5===this._state||this._currentTimeChangedWhilePaused)&&this.play()},t.prototype.stop=function(){1!==this._state&&this._stop()},t.prototype.getClassName=function(){return"_WebAudioStreamingSoundInstance"},t.prototype._connect=function(t){var n;return!!e.prototype._connect.call(this,t)&&(t instanceof f&&t._inNode&&(null===(n=this._outNode)||void 0===n||n.connect(t._inNode)),!0)},t.prototype._disconnect=function(t){var n;return!!e.prototype._disconnect.call(this,t)&&(t instanceof f&&t._inNode&&(null===(n=this._outNode)||void 0===n||n.disconnect(t._inNode)),!0)},t.prototype._initFromMediaElement=function(e){if(o.S0.SetCorsBehavior(e.currentSrc,e),e.controls=!1,e.loop=this._options.loop,e.preload="auto",e.addEventListener("canplaythrough",this._onCanPlayThrough,{once:!0}),e.addEventListener("ended",this._onEnded,{once:!0}),e.addEventListener("error",this._onError,{once:!0}),e.load(),this._sourceNode=new MediaElementAudioSourceNode(this._sound._audioContext,{mediaElement:e}),this._sourceNode.connect(this._volumeNode),!this._connect(this._sound))throw new Error("Connect failed");this._mediaElement=e},t.prototype._initFromUrl=function(e){var t=new Audio((0,h.Ki)(e));this._initFromMediaElement(t)},t.prototype._initFromUrls=function(e){for(var t=new Audio,n=0,r=e;n{n.r(t),n.d(t,{lightProxyVertexShaderWGSL:()=>a});var r=n(98519),i=(n(36644),n(23170),"lightProxyVertexShader"),o="attribute position: vec3f;flat varying vOffset: u32;flat varying vMask: u32;\n#include\nvar lightDataTexture: texture_2d;uniform tileMaskResolution: vec3f;uniform halfTileRes: vec2f;\n#include\n@vertex\nfn main(input: VertexInputs)->FragmentInputs {let light=getClusteredLight(lightDataTexture,vertexInputs.instanceIndex);let range=light.vLightFalloff.x;let viewPosition=scene.view*vec4f(light.vLightData.xyz,1);let viewPositionSq=viewPosition*viewPosition;let distSq=viewPositionSq.xy+viewPositionSq.z;let sinSq=(range*range)/distSq;let cosSq=max(1.0-sinSq,vec2f(0.01));let sinCos=vertexInputs.position.xy*sqrt(sinSq*cosSq);let rotatedX=mat2x2f(cosSq.x,-sinCos.x,sinCos.x,cosSq.x)*viewPosition.xz;let rotatedY=mat2x2f(cosSq.y,-sinCos.y,sinCos.y,cosSq.y)*viewPosition.yz;let projX=scene.projection*vec4f(rotatedX.x,0,rotatedX.y,1);let projY=scene.projection*vec4f(0,rotatedY.x,rotatedY.y,1);var projPosition=vec2f(projX.x/max(projX.w,0.01),projY.y/max(projY.w,0.01));projPosition=select(vertexInputs.position.xy,projPosition,cosSq>vec2(0.01));let halfTileRes=uniforms.tileMaskResolution.xy/2.0;var tilePosition=(projPosition+1.0)*halfTileRes;tilePosition=select(floor(tilePosition)-0.01,ceil(tilePosition)+0.01,vertexInputs.position.xy>vec2f(0));vertexOutputs.position=vec4f(tilePosition/halfTileRes-1.0,0,1);vertexOutputs.vOffset=vertexInputs.instanceIndex/CLUSTLIGHT_BATCH;vertexOutputs.vMask=1u<<(vertexInputs.instanceIndex % CLUSTLIGHT_BATCH);}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},14012:(e,t,n)=>{n.d(t,{V:()=>s,m:()=>a});var r=n(78322),i=n(93540),o=n(67367),a=function(e){function t(n,i,a){void 0===i&&(i=null);var s=(0,r.Cl)({name:n,engine:i||o.N.LastCreatedEngine,useShaderStore:!0,useAsPostProcess:!0,fragmentShader:t.FragmentUrl},a);return s.engine||(s.engine=o.N.LastCreatedEngine),e.call(this,s)||this}return(0,r.C6)(t,e),t.prototype._gatherImports=function(t,r){t?(this._webGPUReady=!0,r.push(Promise.all([Promise.resolve().then(n.bind(n,59448))]))):r.push(Promise.all([Promise.resolve().then(n.bind(n,56017))])),e.prototype._gatherImports.call(this,t,r)},t.FragmentUrl="pass",t}(i.$),s=function(e){function t(n,i,a){void 0===i&&(i=null);var s=e.call(this,(0,r.Cl)((0,r.Cl)({},a),{name:n,engine:i||o.N.LastCreatedEngine,useShaderStore:!0,useAsPostProcess:!0,fragmentShader:t.FragmentUrl,defines:"#define POSITIVEX"}))||this;return s._face=0,s}return(0,r.C6)(t,e),t.prototype._gatherImports=function(t,r){t?(this._webGPUReady=!0,r.push(Promise.all([Promise.resolve().then(n.bind(n,33739))]))):r.push(Promise.all([Promise.resolve().then(n.bind(n,25750))])),e.prototype._gatherImports.call(this,t,r)},Object.defineProperty(t.prototype,"face",{get:function(){return this._face},set:function(e){if(!(e<0||e>5))switch(this._face=e,this._face){case 0:this.updateEffect("#define POSITIVEX");break;case 1:this.updateEffect("#define NEGATIVEX");break;case 2:this.updateEffect("#define POSITIVEY");break;case 3:this.updateEffect("#define NEGATIVEY");break;case 4:this.updateEffect("#define POSITIVEZ");break;case 5:this.updateEffect("#define NEGATIVEZ")}},enumerable:!1,configurable:!0}),t.FragmentUrl="passCube",t}(i.$)},14052:(e,t,n)=>{var r=n(98519),i=(n(36644),n(40647),"pbrUboDeclaration");r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="uniform vAlbedoInfos: vec2f;uniform vBaseWeightInfos: vec2f;uniform vBaseDiffuseRoughnessInfos: vec2f;uniform vAmbientInfos: vec4f;uniform vOpacityInfos: vec2f;uniform vEmissiveInfos: vec2f;uniform vLightmapInfos: vec2f;uniform vReflectivityInfos: vec3f;uniform vMicroSurfaceSamplerInfos: vec2f;uniform vBumpInfos: vec3f;uniform albedoMatrix: mat4x4f;uniform baseWeightMatrix: mat4x4f;uniform baseDiffuseRoughnessMatrix: mat4x4f;uniform ambientMatrix: mat4x4f;uniform opacityMatrix: mat4x4f;uniform emissiveMatrix: mat4x4f;uniform lightmapMatrix: mat4x4f;uniform reflectivityMatrix: mat4x4f;uniform microSurfaceSamplerMatrix: mat4x4f;uniform bumpMatrix: mat4x4f;uniform vTangentSpaceParams: vec2f;uniform vAlbedoColor: vec4f;uniform baseWeight: f32;uniform baseDiffuseRoughness: f32;uniform vLightingIntensity: vec4f;uniform pointSize: f32;uniform vReflectivityColor: vec4f;uniform vEmissiveColor: vec3f;uniform vAmbientColor: vec3f;uniform vDebugMode: vec2f;uniform vMetallicReflectanceFactors: vec4f;uniform vMetallicReflectanceInfos: vec2f;uniform metallicReflectanceMatrix: mat4x4f;uniform vReflectanceInfos: vec2f;uniform reflectanceMatrix: mat4x4f;uniform cameraInfo: vec4f;uniform vReflectionInfos: vec2f;uniform reflectionMatrix: mat4x4f;uniform vReflectionMicrosurfaceInfos: vec3f;uniform vReflectionPosition: vec3f;uniform vReflectionSize: vec3f;uniform vReflectionFilteringInfo: vec2f;uniform vReflectionDominantDirection: vec3f;uniform vReflectionColor: vec3f;uniform vSphericalL00: vec3f;uniform vSphericalL1_1: vec3f;uniform vSphericalL10: vec3f;uniform vSphericalL11: vec3f;uniform vSphericalL2_2: vec3f;uniform vSphericalL2_1: vec3f;uniform vSphericalL20: vec3f;uniform vSphericalL21: vec3f;uniform vSphericalL22: vec3f;uniform vSphericalX: vec3f;uniform vSphericalY: vec3f;uniform vSphericalZ: vec3f;uniform vSphericalXX_ZZ: vec3f;uniform vSphericalYY_ZZ: vec3f;uniform vSphericalZZ: vec3f;uniform vSphericalXY: vec3f;uniform vSphericalYZ: vec3f;uniform vSphericalZX: vec3f;\n#define ADDITIONAL_UBO_DECLARATION\n#include\n#include\n")},14188:(e,t,n)=>{var r=n(98519),i="mainUVVaryingDeclaration";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="#ifdef MAINUV{X}\nvarying vMainUV{X}: vec2f;\n#endif\n")},14236:(e,t,n)=>{var r=n(98519),i="ltcHelperFunctions";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="fn LTCUv(N: vec3f,V: vec3f,roughness: f32)->vec2f {var LUTSIZE: f32=64.0;var LUTSCALE: f32=( LUTSIZE-1.0 )/LUTSIZE;var LUTBIAS:f32=0.5/LUTSIZE;var dotNV:f32=saturate( dot( N,V ) );var uv:vec2f=vec2f( roughness,sqrt( 1.0-dotNV ) );uv=uv*LUTSCALE+LUTBIAS;return uv;}\nfn LTCClippedSphereFormFactor( f:vec3f )->f32 {var l: f32=length( f );return max( ( l*l+f.z )/( l+1.0 ),0.0 );}\nfn LTCEdgeVectorFormFactor( v1:vec3f,v2:vec3f )->vec3f {var x:f32=dot( v1,v2 );var y:f32=abs( x );var a:f32=0.8543985+( 0.4965155+0.0145206*y )*y;var b:f32=3.4175940+( 4.1616724+y )*y;var v:f32=a/b;var thetaSintheta:f32=0.0;if( x>0.0 )\n{thetaSintheta=v;}\nelse\n{thetaSintheta=0.5*inverseSqrt( max( 1.0-x*x,0.00000001 ) )-v;}\nreturn cross( v1,v2 )*thetaSintheta;}\nfn LTCEvaluate( N:vec3f,V:vec3f,P:vec3f,mInv: mat3x3,rectCoords0:vec3f,rectCoords1:vec3f,rectCoords2:vec3f,rectCoords3:vec3f )->vec3f {var v1:vec3f=rectCoords1-rectCoords0;var v2:vec3f=rectCoords3-rectCoords0;var lightNormal:vec3f=cross( v1,v2 );if( dot( lightNormal,P-rectCoords0 )<0.0 ){return vec3f( 0.0 );}\nvar T1:vec3f=normalize( V-N*dot( V,N ) );var T2:vec3f=- cross( N,T1 ); \nvar mat: mat3x3=mInv*transposeMat3( mat3x3( T1,T2,N ) );var coords0: vec3f=mat*( rectCoords0-P );var coords1: vec3f=mat*( rectCoords1-P );var coords2: vec3f=mat*( rectCoords2-P );var coords3: vec3f=mat*( rectCoords3-P );coords0=normalize( coords0 );coords1=normalize( coords1 );coords2=normalize( coords2 );coords3=normalize( coords3 );var vectorFormFactor:vec3f=vec3( 0.0 );vectorFormFactor+=LTCEdgeVectorFormFactor( coords0,coords1 );vectorFormFactor+=LTCEdgeVectorFormFactor( coords1,coords2 );vectorFormFactor+=LTCEdgeVectorFormFactor( coords2,coords3 );vectorFormFactor+=LTCEdgeVectorFormFactor( coords3,coords0 );var result:f32=LTCClippedSphereFormFactor( vectorFormFactor );return vec3f( result );}\nstruct areaLightData\n{Diffuse: vec3f,\nSpecular: vec3f,\nFresnel: vec4f};fn computeAreaLightSpecularDiffuseFresnel(ltc1: texture_2d,ltc1Sampler:sampler,ltc2:texture_2d,ltc2Sampler:sampler,viewDir: vec3f,normal:vec3f,position:vec3f,lightPos:vec3f,halfWidth:vec3f, halfHeight:vec3f,roughness:f32)->areaLightData {var result: areaLightData;var rectCoords0:vec3f=lightPos+halfWidth-halfHeight; \nvar rectCoords1:vec3f=lightPos-halfWidth-halfHeight;var rectCoords2:vec3f=lightPos-halfWidth+halfHeight;var rectCoords3:vec3f=lightPos+halfWidth+halfHeight;\n#ifdef SPECULARTERM\nvar uv:vec2f=LTCUv( normal,viewDir,roughness );var t1:vec4f=textureSample( ltc1,ltc1Sampler,uv );var t2:vec4f=textureSample( ltc2,ltc2Sampler,uv );var mInv:mat3x3=mat3x3(\nvec3f( t1.x,0,t1.y ),\nvec3f( 0,1, 0 ),\nvec3f( t1.z,0,t1.w )\n);result.Fresnel=t2;result.Specular=LTCEvaluate( normal,viewDir,position,mInv,rectCoords0,rectCoords1,rectCoords2,rectCoords3 );\n#endif\nvar mInvEmpty:mat3x3=mat3x3(\nvec3f( 1,0,0 ),\nvec3f( 0,1,0 ),\nvec3f( 0,0,1 )\n);result.Diffuse+=LTCEvaluate( normal,viewDir,position,mInvEmpty,rectCoords0,rectCoords1,rectCoords2,rectCoords3 );return result;}")},14389:(e,t,n)=>{n.d(t,{i:()=>o});var r=n(11296),i=n(8046),o=function(){function e(e,t,n){this.center=i.Pq.Zero(),this.centerWorld=i.Pq.Zero(),this.minimum=i.Pq.Zero(),this.maximum=i.Pq.Zero(),this.reConstruct(e,t,n)}return e.prototype.reConstruct=function(e,t,n){this.minimum.copyFrom(e),this.maximum.copyFrom(t);var r=i.Pq.Distance(e,t);t.addToRef(e,this.center).scaleInPlace(.5),this.radius=.5*r,this._update(n||i.uq.IdentityReadOnly)},e.prototype.scale=function(t){var n=this.radius*t,r=e._TmpVector3,i=r[0].setAll(n),o=this.center.subtractToRef(i,r[1]),a=this.center.addToRef(i,r[2]);return this.reConstruct(o,a,this._worldMatrix),this},e.prototype.getWorldMatrix=function(){return this._worldMatrix},e.prototype._update=function(t){if(t.isIdentity())this.centerWorld.copyFrom(this.center),this.radiusWorld=this.radius;else{i.Pq.TransformCoordinatesToRef(this.center,t,this.centerWorld);var n=e._TmpVector3[0];i.Pq.TransformNormalFromFloatsToRef(1,1,1,t,n),this.radiusWorld=Math.max(Math.abs(n.x),Math.abs(n.y),Math.abs(n.z))*this.radius}},e.prototype.isInFrustum=function(e){for(var t=this.centerWorld,n=this.radiusWorld,r=0;r<6;r++)if(e[r].dotCoordinate(t)<=-n)return!1;return!0},e.prototype.isCenterInFrustum=function(e){for(var t=this.centerWorld,n=0;n<6;n++)if(e[n].dotCoordinate(t)<0)return!1;return!0},e.prototype.intersectsPoint=function(e){var t=i.Pq.DistanceSquared(this.centerWorld,e);return!(this.radiusWorld*this.radiusWorld{n.d(t,{X:()=>r});var r=function(){function e(e,t,n){this.name=e,this._parentTask=t,this._context=n,this.disabled=!1}return e.prototype.setExecuteFunc=function(e){this._executeFunc=e},e.prototype._execute=function(){this.disabled||this._executeFunc(this._context)},e.prototype._isValid=function(){return void 0!==this._executeFunc?null:"Execute function is not set (call setExecuteFunc to set it)"},e}()},14605:(e,t,n)=>{var r=n(82673);r.$.prototype.getRenderPassNames=function(){return this._renderPassNames},r.$.prototype.getCurrentRenderPassName=function(){return this._renderPassNames[this.currentRenderPassId]},r.$.prototype.createRenderPassId=function(e){var t=++r.$._RenderPassIdCounter;return this._renderPassNames[t]=null!=e?e:"NONAME",t},r.$.prototype.releaseRenderPassId=function(e){this._renderPassNames[e]=void 0;for(var t=0;t{n.r(t),n.d(t,{shadowMapFragmentSoftTransparentShadowWGSL:()=>a});var r=n(98519),i="shadowMapFragmentSoftTransparentShadow",o="#if SM_SOFTTRANSPARENTSHADOW==1\nif ((bayerDither8(floor(((fragmentInputs.position.xy)%(8.0)))))/64.0>=uniforms.softTransparentShadowSM.x*alpha) {discard;}\n#endif\n";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]=o);var a={name:i,shader:o}},14737:(e,t,n)=>{n.d(t,{x:()=>r});var r=function(){function e(){this._valueCache={},this.vertexCompilationError=null,this.fragmentCompilationError=null,this.programLinkError=null,this.programValidationError=null,this._isDisposed=!1}return Object.defineProperty(e.prototype,"isAsync",{get:function(){return this.isParallelCompiled},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isReady",{get:function(){return!!this.program&&(!this.isParallelCompiled||this.engine._isRenderingStateCompiled(this))},enumerable:!1,configurable:!0}),e.prototype._handlesSpectorRebuildCallback=function(e){e&&this.program&&e(this.program)},e.prototype.setEngine=function(e){this.engine=e},e.prototype._fillEffectInformation=function(e,t,n,r,i,o,a,s){var l,c=this.engine;if(c.supportsUniformBuffers)for(var u in t)e.bindUniformBlock(u,t[u]);for(this.engine.getUniforms(this,n).forEach((function(e,t){r[n[t]]=e})),this._uniforms=r,l=0;l{n.d(t,{E:()=>i});var r=n(53695),i=function(){function e(e,t){void 0===t&&(t=!0),this._wasPreviouslyReady=!1,this._forceRebindOnNextCall=!0,this._wasPreviouslyUsingInstances=null,this.effect=null,this.defines=null,this.drawContext=e.createDrawContext(),t&&(this.materialContext=e.createMaterialContext())}return e.GetEffect=function(e){return void 0===e.getPipelineContext?e.effect:e},e.prototype.setEffect=function(e,t,n){var r;void 0===n&&(n=!0),this.effect=e,void 0!==t&&(this.defines=t),n&&(null===(r=this.drawContext)||void 0===r||r.reset())},e.prototype.dispose=function(e){var t;if(void 0===e&&(e=!1),this.effect){var n=this.effect;e?n.dispose():r._.SetImmediate((function(){n.getEngine().onEndFrameObservable.addOnce((function(){n.dispose()}))})),this.effect=null}null===(t=this.drawContext)||void 0===t||t.dispose()},e}()},14782:(e,t,n)=>{var r=n(98519),i="kernelBlurVaryingDeclaration";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="varying sampleCoord{X}: vec2f;")},14830:(e,t,n)=>{n.r(t),n.d(t,{imageProcessingPixelShader:()=>a});var r=n(98519),i=(n(59581),n(75334),n(40688),"imageProcessingPixelShader"),o="varying vec2 vUV;uniform sampler2D textureSampler;\n#include\n#include\n#include\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{vec4 result=texture2D(textureSampler,vUV);result.rgb=max(result.rgb,vec3(0.));\n#ifdef IMAGEPROCESSING\n#ifndef FROMLINEARSPACE\nresult.rgb=toLinearSpace(result.rgb);\n#endif\nresult=applyImageProcessing(result);\n#else\n#ifdef FROMLINEARSPACE\nresult=applyImageProcessing(result);\n#endif\n#endif\ngl_FragColor=result;}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},15229:(e,t,n)=>{n.r(t),n.d(t,{bilateralBlurQualityPixelShaderWGSL:()=>a});var r=n(98519),i="bilateralBlurQualityPixelShader",o="var textureSamplerSampler: sampler;var textureSampler: texture_2d;var normalSamplerSampler: sampler;var normalSampler: texture_2d;var depthSamplerSampler: sampler;var depthSampler: texture_2d;uniform filterSize: i32;uniform blurDir: vec2f;uniform depthThreshold: f32;uniform normalThreshold: f32;varying vUV: vec2f;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var color: vec3f=textureSampleLevel(textureSampler,textureSamplerSampler,input.vUV,0.).rgb;var depth: f32=textureSampleLevel(depthSampler,depthSamplerSampler,input.vUV,0.).x;if (depth>=1e6 || depth<=0.) {fragmentOutputs.color= vec4f(color,1.);return fragmentOutputs;}\nvar normal: vec3f=textureSampleLevel(normalSampler,normalSamplerSampler,input.vUV,0.).rgb;\n#ifdef DECODE_NORMAL\nnormal=normal*2.0-1.0;\n#endif\nvar sigma: f32= f32(uniforms.filterSize);var two_sigma2: f32=2.0*sigma*sigma;var sigmaDepth: f32=uniforms.depthThreshold;var two_sigmaDepth2: f32=2.0*sigmaDepth*sigmaDepth;var sigmaNormal: f32=uniforms.normalThreshold;var two_sigmaNormal2: f32=2.0*sigmaNormal*sigmaNormal;var sum: vec3f= vec3f(0.);var wsum: f32=0.;for (var x: i32=-uniforms.filterSize; x<=uniforms.filterSize; x++) {for (var y: i32=-uniforms.filterSize; y<=uniforms.filterSize; y++) {var coords: vec2f= vec2f(f32(x),f32(y))*uniforms.blurDir;var sampleColor: vec3f=textureSampleLevel(textureSampler,textureSamplerSampler,input.vUV+coords,0.).rgb;var sampleDepth: f32=textureSampleLevel(depthSampler,depthSamplerSampler,input.vUV+coords,0.).r;var sampleNormal: vec3f=textureSampleLevel(normalSampler,normalSamplerSampler,input.vUV+coords,0.).rgb;\n#ifdef DECODE_NORMAL\nsampleNormal=sampleNormal*2.0-1.0;\n#endif\nvar r: f32=dot(coords,coords);var w: f32=exp(-r/two_sigma2);var rDepth: f32=sampleDepth-depth;var wd: f32=exp(-rDepth*rDepth/two_sigmaDepth2);var rNormal: f32=abs(sampleNormal.x-normal.x)+abs(sampleNormal.y-normal.y)+abs(sampleNormal.z-normal.z);var wn: f32=exp(-rNormal*rNormal/two_sigmaNormal2);sum+=sampleColor*w*wd*wn;wsum+=w*wd*wn;}}\nfragmentOutputs.color= vec4f(sum/wsum,1.);}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},15390:(e,t,n)=>{n.r(t),n.d(t,{vrDistortionCorrectionPixelShaderWGSL:()=>a});var r=n(98519),i="vrDistortionCorrectionPixelShader",o="#define DISABLE_UNIFORMITY_ANALYSIS\nvarying vUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d;uniform LensCenter: vec2f;uniform Scale: vec2f;uniform ScaleIn: vec2f;uniform HmdWarpParam: vec4f;fn HmdWarp(in01: vec2f)->vec2f {var theta: vec2f=(in01-uniforms.LensCenter)*uniforms.ScaleIn; \nvar rSq: f32=theta.x*theta.x+theta.y*theta.y;var rvector: vec2f=theta*(uniforms.HmdWarpParam.x+uniforms.HmdWarpParam.y*rSq+uniforms.HmdWarpParam.z*rSq*rSq+uniforms.HmdWarpParam.w*rSq*rSq*rSq);return uniforms.LensCenter+uniforms.Scale*rvector;}\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var tc: vec2f=HmdWarp(input.vUV);if (tc.x <0.0 || tc.x>1.0 || tc.y<0.0 || tc.y>1.0) {fragmentOutputs.color=vec4f(0.0,0.0,0.0,0.0);}\nelse{fragmentOutputs.color=textureSample(textureSampler,textureSamplerSampler,tc);}}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},15455:(e,t,n)=>{n.r(t),n.d(t,{shadowMapVertexShaderWGSL:()=>l});var r=n(98519),i=(n(45699),n(27279),n(73683),n(68478),n(17393),n(36644),n(40647),"shadowMapVertexExtraDeclaration");r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="#if SM_NORMALBIAS==1\nuniform lightDataSM: vec3f;\n#endif\nuniform biasAndScaleSM: vec3f;uniform depthValuesSM: vec2f;varying vDepthMetricSM: f32;\n#if SM_USEDISTANCE==1\nvarying vPositionWSM: vec3f;\n#endif\n#if defined(SM_DEPTHCLAMP) && SM_DEPTHCLAMP==1\nvarying zSM: f32;\n#endif\n"),n(9436),n(98819),n(77320),n(21310),n(3641),n(86615);var o="shadowMapVertexNormalBias";r.l.IncludesShadersStoreWGSL[o]||(r.l.IncludesShadersStoreWGSL[o]="#if SM_NORMALBIAS==1\n#if SM_DIRECTIONINLIGHTDATA==1\nvar worldLightDirSM: vec3f=normalize(-uniforms.lightDataSM.xyz);\n#else\nvar directionToLightSM: vec3f=uniforms.lightDataSM.xyz-worldPos.xyz;var worldLightDirSM: vec3f=normalize(directionToLightSM);\n#endif\nvar ndlSM: f32=dot(vNormalW,worldLightDirSM);var sinNLSM: f32=sqrt(1.0-ndlSM*ndlSM);var normalBiasSM: f32=uniforms.biasAndScaleSM.y*sinNLSM;worldPos=vec4f(worldPos.xyz-vNormalW*normalBiasSM,worldPos.w);\n#endif\n"),n(28924),n(63002);var a="shadowMapVertexShader",s="attribute position: vec3f;\n#ifdef NORMAL\nattribute normal: vec3f;\n#endif\n#include\n#include\n#include\n#include[0..maxSimultaneousMorphTargets]\n#ifdef INSTANCES\nattribute world0: vec4f;attribute world1: vec4f;attribute world2: vec4f;attribute world3: vec4f;\n#endif\n#include\n#include\n#include\n#ifdef ALPHATEXTURE\nvarying vUV: vec2f;uniform diffuseMatrix: mat4x4f;\n#ifdef UV1\nattribute uv: vec2f;\n#endif\n#ifdef UV2\nattribute uv2: vec2f;\n#endif\n#endif\n#include\n#include\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {var positionUpdated: vec3f=input.position;\n#ifdef UV1\nvar uvUpdated: vec2f=input.uv;\n#endif\n#ifdef UV2\nvar uv2Updated: vec2f=input.uv2;\n#endif\n#ifdef NORMAL\nvar normalUpdated: vec3f=input.normal;\n#endif\n#include\n#include[0..maxSimultaneousMorphTargets]\n#include\n#include\n#include\nvar worldPos: vec4f=finalWorld* vec4f(positionUpdated,1.0);\n#ifdef NORMAL\nvar normWorldSM: mat3x3f= mat3x3f(finalWorld[0].xyz,finalWorld[1].xyz,finalWorld[2].xyz);\n#if defined(INSTANCES) && defined(THIN_INSTANCES)\nvar vNormalW: vec3f=normalUpdated/ vec3f(dot(normWorldSM[0],normWorldSM[0]),dot(normWorldSM[1],normWorldSM[1]),dot(normWorldSM[2],normWorldSM[2]));vNormalW=normalize(normWorldSM*vNormalW);\n#else\n#ifdef NONUNIFORMSCALING\nnormWorldSM=transposeMat3(inverseMat3(normWorldSM));\n#endif\nvar vNormalW: vec3f=normalize(normWorldSM*normalUpdated);\n#endif\n#endif\n#include\nvertexOutputs.position=scene.viewProjection*worldPos;\n#include\n#ifdef ALPHATEXTURE\n#ifdef UV1\nvertexOutputs.vUV= (uniforms.diffuseMatrix* vec4f(uvUpdated,1.0,0.0)).xy;\n#endif\n#ifdef UV2\nvertexOutputs.vUV= (uniforms.diffuseMatrix* vec4f(uv2Updated,1.0,0.0)).xy;\n#endif\n#endif\n#include\n}";r.l.ShadersStoreWGSL[a]||(r.l.ShadersStoreWGSL[a]=s);var l={name:a,shader:s}},15579:(e,t,n)=>{n.d(t,{bO:()=>o,uD:()=>i,uJ:()=>r});var r={pan:0};function i(e){return e.stereoEnabled||void 0!==e.stereoPan}var o=function(){}},15638:(e,t,n)=>{n.r(t),n.d(t,{glowMapMergePixelShaderWGSL:()=>a});var r=n(98519),i="glowMapMergePixelShader",o="varying vUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d;\n#ifdef EMISSIVE\nvar textureSampler2Sampler: sampler;var textureSampler2: texture_2d;\n#endif\nuniform offset: f32;\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\nvar baseColor: vec4f=textureSample(textureSampler,textureSamplerSampler,input.vUV);\n#ifdef EMISSIVE\nbaseColor+=textureSample(textureSampler2,textureSampler2Sampler,input.vUV);baseColor*=uniforms.offset;\n#else\nbaseColor=vec4f(baseColor.rgb,abs(uniforms.offset-baseColor.a));\n#ifdef STROKE\nvar alpha: f32=smoothstep(.0,.1,baseColor.a);baseColor=vec4f(baseColor.rgb*alpha,alpha);\n#endif\n#endif\n#if LDR\nbaseColor=clamp(baseColor,vec4f(0.),vec4f(1.0));\n#endif\nfragmentOutputs.color=baseColor;\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},15656:(e,t,n)=>{var r=n(98519),i="depthPrePass";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#ifdef DEPTHPREPASS\ngl_FragColor=vec4(0.,0.,0.,1.0);return;\n#endif\n")},16040:(e,t,n)=>{n.r(t),n.d(t,{ssao2PixelShader:()=>a});var r=n(98519),i="ssao2PixelShader",o="precision highp float;uniform sampler2D textureSampler;varying vec2 vUV;\n#ifdef SSAO\nfloat scales[16]=float[16](\n0.1,\n0.11406250000000001,\n0.131640625,\n0.15625,\n0.187890625,\n0.2265625,\n0.272265625,\n0.325,\n0.384765625,\n0.4515625,\n0.525390625,\n0.60625,\n0.694140625,\n0.7890625,\n0.891015625,\n1.0\n);uniform float near;uniform float radius;uniform sampler2D depthSampler;uniform sampler2D randomSampler;uniform sampler2D normalSampler;uniform float randTextureTiles;uniform float samplesFactor;uniform vec3 sampleSphere[SAMPLES];uniform float totalStrength;uniform float base;\n#ifdef ORTHOGRAPHIC_CAMERA\nuniform vec4 viewport;\n#else\nuniform float xViewport;uniform float yViewport;\n#endif\nuniform mat3 depthProjection;uniform float maxZ;uniform float minZAspect;uniform vec2 texelSize;uniform mat4 projection;void main()\n{vec3 random=textureLod(randomSampler,vUV*randTextureTiles,0.0).rgb;float depth=textureLod(depthSampler,vUV,0.0).r;float depthSign=sign(depth);depth=depth*depthSign;vec3 normal=textureLod(normalSampler,vUV,0.0).rgb;float occlusion=0.0;float correctedRadius=min(radius,minZAspect*depth/near);\n#ifdef ORTHOGRAPHIC_CAMERA\nvec3 vViewRay=vec3(mix(viewport.x,viewport.y,vUV.x),mix(viewport.z,viewport.w,vUV.y),depthSign);\n#else\nvec3 vViewRay=vec3((vUV.x*2.0-1.0)*xViewport,(vUV.y*2.0-1.0)*yViewport,depthSign);\n#endif\nvec3 vDepthFactor=depthProjection*vec3(1.0,1.0,depth);vec3 origin=vViewRay*vDepthFactor;vec3 rvec=random*2.0-1.0;rvec.z=0.0;float dotProduct=dot(rvec,normal);rvec=1.0-abs(dotProduct)>1e-2 ? rvec : vec3(-rvec.y,0.0,rvec.x);vec3 tangent=normalize(rvec-normal*dot(rvec,normal));vec3 bitangent=cross(normal,tangent);mat3 tbn=mat3(tangent,bitangent,normal);float difference;for (int i=0; i1.0 || offset.y>1.0) {continue;}\nfloat sampleDepth=abs(textureLod(depthSampler,offset.xy,0.0).r);difference=depthSign*samplePosition.z-sampleDepth;float rangeCheck=1.0-smoothstep(correctedRadius*0.5,correctedRadius,difference);occlusion+=step(EPSILON,difference)*rangeCheck;}\nocclusion=occlusion*(1.0-smoothstep(maxZ*0.75,maxZ,depth));float ao=1.0-totalStrength*occlusion*samplesFactor;float result=clamp(ao+base,0.0,1.0);gl_FragColor=vec4(vec3(result),1.0);}\n#endif\n#ifdef BLUR\nuniform float outSize;uniform float soften;uniform float tolerance;uniform int samples;\n#ifndef BLUR_BYPASS\nuniform sampler2D depthSampler;\n#ifdef BLUR_LEGACY\n#define inline\nfloat blur13Bilateral(sampler2D image,vec2 uv,vec2 step) {float result=0.0;vec2 off1=vec2(1.411764705882353)*step;vec2 off2=vec2(3.2941176470588234)*step;vec2 off3=vec2(5.176470588235294)*step;float compareDepth=abs(textureLod(depthSampler,uv,0.0).r);float sampleDepth;float weight;float weightSum=30.0;result+=textureLod(image,uv,0.0).r*30.0;sampleDepth=abs(textureLod(depthSampler,uv+off1,0.0).r);weight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);weightSum+= weight;result+=textureLod(image,uv+off1,0.0).r*weight;sampleDepth=abs(textureLod(depthSampler,uv-off1,0.0).r);weight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);weightSum+= weight;result+=textureLod(image,uv-off1,0.0).r*weight;sampleDepth=abs(textureLod(depthSampler,uv+off2,0.0).r);weight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);weightSum+=weight;result+=textureLod(image,uv+off2,0.0).r*weight;sampleDepth=abs(textureLod(depthSampler,uv-off2,0.0).r);weight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);weightSum+=weight;result+=textureLod(image,uv-off2,0.0).r*weight;sampleDepth=abs(textureLod(depthSampler,uv+off3,0.0).r);weight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);weightSum+=weight;result+=textureLod(image,uv+off3,0.0).r*weight;sampleDepth=abs(textureLod(depthSampler,uv-off3,0.0).r);weight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);weightSum+=weight;result+=textureLod(image,uv-off3,0.0).r*weight;return result/weightSum;}\n#endif\n#endif\nvoid main()\n{float result=0.0;\n#ifdef BLUR_BYPASS\nresult=textureLod(textureSampler,vUV,0.0).r;\n#else\n#ifdef BLUR_H\nvec2 step=vec2(1.0/outSize,0.0);\n#else\nvec2 step=vec2(0.0,1.0/outSize);\n#endif\n#ifdef BLUR_LEGACY\nresult=blur13Bilateral(textureSampler,vUV,step);\n#else\nfloat compareDepth=abs(textureLod(depthSampler,vUV,0.0).r);float weightSum=0.0;for (int i=-samples; i{n.d(t,{I:()=>r});var r=function(){function e(){}return e.SetMatrixPrecision=function(t){if(e.MatrixTrackPrecisionChange=!1,t&&!e.MatrixUse64Bits&&e.MatrixTrackedMatrices)for(var n=0;n{n.d(t,{EE:()=>d,LO:()=>y,LZ:()=>f,Oz:()=>v,Qs:()=>p,SX:()=>m,v9:()=>_});var r,i,o=n(78322),a=n(50582),s=n(41085),l=n(73441),c=n(81152),u=n(30622),h=n(48810);function d(e,t,n,r){void 0===r&&(r=!0);var i=e.getScene(),o=i.getEngine(),u=new s.$("resized"+e.name,{width:t,height:n},i,!e.noMipmap,!0,e._texture.type,!1,e.samplingMode,!1);u.wrapU=e.wrapU,u.wrapV=e.wrapV,u.uOffset=e.uOffset,u.vOffset=e.vOffset,u.uScale=e.uScale,u.vScale=e.vScale,u.uAng=e.uAng,u.vAng=e.vAng,u.wAng=e.wAng,u.coordinatesIndex=e.coordinatesIndex,u.level=e.level,u.anisotropicFilteringLevel=e.anisotropicFilteringLevel,u._texture.isReady=!1,e.wrapU=a.g.CLAMP_ADDRESSMODE,e.wrapV=a.g.CLAMP_ADDRESSMODE;var h=new l.v("pass",1,null,r?a.g.BILINEAR_SAMPLINGMODE:a.g.NEAREST_SAMPLINGMODE,o,!1,c.Y.TEXTURETYPE_UNSIGNED_BYTE);return h.externalTextureSamplerBinding=!0,h.onEffectCreatedObservable.addOnce((function(t){t.executeWhenCompiled((function(){h.onApply=function(t){t.setTexture("textureSampler",e)};var t=u.renderTarget;t&&(i.postProcessManager.directRender([h],t),o.unBindFramebuffer(t),u.disposeFramebufferObjects(),h.dispose(),u.getInternalTexture().isReady=!0)}))})),u}function p(e,t,n,r,i,o,a,s){var l=t.getEngine();return t.isReady=!1,i=null!=i?i:t.samplingMode,r=null!=r?r:t.type,o=null!=o?o:t.format,a=null!=a?a:t.width,s=null!=s?s:t.height,-1===r&&(r=c.Y.TEXTURETYPE_UNSIGNED_BYTE),new Promise((function(h){var d=new u.w("postprocess",e,null,null,1,null,i,l,!1,void 0,r,void 0,null,!1,o);d.externalTextureSamplerBinding=!0;var p=l.createRenderTargetTexture({width:a,height:s},{generateDepthBuffer:!1,generateMipMaps:!1,generateStencilBuffer:!1,samplingMode:i,type:r,format:o});d.onEffectCreatedObservable.addOnce((function(e){e.executeWhenCompiled((function(){d.onApply=function(e){e._bindTexture("textureSampler",t),e.setFloat2("scale",1,1)},n.postProcessManager.directRender([d],p,!0),l.restoreDefaultFramebuffer(),l._releaseTexture(t),d&&d.dispose(),p._swapAndDie(t),t.type=r,t.format=c.Y.TEXTUREFORMAT_RGBA,t.isReady=!0,h(t)}))}))}))}function f(e){r||(r=new Float32Array(1),i=new Int32Array(r.buffer)),r[0]=e;var t=i[0],n=t>>16&32768,o=t>>12&2047,a=t>>23&255;return a<103?n:a>142?(n|=31744,n|=(255==a?0:1)&&8388607&t):a<113?n|=((o|=2048)>>114-a)+(o>>113-a&1):(n|=a-112<<10|o>>1,n+=1&o)}function m(e){var t=(32768&e)>>15,n=(31744&e)>>10,r=1023&e;return 0===n?(t?-1:1)*Math.pow(2,-14)*(r/Math.pow(2,10)):31==n?r?NaN:1/0*(t?-1:1):(t?-1:1)*Math.pow(2,n-15)*(1+r/Math.pow(2,10))}function _(e){return(0,o.sH)(this,void 0,void 0,(function(){var t,n,r,i;return(0,o.YH)(this,(function(o){switch(o.label){case 0:if(e.isReady())return[2];if(e.loadingError)throw new Error((null===(r=e.errorObject)||void 0===r?void 0:r.message)||"Texture ".concat(e.name," errored while loading."));return(t=e.onLoadObservable)?[4,new Promise((function(e){return t.addOnce((function(){return e()}))}))]:[3,2];case 1:case 3:return[2,o.sent()];case 2:return(n=null===(i=e._texture)||void 0===i?void 0:i.onLoadedObservable)?[4,new Promise((function(e){return n.addOnce((function(){return e()}))}))]:[3,4];case 4:throw new Error("Cannot determine readiness of texture ".concat(e.name,"."))}}))}))}function g(e,t,r,i,l){return(0,o.sH)(this,void 0,void 0,(function(){var c,h,d,p,f,m,_,g,v;return(0,o.YH)(this,(function(o){switch(o.label){case 0:return c=e.getScene(),(h=c.getEngine()).isWebGPU?[3,5]:e.isCube?[4,Promise.resolve().then(n.bind(n,97334))]:[3,2];case 1:return o.sent(),[3,4];case 2:return[4,Promise.resolve().then(n.bind(n,94481))];case 3:o.sent(),o.label=4;case 4:return[3,9];case 5:return e.isCube?[4,Promise.resolve().then(n.bind(n,50265))]:[3,7];case 6:return o.sent(),[3,9];case 7:return[4,Promise.resolve().then(n.bind(n,39790))];case 8:o.sent(),o.label=9;case 9:return e.isCube?(p=["#define POSITIVEX","#define NEGATIVEX","#define POSITIVEY","#define NEGATIVEY","#define POSITIVEZ","#define NEGATIVEZ"],d=new u.w("lodCube","lodCube",{uniforms:["lod","gamma"],samplingMode:a.g.NEAREST_NEAREST_MIPNEAREST,engine:h,defines:p[i],shaderLanguage:h.isWebGPU?1:0})):d=new u.w("lod","lod",{uniforms:["lod","gamma"],samplingMode:a.g.NEAREST_NEAREST_MIPNEAREST,engine:h,shaderLanguage:h.isWebGPU?1:0}),[4,new Promise((function(e){d.onEffectCreatedObservable.addOnce((function(t){t.executeWhenCompiled((function(){e(0)}))}))}))];case 10:o.sent(),f=new s.$("temp",{width:t,height:r},c,!1),d.onApply=function(t){t.setTexture("textureSampler",e),t.setFloat("lod",l),t.setInt("gamma",e.gammaSpace?1:0)},m=e.getInternalTexture(),o.label=11;case 11:return o.trys.push([11,,15,16]),f.renderTarget&&m?(_=m.samplingMode,0!==l?e.updateSamplingMode(a.g.NEAREST_NEAREST_MIPNEAREST):e.updateSamplingMode(a.g.NEAREST_NEAREST),c.postProcessManager.directRender([d],f.renderTarget,!0),e.updateSamplingMode(_),[4,h.readPixels(0,0,t,r)]):[3,13];case 12:return g=o.sent(),v=new Uint8Array(g.buffer,0,g.byteLength),h.unBindFramebuffer(f.renderTarget),[2,v];case 13:throw Error("Render to texture failed.");case 14:return[3,16];case 15:return f.dispose(),d.dispose(),[7];case 16:return[2]}}))}))}function v(e,t,n){return(0,o.sH)(this,arguments,void 0,(function(e,t,n,r,i){var a,s,l,u,d,p,f,m,v;return void 0===r&&(r=0),void 0===i&&(i=0),(0,o.YH)(this,(function(o){switch(o.label){case 0:return[4,_(e)];case 1:return o.sent(),a=e.getSize(),s=a.width,l=a.height,u=null!=t?t:s,d=null!=n?n:l,function(e){switch(e){case c.Y.TEXTUREFORMAT_COMPRESSED_RGBA_BPTC_UNORM:case c.Y.TEXTUREFORMAT_COMPRESSED_SRGB_ALPHA_BPTC_UNORM:case c.Y.TEXTUREFORMAT_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT:case c.Y.TEXTUREFORMAT_COMPRESSED_RGB_BPTC_SIGNED_FLOAT:case c.Y.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT5:case c.Y.TEXTUREFORMAT_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:case c.Y.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT3:case c.Y.TEXTUREFORMAT_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:case c.Y.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT1:case c.Y.TEXTUREFORMAT_COMPRESSED_RGB_S3TC_DXT1:case c.Y.TEXTUREFORMAT_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:case c.Y.TEXTUREFORMAT_COMPRESSED_SRGB_S3TC_DXT1_EXT:case c.Y.TEXTUREFORMAT_COMPRESSED_RGBA_ASTC_4x4:case c.Y.TEXTUREFORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:case c.Y.TEXTUREFORMAT_COMPRESSED_RGB_ETC1_WEBGL:case c.Y.TEXTUREFORMAT_COMPRESSED_RGB8_ETC2:case c.Y.TEXTUREFORMAT_COMPRESSED_SRGB8_ETC2:case c.Y.TEXTUREFORMAT_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:case c.Y.TEXTUREFORMAT_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:case c.Y.TEXTUREFORMAT_COMPRESSED_RGBA8_ETC2_EAC:case c.Y.TEXTUREFORMAT_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:return!0;default:return!1}}(e.textureFormat)||u!==s||d!==l?[4,g(e,u,d,r,i)]:[3,3];case 2:return[2,o.sent()];case 3:return[4,e.readPixels(r,i)];case 4:if(!(p=o.sent()))throw new Error("Failed to read pixels from texture ".concat(e.name,"."));if(p instanceof Float32Array){for(f=new Uint8Array(p.length),m=p.length;m--;)v=p[m],f[m]=Math.round(255*(0,h.Clamp)(v));p=f}return[2,p]}}))}))}var y={CreateResizedCopy:d,ApplyPostProcess:p,ToHalfFloat:f,FromHalfFloat:m,GetTextureDataAsync:v}},16814:(e,t,n)=>{n.d(t,{D:()=>o});var r=n(8046),i=n(81152),o=function(){function e(){}return e.ConvertPanoramaToCubemap=function(e,t,n,r,o,a){if(void 0===o&&(o=!1),void 0===a&&(a=!0),!e)throw"ConvertPanoramaToCubemap: input cannot be null";var s=0;if(e.length!=t*n*3){if(e.length!=t*n*4)throw"ConvertPanoramaToCubemap: input size is wrong";s=4}else s=3;return{front:this.CreateCubemapTexture(r,this.FACE_FRONT,e,t,n,o,a,s),back:this.CreateCubemapTexture(r,this.FACE_BACK,e,t,n,o,a,s),left:this.CreateCubemapTexture(r,this.FACE_LEFT,e,t,n,o,a,s),right:this.CreateCubemapTexture(r,this.FACE_RIGHT,e,t,n,o,a,s),up:this.CreateCubemapTexture(r,this.FACE_UP,e,t,n,o,a,s),down:this.CreateCubemapTexture(r,this.FACE_DOWN,e,t,n,o,a,s),size:r,type:i.Y.TEXTURETYPE_FLOAT,format:i.Y.TEXTUREFORMAT_RGB,gammaSpace:!1}},e.CreateCubemapTexture=function(e,t,n,r,i,o,a,s){for(var l=new ArrayBuffer(e*e*4*3),c=new Float32Array(l),u=o?Math.max(1,Math.round(r/4/e)):1,h=1/u,d=h*h,p=t[1].subtract(t[0]).scale(h/e),f=t[3].subtract(t[2]).scale(h/e),m=1/e,_=0,g=0;gMath.PI;)a-=2*Math.PI;var l=a/Math.PI,c=s/Math.PI;l=.5*l+.5;var u=Math.round(l*n);u<0?u=0:u>=n&&(u=n-1);var h=Math.round(c*r);h<0?h=0:h>=r&&(h=r-1);var d=o?r-h-1:h;return{r:t[d*n*i+u*i+0],g:t[d*n*i+u*i+1],b:t[d*n*i+u*i+2]}},e.FACE_LEFT=[new r.Pq(-1,-1,-1),new r.Pq(1,-1,-1),new r.Pq(-1,1,-1),new r.Pq(1,1,-1)],e.FACE_RIGHT=[new r.Pq(1,-1,1),new r.Pq(-1,-1,1),new r.Pq(1,1,1),new r.Pq(-1,1,1)],e.FACE_FRONT=[new r.Pq(1,-1,-1),new r.Pq(1,-1,1),new r.Pq(1,1,-1),new r.Pq(1,1,1)],e.FACE_BACK=[new r.Pq(-1,-1,1),new r.Pq(-1,-1,-1),new r.Pq(-1,1,1),new r.Pq(-1,1,-1)],e.FACE_DOWN=[new r.Pq(1,1,-1),new r.Pq(1,1,1),new r.Pq(-1,1,-1),new r.Pq(-1,1,1)],e.FACE_UP=[new r.Pq(-1,-1,-1),new r.Pq(-1,-1,1),new r.Pq(1,-1,-1),new r.Pq(1,-1,1)],e}()},16882:(e,t,n)=>{var r=n(98519),i="pbrDirectLightingFalloffFunctions";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="fn computeDistanceLightFalloff_Standard(lightOffset: vec3f,range: f32)->f32\n{return max(0.,1.0-length(lightOffset)/range);}\nfn computeDistanceLightFalloff_Physical(lightDistanceSquared: f32)->f32\n{return 1.0/maxEps(lightDistanceSquared);}\nfn computeDistanceLightFalloff_GLTF(lightDistanceSquared: f32,inverseSquaredRange: f32)->f32\n{var lightDistanceFalloff: f32=1.0/maxEps(lightDistanceSquared);var factor: f32=lightDistanceSquared*inverseSquaredRange;var attenuation: f32=saturate(1.0-factor*factor);attenuation*=attenuation;lightDistanceFalloff*=attenuation;return lightDistanceFalloff;}\nfn computeDirectionalLightFalloff_IES(lightDirection: vec3f,directionToLightCenterW: vec3f,iesLightTexture: texture_2d,iesLightTextureSampler: sampler)->f32\n{var cosAngle: f32=dot(-lightDirection,directionToLightCenterW);var angle=acos(cosAngle)/PI;return textureSampleLevel(iesLightTexture,iesLightTextureSampler,vec2f(angle,0),0.).r;}\nfn computeDistanceLightFalloff(lightOffset: vec3f,lightDistanceSquared: f32,range: f32,inverseSquaredRange: f32)->f32\n{\n#ifdef USEPHYSICALLIGHTFALLOFF\nreturn computeDistanceLightFalloff_Physical(lightDistanceSquared);\n#elif defined(USEGLTFLIGHTFALLOFF)\nreturn computeDistanceLightFalloff_GLTF(lightDistanceSquared,inverseSquaredRange);\n#else\nreturn computeDistanceLightFalloff_Standard(lightOffset,range);\n#endif\n}\nfn computeDirectionalLightFalloff_Standard(lightDirection: vec3f,directionToLightCenterW: vec3f,cosHalfAngle: f32,exponent: f32)->f32\n{var falloff: f32=0.0;var cosAngle: f32=maxEps(dot(-lightDirection,directionToLightCenterW));if (cosAngle>=cosHalfAngle)\n{falloff=max(0.,pow(cosAngle,exponent));}\nreturn falloff;}\nfn computeDirectionalLightFalloff_Physical(lightDirection: vec3f,directionToLightCenterW: vec3f,cosHalfAngle: f32)->f32\n{const kMinusLog2ConeAngleIntensityRatio: f32=6.64385618977; \nvar concentrationKappa: f32=kMinusLog2ConeAngleIntensityRatio/(1.0-cosHalfAngle);var lightDirectionSpreadSG: vec4f= vec4f(-lightDirection*concentrationKappa,-concentrationKappa);var falloff: f32=exp2(dot( vec4f(directionToLightCenterW,1.0),lightDirectionSpreadSG));return falloff;}\nfn computeDirectionalLightFalloff_GLTF(lightDirection: vec3f,directionToLightCenterW: vec3f,lightAngleScale: f32,lightAngleOffset: f32)->f32\n{var cd: f32=dot(-lightDirection,directionToLightCenterW);var falloff: f32=saturate(cd*lightAngleScale+lightAngleOffset);falloff*=falloff;return falloff;}\nfn computeDirectionalLightFalloff(lightDirection: vec3f,directionToLightCenterW: vec3f,cosHalfAngle: f32,exponent: f32,lightAngleScale: f32,lightAngleOffset: f32)->f32\n{\n#ifdef USEPHYSICALLIGHTFALLOFF\nreturn computeDirectionalLightFalloff_Physical(lightDirection,directionToLightCenterW,cosHalfAngle);\n#elif defined(USEGLTFLIGHTFALLOFF)\nreturn computeDirectionalLightFalloff_GLTF(lightDirection,directionToLightCenterW,lightAngleScale,lightAngleOffset);\n#else\nreturn computeDirectionalLightFalloff_Standard(lightDirection,directionToLightCenterW,cosHalfAngle,exponent);\n#endif\n}")},17152:(e,t,n)=>{n.r(t),n.d(t,{pbrVertexShader:()=>s});var r=n(98519),i=(n(42858),"pbrVertexDeclaration");r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="uniform mat4 view;uniform mat4 viewProjection;uniform vec4 vEyePosition;\n#ifdef MULTIVIEW\nmat4 viewProjectionR;\n#endif\n#ifdef ALBEDO\nuniform mat4 albedoMatrix;uniform vec2 vAlbedoInfos;\n#endif\n#ifdef BASE_WEIGHT\nuniform mat4 baseWeightMatrix;uniform vec2 vBaseWeightInfos;\n#endif\nuniform float baseDiffuseRoughness;\n#ifdef BASE_DIFFUSE_ROUGHNESS\nuniform mat4 baseDiffuseRoughnessMatrix;uniform vec2 vBaseDiffuseRoughnessInfos;\n#endif\n#ifdef AMBIENT\nuniform mat4 ambientMatrix;uniform vec4 vAmbientInfos;\n#endif\n#ifdef OPACITY\nuniform mat4 opacityMatrix;uniform vec2 vOpacityInfos;\n#endif\n#ifdef EMISSIVE\nuniform vec2 vEmissiveInfos;uniform mat4 emissiveMatrix;\n#endif\n#ifdef LIGHTMAP\nuniform vec2 vLightmapInfos;uniform mat4 lightmapMatrix;\n#endif\n#ifdef REFLECTIVITY\nuniform vec3 vReflectivityInfos;uniform mat4 reflectivityMatrix;\n#endif\n#ifdef METALLIC_REFLECTANCE\nuniform vec2 vMetallicReflectanceInfos;uniform mat4 metallicReflectanceMatrix;\n#endif\n#ifdef REFLECTANCE\nuniform vec2 vReflectanceInfos;uniform mat4 reflectanceMatrix;\n#endif\n#ifdef MICROSURFACEMAP\nuniform vec2 vMicroSurfaceSamplerInfos;uniform mat4 microSurfaceSamplerMatrix;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;uniform mat4 bumpMatrix;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nuniform vec4 cameraInfo;\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;uniform mat4 reflectionMatrix;\n#endif\n#ifdef CLEARCOAT\n#if defined(CLEARCOAT_TEXTURE) || defined(CLEARCOAT_TEXTURE_ROUGHNESS)\nuniform vec4 vClearCoatInfos;\n#endif\n#ifdef CLEARCOAT_TEXTURE\nuniform mat4 clearCoatMatrix;\n#endif\n#ifdef CLEARCOAT_TEXTURE_ROUGHNESS\nuniform mat4 clearCoatRoughnessMatrix;\n#endif\n#ifdef CLEARCOAT_BUMP\nuniform vec2 vClearCoatBumpInfos;uniform mat4 clearCoatBumpMatrix;\n#endif\n#ifdef CLEARCOAT_TINT_TEXTURE\nuniform vec2 vClearCoatTintInfos;uniform mat4 clearCoatTintMatrix;\n#endif\n#endif\n#ifdef IRIDESCENCE\n#if defined(IRIDESCENCE_TEXTURE) || defined(IRIDESCENCE_THICKNESS_TEXTURE)\nuniform vec4 vIridescenceInfos;\n#endif\n#ifdef IRIDESCENCE_TEXTURE\nuniform mat4 iridescenceMatrix;\n#endif\n#ifdef IRIDESCENCE_THICKNESS_TEXTURE\nuniform mat4 iridescenceThicknessMatrix;\n#endif\n#endif\n#ifdef ANISOTROPIC\n#ifdef ANISOTROPIC_TEXTURE\nuniform vec2 vAnisotropyInfos;uniform mat4 anisotropyMatrix;\n#endif\n#endif\n#ifdef SHEEN\n#if defined(SHEEN_TEXTURE) || defined(SHEEN_TEXTURE_ROUGHNESS)\nuniform vec4 vSheenInfos;\n#endif\n#ifdef SHEEN_TEXTURE\nuniform mat4 sheenMatrix;\n#endif\n#ifdef SHEEN_TEXTURE_ROUGHNESS\nuniform mat4 sheenRoughnessMatrix;\n#endif\n#endif\n#ifdef SUBSURFACE\n#ifdef SS_REFRACTION\nuniform vec4 vRefractionInfos;uniform mat4 refractionMatrix;\n#endif\n#ifdef SS_THICKNESSANDMASK_TEXTURE\nuniform vec2 vThicknessInfos;uniform mat4 thicknessMatrix;\n#endif\n#ifdef SS_REFRACTIONINTENSITY_TEXTURE\nuniform vec2 vRefractionIntensityInfos;uniform mat4 refractionIntensityMatrix;\n#endif\n#ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE\nuniform vec2 vTranslucencyIntensityInfos;uniform mat4 translucencyIntensityMatrix;\n#endif\n#ifdef SS_TRANSLUCENCYCOLOR_TEXTURE\nuniform vec2 vTranslucencyColorInfos;uniform mat4 translucencyColorMatrix;\n#endif\n#endif\n#ifdef NORMAL\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\n#ifdef USESPHERICALFROMREFLECTIONMAP\n#ifdef SPHERICAL_HARMONICS\nuniform vec3 vSphericalL00;uniform vec3 vSphericalL1_1;uniform vec3 vSphericalL10;uniform vec3 vSphericalL11;uniform vec3 vSphericalL2_2;uniform vec3 vSphericalL2_1;uniform vec3 vSphericalL20;uniform vec3 vSphericalL21;uniform vec3 vSphericalL22;\n#else\nuniform vec3 vSphericalX;uniform vec3 vSphericalY;uniform vec3 vSphericalZ;uniform vec3 vSphericalXX_ZZ;uniform vec3 vSphericalYY_ZZ;uniform vec3 vSphericalZZ;uniform vec3 vSphericalXY;uniform vec3 vSphericalYZ;uniform vec3 vSphericalZX;\n#endif\n#endif\n#endif\n#endif\n#ifdef DETAIL\nuniform vec4 vDetailInfos;uniform mat4 detailMatrix;\n#endif\n#include\n#define ADDITIONAL_VERTEX_DECLARATION\n"),n(48915),n(77976),n(48493),n(75334),n(64244),n(36470),n(64400),n(38615),n(60965),n(60581),n(92518),n(42513),n(85637),n(72153),n(94785),n(48961),n(24444),n(67369),n(59262),n(58266),n(84589),n(35397),n(76898),n(49334),n(7761),n(45858),n(81067),n(35845),n(83057),n(62589),n(62136),n(45812),n(56458);var o="pbrVertexShader",a="#define PBR_VERTEX_SHADER\n#define CUSTOM_VERTEX_EXTENSION\nprecision highp float;\n#include<__decl__pbrVertex>\n#define CUSTOM_VERTEX_BEGIN\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef TANGENT\nattribute vec4 tangent;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#include[2..7]\n#include[1..7]\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include\n#include\n#include\n#include\n#include\n#include\n#include(_DEFINENAME_,ALBEDO,_VARYINGNAME_,Albedo)\n#include(_DEFINENAME_,BASE_WEIGHT,_VARYINGNAME_,BaseWeight)\n#include(_DEFINENAME_,BASE_DIFFUSE_ROUGHNESS,_VARYINGNAME_,BaseDiffuseRoughness)\n#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail)\n#include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient)\n#include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity)\n#include(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive)\n#include(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap)\n#include(_DEFINENAME_,REFLECTIVITY,_VARYINGNAME_,Reflectivity)\n#include(_DEFINENAME_,MICROSURFACEMAP,_VARYINGNAME_,MicroSurfaceSampler)\n#include(_DEFINENAME_,METALLIC_REFLECTANCE,_VARYINGNAME_,MetallicReflectance)\n#include(_DEFINENAME_,REFLECTANCE,_VARYINGNAME_,Reflectance)\n#include(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump)\n#include(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal)\n#ifdef CLEARCOAT\n#include(_DEFINENAME_,CLEARCOAT_TEXTURE,_VARYINGNAME_,ClearCoat)\n#include(_DEFINENAME_,CLEARCOAT_TEXTURE_ROUGHNESS,_VARYINGNAME_,ClearCoatRoughness)\n#include(_DEFINENAME_,CLEARCOAT_BUMP,_VARYINGNAME_,ClearCoatBump)\n#include(_DEFINENAME_,CLEARCOAT_TINT_TEXTURE,_VARYINGNAME_,ClearCoatTint)\n#endif\n#ifdef IRIDESCENCE\n#include(_DEFINENAME_,IRIDESCENCE_TEXTURE,_VARYINGNAME_,Iridescence)\n#include(_DEFINENAME_,IRIDESCENCE_THICKNESS_TEXTURE,_VARYINGNAME_,IridescenceThickness)\n#endif\n#ifdef SHEEN\n#include(_DEFINENAME_,SHEEN_TEXTURE,_VARYINGNAME_,Sheen)\n#include(_DEFINENAME_,SHEEN_TEXTURE_ROUGHNESS,_VARYINGNAME_,SheenRoughness)\n#endif\n#ifdef ANISOTROPIC\n#include(_DEFINENAME_,ANISOTROPIC_TEXTURE,_VARYINGNAME_,Anisotropy)\n#endif\n#ifdef SUBSURFACE\n#include(_DEFINENAME_,SS_THICKNESSANDMASK_TEXTURE,_VARYINGNAME_,Thickness)\n#include(_DEFINENAME_,SS_REFRACTIONINTENSITY_TEXTURE,_VARYINGNAME_,RefractionIntensity)\n#include(_DEFINENAME_,SS_TRANSLUCENCYINTENSITY_TEXTURE,_VARYINGNAME_,TranslucencyIntensity)\n#include(_DEFINENAME_,SS_TRANSLUCENCYCOLOR_TEXTURE,_VARYINGNAME_,TranslucencyColor)\n#endif\nvarying vec3 vPositionW;\n#if DEBUGMODE>0\nvarying vec4 vClipSpacePosition;\n#endif\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\nvarying vec3 vEnvironmentIrradiance;\n#include\n#endif\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#include\n#include\n#include\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\n#include\n#include[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#include\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvec3 positionUpdated=position;\n#ifdef NORMAL\nvec3 normalUpdated=normal;\n#endif\n#ifdef TANGENT\nvec4 tangentUpdated=tangent;\n#endif\n#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#ifdef UV2\nvec2 uv2Updated=uv2;\n#endif\n#ifdef VERTEXCOLOR\nvec4 colorUpdated=color;\n#endif\n#include\n#include[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\nvPositionUVW=positionUpdated;\n#endif\n#define CUSTOM_VERTEX_UPDATE_POSITION\n#define CUSTOM_VERTEX_UPDATE_NORMAL\n#include\n#if defined(PREPASS) && ((defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR)) && !defined(BONES_VELOCITY_ENABLED)\nvCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);vPreviousPosition=previousViewProjection*finalPreviousWorld*vec4(positionUpdated,1.0);\n#endif\n#include\n#include\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);vPositionW=vec3(worldPos);\n#ifdef PREPASS\n#include\n#endif\n#ifdef NORMAL\nmat3 normalWorld=mat3(finalWorld);\n#if defined(INSTANCES) && defined(THIN_INSTANCES)\nvNormalW=normalUpdated/vec3(dot(normalWorld[0],normalWorld[0]),dot(normalWorld[1],normalWorld[1]),dot(normalWorld[2],normalWorld[2]));vNormalW=normalize(normalWorld*vNormalW);\n#else\n#ifdef NONUNIFORMSCALING\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\n#endif\nvNormalW=normalize(normalWorld*normalUpdated);\n#endif\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\n#if BASE_DIFFUSE_MODEL != BRDF_DIFFUSE_MODEL_LAMBERT && BASE_DIFFUSE_MODEL != BRDF_DIFFUSE_MODEL_LEGACY\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);float NdotV=max(dot(vNormalW,viewDirectionW),0.0);vec3 roughNormal=mix(vNormalW,viewDirectionW,(0.5*(1.0-NdotV))*baseDiffuseRoughness);vec3 reflectionVector=vec3(reflectionMatrix*vec4(roughNormal,0)).xyz;\n#else\nvec3 reflectionVector=vec3(reflectionMatrix*vec4(vNormalW,0)).xyz;\n#endif\n#ifdef REFLECTIONMAP_OPPOSITEZ\nreflectionVector.z*=-1.0;\n#endif\nvEnvironmentIrradiance=computeEnvironmentIrradiance(reflectionVector);\n#endif\n#endif\n#define CUSTOM_VERTEX_UPDATE_WORLDPOS\n#ifdef MULTIVIEW\nif (gl_ViewID_OVR==0u) {gl_Position=viewProjection*worldPos;} else {gl_Position=viewProjectionR*worldPos;}\n#else\ngl_Position=viewProjection*worldPos;\n#endif\n#if DEBUGMODE>0\nvClipSpacePosition=gl_Position;\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvDirectionW=normalize(vec3(finalWorld*vec4(positionUpdated,0.0)));\n#endif\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvViewDepth=(view*worldPos).z;\n#endif\n#ifndef UV1\nvec2 uvUpdated=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2Updated=vec2(0.,0.);\n#endif\n#ifdef MAINUV1\nvMainUV1=uvUpdated;\n#endif\n#ifdef MAINUV2\nvMainUV2=uv2Updated;\n#endif\n#include[3..7]\n#include(_DEFINENAME_,ALBEDO,_VARYINGNAME_,Albedo,_MATRIXNAME_,albedo,_INFONAME_,AlbedoInfos.x)\n#include(_DEFINENAME_,BASE_WEIGHT,_VARYINGNAME_,BaseWeight,_MATRIXNAME_,baseWeight,_INFONAME_,BaseWeightInfos.x)\n#include(_DEFINENAME_,BASE_DIFFUSE_ROUGHNESS,_VARYINGNAME_,BaseDiffuseRoughness,_MATRIXNAME_,baseDiffuseRoughness,_INFONAME_,BaseDiffuseRoughnessInfos.x)\n#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail,_MATRIXNAME_,detail,_INFONAME_,DetailInfos.x)\n#include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_MATRIXNAME_,ambient,_INFONAME_,AmbientInfos.x)\n#include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_MATRIXNAME_,opacity,_INFONAME_,OpacityInfos.x)\n#include(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_MATRIXNAME_,emissive,_INFONAME_,EmissiveInfos.x)\n#include(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_MATRIXNAME_,lightmap,_INFONAME_,LightmapInfos.x)\n#include(_DEFINENAME_,REFLECTIVITY,_VARYINGNAME_,Reflectivity,_MATRIXNAME_,reflectivity,_INFONAME_,ReflectivityInfos.x)\n#include(_DEFINENAME_,MICROSURFACEMAP,_VARYINGNAME_,MicroSurfaceSampler,_MATRIXNAME_,microSurfaceSampler,_INFONAME_,MicroSurfaceSamplerInfos.x)\n#include(_DEFINENAME_,METALLIC_REFLECTANCE,_VARYINGNAME_,MetallicReflectance,_MATRIXNAME_,metallicReflectance,_INFONAME_,MetallicReflectanceInfos.x)\n#include(_DEFINENAME_,REFLECTANCE,_VARYINGNAME_,Reflectance,_MATRIXNAME_,reflectance,_INFONAME_,ReflectanceInfos.x)\n#include(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump,_MATRIXNAME_,bump,_INFONAME_,BumpInfos.x)\n#include(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_MATRIXNAME_,decal,_INFONAME_,DecalInfos.x)\n#ifdef CLEARCOAT\n#include(_DEFINENAME_,CLEARCOAT_TEXTURE,_VARYINGNAME_,ClearCoat,_MATRIXNAME_,clearCoat,_INFONAME_,ClearCoatInfos.x)\n#include(_DEFINENAME_,CLEARCOAT_TEXTURE_ROUGHNESS,_VARYINGNAME_,ClearCoatRoughness,_MATRIXNAME_,clearCoatRoughness,_INFONAME_,ClearCoatInfos.z)\n#include(_DEFINENAME_,CLEARCOAT_BUMP,_VARYINGNAME_,ClearCoatBump,_MATRIXNAME_,clearCoatBump,_INFONAME_,ClearCoatBumpInfos.x)\n#include(_DEFINENAME_,CLEARCOAT_TINT_TEXTURE,_VARYINGNAME_,ClearCoatTint,_MATRIXNAME_,clearCoatTint,_INFONAME_,ClearCoatTintInfos.x)\n#endif\n#ifdef IRIDESCENCE\n#include(_DEFINENAME_,IRIDESCENCE_TEXTURE,_VARYINGNAME_,Iridescence,_MATRIXNAME_,iridescence,_INFONAME_,IridescenceInfos.x)\n#include(_DEFINENAME_,IRIDESCENCE_THICKNESS_TEXTURE,_VARYINGNAME_,IridescenceThickness,_MATRIXNAME_,iridescenceThickness,_INFONAME_,IridescenceInfos.z)\n#endif\n#ifdef SHEEN\n#include(_DEFINENAME_,SHEEN_TEXTURE,_VARYINGNAME_,Sheen,_MATRIXNAME_,sheen,_INFONAME_,SheenInfos.x)\n#include(_DEFINENAME_,SHEEN_TEXTURE_ROUGHNESS,_VARYINGNAME_,SheenRoughness,_MATRIXNAME_,sheenRoughness,_INFONAME_,SheenInfos.z)\n#endif\n#ifdef ANISOTROPIC\n#include(_DEFINENAME_,ANISOTROPIC_TEXTURE,_VARYINGNAME_,Anisotropy,_MATRIXNAME_,anisotropy,_INFONAME_,AnisotropyInfos.x)\n#endif\n#ifdef SUBSURFACE\n#include(_DEFINENAME_,SS_THICKNESSANDMASK_TEXTURE,_VARYINGNAME_,Thickness,_MATRIXNAME_,thickness,_INFONAME_,ThicknessInfos.x)\n#include(_DEFINENAME_,SS_REFRACTIONINTENSITY_TEXTURE,_VARYINGNAME_,RefractionIntensity,_MATRIXNAME_,refractionIntensity,_INFONAME_,RefractionIntensityInfos.x)\n#include(_DEFINENAME_,SS_TRANSLUCENCYINTENSITY_TEXTURE,_VARYINGNAME_,TranslucencyIntensity,_MATRIXNAME_,translucencyIntensity,_INFONAME_,TranslucencyIntensityInfos.x)\n#include(_DEFINENAME_,SS_TRANSLUCENCYCOLOR_TEXTURE,_VARYINGNAME_,TranslucencyColor,_MATRIXNAME_,translucencyColor,_INFONAME_,TranslucencyColorInfos.x)\n#endif\n#include\n#include\n#include\n#include[0..maxSimultaneousLights]\n#include\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#include\n#define CUSTOM_VERTEX_MAIN_END\n}\n";r.l.ShadersStore[o]||(r.l.ShadersStore[o]=a);var s={name:o,shader:a}},17198:(e,t,n)=>{var r=n(82673);n(92142),r.$.prototype.getStencilBuffer=function(){return this._stencilState.stencilTest},r.$.prototype.setStencilBuffer=function(e){this._stencilState.stencilTest=e},r.$.prototype.getStencilMask=function(){return this._stencilState.stencilMask},r.$.prototype.setStencilMask=function(e){this._stencilState.stencilMask=e},r.$.prototype.getStencilFunction=function(){return this._stencilState.stencilFunc},r.$.prototype.getStencilBackFunction=function(){return this._stencilState.stencilBackFunc},r.$.prototype.getStencilFunctionReference=function(){return this._stencilState.stencilFuncRef},r.$.prototype.getStencilFunctionMask=function(){return this._stencilState.stencilFuncMask},r.$.prototype.setStencilFunction=function(e){this._stencilState.stencilFunc=e},r.$.prototype.setStencilBackFunction=function(e){this._stencilState.stencilBackFunc=e},r.$.prototype.setStencilFunctionReference=function(e){this._stencilState.stencilFuncRef=e},r.$.prototype.setStencilFunctionMask=function(e){this._stencilState.stencilFuncMask=e},r.$.prototype.getStencilOperationFail=function(){return this._stencilState.stencilOpStencilFail},r.$.prototype.getStencilBackOperationFail=function(){return this._stencilState.stencilBackOpStencilFail},r.$.prototype.getStencilOperationDepthFail=function(){return this._stencilState.stencilOpDepthFail},r.$.prototype.getStencilBackOperationDepthFail=function(){return this._stencilState.stencilBackOpDepthFail},r.$.prototype.getStencilOperationPass=function(){return this._stencilState.stencilOpStencilDepthPass},r.$.prototype.getStencilBackOperationPass=function(){return this._stencilState.stencilBackOpStencilDepthPass},r.$.prototype.setStencilOperationFail=function(e){this._stencilState.stencilOpStencilFail=e},r.$.prototype.setStencilBackOperationFail=function(e){this._stencilState.stencilBackOpStencilFail=e},r.$.prototype.setStencilOperationDepthFail=function(e){this._stencilState.stencilOpDepthFail=e},r.$.prototype.setStencilBackOperationDepthFail=function(e){this._stencilState.stencilBackOpDepthFail=e},r.$.prototype.setStencilOperationPass=function(e){this._stencilState.stencilOpStencilDepthPass=e},r.$.prototype.setStencilBackOperationPass=function(e){this._stencilState.stencilBackOpStencilDepthPass=e},r.$.prototype.cacheStencilState=function(){this._cachedStencilBuffer=this.getStencilBuffer(),this._cachedStencilFunction=this.getStencilFunction(),this._cachedStencilMask=this.getStencilMask(),this._cachedStencilOperationPass=this.getStencilOperationPass(),this._cachedStencilOperationFail=this.getStencilOperationFail(),this._cachedStencilOperationDepthFail=this.getStencilOperationDepthFail(),this._cachedStencilReference=this.getStencilFunctionReference()},r.$.prototype.restoreStencilState=function(){this.setStencilFunction(this._cachedStencilFunction),this.setStencilMask(this._cachedStencilMask),this.setStencilBuffer(this._cachedStencilBuffer),this.setStencilOperationPass(this._cachedStencilOperationPass),this.setStencilOperationFail(this._cachedStencilOperationFail),this.setStencilOperationDepthFail(this._cachedStencilOperationDepthFail),this.setStencilFunctionReference(this._cachedStencilReference)}},17347:(e,t,n)=>{n.d(t,{M1:()=>T,Mi:()=>y,NJ:()=>P,VB:()=>b,W$:()=>x,ZP:()=>M,dy:()=>F,eC:()=>S,f2:()=>O,hX:()=>v,my:()=>I,ny:()=>A,qc:()=>E,rh:()=>L,rz:()=>D,sh:()=>R,wS:()=>N,zU:()=>C});var r=n(78322),i=n(46799),o=n(5153),a=n(66377),s=n(23148),l=n(49449),c=n(91016),u=n(37530),h=n(35930),d=n(66614),p=n(7164),f=n(53695),m=n(24894),_=n(82673),g=new RegExp(/^data:([^,]+\/[^,]+)?;base64,/i),v=function(e){function t(n,r){var o=e.call(this,n,c.tG.LoadFileError)||this;return o.name="LoadFileError",c.Cf._setPrototypeOf(o,t.prototype),r instanceof i.u?o.request=r:o.file=r,o}return(0,r.C6)(t,e),t}(c.bu),y=function(e){function t(n,r){var i=e.call(this,n,c.tG.RequestFileError)||this;return i.request=r,i.name="RequestFileError",c.Cf._setPrototypeOf(i,t.prototype),i}return(0,r.C6)(t,e),t}(c.bu),b=function(e){function t(n,r){var i=e.call(this,n,c.tG.ReadFileError)||this;return i.file=r,i.name="ReadFileError",c.Cf._setPrototypeOf(i,t.prototype),i}return(0,r.C6)(t,e),t}(c.bu),S={DefaultRetryStrategy:l.a.ExponentialBackoff(),BaseUrl:"",CorsBehavior:"anonymous",PreprocessUrl:function(e){return e},ScriptBaseUrl:"",ScriptPreprocessUrl:function(e){return e},CleanUrl:function(e){return e.replace(/#/gm,"%23")}},T=function(e,t){if((!e||0!==e.indexOf("data:"))&&S.CorsBehavior)if("string"==typeof S.CorsBehavior||S.CorsBehavior instanceof String)t.crossOrigin=S.CorsBehavior;else{var n=S.CorsBehavior(e);n&&(t.crossOrigin=n)}},E={getRequiredSize:null},x=function(e,t,n,o,a,l,c){if(void 0===a&&(a=""),void 0===c&&(c=d.q.LastCreatedEngine),"undefined"==typeof HTMLImageElement&&!(null==c?void 0:c._features.forceBitmapOverHTMLImageElement))return n("LoadImage is only supported in web or BabylonNative environments."),null;var h,p=!1;e instanceof ArrayBuffer||ArrayBuffer.isView(e)?"undefined"!=typeof Blob&&"undefined"!=typeof URL?(h=URL.createObjectURL(new Blob([e],{type:a})),p=!0):h="data:".concat(a,";base64,")+(0,u.EL)(e):e instanceof Blob?(h=URL.createObjectURL(e),p=!0):(h=S.CleanUrl(e),h=S.PreprocessUrl(h));var f=function(t){if(n){var r=h||e.toString();n("Error while trying to load image: ".concat(0===r.indexOf("http")||r.length<=128?r:r.slice(0,128)+"..."),t)}};if(null==c?void 0:c._features.forceBitmapOverHTMLImageElement)return C(h,(function(i){c.createImageBitmap(new Blob([i],{type:a}),(0,r.Cl)({premultiplyAlpha:"none"},l)).then((function(e){t(e),p&&URL.revokeObjectURL(h)})).catch((function(t){n&&n("Error while trying to load image: "+e,t)}))}),void 0,o||void 0,!0,(function(e,t){f(t)})),null;var m=new Image;if(E.getRequiredSize){var _=E.getRequiredSize(e);_.width&&(m.width=_.width),_.height&&(m.height=_.height)}T(h,m);var g=[],v=function(){for(var e=0,t=g;e=200&&r.status<300||0===r.status&&(!(0,o.BA)()||I())){var n=s?r.response:r.responseText;if(null!==n){try{t&&t(n,r)}catch(e){_(e)}return}}var c=S.DefaultRetryStrategy;if(c){var d=c(h,r,p);if(-1!==d)return u(),r=new i.u,void(a=setTimeout((function(){return g(p+1)}),d))}var m=new y("Error status: "+r.status+" "+r.statusText+" - Unable to load "+h,r);l&&l(m)}},r.addEventListener("readystatechange",e),r.send()}};g(0)};if(r&&r.enableSceneOffline&&!e.startsWith("blob:")){var g=function(e){e&&e.status>400?l&&l(e):_()};r.open((function(){r&&r.loadFile(S.BaseUrl+e,(function(e){!f&&t&&t(e),m.onCompleteObservable.notifyObservers(m)}),n?function(e){!f&&n&&n(e)}:void 0,g,s)}),g)}else _();return m},A=function(e){var t=M(e),n=t.match,r=t.type;if(n)return r||void 0;var i=e.lastIndexOf(".");switch(e.substring(i+1).toLowerCase()){case"glb":return"model/gltf-binary";case"bin":return"application/octet-stream";case"gltf":return"model/gltf+json";case"jpg":case"jpeg":return"image/jpeg";case"png":return"image/png";case"webp":return"image/webp";case"ktx":return"image/ktx";case"ktx2":return"image/ktx2";case"avif":return"image/avif";default:return}},I=function(){return"undefined"!=typeof location&&"file:"===location.protocol},O=function(e){return g.test(e)},M=function(e){var t=g.exec(e);return null===t||0===t.length?{match:!1,type:""}:{match:!0,type:t[0].replace("data:","").replace(";base64,","")}};function D(e){return(0,u.yS)(e.split(",")[1])}var N,F=function(e){return(0,u.AV)(e.split(",")[1])};_.$._FileToolsLoadImage=x,m.sg.loadFile=C,h.Hd.loadFile=C;var L=function(e,t,n,r,i,o,a,s,l,c){N={DecodeBase64UrlToBinary:e,DecodeBase64UrlToString:t,DefaultRetryStrategy:n.DefaultRetryStrategy,BaseUrl:n.BaseUrl,CorsBehavior:n.CorsBehavior,PreprocessUrl:n.PreprocessUrl,IsBase64DataUrl:r,IsFileURL:i,LoadFile:o,LoadImage:a,ReadFile:s,RequestFile:l,SetCorsBehavior:c},Object.defineProperty(N,"DefaultRetryStrategy",{get:function(){return n.DefaultRetryStrategy},set:function(e){n.DefaultRetryStrategy=e}}),Object.defineProperty(N,"BaseUrl",{get:function(){return n.BaseUrl},set:function(e){n.BaseUrl=e}}),Object.defineProperty(N,"PreprocessUrl",{get:function(){return n.PreprocessUrl},set:function(e){n.PreprocessUrl=e}}),Object.defineProperty(N,"CorsBehavior",{get:function(){return n.CorsBehavior},set:function(e){n.CorsBehavior=e}})};L(D,F,S,O,I,C,x,P,R,T)},17393:(e,t,n)=>{n.r(t),n.d(t,{helperFunctionsWGSL:()=>a});var r=n(98519),i="helperFunctions",o="const PI: f32=3.1415926535897932384626433832795;const TWO_PI: f32=6.283185307179586;const HALF_PI: f32=1.5707963267948966;const RECIPROCAL_PI: f32=0.3183098861837907;const RECIPROCAL_PI2: f32=0.15915494309189535;const RECIPROCAL_PI4: f32=0.07957747154594767;const HALF_MIN: f32=5.96046448e-08; \nconst LinearEncodePowerApprox: f32=2.2;const GammaEncodePowerApprox: f32=1.0/LinearEncodePowerApprox;const LuminanceEncodeApprox: vec3f=vec3f(0.2126,0.7152,0.0722);const Epsilon:f32=0.0000001;fn square(x: f32)->f32 {return x*x;}\nfn saturate(x: f32)->f32 {return clamp(x,0.0,1.0);}\nfn saturateVec3(x: vec3f)->vec3f {return clamp(x,vec3f(),vec3f(1.0));}\nfn saturateEps(x: f32)->f32 {return clamp(x,Epsilon,1.0);}\nfn maxEps(x: f32)->f32 {return max(x,Epsilon);}\nfn maxEpsVec3(x: vec3f)->vec3f {return max(x,vec3f(Epsilon));}\nfn absEps(x: f32)->f32 {return abs(x)+Epsilon;}\nfn transposeMat3(inMatrix: mat3x3f)->mat3x3f {let i0: vec3f=inMatrix[0];let i1: vec3f=inMatrix[1];let i2: vec3f=inMatrix[2];let outMatrix:mat3x3f=mat3x3f(\nvec3(i0.x,i1.x,i2.x),\nvec3(i0.y,i1.y,i2.y),\nvec3(i0.z,i1.z,i2.z)\n);return outMatrix;}\nfn inverseMat3(inMatrix: mat3x3f)->mat3x3f {let a00: f32=inMatrix[0][0];let a01: f32=inMatrix[0][1];let a02: f32=inMatrix[0][2];let a10: f32=inMatrix[1][0];let a11: f32=inMatrix[1][1];let a12: f32=inMatrix[1][2];let a20: f32=inMatrix[2][0];let a21: f32=inMatrix[2][1];let a22: f32=inMatrix[2][2];let b01: f32=a22*a11-a12*a21;let b11: f32=-a22*a10+a12*a20;let b21: f32=a21*a10-a11*a20;let det: f32=a00*b01+a01*b11+a02*b21;return mat3x3f(b01/det,(-a22*a01+a02*a21)/det,(a12*a01-a02*a11)/det,\nb11/det,(a22*a00-a02*a20)/det,(-a12*a00+a02*a10)/det,\nb21/det,(-a21*a00+a01*a20)/det,(a11*a00-a01*a10)/det);}\n#if USE_EXACT_SRGB_CONVERSIONS\nfn toLinearSpaceExact(color: vec3f)->vec3f\n{let nearZeroSection: vec3f=0.0773993808*color;let remainingSection: vec3f=pow(0.947867299*(color+vec3f(0.055)),vec3f(2.4));return mix(remainingSection,nearZeroSection,lessThanEqual(color,vec3f(0.04045)));}\nfn toGammaSpaceExact(color: vec3f)->vec3f\n{let nearZeroSection: vec3f=12.92*color;let remainingSection: vec3f=1.055*pow(color,vec3f(0.41666))-vec3f(0.055);return mix(remainingSection,nearZeroSection,lessThanEqual(color,vec3f(0.0031308)));}\n#endif\nfn toLinearSpace(color: f32)->f32\n{\n#if USE_EXACT_SRGB_CONVERSIONS\nvar nearZeroSection=0.0773993808*color;var remainingSection=pow(0.947867299*(color+0.055),2.4);return select(remainingSection,nearZeroSection,color<=0.04045);\n#else\nreturn pow(color,LinearEncodePowerApprox);\n#endif\n}\nfn toLinearSpaceVec3(color: vec3f)->vec3f\n{\n#if USE_EXACT_SRGB_CONVERSIONS\nreturn toLinearSpaceExact(color);\n#else\nreturn pow(color,vec3f(LinearEncodePowerApprox));\n#endif\n}\nfn toLinearSpaceVec4(color: vec4)->vec4\n{\n#if USE_EXACT_SRGB_CONVERSIONS\nreturn vec4f(toLinearSpaceExact(color.rgb),color.a);\n#else\nreturn vec4f(pow(color.rgb,vec3f(LinearEncodePowerApprox)),color.a);\n#endif\n}\nfn toGammaSpace(color: vec4)->vec4\n{\n#if USE_EXACT_SRGB_CONVERSIONS\nreturn vec4(toGammaSpaceExact(color.rgb),color.a);\n#else\nreturn vec4(pow(color.rgb,vec3f(GammaEncodePowerApprox)),color.a);\n#endif\n}\nfn toGammaSpaceVec3(color: vec3f)->vec3f\n{\n#if USE_EXACT_SRGB_CONVERSIONS\nreturn toGammaSpaceExact(color);\n#else\nreturn pow(color,vec3f(GammaEncodePowerApprox));\n#endif\n}\nfn squareVec3(value: vec3f)->vec3f\n{return value*value;}\nfn pow5(value: f32)->f32 {let sq: f32=value*value;return sq*sq*value;}\nfn getLuminance(color: vec3f)->f32\n{return saturate(dot(color,LuminanceEncodeApprox));}\nfn getRand(seed: vec2)->f32 {return fract(sin(dot(seed.xy ,vec2(12.9898,78.233)))*43758.5453);}\nfn dither(seed: vec2,varianceAmount: f32)->f32 {let rand: f32=getRand(seed);let normVariance: f32=varianceAmount/255.0;let dither: f32=mix(-normVariance,normVariance,rand);return dither;}\nconst rgbdMaxRange: f32=255.0;fn toRGBD(color: vec3f)->vec4 {let maxRGB: f32=max(max(color.r,max(color.g,color.b)),Epsilon);var D: f32 =max(rgbdMaxRange/maxRGB,1.);D =clamp(floor(D)/255.0,0.,1.);var rgb: vec3f =color.rgb*D;rgb=toGammaSpaceVec3(rgb);return vec4(saturateVec3(rgb),D);}\nfn fromRGBD(rgbd: vec4)->vec3f {let rgb=toLinearSpaceVec3(rgbd.rgb);return rgb/rgbd.a;}\nfn parallaxCorrectNormal(vertexPos: vec3f,origVec: vec3f,cubeSize: vec3f,cubePos: vec3f)->vec3f {let invOrigVec: vec3f=vec3f(1.)/origVec;let halfSize: vec3f=cubeSize*0.5;let intersecAtMaxPlane: vec3f=(cubePos+halfSize-vertexPos)*invOrigVec;let intersecAtMinPlane: vec3f=(cubePos-halfSize-vertexPos)*invOrigVec;let largestIntersec: vec3f=max(intersecAtMaxPlane,intersecAtMinPlane);let distance: f32=min(min(largestIntersec.x,largestIntersec.y),largestIntersec.z);let intersectPositionWS: vec3f=vertexPos+origVec*distance;return intersectPositionWS-cubePos;}\nfn equirectangularToCubemapDirection(uv : vec2f)->vec3f {var longitude : f32=uv.x*TWO_PI-PI;var latitude : f32=HALF_PI-uv.y*PI;var direction : vec3f;direction.x=cos(latitude)*sin(longitude);direction.y=sin(latitude);direction.z=cos(latitude)*cos(longitude);return direction;}\nfn sqrtClamped(value: f32)->f32 {return sqrt(max(value,0.));}\nfn avg(value: vec3f)->f32 {return dot(value,vec3f(0.333333333));}\n";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]=o);var a={name:i,shader:o}},17706:(e,t,n)=>{n.r(t),n.d(t,{greasedLinePixelShaderWGSL:()=>a});var r=n(98519),i="greasedLinePixelShader",o="var grlColors: texture_2d;var grlColorsSampler: sampler;uniform grlUseColors: f32;uniform grlUseDash: f32;uniform grlDashArray: f32;uniform grlDashOffset: f32;uniform grlDashRatio: f32;uniform grlVisibility: f32;uniform grlColorsWidth: f32;uniform grl_colorModeAndColorDistributionType: vec2f;uniform grlColor: vec3f;varying grlCounters: f32;varying grlColorPointer: f32;\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\nlet grlColorMode: f32=uniforms.grl_colorModeAndColorDistributionType.x;let grlColorDistributionType: f32=uniforms.grl_colorModeAndColorDistributionType.y;var outColor=vec4(uniforms.grlColor,1.);outColor.a=step(fragmentInputs.grlCounters,uniforms.grlVisibility);if (outColor.a==0.0) {discard;}\nif (uniforms.grlUseDash==1.0) {let dashPosition=(fragmentInputs.grlCounters+uniforms.grlDashOffset) % uniforms.grlDashArray;outColor.a*=ceil(dashPosition-(uniforms.grlDashArray*uniforms.grlDashRatio));if (outColor.a==0.0) {discard;}}\nif (uniforms.grlUseColors==1.) {\n#ifdef GREASED_LINE_COLOR_DISTRIBUTION_TYPE_LINE\nlet grlColor: vec4f=textureSample(grlColors,grlColorsSampler,vec2f(fragmentInputs.grlCounters,0.));\n#else\nlet lookup: vec2f=vec2(fract(fragmentInputs.grlColorPointer/uniforms.grlColorsWidth),1.0-floor(fragmentInputs.grlColorPointer/uniforms.grlColorsWidth));let grlColor: vec4f=textureSample(grlColors,grlColorsSampler,lookup);\n#endif\nif (grlColorMode==COLOR_MODE_SET) {outColor=grlColor;} else if (grlColorMode==COLOR_MODE_ADD) {outColor+=grlColor;} else if (grlColorMode==COLOR_MODE_MULTIPLY) {outColor*=grlColor;}}\n#if !defined(PREPASS) && !defined(ORDER_INDEPENDENT_TRANSPARENCY)\nfragmentOutputs.color=outColor;\n#endif\n#if ORDER_INDEPENDENT_TRANSPARENCY\nif (fragDepth==nearestDepth) {fragmentOutputs.frontColor=vec4f(fragmentOutputs.frontColor.rgb+outColor.rgb*outColor.a*alphaMultiplier,1.0-alphaMultiplier*(1.0-outColor.a));} else {fragmentOutputs.backColor+=outColor;}\n#endif\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},17874:(e,t,n)=>{n.r(t),n.d(t,{iblScaledLuminancePixelShaderWGSL:()=>a});var r=n(98519),i=(n(17393),"iblScaledLuminancePixelShader"),o="#include\n#ifdef IBL_USE_CUBE_MAP\nvar iblSourceSampler: sampler;var iblSource: texture_cube;\n#else\nvar iblSourceSampler: sampler;var iblSource: texture_2d;\n#endif\nuniform iblHeight: i32;uniform iblWidth: i32;fn fetchLuminance(coords: vec2f)->f32 {\n#ifdef IBL_USE_CUBE_MAP\nvar direction: vec3f=equirectangularToCubemapDirection(coords);var color: vec3f=textureSampleLevel(iblSource,iblSourceSampler,direction,0.0).rgb;\n#else\nvar color: vec3f=textureSampleLevel(iblSource,iblSourceSampler,coords,0.0).rgb;\n#endif\nreturn dot(color,LuminanceEncodeApprox);}\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var deform: f32=sin(input.vUV.y*PI);var luminance: f32=fetchLuminance(input.vUV);fragmentOutputs.color=vec4f(vec3f(deform*luminance),1.0);}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},17900:(e,t,n)=>{n.d(t,{h:()=>o});var r=n(82673),i=n(81152),o=function(){function e(){}return Object.defineProperty(e,"DiffuseTextureEnabled",{get:function(){return this._DiffuseTextureEnabled},set:function(e){this._DiffuseTextureEnabled!==e&&(this._DiffuseTextureEnabled=e,r.$.MarkAllMaterialsAsDirty(i.Y.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"BaseWeightTextureEnabled",{get:function(){return this._BaseWeightTextureEnabled},set:function(e){this._BaseWeightTextureEnabled!==e&&(this._BaseWeightTextureEnabled=e,r.$.MarkAllMaterialsAsDirty(i.Y.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"BaseDiffuseRoughnessTextureEnabled",{get:function(){return this._BaseDiffuseRoughnessTextureEnabled},set:function(e){this._BaseDiffuseRoughnessTextureEnabled!==e&&(this._BaseDiffuseRoughnessTextureEnabled=e,r.$.MarkAllMaterialsAsDirty(i.Y.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"DetailTextureEnabled",{get:function(){return this._DetailTextureEnabled},set:function(e){this._DetailTextureEnabled!==e&&(this._DetailTextureEnabled=e,r.$.MarkAllMaterialsAsDirty(i.Y.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"DecalMapEnabled",{get:function(){return this._DecalMapEnabled},set:function(e){this._DecalMapEnabled!==e&&(this._DecalMapEnabled=e,r.$.MarkAllMaterialsAsDirty(i.Y.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"AmbientTextureEnabled",{get:function(){return this._AmbientTextureEnabled},set:function(e){this._AmbientTextureEnabled!==e&&(this._AmbientTextureEnabled=e,r.$.MarkAllMaterialsAsDirty(i.Y.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"OpacityTextureEnabled",{get:function(){return this._OpacityTextureEnabled},set:function(e){this._OpacityTextureEnabled!==e&&(this._OpacityTextureEnabled=e,r.$.MarkAllMaterialsAsDirty(i.Y.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"ReflectionTextureEnabled",{get:function(){return this._ReflectionTextureEnabled},set:function(e){this._ReflectionTextureEnabled!==e&&(this._ReflectionTextureEnabled=e,r.$.MarkAllMaterialsAsDirty(i.Y.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"EmissiveTextureEnabled",{get:function(){return this._EmissiveTextureEnabled},set:function(e){this._EmissiveTextureEnabled!==e&&(this._EmissiveTextureEnabled=e,r.$.MarkAllMaterialsAsDirty(i.Y.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"SpecularTextureEnabled",{get:function(){return this._SpecularTextureEnabled},set:function(e){this._SpecularTextureEnabled!==e&&(this._SpecularTextureEnabled=e,r.$.MarkAllMaterialsAsDirty(i.Y.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"BumpTextureEnabled",{get:function(){return this._BumpTextureEnabled},set:function(e){this._BumpTextureEnabled!==e&&(this._BumpTextureEnabled=e,r.$.MarkAllMaterialsAsDirty(i.Y.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"LightmapTextureEnabled",{get:function(){return this._LightmapTextureEnabled},set:function(e){this._LightmapTextureEnabled!==e&&(this._LightmapTextureEnabled=e,r.$.MarkAllMaterialsAsDirty(i.Y.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"RefractionTextureEnabled",{get:function(){return this._RefractionTextureEnabled},set:function(e){this._RefractionTextureEnabled!==e&&(this._RefractionTextureEnabled=e,r.$.MarkAllMaterialsAsDirty(i.Y.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"ColorGradingTextureEnabled",{get:function(){return this._ColorGradingTextureEnabled},set:function(e){this._ColorGradingTextureEnabled!==e&&(this._ColorGradingTextureEnabled=e,r.$.MarkAllMaterialsAsDirty(i.Y.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"FresnelEnabled",{get:function(){return this._FresnelEnabled},set:function(e){this._FresnelEnabled!==e&&(this._FresnelEnabled=e,r.$.MarkAllMaterialsAsDirty(i.Y.MATERIAL_FresnelDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"ClearCoatTextureEnabled",{get:function(){return this._ClearCoatTextureEnabled},set:function(e){this._ClearCoatTextureEnabled!==e&&(this._ClearCoatTextureEnabled=e,r.$.MarkAllMaterialsAsDirty(i.Y.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"ClearCoatBumpTextureEnabled",{get:function(){return this._ClearCoatBumpTextureEnabled},set:function(e){this._ClearCoatBumpTextureEnabled!==e&&(this._ClearCoatBumpTextureEnabled=e,r.$.MarkAllMaterialsAsDirty(i.Y.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"ClearCoatTintTextureEnabled",{get:function(){return this._ClearCoatTintTextureEnabled},set:function(e){this._ClearCoatTintTextureEnabled!==e&&(this._ClearCoatTintTextureEnabled=e,r.$.MarkAllMaterialsAsDirty(i.Y.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"SheenTextureEnabled",{get:function(){return this._SheenTextureEnabled},set:function(e){this._SheenTextureEnabled!==e&&(this._SheenTextureEnabled=e,r.$.MarkAllMaterialsAsDirty(i.Y.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"AnisotropicTextureEnabled",{get:function(){return this._AnisotropicTextureEnabled},set:function(e){this._AnisotropicTextureEnabled!==e&&(this._AnisotropicTextureEnabled=e,r.$.MarkAllMaterialsAsDirty(i.Y.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"ThicknessTextureEnabled",{get:function(){return this._ThicknessTextureEnabled},set:function(e){this._ThicknessTextureEnabled!==e&&(this._ThicknessTextureEnabled=e,r.$.MarkAllMaterialsAsDirty(i.Y.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"RefractionIntensityTextureEnabled",{get:function(){return this._ThicknessTextureEnabled},set:function(e){this._RefractionIntensityTextureEnabled!==e&&(this._RefractionIntensityTextureEnabled=e,r.$.MarkAllMaterialsAsDirty(i.Y.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"TranslucencyIntensityTextureEnabled",{get:function(){return this._TranslucencyIntensityTextureEnabled},set:function(e){this._TranslucencyIntensityTextureEnabled!==e&&(this._TranslucencyIntensityTextureEnabled=e,r.$.MarkAllMaterialsAsDirty(i.Y.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"TranslucencyColorTextureEnabled",{get:function(){return this._TranslucencyColorTextureEnabled},set:function(e){this._TranslucencyColorTextureEnabled!==e&&(this._TranslucencyColorTextureEnabled=e,r.$.MarkAllMaterialsAsDirty(i.Y.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"IridescenceTextureEnabled",{get:function(){return this._IridescenceTextureEnabled},set:function(e){this._IridescenceTextureEnabled!==e&&(this._IridescenceTextureEnabled=e,r.$.MarkAllMaterialsAsDirty(i.Y.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),e._DiffuseTextureEnabled=!0,e._BaseWeightTextureEnabled=!0,e._BaseDiffuseRoughnessTextureEnabled=!0,e._DetailTextureEnabled=!0,e._DecalMapEnabled=!0,e._AmbientTextureEnabled=!0,e._OpacityTextureEnabled=!0,e._ReflectionTextureEnabled=!0,e._EmissiveTextureEnabled=!0,e._SpecularTextureEnabled=!0,e._BumpTextureEnabled=!0,e._LightmapTextureEnabled=!0,e._RefractionTextureEnabled=!0,e._ColorGradingTextureEnabled=!0,e._FresnelEnabled=!0,e._ClearCoatTextureEnabled=!0,e._ClearCoatBumpTextureEnabled=!0,e._ClearCoatTintTextureEnabled=!0,e._SheenTextureEnabled=!0,e._AnisotropicTextureEnabled=!0,e._ThicknessTextureEnabled=!0,e._RefractionIntensityTextureEnabled=!0,e._TranslucencyIntensityTextureEnabled=!0,e._TranslucencyColorTextureEnabled=!0,e._IridescenceTextureEnabled=!0,e}()},17998:(e,t,n)=>{n.r(t),n.d(t,{FlowGraphCodeExecutionBlock:()=>a});var r=n(78322),i=n(45749),o=n(88099),a=function(e){function t(t){var n=e.call(this,t)||this;return n.config=t,n.executionFunction=n.registerDataInput("function",o.Vv),n.value=n.registerDataInput("value",o.Vv),n.result=n.registerDataOutput("result",o.Vv),n}return(0,r.C6)(t,e),t.prototype._updateOutputs=function(e){var t=this.executionFunction.getValue(e),n=this.value.getValue(e);t&&this.result.setValue(t(n,e),e)},t.prototype.getClassName=function(){return"FlowGraphCodeExecutionBlock"},t}(i.e)},18132:(e,t,n)=>{n.r(t),n.d(t,{FlowGraphBooleanToFloat:()=>l,FlowGraphBooleanToInt:()=>c,FlowGraphFloatToBoolean:()=>u,FlowGraphFloatToInt:()=>p,FlowGraphIntToBoolean:()=>h,FlowGraphIntToFloat:()=>d});var r=n(78322),i=n(23101),o=n(88099),a=n(34623),s=n(40099),l=function(e){function t(t){return e.call(this,o.RI,o.Es,(function(e){return+e}),"FlowGraphBooleanToFloat",t)||this}return(0,r.C6)(t,e),t}(i.a);(0,a.Y5)("FlowGraphBooleanToFloat",l);var c=function(e){function t(t){return e.call(this,o.RI,o.x2,(function(e){return s.P.FromValue(+e)}),"FlowGraphBooleanToInt",t)||this}return(0,r.C6)(t,e),t}(i.a);(0,a.Y5)("FlowGraphBooleanToInt",c);var u=function(e){function t(t){return e.call(this,o.Es,o.RI,(function(e){return!!e}),"FlowGraphFloatToBoolean",t)||this}return(0,r.C6)(t,e),t}(i.a);(0,a.Y5)("FlowGraphFloatToBoolean",u);var h=function(e){function t(t){return e.call(this,o.x2,o.RI,(function(e){return!!e.value}),"FlowGraphIntToBoolean",t)||this}return(0,r.C6)(t,e),t}(i.a);(0,a.Y5)("FlowGraphIntToBoolean",h);var d=function(e){function t(t){return e.call(this,o.x2,o.Es,(function(e){return e.value}),"FlowGraphIntToFloat",t)||this}return(0,r.C6)(t,e),t}(i.a);(0,a.Y5)("FlowGraphIntToFloat",d);var p=function(e){function t(t){return e.call(this,o.Es,o.x2,(function(e){switch(null==t?void 0:t.roundingMode){case"floor":return s.P.FromValue(Math.floor(e));case"ceil":return s.P.FromValue(Math.ceil(e));case"round":return s.P.FromValue(Math.round(e));default:return s.P.FromValue(e)}}),"FlowGraphFloatToInt",t)||this}return(0,r.C6)(t,e),t}(i.a);(0,a.Y5)("FlowGraphFloatToInt",p)},18149:(e,t,n)=>{n.r(t),n.d(t,{ComputeShaderBoundingHelper:()=>d});var r=n(78322),i=n(75227),o=n(1554),a=n(62623),s=n(8046),l=n(75482),c=n(98519),u="boundingInfoComputeShader";c.l.ShadersStoreWGSL[u]||(c.l.ShadersStoreWGSL[u]="struct Results {minX : atomic,\nminY : atomic,\nminZ : atomic,\nmaxX : atomic,\nmaxY : atomic,\nmaxZ : atomic,\ndummy1 : i32,\ndummy2 : i32,};fn floatToBits(value: f32)->i32 {return bitcast(value);}\nfn bitsToFloat(value: i32)->f32 {return bitcast(value);}\nfn atomicMinFloat(atomicVar: ptr,read_write>,value: f32) {let intValue=floatToBits(value);loop {let oldIntValue=atomicLoad(atomicVar);let oldValue=bitsToFloat(oldIntValue);if (value>=oldValue) {break;}\nif (atomicCompareExchangeWeak(atomicVar,oldIntValue,intValue).old_value==oldIntValue) {break;}}}\nfn atomicMaxFloat(atomicVar: ptr,read_write>,value: f32) {let intValue=floatToBits(value);loop {let oldIntValue=atomicLoad(atomicVar);let oldValue=bitsToFloat(oldIntValue);if (value<=oldValue) {break;}\nif (atomicCompareExchangeWeak(atomicVar,oldIntValue,intValue).old_value==oldIntValue) {break;}}}\nfn readMatrixFromRawSampler(smp : texture_2d,index : f32)->mat4x4\n{let offset=i32(index) *4; \nlet m0=textureLoad(smp,vec2(offset+0,0),0);let m1=textureLoad(smp,vec2(offset+1,0),0);let m2=textureLoad(smp,vec2(offset+2,0),0);let m3=textureLoad(smp,vec2(offset+3,0),0);return mat4x4(m0,m1,m2,m3);}\nconst identity=mat4x4f(\nvec4f(1.0,0.0,0.0,0.0),\nvec4f(0.0,1.0,0.0,0.0),\nvec4f(0.0,0.0,1.0,0.0),\nvec4f(0.0,0.0,0.0,1.0)\n);struct Settings {morphTargetTextureInfo: vec3f,\nmorphTargetCount: f32,\nindexResult : u32,};@group(0) @binding(0) var positionBuffer : array;@group(0) @binding(1) var resultBuffer : array;@group(0) @binding(7) var settings : Settings;\n#if NUM_BONE_INFLUENCERS>0\n@group(0) @binding(2) var boneSampler : texture_2d;@group(0) @binding(3) var indexBuffer : array;@group(0) @binding(4) var weightBuffer : array;\n#if NUM_BONE_INFLUENCERS>4\n@group(0) @binding(5) var indexExtraBuffer : array;@group(0) @binding(6) var weightExtraBuffer : array;\n#endif\n#endif\n#ifdef MORPHTARGETS\n@group(0) @binding(8) var morphTargets : texture_2d_array;@group(0) @binding(9) var morphTargetInfluences : array;@group(0) @binding(10) var morphTargetTextureIndices : array;\n#endif\n#ifdef MORPHTARGETS\nfn readVector3FromRawSampler(targetIndex : i32,vertexIndex : u32)->vec3f\n{ \nlet vertexID=f32(vertexIndex)*settings.morphTargetTextureInfo.x;let y=floor(vertexID/settings.morphTargetTextureInfo.y);let x=vertexID-y*settings.morphTargetTextureInfo.y;let textureUV=vec2(i32(x),i32(y));return textureLoad(morphTargets,textureUV,i32(morphTargetTextureIndices[targetIndex]),0).xyz;}\nfn readVector4FromRawSampler(targetIndex : i32,vertexIndex : u32)->vec4f\n{ \nlet vertexID=f32(vertexIndex)*settings.morphTargetTextureInfo.x;let y=floor(vertexID/settings.morphTargetTextureInfo.y);let x=vertexID-y*settings.morphTargetTextureInfo.y;let textureUV=vec2(i32(x),i32(y));return textureLoad(morphTargets,textureUV,i32(morphTargetTextureIndices[targetIndex]),0);}\n#endif\n@compute @workgroup_size(256,1,1)\nfn main(@builtin(global_invocation_id) global_id : vec3) {let index=global_id.x;if (index>=arrayLength(&positionBuffer)/3) {return;}\nlet position=vec3f(positionBuffer[index*3],positionBuffer[index*3+1],positionBuffer[index*3+2]);var finalWorld=identity;var positionUpdated=position;\n#if NUM_BONE_INFLUENCERS>0\nvar influence : mat4x4;let matricesIndices=indexBuffer[index];let matricesWeights=weightBuffer[index];influence=readMatrixFromRawSampler(boneSampler,matricesIndices[0])*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\ninfluence=influence+readMatrixFromRawSampler(boneSampler,matricesIndices[1])*matricesWeights[1];\n#endif \n#if NUM_BONE_INFLUENCERS>2\ninfluence=influence+readMatrixFromRawSampler(boneSampler,matricesIndices[2])*matricesWeights[2];\n#endif \n#if NUM_BONE_INFLUENCERS>3\ninfluence=influence+readMatrixFromRawSampler(boneSampler,matricesIndices[3])*matricesWeights[3];\n#endif \n#if NUM_BONE_INFLUENCERS>4\nlet matricesIndicesExtra=indexExtraBuffer[index];let matricesWeightsExtra=weightExtraBuffer[index];influence=influence+readMatrixFromRawSampler(boneSampler,matricesIndicesExtra.x)*matricesWeightsExtra.x;\n#if NUM_BONE_INFLUENCERS>5\ninfluence=influence+readMatrixFromRawSampler(boneSampler,matricesIndicesExtra.y)*matricesWeightsExtra.y;\n#endif \n#if NUM_BONE_INFLUENCERS>6\ninfluence=influence+readMatrixFromRawSampler(boneSampler,matricesIndicesExtra.z)*matricesWeightsExtra.z;\n#endif \n#if NUM_BONE_INFLUENCERS>7\ninfluence=influence+readMatrixFromRawSampler(boneSampler,matricesIndicesExtra.w)*matricesWeightsExtra.w;\n#endif \n#endif \nfinalWorld=finalWorld*influence;\n#endif\n#ifdef MORPHTARGETS\nfor (var i=0; i=settings.morphTargetCount) {break;}\npositionUpdated=positionUpdated+(readVector3FromRawSampler(i,index)-position)*morphTargetInfluences[i];}\n#endif\nvar worldPos=finalWorld*vec4f(positionUpdated.x,positionUpdated.y,positionUpdated.z,1.0);atomicMinFloat(&resultBuffer[settings.indexResult].minX,worldPos.x);atomicMinFloat(&resultBuffer[settings.indexResult].minY,worldPos.y);atomicMinFloat(&resultBuffer[settings.indexResult].minZ,worldPos.z);atomicMaxFloat(&resultBuffer[settings.indexResult].maxX,worldPos.x);atomicMaxFloat(&resultBuffer[settings.indexResult].maxY,worldPos.y);atomicMaxFloat(&resultBuffer[settings.indexResult].maxZ,worldPos.z);}\n");var h=n(53695),d=function(){function e(e){this._computeShadersCache={},this._positionBuffers={},this._indexBuffers={},this._weightBuffers={},this._indexExtraBuffers={},this._weightExtraBuffers={},this._morphTargetInfluenceBuffers={},this._morphTargetTextureIndexBuffers={},this._ubos=[],this._uboIndex=0,this._processedMeshes=[],this._computeShaders=[],this._uniqueComputeShaders=new Set,this._resultBuffers=[],this._engine=e}return e.prototype._getComputeShader=function(e,t,n){var r,o=e.join("\n");if(this._computeShadersCache[o])r=this._computeShadersCache[o];else{var a={positionBuffer:{group:0,binding:0},resultBuffer:{group:0,binding:1},settings:{group:0,binding:7}};t&&(a.boneSampler={group:0,binding:2},a.indexBuffer={group:0,binding:3},a.weightBuffer={group:0,binding:4},a.indexExtraBuffer={group:0,binding:5},a.weightExtraBuffer={group:0,binding:6}),n&&(a.morphTargets={group:0,binding:8},a.morphTargetInfluences={group:0,binding:9},a.morphTargetTextureIndices={group:0,binding:10}),r=new i.H("boundingInfoCompute".concat(t?"_bones":"").concat(n?"_morphs":""),this._engine,"boundingInfo",{bindingsMapping:a,defines:e}),this._computeShadersCache[o]=r}return r},e.prototype._getUBO=function(){if(this._uboIndex>=this._ubos.length){var e=new l.D(this._engine);e.addFloat3("morphTargetTextureInfo",0,0,0),e.addUniform("morphTargetCount",1),e.addUniform("indexResult",1),this._ubos.push(e)}return this._ubos[this._uboIndex++]},e.prototype._extractDataAndLink=function(e,t,n,r,i,a){var s,l,c=t.getTotalVertices();if(a[t.uniqueId])l=a[t.uniqueId];else{var u=null===(s=t.getVertexBuffer(n))||void 0===s?void 0:s.getFloatData(c);(l=new o.K(this._engine,Float32Array.BYTES_PER_ELEMENT*c*r)).update(u),a[t.uniqueId]=l}e.setStorageBuffer(i,l)},e.prototype._prepareStorage=function(e,t,n,r,i,a){var s;r[n]?s=r[n]:(s=new o.K(this._engine,Float32Array.BYTES_PER_ELEMENT*i),r[n]=s),s.update(a),e.setStorageBuffer(t,s)},e.prototype.processAsync=function(e){return(0,r.sH)(this,void 0,void 0,(function(){return(0,r.YH)(this,(function(t){switch(t.label){case 0:return[4,this.registerMeshListAsync(e)];case 1:return t.sent(),this.processMeshList(),[4,this.fetchResultsForMeshListAsync()];case 2:return t.sent(),[2]}}))}))},e.prototype.registerMeshListAsync=function(e){var t=this;this._disposeForMeshList(),Array.isArray(e)||(e=[e]);for(var n=0,r=0;r0&&h.supportsPositions,p=d?u:c;if(this._extractDataAndLink(p,i,a.R.PositionKind,3,"positionBuffer",this._positionBuffers),i&&i.useBones&&i.computeBonesUsingShaders&&i.skeleton&&i.skeleton.useTextureToStoreBoneMatrices){this._extractDataAndLink(p,i,a.R.MatricesIndicesKind,4,"indexBuffer",this._indexBuffers),this._extractDataAndLink(p,i,a.R.MatricesWeightsKind,4,"weightBuffer",this._weightBuffers);var f=i.skeleton.getTransformMatrixTexture(i);p.setTexture("boneSampler",f,!1),i.numBoneInfluencers>4&&(this._extractDataAndLink(p,i,a.R.MatricesIndicesExtraKind,4,"indexExtraBuffer",this._indexExtraBuffers),this._extractDataAndLink(p,i,a.R.MatricesWeightsExtraKind,4,"weightExtraBuffer",this._weightExtraBuffers))}var m=this._getUBO();if(d){var _=h._targetStoreTexture;p.setTexture("morphTargets",_,!1),this._prepareStorage(p,"morphTargetInfluences",i.uniqueId,this._morphTargetInfluenceBuffers,h.numInfluencers,h.influences),this._prepareStorage(p,"morphTargetTextureIndices",i.uniqueId,this._morphTargetTextureIndexBuffers,h.numInfluencers,h._morphTargetTextureIndices),m.updateFloat3("morphTargetTextureInfo",h._textureVertexStride,h._textureWidth,h._textureHeight),m.updateFloat("morphTargetCount",h.numInfluencers),m.update()}p.setStorageBuffer("resultBuffer",n),p.setUniformBuffer("settings",m),p.dispatch(Math.ceil(s/256)),this._engine.flushFramebuffer()}}},e.prototype.fetchResultsForMeshListAsync=function(){return(0,r.sH)(this,void 0,void 0,(function(){var e=this;return(0,r.YH)(this,(function(t){switch(t.label){case 0:return[4,new Promise((function(t){for(var n=[],r=0,i=0;i0&&(l.minimizeInPlace(o.getBoundingInfo().minimum),c.maximizeInPlace(o.getBoundingInfo().maximum)),o._refreshBoundingInfoDirect(u)}n+=8*e._processedMeshes.length}for(var h=0,d=e._resultBuffers;h{n.d(t,{Ki:()=>u,mJ:()=>c,qK:()=>r});var r=new RegExp("\\.(\\w{3,4})($|\\?)"),i=100,o=new Float32Array([0,0]),a=null,s=null,l=null;function c(e,t,n){var r;if(a||(a=new Float32Array(i)),"linear"===e)return o[0]=t,o[1]=n,o;if("exponential"===e)r=function(){if(!s){s=new Float32Array(i);for(var e=1/(i-1),t=e,n=1;n{n.d(t,{g:()=>o});var r=n(78322),i=n(66377),o=function(e){function t(t){var n=e.call(this,t.engine,2)||this;return n._state=1,n.onEndedObservable=new i.cP,n.onErrorObservable=new i.cP,n.onStateChangedObservable=new i.cP,n._sound=t,n}return(0,r.C6)(t,e),Object.defineProperty(t.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){e.prototype.dispose.call(this),this.stop(),this.onEndedObservable.clear(),this.onStateChangedObservable.clear()},t.prototype._setState=function(e){this._state!==e&&(this._state=e,this.onStateChangedObservable.notifyObservers(this))},t}(n(95087).f0)},18337:(e,t,n)=>{n.r(t),n.d(t,{fluidRenderingParticleDepthPixelShader:()=>a});var r=n(98519),i="fluidRenderingParticleDepthPixelShader",o="uniform mat4 projection;varying vec2 uv;varying vec3 viewPos;varying float sphereRadius;\n#ifdef FLUIDRENDERING_VELOCITY\nvarying float velocityNorm;\n#endif\nvoid main(void) {vec3 normal;normal.xy=uv*2.0-1.0;float r2=dot(normal.xy,normal.xy);if (r2>1.0) discard;normal.z=sqrt(1.0-r2);\n#ifndef FLUIDRENDERING_RHS\nnormal.z=-normal.z;\n#endif\nvec4 realViewPos=vec4(viewPos+normal*sphereRadius,1.0);vec4 clipSpacePos=projection*realViewPos;\n#ifdef WEBGPU\ngl_FragDepth=clipSpacePos.z/clipSpacePos.w;\n#else\ngl_FragDepth=(clipSpacePos.z/clipSpacePos.w)*0.5+0.5;\n#endif\n#ifdef FLUIDRENDERING_RHS\nrealViewPos.z=-realViewPos.z;\n#endif\n#ifdef FLUIDRENDERING_VELOCITY\nglFragColor=vec4(realViewPos.z,velocityNorm,0.,1.);\n#else\nglFragColor=vec4(realViewPos.z,0.,0.,1.);\n#endif\n}\n";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},18644:(e,t,n)=>{var r=n(98519),i="fresnelFunction";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#ifdef FRESNEL\nfloat computeFresnelTerm(vec3 viewDirection,vec3 worldNormal,float bias,float power)\n{float fresnelTerm=pow(bias+abs(dot(viewDirection,worldNormal)),power);return clamp(fresnelTerm,0.,1.);}\n#endif\n")},18778:(e,t,n)=>{n.r(t),n.d(t,{copyTextureToTexturePixelShader:()=>a});var r=n(98519),i=(n(75334),"copyTextureToTexturePixelShader"),o="uniform float conversion;uniform sampler2D textureSampler;varying vec2 vUV;\n#include\nvoid main(void) \n{\n#ifdef NO_SAMPLER\nvec4 color=texelFetch(textureSampler,ivec2(gl_FragCoord.xy),0);\n#else\nvec4 color=texture2D(textureSampler,vUV);\n#endif\n#ifdef DEPTH_TEXTURE\ngl_FragDepth=color.r;\n#else\nif (conversion==1.) {color=toLinearSpace(color);} else if (conversion==2.) {color=toGammaSpace(color);}\ngl_FragColor=color;\n#endif\n}\n";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},18924:(e,t,n)=>{n.r(t),n.d(t,{outlineVertexShader:()=>a});var r=n(98519),i=(n(36470),n(64400),n(24444),n(67369),n(85637),n(38615),n(59262),n(58266),n(84589),n(35397),n(76898),n(49334),n(83057),n(56458),"outlineVertexShader"),o="attribute vec3 position;attribute vec3 normal;\n#include\n#include\n#include\n#include[0..maxSimultaneousMorphTargets]\n#include\nuniform float offset;\n#include\nuniform mat4 viewProjection;\n#ifdef ALPHATEST\nvarying vec2 vUV;uniform mat4 diffuseMatrix;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#endif\n#include\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void)\n{vec3 positionUpdated=position;vec3 normalUpdated=normal;\n#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#ifdef UV2\nvec2 uv2Updated=uv2;\n#endif\n#include\n#include[0..maxSimultaneousMorphTargets]\nvec3 offsetPosition=positionUpdated+(normalUpdated*offset);\n#include\n#include\n#include\nvec4 worldPos=finalWorld*vec4(offsetPosition,1.0);gl_Position=viewProjection*worldPos;\n#ifdef ALPHATEST\n#ifdef UV1\nvUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef UV2\nvUV=vec2(diffuseMatrix*vec4(uv2Updated,1.0,0.0));\n#endif\n#endif\n#include\n#include\n}\n";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},18973:(e,t,n)=>{var r=n(98519),i="pbrDirectLightingFunctions";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#define CLEARCOATREFLECTANCE90 1.0\nstruct lightingInfo\n{vec3 diffuse;\n#ifdef SS_TRANSLUCENCY\nvec3 diffuseTransmission;\n#endif\n#ifdef SPECULARTERM\nvec3 specular;\n#endif\n#ifdef CLEARCOAT\nvec4 clearCoat;\n#endif\n#ifdef SHEEN\nvec3 sheen;\n#endif\n};float adjustRoughnessFromLightProperties(float roughness,float lightRadius,float lightDistance) {\n#if defined(USEPHYSICALLIGHTFALLOFF) || defined(USEGLTFLIGHTFALLOFF)\nfloat lightRoughness=lightRadius/lightDistance;float totalRoughness=saturate(lightRoughness+roughness);return totalRoughness;\n#else\nreturn roughness;\n#endif\n}\nvec3 computeHemisphericDiffuseLighting(preLightingInfo info,vec3 lightColor,vec3 groundColor) {return mix(groundColor,lightColor,info.NdotL);}\n#if defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)\nvec3 computeAreaDiffuseLighting(preLightingInfo info,vec3 lightColor) {return info.areaLightDiffuse*lightColor;}\n#endif\nvec3 computeDiffuseLighting(preLightingInfo info,vec3 lightColor) {vec3 diffuseTerm=vec3(1.0/PI);\n#if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_LEGACY\ndiffuseTerm=vec3(diffuseBRDF_Burley(info.NdotL,info.NdotV,info.VdotH,info.roughness));\n#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY\ndiffuseTerm=vec3(diffuseBRDF_Burley(info.NdotL,info.NdotV,info.VdotH,info.diffuseRoughness));\n#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON\nvec3 clampedAlbedo=clamp(info.surfaceAlbedo,vec3(0.1),vec3(1.0));diffuseTerm=diffuseBRDF_EON(clampedAlbedo,info.diffuseRoughness,info.NdotL,info.NdotV,info.LdotV);diffuseTerm/=clampedAlbedo;\n#endif\nreturn diffuseTerm*info.attenuation*info.NdotL*lightColor;}\n#define inline\nvec3 computeProjectionTextureDiffuseLighting(sampler2D projectionLightSampler,mat4 textureProjectionMatrix,vec3 posW){vec4 strq=textureProjectionMatrix*vec4(posW,1.0);strq/=strq.w;vec3 textureColor=texture2D(projectionLightSampler,strq.xy).rgb;return toLinearSpace(textureColor);}\n#ifdef SS_TRANSLUCENCY\nvec3 computeDiffuseTransmittedLighting(preLightingInfo info,vec3 lightColor,vec3 transmittance) {vec3 transmittanceNdotL=vec3(0.);float NdotL=absEps(info.NdotLUnclamped);\n#ifndef SS_TRANSLUCENCY_LEGACY\nif (info.NdotLUnclamped<0.0) {\n#endif\nfloat wrapNdotL=computeWrappedDiffuseNdotL(NdotL,0.02);float trAdapt=step(0.,info.NdotLUnclamped);transmittanceNdotL=mix(transmittance*wrapNdotL,vec3(wrapNdotL),trAdapt);\n#ifndef SS_TRANSLUCENCY_LEGACY\n}\nvec3 diffuseTerm=vec3(1.0/PI);\n#if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_LEGACY\ndiffuseTerm=vec3(diffuseBRDF_Burley(info.NdotL,info.NdotV,info.VdotH,info.roughness));\n#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY\ndiffuseTerm=vec3(diffuseBRDF_Burley(info.NdotL,info.NdotV,info.VdotH,info.diffuseRoughness));\n#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON\nvec3 clampedAlbedo=clamp(info.surfaceAlbedo,vec3(0.1),vec3(1.0));diffuseTerm=diffuseBRDF_EON(clampedAlbedo,info.diffuseRoughness,info.NdotL,info.NdotV,info.LdotV);diffuseTerm/=clampedAlbedo;\n#endif\n#else\nfloat diffuseTerm=diffuseBRDF_Burley(NdotL,info.NdotV,info.VdotH,info.roughness);\n#endif\nreturn diffuseTerm*transmittanceNdotL*info.attenuation*lightColor;}\n#endif\n#ifdef SPECULARTERM\nvec3 computeSpecularLighting(preLightingInfo info,vec3 N,vec3 reflectance0,vec3 fresnel,float geometricRoughnessFactor,vec3 lightColor) {float NdotH=saturateEps(dot(N,info.H));float roughness=max(info.roughness,geometricRoughnessFactor);float alphaG=convertRoughnessToAverageSlope(roughness);\n#ifdef IRIDESCENCE\nfresnel=mix(fresnel,reflectance0,info.iridescenceIntensity);\n#endif\nfloat distribution=normalDistributionFunction_TrowbridgeReitzGGX(NdotH,alphaG);\n#ifdef BRDF_V_HEIGHT_CORRELATED\nfloat smithVisibility=smithVisibility_GGXCorrelated(info.NdotL,info.NdotV,alphaG);\n#else\nfloat smithVisibility=smithVisibility_TrowbridgeReitzGGXFast(info.NdotL,info.NdotV,alphaG);\n#endif\nvec3 specTerm=fresnel*distribution*smithVisibility;return specTerm*info.attenuation*info.NdotL*lightColor;}\n#if defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)\nvec3 computeAreaSpecularLighting(preLightingInfo info,vec3 specularColor,vec3 reflectance0,vec3 reflectance90) {vec3 fresnel=specularColor*info.areaLightFresnel.x*reflectance0+( vec3( 1.0 )-specularColor )*info.areaLightFresnel.y*reflectance90;return specularColor*fresnel*info.areaLightSpecular;}\n#endif\n#endif\n#ifdef FUZZ\nfloat evalFuzz(vec3 L,float NdotL,float NdotV,vec3 T,vec3 B,vec3 ltcLut)\n{if (NdotL<=0.0 || NdotV<=0.0)\nreturn 0.0;mat3 M=mat3(\nvec3(ltcLut.r,0.0,0.0),\nvec3(ltcLut.g,1.0,0.0),\nvec3(0.0,0.0,1.0)\n);vec3 Llocal=vec3(dot(L,T),dot(L,B),NdotL);vec3 Lwarp=normalize(M*Llocal);float cosThetaWarp=max(Lwarp.z,0.0);return cosThetaWarp*NdotL;}\n#endif\n#if defined(ANISOTROPIC) && defined(ANISOTROPIC_OPENPBR)\nvec3 computeAnisotropicSpecularLighting(preLightingInfo info,vec3 V,vec3 N,vec3 T,vec3 B,float anisotropy,float geometricRoughnessFactor,vec3 lightColor) {float NdotH=saturateEps(dot(N,info.H));float TdotH=dot(T,info.H);float BdotH=dot(B,info.H);float TdotV=dot(T,V);float BdotV=dot(B,V);float TdotL=dot(T,info.L);float BdotL=dot(B,info.L);float alphaG=convertRoughnessToAverageSlope(info.roughness);vec2 alphaTB=getAnisotropicRoughness(alphaG,anisotropy);alphaTB=max(alphaTB,square(geometricRoughnessFactor));float distribution=normalDistributionFunction_BurleyGGX_Anisotropic(NdotH,TdotH,BdotH,alphaTB);float smithVisibility=smithVisibility_GGXCorrelated_Anisotropic(info.NdotL,info.NdotV,TdotV,BdotV,TdotL,BdotL,alphaTB);vec3 specTerm=vec3(distribution*smithVisibility);return specTerm*info.attenuation*info.NdotL*lightColor;}\n#elif defined(ANISOTROPIC)\nvec3 computeAnisotropicSpecularLighting(preLightingInfo info,vec3 V,vec3 N,vec3 T,vec3 B,float anisotropy,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,vec3 lightColor) {float NdotH=saturateEps(dot(N,info.H));float TdotH=dot(T,info.H);float BdotH=dot(B,info.H);float TdotV=dot(T,V);float BdotV=dot(B,V);float TdotL=dot(T,info.L);float BdotL=dot(B,info.L);float alphaG=convertRoughnessToAverageSlope(info.roughness);vec2 alphaTB=getAnisotropicRoughness(alphaG,anisotropy);alphaTB=max(alphaTB,square(geometricRoughnessFactor));vec3 fresnel=fresnelSchlickGGX(info.VdotH,reflectance0,reflectance90);\n#ifdef IRIDESCENCE\nfresnel=mix(fresnel,reflectance0,info.iridescenceIntensity);\n#endif\nfloat distribution=normalDistributionFunction_BurleyGGX_Anisotropic(NdotH,TdotH,BdotH,alphaTB);float smithVisibility=smithVisibility_GGXCorrelated_Anisotropic(info.NdotL,info.NdotV,TdotV,BdotV,TdotL,BdotL,alphaTB);vec3 specTerm=fresnel*distribution*smithVisibility;return specTerm*info.attenuation*info.NdotL*lightColor;}\n#endif\n#ifdef CLEARCOAT\nvec4 computeClearCoatLighting(preLightingInfo info,vec3 Ncc,float geometricRoughnessFactor,float clearCoatIntensity,vec3 lightColor) {float NccdotL=saturateEps(dot(Ncc,info.L));float NccdotH=saturateEps(dot(Ncc,info.H));float clearCoatRoughness=max(info.roughness,geometricRoughnessFactor);float alphaG=convertRoughnessToAverageSlope(clearCoatRoughness);float fresnel=fresnelSchlickGGX(info.VdotH,vClearCoatRefractionParams.x,CLEARCOATREFLECTANCE90);fresnel*=clearCoatIntensity;float distribution=normalDistributionFunction_TrowbridgeReitzGGX(NccdotH,alphaG);float kelemenVisibility=visibility_Kelemen(info.VdotH);float clearCoatTerm=fresnel*distribution*kelemenVisibility;return vec4(\nclearCoatTerm*info.attenuation*NccdotL*lightColor,\n1.0-fresnel\n);}\nvec3 computeClearCoatLightingAbsorption(float NdotVRefract,vec3 L,vec3 Ncc,vec3 clearCoatColor,float clearCoatThickness,float clearCoatIntensity) {vec3 LRefract=-refract(L,Ncc,vClearCoatRefractionParams.y);float NdotLRefract=saturateEps(dot(Ncc,LRefract));vec3 absorption=computeClearCoatAbsorption(NdotVRefract,NdotLRefract,clearCoatColor,clearCoatThickness,clearCoatIntensity);return absorption;}\n#endif\n#ifdef SHEEN\nvec3 computeSheenLighting(preLightingInfo info,vec3 N,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,vec3 lightColor) {float NdotH=saturateEps(dot(N,info.H));float roughness=max(info.roughness,geometricRoughnessFactor);float alphaG=convertRoughnessToAverageSlope(roughness);float fresnel=1.;float distribution=normalDistributionFunction_CharlieSheen(NdotH,alphaG);/*#ifdef SHEEN_SOFTER\nfloat visibility=visibility_CharlieSheen(info.NdotL,info.NdotV,alphaG);\n#else */\nfloat visibility=visibility_Ashikhmin(info.NdotL,info.NdotV);/* #endif */\nfloat sheenTerm=fresnel*distribution*visibility;return sheenTerm*info.attenuation*info.NdotL*lightColor;}\n#endif\n")},18985:(e,t,n)=>{n.r(t),n.d(t,{iblIcdfPixelShader:()=>a});var r=n(98519),i=(n(75334),"iblIcdfPixelShader"),o="precision highp sampler2D;\n#include\nvarying vec2 vUV;\n#ifdef IBL_USE_CUBE_MAP\nuniform samplerCube iblSource;\n#else\nuniform sampler2D iblSource;\n#endif\nuniform sampler2D scaledLuminanceSampler;uniform int iblWidth;uniform int iblHeight;uniform sampler2D cdfx;uniform sampler2D cdfy;float fetchLuminance(vec2 coords) {\n#ifdef IBL_USE_CUBE_MAP\nvec3 direction=equirectangularToCubemapDirection(coords);vec3 color=textureCubeLodEXT(iblSource,direction,0.0).rgb;\n#else\nvec3 color=textureLod(iblSource,coords,0.0).rgb;\n#endif\nreturn dot(color,LuminanceEncodeApprox);}\nfloat fetchCDFx(int x) { return texelFetch(cdfx,ivec2(x,0),0).x; }\nfloat bisectx(int size,float targetValue) {int a=0,b=size-1;while (b-a>1) {int c=a+b>>1;if (fetchCDFx(c)1) {int c=a+b>>1;if (fetchCDFy(c,invocationId){n.d(t,{EE:()=>p,ER:()=>o,Ky:()=>a,Tf:()=>s,fd:()=>u,fg:()=>l,jk:()=>r,rl:()=>d,v9:()=>h,xO:()=>c,yj:()=>f});var r=function(){function e(){}return e._UpdateFlagSeed=0,e}();function i(e,t,n,r,i,a,s,l,c,u,h,d,p,f,m,_,g){var v=e.asArray();v[0]=t,v[1]=n,v[2]=r,v[3]=i,v[4]=a,v[5]=s,v[6]=l,v[7]=c,v[8]=u,v[9]=h,v[10]=d,v[11]=p,v[12]=f,v[13]=m,v[14]=_,v[15]=g,o(e)}function o(e){e.updateFlag=r._UpdateFlagSeed++}function a(e){i(e,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)}function s(e,t,n,r){i(r,1,0,0,0,0,1,0,0,0,0,1,0,e,t,n,1)}function l(e,t,n,r){i(r,e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1)}function c(e,t,n,r){void 0===r&&(r=0);var i=e.asArray(),o=t.asArray(),a=i[0],s=i[1],l=i[2],c=i[3],u=i[4],h=i[5],d=i[6],p=i[7],f=i[8],m=i[9],_=i[10],g=i[11],v=i[12],y=i[13],b=i[14],S=i[15],T=o[0],E=o[1],x=o[2],P=o[3],C=o[4],R=o[5],A=o[6],I=o[7],O=o[8],M=o[9],D=o[10],N=o[11],F=o[12],L=o[13],w=o[14],B=o[15];n[r]=a*T+s*C+l*O+c*F,n[r+1]=a*E+s*R+l*M+c*L,n[r+2]=a*x+s*A+l*D+c*w,n[r+3]=a*P+s*I+l*N+c*B,n[r+4]=u*T+h*C+d*O+p*F,n[r+5]=u*E+h*R+d*M+p*L,n[r+6]=u*x+h*A+d*D+p*w,n[r+7]=u*P+h*I+d*N+p*B,n[r+8]=f*T+m*C+_*O+g*F,n[r+9]=f*E+m*R+_*M+g*L,n[r+10]=f*x+m*A+_*D+g*w,n[r+11]=f*P+m*I+_*N+g*B,n[r+12]=v*T+y*C+b*O+S*F,n[r+13]=v*E+y*R+b*M+S*L,n[r+14]=v*x+y*A+b*D+S*w,n[r+15]=v*P+y*I+b*N+S*B}function u(e,t,n,r){void 0===r&&(r=0),c(e,t,n.asArray(),r),o(n)}function h(e,t){d(e,t.asArray()),o(t)}function d(e,t,n){void 0===n&&(n=0);var r=e.asArray();t[n]=r[0],t[n+1]=r[1],t[n+2]=r[2],t[n+3]=r[3],t[n+4]=r[4],t[n+5]=r[5],t[n+6]=r[6],t[n+7]=r[7],t[n+8]=r[8],t[n+9]=r[9],t[n+10]=r[10],t[n+11]=r[11],t[n+12]=r[12],t[n+13]=r[13],t[n+14]=r[14],t[n+15]=r[15]}function p(e,t){var n=f(e,t.asArray());return n&&o(t),n}function f(e,t){var n=e.asArray(),r=n[0],i=n[1],o=n[2],a=n[3],s=n[4],l=n[5],c=n[6],u=n[7],h=n[8],d=n[9],p=n[10],f=n[11],m=n[12],_=n[13],g=n[14],v=n[15],y=p*v-g*f,b=d*v-_*f,S=d*g-_*p,T=h*v-m*f,E=h*g-p*m,x=h*_-m*d,P=+(l*y-c*b+u*S),C=-(s*y-c*T+u*E),R=+(s*b-l*T+u*x),A=-(s*S-l*E+c*x),I=r*P+i*C+o*R+a*A;if(0===I)return!1;var O=1/I,M=c*v-g*u,D=l*v-_*u,N=l*g-_*c,F=s*v-m*u,L=s*g-m*c,w=s*_-m*l,B=c*f-p*u,V=l*f-d*u,U=l*p-d*c,G=s*f-h*u,k=s*p-h*c,z=s*d-h*l,W=-(i*y-o*b+a*S),H=+(r*y-o*T+a*E),Y=-(r*b-i*T+a*x),X=+(r*S-i*E+o*x),j=+(i*M-o*D+a*N),q=-(r*M-o*F+a*L),K=+(r*D-i*F+a*w),Z=-(r*N-i*L+o*w),Q=-(i*B-o*V+a*U),J=+(r*B-o*G+a*k),$=-(r*V-i*G+a*z),ee=+(r*U-i*k+o*z);return t[0]=P*O,t[1]=W*O,t[2]=j*O,t[3]=Q*O,t[4]=C*O,t[5]=H*O,t[6]=q*O,t[7]=J*O,t[8]=R*O,t[9]=Y*O,t[10]=K*O,t[11]=$*O,t[12]=A*O,t[13]=X*O,t[14]=Z*O,t[15]=ee*O,!0}},19061:(e,t,n)=>{n.r(t),n.d(t,{ssaoCombinePixelShader:()=>a});var r=n(98519),i="ssaoCombinePixelShader",o="uniform sampler2D textureSampler;uniform sampler2D originalColor;uniform vec4 viewport;varying vec2 vUV;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\nvec2 uv=viewport.xy+vUV*viewport.zw;vec4 ssaoColor=texture2D(textureSampler,uv);vec4 sceneColor=texture2D(originalColor,uv);gl_FragColor=sceneColor*ssaoColor;\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},19133:(e,t,n)=>{n.d(t,{G:()=>r,h:()=>s});var r,i=n(78322),o=n(66377),a=n(55204);!function(e){e[e.Unknown=0]="Unknown",e[e.Url=1]="Url",e[e.Temp=2]="Temp",e[e.Raw=3]="Raw",e[e.Dynamic=4]="Dynamic",e[e.RenderTarget=5]="RenderTarget",e[e.MultiRenderTarget=6]="MultiRenderTarget",e[e.Cube=7]="Cube",e[e.CubeRaw=8]="CubeRaw",e[e.CubePrefiltered=9]="CubePrefiltered",e[e.Raw3D=10]="Raw3D",e[e.Raw2DArray=11]="Raw2DArray",e[e.DepthStencil=12]="DepthStencil",e[e.CubeRawRGBD=13]="CubeRawRGBD",e[e.Depth=14]="Depth"}(r||(r={}));var s=function(e){function t(n,r,i){void 0===i&&(i=!1);var a=e.call(this)||this;return a.isReady=!1,a.isCube=!1,a.is3D=!1,a.is2DArray=!1,a.isMultiview=!1,a.url="",a.generateMipMaps=!1,a.samples=0,a.type=-1,a.format=-1,a.onLoadedObservable=new o.cP,a.onErrorObservable=new o.cP,a.onRebuildCallback=null,a.width=0,a.height=0,a.depth=0,a.baseWidth=0,a.baseHeight=0,a.baseDepth=0,a.invertY=!1,a._invertVScale=!1,a._associatedChannel=-1,a._source=0,a._buffer=null,a._bufferView=null,a._bufferViewArray=null,a._bufferViewArrayArray=null,a._size=0,a._extension="",a._files=null,a._workingCanvas=null,a._workingContext=null,a._cachedCoordinatesMode=null,a._isDisabled=!1,a._compression=null,a._sphericalPolynomial=null,a._sphericalPolynomialPromise=null,a._sphericalPolynomialComputed=!1,a._lodGenerationScale=0,a._lodGenerationOffset=0,a._useSRGBBuffer=!1,a._creationFlags=0,a._lodTextureHigh=null,a._lodTextureMid=null,a._lodTextureLow=null,a._isRGBD=!1,a._linearSpecularLOD=!1,a._irradianceTexture=null,a._hardwareTexture=null,a._maxLodLevel=null,a._references=1,a._gammaSpace=null,a._premulAlpha=!1,a._dynamicTextureSource=null,a._autoMSAAManagement=!1,a._engine=n,a._source=r,a._uniqueId=t._Counter++,i||(a._hardwareTexture=n._createHardwareTexture()),a}return(0,i.C6)(t,e),Object.defineProperty(t.prototype,"useMipMaps",{get:function(){return this.generateMipMaps},set:function(e){this.generateMipMaps=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"uniqueId",{get:function(){return this._uniqueId},enumerable:!1,configurable:!0}),t.prototype._setUniqueId=function(e){this._uniqueId=e},t.prototype.getEngine=function(){return this._engine},Object.defineProperty(t.prototype,"source",{get:function(){return this._source},enumerable:!1,configurable:!0}),t.prototype.incrementReferences=function(){this._references++},t.prototype.updateSize=function(e,t,n){void 0===n&&(n=1),this._engine.updateTextureDimensions(this,e,t,n),this.width=e,this.height=t,this.depth=n,this.baseWidth=e,this.baseHeight=t,this.baseDepth=n,this._size=e*t*n},t.prototype._rebuild=function(){var e,t,n=this;if(this.isReady=!1,this._cachedCoordinatesMode=null,this._cachedWrapU=null,this._cachedWrapV=null,this._cachedWrapR=null,this._cachedAnisotropicFilteringLevel=null,this.onRebuildCallback){var r=this.onRebuildCallback(this),i=function(e){e._swapAndDie(n,!1),n.isReady=r.isReady};r.isAsync?r.proxy.then(i):i(r.proxy)}else{var o;switch(this.source){case 2:case 12:case 14:break;case 1:return void(o=this._engine.createTexture(null!==(e=this._originalUrl)&&void 0!==e?e:this.url,!this.generateMipMaps,this.invertY,null,this.samplingMode,(function(e){e._swapAndDie(n,!1),n.isReady=!0}),null,this._buffer,void 0,this.format,this._extension,void 0,void 0,void 0,this._useSRGBBuffer));case 3:(o=this._engine.createRawTexture(this._bufferView,this.baseWidth,this.baseHeight,this.format,this.generateMipMaps,this.invertY,this.samplingMode,this._compression,this.type,this._creationFlags,this._useSRGBBuffer))._swapAndDie(this,!1),this.isReady=!0;break;case 10:(o=this._engine.createRawTexture3D(this._bufferView,this.baseWidth,this.baseHeight,this.baseDepth,this.format,this.generateMipMaps,this.invertY,this.samplingMode,this._compression,this.type))._swapAndDie(this,!1),this.isReady=!0;break;case 11:(o=this._engine.createRawTexture2DArray(this._bufferView,this.baseWidth,this.baseHeight,this.baseDepth,this.format,this.generateMipMaps,this.invertY,this.samplingMode,this._compression,this.type))._swapAndDie(this,!1),this.isReady=!0;break;case 4:(o=this._engine.createDynamicTexture(this.baseWidth,this.baseHeight,this.generateMipMaps,this.samplingMode))._swapAndDie(this,!1),this._dynamicTextureSource&&this._engine.updateDynamicTexture(this,this._dynamicTextureSource,this.invertY,this._premulAlpha,this.format,!0);break;case 7:return void(o=this._engine.createCubeTexture(this.url,null,this._files,!this.generateMipMaps,(function(){o._swapAndDie(n,!1),n.isReady=!0}),null,this.format,this._extension,!1,0,0,null,void 0,this._useSRGBBuffer,ArrayBuffer.isView(this._buffer)?this._buffer:null));case 8:(o=this._engine.createRawCubeTexture(this._bufferViewArray,this.width,null!==(t=this._originalFormat)&&void 0!==t?t:this.format,this.type,this.generateMipMaps,this.invertY,this.samplingMode,this._compression))._swapAndDie(this,!1),this.isReady=!0;break;case 13:return;case 9:return void((o=this._engine.createPrefilteredCubeTexture(this.url,null,this._lodGenerationScale,this._lodGenerationOffset,(function(e){e&&e._swapAndDie(n,!1),n.isReady=!0}),null,this.format,this._extension))._sphericalPolynomial=this._sphericalPolynomial)}}},t.prototype._swapAndDie=function(e,t){var n;void 0===t&&(t=!0),null===(n=this._hardwareTexture)||void 0===n||n.setUsage(e._source,this.generateMipMaps,this.is2DArray,this.isCube,this.is3D,this.width,this.height,this.depth),e._hardwareTexture=this._hardwareTexture,t&&(e._isRGBD=this._isRGBD),this._lodTextureHigh&&(e._lodTextureHigh&&e._lodTextureHigh.dispose(),e._lodTextureHigh=this._lodTextureHigh),this._lodTextureMid&&(e._lodTextureMid&&e._lodTextureMid.dispose(),e._lodTextureMid=this._lodTextureMid),this._lodTextureLow&&(e._lodTextureLow&&e._lodTextureLow.dispose(),e._lodTextureLow=this._lodTextureLow),this._irradianceTexture&&(e._irradianceTexture&&e._irradianceTexture.dispose(),e._irradianceTexture=this._irradianceTexture);var r=this._engine.getLoadedTexturesCache(),i=r.indexOf(this);-1!==i&&r.splice(i,1),-1===(i=r.indexOf(e))&&r.push(e)},t.prototype.dispose=function(){this._references--,0===this._references&&(this.onLoadedObservable.clear(),this.onErrorObservable.clear(),this._engine._releaseTexture(this),this._hardwareTexture=null,this._dynamicTextureSource=null)},t._Counter=0,t}(a.u)},19135:(e,t,n)=>{n.r(t),n.d(t,{_DDSTextureLoader:()=>o});var r=n(51428),i=n(49611),o=function(){function e(){this.supportCascades=!0}return e.prototype.loadCubeData=function(e,t,n,o){var a,s=t.getEngine(),l=!1,c=1e3;if(Array.isArray(e))for(var u=0;u1)&&t.generateMipMaps,s._unpackFlipY(a.isCompressed),i.DDSTools.UploadDDSLevels(s,t,h,a,l,6,-1,u),a.isFourCC||1!==a.mipmapCount?c=a.mipmapCount-1:s.generateMipMapsForCubemap(t)}else h=e,a=i.DDSTools.GetDDSInfo(h),t.width=a.width,t.height=a.height,n&&(a.sphericalPolynomial=new r.Q),l=(a.isRGB||a.isLuminance||a.mipmapCount>1)&&t.generateMipMaps,s._unpackFlipY(a.isCompressed),i.DDSTools.UploadDDSLevels(s,t,h,a,l,6),a.isFourCC||1!==a.mipmapCount?c=a.mipmapCount-1:s.generateMipMapsForCubemap(t,!1);s._setCubeMapTextureParams(t,l,c),t.isReady=!0,t.onLoadedObservable.notifyObservers(t),t.onLoadedObservable.clear(),o&&o({isDDS:!0,width:t.width,info:a,data:e,texture:t})},e.prototype.loadData=function(e,t,n){var r=i.DDSTools.GetDDSInfo(e),o=(r.isRGB||r.isLuminance||r.mipmapCount>1)&&t.generateMipMaps&&Math.max(r.width,r.height)>>r.mipmapCount-1==1;n(r.width,r.height,o,r.isFourCC,(function(){i.DDSTools.UploadDDSLevels(t.getEngine(),t,e,r,o,1)}))},e}()},19568:(e,t,n)=>{var r=n(98519),i="importanceSampling";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="vec3 hemisphereCosSample(vec2 u) {float phi=2.*PI*u.x;float cosTheta2=1.-u.y;float cosTheta=sqrt(cosTheta2);float sinTheta=sqrt(1.-cosTheta2);return vec3(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);}\nvec3 hemisphereImportanceSampleDggx(vec2 u,float a) {float phi=2.*PI*u.x;float cosTheta2=(1.-u.y)/(1.+(a+1.)*((a-1.)*u.y));float cosTheta=sqrt(cosTheta2);float sinTheta=sqrt(1.-cosTheta2);return vec3(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);}\nvec3 hemisphereImportanceSampleDggxAnisotropic(vec2 Xi,float alphaTangent,float alphaBitangent)\n{alphaTangent=max(alphaTangent,0.0001);alphaBitangent=max(alphaBitangent,0.0001);float phi=atan(alphaBitangent/alphaTangent*tan(2.0*3.14159265*Xi.x));if (Xi.x>0.5) phi+=3.14159265; \nfloat cosPhi=cos(phi);float sinPhi=sin(phi);float alpha2=(cosPhi*cosPhi)/(alphaTangent*alphaTangent) +\n(sinPhi*sinPhi)/(alphaBitangent*alphaBitangent);float tanTheta2=Xi.y/(1.0-Xi.y)/alpha2;float cosTheta=1.0/sqrt(1.0+tanTheta2);float sinTheta=sqrt(max(0.0,1.0-cosTheta*cosTheta));return vec3(sinTheta*cosPhi,sinTheta*sinPhi,cosTheta);}\nvec3 hemisphereImportanceSampleDCharlie(vec2 u,float a) { \nfloat phi=2.*PI*u.x;float sinTheta=pow(u.y,a/(2.*a+1.));float cosTheta=sqrt(1.-sinTheta*sinTheta);return vec3(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);}")},19748:(e,t,n)=>{var r=n(98519),i="bumpVertex";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="#if defined(BUMP) || defined(PARALLAX) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC)\n#if defined(TANGENT) && defined(NORMAL)\nvar tbnNormal: vec3f=normalize(normalUpdated);var tbnTangent: vec3f=normalize(tangentUpdated.xyz);var tbnBitangent: vec3f=cross(tbnNormal,tbnTangent)*tangentUpdated.w;var matTemp= mat3x3f(finalWorld[0].xyz,finalWorld[1].xyz,finalWorld[2].xyz)* mat3x3f(tbnTangent,tbnBitangent,tbnNormal);vertexOutputs.vTBN0=matTemp[0];vertexOutputs.vTBN1=matTemp[1];vertexOutputs.vTBN2=matTemp[2];\n#endif\n#endif\n")},19941:(e,t,n)=>{n.r(t),n.d(t,{_IESTextureLoader:()=>o});var r=n(81152),i=n(29587),o=function(){function e(){this.supportCascades=!1}return e.prototype.loadCubeData=function(){throw".ies not supported in Cube."},e.prototype.loadData=function(e,t,n){var o=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),a=(0,i.i)(o);n(a.width,a.height,t.useMipMaps,!1,(function(){var e=t.getEngine();t.type=r.Y.TEXTURETYPE_FLOAT,t.format=r.Y.TEXTUREFORMAT_R,t._gammaSpace=!1,e._uploadDataToTextureDirectly(t,a.data)}))},e}()},19966:(e,t,n)=>{var r=n(19133),i=n(7164),o=n(17347),a=n(23885),s=n(82673),l=n(1235),c=n(76872);s.$.prototype._partialLoadFile=function(e,t,n,r,i){void 0===i&&(i=null),this._loadFile(e,(function(e){n[t]=e,n._internalCount++,6===n._internalCount&&r(n)}),void 0,void 0,!0,(function(e,t){i&&e&&i(e.status+" "+e.statusText,t)}))},s.$.prototype._cascadeLoadFiles=function(e,t,n,r){void 0===r&&(r=null);var i=[];i._internalCount=0;for(var o=0;o<6;o++)this._partialLoadFile(n[o],o,i,t,r)},s.$.prototype._cascadeLoadImgs=function(e,t,n,r,i,o){void 0===i&&(i=null);var a=[];a._internalCount=0;for(var s=0;s<6;s++)this._partialLoadImg(r[s],s,a,e,t,n,i,o)},s.$.prototype._partialLoadImg=function(e,t,n,r,i,s,l,c){void 0===l&&(l=null);var u=(0,a.z)();(0,o.W$)(e,(function(e){n[t]=e,n._internalCount++,r&&r.removePendingData(u),6===n._internalCount&&s&&s(i,n)}),(function(e,t){r&&r.removePendingData(u),l&&l(e,t)}),r?r.offlineProvider:null,c),r&&r.addPendingData(u)},s.$.prototype.createCubeTextureBase=function(e,t,n,o,a,s,u,h,d,p,f,m,_,g,v,y){var b=this;void 0===a&&(a=null),void 0===s&&(s=null),void 0===h&&(h=null),void 0===d&&(d=!1),void 0===p&&(p=0),void 0===f&&(f=0),void 0===m&&(m=null),void 0===_&&(_=null),void 0===g&&(g=null),void 0===v&&(v=!1),void 0===y&&(y=null);var S=m||new r.h(this,7);S.isCube=!0,S.url=e,S.generateMipMaps=!o,S._lodGenerationScale=p,S._lodGenerationOffset=f,S._useSRGBBuffer=!!v&&this._caps.supportSRGBBuffers&&(this.version>1||this.isWebGPU||!!o),S!==m&&(S.label=e.substring(0,60)),this._doNotHandleContextLost||(S._extension=h,S._files=n,S._buffer=y);var T=e;this._transformTextureUrl&&!m&&(e=this._transformTextureUrl(e));var E=null!=h?h:(0,c.r)(e),x=(0,l.gT)(E),P=function(e,t){S.dispose(),s?s(e,t):e&&i.V.Warn(e)},C=function(r,s){e===T?r&&P(r.status+" "+r.statusText,s):(i.V.Warn("Failed to load ".concat(e,", falling back to the ").concat(T)),b.createCubeTextureBase(T,t,n,!!o,a,P,u,h,d,p,f,S,_,g,v,y))};if(x)x.then((function(r){var i=function(e){_&&_(S,e),r.loadCubeData(e,S,d,a,(function(e,t){P(e,t)}))};y?i(y):n&&6===n.length?r.supportCascades?b._cascadeLoadFiles(t,(function(e){return i(e.map((function(e){return new Uint8Array(e)})))}),n,P):P("Textures type does not support cascades."):b._loadFile(e,(function(e){return i(new Uint8Array(e))}),void 0,t?t.offlineProvider||null:void 0,!0,C)}));else{if(!n||0===n.length)throw new Error("Cannot load cubemap because files were not defined, or the correct loader was not found.");this._cascadeLoadImgs(t,S,(function(e,t){g&&g(e,t)}),n,P)}return this._internalTexturesCache.push(S),S}},20097:(e,t,n)=>{var r=n(98519),i="sceneVertexDeclaration";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="uniform mat4 viewProjection;\n#ifdef MULTIVIEW\nuniform mat4 viewProjectionR;\n#endif\nuniform mat4 view;uniform mat4 projection;uniform vec4 vEyePosition;\n")},20201:(e,t,n)=>{n.d(t,{W:()=>i});var r=n(78322),i=function(e){function t(t,n,r,i,o,a){var s=e.call(this,r,a)||this;return s._operation=i,s._className=o,s.a=s.registerDataInput("a",t),s.b=s.registerDataInput("b",n),s}return(0,r.C6)(t,e),t.prototype._doOperation=function(e){var t=this.a.getValue(e),n=this.b.getValue(e);return this._operation(t,n)},t.prototype.getClassName=function(){return this._className},t}(n(61930).r)},20274:(e,t,n)=>{n.r(t),n.d(t,{bumpFragmentWGSL:()=>a});var r=n(98519),i="bumpFragment",o="var uvOffset: vec2f= vec2f(0.0,0.0);\n#if defined(BUMP) || defined(PARALLAX) || defined(DETAIL)\n#ifdef NORMALXYSCALE\nvar normalScale: f32=1.0;\n#elif defined(BUMP)\nvar normalScale: f32=uniforms.vBumpInfos.y;\n#else\nvar normalScale: f32=1.0;\n#endif\n#if defined(TANGENT) && defined(NORMAL)\nvar TBN: mat3x3f=mat3x3(input.vTBN0,input.vTBN1,input.vTBN2); \n#elif defined(BUMP)\nvar TBNUV: vec2f=select(-fragmentInputs.vBumpUV,fragmentInputs.vBumpUV,fragmentInputs.frontFacing);var TBN: mat3x3f=cotangent_frame(normalW*normalScale,input.vPositionW,TBNUV,uniforms.vTangentSpaceParams);\n#else\nvar TBNUV: vec2f=select(-fragmentInputs.vDetailUV,fragmentInputs.vDetailUV,fragmentInputs.frontFacing);var TBN: mat3x3f=cotangent_frame(normalW*normalScale,input.vPositionW,TBNUV, vec2f(1.,1.));\n#endif\n#elif defined(ANISOTROPIC)\n#if defined(TANGENT) && defined(NORMAL)\nvar TBN: mat3x3f=mat3x3(input.vTBN0,input.vTBN1,input.vTBN2); \n#else\nvar TBNUV: vec2f=select( -fragmentInputs.vMainUV1,fragmentInputs.vMainUV1,fragmentInputs.frontFacing);var TBN: mat3x3f=cotangent_frame(normalW,input.vPositionW,TBNUV, vec2f(1.,1.));\n#endif\n#endif\n#ifdef PARALLAX\nvar invTBN: mat3x3f=transposeMat3(TBN);\n#ifdef PARALLAXOCCLUSION\nuvOffset=parallaxOcclusion(invTBN*-viewDirectionW,invTBN*normalW,fragmentInputs.vBumpUV,uniforms.vBumpInfos.z);\n#else\nuvOffset=parallaxOffset(invTBN*viewDirectionW,uniforms.vBumpInfos.z);\n#endif\n#endif\n#ifdef DETAIL\nvar detailColor: vec4f=textureSample(detailSampler,detailSamplerSampler,fragmentInputs.vDetailUV+uvOffset);var detailNormalRG: vec2f=detailColor.wy*2.0-1.0;var detailNormalB: f32=sqrt(1.-saturate(dot(detailNormalRG,detailNormalRG)));var detailNormal: vec3f= vec3f(detailNormalRG,detailNormalB);\n#endif\n#ifdef BUMP\n#ifdef OBJECTSPACE_NORMALMAP\n#define CUSTOM_FRAGMENT_BUMP_FRAGMENT\nnormalW=normalize(textureSample(bumpSampler,bumpSamplerSampler,fragmentInputs.vBumpUV).xyz *2.0-1.0);normalW=normalize(mat3x3f(uniforms.normalMatrix[0].xyz,uniforms.normalMatrix[1].xyz,uniforms.normalMatrix[2].xyz)*normalW);\n#elif !defined(DETAIL)\nnormalW=perturbNormal(TBN,textureSample(bumpSampler,bumpSamplerSampler,fragmentInputs.vBumpUV+uvOffset).xyz,uniforms.vBumpInfos.y);\n#else\nvar bumpNormal: vec3f=textureSample(bumpSampler,bumpSamplerSampler,fragmentInputs.vBumpUV+uvOffset).xyz*2.0-1.0;\n#if DETAIL_NORMALBLENDMETHOD==0 \ndetailNormal=vec3f(detailNormal.xy*uniforms.vDetailInfos.z,detailNormal.z);var blendedNormal: vec3f=normalize( vec3f(bumpNormal.xy+detailNormal.xy,bumpNormal.z*detailNormal.z));\n#elif DETAIL_NORMALBLENDMETHOD==1 \ndetailNormal=vec3f(detailNormal.xy*uniforms.vDetailInfos.z,detailNormal.z);bumpNormal+= vec3f(0.0,0.0,1.0);detailNormal*= vec3f(-1.0,-1.0,1.0);var blendedNormal: vec3f=bumpNormal*dot(bumpNormal,detailNormal)/bumpNormal.z-detailNormal;\n#endif\nnormalW=perturbNormalBase(TBN,blendedNormal,uniforms.vBumpInfos.y);\n#endif\n#elif defined(DETAIL)\ndetailNormal=vec3f(detailNormal.xy*uniforms.vDetailInfos.z,detailNormal.z);normalW=perturbNormalBase(TBN,detailNormal,uniforms.vDetailInfos.z);\n#endif\n";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]=o);var a={name:i,shader:o}},20502:(e,t,n)=>{n.r(t),n.d(t,{clipPlaneFragmentDeclarationWGSL:()=>a});var r=n(98519),i="clipPlaneFragmentDeclaration",o="#ifdef CLIPPLANE\nvarying fClipDistance: f32;\n#endif\n#ifdef CLIPPLANE2\nvarying fClipDistance2: f32;\n#endif\n#ifdef CLIPPLANE3\nvarying fClipDistance3: f32;\n#endif\n#ifdef CLIPPLANE4\nvarying fClipDistance4: f32;\n#endif\n#ifdef CLIPPLANE5\nvarying fClipDistance5: f32;\n#endif\n#ifdef CLIPPLANE6\nvarying fClipDistance6: f32;\n#endif\n";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]=o);var a={name:i,shader:o}},20833:(e,t,n)=>{n(82673).$.prototype.createDepthStencilTexture=function(e,t,n){if(t.isCube){var r=e.width||e;return this._createDepthStencilCubeTexture(r,t)}return this._createDepthStencilTexture(e,t,n)}},21181:(e,t,n)=>{n.r(t),n.d(t,{iblShadowAccumulationPixelShaderWGSL:()=>a});var r=n(98519),i="iblShadowAccumulationPixelShader",o="varying vUV: vec2f;uniform accumulationParameters: vec4f;\n#define remanence uniforms.accumulationParameters.x\n#define resetb uniforms.accumulationParameters.y\n#define sceneSize uniforms.accumulationParameters.z\nvar motionSampler: texture_2d;var positionSampler: texture_2d;var spatialBlurSampler : texture_2d;var oldAccumulationSamplerSampler: sampler;var oldAccumulationSampler: texture_2d;var prevPositionSamplerSampler: sampler;var prevPositionSampler: texture_2d;fn max2(v: vec2f,w: vec2f)->vec2f { \nreturn vec2f(max(v.x,w.x),max(v.y,w.y)); }\nfn lessThan(x: vec2f,y: vec2f)->vec2 {return xFragmentOutputs {var reset: bool= bool(resetb);var gbufferRes : vec2f=vec2f(textureDimensions(positionSampler,0));var gbufferPixelCoord: vec2i= vec2i(input.vUV*gbufferRes);var shadowRes : vec2f=vec2f(textureDimensions(spatialBlurSampler,0));var shadowPixelCoord: vec2i= vec2i(input.vUV*shadowRes);var LP: vec4f=textureLoad(positionSampler,gbufferPixelCoord,0);if (0.0==LP.w) {fragmentOutputs.color=vec4f(1.0,0.0,0.0,1.0);return fragmentOutputs;}\nvar velocityColor: vec2f=textureLoad(motionSampler,gbufferPixelCoord,0).xy;var prevCoord: vec2f=input.vUV+velocityColor;var PrevLP: vec3f=textureSampleLevel(prevPositionSampler,prevPositionSamplerSampler,prevCoord,0.0).xyz;var PrevShadows: vec4f=textureSampleLevel(oldAccumulationSampler,oldAccumulationSamplerSampler,prevCoord,0.0);var newShadows : vec3f=textureLoad(spatialBlurSampler,shadowPixelCoord,0).xyz;PrevShadows.a=select(1.0,max(PrevShadows.a/(1.0+PrevShadows.a),1.0-remanence),!reset && all(lessThan(abs(prevCoord- vec2f(0.5)), vec2f(0.5))) &&\ndistance(LP.xyz,PrevLP)<5e-2*sceneSize);PrevShadows=max( vec4f(0.0),PrevShadows);fragmentOutputs.color= vec4f(mix(PrevShadows.x,newShadows.x,PrevShadows.a),\nmix(PrevShadows.y,newShadows.y,PrevShadows.a),\nmix(PrevShadows.z,newShadows.z,PrevShadows.a),PrevShadows.a);}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},21310:(e,t,n)=>{var r=n(98519),i="instancesVertex";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="#ifdef INSTANCES\nvar finalWorld=mat4x4(vertexInputs.world0,vertexInputs.world1,vertexInputs.world2,vertexInputs.world3);\n#if defined(PREPASS_VELOCITY) || defined(VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) || defined(VELOCITY_LINEAR)\nvar finalPreviousWorld=mat4x4(\nvertexInputs.previousWorld0,vertexInputs.previousWorld1,\nvertexInputs.previousWorld2,vertexInputs.previousWorld3);\n#endif\n#ifdef THIN_INSTANCES\n#if !defined(WORLD_UBO)\nfinalWorld=uniforms.world*finalWorld;\n#else\nfinalWorld=mesh.world*finalWorld;\n#endif\n#if defined(PREPASS_VELOCITY) || defined(VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) || defined(VELOCITY_LINEAR)\nfinalPreviousWorld=uniforms.previousWorld*finalPreviousWorld;\n#endif\n#endif\n#else\n#if !defined(WORLD_UBO)\nvar finalWorld=uniforms.world;\n#else\nvar finalWorld=mesh.world;\n#endif\n#if defined(PREPASS_VELOCITY) || defined(VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) || defined(VELOCITY_LINEAR)\nvar finalPreviousWorld=uniforms.previousWorld;\n#endif\n#endif\n")},21379:(e,t,n)=>{n.d(t,{M:()=>i});var r=n(78322),i=function(e){function t(t,n){var r=e.call(this,t)||this;if(r._eventsSignalOutputs={},r.done=r._registerSignalOutput("done"),n)for(var i=0,o=n;i{n.r(t),n.d(t,{FlowGraphSetPropertyBlock:()=>s});var r=n(78322),i=n(88469),o=n(88099),a=n(34623),s=function(e){function t(t){var n=e.call(this,t)||this;return n.config=t,n.object=n.registerDataInput("object",o.Vv,t.target),n.value=n.registerDataInput("value",o.Vv),n.propertyName=n.registerDataInput("propertyName",o.Vv,t.propertyName),n.customSetFunction=n.registerDataInput("customSetFunction",o.Vv),n}return(0,r.C6)(t,e),t.prototype._execute=function(e,t){try{var n=this.object.getValue(e),r=this.value.getValue(e),i=this.propertyName.getValue(e);this._stopRunningAnimations(e,n,i);var o=this.customSetFunction.getValue(e);o?o(n,i,r,e):this._setPropertyValue(n,i,r)}catch(t){this._reportError(e,t)}this.out._activateSignal(e)},t.prototype._stopRunningAnimations=function(e,t,n){for(var r=e._getGlobalContextVariable("currentlyRunningAnimationGroups",[]),i=function(i){var o=e.assetsContext.animationGroups.find((function(e){return e.uniqueId===i}));if(o)for(var a=0,s=o.targetedAnimations;a{n.d(t,{$:()=>a});var r=n(78322),i=n(8046),o=n(11296),a=function(e){function t(t,n,r,o,a,s,l){var c;void 0===r&&(r=null),void 0===o&&(o=null),void 0===a&&(a=null),void 0===s&&(s=null),void 0===l&&(l=null);var u=e.call(this,t,n.getScene(),!1)||this;return u.name=t,u.children=[],u.animations=[],u._index=null,u._scalingDeterminant=1,u._needToDecompose=!0,u._needToCompose=!1,u._linkedTransformNode=null,u._waitingTransformNodeId=null,u._skeleton=n,u._localMatrix=null!==(c=null==o?void 0:o.clone())&&void 0!==c?c:i.uq.Identity(),u._restMatrix=null!=a?a:u._localMatrix.clone(),u._bindMatrix=null!=s?s:u._localMatrix.clone(),u._index=l,u._absoluteMatrix=new i.uq,u._absoluteBindMatrix=new i.uq,u._absoluteInverseBindMatrix=new i.uq,u._finalMatrix=new i.uq,n.bones.push(u),u.setParent(r,!1),u._updateAbsoluteBindMatrices(),u}return(0,r.C6)(t,e),Object.defineProperty(t.prototype,"_matrix",{get:function(){return this._compose(),this._localMatrix},set:function(e){(e.updateFlag!==this._localMatrix.updateFlag||this._needToCompose)&&(this._needToCompose=!1,this._localMatrix.copyFrom(e),this._markAsDirtyAndDecompose())},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"Bone"},t.prototype.getSkeleton=function(){return this._skeleton},Object.defineProperty(t.prototype,"parent",{get:function(){return this._parentNode},set:function(e){this.setParent(e)},enumerable:!1,configurable:!0}),t.prototype.getParent=function(){return this.parent},t.prototype.getChildren=function(){return this.children},t.prototype.getIndex=function(){return null===this._index?this.getSkeleton().bones.indexOf(this):this._index},t.prototype.setParent=function(e,t){if(void 0===t&&(t=!0),this.parent!==e){if(this.parent){var n=this.parent.children.indexOf(this);-1!==n&&this.parent.children.splice(n,1)}this._parentNode=e,this.parent&&this.parent.children.push(this),t&&this._updateAbsoluteBindMatrices(),this.markAsDirty()}},t.prototype.getLocalMatrix=function(){return this._compose(),this._localMatrix},t.prototype.getBindMatrix=function(){return this._bindMatrix},t.prototype.getBaseMatrix=function(){return this.getBindMatrix()},t.prototype.getRestMatrix=function(){return this._restMatrix},t.prototype.getRestPose=function(){return this.getRestMatrix()},t.prototype.setRestMatrix=function(e){this._restMatrix.copyFrom(e)},t.prototype.setRestPose=function(e){this.setRestMatrix(e)},t.prototype.getBindPose=function(){return this.getBindMatrix()},t.prototype.setBindMatrix=function(e){this.updateMatrix(e)},t.prototype.setBindPose=function(e){this.setBindMatrix(e)},t.prototype.getFinalMatrix=function(){return this._finalMatrix},t.prototype.getWorldMatrix=function(){return this.getFinalMatrix()},t.prototype.returnToRest=function(){var e;if(this._linkedTransformNode){var t=i.AA.Vector3[0],n=i.AA.Quaternion[0],r=i.AA.Vector3[1];this.getRestMatrix().decompose(t,n,r),this._linkedTransformNode.position.copyFrom(r),this._linkedTransformNode.rotationQuaternion=null!==(e=this._linkedTransformNode.rotationQuaternion)&&void 0!==e?e:i.PT.Identity(),this._linkedTransformNode.rotationQuaternion.copyFrom(n),this._linkedTransformNode.scaling.copyFrom(t)}else this._matrix=this._restMatrix},t.prototype.getAbsoluteInverseBindMatrix=function(){return this._absoluteInverseBindMatrix},t.prototype.getInvertedAbsoluteTransform=function(){return this.getAbsoluteInverseBindMatrix()},t.prototype.getAbsoluteMatrix=function(){return this._skeleton.computeAbsoluteMatrices(),this._absoluteMatrix},t.prototype.getAbsoluteTransform=function(){return this.getAbsoluteMatrix()},t.prototype.linkTransformNode=function(e){this._linkedTransformNode&&this._skeleton._numBonesWithLinkedTransformNode--,this._linkedTransformNode=e,this._linkedTransformNode&&this._skeleton._numBonesWithLinkedTransformNode++},t.prototype.getTransformNode=function(){return this._linkedTransformNode},Object.defineProperty(t.prototype,"position",{get:function(){return this._decompose(),this._localPosition},set:function(e){this._decompose(),this._localPosition.copyFrom(e),this._markAsDirtyAndCompose()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotation",{get:function(){return this.getRotation()},set:function(e){this.setRotation(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotationQuaternion",{get:function(){return this._decompose(),this._localRotation},set:function(e){this.setRotationQuaternion(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scaling",{get:function(){return this.getScale()},set:function(e){this.setScale(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"animationPropertiesOverride",{get:function(){return this._skeleton.animationPropertiesOverride},enumerable:!1,configurable:!0}),t.prototype._decompose=function(){this._needToDecompose&&(this._needToDecompose=!1,this._localScaling||(this._localScaling=i.Pq.Zero(),this._localRotation=i.PT.Zero(),this._localPosition=i.Pq.Zero()),this._localMatrix.decompose(this._localScaling,this._localRotation,this._localPosition))},t.prototype._compose=function(){this._needToCompose&&(this._localScaling?(this._needToCompose=!1,i.uq.ComposeToRef(this._localScaling,this._localRotation,this._localPosition,this._localMatrix)):this._needToCompose=!1)},t.prototype.updateMatrix=function(e,t,n){void 0===t&&(t=!0),void 0===n&&(n=!0),this._bindMatrix.copyFrom(e),t&&this._updateAbsoluteBindMatrices(),n?this._matrix=e:this.markAsDirty()},t.prototype._updateAbsoluteBindMatrices=function(e,t){if(void 0===t&&(t=!0),e||(e=this._bindMatrix),this.parent?e.multiplyToRef(this.parent._absoluteBindMatrix,this._absoluteBindMatrix):this._absoluteBindMatrix.copyFrom(e),this._absoluteBindMatrix.invertToRef(this._absoluteInverseBindMatrix),t)for(var n=0;n{var r=n(98519),i="prePassVertex";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="#ifdef PREPASS_DEPTH\nvertexOutputs.vViewPos=(scene.view*worldPos).rgb;\n#endif\n#ifdef PREPASS_NORMALIZED_VIEW_DEPTH\nvertexOutputs.vNormViewDepth=((scene.view*worldPos).z-uniforms.cameraInfo.x)/(uniforms.cameraInfo.y-uniforms.cameraInfo.x);\n#endif\n#ifdef PREPASS_LOCAL_POSITION\nvertexOutputs.vPosition=positionUpdated.xyz;\n#endif\n#if (defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR)) && defined(BONES_VELOCITY_ENABLED)\nvertexOutputs.vCurrentPosition=scene.viewProjection*worldPos;\n#if NUM_BONE_INFLUENCERS>0\nvar previousInfluence: mat4x4f;previousInfluence=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndices[0])]*vertexInputs.matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\npreviousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndices[1])]*vertexInputs.matricesWeights[1];\n#endif \n#if NUM_BONE_INFLUENCERS>2\npreviousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndices[2])]*vertexInputs.matricesWeights[2];\n#endif \n#if NUM_BONE_INFLUENCERS>3\npreviousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndices[3])]*vertexInputs.matricesWeights[3];\n#endif\n#if NUM_BONE_INFLUENCERS>4\npreviousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndicesExtra[0])]*vertexInputs.matricesWeightsExtra[0];\n#endif \n#if NUM_BONE_INFLUENCERS>5\npreviousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndicesExtra[1])]*vertexInputs.matricesWeightsExtra[1];\n#endif \n#if NUM_BONE_INFLUENCERS>6\npreviousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndicesExtra[2])]*vertexInputs.matricesWeightsExtra[2];\n#endif \n#if NUM_BONE_INFLUENCERS>7\npreviousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndicesExtra[3])]*vertexInputs.matricesWeightsExtra[3];\n#endif\nvertexOutputs.vPreviousPosition=uniforms.previousViewProjection*finalPreviousWorld*previousInfluence* vec4f(positionUpdated,1.0);\n#else\nvertexOutputs.vPreviousPosition=uniforms.previousViewProjection*finalPreviousWorld* vec4f(positionUpdated,1.0);\n#endif\n#endif\n")},22088:(e,t,n)=>{n.r(t),n.d(t,{spritesPixelShader:()=>s});var r=n(98519),i=(n(52767),n(59262),n(13088),n(86343),"imageProcessingCompatibility");r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#ifdef IMAGEPROCESSINGPOSTPROCESS\ngl_FragColor.rgb=pow(gl_FragColor.rgb,vec3(2.2));\n#endif\n");var o="spritesPixelShader",a="#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\nuniform bool alphaTest;varying vec4 vColor;varying vec2 vUV;uniform sampler2D diffuseSampler;\n#include\n#include\n#define CUSTOM_FRAGMENT_DEFINITIONS\n#ifdef PIXEL_PERFECT\nvec2 uvPixelPerfect(vec2 uv) {vec2 res=vec2(textureSize(diffuseSampler,0));uv=uv*res;vec2 seam=floor(uv+0.5);uv=seam+clamp((uv-seam)/fwidth(uv),-0.5,0.5);return uv/res;}\n#endif\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#ifdef PIXEL_PERFECT\nvec2 uv=uvPixelPerfect(vUV);\n#else\nvec2 uv=vUV;\n#endif\nvec4 color=texture2D(diffuseSampler,uv);float fAlphaTest=float(alphaTest);if (fAlphaTest != 0.)\n{if (color.a<0.95)\ndiscard;}\ncolor*=vColor;\n#include\n#include\ngl_FragColor=color;\n#include\n#define CUSTOM_FRAGMENT_MAIN_END\n}";r.l.ShadersStore[o]||(r.l.ShadersStore[o]=a);var s={name:o,shader:a}},22129:(e,t,n)=>{n.r(t),n.d(t,{sharpenPixelShader:()=>a});var r=n(98519),i="sharpenPixelShader",o="varying vec2 vUV;uniform sampler2D textureSampler;uniform vec2 screenSize;uniform vec2 sharpnessAmounts;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{vec2 onePixel=vec2(1.0,1.0)/screenSize;vec4 color=texture2D(textureSampler,vUV);vec4 edgeDetection=texture2D(textureSampler,vUV+onePixel*vec2(0,-1)) +\ntexture2D(textureSampler,vUV+onePixel*vec2(-1,0)) +\ntexture2D(textureSampler,vUV+onePixel*vec2(1,0)) +\ntexture2D(textureSampler,vUV+onePixel*vec2(0,1)) -\ncolor*4.0;gl_FragColor=max(vec4(color.rgb*sharpnessAmounts.y,color.a)-(sharpnessAmounts.x*vec4(edgeDetection.rgb,0)),0.);}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},22955:(e,t,n)=>{n.r(t),n.d(t,{rgbdEncodePixelShader:()=>a});var r=n(98519),i=(n(75334),"rgbdEncodePixelShader"),o="varying vec2 vUV;uniform sampler2D textureSampler;\n#include\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) \n{gl_FragColor=toRGBD(texture2D(textureSampler,vUV).rgb);}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},23101:(e,t,n)=>{n.d(t,{a:()=>i});var r=n(78322),i=function(e){function t(t,n,r,i,o){var a=e.call(this,n,o)||this;return a._operation=r,a._className=i,a.a=a.registerDataInput("a",t),a}return(0,r.C6)(t,e),t.prototype._doOperation=function(e){return this._operation(this.a.getValue(e))},t.prototype.getClassName=function(){return this._className},t}(n(61930).r)},23148:(e,t,n)=>{n.d(t,{T:()=>r});var r=function(){function e(){}return e.FilesToLoad={},e}()},23170:(e,t,n)=>{var r=n(98519),i="clusteredLightingFunctions";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="struct ClusteredLight {vLightData: vec4f,\nvLightDiffuse: vec4f,\nvLightSpecular: vec4f,\nvLightDirection: vec4f,\nvLightFalloff: vec4f,}\nfn getClusteredLight(lightDataTexture: texture_2d,index: u32)->ClusteredLight {return ClusteredLight(\ntextureLoad(lightDataTexture,vec2u(0,index),0),\ntextureLoad(lightDataTexture,vec2u(1,index),0),\ntextureLoad(lightDataTexture,vec2u(2,index),0),\ntextureLoad(lightDataTexture,vec2u(3,index),0),\ntextureLoad(lightDataTexture,vec2u(4,index),0)\n);}\nfn getClusteredSliceIndex(sliceData: vec2f,viewDepth: f32)->i32 {return i32(log(viewDepth)*sliceData.x+sliceData.y);}\n")},23307:(e,t,n)=>{n.r(t),n.d(t,{FlowGraphFlipFlopBlock:()=>s});var r=n(78322),i=n(88677),o=n(88099),a=n(34623),s=function(e){function t(t){var n=e.call(this,t)||this;return n.onOn=n._registerSignalOutput("onOn"),n.onOff=n._registerSignalOutput("onOff"),n.value=n.registerDataOutput("value",o.RI),n}return(0,r.C6)(t,e),t.prototype._execute=function(e,t){var n,r=e._getExecutionVariable(this,"value","boolean"==typeof(null===(n=this.config)||void 0===n?void 0:n.startValue)&&!this.config.startValue);r=!r,e._setExecutionVariable(this,"value",r),this.value.setValue(r,e),r?this.onOn._activateSignal(e):this.onOff._activateSignal(e)},t.prototype.getClassName=function(){return"FlowGraphFlipFlopBlock"},t}(i.u);(0,a.Y5)("FlowGraphFlipFlopBlock",s)},23338:(e,t,n)=>{n.r(t),n.d(t,{outlinePixelShader:()=>a});var r=n(98519),i=(n(27003),n(59262),n(39643),n(13088),"outlinePixelShader"),o="#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\nuniform vec4 color;\n#ifdef ALPHATEST\nvarying vec2 vUV;uniform sampler2D diffuseSampler;\n#endif\n#include\n#include\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include\n#ifdef ALPHATEST\nif (texture2D(diffuseSampler,vUV).a<0.4)\ndiscard;\n#endif\n#include\ngl_FragColor=color;\n#define CUSTOM_FRAGMENT_MAIN_END\n}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},23459:(e,t,n)=>{n.r(t),n.d(t,{fxaaPixelShaderWGSL:()=>a});var r=n(98519),i="fxaaPixelShader",o="varying vUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d;uniform texelSize: vec2f;varying sampleCoordS: vec2f;varying sampleCoordE: vec2f;varying sampleCoordN: vec2f;varying sampleCoordW: vec2f;varying sampleCoordNW: vec2f;varying sampleCoordSE: vec2f;varying sampleCoordNE: vec2f;varying sampleCoordSW: vec2f;const fxaaQualitySubpix: f32=1.0;const fxaaQualityEdgeThreshold: f32=0.166;const fxaaQualityEdgeThresholdMin: f32=0.0833;const kLumaCoefficients: vec3f= vec3f(0.2126,0.7152,0.0722);fn FxaaLuma(rgba: vec4f)->f32 {return dot(rgba.rgb,kLumaCoefficients);} \n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var posM: vec2f;posM.x=input.vUV.x;posM.y=input.vUV.y;var rgbyM: vec4f=textureSampleLevel(textureSampler,textureSamplerSampler,input.vUV,0.0);var lumaM: f32=FxaaLuma(rgbyM);var lumaS: f32=FxaaLuma(textureSampleLevel(textureSampler,textureSamplerSampler,input.sampleCoordS,0.0));var lumaE: f32=FxaaLuma(textureSampleLevel(textureSampler,textureSamplerSampler,input.sampleCoordE,0.0));var lumaN: f32=FxaaLuma(textureSampleLevel(textureSampler,textureSamplerSampler,input.sampleCoordN,0.0));var lumaW: f32=FxaaLuma(textureSampleLevel(textureSampler,textureSamplerSampler,input.sampleCoordW,0.0));var maxSM: f32=max(lumaS,lumaM);var minSM: f32=min(lumaS,lumaM);var maxESM: f32=max(lumaE,maxSM);var minESM: f32=min(lumaE,minSM);var maxWN: f32=max(lumaN,lumaW);var minWN: f32=min(lumaN,lumaW);var rangeMax: f32=max(maxWN,maxESM);var rangeMin: f32=min(minWN,minESM);var rangeMaxScaled: f32=rangeMax*fxaaQualityEdgeThreshold;var range: f32=rangeMax-rangeMin;var rangeMaxClamped: f32=max(fxaaQualityEdgeThresholdMin,rangeMaxScaled);\n#ifndef MALI\nif(range=edgeVert;var subpixA: f32=subpixNSWE*2.0+subpixNWSWNESE;if (!horzSpan)\n{lumaN=lumaW;}\nif (!horzSpan) \n{lumaS=lumaE;}\nif (horzSpan) \n{lengthSign=uniforms.texelSize.y;}\nvar subpixB: f32=(subpixA*(1.0/12.0))-lumaM;var gradientN: f32=lumaN-lumaM;var gradientS: f32=lumaS-lumaM;var lumaNN: f32=lumaN+lumaM;var lumaSS: f32=lumaS+lumaM;var pairN: bool=abs(gradientN)>=abs(gradientS);var gradient: f32=max(abs(gradientN),abs(gradientS));if (pairN)\n{lengthSign=-lengthSign;}\nvar subpixC: f32=clamp(abs(subpixB)*subpixRcpRange,0.0,1.0);var posB: vec2f;posB.x=posM.x;posB.y=posM.y;var offNP: vec2f;offNP.x=select(uniforms.texelSize.x,0.0,(!horzSpan));offNP.y=select(uniforms.texelSize.y,0.0,(horzSpan));if (!horzSpan) \n{posB.x+=lengthSign*0.5;}\nif (horzSpan)\n{posB.y+=lengthSign*0.5;}\nvar posN: vec2f;posN.x=posB.x-offNP.x*1.5;posN.y=posB.y-offNP.y*1.5;var posP: vec2f;posP.x=posB.x+offNP.x*1.5;posP.y=posB.y+offNP.y*1.5;var subpixD: f32=((-2.0)*subpixC)+3.0;var lumaEndN: f32=FxaaLuma(textureSampleLevel(textureSampler,textureSamplerSampler,posN,0.0));var subpixE: f32=subpixC*subpixC;var lumaEndP: f32=FxaaLuma(textureSampleLevel(textureSampler,textureSamplerSampler,posP,0.0));if (!pairN) \n{lumaNN=lumaSS;}\nvar gradientScaled: f32=gradient*1.0/4.0;var lumaMM: f32=lumaM-lumaNN*0.5;var subpixF: f32=subpixD*subpixE;var lumaMLTZero: bool=lumaMM<0.0;lumaEndN-=lumaNN*0.5;lumaEndP-=lumaNN*0.5;var doneN: bool=abs(lumaEndN)>=gradientScaled;var doneP: bool=abs(lumaEndP)>=gradientScaled;if (!doneN) \n{posN.x-=offNP.x*3.0;}\nif (!doneN) \n{posN.y-=offNP.y*3.0;}\nvar doneNP: bool=(!doneN) || (!doneP);if (!doneP) \n{posP.x+=offNP.x*3.0;}\nif (!doneP)\n{posP.y+=offNP.y*3.0;}\nif (doneNP)\n{if (!doneN) {lumaEndN=FxaaLuma(textureSampleLevel(textureSampler,textureSamplerSampler,posN.xy,0.0));}\nif (!doneP) {lumaEndP=FxaaLuma(textureSampleLevel(textureSampler,textureSamplerSampler,posP.xy,0.0));}\nif (!doneN) {lumaEndN=lumaEndN-lumaNN*0.5;}\nif (!doneP) {lumaEndP=lumaEndP-lumaNN*0.5;}\ndoneN=abs(lumaEndN)>=gradientScaled;doneP=abs(lumaEndP)>=gradientScaled;if (!doneN) {posN.x-=offNP.x*12.0;}\nif (!doneN) {posN.y-=offNP.y*12.0;}\ndoneNP=(!doneN) || (!doneP);if (!doneP) {posP.x+=offNP.x*12.0;}\nif (!doneP) {posP.y+=offNP.y*12.0;}}\nvar dstN: f32=posM.x-posN.x;var dstP: f32=posP.x-posM.x;if (!horzSpan)\n{dstN=posM.y-posN.y;}\nif (!horzSpan) \n{dstP=posP.y-posM.y;}\nvar goodSpanN: bool=(lumaEndN<0.0) != lumaMLTZero;var spanLength: f32=(dstP+dstN);var goodSpanP: bool=(lumaEndP<0.0) != lumaMLTZero;var spanLengthRcp: f32=1.0/spanLength;var directionN: bool=dstN{var r=n(44256);r.ThinEngine.prototype.updateDynamicIndexBuffer=function(e,t,n){var r;void 0===n&&(n=0),this._currentBoundBuffer[this._gl.ELEMENT_ARRAY_BUFFER]=null,this.bindIndexBuffer(e),r=e.is32Bits?t instanceof Uint32Array?t:new Uint32Array(t):t instanceof Uint16Array?t:new Uint16Array(t),this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER,r,this._gl.DYNAMIC_DRAW),this._resetIndexBufferBinding()},r.ThinEngine.prototype.updateDynamicVertexBuffer=function(e,t,n,r){this.bindArrayBuffer(e),void 0===n&&(n=0);var i=t.byteLength||t.length;void 0===r||r>=i&&0===n?t instanceof Array?this._gl.bufferSubData(this._gl.ARRAY_BUFFER,n,new Float32Array(t)):this._gl.bufferSubData(this._gl.ARRAY_BUFFER,n,t):t instanceof Array?this._gl.bufferSubData(this._gl.ARRAY_BUFFER,n,new Float32Array(t).subarray(0,r/4)):(t=t instanceof ArrayBuffer?new Uint8Array(t,0,r):new Uint8Array(t.buffer,t.byteOffset,r),this._gl.bufferSubData(this._gl.ARRAY_BUFFER,n,t)),this._resetVertexBufferBinding()}},23528:(e,t,n)=>{n.r(t),n.d(t,{FlowGraphCancelDelayBlock:()=>l});var r=n(78322),i=n(34623),o=n(88469),a=n(88099),s=n(95803),l=function(e){function t(t){var n=e.call(this,t)||this;return n.delayIndex=n.registerDataInput("delayIndex",a.x2),n}return(0,r.C6)(t,e),t.prototype._execute=function(e,t){var n=(0,s.$w)(this.delayIndex.getValue(e));if(n<=0||isNaN(n)||!isFinite(n))return this._reportError(e,"Invalid delay index");var r=e._getGlobalContextVariable("pendingDelays",[])[n];r&&r.dispose(),this.out._activateSignal(e)},t.prototype.getClassName=function(){return"FlowGraphCancelDelayBlock"},t}(o.w);(0,i.Y5)("FlowGraphCancelDelayBlock",l)},23586:(e,t,n)=>{n.r(t),n.d(t,{_BasisTextureLoader:()=>o});var r=n(82941),i=n(44957),o=function(){function e(){this.supportCascades=!1}return e.prototype.loadCubeData=function(e,t,n,o,a){if(!Array.isArray(e)){var s=t.getEngine().getCaps(),l={supportedCompressionFormats:{etc1:!!s.etc1,s3tc:!!s.s3tc,pvrtc:!!s.pvrtc,etc2:!!s.etc2,astc:!!s.astc,bc7:!!s.bptc}};(0,r.yk)(e,l).then((function(e){var n=e.fileInfo.images[0].levels.length>1&&t.generateMipMaps;(0,r.aB)(t,e),t.getEngine()._setCubeMapTextureParams(t,n),t.isReady=!0,t.onLoadedObservable.notifyObservers(t),t.onLoadedObservable.clear(),o&&o()})).catch((function(e){i.S0.Warn("Failed to transcode Basis file, transcoding may not be supported on this device"),t.isReady=!0,a&&a(e)}))}},e.prototype.loadData=function(e,t,n){var o=t.getEngine().getCaps(),a={supportedCompressionFormats:{etc1:!!o.etc1,s3tc:!!o.s3tc,pvrtc:!!o.pvrtc,etc2:!!o.etc2,astc:!!o.astc,bc7:!!o.bptc}};(0,r.yk)(e,a).then((function(e){var i=e.fileInfo.images[0].levels[0],o=e.fileInfo.images[0].levels.length>1&&t.generateMipMaps;n(i.width,i.height,o,-1!==e.format,(function(){(0,r.aB)(t,e)}))})).catch((function(e){i.S0.Warn("Failed to transcode Basis file, transcoding may not be supported on this device"),i.S0.Warn("Failed to transcode Basis file: ".concat(e)),n(0,0,!1,!1,(function(){}),!0)}))},e}()},23667:(e,t,n)=>{n.r(t),n.d(t,{defaultPixelShader:()=>s});var r=n(98519),i=(n(77740),"defaultFragmentDeclaration");r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="uniform vec4 vEyePosition;uniform vec4 vDiffuseColor;uniform vec4 vSpecularColor;uniform vec3 vEmissiveColor;uniform vec3 vAmbientColor;uniform float visibility;\n#ifdef DIFFUSE\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef AMBIENT\nuniform vec2 vAmbientInfos;\n#endif\n#ifdef OPACITY \nuniform vec2 vOpacityInfos;\n#endif\n#ifdef EMISSIVE\nuniform vec2 vEmissiveInfos;\n#endif\n#ifdef LIGHTMAP\nuniform vec2 vLightmapInfos;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;uniform vec2 vTangentSpaceParams;\n#endif\n#ifdef ALPHATEST\nuniform float alphaCutOff;\n#endif\n#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(REFRACTION) || defined(PREPASS)\nuniform mat4 view;\n#endif\n#ifdef REFRACTION\nuniform vec4 vRefractionInfos;\n#ifndef REFRACTIONMAP_3D\nuniform mat4 refractionMatrix;\n#endif\n#ifdef REFRACTIONFRESNEL\nuniform vec4 refractionLeftColor;uniform vec4 refractionRightColor;\n#endif\n#if defined(USE_LOCAL_REFRACTIONMAP_CUBIC) && defined(REFRACTIONMAP_3D)\nuniform vec3 vRefractionPosition;uniform vec3 vRefractionSize; \n#endif\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM)\nuniform vec2 vSpecularInfos;\n#endif\n#ifdef DIFFUSEFRESNEL\nuniform vec4 diffuseLeftColor;uniform vec4 diffuseRightColor;\n#endif\n#ifdef OPACITYFRESNEL\nuniform vec4 opacityParts;\n#endif\n#ifdef EMISSIVEFRESNEL\nuniform vec4 emissiveLeftColor;uniform vec4 emissiveRightColor;\n#endif\n#if defined(REFLECTION) || (defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED))\nuniform vec2 vReflectionInfos;\n#if defined(REFLECTIONMAP_PLANAR) || defined(REFLECTIONMAP_CUBIC) || defined(REFLECTIONMAP_PROJECTION) || defined(REFLECTIONMAP_EQUIRECTANGULAR) || defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_SKYBOX)\nuniform mat4 reflectionMatrix;\n#endif\n#ifndef REFLECTIONMAP_SKYBOX\n#if defined(USE_LOCAL_REFLECTIONMAP_CUBIC) && defined(REFLECTIONMAP_CUBIC)\nuniform vec3 vReflectionPosition;uniform vec3 vReflectionSize; \n#endif\n#endif\n#ifdef REFLECTIONFRESNEL\nuniform vec4 reflectionLeftColor;uniform vec4 reflectionRightColor;\n#endif\n#endif\n#ifdef DETAIL\nuniform vec4 vDetailInfos;\n#endif\n#include\n#define ADDITIONAL_FRAGMENT_DECLARATION\n"),n(51578),n(42107),n(81751),n(48493),n(75334),n(87283),n(32823),n(54409),n(46837),n(37755),n(18644),n(40150),n(59581),n(40688),n(48661),n(75394),n(27003),n(59262),n(52767),n(39643),n(56159),n(93130),n(15656),n(7363),n(13088),n(86343),n(11135);var o="defaultPixelShader",a="#define CUSTOM_FRAGMENT_EXTENSION\n#include<__decl__defaultFragment>\n#if defined(BUMP) || !defined(NORMAL)\n#extension GL_OES_standard_derivatives : enable\n#endif\n#include[SCENE_MRT_COUNT]\n#include\n#define CUSTOM_FRAGMENT_BEGIN\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#include[1..7]\n#include\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n#include\n#include(_DEFINENAME_,DIFFUSE,_VARYINGNAME_,Diffuse,_SAMPLERNAME_,diffuse)\n#include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_SAMPLERNAME_,ambient)\n#include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_SAMPLERNAME_,opacity)\n#include(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_SAMPLERNAME_,emissive)\n#include(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_SAMPLERNAME_,lightmap)\n#include(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_SAMPLERNAME_,decal)\n#ifdef REFRACTION\n#ifdef REFRACTIONMAP_3D\nuniform samplerCube refractionCubeSampler;\n#else\nuniform sampler2D refraction2DSampler;\n#endif\n#endif\n#if defined(SPECULARTERM)\n#include(_DEFINENAME_,SPECULAR,_VARYINGNAME_,Specular,_SAMPLERNAME_,specular)\n#endif\n#include\n#ifdef REFLECTION\n#ifdef REFLECTIONMAP_3D\nuniform samplerCube reflectionCubeSampler;\n#else\nuniform sampler2D reflection2DSampler;\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#else\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#endif\n#include\n#endif\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);vec4 baseColor=vec4(1.,1.,1.,1.);vec3 diffuseColor=vDiffuseColor.rgb;float alpha=vDiffuseColor.a;\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=normalize(-cross(dFdx(vPositionW),dFdy(vPositionW)));\n#endif\n#include\n#ifdef TWOSIDEDLIGHTING\nnormalW=gl_FrontFacing ? normalW : -normalW;\n#endif\n#ifdef DIFFUSE\nbaseColor=texture2D(diffuseSampler,vDiffuseUV+uvOffset);\n#if defined(ALPHATEST) && !defined(ALPHATEST_AFTERALLALPHACOMPUTATIONS)\nif (baseColor.a(surfaceAlbedo,baseColor,GAMMADECAL,_GAMMADECAL_NOTUSED_)\n#endif\n#include\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nbaseColor.rgb*=vColor.rgb;\n#endif\n#ifdef DETAIL\nbaseColor.rgb=baseColor.rgb*2.0*mix(0.5,detailColor.r,vDetailInfos.y);\n#endif\n#if defined(DECAL) && defined(DECAL_AFTER_DETAIL)\nvec4 decalColor=texture2D(decalSampler,vDecalUV+uvOffset);\n#include(surfaceAlbedo,baseColor,GAMMADECAL,_GAMMADECAL_NOTUSED_)\n#endif\n#define CUSTOM_FRAGMENT_UPDATE_DIFFUSE\nvec3 baseAmbientColor=vec3(1.,1.,1.);\n#ifdef AMBIENT\nbaseAmbientColor=texture2D(ambientSampler,vAmbientUV+uvOffset).rgb*vAmbientInfos.y;\n#endif\n#define CUSTOM_FRAGMENT_BEFORE_LIGHTS\nfloat glossiness=vSpecularColor.a;vec3 specularColor=vSpecularColor.rgb;\n#ifdef SPECULARTERM\n#ifdef SPECULAR\nvec4 specularMapColor=texture2D(specularSampler,vSpecularUV+uvOffset);specularColor=specularMapColor.rgb;\n#ifdef GLOSSINESS\nglossiness=glossiness*specularMapColor.a;\n#endif\n#endif\n#endif\nvec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\nfloat shadow=1.;float aggShadow=0.;float numLights=0.;\n#ifdef LIGHTMAP\nvec4 lightmapColor=texture2D(lightmapSampler,vLightmapUV+uvOffset);\n#ifdef RGBDLIGHTMAP\nlightmapColor.rgb=fromRGBD(lightmapColor);\n#endif\nlightmapColor.rgb*=vLightmapInfos.y;\n#endif\n#include[0..maxSimultaneousLights]\naggShadow=aggShadow/numLights;vec4 refractionColor=vec4(0.,0.,0.,1.);\n#ifdef REFRACTION\nvec3 refractionVector=normalize(refract(-viewDirectionW,normalW,vRefractionInfos.y));\n#ifdef REFRACTIONMAP_3D\n#ifdef USE_LOCAL_REFRACTIONMAP_CUBIC\nrefractionVector=parallaxCorrectNormal(vPositionW,refractionVector,vRefractionSize,vRefractionPosition);\n#endif\nrefractionVector.y=refractionVector.y*vRefractionInfos.w;vec4 refractionLookup=textureCube(refractionCubeSampler,refractionVector);if (dot(refractionVector,viewDirectionW)<1.0) {refractionColor=refractionLookup;}\n#else\nvec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*vRefractionInfos.z,1.0)));vec2 refractionCoords=vRefractionUVW.xy/vRefractionUVW.z;refractionCoords.y=1.0-refractionCoords.y;refractionColor=texture2D(refraction2DSampler,refractionCoords);\n#endif\n#ifdef RGBDREFRACTION\nrefractionColor.rgb=fromRGBD(refractionColor);\n#endif\n#ifdef IS_REFRACTION_LINEAR\nrefractionColor.rgb=toGammaSpace(refractionColor.rgb);\n#endif\nrefractionColor.rgb*=vRefractionInfos.x;\n#endif\nvec4 reflectionColor=vec4(0.,0.,0.,1.);\n#ifdef REFLECTION\nvec3 vReflectionUVW=computeReflectionCoords(vec4(vPositionW,1.0),normalW);\n#ifdef REFLECTIONMAP_OPPOSITEZ\nvReflectionUVW.z*=-1.0;\n#endif\n#ifdef REFLECTIONMAP_3D\n#ifdef ROUGHNESS\nfloat bias=vReflectionInfos.y;\n#ifdef SPECULARTERM\n#ifdef SPECULAR\n#ifdef GLOSSINESS\nbias*=(1.0-specularMapColor.a);\n#endif\n#endif\n#endif\nreflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW,bias);\n#else\nreflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW);\n#endif\n#else\nvec2 coords=vReflectionUVW.xy;\n#ifdef REFLECTIONMAP_PROJECTION\ncoords/=vReflectionUVW.z;\n#endif\ncoords.y=1.0-coords.y;reflectionColor=texture2D(reflection2DSampler,coords);\n#endif\n#ifdef RGBDREFLECTION\nreflectionColor.rgb=fromRGBD(reflectionColor);\n#endif\n#ifdef IS_REFLECTION_LINEAR\nreflectionColor.rgb=toGammaSpace(reflectionColor.rgb);\n#endif\nreflectionColor.rgb*=vReflectionInfos.x;\n#ifdef REFLECTIONFRESNEL\nfloat reflectionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,reflectionRightColor.a,reflectionLeftColor.a);\n#ifdef REFLECTIONFRESNELFROMSPECULAR\n#ifdef SPECULARTERM\nreflectionColor.rgb*=specularColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#else\nreflectionColor.rgb*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#endif\n#else\nreflectionColor.rgb*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#endif\n#endif\n#endif\n#ifdef REFRACTIONFRESNEL\nfloat refractionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,refractionRightColor.a,refractionLeftColor.a);refractionColor.rgb*=refractionLeftColor.rgb*(1.0-refractionFresnelTerm)+refractionFresnelTerm*refractionRightColor.rgb;\n#endif\n#ifdef OPACITY\nvec4 opacityMap=texture2D(opacitySampler,vOpacityUV+uvOffset);\n#ifdef OPACITYRGB\nopacityMap.rgb=opacityMap.rgb*vec3(0.3,0.59,0.11);alpha*=(opacityMap.x+opacityMap.y+opacityMap.z)* vOpacityInfos.y;\n#else\nalpha*=opacityMap.a*vOpacityInfos.y;\n#endif\n#endif\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\n#ifdef OPACITYFRESNEL\nfloat opacityFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,opacityParts.z,opacityParts.w);alpha+=opacityParts.x*(1.0-opacityFresnelTerm)+opacityFresnelTerm*opacityParts.y;\n#endif\n#ifdef ALPHATEST\n#ifdef ALPHATEST_AFTERALLALPHACOMPUTATIONS\nif (alpha\n#include\n#ifdef IMAGEPROCESSINGPOSTPROCESS\ncolor.rgb=toLinearSpace(color.rgb);\n#else\n#ifdef IMAGEPROCESSING\ncolor.rgb=toLinearSpace(color.rgb);color=applyImageProcessing(color);\n#endif\n#endif\ncolor.a*=visibility;\n#ifdef PREMULTIPLYALPHA\ncolor.rgb*=color.a;\n#endif\n#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR\n#ifdef PREPASS\n#if SCENE_MRT_COUNT>0\nfloat writeGeometryInfo=color.a>0.4 ? 1.0 : 0.0;\n#ifdef PREPASS_COLOR\ngl_FragData[PREPASS_COLOR_INDEX]=color; \n#endif\n#ifdef PREPASS_POSITION\ngl_FragData[PREPASS_POSITION_INDEX]=vec4(vPositionW,writeGeometryInfo);\n#endif\n#ifdef PREPASS_LOCAL_POSITION\ngl_FragData[PREPASS_LOCAL_POSITION_INDEX]=vec4(vPosition,writeGeometryInfo);\n#endif\n#if defined(PREPASS_VELOCITY)\nvec2 a=(vCurrentPosition.xy/vCurrentPosition.w)*0.5+0.5;vec2 b=(vPreviousPosition.xy/vPreviousPosition.w)*0.5+0.5;vec2 velocity=abs(a-b);velocity=vec2(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;gl_FragData[PREPASS_VELOCITY_INDEX]=vec4(velocity,0.0,writeGeometryInfo);\n#elif defined(PREPASS_VELOCITY_LINEAR)\nvec2 velocity=vec2(0.5)*((vPreviousPosition.xy/vPreviousPosition.w)-(vCurrentPosition.xy/vCurrentPosition.w));gl_FragData[PREPASS_VELOCITY_LINEAR_INDEX]=vec4(velocity,0.0,writeGeometryInfo);\n#endif\n#ifdef PREPASS_IRRADIANCE\ngl_FragData[PREPASS_IRRADIANCE_INDEX]=vec4(0.0,0.0,0.0,writeGeometryInfo); \n#endif\n#ifdef PREPASS_DEPTH\ngl_FragData[PREPASS_DEPTH_INDEX]=vec4(vViewPos.z,0.0,0.0,writeGeometryInfo); \n#endif\n#ifdef PREPASS_SCREENSPACE_DEPTH\ngl_FragData[PREPASS_SCREENSPACE_DEPTH_INDEX]=vec4(gl_FragCoord.z,0.0,0.0,writeGeometryInfo);\n#endif\n#ifdef PREPASS_NORMALIZED_VIEW_DEPTH\ngl_FragData[PREPASS_NORMALIZED_VIEW_DEPTH_INDEX]=vec4(vNormViewDepth,0.0,0.0,writeGeometryInfo);\n#endif\n#ifdef PREPASS_NORMAL\n#ifdef PREPASS_NORMAL_WORLDSPACE\ngl_FragData[PREPASS_NORMAL_INDEX]=vec4(normalW,writeGeometryInfo);\n#else\ngl_FragData[PREPASS_NORMAL_INDEX]=vec4(normalize((view*vec4(normalW,0.0)).rgb),writeGeometryInfo);\n#endif\n#endif\n#ifdef PREPASS_WORLD_NORMAL\ngl_FragData[PREPASS_WORLD_NORMAL_INDEX]=vec4(normalW*0.5+0.5,writeGeometryInfo);\n#endif\n#ifdef PREPASS_ALBEDO\ngl_FragData[PREPASS_ALBEDO_INDEX]=vec4(baseColor.rgb,writeGeometryInfo);\n#endif\n#ifdef PREPASS_ALBEDO_SQRT\ngl_FragData[PREPASS_ALBEDO_SQRT_INDEX]=vec4(sqrt(baseColor.rgb),writeGeometryInfo);\n#endif\n#ifdef PREPASS_REFLECTIVITY\n#if defined(SPECULAR)\ngl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(toLinearSpace(specularMapColor))*writeGeometryInfo; \n#else\ngl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(toLinearSpace(specularColor),1.0)*writeGeometryInfo;\n#endif\n#endif\n#endif\n#endif\n#if !defined(PREPASS) || defined(WEBGL2)\ngl_FragColor=color;\n#endif\n#include\n#if ORDER_INDEPENDENT_TRANSPARENCY\nif (fragDepth==nearestDepth) {frontColor.rgb+=color.rgb*color.a*alphaMultiplier;frontColor.a=1.0-alphaMultiplier*(1.0-color.a);} else {backColor+=color;}\n#endif\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";r.l.ShadersStore[o]||(r.l.ShadersStore[o]=a);var s={name:o,shader:a}},23778:(e,t,n)=>{var r=n(78322),i=n(44256),o=n(19133),a=n(7164),s=n(81152),l=n(51428),c=n(28081);i.ThinEngine.prototype.createPrefilteredCubeTexture=function(e,t,i,u,h,d,p,f,m){var _=this;return void 0===h&&(h=null),void 0===d&&(d=null),void 0===f&&(f=null),void 0===m&&(m=!0),this.createCubeTexture(e,t,null,!1,(function(e){return(0,r.sH)(_,void 0,void 0,(function(){var d,p,f,_,g,v,y,b,S,T,E,x,P,C,R,A;return(0,r.YH)(this,(function(r){switch(r.label){case 0:return e?(d=e.texture,m?e.info.sphericalPolynomial&&(d._sphericalPolynomial=e.info.sphericalPolynomial):d._sphericalPolynomial=new l.Q,d._source=9,this.getCaps().textureLOD?(h&&h(d),[2]):(p=3,f=this._gl,(_=e.width)?[4,Promise.resolve().then(n.bind(n,49611))]:[2])):(h&&h(null),[2]);case 1:for(g=r.sent().DDSTools,v=[],y=0;y{function r(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}n.d(t,{S:()=>i,z:()=>r});var i={RandomId:r}},24019:(e,t,n)=>{n.r(t),n.d(t,{iblCdfxPixelShaderWGSL:()=>a});var r=n(98519),i="iblCdfxPixelShader",o="#define PI 3.1415927\nvarying vUV: vec2f;var cdfy: texture_2d;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var cdfyRes=textureDimensions(cdfy,0);var currentPixel=vec2u(fragmentInputs.position.xy);var cdfx: f32=0.0;for (var x: u32=1; x<=currentPixel.x; x++) {cdfx+=textureLoad(cdfy, vec2u(x-1,cdfyRes.y-1),0).x;}\nfragmentOutputs.color= vec4f( vec3f(cdfx),1.0);}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},24054:(e,t,n)=>{n.d(t,{B:()=>i});var r=/(flat\s)?\s*varying\s*.*/,i=function(){function e(){this.shaderLanguage=0}return e.prototype.attributeProcessor=function(e){return e.replace("attribute","in")},e.prototype.varyingCheck=function(e,t){return r.test(e)},e.prototype.varyingProcessor=function(e,t){return e.replace("varying",t?"in":"out")},e.prototype.postProcessor=function(e,t,n){var r=-1!==e.search(/#extension.+GL_EXT_draw_buffers.+require/);if(e=(e=e.replace(/#extension.+(GL_OVR_multiview2|GL_OES_standard_derivatives|GL_EXT_shader_texture_lod|GL_EXT_frag_depth|GL_EXT_draw_buffers).+(enable|require)/g,"")).replace(/texture2D\s*\(/g,"texture("),n){var i=-1!==e.search(/layout *\(location *= *0\) *out/g),o=-1!==t.indexOf("#define DUAL_SOURCE_BLENDING"),a=o?"layout(location = 0, index = 0) out vec4 glFragColor;\nlayout(location = 0, index = 1) out vec4 glFragColor2;\n":"layout(location = 0) out vec4 glFragColor;\n";o&&(e="#extension GL_EXT_blend_func_extended : require\n"+e),e=(e=(e=(e=(e=(e=(e=e.replace(/texture2DLodEXT\s*\(/g,"textureLod(")).replace(/textureCubeLodEXT\s*\(/g,"textureLod(")).replace(/textureCube\s*\(/g,"texture(")).replace(/gl_FragDepthEXT/g,"gl_FragDepth")).replace(/gl_FragColor/g,"glFragColor")).replace(/gl_FragData/g,"glFragData")).replace(/void\s+?main\s*\(/g,(r||i?"":a)+"void main(")}else if(t.indexOf("#define VERTEXOUTPUT_INVARIANT")>=0&&(e="invariant gl_Position;\n"+e),-1!==t.indexOf("#define MULTIVIEW"))return"#extension GL_OVR_multiview2 : require\nlayout (num_views = 2) in;\n"+e;return e},e}()},24313:(e,t,n)=>{n.r(t),n.d(t,{FlowGraphBezierCurveEasingBlock:()=>l});var r=n(78322),i=n(84668),o=n(45749),a=n(88099),s=n(34623),l=function(e){function t(t){var n=e.call(this,t)||this;return n.config=t,n._easingFunctions={},n.mode=n.registerDataInput("mode",a.Es,0),n.controlPoint1=n.registerDataInput("controlPoint1",a.K$),n.controlPoint2=n.registerDataInput("controlPoint2",a.K$),n.easingFunction=n.registerDataOutput("easingFunction",a.Vv),n}return(0,r.C6)(t,e),t.prototype._updateOutputs=function(e){var t=this.mode.getValue(e),n=this.controlPoint1.getValue(e),r=this.controlPoint2.getValue(e);if(void 0!==t){var o="".concat(t,"-").concat(n.x,"-").concat(n.y,"-").concat(r.x,"-").concat(r.y);if(!this._easingFunctions[o]){var a=new i.Bv(n.x,n.y,r.x,r.y);a.setEasingMode(t),this._easingFunctions[o]=a}this.easingFunction.setValue(this._easingFunctions[o],e)}},t.prototype.getClassName=function(){return"FlowGraphBezierCurveEasing"},t}(o.e);(0,s.Y5)("FlowGraphBezierCurveEasing",l)},24444:(e,t,n)=>{n.r(t),n.d(t,{morphTargetsVertexGlobalDeclaration:()=>a});var r=n(98519),i="morphTargetsVertexGlobalDeclaration",o="#ifdef MORPHTARGETS\nuniform float morphTargetInfluences[NUM_MORPH_INFLUENCERS];\n#ifdef MORPHTARGETS_TEXTURE \nuniform float morphTargetTextureIndices[NUM_MORPH_INFLUENCERS];uniform vec3 morphTargetTextureInfo;uniform highp sampler2DArray morphTargets;vec3 readVector3FromRawSampler(int targetIndex,float vertexIndex)\n{ \nfloat y=floor(vertexIndex/morphTargetTextureInfo.y);float x=vertexIndex-y*morphTargetTextureInfo.y;vec3 textureUV=vec3((x+0.5)/morphTargetTextureInfo.y,(y+0.5)/morphTargetTextureInfo.z,morphTargetTextureIndices[targetIndex]);return texture(morphTargets,textureUV).xyz;}\nvec4 readVector4FromRawSampler(int targetIndex,float vertexIndex)\n{ \nfloat y=floor(vertexIndex/morphTargetTextureInfo.y);float x=vertexIndex-y*morphTargetTextureInfo.y;vec3 textureUV=vec3((x+0.5)/morphTargetTextureInfo.y,(y+0.5)/morphTargetTextureInfo.z,morphTargetTextureIndices[targetIndex]);return texture(morphTargets,textureUV);}\n#endif\n#endif\n";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]=o);var a={name:i,shader:o}},24687:(e,t,n)=>{n.r(t),n.d(t,{Dispose:()=>m,DumpData:()=>f,DumpDataAsync:()=>p,DumpFramebuffer:()=>d,DumpTools:()=>_});var r=n(78322),i=n(81152),o=n(93540),a=n(44957),s=n(48810),l=n(66614),c=n(7164),u=null;function h(){return(0,r.sH)(this,void 0,void 0,(function(){return(0,r.YH)(this,(function(e){switch(e.label){case 0:return u||(u=function(){return(0,r.sH)(this,void 0,void 0,(function(){var e,t,i,a,s,u,h,d;return(0,r.YH)(this,(function(r){switch(r.label){case 0:return(e=null!==(d=null===(h=l.q.LastCreatedEngine)||void 0===h?void 0:h.createCanvas(100,100))&&void 0!==d?d:new OffscreenCanvas(100,100))instanceof OffscreenCanvas&&c.V.Warn("DumpData: OffscreenCanvas will be used for dumping data. This may result in lossy alpha values."),[4,Promise.resolve().then(n.bind(n,44256))];case 1:if(!(t=r.sent().ThinEngine).IsSupported){if(!e.getContext("bitmaprenderer"))throw new Error("DumpData: No WebGL or bitmap rendering context available. Cannot dump data.");return[2,{canvas:e}]}return i=new t(e,!1,{preserveDrawingBuffer:!0,depth:!1,stencil:!1,alpha:!0,premultipliedAlpha:!1,antialias:!1,failIfMajorPerformanceCaveat:!1}),l.q.Instances.pop(),l.q.OnEnginesDisposedObservable.add((function(e){i&&e!==i&&!i.isDisposed&&0===l.q.Instances.length&&m()})),i.getCaps().parallelShaderCompile=void 0,a=new o.J(i),[4,Promise.resolve().then(n.bind(n,56017))];case 2:return s=r.sent().passPixelShader,u=new o.$({engine:i,name:s.name,fragmentShader:s.shader,samplerNames:["textureSampler"]}),[2,{canvas:e,dumpEngine:{engine:i,renderer:a,wrapper:u}}]}}))}))}()),[4,u];case 1:return[2,e.sent()]}}))}))}function d(e,t,n,i){return(0,r.sH)(this,arguments,void 0,(function(e,t,n,i,o,a,s){var l,c;return void 0===o&&(o="image/png"),(0,r.YH)(this,(function(r){switch(r.label){case 0:return[4,n.readPixels(0,0,e,t)];case 1:return l=r.sent(),c=new Uint8Array(l.buffer),f(e,t,c,i,o,a,!0,void 0,s),[2]}}))}))}function p(e,t,n){return(0,r.sH)(this,arguments,void 0,(function(e,t,n,o,l,c,u,d){var p,f,m,_,g=this;return void 0===o&&(o="image/png"),void 0===c&&(c=!1),void 0===u&&(u=!1),(0,r.YH)(this,(function(v){switch(v.label){case 0:if(n instanceof Float32Array){for(p=new Uint8Array(n.length),f=n.length;f--;)m=n[f],p[f]=Math.round(255*(0,s.Clamp)(m));n=p}return[4,h()];case 1:return _=v.sent(),[4,new Promise((function(s){return(0,r.sH)(g,void 0,void 0,(function(){var h,p,f,m,g;return(0,r.YH)(this,(function(r){switch(r.label){case 0:return _.dumpEngine?((h=_.dumpEngine).engine.setSize(e,t,!0),p=h.engine.createRawTexture(n,e,t,i.Y.TEXTUREFORMAT_RGBA,!1,!c,i.Y.TEXTURE_NEAREST_NEAREST),h.renderer.setViewport(),h.renderer.applyEffectWrapper(h.wrapper),h.wrapper.effect._bindTexture("textureSampler",p),h.renderer.draw(),p.dispose(),[3,3]):[3,1];case 1:return f=_.canvas.getContext("bitmaprenderer"),_.canvas.width=e,_.canvas.height=t,(m=new ImageData(e,t)).data.set(n),[4,createImageBitmap(m,{premultiplyAlpha:"none",imageOrientation:c?"flipY":"from-image"})];case 2:g=r.sent(),f.transferFromImageBitmap(g),r.label=3;case 3:return a.S0.ToBlob(_.canvas,(function(e){if(!e)throw new Error("DumpData: Failed to convert canvas to blob.");void 0!==l&&a.S0.DownloadBlob(e,l);var t=new FileReader;t.onload=function(e){var t=e.target.result;s(t)},u?t.readAsArrayBuffer(e):t.readAsDataURL(e)}),o,d),[2]}}))}))}))];case 2:return[2,v.sent()]}}))}))}function f(e,t,n,r,i,o,a,s,l){void 0===i&&(i="image/png"),void 0===a&&(a=!1),void 0===s&&(s=!1),void 0!==o||r||(o=""),p(e,t,n,i,o,a,s,l).then((function(e){r&&r(e)}))}function m(){u&&(null==u||u.then((function(e){e.canvas instanceof HTMLCanvasElement&&e.canvas.remove(),e.dumpEngine&&(e.dumpEngine.engine.dispose(),e.dumpEngine.renderer.dispose(),e.dumpEngine.wrapper.dispose())})),u=null)}var _={DumpData:f,DumpDataAsync:p,DumpFramebuffer:d,Dispose:m};a.S0.DumpData=f,a.S0.DumpDataAsync=p,a.S0.DumpFramebuffer=d},24894:(e,t,n)=>{n.d(t,{iL:()=>a,kZ:()=>c,sb:()=>s,sg:()=>o,tj:()=>l});var r=n(41190),i=(n(5153),n(81152)),o={};function a(e,t,n){return void 0===n&&(n=""),n+(t?t+"\n":"")+e}function s(e,t,n,i,a,s,l){var c=l||o.loadFile;if(c)return c(e,t,n,i,a,s);throw(0,r.n)("FileTools")}function l(e,t,n,r){if(e)return t?e.IS_NDC_HALF_ZRANGE="":delete e.IS_NDC_HALF_ZRANGE,n?e.USE_REVERSE_DEPTHBUFFER="":delete e.USE_REVERSE_DEPTHBUFFER,void(r?e.USE_EXACT_SRGB_CONVERSIONS="":delete e.USE_EXACT_SRGB_CONVERSIONS);var i="";return t&&(i+="#define IS_NDC_HALF_ZRANGE"),n&&(i&&(i+="\n"),i+="#define USE_REVERSE_DEPTHBUFFER"),r&&(i&&(i+="\n"),i+="#define USE_EXACT_SRGB_CONVERSIONS"),i}function c(e,t,n,r){switch(void 0===n&&(n=!1),e){case i.Y.TEXTURETYPE_BYTE:var o=(ArrayBuffer,new Int8Array(t));return r&&o.set(new Int8Array(r)),o;case i.Y.TEXTURETYPE_UNSIGNED_BYTE:var a=(ArrayBuffer,new Uint8Array(t));return r&&a.set(new Uint8Array(r)),a;case i.Y.TEXTURETYPE_SHORT:var s=t instanceof ArrayBuffer?new Int16Array(t):new Int16Array(n?t/2:t);return r&&s.set(new Int16Array(r)),s;case i.Y.TEXTURETYPE_UNSIGNED_SHORT:case i.Y.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4:case i.Y.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1:case i.Y.TEXTURETYPE_UNSIGNED_SHORT_5_6_5:case i.Y.TEXTURETYPE_HALF_FLOAT:var l=t instanceof ArrayBuffer?new Uint16Array(t):new Uint16Array(n?t/2:t);return r&&l.set(new Uint16Array(r)),l;case i.Y.TEXTURETYPE_INT:var c=t instanceof ArrayBuffer?new Int32Array(t):new Int32Array(n?t/4:t);return r&&c.set(new Int32Array(r)),c;case i.Y.TEXTURETYPE_UNSIGNED_INTEGER:case i.Y.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV:case i.Y.TEXTURETYPE_UNSIGNED_INT_24_8:case i.Y.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV:case i.Y.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV:case i.Y.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV:var u=t instanceof ArrayBuffer?new Uint32Array(t):new Uint32Array(n?t/4:t);return r&&u.set(new Uint32Array(r)),u;case i.Y.TEXTURETYPE_FLOAT:var h=t instanceof ArrayBuffer?new Float32Array(t):new Float32Array(n?t/4:t);return r&&h.set(new Float32Array(r)),h}var d=(ArrayBuffer,new Uint8Array(t));return r&&d.set(new Uint8Array(r)),d}},24943:(e,t,n)=>{n.d(t,{l:()=>i});var r=n(8046),i=function(){function e(e){var t=this;this._attachmentType=3,this._position=new r.Pq,this._rotationQuaternion=new r.PT,this._sceneNode=null,this._useBoundingBox=!1,this.dispose=function(){t.detach()},this._spatialAudioNode=e}return Object.defineProperty(e.prototype,"isAttached",{get:function(){return null!==this._sceneNode},enumerable:!1,configurable:!0}),e.prototype.attach=function(e,t,n){this._sceneNode!==e&&(this.detach(),e&&(this._attachmentType=n,this._sceneNode=e,this._sceneNode.onDisposeObservable.add(this.dispose),this._useBoundingBox=t))},e.prototype.detach=function(){var e;null===(e=this._sceneNode)||void 0===e||e.onDisposeObservable.removeCallback(this.dispose),this._sceneNode=null},e.prototype.update=function(){var e,t;1&this._attachmentType&&(this._useBoundingBox&&this._sceneNode.getBoundingInfo?this._position.copyFrom(this._sceneNode.getBoundingInfo().boundingBox.centerWorld):null===(e=this._sceneNode)||void 0===e||e.getWorldMatrix().getTranslationToRef(this._position),this._spatialAudioNode.position.copyFrom(this._position),this._spatialAudioNode._updatePosition()),2&this._attachmentType&&(null===(t=this._sceneNode)||void 0===t||t.getWorldMatrix().decompose(void 0,this._rotationQuaternion),this._spatialAudioNode.rotationQuaternion.copyFrom(this._rotationQuaternion),this._spatialAudioNode._updateRotation())},e}()},25187:(e,t,n)=>{n.d(t,{L:()=>r});var r=function(){function e(e,t,n,r){this.x=e,this.y=t,this.width=n,this.height=r}return e.prototype.toGlobal=function(t,n){return new e(this.x*t,this.y*n,this.width*t,this.height*n)},e.prototype.toGlobalToRef=function(e,t,n){return n.x=this.x*e,n.y=this.y*t,n.width=this.width*e,n.height=this.height*t,this},e.prototype.clone=function(){return new e(this.x,this.y,this.width,this.height)},e}()},25188:(e,t,n)=>{n.r(t),n.d(t,{lensFlarePixelShader:()=>a});var r=n(98519),i="lensFlarePixelShader",o="varying vec2 vUV;uniform sampler2D textureSampler;uniform vec4 color;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\nvec4 baseColor=texture2D(textureSampler,vUV);gl_FragColor=baseColor*color;\n#define CUSTOM_FRAGMENT_MAIN_END\n}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},25302:(e,t,n)=>{n.r(t),n.d(t,{lightProxyPixelShader:()=>a});var r=n(98519),i="lightProxyPixelShader",o="flat varying vec2 vLimits;flat varying highp uint vMask;void main(void) {if (gl_FragCoord.yvLimits.y) {discard;}\ngl_FragColor=vec4(vMask,0,0,1);}\n";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},25598:(e,t,n)=>{n.d(t,{A_:()=>d,Ez:()=>l,Hh:()=>m,JH:()=>a,Kl:()=>s,LK:()=>u,LU:()=>f,U0:()=>h,Y3:()=>i,aN:()=>o,b7:()=>r,cQ:()=>c,gn:()=>_,lR:()=>p});var r=4,i=4,o=1,a=2,s=8,l=65536,c=l>>3,u=14,h=65537,d=1<{n.r(t),n.d(t,{passCubePixelShader:()=>a});var r=n(98519),i="passCubePixelShader",o="varying vec2 vUV;uniform samplerCube textureSampler;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) \n{vec2 uv=vUV*2.0-1.0;\n#ifdef POSITIVEX\ngl_FragColor=textureCube(textureSampler,vec3(1.001,uv.y,uv.x));\n#endif\n#ifdef NEGATIVEX\ngl_FragColor=textureCube(textureSampler,vec3(-1.001,uv.y,uv.x));\n#endif\n#ifdef POSITIVEY\ngl_FragColor=textureCube(textureSampler,vec3(uv.y,1.001,uv.x));\n#endif\n#ifdef NEGATIVEY\ngl_FragColor=textureCube(textureSampler,vec3(uv.y,-1.001,uv.x));\n#endif\n#ifdef POSITIVEZ\ngl_FragColor=textureCube(textureSampler,vec3(uv,1.001));\n#endif\n#ifdef NEGATIVEZ\ngl_FragColor=textureCube(textureSampler,vec3(uv,-1.001));\n#endif\n}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},25757:(e,t,n)=>{var r=n(98519),i="depthPrePass";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="#ifdef DEPTHPREPASS\nfragmentOutputs.color= vec4f(0.,0.,0.,1.0);return fragmentOutputs;\n#endif\n")},25773:(e,t,n)=>{n.r(t),n.d(t,{iblDominantDirectionPixelShaderWGSL:()=>a});var r=n(98519),i=(n(17393),n(28469),n(61669),n(31321),"iblDominantDirectionPixelShader"),o="#include\n#include\n#include\n#include\nvar icdfSamplerSampler: sampler;var icdfSampler: texture_2d;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var lightDir: vec3f=vec3f(0.0,0.0,0.0);for(var i: u32=0u; i{n.r(t),n.d(t,{bloomMergePixelShader:()=>a});var r=n(98519),i="bloomMergePixelShader",o="uniform sampler2D textureSampler;uniform sampler2D bloomBlur;varying vec2 vUV;uniform float bloomWeight;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{gl_FragColor=texture2D(textureSampler,vUV);vec3 blurred=texture2D(bloomBlur,vUV).rgb;gl_FragColor.rgb=gl_FragColor.rgb+(blurred.rgb*bloomWeight); }\n";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},25792:(e,t,n)=>{n.r(t),n.d(t,{spritesVertexShader:()=>a});var r=n(98519),i=(n(72153),n(59262),n(56458),"spritesVertexShader"),o="attribute vec4 position;attribute vec2 options;attribute vec2 offsets;attribute vec2 inverts;attribute vec4 cellInfo;attribute vec4 color;uniform mat4 view;uniform mat4 projection;varying vec2 vUV;varying vec4 vColor;\n#include\n#include\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvec3 viewPos=(view*vec4(position.xyz,1.0)).xyz; \nvec2 cornerPos;float angle=position.w;vec2 size=vec2(options.x,options.y);vec2 offset=offsets.xy;cornerPos=vec2(offset.x-0.5,offset.y -0.5)*size;vec3 rotatedCorner;rotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);rotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);rotatedCorner.z=0.;viewPos+=rotatedCorner;gl_Position=projection*vec4(viewPos,1.0); \nvColor=color;vec2 uvOffset=vec2(abs(offset.x-inverts.x),abs(1.0-offset.y-inverts.y));vec2 uvPlace=cellInfo.xy;vec2 uvSize=cellInfo.zw;vUV.x=uvPlace.x+uvSize.x*uvOffset.x;vUV.y=uvPlace.y+uvSize.y*uvOffset.y;\n#ifdef FOG\nvFogDistance=viewPos;\n#endif\n#include\n#define CUSTOM_VERTEX_MAIN_END\n}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},25910:(e,t,n)=>{n.r(t),n.d(t,{displayPassPixelShaderWGSL:()=>a});var r=n(98519),i="displayPassPixelShader",o="varying vUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d;var passSamplerSampler: sampler;var passSampler: texture_2d;\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {fragmentOutputs.color=textureSample(passSampler,passSamplerSampler,input.vUV);}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},26218:(e,t,n)=>{n.d(t,{A:()=>i});var r=n(78322),i=function(e){function t(t){var n=e.call(this)||this;return n._buffer=t,n}return(0,r.C6)(t,e),Object.defineProperty(t.prototype,"underlyingResource",{get:function(){return this._buffer},enumerable:!1,configurable:!0}),t}(n(37943).n)},26345:(e,t,n)=>{n.r(t),n.d(t,{circleOfConfusionPixelShader:()=>a});var r=n(98519),i="circleOfConfusionPixelShader",o="uniform sampler2D depthSampler;varying vec2 vUV;\n#ifndef COC_DEPTH_NOT_NORMALIZED\nuniform vec2 cameraMinMaxZ;\n#endif\nuniform float focusDistance;uniform float cocPrecalculation;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{float depth=texture2D(depthSampler,vUV).r;\n#define CUSTOM_COC_DEPTH\n#ifdef COC_DEPTH_NOT_NORMALIZED\nfloat pixelDistance=depth*1000.0;\n#else\nfloat pixelDistance=(cameraMinMaxZ.x+cameraMinMaxZ.y*depth)*1000.0; \n#endif\n#define CUSTOM_COC_PIXELDISTANCE\nfloat coc=abs(cocPrecalculation*((focusDistance-pixelDistance)/pixelDistance));coc=clamp(coc,0.0,1.0);gl_FragColor=vec4(coc,coc,coc,1.0);}\n";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},27003:(e,t,n)=>{n.r(t),n.d(t,{clipPlaneFragmentDeclaration:()=>a});var r=n(98519),i="clipPlaneFragmentDeclaration",o="#ifdef CLIPPLANE\nvarying float fClipDistance;\n#endif\n#ifdef CLIPPLANE2\nvarying float fClipDistance2;\n#endif\n#ifdef CLIPPLANE3\nvarying float fClipDistance3;\n#endif\n#ifdef CLIPPLANE4\nvarying float fClipDistance4;\n#endif\n#ifdef CLIPPLANE5\nvarying float fClipDistance5;\n#endif\n#ifdef CLIPPLANE6\nvarying float fClipDistance6;\n#endif\n";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]=o);var a={name:i,shader:o}},27063:(e,t,n)=>{n.d(t,{GB:()=>o,Qc:()=>i,lA:()=>a});var r=n(8046),i={coneInnerAngle:6.28318530718,coneOuterAngle:6.28318530718,coneOuterVolume:0,distanceModel:"linear",maxDistance:1e4,minDistance:1,panningModel:"equalpower",position:r.Pq.Zero(),rolloffFactor:1,rotation:r.Pq.Zero(),rotationQuaternion:new r.PT};function o(e){return e.spatialEnabled||void 0!==e.spatialAutoUpdate||void 0!==e.spatialConeInnerAngle||void 0!==e.spatialConeOuterAngle||void 0!==e.spatialConeOuterVolume||void 0!==e.spatialDistanceModel||void 0!==e.spatialMaxDistance||void 0!==e.spatialMinDistance||void 0!==e.spatialMinUpdateTime||void 0!==e.spatialPanningModel||void 0!==e.spatialPosition||void 0!==e.spatialRolloffFactor||void 0!==e.spatialRotation||void 0!==e.spatialRotationQuaternion}var a=function(){}},27082:(e,t,n)=>{n.r(t),n.d(t,{openpbrPixelShaderWGSL:()=>E});var r=n(98519),i=(n(78710),n(76778),n(97088),n(75710),n(10896),n(338),"openpbrFragmentSamplersDeclaration");r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="#include(_DEFINENAME_,BASE_COLOR,_VARYINGNAME_,BaseColor,_SAMPLERNAME_,baseColor)\n#include(_DEFINENAME_,BASE_WEIGHT,_VARYINGNAME_,BaseWeight,_SAMPLERNAME_,baseWeight)\n#include(_DEFINENAME_,BASE_DIFFUSE_ROUGHNESS,_VARYINGNAME_,BaseDiffuseRoughness,_SAMPLERNAME_,baseDiffuseRoughness)\n#include(_DEFINENAME_,BASE_METALNESS,_VARYINGNAME_,BaseMetalness,_SAMPLERNAME_,baseMetalness)\n#include(_DEFINENAME_,SPECULAR_WEIGHT,_VARYINGNAME_,SpecularWeight,_SAMPLERNAME_,specularWeight)\n#include(_DEFINENAME_,SPECULAR_COLOR,_VARYINGNAME_,SpecularColor,_SAMPLERNAME_,specularColor)\n#include(_DEFINENAME_,SPECULAR_ROUGHNESS,_VARYINGNAME_,SpecularRoughness,_SAMPLERNAME_,specularRoughness)\n#include(_DEFINENAME_,SPECULAR_ROUGHNESS_ANISOTROPY,_VARYINGNAME_,SpecularRoughnessAnisotropy,_SAMPLERNAME_,specularRoughnessAnisotropy)\n#include(_DEFINENAME_,COAT_WEIGHT,_VARYINGNAME_,CoatWeight,_SAMPLERNAME_,coatWeight)\n#include(_DEFINENAME_,COAT_COLOR,_VARYINGNAME_,CoatColor,_SAMPLERNAME_,coatColor)\n#include(_DEFINENAME_,COAT_ROUGHNESS,_VARYINGNAME_,CoatRoughness,_SAMPLERNAME_,coatRoughness)\n#include(_DEFINENAME_,COAT_ROUGHNESS_ANISOTROPY,_VARYINGNAME_,CoatRoughnessAnisotropy,_SAMPLERNAME_,coatRoughnessAnisotropy)\n#include(_DEFINENAME_,COAT_DARKENING,_VARYINGNAME_,CoatDarkening,_SAMPLERNAME_,coatDarkening)\n#include(_DEFINENAME_,FUZZ_WEIGHT,_VARYINGNAME_,FuzzWeight,_SAMPLERNAME_,fuzzWeight)\n#include(_DEFINENAME_,FUZZ_COLOR,_VARYINGNAME_,FuzzColor,_SAMPLERNAME_,fuzzColor)\n#include(_DEFINENAME_,FUZZ_ROUGHNESS,_VARYINGNAME_,FuzzRoughness,_SAMPLERNAME_,fuzzRoughness)\n#include(_DEFINENAME_,GEOMETRY_OPACITY,_VARYINGNAME_,GeometryOpacity,_SAMPLERNAME_,geometryOpacity)\n#include(_DEFINENAME_,GEOMETRY_TANGENT,_VARYINGNAME_,GeometryTangent,_SAMPLERNAME_,geometryTangent)\n#include(_DEFINENAME_,GEOMETRY_COAT_TANGENT,_VARYINGNAME_,GeometryCoatTangent,_SAMPLERNAME_,geometryCoatTangent)\n#include(_DEFINENAME_,EMISSION_COLOR,_VARYINGNAME_,EmissionColor,_SAMPLERNAME_,emissionColor)\n#include(_DEFINENAME_,THIN_FILM_WEIGHT,_VARYINGNAME_,ThinFilmWeight,_SAMPLERNAME_,thinFilmWeight)\n#include(_DEFINENAME_,THIN_FILM_THICKNESS,_VARYINGNAME_,ThinFilmThickness,_SAMPLERNAME_,thinFilmThickness)\n#include(_DEFINENAME_,AMBIENT_OCCLUSION,_VARYINGNAME_,AmbientOcclusion,_SAMPLERNAME_,ambientOcclusion)\n#include(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_SAMPLERNAME_,decal)\n#ifdef REFLECTION\n#ifdef REFLECTIONMAP_3D\nvar reflectionSamplerSampler: sampler;var reflectionSampler: texture_cube;\n#ifdef LODBASEDMICROSFURACE\n#else\nvar reflectionLowSamplerSampler: sampler;var reflectionLowSampler: texture_cube;var reflectionHighSamplerSampler: sampler;var reflectionHighSampler: texture_cube;\n#endif\n#ifdef USEIRRADIANCEMAP\nvar irradianceSamplerSampler: sampler;var irradianceSampler: texture_cube;\n#endif\n#else\nvar reflectionSamplerSampler: sampler;var reflectionSampler: texture_2d;\n#ifdef LODBASEDMICROSFURACE\n#else\nvar reflectionLowSamplerSampler: sampler;var reflectionLowSampler: texture_2d;var reflectionHighSamplerSampler: sampler;var reflectionHighSampler: texture_2d;\n#endif\n#ifdef USEIRRADIANCEMAP\nvar irradianceSamplerSampler: sampler;var irradianceSampler: texture_2d;\n#endif\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vPositionUVW: vec3f;\n#else\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vDirectionW: vec3f;\n#endif\n#endif\n#endif\n#ifdef ENVIRONMENTBRDF\nvar environmentBrdfSamplerSampler: sampler;var environmentBrdfSampler: texture_2d;\n#endif\n#ifdef FUZZENVIRONMENTBRDF\nvar environmentFuzzBrdfSamplerSampler: sampler;var environmentFuzzBrdfSampler: texture_2d;\n#endif\n#if defined(ANISOTROPIC) || defined(FUZZ)\nvar blueNoiseSamplerSampler: sampler;var blueNoiseSampler: texture_2d;\n#endif\n#ifdef IBL_CDF_FILTERING\nvar icdfSamplerSampler: sampler;var icdfSampler: texture_2d;\n#endif\n"),n(86320),n(20502),n(38197),n(98318),n(17393),n(2804),n(28469),n(12191),n(4661),n(32532),n(44467),n(11751),n(16882),n(61669),n(31321),n(65136),n(37886);var o="openpbrNormalMapFragmentMainFunctions";r.l.IncludesShadersStoreWGSL[o]||(r.l.IncludesShadersStoreWGSL[o]="#if defined(GEOMETRY_NORMAL) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC) || defined(FUZZ) || defined(DETAIL)\n#if defined(TANGENT) && defined(NORMAL) \nvarying vTBN0: vec3f;varying vTBN1: vec3f;varying vTBN2: vec3f;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\nuniform normalMatrix: mat4x4f;fn toNormalMatrix(m: mat4x4f)->mat4x4f\n{var a00=m[0][0];var a01=m[0][1];var a02=m[0][2];var a03=m[0][3];var a10=m[1][0];var a11=m[1][1];var a12=m[1][2];var a13=m[1][3];var a20=m[2][0]; \nvar a21=m[2][1];var a22=m[2][2];var a23=m[2][3];var a30=m[3][0]; \nvar a31=m[3][1];var a32=m[3][2];var a33=m[3][3];var b00=a00*a11-a01*a10;var b01=a00*a12-a02*a10;var b02=a00*a13-a03*a10;var b03=a01*a12-a02*a11;var b04=a01*a13-a03*a11;var b05=a02*a13-a03*a12;var b06=a20*a31-a21*a30;var b07=a20*a32-a22*a30;var b08=a20*a33-a23*a30;var b09=a21*a32-a22*a31;var b10=a21*a33-a23*a31;var b11=a22*a33-a23*a32;var det=b00*b11-b01*b10+b02*b09+b03*b08-b04*b07+b05*b06;var mi=mat4x4(\n(a11*b11-a12*b10+a13*b09)/det,\n(a02*b10-a01*b11-a03*b09)/det,\n(a31*b05-a32*b04+a33*b03)/det,\n(a22*b04-a21*b05-a23*b03)/det,\n(a12*b08-a10*b11-a13*b07)/det,\n(a00*b11-a02*b08+a03*b07)/det,\n(a32*b02-a30*b05-a33*b01)/det,\n(a20*b05-a22*b02+a23*b01)/det,\n(a10*b10-a11*b08+a13*b06)/det,\n(a01*b08-a00*b10-a03*b06)/det,\n(a30*b04-a31*b02+a33*b00)/det,\n(a21*b02-a20*b04-a23*b00)/det,\n(a11*b07-a10*b09-a12*b06)/det,\n(a00*b09-a01*b07+a02*b06)/det,\n(a31*b01-a30*b03-a32*b00)/det,\n(a20*b03-a21*b01+a22*b00)/det);return mat4x4(mi[0][0],mi[1][0],mi[2][0],mi[3][0],\nmi[0][1],mi[1][1],mi[2][1],mi[3][1],\nmi[0][2],mi[1][2],mi[2][2],mi[3][2],\nmi[0][3],mi[1][3],mi[2][3],mi[3][3]);}\n#endif\nfn perturbNormalBase(cotangentFrame: mat3x3f,normal: vec3f,scale: f32)->vec3f\n{var output=normal;\n#ifdef NORMALXYSCALE\noutput=normalize(output* vec3f(scale,scale,1.0));\n#endif\nreturn normalize(cotangentFrame*output);}\nfn perturbNormal(cotangentFrame: mat3x3f,textureSample: vec3f,scale: f32)->vec3f\n{return perturbNormalBase(cotangentFrame,textureSample*2.0-1.0,scale);}\nfn cotangent_frame(normal: vec3f,p: vec3f,uv: vec2f,tangentSpaceParams: vec2f)->mat3x3f\n{var dp1: vec3f=dpdx(p);var dp2: vec3f=dpdy(p);var duv1: vec2f=dpdx(uv);var duv2: vec2f=dpdy(uv);var dp2perp: vec3f=cross(dp2,normal);var dp1perp: vec3f=cross(normal,dp1);var tangent: vec3f=dp2perp*duv1.x+dp1perp*duv2.x;var bitangent: vec3f=dp2perp*duv1.y+dp1perp*duv2.y;tangent*=tangentSpaceParams.x;bitangent*=tangentSpaceParams.y;var det: f32=max(dot(tangent,tangent),dot(bitangent,bitangent));var invmax: f32=select(inverseSqrt(det),0.0,det==0.0);return mat3x3f(tangent*invmax,bitangent*invmax,normal);}\n#endif\n");var a="openpbrNormalMapFragmentFunctions";r.l.IncludesShadersStoreWGSL[a]||(r.l.IncludesShadersStoreWGSL[a]="#if defined(GEOMETRY_NORMAL)\n#include(_DEFINENAME_,GEOMETRY_NORMAL,_VARYINGNAME_,GeometryNormal,_SAMPLERNAME_,geometryNormal)\n#endif\n#if defined(GEOMETRY_COAT_NORMAL)\n#include(_DEFINENAME_,GEOMETRY_COAT_NORMAL,_VARYINGNAME_,GeometryCoatNormal,_SAMPLERNAME_,geometryCoatNormal)\n#endif\n#if defined(DETAIL)\n#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail,_SAMPLERNAME_,detail)\n#endif\n#if defined(GEOMETRY_NORMAL) && defined(PARALLAX)\nconst minSamples: f32=4.;const maxSamples: f32=15.;const iMaxSamples: i32=15;fn parallaxOcclusion(vViewDirCoT: vec3f,vNormalCoT: vec3f,texCoord: vec2f,parallaxScale: f32)->vec2f {var parallaxLimit: f32=length(vViewDirCoT.xy)/vViewDirCoT.z;parallaxLimit*=parallaxScale;var vOffsetDir: vec2f=normalize(vViewDirCoT.xy);var vMaxOffset: vec2f=vOffsetDir*parallaxLimit;var numSamples: f32=maxSamples+(dot(vViewDirCoT,vNormalCoT)*(minSamples-maxSamples));var stepSize: f32=1.0/numSamples;var currRayHeight: f32=1.0;var vCurrOffset: vec2f= vec2f(0,0);var vLastOffset: vec2f= vec2f(0,0);var lastSampledHeight: f32=1.0;var currSampledHeight: f32=1.0;var keepWorking: bool=true;for (var i: i32=0; icurrRayHeight)\n{var delta1: f32=currSampledHeight-currRayHeight;var delta2: f32=(currRayHeight+stepSize)-lastSampledHeight;var ratio: f32=delta1/(delta1+delta2);vCurrOffset=(ratio)* vLastOffset+(1.0-ratio)*vCurrOffset;keepWorking=false;}\nelse\n{currRayHeight-=stepSize;vLastOffset=vCurrOffset;\n#ifdef PARALLAX_RHS\nvCurrOffset-=stepSize*vMaxOffset;\n#else\nvCurrOffset+=stepSize*vMaxOffset;\n#endif\nlastSampledHeight=currSampledHeight;}}\nreturn vCurrOffset;}\nfn parallaxOffset(viewDir: vec3f,heightScale: f32)->vec2f\n{var height: f32=textureSample(geometryNormalSampler,geometryNormalSamplerSampler,fragmentInputs.vGeometryNormalUV).w;var texCoordOffset: vec2f=heightScale*viewDir.xy*height;\n#ifdef PARALLAX_RHS\nreturn texCoordOffset;\n#else\nreturn -texCoordOffset;\n#endif\n}\n#endif\n"),n(61439);var s="openpbrDielectricReflectance";r.l.IncludesShadersStoreWGSL[s]||(r.l.IncludesShadersStoreWGSL[s]="struct ReflectanceParams\n{F0: f32,\nF90: f32,\ncoloredF0: vec3f,\ncoloredF90: vec3f,};\n#define pbr_inline\nfn dielectricReflectance(\ninsideIOR: f32,outsideIOR: f32,specularColor: vec3f,specularWeight: f32\n)->ReflectanceParams\n{var outParams: ReflectanceParams;let dielectricF0=pow((insideIOR-outsideIOR)/(insideIOR+outsideIOR),2.0);\n#if DIELECTRIC_SPECULAR_MODEL==DIELECTRIC_SPECULAR_MODEL_GLTF\nlet maxF0=max(specularColor.r,max(specularColor.g,specularColor.b));outParams.F0=dielectricF0*maxF0*specularWeight;\n#else\noutParams.F0=dielectricF0*specularWeight;\n#endif\nlet f90Scale=clamp(2.0f*abs(insideIOR-outsideIOR),0.0f,1.0f);outParams.F90=f90Scale*specularWeight;outParams.coloredF0=vec3f(dielectricF0*specularWeight)*specularColor.rgb;\n#if (DIELECTRIC_SPECULAR_MODEL==DIELECTRIC_SPECULAR_MODEL_OPENPBR)\nlet dielectricColorF90: vec3f=specularColor.rgb*vec3f(f90Scale)*specularWeight;\n#else\nlet dielectricColorF90: vec3f=vec3f(f90Scale)*specularWeight;\n#endif\noutParams.coloredF90=dielectricColorF90;return outParams;}\n");var l="openpbrConductorReflectance";r.l.IncludesShadersStoreWGSL[l]||(r.l.IncludesShadersStoreWGSL[l]="#define pbr_inline\nfn conductorReflectance(baseColor: vec3f,specularColor: vec3f,specularWeight: f32)->ReflectanceParams\n{var outParams: ReflectanceParams;\n#if (CONDUCTOR_SPECULAR_MODEL==CONDUCTOR_SPECULAR_MODEL_OPENPBR)\noutParams.coloredF0=baseColor*specularWeight;outParams.coloredF90=specularColor*specularWeight;\n#else\noutParams.coloredF0=baseColor;outParams.coloredF90=vec3f(1.0f);\n#endif\noutParams.F0=1.0f;outParams.F90=1.0f;return outParams;}");var c="openpbrBlockAmbientOcclusion";r.l.IncludesShadersStoreWGSL[c]||(r.l.IncludesShadersStoreWGSL[c]="struct ambientOcclusionOutParams\n{ambientOcclusionColor: vec3f,\n#if DEBUGMODE>0 && defined(AMBIENT_OCCLUSION)\nambientOcclusionColorMap: vec3f\n#endif\n};\n#define pbr_inline\nfn ambientOcclusionBlock(\n#ifdef AMBIENT_OCCLUSION\nambientOcclusionColorMap_: vec3f,\nambientInfos: vec2f\n#endif\n)->ambientOcclusionOutParams\n{ \nvar outParams: ambientOcclusionOutParams;var ambientOcclusionColor: vec3f= vec3f(1.,1.,1.);\n#ifdef AMBIENT_OCCLUSION\nvar ambientOcclusionColorMap: vec3f=ambientOcclusionColorMap_*ambientInfos.y;\n#ifdef AMBIENTINGRAYSCALE\nambientOcclusionColorMap= vec3f(ambientOcclusionColorMap.r,ambientOcclusionColorMap.r,ambientOcclusionColorMap.r);\n#endif\n#if DEBUGMODE>0\noutParams.ambientOcclusionColorMap=ambientOcclusionColorMap;\n#endif\n#endif\noutParams.ambientOcclusionColor=ambientOcclusionColor;return outParams;}\n");var u="openpbrGeometryInfo";r.l.IncludesShadersStoreWGSL[u]||(r.l.IncludesShadersStoreWGSL[u]="struct geometryInfoOutParams\n{NdotV: f32,\nNdotVUnclamped: f32,\nenvironmentBrdf: vec3f,\nhorizonOcclusion: f32};struct geometryInfoAnisoOutParams\n{NdotV: f32,\nNdotVUnclamped: f32,\nenvironmentBrdf: vec3f,\nhorizonOcclusion: f32,\nanisotropy: f32,\nanisotropicTangent: vec3f,\nanisotropicBitangent: vec3f,\nTBN: mat3x3};fn geometryInfo(\nnormalW: vec3f,viewDirectionW: vec3f,roughness: f32,geometricNormalW: vec3f\n)->geometryInfoOutParams\n{var outParams: geometryInfoOutParams;outParams.NdotVUnclamped=dot(normalW,viewDirectionW);outParams.NdotV=absEps(outParams.NdotVUnclamped);\n#if defined(ENVIRONMENTBRDF)\noutParams.environmentBrdf=getBRDFLookup(outParams.NdotV,roughness);\n#else\noutParams.environmentBrdf=vec3f(0.0);\n#endif\noutParams.horizonOcclusion=1.0f;\n#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\n#ifdef HORIZONOCCLUSION\n#if defined(GEOMETRY_NORMAL) || defined(GEOMETRY_COAT_NORMAL)\n#ifdef REFLECTIONMAP_3D\noutParams.horizonOcclusion=environmentHorizonOcclusion(-viewDirectionW,normalW,geometricNormalW);\n#endif\n#endif\n#endif\n#endif\nreturn outParams;}\nfn geometryInfoAniso(\nnormalW: vec3f,viewDirectionW: vec3f,roughness: f32,geometricNormalW: vec3f\n,vAnisotropy: vec3f,TBN: mat3x3\n)->geometryInfoAnisoOutParams\n{let geoInfo: geometryInfoOutParams=geometryInfo(normalW,viewDirectionW,roughness,geometricNormalW);var outParams: geometryInfoAnisoOutParams;outParams.NdotV=geoInfo.NdotV;outParams.NdotVUnclamped=geoInfo.NdotVUnclamped;outParams.environmentBrdf=geoInfo.environmentBrdf;outParams.horizonOcclusion=geoInfo.horizonOcclusion;outParams.anisotropy=vAnisotropy.b;let anisotropyDirection: vec3f=vec3f(vAnisotropy.xy,0.);let anisoTBN: mat3x3=mat3x3(normalize(TBN[0]),normalize(TBN[1]),normalize(TBN[2]));outParams.anisotropicTangent=normalize(anisoTBN*anisotropyDirection);outParams.anisotropicBitangent=normalize(cross(anisoTBN[2],outParams.anisotropicTangent));outParams.TBN=TBN;return outParams;}\n");var h="openpbrIblFunctions";r.l.IncludesShadersStoreWGSL[h]||(r.l.IncludesShadersStoreWGSL[h]="#ifdef REFLECTION\nfn sampleIrradiance(\nsurfaceNormal: vec3f\n#if defined(NORMAL) && defined(USESPHERICALINVERTEX)\n,vEnvironmentIrradianceSH: vec3f\n#endif\n#if (defined(USESPHERICALFROMREFLECTIONMAP) && (!defined(NORMAL) || !defined(USESPHERICALINVERTEX))) || (defined(USEIRRADIANCEMAP) && defined(REFLECTIONMAP_3D))\n,iblMatrix: mat4x4f\n#endif\n#ifdef USEIRRADIANCEMAP\n#ifdef REFLECTIONMAP_3D\n,irradianceSampler: texture_cube\n,irradianceSamplerSampler: sampler\n#else\n,irradianceSampler: texture_2d\n,irradianceSamplerSampler: sampler\n#endif\n#ifdef USE_IRRADIANCE_DOMINANT_DIRECTION\n,reflectionDominantDirection: vec3f\n#endif\n#endif\n#ifdef REALTIME_FILTERING\n,reflectionFilteringInfo: vec2f\n#ifdef IBL_CDF_FILTERING\n,icdfSampler: texture_2d\n,icdfSamplerSampler: sampler\n#endif\n#endif\n,reflectionInfos: vec2f\n,viewDirectionW: vec3f\n,diffuseRoughness: f32\n,surfaceAlbedo: vec3f\n)->vec3f {var environmentIrradiance=vec3f(0.,0.,0.);\n#if (defined(USESPHERICALFROMREFLECTIONMAP) && (!defined(NORMAL) || !defined(USESPHERICALINVERTEX))) || (defined(USEIRRADIANCEMAP) && defined(REFLECTIONMAP_3D))\nvar irradianceVector=(iblMatrix*vec4f(surfaceNormal,0.0f)).xyz;let irradianceView=(iblMatrix*vec4f(viewDirectionW,0.0f)).xyz;\n#if !defined(USE_IRRADIANCE_DOMINANT_DIRECTION) && !defined(REALTIME_FILTERING)\n#if BASE_DIFFUSE_MODEL != BRDF_DIFFUSE_MODEL_LAMBERT && BASE_DIFFUSE_MODEL != BRDF_DIFFUSE_MODEL_LEGACY\n{let NdotV=max(dot(surfaceNormal,viewDirectionW),0.0f);irradianceVector=mix(irradianceVector,irradianceView,(0.5f*(1.0f-NdotV))*diffuseRoughness);}\n#endif\n#endif\n#ifdef REFLECTIONMAP_OPPOSITEZ\nirradianceVector.z*=-1.0f;\n#endif\n#ifdef INVERTCUBICMAP\nirradianceVector.y*=-1.0f;\n#endif\n#endif\n#ifdef USESPHERICALFROMREFLECTIONMAP\n#if defined(NORMAL) && defined(USESPHERICALINVERTEX)\nenvironmentIrradiance=vEnvironmentIrradianceSH;\n#else\n#if defined(REALTIME_FILTERING)\nenvironmentIrradiance=irradiance(reflectionSampler,reflectionSamplerSampler,irradianceVector,reflectionFilteringInfo,diffuseRoughness,surfaceAlbedo,irradianceView\n#ifdef IBL_CDF_FILTERING\n,icdfSampler\n,icdfSamplerSampler\n#endif\n);\n#else\nenvironmentIrradiance=computeEnvironmentIrradiance(irradianceVector);\n#endif\n#endif\n#elif defined(USEIRRADIANCEMAP)\n#ifdef REFLECTIONMAP_3D\nlet environmentIrradianceFromTexture: vec4f=textureSample(irradianceSampler,irradianceSamplerSampler,irradianceVector);\n#else\nlet environmentIrradianceFromTexture: vec4f=textureSample(irradianceSampler,irradianceSamplerSampler,reflectionCoords);\n#endif\nenvironmentIrradiance=environmentIrradianceFromTexture.rgb;\n#ifdef RGBDREFLECTION\nenvironmentIrradiance.rgb=fromRGBD(environmentIrradianceFromTexture);\n#endif\n#ifdef GAMMAREFLECTION\nenvironmentIrradiance.rgb=toLinearSpace(environmentIrradiance.rgb);\n#endif\n#ifdef USE_IRRADIANCE_DOMINANT_DIRECTION\nlet Ls: vec3f=normalize(reflectionDominantDirection);let NoL: f32=dot(irradianceVector,Ls);let NoV: f32=dot(irradianceVector,irradianceView);var diffuseRoughnessTerm=vec3f(1.0f);\n#if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON\nlet LoV: f32=dot (Ls,irradianceView);let mag: f32=length(reflectionDominantDirection)*2.0f;let clampedAlbedo: vec3f=clamp(surfaceAlbedo,vec3f(0.1f),vec3f(1.0f));diffuseRoughnessTerm=diffuseBRDF_EON(clampedAlbedo,diffuseRoughness,NoL,NoV,LoV)*PI;diffuseRoughnessTerm=diffuseRoughnessTerm/clampedAlbedo;diffuseRoughnessTerm=mix(vec3f(1.0f),diffuseRoughnessTerm,sqrt(clamp(mag*NoV,0.0f,1.0f)));\n#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY\nlet H: vec3f=(irradianceView+Ls)*0.5f;let VoH: f32=dot(irradianceView,H);diffuseRoughnessTerm=vec3f(diffuseBRDF_Burley(NoL,NoV,VoH,diffuseRoughness)*PI);\n#endif\nenvironmentIrradiance=environmentIrradiance.rgb*diffuseRoughnessTerm;\n#endif\n#endif\nenvironmentIrradiance*=reflectionInfos.x;return environmentIrradiance;}\n#ifdef REFLECTIONMAP_3D\nfn createReflectionCoords(vPositionW: vec3f,normalW: vec3f)->vec3f\n#else\nfn createReflectionCoords(vPositionW: vec3f,normalW: vec3f)->vec2f\n#endif\n{var reflectionVector: vec3f=computeReflectionCoords(vec4f(vPositionW,1.0f),normalW);\n#ifdef REFLECTIONMAP_OPPOSITEZ\nreflectionVector.z*=-1.0;\n#endif\n#ifdef REFLECTIONMAP_3D\nvar reflectionCoords: vec3f=reflectionVector;\n#else\nvar reflectionCoords: vec2f=reflectionVector.xy;\n#ifdef REFLECTIONMAP_PROJECTION\nreflectionCoords/=reflectionVector.z;\n#endif\nreflectionCoords.y=1.0f-reflectionCoords.y;\n#endif\nreturn reflectionCoords;}\nfn sampleRadiance(\nalphaG: f32\n,reflectionMicrosurfaceInfos: vec3f\n,reflectionInfos: vec2f\n,geoInfo: geometryInfoOutParams\n#ifdef REFLECTIONMAP_3D\n,reflectionSampler: texture_cube\n,reflectionSamplerSampler: sampler\n,reflectionCoords: vec3f\n#else\n,reflectionSampler: texture_2d\n,reflectionSamplerSampler: sampler\n,reflectionCoords: vec2f\n#endif\n#ifdef REALTIME_FILTERING\n,reflectionFilteringInfo: vec2f\n#endif\n)->vec3f {var environmentRadiance: vec4f=vec4f(0.f,0.f,0.f,0.f);\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\nvar reflectionLOD: f32=getLodFromAlphaG(reflectionMicrosurfaceInfos.x,alphaG,geoInfo.NdotVUnclamped);\n#elif defined(LINEARSPECULARREFLECTION)\nvar reflectionLOD: f32=getLinearLodFromRoughness(reflectionMicrosurfaceInfos.x,roughness);\n#else\nvar reflectionLOD: f32=getLodFromAlphaG(reflectionMicrosurfaceInfos.x,alphaG);\n#endif\nreflectionLOD=reflectionLOD*reflectionMicrosurfaceInfos.y+reflectionMicrosurfaceInfos.z;\n#ifdef REALTIME_FILTERING\nenvironmentRadiance=vec4f(radiance(alphaG,reflectionSampler,reflectionSamplerSampler,reflectionCoords,reflectionFilteringInfo),1.0f);\n#else\nenvironmentRadiance=textureSampleLevel(reflectionSampler,reflectionSamplerSampler,reflectionCoords,reflectionLOD);\n#endif\n#ifdef RGBDREFLECTION\nenvironmentRadiance.rgb=fromRGBD(environmentRadiance);\n#endif\n#ifdef GAMMAREFLECTION\nenvironmentRadiance.rgb=toLinearSpace(environmentRadiance.rgb);\n#endif\nreturn environmentRadiance.rgb;}\n#if defined(ANISOTROPIC)\nfn sampleRadianceAnisotropic(\nalphaG: f32\n,reflectionMicrosurfaceInfos: vec3f\n,reflectionInfos: vec2f\n,geoInfo: geometryInfoAnisoOutParams\n,normalW: vec3f\n,viewDirectionW: vec3f\n,positionW: vec3f\n,noise: vec3f\n#ifdef REFLECTIONMAP_3D\n,reflectionSampler: texture_cube\n,reflectionSamplerSampler: sampler\n#else\n,reflectionSampler: texture_2d\n,reflectionSamplerSampler: sampler\n#endif\n#ifdef REALTIME_FILTERING\n,reflectionFilteringInfo: vec2f\n#endif\n)->vec3f {var environmentRadiance: vec4f=vec4f(0.f,0.f,0.f,0.f);let alphaT=alphaG*sqrt(2.0f/(1.0f+(1.0f-geoInfo.anisotropy)*(1.0f-geoInfo.anisotropy)));let alphaB=(1.0f-geoInfo.anisotropy)*alphaT;let modifiedAlphaG=alphaB;\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\nvar reflectionLOD: f32=getLodFromAlphaG(reflectionMicrosurfaceInfos.x,modifiedAlphaG,geoInfo.NdotVUnclamped);\n#elif defined(LINEARSPECULARREFLECTION)\nvar reflectionLOD: f32=getLinearLodFromRoughness(reflectionMicrosurfaceInfos.x,roughness);\n#else\nvar reflectionLOD: f32=getLodFromAlphaG(reflectionMicrosurfaceInfos.x,modifiedAlphaG);\n#endif\nreflectionLOD=reflectionLOD*reflectionMicrosurfaceInfos.y+reflectionMicrosurfaceInfos.z;\n#ifdef REALTIME_FILTERING\nvar view=(uniforms.reflectionMatrix*vec4f(viewDirectionW,0.0f)).xyz;var tangent=(uniforms.reflectionMatrix*vec4f(geoInfo.anisotropicTangent,0.0f)).xyz;var bitangent=(uniforms.reflectionMatrix*vec4f(geoInfo.anisotropicBitangent,0.0f)).xyz;var normal=(uniforms.reflectionMatrix*vec4f(normalW,0.0f)).xyz;\n#ifdef REFLECTIONMAP_OPPOSITEZ\nview.z*=-1.0f;tangent.z*=-1.0f;bitangent.z*=-1.0f;normal.z*=-1.0f;\n#endif\nenvironmentRadiance =\nvec4f(radianceAnisotropic(alphaT,alphaB,reflectionSampler,reflectionSamplerSampler,\nview,tangent,\nbitangent,normal,\nreflectionFilteringInfo,noise.xy),\n1.0f);\n#else\nconst samples: i32=16;var radianceSample=vec4f(0.0);var accumulatedRadiance=vec3f(0.0);var reflectionCoords=vec3f(0.0);var sample_weight=0.0f;var total_weight=0.0f;let step=1.0f/f32(max(samples-1,1));for (var i: i32=0; i0.0) {let blend: f32=t;bentNormal=normalize(mix(normalW,geoInfo.anisotropicTangent,blend));} else {bentNormal=normalW;}\nreflectionCoords=createReflectionCoords(positionW,bentNormal);radianceSample=textureSampleLevel(reflectionSampler,reflectionSamplerSampler,reflectionCoords,reflectionLOD);\n#ifdef RGBDREFLECTION\naccumulatedRadiance+=vec3f(sample_weight)*fromRGBD(radianceSample);\n#elif defined(GAMMAREFLECTION)\naccumulatedRadiance+=vec3f(sample_weight)*toLinearSpace(radianceSample.rgb);\n#else\naccumulatedRadiance+=vec3f(sample_weight)*radianceSample.rgb;\n#endif\ntotal_weight+=sample_weight;}\nenvironmentRadiance=vec4f(accumulatedRadiance/vec3f(total_weight),1.0f);\n#endif\nenvironmentRadiance=vec4f(environmentRadiance.rgb*reflectionInfos.xxx,environmentRadiance.a);return environmentRadiance.rgb;}\n#endif\nfn conductorIblFresnel(reflectance: ReflectanceParams,NdotV: f32,roughness: f32,environmentBrdf: vec3f)->vec3f\n{\n#if (CONDUCTOR_SPECULAR_MODEL==CONDUCTOR_SPECULAR_MODEL_OPENPBR)\nlet albedoF0: vec3f=mix(reflectance.coloredF0,pow(reflectance.coloredF0,vec3f(1.4f)),roughness);return getF82Specular(NdotV,albedoF0,reflectance.coloredF90,roughness);\n#else\nreturn getReflectanceFromBRDFLookup(reflectance.coloredF0,reflectance.coloredF90,environmentBrdf);\n#endif\n}\n#endif\n"),n(30032),n(30515);var d="openpbrNormalMapFragment";r.l.IncludesShadersStoreWGSL[d]||(r.l.IncludesShadersStoreWGSL[d]="var uvOffset: vec2f= vec2f(0.0,0.0);\n#if defined(GEOMETRY_NORMAL) || defined(GEOMETRY_COAT_NORMAL) || defined(PARALLAX) || defined(DETAIL)\n#ifdef NORMALXYSCALE\nvar normalScale: f32=1.0;\n#elif defined(GEOMETRY_NORMAL)\nvar normalScale: f32=uniforms.vGeometryNormalInfos.y;\n#else\nvar normalScale: f32=1.0;\n#endif\n#if defined(TANGENT) && defined(NORMAL)\nvar TBN: mat3x3f=mat3x3(input.vTBN0,input.vTBN1,input.vTBN2); \n#elif defined(GEOMETRY_NORMAL)\nvar TBNUV: vec2f=select(-fragmentInputs.vGeometryNormalUV,fragmentInputs.vGeometryNormalUV,fragmentInputs.frontFacing);var TBN: mat3x3f=cotangent_frame(normalW*normalScale,input.vPositionW,TBNUV,uniforms.vTangentSpaceParams);\n#else\nvar TBNUV: vec2f=select(-fragmentInputs.vDetailUV,fragmentInputs.vDetailUV,fragmentInputs.frontFacing);var TBN: mat3x3f=cotangent_frame(normalW*normalScale,input.vPositionW,TBNUV, vec2f(1.,1.));\n#endif\n#elif defined(ANISOTROPIC) || defined(FUZZ)\n#if defined(TANGENT) && defined(NORMAL)\nvar TBN: mat3x3f=mat3x3(input.vTBN0,input.vTBN1,input.vTBN2);\n#else\nvar TBNUV: vec2f=select( -fragmentInputs.vMainUV1,fragmentInputs.vMainUV1,fragmentInputs.frontFacing);var TBN: mat3x3f=cotangent_frame(normalW,input.vPositionW,TBNUV, vec2f(1.,1.));\n#endif\n#endif\n#ifdef PARALLAX\nvar invTBN: mat3x3f=transposeMat3(TBN);\n#ifdef PARALLAXOCCLUSION\n#else\n#endif\n#endif\n#ifdef DETAIL\nvar detailColor: vec4f=textureSample(detailSampler,detailSamplerSampler,fragmentInputs.vDetailUV+uvOffset);var detailNormalRG: vec2f=detailColor.wy*2.0-1.0;var detailNormalB: f32=sqrt(1.-saturate(dot(detailNormalRG,detailNormalRG)));var detailNormal: vec3f= vec3f(detailNormalRG,detailNormalB);\n#endif\n#ifdef GEOMETRY_COAT_NORMAL\ncoatNormalW=perturbNormal(TBN,textureSample(geometryCoatNormalSampler,geometryCoatNormalSamplerSampler,fragmentInputs.vGeometryCoatNormalUV+uvOffset).xyz,uniforms.vGeometryCoatNormalInfos.y);\n#endif\n#ifdef GEOMETRY_NORMAL\n#ifdef OBJECTSPACE_NORMALMAP\n#define CUSTOM_FRAGMENT_BUMP_FRAGMENT\nnormalW=normalize(textureSample(geometryNormalSampler,geometryNormalSamplerSampler,fragmentInputs.vGeometryNormalUV).xyz *2.0-1.0);normalW=normalize(mat3x3f(uniforms.normalMatrix[0].xyz,uniforms.normalMatrix[1].xyz,uniforms.normalMatrix[2].xyz)*normalW);\n#elif !defined(DETAIL)\nnormalW=perturbNormal(TBN,textureSample(geometryNormalSampler,geometryNormalSamplerSampler,fragmentInputs.vGeometryNormalUV+uvOffset).xyz,uniforms.vGeometryNormalInfos.y);\n#else\nvar sampledNormal: vec3f=textureSample(geometryNormalSampler,geometryNormalSamplerSampler,fragmentInputs.vGeometryNormalUV+uvOffset).xyz*2.0-1.0;\n#if DETAIL_NORMALBLENDMETHOD==0 \ndetailNormal=vec3f(detailNormal.xy*uniforms.vDetailInfos.z,detailNormal.z);var blendedNormal: vec3f=normalize( vec3f(sampledNormal.xy+detailNormal.xy,sampledNormal.z*detailNormal.z));\n#elif DETAIL_NORMALBLENDMETHOD==1 \ndetailNormal=vec3f(detailNormal.xy*uniforms.vDetailInfos.z,detailNormal.z);sampledNormal+= vec3f(0.0,0.0,1.0);detailNormal*= vec3f(-1.0,-1.0,1.0);var blendedNormal: vec3f=sampledNormal*dot(sampledNormal,detailNormal)/sampledNormal.z-detailNormal;\n#endif\nnormalW=perturbNormalBase(TBN,blendedNormal,uniforms.vGeometryNormalInfos.y);\n#endif\n#elif defined(DETAIL)\ndetailNormal=vec3f(detailNormal.xy*uniforms.vDetailInfos.z,detailNormal.z);normalW=perturbNormalBase(TBN,detailNormal,uniforms.vDetailInfos.z);\n#endif\n");var p="openpbrBlockNormalFinal";r.l.IncludesShadersStoreWGSL[p]||(r.l.IncludesShadersStoreWGSL[p]="#if defined(FORCENORMALFORWARD) && defined(NORMAL)\nvar faceNormal: vec3f=normalize(cross(dpdx(fragmentInputs.vPositionW),dpdy(fragmentInputs.vPositionW)))*scene.vEyePosition.w;\n#if defined(TWOSIDEDLIGHTING)\nfaceNormal=select(-faceNormal,faceNormal,fragmentInputs.frontFacing);\n#endif\nnormalW*=sign(dot(normalW,faceNormal));coatNormalW*=sign(dot(coatNormalW,faceNormal));\n#endif\n#if defined(TWOSIDEDLIGHTING) && defined(NORMAL)\n#if defined(MIRRORED)\nnormalW=select(normalW,-normalW,fragmentInputs.frontFacing);coatNormalW=select(coatNormalW,-coatNormalW,fragmentInputs.frontFacing);\n#else\nnormalW=select(-normalW,normalW,fragmentInputs.frontFacing);coatNormalW=select(-coatNormalW,coatNormalW,fragmentInputs.frontFacing);\n#endif\n#endif\n");var f="openpbrBaseLayerData";r.l.IncludesShadersStoreWGSL[f]||(r.l.IncludesShadersStoreWGSL[f]="var base_color=vec3f(0.8);var base_metalness: f32=0.0;var base_diffuse_roughness: f32=0.0;var specular_weight: f32=1.0;var specular_roughness: f32=0.3;var specular_color: vec3f=vec3f(1.0);var specular_roughness_anisotropy: f32=0.0;var specular_ior: f32=1.5;var alpha: f32=1.0;var geometry_tangent: vec2f=vec2f(1.0,0.0);\n#ifdef BASE_WEIGHT\nlet baseWeightFromTexture: vec4f=textureSample(baseWeightSampler,baseWeightSamplerSampler,fragmentInputs.vBaseWeightUV+uvOffset);\n#endif\n#ifdef BASE_COLOR\nlet baseColorFromTexture: vec4f=textureSample(baseColorSampler,baseColorSamplerSampler,fragmentInputs.vBaseColorUV+uvOffset);\n#endif\n#ifdef BASE_METALNESS\nlet metallicFromTexture: vec4f=textureSample(baseMetalnessSampler,baseMetalnessSamplerSampler,fragmentInputs.vBaseMetalnessUV+uvOffset);\n#endif\n#ifdef BASE_DIFFUSE_ROUGHNESS\nlet baseDiffuseRoughnessFromTexture: f32=textureSample(baseDiffuseRoughnessSampler,baseDiffuseRoughnessSamplerSampler,fragmentInputs.vBaseDiffuseRoughnessUV+uvOffset).r;\n#endif\n#ifdef GEOMETRY_TANGENT\nlet geometryTangentFromTexture: vec3f=textureSample(geometryTangentSampler,geometryTangentSamplerSampler,fragmentInputs.vGeometryTangentUV+uvOffset).rgb;\n#endif\n#ifdef SPECULAR_ROUGHNESS_ANISOTROPY\nlet anisotropyFromTexture: f32=textureSample(specularRoughnessAnisotropySampler,specularRoughnessAnisotropySamplerSampler,fragmentInputs.vSpecularRoughnessAnisotropyUV+uvOffset).r*uniforms.vSpecularRoughnessAnisotropyInfos.y;\n#endif\n#ifdef GEOMETRY_OPACITY\nlet opacityFromTexture: vec4f=textureSample(opacitySampler,opacitySamplerSampler,fragmentInputs.vOpacityUV+uvOffset);\n#endif\n#ifdef DECAL\nlet decalFromTexture: vec4f=textureSample(decalSampler,decalSamplerSampler,fragmentInputs.vDecalUV+uvOffset);\n#endif\n#ifdef SPECULAR_COLOR\nlet specularColorFromTexture: vec4f=textureSample(specularColorSampler,specularColorSamplerSampler,fragmentInputs.vSpecularColorUV+uvOffset);\n#endif\n#if defined(SPECULAR_WEIGHT)\n#ifdef SPECULAR_WEIGHT_IN_ALPHA\nlet specularWeightFromTexture: f32=textureSample(specularWeightSampler,specularWeightSamplerSampler,fragmentInputs.vSpecularWeightUV+uvOffset).a;\n#else\nlet specularWeightFromTexture: f32=textureSample(specularWeightSampler,specularWeightSamplerSampler,fragmentInputs.vSpecularWeightUV+uvOffset).r;\n#endif\n#endif\n#if defined(ANISOTROPIC) || defined(FUZZ)\nlet noise=textureSample(blueNoiseSampler,blueNoiseSamplerSampler,fragmentInputs.position.xy/256.0).xyz;\n#endif\n#if defined(ROUGHNESSSTOREINMETALMAPGREEN) && defined(BASE_METALNESS)\nlet roughnessFromTexture: f32=metallicFromTexture.g;\n#elif defined(SPECULAR_ROUGHNESS)\nlet roughnessFromTexture: f32=textureSample(specularRoughnessSampler,specularRoughnessSamplerSampler,fragmentInputs.vSpecularRoughnessUV+uvOffset).r;\n#endif\nbase_color=uniforms.vBaseColor.rgb;\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nbase_color*=fragmentInputs.vColor.rgb;\n#endif\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=fragmentInputs.vColor.a;\n#endif\nbase_color*=vec3(uniforms.vBaseWeight);alpha=uniforms.vBaseColor.a;base_metalness=uniforms.vReflectanceInfo.x;base_diffuse_roughness=uniforms.vBaseDiffuseRoughness;specular_roughness=uniforms.vReflectanceInfo.y;specular_color=uniforms.vSpecularColor.rgb;specular_weight=uniforms.vReflectanceInfo.a;specular_ior=uniforms.vReflectanceInfo.z;specular_roughness_anisotropy=uniforms.vSpecularAnisotropy.b;geometry_tangent=uniforms.vSpecularAnisotropy.rg;\n#ifdef BASE_COLOR\n#ifdef BASE_COLOR_GAMMA\nbase_color*=toLinearSpace(baseColorFromTexture.rgb);\n#else\nbase_color*=baseColorFromTexture.rgb;\n#endif\nbase_color*=uniforms.vBaseColorInfos.y;\n#endif\n#ifdef BASE_WEIGHT\nbase_color*=baseWeightFromTexture.r;\n#endif\n#if defined(BASE_COLOR) && defined(ALPHA_FROM_BASE_COLOR_TEXTURE)\nalpha*=baseColorFromTexture.a;\n#elif defined(GEOMETRY_OPACITY)\nalpha*=opacityFromTexture.a;alpha*=uniforms.vGeometryOpacityInfos.y;\n#endif\n#ifdef ALPHATEST\n#if DEBUGMODE != 88\nif (alpha{n.r(t),n.d(t,{outlineVertexShaderWGSL:()=>a});var r=n(98519),i=(n(45699),n(27279),n(73683),n(68478),n(9436),n(63866),n(38197),n(98819),n(77320),n(21310),n(3641),n(86615),n(63002),n(55607),"outlineVertexShader"),o="attribute position: vec3f;attribute normal: vec3f;\n#include\n#include\n#include\n#include[0..maxSimultaneousMorphTargets]\n#include\nuniform offset: f32;\n#include\nuniform viewProjection: mat4x4f;\n#ifdef ALPHATEST\nvarying vUV: vec2f;uniform diffuseMatrix: mat4x4f; \n#ifdef UV1\nattribute uv: vec2f;\n#endif\n#ifdef UV2\nattribute uv2: vec2f;\n#endif\n#endif\n#include\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input: VertexInputs)->FragmentInputs {var positionUpdated: vec3f=vertexInputs.position;var normalUpdated: vec3f=vertexInputs.normal;\n#ifdef UV1\nvar uvUpdated: vec2f=vertexInputs.uv;\n#endif\n#ifdef UV2\nvar uv2Updated: vec2f=vertexInputs.uv2;\n#endif\n#include\n#include[0..maxSimultaneousMorphTargets]\nvar offsetPosition: vec3f=positionUpdated+(normalUpdated*uniforms.offset);\n#include\n#include\n#include\nvar worldPos: vec4f=finalWorld*vec4f(offsetPosition,1.0);vertexOutputs.position=uniforms.viewProjection*worldPos;\n#ifdef ALPHATEST\n#ifdef UV1\nvertexOutputs.vUV=(uniforms.diffuseMatrix*vec4f(uvUpdated,1.0,0.0)).xy;\n#endif\n#ifdef UV2\nvertexOutputs.vUV=(uniforms.diffuseMatrix*vec4f(uv2Updated,1.0,0.0)).xy;\n#endif\n#endif\n#include\n#include\n}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},27181:(e,t,n)=>{n.d(t,{C:()=>o,_:()=>i});var r=n(10740);function i(e,t){t.EXPOSURE&&e.push("exposureLinear"),t.CONTRAST&&e.push("contrast"),t.COLORGRADING&&e.push("colorTransformSettings"),(t.VIGNETTE||t.DITHER)&&e.push("vInverseScreenSize"),t.VIGNETTE&&(e.push("vignetteSettings1"),e.push("vignetteSettings2")),t.COLORCURVES&&(0,r.B)(e),t.DITHER&&e.push("ditherIntensity")}function o(e,t){t.COLORGRADING&&e.push("txColorTransform")}},27279:(e,t,n)=>{var r=n(98519),i="bakedVertexAnimationDeclaration";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="#ifdef BAKED_VERTEX_ANIMATION_TEXTURE\nuniform bakedVertexAnimationTime: f32;uniform bakedVertexAnimationTextureSizeInverted: vec2;uniform bakedVertexAnimationSettings: vec4;var bakedVertexAnimationTexture : texture_2d;\n#ifdef INSTANCES\nattribute bakedVertexAnimationSettingsInstanced : vec4;\n#endif\nfn readMatrixFromRawSamplerVAT(smp : texture_2d,index : f32,frame : f32)->mat4x4\n{let offset=i32(index)*4;let frameUV=i32(frame);let m0=textureLoad(smp,vec2(offset+0,frameUV),0);let m1=textureLoad(smp,vec2(offset+1,frameUV),0);let m2=textureLoad(smp,vec2(offset+2,frameUV),0);let m3=textureLoad(smp,vec2(offset+3,frameUV),0);return mat4x4(m0,m1,m2,m3);}\n#endif\n")},27401:(e,t,n)=>{n.r(t),n.d(t,{filterPixelShaderWGSL:()=>a});var r=n(98519),i="filterPixelShader",o="varying vUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d;uniform kernelMatrix: mat4x4f;\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var baseColor: vec3f=textureSample(textureSampler,textureSamplerSampler,input.vUV).rgb;var updatedColor: vec3f=(uniforms.kernelMatrix* vec4f(baseColor,1.0)).rgb;fragmentOutputs.color= vec4f(updatedColor,1.0);}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},27947:(e,t,n)=>{var r=n(98519),i=(n(50851),"backgroundUboDeclaration");r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="layout(std140,column_major) uniform;uniform Material\n{uniform vec4 vPrimaryColor;uniform vec4 vPrimaryColorShadow;uniform vec2 vDiffuseInfos;uniform mat4 diffuseMatrix;uniform float fFovMultiplier;uniform float pointSize;uniform float shadowLevel;uniform float alpha;uniform vec3 vBackgroundCenter;uniform vec4 vReflectionControl;uniform vec2 projectedGroundInfos;uniform vec2 vReflectionInfos;uniform mat4 reflectionMatrix;uniform vec3 vReflectionMicrosurfaceInfos;};\n#include\n")},27993:(e,t,n)=>{n.r(t),n.d(t,{oitBackBlendPixelShaderWGSL:()=>a});var r=n(98519),i="oitBackBlendPixelShader",o="var uBackColor: texture_2d;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {fragmentOutputs.color=textureLoad(uBackColor,vec2i(fragmentInputs.position.xy),0);if (fragmentOutputs.color.a==0.0) {discard;}}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},28081:(e,t,n)=>{n.d(t,{t:()=>d});var r=n(78322),i=n(6174),o=n(66377),a=n(8046),s=n(66614),l=n(81152),c=n(23885),u=(n(17347),n(63919)),h=n(12028),d=function(e){function t(n,r){void 0===r&&(r=null);var i=e.call(this,null)||this;return i.metadata=null,i.reservedDataStore=null,i._hasAlpha=!1,i._getAlphaFromRGB=!1,i.level=1,i._coordinatesIndex=0,i.optimizeUVAllocation=!0,i._coordinatesMode=l.Y.TEXTURE_EXPLICIT_MODE,i.wrapR=l.Y.TEXTURE_WRAP_ADDRESSMODE,i.anisotropicFilteringLevel=t.DEFAULT_ANISOTROPIC_FILTERING_LEVEL,i._isCube=!1,i._gammaSpace=!0,i.invertZ=!1,i.lodLevelInAlpha=!1,i._dominantDirection=null,i.isRenderTarget=!1,i._prefiltered=!1,i._forceSerialize=!1,i.animations=[],i.onDisposeObservable=new o.cP,i._onDisposeObserver=null,i._scene=null,i._uid=null,i._parentContainer=null,i._loadingError=!1,n?t._IsScene(n)?i._scene=n:i._engine=n:i._scene=s.q.LastCreatedScene,i._scene&&(i.uniqueId=i._scene.getUniqueId(),i._scene.addTexture(i),i._engine=i._scene.getEngine()),i._texture=r,i._uid=null,i}return(0,r.C6)(t,e),Object.defineProperty(t.prototype,"hasAlpha",{get:function(){return this._hasAlpha},set:function(e){var t=this;this._hasAlpha!==e&&(this._hasAlpha=e,this._scene&&this._scene.markAllMaterialsAsDirty(l.Y.MATERIAL_TextureDirtyFlag,(function(e){return e.hasTexture(t)})))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getAlphaFromRGB",{get:function(){return this._getAlphaFromRGB},set:function(e){var t=this;this._getAlphaFromRGB!==e&&(this._getAlphaFromRGB=e,this._scene&&this._scene.markAllMaterialsAsDirty(l.Y.MATERIAL_TextureDirtyFlag,(function(e){return e.hasTexture(t)})))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"coordinatesIndex",{get:function(){return this._coordinatesIndex},set:function(e){var t=this;this._coordinatesIndex!==e&&(this._coordinatesIndex=e,this._scene&&this._scene.markAllMaterialsAsDirty(l.Y.MATERIAL_TextureDirtyFlag,(function(e){return e.hasTexture(t)})))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"coordinatesMode",{get:function(){return this._coordinatesMode},set:function(e){var t=this;this._coordinatesMode!==e&&(this._coordinatesMode=e,this._scene&&this._scene.markAllMaterialsAsDirty(l.Y.MATERIAL_TextureDirtyFlag,(function(e){return e.hasTexture(t)})))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wrapU",{get:function(){return this._wrapU},set:function(e){this._wrapU=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wrapV",{get:function(){return this._wrapV},set:function(e){this._wrapV=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isCube",{get:function(){return this._texture?this._texture.isCube:this._isCube},set:function(e){this._texture?this._texture.isCube=e:this._isCube=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"is3D",{get:function(){return!!this._texture&&this._texture.is3D},set:function(e){this._texture&&(this._texture.is3D=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"is2DArray",{get:function(){return!!this._texture&&this._texture.is2DArray},set:function(e){this._texture&&(this._texture.is2DArray=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"gammaSpace",{get:function(){return this._texture?(null===this._texture._gammaSpace&&(this._texture._gammaSpace=this._gammaSpace),this._texture._gammaSpace&&!this._texture._useSRGBBuffer):this._gammaSpace},set:function(e){var t,n=this;if(this._texture){if(this._texture._gammaSpace===e)return;this._texture._gammaSpace=e}else{if(this._gammaSpace===e)return;this._gammaSpace=e}null===(t=this.getScene())||void 0===t||t.markAllMaterialsAsDirty(l.Y.MATERIAL_TextureDirtyFlag,(function(e){return e.hasTexture(n)}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isRGBD",{get:function(){return null!=this._texture&&this._texture._isRGBD},set:function(e){var t,n=this;e!==this.isRGBD&&(this._texture&&(this._texture._isRGBD=e),null===(t=this.getScene())||void 0===t||t.markAllMaterialsAsDirty(l.Y.MATERIAL_TextureDirtyFlag,(function(e){return e.hasTexture(n)})))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"noMipmap",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lodGenerationOffset",{get:function(){return this._texture?this._texture._lodGenerationOffset:0},set:function(e){this._texture&&(this._texture._lodGenerationOffset=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lodGenerationScale",{get:function(){return this._texture?this._texture._lodGenerationScale:0},set:function(e){this._texture&&(this._texture._lodGenerationScale=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"linearSpecularLOD",{get:function(){return!!this._texture&&this._texture._linearSpecularLOD},set:function(e){this._texture&&(this._texture._linearSpecularLOD=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"irradianceTexture",{get:function(){return this._texture?this._texture._irradianceTexture:null},set:function(e){this._texture&&(this._texture._irradianceTexture=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"uid",{get:function(){return this._uid||(this._uid=(0,c.z)()),this._uid},enumerable:!1,configurable:!0}),t.prototype.toString=function(){return this.name},t.prototype.getClassName=function(){return"BaseTexture"},Object.defineProperty(t.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isBlocking",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loadingError",{get:function(){return this._loadingError},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"errorObject",{get:function(){return this._errorObject},enumerable:!1,configurable:!0}),t.prototype.getScene=function(){return this._scene},t.prototype._getEngine=function(){return this._engine},t.prototype.getTextureMatrix=function(){return a.uq.IdentityReadOnly},t.prototype.getReflectionTextureMatrix=function(){return a.uq.IdentityReadOnly},t.prototype.getRefractionTextureMatrix=function(){return this.getReflectionTextureMatrix()},t.prototype.isReadyOrNotBlocking=function(){return!this.isBlocking||this.isReady()||this.loadingError},t.prototype.scale=function(e){},Object.defineProperty(t.prototype,"canRescale",{get:function(){return!1},enumerable:!1,configurable:!0}),t.prototype._getFromCache=function(e,t,n,r,i,o){var a=this._getEngine();if(!a)return null;for(var s=a._getUseSRGBBuffer(!!i,t),l=a.getLoadedTexturesCache(),c=0;c=0&&this._scene.textures.splice(t,1),this._scene.onTextureRemovedObservable.notifyObservers(this),this._scene=null,this._parentContainer){var n=this._parentContainer.textures.indexOf(this);n>-1&&this._parentContainer.textures.splice(n,1),this._parentContainer=null}}this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this.metadata=null,e.prototype.dispose.call(this)},t.prototype.serialize=function(e){if(void 0===e&&(e=!1),!this.name&&!e)return null;var t=h.p.Serialize(this);return h.p.AppendSerializedAnimations(this,t),t},t.WhenAllReady=function(e,t){var n=e.length;if(0!==n)for(var r=0;r{var r=n(98519),i="importanceSampling";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="fn hemisphereCosSample(u: vec2f)->vec3f {var phi: f32=2.*PI*u.x;var cosTheta2: f32=1.-u.y;var cosTheta: f32=sqrt(cosTheta2);var sinTheta: f32=sqrt(1.-cosTheta2);return vec3f(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);}\nfn hemisphereImportanceSampleDggx(u: vec2f,a: f32)->vec3f {var phi: f32=2.*PI*u.x;var cosTheta2: f32=(1.-u.y)/(1.+(a+1.)*((a-1.)*u.y));var cosTheta: f32=sqrt(cosTheta2);var sinTheta: f32=sqrt(1.-cosTheta2);return vec3f(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);}\nfn hemisphereImportanceSampleDggxAnisotropic(Xi: vec2f,alphaTangent: f32,alphaBitangent: f32)->vec3f\n{let alphaT: f32=max(alphaTangent,0.0001);let alphaB: f32=max(alphaBitangent,0.0001);var phi: f32=atan(alphaB/alphaT*tan(2.0f*PI*Xi.x));if (Xi.x>0.5) {phi+=PI; }\nlet cosPhi: f32=cos(phi);let sinPhi: f32=sin(phi);let alpha2: f32=(cosPhi*cosPhi)/(alphaTangent*alphaTangent) +\n(sinPhi*sinPhi)/(alphaB*alphaB);let tanTheta2: f32=Xi.y/(1.0f-Xi.y)/alpha2;let cosTheta: f32=1.0f/sqrt(1.0f+tanTheta2);let sinTheta: f32=sqrt(max(0.0f,1.0f-cosTheta*cosTheta));return vec3f(sinTheta*cosPhi,sinTheta*sinPhi,cosTheta);}\nfn hemisphereImportanceSampleDCharlie(u: vec2f,a: f32)->vec3f { \nvar phi: f32=2.*PI*u.x;var sinTheta: f32=pow(u.y,a/(2.*a+1.));var cosTheta: f32=sqrt(1.-sinTheta*sinTheta);return vec3f(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);}")},28924:(e,t,n)=>{n.r(t),n.d(t,{shadowMapVertexMetricWGSL:()=>a});var r=n(98519),i="shadowMapVertexMetric",o="#if SM_USEDISTANCE==1\nvertexOutputs.vPositionWSM=worldPos.xyz;\n#endif\n#if SM_DEPTHTEXTURE==1\n#ifdef IS_NDC_HALF_ZRANGE\n#define BIASFACTOR 0.5\n#else\n#define BIASFACTOR 1.0\n#endif\n#ifdef USE_REVERSE_DEPTHBUFFER\nvertexOutputs.position.z-=uniforms.biasAndScaleSM.x*vertexOutputs.position.w*BIASFACTOR;\n#else\nvertexOutputs.position.z+=uniforms.biasAndScaleSM.x*vertexOutputs.position.w*BIASFACTOR;\n#endif\n#endif\n#if defined(SM_DEPTHCLAMP) && SM_DEPTHCLAMP==1\nvertexOutputs.zSM=vertexOutputs.position.z;vertexOutputs.position.z=0.0;\n#elif SM_USEDISTANCE==0\n#ifdef USE_REVERSE_DEPTHBUFFER\nvertexOutputs.vDepthMetricSM=(-vertexOutputs.position.z+uniforms.depthValuesSM.x)/uniforms.depthValuesSM.y+uniforms.biasAndScaleSM.x;\n#else\nvertexOutputs.vDepthMetricSM=(vertexOutputs.position.z+uniforms.depthValuesSM.x)/uniforms.depthValuesSM.y+uniforms.biasAndScaleSM.x;\n#endif\n#endif\n";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]=o);var a={name:i,shader:o}},28937:(e,t,n)=>{n.r(t),n.d(t,{gaussianSplattingVertexShader:()=>a});var r=n(98519),i=(n(91906),n(42202),n(85637),n(72153),n(59262),n(75334),n(72226),n(83057),n(62589),n(56458),"gaussianSplattingVertexShader"),o="#include<__decl__gaussianSplattingVertex>\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include\n#include\n#include\n#include\nattribute float splatIndex;uniform vec2 invViewport;uniform vec2 dataTextureSize;uniform vec2 focal;uniform float kernelSize;uniform vec3 eyePosition;uniform vec3 viewDirectionFactor;uniform sampler2D covariancesATexture;uniform sampler2D covariancesBTexture;uniform sampler2D centersTexture;uniform sampler2D colorsTexture;\n#if SH_DEGREE>0\nuniform highp usampler2D shTexture0;\n#endif\n#if SH_DEGREE>1\nuniform highp usampler2D shTexture1;\n#endif\n#if SH_DEGREE>2\nuniform highp usampler2D shTexture2;\n#endif\nvarying vec4 vColor;varying vec2 vPosition;\n#include\nvoid main () {Splat splat=readSplat(splatIndex);vec3 covA=splat.covA.xyz;vec3 covB=vec3(splat.covA.w,splat.covB.xy);vec4 worldPos=world*vec4(splat.center.xyz,1.0);vColor=splat.color;vPosition=position;\n#if SH_DEGREE>0\nmat3 worldRot=mat3(world);mat3 normWorldRot=inverseMat3(worldRot);vec3 dir=normalize(normWorldRot*(worldPos.xyz-eyePosition));dir*=viewDirectionFactor;vColor.xyz=splat.color.xyz+computeSH(splat,dir);\n#endif\ngl_Position=gaussianSplatting(position,worldPos.xyz,vec2(1.,1.),covA,covB,world,view,projection);\n#include\n#include\n#include\n}\n";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},28981:(e,t,n)=>{var r=n(98519),i="uvVariableDeclaration";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="#ifdef MAINUV{X}\n#if !defined(UV{X})\nvar uv{X}: vec2f=vec2f(0.,0.);\n#else\nvar uv{X}: vec2f=vertexInputs.uv{X};\n#endif\nvertexOutputs.vMainUV{X}=uv{X};\n#endif\n")},29059:(e,t,n)=>{n.r(t),n.d(t,{ssao2PixelShaderWGSL:()=>a});var r=n(98519),i="ssao2PixelShader",o="varying vUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d;\n#ifdef SSAO\nconst scales: array=array(\n0.1,\n0.11406250000000001,\n0.131640625,\n0.15625,\n0.187890625,\n0.2265625,\n0.272265625,\n0.325,\n0.384765625,\n0.4515625,\n0.525390625,\n0.60625,\n0.694140625,\n0.7890625,\n0.891015625,\n1.0\n);uniform near: f32;uniform radius: f32;var depthSamplerSampler: sampler;var depthSampler: texture_2d;var randomSamplerSampler: sampler;var randomSampler: texture_2d;var normalSamplerSampler: sampler;var normalSampler: texture_2d;uniform randTextureTiles: f32;uniform samplesFactor: f32;uniform sampleSphere: array;uniform totalStrength: f32;uniform base: f32;\n#ifdef ORTHOGRAPHIC_CAMERA\nuniform viewport: vec4f;\n#else\nuniform xViewport: f32;uniform yViewport: f32;\n#endif\nuniform depthProjection: mat3x3f;uniform maxZ: f32;uniform minZAspect: f32;uniform texelSize: vec2f;uniform projection: mat4x4f;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var random: vec3f=textureSampleLevel(randomSampler,randomSamplerSampler,input.vUV*uniforms.randTextureTiles,0.0).rgb;var depth: f32=textureSampleLevel(depthSampler,depthSamplerSampler,input.vUV,0.0).r;var depthSign: f32=sign(depth);depth=depth*depthSign;var normal: vec3f=textureSampleLevel(normalSampler,normalSamplerSampler,input.vUV,0.0).rgb;var occlusion: f32=0.0;var correctedRadius: f32=min(uniforms.radius,uniforms.minZAspect*depth/uniforms.near);\n#ifdef ORTHOGRAPHIC_CAMERA\nvar vViewRay: vec3f= vec3f(mix(uniforms.viewport.x,uniforms.viewport.y,input.vUV.x),mix(uniforms.viewport.z,uniforms.viewport.w,input.vUV.y),depthSign);\n#else\nvar vViewRay: vec3f= vec3f((input.vUV.x*2.0-1.0)*uniforms.xViewport,(input.vUV.y*2.0-1.0)*uniforms.yViewport,depthSign);\n#endif\nvar vDepthFactor: vec3f=uniforms.depthProjection* vec3f(1.0,1.0,depth);var origin: vec3f=vViewRay*vDepthFactor;var rvec: vec3f=random*2.0-1.0;rvec.z=0.0;var dotProduct: f32=dot(rvec,normal);rvec=select( vec3f(-rvec.y,0.0,rvec.x),rvec,1.0-abs(dotProduct)>1e-2);var tangent: vec3f=normalize(rvec-normal*dot(rvec,normal));var bitangent: vec3f=cross(normal,tangent);var tbn: mat3x3f= mat3x3f(tangent,bitangent,normal);var difference: f32;for (var i: i32=0; i1.0 || offset.y>1.0) {continue;}\nvar sampleDepth: f32=abs(textureSampleLevel(depthSampler,depthSamplerSampler,offset.xy,0.0).r);difference=depthSign*samplePosition.z-sampleDepth;var rangeCheck: f32=1.0-smoothstep(correctedRadius*0.5,correctedRadius,difference);occlusion+=step(EPSILON,difference)*rangeCheck;}\nocclusion=occlusion*(1.0-smoothstep(uniforms.maxZ*0.75,uniforms.maxZ,depth));var ao: f32=1.0-uniforms.totalStrength*occlusion*uniforms.samplesFactor;var result: f32=clamp(ao+uniforms.base,0.0,1.0);fragmentOutputs.color= vec4f( vec3f(result),1.0);}\n#else\n#ifdef BLUR\nuniform outSize: f32;uniform soften: f32;uniform tolerance: f32;uniform samples: i32;\n#ifndef BLUR_BYPASS\nvar depthSamplerSampler: sampler;var depthSampler: texture_2d;\n#ifdef BLUR_LEGACY\nfn blur13Bilateral(image: texture_2d,imageSampler: sampler,uv: vec2f,step: vec2f)->f32 {var result: f32=0.0;var off1: vec2f= vec2f(1.411764705882353)*step;var off2: vec2f= vec2f(3.2941176470588234)*step;var off3: vec2f= vec2f(5.176470588235294)*step;var compareDepth: f32=abs(textureSampleLevel(depthSampler,depthSamplerSampler,uv,0.0).r);var sampleDepth: f32;var weight: f32;var weightSum: f32=30.0;result+=textureSampleLevel(image,imageSampler,uv,0.0).r*30.0;sampleDepth=abs(textureSampleLevel(depthSampler,depthSamplerSampler,uv+off1,0.0).r);weight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);weightSum+= weight;result+=textureSampleLevel(image,imageSampler,uv+off1,0.0).r*weight;sampleDepth=abs(textureSampleLevel(depthSampler,depthSamplerSampler,uv-off1,0.0).r);weight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);weightSum+= weight;result+=textureSampleLevel(image,imageSampler,uv-off1,0.0).r*weight;sampleDepth=abs(textureSampleLevel(depthSampler,depthSamplerSampler,uv+off2,0.0).r);weight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);weightSum+=weight;result+=textureSampleLevel(image,imageSampler,uv+off2,0.0).r*weight;sampleDepth=abs(textureSampleLevel(depthSampler,depthSamplerSampler,uv-off2,0.0).r);weight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);weightSum+=weight;result+=textureSampleLevel(image,imageSampler,uv-off2,0.0).r*weight;sampleDepth=abs(textureSampleLevel(depthSampler,depthSamplerSampler,uv+off3,0.0).r);weight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);weightSum+=weight;result+=textureSampleLevel(image,imageSampler,uv+off3,0.0).r*weight;sampleDepth=abs(textureSampleLevel(depthSampler,depthSamplerSampler,uv-off3,0.0).r);weight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);weightSum+=weight;result+=textureSampleLevel(image,imageSampler,uv-off3,0.0).r*weight;return result/weightSum;}\n#endif\n#endif\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var result: f32=0.0;\n#ifdef BLUR_BYPASS\nresult=textureSampleLevel(textureSampler,textureSamplerSampler,input.vUV,0.0).r;\n#else\n#ifdef BLUR_H\nvar step: vec2f= vec2f(1.0/uniforms.outSize,0.0);\n#else\nvar step: vec2f= vec2f(0.0,1.0/uniforms.outSize);\n#endif\n#ifdef BLUR_LEGACY\nresult=blur13Bilateral(textureSampler,textureSamplerSampler,input.vUV,step);\n#else\nvar compareDepth: f32=abs(textureSampleLevel(depthSampler,depthSamplerSampler,input.vUV,0.0).r);var weightSum: f32=0.0;for (var i: i32=-uniforms.samples; i{n.r(t),n.d(t,{shadowMapFragment:()=>a});var r=n(98519),i="shadowMapFragment",o="float depthSM=vDepthMetricSM;\n#if defined(SM_DEPTHCLAMP) && SM_DEPTHCLAMP==1\n#if SM_USEDISTANCE==1\ndepthSM=(length(vPositionWSM-lightDataSM)+depthValuesSM.x)/depthValuesSM.y+biasAndScaleSM.x;\n#else\n#ifdef USE_REVERSE_DEPTHBUFFER\ndepthSM=(-zSM+depthValuesSM.x)/depthValuesSM.y+biasAndScaleSM.x;\n#else\ndepthSM=(zSM+depthValuesSM.x)/depthValuesSM.y+biasAndScaleSM.x;\n#endif\n#endif\ndepthSM=clamp(depthSM,0.0,1.0);\n#ifdef USE_REVERSE_DEPTHBUFFER\ngl_FragDepth=clamp(1.0-depthSM,0.0,1.0);\n#else\ngl_FragDepth=clamp(depthSM,0.0,1.0); \n#endif\n#elif SM_USEDISTANCE==1\ndepthSM=(length(vPositionWSM-lightDataSM)+depthValuesSM.x)/depthValuesSM.y+biasAndScaleSM.x;\n#endif\n#if SM_ESM==1\ndepthSM=clamp(exp(-min(87.,biasAndScaleSM.z*depthSM)),0.,1.);\n#endif\n#if SM_FLOAT==1\ngl_FragColor=vec4(depthSM,1.0,1.0,1.0);\n#else\ngl_FragColor=pack(depthSM);\n#endif\nreturn;";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]=o);var a={name:i,shader:o}},29587:(e,t,n)=>{n.d(t,{i:()=>s});var r=n(48810);function i(e){return e.split(" ").filter((function(e){return""!==e})).map((function(e){return parseFloat(e)}))}function o(e,t,n){for(;n.length!==t;){var r=i(e.lines[e.index++]);n.push.apply(n,r)}}function a(e,t,n){for(var i=0,o=0,a=0,s=0,l=0,c=0,u=0;u0&&!t.lines[t.index].includes("TILT=");)t.index++;t.lines[t.index].includes("INCLUDE"),t.index++;var r=i(t.lines[t.index++]);n.numberOfLights=r[0],n.lumensPerLamp=r[1],n.candelaMultiplier=r[2],n.numberOfVerticalAngles=r[3],n.numberOfHorizontalAngles=r[4],n.photometricType=r[5],n.unitsType=r[6],n.width=r[7],n.length=r[8],n.height=r[9];var s=i(t.lines[t.index++]);n.ballastFactor=s[0],n.fileGenerationType=s[1],n.inputWatts=s[2];for(var l=0;l0)for(l=0;l=p)&&(f%=2*p)>p&&(f=2*p-f),h[m+180*f]=a(n,m,f)}return{width:180,height:1,data:h}}},29598:(e,t,n)=>{n.d(t,{C:()=>o});var r=n(78322),i=n(81152),o=function(e){function t(t,n,r){var o=e.call(this,t,n)||this;return o.sourceSamplingMode=i.Y.TEXTURE_BILINEAR_SAMPLINGMODE,o.depthReadOnly=!1,o.stencilReadOnly=!1,o.disableColorWrite=!1,o.drawBackFace=!1,o.depthTest=!0,o.postProcess=r,o._postProcessDrawWrapper=o.postProcess.drawWrapper,o.outputTexture=o._frameGraph.textureManager.createDanglingHandle(),o.outputDepthAttachmentTexture=o._frameGraph.textureManager.createDanglingHandle(),o}return(0,r.C6)(t,e),Object.defineProperty(t.prototype,"drawWrapper",{get:function(){return this._postProcessDrawWrapper},enumerable:!1,configurable:!0}),t.prototype.isReady=function(){return this.postProcess.isReady()},t.prototype.record=function(e,t,n){var r=this;if(void 0===e&&(e=!1),void 0===this.sourceTexture&&void 0===this.targetTexture)throw new Error('FrameGraphPostProcessTask "'.concat(this.name,'": sourceTexture or targetTexture is required'));var i=void 0!==this.sourceTexture?this._frameGraph.textureManager.getTextureCreationOptions(this.sourceTexture):void 0;if(i&&(i.options.samples=1),this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture,this.targetTexture,this.name,i),void 0!==this.depthAttachmentTexture&&this._frameGraph.textureManager.resolveDanglingHandle(this.outputDepthAttachmentTexture,this.depthAttachmentTexture),i){var o=this._frameGraph.textureManager.getTextureAbsoluteDimensions(i);this._sourceWidth=o.width,this._sourceHeight=o.height}var a=this._frameGraph.textureManager.getTextureDescription(this.outputTexture);this._outputWidth=a.size.width,this._outputHeight=a.size.height;var s=this._frameGraph.addRenderPass(this.name);if(s.depthReadOnly=this.depthReadOnly,s.stencilReadOnly=this.stencilReadOnly,s.addDependencies(this.sourceTexture),s.setRenderTarget(this.outputTexture),s.setRenderTargetDepth(this.depthAttachmentTexture),s.setExecuteFunc((function(e){void 0!==r.sourceTexture&&e.setTextureSamplingMode(r.sourceTexture,r.sourceSamplingMode),null==t||t(e),e.applyFullScreenEffect(r._postProcessDrawWrapper,(function(){void 0!==r.sourceTexture&&e.bindTextureHandle(r._postProcessDrawWrapper.effect,"textureSampler",r.sourceTexture),null==n||n(e),r.postProcess.bind()}),r.stencilState,r.disableColorWrite,r.drawBackFace,r.depthTest)})),!e){var l=this._frameGraph.addRenderPass(this.name+"_disabled",!0);l.depthReadOnly=this.depthReadOnly,l.stencilReadOnly=this.stencilReadOnly,l.addDependencies(this.sourceTexture),l.setRenderTarget(this.outputTexture),l.setRenderTargetDepth(this.depthAttachmentTexture),l.setExecuteFunc((function(e){void 0!==r.sourceTexture&&e.copyTexture(r.sourceTexture)}))}return s},t.prototype.dispose=function(){this.postProcess.dispose(),e.prototype.dispose.call(this)},t}(n(97247).L)},29687:(e,t,n)=>{n.r(t),n.d(t,{fluidRenderingParticleDepthVertexShader:()=>a});var r=n(98519),i="fluidRenderingParticleDepthVertexShader",o="attribute vec3 position;attribute vec2 offset;uniform mat4 view;uniform mat4 projection;uniform vec2 size;varying vec2 uv;varying vec3 viewPos;varying float sphereRadius;\n#ifdef FLUIDRENDERING_VELOCITY\nattribute vec3 velocity;varying float velocityNorm;\n#endif\nvoid main(void) {vec3 cornerPos;cornerPos.xy=vec2(offset.x-0.5,offset.y-0.5)*size;cornerPos.z=0.0;viewPos=(view*vec4(position,1.0)).xyz;gl_Position=projection*vec4(viewPos+cornerPos,1.0);uv=offset;sphereRadius=size.x/2.0;\n#ifdef FLUIDRENDERING_VELOCITY\nvelocityNorm=length(velocity);\n#endif\n}\n";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},29776:(e,t,n)=>{n.r(t),n.d(t,{FlowGraphPauseAnimationBlock:()=>s});var r=n(78322),i=n(88469),o=n(88099),a=n(34623),s=function(e){function t(t){var n=e.call(this,t)||this;return n.animationToPause=n.registerDataInput("animationToPause",o.Vv),n}return(0,r.C6)(t,e),t.prototype._execute=function(e){this.animationToPause.getValue(e).pause(),this.out._activateSignal(e)},t.prototype.getClassName=function(){return"FlowGraphPauseAnimationBlock"},t}(i.w);(0,a.Y5)("FlowGraphPauseAnimationBlock",s)},29993:(e,t,n)=>{n.r(t),n.d(t,{taaPixelShaderWGSL:()=>a});var r=n(98519),i="taaPixelShader",o="varying vUV: vec2f;var textureSampler: texture_2d;var historySampler: texture_2d;\n#ifdef TAA_REPROJECT_HISTORY\nvar historySamplerSampler: sampler;var velocitySampler: texture_2d;\n#endif\nuniform factor: f32;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {let pos=vec2i(fragmentInputs.position.xy);let c=textureLoad(textureSampler,pos,0);\n#ifdef TAA_REPROJECT_HISTORY\nlet v=textureLoad(velocitySampler,pos,0);var h=textureSample(historySampler,historySamplerSampler,input.vUV+v.xy);\n#else\nvar h=textureLoad(historySampler,pos,0);\n#endif\n#ifdef TAA_CLAMP_HISTORY\nvar cmin=vec4f(1);var cmax=vec4f(0);for (var x=-1; x<=1; x+=1) {for (var y=-1; y<=1; y+=1) {let c=textureLoad(textureSampler,pos+vec2i(x,y),0);cmin=min(cmin,c);cmax=max(cmax,c);}}\nh=clamp(h,cmin,cmax);\n#endif\nfragmentOutputs.color= mix(h,c,uniforms.factor);}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},30004:(e,t,n)=>{n.r(t),n.d(t,{meshUVSpaceRendererMaskerPixelShader:()=>a});var r=n(98519),i="meshUVSpaceRendererMaskerPixelShader",o="varying vec2 vUV;void main(void) {gl_FragColor=vec4(1.0,1.0,1.0,1.0);}\n";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},30025:(e,t,n)=>{n.r(t),n.d(t,{boundingBoxRendererPixelShaderWGSL:()=>a});var r=n(98519),i="boundingBoxRendererPixelShader",o="uniform color: vec4f;\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\nfragmentOutputs.color=uniforms.color;\n#define CUSTOM_FRAGMENT_MAIN_END\n}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},30032:(e,t,n)=>{n.r(t),n.d(t,{clipPlaneFragmentWGSL:()=>a});var r=n(98519),i="clipPlaneFragment",o="#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4) || defined(CLIPPLANE5) || defined(CLIPPLANE6)\nif (false) {}\n#endif\n#ifdef CLIPPLANE\nelse if (fragmentInputs.fClipDistance>0.0)\n{discard;}\n#endif\n#ifdef CLIPPLANE2\nelse if (fragmentInputs.fClipDistance2>0.0)\n{discard;}\n#endif\n#ifdef CLIPPLANE3\nelse if (fragmentInputs.fClipDistance3>0.0)\n{discard;}\n#endif\n#ifdef CLIPPLANE4\nelse if (fragmentInputs.fClipDistance4>0.0)\n{discard;}\n#endif\n#ifdef CLIPPLANE5\nelse if (fragmentInputs.fClipDistance5>0.0)\n{discard;}\n#endif\n#ifdef CLIPPLANE6\nelse if (fragmentInputs.fClipDistance6>0.0)\n{discard;}\n#endif\n";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]=o);var a={name:i,shader:o}},30145:(e,t,n)=>{n.r(t),n.d(t,{displayPassPixelShader:()=>a});var r=n(98519),i="displayPassPixelShader",o="varying vec2 vUV;uniform sampler2D textureSampler;uniform sampler2D passSampler;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{gl_FragColor=texture2D(passSampler,vUV);}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},30515:(e,t,n)=>{var r=n(98519),i="pbrBlockNormalGeometric";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="var viewDirectionW: vec3f=normalize(scene.vEyePosition.xyz-input.vPositionW);\n#ifdef NORMAL\nvar normalW: vec3f=normalize(input.vNormalW);\n#else\nvar normalW: vec3f=normalize(cross(dpdx(input.vPositionW),dpdy(input.vPositionW)))*scene.vEyePosition.w;\n#endif\nvar geometricNormalW: vec3f=normalW;\n#if defined(TWOSIDEDLIGHTING) && defined(NORMAL)\ngeometricNormalW=select(-geometricNormalW,geometricNormalW,fragmentInputs.frontFacing);\n#endif\n")},30622:(e,t,n)=>{n.d(t,{w:()=>m});var r=n(78322),i=n(53770),o=n(66377),a=n(8046),s=n(74239),l=n(81152),c=n(6174),u=n(12028),h=n(34623),d=n(82673),p=n(87074),f=n(93540);d.$.prototype.setTextureFromPostProcess=function(e,t,n){var r,i=null;t&&(t._forcedOutputTexture?i=t._forcedOutputTexture:t._textures.data[t._currentRenderTextureInd]&&(i=t._textures.data[t._currentRenderTextureInd])),this._bindTexture(e,null!==(r=null==i?void 0:i.texture)&&void 0!==r?r:null,n)},d.$.prototype.setTextureFromPostProcessOutput=function(e,t,n){var r,i;this._bindTexture(e,null!==(i=null===(r=null==t?void 0:t._outputTexture)||void 0===r?void 0:r.texture)&&void 0!==i?i:null,n)},s.M.prototype.setTextureFromPostProcess=function(e,t){this._engine.setTextureFromPostProcess(this._samplers[e],t,e)},s.M.prototype.setTextureFromPostProcessOutput=function(e,t){this._engine.setTextureFromPostProcessOutput(this._samplers[e],t,e)};var m=function(){function e(t,n,r,s,c,u,h,d,p,m,_,g,v,y,b,S,T){var E,x,P,C,R,A,I,O,M,D,N,F;void 0===h&&(h=l.Y.TEXTURE_NEAREST_SAMPLINGMODE),void 0===m&&(m=null),void 0===_&&(_=l.Y.TEXTURETYPE_UNSIGNED_BYTE),void 0===g&&(g="postprocess"),void 0===y&&(y=!1),void 0===b&&(b=l.Y.TEXTUREFORMAT_RGBA),this._parentContainer=null,this.width=-1,this.height=-1,this.nodeMaterialSource=null,this._outputTexture=null,this.autoClear=!0,this.forceAutoClearInAlphaMode=!1,this.animations=[],this.enablePixelPerfectMode=!1,this.forceFullscreenViewport=!0,this.scaleMode=l.Y.SCALEMODE_FLOOR,this.alwaysForcePOT=!1,this._samples=1,this.adaptScaleToCurrentViewport=!1,this._webGPUReady=!1,this._reusable=!1,this._renderId=0,this.externalTextureSamplerBinding=!1,this._textures=new i.L(2),this._textureCache=[],this._currentRenderTextureInd=0,this._scaleRatio=new a.I9(1,1),this._texelSize=a.I9.Zero(),this.onActivateObservable=new o.cP,this.onSizeChangedObservable=new o.cP,this.onApplyObservable=new o.cP,this.onBeforeRenderObservable=new o.cP,this.onAfterRenderObservable=new o.cP,this.onDisposeObservable=new o.cP;var L,w=1,B=null;if(r&&!Array.isArray(r)){var V=r;r=null!==(E=V.uniforms)&&void 0!==E?E:null,s=null!==(x=V.samplers)&&void 0!==x?x:null,w=null!==(P=V.size)&&void 0!==P?P:1,u=null!==(C=V.camera)&&void 0!==C?C:null,h=null!==(R=V.samplingMode)&&void 0!==R?R:l.Y.TEXTURE_NEAREST_SAMPLINGMODE,d=V.engine,p=V.reusable,m=Array.isArray(V.defines)?V.defines.join("\n"):null!==(A=V.defines)&&void 0!==A?A:null,_=null!==(I=V.textureType)&&void 0!==I?I:l.Y.TEXTURETYPE_UNSIGNED_BYTE,g=null!==(O=V.vertexUrl)&&void 0!==O?O:"postprocess",v=V.indexParameters,y=null!==(M=V.blockCompilation)&&void 0!==M&&M,b=null!==(D=V.textureFormat)&&void 0!==D?D:l.Y.TEXTUREFORMAT_RGBA,S=null!==(N=V.shaderLanguage)&&void 0!==N?N:0,B=null!==(F=V.uniformBuffers)&&void 0!==F?F:null,T=V.extraInitializations,L=V.effectWrapper}else c&&(w="number"==typeof c?c:{width:c.width,height:c.height});if(this._useExistingThinPostProcess=!!L,this._effectWrapper=null!=L?L:new f.$({name:t,useShaderStore:!0,useAsPostProcess:!0,fragmentShader:n,engine:d||(null==u?void 0:u.getScene().getEngine()),uniforms:r,samplers:s,uniformBuffers:B,defines:m,vertexUrl:g,indexParameters:v,blockCompilation:!0,shaderLanguage:S,extraInitializations:void 0}),this.name=t,this.onEffectCreatedObservable=this._effectWrapper.onEffectCreatedObservable,null!=u?(this._camera=u,this._scene=u.getScene(),u.attachPostProcess(this),this._engine=this._scene.getEngine(),this._scene.addPostProcess(this),this.uniqueId=this._scene.getUniqueId()):d&&(this._engine=d,this._engine.postProcesses.push(this)),this._options=w,this.renderTargetSamplingMode=h||l.Y.TEXTURE_NEAREST_SAMPLINGMODE,this._reusable=p||!1,this._textureType=_,this._textureFormat=b,this._shaderLanguage=S||0,this._samplers=s||[],-1===this._samplers.indexOf("textureSampler")&&this._samplers.push("textureSampler"),this._fragmentUrl=n,this._vertexUrl=g,this._parameters=r||[],-1===this._parameters.indexOf("scale")&&this._parameters.push("scale"),this._uniformBuffers=B||[],this._indexParameters=v,!this._useExistingThinPostProcess){this._webGPUReady=1===this._shaderLanguage;var U=[];this._gatherImports(this._engine.isWebGPU&&!e.ForceGLSL,U),this._effectWrapper._webGPUReady=this._webGPUReady,this._effectWrapper._postConstructor(y,m,T,U)}}return Object.defineProperty(e,"ForceGLSL",{get:function(){return f.$.ForceGLSL},set:function(e){f.$.ForceGLSL=e},enumerable:!1,configurable:!0}),e.RegisterShaderCodeProcessing=function(e,t){f.$.RegisterShaderCodeProcessing(e,t)},Object.defineProperty(e.prototype,"name",{get:function(){return this._effectWrapper.name},set:function(e){this._effectWrapper.name=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alphaMode",{get:function(){return this._effectWrapper.alphaMode},set:function(e){this._effectWrapper.alphaMode=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"samples",{get:function(){return this._samples},set:function(e){var t=this;this._samples=Math.min(e,this._engine.getCaps().maxMSAASamples),this._textures.forEach((function(e){e.setSamples(t._samples)}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shaderLanguage",{get:function(){return this._shaderLanguage},enumerable:!1,configurable:!0}),e.prototype.getEffectName=function(){return this._fragmentUrl},Object.defineProperty(e.prototype,"onActivate",{set:function(e){this._onActivateObserver&&this.onActivateObservable.remove(this._onActivateObserver),e&&(this._onActivateObserver=this.onActivateObservable.add(e))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onSizeChanged",{set:function(e){this._onSizeChangedObserver&&this.onSizeChangedObservable.remove(this._onSizeChangedObserver),this._onSizeChangedObserver=this.onSizeChangedObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onApply",{set:function(e){this._onApplyObserver&&this.onApplyObservable.remove(this._onApplyObserver),this._onApplyObserver=this.onApplyObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onBeforeRender",{set:function(e){this._onBeforeRenderObserver&&this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver),this._onBeforeRenderObserver=this.onBeforeRenderObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onAfterRender",{set:function(e){this._onAfterRenderObserver&&this.onAfterRenderObservable.remove(this._onAfterRenderObserver),this._onAfterRenderObserver=this.onAfterRenderObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"inputTexture",{get:function(){return this._textures.data[this._currentRenderTextureInd]},set:function(e){this._forcedOutputTexture=e},enumerable:!1,configurable:!0}),e.prototype.restoreDefaultInputTexture=function(){this._forcedOutputTexture&&(this._forcedOutputTexture=null,this.markTextureDirty())},e.prototype.getCamera=function(){return this._camera},Object.defineProperty(e.prototype,"texelSize",{get:function(){return this._shareOutputWithPostProcess?this._shareOutputWithPostProcess.texelSize:(this._forcedOutputTexture&&this._texelSize.copyFromFloats(1/this._forcedOutputTexture.width,1/this._forcedOutputTexture.height),this._texelSize)},enumerable:!1,configurable:!0}),e.prototype._gatherImports=function(e,t){void 0===e&&(e=!1),e&&this._webGPUReady?t.push(Promise.all([Promise.resolve().then(n.bind(n,3072))])):t.push(Promise.all([Promise.resolve().then(n.bind(n,96795))]))},e.prototype.getClassName=function(){return"PostProcess"},e.prototype.getEngine=function(){return this._engine},e.prototype.getEffect=function(){return this._effectWrapper.drawWrapper.effect},e.prototype.shareOutputWith=function(e){return this._disposeTextures(),this._shareOutputWithPostProcess=e,this},e.prototype.useOwnOutput=function(){0==this._textures.length&&(this._textures=new i.L(2)),this._shareOutputWithPostProcess=null},e.prototype.updateEffect=function(e,t,n,r,i,o,a,s){void 0===e&&(e=null),void 0===t&&(t=null),void 0===n&&(n=null),this._effectWrapper.updateEffect(e,t,n,r,i,o,a,s),this._postProcessDefines=Array.isArray(this._effectWrapper.options.defines)?this._effectWrapper.options.defines.join("\n"):this._effectWrapper.options.defines},e.prototype.isReusable=function(){return this._reusable},e.prototype.markTextureDirty=function(){this.width=-1},e.prototype._createRenderTargetTexture=function(e,t,n){void 0===n&&(n=0);for(var r=0;r=0;t--)if(e-this._textureCache[t].lastUsedRenderId>100){for(var n=!1,r=0;r0&&this._textures.reset(),this.width=e,this.height=t;var o=null;if(n)for(var a=0;a=0;e--)this._textureCache[e].texture.dispose();this._textureCache.length=0},e.prototype.setPrePassRenderer=function(e){return!!this._prePassEffectConfiguration&&(this._prePassEffectConfiguration=e.addEffectConfiguration(this._prePassEffectConfiguration),this._prePassEffectConfiguration.enabled=!0,!0)},e.prototype.dispose=function(e){var t;if(e=e||this._camera,this._useExistingThinPostProcess||this._effectWrapper.dispose(),this._disposeTextures(),this._scene&&(t=this._scene.removePostProcess(this)),this._parentContainer){var n=this._parentContainer.postProcesses.indexOf(this);n>-1&&this._parentContainer.postProcesses.splice(n,1),this._parentContainer=null}if(-1!==(t=this._engine.postProcesses.indexOf(this))&&this._engine.postProcesses.splice(t,1),this.onDisposeObservable.notifyObservers(),e){if(e.detachPostProcess(this),0===(t=e._postProcesses.indexOf(this))&&e._postProcesses.length>0){var r=this._camera._getFirstPostProcess();r&&r.markTextureDirty()}this.onActivateObservable.clear(),this.onAfterRenderObservable.clear(),this.onApplyObservable.clear(),this.onBeforeRenderObservable.clear(),this.onSizeChangedObservable.clear(),this.onEffectCreatedObservable.clear()}},e.prototype.serialize=function(){var e=u.p.Serialize(this),t=this.getCamera()||this._scene&&this._scene.activeCamera;return e.customType="BABYLON."+this.getClassName(),e.cameraId=t?t.id:null,e.reusable=this._reusable,e.textureType=this._textureType,e.fragmentUrl=this._fragmentUrl,e.parameters=this._parameters,e.samplers=this._samplers,e.uniformBuffers=this._uniformBuffers,e.options=this._options,e.defines=this._postProcessDefines,e.textureFormat=this._textureFormat,e.vertexUrl=this._vertexUrl,e.indexParameters=this._indexParameters,e},e.prototype.clone=function(){var t=this.serialize();t._engine=this._engine,t.cameraId=null;var n=e.Parse(t,this._scene,"");return n?(n.onActivateObservable=this.onActivateObservable.clone(),n.onSizeChangedObservable=this.onSizeChangedObservable.clone(),n.onApplyObservable=this.onApplyObservable.clone(),n.onBeforeRenderObservable=this.onBeforeRenderObservable.clone(),n.onAfterRenderObservable=this.onAfterRenderObservable.clone(),n._prePassEffectConfiguration=this._prePassEffectConfiguration,n):null},e.Parse=function(e,t,n){var r=(0,h.n9)(e.customType);if(!r||!r._Parse)return null;var i=t?t.getCameraById(e.cameraId):null;return r._Parse(e,i,t,n)},e._Parse=function(t,n,r,i){return u.p.Parse((function(){return new e(t.name,t.fragmentUrl,t.parameters,t.samplers,t.options,n,t.renderTargetSamplingMode,t._engine,t.reusable,t.defines,t.textureType,t.vertexUrl,t.indexParameters,!1,t.textureFormat)}),t,r,i)},(0,r.Cg)([(0,c.lK)()],e.prototype,"uniqueId",void 0),(0,r.Cg)([(0,c.lK)()],e.prototype,"name",null),(0,r.Cg)([(0,c.lK)()],e.prototype,"width",void 0),(0,r.Cg)([(0,c.lK)()],e.prototype,"height",void 0),(0,r.Cg)([(0,c.lK)()],e.prototype,"renderTargetSamplingMode",void 0),(0,r.Cg)([(0,c.qK)()],e.prototype,"clearColor",void 0),(0,r.Cg)([(0,c.lK)()],e.prototype,"autoClear",void 0),(0,r.Cg)([(0,c.lK)()],e.prototype,"forceAutoClearInAlphaMode",void 0),(0,r.Cg)([(0,c.lK)()],e.prototype,"alphaMode",null),(0,r.Cg)([(0,c.lK)()],e.prototype,"alphaConstants",void 0),(0,r.Cg)([(0,c.lK)()],e.prototype,"enablePixelPerfectMode",void 0),(0,r.Cg)([(0,c.lK)()],e.prototype,"forceFullscreenViewport",void 0),(0,r.Cg)([(0,c.lK)()],e.prototype,"scaleMode",void 0),(0,r.Cg)([(0,c.lK)()],e.prototype,"alwaysForcePOT",void 0),(0,r.Cg)([(0,c.lK)("samples")],e.prototype,"_samples",void 0),(0,r.Cg)([(0,c.lK)()],e.prototype,"adaptScaleToCurrentViewport",void 0),e}();(0,h.Y5)("BABYLON.PostProcess",m)},30683:(e,t,n)=>{n.r(t),n.d(t,{pickingVertexShader:()=>a});var r=n(98519),i=(n(36470),n(64400),n(24444),n(67369),n(38615),n(58266),n(84589),n(35397),n(76898),n(49334),"pickingVertexShader"),o="attribute vec3 position;\n#if defined(INSTANCES)\nattribute float instanceMeshID;\n#endif\n#include\n#include\n#include\n#include[0..maxSimultaneousMorphTargets]\n#include\nuniform mat4 viewProjection;\n#if defined(INSTANCES)\nvarying float vMeshID;\n#endif\nvoid main(void) {\n#include\n#include[0..maxSimultaneousMorphTargets]\n#include\n#include\n#include\nvec4 worldPos=finalWorld*vec4(position,1.0);gl_Position=viewProjection*worldPos;\n#if defined(INSTANCES)\nvMeshID=instanceMeshID;\n#endif\n}\n";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},30738:(e,t,n)=>{n.r(t),n.d(t,{iblVoxelGridPixelShaderWGSL:()=>a});var r=n(98519),i="iblVoxelGridPixelShader",o="varying vNormalizedPosition: vec3f;uniform nearPlane: f32;uniform farPlane: f32;uniform stepSize: f32;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var normPos: vec3f=input.vNormalizedPosition.xyz;if (normPos.zuniforms.farPlane) {discard;}\nfragmentOutputs.fragData0=select(vec4f(0.0),vec4f(1.0),normPos.z=uniforms.nearPlane+uniforms.stepSize && normPos.z=uniforms.nearPlane+2.0*uniforms.stepSize && normPos.z=uniforms.nearPlane+3.0*uniforms.stepSize && normPos.z4\nfragmentOutputs.fragData4=select(vec4f(0.0),vec4f(1.0),normPos.z>=uniforms.nearPlane+4.0*uniforms.stepSize && normPos.z=uniforms.nearPlane+5.0*uniforms.stepSize && normPos.z=uniforms.nearPlane+6.0*uniforms.stepSize && normPos.z=uniforms.nearPlane+7.0*uniforms.stepSize && normPos.z{n.r(t),n.d(t,{FlowGraphInterpolationBlock:()=>c});var r=n(78322),i=n(81152),o=n(45749),a=n(88099),s=n(6927),l=n(34623),c=function(e){function t(t){var n,r;void 0===t&&(t={});var o=e.call(this,t)||this;o.keyFrames=[];var s="string"==typeof(null==t?void 0:t.animationType)?(0,a.Yd)(t.animationType):(0,a.aZ)(null!==(n=null==t?void 0:t.animationType)&&void 0!==n?n:i.Y.ANIMATIONTYPE_FLOAT),l=null!==(r=null==t?void 0:t.keyFramesCount)&&void 0!==r?r:1,c=o.registerDataInput("duration_0",a.Es,0),u=o.registerDataInput("value_0",s);o.keyFrames.push({duration:c,value:u});for(var h=1;h{n.d(t,{p:()=>i});var r=n(78322),i=function(e){function t(t,n,r,i){var o=e.call(this,t,n,r)||this;return o._dependencies=new Set,o.depthReadOnly=!1,o.stencilReadOnly=!1,o._engine=i,o}return(0,r.C6)(t,e),t.IsRenderPass=function(e){return void 0!==e.setRenderTarget},Object.defineProperty(t.prototype,"renderTarget",{get:function(){return this._renderTarget},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"renderTargetDepth",{get:function(){return this._renderTargetDepth},enumerable:!1,configurable:!0}),t.prototype.setRenderTarget=function(e){this._renderTarget=e},t.prototype.setRenderTargetDepth=function(e){this._renderTargetDepth=e},t.prototype.addDependencies=function(e){if(void 0!==e)if(Array.isArray(e))for(var t=0,n=e;t{n.r(t),n.d(t,{depthVertexShaderWGSL:()=>a});var r=n(98519),i=(n(45699),n(27279),n(73683),n(68478),n(9436),n(63866),n(98819),n(77320),n(21310),n(3641),n(86615),n(63002),"depthVertexShader"),o="attribute position: vec3f;\n#include\n#include\n#include\n#include[0..maxSimultaneousMorphTargets]\n#include\n#include\nuniform viewProjection: mat4x4f;uniform depthValues: vec2f;\n#if defined(ALPHATEST) || defined(NEED_UV)\nvarying vUV: vec2f;uniform diffuseMatrix: mat4x4f;\n#ifdef UV1\nattribute uv: vec2f;\n#endif\n#ifdef UV2\nattribute uv2: vec2f;\n#endif\n#endif\n#ifdef STORE_CAMERASPACE_Z\nuniform view: mat4x4f;varying vViewPos: vec4f;\n#endif\nvarying vDepthMetric: f32;\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {var positionUpdated: vec3f=input.position;\n#ifdef UV1\nvar uvUpdated: vec2f=input.uv;\n#endif\n#ifdef UV2\nvar uv2Updated: vec2f=input.uv2;\n#endif\n#include\n#include[0..maxSimultaneousMorphTargets]\n#include\n#include\n#include\nvar worldPos: vec4f=finalWorld* vec4f(positionUpdated,1.0);\n#include\nvertexOutputs.position=uniforms.viewProjection*worldPos;\n#ifdef STORE_CAMERASPACE_Z\nvertexOutputs.vViewPos=uniforms.view*worldPos;\n#else\n#ifdef USE_REVERSE_DEPTHBUFFER\nvertexOutputs.vDepthMetric=((-vertexOutputs.position.z+uniforms.depthValues.x)/(uniforms.depthValues.y));\n#else\nvertexOutputs.vDepthMetric=((vertexOutputs.position.z+uniforms.depthValues.x)/(uniforms.depthValues.y));\n#endif\n#endif\n#if defined(ALPHATEST) || defined(BASIC_RENDER)\n#ifdef UV1\nvertexOutputs.vUV= (uniforms.diffuseMatrix* vec4f(uvUpdated,1.0,0.0)).xy;\n#endif\n#ifdef UV2\nvertexOutputs.vUV= (uniforms.diffuseMatrix* vec4f(uv2Updated,1.0,0.0)).xy;\n#endif\n#endif\n}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},31194:(e,t,n)=>{n.r(t),n.d(t,{pbrPixelShaderWGSL:()=>C});var r=n(98519),i=(n(78710),n(76778),n(14052),n(75710),n(10896),n(338),"samplerFragmentAlternateDeclaration");r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="#ifdef _DEFINENAME_\n#if _DEFINENAME_DIRECTUV==1\n#define v_VARYINGNAME_UV vMainUV1\n#elif _DEFINENAME_DIRECTUV==2\n#define v_VARYINGNAME_UV vMainUV2\n#elif _DEFINENAME_DIRECTUV==3\n#define v_VARYINGNAME_UV vMainUV3\n#elif _DEFINENAME_DIRECTUV==4\n#define v_VARYINGNAME_UV vMainUV4\n#elif _DEFINENAME_DIRECTUV==5\n#define v_VARYINGNAME_UV vMainUV5\n#elif _DEFINENAME_DIRECTUV==6\n#define v_VARYINGNAME_UV vMainUV6\n#else\nvarying v_VARYINGNAME_UV: vec2f;\n#endif\n#endif\n");var o="pbrFragmentSamplersDeclaration";r.l.IncludesShadersStoreWGSL[o]||(r.l.IncludesShadersStoreWGSL[o]="#include(_DEFINENAME_,ALBEDO,_VARYINGNAME_,Albedo,_SAMPLERNAME_,albedo)\n#include(_DEFINENAME_,BASE_WEIGHT,_VARYINGNAME_,BaseWeight,_SAMPLERNAME_,baseWeight)\n#include(_DEFINENAME_,BASE_DIFFUSE_ROUGHNESS,_VARYINGNAME_,BaseDiffuseRoughness,_SAMPLERNAME_,baseDiffuseRoughness)\n#include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_SAMPLERNAME_,ambient)\n#include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_SAMPLERNAME_,opacity)\n#include(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_SAMPLERNAME_,emissive)\n#include(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_SAMPLERNAME_,lightmap)\n#include(_DEFINENAME_,REFLECTIVITY,_VARYINGNAME_,Reflectivity,_SAMPLERNAME_,reflectivity)\n#include(_DEFINENAME_,MICROSURFACEMAP,_VARYINGNAME_,MicroSurfaceSampler,_SAMPLERNAME_,microSurface)\n#include(_DEFINENAME_,METALLIC_REFLECTANCE,_VARYINGNAME_,MetallicReflectance,_SAMPLERNAME_,metallicReflectance)\n#include(_DEFINENAME_,REFLECTANCE,_VARYINGNAME_,Reflectance,_SAMPLERNAME_,reflectance)\n#include(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_SAMPLERNAME_,decal)\n#ifdef CLEARCOAT\n#include(_DEFINENAME_,CLEARCOAT_TEXTURE,_VARYINGNAME_,ClearCoat,_SAMPLERNAME_,clearCoat)\n#include(_DEFINENAME_,CLEARCOAT_TEXTURE_ROUGHNESS,_VARYINGNAME_,ClearCoatRoughness)\n#if defined(CLEARCOAT_TEXTURE_ROUGHNESS)\nvar clearCoatRoughnessSamplerSampler: sampler;var clearCoatRoughnessSampler: texture_2d;\n#endif\n#include(_DEFINENAME_,CLEARCOAT_BUMP,_VARYINGNAME_,ClearCoatBump,_SAMPLERNAME_,clearCoatBump)\n#include(_DEFINENAME_,CLEARCOAT_TINT_TEXTURE,_VARYINGNAME_,ClearCoatTint,_SAMPLERNAME_,clearCoatTint)\n#endif\n#ifdef IRIDESCENCE\n#include(_DEFINENAME_,IRIDESCENCE_TEXTURE,_VARYINGNAME_,Iridescence,_SAMPLERNAME_,iridescence)\n#include(_DEFINENAME_,IRIDESCENCE_THICKNESS_TEXTURE,_VARYINGNAME_,IridescenceThickness,_SAMPLERNAME_,iridescenceThickness)\n#endif\n#ifdef SHEEN\n#include(_DEFINENAME_,SHEEN_TEXTURE,_VARYINGNAME_,Sheen,_SAMPLERNAME_,sheen)\n#include(_DEFINENAME_,SHEEN_TEXTURE_ROUGHNESS,_VARYINGNAME_,SheenRoughness)\n#if defined(SHEEN_ROUGHNESS) && defined(SHEEN_TEXTURE_ROUGHNESS)\nvar sheenRoughnessSamplerSampler: sampler;var sheenRoughnessSampler: texture_2d;\n#endif\n#endif\n#ifdef ANISOTROPIC\n#include(_DEFINENAME_,ANISOTROPIC_TEXTURE,_VARYINGNAME_,Anisotropy,_SAMPLERNAME_,anisotropy)\n#endif\n#ifdef REFLECTION\n#ifdef REFLECTIONMAP_3D\nvar reflectionSamplerSampler: sampler;var reflectionSampler: texture_cube;\n#ifdef LODBASEDMICROSFURACE\n#else\nvar reflectionLowSamplerSampler: sampler;var reflectionLowSampler: texture_cube;var reflectionHighSamplerSampler: sampler;var reflectionHighSampler: texture_cube;\n#endif\n#ifdef USEIRRADIANCEMAP\nvar irradianceSamplerSampler: sampler;var irradianceSampler: texture_cube;\n#endif\n#else\nvar reflectionSamplerSampler: sampler;var reflectionSampler: texture_2d;\n#ifdef LODBASEDMICROSFURACE\n#else\nvar reflectionLowSamplerSampler: sampler;var reflectionLowSampler: texture_2d;var reflectionHighSamplerSampler: sampler;var reflectionHighSampler: texture_2d;\n#endif\n#ifdef USEIRRADIANCEMAP\nvar irradianceSamplerSampler: sampler;var irradianceSampler: texture_2d;\n#endif\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vPositionUVW: vec3f;\n#else\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vDirectionW: vec3f;\n#endif\n#endif\n#endif\n#ifdef ENVIRONMENTBRDF\nvar environmentBrdfSamplerSampler: sampler;var environmentBrdfSampler: texture_2d;\n#endif\n#ifdef SUBSURFACE\n#ifdef SS_REFRACTION\n#ifdef SS_REFRACTIONMAP_3D\nvar refractionSamplerSampler: sampler;var refractionSampler: texture_cube;\n#ifdef LODBASEDMICROSFURACE\n#else\nvar refractionLowSamplerSampler: sampler;var refractionLowSampler: texture_cube;var refractionHighSamplerSampler: sampler;var refractionHighSampler: texture_cube;\n#endif\n#else\nvar refractionSamplerSampler: sampler;var refractionSampler: texture_2d;\n#ifdef LODBASEDMICROSFURACE\n#else\nvar refractionLowSamplerSampler: sampler;var refractionLowSampler: texture_2d;var refractionHighSamplerSampler: sampler;var refractionHighSampler: texture_2d;\n#endif\n#endif\n#endif\n#include(_DEFINENAME_,SS_THICKNESSANDMASK_TEXTURE,_VARYINGNAME_,Thickness,_SAMPLERNAME_,thickness)\n#include(_DEFINENAME_,SS_REFRACTIONINTENSITY_TEXTURE,_VARYINGNAME_,RefractionIntensity,_SAMPLERNAME_,refractionIntensity)\n#include(_DEFINENAME_,SS_TRANSLUCENCYINTENSITY_TEXTURE,_VARYINGNAME_,TranslucencyIntensity,_SAMPLERNAME_,translucencyIntensity)\n#include(_DEFINENAME_,SS_TRANSLUCENCYCOLOR_TEXTURE,_VARYINGNAME_,TranslucencyColor,_SAMPLERNAME_,translucencyColor)\n#endif\n#ifdef IBL_CDF_FILTERING\nvar icdfSamplerSampler: sampler;var icdfSampler: texture_2d;\n#endif\n"),n(86320),n(20502),n(38197),n(98318),n(17393),n(2804),n(28469),n(12191),n(4661),n(32532),n(44467),n(11751),n(16882),n(61669),n(31321),n(65136),n(37886),n(96830),n(66633),n(61439),n(65969);var a="pbrBlockAlbedoOpacity";r.l.IncludesShadersStoreWGSL[a]||(r.l.IncludesShadersStoreWGSL[a]="struct albedoOpacityOutParams\n{surfaceAlbedo: vec3f,\nalpha: f32};\n#define pbr_inline\nfn albedoOpacityBlock(\nvAlbedoColor: vec4f\n#ifdef ALBEDO\n,albedoTexture: vec4f\n,albedoInfos: vec2f\n#endif\n,baseWeight: f32\n#ifdef BASE_WEIGHT\n,baseWeightTexture: vec4f\n,vBaseWeightInfos: vec2f\n#endif\n#ifdef OPACITY\n,opacityMap: vec4f\n,vOpacityInfos: vec2f\n#endif\n#ifdef DETAIL\n,detailColor: vec4f\n,vDetailInfos: vec4f\n#endif\n#ifdef DECAL\n,decalColor: vec4f\n,vDecalInfos: vec4f\n#endif\n)->albedoOpacityOutParams\n{var outParams: albedoOpacityOutParams;var surfaceAlbedo: vec3f=vAlbedoColor.rgb;var alpha: f32=vAlbedoColor.a;\n#ifdef ALBEDO\n#if defined(ALPHAFROMALBEDO) || defined(ALPHATEST)\nalpha*=albedoTexture.a;\n#endif\n#ifdef GAMMAALBEDO\nsurfaceAlbedo*=toLinearSpaceVec3(albedoTexture.rgb);\n#else\nsurfaceAlbedo*=albedoTexture.rgb;\n#endif\nsurfaceAlbedo*=albedoInfos.y;\n#endif\n#ifndef DECAL_AFTER_DETAIL\n#include\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nsurfaceAlbedo*=fragmentInputs.vColor.rgb;\n#endif\n#ifdef DETAIL\nvar detailAlbedo: f32=2.0*mix(0.5,detailColor.r,vDetailInfos.y);surfaceAlbedo=surfaceAlbedo.rgb*detailAlbedo*detailAlbedo; \n#endif\n#ifdef DECAL_AFTER_DETAIL\n#include\n#endif\n#define CUSTOM_FRAGMENT_UPDATE_ALBEDO\nsurfaceAlbedo*=baseWeight;\n#ifdef BASE_WEIGHT\nsurfaceAlbedo*=baseWeightTexture.r;\n#endif\n#ifdef OPACITY\n#ifdef OPACITYRGB\nalpha=getLuminance(opacityMap.rgb);\n#else\nalpha*=opacityMap.a;\n#endif\nalpha*=vOpacityInfos.y;\n#endif\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=fragmentInputs.vColor.a;\n#endif\n#if !defined(SS_LINKREFRACTIONTOTRANSPARENCY) && !defined(ALPHAFRESNEL)\n#ifdef ALPHATEST\n#if DEBUGMODE != 88\nif (alpha{n.r(t),n.d(t,{tonemapPixelShaderWGSL:()=>a});var r=n(98519),i="tonemapPixelShader",o="varying vUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d;uniform _ExposureAdjustment: f32;\n#if defined(HABLE_TONEMAPPING)\nconst A: f32=0.15;const B: f32=0.50;const C: f32=0.10;const D: f32=0.20;const E: f32=0.02;const F: f32=0.30;const W: f32=11.2;\n#endif\nfn Luminance(c: vec3f)->f32\n{return dot(c, vec3f(0.22,0.707,0.071));}\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var colour: vec3f=textureSample(textureSampler,textureSamplerSampler,input.vUV).rgb;\n#if defined(REINHARD_TONEMAPPING)\nvar lum: f32=Luminance(colour.rgb); \nvar lumTm: f32=lum*uniforms._ExposureAdjustment;var scale: f32=lumTm/(1.0+lumTm); \ncolour*=scale/lum;\n#elif defined(HABLE_TONEMAPPING)\ncolour*=uniforms._ExposureAdjustment;const ExposureBias: f32=2.0;var x: vec3f=ExposureBias*colour;var curr: vec3f=((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;x= vec3f(W,W,W);var whiteScale: vec3f=1.0/(((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F);colour=curr*whiteScale;\n#elif defined(OPTIMIZED_HEJIDAWSON_TONEMAPPING)\ncolour*=uniforms._ExposureAdjustment;var X: vec3f=max( vec3f(0.0,0.0,0.0),colour-0.004);var retColor: vec3f=(X*(6.2*X+0.5))/(X*(6.2*X+1.7)+0.06);colour=retColor*retColor;\n#elif defined(PHOTOGRAPHIC_TONEMAPPING)\ncolour= vec3f(1.0,1.0,1.0)-exp2(-uniforms._ExposureAdjustment*colour);\n#endif\nfragmentOutputs.color= vec4f(colour.rgb,1.0);}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},31198:(e,t,n)=>{n.d(t,{H:()=>a});var r=n(40099),i=n(88099),o=new RegExp(/\/\{(\w+)\}(?=\/|$)/g),a=function(){function e(e,t){this.path=e,this.ownerBlock=t,this.templatedInputs=[];for(var n=o.exec(e),a=new Set;n;){var s=n[1];if(a.has(s))throw new Error("Duplicate template variable detected.");a.add(s),this.templatedInputs.push(t.registerDataInput(s,i.x2,new r.P(0))),n=o.exec(e)}}return e.prototype.getAccessor=function(e,t){for(var n=this.path,r=0,i=this.templatedInputs;r{var r=n(98519),i="pbrIBLFunctions";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#if defined(REFLECTION) || defined(SS_REFRACTION)\nfloat getLodFromAlphaG(float cubeMapDimensionPixels,float microsurfaceAverageSlope) {float microsurfaceAverageSlopeTexels=cubeMapDimensionPixels*microsurfaceAverageSlope;float lod=log2(microsurfaceAverageSlopeTexels);return lod;}\nfloat getLinearLodFromRoughness(float cubeMapDimensionPixels,float roughness) {float lod=log2(cubeMapDimensionPixels)*roughness;return lod;}\n#endif\n#if defined(ENVIRONMENTBRDF) && defined(RADIANCEOCCLUSION)\nfloat environmentRadianceOcclusion(float ambientOcclusion,float NdotVUnclamped) {float temp=NdotVUnclamped+ambientOcclusion;return saturate(square(temp)-1.0+ambientOcclusion);}\n#endif\n#if defined(ENVIRONMENTBRDF) && defined(HORIZONOCCLUSION)\nfloat environmentHorizonOcclusion(vec3 view,vec3 normal,vec3 geometricNormal) {vec3 reflection=reflect(view,normal);float temp=saturate(1.0+1.1*dot(reflection,geometricNormal));return square(temp);}\n#endif\n#if defined(LODINREFLECTIONALPHA) || defined(SS_LODINREFRACTIONALPHA)\n#define UNPACK_LOD(x) (1.0-x)*255.0\nfloat getLodFromAlphaG(float cubeMapDimensionPixels,float alphaG,float NdotV) {float microsurfaceAverageSlope=alphaG;microsurfaceAverageSlope*=sqrt(abs(NdotV));return getLodFromAlphaG(cubeMapDimensionPixels,microsurfaceAverageSlope);}\n#endif\n")},31298:(e,t,n)=>{n.r(t),n.d(t,{fluidRenderingStandardBlurPixelShader:()=>a});var r=n(98519),i="fluidRenderingStandardBlurPixelShader",o="uniform sampler2D textureSampler;uniform int filterSize;uniform vec2 blurDir;varying vec2 vUV;void main(void) {vec4 s=textureLod(textureSampler,vUV,0.);if (s.r==0.) {glFragColor=vec4(0.,0.,0.,1.);return;}\nfloat sigma=float(filterSize)/3.0;float twoSigma2=2.0*sigma*sigma;vec4 sum=vec4(0.);float wsum=0.;for (int x=-filterSize; x<=filterSize; ++x) {vec2 coords=vec2(x);vec4 sampl=textureLod(textureSampler,vUV+coords*blurDir,0.);float w=exp(-coords.x*coords.x/twoSigma2);sum+=sampl*w;wsum+=w;}\nsum/=wsum;glFragColor=vec4(sum.rgb,1.);}\n";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},31321:(e,t,n)=>{var r=n(98519),i="hdrFilteringFunctions";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="#ifdef NUM_SAMPLES\n#if NUM_SAMPLES>0\nfn radicalInverse_VdC(value: u32)->f32 \n{var bits=(value<<16u) | (value>>16u);bits=((bits & 0x55555555u)<<1u) | ((bits & 0xAAAAAAAAu)>>1u);bits=((bits & 0x33333333u)<<2u) | ((bits & 0xCCCCCCCCu)>>2u);bits=((bits & 0x0F0F0F0Fu)<<4u) | ((bits & 0xF0F0F0F0u)>>4u);bits=((bits & 0x00FF00FFu)<<8u) | ((bits & 0xFF00FF00u)>>8u);return f32(bits)*2.3283064365386963e-10; }\nfn hammersley(i: u32,N: u32)->vec2f\n{return vec2f( f32(i)/ f32(N),radicalInverse_VdC(i));}\nfn log4(x: f32)->f32 {return log2(x)/2.;}\nfn uv_to_normal(uv: vec2f)->vec3f {var N: vec3f;var uvRange: vec2f=uv;var theta: f32=uvRange.x*2.0*PI;var phi: f32=uvRange.y*PI;N.x=cos(theta)*sin(phi);N.z=sin(theta)*sin(phi);N.y=cos(phi);return N;}\nconst NUM_SAMPLES_FLOAT: f32= f32(NUM_SAMPLES);const NUM_SAMPLES_FLOAT_INVERSED: f32=1./NUM_SAMPLES_FLOAT;const K: f32=4.;fn irradiance(\n#ifdef CUSTOM_IRRADIANCE_FILTERING_INPUT\nCUSTOM_IRRADIANCE_FILTERING_INPUT\n#else\ninputTexture: texture_cube,inputSampler: sampler,\n#endif\ninputN: vec3f,\nfilteringInfo: vec2f,\ndiffuseRoughness: f32,\nsurfaceAlbedo: vec3f,\ninputV: vec3f\n#ifdef IBL_CDF_FILTERING\n,icdfSampler: texture_2d,icdfSamplerSampler: sampler\n#endif\n)->vec3f\n{var n: vec3f=normalize(inputN);var result: vec3f= vec3f(0.0);\n#ifndef IBL_CDF_FILTERING\nvar tangent: vec3f=select(vec3f(1.,0.,0.),vec3f(0.,0.,1.),abs(n.z)<0.999);tangent=normalize(cross(tangent,n));var bitangent: vec3f=cross(n,tangent);var tbn: mat3x3f= mat3x3f(tangent,bitangent,n);var tbnInverse: mat3x3f=transpose(tbn);\n#endif\nvar maxLevel: f32=filteringInfo.y;var dim0: f32=filteringInfo.x;var omegaP: f32=(4.*PI)/(6.*dim0*dim0);var clampedAlbedo: vec3f=clamp(surfaceAlbedo,vec3f(0.1),vec3f(1.0));for(var i: u32=0u; i0.) {\n#ifdef IBL_CDF_FILTERING\nvar pdf: f32=textureSampleLevel(icdfSampler,icdfSamplerSampler,T,0.0).z;var c: vec3f=textureSampleLevel(inputTexture,inputSampler,Ls,0.0).rgb;\n#else\nvar pdf_inversed: f32=PI/NoL;var omegaS: f32=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;var l: f32=log4(omegaS)-log4(omegaP)+log4(K);var mipLevel: f32=clamp(l,0.0,maxLevel);\n#ifdef CUSTOM_IRRADIANCE_FILTERING_FUNCTION\nCUSTOM_IRRADIANCE_FILTERING_FUNCTION\n#else\nvar c: vec3f=textureSampleLevel(inputTexture,inputSampler,tbn*Ls,mipLevel).rgb;\n#endif\n#endif\n#ifdef GAMMA_INPUT\nc=toLinearSpaceVec3(c);\n#endif\nvar diffuseRoughnessTerm: vec3f=vec3f(1.0);\n#if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON\ndiffuseRoughnessTerm=diffuseBRDF_EON(clampedAlbedo,diffuseRoughness,NoL,NoV,LoV)*PI;\n#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY\ndiffuseRoughnessTerm=vec3f(diffuseBRDF_Burley(NoL,NoV,VoH,diffuseRoughness)*PI);\n#endif\n#ifdef IBL_CDF_FILTERING\nvar light: vec3f=vec3f(0.0);if (pdf>1e-6) {light=vec3f(1.0)/vec3f(pdf)*c;}\nresult+=NoL*diffuseRoughnessTerm*light;\n#else\nresult+=c*diffuseRoughnessTerm;\n#endif\n}}\nresult=result*NUM_SAMPLES_FLOAT_INVERSED;\n#if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON\nresult=result/clampedAlbedo;\n#endif\nreturn result;}\nfn radiance(alphaG: f32,inputTexture: texture_cube,inputSampler: sampler,inputN: vec3f,filteringInfo: vec2f)->vec3f\n{var n: vec3f=normalize(inputN);var c: vec3f=textureSample(inputTexture,inputSampler,n).rgb; \nif (alphaG==0.) {\n#ifdef GAMMA_INPUT\nc=toLinearSpace(c);\n#endif\nreturn c;} else {var result: vec3f= vec3f(0.);var tangent: vec3f=select(vec3f(1.,0.,0.),vec3f(0.,0.,1.),abs(n.z)<0.999);tangent=normalize(cross(tangent,n));var bitangent: vec3f=cross(n,tangent);var tbn: mat3x3f= mat3x3f(tangent,bitangent,n);var maxLevel: f32=filteringInfo.y;var dim0: f32=filteringInfo.x;var omegaP: f32=(4.*PI)/(6.*dim0*dim0);var weight: f32=0.;for(var i: u32=0u; i0.) {var pdf_inversed: f32=4./normalDistributionFunction_TrowbridgeReitzGGX(NoH,alphaG);var omegaS: f32=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;var l: f32=log4(omegaS)-log4(omegaP)+log4(K);var mipLevel: f32=clamp( f32(l),0.0,maxLevel);weight+=NoL;var c: vec3f=textureSampleLevel(inputTexture,inputSampler,tbn*L,mipLevel).rgb;\n#ifdef GAMMA_INPUT\nc=toLinearSpace(c);\n#endif\nresult+=c*NoL;}}\nresult=result/weight;return result;}}\n#ifdef ANISOTROPIC\nfn radianceAnisotropic(\nalphaTangent: f32, \nalphaBitangent: f32, \ninputTexture: texture_cube,\ninputSampler: sampler,\ninputView: vec3f, \ninputTangent: vec3f, \ninputBitangent: vec3f, \ninputNormal: vec3f, \nfilteringInfo: vec2f,\nnoiseInput: vec2f \n)->vec3f {var V: vec3f=inputView;var N: vec3f=inputNormal;var T: vec3f=inputTangent;var B: vec3f=inputBitangent;var R: vec3f=reflect(-V,N);var c: vec3f=textureSample(inputTexture,inputSampler,R).rgb;if (alphaTangent==0.f && alphaBitangent==0.f) {\n#if GAMMA_INPUT\nc=toLinearSpace(c);\n#endif\nreturn c;}\nvar result: vec3f=vec3f(0.f);var maxLevel: f32=filteringInfo.y;var dim0: f32=filteringInfo.x;var effectiveDim: f32=dim0*sqrt(alphaTangent*alphaBitangent);var omegaP: f32=(4.f*PI)/(6.f*effectiveDim*effectiveDim);let noiseScale: f32=clamp(log2(f32(NUM_SAMPLES))/12.0f,0.0f,1.0f);var weight: f32=0.f;for(var i: u32=0u; i0.f) {var pdf_inversed: f32=4./normalDistributionFunction_BurleyGGX_Anisotropic(\nH_tangent.z,H_tangent.x,H_tangent.y,vec2(alphaTangent,alphaBitangent)\n);var omegaS: f32=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;var l: f32=log4(omegaS)-log4(omegaP)+log4(K);var mipLevel: f32=clamp(l,0.0f,maxLevel);weight+=NoL;var c: vec3f=textureSampleLevel(inputTexture,inputSampler,L,mipLevel).rgb;\n#if GAMMA_INPUT\nc=toLinearSpace(c);\n#endif\nresult+=c*NoL;}}\nresult=result/weight;return result;}\n#endif\n#endif\n#endif\n")},31342:(e,t,n)=>{n.r(t),n.d(t,{colorCorrectionPixelShaderWGSL:()=>a});var r=n(98519),i="colorCorrectionPixelShader",o="varying vUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d;varying vUV: vec2f;var colorTableSampler: sampler;var colorTable: texture_2d;const SLICE_COUNT: f32=16.0; \nfn sampleAs3DTexture(uv: vec3f,width: f32)->vec4f {var sliceSize: f32=1.0/width; \nvar slicePixelSize: f32=sliceSize/width; \nvar sliceInnerSize: f32=slicePixelSize*(width-1.0); \nvar zSlice0: f32=min(floor(uv.z*width),width-1.0);var zSlice1: f32=min(zSlice0+1.0,width-1.0);var xOffset: f32=slicePixelSize*0.5+uv.x*sliceInnerSize;var s0: f32=xOffset+(zSlice0*sliceSize);var s1: f32=xOffset+(zSlice1*sliceSize);var slice0Color: vec4f=textureSample(colorTable,colorTableSampler,vec2f(s0,uv.y));var slice1Color: vec4f=textureSample(colorTable,colorTableSampler,vec2f(s1,uv.y));var zOffset: f32=((uv.z*width)%(1.0));return mix(slice0Color,slice1Color,zOffset);}\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var screen_color: vec4f=textureSample(textureSampler,textureSamplerSampler,input.vUV);fragmentOutputs.color=sampleAs3DTexture(screen_color.rgb,SLICE_COUNT);}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},31489:(e,t,n)=>{n.d(t,{j:()=>h});var r=n(78322),i=n(30622),o=n(50582),a=n(81152),s=n(34623),l=n(6174),c=n(12028),u=n(44228),h=function(e){function t(t,n,i,s,l,c,h,d,p,f,m,_){void 0===l&&(l=null),void 0===c&&(c=o.g.BILINEAR_SAMPLINGMODE),void 0===p&&(p=a.Y.TEXTURETYPE_UNSIGNED_BYTE),void 0===f&&(f=""),void 0===m&&(m=!1),void 0===_&&(_=a.Y.TEXTUREFORMAT_RGBA);var g=this,v="number"==typeof s?m:!!s.blockCompilation,y=(0,r.Cl)((0,r.Cl)({uniforms:u.q.Uniforms,samplers:u.q.Samplers,size:"number"==typeof s?s:void 0,camera:l,samplingMode:c,engine:h,reusable:d,textureType:p,vertexUrl:u.q.VertexUrl,indexParameters:{varyingCount:0,depCount:0},textureFormat:_,defines:f},s),{blockCompilation:!0});return(g=e.call(this,t,u.q.FragmentUrl,(0,r.Cl)({effectWrapper:"number"!=typeof s&&s.effectWrapper?void 0:new u.q(t,h,void 0,void 0,y)},y))||this)._effectWrapper.options.blockCompilation=v,g.direction=n,g.onApplyObservable.add((function(){g._effectWrapper.textureWidth=g._outputTexture?g._outputTexture.width:g.width,g._effectWrapper.textureHeight=g._outputTexture?g._outputTexture.height:g.height})),g.kernel=i,g}return(0,r.C6)(t,e),Object.defineProperty(t.prototype,"direction",{get:function(){return this._effectWrapper.direction},set:function(e){this._effectWrapper.direction=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"kernel",{get:function(){return this._effectWrapper.kernel},set:function(e){this._effectWrapper.kernel=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"packedFloat",{get:function(){return this._effectWrapper.packedFloat},set:function(e){this._effectWrapper.packedFloat=e},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"BlurPostProcess"},t.prototype.updateEffect=function(e,t,n,r,i,o){void 0===e&&(e=null),void 0===t&&(t=null),void 0===n&&(n=null),this._effectWrapper._updateParameters(i,o)},t._Parse=function(e,n,r,i){return c.p.Parse((function(){return new t(e.name,e.direction,e.kernel,e.options,n,e.renderTargetSamplingMode,r.getEngine(),e.reusable,e.textureType,void 0,!1)}),e,r,i)},(0,r.Cg)([(0,l.WM)()],t.prototype,"direction",null),(0,r.Cg)([(0,l.lK)()],t.prototype,"kernel",null),(0,r.Cg)([(0,l.lK)()],t.prototype,"packedFloat",null),t}(i.w);(0,s.Y5)("BABYLON.BlurPostProcess",h)},31802:(e,t,n)=>{n.d(t,{H:()=>o,r:()=>r});var r,i=n(7164);!function(e){e.ExecuteBlock="ExecuteBlock",e.ExecuteEvent="ExecuteEvent",e.TriggerConnection="TriggerConnection",e.ContextVariableSet="ContextVariableSet",e.GlobalVariableSet="GlobalVariableSet",e.GlobalVariableDelete="GlobalVariableDelete",e.GlobalVariableGet="GlobalVariableGet",e.AddConnection="AddConnection",e.GetConnectionValue="GetConnectionValue",e.SetConnectionValue="SetConnectionValue",e.ActivateSignal="ActivateSignal",e.ContextVariableGet="ContextVariableGet"}(r||(r={}));var o=function(){function e(){this.logToConsole=!1,this.log=[]}return e.prototype.addLogItem=function(e){var t;if(e.time||(e.time=Date.now()),this.log.push(e),this.logToConsole){var n=null===(t=e.payload)||void 0===t?void 0:t.value;"object"==typeof n&&n.getClassName?i.V.Log("[FGLog] ".concat(e.className,":").concat(e.uniqueId.split("-")[0]," ").concat(e.action," - ").concat(JSON.stringify(n.getClassName()),": ").concat(n.toString())):i.V.Log("[FGLog] ".concat(e.className,":").concat(e.uniqueId.split("-")[0]," ").concat(e.action," - ").concat(JSON.stringify(e.payload)))}},e.prototype.getItemsOfType=function(e){return this.log.filter((function(t){return t.action===e}))},e}()},31984:(e,t,n)=>{n.r(t),n.d(t,{iblShadowSpatialBlurPixelShader:()=>a});var r=n(98519),i="iblShadowSpatialBlurPixelShader",o="precision highp sampler2D;\n#define PI 3.1415927\nvarying vec2 vUV;uniform sampler2D depthSampler;uniform sampler2D worldNormalSampler;uniform sampler2D voxelTracingSampler;uniform vec4 blurParameters;\n#define stridef blurParameters.x\n#define worldScale blurParameters.y\nconst float weights[5]=float[5](0.0625,0.25,0.375,0.25,0.0625);const int nbWeights=5;vec2 max2(vec2 v,vec2 w) {return vec2(max(v.x,w.x),max(v.y,w.y));}\nvoid main(void)\n{vec2 gbufferRes=vec2(textureSize(depthSampler,0));ivec2 gbufferPixelCoord=ivec2(vUV*gbufferRes);vec2 shadowRes=vec2(textureSize(voxelTracingSampler,0));ivec2 shadowPixelCoord=ivec2(vUV*shadowRes);vec3 N=texelFetch(worldNormalSampler,gbufferPixelCoord,0).xyz;if (length(N)<0.01) {glFragColor=vec4(1.0,1.0,0.0,1.0);return;}\nfloat depth=-texelFetch(depthSampler,gbufferPixelCoord,0).x;vec4 X=vec4(0.0);for(int y=0; y>1),y-(nbWeights>>1));ivec2 shadowCoords=shadowPixelCoord+int(stridef)*ivec2(x-(nbWeights>>1),y-(nbWeights>>1));vec4 T=texelFetch(voxelTracingSampler,shadowCoords,0);float ddepth=-texelFetch(depthSampler,gBufferCoords,0).x-depth;vec3 dN=texelFetch(worldNormalSampler,gBufferCoords,0).xyz-N;float w=weights[x]*weights[y] *\nexp2(max(-1000.0/(worldScale*worldScale),-0.5) *\n(ddepth*ddepth) -\n1e1*dot(dN,dN));X+=vec4(w*T.x,w*T.y,w*T.z,w);}}\ngl_FragColor=vec4(X.x/X.w,X.y/X.w,X.z/X.w,1.0);}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},31985:(e,t,n)=>{n.d(t,{Y:()=>i});var r=n(92548),i=function(){function e(){}return e.EnableFor=function(t){t._tags=t._tags||{},t.hasTags=function(){return e.HasTags(t)},t.addTags=function(n){return e.AddTagsTo(t,n)},t.removeTags=function(n){return e.RemoveTagsFrom(t,n)},t.matchesTagsQuery=function(n){return e.MatchesQuery(t,n)}},e.DisableFor=function(e){delete e._tags,delete e.hasTags,delete e.addTags,delete e.removeTags,delete e.matchesTagsQuery},e.HasTags=function(e){if(!e._tags)return!1;var t=e._tags;for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n))return!0;return!1},e.GetTags=function(e,t){if(void 0===t&&(t=!0),!e._tags)return null;if(t){var n=[];for(var r in e._tags)Object.prototype.hasOwnProperty.call(e._tags,r)&&!0===e._tags[r]&&n.push(r);return n.join(" ")}return e._tags},e.AddTagsTo=function(t,n){if(n&&"string"==typeof n)for(var r=0,i=n.split(" ");r{n.d(t,{Y:()=>u});var r=n(78322),i=n(6174),o=n(23885),a=n(38810),s=n(66377),l=n(10252),c=n(31802),u=function(){function e(e){var t;this.uniqueId=(0,o.z)(),this._userVariables={},this._executionVariables={},this._globalContextVariables={},this._connectionValues={},this._pendingBlocks=[],this._executionId=0,this.onNodeExecutedObservable=new s.cP,this.treatDataAsRightHanded=!1,this._enableLogging=!1,this._configuration=e,this.assetsContext=null!==(t=e.assetsContext)&&void 0!==t?t:e.scene}return Object.defineProperty(e.prototype,"enableLogging",{get:function(){return this._enableLogging},set:function(e){this._enableLogging!==e&&(this._enableLogging=e,this._enableLogging?(this.logger=new c.H,this.logger.logToConsole=!0):this.logger=null)},enumerable:!1,configurable:!0}),e.prototype.hasVariable=function(e){return e in this._userVariables},e.prototype.setVariable=function(e,t){var n;this._userVariables[e]=t,null===(n=this.logger)||void 0===n||n.addLogItem({time:Date.now(),className:this.getClassName(),uniqueId:this.uniqueId,action:"ContextVariableSet",payload:{name:e,value:t}})},e.prototype.getAsset=function(e,t){return(0,l.N)(this.assetsContext,e,t)},e.prototype.getVariable=function(e){var t;return null===(t=this.logger)||void 0===t||t.addLogItem({time:Date.now(),className:this.getClassName(),uniqueId:this.uniqueId,action:"ContextVariableGet",payload:{name:e,value:this._userVariables[e]}}),this._userVariables[e]},Object.defineProperty(e.prototype,"userVariables",{get:function(){return this._userVariables},enumerable:!1,configurable:!0}),e.prototype.getScene=function(){return this._configuration.scene},e.prototype._getUniqueIdPrefixedName=function(e,t){return"".concat(e.uniqueId,"_").concat(t)},e.prototype._getGlobalContextVariable=function(e,t){var n;return null===(n=this.logger)||void 0===n||n.addLogItem({time:Date.now(),className:this.getClassName(),uniqueId:this.uniqueId,action:"GlobalVariableGet",payload:{name:e,defaultValue:t,possibleValue:this._globalContextVariables[e]}}),this._hasGlobalContextVariable(e)?this._globalContextVariables[e]:t},e.prototype._setGlobalContextVariable=function(e,t){var n;null===(n=this.logger)||void 0===n||n.addLogItem({time:Date.now(),className:this.getClassName(),uniqueId:this.uniqueId,action:"GlobalVariableSet",payload:{name:e,value:t}}),this._globalContextVariables[e]=t},e.prototype._deleteGlobalContextVariable=function(e){var t;null===(t=this.logger)||void 0===t||t.addLogItem({time:Date.now(),className:this.getClassName(),uniqueId:this.uniqueId,action:"GlobalVariableDelete",payload:{name:e}}),delete this._globalContextVariables[e]},e.prototype._hasGlobalContextVariable=function(e){return e in this._globalContextVariables},e.prototype._setExecutionVariable=function(e,t,n){this._executionVariables[this._getUniqueIdPrefixedName(e,t)]=n},e.prototype._getExecutionVariable=function(e,t,n){return this._hasExecutionVariable(e,t)?this._executionVariables[this._getUniqueIdPrefixedName(e,t)]:n},e.prototype._deleteExecutionVariable=function(e,t){delete this._executionVariables[this._getUniqueIdPrefixedName(e,t)]},e.prototype._hasExecutionVariable=function(e,t){return this._getUniqueIdPrefixedName(e,t)in this._executionVariables},e.prototype._hasConnectionValue=function(e){return e.uniqueId in this._connectionValues},e.prototype._setConnectionValue=function(e,t){var n;this._connectionValues[e.uniqueId]=t,null===(n=this.logger)||void 0===n||n.addLogItem({time:Date.now(),className:this.getClassName(),uniqueId:this.uniqueId,action:"SetConnectionValue",payload:{connectionPointId:e.uniqueId,value:t}})},e.prototype._setConnectionValueByKey=function(e,t){this._connectionValues[e]=t},e.prototype._getConnectionValue=function(e){var t;return null===(t=this.logger)||void 0===t||t.addLogItem({time:Date.now(),className:this.getClassName(),uniqueId:this.uniqueId,action:"GetConnectionValue",payload:{connectionPointId:e.uniqueId,value:this._connectionValues[e.uniqueId]}}),this._connectionValues[e.uniqueId]},Object.defineProperty(e.prototype,"configuration",{get:function(){return this._configuration},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasPendingBlocks",{get:function(){return this._pendingBlocks.length>0},enumerable:!1,configurable:!0}),e.prototype._addPendingBlock=function(e){this._pendingBlocks.includes(e)||(this._pendingBlocks.push(e),this._pendingBlocks.sort((function(e,t){return e.priority-t.priority})))},e.prototype._removePendingBlock=function(e){var t=this._pendingBlocks.indexOf(e);-1!==t&&this._pendingBlocks.splice(t,1)},e.prototype._clearPendingBlocks=function(){for(var e=0,t=this._pendingBlocks;e{n.r(t),n.d(t,{openpbrVertexShader:()=>c});var r=n(98519),i=(n(42858),"openpbrVertexDeclaration");r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="uniform mat4 view;uniform mat4 viewProjection;uniform vec4 vEyePosition;\n#ifdef MULTIVIEW\nmat4 viewProjectionR;\n#endif\n#ifdef BASE_COLOR\nuniform vec2 vBaseColorInfos;uniform mat4 baseColorMatrix;\n#endif\n#ifdef BASE_WEIGHT\nuniform mat4 baseWeightMatrix;uniform vec2 vBaseWeightInfos;\n#endif\nuniform float vBaseDiffuseRoughness;\n#ifdef BASE_DIFFUSE_ROUGHNESS\nuniform mat4 baseDiffuseRoughnessMatrix;uniform vec2 vBaseDiffuseRoughnessInfos;\n#endif\n#ifdef AMBIENT_OCCLUSION\nuniform vec2 vAmbientOcclusionInfos;uniform mat4 ambientOcclusionMatrix;\n#endif\n#ifdef EMISSION_COLOR\nuniform vec2 vEmissionColorInfos;uniform mat4 emissionColorMatrix;\n#endif\n#ifdef LIGHTMAP\nuniform vec2 vLightmapInfos;uniform mat4 lightmapMatrix;\n#endif\n#ifdef BASE_METALNESS\nuniform vec2 vBaseMetalnessInfos;uniform mat4 baseMetalnessMatrix;\n#endif\n#ifdef SPECULAR_WEIGHT\nuniform vec2 vSpecularWeightInfos;uniform mat4 specularWeightMatrix;\n#endif\n#ifdef SPECULAR_COLOR\nuniform vec2 vSpecularColorInfos;uniform mat4 specularColorMatrix;\n#endif\n#ifdef SPECULAR_ROUGHNESS\nuniform vec2 vSpecularRoughnessInfos;uniform mat4 specularRoughnessMatrix;\n#endif\n#ifdef SPECULAR_ROUGHNESS_ANISOTROPY\nuniform vec2 vSpecularRoughnessAnisotropyInfos;uniform mat4 specularRoughnessAnisotropyMatrix;\n#endif\n#ifdef COAT_WEIGHT\nuniform vec2 vCoatWeightInfos;uniform mat4 coatWeightMatrix;\n#endif\n#ifdef COAT_COLOR\nuniform vec2 vCoatColorInfos;uniform mat4 coatColorMatrix;\n#endif\n#ifdef COAT_ROUGHNESS\nuniform vec2 vCoatRoughnessInfos;uniform mat4 coatRoughnessMatrix;\n#endif\n#ifdef COAT_ROUGHNESS_ANISOTROPY\nuniform vec2 vCoatRoughnessAnisotropyInfos;uniform mat4 coatRoughnessAnisotropyMatrix;\n#endif\n#ifdef COAT_IOR\nuniform vec2 vCoatIorInfos;uniform mat4 coatIorMatrix;\n#endif\n#ifdef COAT_DARKENING\nuniform vec2 vCoatDarkeningInfos;uniform mat4 coatDarkeningMatrix;\n#endif\n#ifdef FUZZ_WEIGHT\nuniform vec2 vFuzzWeightInfos;uniform mat4 fuzzWeightMatrix;\n#endif\n#ifdef FUZZ_COLOR\nuniform vec2 vFuzzColorInfos;uniform mat4 fuzzColorMatrix;\n#endif\n#ifdef FUZZ_ROUGHNESS\nuniform vec2 vFuzzRoughnessInfos;uniform mat4 fuzzRoughnessMatrix;\n#endif\n#ifdef GEOMETRY_NORMAL\nuniform vec2 vGeometryNormalInfos;uniform mat4 geometryNormalMatrix;\n#endif\n#ifdef GEOMETRY_TANGENT\nuniform vec2 vGeometryTangentInfos;uniform mat4 geometryTangentMatrix;\n#endif\n#ifdef GEOMETRY_COAT_NORMAL\nuniform vec2 vGeometryCoatNormalInfos;uniform mat4 geometryCoatNormalMatrix;\n#endif\n#ifdef THIN_FILM_WEIGHT\nuniform vec2 vThinFilmWeightInfos;uniform mat4 thinFilmWeightMatrix;\n#endif\n#ifdef THIN_FILM_THICKNESS\nuniform vec2 vThinFilmThicknessInfos;uniform mat4 thinFilmThicknessMatrix;\n#endif\n#ifdef GEOMETRY_OPACITY\nuniform mat4 geometryOpacityMatrix;uniform vec2 vGeometryOpacityInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nuniform vec4 cameraInfo;\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;uniform mat4 reflectionMatrix;\n#endif\n#ifdef NORMAL\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\n#ifdef USESPHERICALFROMREFLECTIONMAP\n#ifdef SPHERICAL_HARMONICS\nuniform vec3 vSphericalL00;uniform vec3 vSphericalL1_1;uniform vec3 vSphericalL10;uniform vec3 vSphericalL11;uniform vec3 vSphericalL2_2;uniform vec3 vSphericalL2_1;uniform vec3 vSphericalL20;uniform vec3 vSphericalL21;uniform vec3 vSphericalL22;\n#else\nuniform vec3 vSphericalX;uniform vec3 vSphericalY;uniform vec3 vSphericalZ;uniform vec3 vSphericalXX_ZZ;uniform vec3 vSphericalYY_ZZ;uniform vec3 vSphericalZZ;uniform vec3 vSphericalXY;uniform vec3 vSphericalYZ;uniform vec3 vSphericalZX;\n#endif\n#endif\n#endif\n#endif\n#ifdef DETAIL\nuniform vec4 vDetailInfos;uniform mat4 detailMatrix;\n#endif\n#include\n#define ADDITIONAL_VERTEX_DECLARATION\n"),n(50163),n(77976),n(48493),n(75334),n(64244),n(36470),n(64400),n(38615),n(60965),n(60581),n(92518);var o="openpbrNormalMapVertexDeclaration";r.l.IncludesShadersStore[o]||(r.l.IncludesShadersStore[o]="#if defined(GEOMETRY_NORMAL) || defined(PARALLAX) || defined(GEOMETRY_COAT_NORMAL) || defined(ANISOTROPIC) || defined(FUZZ)\n#if defined(TANGENT) && defined(NORMAL) \nvarying mat3 vTBN;\n#endif\n#endif\n"),n(85637),n(72153),n(94785),n(48961),n(24444),n(67369),n(59262),n(58266),n(84589),n(35397),n(76898),n(49334),n(7761),n(45858),n(81067);var a="openpbrNormalMapVertex";r.l.IncludesShadersStore[a]||(r.l.IncludesShadersStore[a]="#if defined(GEOMETRY_NORMAL) || defined(PARALLAX) || defined(GEOMETRY_COAT_NORMAL) || defined(ANISOTROPIC) || defined(FUZZ)\n#if defined(TANGENT) && defined(NORMAL)\nvec3 tbnNormal=normalize(normalUpdated);vec3 tbnTangent=normalize(tangentUpdated.xyz);vec3 tbnBitangent=cross(tbnNormal,tbnTangent)*tangentUpdated.w;vTBN=mat3(finalWorld)*mat3(tbnTangent,tbnBitangent,tbnNormal);\n#endif\n#endif\n"),n(83057),n(62589),n(62136),n(45812),n(56458);var s="openpbrVertexShader",l="#define OPENPBR_VERTEX_SHADER\n#define CUSTOM_VERTEX_EXTENSION\nprecision highp float;\n#include<__decl__openpbrVertex>\n#define CUSTOM_VERTEX_BEGIN\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef TANGENT\nattribute vec4 tangent;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#include[2..7]\n#include[1..7]\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include\n#include\n#include\n#include\n#include\n#include\n#include(_DEFINENAME_,BASE_COLOR,_VARYINGNAME_,BaseColor)\n#include(_DEFINENAME_,BASE_WEIGHT,_VARYINGNAME_,BaseWeight)\n#include(_DEFINENAME_,BASE_DIFFUSE_ROUGHNESS,_VARYINGNAME_,BaseDiffuseRoughness)\n#include(_DEFINENAME_,BASE_METALNESS,_VARYINGNAME_,BaseMetalness)\n#include(_DEFINENAME_,SPECULAR_WEIGHT,_VARYINGNAME_,SpecularWeight)\n#include(_DEFINENAME_,SPECULAR_COLOR,_VARYINGNAME_,SpecularColor)\n#include(_DEFINENAME_,SPECULAR_ROUGHNESS,_VARYINGNAME_,SpecularRoughness)\n#include(_DEFINENAME_,SPECULAR_ROUGHNESS_ANISOTROPY,_VARYINGNAME_,SpecularRoughnessAnisotropy)\n#include(_DEFINENAME_,COAT_WEIGHT,_VARYINGNAME_,CoatWeight)\n#include(_DEFINENAME_,COAT_COLOR,_VARYINGNAME_,CoatColor)\n#include(_DEFINENAME_,COAT_ROUGHNESS,_VARYINGNAME_,CoatRoughness)\n#include(_DEFINENAME_,COAT_ROUGHNESS_ANISOTROPY,_VARYINGNAME_,CoatRoughnessAnisotropy)\n#include(_DEFINENAME_,COAT_DARKENING,_VARYINGNAME_,CoatDarkening)\n#include(_DEFINENAME_,FUZZ_WEIGHT,_VARYINGNAME_,FuzzWeight)\n#include(_DEFINENAME_,FUZZ_COLOR,_VARYINGNAME_,FuzzColor)\n#include(_DEFINENAME_,FUZZ_ROUGHNESS,_VARYINGNAME_,FuzzRoughness)\n#include(_DEFINENAME_,GEOMETRY_NORMAL,_VARYINGNAME_,GeometryNormal)\n#include(_DEFINENAME_,GEOMETRY_TANGENT,_VARYINGNAME_,GeometryTangent)\n#include(_DEFINENAME_,GEOMETRY_COAT_NORMAL,_VARYINGNAME_,GeometryCoatNormal)\n#include(_DEFINENAME_,GEOMETRY_OPACITY,_VARYINGNAME_,GeometryOpacity)\n#include(_DEFINENAME_,EMISSION_COLOR,_VARYINGNAME_,EmissionColor)\n#include(_DEFINENAME_,THIN_FILM_WEIGHT,_VARYINGNAME_,ThinFilmWeight)\n#include(_DEFINENAME_,THIN_FILM_THICKNESS,_VARYINGNAME_,ThinFilmThickness)\n#include(_DEFINENAME_,AMBIENT_OCCLUSION,_VARYINGNAME_,AmbientOcclusion)\n#include(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal)\n#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail)\nvarying vec3 vPositionW;\n#if DEBUGMODE>0\nvarying vec4 vClipSpacePosition;\n#endif\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\nvarying vec3 vEnvironmentIrradiance;\n#include\n#endif\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#include\n#include\n#include\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\n#include\n#include[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#include\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvec3 positionUpdated=position;\n#ifdef NORMAL\nvec3 normalUpdated=normal;\n#endif\n#ifdef TANGENT\nvec4 tangentUpdated=tangent;\n#endif\n#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#ifdef UV2\nvec2 uv2Updated=uv2;\n#endif\n#ifdef VERTEXCOLOR\nvec4 colorUpdated=color;\n#endif\n#include\n#include[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\nvPositionUVW=positionUpdated;\n#endif\n#define CUSTOM_VERTEX_UPDATE_POSITION\n#define CUSTOM_VERTEX_UPDATE_NORMAL\n#include\n#if defined(PREPASS) && ((defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR)) && !defined(BONES_VELOCITY_ENABLED)\nvCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);vPreviousPosition=previousViewProjection*finalPreviousWorld*vec4(positionUpdated,1.0);\n#endif\n#include\n#include\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);vPositionW=vec3(worldPos);\n#ifdef PREPASS\n#include\n#endif\n#ifdef NORMAL\nmat3 normalWorld=mat3(finalWorld);\n#if defined(INSTANCES) && defined(THIN_INSTANCES)\nvNormalW=normalUpdated/vec3(dot(normalWorld[0],normalWorld[0]),dot(normalWorld[1],normalWorld[1]),dot(normalWorld[2],normalWorld[2]));vNormalW=normalize(normalWorld*vNormalW);\n#else\n#ifdef NONUNIFORMSCALING\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\n#endif\nvNormalW=normalize(normalWorld*normalUpdated);\n#endif\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\n#if BASE_DIFFUSE_MODEL != BRDF_DIFFUSE_MODEL_LAMBERT && BASE_DIFFUSE_MODEL != BRDF_DIFFUSE_MODEL_LEGACY\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\n#if !defined(NATIVE) && !defined(WEBGPU)\nbool bbb=any(isnan(position));if (bbb) { }\n#endif\nfloat NdotV=max(dot(vNormalW,viewDirectionW),0.0);vec3 roughNormal=mix(vNormalW,viewDirectionW,(0.5*(1.0-NdotV))*vBaseDiffuseRoughness);vec3 reflectionVector=vec3(reflectionMatrix*vec4(roughNormal,0)).xyz;\n#else\nvec3 reflectionVector=vec3(reflectionMatrix*vec4(vNormalW,0)).xyz;\n#endif\n#ifdef REFLECTIONMAP_OPPOSITEZ\nreflectionVector.z*=-1.0;\n#endif\nvEnvironmentIrradiance=computeEnvironmentIrradiance(reflectionVector);\n#endif\n#endif\n#define CUSTOM_VERTEX_UPDATE_WORLDPOS\n#ifdef MULTIVIEW\nif (gl_ViewID_OVR==0u) {gl_Position=viewProjection*worldPos;} else {gl_Position=viewProjectionR*worldPos;}\n#else\ngl_Position=viewProjection*worldPos;\n#endif\n#if DEBUGMODE>0\nvClipSpacePosition=gl_Position;\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvDirectionW=normalize(vec3(finalWorld*vec4(positionUpdated,0.0)));\n#endif\n#ifndef UV1\nvec2 uvUpdated=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2Updated=vec2(0.,0.);\n#endif\n#ifdef MAINUV1\nvMainUV1=uvUpdated;\n#endif\n#ifdef MAINUV2\nvMainUV2=uv2Updated;\n#endif\n#include[3..7]\n#include(_DEFINENAME_,BASE_COLOR,_VARYINGNAME_,BaseColor,_MATRIXNAME_,baseColor,_INFONAME_,BaseColorInfos.x)\n#include(_DEFINENAME_,BASE_WEIGHT,_VARYINGNAME_,BaseWeight,_MATRIXNAME_,baseWeight,_INFONAME_,BaseWeightInfos.x)\n#include(_DEFINENAME_,BASE_DIFFUSE_ROUGHNESS,_VARYINGNAME_,BaseDiffuseRoughness,_MATRIXNAME_,baseDiffuseRoughness,_INFONAME_,BaseDiffuseRoughnessInfos.x)\n#include(_DEFINENAME_,BASE_METALNESS,_VARYINGNAME_,BaseMetalness,_MATRIXNAME_,baseMetalness,_INFONAME_,BaseMetalnessInfos.x)\n#include(_DEFINENAME_,SPECULAR_WEIGHT,_VARYINGNAME_,SpecularWeight,_MATRIXNAME_,specularWeight,_INFONAME_,SpecularWeightInfos.x)\n#include(_DEFINENAME_,SPECULAR_COLOR,_VARYINGNAME_,SpecularColor,_MATRIXNAME_,specularColor,_INFONAME_,SpecularColorInfos.x)\n#include(_DEFINENAME_,SPECULAR_ROUGHNESS,_VARYINGNAME_,SpecularRoughness,_MATRIXNAME_,specularRoughness,_INFONAME_,SpecularRoughnessInfos.x)\n#include(_DEFINENAME_,SPECULAR_ROUGHNESS_ANISOTROPY,_VARYINGNAME_,SpecularRoughnessAnisotropy,_MATRIXNAME_,specularRoughnessAnisotropy,_INFONAME_,SpecularRoughnessAnisotropyInfos.x)\n#include(_DEFINENAME_,COAT_WEIGHT,_VARYINGNAME_,CoatWeight,_MATRIXNAME_,coatWeight,_INFONAME_,CoatWeightInfos.x)\n#include(_DEFINENAME_,COAT_COLOR,_VARYINGNAME_,CoatColor,_MATRIXNAME_,coatColor,_INFONAME_,CoatColorInfos.x)\n#include(_DEFINENAME_,COAT_ROUGHNESS,_VARYINGNAME_,CoatRoughness,_MATRIXNAME_,coatRoughness,_INFONAME_,CoatRoughnessInfos.x)\n#include(_DEFINENAME_,COAT_ROUGHNESS_ANISOTROPY,_VARYINGNAME_,CoatRoughnessAnisotropy,_MATRIXNAME_,coatRoughnessAnisotropy,_INFONAME_,CoatRoughnessAnisotropyInfos.x)\n#include(_DEFINENAME_,COAT_DARKENING,_VARYINGNAME_,CoatDarkening,_MATRIXNAME_,coatDarkening,_INFONAME_,CoatDarkeningInfos.x)\n#include(_DEFINENAME_,FUZZ_WEIGHT,_VARYINGNAME_,FuzzWeight,_MATRIXNAME_,fuzzWeight,_INFONAME_,FuzzWeightInfos.x)\n#include(_DEFINENAME_,FUZZ_COLOR,_VARYINGNAME_,FuzzColor,_MATRIXNAME_,fuzzColor,_INFONAME_,FuzzColorInfos.x)\n#include(_DEFINENAME_,FUZZ_ROUGHNESS,_VARYINGNAME_,FuzzRoughness,_MATRIXNAME_,fuzzRoughness,_INFONAME_,FuzzRoughnessInfos.x)\n#include(_DEFINENAME_,GEOMETRY_NORMAL,_VARYINGNAME_,GeometryNormal,_MATRIXNAME_,geometryNormal,_INFONAME_,GeometryNormalInfos.x)\n#include(_DEFINENAME_,GEOMETRY_COAT_NORMAL,_VARYINGNAME_,GeometryCoatNormal,_MATRIXNAME_,geometryCoatNormal,_INFONAME_,GeometryCoatNormalInfos.x)\n#include(_DEFINENAME_,GEOMETRY_OPACITY,_VARYINGNAME_,GeometryOpacity,_MATRIXNAME_,geometryOpacity,_INFONAME_,GeometryOpacityInfos.x)\n#include(_DEFINENAME_,GEOMETRY_TANGENT,_VARYINGNAME_,GeometryTangent,_MATRIXNAME_,geometryTangent,_INFONAME_,GeometryTangentInfos.x)\n#include(_DEFINENAME_,EMISSION_COLOR,_VARYINGNAME_,EmissionColor,_MATRIXNAME_,emissionColor,_INFONAME_,EmissionColorInfos.x)\n#include(_DEFINENAME_,THIN_FILM_WEIGHT,_VARYINGNAME_,ThinFilmWeight,_MATRIXNAME_,thinFilmWeight,_INFONAME_,ThinFilmWeightInfos.x)\n#include(_DEFINENAME_,THIN_FILM_THICKNESS,_VARYINGNAME_,ThinFilmThickness,_MATRIXNAME_,thinFilmThickness,_INFONAME_,ThinFilmThicknessInfos.x)\n#include(_DEFINENAME_,AMBIENT_OCCLUSION,_VARYINGNAME_,AmbientOcclusion,_MATRIXNAME_,ambientOcclusion,_INFONAME_,AmbientOcclusionInfos.x)\n#include(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_MATRIXNAME_,decal,_INFONAME_,DecalInfos.x)\n#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail,_MATRIXNAME_,detail,_INFONAME_,DetailInfos.x)\n#include\n#include\n#include\n#include[0..maxSimultaneousLights]\n#include\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#include\n#define CUSTOM_VERTEX_MAIN_END\n}\n";r.l.ShadersStore[s]||(r.l.ShadersStore[s]=l);var c={name:s,shader:l}},32407:(e,t,n)=>{n.r(t),n.d(t,{rgbdDecodePixelShader:()=>a});var r=n(98519),i=(n(75334),"rgbdDecodePixelShader"),o="varying vec2 vUV;uniform sampler2D textureSampler;\n#include\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) \n{gl_FragColor=vec4(fromRGBD(texture2D(textureSampler,vUV)),1.0);}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},32532:(e,t,n)=>{n.r(t),n.d(t,{shadowsFragmentFunctionsWGSL:()=>a});var r=n(98519),i="shadowsFragmentFunctions",o="#ifdef SHADOWS\n#ifndef SHADOWFLOAT\nfn unpack(color: vec4f)->f32\n{const bit_shift: vec4f= vec4f(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(color,bit_shift);}\n#endif\nfn computeFallOff(value: f32,clipSpace: vec2f,frustumEdgeFalloff: f32)->f32\n{var mask: f32=smoothstep(1.0-frustumEdgeFalloff,1.00000012,clamp(dot(clipSpace,clipSpace),0.,1.));return mix(value,1.0,mask);}\nfn computeShadowCube(worldPos: vec3f,lightPosition: vec3f,shadowTexture: texture_cube,shadowSampler: sampler,darkness: f32,depthValues: vec2f)->f32\n{var directionToLight: vec3f=worldPos-lightPosition;var depth: f32=length(directionToLight);depth=(depth+depthValues.x)/(depthValues.y);depth=clamp(depth,0.,1.0);directionToLight=normalize(directionToLight);directionToLight.y=-directionToLight.y;\n#ifndef SHADOWFLOAT\nvar shadow: f32=unpack(textureSample(shadowTexture,shadowSampler,directionToLight));\n#else\nvar shadow: f32=textureSample(shadowTexture,shadowSampler,directionToLight).x;\n#endif\nreturn select(1.0,darkness,depth>shadow);}\nfn computeShadowWithPoissonSamplingCube(worldPos: vec3f,lightPosition: vec3f,shadowTexture: texture_cube,shadowSampler: sampler,mapSize: f32,darkness: f32,depthValues: vec2f)->f32\n{var directionToLight: vec3f=worldPos-lightPosition;var depth: f32=length(directionToLight);depth=(depth+depthValues.x)/(depthValues.y);depth=clamp(depth,0.,1.0);directionToLight=normalize(directionToLight);directionToLight.y=-directionToLight.y;var visibility: f32=1.;var poissonDisk: array;poissonDisk[0]= vec3f(-1.0,1.0,-1.0);poissonDisk[1]= vec3f(1.0,-1.0,-1.0);poissonDisk[2]= vec3f(-1.0,-1.0,-1.0);poissonDisk[3]= vec3f(1.0,-1.0,1.0);\n#ifndef SHADOWFLOAT\nif (unpack(textureSample(shadowTexture,shadowSampler,directionToLight+poissonDisk[0]*mapSize)),shadowSampler: sampler,darkness: f32,depthScale: f32,depthValues: vec2f)->f32\n{var directionToLight: vec3f=worldPos-lightPosition;var depth: f32=length(directionToLight);depth=(depth+depthValues.x)/(depthValues.y);var shadowPixelDepth: f32=clamp(depth,0.,1.0);directionToLight=normalize(directionToLight);directionToLight.y=-directionToLight.y;\n#ifndef SHADOWFLOAT\nvar shadowMapSample: f32=unpack(textureSample(shadowTexture,shadowSampler,directionToLight));\n#else\nvar shadowMapSample: f32=textureSample(shadowTexture,shadowSampler,directionToLight).x;\n#endif\nvar esm: f32=1.0-clamp(exp(min(87.,depthScale*shadowPixelDepth))*shadowMapSample,0.,1.-darkness);return esm;}\nfn computeShadowWithCloseESMCube(worldPos: vec3f,lightPosition: vec3f,shadowTexture: texture_cube,shadowSampler: sampler,darkness: f32,depthScale: f32,depthValues: vec2f)->f32\n{var directionToLight: vec3f=worldPos-lightPosition;var depth: f32=length(directionToLight);depth=(depth+depthValues.x)/(depthValues.y);var shadowPixelDepth: f32=clamp(depth,0.,1.0);directionToLight=normalize(directionToLight);directionToLight.y=-directionToLight.y;\n#ifndef SHADOWFLOAT\nvar shadowMapSample: f32=unpack(textureSample(shadowTexture,shadowSampler,directionToLight));\n#else\nvar shadowMapSample: f32=textureSample(shadowTexture,shadowSampler,directionToLight).x;\n#endif\nvar esm: f32=clamp(exp(min(87.,-depthScale*(shadowPixelDepth-shadowMapSample))),darkness,1.);return esm;}\nfn computeShadowCSM(layer: i32,vPositionFromLight: vec4f,depthMetric: f32,shadowTexture: texture_2d_array,shadowSampler: sampler,darkness: f32,frustumEdgeFalloff: f32)->f32\n{var clipSpace: vec3f=vPositionFromLight.xyz/vPositionFromLight.w;var uv: vec2f=0.5*clipSpace.xy+ vec2f(0.5);var shadowPixelDepth: f32=clamp(depthMetric,0.,1.0);\n#ifndef SHADOWFLOAT\nvar shadow: f32=unpack(textureSample(shadowTexture,shadowSampler,uv,layer));\n#else\nvar shadow: f32=textureSample(shadowTexture,shadowSampler,uv,layer).x;\n#endif\nreturn select(1.,computeFallOff(darkness,clipSpace.xy,frustumEdgeFalloff),shadowPixelDepth>shadow );}\nfn computeShadow(vPositionFromLight: vec4f,depthMetric: f32,shadowTexture: texture_2d,shadowSampler: sampler,darkness: f32,frustumEdgeFalloff: f32)->f32\n{var clipSpace: vec3f=vPositionFromLight.xyz/vPositionFromLight.w;var uv: vec2f=0.5*clipSpace.xy+ vec2f(0.5);if (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\n{return 1.0;}\nelse\n{var shadowPixelDepth: f32=clamp(depthMetric,0.,1.0);\n#ifndef SHADOWFLOAT\nvar shadow: f32=unpack(textureSampleLevel(shadowTexture,shadowSampler,uv,0.));\n#else\nvar shadow: f32=textureSampleLevel(shadowTexture,shadowSampler,uv,0.).x;\n#endif\nreturn select(1.,computeFallOff(darkness,clipSpace.xy,frustumEdgeFalloff),shadowPixelDepth>shadow );}}\nfn computeShadowWithPoissonSampling(vPositionFromLight: vec4f,depthMetric: f32,shadowTexture: texture_2d,shadowSampler: sampler,mapSize: f32,darkness: f32,frustumEdgeFalloff: f32)->f32\n{var clipSpace: vec3f=vPositionFromLight.xyz/vPositionFromLight.w;var uv: vec2f=0.5*clipSpace.xy+ vec2f(0.5);if (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\n{return 1.0;}\nelse\n{var shadowPixelDepth: f32=clamp(depthMetric,0.,1.0);var visibility: f32=1.;var poissonDisk: array;poissonDisk[0]= vec2f(-0.94201624,-0.39906216);poissonDisk[1]= vec2f(0.94558609,-0.76890725);poissonDisk[2]= vec2f(-0.094184101,-0.92938870);poissonDisk[3]= vec2f(0.34495938,0.29387760);\n#ifndef SHADOWFLOAT\nif (unpack(textureSampleLevel(shadowTexture,shadowSampler,uv+poissonDisk[0]*mapSize,0.)),shadowSampler: sampler,darkness: f32,depthScale: f32,frustumEdgeFalloff: f32)->f32\n{var clipSpace: vec3f=vPositionFromLight.xyz/vPositionFromLight.w;var uv: vec2f=0.5*clipSpace.xy+ vec2f(0.5);if (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\n{return 1.0;}\nelse\n{var shadowPixelDepth: f32=clamp(depthMetric,0.,1.0);\n#ifndef SHADOWFLOAT\nvar shadowMapSample: f32=unpack(textureSampleLevel(shadowTexture,shadowSampler,uv,0.));\n#else\nvar shadowMapSample: f32=textureSampleLevel(shadowTexture,shadowSampler,uv,0.).x;\n#endif\nvar esm: f32=1.0-clamp(exp(min(87.,depthScale*shadowPixelDepth))*shadowMapSample,0.,1.-darkness);return computeFallOff(esm,clipSpace.xy,frustumEdgeFalloff);}}\nfn computeShadowWithCloseESM(vPositionFromLight: vec4f,depthMetric: f32,shadowTexture: texture_2d,shadowSampler: sampler,darkness: f32,depthScale: f32,frustumEdgeFalloff: f32)->f32\n{var clipSpace: vec3f=vPositionFromLight.xyz/vPositionFromLight.w;var uv: vec2f=0.5*clipSpace.xy+ vec2f(0.5);if (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\n{return 1.0;}\nelse\n{var shadowPixelDepth: f32=clamp(depthMetric,0.,1.0); \n#ifndef SHADOWFLOAT\nvar shadowMapSample: f32=unpack(textureSampleLevel(shadowTexture,shadowSampler,uv,0.));\n#else\nvar shadowMapSample: f32=textureSampleLevel(shadowTexture,shadowSampler,uv,0.).x;\n#endif\nvar esm: f32=clamp(exp(min(87.,-depthScale*(shadowPixelDepth-shadowMapSample))),darkness,1.);return computeFallOff(esm,clipSpace.xy,frustumEdgeFalloff);}}\nfn getZInClip(clipSpace: vec3f,uvDepth: vec3f)->f32\n{\n#ifdef IS_NDC_HALF_ZRANGE\nreturn clipSpace.z;\n#else\nreturn uvDepth.z;\n#endif\n}\nconst GREATEST_LESS_THAN_ONE: f32=0.99999994;\n#define DISABLE_UNIFORMITY_ANALYSIS\nfn computeShadowWithCSMPCF1(layer: i32,vPositionFromLight: vec4f,depthMetric: f32,shadowTexture: texture_depth_2d_array,shadowSampler: sampler_comparison,darkness: f32,frustumEdgeFalloff: f32)->f32\n{var clipSpace: vec3f=vPositionFromLight.xyz/vPositionFromLight.w;var uvDepth: vec3f= vec3f(0.5*clipSpace.xyz+ vec3f(0.5));uvDepth.z=clamp(getZInClip(clipSpace,uvDepth),0.,GREATEST_LESS_THAN_ONE);var shadow: f32=textureSampleCompare(shadowTexture,shadowSampler,uvDepth.xy,layer,uvDepth.z);shadow=mix(darkness,1.,shadow);return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);}\nfn computeShadowWithCSMPCF3(layer: i32,vPositionFromLight: vec4f,depthMetric: f32,shadowTexture: texture_depth_2d_array,shadowSampler: sampler_comparison,shadowMapSizeAndInverse: vec2f,darkness: f32,frustumEdgeFalloff: f32)->f32\n{var clipSpace: vec3f=vPositionFromLight.xyz/vPositionFromLight.w;var uvDepth: vec3f= vec3f(0.5*clipSpace.xyz+ vec3f(0.5));uvDepth.z=clamp(getZInClip(clipSpace,uvDepth),0.,GREATEST_LESS_THAN_ONE);var uv: vec2f=uvDepth.xy*shadowMapSizeAndInverse.x; \nuv+=0.5; \nvar st: vec2f=fract(uv); \nvar base_uv: vec2f=floor(uv)-0.5; \nbase_uv*=shadowMapSizeAndInverse.y; \nvar uvw0: vec2f=3.-2.*st;var uvw1: vec2f=1.+2.*st;var u: vec2f= vec2f((2.-st.x)/uvw0.x-1.,st.x/uvw1.x+1.)*shadowMapSizeAndInverse.y;var v: vec2f= vec2f((2.-st.y)/uvw0.y-1.,st.y/uvw1.y+1.)*shadowMapSizeAndInverse.y;var shadow: f32=0.;shadow+=uvw0.x*uvw0.y*textureSampleCompare(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[0],v[0]),layer,uvDepth.z);shadow+=uvw1.x*uvw0.y*textureSampleCompare(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[1],v[0]),layer,uvDepth.z);shadow+=uvw0.x*uvw1.y*textureSampleCompare(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[0],v[1]),layer,uvDepth.z);shadow+=uvw1.x*uvw1.y*textureSampleCompare(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[1],v[1]),layer,uvDepth.z);shadow=shadow/16.;shadow=mix(darkness,1.,shadow);return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);}\nfn computeShadowWithCSMPCF5(layer: i32,vPositionFromLight: vec4f,depthMetric: f32,shadowTexture: texture_depth_2d_array,shadowSampler: sampler_comparison,shadowMapSizeAndInverse: vec2f,darkness: f32,frustumEdgeFalloff: f32)->f32\n{var clipSpace: vec3f=vPositionFromLight.xyz/vPositionFromLight.w;var uvDepth: vec3f= vec3f(0.5*clipSpace.xyz+ vec3f(0.5));uvDepth.z=clamp(getZInClip(clipSpace,uvDepth),0.,GREATEST_LESS_THAN_ONE);var uv: vec2f=uvDepth.xy*shadowMapSizeAndInverse.x; \nuv+=0.5; \nvar st: vec2f=fract(uv); \nvar base_uv: vec2f=floor(uv)-0.5; \nbase_uv*=shadowMapSizeAndInverse.y; \nvar uvw0: vec2f=4.-3.*st;var uvw1: vec2f= vec2f(7.);var uvw2: vec2f=1.+3.*st;var u: vec3f= vec3f((3.-2.*st.x)/uvw0.x-2.,(3.+st.x)/uvw1.x,st.x/uvw2.x+2.)*shadowMapSizeAndInverse.y;var v: vec3f= vec3f((3.-2.*st.y)/uvw0.y-2.,(3.+st.y)/uvw1.y,st.y/uvw2.y+2.)*shadowMapSizeAndInverse.y;var shadow: f32=0.;shadow+=uvw0.x*uvw0.y*textureSampleCompare(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[0],v[0]),layer,uvDepth.z);shadow+=uvw1.x*uvw0.y*textureSampleCompare(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[1],v[0]),layer,uvDepth.z);shadow+=uvw2.x*uvw0.y*textureSampleCompare(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[2],v[0]),layer,uvDepth.z);shadow+=uvw0.x*uvw1.y*textureSampleCompare(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[0],v[1]),layer,uvDepth.z);shadow+=uvw1.x*uvw1.y*textureSampleCompare(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[1],v[1]),layer,uvDepth.z);shadow+=uvw2.x*uvw1.y*textureSampleCompare(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[2],v[1]),layer,uvDepth.z);shadow+=uvw0.x*uvw2.y*textureSampleCompare(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[0],v[2]),layer,uvDepth.z);shadow+=uvw1.x*uvw2.y*textureSampleCompare(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[1],v[2]),layer,uvDepth.z);shadow+=uvw2.x*uvw2.y*textureSampleCompare(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[2],v[2]),layer,uvDepth.z);shadow=shadow/144.;shadow=mix(darkness,1.,shadow);return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);}\nfn computeShadowWithPCF1(vPositionFromLight: vec4f,depthMetric: f32,shadowTexture: texture_depth_2d,shadowSampler: sampler_comparison,darkness: f32,frustumEdgeFalloff: f32)->f32\n{if (depthMetric>1.0 || depthMetric<0.0) {return 1.0;}\nelse\n{var clipSpace: vec3f=vPositionFromLight.xyz/vPositionFromLight.w;var uvDepth: vec3f= vec3f(0.5*clipSpace.xyz+ vec3f(0.5));uvDepth.z=getZInClip(clipSpace,uvDepth);var shadow: f32=textureSampleCompareLevel(shadowTexture,shadowSampler,uvDepth.xy,uvDepth.z);shadow=mix(darkness,1.,shadow);return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);}}\nfn computeShadowWithPCF3(vPositionFromLight: vec4f,depthMetric: f32,shadowTexture: texture_depth_2d,shadowSampler: sampler_comparison,shadowMapSizeAndInverse: vec2f,darkness: f32,frustumEdgeFalloff: f32)->f32\n{if (depthMetric>1.0 || depthMetric<0.0) {return 1.0;}\nelse\n{var clipSpace: vec3f=vPositionFromLight.xyz/vPositionFromLight.w;var uvDepth: vec3f= vec3f(0.5*clipSpace.xyz+ vec3f(0.5));uvDepth.z=getZInClip(clipSpace,uvDepth);var uv: vec2f=uvDepth.xy*shadowMapSizeAndInverse.x; \nuv+=0.5; \nvar st: vec2f=fract(uv); \nvar base_uv: vec2f=floor(uv)-0.5; \nbase_uv*=shadowMapSizeAndInverse.y; \nvar uvw0: vec2f=3.-2.*st;var uvw1: vec2f=1.+2.*st;var u: vec2f= vec2f((2.-st.x)/uvw0.x-1.,st.x/uvw1.x+1.)*shadowMapSizeAndInverse.y;var v: vec2f= vec2f((2.-st.y)/uvw0.y-1.,st.y/uvw1.y+1.)*shadowMapSizeAndInverse.y;var shadow: f32=0.;shadow+=uvw0.x*uvw0.y*textureSampleCompareLevel(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[0],v[0]),uvDepth.z);shadow+=uvw1.x*uvw0.y*textureSampleCompareLevel(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[1],v[0]),uvDepth.z);shadow+=uvw0.x*uvw1.y*textureSampleCompareLevel(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[0],v[1]),uvDepth.z);shadow+=uvw1.x*uvw1.y*textureSampleCompareLevel(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[1],v[1]),uvDepth.z);shadow=shadow/16.;shadow=mix(darkness,1.,shadow);return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);}}\nfn computeShadowWithPCF5(vPositionFromLight: vec4f,depthMetric: f32,shadowTexture: texture_depth_2d,shadowSampler: sampler_comparison,shadowMapSizeAndInverse: vec2f,darkness: f32,frustumEdgeFalloff: f32)->f32\n{if (depthMetric>1.0 || depthMetric<0.0) {return 1.0;}\nelse\n{var clipSpace: vec3f=vPositionFromLight.xyz/vPositionFromLight.w;var uvDepth: vec3f= vec3f(0.5*clipSpace.xyz+ vec3f(0.5));uvDepth.z=getZInClip(clipSpace,uvDepth);var uv: vec2f=uvDepth.xy*shadowMapSizeAndInverse.x; \nuv+=0.5; \nvar st: vec2f=fract(uv); \nvar base_uv: vec2f=floor(uv)-0.5; \nbase_uv*=shadowMapSizeAndInverse.y; \nvar uvw0: vec2f=4.-3.*st;var uvw1: vec2f= vec2f(7.);var uvw2: vec2f=1.+3.*st;var u: vec3f= vec3f((3.-2.*st.x)/uvw0.x-2.,(3.+st.x)/uvw1.x,st.x/uvw2.x+2.)*shadowMapSizeAndInverse.y;var v: vec3f= vec3f((3.-2.*st.y)/uvw0.y-2.,(3.+st.y)/uvw1.y,st.y/uvw2.y+2.)*shadowMapSizeAndInverse.y;var shadow: f32=0.;shadow+=uvw0.x*uvw0.y*textureSampleCompareLevel(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[0],v[0]),uvDepth.z);shadow+=uvw1.x*uvw0.y*textureSampleCompareLevel(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[1],v[0]),uvDepth.z);shadow+=uvw2.x*uvw0.y*textureSampleCompareLevel(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[2],v[0]),uvDepth.z);shadow+=uvw0.x*uvw1.y*textureSampleCompareLevel(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[0],v[1]),uvDepth.z);shadow+=uvw1.x*uvw1.y*textureSampleCompareLevel(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[1],v[1]),uvDepth.z);shadow+=uvw2.x*uvw1.y*textureSampleCompareLevel(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[2],v[1]),uvDepth.z);shadow+=uvw0.x*uvw2.y*textureSampleCompareLevel(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[0],v[2]),uvDepth.z);shadow+=uvw1.x*uvw2.y*textureSampleCompareLevel(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[1],v[2]),uvDepth.z);shadow+=uvw2.x*uvw2.y*textureSampleCompareLevel(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[2],v[2]),uvDepth.z);shadow=shadow/144.;shadow=mix(darkness,1.,shadow);return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);}}\nconst PoissonSamplers32: array=array (\nvec3f(0.06407013,0.05409927,0.),\nvec3f(0.7366577,0.5789394,0.),\nvec3f(-0.6270542,-0.5320278,0.),\nvec3f(-0.4096107,0.8411095,0.),\nvec3f(0.6849564,-0.4990818,0.),\nvec3f(-0.874181,-0.04579735,0.),\nvec3f(0.9989998,0.0009880066,0.),\nvec3f(-0.004920578,-0.9151649,0.),\nvec3f(0.1805763,0.9747483,0.),\nvec3f(-0.2138451,0.2635818,0.),\nvec3f(0.109845,0.3884785,0.),\nvec3f(0.06876755,-0.3581074,0.),\nvec3f(0.374073,-0.7661266,0.),\nvec3f(0.3079132,-0.1216763,0.),\nvec3f(-0.3794335,-0.8271583,0.),\nvec3f(-0.203878,-0.07715034,0.),\nvec3f(0.5912697,0.1469799,0.),\nvec3f(-0.88069,0.3031784,0.),\nvec3f(0.5040108,0.8283722,0.),\nvec3f(-0.5844124,0.5494877,0.),\nvec3f(0.6017799,-0.1726654,0.),\nvec3f(-0.5554981,0.1559997,0.),\nvec3f(-0.3016369,-0.3900928,0.),\nvec3f(-0.5550632,-0.1723762,0.),\nvec3f(0.925029,0.2995041,0.),\nvec3f(-0.2473137,0.5538505,0.),\nvec3f(0.9183037,-0.2862392,0.),\nvec3f(0.2469421,0.6718712,0.),\nvec3f(0.3916397,-0.4328209,0.),\nvec3f(-0.03576927,-0.6220032,0.),\nvec3f(-0.04661255,0.7995201,0.),\nvec3f(0.4402924,0.3640312,0.),\nvec3f(0.),\nvec3f(0.),\nvec3f(0.),\nvec3f(0.),\nvec3f(0.),\nvec3f(0.),\nvec3f(0.),\nvec3f(0.),\nvec3f(0.),\nvec3f(0.),\nvec3f(0.),\nvec3f(0.),\nvec3f(0.),\nvec3f(0.),\nvec3f(0.),\nvec3f(0.),\nvec3f(0.),\nvec3f(0.),\nvec3f(0.),\nvec3f(0.),\nvec3f(0.),\nvec3f(0.),\nvec3f(0.),\nvec3f(0.),\nvec3f(0.),\nvec3f(0.),\nvec3f(0.),\nvec3f(0.),\nvec3f(0.),\nvec3f(0.),\nvec3f(0.),\nvec3f(0.)\n);const PoissonSamplers64: array=array (\nvec3f(-0.613392,0.617481,0.),\nvec3f(0.170019,-0.040254,0.),\nvec3f(-0.299417,0.791925,0.),\nvec3f(0.645680,0.493210,0.),\nvec3f(-0.651784,0.717887,0.),\nvec3f(0.421003,0.027070,0.),\nvec3f(-0.817194,-0.271096,0.),\nvec3f(-0.705374,-0.668203,0.),\nvec3f(0.977050,-0.108615,0.),\nvec3f(0.063326,0.142369,0.),\nvec3f(0.203528,0.214331,0.),\nvec3f(-0.667531,0.326090,0.),\nvec3f(-0.098422,-0.295755,0.),\nvec3f(-0.885922,0.215369,0.),\nvec3f(0.566637,0.605213,0.),\nvec3f(0.039766,-0.396100,0.),\nvec3f(0.751946,0.453352,0.),\nvec3f(0.078707,-0.715323,0.),\nvec3f(-0.075838,-0.529344,0.),\nvec3f(0.724479,-0.580798,0.),\nvec3f(0.222999,-0.215125,0.),\nvec3f(-0.467574,-0.405438,0.),\nvec3f(-0.248268,-0.814753,0.),\nvec3f(0.354411,-0.887570,0.),\nvec3f(0.175817,0.382366,0.),\nvec3f(0.487472,-0.063082,0.),\nvec3f(-0.084078,0.898312,0.),\nvec3f(0.488876,-0.783441,0.),\nvec3f(0.470016,0.217933,0.),\nvec3f(-0.696890,-0.549791,0.),\nvec3f(-0.149693,0.605762,0.),\nvec3f(0.034211,0.979980,0.),\nvec3f(0.503098,-0.308878,0.),\nvec3f(-0.016205,-0.872921,0.),\nvec3f(0.385784,-0.393902,0.),\nvec3f(-0.146886,-0.859249,0.),\nvec3f(0.643361,0.164098,0.),\nvec3f(0.634388,-0.049471,0.),\nvec3f(-0.688894,0.007843,0.),\nvec3f(0.464034,-0.188818,0.),\nvec3f(-0.440840,0.137486,0.),\nvec3f(0.364483,0.511704,0.),\nvec3f(0.034028,0.325968,0.),\nvec3f(0.099094,-0.308023,0.),\nvec3f(0.693960,-0.366253,0.),\nvec3f(0.678884,-0.204688,0.),\nvec3f(0.001801,0.780328,0.),\nvec3f(0.145177,-0.898984,0.),\nvec3f(0.062655,-0.611866,0.),\nvec3f(0.315226,-0.604297,0.),\nvec3f(-0.780145,0.486251,0.),\nvec3f(-0.371868,0.882138,0.),\nvec3f(0.200476,0.494430,0.),\nvec3f(-0.494552,-0.711051,0.),\nvec3f(0.612476,0.705252,0.),\nvec3f(-0.578845,-0.768792,0.),\nvec3f(-0.772454,-0.090976,0.),\nvec3f(0.504440,0.372295,0.),\nvec3f(0.155736,0.065157,0.),\nvec3f(0.391522,0.849605,0.),\nvec3f(-0.620106,-0.328104,0.),\nvec3f(0.789239,-0.419965,0.),\nvec3f(-0.545396,0.538133,0.),\nvec3f(-0.178564,-0.596057,0.)\n);fn computeShadowWithCSMPCSS(layer: i32,vPositionFromLight: vec4f,depthMetric: f32,depthTexture: texture_2d_array,depthSampler: sampler,shadowTexture: texture_depth_2d_array,shadowSampler: sampler_comparison,shadowMapSizeInverse: f32,lightSizeUV: f32,darkness: f32,frustumEdgeFalloff: f32,searchTapCount: i32,pcfTapCount: i32,poissonSamplers: array,lightSizeUVCorrection: vec2f,depthCorrection: f32,penumbraDarkness: f32)->f32\n{var clipSpace: vec3f=vPositionFromLight.xyz/vPositionFromLight.w;var uvDepth: vec3f= vec3f(0.5*clipSpace.xyz+ vec3f(0.5));uvDepth.z=clamp(getZInClip(clipSpace,uvDepth),0.,GREATEST_LESS_THAN_ONE);var uvDepthLayer: vec4f= vec4f(uvDepth.x,uvDepth.y,f32(layer),uvDepth.z);var blockerDepth: f32=0.0;var sumBlockerDepth: f32=0.0;var numBlocker: f32=0.0;for (var i: i32=0; i,depthSampler: sampler,shadowTexture: texture_depth_2d,shadowSampler: sampler_comparison,shadowMapSizeInverse: f32,lightSizeUV: f32,darkness: f32,frustumEdgeFalloff: f32,searchTapCount: i32,pcfTapCount: i32,poissonSamplers: array)->f32\n{var clipSpace: vec3f=vPositionFromLight.xyz/vPositionFromLight.w;var uvDepth: vec3f= vec3f(0.5*clipSpace.xyz+ vec3f(0.5));uvDepth.z=getZInClip(clipSpace,uvDepth);var blockerDepth: f32=0.0;var sumBlockerDepth: f32=0.0;var numBlocker: f32=0.0;var exitCondition: bool=depthMetric>1.0 || depthMetric<0.0;for (var i: i32=0; i,depthSampler: sampler,shadowTexture: texture_depth_2d,shadowSampler: sampler_comparison,shadowMapSizeInverse: f32,lightSizeUV: f32,darkness: f32,frustumEdgeFalloff: f32)->f32\n{return computeShadowWithPCSS(vPositionFromLight,depthMetric,depthTexture,depthSampler,shadowTexture,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,16,16,PoissonSamplers32);}\nfn computeShadowWithPCSS32(vPositionFromLight: vec4f,depthMetric: f32,depthTexture: texture_2d,depthSampler: sampler,shadowTexture: texture_depth_2d,shadowSampler: sampler_comparison,shadowMapSizeInverse: f32,lightSizeUV: f32,darkness: f32,frustumEdgeFalloff: f32)->f32\n{return computeShadowWithPCSS(vPositionFromLight,depthMetric,depthTexture,depthSampler,shadowTexture,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,16,32,PoissonSamplers32);}\nfn computeShadowWithPCSS64(vPositionFromLight: vec4f,depthMetric: f32,depthTexture: texture_2d,depthSampler: sampler,shadowTexture: texture_depth_2d,shadowSampler: sampler_comparison,shadowMapSizeInverse: f32,lightSizeUV: f32,darkness: f32,frustumEdgeFalloff: f32)->f32\n{return computeShadowWithPCSS(vPositionFromLight,depthMetric,depthTexture,depthSampler,shadowTexture,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,32,64,PoissonSamplers64);}\nfn computeShadowWithCSMPCSS16(layer: i32,vPositionFromLight: vec4f,depthMetric: f32,depthTexture: texture_2d_array,depthSampler: sampler,shadowTexture: texture_depth_2d_array,shadowSampler: sampler_comparison,shadowMapSizeInverse: f32,lightSizeUV: f32,darkness: f32,frustumEdgeFalloff: f32,lightSizeUVCorrection: vec2f,depthCorrection: f32,penumbraDarkness: f32)->f32\n{return computeShadowWithCSMPCSS(layer,vPositionFromLight,depthMetric,depthTexture,depthSampler,shadowTexture,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,16,16,PoissonSamplers32,lightSizeUVCorrection,depthCorrection,penumbraDarkness);}\nfn computeShadowWithCSMPCSS32(layer: i32,vPositionFromLight: vec4f,depthMetric: f32,depthTexture: texture_2d_array,depthSampler: sampler,shadowTexture: texture_depth_2d_array,shadowSampler: sampler_comparison,shadowMapSizeInverse: f32,lightSizeUV: f32,darkness: f32,frustumEdgeFalloff: f32,lightSizeUVCorrection: vec2f,depthCorrection: f32,penumbraDarkness: f32)->f32\n{return computeShadowWithCSMPCSS(layer,vPositionFromLight,depthMetric,depthTexture,depthSampler,shadowTexture,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,16,32,PoissonSamplers32,lightSizeUVCorrection,depthCorrection,penumbraDarkness);}\nfn computeShadowWithCSMPCSS64(layer: i32,vPositionFromLight: vec4f,depthMetric: f32,depthTexture: texture_2d_array,depthSampler: sampler,shadowTexture: texture_depth_2d_array,shadowSampler: sampler_comparison,shadowMapSizeInverse: f32,lightSizeUV: f32,darkness: f32,frustumEdgeFalloff: f32,lightSizeUVCorrection: vec2f,depthCorrection: f32,penumbraDarkness: f32)->f32\n{return computeShadowWithCSMPCSS(layer,vPositionFromLight,depthMetric,depthTexture,depthSampler,shadowTexture,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,32,64,PoissonSamplers64,lightSizeUVCorrection,depthCorrection,penumbraDarkness);}\n#endif\n";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]=o);var a={name:i,shader:o}},32755:(e,t,n)=>{n.r(t),n.d(t,{colorVertexShader:()=>a});var r=n(98519),i=(n(36470),n(64400),n(85637),n(72153),n(38615),n(35397),n(76898),n(49334),n(83057),n(62589),n(45812),"colorVertexShader"),o="attribute vec3 position;\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include\n#include\n#include\n#include\n#ifdef FOG\nuniform mat4 view;\n#endif\n#include\nuniform mat4 viewProjection;\n#ifdef MULTIVIEW\nuniform mat4 viewProjectionR;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef VERTEXCOLOR\nvec4 colorUpdated=color;\n#endif\n#include\n#include\n#include\nvec4 worldPos=finalWorld*vec4(position,1.0);\n#ifdef MULTIVIEW\nif (gl_ViewID_OVR==0u) {gl_Position=viewProjection*worldPos;} else {gl_Position=viewProjectionR*worldPos;}\n#else\ngl_Position=viewProjection*worldPos;\n#endif\n#include\n#include\n#include\n#define CUSTOM_VERTEX_MAIN_END\n}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},32823:(e,t,n)=>{n.r(t),n.d(t,{lightUboDeclaration:()=>a});var r=n(98519),i="lightUboDeclaration",o="#ifdef LIGHT{X}\nuniform Light{X}\n{vec4 vLightData;vec4 vLightDiffuse;vec4 vLightSpecular;\n#ifdef SPOTLIGHT{X}\nvec4 vLightDirection;vec4 vLightFalloff;\n#elif defined(POINTLIGHT{X})\nvec4 vLightFalloff;\n#elif defined(HEMILIGHT{X})\nvec3 vLightGround;\n#elif defined(CLUSTLIGHT{X})\nvec2 vSliceData;vec2 vSliceRanges[CLUSTLIGHT_SLICES];\n#endif\n#if defined(AREALIGHT{X})\nvec4 vLightWidth;vec4 vLightHeight;\n#endif\nvec4 shadowsInfo;vec2 depthValues;} light{X};\n#ifdef IESLIGHTTEXTURE{X}\nuniform sampler2D iesLightTexture{X};\n#endif\n#ifdef PROJECTEDLIGHTTEXTURE{X}\nuniform mat4 textureProjectionMatrix{X};uniform sampler2D projectionLightTexture{X};\n#endif\n#ifdef CLUSTLIGHT{X}\nuniform sampler2D lightDataTexture{X};uniform highp sampler2D tileMaskTexture{X};\n#endif\n#ifdef SHADOW{X}\n#ifdef SHADOWCSM{X}\nuniform mat4 lightMatrix{X}[SHADOWCSMNUM_CASCADES{X}];uniform float viewFrustumZ{X}[SHADOWCSMNUM_CASCADES{X}];uniform float frustumLengths{X}[SHADOWCSMNUM_CASCADES{X}];uniform float cascadeBlendFactor{X};varying vec4 vPositionFromLight{X}[SHADOWCSMNUM_CASCADES{X}];varying float vDepthMetric{X}[SHADOWCSMNUM_CASCADES{X}];varying vec4 vPositionFromCamera{X};\n#if defined(SHADOWPCSS{X})\nuniform highp sampler2DArrayShadow shadowTexture{X};uniform highp sampler2DArray depthTexture{X};uniform vec2 lightSizeUVCorrection{X}[SHADOWCSMNUM_CASCADES{X}];uniform float depthCorrection{X}[SHADOWCSMNUM_CASCADES{X}];uniform float penumbraDarkness{X};\n#elif defined(SHADOWPCF{X})\nuniform highp sampler2DArrayShadow shadowTexture{X};\n#else\nuniform highp sampler2DArray shadowTexture{X};\n#endif\n#ifdef SHADOWCSMDEBUG{X}\nconst vec3 vCascadeColorsMultiplier{X}[8]=vec3[8]\n(\nvec3 ( 1.5,0.0,0.0 ),\nvec3 ( 0.0,1.5,0.0 ),\nvec3 ( 0.0,0.0,5.5 ),\nvec3 ( 1.5,0.0,5.5 ),\nvec3 ( 1.5,1.5,0.0 ),\nvec3 ( 1.0,1.0,1.0 ),\nvec3 ( 0.0,1.0,5.5 ),\nvec3 ( 0.5,3.5,0.75 )\n);vec3 shadowDebug{X};\n#endif\n#ifdef SHADOWCSMUSESHADOWMAXZ{X}\nint index{X}=-1;\n#else\nint index{X}=SHADOWCSMNUM_CASCADES{X}-1;\n#endif\nfloat diff{X}=0.;\n#elif defined(SHADOWCUBE{X})\nuniform samplerCube shadowTexture{X}; \n#else\nvarying vec4 vPositionFromLight{X};varying float vDepthMetric{X};\n#if defined(SHADOWPCSS{X})\nuniform highp sampler2DShadow shadowTexture{X};uniform highp sampler2D depthTexture{X};\n#elif defined(SHADOWPCF{X})\nuniform highp sampler2DShadow shadowTexture{X};\n#else\nuniform sampler2D shadowTexture{X};\n#endif\nuniform mat4 lightMatrix{X};\n#endif\n#endif\n#endif\n";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]=o);var a={name:i,shader:o}},32950:(e,t,n)=>{n.r(t),n.d(t,{FlowGraphArrayIndexBlock:()=>c});var r=n(78322),i=n(45749),o=n(88099),a=n(34623),s=n(40099),l=n(95803),c=function(e){function t(t){var n=e.call(this,t)||this;return n.config=t,n.array=n.registerDataInput("array",o.Vv),n.index=n.registerDataInput("index",o.Vv,new s.P(-1)),n.value=n.registerDataOutput("value",o.Vv),n}return(0,r.C6)(t,e),t.prototype._updateOutputs=function(e){var t=this.array.getValue(e),n=(0,l.$w)(this.index.getValue(e));t&&n>=0&&n{var r=n(98519),i="bumpVertexDeclaration";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="#if defined(BUMP) || defined(PARALLAX) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC)\n#if defined(TANGENT) && defined(NORMAL) \nvarying vTBN0: vec3f;varying vTBN1: vec3f;varying vTBN2: vec3f;\n#endif\n#endif\n")},33355:(e,t,n)=>{n.r(t),n.d(t,{particlesVertexShader:()=>a});var r=n(98519),i=(n(85637),n(72153),n(59262),n(83057),n(62589),n(56458),"particlesVertexShader"),o="attribute vec3 position;attribute vec4 color;attribute float angle;attribute vec2 size;\n#ifdef ANIMATESHEET\nattribute float cellIndex;\n#endif\n#ifndef BILLBOARD\nattribute vec3 direction;\n#endif\n#ifdef BILLBOARDSTRETCHED\nattribute vec3 direction;\n#endif\n#ifdef RAMPGRADIENT\nattribute vec4 remapData;\n#endif\nattribute vec2 offset;uniform mat4 view;uniform mat4 projection;uniform vec2 translationPivot;\n#ifdef ANIMATESHEET\nuniform vec3 particlesInfos; \n#endif\nvarying vec2 vUV;varying vec4 vColor;\n#ifdef RAMPGRADIENT\nvarying vec4 remapRanges;\n#endif\n#if defined(BILLBOARD) && !defined(BILLBOARDY) && !defined(BILLBOARDSTRETCHED)\nuniform mat4 invView;\n#endif\n#include\n#include\n#include\n#ifdef BILLBOARD\nuniform vec3 eyePosition;\n#endif\nvec3 rotate(vec3 yaxis,vec3 rotatedCorner) {vec3 xaxis=normalize(cross(vec3(0.,1.0,0.),yaxis));vec3 zaxis=normalize(cross(yaxis,xaxis));vec3 row0=vec3(xaxis.x,xaxis.y,xaxis.z);vec3 row1=vec3(yaxis.x,yaxis.y,yaxis.z);vec3 row2=vec3(zaxis.x,zaxis.y,zaxis.z);mat3 rotMatrix= mat3(row0,row1,row2);vec3 alignedCorner=rotMatrix*rotatedCorner;return position+alignedCorner;}\n#ifdef BILLBOARDSTRETCHED\nvec3 rotateAlign(vec3 toCamera,vec3 rotatedCorner) {vec3 normalizedToCamera=normalize(toCamera);vec3 normalizedCrossDirToCamera=normalize(cross(normalize(direction),normalizedToCamera));vec3 row0=vec3(normalizedCrossDirToCamera.x,normalizedCrossDirToCamera.y,normalizedCrossDirToCamera.z);vec3 row2=vec3(normalizedToCamera.x,normalizedToCamera.y,normalizedToCamera.z);\n#ifdef BILLBOARDSTRETCHED_LOCAL\nvec3 row1=direction;\n#else\nvec3 crossProduct=normalize(cross(normalizedToCamera,normalizedCrossDirToCamera));vec3 row1=vec3(crossProduct.x,crossProduct.y,crossProduct.z);\n#endif\nmat3 rotMatrix= mat3(row0,row1,row2);vec3 alignedCorner=rotMatrix*rotatedCorner;return position+alignedCorner;}\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvec2 cornerPos;vec3 vPositionW;cornerPos=(vec2(offset.x-0.5,offset.y -0.5)-translationPivot)*size;\n#ifdef BILLBOARD\nvec3 rotatedCorner;\n#ifdef BILLBOARDY\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);rotatedCorner.z=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);rotatedCorner.y=0.;rotatedCorner.xz+=translationPivot;vec3 yaxis=position-eyePosition;yaxis.y=0.;vPositionW=rotate(normalize(yaxis),rotatedCorner);vec3 viewPos=(view*vec4(vPositionW,1.0)).xyz;\n#elif defined(BILLBOARDSTRETCHED)\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);rotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);rotatedCorner.z=0.;rotatedCorner.xy+=translationPivot;vec3 toCamera=position-eyePosition;vPositionW=rotateAlign(toCamera,rotatedCorner);vec3 viewPos=(view*vec4(vPositionW,1.0)).xyz;\n#else\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);rotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);rotatedCorner.z=0.;rotatedCorner.xy+=translationPivot;vec3 viewPos=(view*vec4(position,1.0)).xyz+rotatedCorner;vPositionW=(invView*vec4(viewPos,1)).xyz;\n#endif\n#ifdef RAMPGRADIENT\nremapRanges=remapData;\n#endif\ngl_Position=projection*vec4(viewPos,1.0);\n#else\nvec3 rotatedCorner;rotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);rotatedCorner.z=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);rotatedCorner.y=0.;rotatedCorner.xz+=translationPivot;vec3 yaxis=normalize(direction);vPositionW=rotate(yaxis,rotatedCorner);gl_Position=projection*view*vec4(vPositionW,1.0);\n#endif\nvColor=color;\n#ifdef ANIMATESHEET\nfloat rowOffset=floor(cellIndex*particlesInfos.z);float columnOffset=cellIndex-rowOffset/particlesInfos.z;vec2 uvScale=particlesInfos.xy;vec2 uvOffset=vec2(offset.x ,1.0-offset.y);vUV=(uvOffset+vec2(columnOffset,rowOffset))*uvScale;\n#else\nvUV=offset;\n#endif\n#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4) || defined(CLIPPLANE5) || defined(CLIPPLANE6) || defined(FOG)\nvec4 worldPos=vec4(vPositionW,1.0);\n#endif\n#include\n#include\n#include\n#define CUSTOM_VERTEX_MAIN_END\n}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},33739:(e,t,n)=>{n.r(t),n.d(t,{passCubePixelShaderWGSL:()=>a});var r=n(98519),i="passCubePixelShader",o="varying vUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_cube;\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var uv: vec2f=input.vUV*2.0-1.0;\n#ifdef POSITIVEX\nfragmentOutputs.color=textureSample(textureSampler,textureSamplerSampler,vec3f(1.001,uv.y,uv.x));\n#endif\n#ifdef NEGATIVEX\nfragmentOutputs.color=textureSample(textureSampler,textureSamplerSampler,vec3f(-1.001,uv.y,uv.x));\n#endif\n#ifdef POSITIVEY\nfragmentOutputs.color=textureSample(textureSampler,textureSamplerSampler,vec3f(uv.y,1.001,uv.x));\n#endif\n#ifdef NEGATIVEY\nfragmentOutputs.color=textureSample(textureSampler,textureSamplerSampler,vec3f(uv.y,-1.001,uv.x));\n#endif\n#ifdef POSITIVEZ\nfragmentOutputs.color=textureSample(textureSampler,textureSamplerSampler,vec3f(uv,1.001));\n#endif\n#ifdef NEGATIVEZ\nfragmentOutputs.color=textureSample(textureSampler,textureSamplerSampler,vec3f(uv,-1.001));\n#endif\n}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},34063:(e,t,n)=>{n.r(t),n.d(t,{boundingBoxRendererVertexShaderWGSL:()=>a});var r=n(98519),i="boundingBoxRendererVertexShader",o="attribute position: vec3f;uniform world: mat4x4f;uniform viewProjection: mat4x4f;\n#ifdef INSTANCES\nattribute world0 : vec4;attribute world1 : vec4;attribute world2 : vec4;attribute world3 : vec4;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef INSTANCES\nvar finalWorld=mat4x4(vertexInputs.world0,vertexInputs.world1,vertexInputs.world2,vertexInputs.world3);var worldPos: vec4f=finalWorld* vec4f(input.position,1.0);\n#else\nvar worldPos: vec4f=uniforms.world* vec4f(input.position,1.0);\n#endif\nvertexOutputs.position=uniforms.viewProjection*worldPos;\n#define CUSTOM_VERTEX_MAIN_END\n}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},34438:(e,t,n)=>{n.r(t),n.d(t,{layerVertexShaderWGSL:()=>a});var r=n(98519),i="layerVertexShader",o="attribute position: vec2f;uniform scale: vec2f;uniform offset: vec2f;uniform textureMatrix: mat4x4f;varying vUV: vec2f;const madd: vec2f= vec2f(0.5,0.5);\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvar shiftedPosition: vec2f=input.position*uniforms.scale+uniforms.offset;vertexOutputs.vUV=(uniforms.textureMatrix* vec4f(shiftedPosition*madd+madd,1.0,0.0)).xy;vertexOutputs.position= vec4f(shiftedPosition,0.0,1.0);\n#define CUSTOM_VERTEX_MAIN_END\n}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},34561:(e,t,n)=>{function r(e){-1===e.indexOf("vClipPlane")&&e.push("vClipPlane"),-1===e.indexOf("vClipPlane2")&&e.push("vClipPlane2"),-1===e.indexOf("vClipPlane3")&&e.push("vClipPlane3"),-1===e.indexOf("vClipPlane4")&&e.push("vClipPlane4"),-1===e.indexOf("vClipPlane5")&&e.push("vClipPlane5"),-1===e.indexOf("vClipPlane6")&&e.push("vClipPlane6")}function i(e,t,n){var r,i,o,a,s,l,c=!!(null!==(r=e.clipPlane)&&void 0!==r?r:t.clipPlane),u=!!(null!==(i=e.clipPlane2)&&void 0!==i?i:t.clipPlane2),h=!!(null!==(o=e.clipPlane3)&&void 0!==o?o:t.clipPlane3),d=!!(null!==(a=e.clipPlane4)&&void 0!==a?a:t.clipPlane4),p=!!(null!==(s=e.clipPlane5)&&void 0!==s?s:t.clipPlane5),f=!!(null!==(l=e.clipPlane6)&&void 0!==l?l:t.clipPlane6);c&&n.push("#define CLIPPLANE"),u&&n.push("#define CLIPPLANE2"),h&&n.push("#define CLIPPLANE3"),d&&n.push("#define CLIPPLANE4"),p&&n.push("#define CLIPPLANE5"),f&&n.push("#define CLIPPLANE6")}function o(e,t,n){var r,i,o,a,s,l,c=!1,u=!!(null!==(r=e.clipPlane)&&void 0!==r?r:t.clipPlane),h=!!(null!==(i=e.clipPlane2)&&void 0!==i?i:t.clipPlane2),d=!!(null!==(o=e.clipPlane3)&&void 0!==o?o:t.clipPlane3),p=!!(null!==(a=e.clipPlane4)&&void 0!==a?a:t.clipPlane4),f=!!(null!==(s=e.clipPlane5)&&void 0!==s?s:t.clipPlane5),m=!!(null!==(l=e.clipPlane6)&&void 0!==l?l:t.clipPlane6);return n.CLIPPLANE!==u&&(n.CLIPPLANE=u,c=!0),n.CLIPPLANE2!==h&&(n.CLIPPLANE2=h,c=!0),n.CLIPPLANE3!==d&&(n.CLIPPLANE3=d,c=!0),n.CLIPPLANE4!==p&&(n.CLIPPLANE4=p,c=!0),n.CLIPPLANE5!==f&&(n.CLIPPLANE5=f,c=!0),n.CLIPPLANE6!==m&&(n.CLIPPLANE6=m,c=!0),c}function a(e,t,n){var r,i,o,a,l,c,u=null!==(r=t.clipPlane)&&void 0!==r?r:n.clipPlane;s(e,"vClipPlane",u),s(e,"vClipPlane2",u=null!==(i=t.clipPlane2)&&void 0!==i?i:n.clipPlane2),s(e,"vClipPlane3",u=null!==(o=t.clipPlane3)&&void 0!==o?o:n.clipPlane3),s(e,"vClipPlane4",u=null!==(a=t.clipPlane4)&&void 0!==a?a:n.clipPlane4),s(e,"vClipPlane5",u=null!==(l=t.clipPlane5)&&void 0!==l?l:n.clipPlane5),s(e,"vClipPlane6",u=null!==(c=t.clipPlane6)&&void 0!==c?c:n.clipPlane6)}function s(e,t,n){n&&e.setFloat4(t,n.normal.x,n.normal.y,n.normal.z,n.d)}n.d(t,{Ll:()=>r,e3:()=>o,ij:()=>a,r4:()=>i})},34593:(e,t,n)=>{n.r(t),n.d(t,{hdrFilteringVertexShaderWGSL:()=>a});var r=n(98519),i="hdrFilteringVertexShader",o="attribute position: vec2f;varying direction: vec3f;uniform up: vec3f;uniform right: vec3f;uniform front: vec3f;\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvar view: mat3x3f= mat3x3f(uniforms.up,uniforms.right,uniforms.front);vertexOutputs.direction=view*vec3f(input.position,1.0);vertexOutputs.position= vec4f(input.position,0.0,1.0);\n#define CUSTOM_VERTEX_MAIN_END\n}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},34623:(e,t,n)=>{n.d(t,{Uu:()=>a,Y5:()=>i,n9:()=>o});var r={};function i(e,t){r[e]=t}function o(e){return r[e]}function a(e){for(var t in r)if(e instanceof r[t]&&!t.includes("Abstract"))return t;return"Unknown"}},34855:(e,t,n)=>{n.r(t),n.d(t,{meshUVSpaceRendererVertexShader:()=>a});var r=n(98519),i=(n(36470),n(64400),n(24444),n(67369),n(38615),n(58266),n(84589),n(35397),n(76898),n(49334),"meshUVSpaceRendererVertexShader"),o="precision highp float;attribute vec3 position;attribute vec3 normal;attribute vec2 uv;uniform mat4 projMatrix;varying vec2 vDecalTC;\n#include\n#include\n#include\n#include[0..maxSimultaneousMorphTargets]\n#include\nvoid main(void) {vec3 positionUpdated=position;vec3 normalUpdated=normal;\n#include\n#include[0..maxSimultaneousMorphTargets]\n#include\n#include\n#include\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);mat3 normWorldSM=mat3(finalWorld);vec3 vNormalW;\n#if defined(INSTANCES) && defined(THIN_INSTANCES)\nvNormalW=normalUpdated/vec3(dot(normWorldSM[0],normWorldSM[0]),dot(normWorldSM[1],normWorldSM[1]),dot(normWorldSM[2],normWorldSM[2]));vNormalW=normalize(normWorldSM*vNormalW);\n#else\n#ifdef NONUNIFORMSCALING\nnormWorldSM=transposeMat3(inverseMat3(normWorldSM));\n#endif\nvNormalW=normalize(normWorldSM*normalUpdated);\n#endif\nvec3 normalView=normalize((projMatrix*vec4(vNormalW,0.0)).xyz);vec3 decalTC=(projMatrix*worldPos).xyz;vDecalTC=decalTC.xy;gl_Position=vec4(uv*2.0-1.0,normalView.z>0.0 ? 2. : decalTC.z,1.0);}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},34873:(e,t,n)=>{n.r(t),n.d(t,{linePixelShaderWGSL:()=>a});var r=n(98519),i=(n(20502),n(38197),n(56897),n(30032),"linePixelShader"),o="#include\nuniform color: vec4f;\n#include\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include\n#include\nfragmentOutputs.color=uniforms.color;\n#define CUSTOM_FRAGMENT_MAIN_END\n}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},35007:(e,t,n)=>{n.r(t),n.d(t,{motionBlurPixelShader:()=>a});var r=n(98519),i="motionBlurPixelShader",o="varying vec2 vUV;uniform sampler2D textureSampler;uniform float motionStrength;uniform float motionScale;uniform vec2 screenSize;\n#ifdef OBJECT_BASED\nuniform sampler2D velocitySampler;\n#else\nuniform sampler2D depthSampler;uniform mat4 inverseViewProjection;uniform mat4 prevViewProjection;uniform mat4 projection;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\n#ifdef GEOMETRY_SUPPORTED\n#ifdef OBJECT_BASED\nvec2 texelSize=1.0/screenSize;vec4 velocityColor=textureLod(velocitySampler,vUV,0.0);velocityColor.rg=velocityColor.rg*2.0-vec2(1.0);vec2 signs=sign(velocityColor.rg);vec2 velocity=pow(abs(velocityColor.rg),vec2(3.0))*signs*velocityColor.a;velocity*=motionScale*motionStrength;float speed=length(velocity/texelSize);int samplesCount=int(clamp(speed,1.0,SAMPLES));velocity=normalize(velocity)*texelSize;float hlim=float(-samplesCount)*0.5+0.5;vec4 result=textureLod(textureSampler,vUV,0.0);for (int i=1; i=samplesCount)\nbreak;vec2 offset=vUV+velocity*(hlim+float(i));result+=textureLod(textureSampler,offset,0.0);}\ngl_FragColor=result/float(samplesCount);gl_FragColor.a=1.0;\n#else\nvec4 result=textureLod(textureSampler,vUV,0.0);vec2 texelSize=1.0/screenSize;float depth=textureLod(depthSampler,vUV,0.0).r;if (depth==0.0) {gl_FragColor=result;return;}\ndepth=projection[2].z+projection[3].z/depth; \nvec4 cpos=vec4(vUV*2.0-1.0,depth,1.0);cpos=inverseViewProjection*cpos;cpos/=cpos.w;vec4 ppos=prevViewProjection*cpos;ppos/=ppos.w;ppos.xy=ppos.xy*0.5+0.5;vec2 velocity=(ppos.xy-vUV)*motionScale*motionStrength;float speed=length(velocity/texelSize);int nSamples=int(clamp(speed,1.0,SAMPLES));for (int i=1; i=nSamples)\nbreak;vec2 offset1=vUV+velocity*(float(i)/float(nSamples-1)-0.5);result+=textureLod(textureSampler,offset1,0.0);}\ngl_FragColor=result/float(nSamples);\n#endif\n#else\ngl_FragColor=texture2D(textureSampler,vUV);\n#endif\n}\n";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},35133:(e,t,n)=>{n.r(t),n.d(t,{FlowGraphThrottleBlock:()=>s});var r=n(78322),i=n(88099),o=n(88469),a=n(34623),s=function(e){function t(t){var n=e.call(this,t)||this;return n.reset=n._registerSignalInput("reset"),n.duration=n.registerDataInput("duration",i.Es),n.lastRemainingTime=n.registerDataOutput("lastRemainingTime",i.Es,NaN),n}return(0,r.C6)(t,e),t.prototype._execute=function(e,t){if(t===this.reset)return this.lastRemainingTime.setValue(NaN,e),e._setExecutionVariable(this,"lastRemainingTime",NaN),void e._setExecutionVariable(this,"timestamp",0);var n=this.duration.getValue(e);if(n<=0||isNaN(n)||!isFinite(n))return this._reportError(e,"Invalid duration in Throttle block");var r=e._getExecutionVariable(this,"lastRemainingTime",NaN),i=Date.now();if(isNaN(r))return this.lastRemainingTime.setValue(0,e),e._setExecutionVariable(this,"lastRemainingTime",0),e._setExecutionVariable(this,"timestamp",i),this.out._activateSignal(e);var o=i-e._getExecutionVariable(this,"timestamp",0),a=1e3*n;if(a<=o)return this.lastRemainingTime.setValue(0,e),e._setExecutionVariable(this,"lastRemainingTime",0),e._setExecutionVariable(this,"timestamp",i),this.out._activateSignal(e);var s=a-o;this.lastRemainingTime.setValue(s/1e3,e),e._setExecutionVariable(this,"lastRemainingTime",s)},t.prototype.getClassName=function(){return"FlowGraphThrottleBlock"},t}(o.w);(0,a.Y5)("FlowGraphThrottleBlock",s)},35139:(e,t,n)=>{n.r(t),n.d(t,{iblShadowDebugPixelShaderWGSL:()=>a});var r=n(98519),i="iblShadowDebugPixelShader",o="varying vUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d;var debugSamplerSampler: sampler;var debugSampler: texture_2d;uniform sizeParams: vec4f;\n#define offsetX uniforms.sizeParams.x\n#define offsetY uniforms.sizeParams.y\n#define widthScale uniforms.sizeParams.z\n#define heightScale uniforms.sizeParams.w\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var uv: vec2f =\nvec2f((offsetX+fragmentInputs.vUV.x)*widthScale,(offsetY+fragmentInputs.vUV.y)*heightScale);var background: vec4f=textureSample(textureSampler,textureSamplerSampler,fragmentInputs.vUV);var debugColour: vec4f=textureSample(debugSampler,debugSamplerSampler,fragmentInputs.vUV);if (uv.x<0.0 || uv.x>1.0 || uv.y<0.0 || uv.y>1.0) {fragmentOutputs.color=background;} else {fragmentOutputs.color=vec4f(mix(debugColour.rgb,background.rgb,0.0),1.0);}}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},35397:(e,t,n)=>{var r=n(98519),i="instancesVertex";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#ifdef INSTANCES\nmat4 finalWorld=mat4(world0,world1,world2,world3);\n#if defined(PREPASS_VELOCITY) || defined(VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) || defined(VELOCITY_LINEAR)\nmat4 finalPreviousWorld=mat4(previousWorld0,previousWorld1,\npreviousWorld2,previousWorld3);\n#endif\n#ifdef THIN_INSTANCES\nfinalWorld=world*finalWorld;\n#if defined(PREPASS_VELOCITY) || defined(VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) || defined(VELOCITY_LINEAR)\nfinalPreviousWorld=previousWorld*finalPreviousWorld;\n#endif\n#endif\n#else\nmat4 finalWorld=world;\n#if defined(PREPASS_VELOCITY) || defined(VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) || defined(VELOCITY_LINEAR)\nmat4 finalPreviousWorld=previousWorld;\n#endif\n#endif\n")},35747:(e,t,n)=>{n.d(t,{X:()=>r});var r=function(){function e(e,t,n,r,i,o){this.source=e,this.pointerX=t,this.pointerY=n,this.meshUnderPointer=r,this.sourceEvent=i,this.additionalData=o}return e.CreateNew=function(t,n,r){var i=t.getScene();return new e(t,i.pointerX,i.pointerY,i.meshUnderPointer||t,n,r)},e.CreateNewFromSprite=function(t,n,r,i){return new e(t,n.pointerX,n.pointerY,n.meshUnderPointer,r,i)},e.CreateNewFromScene=function(t,n){return new e(null,t.pointerX,t.pointerY,t.meshUnderPointer,n)},e.CreateNewFromPrimitive=function(t,n,r,i){return new e(t,n.x,n.y,null,r,i)},e}()},35750:(e,t,n)=>{n.r(t),n.d(t,{glowMapGenerationPixelShaderWGSL:()=>a});var r=n(98519),i=(n(17393),n(20502),n(30032),"glowMapGenerationPixelShader"),o="#if defined(DIFFUSE_ISLINEAR) || defined(EMISSIVE_ISLINEAR)\n#include\n#endif\n#ifdef DIFFUSE\nvarying vUVDiffuse: vec2f;var diffuseSamplerSampler: sampler;var diffuseSampler: texture_2d;\n#endif\n#ifdef OPACITY\nvarying vUVOpacity: vec2f;var opacitySamplerSampler: sampler;var opacitySampler: texture_2d;uniform opacityIntensity: f32;\n#endif\n#ifdef EMISSIVE\nvarying vUVEmissive: vec2f;var emissiveSamplerSampler: sampler;var emissiveSampler: texture_2d;\n#endif\n#ifdef VERTEXALPHA\nvarying vColor: vec4f;\n#endif\nuniform glowColor: vec4f;uniform glowIntensity: f32;\n#include\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#include\nvar finalColor: vec4f=uniforms.glowColor;\n#ifdef DIFFUSE\nvar albedoTexture: vec4f=textureSample(diffuseSampler,diffuseSamplerSampler,fragmentInputs.vUVDiffuse);\n#ifdef DIFFUSE_ISLINEAR\nalbedoTexture=toGammaSpace(albedoTexture);\n#endif\n#ifdef GLOW\nfinalColor=vec4f(finalColor.rgb,finalColor.a*albedoTexture.a);\n#endif\n#ifdef HIGHLIGHT\nfinalColor=vec4f(finalColor.rgb,albedoTexture.a);\n#endif\n#endif\n#ifdef OPACITY\nvar opacityMap: vec4f=textureSample(opacitySampler,opacitySamplerSampler,fragmentInputs.vUVOpacity);\n#ifdef OPACITYRGB\nfinalColor=vec4f(finalColor.rgb,finalColor.a*getLuminance(opacityMap.rgb));\n#else\nfinalColor=vec4f(finalColor.rgb,finalColor.a*opacityMap.a);\n#endif\nfinalColor=vec4f(finalColor.rgb,finalColor.a*uniforms.opacityIntensity);\n#endif\n#ifdef VERTEXALPHA\nfinalColor=vec4f(finalColor.rgb,finalColor.a*fragmentInputs.vColor.a);\n#endif\n#ifdef ALPHATEST\nif (finalColor.a{n.r(t),n.d(t,{iblScaledLuminancePixelShader:()=>a});var r=n(98519),i=(n(75334),"iblScaledLuminancePixelShader"),o="precision highp sampler2D;precision highp samplerCube;\n#include\nvarying vec2 vUV;\n#ifdef IBL_USE_CUBE_MAP\nuniform samplerCube iblSource;\n#else\nuniform sampler2D iblSource;\n#endif\nuniform int iblWidth;uniform int iblHeight;float fetchLuminance(vec2 coords) {\n#ifdef IBL_USE_CUBE_MAP\nvec3 direction=equirectangularToCubemapDirection(coords);vec3 color=textureCubeLodEXT(iblSource,direction,0.0).rgb;\n#else\nvec3 color=textureLod(iblSource,coords,0.0).rgb;\n#endif\nreturn dot(color,LuminanceEncodeApprox);}\nvoid main(void) {float deform=sin(vUV.y*PI);float luminance=fetchLuminance(vUV);gl_FragColor=vec4(vec3(deform*luminance),1.0);}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},35845:(e,t,n)=>{var r=n(98519),i="bumpVertex";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#if defined(BUMP) || defined(PARALLAX) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC)\n#if defined(TANGENT) && defined(NORMAL)\nvec3 tbnNormal=normalize(normalUpdated);vec3 tbnTangent=normalize(tangentUpdated.xyz);vec3 tbnBitangent=cross(tbnNormal,tbnTangent)*tangentUpdated.w;vTBN=mat3(finalWorld)*mat3(tbnTangent,tbnBitangent,tbnNormal);\n#endif\n#endif\n")},35930:(e,t,n)=>{n.d(t,{nO:()=>C,pB:()=>E,jC:()=>P,M0:()=>x,je:()=>N,Hd:()=>F});var r=function(){function e(){this.children=[]}return e.prototype.isValid=function(e){return!0},e.prototype.process=function(e,t,n){var r,i,o,a,s,l,c,u="";if(this.line){var h=this.line,d=t.processor;if(d){d.lineProcessor&&(h=d.lineProcessor(h,t.isFragment,t.processingContext));var p=null!==(i=null===(r=t.processor)||void 0===r?void 0:r.attributeKeywordName)&&void 0!==i?i:"attribute",f=t.isFragment&&(null===(o=t.processor)||void 0===o?void 0:o.varyingFragmentKeywordName)?null===(a=t.processor)||void 0===a?void 0:a.varyingFragmentKeywordName:!t.isFragment&&(null===(s=t.processor)||void 0===s?void 0:s.varyingVertexKeywordName)?null===(l=t.processor)||void 0===l?void 0:l.varyingVertexKeywordName:"varying";!t.isFragment&&d.attributeProcessor&&this.line.startsWith(p)?h=d.attributeProcessor(this.line,e,t.processingContext):d.varyingProcessor&&((null===(c=d.varyingCheck)||void 0===c?void 0:c.call(d,this.line,t.isFragment))||!d.varyingCheck&&this.line.startsWith(f))?h=d.varyingProcessor(this.line,t.isFragment,e,t.processingContext):d.uniformProcessor&&d.uniformRegexp&&d.uniformRegexp.test(this.line)?t.lookForClosingBracketForUniformBuffer||(h=d.uniformProcessor(this.line,t.isFragment,e,t.processingContext)):d.uniformBufferProcessor&&d.uniformBufferRegexp&&d.uniformBufferRegexp.test(this.line)?t.lookForClosingBracketForUniformBuffer||(h=d.uniformBufferProcessor(this.line,t.isFragment,t.processingContext),t.lookForClosingBracketForUniformBuffer=!0):d.textureProcessor&&d.textureRegexp&&d.textureRegexp.test(this.line)?h=d.textureProcessor(this.line,t.isFragment,e,t.processingContext):(d.uniformProcessor||d.uniformBufferProcessor)&&this.line.startsWith("uniform")&&!t.lookForClosingBracketForUniformBuffer&&(/uniform\s+(?:(?:highp)?|(?:lowp)?)\s*(\S+)\s+(\S+)\s*;/.test(this.line)?d.uniformProcessor&&(h=d.uniformProcessor(this.line,t.isFragment,e,t.processingContext)):d.uniformBufferProcessor&&(h=d.uniformBufferProcessor(this.line,t.isFragment,t.processingContext),t.lookForClosingBracketForUniformBuffer=!0)),t.lookForClosingBracketForUniformBuffer&&-1!==this.line.indexOf("}")&&(t.lookForClosingBracketForUniformBuffer=!1,d.endOfUniformBufferProcessor&&(h=d.endOfUniformBufferProcessor(this.line,t.isFragment,t.processingContext)))}u+=h+"\n"}for(var m=0,_=this.children;m<_.length;m++)u+=_[m].process(e,t,n);return this.additionalDefineKey&&(e[this.additionalDefineKey]=this.additionalDefineValue||"true",n[this.additionalDefineKey]=e[this.additionalDefineKey]),u},e}(),i=function(){function e(){this._lines=[]}return Object.defineProperty(e.prototype,"currentLine",{get:function(){return this._lines[this.lineIndex]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"canRead",{get:function(){return this.lineIndex1&&this._lines.push(i);else for(var a=r.split(";"),s=0;s1){for(o();-1!==i&&e._OperatorPriority[s()]>=e._OperatorPriority[d];)r.push(l());a(d),c++}else u+=h;c++}for(o();-1!==i;)"("===s()?l():r.push(l());return e._InfixToPostfixCache.size>=e.InfixToPostfixCacheLimitSize&&e.ClearCache(),e._InfixToPostfixCache.set(t,{result:r,accessTime:Date.now()}),r},e.ClearCache=function(){for(var t=Array.from(e._InfixToPostfixCache.entries()).sort((function(e,t){return e[1].accessTime-t[1].accessTime})),n=0;n":t=n>r;break;case"<":t=n=":t=n>=r;break;case"==":t=n===r;break;case"!=":t=n!==r}return t},t}(l),p=n(41190),f=n(24894),m=/defined\s*?\((.+?)\)/g,_=/defined\s*?\[(.+?)\]/g,g=/#include\s?<(.+)>(\((.*)\))*(\[(.*)\])*/g,v=/__decl__/,y=/light\{X\}.(\w*)/g,b=/\{X\}/g,S=[],T=/(#ifdef)|(#else)|(#elif)|(#endif)|(#ifndef)|(#if)/;function E(e){e.processor&&e.processor.initializeShaders&&e.processor.initializeShaders(e.processingContext)}function x(e,t,n,r){var i;(null===(i=t.processor)||void 0===i?void 0:i.preProcessShaderCode)&&(e=t.processor.preProcessShaderCode(e,t.isFragment)),N(e,t,(function(e){t.processCodeAfterIncludes&&(e=t.processCodeAfterIncludes(t.isFragment?"fragment":"vertex",e,t.defines));var i=function(e,t,n){var r=function(e,t){var n;if(null===(n=t.processor)||void 0===n?void 0:n.noPrecision)return e;var r=t.shouldUseHighPrecisionShader;return-1===e.indexOf("precision highp float")?e=r?"precision highp float;\n"+e:"precision mediump float;\n"+e:r||(e=e.replace("precision highp float","precision mediump float")),e}(e,t);if(!t.processor)return r;if(0===t.processor.shaderLanguage&&-1!==r.indexOf("#version 3")&&(r=r.replace("#version 300 es",""),!t.processor.parseGLES3))return r;var i=t.defines,o=D(t,n);t.processor.preProcessor&&(r=t.processor.preProcessor(r,i,o,t.isFragment,t.processingContext));var a={};return r=M(r,o,t,a),t.processor.postProcessor&&(r=t.processor.postProcessor(r,i,t.isFragment,t.processingContext,n?{drawBuffersExtensionDisabled:!n.getCaps().drawBuffersExtension}:{},o,a)),(null==n?void 0:n._features.needShaderCodeInlining)&&(r=n.inlineShaderCode(r)),r}(e,t,r);n(i,e)}))}function P(e,t,n,r){var i;(null===(i=t.processor)||void 0===i?void 0:i.preProcessShaderCode)&&(e=t.processor.preProcessShaderCode(e,t.isFragment)),N(e,t,(function(e){t.processCodeAfterIncludes&&(e=t.processCodeAfterIncludes(t.isFragment?"fragment":"vertex",e,t.defines));var i=function(e,t,n){var r,i,o=e,a=t.defines,s=D(t,n);(null===(r=t.processor)||void 0===r?void 0:r.preProcessor)&&(o=t.processor.preProcessor(o,a,s,t.isFragment,t.processingContext));var l={};return o=M(o,s,t,l),(null===(i=t.processor)||void 0===i?void 0:i.postProcessor)&&(o=t.processor.postProcessor(o,a,t.isFragment,t.processingContext,n?{drawBuffersExtensionDisabled:!n.getCaps().drawBuffersExtension}:{},s,l)),n._features.needShaderCodeInlining&&(o=n.inlineShaderCode(o)),o}(e,t,r);n(i,e)}))}function C(e,t,n){return n.processor&&n.processor.finalizeShaders?n.processor.finalizeShaders(e,t,n.processingContext):{vertexCode:e,fragmentCode:t}}function R(e){var t=/defined\((.+)\)/.exec(e);if(t&&t.length)return new c(t[1].trim(),"!"===e[0]);for(var n="",r=0,i=0,o=["==","!=",">=","<=","<",">"];i-1));i++);if(-1===r)return new c(e);var a=e.substring(0,r).trim(),s=e.substring(r+n.length).trim();return new d(a,n,s)}function A(e,t){var n=new s,r=e.substring(0,t),i=e.substring(t);return i=i.substring(0,(i.indexOf("//")+1||i.length+1)-1).trim(),n.testExpression="#ifdef"===r?new c(i):"#ifndef"===r?new c(i,!0):function(e){e=e.replace(m,"defined[$1]");for(var t=[],n=0,r=l.infixToPostfix(e);n=2){var o=t[t.length-1],a=t[t.length-2];t.length-=2;var s="&&"==i?new h:new u;"string"==typeof o&&(o=o.replace(_,"defined($1)")),"string"==typeof a&&(a=a.replace(_,"defined($1)")),s.leftOperand="string"==typeof a?R(a):a,s.rightOperand="string"==typeof o?R(o):o,t.push(s)}}var c=t[t.length-1];return"string"==typeof c&&(c=c.replace(_,"defined($1)")),"string"==typeof c?R(c):c}(i),n}function I(e,t,n,i){for(var o=e.currentLine;O(e,n,i);){var a=(o=e.currentLine).substring(0,5).toLowerCase();if("#else"===a){var s=new r;return t.children.push(s),void O(e,s,i)}if("#elif"===a){var l=A(o,5);t.children.push(l),n=l}}}function O(e,t,n){for(;e.canRead;){e.lineIndex++;var i=e.currentLine;if(i.indexOf("#")>=0){var o=T.exec(i);if(o&&o.length){switch(o[0]){case"#ifdef":var s=new a;t.children.push(s);var l=A(i,6);s.children.push(l),I(e,s,l,n);break;case"#else":case"#elif":return!0;case"#endif":return!1;case"#ifndef":s=new a,t.children.push(s),l=A(i,7),s.children.push(l),I(e,s,l,n);break;case"#if":s=new a,l=A(i,3),t.children.push(s),s.children.push(l),I(e,s,l,n)}continue}}var c=new r;if(c.line=i,t.children.push(c),"#"===i[0]&&"d"===i[1]){var u=i.replace(";","").split(" ");c.additionalDefineKey=u[1],3===u.length&&(c.additionalDefineValue=u[2])}}return!1}function M(e,t,n,o){var a=new r,s=new i;return s.lineIndex=-1,s.lines=e.split("\n"),O(s,a,o),a.process(t,n,o)}function D(e,t){for(var n,r={},i=0,o=e.defines;i1?a[1]:""}return 0===(null===(n=e.processor)||void 0===n?void 0:n.shaderLanguage)&&(r.GL_ES="true"),r.__VERSION__=e.version,r[e.platformName]="true",(0,f.tj)(r,null==t?void 0:t.isNDCHalfZRange,null==t?void 0:t.useReverseDepthBuffer,null==t?void 0:t.useExactSrgbConversions),r}function N(e,t,n){var r;for(S.length=0;null!==(r=g.exec(e));)S.push(r);for(var i=String(e),o=[e],a=!1,s=function(e){var r=e[1];if(-1!==r.indexOf("__decl__")&&(r=r.replace(v,""),t.supportsUniformBuffers&&(r=r.replace("Vertex","Ubo").replace("Fragment","Ubo")),r+="Declaration"),!t.includesShadersStore[r]){var i=t.shadersRepository+"ShadersInclude/"+r+".fx";return F.loadFile(i,(function(e){t.includesShadersStore[r]=e,N(o.join(""),t,n)})),{value:void 0}}var s=t.includesShadersStore[r];if(e[2])for(var l=e[3].split(","),c=0;c=0||s.indexOf("#include <")>=0},l=0,c=S;l{n.r(t),n.d(t,{depthVertexShader:()=>s});var r=n(98519),i=(n(36470),n(64400),n(24444),n(67369),n(85637),n(38615),"pointCloudVertexDeclaration");r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n"),n(58266),n(84589),n(35397),n(76898),n(49334),n(83057),n(52226);var o="depthVertexShader",a="attribute vec3 position;\n#include\n#include\n#include\n#include[0..maxSimultaneousMorphTargets]\n#include\n#include\nuniform mat4 viewProjection;uniform vec2 depthValues;\n#if defined(ALPHATEST) || defined(NEED_UV)\nvarying vec2 vUV;uniform mat4 diffuseMatrix;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#endif\n#ifdef STORE_CAMERASPACE_Z\nuniform mat4 view;varying vec4 vViewPos;\n#endif\n#include\nvarying float vDepthMetric;\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void)\n{vec3 positionUpdated=position;\n#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#ifdef UV2\nvec2 uv2Updated=uv2;\n#endif\n#include\n#include[0..maxSimultaneousMorphTargets]\n#include\n#include\n#include\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\n#include\ngl_Position=viewProjection*worldPos;\n#ifdef STORE_CAMERASPACE_Z\nvViewPos=view*worldPos;\n#else\n#ifdef USE_REVERSE_DEPTHBUFFER\nvDepthMetric=((-gl_Position.z+depthValues.x)/(depthValues.y));\n#else\nvDepthMetric=((gl_Position.z+depthValues.x)/(depthValues.y));\n#endif\n#endif\n#if defined(ALPHATEST) || defined(BASIC_RENDER)\n#ifdef UV1\nvUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef UV2\nvUV=vec2(diffuseMatrix*vec4(uv2Updated,1.0,0.0));\n#endif\n#endif\n#include\n}\n";r.l.ShadersStore[o]||(r.l.ShadersStore[o]=a);var s={name:o,shader:a}},36359:(e,t,n)=>{n.d(t,{P:()=>i});var r=n(43939),i=function(){function e(){}return e.GetPlanes=function(t){for(var n=[],i=0;i<6;i++)n.push(new r.Z(0,0,0,0));return e.GetPlanesToRef(t,n),n},e.GetNearPlaneToRef=function(e,t){var n=e.m;t.normal.x=n[3]+n[2],t.normal.y=n[7]+n[6],t.normal.z=n[11]+n[10],t.d=n[15]+n[14],t.normalize()},e.GetFarPlaneToRef=function(e,t){var n=e.m;t.normal.x=n[3]-n[2],t.normal.y=n[7]-n[6],t.normal.z=n[11]-n[10],t.d=n[15]-n[14],t.normalize()},e.GetLeftPlaneToRef=function(e,t){var n=e.m;t.normal.x=n[3]+n[0],t.normal.y=n[7]+n[4],t.normal.z=n[11]+n[8],t.d=n[15]+n[12],t.normalize()},e.GetRightPlaneToRef=function(e,t){var n=e.m;t.normal.x=n[3]-n[0],t.normal.y=n[7]-n[4],t.normal.z=n[11]-n[8],t.d=n[15]-n[12],t.normalize()},e.GetTopPlaneToRef=function(e,t){var n=e.m;t.normal.x=n[3]-n[1],t.normal.y=n[7]-n[5],t.normal.z=n[11]-n[9],t.d=n[15]-n[13],t.normalize()},e.GetBottomPlaneToRef=function(e,t){var n=e.m;t.normal.x=n[3]+n[1],t.normal.y=n[7]+n[5],t.normal.z=n[11]+n[9],t.d=n[15]+n[13],t.normalize()},e.GetPlanesToRef=function(t,n){e.GetNearPlaneToRef(t,n[0]),e.GetFarPlaneToRef(t,n[1]),e.GetLeftPlaneToRef(t,n[2]),e.GetRightPlaneToRef(t,n[3]),e.GetTopPlaneToRef(t,n[4]),e.GetBottomPlaneToRef(t,n[5])},e.IsPointInFrustum=function(e,t){for(var n=0;n<6;n++)if(t[n].dotCoordinate(e)<0)return!1;return!0},e}()},36423:(e,t,n)=>{n.r(t),n.d(t,{backgroundPixelShader:()=>l});var r=n(98519),i="backgroundFragmentDeclaration";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="uniform vec4 vEyePosition;uniform vec4 vPrimaryColor;\n#ifdef USEHIGHLIGHTANDSHADOWCOLORS\nuniform vec4 vPrimaryColorShadow;\n#endif\nuniform float shadowLevel;uniform float alpha;\n#ifdef DIFFUSE\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;uniform mat4 reflectionMatrix;uniform vec3 vReflectionMicrosurfaceInfos;\n#endif\n#if defined(REFLECTIONFRESNEL) || defined(OPACITYFRESNEL)\nuniform vec3 vBackgroundCenter;\n#endif\n#ifdef REFLECTIONFRESNEL\nuniform vec4 vReflectionControl;\n#endif\n#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(REFRACTION)\nuniform mat4 view;\n#endif\n#ifdef PROJECTED_GROUND\nuniform vec2 projectedGroundInfos;\n#endif\n"),n(27947),n(75334),n(40150),n(59581),n(87283),n(32823),n(54409),n(46837),n(40688),n(59262),n(27003),n(52767);var o="intersectionFunctions";r.l.IncludesShadersStore[o]||(r.l.IncludesShadersStore[o]="float diskIntersectWithBackFaceCulling(vec3 ro,vec3 rd,vec3 c,float r) {float d=rd.y;if(d>0.0) { return 1e6; }\nvec3 o=ro-c;float t=-o.y/d;vec3 q=o+rd*t;return (dot(q,q){n.r(t),n.d(t,{bonesDeclaration:()=>a});var r=n(98519),i="bonesDeclaration",o="#if NUM_BONE_INFLUENCERS>0\nattribute vec4 matricesIndices;attribute vec4 matricesWeights;\n#if NUM_BONE_INFLUENCERS>4\nattribute vec4 matricesIndicesExtra;attribute vec4 matricesWeightsExtra;\n#endif\n#ifndef BAKED_VERTEX_ANIMATION_TEXTURE\n#ifdef BONETEXTURE\nuniform highp sampler2D boneSampler;uniform float boneTextureWidth;\n#else\nuniform mat4 mBones[BonesPerMesh];\n#endif\n#ifdef BONES_VELOCITY_ENABLED\nuniform mat4 mPreviousBones[BonesPerMesh];\n#endif\n#ifdef BONETEXTURE\n#define inline\nmat4 readMatrixFromRawSampler(sampler2D smp,float index)\n{float offset=index *4.0;float dx=1.0/boneTextureWidth;vec4 m0=texture2D(smp,vec2(dx*(offset+0.5),0.));vec4 m1=texture2D(smp,vec2(dx*(offset+1.5),0.));vec4 m2=texture2D(smp,vec2(dx*(offset+2.5),0.));vec4 m3=texture2D(smp,vec2(dx*(offset+3.5),0.));return mat4(m0,m1,m2,m3);}\n#endif\n#endif\n#endif\n";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]=o);var a={name:i,shader:o}},36489:(e,t,n)=>{n.r(t),n.d(t,{highlightsPixelShader:()=>a});var r=n(98519),i="highlightsPixelShader",o="varying vec2 vUV;uniform sampler2D textureSampler;const vec3 RGBLuminanceCoefficients=vec3(0.2126,0.7152,0.0722);\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) \n{vec4 tex=texture2D(textureSampler,vUV);vec3 c=tex.rgb;float luma=dot(c.rgb,RGBLuminanceCoefficients);gl_FragColor=vec4(pow(c,vec3(25.0-luma*15.0)),tex.a); }";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},36644:(e,t,n)=>{var r=n(98519),i="sceneUboDeclaration";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="struct Scene {viewProjection : mat4x4,\n#ifdef MULTIVIEW\nviewProjectionR : mat4x4,\n#endif \nview : mat4x4,\nprojection : mat4x4,\nvEyePosition : vec4,};\n#define SCENE_UBO\nvar scene : Scene;\n")},36729:(e,t,n)=>{n.d(t,{B:()=>o,K:()=>a});var r={},i={};function o(e){var t=e.getClassName();return i[t]||(i[t]={}),i[t]}function a(e){var t=e.getClassName();if(r[t])return r[t];r[t]={};for(var n=r[t],o=e,a=t;a;){var s=i[a];for(var l in s)n[l]=s[l];var c=void 0,u=!1;do{if(!(c=Object.getPrototypeOf(o)).getClassName){u=!0;break}if(c.getClassName()!==a)break;o=c}while(c);if(u)break;a=c.getClassName(),o=c}return n}},36870:(e,t,n)=>{n.r(t),n.d(t,{fluidRenderingRenderPixelShader:()=>a});var r=n(98519),i="fluidRenderingRenderPixelShader",o="#define DISABLE_UNIFORMITY_ANALYSIS\n#define IOR 1.333\n#define ETA 1.0/IOR\n#define F0 0.02\nuniform sampler2D textureSampler;uniform sampler2D depthSampler;\n#ifdef FLUIDRENDERING_DIFFUSETEXTURE\nuniform sampler2D diffuseSampler;\n#else\nuniform vec3 diffuseColor;\n#endif\n#ifdef FLUIDRENDERING_FIXED_THICKNESS\nuniform float thickness;uniform sampler2D bgDepthSampler;\n#else\nuniform float minimumThickness;uniform sampler2D thicknessSampler;\n#endif\n#ifdef FLUIDRENDERING_ENVIRONMENT\nuniform samplerCube reflectionSampler;\n#endif\n#if defined(FLUIDRENDERING_DEBUG) && defined(FLUIDRENDERING_DEBUG_TEXTURE)\nuniform sampler2D debugSampler;\n#endif\nuniform mat4 viewMatrix;uniform mat4 projectionMatrix;uniform mat4 invProjectionMatrix;uniform vec2 texelSize;uniform vec3 dirLight;uniform float cameraFar;uniform float density;uniform float refractionStrength;uniform float fresnelClamp;uniform float specularPower;varying vec2 vUV;vec3 computeViewPosFromUVDepth(vec2 texCoord,float depth) {vec4 ndc;ndc.xy=texCoord*2.0-1.0;\n#ifdef FLUIDRENDERING_RHS\nndc.z=-projectionMatrix[2].z+projectionMatrix[3].z/depth;\n#else\nndc.z=projectionMatrix[2].z+projectionMatrix[3].z/depth;\n#endif\nndc.w=1.0;vec4 eyePos=invProjectionMatrix*ndc;eyePos.xyz/=eyePos.w;return eyePos.xyz;}\nvec3 getViewPosFromTexCoord(vec2 texCoord) {float depth=textureLod(depthSampler,texCoord,0.).x;return computeViewPosFromUVDepth(texCoord,depth);}\nvoid main(void) {vec2 texCoord=vUV;\n#if defined(FLUIDRENDERING_DEBUG) && defined(FLUIDRENDERING_DEBUG_TEXTURE)\nvec4 color=texture2D(debugSampler,texCoord);\n#ifdef FLUIDRENDERING_DEBUG_DEPTH\nglFragColor=vec4(color.rgb/vec3(2.0),1.);if (color.r>0.999 && color.g>0.999) {glFragColor=texture2D(textureSampler,texCoord);}\n#else\nglFragColor=vec4(color.rgb,1.);if (color.r<0.001 && color.g<0.001 && color.b<0.001) {glFragColor=texture2D(textureSampler,texCoord);}\n#endif\nreturn;\n#endif\nvec2 depthVel=textureLod(depthSampler,texCoord,0.).rg;float depth=depthVel.r;\n#ifndef FLUIDRENDERING_FIXED_THICKNESS\nfloat thickness=texture2D(thicknessSampler,texCoord).x;\n#else\nfloat bgDepth=texture2D(bgDepthSampler,texCoord).x;float depthNonLinear=projectionMatrix[2].z+projectionMatrix[3].z/depth;depthNonLinear=depthNonLinear*0.5+0.5;\n#endif\nvec4 backColor=texture2D(textureSampler,texCoord);\n#ifndef FLUIDRENDERING_FIXED_THICKNESS\nif (depth>=cameraFar || depth<=0. || thickness<=minimumThickness) {\n#else\nif (depth>=cameraFar || depth<=0. || bgDepth<=depthNonLinear) {\n#endif\n#ifdef FLUIDRENDERING_COMPOSITE_MODE\nglFragColor.rgb=backColor.rgb*backColor.a;glFragColor.a=backColor.a;\n#else\nglFragColor=backColor;\n#endif\nreturn;}\nvec3 viewPos=computeViewPosFromUVDepth(texCoord,depth);vec3 ddx=getViewPosFromTexCoord(texCoord+vec2(texelSize.x,0.))-viewPos;vec3 ddy=getViewPosFromTexCoord(texCoord+vec2(0.,texelSize.y))-viewPos;vec3 ddx2=viewPos-getViewPosFromTexCoord(texCoord+vec2(-texelSize.x,0.));if (abs(ddx.z)>abs(ddx2.z)) {ddx=ddx2;}\nvec3 ddy2=viewPos-getViewPosFromTexCoord(texCoord+vec2(0.,-texelSize.y));if (abs(ddy.z)>abs(ddy2.z)) {ddy=ddy2;}\nvec3 normal=normalize(cross(ddy,ddx));\n#ifdef FLUIDRENDERING_RHS\nnormal=-normal;\n#endif\n#ifndef WEBGPU\nif(isnan(normal.x) || isnan(normal.y) || isnan(normal.z) || isinf(normal.x) || isinf(normal.y) || isinf(normal.z)) {normal=vec3(0.,0.,-1.);}\n#endif\n#if defined(FLUIDRENDERING_DEBUG) && defined(FLUIDRENDERING_DEBUG_SHOWNORMAL)\nglFragColor=vec4(normal*0.5+0.5,1.0);return;\n#endif\nvec3 rayDir=normalize(viewPos); \n#ifdef FLUIDRENDERING_DIFFUSETEXTURE\nvec3 diffuseColor=textureLod(diffuseSampler,texCoord,0.0).rgb;\n#endif\nvec3 lightDir=normalize(vec3(viewMatrix*vec4(-dirLight,0.)));vec3 H =normalize(lightDir-rayDir);float specular=pow(max(0.0,dot(H,normal)),specularPower);\n#ifdef FLUIDRENDERING_DEBUG_DIFFUSERENDERING\nfloat diffuse =max(0.0,dot(lightDir,normal))*1.0;glFragColor=vec4(vec3(0.1) /*ambient*/+vec3(0.42,0.50,1.00)*diffuse+vec3(0,0,0.2)+specular,1.);return;\n#endif\nvec3 refractionDir=refract(rayDir,normal,ETA);vec4 transmitted=textureLod(textureSampler,vec2(texCoord+refractionDir.xy*thickness*refractionStrength),0.0);\n#ifdef FLUIDRENDERING_COMPOSITE_MODE\nif (transmitted.a==0.) transmitted.a=thickness;\n#endif\nvec3 transmittance=exp(-density*thickness*(1.0-diffuseColor)); \nvec3 refractionColor=transmitted.rgb*transmittance;\n#ifdef FLUIDRENDERING_ENVIRONMENT\nvec3 reflectionDir=reflect(rayDir,normal);vec3 reflectionColor=(textureCube(reflectionSampler,reflectionDir).rgb);float fresnel=clamp(F0+(1.0-F0)*pow(1.0-dot(normal,-rayDir),5.0),0.,fresnelClamp);vec3 finalColor=mix(refractionColor,reflectionColor,fresnel)+specular;\n#else\nvec3 finalColor=refractionColor+specular;\n#endif\n#ifdef FLUIDRENDERING_VELOCITY\nfloat velocity=depthVel.g;finalColor=mix(finalColor,vec3(1.0),smoothstep(0.3,1.0,velocity/6.0));\n#endif\nglFragColor=vec4(finalColor,transmitted.a);}\n";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},37065:(e,t,n)=>{n.d(t,{F5:()=>l,G$:()=>a,Ve:()=>o,Wl:()=>s,bQ:()=>h,fb:()=>p,kf:()=>c,pi:()=>d,xl:()=>u});var r=n(48810),i=n(8046);function o(e,t){return"{X: ".concat(e.x.toFixed(t)," Y: ").concat(e.y.toFixed(t),"}")}function a(e,t){return e.x*t.x+e.y*t.y+e.z*t.z}function s(e,t,n,r){return r.x=e,r.y=t,r.z=n,r}function l(e,t,n){return n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n}function c(e,t){return"{X: ".concat(e._x.toFixed(t)," Y: ").concat(e._y.toFixed(t)," Z: ").concat(e._z.toFixed(t),"}")}function u(e,t){return"{X: ".concat(e.x.toFixed(t)," Y: ").concat(e.y.toFixed(t)," Z: ").concat(e.z.toFixed(t)," W: ").concat(e.w.toFixed(t),"}")}function h(e,t){return 2*Math.acos((0,r.Clamp)(i.PT.Dot(e,t)))}function d(e,t){var n=new i.PT;return p(e,t,n),n}function p(e,t,n){var o=i.Pq.Cross(e,t),s=Math.acos((0,r.Clamp)(a(e,t),-1,1));return i.PT.RotationAxisToRef(o,s,n),n}},37113:(e,t,n)=>{n.r(t),n.d(t,{fluidRenderingParticleThicknessVertexShaderWGSL:()=>a});var r=n(98519),i="fluidRenderingParticleThicknessVertexShader",o="attribute position: vec3f;attribute offset: vec2f;uniform view: mat4x4f;uniform projection: mat4x4f;uniform size: vec2f;varying uv: vec2f;@vertex\nfn main(input: VertexInputs)->FragmentInputs {var cornerPos: vec3f=vec3f(\nvec2f(input.offset.x-0.5,input.offset.y-0.5)*uniforms.size,\n0.0\n);var viewPos: vec3f=(uniforms.view*vec4f(input.position,1.0)).xyz+cornerPos;vertexOutputs.position=uniforms.projection*vec4f(viewPos,1.0);vertexOutputs.uv=input.offset;}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},37411:(e,t,n)=>{n.d(t,{e:()=>i});var r=n(70511),i=function(){function e(){this._gpuTimeInFrameId=-1,this.counter=new r.A}return e.prototype._addDuration=function(e,t){e{n.r(t),n.d(t,{hdrIrradianceFilteringVertexShaderWGSL:()=>a});var r=n(98519),i="hdrIrradianceFilteringVertexShader",o="attribute position: vec2f;varying direction: vec3f;uniform up: vec3f;uniform right: vec3f;uniform front: vec3f;\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvar view: mat3x3f= mat3x3f(uniforms.up,uniforms.right,uniforms.front);vertexOutputs.direction=view*vec3f(input.position,1.0);vertexOutputs.position= vec4f(input.position,0.0,1.0);\n#define CUSTOM_VERTEX_MAIN_END\n}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},37494:(e,t,n)=>{n.r(t),n.d(t,{rgbdDecodePixelShaderWGSL:()=>a});var r=n(98519),i=(n(17393),"rgbdDecodePixelShader"),o="varying vUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d;\n#include\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {fragmentOutputs.color=vec4f(fromRGBD(textureSample(textureSampler,textureSamplerSampler,input.vUV)),1.0);}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},37530:(e,t,n)=>{n.d(t,{AV:()=>s,EL:()=>a,LW:()=>c,Tq:()=>o,UH:()=>i,jq:()=>r,nQ:()=>u,yS:()=>l});var r=function(e,t){return e.endsWith(t)},i=function(e,t){return!!e&&e.startsWith(t)},o=function(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var t="",n=0;n>2,o=(3&t)<<4|(n=u>4,a=(15&n)<<2|(r=u>6,s=63&r,isNaN(n)?a=s=64:isNaN(r)&&(s=64),c+=l.charAt(i)+l.charAt(o)+l.charAt(a)+l.charAt(s);return c},s=function(e){return atob(e)},l=function(e){for(var t=s(e),n=t.length,r=new Uint8Array(new ArrayBuffer(n)),i=0;i{n.d(t,{t:()=>s});var r=n(78322),i=n(95087),o=n(99157),a=n(84955),s=function(e){function t(t,n,r){var i=e.call(this,t,n,r)||this;return i._analyzer=null,i}return(0,r.C6)(t,e),Object.defineProperty(t.prototype,"analyzer",{get:function(){var e;return null!==(e=this._analyzer)&&void 0!==e?e:this._analyzer=new a.sQ(this._subGraph)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"volume",{get:function(){return(0,o.pN)(this._subGraph,"volume")},set:function(e){var t=(0,o.sf)(this._subGraph);if(!t)throw new Error("No volume subnode");t.volume=e},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){var t;e.prototype.dispose.call(this),null===(t=this._analyzer)||void 0===t||t.dispose(),this._analyzer=null,this._subGraph.dispose()},t.prototype.setVolume=function(e,t){void 0===t&&(t=null);var n=(0,o.sf)(this._subGraph);if(!n)throw new Error("No volume subnode");n.setVolume(e,t)},t}(i.Ui)},37592:(e,t,n)=>{n.r(t),n.d(t,{copyTexture3DLayerToTexturePixelShader:()=>a});var r=n(98519),i="copyTexture3DLayerToTexturePixelShader",o="precision highp sampler3D;uniform sampler3D textureSampler;uniform int layerNum;varying vec2 vUV;void main(void) {vec3 coord=vec3(0.0,0.0,float(layerNum));coord.xy=vec2(vUV.x,vUV.y)*vec2(textureSize(textureSampler,0).xy);vec3 color=texelFetch(textureSampler,ivec3(coord),0).rgb;gl_FragColor=vec4(color,1);}\n";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},37624:(e,t,n)=>{n.r(t),n.d(t,{oitBackBlendPixelShader:()=>a});var r=n(98519),i="oitBackBlendPixelShader",o="precision highp float;uniform sampler2D uBackColor;void main() {glFragColor=texelFetch(uBackColor,ivec2(gl_FragCoord.xy),0);if (glFragColor.a==0.0) { \ndiscard;}}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},37755:(e,t,n)=>{var r=n(98519),i="samplerFragmentDeclaration";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#ifdef _DEFINENAME_\n#if _DEFINENAME_DIRECTUV==1\n#define v_VARYINGNAME_UV vMainUV1\n#elif _DEFINENAME_DIRECTUV==2\n#define v_VARYINGNAME_UV vMainUV2\n#elif _DEFINENAME_DIRECTUV==3\n#define v_VARYINGNAME_UV vMainUV3\n#elif _DEFINENAME_DIRECTUV==4\n#define v_VARYINGNAME_UV vMainUV4\n#elif _DEFINENAME_DIRECTUV==5\n#define v_VARYINGNAME_UV vMainUV5\n#elif _DEFINENAME_DIRECTUV==6\n#define v_VARYINGNAME_UV vMainUV6\n#else\nvarying vec2 v_VARYINGNAME_UV;\n#endif\nuniform sampler2D _SAMPLERNAME_Sampler;\n#endif\n")},37886:(e,t,n)=>{var r=n(98519),i="pbrIBLFunctions";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="#if defined(REFLECTION) || defined(SS_REFRACTION)\nfn getLodFromAlphaG(cubeMapDimensionPixels: f32,microsurfaceAverageSlope: f32)->f32 {var microsurfaceAverageSlopeTexels: f32=cubeMapDimensionPixels*microsurfaceAverageSlope;var lod: f32=log2(microsurfaceAverageSlopeTexels);return lod;}\nfn getLinearLodFromRoughness(cubeMapDimensionPixels: f32,roughness: f32)->f32 {var lod: f32=log2(cubeMapDimensionPixels)*roughness;return lod;}\n#endif\n#if defined(ENVIRONMENTBRDF) && defined(RADIANCEOCCLUSION)\nfn environmentRadianceOcclusion(ambientOcclusion: f32,NdotVUnclamped: f32)->f32 {var temp: f32=NdotVUnclamped+ambientOcclusion;return saturate(temp*temp-1.0+ambientOcclusion);}\n#endif\n#if defined(ENVIRONMENTBRDF) && defined(HORIZONOCCLUSION)\nfn environmentHorizonOcclusion(view: vec3f,normal: vec3f,geometricNormal: vec3f)->f32 {var reflection: vec3f=reflect(view,normal);var temp: f32=saturate(1.0+1.1*dot(reflection,geometricNormal));return temp*temp;}\n#endif\n#if defined(LODINREFLECTIONALPHA) || defined(SS_LODINREFRACTIONALPHA)\nfn UNPACK_LOD(x: f32)->f32 {return (1.0-x)*255.0;}\nfn getLodFromAlphaGNdotV(cubeMapDimensionPixels: f32,alphaG: f32,NdotV: f32)->f32 {var microsurfaceAverageSlope: f32=alphaG;microsurfaceAverageSlope*=sqrt(abs(NdotV));return getLodFromAlphaG(cubeMapDimensionPixels,microsurfaceAverageSlope);}\n#endif\n")},37904:(e,t,n)=>{n.r(t),n.d(t,{TransformFeedbackBoundingHelper:()=>h});var r=n(62623),i=n(81152),o=n(85096),a=n(47424),s=n(8046),l=n(98519),c=(n(36470),n(64400),n(24444),n(67369),n(58266),n(84589),n(76898),n(49334),"gpuTransformVertexShader");l.l.ShadersStore[c]||(l.l.ShadersStore[c]="attribute vec3 position;\n#include\n#include\n#include\n#include[0..maxSimultaneousMorphTargets]\nout vec3 outPosition;const mat4 identity=mat4(\nvec4(1.0,0.0,0.0,0.0),\nvec4(0.0,1.0,0.0,0.0),\nvec4(0.0,0.0,1.0,0.0),\nvec4(0.0,0.0,0.0,1.0)\n);void main(void) {vec3 positionUpdated=position;\n#include\n#include[0..maxSimultaneousMorphTargets]\nmat4 finalWorld=identity;\n#include\n#include\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);outPosition=worldPos.xyz;}");var u="gpuTransformPixelShader";l.l.ShadersStore[u]||(l.l.ShadersStore[u]="#version 300 es\nvoid main() {discard;}\n");var h=function(){function e(e){this._buffers={},this._effects={},this._meshListCounter=0,this._engine=e}return e.prototype.processAsync=function(e){return Array.isArray(e)||(e=[e]),this._meshListCounter=0,this._processMeshList(e),Promise.resolve()},e.prototype._processMeshList=function(e){var t=this._engine.getCaps().parallelShaderCompile;this._engine.getCaps().parallelShaderCompile=void 0;for(var n=0;n4&&(l.push(r.R.MatricesIndicesExtraKind),l.push(r.R.MatricesWeightsExtraKind)),s.push("#define NUM_BONE_INFLUENCERS "+i.numBoneInfluencers),s.push("#define BONETEXTURE "+i.skeleton.isUsingTextureForMatrices),s.push("#define BonesPerMesh "+(i.skeleton.bones.length+1))):s.push("#define NUM_BONE_INFLUENCERS 0");var c=i.morphTargetManager?(0,o.Dk)(i.morphTargetManager,s,l,i,!0,!1,!1,!1,!1,!1):0,u=i.bakedVertexAnimationManager;u&&u.isEnabled&&(s.push("#define BAKED_VERTEX_ANIMATION_TEXTURE"),(0,o.J2)(l,i,s));var h=s.join("\n");if(this._effects[h])a=this._effects[h];else{var d={attributes:l,uniformsNames:["boneTextureWidth","mBones","morphTargetInfluences","morphTargetCount","morphTargetTextureInfo","morphTargetTextureIndices","bakedVertexAnimationSettings","bakedVertexAnimationTextureSizeInverted","bakedVertexAnimationTime"],uniformBuffersNames:[],samplers:["boneSampler","morphTargets","bakedVertexAnimationTexture"],defines:h,fallbacks:null,onCompiled:null,onError:null,indexParameters:{maxSimultaneousMorphTargets:c},maxSimultaneousLights:0,transformFeedbackVaryings:["outPosition"]};a=this._engine.createEffect("gpuTransform",d,this._engine),this._effects[h]=a}this._compute(i,a)}}this._engine.getCaps().parallelShaderCompile=t},e.prototype._compute=function(t,n){var s,l,c=this._engine,u=t.getTotalVertices();if(this._buffers[t.uniqueId])l=this._buffers[t.uniqueId];else{var h=new Float32Array(3*u);l=new r.h(t.getEngine(),h,!0,3),this._buffers[t.uniqueId]=l}n.getEngine().enableEffect(n),t._bindDirect(n,null,!0),(0,o.f$)(t,n),(0,o.nR)(t,n),t.morphTargetManager&&t.morphTargetManager.isUsingTextureForTargets&&t.morphTargetManager._bind(n);var d=t.bakedVertexAnimationManager;d&&d.isEnabled&&(null===(s=t.bakedVertexAnimationManager)||void 0===s||s.bind(n,!1));var p=l.getData();if(c.bindTransformFeedbackBuffer(l.getBuffer()),c.setRasterizerState(!1),c.beginTransformFeedback(!0),c.drawArraysType(i.Y.MATERIAL_PointFillMode,0,u),c.endTransformFeedback(),c.setRasterizerState(!0),c.readTransformFeedbackBuffer(p),c.bindTransformFeedbackBuffer(null),0===this._meshListCounter)t._refreshBoundingInfo(p,null);else{var f=t.getBoundingInfo().boundingBox,m=(0,a.b8)(p,0,u);e._Min.copyFrom(f.minimum).minimizeInPlace(m.minimum),e._Max.copyFrom(f.maximum).maximizeInPlace(m.maximum),t._refreshBoundingInfoDirect({minimum:e._Min,maximum:e._Max})}},e.prototype.registerMeshListAsync=function(e){return Array.isArray(e)||(e=[e]),this._meshList=e,this._meshListCounter=0,Promise.resolve()},e.prototype.processMeshList=function(){0!==this._meshList.length&&(this._processMeshList(this._meshList),this._meshListCounter++)},e.prototype.fetchResultsForMeshListAsync=function(){return this._meshListCounter=0,Promise.resolve()},e.prototype.dispose=function(){for(var e in this._buffers)this._buffers[e].dispose();this._buffers={},this._effects={},this._engine=null},e._Min=new s.Pq,e._Max=new s.Pq,e}()},37943:(e,t,n)=>{n.d(t,{n:()=>r});var r=function(){function e(){this.references=0,this.capacity=0,this.is32Bits=!1,this.uniqueId=e._Counter++}return Object.defineProperty(e.prototype,"underlyingResource",{get:function(){return null},enumerable:!1,configurable:!0}),e._Counter=0,e}()},38197:(e,t,n)=>{var r=n(98519),i="logDepthDeclaration";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="#ifdef LOGARITHMICDEPTH\nuniform logarithmicDepthConstant: f32;varying vFragmentDepth: f32;\n#endif\n")},38589:(e,t,n)=>{n.r(t),n.d(t,{colorPixelShader:()=>a});var r=n(98519),i=(n(27003),n(52767),n(39643),n(86343),"colorPixelShader"),o="#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\n#define VERTEXCOLOR\nvarying vec4 vColor;\n#else\nuniform vec4 color;\n#endif\n#include\n#include\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\ngl_FragColor=vColor;\n#else\ngl_FragColor=color;\n#endif\n#include(color,gl_FragColor)\n#define CUSTOM_FRAGMENT_MAIN_END\n}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},38615:(e,t,n)=>{var r=n(98519),i="instancesDeclaration";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#ifdef INSTANCES\nattribute vec4 world0;attribute vec4 world1;attribute vec4 world2;attribute vec4 world3;\n#ifdef INSTANCESCOLOR\nattribute vec4 instanceColor;\n#endif\n#if defined(THIN_INSTANCES) && !defined(WORLD_UBO)\nuniform mat4 world;\n#endif\n#if defined(VELOCITY) || defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) || defined(VELOCITY_LINEAR)\nattribute vec4 previousWorld0;attribute vec4 previousWorld1;attribute vec4 previousWorld2;attribute vec4 previousWorld3;\n#ifdef THIN_INSTANCES\nuniform mat4 previousWorld;\n#endif\n#endif\n#else\n#if !defined(WORLD_UBO)\nuniform mat4 world;\n#endif\n#if defined(VELOCITY) || defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) || defined(VELOCITY_LINEAR)\nuniform mat4 previousWorld;\n#endif\n#endif\n")},38810:(e,t,n)=>{n.d(t,{$Q:()=>h,X5:()=>c,wk:()=>u});var r=n(64726),i=n(8046),o=n(40099),a=n(88099),s=n(96832);function l(e){return"Vector2"===e||"Vector3"===e||"Vector4"===e||"Quaternion"===e||"Color3"===e||"Color4"===e}function c(e,t,n){var r,i,o=null!==(i=null===(r=null==t?void 0:t.getClassName)||void 0===r?void 0:r.call(t))&&void 0!==i?i:"";if(l(o)||function(e){return"Matrix"===e||"Matrix2D"===e||"Matrix3D"===e}(o))n[e]={value:t.asArray(),className:o};else if("FlowGraphInteger"===o)n[e]={value:t.value,className:o};else if(o&&(t.id||t.name))n[e]={id:t.id,name:t.name,className:o};else{if("object"==typeof t)throw new Error("Could not serialize value ".concat(t));n[e]=t}}function u(e,t,n,c){var h,d,p=t[e],f=null!==(h=null==p?void 0:p.type)&&void 0!==h?h:null==p?void 0:p.className;if(function(e){return"Mesh"===e||"AbstractMesh"===e||"GroundMesh"===e||"InstanceMesh"===e||"LinesMesh"===e||"GoldbergMesh"===e||"GreasedLineMesh"===e||"TrailMesh"===e}(f)){var m=c.meshes.filter((function(e){return p.id?e.id===p.id:e.name===p.name}));0===m.length&&(m=c.transformNodes.filter((function(e){return p.id?e.id===p.id:e.name===p.name}))),d=p.uniqueId?m.find((function(e){return e.uniqueId===p.uniqueId})):m[0]}else if(l(f))d=function(e,t,n){if(void 0===n&&(n=!1),"Vector2"===e)return i.I9.FromArray(t);if("Vector3"===e)return n&&(t[2]*=-1),i.Pq.FromArray(t);if("Vector4"===e)return i.IU.FromArray(t);if("Quaternion"===e)return n&&(t[2]*=-1,t[3]*=-1),i.PT.FromArray(t);if("Color3"===e)return new r.v9(t[0],t[1],t[2]);if("Color4"===e)return new r.ov(t[0],t[1],t[2],t[3]);throw new Error("Unknown vector class name ".concat(e))}(f,p.value);else if(function(e){return"AnimationGroup"===e}(f)){var _=c.animationGroups.filter((function(e){return e.name===p.name}));d=1===_.length?_[0]:_.find((function(e){return e.uniqueId===p.uniqueId}))}else d="Matrix"===f?i.uq.FromArray(p.value):"Matrix2D"===f?new s.K(p.value):"Matrix3D"===f?new s.z(p.value):"FlowGraphInteger"===f?o.P.FromValue(p.value):"number"===f||"string"===f||"boolean"===f?p.value[0]:p&&void 0!==p.value?p.value:Array.isArray(p)?p.reduce((function(e,t){return t.eventData?(e[t.id]={type:(0,a.Yd)(t.type)},void 0!==t.value&&(e[t.id].value=u("value",t,n,c)),e):e}),{}):p;return d}function h(e){return"FlowGraphJsonPointerParserBlock"===e}},38884:(e,t,n)=>{n.r(t),n.d(t,{bilateralBlurPixelShaderWGSL:()=>a});var r=n(98519),i="bilateralBlurPixelShader",o="var textureSamplerSampler: sampler;var textureSampler: texture_2d;var normalSamplerSampler: sampler;var normalSampler: texture_2d;var depthSamplerSampler: sampler;var depthSampler: texture_2d;uniform filterSize: i32;uniform blurDir: vec2f;uniform depthThreshold: f32;uniform normalThreshold: f32;varying vUV: vec2f;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var color: vec3f=textureSampleLevel(textureSampler,textureSamplerSampler,input.vUV,0.).rgb;var depth: f32=textureSampleLevel(depthSampler,depthSamplerSampler,input.vUV,0.).x;if (depth>=1e6 || depth<=0.) {fragmentOutputs.color= vec4f(color,1.);return fragmentOutputs;}\nvar normal: vec3f=textureSampleLevel(normalSampler,normalSamplerSampler,input.vUV,0.).rgb;\n#ifdef DECODE_NORMAL\nnormal=normal*2.0-1.0;\n#endif\nvar sigma: f32= f32(uniforms.filterSize);var two_sigma2: f32=2.0*sigma*sigma;var sigmaDepth: f32=uniforms.depthThreshold;var two_sigmaDepth2: f32=2.0*sigmaDepth*sigmaDepth;var sigmaNormal: f32=uniforms.normalThreshold;var two_sigmaNormal2: f32=2.0*sigmaNormal*sigmaNormal;var sum: vec3f= vec3f(0.);var wsum: f32=0.;for (var x: i32=-uniforms.filterSize; x<=uniforms.filterSize; x++) {var coords=vec2f(f32(x));var sampleColor: vec3f=textureSampleLevel(textureSampler,textureSamplerSampler,input.vUV+coords*uniforms.blurDir,0.).rgb;var sampleDepth: f32=textureSampleLevel(depthSampler,depthSamplerSampler,input.vUV+coords*uniforms.blurDir,0.).r;var sampleNormal: vec3f=textureSampleLevel(normalSampler,normalSamplerSampler,input.vUV+coords*uniforms.blurDir,0.).rgb;\n#ifdef DECODE_NORMAL\nsampleNormal=sampleNormal*2.0-1.0;\n#endif\nvar r: f32=dot(coords,coords);var w: f32=exp(-r/two_sigma2);var depthDelta: f32=abs(sampleDepth-depth);var wd: f32=step(depthDelta,uniforms.depthThreshold);var normalDelta: vec3f=abs(sampleNormal-normal);var wn: f32=step(normalDelta.x+normalDelta.y+normalDelta.z,uniforms.normalThreshold);sum+=sampleColor*w*wd*wn;wsum+=w*wd*wn;}\nfragmentOutputs.color= vec4f(sum/wsum,1.);}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},39407:(e,t,n)=>{n.r(t),n.d(t,{FlowGraphMeshPickEventBlock:()=>c});var r=n(78322),i=n(90279),o=n(64391),a=n(34623),s=n(95803),l=n(88099),c=function(e){function t(t){var n=e.call(this,t)||this;return n.config=t,n.type="MeshPick",n.asset=n.registerDataInput("asset",l.Vv,null==t?void 0:t.targetMesh),n.pickedPoint=n.registerDataOutput("pickedPoint",l.Dx),n.pickOrigin=n.registerDataOutput("pickOrigin",l.Dx),n.pointerId=n.registerDataOutput("pointerId",l.Es),n.pickedMesh=n.registerDataOutput("pickedMesh",l.Vv),n.pointerType=n.registerDataInput("pointerType",l.Vv,o.Zp.POINTERPICK),n}return(0,r.C6)(t,e),t.prototype._getReferencedMesh=function(e){return this.asset.getValue(e)},t.prototype._executeEvent=function(e,t){var n,r,i,o,a;if(this.pointerType.getValue(e)!==t.type)return!0;var l=this._getReferencedMesh(e);return l&&(null===(n=t.pickInfo)||void 0===n?void 0:n.pickedMesh)&&((null===(r=t.pickInfo)||void 0===r?void 0:r.pickedMesh)===l||(0,s.Ah)(null===(i=t.pickInfo)||void 0===i?void 0:i.pickedMesh,l))?(this.pointerId.setValue(t.event.pointerId,e),this.pickOrigin.setValue(null===(o=t.pickInfo.ray)||void 0===o?void 0:o.origin,e),this.pickedPoint.setValue(t.pickInfo.pickedPoint,e),this.pickedMesh.setValue(t.pickInfo.pickedMesh,e),this._execute(e),!(null===(a=this.config)||void 0===a?void 0:a.stopPropagation)):(this.pointerId.resetToDefaultValue(e),this.pickOrigin.resetToDefaultValue(e),this.pickedPoint.resetToDefaultValue(e),this.pickedMesh.resetToDefaultValue(e),!0)},t.prototype._preparePendingTasks=function(e){},t.prototype._cancelPendingTasks=function(e){},t.prototype.getClassName=function(){return"FlowGraphMeshPickEventBlock"},t}(i.i);(0,a.Y5)("FlowGraphMeshPickEventBlock",c)},39643:(e,t,n)=>{n.r(t),n.d(t,{clipPlaneFragment:()=>a});var r=n(98519),i="clipPlaneFragment",o="#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4) || defined(CLIPPLANE5) || defined(CLIPPLANE6)\nif (false) {}\n#endif\n#ifdef CLIPPLANE\nelse if (fClipDistance>0.0)\n{discard;}\n#endif\n#ifdef CLIPPLANE2\nelse if (fClipDistance2>0.0)\n{discard;}\n#endif\n#ifdef CLIPPLANE3\nelse if (fClipDistance3>0.0)\n{discard;}\n#endif\n#ifdef CLIPPLANE4\nelse if (fClipDistance4>0.0)\n{discard;}\n#endif\n#ifdef CLIPPLANE5\nelse if (fClipDistance5>0.0)\n{discard;}\n#endif\n#ifdef CLIPPLANE6\nelse if (fClipDistance6>0.0)\n{discard;}\n#endif\n";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]=o);var a={name:i,shader:o}},39721:(e,t,n)=>{n.r(t),n.d(t,{meshUVSpaceRendererMaskerVertexShaderWGSL:()=>a});var r=n(98519),i="meshUVSpaceRendererMaskerVertexShader",o="attribute uv: vec2f;varying vUV: vec2f;@vertex\nfn main(input : VertexInputs)->FragmentInputs {vertexOutputs.position= vec4f( vec2f(input.uv.x,input.uv.y)*2.0-1.0,0.,1.0);vertexOutputs.vUV=input.uv;}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},39768:(e,t,n)=>{n.r(t),n.d(t,{iblVoxelGrid2dArrayDebugPixelShaderWGSL:()=>a});var r=n(98519),i="iblVoxelGrid2dArrayDebugPixelShader",o="varying vUV: vec2f;var voxelTextureSampler: sampler;var voxelTexture: texture_3d;var textureSamplerSampler: sampler;var textureSampler: texture_2d;uniform slice: i32;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var size: vec3u=textureDimensions(voxelTexture,0);var dimension: f32=sqrt( f32(size.z));var samplePos: vec2f=fract(input.vUV.xy* vec2f(dimension));var sampleIndex: u32= u32(floor(input.vUV.x* f32(dimension))+floor(input.vUV.y* f32(dimension))*dimension);var color=textureSample(voxelTexture,voxelTextureSampler, vec3f(samplePos.xy,sampleIndex)).rrr;color+=textureSample(textureSampler,textureSamplerSampler,input.vUV.xy).rgb;fragmentOutputs.color=vec4f(color,1.0);}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},39790:(e,t,n)=>{n.r(t),n.d(t,{lodPixelShaderWGSL:()=>a});var r=n(98519),i="lodPixelShader",o="const GammaEncodePowerApprox=1.0/2.2;varying vUV: vec2f;var textureSampler: texture_2d;uniform lod: f32;uniform gamma: i32;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {let textureSize=textureDimensions(textureSampler);fragmentOutputs.color=textureLoad(textureSampler,vec2u(fragmentInputs.vUV*vec2f(textureSize)),u32(uniforms.lod));if (uniforms.gamma==0) {fragmentOutputs.color=vec4f(pow(fragmentOutputs.color.rgb,vec3f(GammaEncodePowerApprox)),fragmentOutputs.color.a);}}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},39813:(e,t,n)=>{var r=n(75768),i=n(28081);i.t.prototype.forceSphericalPolynomialsRecompute=function(){this._texture&&(this._texture._sphericalPolynomial=null,this._texture._sphericalPolynomialPromise=null,this._texture._sphericalPolynomialComputed=!1)},Object.defineProperty(i.t.prototype,"sphericalPolynomial",{get:function(){var e=this;if(this._texture){if(this._texture._sphericalPolynomial||this._texture._sphericalPolynomialComputed)return this._texture._sphericalPolynomial;if(this._texture.isReady)return this._texture._sphericalPolynomialPromise||(this._texture._sphericalPolynomialPromise=r.d.ConvertCubeMapTextureToSphericalPolynomial(this),null===this._texture._sphericalPolynomialPromise?this._texture._sphericalPolynomialComputed=!0:this._texture._sphericalPolynomialPromise.then((function(t){e._texture._sphericalPolynomial=t,e._texture._sphericalPolynomialComputed=!0}))),null}return null},set:function(e){this._texture&&(this._texture._sphericalPolynomial=e)},enumerable:!0,configurable:!0})},40002:(e,t,n)=>{n.r(t),n.d(t,{meshUVSpaceRendererPixelShaderWGSL:()=>a});var r=n(98519),i="meshUVSpaceRendererPixelShader",o="varying vDecalTC: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {if (input.vDecalTC.x<0. || input.vDecalTC.x>1. || input.vDecalTC.y<0. || input.vDecalTC.y>1.) {discard;}\nfragmentOutputs.color=textureSample(textureSampler,textureSamplerSampler,input.vDecalTC);}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},40099:(e,t,n)=>{n.d(t,{P:()=>i});var r=n(34623),i=function(){function e(e){this.value=this._toInt(e)}return e.prototype._toInt=function(e){return 0|e},e.prototype.add=function(t){return new e(this.value+t.value)},e.prototype.subtract=function(t){return new e(this.value-t.value)},e.prototype.multiply=function(t){return new e(Math.imul(this.value,t.value))},e.prototype.divide=function(t){return new e(this.value/t.value)},e.prototype.getClassName=function(){return e.ClassName},e.prototype.equals=function(e){return this.value===e.value},e.FromValue=function(t){return new e(t)},e.prototype.toString=function(){return this.value.toString()},e.ClassName="FlowGraphInteger",e}();(0,r.Y5)("FlowGraphInteger",i)},40150:(e,t,n)=>{n.r(t),n.d(t,{reflectionFunction:()=>a});var r=n(98519),i="reflectionFunction",o="vec3 computeFixedEquirectangularCoords(vec4 worldPos,vec3 worldNormal,vec3 direction)\n{float lon=atan(direction.z,direction.x);float lat=acos(direction.y);vec2 sphereCoords=vec2(lon,lat)*RECIPROCAL_PI2*2.0;float s=sphereCoords.x*0.5+0.5;float t=sphereCoords.y;return vec3(s,t,0); }\nvec3 computeMirroredFixedEquirectangularCoords(vec4 worldPos,vec3 worldNormal,vec3 direction)\n{float lon=atan(direction.z,direction.x);float lat=acos(direction.y);vec2 sphereCoords=vec2(lon,lat)*RECIPROCAL_PI2*2.0;float s=sphereCoords.x*0.5+0.5;float t=sphereCoords.y;return vec3(1.0-s,t,0); }\nvec3 computeEquirectangularCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix)\n{vec3 cameraToVertex=normalize(worldPos.xyz-eyePosition);vec3 r=normalize(reflect(cameraToVertex,worldNormal));r=vec3(reflectionMatrix*vec4(r,0));float lon=atan(r.z,r.x);float lat=acos(r.y);vec2 sphereCoords=vec2(lon,lat)*RECIPROCAL_PI2*2.0;float s=sphereCoords.x*0.5+0.5;float t=sphereCoords.y;return vec3(s,t,0);}\nvec3 computeSphericalCoords(vec4 worldPos,vec3 worldNormal,mat4 view,mat4 reflectionMatrix)\n{vec3 viewDir=normalize(vec3(view*worldPos));vec3 viewNormal=normalize(vec3(view*vec4(worldNormal,0.0)));vec3 r=reflect(viewDir,viewNormal);r=vec3(reflectionMatrix*vec4(r,0));r.z=r.z-1.0;float m=2.0*length(r);return vec3(r.x/m+0.5,1.0-r.y/m-0.5,0);}\nvec3 computePlanarCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix)\n{vec3 viewDir=worldPos.xyz-eyePosition;vec3 coords=normalize(reflect(viewDir,worldNormal));return vec3(reflectionMatrix*vec4(coords,1));}\nvec3 computeCubicCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix)\n{vec3 viewDir=normalize(worldPos.xyz-eyePosition);vec3 coords=reflect(viewDir,worldNormal);coords=vec3(reflectionMatrix*vec4(coords,0));\n#ifdef INVERTCUBICMAP\ncoords.y*=-1.0;\n#endif\nreturn coords;}\nvec3 computeCubicLocalCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix,vec3 reflectionSize,vec3 reflectionPosition)\n{vec3 viewDir=normalize(worldPos.xyz-eyePosition);vec3 coords=reflect(viewDir,worldNormal);coords=parallaxCorrectNormal(worldPos.xyz,coords,reflectionSize,reflectionPosition);coords=vec3(reflectionMatrix*vec4(coords,0));\n#ifdef INVERTCUBICMAP\ncoords.y*=-1.0;\n#endif\nreturn coords;}\nvec3 computeProjectionCoords(vec4 worldPos,mat4 view,mat4 reflectionMatrix)\n{return vec3(reflectionMatrix*(view*worldPos));}\nvec3 computeSkyBoxCoords(vec3 positionW,mat4 reflectionMatrix)\n{return vec3(reflectionMatrix*vec4(positionW,1.));}\n#ifdef REFLECTION\nvec3 computeReflectionCoords(vec4 worldPos,vec3 worldNormal)\n{\n#ifdef REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED\nvec3 direction=normalize(vDirectionW);return computeMirroredFixedEquirectangularCoords(worldPos,worldNormal,direction);\n#endif\n#ifdef REFLECTIONMAP_EQUIRECTANGULAR_FIXED\nvec3 direction=normalize(vDirectionW);return computeFixedEquirectangularCoords(worldPos,worldNormal,direction);\n#endif\n#ifdef REFLECTIONMAP_EQUIRECTANGULAR\nreturn computeEquirectangularCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix);\n#endif\n#ifdef REFLECTIONMAP_SPHERICAL\nreturn computeSphericalCoords(worldPos,worldNormal,view,reflectionMatrix);\n#endif\n#ifdef REFLECTIONMAP_PLANAR\nreturn computePlanarCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix);\n#endif\n#ifdef REFLECTIONMAP_CUBIC\n#ifdef USE_LOCAL_REFLECTIONMAP_CUBIC\nreturn computeCubicLocalCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix,vReflectionSize,vReflectionPosition);\n#else\nreturn computeCubicCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix);\n#endif\n#endif\n#ifdef REFLECTIONMAP_PROJECTION\nreturn computeProjectionCoords(worldPos,view,reflectionMatrix);\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nreturn computeSkyBoxCoords(vPositionUVW,reflectionMatrix);\n#endif\n#ifdef REFLECTIONMAP_EXPLICIT\nreturn vec3(0,0,0);\n#endif\n}\n#endif\n";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]=o);var a={name:i,shader:o}},40246:(e,t,n)=>{var r=n(98519),i="pbrHelperFunctions";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#define MINIMUMVARIANCE 0.0005\nfloat convertRoughnessToAverageSlope(float roughness)\n{return square(roughness)+MINIMUMVARIANCE;}\nfloat fresnelGrazingReflectance(float reflectance0) {float reflectance90=saturate(reflectance0*25.0);return reflectance90;}\nvec2 getAARoughnessFactors(vec3 normalVector) {\n#ifdef SPECULARAA\nvec3 nDfdx=dFdx(normalVector.xyz);vec3 nDfdy=dFdy(normalVector.xyz);float slopeSquare=max(dot(nDfdx,nDfdx),dot(nDfdy,nDfdy));float geometricRoughnessFactor=pow(saturate(slopeSquare),0.333);float geometricAlphaGFactor=sqrt(slopeSquare);geometricAlphaGFactor*=0.75;return vec2(geometricRoughnessFactor,geometricAlphaGFactor);\n#else\nreturn vec2(0.);\n#endif\n}\n#ifdef ANISOTROPIC\n#ifdef ANISOTROPIC_LEGACY\nvec2 getAnisotropicRoughness(float alphaG,float anisotropy) {float alphaT=max(alphaG*(1.0+anisotropy),MINIMUMVARIANCE);float alphaB=max(alphaG*(1.0-anisotropy),MINIMUMVARIANCE);return vec2(alphaT,alphaB);}\nvec3 getAnisotropicBentNormals(const vec3 T,const vec3 B,const vec3 N,const vec3 V,float anisotropy,float roughness) {vec3 anisotropicFrameDirection;if (anisotropy>=0.0) {anisotropicFrameDirection=B;} else {anisotropicFrameDirection=T;}\nvec3 anisotropicFrameTangent=cross(normalize(anisotropicFrameDirection),V);vec3 anisotropicFrameNormal=cross(anisotropicFrameTangent,anisotropicFrameDirection);vec3 anisotropicNormal=normalize(mix(N,anisotropicFrameNormal,abs(anisotropy)));return anisotropicNormal;}\n#elif ANISOTROPIC_OPENPBR\nvec2 getAnisotropicRoughness(float alphaG,float anisotropy) {float alphaT=alphaG*sqrt(2.0/(1.0+(1.0-anisotropy)*(1.0-anisotropy)));float alphaB=max(alphaT*(1.0-anisotropy),MINIMUMVARIANCE);return vec2(alphaT,alphaB);}\n#else\nvec2 getAnisotropicRoughness(float alphaG,float anisotropy) {float alphaT=max(mix(alphaG,1.0,anisotropy*anisotropy),MINIMUMVARIANCE);float alphaB=max(alphaG,MINIMUMVARIANCE);return vec2(alphaT,alphaB);}\nvec3 getAnisotropicBentNormals(const vec3 T,const vec3 B,const vec3 N,const vec3 V,float anisotropy,float roughness) {vec3 bentNormal=cross(B,V);bentNormal=normalize(cross(bentNormal,B));float a=square(square(1.0-anisotropy*(1.0-roughness)));bentNormal=normalize(mix(bentNormal,N,a));return bentNormal;}\n#endif\n#endif\n#if defined(CLEARCOAT) || defined(SS_REFRACTION)\nvec3 cocaLambert(vec3 alpha,float distance) {return exp(-alpha*distance);}\nvec3 cocaLambert(float NdotVRefract,float NdotLRefract,vec3 alpha,float thickness) {return cocaLambert(alpha,(thickness*((NdotLRefract+NdotVRefract)/(NdotLRefract*NdotVRefract))));}\nvec3 computeColorAtDistanceInMedia(vec3 color,float distance) {return -log(color)/distance;}\nvec3 computeClearCoatAbsorption(float NdotVRefract,float NdotLRefract,vec3 clearCoatColor,float clearCoatThickness,float clearCoatIntensity) {vec3 clearCoatAbsorption=mix(vec3(1.0),\ncocaLambert(NdotVRefract,NdotLRefract,clearCoatColor,clearCoatThickness),\nclearCoatIntensity);return clearCoatAbsorption;}\n#endif\n#ifdef MICROSURFACEAUTOMATIC\nfloat computeDefaultMicroSurface(float microSurface,vec3 reflectivityColor)\n{const float kReflectivityNoAlphaWorkflow_SmoothnessMax=0.95;float reflectivityLuminance=getLuminance(reflectivityColor);float reflectivityLuma=sqrt(reflectivityLuminance);microSurface=reflectivityLuma*kReflectivityNoAlphaWorkflow_SmoothnessMax;return microSurface;}\n#endif\n")},40647:(e,t,n)=>{var r=n(98519),i="meshUboDeclaration";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="struct Mesh {world : mat4x4,\nvisibility : f32,};var mesh : Mesh;\n#define WORLD_UBO\n")},40682:(e,t,n)=>{n.r(t),n.d(t,{pbrPixelShader:()=>I});var r=n(98519),i=(n(42107),n(81751),n(77740),"pbrFragmentDeclaration");r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="uniform vec4 vEyePosition;uniform vec3 vReflectionColor;uniform vec4 vAlbedoColor;uniform float baseWeight;uniform float baseDiffuseRoughness;uniform vec4 vLightingIntensity;uniform vec4 vReflectivityColor;uniform vec4 vMetallicReflectanceFactors;uniform vec3 vEmissiveColor;uniform float visibility;uniform vec3 vAmbientColor;\n#ifdef ALBEDO\nuniform vec2 vAlbedoInfos;\n#endif\n#ifdef BASE_WEIGHT\nuniform vec2 vBaseWeightInfos;\n#endif\n#ifdef BASE_DIFFUSE_ROUGHNESS\nuniform vec2 vBaseDiffuseRoughnessInfos;\n#endif\n#ifdef AMBIENT\nuniform vec4 vAmbientInfos;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;uniform vec2 vTangentSpaceParams;\n#endif\n#ifdef OPACITY\nuniform vec2 vOpacityInfos;\n#endif\n#ifdef EMISSIVE\nuniform vec2 vEmissiveInfos;\n#endif\n#ifdef LIGHTMAP\nuniform vec2 vLightmapInfos;\n#endif\n#ifdef REFLECTIVITY\nuniform vec3 vReflectivityInfos;\n#endif\n#ifdef MICROSURFACEMAP\nuniform vec2 vMicroSurfaceSamplerInfos;\n#endif\n#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(SS_REFRACTION) || defined(PREPASS)\nuniform mat4 view;\n#endif\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;\n#ifdef REALTIME_FILTERING\nuniform vec2 vReflectionFilteringInfo;\n#endif\nuniform mat4 reflectionMatrix;uniform vec3 vReflectionMicrosurfaceInfos;\n#if defined(USEIRRADIANCEMAP) && defined(USE_IRRADIANCE_DOMINANT_DIRECTION)\nuniform vec3 vReflectionDominantDirection;\n#endif\n#if defined(USE_LOCAL_REFLECTIONMAP_CUBIC) && defined(REFLECTIONMAP_CUBIC)\nuniform vec3 vReflectionPosition;uniform vec3 vReflectionSize;\n#endif\n#endif\n#if defined(SS_REFRACTION) && defined(SS_USE_LOCAL_REFRACTIONMAP_CUBIC)\nuniform vec3 vRefractionPosition;uniform vec3 vRefractionSize;\n#endif\n#ifdef CLEARCOAT\nuniform vec2 vClearCoatParams;uniform vec4 vClearCoatRefractionParams;\n#if defined(CLEARCOAT_TEXTURE) || defined(CLEARCOAT_TEXTURE_ROUGHNESS)\nuniform vec4 vClearCoatInfos;\n#endif\n#ifdef CLEARCOAT_TEXTURE\nuniform mat4 clearCoatMatrix;\n#endif\n#ifdef CLEARCOAT_TEXTURE_ROUGHNESS\nuniform mat4 clearCoatRoughnessMatrix;\n#endif\n#ifdef CLEARCOAT_BUMP\nuniform vec2 vClearCoatBumpInfos;uniform vec2 vClearCoatTangentSpaceParams;uniform mat4 clearCoatBumpMatrix;\n#endif\n#ifdef CLEARCOAT_TINT\nuniform vec4 vClearCoatTintParams;uniform float clearCoatColorAtDistance;\n#ifdef CLEARCOAT_TINT_TEXTURE\nuniform vec2 vClearCoatTintInfos;uniform mat4 clearCoatTintMatrix;\n#endif\n#endif\n#endif\n#ifdef IRIDESCENCE\nuniform vec4 vIridescenceParams;\n#if defined(IRIDESCENCE_TEXTURE) || defined(IRIDESCENCE_THICKNESS_TEXTURE)\nuniform vec4 vIridescenceInfos;\n#endif\n#ifdef IRIDESCENCE_TEXTURE\nuniform mat4 iridescenceMatrix;\n#endif\n#ifdef IRIDESCENCE_THICKNESS_TEXTURE\nuniform mat4 iridescenceThicknessMatrix;\n#endif\n#endif\n#ifdef ANISOTROPIC\nuniform vec3 vAnisotropy;\n#ifdef ANISOTROPIC_TEXTURE\nuniform vec2 vAnisotropyInfos;uniform mat4 anisotropyMatrix;\n#endif\n#endif\n#ifdef SHEEN\nuniform vec4 vSheenColor;\n#ifdef SHEEN_ROUGHNESS\nuniform float vSheenRoughness;\n#endif\n#if defined(SHEEN_TEXTURE) || defined(SHEEN_TEXTURE_ROUGHNESS)\nuniform vec4 vSheenInfos;\n#endif\n#ifdef SHEEN_TEXTURE\nuniform mat4 sheenMatrix;\n#endif\n#ifdef SHEEN_TEXTURE_ROUGHNESS\nuniform mat4 sheenRoughnessMatrix;\n#endif\n#endif\n#ifdef SUBSURFACE\n#ifdef SS_REFRACTION\nuniform vec4 vRefractionMicrosurfaceInfos;uniform vec4 vRefractionInfos;uniform mat4 refractionMatrix;\n#ifdef REALTIME_FILTERING\nuniform vec2 vRefractionFilteringInfo;\n#endif\n#ifdef SS_DISPERSION\nuniform float dispersion;\n#endif\n#endif\n#ifdef SS_THICKNESSANDMASK_TEXTURE\nuniform vec2 vThicknessInfos;uniform mat4 thicknessMatrix;\n#endif\n#ifdef SS_REFRACTIONINTENSITY_TEXTURE\nuniform vec2 vRefractionIntensityInfos;uniform mat4 refractionIntensityMatrix;\n#endif\n#ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE\nuniform vec2 vTranslucencyIntensityInfos;uniform mat4 translucencyIntensityMatrix;\n#endif\nuniform vec2 vThicknessParam;uniform vec3 vDiffusionDistance;uniform vec4 vTintColor;uniform vec3 vSubSurfaceIntensity;uniform vec4 vTranslucencyColor;\n#ifdef SS_TRANSLUCENCYCOLOR_TEXTURE\nuniform vec2 vTranslucencyColorInfos;uniform mat4 translucencyColorMatrix;\n#endif\n#endif\n#ifdef PREPASS\n#ifdef SS_SCATTERING\nuniform float scatteringDiffusionProfile;\n#endif\n#endif\n#if DEBUGMODE>0\nuniform vec2 vDebugMode;\n#endif\n#ifdef DETAIL\nuniform vec4 vDetailInfos;\n#endif\n#include\n#ifdef USESPHERICALFROMREFLECTIONMAP\n#ifdef SPHERICAL_HARMONICS\nuniform vec3 vSphericalL00;uniform vec3 vSphericalL1_1;uniform vec3 vSphericalL10;uniform vec3 vSphericalL11;uniform vec3 vSphericalL2_2;uniform vec3 vSphericalL2_1;uniform vec3 vSphericalL20;uniform vec3 vSphericalL21;uniform vec3 vSphericalL22;\n#else\nuniform vec3 vSphericalX;uniform vec3 vSphericalY;uniform vec3 vSphericalZ;uniform vec3 vSphericalXX_ZZ;uniform vec3 vSphericalYY_ZZ;uniform vec3 vSphericalZZ;uniform vec3 vSphericalXY;uniform vec3 vSphericalYZ;uniform vec3 vSphericalZX;\n#endif\n#endif\n#define ADDITIONAL_FRAGMENT_DECLARATION\n"),n(48915),n(58953),n(87283),n(32823),n(37755);var o="samplerFragmentAlternateDeclaration";r.l.IncludesShadersStore[o]||(r.l.IncludesShadersStore[o]="#ifdef _DEFINENAME_\n#if _DEFINENAME_DIRECTUV==1\n#define v_VARYINGNAME_UV vMainUV1\n#elif _DEFINENAME_DIRECTUV==2\n#define v_VARYINGNAME_UV vMainUV2\n#elif _DEFINENAME_DIRECTUV==3\n#define v_VARYINGNAME_UV vMainUV3\n#elif _DEFINENAME_DIRECTUV==4\n#define v_VARYINGNAME_UV vMainUV4\n#elif _DEFINENAME_DIRECTUV==5\n#define v_VARYINGNAME_UV vMainUV5\n#elif _DEFINENAME_DIRECTUV==6\n#define v_VARYINGNAME_UV vMainUV6\n#else\nvarying vec2 v_VARYINGNAME_UV;\n#endif\n#endif\n");var a="pbrFragmentSamplersDeclaration";r.l.IncludesShadersStore[a]||(r.l.IncludesShadersStore[a]="#include(_DEFINENAME_,ALBEDO,_VARYINGNAME_,Albedo,_SAMPLERNAME_,albedo)\n#include(_DEFINENAME_,BASE_WEIGHT,_VARYINGNAME_,BaseWeight,_SAMPLERNAME_,baseWeight)\n#include(_DEFINENAME_,BASE_DIFFUSE_ROUGHNESS,_VARYINGNAME_,BaseDiffuseRoughness,_SAMPLERNAME_,baseDiffuseRoughness)\n#include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_SAMPLERNAME_,ambient)\n#include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_SAMPLERNAME_,opacity)\n#include(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_SAMPLERNAME_,emissive)\n#include(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_SAMPLERNAME_,lightmap)\n#include(_DEFINENAME_,REFLECTIVITY,_VARYINGNAME_,Reflectivity,_SAMPLERNAME_,reflectivity)\n#include(_DEFINENAME_,MICROSURFACEMAP,_VARYINGNAME_,MicroSurfaceSampler,_SAMPLERNAME_,microSurface)\n#include(_DEFINENAME_,METALLIC_REFLECTANCE,_VARYINGNAME_,MetallicReflectance,_SAMPLERNAME_,metallicReflectance)\n#include(_DEFINENAME_,REFLECTANCE,_VARYINGNAME_,Reflectance,_SAMPLERNAME_,reflectance)\n#include(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_SAMPLERNAME_,decal)\n#ifdef CLEARCOAT\n#include(_DEFINENAME_,CLEARCOAT_TEXTURE,_VARYINGNAME_,ClearCoat,_SAMPLERNAME_,clearCoat)\n#include(_DEFINENAME_,CLEARCOAT_TEXTURE_ROUGHNESS,_VARYINGNAME_,ClearCoatRoughness)\n#if defined(CLEARCOAT_TEXTURE_ROUGHNESS)\nuniform sampler2D clearCoatRoughnessSampler;\n#endif\n#include(_DEFINENAME_,CLEARCOAT_BUMP,_VARYINGNAME_,ClearCoatBump,_SAMPLERNAME_,clearCoatBump)\n#include(_DEFINENAME_,CLEARCOAT_TINT_TEXTURE,_VARYINGNAME_,ClearCoatTint,_SAMPLERNAME_,clearCoatTint)\n#endif\n#ifdef IRIDESCENCE\n#include(_DEFINENAME_,IRIDESCENCE_TEXTURE,_VARYINGNAME_,Iridescence,_SAMPLERNAME_,iridescence)\n#include(_DEFINENAME_,IRIDESCENCE_THICKNESS_TEXTURE,_VARYINGNAME_,IridescenceThickness,_SAMPLERNAME_,iridescenceThickness)\n#endif\n#ifdef SHEEN\n#include(_DEFINENAME_,SHEEN_TEXTURE,_VARYINGNAME_,Sheen,_SAMPLERNAME_,sheen)\n#include(_DEFINENAME_,SHEEN_TEXTURE_ROUGHNESS,_VARYINGNAME_,SheenRoughness)\n#if defined(SHEEN_ROUGHNESS) && defined(SHEEN_TEXTURE_ROUGHNESS)\nuniform sampler2D sheenRoughnessSampler;\n#endif\n#endif\n#ifdef ANISOTROPIC\n#include(_DEFINENAME_,ANISOTROPIC_TEXTURE,_VARYINGNAME_,Anisotropy,_SAMPLERNAME_,anisotropy)\n#endif\n#ifdef REFLECTION\n#ifdef REFLECTIONMAP_3D\n#define sampleReflection(s,c) textureCube(s,c)\nuniform samplerCube reflectionSampler;\n#ifdef LODBASEDMICROSFURACE\n#define sampleReflectionLod(s,c,l) textureCubeLodEXT(s,c,l)\n#else\nuniform samplerCube reflectionSamplerLow;uniform samplerCube reflectionSamplerHigh;\n#endif\n#ifdef USEIRRADIANCEMAP\nuniform samplerCube irradianceSampler;\n#endif\n#else\n#define sampleReflection(s,c) texture2D(s,c)\nuniform sampler2D reflectionSampler;\n#ifdef LODBASEDMICROSFURACE\n#define sampleReflectionLod(s,c,l) texture2DLodEXT(s,c,l)\n#else\nuniform sampler2D reflectionSamplerLow;uniform sampler2D reflectionSamplerHigh;\n#endif\n#ifdef USEIRRADIANCEMAP\nuniform sampler2D irradianceSampler;\n#endif\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#else\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#endif\n#endif\n#ifdef ENVIRONMENTBRDF\nuniform sampler2D environmentBrdfSampler;\n#endif\n#ifdef SUBSURFACE\n#ifdef SS_REFRACTION\n#ifdef SS_REFRACTIONMAP_3D\n#define sampleRefraction(s,c) textureCube(s,c)\nuniform samplerCube refractionSampler;\n#ifdef LODBASEDMICROSFURACE\n#define sampleRefractionLod(s,c,l) textureCubeLodEXT(s,c,l)\n#else\nuniform samplerCube refractionSamplerLow;uniform samplerCube refractionSamplerHigh;\n#endif\n#else\n#define sampleRefraction(s,c) texture2D(s,c)\nuniform sampler2D refractionSampler;\n#ifdef LODBASEDMICROSFURACE\n#define sampleRefractionLod(s,c,l) texture2DLodEXT(s,c,l)\n#else\nuniform sampler2D refractionSamplerLow;uniform sampler2D refractionSamplerHigh;\n#endif\n#endif\n#endif\n#include(_DEFINENAME_,SS_THICKNESSANDMASK_TEXTURE,_VARYINGNAME_,Thickness,_SAMPLERNAME_,thickness)\n#include(_DEFINENAME_,SS_REFRACTIONINTENSITY_TEXTURE,_VARYINGNAME_,RefractionIntensity,_SAMPLERNAME_,refractionIntensity)\n#include(_DEFINENAME_,SS_TRANSLUCENCYINTENSITY_TEXTURE,_VARYINGNAME_,TranslucencyIntensity,_SAMPLERNAME_,translucencyIntensity)\n#include(_DEFINENAME_,SS_TRANSLUCENCYCOLOR_TEXTURE,_VARYINGNAME_,TranslucencyColor,_SAMPLERNAME_,translucencyColor)\n#endif\n#ifdef IBL_CDF_FILTERING\nuniform sampler2D icdfSampler;\n#endif\n"),n(59581),n(27003),n(59262),n(52767),n(75334),n(5447),n(19568),n(40246),n(40688),n(46837),n(92518),n(80752),n(62049),n(64244),n(10114),n(18973),n(31217),n(48661),n(75394),n(40150),n(93130);var s="pbrBlockAlbedoOpacity";r.l.IncludesShadersStore[s]||(r.l.IncludesShadersStore[s]="struct albedoOpacityOutParams\n{vec3 surfaceAlbedo;float alpha;};\n#define pbr_inline\nalbedoOpacityOutParams albedoOpacityBlock(\nin vec4 vAlbedoColor\n#ifdef ALBEDO\n,in vec4 albedoTexture\n,in vec2 albedoInfos\n#endif\n,in float baseWeight\n#ifdef BASE_WEIGHT\n,in vec4 baseWeightTexture\n,in vec2 vBaseWeightInfos\n#endif\n#ifdef OPACITY\n,in vec4 opacityMap\n,in vec2 vOpacityInfos\n#endif\n#ifdef DETAIL\n,in vec4 detailColor\n,in vec4 vDetailInfos\n#endif\n#ifdef DECAL\n,in vec4 decalColor\n,in vec4 vDecalInfos\n#endif\n)\n{albedoOpacityOutParams outParams;vec3 surfaceAlbedo=vAlbedoColor.rgb;float alpha=vAlbedoColor.a;\n#ifdef ALBEDO\n#if defined(ALPHAFROMALBEDO) || defined(ALPHATEST)\nalpha*=albedoTexture.a;\n#endif\n#ifdef GAMMAALBEDO\nsurfaceAlbedo*=toLinearSpace(albedoTexture.rgb);\n#else\nsurfaceAlbedo*=albedoTexture.rgb;\n#endif\nsurfaceAlbedo*=albedoInfos.y;\n#endif\n#ifndef DECAL_AFTER_DETAIL\n#include\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nsurfaceAlbedo*=vColor.rgb;\n#endif\n#ifdef DETAIL\nfloat detailAlbedo=2.0*mix(0.5,detailColor.r,vDetailInfos.y);surfaceAlbedo.rgb=surfaceAlbedo.rgb*detailAlbedo*detailAlbedo; \n#endif\n#ifdef DECAL_AFTER_DETAIL\n#include\n#endif\n#define CUSTOM_FRAGMENT_UPDATE_ALBEDO\nsurfaceAlbedo*=baseWeight;\n#ifdef BASE_WEIGHT\nsurfaceAlbedo*=baseWeightTexture.r;\n#endif\n#ifdef OPACITY\n#ifdef OPACITYRGB\nalpha=getLuminance(opacityMap.rgb);\n#else\nalpha*=opacityMap.a;\n#endif\nalpha*=vOpacityInfos.y;\n#endif\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\n#if !defined(SS_LINKREFRACTIONTOTRANSPARENCY) && !defined(ALPHAFRESNEL)\n#ifdef ALPHATEST\n#if DEBUGMODE != 88\nif (alpha{n.r(t),n.d(t,{imageProcessingFunctions:()=>a});var r=n(98519),i="imageProcessingFunctions",o="#if defined(COLORGRADING) && !defined(COLORGRADING3D)\n/** \n* Polyfill for SAMPLE_TEXTURE_3D,which is unsupported in WebGL.\n* sampler3dSetting.x=textureOffset (0.5/textureSize).\n* sampler3dSetting.y=textureSize.\n*/\n#define inline\nvec3 sampleTexture3D(sampler2D colorTransform,vec3 color,vec2 sampler3dSetting)\n{float sliceSize=2.0*sampler3dSetting.x; \n#ifdef SAMPLER3DGREENDEPTH\nfloat sliceContinuous=(color.g-sampler3dSetting.x)*sampler3dSetting.y;\n#else\nfloat sliceContinuous=(color.b-sampler3dSetting.x)*sampler3dSetting.y;\n#endif\nfloat sliceInteger=floor(sliceContinuous);float sliceFraction=sliceContinuous-sliceInteger;\n#ifdef SAMPLER3DGREENDEPTH\nvec2 sliceUV=color.rb;\n#else\nvec2 sliceUV=color.rg;\n#endif\nsliceUV.x*=sliceSize;sliceUV.x+=sliceInteger*sliceSize;sliceUV=saturate(sliceUV);vec4 slice0Color=texture2D(colorTransform,sliceUV);sliceUV.x+=sliceSize;sliceUV=saturate(sliceUV);vec4 slice1Color=texture2D(colorTransform,sliceUV);vec3 result=mix(slice0Color.rgb,slice1Color.rgb,sliceFraction);\n#ifdef SAMPLER3DBGRMAP\ncolor.rgb=result.rgb;\n#else\ncolor.rgb=result.bgr;\n#endif\nreturn color;}\n#endif\n#if TONEMAPPING==3\nconst float PBRNeutralStartCompression=0.8-0.04;const float PBRNeutralDesaturation=0.15;vec3 PBRNeutralToneMapping( vec3 color ) {float x=min(color.r,min(color.g,color.b));float offset=x<0.08 ? x-6.25*x*x : 0.04;color-=offset;float peak=max(color.r,max(color.g,color.b));if (peak{n.r(t),n.d(t,{highlightsPixelShaderWGSL:()=>a});var r=n(98519),i="highlightsPixelShader",o="varying vUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d;const RGBLuminanceCoefficients: vec3f= vec3f(0.2126,0.7152,0.0722);\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var tex: vec4f=textureSample(textureSampler,textureSamplerSampler,input.vUV);var c: vec3f=tex.rgb;var luma: f32=dot(c.rgb,RGBLuminanceCoefficients);fragmentOutputs.color= vec4f(pow(c, vec3f(25.0-luma*15.0)),tex.a); }";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},40877:(e,t,n)=>{n.r(t),n.d(t,{geometryVertexShaderWGSL:()=>a});var r=n(98519),i=(n(45699),n(27279),n(73683),n(68478),n(63866),n(36644),n(9436),n(98819),n(77320),n(21310),n(3641),n(86615),n(63002),n(19748),"geometryVertexShader"),o="#include\n#include\n#include\n#include[0..maxSimultaneousMorphTargets]\n#include\n#include\n#include\nattribute position: vec3f;\n#ifdef HAS_NORMAL_ATTRIBUTE\nattribute normal: vec3f;\n#endif\n#ifdef NEED_UV\nvarying vUV: vec2f;\n#ifdef ALPHATEST\nuniform diffuseMatrix: mat4x4f;\n#endif\n#ifdef BUMP\nuniform bumpMatrix: mat4x4f;varying vBumpUV: vec2f;\n#endif\n#ifdef REFLECTIVITY\nuniform reflectivityMatrix: mat4x4f;uniform albedoMatrix: mat4x4f;varying vReflectivityUV: vec2f;varying vAlbedoUV: vec2f;\n#endif\n#ifdef METALLIC_TEXTURE\nvarying vMetallicUV: vec2f;uniform metallicMatrix: mat4x4f;\n#endif\n#ifdef ROUGHNESS_TEXTURE\nvarying vRoughnessUV: vec2f;uniform roughnessMatrix: mat4x4f;\n#endif\n#ifdef UV1\nattribute uv: vec2f;\n#endif\n#ifdef UV2\nattribute uv2: vec2f;\n#endif\n#endif\n#ifdef BUMP\nvarying vWorldView0: vec4f;varying vWorldView1: vec4f;varying vWorldView2: vec4f;varying vWorldView3: vec4f;\n#endif\n#ifdef BUMP\nvarying vNormalW: vec3f;\n#else\nvarying vNormalV: vec3f;\n#endif\nvarying vViewPos: vec4f;\n#if defined(POSITION) || defined(BUMP)\nvarying vPositionW: vec3f;\n#endif\n#if defined(VELOCITY) || defined(VELOCITY_LINEAR)\nuniform previousViewProjection: mat4x4f;varying vCurrentPosition: vec4f;varying vPreviousPosition: vec4f;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {var positionUpdated: vec3f=input.position;\n#ifdef HAS_NORMAL_ATTRIBUTE\nvar normalUpdated: vec3f=input.normal;\n#else\nvar normalUpdated: vec3f=vec3f(0.0,0.0,0.0);\n#endif\n#ifdef UV1\nvar uvUpdated: vec2f=input.uv;\n#endif\n#ifdef UV2\nvar uv2Updated: vec2f=input.uv2;\n#endif\n#include\n#include[0..maxSimultaneousMorphTargets]\n#include\n#if (defined(VELOCITY) || defined(VELOCITY_LINEAR)) && !defined(BONES_VELOCITY_ENABLED)\nvCurrentPosition=scene.viewProjection*finalWorld*vec4f(positionUpdated,1.0);vPreviousPosition=uniforms.previousViewProjection*finalPreviousWorld* vec4f(positionUpdated,1.0);\n#endif\n#include\n#include\nvar worldPos: vec4f= vec4f(finalWorld* vec4f(positionUpdated,1.0));\n#ifdef BUMP\nlet vWorldView=scene.view*finalWorld;vertexOutputs.vWorldView0=vWorldView[0];vertexOutputs.vWorldView1=vWorldView[1];vertexOutputs.vWorldView2=vWorldView[2];vertexOutputs.vWorldView3=vWorldView[3];let normalWorld: mat3x3f= mat3x3f(finalWorld[0].xyz,finalWorld[1].xyz,finalWorld[2].xyz);vertexOutputs.vNormalW=normalize(normalWorld*normalUpdated);\n#else\n#ifdef NORMAL_WORLDSPACE\nvertexOutputs.vNormalV=normalize((finalWorld* vec4f(normalUpdated,0.0)).xyz);\n#else\nvertexOutputs.vNormalV=normalize(((scene.view*finalWorld)* vec4f(normalUpdated,0.0)).xyz);\n#endif\n#endif\nvertexOutputs.vViewPos=scene.view*worldPos;\n#if (defined(VELOCITY) || defined(VELOCITY_LINEAR)) && defined(BONES_VELOCITY_ENABLED)\nvertexOutputs.vCurrentPosition=scene.viewProjection*finalWorld* vec4f(positionUpdated,1.0);\n#if NUM_BONE_INFLUENCERS>0\nvar previousInfluence: mat4x4f;previousInfluence=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndices[0])]*vertexInputs.matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\npreviousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndices[1])]*vertexInputs.matricesWeights[1];\n#endif\n#if NUM_BONE_INFLUENCERS>2\npreviousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndices[2])]*vertexInputs.matricesWeights[2];\n#endif\n#if NUM_BONE_INFLUENCERS>3\npreviousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndices[3])]*vertexInputs.matricesWeights[3];\n#endif\n#if NUM_BONE_INFLUENCERS>4\npreviousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndicesExtra[0])]*vertexInputs.matricesWeightsExtra[0];\n#endif\n#if NUM_BONE_INFLUENCERS>5\npreviousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndicesExtra[1])]*vertexInputs.matricesWeightsExtra[1];\n#endif\n#if NUM_BONE_INFLUENCERS>6\npreviousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndicesExtra[2])]*vertexInputs.matricesWeightsExtra[2];\n#endif\n#if NUM_BONE_INFLUENCERS>7\npreviousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndicesExtra[3])]*vertexInputs.matricesWeightsExtra[3];\n#endif\nvertexOutputs.vPreviousPosition=uniforms.previousViewProjection*finalPreviousWorld*previousInfluence* vec4f(positionUpdated,1.0);\n#else\nvertexOutputs.vPreviousPosition=uniforms.previousViewProjection*finalPreviousWorld* vec4f(positionUpdated,1.0);\n#endif\n#endif\n#if defined(POSITION) || defined(BUMP)\nvertexOutputs.vPositionW=worldPos.xyz/worldPos.w;\n#endif\nvertexOutputs.position=scene.viewProjection*finalWorld* vec4f(positionUpdated,1.0);\n#include\n#ifdef NEED_UV\n#ifdef UV1\n#if defined(ALPHATEST) && defined(ALPHATEST_UV1)\nvertexOutputs.vUV=(uniforms.diffuseMatrix* vec4f(uvUpdated,1.0,0.0)).xy;\n#else\nvertexOutputs.vUV=uvUpdated;\n#endif\n#ifdef BUMP_UV1\nvertexOutputs.vBumpUV=(uniforms.bumpMatrix* vec4f(uvUpdated,1.0,0.0)).xy;\n#endif\n#ifdef REFLECTIVITY_UV1\nvertexOutputs.vReflectivityUV=(uniforms.reflectivityMatrix* vec4f(uvUpdated,1.0,0.0)).xy;\n#else\n#ifdef METALLIC_UV1\nvertexOutputs.vMetallicUV=(uniforms.metallicMatrix* vec4f(uvUpdated,1.0,0.0)).xy;\n#endif\n#ifdef ROUGHNESS_UV1\nvertexOutputs.vRoughnessUV=(uniforms.roughnessMatrix* vec4f(uvUpdated,1.0,0.0)).xy;\n#endif\n#endif\n#ifdef ALBEDO_UV1\nvertexOutputs.vAlbedoUV=(uniforms.albedoMatrix* vec4f(uvUpdated,1.0,0.0)).xy;\n#endif\n#endif\n#ifdef UV2\n#if defined(ALPHATEST) && defined(ALPHATEST_UV2)\nvertexOutputs.vUV=(uniforms.diffuseMatrix* vec4f(uv2Updated,1.0,0.0)).xy;\n#else\nvertexOutputs.vUV=uv2Updated;\n#endif\n#ifdef BUMP_UV2\nvertexOutputs.vBumpUV=(uniforms.bumpMatrix* vec4f(uv2Updated,1.0,0.0)).xy;\n#endif\n#ifdef REFLECTIVITY_UV2\nvertexOutputs.vReflectivityUV=(uniforms.reflectivityMatrix* vec4f(uv2Updated,1.0,0.0)).xy;\n#else\n#ifdef METALLIC_UV2\nvertexOutputs.vMetallicUV=(uniforms.metallicMatrix* vec4f(uv2Updated,1.0,0.0)).xy;\n#endif\n#ifdef ROUGHNESS_UV2\nvertexOutputs.vRoughnessUV=(uniforms.roughnessMatrix* vec4f(uv2Updated,1.0,0.0)).xy;\n#endif\n#endif\n#ifdef ALBEDO_UV2\nvertexOutputs.vAlbedoUV=(uniforms.albedoMatrix* vec4f(uv2Updated,1.0,0.0)).xy;\n#endif\n#endif\n#endif\n#include\n}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},40880:(e,t,n)=>{n.r(t),n.d(t,{minmaxReduxPixelShader:()=>a});var r=n(98519),i="minmaxReduxPixelShader",o="varying vec2 vUV;uniform sampler2D textureSampler;\n#if defined(INITIAL)\nuniform vec2 texSize;void main(void)\n{ivec2 coord=ivec2(vUV*(texSize-1.0));float f1=texelFetch(textureSampler,coord,0).r;float f2=texelFetch(textureSampler,coord+ivec2(1,0),0).r;float f3=texelFetch(textureSampler,coord+ivec2(1,1),0).r;float f4=texelFetch(textureSampler,coord+ivec2(0,1),0).r;\n#ifdef DEPTH_REDUX\n#ifdef VIEW_DEPTH\nfloat minz=3.4e38;if (f1 != 0.0) { minz=f1; }\nif (f2 != 0.0) { minz=min(minz,f2); }\nif (f3 != 0.0) { minz=min(minz,f3); }\nif (f4 != 0.0) { minz=min(minz,f4); }\nfloat maxz=max(max(max(f1,f2),f3),f4);\n#else\nfloat minz=min(min(min(f1,f2),f3),f4);float maxz=max(max(max(sign(1.0-f1)*f1,sign(1.0-f2)*f2),sign(1.0-f3)*f3),sign(1.0-f4)*f4);\n#endif\n#else\nfloat minz=min(min(min(f1,f2),f3),f4);float maxz=max(max(max(f1,f2),f3),f4);\n#endif\nglFragColor=vec4(minz,maxz,0.,0.);}\n#elif defined(MAIN)\nuniform vec2 texSize;void main(void)\n{ivec2 coord=ivec2(vUV*(texSize-1.0));vec2 f1=texelFetch(textureSampler,coord,0).rg;vec2 f2=texelFetch(textureSampler,coord+ivec2(1,0),0).rg;vec2 f3=texelFetch(textureSampler,coord+ivec2(1,1),0).rg;vec2 f4=texelFetch(textureSampler,coord+ivec2(0,1),0).rg;float minz=min(min(min(f1.x,f2.x),f3.x),f4.x);float maxz=max(max(max(f1.y,f2.y),f3.y),f4.y);glFragColor=vec4(minz,maxz,0.,0.);}\n#elif defined(ONEBEFORELAST)\nuniform ivec2 texSize;void main(void)\n{ivec2 coord=ivec2(vUV*vec2(texSize-1));vec2 f1=texelFetch(textureSampler,coord % texSize,0).rg;vec2 f2=texelFetch(textureSampler,(coord+ivec2(1,0)) % texSize,0).rg;vec2 f3=texelFetch(textureSampler,(coord+ivec2(1,1)) % texSize,0).rg;vec2 f4=texelFetch(textureSampler,(coord+ivec2(0,1)) % texSize,0).rg;float minz=min(min(min(f1.x,f2.x),f3.x),f4.x);float maxz=max(max(max(f1.y,f2.y),f3.y),f4.y);glFragColor=vec4(minz,maxz,0.,0.);}\n#elif defined(LAST)\nvoid main(void)\n{glFragColor=vec4(0.);if (true) { \ndiscard;}}\n#endif\n";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},41053:(e,t,n)=>{n.d(t,{GA:()=>i,IR:()=>r,zx:()=>o});var r={fftSize:2048,minDecibels:-100,maxDecibels:-30,smoothing:.8};function i(e){return e.analyzerEnabled||void 0!==e.analyzerFFTSize||void 0!==e.analyzerMinDecibels||void 0!==e.analyzerMaxDecibels||void 0!==e.analyzerSmoothing}var o=function(){function e(){}return Object.defineProperty(e.prototype,"frequencyBinCount",{get:function(){return this.fftSize/2},enumerable:!1,configurable:!0}),e}()},41085:(e,t,n)=>{n.d(t,{$:()=>p});var r=n(78322),i=n(66377),o=n(8046),a=n(50582),s=n(63639),l=n(81152),c=n(87074),u=n(74239),h=n(7164),d=n(4064);u.M.prototype.setDepthStencilTexture=function(e,t){this._engine.setDepthStencilTexture(this._samplers[e],this._uniforms[e],t,e)};var p=function(e){function t(t,n,r,s,c,u,p,f,m,_,g,v,y,b,S,T,E){void 0===s&&(s=!1),void 0===c&&(c=!0),void 0===u&&(u=l.Y.TEXTURETYPE_UNSIGNED_BYTE),void 0===p&&(p=!1),void 0===f&&(f=a.g.TRILINEAR_SAMPLINGMODE),void 0===m&&(m=!0),void 0===_&&(_=!1),void 0===g&&(g=!1),void 0===v&&(v=l.Y.TEXTUREFORMAT_RGBA),void 0===y&&(y=!1),void 0===T&&(T=!1),void 0===E&&(E=!1);var x,P,C,R,A,I,O,M=this,D=void 0,N=!0,F=void 0,L=!1;if("object"==typeof s){var w=s;s=!!w.generateMipMaps,c=null===(x=w.doNotChangeAspectRatio)||void 0===x||x,u=null!==(P=w.type)&&void 0!==P?P:l.Y.TEXTURETYPE_UNSIGNED_BYTE,p=!!w.isCube,f=null!==(C=w.samplingMode)&&void 0!==C?C:a.g.TRILINEAR_SAMPLINGMODE,m=null===(R=w.generateDepthBuffer)||void 0===R||R,_=!!w.generateStencilBuffer,g=!!w.isMulti,v=null!==(A=w.format)&&void 0!==A?A:l.Y.TEXTUREFORMAT_RGBA,y=!!w.delayAllocation,b=w.samples,S=w.creationFlags,T=!!w.noColorAttachment,E=!!w.useSRGBBuffer,D=w.colorAttachment,N=null!==(I=w.gammaSpace)&&void 0!==I?I:N,F=w.existingObjectRenderer,L=!!w.enableClusteredLights}if((M=e.call(this,null,r,!s,void 0,f,void 0,void 0,void 0,void 0,v)||this).ignoreCameraViewport=!1,M.onBeforeBindObservable=new i.cP,M.onAfterUnbindObservable=new i.cP,M.onClearObservable=new i.cP,M.onResizeObservable=new i.cP,M._cleared=!1,M.skipInitialClear=!1,M._samples=1,M._canRescale=!0,M._renderTarget=null,M._dontDisposeObjectRenderer=!1,M.boundingBoxPosition=o.Pq.Zero(),M._disableEngineStages=!1,M._dumpToolsLoading=!1,!(r=M.getScene()))return M;var B=M.getScene().getEngine();return M._gammaSpace=N,M._coordinatesMode=a.g.PROJECTION_MODE,M.name=t,M.isRenderTarget=!0,M._initialSizeParameter=n,M._dontDisposeObjectRenderer=!!F,M._processSizeParameter(n),M._objectRenderer=null!=F?F:new d.P(t,r,{numPasses:p?6:M.getRenderLayers()||1,doNotChangeAspectRatio:c,enableClusteredLights:L}),M._onBeforeRenderingManagerRenderObserver=M._objectRenderer.onBeforeRenderingManagerRenderObservable.add((function(){if(!M._disableEngineStages)for(var e=0,t=M._scene._beforeRenderTargetClearStage;e0&&(this._postProcesses[0].autoClear=!1))}},t.prototype.resetRefreshCounter=function(){this._objectRenderer.resetRefreshCounter()},Object.defineProperty(t.prototype,"refreshRate",{get:function(){return this._objectRenderer.refreshRate},set:function(e){this._objectRenderer.refreshRate=e},enumerable:!1,configurable:!0}),t.prototype._shouldRender=function(){return this._objectRenderer.shouldRender()},t.prototype.getRenderSize=function(){return this.getRenderWidth()},t.prototype.getRenderWidth=function(){return this._size.width?this._size.width:this._size},t.prototype.getRenderHeight=function(){return this._size.width?this._size.height:this._size},t.prototype.getRenderLayers=function(){var e=this._size.layers;return e||(this._size.depth||0)},t.prototype.disableRescaling=function(){this._canRescale=!1},Object.defineProperty(t.prototype,"canRescale",{get:function(){return this._canRescale},enumerable:!1,configurable:!0}),t.prototype.scale=function(e){var t=Math.max(1,this.getRenderSize()*e);this.resize(t)},t.prototype.getReflectionTextureMatrix=function(){return this.isCube?this._textureMatrix:e.prototype.getReflectionTextureMatrix.call(this)},t.prototype.resize=function(e){var t,n=this.isCube;null===(t=this._renderTarget)||void 0===t||t.dispose(),this._renderTarget=null;var r=this.getScene();r&&(this._processSizeParameter(e),this._renderTarget=n?r.getEngine().createRenderTargetCubeTexture(this.getRenderSize(),this._renderTargetOptions):r.getEngine().createRenderTargetTexture(this._size,this._renderTargetOptions),this._texture=this._renderTarget.texture,void 0!==this._renderTargetOptions.samples&&(this.samples=this._renderTargetOptions.samples),this.onResizeObservable.hasObservers()&&this.onResizeObservable.notifyObservers(this))},t.prototype.render=function(e,t){void 0===e&&(e=!1),void 0===t&&(t=!1),this._render(e,t)},t.prototype.isReadyForRendering=function(){var e=this;this._dumpToolsLoading||(this._dumpToolsLoading=!0,Promise.resolve().then(n.bind(n,24687)).then((function(t){return e._dumpTools=t}))),this._objectRenderer.prepareRenderList(),this.onBeforeBindObservable.notifyObservers(this),this._objectRenderer.initRender(this.getRenderWidth(),this.getRenderHeight());var t=this._objectRenderer._checkReadiness();return this.onAfterUnbindObservable.notifyObservers(this),this._objectRenderer.finishRender(),t},t.prototype._render=function(e,t){void 0===e&&(e=!1),void 0===t&&(t=!1);var n=this.getScene();if(n){if(void 0!==this.useCameraPostProcesses&&(e=this.useCameraPostProcesses),this._objectRenderer.prepareRenderList(),this.onBeforeBindObservable.notifyObservers(this),this._objectRenderer.initRender(this.getRenderWidth(),this.getRenderHeight()),!this.is2DArray&&!this.is3D||this.isMulti)if(this.isCube&&!this.isMulti)for(var r=0;r<6;r++)this._renderToTarget(r,e,t),n.incrementRenderId(),n.resetCachedMaterial();else this._renderToTarget(0,e,t);else for(var i=0;i=0&&n.customRenderTargets.splice(r,1);for(var i=0,o=n.cameras;i=0&&a.customRenderTargets.splice(r,1)}null===(t=this._renderTarget)||void 0===t||t.dispose(),this._renderTarget=null,this._texture=null,e.prototype.dispose.call(this)}},t.prototype._rebuild=function(){this._objectRenderer._rebuild(),this._postProcessManager&&this._postProcessManager._rebuild()},t.prototype.freeRenderingGroups=function(){this._objectRenderer.freeRenderingGroups()},t.prototype.getViewCount=function(){return 1},t.REFRESHRATE_RENDER_ONCE=d.P.REFRESHRATE_RENDER_ONCE,t.REFRESHRATE_RENDER_ONEVERYFRAME=d.P.REFRESHRATE_RENDER_ONEVERYFRAME,t.REFRESHRATE_RENDER_ONEVERYTWOFRAMES=d.P.REFRESHRATE_RENDER_ONEVERYTWOFRAMES,t}(a.g);a.g._CreateRenderTargetTexture=function(e,t,n,r,i){return new p(e,t,n,r)}},41182:(e,t,n)=>{n.r(t),n.d(t,{kernelBlurVertexShader:()=>s});var r=n(98519),i=(n(67303),"kernelBlurVertex");r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="sampleCoord{X}=sampleCenter+delta*KERNEL_OFFSET{X};");var o="kernelBlurVertexShader",a="attribute vec2 position;uniform vec2 delta;varying vec2 sampleCenter;\n#include[0..varyingCount]\nconst vec2 madd=vec2(0.5,0.5);\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nsampleCenter=(position*madd+madd);\n#include[0..varyingCount]\ngl_Position=vec4(position,0.0,1.0);\n#define CUSTOM_VERTEX_MAIN_END\n}";r.l.ShadersStore[o]||(r.l.ShadersStore[o]=a);var s={name:o,shader:a}},41190:(e,t,n)=>{n.d(t,{n:()=>i});var r={};function i(e,t){if(void 0===t&&(t=!1),!t||!r[e])return r[e]=!0,"".concat(e," needs to be imported before as it contains a side-effect required by your code.")}},41409:(e,t,n)=>{n.d(t,{Z:()=>ne,F:()=>P});var r=n(78322),i=n(44957),o=n(85258),a=n(66377),s=n(53770),l=n(59437),c=n(31985),u=n(8046),h=n(81914),d=n(75482),p=n(8004),f=n(35747),m=n(63639),_=n(74239),g=n(19023),v=new u.uq,y=new u.uq,b=new u.uq;function S(e,t,n){for(var r=n.asArray(),i=t.asArray(),o=0;o<16;o++)r[o]=i[o];return r[12]-=e.x,r[13]-=e.y,r[14]-=e.z,u.uq.FromArrayToRef(r,0,n),n}function T(e,t){for(var n=t.asArray(),r=e.asArray(),i=0;i<16;i++)n[i]=r[i];return n[12]=0,n[13]=0,n[14]=0,u.uq.FromArrayToRef(n,0,t),t}function E(e,t,n){return(0,g.fd)(T(e,n),t,n),n}function x(e,t,n){switch(v.updateFlag=t.updateFlag,e){case"world":return S(n.floatingOriginOffset,t,v);case"view":return T(t,v);case"worldView":return r=n.floatingOriginOffset,i=t,o=n.getViewMatrix(),a=v,(0,g.EE)(o,y),(0,g.fd)(i,y,b),S(r,b,y),T(o,b),(0,g.fd)(y,b,a),a;case"viewProjection":return E(n.getViewMatrix(),n.getProjectionMatrix(),v);case"worldViewProjection":return function(e,t,n,r,i,o){return(0,g.EE)(n,y),(0,g.fd)(t,y,b),S(e,b,y),E(r,i,b),(0,g.fd)(y,b,o),o}(n.floatingOriginOffset,t,n.getTransformMatrix(),n.getViewMatrix(),n.getProjectionMatrix(),v);default:return t}var r,i,o,a}var P,C=d.D,R=_.M,A=C.prototype._updateMatrixForUniform,I=_.M.prototype.setMatrix,O=n(7931),M=n(52366),D=n(81152),N=n(5153),F=n(66614),L=n(41190),w=n(64391),B=n(82966),V=n(6451),U=n(45158),G=n(67925),k=n(70160),z=function(){function e(){this._singleClick=!1,this._doubleClick=!1,this._hasSwiped=!1,this._ignore=!1}return Object.defineProperty(e.prototype,"singleClick",{get:function(){return this._singleClick},set:function(e){this._singleClick=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"doubleClick",{get:function(){return this._doubleClick},set:function(e){this._doubleClick=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasSwiped",{get:function(){return this._hasSwiped},set:function(e){this._hasSwiped=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ignore",{get:function(){return this._ignore},set:function(e){this._ignore=e},enumerable:!1,configurable:!0}),e}(),W=function(){function e(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 u.I9(0,0),this._previousStartingPointerPosition=new u.I9(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||F.q.LastCreatedScene,this._scene}return Object.defineProperty(e.prototype,"meshUnderPointer",{get:function(){return this._movePointerInfo&&(this._movePointerInfo._generatePickInfo(),this._movePointerInfo=null),this._pointerOverMesh},enumerable:!1,configurable:!0}),e.prototype.getMeshUnderPointerByPointerId=function(e){return this._meshUnderPointerId[e]||null},Object.defineProperty(e.prototype,"unTranslatedPointer",{get:function(){return new u.I9(this._unTranslatedPointerX,this._unTranslatedPointerY)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pointerX",{get:function(){return this._pointerX},set:function(e){this._pointerX=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pointerY",{get:function(){return this._pointerY},set:function(e){this._pointerY=e},enumerable:!1,configurable:!0}),e.prototype._updatePointerPosition=function(e){var 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)},e.prototype._processPointerMove=function(e,t){var n=this._scene,r=n.getEngine(),i=r.getInputElement();i&&(i.tabIndex=r.canvasTabIndex,n.doNotHandleCursors||(i.style.cursor=n.defaultCursor)),this._setCursorAndPointerOverMesh(e,t,n);for(var o=0,a=n._pointerMoveStage;o=U.ST.MouseWheelX&&t.inputIndex<=U.ST.MouseWheelZ?w.Zp.POINTERWHEEL:w.Zp.POINTERMOVE;n.onPointerMove&&(e=e||this._pickMove(t),n.onPointerMove(t,e,u)),e?(c=new w.mx(u,t,e),this._setRayOnPointerInfo(e,t)):(c=new w.mx(u,t,null,this),this._movePointerInfo=c),n.onPointerObservable.hasObservers()&&n.onPointerObservable.notifyObservers(c,u)},e.prototype._setRayOnPointerInfo=function(e,t){var n=this._scene;e&&k.h._IsPickingAvailable&&(e.ray||(e.ray=n.createPickingRay(t.offsetX,t.offsetY,u.uq.Identity(),n.activeCamera)))},e.prototype._addCameraPointerObserver=function(e,t){return this._cameraObserverCount++,this._scene.onPointerObservable.add(e,t)},e.prototype._removeCameraPointerObserver=function(e){return this._cameraObserverCount--,this._scene.onPointerObservable.remove(e)},e.prototype._checkForPicking=function(){return!!(this._scene.onPointerObservable.observers.length>this._cameraObserverCount||this._scene.onPointerPick)},e.prototype._checkPrePointerObservable=function(e,t,n){var r=this._scene,i=new w.tT(n,t,this._unTranslatedPointerX,this._unTranslatedPointerY);return e&&(i.originalPickingInfo=e,i.ray=e.ray,"xr-near"===t.pointerType&&e.originMesh&&(i.nearInteractionPickingInfo=e)),r.onPrePointerObservable.notifyObservers(i,n),!!i.skipOnPointerObservable},e.prototype._pickMove=function(e){var t=this._scene,n=t.pick(this._unTranslatedPointerX,this._unTranslatedPointerY,t.pointerMovePredicate,t.pointerMoveFastCheck,t.cameraToUseForPointers,t.pointerMoveTrianglePredicate);return this._setCursorAndPointerOverMesh(n,e,t),n},e.prototype._setCursorAndPointerOverMesh=function(e,t,n){var r=n.getEngine().getInputElement();if(null==e?void 0:e.pickedMesh){if(this.setPointerOverMesh(e.pickedMesh,t.pointerId,e,t),!n.doNotHandleCursors&&r&&this._pointerOverMesh){var i=this._pointerOverMesh._getActionManagerForTrigger();i&&i.hasPointerTriggers&&(r.style.cursor=i.hoverCursor||n.hoverCursor)}}else this.setPointerOverMesh(null,t.pointerId,e,t)},e.prototype.simulatePointerMove=function(e,t){var n=new PointerEvent("pointermove",t);n.inputIndex=U.ST.Move,this._checkPrePointerObservable(e,n,w.Zp.POINTERMOVE)||this._processPointerMove(e,n)},e.prototype.simulatePointerDown=function(e,t){var n=new PointerEvent("pointerdown",t);n.inputIndex=n.button+2,this._checkPrePointerObservable(e,n,w.Zp.POINTERDOWN)||this._processPointerDown(e,n)},e.prototype._processPointerDown=function(t,n){var r,i=this,o=this._scene;if(null==t?void 0:t.pickedMesh){this._pickedDownMesh=t.pickedMesh;var a=t.pickedMesh._getActionManagerForTrigger();if(a){if(a.hasPickTriggers)switch(a.processTrigger(D.Y.ACTION_OnPickDownTrigger,new f.X(t.pickedMesh,o.pointerX,o.pointerY,t.pickedMesh,n,t)),n.button){case 0:a.processTrigger(D.Y.ACTION_OnLeftPickTrigger,new f.X(t.pickedMesh,o.pointerX,o.pointerY,t.pickedMesh,n,t));break;case 1:a.processTrigger(D.Y.ACTION_OnCenterPickTrigger,new f.X(t.pickedMesh,o.pointerX,o.pointerY,t.pickedMesh,n,t));break;case 2:a.processTrigger(D.Y.ACTION_OnRightPickTrigger,new f.X(t.pickedMesh,o.pointerX,o.pointerY,t.pickedMesh,n,t))}a.hasSpecificTrigger(D.Y.ACTION_OnLongPressTrigger)&&window.setTimeout((function(){var t=o.pick(i._unTranslatedPointerX,i._unTranslatedPointerY,(function(e){return e.isPickable&&e.isVisible&&e.isReady()&&e.actionManager&&e.actionManager.hasSpecificTrigger(D.Y.ACTION_OnLongPressTrigger)&&e===i._pickedDownMesh}),!1,o.cameraToUseForPointers);(null==t?void 0:t.pickedMesh)&&a&&0!==i._activePointerIdsCount&&Date.now()-i._startingPointerTime>e.LongPressDelay&&!i._isPointerSwiping()&&(i._startingPointerTime=0,a.processTrigger(D.Y.ACTION_OnLongPressTrigger,f.X.CreateNew(t.pickedMesh,n)))}),e.LongPressDelay)}}else for(var s=0,l=o._pointerDownStage;sthis._cameraObserverCount)){var i=w.Zp.POINTERPICK,o=new w.mx(i,t,e);this._setRayOnPointerInfo(e,t),r.onPointerObservable.notifyObservers(o,i)}var a=e.pickedMesh._getActionManagerForTrigger();if(a&&!n.ignore){a.processTrigger(D.Y.ACTION_OnPickUpTrigger,f.X.CreateNew(e.pickedMesh,t,e)),!n.hasSwiped&&n.singleClick&&a.processTrigger(D.Y.ACTION_OnPickTrigger,f.X.CreateNew(e.pickedMesh,t,e));var s=e.pickedMesh._getActionManagerForTrigger(D.Y.ACTION_OnDoublePickTrigger);n.doubleClick&&s&&s.processTrigger(D.Y.ACTION_OnDoublePickTrigger,f.X.CreateNew(e.pickedMesh,t,e))}}else if(!n.ignore)for(var l=0,c=r._pointerUpStage;le.DoubleClickDelay&&!o._doubleClickOccured||t!==o._previousButtonPressed)&&(o._doubleClickOccured=!1,n.singleClick=!0,n.ignore=!1,o._delayedClicks[t])){var i=o._delayedClicks[t].evt,s=w.Zp.POINTERTAP,l=new w.mx(s,i,o._currentPickResult);a.onPointerObservable.hasObservers()&&a.onPointerObservable.hasSpecificMask(s)&&a.onPointerObservable.notifyObservers(l,s),o._delayedClicks[t]=null}},this._initClickEvent=function(t,n,r,i){var a,s,l=new z;o._currentPickResult=null;var c=null,u=t.hasSpecificMask(w.Zp.POINTERPICK)||n.hasSpecificMask(w.Zp.POINTERPICK)||t.hasSpecificMask(w.Zp.POINTERTAP)||n.hasSpecificMask(w.Zp.POINTERTAP)||t.hasSpecificMask(w.Zp.POINTERDOUBLETAP)||n.hasSpecificMask(w.Zp.POINTERDOUBLETAP);!u&&B.G&&(c=o._initActionManager(c,l))&&(u=c.hasPickTriggers);var h=!1;if(u=u&&!o._isMultiTouchGesture){var d=r.button;if(l.hasSwiped=o._isPointerSwiping(),!l.hasSwiped){var p=!e.ExclusiveDoubleClickMode;if(p||(p=!t.hasSpecificMask(w.Zp.POINTERDOUBLETAP)&&!n.hasSpecificMask(w.Zp.POINTERDOUBLETAP))&&!B.G.HasSpecificTrigger(D.Y.ACTION_OnDoublePickTrigger)&&(c=o._initActionManager(c,l))&&(p=!c.hasSpecificTrigger(D.Y.ACTION_OnDoublePickTrigger)),p)(Date.now()-o._previousStartingPointerTime>e.DoubleClickDelay||d!==o._previousButtonPressed)&&(l.singleClick=!0,i(l,o._currentPickResult),h=!0);else{var f={evt:r,clickInfo:l,timeoutId:window.setTimeout(o._delayedSimpleClick.bind(o,d,l,i),e.DoubleClickDelay)};o._delayedClicks[d]=f}var m=t.hasSpecificMask(w.Zp.POINTERDOUBLETAP)||n.hasSpecificMask(w.Zp.POINTERDOUBLETAP);!m&&B.G.HasSpecificTrigger(D.Y.ACTION_OnDoublePickTrigger)&&(c=o._initActionManager(c,l))&&(m=c.hasSpecificTrigger(D.Y.ACTION_OnDoublePickTrigger)),m&&(d===o._previousButtonPressed&&Date.now()-o._previousStartingPointerTimee.DragMovementThreshold||Math.abs(o._startingPointerPosition.y-o._pointerY)>e.DragMovementThreshold),s.isPointerLock&&s._verifyPointerLock(),!o._checkPrePointerObservable(null,t,t.inputIndex>=U.ST.MouseWheelX&&t.inputIndex<=U.ST.MouseWheelZ?w.Zp.POINTERWHEEL:w.Zp.POINTERMOVE)&&(a.cameraToUseForPointers||a.activeCamera))if(a.skipPointerMovePicking)o._processPointerMove(new p.G,t);else{a.pointerMovePredicate||(a.pointerMovePredicate=function(e){return e.isPickable&&e.isVisible&&e.isReady()&&e.isEnabled()&&(e.enablePointerMoveEvents||a.constantlyUpdateMeshUnderPointer||null!==e._getActionManagerForTrigger())&&(!a.cameraToUseForPointers||0!==(a.cameraToUseForPointers.layerMask&e.layerMask))});var n=a._registeredActions>0||a.constantlyUpdateMeshUnderPointer?o._pickMove(t):null;o._processPointerMove(n,t)}},this._onPointerDown=function(t){var n,r,s=o._activePointerIds.indexOf(-1);if(-1===s?o._activePointerIds.push(t.pointerId):o._activePointerIds[s]=t.pointerId,o._activePointerIdsCount++,o._pickedDownMesh=null,o._meshPickProceed=!1,e.ExclusiveDoubleClickMode)for(var l=0;l1&&(o._isMultiTouchGesture=!0)):t&&0===e.getInput(i.inputIndex)&&(o._onPointerUp(i),0===o._activePointerIdsCount&&(o._isMultiTouchGesture=!1))),r&&i.inputIndex===U.ST.Move&&o._onPointerMove(i)})):e.deviceType===U.bq.Keyboard&&e.onInputChangedObservable.add((function(e){"keydown"===e.type?o._onKeyDown(e):"keyup"===e.type&&o._onKeyUp(e)}))})),this._alreadyAttached=!0},e.prototype.detachControl=function(){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)},e.prototype.setPointerOverMesh=function(e,t,n,r){if(void 0===t&&(t=0),this._meshUnderPointerId[t]!==e||e&&e._internalAbstractMeshDataInfo._pointerOverDisableMeshTesting){var i,o=this._meshUnderPointerId[t];o&&(i=o._getActionManagerForTrigger(D.Y.ACTION_OnPointerOutTrigger))&&i.processTrigger(D.Y.ACTION_OnPointerOutTrigger,new f.X(o,this._pointerX,this._pointerY,e,r,{pointerId:t})),e?(this._meshUnderPointerId[t]=e,this._pointerOverMesh=e,(i=e._getActionManagerForTrigger(D.Y.ACTION_OnPointerOverTrigger))&&i.processTrigger(D.Y.ACTION_OnPointerOverTrigger,new f.X(e,this._pointerX,this._pointerY,e,r,{pointerId:t,pickResult:n}))):(delete this._meshUnderPointerId[t],this._pointerOverMesh=null),this._scene.onMeshUnderPointerUpdatedObservable.hasObservers()&&this._scene.onMeshUnderPointerUpdatedObservable.notifyObservers({mesh:e,pointerId:t})}},e.prototype.getPointerOverMesh=function(){return this.meshUnderPointer},e.prototype._invalidateMesh=function(e){for(var t in this._pointerOverMesh===e&&(this._pointerOverMesh=null),this._pickedDownMesh===e&&(this._pickedDownMesh=null),this._pickedUpMesh===e&&(this._pickedUpMesh=null),this._meshUnderPointerId)this._meshUnderPointerId[t]===e&&delete this._meshUnderPointerId[t]},e.DragMovementThreshold=10,e.LongPressDelay=500,e.DoubleClickDelay=300,e.ExclusiveDoubleClickMode=!1,e}(),H=n(70511),Y=n(64726),X=n(36359),j=n(62273),q=n(17347),K=n(91946),Z=n(11296),Q=function(){this.pointerDownFastCheck=!1,this.pointerUpFastCheck=!1,this.pointerMoveFastCheck=!1,this.skipPointerMovePicking=!1,this.skipPointerDownPicking=!1,this.skipPointerUpPicking=!1},J=n(7164),$=n(34623),ee=n(4906),te=n(53695);!function(e){e[e.BackwardCompatible=0]="BackwardCompatible",e[e.Intermediate=1]="Intermediate",e[e.Aggressive=2]="Aggressive"}(P||(P={}));var ne=function(){function e(t,n){var i=this;this._inputManager=new W(this),this.cameraToUseForPointers=null,this._isScene=!0,this._blockEntityCollection=!1,this.autoClear=!0,this.autoClearDepthAndStencil=!0,this._clearColor=new Y.ov(.2,.2,.3,1),this._tempVect4=new u.IU,this.onClearColorChangedObservable=new a.cP,this.ambientColor=new Y.v9(0,0,0),this.environmentIntensity=1,this.iblIntensity=1,this._performancePriority=0,this.onScenePerformancePriorityChangedObservable=new a.cP,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.hoverCursor="pointer",this.defaultCursor="",this.doNotHandleCursors=!1,this.preventDefaultOnPointerDown=!0,this.preventDefaultOnPointerUp=!0,this.metadata=null,this.reservedDataStore=null,this.disableOfflineSupportExceptionRules=[],this.onDisposeObservable=new a.cP,this._onDisposeObserver=null,this.onBeforeRenderObservable=new a.cP,this._onBeforeRenderObserver=null,this.onAfterRenderObservable=new a.cP,this.onAfterRenderCameraObservable=new a.cP,this._onAfterRenderObserver=null,this.onBeforeAnimationsObservable=new a.cP,this.onAfterAnimationsObservable=new a.cP,this.onBeforeDrawPhaseObservable=new a.cP,this.onAfterDrawPhaseObservable=new a.cP,this.onReadyObservable=new a.cP,this.onBeforeCameraRenderObservable=new a.cP,this._onBeforeCameraRenderObserver=null,this.onAfterCameraRenderObservable=new a.cP,this._onAfterCameraRenderObserver=null,this.onBeforeActiveMeshesEvaluationObservable=new a.cP,this.onAfterActiveMeshesEvaluationObservable=new a.cP,this.onBeforeParticlesRenderingObservable=new a.cP,this.onAfterParticlesRenderingObservable=new a.cP,this.onDataLoadedObservable=new a.cP,this.onNewCameraAddedObservable=new a.cP,this.onCameraRemovedObservable=new a.cP,this.onNewLightAddedObservable=new a.cP,this.onLightRemovedObservable=new a.cP,this.onNewGeometryAddedObservable=new a.cP,this.onGeometryRemovedObservable=new a.cP,this.onNewTransformNodeAddedObservable=new a.cP,this.onTransformNodeRemovedObservable=new a.cP,this.onNewMeshAddedObservable=new a.cP,this.onMeshRemovedObservable=new a.cP,this.onNewSkeletonAddedObservable=new a.cP,this.onSkeletonRemovedObservable=new a.cP,this.onNewParticleSystemAddedObservable=new a.cP,this.onParticleSystemRemovedObservable=new a.cP,this.onNewAnimationGroupAddedObservable=new a.cP,this.onAnimationGroupRemovedObservable=new a.cP,this.onNewMaterialAddedObservable=new a.cP,this.onNewMultiMaterialAddedObservable=new a.cP,this.onMaterialRemovedObservable=new a.cP,this.onMultiMaterialRemovedObservable=new a.cP,this.onNewTextureAddedObservable=new a.cP,this.onTextureRemovedObservable=new a.cP,this.onNewFrameGraphAddedObservable=new a.cP,this.onFrameGraphRemovedObservable=new a.cP,this.onNewObjectRendererAddedObservable=new a.cP,this.onObjectRendererRemovedObservable=new a.cP,this.onNewPostProcessAddedObservable=new a.cP,this.onPostProcessRemovedObservable=new a.cP,this.onNewEffectLayerAddedObservable=new a.cP,this.onEffectLayerRemovedObservable=new a.cP,this.onBeforeRenderTargetsRenderObservable=new a.cP,this.onAfterRenderTargetsRenderObservable=new a.cP,this.onBeforeStepObservable=new a.cP,this.onAfterStepObservable=new a.cP,this.onActiveCameraChanged=new a.cP,this.onActiveCamerasChanged=new a.cP,this.onBeforeRenderingGroupObservable=new a.cP,this.onAfterRenderingGroupObservable=new a.cP,this.onMeshImportedObservable=new a.cP,this.onAnimationFileImportedObservable=new a.cP,this.onEnvironmentTextureChangedObservable=new a.cP,this.onMeshUnderPointerUpdatedObservable=new a.cP,this._registeredForLateAnimationBindings=new s.b(256),this._pointerPickingConfiguration=new Q,this.onPrePointerObservable=new a.cP,this.onPointerObservable=new a.cP,this.onPreKeyboardObservable=new a.cP,this.onKeyboardObservable=new a.cP,this._useRightHandedSystem=!1,this._timeAccumulator=0,this._currentStepId=0,this._currentInternalStep=0,this._fogEnabled=!0,this._fogMode=e.FOGMODE_NONE,this.fogColor=new Y.v9(.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 u.Pq(0,-9.807,0),this.postProcessesEnabled=!0,this.renderTargetsEnabled=!0,this.dumpNextRenderTargets=!1,this.customRenderTargets=[],this.importedMeshesFiles=[],this.probesEnabled=!0,this._meshesForIntersections=new s.b(256),this.proceduralTexturesEnabled=!0,this._totalVertices=new H.A,this._activeIndices=new H.A,this._activeParticles=new H.A,this._activeBones=new H.A,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.dispatchAllSubMeshesOfActiveMeshes=!1,this._activeMeshes=new s.L(256),this._processedMaterials=new s.L(256),this._renderTargets=new s.b(256),this._materialsRenderTargets=new s.b(256),this._activeParticleSystems=new s.L(256),this._activeSkeletons=new s.b(32),this._softwareSkinnedMeshes=new s.b(32),this._activeAnimatables=new Array,this._transformMatrix=u.uq.Zero(),this.requireLightSorting=!1,this._components=[],this._serializableComponents=[],this._transientComponents=[],this._beforeCameraUpdateStage=M.B.Create(),this._beforeClearStage=M.B.Create(),this._beforeRenderTargetClearStage=M.B.Create(),this._gatherRenderTargetsStage=M.B.Create(),this._gatherActiveCameraRenderTargetsStage=M.B.Create(),this._isReadyForMeshStage=M.B.Create(),this._beforeEvaluateActiveMeshStage=M.B.Create(),this._evaluateSubMeshStage=M.B.Create(),this._preActiveMeshStage=M.B.Create(),this._cameraDrawRenderTargetStage=M.B.Create(),this._beforeCameraDrawStage=M.B.Create(),this._beforeRenderTargetDrawStage=M.B.Create(),this._beforeRenderingGroupDrawStage=M.B.Create(),this._beforeRenderingMeshStage=M.B.Create(),this._afterRenderingMeshStage=M.B.Create(),this._afterRenderingGroupDrawStage=M.B.Create(),this._afterCameraDrawStage=M.B.Create(),this._afterCameraPostProcessStage=M.B.Create(),this._afterRenderTargetDrawStage=M.B.Create(),this._afterRenderTargetPostProcessStage=M.B.Create(),this._afterRenderStage=M.B.Create(),this._pointerMoveStage=M.B.Create(),this._pointerDownStage=M.B.Create(),this._pointerUpStage=M.B.Create(),this._geometriesByUniqueId=null,this._uniqueId=0,this._defaultMeshCandidates={data:[],length:0},this._defaultSubMeshCandidates={data:[],length:0},this._floatingOriginMode=!1,this._floatingOriginOffsetDefault=u.Pq.Zero(),this._preventFreeActiveMeshesAndRenderingGroups=!1,this._activeMeshesFrozen=!1,this._activeMeshesFrozenButKeepClipping=!1,this._skipEvaluateActiveMeshesCompletely=!1,this._freezeActiveMeshesCancel=null,this._useCurrentFrameBuffer=!1,this._allowPostProcessClearColor=!0,this.getDeterministicFrameTime=function(){return i._engine.getTimeStep()},this._registeredActions=0,this._blockMaterialDirtyMechanism=!1,this._perfCollector=null,this.activeCameras=[],this._uniqueId=this.getUniqueId();var o,l=(0,r.Cl)({useGeometryUniqueIdsMap:!0,useMaterialMeshMap:!0,useClonedMeshMap:!0,virtual:!1},n);t=this._engine=t||F.q.LastCreatedEngine,l.virtual?t._virtualScenes.push(this):(F.q._LastCreatedScene=this,t.scenes.push(this)),(null==n?void 0:n.floatingOriginMode)&&(t.getCreationOptions().useHighPrecisionMatrix=!0,o=this,R.prototype._setMatrixOverride=_.M.prototype.setMatrix,R.prototype.setMatrix=function(e,t){return this._setMatrixOverride(e,x(e,t,o)),this},C.prototype._updateMatrixForUniformOverride=C.prototype._updateMatrixForUniform,C.prototype._updateMatrixForUniform=function(e,t){this._updateMatrixForUniformOverride(e,x(e,t,o))},this._floatingOriginMode=!0),this._uid=null,this._renderingManager=new O.m(this),m.X&&(this.postProcessManager=new m.X(this)),(0,N.BA)()&&this.attachControl(),this._createUbo(),h.p&&(this._imageProcessingConfiguration=new h.p),this.setDefaultCandidateProviders(),l.useGeometryUniqueIdsMap&&(this._geometriesByUniqueId={}),this.useMaterialMeshMap=l.useMaterialMeshMap,this.useClonedMeshMap=l.useClonedMeshMap,n&&n.virtual||t.onNewSceneAddedObservable.notifyObservers(this)}return e.DefaultMaterialFactory=function(e){throw(0,L.n)("StandardMaterial")},e.CollisionCoordinatorFactory=function(){throw(0,L.n)("DefaultCollisionCoordinator")},Object.defineProperty(e.prototype,"clearColor",{get:function(){return this._clearColor},set:function(e){e!==this._clearColor&&(this._clearColor=e,this.onClearColorChangedObservable.notifyObservers(this._clearColor))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"imageProcessingConfiguration",{get:function(){return this._imageProcessingConfiguration},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"performancePriority",{get:function(){return this._performancePriority},set:function(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}this.onScenePerformancePriorityChangedObservable.notifyObservers(e)}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"forceWireframe",{get:function(){return this._forceWireframe},set:function(e){this._forceWireframe!==e&&(this._forceWireframe=e,this.markAllMaterialsAsDirty(D.Y.MATERIAL_MiscDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"skipFrustumClipping",{get:function(){return this._skipFrustumClipping},set:function(e){this._skipFrustumClipping!==e&&(this._skipFrustumClipping=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"forcePointsCloud",{get:function(){return this._forcePointsCloud},set:function(e){this._forcePointsCloud!==e&&(this._forcePointsCloud=e,this.markAllMaterialsAsDirty(D.Y.MATERIAL_MiscDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"environmentTexture",{get:function(){return this._environmentTexture},set:function(e){this._environmentTexture!==e&&(this._environmentTexture=e,this.onEnvironmentTextureChangedObservable.notifyObservers(e),this.markAllMaterialsAsDirty(D.Y.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),e.prototype.getNodes=function(){var e=[];e=(e=(e=(e=e.concat(this.meshes)).concat(this.lights)).concat(this.cameras)).concat(this.transformNodes);for(var t=0,n=this.skeletons;t0){for(var e=0,t=this._transientComponents;e0&&(s=!1),null===(r=this.prePassRenderer)||void 0===r||r.update(),this.useOrderIndependentTransparency&&this.depthPeelingRenderer&&s&&(s=this.depthPeelingRenderer.isReady()),e&&(this._processedMaterials.reset(),this._materialsRenderTargets.reset()),i=0;i0,u=0,h=this._isReadyForMeshStage;u0)for(var _=0,g=this.activeCameras;_0},enumerable:!1,configurable:!0}),e.prototype.executeWhenReady=function(e,t){void 0===t&&(t=!1),this.onReadyObservable.addOnce(e),null===this._executeWhenReadyTimeoutId&&this._checkIsReady(t)},e.prototype.whenReadyAsync=function(){return(0,r.sH)(this,arguments,void 0,(function(e){var t=this;return void 0===e&&(e=!1),(0,r.YH)(this,(function(n){switch(n.label){case 0:return[4,new Promise((function(n){t.executeWhenReady((function(){n()}),e)}))];case 1:return[2,n.sent()]}}))}))},e.prototype._checkIsReady=function(e){var t=this;return void 0===e&&(e=!1),this._registerTransientComponents(),this.isReady(e)?(this.onReadyObservable.notifyObservers(this),this.onReadyObservable.clear(),void(this._executeWhenReadyTimeoutId=null)):this._isDisposed?(this.onReadyObservable.clear(),void(this._executeWhenReadyTimeoutId=null)):void(this._executeWhenReadyTimeoutId=setTimeout((function(){t.incrementRenderId(),t._checkIsReady(e)}),100))},Object.defineProperty(e.prototype,"animatables",{get:function(){return this._activeAnimatables},enumerable:!1,configurable:!0}),e.prototype.resetLastAnimationTimeFrame=function(){this._animationTimeLast=o.j.Now},e.prototype.getViewMatrix=function(){return this._viewMatrix},e.prototype.getProjectionMatrix=function(){return this._projectionMatrix},e.prototype.getTransformMatrix=function(){return this._transformMatrix},e.prototype.setTransformMatrix=function(e,t,n,r){n||r||!this._multiviewSceneUbo||(this._multiviewSceneUbo.dispose(),this._multiviewSceneUbo=null),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?X.P.GetPlanesToRef(this._transformMatrix,this._frustumPlanes):this._frustumPlanes=X.P.GetPlanes(this._transformMatrix),this._multiviewSceneUbo&&this._multiviewSceneUbo.useUbo?this._updateMultiviewUbo(n,r):this._sceneUbo.useUbo&&(this._sceneUbo.updateMatrix("viewProjection",this._transformMatrix),this._sceneUbo.updateMatrix("view",this._viewMatrix),this._sceneUbo.updateMatrix("projection",this._projectionMatrix)))},e.prototype.getSceneUniformBuffer=function(){return this._multiviewSceneUbo?this._multiviewSceneUbo:this._sceneUbo},e.prototype.createSceneUniformBuffer=function(e,t){var n=new d.D(this._engine,void 0,!1,null!=e?e:"scene",void 0,t);return n.addUniform("viewProjection",16),n.addUniform("view",16),n.addUniform("projection",16),n.addUniform("vEyePosition",4),n},e.prototype.setSceneUniformBuffer=function(e){this._sceneUbo=e,this._viewUpdateFlag=-1,this._projectionUpdateFlag=-1},Object.defineProperty(e.prototype,"floatingOriginMode",{get:function(){return this._floatingOriginMode},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"floatingOriginOffset",{get:function(){return this.floatingOriginMode&&this.activeCamera?this.activeCamera.getWorldMatrix().getTranslation():this._floatingOriginOffsetDefault},enumerable:!1,configurable:!0}),e.prototype.getUniqueId=function(){return j.K.UniqueId},e.prototype.addMesh=function(e,t){var n=this;if(void 0===t&&(t=!1),!this._blockEntityCollection&&(this.meshes.push(e),e._resyncLightSources(),e.parent||e._addToSceneRootNodes(),i.S0.SetImmediate((function(){n.onNewMeshAddedObservable.notifyObservers(e)})),t))for(var r=0,o=e.getChildMeshes();r0?this.activeCamera=this.cameras[0]:this.activeCamera=null),this.onCameraRemovedObservable.notifyObservers(e),t},e.prototype.removeParticleSystem=function(e){var t=this.particleSystems.indexOf(e);return-1!==t&&(this.particleSystems.splice(t,1),this._executeActiveContainerCleanup(this._activeParticleSystems)),this.onParticleSystemRemovedObservable.notifyObservers(e),t},e.prototype.removeAnimation=function(e){var t=this.animations.indexOf(e);return-1!==t&&this.animations.splice(t,1),t},e.prototype.stopAnimation=function(e,t,n){},e.prototype.removeAnimationGroup=function(e){var t=this.animationGroups.indexOf(e);return-1!==t&&this.animationGroups.splice(t,1),this.onAnimationGroupRemovedObservable.notifyObservers(e),t},e.prototype.removeMultiMaterial=function(e){var t=this.multiMaterials.indexOf(e);return-1!==t&&this.multiMaterials.splice(t,1),this.onMultiMaterialRemovedObservable.notifyObservers(e),t},e.prototype.removeMaterial=function(e){var t=e._indexInSceneMaterialArray;if(-1!==t&&t=0;n--)if(this.materials[n].id===e)return this.materials[n];if(t)for(n=this.multiMaterials.length-1;n>=0;n--)if(this.multiMaterials[n].id===e)return this.multiMaterials[n];return null},e.prototype.getTextureByUniqueId=function(e){for(var t=0;t=0;t--)if(this.meshes[t].id===e)return this.meshes[t];return null},e.prototype.getLastTransformNodeById=function(e){for(var t=this.transformNodes.length-1;t>=0;t--)if(this.transformNodes[t].id===e)return this.transformNodes[t];return null},e.prototype.getLastEntryById=function(e){var 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];return null},e.prototype.getNodeById=function(e){var t=this.getMeshById(e);if(t)return t;var n=this.getTransformNodeById(e);if(n)return n;var r=this.getLightById(e);if(r)return r;var i=this.getCameraById(e);return i||(this.getBoneById(e)||null)},e.prototype.getNodeByName=function(e){var t=this.getMeshByName(e);if(t)return t;var n=this.getTransformNodeByName(e);if(n)return n;var r=this.getLightByName(e);if(r)return r;var i=this.getCameraByName(e);return i||(this.getBoneByName(e)||null)},e.prototype.getMeshByName=function(e){for(var t=0;t=0;t--)if(this.skeletons[t].id===e)return this.skeletons[t];return null},e.prototype.getSkeletonByUniqueId=function(e){for(var t=0;t0&&(null===(e=this.activeCamera)||void 0===e||e._activeMeshes.reset(),this._activeMeshes.reset(),this._renderingManager.reset(),this._processedMaterials.reset(),this._activeParticleSystems.reset(),this._activeSkeletons.reset(),this._softwareSkinnedMeshes.reset());else if(this._activeMeshesFrozen&&this._activeMeshes.length){if(!this._skipEvaluateActiveMeshesCompletely)for(var t=this._activeMeshes.length,n=0;n0&&0!==(l.layerMask&this.activeCamera.layerMask)&&(this._skipFrustumClipping||l.alwaysSelectAsActiveMesh||l.isInFrustum(this._frustumPlanes)))){this._activeMeshes.push(l),this.activeCamera._activeMeshes.push(l),u!==l&&u._activate(this._renderId,!1);for(var h=0,d=this._preActiveMeshStage;h0){var r=this.getActiveSubMeshCandidates(t),i=r.length;n=n||1===i;for(var o=0;o0&&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(var d=0,p=this._gatherActiveCameraRenderTargetsStage;d0){i.S0.StartPerformanceCounter("Render targets",this._renderTargets.length>0);for(var m=null===(r=this.getBoundingBoxRenderer)||void 0===r?void 0:r.call(this),_=void 0,g=0;g0?m.renderList.data.slice():[]).length=m.renderList.length),v.render(y,this.dumpNextRenderTargets),f=!0}}m&&_&&(m.renderList.data=_,m.renderList.length=_.length),i.S0.EndPerformanceCounter("Render targets",this._renderTargets.length>0),this._renderId++}for(var b=0,S=this._cameraDrawRenderTargetStage;b-1&&(n.trigger===D.Y.ACTION_OnIntersectionExitTrigger&&n._executeCurrent(f.X.CreateNew(t,void 0,i)),t.actionManager.hasSpecificTrigger(D.Y.ACTION_OnIntersectionExitTrigger,(function(e){var t=e.mesh?e.mesh:e;return i===t}))&&n.trigger!==D.Y.ACTION_OnIntersectionExitTrigger||t._intersectionsInProgress.splice(a,1))}},r=0;t.actionManager&&r0&&i0)for(var h=0;h0);for(var m=0;m0),this._renderId++}this._engine.currentRenderPassId=null!==(o=null==f?void 0:f.renderPassId)&&void 0!==o?o:D.Y.RENDERPASS_MAIN,this.activeCamera=f,this._activeCamera&&this._activeCamera.cameraRigMode!==D.Y.RIG_MODE_CUSTOM&&!this.prePass&&this._bindFrameBuffer(this._activeCamera,!1),this.onAfterRenderTargetsRenderObservable.notifyObservers(this);for(var v=0,y=this._beforeClearStage;v0)for(h=0;h0);else{if(!this.activeCamera)throw new Error("No camera defined");this._processSubCameras(this.activeCamera,!!this.activeCamera.outputRenderTarget)}}this._checkIntersections();for(var T=0,E=this._afterRenderStage;T-1&&this._engine.scenes.splice(s,1),F.q._LastCreatedScene===this){F.q._LastCreatedScene=null;for(var l=F.q.Instances.length-1;l>=0;){var c=F.q.Instances[l];if(c.scenes.length>0){F.q._LastCreatedScene=c.scenes[this._engine.scenes.length-1];break}l--}}(s=this._engine._virtualScenes.indexOf(this))>-1&&this._engine._virtualScenes.splice(s,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(),_.M.prototype.setMatrix=I,R._setMatrixOverride=void 0,C.prototype._updateMatrixForUniform=A,C.prototype._updateMatrixForUniformOverride=void 0,this._isDisposed=!0}},e.prototype._disposeList=function(e,t){t=null!=t?t:function(e){return e.dispose()};for(var n=0,r=e.slice(0);n{n.r(t),n.d(t,{iblShadowGBufferDebugPixelShader:()=>a});var r=n(98519),i="iblShadowGBufferDebugPixelShader",o="#ifdef GL_ES\nprecision mediump float;\n#endif\nvarying vec2 vUV;uniform sampler2D textureSampler;uniform sampler2D depthSampler;uniform sampler2D normalSampler;uniform sampler2D positionSampler;uniform sampler2D velocitySampler;uniform vec4 sizeParams;uniform float maxDepth;\n#define offsetX sizeParams.x\n#define offsetY sizeParams.y\n#define widthScale sizeParams.z\n#define heightScale sizeParams.w\nvoid main(void) {vec2 uv =\nvec2((offsetX+vUV.x)*widthScale,(offsetY+vUV.y)*heightScale);vec4 backgroundColour=texture2D(textureSampler,vUV).rgba;vec4 depth=texture2D(depthSampler,vUV);vec4 worldNormal=texture2D(normalSampler,vUV);vec4 worldPosition=texture2D(positionSampler,vUV);vec4 velocityLinear=texture2D(velocitySampler,vUV);if (uv.x<0.0 || uv.x>1.0 || uv.y<0.0 || uv.y>1.0) {gl_FragColor.rgba=backgroundColour;} else {gl_FragColor.a=1.0;if (uv.x<=0.25) {gl_FragColor.rgb=depth.rgb;gl_FragColor.a=1.0;} else if (uv.x<=0.5) {velocityLinear.rg=velocityLinear.rg*0.5+0.5;gl_FragColor.rgb=velocityLinear.rgb;} else if (uv.x<=0.75) {gl_FragColor.rgb=worldPosition.rgb;} else {gl_FragColor.rgb=worldNormal.rgb;}}}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},42015:(e,t,n)=>{n.r(t),n.d(t,{kernelBlurPixelShader:()=>l});var r=n(98519),i=(n(67303),n(78531),"kernelBlurFragment");r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#ifdef DOF\nfactor=sampleCoC(sampleCoord{X}); \ncomputedWeight=KERNEL_WEIGHT{X}*factor;sumOfWeights+=computedWeight;\n#else\ncomputedWeight=KERNEL_WEIGHT{X};\n#endif\n#ifdef PACKEDFLOAT\nblend+=unpack(texture2D(textureSampler,sampleCoord{X}))*computedWeight;\n#else\nblend+=texture2D(textureSampler,sampleCoord{X})*computedWeight;\n#endif\n");var o="kernelBlurFragment2";r.l.IncludesShadersStore[o]||(r.l.IncludesShadersStore[o]="#ifdef DOF\nfactor=sampleCoC(sampleCenter+delta*KERNEL_DEP_OFFSET{X});computedWeight=KERNEL_DEP_WEIGHT{X}*factor;sumOfWeights+=computedWeight;\n#else\ncomputedWeight=KERNEL_DEP_WEIGHT{X};\n#endif\n#ifdef PACKEDFLOAT\nblend+=unpack(texture2D(textureSampler,sampleCenter+delta*KERNEL_DEP_OFFSET{X}))*computedWeight;\n#else\nblend+=texture2D(textureSampler,sampleCenter+delta*KERNEL_DEP_OFFSET{X})*computedWeight;\n#endif\n");var a="kernelBlurPixelShader",s="uniform sampler2D textureSampler;uniform vec2 delta;varying vec2 sampleCenter;\n#ifdef DOF\nuniform sampler2D circleOfConfusionSampler;float sampleCoC(in vec2 offset) {float coc=texture2D(circleOfConfusionSampler,offset).r;return coc; }\n#endif\n#include[0..varyingCount]\n#ifdef PACKEDFLOAT\n#include\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{float computedWeight=0.0;\n#ifdef PACKEDFLOAT\nfloat blend=0.;\n#else\nvec4 blend=vec4(0.);\n#endif\n#ifdef DOF\nfloat sumOfWeights=CENTER_WEIGHT; \nfloat factor=0.0;\n#ifdef PACKEDFLOAT\nblend+=unpack(texture2D(textureSampler,sampleCenter))*CENTER_WEIGHT;\n#else\nblend+=texture2D(textureSampler,sampleCenter)*CENTER_WEIGHT;\n#endif\n#endif\n#include[0..varyingCount]\n#include[0..depCount]\n#ifdef PACKEDFLOAT\ngl_FragColor=pack(blend);\n#else\ngl_FragColor=blend;\n#endif\n#ifdef DOF\ngl_FragColor/=sumOfWeights;\n#endif\n}";r.l.ShadersStore[a]||(r.l.ShadersStore[a]=s);var l={name:a,shader:s}},42107:(e,t,n)=>{var r=n(98519),i="prePassDeclaration";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#ifdef PREPASS\n#extension GL_EXT_draw_buffers : require\nlayout(location=0) out highp vec4 glFragData[{X}];highp vec4 gl_FragColor;\n#ifdef PREPASS_LOCAL_POSITION\nvarying highp vec3 vPosition;\n#endif\n#ifdef PREPASS_DEPTH\nvarying highp vec3 vViewPos;\n#endif\n#ifdef PREPASS_NORMALIZED_VIEW_DEPTH\nvarying highp float vNormViewDepth;\n#endif\n#if defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR)\nvarying highp vec4 vCurrentPosition;varying highp vec4 vPreviousPosition;\n#endif\n#endif\n")},42202:(e,t,n)=>{var r=n(98519),i=(n(50851),n(56174),"gaussianSplattingUboDeclaration");r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#include\n#include\nattribute vec2 position;")},42362:(e,t,n)=>{n.r(t),n.d(t,{iblVoxelGrid3dDebugPixelShaderWGSL:()=>a});var r=n(98519),i="iblVoxelGrid3dDebugPixelShader",o="varying vUV: vec2f;var voxelTextureSampler: sampler;var voxelTexture: texture_3d;var voxelSlabTextureSampler: sampler;var voxelSlabTexture: texture_2d;var textureSamplerSampler: sampler;var textureSampler: texture_2d;uniform sizeParams: vec4f;\n#define offsetX uniforms.sizeParams.x\n#define offsetY uniforms.sizeParams.y\n#define widthScale uniforms.sizeParams.z\n#define heightScale uniforms.sizeParams.w\nuniform mipNumber: f32;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var uv: vec2f =\nvec2f((offsetX+input.vUV.x)*widthScale,(offsetY+input.vUV.y)*heightScale);var background: vec4f=textureSample(textureSampler,textureSamplerSampler,input.vUV);var voxelSlab: vec4f=textureSample(voxelSlabTexture,voxelSlabTextureSampler,input.vUV);var size: vec3u=textureDimensions(voxelTexture, i32(uniforms.mipNumber));var dimension: f32=ceil(sqrt( f32(size.z)));var samplePos: vec2f=fract(uv.xy* vec2f(dimension));var sampleIndex: u32= u32(floor(uv.x* f32(dimension)) +\nfloor(uv.y* f32(dimension))*dimension);var mip_separator: f32=0.0;if (samplePos.x<0.01 || samplePos.y<0.01) {mip_separator=1.0;}\nvar outBounds: bool=select(false,true,sampleIndex>size.z-1);sampleIndex=clamp(sampleIndex,0,size.z-1);var samplePosInt: vec2i= vec2i(samplePos.xy* vec2f(size.xy));var voxel: vec3f=textureLoad(voxelTexture,\nvec3i(i32(samplePosInt.x),i32(samplePosInt.y),i32(sampleIndex)),\ni32(uniforms.mipNumber)).rgb;if (uv.x<0.0 || uv.x>1.0 || uv.y<0.0 || uv.y>1.0) {fragmentOutputs.color=background;} else {if (outBounds) {voxel= vec3f(0.15,0.0,0.0);} else {if (voxel.r>0.001) {voxel.g=1.0;}\nvoxel.r+=mip_separator;}\nfragmentOutputs.color=vec4f(mix(background.rgb,voxelSlab.rgb,voxelSlab.a)+voxel,1.0);}}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},42513:(e,t,n)=>{var r=n(98519),i="bumpVertexDeclaration";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#if defined(BUMP) || defined(PARALLAX) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC)\n#if defined(TANGENT) && defined(NORMAL) \nvarying mat3 vTBN;\n#endif\n#endif\n")},42769:(e,t,n)=>{n.r(t),n.d(t,{meshUVSpaceRendererFinaliserPixelShaderWGSL:()=>a});var r=n(98519),i="meshUVSpaceRendererFinaliserPixelShader",o="#define DISABLE_UNIFORMITY_ANALYSIS\nvarying vUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d;var maskTextureSamplerSampler: sampler;var maskTextureSampler: texture_2d;uniform textureSize: vec2f;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var mask: vec4f=textureSample(maskTextureSampler,maskTextureSamplerSampler,input.vUV).rgba;if (mask.r>0.5) {fragmentOutputs.color=textureSample(textureSampler,textureSamplerSampler,input.vUV);} else {var texelSize: vec2f=4.0/uniforms.textureSize;var uv_p01: vec2f=input.vUV+ vec2f(-1.0,0.0)*texelSize;var uv_p21: vec2f=input.vUV+ vec2f(1.0,0.0)*texelSize;var uv_p10: vec2f=input.vUV+ vec2f(0.0,-1.0)*texelSize;var uv_p12: vec2f=input.vUV+ vec2f(0.0,1.0)*texelSize;var mask_p01: f32=textureSample(maskTextureSampler,maskTextureSamplerSampler,uv_p01).r;var mask_p21: f32=textureSample(maskTextureSampler,maskTextureSamplerSampler,uv_p21).r;var mask_p10: f32=textureSample(maskTextureSampler,maskTextureSamplerSampler,uv_p10).r;var mask_p12: f32=textureSample(maskTextureSampler,maskTextureSamplerSampler,uv_p12).r;var col: vec4f= vec4f(0.0,0.0,0.0,0.0);var total_weight: f32=0.0;if (mask_p01>0.5) {col+=textureSample(textureSampler,textureSamplerSampler,uv_p01);total_weight+=1.0;}\nif (mask_p21>0.5) {col+=textureSample(textureSampler,textureSamplerSampler,uv_p21);total_weight+=1.0;}\nif (mask_p10>0.5) {col+=textureSample(textureSampler,textureSamplerSampler,uv_p10);total_weight+=1.0;}\nif (mask_p12>0.5) {col+=textureSample(textureSampler,textureSamplerSampler,uv_p12);total_weight+=1.0;}\nif (total_weight>0.0) {fragmentOutputs.color=col/total_weight;} else {fragmentOutputs.color=col;}}}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},42858:(e,t,n)=>{var r=n(98519),i="decalVertexDeclaration";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#ifdef DECAL\nuniform vec4 vDecalInfos;uniform mat4 decalMatrix;\n#endif\n")},43212:(e,t,n)=>{n.r(t),n.d(t,{iblCdfxPixelShader:()=>a});var r=n(98519),i="iblCdfxPixelShader",o="precision highp sampler2D;\n#define PI 3.1415927\nvarying vec2 vUV;uniform sampler2D cdfy;void main(void) {ivec2 cdfyRes=textureSize(cdfy,0);ivec2 currentPixel=ivec2(gl_FragCoord.xy);float cdfx=0.0;for (int x=1; x<=currentPixel.x; x++) {cdfx+=texelFetch(cdfy,ivec2(x-1,cdfyRes.y-1),0).x;}\ngl_FragColor=vec4(vec3(cdfx),1.0);}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},43939:(e,t,n)=>{n.d(t,{Z:()=>i});var r=n(8046),i=function(){function e(e,t,n,i){this.normal=new r.Pq(e,t,n),this.d=i}return e.prototype.asArray=function(){return[this.normal.x,this.normal.y,this.normal.z,this.d]},e.prototype.clone=function(){return new e(this.normal.x,this.normal.y,this.normal.z,this.d)},e.prototype.getClassName=function(){return"Plane"},e.prototype.getHashCode=function(){var e=this.normal.getHashCode();return 397*e^this.d},e.prototype.normalize=function(){var e=Math.sqrt(this.normal.x*this.normal.x+this.normal.y*this.normal.y+this.normal.z*this.normal.z),t=0;return 0!==e&&(t=1/e),this.normal.x*=t,this.normal.y*=t,this.normal.z*=t,this.d*=t,this},e.prototype.transform=function(t){var n=e._TmpMatrix;t.invertToRef(n);var r=n.m,i=this.normal.x,o=this.normal.y,a=this.normal.z,s=this.d;return new e(i*r[0]+o*r[1]+a*r[2]+s*r[3],i*r[4]+o*r[5]+a*r[6]+s*r[7],i*r[8]+o*r[9]+a*r[10]+s*r[11],i*r[12]+o*r[13]+a*r[14]+s*r[15])},e.prototype.dotCoordinate=function(e){return this.normal.x*e.x+this.normal.y*e.y+this.normal.z*e.z+this.d},e.prototype.copyFromPoints=function(e,t,n){var r,i=t.x-e.x,o=t.y-e.y,a=t.z-e.z,s=n.x-e.x,l=n.y-e.y,c=n.z-e.z,u=o*c-a*l,h=a*s-i*c,d=i*l-o*s,p=Math.sqrt(u*u+h*h+d*d);return r=0!==p?1/p:0,this.normal.x=u*r,this.normal.y=h*r,this.normal.z=d*r,this.d=-(this.normal.x*e.x+this.normal.y*e.y+this.normal.z*e.z),this},e.prototype.isFrontFacingTo=function(e,t){return r.Pq.Dot(this.normal,e)<=t},e.prototype.signedDistanceTo=function(e){return r.Pq.Dot(e,this.normal)+this.d},e.FromArray=function(t){return new e(t[0],t[1],t[2],t[3])},e.FromPoints=function(t,n,r){var i=new e(0,0,0,0);return i.copyFromPoints(t,n,r),i},e.FromPositionAndNormal=function(t,n){var r=new e(0,0,0,0);return this.FromPositionAndNormalToRef(t,n,r)},e.FromPositionAndNormalToRef=function(e,t,n){return n.normal.copyFrom(t),n.normal.normalize(),n.d=-e.dot(n.normal),n},e.SignedDistanceToPlaneFromPositionAndNormal=function(e,t,n){var i=-(t.x*e.x+t.y*e.y+t.z*e.z);return r.Pq.Dot(n,t)+i},e._TmpMatrix=r.uq.Identity(),e}()},43967:(e,t,n)=>{n.r(t),n.d(t,{particlesVertexShaderWGSL:()=>a});var r=n(98519),i=(n(9436),n(79716),n(38197),n(63002),n(70898),n(55607),"particlesVertexShader"),o="attribute position: vec3f;attribute color: vec4f;attribute angle: f32;attribute size: vec2f;\n#ifdef ANIMATESHEET\nattribute cellIndex: f32;\n#endif\n#ifndef BILLBOARD\nattribute direction: vec3f;\n#endif\n#ifdef BILLBOARDSTRETCHED\nattribute direction: vec3f;\n#endif\n#ifdef RAMPGRADIENT\nattribute remapData: vec4f;\n#endif\nattribute offset: vec2f;uniform view: mat4x4f;uniform projection: mat4x4f;uniform translationPivot: vec2f;\n#ifdef ANIMATESHEET\nuniform particlesInfos: vec3f; \n#endif\nvarying vUV: vec2f;varying vColor: vec4f;\n#ifdef RAMPGRADIENT\nvarying remapRanges: vec4f;\n#endif\n#if defined(BILLBOARD) && !defined(BILLBOARDY) && !defined(BILLBOARDSTRETCHED)\nuniform invView: mat4x4f;\n#endif\n#include\n#include\n#include\n#ifdef BILLBOARD\nuniform eyePosition: vec3f;\n#endif\nfn rotate(yaxis: vec3f,rotatedCorner: vec3f)->vec3f {var xaxis: vec3f=normalize(cross( vec3f(0.,1.0,0.),yaxis));var zaxis: vec3f=normalize(cross(yaxis,xaxis));var row0: vec3f= vec3f(xaxis.x,xaxis.y,xaxis.z);var row1: vec3f= vec3f(yaxis.x,yaxis.y,yaxis.z);var row2: vec3f= vec3f(zaxis.x,zaxis.y,zaxis.z);var rotMatrix: mat3x3f= mat3x3f(row0,row1,row2);var alignedCorner: vec3f=rotMatrix*rotatedCorner;return vertexInputs.position+alignedCorner;}\n#ifdef BILLBOARDSTRETCHED\nfn rotateAlign(toCamera: vec3f,rotatedCorner: vec3f)->vec3f {var normalizedToCamera: vec3f=normalize(toCamera);var normalizedCrossDirToCamera: vec3f=normalize(cross(normalize(vertexInputs.direction),normalizedToCamera));var row0: vec3f= vec3f(normalizedCrossDirToCamera.x,normalizedCrossDirToCamera.y,normalizedCrossDirToCamera.z);var row2: vec3f= vec3f(normalizedToCamera.x,normalizedToCamera.y,normalizedToCamera.z);\n#ifdef BILLBOARDSTRETCHED_LOCAL\nvar row1: vec3f=vertexInputs.direction;\n#else\nvar crossProduct: vec3f=normalize(cross(normalizedToCamera,normalizedCrossDirToCamera));var row1: vec3f= vec3f(crossProduct.x,crossProduct.y,crossProduct.z);\n#endif\nvar rotMatrix: mat3x3f= mat3x3f(row0,row1,row2);var alignedCorner: vec3f=rotMatrix*rotatedCorner;return vertexInputs.position+alignedCorner;}\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvar cornerPos: vec2f;var vPositionW: vec3f;cornerPos=( vec2f(input.offset.x-0.5,input.offset.y -0.5)-uniforms.translationPivot)*input.size;\n#ifdef BILLBOARD\nvar rotatedCorner: vec3f;\n#ifdef BILLBOARDY\nrotatedCorner.x=cornerPos.x*cos(input.angle)-cornerPos.y*sin(input.angle)+uniforms.translationPivot.x;rotatedCorner.z=cornerPos.x*sin(input.angle)+cornerPos.y*cos(input.angle)+uniforms.translationPivot.y;rotatedCorner.y=0.;var yaxis: vec3f=input.position-uniforms.eyePosition;yaxis.y=0.;vPositionW=rotate(normalize(yaxis),rotatedCorner);var viewPos: vec3f=(uniforms.view* vec4f(vPositionW,1.0)).xyz;\n#elif defined(BILLBOARDSTRETCHED)\nrotatedCorner.x=cornerPos.x*cos(input.angle)-cornerPos.y*sin(input.angle)+uniforms.translationPivot.x;rotatedCorner.y=cornerPos.x*sin(input.angle)+cornerPos.y*cos(input.angle)+uniforms.translationPivot.y;rotatedCorner.z=0.;var toCamera: vec3f=input.position-uniforms.eyePosition;vPositionW=rotateAlign(toCamera,rotatedCorner);var viewPos: vec3f=(uniforms.view* vec4f(vPositionW,1.0)).xyz;\n#else\nrotatedCorner.x=cornerPos.x*cos(input.angle)-cornerPos.y*sin(input.angle)+uniforms.translationPivot.x;rotatedCorner.y=cornerPos.x*sin(input.angle)+cornerPos.y*cos(input.angle)+uniforms.translationPivot.y;rotatedCorner.z=0.;var viewPos: vec3f=(uniforms.view* vec4f(input.position,1.0)).xyz+rotatedCorner;vPositionW=(uniforms.invView* vec4f(viewPos,1)).xyz;\n#endif\n#ifdef RAMPGRADIENT\nvertexOutputs.remapRanges=input.remapData;\n#endif\nvertexOutputs.position=uniforms.projection* vec4f(viewPos,1.0);\n#else\nvar rotatedCorner: vec3f;rotatedCorner.x=cornerPos.x*cos(input.angle)-cornerPos.y*sin(input.angle)+uniforms.translationPivot.x;rotatedCorner.z=cornerPos.x*sin(input.angle)+cornerPos.y*cos(input.angle)+uniforms.translationPivot.y;rotatedCorner.y=0.;var yaxis: vec3f=normalize(vertexInputs.direction);vPositionW=rotate(yaxis,rotatedCorner);vertexOutputs.position=uniforms.projection*uniforms.view* vec4f(vPositionW,1.0);\n#endif\nvertexOutputs.vColor=input.color;\n#ifdef ANIMATESHEET\nvar rowOffset: f32=floor(input.cellIndex*uniforms.particlesInfos.z);var columnOffset: f32=input.cellIndex-rowOffset/uniforms.particlesInfos.z;var uvScale: vec2f=uniforms.particlesInfos.xy;var uvOffset: vec2f= vec2f(input.offset.x ,1.0-input.offset.y);vertexOutputs.vUV=(uvOffset+ vec2f(columnOffset,rowOffset))*uvScale;\n#else\nvertexOutputs.vUV=input.offset;\n#endif\n#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4) || defined(CLIPPLANE5) || defined(CLIPPLANE6) || defined(FOG)\nvar worldPos: vec4f= vec4f(vPositionW,1.0);\n#endif\n#include\n#include\n#include\n#define CUSTOM_VERTEX_MAIN_END\n}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},44228:(e,t,n)=>{n.d(t,{q:()=>a});var r=n(78322),i=n(93540),o=n(67367),a=function(e){function t(n,i,a,s,l){void 0===i&&(i=null);var c=this,u=!!(null==l?void 0:l.blockCompilation);return(c=e.call(this,(0,r.Cl)((0,r.Cl)({},l),{name:n,engine:i||o.N.LastCreatedEngine,useShaderStore:!0,useAsPostProcess:!0,fragmentShader:t.FragmentUrl,uniforms:t.Uniforms,samplers:t.Samplers,vertexUrl:t.VertexUrl,blockCompilation:!0}))||this)._packedFloat=!1,c._staticDefines="",c.textureWidth=0,c.textureHeight=0,c._staticDefines=l?Array.isArray(l.defines)?l.defines.join("\n"):l.defines||"":"",c.options.blockCompilation=u,void 0!==a&&(c.direction=a),void 0!==s&&(c.kernel=s),c}return(0,r.C6)(t,e),t.prototype._gatherImports=function(e,t){e?(this._webGPUReady=!0,t.push(Promise.all([Promise.resolve().then(n.bind(n,76832)),Promise.resolve().then(n.bind(n,7621))]))):t.push(Promise.all([Promise.resolve().then(n.bind(n,42015)),Promise.resolve().then(n.bind(n,41182))]))},Object.defineProperty(t.prototype,"kernel",{get:function(){return this._idealKernel},set:function(e){this._idealKernel!==e&&(e=Math.max(e,1),this._idealKernel=e,this._kernel=this._nearestBestKernel(e),this.options.blockCompilation||this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"packedFloat",{get:function(){return this._packedFloat},set:function(e){this._packedFloat!==e&&(this._packedFloat=e,this.options.blockCompilation||this._updateParameters())},enumerable:!1,configurable:!0}),t.prototype.bind=function(t){void 0===t&&(t=!1),e.prototype.bind.call(this,t),this._drawWrapper.effect.setFloat2("delta",1/this.textureWidth*this.direction.x,1/this.textureHeight*this.direction.y)},t.prototype._updateParameters=function(e,t){for(var n=this._kernel,r=(n-1)/2,i=[],o=[],a=0,s=0;s0)return Math.max(i,3)}return Math.max(t,3)},t.prototype._gaussianWeight=function(e){var t=1/3,n=-e*e/(2*t*t);return 1/(Math.sqrt(2*Math.PI)*t)*Math.exp(n)},t.prototype._glslFloat=function(e,t){return void 0===t&&(t=8),e.toFixed(t).replace(/0+$/,"")},t.VertexUrl="kernelBlur",t.FragmentUrl="kernelBlur",t.Uniforms=["delta","direction"],t.Samplers=["circleOfConfusionSampler"],t}(i.$)},44248:(e,t,n)=>{var r=n(98519),i="pbrDebug";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#if DEBUGMODE>0\nif (vClipSpacePosition.x/vClipSpacePosition.w>=vDebugMode.x) {\n#if DEBUGMODE==1\ngl_FragColor.rgb=vPositionW.rgb;\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==2 && defined(NORMAL)\ngl_FragColor.rgb=vNormalW.rgb;\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==3 && defined(BUMP) || DEBUGMODE==3 && defined(PARALLAX) || DEBUGMODE==3 && defined(ANISOTROPIC)\ngl_FragColor.rgb=TBN[0];\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==4 && defined(BUMP) || DEBUGMODE==4 && defined(PARALLAX) || DEBUGMODE==4 && defined(ANISOTROPIC)\ngl_FragColor.rgb=TBN[1];\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==5\ngl_FragColor.rgb=normalW;\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==6 && defined(MAINUV1)\ngl_FragColor.rgb=vec3(vMainUV1,0.0);\n#elif DEBUGMODE==7 && defined(MAINUV2)\ngl_FragColor.rgb=vec3(vMainUV2,0.0);\n#elif DEBUGMODE==8 && defined(CLEARCOAT) && defined(CLEARCOAT_BUMP)\ngl_FragColor.rgb=clearcoatOut.TBNClearCoat[0];\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==9 && defined(CLEARCOAT) && defined(CLEARCOAT_BUMP)\ngl_FragColor.rgb=clearcoatOut.TBNClearCoat[1];\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==10 && defined(CLEARCOAT)\ngl_FragColor.rgb=clearcoatOut.clearCoatNormalW;\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==11 && defined(ANISOTROPIC)\ngl_FragColor.rgb=anisotropicOut.anisotropicNormal;\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==12 && defined(ANISOTROPIC)\ngl_FragColor.rgb=anisotropicOut.anisotropicTangent;\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==13 && defined(ANISOTROPIC)\ngl_FragColor.rgb=anisotropicOut.anisotropicBitangent;\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==20 && defined(ALBEDO)\ngl_FragColor.rgb=albedoTexture.rgb;\n#ifndef GAMMAALBEDO\n#define DEBUGMODE_GAMMA\n#endif\n#elif DEBUGMODE==21 && defined(AMBIENT)\ngl_FragColor.rgb=aoOut.ambientOcclusionColorMap.rgb;\n#elif DEBUGMODE==22 && defined(OPACITY)\ngl_FragColor.rgb=opacityMap.rgb;\n#elif DEBUGMODE==23 && defined(EMISSIVE)\ngl_FragColor.rgb=emissiveColorTex.rgb;\n#ifndef GAMMAEMISSIVE\n#define DEBUGMODE_GAMMA\n#endif\n#elif DEBUGMODE==24 && defined(LIGHTMAP)\ngl_FragColor.rgb=lightmapColor.rgb;\n#ifndef GAMMALIGHTMAP\n#define DEBUGMODE_GAMMA\n#endif\n#elif DEBUGMODE==25 && defined(REFLECTIVITY) && defined(METALLICWORKFLOW)\ngl_FragColor.rgb=reflectivityOut.surfaceMetallicColorMap.rgb;\n#elif DEBUGMODE==26 && defined(REFLECTIVITY) && !defined(METALLICWORKFLOW)\ngl_FragColor.rgb=reflectivityOut.surfaceReflectivityColorMap.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==27 && defined(CLEARCOAT) && defined(CLEARCOAT_TEXTURE)\ngl_FragColor.rgb=vec3(clearcoatOut.clearCoatMapData.rg,0.0);\n#elif DEBUGMODE==28 && defined(CLEARCOAT) && defined(CLEARCOAT_TINT) && defined(CLEARCOAT_TINT_TEXTURE)\ngl_FragColor.rgb=clearcoatOut.clearCoatTintMapData.rgb;\n#elif DEBUGMODE==29 && defined(SHEEN) && defined(SHEEN_TEXTURE)\ngl_FragColor.rgb=sheenOut.sheenMapData.rgb;\n#elif DEBUGMODE==30 && defined(ANISOTROPIC) && defined(ANISOTROPIC_TEXTURE)\ngl_FragColor.rgb=anisotropicOut.anisotropyMapData.rgb;\n#elif DEBUGMODE==31 && defined(SUBSURFACE) && defined(SS_THICKNESSANDMASK_TEXTURE)\ngl_FragColor.rgb=subSurfaceOut.thicknessMap.rgb;\n#elif DEBUGMODE==32 && defined(BUMP)\ngl_FragColor.rgb=texture2D(bumpSampler,vBumpUV).rgb;\n#elif DEBUGMODE==40 && defined(SS_REFRACTION)\ngl_FragColor.rgb=subSurfaceOut.environmentRefraction.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==41 && defined(REFLECTION)\ngl_FragColor.rgb=reflectionOut.environmentRadiance.rgb;\n#ifndef GAMMAREFLECTION\n#define DEBUGMODE_GAMMA\n#endif\n#elif DEBUGMODE==42 && defined(CLEARCOAT) && defined(REFLECTION)\ngl_FragColor.rgb=clearcoatOut.environmentClearCoatRadiance.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==50\ngl_FragColor.rgb=diffuseBase.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==51 && defined(SPECULARTERM)\ngl_FragColor.rgb=specularBase.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==52 && defined(CLEARCOAT)\ngl_FragColor.rgb=clearCoatBase.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==53 && defined(SHEEN)\ngl_FragColor.rgb=sheenBase.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==54 && defined(REFLECTION)\ngl_FragColor.rgb=reflectionOut.environmentIrradiance.rgb;\n#ifndef GAMMAREFLECTION\n#define DEBUGMODE_GAMMA\n#endif\n#elif DEBUGMODE==60\ngl_FragColor.rgb=surfaceAlbedo.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==61\ngl_FragColor.rgb=clearcoatOut.specularEnvironmentR0;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==62 && defined(METALLICWORKFLOW)\ngl_FragColor.rgb=vec3(reflectivityOut.metallic);\n#elif DEBUGMODE==71 && defined(METALLICWORKFLOW)\ngl_FragColor.rgb=reflectivityOut.metallicF0;\n#elif DEBUGMODE==63\ngl_FragColor.rgb=vec3(roughness);\n#elif DEBUGMODE==64\ngl_FragColor.rgb=vec3(alphaG);\n#elif DEBUGMODE==65\ngl_FragColor.rgb=vec3(NdotV);\n#elif DEBUGMODE==66 && defined(CLEARCOAT) && defined(CLEARCOAT_TINT)\ngl_FragColor.rgb=clearcoatOut.clearCoatColor.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==67 && defined(CLEARCOAT)\ngl_FragColor.rgb=vec3(clearcoatOut.clearCoatRoughness);\n#elif DEBUGMODE==68 && defined(CLEARCOAT)\ngl_FragColor.rgb=vec3(clearcoatOut.clearCoatNdotV);\n#elif DEBUGMODE==69 && defined(SUBSURFACE) && defined(SS_TRANSLUCENCY)\ngl_FragColor.rgb=subSurfaceOut.transmittance;\n#elif DEBUGMODE==70 && defined(SUBSURFACE) && defined(SS_REFRACTION)\ngl_FragColor.rgb=subSurfaceOut.refractionTransmittance;\n#elif DEBUGMODE==72\ngl_FragColor.rgb=vec3(microSurface);\n#elif DEBUGMODE==73\ngl_FragColor.rgb=vAlbedoColor.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==74 && !defined(METALLICWORKFLOW)\ngl_FragColor.rgb=vReflectivityColor.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==75\ngl_FragColor.rgb=vEmissiveColor.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==80 && defined(RADIANCEOCCLUSION)\ngl_FragColor.rgb=vec3(seo);\n#elif DEBUGMODE==81 && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D)\ngl_FragColor.rgb=vec3(eho);\n#elif DEBUGMODE==82 && defined(MS_BRDF_ENERGY_CONSERVATION)\ngl_FragColor.rgb=vec3(energyConservationFactor);\n#elif DEBUGMODE==83 && defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\ngl_FragColor.rgb=baseSpecularEnvironmentReflectance;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==84 && defined(CLEARCOAT) && defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\ngl_FragColor.rgb=clearcoatOut.clearCoatEnvironmentReflectance;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==85 && defined(SHEEN) && defined(REFLECTION)\ngl_FragColor.rgb=sheenOut.sheenEnvironmentReflectance;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==86 && defined(ALPHABLEND)\ngl_FragColor.rgb=vec3(luminanceOverAlpha);\n#elif DEBUGMODE==87\ngl_FragColor.rgb=vec3(alpha);\n#elif DEBUGMODE==88 && defined(ALBEDO)\ngl_FragColor.rgb=vec3(albedoTexture.a);\n#elif DEBUGMODE==89\ngl_FragColor.rgb=aoOut.ambientOcclusionColor.rgb;\n#else\nfloat stripeWidth=30.;float stripePos=floor(gl_FragCoord.x/stripeWidth);float whichColor=mod(stripePos,2.);vec3 color1=vec3(.6,.2,.2);vec3 color2=vec3(.3,.1,.1);gl_FragColor.rgb=mix(color1,color2,whichColor);\n#endif\ngl_FragColor.rgb*=vDebugMode.y;\n#ifdef DEBUGMODE_NORMALIZE\ngl_FragColor.rgb=normalize(gl_FragColor.rgb)*0.5+0.5;\n#endif\n#ifdef DEBUGMODE_GAMMA\ngl_FragColor.rgb=toGammaSpace(gl_FragColor.rgb);\n#endif\ngl_FragColor.a=1.0;\n#ifdef PREPASS\ngl_FragData[0]=toLinearSpace(gl_FragColor); \ngl_FragData[1]=vec4(0.,0.,0.,0.); \n#endif\n#ifdef DEBUGMODE_FORCERETURN\nreturn;\n#endif\n}\n#endif\n")},44256:(e,t,n)=>{n.r(t),n.d(t,{ThinEngine:()=>T});var r=n(78322),i=n(53399),o=n(92118),a=n(7164),s=n(5153),l=n(47582),c=n(24054),u=n(26218),h=n(87074),d=n(82673),p=n(81152),f=n(90519),m=n(19133),_=n(74239),g=n(24894),v=n(76320),y=n(3429),b=n(69329),S=function(){},T=function(e){function t(n,r,o,s){var u=this;if(o=o||{},(u=e.call(this,null!=r?r:o.antialias,o,s)||this)._name="WebGL",u.forcePOTTextures=!1,u.validateShaderPrograms=!1,u.disableUniformBuffers=!1,u._webGLVersion=1,u._vertexAttribArraysEnabled=[],u._uintIndicesCurrentlySet=!1,u._currentBoundBuffer=new Array,u._currentFramebuffer=null,u._dummyFramebuffer=null,u._currentBufferPointers=new Array,u._currentInstanceLocations=new Array,u._currentInstanceBuffers=new Array,u._vaoRecordInProgress=!1,u._mustWipeVertexAttributes=!1,u._nextFreeTextureSlots=new Array,u._maxSimultaneousTextures=0,u._maxMSAASamplesOverride=null,u._unpackFlipYCached=null,u.enableUnpackFlipYCached=!0,u._boundUniforms={},!n)return u;var h=null;if(n.getContext){if(h=n,void 0===o.preserveDrawingBuffer&&(o.preserveDrawingBuffer=!1),void 0===o.xrCompatible&&(o.xrCompatible=!1),navigator&&navigator.userAgent){u._setupMobileChecks();for(var d=navigator.userAgent,p=0,f=t.ExceptionList;p0&&parseInt(b[b.length-1])>=y)continue}for(var T=0,E=g;T1?new c.B:new l.n;var C="Babylon.js v".concat(t.Version);a.V.Log(C+" - ".concat(u.description)),u._renderingCanvas&&u._renderingCanvas.setAttribute&&u._renderingCanvas.setAttribute("data-engine",C);var R=(0,i.N5)(u._gl);return R.validateShaderPrograms=u.validateShaderPrograms,R.parallelShaderCompile=u._caps.parallelShaderCompile,u}return(0,r.C6)(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return this._name},set:function(e){this._name=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"version",{get:function(){return this._webGLVersion},enumerable:!1,configurable:!0}),Object.defineProperty(t,"ShadersRepository",{get:function(){return _.M.ShadersRepository},set:function(e){_.M.ShadersRepository=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"supportsUniformBuffers",{get:function(){return this.webGLVersion>1&&!this.disableUniformBuffers},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"needPOTTextures",{get:function(){return this._webGLVersion<2||this.forcePOTTextures},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_supportsHardwareTextureRescaling",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"framebufferDimensionsObject",{set:function(e){this._framebufferDimensionsObject=e},enumerable:!1,configurable:!0}),t.prototype.snapshotRenderingReset=function(){this.snapshotRendering=!1},t.prototype._clearEmptyResources=function(){this._dummyFramebuffer=null,e.prototype._clearEmptyResources.call(this)},t.prototype._getShaderProcessingContext=function(e){return null},t.prototype.areAllEffectsReady=function(){for(var e in this._compiledEffects)if(!this._compiledEffects[e].isReady())return!1;return!0},t.prototype._initGLContext=function(){var e;this._caps={maxTexturesImageUnits:this._gl.getParameter(this._gl.MAX_TEXTURE_IMAGE_UNITS),maxCombinedTexturesImageUnits:this._gl.getParameter(this._gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS),maxVertexTextureImageUnits:this._gl.getParameter(this._gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxTextureSize:this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),maxSamples:this._webGLVersion>1?this._gl.getParameter(this._gl.MAX_SAMPLES):1,maxCubemapTextureSize:this._gl.getParameter(this._gl.MAX_CUBE_MAP_TEXTURE_SIZE),maxRenderTextureSize:this._gl.getParameter(this._gl.MAX_RENDERBUFFER_SIZE),maxVertexAttribs:this._gl.getParameter(this._gl.MAX_VERTEX_ATTRIBS),maxVaryingVectors:this._gl.getParameter(this._gl.MAX_VARYING_VECTORS),maxFragmentUniformVectors:this._gl.getParameter(this._gl.MAX_FRAGMENT_UNIFORM_VECTORS),maxVertexUniformVectors:this._gl.getParameter(this._gl.MAX_VERTEX_UNIFORM_VECTORS),shaderFloatPrecision:0,parallelShaderCompile:this._gl.getExtension("KHR_parallel_shader_compile")||void 0,standardDerivatives:this._webGLVersion>1||null!==this._gl.getExtension("OES_standard_derivatives"),maxAnisotropy:1,astc:this._gl.getExtension("WEBGL_compressed_texture_astc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_astc"),bptc:this._gl.getExtension("EXT_texture_compression_bptc")||this._gl.getExtension("WEBKIT_EXT_texture_compression_bptc"),s3tc:this._gl.getExtension("WEBGL_compressed_texture_s3tc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc"),s3tc_srgb:this._gl.getExtension("WEBGL_compressed_texture_s3tc_srgb")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc_srgb"),pvrtc:this._gl.getExtension("WEBGL_compressed_texture_pvrtc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),etc1:this._gl.getExtension("WEBGL_compressed_texture_etc1")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_etc1"),etc2:this._gl.getExtension("WEBGL_compressed_texture_etc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_etc")||this._gl.getExtension("WEBGL_compressed_texture_es3_0"),textureAnisotropicFilterExtension:this._gl.getExtension("EXT_texture_filter_anisotropic")||this._gl.getExtension("WEBKIT_EXT_texture_filter_anisotropic")||this._gl.getExtension("MOZ_EXT_texture_filter_anisotropic"),uintIndices:this._webGLVersion>1||null!==this._gl.getExtension("OES_element_index_uint"),fragmentDepthSupported:this._webGLVersion>1||null!==this._gl.getExtension("EXT_frag_depth"),highPrecisionShaderSupported:!1,timerQuery:this._gl.getExtension("EXT_disjoint_timer_query_webgl2")||this._gl.getExtension("EXT_disjoint_timer_query"),supportOcclusionQuery:this._webGLVersion>1,canUseTimestampForTimerQuery:!1,drawBuffersExtension:!1,maxMSAASamples:1,colorBufferFloat:!!(this._webGLVersion>1&&this._gl.getExtension("EXT_color_buffer_float")),blendFloat:null!==this._gl.getExtension("EXT_float_blend"),supportFloatTexturesResolve:!1,rg11b10ufColorRenderable:!1,colorBufferHalfFloat:!!(this._webGLVersion>1&&this._gl.getExtension("EXT_color_buffer_half_float")),textureFloat:!!(this._webGLVersion>1||this._gl.getExtension("OES_texture_float")),textureHalfFloat:!!(this._webGLVersion>1||this._gl.getExtension("OES_texture_half_float")),textureHalfFloatRender:!1,textureFloatLinearFiltering:!1,textureFloatRender:!1,textureHalfFloatLinearFiltering:!1,vertexArrayObject:!1,instancedArrays:!1,textureLOD:!!(this._webGLVersion>1||this._gl.getExtension("EXT_shader_texture_lod")),texelFetch:1!==this._webGLVersion,blendMinMax:!1,multiview:this._gl.getExtension("OVR_multiview2"),oculusMultiview:this._gl.getExtension("OCULUS_multiview"),depthTextureExtension:!1,canUseGLInstanceID:this._webGLVersion>1,canUseGLVertexID:this._webGLVersion>1,supportComputeShaders:!1,supportSRGBBuffers:!1,supportTransformFeedbacks:this._webGLVersion>1,textureMaxLevel:this._webGLVersion>1,texture2DArrayMaxLayerCount:this._webGLVersion>1?this._gl.getParameter(this._gl.MAX_ARRAY_TEXTURE_LAYERS):128,disableMorphTargetTexture:!1,textureNorm16:!!this._gl.getExtension("EXT_texture_norm16"),blendParametersPerTarget:!1,dualSourceBlending:!1},this._caps.supportFloatTexturesResolve=this._caps.colorBufferFloat,this._caps.rg11b10ufColorRenderable=this._caps.colorBufferFloat,this._glVersion=this._gl.getParameter(this._gl.VERSION);var t=this._gl.getExtension("WEBGL_debug_renderer_info");null!=t&&(this._glRenderer=this._gl.getParameter(t.UNMASKED_RENDERER_WEBGL),this._glVendor=this._gl.getParameter(t.UNMASKED_VENDOR_WEBGL)),this._glVendor||(this._glVendor=this._gl.getParameter(this._gl.VENDOR)||"Unknown vendor"),this._glRenderer||(this._glRenderer=this._gl.getParameter(this._gl.RENDERER)||"Unknown renderer"),36193!==this._gl.HALF_FLOAT_OES&&(this._gl.HALF_FLOAT_OES=36193),34842!==this._gl.RGBA16F&&(this._gl.RGBA16F=34842),34836!==this._gl.RGBA32F&&(this._gl.RGBA32F=34836),35056!==this._gl.DEPTH24_STENCIL8&&(this._gl.DEPTH24_STENCIL8=35056),this._caps.timerQuery&&(1===this._webGLVersion&&(this._gl.getQuery=this._caps.timerQuery.getQueryEXT.bind(this._caps.timerQuery)),this._caps.canUseTimestampForTimerQuery=(null!==(e=this._gl.getQuery(this._caps.timerQuery.TIMESTAMP_EXT,this._caps.timerQuery.QUERY_COUNTER_BITS_EXT))&&void 0!==e?e:0)>0),this._caps.maxAnisotropy=this._caps.textureAnisotropicFilterExtension?this._gl.getParameter(this._caps.textureAnisotropicFilterExtension.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,this._caps.textureFloatLinearFiltering=!(!this._caps.textureFloat||!this._gl.getExtension("OES_texture_float_linear")),this._caps.textureFloatRender=!(!this._caps.textureFloat||!this._canRenderToFloatFramebuffer()),this._caps.textureHalfFloatLinearFiltering=!!(this._webGLVersion>1||this._caps.textureHalfFloat&&this._gl.getExtension("OES_texture_half_float_linear")),this._caps.textureNorm16&&(this._gl.R16_EXT=33322,this._gl.RG16_EXT=33324,this._gl.RGB16_EXT=32852,this._gl.RGBA16_EXT=32859,this._gl.R16_SNORM_EXT=36760,this._gl.RG16_SNORM_EXT=36761,this._gl.RGB16_SNORM_EXT=36762,this._gl.RGBA16_SNORM_EXT=36763);var n=this._gl.getExtension("OES_draw_buffers_indexed");if(this._caps.blendParametersPerTarget=!!n,this._alphaState=new b.i(this._caps.blendParametersPerTarget),n&&(this._gl.blendEquationSeparateIndexed=n.blendEquationSeparateiOES.bind(n),this._gl.blendEquationIndexed=n.blendEquationiOES.bind(n),this._gl.blendFuncSeparateIndexed=n.blendFuncSeparateiOES.bind(n),this._gl.blendFuncIndexed=n.blendFunciOES.bind(n),this._gl.colorMaskIndexed=n.colorMaskiOES.bind(n),this._gl.disableIndexed=n.disableiOES.bind(n),this._gl.enableIndexed=n.enableiOES.bind(n)),this._caps.dualSourceBlending=!!this._gl.getExtension("WEBGL_blend_func_extended"),this._caps.astc&&(this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR),this._caps.bptc&&(this._gl.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=this._caps.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT),this._caps.s3tc_srgb&&(this._gl.COMPRESSED_SRGB_S3TC_DXT1_EXT=this._caps.s3tc_srgb.COMPRESSED_SRGB_S3TC_DXT1_EXT,this._gl.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=this._caps.s3tc_srgb.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,this._gl.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=this._caps.s3tc_srgb.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT),this._caps.etc2&&(this._gl.COMPRESSED_SRGB8_ETC2=this._caps.etc2.COMPRESSED_SRGB8_ETC2,this._gl.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=this._caps.etc2.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC),this._webGLVersion>1&&5131!==this._gl.HALF_FLOAT_OES&&(this._gl.HALF_FLOAT_OES=5131),this._caps.textureHalfFloatRender=this._caps.textureHalfFloat&&this._canRenderToHalfFloatFramebuffer(),this._webGLVersion>1)this._caps.drawBuffersExtension=!0,this._caps.maxMSAASamples=null!==this._maxMSAASamplesOverride?this._maxMSAASamplesOverride:this._gl.getParameter(this._gl.MAX_SAMPLES),this._caps.maxDrawBuffers=this._gl.getParameter(this._gl.MAX_DRAW_BUFFERS);else{var r=this._gl.getExtension("WEBGL_draw_buffers");if(null!==r){this._caps.drawBuffersExtension=!0,this._gl.drawBuffers=r.drawBuffersWEBGL.bind(r),this._caps.maxDrawBuffers=this._gl.getParameter(r.MAX_DRAW_BUFFERS_WEBGL),this._gl.DRAW_FRAMEBUFFER=this._gl.FRAMEBUFFER;for(var i=0;i<16;i++)this._gl["COLOR_ATTACHMENT"+i+"_WEBGL"]=r["COLOR_ATTACHMENT"+i+"_WEBGL"]}}if(this._webGLVersion>1)this._caps.depthTextureExtension=!0;else{var o=this._gl.getExtension("WEBGL_depth_texture");null!=o&&(this._caps.depthTextureExtension=!0,this._gl.UNSIGNED_INT_24_8=o.UNSIGNED_INT_24_8_WEBGL)}if(this.disableVertexArrayObjects)this._caps.vertexArrayObject=!1;else if(this._webGLVersion>1)this._caps.vertexArrayObject=!0;else{var a=this._gl.getExtension("OES_vertex_array_object");null!=a&&(this._caps.vertexArrayObject=!0,this._gl.createVertexArray=a.createVertexArrayOES.bind(a),this._gl.bindVertexArray=a.bindVertexArrayOES.bind(a),this._gl.deleteVertexArray=a.deleteVertexArrayOES.bind(a))}if(this._webGLVersion>1)this._caps.instancedArrays=!0;else{var s=this._gl.getExtension("ANGLE_instanced_arrays");null!=s?(this._caps.instancedArrays=!0,this._gl.drawArraysInstanced=s.drawArraysInstancedANGLE.bind(s),this._gl.drawElementsInstanced=s.drawElementsInstancedANGLE.bind(s),this._gl.vertexAttribDivisor=s.vertexAttribDivisorANGLE.bind(s)):this._caps.instancedArrays=!1}if(this._gl.getShaderPrecisionFormat){var l=this._gl.getShaderPrecisionFormat(this._gl.VERTEX_SHADER,this._gl.HIGH_FLOAT),c=this._gl.getShaderPrecisionFormat(this._gl.FRAGMENT_SHADER,this._gl.HIGH_FLOAT);if(l&&c&&(this._caps.highPrecisionShaderSupported=0!==l.precision&&0!==c.precision,this._caps.shaderFloatPrecision=Math.min(l.precision,c.precision)),!this._shouldUseHighPrecisionShader){var u=this._gl.getShaderPrecisionFormat(this._gl.VERTEX_SHADER,this._gl.MEDIUM_FLOAT),h=this._gl.getShaderPrecisionFormat(this._gl.FRAGMENT_SHADER,this._gl.MEDIUM_FLOAT);u&&h&&(this._caps.shaderFloatPrecision=Math.min(u.precision,h.precision))}this._caps.shaderFloatPrecision<10&&(this._caps.shaderFloatPrecision=10)}if(this._webGLVersion>1)this._caps.blendMinMax=!0;else{var d=this._gl.getExtension("EXT_blend_minmax");null!=d&&(this._caps.blendMinMax=!0,this._gl.MAX=d.MAX_EXT,this._gl.MIN=d.MIN_EXT)}if(!this._caps.supportSRGBBuffers){if(this._webGLVersion>1)this._caps.supportSRGBBuffers=!0,this._glSRGBExtensionValues={SRGB:WebGL2RenderingContext.SRGB,SRGB8:WebGL2RenderingContext.SRGB8,SRGB8_ALPHA8:WebGL2RenderingContext.SRGB8_ALPHA8};else{var p=this._gl.getExtension("EXT_sRGB");null!=p&&(this._caps.supportSRGBBuffers=!0,this._glSRGBExtensionValues={SRGB:p.SRGB_EXT,SRGB8:p.SRGB_ALPHA_EXT,SRGB8_ALPHA8:p.SRGB_ALPHA_EXT})}if(this._creationOptions){var f=this._creationOptions.forceSRGBBufferSupportState;void 0!==f&&(this._caps.supportSRGBBuffers=this._caps.supportSRGBBuffers&&f)}}this._depthCullingState.depthTest=!0,this._depthCullingState.depthFunc=this._gl.LEQUAL,this._depthCullingState.depthMask=!0,this._maxSimultaneousTextures=this._caps.maxCombinedTexturesImageUnits;for(var m=0;m=65535)return new Uint32Array(e);return new Uint16Array(e)}return new Uint16Array(e)},t.prototype.bindArrayBuffer=function(e){this._vaoRecordInProgress||this._unbindVertexArrayObject(),this._bindBuffer(e,this._gl.ARRAY_BUFFER)},t.prototype.bindUniformBlock=function(e,t,n){var r=e.program,i=this._gl.getUniformBlockIndex(r,t);this._gl.uniformBlockBinding(r,i,n)},t.prototype.bindIndexBuffer=function(e){this._vaoRecordInProgress||this._unbindVertexArrayObject(),this._bindBuffer(e,this._gl.ELEMENT_ARRAY_BUFFER)},t.prototype._bindBuffer=function(e,t){(this._vaoRecordInProgress||this._currentBoundBuffer[t]!==e)&&(this._gl.bindBuffer(t,e?e.underlyingResource:null),this._currentBoundBuffer[t]=e)},t.prototype.updateArrayBuffer=function(e){this._gl.bufferSubData(this._gl.ARRAY_BUFFER,0,e)},t.prototype._vertexAttribPointer=function(e,t,n,r,i,o,a){var s=this._currentBufferPointers[t];if(s){var l=!1;s.active?(s.buffer!==e&&(s.buffer=e,l=!0),s.size!==n&&(s.size=n,l=!0),s.type!==r&&(s.type=r,l=!0),s.normalized!==i&&(s.normalized=i,l=!0),s.stride!==o&&(s.stride=o,l=!0),s.offset!==a&&(s.offset=a,l=!0)):(l=!0,s.active=!0,s.index=t,s.size=n,s.type=r,s.normalized=i,s.stride=o,s.offset=a,s.buffer=e),(l||this._vaoRecordInProgress)&&(this.bindArrayBuffer(e),r===this._gl.UNSIGNED_INT||r===this._gl.INT?this._gl.vertexAttribIPointer(t,n,r,o,a):this._gl.vertexAttribPointer(t,n,r,i,o,a))}},t.prototype._bindIndexBufferWithCache=function(e){null!=e&&this._cachedIndexBuffer!==e&&(this._cachedIndexBuffer=e,this.bindIndexBuffer(e),this._uintIndicesCurrentlySet=e.is32Bits)},t.prototype._bindVertexBuffersAttributes=function(e,t,n){var r=t.getAttributesNames();this._vaoRecordInProgress||this._unbindVertexArrayObject(),this.unbindAllAttributes();for(var i=0;i=0){var a=r[i],s=null;if(n&&(s=n[a]),s||(s=e[a]),!s)continue;this._gl.enableVertexAttribArray(o),this._vaoRecordInProgress||(this._vertexAttribArraysEnabled[o]=!0);var l=s.getBuffer();l&&(this._vertexAttribPointer(l,o,s.getSize(),s.type,s.normalized,s.byteStride,s.byteOffset),s.getIsInstanced()&&(this._gl.vertexAttribDivisor(o,s.getInstanceDivisor()),this._vaoRecordInProgress||(this._currentInstanceLocations.push(o),this._currentInstanceBuffers.push(l))))}}},t.prototype.recordVertexArrayObject=function(e,t,n,r){var i=this._gl.createVertexArray();if(!i)throw new Error("Unable to create VAO");return this._vaoRecordInProgress=!0,this._gl.bindVertexArray(i),this._mustWipeVertexAttributes=!0,this._bindVertexBuffersAttributes(e,n,r),this.bindIndexBuffer(t),this._vaoRecordInProgress=!1,this._gl.bindVertexArray(null),i},t.prototype.bindVertexArrayObject=function(e,t){this._cachedVertexArrayObject!==e&&(this._cachedVertexArrayObject=e,this._gl.bindVertexArray(e),this._cachedVertexBuffers=null,this._cachedIndexBuffer=null,this._uintIndicesCurrentlySet=null!=t&&t.is32Bits,this._mustWipeVertexAttributes=!0)},t.prototype.bindBuffersDirectly=function(e,t,n,r,i){if(this._cachedVertexBuffers!==e||this._cachedEffectForVertexBuffers!==i){this._cachedVertexBuffers=e,this._cachedEffectForVertexBuffers=i;var o=i.getAttributesCount();this._unbindVertexArrayObject(),this.unbindAllAttributes();for(var a=0,s=0;s=0&&(this._gl.enableVertexAttribArray(l),this._vertexAttribArraysEnabled[l]=!0,this._vertexAttribPointer(e,l,n[s],this._gl.FLOAT,!1,r,a)),a+=4*n[s]}}this._bindIndexBufferWithCache(t)},t.prototype._unbindVertexArrayObject=function(){this._cachedVertexArrayObject&&(this._cachedVertexArrayObject=null,this._gl.bindVertexArray(null))},t.prototype.bindBuffers=function(e,t,n,r){this._cachedVertexBuffers===e&&this._cachedEffectForVertexBuffers===n||(this._cachedVertexBuffers=e,this._cachedEffectForVertexBuffers=n,this._bindVertexBuffersAttributes(e,n,r)),this._bindIndexBufferWithCache(t)},t.prototype.unbindInstanceAttributes=function(){for(var e,t=0,n=this._currentInstanceLocations.length;t1||this.isWebGPU)),(c!==p.Y.TEXTURETYPE_FLOAT||this._caps.textureFloatLinearFiltering)&&(c!==p.Y.TEXTURETYPE_HALF_FLOAT||this._caps.textureHalfFloatLinearFiltering)||(u=p.Y.TEXTURE_NEAREST_SAMPLINGMODE),c!==p.Y.TEXTURETYPE_FLOAT||this._caps.textureFloat||(c=p.Y.TEXTURETYPE_UNSIGNED_BYTE,a.V.Warn("Float textures are not supported. Type forced to TEXTURETYPE_UNSIGNED_BYTE"));var v=(0,y.vl)(h),b=(0,y.$l)(h),S=this._gl,T=new m.h(this,r),E=e.width||e,x=e.height||e,P=e.depth||0,C=e.layers||0,R=this._getSamplingParameters(u,(s||l)&&!v),A=0!==C?S.TEXTURE_2D_ARRAY:0!==P?S.TEXTURE_3D:S.TEXTURE_2D,I=v?this._getInternalFormatFromDepthTextureFormat(h,!0,b):this._getRGBABufferInternalSizedFormat(c,h,d),O=v?b?S.DEPTH_STENCIL:S.DEPTH_COMPONENT:this._getInternalFormat(h),M=v?this._getWebGLTextureTypeFromDepthTextureFormat(h):this._getWebGLTextureType(c);if(this._bindTextureDirectly(A,T),0!==C?(T.is2DArray=!0,S.texImage3D(A,0,I,E,x,C,0,O,M,null)):0!==P?(T.is3D=!0,S.texImage3D(A,0,I,E,x,P,0,O,M,null)):S.texImage2D(A,0,I,E,x,0,O,M,null),S.texParameteri(A,S.TEXTURE_MAG_FILTER,R.mag),S.texParameteri(A,S.TEXTURE_MIN_FILTER,R.min),S.texParameteri(A,S.TEXTURE_WRAP_S,S.CLAMP_TO_EDGE),S.texParameteri(A,S.TEXTURE_WRAP_T,S.CLAMP_TO_EDGE),v&&this.webGLVersion>1&&(0===g?(S.texParameteri(A,S.TEXTURE_COMPARE_FUNC,p.Y.LEQUAL),S.texParameteri(A,S.TEXTURE_COMPARE_MODE,S.NONE)):(S.texParameteri(A,S.TEXTURE_COMPARE_FUNC,g),S.texParameteri(A,S.TEXTURE_COMPARE_MODE,S.COMPARE_REF_TO_TEXTURE))),(s||l)&&this._gl.generateMipmap(A),this._bindTextureDirectly(A,null),T._useSRGBBuffer=d,T.baseWidth=E,T.baseHeight=x,T.width=E,T.height=x,T.depth=C||P,T.isReady=!0,T.samples=f,T.generateMipMaps=s,T.samplingMode=u,T.type=c,T.format=h,T.label=o,T.comparisonFunction=g,this._internalTexturesCache.push(T),_){var D;if(!(D=(0,y.vl)(T.format)?this._setupFramebufferDepthAttachments((0,y.$l)(T.format),T.format!==p.Y.TEXTUREFORMAT_STENCIL8,T.width,T.height,f,T.format,!0):this._createRenderBuffer(T.width,T.height,f,-1,this._getRGBABufferInternalSizedFormat(T.type,T.format,T._useSRGBBuffer),-1)))throw new Error("Unable to create render buffer");T._autoMSAAManagement=!0;var N=T._hardwareTexture;N||(N=T._hardwareTexture=this._createHardwareTexture()),N.addMSAARenderBuffer(D)}return T},t.prototype._getUseSRGBBuffer=function(e,t){return e&&this._caps.supportSRGBBuffers&&(this.webGLVersion>1||t)},t.prototype.createTexture=function(e,t,n,i,o,a,s,l,c,u,h,d,f,_,g){var v=this;return void 0===o&&(o=p.Y.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===a&&(a=null),void 0===s&&(s=null),void 0===l&&(l=null),void 0===c&&(c=null),void 0===u&&(u=null),void 0===h&&(h=null),this._createTextureBase(e,t,n,i,o,a,s,(function(){for(var e=[],t=0;tu||n.height>u||!v._supportsHardwareTextureRescaling)return v._prepareWorkingCanvas(),!(!v._workingCanvas||!v._workingContext||(v._workingCanvas.width=e,v._workingCanvas.height=t,v._workingContext.drawImage(n,0,0,n.width,n.height,0,0,e,t),s.texImage2D(s.TEXTURE_2D,0,c.internalFormat,c.format,c.type,v._workingCanvas),o.width=e,o.height=t,1));var h=new m.h(v,2);return v._bindTextureDirectly(s.TEXTURE_2D,h,!0),s.texImage2D(s.TEXTURE_2D,0,c.internalFormat,c.format,c.type,n),v._rescaleTexture(h,o,i,c.format,(function(){v._releaseTexture(h),v._bindTextureDirectly(s.TEXTURE_2D,o,!0),a()})),!0}),l,c,u,h,d,f,g)},t.prototype._getTexImageParametersForCreateTexture=function(e,t){var n,r;return 1===this.webGLVersion?r=n=this._getInternalFormat(e,t):(n=this._getInternalFormat(e,!1),r=this._getRGBABufferInternalSizedFormat(p.Y.TEXTURETYPE_UNSIGNED_BYTE,e,t)),{internalFormat:r,format:n,type:this._gl.UNSIGNED_BYTE}},t.prototype._rescaleTexture=function(e,t,n,r,i){},t.prototype._unpackFlipY=function(e){this._unpackFlipYCached!==e&&(this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL,e?1:0),this.enableUnpackFlipYCached&&(this._unpackFlipYCached=e))},t.prototype._getUnpackAlignement=function(){return this._gl.getParameter(this._gl.UNPACK_ALIGNMENT)},t.prototype._getTextureTarget=function(e){return e.isCube?this._gl.TEXTURE_CUBE_MAP:e.is3D?this._gl.TEXTURE_3D:e.is2DArray||e.isMultiview?this._gl.TEXTURE_2D_ARRAY:this._gl.TEXTURE_2D},t.prototype.updateTextureSamplingMode=function(e,t,n){void 0===n&&(n=!1);var r=this._getTextureTarget(t),i=this._getSamplingParameters(e,t.useMipMaps||n);this._setTextureParameterInteger(r,this._gl.TEXTURE_MAG_FILTER,i.mag,t),this._setTextureParameterInteger(r,this._gl.TEXTURE_MIN_FILTER,i.min),n&&i.hasMipMaps&&(t.generateMipMaps=!0,this._gl.generateMipmap(r)),this._bindTextureDirectly(r,null),t.samplingMode=e},t.prototype.updateTextureDimensions=function(e,t,n,r){void 0===r&&(r=1)},t.prototype.updateTextureWrappingMode=function(e,t,n,r){void 0===n&&(n=null),void 0===r&&(r=null);var i=this._getTextureTarget(e);null!==t&&(this._setTextureParameterInteger(i,this._gl.TEXTURE_WRAP_S,this._getTextureWrapMode(t),e),e._cachedWrapU=t),null!==n&&(this._setTextureParameterInteger(i,this._gl.TEXTURE_WRAP_T,this._getTextureWrapMode(n),e),e._cachedWrapV=n),(e.is2DArray||e.is3D)&&null!==r&&(this._setTextureParameterInteger(i,this._gl.TEXTURE_WRAP_R,this._getTextureWrapMode(r),e),e._cachedWrapR=r),this._bindTextureDirectly(i,null)},t.prototype._uploadCompressedDataToTextureDirectly=function(e,t,n,r,i,o,a){void 0===o&&(o=0),void 0===a&&(a=0);var s=this._gl,l=s.TEXTURE_2D;if(e.isCube&&(l=s.TEXTURE_CUBE_MAP_POSITIVE_X+o),e._useSRGBBuffer)switch(t){case p.Y.TEXTUREFORMAT_COMPRESSED_RGB8_ETC2:case p.Y.TEXTUREFORMAT_COMPRESSED_RGB_ETC1_WEBGL:this._caps.etc2?t=s.COMPRESSED_SRGB8_ETC2:e._useSRGBBuffer=!1;break;case p.Y.TEXTUREFORMAT_COMPRESSED_RGBA8_ETC2_EAC:this._caps.etc2?t=s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:e._useSRGBBuffer=!1;break;case p.Y.TEXTUREFORMAT_COMPRESSED_RGBA_BPTC_UNORM:t=s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT;break;case p.Y.TEXTUREFORMAT_COMPRESSED_RGBA_ASTC_4x4:t=s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR;break;case p.Y.TEXTUREFORMAT_COMPRESSED_RGB_S3TC_DXT1:this._caps.s3tc_srgb?t=s.COMPRESSED_SRGB_S3TC_DXT1_EXT:e._useSRGBBuffer=!1;break;case p.Y.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT1:this._caps.s3tc_srgb?t=s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:e._useSRGBBuffer=!1;break;case p.Y.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT5:this._caps.s3tc_srgb?t=s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:e._useSRGBBuffer=!1;break;default:e._useSRGBBuffer=!1}if(e.generateMipMaps){var c=e._hardwareTexture;c.memoryAllocated||(s.texStorage2D(s.TEXTURE_2D,Math.floor(Math.log2(Math.max(n,r)))+1,t,e.width,e.height),c.memoryAllocated=!0),this._gl.compressedTexSubImage2D(l,a,0,0,n,r,t,i)}else this._gl.compressedTexImage2D(l,a,t,n,r,0,i)},t.prototype._uploadDataToTextureDirectly=function(e,t,n,r,i,o){void 0===n&&(n=0),void 0===r&&(r=0),void 0===o&&(o=!1);var a=this._gl,s=this._getWebGLTextureType(e.type),l=this._getInternalFormat(e.format),c=void 0===i?this._getRGBABufferInternalSizedFormat(e.type,e.format,e._useSRGBBuffer):this._getInternalFormat(i,e._useSRGBBuffer);this._unpackFlipY(e.invertY);var u=a.TEXTURE_2D;e.isCube&&(u=a.TEXTURE_CUBE_MAP_POSITIVE_X+n);var h=Math.round(Math.log(e.width)*Math.LOG2E),d=Math.round(Math.log(e.height)*Math.LOG2E),p=o?e.width:Math.pow(2,Math.max(h-r,0)),f=o?e.height:Math.pow(2,Math.max(d-r,0));a.texImage2D(u,r,c,p,f,0,l,s,t)},t.prototype.updateTextureData=function(e,t,n,r,i,o,a,s,l){void 0===a&&(a=0),void 0===s&&(s=0),void 0===l&&(l=!1);var c=this._gl,u=this._getWebGLTextureType(e.type),h=this._getInternalFormat(e.format);this._unpackFlipY(e.invertY);var d=c.TEXTURE_2D,p=c.TEXTURE_2D;e.isCube&&(p=c.TEXTURE_CUBE_MAP_POSITIVE_X+a,d=c.TEXTURE_CUBE_MAP),this._bindTextureDirectly(d,e,!0),c.texSubImage2D(p,s,n,r,i,o,h,u,t),l&&this._gl.generateMipmap(p),this._bindTextureDirectly(d,null)},t.prototype._uploadArrayBufferViewToTexture=function(e,t,n,r){void 0===n&&(n=0),void 0===r&&(r=0);var i=this._gl,o=e.isCube?i.TEXTURE_CUBE_MAP:i.TEXTURE_2D;this._bindTextureDirectly(o,e,!0),this._uploadDataToTextureDirectly(e,t,n,r),this._bindTextureDirectly(o,null,!0)},t.prototype._prepareWebGLTextureContinuation=function(e,t,n,r,i){var o=this._gl;if(o){var a=this._getSamplingParameters(i,!n);o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,a.mag),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,a.min),n||r||o.generateMipmap(o.TEXTURE_2D),this._bindTextureDirectly(o.TEXTURE_2D,null),t&&t.removePendingData(e),e.onLoadedObservable.notifyObservers(e),e.onLoadedObservable.clear()}},t.prototype._prepareWebGLTexture=function(e,t,n,r,i,o,a,s,l,c){var u=this,d=this.getCaps().maxTextureSize,f=Math.min(d,this.needPOTTextures?(0,h.R)(r.width,d):r.width),m=Math.min(d,this.needPOTTextures?(0,h.R)(r.height,d):r.height),_=this._gl;_&&(e._hardwareTexture?(this._bindTextureDirectly(_.TEXTURE_2D,e,!0),this._unpackFlipY(void 0===i||!!i),e.baseWidth=r.width,e.baseHeight=r.height,e.width=f,e.height=m,e.isReady=!0,e.type=-1!==e.type?e.type:p.Y.TEXTURETYPE_UNSIGNED_BYTE,e.format=-1!==e.format?e.format:null!=c?c:".jpg"!==t||e._useSRGBBuffer?p.Y.TEXTUREFORMAT_RGBA:p.Y.TEXTUREFORMAT_RGB,s(f,m,r,t,e,(function(){u._prepareWebGLTextureContinuation(e,n,o,a,l)}))||this._prepareWebGLTextureContinuation(e,n,o,a,l)):n&&n.removePendingData(e))},t.prototype._getInternalFormatFromDepthTextureFormat=function(e,t,n){var r=this._gl;if(!t)return r.STENCIL_INDEX8;var i=n?r.DEPTH_STENCIL:r.DEPTH_COMPONENT;return this.webGLVersion>1?e===p.Y.TEXTUREFORMAT_DEPTH16?i=r.DEPTH_COMPONENT16:e===p.Y.TEXTUREFORMAT_DEPTH24?i=r.DEPTH_COMPONENT24:e===p.Y.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8||e===p.Y.TEXTUREFORMAT_DEPTH24_STENCIL8?i=n?r.DEPTH24_STENCIL8:r.DEPTH_COMPONENT24:e===p.Y.TEXTUREFORMAT_DEPTH32_FLOAT?i=r.DEPTH_COMPONENT32F:e===p.Y.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8&&(i=n?r.DEPTH32F_STENCIL8:r.DEPTH_COMPONENT32F):i=r.DEPTH_COMPONENT16,i},t.prototype._getWebGLTextureTypeFromDepthTextureFormat=function(e){var t=this._gl,n=t.UNSIGNED_INT;return e===p.Y.TEXTUREFORMAT_DEPTH16?n=t.UNSIGNED_SHORT:e===p.Y.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8||e===p.Y.TEXTUREFORMAT_DEPTH24_STENCIL8?n=t.UNSIGNED_INT_24_8:e===p.Y.TEXTUREFORMAT_DEPTH32_FLOAT?n=t.FLOAT:e===p.Y.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8?n=t.FLOAT_32_UNSIGNED_INT_24_8_REV:e===p.Y.TEXTUREFORMAT_STENCIL8&&(n=t.UNSIGNED_BYTE),n},t.prototype._setupFramebufferDepthAttachments=function(e,t,n,r,i,o,a){void 0===i&&(i=1),void 0===a&&(a=!1);var s=this._gl;o=null!=o?o:e?p.Y.TEXTUREFORMAT_DEPTH24_STENCIL8:p.Y.TEXTUREFORMAT_DEPTH32_FLOAT;var l=this._getInternalFormatFromDepthTextureFormat(o,t,e);return e&&t?this._createRenderBuffer(n,r,i,s.DEPTH_STENCIL,l,a?-1:s.DEPTH_STENCIL_ATTACHMENT):t?this._createRenderBuffer(n,r,i,l,l,a?-1:s.DEPTH_ATTACHMENT):e?this._createRenderBuffer(n,r,i,l,l,a?-1:s.STENCIL_ATTACHMENT):null},t.prototype._createRenderBuffer=function(e,t,n,r,i,o,a){void 0===a&&(a=!0);var s=this._gl.createRenderbuffer();return this._updateRenderBuffer(s,e,t,n,r,i,o,a)},t.prototype._updateRenderBuffer=function(e,t,n,r,i,o,a,s){void 0===s&&(s=!0);var l=this._gl;return l.bindRenderbuffer(l.RENDERBUFFER,e),r>1&&l.renderbufferStorageMultisample?l.renderbufferStorageMultisample(l.RENDERBUFFER,r,o,t,n):l.renderbufferStorage(l.RENDERBUFFER,i,t,n),-1!==a&&l.framebufferRenderbuffer(l.FRAMEBUFFER,a,l.RENDERBUFFER,e),s&&l.bindRenderbuffer(l.RENDERBUFFER,null),e},t.prototype._releaseTexture=function(e){this._deleteTexture(e._hardwareTexture),this.unbindAllTextures();var t=this._internalTexturesCache.indexOf(e);-1!==t&&this._internalTexturesCache.splice(t,1),e._lodTextureHigh&&e._lodTextureHigh.dispose(),e._lodTextureMid&&e._lodTextureMid.dispose(),e._lodTextureLow&&e._lodTextureLow.dispose(),e._irradianceTexture&&e._irradianceTexture.dispose()},t.prototype._deleteTexture=function(e){null==e||e.release()},t.prototype._setProgram=function(e){this._currentProgram!==e&&((0,i.C5)(e,this._gl),this._currentProgram=e)},t.prototype.bindSamplers=function(e){var t=e.getPipelineContext();this._setProgram(t.program);for(var n=e.getSamplers(),r=0;r-1;if(n&&l&&(this._activeChannel=t._associatedChannel),this._boundTexturesCache[this._activeChannel]!==t||r){if(this._activateCurrentTexture(),t&&t.isMultiview)throw a.V.Error(["_bindTextureDirectly called with a multiview texture!",e,t]),"_bindTextureDirectly called with a multiview texture!";this._gl.bindTexture(e,null!==(o=null===(i=null==t?void 0:t._hardwareTexture)||void 0===i?void 0:i.underlyingResource)&&void 0!==o?o:null),this._boundTexturesCache[this._activeChannel]=t,t&&(t._associatedChannel=this._activeChannel)}else n&&(s=!0,this._activateCurrentTexture());return l&&!n&&this._bindSamplerUniformToChannel(t._associatedChannel,this._activeChannel),s},t.prototype._bindTexture=function(e,t,n){if(void 0!==e){t&&(t._associatedChannel=e),this._activeChannel=e;var r=t?this._getTextureTarget(t):this._gl.TEXTURE_2D;this._bindTextureDirectly(r,t)}},t.prototype.unbindAllTextures=function(){for(var e=0;e1&&(this._bindTextureDirectly(this._gl.TEXTURE_3D,null),this._bindTextureDirectly(this._gl.TEXTURE_2D_ARRAY,null))},t.prototype.setTexture=function(e,t,n,r){void 0!==e&&(t&&(this._boundUniforms[e]=t),this._setTexture(e,n))},t.prototype._bindSamplerUniformToChannel=function(e,t){var n=this._boundUniforms[e];n&&n._currentState!==t&&(this._gl.uniform1i(n,t),n._currentState=t)},t.prototype._getTextureWrapMode=function(e){switch(e){case p.Y.TEXTURE_WRAP_ADDRESSMODE:return this._gl.REPEAT;case p.Y.TEXTURE_CLAMP_ADDRESSMODE:return this._gl.CLAMP_TO_EDGE;case p.Y.TEXTURE_MIRROR_ADDRESSMODE:return this._gl.MIRRORED_REPEAT}return this._gl.REPEAT},t.prototype._setTexture=function(e,t,n,r,i){if(void 0===n&&(n=!1),void 0===r&&(r=!1),void 0===i&&(i=""),!t)return null!=this._boundTexturesCache[e]&&(this._activeChannel=e,this._bindTextureDirectly(this._gl.TEXTURE_2D,null),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null),this.webGLVersion>1&&(this._bindTextureDirectly(this._gl.TEXTURE_3D,null),this._bindTextureDirectly(this._gl.TEXTURE_2D_ARRAY,null))),!1;if(t.video){this._activeChannel=e;var o=t.getInternalTexture();o&&(o._associatedChannel=e),t.update()}else if(t.delayLoadState===p.Y.DELAYLOADSTATE_NOTLOADED)return t.delayLoad(),!1;var a;a=r?t.depthStencilTexture:t.isReady()?t.getInternalTexture():t.isCube?this.emptyCubeTexture:t.is3D?this.emptyTexture3D:t.is2DArray?this.emptyTexture2DArray:this.emptyTexture,!n&&a&&(a._associatedChannel=e);var s=!0;this._boundTexturesCache[e]===a&&(n||this._bindSamplerUniformToChannel(a._associatedChannel,e),s=!1),this._activeChannel=e;var l=this._getTextureTarget(a);if(s&&this._bindTextureDirectly(l,a,n),a&&!a.isMultiview){if(a.isCube&&a._cachedCoordinatesMode!==t.coordinatesMode){a._cachedCoordinatesMode=t.coordinatesMode;var c=t.coordinatesMode!==p.Y.TEXTURE_CUBIC_MODE&&t.coordinatesMode!==p.Y.TEXTURE_SKYBOX_MODE?p.Y.TEXTURE_WRAP_ADDRESSMODE:p.Y.TEXTURE_CLAMP_ADDRESSMODE;t.wrapU=c,t.wrapV=c}a._cachedWrapU!==t.wrapU&&(a._cachedWrapU=t.wrapU,this._setTextureParameterInteger(l,this._gl.TEXTURE_WRAP_S,this._getTextureWrapMode(t.wrapU),a)),a._cachedWrapV!==t.wrapV&&(a._cachedWrapV=t.wrapV,this._setTextureParameterInteger(l,this._gl.TEXTURE_WRAP_T,this._getTextureWrapMode(t.wrapV),a)),a.is3D&&a._cachedWrapR!==t.wrapR&&(a._cachedWrapR=t.wrapR,this._setTextureParameterInteger(l,this._gl.TEXTURE_WRAP_R,this._getTextureWrapMode(t.wrapR),a)),this._setAnisotropicLevel(l,a,t.anisotropicFilteringLevel)}return!0},t.prototype.setTextureArray=function(e,t,n,r){if(void 0!==e&&t){this._textureUnits&&this._textureUnits.length===n.length||(this._textureUnits=new Int32Array(n.length));for(var i=0;i=this._caps.maxVertexAttribs||!this._vertexAttribArraysEnabled[e]||this.disableAttributeByIndex(e)}},t.prototype.releaseEffects=function(){this._compiledEffects={},this.onReleaseEffectsObservable.notifyObservers(this)},t.prototype.dispose=function(){var t;(0,s.BA)()&&this._renderingCanvas&&(this._renderingCanvas.removeEventListener("webglcontextlost",this._onContextLost),this._onContextRestored&&this._renderingCanvas.removeEventListener("webglcontextrestored",this._onContextRestored)),e.prototype.dispose.call(this),this._dummyFramebuffer&&this._gl.deleteFramebuffer(this._dummyFramebuffer),this.unbindAllAttributes(),this._boundUniforms={},this._workingCanvas=null,this._workingContext=null,this._currentBufferPointers.length=0,this._currentProgram=null,this._creationOptions.loseContextOnDispose&&(null===(t=this._gl.getExtension("WEBGL_lose_context"))||void 0===t||t.loseContext()),(0,i.Cm)(this._gl)},t.prototype.attachContextLostEvent=function(e){this._renderingCanvas&&this._renderingCanvas.addEventListener("webglcontextlost",e,!1)},t.prototype.attachContextRestoredEvent=function(e){this._renderingCanvas&&this._renderingCanvas.addEventListener("webglcontextrestored",e,!1)},t.prototype.getError=function(){return this._gl.getError()},t.prototype._canRenderToFloatFramebuffer=function(){return this._webGLVersion>1?this._caps.colorBufferFloat:this._canRenderToFramebuffer(p.Y.TEXTURETYPE_FLOAT)},t.prototype._canRenderToHalfFloatFramebuffer=function(){return this._webGLVersion>1?this._caps.colorBufferFloat:this._canRenderToFramebuffer(p.Y.TEXTURETYPE_HALF_FLOAT)},t.prototype._canRenderToFramebuffer=function(e){for(var t=this._gl;t.getError()!==t.NO_ERROR;);var n=!0,r=t.createTexture();t.bindTexture(t.TEXTURE_2D,r),t.texImage2D(t.TEXTURE_2D,0,this._getRGBABufferInternalSizedFormat(e),1,1,0,t.RGBA,this._getWebGLTextureType(e),null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST);var i=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,i),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0);var o=t.checkFramebufferStatus(t.FRAMEBUFFER);if((n=(n=n&&o===t.FRAMEBUFFER_COMPLETE)&&t.getError()===t.NO_ERROR)&&(t.clear(t.COLOR_BUFFER_BIT),n=n&&t.getError()===t.NO_ERROR),n){t.bindFramebuffer(t.FRAMEBUFFER,null);var a=t.RGBA,s=t.UNSIGNED_BYTE,l=new Uint8Array(4);t.readPixels(0,0,1,1,a,s,l),n=n&&t.getError()===t.NO_ERROR}for(t.deleteTexture(r),t.deleteFramebuffer(i),t.bindFramebuffer(t.FRAMEBUFFER,null);!n&&t.getError()!==t.NO_ERROR;);return n},t.prototype._getWebGLTextureType=function(e){if(1===this._webGLVersion){switch(e){case p.Y.TEXTURETYPE_FLOAT:return this._gl.FLOAT;case p.Y.TEXTURETYPE_HALF_FLOAT:return this._gl.HALF_FLOAT_OES;case p.Y.TEXTURETYPE_UNSIGNED_BYTE:return this._gl.UNSIGNED_BYTE;case p.Y.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4:return this._gl.UNSIGNED_SHORT_4_4_4_4;case p.Y.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1:return this._gl.UNSIGNED_SHORT_5_5_5_1;case p.Y.TEXTURETYPE_UNSIGNED_SHORT_5_6_5:return this._gl.UNSIGNED_SHORT_5_6_5}return this._gl.UNSIGNED_BYTE}switch(e){case p.Y.TEXTURETYPE_BYTE:return this._gl.BYTE;case p.Y.TEXTURETYPE_UNSIGNED_BYTE:return this._gl.UNSIGNED_BYTE;case p.Y.TEXTURETYPE_SHORT:return this._gl.SHORT;case p.Y.TEXTURETYPE_UNSIGNED_SHORT:return this._gl.UNSIGNED_SHORT;case p.Y.TEXTURETYPE_INT:return this._gl.INT;case p.Y.TEXTURETYPE_UNSIGNED_INTEGER:return this._gl.UNSIGNED_INT;case p.Y.TEXTURETYPE_FLOAT:return this._gl.FLOAT;case p.Y.TEXTURETYPE_HALF_FLOAT:return this._gl.HALF_FLOAT;case p.Y.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4:return this._gl.UNSIGNED_SHORT_4_4_4_4;case p.Y.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1:return this._gl.UNSIGNED_SHORT_5_5_5_1;case p.Y.TEXTURETYPE_UNSIGNED_SHORT_5_6_5:return this._gl.UNSIGNED_SHORT_5_6_5;case p.Y.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV:return this._gl.UNSIGNED_INT_2_10_10_10_REV;case p.Y.TEXTURETYPE_UNSIGNED_INT_24_8:return this._gl.UNSIGNED_INT_24_8;case p.Y.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV:return this._gl.UNSIGNED_INT_10F_11F_11F_REV;case p.Y.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV:return this._gl.UNSIGNED_INT_5_9_9_9_REV;case p.Y.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV:return this._gl.FLOAT_32_UNSIGNED_INT_24_8_REV}return this._gl.UNSIGNED_BYTE},t.prototype._getInternalFormat=function(e,t){void 0===t&&(t=!1);var n=t?this._glSRGBExtensionValues.SRGB8_ALPHA8:this._gl.RGBA;switch(e){case p.Y.TEXTUREFORMAT_ALPHA:n=this._gl.ALPHA;break;case p.Y.TEXTUREFORMAT_LUMINANCE:n=this._gl.LUMINANCE;break;case p.Y.TEXTUREFORMAT_LUMINANCE_ALPHA:n=this._gl.LUMINANCE_ALPHA;break;case p.Y.TEXTUREFORMAT_RED:case p.Y.TEXTUREFORMAT_R16_UNORM:case p.Y.TEXTUREFORMAT_R16_SNORM:n=this._gl.RED;break;case p.Y.TEXTUREFORMAT_RG:case p.Y.TEXTUREFORMAT_RG16_UNORM:case p.Y.TEXTUREFORMAT_RG16_SNORM:n=this._gl.RG;break;case p.Y.TEXTUREFORMAT_RGB:case p.Y.TEXTUREFORMAT_RGB16_UNORM:case p.Y.TEXTUREFORMAT_RGB16_SNORM:n=t?this._glSRGBExtensionValues.SRGB:this._gl.RGB;break;case p.Y.TEXTUREFORMAT_RGBA:case p.Y.TEXTUREFORMAT_RGBA16_UNORM:case p.Y.TEXTUREFORMAT_RGBA16_SNORM:n=t?this._glSRGBExtensionValues.SRGB8_ALPHA8:this._gl.RGBA}if(this._webGLVersion>1)switch(e){case p.Y.TEXTUREFORMAT_RED_INTEGER:n=this._gl.RED_INTEGER;break;case p.Y.TEXTUREFORMAT_RG_INTEGER:n=this._gl.RG_INTEGER;break;case p.Y.TEXTUREFORMAT_RGB_INTEGER:n=this._gl.RGB_INTEGER;break;case p.Y.TEXTUREFORMAT_RGBA_INTEGER:n=this._gl.RGBA_INTEGER}return n},t.prototype._getRGBABufferInternalSizedFormat=function(e,t,n){if(void 0===n&&(n=!1),1===this._webGLVersion){if(void 0!==t)switch(t){case p.Y.TEXTUREFORMAT_ALPHA:return this._gl.ALPHA;case p.Y.TEXTUREFORMAT_LUMINANCE:return this._gl.LUMINANCE;case p.Y.TEXTUREFORMAT_LUMINANCE_ALPHA:return this._gl.LUMINANCE_ALPHA;case p.Y.TEXTUREFORMAT_RGB:return n?this._glSRGBExtensionValues.SRGB:this._gl.RGB}return this._gl.RGBA}switch(e){case p.Y.TEXTURETYPE_BYTE:switch(t){case p.Y.TEXTUREFORMAT_RED:return this._gl.R8_SNORM;case p.Y.TEXTUREFORMAT_RG:return this._gl.RG8_SNORM;case p.Y.TEXTUREFORMAT_RGB:return this._gl.RGB8_SNORM;case p.Y.TEXTUREFORMAT_RED_INTEGER:return this._gl.R8I;case p.Y.TEXTUREFORMAT_RG_INTEGER:return this._gl.RG8I;case p.Y.TEXTUREFORMAT_RGB_INTEGER:return this._gl.RGB8I;case p.Y.TEXTUREFORMAT_RGBA_INTEGER:return this._gl.RGBA8I;default:return this._gl.RGBA8_SNORM}case p.Y.TEXTURETYPE_UNSIGNED_BYTE:switch(t){case p.Y.TEXTUREFORMAT_RED:return this._gl.R8;case p.Y.TEXTUREFORMAT_RG:return this._gl.RG8;case p.Y.TEXTUREFORMAT_RGB:return n?this._glSRGBExtensionValues.SRGB8:this._gl.RGB8;case p.Y.TEXTUREFORMAT_RGBA:return n?this._glSRGBExtensionValues.SRGB8_ALPHA8:this._gl.RGBA8;case p.Y.TEXTUREFORMAT_RED_INTEGER:return this._gl.R8UI;case p.Y.TEXTUREFORMAT_RG_INTEGER:return this._gl.RG8UI;case p.Y.TEXTUREFORMAT_RGB_INTEGER:return this._gl.RGB8UI;case p.Y.TEXTUREFORMAT_RGBA_INTEGER:return this._gl.RGBA8UI;case p.Y.TEXTUREFORMAT_ALPHA:return this._gl.ALPHA;case p.Y.TEXTUREFORMAT_LUMINANCE:return this._gl.LUMINANCE;case p.Y.TEXTUREFORMAT_LUMINANCE_ALPHA:return this._gl.LUMINANCE_ALPHA;default:return this._gl.RGBA8}case p.Y.TEXTURETYPE_SHORT:switch(t){case p.Y.TEXTUREFORMAT_RED_INTEGER:return this._gl.R16I;case p.Y.TEXTUREFORMAT_R16_SNORM:return this._gl.R16_SNORM_EXT;case p.Y.TEXTUREFORMAT_RG16_SNORM:return this._gl.RG16_SNORM_EXT;case p.Y.TEXTUREFORMAT_RGB16_SNORM:return this._gl.RGB16_SNORM_EXT;case p.Y.TEXTUREFORMAT_RGBA16_SNORM:return this._gl.RGBA16_SNORM_EXT;case p.Y.TEXTUREFORMAT_RG_INTEGER:return this._gl.RG16I;case p.Y.TEXTUREFORMAT_RGB_INTEGER:return this._gl.RGB16I;case p.Y.TEXTUREFORMAT_RGBA_INTEGER:default:return this._gl.RGBA16I}case p.Y.TEXTURETYPE_UNSIGNED_SHORT:switch(t){case p.Y.TEXTUREFORMAT_RED_INTEGER:return this._gl.R16UI;case p.Y.TEXTUREFORMAT_R16_UNORM:return this._gl.R16_EXT;case p.Y.TEXTUREFORMAT_RG16_UNORM:return this._gl.RG16_EXT;case p.Y.TEXTUREFORMAT_RGB16_UNORM:return this._gl.RGB16_EXT;case p.Y.TEXTUREFORMAT_RGBA16_UNORM:return this._gl.RGBA16_EXT;case p.Y.TEXTUREFORMAT_RG_INTEGER:return this._gl.RG16UI;case p.Y.TEXTUREFORMAT_RGB_INTEGER:return this._gl.RGB16UI;case p.Y.TEXTUREFORMAT_RGBA_INTEGER:default:return this._gl.RGBA16UI}case p.Y.TEXTURETYPE_INT:switch(t){case p.Y.TEXTUREFORMAT_RED_INTEGER:return this._gl.R32I;case p.Y.TEXTUREFORMAT_RG_INTEGER:return this._gl.RG32I;case p.Y.TEXTUREFORMAT_RGB_INTEGER:return this._gl.RGB32I;case p.Y.TEXTUREFORMAT_RGBA_INTEGER:default:return this._gl.RGBA32I}case p.Y.TEXTURETYPE_UNSIGNED_INTEGER:switch(t){case p.Y.TEXTUREFORMAT_RED_INTEGER:return this._gl.R32UI;case p.Y.TEXTUREFORMAT_RG_INTEGER:return this._gl.RG32UI;case p.Y.TEXTUREFORMAT_RGB_INTEGER:return this._gl.RGB32UI;case p.Y.TEXTUREFORMAT_RGBA_INTEGER:default:return this._gl.RGBA32UI}case p.Y.TEXTURETYPE_FLOAT:switch(t){case p.Y.TEXTUREFORMAT_RED:return this._gl.R32F;case p.Y.TEXTUREFORMAT_RG:return this._gl.RG32F;case p.Y.TEXTUREFORMAT_RGB:return this._gl.RGB32F;case p.Y.TEXTUREFORMAT_RGBA:default:return this._gl.RGBA32F}case p.Y.TEXTURETYPE_HALF_FLOAT:switch(t){case p.Y.TEXTUREFORMAT_RED:return this._gl.R16F;case p.Y.TEXTUREFORMAT_RG:return this._gl.RG16F;case p.Y.TEXTUREFORMAT_RGB:return this._gl.RGB16F;case p.Y.TEXTUREFORMAT_RGBA:default:return this._gl.RGBA16F}case p.Y.TEXTURETYPE_UNSIGNED_SHORT_5_6_5:return this._gl.RGB565;case p.Y.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV:return this._gl.R11F_G11F_B10F;case p.Y.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV:return this._gl.RGB9_E5;case p.Y.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4:return this._gl.RGBA4;case p.Y.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1:return this._gl.RGB5_A1;case p.Y.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV:switch(t){case p.Y.TEXTUREFORMAT_RGBA:return this._gl.RGB10_A2;case p.Y.TEXTUREFORMAT_RGBA_INTEGER:return this._gl.RGB10_A2UI;default:return this._gl.RGB10_A2}}return n?this._glSRGBExtensionValues.SRGB8_ALPHA8:this._gl.RGBA8},t.prototype.readPixels=function(e,t,n,r,i,o,s){void 0===i&&(i=!0),void 0===o&&(o=!0),void 0===s&&(s=null);var l=i?4:3,c=i?this._gl.RGBA:this._gl.RGB,u=n*r*l;if(s){if(s.length{var r=n(98519),i="harmonicsFunctions";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="#ifdef USESPHERICALFROMREFLECTIONMAP\n#ifdef SPHERICAL_HARMONICS\nfn computeEnvironmentIrradiance(normal: vec3f)->vec3f {return uniforms.vSphericalL00\n+ uniforms.vSphericalL1_1*(normal.y)\n+ uniforms.vSphericalL10*(normal.z)\n+ uniforms.vSphericalL11*(normal.x)\n+ uniforms.vSphericalL2_2*(normal.y*normal.x)\n+ uniforms.vSphericalL2_1*(normal.y*normal.z)\n+ uniforms.vSphericalL20*((3.0*normal.z*normal.z)-1.0)\n+ uniforms.vSphericalL21*(normal.z*normal.x)\n+ uniforms.vSphericalL22*(normal.x*normal.x-(normal.y*normal.y));}\n#else\nfn computeEnvironmentIrradiance(normal: vec3f)->vec3f {var Nx: f32=normal.x;var Ny: f32=normal.y;var Nz: f32=normal.z;var C1: vec3f=uniforms.vSphericalZZ.rgb;var Cx: vec3f=uniforms.vSphericalX.rgb;var Cy: vec3f=uniforms.vSphericalY.rgb;var Cz: vec3f=uniforms.vSphericalZ.rgb;var Cxx_zz: vec3f=uniforms.vSphericalXX_ZZ.rgb;var Cyy_zz: vec3f=uniforms.vSphericalYY_ZZ.rgb;var Cxy: vec3f=uniforms.vSphericalXY.rgb;var Cyz: vec3f=uniforms.vSphericalYZ.rgb;var Czx: vec3f=uniforms.vSphericalZX.rgb;var a1: vec3f=Cyy_zz*Ny+Cy;var a2: vec3f=Cyz*Nz+a1;var b1: vec3f=Czx*Nz+Cx;var b2: vec3f=Cxy*Ny+b1;var b3: vec3f=Cxx_zz*Nx+b2;var t1: vec3f=Cz *Nz+C1;var t2: vec3f=a2 *Ny+t1;var t3: vec3f=b3 *Nx+t2;return t3;}\n#endif\n#endif\n")},44520:(e,t,n)=>{n.r(t),n.d(t,{blackAndWhitePixelShaderWGSL:()=>a});var r=n(98519),i="blackAndWhitePixelShader",o="varying vUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d;uniform degree: f32;\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var color: vec3f=textureSample(textureSampler,textureSamplerSampler,input.vUV).rgb;var luminance: f32=dot(color, vec3f(0.3,0.59,0.11)); \nvar blackAndWhite: vec3f= vec3f(luminance,luminance,luminance);fragmentOutputs.color= vec4f(color-((color-blackAndWhite)*uniforms.degree),1.0);}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},44576:(e,t,n)=>{n.d(t,{r:()=>a});var r=n(78322),i=n(7164),o=function(e,t,n){return e?e.getClassName&&"Mesh"===e.getClassName()?null:!e.getClassName||"SubMesh"!==e.getClassName()&&"PhysicsBody"!==e.getClassName()?e.clone?e.clone():Array.isArray(e)?e.slice():n&&"object"==typeof e?(0,r.Cl)({},e):null:e.clone(t):null},a=function(){function e(){}return e.DeepCopy=function(e,t,n,r,a){void 0===a&&(a=!1);for(var s=function(e){var t=[];do{for(var n=0,r=Object.getOwnPropertyNames(e);n0)if("object"==typeof h[0])for(var p=0;p{n.d(t,{LV:()=>y,S0:()=>g,s7:()=>v});var r=n(78322),i=n(66377),o=n(5153),a=n(7164),s=n(44576),l=n(85258),c=n(41190),u=n(46799),h=n(66614),d=n(17347),p=n(53695),f=n(252),m=n(23885),_=n(87074),g=function(){function e(){}return Object.defineProperty(e,"BaseUrl",{get:function(){return d.eC.BaseUrl},set:function(e){d.eC.BaseUrl=e},enumerable:!1,configurable:!0}),Object.defineProperty(e,"CleanUrl",{get:function(){return d.eC.CleanUrl},set:function(e){d.eC.CleanUrl=e},enumerable:!1,configurable:!0}),e.IsAbsoluteUrl=function(e){return 0===e.indexOf("//")||-1!==e.indexOf("://")&&-1!==e.indexOf(".")&&-1!==e.indexOf("/")&&!(e.indexOf(":")>e.indexOf("/"))&&(e.indexOf("://")=t)break;if(r(a),o&&o()){e.breakLoop();break}}e.executeNext()}),a)}),i)},e}();g.Mix=_.zF,g.IsExponentOfTwo=_.L8,h.q.FallbackTexture="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/4QBmRXhpZgAATU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUAAAABAAAARgEoAAMAAAABAAIAAAExAAIAAAAQAAAATgAAAAAAAABgAAAAAQAAAGAAAAABcGFpbnQubmV0IDQuMC41AP/bAEMABAIDAwMCBAMDAwQEBAQFCQYFBQUFCwgIBgkNCw0NDQsMDA4QFBEODxMPDAwSGBITFRYXFxcOERkbGRYaFBYXFv/bAEMBBAQEBQUFCgYGChYPDA8WFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFv/AABEIAQABAAMBIgACEQEDEQH/xAAfAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgv/xAC1EAACAQMDAgQDBQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZGiUmJygpKjQ1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4eLj5OXm5+jp6vHy8/T19vf4+fr/xAAfAQADAQEBAQEBAQEBAAAAAAAAAQIDBAUGBwgJCgv/xAC1EQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2gAMAwEAAhEDEQA/APH6KKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76CiiigD5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BQooooA+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/voKKKKAPl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76CiiigD5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BQooooA+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/voKKKKAPl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76P//Z"},44993:(e,t,n)=>{n.r(t),n.d(t,{convolutionPixelShaderWGSL:()=>a});var r=n(98519),i="convolutionPixelShader",o="varying vUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d;uniform screenSize: vec2f;uniform kernel: array;\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var onePixel: vec2f= vec2f(1.0,1.0)/uniforms.screenSize;var colorSum: vec4f =\ntextureSample(textureSampler,textureSamplerSampler,input.vUV+onePixel* vec2f(-1,-1))*uniforms.kernel[0] +\ntextureSample(textureSampler,textureSamplerSampler,input.vUV+onePixel* vec2f(0,-1))*uniforms.kernel[1] +\ntextureSample(textureSampler,textureSamplerSampler,input.vUV+onePixel* vec2f(1,-1))*uniforms.kernel[2] +\ntextureSample(textureSampler,textureSamplerSampler,input.vUV+onePixel* vec2f(-1,0))*uniforms.kernel[3] +\ntextureSample(textureSampler,textureSamplerSampler,input.vUV+onePixel* vec2f(0,0))*uniforms.kernel[4] +\ntextureSample(textureSampler,textureSamplerSampler,input.vUV+onePixel* vec2f(1,0))*uniforms.kernel[5] +\ntextureSample(textureSampler,textureSamplerSampler,input.vUV+onePixel* vec2f(-1,1))*uniforms.kernel[6] +\ntextureSample(textureSampler,textureSamplerSampler,input.vUV+onePixel* vec2f(0,1))*uniforms.kernel[7] +\ntextureSample(textureSampler,textureSamplerSampler,input.vUV+onePixel* vec2f(1,1))*uniforms.kernel[8];var kernelWeight: f32 =\nuniforms.kernel[0] +\nuniforms.kernel[1] +\nuniforms.kernel[2] +\nuniforms.kernel[3] +\nuniforms.kernel[4] +\nuniforms.kernel[5] +\nuniforms.kernel[6] +\nuniforms.kernel[7] +\nuniforms.kernel[8];if (kernelWeight<=0.0) {kernelWeight=1.0;}\nfragmentOutputs.color= vec4f((colorSum/kernelWeight).rgb,1);}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},45109:(e,t,n)=>{n.d(t,{Ff:()=>m,Jn:()=>d,KA:()=>b,LD:()=>_,PX:()=>u,Sn:()=>g,T$:()=>l,XE:()=>y,_S:()=>h,cL:()=>c,fz:()=>p,he:()=>r,tB:()=>f,zX:()=>v});var r,i,o=n(48810),a=n(25598);!function(e){e[e.NO_COMPRESSION=0]="NO_COMPRESSION",e[e.RLE_COMPRESSION=1]="RLE_COMPRESSION",e[e.ZIPS_COMPRESSION=2]="ZIPS_COMPRESSION",e[e.ZIP_COMPRESSION=3]="ZIP_COMPRESSION",e[e.PIZ_COMPRESSION=4]="PIZ_COMPRESSION",e[e.PXR24_COMPRESSION=5]="PXR24_COMPRESSION"}(r||(r={})),function(e){e[e.INCREASING_Y=0]="INCREASING_Y",e[e.DECREASING_Y=1]="DECREASING_Y"}(i||(i={}));var s=function(){for(var e=new ArrayBuffer(4),t=new Float32Array(e),n=new Uint32Array(e),r=new Uint32Array(512),i=new Uint32Array(512),o=0;o<256;++o)(u=o-127)<-27?(r[o]=0,r[256|o]=32768,i[o]=24,i[256|o]=24):u<-14?(r[o]=1024>>-u-14,r[256|o]=1024>>-u-14|32768,i[o]=-u-1,i[256|o]=-u-1):u<=15?(r[o]=u+15<<10,r[256|o]=u+15<<10|32768,i[o]=13,i[256|o]=13):u<128?(r[o]=31744,r[256|o]=64512,i[o]=24,i[256|o]=24):(r[o]=31744,r[256|o]=64512,i[o]=13,i[256|o]=13);var a=new Uint32Array(2048),s=new Uint32Array(64),l=new Uint32Array(64);for(o=1;o<1024;++o){for(var c=o<<13,u=0;!(8388608&c);)c<<=1,u-=8388608;c&=-8388609,u+=947912704,a[o]=c|u}for(o=1024;o<2048;++o)a[o]=939524096+(o-1024<<13);for(o=1;o<31;++o)s[o]=o<<23;for(s[31]=1199570944,s[32]=2147483648,o=33;o<63;++o)s[o]=2147483648+(o-32<<23);for(s[63]=3347054592,o=1;o<64;++o)32!==o&&(l[o]=1024);return{floatView:t,uint32View:n,baseTable:r,shiftTable:i,mantissaTable:a,exponentTable:s,offsetTable:l}}();function l(e,t){for(var n=new Uint8Array(e),r=0;0!=n[t.value+r];)r+=1;var i=(new TextDecoder).decode(n.slice(t.value,t.value+r));return t.value=t.value+r+1,i}function c(e,t){var n=e.getInt32(t.value,!0);return t.value+=a.b7,n}function u(e,t){var n=e.getUint32(t.value,!0);return t.value+=a.b7,n}function h(e,t){var n=e.getUint8(t.value);return t.value+=a.aN,n}function d(e,t){var n=e.getUint16(t.value,!0);return t.value+=a.JH,n}function p(e,t){var n=e[t.value];return t.value+=a.aN,n}function f(e,t){var n;return n="getBigInt64"in DataView.prototype?Number(e.getBigInt64(t.value,!0)):e.getUint32(t.value+4,!0)+Number(e.getUint32(t.value,!0)<<32),t.value+=a.Kl,n}function m(e,t){var n=e.getFloat32(t.value,!0);return t.value+=a.Y3,n}function _(e,t){return i=1023&(n=d(e,t)),(n>>15?-1:1)*((r=(31744&n)>>10)?31===r?i?NaN:1/0:Math.pow(2,r-15)*(1+i/1024):i/1024*6103515625e-14);var n,r,i}function g(e,t){return function(e){if(Math.abs(e)>65504)throw new Error("Value out of range.Consider using float instead of half-float.");e=(0,o.Clamp)(e,-65504,65504),s.floatView[0]=e;var t=s.uint32View[0],n=t>>23&511;return s.baseTable[n]+((8388607&t)>>s.shiftTable[n])}(m(e,t))}function v(e,t,n,r){switch(n){case"string":case"stringvector":case"iccProfile":return function(e,t,n){var r=(new TextDecoder).decode(new Uint8Array(e).slice(t.value,t.value+n));return t.value=t.value+n,r}(e.buffer,t,r);case"chlist":return function(e,t,n){for(var r=t.value,i=[];t.valueo||(t[i++]=e[n++],i>o));)t[i++]=e[r++]}},45158:(e,t,n)=>{var r,i,o,a,s,l,c;n.d(t,{ST:()=>i,Ze:()=>o,bq:()=>r,dR:()=>c,h8:()=>a,pI:()=>s,sZ:()=>l}),function(e){e[e.Generic=0]="Generic",e[e.Keyboard=1]="Keyboard",e[e.Mouse=2]="Mouse",e[e.Touch=3]="Touch",e[e.DualShock=4]="DualShock",e[e.Xbox=5]="Xbox",e[e.Switch=6]="Switch",e[e.DualSense=7]="DualSense"}(r||(r={})),function(e){e[e.Horizontal=0]="Horizontal",e[e.Vertical=1]="Vertical",e[e.LeftClick=2]="LeftClick",e[e.MiddleClick=3]="MiddleClick",e[e.RightClick=4]="RightClick",e[e.BrowserBack=5]="BrowserBack",e[e.BrowserForward=6]="BrowserForward",e[e.MouseWheelX=7]="MouseWheelX",e[e.MouseWheelY=8]="MouseWheelY",e[e.MouseWheelZ=9]="MouseWheelZ",e[e.Move=12]="Move"}(i||(i={})),function(e){e[e.Horizontal=0]="Horizontal",e[e.Vertical=1]="Vertical",e[e.LeftClick=2]="LeftClick",e[e.MiddleClick=3]="MiddleClick",e[e.RightClick=4]="RightClick",e[e.BrowserBack=5]="BrowserBack",e[e.BrowserForward=6]="BrowserForward",e[e.MouseWheelX=7]="MouseWheelX",e[e.MouseWheelY=8]="MouseWheelY",e[e.MouseWheelZ=9]="MouseWheelZ",e[e.DeltaHorizontal=10]="DeltaHorizontal",e[e.DeltaVertical=11]="DeltaVertical"}(o||(o={})),function(e){e[e.Cross=0]="Cross",e[e.Circle=1]="Circle",e[e.Square=2]="Square",e[e.Triangle=3]="Triangle",e[e.L1=4]="L1",e[e.R1=5]="R1",e[e.L2=6]="L2",e[e.R2=7]="R2",e[e.Share=8]="Share",e[e.Options=9]="Options",e[e.L3=10]="L3",e[e.R3=11]="R3",e[e.DPadUp=12]="DPadUp",e[e.DPadDown=13]="DPadDown",e[e.DPadLeft=14]="DPadLeft",e[e.DPadRight=15]="DPadRight",e[e.Home=16]="Home",e[e.TouchPad=17]="TouchPad",e[e.LStickXAxis=18]="LStickXAxis",e[e.LStickYAxis=19]="LStickYAxis",e[e.RStickXAxis=20]="RStickXAxis",e[e.RStickYAxis=21]="RStickYAxis"}(a||(a={})),function(e){e[e.Cross=0]="Cross",e[e.Circle=1]="Circle",e[e.Square=2]="Square",e[e.Triangle=3]="Triangle",e[e.L1=4]="L1",e[e.R1=5]="R1",e[e.L2=6]="L2",e[e.R2=7]="R2",e[e.Create=8]="Create",e[e.Options=9]="Options",e[e.L3=10]="L3",e[e.R3=11]="R3",e[e.DPadUp=12]="DPadUp",e[e.DPadDown=13]="DPadDown",e[e.DPadLeft=14]="DPadLeft",e[e.DPadRight=15]="DPadRight",e[e.Home=16]="Home",e[e.TouchPad=17]="TouchPad",e[e.LStickXAxis=18]="LStickXAxis",e[e.LStickYAxis=19]="LStickYAxis",e[e.RStickXAxis=20]="RStickXAxis",e[e.RStickYAxis=21]="RStickYAxis"}(s||(s={})),function(e){e[e.A=0]="A",e[e.B=1]="B",e[e.X=2]="X",e[e.Y=3]="Y",e[e.LB=4]="LB",e[e.RB=5]="RB",e[e.LT=6]="LT",e[e.RT=7]="RT",e[e.Back=8]="Back",e[e.Start=9]="Start",e[e.LS=10]="LS",e[e.RS=11]="RS",e[e.DPadUp=12]="DPadUp",e[e.DPadDown=13]="DPadDown",e[e.DPadLeft=14]="DPadLeft",e[e.DPadRight=15]="DPadRight",e[e.Home=16]="Home",e[e.LStickXAxis=17]="LStickXAxis",e[e.LStickYAxis=18]="LStickYAxis",e[e.RStickXAxis=19]="RStickXAxis",e[e.RStickYAxis=20]="RStickYAxis"}(l||(l={})),function(e){e[e.B=0]="B",e[e.A=1]="A",e[e.Y=2]="Y",e[e.X=3]="X",e[e.L=4]="L",e[e.R=5]="R",e[e.ZL=6]="ZL",e[e.ZR=7]="ZR",e[e.Minus=8]="Minus",e[e.Plus=9]="Plus",e[e.LS=10]="LS",e[e.RS=11]="RS",e[e.DPadUp=12]="DPadUp",e[e.DPadDown=13]="DPadDown",e[e.DPadLeft=14]="DPadLeft",e[e.DPadRight=15]="DPadRight",e[e.Home=16]="Home",e[e.Capture=17]="Capture",e[e.LStickXAxis=18]="LStickXAxis",e[e.LStickYAxis=19]="LStickYAxis",e[e.RStickXAxis=20]="RStickXAxis",e[e.RStickYAxis=21]="RStickYAxis"}(c||(c={}))},45310:(e,t,n)=>{n.r(t),n.d(t,{iblShadowDebugPixelShader:()=>a});var r=n(98519),i="iblShadowDebugPixelShader",o="#ifdef GL_ES\nprecision mediump float;\n#endif\nvarying vec2 vUV;uniform sampler2D textureSampler;uniform sampler2D debugSampler;uniform vec4 sizeParams;\n#define offsetX sizeParams.x\n#define offsetY sizeParams.y\n#define widthScale sizeParams.z\n#define heightScale sizeParams.w\nvoid main(void) {vec2 uv =\nvec2((offsetX+vUV.x)*widthScale,(offsetY+vUV.y)*heightScale);vec4 background=texture2D(textureSampler,vUV);vec4 debugColour=texture2D(debugSampler,vUV);if (uv.x<0.0 || uv.x>1.0 || uv.y<0.0 || uv.y>1.0) {gl_FragColor.rgba=background;} else {gl_FragColor.rgb=mix(debugColour.rgb,background.rgb,0.0);gl_FragColor.a=1.0;}}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},45514:(e,t,n)=>{n.r(t),n.d(t,{particlesPixelShaderWGSL:()=>a});var r=n(98519),i=(n(20502),n(86320),n(38197),n(17393),n(4661),n(98318),n(30032),n(56897),n(83512),"particlesPixelShader"),o="varying vUV: vec2f;varying vColor: vec4f;uniform textureMask: vec4f;var diffuseSamplerSampler: sampler;var diffuseSampler: texture_2d;\n#include\n#include\n#include\n#include\n#include\n#ifdef RAMPGRADIENT\nvarying remapRanges: vec4f;var rampSamplerSampler: sampler;var rampSampler: texture_2d;\n#endif\n#include\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include\nvar textureColor: vec4f=textureSample(diffuseSampler,diffuseSamplerSampler,input.vUV);var baseColor: vec4f=(textureColor*uniforms.textureMask+( vec4f(1.,1.,1.,1.)-uniforms.textureMask))*input.vColor;\n#ifdef RAMPGRADIENT\nvar alpha: f32=baseColor.a;var remappedColorIndex: f32=clamp((alpha-input.remapRanges.x)/input.remapRanges.y,0.0,1.0);var rampColor: vec4f=textureSample(rampSampler,rampSamplerSampler,vec2f(1.0-remappedColorIndex,0.));baseColor=vec4f(baseColor.rgb*rampColor.rgb,baseColor.a);var finalAlpha: f32=baseColor.a;baseColor.a=clamp((alpha*rampColor.a-input.remapRanges.z)/input.remapRanges.w,0.0,1.0);\n#endif\n#ifdef BLENDMULTIPLYMODE\nvar sourceAlpha: f32=input.vColor.a*textureColor.a;baseColor=vec4f(baseColor.rgb*sourceAlpha+ vec3f(1.0)*(1.0-sourceAlpha),baseColor.a);\n#endif\n#include\n#include(color,baseColor)\n#ifdef IMAGEPROCESSINGPOSTPROCESS\nbaseColor=vec4f(toLinearSpaceVec3(baseColor.rgb),baseColor.a);\n#else\n#ifdef IMAGEPROCESSING\nbaseColor=vec4f(toLinearSpaceVec3(baseColor.rgb),baseColor.a);baseColor=applyImageProcessing(baseColor);\n#endif\n#endif\nfragmentOutputs.color=baseColor;\n#define CUSTOM_FRAGMENT_MAIN_END\n}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},45566:(e,t,n)=>{n.r(t),n.d(t,{FlowGraphWhileLoopBlock:()=>l});var r=n(78322),i=n(88099),o=n(34623),a=n(88469),s=n(7164),l=function(e){function t(t){var n=e.call(this,t)||this;return n.config=t,n.condition=n.registerDataInput("condition",i.RI),n.executionFlow=n._registerSignalOutput("executionFlow"),n.completed=n._registerSignalOutput("completed"),n._unregisterSignalOutput("out"),n}return(0,r.C6)(t,e),t.prototype._execute=function(e,n){var r,i=this.condition.getValue(e);(null===(r=this.config)||void 0===r?void 0:r.doWhile)&&!i&&this.executionFlow._activateSignal(e);for(var o=0;i;){if(this.executionFlow._activateSignal(e),++o>=t.MaxLoopCount){s.V.Warn("FlowGraphWhileLoopBlock: Max loop count reached. Breaking.");break}i=this.condition.getValue(e)}this.completed._activateSignal(e)},t.prototype.getClassName=function(){return"FlowGraphWhileLoopBlock"},t.MaxLoopCount=1e3,t}(a.w);(0,o.Y5)("FlowGraphWhileLoopBlock",l)},45699:(e,t,n)=>{n.r(t),n.d(t,{bonesDeclarationWGSL:()=>a});var r=n(98519),i="bonesDeclaration",o="#if NUM_BONE_INFLUENCERS>0\nattribute matricesIndices : vec4;attribute matricesWeights : vec4;\n#if NUM_BONE_INFLUENCERS>4\nattribute matricesIndicesExtra : vec4;attribute matricesWeightsExtra : vec4;\n#endif\n#ifndef BAKED_VERTEX_ANIMATION_TEXTURE\n#ifdef BONETEXTURE\nvar boneSampler : texture_2d;uniform boneTextureWidth : f32;\n#else\nuniform mBones : array;\n#endif\n#ifdef BONES_VELOCITY_ENABLED\nuniform mPreviousBones : array;\n#endif\n#ifdef BONETEXTURE\nfn readMatrixFromRawSampler(smp : texture_2d,index : f32)->mat4x4f\n{let offset=i32(index) *4; \nlet m0=textureLoad(smp,vec2(offset+0,0),0);let m1=textureLoad(smp,vec2(offset+1,0),0);let m2=textureLoad(smp,vec2(offset+2,0),0);let m3=textureLoad(smp,vec2(offset+3,0),0);return mat4x4f(m0,m1,m2,m3);}\n#endif\n#endif\n#endif\n";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]=o);var a={name:i,shader:o}},45749:(e,t,n)=>{n.d(t,{e:()=>a});var r=n(23885),i=n(75034),o=n(38810),a=function(){function e(e){var t,n;this.config=e,this.uniqueId=(0,r.z)(),this.name=null!==(n=null===(t=this.config)||void 0===t?void 0:t.name)&&void 0!==n?n:this.getClassName(),this.dataInputs=[],this.dataOutputs=[]}return e.prototype._updateOutputs=function(e){},e.prototype.registerDataInput=function(e,t,n){var r=new i.l(e,0,this,t,n);return this.dataInputs.push(r),r},e.prototype.registerDataOutput=function(e,t,n){var r=new i.l(e,1,this,t,n);return this.dataOutputs.push(r),r},e.prototype.getDataInput=function(e){return this.dataInputs.find((function(t){return t.name===e}))},e.prototype.getDataOutput=function(e){return this.dataOutputs.find((function(t){return t.name===e}))},e.prototype.serialize=function(e,t){if(void 0===e&&(e={}),void 0===t&&(t=o.X5),e.uniqueId=this.uniqueId,e.config={},this.config)for(var n=this.config,r=0,i=Object.keys(n);r{var r=n(98519),i="vertexColorMixing";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvColor=vec4(1.0);\n#ifdef VERTEXCOLOR\n#ifdef VERTEXALPHA\nvColor*=colorUpdated;\n#else\nvColor.rgb*=colorUpdated.rgb;\n#endif\n#endif\n#ifdef INSTANCESCOLOR\nvColor*=instanceColor;\n#endif\n#endif\n")},45858:(e,t,n)=>{var r=n(98519),i="uvVariableDeclaration";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#if !defined(UV{X}) && defined(MAINUV{X})\nvec2 uv{X}=vec2(0.,0.);\n#endif\n#ifdef MAINUV{X}\nvMainUV{X}=uv{X};\n#endif\n")},45868:(e,t,n)=>{n.r(t),n.d(t,{fluidRenderingParticleDiffusePixelShader:()=>a});var r=n(98519),i="fluidRenderingParticleDiffusePixelShader",o="uniform float particleAlpha;varying vec2 uv;varying vec3 diffuseColor;void main(void) {vec3 normal;normal.xy=uv*2.0-1.0;float r2=dot(normal.xy,normal.xy);if (r2>1.0) discard;glFragColor=vec4(diffuseColor,1.0);}\n";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},46436:(e,t,n)=>{n.d(t,{G:()=>i});var r=n(78322),i=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r._preloadedInstances=new Array,r}return(0,r.C6)(t,e),Object.defineProperty(t.prototype,"preloadCount",{get:function(){var e;return null!==(e=this._options.preloadCount)&&void 0!==e?e:1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"preloadCompletedCount",{get:function(){return this._preloadedInstances.length},enumerable:!1,configurable:!0}),t.prototype.preloadInstanceAsync=function(){var e=this._createInstance();return this._addPreloadedInstance(e),e.preloadedPromise},t.prototype.preloadInstancesAsync=function(e){return(0,r.sH)(this,void 0,void 0,(function(){var t,n=this;return(0,r.YH)(this,(function(i){switch(i.label){case 0:for(t=0;t0?((o=this._preloadedInstances[0]).startOffset=this.startOffset,this._removePreloadedInstance(o)):o=this._createInstance();var a=function(){3===o.state&&(i._stopExcessInstances(),o.onStateChangedObservable.removeCallback(a))};o.onStateChangedObservable.add(a),null!==(t=e.startOffset)&&void 0!==t||(e.startOffset=this.startOffset),null!==(n=e.loop)&&void 0!==n||(e.loop=this.loop),null!==(r=e.volume)&&void 0!==r||(e.volume=1),this._beforePlay(o),o.play(e),this._afterPlay(o)}else this.resume()},t.prototype.stop=function(){if(this._setState(1),this._instances)for(var e=0,t=Array.from(this._instances);e{n.d(t,{u:()=>r});var r=function(){function e(){this._xhr="undefined"!=typeof _native&&_native.XMLHttpRequest?new _native.XMLHttpRequest:new XMLHttpRequest,this._requestURL=""}return Object.defineProperty(e,"IsCustomRequestAvailable",{get:function(){return Object.keys(e.CustomRequestHeaders).length>0||e.CustomRequestModifiers.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"requestURL",{get:function(){return this._requestURL},enumerable:!1,configurable:!0}),e.prototype._injectCustomRequestHeaders=function(){if(!this._shouldSkipRequestModifications(this._requestURL))for(var t in e.CustomRequestHeaders){var n=e.CustomRequestHeaders[t];n&&this._xhr.setRequestHeader(t,n)}},e.prototype._shouldSkipRequestModifications=function(t){return e.SkipRequestModificationForBabylonCDN&&(t.includes("preview.babylonjs.com")||t.includes("cdn.babylonjs.com"))},Object.defineProperty(e.prototype,"onprogress",{get:function(){return this._xhr.onprogress},set:function(e){this._xhr.onprogress=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"readyState",{get:function(){return this._xhr.readyState},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this._xhr.status},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"statusText",{get:function(){return this._xhr.statusText},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"response",{get:function(){return this._xhr.response},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"responseURL",{get:function(){return this._xhr.responseURL},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"responseText",{get:function(){return this._xhr.responseText},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"responseType",{get:function(){return this._xhr.responseType},set:function(e){this._xhr.responseType=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"timeout",{get:function(){return this._xhr.timeout},set:function(e){this._xhr.timeout=e},enumerable:!1,configurable:!0}),e.prototype.addEventListener=function(e,t,n){this._xhr.addEventListener(e,t,n)},e.prototype.removeEventListener=function(e,t,n){this._xhr.removeEventListener(e,t,n)},e.prototype.abort=function(){this._xhr.abort()},e.prototype.send=function(t){e.CustomRequestHeaders&&this._injectCustomRequestHeaders(),this._xhr.send(t)},e.prototype.open=function(t,n){for(var r=0,i=e.CustomRequestModifiers;r{n.r(t),n.d(t,{shadowsFragmentFunctions:()=>a});var r=n(98519),i="shadowsFragmentFunctions",o="#ifdef SHADOWS\n#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\n#define TEXTUREFUNC(s,c,l) texture2DLodEXT(s,c,l)\n#else\n#define TEXTUREFUNC(s,c,b) texture2D(s,c,b)\n#endif\n#ifndef SHADOWFLOAT\nfloat unpack(vec4 color)\n{const vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(color,bit_shift);}\n#endif\nfloat computeFallOff(float value,vec2 clipSpace,float frustumEdgeFalloff)\n{float mask=smoothstep(1.0-frustumEdgeFalloff,1.00000012,clamp(dot(clipSpace,clipSpace),0.,1.));return mix(value,1.0,mask);}\n#define inline\nfloat computeShadowCube(vec3 worldPos,vec3 lightPosition,samplerCube shadowSampler,float darkness,vec2 depthValues)\n{vec3 directionToLight=worldPos-lightPosition;float depth=length(directionToLight);depth=(depth+depthValues.x)/(depthValues.y);depth=clamp(depth,0.,1.0);directionToLight=normalize(directionToLight);directionToLight.y=-directionToLight.y;\n#ifndef SHADOWFLOAT\nfloat shadow=unpack(textureCube(shadowSampler,directionToLight));\n#else\nfloat shadow=textureCube(shadowSampler,directionToLight).x;\n#endif\nreturn depth>shadow ? darkness : 1.0;}\n#define inline\nfloat computeShadowWithPoissonSamplingCube(vec3 worldPos,vec3 lightPosition,samplerCube shadowSampler,float mapSize,float darkness,vec2 depthValues)\n{vec3 directionToLight=worldPos-lightPosition;float depth=length(directionToLight);depth=(depth+depthValues.x)/(depthValues.y);depth=clamp(depth,0.,1.0);directionToLight=normalize(directionToLight);directionToLight.y=-directionToLight.y;float visibility=1.;vec3 poissonDisk[4];poissonDisk[0]=vec3(-1.0,1.0,-1.0);poissonDisk[1]=vec3(1.0,-1.0,-1.0);poissonDisk[2]=vec3(-1.0,-1.0,-1.0);poissonDisk[3]=vec3(1.0,-1.0,1.0);\n#ifndef SHADOWFLOAT\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[0]*mapSize))shadow ? computeFallOff(darkness,clipSpace.xy,frustumEdgeFalloff) : 1.;}\n#endif\n#define inline\nfloat computeShadow(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float darkness,float frustumEdgeFalloff)\n{vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;vec2 uv=0.5*clipSpace.xy+vec2(0.5);if (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\n{return 1.0;}\nelse\n{float shadowPixelDepth=clamp(depthMetric,0.,1.0);\n#ifndef SHADOWFLOAT\nfloat shadow=unpack(TEXTUREFUNC(shadowSampler,uv,0.));\n#else\nfloat shadow=TEXTUREFUNC(shadowSampler,uv,0.).x;\n#endif\nreturn shadowPixelDepth>shadow ? computeFallOff(darkness,clipSpace.xy,frustumEdgeFalloff) : 1.;}}\n#define inline\nfloat computeShadowWithPoissonSampling(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float mapSize,float darkness,float frustumEdgeFalloff)\n{vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;vec2 uv=0.5*clipSpace.xy+vec2(0.5);if (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\n{return 1.0;}\nelse\n{float shadowPixelDepth=clamp(depthMetric,0.,1.0);float visibility=1.;vec2 poissonDisk[4];poissonDisk[0]=vec2(-0.94201624,-0.39906216);poissonDisk[1]=vec2(0.94558609,-0.76890725);poissonDisk[2]=vec2(-0.094184101,-0.92938870);poissonDisk[3]=vec2(0.34495938,0.29387760);\n#ifndef SHADOWFLOAT\nif (unpack(TEXTUREFUNC(shadowSampler,uv+poissonDisk[0]*mapSize,0.))1.0 || uv.y<0. || uv.y>1.0)\n{return 1.0;}\nelse\n{float shadowPixelDepth=clamp(depthMetric,0.,1.0);\n#ifndef SHADOWFLOAT\nfloat shadowMapSample=unpack(TEXTUREFUNC(shadowSampler,uv,0.));\n#else\nfloat shadowMapSample=TEXTUREFUNC(shadowSampler,uv,0.).x;\n#endif\nfloat esm=1.0-clamp(exp(min(87.,depthScale*shadowPixelDepth))*shadowMapSample,0.,1.-darkness);return computeFallOff(esm,clipSpace.xy,frustumEdgeFalloff);}}\n#define inline\nfloat computeShadowWithCloseESM(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float darkness,float depthScale,float frustumEdgeFalloff)\n{vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;vec2 uv=0.5*clipSpace.xy+vec2(0.5);if (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\n{return 1.0;}\nelse\n{float shadowPixelDepth=clamp(depthMetric,0.,1.0); \n#ifndef SHADOWFLOAT\nfloat shadowMapSample=unpack(TEXTUREFUNC(shadowSampler,uv,0.));\n#else\nfloat shadowMapSample=TEXTUREFUNC(shadowSampler,uv,0.).x;\n#endif\nfloat esm=clamp(exp(min(87.,-depthScale*(shadowPixelDepth-shadowMapSample))),darkness,1.);return computeFallOff(esm,clipSpace.xy,frustumEdgeFalloff);}}\n#ifdef IS_NDC_HALF_ZRANGE\n#define ZINCLIP clipSpace.z\n#else\n#define ZINCLIP uvDepth.z\n#endif\n#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\n#define SMALLEST_ABOVE_ZERO 1.1754943508e-38\n#define GREATEST_LESS_THAN_ONE 0.99999994\n#define DISABLE_UNIFORMITY_ANALYSIS\n#define inline\nfloat computeShadowWithCSMPCF1(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArrayShadow shadowSampler,float darkness,float frustumEdgeFalloff)\n{vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;vec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\n#ifdef USE_REVERSE_DEPTHBUFFER\nuvDepth.z=clamp(ZINCLIP,SMALLEST_ABOVE_ZERO,1.);\n#else\nuvDepth.z=clamp(ZINCLIP,0.,GREATEST_LESS_THAN_ONE);\n#endif\nvec4 uvDepthLayer=vec4(uvDepth.x,uvDepth.y,layer,uvDepth.z);float shadow=texture2D(shadowSampler,uvDepthLayer);shadow=mix(darkness,1.,shadow);return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);}\n#define inline\nfloat computeShadowWithCSMPCF3(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArrayShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\n{vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;vec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\n#ifdef USE_REVERSE_DEPTHBUFFER\nuvDepth.z=clamp(ZINCLIP,SMALLEST_ABOVE_ZERO,1.);\n#else\nuvDepth.z=clamp(ZINCLIP,0.,GREATEST_LESS_THAN_ONE);\n#endif\nvec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x; \nuv+=0.5; \nvec2 st=fract(uv); \nvec2 base_uv=floor(uv)-0.5; \nbase_uv*=shadowMapSizeAndInverse.y; \nvec2 uvw0=3.-2.*st;vec2 uvw1=1.+2.*st;vec2 u=vec2((2.-st.x)/uvw0.x-1.,st.x/uvw1.x+1.)*shadowMapSizeAndInverse.y;vec2 v=vec2((2.-st.y)/uvw0.y-1.,st.y/uvw1.y+1.)*shadowMapSizeAndInverse.y;float shadow=0.;shadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[0]),layer,uvDepth.z));shadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[0]),layer,uvDepth.z));shadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[1]),layer,uvDepth.z));shadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[1]),layer,uvDepth.z));shadow=shadow/16.;shadow=mix(darkness,1.,shadow);return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);}\n#define inline\nfloat computeShadowWithCSMPCF5(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArrayShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\n{vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;vec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\n#ifdef USE_REVERSE_DEPTHBUFFER\nuvDepth.z=clamp(ZINCLIP,SMALLEST_ABOVE_ZERO,1.);\n#else\nuvDepth.z=clamp(ZINCLIP,0.,GREATEST_LESS_THAN_ONE);\n#endif\nvec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x; \nuv+=0.5; \nvec2 st=fract(uv); \nvec2 base_uv=floor(uv)-0.5; \nbase_uv*=shadowMapSizeAndInverse.y; \nvec2 uvw0=4.-3.*st;vec2 uvw1=vec2(7.);vec2 uvw2=1.+3.*st;vec3 u=vec3((3.-2.*st.x)/uvw0.x-2.,(3.+st.x)/uvw1.x,st.x/uvw2.x+2.)*shadowMapSizeAndInverse.y;vec3 v=vec3((3.-2.*st.y)/uvw0.y-2.,(3.+st.y)/uvw1.y,st.y/uvw2.y+2.)*shadowMapSizeAndInverse.y;float shadow=0.;shadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[0]),layer,uvDepth.z));shadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[0]),layer,uvDepth.z));shadow+=uvw2.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[2],v[0]),layer,uvDepth.z));shadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[1]),layer,uvDepth.z));shadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[1]),layer,uvDepth.z));shadow+=uvw2.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[2],v[1]),layer,uvDepth.z));shadow+=uvw0.x*uvw2.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[2]),layer,uvDepth.z));shadow+=uvw1.x*uvw2.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[2]),layer,uvDepth.z));shadow+=uvw2.x*uvw2.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[2],v[2]),layer,uvDepth.z));shadow=shadow/144.;shadow=mix(darkness,1.,shadow);return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);}\n#define inline\nfloat computeShadowWithPCF1(vec4 vPositionFromLight,float depthMetric,highp sampler2DShadow shadowSampler,float darkness,float frustumEdgeFalloff)\n{if (depthMetric>1.0 || depthMetric<0.0) {return 1.0;}\nelse\n{vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;vec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));uvDepth.z=ZINCLIP;float shadow=TEXTUREFUNC(shadowSampler,uvDepth,0.);shadow=mix(darkness,1.,shadow);return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);}}\n#define inline\nfloat computeShadowWithPCF3(vec4 vPositionFromLight,float depthMetric,highp sampler2DShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\n{if (depthMetric>1.0 || depthMetric<0.0) {return 1.0;}\nelse\n{vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;vec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));uvDepth.z=ZINCLIP;vec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x; \nuv+=0.5; \nvec2 st=fract(uv); \nvec2 base_uv=floor(uv)-0.5; \nbase_uv*=shadowMapSizeAndInverse.y; \nvec2 uvw0=3.-2.*st;vec2 uvw1=1.+2.*st;vec2 u=vec2((2.-st.x)/uvw0.x-1.,st.x/uvw1.x+1.)*shadowMapSizeAndInverse.y;vec2 v=vec2((2.-st.y)/uvw0.y-1.,st.y/uvw1.y+1.)*shadowMapSizeAndInverse.y;float shadow=0.;shadow+=uvw0.x*uvw0.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[0]),uvDepth.z),0.);shadow+=uvw1.x*uvw0.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[0]),uvDepth.z),0.);shadow+=uvw0.x*uvw1.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[1]),uvDepth.z),0.);shadow+=uvw1.x*uvw1.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[1]),uvDepth.z),0.);shadow=shadow/16.;shadow=mix(darkness,1.,shadow);return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);}}\n#define inline\nfloat computeShadowWithPCF5(vec4 vPositionFromLight,float depthMetric,highp sampler2DShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\n{if (depthMetric>1.0 || depthMetric<0.0) {return 1.0;}\nelse\n{vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;vec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));uvDepth.z=ZINCLIP;vec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x; \nuv+=0.5; \nvec2 st=fract(uv); \nvec2 base_uv=floor(uv)-0.5; \nbase_uv*=shadowMapSizeAndInverse.y; \nvec2 uvw0=4.-3.*st;vec2 uvw1=vec2(7.);vec2 uvw2=1.+3.*st;vec3 u=vec3((3.-2.*st.x)/uvw0.x-2.,(3.+st.x)/uvw1.x,st.x/uvw2.x+2.)*shadowMapSizeAndInverse.y;vec3 v=vec3((3.-2.*st.y)/uvw0.y-2.,(3.+st.y)/uvw1.y,st.y/uvw2.y+2.)*shadowMapSizeAndInverse.y;float shadow=0.;shadow+=uvw0.x*uvw0.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[0]),uvDepth.z),0.);shadow+=uvw1.x*uvw0.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[0]),uvDepth.z),0.);shadow+=uvw2.x*uvw0.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[0]),uvDepth.z),0.);shadow+=uvw0.x*uvw1.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[1]),uvDepth.z),0.);shadow+=uvw1.x*uvw1.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[1]),uvDepth.z),0.);shadow+=uvw2.x*uvw1.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[1]),uvDepth.z),0.);shadow+=uvw0.x*uvw2.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[2]),uvDepth.z),0.);shadow+=uvw1.x*uvw2.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[2]),uvDepth.z),0.);shadow+=uvw2.x*uvw2.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[2]),uvDepth.z),0.);shadow=shadow/144.;shadow=mix(darkness,1.,shadow);return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);}}\nconst vec3 PoissonSamplers32[64]=vec3[64](\nvec3(0.06407013,0.05409927,0.),\nvec3(0.7366577,0.5789394,0.),\nvec3(-0.6270542,-0.5320278,0.),\nvec3(-0.4096107,0.8411095,0.),\nvec3(0.6849564,-0.4990818,0.),\nvec3(-0.874181,-0.04579735,0.),\nvec3(0.9989998,0.0009880066,0.),\nvec3(-0.004920578,-0.9151649,0.),\nvec3(0.1805763,0.9747483,0.),\nvec3(-0.2138451,0.2635818,0.),\nvec3(0.109845,0.3884785,0.),\nvec3(0.06876755,-0.3581074,0.),\nvec3(0.374073,-0.7661266,0.),\nvec3(0.3079132,-0.1216763,0.),\nvec3(-0.3794335,-0.8271583,0.),\nvec3(-0.203878,-0.07715034,0.),\nvec3(0.5912697,0.1469799,0.),\nvec3(-0.88069,0.3031784,0.),\nvec3(0.5040108,0.8283722,0.),\nvec3(-0.5844124,0.5494877,0.),\nvec3(0.6017799,-0.1726654,0.),\nvec3(-0.5554981,0.1559997,0.),\nvec3(-0.3016369,-0.3900928,0.),\nvec3(-0.5550632,-0.1723762,0.),\nvec3(0.925029,0.2995041,0.),\nvec3(-0.2473137,0.5538505,0.),\nvec3(0.9183037,-0.2862392,0.),\nvec3(0.2469421,0.6718712,0.),\nvec3(0.3916397,-0.4328209,0.),\nvec3(-0.03576927,-0.6220032,0.),\nvec3(-0.04661255,0.7995201,0.),\nvec3(0.4402924,0.3640312,0.),\nvec3(0.),\nvec3(0.),\nvec3(0.),\nvec3(0.),\nvec3(0.),\nvec3(0.),\nvec3(0.),\nvec3(0.),\nvec3(0.),\nvec3(0.),\nvec3(0.),\nvec3(0.),\nvec3(0.),\nvec3(0.),\nvec3(0.),\nvec3(0.),\nvec3(0.),\nvec3(0.),\nvec3(0.),\nvec3(0.),\nvec3(0.),\nvec3(0.),\nvec3(0.),\nvec3(0.),\nvec3(0.),\nvec3(0.),\nvec3(0.),\nvec3(0.),\nvec3(0.),\nvec3(0.),\nvec3(0.),\nvec3(0.)\n);const vec3 PoissonSamplers64[64]=vec3[64](\nvec3(-0.613392,0.617481,0.),\nvec3(0.170019,-0.040254,0.),\nvec3(-0.299417,0.791925,0.),\nvec3(0.645680,0.493210,0.),\nvec3(-0.651784,0.717887,0.),\nvec3(0.421003,0.027070,0.),\nvec3(-0.817194,-0.271096,0.),\nvec3(-0.705374,-0.668203,0.),\nvec3(0.977050,-0.108615,0.),\nvec3(0.063326,0.142369,0.),\nvec3(0.203528,0.214331,0.),\nvec3(-0.667531,0.326090,0.),\nvec3(-0.098422,-0.295755,0.),\nvec3(-0.885922,0.215369,0.),\nvec3(0.566637,0.605213,0.),\nvec3(0.039766,-0.396100,0.),\nvec3(0.751946,0.453352,0.),\nvec3(0.078707,-0.715323,0.),\nvec3(-0.075838,-0.529344,0.),\nvec3(0.724479,-0.580798,0.),\nvec3(0.222999,-0.215125,0.),\nvec3(-0.467574,-0.405438,0.),\nvec3(-0.248268,-0.814753,0.),\nvec3(0.354411,-0.887570,0.),\nvec3(0.175817,0.382366,0.),\nvec3(0.487472,-0.063082,0.),\nvec3(-0.084078,0.898312,0.),\nvec3(0.488876,-0.783441,0.),\nvec3(0.470016,0.217933,0.),\nvec3(-0.696890,-0.549791,0.),\nvec3(-0.149693,0.605762,0.),\nvec3(0.034211,0.979980,0.),\nvec3(0.503098,-0.308878,0.),\nvec3(-0.016205,-0.872921,0.),\nvec3(0.385784,-0.393902,0.),\nvec3(-0.146886,-0.859249,0.),\nvec3(0.643361,0.164098,0.),\nvec3(0.634388,-0.049471,0.),\nvec3(-0.688894,0.007843,0.),\nvec3(0.464034,-0.188818,0.),\nvec3(-0.440840,0.137486,0.),\nvec3(0.364483,0.511704,0.),\nvec3(0.034028,0.325968,0.),\nvec3(0.099094,-0.308023,0.),\nvec3(0.693960,-0.366253,0.),\nvec3(0.678884,-0.204688,0.),\nvec3(0.001801,0.780328,0.),\nvec3(0.145177,-0.898984,0.),\nvec3(0.062655,-0.611866,0.),\nvec3(0.315226,-0.604297,0.),\nvec3(-0.780145,0.486251,0.),\nvec3(-0.371868,0.882138,0.),\nvec3(0.200476,0.494430,0.),\nvec3(-0.494552,-0.711051,0.),\nvec3(0.612476,0.705252,0.),\nvec3(-0.578845,-0.768792,0.),\nvec3(-0.772454,-0.090976,0.),\nvec3(0.504440,0.372295,0.),\nvec3(0.155736,0.065157,0.),\nvec3(0.391522,0.849605,0.),\nvec3(-0.620106,-0.328104,0.),\nvec3(0.789239,-0.419965,0.),\nvec3(-0.545396,0.538133,0.),\nvec3(-0.178564,-0.596057,0.)\n);\n#define inline\nfloat computeShadowWithCSMPCSS(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArray depthSampler,highp sampler2DArrayShadow shadowSampler,float shadowMapSizeInverse,float lightSizeUV,float darkness,float frustumEdgeFalloff,int searchTapCount,int pcfTapCount,vec3[64] poissonSamplers,vec2 lightSizeUVCorrection,float depthCorrection,float penumbraDarkness)\n{vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;vec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\n#ifdef USE_REVERSE_DEPTHBUFFER\nuvDepth.z=clamp(ZINCLIP,SMALLEST_ABOVE_ZERO,1.);\n#else\nuvDepth.z=clamp(ZINCLIP,0.,GREATEST_LESS_THAN_ONE);\n#endif\nvec4 uvDepthLayer=vec4(uvDepth.x,uvDepth.y,layer,uvDepth.z);float blockerDepth=0.0;float sumBlockerDepth=0.0;float numBlocker=0.0;for (int i=0; i1.0 || depthMetric<0.0) {return 1.0;}\nelse\n{vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;vec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));uvDepth.z=ZINCLIP;float blockerDepth=0.0;float sumBlockerDepth=0.0;float numBlocker=0.0;for (int i=0; i{n.r(t),n.d(t,{FlowGraphCallCounterBlock:()=>s});var r=n(78322),i=n(88099),o=n(88469),a=n(34623),s=function(e){function t(t){var n=e.call(this,t)||this;return n.count=n.registerDataOutput("count",i.Es),n.reset=n._registerSignalInput("reset"),n}return(0,r.C6)(t,e),t.prototype._execute=function(e,t){if(t===this.reset)return e._setExecutionVariable(this,"count",0),void this.count.setValue(0,e);var n=e._getExecutionVariable(this,"count",0)+1;e._setExecutionVariable(this,"count",n),this.count.setValue(n,e),this.out._activateSignal(e)},t.prototype.getClassName=function(){return"FlowGraphCallCounterBlock"},t}(o.w);(0,a.Y5)("FlowGraphCallCounterBlock",s)},47257:(e,t,n)=>{n.r(t),n.d(t,{rsmGlobalIlluminationPixelShaderWGSL:()=>a});var r=n(98519),i="rsmGlobalIlluminationPixelShader",o="/**\n* The implementation is an application of the formula found in http:\n* For better results,it also adds a random (noise) rotation to the RSM samples (the noise artifacts are easier to remove than the banding artifacts).\n*/\nvarying vUV: vec2f;uniform rsmLightMatrix: mat4x4f;uniform rsmInfo: vec4f;uniform rsmInfo2: vec4f;var textureSamplerSampler: sampler;var textureSampler: texture_2d;var normalSamplerSampler: sampler;var normalSampler: texture_2d;var rsmPositionWSampler: sampler;var rsmPositionW: texture_2d;var rsmNormalWSampler: sampler;var rsmNormalW: texture_2d;var rsmFluxSampler: sampler;var rsmFlux: texture_2d;var rsmSamples: texture_2d;\n#ifdef TRANSFORM_NORMAL\nuniform invView: mat4x4f;\n#endif\nfn mod289(x: f32)->f32{return x-floor(x*(1.0/289.0))*289.0;}\nfn mod289Vec4(x: vec4f)->vec4f {return x-floor(x*(1.0/289.0))* 289.0;}\nfn perm(x: vec4f)->vec4f {return mod289Vec4(((x*34.0)+1.0)*x) ;}\nfn noise(p: vec3f)->f32{var a: vec3f=floor(p);var d: vec3f=p-a;d=d*d*(3.0-2.0*d);var b: vec4f=a.xxyy+ vec4f(0.0,1.0,0.0,1.0);var k1: vec4f=perm(b.xyxy);var k2: vec4f=perm(k1.xyxy+b.zzww);var c: vec4f=k2+a.zzzz;var k3: vec4f=perm(c);var k4: vec4f=perm(c+1.0);var o1: vec4f=fract(k3*(1.0/41.0));var o2: vec4f=fract(k4*(1.0/41.0));var o3: vec4f=o2*d.z+o1*(1.0-d.z);var o4: vec2f=o3.yw*d.x+o3.xz*(1.0-d.x);return o4.y*d.y+o4.x*(1.0-d.y);}\nfn computeIndirect(p: vec3f,n: vec3f)->vec3f {var indirectDiffuse: vec3f= vec3f(0.);var numSamples: i32= i32(uniforms.rsmInfo.x);var radius: f32=uniforms.rsmInfo.y;var intensity: f32=uniforms.rsmInfo.z;var edgeArtifactCorrection: f32=uniforms.rsmInfo.w;var texRSM: vec4f=uniforms.rsmLightMatrix* vec4f(p,1.);texRSM=vec4f(texRSM.xy/texRSM.w,texRSM.z,texRSM.w);texRSM=vec4f(texRSM.xy*0.5+0.5,texRSM.z,texRSM.w);var angle: f32=noise(p*uniforms.rsmInfo2.x);var c: f32=cos(angle);var s: f32=sin(angle);for (var i: i32=0; i(i,0),0).xyz;var weightSquare: f32=rsmSample.z;if (uniforms.rsmInfo2.y==1.0){rsmSample=vec3f(rsmSample.x*c+rsmSample.y*s,-rsmSample.x*s+rsmSample.y*c,rsmSample.z);}\nvar uv: vec2f=texRSM.xy+rsmSample.xy*radius;if (uv.x<0. || uv.x>1. || uv.y<0. || uv.y>1.) {continue;}\nvar vplPositionW: vec3f=textureSampleLevel(rsmPositionW,rsmPositionWSampler,uv,0.).xyz;var vplNormalW: vec3f=textureSampleLevel(rsmNormalW,rsmNormalWSampler,uv,0.).xyz*2.0-1.0;var vplFlux: vec3f=textureSampleLevel(rsmFlux,rsmFluxSampler,uv,0.).rgb;vplPositionW-=vplNormalW*edgeArtifactCorrection; \nvar dist2: f32=dot(vplPositionW-p,vplPositionW-p);indirectDiffuse+=vplFlux*weightSquare*max(0.,dot(n,vplPositionW-p))*max(0.,dot(vplNormalW,p-vplPositionW))/(dist2*dist2);}\nreturn clamp(indirectDiffuse*intensity,vec3f(0.0),vec3f(1.0));}\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var positionW: vec3f=textureSample(textureSampler,textureSamplerSampler,input.vUV).xyz;var normalW: vec3f=textureSample(normalSampler,normalSamplerSampler,input.vUV).xyz;\n#ifdef DECODE_NORMAL\nnormalW=normalW*2.0-1.0;\n#endif\n#ifdef TRANSFORM_NORMAL\nnormalW=(uniforms.invView* vec4f(normalW,0.)).xyz;\n#endif\nfragmentOutputs.color=vec4f(computeIndirect(positionW,normalW),1.0);}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},47347:(e,t,n)=>{n.d(t,{$:()=>h,Z:()=>d});var r=n(78322),i=n(81152),o=n(80244),a=n(44957),s=n(54665);function l(e,t){var n=(null==t?void 0:t.jsDecoderModule)||KTX2DECODER;e&&(e.wasmBaseUrl&&(n.Transcoder.WasmBaseUrl=e.wasmBaseUrl),e.wasmUASTCToASTC&&(n.LiteTranscoder_UASTC_ASTC.WasmModuleURL=e.wasmUASTCToASTC),e.wasmUASTCToBC7&&(n.LiteTranscoder_UASTC_BC7.WasmModuleURL=e.wasmUASTCToBC7),e.wasmUASTCToRGBA_UNORM&&(n.LiteTranscoder_UASTC_RGBA_UNORM.WasmModuleURL=e.wasmUASTCToRGBA_UNORM),e.wasmUASTCToRGBA_SRGB&&(n.LiteTranscoder_UASTC_RGBA_SRGB.WasmModuleURL=e.wasmUASTCToRGBA_SRGB),e.wasmUASTCToR8_UNORM&&(n.LiteTranscoder_UASTC_R8_UNORM.WasmModuleURL=e.wasmUASTCToR8_UNORM),e.wasmUASTCToRG8_UNORM&&(n.LiteTranscoder_UASTC_RG8_UNORM.WasmModuleURL=e.wasmUASTCToRG8_UNORM),e.jsMSCTranscoder&&(n.MSCTranscoder.JSModuleURL=e.jsMSCTranscoder),e.wasmMSCTranscoder&&(n.MSCTranscoder.WasmModuleURL=e.wasmMSCTranscoder),e.wasmZSTDDecoder&&(n.ZSTDDecoder.WasmModuleURL=e.wasmZSTDDecoder)),t&&(t.wasmUASTCToASTC&&(n.LiteTranscoder_UASTC_ASTC.WasmBinary=t.wasmUASTCToASTC),t.wasmUASTCToBC7&&(n.LiteTranscoder_UASTC_BC7.WasmBinary=t.wasmUASTCToBC7),t.wasmUASTCToRGBA_UNORM&&(n.LiteTranscoder_UASTC_RGBA_UNORM.WasmBinary=t.wasmUASTCToRGBA_UNORM),t.wasmUASTCToRGBA_SRGB&&(n.LiteTranscoder_UASTC_RGBA_SRGB.WasmBinary=t.wasmUASTCToRGBA_SRGB),t.wasmUASTCToR8_UNORM&&(n.LiteTranscoder_UASTC_R8_UNORM.WasmBinary=t.wasmUASTCToR8_UNORM),t.wasmUASTCToRG8_UNORM&&(n.LiteTranscoder_UASTC_RG8_UNORM.WasmBinary=t.wasmUASTCToRG8_UNORM),t.jsMSCTranscoder&&(n.MSCTranscoder.JSModule=t.jsMSCTranscoder),t.wasmMSCTranscoder&&(n.MSCTranscoder.WasmBinary=t.wasmMSCTranscoder),t.wasmZSTDDecoder&&(n.ZSTDDecoder.WasmBinary=t.wasmZSTDDecoder))}function c(e){var t;void 0===e&&"undefined"!=typeof KTX2DECODER&&(e=KTX2DECODER),onmessage=function(n){if(n.data)switch(n.data.action){case"init":var i=n.data.urls;i&&(i.jsDecoderModule&&void 0===e&&(importScripts(i.jsDecoderModule),e=KTX2DECODER),l(i)),n.data.wasmBinaries&&l(void 0,(0,r.Cl)((0,r.Cl)({},n.data.wasmBinaries),{jsDecoderModule:e})),t=new e.KTX2Decoder,postMessage({action:"init"});break;case"setDefaultDecoderOptions":e.KTX2Decoder.DefaultDecoderOptions=n.data.options;break;case"decode":t.decode(n.data.data,n.data.caps,n.data.options).then((function(e){for(var t=[],n=0;n1,t.width=e.mipmaps[0].width,t.height=e.mipmaps[0].height,e.errors)throw new Error("KTX2 container - could not transcode the data. "+e.errors);for(var o=0;o=12){var t=new Uint8Array(e.buffer,e.byteOffset,12);if(171===t[0]&&75===t[1]&&84===t[2]&&88===t[3]&&32===t[4]&&50===t[5]&&48===t[6]&&187===t[7]&&13===t[8]&&10===t[9]&&26===t[10]&&10===t[11])return!0}return!1},e.URLConfig={jsDecoderModule:"https://cdn.babylonjs.com/babylon.ktx2Decoder.js",wasmUASTCToASTC:null,wasmUASTCToBC7:null,wasmUASTCToRGBA_UNORM:null,wasmUASTCToRGBA_SRGB:null,wasmUASTCToR8_UNORM:null,wasmUASTCToRG8_UNORM:null,jsMSCTranscoder:null,wasmMSCTranscoder:null,wasmZSTDDecoder:null},e.DefaultNumWorkers=e.GetDefaultNumWorkers(),e.DefaultDecoderOptions=new h,e}()},47424:(e,t,n)=>{n.d(t,{Y4:()=>c,b8:()=>l,cD:()=>s});var r=n(78322),i=n(8046),o=n(6174),a=function(){function e(){}return e.extractMinAndMaxIndexed=function(e,t,n,r,i,o){for(var a=n;a=0&&(t[p]=_,t[p+2]=f)}}},47469:(e,t,n)=>{n.r(t),n.d(t,{grainPixelShader:()=>a});var r=n(98519),i=(n(75334),"grainPixelShader"),o="#include\nuniform sampler2D textureSampler; \nuniform float intensity;uniform float animatedSeed;varying vec2 vUV;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{gl_FragColor=texture2D(textureSampler,vUV);vec2 seed=vUV*(animatedSeed);float grain=dither(seed,intensity);float lum=getLuminance(gl_FragColor.rgb);float grainAmount=(cos(-PI+(lum*PI*2.))+1.)/2.;gl_FragColor.rgb+=grain*grainAmount;gl_FragColor.rgb=max(gl_FragColor.rgb,0.0);}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},47582:(e,t,n)=>{n.d(t,{n:()=>r});var r=function(){function e(){this.shaderLanguage=0}return e.prototype.postProcessor=function(e,t,n,r,i){return i.drawBuffersExtensionDisabled&&(e=e.replace(/#extension.+GL_EXT_draw_buffers.+(enable|require)/g,"")),e},e}()},47590:(e,t,n)=>{n.r(t),n.d(t,{colorPixelShaderWGSL:()=>a});var r=n(98519),i=(n(20502),n(98318),n(30032),n(83512),"colorPixelShader"),o="#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\n#define VERTEXCOLOR\nvarying vColor: vec4f;\n#else\nuniform color: vec4f;\n#endif\n#include\n#include\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nfragmentOutputs.color=input.vColor;\n#else\nfragmentOutputs.color=uniforms.color;\n#endif\n#include(color,fragmentOutputs.color)\n#define CUSTOM_FRAGMENT_MAIN_END\n}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},47615:(e,t,n)=>{n.r(t),n.d(t,{glowMapGenerationVertexShader:()=>a});var r=n(98519),i=(n(36470),n(64400),n(24444),n(67369),n(85637),n(38615),n(58266),n(84589),n(35397),n(76898),n(49334),n(83057),"glowMapGenerationVertexShader"),o="attribute vec3 position;\n#include\n#include\n#include\n#include[0..maxSimultaneousMorphTargets]\n#include\n#include\nuniform mat4 viewProjection;varying vec4 vPosition;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef DIFFUSE\nvarying vec2 vUVDiffuse;uniform mat4 diffuseMatrix;\n#endif\n#ifdef OPACITY\nvarying vec2 vUVOpacity;uniform mat4 opacityMatrix;\n#endif\n#ifdef EMISSIVE\nvarying vec2 vUVEmissive;uniform mat4 emissiveMatrix;\n#endif\n#ifdef VERTEXALPHA\nattribute vec4 color;varying vec4 vColor;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void)\n{vec3 positionUpdated=position;\n#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#ifdef UV2\nvec2 uv2Updated=uv2;\n#endif\n#include\n#include[0..maxSimultaneousMorphTargets]\n#include\n#include\n#include\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\n#ifdef CUBEMAP\nvPosition=worldPos;gl_Position=viewProjection*finalWorld*vec4(position,1.0);\n#else\nvPosition=viewProjection*worldPos;gl_Position=vPosition;\n#endif\n#ifdef DIFFUSE\n#ifdef DIFFUSEUV1\nvUVDiffuse=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef DIFFUSEUV2\nvUVDiffuse=vec2(diffuseMatrix*vec4(uv2Updated,1.0,0.0));\n#endif\n#endif\n#ifdef OPACITY\n#ifdef OPACITYUV1\nvUVOpacity=vec2(opacityMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef OPACITYUV2\nvUVOpacity=vec2(opacityMatrix*vec4(uv2Updated,1.0,0.0));\n#endif\n#endif\n#ifdef EMISSIVE\n#ifdef EMISSIVEUV1\nvUVEmissive=vec2(emissiveMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef EMISSIVEUV2\nvUVEmissive=vec2(emissiveMatrix*vec4(uv2Updated,1.0,0.0));\n#endif\n#endif\n#ifdef VERTEXALPHA\nvColor=color;\n#endif\n#include\n}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},47636:(e,t,n)=>{n.r(t),n.d(t,{FlowGraphForLoopBlock:()=>c});var r=n(78322),i=n(88469),o=n(88099),a=n(34623),s=n(95803),l=n(40099),c=function(e){function t(t){var n,r=e.call(this,t)||this;return r.startIndex=r.registerDataInput("startIndex",o.Vv,0),r.endIndex=r.registerDataInput("endIndex",o.Vv),r.step=r.registerDataInput("step",o.Es,1),r.index=r.registerDataOutput("index",o.x2,new l.P((0,s.$w)(null!==(n=null==t?void 0:t.initialIndex)&&void 0!==n?n:0))),r.executionFlow=r._registerSignalOutput("executionFlow"),r.completed=r._registerSignalOutput("completed"),r._unregisterSignalOutput("out"),r}return(0,r.C6)(t,e),t.prototype._execute=function(e){for(var n,r=(0,s.$w)(this.startIndex.getValue(e)),i=this.step.getValue(e),o=(0,s.$w)(this.endIndex.getValue(e)),a=r;at.MaxLoopIterations*i));a+=i);(null===(n=this.config)||void 0===n?void 0:n.incrementIndexWhenLoopDone)&&this.index.setValue(new l.P((0,s.$w)(this.index.getValue(e))+i),e),this.completed._activateSignal(e)},t.prototype.getClassName=function(){return"FlowGraphForLoopBlock"},t.MaxLoopIterations=1e3,t}(i.w);(0,a.Y5)("FlowGraphForLoopBlock",c)},47779:(e,t,n)=>{n.r(t),n.d(t,{hdrIrradianceFilteringPixelShader:()=>a});var r=n(98519),i=(n(75334),n(19568),n(64244),n(10114),"hdrIrradianceFilteringPixelShader"),o="#include\n#include\n#include\n#include\nuniform samplerCube inputTexture;\n#ifdef IBL_CDF_FILTERING\nuniform sampler2D icdfTexture;\n#endif\nuniform vec2 vFilteringInfo;uniform float hdrScale;varying vec3 direction;void main() {vec3 color=irradiance(inputTexture,direction,vFilteringInfo,0.0,vec3(1.0),direction\n#ifdef IBL_CDF_FILTERING\n,icdfTexture\n#endif\n);gl_FragColor=vec4(color*hdrScale,1.0);}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},48063:(e,t,n)=>{n.r(t),n.d(t,{fluidRenderingBilateralBlurPixelShader:()=>a});var r=n(98519),i="fluidRenderingBilateralBlurPixelShader",o="uniform sampler2D textureSampler;uniform int maxFilterSize;uniform vec2 blurDir;uniform float projectedParticleConstant;uniform float depthThreshold;varying vec2 vUV;void main(void) {float depth=textureLod(textureSampler,vUV,0.).x;if (depth>=1e6 || depth<=0.) {glFragColor=vec4(vec3(depth),1.);return;}\nint filterSize=min(maxFilterSize,int(ceil(projectedParticleConstant/depth)));float sigma=float(filterSize)/3.0;float two_sigma2=2.0*sigma*sigma;float sigmaDepth=depthThreshold/3.0;float two_sigmaDepth2=2.0*sigmaDepth*sigmaDepth;float sum=0.;float wsum=0.;float sumVel=0.;for (int x=-filterSize; x<=filterSize; ++x) {vec2 coords=vec2(x);vec2 sampleDepthVel=textureLod(textureSampler,vUV+coords*blurDir,0.).rg;float r=dot(coords,coords);float w=exp(-r/two_sigma2);float rDepth=sampleDepthVel.r-depth;float wd=exp(-rDepth*rDepth/two_sigmaDepth2);sum+=sampleDepthVel.r*w*wd;sumVel+=sampleDepthVel.g*w*wd;wsum+=w*wd;}\nglFragColor=vec4(sum/wsum,sumVel/wsum,0.,1.);}\n";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},48424:(e,t,n)=>{n.d(t,{N:()=>r});var r=function(){function e(e){void 0===e&&(e=!0),this._isDepthTestDirty=!1,this._isDepthMaskDirty=!1,this._isDepthFuncDirty=!1,this._isCullFaceDirty=!1,this._isCullDirty=!1,this._isZOffsetDirty=!1,this._isFrontFaceDirty=!1,e&&this.reset()}return Object.defineProperty(e.prototype,"isDirty",{get:function(){return this._isDepthFuncDirty||this._isDepthTestDirty||this._isDepthMaskDirty||this._isCullFaceDirty||this._isCullDirty||this._isZOffsetDirty||this._isFrontFaceDirty},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"zOffset",{get:function(){return this._zOffset},set:function(e){this._zOffset!==e&&(this._zOffset=e,this._isZOffsetDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"zOffsetUnits",{get:function(){return this._zOffsetUnits},set:function(e){this._zOffsetUnits!==e&&(this._zOffsetUnits=e,this._isZOffsetDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cullFace",{get:function(){return this._cullFace},set:function(e){this._cullFace!==e&&(this._cullFace=e,this._isCullFaceDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cull",{get:function(){return this._cull},set:function(e){this._cull!==e&&(this._cull=e,this._isCullDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"depthFunc",{get:function(){return this._depthFunc},set:function(e){this._depthFunc!==e&&(this._depthFunc=e,this._isDepthFuncDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"depthMask",{get:function(){return this._depthMask},set:function(e){this._depthMask!==e&&(this._depthMask=e,this._isDepthMaskDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"depthTest",{get:function(){return this._depthTest},set:function(e){this._depthTest!==e&&(this._depthTest=e,this._isDepthTestDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"frontFace",{get:function(){return this._frontFace},set:function(e){this._frontFace!==e&&(this._frontFace=e,this._isFrontFaceDirty=!0)},enumerable:!1,configurable:!0}),e.prototype.reset=function(){this._depthMask=!0,this._depthTest=!0,this._depthFunc=null,this._cullFace=null,this._cull=null,this._zOffset=0,this._zOffsetUnits=0,this._frontFace=null,this._isDepthTestDirty=!0,this._isDepthMaskDirty=!0,this._isDepthFuncDirty=!1,this._isCullFaceDirty=!1,this._isCullDirty=!1,this._isZOffsetDirty=!0,this._isFrontFaceDirty=!1},e.prototype.apply=function(e){this.isDirty&&(this._isCullDirty&&(this.cull?e.enable(e.CULL_FACE):e.disable(e.CULL_FACE),this._isCullDirty=!1),this._isCullFaceDirty&&(e.cullFace(this.cullFace),this._isCullFaceDirty=!1),this._isDepthMaskDirty&&(e.depthMask(this.depthMask),this._isDepthMaskDirty=!1),this._isDepthTestDirty&&(this.depthTest?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),this._isDepthTestDirty=!1),this._isDepthFuncDirty&&(e.depthFunc(this.depthFunc),this._isDepthFuncDirty=!1),this._isZOffsetDirty&&(this.zOffset||this.zOffsetUnits?(e.enable(e.POLYGON_OFFSET_FILL),e.polygonOffset(this.zOffset,this.zOffsetUnits)):e.disable(e.POLYGON_OFFSET_FILL),this._isZOffsetDirty=!1),this._isFrontFaceDirty&&(e.frontFace(this.frontFace),this._isFrontFaceDirty=!1))},e}()},48493:(e,t,n)=>{var r=n(98519),i="mainUVVaryingDeclaration";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#ifdef MAINUV{X}\nvarying vec2 vMainUV{X};\n#endif\n")},48533:(e,t,n)=>{n.r(t),n.d(t,{iblVoxelGrid3dDebugPixelShader:()=>a});var r=n(98519),i="iblVoxelGrid3dDebugPixelShader",o="precision highp sampler3D;varying vec2 vUV;uniform sampler3D voxelTexture;uniform sampler2D voxelSlabTexture;uniform sampler2D textureSampler;uniform vec4 sizeParams;\n#define offsetX sizeParams.x\n#define offsetY sizeParams.y\n#define widthScale sizeParams.z\n#define heightScale sizeParams.w\nuniform float mipNumber;void main(void) {vec2 uv =\nvec2((offsetX+vUV.x)*widthScale,(offsetY+vUV.y)*heightScale);vec4 background=texture2D(textureSampler,vUV);vec4 voxelSlab=texture2D(voxelSlabTexture,vUV);ivec3 size=textureSize(voxelTexture,int(mipNumber));float dimension=ceil(sqrt(float(size.z)));vec2 samplePos=fract(uv.xy*vec2(dimension));int sampleIndex=int(floor(uv.x*float(dimension)) +\nfloor(uv.y*float(dimension))*dimension);float mip_separator=0.0;if (samplePos.x<0.01 || samplePos.y<0.01) {mip_separator=1.0;}\nbool outBounds=sampleIndex>size.z-1 ? true : false;sampleIndex=clamp(sampleIndex,0,size.z-1);ivec2 samplePosInt=ivec2(samplePos.xy*vec2(size.xy));vec3 voxel=texelFetch(voxelTexture,\nivec3(samplePosInt.x,samplePosInt.y,sampleIndex),\nint(mipNumber))\n.rgb;if (uv.x<0.0 || uv.x>1.0 || uv.y<0.0 || uv.y>1.0) {gl_FragColor.rgba=background;} else {if (outBounds) {voxel=vec3(0.15,0.0,0.0);} else {if (voxel.r>0.001) {voxel.g=1.0;}\nvoxel.r+=mip_separator;}\nglFragColor.rgb=mix(background.rgb,voxelSlab.rgb,voxelSlab.a)+voxel;glFragColor.a=1.0;}}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},48661:(e,t,n)=>{n.r(t),n.d(t,{bumpFragmentMainFunctions:()=>a});var r=n(98519),i="bumpFragmentMainFunctions",o="#if defined(BUMP) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC) || defined(DETAIL)\n#if defined(TANGENT) && defined(NORMAL) \nvarying mat3 vTBN;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\nuniform mat4 normalMatrix;\n#if defined(WEBGL2) || defined(WEBGPU)\nmat4 toNormalMatrix(mat4 wMatrix)\n{mat4 ret=inverse(wMatrix);ret=transpose(ret);ret[0][3]=0.;ret[1][3]=0.;ret[2][3]=0.;ret[3]=vec4(0.,0.,0.,1.);return ret;}\n#else\nmat4 toNormalMatrix(mat4 m)\n{float\na00=m[0][0],a01=m[0][1],a02=m[0][2],a03=m[0][3],\na10=m[1][0],a11=m[1][1],a12=m[1][2],a13=m[1][3],\na20=m[2][0],a21=m[2][1],a22=m[2][2],a23=m[2][3],\na30=m[3][0],a31=m[3][1],a32=m[3][2],a33=m[3][3],\nb00=a00*a11-a01*a10,\nb01=a00*a12-a02*a10,\nb02=a00*a13-a03*a10,\nb03=a01*a12-a02*a11,\nb04=a01*a13-a03*a11,\nb05=a02*a13-a03*a12,\nb06=a20*a31-a21*a30,\nb07=a20*a32-a22*a30,\nb08=a20*a33-a23*a30,\nb09=a21*a32-a22*a31,\nb10=a21*a33-a23*a31,\nb11=a22*a33-a23*a32,\ndet=b00*b11-b01*b10+b02*b09+b03*b08-b04*b07+b05*b06;mat4 mi=mat4(\na11*b11-a12*b10+a13*b09,\na02*b10-a01*b11-a03*b09,\na31*b05-a32*b04+a33*b03,\na22*b04-a21*b05-a23*b03,\na12*b08-a10*b11-a13*b07,\na00*b11-a02*b08+a03*b07,\na32*b02-a30*b05-a33*b01,\na20*b05-a22*b02+a23*b01,\na10*b10-a11*b08+a13*b06,\na01*b08-a00*b10-a03*b06,\na30*b04-a31*b02+a33*b00,\na21*b02-a20*b04-a23*b00,\na11*b07-a10*b09-a12*b06,\na00*b09-a01*b07+a02*b06,\na31*b01-a30*b03-a32*b00,\na20*b03-a21*b01+a22*b00)/det;return mat4(mi[0][0],mi[1][0],mi[2][0],mi[3][0],\nmi[0][1],mi[1][1],mi[2][1],mi[3][1],\nmi[0][2],mi[1][2],mi[2][2],mi[3][2],\nmi[0][3],mi[1][3],mi[2][3],mi[3][3]);}\n#endif\n#endif\nvec3 perturbNormalBase(mat3 cotangentFrame,vec3 normal,float scale)\n{\n#ifdef NORMALXYSCALE\nnormal=normalize(normal*vec3(scale,scale,1.0));\n#endif\nreturn normalize(cotangentFrame*normal);}\nvec3 perturbNormal(mat3 cotangentFrame,vec3 textureSample,float scale)\n{return perturbNormalBase(cotangentFrame,textureSample*2.0-1.0,scale);}\nmat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv,vec2 tangentSpaceParams)\n{vec3 dp1=dFdx(p);vec3 dp2=dFdy(p);vec2 duv1=dFdx(uv);vec2 duv2=dFdy(uv);vec3 dp2perp=cross(dp2,normal);vec3 dp1perp=cross(normal,dp1);vec3 tangent=dp2perp*duv1.x+dp1perp*duv2.x;vec3 bitangent=dp2perp*duv1.y+dp1perp*duv2.y;tangent*=tangentSpaceParams.x;bitangent*=tangentSpaceParams.y;float det=max(dot(tangent,tangent),dot(bitangent,bitangent));float invmax=det==0.0 ? 0.0 : inversesqrt(det);return mat3(tangent*invmax,bitangent*invmax,normal);}\n#endif\n";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]=o);var a={name:i,shader:o}},48810:(e,t,n)=>{function r(e){return parseInt(e.toString().replace(/\W/g,""))}function i(e,t,n){return void 0===n&&(n=1401298e-51),Math.abs(e-t)<=n}function o(e,t,n,r){return void 0===r&&(r=1401298e-51),en+r}function a(e,t){return e===t?e:Math.random()*(t-e)+e}function s(e,t,n){return e+(t-e)*n}function l(e,t,n){var r=_(t-e,360);return r>180&&(r-=360),e+r*d(n)}function c(e,t,n){return e!=t?d((n-e)/(t-e)):0}function u(e,t,n,r,i){var o=i*i,a=i*o;return e*(2*a-3*o+1)+n*(-2*a+3*o)+t*(a-2*o+i)+r*(a-o)}function h(e,t,n,r,i){var o=i*i;return 6*(o-i)*e+(3*o-4*i+1)*t+6*(-o+i)*n+(3*o-2*i)*r}function d(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),Math.min(n,Math.max(t,e))}function p(e){return e-2*Math.PI*Math.floor((e+Math.PI)/(2*Math.PI))}function f(e){var t=e.toString(16);return e<=15?("0"+t).toUpperCase():t.toUpperCase()}function m(e){if(Math.log2)return Math.floor(Math.log2(e));if(e<0)return NaN;if(0===e)return-1/0;var t=0;if(e<1){for(;e<1;)t++,e*=2;t=-t}else if(e>1)for(;e>1;)t++,e=Math.floor(e/2);return t}function _(e,t){return e-Math.floor(e/t)*t}function g(e,t,n){return(e-t)/(n-t)}function v(e,t,n){return e*(n-t)+t}function y(e,t){var n=_(t-e,360);return n>180&&(n-=360),n}function b(e,t){var n=_(e,2*t);return t-Math.abs(n-t)}function S(e,t,n){var r=d(n);return t*(r=-2*r*r*r+3*r*r)+e*(1-r)}function T(e,t,n){return Math.abs(t-e)<=n?t:e+Math.sign(t-e)*n}function E(e,t,n){var r=y(e,t);return-nd,DeltaAngle:()=>y,Denormalize:()=>v,ExtractAsInt:()=>r,Hermite:()=>u,Hermite1stDerivative:()=>h,HighestCommonFactor:()=>C,ILog2:()=>m,InverseLerp:()=>c,Lerp:()=>s,LerpAngle:()=>l,MoveTowards:()=>T,MoveTowardsAngle:()=>E,Normalize:()=>g,NormalizeRadians:()=>p,OutsideRange:()=>o,PercentToRange:()=>P,PingPong:()=>b,RandomRange:()=>a,RangeToPercent:()=>x,Repeat:()=>_,SmoothStep:()=>S,ToHex:()=>f,WithinEpsilon:()=>i})},48915:(e,t,n)=>{var r=n(98519),i=(n(50851),n(56174),"pbrUboDeclaration");r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="layout(std140,column_major) uniform;uniform Material {vec2 vAlbedoInfos;vec2 vBaseWeightInfos;vec2 vBaseDiffuseRoughnessInfos;vec4 vAmbientInfos;vec2 vOpacityInfos;vec2 vEmissiveInfos;vec2 vLightmapInfos;vec3 vReflectivityInfos;vec2 vMicroSurfaceSamplerInfos;vec3 vBumpInfos;mat4 albedoMatrix;mat4 baseWeightMatrix;mat4 baseDiffuseRoughnessMatrix;mat4 ambientMatrix;mat4 opacityMatrix;mat4 emissiveMatrix;mat4 lightmapMatrix;mat4 reflectivityMatrix;mat4 microSurfaceSamplerMatrix;mat4 bumpMatrix;vec2 vTangentSpaceParams;vec4 vAlbedoColor;float baseWeight;float baseDiffuseRoughness;vec4 vLightingIntensity;float pointSize;vec4 vReflectivityColor;vec3 vEmissiveColor;vec3 vAmbientColor;vec2 vDebugMode;vec4 vMetallicReflectanceFactors;vec2 vMetallicReflectanceInfos;mat4 metallicReflectanceMatrix;vec2 vReflectanceInfos;mat4 reflectanceMatrix;vec4 cameraInfo;vec2 vReflectionInfos;mat4 reflectionMatrix;vec3 vReflectionMicrosurfaceInfos;vec3 vReflectionPosition;vec3 vReflectionSize;vec2 vReflectionFilteringInfo;vec3 vReflectionDominantDirection;vec3 vReflectionColor;vec3 vSphericalL00;vec3 vSphericalL1_1;vec3 vSphericalL10;vec3 vSphericalL11;vec3 vSphericalL2_2;vec3 vSphericalL2_1;vec3 vSphericalL20;vec3 vSphericalL21;vec3 vSphericalL22;vec3 vSphericalX;vec3 vSphericalY;vec3 vSphericalZ;vec3 vSphericalXX_ZZ;vec3 vSphericalYY_ZZ;vec3 vSphericalZZ;vec3 vSphericalXY;vec3 vSphericalYZ;vec3 vSphericalZX;\n#define ADDITIONAL_UBO_DECLARATION\n};\n#include\n#include\n")},48961:(e,t,n)=>{n.r(t),n.d(t,{lightVxUboDeclaration:()=>a});var r=n(98519),i="lightVxUboDeclaration",o="#ifdef LIGHT{X}\nuniform Light{X}\n{vec4 vLightData;vec4 vLightDiffuse;vec4 vLightSpecular;\n#ifdef SPOTLIGHT{X}\nvec4 vLightDirection;vec4 vLightFalloff;\n#elif defined(POINTLIGHT{X})\nvec4 vLightFalloff;\n#elif defined(HEMILIGHT{X})\nvec3 vLightGround;\n#elif defined(CLUSTLIGHT{X})\nvec2 vSliceData;vec2 vSliceRanges[CLUSTLIGHT_SLICES];\n#endif\n#if defined(AREALIGHT{X})\nvec4 vLightWidth;vec4 vLightHeight;\n#endif\nvec4 shadowsInfo;vec2 depthValues;} light{X};\n#ifdef SHADOW{X}\n#ifdef SHADOWCSM{X}\nuniform mat4 lightMatrix{X}[SHADOWCSMNUM_CASCADES{X}];varying vec4 vPositionFromLight{X}[SHADOWCSMNUM_CASCADES{X}];varying float vDepthMetric{X}[SHADOWCSMNUM_CASCADES{X}];varying vec4 vPositionFromCamera{X};\n#elif defined(SHADOWCUBE{X})\n#else\nvarying vec4 vPositionFromLight{X};varying float vDepthMetric{X};uniform mat4 lightMatrix{X};\n#endif\n#endif\n#endif\n";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]=o);var a={name:i,shader:o}},49125:(e,t,n)=>{n.r(t),n.d(t,{backgroundPixelShaderWGSL:()=>s});var r=n(98519),i=(n(66138),n(17393),n(61439),n(86320),n(10896),n(53378),n(32532),n(4661),n(38197),n(20502),n(98318),"intersectionFunctions");r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="fn diskIntersectWithBackFaceCulling(ro: vec3f,rd: vec3f,c: vec3f,r: f32)->f32 {var d: f32=rd.y;if(d>0.0) { return 1e6; }\nvar o: vec3f=ro-c;var t: f32=-o.y/d;var q: vec3f=o+rd*t;return select(1e6,t,(dot(q,q)vec2f {var oc: vec3f=ro-ce;var b: f32=dot(oc,rd);var c: f32=dot(oc,oc)-ra*ra;var h: f32=b*b-c;if(h<0.0) { return vec2f(-1.,-1.); }\nh=sqrt(h);return vec2f(-b+h,-b-h);}\nfn sphereIntersectFromOrigin(ro: vec3f,rd: vec3f,ra: f32)->vec2f {var b: f32=dot(ro,rd);var c: f32=dot(ro,ro)-ra*ra;var h: f32=b*b-c;if(h<0.0) { return vec2f(-1.,-1.); }\nh=sqrt(h);return vec2f(-b+h,-b-h);}"),n(30032),n(84192),n(56897),n(83512);var o="backgroundPixelShader",a="#include\n#include\nvarying vPositionW: vec3f;\n#ifdef MAINUV1\nvarying vMainUV1: vec2f;\n#endif \n#ifdef MAINUV2 \nvarying vMainUV2: vec2f; \n#endif \n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#ifdef DIFFUSE\n#if DIFFUSEDIRECTUV==1\n#define vDiffuseUV vMainUV1\n#elif DIFFUSEDIRECTUV==2\n#define vDiffuseUV vMainUV2\n#else\nvarying vDiffuseUV: vec2f;\n#endif\nvar diffuseSamplerSampler: sampler;var diffuseSampler: texture_2d;\n#endif\n#ifdef REFLECTION\n#ifdef REFLECTIONMAP_3D\nvar reflectionSamplerSampler: sampler;var reflectionSampler: texture_cube;\n#ifdef TEXTURELODSUPPORT\n#else\nvar reflectionLowSamplerSampler: sampler;var reflectionLowSampler: texture_cube;var reflectionHighSamplerSampler: sampler;var reflectionHighSampler: texture_cube;\n#endif\n#else\nvar reflectionSamplerSampler: sampler;var reflectionSampler: texture_2d;\n#ifdef TEXTURELODSUPPORT\n#else\nvar reflectionLowSamplerSampler: sampler;var reflectionLowSampler: texture_2d;var reflectionHighSamplerSampler: sampler;var reflectionHighSampler: texture_2d;\n#endif\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vPositionUVW: vec3f;\n#else\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vDirectionW: vec3f;\n#endif\n#endif\n#include\n#endif\n#ifndef FROMLINEARSPACE\n#define FROMLINEARSPACE;\n#endif\n#ifndef SHADOWONLY\n#define SHADOWONLY;\n#endif\n#include\n#include[0..maxSimultaneousLights]\n#include\n#include\n#include\n#include\n#include\n#include\n#ifdef REFLECTIONFRESNEL\n#define FRESNEL_MAXIMUM_ON_ROUGH 0.25\nfn fresnelSchlickEnvironmentGGX(VdotN: f32,reflectance0: vec3f,reflectance90: vec3f,smoothness: f32)->vec3f\n{var weight: f32=mix(FRESNEL_MAXIMUM_ON_ROUGH,1.0,smoothness);return reflectance0+weight*(reflectance90-reflectance0)*pow5(saturate(1.0-VdotN));}\n#endif\n#ifdef PROJECTED_GROUND\n#include\nfn project(viewDirectionW: vec3f,eyePosition: vec3f)->vec3f {var radius: f32=uniforms.projectedGroundInfos.x;var height: f32=uniforms.projectedGroundInfos.y;var camDir: vec3f=-viewDirectionW;var skySphereDistance: f32=sphereIntersectFromOrigin(eyePosition,camDir,radius).x;var skySpherePositionW: vec3f=eyePosition+camDir*skySphereDistance;var p: vec3f=normalize(skySpherePositionW);var upEyePosition=vec3f(eyePosition.x,eyePosition.y-height,eyePosition.z);var sIntersection: f32=sphereIntersectFromOrigin(upEyePosition,p,radius).x;var h: vec3f= vec3f(0.0,-height,0.0);var dIntersection: f32=diskIntersectWithBackFaceCulling(upEyePosition,p,h,radius);p=(upEyePosition+min(sIntersection,dIntersection)*p);return p;}\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include\nvar viewDirectionW: vec3f=normalize(scene.vEyePosition.xyz-input.vPositionW);\n#ifdef NORMAL\nvar normalW: vec3f=normalize(fragmentInputs.vNormalW);\n#else\nvar normalW: vec3f= vec3f(0.0,1.0,0.0);\n#endif\nvar shadow: f32=1.;var globalShadow: f32=0.;var shadowLightCount: f32=0.;var aggShadow: f32=0.;var numLights: f32=0.;\n#include[0..maxSimultaneousLights]\n#ifdef SHADOWINUSE\nglobalShadow/=shadowLightCount;\n#else\nglobalShadow=1.0;\n#endif\n#ifndef BACKMAT_SHADOWONLY\nvar reflectionColor: vec4f= vec4f(1.,1.,1.,1.);\n#ifdef REFLECTION\n#ifdef PROJECTED_GROUND\nvar reflectionVector: vec3f=project(viewDirectionW,scene.vEyePosition.xyz);reflectionVector= (uniforms.reflectionMatrix*vec4f(reflectionVector,1.)).xyz;\n#else\nvar reflectionVector: vec3f=computeReflectionCoords( vec4f(fragmentInputs.vPositionW,1.0),normalW);\n#endif\n#ifdef REFLECTIONMAP_OPPOSITEZ\nreflectionVector.z*=-1.0;\n#endif\n#ifdef REFLECTIONMAP_3D\nvar reflectionCoords: vec3f=reflectionVector;\n#else\nvar reflectionCoords: vec2f=reflectionVector.xy;\n#ifdef REFLECTIONMAP_PROJECTION\nreflectionCoords/=reflectionVector.z;\n#endif\nreflectionCoords.y=1.0-reflectionCoords.y;\n#endif\n#ifdef REFLECTIONBLUR\nvar reflectionLOD: f32=uniforms.vReflectionInfos.y;\n#ifdef TEXTURELODSUPPORT\nreflectionLOD=reflectionLOD*log2(uniforms.vReflectionMicrosurfaceInfos.x)*uniforms.vReflectionMicrosurfaceInfos.y+uniforms.vReflectionMicrosurfaceInfos.z;reflectionColor=textureSampleLevel(reflectionSampler,reflectionSamplerSampler,reflectionCoords,reflectionLOD);\n#else\nvar lodReflectionNormalized: f32=saturate(reflectionLOD);var lodReflectionNormalizedDoubled: f32=lodReflectionNormalized*2.0;var reflectionSpecularMid: vec4f=textureSample(reflectionSampler,reflectionSamplerSampler,reflectionCoords);if(lodReflectionNormalizedDoubled<1.0){reflectionColor=mix(\ntextureSample(reflectionrHighSampler,reflectionrHighSamplerSampler,reflectionCoords),\nreflectionSpecularMid,\nlodReflectionNormalizedDoubled\n);} else {reflectionColor=mix(\nreflectionSpecularMid,\ntextureSample(reflectionLowSampler,reflectionLowSamplerSampler,reflectionCoords),\nlodReflectionNormalizedDoubled-1.0\n);}\n#endif\n#else\nvar reflectionSample: vec4f=textureSample(reflectionSampler,reflectionSamplerSampler,reflectionCoords);reflectionColor=reflectionSample;\n#endif\n#ifdef RGBDREFLECTION\nreflectionColor=vec4f(fromRGBD(reflectionColor).rgb,reflectionColor.a);\n#endif\n#ifdef GAMMAREFLECTION\nreflectionColor=vec4f(toLinearSpaceVec3(reflectionColor.rgb),reflectionColor.a);\n#endif\n#ifdef REFLECTIONBGR\nreflectionColor=vec4f(reflectionColor.bgr,reflectionColor.a);\n#endif\nreflectionColor=vec4f(reflectionColor.rgb*uniforms.vReflectionInfos.x,reflectionColor.a);\n#endif\nvar diffuseColor: vec3f= vec3f(1.,1.,1.);var finalAlpha: f32=uniforms.alpha;\n#ifdef DIFFUSE\nvar diffuseMap: vec4f=textureSample(diffuseSampler,diffuseSamplerSampler,input.vDiffuseUV);\n#ifdef GAMMADIFFUSE\ndiffuseMap=vec4f(toLinearSpaceVec3(diffuseMap.rgb),diffuseMap.a);\n#endif\ndiffuseMap=vec4f(diffuseMap.rgb *uniforms.vDiffuseInfos.y,diffuseMap.a);\n#ifdef DIFFUSEHASALPHA\nfinalAlpha*=diffuseMap.a;\n#endif\ndiffuseColor=diffuseMap.rgb;\n#endif\n#ifdef REFLECTIONFRESNEL\nvar colorBase: vec3f=diffuseColor;\n#else\nvar colorBase: vec3f=reflectionColor.rgb*diffuseColor;\n#endif\ncolorBase=max(colorBase,vec3f(0.0));\n#ifdef USERGBCOLOR\nvar finalColor: vec3f=colorBase;\n#else\n#ifdef USEHIGHLIGHTANDSHADOWCOLORS\nvar mainColor: vec3f=mix(uniforms.vPrimaryColorShadow.rgb,uniforms.vPrimaryColor.rgb,colorBase);\n#else\nvar mainColor: vec3f=uniforms.vPrimaryColor.rgb;\n#endif\nvar finalColor: vec3f=colorBase*mainColor;\n#endif\n#ifdef REFLECTIONFRESNEL\nvar reflectionAmount: vec3f=uniforms.vReflectionControl.xxx;var reflectionReflectance0: vec3f=uniforms.vReflectionControl.yyy;var reflectionReflectance90: vec3f=uniforms.vReflectionControl.zzz;var VdotN: f32=dot(normalize(scene.vEyePosition.xyz),normalW);var planarReflectionFresnel: vec3f=fresnelSchlickEnvironmentGGX(saturate(VdotN),reflectionReflectance0,reflectionReflectance90,1.0);reflectionAmount*=planarReflectionFresnel;\n#ifdef REFLECTIONFALLOFF\nvar reflectionDistanceFalloff: f32=1.0-saturate(length(vPositionW.xyz-uniforms.vBackgroundCenter)*uniforms.vReflectionControl.w);reflectionDistanceFalloff*=reflectionDistanceFalloff;reflectionAmount*=reflectionDistanceFalloff;\n#endif\nfinalColor=mix(finalColor,reflectionColor.rgb,saturateVec3(reflectionAmount));\n#endif\n#ifdef OPACITYFRESNEL\nvar viewAngleToFloor: f32=dot(normalW,normalize(scene.vEyePosition.xyz-uniforms.vBackgroundCenter));const startAngle: f32=0.1;var fadeFactor: f32=saturate(viewAngleToFloor/startAngle);finalAlpha*=fadeFactor*fadeFactor;\n#endif\n#ifdef SHADOWINUSE\nfinalColor=mix(finalColor*uniforms.shadowLevel,finalColor,globalShadow);\n#endif\nvar color: vec4f= vec4f(finalColor,finalAlpha);\n#else\nvar color: vec4f= vec4f(uniforms.vPrimaryColor.rgb,(1.0-clamp(globalShadow,0.,1.))*uniforms.alpha);\n#endif\n#include\n#include\n#ifdef IMAGEPROCESSINGPOSTPROCESS\n#if !defined(SKIPFINALCOLORCLAMP)\ncolor=vec4f(clamp(color.rgb,vec3f(0.),vec3f(30.0)),color.a);\n#endif\n#else\ncolor=applyImageProcessing(color);\n#endif\n#ifdef PREMULTIPLYALPHA\ncolor=vec4f(color.rgb *color.a,color.a);\n#endif\n#ifdef NOISE\ncolor=vec4f(color.rgb+dither(fragmentInputs.vPositionW.xy,0.5),color.a);color=max(color,vec4f(0.0));\n#endif\nfragmentOutputs.color=color;\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";r.l.ShadersStoreWGSL[o]||(r.l.ShadersStoreWGSL[o]=a);var s={name:o,shader:a}},49127:(e,t,n)=>{n.r(t),n.d(t,{FlowGraphWaitAllBlock:()=>l});var r=n(78322),i=n(88469),o=n(34623),a=n(88099),s=n(40099),l=function(e){function t(t){var n=e.call(this,t)||this;n.config=t,n.inFlows=[],n._cachedActivationState=[],n.reset=n._registerSignalInput("reset"),n.completed=n._registerSignalOutput("completed"),n.remainingInputs=n.registerDataOutput("remainingInputs",a.x2,new s.P(n.config.inputSignalCount||0));for(var r=0;r=0&&(n[i]=!0)}if(this.remainingInputs.setValue(new s.P(n.filter((function(e){return!e})).length),e),e._setExecutionVariable(this,"activationState",n.slice()),n.includes(!1))t!==this.reset&&this.out._activateSignal(e);else for(this.completed._activateSignal(e),r=0;r{var r=n(98519),i="bakedVertexAnimation";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#ifdef BAKED_VERTEX_ANIMATION_TEXTURE\n{\n#ifdef INSTANCES\n#define BVASNAME bakedVertexAnimationSettingsInstanced\n#else\n#define BVASNAME bakedVertexAnimationSettings\n#endif\nfloat VATStartFrame=BVASNAME.x;float VATEndFrame=BVASNAME.y;float VATOffsetFrame=BVASNAME.z;float VATSpeed=BVASNAME.w;float totalFrames=VATEndFrame-VATStartFrame+1.0;float time=bakedVertexAnimationTime*VATSpeed/totalFrames;float frameCorrection=time<1.0 ? 0.0 : 1.0;float numOfFrames=totalFrames-frameCorrection;float VATFrameNum=fract(time)*numOfFrames;VATFrameNum=mod(VATFrameNum+VATOffsetFrame,numOfFrames);VATFrameNum=floor(VATFrameNum);VATFrameNum+=VATStartFrame+frameCorrection;mat4 VATInfluence;VATInfluence=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndices[0],VATFrameNum)*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\nVATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndices[1],VATFrameNum)*matricesWeights[1];\n#endif\n#if NUM_BONE_INFLUENCERS>2\nVATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndices[2],VATFrameNum)*matricesWeights[2];\n#endif\n#if NUM_BONE_INFLUENCERS>3\nVATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndices[3],VATFrameNum)*matricesWeights[3];\n#endif\n#if NUM_BONE_INFLUENCERS>4\nVATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndicesExtra[0],VATFrameNum)*matricesWeightsExtra[0];\n#endif\n#if NUM_BONE_INFLUENCERS>5\nVATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndicesExtra[1],VATFrameNum)*matricesWeightsExtra[1];\n#endif\n#if NUM_BONE_INFLUENCERS>6\nVATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndicesExtra[2],VATFrameNum)*matricesWeightsExtra[2];\n#endif\n#if NUM_BONE_INFLUENCERS>7\nVATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndicesExtra[3],VATFrameNum)*matricesWeightsExtra[3];\n#endif\nfinalWorld=finalWorld*VATInfluence;}\n#endif\n")},49449:(e,t,n)=>{n.d(t,{a:()=>r});var r=function(){function e(){}return e.ExponentialBackoff=function(e,t){return void 0===e&&(e=3),void 0===t&&(t=500),function(n,r,i){return 0!==r.status||i>=e||-1!==n.indexOf("file:")?-1:Math.pow(2,i)*t}},e}()},49611:(e,t,n)=>{n.r(t),n.d(t,{DDSTools:()=>m});var r=n(48810),i=n(81152),o=n(7164),a=n(75768),s=n(16110),l=(n(19966),131072),c=131072;function u(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}var h=u("DXT1"),d=u("DXT3"),p=u("DXT5"),f=u("DX10"),m=function(){function e(){}return e.GetDDSInfo=function(e){var t=new Int32Array(e.buffer,e.byteOffset,31),n=new Int32Array(e.buffer,e.byteOffset,35),r=1;t[2]&l&&(r=Math.max(1,t[7]));var o=t[21],a=o===f?n[32]:0,s=i.Y.TEXTURETYPE_UNSIGNED_BYTE;switch(o){case 113:s=i.Y.TEXTURETYPE_HALF_FLOAT;break;case 116:s=i.Y.TEXTURETYPE_FLOAT;break;case f:if(10===a){s=i.Y.TEXTURETYPE_HALF_FLOAT;break}if(2===a){s=i.Y.TEXTURETYPE_FLOAT;break}}return{width:t[4],height:t[3],mipmapCount:r,isFourCC:!(4&~t[20]),isRGB:!(64&~t[20]),isLuminance:(t[20]&c)===c,isCube:!(512&~t[28]),isCompressed:o===h||o===d||o===p,dxgiFormat:a,textureType:s}},e._GetHalfFloatAsFloatRGBAArrayBuffer=function(t,n,r,i,o,a){for(var l=new Float32Array(i),c=new Uint16Array(o,r),u=0,h=0;h>8)},e._GetRGBArrayBuffer=function(e,t,n,r,i,o,a,s){for(var l=new Uint8Array(r),c=new Uint8Array(i,n),u=0,h=0;h>8&255,D>>16&255,D>>24&255))])}var L=e._ExtractLongWordOrder(R[23]),w=e._ExtractLongWordOrder(R[24]),B=e._ExtractLongWordOrder(R[25]),V=e._ExtractLongWordOrder(R[26]);N&&(I=t._getRGBABufferInternalSizedFormat(s.textureType)),P=1,R[2]&l&&!1!==c&&(P=Math.max(1,R[7]));for(var U=_||0,G=t.getCaps(),k=U;k0?s.sphericalPolynomial=a.d.ConvertCubeMapToSphericalPolynomial({size:R[4],right:v[0],left:v[1],up:v[2],down:v[3],front:v[4],back:v[5],format:i.Y.TEXTUREFORMAT_RGBA,type:i.Y.TEXTURETYPE_FLOAT,gammaSpace:!1}):s.sphericalPolynomial=void 0}else o.V.Error("Compressed textures are not supported on this platform.");else o.V.Error("Unsupported format, must contain a FourCC, RGB or LUMINANCE code");else o.V.Error("Invalid magic number in DDS header")},e.StoreLODInAlphaChannel=!1,e}()},49803:(e,t,n)=>{n.d(t,{v:()=>d});var r=n(78322),i=n(6174),o=n(8046),a=n(64726),s=n(85405),l=n(75482),c=n(34623),u=n(91946),h=n(12028),d=function(e){function t(n,r){var i=e.call(this,n,r,!1)||this;return i.diffuse=new a.v9(1,1,1),i.specular=new a.v9(1,1,1),i.falloffType=t.FALLOFF_DEFAULT,i.intensity=1,i._range=Number.MAX_VALUE,i._inverseSquaredRange=0,i._photometricScale=1,i._intensityMode=t.INTENSITYMODE_AUTOMATIC,i._radius=1e-5,i.renderPriority=0,i._shadowEnabled=!0,i._excludeWithLayerMask=0,i._includeOnlyWithLayerMask=0,i._lightmapMode=0,i._shadowGenerators=null,i._excludedMeshesIds=new Array,i._includedOnlyMeshesIds=new Array,i._currentViewDepth=0,i._isLight=!0,i.getScene().addLight(i),i._uniformBuffer=new l.D(i.getScene().getEngine(),void 0,void 0,n),i._buildUniformLayout(),i.includedOnlyMeshes=[],i.excludedMeshes=[],i._resyncMeshes(),i}return(0,r.C6)(t,e),Object.defineProperty(t.prototype,"range",{get:function(){return this._range},set:function(e){this._range=e,this._inverseSquaredRange=1/(this.range*this.range)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"intensityMode",{get:function(){return this._intensityMode},set:function(e){this._intensityMode=e,this._computePhotometricScale()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"radius",{get:function(){return this._radius},set:function(e){this._radius=e,this._computePhotometricScale()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shadowEnabled",{get:function(){return this._shadowEnabled},set:function(e){this._shadowEnabled!==e&&(this._shadowEnabled=e,this._markMeshesAsLightDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"includedOnlyMeshes",{get:function(){return this._includedOnlyMeshes},set:function(e){this._includedOnlyMeshes=e,this._hookArrayForIncludedOnly(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"excludedMeshes",{get:function(){return this._excludedMeshes},set:function(e){this._excludedMeshes=e,this._hookArrayForExcluded(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"excludeWithLayerMask",{get:function(){return this._excludeWithLayerMask},set:function(e){this._excludeWithLayerMask=e,this._resyncMeshes()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"includeOnlyWithLayerMask",{get:function(){return this._includeOnlyWithLayerMask},set:function(e){this._includeOnlyWithLayerMask=e,this._resyncMeshes()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lightmapMode",{get:function(){return this._lightmapMode},set:function(e){this._lightmapMode!==e&&(this._lightmapMode=e,this._markMeshesAsLightDirty())},enumerable:!1,configurable:!0}),t.prototype.getViewMatrix=function(e){return null},t.prototype.getProjectionMatrix=function(e,t){return null},t.prototype.transferTexturesToEffect=function(e,t){return this},t.prototype._bindLight=function(e,t,n,r,i){var o;void 0===i&&(i=!0);var s=e.toString(),l=!1;if(this._uniformBuffer.bindToEffect(n,"Light"+s),this._renderId!==t.getRenderId()||this._lastUseSpecular!==r||!this._uniformBuffer.useUbo){this._renderId=t.getRenderId(),this._lastUseSpecular=r;var c=this.getScaledIntensity();this.transferToEffect(n,s),this.diffuse.scaleToRef(c,a.IG.Color3[0]),this._uniformBuffer.updateColor4("vLightDiffuse",a.IG.Color3[0],this.range,s),r&&(this.specular.scaleToRef(c,a.IG.Color3[1]),this._uniformBuffer.updateColor4("vLightSpecular",a.IG.Color3[1],this.radius,s)),l=!0}if(this.transferTexturesToEffect(n,s),t.shadowsEnabled&&this.shadowEnabled&&i){var u=null!==(o=this.getShadowGenerator(t.activeCamera))&&void 0!==o?o:this.getShadowGenerator();u&&(u.bindShadowLight(s,n),l=!0)}l?this._uniformBuffer.update():this._uniformBuffer.bindUniformBuffer()},t.prototype.getClassName=function(){return"Light"},t.prototype.toString=function(e){var t="Name: "+this.name;if(t+=", type: "+["Point","Directional","Spot","Hemispheric","Clustered"][this.getTypeID()],this.animations)for(var n=0;n0&&-1===this.includedOnlyMeshes.indexOf(e)||this.excludedMeshes&&this.excludedMeshes.length>0&&-1!==this.excludedMeshes.indexOf(e)||0!==this.includeOnlyWithLayerMask&&0===(this.includeOnlyWithLayerMask&e.layerMask)||0!==this.excludeWithLayerMask&&this.excludeWithLayerMask&e.layerMask))},t.prototype.dispose=function(t,n){if(void 0===n&&(n=!1),this._shadowGenerators){for(var r=this._shadowGenerators.values(),i=r.next();!0!==i.done;i=r.next())i.value.dispose();this._shadowGenerators=null}if(this.getScene().stopAnimation(this),this._parentContainer){var o=this._parentContainer.lights.indexOf(this);o>-1&&this._parentContainer.lights.splice(o,1),this._parentContainer=null}for(var a=0,s=this.getScene().meshes;a0){e.excludedMeshesIds=[];for(var t=0,n=this.excludedMeshes;t0){e.includedOnlyMeshesIds=[];for(var i=0,o=this.includedOnlyMeshes;i{n.d(t,{p:()=>c});var r=n(78322),i=n(6174),o=n(8046),a=n(49803),s=n(13424),l=n(81152),c=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._needProjectionMatrixCompute=!0,t._viewMatrix=o.uq.Identity(),t._projectionMatrix=o.uq.Identity(),t}return(0,r.C6)(t,e),t.prototype._setPosition=function(e){this._position=e},Object.defineProperty(t.prototype,"position",{get:function(){return this._position},set:function(e){this._setPosition(e)},enumerable:!1,configurable:!0}),t.prototype._setDirection=function(e){this._direction=e},Object.defineProperty(t.prototype,"direction",{get:function(){return this._direction},set:function(e){this._setDirection(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shadowMinZ",{get:function(){return this._shadowMinZ},set:function(e){this._shadowMinZ=e,this.forceProjectionMatrixCompute()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shadowMaxZ",{get:function(){return this._shadowMaxZ},set:function(e){this._shadowMaxZ=e,this.forceProjectionMatrixCompute()},enumerable:!1,configurable:!0}),t.prototype.computeTransformedInformation=function(){return!(!this.parent||!this.parent.getWorldMatrix||(this.transformedPosition||(this.transformedPosition=o.Pq.Zero()),o.Pq.TransformCoordinatesToRef(this.position,this.parent.getWorldMatrix(),this.transformedPosition),this.direction&&(this.transformedDirection||(this.transformedDirection=o.Pq.Zero()),o.Pq.TransformNormalToRef(this.direction,this.parent.getWorldMatrix(),this.transformedDirection)),0))},t.prototype.getDepthScale=function(){return 50},t.prototype.getShadowDirection=function(e){return this.transformedDirection?this.transformedDirection:this.direction},t.prototype.getAbsolutePosition=function(){return this.transformedPosition?this.transformedPosition:this.position},t.prototype.setDirectionToTarget=function(e){return this.direction=o.Pq.Normalize(e.subtract(this.position)),this.direction},t.prototype.getRotation=function(){this.direction.normalize();var e=o.Pq.Cross(this.direction,s._0.Y),t=o.Pq.Cross(e,this.direction);return o.Pq.RotationFromAxis(e,t,this.direction)},t.prototype.needCube=function(){return!1},t.prototype.needProjectionMatrixCompute=function(){return this._needProjectionMatrixCompute},t.prototype.forceProjectionMatrixCompute=function(){this._needProjectionMatrixCompute=!0},t.prototype._initCache=function(){e.prototype._initCache.call(this),this._cache.position=o.Pq.Zero()},t.prototype._isSynchronized=function(){return!!this._cache.position.equals(this.position)},t.prototype.computeWorldMatrix=function(e){return!e&&this.isSynchronized()?(this._currentRenderId=this.getScene().getRenderId(),this._worldMatrix):(this._updateCache(),this._cache.position.copyFrom(this.position),this._worldMatrix||(this._worldMatrix=o.uq.Identity()),o.uq.TranslationToRef(this.position.x,this.position.y,this.position.z,this._worldMatrix),this.parent&&this.parent.getWorldMatrix&&(this._worldMatrix.multiplyToRef(this.parent.getWorldMatrix(),this._worldMatrix),this._markSyncedWithParent()),this._worldMatrixDeterminantIsDirty=!0,this._worldMatrix)},t.prototype.getDepthMinZ=function(e){return void 0!==this.shadowMinZ?this.shadowMinZ:(null==e?void 0:e.minZ)||l.Y.ShadowMinZ},t.prototype.getDepthMaxZ=function(e){return void 0!==this.shadowMaxZ?this.shadowMaxZ:(null==e?void 0:e.maxZ)||l.Y.ShadowMaxZ},t.prototype.setShadowProjectionMatrix=function(e,t,n){return this.customProjectionMatrixBuilder?this.customProjectionMatrixBuilder(t,n,e):this._setDefaultShadowProjectionMatrix(e,t,n),this},t.prototype._syncParentEnabledState=function(){e.prototype._syncParentEnabledState.call(this),this.parent&&this.parent.getWorldMatrix||(this.transformedPosition=null,this.transformedDirection=null)},t.prototype.getViewMatrix=function(e){var t=o.AA.Vector3[0],n=this.position;this.computeTransformedInformation()&&(n=this.transformedPosition),o.Pq.NormalizeToRef(this.getShadowDirection(e),t),1===Math.abs(o.Pq.Dot(t,o.Pq.Up()))&&(t.z=1e-13);var r=o.AA.Vector3[1];return n.addToRef(t,r),o.uq.LookAtLHToRef(n,r,o.Pq.Up(),this._viewMatrix),this._viewMatrix},t.prototype.getProjectionMatrix=function(e,t){return this.setShadowProjectionMatrix(this._projectionMatrix,null!=e?e:this._viewMatrix,null!=t?t:[]),this._projectionMatrix},(0,r.Cg)([(0,i.P_)()],t.prototype,"position",null),(0,r.Cg)([(0,i.P_)()],t.prototype,"direction",null),(0,r.Cg)([(0,i.lK)()],t.prototype,"shadowMinZ",null),(0,r.Cg)([(0,i.lK)()],t.prototype,"shadowMaxZ",null),t}(a.v)},50016:(e,t,n)=>{n.d(t,{H:()=>d});var r=n(78322),i=function(){function e(){var e=this;this._createSubNodePromises={},this._isDisposed=!1,this._subNodes={},this._onSubNodeDisposed=function(t){var n=t;delete e._subNodes[n.name],e._onSubNodesChanged()}}return e.prototype.callOnSubNode=function(e,t){var n=this,r=this.getSubNode(e);r?t(r):this._createSubNodePromisesResolvedAsync().then((function(){var r=n.getSubNode(e);r?t(r):n.createAndAddSubNodeAsync(e).then((function(e){t(e)}))}))},e.prototype.createAndAddSubNodeAsync=function(e){var t,n=this;return(t=this._createSubNodePromises)[e]||(t[e]=this._createSubNode(e).then((function(e){return n._addSubNode(e),e}))),this._createSubNodePromises[e]},e.prototype.dispose=function(){this._isDisposed=!0;for(var e=0,t=Object.values(this._subNodes);e{var r=n(98519),i=(n(50851),n(56174),"openpbrUboDeclaration");r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="layout(std140,column_major) uniform;uniform Material {vec2 vTangentSpaceParams;vec4 vLightingIntensity;float pointSize;vec2 vDebugMode;vec4 cameraInfo;vec2 vReflectionInfos;mat4 reflectionMatrix;vec3 vReflectionMicrosurfaceInfos;vec3 vReflectionPosition;vec3 vReflectionSize;vec2 vReflectionFilteringInfo;vec3 vReflectionDominantDirection;vec3 vReflectionColor;vec3 vSphericalL00;vec3 vSphericalL1_1;vec3 vSphericalL10;vec3 vSphericalL11;vec3 vSphericalL2_2;vec3 vSphericalL2_1;vec3 vSphericalL20;vec3 vSphericalL21;vec3 vSphericalL22;vec3 vSphericalX;vec3 vSphericalY;vec3 vSphericalZ;vec3 vSphericalXX_ZZ;vec3 vSphericalYY_ZZ;vec3 vSphericalZZ;vec3 vSphericalXY;vec3 vSphericalYZ;vec3 vSphericalZX;float vBaseWeight;vec4 vBaseColor;float vBaseDiffuseRoughness;vec4 vReflectanceInfo;vec4 vSpecularColor;vec3 vSpecularAnisotropy;float vCoatWeight;vec3 vCoatColor;float vCoatRoughness;float vCoatRoughnessAnisotropy;float vCoatIor;float vCoatDarkening;float vFuzzWeight;vec3 vFuzzColor;float vFuzzRoughness;vec2 vGeometryCoatTangent;vec3 vEmissionColor;float vThinFilmWeight;vec2 vThinFilmThickness;float vThinFilmIor;vec2 vBaseWeightInfos;mat4 baseWeightMatrix;vec2 vBaseColorInfos;mat4 baseColorMatrix;vec2 vBaseDiffuseRoughnessInfos;mat4 baseDiffuseRoughnessMatrix;vec2 vBaseMetalnessInfos;mat4 baseMetalnessMatrix;vec2 vSpecularWeightInfos;mat4 specularWeightMatrix;vec2 vSpecularColorInfos;mat4 specularColorMatrix;vec2 vSpecularRoughnessInfos;mat4 specularRoughnessMatrix;vec2 vSpecularRoughnessAnisotropyInfos;mat4 specularRoughnessAnisotropyMatrix;vec2 vCoatWeightInfos;mat4 coatWeightMatrix;vec2 vCoatColorInfos;mat4 coatColorMatrix;vec2 vCoatRoughnessInfos;mat4 coatRoughnessMatrix;vec2 vCoatRoughnessAnisotropyInfos;mat4 coatRoughnessAnisotropyMatrix;vec2 vCoatDarkeningInfos;mat4 coatDarkeningMatrix;vec2 vFuzzWeightInfos;mat4 fuzzWeightMatrix;vec2 vFuzzColorInfos;mat4 fuzzColorMatrix;vec2 vFuzzRoughnessInfos;mat4 fuzzRoughnessMatrix;vec2 vGeometryNormalInfos;mat4 geometryNormalMatrix;vec2 vGeometryTangentInfos;mat4 geometryTangentMatrix;vec2 vGeometryCoatNormalInfos;mat4 geometryCoatNormalMatrix;vec2 vGeometryCoatTangentInfos;mat4 geometryCoatTangentMatrix;vec2 vGeometryOpacityInfos;mat4 geometryOpacityMatrix;vec2 vEmissionColorInfos;mat4 emissionColorMatrix;vec2 vThinFilmWeightInfos;mat4 thinFilmWeightMatrix;vec2 vThinFilmThicknessInfos;mat4 thinFilmThicknessMatrix;vec2 vAmbientOcclusionInfos;mat4 ambientOcclusionMatrix;\n#define ADDITIONAL_UBO_DECLARATION\n};\n#include\n#include\n")},50265:(e,t,n)=>{n.r(t),n.d(t,{lodCubePixelShaderWGSL:()=>a});var r=n(98519),i="lodCubePixelShader",o="const GammaEncodePowerApprox=1.0/2.2;varying vUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_cube;uniform lod: f32;uniform gamma: i32;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {let uv=fragmentInputs.vUV*2.0-1.0;\n#ifdef POSITIVEX\nfragmentOutputs.color=textureSampleLevel(textureSampler,textureSamplerSampler,vec3f(1.001,uv.y,uv.x),uniforms.lod);\n#endif\n#ifdef NEGATIVEX\nfragmentOutputs.color=textureSampleLevel(textureSampler,textureSamplerSampler,vec3f(-1.001,uv.y,uv.x),uniforms.lod);\n#endif\n#ifdef POSITIVEY\nfragmentOutputs.color=textureSampleLevel(textureSampler,textureSamplerSampler,vec3f(uv.y,1.001,uv.x),uniforms.lod);\n#endif\n#ifdef NEGATIVEY\nfragmentOutputs.color=textureSampleLevel(textureSampler,textureSamplerSampler,vec3f(uv.y,-1.001,uv.x),uniforms.lod);\n#endif\n#ifdef POSITIVEZ\nfragmentOutputs.color=textureSampleLevel(textureSampler,textureSamplerSampler,vec3f(uv,1.001),uniforms.lod);\n#endif\n#ifdef NEGATIVEZ\nfragmentOutputs.color=textureSampleLevel(textureSampler,textureSamplerSampler,vec3f(uv,-1.001),uniforms.lod);\n#endif\nif (uniforms.gamma==0) {fragmentOutputs.color=vec4f(pow(fragmentOutputs.color.rgb,vec3f(GammaEncodePowerApprox)),fragmentOutputs.color.a);}}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},50491:(e,t,n)=>{n.r(t),n.d(t,{FlowGraphConditionalDataBlock:()=>s});var r=n(78322),i=n(45749),o=n(88099),a=n(34623),s=function(e){function t(t){var n=e.call(this,t)||this;return n.condition=n.registerDataInput("condition",o.RI),n.onTrue=n.registerDataInput("onTrue",o.Vv),n.onFalse=n.registerDataInput("onFalse",o.Vv),n.output=n.registerDataOutput("output",o.Vv),n}return(0,r.C6)(t,e),t.prototype._updateOutputs=function(e){var t=this.condition.getValue(e);this.output.setValue(t?this.onTrue.getValue(e):this.onFalse.getValue(e),e)},t.prototype.getClassName=function(){return"FlowGraphConditionalBlock"},t}(i.e);(0,a.Y5)("FlowGraphConditionalBlock",s)},50582:(e,t,n)=>{n.d(t,{g:()=>v});var r=n(78322),i=n(6174),o=n(66377),a=n(8046),s=n(28081),l=n(81152),c=n(34623),u=n(41190),h=n(53695),d=n(252),p=n(43939),f=n(37530),m=n(75838),_=n(51956),g=n(12028),v=function(e){function t(n,r,i,a,s,c,u,d,p,f,m,g,v,y){var b,S,T,E,x,P,C,R,A,I,O;void 0===s&&(s=t.TRILINEAR_SAMPLINGMODE),void 0===c&&(c=null),void 0===u&&(u=null),void 0===d&&(d=null),void 0===p&&(p=!1);var M,D=e.call(this,r)||this;D.url=null,D.uOffset=0,D.vOffset=0,D.uScale=1,D.vScale=1,D.uAng=0,D.vAng=0,D.wAng=0,D.uRotationCenter=.5,D.vRotationCenter=.5,D.wRotationCenter=.5,D.homogeneousRotationInUVTransform=!1,D.inspectableCustomProperties=null,D._noMipmap=!1,D._invertY=!1,D._rowGenerationMatrix=null,D._cachedTextureMatrix=null,D._projectionModeMatrix=null,D._t0=null,D._t1=null,D._t2=null,D._cachedUOffset=-1,D._cachedVOffset=-1,D._cachedUScale=0,D._cachedVScale=0,D._cachedUAng=-1,D._cachedVAng=-1,D._cachedWAng=-1,D._cachedReflectionProjectionMatrixId=-1,D._cachedURotationCenter=-1,D._cachedVRotationCenter=-1,D._cachedWRotationCenter=-1,D._cachedHomogeneousRotationInUVTransform=!1,D._cachedIdentity3x2=!0,D._cachedReflectionTextureMatrix=null,D._cachedReflectionUOffset=-1,D._cachedReflectionVOffset=-1,D._cachedReflectionUScale=0,D._cachedReflectionVScale=0,D._cachedReflectionCoordinatesMode=-1,D._buffer=null,D._deleteBuffer=!1,D._format=null,D._delayedOnLoad=null,D._delayedOnError=null,D.onLoadObservable=new o.cP,D._isBlocking=!0,D.name=n||"",D.url=n;var N=!1,F=null,L=!0;"object"==typeof i&&null!==i?(M=null!==(b=i.noMipmap)&&void 0!==b&&b,a=null!==(S=i.invertY)&&void 0!==S?S:!_.rX,s=null!==(T=i.samplingMode)&&void 0!==T?T:t.TRILINEAR_SAMPLINGMODE,c=null!==(E=i.onLoad)&&void 0!==E?E:null,u=null!==(x=i.onError)&&void 0!==x?x:null,d=null!==(P=i.buffer)&&void 0!==P?P:null,p=null!==(C=i.deleteBuffer)&&void 0!==C&&C,f=i.format,m=i.mimeType,g=i.loaderOptions,v=i.creationFlags,N=null!==(R=i.useSRGBBuffer)&&void 0!==R&&R,F=null!==(A=i.internalTexture)&&void 0!==A?A:null,L=null!==(I=i.gammaSpace)&&void 0!==I?I:L,y=null!==(O=i.forcedExtension)&&void 0!==O?O:y):M=!!i,D._gammaSpace=L,D._noMipmap=M,D._invertY=void 0===a?!_.rX:a,D._initialSamplingMode=s,D._buffer=d,D._deleteBuffer=p,D._mimeType=m,D._loaderOptions=g,D._creationFlags=v,D._useSRGBBuffer=N,D._forcedExtension=y,void 0!==f&&(D._format=f);var w=D.getScene(),B=D._getEngine();if(!B)return D;B.onBeforeTextureInitObservable.notifyObservers(D);var V=function(){D._texture&&(D._texture._invertVScale&&(D.vScale*=-1,D.vOffset+=1),null!==D._texture._cachedWrapU&&(D.wrapU=D._texture._cachedWrapU,D._texture._cachedWrapU=null),null!==D._texture._cachedWrapV&&(D.wrapV=D._texture._cachedWrapV,D._texture._cachedWrapV=null),null!==D._texture._cachedWrapR&&(D.wrapR=D._texture._cachedWrapR,D._texture._cachedWrapR=null)),D.onLoadObservable.hasObservers()&&D.onLoadObservable.notifyObservers(D),c&&c(),!D.isBlocking&&w&&w.resetCachedMaterial()},U=function(e,n){D._loadingError=!0,D._errorObject={message:e,exception:n},u&&u(e,n),t.OnTextureLoadErrorObservable.notifyObservers(D)};if(!D.url&&!F)return D._delayedOnLoad=V,D._delayedOnError=U,D;if(D._texture=null!=F?F:D._getFromCache(D.url,M,s,D._invertY,N,D.isCube),D._texture)if(D._texture.isReady)h._.SetImmediate((function(){return V()}));else{var G=D._texture.onLoadedObservable.add(V);D._texture.onErrorObservable.add((function(e){var t;U(e.message,e.exception),null===(t=D._texture)||void 0===t||t.onLoadedObservable.remove(G)}))}else if(w&&w.useDelayedTextureLoading)D.delayLoadState=l.Y.DELAYLOADSTATE_NOTLOADED,D._delayedOnLoad=V,D._delayedOnError=U;else{try{D._texture=B.createTexture(D.url,M,D._invertY,w,s,V,U,D._buffer,void 0,D._format,D._forcedExtension,m,g,v,N)}catch(e){throw U("error loading",e),e}p&&(D._buffer=null)}return D}return(0,r.C6)(t,e),t._CreateVideoTexture=function(e,n,r,i,o,a,s,c,h){throw void 0===i&&(i=!1),void 0===o&&(o=!1),void 0===a&&(a=t.TRILINEAR_SAMPLINGMODE),void 0===s&&(s={}),void 0===h&&(h=l.Y.TEXTUREFORMAT_RGBA),(0,u.n)("VideoTexture")},Object.defineProperty(t.prototype,"noMipmap",{get:function(){return this._noMipmap},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mimeType",{get:function(){return this._mimeType},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isBlocking",{get:function(){return this._isBlocking},set:function(e){this._isBlocking=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"invertY",{get:function(){return this._invertY},enumerable:!1,configurable:!0}),t.prototype.updateURL=function(e,t,n,r){var i=this;void 0===t&&(t=null),this.url&&(this.releaseInternalTexture(),this.getScene().markAllMaterialsAsDirty(l.Y.MATERIAL_TextureDirtyFlag,(function(e){return e.hasTexture(i)}))),this.name&&!this.name.startsWith("data:")||(this.name=e),this.url=e,this._buffer=t,this._forcedExtension=r,this.delayLoadState=l.Y.DELAYLOADSTATE_NOTLOADED;var o=this._delayedOnLoad;this._delayedOnLoad=function(){o?o():i.onLoadObservable.hasObservers()&&i.onLoadObservable.notifyObservers(i),n&&n()},this.delayLoad()},t.prototype.delayLoad=function(){if(this.delayLoadState===l.Y.DELAYLOADSTATE_NOTLOADED){var e=this.getScene();if(e){var t=this.url;!t&&(this.name.indexOf("://")>0||this.name.startsWith("data:"))&&(t=this.name),this.delayLoadState=l.Y.DELAYLOADSTATE_LOADED,this._texture=this._getFromCache(t,this._noMipmap,this.samplingMode,this._invertY,this._useSRGBBuffer,this.isCube),this._texture?this._delayedOnLoad&&(this._texture.isReady?h._.SetImmediate(this._delayedOnLoad):this._texture.onLoadedObservable.add(this._delayedOnLoad)):(this._texture=e.getEngine().createTexture(t,this._noMipmap,this._invertY,e,this.samplingMode,this._delayedOnLoad,this._delayedOnError,this._buffer,null,this._format,this._forcedExtension,this._mimeType,this._loaderOptions,this._creationFlags,this._useSRGBBuffer),this._deleteBuffer&&(this._buffer=null)),this._delayedOnLoad=null,this._delayedOnError=null}}},t.prototype._prepareRowForTextureGeneration=function(e,t,n,r){e*=this._cachedUScale,t*=this._cachedVScale,e-=this.uRotationCenter*this._cachedUScale,t-=this.vRotationCenter*this._cachedVScale,n-=this.wRotationCenter,a.Pq.TransformCoordinatesFromFloatsToRef(e,t,n,this._rowGenerationMatrix,r),r.x+=this.uRotationCenter*this._cachedUScale+this._cachedUOffset,r.y+=this.vRotationCenter*this._cachedVScale+this._cachedVOffset,r.z+=this.wRotationCenter},t.prototype.getTextureMatrix=function(e){var t=this;if(void 0===e&&(e=1),this.uOffset===this._cachedUOffset&&this.vOffset===this._cachedVOffset&&this.uScale*e===this._cachedUScale&&this.vScale===this._cachedVScale&&this.uAng===this._cachedUAng&&this.vAng===this._cachedVAng&&this.wAng===this._cachedWAng&&this.uRotationCenter===this._cachedURotationCenter&&this.vRotationCenter===this._cachedVRotationCenter&&this.wRotationCenter===this._cachedWRotationCenter&&this.homogeneousRotationInUVTransform===this._cachedHomogeneousRotationInUVTransform)return this._cachedTextureMatrix;this._cachedUOffset=this.uOffset,this._cachedVOffset=this.vOffset,this._cachedUScale=this.uScale*e,this._cachedVScale=this.vScale,this._cachedUAng=this.uAng,this._cachedVAng=this.vAng,this._cachedWAng=this.wAng,this._cachedURotationCenter=this.uRotationCenter,this._cachedVRotationCenter=this.vRotationCenter,this._cachedWRotationCenter=this.wRotationCenter,this._cachedHomogeneousRotationInUVTransform=this.homogeneousRotationInUVTransform,this._cachedTextureMatrix&&this._rowGenerationMatrix||(this._cachedTextureMatrix=a.uq.Zero(),this._rowGenerationMatrix=new a.uq,this._t0=a.Pq.Zero(),this._t1=a.Pq.Zero(),this._t2=a.Pq.Zero()),a.uq.RotationYawPitchRollToRef(this.vAng,this.uAng,this.wAng,this._rowGenerationMatrix),this.homogeneousRotationInUVTransform?(a.uq.TranslationToRef(-this._cachedURotationCenter,-this._cachedVRotationCenter,-this._cachedWRotationCenter,a.AA.Matrix[0]),a.uq.TranslationToRef(this._cachedURotationCenter,this._cachedVRotationCenter,this._cachedWRotationCenter,a.AA.Matrix[1]),a.uq.ScalingToRef(this._cachedUScale,this._cachedVScale,0,a.AA.Matrix[2]),a.uq.TranslationToRef(this._cachedUOffset,this._cachedVOffset,0,a.AA.Matrix[3]),a.AA.Matrix[0].multiplyToRef(this._rowGenerationMatrix,this._cachedTextureMatrix),this._cachedTextureMatrix.multiplyToRef(a.AA.Matrix[1],this._cachedTextureMatrix),this._cachedTextureMatrix.multiplyToRef(a.AA.Matrix[2],this._cachedTextureMatrix),this._cachedTextureMatrix.multiplyToRef(a.AA.Matrix[3],this._cachedTextureMatrix),this._cachedTextureMatrix.setRowFromFloats(2,this._cachedTextureMatrix.m[12],this._cachedTextureMatrix.m[13],this._cachedTextureMatrix.m[14],1)):(this._prepareRowForTextureGeneration(0,0,0,this._t0),this._prepareRowForTextureGeneration(1,0,0,this._t1),this._prepareRowForTextureGeneration(0,1,0,this._t2),this._t1.subtractInPlace(this._t0),this._t2.subtractInPlace(this._t0),a.uq.FromValuesToRef(this._t1.x,this._t1.y,this._t1.z,0,this._t2.x,this._t2.y,this._t2.z,0,this._t0.x,this._t0.y,this._t0.z,0,0,0,0,1,this._cachedTextureMatrix));var n=this.getScene();if(!n)return this._cachedTextureMatrix;var r=this._cachedIdentity3x2;return this._cachedIdentity3x2=this._cachedTextureMatrix.isIdentityAs3x2(),this.optimizeUVAllocation&&r!==this._cachedIdentity3x2&&n.markAllMaterialsAsDirty(l.Y.MATERIAL_TextureDirtyFlag,(function(e){return e.hasTexture(t)})),this._cachedTextureMatrix},t.prototype.getReflectionTextureMatrix=function(){var e=this,n=this.getScene();if(!n)return this._cachedReflectionTextureMatrix;if(this.uOffset===this._cachedReflectionUOffset&&this.vOffset===this._cachedReflectionVOffset&&this.uScale===this._cachedReflectionUScale&&this.vScale===this._cachedReflectionVScale&&this.coordinatesMode===this._cachedReflectionCoordinatesMode){if(this.coordinatesMode!==t.PROJECTION_MODE)return this._cachedReflectionTextureMatrix;if(this._cachedReflectionProjectionMatrixId===n.getProjectionMatrix().updateFlag)return this._cachedReflectionTextureMatrix}this._cachedReflectionTextureMatrix||(this._cachedReflectionTextureMatrix=a.uq.Zero()),this._projectionModeMatrix||(this._projectionModeMatrix=a.uq.Zero());var r=this._cachedReflectionCoordinatesMode!==this.coordinatesMode;switch(this._cachedReflectionUOffset=this.uOffset,this._cachedReflectionVOffset=this.vOffset,this._cachedReflectionUScale=this.uScale,this._cachedReflectionVScale=this.vScale,this._cachedReflectionCoordinatesMode=this.coordinatesMode,this.coordinatesMode){case t.PLANAR_MODE:a.uq.IdentityToRef(this._cachedReflectionTextureMatrix),this._cachedReflectionTextureMatrix[0]=this.uScale,this._cachedReflectionTextureMatrix[5]=this.vScale,this._cachedReflectionTextureMatrix[12]=this.uOffset,this._cachedReflectionTextureMatrix[13]=this.vOffset;break;case t.PROJECTION_MODE:a.uq.FromValuesToRef(.5,0,0,0,0,-.5,0,0,0,0,0,0,.5,.5,1,1,this._projectionModeMatrix);var i=n.getProjectionMatrix();this._cachedReflectionProjectionMatrixId=i.updateFlag,i.multiplyToRef(this._projectionModeMatrix,this._cachedReflectionTextureMatrix);break;default:a.uq.IdentityToRef(this._cachedReflectionTextureMatrix)}return r&&n.markAllMaterialsAsDirty(l.Y.MATERIAL_TextureDirtyFlag,(function(t){return t.hasTexture(e)})),this._cachedReflectionTextureMatrix},t.prototype.clone=function(){var e=this,n={noMipmap:this._noMipmap,invertY:this._invertY,samplingMode:this.samplingMode,onLoad:void 0,onError:void 0,buffer:this._texture?this._texture._buffer:void 0,deleteBuffer:this._deleteBuffer,format:this.textureFormat,mimeType:this.mimeType,loaderOptions:this._loaderOptions,creationFlags:this._creationFlags,useSRGBBuffer:this._useSRGBBuffer};return g.p.Clone((function(){return new t(e._texture?e._texture.url:null,e.getScene(),n)}),this)},t.prototype.serialize=function(){var n,r,i=this.name;t.SerializeBuffers||this.name.startsWith("data:")&&(this.name=""),this.name.startsWith("data:")&&this.url===this.name&&(this.url="");var o=e.prototype.serialize.call(this,t._SerializeInternalTextureUniqueId);if(!o)return null;if(t.SerializeBuffers||t.ForceSerializeBuffers)if("string"==typeof this._buffer&&this._buffer.startsWith("data:"))o.base64String=this._buffer,o.name=o.name.replace("data:","");else if(this.url&&this.url.startsWith("data:")&&this._buffer instanceof Uint8Array){var a=this.mimeType||"image/png";o.base64String="data:".concat(a,";base64,").concat((0,f.EL)(this._buffer))}else(t.ForceSerializeBuffers||this.url&&this.url.startsWith("blob:")||this._forceSerialize)&&(o.base64String=!this._engine||this._engine._features.supportSyncTextureRead?(0,m.lP)(this):(0,m.nh)(this));return o.invertY=this._invertY,o.samplingMode=this.samplingMode,o._creationFlags=this._creationFlags,o._useSRGBBuffer=this._useSRGBBuffer,t._SerializeInternalTextureUniqueId&&(o.internalTextureUniqueId=null===(n=this._texture)||void 0===n?void 0:n.uniqueId),o.internalTextureLabel=null===(r=this._texture)||void 0===r?void 0:r.label,o.noMipmap=this._noMipmap,this.name=i,o},t.prototype.getClassName=function(){return"Texture"},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.onLoadObservable.clear(),this._delayedOnLoad=null,this._delayedOnError=null,this._buffer=null},t.Parse=function(e,n,r){if(e.customType){var i=d.n.Instantiate(e.customType).Parse(e,n,r);return e.samplingMode&&i.updateSamplingMode&&i._samplingMode&&i._samplingMode!==e.samplingMode&&i.updateSamplingMode(e.samplingMode),i}if(e.isCube&&!e.isRenderTarget)return t._CubeTextureParser(e,n,r);var o,a=void 0!==e.internalTextureUniqueId;if(!e.name&&!e.isRenderTarget&&!a)return null;if(a)for(var s=0,l=n.getEngine().getLoadedTexturesCache();s0||e.name.startsWith("data:"))?e.name:r+e.name,e.url&&(e.url.startsWith("data:")||t.UseSerializedUrlIfAny)&&(g=e.url);var v={noMipmap:!c,invertY:e.invertY,samplingMode:e.samplingMode,onLoad:function(){h(l)},internalTexture:o};l=new t(g,n,v)}return l}),e,n);return f},t.CreateFromBase64String=function(e,n,r,i,o,a,s,c,u,h,d){return void 0===a&&(a=t.TRILINEAR_SAMPLINGMODE),void 0===s&&(s=null),void 0===c&&(c=null),void 0===u&&(u=l.Y.TEXTUREFORMAT_RGBA),new t("data:"+n,r,i,o,a,s,c,e,!1,u,void 0,void 0,h,d)},t.LoadFromDataString=function(e,n,r,i,o,a,s,c,u,h,d,p){return void 0===i&&(i=!1),void 0===a&&(a=!0),void 0===s&&(s=t.TRILINEAR_SAMPLINGMODE),void 0===c&&(c=null),void 0===u&&(u=null),void 0===h&&(h=l.Y.TEXTUREFORMAT_RGBA),"data:"!==e.substring(0,5)&&(e="data:"+e),new t(e,r,o,a,s,c,u,n,i,h,void 0,void 0,d,p)},t.SerializeBuffers=!0,t.ForceSerializeBuffers=!1,t.OnTextureLoadErrorObservable=new o.cP,t._SerializeInternalTextureUniqueId=!1,t._CubeTextureParser=function(e,t,n){throw(0,u.n)("CubeTexture")},t._CreateMirror=function(e,t,n,r){throw(0,u.n)("MirrorTexture")},t._CreateRenderTargetTexture=function(e,t,n,r,i){throw(0,u.n)("RenderTargetTexture")},t.NEAREST_SAMPLINGMODE=l.Y.TEXTURE_NEAREST_SAMPLINGMODE,t.NEAREST_NEAREST_MIPLINEAR=l.Y.TEXTURE_NEAREST_NEAREST_MIPLINEAR,t.BILINEAR_SAMPLINGMODE=l.Y.TEXTURE_BILINEAR_SAMPLINGMODE,t.LINEAR_LINEAR_MIPNEAREST=l.Y.TEXTURE_LINEAR_LINEAR_MIPNEAREST,t.TRILINEAR_SAMPLINGMODE=l.Y.TEXTURE_TRILINEAR_SAMPLINGMODE,t.LINEAR_LINEAR_MIPLINEAR=l.Y.TEXTURE_LINEAR_LINEAR_MIPLINEAR,t.NEAREST_NEAREST_MIPNEAREST=l.Y.TEXTURE_NEAREST_NEAREST_MIPNEAREST,t.NEAREST_LINEAR_MIPNEAREST=l.Y.TEXTURE_NEAREST_LINEAR_MIPNEAREST,t.NEAREST_LINEAR_MIPLINEAR=l.Y.TEXTURE_NEAREST_LINEAR_MIPLINEAR,t.NEAREST_LINEAR=l.Y.TEXTURE_NEAREST_LINEAR,t.NEAREST_NEAREST=l.Y.TEXTURE_NEAREST_NEAREST,t.LINEAR_NEAREST_MIPNEAREST=l.Y.TEXTURE_LINEAR_NEAREST_MIPNEAREST,t.LINEAR_NEAREST_MIPLINEAR=l.Y.TEXTURE_LINEAR_NEAREST_MIPLINEAR,t.LINEAR_LINEAR=l.Y.TEXTURE_LINEAR_LINEAR,t.LINEAR_NEAREST=l.Y.TEXTURE_LINEAR_NEAREST,t.EXPLICIT_MODE=l.Y.TEXTURE_EXPLICIT_MODE,t.SPHERICAL_MODE=l.Y.TEXTURE_SPHERICAL_MODE,t.PLANAR_MODE=l.Y.TEXTURE_PLANAR_MODE,t.CUBIC_MODE=l.Y.TEXTURE_CUBIC_MODE,t.PROJECTION_MODE=l.Y.TEXTURE_PROJECTION_MODE,t.SKYBOX_MODE=l.Y.TEXTURE_SKYBOX_MODE,t.INVCUBIC_MODE=l.Y.TEXTURE_INVCUBIC_MODE,t.EQUIRECTANGULAR_MODE=l.Y.TEXTURE_EQUIRECTANGULAR_MODE,t.FIXED_EQUIRECTANGULAR_MODE=l.Y.TEXTURE_FIXED_EQUIRECTANGULAR_MODE,t.FIXED_EQUIRECTANGULAR_MIRRORED_MODE=l.Y.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE,t.CLAMP_ADDRESSMODE=l.Y.TEXTURE_CLAMP_ADDRESSMODE,t.WRAP_ADDRESSMODE=l.Y.TEXTURE_WRAP_ADDRESSMODE,t.MIRROR_ADDRESSMODE=l.Y.TEXTURE_MIRROR_ADDRESSMODE,t.UseSerializedUrlIfAny=!1,(0,r.Cg)([(0,i.lK)()],t.prototype,"url",void 0),(0,r.Cg)([(0,i.lK)()],t.prototype,"uOffset",void 0),(0,r.Cg)([(0,i.lK)()],t.prototype,"vOffset",void 0),(0,r.Cg)([(0,i.lK)()],t.prototype,"uScale",void 0),(0,r.Cg)([(0,i.lK)()],t.prototype,"vScale",void 0),(0,r.Cg)([(0,i.lK)()],t.prototype,"uAng",void 0),(0,r.Cg)([(0,i.lK)()],t.prototype,"vAng",void 0),(0,r.Cg)([(0,i.lK)()],t.prototype,"wAng",void 0),(0,r.Cg)([(0,i.lK)()],t.prototype,"uRotationCenter",void 0),(0,r.Cg)([(0,i.lK)()],t.prototype,"vRotationCenter",void 0),(0,r.Cg)([(0,i.lK)()],t.prototype,"wRotationCenter",void 0),(0,r.Cg)([(0,i.lK)()],t.prototype,"homogeneousRotationInUVTransform",void 0),(0,r.Cg)([(0,i.lK)()],t.prototype,"isBlocking",null),t}(s.t);(0,c.Y5)("BABYLON.Texture",v),g.p._TextureParser=v.Parse},50615:(e,t,n)=>{var r=n(98519),i="vertexColorMixing";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvertexOutputs.vColor=vec4f(1.0);\n#ifdef VERTEXCOLOR\n#ifdef VERTEXALPHA\nvertexOutputs.vColor*=vertexInputs.color;\n#else\nvertexOutputs.vColor=vec4f(vertexOutputs.vColor.rgb*vertexInputs.color.rgb,vertexOutputs.vColor.a);\n#endif\n#endif\n#ifdef INSTANCESCOLOR\nvertexOutputs.vColor*=vertexInputs.instanceColor;\n#endif\n#endif\n")},50712:(e,t,n)=>{var r;n.d(t,{b:()=>r,s:()=>i}),function(e){e[e.PointerMove=0]="PointerMove",e[e.PointerDown=1]="PointerDown",e[e.PointerUp=2]="PointerUp"}(r||(r={}));var i=function(){function e(){}return e.DOM_DELTA_PIXEL=0,e.DOM_DELTA_LINE=1,e.DOM_DELTA_PAGE=2,e}()},50851:(e,t,n)=>{var r=n(98519),i="sceneUboDeclaration";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="layout(std140,column_major) uniform;uniform Scene {mat4 viewProjection;\n#ifdef MULTIVIEW\nmat4 viewProjectionR;\n#endif \nmat4 view;mat4 projection;vec4 vEyePosition;};\n")},50919:(e,t,n)=>{n.d(t,{FG:()=>s,Kq:()=>b,ZR:()=>f,tb:()=>y});var r=n(45109),i=n(25598),o=32768,a=65535;function s(e,t){for(var n=0,r=0;r>3]&1<<(7&r))&&(t[n++]=r);for(var o=n-1;n>(n-=e)&(1<>(r-=8);if(h=new Uint8Array([h])[0],s.value+h>l)return null;for(var d=a[s.value-1];h-- >0;)a[s.value++]=d}else{if(!(s.value>6}function f(e,t,n,o,a,s){var f=n.value,m=(0,r.PX)(t,n),_=(0,r.PX)(t,n);n.value+=4;var g=(0,r.PX)(t,n);if(n.value+=4,m<0||m>=i.U0||_<0||_>=i.U0)throw new Error("Wrong HUF_ENCSIZE");var v=new Array(i.U0),y=new Array(i.A_);if(function(e){for(var t=0;tn)return;var d=l(6,c,u,e,s),p=d.l;if(c=d.c,u=d.lc,a[r]=p,p==i.Hh){if(s.value-t.value>n)throw new Error("Error in HufUnpackEncTable");var f=(d=l(8,c,u,e,s)).l+i.gn;if(c=d.c,u=d.lc,r+f>o+1)throw new Error("Error in HufUnpackEncTable");for(;f--;)a[r++]=0;r--}else if(p>=i.LU){if(r+(f=p-i.LU+2)>o+1)throw new Error("Error in HufUnpackEncTable");for(;f--;)a[r++]=0;r--}}!function(e){for(var t=0;t<=58;++t)h[t]=0;for(t=0;t0;--t){var r=n+h[t]>>1;h[t]=n,n=r}for(t=0;t0&&(e[t]=o|h[o]++<<6)}}(a)}(e,n,o-(n.value-f),m,_,v),g>8*(o-(n.value-f)))throw new Error("Wrong hufUncompress");!function(e,t,n,r){for(;t<=n;t++){var o=p(e[t]),a=d(e[t]);if(o>>a)throw new Error("Invalid table entry");if(a>i.LK){if((u=r[o>>a-i.LK]).len)throw new Error("Invalid table entry");if(u.lit++,u.p){var s=u.p;u.p=new Array(u.lit);for(var l=0;l0;l--){var u;if((u=r[(o<=i.LK;)if((T=t[f>>m-i.LK&i.lR]).len)m-=T.len,(E=u(T.lit,a,f,m,n,r,l,h,_))&&(f=E.c,m=E.lc);else{if(!T.p)throw new Error("hufDecode issues");var y=void 0;for(y=0;y=b&&p(e[T.p[y]])==(f>>m-b&(1<>=S,m-=S;m>0;){var T,E;if(!(T=t[f<32767?t-65536:t}function g(e,t){var n=_(e),r=_(t),i=n+(1&r)+(r>>1);return{a:i,b:i-r}}function v(e,t){var n=m(e),r=m(t),i=n-(r>>1)&a;return{a:r+i-o&a,b:i}}function y(e,t,n,r,i,o,a){for(var s,l,c=a<16384,u=n>i?i:n,h=1;h<=u;)h<<=1;for(s=h>>=1,h>>=1;h>=1;){for(var d=(l=0)+o*(i-s),p=o*h,f=o*s,m=r*h,_=r*s,y=void 0,b=void 0,S=void 0,T=void 0;l<=d;l+=f){for(var E=l,x=l+r*(n-s);E<=x;E+=_){var P=E+m,C=(R=E+p)+m;c?(y=(A=g(e[E+t],e[R+t])).a,S=A.b,b=(A=g(e[P+t],e[C+t])).a,T=A.b,A=g(y,b),e[E+t]=A.a,e[P+t]=A.b,A=g(S,T),e[R+t]=A.a,e[C+t]=A.b):(y=(A=v(e[E+t],e[R+t])).a,S=A.b,b=(A=v(e[P+t],e[C+t])).a,T=A.b,A=v(y,b),e[E+t]=A.a,e[P+t]=A.b,A=v(S,T),e[R+t]=A.a,e[C+t]=A.b)}if(n&h){var R=E+p,A=void 0;y=(A=c?g(e[E+t],e[R+t]):v(e[E+t],e[R+t])).a,e[R+t]=A.b,e[E+t]=y}}if(i&h)for(E=l,x=l+r*(n-s);E<=x;E+=_)P=E+m,A=void 0,y=(A=c?g(e[E+t],e[P+t]):v(e[E+t],e[P+t])).a,e[P+t]=A.b,e[E+t]=y;s=h,h>>=1}return l}function b(e,t,n){for(var r=0;r{n.r(t),n.d(t,{lensFlareVertexShader:()=>a});var r=n(98519),i="lensFlareVertexShader",o="attribute vec2 position;uniform mat4 viewportMatrix;varying vec2 vUV;const vec2 madd=vec2(0.5,0.5);\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvUV=position*madd+madd;gl_Position=viewportMatrix*vec4(position,0.0,1.0);\n#define CUSTOM_VERTEX_MAIN_END\n}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},51093:(e,t,n)=>{n.r(t),n.d(t,{lensFlareVertexShaderWGSL:()=>a});var r=n(98519),i="lensFlareVertexShader",o="attribute position: vec2f;uniform viewportMatrix: mat4x4f;varying vUV: vec2f;const madd: vec2f= vec2f(0.5,0.5);\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvertexOutputs.vUV=input.position*madd+madd;vertexOutputs.position=uniforms.viewportMatrix* vec4f(input.position,0.0,1.0);\n#define CUSTOM_VERTEX_MAIN_END\n}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},51162:(e,t,n)=>{n.d(t,{w:()=>i});var r=n(85258),i=function(){function e(e,t,n){var i=this;if(this._autoUpdate=!0,this._lastUpdateTime=0,this.minUpdateTime=0,t){this.minUpdateTime=n;var o=function(){if(i._autoUpdate){var t=!1;if(0{function r(e){for(var t=e.byteLength,n=[],r=0,i=new DataView(e);t>0;){var o=i.getInt8(r++);if(o<0){t-=1+(s=-o);for(var a=0;ar})},51319:(e,t,n)=>{n.r(t),n.d(t,{geometryPixelShaderWGSL:()=>a});var r=n(98519),i=(n(20502),n(96830),n(66633),n(17393),n(30032),n(20274),"geometryPixelShader"),o="#ifdef BUMP\nvarying vWorldView0: vec4f;varying vWorldView1: vec4f;varying vWorldView2: vec4f;varying vWorldView3: vec4f;varying vNormalW: vec3f;\n#else\nvarying vNormalV: vec3f;\n#endif\nvarying vViewPos: vec4f;\n#if defined(POSITION) || defined(BUMP)\nvarying vPositionW: vec3f;\n#endif\n#if defined(VELOCITY) || defined(VELOCITY_LINEAR)\nvarying vCurrentPosition: vec4f;varying vPreviousPosition: vec4f;\n#endif\n#ifdef NEED_UV\nvarying vUV: vec2f;\n#endif\n#ifdef BUMP\nuniform vBumpInfos: vec3f;uniform vTangentSpaceParams: vec2f;\n#endif\n#if defined(REFLECTIVITY)\n#if defined(ORMTEXTURE) || defined(SPECULARGLOSSINESSTEXTURE) || defined(REFLECTIVITYTEXTURE)\nvar reflectivitySamplerSampler: sampler;var reflectivitySampler: texture_2d;varying vReflectivityUV: vec2f;\n#else\n#ifdef METALLIC_TEXTURE\nvar metallicSamplerSampler: sampler;var metallicSampler: texture_2d;varying vMetallicUV: vec2f;\n#endif\n#ifdef ROUGHNESS_TEXTURE\nvar roughnessSamplerSampler: sampler;var roughnessSampler: texture_2d;varying vRoughnessUV: vec2f;\n#endif\n#endif\n#ifdef ALBEDOTEXTURE\nvarying vAlbedoUV: vec2f;var albedoSamplerSampler: sampler;var albedoSampler: texture_2d;\n#endif\n#ifdef REFLECTIVITYCOLOR\nuniform reflectivityColor: vec3f;\n#endif\n#ifdef ALBEDOCOLOR\nuniform albedoColor: vec3f;\n#endif\n#ifdef METALLIC\nuniform metallic: f32;\n#endif\n#if defined(ROUGHNESS) || defined(GLOSSINESS)\nuniform glossiness: f32;\n#endif\n#endif\n#if defined(ALPHATEST) && defined(NEED_UV)\nvar diffuseSamplerSampler: sampler;var diffuseSampler: texture_2d;\n#endif\n#include\n#include\n#include\n#include\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#include\n#ifdef ALPHATEST\nif (textureSample(diffuseSampler,diffuseSamplerSampler,input.vUV).a<0.4) {discard;}\n#endif\nvar normalOutput: vec3f;\n#ifdef BUMP\nvar normalW: vec3f=normalize(input.vNormalW);\n#include\n#ifdef NORMAL_WORLDSPACE\nnormalOutput=normalW;\n#else\nnormalOutput=normalize( (mat4x4f(input.vWorldView0,input.vWorldView1,input.vWorldView2,input.vWorldView3)* vec4f(normalW,0.0)).xyz);\n#endif\n#elif defined(HAS_NORMAL_ATTRIBUTE)\nnormalOutput=normalize(input.vNormalV);\n#elif defined(POSITION)\nnormalOutput=normalize(-cross(dpdx(input.vPositionW),dpdy(input.vPositionW)));\n#endif\n#ifdef ENCODE_NORMAL\nnormalOutput=normalOutput*0.5+0.5;\n#endif\nvar fragData: array,SCENE_MRT_COUNT>;\n#ifdef DEPTH\nfragData[DEPTH_INDEX]=vec4f(input.vViewPos.z/input.vViewPos.w,0.0,0.0,1.0);\n#endif\n#ifdef NORMAL\nfragData[NORMAL_INDEX]=vec4f(normalOutput,1.0);\n#endif\n#ifdef SCREENSPACE_DEPTH\nfragData[SCREENSPACE_DEPTH_INDEX]=vec4f(fragmentInputs.position.z,0.0,0.0,1.0);\n#endif\n#ifdef POSITION\nfragData[POSITION_INDEX]= vec4f(input.vPositionW,1.0);\n#endif\n#ifdef VELOCITY\nvar a: vec2f=(input.vCurrentPosition.xy/input.vCurrentPosition.w)*0.5+0.5;var b: vec2f=(input.vPreviousPosition.xy/input.vPreviousPosition.w)*0.5+0.5;var velocity: vec2f=abs(a-b);velocity= vec2f(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;fragData[VELOCITY_INDEX]= vec4f(velocity,0.0,1.0);\n#endif\n#ifdef VELOCITY_LINEAR\nvar velocity : vec2f=vec2f(0.5)*((input.vPreviousPosition.xy /\ninput.vPreviousPosition.w) -\n(input.vCurrentPosition.xy /\ninput.vCurrentPosition.w));fragData[VELOCITY_LINEAR_INDEX]=vec4f(velocity,0.0,1.0);\n#endif\n#ifdef REFLECTIVITY\nvar reflectivity: vec4f= vec4f(0.0,0.0,0.0,1.0);\n#ifdef METALLICWORKFLOW\nvar metal: f32=1.0;var roughness: f32=1.0;\n#ifdef ORMTEXTURE\nmetal*=textureSample(reflectivitySampler,reflectivitySamplerSampler,input.vReflectivityUV).b;roughness*=textureSample(reflectivitySampler,reflectivitySamplerSampler,input.vReflectivityUV).g;\n#else\n#ifdef METALLIC_TEXTURE\nmetal*=textureSample(metallicSampler,metallicSamplerSampler,input.vMetallicUV).r;\n#endif\n#ifdef ROUGHNESS_TEXTURE\nroughness*=textureSample(roughnessSampler,roughnessSamplerSampler,input.vRoughnessUV).r;\n#endif\n#endif\n#ifdef METALLIC\nmetal*=uniforms.metallic;\n#endif\n#ifdef ROUGHNESS\nroughness*=(1.0-uniforms.glossiness); \n#endif\nreflectivity=vec4f(reflectivity.rgb,reflectivity.a-roughness);var color: vec3f= vec3f(1.0);\n#ifdef ALBEDOTEXTURE\ncolor=textureSample(albedoSampler,albedoSamplerSampler,input.vAlbedoUV).rgb;\n#ifdef GAMMAALBEDO\ncolor=toLinearSpaceVec4(color);\n#endif\n#endif\n#ifdef ALBEDOCOLOR\ncolor*=uniforms.albedoColor.xyz;\n#endif\nreflectivity=vec4f(mix( vec3f(0.04),color,metal),reflectivity.a);\n#else\n#if defined(SPECULARGLOSSINESSTEXTURE) || defined(REFLECTIVITYTEXTURE)\nreflectivity=textureSample(reflectivitySampler,reflectivitySamplerSampler,input.vReflectivityUV);\n#ifdef GAMMAREFLECTIVITYTEXTURE\nreflectivity=vec4f(toLinearSpaceVec3(reflectivity.rgb),reflectivity.a);\n#endif\n#else \n#ifdef REFLECTIVITYCOLOR\nreflectivity=vec4f(toLinearSpaceVec3(uniforms.reflectivityColor.xyz),1.0);\n#endif\n#endif\n#ifdef GLOSSINESSS\nreflectivity=vec4f(reflectivity.rgb,reflectivity.a*glossiness); \n#endif\n#endif\nfragData[REFLECTIVITY_INDEX]=reflectivity;\n#endif\n#if SCENE_MRT_COUNT>0\nfragmentOutputs.fragData0=fragData[0];\n#endif\n#if SCENE_MRT_COUNT>1\nfragmentOutputs.fragData1=fragData[1];\n#endif\n#if SCENE_MRT_COUNT>2\nfragmentOutputs.fragData2=fragData[2];\n#endif\n#if SCENE_MRT_COUNT>3\nfragmentOutputs.fragData3=fragData[3];\n#endif\n#if SCENE_MRT_COUNT>4\nfragmentOutputs.fragData4=fragData[4];\n#endif\n#if SCENE_MRT_COUNT>5\nfragmentOutputs.fragData5=fragData[5];\n#endif\n#if SCENE_MRT_COUNT>6\nfragmentOutputs.fragData6=fragData[6];\n#endif\n#if SCENE_MRT_COUNT>7\nfragmentOutputs.fragData7=fragData[7];\n#endif\n}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},51322:(e,t,n)=>{n.d(t,{uM:()=>s.uM,Xy:()=>s.Xy,_0:()=>r._0,vr:()=>s.vr,v9:()=>i.v9,ov:()=>i.ov,xp:()=>r.xp,jj:()=>s.jj,bH:()=>o.bH,PP:()=>a.P,uq:()=>u.uq,t4:()=>s.t4,a6:()=>o.a6,Cu:()=>s.Cu,tO:()=>s.tO,Zc:()=>l.Z,k0:()=>d,B5:()=>h,PT:()=>u.PT,or:()=>c.o,$x:()=>r.$x,IG:()=>i.IG,AA:()=>u.AA,rv:()=>o.rv,tk:()=>o.tk,I9:()=>u.I9,Pq:()=>u.Pq,IU:()=>u.IU,LM:()=>p.L});var r=n(13424),i=n(64726),o=n(56740),a=n(36359),s=n(95318),l=n(43939),c=n(73152),u=n(8046),h=function(){function e(e,t){void 0===e&&(e=u.Pq.Zero()),void 0===t&&(t=u.Pq.Up()),this.position=e,this.normal=t}return e.prototype.clone=function(){return new e(this.position.clone(),this.normal.clone())},e}(),d=function(){function e(e,t,n){void 0===e&&(e=u.Pq.Zero()),void 0===t&&(t=u.Pq.Up()),void 0===n&&(n=u.I9.Zero()),this.position=e,this.normal=t,this.uv=n}return e.prototype.clone=function(){return new e(this.position.clone(),this.normal.clone(),this.uv.clone())},e}(),p=n(25187)},51428:(e,t,n)=>{n.d(t,{O:()=>c,Q:()=>u});var r=n(8046),i=n(51322),o=[Math.sqrt(1/(4*Math.PI)),-Math.sqrt(3/(4*Math.PI)),Math.sqrt(3/(4*Math.PI)),-Math.sqrt(3/(4*Math.PI)),Math.sqrt(15/(4*Math.PI)),-Math.sqrt(15/(4*Math.PI)),Math.sqrt(5/(16*Math.PI)),-Math.sqrt(15/(4*Math.PI)),Math.sqrt(15/(16*Math.PI))],a=[function(){return 1},function(e){return e.y},function(e){return e.z},function(e){return e.x},function(e){return e.x*e.y},function(e){return e.y*e.z},function(e){return 3*e.z*e.z-1},function(e){return e.x*e.z},function(e){return e.x*e.x-e.y*e.y}],s=function(e,t){return o[e]*a[e](t)},l=[Math.PI,2*Math.PI/3,2*Math.PI/3,2*Math.PI/3,Math.PI/4,Math.PI/4,Math.PI/4,Math.PI/4,Math.PI/4],c=function(){function e(){this.preScaled=!1,this.l00=r.Pq.Zero(),this.l1_1=r.Pq.Zero(),this.l10=r.Pq.Zero(),this.l11=r.Pq.Zero(),this.l2_2=r.Pq.Zero(),this.l2_1=r.Pq.Zero(),this.l20=r.Pq.Zero(),this.l21=r.Pq.Zero(),this.l22=r.Pq.Zero()}return e.prototype.addLight=function(e,t,n){i.AA.Vector3[0].set(t.r,t.g,t.b);var r=i.AA.Vector3[0],o=i.AA.Vector3[1];r.scaleToRef(n,o),o.scaleToRef(s(0,e),i.AA.Vector3[2]),this.l00.addInPlace(i.AA.Vector3[2]),o.scaleToRef(s(1,e),i.AA.Vector3[2]),this.l1_1.addInPlace(i.AA.Vector3[2]),o.scaleToRef(s(2,e),i.AA.Vector3[2]),this.l10.addInPlace(i.AA.Vector3[2]),o.scaleToRef(s(3,e),i.AA.Vector3[2]),this.l11.addInPlace(i.AA.Vector3[2]),o.scaleToRef(s(4,e),i.AA.Vector3[2]),this.l2_2.addInPlace(i.AA.Vector3[2]),o.scaleToRef(s(5,e),i.AA.Vector3[2]),this.l2_1.addInPlace(i.AA.Vector3[2]),o.scaleToRef(s(6,e),i.AA.Vector3[2]),this.l20.addInPlace(i.AA.Vector3[2]),o.scaleToRef(s(7,e),i.AA.Vector3[2]),this.l21.addInPlace(i.AA.Vector3[2]),o.scaleToRef(s(8,e),i.AA.Vector3[2]),this.l22.addInPlace(i.AA.Vector3[2])},e.prototype.scaleInPlace=function(e){this.l00.scaleInPlace(e),this.l1_1.scaleInPlace(e),this.l10.scaleInPlace(e),this.l11.scaleInPlace(e),this.l2_2.scaleInPlace(e),this.l2_1.scaleInPlace(e),this.l20.scaleInPlace(e),this.l21.scaleInPlace(e),this.l22.scaleInPlace(e)},e.prototype.convertIncidentRadianceToIrradiance=function(){this.l00.scaleInPlace(l[0]),this.l1_1.scaleInPlace(l[1]),this.l10.scaleInPlace(l[2]),this.l11.scaleInPlace(l[3]),this.l2_2.scaleInPlace(l[4]),this.l2_1.scaleInPlace(l[5]),this.l20.scaleInPlace(l[6]),this.l21.scaleInPlace(l[7]),this.l22.scaleInPlace(l[8])},e.prototype.convertIrradianceToLambertianRadiance=function(){this.scaleInPlace(1/Math.PI)},e.prototype.preScaleForRendering=function(){this.preScaled=!0,this.l00.scaleInPlace(o[0]),this.l1_1.scaleInPlace(o[1]),this.l10.scaleInPlace(o[2]),this.l11.scaleInPlace(o[3]),this.l2_2.scaleInPlace(o[4]),this.l2_1.scaleInPlace(o[5]),this.l20.scaleInPlace(o[6]),this.l21.scaleInPlace(o[7]),this.l22.scaleInPlace(o[8])},e.prototype.updateFromArray=function(e){return r.Pq.FromArrayToRef(e[0],0,this.l00),r.Pq.FromArrayToRef(e[1],0,this.l1_1),r.Pq.FromArrayToRef(e[2],0,this.l10),r.Pq.FromArrayToRef(e[3],0,this.l11),r.Pq.FromArrayToRef(e[4],0,this.l2_2),r.Pq.FromArrayToRef(e[5],0,this.l2_1),r.Pq.FromArrayToRef(e[6],0,this.l20),r.Pq.FromArrayToRef(e[7],0,this.l21),r.Pq.FromArrayToRef(e[8],0,this.l22),this},e.prototype.updateFromFloatsArray=function(e){return r.Pq.FromFloatsToRef(e[0],e[1],e[2],this.l00),r.Pq.FromFloatsToRef(e[3],e[4],e[5],this.l1_1),r.Pq.FromFloatsToRef(e[6],e[7],e[8],this.l10),r.Pq.FromFloatsToRef(e[9],e[10],e[11],this.l11),r.Pq.FromFloatsToRef(e[12],e[13],e[14],this.l2_2),r.Pq.FromFloatsToRef(e[15],e[16],e[17],this.l2_1),r.Pq.FromFloatsToRef(e[18],e[19],e[20],this.l20),r.Pq.FromFloatsToRef(e[21],e[22],e[23],this.l21),r.Pq.FromFloatsToRef(e[24],e[25],e[26],this.l22),this},e.FromArray=function(t){return(new e).updateFromArray(t)},e.FromPolynomial=function(t){var n=new e;return n.l00=t.xx.scale(.376127).add(t.yy.scale(.376127)).add(t.zz.scale(.376126)),n.l1_1=t.y.scale(.977204),n.l10=t.z.scale(.977204),n.l11=t.x.scale(.977204),n.l2_2=t.xy.scale(1.16538),n.l2_1=t.yz.scale(1.16538),n.l20=t.zz.scale(1.34567).subtract(t.xx.scale(.672834)).subtract(t.yy.scale(.672834)),n.l21=t.zx.scale(1.16538),n.l22=t.xx.scale(1.16538).subtract(t.yy.scale(1.16538)),n.l1_1.scaleInPlace(-1),n.l11.scaleInPlace(-1),n.l2_1.scaleInPlace(-1),n.l21.scaleInPlace(-1),n.scaleInPlace(Math.PI),n},e}(),u=function(){function e(){this.x=r.Pq.Zero(),this.y=r.Pq.Zero(),this.z=r.Pq.Zero(),this.xx=r.Pq.Zero(),this.yy=r.Pq.Zero(),this.zz=r.Pq.Zero(),this.xy=r.Pq.Zero(),this.yz=r.Pq.Zero(),this.zx=r.Pq.Zero()}return Object.defineProperty(e.prototype,"preScaledHarmonics",{get:function(){return this._harmonics||(this._harmonics=c.FromPolynomial(this)),this._harmonics.preScaled||this._harmonics.preScaleForRendering(),this._harmonics},enumerable:!1,configurable:!0}),e.prototype.addAmbient=function(e){i.AA.Vector3[0].copyFromFloats(e.r,e.g,e.b);var t=i.AA.Vector3[0];this.xx.addInPlace(t),this.yy.addInPlace(t),this.zz.addInPlace(t)},e.prototype.scaleInPlace=function(e){this.x.scaleInPlace(e),this.y.scaleInPlace(e),this.z.scaleInPlace(e),this.xx.scaleInPlace(e),this.yy.scaleInPlace(e),this.zz.scaleInPlace(e),this.yz.scaleInPlace(e),this.zx.scaleInPlace(e),this.xy.scaleInPlace(e)},e.prototype.updateFromHarmonics=function(e){return this._harmonics=e,this.x.copyFrom(e.l11),this.x.scaleInPlace(1.02333).scaleInPlace(-1),this.y.copyFrom(e.l1_1),this.y.scaleInPlace(1.02333).scaleInPlace(-1),this.z.copyFrom(e.l10),this.z.scaleInPlace(1.02333),this.xx.copyFrom(e.l00),i.AA.Vector3[0].copyFrom(e.l20).scaleInPlace(.247708),i.AA.Vector3[1].copyFrom(e.l22).scaleInPlace(.429043),this.xx.scaleInPlace(.886277).subtractInPlace(i.AA.Vector3[0]).addInPlace(i.AA.Vector3[1]),this.yy.copyFrom(e.l00),this.yy.scaleInPlace(.886277).subtractInPlace(i.AA.Vector3[0]).subtractInPlace(i.AA.Vector3[1]),this.zz.copyFrom(e.l00),i.AA.Vector3[0].copyFrom(e.l20).scaleInPlace(.495417),this.zz.scaleInPlace(.886277).addInPlace(i.AA.Vector3[0]),this.yz.copyFrom(e.l2_1),this.yz.scaleInPlace(.858086).scaleInPlace(-1),this.zx.copyFrom(e.l21),this.zx.scaleInPlace(.858086).scaleInPlace(-1),this.xy.copyFrom(e.l2_2),this.xy.scaleInPlace(.858086),this.scaleInPlace(1/Math.PI),this},e.FromHarmonics=function(t){return(new e).updateFromHarmonics(t)},e.FromArray=function(t){var n=new e;return r.Pq.FromArrayToRef(t[0],0,n.x),r.Pq.FromArrayToRef(t[1],0,n.y),r.Pq.FromArrayToRef(t[2],0,n.z),r.Pq.FromArrayToRef(t[3],0,n.xx),r.Pq.FromArrayToRef(t[4],0,n.yy),r.Pq.FromArrayToRef(t[5],0,n.zz),r.Pq.FromArrayToRef(t[6],0,n.yz),r.Pq.FromArrayToRef(t[7],0,n.zx),r.Pq.FromArrayToRef(t[8],0,n.xy),n},e}()},51578:(e,t,n)=>{var r=n(98519),i=(n(50851),n(56174),"defaultUboDeclaration");r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="layout(std140,column_major) uniform;uniform Material\n{vec4 diffuseLeftColor;vec4 diffuseRightColor;vec4 opacityParts;vec4 reflectionLeftColor;vec4 reflectionRightColor;vec4 refractionLeftColor;vec4 refractionRightColor;vec4 emissiveLeftColor;vec4 emissiveRightColor;vec2 vDiffuseInfos;vec2 vAmbientInfos;vec2 vOpacityInfos;vec2 vEmissiveInfos;vec2 vLightmapInfos;vec2 vSpecularInfos;vec3 vBumpInfos;mat4 diffuseMatrix;mat4 ambientMatrix;mat4 opacityMatrix;mat4 emissiveMatrix;mat4 lightmapMatrix;mat4 specularMatrix;mat4 bumpMatrix;vec2 vTangentSpaceParams;float pointSize;float alphaCutOff;mat4 refractionMatrix;vec4 vRefractionInfos;vec3 vRefractionPosition;vec3 vRefractionSize;vec4 vSpecularColor;vec3 vEmissiveColor;vec4 vDiffuseColor;vec3 vAmbientColor;vec4 cameraInfo;vec2 vReflectionInfos;mat4 reflectionMatrix;vec3 vReflectionPosition;vec3 vReflectionSize;\n#define ADDITIONAL_UBO_DECLARATION\n};\n#include\n#include\n")},51956:(e,t,n)=>{n.d(t,{ge:()=>i,p9:()=>o,rX:()=>r});var r=!1;function i(e){r=e}var o={get UseOpenGLOrientationForUV(){return r},set UseOpenGLOrientationForUV(e){r=e}}},51967:(e,t,n)=>{n.d(t,{I9:()=>u,LT:()=>l,NK:()=>a,VH:()=>s});var r=n(16814);function i(e,t,n,r,i,o){i>0?(i=function(e,t){return t>1023?1*Math.pow(2,1023)*Math.pow(2,t-1023):t<-1074?1*Math.pow(2,-1074)*Math.pow(2,t+1074):1*Math.pow(2,t)}(0,i-136),e[o+0]=t*i,e[o+1]=n*i,e[o+2]=r*i):(e[o+0]=0,e[o+1]=0,e[o+2]=0)}function o(e,t){for(var n="",r="",i=t;i32767)throw"HDR Bad header format, unsupported size";return{height:t,width:n,dataPosition:s+=r.length+1}}function s(e,t,n){void 0===n&&(n=!1);var i=new Uint8Array(e),o=a(i),s=l(i,o);return r.D.ConvertPanoramaToCubemap(s,o.width,o.height,t,n)}function l(e,t){return function(e,t){for(var n,r,o,a,s,l=t.height,u=t.width,h=t.dataPosition,d=0,p=0,f=0,m=new ArrayBuffer(4*u),_=new Uint8Array(m),g=new ArrayBuffer(t.width*t.height*4*3),v=new Float32Array(g);l>0;){if(n=e[h++],r=e[h++],o=e[h++],a=e[h++],2!=n||2!=r||128&o||t.width<8||t.width>32767)return c(e,t);if((o<<8|a)!=u)throw"HDR Bad header format, wrong scan line width";for(d=0,f=0;f<4;f++)for(p=(f+1)*u;d128){if(0==(s=n-128)||s>p-d)throw"HDR Bad Format, bad scanline data (run)";for(;s-- >0;)_[d++]=r}else{if(0==(s=n)||s>p-d)throw"HDR Bad Format, bad scanline data (non-run)";if(_[d++]=r,--s>0)for(var y=0;y0;){for(n=0;n{n.r(t),n.d(t,{fluidRenderingStandardBlurPixelShaderWGSL:()=>a});var r=n(98519),i="fluidRenderingStandardBlurPixelShader",o="var textureSamplerSampler: sampler;var textureSampler: texture_2d;uniform filterSize: i32;uniform blurDir: vec2f;varying vUV: vec2f;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var s: vec4f=textureSampleLevel(textureSampler,textureSamplerSampler,input.vUV,0.);if (s.r==0.) {fragmentOutputs.color=vec4f(0.,0.,0.,1.);return fragmentOutputs;}\nvar sigma: f32=f32(uniforms.filterSize)/3.0;var twoSigma2: f32=2.0*sigma*sigma;var sum: vec4f=vec4f(0.);var wsum: f32=0.;for (var x: i32=-uniforms.filterSize; x<=uniforms.filterSize; x++) {var coords: vec2f=vec2f(f32(x));var sampl: vec4f=textureSampleLevel(textureSampler,textureSamplerSampler,input.vUV+coords*uniforms.blurDir,0.);var w: f32=exp(-coords.x*coords.x/twoSigma2);sum+=sampl*w;wsum+=w;}\nsum/=wsum;fragmentOutputs.color=vec4f(sum.rgb,1.);}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},52226:(e,t,n)=>{var r=n(98519),i="pointCloudVertex";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n")},52275:(e,t,n)=>{n.r(t),n.d(t,{FlowGraphCombineMatrix2DBlock:()=>_,FlowGraphCombineMatrix3DBlock:()=>g,FlowGraphCombineMatrixBlock:()=>m,FlowGraphCombineVector2Block:()=>d,FlowGraphCombineVector3Block:()=>p,FlowGraphCombineVector4Block:()=>f,FlowGraphExtractMatrix2DBlock:()=>T,FlowGraphExtractMatrix3DBlock:()=>E,FlowGraphExtractMatrixBlock:()=>S,FlowGraphExtractVector2Block:()=>v,FlowGraphExtractVector3Block:()=>y,FlowGraphExtractVector4Block:()=>b});var r=n(78322),i=n(61930),o=n(88099),a=n(45749),s=n(8046),l=n(34623),c=n(96832),u=function(e){function t(t,n,r){for(var i=e.call(this,n,r)||this,a=0;a{n.d(t,{B:()=>o,v:()=>i});var r=n(78322),i=function(){function e(){}return e.NAME_EFFECTLAYER="EffectLayer",e.NAME_LAYER="Layer",e.NAME_LENSFLARESYSTEM="LensFlareSystem",e.NAME_BOUNDINGBOXRENDERER="BoundingBoxRenderer",e.NAME_PARTICLESYSTEM="ParticleSystem",e.NAME_GAMEPAD="Gamepad",e.NAME_SIMPLIFICATIONQUEUE="SimplificationQueue",e.NAME_GEOMETRYBUFFERRENDERER="GeometryBufferRenderer",e.NAME_PREPASSRENDERER="PrePassRenderer",e.NAME_DEPTHRENDERER="DepthRenderer",e.NAME_DEPTHPEELINGRENDERER="DepthPeelingRenderer",e.NAME_POSTPROCESSRENDERPIPELINEMANAGER="PostProcessRenderPipelineManager",e.NAME_SPRITE="Sprite",e.NAME_SUBSURFACE="SubSurface",e.NAME_OUTLINERENDERER="Outline",e.NAME_PROCEDURALTEXTURE="ProceduralTexture",e.NAME_SHADOWGENERATOR="ShadowGenerator",e.NAME_OCTREE="Octree",e.NAME_PHYSICSENGINE="PhysicsEngine",e.NAME_AUDIO="Audio",e.NAME_FLUIDRENDERER="FluidRenderer",e.NAME_IBLCDFGENERATOR="iblCDFGenerator",e.NAME_CLUSTEREDLIGHTING="ClusteredLighting",e.STEP_ISREADYFORMESH_EFFECTLAYER=0,e.STEP_BEFOREEVALUATEACTIVEMESH_BOUNDINGBOXRENDERER=0,e.STEP_EVALUATESUBMESH_BOUNDINGBOXRENDERER=0,e.STEP_PREACTIVEMESH_BOUNDINGBOXRENDERER=0,e.STEP_CAMERADRAWRENDERTARGET_EFFECTLAYER=1,e.STEP_BEFORECAMERADRAW_PREPASS=0,e.STEP_BEFORECAMERADRAW_EFFECTLAYER=1,e.STEP_BEFORECAMERADRAW_LAYER=2,e.STEP_BEFORERENDERTARGETDRAW_PREPASS=0,e.STEP_BEFORERENDERTARGETDRAW_LAYER=1,e.STEP_BEFORERENDERINGMESH_PREPASS=0,e.STEP_BEFORERENDERINGMESH_OUTLINE=1,e.STEP_AFTERRENDERINGMESH_PREPASS=0,e.STEP_AFTERRENDERINGMESH_OUTLINE=1,e.STEP_AFTERRENDERINGGROUPDRAW_EFFECTLAYER_DRAW=0,e.STEP_AFTERRENDERINGGROUPDRAW_BOUNDINGBOXRENDERER=1,e.STEP_BEFORECAMERAUPDATE_SIMPLIFICATIONQUEUE=0,e.STEP_BEFORECLEAR_PROCEDURALTEXTURE=0,e.STEP_BEFORECLEAR_PREPASS=1,e.STEP_BEFORERENDERTARGETCLEAR_PREPASS=0,e.STEP_AFTERRENDERTARGETDRAW_PREPASS=0,e.STEP_AFTERRENDERTARGETDRAW_LAYER=1,e.STEP_AFTERCAMERADRAW_PREPASS=0,e.STEP_AFTERCAMERADRAW_EFFECTLAYER=1,e.STEP_AFTERCAMERADRAW_LENSFLARESYSTEM=2,e.STEP_AFTERCAMERADRAW_EFFECTLAYER_DRAW=3,e.STEP_AFTERCAMERADRAW_LAYER=4,e.STEP_AFTERCAMERADRAW_FLUIDRENDERER=5,e.STEP_AFTERCAMERAPOSTPROCESS_LAYER=0,e.STEP_AFTERRENDERTARGETPOSTPROCESS_LAYER=0,e.STEP_AFTERRENDER_AUDIO=0,e.STEP_GATHERRENDERTARGETS_DEPTHRENDERER=0,e.STEP_GATHERRENDERTARGETS_GEOMETRYBUFFERRENDERER=1,e.STEP_GATHERRENDERTARGETS_SHADOWGENERATOR=2,e.STEP_GATHERRENDERTARGETS_POSTPROCESSRENDERPIPELINEMANAGER=3,e.STEP_GATHERACTIVECAMERARENDERTARGETS_DEPTHRENDERER=0,e.STEP_GATHERACTIVECAMERARENDERTARGETS_FLUIDRENDERER=1,e.STEP_GATHERACTIVECAMERARENDERTARGETS_CLUSTEREDLIGHTING=2,e.STEP_POINTERMOVE_SPRITE=0,e.STEP_POINTERDOWN_SPRITE=0,e.STEP_POINTERUP_SPRITE=0,e}(),o=function(e){function t(t){return e.apply(this,t)||this}return(0,r.C6)(t,e),t.Create=function(){return Object.create(t.prototype)},t.prototype.registerStep=function(e,t,n){var r=0;for(Number.MAX_VALUE;r{n.r(t),n.d(t,{iblGenerateVoxelMipPixelShaderWGSL:()=>a});var r=n(98519),i="iblGenerateVoxelMipPixelShader",o="varying vUV: vec2f;var srcMip: texture_3d;uniform layerNum: i32;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var Coords=vec3i(2)*vec3i(vec2i(fragmentInputs.position.xy),uniforms.layerNum);var tex =\n(u32(select(0u,1u,textureLoad(srcMip,Coords+vec3i(0,0,0),0).x>0.0f))\n<< 0u) |\n(u32(select(0u,1u,textureLoad(srcMip,Coords+vec3i(1,0,0),0).x>0.0f))\n<< 1u) |\n(u32(select(0u,1u,textureLoad(srcMip,Coords+vec3i(0,1,0),0).x>0.0f))\n<< 2u) |\n(u32(select(0u,1u,textureLoad(srcMip,Coords+vec3i(1,1,0),0).x>0.0f))\n<< 3u) |\n(u32(select(0u,1u,textureLoad(srcMip,Coords+vec3i(0,0,1),0).x>0.0f))\n<< 4u) |\n(u32(select(0u,1u,textureLoad(srcMip,Coords+vec3i(1,0,1),0).x>0.0f))\n<< 5u) |\n(u32(select(0u,1u,textureLoad(srcMip,Coords+vec3i(0,1,1),0).x>0.0f))\n<< 6u) |\n(u32(select(0u,1u,textureLoad(srcMip,Coords+vec3i(1,1,1),0).x>0.0f))\n<< 7u);fragmentOutputs.color=vec4f( f32(tex)/255.0f,0.0f,0.0f,1.0);}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},52714:(e,t,n)=>{n.d(t,{K:()=>r});var r=function(){function e(e,t,n){this.name=e,this.from=t,this.to=n}return e.prototype.clone=function(){return new e(this.name,this.from,this.to)},e}()},52767:(e,t,n)=>{n.r(t),n.d(t,{fogFragmentDeclaration:()=>a});var r=n(98519),i="fogFragmentDeclaration",o="#ifdef FOG\n#define FOGMODE_NONE 0.\n#define FOGMODE_EXP 1.\n#define FOGMODE_EXP2 2.\n#define FOGMODE_LINEAR 3.\n#define E 2.71828\nuniform vec4 vFogInfos;uniform vec3 vFogColor;varying vec3 vFogDistance;float CalcFogFactor()\n{float fogCoeff=1.0;float fogStart=vFogInfos.y;float fogEnd=vFogInfos.z;float fogDensity=vFogInfos.w;float fogDistance=length(vFogDistance);if (FOGMODE_LINEAR==vFogInfos.x)\n{fogCoeff=(fogEnd-fogDistance)/(fogEnd-fogStart);}\nelse if (FOGMODE_EXP==vFogInfos.x)\n{fogCoeff=1.0/pow(E,fogDistance*fogDensity);}\nelse if (FOGMODE_EXP2==vFogInfos.x)\n{fogCoeff=1.0/pow(E,fogDistance*fogDistance*fogDensity*fogDensity);}\nreturn clamp(fogCoeff,0.0,1.0);}\n#endif\n";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]=o);var a={name:i,shader:o}},52793:(e,t,n)=>{n.r(t),n.d(t,{FlowGraphGetAssetBlock:()=>u});var r=n(78322),i=n(10252),o=n(45749),a=n(88099),s=n(34623),l=n(40099),c=n(95803),u=function(e){function t(t){var n,r=e.call(this,t)||this;return r.config=t,r.type=r.registerDataInput("type",a.Vv,t.type),r.value=r.registerDataOutput("value",a.Vv),r.index=r.registerDataInput("index",a.Vv,new l.P((0,c.$w)(null!==(n=t.index)&&void 0!==n?n:-1))),r}return(0,r.C6)(t,e),t.prototype._updateOutputs=function(e){var t=this.type.getValue(e),n=this.index.getValue(e),r=(0,i.N)(e.assetsContext,t,(0,c.$w)(n),this.config.useIndexAsUniqueId);this.value.setValue(r,e)},t.prototype.getClassName=function(){return"FlowGraphGetAssetBlock"},t}(o.e);(0,s.Y5)("FlowGraphGetAssetBlock",u)},53365:(e,t,n)=>{n.r(t),n.d(t,{iblShadowVoxelTracingPixelShader:()=>a});var r=n(98519),i="iblShadowVoxelTracingPixelShader",o="precision highp sampler2D;precision highp sampler3D;\n#define PI 3.1415927\nvarying vec2 vUV;\n#define DISABLE_UNIFORMITY_ANALYSIS\nuniform sampler2D depthSampler;uniform sampler2D worldNormalSampler;uniform sampler2D blueNoiseSampler;uniform sampler2D icdfSampler;uniform sampler3D voxelGridSampler;\n#ifdef COLOR_SHADOWS\nuniform samplerCube iblSampler;\n#endif\nuniform vec4 shadowParameters;\n#define SHADOWdirs shadowParameters.x\n#define SHADOWframe shadowParameters.y\n#define SHADOWenvRot shadowParameters.w\nuniform vec4 voxelBiasParameters;\n#define highestMipLevel voxelBiasParameters.z\nuniform vec4 sssParameters;\n#define SSSsamples sssParameters.x\n#define SSSstride sssParameters.y\n#define SSSmaxDistance sssParameters.z\n#define SSSthickness sssParameters.w\nuniform vec4 shadowOpacity;uniform mat4 projMtx;uniform mat4 viewMtx;uniform mat4 invProjMtx;uniform mat4 invViewMtx;uniform mat4 wsNormalizationMtx;uniform mat4 invVPMtx;\n#define PI 3.1415927\n#define GOLD 0.618034\nstruct AABB3f {vec3 m_min;vec3 m_max;};struct Ray {vec3 orig;vec3 dir;vec3 dir_rcp;float t_min;float t_max;};Ray make_ray(const vec3 origin,const vec3 direction,const float tmin,\nconst float tmax) {Ray ray;ray.orig=origin;ray.dir=direction;ray.dir_rcp=1.0f/direction;ray.t_min=tmin;ray.t_max=tmax;return ray;}\nbool ray_box_intersection(const in AABB3f aabb,const in Ray ray,\nout float distance_near,out float distance_far) {vec3 tbot=ray.dir_rcp*(aabb.m_min-ray.orig);vec3 ttop=ray.dir_rcp*(aabb.m_max-ray.orig);vec3 tmin=min(ttop,tbot);vec3 tmax=max(ttop,tbot);distance_near=max(ray.t_min,max(tmin.x,max(tmin.y,tmin.z)));distance_far=min(ray.t_max,min(tmax.x,min(tmax.y,tmax.z)));return distance_near<=distance_far;}\n#if VOXEL_MARCH_DIAGNOSTIC_INFO_OPTION\nstruct VoxelMarchDiagnosticInfo {float heat;ivec3 voxel_intersect_coords;};\n#endif\nuint hash(uint i) {i ^= i>>16u;i*=0x7FEB352Du;i ^= i>>15u;i*=0x846CA68Bu;i ^= i>>16u;return i;}\nfloat uint2float(uint i) {return uintBitsToFloat(0x3F800000u | (i>>9u))-1.0;}\nvec3 uv_to_normal(vec2 uv) {vec3 N;vec2 uvRange=uv;float theta=uvRange.x*2.0*PI;float phi=uvRange.y*PI;N.x=cos(theta)*sin(phi);N.z=sin(theta)*sin(phi);N.y=cos(phi);return N;}\nvec2 plasticSequence(const uint rstate) {return vec2(uint2float(rstate*3242174889u),\nuint2float(rstate*2447445414u));}\nfloat goldenSequence(const uint rstate) {return uint2float(rstate*2654435769u);}\nfloat distanceSquared(vec2 a,vec2 b) {vec2 diff=a-b;return dot(diff,diff);}\nvoid genTB(const vec3 N,out vec3 T,out vec3 B) {float s=N.z<0.0 ? -1.0 : 1.0;float a=-1.0/(s+N.z);float b=N.x*N.y*a;T=vec3(1.0+s*N.x*N.x*a,s*b,-s*N.x);B=vec3(b,s+N.y*N.y*a,-N.y);}\nint stack[24]; \n#define PUSH(i) stack[stackLevel++]=i; \n#define POP() stack[--stackLevel] \n#ifdef VOXEL_MARCH_DIAGNOSTIC_INFO_OPTION\nbool anyHitVoxels(const Ray ray_vs,\nout VoxelMarchDiagnosticInfo voxel_march_diagnostic_info) {\n#else\nbool anyHitVoxels(const Ray ray_vs) {\n#endif\nvec3 invD=ray_vs.dir_rcp;vec3 D=ray_vs.dir;vec3 O=ray_vs.orig;ivec3 negD=ivec3(lessThan(D,vec3(0,0,0)));int voxel0=negD.x | negD.y<<1 | negD.z<<2;vec3 t0=-O*invD,t1=(vec3(1.0)-O)*invD;int maxLod=int(highestMipLevel);int stackLevel=0;\n#if VOXEL_MARCH_DIAGNOSTIC_INFO_OPTION\nuint steps=0u;\n#endif\nPUSH(maxLod<<24);while (stackLevel>0) {int elem=POP();ivec4 Coords =\nivec4(elem & 0xFF,elem>>8 & 0xFF,elem>>16 & 0xFF,elem>>24);if (Coords.w==0) {\n#if VOXEL_MARCH_DIAGNOSTIC_INFO_OPTION\nvoxel_march_diagnostic_info.heat=float(steps)/24.0;\n#endif\nreturn true;}\n#if VOXEL_MARCH_DIAGNOSTIC_INFO_OPTION\n++steps;\n#endif\nfloat invRes=exp2(float(Coords.w-maxLod));vec3 bbmin=invRes*vec3(Coords.xyz+negD);vec3 bbmax=invRes*vec3(Coords.xyz-negD+ivec3(1));vec3 mint=mix(t0,t1,bbmin);vec3 maxt=mix(t0,t1,bbmax);vec3 midt=0.5*(mint+maxt);mint.x=max(0.0,mint.x);midt.x=max(0.0,midt.x);int nodeMask=int(\nround(texelFetch(voxelGridSampler,Coords.xyz,Coords.w).x*255.0));Coords.w--;int voxelBit=voxel0;Coords.xyz=(Coords.xyz<<1)+negD;int packedCoords =\nCoords.x | Coords.y<<8 | Coords.z<<16 | Coords.w<<24;if (max(mint.x,max(mint.y,mint.z))0.0 && stepCount0.0) {vec4 VP2=VP;VP2.y*=-1.0;vec4 unormWP=invViewMtx*VP2;vec3 WP=(wsNormalizationMtx*unormWP).xyz;vec2 vxNoise=vec2(uint2float(hash(dirId*2u)),uint2float(hash(dirId*2u+1u)));\n#ifdef VOXEL_MARCH_DIAGNOSTIC_INFO_OPTION\nVoxelMarchDiagnosticInfo voxel_march_diagnostic_info;opacity=max(opacity,shadowOpacity.x*voxelShadow(WP,L.xyz,N,vxNoise,voxel_march_diagnostic_info));heat+=voxel_march_diagnostic_info.heat;\n#else\nopacity =\nmax(opacity,shadowOpacity.x*voxelShadow(WP,L.xyz,N,vxNoise));\n#endif\nvec3 VL=(viewMtx*L).xyz;\n#ifdef RIGHT_HANDED\nfloat nearPlaneZ=-projMtx[3][2]/(projMtx[2][2]-1.0); \nfloat farPlaneZ=-projMtx[3][2]/(projMtx[2][2]+1.0);\n#else\nfloat nearPlaneZ=-projMtx[3][2]/(projMtx[2][2]+1.0); \nfloat farPlaneZ=-projMtx[3][2]/(projMtx[2][2]-1.0);\n#endif\nfloat ssShadow=shadowOpacity.y *\nscreenSpaceShadow(VP2.xyz,VL,Resolution,nearPlaneZ,farPlaneZ,\nabs(2.0*noise.z-1.0));opacity=max(opacity,ssShadow);\n#ifdef COLOR_SHADOWS\nvec3 light=pdf<1e-6 ? vec3(0.0) : vec3(cosNL)/vec3(pdf)*ibl;shadowedLight+=light*opacity;totalLight+=light;\n#else\nfloat rcos=(1.0-cosNL);shadowAccum+=(1.0-opacity*(1.0-pow(rcos,8.0)));sampleWeight+=1.0;vec3 VR=-(viewMtx*vec4(reflect(-L.xyz,N),0.0)).xyz;specShadowAccum+=max(1.0-(opacity*pow(VR.z,8.0)),0.0);\n#endif\n}\nnoise.z=fract(noise.z+GOLD);}\n#ifdef COLOR_SHADOWS\nvec3 shadow=(totalLight-shadowedLight)/totalLight;float maxShadow=max(max(shadow.x,max(shadow.y,shadow.z)),1.0);glFragColor=vec4(shadow/maxShadow,1.0);\n#else\n#ifdef VOXEL_MARCH_DIAGNOSTIC_INFO_OPTION\ngl_FragColor=vec4(shadowAccum/float(sampleWeight),\nspecShadowAccum/float(sampleWeight),heat/float(sampleWeight),1.0);\n#else\ngl_FragColor=vec4(shadowAccum/float(sampleWeight),specShadowAccum/float(sampleWeight),0.0,1.0);\n#endif\n#endif\n}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},53378:(e,t,n)=>{n.r(t),n.d(t,{lightsFragmentFunctionsWGSL:()=>a});var r=n(98519),i=(n(14236),n(23170),"lightsFragmentFunctions"),o="struct lightingInfo\n{diffuse: vec3f,\n#ifdef SPECULARTERM\nspecular: vec3f,\n#endif\n#ifdef NDOTL\nndl: f32,\n#endif\n};fn computeLighting(viewDirectionW: vec3f,vNormal: vec3f,lightData: vec4f,diffuseColor: vec3f,specularColor: vec3f,range: f32,glossiness: f32)->lightingInfo {var result: lightingInfo;var lightVectorW: vec3f;var attenuation: f32=1.0;if (lightData.w==0.)\n{var direction: vec3f=lightData.xyz-fragmentInputs.vPositionW;attenuation=max(0.,1.0-length(direction)/range);lightVectorW=normalize(direction);}\nelse\n{lightVectorW=normalize(-lightData.xyz);}\nvar ndl: f32=max(0.,dot(vNormal,lightVectorW));\n#ifdef NDOTL\nresult.ndl=ndl;\n#endif\nresult.diffuse=ndl*diffuseColor*attenuation;\n#ifdef SPECULARTERM\nvar angleW: vec3f=normalize(viewDirectionW+lightVectorW);var specComp: f32=max(0.,dot(vNormal,angleW));specComp=pow(specComp,max(1.,glossiness));result.specular=specComp*specularColor*attenuation;\n#endif\nreturn result;}\nfn getAttenuation(cosAngle: f32,exponent: f32)->f32 {return max(0.,pow(cosAngle,exponent));}\nfn getIESAttenuation(cosAngle: f32,iesLightTexture: texture_2d,iesLightTextureSampler: sampler)->f32 {var angle=acos(cosAngle)/PI;return textureSampleLevel(iesLightTexture,iesLightTextureSampler,vec2f(angle,0),0.).r;}\nfn computeBasicSpotLighting(viewDirectionW: vec3f,lightVectorW: vec3f,vNormal: vec3f,attenuation: f32,diffuseColor: vec3f,specularColor: vec3f,glossiness: f32)->lightingInfo {var result: lightingInfo;var ndl: f32=max(0.,dot(vNormal,lightVectorW));\n#ifdef NDOTL\nresult.ndl=ndl;\n#endif\nresult.diffuse=ndl*diffuseColor*attenuation;\n#ifdef SPECULARTERM\nvar angleW: vec3f=normalize(viewDirectionW+lightVectorW);var specComp: f32=max(0.,dot(vNormal,angleW));specComp=pow(specComp,max(1.,glossiness));result.specular=specComp*specularColor*attenuation;\n#endif\nreturn result;}\nfn computeIESSpotLighting(viewDirectionW: vec3f,vNormal: vec3f,lightData: vec4f,lightDirection: vec4f,diffuseColor: vec3f,specularColor: vec3f,range: f32,glossiness: f32,iesLightTexture: texture_2d,iesLightTextureSampler: sampler)->lightingInfo {var direction: vec3f=lightData.xyz-fragmentInputs.vPositionW;var lightVectorW: vec3f=normalize(direction);var attenuation: f32=max(0.,1.0-length(direction)/range);var dotProduct=dot(lightDirection.xyz,-lightVectorW);var cosAngle: f32=max(0.,dotProduct);if (cosAngle>=lightDirection.w)\n{attenuation*=getIESAttenuation(dotProduct,iesLightTexture,iesLightTextureSampler);return computeBasicSpotLighting(viewDirectionW,lightVectorW,vNormal,attenuation,diffuseColor,specularColor,glossiness);}\nvar result: lightingInfo;result.diffuse=vec3f(0.);\n#ifdef SPECULARTERM\nresult.specular=vec3f(0.);\n#endif\n#ifdef NDOTL\nresult.ndl=0.;\n#endif\nreturn result;}\nfn computeSpotLighting(viewDirectionW: vec3f,vNormal: vec3f ,lightData: vec4f,lightDirection: vec4f,diffuseColor: vec3f,specularColor: vec3f,range: f32,glossiness: f32)->lightingInfo {var direction: vec3f=lightData.xyz-fragmentInputs.vPositionW;var lightVectorW: vec3f=normalize(direction);var attenuation: f32=max(0.,1.0-length(direction)/range);var cosAngle: f32=max(0.,dot(lightDirection.xyz,-lightVectorW));if (cosAngle>=lightDirection.w)\n{attenuation*=getAttenuation(cosAngle,lightData.w);return computeBasicSpotLighting(viewDirectionW,lightVectorW,vNormal,attenuation,diffuseColor,specularColor,glossiness);}\nvar result: lightingInfo;result.diffuse=vec3f(0.);\n#ifdef SPECULARTERM\nresult.specular=vec3f(0.);\n#endif\n#ifdef NDOTL\nresult.ndl=0.;\n#endif\nreturn result;}\nfn computeHemisphericLighting(viewDirectionW: vec3f,vNormal: vec3f,lightData: vec4f,diffuseColor: vec3f,specularColor: vec3f,groundColor: vec3f,glossiness: f32)->lightingInfo {var result: lightingInfo;var ndl: f32=dot(vNormal,lightData.xyz)*0.5+0.5;\n#ifdef NDOTL\nresult.ndl=ndl;\n#endif\nresult.diffuse=mix(groundColor,diffuseColor,ndl);\n#ifdef SPECULARTERM\nvar angleW: vec3f=normalize(viewDirectionW+lightData.xyz);var specComp: f32=max(0.,dot(vNormal,angleW));specComp=pow(specComp,max(1.,glossiness));result.specular=specComp*specularColor;\n#endif\nreturn result;}\nfn computeProjectionTextureDiffuseLighting(projectionLightTexture: texture_2d,projectionLightSampler: sampler,textureProjectionMatrix: mat4x4f,posW: vec3f)->vec3f {var strq: vec4f=textureProjectionMatrix*vec4f(posW,1.0);strq/=strq.w;var textureColor: vec3f=textureSample(projectionLightTexture,projectionLightSampler,strq.xy).rgb;return textureColor;}\n#if defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)\n#include\nvar areaLightsLTC1SamplerSampler: sampler;var areaLightsLTC1Sampler: texture_2d;var areaLightsLTC2SamplerSampler: sampler;var areaLightsLTC2Sampler: texture_2d;fn computeAreaLighting(ltc1: texture_2d,ltc1Sampler:sampler,ltc2:texture_2d,ltc2Sampler:sampler,viewDirectionW: vec3f,vNormal:vec3f,vPosition:vec3f,lightPosition:vec3f,halfWidth:vec3f, halfHeight:vec3f,diffuseColor:vec3f,specularColor:vec3f,roughness:f32 )->lightingInfo\n{var result: lightingInfo;var data: areaLightData=computeAreaLightSpecularDiffuseFresnel(ltc1,ltc1Sampler,ltc2,ltc2Sampler,viewDirectionW,vNormal,vPosition,lightPosition,halfWidth,halfHeight,roughness);\n#ifdef SPECULARTERM\nvar fresnel:vec3f=( specularColor*data.Fresnel.x+( vec3f( 1.0 )-specularColor )*data.Fresnel.y );result.specular+=specularColor*fresnel*data.Specular;\n#endif\nresult.diffuse+=diffuseColor*data.Diffuse;return result;}\n#endif\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\n#include\nfn computeClusteredLighting(\nlightDataTexture: texture_2d,\ntileMaskBuffer: ptr>,\nviewDirectionW: vec3f,\nvNormal: vec3f,\nlightData: vec4f,\nsliceRange: vec2u,\nglossiness: f32\n)->lightingInfo {var result: lightingInfo;let tilePosition=vec2u(fragmentInputs.position.xy*lightData.xy);let maskResolution=vec2u(lightData.zw);var tileIndex=(tilePosition.x*maskResolution.x+tilePosition.y)*maskResolution.y;let batchRange=sliceRange/CLUSTLIGHT_BATCH;var batchOffset=batchRange.x*CLUSTLIGHT_BATCH;tileIndex+=batchRange.x;for (var i=batchRange.x; i<=batchRange.y; i+=1) {var mask=tileMaskBuffer[tileIndex];tileIndex+=1;let maskOffset=max(sliceRange.x,batchOffset)-batchOffset; \nlet maskWidth=min(sliceRange.y-batchOffset+1,CLUSTLIGHT_BATCH);mask=extractBits(mask,maskOffset,maskWidth);while mask != 0 {let trailing=firstTrailingBit(mask);mask ^= 1u<{n.d(t,{A5:()=>p,C5:()=>v,Cm:()=>l,EX:()=>u,GX:()=>h,N5:()=>s,YM:()=>m,bS:()=>y,kf:()=>c,tI:()=>d,tg:()=>f});var r=n(14737),i=n(24894),o=new WeakMap,a={_webGLVersion:2,cachedPipelines:{}};function s(e){var t=o.get(e);if(!t){if(!e)return a;t={_webGLVersion:e.TEXTURE_BINDING_3D?2:1,_context:e,parallelShaderCompile:e.getExtension("KHR_parallel_shader_compile")||void 0,cachedPipelines:{}},o.set(e,t)}return t}function l(e){o.delete(e)}function c(e,t,n,r,i,o){var a,l=s(r);return o||(o=null!==(a=l._createShaderProgramInjection)&&void 0!==a?a:d),o(e,g(t,"vertex",r,l._contextWasLost),g(n,"fragment",r,l._contextWasLost),r,i,l.validateShaderPrograms)}function u(e,t,n,r,i,o,a){var l;void 0===o&&(o=null);var c=s(i);a||(a=null!==(l=c._createShaderProgramInjection)&&void 0!==l?l:d);var u=c._webGLVersion>1?"#version 300 es\n#define WEBGL2 \n":"";return a(e,_(t,"vertex",r,u,i,c._contextWasLost),_(n,"fragment",r,u,i,c._contextWasLost),i,o,c.validateShaderPrograms)}function h(e,t){var n=new r.x,i=s(e);return i.parallelShaderCompile&&!i.disableParallelShaderCompile&&(n.isParallelCompiled=!0),n.context=i._context,n}function d(e,t,n,r,i,o){void 0===i&&(i=null);var a=r.createProgram();if(e.program=a,!a)throw new Error("Unable to create program");return r.attachShader(a,t),r.attachShader(a,n),r.linkProgram(a),e.context=r,e.vertexShader=t,e.fragmentShader=n,e.isParallelCompiled||f(e,r,o),a}function p(e,t,n){var r=e;if(r._isDisposed)return!1;var i=s(t);return!!(i&&i.parallelShaderCompile&&i.parallelShaderCompile.COMPLETION_STATUS_KHR&&r.program&&t.getProgramParameter(r.program,i.parallelShaderCompile.COMPLETION_STATUS_KHR))&&(f(r,t,n),!0)}function f(e,t,n){var r=e.context,i=e.vertexShader,o=e.fragmentShader,a=e.program;if(!r.getProgramParameter(a,r.LINK_STATUS)){var s,l;if(!t.getShaderParameter(i,t.COMPILE_STATUS)&&(s=t.getShaderInfoLog(i)))throw e.vertexCompilationError=s,new Error("VERTEX SHADER "+s);if(!t.getShaderParameter(o,t.COMPILE_STATUS)&&(s=t.getShaderInfoLog(o)))throw e.fragmentCompilationError=s,new Error("FRAGMENT SHADER "+s);if(l=r.getProgramInfoLog(a))throw e.programLinkError=l,new Error(l)}if(n&&(r.validateProgram(a),!r.getProgramParameter(a,r.VALIDATE_STATUS)&&(l=r.getProgramInfoLog(a))))throw e.programValidationError=l,new Error(l);r.deleteShader(i),r.deleteShader(o),e.vertexShader=void 0,e.fragmentShader=void 0,e.onCompiled&&(e.onCompiled(),e.onCompiled=void 0)}function m(e,t,n,r,i,o,a,l,h,d,p,f,m){var _,g;void 0===d&&(d="");var v=s(e.context);f||(f=null!==(_=v.createRawShaderProgramInjection)&&void 0!==_?_:c),m||(m=null!==(g=v.createShaderProgramInjection)&&void 0!==g?g:u);var y=e;y.program=r?f(y,t,n,y.context,h):m(y,t,n,l,y.context,h),y.program.__SPECTOR_rebuildProgram=a,p()}function _(e,t,n,r,o,a){return g((0,i.iL)(e,n,r),t,o,a)}function g(e,t,n,r){var i=n.createShader("vertex"===t?n.VERTEX_SHADER:n.FRAGMENT_SHADER);if(!i){for(var o=n.NO_ERROR,a=n.NO_ERROR;(a=n.getError())!==n.NO_ERROR;)o=a;throw new Error("Something went wrong while creating a gl ".concat(t," shader object. gl error=").concat(o,", gl isContextLost=").concat(n.isContextLost(),", _contextWasLost=").concat(r))}return n.shaderSource(i,e),n.compileShader(i),i}function v(e,t){t.useProgram(e)}function y(e,t){var n=e;if(n.isParallelCompiled){var r=n.onCompiled;n.onCompiled=function(){null==r||r(),t(e)}}else t(e)}},53695:(e,t,n)=>{n.d(t,{B:()=>a,_:()=>i});var r=[],i=function(){function e(){}return e.SetImmediate=function(e){0===r.length&&setTimeout((function(){var e=r;r=[];for(var t=0,n=e;t{n.d(t,{L:()=>i,b:()=>o});var r=n(78322),i=function(){function e(t){this.length=0,this.data=new Array(t),this._id=e._GlobalId++}return e.prototype.push=function(e){this.data[this.length++]=e,this.length>this.data.length&&(this.data.length*=2)},e.prototype.forEach=function(e){for(var t=0;tthis.data.length&&(this.data.length=2*(this.length+e.length));for(var t=0;t=this.length?-1:t},e.prototype.contains=function(e){return-1!==this.indexOf(e)},e._GlobalId=0,e}(),o=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._duplicateId=0,t}return(0,r.C6)(t,e),t.prototype.push=function(t){e.prototype.push.call(this,t),t.__smartArrayFlags||(t.__smartArrayFlags={}),t.__smartArrayFlags[this._id]=this._duplicateId},t.prototype.pushNoDuplicate=function(e){return!(e.__smartArrayFlags&&e.__smartArrayFlags[this._id]===this._duplicateId||(this.push(e),0))},t.prototype.reset=function(){e.prototype.reset.call(this),this._duplicateId++},t.prototype.concatWithNoDuplicate=function(e){if(0!==e.length){this.length+e.length>this.data.length&&(this.data.length=2*(this.length+e.length));for(var t=0;t{n.d(t,{w:()=>h});var r=n(78322),i=n(8822),o=n(99971),a=n(13803),s=n(11741),l=n(29598),c=n(81152),u=n(60257),h=function(e){function t(t,n,r){var o=e.call(this,t,n,r)||this;return o.depthTextureType=0,o._numCascades=i.c.DEFAULT_CASCADES_COUNT,o._debug=!1,o._stabilizeCascades=!1,o._lambda=.5,o._cascadeBlendPercentage=.1,o._depthClamp=!0,o._autoCalcDepthBounds=!1,o._currentAutoCalcDepthBoundsCounter=0,o._autoCalcDepthBoundsRefreshRate=1,o._shadowMaxZ=1e4,o._thinMinMaxReducer=new s.Qh(r),o._thinMinMaxReducer.onAfterReductionPerformed.add((function(e){if(o._shadowGenerator){var t=o.camera,n=e.min,r=e.max;if(n>=r)n=0,r=1;else if(t&&0!==o.depthTextureType){if(2===o.depthTextureType){var i=o._frameGraph.engine,a=t.getProjectionMatrix(),s=a.m[10],l=a.m[14];i.isNDCHalfZRange||(n=2*n-1,r=2*r-1),n=l/(n-s),r=l/(r-s)}var c=t.minZ,u=t.maxZ;n=(n-c)/(u-c),r=(r-c)/(u-c)}n===o._shadowGenerator.minDistance&&r===o._shadowGenerator.maxDistance||o._shadowGenerator.setMinMaxDistance(n,r)}})),o}return(0,r.C6)(t,e),t.IsCascadedShadowGenerator=function(e){return void 0!==e.numCascades},Object.defineProperty(t.prototype,"numCascades",{get:function(){return this._numCascades},set:function(e){e!==this._numCascades&&(this._numCascades=e,this._setupShadowGenerator())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"debug",{get:function(){return this._debug},set:function(e){e!==this._debug&&(this._debug=e,this._shadowGenerator&&(this._shadowGenerator.debug=e))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stabilizeCascades",{get:function(){return this._stabilizeCascades},set:function(e){e!==this._stabilizeCascades&&(this._stabilizeCascades=e,this._shadowGenerator&&(this._shadowGenerator.stabilizeCascades=e))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lambda",{get:function(){return this._lambda},set:function(e){e!==this._lambda&&(this._lambda=e,this._shadowGenerator&&(this._shadowGenerator.lambda=e))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cascadeBlendPercentage",{get:function(){return this._cascadeBlendPercentage},set:function(e){e!==this._cascadeBlendPercentage&&(this._cascadeBlendPercentage=e,this._shadowGenerator&&(this._shadowGenerator.cascadeBlendPercentage=e))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"depthClamp",{get:function(){return this._depthClamp},set:function(e){e!==this._depthClamp&&(this._depthClamp=e,this._shadowGenerator&&(this._shadowGenerator.depthClamp=e))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"autoCalcDepthBounds",{get:function(){return this._autoCalcDepthBounds},set:function(e){var t;if(e!==this._autoCalcDepthBounds){this._autoCalcDepthBounds=e,this._currentAutoCalcDepthBoundsCounter=this._autoCalcDepthBoundsRefreshRate,e||null===(t=this._shadowGenerator)||void 0===t||t.setMinMaxDistance(0,1);for(var n=this.passes,r=0;r=0){if(++t._currentAutoCalcDepthBoundsCounter>=t._autoCalcDepthBoundsRefreshRate){var n=e.getTextureFromHandle(a);n&&t._thinMinMaxReducer.readMinMax(n)}t._currentAutoCalcDepthBoundsCounter%=t._autoCalcDepthBoundsRefreshRate,0===t._autoCalcDepthBoundsRefreshRate&&(t._currentAutoCalcDepthBoundsCounter=-1)}}))}e.prototype.record.call(this)},t.prototype.dispose=function(){e.prototype.dispose.call(this),this._thinMinMaxReducer.dispose()},t}(o.Q)},54071:(e,t,n)=>{n.d(t,{I:()=>a});var r=n(11296),i=n(8046),o=n(56740),a=function(){function e(e,t,n){this.vectors=(0,r.mI)(8,i.Pq.Zero),this.center=i.Pq.Zero(),this.centerWorld=i.Pq.Zero(),this.extendSize=i.Pq.Zero(),this.extendSizeWorld=i.Pq.Zero(),this.directions=(0,r.mI)(3,i.Pq.Zero),this.vectorsWorld=(0,r.mI)(8,i.Pq.Zero),this.minimumWorld=i.Pq.Zero(),this.maximumWorld=i.Pq.Zero(),this.minimum=i.Pq.Zero(),this.maximum=i.Pq.Zero(),this._drawWrapperFront=null,this._drawWrapperBack=null,this.reConstruct(e,t,n)}return e.prototype.reConstruct=function(e,t,n){var r=e.x,o=e.y,a=e.z,s=t.x,l=t.y,c=t.z,u=this.vectors;this.minimum.copyFromFloats(r,o,a),this.maximum.copyFromFloats(s,l,c),u[0].copyFromFloats(r,o,a),u[1].copyFromFloats(s,l,c),u[2].copyFromFloats(s,o,a),u[3].copyFromFloats(r,l,a),u[4].copyFromFloats(r,o,c),u[5].copyFromFloats(s,l,a),u[6].copyFromFloats(r,l,c),u[7].copyFromFloats(s,o,c),t.addToRef(e,this.center).scaleInPlace(.5),t.subtractToRef(e,this.extendSize).scaleInPlace(.5),this._worldMatrix=n||i.uq.IdentityReadOnly,this._update(this._worldMatrix)},e.prototype.scale=function(t){var n=e._TmpVector3,r=this.maximum.subtractToRef(this.minimum,n[0]),i=r.length();r.normalizeFromLength(i);var o=i*t,a=r.scaleInPlace(.5*o),s=this.center.subtractToRef(a,n[1]),l=this.center.addToRef(a,n[2]);return this.reConstruct(s,l,this._worldMatrix),this},e.prototype.getWorldMatrix=function(){return this._worldMatrix},e.prototype._update=function(e){var t=this.minimumWorld,n=this.maximumWorld,r=this.directions,o=this.vectorsWorld,a=this.vectors;if(e.isIdentity()){for(t.copyFrom(this.minimum),n.copyFrom(this.maximum),s=0;s<8;++s)o[s].copyFrom(a[s]);this.extendSizeWorld.copyFrom(this.extendSize),this.centerWorld.copyFrom(this.center)}else{t.setAll(Number.MAX_VALUE),n.setAll(-Number.MAX_VALUE);for(var s=0;s<8;++s){var l=o[s];i.Pq.TransformCoordinatesToRef(a[s],e,l),t.minimizeInPlace(l),n.maximizeInPlace(l)}n.subtractToRef(t,this.extendSizeWorld).scaleInPlace(.5),n.addToRef(t,this.centerWorld).scaleInPlace(.5)}i.Pq.FromArrayToRef(e.m,0,r[0]),i.Pq.FromArrayToRef(e.m,4,r[1]),i.Pq.FromArrayToRef(e.m,8,r[2]),this._worldMatrix=e},e.prototype.isInFrustum=function(t){return e.IsInFrustum(this.vectorsWorld,t)},e.prototype.isCompletelyInFrustum=function(t){return e.IsCompletelyInFrustum(this.vectorsWorld,t)},e.prototype.intersectsPoint=function(e){var t=this.minimumWorld,n=this.maximumWorld,r=t.x,i=t.y,a=t.z,s=n.x,l=n.y,c=n.z,u=e.x,h=e.y,d=e.z,p=-o.bH;return!(s-uu-r||l-hh-i||c-dd-a)},e.prototype.intersectsSphere=function(t){return e.IntersectsSphere(this.minimumWorld,this.maximumWorld,t.centerWorld,t.radiusWorld)},e.prototype.intersectsMinMax=function(e,t){var n=this.minimumWorld,r=this.maximumWorld,i=n.x,o=n.y,a=n.z,s=r.x,l=r.y,c=r.z,u=e.x,h=e.y,d=e.z,p=t.x,f=t.y,m=t.z;return!(sp||lf||cm)},e.prototype.dispose=function(){var e,t;null===(e=this._drawWrapperFront)||void 0===e||e.dispose(),null===(t=this._drawWrapperBack)||void 0===t||t.dispose()},e.Intersects=function(e,t){return e.intersectsMinMax(t.minimumWorld,t.maximumWorld)},e.IntersectsSphere=function(t,n,r,o){var a=e._TmpVector3[0];return i.Pq.ClampToRef(r,t,n,a),i.Pq.DistanceSquared(r,a)<=o*o},e.IsCompletelyInFrustum=function(e,t){for(var n=0;n<6;++n)for(var r=t[n],i=0;i<8;++i)if(r.dotCoordinate(e[i])<0)return!1;return!0},e.IsInFrustum=function(e,t){for(var n=0;n<6;++n){for(var r=!0,i=t[n],o=0;o<8;++o)if(i.dotCoordinate(e[o])>=0){r=!1;break}if(r)return!1}return!0},e._TmpVector3=(0,r.mI)(3,i.Pq.Zero),e}()},54198:(e,t,n)=>{var r=n(5153),i=n(82673);i.$.prototype.displayLoadingUI=function(){if((0,r.BA)()){var e=this.loadingScreen;e&&e.displayLoadingUI()}},i.$.prototype.hideLoadingUI=function(){if((0,r.BA)()){var e=this._loadingScreen;e&&e.hideLoadingUI()}},Object.defineProperty(i.$.prototype,"loadingScreen",{get:function(){return!this._loadingScreen&&this._renderingCanvas&&(this._loadingScreen=i.$.DefaultLoadingScreenFactory(this._renderingCanvas)),this._loadingScreen},set:function(e){this._loadingScreen=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.$.prototype,"loadingUIText",{set:function(e){this.loadingScreen.loadingUIText=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.$.prototype,"loadingUIBackgroundColor",{set:function(e){this.loadingScreen.loadingUIBackgroundColor=e},enumerable:!0,configurable:!0})},54409:(e,t,n)=>{n.r(t),n.d(t,{lightsFragmentFunctions:()=>a});var r=n(98519),i=(n(69137),n(2495),"lightsFragmentFunctions"),o="struct lightingInfo\n{vec3 diffuse;\n#ifdef SPECULARTERM\nvec3 specular;\n#endif\n#ifdef NDOTL\nfloat ndl;\n#endif\n};lightingInfo computeLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,float range,float glossiness) {lightingInfo result;vec3 lightVectorW;float attenuation=1.0;if (lightData.w==0.)\n{vec3 direction=lightData.xyz-vPositionW;attenuation=max(0.,1.0-length(direction)/range);lightVectorW=normalize(direction);}\nelse\n{lightVectorW=normalize(-lightData.xyz);}\nfloat ndl=max(0.,dot(vNormal,lightVectorW));\n#ifdef NDOTL\nresult.ndl=ndl;\n#endif\nresult.diffuse=ndl*diffuseColor*attenuation;\n#ifdef SPECULARTERM\nvec3 angleW=normalize(viewDirectionW+lightVectorW);float specComp=max(0.,dot(vNormal,angleW));specComp=pow(specComp,max(1.,glossiness));result.specular=specComp*specularColor*attenuation;\n#endif\nreturn result;}\nfloat getAttenuation(float cosAngle,float exponent) {return max(0.,pow(cosAngle,exponent));}\nfloat getIESAttenuation(float cosAngle,sampler2D iesLightSampler) {float angle=acos(cosAngle)/PI;return texture2D(iesLightSampler,vec2(angle,0.)).r;}\nlightingInfo basicSpotLighting(vec3 viewDirectionW,vec3 lightVectorW,vec3 vNormal,float attenuation,vec3 diffuseColor,vec3 specularColor,float glossiness) {lightingInfo result; \nfloat ndl=max(0.,dot(vNormal,lightVectorW));\n#ifdef NDOTL\nresult.ndl=ndl;\n#endif\nresult.diffuse=ndl*diffuseColor*attenuation;\n#ifdef SPECULARTERM\nvec3 angleW=normalize(viewDirectionW+lightVectorW);float specComp=max(0.,dot(vNormal,angleW));specComp=pow(specComp,max(1.,glossiness));result.specular=specComp*specularColor*attenuation;\n#endif\nreturn result;}\nlightingInfo computeIESSpotLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec4 lightDirection,vec3 diffuseColor,vec3 specularColor,float range,float glossiness,sampler2D iesLightSampler) { \nvec3 direction=lightData.xyz-vPositionW;vec3 lightVectorW=normalize(direction);float attenuation=max(0.,1.0-length(direction)/range);float dotProduct=dot(lightDirection.xyz,-lightVectorW);float cosAngle=max(0.,dotProduct);if (cosAngle>=lightDirection.w)\n{ \nattenuation*=getIESAttenuation(dotProduct,iesLightSampler);return basicSpotLighting(viewDirectionW,lightVectorW,vNormal,attenuation,diffuseColor,specularColor,glossiness);}\nlightingInfo result;result.diffuse=vec3(0.);\n#ifdef SPECULARTERM\nresult.specular=vec3(0.);\n#endif\n#ifdef NDOTL\nresult.ndl=0.;\n#endif\nreturn result;}\nlightingInfo computeSpotLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec4 lightDirection,vec3 diffuseColor,vec3 specularColor,float range,float glossiness) {vec3 direction=lightData.xyz-vPositionW;vec3 lightVectorW=normalize(direction);float attenuation=max(0.,1.0-length(direction)/range);float cosAngle=max(0.,dot(lightDirection.xyz,-lightVectorW));if (cosAngle>=lightDirection.w)\n{ \nattenuation*=getAttenuation(cosAngle,lightData.w);return basicSpotLighting(viewDirectionW,lightVectorW,vNormal,attenuation,diffuseColor,specularColor,glossiness);}\nlightingInfo result;result.diffuse=vec3(0.);\n#ifdef SPECULARTERM\nresult.specular=vec3(0.);\n#endif\n#ifdef NDOTL\nresult.ndl=0.;\n#endif\nreturn result;}\nlightingInfo computeHemisphericLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,vec3 groundColor,float glossiness) {lightingInfo result;float ndl=dot(vNormal,lightData.xyz)*0.5+0.5;\n#ifdef NDOTL\nresult.ndl=ndl;\n#endif\nresult.diffuse=mix(groundColor,diffuseColor,ndl);\n#ifdef SPECULARTERM\nvec3 angleW=normalize(viewDirectionW+lightData.xyz);float specComp=max(0.,dot(vNormal,angleW));specComp=pow(specComp,max(1.,glossiness));result.specular=specComp*specularColor;\n#endif\nreturn result;}\n#define inline\nvec3 computeProjectionTextureDiffuseLighting(sampler2D projectionLightSampler,mat4 textureProjectionMatrix,vec3 posW){vec4 strq=textureProjectionMatrix*vec4(posW,1.0);strq/=strq.w;vec3 textureColor=texture2D(projectionLightSampler,strq.xy).rgb;return textureColor;}\n#if defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)\n#include\nuniform sampler2D areaLightsLTC1Sampler;uniform sampler2D areaLightsLTC2Sampler;\n#define inline\nlightingInfo computeAreaLighting(sampler2D ltc1,sampler2D ltc2,vec3 viewDirectionW,vec3 vNormal,vec3 vPosition,vec3 lightPosition,vec3 halfWidth,vec3 halfHeight,vec3 diffuseColor,vec3 specularColor,float roughness) \n{lightingInfo result;areaLightData data=computeAreaLightSpecularDiffuseFresnel(ltc1,ltc2,viewDirectionW,vNormal,vPosition,lightPosition,halfWidth,halfHeight,roughness);\n#ifdef SPECULARTERM\nvec3 fresnel=( specularColor*data.Fresnel.x+( vec3( 1.0 )-specularColor )*data.Fresnel.y );result.specular+=specularColor*fresnel*data.Specular;\n#endif\nresult.diffuse+=diffuseColor*data.Diffuse;return result;}\n#endif\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\n#include\n#define inline\nlightingInfo computeClusteredLighting(\nsampler2D lightDataTexture,\nsampler2D tileMaskTexture,\nvec3 viewDirectionW,\nvec3 vNormal,\nvec4 lightData,\nivec2 sliceRange,\nfloat glossiness\n) {lightingInfo result;ivec2 tilePosition=ivec2(gl_FragCoord.xy*lightData.xy);int maskHeight=int(lightData.z);tilePosition.y=min(tilePosition.y,maskHeight-1);ivec2 batchRange=sliceRange/CLUSTLIGHT_BATCH;int batchOffset=batchRange.x*CLUSTLIGHT_BATCH;tilePosition.y+=maskHeight*batchRange.x;for (int i=batchRange.x; i<=batchRange.y; i+=1) {uint mask=uint(texelFetch(tileMaskTexture,tilePosition,0).r);tilePosition.y+=maskHeight;int maskOffset=max(sliceRange.x-batchOffset,0);int maskWidth=min(sliceRange.y-batchOffset+1,CLUSTLIGHT_BATCH);mask=extractBits(mask,maskOffset,maskWidth);while (mask != 0u) {uint bit=mask & -mask;mask ^= bit;int position=onlyBitPosition(bit);ClusteredLight light=getClusteredLight(lightDataTexture,batchOffset+maskOffset+position);lightingInfo info;if (light.vLightDirection.w<0.0) {info=computeLighting(viewDirectionW,vNormal,light.vLightData,light.vLightDiffuse.rgb,light.vLightSpecular.rgb,light.vLightDiffuse.a,glossiness);} else {info=computeSpotLighting(viewDirectionW,vNormal,light.vLightData,light.vLightDirection,light.vLightDiffuse.rgb,light.vLightSpecular.rgb,light.vLightDiffuse.a,glossiness);}\nresult.diffuse+=info.diffuse;\n#ifdef SPECULARTERM\nresult.specular+=info.specular;\n#endif\n}\nbatchOffset+=CLUSTLIGHT_BATCH;}\nreturn result;}\n#endif\n";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]=o);var a={name:i,shader:o}},54617:(e,t,n)=>{n.r(t),n.d(t,{greasedLinePixelShader:()=>a});var r=n(98519),i="greasedLinePixelShader",o="precision highp float;uniform sampler2D grlColors;uniform float grlUseColors;uniform float grlUseDash;uniform float grlDashArray;uniform float grlDashOffset;uniform float grlDashRatio;uniform float grlVisibility;uniform float grlColorsWidth;uniform vec2 grl_colorModeAndColorDistributionType;uniform vec3 grlColor;varying float grlCounters;varying float grlColorPointer;void main() {float grlColorMode=grl_colorModeAndColorDistributionType.x;float grlColorDistributionType=grl_colorModeAndColorDistributionType.y;gl_FragColor=vec4(grlColor,1.);gl_FragColor.a=step(grlCounters,grlVisibility);if (gl_FragColor.a==0.) discard;if( grlUseDash==1. ){gl_FragColor.a=ceil(mod(grlCounters+grlDashOffset,grlDashArray)-(grlDashArray*grlDashRatio));if (gl_FragColor.a==0.) discard;}\nif (grlUseColors==1.) {vec4 textureColor;if (grlColorDistributionType==COLOR_DISTRIBUTION_TYPE_LINE) { \ntextureColor=texture2D(grlColors,vec2(grlCounters,0.),0.);} else {textureColor=texture2D(grlColors,vec2(grlColorPointer/grlColorsWidth,0.),0.);}\nif (grlColorMode==COLOR_MODE_SET) {gl_FragColor=textureColor;} else if (grlColorMode==COLOR_MODE_ADD) {gl_FragColor+=textureColor;} else if (grlColorMode==COLOR_MODE_MULTIPLY) {gl_FragColor*=textureColor;}}}\n";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},54646:(e,t,n)=>{var r;n.d(t,{V:()=>r,u:()=>i}),function(e){e[e.Float=0]="Float",e[e.HalfFloat=1]="HalfFloat"}(r||(r={}));var i=function(){function e(){}return e.DefaultOutputType=r.HalfFloat,e.FFLATEUrl="https://unpkg.com/fflate@0.8.2",e}()},54665:(e,t,n)=>{var r,i,o;n.d(t,{GQ:()=>o,Ok:()=>r,Xl:()=>i}),function(e){e[e.ETC1S=0]="ETC1S",e[e.UASTC4x4=1]="UASTC4x4"}(r||(r={})),function(e){e[e.ASTC_4X4_RGBA=0]="ASTC_4X4_RGBA",e[e.ASTC_4x4_RGBA=0]="ASTC_4x4_RGBA",e[e.BC7_RGBA=1]="BC7_RGBA",e[e.BC3_RGBA=2]="BC3_RGBA",e[e.BC1_RGB=3]="BC1_RGB",e[e.PVRTC1_4_RGBA=4]="PVRTC1_4_RGBA",e[e.PVRTC1_4_RGB=5]="PVRTC1_4_RGB",e[e.ETC2_RGBA=6]="ETC2_RGBA",e[e.ETC1_RGB=7]="ETC1_RGB",e[e.RGBA32=8]="RGBA32",e[e.R8=9]="R8",e[e.RG8=10]="RG8"}(i||(i={})),function(e){e[e.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",e[e.COMPRESSED_RGBA_ASTC_4X4_KHR=37808]="COMPRESSED_RGBA_ASTC_4X4_KHR",e[e.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",e[e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",e[e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",e[e.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",e[e.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",e[e.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",e[e.RGBA8Format=32856]="RGBA8Format",e[e.R8Format=33321]="R8Format",e[e.RG8Format=33323]="RG8Format"}(o||(o={}))},55139:(e,t,n)=>{n.r(t),n.d(t,{meshUVSpaceRendererMaskerPixelShaderWGSL:()=>a});var r=n(98519),i="meshUVSpaceRendererMaskerPixelShader",o="varying vUV: vec2f;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {fragmentOutputs.color= vec4f(1.0,1.0,1.0,1.0);}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},55204:(e,t,n)=>{n.d(t,{u:()=>i});var r=n(81152),i=function(){function e(){this.samplingMode=-1,this._useMipMaps=!0,this._cachedWrapU=null,this._cachedWrapV=null,this._cachedWrapR=null,this._cachedAnisotropicFilteringLevel=null,this._comparisonFunction=0}return Object.defineProperty(e.prototype,"wrapU",{get:function(){return this._cachedWrapU},set:function(e){this._cachedWrapU=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"wrapV",{get:function(){return this._cachedWrapV},set:function(e){this._cachedWrapV=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"wrapR",{get:function(){return this._cachedWrapR},set:function(e){this._cachedWrapR=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"anisotropicFilteringLevel",{get:function(){return this._cachedAnisotropicFilteringLevel},set:function(e){this._cachedAnisotropicFilteringLevel=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"comparisonFunction",{get:function(){return this._comparisonFunction},set:function(e){this._comparisonFunction=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"useMipMaps",{get:function(){return this._useMipMaps},set:function(e){this._useMipMaps=e},enumerable:!1,configurable:!0}),e.prototype.setParameters=function(e,t,n,i,o,a){return void 0===e&&(e=r.Y.TEXTURE_WRAP_ADDRESSMODE),void 0===t&&(t=r.Y.TEXTURE_WRAP_ADDRESSMODE),void 0===n&&(n=r.Y.TEXTURE_WRAP_ADDRESSMODE),void 0===i&&(i=1),void 0===o&&(o=r.Y.TEXTURE_BILINEAR_SAMPLINGMODE),void 0===a&&(a=0),this._cachedWrapU=e,this._cachedWrapV=t,this._cachedWrapR=n,this._cachedAnisotropicFilteringLevel=i,this.samplingMode=o,this._comparisonFunction=a,this},e.prototype.compareSampler=function(e){return this._cachedWrapU===e._cachedWrapU&&this._cachedWrapV===e._cachedWrapV&&this._cachedWrapR===e._cachedWrapR&&this._cachedAnisotropicFilteringLevel===e._cachedAnisotropicFilteringLevel&&this.samplingMode===e.samplingMode&&this._comparisonFunction===e._comparisonFunction&&this._useMipMaps===e._useMipMaps},e}()},55214:(e,t,n)=>{n.r(t),n.d(t,{fluidRenderingParticleThicknessVertexShader:()=>a});var r=n(98519),i="fluidRenderingParticleThicknessVertexShader",o="attribute vec3 position;attribute vec2 offset;uniform mat4 view;uniform mat4 projection;uniform vec2 size;varying vec2 uv;void main(void) {vec3 cornerPos;cornerPos.xy=vec2(offset.x-0.5,offset.y-0.5)*size;cornerPos.z=0.0;vec3 viewPos=(view*vec4(position,1.0)).xyz+cornerPos;gl_Position=projection*vec4(viewPos,1.0);uv=offset;}\n";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},55557:(e,t,n)=>{var r=n(78322),i=n(19133),o=n(7164),a=n(81152),s=n(44256),l=n(87074);function c(e,t,n,r){var i,o=1;r===a.Y.TEXTURETYPE_FLOAT?i=new Float32Array(t*n*4):r===a.Y.TEXTURETYPE_HALF_FLOAT?(i=new Uint16Array(t*n*4),o=15360):i=r===a.Y.TEXTURETYPE_UNSIGNED_INTEGER?new Uint32Array(t*n*4):new Uint8Array(t*n*4);for(var s=0;s>S,E=0;E<6;E++)x=b[S][E],y&&(x=c(x,T,T,o)),_.texImage2D(E,S,v,T,T,0,m,p,x);this._bindTextureDirectly(_.TEXTURE_CUBE_MAP,null)}else this.updateRawCubeTexture(g,a,i,o,f);return g.isReady=!0,null==t||t.removePendingData(g),g.onLoadedObservable.notifyObservers(g),g.onLoadedObservable.clear(),h&&h(),[2]}}))}))})(e).catch((function(e){v(void 0,e)}))}),void 0,null==t?void 0:t.offlineProvider,!0,v),g},s.ThinEngine.prototype.createRawTexture2DArray=u(!1),s.ThinEngine.prototype.createRawTexture3D=u(!0),s.ThinEngine.prototype.updateRawTexture2DArray=h(!1),s.ThinEngine.prototype.updateRawTexture3D=h(!0)},55607:(e,t,n)=>{var r=n(98519),i="logDepthVertex";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="#ifdef LOGARITHMICDEPTH\nvertexOutputs.vFragmentDepth=1.0+vertexOutputs.position.w;vertexOutputs.position.z=log2(max(0.000001,vertexOutputs.vFragmentDepth))*uniforms.logarithmicDepthConstant;\n#endif\n")},56017:(e,t,n)=>{n.r(t),n.d(t,{passPixelShader:()=>a});var r=n(98519),i="passPixelShader",o="varying vec2 vUV;uniform sampler2D textureSampler;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) \n{gl_FragColor=texture2D(textureSampler,vUV);}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},56159:(e,t,n)=>{n.r(t),n.d(t,{bumpFragment:()=>a});var r=n(98519),i="bumpFragment",o="vec2 uvOffset=vec2(0.0,0.0);\n#if defined(BUMP) || defined(PARALLAX) || defined(DETAIL)\n#ifdef NORMALXYSCALE\nfloat normalScale=1.0;\n#elif defined(BUMP)\nfloat normalScale=vBumpInfos.y;\n#else\nfloat normalScale=1.0;\n#endif\n#if defined(TANGENT) && defined(NORMAL)\nmat3 TBN=vTBN;\n#elif defined(BUMP)\nvec2 TBNUV=gl_FrontFacing ? vBumpUV : -vBumpUV;mat3 TBN=cotangent_frame(normalW*normalScale,vPositionW,TBNUV,vTangentSpaceParams);\n#else\nvec2 TBNUV=gl_FrontFacing ? vDetailUV : -vDetailUV;mat3 TBN=cotangent_frame(normalW*normalScale,vPositionW,TBNUV,vec2(1.,1.));\n#endif\n#elif defined(ANISOTROPIC)\n#if defined(TANGENT) && defined(NORMAL)\nmat3 TBN=vTBN;\n#else\nvec2 TBNUV=gl_FrontFacing ? vMainUV1 : -vMainUV1;mat3 TBN=cotangent_frame(normalW,vPositionW,TBNUV,vec2(1.,1.));\n#endif\n#endif\n#ifdef PARALLAX\nmat3 invTBN=transposeMat3(TBN);\n#ifdef PARALLAXOCCLUSION\nuvOffset=parallaxOcclusion(invTBN*-viewDirectionW,invTBN*normalW,vBumpUV,vBumpInfos.z);\n#else\nuvOffset=parallaxOffset(invTBN*viewDirectionW,vBumpInfos.z);\n#endif\n#endif\n#ifdef DETAIL\nvec4 detailColor=texture2D(detailSampler,vDetailUV+uvOffset);vec2 detailNormalRG=detailColor.wy*2.0-1.0;float detailNormalB=sqrt(1.-saturate(dot(detailNormalRG,detailNormalRG)));vec3 detailNormal=vec3(detailNormalRG,detailNormalB);\n#endif\n#ifdef BUMP\n#ifdef OBJECTSPACE_NORMALMAP\n#define CUSTOM_FRAGMENT_BUMP_FRAGMENT\nnormalW=normalize(texture2D(bumpSampler,vBumpUV).xyz *2.0-1.0);normalW=normalize(mat3(normalMatrix)*normalW);\n#elif !defined(DETAIL)\nnormalW=perturbNormal(TBN,texture2D(bumpSampler,vBumpUV+uvOffset).xyz,vBumpInfos.y);\n#else\nvec3 bumpNormal=texture2D(bumpSampler,vBumpUV+uvOffset).xyz*2.0-1.0;\n#if DETAIL_NORMALBLENDMETHOD==0 \ndetailNormal.xy*=vDetailInfos.z;vec3 blendedNormal=normalize(vec3(bumpNormal.xy+detailNormal.xy,bumpNormal.z*detailNormal.z));\n#elif DETAIL_NORMALBLENDMETHOD==1 \ndetailNormal.xy*=vDetailInfos.z;bumpNormal+=vec3(0.0,0.0,1.0);detailNormal*=vec3(-1.0,-1.0,1.0);vec3 blendedNormal=bumpNormal*dot(bumpNormal,detailNormal)/bumpNormal.z-detailNormal;\n#endif\nnormalW=perturbNormalBase(TBN,blendedNormal,vBumpInfos.y);\n#endif\n#elif defined(DETAIL)\ndetailNormal.xy*=vDetailInfos.z;normalW=perturbNormalBase(TBN,detailNormal,vDetailInfos.z);\n#endif\n";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]=o);var a={name:i,shader:o}},56174:(e,t,n)=>{var r=n(98519),i="meshUboDeclaration";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#ifdef WEBGL2\nuniform mat4 world;uniform float visibility;\n#else\nlayout(std140,column_major) uniform;uniform Mesh\n{mat4 world;float visibility;};\n#endif\n#define WORLD_UBO\n")},56213:(e,t,n)=>{var r=n(98519),i="uvAttributeDeclaration";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="#ifdef UV{X}\nattribute uv{X}: vec2f;\n#endif\n")},56458:(e,t,n)=>{var r=n(98519),i="logDepthVertex";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#ifdef LOGARITHMICDEPTH\nvFragmentDepth=1.0+gl_Position.w;gl_Position.z=log2(max(0.000001,vFragmentDepth))*logarithmicDepthConstant;\n#endif\n")},56740:(e,t,n)=>{n.d(t,{a6:()=>o,bH:()=>a,rv:()=>r,tk:()=>i});var r=1/2.2,i=2.2,o=(1+Math.sqrt(5))/2,a=.001},56809:(e,t,n)=>{n.r(t),n.d(t,{iblVoxelSlabDebugPixelShaderWGSL:()=>a});var r=n(98519),i="iblVoxelSlabDebugPixelShader",o="varying vNormalizedPosition: vec3f;uniform nearPlane: f32;uniform farPlane: f32;uniform stepSize: f32;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var normPos: vec3f=input.vNormalizedPosition.xyz;var chunkSize: f32=uniforms.stepSize* f32(MAX_DRAW_BUFFERS);var numChunks: f32=1.0/chunkSize;var positionInChunk: f32=fract(normPos.z/chunkSize);var slab: f32=floor(positionInChunk* f32(MAX_DRAW_BUFFERS)) /\nf32(MAX_DRAW_BUFFERS);if (normPos.x<0.0 || normPos.y<0.0 || normPos.z<0.0 ||\nnormPos.x>1.0 || normPos.y>1.0 || normPos.z>1.0) {fragmentOutputs.color= vec4f(0.0,0.0,0.0,0.0);} else {fragmentOutputs.color= vec4f(slab,0.0,0.0,0.75);}}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},56897:(e,t,n)=>{var r=n(98519),i="logDepthFragment";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="#ifdef LOGARITHMICDEPTH\nfragmentOutputs.fragDepth=log2(fragmentInputs.vFragmentDepth)*uniforms.logarithmicDepthConstant*0.5;\n#endif\n")},57170:(e,t,n)=>{n.d(t,{D:()=>o});var r=n(81152),i=n(7164);function o(e,t,n){if(!e||e.LOGARITHMICDEPTH||e.indexOf&&e.indexOf("LOGARITHMICDEPTH")>=0){var o=n.activeCamera;o.mode===r.Y.ORTHOGRAPHIC_CAMERA&&i.V.Error("Logarithmic depth is not compatible with orthographic cameras!",20),t.setFloat("logarithmicDepthConstant",2/(Math.log(o.maxZ+1)/Math.LN2))}}},57315:(e,t,n)=>{n.r(t),n.d(t,{minmaxReduxPixelShaderWGSL:()=>a});var r=n(98519),i="minmaxReduxPixelShader",o="varying vUV: vec2f;var textureSampler: texture_2d;\n#if defined(INITIAL)\nuniform texSize: vec2f;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {let coord=vec2i(fragmentInputs.vUV*(uniforms.texSize-1.0));let f1=textureLoad(textureSampler,coord,0).r;let f2=textureLoad(textureSampler,coord+vec2i(1,0),0).r;let f3=textureLoad(textureSampler,coord+vec2i(1,1),0).r;let f4=textureLoad(textureSampler,coord+vec2i(0,1),0).r;\n#ifdef DEPTH_REDUX\n#ifdef VIEW_DEPTH\nvar minz=3.4e38;if (f1 != 0.0) { minz=f1; }\nif (f2 != 0.0) { minz=min(minz,f2); }\nif (f3 != 0.0) { minz=min(minz,f3); }\nif (f4 != 0.0) { minz=min(minz,f4); }\nlet maxz=max(max(max(f1,f2),f3),f4);\n#else\nlet minz=min(min(min(f1,f2),f3),f4);let maxz=max(max(max(sign(1.0-f1)*f1,sign(1.0-f2)*f2),sign(1.0-f3)*f3),sign(1.0-f4)*f4);\n#endif\n#else\nlet minz=min(min(min(f1,f2),f3),f4);let maxz=max(max(max(f1,f2),f3),f4);\n#endif\nfragmentOutputs.color=vec4f(minz,maxz,0.,0.);}\n#elif defined(MAIN)\nuniform texSize: vec2f;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {let coord=vec2i(fragmentInputs.vUV*(uniforms.texSize-1.0));let f1=textureLoad(textureSampler,coord,0).rg;let f2=textureLoad(textureSampler,coord+vec2i(1,0),0).rg;let f3=textureLoad(textureSampler,coord+vec2i(1,1),0).rg;let f4=textureLoad(textureSampler,coord+vec2i(0,1),0).rg;let minz=min(min(min(f1.x,f2.x),f3.x),f4.x);let maxz=max(max(max(f1.y,f2.y),f3.y),f4.y);fragmentOutputs.color=vec4(minz,maxz,0.,0.);}\n#elif defined(ONEBEFORELAST)\nuniform texSize: vec2i;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {let coord=vec2i(fragmentInputs.vUV*vec2f(uniforms.texSize-1));let f1=textureLoad(textureSampler,coord % uniforms.texSize,0).rg;let f2=textureLoad(textureSampler,(coord+vec2i(1,0)) % uniforms.texSize,0).rg;let f3=textureLoad(textureSampler,(coord+vec2i(1,1)) % uniforms.texSize,0).rg;let f4=textureLoad(textureSampler,(coord+vec2i(0,1)) % uniforms.texSize,0).rg;let minz=min(min(min(f1.x,f2.x),f3.x),f4.x);let maxz=max(max(max(f1.y,f2.y),f3.y),f4.y);fragmentOutputs.color=vec4(minz,maxz,0.,0.);}\n#elif defined(LAST)\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {fragmentOutputs.color=vec4f(0.);if (true) { \ndiscard;}}\n#endif\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},57372:(e,t,n)=>{n.r(t),n.d(t,{extractHighlightsPixelShader:()=>a});var r=n(98519),i=(n(75334),"extractHighlightsPixelShader"),o="#include\nvarying vec2 vUV;uniform sampler2D textureSampler;uniform float threshold;uniform float exposure;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) \n{gl_FragColor=texture2D(textureSampler,vUV);float luma=dot(LuminanceEncodeApprox,gl_FragColor.rgb*exposure);gl_FragColor.rgb=step(threshold,luma)*gl_FragColor.rgb;}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},57475:(e,t,n)=>{n.d(t,{x:()=>o});var r=n(8046),i=n(6927),o=function(){function e(e,t,n,o){if(this._events=new Array,this._currentFrame=0,this._originalValue=new Array,this._originalBlendValue=null,this._offsetsCache={},this._highLimitsCache={},this._stopped=!1,this._blendingFactor=0,this._currentValue=null,this._currentActiveTarget=null,this._directTarget=null,this._targetPath="",this._weight=1,this._absoluteFrameOffset=0,this._previousElapsedTime=0,this._yoyoDirection=1,this._previousAbsoluteFrame=0,this._targetIsArray=!1,this._coreRuntimeAnimation=null,this._animation=t,this._target=e,this._scene=n,this._host=o,this._activeTargets=[],t._runtimeAnimations.push(this),this._animationState={key:0,repeatCount:0,loopMode:this._getCorrectLoopMode()},this._animation.dataType===i.X5.ANIMATIONTYPE_MATRIX&&(this._animationState.workValue=r.uq.Zero()),this._keys=this._animation.getKeys(),this._minFrame=this._keys[0].frame,this._maxFrame=this._keys[this._keys.length-1].frame,this._minValue=this._keys[0].value,this._maxValue=this._keys[this._keys.length-1].value,0!==this._minFrame){var a={frame:0,value:this._minValue};this._keys.splice(0,0,a)}if(this._target instanceof Array){for(var s=0,l=0,c=this._target;l0)for(var d=0,p=h;d1){for(var r=e,i=0;i-1&&this._animation.runtimeAnimations.splice(e,1)},e.prototype.setValue=function(e,t){if(this._targetIsArray)for(var n=0;nn[n.length-1].frame&&(e=n[n.length-1].frame);var r=this._events;if(r.length)for(var i=0;ithis._maxFrame)&&(t=this._minFrame),(nthis._maxFrame)&&(n=this._maxFrame),d=n-t;var p=void 0,f=e*(s.framePerSecond*o)/1e3+this._absoluteFrameOffset,m=0,_=!1,g=r&&this._animationState.loopMode===i.X5.ANIMATIONLOOPMODE_YOYO;if(g){var v=(f-t)/d,y=Math.sin(v*Math.PI);f=Math.abs(y)*d+t;var b=y>=0?1:-1;this._yoyoDirection!==b&&(_=!0),this._yoyoDirection=b}if(this._previousElapsedTime=e,this._previousAbsoluteFrame=f,!r&&n>=t&&(f>=d&&o>0||f<=0&&o<0))u=!1,m=s._getKeyValue(this._maxValue);else if(!r&&t>=n&&(f<=d&&o<0||f>=0&&o>0))u=!1,m=s._getKeyValue(this._minValue);else if(this._animationState.loopMode!==i.X5.ANIMATIONLOOPMODE_CYCLE){var S=n.toString()+t.toString();if(!this._offsetsCache[S]){this._animationState.repeatCount=0,this._animationState.loopMode=i.X5.ANIMATIONLOOPMODE_CYCLE;var T=s._interpolate(t,this._animationState),E=s._interpolate(n,this._animationState);switch(this._animationState.loopMode=this._getCorrectLoopMode(),s.dataType){case i.X5.ANIMATIONTYPE_FLOAT:this._offsetsCache[S]=E-T;break;case i.X5.ANIMATIONTYPE_QUATERNION:case i.X5.ANIMATIONTYPE_VECTOR3:case i.X5.ANIMATIONTYPE_VECTOR2:case i.X5.ANIMATIONTYPE_SIZE:case i.X5.ANIMATIONTYPE_COLOR3:this._offsetsCache[S]=E.subtract(T)}this._highLimitsCache[S]=E}m=this._highLimitsCache[S],p=this._offsetsCache[S]}if(void 0===p)switch(s.dataType){case i.X5.ANIMATIONTYPE_FLOAT:p=0;break;case i.X5.ANIMATIONTYPE_QUATERNION:p=i.ov;break;case i.X5.ANIMATIONTYPE_VECTOR3:p=i.mA;break;case i.X5.ANIMATIONTYPE_VECTOR2:p=i.fY;break;case i.X5.ANIMATIONTYPE_SIZE:p=i.bn;break;case i.X5.ANIMATIONTYPE_COLOR3:p=i.wF;break;case i.X5.ANIMATIONTYPE_COLOR4:p=i.pO}if(this._host&&this._host.syncRoot){var x=this._host.syncRoot;c=t+d*((x.masterFrame-x.fromFrame)/(x.toFrame-x.fromFrame))}else c=f>0&&t>n||f<0&&t0&&this.currentFrame>c||o<0&&this.currentFrame0?0:s.getKeys().length-1}this._currentFrame=c,this._animationState.repeatCount=0===d?0:f/d|0,this._animationState.highLimitValue=m,this._animationState.offsetValue=p}var C=s._interpolate(c,this._animationState);if(this.setValue(C,a),h.length)for(P=0;P=0&&c>=h[P].frame&&h[P].frame>=t||d<0&&c<=h[P].frame&&h[P].frame<=t){var R=h[P];R.isDone||(R.onlyOnce&&(h.splice(P,1),P--),R.isDone=!0,R.action(c))}return u||(this._stopped=!0),u},e}()},57731:(e,t,n)=>{n.d(t,{i:()=>g});var r=n(78322),i=n(6174),o=n(53770),a=n(44957),s=n(66377),l=n(8046),c=n(85405),u=n(7164),h=n(34623),d=n(41190),p=n(25187),f=n(36359),m=n(81152),_=n(12028),g=function(e){function t(n,r,i,a){void 0===a&&(a=!0);var c=e.call(this,n,i,!1)||this;return c._position=l.Pq.Zero(),c._upVector=l.Pq.Up(),c.oblique=null,c._orthoLeft=null,c._orthoRight=null,c._orthoBottom=null,c._orthoTop=null,c.fov=.8,c.projectionPlaneTilt=0,c.minZ=1,c.maxZ=1e4,c.inertia=.9,c._mode=t.PERSPECTIVE_CAMERA,c.isIntermediate=!1,c.viewport=new p.L(0,0,1,1),c.layerMask=268435455,c.fovMode=t.FOVMODE_VERTICAL_FIXED,c.cameraRigMode=t.RIG_MODE_NONE,c.customRenderTargets=[],c.outputRenderTarget=null,c.onViewMatrixChangedObservable=new s.cP,c.onProjectionMatrixChangedObservable=new s.cP,c.onAfterCheckInputsObservable=new s.cP,c.onRestoreStateObservable=new s.cP,c.isRigCamera=!1,c._hasMoved=!1,c._rigCameras=new Array,c._skipRendering=!1,c._projectionMatrix=new l.uq,c._postProcesses=new Array,c._activeMeshes=new o.L(256),c._globalPosition=l.Pq.Zero(),c._computedViewMatrix=l.uq.Identity(),c._doNotComputeProjectionMatrix=!1,c._transformMatrix=l.uq.Zero(),c._refreshFrustumPlanes=!0,c._absoluteRotation=l.PT.Identity(),c._isCamera=!0,c._isLeftCamera=!1,c._isRightCamera=!1,c.getScene().addCamera(c),a&&!c.getScene().activeCamera&&(c.getScene().activeCamera=c),c.position=r,c.renderPassId=c.getScene().getEngine().createRenderPassId("Camera ".concat(n)),c}return(0,r.C6)(t,e),Object.defineProperty(t.prototype,"position",{get:function(){return this._position},set:function(e){this._position=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"upVector",{get:function(){return this._upVector},set:function(e){this._upVector=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"screenArea",{get:function(){var e,n,r,i,o=0,a=0;if(this.mode===t.PERSPECTIVE_CAMERA)this.fovMode===t.FOVMODE_VERTICAL_FIXED?(a=2*this.minZ*Math.tan(this.fov/2),o=this.getEngine().getAspectRatio(this)*a):a=(o=2*this.minZ*Math.tan(this.fov/2))/this.getEngine().getAspectRatio(this);else{var s=this.getEngine().getRenderWidth()/2,l=this.getEngine().getRenderHeight()/2;o=(null!==(e=this.orthoRight)&&void 0!==e?e:s)-(null!==(n=this.orthoLeft)&&void 0!==n?n:-s),a=(null!==(r=this.orthoTop)&&void 0!==r?r:l)-(null!==(i=this.orthoBottom)&&void 0!==i?i:-l)}return o*a},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"orthoLeft",{get:function(){return this._orthoLeft},set:function(e){this._orthoLeft=e;for(var t=0,n=this._rigCameras;t-1?(u.V.Error("You're trying to reuse a post process not defined as reusable."),0):(null==t||t<0?this._postProcesses.push(e):null===this._postProcesses[t]?this._postProcesses[t]=e:this._postProcesses.splice(t,0,e),this._cascadePostProcessesToRigCams(),this._scene.prePassRenderer&&this._scene.prePassRenderer.markAsDirty(),this._postProcesses.indexOf(e))},t.prototype.detachPostProcess=function(e){var t=this._postProcesses.indexOf(e);-1!==t&&(this._postProcesses[t]=null),this._scene.prePassRenderer&&this._scene.prePassRenderer.markAsDirty(),this._cascadePostProcessesToRigCams()},t.prototype.getWorldMatrix=function(){return this._isSynchronizedViewMatrix()||this.getViewMatrix(),this._worldMatrix},t.prototype._getViewMatrix=function(){return l.uq.Identity()},t.prototype.getViewMatrix=function(e){return!e&&this._isSynchronizedViewMatrix()||(this._hasMoved=!0,this.updateCache(),this._computedViewMatrix=this._getViewMatrix(),this._currentRenderId=this.getScene().getRenderId(),this._childUpdateId++,this._refreshFrustumPlanes=!0,this._cameraRigParams&&this._cameraRigParams.vrPreViewMatrix&&this._computedViewMatrix.multiplyToRef(this._cameraRigParams.vrPreViewMatrix,this._computedViewMatrix),this.parent&&this.parent.onViewMatrixChangedObservable&&this.parent.onViewMatrixChangedObservable.notifyObservers(this.parent),this.onViewMatrixChangedObservable.notifyObservers(this),this._computedViewMatrix.invertToRef(this._worldMatrix)),this._computedViewMatrix},t.prototype.freezeProjectionMatrix=function(e){this._doNotComputeProjectionMatrix=!0,void 0!==e&&(this._projectionMatrix=e)},t.prototype.unfreezeProjectionMatrix=function(){this._doNotComputeProjectionMatrix=!1},t.prototype.getProjectionMatrix=function(e){var n,r,i,o,a,s,c,u,h,d,p,f,m,_,g,v,y,b,S;if(this._doNotComputeProjectionMatrix||!e&&this._isSynchronizedProjectionMatrix())return this._projectionMatrix;this._cache.mode=this.mode,this._cache.minZ=this.minZ,this._cache.maxZ=this.maxZ,this._refreshFrustumPlanes=!0;var T=this.getEngine(),E=this.getScene(),x=T.useReverseDepthBuffer;if(this.mode===t.PERSPECTIVE_CAMERA)this._cache.fov=this.fov,this._cache.fovMode=this.fovMode,this._cache.aspectRatio=T.getAspectRatio(this),this._cache.projectionPlaneTilt=this.projectionPlaneTilt,this.minZ<=0&&(this.minZ=.1),(E.useRightHandedSystem?l.uq.PerspectiveFovRHToRef:l.uq.PerspectiveFovLHToRef)(this.fov,T.getAspectRatio(this),x?this.maxZ:this.minZ,x?this.minZ:this.maxZ,this._projectionMatrix,this.fovMode===t.FOVMODE_VERTICAL_FIXED,T.isNDCHalfZRange,this.projectionPlaneTilt,x);else{var P=T.getRenderWidth()/2,C=T.getRenderHeight()/2;E.useRightHandedSystem?this.oblique?l.uq.ObliqueOffCenterRHToRef(null!==(n=this.orthoLeft)&&void 0!==n?n:-P,null!==(r=this.orthoRight)&&void 0!==r?r:P,null!==(i=this.orthoBottom)&&void 0!==i?i:-C,null!==(o=this.orthoTop)&&void 0!==o?o:C,x?this.maxZ:this.minZ,x?this.minZ:this.maxZ,this.oblique.length,this.oblique.angle,this._computeObliqueDistance(this.oblique.offset),this._projectionMatrix,T.isNDCHalfZRange):l.uq.OrthoOffCenterRHToRef(null!==(a=this.orthoLeft)&&void 0!==a?a:-P,null!==(s=this.orthoRight)&&void 0!==s?s:P,null!==(c=this.orthoBottom)&&void 0!==c?c:-C,null!==(u=this.orthoTop)&&void 0!==u?u:C,x?this.maxZ:this.minZ,x?this.minZ:this.maxZ,this._projectionMatrix,T.isNDCHalfZRange):this.oblique?l.uq.ObliqueOffCenterLHToRef(null!==(h=this.orthoLeft)&&void 0!==h?h:-P,null!==(d=this.orthoRight)&&void 0!==d?d:P,null!==(p=this.orthoBottom)&&void 0!==p?p:-C,null!==(f=this.orthoTop)&&void 0!==f?f:C,x?this.maxZ:this.minZ,x?this.minZ:this.maxZ,this.oblique.length,this.oblique.angle,this._computeObliqueDistance(this.oblique.offset),this._projectionMatrix,T.isNDCHalfZRange):l.uq.OrthoOffCenterLHToRef(null!==(m=this.orthoLeft)&&void 0!==m?m:-P,null!==(_=this.orthoRight)&&void 0!==_?_:P,null!==(g=this.orthoBottom)&&void 0!==g?g:-C,null!==(v=this.orthoTop)&&void 0!==v?v:C,x?this.maxZ:this.minZ,x?this.minZ:this.maxZ,this._projectionMatrix,T.isNDCHalfZRange),this._cache.orthoLeft=this.orthoLeft,this._cache.orthoRight=this.orthoRight,this._cache.orthoBottom=this.orthoBottom,this._cache.orthoTop=this.orthoTop,this._cache.obliqueAngle=null===(y=this.oblique)||void 0===y?void 0:y.angle,this._cache.obliqueLength=null===(b=this.oblique)||void 0===b?void 0:b.length,this._cache.obliqueOffset=null===(S=this.oblique)||void 0===S?void 0:S.offset,this._cache.renderWidth=T.getRenderWidth(),this._cache.renderHeight=T.getRenderHeight()}return this.onProjectionMatrixChangedObservable.notifyObservers(this),this._projectionMatrix},t.prototype.getTransformationMatrix=function(){return this._computedViewMatrix.multiplyToRef(this._projectionMatrix,this._transformMatrix),this._transformMatrix},t.prototype._computeObliqueDistance=function(e){return(this.radius||(this.target?l.Pq.Distance(this.position,this.target):this.position.length()))+e},t.prototype._updateFrustumPlanes=function(){this._refreshFrustumPlanes&&(this.getTransformationMatrix(),this._frustumPlanes?f.P.GetPlanesToRef(this._transformMatrix,this._frustumPlanes):this._frustumPlanes=f.P.GetPlanes(this._transformMatrix),this._refreshFrustumPlanes=!1)},t.prototype.isInFrustum=function(e,t){if(void 0===t&&(t=!1),this._updateFrustumPlanes(),t&&this.rigCameras.length>0){for(var n=!1,r=0,i=this.rigCameras;r0;){var i=this._rigCameras.pop();i&&i.dispose()}if(this._parentContainer){var o=this._parentContainer.cameras.indexOf(this);o>-1&&this._parentContainer.cameras.splice(o,1),this._parentContainer=null}if(this._rigPostProcess)this._rigPostProcess.dispose(this),this._rigPostProcess=null,this._postProcesses.length=0;else if(this.cameraRigMode!==t.RIG_MODE_NONE)this._rigPostProcess=null,this._postProcesses.length=0;else for(var a=this._postProcesses.length;--a>=0;){var s=this._postProcesses[a];s&&s.dispose(this)}for(var l=this.customRenderTargets.length;--l>=0;)this.customRenderTargets[l].dispose();this.customRenderTargets.length=0,this._activeMeshes.dispose(),this.getScene().getEngine().releaseRenderPassId(this.renderPassId),e.prototype.dispose.call(this,n,r)},Object.defineProperty(t.prototype,"isLeftCamera",{get:function(){return this._isLeftCamera},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isRightCamera",{get:function(){return this._isRightCamera},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"leftCamera",{get:function(){return this._rigCameras.length<1?null:this._rigCameras[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rightCamera",{get:function(){return this._rigCameras.length<2?null:this._rigCameras[1]},enumerable:!1,configurable:!0}),t.prototype.getLeftTarget=function(){return this._rigCameras.length<1?null:this._rigCameras[0].getTarget()},t.prototype.getRightTarget=function(){return this._rigCameras.length<2?null:this._rigCameras[1].getTarget()},t.prototype.setCameraRigMode=function(e,n){if(this.cameraRigMode!==e){for(;this._rigCameras.length>0;){var r=this._rigCameras.pop();r&&r.dispose()}if(this.cameraRigMode=e,this._cameraRigParams={},this._cameraRigParams.interaxialDistance=n.interaxialDistance||.0637,this._cameraRigParams.stereoHalfAngle=a.S0.ToRadians(this._cameraRigParams.interaxialDistance/.0637),this.cameraRigMode!==t.RIG_MODE_NONE){var i=this.createRigCamera(this.name+"_L",0);i&&(i._isLeftCamera=!0);var o=this.createRigCamera(this.name+"_R",1);o&&(o._isRightCamera=!0),i&&o&&(this._rigCameras.push(i),this._rigCameras.push(o))}this._setRigMode(n),this._cascadePostProcessesToRigCams(),this.update()}},t.prototype._setRigMode=function(e){},t.prototype._getVRProjectionMatrix=function(){return l.uq.PerspectiveFovLHToRef(this._cameraRigParams.vrMetrics.aspectRatioFov,this._cameraRigParams.vrMetrics.aspectRatio,this.minZ,this.maxZ,this._cameraRigParams.vrWorkMatrix,!0,this.getEngine().isNDCHalfZRange),this._cameraRigParams.vrWorkMatrix.multiplyToRef(this._cameraRigParams.vrHMatrix,this._projectionMatrix),this._projectionMatrix},t.prototype.setCameraRigParameter=function(e,t){this._cameraRigParams||(this._cameraRigParams={}),this._cameraRigParams[e]=t,"interaxialDistance"===e&&(this._cameraRigParams.stereoHalfAngle=a.S0.ToRadians(t/.0637))},t.prototype.createRigCamera=function(e,t){return null},t.prototype._updateRigCameras=function(){for(var e=0;e{n.r(t),n.d(t,{FlowGraphSequenceBlock:()=>o});var r=n(78322),i=n(34623),o=function(e){function t(t){var n=e.call(this,t)||this;return n.config=t,n.executionSignals=[],n.setNumberOfOutputSignals(n.config.outputSignalCount),n}return(0,r.C6)(t,e),t.prototype._execute=function(e){for(var t=0;te;){var t=this.executionSignals.pop();t&&(t.disconnectFromAll(),this._unregisterSignalOutput(t.name))}for(;this.executionSignals.length{n.r(t),n.d(t,{backgroundVertexShader:()=>s});var r=n(98519),i="backgroundVertexDeclaration";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="uniform mat4 view;uniform mat4 viewProjection;\n#ifdef MULTIVIEW\nuniform mat4 viewProjectionR;\n#endif\nuniform float shadowLevel;\n#ifdef DIFFUSE\nuniform mat4 diffuseMatrix;uniform vec2 vDiffuseInfos;\n#endif\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;uniform mat4 reflectionMatrix;uniform vec3 vReflectionMicrosurfaceInfos;uniform float fFovMultiplier;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n"),n(27947),n(75334),n(36470),n(64400),n(38615),n(85637),n(72153),n(94785),n(48961),n(59262),n(35397),n(76898),n(49334),n(83057),n(62589),n(62136),n(56458);var o="backgroundVertexShader",a="precision highp float;\n#include<__decl__backgroundVertex>\n#include\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#include\n#include\n#include\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef MAINUV1\nvarying vec2 vMainUV1;\n#endif\n#ifdef MAINUV2\nvarying vec2 vMainUV2;\n#endif\n#if defined(DIFFUSE) && DIFFUSEDIRECTUV==0\nvarying vec2 vDiffuseUV;\n#endif\n#include\n#include\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#include\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef REFLECTIONMAP_SKYBOX\nvPositionUVW=position;\n#endif\n#include\n#include\n#include\n#ifdef MULTIVIEW\nif (gl_ViewID_OVR==0u) {gl_Position=viewProjection*finalWorld*vec4(position,1.0);} else {gl_Position=viewProjectionR*finalWorld*vec4(position,1.0);}\n#else\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\n#endif\nvec4 worldPos=finalWorld*vec4(position,1.0);vPositionW=vec3(worldPos);\n#ifdef NORMAL\nmat3 normalWorld=mat3(finalWorld);\n#ifdef NONUNIFORMSCALING\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\n#endif\nvNormalW=normalize(normalWorld*normal);\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvDirectionW=normalize(vec3(finalWorld*vec4(position,0.0)));\n#ifdef EQUIRECTANGULAR_RELFECTION_FOV\nmat3 screenToWorld=inverseMat3(mat3(finalWorld*viewProjection));vec3 segment=mix(vDirectionW,screenToWorld*vec3(0.0,0.0,1.0),abs(fFovMultiplier-1.0));if (fFovMultiplier<=1.0) {vDirectionW=normalize(segment);} else {vDirectionW=normalize(vDirectionW+(vDirectionW-segment));}\n#endif\n#endif\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef MAINUV1\nvMainUV1=uv;\n#endif\n#ifdef MAINUV2\nvMainUV2=uv2;\n#endif\n#if defined(DIFFUSE) && DIFFUSEDIRECTUV==0\nif (vDiffuseInfos.x==0.)\n{vDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));}\nelse\n{vDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));}\n#endif\n#include\n#include\n#include[0..maxSimultaneousLights]\n#ifdef VERTEXCOLOR\nvColor=colorUpdated;\n#endif\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#include\n#define CUSTOM_VERTEX_MAIN_END\n}\n";r.l.ShadersStore[o]||(r.l.ShadersStore[o]=a);var s={name:o,shader:a}},58036:(e,t,n)=>{n.r(t),n.d(t,{chromaticAberrationPixelShaderWGSL:()=>a});var r=n(98519),i="chromaticAberrationPixelShader",o="varying vUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d;uniform chromatic_aberration: f32;uniform radialIntensity: f32;uniform direction: vec2f;uniform centerPosition: vec2f;uniform screen_width: f32;uniform screen_height: f32;\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var centered_screen_pos: vec2f= vec2f(input.vUV.x-uniforms.centerPosition.x,input.vUV.y-uniforms.centerPosition.y);var directionOfEffect: vec2f=uniforms.direction;if(directionOfEffect.x==0. && directionOfEffect.y==0.){directionOfEffect=normalize(centered_screen_pos);}\nvar radius2: f32=centered_screen_pos.x*centered_screen_pos.x\n+ centered_screen_pos.y*centered_screen_pos.y;var radius: f32=sqrt(radius2);var ref_indices: vec3f= vec3f(-0.3,0.0,0.3);var ref_shiftX: f32=uniforms.chromatic_aberration*pow(radius,uniforms.radialIntensity)*directionOfEffect.x/uniforms.screen_width;var ref_shiftY: f32=uniforms.chromatic_aberration*pow(radius,uniforms.radialIntensity)*directionOfEffect.y/uniforms.screen_height;var ref_coords_r: vec2f=vec2f(input.vUV.x+ref_indices.r*ref_shiftX,input.vUV.y+ref_indices.r*ref_shiftY*0.5);var ref_coords_g: vec2f=vec2f(input.vUV.x+ref_indices.g*ref_shiftX,input.vUV.y+ref_indices.g*ref_shiftY*0.5);var ref_coords_b: vec2f=vec2f(input.vUV.x+ref_indices.b*ref_shiftX,input.vUV.y+ref_indices.b*ref_shiftY*0.5);var r=textureSample(textureSampler,textureSamplerSampler,ref_coords_r);var g=textureSample(textureSampler,textureSamplerSampler,ref_coords_g);var b=textureSample(textureSampler,textureSamplerSampler,ref_coords_b);var a=clamp(r.a+g.a+b.a,0.,1.);fragmentOutputs.color=vec4f(r.r,g.g,b.b,a);}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},58266:(e,t,n)=>{n.r(t),n.d(t,{morphTargetsVertexGlobal:()=>a});var r=n(98519),i="morphTargetsVertexGlobal",o="#ifdef MORPHTARGETS\n#ifdef MORPHTARGETS_TEXTURE\nfloat vertexID;\n#endif\n#endif\n";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]=o);var a={name:i,shader:o}},58902:(e,t,n)=>{n.r(t),n.d(t,{lightVxUboDeclarationWGSL:()=>a});var r=n(98519),i="lightVxUboDeclaration",o="#ifdef LIGHT{X}\nstruct Light{X}\n{vLightData: vec4f,\nvLightDiffuse: vec4f,\nvLightSpecular: vec4f,\n#ifdef SPOTLIGHT{X}\nvLightDirection: vec4f,\nvLightFalloff: vec4f,\n#elif defined(POINTLIGHT{X})\nvLightFalloff: vec4f,\n#elif defined(HEMILIGHT{X})\nvLightGround: vec3f,\n#elif defined(CLUSTLIGHT{X})\nvSliceData: vec2f,\nvSliceRanges: array,\n#endif\n#if defined(AREALIGHT{X})\nvLightWidth: vec4f,\nvLightHeight: vec4f,\n#endif\nshadowsInfo: vec4f,\ndepthValues: vec2f} ;var light{X} : Light{X};\n#ifdef SHADOW{X}\n#ifdef SHADOWCSM{X}\nuniform lightMatrix{X}: array;varying vPositionFromLight{X}_0: vec4f;varying vDepthMetric{X}_0: f32;varying vPositionFromLight{X}_1: vec4f;varying vDepthMetric{X}_1: f32;varying vPositionFromLight{X}_2: vec4f;varying vDepthMetric{X}_2: f32;varying vPositionFromLight{X}_3: vec4f;varying vDepthMetric{X}_3: f32;varying vPositionFromCamera{X}: vec4f;\n#elif defined(SHADOWCUBE{X})\n#else\nvarying vPositionFromLight{X}: vec4f;varying vDepthMetric{X}: f32;uniform lightMatrix{X}: mat4x4f;\n#endif\n#endif\n#endif\n";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]=o);var a={name:i,shader:o}},58953:(e,t,n)=>{var r=n(98519),i=(n(48493),"pbrFragmentExtraDeclaration");r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="varying vec3 vPositionW;\n#if DEBUGMODE>0\nvarying vec4 vClipSpacePosition;\n#endif\n#include[1..7]\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\nvarying vec3 vEnvironmentIrradiance;\n#endif\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n")},59012:(e,t,n)=>{var r=n(44256),i=n(26218);r.ThinEngine.prototype.createUniformBuffer=function(e,t){var n=this._gl.createBuffer();if(!n)throw new Error("Unable to create uniform buffer");var r=new i.A(n);return this.bindUniformBuffer(r),e instanceof Float32Array?this._gl.bufferData(this._gl.UNIFORM_BUFFER,e,this._gl.STATIC_DRAW):this._gl.bufferData(this._gl.UNIFORM_BUFFER,new Float32Array(e),this._gl.STATIC_DRAW),this.bindUniformBuffer(null),r.references=1,r},r.ThinEngine.prototype.createDynamicUniformBuffer=function(e,t){var n=this._gl.createBuffer();if(!n)throw new Error("Unable to create dynamic uniform buffer");var r=new i.A(n);return this.bindUniformBuffer(r),e instanceof Float32Array?this._gl.bufferData(this._gl.UNIFORM_BUFFER,e,this._gl.DYNAMIC_DRAW):this._gl.bufferData(this._gl.UNIFORM_BUFFER,new Float32Array(e),this._gl.DYNAMIC_DRAW),this.bindUniformBuffer(null),r.references=1,r},r.ThinEngine.prototype.updateUniformBuffer=function(e,t,n,r){this.bindUniformBuffer(e),void 0===n&&(n=0),void 0===r?t instanceof Float32Array?this._gl.bufferSubData(this._gl.UNIFORM_BUFFER,n,t):this._gl.bufferSubData(this._gl.UNIFORM_BUFFER,n,new Float32Array(t)):t instanceof Float32Array?this._gl.bufferSubData(this._gl.UNIFORM_BUFFER,0,t.subarray(n,n+r)):this._gl.bufferSubData(this._gl.UNIFORM_BUFFER,0,new Float32Array(t).subarray(n,n+r)),this.bindUniformBuffer(null)},r.ThinEngine.prototype.bindUniformBuffer=function(e){this._gl.bindBuffer(this._gl.UNIFORM_BUFFER,e?e.underlyingResource:null)},r.ThinEngine.prototype.bindUniformBufferBase=function(e,t,n){this._gl.bindBufferBase(this._gl.UNIFORM_BUFFER,t,e?e.underlyingResource:null)},r.ThinEngine.prototype.bindUniformBlock=function(e,t,n){var r=e.program,i=this._gl.getUniformBlockIndex(r,t);4294967295!==i&&this._gl.uniformBlockBinding(r,i,n)}},59115:(e,t,n)=>{n.r(t),n.d(t,{shadowsVertexWGSL:()=>a});var r=n(98519),i="shadowsVertex",o="#ifdef SHADOWS\n#if defined(SHADOWCSM{X})\nvertexOutputs.vPositionFromCamera{X}=scene.view*worldPos;\n#if SHADOWCSMNUM_CASCADES{X}>0\nvertexOutputs.vPositionFromLight{X}_0=uniforms.lightMatrix{X}[0]*worldPos;\n#ifdef USE_REVERSE_DEPTHBUFFER\nvertexOutputs.vDepthMetric{X}_0=(-vertexOutputs.vPositionFromLight{X}_0.z+light{X}.depthValues.x)/light{X}.depthValues.y;\n#else\nvertexOutputs.vDepthMetric{X}_0= (vertexOutputs.vPositionFromLight{X}_0.z+light{X}.depthValues.x)/light{X}.depthValues.y;\n#endif\n#endif\n#if SHADOWCSMNUM_CASCADES{X}>1\nvertexOutputs.vPositionFromLight{X}_1=uniforms.lightMatrix{X}[1]*worldPos;\n#ifdef USE_REVERSE_DEPTHBUFFER\nvertexOutputs.vDepthMetric{X}_1=(-vertexOutputs.vPositionFromLight{X}_1.z+light{X}.depthValues.x)/light{X}.depthValues.y;\n#else\nvertexOutputs.vDepthMetric{X}_1= (vertexOutputs.vPositionFromLight{X}_1.z+light{X}.depthValues.x)/light{X}.depthValues.y;\n#endif\n#endif \n#if SHADOWCSMNUM_CASCADES{X}>2\nvertexOutputs.vPositionFromLight{X}_2=uniforms.lightMatrix{X}[2]*worldPos;\n#ifdef USE_REVERSE_DEPTHBUFFER\nvertexOutputs.vDepthMetric{X}_2=(-vertexOutputs.vPositionFromLight{X}_2.z+light{X}.depthValues.x)/light{X}.depthValues.y;\n#else\nvertexOutputs.vDepthMetric{X}_2= (vertexOutputs.vPositionFromLight{X}_2.z+light{X}.depthValues.x)/light{X}.depthValues.y;\n#endif\n#endif \n#if SHADOWCSMNUM_CASCADES{X}>3\nvertexOutputs.vPositionFromLight{X}_3=uniforms.lightMatrix{X}[3]*worldPos;\n#ifdef USE_REVERSE_DEPTHBUFFER\nvertexOutputs.vDepthMetric{X}_3=(-vertexOutputs.vPositionFromLight{X}_3.z+light{X}.depthValues.x)/light{X}.depthValues.y;\n#else\nvertexOutputs.vDepthMetric{X}_3= (vertexOutputs.vPositionFromLight{X}_3.z+light{X}.depthValues.x)/light{X}.depthValues.y;\n#endif\n#endif \n#elif defined(SHADOW{X}) && !defined(SHADOWCUBE{X})\nvertexOutputs.vPositionFromLight{X}=uniforms.lightMatrix{X}*worldPos;\n#ifdef USE_REVERSE_DEPTHBUFFER\nvertexOutputs.vDepthMetric{X}=(-vertexOutputs.vPositionFromLight{X}.z+light{X}.depthValues.x)/light{X}.depthValues.y;\n#else\nvertexOutputs.vDepthMetric{X}=(vertexOutputs.vPositionFromLight{X}.z+light{X}.depthValues.x)/light{X}.depthValues.y;\n#endif\n#endif\n#endif\n";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]=o);var a={name:i,shader:o}},59210:(e,t,n)=>{n.r(t),n.d(t,{fxaaPixelShader:()=>a});var r=n(98519),i="fxaaPixelShader",o="#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\n#define TEXTUREFUNC(s,c,l) texture2DLodEXT(s,c,l)\n#else\n#define TEXTUREFUNC(s,c,b) texture2D(s,c,b)\n#endif\nuniform sampler2D textureSampler;uniform vec2 texelSize;varying vec2 vUV;varying vec2 sampleCoordS;varying vec2 sampleCoordE;varying vec2 sampleCoordN;varying vec2 sampleCoordW;varying vec2 sampleCoordNW;varying vec2 sampleCoordSE;varying vec2 sampleCoordNE;varying vec2 sampleCoordSW;const float fxaaQualitySubpix=1.0;const float fxaaQualityEdgeThreshold=0.166;const float fxaaQualityEdgeThresholdMin=0.0833;const vec3 kLumaCoefficients=vec3(0.2126,0.7152,0.0722);\n#define FxaaLuma(rgba) dot(rgba.rgb,kLumaCoefficients)\nvoid main(){vec2 posM;posM.x=vUV.x;posM.y=vUV.y;vec4 rgbyM=TEXTUREFUNC(textureSampler,vUV,0.0);float lumaM=FxaaLuma(rgbyM);float lumaS=FxaaLuma(TEXTUREFUNC(textureSampler,sampleCoordS,0.0));float lumaE=FxaaLuma(TEXTUREFUNC(textureSampler,sampleCoordE,0.0));float lumaN=FxaaLuma(TEXTUREFUNC(textureSampler,sampleCoordN,0.0));float lumaW=FxaaLuma(TEXTUREFUNC(textureSampler,sampleCoordW,0.0));float maxSM=max(lumaS,lumaM);float minSM=min(lumaS,lumaM);float maxESM=max(lumaE,maxSM);float minESM=min(lumaE,minSM);float maxWN=max(lumaN,lumaW);float minWN=min(lumaN,lumaW);float rangeMax=max(maxWN,maxESM);float rangeMin=min(minWN,minESM);float rangeMaxScaled=rangeMax*fxaaQualityEdgeThreshold;float range=rangeMax-rangeMin;float rangeMaxClamped=max(fxaaQualityEdgeThresholdMin,rangeMaxScaled);\n#ifndef MALI\nif(range=edgeVert;float subpixA=subpixNSWE*2.0+subpixNWSWNESE;if (!horzSpan)\n{lumaN=lumaW;}\nif (!horzSpan) \n{lumaS=lumaE;}\nif (horzSpan) \n{lengthSign=texelSize.y;}\nfloat subpixB=(subpixA*(1.0/12.0))-lumaM;float gradientN=lumaN-lumaM;float gradientS=lumaS-lumaM;float lumaNN=lumaN+lumaM;float lumaSS=lumaS+lumaM;bool pairN=abs(gradientN)>=abs(gradientS);float gradient=max(abs(gradientN),abs(gradientS));if (pairN)\n{lengthSign=-lengthSign;}\nfloat subpixC=clamp(abs(subpixB)*subpixRcpRange,0.0,1.0);vec2 posB;posB.x=posM.x;posB.y=posM.y;vec2 offNP;offNP.x=(!horzSpan) ? 0.0 : texelSize.x;offNP.y=(horzSpan) ? 0.0 : texelSize.y;if (!horzSpan) \n{posB.x+=lengthSign*0.5;}\nif (horzSpan)\n{posB.y+=lengthSign*0.5;}\nvec2 posN;posN.x=posB.x-offNP.x*1.5;posN.y=posB.y-offNP.y*1.5;vec2 posP;posP.x=posB.x+offNP.x*1.5;posP.y=posB.y+offNP.y*1.5;float subpixD=((-2.0)*subpixC)+3.0;float lumaEndN=FxaaLuma(TEXTUREFUNC(textureSampler,posN,0.0));float subpixE=subpixC*subpixC;float lumaEndP=FxaaLuma(TEXTUREFUNC(textureSampler,posP,0.0));if (!pairN) \n{lumaNN=lumaSS;}\nfloat gradientScaled=gradient*1.0/4.0;float lumaMM=lumaM-lumaNN*0.5;float subpixF=subpixD*subpixE;bool lumaMLTZero=lumaMM<0.0;lumaEndN-=lumaNN*0.5;lumaEndP-=lumaNN*0.5;bool doneN=abs(lumaEndN)>=gradientScaled;bool doneP=abs(lumaEndP)>=gradientScaled;if (!doneN) \n{posN.x-=offNP.x*3.0;}\nif (!doneN) \n{posN.y-=offNP.y*3.0;}\nbool doneNP=(!doneN) || (!doneP);if (!doneP) \n{posP.x+=offNP.x*3.0;}\nif (!doneP)\n{posP.y+=offNP.y*3.0;}\nif (doneNP)\n{if (!doneN) lumaEndN=FxaaLuma(TEXTUREFUNC(textureSampler,posN.xy,0.0));if (!doneP) lumaEndP=FxaaLuma(TEXTUREFUNC(textureSampler,posP.xy,0.0));if (!doneN) lumaEndN=lumaEndN-lumaNN*0.5;if (!doneP) lumaEndP=lumaEndP-lumaNN*0.5;doneN=abs(lumaEndN)>=gradientScaled;doneP=abs(lumaEndP)>=gradientScaled;if (!doneN) posN.x-=offNP.x*12.0;if (!doneN) posN.y-=offNP.y*12.0;doneNP=(!doneN) || (!doneP);if (!doneP) posP.x+=offNP.x*12.0;if (!doneP) posP.y+=offNP.y*12.0;}\nfloat dstN=posM.x-posN.x;float dstP=posP.x-posM.x;if (!horzSpan)\n{dstN=posM.y-posN.y;}\nif (!horzSpan) \n{dstP=posP.y-posM.y;}\nbool goodSpanN=(lumaEndN<0.0) != lumaMLTZero;float spanLength=(dstP+dstN);bool goodSpanP=(lumaEndP<0.0) != lumaMLTZero;float spanLengthRcp=1.0/spanLength;bool directionN=dstN{n.r(t),n.d(t,{iblIcdfPixelShaderWGSL:()=>a});var r=n(98519),i=(n(17393),"iblIcdfPixelShader"),o="#include\nvarying vUV: vec2f;\n#ifdef IBL_USE_CUBE_MAP\nvar iblSourceSampler: sampler;var iblSource: texture_cube;\n#else\nvar iblSourceSampler: sampler;var iblSource: texture_2d;\n#endif\nvar scaledLuminanceSamplerSampler : sampler;var scaledLuminanceSampler : texture_2d;var cdfx: texture_2d;var cdfy: texture_2d;fn fetchLuminance(coords: vec2f)->f32 {\n#ifdef IBL_USE_CUBE_MAP\nvar direction: vec3f=equirectangularToCubemapDirection(coords);var color: vec3f=textureSampleLevel(iblSource,iblSourceSampler,direction,0.0).rgb;\n#else\nvar color: vec3f=textureSampleLevel(iblSource,iblSourceSampler,coords,0.0).rgb;\n#endif\nreturn dot(color,LuminanceEncodeApprox);}\nfn fetchCDFx(x: u32)->f32 {return textureLoad(cdfx, vec2u(x,0),0).x;}\nfn bisectx(size: u32,targetValue: f32)->f32\n{var a: u32=0;var b=size-1;while (b-a>1) {var c: u32=(a+b)>>1;if (fetchCDFx(c)f32 {return textureLoad(cdfy, vec2u(invocationId,y),0).x;}\nfn bisecty(size: u32,targetValue: f32,invocationId: u32)->f32\n{var a: u32=0;var b=size-1;while (b-a>1) {var c=(a+b)>>1;if (fetchCDFy(c,invocationId)FragmentOutputs {var cdfxSize: vec2u=textureDimensions(cdfx,0);var cdfWidth: u32=cdfxSize.x;var icdfWidth: u32=cdfWidth-1;var currentPixel: vec2u= vec2u(fragmentInputs.position.xy);var outputColor: vec3f=vec3f(1.0);if (currentPixel.x==0)\n{outputColor.x= 0.0;}\nelse if (currentPixel.x==icdfWidth-1) {outputColor.x= 1.0;} else {var targetValue: f32=fetchCDFx(cdfWidth-1)*input.vUV.x;outputColor.x= bisectx(cdfWidth,targetValue);}\nvar cdfySize: vec2u=textureDimensions(cdfy,0);var cdfHeight: u32=cdfySize.y;if (currentPixel.y==0) {outputColor.y= 0.0;}\nelse if (currentPixel.y==cdfHeight-2) {outputColor.y= 1.0;} else {var targetValue: f32=fetchCDFy(cdfHeight-1,currentPixel.x)*input.vUV.y;outputColor.y= max(bisecty(cdfHeight,targetValue,currentPixel.x),0.0);}\nvar size : vec2f=vec2f(textureDimensions(scaledLuminanceSampler,0));var highestMip: f32=floor(log2(size.x));var normalization : f32=textureSampleLevel(scaledLuminanceSampler,\nscaledLuminanceSamplerSampler,\ninput.vUV,highestMip)\n.r;var pixelLuminance: f32=fetchLuminance(input.vUV);outputColor.z=pixelLuminance/(2.0*PI*normalization);fragmentOutputs.color=vec4( outputColor,1.0);}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},59262:(e,t,n)=>{var r=n(98519),i="logDepthDeclaration";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#ifdef LOGARITHMICDEPTH\nuniform float logarithmicDepthConstant;varying float vFragmentDepth;\n#endif\n")},59437:(e,t,n)=>{n.d(t,{w:()=>r});var r=function(){function e(){this._count=0,this._data={}}return e.prototype.copyFrom=function(e){var t=this;this.clear(),e.forEach((function(e,n){return t.add(e,n)}))},e.prototype.get=function(e){var t=this._data[e];if(void 0!==t)return t},e.prototype.getOrAddWithFactory=function(e,t){var n=this.get(e);return void 0!==n||(n=t(e))&&this.add(e,n),n},e.prototype.getOrAdd=function(e,t){var n=this.get(e);return void 0!==n?n:(this.add(e,t),t)},e.prototype.contains=function(e){return void 0!==this._data[e]},e.prototype.add=function(e,t){return void 0===this._data[e]&&(this._data[e]=t,++this._count,!0)},e.prototype.set=function(e,t){return void 0!==this._data[e]&&(this._data[e]=t,!0)},e.prototype.getAndRemove=function(e){var t=this.get(e);return void 0!==t?(delete this._data[e],--this._count,t):null},e.prototype.remove=function(e){return!!this.contains(e)&&(delete this._data[e],--this._count,!0)},e.prototype.clear=function(){this._data={},this._count=0},Object.defineProperty(e.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),e.prototype.forEach=function(e){for(var t in this._data)e(t,this._data[t])},e.prototype.first=function(e){for(var t in this._data){var n=e(t,this._data[t]);if(n)return n}return null},e}()},59448:(e,t,n)=>{n.r(t),n.d(t,{passPixelShaderWGSL:()=>a});var r=n(98519),i="passPixelShader",o="varying vUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d;\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {fragmentOutputs.color=textureSample(textureSampler,textureSamplerSampler,input.vUV);}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},59465:(e,t,n)=>{n.d(t,{e:()=>i});var r=n(78322),i=function(e){function t(t,n){return e.call(this,t,n,3)||this}return(0,r.C6)(t,e),t.prototype.connect=function(e){if(!this._connect(e))throw new Error("Connect failed")},t.prototype.disconnect=function(e){if(!this._disconnect(e))throw new Error("Disconnect failed")},t.prototype.disconnectAll=function(){if(!this._downstreamNodes)throw new Error("Disconnect failed");for(var e=this._downstreamNodes.values(),t=e.next();!t.done;t=e.next())if(!this._disconnect(t.value))throw new Error("Disconnect failed")},t}(n(95087).Ui)},59581:(e,t,n)=>{n.r(t),n.d(t,{imageProcessingDeclaration:()=>a});var r=n(98519),i="imageProcessingDeclaration",o="#ifdef EXPOSURE\nuniform float exposureLinear;\n#endif\n#ifdef CONTRAST\nuniform float contrast;\n#endif\n#if defined(VIGNETTE) || defined(DITHER)\nuniform vec2 vInverseScreenSize;\n#endif\n#ifdef VIGNETTE\nuniform vec4 vignetteSettings1;uniform vec4 vignetteSettings2;\n#endif\n#ifdef COLORCURVES\nuniform vec4 vCameraColorCurveNegative;uniform vec4 vCameraColorCurveNeutral;uniform vec4 vCameraColorCurvePositive;\n#endif\n#ifdef COLORGRADING\n#ifdef COLORGRADING3D\nuniform highp sampler3D txColorTransform;\n#else\nuniform sampler2D txColorTransform;\n#endif\nuniform vec4 colorTransformSettings;\n#endif\n#ifdef DITHER\nuniform float ditherIntensity;\n#endif\n";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]=o);var a={name:i,shader:o}},59586:(e,t,n)=>{n.r(t),n.d(t,{hdrFilteringPixelShader:()=>a});var r=n(98519),i=(n(75334),n(19568),n(64244),n(10114),"hdrFilteringPixelShader"),o="#include\n#include\n#include\n#include\nuniform float alphaG;uniform samplerCube inputTexture;uniform vec2 vFilteringInfo;uniform float hdrScale;varying vec3 direction;void main() {vec3 color=radiance(alphaG,inputTexture,direction,vFilteringInfo);gl_FragColor=vec4(color*hdrScale,1.0);}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},59681:(e,t,n)=>{var r=n(98519),i=(n(56897),n(83512),"gaussianSplattingFragmentDeclaration");r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="fn gaussianColor(inColor: vec4f,inPosition: vec2f)->vec4f\n{var A : f32=-dot(inPosition,inPosition);if (A>-4.0)\n{var B: f32=exp(A)*inColor.a;\n#include\nvar color: vec3f=inColor.rgb;\n#ifdef FOG\n#include\n#endif\nreturn vec4f(color,B);} else {return vec4f(0.0);}}\n")},59784:(e,t,n)=>{n.d(t,{o:()=>b});var r=n(78322),i=n(8046),o=n(64726),a=n(62623),s=n(49803),l=n(50582),c=n(41085),u=n(30622),h=n(31489),d=n(81152),p=n(66377),f=n(41190),m=n(67780),_=n(7931),g=n(14777),v=n(34561),y=n(85096),b=function(){function e(t,n,r,o,a,s){void 0===s&&(s=!1),this.onBeforeShadowMapRenderObservable=new p.cP,this.onAfterShadowMapRenderObservable=new p.cP,this.onBeforeShadowMapRenderMeshObservable=new p.cP,this.onAfterShadowMapRenderMeshObservable=new p.cP,this.doNotSerialize=!1,this._bias=5e-5,this._normalBias=0,this._blurBoxOffset=1,this._blurScale=2,this._blurKernel=1,this._useKernelBlur=!1,this._filter=e.FILTER_NONE,this._filteringQuality=e.QUALITY_HIGH,this._contactHardeningLightSizeUVRatio=.1,this._darkness=0,this._transparencyShadow=!1,this.enableSoftTransparentShadow=!1,this.useOpacityTextureForTransparentShadow=!1,this.frustumEdgeFalloff=0,this._shaderLanguage=0,this.forceBackFacesOnly=!1,this._lightDirection=i.Pq.Zero(),this._viewMatrix=i.uq.Zero(),this._projectionMatrix=i.uq.Zero(),this._transformMatrix=i.uq.Zero(),this._cachedPosition=new i.Pq(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cachedDirection=new i.Pq(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._currentFaceIndex=0,this._currentFaceIndexCache=0,this._defaultTextureMatrix=i.uq.Identity(),this._shadersLoaded=!1,this._mapSize=t,this._light=n,this._scene=n.getScene(),this._camera=null!=o?o:null,this._useRedTextureType=!!a,this._initShaderSourceAsync(s);var l=n._shadowGenerators;l||(l=n._shadowGenerators=new Map),l.set(this._camera,this),this.id=n.id,this._useUBO=this._scene.getEngine().supportsUniformBuffers,this._useUBO&&(this._sceneUBOs=[],this._sceneUBOs.push(this._scene.createSceneUniformBuffer('Scene for Shadow Generator (light "'.concat(this._light.name,'")')))),e._SceneComponentInitialization(this._scene);var c=this._scene.getEngine().getCaps();r?c.textureFloatRender&&c.textureFloatLinearFiltering?this._textureType=d.Y.TEXTURETYPE_FLOAT:c.textureHalfFloatRender&&c.textureHalfFloatLinearFiltering?this._textureType=d.Y.TEXTURETYPE_HALF_FLOAT:this._textureType=d.Y.TEXTURETYPE_UNSIGNED_BYTE:c.textureHalfFloatRender&&c.textureHalfFloatLinearFiltering?this._textureType=d.Y.TEXTURETYPE_HALF_FLOAT:c.textureFloatRender&&c.textureFloatLinearFiltering?this._textureType=d.Y.TEXTURETYPE_FLOAT:this._textureType=d.Y.TEXTURETYPE_UNSIGNED_BYTE,this._initializeGenerator(),this._applyFilterValues()}return Object.defineProperty(e.prototype,"bias",{get:function(){return this._bias},set:function(e){this._bias=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"normalBias",{get:function(){return this._normalBias},set:function(e){this._normalBias=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blurBoxOffset",{get:function(){return this._blurBoxOffset},set:function(e){this._blurBoxOffset!==e&&(this._blurBoxOffset=e,this._disposeBlurPostProcesses())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blurScale",{get:function(){return this._blurScale},set:function(e){this._blurScale!==e&&(this._blurScale=e,this._disposeBlurPostProcesses())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blurKernel",{get:function(){return this._blurKernel},set:function(e){this._blurKernel!==e&&(this._blurKernel=e,this._disposeBlurPostProcesses())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"useKernelBlur",{get:function(){return this._useKernelBlur},set:function(e){this._useKernelBlur!==e&&(this._useKernelBlur=e,this._disposeBlurPostProcesses())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"depthScale",{get:function(){return void 0!==this._depthScale?this._depthScale:this._light.getDepthScale()},set:function(e){this._depthScale=e},enumerable:!1,configurable:!0}),e.prototype._validateFilter=function(e){return e},Object.defineProperty(e.prototype,"filter",{get:function(){return this._filter},set:function(t){if(t=this._validateFilter(t),this._light.needCube()){if(t===e.FILTER_BLUREXPONENTIALSHADOWMAP)return void(this.useExponentialShadowMap=!0);if(t===e.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP)return void(this.useCloseExponentialShadowMap=!0);if(t===e.FILTER_PCF||t===e.FILTER_PCSS)return void(this.usePoissonSampling=!0)}t!==e.FILTER_PCF&&t!==e.FILTER_PCSS||this._scene.getEngine()._features.supportShadowSamplers?this._filter!==t&&(this._filter=t,this._disposeBlurPostProcesses(),this._applyFilterValues(),this._light._markMeshesAsLightDirty()):this.usePoissonSampling=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"usePoissonSampling",{get:function(){return this.filter===e.FILTER_POISSONSAMPLING},set:function(t){var n=this._validateFilter(e.FILTER_POISSONSAMPLING);(t||this.filter===e.FILTER_POISSONSAMPLING)&&(this.filter=t?n:e.FILTER_NONE)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"useExponentialShadowMap",{get:function(){return this.filter===e.FILTER_EXPONENTIALSHADOWMAP},set:function(t){var n=this._validateFilter(e.FILTER_EXPONENTIALSHADOWMAP);(t||this.filter===e.FILTER_EXPONENTIALSHADOWMAP)&&(this.filter=t?n:e.FILTER_NONE)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"useBlurExponentialShadowMap",{get:function(){return this.filter===e.FILTER_BLUREXPONENTIALSHADOWMAP},set:function(t){var n=this._validateFilter(e.FILTER_BLUREXPONENTIALSHADOWMAP);(t||this.filter===e.FILTER_BLUREXPONENTIALSHADOWMAP)&&(this.filter=t?n:e.FILTER_NONE)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"useCloseExponentialShadowMap",{get:function(){return this.filter===e.FILTER_CLOSEEXPONENTIALSHADOWMAP},set:function(t){var n=this._validateFilter(e.FILTER_CLOSEEXPONENTIALSHADOWMAP);(t||this.filter===e.FILTER_CLOSEEXPONENTIALSHADOWMAP)&&(this.filter=t?n:e.FILTER_NONE)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"useBlurCloseExponentialShadowMap",{get:function(){return this.filter===e.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP},set:function(t){var n=this._validateFilter(e.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP);(t||this.filter===e.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP)&&(this.filter=t?n:e.FILTER_NONE)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"usePercentageCloserFiltering",{get:function(){return this.filter===e.FILTER_PCF},set:function(t){var n=this._validateFilter(e.FILTER_PCF);(t||this.filter===e.FILTER_PCF)&&(this.filter=t?n:e.FILTER_NONE)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"filteringQuality",{get:function(){return this._filteringQuality},set:function(e){this._filteringQuality!==e&&(this._filteringQuality=e,this._disposeBlurPostProcesses(),this._applyFilterValues(),this._light._markMeshesAsLightDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"useContactHardeningShadow",{get:function(){return this.filter===e.FILTER_PCSS},set:function(t){var n=this._validateFilter(e.FILTER_PCSS);(t||this.filter===e.FILTER_PCSS)&&(this.filter=t?n:e.FILTER_NONE)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"contactHardeningLightSizeUVRatio",{get:function(){return this._contactHardeningLightSizeUVRatio},set:function(e){this._contactHardeningLightSizeUVRatio=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"darkness",{get:function(){return this._darkness},set:function(e){this.setDarkness(e)},enumerable:!1,configurable:!0}),e.prototype.getDarkness=function(){return this._darkness},e.prototype.setDarkness=function(e){return this._darkness=e>=1?1:e<=0?0:e,this},Object.defineProperty(e.prototype,"transparencyShadow",{get:function(){return this._transparencyShadow},set:function(e){this.setTransparencyShadow(e)},enumerable:!1,configurable:!0}),e.prototype.setTransparencyShadow=function(e){return this._transparencyShadow=e,this},e.prototype.getShadowMap=function(){return this._shadowMap},e.prototype.getShadowMapForRendering=function(){return this._shadowMap2?this._shadowMap2:this._shadowMap},e.prototype.getClassName=function(){return e.CLASSNAME},e.prototype.addShadowCaster=function(e,t){if(void 0===t&&(t=!0),!this._shadowMap)return this;if(this._shadowMap.renderList||(this._shadowMap.renderList=[]),-1===this._shadowMap.renderList.indexOf(e)&&this._shadowMap.renderList.push(e),t)for(var n=0,r=e.getChildMeshes();n=s.length)return void(e&&e(n));setTimeout(d,16)}};d()}else e&&e(this)}else e&&e(this)}else e&&e(this)},e.prototype.forceCompilationAsync=function(e){return(0,r.sH)(this,void 0,void 0,(function(){var t=this;return(0,r.YH)(this,(function(n){switch(n.label){case 0:return[4,new Promise((function(n){t.forceCompilation((function(){n()}),e)}))];case 1:return[2,n.sent()]}}))}))},e.prototype._isReadyCustomDefines=function(e,t,n){},e.prototype._prepareShadowDefines=function(e,t,n,r){n.push("#define SM_LIGHTTYPE_"+this._light.getClassName().toUpperCase()),n.push("#define SM_FLOAT "+(this._textureType!==d.Y.TEXTURETYPE_UNSIGNED_BYTE?"1":"0")),n.push("#define SM_ESM "+(this.useExponentialShadowMap||this.useBlurExponentialShadowMap?"1":"0")),n.push("#define SM_DEPTHTEXTURE "+(this.usePercentageCloserFiltering||this.useContactHardeningShadow?"1":"0"));var i=e.getMesh();return n.push("#define SM_NORMALBIAS "+(this.normalBias&&i.isVerticesDataPresent(a.R.NormalKind)?"1":"0")),n.push("#define SM_DIRECTIONINLIGHTDATA "+(this.getLight().getTypeID()===s.v.LIGHTTYPEID_DIRECTIONALLIGHT?"1":"0")),n.push("#define SM_USEDISTANCE "+(this._light.needCube()?"1":"0")),n.push("#define SM_SOFTTRANSPARENTSHADOW "+(this.enableSoftTransparentShadow&&r?"1":"0")),this._isReadyCustomDefines(n,e,t),n},e.prototype.isReady=function(t,n,r){var i;if(!this._shadersLoaded)return!1;var o=t.getMaterial(),s=null==o?void 0:o.shadowDepthWrapper;if(this._opacityTexture=null,!o)return!1;var l=[];if(this._prepareShadowDefines(t,n,l,r),s){if(!s.isReadyForSubMesh(t,l,this,n,this._scene.getEngine().currentRenderPassId))return!1}else{var c=t._getDrawWrapper(void 0,!0),u=c.effect,h=c.defines,d=[a.R.PositionKind],p=t.getMesh(),f=!1,_=!1,g=!1;this.normalBias&&p.isVerticesDataPresent(a.R.NormalKind)&&(d.push(a.R.NormalKind),l.push("#define NORMAL"),f=!0,p.nonUniformScaling&&l.push("#define NONUNIFORMSCALING"));var b=o.needAlphaTestingForMesh(p);if((b||o.needAlphaBlendingForMesh(p))&&(this.useOpacityTextureForTransparentShadow?this._opacityTexture=o.opacityTexture:this._opacityTexture=o.getAlphaTestTexture(),this._opacityTexture)){if(!this._opacityTexture.isReady())return!1;var S=null!==(i=o.alphaCutOff)&&void 0!==i?i:e.DEFAULT_ALPHA_CUTOFF;l.push("#define ALPHATEXTURE"),b&&l.push("#define ALPHATESTVALUE ".concat(S).concat(S%1==0?".":"")),p.isVerticesDataPresent(a.R.UVKind)&&(d.push(a.R.UVKind),l.push("#define UV1"),_=!0),p.isVerticesDataPresent(a.R.UV2Kind)&&1===this._opacityTexture.coordinatesIndex&&(d.push(a.R.UV2Kind),l.push("#define UV2"),g=!0)}var T=new m.J;if(p.useBones&&p.computeBonesUsingShaders&&p.skeleton){d.push(a.R.MatricesIndicesKind),d.push(a.R.MatricesWeightsKind),p.numBoneInfluencers>4&&(d.push(a.R.MatricesIndicesExtraKind),d.push(a.R.MatricesWeightsExtraKind));var E=p.skeleton;l.push("#define NUM_BONE_INFLUENCERS "+p.numBoneInfluencers),p.numBoneInfluencers>0&&T.addCPUSkinningFallback(0,p),E.isUsingTextureForMatrices?l.push("#define BONETEXTURE"):l.push("#define BonesPerMesh "+(E.bones.length+1))}else l.push("#define NUM_BONE_INFLUENCERS 0");var x=p.morphTargetManager?(0,y.Dk)(p.morphTargetManager,l,d,p,!0,f,!1,_,g,!1):0;if((0,v.r4)(o,this._scene,l),n&&(l.push("#define INSTANCES"),(0,y.te)(d),t.getRenderingMesh().hasThinInstances&&l.push("#define THIN_INSTANCES")),this.customShaderOptions&&this.customShaderOptions.defines)for(var P=0,C=this.customShaderOptions.defines;P{n.r(t),n.d(t,{gaussianSplattingPixelShader:()=>s});var r=n(98519),i=(n(27003),n(59262),n(52767),n(13088),n(86343),"gaussianSplattingFragmentDeclaration");r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="vec4 gaussianColor(vec4 inColor)\n{float A=-dot(vPosition,vPosition);if (A<-4.0) discard;float B=exp(A)*inColor.a;\n#include\nvec3 color=inColor.rgb;\n#ifdef FOG\n#include\n#endif\nreturn vec4(color,B);}\n"),n(39643);var o="gaussianSplattingPixelShader",a="#include\n#include\n#include\nvarying vec4 vColor;varying vec2 vPosition;\n#include\nvoid main () { \n#include\ngl_FragColor=gaussianColor(vColor);}\n";r.l.ShadersStore[o]||(r.l.ShadersStore[o]=a);var s={name:o,shader:a}},60257:(e,t,n)=>{function r(e){return void 0!==e.width}function i(e){return r(e)?{width:e.width,height:e.height}:{width:e,height:e}}n.d(t,{e:()=>r,o:()=>i})},60383:(e,t,n)=>{n.r(t),n.d(t,{screenSpaceCurvaturePixelShader:()=>a});var r=n(98519),i="screenSpaceCurvaturePixelShader",o="precision highp float;varying vec2 vUV;uniform sampler2D textureSampler;uniform sampler2D normalSampler;uniform float curvature_ridge;uniform float curvature_valley;\n#ifndef CURVATURE_OFFSET\n#define CURVATURE_OFFSET 1\n#endif\nfloat curvature_soft_clamp(float curvature,float control)\n{if (curvature<0.5/control)\nreturn curvature*(1.0-curvature*control);return 0.25/control;}\nfloat calculate_curvature(ivec2 texel,float ridge,float valley)\n{vec2 normal_up =texelFetch(normalSampler,texel+ivec2(0, CURVATURE_OFFSET),0).rb;vec2 normal_down =texelFetch(normalSampler,texel+ivec2(0,-CURVATURE_OFFSET),0).rb;vec2 normal_left =texelFetch(normalSampler,texel+ivec2(-CURVATURE_OFFSET,0),0).rb;vec2 normal_right=texelFetch(normalSampler,texel+ivec2( CURVATURE_OFFSET,0),0).rb;float normal_diff=((normal_up.g-normal_down.g)+(normal_right.r-normal_left.r));if (normal_diff<0.0)\nreturn -2.0*curvature_soft_clamp(-normal_diff,valley);return 2.0*curvature_soft_clamp(normal_diff,ridge);}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) \n{ivec2 texel=ivec2(gl_FragCoord.xy);vec4 baseColor=texture2D(textureSampler,vUV);float curvature=calculate_curvature(texel,curvature_ridge,curvature_valley);baseColor.rgb*=curvature+1.0;gl_FragColor=baseColor;}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},60581:(e,t,n)=>{var r=n(98519),i="samplerVertexDeclaration";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#if defined(_DEFINENAME_) && _DEFINENAME_DIRECTUV==0\nvarying vec2 v_VARYINGNAME_UV;\n#endif\n")},60738:(e,t,n)=>{n.r(t),n.d(t,{lineVertexShader:()=>l});var r=n(98519),i="lineVertexDeclaration";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="uniform mat4 viewProjection;\n#define ADDITIONAL_VERTEX_DECLARATION\n"),n(50851),n(56174);var o="lineUboDeclaration";r.l.IncludesShadersStore[o]||(r.l.IncludesShadersStore[o]="layout(std140,column_major) uniform;\n#include\n#include\n"),n(38615),n(85637),n(59262),n(35397),n(83057),n(56458);var a="lineVertexShader",s="#include<__decl__lineVertex>\n#include\n#include\nattribute vec3 position;attribute vec4 normal;uniform float width;uniform float aspectRatio;\n#include\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include\nmat4 worldViewProjection=viewProjection*finalWorld;vec4 viewPosition=worldViewProjection*vec4(position,1.0);vec4 viewPositionNext=worldViewProjection*vec4(normal.xyz,1.0);vec2 currentScreen=viewPosition.xy/viewPosition.w;vec2 nextScreen=viewPositionNext.xy/viewPositionNext.w;currentScreen.x*=aspectRatio;nextScreen.x*=aspectRatio;vec2 dir=normalize(nextScreen-currentScreen);vec2 normalDir=vec2(-dir.y,dir.x);normalDir*=width/2.0;normalDir.x/=aspectRatio;vec4 offset=vec4(normalDir*normal.w,0.0,0.0);gl_Position=viewPosition+offset;\n#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4) || defined(CLIPPLANE5) || defined(CLIPPLANE6)\nvec4 worldPos=finalWorld*vec4(position,1.0);\n#include\n#endif\n#include\n#define CUSTOM_VERTEX_MAIN_END\n}";r.l.ShadersStore[a]||(r.l.ShadersStore[a]=s);var l={name:a,shader:s}},60965:(e,t,n)=>{var r=n(98519),i="prePassVertexDeclaration";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#ifdef PREPASS\n#ifdef PREPASS_LOCAL_POSITION\nvarying vec3 vPosition;\n#endif\n#ifdef PREPASS_DEPTH\nvarying vec3 vViewPos;\n#endif\n#ifdef PREPASS_NORMALIZED_VIEW_DEPTH\nvarying float vNormViewDepth;\n#endif\n#if defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR)\nuniform mat4 previousViewProjection;varying vec4 vCurrentPosition;varying vec4 vPreviousPosition;\n#endif\n#endif\n")},61114:(e,t,n)=>{n.r(t),n.d(t,{hdrIrradianceFilteringVertexShader:()=>a});var r=n(98519),i="hdrIrradianceFilteringVertexShader",o="attribute vec2 position;varying vec3 direction;uniform vec3 up;uniform vec3 right;uniform vec3 front;\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nmat3 view=mat3(up,right,front);direction=view*vec3(position,1.0);gl_Position=vec4(position,0.0,1.0);\n#define CUSTOM_VERTEX_MAIN_END\n}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},61186:(e,t,n)=>{n.r(t),n.d(t,{ssaoCombinePixelShaderWGSL:()=>a});var r=n(98519),i="ssaoCombinePixelShader",o="varying vUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d;var originalColorSampler: sampler;var originalColor: texture_2d;uniform viewport: vec4f;\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\nvar uv: vec2f=uniforms.viewport.xy+input.vUV*uniforms.viewport.zw;var ssaoColor: vec4f=textureSample(textureSampler,textureSamplerSampler,uv);var sceneColor: vec4f=textureSample(originalColor,originalColorSampler,uv);fragmentOutputs.color=sceneColor*ssaoColor;\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},61189:(e,t,n)=>{n.r(t),n.d(t,{outlinePixelShaderWGSL:()=>a});var r=n(98519),i=(n(20502),n(38197),n(30032),n(56897),"outlinePixelShader"),o="uniform color: vec4f;\n#ifdef ALPHATEST\nvarying vUV: vec2f;var diffuseSamplerSampler: sampler;var diffuseSampler: texture_2d;\n#endif\n#include\n#include\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include\n#ifdef ALPHATEST\nif (textureSample(diffuseSampler,diffuseSamplerSampler,fragmentInputs.vUV).a<0.4) {discard;}\n#endif\n#include\nfragmentOutputs.color=uniforms.color;\n#define CUSTOM_FRAGMENT_MAIN_END\n}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},61195:(e,t,n)=>{n.r(t),n.d(t,{shadowMapFragmentSoftTransparentShadow:()=>a});var r=n(98519),i="shadowMapFragmentSoftTransparentShadow",o="#if SM_SOFTTRANSPARENTSHADOW==1\nif ((bayerDither8(floor(mod(gl_FragCoord.xy,8.0))))/64.0>=softTransparentShadowSM.x*alpha) discard;\n#endif\n";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]=o);var a={name:i,shader:o}},61439:(e,t,n)=>{n.r(t),n.d(t,{reflectionFunctionWGSL:()=>a});var r=n(98519),i="reflectionFunction",o="fn computeFixedEquirectangularCoords(worldPos: vec4f,worldNormal: vec3f,direction: vec3f)->vec3f\n{var lon: f32=atan2(direction.z,direction.x);var lat: f32=acos(direction.y);var sphereCoords: vec2f= vec2f(lon,lat)*RECIPROCAL_PI2*2.0;var s: f32=sphereCoords.x*0.5+0.5;var t: f32=sphereCoords.y;return vec3f(s,t,0); }\nfn computeMirroredFixedEquirectangularCoords(worldPos: vec4f,worldNormal: vec3f,direction: vec3f)->vec3f\n{var lon: f32=atan2(direction.z,direction.x);var lat: f32=acos(direction.y);var sphereCoords: vec2f= vec2f(lon,lat)*RECIPROCAL_PI2*2.0;var s: f32=sphereCoords.x*0.5+0.5;var t: f32=sphereCoords.y;return vec3f(1.0-s,t,0); }\nfn computeEquirectangularCoords(worldPos: vec4f,worldNormal: vec3f,eyePosition: vec3f,reflectionMatrix: mat4x4f)->vec3f\n{var cameraToVertex: vec3f=normalize(worldPos.xyz-eyePosition);var r: vec3f=normalize(reflect(cameraToVertex,worldNormal));r= (reflectionMatrix* vec4f(r,0)).xyz;var lon: f32=atan2(r.z,r.x);var lat: f32=acos(r.y);var sphereCoords: vec2f= vec2f(lon,lat)*RECIPROCAL_PI2*2.0;var s: f32=sphereCoords.x*0.5+0.5;var t: f32=sphereCoords.y;return vec3f(s,t,0);}\nfn computeSphericalCoords(worldPos: vec4f,worldNormal: vec3f,view: mat4x4f,reflectionMatrix: mat4x4f)->vec3f\n{var viewDir: vec3f=normalize((view*worldPos).xyz);var viewNormal: vec3f=normalize((view* vec4f(worldNormal,0.0)).xyz);var r: vec3f=reflect(viewDir,viewNormal);r= (reflectionMatrix* vec4f(r,0)).xyz;r.z=r.z-1.0;var m: f32=2.0*length(r);return vec3f(r.x/m+0.5,1.0-r.y/m-0.5,0);}\nfn computePlanarCoords(worldPos: vec4f,worldNormal: vec3f,eyePosition: vec3f,reflectionMatrix: mat4x4f)->vec3f\n{var viewDir: vec3f=worldPos.xyz-eyePosition;var coords: vec3f=normalize(reflect(viewDir,worldNormal));return (reflectionMatrix* vec4f(coords,1)).xyz;}\nfn computeCubicCoords(worldPos: vec4f,worldNormal: vec3f,eyePosition: vec3f,reflectionMatrix: mat4x4f)->vec3f\n{var viewDir: vec3f=normalize(worldPos.xyz-eyePosition);var coords: vec3f=reflect(viewDir,worldNormal);coords= (reflectionMatrix* vec4f(coords,0)).xyz;\n#ifdef INVERTCUBICMAP\ncoords.y*=-1.0;\n#endif\nreturn coords;}\nfn computeCubicLocalCoords(worldPos: vec4f,worldNormal: vec3f,eyePosition: vec3f,reflectionMatrix: mat4x4f,reflectionSize: vec3f,reflectionPosition: vec3f)->vec3f\n{var viewDir: vec3f=normalize(worldPos.xyz-eyePosition);var coords: vec3f=reflect(viewDir,worldNormal);coords=parallaxCorrectNormal(worldPos.xyz,coords,reflectionSize,reflectionPosition);coords=(reflectionMatrix* vec4f(coords,0)).xyz;\n#ifdef INVERTCUBICMAP\ncoords.y*=-1.0;\n#endif\nreturn coords;}\nfn computeProjectionCoords(worldPos: vec4f,view: mat4x4f,reflectionMatrix: mat4x4f)->vec3f\n{return (reflectionMatrix*(view*worldPos)).xyz;}\nfn computeSkyBoxCoords(positionW: vec3f,reflectionMatrix: mat4x4f)->vec3f\n{return (reflectionMatrix* vec4f(positionW,1.)).xyz;}\n#ifdef REFLECTION\nfn computeReflectionCoords(worldPos: vec4f,worldNormal: vec3f)->vec3f\n{\n#ifdef REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED\nvar direction: vec3f=normalize(fragmentInputs.vDirectionW);return computeMirroredFixedEquirectangularCoords(worldPos,worldNormal,direction);\n#endif\n#ifdef REFLECTIONMAP_EQUIRECTANGULAR_FIXED\nvar direction: vec3f=normalize(fragmentInputs.vDirectionW);return computeFixedEquirectangularCoords(worldPos,worldNormal,direction);\n#endif\n#ifdef REFLECTIONMAP_EQUIRECTANGULAR\nreturn computeEquirectangularCoords(worldPos,worldNormal,scene.vEyePosition.xyz,uniforms.reflectionMatrix);\n#endif\n#ifdef REFLECTIONMAP_SPHERICAL\nreturn computeSphericalCoords(worldPos,worldNormal,scene.view,uniforms.reflectionMatrix);\n#endif\n#ifdef REFLECTIONMAP_PLANAR\nreturn computePlanarCoords(worldPos,worldNormal,scene.vEyePosition.xyz,uniforms.reflectionMatrix);\n#endif\n#ifdef REFLECTIONMAP_CUBIC\n#ifdef USE_LOCAL_REFLECTIONMAP_CUBIC\nreturn computeCubicLocalCoords(worldPos,worldNormal,scene.vEyePosition.xyz,uniforms.reflectionMatrix,uniforms.vReflectionSize,uniforms.vReflectionPosition);\n#else\nreturn computeCubicCoords(worldPos,worldNormal,scene.vEyePosition.xyz,uniforms.reflectionMatrix);\n#endif\n#endif\n#ifdef REFLECTIONMAP_PROJECTION\nreturn computeProjectionCoords(worldPos,scene.view,uniforms.reflectionMatrix);\n#endif\n#ifndef REFLECTIONMAP_CUBIC\n#ifdef REFLECTIONMAP_SKYBOX\nreturn computeSkyBoxCoords(fragmentInputs.vPositionUVW,uniforms.reflectionMatrix);\n#endif\n#endif\n#ifdef REFLECTIONMAP_EXPLICIT\nreturn vec3f(0,0,0);\n#endif\n}\n#endif\n";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]=o);var a={name:i,shader:o}},61482:(e,t,n)=>{n.r(t),n.d(t,{FlowGraphFunctionReferenceBlock:()=>s});var r=n(78322),i=n(45749),o=n(88099),a=n(34623),s=function(e){function t(t){var n=e.call(this,t)||this;return n.functionName=n.registerDataInput("functionName",o.KV),n.object=n.registerDataInput("object",o.Vv),n.context=n.registerDataInput("context",o.Vv,null),n.output=n.registerDataOutput("output",o.Vv),n}return(0,r.C6)(t,e),t.prototype._updateOutputs=function(e){var t=this.functionName.getValue(e),n=this.object.getValue(e),r=this.context.getValue(e);if(n&&t){var i=n[t];i&&"function"==typeof i&&this.output.setValue(i.bind(r),e)}},t.prototype.getClassName=function(){return"FlowGraphFunctionReference"},t}(i.e);(0,a.Y5)("FlowGraphFunctionReference",s)},61669:(e,t,n)=>{var r=n(98519),i="pbrBRDFFunctions";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="#define FRESNEL_MAXIMUM_ON_ROUGH 0.25\n#define BRDF_DIFFUSE_MODEL_EON 0\n#define BRDF_DIFFUSE_MODEL_BURLEY 1\n#define BRDF_DIFFUSE_MODEL_LAMBERT 2\n#define BRDF_DIFFUSE_MODEL_LEGACY 3\n#define DIELECTRIC_SPECULAR_MODEL_GLTF 0\n#define DIELECTRIC_SPECULAR_MODEL_OPENPBR 1\n#define CONDUCTOR_SPECULAR_MODEL_GLTF 0\n#define CONDUCTOR_SPECULAR_MODEL_OPENPBR 1\n#if !defined(PBR_VERTEX_SHADER) && !defined(OPENPBR_VERTEX_SHADER)\n#ifdef MS_BRDF_ENERGY_CONSERVATION\nfn getEnergyConservationFactor(specularEnvironmentR0: vec3f,environmentBrdf: vec3f)->vec3f {return 1.0+specularEnvironmentR0*(1.0/environmentBrdf.y-1.0);}\n#endif\n#if CONDUCTOR_SPECULAR_MODEL==CONDUCTOR_SPECULAR_MODEL_OPENPBR \nfn getF82Specular(NdotV: f32,F0: vec3f,edgeTint: vec3f,roughness: f32)->vec3f {const cos_theta_max: f32=0.142857143; \nconst one_minus_cos_theta_max_to_the_fifth: f32=0.462664366; \nconst one_minus_cos_theta_max_to_the_sixth: f32=0.396569457; \nlet white_minus_F0: vec3f=vec3f(1.0f)-F0;let b_numerator: vec3f=(F0+white_minus_F0*one_minus_cos_theta_max_to_the_fifth)*(vec3f(1.0)-edgeTint);const b_denominator: f32=cos_theta_max*one_minus_cos_theta_max_to_the_sixth;const b_denominator_reciprocal: f32=1.0f/b_denominator;let b: vec3f=b_numerator*b_denominator_reciprocal; \nlet cos_theta: f32=max(roughness,NdotV);let one_minus_cos_theta: f32=1.0-cos_theta;let offset_from_F0: vec3f=(white_minus_F0-b*cos_theta*one_minus_cos_theta)*pow(one_minus_cos_theta,5.0f);return clamp(F0+offset_from_F0,vec3f(0.0f),vec3f(1.0f));}\n#endif\n#ifdef FUZZENVIRONMENTBRDF\nfn getFuzzBRDFLookup(NdotV: f32,perceptualRoughness: f32)->vec3f {let UV: vec2f=vec2f(perceptualRoughness,NdotV);var brdfLookup: vec4f=textureSample(environmentFuzzBrdfSampler,environmentFuzzBrdfSamplerSampler,UV);const RiRange: vec2f=vec2f(0.0f,0.75f);const ARange: vec2f=vec2f(0.005f,0.88f);const BRange: vec2f=vec2f(-0.18f,0.002f);brdfLookup.r=mix(ARange.x, ARange.y, brdfLookup.r);brdfLookup.g=mix(BRange.x, BRange.y, brdfLookup.g);brdfLookup.b=mix(RiRange.x,RiRange.y,brdfLookup.b);return brdfLookup.rgb;}\n#endif\n#ifdef ENVIRONMENTBRDF\nfn getBRDFLookup(NdotV: f32,perceptualRoughness: f32)->vec3f {var UV: vec2f= vec2f(NdotV,perceptualRoughness);var brdfLookup: vec4f= textureSample(environmentBrdfSampler,environmentBrdfSamplerSampler,UV);\n#ifdef ENVIRONMENTBRDF_RGBD\nbrdfLookup=vec4f(fromRGBD(brdfLookup.rgba),brdfLookup.a);\n#endif\nreturn brdfLookup.rgb;}\nfn getReflectanceFromBRDFWithEnvLookup(specularEnvironmentR0: vec3f,specularEnvironmentR90: vec3f,environmentBrdf: vec3f)->vec3f {\n#ifdef BRDF_V_HEIGHT_CORRELATED\nvar reflectance: vec3f=(specularEnvironmentR90-specularEnvironmentR0)*environmentBrdf.x+specularEnvironmentR0*environmentBrdf.y;\n#else\nvar reflectance: vec3f=specularEnvironmentR0*environmentBrdf.x+specularEnvironmentR90*environmentBrdf.y;\n#endif\nreturn reflectance;}\nfn getReflectanceFromBRDFLookup(specularEnvironmentR0: vec3f,environmentBrdf: vec3f)->vec3f {\n#ifdef BRDF_V_HEIGHT_CORRELATED\nvar reflectance: vec3f=mix(environmentBrdf.xxx,environmentBrdf.yyy,specularEnvironmentR0);\n#else\nvar reflectance: vec3f=specularEnvironmentR0*environmentBrdf.x+environmentBrdf.y;\n#endif\nreturn reflectance;}\n#endif\n/* NOT USED\n#if defined(SHEEN) && defined(SHEEN_SOFTER)\nfn getBRDFLookupCharlieSheen(NdotV: f32,perceptualRoughness: f32)->f32\n{var c: f32=1.0-NdotV;var c3: f32=c*c*c;return 0.65584461*c3+1.0/(4.16526551+exp(-7.97291361*perceptualRoughness+6.33516894));}\n#endif\n*/\n#if !defined(ENVIRONMENTBRDF) || defined(REFLECTIONMAP_SKYBOX) || defined(ALPHAFRESNEL)\nfn getReflectanceFromAnalyticalBRDFLookup_Jones(VdotN: f32,reflectance0: vec3f,reflectance90: vec3f,smoothness: f32)->vec3f\n{var weight: f32=mix(FRESNEL_MAXIMUM_ON_ROUGH,1.0,smoothness);return reflectance0+weight*(reflectance90-reflectance0)*pow5(saturate(1.0-VdotN));}\n#endif\n#if defined(SHEEN) && defined(ENVIRONMENTBRDF)\n/**\n* The sheen BRDF not containing F can be easily stored in the blue channel of the BRDF texture.\n* The blue channel contains DCharlie*VAshikhmin*NdotL as a lokkup table\n*/\nfn getSheenReflectanceFromBRDFLookup(reflectance0: vec3f,environmentBrdf: vec3f)->vec3f {var sheenEnvironmentReflectance: vec3f=reflectance0*environmentBrdf.b;return sheenEnvironmentReflectance;}\n#endif\nfn fresnelSchlickGGXVec3(VdotH: f32,reflectance0: vec3f,reflectance90: vec3f)->vec3f\n{return reflectance0+(reflectance90-reflectance0)*pow5(1.0-VdotH);}\nfn fresnelSchlickGGX(VdotH: f32,reflectance0: f32,reflectance90: f32)->f32\n{return reflectance0+(reflectance90-reflectance0)*pow5(1.0-VdotH);}\n#ifdef CLEARCOAT\nfn getR0RemappedForClearCoat(f0: vec3f)->vec3f {\n#ifdef CLEARCOAT_DEFAULTIOR\n#ifdef MOBILE\nreturn saturateVec3(f0*(f0*0.526868+0.529324)-0.0482256);\n#else\nreturn saturateVec3(f0*(f0*(0.941892-0.263008*f0)+0.346479)-0.0285998);\n#endif\n#else\nvar s: vec3f=sqrt(f0);var t: vec3f=(uniforms.vClearCoatRefractionParams.z+uniforms.vClearCoatRefractionParams.w*s)/(uniforms.vClearCoatRefractionParams.w+uniforms.vClearCoatRefractionParams.z*s);return squareVec3(t);\n#endif\n}\n#endif\n#ifdef IRIDESCENCE\nconst XYZ_TO_REC709: mat3x3f= mat3x3f(\n3.2404542,-0.9692660, 0.0556434,\n-1.5371385, 1.8760108,-0.2040259,\n-0.4985314, 0.0415560, 1.0572252\n);fn getIORTfromAirToSurfaceR0(f0: vec3f)->vec3f {var sqrtF0: vec3f=sqrt(f0);return (1.+sqrtF0)/(1.-sqrtF0);}\nfn getR0fromIORsVec3(iorT: vec3f,iorI: f32)->vec3f {return squareVec3((iorT- vec3f(iorI))/(iorT+ vec3f(iorI)));}\nfn getR0fromIORs(iorT: f32,iorI: f32)->f32 {return square((iorT-iorI)/(iorT+iorI));}\nfn evalSensitivity(opd: f32,shift: vec3f)->vec3f {var phase: f32=2.0*PI*opd*1.0e-9;const val: vec3f= vec3f(5.4856e-13,4.4201e-13,5.2481e-13);const pos: vec3f= vec3f(1.6810e+06,1.7953e+06,2.2084e+06);const vr: vec3f= vec3f(4.3278e+09,9.3046e+09,6.6121e+09);var xyz: vec3f=val*sqrt(2.0*PI*vr)*cos(pos*phase+shift)*exp(-square(phase)*vr);xyz.x+=9.7470e-14*sqrt(2.0*PI*4.5282e+09)*cos(2.2399e+06*phase+shift[0])*exp(-4.5282e+09*square(phase));xyz/=1.0685e-7;var srgb: vec3f=XYZ_TO_REC709*xyz;return srgb;}\nfn evalIridescence(outsideIOR: f32,eta2: f32,cosTheta1: f32,thinFilmThickness: f32,baseF0: vec3f)->vec3f {var I: vec3f= vec3f(1.0);var iridescenceIOR: f32=mix(outsideIOR,eta2,smoothstep(0.0,0.03,thinFilmThickness));var sinTheta2Sq: f32=square(outsideIOR/iridescenceIOR)*(1.0-square(cosTheta1));var cosTheta2Sq: f32=1.0-sinTheta2Sq;if (cosTheta2Sq<0.0) {return I;}\nvar cosTheta2: f32=sqrt(cosTheta2Sq);var R0: f32=getR0fromIORs(iridescenceIOR,outsideIOR);var R12: f32=fresnelSchlickGGX(cosTheta1,R0,1.);var R21: f32=R12;var T121: f32=1.0-R12;var phi12: f32=0.0;if (iridescenceIORf32\n{var a2: f32=alphaG*alphaG;var d: f32=NdotH*NdotH*(a2-1.0)+1.0;return a2/(PI*d*d);}\n#ifdef SHEEN\nfn normalDistributionFunction_CharlieSheen(NdotH: f32,alphaG: f32)->f32\n{var invR: f32=1./alphaG;var cos2h: f32=NdotH*NdotH;var sin2h: f32=1.-cos2h;return (2.+invR)*pow(sin2h,invR*.5)/(2.*PI);}\n#endif\n#ifdef ANISOTROPIC\nfn normalDistributionFunction_BurleyGGX_Anisotropic(NdotH: f32,TdotH: f32,BdotH: f32,alphaTB: vec2f)->f32 {var a2: f32=alphaTB.x*alphaTB.y;var v: vec3f= vec3f(alphaTB.y*TdotH,alphaTB.x *BdotH,a2*NdotH);var v2: f32=dot(v,v);var w2: f32=a2/v2;return a2*w2*w2*RECIPROCAL_PI;}\n#endif\n#ifdef BRDF_V_HEIGHT_CORRELATED\nfn smithVisibility_GGXCorrelated(NdotL: f32,NdotV: f32,alphaG: f32)->f32 {\n#ifdef MOBILE\nvar GGXV: f32=NdotL*(NdotV*(1.0-alphaG)+alphaG);var GGXL: f32=NdotV*(NdotL*(1.0-alphaG)+alphaG);return 0.5/(GGXV+GGXL);\n#else\nvar a2: f32=alphaG*alphaG;var GGXV: f32=NdotL*sqrt(NdotV*(NdotV-a2*NdotV)+a2);var GGXL: f32=NdotV*sqrt(NdotL*(NdotL-a2*NdotL)+a2);return 0.5/(GGXV+GGXL);\n#endif\n}\n#else\nfn smithVisibilityG1_TrowbridgeReitzGGXFast(dot: f32,alphaG: f32)->f32\n{\n#ifdef MOBILE\nreturn 1.0/(dot+alphaG+(1.0-alphaG)*dot ));\n#else\nvar alphaSquared: f32=alphaG*alphaG;return 1.0/(dot+sqrt(alphaSquared+(1.0-alphaSquared)*dot*dot));\n#endif\n}\nfn smithVisibility_TrowbridgeReitzGGXFast(NdotL: f32,NdotV: f32,alphaG: f32)->f32\n{var visibility: f32=smithVisibilityG1_TrowbridgeReitzGGXFast(NdotL,alphaG)*smithVisibilityG1_TrowbridgeReitzGGXFast(NdotV,alphaG);return visibility;}\n#endif\n#ifdef ANISOTROPIC\nfn smithVisibility_GGXCorrelated_Anisotropic(NdotL: f32,NdotV: f32,TdotV: f32,BdotV: f32,TdotL: f32,BdotL: f32,alphaTB: vec2f)->f32 {var lambdaV: f32=NdotL*length( vec3f(alphaTB.x*TdotV,alphaTB.y*BdotV,NdotV));var lambdaL: f32=NdotV*length( vec3f(alphaTB.x*TdotL,alphaTB.y*BdotL,NdotL));var v: f32=0.5/(lambdaV+lambdaL);return v;}\n#endif\n#ifdef CLEARCOAT\nfn visibility_Kelemen(VdotH: f32)->f32 {return 0.25/(VdotH*VdotH); }\n#endif\n#ifdef SHEEN\nfn visibility_Ashikhmin(NdotL: f32,NdotV: f32)->f32\n{return 1./(4.*(NdotL+NdotV-NdotL*NdotV));}\n/* NOT USED\n#ifdef SHEEN_SOFTER\nfn l(x: f32,alphaG: f32)->f32\n{var oneMinusAlphaSq: f32=(1.0-alphaG)*(1.0-alphaG);var a: f32=mix(21.5473,25.3245,oneMinusAlphaSq);var b: f32=mix(3.82987,3.32435,oneMinusAlphaSq);var c: f32=mix(0.19823,0.16801,oneMinusAlphaSq);var d: f32=mix(-1.97760,-1.27393,oneMinusAlphaSq);var e: f32=mix(-4.32054,-4.85967,oneMinusAlphaSq);return a/(1.0+b*pow(x,c))+d*x+e;}\nfn lambdaSheen(cosTheta: f32,alphaG: f32)->f32\n{return abs(cosTheta)<0.5 ? exp(l(cosTheta,alphaG)) : exp(2.0*l(0.5,alphaG)-l(1.0-cosTheta,alphaG));}\nfn visibility_CharlieSheen(NdotL: f32,NdotV: f32,alphaG: f32)->f32\n{var G: f32=1.0/(1.0+lambdaSheen(NdotV,alphaG)+lambdaSheen(NdotL,alphaG));return G/(4.0*NdotV*NdotL);}\n#endif\n*/\n#endif\nconst constant1_FON: f32=0.5f-2.0f/(3.0f*PI);const constant2_FON: f32=2.0f/3.0f-28.0f/(15.0f*PI);fn E_FON_approx(mu: f32,roughness: f32)->f32\n{var sigma: f32=roughness; \nvar mucomp: f32=1.0f-mu;var mucomp2: f32=mucomp*mucomp;const Gcoeffs: mat2x2f=mat2x2f(0.0571085289f,-0.332181442f,\n0.491881867f,0.0714429953f);var GoverPi: f32=dot(Gcoeffs*vec2f(mucomp,mucomp2),vec2f(1.0f,mucomp2));return (1.0f+sigma*GoverPi)/(1.0f+constant1_FON*sigma);}\nfn diffuseBRDF_EON(albedo: vec3f,roughness: f32,NdotL: f32,NdotV: f32,LdotV: f32)->vec3f\n{var rho: vec3f=albedo;var sigma: f32=roughness; \nvar mu_i: f32=NdotL; \nvar mu_o: f32=NdotV; \nvar s: f32=LdotV-mu_i*mu_o; \nvar sovertF: f32=select(s,s/max(mu_i,mu_o),s>0.0f); \nvar AF: f32=1.0f/(1.0f+constant1_FON*sigma); \nvar f_ss: vec3f=(rho*RECIPROCAL_PI)*AF*(1.0f+sigma*sovertF); \nvar EFo: f32=E_FON_approx(mu_o,sigma); \nvar EFi: f32=E_FON_approx(mu_i,sigma); \nvar avgEF: f32=AF*(1.0f+constant2_FON*sigma); \nvar rho_ms: vec3f=(rho*rho)*avgEF/(vec3f(1.0f)-rho*(1.0f-avgEF));const eps: f32=1.0e-7f;var f_ms: vec3f=(rho_ms*RECIPROCAL_PI)*max(eps,1.0f-EFo) \n* max(eps,1.0f-EFi)\n/ max(eps,1.0f-avgEF);return (f_ss+f_ms);}\nfn diffuseBRDF_Burley(NdotL: f32,NdotV: f32,VdotH: f32,roughness: f32)->f32 {var diffuseFresnelNV: f32=pow5(saturateEps(1.0-NdotL));var diffuseFresnelNL: f32=pow5(saturateEps(1.0-NdotV));var diffuseFresnel90: f32=0.5+2.0*VdotH*VdotH*roughness;var fresnel: f32 =\n(1.0+(diffuseFresnel90-1.0)*diffuseFresnelNL) *\n(1.0+(diffuseFresnel90-1.0)*diffuseFresnelNV);return fresnel/PI;}\n#ifdef SS_TRANSLUCENCY\nfn transmittanceBRDF_Burley(tintColor: vec3f,diffusionDistance: vec3f,thickness: f32)->vec3f {var S: vec3f=1./maxEpsVec3(diffusionDistance);var temp: vec3f=exp((-0.333333333*thickness)*S);return tintColor.rgb*0.25*(temp*temp*temp+3.0*temp);}\nfn computeWrappedDiffuseNdotL(NdotL: f32,w: f32)->f32 {var t: f32=1.0+w;var invt2: f32=1.0/(t*t);return saturate((NdotL+w)*invt2);}\n#endif\n#endif \n")},61930:(e,t,n)=>{n.d(t,{r:()=>l});var r=n(78322),i=n(45749),o=n(88099),a="cachedOperationValue",s="cachedExecutionId",l=function(e){function t(t,n){var r=e.call(this,n)||this;return r.value=r.registerDataOutput("value",t),r.isValid=r.registerDataOutput("isValid",o.RI),r}return(0,r.C6)(t,e),t.prototype._updateOutputs=function(e){var t=e._getExecutionVariable(this,s,-1),n=e._getExecutionVariable(this,a,null);if(null!=n&&t===e.executionId)this.isValid.setValue(!0,e),this.value.setValue(n,e);else try{var r=this._doOperation(e);if(null==r)return void this.isValid.setValue(!1,e);e._setExecutionVariable(this,a,r),e._setExecutionVariable(this,s,e.executionId),this.value.setValue(r,e),this.isValid.setValue(!0,e)}catch(t){this.isValid.setValue(!1,e)}},t}(i.e)},62004:(e,t,n)=>{n.r(t),n.d(t,{depthPixelShaderWGSL:()=>a});var r=n(98519),i=(n(20502),n(68298),n(30032),"depthPixelShader"),o="#ifdef ALPHATEST\nvarying vUV: vec2f;var diffuseSamplerSampler: sampler;var diffuseSampler: texture_2d;\n#endif\n#include\nvarying vDepthMetric: f32;\n#ifdef PACKED\n#include\n#endif\n#ifdef STORE_CAMERASPACE_Z\nvarying vViewPos: vec4f;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#include\n#ifdef ALPHATEST\nif (textureSample(diffuseSampler,diffuseSamplerSampler,input.vUV).a<0.4) {discard;}\n#endif\n#ifdef STORE_CAMERASPACE_Z\n#ifdef PACKED\nfragmentOutputs.color=pack(input.vViewPos.z);\n#else\nfragmentOutputs.color= vec4f(input.vViewPos.z,0.0,0.0,1.0);\n#endif\n#else\n#ifdef NONLINEARDEPTH\n#ifdef PACKED\nfragmentOutputs.color=pack(input.position.z);\n#else\nfragmentOutputs.color= vec4f(input.position.z,0.0,0.0,0.0);\n#endif\n#else\n#ifdef PACKED\nfragmentOutputs.color=pack(input.vDepthMetric);\n#else\nfragmentOutputs.color= vec4f(input.vDepthMetric,0.0,0.0,1.0);\n#endif\n#endif\n#endif\n}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},62049:(e,t,n)=>{var r=n(98519),i="pbrDirectLightingFalloffFunctions";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="float computeDistanceLightFalloff_Standard(vec3 lightOffset,float range)\n{return max(0.,1.0-length(lightOffset)/range);}\nfloat computeDistanceLightFalloff_Physical(float lightDistanceSquared)\n{return 1.0/maxEps(lightDistanceSquared);}\nfloat computeDistanceLightFalloff_GLTF(float lightDistanceSquared,float inverseSquaredRange)\n{float lightDistanceFalloff=1.0/maxEps(lightDistanceSquared);float factor=lightDistanceSquared*inverseSquaredRange;float attenuation=saturate(1.0-factor*factor);attenuation*=attenuation;lightDistanceFalloff*=attenuation;return lightDistanceFalloff;}\nfloat computeDistanceLightFalloff(vec3 lightOffset,float lightDistanceSquared,float range,float inverseSquaredRange)\n{\n#ifdef USEPHYSICALLIGHTFALLOFF\nreturn computeDistanceLightFalloff_Physical(lightDistanceSquared);\n#elif defined(USEGLTFLIGHTFALLOFF)\nreturn computeDistanceLightFalloff_GLTF(lightDistanceSquared,inverseSquaredRange);\n#else\nreturn computeDistanceLightFalloff_Standard(lightOffset,range);\n#endif\n}\nfloat computeDirectionalLightFalloff_Standard(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle,float exponent)\n{float falloff=0.0;float cosAngle=maxEps(dot(-lightDirection,directionToLightCenterW));if (cosAngle>=cosHalfAngle)\n{falloff=max(0.,pow(cosAngle,exponent));}\nreturn falloff;}\nfloat computeDirectionalLightFalloff_IES(vec3 lightDirection,vec3 directionToLightCenterW,sampler2D iesLightSampler)\n{float cosAngle=dot(-lightDirection,directionToLightCenterW);float angle=acos(cosAngle)/PI;return texture2D(iesLightSampler,vec2(angle,0.)).r;}\nfloat computeDirectionalLightFalloff_Physical(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle)\n{const float kMinusLog2ConeAngleIntensityRatio=6.64385618977; \nfloat concentrationKappa=kMinusLog2ConeAngleIntensityRatio/(1.0-cosHalfAngle);vec4 lightDirectionSpreadSG=vec4(-lightDirection*concentrationKappa,-concentrationKappa);float falloff=exp2(dot(vec4(directionToLightCenterW,1.0),lightDirectionSpreadSG));return falloff;}\nfloat computeDirectionalLightFalloff_GLTF(vec3 lightDirection,vec3 directionToLightCenterW,float lightAngleScale,float lightAngleOffset)\n{float cd=dot(-lightDirection,directionToLightCenterW);float falloff=saturate(cd*lightAngleScale+lightAngleOffset);falloff*=falloff;return falloff;}\nfloat computeDirectionalLightFalloff(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle,float exponent,float lightAngleScale,float lightAngleOffset)\n{\n#ifdef USEPHYSICALLIGHTFALLOFF\nreturn computeDirectionalLightFalloff_Physical(lightDirection,directionToLightCenterW,cosHalfAngle);\n#elif defined(USEGLTFLIGHTFALLOFF)\nreturn computeDirectionalLightFalloff_GLTF(lightDirection,directionToLightCenterW,lightAngleScale,lightAngleOffset);\n#else\nreturn computeDirectionalLightFalloff_Standard(lightDirection,directionToLightCenterW,cosHalfAngle,exponent);\n#endif\n}")},62136:(e,t,n)=>{n.r(t),n.d(t,{shadowsVertex:()=>a});var r=n(98519),i="shadowsVertex",o="#ifdef SHADOWS\n#if defined(SHADOWCSM{X})\nvPositionFromCamera{X}=view*worldPos;for (int i=0; i{n.r(t),n.d(t,{glowMapMergePixelShader:()=>a});var r=n(98519),i="glowMapMergePixelShader",o="varying vec2 vUV;uniform sampler2D textureSampler;\n#ifdef EMISSIVE\nuniform sampler2D textureSampler2;\n#endif\nuniform float offset;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\nvec4 baseColor=texture2D(textureSampler,vUV);\n#ifdef EMISSIVE\nbaseColor+=texture2D(textureSampler2,vUV);baseColor*=offset;\n#else\nbaseColor.a=abs(offset-baseColor.a);\n#ifdef STROKE\nfloat alpha=smoothstep(.0,.1,baseColor.a);baseColor.a=alpha;baseColor.rgb=baseColor.rgb*alpha;\n#endif\n#endif\n#if LDR\nbaseColor=clamp(baseColor,0.,1.0);\n#endif\ngl_FragColor=baseColor;\n#define CUSTOM_FRAGMENT_MAIN_END\n}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},62273:(e,t,n)=>{n.d(t,{K:()=>r});var r=function(){function e(){}return Object.defineProperty(e,"UniqueId",{get:function(){var e=this._UniqueIdCounter;return this._UniqueIdCounter++,e},enumerable:!1,configurable:!0}),e._UniqueIdCounter=1,e}()},62371:(e,t,n)=>{n.r(t),n.d(t,{shadowMapVertexMetric:()=>a});var r=n(98519),i="shadowMapVertexMetric",o="#if SM_USEDISTANCE==1\nvPositionWSM=worldPos.xyz;\n#endif\n#if SM_DEPTHTEXTURE==1\n#ifdef IS_NDC_HALF_ZRANGE\n#define BIASFACTOR 0.5\n#else\n#define BIASFACTOR 1.0\n#endif\n#ifdef USE_REVERSE_DEPTHBUFFER\ngl_Position.z-=biasAndScaleSM.x*gl_Position.w*BIASFACTOR;\n#else\ngl_Position.z+=biasAndScaleSM.x*gl_Position.w*BIASFACTOR;\n#endif\n#endif\n#if defined(SM_DEPTHCLAMP) && SM_DEPTHCLAMP==1\nzSM=gl_Position.z;gl_Position.z=0.0;\n#elif SM_USEDISTANCE==0\n#ifdef USE_REVERSE_DEPTHBUFFER\nvDepthMetricSM=(-gl_Position.z+depthValuesSM.x)/depthValuesSM.y+biasAndScaleSM.x;\n#else\nvDepthMetricSM=(gl_Position.z+depthValuesSM.x)/depthValuesSM.y+biasAndScaleSM.x;\n#endif\n#endif\n";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]=o);var a={name:i,shader:o}},62400:(e,t,n)=>{n.d(t,{K:()=>o,r:()=>i});var r=n(85258),i=function(){function e(e){void 0===e&&(e=30),this._enabled=!0,this._rollingFrameTime=new o(e)}return e.prototype.sampleFrame=function(e){if(void 0===e&&(e=r.j.Now),this._enabled){if(null!=this._lastFrameTimeMs){var t=e-this._lastFrameTimeMs;this._rollingFrameTime.add(t)}this._lastFrameTimeMs=e}},Object.defineProperty(e.prototype,"averageFrameTime",{get:function(){return this._rollingFrameTime.average},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"averageFrameTimeVariance",{get:function(){return this._rollingFrameTime.variance},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"instantaneousFrameTime",{get:function(){return this._rollingFrameTime.history(0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"averageFPS",{get:function(){return 1e3/this._rollingFrameTime.average},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"instantaneousFPS",{get:function(){var e=this._rollingFrameTime.history(0);return 0===e?0:1e3/e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isSaturated",{get:function(){return this._rollingFrameTime.isSaturated()},enumerable:!1,configurable:!0}),e.prototype.enable=function(){this._enabled=!0},e.prototype.disable=function(){this._enabled=!1,this._lastFrameTimeMs=null},Object.defineProperty(e.prototype,"isEnabled",{get:function(){return this._enabled},enumerable:!1,configurable:!0}),e.prototype.reset=function(){this._lastFrameTimeMs=null,this._rollingFrameTime.reset()},e}(),o=function(){function e(e){this._samples=new Array(e),this.reset()}return e.prototype.add=function(e){var t;if(this.isSaturated()){var n=this._samples[this._pos];t=n-this.average,this.average-=t/(this._sampleCount-1),this._m2-=t*(n-this.average)}else this._sampleCount++;t=e-this.average,this.average+=t/this._sampleCount,this._m2+=t*(e-this.average),this.variance=this._m2/(this._sampleCount-1),this._samples[this._pos]=e,this._pos++,this._pos%=this._samples.length},e.prototype.history=function(e){if(e>=this._sampleCount||e>=this._samples.length)return 0;var t=this._wrapPosition(this._pos-1);return this._samples[this._wrapPosition(t-e)]},e.prototype.isSaturated=function(){return this._sampleCount>=this._samples.length},e.prototype.reset=function(){this.average=0,this.variance=0,this._sampleCount=0,this._pos=0,this._m2=0},e.prototype._wrapPosition=function(e){var t=this._samples.length;return(e%t+t)%t},e}()},62544:(e,t,n)=>{n.r(t),n.d(t,{FlowGraphPlayAnimationBlock:()=>l});var r=n(78322),i=n(21379),o=n(88099),a=n(34623),s=n(73568),l=function(e){function t(t){var n=e.call(this,t,["animationLoop","animationEnd","animationGroupLoop"])||this;return n.config=t,n.speed=n.registerDataInput("speed",o.Es),n.loop=n.registerDataInput("loop",o.RI),n.from=n.registerDataInput("from",o.Es,0),n.to=n.registerDataInput("to",o.Es),n.currentFrame=n.registerDataOutput("currentFrame",o.Es),n.currentTime=n.registerDataOutput("currentTime",o.Es),n.currentAnimationGroup=n.registerDataOutput("currentAnimationGroup",o.Vv),n.animationGroup=n.registerDataInput("animationGroup",o.Vv,null==t?void 0:t.animationGroup),n.animation=n.registerDataInput("animation",o.Vv),n.object=n.registerDataInput("object",o.Vv),n}return(0,r.C6)(t,e),t.prototype._preparePendingTasks=function(e){var t,n=this,r=this.animationGroup.getValue(e),i=this.animation.getValue(e);if(!r&&!i)return this._reportError(e,"No animation or animation group provided");var o=this.currentAnimationGroup.getValue(e);o&&o!==r&&o.dispose();var a=r;if(i&&!a){var l=this.object.getValue(e);if(!l)return this._reportError(e,"No target object provided");var c=Array.isArray(i)?i:[i],u=c[0].name;a=new s.k("flowGraphAnimationGroup-"+u+"-"+l.name,e.configuration.scene);for(var h=!1,d=e._getGlobalContextVariable("interpolationAnimations",[]),p=0,f=c;p{var r=n(98519),i="fogVertex";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#ifdef FOG\nvFogDistance=(view*worldPos).xyz;\n#endif\n")},62623:(e,t,n)=>{n.d(t,{R:()=>l,h:()=>s});var r=n(37943),i=n(7164),o=n(81152),a=n(2362),s=function(){function e(e,t,n,i,o,a,s,l,c){void 0===i&&(i=0),void 0===o&&(o=!1),void 0===a&&(a=!1),void 0===s&&(s=!1),this._isAlreadyOwned=!1,this._isDisposed=!1,e&&e.getScene?this._engine=e.getScene().getEngine():this._engine=e,this._updatable=n,this._instanced=a,this._divisor=l||1,this._label=c,t instanceof r.n?(this._data=null,this._buffer=t):(this._data=t,this._buffer=null),this.byteStride=s?i:i*Float32Array.BYTES_PER_ELEMENT,o||this.create()}return Object.defineProperty(e.prototype,"isDisposed",{get:function(){return this._isDisposed},enumerable:!1,configurable:!0}),e.prototype.createVertexBuffer=function(e,t,n,r,i,o,a){void 0===o&&(o=!1);var s=o?t:t*Float32Array.BYTES_PER_ELEMENT,c=r?o?r:r*Float32Array.BYTES_PER_ELEMENT:this.byteStride;return new l(this._engine,this,e,this._updatable,!0,c,void 0===i?this._instanced:i,s,n,void 0,void 0,!0,this._divisor||a)},e.prototype.isUpdatable=function(){return this._updatable},e.prototype.getData=function(){return this._data},e.prototype.getBuffer=function(){return this._buffer},e.prototype.getStrideSize=function(){return this.byteStride/Float32Array.BYTES_PER_ELEMENT},e.prototype.create=function(e){void 0===e&&(e=null),!e&&this._buffer||(e=e||this._data)&&(this._buffer?this._updatable&&(this._engine.updateDynamicVertexBuffer(this._buffer,e),this._data=e):this._updatable?(this._buffer=this._engine.createDynamicVertexBuffer(e,this._label),this._data=e):this._buffer=this._engine.createVertexBuffer(e,void 0,this._label))},e.prototype._rebuild=function(){if(this._data)this._buffer=null,this.create(this._data);else{if(!this._buffer)return;if(this._buffer.capacity>0)return void(this._updatable?this._buffer=this._engine.createDynamicVertexBuffer(this._buffer.capacity,this._label):this._buffer=this._engine.createVertexBuffer(this._buffer.capacity,void 0,this._label));i.V.Warn('Missing data for buffer "'.concat(this._label,'" ').concat(this._buffer?"(uniqueId: "+this._buffer.uniqueId+")":"",". Buffer reconstruction failed.")),this._buffer=null}},e.prototype.update=function(e){this.create(e)},e.prototype.updateDirectly=function(e,t,n,r){void 0===r&&(r=!1),this._buffer&&this._updatable&&(this._engine.updateDynamicVertexBuffer(this._buffer,e,r?t:t*Float32Array.BYTES_PER_ELEMENT,n?n*this.byteStride:void 0),this._data=0===t&&void 0===n?e:null)},e.prototype._increaseReferences=function(){this._buffer&&(this._isAlreadyOwned?this._buffer.references++:this._isAlreadyOwned=!0)},e.prototype.dispose=function(){this._buffer&&this._engine._releaseBuffer(this._buffer)&&(this._isDisposed=!0,this._data=null,this._buffer=null)},e}(),l=function(){function e(t,n,r,i,o,l,c,u,h,d,p,f,m,_){var g,v,y,b,S;void 0===p&&(p=!1),void 0===f&&(f=!1),void 0===m&&(m=1),void 0===_&&(_=!1),this._isDisposed=!1;var T=!1;if(this.engine=t,"object"==typeof i&&null!==i?(T=null!==(g=i.updatable)&&void 0!==g&&g,o=i.postponeInternalCreation,l=i.stride,c=i.instanced,u=i.offset,h=i.size,d=i.type,p=null!==(v=i.normalized)&&void 0!==v&&v,f=null!==(y=i.useBytes)&&void 0!==y&&y,m=null!==(b=i.divisor)&&void 0!==b?b:1,_=null!==(S=i.takeBufferOwnership)&&void 0!==S&&S,this._label=i.label):T=!!i,n instanceof s?(this._buffer=n,this._ownsBuffer=_):(this._buffer=new s(t,n,T,l,o,c,f,m,this._label),this._ownsBuffer=!0),this.uniqueId=e._Counter++,this._kind=r,void 0===d){var E=this.getData();this.type=E?e.GetDataType(E):e.FLOAT}else this.type=d;var x=(0,a.PD)(this.type);f?(this._size=h||(l?l/x:e.DeduceStride(r)),this.byteStride=l||this._buffer.byteStride||this._size*x,this.byteOffset=u||0):(this._size=h||l||e.DeduceStride(r),this.byteStride=l?l*x:this._buffer.byteStride||this._size*x,this.byteOffset=(u||0)*x),this.normalized=p,this._instanced=void 0!==c&&c,this._instanceDivisor=c?m:0,this._alignBuffer(),this._computeHashCode()}return Object.defineProperty(e.prototype,"isDisposed",{get:function(){return this._isDisposed},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"instanceDivisor",{get:function(){return this._instanceDivisor},set:function(e){var t=0!=e;this._instanceDivisor=e,t!==this._instanced&&(this._instanced=t,this._computeHashCode())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_maxVerticesCount",{get:function(){var e=this.getData();return e?Array.isArray(e)?e.length/(this.byteStride/4)-this.byteOffset/4:(e.byteLength-this.byteOffset)/this.byteStride:0},enumerable:!1,configurable:!0}),e.prototype._computeHashCode=function(){this.hashCode=(this.type-5120|0)+((this.normalized?1:0)<<3)+(this._size<<4)+((this._instanced?1:0)<<6)+(this.byteStride<<12)},e.prototype._rebuild=function(){var e;null===(e=this._buffer)||void 0===e||e._rebuild()},e.prototype.getKind=function(){return this._kind},e.prototype.isUpdatable=function(){return this._buffer.isUpdatable()},e.prototype.getData=function(){return this._buffer.getData()},e.prototype.getFloatData=function(e,t){var n=this.getData();return n?(0,a.jm)(n,this._size,this.type,this.byteOffset,this.byteStride,this.normalized,e,t):null},e.prototype.getBuffer=function(){return this._buffer.getBuffer()},e.prototype.getWrapperBuffer=function(){return this._buffer},e.prototype.getStrideSize=function(){return this.byteStride/(0,a.PD)(this.type)},e.prototype.getOffset=function(){return this.byteOffset/(0,a.PD)(this.type)},e.prototype.getSize=function(e){return void 0===e&&(e=!1),e?this._size*(0,a.PD)(this.type):this._size},e.prototype.getIsInstanced=function(){return this._instanced},e.prototype.getInstanceDivisor=function(){return this._instanceDivisor},e.prototype.create=function(e){this._buffer.create(e),this._alignBuffer()},e.prototype.update=function(e){this._buffer.update(e),this._alignBuffer()},e.prototype.updateDirectly=function(e,t,n){void 0===n&&(n=!1),this._buffer.updateDirectly(e,t,void 0,n),this._alignBuffer()},e.prototype.dispose=function(){this._ownsBuffer&&this._buffer.dispose(),this._isDisposed=!0},e.prototype.forEach=function(e,t){var n=this;(0,a.XG)(this._buffer.getData(),this.byteOffset,this.byteStride,this._size,this.type,e,this.normalized,(function(e,r){for(var i=0;i{n.r(t),n.d(t,{clipPlaneVertexWGSL:()=>a});var r=n(98519),i="clipPlaneVertex",o="#ifdef CLIPPLANE\nvertexOutputs.fClipDistance=dot(worldPos,uniforms.vClipPlane);\n#endif\n#ifdef CLIPPLANE2\nvertexOutputs.fClipDistance2=dot(worldPos,uniforms.vClipPlane2);\n#endif\n#ifdef CLIPPLANE3\nvertexOutputs.fClipDistance3=dot(worldPos,uniforms.vClipPlane3);\n#endif\n#ifdef CLIPPLANE4\nvertexOutputs.fClipDistance4=dot(worldPos,uniforms.vClipPlane4);\n#endif\n#ifdef CLIPPLANE5\nvertexOutputs.fClipDistance5=dot(worldPos,uniforms.vClipPlane5);\n#endif\n#ifdef CLIPPLANE6\nvertexOutputs.fClipDistance6=dot(worldPos,uniforms.vClipPlane6);\n#endif\n";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]=o);var a={name:i,shader:o}},63327:(e,t,n)=>{n.r(t),n.d(t,{lineVertexShaderWGSL:()=>a});var r=n(98519),i=(n(63866),n(9436),n(36644),n(40647),n(38197),n(21310),n(63002),n(55607),"lineVertexShader"),o="#define ADDITIONAL_VERTEX_DECLARATION\n#include\n#include\n#include\n#include\nattribute position: vec3f;attribute normal: vec4f;uniform width: f32;uniform aspectRatio: f32;\n#include\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include\nvar worldViewProjection: mat4x4f=scene.viewProjection*finalWorld;var viewPosition: vec4f=worldViewProjection* vec4f(input.position,1.0);var viewPositionNext: vec4f=worldViewProjection* vec4f(input.normal.xyz,1.0);var currentScreen: vec2f=viewPosition.xy/viewPosition.w;var nextScreen: vec2f=viewPositionNext.xy/viewPositionNext.w;currentScreen=vec2f(currentScreen.x*uniforms.aspectRatio,currentScreen.y);nextScreen=vec2f(nextScreen.x*uniforms.aspectRatio,nextScreen.y);var dir: vec2f=normalize(nextScreen-currentScreen);var normalDir: vec2f= vec2f(-dir.y,dir.x);normalDir*=uniforms.width/2.0;normalDir=vec2f(normalDir.x/uniforms.aspectRatio,normalDir.y);var offset: vec4f= vec4f(normalDir*input.normal.w,0.0,0.0);vertexOutputs.position=viewPosition+offset;\n#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4) || defined(CLIPPLANE5) || defined(CLIPPLANE6)\nvar worldPos: vec4f=finalWorld*vec4f(input.position,1.0);\n#include\n#endif\n#include\n#define CUSTOM_VERTEX_MAIN_END\n}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},63639:(e,t,n)=>{n.d(t,{X:()=>a});var r=n(62623),i=n(81152),o=n(66377),a=function(){function e(e){this._vertexBuffers={},this.onBeforeRenderObservable=new o.cP,this._scene=e}return e.prototype._prepareBuffers=function(){if(!this._vertexBuffers[r.R.PositionKind]){var e=[];e.push(1,1),e.push(-1,1),e.push(-1,-1),e.push(1,-1),this._vertexBuffers[r.R.PositionKind]=new r.R(this._scene.getEngine(),e,r.R.PositionKind,!1,!1,2),this._buildIndexBuffer()}},e.prototype._buildIndexBuffer=function(){var e=[];e.push(0),e.push(1),e.push(2),e.push(0),e.push(2),e.push(3),this._indexBuffer=this._scene.getEngine().createIndexBuffer(e)},e.prototype._rebuild=function(){var e=this._vertexBuffers[r.R.PositionKind];e&&(e._rebuild(),this._buildIndexBuffer())},e.prototype._prepareFrame=function(e,t){void 0===e&&(e=null),void 0===t&&(t=null);var n=this._scene.activeCamera;return!(!n||!(t=t||n._postProcesses.filter((function(e){return null!=e})))||0===t.length||!this._scene.postProcessesEnabled||(t[0].activate(n,e,null!=t),0))},e.prototype.directRender=function(e,t,n,r,o,a,s){var l;void 0===t&&(t=null),void 0===n&&(n=!1),void 0===r&&(r=0),void 0===o&&(o=0),void 0===a&&(a=!1),void 0===s&&(s=e.length);for(var c=this._scene.getEngine(),u=0;u{var r=n(98519),i="instancesDeclaration";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="#ifdef INSTANCES\nattribute world0 : vec4;attribute world1 : vec4;attribute world2 : vec4;attribute world3 : vec4;\n#ifdef INSTANCESCOLOR\nattribute instanceColor : vec4;\n#endif\n#if defined(THIN_INSTANCES) && !defined(WORLD_UBO)\nuniform world : mat4x4;\n#endif\n#if defined(VELOCITY) || defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) || defined(VELOCITY_LINEAR)\nattribute previousWorld0 : vec4;attribute previousWorld1 : vec4;attribute previousWorld2 : vec4;attribute previousWorld3 : vec4;\n#ifdef THIN_INSTANCES\nuniform previousWorld : mat4x4;\n#endif\n#endif\n#else\n#if !defined(WORLD_UBO)\nuniform world : mat4x4;\n#endif\n#if defined(VELOCITY) || defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) || defined(VELOCITY_LINEAR)\nuniform previousWorld : mat4x4;\n#endif\n#endif\n")},63919:(e,t,n)=>{n.d(t,{D:()=>o});var r=n(81152),i=n(73152),o=function(){function e(t){var n,o,a;this._wrapU=r.Y.TEXTURE_WRAP_ADDRESSMODE,this._wrapV=r.Y.TEXTURE_WRAP_ADDRESSMODE,this.wrapR=r.Y.TEXTURE_WRAP_ADDRESSMODE,this.anisotropicFilteringLevel=4,this.delayLoadState=r.Y.DELAYLOADSTATE_NONE,this._texture=null,this._engine=null,this._cachedSize=i.o.Zero(),this._cachedBaseSize=i.o.Zero(),this._initialSamplingMode=r.Y.TEXTURE_BILINEAR_SAMPLINGMODE,this._texture=e._IsRenderTargetWrapper(t)?t.texture:t,this._texture&&(this._engine=this._texture.getEngine(),this.wrapU=null!==(n=this._texture._cachedWrapU)&&void 0!==n?n:this.wrapU,this.wrapV=null!==(o=this._texture._cachedWrapV)&&void 0!==o?o:this.wrapV,this.wrapR=null!==(a=this._texture._cachedWrapR)&&void 0!==a?a:this.wrapR)}return Object.defineProperty(e.prototype,"wrapU",{get:function(){return this._wrapU},set:function(e){this._wrapU=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"wrapV",{get:function(){return this._wrapV},set:function(e){this._wrapV=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coordinatesMode",{get:function(){return 0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isCube",{get:function(){return!!this._texture&&this._texture.isCube},set:function(e){this._texture&&(this._texture.isCube=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"is3D",{get:function(){return!!this._texture&&this._texture.is3D},set:function(e){this._texture&&(this._texture.is3D=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"is2DArray",{get:function(){return!!this._texture&&this._texture.is2DArray},set:function(e){this._texture&&(this._texture.is2DArray=e)},enumerable:!1,configurable:!0}),e.prototype.getClassName=function(){return"ThinTexture"},e._IsRenderTargetWrapper=function(e){return void 0!==(null==e?void 0:e.shareDepth)},e.prototype.isReady=function(){return this.delayLoadState===r.Y.DELAYLOADSTATE_NOTLOADED?(this.delayLoad(),!1):!!this._texture&&this._texture.isReady},e.prototype.delayLoad=function(){},e.prototype.getInternalTexture=function(){return this._texture},e.prototype.getSize=function(){if(this._texture){if(this._texture.width)return this._cachedSize.width=this._texture.width,this._cachedSize.height=this._texture.height,this._cachedSize;if(this._texture._size)return this._cachedSize.width=this._texture._size,this._cachedSize.height=this._texture._size,this._cachedSize}return this._cachedSize},e.prototype.getBaseSize=function(){return this.isReady()&&this._texture?this._texture._size?(this._cachedBaseSize.width=this._texture._size,this._cachedBaseSize.height=this._texture._size,this._cachedBaseSize):(this._cachedBaseSize.width=this._texture.baseWidth,this._cachedBaseSize.height=this._texture.baseHeight,this._cachedBaseSize):(this._cachedBaseSize.width=0,this._cachedBaseSize.height=0,this._cachedBaseSize)},Object.defineProperty(e.prototype,"samplingMode",{get:function(){return this._texture?this._texture.samplingMode:this._initialSamplingMode},enumerable:!1,configurable:!0}),e.prototype.updateSamplingMode=function(e,t){void 0===t&&(t=!1),this._texture&&this._engine&&this._engine.updateTextureSamplingMode(e,this._texture,this._texture.generateMipMaps&&t)},e.prototype.releaseInternalTexture=function(){this._texture&&(this._texture.dispose(),this._texture=null)},e.prototype.dispose=function(){this._texture&&(this.releaseInternalTexture(),this._engine=null)},e}()},63982:(e,t,n)=>{n.d(t,{i:()=>l});var r=n(78322),i=n(9151),o=n(27063),a=function(e){function t(t){var n=e.call(this)||this;n._coneInnerAngle=o.Qc.coneInnerAngle,n._coneOuterAngle=o.Qc.coneOuterAngle,n._coneOuterVolume=o.Qc.coneOuterVolume,n._distanceModel=o.Qc.distanceModel,n._maxDistance=o.Qc.maxDistance,n._minDistance=o.Qc.minDistance,n._panningModel=o.Qc.panningModel,n._rolloffFactor=o.Qc.rolloffFactor;var r=(0,i.y5)(t);return r?(n._position=r.position.clone(),n._rotation=r.rotation.clone(),n._rotationQuaternion=r.rotationQuaternion.clone()):(n._position=o.Qc.position.clone(),n._rotation=o.Qc.rotation.clone(),n._rotationQuaternion=o.Qc.rotationQuaternion.clone(),t.createAndAddSubNodeAsync("Spatial")),n._subGraph=t,n}return(0,r.C6)(t,e),Object.defineProperty(t.prototype,"coneInnerAngle",{get:function(){return this._coneInnerAngle},set:function(e){this._coneInnerAngle=e,(0,i.Pt)(this._subGraph,"coneInnerAngle",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"coneOuterAngle",{get:function(){return this._coneOuterAngle},set:function(e){this._coneOuterAngle=e,(0,i.Pt)(this._subGraph,"coneOuterAngle",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"coneOuterVolume",{get:function(){return this._coneOuterVolume},set:function(e){this._coneOuterVolume=e,(0,i.Pt)(this._subGraph,"coneOuterVolume",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"distanceModel",{get:function(){return this._distanceModel},set:function(e){this._distanceModel=e,(0,i.Pt)(this._subGraph,"distanceModel",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAttached",{get:function(){var e,t;return null!==(t=null===(e=this._subGraph.getSubNode("Spatial"))||void 0===e?void 0:e.isAttached)&&void 0!==t&&t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxDistance",{get:function(){return this._maxDistance},set:function(e){e<=0&&(e=1e-6),this._maxDistance=e,(0,i.Pt)(this._subGraph,"maxDistance",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minDistance",{get:function(){return this._minDistance},set:function(e){this._minDistance=e,(0,i.Pt)(this._subGraph,"minDistance",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"panningModel",{get:function(){return this._panningModel},set:function(e){this._panningModel=e,(0,i.Pt)(this._subGraph,"panningModel",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"position",{get:function(){return this._position},set:function(e){this._position=e,this._updatePosition()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rolloffFactor",{get:function(){return this._rolloffFactor},set:function(e){this._rolloffFactor=e,(0,i.Pt)(this._subGraph,"rolloffFactor",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotation",{get:function(){return this._rotation},set:function(e){this._rotation=e,this._updateRotation()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotationQuaternion",{get:function(){return this._rotationQuaternion},set:function(e){this._rotationQuaternion=e,this._updateRotation()},enumerable:!1,configurable:!0}),t.prototype.attach=function(e,t,n){var r;void 0===t&&(t=!1),void 0===n&&(n=3),null===(r=(0,i.y5)(this._subGraph))||void 0===r||r.attach(e,t,n)},t.prototype.detach=function(){var e;null===(e=(0,i.y5)(this._subGraph))||void 0===e||e.detach()},t.prototype.update=function(){var e=(0,i.y5)(this._subGraph);e&&(e.isAttached?e.update():(this._updatePosition(e),this._updateRotation(e)))},t.prototype._updatePosition=function(e){void 0===e&&(e=null),(e||(e=(0,i.y5)(this._subGraph)))&&(e.position.equalsWithEpsilon(this._position)||(e.position.copyFrom(this._position),e._updatePosition()))},t.prototype._updateRotation=function(e){void 0===e&&(e=null),(e||(e=(0,i.y5)(this._subGraph)))&&(e.rotationQuaternion.equalsWithEpsilon(this._rotationQuaternion)?e.rotation.equalsWithEpsilon(this._rotation)||(e.rotation.copyFrom(this._rotation),e._updateRotation()):(e.rotationQuaternion.copyFrom(this._rotationQuaternion),e._updateRotation()))},t}(o.lA),s=n(51162),l=function(e){function t(t,n,r){var i=e.call(this,t)||this;return i._updaterComponent=new s.w(i,n,r),i}return(0,r.C6)(t,e),Object.defineProperty(t.prototype,"minUpdateTime",{get:function(){return this._updaterComponent.minUpdateTime},set:function(e){this._updaterComponent.minUpdateTime=e},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this._updaterComponent.dispose(),this._updaterComponent=null},t}(a)},64015:(e,t,n)=>{n.r(t),n.d(t,{iblVoxelSlabDebugVertexShaderWGSL:()=>a});var r=n(98519),i="iblVoxelSlabDebugVertexShader",o="attribute position: vec3f;varying vNormalizedPosition: vec3f;uniform world: mat4x4f;uniform invWorldScale: mat4x4f;uniform cameraViewMatrix: mat4x4f;uniform projection: mat4x4f;uniform viewMatrix: mat4x4f;@vertex\nfn main(input : VertexInputs)->FragmentInputs {var worldPosition: vec4f=(uniforms.world* vec4f(input.position,1.));vertexOutputs.position=uniforms.projection*uniforms.cameraViewMatrix*worldPosition;vertexOutputs.vNormalizedPosition=(uniforms.viewMatrix*uniforms.invWorldScale*worldPosition).rgb;vertexOutputs.vNormalizedPosition=vertexOutputs.vNormalizedPosition* vec3f(0.5)+ vec3f(0.5);}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},64244:(e,t,n)=>{var r=n(98519),i="pbrBRDFFunctions";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#define FRESNEL_MAXIMUM_ON_ROUGH 0.25\n#define BRDF_DIFFUSE_MODEL_EON 0\n#define BRDF_DIFFUSE_MODEL_BURLEY 1\n#define BRDF_DIFFUSE_MODEL_LAMBERT 2\n#define BRDF_DIFFUSE_MODEL_LEGACY 3\n#define DIELECTRIC_SPECULAR_MODEL_GLTF 0\n#define DIELECTRIC_SPECULAR_MODEL_OPENPBR 1\n#define CONDUCTOR_SPECULAR_MODEL_GLTF 0\n#define CONDUCTOR_SPECULAR_MODEL_OPENPBR 1\n#if !defined(PBR_VERTEX_SHADER) && !defined(OPENPBR_VERTEX_SHADER)\n#ifdef MS_BRDF_ENERGY_CONSERVATION\nvec3 getEnergyConservationFactor(const vec3 specularEnvironmentR0,const vec3 environmentBrdf) {return 1.0+specularEnvironmentR0*(1.0/environmentBrdf.y-1.0);}\n#endif\n#if CONDUCTOR_SPECULAR_MODEL==CONDUCTOR_SPECULAR_MODEL_OPENPBR \nvec3 getF82Specular(float NdotV,vec3 F0,vec3 edgeTint,float roughness) {const float cos_theta_max=0.142857143; \nconst float one_minus_cos_theta_max_to_the_fifth=0.462664366; \nconst float one_minus_cos_theta_max_to_the_sixth=0.396569457; \nvec3 white_minus_F0=vec3(1.0)-F0;vec3 b_numerator=(F0+white_minus_F0*one_minus_cos_theta_max_to_the_fifth)*(vec3(1.0)-edgeTint);const float b_denominator=cos_theta_max*one_minus_cos_theta_max_to_the_sixth;const float b_denominator_reciprocal=1.0/b_denominator;vec3 b=b_numerator*b_denominator_reciprocal; \nfloat cos_theta=max(roughness,NdotV);float one_minus_cos_theta=1.0-cos_theta;vec3 offset_from_F0=(white_minus_F0-b*cos_theta*one_minus_cos_theta)*pow(one_minus_cos_theta,5.0);return clamp(F0+offset_from_F0,0.0,1.0);}\n#endif\n#ifdef FUZZENVIRONMENTBRDF\nvec3 getFuzzBRDFLookup(float NdotV,float perceptualRoughness) {vec2 UV=vec2(perceptualRoughness,NdotV);vec4 brdfLookup=texture(environmentFuzzBrdfSampler,UV);const vec2 RiRange=vec2(0.0,0.75);const vec2 ARange =vec2(0.005,0.88);const vec2 BRange =vec2(-0.18,0.002);brdfLookup.r=mix(ARange.x, ARange.y, brdfLookup.r);brdfLookup.g=mix(BRange.x, BRange.y, brdfLookup.g);brdfLookup.b=mix(RiRange.x,RiRange.y,brdfLookup.b);return brdfLookup.rgb;}\n#endif\n#ifdef ENVIRONMENTBRDF\nvec3 getBRDFLookup(float NdotV,float perceptualRoughness) {vec2 UV=vec2(NdotV,perceptualRoughness);vec4 brdfLookup=texture2D(environmentBrdfSampler,UV);\n#ifdef ENVIRONMENTBRDF_RGBD\nbrdfLookup.rgb=fromRGBD(brdfLookup.rgba);\n#endif\nreturn brdfLookup.rgb;}\nvec3 getReflectanceFromBRDFLookup(const vec3 specularEnvironmentR0,const vec3 specularEnvironmentR90,const vec3 environmentBrdf) {\n#ifdef BRDF_V_HEIGHT_CORRELATED\nvec3 reflectance=(specularEnvironmentR90-specularEnvironmentR0)*environmentBrdf.x+specularEnvironmentR0*environmentBrdf.y;\n#else\nvec3 reflectance=specularEnvironmentR0*environmentBrdf.x+specularEnvironmentR90*environmentBrdf.y;\n#endif\nreturn reflectance;}\nvec3 getReflectanceFromBRDFLookup(const vec3 specularEnvironmentR0,const vec3 environmentBrdf) {\n#ifdef BRDF_V_HEIGHT_CORRELATED\nvec3 reflectance=mix(environmentBrdf.xxx,environmentBrdf.yyy,specularEnvironmentR0);\n#else\nvec3 reflectance=specularEnvironmentR0*environmentBrdf.x+environmentBrdf.y;\n#endif\nreturn reflectance;}\n#endif\n/* NOT USED\n#if defined(SHEEN) && defined(SHEEN_SOFTER)\nfloat getBRDFLookupCharlieSheen(float NdotV,float perceptualRoughness)\n{float c=1.0-NdotV;float c3=c*c*c;return 0.65584461*c3+1.0/(4.16526551+exp(-7.97291361*perceptualRoughness+6.33516894));}\n#endif\n*/\n#if !defined(ENVIRONMENTBRDF) || defined(REFLECTIONMAP_SKYBOX) || defined(ALPHAFRESNEL)\nvec3 getReflectanceFromAnalyticalBRDFLookup_Jones(float VdotN,vec3 reflectance0,vec3 reflectance90,float smoothness)\n{float weight=mix(FRESNEL_MAXIMUM_ON_ROUGH,1.0,smoothness);return reflectance0+weight*(reflectance90-reflectance0)*pow5(saturate(1.0-VdotN));}\n#endif\n#if defined(SHEEN) && defined(ENVIRONMENTBRDF)\n/**\n* The sheen BRDF not containing F can be easily stored in the blue channel of the BRDF texture.\n* The blue channel contains DCharlie*VAshikhmin*NdotL as a lokkup table\n*/\nvec3 getSheenReflectanceFromBRDFLookup(const vec3 reflectance0,const vec3 environmentBrdf) {vec3 sheenEnvironmentReflectance=reflectance0*environmentBrdf.b;return sheenEnvironmentReflectance;}\n#endif\nvec3 fresnelSchlickGGX(float VdotH,vec3 reflectance0,vec3 reflectance90)\n{return reflectance0+(reflectance90-reflectance0)*pow5(1.0-VdotH);}\nfloat fresnelSchlickGGX(float VdotH,float reflectance0,float reflectance90)\n{return reflectance0+(reflectance90-reflectance0)*pow5(1.0-VdotH);}\n#ifdef CLEARCOAT\nvec3 getR0RemappedForClearCoat(vec3 f0) {\n#ifdef CLEARCOAT_DEFAULTIOR\n#ifdef MOBILE\nreturn saturate(f0*(f0*0.526868+0.529324)-0.0482256);\n#else\nreturn saturate(f0*(f0*(0.941892-0.263008*f0)+0.346479)-0.0285998);\n#endif\n#else\nvec3 s=sqrt(f0);vec3 t=(vClearCoatRefractionParams.z+vClearCoatRefractionParams.w*s)/(vClearCoatRefractionParams.w+vClearCoatRefractionParams.z*s);return square(t);\n#endif\n}\n#endif\n#ifdef IRIDESCENCE\nconst mat3 XYZ_TO_REC709=mat3(\n3.2404542,-0.9692660, 0.0556434,\n-1.5371385, 1.8760108,-0.2040259,\n-0.4985314, 0.0415560, 1.0572252\n);vec3 getIORTfromAirToSurfaceR0(vec3 f0) {vec3 sqrtF0=sqrt(f0);return (1.+sqrtF0)/(1.-sqrtF0);}\nvec3 getR0fromIORs(vec3 iorT,float iorI) {return square((iorT-vec3(iorI))/(iorT+vec3(iorI)));}\nfloat getR0fromIORs(float iorT,float iorI) {return square((iorT-iorI)/(iorT+iorI));}\nvec3 evalSensitivity(float opd,vec3 shift) {float phase=2.0*PI*opd*1.0e-9;const vec3 val=vec3(5.4856e-13,4.4201e-13,5.2481e-13);const vec3 pos=vec3(1.6810e+06,1.7953e+06,2.2084e+06);const vec3 var=vec3(4.3278e+09,9.3046e+09,6.6121e+09);vec3 xyz=val*sqrt(2.0*PI*var)*cos(pos*phase+shift)*exp(-square(phase)*var);xyz.x+=9.7470e-14*sqrt(2.0*PI*4.5282e+09)*cos(2.2399e+06*phase+shift[0])*exp(-4.5282e+09*square(phase));xyz/=1.0685e-7;vec3 srgb=XYZ_TO_REC709*xyz;return srgb;}\nvec3 evalIridescence(float outsideIOR,float eta2,float cosTheta1,float thinFilmThickness,vec3 baseF0) {vec3 I=vec3(1.0);float iridescenceIOR=mix(outsideIOR,eta2,smoothstep(0.0,0.03,thinFilmThickness));float sinTheta2Sq=square(outsideIOR/iridescenceIOR)*(1.0-square(cosTheta1));float cosTheta2Sq=1.0-sinTheta2Sq;if (cosTheta2Sq<0.0) {return I;}\nfloat cosTheta2=sqrt(cosTheta2Sq);float R0=getR0fromIORs(iridescenceIOR,outsideIOR);float R12=fresnelSchlickGGX(cosTheta1,R0,1.);float R21=R12;float T121=1.0-R12;float phi12=0.0;if (iridescenceIOR0.0 ? s/max(mu_i,mu_o) : s; \nfloat AF=1.0/(1.0+constant1_FON*sigma); \nvec3 f_ss=(rho*RECIPROCAL_PI)*AF*(1.0+sigma*sovertF); \nfloat EFo=E_FON_approx(mu_o,sigma); \nfloat EFi=E_FON_approx(mu_i,sigma); \nfloat avgEF=AF*(1.0+constant2_FON*sigma); \nvec3 rho_ms=(rho*rho)*avgEF/(vec3(1.0)-rho*(1.0-avgEF));const float eps=1.0e-7;vec3 f_ms=(rho_ms*RECIPROCAL_PI)*max(eps,1.0-EFo) \n* max(eps,1.0-EFi)\n/ max(eps,1.0-avgEF);return (f_ss+f_ms);}\n#ifdef SS_TRANSLUCENCY\nvec3 transmittanceBRDF_Burley(const vec3 tintColor,const vec3 diffusionDistance,float thickness) {vec3 S=1./maxEps(diffusionDistance);vec3 temp=exp((-0.333333333*thickness)*S);return tintColor.rgb*0.25*(temp*temp*temp+3.0*temp);}\nfloat computeWrappedDiffuseNdotL(float NdotL,float w) {float t=1.0+w;float invt2=1.0/square(t);return saturate((NdotL+w)*invt2);}\n#endif\n#endif \n")},64391:(e,t,n)=>{n.d(t,{Vn:()=>a,Zp:()=>o,mx:()=>l,tT:()=>s});var r=n(78322),i=n(8046),o=function(){function e(){}return e.POINTERDOWN=1,e.POINTERUP=2,e.POINTERMOVE=4,e.POINTERWHEEL=8,e.POINTERPICK=16,e.POINTERTAP=32,e.POINTERDOUBLETAP=64,e}(),a=function(e,t){this.type=e,this.event=t},s=function(e){function t(t,n,r,o){var a=e.call(this,t,n)||this;return a.ray=null,a.originalPickingInfo=null,a.skipOnPointerObservable=!1,a.localPosition=new i.I9(r,o),a}return(0,r.C6)(t,e),t}(a),l=function(e){function t(t,n,r,i){void 0===i&&(i=null);var o=e.call(this,t,n)||this;return o._pickInfo=r,o._inputManager=i,o}return(0,r.C6)(t,e),Object.defineProperty(t.prototype,"pickInfo",{get:function(){return this._pickInfo||this._generatePickInfo(),this._pickInfo},enumerable:!1,configurable:!0}),t.prototype._generatePickInfo=function(){this._inputManager&&(this._pickInfo=this._inputManager._pickMove(this.event),this._inputManager._setRayOnPointerInfo(this._pickInfo,this.event),this._inputManager=null)},t}(a)},64400:(e,t,n)=>{var r=n(98519),i="bakedVertexAnimationDeclaration";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#ifdef BAKED_VERTEX_ANIMATION_TEXTURE\nuniform float bakedVertexAnimationTime;uniform vec2 bakedVertexAnimationTextureSizeInverted;uniform vec4 bakedVertexAnimationSettings;uniform sampler2D bakedVertexAnimationTexture;\n#ifdef INSTANCES\nattribute vec4 bakedVertexAnimationSettingsInstanced;\n#endif\n#define inline\nmat4 readMatrixFromRawSamplerVAT(sampler2D smp,float index,float frame)\n{float offset=index*4.0;float frameUV=(frame+0.5)*bakedVertexAnimationTextureSizeInverted.y;float dx=bakedVertexAnimationTextureSizeInverted.x;vec4 m0=texture2D(smp,vec2(dx*(offset+0.5),frameUV));vec4 m1=texture2D(smp,vec2(dx*(offset+1.5),frameUV));vec4 m2=texture2D(smp,vec2(dx*(offset+2.5),frameUV));vec4 m3=texture2D(smp,vec2(dx*(offset+3.5),frameUV));return mat4(m0,m1,m2,m3);}\n#endif\n")},64541:(e,t,n)=>{n.r(t),n.d(t,{openpbrPixelShader:()=>x});var r=n(98519),i=(n(42107),n(81751),n(77740),"openpbrFragmentDeclaration");r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="uniform vec4 vEyePosition;uniform float vBaseWeight;uniform vec4 vBaseColor;uniform float vBaseDiffuseRoughness;uniform vec4 vReflectanceInfo;uniform vec4 vSpecularColor;uniform vec3 vSpecularAnisotropy;uniform float vCoatWeight;uniform vec3 vCoatColor;uniform float vCoatRoughness;uniform float vCoatRoughnessAnisotropy;uniform float vCoatIor;uniform float vCoatDarkening;uniform float vFuzzWeight;uniform vec3 vFuzzColor;uniform float vFuzzRoughness;uniform vec2 vGeometryCoatTangent;uniform vec3 vEmissionColor;uniform float vThinFilmWeight;uniform vec2 vThinFilmThickness;uniform float vThinFilmIor;uniform vec4 vLightingIntensity;uniform float visibility;\n#ifdef BASE_COLOR\nuniform vec2 vBaseColorInfos;\n#endif\n#ifdef BASE_WEIGHT\nuniform vec2 vBaseWeightInfos;\n#endif\n#ifdef BASE_METALNESS\nuniform vec2 vBaseMetalnessInfos;\n#endif\n#ifdef BASE_DIFFUSE_ROUGHNESS\nuniform vec2 vBaseDiffuseRoughnessInfos;\n#endif\n#ifdef SPECULAR_WEIGHT\nuniform vec2 vSpecularWeightInfos;\n#endif\n#ifdef SPECULAR_COLOR\nuniform vec2 vSpecularColorInfos;\n#endif\n#ifdef SPECULAR_ROUGHNESS\nuniform vec2 vSpecularRoughnessInfos;\n#endif\n#ifdef SPECULAR_ROUGHNESS_ANISOTROPY\nuniform vec2 vSpecularRoughnessAnisotropyInfos;\n#endif\n#ifdef SPECULAR_IOR\nuniform vec2 vSpecularIorInfos;\n#endif\n#ifdef AMBIENT_OCCLUSION\nuniform vec2 vAmbientOcclusionInfos;\n#endif\n#ifdef GEOMETRY_NORMAL\nuniform vec2 vGeometryNormalInfos;uniform vec2 vTangentSpaceParams;\n#endif\n#ifdef GEOMETRY_TANGENT\nuniform vec2 vGeometryTangentInfos;\n#endif\n#ifdef GEOMETRY_COAT_NORMAL\nuniform vec2 vGeometryCoatNormalInfos;\n#endif\n#ifdef GEOMETRY_OPACITY\nuniform vec2 vGeometryOpacityInfos;\n#endif\n#ifdef EMISSION_COLOR\nuniform vec2 vEmissionColorInfos;\n#endif\n#ifdef COAT_WEIGHT\nuniform vec2 vCoatWeightInfos;\n#endif\n#ifdef COAT_COLOR\nuniform vec2 vCoatColorInfos;\n#endif\n#ifdef COAT_ROUGHNESS\nuniform vec2 vCoatRoughnessInfos;\n#endif\n#ifdef COAT_ROUGHNESS_ANISOTROPY\nuniform vec2 vCoatRoughnessAnisotropyInfos;\n#endif\n#ifdef COAT_IOR\nuniform vec2 vCoatIorInfos;\n#endif\n#ifdef COAT_DARKENING\nuniform vec2 vCoatDarkeningInfos;\n#endif\n#ifdef FUZZ_WEIGHT\nuniform vec2 vFuzzWeightInfos;\n#endif\n#ifdef FUZZ_COLOR\nuniform vec2 vFuzzColorInfos;\n#endif\n#ifdef FUZZ_ROUGHNESS\nuniform vec2 vFuzzRoughnessInfos;\n#endif\n#ifdef GEOMETRY_COAT_TANGENT\nuniform vec2 vGeometryCoatTangentInfos;\n#endif\n#ifdef THIN_FILM_WEIGHT\nuniform vec2 vThinFilmWeightInfos;\n#endif\n#ifdef THIN_FILM_THICKNESS\nuniform vec2 vThinFilmThicknessInfos;\n#endif\n#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(SS_REFRACTION) || defined(PREPASS)\nuniform mat4 view;\n#endif\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;\n#ifdef REALTIME_FILTERING\nuniform vec2 vReflectionFilteringInfo;\n#endif\nuniform mat4 reflectionMatrix;uniform vec3 vReflectionMicrosurfaceInfos;\n#if defined(USEIRRADIANCEMAP) && defined(USE_IRRADIANCE_DOMINANT_DIRECTION)\nuniform vec3 vReflectionDominantDirection;\n#endif\n#if defined(USE_LOCAL_REFLECTIONMAP_CUBIC) && defined(REFLECTIONMAP_CUBIC)\nuniform vec3 vReflectionPosition;uniform vec3 vReflectionSize;\n#endif\n#endif\n#ifdef PREPASS\n#ifdef SS_SCATTERING\nuniform float scatteringDiffusionProfile;\n#endif\n#endif\n#if DEBUGMODE>0\nuniform vec2 vDebugMode;\n#endif\n#ifdef DETAIL\nuniform vec4 vDetailInfos;\n#endif\n#include\n#ifdef USESPHERICALFROMREFLECTIONMAP\n#ifdef SPHERICAL_HARMONICS\nuniform vec3 vSphericalL00;uniform vec3 vSphericalL1_1;uniform vec3 vSphericalL10;uniform vec3 vSphericalL11;uniform vec3 vSphericalL2_2;uniform vec3 vSphericalL2_1;uniform vec3 vSphericalL20;uniform vec3 vSphericalL21;uniform vec3 vSphericalL22;\n#else\nuniform vec3 vSphericalX;uniform vec3 vSphericalY;uniform vec3 vSphericalZ;uniform vec3 vSphericalXX_ZZ;uniform vec3 vSphericalYY_ZZ;uniform vec3 vSphericalZZ;uniform vec3 vSphericalXY;uniform vec3 vSphericalYZ;uniform vec3 vSphericalZX;\n#endif\n#endif\n#define ADDITIONAL_FRAGMENT_DECLARATION\n"),n(50163),n(58953),n(87283),n(32823),n(37755);var o="openpbrFragmentSamplersDeclaration";r.l.IncludesShadersStore[o]||(r.l.IncludesShadersStore[o]="#include(_DEFINENAME_,BASE_COLOR,_VARYINGNAME_,BaseColor,_SAMPLERNAME_,baseColor)\n#include(_DEFINENAME_,BASE_WEIGHT,_VARYINGNAME_,BaseWeight,_SAMPLERNAME_,baseWeight)\n#include(_DEFINENAME_,BASE_DIFFUSE_ROUGHNESS,_VARYINGNAME_,BaseDiffuseRoughness,_SAMPLERNAME_,baseDiffuseRoughness)\n#include(_DEFINENAME_,BASE_METALNESS,_VARYINGNAME_,BaseMetalness,_SAMPLERNAME_,baseMetalness)\n#include(_DEFINENAME_,SPECULAR_WEIGHT,_VARYINGNAME_,SpecularWeight,_SAMPLERNAME_,specularWeight)\n#include(_DEFINENAME_,SPECULAR_COLOR,_VARYINGNAME_,SpecularColor,_SAMPLERNAME_,specularColor)\n#include(_DEFINENAME_,SPECULAR_ROUGHNESS,_VARYINGNAME_,SpecularRoughness,_SAMPLERNAME_,specularRoughness)\n#include(_DEFINENAME_,SPECULAR_ROUGHNESS_ANISOTROPY,_VARYINGNAME_,SpecularRoughnessAnisotropy,_SAMPLERNAME_,specularRoughnessAnisotropy)\n#include(_DEFINENAME_,COAT_WEIGHT,_VARYINGNAME_,CoatWeight,_SAMPLERNAME_,coatWeight)\n#include(_DEFINENAME_,COAT_COLOR,_VARYINGNAME_,CoatColor,_SAMPLERNAME_,coatColor)\n#include(_DEFINENAME_,COAT_ROUGHNESS,_VARYINGNAME_,CoatRoughness,_SAMPLERNAME_,coatRoughness)\n#include(_DEFINENAME_,COAT_ROUGHNESS_ANISOTROPY,_VARYINGNAME_,CoatRoughnessAnisotropy,_SAMPLERNAME_,coatRoughnessAnisotropy)\n#include(_DEFINENAME_,COAT_DARKENING,_VARYINGNAME_,CoatDarkening,_SAMPLERNAME_,coatDarkening)\n#include(_DEFINENAME_,FUZZ_WEIGHT,_VARYINGNAME_,FuzzWeight,_SAMPLERNAME_,fuzzWeight)\n#include(_DEFINENAME_,FUZZ_COLOR,_VARYINGNAME_,FuzzColor,_SAMPLERNAME_,fuzzColor)\n#include(_DEFINENAME_,FUZZ_ROUGHNESS,_VARYINGNAME_,FuzzRoughness,_SAMPLERNAME_,fuzzRoughness)\n#include(_DEFINENAME_,GEOMETRY_OPACITY,_VARYINGNAME_,GeometryOpacity,_SAMPLERNAME_,geometryOpacity)\n#include(_DEFINENAME_,GEOMETRY_TANGENT,_VARYINGNAME_,GeometryTangent,_SAMPLERNAME_,geometryTangent)\n#include(_DEFINENAME_,GEOMETRY_COAT_TANGENT,_VARYINGNAME_,GeometryCoatTangent,_SAMPLERNAME_,geometryCoatTangent)\n#include(_DEFINENAME_,EMISSION_COLOR,_VARYINGNAME_,EmissionColor,_SAMPLERNAME_,emissionColor)\n#include(_DEFINENAME_,THIN_FILM_WEIGHT,_VARYINGNAME_,ThinFilmWeight,_SAMPLERNAME_,thinFilmWeight)\n#include(_DEFINENAME_,THIN_FILM_THICKNESS,_VARYINGNAME_,ThinFilmThickness,_SAMPLERNAME_,thinFilmThickness)\n#include(_DEFINENAME_,AMBIENT_OCCLUSION,_VARYINGNAME_,AmbientOcclusion,_SAMPLERNAME_,ambientOcclusion)\n#include(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_SAMPLERNAME_,decal)\n#ifdef REFLECTION\n#ifdef REFLECTIONMAP_3D\n#define sampleReflection(s,c) textureCube(s,c)\nuniform samplerCube reflectionSampler;\n#ifdef LODBASEDMICROSFURACE\n#define sampleReflectionLod(s,c,l) textureCubeLodEXT(s,c,l)\n#else\nuniform samplerCube reflectionSamplerLow;uniform samplerCube reflectionSamplerHigh;\n#endif\n#ifdef USEIRRADIANCEMAP\nuniform samplerCube irradianceSampler;\n#endif\n#else\n#define sampleReflection(s,c) texture2D(s,c)\nuniform sampler2D reflectionSampler;\n#ifdef LODBASEDMICROSFURACE\n#define sampleReflectionLod(s,c,l) texture2DLodEXT(s,c,l)\n#else\nuniform sampler2D reflectionSamplerLow;uniform sampler2D reflectionSamplerHigh;\n#endif\n#ifdef USEIRRADIANCEMAP\nuniform sampler2D irradianceSampler;\n#endif\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#else\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#endif\n#endif\n#ifdef ENVIRONMENTBRDF\nuniform sampler2D environmentBrdfSampler;\n#endif\n#ifdef FUZZENVIRONMENTBRDF\nuniform sampler2D environmentFuzzBrdfSampler;\n#endif\n#if defined(ANISOTROPIC) || defined(FUZZ)\nuniform sampler2D blueNoiseSampler;\n#endif\n#ifdef IBL_CDF_FILTERING\nuniform sampler2D icdfSampler;\n#endif\n"),n(59581),n(27003),n(59262),n(52767),n(75334),n(5447),n(19568),n(40246),n(40688),n(46837),n(92518),n(80752),n(62049),n(64244),n(10114),n(18973),n(31217);var a="openpbrNormalMapFragmentMainFunctions";r.l.IncludesShadersStore[a]||(r.l.IncludesShadersStore[a]="#if defined(GEOMETRY_NORMAL) || defined(GEOMETRY_COAT_NORMAL) || defined(ANISOTROPIC) || defined(FUZZ) || defined(DETAIL)\n#if defined(TANGENT) && defined(NORMAL) \nvarying mat3 vTBN;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\nuniform mat4 normalMatrix;\n#if defined(WEBGL2) || defined(WEBGPU)\nmat4 toNormalMatrix(mat4 wMatrix)\n{mat4 ret=inverse(wMatrix);ret=transpose(ret);ret[0][3]=0.;ret[1][3]=0.;ret[2][3]=0.;ret[3]=vec4(0.,0.,0.,1.);return ret;}\n#else\nmat4 toNormalMatrix(mat4 m)\n{float\na00=m[0][0],a01=m[0][1],a02=m[0][2],a03=m[0][3],\na10=m[1][0],a11=m[1][1],a12=m[1][2],a13=m[1][3],\na20=m[2][0],a21=m[2][1],a22=m[2][2],a23=m[2][3],\na30=m[3][0],a31=m[3][1],a32=m[3][2],a33=m[3][3],\nb00=a00*a11-a01*a10,\nb01=a00*a12-a02*a10,\nb02=a00*a13-a03*a10,\nb03=a01*a12-a02*a11,\nb04=a01*a13-a03*a11,\nb05=a02*a13-a03*a12,\nb06=a20*a31-a21*a30,\nb07=a20*a32-a22*a30,\nb08=a20*a33-a23*a30,\nb09=a21*a32-a22*a31,\nb10=a21*a33-a23*a31,\nb11=a22*a33-a23*a32,\ndet=b00*b11-b01*b10+b02*b09+b03*b08-b04*b07+b05*b06;mat4 mi=mat4(\na11*b11-a12*b10+a13*b09,\na02*b10-a01*b11-a03*b09,\na31*b05-a32*b04+a33*b03,\na22*b04-a21*b05-a23*b03,\na12*b08-a10*b11-a13*b07,\na00*b11-a02*b08+a03*b07,\na32*b02-a30*b05-a33*b01,\na20*b05-a22*b02+a23*b01,\na10*b10-a11*b08+a13*b06,\na01*b08-a00*b10-a03*b06,\na30*b04-a31*b02+a33*b00,\na21*b02-a20*b04-a23*b00,\na11*b07-a10*b09-a12*b06,\na00*b09-a01*b07+a02*b06,\na31*b01-a30*b03-a32*b00,\na20*b03-a21*b01+a22*b00)/det;return mat4(mi[0][0],mi[1][0],mi[2][0],mi[3][0],\nmi[0][1],mi[1][1],mi[2][1],mi[3][1],\nmi[0][2],mi[1][2],mi[2][2],mi[3][2],\nmi[0][3],mi[1][3],mi[2][3],mi[3][3]);}\n#endif\n#endif\nvec3 perturbNormalBase(mat3 cotangentFrame,vec3 normal,float scale)\n{\n#ifdef NORMALXYSCALE\nnormal=normalize(normal*vec3(scale,scale,1.0));\n#endif\nreturn normalize(cotangentFrame*normal);}\nvec3 perturbNormal(mat3 cotangentFrame,vec3 textureSample,float scale)\n{return perturbNormalBase(cotangentFrame,textureSample*2.0-1.0,scale);}\nmat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv,vec2 tangentSpaceParams)\n{vec3 dp1=dFdx(p);vec3 dp2=dFdy(p);vec2 duv1=dFdx(uv);vec2 duv2=dFdy(uv);vec3 dp2perp=cross(dp2,normal);vec3 dp1perp=cross(normal,dp1);vec3 tangent=dp2perp*duv1.x+dp1perp*duv2.x;vec3 bitangent=dp2perp*duv1.y+dp1perp*duv2.y;tangent*=tangentSpaceParams.x;bitangent*=tangentSpaceParams.y;float det=max(dot(tangent,tangent),dot(bitangent,bitangent));float invmax=det==0.0 ? 0.0 : inversesqrt(det);return mat3(tangent*invmax,bitangent*invmax,normal);}\n#endif\n");var s="openpbrNormalMapFragmentFunctions";r.l.IncludesShadersStore[s]||(r.l.IncludesShadersStore[s]="#if defined(GEOMETRY_NORMAL)\n#include(_DEFINENAME_,GEOMETRY_NORMAL,_VARYINGNAME_,GeometryNormal,_SAMPLERNAME_,geometryNormal)\n#endif\n#if defined(GEOMETRY_COAT_NORMAL)\n#include(_DEFINENAME_,GEOMETRY_COAT_NORMAL,_VARYINGNAME_,GeometryCoatNormal,_SAMPLERNAME_,geometryCoatNormal)\n#endif\n#if defined(DETAIL)\n#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail,_SAMPLERNAME_,detail)\n#endif\n#if defined(GEOMETRY_NORMAL) && defined(PARALLAX)\nconst float minSamples=4.;const float maxSamples=15.;const int iMaxSamples=15;vec2 parallaxOcclusion(vec3 vViewDirCoT,vec3 vNormalCoT,vec2 texCoord,float parallaxScale) {float parallaxLimit=length(vViewDirCoT.xy)/vViewDirCoT.z;parallaxLimit*=parallaxScale;vec2 vOffsetDir=normalize(vViewDirCoT.xy);vec2 vMaxOffset=vOffsetDir*parallaxLimit;float numSamples=maxSamples+(dot(vViewDirCoT,vNormalCoT)*(minSamples-maxSamples));float stepSize=1.0/numSamples;float currRayHeight=1.0;vec2 vCurrOffset=vec2(0,0);vec2 vLastOffset=vec2(0,0);float lastSampledHeight=1.0;float currSampledHeight=1.0;bool keepWorking=true;for (int i=0; icurrRayHeight)\n{float delta1=currSampledHeight-currRayHeight;float delta2=(currRayHeight+stepSize)-lastSampledHeight;float ratio=delta1/(delta1+delta2);vCurrOffset=(ratio)* vLastOffset+(1.0-ratio)*vCurrOffset;keepWorking=false;}\nelse\n{currRayHeight-=stepSize;vLastOffset=vCurrOffset;\n#ifdef PARALLAX_RHS\nvCurrOffset-=stepSize*vMaxOffset;\n#else\nvCurrOffset+=stepSize*vMaxOffset;\n#endif\nlastSampledHeight=currSampledHeight;}}\nreturn vCurrOffset;}\nvec2 parallaxOffset(vec3 viewDir,float heightScale)\n{float height=texture2D(geometryNormalSampler,vGeometryNormalUV).w;vec2 texCoordOffset=heightScale*viewDir.xy*height;\n#ifdef PARALLAX_RHS\nreturn texCoordOffset;\n#else\nreturn -texCoordOffset;\n#endif\n}\n#endif\n"),n(40150);var l="openpbrDielectricReflectance";r.l.IncludesShadersStore[l]||(r.l.IncludesShadersStore[l]="struct ReflectanceParams\n{float F0;float F90;vec3 coloredF0;vec3 coloredF90;};\n#define pbr_inline\nReflectanceParams dielectricReflectance(\nin float insideIOR,in float outsideIOR,in vec3 specularColor,in float specularWeight\n)\n{ReflectanceParams outParams;float dielectricF0=pow((insideIOR-outsideIOR)/(insideIOR+outsideIOR),2.0);float dielectricF0_NoSpec=pow((1.0-outsideIOR)/(1.0+outsideIOR),2.0);float f90Scale=clamp(2.0*abs(insideIOR-outsideIOR),0.0,1.0);float f90Scale_NoSpec=clamp(2.0*abs(1.0-outsideIOR),0.0,1.0);\n#if (DIELECTRIC_SPECULAR_MODEL==DIELECTRIC_SPECULAR_MODEL_OPENPBR)\nvec3 dielectricColorF90=specularColor.rgb*vec3(f90Scale);vec3 dielectricColorF90_NoSpec=specularColor.rgb*vec3(f90Scale_NoSpec);\n#else\nvec3 dielectricColorF90=vec3(f90Scale);vec3 dielectricColorF90_NoSpec=vec3(f90Scale_NoSpec);\n#endif\n#if DIELECTRIC_SPECULAR_MODEL==DIELECTRIC_SPECULAR_MODEL_GLTF\nfloat maxF0=max(specularColor.r,max(specularColor.g,specularColor.b));outParams.F0=mix(dielectricF0_NoSpec,dielectricF0,specularWeight)*maxF0;\n#else\noutParams.F0=mix(dielectricF0_NoSpec,dielectricF0,specularWeight);\n#endif\noutParams.F90=mix(f90Scale_NoSpec,f90Scale,specularWeight);outParams.coloredF0=mix(vec3(dielectricF0_NoSpec),vec3(dielectricF0),specularWeight)*specularColor.rgb;outParams.coloredF90=mix(dielectricColorF90_NoSpec,dielectricColorF90,specularWeight);return outParams;}\n");var c="openpbrConductorReflectance";r.l.IncludesShadersStore[c]||(r.l.IncludesShadersStore[c]="#define pbr_inline\nReflectanceParams conductorReflectance(in vec3 baseColor,in vec3 specularColor,in float specularWeight)\n{ReflectanceParams outParams;\n#if (CONDUCTOR_SPECULAR_MODEL==CONDUCTOR_SPECULAR_MODEL_OPENPBR)\noutParams.coloredF0=baseColor*specularWeight;outParams.coloredF90=specularColor*specularWeight;\n#else\noutParams.coloredF0=baseColor;outParams.coloredF90=vec3(1.0);\n#endif\noutParams.F0=1.0;outParams.F90=1.0;return outParams;}");var u="openpbrBlockAmbientOcclusion";r.l.IncludesShadersStore[u]||(r.l.IncludesShadersStore[u]="struct ambientOcclusionOutParams\n{vec3 ambientOcclusionColor;\n#if DEBUGMODE>0 && defined(AMBIENT_OCCLUSION)\nvec3 ambientOcclusionColorMap;\n#endif\n};\n#define pbr_inline\nambientOcclusionOutParams ambientOcclusionBlock(\n#ifdef AMBIENT_OCCLUSION\nin vec3 ambientOcclusionColorMap_,\nin vec2 ambientInfos\n#endif\n)\n{ambientOcclusionOutParams outParams;vec3 ambientOcclusionColor=vec3(1.,1.,1.);\n#ifdef AMBIENT_OCCLUSION\nvec3 ambientOcclusionColorMap=ambientOcclusionColorMap_*ambientInfos.y;\n#ifdef AMBIENTINGRAYSCALE\nambientOcclusionColorMap=vec3(ambientOcclusionColorMap.r,ambientOcclusionColorMap.r,ambientOcclusionColorMap.r);\n#endif\n#if DEBUGMODE>0\noutParams.ambientOcclusionColorMap=ambientOcclusionColorMap;\n#endif\n#endif\noutParams.ambientOcclusionColor=ambientOcclusionColor;return outParams;}\n");var h="openpbrGeometryInfo";r.l.IncludesShadersStore[h]||(r.l.IncludesShadersStore[h]="struct geometryInfoOutParams\n{float NdotV;float NdotVUnclamped;vec3 environmentBrdf;float horizonOcclusion;};struct geometryInfoAnisoOutParams\n{float NdotV;float NdotVUnclamped;vec3 environmentBrdf;float horizonOcclusion;float anisotropy;vec3 anisotropicTangent;vec3 anisotropicBitangent;mat3 TBN;};\n#define pbr_inline\ngeometryInfoOutParams geometryInfo(\nin vec3 normalW,in vec3 viewDirectionW,in float roughness,in vec3 geometricNormalW\n)\n{geometryInfoOutParams outParams;outParams.NdotVUnclamped=dot(normalW,viewDirectionW);outParams.NdotV=absEps(outParams.NdotVUnclamped);\n#if defined(ENVIRONMENTBRDF)\noutParams.environmentBrdf=getBRDFLookup(outParams.NdotV,roughness);\n#else\noutParams.environmentBrdf=vec3(0.0);\n#endif\noutParams.horizonOcclusion=1.0;\n#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\n#ifdef HORIZONOCCLUSION\n#if defined(GEOMETRY_NORMAL) || defined(GEOMETRY_COAT_NORMAL)\n#ifdef REFLECTIONMAP_3D\noutParams.horizonOcclusion=environmentHorizonOcclusion(-viewDirectionW,normalW,geometricNormalW);\n#endif\n#endif\n#endif\n#endif\nreturn outParams;}\n#define pbr_inline\ngeometryInfoAnisoOutParams geometryInfoAniso(\nin vec3 normalW,in vec3 viewDirectionW,in float roughness,in vec3 geometricNormalW\n,in vec3 vAnisotropy,in mat3 TBN\n)\n{geometryInfoOutParams geoInfo=geometryInfo(normalW,viewDirectionW,roughness,geometricNormalW);geometryInfoAnisoOutParams outParams;outParams.NdotV=geoInfo.NdotV;outParams.NdotVUnclamped=geoInfo.NdotVUnclamped;outParams.environmentBrdf=geoInfo.environmentBrdf;outParams.horizonOcclusion=geoInfo.horizonOcclusion;outParams.anisotropy=vAnisotropy.b;vec3 anisotropyDirection=vec3(vAnisotropy.xy,0.);mat3 anisoTBN=mat3(normalize(TBN[0]),normalize(TBN[1]),normalize(TBN[2]));outParams.anisotropicTangent=normalize(anisoTBN*anisotropyDirection);outParams.anisotropicBitangent=normalize(cross(anisoTBN[2],outParams.anisotropicTangent));outParams.TBN=TBN;return outParams;}");var d="openpbrIblFunctions";r.l.IncludesShadersStore[d]||(r.l.IncludesShadersStore[d]="#ifdef REFLECTION\nvec3 sampleIrradiance(\nin vec3 surfaceNormal\n#if defined(NORMAL) && defined(USESPHERICALINVERTEX)\n,in vec3 vEnvironmentIrradianceSH\n#endif\n#if (defined(USESPHERICALFROMREFLECTIONMAP) && (!defined(NORMAL) || !defined(USESPHERICALINVERTEX))) || (defined(USEIRRADIANCEMAP) && defined(REFLECTIONMAP_3D))\n,in mat4 iblMatrix\n#endif\n#ifdef USEIRRADIANCEMAP\n#ifdef REFLECTIONMAP_3D\n,in samplerCube irradianceSampler\n#else\n,in sampler2D irradianceSampler\n#endif\n#ifdef USE_IRRADIANCE_DOMINANT_DIRECTION\n,in vec3 reflectionDominantDirection\n#endif\n#endif\n#ifdef REALTIME_FILTERING\n,in vec2 vReflectionFilteringInfo\n#ifdef IBL_CDF_FILTERING\n,in sampler2D icdfSampler\n#endif\n#endif\n,in vec2 vReflectionInfos\n,in vec3 viewDirectionW\n,in float diffuseRoughness\n,in vec3 surfaceAlbedo\n) {vec3 environmentIrradiance=vec3(0.,0.,0.);\n#if (defined(USESPHERICALFROMREFLECTIONMAP) && (!defined(NORMAL) || !defined(USESPHERICALINVERTEX))) || (defined(USEIRRADIANCEMAP) && defined(REFLECTIONMAP_3D))\nvec3 irradianceVector=(iblMatrix*vec4(surfaceNormal,0)).xyz;vec3 irradianceView=(iblMatrix*vec4(viewDirectionW,0)).xyz;\n#if !defined(USE_IRRADIANCE_DOMINANT_DIRECTION) && !defined(REALTIME_FILTERING)\n#if BASE_DIFFUSE_MODEL != BRDF_DIFFUSE_MODEL_LAMBERT && BASE_DIFFUSE_MODEL != BRDF_DIFFUSE_MODEL_LEGACY\n{float NdotV=max(dot(surfaceNormal,viewDirectionW),0.0);irradianceVector=mix(irradianceVector,irradianceView,(0.5*(1.0-NdotV))*diffuseRoughness);}\n#endif\n#endif\n#ifdef REFLECTIONMAP_OPPOSITEZ\nirradianceVector.z*=-1.0;\n#endif\n#ifdef INVERTCUBICMAP\nirradianceVector.y*=-1.0;\n#endif\n#endif\n#ifdef USESPHERICALFROMREFLECTIONMAP\n#if defined(NORMAL) && defined(USESPHERICALINVERTEX)\nenvironmentIrradiance=vEnvironmentIrradianceSH;\n#else\n#if defined(REALTIME_FILTERING)\nenvironmentIrradiance=irradiance(reflectionSampler,irradianceVector,vReflectionFilteringInfo,diffuseRoughness,surfaceAlbedo,irradianceView\n#ifdef IBL_CDF_FILTERING\n,icdfSampler\n#endif\n);\n#else\nenvironmentIrradiance=computeEnvironmentIrradiance(irradianceVector);\n#endif\n#endif\n#elif defined(USEIRRADIANCEMAP)\n#ifdef REFLECTIONMAP_3D\nvec4 environmentIrradianceFromTexture=sampleReflection(irradianceSampler,irradianceVector);\n#else\nvec4 environmentIrradianceFromTexture=sampleReflection(irradianceSampler,reflectionCoords);\n#endif\nenvironmentIrradiance=environmentIrradianceFromTexture.rgb;\n#ifdef RGBDREFLECTION\nenvironmentIrradiance.rgb=fromRGBD(environmentIrradianceFromTexture);\n#endif\n#ifdef GAMMAREFLECTION\nenvironmentIrradiance.rgb=toLinearSpace(environmentIrradiance.rgb);\n#endif\n#ifdef USE_IRRADIANCE_DOMINANT_DIRECTION\nvec3 Ls=normalize(reflectionDominantDirection);float NoL=dot(irradianceVector,Ls);float NoV=dot(irradianceVector,irradianceView);vec3 diffuseRoughnessTerm=vec3(1.0);\n#if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON\nfloat LoV=dot (Ls,irradianceView);float mag=length(reflectionDominantDirection)*2.0;vec3 clampedAlbedo=clamp(surfaceAlbedo,vec3(0.1),vec3(1.0));diffuseRoughnessTerm=diffuseBRDF_EON(clampedAlbedo,diffuseRoughness,NoL,NoV,LoV)*PI;diffuseRoughnessTerm=diffuseRoughnessTerm/clampedAlbedo;diffuseRoughnessTerm=mix(vec3(1.0),diffuseRoughnessTerm,sqrt(clamp(mag*NoV,0.0,1.0)));\n#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY\nvec3 H=(irradianceView+Ls)*0.5;float VoH=dot(irradianceView,H);diffuseRoughnessTerm=vec3(diffuseBRDF_Burley(NoL,NoV,VoH,diffuseRoughness)*PI);\n#endif\nenvironmentIrradiance=environmentIrradiance.rgb*diffuseRoughnessTerm;\n#endif\n#endif\nenvironmentIrradiance*=vReflectionInfos.x;return environmentIrradiance;}\n#define pbr_inline\n#ifdef REFLECTIONMAP_3D\nvec3 createReflectionCoords(\n#else\nvec2 createReflectionCoords(\n#endif\nin vec3 vPositionW\n,in vec3 normalW\n)\n{vec3 reflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),normalW);\n#ifdef REFLECTIONMAP_OPPOSITEZ\nreflectionVector.z*=-1.0;\n#endif\n#ifdef REFLECTIONMAP_3D\nvec3 reflectionCoords=reflectionVector;\n#else\nvec2 reflectionCoords=reflectionVector.xy;\n#ifdef REFLECTIONMAP_PROJECTION\nreflectionCoords/=reflectionVector.z;\n#endif\nreflectionCoords.y=1.0-reflectionCoords.y;\n#endif\nreturn reflectionCoords;}\n#define pbr_inline\n#define inline\nvec3 sampleRadiance(\nin float alphaG\n,in vec3 vReflectionMicrosurfaceInfos\n,in vec2 vReflectionInfos\n,in geometryInfoOutParams geoInfo\n#ifdef REFLECTIONMAP_3D\n,in samplerCube reflectionSampler\n,const vec3 reflectionCoords\n#else\n,in sampler2D reflectionSampler\n,const vec2 reflectionCoords\n#endif\n#ifdef REALTIME_FILTERING\n,in vec2 vReflectionFilteringInfo\n#endif\n)\n{vec4 environmentRadiance=vec4(0.,0.,0.,0.);\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\nfloat reflectionLOD=getLodFromAlphaG(vReflectionMicrosurfaceInfos.x,alphaG,geoInfo.NdotVUnclamped);\n#elif defined(LINEARSPECULARREFLECTION)\nfloat reflectionLOD=getLinearLodFromRoughness(vReflectionMicrosurfaceInfos.x,roughness);\n#else\nfloat reflectionLOD=getLodFromAlphaG(vReflectionMicrosurfaceInfos.x,alphaG);\n#endif\nreflectionLOD=reflectionLOD*vReflectionMicrosurfaceInfos.y+vReflectionMicrosurfaceInfos.z;\n#ifdef REALTIME_FILTERING\nenvironmentRadiance=vec4(radiance(alphaG,reflectionSampler,reflectionCoords,vReflectionFilteringInfo),1.0);\n#else\nenvironmentRadiance=sampleReflectionLod(reflectionSampler,reflectionCoords,reflectionLOD);\n#endif\n#ifdef RGBDREFLECTION\nenvironmentRadiance.rgb=fromRGBD(environmentRadiance);\n#endif\n#ifdef GAMMAREFLECTION\nenvironmentRadiance.rgb=toLinearSpace(environmentRadiance.rgb);\n#endif\nenvironmentRadiance.rgb*=vec3(vReflectionInfos.x);return environmentRadiance.rgb;}\n#if defined(ANISOTROPIC)\n#define pbr_inline\n#define inline\nvec3 sampleRadianceAnisotropic(\nin float alphaG\n,in vec3 vReflectionMicrosurfaceInfos\n,in vec2 vReflectionInfos\n,in geometryInfoAnisoOutParams geoInfo\n,const vec3 normalW\n,const vec3 viewDirectionW\n,const vec3 positionW\n,const vec3 noise\n#ifdef REFLECTIONMAP_3D\n,in samplerCube reflectionSampler\n#else\n,in sampler2D reflectionSampler\n#endif\n#ifdef REALTIME_FILTERING\n,in vec2 vReflectionFilteringInfo\n#endif\n)\n{vec4 environmentRadiance=vec4(0.,0.,0.,0.);float alphaT=alphaG*sqrt(2.0/(1.0+(1.0-geoInfo.anisotropy)*(1.0-geoInfo.anisotropy)));float alphaB=(1.0-geoInfo.anisotropy)*alphaT;alphaG=alphaB;\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\nfloat reflectionLOD=getLodFromAlphaG(vReflectionMicrosurfaceInfos.x,alphaG,geoInfo.NdotVUnclamped);\n#elif defined(LINEARSPECULARREFLECTION)\nfloat reflectionLOD=getLinearLodFromRoughness(vReflectionMicrosurfaceInfos.x,roughness);\n#else\nfloat reflectionLOD=getLodFromAlphaG(vReflectionMicrosurfaceInfos.x,alphaG);\n#endif\nreflectionLOD=reflectionLOD*vReflectionMicrosurfaceInfos.y+vReflectionMicrosurfaceInfos.z;\n#ifdef REALTIME_FILTERING\nvec3 view=(reflectionMatrix*vec4(viewDirectionW,0.0)).xyz;vec3 tangent=(reflectionMatrix*vec4(geoInfo.anisotropicTangent,0.0)).xyz;vec3 bitangent=(reflectionMatrix*vec4(geoInfo.anisotropicBitangent,0.0)).xyz;vec3 normal=(reflectionMatrix*vec4(normalW,0.0)).xyz;\n#ifdef REFLECTIONMAP_OPPOSITEZ\nview.z*=-1.0;tangent.z*=-1.0;bitangent.z*=-1.0;normal.z*=-1.0;\n#endif\nenvironmentRadiance =\nvec4(radianceAnisotropic(alphaT,alphaB,reflectionSampler,\nview,tangent,\nbitangent,normal,\nvReflectionFilteringInfo,noise.xy),\n1.0);\n#else\nconst int samples=16;vec4 radianceSample=vec4(0.0);vec3 reflectionCoords=vec3(0.0);float sample_weight=0.0;float total_weight=0.0;float step=1.0/float(max(samples-1,1));for (int i=0; i0.0) {float blend=t;bentNormal=normalize(mix(normalW,geoInfo.anisotropicTangent,blend));} else {bentNormal=normalW;}\nreflectionCoords=createReflectionCoords(positionW,bentNormal);radianceSample=sampleReflectionLod(reflectionSampler,reflectionCoords,reflectionLOD);\n#ifdef RGBDREFLECTION\nenvironmentRadiance.rgb+=sample_weight*fromRGBD(radianceSample);\n#elif defined(GAMMAREFLECTION)\nenvironmentRadiance.rgb+=sample_weight*toLinearSpace(radianceSample.rgb);\n#else\nenvironmentRadiance.rgb+=sample_weight*radianceSample.rgb;\n#endif\ntotal_weight+=sample_weight;}\nenvironmentRadiance=vec4(environmentRadiance.xyz/float(total_weight),1.0);\n#endif\nenvironmentRadiance.rgb*=vec3(vReflectionInfos.x);return environmentRadiance.rgb;}\n#endif\n#define pbr_inline\nvec3 conductorIblFresnel(in ReflectanceParams reflectance,in float NdotV,in float roughness,in vec3 environmentBrdf)\n{\n#if (CONDUCTOR_SPECULAR_MODEL==CONDUCTOR_SPECULAR_MODEL_OPENPBR)\nvec3 albedoF0=mix(reflectance.coloredF0,pow(reflectance.coloredF0,vec3(1.4)),roughness);return getF82Specular(NdotV,albedoF0,reflectance.coloredF90,roughness);\n#else\nreturn getReflectanceFromBRDFLookup(reflectance.coloredF0,reflectance.coloredF90,environmentBrdf);\n#endif\n}\n#endif\n"),n(39643),n(79124);var p="openpbrNormalMapFragment";r.l.IncludesShadersStore[p]||(r.l.IncludesShadersStore[p]="vec2 uvOffset=vec2(0.0,0.0);\n#if defined(GEOMETRY_NORMAL) || defined(GEOMETRY_COAT_NORMAL) || defined(PARALLAX) || defined(DETAIL)\n#ifdef NORMALXYSCALE\nfloat normalScale=1.0;\n#elif defined(GEOMETRY_NORMAL)\nfloat normalScale=vGeometryNormalInfos.y;\n#else\nfloat normalScale=1.0;\n#endif\n#if defined(TANGENT) && defined(NORMAL)\nmat3 TBN=vTBN;\n#elif defined(GEOMETRY_NORMAL)\nvec2 TBNUV=gl_FrontFacing ? vGeometryNormalUV : -vGeometryNormalUV;mat3 TBN=cotangent_frame(normalW*normalScale,vPositionW,TBNUV,vTangentSpaceParams);\n#else\nvec2 TBNUV=gl_FrontFacing ? vDetailUV : -vDetailUV;mat3 TBN=cotangent_frame(normalW*normalScale,vPositionW,TBNUV,vec2(1.,1.));\n#endif\n#elif defined(ANISOTROPIC) || defined(FUZZ)\n#if defined(TANGENT) && defined(NORMAL)\nmat3 TBN=vTBN;\n#else\nvec2 TBNUV=gl_FrontFacing ? vMainUV1 : -vMainUV1;mat3 TBN=cotangent_frame(normalW,vPositionW,TBNUV,vec2(1.,1.));\n#endif\n#endif\n#ifdef PARALLAX\nmat3 invTBN=transposeMat3(TBN);\n#ifdef PARALLAXOCCLUSION\n#else\n#endif\n#endif\n#ifdef DETAIL\nvec4 detailColor=texture2D(detailSampler,vDetailUV+uvOffset);vec2 detailNormalRG=detailColor.wy*2.0-1.0;float detailNormalB=sqrt(1.-saturate(dot(detailNormalRG,detailNormalRG)));vec3 detailNormal=vec3(detailNormalRG,detailNormalB);\n#endif\n#ifdef GEOMETRY_COAT_NORMAL\ncoatNormalW=perturbNormal(TBN,texture2D(geometryCoatNormalSampler,vGeometryCoatNormalUV+uvOffset).xyz,vGeometryCoatNormalInfos.y);\n#endif\n#ifdef GEOMETRY_NORMAL\n#ifdef OBJECTSPACE_NORMALMAP\n#define CUSTOM_FRAGMENT_BUMP_FRAGMENT\nnormalW=normalize(texture2D(geometryNormalSampler,vGeometryNormalUV).xyz *2.0-1.0);normalW=normalize(mat3(normalMatrix)*normalW);\n#elif !defined(DETAIL)\nnormalW=perturbNormal(TBN,texture2D(geometryNormalSampler,vGeometryNormalUV+uvOffset).xyz,vGeometryNormalInfos.y);\n#else\nvec3 sampledNormal=texture2D(geometryNormalSampler,vGeometryNormalUV+uvOffset).xyz*2.0-1.0;\n#if DETAIL_NORMALBLENDMETHOD==0 \ndetailNormal.xy*=vDetailInfos.z;vec3 blendedNormal=normalize(vec3(sampledNormal.xy+detailNormal.xy,sampledNormal.z*detailNormal.z));\n#elif DETAIL_NORMALBLENDMETHOD==1 \ndetailNormal.xy*=vDetailInfos.z;sampledNormal+=vec3(0.0,0.0,1.0);detailNormal*=vec3(-1.0,-1.0,1.0);vec3 blendedNormal=sampledNormal*dot(sampledNormal,detailNormal)/sampledNormal.z-detailNormal;\n#endif\nnormalW=perturbNormalBase(TBN,blendedNormal,vGeometryNormalInfos.y);\n#endif\n#elif defined(DETAIL)\ndetailNormal.xy*=vDetailInfos.z;normalW=perturbNormalBase(TBN,detailNormal,vDetailInfos.z);\n#endif\n");var f="openpbrBlockNormalFinal";r.l.IncludesShadersStore[f]||(r.l.IncludesShadersStore[f]="#if defined(FORCENORMALFORWARD) && defined(NORMAL)\nvec3 faceNormal=normalize(cross(dFdx(vPositionW),dFdy(vPositionW)))*vEyePosition.w;\n#if defined(TWOSIDEDLIGHTING)\nfaceNormal=gl_FrontFacing ? faceNormal : -faceNormal;\n#endif\nnormalW*=sign(dot(normalW,faceNormal));coatNormalW*=sign(dot(coatNormalW,faceNormal));\n#endif\n#if defined(TWOSIDEDLIGHTING) && defined(NORMAL)\n#if defined(MIRRORED)\nnormalW=gl_FrontFacing ? -normalW : normalW;coatNormalW=gl_FrontFacing ? -coatNormalW : coatNormalW;\n#else\nnormalW=gl_FrontFacing ? normalW : -normalW;coatNormalW=gl_FrontFacing ? coatNormalW : -coatNormalW;\n#endif\n#endif\n");var m="openpbrBaseLayerData";r.l.IncludesShadersStore[m]||(r.l.IncludesShadersStore[m]="vec3 base_color=vec3(0.8);float base_metalness=0.0;float base_diffuse_roughness=0.0;float specular_weight=1.0;float specular_roughness=0.3;vec3 specular_color=vec3(1.0);float specular_roughness_anisotropy=0.0;float specular_ior=1.5;float alpha=1.0;vec2 geometry_tangent=vec2(1.0,0.0);\n#ifdef BASE_WEIGHT\nvec4 baseWeightFromTexture=texture2D(baseWeightSampler,vBaseWeightUV+uvOffset);\n#endif\n#ifdef BASE_COLOR\nvec4 baseColorFromTexture=texture2D(baseColorSampler,vBaseColorUV+uvOffset);\n#endif\n#ifdef BASE_METALNESS\nvec4 metallicFromTexture=texture2D(baseMetalnessSampler,vBaseMetalnessUV+uvOffset);\n#endif\n#if defined(ROUGHNESSSTOREINMETALMAPGREEN) && defined(BASE_METALNESS)\nfloat roughnessFromTexture=metallicFromTexture.g;\n#elif defined(SPECULAR_ROUGHNESS)\nfloat roughnessFromTexture=texture2D(specularRoughnessSampler,vSpecularRoughnessUV+uvOffset).r;\n#endif\n#ifdef GEOMETRY_TANGENT\nvec3 geometryTangentFromTexture=texture2D(geometryTangentSampler,vGeometryTangentUV+uvOffset).rgb;\n#endif\n#ifdef SPECULAR_ROUGHNESS_ANISOTROPY\nfloat anisotropyFromTexture=texture2D(specularRoughnessAnisotropySampler,vSpecularRoughnessAnisotropyUV+uvOffset).r*vSpecularRoughnessAnisotropyInfos.y;\n#endif\n#ifdef BASE_DIFFUSE_ROUGHNESS\nfloat baseDiffuseRoughnessFromTexture=texture2D(baseDiffuseRoughnessSampler,vBaseDiffuseRoughnessUV+uvOffset).r;\n#endif\n#ifdef GEOMETRY_OPACITY\nvec4 opacityFromTexture=texture2D(opacitySampler,vOpacityUV+uvOffset);\n#endif\n#ifdef DECAL\nvec4 decalFromTexture=texture2D(decalSampler,vDecalUV+uvOffset);\n#endif\n#ifdef SPECULAR_COLOR\nvec4 specularColorFromTexture=texture2D(specularColorSampler,vSpecularColorUV+uvOffset);\n#endif\n#ifdef SPECULAR_WEIGHT\n#ifdef SPECULAR_WEIGHT_IN_ALPHA\nfloat specularWeightFromTexture=texture2D(specularWeightSampler,vSpecularWeightUV+uvOffset).a;\n#else\nfloat specularWeightFromTexture=texture2D(specularWeightSampler,vSpecularWeightUV+uvOffset).r;\n#endif\n#endif\n#if defined(ANISOTROPIC) || defined(FUZZ)\nvec3 noise=texture2D(blueNoiseSampler,gl_FragCoord.xy/256.0).xyz;\n#endif\nbase_color=vBaseColor.rgb;\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nbase_color*=vColor.rgb;\n#endif\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\nbase_color*=vec3(vBaseWeight);alpha=vBaseColor.a;base_metalness=vReflectanceInfo.x;base_diffuse_roughness=vBaseDiffuseRoughness;specular_roughness=vReflectanceInfo.y;specular_color=vSpecularColor.rgb;specular_weight=vReflectanceInfo.a;specular_ior=vReflectanceInfo.z;specular_roughness_anisotropy=vSpecularAnisotropy.b;geometry_tangent=vSpecularAnisotropy.rg;\n#ifdef BASE_COLOR\n#ifdef BASE_COLOR_GAMMA\nbase_color*=toLinearSpace(baseColorFromTexture.rgb);\n#else\nbase_color*=baseColorFromTexture.rgb;\n#endif\nbase_color*=vBaseColorInfos.y;\n#endif\n#ifdef BASE_WEIGHT\nbase_color*=baseWeightFromTexture.r;\n#endif\n#if defined(BASE_COLOR) && defined(ALPHA_FROM_BASE_COLOR_TEXTURE)\nalpha*=baseColorFromTexture.a;\n#elif defined(GEOMETRY_OPACITY)\nalpha*=opacityFromTexture.r;alpha*=vGeometryOpacityInfos.y;\n#endif\n#ifdef ALPHATEST\n#if DEBUGMODE != 88\nif (alpha{n.d(t,{IG:()=>p,ov:()=>d,v9:()=>h});var r=n(11296),i=n(34623),o=n(56740),a=n(48810);function s(e){return Math.pow(e,o.tk)}function l(e){return e<=.04045?.0773993808*e:Math.pow(.947867299*(e+.055),2.4)}function c(e){return Math.pow(e,o.rv)}function u(e){return e<=.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}var h=function(){function e(e,t,n){void 0===e&&(e=0),void 0===t&&(t=0),void 0===n&&(n=0),this.r=e,this.g=t,this.b=n}return e.prototype.toString=function(){return"{R: "+this.r+" G:"+this.g+" B:"+this.b+"}"},e.prototype.getClassName=function(){return"Color3"},e.prototype.getHashCode=function(){var e=255*this.r|0;return 397*(e=397*e^255*this.g)^255*this.b},e.prototype.toArray=function(e,t){return void 0===t&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,this},e.prototype.fromArray=function(t,n){return void 0===n&&(n=0),e.FromArrayToRef(t,n,this),this},e.prototype.toColor4=function(e){return void 0===e&&(e=1),new d(this.r,this.g,this.b,e)},e.prototype.asArray=function(){return[this.r,this.g,this.b]},e.prototype.toLuminance=function(){return.3*this.r+.59*this.g+.11*this.b},e.prototype.multiply=function(t){return new e(this.r*t.r,this.g*t.g,this.b*t.b)},e.prototype.multiplyToRef=function(e,t){return t.r=this.r*e.r,t.g=this.g*e.g,t.b=this.b*e.b,t},e.prototype.multiplyInPlace=function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this},e.prototype.multiplyByFloats=function(t,n,r){return new e(this.r*t,this.g*n,this.b*r)},e.prototype.divide=function(e){throw new ReferenceError("Can not divide a color")},e.prototype.divideToRef=function(e,t){throw new ReferenceError("Can not divide a color")},e.prototype.divideInPlace=function(e){throw new ReferenceError("Can not divide a color")},e.prototype.minimizeInPlace=function(e){return this.minimizeInPlaceFromFloats(e.r,e.g,e.b)},e.prototype.maximizeInPlace=function(e){return this.maximizeInPlaceFromFloats(e.r,e.g,e.b)},e.prototype.minimizeInPlaceFromFloats=function(e,t,n){return this.r=Math.min(e,this.r),this.g=Math.min(t,this.g),this.b=Math.min(n,this.b),this},e.prototype.maximizeInPlaceFromFloats=function(e,t,n){return this.r=Math.max(e,this.r),this.g=Math.max(t,this.g),this.b=Math.max(n,this.b),this},e.prototype.floorToRef=function(e){throw new ReferenceError("Can not floor a color")},e.prototype.floor=function(){throw new ReferenceError("Can not floor a color")},e.prototype.fractToRef=function(e){throw new ReferenceError("Can not fract a color")},e.prototype.fract=function(){throw new ReferenceError("Can not fract a color")},e.prototype.equals=function(e){return e&&this.r===e.r&&this.g===e.g&&this.b===e.b},e.prototype.equalsFloats=function(e,t,n){return this.equalsToFloats(e,t,n)},e.prototype.equalsToFloats=function(e,t,n){return this.r===e&&this.g===t&&this.b===n},e.prototype.equalsWithEpsilon=function(e,t){return void 0===t&&(t=o.bH),(0,a.WithinEpsilon)(this.r,e.r,t)&&(0,a.WithinEpsilon)(this.g,e.g,t)&&(0,a.WithinEpsilon)(this.b,e.b,t)},e.prototype.negate=function(){throw new ReferenceError("Can not negate a color")},e.prototype.negateInPlace=function(){throw new ReferenceError("Can not negate a color")},e.prototype.negateToRef=function(e){throw new ReferenceError("Can not negate a color")},e.prototype.scale=function(t){return new e(this.r*t,this.g*t,this.b*t)},e.prototype.scaleInPlace=function(e){return this.r*=e,this.g*=e,this.b*=e,this},e.prototype.scaleToRef=function(e,t){return t.r=this.r*e,t.g=this.g*e,t.b=this.b*e,t},e.prototype.scaleAndAddToRef=function(e,t){return t.r+=this.r*e,t.g+=this.g*e,t.b+=this.b*e,t},e.prototype.clampToRef=function(e,t,n){return void 0===e&&(e=0),void 0===t&&(t=1),n.r=(0,a.Clamp)(this.r,e,t),n.g=(0,a.Clamp)(this.g,e,t),n.b=(0,a.Clamp)(this.b,e,t),n},e.prototype.add=function(t){return new e(this.r+t.r,this.g+t.g,this.b+t.b)},e.prototype.addInPlace=function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this},e.prototype.addInPlaceFromFloats=function(e,t,n){return this.r+=e,this.g+=t,this.b+=n,this},e.prototype.addToRef=function(e,t){return t.r=this.r+e.r,t.g=this.g+e.g,t.b=this.b+e.b,t},e.prototype.subtract=function(t){return new e(this.r-t.r,this.g-t.g,this.b-t.b)},e.prototype.subtractToRef=function(e,t){return t.r=this.r-e.r,t.g=this.g-e.g,t.b=this.b-e.b,t},e.prototype.subtractInPlace=function(e){return this.r-=e.r,this.g-=e.g,this.b-=e.b,this},e.prototype.subtractFromFloats=function(t,n,r){return new e(this.r-t,this.g-n,this.b-r)},e.prototype.subtractFromFloatsToRef=function(e,t,n,r){return r.r=this.r-e,r.g=this.g-t,r.b=this.b-n,r},e.prototype.clone=function(){return new e(this.r,this.g,this.b)},e.prototype.copyFrom=function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},e.prototype.copyFromFloats=function(e,t,n){return this.r=e,this.g=t,this.b=n,this},e.prototype.set=function(e,t,n){return this.copyFromFloats(e,t,n)},e.prototype.setAll=function(e){return this.r=this.g=this.b=e,this},e.prototype.toHexString=function(){var e=Math.round(255*this.r),t=Math.round(255*this.g),n=Math.round(255*this.b);return"#"+(0,a.ToHex)(e)+(0,a.ToHex)(t)+(0,a.ToHex)(n)},e.prototype.fromHexString=function(e){return"#"!==e.substring(0,1)||7!==e.length||(this.r=parseInt(e.substring(1,3),16)/255,this.g=parseInt(e.substring(3,5),16)/255,this.b=parseInt(e.substring(5,7),16)/255),this},e.prototype.toHSV=function(){return this.toHSVToRef(new e)},e.prototype.toHSVToRef=function(e){var t=this.r,n=this.g,r=this.b,i=Math.max(t,n,r),o=Math.min(t,n,r),a=0,s=0,l=i,c=i-o;return 0!==i&&(s=c/i),i!=o&&(i==t?(a=(n-r)/c,n=0&&o<=1?(s=i,l=a):o>=1&&o<=2?(s=a,l=i):o>=2&&o<=3?(l=i,c=a):o>=3&&o<=4?(l=a,c=i):o>=4&&o<=5?(s=a,c=i):o>=5&&o<=6&&(s=i,c=a);var u=n-i;return r.r=s+u,r.g=l+u,r.b=c+u,r},e.FromHSV=function(t,n,r){var i=new e(0,0,0);return e.HSVtoRGBToRef(t,n,r,i),i},e.FromHexString=function(t){return new e(0,0,0).fromHexString(t)},e.FromArray=function(t,n){return void 0===n&&(n=0),new e(t[n],t[n+1],t[n+2])},e.FromArrayToRef=function(e,t,n){void 0===t&&(t=0),n.r=e[t],n.g=e[t+1],n.b=e[t+2]},e.FromInts=function(t,n,r){return new e(t/255,n/255,r/255)},e.Lerp=function(t,n,r){var i=new e(0,0,0);return e.LerpToRef(t,n,r,i),i},e.LerpToRef=function(e,t,n,r){r.r=e.r+(t.r-e.r)*n,r.g=e.g+(t.g-e.g)*n,r.b=e.b+(t.b-e.b)*n},e.Hermite=function(t,n,r,i,o){var a=o*o,s=o*a,l=2*s-3*a+1,c=-2*s+3*a,u=s-2*a+o,h=s-a;return new e(t.r*l+r.r*c+n.r*u+i.r*h,t.g*l+r.g*c+n.g*u+i.g*h,t.b*l+r.b*c+n.b*u+i.b*h)},e.Hermite1stDerivative=function(t,n,r,i,o){var a=e.Black();return this.Hermite1stDerivativeToRef(t,n,r,i,o,a),a},e.Hermite1stDerivativeToRef=function(e,t,n,r,i,o){var a=i*i;o.r=6*(a-i)*e.r+(3*a-4*i+1)*t.r+6*(-a+i)*n.r+(3*a-2*i)*r.r,o.g=6*(a-i)*e.g+(3*a-4*i+1)*t.g+6*(-a+i)*n.g+(3*a-2*i)*r.g,o.b=6*(a-i)*e.b+(3*a-4*i+1)*t.b+6*(-a+i)*n.b+(3*a-2*i)*r.b},e.Red=function(){return new e(1,0,0)},e.Green=function(){return new e(0,1,0)},e.Blue=function(){return new e(0,0,1)},e.Black=function(){return new e(0,0,0)},Object.defineProperty(e,"BlackReadOnly",{get:function(){return e._BlackReadOnly},enumerable:!1,configurable:!0}),e.White=function(){return new e(1,1,1)},e.Purple=function(){return new e(.5,0,.5)},e.Magenta=function(){return new e(1,0,1)},e.Yellow=function(){return new e(1,1,0)},e.Gray=function(){return new e(.5,.5,.5)},e.Teal=function(){return new e(0,1,1)},e.Random=function(){return new e(Math.random(),Math.random(),Math.random())},e._V8PerformanceHack=new e(.5,.5,.5),e._BlackReadOnly=e.Black(),e}();Object.defineProperties(h.prototype,{dimension:{value:[3]},rank:{value:1}});var d=function(){function e(e,t,n,r){void 0===e&&(e=0),void 0===t&&(t=0),void 0===n&&(n=0),void 0===r&&(r=1),this.r=e,this.g=t,this.b=n,this.a=r}return e.prototype.asArray=function(){return[this.r,this.g,this.b,this.a]},e.prototype.toArray=function(e,t){return void 0===t&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e[t+3]=this.a,this},e.prototype.fromArray=function(e,t){return void 0===t&&(t=0),this.r=e[t],this.g=e[t+1],this.b=e[t+2],this.a=e[t+3],this},e.prototype.equals=function(e){return e&&this.r===e.r&&this.g===e.g&&this.b===e.b&&this.a===e.a},e.prototype.add=function(t){return new e(this.r+t.r,this.g+t.g,this.b+t.b,this.a+t.a)},e.prototype.addToRef=function(e,t){return t.r=this.r+e.r,t.g=this.g+e.g,t.b=this.b+e.b,t.a=this.a+e.a,t},e.prototype.addInPlace=function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this.a+=e.a,this},e.prototype.addInPlaceFromFloats=function(e,t,n,r){return this.r+=e,this.g+=t,this.b+=n,this.a+=r,this},e.prototype.subtract=function(t){return new e(this.r-t.r,this.g-t.g,this.b-t.b,this.a-t.a)},e.prototype.subtractToRef=function(e,t){return t.r=this.r-e.r,t.g=this.g-e.g,t.b=this.b-e.b,t.a=this.a-e.a,t},e.prototype.subtractInPlace=function(e){return this.r-=e.r,this.g-=e.g,this.b-=e.b,this.a-=e.a,this},e.prototype.subtractFromFloats=function(t,n,r,i){return new e(this.r-t,this.g-n,this.b-r,this.a-i)},e.prototype.subtractFromFloatsToRef=function(e,t,n,r,i){return i.r=this.r-e,i.g=this.g-t,i.b=this.b-n,i.a=this.a-r,i},e.prototype.scale=function(t){return new e(this.r*t,this.g*t,this.b*t,this.a*t)},e.prototype.scaleInPlace=function(e){return this.r*=e,this.g*=e,this.b*=e,this.a*=e,this},e.prototype.scaleToRef=function(e,t){return t.r=this.r*e,t.g=this.g*e,t.b=this.b*e,t.a=this.a*e,t},e.prototype.scaleAndAddToRef=function(e,t){return t.r+=this.r*e,t.g+=this.g*e,t.b+=this.b*e,t.a+=this.a*e,t},e.prototype.clampToRef=function(e,t,n){return void 0===e&&(e=0),void 0===t&&(t=1),n.r=(0,a.Clamp)(this.r,e,t),n.g=(0,a.Clamp)(this.g,e,t),n.b=(0,a.Clamp)(this.b,e,t),n.a=(0,a.Clamp)(this.a,e,t),n},e.prototype.multiply=function(t){return new e(this.r*t.r,this.g*t.g,this.b*t.b,this.a*t.a)},e.prototype.multiplyToRef=function(e,t){return t.r=this.r*e.r,t.g=this.g*e.g,t.b=this.b*e.b,t.a=this.a*e.a,t},e.prototype.multiplyInPlace=function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this.a*=e.a,this},e.prototype.multiplyByFloats=function(t,n,r,i){return new e(this.r*t,this.g*n,this.b*r,this.a*i)},e.prototype.divide=function(e){throw new ReferenceError("Can not divide a color")},e.prototype.divideToRef=function(e,t){throw new ReferenceError("Can not divide a color")},e.prototype.divideInPlace=function(e){throw new ReferenceError("Can not divide a color")},e.prototype.minimizeInPlace=function(e){return this.r=Math.min(this.r,e.r),this.g=Math.min(this.g,e.g),this.b=Math.min(this.b,e.b),this.a=Math.min(this.a,e.a),this},e.prototype.maximizeInPlace=function(e){return this.r=Math.max(this.r,e.r),this.g=Math.max(this.g,e.g),this.b=Math.max(this.b,e.b),this.a=Math.max(this.a,e.a),this},e.prototype.minimizeInPlaceFromFloats=function(e,t,n,r){return this.r=Math.min(e,this.r),this.g=Math.min(t,this.g),this.b=Math.min(n,this.b),this.a=Math.min(r,this.a),this},e.prototype.maximizeInPlaceFromFloats=function(e,t,n,r){return this.r=Math.max(e,this.r),this.g=Math.max(t,this.g),this.b=Math.max(n,this.b),this.a=Math.max(r,this.a),this},e.prototype.floorToRef=function(e){throw new ReferenceError("Can not floor a color")},e.prototype.floor=function(){throw new ReferenceError("Can not floor a color")},e.prototype.fractToRef=function(e){throw new ReferenceError("Can not fract a color")},e.prototype.fract=function(){throw new ReferenceError("Can not fract a color")},e.prototype.negate=function(){throw new ReferenceError("Can not negate a color")},e.prototype.negateInPlace=function(){throw new ReferenceError("Can not negate a color")},e.prototype.negateToRef=function(e){throw new ReferenceError("Can not negate a color")},e.prototype.equalsWithEpsilon=function(e,t){return void 0===t&&(t=o.bH),(0,a.WithinEpsilon)(this.r,e.r,t)&&(0,a.WithinEpsilon)(this.g,e.g,t)&&(0,a.WithinEpsilon)(this.b,e.b,t)&&(0,a.WithinEpsilon)(this.a,e.a,t)},e.prototype.equalsToFloats=function(e,t,n,r){return this.r===e&&this.g===t&&this.b===n&&this.a===r},e.prototype.toString=function(){return"{R: "+this.r+" G:"+this.g+" B:"+this.b+" A:"+this.a+"}"},e.prototype.getClassName=function(){return"Color4"},e.prototype.getHashCode=function(){var e=255*this.r|0;return 397*(e=397*(e=397*e^255*this.g)^255*this.b)^255*this.a},e.prototype.clone=function(){return(new e).copyFrom(this)},e.prototype.copyFrom=function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this},e.prototype.copyFromFloats=function(e,t,n,r){return this.r=e,this.g=t,this.b=n,this.a=r,this},e.prototype.set=function(e,t,n,r){return this.copyFromFloats(e,t,n,r)},e.prototype.setAll=function(e){return this.r=this.g=this.b=this.a=e,this},e.prototype.toHexString=function(e){void 0===e&&(e=!1);var t=Math.round(255*this.r),n=Math.round(255*this.g),r=Math.round(255*this.b);if(e)return"#"+(0,a.ToHex)(t)+(0,a.ToHex)(n)+(0,a.ToHex)(r);var i=Math.round(255*this.a);return"#"+(0,a.ToHex)(t)+(0,a.ToHex)(n)+(0,a.ToHex)(r)+(0,a.ToHex)(i)},e.prototype.fromHexString=function(e){return"#"!==e.substring(0,1)||9!==e.length&&7!==e.length||(this.r=parseInt(e.substring(1,3),16)/255,this.g=parseInt(e.substring(3,5),16)/255,this.b=parseInt(e.substring(5,7),16)/255,9===e.length&&(this.a=parseInt(e.substring(7,9),16)/255)),this},e.prototype.toLinearSpace=function(t){void 0===t&&(t=!1);var n=new e;return this.toLinearSpaceToRef(n,t),n},e.prototype.toLinearSpaceToRef=function(e,t){return void 0===t&&(t=!1),t?(e.r=l(this.r),e.g=l(this.g),e.b=l(this.b)):(e.r=s(this.r),e.g=s(this.g),e.b=s(this.b)),e.a=this.a,this},e.prototype.toGammaSpace=function(t){void 0===t&&(t=!1);var n=new e;return this.toGammaSpaceToRef(n,t),n},e.prototype.toGammaSpaceToRef=function(e,t){return void 0===t&&(t=!1),t?(e.r=u(this.r),e.g=u(this.g),e.b=u(this.b)):(e.r=c(this.r),e.g=c(this.g),e.b=c(this.b)),e.a=this.a,this},e.FromHexString=function(t){return"#"!==t.substring(0,1)||9!==t.length&&7!==t.length?new e(0,0,0,0):new e(0,0,0,1).fromHexString(t)},e.Lerp=function(t,n,r){return e.LerpToRef(t,n,r,new e)},e.LerpToRef=function(e,t,n,r){return r.r=e.r+(t.r-e.r)*n,r.g=e.g+(t.g-e.g)*n,r.b=e.b+(t.b-e.b)*n,r.a=e.a+(t.a-e.a)*n,r},e.Hermite=function(t,n,r,i,o){var a=o*o,s=o*a,l=2*s-3*a+1,c=-2*s+3*a,u=s-2*a+o,h=s-a;return new e(t.r*l+r.r*c+n.r*u+i.r*h,t.g*l+r.g*c+n.g*u+i.g*h,t.b*l+r.b*c+n.b*u+i.b*h,t.a*l+r.a*c+n.a*u+i.a*h)},e.Hermite1stDerivative=function(t,n,r,i,o){var a=new e;return this.Hermite1stDerivativeToRef(t,n,r,i,o,a),a},e.Hermite1stDerivativeToRef=function(e,t,n,r,i,o){var a=i*i;o.r=6*(a-i)*e.r+(3*a-4*i+1)*t.r+6*(-a+i)*n.r+(3*a-2*i)*r.r,o.g=6*(a-i)*e.g+(3*a-4*i+1)*t.g+6*(-a+i)*n.g+(3*a-2*i)*r.g,o.b=6*(a-i)*e.b+(3*a-4*i+1)*t.b+6*(-a+i)*n.b+(3*a-2*i)*r.b,o.a=6*(a-i)*e.a+(3*a-4*i+1)*t.a+6*(-a+i)*n.a+(3*a-2*i)*r.a},e.FromColor3=function(t,n){return void 0===n&&(n=1),new e(t.r,t.g,t.b,n)},e.FromArray=function(t,n){return void 0===n&&(n=0),new e(t[n],t[n+1],t[n+2],t[n+3])},e.FromArrayToRef=function(e,t,n){void 0===t&&(t=0),n.r=e[t],n.g=e[t+1],n.b=e[t+2],n.a=e[t+3]},e.FromInts=function(t,n,r,i){return new e(t/255,n/255,r/255,i/255)},e.CheckColors4=function(e,t){if(e.length===3*t){for(var n=[],r=0;r{n.r(t),n.d(t,{fluidRenderingParticleDepthVertexShaderWGSL:()=>a});var r=n(98519),i="fluidRenderingParticleDepthVertexShader",o="attribute position: vec3f;attribute offset: vec2f;uniform view: mat4x4f;uniform projection: mat4x4f;uniform size: vec2f;varying uv: vec2f;varying viewPos: vec3f;varying sphereRadius: f32;\n#ifdef FLUIDRENDERING_VELOCITY\nattribute velocity: vec3f;varying velocityNorm: f32;\n#endif\n@vertex\nfn main(input: VertexInputs)->FragmentInputs {var cornerPos: vec3f=vec3f(\nvec2f(input.offset.x-0.5,input.offset.y-0.5)*uniforms.size,\n0.0\n);vertexOutputs.viewPos=(uniforms.view*vec4f(input.position,1.0)).xyz;vertexOutputs.position=uniforms.projection*vec4f(vertexOutputs.viewPos+cornerPos,1.0);vertexOutputs.uv=input.offset;vertexOutputs.sphereRadius=uniforms.size.x/2.0;\n#ifdef FLUIDRENDERING_VELOCITY\nvertexOutputs.velocityNorm=length(velocity);\n#endif\n}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},64838:(e,t,n)=>{n(44256).ThinEngine.prototype.setDepthStencilTexture=function(e,t,n,r){void 0!==e&&(t&&(this._boundUniforms[e]=t),n&&n.depthStencilTexture?this._setTexture(e,n,!1,!0,r):this._setTexture(e,null,void 0,void 0,r))}},64880:(e,t,n)=>{n.d(t,{j:()=>d});var r=n(11296),i=n(8046),o=n(81152),a=n(54071),s=n(14389),l={min:0,max:0},c={min:0,max:0},u=function(e,t,n){var r=i.Pq.Dot(t.centerWorld,e),o=Math.abs(i.Pq.Dot(t.directions[0],e))*t.extendSize.x+Math.abs(i.Pq.Dot(t.directions[1],e))*t.extendSize.y+Math.abs(i.Pq.Dot(t.directions[2],e))*t.extendSize.z;n.min=r-o,n.max=r+o},h=function(e,t,n){return u(e,t,l),u(e,n,c),!(l.min>c.max||c.min>l.max)},d=function(){function e(e,t,n){this._isLocked=!1,this.boundingBox=new a.I(e,t,n),this.boundingSphere=new s.i(e,t,n)}return e.prototype.reConstruct=function(e,t,n){this.boundingBox.reConstruct(e,t,n),this.boundingSphere.reConstruct(e,t,n)},Object.defineProperty(e.prototype,"minimum",{get:function(){return this.boundingBox.minimum},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maximum",{get:function(){return this.boundingBox.maximum},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isLocked",{get:function(){return this._isLocked},set:function(e){this._isLocked=e},enumerable:!1,configurable:!0}),e.prototype.update=function(e){this._isLocked||(this.boundingBox._update(e),this.boundingSphere._update(e))},e.prototype.centerOn=function(t,n){var r=e._TmpVector3[0].copyFrom(t).subtractInPlace(n),i=e._TmpVector3[1].copyFrom(t).addInPlace(n);return this.boundingBox.reConstruct(r,i,this.boundingBox.getWorldMatrix()),this.boundingSphere.reConstruct(r,i,this.boundingBox.getWorldMatrix()),this},e.prototype.encapsulate=function(e){var t=i.Pq.Minimize(this.minimum,e),n=i.Pq.Maximize(this.maximum,e);return this.reConstruct(t,n,this.boundingBox.getWorldMatrix()),this},e.prototype.encapsulateBoundingInfo=function(e){var t=i.AA.Matrix[0];this.boundingBox.getWorldMatrix().invertToRef(t);var n=i.AA.Vector3[0];return i.Pq.TransformCoordinatesToRef(e.boundingBox.minimumWorld,t,n),this.encapsulate(n),i.Pq.TransformCoordinatesToRef(e.boundingBox.maximumWorld,t,n),this.encapsulate(n),this},e.prototype.scale=function(e){return this.boundingBox.scale(e),this.boundingSphere.scale(e),this},e.prototype.isInFrustum=function(e,t){return void 0===t&&(t=o.Y.MESHES_CULLINGSTRATEGY_STANDARD),!(t!==o.Y.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION&&t!==o.Y.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY||!this.boundingSphere.isCenterInFrustum(e))||!!this.boundingSphere.isInFrustum(e)&&(!(t!==o.Y.MESHES_CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY&&t!==o.Y.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY)||this.boundingBox.isInFrustum(e))},Object.defineProperty(e.prototype,"diagonalLength",{get:function(){var t=this.boundingBox;return t.maximumWorld.subtractToRef(t.minimumWorld,e._TmpVector3[0]).length()},enumerable:!1,configurable:!0}),e.prototype.isCompletelyInFrustum=function(e){return this.boundingBox.isCompletelyInFrustum(e)},e.prototype._checkCollision=function(e){return e._canDoCollision(this.boundingSphere.centerWorld,this.boundingSphere.radiusWorld,this.boundingBox.minimumWorld,this.boundingBox.maximumWorld)},e.prototype.intersectsPoint=function(e){return!!this.boundingSphere.centerWorld&&!!this.boundingSphere.intersectsPoint(e)&&!!this.boundingBox.intersectsPoint(e)},e.prototype.intersects=function(e,t){if(!s.i.Intersects(this.boundingSphere,e.boundingSphere))return!1;if(!a.I.Intersects(this.boundingBox,e.boundingBox))return!1;if(!t)return!0;var n=this.boundingBox,r=e.boundingBox;return!!(h(n.directions[0],n,r)&&h(n.directions[1],n,r)&&h(n.directions[2],n,r)&&h(r.directions[0],n,r)&&h(r.directions[1],n,r)&&h(r.directions[2],n,r)&&h(i.Pq.Cross(n.directions[0],r.directions[0]),n,r)&&h(i.Pq.Cross(n.directions[0],r.directions[1]),n,r)&&h(i.Pq.Cross(n.directions[0],r.directions[2]),n,r)&&h(i.Pq.Cross(n.directions[1],r.directions[0]),n,r)&&h(i.Pq.Cross(n.directions[1],r.directions[1]),n,r)&&h(i.Pq.Cross(n.directions[1],r.directions[2]),n,r)&&h(i.Pq.Cross(n.directions[2],r.directions[0]),n,r)&&h(i.Pq.Cross(n.directions[2],r.directions[1]),n,r)&&h(i.Pq.Cross(n.directions[2],r.directions[2]),n,r))},e._TmpVector3=(0,r.mI)(2,i.Pq.Zero),e}()},65054:(e,t,n)=>{n.d(t,{FA:()=>g,O_:()=>_,uT:()=>v});var r=n(7164),i=1,o=2,a=3,s=9,l=10,c=11,u=48,h=4,d=0,p=1,f=2,m=3;function _(e){var t=0;return{id_length:e[t++],colormap_type:e[t++],image_type:e[t++],colormap_index:e[t++]|e[t++]<<8,colormap_length:e[t++]|e[t++]<<8,colormap_size:e[t++],origin:[e[t++]|e[t++]<<8,e[t++]|e[t++]<<8],width:e[t++]|e[t++]<<8,height:e[t++]|e[t++]<<8,pixel_size:e[t++],flags:e[t++]}}function g(e,t){if(t.length<19)r.V.Error("Unable to load TGA file - Not enough data to contain header");else{var n=18,g=_(t);if(g.id_length+n>t.length)r.V.Error("Unable to load TGA file - Not enough data");else{n+=g.id_length;var y,b=!1,S=!1,T=!1;switch(g.image_type){case s:b=!0;case i:S=!0;break;case l:b=!0;case o:break;case c:b=!0;case a:T=!0}var E,x,P,C,R,A,I,O=g.pixel_size>>3,M=g.width*g.height*O;if(S&&(E=t.subarray(n,n+=g.colormap_length*(g.colormap_size>>3))),b){y=new Uint8Array(M);for(var D=void 0,N=void 0,F=void 0,L=0,w=new Uint8Array(O);n>h){default:case f:x=0,C=1,I=g.width,P=0,R=1,A=g.height;break;case d:x=0,C=1,I=g.width,P=g.height-1,R=-1,A=-1;break;case m:x=g.width-1,C=-1,I=-1,P=0,R=1,A=g.height;break;case p:x=g.width-1,C=-1,I=-1,P=g.height-1,R=-1,A=-1}var B="_getImageData"+(T?"Grey":"")+g.pixel_size+"bits",V=v[B](g,E,y,P,R,A,x,C,I);e.getEngine()._uploadDataToTextureDirectly(e,V)}}}var v={GetTGAHeader:_,UploadContent:g,_getImageData8bits:function(e,t,n,r,i,o,a,s,l){var c,u,h,d=n,p=t,f=e.width,m=e.height,_=0,g=new Uint8Array(f*m*4);for(h=r;h!==o;h+=i)for(u=a;u!==l;u+=s,_++)c=d[_],g[4*(u+f*h)+3]=255,g[4*(u+f*h)+2]=p[3*c+0],g[4*(u+f*h)+1]=p[3*c+1],g[4*(u+f*h)+0]=p[3*c+2];return g},_getImageData16bits:function(e,t,n,r,i,o,a,s,l){var c,u,h,d=n,p=e.width,f=e.height,m=0,_=new Uint8Array(p*f*4);for(h=r;h!==o;h+=i)for(u=a;u!==l;u+=s,m+=2){var g=255*((31744&(c=d[m+0]+(d[m+1]<<8)))>>10)/31|0,v=255*((992&c)>>5)/31|0,y=255*(31&c)/31|0;_[4*(u+p*h)+0]=g,_[4*(u+p*h)+1]=v,_[4*(u+p*h)+2]=y,_[4*(u+p*h)+3]=32768&c?0:255}return _},_getImageData24bits:function(e,t,n,r,i,o,a,s,l){var c,u,h=n,d=e.width,p=e.height,f=0,m=new Uint8Array(d*p*4);for(u=r;u!==o;u+=i)for(c=a;c!==l;c+=s,f+=3)m[4*(c+d*u)+3]=255,m[4*(c+d*u)+2]=h[f+0],m[4*(c+d*u)+1]=h[f+1],m[4*(c+d*u)+0]=h[f+2];return m},_getImageData32bits:function(e,t,n,r,i,o,a,s,l){var c,u,h=n,d=e.width,p=e.height,f=0,m=new Uint8Array(d*p*4);for(u=r;u!==o;u+=i)for(c=a;c!==l;c+=s,f+=4)m[4*(c+d*u)+2]=h[f+0],m[4*(c+d*u)+1]=h[f+1],m[4*(c+d*u)+0]=h[f+2],m[4*(c+d*u)+3]=h[f+3];return m},_getImageDataGrey8bits:function(e,t,n,r,i,o,a,s,l){var c,u,h,d=n,p=e.width,f=e.height,m=0,_=new Uint8Array(p*f*4);for(h=r;h!==o;h+=i)for(u=a;u!==l;u+=s,m++)c=d[m],_[4*(u+p*h)+0]=c,_[4*(u+p*h)+1]=c,_[4*(u+p*h)+2]=c,_[4*(u+p*h)+3]=255;return _},_getImageDataGrey16bits:function(e,t,n,r,i,o,a,s,l){var c,u,h=n,d=e.width,p=e.height,f=0,m=new Uint8Array(d*p*4);for(u=r;u!==o;u+=i)for(c=a;c!==l;c+=s,f+=2)m[4*(c+d*u)+0]=h[f+0],m[4*(c+d*u)+1]=h[f+0],m[4*(c+d*u)+2]=h[f+0],m[4*(c+d*u)+3]=h[f+1];return m}}},65110:(e,t,n)=>{n.d(t,{SM:()=>f,rT:()=>u,BT:()=>p});var r=n(21823),i=n(78322),o=n(66377),a=n(57475),s=n(6927),l=n(85258),c=n(8046),u=function(){function e(e,t,n,r,i,a,s,l,c,u,h){void 0===n&&(n=0),void 0===r&&(r=100),void 0===i&&(i=!1),void 0===a&&(a=1),void 0===u&&(u=!1),void 0===h&&(h=0),this.target=t,this.fromFrame=n,this.toFrame=r,this.loopAnimation=i,this.onAnimationEnd=s,this.onAnimationLoop=c,this.isAdditive=u,this.playOrder=h,this._localDelayOffset=null,this._pausedDelay=null,this._manualJumpDelay=null,this._runtimeAnimations=new Array,this._paused=!1,this._speedRatio=1,this._weight=-1,this._previousWeight=-1,this._syncRoot=null,this._frameToSyncFromJump=null,this._goToFrame=null,this.disposeOnEnd=!0,this.animationStarted=!1,this.onAnimationEndObservable=new o.cP,this.onAnimationLoopObservable=new o.cP,this._scene=e,l&&this.appendAnimations(t,l),this._speedRatio=a,e._activeAnimatables.push(this)}return Object.defineProperty(e.prototype,"syncRoot",{get:function(){return this._syncRoot},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"masterFrame",{get:function(){return 0===this._runtimeAnimations.length?0:this._runtimeAnimations[0].currentFrame},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"weight",{get:function(){return this._weight},set:function(e){this._weight=-1!==e?Math.min(Math.max(e,0),1):-1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"speedRatio",{get:function(){return this._speedRatio},set:function(e){for(var t=0;t-1&&(this._scene._activeAnimatables.splice(t,1),this._scene._activeAnimatables.push(this))}return this},e.prototype.getAnimations=function(){return this._runtimeAnimations},e.prototype.appendAnimations=function(e,t){for(var n=this,r=0;r-1){for(var o=(s=this._runtimeAnimations).length-1;o>=0;o--){var a=s[o];e&&a.animation.name!=e||t&&!t(a.target)||(a.dispose(),s.splice(o,1))}0==s.length&&(n||this._scene._activeAnimatables.splice(i,1),r||this._raiseOnAnimationEnd())}}else if((o=this._scene._activeAnimatables.indexOf(this))>-1){n||this._scene._activeAnimatables.splice(o,1);for(var s=this._runtimeAnimations,l=0;l0?l:-l,i),d.scaleAndAddToRef(l,n)}i.normalize()}for(h=0;h0)i.copyFrom(r);else if(1===e.animations.length){if(c.PT.SlerpToRef(r,n.currentValue,Math.min(1,e.totalWeight),i),0===e.totalAdditiveWeight)return i}else if(e.animations.length>1){var o=1,a=void 0,s=void 0;if(e.totalWeight<1){var l=1-e.totalWeight;s=[],(a=[]).push(r),s.push(l)}else{if(2===e.animations.length&&(c.PT.SlerpToRef(e.animations[0].currentValue,e.animations[1].currentValue,e.animations[1].weight/e.totalWeight,t),0===e.totalAdditiveWeight))return t;a=[],s=[],o=e.totalWeight}for(var u=0;u=u&&a.frame<=h&&(r?(c=a.value.clone(),_?(l=c.getTranslation(),c.setTranslation(l.scaleInPlace(g))):v&&i?(l=c.getTranslation(),c.setTranslation(l.multiplyInPlace(i))):c=a.value):c=a.value,y.push({frame:a.frame+n,value:c}));return this.animations[0].createRange(t,u+n,h+n),!0}),e&&(e.prototype._animate=function(e){if(this.animationsEnabled){var t=l.j.Now;if(!this._animationTimeLast){if(this._pendingData.length>0)return;this._animationTimeLast=t}this.deltaTime=void 0!==e?e:this.useConstantAnimationDeltaTime?16:(t-this._animationTimeLast)*this.animationTimeScale,this._animationTimeLast=t;var n=this._activeAnimatables;if(0!==n.length){this._animationTime+=this.deltaTime;for(var r=this._animationTime,i=0;in&&(i=-i),s&&this.stopAnimation(e,void 0,l),a||(a=new u(this,e,t,n,r,i,o,void 0,c,h));var p=!l||l(e);if(e.animations&&p&&a.appendAnimations(e,e.animations),e.getAnimatables)for(var f=e.getAnimatables(),m=0;mr&&(o=-o),new u(this,e,n,r,i,o,a,t,s,l)},e.prototype.beginDirectHierarchyAnimation=function(e,t,n,r,i,o,a,s,l,c){void 0===c&&(c=!1);var u=e.getDescendants(t),h=[];h.push(this.beginDirectAnimation(e,n,r,i,o,a,s,l,c));for(var d=0,p=u;d{var r=n(98519),i=(n(23170),n(10513),"pbrDirectLightingFunctions");r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="#define CLEARCOATREFLECTANCE90 1.0\nstruct lightingInfo\n{diffuse: vec3f,\n#ifdef SS_TRANSLUCENCY\ndiffuseTransmission: vec3f,\n#endif\n#ifdef SPECULARTERM\nspecular: vec3f,\n#endif\n#ifdef CLEARCOAT\nclearCoat: vec4f,\n#endif\n#ifdef SHEEN\nsheen: vec3f\n#endif\n};fn adjustRoughnessFromLightProperties(roughness: f32,lightRadius: f32,lightDistance: f32)->f32 {\n#if defined(USEPHYSICALLIGHTFALLOFF) || defined(USEGLTFLIGHTFALLOFF)\nvar lightRoughness: f32=lightRadius/lightDistance;var totalRoughness: f32=saturate(lightRoughness+roughness);return totalRoughness;\n#else\nreturn roughness;\n#endif\n}\nfn computeHemisphericDiffuseLighting(info: preLightingInfo,lightColor: vec3f,groundColor: vec3f)->vec3f {return mix(groundColor,lightColor,info.NdotL);}\n#if defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)\nfn computeAreaDiffuseLighting(info: preLightingInfo,lightColor: vec3f)->vec3f {return info.areaLightDiffuse*lightColor;}\n#endif\nfn computeDiffuseLighting(info: preLightingInfo,lightColor: vec3f)->vec3f {var diffuseTerm: vec3f=vec3f(1.0/PI);\n#if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_LEGACY\ndiffuseTerm=vec3f(diffuseBRDF_Burley(info.NdotL,info.NdotV,info.VdotH,info.roughness));\n#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY\ndiffuseTerm=vec3f(diffuseBRDF_Burley(info.NdotL,info.NdotV,info.VdotH,info.diffuseRoughness));\n#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON\nvar clampedAlbedo: vec3f=clamp(info.surfaceAlbedo,vec3f(0.1),vec3f(1.0));diffuseTerm=diffuseBRDF_EON(clampedAlbedo,info.diffuseRoughness,info.NdotL,info.NdotV,info.LdotV);diffuseTerm/=clampedAlbedo;\n#endif\nreturn diffuseTerm*info.attenuation*info.NdotL*lightColor;}\nfn computeProjectionTextureDiffuseLighting(projectionLightTexture: texture_2d,projectionLightSampler: sampler,textureProjectionMatrix: mat4x4f,posW: vec3f)->vec3f{var strq: vec4f=textureProjectionMatrix* vec4f(posW,1.0);strq/=strq.w;var textureColor: vec3f=textureSample(projectionLightTexture,projectionLightSampler,strq.xy).rgb;return toLinearSpaceVec3(textureColor);}\n#ifdef SS_TRANSLUCENCY\nfn computeDiffuseTransmittedLighting(info: preLightingInfo,lightColor: vec3f,transmittance: vec3f)->vec3f {var transmittanceNdotL=vec3f(0.0);var NdotL: f32=absEps(info.NdotLUnclamped);\n#ifndef SS_TRANSLUCENCY_LEGACY\nif (info.NdotLUnclamped<0.0) {\n#endif\nvar wrapNdotL: f32=computeWrappedDiffuseNdotL(NdotL,0.02);var trAdapt: f32=step(0.,info.NdotLUnclamped);transmittanceNdotL=mix(transmittance*wrapNdotL, vec3f(wrapNdotL),trAdapt);\n#ifndef SS_TRANSLUCENCY_LEGACY\n}\nvar diffuseTerm : vec3f=vec3f(1.0/PI);\n#if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_LEGACY\ndiffuseTerm=vec3f(diffuseBRDF_Burley(\ninfo.NdotL,info.NdotV,info.VdotH,info.roughness));\n#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY\ndiffuseTerm=vec3f(diffuseBRDF_Burley(\ninfo.NdotL,info.NdotV,info.VdotH,info.diffuseRoughness));\n#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON\nvar clampedAlbedo: vec3f=clamp(info.surfaceAlbedo,vec3f(0.1),vec3f(1.0));diffuseTerm=diffuseBRDF_EON(clampedAlbedo,info.diffuseRoughness,\ninfo.NdotL,info.NdotV,info.LdotV);diffuseTerm/=clampedAlbedo;\n#endif\nreturn (transmittanceNdotL*diffuseTerm)*info.attenuation*lightColor;\n#else\nlet diffuseTerm=diffuseBRDF_Burley(NdotL,info.NdotV,info.VdotH,info.roughness);return diffuseTerm*transmittanceNdotL*info.attenuation*lightColor;\n#endif\n}\n#endif\n#ifdef SPECULARTERM\nfn computeSpecularLighting(info: preLightingInfo,N: vec3f,reflectance0: vec3f,fresnel: vec3f,geometricRoughnessFactor: f32,lightColor: vec3f)->vec3f {var NdotH: f32=saturateEps(dot(N,info.H));var roughness: f32=max(info.roughness,geometricRoughnessFactor);var alphaG: f32=convertRoughnessToAverageSlope(roughness);var modifiedFresnel: vec3f=fresnel;\n#ifdef IRIDESCENCE\nmodifiedFresnel=mix(fresnel,reflectance0,info.iridescenceIntensity);\n#endif\nvar distribution: f32=normalDistributionFunction_TrowbridgeReitzGGX(NdotH,alphaG);\n#ifdef BRDF_V_HEIGHT_CORRELATED\nvar smithVisibility: f32=smithVisibility_GGXCorrelated(info.NdotL,info.NdotV,alphaG);\n#else\nvar smithVisibility: f32=smithVisibility_TrowbridgeReitzGGXFast(info.NdotL,info.NdotV,alphaG);\n#endif\nvar specTerm: vec3f=modifiedFresnel*distribution*smithVisibility;return specTerm*info.attenuation*info.NdotL*lightColor;}\n#if defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)\nfn computeAreaSpecularLighting(info: preLightingInfo,specularColor: vec3f,reflectance0: vec3f,reflectance90: vec3f)->vec3f {var fresnel:vec3f =reflectance0*specularColor*info.areaLightFresnel.x+( vec3f( 1.0 )-specularColor )*info.areaLightFresnel.y*reflectance90;return specularColor*fresnel*info.areaLightSpecular;}\n#endif\n#endif\n#ifdef FUZZ\nfn evalFuzz(L: vec3f,NdotL: f32,NdotV: f32,T: vec3f,B: vec3f,ltcLut: vec3f)->f32\n{if (NdotL<=0.0f || NdotV<=0.0f) {return 0.0f;}\nlet M=mat3x3f(\nvec3f(ltcLut.r,0.0f,0.0f),\nvec3f(ltcLut.g,1.0f,0.0f),\nvec3f(0.0f,0.0f,1.0f)\n);let Llocal: vec3f=vec3f(dot(L,T),dot(L,B),NdotL);let Lwarp: vec3f=normalize(M*Llocal);let cosThetaWarp: f32=max(Lwarp.z,0.0f);return cosThetaWarp*NdotL;}\n#endif\n#if defined(ANISOTROPIC) && defined(ANISOTROPIC_OPENPBR)\nfn computeAnisotropicSpecularLighting(info: preLightingInfo,V: vec3f,N: vec3f,T: vec3f,B: vec3f,anisotropy: f32,geometricRoughnessFactor: f32,lightColor: vec3f)->vec3f {var NdotH: f32=saturateEps(dot(N,info.H));var TdotH: f32=dot(T,info.H);var BdotH: f32=dot(B,info.H);var TdotV: f32=dot(T,V);var BdotV: f32=dot(B,V);var TdotL: f32=dot(T,info.L);var BdotL: f32=dot(B,info.L);var alphaG: f32=convertRoughnessToAverageSlope(info.roughness);var alphaTB: vec2f=getAnisotropicRoughness(alphaG,anisotropy);alphaTB=max(alphaTB,vec2f(geometricRoughnessFactor*geometricRoughnessFactor));var distribution: f32=normalDistributionFunction_BurleyGGX_Anisotropic(NdotH,TdotH,BdotH,alphaTB);var smithVisibility: f32=smithVisibility_GGXCorrelated_Anisotropic(info.NdotL,info.NdotV,TdotV,BdotV,TdotL,BdotL,alphaTB);var specTerm: vec3f=vec3f(distribution*smithVisibility);return specTerm*info.attenuation*info.NdotL*lightColor;}\n#elif defined(ANISOTROPIC)\nfn computeAnisotropicSpecularLighting(info: preLightingInfo,V: vec3f,N: vec3f,T: vec3f,B: vec3f,anisotropy: f32,reflectance0: vec3f,reflectance90: vec3f,geometricRoughnessFactor: f32,lightColor: vec3f)->vec3f {var NdotH: f32=saturateEps(dot(N,info.H));var TdotH: f32=dot(T,info.H);var BdotH: f32=dot(B,info.H);var TdotV: f32=dot(T,V);var BdotV: f32=dot(B,V);var TdotL: f32=dot(T,info.L);var BdotL: f32=dot(B,info.L);var alphaG: f32=convertRoughnessToAverageSlope(info.roughness);var alphaTB: vec2f=getAnisotropicRoughness(alphaG,anisotropy);alphaTB=max(alphaTB,vec2f(geometricRoughnessFactor*geometricRoughnessFactor));var fresnel: vec3f=fresnelSchlickGGXVec3(info.VdotH,reflectance0,reflectance90);\n#ifdef IRIDESCENCE\nfresnel=mix(fresnel,reflectance0,info.iridescenceIntensity);\n#endif\nvar distribution: f32=normalDistributionFunction_BurleyGGX_Anisotropic(NdotH,TdotH,BdotH,alphaTB);var smithVisibility: f32=smithVisibility_GGXCorrelated_Anisotropic(info.NdotL,info.NdotV,TdotV,BdotV,TdotL,BdotL,alphaTB);var specTerm: vec3f=fresnel*distribution*smithVisibility;return specTerm*info.attenuation*info.NdotL*lightColor;}\n#endif\n#ifdef CLEARCOAT\nfn computeClearCoatLighting(info: preLightingInfo,Ncc: vec3f,geometricRoughnessFactor: f32,clearCoatIntensity: f32,lightColor: vec3f)->vec4f {var NccdotL: f32=saturateEps(dot(Ncc,info.L));var NccdotH: f32=saturateEps(dot(Ncc,info.H));var clearCoatRoughness: f32=max(info.roughness,geometricRoughnessFactor);var alphaG: f32=convertRoughnessToAverageSlope(clearCoatRoughness);var fresnel: f32=fresnelSchlickGGX(info.VdotH,uniforms.vClearCoatRefractionParams.x,CLEARCOATREFLECTANCE90);fresnel*=clearCoatIntensity;var distribution: f32=normalDistributionFunction_TrowbridgeReitzGGX(NccdotH,alphaG);var kelemenVisibility: f32=visibility_Kelemen(info.VdotH);var clearCoatTerm: f32=fresnel*distribution*kelemenVisibility;return vec4f(\nclearCoatTerm*info.attenuation*NccdotL*lightColor,\n1.0-fresnel\n);}\nfn computeClearCoatLightingAbsorption(NdotVRefract: f32,L: vec3f,Ncc: vec3f,clearCoatColor: vec3f,clearCoatThickness: f32,clearCoatIntensity: f32)->vec3f {var LRefract: vec3f=-refract(L,Ncc,uniforms.vClearCoatRefractionParams.y);var NdotLRefract: f32=saturateEps(dot(Ncc,LRefract));var absorption: vec3f=computeClearCoatAbsorption(NdotVRefract,NdotLRefract,clearCoatColor,clearCoatThickness,clearCoatIntensity);return absorption;}\n#endif\n#ifdef SHEEN\nfn computeSheenLighting(info: preLightingInfo,N: vec3f,reflectance0: vec3f,reflectance90: vec3f,geometricRoughnessFactor: f32,lightColor: vec3f)->vec3f {var NdotH: f32=saturateEps(dot(N,info.H));var roughness: f32=max(info.roughness,geometricRoughnessFactor);var alphaG: f32=convertRoughnessToAverageSlope(roughness);var fresnel: f32=1.;var distribution: f32=normalDistributionFunction_CharlieSheen(NdotH,alphaG);/*#ifdef SHEEN_SOFTER\nvar visibility: f32=visibility_CharlieSheen(info.NdotL,info.NdotV,alphaG);\n#else */\nvar visibility: f32=visibility_Ashikhmin(info.NdotL,info.NdotV);/* #endif */\nvar sheenTerm: f32=fresnel*distribution*visibility;return sheenTerm*info.attenuation*info.NdotL*lightColor;}\n#endif\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\n#include\nfn computeClusteredLighting(\nlightDataTexture: texture_2d,\ntileMaskBuffer: ptr>,\nlightData: vec4f,\nsliceRange: vec2u,\nV: vec3f,\nN: vec3f,\nposW: vec3f,\nsurfaceAlbedo: vec3f,\nreflectivityOut: reflectivityOutParams,\n#ifdef IRIDESCENCE\niridescenceIntensity: f32,\n#endif\n#ifdef SS_TRANSLUCENCY\nsubSurfaceOut: subSurfaceOutParams,\n#endif\n#ifdef SPECULARTERM\nAARoughnessFactor: f32,\n#endif\n#ifdef ANISOTROPIC\nanisotropicOut: anisotropicOutParams,\n#endif\n#ifdef SHEEN\nsheenOut: sheenOutParams,\n#endif\n#ifdef CLEARCOAT\nclearcoatOut: clearcoatOutParams,\n#endif\n)->lightingInfo {let NdotV=absEps(dot(N,V));\n#include\n#ifdef CLEARCOAT\nspecularEnvironmentR0=clearcoatOut.specularEnvironmentR0;\n#endif\nvar result: lightingInfo;let tilePosition=vec2u(fragmentInputs.position.xy*lightData.xy);let maskResolution=vec2u(lightData.zw);var tileIndex=(tilePosition.x*maskResolution.x+tilePosition.y)*maskResolution.y;let batchRange=sliceRange/CLUSTLIGHT_BATCH;var batchOffset=batchRange.x*CLUSTLIGHT_BATCH;tileIndex+=batchRange.x;for (var i=batchRange.x; i<=batchRange.y; i+=1) {var mask=tileMaskBuffer[tileIndex];tileIndex+=1;let maskOffset=max(sliceRange.x,batchOffset)-batchOffset; \nlet maskWidth=min(sliceRange.y-batchOffset+1,CLUSTLIGHT_BATCH);mask=extractBits(mask,maskOffset,maskWidth);while mask != 0 {let trailing=firstTrailingBit(mask);mask ^= 1u<=0.0 {preInfo.attenuation*=computeDirectionalLightFalloff(light.vLightDirection.xyz,preInfo.L,light.vLightDirection.w,light.vLightData.w,light.vLightFalloff.z,light.vLightFalloff.w);}\npreInfo.roughness=adjustRoughnessFromLightProperties(reflectivityOut.roughness,light.vLightSpecular.a,preInfo.lightDistance);preInfo.diffuseRoughness=reflectivityOut.diffuseRoughness;preInfo.surfaceAlbedo=surfaceAlbedo;\n#ifdef IRIDESCENCE\npreInfo.iridescenceIntensity=iridescenceIntensity;\n#endif\nvar info: lightingInfo;\n#ifdef SS_TRANSLUCENCY\n#ifdef SS_TRANSLUCENCY_LEGACY\ninfo.diffuse=computeDiffuseTransmittedLighting(preInfo,light.vLightDiffuse.rgb,subSurfaceOut.transmittance);info.diffuseTransmission=vec3(0);\n#else\ninfo.diffuse=computeDiffuseLighting(preInfo,light.vLightDiffuse.rgb)*(1.0-subSurfaceOut.translucencyIntensity);info.diffuseTransmission=computeDiffuseTransmittedLighting(preInfo,light.vLightDiffuse.rgb,subSurfaceOut.transmittance);\n#endif\n#else\ninfo.diffuse=computeDiffuseLighting(preInfo,light.vLightDiffuse.rgb);\n#endif\n#ifdef SPECULARTERM\n#if CONDUCTOR_SPECULAR_MODEL==CONDUCTOR_SPECULAR_MODEL_OPENPBR\nlet metalFresnel=reflectivityOut.specularWeight*getF82Specular(preInfo.VdotH,specularEnvironmentR0,reflectivityOut.colorReflectanceF90,reflectivityOut.roughness);let dielectricFresnel=fresnelSchlickGGXVec3(preInfo.VdotH,reflectivityOut.dielectricColorF0,reflectivityOut.colorReflectanceF90);let coloredFresnel=mix(dielectricFresnel,metalFresnel,reflectivityOut.metallic);\n#else\nlet coloredFresnel=fresnelSchlickGGXVec3(preInfo.VdotH,specularEnvironmentR0,reflectivityOut.colorReflectanceF90);\n#endif\n#ifndef LEGACY_SPECULAR_ENERGY_CONSERVATION\nlet NdotH=dot(N,preInfo.H);let fresnel=fresnelSchlickGGXVec3(NdotH,vec3(reflectanceF0),specularEnvironmentR90);info.diffuse*=(vec3(1.0)-fresnel);\n#endif\n#ifdef ANISOTROPIC\ninfo.specular=computeAnisotropicSpecularLighting(preInfo,V,N,anisotropicOut.anisotropicTangent,anisotropicOut.anisotropicBitangent,anisotropicOut.anisotropy,clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,AARoughnessFactor,light.vLightDiffuse.rgb);\n#else\ninfo.specular=computeSpecularLighting(preInfo,N,specularEnvironmentR0,coloredFresnel,AARoughnessFactor,light.vLightDiffuse.rgb);\n#endif\n#endif\n#ifdef SHEEN\n#ifdef SHEEN_LINKWITHALBEDO\npreInfo.roughness=sheenOut.sheenIntensity;\n#else\npreInfo.roughness=adjustRoughnessFromLightProperties(sheenOut.sheenRoughness,light.vLightSpecular.a,preInfo.lightDistance);\n#endif\ninfo.sheen=computeSheenLighting(preInfo,normalW,sheenOut.sheenColor,specularEnvironmentR90,AARoughnessFactor,light.vLightDiffuse.rgb);\n#endif\n#ifdef CLEARCOAT\npreInfo.roughness=adjustRoughnessFromLightProperties(clearcoatOut.clearCoatRoughness,light.vLightSpecular.a,preInfo.lightDistance);info.clearCoat=computeClearCoatLighting(preInfo,clearcoatOut.clearCoatNormalW,clearcoatOut.clearCoatAARoughnessFactors.x,clearcoatOut.clearCoatIntensity,light.vLightDiffuse.rgb);\n#ifdef CLEARCOAT_TINT\nlet absorption=computeClearCoatLightingAbsorption(clearcoatOut.clearCoatNdotVRefract,preInfo.L,clearcoatOut.clearCoatNormalW,clearcoatOut.clearCoatColor,clearcoatOut.clearCoatThickness,clearcoatOut.clearCoatIntensity);info.diffuse*=absorption;\n#ifdef SS_TRANSLUCENCY\ninfo.diffuseTransmission*=absorption;\n#endif\n#ifdef SPECULARTERM\ninfo.specular*=absorption;\n#endif\n#endif\ninfo.diffuse*=info.clearCoat.w;\n#ifdef SS_TRANSLUCENCY\ninfo.diffuseTransmission*=info.clearCoat.w;\n#endif\n#ifdef SPECULARTERM\ninfo.specular*=info.clearCoat.w;\n#endif\n#ifdef SHEEN\ninfo.sheen*=info.clearCoat.w;\n#endif\n#endif\nresult.diffuse+=info.diffuse;\n#ifdef SS_TRANSLUCENCY\nresult.diffuseTransmission+=info.diffuseTransmission;\n#endif\n#ifdef SPECULARTERM\nresult.specular+=info.specular;\n#endif\n#ifdef CLEARCOAT\nresult.clearCoat+=info.clearCoat;\n#endif\n#ifdef SHEEN\nresult.sheen+=info.sheen;\n#endif\n}\nbatchOffset+=CLUSTLIGHT_BATCH;}\nreturn result;}\n#endif\n")},65465:(e,t,n)=>{n.r(t),n.d(t,{shadowMapPixelShaderWGSL:()=>l});var r=n(98519),i=(n(68298),"bayerDitherFunctions");r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="fn bayerDither2(_P: vec2f)->f32 {return ((2.0*_P.y+_P.x+1.0)%(4.0));}\nfn bayerDither4(_P: vec2f)->f32 {var P1: vec2f=((_P)%(2.0)); \nvar P2: vec2f=floor(0.5*((_P)%(4.0))); \nreturn 4.0*bayerDither2(P1)+bayerDither2(P2);}\nfn bayerDither8(_P: vec2f)->f32 {var P1: vec2f=((_P)%(2.0)); \nvar P2: vec2f=floor(0.5 *((_P)%(4.0))); \nvar P4: vec2f=floor(0.25*((_P)%(8.0))); \nreturn 4.0*(4.0*bayerDither2(P1)+bayerDither2(P2))+bayerDither2(P4);}\n");var o="shadowMapFragmentExtraDeclaration";r.l.IncludesShadersStoreWGSL[o]||(r.l.IncludesShadersStoreWGSL[o]="#if SM_FLOAT==0\n#include\n#endif\n#if SM_SOFTTRANSPARENTSHADOW==1\n#include\nuniform softTransparentShadowSM: vec2f;\n#endif\nvarying vDepthMetricSM: f32;\n#if SM_USEDISTANCE==1\nuniform lightDataSM: vec3f;varying vPositionWSM: vec3f;\n#endif\nuniform biasAndScaleSM: vec3f;uniform depthValuesSM: vec2f;\n#if defined(SM_DEPTHCLAMP) && SM_DEPTHCLAMP==1\nvarying zSM: f32;\n#endif\n"),n(20502),n(30032),n(79574);var a="shadowMapPixelShader",s="#include\n#ifdef ALPHATEXTURE\nvarying vUV: vec2f;var diffuseSamplerSampler: sampler;var diffuseSampler: texture_2d;\n#endif\n#include\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#include\n#ifdef ALPHATEXTURE\nvar opacityMap: vec4f=textureSample(diffuseSampler,diffuseSamplerSampler,fragmentInputs.vUV);var alphaFromAlphaTexture: f32=opacityMap.a;\n#if SM_SOFTTRANSPARENTSHADOW==1\nif (uniforms.softTransparentShadowSM.y==1.0) {opacityMap=vec4f(opacityMap.rgb* vec3f(0.3,0.59,0.11),opacityMap.a);alphaFromAlphaTexture=opacityMap.x+opacityMap.y+opacityMap.z;}\n#endif\n#ifdef ALPHATESTVALUE\nif (alphaFromAlphaTexture=uniforms.softTransparentShadowSM.x*alphaFromAlphaTexture) {discard;}\n#else\nif ((bayerDither8(floor(((fragmentInputs.position.xy)%(8.0)))))/64.0>=uniforms.softTransparentShadowSM.x) {discard;} \n#endif\n#endif\n#include\n}";r.l.ShadersStoreWGSL[a]||(r.l.ShadersStoreWGSL[a]=s);var l={name:a,shader:s}},65572:(e,t,n)=>{n.d(t,{C:()=>i});var r=1,i=function(e){this.name="StaticSoundBuffer #".concat(r++),this.engine=e}},65969:(e,t,n)=>{var r=n(98519),i="decalFragment";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="#ifdef DECAL\nvar decalTempColor=decalColor.rgb;var decalTempAlpha=decalColor.a;\n#ifdef GAMMADECAL\ndecalTempColor=toLinearSpaceVec3(decalColor.rgb);\n#endif\n#ifdef DECAL_SMOOTHALPHA\ndecalTempAlpha=decalColor.a*decalColor.a;\n#endif\nsurfaceAlbedo=mix(surfaceAlbedo.rgb,decalTempColor,decalTempAlpha);\n#endif\n")},66138:(e,t,n)=>{var r=n(98519),i=(n(36644),"backgroundUboDeclaration");r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="uniform vPrimaryColor: vec4f;uniform vPrimaryColorShadow: vec4f;uniform vDiffuseInfos : vec2f;uniform diffuseMatrix : mat4x4f;uniform fFovMultiplier: f32;uniform pointSize: f32;uniform shadowLevel: f32;uniform alpha: f32;uniform vBackgroundCenter: vec3f;uniform vReflectionControl: vec4f;uniform projectedGroundInfos: vec2f;uniform vReflectionInfos : vec2f;uniform reflectionMatrix : mat4x4f;uniform vReflectionMicrosurfaceInfos : vec3f;\n#include\n")},66348:(e,t,n)=>{n.r(t),n.d(t,{greasedLineVertexShaderWGSL:()=>a});var r=n(98519),i=(n(63866),n(36644),n(40647),n(21310),"greasedLineVertexShader"),o="#include\n#include\n#include\nattribute grl_widths: f32;\n#ifdef GREASED_LINE_USE_OFFSETS\nattribute grl_offsets: vec3f; \n#endif\nattribute grl_colorPointers: f32;attribute position: vec3f;varying grlCounters: f32;varying grlColorPointer: f32;\n#ifdef GREASED_LINE_CAMERA_FACING\nattribute grl_nextAndCounters: vec4f;attribute grl_previousAndSide: vec4f;uniform grlResolution: vec2f;uniform grlAspect: f32;uniform grlWidth: f32;uniform grlSizeAttenuation: f32;fn grlFix(i: vec4f,aspect: f32)->vec2f {var res=i.xy/i.w;res.x*=aspect;return res;}\n#else\nattribute grl_slopes: vec3f;attribute grl_counters: f32;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include\nvertexOutputs.grlColorPointer=input.grl_colorPointers;let grlMatrix: mat4x4f=scene.viewProjection*mesh.world ;\n#ifdef GREASED_LINE_CAMERA_FACING\nlet grlBaseWidth: f32=uniforms.grlWidth;let grlPrevious: vec3f=input.grl_previousAndSide.xyz;let grlSide: f32=input.grl_previousAndSide.w;let grlNext: vec3f=input.grl_nextAndCounters.xyz;vertexOutputs.grlCounters=input.grl_nextAndCounters.w;let grlWidth:f32=grlBaseWidth*input.grl_widths;\n#ifdef GREASED_LINE_USE_OFFSETS\nvar grlPositionOffset: vec3f=input.grl_offsets;\n#else\nvar grlPositionOffset=vec3f(0.);\n#endif\nlet positionUpdated: vec3f=vertexInputs.position+grlPositionOffset;let worldDir: vec3f=normalize(grlNext-grlPrevious);let nearPosition: vec3f=positionUpdated+(worldDir*0.001);let grlFinalPosition: vec4f=grlMatrix*vec4f(positionUpdated,1.0);let screenNearPos: vec4f=grlMatrix*vec4(nearPosition,1.0);let grlLinePosition: vec2f=grlFix(grlFinalPosition,uniforms.grlAspect);let grlLineNearPosition: vec2f=grlFix(screenNearPos,uniforms.grlAspect);let grlDir: vec2f=normalize(grlLineNearPosition-grlLinePosition);var grlNormal: vec4f=vec4f(-grlDir.y,grlDir.x,0.0,1.0);let grlHalfWidth: f32=0.5*grlWidth;\n#if defined(GREASED_LINE_RIGHT_HANDED_COORDINATE_SYSTEM)\ngrlNormal.x*=-grlHalfWidth;grlNormal.y*=-grlHalfWidth;\n#else\ngrlNormal.x*=grlHalfWidth;grlNormal.y*=grlHalfWidth;\n#endif\ngrlNormal*=scene.projection;if (uniforms.grlSizeAttenuation==1.) {grlNormal.x*=grlFinalPosition.w;grlNormal.y*=grlFinalPosition.w;let pr=vec4f(uniforms.grlResolution,0.0,1.0)*scene.projection;grlNormal.x/=pr.x;grlNormal.y/=pr.y;}\nvertexOutputs.position=vec4f(grlFinalPosition.xy+grlNormal.xy*grlSide,grlFinalPosition.z,grlFinalPosition.w);\n#else\nvertexOutputs.grlCounters=input.grl_counters;vertexOutputs.position=grlMatrix*vec4f((vertexInputs.position+input.grl_offsets)+input.grl_slopes*input.grl_widths,1.0) ;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},66377:(e,t,n)=>{n.d(t,{cP:()=>a,nu:()=>o,qO:()=>i});var r="undefined"!=typeof WeakRef,i=function(){function e(e,t,n,r){void 0===t&&(t=!1),this.initialize(e,t,n,r)}return e.prototype.initialize=function(e,t,n,r){return void 0===t&&(t=!1),this.mask=e,this.skipNextObservers=t,this.target=n,this.currentTarget=r,this},e}(),o=function(){function e(e,t,n){void 0===n&&(n=null),this.callback=e,this.mask=t,this.scope=n,this._willBeUnregistered=!1,this.unregisterOnNextCall=!1,this._remove=null}return e.prototype.remove=function(e){void 0===e&&(e=!1),this._remove&&this._remove(e)},e}(),a=function(){function e(e,t){void 0===t&&(t=!1),this.notifyIfTriggered=t,this._observers=new Array,this._numObserversMarkedAsDeleted=0,this._hasNotified=!1,this._eventState=new i(0),e&&(this._onObserverAdded=e)}return e.FromPromise=function(t,n){var r=new e;return t.then((function(e){r.notifyObservers(e)})).catch((function(e){if(!n)throw e;n.notifyObservers(e)})),r},Object.defineProperty(e.prototype,"observers",{get:function(){return this._observers},enumerable:!1,configurable:!0}),e.prototype.add=function(e,t,n,i,a){var s=this;if(void 0===t&&(t=-1),void 0===n&&(n=!1),void 0===i&&(i=null),void 0===a&&(a=!1),!e)return null;var l=new o(e,t,i);l.unregisterOnNextCall=a,n?this._observers.unshift(l):this._observers.push(l),this._onObserverAdded&&this._onObserverAdded(l),this._hasNotified&&this.notifyIfTriggered&&void 0!==this._lastNotifiedValue&&this.notifyObserver(l,this._lastNotifiedValue);var c=r?new WeakRef(this):{deref:function(){return s}};return l._remove=function(e){void 0===e&&(e=!1);var t=c.deref();t&&(e?t.remove(l):t._remove(l))},l},e.prototype.addOnce=function(e){return this.add(e,void 0,void 0,void 0,!0)},e.prototype.remove=function(e){return!!e&&(e._remove=null,-1!==this._observers.indexOf(e)&&(this._deferUnregister(e),!0))},e.prototype.removeCallback=function(e,t){for(var n=0;n0},e.prototype.clear=function(){for(;this._observers.length;){var e=this._observers.pop();e&&(e._remove=null)}this._onObserverAdded=null,this._numObserversMarkedAsDeleted=0,this.cleanLastNotifiedState()},e.prototype.cleanLastNotifiedState=function(){this._hasNotified=!1,this._lastNotifiedValue=void 0},e.prototype.clone=function(){var t=new e;return t._observers=this._observers.slice(0),t},e.prototype.hasSpecificMask=function(e){void 0===e&&(e=-1);for(var t=0,n=this._observers;t{n.d(t,{q:()=>i});var r=n(66377),i=function(){function e(){}return Object.defineProperty(e,"LastCreatedEngine",{get:function(){return 0===this.Instances.length?null:this.Instances[this.Instances.length-1]},enumerable:!1,configurable:!0}),Object.defineProperty(e,"LastCreatedScene",{get:function(){return this._LastCreatedScene},enumerable:!1,configurable:!0}),e.Instances=[],e.OnEnginesDisposedObservable=new r.cP,e._LastCreatedScene=null,e.UseFallbackTexture=!0,e.FallbackTexture="",e}()},66633:(e,t,n)=>{n.r(t),n.d(t,{bumpFragmentFunctionsWGSL:()=>a});var r=n(98519),i=(n(338),"bumpFragmentFunctions"),o="#if defined(BUMP)\n#include(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump,_SAMPLERNAME_,bump)\n#endif\n#if defined(DETAIL)\n#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail,_SAMPLERNAME_,detail)\n#endif\n#if defined(BUMP) && defined(PARALLAX)\nconst minSamples: f32=4.;const maxSamples: f32=15.;const iMaxSamples: i32=15;fn parallaxOcclusion(vViewDirCoT: vec3f,vNormalCoT: vec3f,texCoord: vec2f,parallaxScale: f32)->vec2f {var parallaxLimit: f32=length(vViewDirCoT.xy)/vViewDirCoT.z;parallaxLimit*=parallaxScale;var vOffsetDir: vec2f=normalize(vViewDirCoT.xy);var vMaxOffset: vec2f=vOffsetDir*parallaxLimit;var numSamples: f32=maxSamples+(dot(vViewDirCoT,vNormalCoT)*(minSamples-maxSamples));var stepSize: f32=1.0/numSamples;var currRayHeight: f32=1.0;var vCurrOffset: vec2f= vec2f(0,0);var vLastOffset: vec2f= vec2f(0,0);var lastSampledHeight: f32=1.0;var currSampledHeight: f32=1.0;var keepWorking: bool=true;for (var i: i32=0; icurrRayHeight)\n{var delta1: f32=currSampledHeight-currRayHeight;var delta2: f32=(currRayHeight+stepSize)-lastSampledHeight;var ratio: f32=delta1/(delta1+delta2);vCurrOffset=(ratio)* vLastOffset+(1.0-ratio)*vCurrOffset;keepWorking=false;}\nelse\n{currRayHeight-=stepSize;vLastOffset=vCurrOffset;\n#ifdef PARALLAX_RHS\nvCurrOffset-=stepSize*vMaxOffset;\n#else\nvCurrOffset+=stepSize*vMaxOffset;\n#endif\nlastSampledHeight=currSampledHeight;}}\nreturn vCurrOffset;}\nfn parallaxOffset(viewDir: vec3f,heightScale: f32)->vec2f\n{var height: f32=textureSample(bumpSampler,bumpSamplerSampler,fragmentInputs.vBumpUV).w;var texCoordOffset: vec2f=heightScale*viewDir.xy*height;\n#ifdef PARALLAX_RHS\nreturn texCoordOffset;\n#else\nreturn -texCoordOffset;\n#endif\n}\n#endif\n";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]=o);var a={name:i,shader:o}},66904:(e,t,n)=>{n.r(t),n.d(t,{defaultVertexShaderWGSL:()=>s});var r=n(98519),i=(n(76941),n(56213),n(17393),n(45699),n(27279),n(63866),n(84020),n(14188),n(12520),n(33330),n(9436),n(79716),"lightVxFragmentDeclaration");r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="#ifdef LIGHT{X}\nuniform vLightData{X}: vec4f;uniform vLightDiffuse{X}: vec4f;\n#ifdef SPECULARTERM\nuniform vLightSpecular{X}: vec4f;\n#else\nvar vLightSpecular{X}: vec4f= vec4f(0.);\n#endif\n#ifdef SHADOW{X}\n#ifdef SHADOWCSM{X}\nuniform lightMatrix{X}: mat4x4f[SHADOWCSMNUM_CASCADES{X}];varying var vPositionFromLight{X}: vec4f[SHADOWCSMNUM_CASCADES{X}];varying var vDepthMetric{X}: f32[SHADOWCSMNUM_CASCADES{X}];varying var vPositionFromCamera{X}: vec4f;\n#elif defined(SHADOWCUBE{X})\n#else\nvarying var vPositionFromLight{X}: vec4f;varying var vDepthMetric{X}: f32;uniform lightMatrix{X}: mat4x4f;\n#endif\nuniform shadowsInfo{X}: vec4f;uniform depthValues{X}: vec2f;\n#endif\n#ifdef SPOTLIGHT{X}\nuniform vLightDirection{X}: vec4f;uniform vLightFalloff{X}: vec4f;\n#elif defined(POINTLIGHT{X})\nuniform vLightFalloff{X}: vec4f;\n#elif defined(HEMILIGHT{X})\nuniform vLightGround{X}: vec3f;\n#endif\n#if defined(AREALIGHT{X})\nuniform vLightWidth{X}: vec4f;uniform vLightHeight{X}: vec4f;\n#endif\n#endif\n"),n(58902),n(73683),n(68478),n(38197),n(98819),n(77320),n(21310),n(3641),n(86615),n(21954),n(28981),n(88380),n(19748),n(63002),n(70898),n(59115),n(50615),n(55607);var o="defaultVertexShader",a="#include\n#define CUSTOM_VERTEX_BEGIN\nattribute position: vec3f;\n#ifdef NORMAL\nattribute normal: vec3f;\n#endif\n#ifdef TANGENT\nattribute tangent: vec4f;\n#endif\n#ifdef UV1\nattribute uv: vec2f;\n#endif\n#include[2..7]\n#ifdef VERTEXCOLOR\nattribute color: vec4f;\n#endif\n#include\n#include\n#include\n#include\n#include\n#include[1..7]\n#include(_DEFINENAME_,DIFFUSE,_VARYINGNAME_,Diffuse)\n#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail)\n#include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient)\n#include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity)\n#include(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive)\n#include(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap)\n#if defined(SPECULARTERM)\n#include(_DEFINENAME_,SPECULAR,_VARYINGNAME_,Specular)\n#endif\n#include(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump)\n#include(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal)\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vColor: vec4f;\n#endif\n#include\n#include\n#include\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\n#include\n#include[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vPositionUVW: vec3f;\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vDirectionW: vec3f;\n#endif\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#include\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvar positionUpdated: vec3f=vertexInputs.position;\n#ifdef NORMAL\nvar normalUpdated: vec3f=vertexInputs.normal;\n#endif\n#ifdef TANGENT\nvar tangentUpdated: vec4f=vertexInputs.tangent;\n#endif\n#ifdef UV1\nvar uvUpdated: vec2f=vertexInputs.uv;\n#endif\n#ifdef UV2\nvar uv2Updated: vec2f=vertexInputs.uv2;\n#endif\n#ifdef VERTEXCOLOR\nvar colorUpdated: vec4f=vertexInputs.color;\n#endif\n#include\n#include[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\nvertexOutputs.vPositionUVW=positionUpdated;\n#endif\n#define CUSTOM_VERTEX_UPDATE_POSITION\n#define CUSTOM_VERTEX_UPDATE_NORMAL\n#include\n#if defined(PREPASS) && ((defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR)) && !defined(BONES_VELOCITY_ENABLED)\nvertexOutputs.vCurrentPosition=scene.viewProjection*finalWorld*vec4f(positionUpdated,1.0);vertexOutputs.vPreviousPosition=uniforms.previousViewProjection*finalPreviousWorld*vec4f(positionUpdated,1.0);\n#endif\n#include\n#include\nvar worldPos: vec4f=finalWorld*vec4f(positionUpdated,1.0);\n#ifdef NORMAL\nvar normalWorld: mat3x3f= mat3x3f(finalWorld[0].xyz,finalWorld[1].xyz,finalWorld[2].xyz);\n#if defined(INSTANCES) && defined(THIN_INSTANCES)\nvertexOutputs.vNormalW=normalUpdated/ vec3f(dot(normalWorld[0],normalWorld[0]),dot(normalWorld[1],normalWorld[1]),dot(normalWorld[2],normalWorld[2]));vertexOutputs.vNormalW=normalize(normalWorld*vertexOutputs.vNormalW);\n#else\n#ifdef NONUNIFORMSCALING\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\n#endif\nvertexOutputs.vNormalW=normalize(normalWorld*normalUpdated);\n#endif\n#endif\n#define CUSTOM_VERTEX_UPDATE_WORLDPOS\n#ifdef MULTIVIEW\nif (gl_ViewID_OVR==0u) {vertexOutputs.position=scene.viewProjection*worldPos;} else {vertexOutputs.position=scene.viewProjectionR*worldPos;}\n#else\nvertexOutputs.position=scene.viewProjection*worldPos;\n#endif\nvertexOutputs.vPositionW= worldPos.xyz;\n#ifdef PREPASS\n#include\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvertexOutputs.vDirectionW=normalize((finalWorld* vec4f(positionUpdated,0.0)).xyz);\n#endif\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvertexOutputs.vViewDepth=(scene.view*worldPos).z;\n#endif\n#ifndef UV1\nvar uvUpdated: vec2f=vec2f(0.,0.);\n#endif\n#ifdef MAINUV1\nvertexOutputs.vMainUV1=uvUpdated;\n#endif\n#ifndef UV2\nvar uv2Updated: vec2f=vec2f(0.,0.);\n#endif\n#ifdef MAINUV2\nvertexOutputs.vMainUV2=uv2Updated;\n#endif\n#include[3..7]\n#include(_DEFINENAME_,DIFFUSE,_VARYINGNAME_,Diffuse,_MATRIXNAME_,diffuse,_INFONAME_,DiffuseInfos.x)\n#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail,_MATRIXNAME_,detail,_INFONAME_,DetailInfos.x)\n#include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_MATRIXNAME_,ambient,_INFONAME_,AmbientInfos.x)\n#include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_MATRIXNAME_,opacity,_INFONAME_,OpacityInfos.x)\n#include(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_MATRIXNAME_,emissive,_INFONAME_,EmissiveInfos.x)\n#include(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_MATRIXNAME_,lightmap,_INFONAME_,LightmapInfos.x)\n#if defined(SPECULARTERM)\n#include(_DEFINENAME_,SPECULAR,_VARYINGNAME_,Specular,_MATRIXNAME_,specular,_INFONAME_,SpecularInfos.x)\n#endif\n#include(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump,_MATRIXNAME_,bump,_INFONAME_,BumpInfos.x)\n#include(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_MATRIXNAME_,decal,_INFONAME_,DecalInfos.x)\n#include\n#include\n#include\n#include[0..maxSimultaneousLights]\n#include\n#include\n#define CUSTOM_VERTEX_MAIN_END\n}\n";r.l.ShadersStoreWGSL[o]||(r.l.ShadersStoreWGSL[o]=a);var s={name:o,shader:a}},67064:(e,t,n)=>{n.r(t),n.d(t,{glowMapMergeVertexShaderWGSL:()=>a});var r=n(98519),i="glowMapMergeVertexShader",o="attribute position: vec2f;varying vUV: vec2f;\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {const madd: vec2f= vec2f(0.5,0.5);\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvertexOutputs.vUV=input.position*madd+madd;vertexOutputs.position= vec4f(input.position,0.0,1.0);\n#define CUSTOM_VERTEX_MAIN_END\n}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},67158:(e,t,n)=>{n.d(t,{G:()=>o});var r=n(78322),i=n(66377),o=function(e){function t(t,n){var r=e.call(this,t,n,3)||this;return r._newestInstance=null,r._privateInstances=new Set,r._state=1,r._instances=r._privateInstances,r.onEndedObservable=new i.cP,r._onInstanceEnded=function(e){r._newestInstance===e&&(r._newestInstance=null),r._privateInstances.delete(e),0===r._instances.size&&(r._state=1,r.onEndedObservable.notifyObservers(r))},r}return(0,r.C6)(t,e),Object.defineProperty(t.prototype,"autoplay",{get:function(){return this._options.autoplay},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"currentTime",{get:function(){var e=this._getNewestInstance();return e?e.currentTime:0},set:function(e){this.startOffset=e;var t=this._getNewestInstance();t&&(t.currentTime=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loop",{get:function(){return this._options.loop},set:function(e){this._options.loop=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxInstances",{get:function(){return this._options.maxInstances},set:function(e){this._options.maxInstances=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startOffset",{get:function(){return this._options.startOffset},set:function(e){this._options.startOffset=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){e.prototype.dispose.call(this),this.stop(),this._newestInstance=null,this._privateInstances.clear(),this.onEndedObservable.clear()},t.prototype.pause=function(){for(var e=this._instances.values(),t=e.next();!t.done;t=e.next())t.value.pause();this._state=5},t.prototype.resume=function(){if(5===this._state){for(var e=this._instances.values(),t=e.next();!t.done;t=e.next())t.value.resume();this._state=3}},t.prototype._beforePlay=function(e){5===this.state&&this._instances.size>0?this.resume():(e.onEndedObservable.addOnce(this._onInstanceEnded),this._privateInstances.add(e),this._newestInstance=e)},t.prototype._afterPlay=function(e){this._state=e.state},t.prototype._getNewestInstance=function(){if(0===this._instances.size)return null;if(!this._newestInstance)for(var e=this._instances.values(),t=e.next();!t.done;t=e.next())this._newestInstance=t.value;return this._newestInstance},t.prototype._setState=function(e){this._state=e},t.prototype._stopExcessInstances=function(){if(this.maxInstances<1/0)for(var e=Array.from(this._instances).filter((function(e){return 3===e.state})).length-this.maxInstances,t=this._instances.values(),n=0;n{n.r(t),n.d(t,{vrDistortionCorrectionPixelShader:()=>a});var r=n(98519),i="vrDistortionCorrectionPixelShader",o="varying vec2 vUV;uniform sampler2D textureSampler;uniform vec2 LensCenter;uniform vec2 Scale;uniform vec2 ScaleIn;uniform vec4 HmdWarpParam;vec2 HmdWarp(vec2 in01) {vec2 theta=(in01-LensCenter)*ScaleIn; \nfloat rSq=theta.x*theta.x+theta.y*theta.y;vec2 rvector=theta*(HmdWarpParam.x+HmdWarpParam.y*rSq+HmdWarpParam.z*rSq*rSq+HmdWarpParam.w*rSq*rSq*rSq);return LensCenter+Scale*rvector;}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{vec2 tc=HmdWarp(vUV);if (tc.x <0.0 || tc.x>1.0 || tc.y<0.0 || tc.y>1.0)\ngl_FragColor=vec4(0.0,0.0,0.0,0.0);else{gl_FragColor=texture2D(textureSampler,tc);}}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},67303:(e,t,n)=>{var r=n(98519),i="kernelBlurVaryingDeclaration";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="varying vec2 sampleCoord{X};")},67367:(e,t,n)=>{n.d(t,{N:()=>_});var r=n(78322),i=n(19133),o=n(66614),a=n(44256),s=n(81152),l=n(62400),c=n(26218),u=n(7164),h=n(90519),d=(n(97286),n(55557),n(82345),n(23469),n(71974),n(71073),n(64838),n(8864),n(23778),n(59012),n(54198),n(69806),n(69565),n(17198),n(14605),n(20833),n(82673)),p=n(608),f=n(70511),m=n(53695),_=function(e){function t(t,n,r,i){void 0===i&&(i=!1);var o=e.call(this,t,n,r,i)||this;return o.customAnimationFrameRequester=null,o._performanceMonitor=new l.r,o._drawCalls=new f.A,t?(o._features.supportRenderPasses=!0,r=o._creationOptions,o):o}return(0,r.C6)(t,e),Object.defineProperty(t,"NpmPackage",{get:function(){return d.$.NpmPackage},enumerable:!1,configurable:!0}),Object.defineProperty(t,"Version",{get:function(){return d.$.Version},enumerable:!1,configurable:!0}),Object.defineProperty(t,"Instances",{get:function(){return o.q.Instances},enumerable:!1,configurable:!0}),Object.defineProperty(t,"LastCreatedEngine",{get:function(){return o.q.LastCreatedEngine},enumerable:!1,configurable:!0}),Object.defineProperty(t,"LastCreatedScene",{get:function(){return o.q.LastCreatedScene},enumerable:!1,configurable:!0}),t.DefaultLoadingScreenFactory=function(e){return d.$.DefaultLoadingScreenFactory(e)},Object.defineProperty(t.prototype,"_supportsHardwareTextureRescaling",{get:function(){return!!t._RescalePostProcessFactory},enumerable:!1,configurable:!0}),t.prototype._measureFps=function(){this._performanceMonitor.sampleFrame(),this._fps=this._performanceMonitor.averageFPS,this._deltaTime=this._performanceMonitor.instantaneousFrameTime||0},Object.defineProperty(t.prototype,"performanceMonitor",{get:function(){return this._performanceMonitor},enumerable:!1,configurable:!0}),t.prototype._initGLContext=function(){e.prototype._initGLContext.call(this),this._rescalePostProcess=null},t.prototype._sharedInit=function(t){e.prototype._sharedInit.call(this,t),(0,p.BG)(this,t,this._creationOptions)},t.prototype.resizeImageBitmap=function(e,t,n){return(0,p.jf)(this,e,t,n)},t.prototype._createImageBitmapFromSource=function(e,t){return(0,r.sH)(this,void 0,void 0,(function(){return(0,r.YH)(this,(function(n){switch(n.label){case 0:return[4,(0,p.kF)(this,e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.switchFullscreen=function(e){this.isFullscreen?this.exitFullscreen():this.enterFullscreen(e)},t.prototype.enterFullscreen=function(e){this.isFullscreen||(this._pointerLockRequested=e,this._renderingCanvas&&(0,p.tl)(this._renderingCanvas))},t.prototype.exitFullscreen=function(){this.isFullscreen&&(0,p.g7)()},t.prototype.setDitheringState=function(e){e?this._gl.enable(this._gl.DITHER):this._gl.disable(this._gl.DITHER)},t.prototype.setRasterizerState=function(e){e?this._gl.disable(this._gl.RASTERIZER_DISCARD):this._gl.enable(this._gl.RASTERIZER_DISCARD)},t.prototype.setDirectViewport=function(e,t,n,r){var i=this._cachedViewport;return this._cachedViewport=null,this._viewport(e,t,n,r),i},t.prototype.scissorClear=function(e,t,n,r,i){this.enableScissor(e,t,n,r),this.clear(i,!0,!0,!0),this.disableScissor()},t.prototype.enableScissor=function(e,t,n,r){var i=this._gl;i.enable(i.SCISSOR_TEST),i.scissor(e,t,n,r)},t.prototype.disableScissor=function(){var e=this._gl;e.disable(e.SCISSOR_TEST)},t.prototype._loadFileAsync=function(e,t,n){return(0,r.sH)(this,void 0,void 0,(function(){var i=this;return(0,r.YH)(this,(function(r){switch(r.label){case 0:return[4,new Promise((function(r,o){i._loadFile(e,(function(e){r(e)}),void 0,t,n,(function(e,t){o(t)}))}))];case 1:return[2,r.sent()]}}))}))},t.prototype.getVertexShaderSource=function(e){var t=this._gl.getAttachedShaders(e);return t?this._gl.getShaderSource(t[0]):null},t.prototype.getFragmentShaderSource=function(e){var t=this._gl.getAttachedShaders(e);return t?this._gl.getShaderSource(t[1]):null},Object.defineProperty(t.prototype,"framebufferDimensionsObject",{set:function(e){this._framebufferDimensionsObject=e,this._framebufferDimensionsObject&&this.onResizeObservable.notifyObservers(this)},enumerable:!1,configurable:!0}),t.prototype._rebuildBuffers=function(){for(var t=0,n=this.scenes;t0&&0===this._frameHandler&&(this.customAnimationFrameRequester?(this.customAnimationFrameRequester.requestID=this._queueNewFrame(this.customAnimationFrameRequester.renderFunction||this._boundRenderFunction,this.customAnimationFrameRequester),this._frameHandler=this.customAnimationFrameRequester.requestID):this._frameHandler=this._queueNewFrame(this._boundRenderFunction,this.getHostWindow()))},t.prototype.enterPointerlock=function(){this._renderingCanvas&&(0,p.eG)(this._renderingCanvas)},t.prototype.exitPointerlock=function(){(0,p.rT)()},t.prototype.beginFrame=function(){this._measureFps(),e.prototype.beginFrame.call(this)},t.prototype._deletePipelineContext=function(t){var n=t;n&&n.program&&n.transformFeedback&&(this.deleteTransformFeedback(n.transformFeedback),n.transformFeedback=null),e.prototype._deletePipelineContext.call(this,t)},t.prototype.createShaderProgram=function(t,n,r,i,o,a){void 0===a&&(a=null),o=o||this._gl,this.onBeforeShaderCompilationObservable.notifyObservers(this);var s=e.prototype.createShaderProgram.call(this,t,n,r,i,o,a);return this.onAfterShaderCompilationObservable.notifyObservers(this),s},t.prototype._createShaderProgram=function(e,t,n,r,i){void 0===i&&(i=null);var o=r.createProgram();if(e.program=o,!o)throw new Error("Unable to create program");if(r.attachShader(o,t),r.attachShader(o,n),this.webGLVersion>1&&i){var a=this.createTransformFeedback();this.bindTransformFeedback(a),this.setTranformFeedbackVaryings(o,i),e.transformFeedback=a}return r.linkProgram(o),this.webGLVersion>1&&i&&this.bindTransformFeedback(null),e.context=r,e.vertexShader=t,e.fragmentShader=n,e.isParallelCompiled||this._finalizePipelineContext(e),o},t.prototype._releaseTexture=function(t){e.prototype._releaseTexture.call(this,t)},t.prototype._releaseRenderTargetWrapper=function(t){e.prototype._releaseRenderTargetWrapper.call(this,t);for(var n=0,r=this.scenes;n{n.r(t),n.d(t,{morphTargetsVertexDeclaration:()=>a});var r=n(98519),i="morphTargetsVertexDeclaration",o="#ifdef MORPHTARGETS\n#ifndef MORPHTARGETS_TEXTURE\n#ifdef MORPHTARGETS_POSITION\nattribute vec3 position{X};\n#endif\n#ifdef MORPHTARGETS_NORMAL\nattribute vec3 normal{X};\n#endif\n#ifdef MORPHTARGETS_TANGENT\nattribute vec3 tangent{X};\n#endif\n#ifdef MORPHTARGETS_UV\nattribute vec2 uv_{X};\n#endif\n#ifdef MORPHTARGETS_UV2\nattribute vec2 uv2_{X};\n#endif\n#ifdef MORPHTARGETS_COLOR\nattribute vec4 color{X};\n#endif\n#elif {X}==0\nuniform float morphTargetCount;\n#endif\n#endif\n";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]=o);var a={name:i,shader:o}},67400:(e,t,n)=>{n.r(t),n.d(t,{proceduralVertexShaderWGSL:()=>a});var r=n(98519),i="proceduralVertexShader",o="attribute position: vec2f;varying vPosition: vec2f;varying vUV: vec2f;const madd: vec2f= vec2f(0.5,0.5);\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvertexOutputs.vPosition=input.position;vertexOutputs.vUV=input.position*madd+madd;vertexOutputs.position= vec4f(input.position,0.0,1.0);\n#define CUSTOM_VERTEX_MAIN_END\n}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},67568:(e,t,n)=>{n.d(t,{d:()=>f});var r=n(78322),i=n(64726),o=n(62623),a=n(50582),s=n(41085),l=n(57731),c=n(81152),u=(n(80119),n(36321),n(41190)),h=n(34561),d=n(85096),p=n(67780),f=function(){function e(t,n,r,o,u,p,f,m){void 0===n&&(n=c.Y.TEXTURETYPE_FLOAT),void 0===r&&(r=null),void 0===o&&(o=!1),void 0===u&&(u=a.g.TRILINEAR_SAMPLINGMODE),void 0===p&&(p=!1);var _=this;this._shaderLanguage=0,this.enabled=!0,this.forceDepthWriteTransparentMeshes=!1,this.useOnlyInActiveCamera=!1,this.reverseCulling=!1,this._shadersLoaded=!1,this._scene=t,this._storeNonLinearDepth=o,this._storeCameraSpaceZ=p,this.isPacked=n===c.Y.TEXTURETYPE_UNSIGNED_BYTE,this.isPacked?this.clearColor=new i.ov(1,1,1,1):this.clearColor=new i.ov(p?0:1,0,0,1),this._initShaderSourceAsync(),e._SceneComponentInitialization(this._scene);var g=t.getEngine();this._camera=r,u!==a.g.NEAREST_SAMPLINGMODE&&(n!==c.Y.TEXTURETYPE_FLOAT||g._caps.textureFloatLinearFiltering||(u=a.g.NEAREST_SAMPLINGMODE),n!==c.Y.TEXTURETYPE_HALF_FLOAT||g._caps.textureHalfFloatLinearFiltering||(u=a.g.NEAREST_SAMPLINGMODE));var v=this.isPacked||!g._features.supportExtendedTextureFormats?c.Y.TEXTUREFORMAT_RGBA:c.Y.TEXTUREFORMAT_R;this._depthMap=null!=m?m:new s.$(null!=f?f:"DepthRenderer",{width:g.getRenderWidth(),height:g.getRenderHeight()},this._scene,!1,!0,n,!1,u,void 0,void 0,void 0,v),this._depthMap.wrapU=a.g.CLAMP_ADDRESSMODE,this._depthMap.wrapV=a.g.CLAMP_ADDRESSMODE,this._depthMap.refreshRate=1,this._depthMap.renderParticles=!1,this._depthMap.renderList=null,this._depthMap.noPrePassRenderer=!0,this._depthMap.activeCamera=this._camera,this._depthMap.ignoreCameraViewport=!0,this._depthMap.useCameraPostProcesses=!1,this._depthMap.onClearObservable.add((function(e){e.clear(_.clearColor,!0,!0,!0)})),this._depthMap.onBeforeBindObservable.add((function(){var e;null===(e=g._debugPushGroup)||void 0===e||e.call(g,"depth renderer",1)})),this._depthMap.onAfterUnbindObservable.add((function(){var e;null===(e=g._debugPopGroup)||void 0===e||e.call(g,1)})),this._depthMap.customIsReadyFunction=function(e,t,n){if((n||0===t)&&e.subMeshes)for(var r=0;r4&&(u.push(o.R.MatricesIndicesExtraKind),u.push(o.R.MatricesWeightsExtraKind)),c.push("#define NUM_BONE_INFLUENCERS "+i.numBoneInfluencers),i.numBoneInfluencers>0&&_.addCPUSkinningFallback(0,i);var g=i.skeleton;g.isUsingTextureForMatrices?c.push("#define BONETEXTURE"):c.push("#define BonesPerMesh "+(g.bones.length+1))}else c.push("#define NUM_BONE_INFLUENCERS 0");var v=i.morphTargetManager?(0,d.Dk)(i.morphTargetManager,c,u,i,!0,!1,!1,f,m,!1):0;l.pointsCloud&&c.push("#define POINTSIZE"),t&&(c.push("#define INSTANCES"),(0,d.te)(u),e.getRenderingMesh().hasThinInstances&&c.push("#define THIN_INSTANCES"));var y=i.bakedVertexAnimationManager;y&&y.isEnabled&&(c.push("#define BAKED_VERTEX_ANIMATION_TEXTURE"),t&&u.push("bakedVertexAnimationSettingsInstanced")),this._storeNonLinearDepth&&c.push("#define NONLINEARDEPTH"),this._storeCameraSpaceZ&&c.push("#define STORE_CAMERASPACE_Z"),this.isPacked&&c.push("#define PACKED"),(0,h.r4)(l,a,c);var b=e._getDrawWrapper(void 0,!0),S=b.defines,T=c.join("\n");if(S!==T){var E=["world","mBones","boneTextureWidth","pointSize","viewProjection","view","diffuseMatrix","depthValues","morphTargetInfluences","morphTargetCount","morphTargetTextureInfo","morphTargetTextureIndices","bakedVertexAnimationSettings","bakedVertexAnimationTextureSizeInverted","bakedVertexAnimationTime","bakedVertexAnimationTexture"];(0,h.Ll)(E),b.setEffect(r.createEffect("depth",{attributes:u,uniformsNames:E,uniformBuffersNames:[],samplers:["diffuseSampler","morphTargets","boneSampler","bakedVertexAnimationTexture"],defines:T,fallbacks:_,onCompiled:null,onError:null,indexParameters:{maxSimultaneousMorphTargets:v},shaderLanguage:this._shaderLanguage},r),T)}return b.effect.isReady()},e.prototype.getDepthMap=function(){return this._depthMap},e.prototype.dispose=function(){var e=[];for(var t in this._scene._depthRenderer)this._scene._depthRenderer[t]===this&&e.push(t);if(e.length>0){this._depthMap.dispose();for(var n=0,r=e;n{n.r(t),n.d(t,{boundingBoxRendererVertexShader:()=>s});var r=n(98519),i="boundingBoxRendererVertexDeclaration";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="uniform mat4 world;uniform mat4 viewProjection;\n#ifdef MULTIVIEW\nuniform mat4 viewProjectionR;\n#endif\n"),n(90253);var o="boundingBoxRendererVertexShader",a="attribute vec3 position;\n#include<__decl__boundingBoxRendererVertex>\n#ifdef INSTANCES\nattribute vec4 world0;attribute vec4 world1;attribute vec4 world2;attribute vec4 world3;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef INSTANCES\nmat4 finalWorld=mat4(world0,world1,world2,world3);vec4 worldPos=finalWorld*vec4(position,1.0);\n#else\nvec4 worldPos=world*vec4(position,1.0);\n#endif\n#ifdef MULTIVIEW\nif (gl_ViewID_OVR==0u) {gl_Position=viewProjection*worldPos;} else {gl_Position=viewProjectionR*worldPos;}\n#else\ngl_Position=viewProjection*worldPos;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n";r.l.ShadersStore[o]||(r.l.ShadersStore[o]=a);var s={name:o,shader:a}},67780:(e,t,n)=>{n.d(t,{J:()=>r});var r=function(){function e(){this._defines={},this._currentRank=32,this._maxRank=-1,this._mesh=null}return e.prototype.unBindMesh=function(){this._mesh=null},e.prototype.addFallback=function(e,t){this._defines[e]||(ethis._maxRank&&(this._maxRank=e),this._defines[e]=new Array),this._defines[e].push(t)},e.prototype.addCPUSkinningFallback=function(e,t){this._mesh=t,ethis._maxRank&&(this._maxRank=e)},Object.defineProperty(e.prototype,"hasMoreFallbacks",{get:function(){return this._currentRank<=this._maxRank},enumerable:!1,configurable:!0}),e.prototype.reduce=function(e,t){if(this._mesh&&this._mesh.computeBonesUsingShaders&&this._mesh.numBoneInfluencers>0){this._mesh.computeBonesUsingShaders=!1,e=e.replace("#define NUM_BONE_INFLUENCERS "+this._mesh.numBoneInfluencers,"#define NUM_BONE_INFLUENCERS 0"),t._bonesComputationForcedToCPU=!0;for(var n=this._mesh.getScene(),r=0;r0&&(i.computeBonesUsingShaders=!1)}}else{var s=this._defines[this._currentRank];if(s)for(r=0;r{n.r(t),n.d(t,{glowBlurPostProcessPixelShader:()=>a});var r=n(98519),i="glowBlurPostProcessPixelShader",o="varying vec2 vUV;uniform sampler2D textureSampler;uniform vec2 screenSize;uniform vec2 direction;uniform float blurWidth;float getLuminance(vec3 color)\n{return dot(color,vec3(0.2126,0.7152,0.0722));}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{float weights[7];weights[0]=0.05;weights[1]=0.1;weights[2]=0.2;weights[3]=0.3;weights[4]=0.2;weights[5]=0.1;weights[6]=0.05;vec2 texelSize=vec2(1.0/screenSize.x,1.0/screenSize.y);vec2 texelStep=texelSize*direction*blurWidth;vec2 start=vUV-3.0*texelStep;vec4 baseColor=vec4(0.,0.,0.,0.);vec2 texelOffset=vec2(0.,0.);for (int i=0; i<7; i++)\n{vec4 texel=texture2D(textureSampler,start+texelOffset);baseColor.a+=texel.a*weights[i];float luminance=getLuminance(baseColor.rgb);float luminanceTexel=getLuminance(texel.rgb);float choice=step(luminanceTexel,luminance);baseColor.rgb=choice*baseColor.rgb+(1.0-choice)*texel.rgb;texelOffset+=texelStep;}\ngl_FragColor=baseColor;}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},67925:(e,t,n)=>{n.d(t,{Z:()=>m});var r=n(45158),i=n(66377),o=n(81152),a=n(50712),s=function(){function e(){}return e.CreateDeviceEvent=function(e,t,n,i,o,a,s){switch(e){case r.bq.Keyboard:return this._CreateKeyboardEvent(n,i,o,a);case r.bq.Mouse:if(n===r.ST.MouseWheelX||n===r.ST.MouseWheelY||n===r.ST.MouseWheelZ)return this._CreateWheelEvent(e,t,n,i,o,a);case r.bq.Touch:return this._CreatePointerEvent(e,t,n,i,o,a,s);default:throw"Unable to generate event for device ".concat(r.bq[e])}},e._CreatePointerEvent=function(e,t,n,i,o,a,s){var l=this._CreateMouseEvent(e,t,n,i,o,a);e===r.bq.Mouse?(l.deviceType=r.bq.Mouse,l.pointerId=1,l.pointerType="mouse"):(l.deviceType=r.bq.Touch,l.pointerId=null!=s?s:t,l.pointerType="touch");var c=0;return c+=o.pollInput(e,t,r.ST.LeftClick),c+=2*o.pollInput(e,t,r.ST.RightClick),c+=4*o.pollInput(e,t,r.ST.MiddleClick),l.buttons=c,n===r.ST.Move?l.type="pointermove":n>=r.ST.LeftClick&&n<=r.ST.RightClick&&(l.type=1===i?"pointerdown":"pointerup",l.button=n-2),l},e._CreateWheelEvent=function(e,t,n,i,o,s){var l=this._CreateMouseEvent(e,t,n,i,o,s);switch(l.pointerId=1,l.type="wheel",l.deltaMode=a.s.DOM_DELTA_PIXEL,l.deltaX=0,l.deltaY=0,l.deltaZ=0,n){case r.ST.MouseWheelX:l.deltaX=i;break;case r.ST.MouseWheelY:l.deltaY=i;break;case r.ST.MouseWheelZ:l.deltaZ=i}return l},e._CreateMouseEvent=function(e,t,n,i,o,a){var s=this._CreateEvent(a),l=o.pollInput(e,t,r.ST.Horizontal),c=o.pollInput(e,t,r.ST.Vertical);return a?(s.movementX=0,s.movementY=0,s.offsetX=s.movementX-a.getBoundingClientRect().x,s.offsetY=s.movementY-a.getBoundingClientRect().y):(s.movementX=o.pollInput(e,t,10),s.movementY=o.pollInput(e,t,11),s.offsetX=0,s.offsetY=0),this._CheckNonCharacterKeys(s,o),s.clientX=l,s.clientY=c,s.x=l,s.y=c,s.deviceType=e,s.deviceSlot=t,s.inputIndex=n,s},e._CreateKeyboardEvent=function(e,t,n,i){var o=this._CreateEvent(i);return this._CheckNonCharacterKeys(o,n),o.deviceType=r.bq.Keyboard,o.deviceSlot=0,o.inputIndex=e,o.type=1===t?"keydown":"keyup",o.key=String.fromCharCode(e),o.keyCode=e,o},e._CheckNonCharacterKeys=function(e,t){var n=t.isDeviceAvailable(r.bq.Keyboard),i=n&&1===t.pollInput(r.bq.Keyboard,0,o.Y.INPUT_ALT_KEY),a=n&&1===t.pollInput(r.bq.Keyboard,0,o.Y.INPUT_CTRL_KEY),s=n&&(1===t.pollInput(r.bq.Keyboard,0,o.Y.INPUT_META_KEY1)||1===t.pollInput(r.bq.Keyboard,0,o.Y.INPUT_META_KEY2)||1===t.pollInput(r.bq.Keyboard,0,o.Y.INPUT_META_KEY3)),l=n&&1===t.pollInput(r.bq.Keyboard,0,o.Y.INPUT_SHIFT_KEY);e.altKey=i,e.ctrlKey=a,e.metaKey=s,e.shiftKey=l},e._CreateEvent=function(e){var t={preventDefault:function(){}};return t.target=e,t},e}(),l=function(){function e(e,t,n){var r=this;this._nativeInput=_native.DeviceInputSystem?new _native.DeviceInputSystem(e,t,(function(e,t,i,o){var a=s.CreateDeviceEvent(e,t,i,o,r);n(e,t,a)})):this._createDummyNativeInput()}return e.prototype.pollInput=function(e,t,n){return this._nativeInput.pollInput(e,t,n)},e.prototype.isDeviceAvailable=function(e){return e===r.bq.Mouse||e===r.bq.Touch},e.prototype.dispose=function(){this._nativeInput.dispose()},e.prototype._createDummyNativeInput=function(){return{pollInput:function(){return 0},isDeviceAvailable:function(){return!1},dispose:function(){}}},e}(),c=n(5153),u=n(44957),h=Object.keys(r.ST).length/2,d=function(){function e(e,t,n,r){var i=this;this._inputs=[],this._keyboardActive=!1,this._pointerActive=!1,this._usingSafari=u.S0.IsSafari(),this._usingMacOs=(0,c.XD)()&&/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform),this._keyboardDownEvent=function(e){},this._keyboardUpEvent=function(e){},this._keyboardBlurEvent=function(e){},this._pointerMoveEvent=function(e){},this._pointerDownEvent=function(e){},this._pointerUpEvent=function(e){},this._pointerCancelEvent=function(e){},this._pointerCancelTouch=function(e){},this._pointerLeaveEvent=function(e){},this._pointerWheelEvent=function(e){},this._pointerBlurEvent=function(e){},this._pointerMacOsChromeOutEvent=function(e){},this._eventsAttached=!1,this._mouseId=-1,this._isUsingFirefox=(0,c.XD)()&&navigator.userAgent&&-1!==navigator.userAgent.indexOf("Firefox"),this._isUsingChromium=(0,c.XD)()&&navigator.userAgent&&-1!==navigator.userAgent.indexOf("Chrome"),this._maxTouchPoints=0,this._pointerInputClearObserver=null,this._gamepadConnectedEvent=function(e){},this._gamepadDisconnectedEvent=function(e){},this._eventPrefix=u.S0.GetPointerPrefix(e),this._engine=e,this._onDeviceConnected=t,this._onDeviceDisconnected=n,this._onInputChanged=r,this._mouseId=this._isUsingFirefox?0:1,this._enableEvents(),this._usingMacOs&&(this._metaKeys=[]),this._engine._onEngineViewChanged||(this._engine._onEngineViewChanged=function(){i._enableEvents()})}return e.prototype.pollInput=function(e,t,n){var i=this._inputs[e][t];if(!i)throw"Unable to find device ".concat(r.bq[e]);e>=r.bq.DualShock&&e<=r.bq.DualSense&&this._updateDevice(e,t,n);var o=i[n];if(void 0===o)throw"Unable to find input ".concat(n," for device ").concat(r.bq[e]," in slot ").concat(t);return n===r.ST.Move&&u.S0.Warn("Unable to provide information for PointerInput.Move. Try using PointerInput.Horizontal or PointerInput.Vertical for move data."),o},e.prototype.isDeviceAvailable=function(e){return void 0!==this._inputs[e]},e.prototype.dispose=function(){this._onDeviceConnected=function(){},this._onDeviceDisconnected=function(){},this._onInputChanged=function(){},delete this._engine._onEngineViewChanged,this._elementToAttachTo&&this._disableEvents()},e.prototype._enableEvents=function(){var e=null==this?void 0:this._engine.getInputElement();if(e&&(!this._eventsAttached||this._elementToAttachTo!==e)){if(this._disableEvents(),this._inputs)for(var t=0,n=this._inputs;t0){for(var o=0,a=e._metaKeys;o=0))return void u.S0.Warn("Max number of touches exceeded. Ignoring touches in excess of ".concat(e._maxTouchPoints));i=o,e._activeTouchIds[o]=t.pointerId,e._onDeviceConnected(n,i)}e._inputs[n]||(e._inputs[n]={}),e._inputs[n][i]||e._addPointerDevice(n,i,t.clientX,t.clientY);var a=e._inputs[n][i];if(a){var s=t;s.inputIndex=r.ST.Move,a[r.ST.Horizontal]=t.clientX,a[r.ST.Vertical]=t.clientY,n===r.bq.Touch&&0===a[r.ST.LeftClick]&&(a[r.ST.LeftClick]=1),void 0===t.pointerId&&(t.pointerId=e._mouseId),e._onInputChanged(n,i,s),e._usingSafari||-1===t.button||(s.inputIndex=t.button+2,a[t.button+2]=a[t.button+2]?0:1,e._onInputChanged(n,i,s))}},this._pointerDownEvent=function(t){var n=e._getPointerType(t),i=n===r.bq.Mouse?0:t.pointerId;if(n===r.bq.Touch){var o=e._activeTouchIds.indexOf(t.pointerId);if(-1===o&&(o=e._activeTouchIds.indexOf(-1)),!(o>=0))return void u.S0.Warn("Max number of touches exceeded. Ignoring touches in excess of ".concat(e._maxTouchPoints));i=o,e._activeTouchIds[o]=t.pointerId}e._inputs[n]||(e._inputs[n]={}),e._inputs[n][i]?n===r.bq.Touch&&e._onDeviceConnected(n,i):e._addPointerDevice(n,i,t.clientX,t.clientY);var a=e._inputs[n][i];if(a){var s=a[r.ST.Horizontal],l=a[r.ST.Vertical];if(n===r.bq.Mouse){if(void 0===t.pointerId&&(t.pointerId=e._mouseId),!document.pointerLockElement)try{e._elementToAttachTo.setPointerCapture(e._mouseId)}catch(e){}}else if(t.pointerId&&!document.pointerLockElement)try{e._elementToAttachTo.setPointerCapture(t.pointerId)}catch(e){}a[r.ST.Horizontal]=t.clientX,a[r.ST.Vertical]=t.clientY,a[t.button+2]=1;var c=t;c.inputIndex=t.button+2,e._onInputChanged(n,i,c),s===t.clientX&&l===t.clientY||(c.inputIndex=r.ST.Move,e._onInputChanged(n,i,c))}},this._pointerUpEvent=function(t){var n,i,o,a,s,l=e._getPointerType(t),c=l===r.bq.Mouse?0:e._activeTouchIds.indexOf(t.pointerId);if(l===r.bq.Touch){if(-1===c)return;e._activeTouchIds[c]=-1}var u=null===(n=e._inputs[l])||void 0===n?void 0:n[c],h=t.button,d=u&&0!==u[h+2];if(!d&&e._isUsingFirefox&&e._usingMacOs&&u&&(d=0!==u[2+(h=2===h?0:2)]),d){var p=u[r.ST.Horizontal],f=u[r.ST.Vertical];u[r.ST.Horizontal]=t.clientX,u[r.ST.Vertical]=t.clientY,u[h+2]=0;var m=t;void 0===t.pointerId&&(t.pointerId=e._mouseId),p===t.clientX&&f===t.clientY||(m.inputIndex=r.ST.Move,e._onInputChanged(l,c,m)),m.inputIndex=h+2,l===r.bq.Mouse&&e._mouseId>=0&&(null===(o=(i=e._elementToAttachTo).hasPointerCapture)||void 0===o?void 0:o.call(i,e._mouseId))?e._elementToAttachTo.releasePointerCapture(e._mouseId):t.pointerId&&(null===(s=(a=e._elementToAttachTo).hasPointerCapture)||void 0===s?void 0:s.call(a,t.pointerId))&&e._elementToAttachTo.releasePointerCapture(t.pointerId),e._onInputChanged(l,c,m),l===r.bq.Touch&&e._onDeviceDisconnected(l,c)}},this._pointerCancelTouch=function(t){var n,i,o=e._activeTouchIds.indexOf(t);if(-1!==o){(null===(i=(n=e._elementToAttachTo).hasPointerCapture)||void 0===i?void 0:i.call(n,t))&&e._elementToAttachTo.releasePointerCapture(t),e._inputs[r.bq.Touch][o][r.ST.LeftClick]=0;var a=s.CreateDeviceEvent(r.bq.Touch,o,r.ST.LeftClick,0,e,e._elementToAttachTo,t);e._onInputChanged(r.bq.Touch,o,a),e._activeTouchIds[o]=-1,e._onDeviceDisconnected(r.bq.Touch,o)}},this._pointerCancelEvent=function(t){var n,i;if("mouse"===t.pointerType){var o=e._inputs[r.bq.Mouse][0];e._mouseId>=0&&(null===(i=(n=e._elementToAttachTo).hasPointerCapture)||void 0===i?void 0:i.call(n,e._mouseId))&&e._elementToAttachTo.releasePointerCapture(e._mouseId);for(var a=r.ST.LeftClick;a<=r.ST.BrowserForward;a++)if(1===o[a]){o[a]=0;var l=s.CreateDeviceEvent(r.bq.Mouse,0,a,0,e,e._elementToAttachTo);e._onInputChanged(r.bq.Mouse,0,l)}}else e._pointerCancelTouch(t.pointerId)},this._pointerLeaveEvent=function(t){"pen"===t.pointerType&&e._pointerCancelTouch(t.pointerId)},this._wheelEventName="onwheel"in document.createElement("div")?"wheel":void 0!==document.onmousewheel?"mousewheel":"DOMMouseScroll";var n=!1,i=function(){};try{var o=Object.defineProperty({},"passive",{get:function(){n=!0}});this._elementToAttachTo.addEventListener("test",i,o),this._elementToAttachTo.removeEventListener("test",i,o)}catch(e){}this._pointerBlurEvent=function(){var t,n,i,o,a;if(e.isDeviceAvailable(r.bq.Mouse)){var l=e._inputs[r.bq.Mouse][0];e._mouseId>=0&&(null===(n=(t=e._elementToAttachTo).hasPointerCapture)||void 0===n?void 0:n.call(t,e._mouseId))&&e._elementToAttachTo.releasePointerCapture(e._mouseId);for(var c=r.ST.LeftClick;c<=r.ST.BrowserForward;c++)if(1===l[c]){l[c]=0;var u=s.CreateDeviceEvent(r.bq.Mouse,0,c,0,e,e._elementToAttachTo);e._onInputChanged(r.bq.Mouse,0,u)}}if(e.isDeviceAvailable(r.bq.Touch)){l=e._inputs[r.bq.Touch];for(var h=0;h1&&e._pointerCancelEvent(t)},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,!!n&&{passive:!1}),this._pointerInputClearObserver=this._engine.onEndFrameObservable.add((function(){if(e.isDeviceAvailable(r.bq.Mouse)){var t=e._inputs[r.bq.Mouse][0];t[r.ST.MouseWheelX]=0,t[r.ST.MouseWheelY]=0,t[r.ST.MouseWheelZ]=0}}))},e.prototype._handleGamepadActions=function(){var e=this;this._gamepadConnectedEvent=function(t){e._addGamePad(t.gamepad)},this._gamepadDisconnectedEvent=function(t){if(e._gamepads){var n=e._getGamepadDeviceType(t.gamepad.id),r=t.gamepad.index;e._unregisterDevice(n,r),delete e._gamepads[r]}},window.addEventListener("gamepadconnected",this._gamepadConnectedEvent),window.addEventListener("gamepaddisconnected",this._gamepadDisconnectedEvent)},e.prototype._updateDevice=function(e,t,n){var r=navigator.getGamepads()[t];if(r&&e===this._gamepads[t]){var i=this._inputs[e][t];n>=r.buttons.length?i[n]=r.axes[n-r.buttons.length].valueOf():i[n]=r.buttons[n].value}},e.prototype._getGamepadDeviceType=function(e){return-1!==e.indexOf("054c")?-1!==e.indexOf("0ce6")?r.bq.DualSense:r.bq.DualShock:-1!==e.indexOf("Xbox One")||-1!==e.search("Xbox 360")||-1!==e.search("xinput")?r.bq.Xbox:-1!==e.indexOf("057e")?r.bq.Switch:r.bq.Generic},e.prototype._getPointerType=function(e){var t=r.bq.Mouse;return("touch"===e.pointerType||"pen"===e.pointerType||e.touches)&&(t=r.bq.Touch),t},e}(),p=n(84163),f=function(){function e(e){var t=this;this._registeredManagers=new Array,this._refCount=0,this.registerManager=function(e){for(var n=0;n-1&&t._registeredManagers.splice(n,1)};var n=Object.keys(r.bq).length/2;this._devices=new Array(n);var i=function(e,n){t._devices[e]||(t._devices[e]=new Array),t._devices[e][n]||(t._devices[e][n]=n);for(var r=0,i=t._registeredManagers;r{n.r(t),n.d(t,{FlowGraphAngleBetweenBlock:()=>P,FlowGraphAxisAngleFromQuaternionBlock:()=>R,FlowGraphConjugateBlock:()=>x,FlowGraphCrossBlock:()=>v,FlowGraphDotBlock:()=>g,FlowGraphLengthBlock:()=>m,FlowGraphNormalizeBlock:()=>_,FlowGraphQuaternionFromAxisAngleBlock:()=>C,FlowGraphQuaternionFromDirectionsBlock:()=>A,FlowGraphRotate2DBlock:()=>y,FlowGraphRotate3DBlock:()=>b,FlowGraphTransformBlock:()=>T,FlowGraphTransformCoordinatesBlock:()=>E});var r=n(78322),i=n(45749),o=n(88099),a=n(34623),s=n(20201),l=n(23101),c=n(8046),u=n(95803),h=n(37065),d="cachedOperationAxis",p="cachedOperationAngle",f="cachedExecutionId",m=function(e){function t(t){var n=e.call(this,o.Vv,o.Es,(function(e){return n._polymorphicLength(e)}),"FlowGraphLengthBlock",t)||this;return n}return(0,r.C6)(t,e),t.prototype._polymorphicLength=function(e){switch((0,u.I$)(e)){case"Vector2":case"Vector3":case"Vector4":case"Quaternion":return e.length();default:throw new Error("Cannot compute length of value ".concat(e))}},t}(l.a);(0,a.Y5)("FlowGraphLengthBlock",m);var _=function(e){function t(t){var n=e.call(this,o.Vv,o.Vv,(function(e){return n._polymorphicNormalize(e)}),"FlowGraphNormalizeBlock",t)||this;return n}return(0,r.C6)(t,e),t.prototype._polymorphicNormalize=function(e){var t,n;switch((0,u.I$)(e)){case"Vector2":case"Vector3":case"Vector4":case"Quaternion":return n=e.normalizeToNew(),(null===(t=this.config)||void 0===t?void 0:t.nanOnZeroLength)&&0===e.length()&&n.setAll(NaN),n;default:throw new Error("Cannot normalize value ".concat(e))}},t}(l.a);(0,a.Y5)("FlowGraphNormalizeBlock",_);var g=function(e){function t(t){var n=e.call(this,o.Vv,o.Vv,o.Es,(function(e,t){return n._polymorphicDot(e,t)}),"FlowGraphDotBlock",t)||this;return n}return(0,r.C6)(t,e),t.prototype._polymorphicDot=function(e,t){switch((0,u.I$)(e)){case"Vector2":case"Vector3":case"Vector4":case"Quaternion":return e.dot(t);default:throw new Error("Cannot get dot product of ".concat(e," and ").concat(t))}},t}(s.W);(0,a.Y5)("FlowGraphDotBlock",g);var v=function(e){function t(t){return e.call(this,o.Dx,o.Dx,o.Dx,(function(e,t){return c.Pq.Cross(e,t)}),"FlowGraphCrossBlock",t)||this}return(0,r.C6)(t,e),t}(s.W);(0,a.Y5)("FlowGraphCrossBlock",v);var y=function(e){function t(t){return e.call(this,o.K$,o.Es,o.K$,(function(e,t){return e.rotate(t)}),"FlowGraphRotate2DBlock",t)||this}return(0,r.C6)(t,e),t}(s.W);(0,a.Y5)("FlowGraphRotate2DBlock",y);var b=function(e){function t(t){return e.call(this,o.Dx,o.P_,o.Dx,(function(e,t){return e.applyRotationQuaternion(t)}),"FlowGraphRotate3DBlock",t)||this}return(0,r.C6)(t,e),t}(s.W);function S(e,t){switch((0,u.I$)(e)){case"Vector2":case"Vector3":return t.transformVector(e);case"Vector4":return new c.IU(e.x*t.m[0]+e.y*t.m[1]+e.z*t.m[2]+e.w*t.m[3],e.x*t.m[4]+e.y*t.m[5]+e.z*t.m[6]+e.w*t.m[7],e.x*t.m[8]+e.y*t.m[9]+e.z*t.m[10]+e.w*t.m[11],e.x*t.m[12]+e.y*t.m[13]+e.z*t.m[14]+e.w*t.m[15]);default:throw new Error("Cannot transform value ".concat(e))}}(0,a.Y5)("FlowGraphRotate3DBlock",b);var T=function(e){function t(t){var n=(null==t?void 0:t.vectorType)||"Vector3",r="Vector2"===n?"Matrix2D":"Vector3"===n?"Matrix3D":"Matrix";return e.call(this,(0,o.Yd)(n),(0,o.Yd)(r),(0,o.Yd)(n),S,"FlowGraphTransformVectorBlock",t)||this}return(0,r.C6)(t,e),t}(s.W);(0,a.Y5)("FlowGraphTransformVectorBlock",T);var E=function(e){function t(t){return e.call(this,o.Dx,o.Sp,o.Dx,(function(e,t){return c.Pq.TransformCoordinates(e,t)}),"FlowGraphTransformCoordinatesBlock",t)||this}return(0,r.C6)(t,e),t}(s.W);(0,a.Y5)("FlowGraphTransformCoordinatesBlock",E);var x=function(e){function t(t){return e.call(this,o.P_,o.P_,(function(e){return e.conjugate()}),"FlowGraphConjugateBlock",t)||this}return(0,r.C6)(t,e),t}(l.a);(0,a.Y5)("FlowGraphConjugateBlock",x);var P=function(e){function t(t){return e.call(this,o.P_,o.P_,o.Es,(function(e,t){return(0,h.bQ)(e,t)}),"FlowGraphAngleBetweenBlock",t)||this}return(0,r.C6)(t,e),t}(s.W);(0,a.Y5)("FlowGraphAngleBetweenBlock",P);var C=function(e){function t(t){return e.call(this,o.Dx,o.Es,o.P_,(function(e,t){return c.PT.RotationAxis(e,t)}),"FlowGraphQuaternionFromAxisAngleBlock",t)||this}return(0,r.C6)(t,e),t}(s.W);(0,a.Y5)("FlowGraphQuaternionFromAxisAngleBlock",C);var R=function(e){function t(t){var n=e.call(this,t)||this;return n.a=n.registerDataInput("a",o.P_),n.axis=n.registerDataOutput("axis",o.Dx),n.angle=n.registerDataOutput("angle",o.Es),n.isValid=n.registerDataOutput("isValid",o.RI),n}return(0,r.C6)(t,e),t.prototype._updateOutputs=function(e){var t=e._getExecutionVariable(this,f,-1),n=e._getExecutionVariable(this,d,null),r=e._getExecutionVariable(this,p,null);if(null!=n&&null!=r&&t===e.executionId)this.axis.setValue(n,e),this.angle.setValue(r,e);else try{var i=this.a.getValue(e).toAxisAngle(),o=i.axis,a=i.angle;e._setExecutionVariable(this,d,o),e._setExecutionVariable(this,p,a),e._setExecutionVariable(this,f,e.executionId),this.axis.setValue(o,e),this.angle.setValue(a,e),this.isValid.setValue(!0,e)}catch(t){this.isValid.setValue(!1,e)}},t.prototype.getClassName=function(){return"FlowGraphAxisAngleFromQuaternionBlock"},t}(i.e);(0,a.Y5)("FlowGraphAxisAngleFromQuaternionBlock",R);var A=function(e){function t(t){return e.call(this,o.Dx,o.Dx,o.P_,(function(e,t){return(0,h.pi)(e,t)}),"FlowGraphQuaternionFromDirectionsBlock",t)||this}return(0,r.C6)(t,e),t}(s.W)},68202:(e,t,n)=>{n.r(t),n.d(t,{iblCdfDebugPixelShaderWGSL:()=>a});var r=n(98519),i="iblCdfDebugPixelShader",o="#define PI 3.1415927\nvarying vUV: vec2f;var cdfySampler: sampler;var cdfy: texture_2d;var cdfxSampler: sampler;var cdfx: texture_2d;var icdfSampler: sampler;var icdf: texture_2d;\n#ifdef IBL_USE_CUBE_MAP\nvar iblSourceSampler: sampler;var iblSource: texture_cube;\n#else\nvar iblSourceSampler: sampler;var iblSource: texture_2d;\n#endif\nvar textureSamplerSampler: sampler;var textureSampler: texture_2d;\n#define cdfyVSize (0.8/3.0)\n#define cdfxVSize 0.1\n#define cdfyHSize 0.5\nuniform sizeParams: vec4f;\n#ifdef IBL_USE_CUBE_MAP\nfn equirectangularToCubemapDirection(uv: vec2f)->vec3f {var longitude: f32=uv.x*2.0*PI-PI;var latitude: f32=PI*0.5-uv.y*PI;var direction: vec3f;direction.x=cos(latitude)*sin(longitude);direction.y=sin(latitude);direction.z=cos(latitude)*cos(longitude);return direction;}\n#endif\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs { \nvar colour: vec3f= vec3f(0.0);var uv: vec2f =\nvec2f((uniforms.sizeParams.x+input.vUV.x)*uniforms.sizeParams.z,(uniforms.sizeParams.y+input.vUV.y)*uniforms.sizeParams.w);var backgroundColour: vec3f=textureSample(textureSampler,textureSamplerSampler,input.vUV).rgb;var cdfxWidth: u32=textureDimensions(cdfx,0).x;var cdfyHeight: u32=textureDimensions(cdfy,0).y;const iblStart: f32=1.0-cdfyVSize;const pdfStart: f32=1.0-2.0*cdfyVSize;const cdfyStart: f32=1.0-3.0*cdfyVSize;const cdfxStart: f32=1.0-3.0*cdfyVSize-cdfxVSize;const icdfxStart: f32=1.0-3.0*cdfyVSize-2.0*cdfxVSize;\n#ifdef IBL_USE_CUBE_MAP\nvar direction: vec3f=equirectangularToCubemapDirection(\n(uv- vec2f(0.0,iblStart))* vec2f(1.0,1.0/cdfyVSize));var iblColour: vec3f=textureSampleLevel(iblSource,iblSourceSampler,direction,0.0).rgb;\n#else\nvar iblColour: vec3f=textureSample(iblSource,iblSourceSampler,(uv- vec2f(0.0,iblStart)) *\nvec2f(1.0,1.0/cdfyVSize))\n.rgb;\n#endif\nvar pdfColour: vec3f =\ntextureSample(icdf,icdfSampler,(uv- vec2f(0.0,pdfStart))* vec2f(1.0,1.0/cdfyVSize)).zzz;var cdfyColour: f32 =\ntextureSample(cdfy,cdfySampler,(uv- vec2f(0.0,cdfyStart))* vec2f(2.0,1.0/cdfyVSize)).r;var icdfyColour: f32 =\ntextureSample(icdf,icdfSampler,(uv- vec2f(0.5,cdfyStart))* vec2f(2.0,1.0/cdfyVSize)).g;var cdfxColour: f32 =\ntextureSample(cdfx,cdfxSampler,(uv- vec2f(0.0,cdfxStart))* vec2f(1.0,1.0/cdfxVSize)).r;var icdfxColour: f32=textureSample(icdf,icdfSampler,(uv- vec2f(0.0,icdfxStart)) *\nvec2f(1.0,1.0/cdfxVSize)).r;if (uv.x<0.0 || uv.x>1.0 || uv.y<0.0 || uv.y>1.0) {colour=backgroundColour;} else if (uv.y>iblStart) {colour+=iblColour;} else if (uv.y>pdfStart) {colour+=pdfColour;} else if (uv.y>cdfyStart && uv.x<0.5) {colour.r+=cdfyColour/f32(cdfyHeight);} else if (uv.y>cdfyStart && uv.x>0.5) {colour.r+=icdfyColour;} else if (uv.y>cdfxStart) {colour.r+=cdfxColour/f32(cdfxWidth);} else if (uv.y>icdfxStart) {colour.r+=icdfxColour;}\nfragmentOutputs.color =vec4(mix(colour,backgroundColour,0.5),1.0);}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},68298:(e,t,n)=>{n.r(t),n.d(t,{packingFunctionsWGSL:()=>a});var r=n(98519),i="packingFunctions",o="fn pack(depth: f32)->vec4f\n{const bit_shift: vec4f= vec4f(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const bit_mask: vec4f= vec4f(0.0,1.0/255.0,1.0/255.0,1.0/255.0);var res: vec4f=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}\nfn unpack(color: vec4f)->f32\n{const bit_shift: vec4f= vec4f(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(color,bit_shift);}";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]=o);var a={name:i,shader:o}},68325:(e,t,n)=>{var r=n(98519),i="gaussianSplatting";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="fn getDataUV(index: f32,dataTextureSize: vec2f)->vec2 {let y: f32=floor(index/dataTextureSize.x);let x: f32=index-y*dataTextureSize.x;return vec2f((x+0.5),(y+0.5));}\nstruct Splat {center: vec4f,\n#ifndef GS_DISABLE_COLOR\ncolor: vec4f,\n#endif\ncovA: vec4f,\ncovB: vec4f,\n#if SH_DEGREE>0\nsh0: vec4,\n#endif\n#if SH_DEGREE>1\nsh1: vec4,\n#endif\n#if SH_DEGREE>2\nsh2: vec4,\n#endif\n};fn readSplat(splatIndex: f32,dataTextureSize: vec2f)->Splat {var splat: Splat;let splatUV=getDataUV(splatIndex,dataTextureSize);let splatUVi32=vec2(i32(splatUV.x),i32(splatUV.y));splat.center=textureLoad(centersTexture,splatUVi32,0);\n#ifndef GS_DISABLE_COLOR\nsplat.color=textureLoad(colorsTexture,splatUVi32,0);\n#endif\nsplat.covA=textureLoad(covariancesATexture,splatUVi32,0)*splat.center.w;splat.covB=textureLoad(covariancesBTexture,splatUVi32,0)*splat.center.w;\n#if SH_DEGREE>0\nsplat.sh0=textureLoad(shTexture0,splatUVi32,0);\n#endif\n#if SH_DEGREE>1\nsplat.sh1=textureLoad(shTexture1,splatUVi32,0);\n#endif\n#if SH_DEGREE>2\nsplat.sh2=textureLoad(shTexture2,splatUVi32,0);\n#endif\nreturn splat;}\nfn computeColorFromSHDegree(dir: vec3f,sh: array,16>)->vec3f\n{let SH_C0: f32=0.28209479;let SH_C1: f32=0.48860251;var SH_C2: array=array(\n1.092548430,\n-1.09254843,\n0.315391565,\n-1.09254843,\n0.546274215\n);var SH_C3: array=array(\n-0.59004358,\n2.890611442,\n-0.45704579,\n0.373176332,\n-0.45704579,\n1.445305721,\n-0.59004358\n);var result: vec3f=/*SH_C0**/sh[0];\n#if SH_DEGREE>0\nlet x: f32=dir.x;let y: f32=dir.y;let z: f32=dir.z;result+=-SH_C1*y*sh[1]+SH_C1*z*sh[2]-SH_C1*x*sh[3];\n#if SH_DEGREE>1\nlet xx: f32=x*x;let yy: f32=y*y;let zz: f32=z*z;let xy: f32=x*y;let yz: f32=y*z;let xz: f32=x*z;result+=\nSH_C2[0]*xy*sh[4] +\nSH_C2[1]*yz*sh[5] +\nSH_C2[2]*(2.0f*zz-xx-yy)*sh[6] +\nSH_C2[3]*xz*sh[7] +\nSH_C2[4]*(xx-yy)*sh[8];\n#if SH_DEGREE>2\nresult+=\nSH_C3[0]*y*(3.0f*xx-yy)*sh[9] +\nSH_C3[1]*xy*z*sh[10] +\nSH_C3[2]*y*(4.0f*zz-xx-yy)*sh[11] +\nSH_C3[3]*z*(2.0f*zz-3.0f*xx-3.0f*yy)*sh[12] +\nSH_C3[4]*x*(4.0f*zz-xx-yy)*sh[13] +\nSH_C3[5]*z*(xx-yy)*sh[14] +\nSH_C3[6]*x*(xx-3.0f*yy)*sh[15];\n#endif\n#endif\n#endif\nreturn result;}\nfn decompose(value: u32)->vec4f\n{let components : vec4f=vec4f(\nf32((value ) & 255u),\nf32((value>>u32( 8)) & 255u),\nf32((value>>u32(16)) & 255u),\nf32((value>>u32(24)) & 255u));return components*vec4f(2./255.)-vec4f(1.);}\nfn computeSH(splat: Splat,dir: vec3f)->vec3f\n{var sh: array,16>;sh[0]=vec3f(0.,0.,0.);\n#if SH_DEGREE>0\nlet sh00: vec4f=decompose(splat.sh0.x);let sh01: vec4f=decompose(splat.sh0.y);let sh02: vec4f=decompose(splat.sh0.z);sh[1]=vec3f(sh00.x,sh00.y,sh00.z);sh[2]=vec3f(sh00.w,sh01.x,sh01.y);sh[3]=vec3f(sh01.z,sh01.w,sh02.x);\n#endif\n#if SH_DEGREE>1\nlet sh03: vec4f=decompose(splat.sh0.w);let sh04: vec4f=decompose(splat.sh1.x);let sh05: vec4f=decompose(splat.sh1.y);sh[4]=vec3f(sh02.y,sh02.z,sh02.w);sh[5]=vec3f(sh03.x,sh03.y,sh03.z);sh[6]=vec3f(sh03.w,sh04.x,sh04.y);sh[7]=vec3f(sh04.z,sh04.w,sh05.x);sh[8]=vec3f(sh05.y,sh05.z,sh05.w);\n#endif\n#if SH_DEGREE>2\nlet sh06: vec4f=decompose(splat.sh1.z);let sh07: vec4f=decompose(splat.sh1.w);let sh08: vec4f=decompose(splat.sh2.x);let sh09: vec4f=decompose(splat.sh2.y);let sh10: vec4f=decompose(splat.sh2.z);let sh11: vec4f=decompose(splat.sh2.w);sh[9]=vec3f(sh06.x,sh06.y,sh06.z);sh[10]=vec3f(sh06.w,sh07.x,sh07.y);sh[11]=vec3f(sh07.z,sh07.w,sh08.x);sh[12]=vec3f(sh08.y,sh08.z,sh08.w);sh[13]=vec3f(sh09.x,sh09.y,sh09.z);sh[14]=vec3f(sh09.w,sh10.x,sh10.y);sh[15]=vec3f(sh10.z,sh10.w,sh11.x); \n#endif\nreturn computeColorFromSHDegree(dir,sh);}\nfn gaussianSplatting(\nmeshPos: vec2,\nworldPos: vec3,\nscale: vec2,\ncovA: vec3,\ncovB: vec3,\nworldMatrix: mat4x4,\nviewMatrix: mat4x4,\nprojectionMatrix: mat4x4,\nfocal: vec2f,\ninvViewport: vec2f,\nkernelSize: f32\n)->vec4f {let modelView=viewMatrix*worldMatrix;let camspace=viewMatrix*vec4f(worldPos,1.0);let pos2d=projectionMatrix*camspace;let bounds=1.2*pos2d.w;if (pos2d.z<0. || pos2d.x<-bounds || pos2d.x>bounds || pos2d.y<-bounds || pos2d.y>bounds) {return vec4f(0.0,0.0,2.0,1.0);}\nlet Vrk=mat3x3(\ncovA.x,covA.y,covA.z,\ncovA.y,covB.x,covB.y,\ncovA.z,covB.y,covB.z\n);let isOrtho=abs(projectionMatrix[3][3]-1.0)<0.001;var J: mat3x3;if (isOrtho) {J=mat3x3(\nfocal.x,0.0,0.0,\n0.0,focal.y,0.0,\n0.0,0.0,0.0\n);} else {J=mat3x3(\nfocal.x/camspace.z,0.0,-(focal.x*camspace.x)/(camspace.z*camspace.z),\n0.0,focal.y/camspace.z,-(focal.y*camspace.y)/(camspace.z*camspace.z),\n0.0,0.0,0.0\n);}\nlet invy=mat3x3(\n1.0,0.0,0.0,\n0.0,-1.0,0.0,\n0.0,0.0,1.0\n);let T=invy*transpose(mat3x3(\nmodelView[0].xyz,\nmodelView[1].xyz,\nmodelView[2].xyz))*J;var cov2d=transpose(T)*Vrk*T;\n#if COMPENSATION\nlet c00: f32=cov2d[0][0];let c11: f32=cov2d[1][1];let c01: f32=cov2d[0][1];let detOrig: f32=c00*c11-c01*c01;\n#endif\ncov2d[0][0]+=kernelSize;cov2d[1][1]+=kernelSize;\n#if COMPENSATION\nlet c2d: vec3f=vec3f(cov2d[0][0],c01,cov2d[1][1]);let detBlur: f32=c2d.x*c2d.z-c2d.y*c2d.y;let compensation: f32=sqrt(max(0.,detOrig/detBlur));vertexOutputs.vColor.w*=compensation;\n#endif\nlet mid=(cov2d[0][0]+cov2d[1][1])/2.0;let radius=length(vec2((cov2d[0][0]-cov2d[1][1])/2.0,cov2d[0][1]));let lambda1=mid+radius;let lambda2=mid-radius;if (lambda2<0.0) {return vec4f(0.0,0.0,2.0,1.0);}\nlet diagonalVector=normalize(vec2(cov2d[0][1],lambda1-cov2d[0][0]));let majorAxis=min(sqrt(2.0*lambda1),1024.0)*diagonalVector;let minorAxis=min(sqrt(2.0*lambda2),1024.0)*vec2(diagonalVector.y,-diagonalVector.x);let vCenter=vec2(pos2d.x,pos2d.y);let scaleFactor=select(pos2d.w,1.0,isOrtho);return vec4f(\nvCenter+((meshPos.x*majorAxis+meshPos.y*minorAxis)*invViewport*scaleFactor)*scale,\npos2d.z,\npos2d.w\n);}")},68351:(e,t,n)=>{n.r(t),n.d(t,{greasedLineVertexShader:()=>a});var r=n(98519),i=(n(38615),n(35397),"greasedLineVertexShader"),o="precision highp float;\n#include\nattribute float grl_widths;attribute vec3 grl_offsets;attribute float grl_colorPointers;attribute vec3 position;uniform mat4 viewProjection;uniform mat4 projection;varying float grlCounters;varying float grlColorPointer;\n#ifdef GREASED_LINE_CAMERA_FACING\nattribute vec4 grl_nextAndCounters;attribute vec4 grl_previousAndSide;uniform vec2 grlResolution;uniform float grlAspect;uniform float grlWidth;uniform float grlSizeAttenuation;vec2 grlFix( vec4 i,float aspect ) {vec2 res=i.xy/i.w;res.x*=aspect;return res;}\n#else\nattribute vec3 grl_slopes;attribute float grl_counters;\n#endif\nvoid main() {\n#include\ngrlColorPointer=grl_colorPointers;mat4 grlMatrix=viewProjection*finalWorld ;\n#ifdef GREASED_LINE_CAMERA_FACING\nfloat grlBaseWidth=grlWidth;vec3 grlPrevious=grl_previousAndSide.xyz;float grlSide=grl_previousAndSide.w;vec3 grlNext=grl_nextAndCounters.xyz;grlCounters=grl_nextAndCounters.w;float grlWidth=grlBaseWidth*grl_widths;vec3 positionUpdated=position+grl_offsets;vec3 worldDir=normalize(grlNext-grlPrevious);vec3 nearPosition=positionUpdated+(worldDir*0.01);vec4 grlFinalPosition=grlMatrix*vec4( positionUpdated ,1.0);vec4 screenNearPos=grlMatrix*vec4(nearPosition,1.0);vec2 grlLinePosition=grlFix(grlFinalPosition,grlAspect);vec2 grlLineNearPosition=grlFix(screenNearPos,grlAspect);vec2 grlDir=normalize(grlLineNearPosition-grlLinePosition);vec4 grlNormal=vec4( -grlDir.y,grlDir.x,0.,1. );\n#ifdef GREASED_LINE_RIGHT_HANDED_COORDINATE_SYSTEM\ngrlNormal.xy*=-.5*grlWidth;\n#else\ngrlNormal.xy*=.5*grlWidth;\n#endif\ngrlNormal*=projection;if (grlSizeAttenuation==1.) {grlNormal.xy*=grlFinalPosition.w;grlNormal.xy/=( vec4( grlResolution,0.,1. )*projection ).xy;}\ngrlFinalPosition.xy+=grlNormal.xy*grlSide;gl_Position=grlFinalPosition;\n#else\ngrlCounters=grl_counters;vec4 grlFinalPosition=grlMatrix*vec4( (position+grl_offsets)+grl_slopes*grl_widths ,1.0 ) ;gl_Position=grlFinalPosition;\n#endif\n}\n";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},68442:(e,t,n)=>{n.r(t),n.d(t,{glowBlurPostProcessPixelShaderWGSL:()=>a});var r=n(98519),i="glowBlurPostProcessPixelShader",o="varying vUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d;uniform screenSize: vec2f;uniform direction: vec2f;uniform blurWidth: f32;fn getLuminance(color: vec3f)->f32\n{return dot(color, vec3f(0.2126,0.7152,0.0722));}\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var weights: array;weights[0]=0.05;weights[1]=0.1;weights[2]=0.2;weights[3]=0.3;weights[4]=0.2;weights[5]=0.1;weights[6]=0.05;var texelSize: vec2f= vec2f(1.0/uniforms.screenSize.x,1.0/uniforms.screenSize.y);var texelStep: vec2f=texelSize*uniforms.direction*uniforms.blurWidth;var start: vec2f=input.vUV-3.0*texelStep;var baseColor: vec4f= vec4f(0.,0.,0.,0.);var texelOffset: vec2f= vec2f(0.,0.);for (var i: i32=0; i<7; i++)\n{var texel: vec4f=textureSample(textureSampler,textureSamplerSampler,start+texelOffset);baseColor=vec4f(baseColor.rgb,baseColor.a+texel.a*weights[i]);var luminance: f32=getLuminance(baseColor.rgb);var luminanceTexel: f32=getLuminance(texel.rgb);var choice: f32=step(luminanceTexel,luminance);baseColor=vec4f(choice*baseColor.rgb+(1.0-choice)*texel.rgb,baseColor.a);texelOffset+=texelStep;}\nfragmentOutputs.color=baseColor;}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},68478:(e,t,n)=>{n.r(t),n.d(t,{morphTargetsVertexDeclarationWGSL:()=>a});var r=n(98519),i="morphTargetsVertexDeclaration",o="#ifdef MORPHTARGETS\n#ifndef MORPHTARGETS_TEXTURE\n#ifdef MORPHTARGETS_POSITION\nattribute position{X} : vec3;\n#endif\n#ifdef MORPHTARGETS_NORMAL\nattribute normal{X} : vec3;\n#endif\n#ifdef MORPHTARGETS_TANGENT\nattribute tangent{X} : vec3;\n#endif\n#ifdef MORPHTARGETS_UV\nattribute uv_{X} : vec2;\n#endif\n#ifdef MORPHTARGETS_UV2\nattribute uv2_{X} : vec2;\n#endif\n#ifdef MORPHTARGETS_COLOR\nattribute color{X} : vec4;\n#endif\n#elif {X}==0\nuniform morphTargetCount: f32;\n#endif\n#endif\n";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]=o);var a={name:i,shader:o}},68805:(e,t,n)=>{n.r(t),n.d(t,{imageProcessingPixelShaderWGSL:()=>a});var r=n(98519),i=(n(86320),n(17393),n(4661),"imageProcessingPixelShader"),o="varying vUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d;\n#include\n#include\n#include\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var result: vec4f=textureSample(textureSampler,textureSamplerSampler,input.vUV);result=vec4f(max(result.rgb,vec3f(0.)),result.a);\n#ifdef IMAGEPROCESSING\n#ifndef FROMLINEARSPACE\nresult=vec4f(toLinearSpaceVec3(result.rgb),result.a);\n#endif\nresult=applyImageProcessing(result);\n#else\n#ifdef FROMLINEARSPACE\nresult=applyImageProcessing(result);\n#endif\n#endif\nfragmentOutputs.color=result;}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},68927:(e,t,n)=>{n.r(t),n.d(t,{_WebAudioSoundSource:()=>c});var r=n(78322),i=n(6115),o=n(27063),a=n(82145),s=n(85182),l=n(63982),c=function(e){function t(n,r,i,o){var a=e.call(this,n,i)||this;return a._spatial=null,a._spatialAutoUpdate=!0,a._spatialMinUpdateTime=0,a._stereo=null,"boolean"==typeof o.spatialAutoUpdate&&(a._spatialAutoUpdate=o.spatialAutoUpdate),"number"==typeof o.spatialMinUpdateTime&&(a._spatialMinUpdateTime=o.spatialMinUpdateTime),a._audioContext=a.engine._audioContext,a._webAudioNode=r,a._subGraph=new t._SubGraph(a),a}return(0,r.C6)(t,e),t.prototype._initAsync=function(e){return(0,r.sH)(this,void 0,void 0,(function(){return(0,r.YH)(this,(function(t){switch(t.label){case 0:return e.outBus?(this.outBus=e.outBus,[3,3]):[3,1];case 1:return!1===e.outBusAutoDefault?[3,3]:[4,this.engine.isReadyPromise];case 2:t.sent(),this.outBus=this.engine.defaultMainBus,t.label=3;case 3:return[4,this._subGraph.initAsync(e)];case 4:return t.sent(),(0,o.GB)(e)&&this._initSpatialProperty(),this.engine._addNode(this),[2]}}))}))},Object.defineProperty(t.prototype,"_inNode",{get:function(){return this._webAudioNode},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_outNode",{get:function(){return this._subGraph._outNode},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"spatial",{get:function(){return this._spatial?this._spatial:this._initSpatialProperty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stereo",{get:function(){var e;return null!==(e=this._stereo)&&void 0!==e?e:this._stereo=new a.i(this._subGraph)},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){var t;e.prototype.dispose.call(this),null===(t=this._spatial)||void 0===t||t.dispose(),this._spatial=null,this._stereo=null,this._subGraph.dispose(),this.engine._removeNode(this)},t.prototype.getClassName=function(){return"_WebAudioSoundSource"},t.prototype._connect=function(t){var n;return!!e.prototype._connect.call(this,t)&&(t._inNode&&(null===(n=this._outNode)||void 0===n||n.connect(t._inNode)),!0)},t.prototype._disconnect=function(t){var n;return!!e.prototype._disconnect.call(this,t)&&(t._inNode&&(null===(n=this._outNode)||void 0===n||n.disconnect(t._inNode)),!0)},t.prototype._initSpatialProperty=function(){return this._spatial||(this._spatial=new l.i(this._subGraph,this._spatialAutoUpdate,this._spatialMinUpdateTime)),this._spatial},t._SubGraph=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,r.C6)(t,e),Object.defineProperty(t.prototype,"_downstreamNodes",{get:function(){var e;return null!==(e=this._owner._downstreamNodes)&&void 0!==e?e:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_upstreamNodes",{get:function(){var e;return null!==(e=this._owner._upstreamNodes)&&void 0!==e?e:null},enumerable:!1,configurable:!0}),t.prototype._onSubNodesChanged=function(){e.prototype._onSubNodesChanged.call(this),this._owner._inNode.disconnect(),this._owner._subGraph._inNode&&this._owner._inNode.connect(this._owner._subGraph._inNode)},t}(s.Q),t}(i.L)},69137:(e,t,n)=>{var r=n(98519),i="ltcHelperFunctions";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="vec2 LTCUv( const in vec3 N,const in vec3 V,const in float roughness ) {const float LUTSIZE=64.0;const float LUTSCALE=( LUTSIZE-1.0 )/LUTSIZE;const float LUTBIAS=0.5/LUTSIZE;float dotNV=saturate( dot( N,V ) );vec2 uv=vec2( roughness,sqrt( 1.0-dotNV ) );uv=uv*LUTSCALE+LUTBIAS;return uv;}\nfloat LTCClippedSphereFormFactor( const in vec3 f ) {float l=length( f );return max( ( l*l+f.z )/( l+1.0 ),0.0 );}\nvec3 LTCEdgeVectorFormFactor( const in vec3 v1,const in vec3 v2 ) {float x=dot( v1,v2 );float y=abs( x );float a=0.8543985+( 0.4965155+0.0145206*y )*y;float b=3.4175940+( 4.1616724+y )*y;float v=a/b;float thetaSintheta=0.0;if( x>0.0 )\n{thetaSintheta=v;}\nelse\n{thetaSintheta=0.5*inversesqrt( max( 1.0-x*x,1e-7 ) )-v;}\nreturn cross( v1,v2 )*thetaSintheta;}\nvec3 LTCEvaluate( const in vec3 N,const in vec3 V,const in vec3 P,const in mat3 mInv,const in vec3 rectCoords[ 4 ] ) {vec3 v1=rectCoords[ 1 ]-rectCoords[ 0 ];vec3 v2=rectCoords[ 3 ]-rectCoords[ 0 ];vec3 lightNormal=cross( v1,v2 );if( dot( lightNormal,P-rectCoords[ 0 ] )<0.0 ) return vec3( 0.0 );vec3 T1,T2;T1=normalize( V-N*dot( V,N ) );T2=- cross( N,T1 ); \nmat3 mat=mInv*transposeMat3( mat3( T1,T2,N ) );vec3 coords[ 4 ];coords[ 0 ]=mat*( rectCoords[ 0 ]-P );coords[ 1 ]=mat*( rectCoords[ 1 ]-P );coords[ 2 ]=mat*( rectCoords[ 2 ]-P );coords[ 3 ]=mat*( rectCoords[ 3 ]-P );coords[ 0 ]=normalize( coords[ 0 ] );coords[ 1 ]=normalize( coords[ 1 ] );coords[ 2 ]=normalize( coords[ 2 ] );coords[ 3 ]=normalize( coords[ 3 ] );vec3 vectorFormFactor=vec3( 0.0 );vectorFormFactor+=LTCEdgeVectorFormFactor( coords[ 0 ],coords[ 1 ] );vectorFormFactor+=LTCEdgeVectorFormFactor( coords[ 1 ],coords[ 2 ] );vectorFormFactor+=LTCEdgeVectorFormFactor( coords[ 2 ],coords[ 3 ] );vectorFormFactor+=LTCEdgeVectorFormFactor( coords[ 3 ],coords[ 0 ] );float result=LTCClippedSphereFormFactor( vectorFormFactor );return vec3( result );}\nstruct areaLightData\n{vec3 Diffuse;vec3 Specular;vec4 Fresnel;};\n#define inline\nareaLightData computeAreaLightSpecularDiffuseFresnel(const in sampler2D ltc1,const in sampler2D ltc2,const in vec3 viewDir,const in vec3 normal,const in vec3 position,const in vec3 lightPos,const in vec3 halfWidth,const in vec3 halfHeight,const in float roughness) \n{areaLightData result;vec3 rectCoords[ 4 ];rectCoords[ 0 ]=lightPos+halfWidth-halfHeight; \nrectCoords[ 1 ]=lightPos-halfWidth-halfHeight;rectCoords[ 2 ]=lightPos-halfWidth+halfHeight;rectCoords[ 3 ]=lightPos+halfWidth+halfHeight;\n#ifdef SPECULARTERM\nvec2 uv=LTCUv( normal,viewDir,roughness );vec4 t1=texture2D( ltc1,uv );vec4 t2=texture2D( ltc2,uv );mat3 mInv=mat3(\nvec3( t1.x,0,t1.y ),\nvec3( 0,1, 0 ),\nvec3( t1.z,0,t1.w )\n);result.Specular=LTCEvaluate( normal,viewDir,position,mInv,rectCoords );result.Fresnel=t2;\n#endif\nresult.Diffuse=LTCEvaluate( normal,viewDir,position,mat3( 1.0 ),rectCoords );return result;}")},69329:(e,t,n)=>{n.d(t,{i:()=>i});var r=n(81152),i=function(){function e(e){this._supportBlendParametersPerTarget=e,this._blendFunctionParameters=new Array(32),this._blendEquationParameters=new Array(16),this._blendConstants=new Array(4),this._isBlendConstantsDirty=!1,this._alphaBlend=Array(8).fill(!1),this._numTargetEnabled=0,this._isAlphaBlendDirty=!1,this._isBlendFunctionParametersDirty=!1,this._isBlendEquationParametersDirty=!1,this.reset()}return Object.defineProperty(e.prototype,"isDirty",{get:function(){return this._isAlphaBlendDirty||this._isBlendFunctionParametersDirty||this._isBlendEquationParametersDirty},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alphaBlend",{get:function(){return this._numTargetEnabled>0},enumerable:!1,configurable:!0}),e.prototype.setAlphaBlend=function(e,t){void 0===t&&(t=0),this._alphaBlend[t]!==e&&(e?this._numTargetEnabled++:this._numTargetEnabled--,this._alphaBlend[t]=e,this._isAlphaBlendDirty=!0)},e.prototype.setAlphaBlendConstants=function(e,t,n,r){this._blendConstants[0]===e&&this._blendConstants[1]===t&&this._blendConstants[2]===n&&this._blendConstants[3]===r||(this._blendConstants[0]=e,this._blendConstants[1]=t,this._blendConstants[2]=n,this._blendConstants[3]=r,this._isBlendConstantsDirty=!0)},e.prototype.setAlphaBlendFunctionParameters=function(e,t,n,r,i){void 0===i&&(i=0);var o=4*i;this._blendFunctionParameters[o+0]===e&&this._blendFunctionParameters[o+1]===t&&this._blendFunctionParameters[o+2]===n&&this._blendFunctionParameters[o+3]===r||(this._blendFunctionParameters[o+0]=e,this._blendFunctionParameters[o+1]=t,this._blendFunctionParameters[o+2]=n,this._blendFunctionParameters[o+3]=r,this._isBlendFunctionParametersDirty=!0)},e.prototype.setAlphaEquationParameters=function(e,t,n){void 0===n&&(n=0);var r=2*n;this._blendEquationParameters[r+0]===e&&this._blendEquationParameters[r+1]===t||(this._blendEquationParameters[r+0]=e,this._blendEquationParameters[r+1]=t,this._isBlendEquationParametersDirty=!0)},e.prototype.reset=function(){this._alphaBlend.fill(!1),this._numTargetEnabled=0,this._blendFunctionParameters.fill(null),this._blendEquationParameters.fill(null),this._blendConstants[0]=null,this._blendConstants[1]=null,this._blendConstants[2]=null,this._blendConstants[3]=null,this._isAlphaBlendDirty=!0,this._isBlendFunctionParametersDirty=!1,this._isBlendEquationParametersDirty=!1,this._isBlendConstantsDirty=!1},e.prototype.apply=function(e,t){if(void 0===t&&(t=1),this.isDirty){if(this._isBlendConstantsDirty&&(e.blendColor(this._blendConstants[0],this._blendConstants[1],this._blendConstants[2],this._blendConstants[3]),this._isBlendConstantsDirty=!1),1===t||!this._supportBlendParametersPerTarget)return this._isAlphaBlendDirty&&(this._alphaBlend[0]?e.enable(e.BLEND):e.disable(e.BLEND),this._isAlphaBlendDirty=!1),this._isBlendFunctionParametersDirty&&(e.blendFuncSeparate(this._blendFunctionParameters[0],this._blendFunctionParameters[1],this._blendFunctionParameters[2],this._blendFunctionParameters[3]),this._isBlendFunctionParametersDirty=!1),void(this._isBlendEquationParametersDirty&&(e.blendEquationSeparate(this._blendEquationParameters[0],this._blendEquationParameters[1]),this._isBlendEquationParametersDirty=!1));var n=e;if(this._isAlphaBlendDirty){for(var r=0;r{n.r(t),n.d(t,{meshUVSpaceRendererPixelShader:()=>a});var r=n(98519),i="meshUVSpaceRendererPixelShader",o="precision highp float;varying vec2 vDecalTC;uniform sampler2D textureSampler;void main(void) {if (vDecalTC.x<0. || vDecalTC.x>1. || vDecalTC.y<0. || vDecalTC.y>1.) {discard;}\ngl_FragColor=texture2D(textureSampler,vDecalTC);}\n";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},69512:(e,t,n)=>{n.r(t),n.d(t,{colorVertexShaderWGSL:()=>a});var r=n(98519),i=(n(45699),n(27279),n(9436),n(79716),n(63866),n(21310),n(3641),n(86615),n(63002),n(70898),n(50615),"colorVertexShader"),o="attribute position: vec3f;\n#ifdef VERTEXCOLOR\nattribute color: vec4f;\n#endif\n#include\n#include\n#include\n#include\n#ifdef FOG\nuniform view: mat4x4f;\n#endif\n#include\nuniform viewProjection: mat4x4f;\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vColor: vec4f;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef VERTEXCOLOR\nvar colorUpdated: vec4f=vertexInputs.color;\n#endif\n#include\n#include\n#include\nvar worldPos: vec4f=finalWorld* vec4f(input.position,1.0);vertexOutputs.position=uniforms.viewProjection*worldPos;\n#include\n#include\n#include\n#define CUSTOM_VERTEX_MAIN_END\n}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},69565:(e,t,n)=>{var r=n(82673),i=n(81152);n(92142),r.$.prototype.getInputElement=function(){return this._renderingCanvas},r.$.prototype.getDepthFunction=function(){return this._depthCullingState.depthFunc},r.$.prototype.setDepthFunction=function(e){this._depthCullingState.depthFunc=e},r.$.prototype.setDepthFunctionToGreater=function(){this.setDepthFunction(i.Y.GREATER)},r.$.prototype.setDepthFunctionToGreaterOrEqual=function(){this.setDepthFunction(i.Y.GEQUAL)},r.$.prototype.setDepthFunctionToLess=function(){this.setDepthFunction(i.Y.LESS)},r.$.prototype.setDepthFunctionToLessOrEqual=function(){this.setDepthFunction(i.Y.LEQUAL)},r.$.prototype.getDepthWrite=function(){return this._depthCullingState.depthMask},r.$.prototype.setDepthWrite=function(e){this._depthCullingState.depthMask=e},r.$.prototype.setAlphaConstants=function(e,t,n,r){this._alphaState.setAlphaBlendConstants(e,t,n,r)},r.$.prototype.getAlphaMode=function(e){return void 0===e&&(e=0),this._alphaMode[e]},r.$.prototype.getAlphaEquation=function(e){return void 0===e&&(e=0),this._alphaEquation[e]}},69806:(e,t,n)=>{var r=n(82673);r.$.prototype.getInputElement=function(){return this._renderingCanvas},r.$.prototype.getRenderingCanvasClientRect=function(){return this._renderingCanvas?this._renderingCanvas.getBoundingClientRect():null},r.$.prototype.getInputElementClientRect=function(){return this._renderingCanvas?this.getInputElement().getBoundingClientRect():null},r.$.prototype.getAspectRatio=function(e,t){void 0===t&&(t=!1);var n=e.viewport;return this.getRenderWidth(t)*n.width/(this.getRenderHeight(t)*n.height)},r.$.prototype.getScreenAspectRatio=function(){return this.getRenderWidth(!0)/this.getRenderHeight(!0)},r.$.prototype._verifyPointerLock=function(){var e;null===(e=this._onPointerLockChange)||void 0===e||e.call(this)}},70051:(e,t,n)=>{n.r(t),n.d(t,{copyTextureToTexturePixelShaderWGSL:()=>a});var r=n(98519),i=(n(17393),"copyTextureToTexturePixelShader"),o="uniform conversion: f32;\n#ifndef NO_SAMPLER\nvar textureSamplerSampler: sampler;\n#endif\nvar textureSampler: texture_2d;varying vUV: vec2f;\n#include\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#ifdef NO_SAMPLER\nvar color: vec4f=textureLoad(textureSampler,vec2u(fragmentInputs.position.xy),0);\n#else\nvar color: vec4f=textureSample(textureSampler,textureSamplerSampler,input.vUV);\n#endif\n#ifdef DEPTH_TEXTURE\nfragmentOutputs.fragDepth=color.r;\n#else\nif (uniforms.conversion==1.) {color=toLinearSpaceVec4(color);} else if (uniforms.conversion==2.) {color=toGammaSpace(color);}\nfragmentOutputs.color=color;\n#endif\n}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},70154:(e,t,n)=>{n.r(t),n.d(t,{motionBlurPixelShaderWGSL:()=>a});var r=n(98519),i="motionBlurPixelShader",o="varying vUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d;uniform motionStrength: f32;uniform motionScale: f32;uniform screenSize: vec2f;\n#ifdef OBJECT_BASED\nvar velocitySamplerSampler: sampler;var velocitySampler: texture_2d;\n#else\nvar depthSamplerSampler: sampler;var depthSampler: texture_2d;uniform inverseViewProjection: mat4x4f;uniform prevViewProjection: mat4x4f;uniform projection: mat4x4f;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#ifdef GEOMETRY_SUPPORTED\n#ifdef OBJECT_BASED\nvar texelSize: vec2f=1.0/uniforms.screenSize;var velocityColor: vec4f=textureSampleLevel(velocitySampler,velocitySamplerSampler,input.vUV,0.0);velocityColor=vec4f(velocityColor.rg*2.0- vec2f(1.0),velocityColor.b,velocityColor.a);let signs=sign(velocityColor.rg);var velocity=pow(abs(velocityColor.rg),vec2f(3.0))*signs*velocityColor.a;velocity*=uniforms.motionScale*uniforms.motionStrength;var speed: f32=length(velocity/texelSize);var samplesCount: i32= i32(clamp(speed,1.0,SAMPLES));velocity=normalize(velocity)*texelSize;var hlim: f32= f32(-samplesCount)*0.5+0.5;var result: vec4f=textureSampleLevel(textureSampler,textureSamplerSampler, input.vUV,0.0);for (var i: i32=1; i< i32(SAMPLES); i++)\n{if (i>=samplesCount) {break;}\nvar offset: vec2f=input.vUV+velocity*(hlim+ f32(i));result+=textureSampleLevel(textureSampler,textureSamplerSampler, offset,0.0);}\nfragmentOutputs.color=vec4f(result.rgb/ f32(samplesCount),1.0);\n#else\nvar result: vec4f=textureSampleLevel(textureSampler,textureSamplerSampler, input.vUV,0.0);var texelSize: vec2f=1.0/uniforms.screenSize;var depth: f32=textureSampleLevel(depthSampler,depthSamplerSampler,input.vUV,0.0).r;if (depth==0.0) {fragmentOutputs.color=result;return fragmentOutputs;}\ndepth=uniforms.projection[2].z+uniforms.projection[3].z/depth; \nvar cpos: vec4f= vec4f(input.vUV*2.0-1.0,depth,1.0);cpos=uniforms.inverseViewProjection*cpos;cpos/=cpos.w;var ppos: vec4f=uniforms.prevViewProjection*cpos;ppos/=ppos.w;ppos=vec4f(ppos.xy*0.5+0.5,ppos.zw);var velocity: vec2f=(ppos.xy-input.vUV)*uniforms.motionScale*uniforms.motionStrength;var speed: f32=length(velocity/texelSize);var nSamples: i32= i32(clamp(speed,1.0,SAMPLES));for (var i: i32=1; i< i32(SAMPLES); i++) {if (i>=nSamples) {break;}\nvar offset1: vec2f=input.vUV+velocity*( f32(i)/ f32(nSamples-1)-0.5);result+=textureSampleLevel(textureSampler,textureSamplerSampler, offset1,0.0);}\nfragmentOutputs.color=result/ f32(nSamples);\n#endif\n#else\nfragmentOutputs.color=textureSample(textureSampler,textureSamplerSampler, input.vUV);\n#endif\n}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},70160:(e,t,n)=>{n.d(t,{h:()=>r});var r=function(){function e(){}return e._IsPickingAvailable=!1,e}()},70183:(e,t,n)=>{n.r(t),n.d(t,{fluidRenderingParticleDiffusePixelShaderWGSL:()=>a});var r=n(98519),i="fluidRenderingParticleDiffusePixelShader",o="uniform particleAlpha: f32;varying uv: vec2f;varying diffuseColor: vec3f;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var normalxy: vec2f=input.uv*2.0-1.0;var r2: f32=dot(normalxy,normalxy);if (r2>1.0) {discard;}\nfragmentOutputs.color=vec4f(input.diffuseColor,1.0);}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},70511:(e,t,n)=>{n.d(t,{A:()=>i});var r=n(85258),i=function(){function e(){this._startMonitoringTime=0,this._min=0,this._max=0,this._average=0,this._lastSecAverage=0,this._current=0,this._totalValueCount=0,this._totalAccumulated=0,this._lastSecAccumulated=0,this._lastSecTime=0,this._lastSecValueCount=0}return Object.defineProperty(e.prototype,"min",{get:function(){return this._min},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"max",{get:function(){return this._max},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"average",{get:function(){return this._average},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastSecAverage",{get:function(){return this._lastSecAverage},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"current",{get:function(){return this._current},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"total",{get:function(){return this._totalAccumulated},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"count",{get:function(){return this._totalValueCount},enumerable:!1,configurable:!0}),e.prototype.fetchNewFrame=function(){this._totalValueCount++,this._current=0,this._lastSecValueCount++},e.prototype.addCount=function(t,n){e.Enabled&&(this._current+=t,n&&this._fetchResult())},e.prototype.beginMonitoring=function(){e.Enabled&&(this._startMonitoringTime=r.j.Now)},e.prototype.endMonitoring=function(t){if(void 0===t&&(t=!0),e.Enabled){t&&this.fetchNewFrame();var n=r.j.Now;this._current=n-this._startMonitoringTime,t&&this._fetchResult()}},e.prototype.endFrame=function(){this._fetchResult()},e.prototype._fetchResult=function(){this._totalAccumulated+=this._current,this._lastSecAccumulated+=this._current,this._min=Math.min(this._min,this._current),this._max=Math.max(this._max,this._current),this._average=this._totalAccumulated/this._totalValueCount;var e=r.j.Now;e-this._lastSecTime>1e3&&(this._lastSecAverage=this._lastSecAccumulated/this._lastSecValueCount,this._lastSecTime=e,this._lastSecAccumulated=0,this._lastSecValueCount=0)},e.Enabled=!0,e}()},70898:(e,t,n)=>{var r=n(98519),i="fogVertex";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="#ifdef FOG\n#ifdef SCENE_UBO\nvertexOutputs.vFogDistance=(scene.view*worldPos).xyz;\n#else\nvertexOutputs.vFogDistance=(uniforms.view*worldPos).xyz;\n#endif\n#endif\n")},71050:(e,t,n)=>{n.r(t),n.d(t,{screenSpaceCurvaturePixelShaderWGSL:()=>a});var r=n(98519),i="screenSpaceCurvaturePixelShader",o="varying vUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d;var normalSampler: texture_2d;uniform curvature_ridge: f32;uniform curvature_valley: f32;\n#ifndef CURVATURE_OFFSET\n#define CURVATURE_OFFSET 1\n#endif\nfn curvature_soft_clamp(curvature: f32,control: f32)->f32\n{if (curvature<0.5/control) {return curvature*(1.0-curvature*control);}\nreturn 0.25/control;}\nfn calculate_curvature(texel: vec2i,ridge: f32,valley: f32)->f32\n{let normal_up =textureLoad(normalSampler,texel+vec2i(0, CURVATURE_OFFSET),0).rb;let normal_down =textureLoad(normalSampler,texel+vec2i(0,-CURVATURE_OFFSET),0).rb;let normal_left =textureLoad(normalSampler,texel+vec2i(-CURVATURE_OFFSET,0),0).rb;let normal_right=textureLoad(normalSampler,texel+vec2i( CURVATURE_OFFSET,0),0).rb;let normal_diff=((normal_up.g-normal_down.g)+(normal_right.r-normal_left.r));if (normal_diff<0.0) {return -2.0*curvature_soft_clamp(-normal_diff,valley);}\nreturn 2.0*curvature_soft_clamp(normal_diff,ridge);}\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs\n{let texel=vec2i(fragmentInputs.position.xy);let baseColor=textureSample(textureSampler,textureSamplerSampler,fragmentInputs.vUV);let curvature=calculate_curvature(texel,uniforms.curvature_ridge,uniforms.curvature_valley);fragmentOutputs.color=vec4f(baseColor.rgb*(curvature+1.0),baseColor.a);}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},71073:(e,t,n)=>{var r=n(78322),i=n(19133),o=n(7164),a=n(44256),s=n(81152),l=n(96925),c=n(3429),u=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;return a._framebuffer=null,a._depthStencilBuffer=null,a._MSAAFramebuffer=null,a._colorTextureArray=null,a._depthStencilTextureArray=null,a._disposeOnlyFramebuffers=!1,a._currentLOD=0,a._context=o,a}return(0,r.C6)(t,e),t.prototype.setDepthStencilTexture=function(t,n){if(void 0===n&&(n=!0),e.prototype.setDepthStencilTexture.call(this,t,n),t){var r=this._engine,i=this._context,o=t._hardwareTexture;if(o&&t._autoMSAAManagement&&this._MSAAFramebuffer){var a=r._currentFramebuffer;r._bindUnboundFramebuffer(this._MSAAFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,(0,c.$l)(t.format)?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,i.RENDERBUFFER,o.getMSAARenderBuffer()),r._bindUnboundFramebuffer(a)}}},t.prototype._cloneRenderTargetWrapper=function(){var t=null;return this._colorTextureArray&&this._depthStencilTextureArray?(t=this._engine.createMultiviewRenderTargetTexture(this.width,this.height)).texture.isReady=!0:t=e.prototype._cloneRenderTargetWrapper.call(this),t},t.prototype._swapRenderTargetWrapper=function(t){e.prototype._swapRenderTargetWrapper.call(this,t),t._framebuffer=this._framebuffer,t._depthStencilBuffer=this._depthStencilBuffer,t._MSAAFramebuffer=this._MSAAFramebuffer,t._colorTextureArray=this._colorTextureArray,t._depthStencilTextureArray=this._depthStencilTextureArray,this._framebuffer=this._depthStencilBuffer=this._MSAAFramebuffer=this._colorTextureArray=this._depthStencilTextureArray=null},t.prototype.createDepthStencilTexture=function(t,n,r,i,o,a){if(void 0===t&&(t=0),void 0===n&&(n=!0),void 0===r&&(r=!1),void 0===i&&(i=1),void 0===o&&(o=s.Y.TEXTUREFORMAT_DEPTH32_FLOAT),this._depthStencilBuffer){var l=this._engine,c=l._currentFramebuffer,u=this._context;l._bindUnboundFramebuffer(this._framebuffer),u.framebufferRenderbuffer(u.FRAMEBUFFER,u.DEPTH_STENCIL_ATTACHMENT,u.RENDERBUFFER,null),u.framebufferRenderbuffer(u.FRAMEBUFFER,u.DEPTH_ATTACHMENT,u.RENDERBUFFER,null),u.framebufferRenderbuffer(u.FRAMEBUFFER,u.STENCIL_ATTACHMENT,u.RENDERBUFFER,null),l._bindUnboundFramebuffer(c),u.deleteRenderbuffer(this._depthStencilBuffer),this._depthStencilBuffer=null}return e.prototype.createDepthStencilTexture.call(this,t,n,r,i,o,a)},t.prototype.shareDepth=function(t){e.prototype.shareDepth.call(this,t);var n=this._context,r=this._depthStencilBuffer,i=t._MSAAFramebuffer||t._framebuffer,o=this._engine;t._depthStencilBuffer&&t._depthStencilBuffer!==r&&n.deleteRenderbuffer(t._depthStencilBuffer),t._depthStencilBuffer=r;var a=t._generateStencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;o._bindUnboundFramebuffer(i),n.framebufferRenderbuffer(n.FRAMEBUFFER,a,n.RENDERBUFFER,r),o._bindUnboundFramebuffer(null)},t.prototype._bindTextureRenderTarget=function(e,t,n,r){var i,o,a,s;void 0===t&&(t=0),void 0===r&&(r=0);var l=e._hardwareTexture;if(l){var c,u=this._framebuffer,h=this._engine,d=h._currentFramebuffer;if(h._bindUnboundFramebuffer(u),h.webGLVersion>1)c=(f=this._context)["COLOR_ATTACHMENT"+t],e.is2DArray||e.is3D?(n=null!==(o=null!=n?n:null===(i=this.layerIndices)||void 0===i?void 0:i[t])&&void 0!==o?o:0,f.framebufferTextureLayer(f.FRAMEBUFFER,c,l.underlyingResource,r,n)):e.isCube?(n=null!==(s=null!=n?n:null===(a=this.faceIndices)||void 0===a?void 0:a[t])&&void 0!==s?s:0,f.framebufferTexture2D(f.FRAMEBUFFER,c,f.TEXTURE_CUBE_MAP_POSITIVE_X+n,l.underlyingResource,r)):f.framebufferTexture2D(f.FRAMEBUFFER,c,f.TEXTURE_2D,l.underlyingResource,r);else{c=(f=this._context)["COLOR_ATTACHMENT"+t+"_WEBGL"];var p=void 0!==n?f.TEXTURE_CUBE_MAP_POSITIVE_X+n:f.TEXTURE_2D;f.framebufferTexture2D(f.FRAMEBUFFER,c,p,l.underlyingResource,r)}if(e._autoMSAAManagement&&this._MSAAFramebuffer){var f=this._context;h._bindUnboundFramebuffer(this._MSAAFramebuffer),f.framebufferRenderbuffer(f.FRAMEBUFFER,c,f.RENDERBUFFER,l.getMSAARenderBuffer())}h._bindUnboundFramebuffer(d)}},t.prototype.setTexture=function(t,n,r){void 0===n&&(n=0),void 0===r&&(r=!0),e.prototype.setTexture.call(this,t,n,r),this._bindTextureRenderTarget(t,n)},t.prototype.setLayerAndFaceIndices=function(t,n){var r,i;if(e.prototype.setLayerAndFaceIndices.call(this,t,n),this.textures&&this.layerIndices&&this.faceIndices)for(var o=null!==(i=null===(r=this._attachments)||void 0===r?void 0:r.length)&&void 0!==i?i:this.textures.length,a=0;a1){var g=l._hardwareTexture.getMSAARenderBuffer(0);i._MSAAFramebuffer=m.createFramebuffer(),this._bindUnboundFramebuffer(i._MSAAFramebuffer),m.framebufferRenderbuffer(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,m.RENDERBUFFER,g),this._bindUnboundFramebuffer(null)}}else this.updateRenderTargetTextureSampleCount(i,c);return i},a.ThinEngine.prototype._createDepthStencilTexture=function(e,t,n){var a,l=this._gl,u=e.layers||0,h=e.depth||0,d=l.TEXTURE_2D;0!==u?d=l.TEXTURE_2D_ARRAY:0!==h&&(d=l.TEXTURE_3D);var p=new i.h(this,12);if(p.label=t.label,!this._caps.depthTextureExtension)return o.V.Error("Depth texture is not supported by your browser or hardware."),p;var f=(0,r.Cl)({bilinearFiltering:!1,comparisonFunction:0,generateStencil:!1},t);if(this._bindTextureDirectly(d,p,!0),this._setupDepthStencilTexture(p,e,0!==f.comparisonFunction&&f.bilinearFiltering,f.comparisonFunction,f.samples),void 0!==f.depthTextureFormat){if(f.depthTextureFormat!==s.Y.TEXTUREFORMAT_DEPTH16&&f.depthTextureFormat!==s.Y.TEXTUREFORMAT_DEPTH24&&f.depthTextureFormat!==s.Y.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8&&f.depthTextureFormat!==s.Y.TEXTUREFORMAT_DEPTH24_STENCIL8&&f.depthTextureFormat!==s.Y.TEXTUREFORMAT_DEPTH32_FLOAT&&f.depthTextureFormat!==s.Y.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8)return o.V.Error("Depth texture ".concat(f.depthTextureFormat," format is not supported.")),p;p.format=f.depthTextureFormat}else p.format=f.generateStencil?s.Y.TEXTUREFORMAT_DEPTH24_STENCIL8:s.Y.TEXTUREFORMAT_DEPTH24;var m=(0,c.$l)(p.format),_=this._getWebGLTextureTypeFromDepthTextureFormat(p.format),g=m?l.DEPTH_STENCIL:l.DEPTH_COMPONENT,v=this._getInternalFormatFromDepthTextureFormat(p.format,!0,m);return p.is2DArray?l.texImage3D(d,0,v,p.width,p.height,u,0,g,_,null):p.is3D?l.texImage3D(d,0,v,p.width,p.height,h,0,g,_,null):l.texImage2D(d,0,v,p.width,p.height,0,g,_,null),this._bindTextureDirectly(d,null),this._internalTexturesCache.push(p),n._depthStencilBuffer&&(l.deleteRenderbuffer(n._depthStencilBuffer),n._depthStencilBuffer=null),this._bindUnboundFramebuffer(null!==(a=n._MSAAFramebuffer)&&void 0!==a?a:n._framebuffer),n._generateStencilBuffer=m,n._depthStencilTextureWithStencil=m,n._depthStencilBuffer=this._setupFramebufferDepthAttachments(n._generateStencilBuffer,n._generateDepthBuffer,n.width,n.height,n.samples,p.format),this._bindUnboundFramebuffer(null),p},a.ThinEngine.prototype.updateRenderTargetTextureSampleCount=function(e,t){var n,r;if(this.webGLVersion<2||!e)return 1;if(e.samples===t)return t;var i=this._gl;t=Math.min(t,this.getCaps().maxMSAASamples),e._depthStencilBuffer&&(i.deleteRenderbuffer(e._depthStencilBuffer),e._depthStencilBuffer=null),e._MSAAFramebuffer&&(i.deleteFramebuffer(e._MSAAFramebuffer),e._MSAAFramebuffer=null);var o=null===(n=e.texture)||void 0===n?void 0:n._hardwareTexture;if(null==o||o.releaseMSAARenderBuffers(),e.texture&&t>1&&"function"==typeof i.renderbufferStorageMultisample){var a=i.createFramebuffer();if(!a)throw new Error("Unable to create multi sampled framebuffer");e._MSAAFramebuffer=a,this._bindUnboundFramebuffer(e._MSAAFramebuffer);var s=this._createRenderBuffer(e.texture.width,e.texture.height,t,-1,this._getRGBABufferInternalSizedFormat(e.texture.type,e.texture.format,e.texture._useSRGBBuffer),i.COLOR_ATTACHMENT0,!1);if(!s)throw new Error("Unable to create multi sampled framebuffer");null==o||o.addMSAARenderBuffer(s)}this._bindUnboundFramebuffer(null!==(r=e._MSAAFramebuffer)&&void 0!==r?r:e._framebuffer),e.texture&&(e.texture.samples=t),e._samples=t;var l=e._depthStencilTexture?e._depthStencilTexture.format:void 0;return e._depthStencilBuffer=this._setupFramebufferDepthAttachments(e._generateStencilBuffer,e._generateDepthBuffer,e.width,e.height,t,l),this._bindUnboundFramebuffer(null),t},a.ThinEngine.prototype._setupDepthStencilTexture=function(e,t,n,r,i){var o,a;void 0===i&&(i=1);var l=null!==(o=t.width)&&void 0!==o?o:t,c=null!==(a=t.height)&&void 0!==a?a:t,u=t.layers||0,h=t.depth||0;e.baseWidth=l,e.baseHeight=c,e.width=l,e.height=c,e.is2DArray=u>0,e.depth=u||h,e.isReady=!0,e.samples=i,e.generateMipMaps=!1,e.samplingMode=n?s.Y.TEXTURE_BILINEAR_SAMPLINGMODE:s.Y.TEXTURE_NEAREST_SAMPLINGMODE,e.type=s.Y.TEXTURETYPE_UNSIGNED_BYTE,e._comparisonFunction=r;var d=this._gl,p=this._getTextureTarget(e),f=this._getSamplingParameters(e.samplingMode,!1);d.texParameteri(p,d.TEXTURE_MAG_FILTER,f.mag),d.texParameteri(p,d.TEXTURE_MIN_FILTER,f.min),d.texParameteri(p,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE),d.texParameteri(p,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE),this.webGLVersion>1&&(0===r?(d.texParameteri(p,d.TEXTURE_COMPARE_FUNC,s.Y.LEQUAL),d.texParameteri(p,d.TEXTURE_COMPARE_MODE,d.NONE)):(d.texParameteri(p,d.TEXTURE_COMPARE_FUNC,r),d.texParameteri(p,d.TEXTURE_COMPARE_MODE,d.COMPARE_REF_TO_TEXTURE)))}},71263:(e,t,n)=>{n.r(t),n.d(t,{extractHighlightsPixelShaderWGSL:()=>a});var r=n(98519),i=(n(17393),"extractHighlightsPixelShader"),o="#include\nvarying vUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d;uniform threshold: f32;uniform exposure: f32;\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {fragmentOutputs.color=textureSample(textureSampler,textureSamplerSampler,input.vUV);var luma: f32=dot(LuminanceEncodeApprox,fragmentOutputs.color.rgb*uniforms.exposure);fragmentOutputs.color=vec4f(step(uniforms.threshold,luma)*fragmentOutputs.color.rgb,fragmentOutputs.color.a);}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},71433:(e,t,n)=>{n.r(t),n.d(t,{backgroundVertexShaderWGSL:()=>a});var r=n(98519),i=(n(66138),n(17393),n(45699),n(27279),n(63866),n(9436),n(79716),n(58902),n(38197),n(21310),n(3641),n(86615),n(63002),n(70898),n(59115),n(55607),"backgroundVertexShader"),o="#include\n#include\nattribute position: vec3f;\n#ifdef NORMAL\nattribute normal: vec3f;\n#endif\n#include\n#include\n#include\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#ifdef UV1\nattribute uv: vec2f;\n#endif\n#ifdef UV2\nattribute uv2: vec2f;\n#endif\n#ifdef MAINUV1\nvarying vMainUV1: vec2f;\n#endif\n#ifdef MAINUV2\nvarying vMainUV2: vec2f;\n#endif\n#if defined(DIFFUSE) && DIFFUSEDIRECTUV==0\nvarying vDiffuseUV: vec2f;\n#endif\n#include\n#include\n#include[0..maxSimultaneousLights]\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vPositionUVW: vec3f;\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vDirectionW: vec3f;\n#endif\n#include\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef REFLECTIONMAP_SKYBOX\nvertexOutputs.vPositionUVW=input.position;\n#endif\n#include\n#include\n#include\n#ifdef MULTIVIEW\nif (gl_ViewID_OVR==0u) {vertexOutputs.position=scene.viewProjection*finalWorld* vec4f(input.position,1.0);} else {vertexOutputs.position=scene.viewProjectionR*finalWorld* vec4f(input.position,1.0);}\n#else\nvertexOutputs.position=scene.viewProjection*finalWorld* vec4f(input.position,1.0);\n#endif\nvar worldPos: vec4f=finalWorld* vec4f(input.position,1.0);vertexOutputs.vPositionW= worldPos.xyz;\n#ifdef NORMAL\nvar normalWorld: mat3x3f=mat3x3f(finalWorld[0].xyz,finalWorld[1].xyz,finalWorld[2].xyz);\n#ifdef NONUNIFORMSCALING\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\n#endif\nvertexOutputs.vNormalW=normalize(normalWorld*input.normal);\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvertexOutputs.vDirectionW=normalize((finalWorld*vec4f(input.position,0.0)).xyz);\n#ifdef EQUIRECTANGULAR_RELFECTION_FOV\nvar screenToWorld: mat3x3f=inverseMat3( mat3x3f(finalWorld*scene.viewProjection));var segment: vec3f=mix(vertexOutputs.vDirectionW,screenToWorld* vec3f(0.0,0.0,1.0),abs(fFovMultiplier-1.0));if (fFovMultiplier<=1.0) {vertexOutputs.vDirectionW=normalize(segment);} else {vertexOutputs.vDirectionW=normalize(vertexOutputs.vDirectionW+(vertexOutputs.vDirectionW-segment));}\n#endif\n#endif\n#ifndef UV1\nvar uv: vec2f=vec2f(0.,0.);\n#else\nvar uv=input.uv;\n#endif\n#ifndef UV2\nvar uv2: vec2f=vec2f(0.,0.);\n#else\nvar uv2=input.uv2;\n#endif\n#ifdef MAINUV1\nvertexOutputs.vMainUV1=uv;\n#endif\n#ifdef MAINUV2\nvertexOutputs.vMainUV2=uv2;\n#endif\n#if defined(DIFFUSE) && DIFFUSEDIRECTUV==0\nif (uniforms.vDiffuseInfos.x==0.)\n{vertexOutputs.vDiffuseUV= (uniforms.diffuseMatrix* vec4f(uv,1.0,0.0)).xy;}\nelse\n{vertexOutputs.vDiffuseUV= (uniforms.diffuseMatrix* vec4f(uv2,1.0,0.0)).xy;}\n#endif\n#include\n#include\n#include[0..maxSimultaneousLights]\n#ifdef VERTEXCOLOR\nvertexOutputs.vColor=vertexInputs.color;\n#endif\n#include\n#define CUSTOM_VERTEX_MAIN_END\n}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},71545:(e,t,n)=>{n.r(t),n.d(t,{_ENVTextureLoader:()=>i});var r=n(88309),i=function(){function e(){this.supportCascades=!1}return e.prototype.loadCubeData=function(e,t,n,i,o){if(!Array.isArray(e)){var a=(0,r.cU)(e);if(a){t.width=a.width,t.height=a.width;try{(0,r.ow)(t,a),(0,r.o5)(t,e,a).then((function(){t.isReady=!0,t.onLoadedObservable.notifyObservers(t),t.onLoadedObservable.clear(),i&&i()}),(function(e){null==o||o("Can not upload environment levels",e)}))}catch(e){null==o||o("Can not upload environment file",e)}}else o&&o("Can not parse the environment file",null)}},e.prototype.loadData=function(){throw".env not supported in 2d."},e}()},71666:(e,t,n)=>{n.r(t),n.d(t,{depthBoxBlurPixelShaderWGSL:()=>a});var r=n(98519),i="depthBoxBlurPixelShader",o="varying vUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d;uniform screenSize: vec2f;\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var colorDepth: vec4f=vec4f(0.0);for (var x: i32=-OFFSET; x<=OFFSET; x++) {for (var y: i32=-OFFSET; y<=OFFSET; y++) {colorDepth+=textureSample(textureSampler,textureSamplerSampler,input.vUV+ vec2f(f32(x),f32(y))/uniforms.screenSize);}}\nfragmentOutputs.color=(colorDepth/ f32((OFFSET*2+1)*(OFFSET*2+1)));}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},71859:(e,t,n)=>{n.r(t),n.d(t,{depthBoxBlurPixelShader:()=>a});var r=n(98519),i="depthBoxBlurPixelShader",o="varying vec2 vUV;uniform sampler2D textureSampler;uniform vec2 screenSize;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{vec4 colorDepth=vec4(0.0);for (int x=-OFFSET; x<=OFFSET; x++)\nfor (int y=-OFFSET; y<=OFFSET; y++)\ncolorDepth+=texture2D(textureSampler,vUV+vec2(x,y)/screenSize);gl_FragColor=(colorDepth/float((OFFSET*2+1)*(OFFSET*2+1)));}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},71974:(e,t,n)=>{var r=n(78322),i=n(44256),o=n(19133),a=n(7164),s=n(81152),l=n(87074);i.ThinEngine.prototype._createDepthStencilCubeTexture=function(e,t){var n=new o.h(this,12);if(n.isCube=!0,1===this.webGLVersion)return a.V.Error("Depth cube texture is not supported by WebGL 1."),n;var i=(0,r.Cl)({bilinearFiltering:!1,comparisonFunction:0,generateStencil:!1},t),s=this._gl;this._bindTextureDirectly(s.TEXTURE_CUBE_MAP,n,!0),this._setupDepthStencilTexture(n,e,i.bilinearFiltering,i.comparisonFunction);for(var l=0;l<6;l++)i.generateStencil?s.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,s.DEPTH24_STENCIL8,e,e,0,s.DEPTH_STENCIL,s.UNSIGNED_INT_24_8,null):s.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,s.DEPTH_COMPONENT24,e,e,0,s.DEPTH_COMPONENT,s.UNSIGNED_INT,null);return this._bindTextureDirectly(s.TEXTURE_CUBE_MAP,null),this._internalTexturesCache.push(n),n},i.ThinEngine.prototype._setCubeMapTextureParams=function(e,t,n){var r=this._gl;r.texParameteri(r.TEXTURE_CUBE_MAP,r.TEXTURE_MAG_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_CUBE_MAP,r.TEXTURE_MIN_FILTER,t?r.LINEAR_MIPMAP_LINEAR:r.LINEAR),r.texParameteri(r.TEXTURE_CUBE_MAP,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_CUBE_MAP,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),e.samplingMode=t?s.Y.TEXTURE_TRILINEAR_SAMPLINGMODE:s.Y.TEXTURE_LINEAR_LINEAR,t&&this.getCaps().textureMaxLevel&&void 0!==n&&n>0&&(r.texParameteri(r.TEXTURE_CUBE_MAP,r.TEXTURE_MAX_LEVEL,n),e._maxLodLevel=n),this._bindTextureDirectly(r.TEXTURE_CUBE_MAP,null)},i.ThinEngine.prototype.createCubeTexture=function(e,t,n,r,i,o,s,c,u,h,d,p,f,m,_){var g=this;void 0===i&&(i=null),void 0===o&&(o=null),void 0===c&&(c=null),void 0===u&&(u=!1),void 0===h&&(h=0),void 0===d&&(d=0),void 0===p&&(p=null),void 0===m&&(m=!1),void 0===_&&(_=null);var v=this._gl;return this.createCubeTextureBase(e,t,n,!!r,i,o,s,c,u,h,d,p,(function(e){return g._bindTextureDirectly(v.TEXTURE_CUBE_MAP,e,!0)}),(function(e,t){var n=g.needPOTTextures?(0,l.R)(t[0].width,g._caps.maxCubemapTextureSize):t[0].width,o=n,c=[v.TEXTURE_CUBE_MAP_POSITIVE_X,v.TEXTURE_CUBE_MAP_POSITIVE_Y,v.TEXTURE_CUBE_MAP_POSITIVE_Z,v.TEXTURE_CUBE_MAP_NEGATIVE_X,v.TEXTURE_CUBE_MAP_NEGATIVE_Y,v.TEXTURE_CUBE_MAP_NEGATIVE_Z];g._bindTextureDirectly(v.TEXTURE_CUBE_MAP,e,!0),g._unpackFlipY(!1);var u=s?g._getInternalFormat(s,e._useSRGBBuffer):e._useSRGBBuffer?g._glSRGBExtensionValues.SRGB8_ALPHA8:v.RGBA,h=s?g._getInternalFormat(s):v.RGBA;e._useSRGBBuffer&&1===g.webGLVersion&&(h=u);for(var d=0;d{n.r(t),n.d(t,{pickingPixelShaderWGSL:()=>a});var r=n(98519),i="pickingPixelShader",o="#if defined(INSTANCES)\nvarying vMeshID: f32;\n#else\nuniform meshID: f32;\n#endif\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var id: i32;\n#if defined(INSTANCES)\nid=i32(input.vMeshID);\n#else\nid=i32(uniforms.meshID);\n#endif\nvar color=vec3f(\nf32((id>>16) & 0xFF),\nf32((id>>8) & 0xFF),\nf32(id & 0xFF),\n)/255.0;fragmentOutputs.color=vec4f(color,1.0);}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},72153:(e,t,n)=>{var r=n(98519),i="fogVertexDeclaration";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#ifdef FOG\nvarying vec3 vFogDistance;\n#endif\n")},72226:(e,t,n)=>{var r=n(98519),i="gaussianSplatting";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#if !defined(WEBGL2) && !defined(WEBGPU) && !defined(NATIVE)\nmat3 transpose(mat3 matrix) {return mat3(matrix[0][0],matrix[1][0],matrix[2][0],\nmatrix[0][1],matrix[1][1],matrix[2][1],\nmatrix[0][2],matrix[1][2],matrix[2][2]);}\n#endif\nvec2 getDataUV(float index,vec2 textureSize) {float y=floor(index/textureSize.x);float x=index-y*textureSize.x;return vec2((x+0.5)/textureSize.x,(y+0.5)/textureSize.y);}\n#if SH_DEGREE>0\nivec2 getDataUVint(float index,vec2 textureSize) {float y=floor(index/textureSize.x);float x=index-y*textureSize.x;return ivec2(uint(x+0.5),uint(y+0.5));}\n#endif\nstruct Splat {vec4 center;\n#ifndef GS_DISABLE_COLOR\nvec4 color;\n#endif\nvec4 covA;vec4 covB;\n#if SH_DEGREE>0\nuvec4 sh0; \n#endif\n#if SH_DEGREE>1\nuvec4 sh1;\n#endif\n#if SH_DEGREE>2\nuvec4 sh2;\n#endif\n};Splat readSplat(float splatIndex)\n{Splat splat;vec2 splatUV=getDataUV(splatIndex,dataTextureSize);splat.center=texture2D(centersTexture,splatUV);\n#ifndef GS_DISABLE_COLOR\nsplat.color=texture2D(colorsTexture,splatUV);\n#endif\nsplat.covA=texture2D(covariancesATexture,splatUV)*splat.center.w;splat.covB=texture2D(covariancesBTexture,splatUV)*splat.center.w;\n#if SH_DEGREE>0\nivec2 splatUVint=getDataUVint(splatIndex,dataTextureSize);splat.sh0=texelFetch(shTexture0,splatUVint,0);\n#endif\n#if SH_DEGREE>1\nsplat.sh1=texelFetch(shTexture1,splatUVint,0);\n#endif\n#if SH_DEGREE>2\nsplat.sh2=texelFetch(shTexture2,splatUVint,0);\n#endif\nreturn splat;}\n#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\nvec3 computeColorFromSHDegree(vec3 dir,const vec3 sh[16])\n{const float SH_C0=0.28209479;const float SH_C1=0.48860251;float SH_C2[5];SH_C2[0]=1.092548430;SH_C2[1]=-1.09254843;SH_C2[2]=0.315391565;SH_C2[3]=-1.09254843;SH_C2[4]=0.546274215;float SH_C3[7];SH_C3[0]=-0.59004358;SH_C3[1]=2.890611442;SH_C3[2]=-0.45704579;SH_C3[3]=0.373176332;SH_C3[4]=-0.45704579;SH_C3[5]=1.445305721;SH_C3[6]=-0.59004358;vec3 result=/*SH_C0**/sh[0];\n#if SH_DEGREE>0\nfloat x=dir.x;float y=dir.y;float z=dir.z;result+=- SH_C1*y*sh[1]+SH_C1*z*sh[2]-SH_C1*x*sh[3];\n#if SH_DEGREE>1\nfloat xx=x*x,yy=y*y,zz=z*z;float xy=x*y,yz=y*z,xz=x*z;result+=\nSH_C2[0]*xy*sh[4] +\nSH_C2[1]*yz*sh[5] +\nSH_C2[2]*(2.0*zz-xx-yy)*sh[6] +\nSH_C2[3]*xz*sh[7] +\nSH_C2[4]*(xx-yy)*sh[8];\n#if SH_DEGREE>2\nresult+=\nSH_C3[0]*y*(3.0*xx-yy)*sh[9] +\nSH_C3[1]*xy*z*sh[10] +\nSH_C3[2]*y*(4.0*zz-xx-yy)*sh[11] +\nSH_C3[3]*z*(2.0*zz-3.0*xx-3.0*yy)*sh[12] +\nSH_C3[4]*x*(4.0*zz-xx-yy)*sh[13] +\nSH_C3[5]*z*(xx-yy)*sh[14] +\nSH_C3[6]*x*(xx-3.0*yy)*sh[15];\n#endif\n#endif\n#endif\nreturn result;}\nvec4 decompose(uint value)\n{vec4 components=vec4(\nfloat((value ) & 255u),\nfloat((value>>uint( 8)) & 255u),\nfloat((value>>uint(16)) & 255u),\nfloat((value>>uint(24)) & 255u));return components*vec4(2./255.)-vec4(1.);}\nvec3 computeSH(Splat splat,vec3 dir)\n{vec3 sh[16];sh[0]=vec3(0.,0.,0.);\n#if SH_DEGREE>0\nvec4 sh00=decompose(splat.sh0.x);vec4 sh01=decompose(splat.sh0.y);vec4 sh02=decompose(splat.sh0.z);sh[1]=vec3(sh00.x,sh00.y,sh00.z);sh[2]=vec3(sh00.w,sh01.x,sh01.y);sh[3]=vec3(sh01.z,sh01.w,sh02.x);\n#endif\n#if SH_DEGREE>1\nvec4 sh03=decompose(splat.sh0.w);vec4 sh04=decompose(splat.sh1.x);vec4 sh05=decompose(splat.sh1.y);sh[4]=vec3(sh02.y,sh02.z,sh02.w);sh[5]=vec3(sh03.x,sh03.y,sh03.z);sh[6]=vec3(sh03.w,sh04.x,sh04.y);sh[7]=vec3(sh04.z,sh04.w,sh05.x);sh[8]=vec3(sh05.y,sh05.z,sh05.w);\n#endif\n#if SH_DEGREE>2\nvec4 sh06=decompose(splat.sh1.z);vec4 sh07=decompose(splat.sh1.w);vec4 sh08=decompose(splat.sh2.x);vec4 sh09=decompose(splat.sh2.y);vec4 sh10=decompose(splat.sh2.z);vec4 sh11=decompose(splat.sh2.w);sh[9]=vec3(sh06.x,sh06.y,sh06.z);sh[10]=vec3(sh06.w,sh07.x,sh07.y);sh[11]=vec3(sh07.z,sh07.w,sh08.x);sh[12]=vec3(sh08.y,sh08.z,sh08.w);sh[13]=vec3(sh09.x,sh09.y,sh09.z);sh[14]=vec3(sh09.w,sh10.x,sh10.y);sh[15]=vec3(sh10.z,sh10.w,sh11.x); \n#endif\nreturn computeColorFromSHDegree(dir,sh);}\n#else\nvec3 computeSH(Splat splat,vec3 dir)\n{return vec3(0.,0.,0.);}\n#endif\nvec4 gaussianSplatting(vec2 meshPos,vec3 worldPos,vec2 scale,vec3 covA,vec3 covB,mat4 worldMatrix,mat4 viewMatrix,mat4 projectionMatrix)\n{mat4 modelView=viewMatrix*worldMatrix;vec4 camspace=viewMatrix*vec4(worldPos,1.);vec4 pos2d=projectionMatrix*camspace;float bounds=1.2*pos2d.w;if (pos2d.z<-pos2d.w || pos2d.x<-bounds || pos2d.x>bounds\n|| pos2d.y<-bounds || pos2d.y>bounds) {return vec4(0.0,0.0,2.0,1.0);}\nmat3 Vrk=mat3(\ncovA.x,covA.y,covA.z,\ncovA.y,covB.x,covB.y,\ncovA.z,covB.y,covB.z\n);bool isOrtho=abs(projectionMatrix[3][3]-1.0)<0.001;mat3 J;if (isOrtho) {J=mat3(\nfocal.x,0.,0.,\n0.,focal.y,0.,\n0.,0.,0.\n);} else {J=mat3(\nfocal.x/camspace.z,0.,-(focal.x*camspace.x)/(camspace.z*camspace.z),\n0.,focal.y/camspace.z,-(focal.y*camspace.y)/(camspace.z*camspace.z),\n0.,0.,0.\n);}\nmat3 invy=mat3(1,0,0,0,-1,0,0,0,1);mat3 T=invy*transpose(mat3(modelView))*J;mat3 cov2d=transpose(T)*Vrk*T;\n#if COMPENSATION\nfloat c00=cov2d[0][0];float c11=cov2d[1][1];float c01=cov2d[0][1];float detOrig=c00*c11-c01*c01;\n#endif\ncov2d[0][0]+=kernelSize;cov2d[1][1]+=kernelSize;\n#if COMPENSATION\nvec3 c2d=vec3(cov2d[0][0],c01,cov2d[1][1]);float detBlur=c2d.x*c2d.z-c2d.y*c2d.y;float compensation=sqrt(max(0.,detOrig/detBlur));vColor.w*=compensation;\n#endif\nfloat mid=(cov2d[0][0]+cov2d[1][1])/2.0;float radius=length(vec2((cov2d[0][0]-cov2d[1][1])/2.0,cov2d[0][1]));float epsilon=0.0001;float lambda1=mid+radius+epsilon,lambda2=mid-radius+epsilon;if (lambda2<0.0)\n{return vec4(0.0,0.0,2.0,1.0);}\nvec2 diagonalVector=normalize(vec2(cov2d[0][1],lambda1-cov2d[0][0]));vec2 majorAxis=min(sqrt(2.0*lambda1),1024.0)*diagonalVector;vec2 minorAxis=min(sqrt(2.0*lambda2),1024.0)*vec2(diagonalVector.y,-diagonalVector.x);vec2 vCenter=vec2(pos2d);float scaleFactor=isOrtho ? 1.0 : pos2d.w;return vec4(\nvCenter \n+ ((meshPos.x*majorAxis\n+ meshPos.y*minorAxis)*invViewport*scaleFactor)*scale,pos2d.zw);}")},72527:(e,t,n)=>{n.r(t),n.d(t,{screenSpaceReflection2PixelShader:()=>a});var r=n(98519),i=(n(75334),n(64244),n(93664),"screenSpaceReflection2PixelShader"),o="#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\n#define TEXTUREFUNC(s,c,lod) texture2DLodEXT(s,c,lod)\n#define TEXTURECUBEFUNC(s,c,lod) textureLod(s,c,lod)\n#else\n#define TEXTUREFUNC(s,c,bias) texture2D(s,c,bias)\n#define TEXTURECUBEFUNC(s,c,bias) textureCube(s,c,bias)\n#endif\nuniform sampler2D textureSampler;varying vec2 vUV;\n#ifdef SSR_SUPPORTED\nuniform sampler2D reflectivitySampler;uniform sampler2D normalSampler;uniform sampler2D depthSampler;\n#ifdef SSRAYTRACE_USE_BACK_DEPTHBUFFER\nuniform sampler2D backDepthSampler;uniform float backSizeFactor;\n#endif\n#ifdef SSR_USE_ENVIRONMENT_CUBE\nuniform samplerCube envCubeSampler;\n#ifdef SSR_USE_LOCAL_REFLECTIONMAP_CUBIC\nuniform vec3 vReflectionPosition;uniform vec3 vReflectionSize;\n#endif\n#endif\nuniform mat4 view;uniform mat4 invView;uniform mat4 projection;uniform mat4 invProjectionMatrix;uniform mat4 projectionPixel;uniform float nearPlaneZ;uniform float farPlaneZ;uniform float stepSize;uniform float maxSteps;uniform float strength;uniform float thickness;uniform float roughnessFactor;uniform float reflectionSpecularFalloffExponent;uniform float maxDistance;uniform float selfCollisionNumSkip;uniform float reflectivityThreshold;\n#include\n#include\n#include\nvec3 hash(vec3 a)\n{a=fract(a*0.8);a+=dot(a,a.yxz+19.19);return fract((a.xxy+a.yxx)*a.zyx);}\nfloat computeAttenuationForIntersection(ivec2 hitPixel,vec2 hitUV,vec3 vsRayOrigin,vec3 vsHitPoint,vec3 reflectionVector,float maxRayDistance,float numIterations) {float attenuation=1.0;\n#ifdef SSR_ATTENUATE_SCREEN_BORDERS\nvec2 dCoords=smoothstep(0.2,0.6,abs(vec2(0.5,0.5)-hitUV.xy));attenuation*=clamp(1.0-(dCoords.x+dCoords.y),0.0,1.0);\n#endif\n#ifdef SSR_ATTENUATE_INTERSECTION_DISTANCE\nattenuation*=1.0-clamp(distance(vsRayOrigin,vsHitPoint)/maxRayDistance,0.0,1.0);\n#endif\n#ifdef SSR_ATTENUATE_INTERSECTION_NUMITERATIONS\nattenuation*=1.0-(numIterations/maxSteps);\n#endif\n#ifdef SSR_ATTENUATE_BACKFACE_REFLECTION\nvec3 reflectionNormal=texelFetch(normalSampler,hitPixel,0).xyz;float directionBasedAttenuation=smoothstep(-0.17,0.0,dot(reflectionNormal,-reflectionVector));attenuation*=directionBasedAttenuation;\n#endif\nreturn attenuation;}\n#endif\nvoid main()\n{\n#ifdef SSR_SUPPORTED\nvec4 colorFull=TEXTUREFUNC(textureSampler,vUV,0.0);vec3 color=colorFull.rgb;vec4 reflectivity=max(TEXTUREFUNC(reflectivitySampler,vUV,0.0),vec4(0.));\n#ifndef SSR_DISABLE_REFLECTIVITY_TEST\nif (max(reflectivity.r,max(reflectivity.g,reflectivity.b))<=reflectivityThreshold) {\n#ifdef SSR_USE_BLUR\ngl_FragColor=vec4(0.);\n#else\ngl_FragColor=colorFull;\n#endif\nreturn;}\n#endif\n#ifdef SSR_INPUT_IS_GAMMA_SPACE\ncolor=toLinearSpace(color);\n#endif\nvec2 texSize=vec2(textureSize(depthSampler,0));vec3 csNormal=texelFetch(normalSampler,ivec2(vUV*texSize),0).xyz; \n#ifdef SSR_DECODE_NORMAL\ncsNormal=csNormal*2.0-1.0;\n#endif\n#ifdef SSR_NORMAL_IS_IN_WORLDSPACE\ncsNormal=(view*vec4(csNormal,0.0)).xyz;\n#endif\nfloat depth=texelFetch(depthSampler,ivec2(vUV*texSize),0).r;\n#ifdef SSRAYTRACE_SCREENSPACE_DEPTH\ndepth=linearizeDepth(depth,nearPlaneZ,farPlaneZ);\n#endif\nvec3 csPosition=computeViewPosFromUVDepth(vUV,depth,projection,invProjectionMatrix);\n#ifdef ORTHOGRAPHIC_CAMERA\nvec3 csViewDirection=vec3(0.,0.,1.);\n#else\nvec3 csViewDirection=normalize(csPosition);\n#endif\nvec3 csReflectedVector=reflect(csViewDirection,csNormal);\n#ifdef SSR_USE_ENVIRONMENT_CUBE\nvec3 wReflectedVector=vec3(invView*vec4(csReflectedVector,0.0));\n#ifdef SSR_USE_LOCAL_REFLECTIONMAP_CUBIC\nvec4 worldPos=invView*vec4(csPosition,1.0);wReflectedVector=parallaxCorrectNormal(worldPos.xyz,normalize(wReflectedVector),vReflectionSize,vReflectionPosition);\n#endif\n#ifdef SSR_INVERTCUBICMAP\nwReflectedVector.y*=-1.0;\n#endif\n#ifdef SSRAYTRACE_RIGHT_HANDED_SCENE\nwReflectedVector.z*=-1.0;\n#endif\nvec3 envColor=TEXTURECUBEFUNC(envCubeSampler,wReflectedVector,0.0).xyz;\n#ifdef SSR_ENVIRONMENT_CUBE_IS_GAMMASPACE\nenvColor=toLinearSpace(envColor);\n#endif\n#else\nvec3 envColor=color;\n#endif\nfloat reflectionAttenuation=1.0;bool rayHasHit=false;vec2 startPixel;vec2 hitPixel;vec3 hitPoint;float numIterations;\n#ifdef SSRAYTRACE_DEBUG\nvec3 debugColor;\n#endif\n#ifdef SSR_ATTENUATE_FACING_CAMERA\nreflectionAttenuation*=1.0-smoothstep(0.25,0.5,dot(-csViewDirection,csReflectedVector));\n#endif\nif (reflectionAttenuation>0.0) {\n#ifdef SSR_USE_BLUR\nvec3 jitt=vec3(0.);\n#else\nfloat roughness=1.0-reflectivity.a;vec3 jitt=mix(vec3(0.0),hash(csPosition)-vec3(0.5),roughness)*roughnessFactor; \n#endif\nvec2 uv2=vUV*texSize;float c=(uv2.x+uv2.y)*0.25;float jitter=mod(c,1.0); \nrayHasHit=traceScreenSpaceRay1(\ncsPosition,\nnormalize(csReflectedVector+jitt),\nprojectionPixel,\ndepthSampler,\ntexSize,\n#ifdef SSRAYTRACE_USE_BACK_DEPTHBUFFER\nbackDepthSampler,\nbackSizeFactor,\n#endif\nthickness,\nnearPlaneZ,\nfarPlaneZ,\nstepSize,\njitter,\nmaxSteps,\nmaxDistance,\nselfCollisionNumSkip,\nstartPixel,\nhitPixel,\nhitPoint,\nnumIterations\n#ifdef SSRAYTRACE_DEBUG\n,debugColor\n#endif\n);}\n#ifdef SSRAYTRACE_DEBUG\ngl_FragColor=vec4(debugColor,1.);return;\n#endif\nvec3 F0=reflectivity.rgb;vec3 fresnel=fresnelSchlickGGX(max(dot(csNormal,-csViewDirection),0.0),F0,vec3(1.));vec3 SSR=envColor;if (rayHasHit) {vec3 reflectedColor=texelFetch(textureSampler,ivec2(hitPixel),0).rgb;\n#ifdef SSR_INPUT_IS_GAMMA_SPACE\nreflectedColor=toLinearSpace(reflectedColor);\n#endif\nreflectionAttenuation*=computeAttenuationForIntersection(ivec2(hitPixel),hitPixel/texSize,csPosition,hitPoint,csReflectedVector,maxDistance,numIterations);SSR=reflectedColor*reflectionAttenuation+(1.0-reflectionAttenuation)*envColor;}\n#ifndef SSR_BLEND_WITH_FRESNEL\nSSR*=fresnel;\n#endif\n#ifdef SSR_USE_BLUR\nfloat blur_radius=0.0;float roughness=1.0-reflectivity.a*(1.0-roughnessFactor);if (roughness>0.001) {float cone_angle=min(roughness,0.999)*3.14159265*0.5;float cone_len=distance(startPixel,hitPixel);float op_len=2.0*tan(cone_angle)*cone_len; \nfloat a=op_len;float h=cone_len;float a2=a*a;float fh2=4.0f*h*h;blur_radius=(a*(sqrt(a2+fh2)-a))/(4.0f*h);}\ngl_FragColor=vec4(SSR,blur_radius/255.0); \n#else\n#ifdef SSR_BLEND_WITH_FRESNEL\nvec3 reflectionMultiplier=clamp(pow(fresnel*strength,vec3(reflectionSpecularFalloffExponent)),0.0,1.0);\n#else\nvec3 reflectionMultiplier=clamp(pow(reflectivity.rgb*strength,vec3(reflectionSpecularFalloffExponent)),0.0,1.0);\n#endif\nvec3 colorMultiplier=1.0-reflectionMultiplier;vec3 finalColor=(color*colorMultiplier)+(SSR*reflectionMultiplier);\n#ifdef SSR_OUTPUT_IS_GAMMA_SPACE\nfinalColor=toGammaSpace(finalColor);\n#endif\ngl_FragColor=vec4(finalColor,colorFull.a);\n#endif\n#else\ngl_FragColor=TEXTUREFUNC(textureSampler,vUV,0.0);\n#endif\n}\n";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},72597:(e,t,n)=>{n.d(t,{CA:()=>a,Z7:()=>s,i_:()=>o});var r=n(78322),i=n(41053),o=function(e){function t(t){return e.call(this,"Analyzer",t)||this}return(0,r.C6)(t,e),t.prototype.setOptions=function(e){var t,n,r,o;this.fftSize=null!==(t=e.analyzerFFTSize)&&void 0!==t?t:i.IR.fftSize,this.minDecibels=null!==(n=e.analyzerMinDecibels)&&void 0!==n?n:i.IR.minDecibels,this.maxDecibels=null!==(r=e.analyzerMaxDecibels)&&void 0!==r?r:i.IR.maxDecibels,this.smoothing=null!==(o=e.analyzerSmoothing)&&void 0!==o?o:i.IR.smoothing},t}(n(59465).e);function a(e){return e.getSubNode("Analyzer")}function s(e,t,n){e.callOnSubNode("Analyzer",(function(e){e[t]=n}))}},72626:(e,t,n)=>{n.r(t),n.d(t,{FlowGraphIndexOfBlock:()=>l});var r=n(78322),i=n(45749),o=n(88099),a=n(34623),s=n(40099),l=function(e){function t(t){var n=e.call(this,t)||this;return n.config=t,n.object=n.registerDataInput("object",o.Vv),n.array=n.registerDataInput("array",o.Vv),n.index=n.registerDataOutput("index",o.x2,new s.P(-1)),n}return(0,r.C6)(t,e),t.prototype._updateOutputs=function(e){var t=this.object.getValue(e),n=this.array.getValue(e);n&&this.index.setValue(new s.P(n.indexOf(t)),e)},t.prototype.serialize=function(t){e.prototype.serialize.call(this,t)},t.prototype.getClassName=function(){return"FlowGraphIndexOfBlock"},t}(i.e);(0,a.Y5)("FlowGraphIndexOfBlock",l)},72627:(e,t,n)=>{n.r(t),n.d(t,{boundingBoxRendererPixelShader:()=>s});var r=n(98519),i="boundingBoxRendererFragmentDeclaration";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="uniform vec4 color;\n"),n(90253);var o="boundingBoxRendererPixelShader",a="#include<__decl__boundingBoxRendererFragment>\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\ngl_FragColor=color;\n#define CUSTOM_FRAGMENT_MAIN_END\n}";r.l.ShadersStore[o]||(r.l.ShadersStore[o]=a);var s={name:o,shader:a}},73152:(e,t,n)=>{n.d(t,{o:()=>r});var r=function(){function e(e,t){this.width=e,this.height=t}return e.prototype.toString=function(){return"{W: ".concat(this.width,", H: ").concat(this.height,"}")},e.prototype.getClassName=function(){return"Size"},e.prototype.getHashCode=function(){var e=0|this.width;return 397*e^this.height},e.prototype.copyFrom=function(e){this.width=e.width,this.height=e.height},e.prototype.copyFromFloats=function(e,t){return this.width=e,this.height=t,this},e.prototype.set=function(e,t){return this.copyFromFloats(e,t)},e.prototype.multiplyByFloats=function(t,n){return new e(this.width*t,this.height*n)},e.prototype.clone=function(){return new e(this.width,this.height)},e.prototype.equals=function(e){return!!e&&this.width===e.width&&this.height===e.height},Object.defineProperty(e.prototype,"surface",{get:function(){return this.width*this.height},enumerable:!1,configurable:!0}),e.Zero=function(){return new e(0,0)},e.prototype.add=function(t){return new e(this.width+t.width,this.height+t.height)},e.prototype.subtract=function(t){return new e(this.width-t.width,this.height-t.height)},e.prototype.scale=function(t){return new e(this.width*t,this.height*t)},e.Lerp=function(t,n,r){return new e(t.width+(n.width-t.width)*r,t.height+(n.height-t.height)*r)},e}()},73216:(e,t,n)=>{n.d(t,{R:()=>s});var r=n(81152),i=n(30622),o=n(63639),a=n(11741),s=(n(40880),n(57315),function(){function e(e){var t=this;this._onAfterUnbindObserver=null,this._forceFullscreenViewport=!0,this._activated=!1,this._camera=e,this._postProcessManager=new o.X(e.getScene()),this._thinMinMaxReducer=new a.Qh(e.getScene()),this._reductionSteps=[],this._onContextRestoredObserver=e.getEngine().onContextRestoredObservable.add((function(){t._postProcessManager._rebuild()}))}return Object.defineProperty(e.prototype,"onAfterReductionPerformed",{get:function(){return this._thinMinMaxReducer.onAfterReductionPerformed},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sourceTexture",{get:function(){return this._sourceTexture},enumerable:!1,configurable:!0}),e.prototype.setSourceTexture=function(e,t,n,o){var s=this;if(void 0===n&&(n=r.Y.TEXTURETYPE_HALF_FLOAT),void 0===o&&(o=!0),e!==this._sourceTexture&&(this._thinMinMaxReducer.depthRedux=t,this.deactivate(),this._sourceTexture=e,this._forceFullscreenViewport=o,this._thinMinMaxReducer.setTextureDimensions(e.getRenderWidth(),e.getRenderHeight()))){this._disposePostProcesses();for(var l=this._thinMinMaxReducer.reductionSteps,c=function(e){var t=l[e],c=new i.w(t.name,a.jK.FragmentUrl,{effectWrapper:t,samplingMode:r.Y.TEXTURE_NEAREST_NEAREST,engine:u._camera.getScene().getEngine(),textureType:n,textureFormat:r.Y.TEXTUREFORMAT_RG,size:{width:t.textureWidth,height:t.textureHeight}});u._reductionSteps.push(c),c.autoClear=!1,c.forceFullscreenViewport=o,0===e&&(c.externalTextureSamplerBinding=!0,c.onApplyObservable.add((function(e){e.setTexture("textureSampler",s._sourceTexture)}))),e===l.length-1&&u._reductionSteps[e-1].onAfterRenderObservable.add((function(){s._thinMinMaxReducer.readMinMax(c.inputTexture.texture)}))},u=this,h=0;h{n.d(t,{s:()=>d,v:()=>h});var r=n(78322),i=n(81152),o=n(30622),a=n(82673),s=n(34623),l=n(12028),c=n(14012),u=n(6174),h=function(e){function t(t,n,o,a,s,l,u,h){void 0===o&&(o=null),void 0===u&&(u=i.Y.TEXTURETYPE_UNSIGNED_BYTE),void 0===h&&(h=!1);var d=(0,r.Cl)({size:"number"==typeof n?n:void 0,camera:o,samplingMode:a,engine:s,reusable:l,textureType:u,blockCompilation:h},n);return e.call(this,t,c.m.FragmentUrl,(0,r.Cl)({effectWrapper:"number"!=typeof n&&n.effectWrapper?void 0:new c.m(t,s,d)},d))||this}return(0,r.C6)(t,e),t.prototype.getClassName=function(){return"PassPostProcess"},t._Parse=function(e,n,r,i){return l.p.Parse((function(){return new t(e.name,e.options,n,e.renderTargetSamplingMode,e._engine,e.reusable)}),e,r,i)},t}(o.w);(0,s.Y5)("BABYLON.PassPostProcess",h);var d=function(e){function t(t,n,o,a,s,l,u,h){void 0===o&&(o=null),void 0===u&&(u=i.Y.TEXTURETYPE_UNSIGNED_BYTE),void 0===h&&(h=!1);var d=(0,r.Cl)({size:"number"==typeof n?n:void 0,camera:o,samplingMode:a,engine:s,reusable:l,textureType:u,blockCompilation:h},n);return e.call(this,t,c.m.FragmentUrl,(0,r.Cl)({effectWrapper:"number"!=typeof n&&n.effectWrapper?void 0:new c.V(t,s,d)},d))||this}return(0,r.C6)(t,e),Object.defineProperty(t.prototype,"face",{get:function(){return this._effectWrapper.face},set:function(e){this._effectWrapper.face=e},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"PassCubePostProcess"},t._Parse=function(e,n,r,i){return l.p.Parse((function(){return new t(e.name,e.options,n,e.renderTargetSamplingMode,e._engine,e.reusable)}),e,r,i)},(0,r.Cg)([(0,u.lK)()],t.prototype,"face",null),t}(o.w);a.$._RescalePostProcessFactory=function(e){return new h("rescale",1,null,i.Y.TEXTURE_BILINEAR_SAMPLINGMODE,e,!1,i.Y.TEXTURETYPE_UNSIGNED_BYTE)}},73526:(e,t,n)=>{n.r(t),n.d(t,{shadowMapVertexShader:()=>h});var r=n(98519),i=(n(36470),n(64400),n(24444),n(67369),n(75334),n(20097),"meshVertexDeclaration");r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="uniform mat4 world;uniform float visibility;\n");var o="shadowMapVertexDeclaration";r.l.IncludesShadersStore[o]||(r.l.IncludesShadersStore[o]="#include\n#include\n"),n(50851),n(56174);var a="shadowMapUboDeclaration";r.l.IncludesShadersStore[a]||(r.l.IncludesShadersStore[a]="layout(std140,column_major) uniform;\n#include\n#include\n");var s="shadowMapVertexExtraDeclaration";r.l.IncludesShadersStore[s]||(r.l.IncludesShadersStore[s]="#if SM_NORMALBIAS==1\nuniform vec3 lightDataSM;\n#endif\nuniform vec3 biasAndScaleSM;uniform vec2 depthValuesSM;varying float vDepthMetricSM;\n#if SM_USEDISTANCE==1\nvarying vec3 vPositionWSM;\n#endif\n#if defined(SM_DEPTHCLAMP) && SM_DEPTHCLAMP==1\nvarying float zSM;\n#endif\n"),n(85637),n(58266),n(84589),n(35397),n(76898),n(49334);var l="shadowMapVertexNormalBias";r.l.IncludesShadersStore[l]||(r.l.IncludesShadersStore[l]="#if SM_NORMALBIAS==1\n#if SM_DIRECTIONINLIGHTDATA==1\nvec3 worldLightDirSM=normalize(-lightDataSM.xyz);\n#else\nvec3 directionToLightSM=lightDataSM.xyz-worldPos.xyz;vec3 worldLightDirSM=normalize(directionToLightSM);\n#endif\nfloat ndlSM=dot(vNormalW,worldLightDirSM);float sinNLSM=sqrt(1.0-ndlSM*ndlSM);float normalBiasSM=biasAndScaleSM.y*sinNLSM;worldPos.xyz-=vNormalW*normalBiasSM;\n#endif\n"),n(62371),n(83057);var c="shadowMapVertexShader",u="attribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#include\n#include\n#include\n#include[0..maxSimultaneousMorphTargets]\n#ifdef INSTANCES\nattribute vec4 world0;attribute vec4 world1;attribute vec4 world2;attribute vec4 world3;\n#endif\n#include\n#include<__decl__shadowMapVertex>\n#ifdef ALPHATEXTURE\nvarying vec2 vUV;uniform mat4 diffuseMatrix;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#endif\n#include\n#include\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void)\n{vec3 positionUpdated=position;\n#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#ifdef UV2\nvec2 uv2Updated=uv2;\n#endif\n#ifdef NORMAL\nvec3 normalUpdated=normal;\n#endif\n#include\n#include[0..maxSimultaneousMorphTargets]\n#include\n#include\n#include\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\n#ifdef NORMAL\nmat3 normWorldSM=mat3(finalWorld);\n#if defined(INSTANCES) && defined(THIN_INSTANCES)\nvec3 vNormalW=normalUpdated/vec3(dot(normWorldSM[0],normWorldSM[0]),dot(normWorldSM[1],normWorldSM[1]),dot(normWorldSM[2],normWorldSM[2]));vNormalW=normalize(normWorldSM*vNormalW);\n#else\n#ifdef NONUNIFORMSCALING\nnormWorldSM=transposeMat3(inverseMat3(normWorldSM));\n#endif\nvec3 vNormalW=normalize(normWorldSM*normalUpdated);\n#endif\n#endif\n#include\ngl_Position=viewProjection*worldPos;\n#include\n#ifdef ALPHATEXTURE\n#ifdef UV1\nvUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef UV2\nvUV=vec2(diffuseMatrix*vec4(uv2Updated,1.0,0.0));\n#endif\n#endif\n#include\n}";r.l.ShadersStore[c]||(r.l.ShadersStore[c]=u);var h={name:c,shader:u}},73568:(e,t,n)=>{n.d(t,{H:()=>l,k:()=>c});var r=n(6927),i=n(66377),o=n(66614),a=n(31985),s=(n(65110),n(62273)),l=function(){function e(e){this.parent=e,this.uniqueId=s.K.UniqueId}return e.prototype.getClassName=function(){return"TargetedAnimation"},e.prototype.serialize=function(){var e={};return e.animation=this.animation.serialize(),e.targetId=this.target.id,e},e}(),c=function(){function e(e,t,n,r){void 0===t&&(t=null),void 0===n&&(n=-1),void 0===r&&(r=0),this.name=e,this._targetedAnimations=new Array,this._animatables=new Array,this._from=Number.MAX_VALUE,this._to=-Number.MAX_VALUE,this._speedRatio=1,this._loopAnimation=!1,this._isAdditive=!1,this._weight=-1,this._playOrder=0,this._enableBlending=null,this._blendingSpeed=null,this._numActiveAnimatables=0,this._shouldStart=!0,this._parentContainer=null,this.onAnimationEndObservable=new i.cP,this.onAnimationLoopObservable=new i.cP,this.onAnimationGroupLoopObservable=new i.cP,this.onAnimationGroupEndObservable=new i.cP,this.onAnimationGroupPauseObservable=new i.cP,this.onAnimationGroupPlayObservable=new i.cP,this.metadata=null,this._mask=null,this._animationLoopFlags=[],this._scene=t||o.q.LastCreatedScene,this._weight=n,this._playOrder=r,this.uniqueId=this._scene.getUniqueId(),this._scene.addAnimationGroup(this)}return Object.defineProperty(e.prototype,"mask",{get:function(){return this._mask},set:function(e){this._mask!==e&&(this._mask=e,this.syncWithMask(!0))},enumerable:!1,configurable:!0}),e.prototype.syncWithMask=function(e){if(void 0===e&&(e=!1),this.mask||e){this._numActiveAnimatables=0;for(var t=0;t0)){for(var t=0;ta&&(a=d.to);for(var c=new e(t[0].name+"_merged",t[0]._scene,i),u=0,h=t;ur[0].frame&&(this._from=r[0].frame),this._to-1;t--)this._targetedAnimations[t].animation===e&&this._targetedAnimations.splice(t,1)},e.prototype.normalize=function(e,t){void 0===e&&(e=null),void 0===t&&(t=null),null==e&&(e=this._from),null==t&&(t=this._to);for(var n=0;ne){var a={frame:e,value:i.value,inTangent:i.inTangent,outTangent:i.outTangent,interpolation:i.interpolation};r.splice(0,0,a)}o.frame0?this._scene._activeAnimatables[r++]=i:e&&this._checkAnimationGroupEnded(i,e)}return this._scene._activeAnimatables.length=r,this._isStarted=!1,this},e.prototype.setWeightForAllAnimatables=function(e){for(var t=0;t-1&&this._scene.animationGroups.splice(e,1),this._parentContainer){var t=this._parentContainer.animationGroups.indexOf(this);t>-1&&this._parentContainer.animationGroups.splice(t,1),this._parentContainer=null}this.onAnimationEndObservable.clear(),this.onAnimationGroupEndObservable.clear(),this.onAnimationGroupPauseObservable.clear(),this.onAnimationGroupPlayObservable.clear(),this.onAnimationLoopObservable.clear(),this.onAnimationGroupLoopObservable.clear()},e.prototype._checkAnimationGroupEnded=function(e,t){void 0===t&&(t=!1);var n=this._animatables.indexOf(e);n>-1&&this._animatables.splice(n,1),this._animatables.length===this._targetedAnimations.length-this._numActiveAnimatables&&(this._isStarted=!1,t||this.onAnimationGroupEndObservable.notifyObservers(this),this._animatables.length=0)},e.prototype.clone=function(t,n,r){void 0===r&&(r=!1);var i=new e(t||this.name,this._scene,this._weight,this._playOrder);i._from=this.from,i._to=this.to,i._speedRatio=this.speedRatio,i._loopAnimation=this.loopAnimation,i._isAdditive=this.isAdditive,i._enableBlending=this.enableBlending,i._blendingSpeed=this.blendingSpeed,i.metadata=this.metadata,i.mask=this.mask;for(var o=0,a=this._targetedAnimations;of[0].frame&&(u=f[0].frame),h=t&&f<=n||i&&m.frame>=t&&m.frame<=n){var _={frame:m.frame,value:m.value.clone?m.value.clone():m.value,inTangent:m.inTangent,outTangent:m.outTangent,interpolation:m.interpolation,lockedTangent:m.lockedTangent};p===Number.MAX_VALUE&&(p=_.frame),_.frame-=p,d.push(_)}}0!==d.length?(o>d[0].frame&&(o=d[0].frame),a{n.r(t),n.d(t,{morphTargetsVertexGlobalDeclarationWGSL:()=>a});var r=n(98519),i="morphTargetsVertexGlobalDeclaration",o="#ifdef MORPHTARGETS\nuniform morphTargetInfluences : array;\n#ifdef MORPHTARGETS_TEXTURE \nuniform morphTargetTextureIndices : array;uniform morphTargetTextureInfo : vec3;var morphTargets : texture_2d_array;var morphTargetsSampler : sampler;fn readVector3FromRawSampler(targetIndex : i32,vertexIndex : f32)->vec3\n{ \nlet y=floor(vertexIndex/uniforms.morphTargetTextureInfo.y);let x=vertexIndex-y*uniforms.morphTargetTextureInfo.y;let textureUV=vec2((x+0.5)/uniforms.morphTargetTextureInfo.y,(y+0.5)/uniforms.morphTargetTextureInfo.z);return textureSampleLevel(morphTargets,morphTargetsSampler,textureUV,i32(uniforms.morphTargetTextureIndices[targetIndex]),0.0).xyz;}\nfn readVector4FromRawSampler(targetIndex : i32,vertexIndex : f32)->vec4\n{ \nlet y=floor(vertexIndex/uniforms.morphTargetTextureInfo.y);let x=vertexIndex-y*uniforms.morphTargetTextureInfo.y;let textureUV=vec2((x+0.5)/uniforms.morphTargetTextureInfo.y,(y+0.5)/uniforms.morphTargetTextureInfo.z);return textureSampleLevel(morphTargets,morphTargetsSampler,textureUV,i32(uniforms.morphTargetTextureIndices[targetIndex]),0.0);}\n#endif\n#endif\n";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]=o);var a={name:i,shader:o}},73758:(e,t,n)=>{n.r(t),n.d(t,{oitFinalPixelShader:()=>a});var r=n(98519),i="oitFinalPixelShader",o="precision highp float;uniform sampler2D uFrontColor;uniform sampler2D uBackColor;void main() {ivec2 fragCoord=ivec2(gl_FragCoord.xy);vec4 frontColor=texelFetch(uFrontColor,fragCoord,0);vec4 backColor=texelFetch(uBackColor,fragCoord,0);float alphaMultiplier=1.0-frontColor.a;glFragColor=vec4(\nfrontColor.rgb+alphaMultiplier*backColor.rgb,\nfrontColor.a+backColor.a\n);}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},73876:(e,t,n)=>{var r=n(98519),i="oitFragment";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="#ifdef ORDER_INDEPENDENT_TRANSPARENCY\nvar fragDepth: f32=fragmentInputs.position.z; \n#ifdef ORDER_INDEPENDENT_TRANSPARENCY_16BITS\nvar halfFloat: u32=pack2x16float( vec2f(fragDepth));var full: vec2f=unpack2x16float(halfFloat);fragDepth=full.x;\n#endif\nvar fragCoord: vec2i=vec2i(fragmentInputs.position.xy);var lastDepth: vec2f=textureLoad(oitDepthSampler,fragCoord,0).rg;var lastFrontColor: vec4f=textureLoad(oitFrontColorSampler,fragCoord,0);fragmentOutputs.depth=vec2f(-MAX_DEPTH);fragmentOutputs.frontColor=lastFrontColor;fragmentOutputs.backColor= vec4f(0.0);\n#ifdef USE_REVERSE_DEPTHBUFFER\nvar furthestDepth: f32=-lastDepth.x;var nearestDepth: f32=lastDepth.y;\n#else\nvar nearestDepth: f32=-lastDepth.x;var furthestDepth: f32=lastDepth.y;\n#endif\nvar alphaMultiplier: f32=1.0-lastFrontColor.a;\n#ifdef USE_REVERSE_DEPTHBUFFER\nif (fragDepth>nearestDepth || fragDepthfurthestDepth) {\n#endif\nreturn fragmentOutputs;}\n#ifdef USE_REVERSE_DEPTHBUFFER\nif (fragDepthfurthestDepth) {\n#else\nif (fragDepth>nearestDepth && fragDepth{n.r(t),n.d(t,{FlowGraphGetVariableBlock:()=>s});var r=n(78322),i=n(45749),o=n(88099),a=n(34623),s=function(e){function t(t){var n=e.call(this,t)||this;return n.config=t,n.value=n.registerDataOutput("value",o.Vv,t.initialValue),n}return(0,r.C6)(t,e),t.prototype._updateOutputs=function(e){var t=this.config.variable;e.hasVariable(t)&&this.value.setValue(e.getVariable(t),e)},t.prototype.serialize=function(t){e.prototype.serialize.call(this,t),t.config.variable=this.config.variable},t.prototype.getClassName=function(){return"FlowGraphGetVariableBlock"},t}(i.e);(0,a.Y5)("FlowGraphGetVariableBlock",s)},74239:(e,t,n)=>{n.d(t,{M:()=>u});var r=n(78322),i=n(66377),o=n(81152),a=n(7164),s=n(98519),l=n(76320),c=n(53695),u=function(){function e(t,n,r,o,a,s,c,u,h,d,p,f,m){void 0===o&&(o=null),void 0===s&&(s=null),void 0===c&&(c=null),void 0===u&&(u=null),void 0===h&&(h=null),void 0===p&&(p=""),void 0===f&&(f=0);var _,g,v,y,b=this;this.defines="",this.onCompiled=null,this.onError=null,this.onBind=null,this.uniqueId=0,this.onCompileObservable=new i.cP,this.onErrorObservable=new i.cP,this._onBindObservable=null,this._isDisposed=!1,this._refCount=1,this._bonesComputationForcedToCPU=!1,this._uniformBuffersNames={},this._multiTarget=!1,this._samplers={},this._isReady=!1,this._compilationError="",this._allFallbacksProcessed=!1,this._uniforms={},this._key="",this._fallbacks=null,this._vertexSourceCodeOverride="",this._fragmentSourceCodeOverride="",this._transformFeedbackVaryings=null,this._disableParallelShaderCompilation=!1,this._pipelineContext=null,this._vertexSourceCode="",this._fragmentSourceCode="",this._vertexSourceCodeBeforeMigration="",this._fragmentSourceCodeBeforeMigration="",this._rawVertexSourceCode="",this._rawFragmentSourceCode="",this._processCodeAfterIncludes=void 0,this._processFinalCode=null,this._onReleaseEffectsObserver=null,this.name=t,this._key=p;var S=this._key.replace(/\r/g,"").replace(/\n/g,"|"),T=void 0;if(n.attributes){var E=n;if(this._engine=r,this._attributesNames=E.attributes,this._uniformsNames=E.uniformsNames.concat(E.samplers),this._samplerList=E.samplers.slice(),this.defines=E.defines,this.onError=E.onError,this.onCompiled=E.onCompiled,this._fallbacks=E.fallbacks,this._indexParameters=E.indexParameters,this._transformFeedbackVaryings=E.transformFeedbackVaryings||null,this._multiTarget=!!E.multiTarget,this._shaderLanguage=null!==(_=E.shaderLanguage)&&void 0!==_?_:0,this._disableParallelShaderCompilation=!!E.disableParallelShaderCompilation,E.uniformBuffersNames){this._uniformBuffersNamesList=E.uniformBuffersNames.slice();for(var x=0;x=a&&(i="Offending line [".concat(a,"] in ").concat(n?"fragment":"vertex"," code: ").concat(s[a-1]))}}return[e,i]},e.prototype._processCompilationErrors=function(t,n){var r,i,o,s,l,c=this;void 0===n&&(n=null),this._compilationError=t.message;var u=this._attributesNames,h=this._fallbacks;if(a.V.Error("Unable to compile effect:"),a.V.Error("Uniforms: ".concat(this._uniformsNames.join(" "))),a.V.Error("Attributes: ".concat(u.join(" "))),a.V.Error("Defines:\n"+this.defines),e.LogShaderCodeOnCompilationError){var d=null,p=null,f=null;(null===(o=this._pipelineContext)||void 0===o?void 0:o._getVertexShaderCode())&&(f=(r=this._getShaderCodeAndErrorLine(this._pipelineContext._getVertexShaderCode(),this._compilationError,!1))[0],d=r[1],f&&(a.V.Error("Vertex code:"),a.V.Error(f))),(null===(s=this._pipelineContext)||void 0===s?void 0:s._getFragmentShaderCode())&&(f=(i=this._getShaderCodeAndErrorLine(null===(l=this._pipelineContext)||void 0===l?void 0:l._getFragmentShaderCode(),this._compilationError,!0))[0],p=i[1],f&&(a.V.Error("Fragment code:"),a.V.Error(f))),d&&a.V.Error(d),p&&a.V.Error(p)}a.V.Error("Error: "+this._compilationError);var m=function(){c.onError&&c.onError(c,c._compilationError),c.onErrorObservable.notifyObservers(c),c._engine.onEffectErrorObservable.notifyObservers({effect:c,errors:c._compilationError})};n&&(this._pipelineContext=n,this._isReady=!0,m()),h?(this._pipelineContext=null,h.hasMoreFallbacks?(this._allFallbacksProcessed=!1,a.V.Error("Trying next fallback."),this.defines=h.reduce(this.defines,this),this._prepareEffect()):(this._allFallbacksProcessed=!0,m(),this.onErrorObservable.clear(),this._fallbacks&&this._fallbacks.unBindMesh())):(this._allFallbacksProcessed=!0,n||m())},Object.defineProperty(e.prototype,"isSupported",{get:function(){return""===this._compilationError},enumerable:!1,configurable:!0}),e.prototype._bindTexture=function(e,t){this._engine._bindTexture(this._samplers[e],t,e)},e.prototype.setTexture=function(e,t){this._engine.setTexture(this._samplers[e],this._uniforms[e],t,e)},e.prototype.setTextureArray=function(e,t){var n=e+"Ex";if(-1===this._samplerList.indexOf(n+"0")){for(var r=this._samplerList.indexOf(e),i=1;i0||this._isDisposed||(this._onReleaseEffectsObserver&&(this._engine.onReleaseEffectsObservable.remove(this._onReleaseEffectsObserver),this._onReleaseEffectsObserver=null),this._pipelineContext&&(0,l.mO)(this._pipelineContext),this._engine._releaseEffect(this),this.clearCodeCache(),this._isDisposed=!0)},e.RegisterShader=function(e,t,n,r){void 0===r&&(r=0),t&&(s.l.GetShadersStore(r)["".concat(e,"PixelShader")]=t),n&&(s.l.GetShadersStore(r)["".concat(e,"VertexShader")]=n)},e.ResetCache=function(){e._BaseCache={}},e.LogShaderCodeOnCompilationError=!0,e.PersistentMode=!1,e.AutomaticallyClearCodeCache=!1,e._UniqueIdSeed=0,e._BaseCache={},e.ShadersStore=s.l.ShadersStore,e.IncludesShadersStore=s.l.IncludesShadersStore,e}()},74616:(e,t,n)=>{n.r(t),n.d(t,{lightProxyVertexShader:()=>a});var r=n(98519),i=(n(20097),n(50851),n(2495),"lightProxyVertexShader"),o="attribute vec3 position;flat varying vec2 vLimits;flat varying highp uint vMask;\n#include<__decl__sceneVertex>\nuniform sampler2D lightDataTexture;uniform vec3 tileMaskResolution;\n#include\nvoid main(void) {ClusteredLight light=getClusteredLight(lightDataTexture,gl_InstanceID);float range=light.vLightFalloff.x;vec4 viewPosition=view*vec4(light.vLightData.xyz,1);vec4 viewPositionSq=viewPosition*viewPosition;vec2 distSq=viewPositionSq.xy+viewPositionSq.z;vec2 sinSq=(range*range)/distSq;vec2 cosSq=max(1.0-sinSq,0.01);vec2 sinCos=position.xy*sqrt(sinSq*cosSq);vec2 rotatedX=mat2(cosSq.x,-sinCos.x,sinCos.x,cosSq.x)*viewPosition.xz;vec2 rotatedY=mat2(cosSq.y,-sinCos.y,sinCos.y,cosSq.y)*viewPosition.yz;vec4 projX=projection*vec4(rotatedX.x,0,rotatedX.y,1);vec4 projY=projection*vec4(0,rotatedY.x,rotatedY.y,1);vec2 projPosition=vec2(projX.x/max(projX.w,0.01),projY.y/max(projY.w,0.01));projPosition=mix(position.xy,projPosition,greaterThan(cosSq,vec2(0.01)));vec2 halfTileRes=tileMaskResolution.xy/2.0;vec2 tilePosition=(projPosition+1.0)*halfTileRes;tilePosition=mix(floor(tilePosition)-0.01,ceil(tilePosition)+0.01,greaterThan(position.xy,vec2(0)));float offset=float(gl_InstanceID/CLUSTLIGHT_BATCH)*tileMaskResolution.y;tilePosition.y=(tilePosition.y+offset)/tileMaskResolution.z;gl_Position=vec4(tilePosition/halfTileRes-1.0,0,1);vLimits=vec2(offset,offset+tileMaskResolution.y);vMask=1u<<(gl_InstanceID % CLUSTLIGHT_BATCH);}\n";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},75034:(e,t,n)=>{n.d(t,{l:()=>l});var r=n(78322),i=n(34623),o=n(10338),a=n(66377),s=n(38810),l=function(e){function t(t,n,r,i,o,s){void 0===o&&(o=i.defaultValue),void 0===s&&(s=!1);var l=e.call(this,t,n,r)||this;return l.richType=i,l._defaultValue=o,l._optional=s,l._isDisabled=!1,l._lastValue=null,l.dataTransformer=null,l.onValueChangedObservable=new a.cP,l}return(0,r.C6)(t,e),Object.defineProperty(t.prototype,"optional",{get:function(){return this._optional},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isDisabled",{get:function(){return this._isDisabled},set:function(e){this._isDisabled!==e&&(this._isDisabled=e,this._isDisabled&&this.disconnectFromAll())},enumerable:!1,configurable:!0}),t.prototype._isSingularConnection=function(){return 0===this.connectionType},t.prototype.setValue=function(e,t){t._getConnectionValue(this)!==e&&(t._setConnectionValue(this,e),this.onValueChangedObservable.notifyObservers(e))},t.prototype.resetToDefaultValue=function(e){e._setConnectionValue(this,this._defaultValue)},t.prototype.connectTo=function(t){this._isDisabled||e.prototype.connectTo.call(this,t)},t.prototype._getValueOrDefault=function(e){var t,n=null!==(t=e._getConnectionValue(this))&&void 0!==t?t:this._defaultValue;return this.dataTransformer?this.dataTransformer(n):n},t.prototype.getValue=function(e){if(1===this.connectionType){e._notifyExecuteNode(this._ownerBlock),this._ownerBlock._updateOutputs(e);var t=this._getValueOrDefault(e);return this._lastValue=t,this.richType.typeTransformer?this.richType.typeTransformer(t):t}var n=this.isConnected()?this._connectedPoint[0].getValue(e):this._getValueOrDefault(e);return this._lastValue=n,this.richType.typeTransformer?this.richType.typeTransformer(n):n},t.prototype._getLastValue=function(){return this._lastValue},t.prototype.getClassName=function(){return"FlowGraphDataConnection"},t.prototype.serialize=function(t){void 0===t&&(t={}),e.prototype.serialize.call(this,t),t.richType={},this.richType.serialize(t.richType),t.optional=this._optional,(0,s.X5)("defaultValue",this._defaultValue,t)},t}(o.X);(0,i.Y5)("FlowGraphDataConnection",l)},75227:(e,t,n)=>{n.d(t,{H:()=>p});var r=n(78322),i=n(6174),o=n(12028),a=n(34623),s=n(50582),l=n(62273),c=n(7164),u=n(55204),h=n(37411),d=n(53695),p=function(){function e(e,t,n,i){void 0===i&&(i={}),this._bindings={},this._samplers={},this._contextIsDirty=!1,this.fastMode=!1,this.onCompiled=null,this.onError=null,this.name=e,this._engine=t,this.uniqueId=l.K.UniqueId,t.enableGPUTimingMeasurements&&(this.gpuTimeInFrame=new h.e),this._engine.getCaps().supportComputeShaders?i.bindingsMapping?(this._context=t.createComputeContext(),this._shaderPath=n,this._options=(0,r.Cl)({bindingsMapping:{},defines:[]},i)):c.V.Error("You must provide the binding mappings as browsers don't support reflection for wgsl shaders yet!"):c.V.Error("This engine does not support compute shaders!")}return Object.defineProperty(e.prototype,"options",{get:function(){return this._options},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shaderPath",{get:function(){return this._shaderPath},enumerable:!1,configurable:!0}),e.prototype.getClassName=function(){return"ComputeShader"},e.prototype.setTexture=function(e,t,n){void 0===n&&(n=!0);var r=this._bindings[e];this._bindings[e]={type:n?0:4,object:t,indexInGroupEntries:null==r?void 0:r.indexInGroupEntries},this._contextIsDirty||(this._contextIsDirty=!r||r.object!==t||r.type!==this._bindings[e].type)},e.prototype.setInternalTexture=function(e,t){var n=this._bindings[e];this._bindings[e]={type:8,object:t,indexInGroupEntries:null==n?void 0:n.indexInGroupEntries},this._contextIsDirty||(this._contextIsDirty=!n||n.object!==t||n.type!==this._bindings[e].type)},e.prototype.setStorageTexture=function(e,t){var n=this._bindings[e];this._contextIsDirty||(this._contextIsDirty=!n||n.object!==t),this._bindings[e]={type:1,object:t,indexInGroupEntries:null==n?void 0:n.indexInGroupEntries}},e.prototype.setExternalTexture=function(e,t){var n=this._bindings[e];this._contextIsDirty||(this._contextIsDirty=!n||n.object!==t),this._bindings[e]={type:6,object:t,indexInGroupEntries:null==n?void 0:n.indexInGroupEntries}},e.prototype.setVideoTexture=function(e,t){return!!t.externalTexture&&(this.setExternalTexture(e,t.externalTexture),!0)},e.prototype.setUniformBuffer=function(t,n){var r=this._bindings[t];this._contextIsDirty||(this._contextIsDirty=!r||r.object!==n),this._bindings[t]={type:e._BufferIsDataBuffer(n)?7:2,object:n,indexInGroupEntries:null==r?void 0:r.indexInGroupEntries}},e.prototype.setStorageBuffer=function(t,n){var r=this._bindings[t];this._contextIsDirty||(this._contextIsDirty=!r||r.object!==n),this._bindings[t]={type:e._BufferIsDataBuffer(n)?7:3,object:n,indexInGroupEntries:null==r?void 0:r.indexInGroupEntries}},e.prototype.setTextureSampler=function(e,t){var n=this._bindings[e];this._contextIsDirty||(this._contextIsDirty=!n||!t.compareSampler(n.object)),this._bindings[e]={type:5,object:t,indexInGroupEntries:null==n?void 0:n.indexInGroupEntries}},e.prototype.isReady=function(){var e=this._effect;for(var t in this._bindings){var n=this._bindings[t],r=n.type,i=n.object;switch(r){case 0:case 4:case 1:case 6:if(!i.isReady())return!1}}var o=[],a=this._shaderPath;if(this._options.defines)for(var s=0;s{n.r(t),n.d(t,{helperFunctions:()=>a});var r=n(98519),i="helperFunctions",o="const float PI=3.1415926535897932384626433832795;const float TWO_PI=6.283185307179586;const float HALF_PI=1.5707963267948966;const float RECIPROCAL_PI=0.3183098861837907;const float RECIPROCAL_PI2=0.15915494309189535;const float RECIPROCAL_PI4=0.07957747154594767;const float HALF_MIN=5.96046448e-08; \nconst float LinearEncodePowerApprox=2.2;const float GammaEncodePowerApprox=1.0/LinearEncodePowerApprox;const vec3 LuminanceEncodeApprox=vec3(0.2126,0.7152,0.0722);const float Epsilon=0.0000001;\n#define saturate(x) clamp(x,0.0,1.0)\n#define absEps(x) abs(x)+Epsilon\n#define maxEps(x) max(x,Epsilon)\n#define saturateEps(x) clamp(x,Epsilon,1.0)\nmat3 transposeMat3(mat3 inMatrix) {vec3 i0=inMatrix[0];vec3 i1=inMatrix[1];vec3 i2=inMatrix[2];mat3 outMatrix=mat3(\nvec3(i0.x,i1.x,i2.x),\nvec3(i0.y,i1.y,i2.y),\nvec3(i0.z,i1.z,i2.z)\n);return outMatrix;}\nmat3 inverseMat3(mat3 inMatrix) {float a00=inMatrix[0][0],a01=inMatrix[0][1],a02=inMatrix[0][2];float a10=inMatrix[1][0],a11=inMatrix[1][1],a12=inMatrix[1][2];float a20=inMatrix[2][0],a21=inMatrix[2][1],a22=inMatrix[2][2];float b01=a22*a11-a12*a21;float b11=-a22*a10+a12*a20;float b21=a21*a10-a11*a20;float det=a00*b01+a01*b11+a02*b21;return mat3(b01,(-a22*a01+a02*a21),(a12*a01-a02*a11),\nb11,(a22*a00-a02*a20),(-a12*a00+a02*a10),\nb21,(-a21*a00+a01*a20),(a11*a00-a01*a10))/det;}\n#if USE_EXACT_SRGB_CONVERSIONS\nvec3 toLinearSpaceExact(vec3 color)\n{vec3 nearZeroSection=0.0773993808*color;vec3 remainingSection=pow(0.947867299*(color+vec3(0.055)),vec3(2.4));\n#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\nreturn mix(remainingSection,nearZeroSection,lessThanEqual(color,vec3(0.04045)));\n#else\nreturn\nvec3(\ncolor.r<=0.04045 ? nearZeroSection.r : remainingSection.r,\ncolor.g<=0.04045 ? nearZeroSection.g : remainingSection.g,\ncolor.b<=0.04045 ? nearZeroSection.b : remainingSection.b);\n#endif\n}\nvec3 toGammaSpaceExact(vec3 color)\n{vec3 nearZeroSection=12.92*color;vec3 remainingSection=1.055*pow(color,vec3(0.41666))-vec3(0.055);\n#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\nreturn mix(remainingSection,nearZeroSection,lessThanEqual(color,vec3(0.0031308)));\n#else\nreturn\nvec3(\ncolor.r<=0.0031308 ? nearZeroSection.r : remainingSection.r,\ncolor.g<=0.0031308 ? nearZeroSection.g : remainingSection.g,\ncolor.b<=0.0031308 ? nearZeroSection.b : remainingSection.b);\n#endif\n}\n#endif\nfloat toLinearSpace(float color)\n{\n#if USE_EXACT_SRGB_CONVERSIONS\nfloat nearZeroSection=0.0773993808*color;float remainingSection=pow(0.947867299*(color+0.055),2.4);return color<=0.04045 ? nearZeroSection : remainingSection;\n#else\nreturn pow(color,LinearEncodePowerApprox);\n#endif\n}\nvec3 toLinearSpace(vec3 color)\n{\n#if USE_EXACT_SRGB_CONVERSIONS\nreturn toLinearSpaceExact(color);\n#else\nreturn pow(color,vec3(LinearEncodePowerApprox));\n#endif\n}\nvec4 toLinearSpace(vec4 color)\n{\n#if USE_EXACT_SRGB_CONVERSIONS\nreturn vec4(toLinearSpaceExact(color.rgb),color.a);\n#else\nreturn vec4(pow(color.rgb,vec3(LinearEncodePowerApprox)),color.a);\n#endif\n}\nfloat toGammaSpace(float color)\n{\n#if USE_EXACT_SRGB_CONVERSIONS\nfloat nearZeroSection=12.92*color;float remainingSection=1.055*pow(color,0.41666)-0.055;return color<=0.0031308 ? nearZeroSection : remainingSection;\n#else\nreturn pow(color,GammaEncodePowerApprox);\n#endif\n}\nvec3 toGammaSpace(vec3 color)\n{\n#if USE_EXACT_SRGB_CONVERSIONS\nreturn toGammaSpaceExact(color);\n#else\nreturn pow(color,vec3(GammaEncodePowerApprox));\n#endif\n}\nvec4 toGammaSpace(vec4 color)\n{\n#if USE_EXACT_SRGB_CONVERSIONS\nreturn vec4(toGammaSpaceExact(color.rgb),color.a);\n#else\nreturn vec4(pow(color.rgb,vec3(GammaEncodePowerApprox)),color.a);\n#endif\n}\nfloat square(float value)\n{return value*value;}\nvec3 square(vec3 value)\n{return value*value;}\nfloat pow5(float value) {float sq=value*value;return sq*sq*value;}\nfloat getLuminance(vec3 color)\n{return saturate(dot(color,LuminanceEncodeApprox));}\nfloat getRand(vec2 seed) {return fract(sin(dot(seed.xy ,vec2(12.9898,78.233)))*43758.5453);}\nfloat dither(vec2 seed,float varianceAmount) {float rand=getRand(seed);float normVariance=varianceAmount/255.0;float dither=mix(-normVariance,normVariance,rand);return dither;}\nconst float rgbdMaxRange=255.;vec4 toRGBD(vec3 color) {float maxRGB=maxEps(max(color.r,max(color.g,color.b)));float D =max(rgbdMaxRange/maxRGB,1.);D =saturate(floor(D)/255.);vec3 rgb=color.rgb*D;rgb=toGammaSpace(rgb);return vec4(saturate(rgb),D);}\nvec3 fromRGBD(vec4 rgbd) {rgbd.rgb=toLinearSpace(rgbd.rgb);return rgbd.rgb/rgbd.a;}\nvec3 parallaxCorrectNormal( vec3 vertexPos,vec3 origVec,vec3 cubeSize,vec3 cubePos ) {vec3 invOrigVec=vec3(1.)/origVec;vec3 halfSize=cubeSize*0.5;vec3 intersecAtMaxPlane=(cubePos+halfSize-vertexPos)*invOrigVec;vec3 intersecAtMinPlane=(cubePos-halfSize-vertexPos)*invOrigVec;vec3 largestIntersec=max(intersecAtMaxPlane,intersecAtMinPlane);float distance=min(min(largestIntersec.x,largestIntersec.y),largestIntersec.z);vec3 intersectPositionWS=vertexPos+origVec*distance;return intersectPositionWS-cubePos;}\nvec3 equirectangularToCubemapDirection(vec2 uv) {float longitude=uv.x*TWO_PI-PI;float latitude=HALF_PI-uv.y*PI;vec3 direction;direction.x=cos(latitude)*sin(longitude);direction.y=sin(latitude);direction.z=cos(latitude)*cos(longitude);return direction;}\nfloat sqrtClamped(float value) {return sqrt(max(value,0.));}\nfloat avg(vec3 value) {return dot(value,vec3(0.333333333));}\n#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE) \nuint extractBits(uint value,int offset,int width) {return (value>>offset) & ((1u<>23)-0x7f;}\n#endif\n";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]=o);var a={name:i,shader:o}},75394:(e,t,n)=>{n.r(t),n.d(t,{bumpFragmentFunctions:()=>a});var r=n(98519),i=(n(37755),"bumpFragmentFunctions"),o="#if defined(BUMP)\n#include(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump,_SAMPLERNAME_,bump)\n#endif\n#if defined(DETAIL)\n#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail,_SAMPLERNAME_,detail)\n#endif\n#if defined(BUMP) && defined(PARALLAX)\nconst float minSamples=4.;const float maxSamples=15.;const int iMaxSamples=15;vec2 parallaxOcclusion(vec3 vViewDirCoT,vec3 vNormalCoT,vec2 texCoord,float parallaxScale) {float parallaxLimit=length(vViewDirCoT.xy)/vViewDirCoT.z;parallaxLimit*=parallaxScale;vec2 vOffsetDir=normalize(vViewDirCoT.xy);vec2 vMaxOffset=vOffsetDir*parallaxLimit;float numSamples=maxSamples+(dot(vViewDirCoT,vNormalCoT)*(minSamples-maxSamples));float stepSize=1.0/numSamples;float currRayHeight=1.0;vec2 vCurrOffset=vec2(0,0);vec2 vLastOffset=vec2(0,0);float lastSampledHeight=1.0;float currSampledHeight=1.0;bool keepWorking=true;for (int i=0; icurrRayHeight)\n{float delta1=currSampledHeight-currRayHeight;float delta2=(currRayHeight+stepSize)-lastSampledHeight;float ratio=delta1/(delta1+delta2);vCurrOffset=(ratio)* vLastOffset+(1.0-ratio)*vCurrOffset;keepWorking=false;}\nelse\n{currRayHeight-=stepSize;vLastOffset=vCurrOffset;\n#ifdef PARALLAX_RHS\nvCurrOffset-=stepSize*vMaxOffset;\n#else\nvCurrOffset+=stepSize*vMaxOffset;\n#endif\nlastSampledHeight=currSampledHeight;}}\nreturn vCurrOffset;}\nvec2 parallaxOffset(vec3 viewDir,float heightScale)\n{float height=texture2D(bumpSampler,vBumpUV).w;vec2 texCoordOffset=heightScale*viewDir.xy*height;\n#ifdef PARALLAX_RHS\nreturn texCoordOffset;\n#else\nreturn -texCoordOffset;\n#endif\n}\n#endif\n";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]=o);var a={name:i,shader:o}},75417:(e,t,n)=>{n.r(t),n.d(t,{glowMapGenerationPixelShader:()=>a});var r=n(98519),i=(n(75334),n(27003),n(39643),"glowMapGenerationPixelShader"),o="#if defined(DIFFUSE_ISLINEAR) || defined(EMISSIVE_ISLINEAR)\n#include\n#endif\n#ifdef DIFFUSE\nvarying vec2 vUVDiffuse;uniform sampler2D diffuseSampler;\n#endif\n#ifdef OPACITY\nvarying vec2 vUVOpacity;uniform sampler2D opacitySampler;uniform float opacityIntensity;\n#endif\n#ifdef EMISSIVE\nvarying vec2 vUVEmissive;uniform sampler2D emissiveSampler;\n#endif\n#ifdef VERTEXALPHA\nvarying vec4 vColor;\n#endif\nuniform vec4 glowColor;uniform float glowIntensity;\n#include\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\n#include\nvec4 finalColor=glowColor;\n#ifdef DIFFUSE\nvec4 albedoTexture=texture2D(diffuseSampler,vUVDiffuse);\n#ifdef DIFFUSE_ISLINEAR\nalbedoTexture=toGammaSpace(albedoTexture);\n#endif\n#ifdef GLOW\nfinalColor.a*=albedoTexture.a;\n#endif\n#ifdef HIGHLIGHT\nfinalColor.a=albedoTexture.a;\n#endif\n#endif\n#ifdef OPACITY\nvec4 opacityMap=texture2D(opacitySampler,vUVOpacity);\n#ifdef OPACITYRGB\nfinalColor.a*=getLuminance(opacityMap.rgb);\n#else\nfinalColor.a*=opacityMap.a;\n#endif\nfinalColor.a*=opacityIntensity;\n#endif\n#ifdef VERTEXALPHA\nfinalColor.a*=vColor.a;\n#endif\n#ifdef ALPHATEST\nif (finalColor.a{n.d(t,{D:()=>o});var r=n(7164),i=n(44957),o=function(){function e(e,t,n,r,i,o){void 0===n&&(n=!1),void 0===i&&(i=!1),this._uniformNames=[],this._valueCache={},this._engine=e,this._noUBO=!e.supportsUniformBuffers||i,this._dynamic=n,this._name=null!=r?r:"no-name",this._data=t||[],this._uniformLocations={},this._uniformSizes={},this._uniformArraySizes={},this._uniformLocationPointer=0,this._needSync=!1,this._trackUBOsInFrame=!1,(void 0===o&&this._engine._features.trackUbosInFrame||!0===o)&&(this._buffers=[],this._bufferIndex=-1,this._createBufferOnWrite=!1,this._currentFrameId=0,this._trackUBOsInFrame=!0),this._noUBO?(this.updateMatrix3x3=this._updateMatrix3x3ForEffect,this.updateMatrix2x2=this._updateMatrix2x2ForEffect,this.updateFloat=this._updateFloatForEffect,this.updateFloat2=this._updateFloat2ForEffect,this.updateFloat3=this._updateFloat3ForEffect,this.updateFloat4=this._updateFloat4ForEffect,this.updateFloatArray=this._updateFloatArrayForEffect,this.updateArray=this._updateArrayForEffect,this.updateIntArray=this._updateIntArrayForEffect,this.updateUIntArray=this._updateUIntArrayForEffect,this.updateMatrix=this._updateMatrixForEffect,this.updateMatrices=this._updateMatricesForEffect,this.updateVector3=this._updateVector3ForEffect,this.updateVector4=this._updateVector4ForEffect,this.updateColor3=this._updateColor3ForEffect,this.updateColor4=this._updateColor4ForEffect,this.updateDirectColor4=this._updateDirectColor4ForEffect,this.updateInt=this._updateIntForEffect,this.updateInt2=this._updateInt2ForEffect,this.updateInt3=this._updateInt3ForEffect,this.updateInt4=this._updateInt4ForEffect,this.updateUInt=this._updateUIntForEffect,this.updateUInt2=this._updateUInt2ForEffect,this.updateUInt3=this._updateUInt3ForEffect,this.updateUInt4=this._updateUInt4ForEffect):(this._engine._uniformBuffers.push(this),this.updateMatrix3x3=this._updateMatrix3x3ForUniform,this.updateMatrix2x2=this._updateMatrix2x2ForUniform,this.updateFloat=this._updateFloatForUniform,this.updateFloat2=this._updateFloat2ForUniform,this.updateFloat3=this._updateFloat3ForUniform,this.updateFloat4=this._updateFloat4ForUniform,this.updateFloatArray=this._updateFloatArrayForUniform,this.updateArray=this._updateArrayForUniform,this.updateIntArray=this._updateIntArrayForUniform,this.updateUIntArray=this._updateUIntArrayForUniform,this.updateMatrix=this._updateMatrixForUniform,this.updateMatrices=this._updateMatricesForUniform,this.updateVector3=this._updateVector3ForUniform,this.updateVector4=this._updateVector4ForUniform,this.updateColor3=this._updateColor3ForUniform,this.updateColor4=this._updateColor4ForUniform,this.updateDirectColor4=this._updateDirectColor4ForUniform,this.updateInt=this._updateIntForUniform,this.updateInt2=this._updateInt2ForUniform,this.updateInt3=this._updateInt3ForUniform,this.updateInt4=this._updateInt4ForUniform,this.updateUInt=this._updateUIntForUniform,this.updateUInt2=this._updateUInt2ForUniform,this.updateUInt3=this._updateUInt3ForUniform,this.updateUInt4=this._updateUInt4ForUniform)}return Object.defineProperty(e.prototype,"useUbo",{get:function(){return!this._noUBO},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isSync",{get:function(){return!this._needSync},enumerable:!1,configurable:!0}),e.prototype.isDynamic=function(){return this._dynamic},e.prototype.getData=function(){return this._bufferData},e.prototype.getBuffer=function(){return this._buffer},e.prototype.getUniformNames=function(){return this._uniformNames},e.prototype._fillAlignment=function(e){var t;if(t=e<=2?e:4,this._uniformLocationPointer%t!==0){var n=this._uniformLocationPointer;this._uniformLocationPointer+=t-this._uniformLocationPointer%t;for(var r=this._uniformLocationPointer-n,i=0;i0&&"number"==typeof t&&(this._uniformArraySizes[e]={strideSize:t,arraySize:n}),void 0===this._uniformLocations[e]&&(this._uniformNames.push(e),!this._noUBO)){var r;if(n>0){if(t instanceof Array)throw"addUniform should not be use with Array in UBO: "+e;this._fillAlignment(4),16==t?t*=n:t=t*n+(4-t)*n,r=[];for(var i=0;i1&&this._buffers[this._bufferIndex][1]){if(this._buffersEqual(this._bufferData,this._buffers[this._bufferIndex][1]))return this._needSync=!1,void(this._createBufferOnWrite=this._trackUBOsInFrame);this._copyBuffer(this._bufferData,this._buffers[this._bufferIndex][1])}this._engine.updateUniformBuffer(this._buffer,this._bufferData),this._engine._features._collectUbosUpdatedInFrame&&(e._UpdatedUbosInFrame[this._name]||(e._UpdatedUbosInFrame[this._name]=0),e._UpdatedUbosInFrame[this._name]++),this._needSync=!1,this._createBufferOnWrite=this._trackUBOsInFrame}else this._createBufferOnWrite=this._trackUBOsInFrame;else this.create()},e.prototype._createNewBuffer=function(){this._bufferIndex+10?(this._needSync=0!==this._bufferIndex,this._bufferIndex=0,this._buffer=this._buffers[this._bufferIndex][0]):this._bufferIndex=-1)},e.prototype.updateUniform=function(e,t,n){this._checkNewFrame();var i=this._uniformLocations[e];if(void 0===i){if(this._buffer)return void r.V.Error("Cannot add an uniform after UBO has been created. uniformName="+e);this.addUniform(e,n),i=this._uniformLocations[e]}if(this._buffer||this.create(),this._dynamic)for(a=0;a1&&this._buffers[t][1]&&this._bufferData.set(this._buffers[t][1]),this._valueCache={},this._currentFrameId=this._engine.frameId,!0;return!1},e.prototype.has=function(e){return void 0!==this._uniformLocations[e]},e.prototype.dispose=function(){if(!this._noUBO){var e=this._engine._uniformBuffers,t=e.indexOf(this);if(-1!==t&&(e[t]=e[e.length-1],e.pop()),this._trackUBOsInFrame&&this._buffers)for(var n=0;n{n.r(t),n.d(t,{iblShadowVoxelTracingPixelShaderWGSL:()=>a});var r=n(98519),i="iblShadowVoxelTracingPixelShader",o="#define PI 3.1415927\nvarying vUV: vec2f;\n#define DISABLE_UNIFORMITY_ANALYSIS\nvar depthSampler: texture_2d;var worldNormalSampler : texture_2d;var blueNoiseSampler: texture_2d;var icdfSamplerSampler: sampler;var icdfSampler: texture_2d;var voxelGridSamplerSampler: sampler;var voxelGridSampler: texture_3d;\n#ifdef COLOR_SHADOWS\nvar iblSamplerSampler: sampler;var iblSampler: texture_cube;\n#endif\nuniform shadowParameters: vec4f;\n#define SHADOWdirs uniforms.shadowParameters.x\n#define SHADOWframe uniforms.shadowParameters.y\n#define SHADOWenvRot uniforms.shadowParameters.w\nuniform voxelBiasParameters : vec4f;\n#define highestMipLevel uniforms.voxelBiasParameters.z\nuniform sssParameters: vec4f;\n#define SSSsamples uniforms.sssParameters.x\n#define SSSstride uniforms.sssParameters.y\n#define SSSmaxDistance uniforms.sssParameters.z\n#define SSSthickness uniforms.sssParameters.w\nuniform shadowOpacity: vec4f;uniform projMtx: mat4x4f;uniform viewMtx: mat4x4f;uniform invProjMtx: mat4x4f;uniform invViewMtx: mat4x4f;uniform wsNormalizationMtx: mat4x4f;uniform invVPMtx: mat4x4f;\n#define PI 3.1415927\n#define GOLD 0.618034\nstruct AABB3f {m_min: vec3f,\nm_max: vec3f,};struct Ray {orig: vec3f,\ndir: vec3f,\ndir_rcp: vec3f,\nt_min: f32,\nt_max: f32,};fn make_ray(origin: vec3f,direction: vec3f,tmin: f32,\ntmax: f32)->Ray {var ray: Ray;ray.orig=origin;ray.dir=direction;ray.dir_rcp=1.0f/direction;ray.t_min=tmin;ray.t_max=tmax;return ray;}\nfn ray_box_intersection(aabb: AABB3f,ray: Ray ,\ndistance_near: ptr,distance_far: ptr)->bool{var tbot: vec3f=ray.dir_rcp*(aabb.m_min-ray.orig);var ttop: vec3f=ray.dir_rcp*(aabb.m_max-ray.orig);var tmin: vec3f=min(ttop,tbot);var tmax: vec3f=max(ttop,tbot);*distance_near=max(ray.t_min,max(tmin.x,max(tmin.y,tmin.z)));*distance_far=min(ray.t_max,min(tmax.x,min(tmax.y,tmax.z)));return *distance_near<=*distance_far;}\n#if VOXEL_MARCH_DIAGNOSTIC_INFO_OPTION\nstruct VoxelMarchDiagnosticInfo {heat: f32,\nvoxel_intersect_coords: vec3i,};\n#endif\nfn hash(i: u32)->u32 {var temp=i ^ (i>>16u);temp*=0x7FEB352Du;temp ^= temp>>15u;temp*=0x846CA68Bu;temp ^= temp>>16u;return temp;}\nfn uintBitsToFloat(x: u32)->f32 {return bitcast(x);}\nfn uint2float(i: u32)->f32 {return uintBitsToFloat(0x3F800000u | (i>>9u))-1.0;}\nfn uv_to_normal(uv: vec2f)->vec3f {var N: vec3f;var uvRange: vec2f=uv;var theta: f32=uvRange.x*2.0*PI;var phi: f32=uvRange.y*PI;N.x=cos(theta)*sin(phi);N.z=sin(theta)*sin(phi);N.y=cos(phi);return N;}\nfn plasticSequence(rstate: u32)->vec2f {return vec2f(uint2float(rstate*3242174889u),\nuint2float(rstate*2447445414u));}\nfn goldenSequence(rstate: u32)->f32 {return uint2float(rstate*2654435769u);}\nfn distanceSquared(a: vec2f,b: vec2f)->f32 {var diff: vec2f=a-b;return dot(diff,diff);}\nfn genTB(N: vec3f,T: ptr,B: ptr) {var s: f32=select(1.0,-1.0,N.z<0.0);var a: f32=-1.0/(s+N.z);var b: f32=N.x*N.y*a;*T= vec3f(1.0+s*N.x*N.x*a,s*b,-s*N.x);*B= vec3f(b,s+N.y*N.y*a,-N.y);}\nfn lessThan(x: vec3f,y: vec3f)->vec3 {return x)->bool {\n#else\nfn anyHitVoxels(ray_vs: Ray)->bool {\n#endif\nvar stack=array(); \nvar invD: vec3f=ray_vs.dir_rcp;var D: vec3f=ray_vs.dir;var O: vec3f=ray_vs.orig;var negD=vec3i(lessThan(D, vec3f(0,0,0)));var voxel0: i32=negD.x | (negD.y<<1) | (negD.z<<2);var t0: vec3f=-O*invD;var t1=(vec3f(1.0)-O)*invD;var maxLod: i32= i32(highestMipLevel);var stackLevel: i32=0;\n#if VOXEL_MARCH_DIAGNOSTIC_INFO_OPTION\nvar steps: u32=0u;\n#endif\nstack[stackLevel]=maxLod<<24;stackLevel++;while (stackLevel>0) {stackLevel=stackLevel-1;var elem: i32=stack[stackLevel];var Coords: vec4i =\nvec4i(elem & 0xFF,(elem>>8) & 0xFF,(elem>>16) & 0xFF,elem>>24);if (Coords.w==0) {\n#if VOXEL_MARCH_DIAGNOSTIC_INFO_OPTION\n*voxel_march_diagnostic_info.heat= f32(steps)/24.0;\n#endif\nreturn true;}\n#if VOXEL_MARCH_DIAGNOSTIC_INFO_OPTION\n++steps;\n#endif\nvar invRes: f32=exp2(f32(Coords.w-maxLod));var bbmin: vec3f=invRes*vec3f(Coords.xyz+negD);var bbmax: vec3f=invRes*vec3f(Coords.xyz-negD+vec3i(1));var mint: vec3f=mix(t0,t1,bbmin);var maxt: vec3f=mix(t0,t1,bbmax);var midt: vec3f=0.5*(mint+maxt);mint.x=max(0.0,mint.x);midt.x=max(0.0,midt.x);var nodeMask: u32= u32(\nround(textureLoad(voxelGridSampler,Coords.xyz,Coords.w).x*255.0));Coords.w--;var voxelBit: u32=u32(voxel0);Coords=vec4i((Coords.xyz<f32 {return (near*far)/(far-depth*(far-near));}\nfn screenSpaceShadow(csOrigin: vec3f,csDirection: vec3f,csZBufferSize: vec2f,\nnearPlaneZ: f32,farPlaneZ: f32,noise: f32)->f32 {\n#ifdef RIGHT_HANDED\nvar csZDir : f32=-1.0;\n#else \nvar csZDir : f32=1.0;\n#endif\nvar ssSamples: f32=SSSsamples;var ssMaxDist: f32=SSSmaxDistance;var ssStride: f32=SSSstride;var ssThickness: f32=SSSthickness;var rayLength: f32 =\nselect(ssMaxDist,(nearPlaneZ-csOrigin.z)/csDirection.z,\ncsZDir*(csOrigin.z+ssMaxDist*csDirection.z)0.0 && stepCount)->f32 {\n#else\nfn voxelShadow(wsOrigin: vec3f,wsDirection: vec3f,wsNormal: vec3f,\nDitherNoise: vec2f)->f32 {\n#endif\nvar vxResolution: f32=f32(textureDimensions(voxelGridSampler,0).x);var T: vec3f;var B: vec3f;genTB(wsDirection,&T,&B);var DitherXY: vec2f=sqrt(DitherNoise.x)* vec2f(cos(2.0*PI*DitherNoise.y),\nsin(2.0*PI*DitherNoise.y));var Dithering : vec3f=(uniforms.voxelBiasParameters.x*wsNormal +\nuniforms.voxelBiasParameters.y*wsDirection +\nDitherXY.x*T+DitherXY.y*B) /\nvxResolution;var O: vec3f=0.5*wsOrigin+0.5+Dithering;var ray_vs=make_ray(O,wsDirection,0.0,10.0);var voxel_aabb: AABB3f;voxel_aabb.m_min=vec3f(0);voxel_aabb.m_max=vec3f(1);var near: f32=0;var far: f32=0;if (!ray_box_intersection(voxel_aabb,ray_vs,&near,&far)) {return 0.0;}\nray_vs.t_min=max(ray_vs.t_min,near);ray_vs.t_max=min(ray_vs.t_max,far);\n#if VOXEL_MARCH_DIAGNOSTIC_INFO_OPTION\nreturn select(0.0f,1.0f,anyHitVoxels(ray_vs,voxel_march_diagnostic_info));\n#else\nreturn select(0.0f,1.0f,anyHitVoxels(ray_vs));\n#endif\n}\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var nbDirs=u32(SHADOWdirs);var frameId=u32(SHADOWframe);var envRot: f32=SHADOWenvRot;var Resolution: vec2f= vec2f(textureDimensions(depthSampler,0));var currentPixel=vec2i(fragmentInputs.vUV*Resolution);var GlobalIndex =\n(frameId*u32(Resolution.y)+u32(currentPixel.y))*u32(Resolution.x) +\nu32(currentPixel.x);var N : vec3f=textureLoad(worldNormalSampler,currentPixel,0).xyz;if (length(N)<0.01) {fragmentOutputs.color=vec4f(1.0,1.0,0.0,1.0);return fragmentOutputs;}\nvar normalizedRotation: f32=envRot/(2.0*PI);var depth : f32=textureLoad(depthSampler,currentPixel,0).x;\n#ifndef IS_NDC_HALF_ZRANGE\ndepth=depth*2.0-1.0;\n#endif\nvar temp : vec2f=(vec2f(currentPixel)+vec2f(0.5))*2.0/Resolution -\nvec2f(1.0);var VP : vec4f=uniforms.invProjMtx*vec4f(temp.x,-temp.y,depth,1.0);VP/=VP.w;N=normalize(N);var noise : vec3f=textureLoad(blueNoiseSampler,currentPixel & vec2i(0xFF),0).xyz;noise.z=fract(noise.z+goldenSequence(frameId*nbDirs));\n#ifdef VOXEL_MARCH_DIAGNOSTIC_INFO_OPTION\nvar heat: f32=0.0f;\n#endif\nvar shadowAccum: f32=0.001;var specShadowAccum: f32=0.001;var sampleWeight : f32=0.001;\n#ifdef COLOR_SHADOWS\nvar totalLight: vec3f=vec3f(0.001);var shadowedLight: vec3f=vec3f(0.0);\n#endif\nfor (var i: u32=0; i0.0) {var VP2: vec4f=VP;VP2.y*=-1.0;var unormWP : vec4f=uniforms.invViewMtx*VP2;var WP: vec3f=(uniforms.wsNormalizationMtx*unormWP).xyz;var vxNoise: vec2f=vec2f(uint2float(hash(dirId*2)),uint2float(hash(dirId*2+1)));\n#ifdef VOXEL_MARCH_DIAGNOSTIC_INFO_OPTION\nVoxelMarchDiagnosticInfo voxel_march_diagnostic_info;opacity=max(opacity,\nuniforms.shadowOpacity.x*voxelShadow(WP,L.xyz,N,vxNoise,\nvoxel_march_diagnostic_info));heat+=voxel_march_diagnostic_info.heat;\n#else\nopacity =\nmax(opacity,uniforms.shadowOpacity.x*voxelShadow(WP,L.xyz,N,vxNoise));\n#endif\nvar VL : vec3f=(uniforms.viewMtx*L).xyz;\n#ifdef RIGHT_HANDED\nvar nearPlaneZ: f32=-2.0*uniforms.projMtx[3][2]/(uniforms.projMtx[2][2]-1.0); \nvar farPlaneZ: f32=-uniforms.projMtx[3][2]/(uniforms.projMtx[2][2]+1.0);\n#else\nvar nearPlaneZ: f32=-2.0*uniforms.projMtx[3][2]/(uniforms.projMtx[2][2]+1.0); \nvar farPlaneZ: f32=-uniforms.projMtx[3][2]/(uniforms.projMtx[2][2]-1.0);\n#endif\nvar ssShadow: f32=uniforms.shadowOpacity.y *\nscreenSpaceShadow(VP2.xyz,VL,Resolution,nearPlaneZ,farPlaneZ,\nabs(2.0*noise.z-1.0));opacity=max(opacity,ssShadow);\n#ifdef COLOR_SHADOWS\nvar light: vec3f=select(vec3f(0.0),vec3f(cosNL)/vec3f(pdf)*ibl,pdf>1e-6);shadowedLight+=light*opacity;totalLight+=light;\n#else\nvar rcos: f32=1.0-cosNL;shadowAccum+=(1.0-opacity*(1.0-pow(rcos,8.0)));sampleWeight+=1.0;var VR : vec3f=abs((uniforms.viewMtx*vec4f(reflect(-L.xyz,N),0.0)).xyz);specShadowAccum+=max(1.0-(opacity*pow(VR.z,8.0)),0.0);\n#endif\n}\nnoise.z=fract(noise.z+GOLD);}\n#ifdef COLOR_SHADOWS\nvar shadow: vec3f=(totalLight-shadowedLight)/totalLight;var maxShadow: f32=max(max(shadow.x,max(shadow.y,shadow.z)),1.0);fragmentOutputs.color=vec4f(shadow/maxShadow,1.0);\n#else\n#ifdef VOXEL_MARCH_DIAGNOSTIC_INFO_OPTION\nfragmentOutputs.color =\nvec4f(shadowAccum/sampleWeight,specShadowAccum/sampleWeight,heat/sampleWeight,1.0);\n#else\nfragmentOutputs.color=vec4f(shadowAccum/sampleWeight,specShadowAccum/sampleWeight,0.0,1.0);\n#endif\n#endif\n}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},75647:(e,t,n)=>{n.d(t,{KJ:()=>s,a7:()=>a,n9:()=>l});var r=n(78322),i=n(59465),o=n(15579),a=function(e){function t(t){return e.call(this,"Stereo",t)||this}return(0,r.C6)(t,e),t.prototype.setOptions=function(e){var t;this.pan=null!==(t=e.stereoPan)&&void 0!==t?t:o.uJ.pan},t}(i.e);function s(e){return e.getSubNode("Stereo")}function l(e,t,n){e.callOnSubNode("Stereo",(function(e){e[t]=n}))}},75710:(e,t,n)=>{var r=n(98519),i=(n(14188),"pbrFragmentExtraDeclaration");r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="varying vPositionW: vec3f;\n#if DEBUGMODE>0\nvarying vClipSpacePosition: vec4f;\n#endif\n#include[1..7]\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\nvarying vEnvironmentIrradiance: vec3f;\n#endif\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vColor: vec4f;\n#endif\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n")},75768:(e,t,n)=>{n.d(t,{d:()=>u});var r=n(8046),i=n(48810),o=n(51428),a=n(81152),s=n(56740),l=n(64726),c=function(e,t,n,r){this.name=e,this.worldAxisForNormal=t,this.worldAxisForFileX=n,this.worldAxisForFileY=r},u=function(){function e(){}return e.ConvertCubeMapTextureToSphericalPolynomial=function(e){var t,n=this;if(!e.isCube)return null;null===(t=e.getScene())||void 0===t||t.getEngine().flushFramebuffer();var r,i,o=e.getSize().width,s=e.readPixels(0,void 0,void 0,!1),l=e.readPixels(1,void 0,void 0,!1);e.isRenderTarget?(r=e.readPixels(3,void 0,void 0,!1),i=e.readPixels(2,void 0,void 0,!1)):(r=e.readPixels(2,void 0,void 0,!1),i=e.readPixels(3,void 0,void 0,!1));var c=e.readPixels(4,void 0,void 0,!1),u=e.readPixels(5,void 0,void 0,!1),h=e.gammaSpace,d=a.Y.TEXTUREFORMAT_RGBA,p=a.Y.TEXTURETYPE_UNSIGNED_BYTE;return e.textureType!=a.Y.TEXTURETYPE_FLOAT&&e.textureType!=a.Y.TEXTURETYPE_HALF_FLOAT||(p=a.Y.TEXTURETYPE_FLOAT),new Promise((function(e){Promise.all([l,s,r,i,c,u]).then((function(t){var r=t[0],i=t[1],a=t[2],s=t[3],l=t[4],c=t[5],u={size:o,right:i,left:r,up:a,down:s,front:l,back:c,format:d,type:p,gammaSpace:h};e(n.ConvertCubeMapToSphericalPolynomial(u))}))}))},e._AreaElement=function(e,t){return Math.atan2(e*t,Math.sqrt(e*e+t*t+1))},e.ConvertCubeMapToSphericalPolynomial=function(e){for(var t=new o.O,n=0,r=2/e.size,c=r,u=.5*r,h=u-1,d=0;d<6;d++)for(var p=this._FileFaces[d],f=e[p.name],m=h,_=e.format===a.Y.TEXTUREFORMAT_RGBA?4:3,g=0;gP){var R=P/C;T*=R,E*=R,x*=R}}else T=(0,i.Clamp)(T,0,P),E=(0,i.Clamp)(E,0,P),x=(0,i.Clamp)(x,0,P);var A=new l.v9(T,E,x);t.addLight(b,A,S),n+=S,v+=r}m+=c}var I=4*Math.PI*6/6/n;return t.scaleInPlace(I),t.convertIncidentRadianceToIrradiance(),t.convertIrradianceToLambertianRadiance(),o.Q.FromHarmonics(t)},e._FileFaces=[new c("right",new r.Pq(1,0,0),new r.Pq(0,0,-1),new r.Pq(0,-1,0)),new c("left",new r.Pq(-1,0,0),new r.Pq(0,0,1),new r.Pq(0,-1,0)),new c("up",new r.Pq(0,1,0),new r.Pq(1,0,0),new r.Pq(0,0,1)),new c("down",new r.Pq(0,-1,0),new r.Pq(1,0,0),new r.Pq(0,0,-1)),new c("front",new r.Pq(0,0,1),new r.Pq(1,0,0),new r.Pq(0,-1,0)),new c("back",new r.Pq(0,0,-1),new r.Pq(-1,0,0),new r.Pq(0,-1,0))],e.MAX_HDRI_VALUE=4096,e.PRESERVE_CLAMPED_COLORS=!1,e}()},75781:(e,t,n)=>{n.d(t,{u:()=>r});var r=function(){function e(e){void 0===e&&(e=!0),this._isStencilTestDirty=!1,this._isStencilMaskDirty=!1,this._isStencilFuncDirty=!1,this._isStencilOpDirty=!1,this.useStencilGlobalOnly=!1,e&&this.reset()}return Object.defineProperty(e.prototype,"isDirty",{get:function(){return this._isStencilTestDirty||this._isStencilMaskDirty||this._isStencilFuncDirty||this._isStencilOpDirty},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"func",{get:function(){return this._func},set:function(e){this._func!==e&&(this._func=e,this._isStencilFuncDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"backFunc",{get:function(){return this._func},set:function(e){this._backFunc!==e&&(this._backFunc=e,this._isStencilFuncDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"funcRef",{get:function(){return this._funcRef},set:function(e){this._funcRef!==e&&(this._funcRef=e,this._isStencilFuncDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"funcMask",{get:function(){return this._funcMask},set:function(e){this._funcMask!==e&&(this._funcMask=e,this._isStencilFuncDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"opStencilFail",{get:function(){return this._opStencilFail},set:function(e){this._opStencilFail!==e&&(this._opStencilFail=e,this._isStencilOpDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"opDepthFail",{get:function(){return this._opDepthFail},set:function(e){this._opDepthFail!==e&&(this._opDepthFail=e,this._isStencilOpDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"opStencilDepthPass",{get:function(){return this._opStencilDepthPass},set:function(e){this._opStencilDepthPass!==e&&(this._opStencilDepthPass=e,this._isStencilOpDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"backOpStencilFail",{get:function(){return this._backOpStencilFail},set:function(e){this._backOpStencilFail!==e&&(this._backOpStencilFail=e,this._isStencilOpDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"backOpDepthFail",{get:function(){return this._backOpDepthFail},set:function(e){this._backOpDepthFail!==e&&(this._backOpDepthFail=e,this._isStencilOpDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"backOpStencilDepthPass",{get:function(){return this._backOpStencilDepthPass},set:function(e){this._backOpStencilDepthPass!==e&&(this._backOpStencilDepthPass=e,this._isStencilOpDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mask",{get:function(){return this._mask},set:function(e){this._mask!==e&&(this._mask=e,this._isStencilMaskDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"enabled",{get:function(){return this._enabled},set:function(e){this._enabled!==e&&(this._enabled=e,this._isStencilTestDirty=!0)},enumerable:!1,configurable:!0}),e.prototype.reset=function(){var e;this.stencilMaterial=void 0,null===(e=this.stencilGlobal)||void 0===e||e.reset(),this._isStencilTestDirty=!0,this._isStencilMaskDirty=!0,this._isStencilFuncDirty=!0,this._isStencilOpDirty=!0},e.prototype.apply=function(e){var t;if(e){var n=!this.useStencilGlobalOnly&&!!(null===(t=this.stencilMaterial)||void 0===t?void 0:t.enabled);this.enabled=n?this.stencilMaterial.enabled:this.stencilGlobal.enabled,this.func=n?this.stencilMaterial.func:this.stencilGlobal.func,this.backFunc=n?this.stencilMaterial.backFunc:this.stencilGlobal.backFunc,this.funcRef=n?this.stencilMaterial.funcRef:this.stencilGlobal.funcRef,this.funcMask=n?this.stencilMaterial.funcMask:this.stencilGlobal.funcMask,this.opStencilFail=n?this.stencilMaterial.opStencilFail:this.stencilGlobal.opStencilFail,this.opDepthFail=n?this.stencilMaterial.opDepthFail:this.stencilGlobal.opDepthFail,this.opStencilDepthPass=n?this.stencilMaterial.opStencilDepthPass:this.stencilGlobal.opStencilDepthPass,this.backOpStencilFail=n?this.stencilMaterial.backOpStencilFail:this.stencilGlobal.backOpStencilFail,this.backOpDepthFail=n?this.stencilMaterial.backOpDepthFail:this.stencilGlobal.backOpDepthFail,this.backOpStencilDepthPass=n?this.stencilMaterial.backOpStencilDepthPass:this.stencilGlobal.backOpStencilDepthPass,this.mask=n?this.stencilMaterial.mask:this.stencilGlobal.mask,this.isDirty&&(this._isStencilTestDirty&&(this.enabled?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),this._isStencilTestDirty=!1),this._isStencilMaskDirty&&(e.stencilMask(this.mask),this._isStencilMaskDirty=!1),this._isStencilFuncDirty&&(e.stencilFuncSeparate(e.FRONT,this.func,this.funcRef,this.funcMask),e.stencilFuncSeparate(e.BACK,this.backFunc,this.funcRef,this.funcMask),this._isStencilFuncDirty=!1),this._isStencilOpDirty&&(e.stencilOpSeparate(e.FRONT,this.opStencilFail,this.opDepthFail,this.opStencilDepthPass),e.stencilOpSeparate(e.BACK,this.backOpStencilFail,this.backOpDepthFail,this.backOpStencilDepthPass),this._isStencilOpDirty=!1))}},e}()},75838:(e,t,n)=>{n.d(t,{D8:()=>s,c9:()=>i,lP:()=>o,nh:()=>a});var r=n(78322);function i(e,t,n){void 0===n&&(n=!1);var r=t.width,i=t.height;if(e instanceof Float32Array){for(var o=e.byteLength/e.BYTES_PER_ELEMENT,a=new Uint8Array(o);--o>=0;){var s=e[o];s<0?s=0:s>1&&(s=1),a[o]=255*s}e=a}var l=document.createElement("canvas");l.width=r,l.height=i;var c=l.getContext("2d");if(!c)return null;var u=c.createImageData(r,i);if(u.data.set(e),c.putImageData(u,0,0),n){var h=document.createElement("canvas");h.width=r,h.height=i;var d=h.getContext("2d");return d?(d.translate(0,i),d.scale(1,-1),d.drawImage(l,0,0),h.toDataURL("image/png")):null}return l.toDataURL("image/png")}function o(e,t,n){void 0===t&&(t=0),void 0===n&&(n=0);var r=e.getInternalTexture();if(!r)return null;var o=e._readPixelsSync(t,n);return o?i(o,e.getSize(),r.invertY):null}function a(e){return(0,r.sH)(this,arguments,void 0,(function(e,t,n){var o,a;return void 0===t&&(t=0),void 0===n&&(n=0),(0,r.YH)(this,(function(r){switch(r.label){case 0:return(o=e.getInternalTexture())?[4,e.readPixels(t,n)]:[2,null];case 1:return(a=r.sent())?[2,i(a,e.getSize(),o.invertY)]:[2,null]}}))}))}var s={GenerateBase64StringFromPixelData:i,GenerateBase64StringFromTexture:o,GenerateBase64StringFromTextureAsync:a}},75866:(e,t,n)=>{n.r(t),n.d(t,{iblShadowGBufferDebugPixelShaderWGSL:()=>a});var r=n(98519),i="iblShadowGBufferDebugPixelShader",o="varying vUV : vec2f;var textureSamplerSampler : sampler;var textureSampler : texture_2d;var depthSamplerSampler : sampler;var depthSampler : texture_2d;var normalSamplerSampler : sampler;var normalSampler : texture_2d;var positionSamplerSampler : sampler;var positionSampler : texture_2d;var velocitySamplerSampler : sampler;var velocitySampler : texture_2d;uniform sizeParams : vec4f;\n#define offsetX uniforms.sizeParams.x\n#define offsetY uniforms.sizeParams.y\n#define widthScale uniforms.sizeParams.z\n#define heightScale uniforms.sizeParams.w\n@fragment fn main(input : FragmentInputs)->FragmentOutputs {var uv : vec2f=\nvec2f((offsetX+input.vUV.x)*widthScale,(offsetY+input.vUV.y)*heightScale);var backgroundColour: vec4f=textureSample(textureSampler,textureSamplerSampler,input.vUV).rgba;var depth : vec4f=textureSample(depthSampler,depthSamplerSampler,input.vUV);var worldNormal: vec4f=textureSample(normalSampler,normalSamplerSampler,input.vUV);var worldPosition : vec4f=textureSample(positionSampler,positionSamplerSampler,input.vUV);var velocityLinear : vec4f=textureSample(velocitySampler,velocitySamplerSampler,input.vUV);if (uv.x<0.0 || uv.x>1.0 || uv.y<0.0 || uv.y>1.0) {fragmentOutputs.color=backgroundColour;} else {if (uv.x<=0.25) {fragmentOutputs.color=vec4f(depth.rgb,1.0);} else if (uv.x<=0.5) {velocityLinear =\nvec4f(velocityLinear.r*0.5+0.5,velocityLinear.g*0.5+0.5,\nvelocityLinear.b,velocityLinear.a);fragmentOutputs.color=vec4f(velocityLinear.rgb,1.0);} else if (uv.x<=0.75) {fragmentOutputs.color=vec4f(worldPosition.rgb,1.0);} else {fragmentOutputs.color=vec4f(worldNormal.rgb,1.0);}}}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},76138:(e,t,n)=>{n.r(t),n.d(t,{fluidRenderingParticleDepthPixelShaderWGSL:()=>a});var r=n(98519),i="fluidRenderingParticleDepthPixelShader",o="uniform projection: mat4x4f;varying uv: vec2f;varying viewPos: vec3f;varying sphereRadius: f32;\n#ifdef FLUIDRENDERING_VELOCITY\nvarying velocityNorm: f32;\n#endif\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var normalxy: vec2f=input.uv*2.0-1.0;var r2: f32=dot(normalxy,normalxy);if (r2>1.0) {discard;}\nvar normal: vec3f=vec3f(normalxy,sqrt(1.0-r2));\n#ifndef FLUIDRENDERING_RHS\nnormal.z=-normal.z;\n#endif\nvar realViewPos: vec4f=vec4f(input.viewPos+normal*input.sphereRadius,1.0);var clipSpacePos: vec4f=uniforms.projection*realViewPos;fragmentOutputs.fragDepth=clipSpacePos.z/clipSpacePos.w;\n#ifdef FLUIDRENDERING_RHS\nrealViewPos.z=-realViewPos.z;\n#endif\n#ifdef FLUIDRENDERING_VELOCITY\nfragmentOutputs.color=vec4f(realViewPos.z,input.velocityNorm,0.,1.);\n#else\nfragmentOutputs.color=vec4f(realViewPos.z,0.,0.,1.);\n#endif\n}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},76164:(e,t,n)=>{function r(e){return Math.floor(e/8)}function i(e){return 1<o});var o=function(){function e(e){this.size=e,this._byteArray=new Uint8Array(Math.ceil(this.size/8))}return e.prototype.get=function(e){if(e>=this.size)throw new RangeError("Bit index out of range");var t=r(e),n=i(e);return 0!==(this._byteArray[t]&n)},e.prototype.set=function(e,t){if(e>=this.size)throw new RangeError("Bit index out of range");var n=r(e),o=i(e);t?this._byteArray[n]|=o:this._byteArray[n]&=~o},e}()},76255:(e,t,n)=>{n.r(t),n.d(t,{OptimizeIndices:()=>i});var r=n(76164);function i(e){for(var t=[],n=e.length/3,i=0;i0;){var r=n.pop();if(!h.get(r)){h.set(r,!0),d.push(t[r]);for(var i=0,a=t[r];i{n.d(t,{JH:()=>h,b4:()=>c,mO:()=>u,uR:()=>p});var r=n(5153),i=n(53399),o=n(98519),a=n(7164),s=n(35930),l=n(24894);function c(e,t){return(0,i.N5)(t).cachedPipelines[e]}function u(e){var t=e._name,n=e.context;if(t&&n){var r=(0,i.N5)(n),o=r.cachedPipelines[t];null==o||o.dispose(),delete r.cachedPipelines[t]}}function h(e,t,n,i,o,a,l){var c,u,h=(0,r.BA)()?null==a?void 0:a.getHostDocument():null;c="string"==typeof t?t:t.vertexSource?"source:"+t.vertexSource:t.vertexElement?(null==h?void 0:h.getElementById(t.vertexElement))||t.vertexElement:t.vertex||t,u="string"==typeof t?t:t.fragmentSource?"source:"+t.fragmentSource:t.fragmentElement?(null==h?void 0:h.getElementById(t.fragmentElement))||t.fragmentElement:t.fragment||t;var p=[void 0,void 0],f=function(){if(p[0]&&p[1]){e.isFragment=!0;var r=p[0],c=p[1];(0,s.M0)(c,e,(function(a,c){l&&(l._fragmentSourceCodeBeforeMigration=c),n&&(a=n("fragment",a));var u=(0,s.nO)(r,a,e);e=null;var h=function(e,t,n,r){return n?{vertexSourceCode:(1===r?"//":"")+"#define SHADER_NAME vertex:"+(n.vertexElement||n.vertex||n.spectorName||n)+"\n"+e,fragmentSourceCode:(1===r?"//":"")+"#define SHADER_NAME fragment:"+(n.fragmentElement||n.fragment||n.spectorName||n)+"\n"+t}:{vertexSourceCode:e,fragmentSourceCode:t}}(u.vertexCode,u.fragmentCode,t,o);null==i||i(h.vertexSourceCode,h.fragmentSourceCode)}),a)}};d(c,"Vertex","",(function(t){(0,s.pB)(e),(0,s.M0)(t,e,(function(e,r){l&&(l._rawVertexSourceCode=t,l._vertexSourceCodeBeforeMigration=r),n&&(e=n("vertex",e)),p[0]=e,f()}),a)}),o),d(u,"Fragment","Pixel",(function(e){l&&(l._rawFragmentSourceCode=e),p[1]=e,f()}),o)}function d(e,t,n,i,a,s){if("undefined"!=typeof HTMLElement&&e instanceof HTMLElement)i((0,r.Zl)(e));else if("source:"!==e.substring(0,7))if("base64:"!==e.substring(0,7)){var c=o.l.GetShadersStore(a);if(c[e+t+"Shader"])i(c[e+t+"Shader"]);else if(n&&c[e+n+"Shader"])i(c[e+n+"Shader"]);else{var u;if(u="."===e[0]||"/"===e[0]||e.indexOf("http")>-1?e:o.l.GetShadersRepository(a)+e,!(s=s||l.sb))throw new Error("loadFileInjection is not defined");s(u+"."+t.toLowerCase()+".fx",i)}}else i(window.atob(e.substring(7)));else i(e.substring(7))}var p=function(e,t,n,r){try{var o=e.context?(0,i.N5)(e.context):null;o&&(o.disableParallelShaderCompile=e.disableParallelCompilation);var s=e.existingPipelineContext||t(e.shaderProcessingContext);return s._name=e.name,e.name&&o&&(o.cachedPipelines[e.name]=s),n(s,e.vertex,e.fragment,!!e.createAsRaw,"","",e.rebuildRebind,e.defines,e.transformFeedbackVaryings,"",(function(){r(s,(function(){var t;null===(t=e.onRenderingStateCompiled)||void 0===t||t.call(e,s)}))})),s}catch(e){throw a.V.Error("Error compiling effect"),e}}},76331:(e,t,n)=>{n.d(t,{Q:()=>l});var r=n(78322),i=n(6174),o=n(64726),a=n(12028),s=n(10740),l=function(){function e(){this._dirty=!0,this._tempColor=new o.ov(0,0,0,0),this._globalCurve=new o.ov(0,0,0,0),this._highlightsCurve=new o.ov(0,0,0,0),this._midtonesCurve=new o.ov(0,0,0,0),this._shadowsCurve=new o.ov(0,0,0,0),this._positiveCurve=new o.ov(0,0,0,0),this._negativeCurve=new o.ov(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}return Object.defineProperty(e.prototype,"globalHue",{get:function(){return this._globalHue},set:function(e){this._globalHue=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"globalDensity",{get:function(){return this._globalDensity},set:function(e){this._globalDensity=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"globalSaturation",{get:function(){return this._globalSaturation},set:function(e){this._globalSaturation=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"globalExposure",{get:function(){return this._globalExposure},set:function(e){this._globalExposure=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"highlightsHue",{get:function(){return this._highlightsHue},set:function(e){this._highlightsHue=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"highlightsDensity",{get:function(){return this._highlightsDensity},set:function(e){this._highlightsDensity=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"highlightsSaturation",{get:function(){return this._highlightsSaturation},set:function(e){this._highlightsSaturation=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"highlightsExposure",{get:function(){return this._highlightsExposure},set:function(e){this._highlightsExposure=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"midtonesHue",{get:function(){return this._midtonesHue},set:function(e){this._midtonesHue=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"midtonesDensity",{get:function(){return this._midtonesDensity},set:function(e){this._midtonesDensity=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"midtonesSaturation",{get:function(){return this._midtonesSaturation},set:function(e){this._midtonesSaturation=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"midtonesExposure",{get:function(){return this._midtonesExposure},set:function(e){this._midtonesExposure=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shadowsHue",{get:function(){return this._shadowsHue},set:function(e){this._shadowsHue=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shadowsDensity",{get:function(){return this._shadowsDensity},set:function(e){this._shadowsDensity=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shadowsSaturation",{get:function(){return this._shadowsSaturation},set:function(e){this._shadowsSaturation=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shadowsExposure",{get:function(){return this._shadowsExposure},set:function(e){this._shadowsExposure=e,this._dirty=!0},enumerable:!1,configurable:!0}),e.prototype.getClassName=function(){return"ColorCurves"},e.Bind=function(e,t,n,r,i){void 0===n&&(n="vCameraColorCurvePositive"),void 0===r&&(r="vCameraColorCurveNeutral"),void 0===i&&(i="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(n,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(i,e._negativeCurve.r,e._negativeCurve.g,e._negativeCurve.b,e._negativeCurve.a))},e.prototype._getColorGradingDataToRef=function(t,n,r,i,o){null!=t&&(t=e._Clamp(t,0,360),n=e._Clamp(n,-100,100),r=e._Clamp(r,-100,100),i=e._Clamp(i,-100,100),n=e._ApplyColorGradingSliderNonlinear(n),n*=.5,i=e._ApplyColorGradingSliderNonlinear(i),n<0&&(n*=-1,t=(t+180)%360),e._FromHSBToRef(t,n,50+.25*i,o),o.scaleToRef(2,o),o.a=1+.01*r)},e._ApplyColorGradingSliderNonlinear=function(e){e/=100;var t=Math.abs(e);return t=Math.pow(t,2),e<0&&(t*=-1),100*t},e._FromHSBToRef=function(t,n,r,i){var o=e._Clamp(t,0,360),a=e._Clamp(n/100,0,1),s=e._Clamp(r/100,0,1);if(0===a)i.r=s,i.g=s,i.b=s;else{o/=60;var l=Math.floor(o),c=o-l,u=s*(1-a),h=s*(1-a*c),d=s*(1-a*(1-c));switch(l){case 0:i.r=s,i.g=d,i.b=u;break;case 1:i.r=h,i.g=s,i.b=u;break;case 2:i.r=u,i.g=s,i.b=d;break;case 3:i.r=u,i.g=h,i.b=s;break;case 4:i.r=d,i.g=u,i.b=s;break;default:i.r=s,i.g=u,i.b=h}}i.a=1},e._Clamp=function(e,t,n){return Math.min(Math.max(e,t),n)},e.prototype.clone=function(){return a.p.Clone((function(){return new e}),this)},e.prototype.serialize=function(){return a.p.Serialize(this)},e.Parse=function(t){return a.p.Parse((function(){return new e}),t,null,null)},e.PrepareUniforms=s.B,(0,r.Cg)([(0,i.lK)()],e.prototype,"_globalHue",void 0),(0,r.Cg)([(0,i.lK)()],e.prototype,"_globalDensity",void 0),(0,r.Cg)([(0,i.lK)()],e.prototype,"_globalSaturation",void 0),(0,r.Cg)([(0,i.lK)()],e.prototype,"_globalExposure",void 0),(0,r.Cg)([(0,i.lK)()],e.prototype,"_highlightsHue",void 0),(0,r.Cg)([(0,i.lK)()],e.prototype,"_highlightsDensity",void 0),(0,r.Cg)([(0,i.lK)()],e.prototype,"_highlightsSaturation",void 0),(0,r.Cg)([(0,i.lK)()],e.prototype,"_highlightsExposure",void 0),(0,r.Cg)([(0,i.lK)()],e.prototype,"_midtonesHue",void 0),(0,r.Cg)([(0,i.lK)()],e.prototype,"_midtonesDensity",void 0),(0,r.Cg)([(0,i.lK)()],e.prototype,"_midtonesSaturation",void 0),(0,r.Cg)([(0,i.lK)()],e.prototype,"_midtonesExposure",void 0),e}();a.p._ColorCurvesParser=l.Parse},76459:(e,t,n)=>{n.r(t),n.d(t,{hdrFilteringPixelShaderWGSL:()=>a});var r=n(98519),i=(n(17393),n(28469),n(61669),n(31321),"hdrFilteringPixelShader"),o="#include\n#include\n#include\n#include\nuniform alphaG: f32;var inputTextureSampler: sampler;var inputTexture: texture_cube;uniform vFilteringInfo: vec2f;uniform hdrScale: f32;varying direction: vec3f;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var color: vec3f=radiance(uniforms.alphaG,inputTexture,inputTextureSampler,input.direction,uniforms.vFilteringInfo);fragmentOutputs.color= vec4f(color*uniforms.hdrScale,1.0);}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},76526:(e,t,n)=>{n.r(t),n.d(t,{rsmGlobalIlluminationPixelShader:()=>a});var r=n(98519),i="rsmGlobalIlluminationPixelShader",o="/**\n* The implementation is an application of the formula found in http:\n* For better results,it also adds a random (noise) rotation to the RSM samples (the noise artifacts are easier to remove than the banding artifacts).\n*/\nprecision highp float;varying vec2 vUV;uniform mat4 rsmLightMatrix;uniform vec4 rsmInfo;uniform vec4 rsmInfo2;uniform sampler2D textureSampler;uniform sampler2D normalSampler;uniform sampler2D rsmPositionW;uniform sampler2D rsmNormalW;uniform sampler2D rsmFlux;uniform sampler2D rsmSamples;\n#ifdef TRANSFORM_NORMAL\nuniform mat4 invView;\n#endif\nfloat mod289(float x){return x-floor(x*(1.0/289.0))*289.0;}\nvec4 mod289(vec4 x){return x-floor(x*(1.0/289.0))*289.0;}\nvec4 perm(vec4 x){return mod289(((x*34.0)+1.0)*x);}\nfloat noise(vec3 p){vec3 a=floor(p);vec3 d=p-a;d=d*d*(3.0-2.0*d);vec4 b=a.xxyy+vec4(0.0,1.0,0.0,1.0);vec4 k1=perm(b.xyxy);vec4 k2=perm(k1.xyxy+b.zzww);vec4 c=k2+a.zzzz;vec4 k3=perm(c);vec4 k4=perm(c+1.0);vec4 o1=fract(k3*(1.0/41.0));vec4 o2=fract(k4*(1.0/41.0));vec4 o3=o2*d.z+o1*(1.0-d.z);vec2 o4=o3.yw*d.x+o3.xz*(1.0-d.x);return o4.y*d.y+o4.x*(1.0-d.y);}\nvec3 computeIndirect(vec3 p,vec3 n) {vec3 indirectDiffuse=vec3(0.);int numSamples=int(rsmInfo.x);float radius=rsmInfo.y;float intensity=rsmInfo.z;float edgeArtifactCorrection=rsmInfo.w;vec4 texRSM=rsmLightMatrix*vec4(p,1.);texRSM.xy/=texRSM.w;texRSM.xy=texRSM.xy*0.5+0.5;float angle=noise(p*rsmInfo2.x);float c=cos(angle);float s=sin(angle);for (int i=0; i1. || uv.y<0. || uv.y>1.) continue;vec3 vplPositionW=textureLod(rsmPositionW,uv,0.).xyz;vec3 vplNormalW=textureLod(rsmNormalW,uv,0.).xyz*2.0-1.0;vec3 vplFlux=textureLod(rsmFlux,uv,0.).rgb;vplPositionW-=vplNormalW*edgeArtifactCorrection; \nfloat dist2=dot(vplPositionW-p,vplPositionW-p);indirectDiffuse+=vplFlux*weightSquare*max(0.,dot(n,vplPositionW-p))*max(0.,dot(vplNormalW,p-vplPositionW))/(dist2*dist2);}\nreturn clamp(indirectDiffuse*intensity,0.0,1.0);}\nvoid main(void) \n{vec3 positionW=texture2D(textureSampler,vUV).xyz;vec3 normalW=texture2D(normalSampler,vUV).xyz;\n#ifdef DECODE_NORMAL\nnormalW=normalW*2.0-1.0;\n#endif\n#ifdef TRANSFORM_NORMAL\nnormalW=(invView*vec4(normalW,0.)).xyz;\n#endif\ngl_FragColor.rgb=computeIndirect(positionW,normalW);gl_FragColor.a=1.0;}\n";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},76686:(e,t,n)=>{n.r(t),n.d(t,{iblCdfyPixelShaderWGSL:()=>a});var r=n(98519),i="iblCdfyPixelShader",o="varying vUV : vec2f;\n#include \n#ifdef IBL_USE_CUBE_MAP\nvar iblSourceSampler: sampler;var iblSource: texture_cube;\n#else\nvar iblSourceSampler: sampler;var iblSource: texture_2d;\n#endif\nuniform iblHeight: i32;\n#ifdef IBL_USE_CUBE_MAP\nfn fetchCube(uv: vec2f)->f32 {var direction: vec3f=equirectangularToCubemapDirection(uv);return sin(PI*uv.y) *\ndot(textureSampleLevel(iblSource,iblSourceSampler,direction,0.0)\n.rgb,\nLuminanceEncodeApprox);}\n#else\nfn fetchPanoramic(Coords: vec2i,envmapHeight: f32)->f32 {return sin(PI*(f32(Coords.y)+0.5)/envmapHeight) *\ndot(textureLoad(iblSource,Coords,0).rgb,LuminanceEncodeApprox);}\n#endif\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var coords: vec2i= vec2i(fragmentInputs.position.xy);var cdfy: f32=0.0;for (var y: i32=1; y<=coords.y; y++) {\n#ifdef IBL_USE_CUBE_MAP\nvar uv: vec2f= vec2f(input.vUV.x,( f32(y-1)+0.5)/ f32(uniforms.iblHeight));cdfy+=fetchCube(uv);\n#else\ncdfy+=fetchPanoramic( vec2i(coords.x,y-1), f32(uniforms.iblHeight));\n#endif\n}\nfragmentOutputs.color= vec4f(cdfy,0.0,0.0,1.0);}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},76747:(e,t,n)=>{n.r(t),n.d(t,{lightProxyPixelShaderWGSL:()=>a});var r=n(98519),i="lightProxyPixelShader",o="flat varying vOffset: u32;flat varying vMask: u32;uniform tileMaskResolution: vec3f;var tileMaskBuffer: array>;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {let maskResolution=vec2u(uniforms.tileMaskResolution.yz);let tilePosition=vec2u(fragmentInputs.position.xy);let tileIndex=(tilePosition.x*maskResolution.x+tilePosition.y)*maskResolution.y+fragmentInputs.vOffset;atomicOr(&tileMaskBuffer[tileIndex],fragmentInputs.vMask);}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},76778:(e,t,n)=>{var r=n(98519),i="oitDeclaration";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="#ifdef ORDER_INDEPENDENT_TRANSPARENCY\n#define MAX_DEPTH 99999.0\nvar oitDepthSamplerSampler: sampler;var oitDepthSampler: texture_2d;var oitFrontColorSamplerSampler: sampler;var oitFrontColorSampler: texture_2d;\n#endif\n")},76832:(e,t,n)=>{n.r(t),n.d(t,{kernelBlurPixelShaderWGSL:()=>l});var r=n(98519),i=(n(14782),n(68298),"kernelBlurFragment");r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="#ifdef DOF\nfactor=sampleCoC(fragmentInputs.sampleCoord{X}); \ncomputedWeight=KERNEL_WEIGHT{X}*factor;sumOfWeights+=computedWeight;\n#else\ncomputedWeight=KERNEL_WEIGHT{X};\n#endif\n#ifdef PACKEDFLOAT\nblend+=unpack(textureSample(textureSampler,textureSamplerSampler,fragmentInputs.sampleCoord{X}))*computedWeight;\n#else\nblend+=textureSample(textureSampler,textureSamplerSampler,fragmentInputs.sampleCoord{X})*computedWeight;\n#endif\n");var o="kernelBlurFragment2";r.l.IncludesShadersStoreWGSL[o]||(r.l.IncludesShadersStoreWGSL[o]="#ifdef DOF\nfactor=sampleCoC(fragmentInputs.sampleCenter+uniforms.delta*KERNEL_DEP_OFFSET{X});computedWeight=KERNEL_DEP_WEIGHT{X}*factor;sumOfWeights+=computedWeight;\n#else\ncomputedWeight=KERNEL_DEP_WEIGHT{X};\n#endif\n#ifdef PACKEDFLOAT\nblend+=unpack(textureSample(textureSampler,textureSamplerSampler,fragmentInputs.sampleCenter+uniforms.delta*KERNEL_DEP_OFFSET{X}))*computedWeight;\n#else\nblend+=textureSample(textureSampler,textureSamplerSampler,fragmentInputs.sampleCenter+uniforms.delta*KERNEL_DEP_OFFSET{X})*computedWeight;\n#endif\n");var a="kernelBlurPixelShader",s="var textureSamplerSampler: sampler;var textureSampler: texture_2d;uniform delta: vec2f;varying sampleCenter: vec2f;\n#ifdef DOF\nvar circleOfConfusionSamplerSampler: sampler;var circleOfConfusionSampler: texture_2d;fn sampleCoC(offset: vec2f)->f32 {var coc: f32=textureSample(circleOfConfusionSampler,circleOfConfusionSamplerSampler,offset).r;return coc; }\n#endif\n#include[0..varyingCount]\n#ifdef PACKEDFLOAT\n#include\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var computedWeight: f32=0.0;\n#ifdef PACKEDFLOAT\nvar blend: f32=0.;\n#else\nvar blend: vec4f= vec4f(0.);\n#endif\n#ifdef DOF\nvar sumOfWeights: f32=CENTER_WEIGHT; \nvar factor: f32=0.0;\n#ifdef PACKEDFLOAT\nblend+=unpack(textureSample(textureSampler,textureSamplerSampler,input.sampleCenter))*CENTER_WEIGHT;\n#else\nblend+=textureSample(textureSampler,textureSamplerSampler,input.sampleCenter)*CENTER_WEIGHT;\n#endif\n#endif\n#include[0..varyingCount]\n#include[0..depCount]\n#ifdef PACKEDFLOAT\nfragmentOutputs.color=pack(blend);\n#else\nfragmentOutputs.color=blend;\n#endif\n#ifdef DOF\nfragmentOutputs.color/=sumOfWeights;\n#endif\n}";r.l.ShadersStoreWGSL[a]||(r.l.ShadersStoreWGSL[a]=s);var l={name:a,shader:s}},76872:(e,t,n)=>{function r(e){var t=e.split("?")[0],n=t.lastIndexOf(".");return n>-1?t.substring(n).toLowerCase():""}n.d(t,{r:()=>r})},76898:(e,t,n)=>{n.r(t),n.d(t,{bonesVertex:()=>a});var r=n(98519),i="bonesVertex",o="#ifndef BAKED_VERTEX_ANIMATION_TEXTURE\n#if NUM_BONE_INFLUENCERS>0\nmat4 influence;\n#ifdef BONETEXTURE\ninfluence=readMatrixFromRawSampler(boneSampler,matricesIndices[0])*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndices[1])*matricesWeights[1];\n#endif\n#if NUM_BONE_INFLUENCERS>2\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndices[2])*matricesWeights[2];\n#endif\n#if NUM_BONE_INFLUENCERS>3\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndices[3])*matricesWeights[3];\n#endif\n#if NUM_BONE_INFLUENCERS>4\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[0])*matricesWeightsExtra[0];\n#endif\n#if NUM_BONE_INFLUENCERS>5\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[1])*matricesWeightsExtra[1];\n#endif\n#if NUM_BONE_INFLUENCERS>6\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[2])*matricesWeightsExtra[2];\n#endif\n#if NUM_BONE_INFLUENCERS>7\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[3])*matricesWeightsExtra[3];\n#endif\n#else\ninfluence=mBones[int(matricesIndices[0])]*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\ninfluence+=mBones[int(matricesIndices[1])]*matricesWeights[1];\n#endif\n#if NUM_BONE_INFLUENCERS>2\ninfluence+=mBones[int(matricesIndices[2])]*matricesWeights[2];\n#endif\n#if NUM_BONE_INFLUENCERS>3\ninfluence+=mBones[int(matricesIndices[3])]*matricesWeights[3];\n#endif\n#if NUM_BONE_INFLUENCERS>4\ninfluence+=mBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0];\n#endif\n#if NUM_BONE_INFLUENCERS>5\ninfluence+=mBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1];\n#endif\n#if NUM_BONE_INFLUENCERS>6\ninfluence+=mBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2];\n#endif\n#if NUM_BONE_INFLUENCERS>7\ninfluence+=mBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3];\n#endif\n#endif\nfinalWorld=finalWorld*influence;\n#endif\n#endif\n";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]=o);var a={name:i,shader:o}},76933:(e,t,n)=>{n.r(t),n.d(t,{iblVoxelGrid2dArrayDebugPixelShader:()=>a});var r=n(98519),i="iblVoxelGrid2dArrayDebugPixelShader",o="precision highp sampler2DArray;varying vec2 vUV;uniform sampler2DArray voxelTexture;uniform sampler2D textureSampler;uniform int slice;void main(void) {ivec3 size=textureSize(voxelTexture,0);float dimension=sqrt(float(size.z));vec2 samplePos=fract(vUV.xy*vec2(dimension));int sampleIndex=int(floor(vUV.x*float(dimension))+floor(vUV.y*float(dimension))*dimension);glFragColor.rgb=texture(voxelTexture,vec3(samplePos.xy,sampleIndex)).rrr;glFragColor.a=1.0;glFragColor.rgb+=texture(textureSampler,vUV.xy).rgb;}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},76941:(e,t,n)=>{var r=n(98519),i=(n(36644),n(40647),"defaultUboDeclaration");r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="uniform diffuseLeftColor: vec4f;uniform diffuseRightColor: vec4f;uniform opacityParts: vec4f;uniform reflectionLeftColor: vec4f;uniform reflectionRightColor: vec4f;uniform refractionLeftColor: vec4f;uniform refractionRightColor: vec4f;uniform emissiveLeftColor: vec4f;uniform emissiveRightColor: vec4f;uniform vDiffuseInfos: vec2f;uniform vAmbientInfos: vec2f;uniform vOpacityInfos: vec2f;uniform vEmissiveInfos: vec2f;uniform vLightmapInfos: vec2f;uniform vSpecularInfos: vec2f;uniform vBumpInfos: vec3f;uniform diffuseMatrix: mat4x4f;uniform ambientMatrix: mat4x4f;uniform opacityMatrix: mat4x4f;uniform emissiveMatrix: mat4x4f;uniform lightmapMatrix: mat4x4f;uniform specularMatrix: mat4x4f;uniform bumpMatrix: mat4x4f;uniform vTangentSpaceParams: vec2f;uniform pointSize: f32;uniform alphaCutOff: f32;uniform refractionMatrix: mat4x4f;uniform vRefractionInfos: vec4f;uniform vRefractionPosition: vec3f;uniform vRefractionSize: vec3f;uniform vSpecularColor: vec4f;uniform vEmissiveColor: vec3f;uniform vDiffuseColor: vec4f;uniform vAmbientColor: vec3f;uniform cameraInfo: vec4f;uniform vReflectionInfos: vec2f;uniform reflectionMatrix: mat4x4f;uniform vReflectionPosition: vec3f;uniform vReflectionSize: vec3f;\n#define ADDITIONAL_UBO_DECLARATION\n#include\n#include\n")},77142:(e,t,n)=>{n.r(t),n.d(t,{iblVoxelSlabDebugPixelShader:()=>a});var r=n(98519),i="iblVoxelSlabDebugPixelShader",o="precision highp float;varying vec3 vNormalizedPosition;uniform float nearPlane;uniform float farPlane;uniform float stepSize;void main(void) {vec3 normPos=vNormalizedPosition.xyz;float chunkSize=stepSize*float(MAX_DRAW_BUFFERS);float numChunks=1.0/chunkSize;float positionInChunk=fract(normPos.z/chunkSize);float slab=floor(positionInChunk*float(MAX_DRAW_BUFFERS)) /\nfloat(MAX_DRAW_BUFFERS);if (normPos.x<0.0 || normPos.y<0.0 || normPos.z<0.0 ||\nnormPos.x>1.0 || normPos.y>1.0 || normPos.z>1.0) {gl_FragColor=vec4(0.0,0.0,0.0,0.0);} else {gl_FragColor=vec4(slab,0.0,0.0,0.75);}}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},77320:(e,t,n)=>{n.r(t),n.d(t,{morphTargetsVertexWGSL:()=>a});var r=n(98519),i="morphTargetsVertex",o="#ifdef MORPHTARGETS\n#ifdef MORPHTARGETS_TEXTURE\n#if {X}==0\nfor (var i=0; i=uniforms.morphTargetCount) {break;}\nvertexID=f32(vertexInputs.vertexIndex)*uniforms.morphTargetTextureInfo.x;\n#ifdef MORPHTARGETS_POSITION\npositionUpdated=positionUpdated+(readVector3FromRawSampler(i,vertexID)-vertexInputs.position)*uniforms.morphTargetInfluences[i];\n#endif\n#ifdef MORPHTARGETTEXTURE_HASPOSITIONS\nvertexID=vertexID+1.0;\n#endif\n#ifdef MORPHTARGETS_NORMAL\nnormalUpdated=normalUpdated+(readVector3FromRawSampler(i,vertexID) -vertexInputs.normal)*uniforms.morphTargetInfluences[i];\n#endif\n#ifdef MORPHTARGETTEXTURE_HASNORMALS\nvertexID=vertexID+1.0;\n#endif\n#ifdef MORPHTARGETS_UV\nuvUpdated=uvUpdated+(readVector3FromRawSampler(i,vertexID).xy-vertexInputs.uv)*uniforms.morphTargetInfluences[i];\n#endif\n#ifdef MORPHTARGETTEXTURE_HASUVS\nvertexID=vertexID+1.0;\n#endif\n#ifdef MORPHTARGETS_TANGENT\ntangentUpdated=vec4f(tangentUpdated.xyz+(readVector3FromRawSampler(i,vertexID) -vertexInputs.tangent.xyz)*uniforms.morphTargetInfluences[i],tangentUpdated.a);\n#endif\n#ifdef MORPHTARGETTEXTURE_HASTANGENTS\nvertexID=vertexID+1.0;\n#endif\n#ifdef MORPHTARGETS_UV2\nuv2Updated=uv2Updated+(readVector3FromRawSampler(i,vertexID).xy-vertexInputs.uv2)*uniforms.morphTargetInfluences[i];\n#endif\n#ifdef MORPHTARGETS_COLOR\ncolorUpdated=colorUpdated+(readVector4FromRawSampler(i,vertexID)-vertexInputs.color)*uniforms.morphTargetInfluences[i];\n#endif\n}\n#endif\n#else\n#ifdef MORPHTARGETS_POSITION\npositionUpdated=positionUpdated+(vertexInputs.position{X}-vertexInputs.position)*uniforms.morphTargetInfluences[{X}];\n#endif\n#ifdef MORPHTARGETS_NORMAL\nnormalUpdated=normalUpdated+(vertexInputs.normal{X}-vertexInputs.normal)*uniforms.morphTargetInfluences[{X}];\n#endif\n#ifdef MORPHTARGETS_TANGENT\ntangentUpdated=vec4f(tangentUpdated.xyz+(vertexInputs.tangent{X}-vertexInputs.tangent.xyz)*uniforms.morphTargetInfluences[{X}],tangentUpdated.a);\n#endif\n#ifdef MORPHTARGETS_UV\nuvUpdated=uvUpdated+(vertexInputs.uv_{X}-vertexInputs.uv)*uniforms.morphTargetInfluences[{X}];\n#endif\n#ifdef MORPHTARGETS_UV2\nuv2Updated=uv2Updated+(vertexInputs.uv2_{X}-vertexInputs.uv2)*uniforms.morphTargetInfluences[{X}];\n#endif\n#ifdef MORPHTARGETS_COLOR\ncolorUpdated=colorUpdated+(vertexInputs.color{X}-vertexInputs.color)*uniforms.morphTargetInfluences[{X}];\n#endif\n#endif\n#endif\n";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]=o);var a={name:i,shader:o}},77740:(e,t,n)=>{var r=n(98519),i="decalFragmentDeclaration";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#ifdef DECAL\nuniform vec4 vDecalInfos;\n#endif\n")},77976:(e,t,n)=>{var r=n(98519),i="uvAttributeDeclaration";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#ifdef UV{X}\nattribute vec2 uv{X};\n#endif\n")},78078:(e,t,n)=>{n.d(t,{k:()=>i});var r=n(78322),i=function(e){function t(t,n){return e.call(this,t,n)||this}return(0,r.C6)(t,e),Object.defineProperty(t.prototype,"duration",{get:function(){return this._options.duration},set:function(e){this._options.duration=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loopStart",{get:function(){return this._options.loopStart},set:function(e){this._options.loopStart=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loopEnd",{get:function(){return this._options.loopEnd},set:function(e){this._options.loopEnd=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pitch",{get:function(){return this._options.pitch},set:function(e){this._options.pitch=e;for(var t=this._instances.values(),n=t.next();!n.done;n=t.next())n.value.pitch=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"playbackRate",{get:function(){return this._options.playbackRate},set:function(e){this._options.playbackRate=e;for(var t=this._instances.values(),n=t.next();!n.done;n=t.next())n.value.playbackRate=e},enumerable:!1,configurable:!0}),t.prototype.play=function(e){var t,n,r,i,o,a,s;if(void 0===e&&(e={}),5!==this.state){null!==(t=e.duration)&&void 0!==t||(e.duration=this.duration),null!==(n=e.loop)&&void 0!==n||(e.loop=this.loop),null!==(r=e.loopStart)&&void 0!==r||(e.loopStart=this.loopStart),null!==(i=e.loopEnd)&&void 0!==i||(e.loopEnd=this.loopEnd),null!==(o=e.startOffset)&&void 0!==o||(e.startOffset=this.startOffset),null!==(a=e.volume)&&void 0!==a||(e.volume=1),null!==(s=e.waitTime)&&void 0!==s||(e.waitTime=0);var l=this._createInstance();this._beforePlay(l),l.play(e),this._afterPlay(l),this._stopExcessInstances()}else this.resume()},t.prototype.stop=function(e){if(void 0===e&&(e={}),e.waitTime&&0{n.r(t),n.d(t,{grainPixelShaderWGSL:()=>a});var r=n(98519),i=(n(17393),"grainPixelShader"),o="#include\nvarying vUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d;uniform intensity: f32;uniform animatedSeed: f32;\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {fragmentOutputs.color=textureSample(textureSampler,textureSamplerSampler,input.vUV);var seed: vec2f=input.vUV*uniforms.animatedSeed;var grain: f32=dither(seed,uniforms.intensity);var lum: f32=getLuminance(fragmentOutputs.color.rgb);var grainAmount: f32=(cos(-PI+(lum*PI*2.))+1.)/2.;fragmentOutputs.color=vec4f(fragmentOutputs.color.rgb+grain*grainAmount,fragmentOutputs.color.a);fragmentOutputs.color=vec4f(max(fragmentOutputs.color.rgb,vec3f(0.0)),fragmentOutputs.color.a);}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},78145:(e,t,n)=>{n.r(t),n.d(t,{iblCdfyPixelShader:()=>a});var r=n(98519),i=(n(75334),"iblCdfyPixelShader"),o="precision highp sampler2D;precision highp samplerCube;\n#include\n#define PI 3.1415927\nvarying vec2 vUV;\n#ifdef IBL_USE_CUBE_MAP\nuniform samplerCube iblSource;\n#else\nuniform sampler2D iblSource;\n#endif\nuniform int iblHeight;\n#ifdef IBL_USE_CUBE_MAP\nfloat fetchCube(vec2 uv) {vec3 direction=equirectangularToCubemapDirection(uv);return sin(PI*uv.y)*dot(textureCubeLodEXT(iblSource,direction,0.0).rgb,LuminanceEncodeApprox);}\n#else\nfloat fetchPanoramic(ivec2 Coords,float envmapHeight) {return sin(PI*(float(Coords.y)+0.5)/envmapHeight) *\ndot(texelFetch(iblSource,Coords,0).rgb,LuminanceEncodeApprox);}\n#endif\nvoid main(void) {ivec2 coords=ivec2(gl_FragCoord.x,gl_FragCoord.y);float cdfy=0.0;for (int y=1; y<=coords.y; y++) {\n#ifdef IBL_USE_CUBE_MAP\nvec2 uv=vec2(vUV.x,(float(y-1)+0.5)/float(iblHeight));cdfy+=fetchCube(uv);\n#else\ncdfy+=fetchPanoramic(ivec2(coords.x,y-1),float(iblHeight));\n#endif\n}\ngl_FragColor=vec4(cdfy,0.0,0.0,1.0);}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},78322:(e,t,n)=>{n.d(t,{C6:()=>i,Cg:()=>a,Cl:()=>o,YH:()=>l,fX:()=>c,sH:()=>s});var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)};function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var o=function(){return o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a}function s(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))}function l(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]{n.r(t),n.d(t,{packingFunctions:()=>a});var r=n(98519),i="packingFunctions",o="vec4 pack(float depth)\n{const vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const vec4 bit_mask=vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}\nfloat unpack(vec4 color)\n{const vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(color,bit_shift);}";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]=o);var a={name:i,shader:o}},78642:(e,t,n)=>{n.r(t),n.d(t,{circleOfConfusionPixelShaderWGSL:()=>a});var r=n(98519),i="circleOfConfusionPixelShader",o="varying vUV: vec2f;var depthSamplerSampler: sampler;var depthSampler: texture_2d;\n#ifndef COC_DEPTH_NOT_NORMALIZED\nuniform cameraMinMaxZ: vec2f;\n#endif\nuniform focusDistance: f32;uniform cocPrecalculation: f32;\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var depth: f32=textureSample(depthSampler,depthSamplerSampler,input.vUV).r;\n#define CUSTOM_COC_DEPTH\n#ifdef COC_DEPTH_NOT_NORMALIZED\nlet pixelDistance=depth*1000.0;\n#else\nlet pixelDistance: f32=(uniforms.cameraMinMaxZ.x+uniforms.cameraMinMaxZ.y*depth)*1000.0; \n#endif\n#define CUSTOM_COC_PIXELDISTANCE\nvar coc: f32=abs(uniforms.cocPrecalculation*((uniforms.focusDistance-pixelDistance)/pixelDistance));coc=clamp(coc,0.0,1.0);fragmentOutputs.color= vec4f(coc,coc,coc,1.0);}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},78665:(e,t,n)=>{n.r(t),n.d(t,{FlowGraphSetVariableBlock:()=>s});var r=n(78322),i=n(34623),o=n(88469),a=n(88099),s=function(e){function t(t){var n=e.call(this,t)||this;if(!t.variable&&!t.variables)throw new Error("FlowGraphSetVariableBlock: variable/variables is not defined");if(t.variables&&t.variable)throw new Error("FlowGraphSetVariableBlock: variable and variables are both defined");if(t.variables)for(var r=0,i=t.variables;r-1&&i.splice(l,1),e._setGlobalContextVariable("currentlyRunningAnimationGroups",i);break}}},a=0,s=i;a{var r=n(98519),i="prePassDeclaration";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="#ifdef PREPASS\n#ifdef PREPASS_LOCAL_POSITION\nvarying vPosition : vec3f;\n#endif\n#ifdef PREPASS_DEPTH\nvarying vViewPos: vec3f;\n#endif\n#ifdef PREPASS_NORMALIZED_VIEW_DEPTH\nvarying vNormViewDepth: f32;\n#endif\n#if defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR)\nvarying vCurrentPosition: vec4f;varying vPreviousPosition: vec4f;\n#endif\n#endif\n")},78750:(e,t,n)=>{n.r(t),n.d(t,{_HDRTextureLoader:()=>o});var r=n(51967),i=n(81152),o=function(){function e(){this.supportCascades=!1}return e.prototype.loadCubeData=function(){throw".hdr not supported in Cube."},e.prototype.loadData=function(e,t,n){for(var o=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),a=(0,r.NK)(o),s=(0,r.LT)(o,a),l=a.width*a.height,c=new Float32Array(4*l),u=0;u{n.r(t),n.d(t,{screenSpaceReflection2PixelShaderWGSL:()=>a});var r=n(98519),i=(n(17393),n(61669),n(7779),"screenSpaceReflection2PixelShader"),o="var textureSamplerSampler: sampler;var textureSampler: texture_2d;varying vUV: vec2f;\n#ifdef SSR_SUPPORTED\nvar reflectivitySamplerSampler: sampler;var reflectivitySampler: texture_2d;var normalSampler: texture_2d;var depthSampler: texture_2d;\n#ifdef SSRAYTRACE_USE_BACK_DEPTHBUFFER\nvar backDepthSampler: texture_2d;uniform backSizeFactor: f32;\n#endif\n#ifdef SSR_USE_ENVIRONMENT_CUBE\nvar envCubeSamplerSampler: sampler;var envCubeSampler: texture_cube;\n#ifdef SSR_USE_LOCAL_REFLECTIONMAP_CUBIC\nuniform vReflectionPosition: vec3f;uniform vReflectionSize: vec3f;\n#endif\n#endif\nuniform view: mat4x4f;uniform invView: mat4x4f;uniform projection: mat4x4f;uniform invProjectionMatrix: mat4x4f;uniform projectionPixel: mat4x4f;uniform nearPlaneZ: f32;uniform farPlaneZ: f32;uniform stepSize: f32;uniform maxSteps: f32;uniform strength: f32;uniform thickness: f32;uniform roughnessFactor: f32;uniform reflectionSpecularFalloffExponent: f32;uniform maxDistance: f32;uniform selfCollisionNumSkip: f32;uniform reflectivityThreshold: f32;\n#include\n#include\n#include\nfn hash(a: vec3f)->vec3f\n{var result=fract(a*0.8);result+=dot(result,result.yxz+19.19);return fract((result.xxy+result.yxx)*result.zyx);}\nfn computeAttenuationForIntersection(ihitPixel: vec2f,hitUV: vec2f,vsRayOrigin: vec3f,vsHitPoint: vec3f,reflectionVector: vec3f,maxRayDistance: f32,numIterations: f32)->f32 {var attenuation: f32=1.0;\n#ifdef SSR_ATTENUATE_SCREEN_BORDERS\nvar dCoords: vec2f=smoothstep(vec2f(0.2),vec2f(0.6),abs( vec2f(0.5,0.5)-hitUV.xy));attenuation*=clamp(1.0-(dCoords.x+dCoords.y),0.0,1.0);\n#endif\n#ifdef SSR_ATTENUATE_INTERSECTION_DISTANCE\nattenuation*=1.0-clamp(distance(vsRayOrigin,vsHitPoint)/maxRayDistance,0.0,1.0);\n#endif\n#ifdef SSR_ATTENUATE_INTERSECTION_NUMITERATIONS\nattenuation*=1.0-(numIterations/uniforms.maxSteps);\n#endif\n#ifdef SSR_ATTENUATE_BACKFACE_REFLECTION\nvar reflectionNormal: vec3f=texelFetch(normalSampler,hitPixel,0).xyz;var directionBasedAttenuation: f32=smoothstep(-0.17,0.0,dot(reflectionNormal,-reflectionVector));attenuation*=directionBasedAttenuation;\n#endif\nreturn attenuation;}\n#endif\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#ifdef SSR_SUPPORTED\nvar colorFull: vec4f=textureSampleLevel(textureSampler,textureSamplerSampler,input.vUV,0.0);var color: vec3f=colorFull.rgb;var reflectivity: vec4f=max(textureSampleLevel(reflectivitySampler,reflectivitySamplerSampler,input.vUV,0.0),vec4f(0.0));\n#ifndef SSR_DISABLE_REFLECTIVITY_TEST\nif (max(reflectivity.r,max(reflectivity.g,reflectivity.b))<=uniforms.reflectivityThreshold) {\n#ifdef SSR_USE_BLUR\nfragmentOutputs.color= vec4f(0.);\n#else\nfragmentOutputs.color=colorFull;\n#endif\nreturn fragmentOutputs;}\n#endif\n#ifdef SSR_INPUT_IS_GAMMA_SPACE\ncolor=toLinearSpaceVec3(color);\n#endif\nvar texSize: vec2f= vec2f(textureDimensions(depthSampler,0));var csNormal: vec3f=textureLoad(normalSampler,vec2(input.vUV*texSize),0).xyz; \n#ifdef SSR_DECODE_NORMAL\ncsNormal=csNormal*2.0-1.0;\n#endif\n#ifdef SSR_NORMAL_IS_IN_WORLDSPACE\ncsNormal=(uniforms.view* vec4f(csNormal,0.0)).xyz;\n#endif\nvar depth: f32=textureLoad(depthSampler,vec2(input.vUV*texSize),0).r;\n#ifdef SSRAYTRACE_SCREENSPACE_DEPTH\ndepth=linearizeDepth(depth,uniforms.nearPlaneZ,uniforms.farPlaneZ);\n#endif\nvar csPosition: vec3f=computeViewPosFromUVDepth(input.vUV,depth,uniforms.projection,uniforms.invProjectionMatrix);\n#ifdef ORTHOGRAPHIC_CAMERA\nvar csViewDirection: vec3f= vec3f(0.,0.,1.);\n#else\nvar csViewDirection: vec3f=normalize(csPosition);\n#endif\nvar csReflectedVector: vec3f=reflect(csViewDirection,csNormal);\n#ifdef SSR_USE_ENVIRONMENT_CUBE\nvar wReflectedVector: vec3f=(uniforms.invView* vec4f(csReflectedVector,0.0)).xyz;\n#ifdef SSR_USE_LOCAL_REFLECTIONMAP_CUBIC\nvar worldPos: vec4f=uniforms.invView* vec4f(csPosition,1.0);wReflectedVector=parallaxCorrectNormal(worldPos.xyz,normalize(wReflectedVector),uniforms.vReflectionSize,uniforms.vReflectionPosition);\n#endif\n#ifdef SSR_INVERTCUBICMAP\nwReflectedVector.y*=-1.0;\n#endif\n#ifdef SSRAYTRACE_RIGHT_HANDED_SCENE\nwReflectedVector.z*=-1.0;\n#endif\nvar envColor: vec3f=textureSampleLevel(envCubeSampler,envCubeSamplerSampler,wReflectedVector,0.0).xyz;\n#ifdef SSR_ENVIRONMENT_CUBE_IS_GAMMASPACE\nenvColor=toLinearSpaceVec3(envColor);\n#endif\n#else\nvar envColor: vec3f=color;\n#endif\nvar reflectionAttenuation: f32=1.0;var rayHasHit: bool=false;var startPixel: vec2f;var hitPixel: vec2f;var hitPoint: vec3f;var numIterations: f32;\n#ifdef SSRAYTRACE_DEBUG\nvar debugColor: vec3f;\n#endif\n#ifdef SSR_ATTENUATE_FACING_CAMERA\nreflectionAttenuation*=1.0-smoothstep(0.25,0.5,dot(-csViewDirection,csReflectedVector));\n#endif\nif (reflectionAttenuation>0.0) {\n#ifdef SSR_USE_BLUR\nvar jitt: vec3f= vec3f(0.);\n#else\nvar roughness: f32=1.0-reflectivity.a;var jitt: vec3f=mix( vec3f(0.0),hash(csPosition)- vec3f(0.5),roughness)*uniforms.roughnessFactor; \n#endif\nvar uv2: vec2f=input.vUV*texSize;var c: f32=(uv2.x+uv2.y)*0.25;var jitter: f32=((c)%(1.0)); \nrayHasHit=traceScreenSpaceRay1(\ncsPosition,\nnormalize(csReflectedVector+jitt),\nuniforms.projectionPixel,\ndepthSampler,\ntexSize,\n#ifdef SSRAYTRACE_USE_BACK_DEPTHBUFFER\nbackDepthSampler,\nuniforms.backSizeFactor,\n#endif\nuniforms.thickness,\nuniforms.nearPlaneZ,\nuniforms.farPlaneZ,\nuniforms.stepSize,\njitter,\nuniforms.maxSteps,\nuniforms.maxDistance,\nuniforms.selfCollisionNumSkip,\n&startPixel,\n&hitPixel,\n&hitPoint,\n&numIterations\n#ifdef SSRAYTRACE_DEBUG\n,&debugColor\n#endif\n);}\n#ifdef SSRAYTRACE_DEBUG\nfragmentOutputs.color= vec4f(debugColor,1.);return fragmentOutputs;\n#endif\nvar F0: vec3f=reflectivity.rgb;var fresnel: vec3f=fresnelSchlickGGXVec3(max(dot(csNormal,-csViewDirection),0.0),F0, vec3f(1.));var SSR: vec3f=envColor;if (rayHasHit) {var reflectedColor: vec3f=textureLoad(textureSampler,vec2(hitPixel),0).rgb;\n#ifdef SSR_INPUT_IS_GAMMA_SPACE\nreflectedColor=toLinearSpaceVec3(reflectedColor);\n#endif\nreflectionAttenuation*=computeAttenuationForIntersection(hitPixel,hitPixel/texSize,csPosition,hitPoint,csReflectedVector,uniforms.maxDistance,numIterations);SSR=reflectedColor*reflectionAttenuation+(1.0-reflectionAttenuation)*envColor;}\n#ifndef SSR_BLEND_WITH_FRESNEL\nSSR*=fresnel;\n#endif\n#ifdef SSR_USE_BLUR\nvar blur_radius: f32=0.0;var roughness: f32=1.0-reflectivity.a*(1.0-uniforms.roughnessFactor);if (roughness>0.001) {var cone_angle: f32=min(roughness,0.999)*3.14159265*0.5;var cone_len: f32=distance(startPixel,hitPixel);var op_len: f32=2.0*tan(cone_angle)*cone_len; \nvar a: f32=op_len;var h: f32=cone_len;var a2: f32=a*a;var fh2: f32=4.0f*h*h;blur_radius=(a*(sqrt(a2+fh2)-a))/(4.0f*h);}\nfragmentOutputs.color= vec4f(SSR,blur_radius/255.0); \n#else\n#ifdef SSR_BLEND_WITH_FRESNEL\nvar reflectionMultiplier: vec3f=clamp(pow(fresnel*uniforms.strength, vec3f(uniforms.reflectionSpecularFalloffExponent)),vec3f(0.0),vec3f(1.0));\n#else\nvar reflectionMultiplier: vec3f=clamp(pow(reflectivity.rgb*uniforms.strength, vec3f(uniforms.reflectionSpecularFalloffExponent)),vec3f(0.0),vec3f(1.0));\n#endif\nvar colorMultiplier: vec3f=1.0-reflectionMultiplier;var finalColor: vec3f=(color*colorMultiplier)+(SSR*reflectionMultiplier);\n#ifdef SSR_OUTPUT_IS_GAMMA_SPACE\nfinalColor=toGammaSpaceVec3(finalColor);\n#endif\nfragmentOutputs.color= vec4f(finalColor,colorFull.a);\n#endif\n#else\nfragmentOutputs.color=textureSampleLevel(textureSampler,textureSamplerSampler,input.vUV,0.0);\n#endif\n}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},79124:(e,t,n)=>{var r=n(98519),i="pbrBlockNormalGeometric";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="vec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=normalize(cross(dFdx(vPositionW),dFdy(vPositionW)))*vEyePosition.w;\n#endif\nvec3 geometricNormalW=normalW;\n#if defined(TWOSIDEDLIGHTING) && defined(NORMAL)\ngeometricNormalW=gl_FrontFacing ? geometricNormalW : -geometricNormalW;\n#endif\n")},79147:(e,t,n)=>{n.r(t),n.d(t,{copyTexture3DLayerToTexturePixelShaderWGSL:()=>a});var r=n(98519),i="copyTexture3DLayerToTexturePixelShader",o="var textureSampler: texture_3d;uniform layerNum: i32;varying vUV: vec2f;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {let coord=vec3f(vec2f(input.vUV.x,input.vUV.y)*vec2f(textureDimensions(textureSampler,0).xy),f32(uniforms.layerNum));let color=textureLoad(textureSampler,vec3i(coord),0).rgb;fragmentOutputs.color= vec4f(color,1);}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},79401:(e,t,n)=>{n.r(t),n.d(t,{iblShadowSpatialBlurPixelShaderWGSL:()=>a});var r=n(98519),i="iblShadowSpatialBlurPixelShader",o="#define PI 3.1415927\nvarying vUV: vec2f;var depthSampler: texture_2d;var worldNormalSampler: texture_2d;var voxelTracingSampler : texture_2d;uniform blurParameters: vec4f;\n#define stridef uniforms.blurParameters.x\n#define worldScale uniforms.blurParameters.y\nconst weights=array(0.0625,0.25,0.375,0.25,0.0625);const nbWeights: i32=5;fn max2(v: vec2f,w: vec2f)->vec2f {return vec2f(max(v.x,w.x),max(v.y,w.y));}\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var gbufferRes=vec2f(textureDimensions(depthSampler,0));var gbufferPixelCoord= vec2i(fragmentInputs.vUV*gbufferRes);var shadowRes=vec2f(textureDimensions(voxelTracingSampler,0));var shadowPixelCoord= vec2i(fragmentInputs.vUV*shadowRes);var N: vec3f=textureLoad(worldNormalSampler,gbufferPixelCoord,0).xyz;if (length(N)<0.01) {fragmentOutputs.color=vec4f(1.0,1.0,0.0,1.0);return fragmentOutputs;}\nvar depth: f32=-textureLoad(depthSampler,gbufferPixelCoord,0).x;var X: vec4f= vec4f(0.0);for(var y: i32=0; y>1),y-(nbWeights>>1));var shadowCoords: vec2i=shadowPixelCoord+i32(stridef)*vec2i(x-(nbWeights>>1),y-(nbWeights>>1));var T : vec3f=textureLoad(voxelTracingSampler,shadowCoords,0).xyz;var ddepth: f32=-textureLoad(depthSampler,gBufferCoords,0).x-depth;var dN: vec3f=textureLoad(worldNormalSampler,gBufferCoords,0).xyz-N;var w: f32=weights[x]*weights[y] *\nexp2(max(-1000.0/(worldScale*worldScale),-0.5) *\n(ddepth*ddepth) -\n1e1*dot(dN,dN));X+= vec4f(w*T.x,w*T.y,w*T.z,w);}}\nfragmentOutputs.color= vec4f(X.x/X.w,X.y/X.w,X.z/X.w,1.0);}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},79444:(e,t,n)=>{n.r(t),n.d(t,{meshUVSpaceRendererFinaliserPixelShader:()=>a});var r=n(98519),i="meshUVSpaceRendererFinaliserPixelShader",o="precision highp float;varying vec2 vUV;uniform sampler2D textureSampler;uniform sampler2D maskTextureSampler;uniform vec2 textureSize;void main() {vec4 mask=texture2D(maskTextureSampler,vUV).rgba;if (mask.r>0.5) {gl_FragColor=texture2D(textureSampler,vUV);} else {vec2 texelSize=4.0/textureSize;vec2 uv_p01=vUV+vec2(-1.0,0.0)*texelSize;vec2 uv_p21=vUV+vec2(1.0,0.0)*texelSize;vec2 uv_p10=vUV+vec2(0.0,-1.0)*texelSize;vec2 uv_p12=vUV+vec2(0.0,1.0)*texelSize;float mask_p01=texture2D(maskTextureSampler,uv_p01).r;float mask_p21=texture2D(maskTextureSampler,uv_p21).r;float mask_p10=texture2D(maskTextureSampler,uv_p10).r;float mask_p12=texture2D(maskTextureSampler,uv_p12).r;vec4 col=vec4(0.0,0.0,0.0,0.0);float total_weight=0.0;if (mask_p01>0.5) {col+=texture2D(textureSampler,uv_p01);total_weight+=1.0;}\nif (mask_p21>0.5) {col+=texture2D(textureSampler,uv_p21);total_weight+=1.0;}\nif (mask_p10>0.5) {col+=texture2D(textureSampler,uv_p10);total_weight+=1.0;}\nif (mask_p12>0.5) {col+=texture2D(textureSampler,uv_p12);total_weight+=1.0;}\nif (total_weight>0.0) {gl_FragColor=col/total_weight;} else {gl_FragColor=col;}}}\n";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},79504:(e,t,n)=>{n.r(t),n.d(t,{iblDominantDirectionPixelShader:()=>a});var r=n(98519),i=(n(75334),n(19568),n(64244),n(10114),"iblDominantDirectionPixelShader"),o="precision highp sampler2D;precision highp samplerCube;\n#include\n#include\n#include\n#include\nvarying vec2 vUV;uniform sampler2D icdfSampler;void main(void) {vec3 lightDir=vec3(0.0,0.0,0.0);for(uint i=0u; i{n.r(t),n.d(t,{shadowMapFragmentWGSL:()=>a});var r=n(98519),i="shadowMapFragment",o="var depthSM: f32=fragmentInputs.vDepthMetricSM;\n#if defined(SM_DEPTHCLAMP) && SM_DEPTHCLAMP==1\n#if SM_USEDISTANCE==1\ndepthSM=(length(fragmentInputs.vPositionWSM-uniforms.lightDataSM)+uniforms.depthValuesSM.x)/uniforms.depthValuesSM.y+uniforms.biasAndScaleSM.x;\n#else\n#ifdef USE_REVERSE_DEPTHBUFFER\ndepthSM=(-fragmentInputs.zSM+uniforms.depthValuesSM.x)/uniforms.depthValuesSM.y+uniforms.biasAndScaleSM.x;\n#else\ndepthSM=(fragmentInputs.zSM+uniforms.depthValuesSM.x)/uniforms.depthValuesSM.y+uniforms.biasAndScaleSM.x;\n#endif\n#endif\ndepthSM=clamp(depthSM,0.0,1.0);\n#ifdef USE_REVERSE_DEPTHBUFFER\nfragmentOutputs.fragDepth=clamp(1.0-depthSM,0.0,1.0);\n#else\nfragmentOutputs.fragDepth=clamp(depthSM,0.0,1.0); \n#endif\n#elif SM_USEDISTANCE==1\ndepthSM=(length(fragmentInputs.vPositionWSM-uniforms.lightDataSM)+uniforms.depthValuesSM.x)/uniforms.depthValuesSM.y+uniforms.biasAndScaleSM.x;\n#endif\n#if SM_ESM==1\ndepthSM=clamp(exp(-min(87.,uniforms.biasAndScaleSM.z*depthSM)),0.,1.);\n#endif\n#if SM_FLOAT==1\nfragmentOutputs.color= vec4f(depthSM,1.0,1.0,1.0);\n#else\nfragmentOutputs.color=pack(depthSM);\n#endif\n";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]=o);var a={name:i,shader:o}},79645:(e,t,n)=>{n.r(t),n.d(t,{layerVertexShader:()=>a});var r=n(98519),i="layerVertexShader",o="attribute vec2 position;uniform vec2 scale;uniform vec2 offset;uniform mat4 textureMatrix;varying vec2 vUV;const vec2 madd=vec2(0.5,0.5);\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvec2 shiftedPosition=position*scale+offset;vUV=vec2(textureMatrix*vec4(shiftedPosition*madd+madd,1.0,0.0));gl_Position=vec4(shiftedPosition,0.0,1.0);\n#define CUSTOM_VERTEX_MAIN_END\n}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},79716:(e,t,n)=>{var r=n(98519),i="fogVertexDeclaration";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="#ifdef FOG\nvarying vFogDistance: vec3f;\n#endif\n")},79908:(e,t,n)=>{n.r(t),n.d(t,{shadowMapPixelShader:()=>l});var r=n(98519),i=(n(78531),"bayerDitherFunctions");r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="float bayerDither2(vec2 _P) {return mod(2.0*_P.y+_P.x+1.0,4.0);}\nfloat bayerDither4(vec2 _P) {vec2 P1=mod(_P,2.0); \nvec2 P2=floor(0.5*mod(_P,4.0)); \nreturn 4.0*bayerDither2(P1)+bayerDither2(P2);}\nfloat bayerDither8(vec2 _P) {vec2 P1=mod(_P,2.0); \nvec2 P2=floor(0.5 *mod(_P,4.0)); \nvec2 P4=floor(0.25*mod(_P,8.0)); \nreturn 4.0*(4.0*bayerDither2(P1)+bayerDither2(P2))+bayerDither2(P4);}\n");var o="shadowMapFragmentExtraDeclaration";r.l.IncludesShadersStore[o]||(r.l.IncludesShadersStore[o]="#if SM_FLOAT==0\n#include\n#endif\n#if SM_SOFTTRANSPARENTSHADOW==1\n#include\nuniform vec2 softTransparentShadowSM;\n#endif\nvarying float vDepthMetricSM;\n#if SM_USEDISTANCE==1\nuniform vec3 lightDataSM;varying vec3 vPositionWSM;\n#endif\nuniform vec3 biasAndScaleSM;uniform vec2 depthValuesSM;\n#if defined(SM_DEPTHCLAMP) && SM_DEPTHCLAMP==1\nvarying float zSM;\n#endif\n"),n(27003),n(39643),n(29313);var a="shadowMapPixelShader",s="#include\n#ifdef ALPHATEXTURE\nvarying vec2 vUV;uniform sampler2D diffuseSampler;\n#endif\n#include\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\n#include\n#ifdef ALPHATEXTURE\nvec4 opacityMap=texture2D(diffuseSampler,vUV);float alphaFromAlphaTexture=opacityMap.a;\n#if SM_SOFTTRANSPARENTSHADOW==1\nif (softTransparentShadowSM.y==1.0) {opacityMap.rgb=opacityMap.rgb*vec3(0.3,0.59,0.11);alphaFromAlphaTexture=opacityMap.x+opacityMap.y+opacityMap.z;}\n#endif\n#ifdef ALPHATESTVALUE\nif (alphaFromAlphaTexture=softTransparentShadowSM.x*alphaFromAlphaTexture) discard;\n#else\nif ((bayerDither8(floor(mod(gl_FragCoord.xy,8.0))))/64.0>=softTransparentShadowSM.x) discard;\n#endif\n#endif\n#include\n}";r.l.ShadersStore[a]||(r.l.ShadersStore[a]=s);var l={name:a,shader:s}},80078:(e,t,n)=>{n.d(t,{x:()=>a});var r=n(66377),i=n(6784),o=n(7164),a=function(){function e(t){var n,r=this;this.config=t,this.dispatchEventsSynchronously=!0,this._flowGraphs=[],this._customEventsMap=new Map,this._eventExecutionCounter=new Map,this._executeOnNextFrame=[],this._eventUniqueId=0,this._disposeObserver=this.config.scene.onDisposeObservable.add((function(){r.dispose()})),this._onBeforeRenderObserver=this.config.scene.onBeforeRenderObservable.add((function(){r._eventExecutionCounter.clear();var e=r._executeOnNextFrame.slice(0);if(e.length)for(var t=function(e){r.notifyCustomEvent(e.id,e.data,!1);var t=r._executeOnNextFrame.findIndex((function(t){return t.uniqueId===e.uniqueId}));-1!==t&&r._executeOnNextFrame.splice(t,1)},n=0,i=e;n=e.MaxEventTypeExecutionPerFrame)return void(i===e.MaxEventTypeExecutionPerFrame&&o.V.Warn('FlowGraphCoordinator: Too many executions of event "'.concat(t,'".')))}else this._eventExecutionCounter.set(t,1);var a=this._customEventsMap.get(t);a&&a.notifyObservers(n)}},e.MaxEventsPerType=30,e.MaxEventTypeExecutionPerFrame=30,e.SceneCoordinators=new Map,e}()},80119:(e,t,n)=>{n.r(t),n.d(t,{depthPixelShader:()=>a});var r=n(98519),i=(n(27003),n(78531),n(39643),"depthPixelShader"),o="#ifdef ALPHATEST\nvarying vec2 vUV;uniform sampler2D diffuseSampler;\n#endif\n#include\nvarying float vDepthMetric;\n#ifdef PACKED\n#include\n#endif\n#ifdef STORE_CAMERASPACE_Z\nvarying vec4 vViewPos;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\n#include\n#ifdef ALPHATEST\nif (texture2D(diffuseSampler,vUV).a<0.4)\ndiscard;\n#endif\n#ifdef STORE_CAMERASPACE_Z\n#ifdef PACKED\ngl_FragColor=pack(vViewPos.z);\n#else\ngl_FragColor=vec4(vViewPos.z,0.0,0.0,1.0);\n#endif\n#else\n#ifdef NONLINEARDEPTH\n#ifdef PACKED\ngl_FragColor=pack(gl_FragCoord.z);\n#else\ngl_FragColor=vec4(gl_FragCoord.z,0.0,0.0,0.0);\n#endif\n#else\n#ifdef PACKED\ngl_FragColor=pack(vDepthMetric);\n#else\ngl_FragColor=vec4(vDepthMetric,0.0,0.0,1.0);\n#endif\n#endif\n#endif\n}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},80239:(e,t,n)=>{n.r(t),n.d(t,{depthOfFieldMergePixelShaderWGSL:()=>a});var r=n(98519),i="depthOfFieldMergePixelShader",o="varying vUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d;var circleOfConfusionSamplerSampler: sampler;var circleOfConfusionSampler: texture_2d;var blurStep0Sampler: sampler;var blurStep0: texture_2d;\n#if BLUR_LEVEL>0\nvar blurStep1Sampler: sampler;var blurStep1: texture_2d;\n#endif\n#if BLUR_LEVEL>1\nvar blurStep2Sampler: sampler;var blurStep2: texture_2d;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var coc: f32=textureSampleLevel(circleOfConfusionSampler,circleOfConfusionSamplerSampler,input.vUV,0.0).r;\n#if BLUR_LEVEL==0\nvar original: vec4f=textureSampleLevel(textureSampler,textureSamplerSampler,input.vUV,0.0);var blurred0: vec4f=textureSampleLevel(blurStep0,blurStep0Sampler,input.vUV,0.0);fragmentOutputs.color=mix(original,blurred0,coc);\n#endif\n#if BLUR_LEVEL==1\nif(coc<0.5){var original: vec4f=textureSampleLevel(textureSampler,textureSamplerSampler,input.vUV,0.0);var blurred1: vec4f=textureSampleLevel(blurStep1,blurStep1Sampler,input.vUV,0.0);fragmentOutputs.color=mix(original,blurred1,coc/0.5);}else{var blurred0: vec4f=textureSampleLevel(blurStep0,blurStep0Sampler,input.vUV,0.0);var blurred1: vec4f=textureSampleLevel(blurStep1,blurStep1Sampler,input.vUV,0.0);fragmentOutputs.color=mix(blurred1,blurred0,(coc-0.5)/0.5);}\n#endif\n#if BLUR_LEVEL==2\nif(coc<0.33){var original: vec4f=textureSampleLevel(textureSampler,textureSamplerSampler,input.vUV,0.0);var blurred2: vec4f=textureSampleLevel(blurStep2,blurStep2Sampler,input.vUV,0.0);fragmentOutputs.color=mix(original,blurred2,coc/0.33);}else if(coc<0.66){var blurred1: vec4f=textureSampleLevel(blurStep1,blurStep1Sampler,input.vUV,0.0);var blurred2: vec4f=textureSampleLevel(blurStep2,blurStep2Sampler,input.vUV,0.0);fragmentOutputs.color=mix(blurred2,blurred1,(coc-0.33)/0.33);}else{var blurred0: vec4f=textureSampleLevel(blurStep0,blurStep0Sampler,input.vUV,0.0);var blurred1: vec4f=textureSampleLevel(blurStep1,blurStep1Sampler,input.vUV,0.0);fragmentOutputs.color=mix(blurred1,blurred0,(coc-0.66)/0.34);}\n#endif\n}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},80244:(e,t,n)=>{n.d(t,{T:()=>i,h:()=>o});var r=n(78322),i=function(){function e(e){this._pendingActions=new Array,this._workerInfos=e.map((function(e){return{workerPromise:Promise.resolve(e),idle:!0}}))}return e.prototype.dispose=function(){for(var e=0,t=this._workerInfos;e{n.r(t),n.d(t,{filterPixelShader:()=>a});var r=n(98519),i="filterPixelShader",o="varying vec2 vUV;uniform sampler2D textureSampler;uniform mat4 kernelMatrix;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{vec3 baseColor=texture2D(textureSampler,vUV).rgb;vec3 updatedColor=(kernelMatrix*vec4(baseColor,1.0)).rgb;gl_FragColor=vec4(updatedColor,1.0);}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},80752:(e,t,n)=>{var r=n(98519),i=(n(69137),"pbrDirectLightingSetupFunctions");r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="struct preLightingInfo\n{vec3 lightOffset;float lightDistanceSquared;float lightDistance;float attenuation;vec3 L;vec3 H;float NdotV;float NdotLUnclamped;float NdotL;float VdotH;float LdotV;float roughness;float diffuseRoughness;vec3 surfaceAlbedo;\n#ifdef IRIDESCENCE\nfloat iridescenceIntensity;\n#endif\n#if defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)\nvec3 areaLightDiffuse;\n#ifdef SPECULARTERM\nvec3 areaLightSpecular;vec4 areaLightFresnel;\n#endif\n#endif\n};preLightingInfo computePointAndSpotPreLightingInfo(vec4 lightData,vec3 V,vec3 N,vec3 posW) {preLightingInfo result;result.lightOffset=lightData.xyz-posW;result.lightDistanceSquared=dot(result.lightOffset,result.lightOffset);result.lightDistance=sqrt(result.lightDistanceSquared);result.L=normalize(result.lightOffset);result.H=normalize(V+result.L);result.VdotH=saturate(dot(V,result.H));result.NdotLUnclamped=dot(N,result.L);result.NdotL=saturateEps(result.NdotLUnclamped);result.LdotV=0.;result.roughness=0.;result.diffuseRoughness=0.;result.surfaceAlbedo=vec3(0.);return result;}\npreLightingInfo computeDirectionalPreLightingInfo(vec4 lightData,vec3 V,vec3 N) {preLightingInfo result;result.lightDistance=length(-lightData.xyz);result.L=normalize(-lightData.xyz);result.H=normalize(V+result.L);result.VdotH=saturate(dot(V,result.H));result.NdotLUnclamped=dot(N,result.L);result.NdotL=saturateEps(result.NdotLUnclamped);result.LdotV=dot(result.L,V);result.roughness=0.;result.diffuseRoughness=0.;result.surfaceAlbedo=vec3(0.);return result;}\npreLightingInfo computeHemisphericPreLightingInfo(vec4 lightData,vec3 V,vec3 N) {preLightingInfo result;result.NdotL=dot(N,lightData.xyz)*0.5+0.5;result.NdotL=saturateEps(result.NdotL);result.NdotLUnclamped=result.NdotL;\n#ifdef SPECULARTERM\nresult.L=normalize(lightData.xyz);result.H=normalize(V+result.L);result.VdotH=saturate(dot(V,result.H));\n#endif\nresult.LdotV=0.;result.roughness=0.;result.diffuseRoughness=0.;result.surfaceAlbedo=vec3(0.);return result;}\n#if defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)\n#include\nuniform sampler2D areaLightsLTC1Sampler;uniform sampler2D areaLightsLTC2Sampler;preLightingInfo computeAreaPreLightingInfo(sampler2D ltc1,sampler2D ltc2,vec3 viewDirectionW,vec3 vNormal,vec3 vPosition,vec4 lightData,vec3 halfWidth,vec3 halfHeight,float roughness )\n{preLightingInfo result;result.lightOffset=lightData.xyz-vPosition;result.lightDistanceSquared=dot(result.lightOffset,result.lightOffset);result.lightDistance=sqrt(result.lightDistanceSquared);areaLightData data=computeAreaLightSpecularDiffuseFresnel(ltc1,ltc2,viewDirectionW,vNormal,vPosition,lightData.xyz,halfWidth,halfHeight,roughness);\n#ifdef SPECULARTERM\nresult.areaLightFresnel=data.Fresnel;result.areaLightSpecular=data.Specular;\n#endif\nresult.areaLightDiffuse=data.Diffuse;result.LdotV=0.;result.roughness=0.;result.diffuseRoughness=0.;result.surfaceAlbedo=vec3(0.);return result;}\n#endif\n")},81067:(e,t,n)=>{var r=n(98519),i="samplerVertexImplementation";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#if defined(_DEFINENAME_) && _DEFINENAME_DIRECTUV==0\nif (v_INFONAME_==0.)\n{v_VARYINGNAME_UV=vec2(_MATRIXNAME_Matrix*vec4(uvUpdated,1.0,0.0));}\n#ifdef UV2\nelse if (v_INFONAME_==1.)\n{v_VARYINGNAME_UV=vec2(_MATRIXNAME_Matrix*vec4(uv2Updated,1.0,0.0));}\n#endif\n#ifdef UV3\nelse if (v_INFONAME_==2.)\n{v_VARYINGNAME_UV=vec2(_MATRIXNAME_Matrix*vec4(uv3,1.0,0.0));}\n#endif\n#ifdef UV4\nelse if (v_INFONAME_==3.)\n{v_VARYINGNAME_UV=vec2(_MATRIXNAME_Matrix*vec4(uv4,1.0,0.0));}\n#endif\n#ifdef UV5\nelse if (v_INFONAME_==4.)\n{v_VARYINGNAME_UV=vec2(_MATRIXNAME_Matrix*vec4(uv5,1.0,0.0));}\n#endif\n#ifdef UV6\nelse if (v_INFONAME_==5.)\n{v_VARYINGNAME_UV=vec2(_MATRIXNAME_Matrix*vec4(uv6,1.0,0.0));}\n#endif\n#endif\n")},81152:(e,t,n)=>{n.d(t,{Y:()=>r});var r=function(){function e(){}return e.AUTOSAMPLERSUFFIX="Sampler",e.DISABLEUA="#define DISABLE_UNIFORMITY_ANALYSIS",e.ALPHA_DISABLE=0,e.ALPHA_ADD=1,e.ALPHA_COMBINE=2,e.ALPHA_SUBTRACT=3,e.ALPHA_MULTIPLY=4,e.ALPHA_MAXIMIZED=5,e.ALPHA_ONEONE=6,e.ALPHA_PREMULTIPLIED=7,e.ALPHA_PREMULTIPLIED_PORTERDUFF=8,e.ALPHA_INTERPOLATE=9,e.ALPHA_SCREENMODE=10,e.ALPHA_ONEONE_ONEONE=11,e.ALPHA_ALPHATOCOLOR=12,e.ALPHA_REVERSEONEMINUS=13,e.ALPHA_SRC_DSTONEMINUSSRCALPHA=14,e.ALPHA_ONEONE_ONEZERO=15,e.ALPHA_EXCLUSION=16,e.ALPHA_LAYER_ACCUMULATE=17,e.ALPHA_MIN=18,e.ALPHA_MAX=19,e.ALPHA_DUAL_SRC0_ADD_SRC1xDST=20,e.ALPHA_EQUATION_ADD=0,e.ALPHA_EQUATION_SUBSTRACT=1,e.ALPHA_EQUATION_REVERSE_SUBTRACT=2,e.ALPHA_EQUATION_MAX=3,e.ALPHA_EQUATION_MIN=4,e.ALPHA_EQUATION_DARKEN=5,e.DELAYLOADSTATE_NONE=0,e.DELAYLOADSTATE_LOADED=1,e.DELAYLOADSTATE_LOADING=2,e.DELAYLOADSTATE_NOTLOADED=4,e.NEVER=512,e.ALWAYS=519,e.LESS=513,e.EQUAL=514,e.LEQUAL=515,e.GREATER=516,e.GEQUAL=518,e.NOTEQUAL=517,e.KEEP=7680,e.ZERO=0,e.REPLACE=7681,e.INCR=7682,e.DECR=7683,e.INVERT=5386,e.INCR_WRAP=34055,e.DECR_WRAP=34056,e.TEXTURE_CLAMP_ADDRESSMODE=0,e.TEXTURE_WRAP_ADDRESSMODE=1,e.TEXTURE_MIRROR_ADDRESSMODE=2,e.TEXTURE_CREATIONFLAG_STORAGE=1,e.TEXTUREFORMAT_ALPHA=0,e.TEXTUREFORMAT_LUMINANCE=1,e.TEXTUREFORMAT_LUMINANCE_ALPHA=2,e.TEXTUREFORMAT_RGB=4,e.TEXTUREFORMAT_RGBA=5,e.TEXTUREFORMAT_RED=6,e.TEXTUREFORMAT_R=6,e.TEXTUREFORMAT_R16_UNORM=33322,e.TEXTUREFORMAT_RG16_UNORM=33324,e.TEXTUREFORMAT_RGB16_UNORM=32852,e.TEXTUREFORMAT_RGBA16_UNORM=32859,e.TEXTUREFORMAT_R16_SNORM=36760,e.TEXTUREFORMAT_RG16_SNORM=36761,e.TEXTUREFORMAT_RGB16_SNORM=36762,e.TEXTUREFORMAT_RGBA16_SNORM=36763,e.TEXTUREFORMAT_RG=7,e.TEXTUREFORMAT_RED_INTEGER=8,e.TEXTUREFORMAT_R_INTEGER=8,e.TEXTUREFORMAT_RG_INTEGER=9,e.TEXTUREFORMAT_RGB_INTEGER=10,e.TEXTUREFORMAT_RGBA_INTEGER=11,e.TEXTUREFORMAT_BGRA=12,e.TEXTUREFORMAT_DEPTH24_STENCIL8=13,e.TEXTUREFORMAT_DEPTH32_FLOAT=14,e.TEXTUREFORMAT_DEPTH16=15,e.TEXTUREFORMAT_DEPTH24=16,e.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8=17,e.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8=18,e.TEXTUREFORMAT_STENCIL8=19,e.TEXTUREFORMAT_UNDEFINED=4294967295,e.TEXTUREFORMAT_COMPRESSED_RGBA_BPTC_UNORM=36492,e.TEXTUREFORMAT_COMPRESSED_SRGB_ALPHA_BPTC_UNORM=36493,e.TEXTUREFORMAT_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT=36495,e.TEXTUREFORMAT_COMPRESSED_RGB_BPTC_SIGNED_FLOAT=36494,e.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT5=33779,e.TEXTUREFORMAT_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919,e.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT3=33778,e.TEXTUREFORMAT_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918,e.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT1=33777,e.TEXTUREFORMAT_COMPRESSED_RGB_S3TC_DXT1=33776,e.TEXTUREFORMAT_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917,e.TEXTUREFORMAT_COMPRESSED_SRGB_S3TC_DXT1_EXT=35916,e.TEXTUREFORMAT_COMPRESSED_RGBA_ASTC_4x4=37808,e.TEXTUREFORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840,e.TEXTUREFORMAT_COMPRESSED_RGB_ETC1_WEBGL=36196,e.TEXTUREFORMAT_COMPRESSED_RGB8_ETC2=37492,e.TEXTUREFORMAT_COMPRESSED_SRGB8_ETC2=37493,e.TEXTUREFORMAT_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494,e.TEXTUREFORMAT_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495,e.TEXTUREFORMAT_COMPRESSED_RGBA8_ETC2_EAC=37496,e.TEXTUREFORMAT_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497,e.TEXTURETYPE_UNSIGNED_BYTE=0,e.TEXTURETYPE_UNSIGNED_INT=0,e.TEXTURETYPE_FLOAT=1,e.TEXTURETYPE_HALF_FLOAT=2,e.TEXTURETYPE_BYTE=3,e.TEXTURETYPE_SHORT=4,e.TEXTURETYPE_UNSIGNED_SHORT=5,e.TEXTURETYPE_INT=6,e.TEXTURETYPE_UNSIGNED_INTEGER=7,e.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4=8,e.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1=9,e.TEXTURETYPE_UNSIGNED_SHORT_5_6_5=10,e.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV=11,e.TEXTURETYPE_UNSIGNED_INT_24_8=12,e.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV=13,e.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV=14,e.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV=15,e.TEXTURETYPE_UNDEFINED=16,e.TEXTURE_2D=3553,e.TEXTURE_2D_ARRAY=35866,e.TEXTURE_CUBE_MAP=34067,e.TEXTURE_CUBE_MAP_ARRAY=3735928559,e.TEXTURE_3D=32879,e.TEXTURE_NEAREST_SAMPLINGMODE=1,e.TEXTURE_NEAREST_NEAREST=1,e.TEXTURE_BILINEAR_SAMPLINGMODE=2,e.TEXTURE_LINEAR_LINEAR=2,e.TEXTURE_TRILINEAR_SAMPLINGMODE=3,e.TEXTURE_LINEAR_LINEAR_MIPLINEAR=3,e.TEXTURE_NEAREST_NEAREST_MIPNEAREST=4,e.TEXTURE_NEAREST_LINEAR_MIPNEAREST=5,e.TEXTURE_NEAREST_LINEAR_MIPLINEAR=6,e.TEXTURE_NEAREST_LINEAR=7,e.TEXTURE_NEAREST_NEAREST_MIPLINEAR=8,e.TEXTURE_LINEAR_NEAREST_MIPNEAREST=9,e.TEXTURE_LINEAR_NEAREST_MIPLINEAR=10,e.TEXTURE_LINEAR_LINEAR_MIPNEAREST=11,e.TEXTURE_LINEAR_NEAREST=12,e.TEXTURE_EXPLICIT_MODE=0,e.TEXTURE_SPHERICAL_MODE=1,e.TEXTURE_PLANAR_MODE=2,e.TEXTURE_CUBIC_MODE=3,e.TEXTURE_PROJECTION_MODE=4,e.TEXTURE_SKYBOX_MODE=5,e.TEXTURE_INVCUBIC_MODE=6,e.TEXTURE_EQUIRECTANGULAR_MODE=7,e.TEXTURE_FIXED_EQUIRECTANGULAR_MODE=8,e.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE=9,e.TEXTURE_FILTERING_QUALITY_OFFLINE=4096,e.TEXTURE_FILTERING_QUALITY_HIGH=64,e.TEXTURE_FILTERING_QUALITY_MEDIUM=16,e.TEXTURE_FILTERING_QUALITY_LOW=8,e.SCALEMODE_FLOOR=1,e.SCALEMODE_NEAREST=2,e.SCALEMODE_CEILING=3,e.MATERIAL_TextureDirtyFlag=1,e.MATERIAL_LightDirtyFlag=2,e.MATERIAL_FresnelDirtyFlag=4,e.MATERIAL_AttributesDirtyFlag=8,e.MATERIAL_MiscDirtyFlag=16,e.MATERIAL_PrePassDirtyFlag=32,e.MATERIAL_ImageProcessingDirtyFlag=64,e.MATERIAL_AllDirtyFlag=127,e.MATERIAL_TriangleFillMode=0,e.MATERIAL_WireFrameFillMode=1,e.MATERIAL_PointFillMode=2,e.MATERIAL_PointListDrawMode=3,e.MATERIAL_LineListDrawMode=4,e.MATERIAL_LineLoopDrawMode=5,e.MATERIAL_LineStripDrawMode=6,e.MATERIAL_TriangleStripDrawMode=7,e.MATERIAL_TriangleFanDrawMode=8,e.MATERIAL_ClockWiseSideOrientation=0,e.MATERIAL_CounterClockWiseSideOrientation=1,e.MATERIAL_DIFFUSE_MODEL_E_OREN_NAYAR=0,e.MATERIAL_DIFFUSE_MODEL_BURLEY=1,e.MATERIAL_DIFFUSE_MODEL_LAMBERT=2,e.MATERIAL_DIFFUSE_MODEL_LEGACY=3,e.MATERIAL_DIELECTRIC_SPECULAR_MODEL_GLTF=0,e.MATERIAL_DIELECTRIC_SPECULAR_MODEL_OPENPBR=1,e.MATERIAL_CONDUCTOR_SPECULAR_MODEL_GLTF=0,e.MATERIAL_CONDUCTOR_SPECULAR_MODEL_OPENPBR=1,e.ACTION_NothingTrigger=0,e.ACTION_OnPickTrigger=1,e.ACTION_OnLeftPickTrigger=2,e.ACTION_OnRightPickTrigger=3,e.ACTION_OnCenterPickTrigger=4,e.ACTION_OnPickDownTrigger=5,e.ACTION_OnDoublePickTrigger=6,e.ACTION_OnPickUpTrigger=7,e.ACTION_OnPickOutTrigger=16,e.ACTION_OnLongPressTrigger=8,e.ACTION_OnPointerOverTrigger=9,e.ACTION_OnPointerOutTrigger=10,e.ACTION_OnEveryFrameTrigger=11,e.ACTION_OnIntersectionEnterTrigger=12,e.ACTION_OnIntersectionExitTrigger=13,e.ACTION_OnKeyDownTrigger=14,e.ACTION_OnKeyUpTrigger=15,e.PARTICLES_BILLBOARDMODE_Y=2,e.PARTICLES_BILLBOARDMODE_ALL=7,e.PARTICLES_BILLBOARDMODE_STRETCHED=8,e.PARTICLES_BILLBOARDMODE_STRETCHED_LOCAL=9,e.MESHES_CULLINGSTRATEGY_STANDARD=0,e.MESHES_CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY=1,e.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION=2,e.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY=3,e.SCENELOADER_NO_LOGGING=0,e.SCENELOADER_MINIMAL_LOGGING=1,e.SCENELOADER_SUMMARY_LOGGING=2,e.SCENELOADER_DETAILED_LOGGING=3,e.PREPASS_IRRADIANCE_TEXTURE_TYPE=0,e.PREPASS_POSITION_TEXTURE_TYPE=1,e.PREPASS_VELOCITY_TEXTURE_TYPE=2,e.PREPASS_REFLECTIVITY_TEXTURE_TYPE=3,e.PREPASS_COLOR_TEXTURE_TYPE=4,e.PREPASS_DEPTH_TEXTURE_TYPE=5,e.PREPASS_NORMAL_TEXTURE_TYPE=6,e.PREPASS_ALBEDO_SQRT_TEXTURE_TYPE=7,e.PREPASS_WORLD_NORMAL_TEXTURE_TYPE=8,e.PREPASS_LOCAL_POSITION_TEXTURE_TYPE=9,e.PREPASS_SCREENSPACE_DEPTH_TEXTURE_TYPE=10,e.PREPASS_VELOCITY_LINEAR_TEXTURE_TYPE=11,e.PREPASS_ALBEDO_TEXTURE_TYPE=12,e.PREPASS_NORMALIZED_VIEW_DEPTH_TEXTURE_TYPE=13,e.BUFFER_CREATIONFLAG_READ=1,e.BUFFER_CREATIONFLAG_WRITE=2,e.BUFFER_CREATIONFLAG_READWRITE=3,e.BUFFER_CREATIONFLAG_UNIFORM=4,e.BUFFER_CREATIONFLAG_VERTEX=8,e.BUFFER_CREATIONFLAG_INDEX=16,e.BUFFER_CREATIONFLAG_STORAGE=32,e.BUFFER_CREATIONFLAG_INDIRECT=64,e.RENDERPASS_MAIN=0,e.INPUT_ALT_KEY=18,e.INPUT_CTRL_KEY=17,e.INPUT_META_KEY1=91,e.INPUT_META_KEY2=92,e.INPUT_META_KEY3=93,e.INPUT_SHIFT_KEY=16,e.SNAPSHOTRENDERING_STANDARD=0,e.SNAPSHOTRENDERING_FAST=1,e.PERSPECTIVE_CAMERA=0,e.ORTHOGRAPHIC_CAMERA=1,e.FOVMODE_VERTICAL_FIXED=0,e.FOVMODE_HORIZONTAL_FIXED=1,e.RIG_MODE_NONE=0,e.RIG_MODE_STEREOSCOPIC_ANAGLYPH=10,e.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL=11,e.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED=12,e.RIG_MODE_STEREOSCOPIC_OVERUNDER=13,e.RIG_MODE_STEREOSCOPIC_INTERLACED=14,e.RIG_MODE_VR=20,e.RIG_MODE_CUSTOM=22,e.MAX_SUPPORTED_UV_SETS=6,e.GL_ALPHA_EQUATION_ADD=32774,e.GL_ALPHA_EQUATION_MIN=32775,e.GL_ALPHA_EQUATION_MAX=32776,e.GL_ALPHA_EQUATION_SUBTRACT=32778,e.GL_ALPHA_EQUATION_REVERSE_SUBTRACT=32779,e.GL_ALPHA_FUNCTION_SRC=768,e.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_COLOR=769,e.GL_ALPHA_FUNCTION_SRC_ALPHA=770,e.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA=771,e.GL_ALPHA_FUNCTION_DST_ALPHA=772,e.GL_ALPHA_FUNCTION_ONE_MINUS_DST_ALPHA=773,e.GL_ALPHA_FUNCTION_DST_COLOR=774,e.GL_ALPHA_FUNCTION_ONE_MINUS_DST_COLOR=775,e.GL_ALPHA_FUNCTION_SRC_ALPHA_SATURATED=776,e.GL_ALPHA_FUNCTION_CONSTANT_COLOR=32769,e.GL_ALPHA_FUNCTION_ONE_MINUS_CONSTANT_COLOR=32770,e.GL_ALPHA_FUNCTION_CONSTANT_ALPHA=32771,e.GL_ALPHA_FUNCTION_ONE_MINUS_CONSTANT_ALPHA=32772,e.GL_ALPHA_FUNCTION_SRC1_COLOR=35065,e.GL_ALPHA_FUNCTION_ONE_MINUS_SRC1_COLOR=35066,e.GL_ALPHA_FUNCTION_SRC1_ALPHA=34185,e.GL_ALPHA_FUNCTION_ONE_MINUS_SRC1_ALPHA=35067,e.SnippetUrl="https://snippet.babylonjs.com",e.FOGMODE_NONE=0,e.FOGMODE_EXP=1,e.FOGMODE_EXP2=2,e.FOGMODE_LINEAR=3,e.BYTE=5120,e.UNSIGNED_BYTE=5121,e.SHORT=5122,e.UNSIGNED_SHORT=5123,e.INT=5124,e.UNSIGNED_INT=5125,e.FLOAT=5126,e.PositionKind="position",e.NormalKind="normal",e.TangentKind="tangent",e.UVKind="uv",e.UV2Kind="uv2",e.UV3Kind="uv3",e.UV4Kind="uv4",e.UV5Kind="uv5",e.UV6Kind="uv6",e.ColorKind="color",e.ColorInstanceKind="instanceColor",e.MatricesIndicesKind="matricesIndices",e.MatricesWeightsKind="matricesWeights",e.MatricesIndicesExtraKind="matricesIndicesExtra",e.MatricesWeightsExtraKind="matricesWeightsExtra",e.ANIMATIONTYPE_FLOAT=0,e.ANIMATIONTYPE_VECTOR3=1,e.ANIMATIONTYPE_QUATERNION=2,e.ANIMATIONTYPE_MATRIX=3,e.ANIMATIONTYPE_COLOR3=4,e.ANIMATIONTYPE_COLOR4=7,e.ANIMATIONTYPE_VECTOR2=5,e.ANIMATIONTYPE_SIZE=6,e.ShadowMinZ=0,e.ShadowMaxZ=1e4,e}()},81487:(e,t,n)=>{n.r(t),n.d(t,{iblVoxelGridPixelShader:()=>a});var r=n(98519),i="iblVoxelGridPixelShader",o="precision highp float;layout(location=0) out highp float glFragData[MAX_DRAW_BUFFERS];varying vec3 vNormalizedPosition;uniform float nearPlane;uniform float farPlane;uniform float stepSize;void main(void) {vec3 normPos=vNormalizedPosition.xyz;if (normPos.zfarPlane) {discard;}\nglFragData[0]=normPos.z=nearPlane+stepSize && normPos.z=nearPlane+2.0*stepSize && normPos.z=nearPlane+3.0*stepSize && normPos.z4\nglFragData[4]=normPos.z>=nearPlane+4.0*stepSize && normPos.z=nearPlane+5.0*stepSize && normPos.z=nearPlane+6.0*stepSize && normPos.z=nearPlane+7.0*stepSize && normPos.z{var r=n(98519),i="oitDeclaration";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#ifdef ORDER_INDEPENDENT_TRANSPARENCY\n#extension GL_EXT_draw_buffers : require\nlayout(location=0) out vec2 depth; \nlayout(location=1) out vec4 frontColor;layout(location=2) out vec4 backColor;\n#define MAX_DEPTH 99999.0\nhighp vec4 gl_FragColor;uniform sampler2D oitDepthSampler;uniform sampler2D oitFrontColorSampler;\n#endif\n")},81867:(e,t,n)=>{n.r(t),n.d(t,{_KTXTextureLoader:()=>s});var r=n(88188),i=n(47347),o=n(7164),a=n(81152),s=function(){function e(){this.supportCascades=!1}return e.prototype.loadCubeData=function(e,t,n,i){if(!Array.isArray(e)){t._invertVScale=!t.invertY;var o=t.getEngine(),a=new r.H(e,6),s=a.numberOfMipmapLevels>1&&t.generateMipMaps;o._unpackFlipY(!0),a.uploadLevels(t,t.generateMipMaps),t.width=a.pixelWidth,t.height=a.pixelHeight,o._setCubeMapTextureParams(t,s,a.numberOfMipmapLevels-1),t.isReady=!0,t.onLoadedObservable.notifyObservers(t),t.onLoadedObservable.clear(),i&&i()}},e.prototype.loadData=function(e,t,n,s){if(r.H.IsValid(e)){t._invertVScale=!t.invertY;var l=new r.H(e,1),c=function(e){switch(e){case a.Y.TEXTUREFORMAT_COMPRESSED_SRGB_S3TC_DXT1_EXT:return a.Y.TEXTUREFORMAT_COMPRESSED_RGB_S3TC_DXT1;case a.Y.TEXTUREFORMAT_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:return a.Y.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT3;case a.Y.TEXTUREFORMAT_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:return a.Y.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT5;case a.Y.TEXTUREFORMAT_COMPRESSED_SRGB8_ETC2:return a.Y.TEXTUREFORMAT_COMPRESSED_RGB8_ETC2;case a.Y.TEXTUREFORMAT_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:return a.Y.TEXTUREFORMAT_COMPRESSED_RGBA8_ETC2_EAC;case a.Y.TEXTUREFORMAT_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:return a.Y.TEXTUREFORMAT_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2;case a.Y.TEXTUREFORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:return a.Y.TEXTUREFORMAT_COMPRESSED_RGBA_ASTC_4x4;case a.Y.TEXTUREFORMAT_COMPRESSED_SRGB_ALPHA_BPTC_UNORM:return a.Y.TEXTUREFORMAT_COMPRESSED_RGBA_BPTC_UNORM}return null}(l.glInternalFormat);c?(t.format=c,t._useSRGBBuffer=t.getEngine()._getUseSRGBBuffer(!0,t.generateMipMaps),t._gammaSpace=!0):t.format=l.glInternalFormat,n(l.pixelWidth,l.pixelHeight,t.generateMipMaps,!0,(function(){l.uploadLevels(t,t.generateMipMaps)}),l.isInvalid)}else i.Z.IsValid(e)?new i.Z(t.getEngine())._uploadAsync(e,t,s).then((function(){n(t.width,t.height,t.generateMipMaps,!0,(function(){}),!1)}),(function(e){o.V.Warn("Failed to load KTX2 texture data: ".concat(e.message)),n(0,0,!1,!1,(function(){}),!0)})):(o.V.Error("texture missing KTX identifier"),n(0,0,!1,!1,(function(){}),!0))},e}()},81914:(e,t,n)=>{n.d(t,{p:()=>d});var r=n(78322),i=n(6174),o=n(66377),a=n(64726),s=n(76331),l=n(87074),c=n(12028),u=n(27181),h=n(34623),d=function(){function e(){this.colorCurves=new s.Q,this._colorCurvesEnabled=!1,this._colorGradingEnabled=!1,this._colorGradingWithGreenDepth=!0,this._colorGradingBGR=!0,this._exposure=1,this._toneMappingEnabled=!1,this._toneMappingType=e.TONEMAPPING_STANDARD,this._contrast=1,this.vignetteStretch=0,this.vignetteCenterX=0,this.vignetteCenterY=0,this.vignetteWeight=1.5,this.vignetteColor=new a.ov(0,0,0,0),this.vignetteCameraFov=.5,this._vignetteBlendMode=e.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 o.cP}return Object.defineProperty(e.prototype,"colorCurvesEnabled",{get:function(){return this._colorCurvesEnabled},set:function(e){this._colorCurvesEnabled!==e&&(this._colorCurvesEnabled=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"colorGradingTexture",{get:function(){return this._colorGradingTexture},set:function(e){this._colorGradingTexture!==e&&(this._colorGradingTexture=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"colorGradingEnabled",{get:function(){return this._colorGradingEnabled},set:function(e){this._colorGradingEnabled!==e&&(this._colorGradingEnabled=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"colorGradingWithGreenDepth",{get:function(){return this._colorGradingWithGreenDepth},set:function(e){this._colorGradingWithGreenDepth!==e&&(this._colorGradingWithGreenDepth=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"colorGradingBGR",{get:function(){return this._colorGradingBGR},set:function(e){this._colorGradingBGR!==e&&(this._colorGradingBGR=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"exposure",{get:function(){return this._exposure},set:function(e){this._exposure!==e&&(this._exposure=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"toneMappingEnabled",{get:function(){return this._toneMappingEnabled},set:function(e){this._toneMappingEnabled!==e&&(this._toneMappingEnabled=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"toneMappingType",{get:function(){return this._toneMappingType},set:function(e){this._toneMappingType!==e&&(this._toneMappingType=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"contrast",{get:function(){return this._contrast},set:function(e){this._contrast!==e&&(this._contrast=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vignetteCentreY",{get:function(){return this.vignetteCenterY},set:function(e){this.vignetteCenterY=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vignetteCentreX",{get:function(){return this.vignetteCenterX},set:function(e){this.vignetteCenterX=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vignetteBlendMode",{get:function(){return this._vignetteBlendMode},set:function(e){this._vignetteBlendMode!==e&&(this._vignetteBlendMode=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vignetteEnabled",{get:function(){return this._vignetteEnabled},set:function(e){this._vignetteEnabled!==e&&(this._vignetteEnabled=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ditheringEnabled",{get:function(){return this._ditheringEnabled},set:function(e){this._ditheringEnabled!==e&&(this._ditheringEnabled=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ditheringIntensity",{get:function(){return this._ditheringIntensity},set:function(e){this._ditheringIntensity!==e&&(this._ditheringIntensity=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"skipFinalColorClamp",{get:function(){return this._skipFinalColorClamp},set:function(e){this._skipFinalColorClamp!==e&&(this._skipFinalColorClamp=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"applyByPostProcess",{get:function(){return this._applyByPostProcess},set:function(e){this._applyByPostProcess!==e&&(this._applyByPostProcess=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isEnabled",{get:function(){return this._isEnabled},set:function(e){this._isEnabled!==e&&(this._isEnabled=e,this._updateParameters())},enumerable:!1,configurable:!0}),e.prototype._updateParameters=function(){this.onUpdateParameters.notifyObservers(this)},e.prototype.getClassName=function(){return"ImageProcessingConfiguration"},e.prototype.prepareDefines=function(t,n){if(void 0===n&&(n=!1),n!==this.applyByPostProcess||!this._isEnabled)return t.VIGNETTE=!1,t.TONEMAPPING=0,t.CONTRAST=!1,t.EXPOSURE=!1,t.COLORCURVES=!1,t.COLORGRADING=!1,t.COLORGRADING3D=!1,t.DITHER=!1,t.IMAGEPROCESSING=!1,t.SKIPFINALCOLORCLAMP=this.skipFinalColorClamp,void(t.IMAGEPROCESSINGPOSTPROCESS=this.applyByPostProcess&&this._isEnabled);if(t.VIGNETTE=this.vignetteEnabled,t.VIGNETTEBLENDMODEMULTIPLY=this.vignetteBlendMode===e._VIGNETTEMODE_MULTIPLY,t.VIGNETTEBLENDMODEOPAQUE=!t.VIGNETTEBLENDMODEMULTIPLY,this._toneMappingEnabled)switch(this._toneMappingType){case e.TONEMAPPING_KHR_PBR_NEUTRAL:t.TONEMAPPING=3;break;case e.TONEMAPPING_ACES:t.TONEMAPPING=2;break;default:t.TONEMAPPING=1}else t.TONEMAPPING=0;t.CONTRAST=1!==this.contrast,t.EXPOSURE=1!==this.exposure,t.COLORCURVES=this.colorCurvesEnabled&&!!this.colorCurves,t.COLORGRADING=this.colorGradingEnabled&&!!this.colorGradingTexture,t.COLORGRADING?t.COLORGRADING3D=this.colorGradingTexture.is3D:t.COLORGRADING3D=!1,t.SAMPLER3DGREENDEPTH=this.colorGradingWithGreenDepth,t.SAMPLER3DBGRMAP=this.colorGradingBGR,t.DITHER=this._ditheringEnabled,t.IMAGEPROCESSINGPOSTPROCESS=this.applyByPostProcess,t.SKIPFINALCOLORCLAMP=this.skipFinalColorClamp,t.IMAGEPROCESSING=t.VIGNETTE||!!t.TONEMAPPING||t.CONTRAST||t.EXPOSURE||t.COLORCURVES||t.COLORGRADING||t.DITHER},e.prototype.isReady=function(){return!this.colorGradingEnabled||!this.colorGradingTexture||this.colorGradingTexture.isReady()},e.prototype.bind=function(e,t){if(this._colorCurvesEnabled&&this.colorCurves&&s.Q.Bind(this.colorCurves,e),this._vignetteEnabled||this._ditheringEnabled){var n=1/(this.outputTextureWidth||e.getEngine().getRenderWidth()),r=1/(this.outputTextureHeight||e.getEngine().getRenderHeight());if(e.setFloat2("vInverseScreenSize",n,r),this._ditheringEnabled&&e.setFloat("ditherIntensity",.5*this._ditheringIntensity),this._vignetteEnabled){var i=null!=t?t:r/n,o=Math.tan(.5*this.vignetteCameraFov),a=o*i,c=Math.sqrt(a*o);a=(0,l.zF)(a,c,this.vignetteStretch),o=(0,l.zF)(o,c,this.vignetteStretch),e.setFloat4("vignetteSettings1",a,o,-a*this.vignetteCenterX,-o*this.vignetteCenterY);var u=-2*this.vignetteWeight;e.setFloat4("vignetteSettings2",this.vignetteColor.r,this.vignetteColor.g,this.vignetteColor.b,u)}}if(e.setFloat("exposureLinear",this.exposure),e.setFloat("contrast",this.contrast),this.colorGradingTexture){e.setTexture("txColorTransform",this.colorGradingTexture);var h=this.colorGradingTexture.getSize().height;e.setFloat4("colorTransformSettings",(h-1)/h,.5/h,h,this.colorGradingTexture.level)}},e.prototype.clone=function(){return c.p.Clone((function(){return new e}),this)},e.prototype.serialize=function(){return c.p.Serialize(this)},e.Parse=function(t){var n=c.p.Parse((function(){return new e}),t,null,null);return void 0!==t.vignetteCentreX&&(n.vignetteCenterX=t.vignetteCentreX),void 0!==t.vignetteCentreY&&(n.vignetteCenterY=t.vignetteCentreY),n},Object.defineProperty(e,"VIGNETTEMODE_MULTIPLY",{get:function(){return this._VIGNETTEMODE_MULTIPLY},enumerable:!1,configurable:!0}),Object.defineProperty(e,"VIGNETTEMODE_OPAQUE",{get:function(){return this._VIGNETTEMODE_OPAQUE},enumerable:!1,configurable:!0}),e.TONEMAPPING_STANDARD=0,e.TONEMAPPING_ACES=1,e.TONEMAPPING_KHR_PBR_NEUTRAL=2,e.PrepareUniforms=u._,e.PrepareSamplers=u.C,e._VIGNETTEMODE_MULTIPLY=0,e._VIGNETTEMODE_OPAQUE=1,(0,r.Cg)([(0,i.wL)()],e.prototype,"colorCurves",void 0),(0,r.Cg)([(0,i.lK)()],e.prototype,"_colorCurvesEnabled",void 0),(0,r.Cg)([(0,i.uM)("colorGradingTexture")],e.prototype,"_colorGradingTexture",void 0),(0,r.Cg)([(0,i.lK)()],e.prototype,"_colorGradingEnabled",void 0),(0,r.Cg)([(0,i.lK)()],e.prototype,"_colorGradingWithGreenDepth",void 0),(0,r.Cg)([(0,i.lK)()],e.prototype,"_colorGradingBGR",void 0),(0,r.Cg)([(0,i.lK)()],e.prototype,"_exposure",void 0),(0,r.Cg)([(0,i.lK)()],e.prototype,"_toneMappingEnabled",void 0),(0,r.Cg)([(0,i.lK)()],e.prototype,"_toneMappingType",void 0),(0,r.Cg)([(0,i.lK)()],e.prototype,"_contrast",void 0),(0,r.Cg)([(0,i.lK)()],e.prototype,"vignetteStretch",void 0),(0,r.Cg)([(0,i.lK)()],e.prototype,"vignetteCenterX",void 0),(0,r.Cg)([(0,i.lK)()],e.prototype,"vignetteCenterY",void 0),(0,r.Cg)([(0,i.lK)()],e.prototype,"vignetteWeight",void 0),(0,r.Cg)([(0,i.qK)()],e.prototype,"vignetteColor",void 0),(0,r.Cg)([(0,i.lK)()],e.prototype,"vignetteCameraFov",void 0),(0,r.Cg)([(0,i.lK)()],e.prototype,"_vignetteBlendMode",void 0),(0,r.Cg)([(0,i.lK)()],e.prototype,"_vignetteEnabled",void 0),(0,r.Cg)([(0,i.lK)()],e.prototype,"_ditheringEnabled",void 0),(0,r.Cg)([(0,i.lK)()],e.prototype,"_ditheringIntensity",void 0),(0,r.Cg)([(0,i.lK)()],e.prototype,"_skipFinalColorClamp",void 0),(0,r.Cg)([(0,i.lK)()],e.prototype,"_applyByPostProcess",void 0),(0,r.Cg)([(0,i.lK)()],e.prototype,"_isEnabled",void 0),(0,r.Cg)([(0,i.lK)()],e.prototype,"outputTextureWidth",void 0),(0,r.Cg)([(0,i.lK)()],e.prototype,"outputTextureHeight",void 0),e}();c.p._ImageProcessingConfigurationParser=d.Parse,(0,h.Y5)("BABYLON.ImageProcessingConfiguration",d)},82145:(e,t,n)=>{n.d(t,{i:()=>a});var r=n(78322),i=n(15579),o=n(75647),a=function(e){function t(t){var n=e.call(this)||this;return n._pan=i.uJ.pan,n._subGraph=t,n}return(0,r.C6)(t,e),Object.defineProperty(t.prototype,"pan",{get:function(){return this._pan},set:function(e){this._pan=e,(0,o.n9)(this._subGraph,"pan",e)},enumerable:!1,configurable:!0}),t}(i.bO)},82155:(e,t,n)=>{n.r(t),n.d(t,{FlowGraphAbsBlock:()=>P,FlowGraphAcosBlock:()=>ie,FlowGraphAcoshBlock:()=>he,FlowGraphAddBlock:()=>m,FlowGraphAsinBlock:()=>re,FlowGraphAsinhBlock:()=>ue,FlowGraphAtan2Block:()=>ae,FlowGraphAtanBlock:()=>oe,FlowGraphAtanhBlock:()=>de,FlowGraphBitwiseAndBlock:()=>Se,FlowGraphBitwiseLeftShiftBlock:()=>xe,FlowGraphBitwiseNotBlock:()=>be,FlowGraphBitwiseOrBlock:()=>Te,FlowGraphBitwiseRightShiftBlock:()=>Pe,FlowGraphBitwiseXorBlock:()=>Ee,FlowGraphCeilBlock:()=>I,FlowGraphClampBlock:()=>U,FlowGraphCosBlock:()=>te,FlowGraphCoshBlock:()=>le,FlowGraphCubeRootBlock:()=>ve,FlowGraphDegToRadBlock:()=>J,FlowGraphDivideBlock:()=>v,FlowGraphEBlock:()=>b,FlowGraphEqualityBlock:()=>H,FlowGraphExpBlock:()=>pe,FlowGraphFloorBlock:()=>A,FlowGraphFractionBlock:()=>M,FlowGraphGreaterThanBlock:()=>q,FlowGraphGreaterThanOrEqualBlock:()=>K,FlowGraphInfBlock:()=>T,FlowGraphIsInfinityBlock:()=>Q,FlowGraphIsNanBlock:()=>Z,FlowGraphLeadingZerosBlock:()=>Ce,FlowGraphLessThanBlock:()=>X,FlowGraphLessThanOrEqualBlock:()=>j,FlowGraphLog10Block:()=>_e,FlowGraphLog2Block:()=>me,FlowGraphLogBlock:()=>fe,FlowGraphMathInterpolationBlock:()=>W,FlowGraphMaxBlock:()=>w,FlowGraphMinBlock:()=>L,FlowGraphModuloBlock:()=>F,FlowGraphMultiplyBlock:()=>g,FlowGraphNaNBlock:()=>E,FlowGraphNegationBlock:()=>D,FlowGraphOneBitsCounterBlock:()=>Ae,FlowGraphPiBlock:()=>S,FlowGraphPowerBlock:()=>ye,FlowGraphRadToDegBlock:()=>$,FlowGraphRandomBlock:()=>y,FlowGraphRoundBlock:()=>O,FlowGraphSaturateBlock:()=>k,FlowGraphSignBlock:()=>C,FlowGraphSinBlock:()=>ee,FlowGraphSinhBlock:()=>se,FlowGraphSquareRootBlock:()=>ge,FlowGraphSubtractBlock:()=>_,FlowGraphTanBlock:()=>ne,FlowGraphTanhBlock:()=>ce,FlowGraphTrailingZerosBlock:()=>Re,FlowGraphTruncBlock:()=>R});var r=n(78322),i=n(34623),o=n(88099),a=n(20201),s=n(61930),l=function(e){function t(t,n,r,i){var o=e.call(this,t,i)||this;return o._operation=n,o._className=r,o}return(0,r.C6)(t,e),t.prototype._doOperation=function(e){return this._operation(e)},t.prototype.getClassName=function(){return this._className},t}(s.r),c=n(8046),u=n(23101),h=function(e){function t(t,n,r,i,o,a,s){var l=e.call(this,i,s)||this;return l._operation=o,l._className=a,l.a=l.registerDataInput("a",t),l.b=l.registerDataInput("b",n),l.c=l.registerDataInput("c",r),l}return(0,r.C6)(t,e),t.prototype._doOperation=function(e){return this._operation(this.a.getValue(e),this.b.getValue(e),this.c.getValue(e))},t.prototype.getClassName=function(){return this._className},t}(s.r),d=n(40099),p=n(96832),f=n(95803),m=function(e){function t(t){var n=e.call(this,(0,o.Yd)(null==t?void 0:t.type),(0,o.Yd)(null==t?void 0:t.type),(0,o.Yd)(null==t?void 0:t.type),(function(e,t){return n._polymorphicAdd(e,t)}),"FlowGraphAddBlock",t)||this;return n}return(0,r.C6)(t,e),t.prototype._polymorphicAdd=function(e,t){var n,r=(0,f.I$)(e),i=(0,f.I$)(t);if((0,f.a2)(r,i)||(0,f.VW)(r,i)||(0,f.An)(r,i))return e.add(t);if("Quaternion"===r||"Vector4"===i)return new c.IU(e.x,e.y,e.z,e.w).addInPlace(t);if("Vector4"===r||"Quaternion"===i)return e.add(t);if((null===(n=this.config)||void 0===n?void 0:n.preventIntegerFloatArithmetic)&&typeof e!=typeof t)throw new Error("Cannot add different types of numbers.");return(0,f.$w)(e)+(0,f.$w)(t)},t}(a.W);(0,i.Y5)("FlowGraphAddBlock",m);var _=function(e){function t(t){var n=e.call(this,(0,o.Yd)(null==t?void 0:t.type),(0,o.Yd)(null==t?void 0:t.type),(0,o.Yd)(null==t?void 0:t.type),(function(e,t){return n._polymorphicSubtract(e,t)}),"FlowGraphSubtractBlock",t)||this;return n}return(0,r.C6)(t,e),t.prototype._polymorphicSubtract=function(e,t){var n,r=(0,f.I$)(e),i=(0,f.I$)(t);if((0,f.a2)(r,i)||(0,f.An)(r,i)||(0,f.VW)(r,i))return e.subtract(t);if("Quaternion"===r||"Vector4"===i)return new c.IU(e.x,e.y,e.z,e.w).subtractInPlace(t);if("Vector4"===r||"Quaternion"===i)return e.subtract(t);if((null===(n=this.config)||void 0===n?void 0:n.preventIntegerFloatArithmetic)&&typeof e!=typeof t)throw new Error("Cannot add different types of numbers.");return(0,f.$w)(e)-(0,f.$w)(t)},t}(a.W);(0,i.Y5)("FlowGraphSubtractBlock",_);var g=function(e){function t(t){var n=e.call(this,(0,o.Yd)(null==t?void 0:t.type),(0,o.Yd)(null==t?void 0:t.type),(0,o.Yd)(null==t?void 0:t.type),(function(e,t){return n._polymorphicMultiply(e,t)}),"FlowGraphMultiplyBlock",t)||this;return n}return(0,r.C6)(t,e),t.prototype._polymorphicMultiply=function(e,t){var n,r,i=(0,f.I$)(e),o=(0,f.I$)(t);if((0,f.a2)(i,o)||(0,f.An)(i,o))return e.multiply(t);if("Quaternion"===i||"Vector4"===o)return new c.IU(e.x,e.y,e.z,e.w).multiplyInPlace(t);if("Vector4"===i||"Quaternion"===o)return e.multiply(t);if((0,f.VW)(i,o)){if(null===(n=this.config)||void 0===n?void 0:n.useMatrixPerComponent){for(var a=e.m,s=0;st}))},t}(a.W);(0,i.Y5)("FlowGraphGreaterThanBlock",q);var K=function(e){function t(t){var n=e.call(this,o.Vv,o.Vv,o.RI,(function(e,t){return n._polymorphicGreaterThanOrEqual(e,t)}),"FlowGraphGreaterThanOrEqualBlock",t)||this;return n}return(0,r.C6)(t,e),t.prototype._polymorphicGreaterThanOrEqual=function(e,t){return Y(e,t,(function(e,t){return e>=t}))},t}(a.W);(0,i.Y5)("FlowGraphGreaterThanOrEqualBlock",K);var Z=function(e){function t(t){var n=e.call(this,o.Vv,o.RI,(function(e){return n._polymorphicIsNan(e)}),"FlowGraphIsNaNBlock",t)||this;return n}return(0,r.C6)(t,e),t.prototype._polymorphicIsNan=function(e){if((0,f.kf)(e,!0))return isNaN((0,f.$w)(e));throw new Error("Cannot get NaN of ".concat(e))},t}(u.a);(0,i.Y5)("FlowGraphIsNaNBlock",Z);var Q=function(e){function t(t){var n=e.call(this,o.Vv,o.RI,(function(e){return n._polymorphicIsInf(e)}),"FlowGraphIsInfBlock",t)||this;return n}return(0,r.C6)(t,e),t.prototype._polymorphicIsInf=function(e){if((0,f.kf)(e))return!isFinite((0,f.$w)(e));throw new Error("Cannot get isInf of ".concat(e))},t}(u.a);(0,i.Y5)("FlowGraphIsInfBlock",Q);var J=function(e){function t(t){var n=e.call(this,o.Vv,o.Vv,(function(e){return n._polymorphicDegToRad(e)}),"FlowGraphDegToRadBlock",t)||this;return n}return(0,r.C6)(t,e),t.prototype._degToRad=function(e){return e*Math.PI/180},t.prototype._polymorphicDegToRad=function(e){return x(e,this._degToRad)},t}(u.a);(0,i.Y5)("FlowGraphDegToRadBlock",J);var $=function(e){function t(t){var n=e.call(this,o.Vv,o.Vv,(function(e){return n._polymorphicRadToDeg(e)}),"FlowGraphRadToDegBlock",t)||this;return n}return(0,r.C6)(t,e),t.prototype._radToDeg=function(e){return 180*e/Math.PI},t.prototype._polymorphicRadToDeg=function(e){return x(e,this._radToDeg)},t}(u.a);(0,i.Y5)("FlowGraphRadToDegBlock",$);var ee=function(e){function t(t){var n=e.call(this,o.Es,o.Es,(function(e){return n._polymorphicSin(e)}),"FlowGraphSinBlock",t)||this;return n}return(0,r.C6)(t,e),t.prototype._polymorphicSin=function(e){return x(e,Math.sin)},t}(u.a),te=function(e){function t(t){var n=e.call(this,o.Es,o.Es,(function(e){return n._polymorphicCos(e)}),"FlowGraphCosBlock",t)||this;return n}return(0,r.C6)(t,e),t.prototype._polymorphicCos=function(e){return x(e,Math.cos)},t}(u.a),ne=function(e){function t(t){var n=e.call(this,o.Es,o.Es,(function(e){return n._polymorphicTan(e)}),"FlowGraphTanBlock",t)||this;return n}return(0,r.C6)(t,e),t.prototype._polymorphicTan=function(e){return x(e,Math.tan)},t}(u.a),re=function(e){function t(t){var n=e.call(this,o.Es,o.Es,(function(e){return n._polymorphicAsin(e)}),"FlowGraphASinBlock",t)||this;return n}return(0,r.C6)(t,e),t.prototype._polymorphicAsin=function(e){return x(e,Math.asin)},t}(u.a);(0,i.Y5)("FlowGraphASinBlock",re);var ie=function(e){function t(t){var n=e.call(this,o.Es,o.Es,(function(e){return n._polymorphicAcos(e)}),"FlowGraphACosBlock",t)||this;return n}return(0,r.C6)(t,e),t.prototype._polymorphicAcos=function(e){return x(e,Math.acos)},t}(u.a);(0,i.Y5)("FlowGraphACosBlock",ie);var oe=function(e){function t(t){var n=e.call(this,o.Es,o.Es,(function(e){return n._polymorphicAtan(e)}),"FlowGraphATanBlock",t)||this;return n}return(0,r.C6)(t,e),t.prototype._polymorphicAtan=function(e){return x(e,Math.atan)},t}(u.a);(0,i.Y5)("FlowGraphATanBlock",oe);var ae=function(e){function t(t){var n=e.call(this,o.Vv,o.Vv,o.Vv,(function(e,t){return n._polymorphicAtan2(e,t)}),"FlowGraphATan2Block",t)||this;return n}return(0,r.C6)(t,e),t.prototype._polymorphicAtan2=function(e,t){return N(e,t,Math.atan2)},t}(a.W);(0,i.Y5)("FlowGraphATan2Block",ae);var se=function(e){function t(t){var n=e.call(this,o.Vv,o.Vv,(function(e){return n._polymorphicSinh(e)}),"FlowGraphSinhBlock",t)||this;return n}return(0,r.C6)(t,e),t.prototype._polymorphicSinh=function(e){return x(e,Math.sinh)},t}(u.a);(0,i.Y5)("FlowGraphSinhBlock",se);var le=function(e){function t(t){var n=e.call(this,o.Vv,o.Vv,(function(e){return n._polymorphicCosh(e)}),"FlowGraphCoshBlock",t)||this;return n}return(0,r.C6)(t,e),t.prototype._polymorphicCosh=function(e){return x(e,Math.cosh)},t}(u.a);(0,i.Y5)("FlowGraphCoshBlock",le);var ce=function(e){function t(t){var n=e.call(this,o.Vv,o.Vv,(function(e){return n._polymorphicTanh(e)}),"FlowGraphTanhBlock",t)||this;return n}return(0,r.C6)(t,e),t.prototype._polymorphicTanh=function(e){return x(e,Math.tanh)},t}(u.a);(0,i.Y5)("FlowGraphTanhBlock",ce);var ue=function(e){function t(t){var n=e.call(this,o.Vv,o.Es,(function(e){return n._polymorphicAsinh(e)}),"FlowGraphASinhBlock",t)||this;return n}return(0,r.C6)(t,e),t.prototype._polymorphicAsinh=function(e){return x(e,Math.asinh)},t}(u.a);(0,i.Y5)("FlowGraphASinhBlock",ue);var he=function(e){function t(t){var n=e.call(this,o.Vv,o.Es,(function(e){return n._polymorphicAcosh(e)}),"FlowGraphACoshBlock",t)||this;return n}return(0,r.C6)(t,e),t.prototype._polymorphicAcosh=function(e){return x(e,Math.acosh)},t}(u.a);(0,i.Y5)("FlowGraphACoshBlock",he);var de=function(e){function t(t){var n=e.call(this,o.Vv,o.Es,(function(e){return n._polymorphicAtanh(e)}),"FlowGraphATanhBlock",t)||this;return n}return(0,r.C6)(t,e),t.prototype._polymorphicAtanh=function(e){return x(e,Math.atanh)},t}(u.a);(0,i.Y5)("FlowGraphATanhBlock",de);var pe=function(e){function t(t){var n=e.call(this,o.Vv,o.Es,(function(e){return n._polymorphicExp(e)}),"FlowGraphExponentialBlock",t)||this;return n}return(0,r.C6)(t,e),t.prototype._polymorphicExp=function(e){return x(e,Math.exp)},t}(u.a);(0,i.Y5)("FlowGraphExponentialBlock",pe);var fe=function(e){function t(t){var n=e.call(this,o.Vv,o.Es,(function(e){return n._polymorphicLog(e)}),"FlowGraphLogBlock",t)||this;return n}return(0,r.C6)(t,e),t.prototype._polymorphicLog=function(e){return x(e,Math.log)},t}(u.a);(0,i.Y5)("FlowGraphLogBlock",fe);var me=function(e){function t(t){var n=e.call(this,o.Vv,o.Es,(function(e){return n._polymorphicLog2(e)}),"FlowGraphLog2Block",t)||this;return n}return(0,r.C6)(t,e),t.prototype._polymorphicLog2=function(e){return x(e,Math.log2)},t}(u.a);(0,i.Y5)("FlowGraphLog2Block",me);var _e=function(e){function t(t){var n=e.call(this,o.Vv,o.Es,(function(e){return n._polymorphicLog10(e)}),"FlowGraphLog10Block",t)||this;return n}return(0,r.C6)(t,e),t.prototype._polymorphicLog10=function(e){return x(e,Math.log10)},t}(u.a);(0,i.Y5)("FlowGraphLog10Block",_e);var ge=function(e){function t(t){var n=e.call(this,o.Vv,o.Es,(function(e){return n._polymorphicSqrt(e)}),"FlowGraphSquareRootBlock",t)||this;return n}return(0,r.C6)(t,e),t.prototype._polymorphicSqrt=function(e){return x(e,Math.sqrt)},t}(u.a);(0,i.Y5)("FlowGraphSquareRootBlock",ge);var ve=function(e){function t(t){var n=e.call(this,o.Vv,o.Es,(function(e){return n._polymorphicCubeRoot(e)}),"FlowGraphCubeRootBlock",t)||this;return n}return(0,r.C6)(t,e),t.prototype._polymorphicCubeRoot=function(e){return x(e,Math.cbrt)},t}(u.a);(0,i.Y5)("FlowGraphCubeRootBlock",ve);var ye=function(e){function t(t){var n=e.call(this,o.Vv,o.Es,o.Es,(function(e,t){return n._polymorphicPow(e,t)}),"FlowGraphPowerBlock",t)||this;return n}return(0,r.C6)(t,e),t.prototype._polymorphicPow=function(e,t){return N(e,t,Math.pow)},t}(a.W);(0,i.Y5)("FlowGraphPowerBlock",ye);var be=function(e){function t(t){return e.call(this,(0,o.Yd)((null==t?void 0:t.valueType)||"FlowGraphInteger"),(0,o.Yd)((null==t?void 0:t.valueType)||"FlowGraphInteger"),(function(e){return"boolean"==typeof e?!e:"number"==typeof e?~e:new d.P(~e.value)}),"FlowGraphBitwiseNotBlock",t)||this}return(0,r.C6)(t,e),t}(u.a);(0,i.Y5)("FlowGraphBitwiseNotBlock",be);var Se=function(e){function t(t){return e.call(this,(0,o.Yd)((null==t?void 0:t.valueType)||"FlowGraphInteger"),(0,o.Yd)((null==t?void 0:t.valueType)||"FlowGraphInteger"),(0,o.Yd)((null==t?void 0:t.valueType)||"FlowGraphInteger"),(function(e,t){if("boolean"==typeof e&&"boolean"==typeof t)return e&&t;if("number"==typeof e&&"number"==typeof t)return e&t;if("object"==typeof e&&"object"==typeof t)return new d.P(e.value&t.value);throw new Error("Cannot perform bitwise AND on ".concat(e," and ").concat(t))}),"FlowGraphBitwiseAndBlock",t)||this}return(0,r.C6)(t,e),t}(a.W);(0,i.Y5)("FlowGraphBitwiseAndBlock",Se);var Te=function(e){function t(t){return e.call(this,(0,o.Yd)((null==t?void 0:t.valueType)||"FlowGraphInteger"),(0,o.Yd)((null==t?void 0:t.valueType)||"FlowGraphInteger"),(0,o.Yd)((null==t?void 0:t.valueType)||"FlowGraphInteger"),(function(e,t){if("boolean"==typeof e&&"boolean"==typeof t)return e||t;if("number"==typeof e&&"number"==typeof t)return e|t;if("object"==typeof e&&"object"==typeof t)return new d.P(e.value|t.value);throw new Error("Cannot perform bitwise OR on ".concat(e," and ").concat(t))}),"FlowGraphBitwiseOrBlock",t)||this}return(0,r.C6)(t,e),t}(a.W);(0,i.Y5)("FlowGraphBitwiseOrBlock",Te);var Ee=function(e){function t(t){return e.call(this,(0,o.Yd)((null==t?void 0:t.valueType)||"FlowGraphInteger"),(0,o.Yd)((null==t?void 0:t.valueType)||"FlowGraphInteger"),(0,o.Yd)((null==t?void 0:t.valueType)||"FlowGraphInteger"),(function(e,t){if("boolean"==typeof e&&"boolean"==typeof t)return e!==t;if("number"==typeof e&&"number"==typeof t)return e^t;if("object"==typeof e&&"object"==typeof t)return new d.P(e.value^t.value);throw new Error("Cannot perform bitwise XOR on ".concat(e," and ").concat(t))}),"FlowGraphBitwiseXorBlock",t)||this}return(0,r.C6)(t,e),t}(a.W);(0,i.Y5)("FlowGraphBitwiseXorBlock",Ee);var xe=function(e){function t(t){return e.call(this,o.x2,o.x2,o.x2,(function(e,t){return new d.P(e.value<>t.value)}),"FlowGraphBitwiseRightShiftBlock",t)||this}return(0,r.C6)(t,e),t}(a.W);(0,i.Y5)("FlowGraphBitwiseRightShiftBlock",Pe);var Ce=function(e){function t(t){return e.call(this,o.x2,o.x2,(function(e){return new d.P(Math.clz32(e.value))}),"FlowGraphLeadingZerosBlock",t)||this}return(0,r.C6)(t,e),t}(u.a);(0,i.Y5)("FlowGraphLeadingZerosBlock",Ce);var Re=function(e){function t(t){return e.call(this,o.x2,o.x2,(function(e){return new d.P(e.value?31-Math.clz32(e.value&-e.value):32)}),"FlowGraphTrailingZerosBlock",t)||this}return(0,r.C6)(t,e),t}(u.a);(0,i.Y5)("FlowGraphTrailingZerosBlock",Re);var Ae=function(e){function t(t){return e.call(this,o.x2,o.x2,(function(e){return new d.P(function(e){for(var t=0;e;)t+=1&e,e>>=1;return t}(e.value))}),"FlowGraphOneBitsCounterBlock",t)||this}return(0,r.C6)(t,e),t}(u.a);(0,i.Y5)("FlowGraphOneBitsCounterBlock",Ae)},82345:(e,t,n)=>{n.d(t,{k:()=>i.kZ});var r=n(44256),i=n(24894);r.ThinEngine.prototype._readTexturePixelsSync=function(e,t,n,r,o,a,s,l,c,u){var h,d;void 0===r&&(r=-1),void 0===o&&(o=0),void 0===a&&(a=null),void 0===s&&(s=!0),void 0===l&&(l=!1),void 0===c&&(c=0),void 0===u&&(u=0);var p=this._gl;if(!p)throw new Error("Engine does not have gl rendering context.");if(!this._dummyFramebuffer){var f=p.createFramebuffer();if(!f)throw new Error("Unable to create dummy framebuffer");this._dummyFramebuffer=f}p.bindFramebuffer(p.FRAMEBUFFER,this._dummyFramebuffer),r>-1?p.framebufferTexture2D(p.FRAMEBUFFER,p.COLOR_ATTACHMENT0,p.TEXTURE_CUBE_MAP_POSITIVE_X+r,null===(h=e._hardwareTexture)||void 0===h?void 0:h.underlyingResource,o):p.framebufferTexture2D(p.FRAMEBUFFER,p.COLOR_ATTACHMENT0,p.TEXTURE_2D,null===(d=e._hardwareTexture)||void 0===d?void 0:d.underlyingResource,o);var m=void 0!==e.type?this._getWebGLTextureType(e.type):p.UNSIGNED_BYTE;return l?a||(a=(0,i.kZ)(e.type,4*t*n)):m===p.UNSIGNED_BYTE?(a||(a=new Uint8Array(4*t*n)),m=p.UNSIGNED_BYTE):(a||(a=new Float32Array(4*t*n)),m=p.FLOAT),s&&this.flushFramebuffer(),p.readPixels(c,u,t,n,p.RGBA,m,a),p.bindFramebuffer(p.FRAMEBUFFER,this._currentFramebuffer),a},r.ThinEngine.prototype._readTexturePixels=function(e,t,n,r,i,o,a,s,l,c){return void 0===r&&(r=-1),void 0===i&&(i=0),void 0===o&&(o=null),void 0===a&&(a=!0),void 0===s&&(s=!1),void 0===l&&(l=0),void 0===c&&(c=0),Promise.resolve(this._readTexturePixelsSync(e,t,n,r,i,o,a,s,l,c))}},82673:(e,t,n)=>{n.d(t,{$:()=>S,r:()=>b});var r=n(78322),i=n(66614),o=n(7164),a=n(74239),s=n(16106),l=n(85258),c=n(48424),u=n(75781),h=n(3911),d=n(69329),p=n(41190),f=n(19133),m=n(5153),_=n(81152),g=n(66377),v=n(24894),y=n(1235);function b(e,t){if((0,m.BA)()){var n=(t||window).requestAnimationFrame;if("function"==typeof n)return n(e)}else if("function"==typeof requestAnimationFrame)return requestAnimationFrame(e);return setTimeout(e,16)}var S=function(){function e(e,t,n){var r,o,a,p,f,v,y,b,S,T,E=this;this._colorWrite=!0,this._colorWriteChanged=!0,this._depthCullingState=new c.N,this._stencilStateComposer=new u.u,this._stencilState=new h.K,this._alphaState=new d.i(!1),this._alphaMode=Array(8).fill(-1),this._alphaEquation=Array(8).fill(-1),this._activeRequests=[],this._badOS=!1,this._badDesktopOS=!1,this._compatibilityMode=!0,this._internalTexturesCache=new Array,this._currentRenderTarget=null,this._boundTexturesCache={},this._activeChannel=0,this._currentTextureChannel=-1,this._viewportCached={x:0,y:0,z:0,w:0},this._isWebGPU=!1,this.onCanvasBlurObservable=new g.cP,this.onCanvasFocusObservable=new g.cP,this.onNewSceneAddedObservable=new g.cP,this.onResizeObservable=new g.cP,this.onCanvasPointerOutObservable=new g.cP,this.onEffectErrorObservable=new g.cP,this.disablePerformanceMonitorInBackground=!1,this.disableVertexArrayObjects=!1,this._frameId=0,this.hostInformation={isMobile:!1},this.isFullscreen=!1,this.enableOfflineSupport=!1,this.disableManifestCheck=!1,this.disableContextMenu=!0,this.currentRenderPassId=_.Y.RENDERPASS_MAIN,this.isPointerLock=!1,this.postProcesses=[],this.canvasTabIndex=1,this._contextWasLost=!1,this._useReverseDepthBuffer=!1,this.isNDCHalfZRange=!1,this.hasOriginBottomLeft=!0,this._renderTargetWrapperCache=new Array,this._compiledEffects={},this._isDisposed=!1,this.scenes=[],this._virtualScenes=new Array,this.onBeforeTextureInitObservable=new g.cP,this.renderEvenInBackground=!0,this.preventCacheWipeBetweenFrames=!1,this._frameHandler=0,this._activeRenderLoops=new Array,this._windowIsBackground=!1,this._boundRenderFunction=function(e){return E._renderLoop(e)},this._lastFrameTime=0,this._renderAccumulator=0,this.skipFrameRender=!1,this.onBeforeShaderCompilationObservable=new g.cP,this.onAfterShaderCompilationObservable=new g.cP,this.onBeginFrameObservable=new g.cP,this.onEndFrameObservable=new g.cP,this._transformTextureUrl=null,this._uniformBuffers=new Array,this._storageBuffers=new Array,this._highPrecisionShadersAllowed=!0,this.onContextLostObservable=new g.cP,this.onContextRestoredObservable=new g.cP,this._name="",this.premultipliedAlpha=!0,this.adaptToDeviceRatio=!1,this._lastDevicePixelRatio=1,this._doNotHandleContextLost=!1,this.cullBackFaces=null,this._renderPassNames=["main"],this._fps=60,this._deltaTime=0,this._deterministicLockstep=!1,this._lockstepMaxSteps=4,this._timeStep=1/60,this.onDisposeObservable=new g.cP,this.onReleaseEffectsObservable=new g.cP,i.q.Instances.push(this),this.startTime=l.j.Now,this._stencilStateComposer.stencilGlobal=this._stencilState,s.I.SetMatrixPrecision(!!t.useHighPrecisionMatrix),(0,m.XD)()&&navigator.userAgent&&(this._badOS=/iPad/i.test(navigator.userAgent)||/iPhone/i.test(navigator.userAgent),this._badDesktopOS=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)),this.adaptToDeviceRatio=null!=n&&n,t.antialias=null!=e?e:t.antialias,t.deterministicLockstep=null!==(r=t.deterministicLockstep)&&void 0!==r&&r,t.lockstepMaxSteps=null!==(o=t.lockstepMaxSteps)&&void 0!==o?o:4,t.timeStep=null!==(a=t.timeStep)&&void 0!==a?a:1/60,t.stencil=null===(p=t.stencil)||void 0===p||p,this._audioContext=null!==(v=null===(f=t.audioEngineOptions)||void 0===f?void 0:f.audioContext)&&void 0!==v?v:null,this._audioDestination=null!==(b=null===(y=t.audioEngineOptions)||void 0===y?void 0:y.audioDestination)&&void 0!==b?b:null,this.premultipliedAlpha=null===(S=t.premultipliedAlpha)||void 0===S||S,this._doNotHandleContextLost=!!t.doNotHandleContextLost,this._isStencilEnable=!!t.stencil,this.useExactSrgbConversions=null!==(T=t.useExactSrgbConversions)&&void 0!==T&&T;var x=(0,m.BA)()&&window.devicePixelRatio||1,P=t.limitDeviceRatio||x;n=n||t.adaptToDeviceRatio||!1,this._hardwareScalingLevel=n?1/Math.min(P,x):1,this._lastDevicePixelRatio=x,this._creationOptions=t}return Object.defineProperty(e.prototype,"frameId",{get:function(){return this._frameId},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isWebGPU",{get:function(){return this._isWebGPU},enumerable:!1,configurable:!0}),e.prototype._getShaderProcessor=function(e){return this._shaderProcessor},e.prototype._resetAlphaMode=function(){this._alphaMode.fill(-1),this._alphaEquation.fill(-1)},Object.defineProperty(e.prototype,"shaderPlatformName",{get:function(){return this._shaderPlatformName},enumerable:!1,configurable:!0}),e.prototype._clearEmptyResources=function(){this._emptyTexture=null,this._emptyCubeTexture=null,this._emptyTexture3D=null,this._emptyTexture2DArray=null},Object.defineProperty(e.prototype,"useReverseDepthBuffer",{get:function(){return this._useReverseDepthBuffer},set:function(e){e!==this._useReverseDepthBuffer&&(this._useReverseDepthBuffer=e,this._depthCullingState.depthFunc=e?_.Y.GEQUAL:_.Y.LEQUAL)},enumerable:!1,configurable:!0}),e.prototype.setColorWrite=function(e){e!==this._colorWrite&&(this._colorWriteChanged=!0,this._colorWrite=e)},e.prototype.getColorWrite=function(){return this._colorWrite},Object.defineProperty(e.prototype,"depthCullingState",{get:function(){return this._depthCullingState},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alphaState",{get:function(){return this._alphaState},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilState",{get:function(){return this._stencilState},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilStateComposer",{get:function(){return this._stencilStateComposer},enumerable:!1,configurable:!0}),e.prototype._getGlobalDefines=function(e){if(e)return this.isNDCHalfZRange?e.IS_NDC_HALF_ZRANGE="":delete e.IS_NDC_HALF_ZRANGE,this.useReverseDepthBuffer?e.USE_REVERSE_DEPTHBUFFER="":delete e.USE_REVERSE_DEPTHBUFFER,void(this.useExactSrgbConversions?e.USE_EXACT_SRGB_CONVERSIONS="":delete e.USE_EXACT_SRGB_CONVERSIONS);var t="";return this.isNDCHalfZRange&&(t+="#define IS_NDC_HALF_ZRANGE"),this.useReverseDepthBuffer&&(t&&(t+="\n"),t+="#define USE_REVERSE_DEPTHBUFFER"),this.useExactSrgbConversions&&(t&&(t+="\n"),t+="#define USE_EXACT_SRGB_CONVERSIONS"),t},e.prototype._rebuildInternalTextures=function(){for(var e=0,t=this._internalTexturesCache.slice();e=0&&(this._activeRenderLoops.splice(t,1),0==this._activeRenderLoops.length&&this._cancelFrame())},e.prototype._cancelFrame=function(){if(0!==this._frameHandler){var e=this._frameHandler;if(this._frameHandler=0,(0,m.BA)()){var t=(this.getHostWindow()||window).cancelAnimationFrame;if("function"==typeof t)return t(e)}else if("function"==typeof cancelAnimationFrame)return cancelAnimationFrame(e);return clearTimeout(e)}},e.prototype.beginFrame=function(){this.onBeginFrameObservable.notifyObservers(this)},e.prototype.endFrame=function(){this._frameId++,this.onEndFrameObservable.notifyObservers(this)},Object.defineProperty(e.prototype,"maxFPS",{get:function(){return this._maxFPS},set:function(e){this._maxFPS=e,void 0!==e&&(this._minFrameTime=e<=0?Number.MAX_VALUE:1e3/e)},enumerable:!1,configurable:!0}),e.prototype._isOverFrameTime=function(e){if(!e||void 0===this._maxFPS)return!1;var t=e-this._lastFrameTime;return this._lastFrameTime=e,this._renderAccumulator+=t,this._renderAccumulatorthis._minFrameTime&&(this._renderAccumulator=this._minFrameTime),!1)},e.prototype._processFrame=function(e){if(this._frameHandler=0,!this._contextWasLost&&!this._isOverFrameTime(e)){var t=!0;(this.isDisposed||!this.renderEvenInBackground&&this._windowIsBackground)&&(t=!1),t&&(this.beginFrame(),this.skipFrameRender||this._renderViews()||this._renderFrame(),this.endFrame())}},e.prototype._renderLoop=function(e){this._processFrame(e),this._activeRenderLoops.length>0&&0===this._frameHandler&&(this._frameHandler=this._queueNewFrame(this._boundRenderFunction,this.getHostWindow()))},e.prototype._renderFrame=function(){for(var e=0;e-1?t.substring(I).toLowerCase():"");O.indexOf("?")>-1&&(O=O.split("?")[0]);var M=(0,y.gT)(O,b);s&&s.addPendingData(R),R.url=t,R.generateMipMaps=!n,R.samplingMode=l,R.invertY=a,R._useSRGBBuffer=this._getUseSRGBBuffer(!!T,n),this._doNotHandleContextLost||(R._buffer=p);var D=null;c&&!m&&(D=R.onLoadedObservable.add(c)),m||this._internalTexturesCache.push(R);var N=function(e,r){s&&s.removePendingData(R),t===A?(D&&R.onLoadedObservable.remove(D),i.q.UseFallbackTexture&&t!==i.q.FallbackTexture&&E._createTextureBase(i.q.FallbackTexture,n,R.invertY,s,l,null,u,h,d,p,R),e=(e||"Unknown error")+(i.q.UseFallbackTexture?" - Fallback texture was used":""),R.onErrorObservable.notifyObservers({message:e,exception:r}),u&&u(e,r)):(o.V.Warn("Failed to load ".concat(t,", falling back to ").concat(A)),E._createTextureBase(A,n,R.invertY,s,l,c,u,h,d,p,R,g,v,b,S,T))};if(M){var F=function(e){return(0,r.sH)(E,void 0,void 0,(function(){return(0,r.YH)(this,(function(t){switch(t.label){case 0:return[4,M];case 1:return t.sent().loadData(e,R,(function(e,t,n,r,i,o){o?N("TextureLoader failed to load data"):h(R,O,s,{width:e,height:t},R.invertY,!n,r,(function(){return i(),!1}),l)}),S),[2]}}))}))};p?p instanceof ArrayBuffer?F(new Uint8Array(p)):ArrayBuffer.isView(p)?F(p):u&&u("Unable to load: only ArrayBuffer or ArrayBufferView is supported",null):this._loadFile(t,(function(e){F(new Uint8Array(e))}),void 0,s?s.offlineProvider:void 0,!0,(function(e,t){N("Unable to load "+(e&&e.responseURL,t))}))}else{var L=function(e){P&&!E._doNotHandleContextLost&&(R._buffer=e),h(R,O,s,e,R.invertY,n,!1,d,l)};!x||C?p&&("string"==typeof p.decoding||p.close)?L(p):e._FileToolsLoadImage(t||"",L,N,s?s.offlineProvider:null,b,R.invertY&&this._features.needsInvertingBitmap?{imageOrientation:"flipY"}:void 0,this):"string"==typeof p||p instanceof ArrayBuffer||ArrayBuffer.isView(p)||p instanceof Blob?e._FileToolsLoadImage(p,L,N,s?s.offlineProvider:null,b,R.invertY&&this._features.needsInvertingBitmap?{imageOrientation:"flipY"}:void 0,this):p&&L(p)}return R},e.prototype._rebuildBuffers=function(){for(var e=0,t=this._uniformBuffers;e=0&&i.q.Instances.splice(r,1),i.q.Instances.length||(i.q.OnEnginesDisposedObservable.notifyObservers(this),i.q.OnEnginesDisposedObservable.clear()),this.onBeginFrameObservable.clear(),this.onEndFrameObservable.clear()},e.DefaultLoadingScreenFactory=function(e){throw(0,p.n)("LoadingScreen")},e.MarkAllMaterialsAsDirty=function(e,t){for(var n=0;n{n.r(t),n.d(t,{iblCombineVoxelGridsPixelShader:()=>a});var r=n(98519),i="iblCombineVoxelGridsPixelShader",o="precision highp float;precision highp sampler3D;varying vec2 vUV;uniform sampler3D voxelXaxisSampler;uniform sampler3D voxelYaxisSampler;uniform sampler3D voxelZaxisSampler;uniform float layer;void main(void) {vec3 coordZ=vec3(vUV.x,vUV.y,layer);float voxelZ=texture(voxelZaxisSampler,coordZ).r;vec3 coordX=vec3(1.0-layer,vUV.y,vUV.x);float voxelX=texture(voxelXaxisSampler,coordX).r;vec3 coordY=vec3(layer,vUV.x,vUV.y);float voxelY=texture(voxelYaxisSampler,coordY).r;float voxel=(voxelX>0.0 || voxelY>0.0 || voxelZ>0.0) ? 1.0 : 0.0;glFragColor=vec4(vec3(voxel),1.0);}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},82941:(e,t,n)=>{n.d(t,{$e:()=>u,ED:()=>S,Sl:()=>d,SV:()=>h,yT:()=>p,aB:()=>b,af:()=>g,yk:()=>v});var r=n(78322),i=n(44957),o=n(50582),a=n(19133),s=n(81152);function l(){var e=null;function t(e,t,n,r,i){var o=e.getImageTranscodedSizeInBytes(t,n,r),a=new Uint8Array(o);return e.transcodeImage(a,t,n,r,1,0)?(i&&(a=function(e,t,n,r){for(var i=new Uint16Array(4),o=new Uint16Array(n*r),a=n/4,s=r/4,l=0;l>2&3],o[p++]=i[d>>4&3],o[p++]=i[d>>6&3]}}return o}(a,0,e.getImageWidth(t,n)+3&-4,e.getImageHeight(t,n)+3&-4)),a):null}onmessage=function(n){if("init"===n.data.action){if(n.data.url)try{importScripts(n.data.url)}catch(e){postMessage({action:"error",error:e})}e||(e=BASIS({wasmBinary:n.data.wasmBinary})),null!==e&&e.then((function(e){BASIS=e,e.initializeBasis(),postMessage({action:"init"})}))}else if("transcode"===n.data.action){var r=n.data.config,i=n.data.imageData,o=new BASIS.BasisFile(i),a=function(e){for(var t=e.getHasAlpha(),n=e.getNumImages(),r=[],i=0;i1;var h=S.GetInternalFormatFromBasisFormat(t.format,n);e.format=h,y(e,n);for(var d=t.fileInfo.images[r].levels,p=0;p{n.d(t,{G:()=>i});var r=n(81152),i=function(){function e(){this.hoverCursor="",this.actions=[],this.isRecursive=!1,this.disposeWhenUnowned=!0}return Object.defineProperty(e,"HasTriggers",{get:function(){for(var t in e.Triggers)if(Object.prototype.hasOwnProperty.call(e.Triggers,t))return!0;return!1},enumerable:!1,configurable:!0}),Object.defineProperty(e,"HasPickTriggers",{get:function(){for(var t in e.Triggers)if(Object.prototype.hasOwnProperty.call(e.Triggers,t)){var n=parseInt(t);if(n>=r.Y.ACTION_OnPickTrigger&&n<=r.Y.ACTION_OnPickUpTrigger)return!0}return!1},enumerable:!1,configurable:!0}),e.HasSpecificTrigger=function(t){for(var n in e.Triggers)if(Object.prototype.hasOwnProperty.call(e.Triggers,n)&&parseInt(n)===t)return!0;return!1},e.Triggers={},e}()},83057:(e,t,n)=>{n.r(t),n.d(t,{clipPlaneVertex:()=>a});var r=n(98519),i="clipPlaneVertex",o="#ifdef CLIPPLANE\nfClipDistance=dot(worldPos,vClipPlane);\n#endif\n#ifdef CLIPPLANE2\nfClipDistance2=dot(worldPos,vClipPlane2);\n#endif\n#ifdef CLIPPLANE3\nfClipDistance3=dot(worldPos,vClipPlane3);\n#endif\n#ifdef CLIPPLANE4\nfClipDistance4=dot(worldPos,vClipPlane4);\n#endif\n#ifdef CLIPPLANE5\nfClipDistance5=dot(worldPos,vClipPlane5);\n#endif\n#ifdef CLIPPLANE6\nfClipDistance6=dot(worldPos,vClipPlane6);\n#endif\n";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]=o);var a={name:i,shader:o}},83512:(e,t,n)=>{var r=n(98519),i="fogFragment";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="#ifdef FOG\nvar fog: f32=CalcFogFactor();\n#ifdef PBR\nfog=toLinearSpace(fog);\n#endif\ncolor= vec4f(mix(uniforms.vFogColor,color.rgb,fog),color.a);\n#endif\n")},83728:(e,t,n)=>{n.r(t),n.d(t,{FlowGraphPointerOutEventBlock:()=>l});var r=n(78322),i=n(90279),o=n(88099),a=n(34623),s=n(95803),l=function(e){function t(t){var n=e.call(this,t)||this;return n.type="PointerOut",n.pointerId=n.registerDataOutput("pointerId",o.Es),n.targetMesh=n.registerDataInput("targetMesh",o.Vv,null==t?void 0:t.targetMesh),n.meshOutOfPointer=n.registerDataOutput("meshOutOfPointer",o.Vv),n}return(0,r.C6)(t,e),t.prototype._executeEvent=function(e,t){var n,r=this.targetMesh.getValue(e);return this.meshOutOfPointer.setValue(t.mesh,e),this.pointerId.setValue(t.pointerId,e),!((!t.over||!(0,s.Ah)(t.mesh,r))&&(t.mesh===r||(0,s.Ah)(t.mesh,r))&&(this._execute(e),null===(n=this.config)||void 0===n?void 0:n.stopPropagation))},t.prototype._preparePendingTasks=function(e){},t.prototype._cancelPendingTasks=function(e){},t.prototype.getClassName=function(){return"FlowGraphPointerOutEventBlock"},t}(i.i);(0,a.Y5)("FlowGraphPointerOutEventBlock",l)},84020:(e,t,n)=>{var r=n(98519),i="prePassVertexDeclaration";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="#ifdef PREPASS\n#ifdef PREPASS_LOCAL_POSITION\nvarying vPosition : vec3f;\n#endif\n#ifdef PREPASS_DEPTH\nvarying vViewPos: vec3f;\n#endif\n#ifdef PREPASS_NORMALIZED_VIEW_DEPTH\nvarying vNormViewDepth: f32;\n#endif\n#if defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR)\nuniform previousViewProjection: mat4x4f;varying vCurrentPosition: vec4f;varying vPreviousPosition: vec4f;\n#endif\n#endif\n")},84163:(e,t,n)=>{n.d(t,{c:()=>i});var r=n(66377),i=function(){function e(e,t,n){void 0===n&&(n=0),this.deviceType=t,this.deviceSlot=n,this.onInputChangedObservable=new r.cP,this._deviceInputSystem=e}return e.prototype.getInput=function(e){return this._deviceInputSystem.pollInput(this.deviceType,this.deviceSlot,e)},e}()},84192:(e,t,n)=>{n.r(t),n.d(t,{lightFragmentWGSL:()=>a});var r=n(98519),i="lightFragment",o="#ifdef LIGHT{X}\n#if defined(SHADOWONLY) || defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X}) && defined(LIGHTMAPNOSPECULAR{X})\n#else\nvar diffuse{X}: vec4f=light{X}.vLightDiffuse;\n#define CUSTOM_LIGHT{X}_COLOR \n#if defined(PBR) && defined(CLUSTLIGHT{X})\n{let sliceIndex=min(getClusteredSliceIndex(light{X}.vSliceData,fragmentInputs.vViewDepth),CLUSTLIGHT_SLICES-1);info=computeClusteredLighting(\nlightDataTexture{X},\n&tileMaskBuffer{X},\nlight{X}.vLightData,\nvec2u(light{X}.vSliceRanges[sliceIndex].xy),\nviewDirectionW,\nnormalW,\nfragmentInputs.vPositionW,\nsurfaceAlbedo,\nreflectivityOut,\n#ifdef IRIDESCENCE\niridescenceIntensity,\n#endif\n#ifdef SS_TRANSLUCENCY\nsubSurfaceOut,\n#endif\n#ifdef SPECULARTERM\nAARoughnessFactors.x,\n#endif\n#ifdef ANISOTROPIC\nanisotropicOut,\n#endif\n#ifdef SHEEN\nsheenOut,\n#endif\n#ifdef CLEARCOAT\nclearcoatOut,\n#endif\n);}\n#elif defined(PBR)\n#ifdef SPOTLIGHT{X}\npreInfo=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW,fragmentInputs.vPositionW);\n#elif defined(POINTLIGHT{X})\npreInfo=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW,fragmentInputs.vPositionW);\n#elif defined(HEMILIGHT{X})\npreInfo=computeHemisphericPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\n#elif defined(DIRLIGHT{X})\npreInfo=computeDirectionalPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\n#elif defined(AREALIGHT{X}) && defined(AREALIGHTSUPPORTED)\npreInfo=computeAreaPreLightingInfo(areaLightsLTC1Sampler,areaLightsLTC1SamplerSampler,areaLightsLTC2Sampler,areaLightsLTC2SamplerSampler,viewDirectionW,normalW,fragmentInputs.vPositionW,light{X}.vLightData.xyz,light{X}.vLightWidth.xyz,light{X}.vLightHeight.xyz,roughness);\n#endif\npreInfo.NdotV=NdotV;\n#ifdef SPOTLIGHT{X}\n#ifdef LIGHT_FALLOFF_GLTF{X}\npreInfo.attenuation=computeDistanceLightFalloff_GLTF(preInfo.lightDistanceSquared,light{X}.vLightFalloff.y);\n#ifdef IESLIGHTTEXTURE{X}\npreInfo.attenuation*=computeDirectionalLightFalloff_IES(light{X}.vLightDirection.xyz,preInfo.L,iesLightTexture{X},iesLightTexture{X}Sampler);\n#else\npreInfo.attenuation*=computeDirectionalLightFalloff_GLTF(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightFalloff.z,light{X}.vLightFalloff.w);\n#endif\n#elif defined(LIGHT_FALLOFF_PHYSICAL{X})\npreInfo.attenuation=computeDistanceLightFalloff_Physical(preInfo.lightDistanceSquared);\n#ifdef IESLIGHTTEXTURE{X}\npreInfo.attenuation*=computeDirectionalLightFalloff_IES(light{X}.vLightDirection.xyz,preInfo.L,iesLightTexture{X},iesLightTexture{X}Sampler);\n#else\npreInfo.attenuation*=computeDirectionalLightFalloff_Physical(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w);\n#endif\n#elif defined(LIGHT_FALLOFF_STANDARD{X})\npreInfo.attenuation=computeDistanceLightFalloff_Standard(preInfo.lightOffset,light{X}.vLightFalloff.x);\n#ifdef IESLIGHTTEXTURE{X}\npreInfo.attenuation*=computeDirectionalLightFalloff_IES(light{X}.vLightDirection.xyz,preInfo.L,iesLightTexture{X},iesLightTexture{X}Sampler);\n#else\npreInfo.attenuation*=computeDirectionalLightFalloff_Standard(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w,light{X}.vLightData.w);\n#endif\n#else\npreInfo.attenuation=computeDistanceLightFalloff(preInfo.lightOffset,preInfo.lightDistanceSquared,light{X}.vLightFalloff.x,light{X}.vLightFalloff.y);\n#ifdef IESLIGHTTEXTURE{X}\npreInfo.attenuation*=computeDirectionalLightFalloff_IES(light{X}.vLightDirection.xyz,preInfo.L,iesLightTexture{X},iesLightTexture{X}Sampler);\n#else\npreInfo.attenuation*=computeDirectionalLightFalloff(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w,light{X}.vLightData.w,light{X}.vLightFalloff.z,light{X}.vLightFalloff.w);\n#endif\n#endif\n#elif defined(POINTLIGHT{X})\n#ifdef LIGHT_FALLOFF_GLTF{X}\npreInfo.attenuation=computeDistanceLightFalloff_GLTF(preInfo.lightDistanceSquared,light{X}.vLightFalloff.y);\n#elif defined(LIGHT_FALLOFF_PHYSICAL{X})\npreInfo.attenuation=computeDistanceLightFalloff_Physical(preInfo.lightDistanceSquared);\n#elif defined(LIGHT_FALLOFF_STANDARD{X})\npreInfo.attenuation=computeDistanceLightFalloff_Standard(preInfo.lightOffset,light{X}.vLightFalloff.x);\n#else\npreInfo.attenuation=computeDistanceLightFalloff(preInfo.lightOffset,preInfo.lightDistanceSquared,light{X}.vLightFalloff.x,light{X}.vLightFalloff.y);\n#endif\n#else\npreInfo.attenuation=1.0;\n#endif\n#if defined(HEMILIGHT{X}) || defined(AREALIGHT{X})\npreInfo.roughness=roughness;\n#else\npreInfo.roughness=adjustRoughnessFromLightProperties(roughness,light{X}.vLightSpecular.a,preInfo.lightDistance);\n#endif\npreInfo.diffuseRoughness=diffuseRoughness;preInfo.surfaceAlbedo=surfaceAlbedo;\n#ifdef IRIDESCENCE\npreInfo.iridescenceIntensity=iridescenceIntensity;\n#endif\n#ifdef SS_TRANSLUCENCY\ninfo.diffuseTransmission=vec3f(0.0);\n#endif\n#ifdef HEMILIGHT{X}\ninfo.diffuse=computeHemisphericDiffuseLighting(preInfo,diffuse{X}.rgb,light{X}.vLightGround);\n#elif defined(AREALIGHT{X})\ninfo.diffuse=computeAreaDiffuseLighting(preInfo,diffuse{X}.rgb);\n#elif defined(SS_TRANSLUCENCY)\n#ifndef SS_TRANSLUCENCY_LEGACY\ninfo.diffuse=computeDiffuseLighting(preInfo,diffuse{X}.rgb)*(1.0-subSurfaceOut.translucencyIntensity);info.diffuseTransmission=computeDiffuseTransmittedLighting(preInfo,diffuse{X}.rgb,subSurfaceOut.transmittance); \n#else\ninfo.diffuse=computeDiffuseTransmittedLighting(preInfo,diffuse{X}.rgb,subSurfaceOut.transmittance);\n#endif\n#else\ninfo.diffuse=computeDiffuseLighting(preInfo,diffuse{X}.rgb);\n#endif\n#ifdef SPECULARTERM\n#if AREALIGHT{X}\ninfo.specular=computeAreaSpecularLighting(preInfo,light{X}.vLightSpecular.rgb,clearcoatOut.specularEnvironmentR0,reflectivityOut.colorReflectanceF90);\n#else\n#if (CONDUCTOR_SPECULAR_MODEL==CONDUCTOR_SPECULAR_MODEL_OPENPBR)\n{let metalFresnel: vec3f=vec3f(reflectivityOut.specularWeight)*getF82Specular(preInfo.VdotH,clearcoatOut.specularEnvironmentR0,reflectivityOut.colorReflectanceF90,reflectivityOut.roughness);let dielectricFresnel: vec3f=fresnelSchlickGGXVec3(preInfo.VdotH,reflectivityOut.dielectricColorF0,reflectivityOut.colorReflectanceF90);coloredFresnel=mix(dielectricFresnel,metalFresnel,reflectivityOut.metallic);}\n#else\ncoloredFresnel=fresnelSchlickGGXVec3(preInfo.VdotH,clearcoatOut.specularEnvironmentR0,reflectivityOut.colorReflectanceF90);\n#endif\n#ifndef LEGACY_SPECULAR_ENERGY_CONSERVATION\n{let NdotH: f32=dot(normalW,preInfo.H);let fresnel: vec3f=fresnelSchlickGGXVec3(NdotH,vec3f(reflectanceF0),specularEnvironmentR90);info.diffuse*=(vec3f(1.0)-fresnel);}\n#endif\n#ifdef ANISOTROPIC\ninfo.specular=computeAnisotropicSpecularLighting(preInfo,viewDirectionW,normalW,anisotropicOut.anisotropicTangent,anisotropicOut.anisotropicBitangent,anisotropicOut.anisotropy,clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,AARoughnessFactors.x,diffuse{X}.rgb);\n#else\ninfo.specular=computeSpecularLighting(preInfo,normalW,clearcoatOut.specularEnvironmentR0,coloredFresnel,AARoughnessFactors.x,diffuse{X}.rgb);\n#endif\n#endif\n#endif\n#ifndef AREALIGHT{X}\n#ifdef SHEEN\n#ifdef SHEEN_LINKWITHALBEDO\npreInfo.roughness=sheenOut.sheenIntensity;\n#else\n#ifdef HEMILIGHT{X}\npreInfo.roughness=sheenOut.sheenRoughness;\n#else\npreInfo.roughness=adjustRoughnessFromLightProperties(sheenOut.sheenRoughness,light{X}.vLightSpecular.a,preInfo.lightDistance);\n#endif\n#endif\ninfo.sheen=computeSheenLighting(preInfo,normalW,sheenOut.sheenColor,specularEnvironmentR90,AARoughnessFactors.x,diffuse{X}.rgb);\n#endif\n#ifdef CLEARCOAT\n#ifdef HEMILIGHT{X}\npreInfo.roughness=clearcoatOut.clearCoatRoughness;\n#else\npreInfo.roughness=adjustRoughnessFromLightProperties(clearcoatOut.clearCoatRoughness,light{X}.vLightSpecular.a,preInfo.lightDistance);\n#endif\ninfo.clearCoat=computeClearCoatLighting(preInfo,clearcoatOut.clearCoatNormalW,clearcoatOut.clearCoatAARoughnessFactors.x,clearcoatOut.clearCoatIntensity,diffuse{X}.rgb);\n#ifdef CLEARCOAT_TINT\nabsorption=computeClearCoatLightingAbsorption(clearcoatOut.clearCoatNdotVRefract,preInfo.L,clearcoatOut.clearCoatNormalW,clearcoatOut.clearCoatColor,clearcoatOut.clearCoatThickness,clearcoatOut.clearCoatIntensity);info.diffuse*=absorption;\n#ifdef SS_TRANSLUCENCY\ninfo.diffuseTransmission*=absorption;\n#endif\n#ifdef SPECULARTERM\ninfo.specular*=absorption;\n#endif\n#endif\ninfo.diffuse*=info.clearCoat.w;\n#ifdef SS_TRANSLUCENCY\ninfo.diffuseTransmission*=info.clearCoat.w;\n#endif\n#ifdef SPECULARTERM\ninfo.specular*=info.clearCoat.w;\n#endif\n#ifdef SHEEN\ninfo.sheen*=info.clearCoat.w;\n#endif\n#endif\n#endif\n#else\n#ifdef SPOTLIGHT{X}\n#ifdef IESLIGHTTEXTURE{X}\ninfo=computeIESSpotLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDirection,diffuse{X}.rgb,light{X}.vLightSpecular.rgb,diffuse{X}.a,glossiness,iesLightTexture{X},iesLightTexture{X}Sampler);\n#else\ninfo=computeSpotLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDirection,diffuse{X}.rgb,light{X}.vLightSpecular.rgb,diffuse{X}.a,glossiness);\n#endif\n#elif defined(HEMILIGHT{X})\ninfo=computeHemisphericLighting(viewDirectionW,normalW,light{X}.vLightData,diffuse{X}.rgb,light{X}.vLightSpecular.rgb,light{X}.vLightGround,glossiness);\n#elif defined(POINTLIGHT{X}) || defined(DIRLIGHT{X})\ninfo=computeLighting(viewDirectionW,normalW,light{X}.vLightData,diffuse{X}.rgb,light{X}.vLightSpecular.rgb,diffuse{X}.a,glossiness);\n#elif define(AREALIGHT{X}) && defined(AREALIGHTSUPPORTED)\ninfo=computeAreaLighting(areaLightsLTC1Sampler,areaLightsLTC1SamplerSampler,areaLightsLTC2Sampler,areaLightsLTC2SamplerSampler,viewDirectionW,normalW,fragmentInputs.vPositionW,light{X}.vLightData.xyz,light{X}.vLightWidth.xyz,light{X}.vLightHeight.xyz,diffuse{X}.rgb,light{X}.vLightSpecular.rgb,\n#ifdef AREALIGHTNOROUGHTNESS\n0.5\n#else\nuniforms.vReflectionInfos.y\n#endif\n);\n#elif defined(CLUSTLIGHT{X})\n{let sliceIndex=min(getClusteredSliceIndex(light{X}.vSliceData,fragmentInputs.vViewDepth),CLUSTLIGHT_SLICES-1);info=computeClusteredLighting(lightDataTexture{X},&tileMaskBuffer{X},viewDirectionW,normalW,light{X}.vLightData,vec2u(light{X}.vSliceRanges[sliceIndex].xy),glossiness);}\n#endif\n#endif\n#ifdef PROJECTEDLIGHTTEXTURE{X}\ninfo.diffuse*=computeProjectionTextureDiffuseLighting(projectionLightTexture{X},projectionLightTexture{X}Sampler,uniforms.textureProjectionMatrix{X},fragmentInputs.vPositionW);\n#endif\n#endif\n#ifdef SHADOW{X}\n#ifdef SHADOWCSMDEBUG{X}\nvar shadowDebug{X}: vec3f;\n#endif\n#ifdef SHADOWCSM{X}\n#ifdef SHADOWCSMUSESHADOWMAXZ{X}\nvar index{X}: i32=-1;\n#else\nvar index{X}: i32=SHADOWCSMNUM_CASCADES{X}-1;\n#endif\nvar diff{X}: f32=0.;vPositionFromLight{X}[0]=fragmentInputs.vPositionFromLight{X}_0;vPositionFromLight{X}[1]=fragmentInputs.vPositionFromLight{X}_1;vPositionFromLight{X}[2]=fragmentInputs.vPositionFromLight{X}_2;vPositionFromLight{X}[3]=fragmentInputs.vPositionFromLight{X}_3;vDepthMetric{X}[0]=fragmentInputs.vDepthMetric{X}_0;vDepthMetric{X}[1]=fragmentInputs.vDepthMetric{X}_1;vDepthMetric{X}[2]=fragmentInputs.vDepthMetric{X}_2;vDepthMetric{X}[3]=fragmentInputs.vDepthMetric{X}_3;for (var i:i32=0; i=0.) {index{X}=i;break;}}\n#ifdef SHADOWCSMUSESHADOWMAXZ{X}\nif (index{X}>=0)\n#endif\n{\n#if defined(SHADOWPCF{X})\n#if defined(SHADOWLOWQUALITY{X})\nshadow=computeShadowWithCSMPCF1(index{X},vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#elif defined(SHADOWMEDIUMQUALITY{X})\nshadow=computeShadowWithCSMPCF3(index{X},vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#else\nshadow=computeShadowWithCSMPCF5(index{X},vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPCSS{X})\n#if defined(SHADOWLOWQUALITY{X})\nshadow=computeShadowWithCSMPCSS16(index{X},vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthTexture{X},depthTexture{X}Sampler,shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,uniforms.lightSizeUVCorrection{X}[index{X}],uniforms.depthCorrection{X}[index{X}],uniforms.penumbraDarkness{X});\n#elif defined(SHADOWMEDIUMQUALITY{X})\nshadow=computeShadowWithCSMPCSS32(index{X},vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthTexture{X},depthTexture{X}Sampler,shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,uniforms.lightSizeUVCorrection{X}[index{X}],uniforms.depthCorrection{X}[index{X}],uniforms.penumbraDarkness{X});\n#else\nshadow=computeShadowWithCSMPCSS64(index{X},vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthTexture{X},depthTexture{X}Sampler,shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,uniforms.lightSizeUVCorrection{X}[index{X}],uniforms.depthCorrection{X}[index{X}],uniforms.penumbraDarkness{X});\n#endif\n#else\nshadow=computeShadowCSM(index{X},vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#ifdef SHADOWCSMDEBUG{X}\nshadowDebug{X}=vec3f(shadow)*vCascadeColorsMultiplier{X}[index{X}];\n#endif\n#ifndef SHADOWCSMNOBLEND{X}\nvar frustumLength:f32=uniforms.frustumLengths{X}[index{X}];var diffRatio:f32=clamp(diff{X}/frustumLength,0.,1.)*uniforms.cascadeBlendFactor{X};if (index{X}<(SHADOWCSMNUM_CASCADES{X}-1) && diffRatio<1.)\n{index{X}+=1;var nextShadow: f32=0.;\n#if defined(SHADOWPCF{X})\n#if defined(SHADOWLOWQUALITY{X})\nnextShadow=computeShadowWithCSMPCF1(index{X},vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],,shadowTexture{X}Sampler,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#elif defined(SHADOWMEDIUMQUALITY{X})\nnextShadow=computeShadowWithCSMPCF3(index{X},vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#else\nnextShadow=computeShadowWithCSMPCF5(index{X},vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPCSS{X})\n#if defined(SHADOWLOWQUALITY{X})\nnextShadow=computeShadowWithCSMPCSS16(index{X},vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthTexture{X},depthTexture{X}Sampler,shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,uniforms.lightSizeUVCorrection{X}[index{X}],uniforms.depthCorrection{X}[index{X}],uniforms.penumbraDarkness{X});\n#elif defined(SHADOWMEDIUMQUALITY{X})\nnextShadow=computeShadowWithCSMPCSS32(index{X},vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthTexture{X},depthTexture{X}Sampler,shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,uniforms.lightSizeUVCorrection{X}[index{X}],uniforms.depthCorrection{X}[index{X}],uniforms.penumbraDarkness{X});\n#else\nnextShadow=computeShadowWithCSMPCSS64(index{X},vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthTexture{X},depthTexture{X}Sampler,shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,uniforms.lightSizeUVCorrection{X}[index{X}],uniforms.depthCorrection{X}[index{X}],uniforms.penumbraDarkness{X});\n#endif\n#else\nnextShadow=computeShadowCSM(index{X},vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\nshadow=mix(nextShadow,shadow,diffRatio);\n#ifdef SHADOWCSMDEBUG{X}\nshadowDebug{X}=mix(vec3(nextShadow)*vCascadeColorsMultiplier{X}[index{X}],shadowDebug{X},diffRatio);\n#endif\n}\n#endif\n}\n#elif defined(SHADOWCLOSEESM{X})\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowWithCloseESMCube(fragmentInputs.vPositionW,light{X}.vLightData.xyz,shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.depthValues);\n#else\nshadow=computeShadowWithCloseESM(fragmentInputs.vPositionFromLight{X},fragmentInputs.vDepthMetric{X},shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWESM{X})\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowWithESMCube(fragmentInputs.vPositionW,light{X}.vLightData.xyz,shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.depthValues);\n#else\nshadow=computeShadowWithESM(fragmentInputs.vPositionFromLight{X},fragmentInputs.vDepthMetric{X},shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPOISSON{X})\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowWithPoissonSamplingCube(fragmentInputs.vPositionW,light{X}.vLightData.xyz,shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.y,light{X}.shadowsInfo.x,light{X}.depthValues);\n#else\nshadow=computeShadowWithPoissonSampling(fragmentInputs.vPositionFromLight{X},fragmentInputs.vDepthMetric{X},shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.y,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPCF{X})\n#if defined(SHADOWLOWQUALITY{X})\nshadow=computeShadowWithPCF1(fragmentInputs.vPositionFromLight{X},fragmentInputs.vDepthMetric{X},shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#elif defined(SHADOWMEDIUMQUALITY{X})\nshadow=computeShadowWithPCF3(fragmentInputs.vPositionFromLight{X},fragmentInputs.vDepthMetric{X},shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#else\nshadow=computeShadowWithPCF5(fragmentInputs.vPositionFromLight{X},fragmentInputs.vDepthMetric{X},shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPCSS{X})\n#if defined(SHADOWLOWQUALITY{X})\nshadow=computeShadowWithPCSS16(fragmentInputs.vPositionFromLight{X},fragmentInputs.vDepthMetric{X},depthTexture{X},depthTexture{X}Sampler,shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#elif defined(SHADOWMEDIUMQUALITY{X})\nshadow=computeShadowWithPCSS32(fragmentInputs.vPositionFromLight{X},fragmentInputs.vDepthMetric{X},depthTexture{X},depthTexture{X}Sampler,shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#else\nshadow=computeShadowWithPCSS64(fragmentInputs.vPositionFromLight{X},fragmentInputs.vDepthMetric{X},depthTexture{X},depthTexture{X}Sampler,shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#else\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowCube(fragmentInputs.vPositionW,light{X}.vLightData.xyz,shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.x,light{X}.depthValues);\n#else\nshadow=computeShadow(fragmentInputs.vPositionFromLight{X},fragmentInputs.vDepthMetric{X},shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#endif\n#ifdef SHADOWONLY\n#ifndef SHADOWINUSE\n#define SHADOWINUSE\n#endif\nglobalShadow+=shadow;shadowLightCount+=1.0;\n#endif\n#else\nshadow=1.;\n#endif\naggShadow+=shadow;numLights+=1.0;\n#ifndef SHADOWONLY\n#ifdef CUSTOMUSERLIGHTING\ndiffuseBase+=computeCustomDiffuseLighting(info,diffuseBase,shadow);\n#ifdef SPECULARTERM\nspecularBase+=computeCustomSpecularLighting(info,specularBase,shadow);\n#endif\n#elif defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X})\ndiffuseBase+=lightmapColor.rgb*shadow;\n#ifdef SPECULARTERM\n#ifndef LIGHTMAPNOSPECULAR{X}\nspecularBase+=info.specular*shadow*lightmapColor.rgb;\n#endif\n#endif\n#ifdef CLEARCOAT\n#ifndef LIGHTMAPNOSPECULAR{X}\nclearCoatBase+=info.clearCoat.rgb*shadow*lightmapColor.rgb;\n#endif\n#endif\n#ifdef SHEEN\n#ifndef LIGHTMAPNOSPECULAR{X}\nsheenBase+=info.sheen.rgb*shadow;\n#endif\n#endif\n#else\n#ifdef SHADOWCSMDEBUG{X}\ndiffuseBase+=info.diffuse*shadowDebug{X};\n#else\ndiffuseBase+=info.diffuse*shadow;\n#endif\n#ifdef SS_TRANSLUCENCY\ndiffuseTransmissionBase+=info.diffuseTransmission*shadow;\n#endif\n#ifdef SPECULARTERM\nspecularBase+=info.specular*shadow;\n#endif\n#ifdef CLEARCOAT\nclearCoatBase+=info.clearCoat.rgb*shadow;\n#endif\n#ifdef SHEEN\nsheenBase+=info.sheen.rgb*shadow;\n#endif\n#endif\n#endif\n#endif\n";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]=o);var a={name:i,shader:o}},84586:(e,t,n)=>{n.r(t),n.d(t,{iblShadowAccumulationPixelShader:()=>a});var r=n(98519),i="iblShadowAccumulationPixelShader",o="#ifdef GL_ES\nprecision mediump float;\n#endif\nvarying vec2 vUV;uniform vec4 accumulationParameters;\n#define remanence accumulationParameters.x\n#define resetb accumulationParameters.y\n#define sceneSize accumulationParameters.z\nuniform sampler2D motionSampler;uniform sampler2D positionSampler;uniform sampler2D spatialBlurSampler;uniform sampler2D oldAccumulationSampler;uniform sampler2D prevPositionSampler;vec2 max2(vec2 v,vec2 w) { return vec2(max(v.x,w.x),max(v.y,w.y)); }\nvoid main(void) {bool reset=bool(resetb);vec2 gbufferRes=vec2(textureSize(motionSampler,0));ivec2 gbufferPixelCoord=ivec2(vUV*gbufferRes);vec2 shadowRes=vec2(textureSize(spatialBlurSampler,0));ivec2 shadowPixelCoord=ivec2(vUV*shadowRes);vec4 LP=texelFetch(positionSampler,gbufferPixelCoord,0);if (0.0==LP.w) {gl_FragColor=vec4(1.0,0.0,0.0,1.0);return;}\nvec2 velocityColor=texelFetch(motionSampler,gbufferPixelCoord,0).xy;vec2 prevCoord=vUV+velocityColor;vec3 PrevLP=texture(prevPositionSampler,prevCoord).xyz;vec4 PrevShadows=texture(oldAccumulationSampler,prevCoord);vec3 newShadows=texelFetch(spatialBlurSampler,shadowPixelCoord,0).xyz;PrevShadows.a =\n!reset && all(lessThan(abs(prevCoord-vec2(0.5)),vec2(0.5))) &&\ndistance(LP.xyz,PrevLP)<5e-2*sceneSize\n? max(PrevShadows.a/(1.0+PrevShadows.a),1.0-remanence)\n: 1.0;PrevShadows=max(vec4(0.0),PrevShadows);gl_FragColor =\nvec4(mix(PrevShadows.x,newShadows.x,PrevShadows.a),\nmix(PrevShadows.y,newShadows.y,PrevShadows.a),\nmix(PrevShadows.z,newShadows.z,PrevShadows.a),PrevShadows.a);}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},84589:(e,t,n)=>{n.r(t),n.d(t,{morphTargetsVertex:()=>a});var r=n(98519),i="morphTargetsVertex",o="#ifdef MORPHTARGETS\n#ifdef MORPHTARGETS_TEXTURE\n#if {X}==0\nfor (int i=0; i=morphTargetCount) break;vertexID=float(gl_VertexID)*morphTargetTextureInfo.x;\n#ifdef MORPHTARGETS_POSITION\npositionUpdated+=(readVector3FromRawSampler(i,vertexID)-position)*morphTargetInfluences[i];\n#endif\n#ifdef MORPHTARGETTEXTURE_HASPOSITIONS\nvertexID+=1.0;\n#endif\n#ifdef MORPHTARGETS_NORMAL\nnormalUpdated+=(readVector3FromRawSampler(i,vertexID) -normal)*morphTargetInfluences[i];\n#endif\n#ifdef MORPHTARGETTEXTURE_HASNORMALS\nvertexID+=1.0;\n#endif\n#ifdef MORPHTARGETS_UV\nuvUpdated+=(readVector3FromRawSampler(i,vertexID).xy-uv)*morphTargetInfluences[i];\n#endif\n#ifdef MORPHTARGETTEXTURE_HASUVS\nvertexID+=1.0;\n#endif\n#ifdef MORPHTARGETS_TANGENT\ntangentUpdated.xyz+=(readVector3FromRawSampler(i,vertexID) -tangent.xyz)*morphTargetInfluences[i];\n#endif\n#ifdef MORPHTARGETTEXTURE_HASTANGENTS\nvertexID+=1.0;\n#endif\n#ifdef MORPHTARGETS_UV2\nuv2Updated+=(readVector3FromRawSampler(i,vertexID).xy-uv2)*morphTargetInfluences[i];\n#endif\n#ifdef MORPHTARGETTEXTURE_HASUV2S\nvertexID+=1.0;\n#endif\n#ifdef MORPHTARGETS_COLOR\ncolorUpdated+=(readVector4FromRawSampler(i,vertexID)-color)*morphTargetInfluences[i];\n#endif\n}\n#endif\n#else\n#ifdef MORPHTARGETS_POSITION\npositionUpdated+=(position{X}-position)*morphTargetInfluences[{X}];\n#endif\n#ifdef MORPHTARGETS_NORMAL\nnormalUpdated+=(normal{X}-normal)*morphTargetInfluences[{X}];\n#endif\n#ifdef MORPHTARGETS_TANGENT\ntangentUpdated.xyz+=(tangent{X}-tangent.xyz)*morphTargetInfluences[{X}];\n#endif\n#ifdef MORPHTARGETS_UV\nuvUpdated+=(uv_{X}-uv)*morphTargetInfluences[{X}];\n#endif\n#ifdef MORPHTARGETS_UV2\nuv2Updated+=(uv2_{X}-uv2)*morphTargetInfluences[{X}];\n#endif\n#ifdef MORPHTARGETS_COLOR\ncolorUpdated+=(color{X}-color)*morphTargetInfluences[{X}];\n#endif\n#endif\n#endif\n";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]=o);var a={name:i,shader:o}},84668:(e,t,n)=>{n.d(t,{Bv:()=>g,E8:()=>h,KA:()=>o,ND:()=>l,Q6:()=>f,Ww:()=>d,_B:()=>u,fA:()=>p,kL:()=>s,kc:()=>_,q7:()=>m,rm:()=>a,vm:()=>c});var r=n(78322),i=n(95318),o=function(){function e(){this._easingMode=e.EASINGMODE_EASEIN}return e.prototype.setEasingMode=function(e){var t=Math.min(Math.max(e,0),2);this._easingMode=t},e.prototype.getEasingMode=function(){return this._easingMode},e.prototype.easeInCore=function(e){throw new Error("You must implement this method")},e.prototype.ease=function(t){switch(this._easingMode){case e.EASINGMODE_EASEIN:return this.easeInCore(t);case e.EASINGMODE_EASEOUT:return 1-this.easeInCore(1-t)}return t>=.5?.5*(1-this.easeInCore(2*(1-t)))+.5:.5*this.easeInCore(2*t)},e.EASINGMODE_EASEIN=0,e.EASINGMODE_EASEOUT=1,e.EASINGMODE_EASEINOUT=2,e}(),a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,r.C6)(t,e),t.prototype.easeInCore=function(e){return e=Math.max(0,Math.min(1,e)),1-Math.sqrt(1-e*e)},t}(o),s=function(e){function t(t){void 0===t&&(t=1);var n=e.call(this)||this;return n.amplitude=t,n}return(0,r.C6)(t,e),t.prototype.easeInCore=function(e){var t=Math.max(0,this.amplitude);return Math.pow(e,3)-e*t*Math.sin(3.141592653589793*e)},t}(o),l=function(e){function t(t,n){void 0===t&&(t=3),void 0===n&&(n=2);var r=e.call(this)||this;return r.bounces=t,r.bounciness=n,r}return(0,r.C6)(t,e),t.prototype.easeInCore=function(e){var t=Math.max(0,this.bounces),n=this.bounciness;n<=1&&(n=1.001);var r=Math.pow(n,t),i=1-n,o=(1-r)/i+.5*r,a=e*o,s=Math.log(-a*(1-n)+1)/Math.log(n),l=Math.floor(s),c=l+1,u=(1-Math.pow(n,l))/(i*o),h=.5*(u+(1-Math.pow(n,c))/(i*o)),d=e-h,p=h-u;return-Math.pow(1/n,t-l)/(p*p)*(d-p)*(d+p)},t}(o),c=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,r.C6)(t,e),t.prototype.easeInCore=function(e){return e*e*e},t}(o),u=function(e){function t(t,n){void 0===t&&(t=3),void 0===n&&(n=3);var r=e.call(this)||this;return r.oscillations=t,r.springiness=n,r}return(0,r.C6)(t,e),t.prototype.easeInCore=function(e){var t=Math.max(0,this.oscillations),n=Math.max(0,this.springiness);return(0==n?e:(Math.exp(n*e)-1)/(Math.exp(n)-1))*Math.sin((6.283185307179586*t+1.5707963267948966)*e)},t}(o),h=function(e){function t(t){void 0===t&&(t=2);var n=e.call(this)||this;return n.exponent=t,n}return(0,r.C6)(t,e),t.prototype.easeInCore=function(e){return this.exponent<=0?e:(Math.exp(this.exponent*e)-1)/(Math.exp(this.exponent)-1)},t}(o),d=function(e){function t(t){void 0===t&&(t=2);var n=e.call(this)||this;return n.power=t,n}return(0,r.C6)(t,e),t.prototype.easeInCore=function(e){var t=Math.max(0,this.power);return Math.pow(e,t)},t}(o),p=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,r.C6)(t,e),t.prototype.easeInCore=function(e){return e*e},t}(o),f=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,r.C6)(t,e),t.prototype.easeInCore=function(e){return e*e*e*e},t}(o),m=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,r.C6)(t,e),t.prototype.easeInCore=function(e){return e*e*e*e*e},t}(o),_=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,r.C6)(t,e),t.prototype.easeInCore=function(e){return 1-Math.sin(1.5707963267948966*(1-e))},t}(o),g=function(e){function t(t,n,r,i){void 0===t&&(t=0),void 0===n&&(n=0),void 0===r&&(r=1),void 0===i&&(i=1);var o=e.call(this)||this;return o.x1=t,o.y1=n,o.x2=r,o.y2=i,o}return(0,r.C6)(t,e),t.prototype.easeInCore=function(e){return i.vr.Interpolate(e,this.x1,this.y1,this.x2,this.y2)},t}(o)},84765:(e,t,n)=>{n.r(t),n.d(t,{defaultVertexShader:()=>s});var r=n(98519),i=(n(42858),"defaultVertexDeclaration");r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="uniform mat4 viewProjection;\n#ifdef MULTIVIEW\nmat4 viewProjectionR;\n#endif \nuniform mat4 view;\n#ifdef DIFFUSE\nuniform mat4 diffuseMatrix;uniform vec2 vDiffuseInfos;\n#endif\n#ifdef AMBIENT\nuniform mat4 ambientMatrix;uniform vec2 vAmbientInfos;\n#endif\n#ifdef OPACITY\nuniform mat4 opacityMatrix;uniform vec2 vOpacityInfos;\n#endif\n#ifdef EMISSIVE\nuniform vec2 vEmissiveInfos;uniform mat4 emissiveMatrix;\n#endif\n#ifdef LIGHTMAP\nuniform vec2 vLightmapInfos;uniform mat4 lightmapMatrix;\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM)\nuniform vec2 vSpecularInfos;uniform mat4 specularMatrix;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;uniform mat4 bumpMatrix;\n#endif\n#ifdef REFLECTION\nuniform mat4 reflectionMatrix;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n#ifdef DETAIL\nuniform vec4 vDetailInfos;uniform mat4 detailMatrix;\n#endif\nuniform vec4 cameraInfo;\n#include\n#define ADDITIONAL_VERTEX_DECLARATION\n"),n(51578),n(77976),n(75334),n(36470),n(64400),n(38615),n(60965),n(48493),n(60581),n(42513),n(85637),n(72153),n(94785),n(48961),n(24444),n(67369),n(59262),n(58266),n(84589),n(35397),n(76898),n(49334),n(7761),n(45858),n(81067),n(35845),n(83057),n(62589),n(62136),n(45812),n(52226),n(56458);var o="defaultVertexShader",a="#define CUSTOM_VERTEX_EXTENSION\n#include<__decl__defaultVertex>\n#define CUSTOM_VERTEX_BEGIN\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef TANGENT\nattribute vec4 tangent;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#include[2..7]\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include\n#include\n#include\n#include\n#include\n#include[1..7]\n#include(_DEFINENAME_,DIFFUSE,_VARYINGNAME_,Diffuse)\n#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail)\n#include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient)\n#include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity)\n#include(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive)\n#include(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap)\n#if defined(SPECULARTERM)\n#include(_DEFINENAME_,SPECULAR,_VARYINGNAME_,Specular)\n#endif\n#include(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump)\n#include(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal)\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#include\n#include\n#include\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\n#include\n#include[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#include\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvec3 positionUpdated=position;\n#ifdef NORMAL\nvec3 normalUpdated=normal;\n#endif\n#ifdef TANGENT\nvec4 tangentUpdated=tangent;\n#endif\n#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#ifdef UV2\nvec2 uv2Updated=uv2;\n#endif\n#ifdef VERTEXCOLOR\nvec4 colorUpdated=color;\n#endif\n#include\n#include[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\nvPositionUVW=positionUpdated;\n#endif\n#define CUSTOM_VERTEX_UPDATE_POSITION\n#define CUSTOM_VERTEX_UPDATE_NORMAL\n#include\n#if defined(PREPASS) && ((defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR)) && !defined(BONES_VELOCITY_ENABLED)\nvCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);vPreviousPosition=previousViewProjection*finalPreviousWorld*vec4(positionUpdated,1.0);\n#endif\n#include\n#include\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\n#ifdef NORMAL\nmat3 normalWorld=mat3(finalWorld);\n#if defined(INSTANCES) && defined(THIN_INSTANCES)\nvNormalW=normalUpdated/vec3(dot(normalWorld[0],normalWorld[0]),dot(normalWorld[1],normalWorld[1]),dot(normalWorld[2],normalWorld[2]));vNormalW=normalize(normalWorld*vNormalW);\n#else\n#ifdef NONUNIFORMSCALING\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\n#endif\nvNormalW=normalize(normalWorld*normalUpdated);\n#endif\n#endif\n#define CUSTOM_VERTEX_UPDATE_WORLDPOS\n#ifdef MULTIVIEW\nif (gl_ViewID_OVR==0u) {gl_Position=viewProjection*worldPos;} else {gl_Position=viewProjectionR*worldPos;}\n#else\ngl_Position=viewProjection*worldPos;\n#endif\nvPositionW=vec3(worldPos);\n#ifdef PREPASS\n#include\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvDirectionW=normalize(vec3(finalWorld*vec4(positionUpdated,0.0)));\n#endif\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvViewDepth=(view*worldPos).z;\n#endif\n#ifndef UV1\nvec2 uvUpdated=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2Updated=vec2(0.,0.);\n#endif\n#ifdef MAINUV1\nvMainUV1=uvUpdated;\n#endif\n#ifdef MAINUV2\nvMainUV2=uv2Updated;\n#endif\n#include[3..7]\n#include(_DEFINENAME_,DIFFUSE,_VARYINGNAME_,Diffuse,_MATRIXNAME_,diffuse,_INFONAME_,DiffuseInfos.x)\n#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail,_MATRIXNAME_,detail,_INFONAME_,DetailInfos.x)\n#include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_MATRIXNAME_,ambient,_INFONAME_,AmbientInfos.x)\n#include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_MATRIXNAME_,opacity,_INFONAME_,OpacityInfos.x)\n#include(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_MATRIXNAME_,emissive,_INFONAME_,EmissiveInfos.x)\n#include(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_MATRIXNAME_,lightmap,_INFONAME_,LightmapInfos.x)\n#if defined(SPECULARTERM)\n#include(_DEFINENAME_,SPECULAR,_VARYINGNAME_,Specular,_MATRIXNAME_,specular,_INFONAME_,SpecularInfos.x)\n#endif\n#include(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump,_MATRIXNAME_,bump,_INFONAME_,BumpInfos.x)\n#include(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_MATRIXNAME_,decal,_INFONAME_,DecalInfos.x)\n#include\n#include\n#include\n#include[0..maxSimultaneousLights]\n#include\n#include\n#include\n#define CUSTOM_VERTEX_MAIN_END\n}\n";r.l.ShadersStore[o]||(r.l.ShadersStore[o]=a);var s={name:o,shader:a}},84955:(e,t,n)=>{n.d(t,{Hi:()=>u,hU:()=>c,sQ:()=>h});var r=n(78322),i=n(7164),o=n(41053),a=n(72597),s=null,l=null;function c(){return s||(s=new Uint8Array),s}function u(){return l||(l=new Float32Array),l}var h=function(e){function t(t){var n=e.call(this)||this;return n._fftSize=o.IR.fftSize,n._maxDecibels=o.IR.maxDecibels,n._minDecibels=o.IR.minDecibels,n._smoothing=o.IR.smoothing,n._subGraph=t,n}return(0,r.C6)(t,e),Object.defineProperty(t.prototype,"fftSize",{get:function(){return this._fftSize},set:function(e){this._fftSize=e,(0,a.Z7)(this._subGraph,"fftSize",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isEnabled",{get:function(){return null!==(0,a.CA)(this._subGraph)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minDecibels",{get:function(){return this._minDecibels},set:function(e){this._minDecibels=e,(0,a.Z7)(this._subGraph,"minDecibels",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxDecibels",{get:function(){return this._maxDecibels},set:function(e){this._maxDecibels=e,(0,a.Z7)(this._subGraph,"maxDecibels",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"smoothing",{get:function(){return this._smoothing},set:function(e){this._smoothing=e,(0,a.Z7)(this._subGraph,"smoothing",e)},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){var e=(0,a.CA)(this._subGraph);e&&(this._subGraph.removeSubNodeAsync(e),e.dispose())},t.prototype.enableAsync=function(){return(0,r.sH)(this,void 0,void 0,(function(){return(0,r.YH)(this,(function(e){switch(e.label){case 0:return(0,a.CA)(this._subGraph)?[3,2]:[4,this._subGraph.createAndAddSubNodeAsync("Analyzer")];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))},t.prototype.getByteFrequencyData=function(){var e=(0,a.CA)(this._subGraph);return e?e.getByteFrequencyData():(i.V.Warn("AudioAnalyzer not enabled"),this.enableAsync(),c())},t.prototype.getFloatFrequencyData=function(){var e=(0,a.CA)(this._subGraph);return e?e.getFloatFrequencyData():(i.V.Warn("AudioAnalyzer not enabled"),this.enableAsync(),u())},t}(o.zx)},85043:(e,t,n)=>{n.d(t,{U:()=>a});var r=n(53770),i=n(8046),o=n(81152),a=function(){function e(e,t,n,i,o){void 0===n&&(n=null),void 0===i&&(i=null),void 0===o&&(o=null),this.index=e,this._opaqueSubMeshes=new r.L(256),this._transparentSubMeshes=new r.L(256),this._alphaTestSubMeshes=new r.L(256),this._depthOnlySubMeshes=new r.L(256),this._particleSystems=new r.L(256),this._spriteManagers=new r.L(256),this._empty=!0,this._edgesRenderers=new r.b(16),this.disableDepthPrePass=!1,this._scene=t,this.opaqueSortCompareFn=n,this.alphaTestSortCompareFn=i,this.transparentSortCompareFn=o}return Object.defineProperty(e.prototype,"opaqueSortCompareFn",{set:function(t){this._opaqueSortCompareFn=t||e.PainterSortCompare,this._renderOpaque=this._renderOpaqueSorted},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alphaTestSortCompareFn",{set:function(t){this._alphaTestSortCompareFn=t||e.PainterSortCompare,this._renderAlphaTest=this._renderAlphaTestSorted},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transparentSortCompareFn",{set:function(t){this._transparentSortCompareFn=t||e.defaultTransparentSortCompare,this._renderTransparent=this._renderTransparentSorted},enumerable:!1,configurable:!0}),e.prototype.render=function(e,t,n,r){if(e)e(this._opaqueSubMeshes,this._alphaTestSubMeshes,this._transparentSubMeshes,this._depthOnlySubMeshes);else{var i=this._scene.getEngine();0!==this._depthOnlySubMeshes.length&&(i.setColorWrite(!1),this._renderAlphaTest(this._depthOnlySubMeshes),i.setColorWrite(!0)),0!==this._opaqueSubMeshes.length&&this._renderOpaque(this._opaqueSubMeshes),0!==this._alphaTestSubMeshes.length&&this._renderAlphaTest(this._alphaTestSubMeshes);var a=i.getStencilBuffer();if(i.setStencilBuffer(!1),t&&this._renderSprites(),n&&this._renderParticles(r),this.onBeforeTransparentRendering&&this.onBeforeTransparentRendering(),0!==this._transparentSubMeshes.length||this._scene.useOrderIndependentTransparency){if(i.setStencilBuffer(a),this._scene.useOrderIndependentTransparency){var s=this._scene.depthPeelingRenderer.render(this._transparentSubMeshes);s.length&&this._renderTransparent(s)}else this._renderTransparent(this._transparentSubMeshes);i.setAlphaMode(o.Y.ALPHA_DISABLE)}if(i.setStencilBuffer(!1),this._edgesRenderers.length){for(var l=0;ln._alphaIndex?1:t._alphaIndext._distanceToCamera?-1:0},e.frontToBackSortCompare=function(e,t){return e._distanceToCamerat._distanceToCamera?1:0},e.PainterSortCompare=function(e,t){var n=e.getMesh(),r=t.getMesh();return n.material&&r.material?n.material.uniqueId-r.material.uniqueId:n.uniqueId-r.uniqueId},e.prototype.prepare=function(){this._opaqueSubMeshes.reset(),this._transparentSubMeshes.reset(),this._alphaTestSubMeshes.reset(),this._depthOnlySubMeshes.reset(),this._particleSystems.reset(),this.prepareSprites(),this._edgesRenderers.reset(),this._empty=!0},e.prototype.prepareSprites=function(){this._spriteManagers.reset()},e.prototype.dispose=function(){this._opaqueSubMeshes.dispose(),this._transparentSubMeshes.dispose(),this._alphaTestSubMeshes.dispose(),this._depthOnlySubMeshes.dispose(),this._particleSystems.dispose(),this._spriteManagers.dispose(),this._edgesRenderers.dispose()},e.prototype.dispatch=function(e,t,n){void 0===t&&(t=e.getMesh()),void 0===n&&(n=e.getMaterial()),null!=n&&(n.needAlphaBlendingForMesh(t)?this._transparentSubMeshes.push(e):n.needAlphaTestingForMesh(t)?(n.needDepthPrePass&&!this.disableDepthPrePass&&this._depthOnlySubMeshes.push(e),this._alphaTestSubMeshes.push(e)):(n.needDepthPrePass&&!this.disableDepthPrePass&&this._depthOnlySubMeshes.push(e),this._opaqueSubMeshes.push(e)),t._renderingGroup=this,t._edgesRenderer&&t.isEnabled()&&t.isVisible&&t._edgesRenderer.isEnabled&&this._edgesRenderers.pushNoDuplicate(t._edgesRenderer),this._empty=!1)},e.prototype.dispatchSprites=function(e){this._spriteManagers.push(e),this._empty=!1},e.prototype.dispatchParticles=function(e){this._particleSystems.push(e),this._empty=!1},e.prototype._renderParticles=function(e){if(0!==this._particleSystems.length){var t=this._scene.activeCamera;this._scene.onBeforeParticlesRenderingObservable.notifyObservers(this._scene);for(var n=0;n{n.d(t,{B1:()=>j,Bb:()=>q,DL:()=>u.D,Dk:()=>f,ER:()=>O,G$:()=>K,GD:()=>X,IC:()=>V,IF:()=>_,J2:()=>x,Jz:()=>U,Kd:()=>R,L0:()=>C,MF:()=>m,N4:()=>H,Nc:()=>W,OR:()=>B,RL:()=>A,VO:()=>z,Wp:()=>S,X8:()=>b,Y7:()=>Y,YT:()=>T,Yy:()=>p,_8:()=>y,az:()=>F,c4:()=>M,f$:()=>P,fm:()=>N,kz:()=>L,lo:()=>w,mA:()=>E,nR:()=>v,ni:()=>I,qB:()=>k,qL:()=>D,te:()=>g,wu:()=>G});var r=n(7164),i=n(81152),o=n(66614),a=n(91946),s=n(34561),l=n(17900),c=n(50582),u=n(57170),h={r:0,g:0,b:0},d={NUM_MORPH_INFLUENCERS:0,NORMAL:!1,TANGENT:!1,UV:!1,UV2:!1,COLOR:!1};function p(e,t,n,r){void 0===r&&(r=!1),n&&e.fogEnabled&&(!t||t.applyFog)&&e.fogMode!==i.Y.FOGMODE_NONE&&(n.setFloat4("vFogInfos",e.fogMode,e.fogStart,e.fogEnd,e.fogDensity),r?(e.fogColor.toLinearSpaceToRef(h,e.getEngine().useExactSrgbConversions),n.setColor3("vFogColor",h)):n.setColor3("vFogColor",e.fogColor))}function f(e,t,n,r,i,o,a,s,l,c){var u=e.numMaxInfluencers||e.numInfluencers;return u<=0?0:(t.push("#define MORPHTARGETS"),e.hasPositions&&t.push("#define MORPHTARGETTEXTURE_HASPOSITIONS"),e.hasNormals&&t.push("#define MORPHTARGETTEXTURE_HASNORMALS"),e.hasTangents&&t.push("#define MORPHTARGETTEXTURE_HASTANGENTS"),e.hasUVs&&t.push("#define MORPHTARGETTEXTURE_HASUVS"),e.hasUV2s&&t.push("#define MORPHTARGETTEXTURE_HASUV2S"),e.hasColors&&t.push("#define MORPHTARGETTEXTURE_HASCOLORS"),e.supportsPositions&&i&&t.push("#define MORPHTARGETS_POSITION"),e.supportsNormals&&o&&t.push("#define MORPHTARGETS_NORMAL"),e.supportsTangents&&a&&t.push("#define MORPHTARGETS_TANGENT"),e.supportsUVs&&s&&t.push("#define MORPHTARGETS_UV"),e.supportsUV2s&&l&&t.push("#define MORPHTARGETS_UV2"),e.supportsColors&&c&&t.push("#define MORPHTARGETS_COLOR"),t.push("#define NUM_MORPH_INFLUENCERS "+u),e.isUsingTextureForTargets&&t.push("#define MORPHTARGETS_TEXTURE"),d.NUM_MORPH_INFLUENCERS=u,d.NORMAL=o,d.TANGENT=a,d.UV=s,d.UV2=l,d.COLOR=c,_(n,r,d,i),u)}function m(e,t,n){d.NUM_MORPH_INFLUENCERS=n,d.NORMAL=!1,d.TANGENT=!1,d.UV=!1,d.UV2=!1,d.COLOR=!1,_(e,t,d,!0)}function _(e,t,n,a){void 0===a&&(a=!0);var s=n.NUM_MORPH_INFLUENCERS;if(s>0&&o.q.LastCreatedEngine){var l=o.q.LastCreatedEngine.getCaps().maxVertexAttribs,c=t.morphTargetManager;if(null==c?void 0:c.isUsingTextureForTargets)return;for(var u=c&&c.supportsPositions&&a,h=c&&c.supportsNormals&&n.NORMAL,d=c&&c.supportsTangents&&n.TANGENT,p=c&&c.supportsUVs&&n.UV1,f=c&&c.supportsUV2s&&n.UV2,m=c&&c.supportsColors&&n.VERTEXCOLOR,_=0;_l&&r.V.Error("Cannot add more vertex attributes for mesh "+t.name)}}function g(e,t){void 0===t&&(t=!1),e.push("world0"),e.push("world1"),e.push("world2"),e.push("world3"),t&&(e.push("previousWorld0"),e.push("previousWorld1"),e.push("previousWorld2"),e.push("previousWorld3"))}function v(e,t){var n=e.morphTargetManager;e&&n&&t.setFloatArray("morphTargetInfluences",n.influences)}function y(e,t){t.bindToEffect(e,"Scene")}function b(e,t,n,r,i,o,a,s,c,u,h,d){if(void 0===i&&(i=null),void 0===o&&(o=!1),void 0===a&&(a=!1),void 0===s&&(s=!1),void 0===c&&(c=!1),void 0===u&&(u=!1),void 0===h&&(h=!1),void 0===d&&(d=0),e.texturesEnabled&&i&&l.h.ReflectionTextureEnabled){if(n.updateMatrix("reflectionMatrix",i.getReflectionTextureMatrix()),n.updateFloat2("vReflectionInfos",i.level*e.iblIntensity,d),s&&i.boundingBoxSize){var p=i;n.updateVector3("vReflectionPosition",p.boundingBoxPosition),n.updateVector3("vReflectionSize",p.boundingBoxSize)}if(o){var f=i.getSize().width;n.updateFloat2("vReflectionFilteringInfo",f,Math.log2(f))}if(u&&!t.USEIRRADIANCEMAP){var m=i.sphericalPolynomial;if(t.USESPHERICALFROMREFLECTIONMAP&&m)if(t.SPHERICAL_HARMONICS){var _=m.preScaledHarmonics;n.updateVector3("vSphericalL00",_.l00),n.updateVector3("vSphericalL1_1",_.l1_1),n.updateVector3("vSphericalL10",_.l10),n.updateVector3("vSphericalL11",_.l11),n.updateVector3("vSphericalL2_2",_.l2_2),n.updateVector3("vSphericalL2_1",_.l2_1),n.updateVector3("vSphericalL20",_.l20),n.updateVector3("vSphericalL21",_.l21),n.updateVector3("vSphericalL22",_.l22)}else n.updateFloat3("vSphericalX",m.x.x,m.x.y,m.x.z),n.updateFloat3("vSphericalY",m.y.x,m.y.y,m.y.z),n.updateFloat3("vSphericalZ",m.z.x,m.z.y,m.z.z),n.updateFloat3("vSphericalXX_ZZ",m.xx.x-m.zz.x,m.xx.y-m.zz.y,m.xx.z-m.zz.z),n.updateFloat3("vSphericalYY_ZZ",m.yy.x-m.zz.x,m.yy.y-m.zz.y,m.yy.z-m.zz.z),n.updateFloat3("vSphericalZZ",m.zz.x,m.zz.y,m.zz.z),n.updateFloat3("vSphericalXY",m.xy.x,m.xy.y,m.xy.z),n.updateFloat3("vSphericalYZ",m.yz.x,m.yz.y,m.yz.z),n.updateFloat3("vSphericalZX",m.zx.x,m.zx.y,m.zx.z)}else c&&t.USEIRRADIANCEMAP&&t.USE_IRRADIANCE_DOMINANT_DIRECTION&&n.updateVector3("vReflectionDominantDirection",i.irradianceTexture._dominantDirection);a&&n.updateFloat3("vReflectionMicrosurfaceInfos",i.getSize().width,i.lodGenerationScale,i.lodGenerationOffset)}h&&n.updateColor3("vReflectionColor",r)}function S(e,t,n,r,i){if(void 0===r&&(r=null),void 0===i&&(i=!1),r&&l.h.ReflectionTextureEnabled){t.LODBASEDMICROSFURACE?n.setTexture("reflectionSampler",r):(n.setTexture("reflectionSampler",r._lodTextureMid||r),n.setTexture("reflectionSamplerLow",r._lodTextureLow||r),n.setTexture("reflectionSamplerHigh",r._lodTextureHigh||r)),t.USEIRRADIANCEMAP&&n.setTexture("irradianceSampler",r.irradianceTexture);var o=e.iblCdfGenerator;i&&o&&n.setTexture("icdfSampler",o.getIcdfTexture())}}function T(e,t,n){t._needUVs=!0,t[n]=!0,e.optimizeUVAllocation&&e.getTextureMatrix().isIdentityAs3x2()?(t[n+"DIRECTUV"]=e.coordinatesIndex+1,t["MAINUV"+(e.coordinatesIndex+1)]=!0):t[n+"DIRECTUV"]=0}function E(e,t,n){var r=e.getTextureMatrix();t.updateMatrix(n+"Matrix",r)}function x(e,t,n){n.BAKED_VERTEX_ANIMATION_TEXTURE&&n.INSTANCES&&e.push("bakedVertexAnimationSettingsInstanced")}function P(e,t,n){var r;if(t&&e&&(e.computeBonesUsingShaders&&t._bonesComputationForcedToCPU&&(e.computeBonesUsingShaders=!1),e.useBones&&e.computeBonesUsingShaders&&e.skeleton)){var o=e.skeleton;if(o.isUsingTextureForMatrices&&t.getUniformIndex("boneTextureWidth")>-1){var a=o.getTransformMatrixTexture(e);t.setTexture("boneSampler",a),t.setFloat("boneTextureWidth",4*(o.bones.length+1))}else{var s=o.getTransformMatrices(e);s&&(t.setMatrices("mBones",s),n&&e.getScene().prePassRenderer&&e.getScene().prePassRenderer.getIndex(i.Y.PREPASS_VELOCITY_TEXTURE_TYPE)&&(n.previousBones[e.uniqueId]||(n.previousBones[e.uniqueId]=s.slice()),t.setMatrices("mPreviousBones",n.previousBones[e.uniqueId]),r=s,n.previousBones[e.uniqueId].set(r)))}}}function C(e,t,n){e.transferToEffect(t,n+"")}function R(e,t,n,r,i,o){void 0===o&&(o=!0),e._bindLight(t,n,r,i,o)}function A(e,t,n,r,i){void 0===i&&(i=4);for(var o=Math.min(t.lightSources.length,i),a=0;a0&&(r.addCPUSkinningFallback(0,t),e.push(i.Y.MatricesIndicesKind),e.push(i.Y.MatricesWeightsKind),n.NUM_BONE_INFLUENCERS>4&&(e.push(i.Y.MatricesIndicesExtraKind),e.push(i.Y.MatricesWeightsExtraKind)))}function O(e,t){(t.INSTANCES||t.THIN_INSTANCES)&&g(e,!!t.PREPASS_VELOCITY),t.INSTANCESCOLOR&&e.push(i.Y.ColorInstanceKind)}function M(e,t,n,r){void 0===n&&(n=4),void 0===r&&(r=0);for(var i=0,o=0;o0&&(i=r+o,t.addFallback(i,"LIGHT"+o)),e.SHADOWS||(e["SHADOW"+o]&&t.addFallback(r,"SHADOW"+o),e["SHADOWPCF"+o]&&t.addFallback(r,"SHADOWPCF"+o),e["SHADOWPCSS"+o]&&t.addFallback(r,"SHADOWPCSS"+o),e["SHADOWPOISSON"+o]&&t.addFallback(r,"SHADOWPOISSON"+o),e["SHADOWESM"+o]&&t.addFallback(r,"SHADOWESM"+o),e["SHADOWCLOSEESM"+o]&&t.addFallback(r,"SHADOWCLOSEESM"+o));return i++}function D(e,t){return t.fogEnabled&&e.applyFog&&t.fogMode!==i.Y.FOGMODE_NONE}function N(e,t,n,r,i,o,a,s,l,c,u){var h;if(void 0===s&&(s=!1),void 0===l&&(l=!1),a._areMiscDirty){a.LOGARITHMICDEPTH=n,a.POINTSIZE=r,a.FOG=i&&D(e,t),a.NONUNIFORMSCALING=e.nonUniformScaling,a.ALPHATEST=o,a.DECAL_AFTER_DETAIL=s,a.USE_VERTEX_PULLING=l;var d=null===(h=null==c?void 0:c.geometry)||void 0===h?void 0:h.getIndexBuffer();a.VERTEX_PULLING_USE_INDEX_BUFFER=!!d,a.VERTEX_PULLING_INDEX_BUFFER_32BITS=!!d&&d.is32Bits,a.VERTEXOUTPUT_INVARIANT=!!u}}function F(e,t,n,r,i,o){if(void 0===i&&(i=4),void 0===o&&(o=!1),!n._areLightsDirty)return n._needNormals;var a=0,s={needNormals:n._needNormals,needRebuild:!1,lightmapMode:!1,shadowEnabled:!1,specularEnabled:!1};if(e.lightsEnabled&&!o)for(var l=0,c=t.lightSources;l0?(n.NUM_SAMPLES=""+o,s._features.needTypeSuffixInShaderConstants&&(n.NUM_SAMPLES=n.NUM_SAMPLES+"u"),n.REALTIME_FILTERING=!0,e.iblCdfGenerator&&(n.IBL_CDF_FILTERING=!0)):n.REALTIME_FILTERING=!1,n.INVERTCUBICMAP=t.coordinatesMode===c.g.INVCUBIC_MODE,n.REFLECTIONMAP_3D=t.isCube,n.REFLECTIONMAP_OPPOSITEZ=n.REFLECTIONMAP_3D&&e.useRightHandedSystem?!t.invertZ:t.invertZ,n.REFLECTIONMAP_CUBIC=!1,n.REFLECTIONMAP_EXPLICIT=!1,n.REFLECTIONMAP_PLANAR=!1,n.REFLECTIONMAP_PROJECTION=!1,n.REFLECTIONMAP_SKYBOX=!1,n.REFLECTIONMAP_SPHERICAL=!1,n.REFLECTIONMAP_EQUIRECTANGULAR=!1,n.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,n.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,t.coordinatesMode){case c.g.EXPLICIT_MODE:n.REFLECTIONMAP_EXPLICIT=!0;break;case c.g.PLANAR_MODE:n.REFLECTIONMAP_PLANAR=!0;break;case c.g.PROJECTION_MODE:n.REFLECTIONMAP_PROJECTION=!0;break;case c.g.SKYBOX_MODE:n.REFLECTIONMAP_SKYBOX=!0;break;case c.g.SPHERICAL_MODE:n.REFLECTIONMAP_SPHERICAL=!0;break;case c.g.EQUIRECTANGULAR_MODE:n.REFLECTIONMAP_EQUIRECTANGULAR=!0;break;case c.g.FIXED_EQUIRECTANGULAR_MODE:n.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!0;break;case c.g.FIXED_EQUIRECTANGULAR_MIRRORED_MODE:n.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!0;break;case c.g.CUBIC_MODE:case c.g.INVCUBIC_MODE:default:n.REFLECTIONMAP_CUBIC=!0,n.USE_LOCAL_REFLECTIONMAP_CUBIC=!!t.boundingBoxSize}t.coordinatesMode!==c.g.SKYBOX_MODE&&(t.irradianceTexture?(n.USEIRRADIANCEMAP=!0,n.USESPHERICALFROMREFLECTIONMAP=!1,n.USESPHERICALINVERTEX=!1,t.irradianceTexture._dominantDirection&&(n.USE_IRRADIANCE_DOMINANT_DIRECTION=!0)):t.isCube&&(n.USESPHERICALFROMREFLECTIONMAP=!0,n.USEIRRADIANCEMAP=!1,n.USE_IRRADIANCE_DOMINANT_DIRECTION=!1,n.USESPHERICALINVERTEX=a))}else n.REFLECTION=!1,n.REFLECTIONMAP_3D=!1,n.REFLECTIONMAP_SPHERICAL=!1,n.REFLECTIONMAP_PLANAR=!1,n.REFLECTIONMAP_CUBIC=!1,n.USE_LOCAL_REFLECTIONMAP_CUBIC=!1,n.REFLECTIONMAP_PROJECTION=!1,n.REFLECTIONMAP_SKYBOX=!1,n.REFLECTIONMAP_EXPLICIT=!1,n.REFLECTIONMAP_EQUIRECTANGULAR=!1,n.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,n.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,n.INVERTCUBICMAP=!1,n.USESPHERICALFROMREFLECTIONMAP=!1,n.USEIRRADIANCEMAP=!1,n.USE_IRRADIANCE_DOMINANT_DIRECTION=!1,n.USESPHERICALINVERTEX=!1,n.REFLECTIONMAP_OPPOSITEZ=!1,n.LODINREFLECTIONALPHA=!1,n.GAMMAREFLECTION=!1,n.RGBDREFLECTION=!1,n.LINEARSPECULARREFLECTION=!1;return!0}function w(e,t,n,r,i,o,s){var l;switch(s.needNormals=!0,void 0===i["LIGHT"+r]&&(s.needRebuild=!0),i["LIGHT"+r]=!0,i["SPOTLIGHT"+r]=!1,i["HEMILIGHT"+r]=!1,i["POINTLIGHT"+r]=!1,i["DIRLIGHT"+r]=!1,i["AREALIGHT"+r]=!1,i["CLUSTLIGHT"+r]=!1,n.prepareLightSpecificDefines(i,r),i["LIGHT_FALLOFF_PHYSICAL"+r]=!1,i["LIGHT_FALLOFF_GLTF"+r]=!1,i["LIGHT_FALLOFF_STANDARD"+r]=!1,n.falloffType){case a.c.FALLOFF_GLTF:i["LIGHT_FALLOFF_GLTF"+r]=!0;break;case a.c.FALLOFF_PHYSICAL:i["LIGHT_FALLOFF_PHYSICAL"+r]=!0;break;case a.c.FALLOFF_STANDARD:i["LIGHT_FALLOFF_STANDARD"+r]=!0}if(o&&!n.specular.equalsFloats(0,0,0)&&(s.specularEnabled=!0),i["SHADOW"+r]=!1,i["SHADOWCSM"+r]=!1,i["SHADOWCSMDEBUG"+r]=!1,i["SHADOWCSMNUM_CASCADES"+r]=!1,i["SHADOWCSMUSESHADOWMAXZ"+r]=!1,i["SHADOWCSMNOBLEND"+r]=!1,i["SHADOWCSM_RIGHTHANDED"+r]=!1,i["SHADOWPCF"+r]=!1,i["SHADOWPCSS"+r]=!1,i["SHADOWPOISSON"+r]=!1,i["SHADOWESM"+r]=!1,i["SHADOWCLOSEESM"+r]=!1,i["SHADOWCUBE"+r]=!1,i["SHADOWLOWQUALITY"+r]=!1,i["SHADOWMEDIUMQUALITY"+r]=!1,t&&t.receiveShadows&&e.shadowsEnabled&&n.shadowEnabled){var c=null!==(l=n.getShadowGenerator(e.activeCamera))&&void 0!==l?l:n.getShadowGenerator();if(c){var u=c.getShadowMap();u&&u.renderList&&u.renderList.length>0&&(s.shadowEnabled=!0,c.prepareDefines(i,r))}}n.lightmapMode!=a.c.LIGHTMAP_DEFAULT?(s.lightmapMode=!0,i["LIGHTMAPEXCLUDED"+r]=!0,i["LIGHTMAPNOSPECULAR"+r]=n.lightmapMode==a.c.LIGHTMAP_SHADOWSONLY):(i["LIGHTMAPEXCLUDED"+r]=!1,i["LIGHTMAPNOSPECULAR"+r]=!1)}function B(e,t,n,r,i,o,a){void 0===o&&(o=null),void 0===a&&(a=!1);var l=Y(e,r);!1!==o&&(l=(0,s.e3)(n,e,r)),r.DEPTHPREPASS!==!t.getColorWrite()&&(r.DEPTHPREPASS=!r.DEPTHPREPASS,l=!0),r.INSTANCES!==i&&(r.INSTANCES=i,l=!0),r.THIN_INSTANCES!==a&&(r.THIN_INSTANCES=a,l=!0),l&&r.markAsUnprocessed()}function V(e,t){if(e.useBones&&e.computeBonesUsingShaders&&e.skeleton){t.NUM_BONE_INFLUENCERS=e.numBoneInfluencers;var n=void 0!==t.BONETEXTURE;if(e.skeleton.isUsingTextureForMatrices&&n)t.BONETEXTURE=!0;else{t.BonesPerMesh=e.skeleton.bones.length+1,t.BONETEXTURE=!n&&void 0;var r=e.getScene().prePassRenderer;if(r&&r.enabled){var i=-1===r.excludedSkinnedMesh.indexOf(e);t.BONES_VELOCITY_ENABLED=i}}}else t.NUM_BONE_INFLUENCERS=0,t.BonesPerMesh=0,void 0!==t.BONETEXTURE&&(t.BONETEXTURE=!1)}function U(e,t){var n=e.morphTargetManager;n?(t.MORPHTARGETS_UV=n.supportsUVs&&t.UV1,t.MORPHTARGETS_UV2=n.supportsUV2s&&t.UV2,t.MORPHTARGETS_TANGENT=n.supportsTangents&&t.TANGENT,t.MORPHTARGETS_NORMAL=n.supportsNormals&&t.NORMAL,t.MORPHTARGETS_POSITION=n.supportsPositions,t.MORPHTARGETS_COLOR=n.supportsColors,t.MORPHTARGETTEXTURE_HASUVS=n.hasUVs,t.MORPHTARGETTEXTURE_HASUV2S=n.hasUV2s,t.MORPHTARGETTEXTURE_HASTANGENTS=n.hasTangents,t.MORPHTARGETTEXTURE_HASNORMALS=n.hasNormals,t.MORPHTARGETTEXTURE_HASPOSITIONS=n.hasPositions,t.MORPHTARGETTEXTURE_HASCOLORS=n.hasColors,t.NUM_MORPH_INFLUENCERS=n.numMaxInfluencers||n.numInfluencers,t.MORPHTARGETS=t.NUM_MORPH_INFLUENCERS>0,t.MORPHTARGETS_TEXTURE=n.isUsingTextureForTargets):(t.MORPHTARGETS_UV=!1,t.MORPHTARGETS_UV2=!1,t.MORPHTARGETS_TANGENT=!1,t.MORPHTARGETS_NORMAL=!1,t.MORPHTARGETS_POSITION=!1,t.MORPHTARGETS_COLOR=!1,t.MORPHTARGETTEXTURE_HASUVS=!1,t.MORPHTARGETTEXTURE_HASUV2S=!1,t.MORPHTARGETTEXTURE_HASTANGENTS=!1,t.MORPHTARGETTEXTURE_HASNORMALS=!1,t.MORPHTARGETTEXTURE_HASPOSITIONS=!1,t.MORPHTARGETTEXTURE_HAS_COLORS=!1,t.MORPHTARGETS=!1,t.NUM_MORPH_INFLUENCERS=0)}function G(e,t){var n=e.bakedVertexAnimationManager;t.BAKED_VERTEX_ANIMATION_TEXTURE=!(!n||!n.isEnabled)}function k(e,t,n,r,o,a,s){if(void 0===o&&(o=!1),void 0===a&&(a=!0),void 0===s&&(s=!0),!t._areAttributesDirty&&t._needNormals===t._normals&&t._needUVs===t._uvs)return!1;t._normals=t._needNormals,t._uvs=t._needUVs,t.NORMAL=t._needNormals&&e.isVerticesDataPresent(i.Y.NormalKind),t._needNormals&&e.isVerticesDataPresent(i.Y.TangentKind)&&(t.TANGENT=!0);for(var l=1;l<=i.Y.MAX_SUPPORTED_UV_SETS;++l)t["UV"+l]=!!t._needUVs&&e.isVerticesDataPresent("uv".concat(1===l?"":l));if(n){var c=e.useVertexColors&&e.isVerticesDataPresent(i.Y.ColorKind);t.VERTEXCOLOR=c,t.VERTEXALPHA=e.hasVertexAlpha&&c&&a}return e.isVerticesDataPresent(i.Y.ColorInstanceKind)&&(e.hasInstances||e.hasThinInstances)&&(t.INSTANCESCOLOR=!0),r&&V(e,t),o&&U(e,t),s&&G(e,t),!0}function z(e,t){if(e.activeCamera){var n=t.MULTIVIEW;t.MULTIVIEW=null!==e.activeCamera.outputRenderTarget&&e.activeCamera.outputRenderTarget.getViewCount()>1,t.MULTIVIEW!=n&&t.markAsUnprocessed()}}function W(e,t,n){var r=t.ORDER_INDEPENDENT_TRANSPARENCY,i=t.ORDER_INDEPENDENT_TRANSPARENCY_16BITS;t.ORDER_INDEPENDENT_TRANSPARENCY=e.useOrderIndependentTransparency&&n,t.ORDER_INDEPENDENT_TRANSPARENCY_16BITS=!e.getEngine().getCaps().textureFloatLinearFiltering,r===t.ORDER_INDEPENDENT_TRANSPARENCY&&i===t.ORDER_INDEPENDENT_TRANSPARENCY_16BITS||t.markAsUnprocessed()}function H(e,t,n){var r=t.PREPASS;if(t._arePrePassDirty){var o=[{type:i.Y.PREPASS_POSITION_TEXTURE_TYPE,define:"PREPASS_POSITION",index:"PREPASS_POSITION_INDEX"},{type:i.Y.PREPASS_LOCAL_POSITION_TEXTURE_TYPE,define:"PREPASS_LOCAL_POSITION",index:"PREPASS_LOCAL_POSITION_INDEX"},{type:i.Y.PREPASS_VELOCITY_TEXTURE_TYPE,define:"PREPASS_VELOCITY",index:"PREPASS_VELOCITY_INDEX"},{type:i.Y.PREPASS_VELOCITY_LINEAR_TEXTURE_TYPE,define:"PREPASS_VELOCITY_LINEAR",index:"PREPASS_VELOCITY_LINEAR_INDEX"},{type:i.Y.PREPASS_REFLECTIVITY_TEXTURE_TYPE,define:"PREPASS_REFLECTIVITY",index:"PREPASS_REFLECTIVITY_INDEX"},{type:i.Y.PREPASS_IRRADIANCE_TEXTURE_TYPE,define:"PREPASS_IRRADIANCE",index:"PREPASS_IRRADIANCE_INDEX"},{type:i.Y.PREPASS_ALBEDO_SQRT_TEXTURE_TYPE,define:"PREPASS_ALBEDO_SQRT",index:"PREPASS_ALBEDO_SQRT_INDEX"},{type:i.Y.PREPASS_DEPTH_TEXTURE_TYPE,define:"PREPASS_DEPTH",index:"PREPASS_DEPTH_INDEX"},{type:i.Y.PREPASS_SCREENSPACE_DEPTH_TEXTURE_TYPE,define:"PREPASS_SCREENSPACE_DEPTH",index:"PREPASS_SCREENSPACE_DEPTH_INDEX"},{type:i.Y.PREPASS_NORMAL_TEXTURE_TYPE,define:"PREPASS_NORMAL",index:"PREPASS_NORMAL_INDEX"},{type:i.Y.PREPASS_WORLD_NORMAL_TEXTURE_TYPE,define:"PREPASS_WORLD_NORMAL",index:"PREPASS_WORLD_NORMAL_INDEX"}];if(e.prePassRenderer&&e.prePassRenderer.enabled&&n){t.PREPASS=!0,t.SCENE_MRT_COUNT=e.prePassRenderer.mrtCount,t.PREPASS_NORMAL_WORLDSPACE=e.prePassRenderer.generateNormalsInWorldSpace,t.PREPASS_COLOR=!0,t.PREPASS_COLOR_INDEX=0;for(var a=0;a{n.d(t,{Q:()=>v});var r=n(78322),i=n(9151),o=n(75647),a=n(99157),s=n(27063),l=n(15579),c=n(8046),u=n(9918),h=c.uq.Zero(),d=new c.PT,p=c.Pq.Zero();function f(e){return e*Math.PI/180}function m(e){return 180*e/Math.PI}var _=function(e){function t(t){var n=e.call(this,t)||this;return n._lastPosition=c.Pq.Zero(),n._lastRotation=c.Pq.Zero(),n._lastRotationQuaternion=new c.PT,n.position=s.Qc.position.clone(),n.rotation=s.Qc.rotation.clone(),n.rotationQuaternion=s.Qc.rotationQuaternion.clone(),n.node=new PannerNode(t._audioContext),n._orientationX=new u.k(t,n.node.orientationX),n._orientationY=new u.k(t,n.node.orientationY),n._orientationZ=new u.k(t,n.node.orientationZ),n._positionX=new u.k(t,n.node.positionX),n._positionY=new u.k(t,n.node.positionY),n._positionZ=new u.k(t,n.node.positionZ),n}return(0,r.C6)(t,e),t.prototype.dispose=function(){e.prototype.dispose.call(this),this._orientationX.dispose(),this._orientationY.dispose(),this._orientationZ.dispose(),this._positionX.dispose(),this._positionY.dispose(),this._positionZ.dispose(),this.node.disconnect()},Object.defineProperty(t.prototype,"coneInnerAngle",{get:function(){return f(this.node.coneInnerAngle)},set:function(e){this.node.coneInnerAngle=m(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"coneOuterAngle",{get:function(){return f(this.node.coneOuterAngle)},set:function(e){this.node.coneOuterAngle=m(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"coneOuterVolume",{get:function(){return this.node.coneOuterGain},set:function(e){this.node.coneOuterGain=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"distanceModel",{get:function(){return this.node.distanceModel},set:function(e){this.node.distanceModel=e;var t=this.node.maxDistance;this.node.maxDistance=t+.001,this.node.maxDistance=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minDistance",{get:function(){return this.node.refDistance},set:function(e){this.node.refDistance=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxDistance",{get:function(){return this.node.maxDistance},set:function(e){this.node.maxDistance=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"panningModel",{get:function(){return this.node.panningModel},set:function(e){this.node.panningModel=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rolloffFactor",{get:function(){return this.node.rolloffFactor},set:function(e){this.node.rolloffFactor=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_inNode",{get:function(){return this.node},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_outNode",{get:function(){return this.node},enumerable:!1,configurable:!0}),t.prototype._updatePosition=function(){this._lastPosition.equalsWithEpsilon(this.position)||this.isAttached&&(this._positionX.isRamping||this._positionY.isRamping||this._positionZ.isRamping)||(this._positionX.targetValue=this.position.x,this._positionY.targetValue=this.position.y,this._positionZ.targetValue=this.position.z,this._lastPosition.copyFrom(this.position))},t.prototype._updateRotation=function(){if(!this.isAttached||!(this._orientationX.isRamping||this._orientationY.isRamping||this._orientationZ.isRamping)){if(this._lastRotationQuaternion.equalsWithEpsilon(this.rotationQuaternion)){if(this._lastRotation.equalsWithEpsilon(this.rotation))return;c.PT.FromEulerAnglesToRef(this.rotation.x,this.rotation.y,this.rotation.z,d),this._lastRotation.copyFrom(this.rotation)}else d.copyFrom(this.rotationQuaternion),this._lastRotationQuaternion.copyFrom(this.rotationQuaternion);c.uq.FromQuaternionToRef(d,h),c.Pq.TransformNormalToRef(c.Pq.RightReadOnly,h,p),this._orientationX.targetValue=p.x,this._orientationY.targetValue=p.y,this._orientationZ.targetValue=p.z}},t.prototype._connect=function(t){return!!e.prototype._connect.call(this,t)&&(t._inNode&&this.node.connect(t._inNode),!0)},t.prototype._disconnect=function(t){return!!e.prototype._disconnect.call(this,t)&&(t._inNode&&this.node.disconnect(t._inNode),!0)},t.prototype.getClassName=function(){return"_SpatialWebAudioSubNode"},t}(i.Au),g=function(e){function t(t){var n=e.call(this,t)||this;return n.node=new StereoPannerNode(t._audioContext),n._pan=new u.k(t,n.node.pan),n}return(0,r.C6)(t,e),t.prototype.dispose=function(){e.prototype.dispose.call(this),this._pan.dispose()},Object.defineProperty(t.prototype,"pan",{get:function(){return this._pan.targetValue},set:function(e){this._pan.targetValue=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_inNode",{get:function(){return this.node},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_outNode",{get:function(){return this.node},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"_StereoWebAudioSubNode"},t.prototype._connect=function(t){return!!e.prototype._connect.call(this,t)&&(t._inNode&&this.node.connect(t._inNode),!0)},t.prototype._disconnect=function(t){return!!e.prototype._disconnect.call(this,t)&&(t._inNode&&this.node.disconnect(t._inNode),!0)},t}(o.a7),v=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._rootNode=null,t._inputNode=null,t}return(0,r.C6)(t,e),t.prototype.initAsync=function(t){return(0,r.sH)(this,void 0,void 0,(function(){var n,a,c,u;return(0,r.YH)(this,(function(r){switch(r.label){case 0:return[4,e.prototype.initAsync.call(this,t)];case 1:return r.sent(),n=!1,a=!1,(n=(0,s.GB)(t))?[4,this.createAndAddSubNodeAsync("Spatial")]:[3,3];case 2:r.sent(),r.label=3;case 3:return(a=(0,l.uD)(t))?[4,this.createAndAddSubNodeAsync("Stereo")]:[3,5];case 4:r.sent(),r.label=5;case 5:return[4,this._createSubNodePromisesResolvedAsync()];case 6:return r.sent(),n&&(null===(c=(0,i.y5)(this))||void 0===c||c.setOptions(t)),a&&(null===(u=(0,o.KJ)(this))||void 0===u||u.setOptions(t)),[2]}}))}))},Object.defineProperty(t.prototype,"_inNode",{get:function(){return this._inputNode},enumerable:!1,configurable:!0}),t.prototype._createSubNode=function(t){try{return e.prototype._createSubNode.call(this,t)}catch(e){}switch(t){case"Spatial":return function(e){return(0,r.sH)(this,void 0,void 0,(function(){return(0,r.YH)(this,(function(t){return[2,new _(e)]}))}))}(this._owner.engine);case"Stereo":return function(e){return(0,r.sH)(this,void 0,void 0,(function(){return(0,r.YH)(this,(function(t){return[2,new g(e)]}))}))}(this._owner.engine);default:throw new Error("Unknown subnode name: ".concat(t))}},t.prototype._onSubNodesChanged=function(){var t,n,r,s;e.prototype._onSubNodesChanged.call(this);var l=(0,i.y5)(this),c=(0,o.KJ)(this),u=(0,a.sf)(this);if(l&&"_SpatialWebAudioSubNode"!==l.getClassName())throw new Error("Not a WebAudio subnode.");if(c&&"_StereoWebAudioSubNode"!==c.getClassName())throw new Error("Not a WebAudio subnode.");if(u&&"_VolumeWebAudioSubNode"!==u.getClassName())throw new Error("Not a WebAudio subnode.");l&&(l.disconnectAll(),u&&l.connect(u)),c&&(c.disconnectAll(),u&&c.connect(u)),l&&c?(this._rootNode=new GainNode(this._owner.engine._audioContext),this._rootNode.connect(l._outNode),this._rootNode.connect(c._outNode)):(null===(t=this._rootNode)||void 0===t||t.disconnect(),this._rootNode=null);var h=null,d=null;if(this._rootNode?d=this._rootNode:(l?h=l:c?h=c:u&&(h=u),d=null!==(n=null==h?void 0:h.node)&&void 0!==n?n:null),this._inputNode!==d){if(this._inputNode&&this._upstreamNodes)for(var p=this._upstreamNodes.values(),f=p.next();!f.done;f=p.next())null===(r=f.value._outNode)||void 0===r||r.disconnect(this._inputNode);if(this._inputNode=d,d&&this._upstreamNodes){var m=this._upstreamNodes.values();for(f=m.next();!f.done;f=m.next())null===(s=f.value._outNode)||void 0===s||s.connect(d)}}},t}(n(50016).H)},85203:(e,t,n)=>{n.r(t),n.d(t,{_WebAudioBus:()=>c});var r=n(78322),i=n(9691),o=n(27063),a=n(82145),s=n(85182),l=n(63982),c=function(e){function t(n,r,i){var o=e.call(this,n,r)||this;return o._spatial=null,o._spatialAutoUpdate=!0,o._spatialMinUpdateTime=0,o._stereo=null,"boolean"==typeof i.spatialAutoUpdate&&(o._spatialAutoUpdate=i.spatialAutoUpdate),"number"==typeof i.spatialMinUpdateTime&&(o._spatialMinUpdateTime=i.spatialMinUpdateTime),o._subGraph=new t._SubGraph(o),o}return(0,r.C6)(t,e),t.prototype._initAsync=function(e){return(0,r.sH)(this,void 0,void 0,(function(){return(0,r.YH)(this,(function(t){switch(t.label){case 0:return e.outBus?(this.outBus=e.outBus,[3,3]):[3,1];case 1:return[4,this.engine.isReadyPromise];case 2:t.sent(),this.outBus=this.engine.defaultMainBus,t.label=3;case 3:return[4,this._subGraph.initAsync(e)];case 4:return t.sent(),(0,o.GB)(e)&&this._initSpatialProperty(),this.engine._addNode(this),[2]}}))}))},t.prototype.dispose=function(){e.prototype.dispose.call(this),this._spatial=null,this._stereo=null,this.engine._removeNode(this)},Object.defineProperty(t.prototype,"_inNode",{get:function(){return this._subGraph._inNode},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_outNode",{get:function(){return this._subGraph._outNode},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"spatial",{get:function(){return this._spatial?this._spatial:this._initSpatialProperty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stereo",{get:function(){var e;return null!==(e=this._stereo)&&void 0!==e?e:this._stereo=new a.i(this._subGraph)},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"_WebAudioBus"},t.prototype._connect=function(t){var n;return!!e.prototype._connect.call(this,t)&&(t._inNode&&(null===(n=this._outNode)||void 0===n||n.connect(t._inNode)),!0)},t.prototype._disconnect=function(t){var n;return!!e.prototype._disconnect.call(this,t)&&(t._inNode&&(null===(n=this._outNode)||void 0===n||n.disconnect(t._inNode)),!0)},t.prototype._initSpatialProperty=function(){return this._spatial||(this._spatial=new l.i(this._subGraph,this._spatialAutoUpdate,this._spatialMinUpdateTime)),this._spatial},t._SubGraph=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,r.C6)(t,e),Object.defineProperty(t.prototype,"_downstreamNodes",{get:function(){var e;return null!==(e=this._owner._downstreamNodes)&&void 0!==e?e:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_upstreamNodes",{get:function(){var e;return null!==(e=this._owner._upstreamNodes)&&void 0!==e?e:null},enumerable:!1,configurable:!0}),t}(s.Q),t}(i.l)},85258:(e,t,n)=>{n.d(t,{j:()=>i});var r=n(5153),i=function(){function e(){}return Object.defineProperty(e,"Now",{get:function(){return(0,r.BA)()&&window.performance&&window.performance.now?window.performance.now():Date.now()},enumerable:!1,configurable:!0}),e}()},85368:(e,t,n)=>{n.r(t),n.d(t,{FlowGraphDeterminantBlock:()=>h,FlowGraphInvertMatrixBlock:()=>d,FlowGraphMatrixComposeBlock:()=>m,FlowGraphMatrixDecomposeBlock:()=>f,FlowGraphMatrixMultiplicationBlock:()=>p,FlowGraphTransposeBlock:()=>u});var r=n(78322),i=n(45749),o=n(88099),a=n(8046),s=n(34623),l=n(23101),c=n(20201),u=function(e){function t(t){return e.call(this,(0,o.Yd)((null==t?void 0:t.matrixType)||"Matrix"),(0,o.Yd)((null==t?void 0:t.matrixType)||"Matrix"),(function(e){return e.transpose?e.transpose():a.uq.Transpose(e)}),"FlowGraphTransposeBlock",t)||this}return(0,r.C6)(t,e),t}(l.a);(0,s.Y5)("FlowGraphTransposeBlock",u);var h=function(e){function t(t){return e.call(this,(0,o.Yd)((null==t?void 0:t.matrixType)||"Matrix"),o.Es,(function(e){return e.determinant()}),"FlowGraphDeterminantBlock",t)||this}return(0,r.C6)(t,e),t}(l.a);(0,s.Y5)("FlowGraphDeterminantBlock",h);var d=function(e){function t(t){return e.call(this,(0,o.Yd)((null==t?void 0:t.matrixType)||"Matrix"),(0,o.Yd)((null==t?void 0:t.matrixType)||"Matrix"),(function(e){return e.inverse?e.inverse():a.uq.Invert(e)}),"FlowGraphInvertMatrixBlock",t)||this}return(0,r.C6)(t,e),t}(l.a);(0,s.Y5)("FlowGraphInvertMatrixBlock",d);var p=function(e){function t(t){return e.call(this,(0,o.Yd)((null==t?void 0:t.matrixType)||"Matrix"),(0,o.Yd)((null==t?void 0:t.matrixType)||"Matrix"),(0,o.Yd)((null==t?void 0:t.matrixType)||"Matrix"),(function(e,t){return t.multiply(e)}),"FlowGraphMatrixMultiplicationBlock",t)||this}return(0,r.C6)(t,e),t}(c.W);(0,s.Y5)("FlowGraphMatrixMultiplicationBlock",p);var f=function(e){function t(t){var n=e.call(this,t)||this;return n.input=n.registerDataInput("input",o.Sp),n.position=n.registerDataOutput("position",o.Dx),n.rotationQuaternion=n.registerDataOutput("rotationQuaternion",o.P_),n.scaling=n.registerDataOutput("scaling",o.Dx),n.isValid=n.registerDataOutput("isValid",o.RI,!1),n}return(0,r.C6)(t,e),t.prototype._updateOutputs=function(e){var t=e._getExecutionVariable(this,"executionId",-1),n=e._getExecutionVariable(this,"cachedPosition",null),r=e._getExecutionVariable(this,"cachedRotation",null),i=e._getExecutionVariable(this,"cachedScaling",null);if(t===e.executionId&&n&&r&&i)this.position.setValue(n,e),this.rotationQuaternion.setValue(r,e),this.scaling.setValue(i,e);else{var o=this.input.getValue(e),s=n||new a.Pq,l=r||new a.PT,c=i||new a.Pq,u=Math.round(1e4*o.m[3])/1e4,h=Math.round(1e4*o.m[7])/1e4,d=Math.round(1e4*o.m[11])/1e4,p=Math.round(1e4*o.m[15])/1e4;if(0!==u||0!==h||0!==d||1!==p)return this.isValid.setValue(!1,e),this.position.setValue(a.Pq.Zero(),e),this.rotationQuaternion.setValue(a.PT.Identity(),e),void this.scaling.setValue(a.Pq.One(),e);var f=o.decompose(c,l,s);this.isValid.setValue(f,e),this.position.setValue(s,e),this.rotationQuaternion.setValue(l,e),this.scaling.setValue(c,e),e._setExecutionVariable(this,"cachedPosition",s),e._setExecutionVariable(this,"cachedRotation",l),e._setExecutionVariable(this,"cachedScaling",c),e._setExecutionVariable(this,"executionId",e.executionId)}},t.prototype.getClassName=function(){return"FlowGraphMatrixDecompose"},t}(i.e);(0,s.Y5)("FlowGraphMatrixDecompose",f);var m=function(e){function t(t){var n=e.call(this,t)||this;return n.position=n.registerDataInput("position",o.Dx),n.rotationQuaternion=n.registerDataInput("rotationQuaternion",o.P_),n.scaling=n.registerDataInput("scaling",o.Dx),n.value=n.registerDataOutput("value",o.Sp),n}return(0,r.C6)(t,e),t.prototype._updateOutputs=function(e){var t=e._getExecutionVariable(this,"executionId",-1),n=e._getExecutionVariable(this,"cachedMatrix",null);if(t===e.executionId&&n)this.value.setValue(n,e);else{var r=a.uq.Compose(this.scaling.getValue(e),this.rotationQuaternion.getValue(e),this.position.getValue(e));this.value.setValue(r,e),e._setExecutionVariable(this,"cachedMatrix",r),e._setExecutionVariable(this,"executionId",e.executionId)}},t.prototype.getClassName=function(){return"FlowGraphMatrixCompose"},t}(i.e);(0,s.Y5)("FlowGraphMatrixCompose",m)},85405:(e,t,n)=>{n.d(t,{b:()=>h});var r=n(78322),i=n(8046),o=n(6174),a=n(66377),s=n(66614),l=n(41190),c=n(12028),u=function(){this._doNotSerialize=!1,this._isDisposed=!1,this._sceneRootNodesIndex=-1,this._isEnabled=!0,this._isParentEnabled=!0,this._isReady=!0,this._onEnabledStateChangedObservable=new a.cP,this._onClonedObservable=new a.cP,this._inheritVisibility=!1,this._isVisible=!0},h=function(){function e(e,t,n){void 0===t&&(t=null),void 0===n&&(n=!0),this._isDirty=!1,this._nodeDataStorage=new u,this.state="",this.metadata=null,this.reservedDataStore=null,this._accessibilityTag=null,this.onAccessibilityTagChangedObservable=new a.cP,this._parentContainer=null,this.animations=[],this._ranges={},this.onReady=null,this._currentRenderId=-1,this._parentUpdateId=-1,this._childUpdateId=-1,this._waitingParentId=null,this._waitingParentInstanceIndex=null,this._waitingParsedUniqueId=null,this._cache={},this._parentNode=null,this._children=null,this._worldMatrix=i.uq.Identity(),this._worldMatrixDeterminant=0,this._worldMatrixDeterminantIsDirty=!0,this._animationPropertiesOverride=null,this._isNode=!0,this.onDisposeObservable=new a.cP,this._onDisposeObserver=null,this._behaviors=new Array,this.name=e,this.id=e,this._scene=t||s.q.LastCreatedScene,this.uniqueId=this._scene.getUniqueId(),this._initCache(),n&&this._addToSceneRootNodes()}return e.AddNodeConstructor=function(e,t){this._NodeConstructors[e]=t},e.Construct=function(e,t,n,r){var i=this._NodeConstructors[e];return i?i(t,n,r):null},Object.defineProperty(e.prototype,"accessibilityTag",{get:function(){return this._accessibilityTag},set:function(e){this._accessibilityTag=e,this.onAccessibilityTagChangedObservable.notifyObservers(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"doNotSerialize",{get:function(){return!!this._nodeDataStorage._doNotSerialize||!!this._parentNode&&this._parentNode.doNotSerialize},set:function(e){this._nodeDataStorage._doNotSerialize=e},enumerable:!1,configurable:!0}),e.prototype.isDisposed=function(){return this._nodeDataStorage._isDisposed},Object.defineProperty(e.prototype,"parent",{get:function(){return this._parentNode},set:function(e){if(this._parentNode!==e){var t=this._parentNode;if(this._parentNode&&void 0!==this._parentNode._children&&null!==this._parentNode._children){var n=this._parentNode._children.indexOf(this);-1!==n&&this._parentNode._children.splice(n,1),e||this._nodeDataStorage._isDisposed||this._addToSceneRootNodes()}this._parentNode=e,this._isDirty=!0,this._parentNode&&(void 0!==this._parentNode._children&&null!==this._parentNode._children||(this._parentNode._children=new Array),this._parentNode._children.push(this),t||this._removeFromSceneRootNodes()),this._syncParentEnabledState()}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"inheritVisibility",{get:function(){return this._nodeDataStorage._inheritVisibility},set:function(e){this._nodeDataStorage._inheritVisibility=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isVisible",{get:function(){return!(this.inheritVisibility&&this._parentNode&&!this._parentNode.isVisible)&&this._nodeDataStorage._isVisible},set:function(e){this._nodeDataStorage._isVisible=e},enumerable:!1,configurable:!0}),e.prototype._serializeAsParent=function(e){e.parentId=this.uniqueId},e.prototype._addToSceneRootNodes=function(){-1===this._nodeDataStorage._sceneRootNodesIndex&&(this._nodeDataStorage._sceneRootNodesIndex=this._scene.rootNodes.length,this._scene.rootNodes.push(this))},e.prototype._removeFromSceneRootNodes=function(){if(-1!==this._nodeDataStorage._sceneRootNodesIndex){var e=this._scene.rootNodes,t=e.length-1;e[this._nodeDataStorage._sceneRootNodesIndex]=e[t],e[this._nodeDataStorage._sceneRootNodesIndex]._nodeDataStorage._sceneRootNodesIndex=this._nodeDataStorage._sceneRootNodesIndex,this._scene.rootNodes.pop(),this._nodeDataStorage._sceneRootNodesIndex=-1}},Object.defineProperty(e.prototype,"animationPropertiesOverride",{get:function(){return this._animationPropertiesOverride?this._animationPropertiesOverride:this._scene.animationPropertiesOverride},set:function(e){this._animationPropertiesOverride=e},enumerable:!1,configurable:!0}),e.prototype.getClassName=function(){return"Node"},Object.defineProperty(e.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onEnabledStateChangedObservable",{get:function(){return this._nodeDataStorage._onEnabledStateChangedObservable},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onClonedObservable",{get:function(){return this._nodeDataStorage._onClonedObservable},enumerable:!1,configurable:!0}),e.prototype.getScene=function(){return this._scene},e.prototype.getEngine=function(){return this._scene.getEngine()},e.prototype.addBehavior=function(e,t){var n=this;return void 0===t&&(t=!1),-1!==this._behaviors.indexOf(e)||(e.init(),this._scene.isLoading&&!t?this._scene.onDataLoadedObservable.addOnce((function(){n._behaviors.includes(e)&&e.attach(n)})):e.attach(this),this._behaviors.push(e)),this},e.prototype.removeBehavior=function(e){var t=this._behaviors.indexOf(e);return-1===t||(this._behaviors[t].detach(),this._behaviors.splice(t,1)),this},Object.defineProperty(e.prototype,"behaviors",{get:function(){return this._behaviors},enumerable:!1,configurable:!0}),e.prototype.getBehaviorByName=function(e){for(var t=0,n=this._behaviors;t{n.r(t),n.d(t,{defaultPixelShaderWGSL:()=>a});var r=n(98519),i=(n(76941),n(78710),n(76778),n(14188),n(17393),n(10896),n(53378),n(32532),n(338),n(92331),n(61439),n(86320),n(4661),n(96830),n(66633),n(20502),n(38197),n(98318),n(30032),n(20274),n(65969),n(25757),n(84192),n(56897),n(83512),n(73876),"defaultPixelShader"),o="#include\n#include[SCENE_MRT_COUNT]\n#include\n#define CUSTOM_FRAGMENT_BEGIN\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vColor: vec4f;\n#endif\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#include[1..7]\n#include\n#include[0..maxSimultaneousLights]\n#include\n#include\n#include(_DEFINENAME_,DIFFUSE,_VARYINGNAME_,Diffuse,_SAMPLERNAME_,diffuse)\n#include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_SAMPLERNAME_,ambient)\n#include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_SAMPLERNAME_,opacity)\n#include(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_SAMPLERNAME_,emissive)\n#include(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_SAMPLERNAME_,lightmap)\n#include(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_SAMPLERNAME_,decal)\n#ifdef REFRACTION\n#ifdef REFRACTIONMAP_3D\nvar refractionCubeSamplerSampler: sampler;var refractionCubeSampler: texture_cube;\n#else\nvar refraction2DSamplerSampler: sampler;var refraction2DSampler: texture_2d;\n#endif\n#endif\n#if defined(SPECULARTERM)\n#include(_DEFINENAME_,SPECULAR,_VARYINGNAME_,Specular,_SAMPLERNAME_,specular)\n#endif\n#include\n#ifdef REFLECTION\n#ifdef REFLECTIONMAP_3D\nvar reflectionCubeSamplerSampler: sampler;var reflectionCubeSampler: texture_cube;\n#else\nvar reflection2DSamplerSampler: sampler;var reflection2DSampler: texture_2d;\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vPositionUVW: vec3f;\n#else\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vDirectionW: vec3f;\n#endif\n#endif\n#include\n#endif\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include\nvar viewDirectionW: vec3f=normalize(scene.vEyePosition.xyz-fragmentInputs.vPositionW);var baseColor: vec4f= vec4f(1.,1.,1.,1.);var diffuseColor: vec3f=uniforms.vDiffuseColor.rgb;var alpha: f32=uniforms.vDiffuseColor.a;\n#ifdef NORMAL\nvar normalW: vec3f=normalize(fragmentInputs.vNormalW);\n#else\nvar normalW: vec3f=normalize(-cross(dpdx(fragmentInputs.vPositionW),dpdy(fragmentInputs.vPositionW)));\n#endif\n#include\n#ifdef TWOSIDEDLIGHTING\nnormalW=select(-normalW,normalW,fragmentInputs.frontFacing);\n#endif\n#ifdef DIFFUSE\nbaseColor=textureSample(diffuseSampler,diffuseSamplerSampler,fragmentInputs.vDiffuseUV+uvOffset);\n#if defined(ALPHATEST) && !defined(ALPHATEST_AFTERALLALPHACOMPUTATIONS)\nif (baseColor.a(surfaceAlbedo,baseColor,GAMMADECAL,_GAMMADECAL_NOTUSED_)\n#endif\n#include\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nbaseColor=vec4f(baseColor.rgb*fragmentInputs.vColor.rgb,baseColor.a);\n#endif\n#ifdef DETAIL\nbaseColor=vec4f(baseColor.rgb*2.0*mix(0.5,detailColor.r,uniforms.vDetailInfos.y),baseColor.a);\n#endif\n#if defined(DECAL) && defined(DECAL_AFTER_DETAIL)\nvar decalColor: vec4f=textureSample(decalSampler,decalSamplerSampler,fragmentInputs.vDecalUV+uvOffset);\n#include(surfaceAlbedo,baseColor,GAMMADECAL,_GAMMADECAL_NOTUSED_)\n#endif\n#define CUSTOM_FRAGMENT_UPDATE_DIFFUSE\nvar baseAmbientColor: vec3f= vec3f(1.,1.,1.);\n#ifdef AMBIENT\nbaseAmbientColor=textureSample(ambientSampler,ambientSamplerSampler,fragmentInputs.vAmbientUV+uvOffset).rgb*uniforms.vAmbientInfos.y;\n#endif\n#define CUSTOM_FRAGMENT_BEFORE_LIGHTS\nvar glossiness: f32=uniforms.vSpecularColor.a;var specularColor: vec3f=uniforms.vSpecularColor.rgb;\n#ifdef SPECULARTERM\n#ifdef SPECULAR\nvar specularMapColor: vec4f=textureSample(specularSampler,specularSamplerSampler,fragmentInputs.vSpecularUV+uvOffset);specularColor=specularMapColor.rgb;\n#ifdef GLOSSINESS\nglossiness=glossiness*specularMapColor.a;\n#endif\n#endif\n#endif\nvar diffuseBase: vec3f= vec3f(0.,0.,0.);var info: lightingInfo;\n#ifdef SPECULARTERM\nvar specularBase: vec3f= vec3f(0.,0.,0.);\n#endif\nvar shadow: f32=1.;var aggShadow: f32=0.;var numLights: f32=0.;\n#ifdef LIGHTMAP\nvar lightmapColor: vec4f=textureSample(lightmapSampler,lightmapSamplerSampler,fragmentInputs.vLightmapUV+uvOffset);\n#ifdef RGBDLIGHTMAP\nlightmapColor=vec4f(fromRGBD(lightmapColor),lightmapColor.a);\n#endif\nlightmapColor=vec4f(lightmapColor.rgb*uniforms.vLightmapInfos.y,lightmapColor.a);\n#endif\n#include[0..maxSimultaneousLights]\naggShadow=aggShadow/numLights;var refractionColor: vec4f= vec4f(0.,0.,0.,1.);\n#ifdef REFRACTION\nvar refractionVector: vec3f=normalize(refract(-viewDirectionW,normalW,uniforms.vRefractionInfos.y));\n#ifdef REFRACTIONMAP_3D\n#ifdef USE_LOCAL_REFRACTIONMAP_CUBIC\nrefractionVector=parallaxCorrectNormal(fragmentInputs.vPositionW,refractionVector,uniforms.vRefractionSize,uniforms.vRefractionPosition);\n#endif\nrefractionVector.y=refractionVector.y*uniforms.vRefractionInfos.w;var refractionLookup: vec4f=textureSample(refractionCubeSampler,refractionCubeSamplerSampler,refractionVector);if (dot(refractionVector,viewDirectionW)<1.0) {refractionColor=refractionLookup;}\n#else\nvar vRefractionUVW: vec3f= (uniforms.refractionMatrix*(scene.view* vec4f(fragmentInputs.vPositionW+refractionVector*uniforms.vRefractionInfos.z,1.0))).xyz;var refractionCoords: vec2f=vRefractionUVW.xy/vRefractionUVW.z;refractionCoords.y=1.0-refractionCoords.y;refractionColor=textureSample(refraction2DSampler,refraction2DSamplerSampler,refractionCoords);\n#endif\n#ifdef RGBDREFRACTION\nrefractionColor=vec4f(fromRGBD(refractionColor),refractionColor.a);\n#endif\n#ifdef IS_REFRACTION_LINEAR\nrefractionColor=vec4f(toGammaSpaceVec3(refractionColor.rgb),refractionColor.a);\n#endif\nrefractionColor=vec4f(refractionColor.rgb*uniforms.vRefractionInfos.x,refractionColor.a);\n#endif\nvar reflectionColor: vec4f= vec4f(0.,0.,0.,1.);\n#ifdef REFLECTION\nvar vReflectionUVW: vec3f=computeReflectionCoords( vec4f(fragmentInputs.vPositionW,1.0),normalW);\n#ifdef REFLECTIONMAP_OPPOSITEZ\nvReflectionUVW=vec3f(vReflectionUVW.x,vReflectionUVW.y,vReflectionUVW.z*-1.0);\n#endif\n#ifdef REFLECTIONMAP_3D\n#ifdef ROUGHNESS\nvar bias: f32=uniforms.vReflectionInfos.y;\n#ifdef SPECULARTERM\n#ifdef SPECULAR\n#ifdef GLOSSINESS\nbias*=(1.0-specularMapColor.a);\n#endif\n#endif\n#endif\nreflectionColor=textureSampleLevel(reflectionCubeSampler,reflectionCubeSamplerSampler,vReflectionUVW,bias);\n#else\nreflectionColor=textureSample(reflectionCubeSampler,reflectionCubeSamplerSampler,vReflectionUVW);\n#endif\n#else\nvar coords: vec2f=vReflectionUVW.xy;\n#ifdef REFLECTIONMAP_PROJECTION\ncoords/=vReflectionUVW.z;\n#endif\ncoords.y=1.0-coords.y;reflectionColor=textureSample(reflection2DSampler,reflection2DSamplerSampler,coords);\n#endif\n#ifdef RGBDREFLECTION\nreflectionColor=vec4f(fromRGBD(reflectionColor),reflectionColor.a);\n#endif\n#ifdef IS_REFLECTION_LINEAR\nreflectionColor=vec4f(toGammaSpaceVec3(reflectionColor.rgb),reflectionColor.a);\n#endif\nreflectionColor=vec4f(reflectionColor.rgb*uniforms.vReflectionInfos.x,reflectionColor.a);\n#ifdef REFLECTIONFRESNEL\nvar reflectionFresnelTerm: f32=computeFresnelTerm(viewDirectionW,normalW,uniforms.reflectionRightColor.a,uniforms.reflectionLeftColor.a);\n#ifdef REFLECTIONFRESNELFROMSPECULAR\n#ifdef SPECULARTERM\nreflectionColor=vec4f(reflectionColor.rgb*specularColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*uniforms.reflectionRightColor.rgb,reflectionColor.a);\n#else\nreflectionColor=vec4f(reflectionColor.rgb*uniforms.reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*uniforms.reflectionRightColor.rgb,reflectionColor.a);\n#endif\n#else\nreflectionColor=vec4f(reflectionColor.rgb*uniforms.reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*uniforms.reflectionRightColor.rgb,reflectionColor.a);\n#endif\n#endif\n#endif\n#ifdef REFRACTIONFRESNEL\nvar refractionFresnelTerm: f32=computeFresnelTerm(viewDirectionW,normalW,uniforms.refractionRightColor.a,uniforms.refractionLeftColor.a);refractionColor=vec4f(refractionColor.rgb*uniforms.refractionLeftColor.rgb*(1.0-refractionFresnelTerm)+refractionFresnelTerm*uniforms.refractionRightColor.rgb,refractionColor.a);\n#endif\n#ifdef OPACITY\nvar opacityMap: vec4f=textureSample(opacitySampler,opacitySamplerSampler,fragmentInputs.vOpacityUV+uvOffset);\n#ifdef OPACITYRGB\nopacityMap=vec4f(opacityMap.rgb* vec3f(0.3,0.59,0.11),opacityMap.a);alpha*=(opacityMap.x+opacityMap.y+opacityMap.z)* uniforms.vOpacityInfos.y;\n#else\nalpha*=opacityMap.a*uniforms.vOpacityInfos.y;\n#endif\n#endif\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=fragmentInputs.vColor.a;\n#endif\n#ifdef OPACITYFRESNEL\nvar opacityFresnelTerm: f32=computeFresnelTerm(viewDirectionW,normalW,uniforms.opacityParts.z,uniforms.opacityParts.w);alpha+=uniforms.opacityParts.x*(1.0-opacityFresnelTerm)+opacityFresnelTerm*uniforms.opacityParts.y;\n#endif\n#ifdef ALPHATEST\n#ifdef ALPHATEST_AFTERALLALPHACOMPUTATIONS\nif (alpha\n#include\n#ifdef IMAGEPROCESSINGPOSTPROCESS\ncolor=vec4f(toLinearSpaceVec3(color.rgb),color.a);\n#else\n#ifdef IMAGEPROCESSING\ncolor=vec4f(toLinearSpaceVec3(color.rgb),color.a);color=applyImageProcessing(color);\n#endif\n#endif\ncolor=vec4f(color.rgb,color.a*mesh.visibility);\n#ifdef PREMULTIPLYALPHA\ncolor=vec4f(color.rgb*color.a, color.a);\n#endif\n#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR\n#ifdef PREPASS\n#if SCENE_MRT_COUNT>0\nvar writeGeometryInfo: f32=select(0.0,1.0,color.a>0.4);var fragData: array,SCENE_MRT_COUNT>;\n#ifdef PREPASS_COLOR\nfragData[PREPASS_COLOR_INDEX]=color; \n#endif\n#ifdef PREPASS_POSITION\nfragData[PREPASS_POSITION_INDEX]=vec4f(fragmentInputs.vPositionW,writeGeometryInfo);\n#endif\n#ifdef PREPASS_LOCAL_POSITION\nfragData[PREPASS_LOCAL_POSITION_INDEX]=vec4f(fragmentInputs.vPosition,writeGeometryInfo);\n#endif\n#ifdef PREPASS_VELOCITY\nvar a: vec2f=(fragmentInputs.vCurrentPosition.xy/fragmentInputs.vCurrentPosition.w)*0.5+0.5;var b: vec2f=(fragmentInputs.vPreviousPosition.xy/fragmentInputs.vPreviousPosition.w)*0.5+0.5;var velocity: vec2f=abs(a-b);velocity= vec2f(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;fragData[PREPASS_VELOCITY_INDEX]= vec4f(velocity,0.0,writeGeometryInfo);\n#elif defined(PREPASS_VELOCITY_LINEAR)\nvar velocity : vec2f=vec2f(0.5)*((fragmentInputs.vPreviousPosition.xy/fragmentInputs.vPreviousPosition.w) -\n(fragmentInputs.vCurrentPosition.xy/fragmentInputs.vCurrentPosition.w));fragData[PREPASS_VELOCITY_LINEAR_INDEX]=vec4f(velocity,0.0,writeGeometryInfo);\n#endif\n#ifdef PREPASS_IRRADIANCE\nfragData[PREPASS_IRRADIANCE_INDEX]=vec4f(0.0,0.0,0.0,writeGeometryInfo); \n#endif\n#ifdef PREPASS_DEPTH\nfragData[PREPASS_DEPTH_INDEX]=vec4f(fragmentInputs.vViewPos.z,0.0,0.0,writeGeometryInfo); \n#endif\n#ifdef PREPASS_SCREENSPACE_DEPTH\nfragData[PREPASS_SCREENSPACE_DEPTH_INDEX]=vec4f(fragmentInputs.position.z,0.0,0.0,writeGeometryInfo);\n#endif\n#ifdef PREPASS_NORMALIZED_VIEW_DEPTH\nfragData[PREPASS_NORMALIZED_VIEW_DEPTH_INDEX]=vec4f(fragmentInputs.vNormViewDepth,0.0,0.0,writeGeometryInfo);\n#endif\n#ifdef PREPASS_NORMAL\n#ifdef PREPASS_NORMAL_WORLDSPACE\nfragData[PREPASS_NORMAL_INDEX]=vec4f(normalW,writeGeometryInfo);\n#else\nfragData[PREPASS_NORMAL_INDEX]=vec4f(normalize((scene.view*vec4f(normalW,0.0)).rgb),writeGeometryInfo);\n#endif\n#endif\n#ifdef PREPASS_WORLD_NORMAL\nfragData[PREPASS_WORLD_NORMAL_INDEX]=vec4f(normalW*0.5+0.5,writeGeometryInfo);\n#endif\n#ifdef PREPASS_ALBEDO\nfragData[PREPASS_ALBEDO_INDEX]=vec4f(baseColor.rgb,writeGeometryInfo);\n#endif\n#ifdef PREPASS_ALBEDO_SQRT\nfragData[PREPASS_ALBEDO_SQRT_INDEX]=vec4f(sqrt(baseColor.rgb),writeGeometryInfo);\n#endif\n#ifdef PREPASS_REFLECTIVITY\n#if defined(SPECULAR)\nfragData[PREPASS_REFLECTIVITY_INDEX]=vec4f(toLinearSpaceVec4(specularMapColor))*writeGeometryInfo; \n#else\nfragData[PREPASS_REFLECTIVITY_INDEX]=vec4f(toLinearSpaceVec3(specularColor),1.0)*writeGeometryInfo;\n#endif\n#endif\n#if SCENE_MRT_COUNT>0\nfragmentOutputs.fragData0=fragData[0];\n#endif\n#if SCENE_MRT_COUNT>1\nfragmentOutputs.fragData1=fragData[1];\n#endif\n#if SCENE_MRT_COUNT>2\nfragmentOutputs.fragData2=fragData[2];\n#endif\n#if SCENE_MRT_COUNT>3\nfragmentOutputs.fragData3=fragData[3];\n#endif\n#if SCENE_MRT_COUNT>4\nfragmentOutputs.fragData4=fragData[4];\n#endif\n#if SCENE_MRT_COUNT>5\nfragmentOutputs.fragData5=fragData[5];\n#endif\n#if SCENE_MRT_COUNT>6\nfragmentOutputs.fragData6=fragData[6];\n#endif\n#if SCENE_MRT_COUNT>7\nfragmentOutputs.fragData7=fragData[7];\n#endif\n#endif\n#endif\n#if !defined(PREPASS) && !defined(ORDER_INDEPENDENT_TRANSPARENCY)\nfragmentOutputs.color=color;\n#endif\n#include\n#if ORDER_INDEPENDENT_TRANSPARENCY\nif (fragDepth==nearestDepth) {fragmentOutputs.frontColor=vec4f(fragmentOutputs.frontColor.rgb+color.rgb*color.a*alphaMultiplier,1.0-alphaMultiplier*(1.0-color.a));} else {fragmentOutputs.backColor+=color;}\n#endif\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},85637:(e,t,n)=>{n.r(t),n.d(t,{clipPlaneVertexDeclaration:()=>a});var r=n(98519),i="clipPlaneVertexDeclaration",o="#ifdef CLIPPLANE\nuniform vec4 vClipPlane;varying float fClipDistance;\n#endif\n#ifdef CLIPPLANE2\nuniform vec4 vClipPlane2;varying float fClipDistance2;\n#endif\n#ifdef CLIPPLANE3\nuniform vec4 vClipPlane3;varying float fClipDistance3;\n#endif\n#ifdef CLIPPLANE4\nuniform vec4 vClipPlane4;varying float fClipDistance4;\n#endif\n#ifdef CLIPPLANE5\nuniform vec4 vClipPlane5;varying float fClipDistance5;\n#endif\n#ifdef CLIPPLANE6\nuniform vec4 vClipPlane6;varying float fClipDistance6;\n#endif\n";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]=o);var a={name:i,shader:o}},86254:(e,t,n)=>{n.r(t),n.d(t,{meshUVSpaceRendererMaskerVertexShader:()=>a});var r=n(98519),i="meshUVSpaceRendererMaskerVertexShader",o="attribute vec2 uv;varying vec2 vUV;void main(void) {gl_Position=vec4(vec2(uv.x,uv.y)*2.0-1.0,0.,1.0);vUV=uv;}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},86320:(e,t,n)=>{n.r(t),n.d(t,{imageProcessingDeclarationWGSL:()=>a});var r=n(98519),i="imageProcessingDeclaration",o="#ifdef EXPOSURE\nuniform exposureLinear: f32;\n#endif\n#ifdef CONTRAST\nuniform contrast: f32;\n#endif\n#if defined(VIGNETTE) || defined(DITHER)\nuniform vInverseScreenSize: vec2f;\n#endif\n#ifdef VIGNETTE\nuniform vignetteSettings1: vec4f;uniform vignetteSettings2: vec4f;\n#endif\n#ifdef COLORCURVES\nuniform vCameraColorCurveNegative: vec4f;uniform vCameraColorCurveNeutral: vec4f;uniform vCameraColorCurvePositive: vec4f;\n#endif\n#ifdef COLORGRADING\n#ifdef COLORGRADING3D\nvar txColorTransformSampler: sampler;var txColorTransform: texture_3d;\n#else\nvar txColorTransformSampler: sampler;var txColorTransform: texture_2d;\n#endif\nuniform colorTransformSettings: vec4f;\n#endif\n#ifdef DITHER\nuniform ditherIntensity: f32;\n#endif\n";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]=o);var a={name:i,shader:o}},86343:(e,t,n)=>{var r=n(98519),i="fogFragment";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#ifdef FOG\nfloat fog=CalcFogFactor();\n#ifdef PBR\nfog=toLinearSpace(fog);\n#endif\ncolor.rgb=mix(vFogColor,color.rgb,fog);\n#endif\n")},86450:(e,t,n)=>{n.r(t),n.d(t,{FlowGraphSendCustomEventBlock:()=>a});var r=n(78322),i=n(88469),o=n(34623),a=function(e){function t(t){var n=e.call(this,t)||this;for(var r in n.config=t,n.config.eventData)n.registerDataInput(r,n.config.eventData[r].type,n.config.eventData[r].value);return n}return(0,r.C6)(t,e),t.prototype._execute=function(e){for(var t=this.config.eventId,n={},r=0,i=this.dataInputs;r{n.r(t),n.d(t,{gaussianSplattingPixelShaderWGSL:()=>a});var r=n(98519),i=(n(20502),n(38197),n(98318),n(59681),n(30032),"gaussianSplattingPixelShader"),o="#include\n#include\n#include\nvarying vColor: vec4f;varying vPosition: vec2f;\n#include\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#include\nfragmentOutputs.color=gaussianColor(input.vColor,input.vPosition);}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},86551:(e,t,n)=>{var r=n(98519),i="pbrBlockPrePass";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="#if SCENE_MRT_COUNT>0\nvar writeGeometryInfo: f32=select(0.0,1.0,finalColor.a>ALPHATESTVALUE);var fragData: array,SCENE_MRT_COUNT>;\n#ifdef PREPASS_POSITION\nfragData[PREPASS_POSITION_INDEX]= vec4f(fragmentInputs.vPositionW,writeGeometryInfo);\n#endif\n#ifdef PREPASS_LOCAL_POSITION\nfragData[PREPASS_LOCAL_POSITION_INDEX]=vec4f(fragmentInputs.vPosition,writeGeometryInfo);\n#endif\n#ifdef PREPASS_VELOCITY\nvar a: vec2f=(fragmentInputs.vCurrentPosition.xy/fragmentInputs.vCurrentPosition.w)*0.5+0.5;var b: vec2f=(fragmentInputs.vPreviousPosition.xy/fragmentInputs.vPreviousPosition.w)*0.5+0.5;var velocity: vec2f=abs(a-b);velocity= vec2f(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;fragData[PREPASS_VELOCITY_INDEX]= vec4f(velocity,0.0,writeGeometryInfo);\n#elif defined(PREPASS_VELOCITY_LINEAR)\nvar velocity : vec2f=vec2f(0.5)*((fragmentInputs.vPreviousPosition.xy/fragmentInputs.vPreviousPosition.w) -\n(fragmentInputs.vCurrentPosition.xy/fragmentInputs.vCurrentPosition.w));fragData[PREPASS_VELOCITY_LINEAR_INDEX]=vec4f(velocity,0.0,writeGeometryInfo);\n#endif\n#ifdef PREPASS_ALBEDO\nfragData[PREPASS_ALBEDO_INDEX]=vec4f(surfaceAlbedo,writeGeometryInfo);\n#endif\n#ifdef PREPASS_ALBEDO_SQRT\nvar sqAlbedo : vec3f=sqrt(surfaceAlbedo); \n#endif\n#ifdef PREPASS_IRRADIANCE\nvar irradiance : vec3f=finalDiffuse;\n#ifndef UNLIT\n#ifdef REFLECTION\nirradiance+=finalIrradiance;\n#endif\n#endif\n#ifdef SS_SCATTERING\n#ifdef PREPASS_COLOR\nfragData[PREPASS_COLOR_INDEX]=vec4f(finalColor.rgb-irradiance,finalColor.a); \n#endif\nirradiance/=sqAlbedo;fragData[PREPASS_IRRADIANCE_INDEX]=vec4f(clamp(irradiance,vec3f(0.),vec3f(1.)),writeGeometryInfo*uniforms.scatteringDiffusionProfile/255.); \n#else\n#ifdef PREPASS_COLOR\nfragData[PREPASS_COLOR_INDEX]=finalColor; \n#endif\nfragData[PREPASS_IRRADIANCE_INDEX]=vec4f(clamp(irradiance,vec3f(0.),vec3f(1.)),writeGeometryInfo); \n#endif\n#elif defined(PREPASS_COLOR)\nfragData[PREPASS_COLOR_INDEX]=vec4f(finalColor.rgb,finalColor.a);\n#endif\n#ifdef PREPASS_DEPTH\nfragData[PREPASS_DEPTH_INDEX]=vec4f(fragmentInputs.vViewPos.z,0.0,0.0,writeGeometryInfo); \n#endif\n#ifdef PREPASS_SCREENSPACE_DEPTH\nfragData[PREPASS_SCREENSPACE_DEPTH_INDEX]=vec4f(fragmentInputs.position.z,0.0,0.0,writeGeometryInfo);\n#endif\n#ifdef PREPASS_NORMALIZED_VIEW_DEPTH\nfragData[PREPASS_NORMALIZED_VIEW_DEPTH_INDEX]=vec4f(fragmentInputs.vNormViewDepth,0.0,0.0,writeGeometryInfo);\n#endif\n#ifdef PREPASS_NORMAL\n#ifdef PREPASS_NORMAL_WORLDSPACE\nfragData[PREPASS_NORMAL_INDEX]=vec4f(normalW,writeGeometryInfo);\n#else\nfragData[PREPASS_NORMAL_INDEX]=vec4f(normalize((scene.view*vec4f(normalW,0.0)).rgb),writeGeometryInfo);\n#endif\n#endif\n#ifdef PREPASS_WORLD_NORMAL\nfragData[PREPASS_WORLD_NORMAL_INDEX]=vec4f(normalW*0.5+0.5,writeGeometryInfo);\n#endif\n#ifdef PREPASS_ALBEDO_SQRT\nfragData[PREPASS_ALBEDO_SQRT_INDEX]=vec4f(sqAlbedo,writeGeometryInfo);\n#endif\n#ifdef PREPASS_REFLECTIVITY\n#ifndef UNLIT\nfragData[PREPASS_REFLECTIVITY_INDEX]=vec4f(specularEnvironmentR0,microSurface)*writeGeometryInfo;\n#else\nfragData[PREPASS_REFLECTIVITY_INDEX]=vec4f(0.0,0.0,0.0,1.0)*writeGeometryInfo;\n#endif\n#endif\n#if SCENE_MRT_COUNT>0\nfragmentOutputs.fragData0=fragData[0];\n#endif\n#if SCENE_MRT_COUNT>1\nfragmentOutputs.fragData1=fragData[1];\n#endif\n#if SCENE_MRT_COUNT>2\nfragmentOutputs.fragData2=fragData[2];\n#endif\n#if SCENE_MRT_COUNT>3\nfragmentOutputs.fragData3=fragData[3];\n#endif\n#if SCENE_MRT_COUNT>4\nfragmentOutputs.fragData4=fragData[4];\n#endif\n#if SCENE_MRT_COUNT>5\nfragmentOutputs.fragData5=fragData[5];\n#endif\n#if SCENE_MRT_COUNT>6\nfragmentOutputs.fragData6=fragData[6];\n#endif\n#if SCENE_MRT_COUNT>7\nfragmentOutputs.fragData7=fragData[7];\n#endif\n#endif\n")},86558:(e,t,n)=>{n.r(t),n.d(t,{rgbdEncodePixelShaderWGSL:()=>a});var r=n(98519),i=(n(17393),"rgbdEncodePixelShader"),o="varying vUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d;\n#include\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {fragmentOutputs.color=toRGBD(textureSample(textureSampler,textureSamplerSampler,input.vUV).rgb);}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},86615:(e,t,n)=>{var r=n(98519),i="bakedVertexAnimation";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="#ifdef BAKED_VERTEX_ANIMATION_TEXTURE\n{\n#ifdef INSTANCES\nlet VATStartFrame: f32=vertexInputs.bakedVertexAnimationSettingsInstanced.x;let VATEndFrame: f32=vertexInputs.bakedVertexAnimationSettingsInstanced.y;let VATOffsetFrame: f32=vertexInputs.bakedVertexAnimationSettingsInstanced.z;let VATSpeed: f32=vertexInputs.bakedVertexAnimationSettingsInstanced.w;\n#else\nlet VATStartFrame: f32=uniforms.bakedVertexAnimationSettings.x;let VATEndFrame: f32=uniforms.bakedVertexAnimationSettings.y;let VATOffsetFrame: f32=uniforms.bakedVertexAnimationSettings.z;let VATSpeed: f32=uniforms.bakedVertexAnimationSettings.w;\n#endif\nlet totalFrames: f32=VATEndFrame-VATStartFrame+1.0;let time: f32=uniforms.bakedVertexAnimationTime*VATSpeed/totalFrames;let frameCorrection: f32=select(1.0,0.0,time<1.0);let numOfFrames: f32=totalFrames-frameCorrection;var VATFrameNum: f32=fract(time)*numOfFrames;VATFrameNum=(VATFrameNum+VATOffsetFrame) % numOfFrames;VATFrameNum=floor(VATFrameNum);VATFrameNum=VATFrameNum+VATStartFrame+frameCorrection;var VATInfluence : mat4x4;VATInfluence=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,vertexInputs.matricesIndices[0],VATFrameNum)*vertexInputs.matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\nVATInfluence=VATInfluence+readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,vertexInputs.matricesIndices[1],VATFrameNum)*vertexInputs.matricesWeights[1];\n#endif\n#if NUM_BONE_INFLUENCERS>2\nVATInfluence=VATInfluence+readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,vertexInputs.matricesIndices[2],VATFrameNum)*vertexInputs.matricesWeights[2];\n#endif\n#if NUM_BONE_INFLUENCERS>3\nVATInfluence=VATInfluence+readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,vertexInputs.matricesIndices[3],VATFrameNum)*vertexInputs.matricesWeights[3];\n#endif\n#if NUM_BONE_INFLUENCERS>4\nVATInfluence=VATInfluence+readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,vertexInputs.matricesIndicesExtra[0],VATFrameNum)*vertexInputs.matricesWeightsExtra[0];\n#endif\n#if NUM_BONE_INFLUENCERS>5\nVATInfluence=VATInfluence+readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,vertexInputs.matricesIndicesExtra[1],VATFrameNum)*vertexInputs.matricesWeightsExtra[1];\n#endif\n#if NUM_BONE_INFLUENCERS>6\nVATInfluence=VATInfluence+readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,vertexInputs.matricesIndicesExtra[2],VATFrameNum)*vertexInputs.matricesWeightsExtra[2];\n#endif\n#if NUM_BONE_INFLUENCERS>7\nVATInfluence=VATInfluence+readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,vertexInputs.matricesIndicesExtra[3],VATFrameNum)*vertexInputs.matricesWeightsExtra[3];\n#endif\nfinalWorld=finalWorld*VATInfluence;}\n#endif\n")},87074:(e,t,n)=>{n.d(t,{C4:()=>l,L8:()=>i,OG:()=>a,R:()=>c,zF:()=>o});var r=n(81152);function i(e){var t=1;do{t*=2}while(te-n?n:t}function s(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e}function l(e){return e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,(e|=e>>16)-(e>>1)}function c(e,t,n){var i;switch(void 0===n&&(n=r.Y.SCALEMODE_NEAREST),n){case r.Y.SCALEMODE_FLOOR:i=l(e);break;case r.Y.SCALEMODE_NEAREST:i=a(e);break;case r.Y.SCALEMODE_CEILING:default:i=s(e)}return Math.min(i,t)}},87180:(e,t,n)=>{var r=n(98519),i="pbrBlockPrePass";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#if SCENE_MRT_COUNT>0\nfloat writeGeometryInfo=finalColor.a>ALPHATESTVALUE ? 1.0 : 0.0;\n#ifdef PREPASS_POSITION\ngl_FragData[PREPASS_POSITION_INDEX]=vec4(vPositionW,writeGeometryInfo);\n#endif\n#ifdef PREPASS_LOCAL_POSITION\ngl_FragData[PREPASS_LOCAL_POSITION_INDEX]=vec4(vPosition,writeGeometryInfo);\n#endif\n#if defined(PREPASS_VELOCITY)\nvec2 a=(vCurrentPosition.xy/vCurrentPosition.w)*0.5+0.5;vec2 b=(vPreviousPosition.xy/vPreviousPosition.w)*0.5+0.5;vec2 velocity=abs(a-b);velocity=vec2(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;gl_FragData[PREPASS_VELOCITY_INDEX]=vec4(velocity,0.0,writeGeometryInfo);\n#elif defined(PREPASS_VELOCITY_LINEAR)\nvec2 velocity=vec2(0.5)*((vPreviousPosition.xy/vPreviousPosition.w)-(vCurrentPosition.xy/vCurrentPosition.w));gl_FragData[PREPASS_VELOCITY_LINEAR_INDEX]=vec4(velocity,0.0,writeGeometryInfo);\n#endif\n#ifdef PREPASS_ALBEDO\ngl_FragData[PREPASS_ALBEDO_INDEX]=vec4(surfaceAlbedo,writeGeometryInfo);\n#endif\n#ifdef PREPASS_ALBEDO_SQRT\nvec3 sqAlbedo=sqrt(surfaceAlbedo); \n#endif\n#ifdef PREPASS_IRRADIANCE\nvec3 irradiance=finalDiffuse;\n#ifndef UNLIT\n#ifdef REFLECTION\nirradiance+=finalIrradiance;\n#endif\n#endif\n#ifdef SS_SCATTERING\n#ifdef PREPASS_COLOR\ngl_FragData[PREPASS_COLOR_INDEX]=vec4(finalColor.rgb-irradiance,finalColor.a); \n#endif\nirradiance/=sqAlbedo;\n#else\n#ifdef PREPASS_COLOR\ngl_FragData[PREPASS_COLOR_INDEX]=finalColor; \n#endif\nfloat scatteringDiffusionProfile=255.;\n#endif\ngl_FragData[PREPASS_IRRADIANCE_INDEX]=vec4(clamp(irradiance,vec3(0.),vec3(1.)),writeGeometryInfo*scatteringDiffusionProfile/255.); \n#elif defined(PREPASS_COLOR)\ngl_FragData[PREPASS_COLOR_INDEX]=vec4(finalColor.rgb,finalColor.a);\n#endif\n#ifdef PREPASS_DEPTH\ngl_FragData[PREPASS_DEPTH_INDEX]=vec4(vViewPos.z,0.0,0.0,writeGeometryInfo); \n#endif\n#ifdef PREPASS_SCREENSPACE_DEPTH\ngl_FragData[PREPASS_SCREENSPACE_DEPTH_INDEX]=vec4(gl_FragCoord.z,0.0,0.0,writeGeometryInfo);\n#endif\n#ifdef PREPASS_NORMALIZED_VIEW_DEPTH\ngl_FragData[PREPASS_NORMALIZED_VIEW_DEPTH_INDEX]=vec4(vNormViewDepth,0.0,0.0,writeGeometryInfo);\n#endif\n#ifdef PREPASS_NORMAL\n#ifdef PREPASS_NORMAL_WORLDSPACE\ngl_FragData[PREPASS_NORMAL_INDEX]=vec4(normalW,writeGeometryInfo);\n#else\ngl_FragData[PREPASS_NORMAL_INDEX]=vec4(normalize((view*vec4(normalW,0.0)).rgb),writeGeometryInfo);\n#endif\n#endif\n#ifdef PREPASS_WORLD_NORMAL\ngl_FragData[PREPASS_WORLD_NORMAL_INDEX]=vec4(normalW*0.5+0.5,writeGeometryInfo); \n#endif\n#ifdef PREPASS_ALBEDO_SQRT\ngl_FragData[PREPASS_ALBEDO_SQRT_INDEX]=vec4(sqAlbedo,writeGeometryInfo); \n#endif\n#ifdef PREPASS_REFLECTIVITY\n#ifndef UNLIT\ngl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(specularEnvironmentR0,microSurface)*writeGeometryInfo;\n#else\ngl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4( 0.0,0.0,0.0,1.0 )*writeGeometryInfo;\n#endif\n#endif\n#endif\n")},87283:(e,t,n)=>{n.r(t),n.d(t,{lightFragmentDeclaration:()=>a});var r=n(98519),i="lightFragmentDeclaration",o="#ifdef LIGHT{X}\nuniform vec4 vLightData{X};uniform vec4 vLightDiffuse{X};\n#ifdef SPECULARTERM\nuniform vec4 vLightSpecular{X};\n#else\nvec4 vLightSpecular{X}=vec4(0.);\n#endif\n#ifdef SHADOW{X}\n#ifdef SHADOWCSM{X}\nuniform mat4 lightMatrix{X}[SHADOWCSMNUM_CASCADES{X}];uniform float viewFrustumZ{X}[SHADOWCSMNUM_CASCADES{X}];uniform float frustumLengths{X}[SHADOWCSMNUM_CASCADES{X}];uniform float cascadeBlendFactor{X};varying vec4 vPositionFromLight{X}[SHADOWCSMNUM_CASCADES{X}];varying float vDepthMetric{X}[SHADOWCSMNUM_CASCADES{X}];varying vec4 vPositionFromCamera{X};\n#if defined(SHADOWPCSS{X})\nuniform highp sampler2DArrayShadow shadowTexture{X};uniform highp sampler2DArray depthTexture{X};uniform vec2 lightSizeUVCorrection{X}[SHADOWCSMNUM_CASCADES{X}];uniform float depthCorrection{X}[SHADOWCSMNUM_CASCADES{X}];uniform float penumbraDarkness{X};\n#elif defined(SHADOWPCF{X})\nuniform highp sampler2DArrayShadow shadowTexture{X};\n#else\nuniform highp sampler2DArray shadowTexture{X};\n#endif\n#ifdef SHADOWCSMDEBUG{X}\nconst vec3 vCascadeColorsMultiplier{X}[8]=vec3[8]\n(\nvec3 ( 1.5,0.0,0.0 ),\nvec3 ( 0.0,1.5,0.0 ),\nvec3 ( 0.0,0.0,5.5 ),\nvec3 ( 1.5,0.0,5.5 ),\nvec3 ( 1.5,1.5,0.0 ),\nvec3 ( 1.0,1.0,1.0 ),\nvec3 ( 0.0,1.0,5.5 ),\nvec3 ( 0.5,3.5,0.75 )\n);vec3 shadowDebug{X};\n#endif\n#ifdef SHADOWCSMUSESHADOWMAXZ{X}\nint index{X}=-1;\n#else\nint index{X}=SHADOWCSMNUM_CASCADES{X}-1;\n#endif\nfloat diff{X}=0.;\n#elif defined(SHADOWCUBE{X})\nuniform samplerCube shadowTexture{X};\n#else\nvarying vec4 vPositionFromLight{X};varying float vDepthMetric{X};\n#if defined(SHADOWPCSS{X})\nuniform highp sampler2DShadow shadowTexture{X};uniform highp sampler2D depthTexture{X};\n#elif defined(SHADOWPCF{X})\nuniform highp sampler2DShadow shadowTexture{X};\n#else\nuniform sampler2D shadowTexture{X};\n#endif\nuniform mat4 lightMatrix{X};\n#endif\nuniform vec4 shadowsInfo{X};uniform vec2 depthValues{X};\n#endif\n#ifdef SPOTLIGHT{X}\nuniform vec4 vLightDirection{X};uniform vec4 vLightFalloff{X};\n#elif defined(POINTLIGHT{X})\nuniform vec4 vLightFalloff{X};\n#elif defined(HEMILIGHT{X})\nuniform vec3 vLightGround{X};\n#endif\n#ifdef AREALIGHT{X}\nuniform vec4 vLightWidth{X};uniform vec4 vLightHeight{X};\n#endif\n#ifdef IESLIGHTTEXTURE{X}\nuniform sampler2D iesLightTexture{X};\n#endif\n#ifdef PROJECTEDLIGHTTEXTURE{X}\nuniform mat4 textureProjectionMatrix{X};uniform sampler2D projectionLightTexture{X};\n#endif\n#ifdef CLUSTLIGHT{X}\nuniform vec2 vSliceData{X};uniform vec2 vSliceRanges{X}[CLUSTLIGHT_SLICES];uniform sampler2D lightDataTexture{X};uniform highp sampler2D tileMaskTexture{X};\n#endif\n#endif\n";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]=o);var a={name:i,shader:o}},87851:(e,t,n)=>{n.r(t),n.d(t,{bilateralBlurPixelShader:()=>a});var r=n(98519),i="bilateralBlurPixelShader",o="uniform sampler2D textureSampler;uniform sampler2D depthSampler;uniform sampler2D normalSampler;uniform int filterSize;uniform vec2 blurDir;uniform float depthThreshold;uniform float normalThreshold;varying vec2 vUV;void main(void) {vec3 color=textureLod(textureSampler,vUV,0.).rgb;float depth=textureLod(depthSampler,vUV,0.).x;if (depth>=1e6 || depth<=0.) {glFragColor=vec4(color,1.);return;}\nvec3 normal=textureLod(normalSampler,vUV,0.).rgb;\n#ifdef DECODE_NORMAL\nnormal=normal*2.0-1.0;\n#endif\nfloat sigma=float(filterSize);float two_sigma2=2.0*sigma*sigma;float sigmaDepth=depthThreshold;float two_sigmaDepth2=2.0*sigmaDepth*sigmaDepth;float sigmaNormal=normalThreshold;float two_sigmaNormal2=2.0*sigmaNormal*sigmaNormal;vec3 sum=vec3(0.);float wsum=0.;for (int x=-filterSize; x<=filterSize; ++x) {vec2 coords=vec2(x);vec3 sampleColor=textureLod(textureSampler,vUV+coords*blurDir,0.).rgb;float sampleDepth=textureLod(depthSampler,vUV+coords*blurDir,0.).r;vec3 sampleNormal=textureLod(normalSampler,vUV+coords*blurDir,0.).rgb;\n#ifdef DECODE_NORMAL\nsampleNormal=sampleNormal*2.0-1.0;\n#endif\nfloat r=dot(coords,coords);float w=exp(-r/two_sigma2);float depthDelta=abs(sampleDepth-depth);float wd=step(depthDelta,depthThreshold);vec3 normalDelta=abs(sampleNormal-normal);float wn=step(normalDelta.x+normalDelta.y+normalDelta.z,normalThreshold);sum+=sampleColor*w*wd*wn;wsum+=w*wd*wn;}\nglFragColor=vec4(sum/wsum,1.);}\n";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},88099:(e,t,n)=>{n.d(t,{D:()=>c,Dx:()=>m,Es:()=>d,F4:()=>y,Gx:()=>S,K$:()=>f,KV:()=>h,Ko:()=>_,Nf:()=>b,P_:()=>T,Qd:()=>r,RI:()=>p,Sp:()=>g,U_:()=>C,Vv:()=>u,Yd:()=>P,aZ:()=>R,cZ:()=>v,k4:()=>x,x2:()=>E});var r,i=n(8046),o=n(64726),a=n(40099),s=n(81152),l=n(96832);!function(e){e.Any="any",e.String="string",e.Number="number",e.Boolean="boolean",e.Object="object",e.Integer="FlowGraphInteger",e.Vector2="Vector2",e.Vector3="Vector3",e.Vector4="Vector4",e.Quaternion="Quaternion",e.Matrix="Matrix",e.Matrix2D="Matrix2D",e.Matrix3D="Matrix3D",e.Color3="Color3",e.Color4="Color4"}(r||(r={}));var c=function(){function e(e,t,n){void 0===n&&(n=-1),this.typeName=e,this.defaultValue=t,this.animationType=n}return e.prototype.serialize=function(e){e.typeName=this.typeName,e.defaultValue=this.defaultValue},e}(),u=new c("any",void 0),h=new c("string",""),d=new c("number",0,s.Y.ANIMATIONTYPE_FLOAT),p=new c("boolean",!1),f=new c("Vector2",i.I9.Zero(),s.Y.ANIMATIONTYPE_VECTOR2),m=new c("Vector3",i.Pq.Zero(),s.Y.ANIMATIONTYPE_VECTOR3),_=new c("Vector4",i.IU.Zero()),g=new c("Matrix",i.uq.Identity(),s.Y.ANIMATIONTYPE_MATRIX),v=new c("Matrix2D",new l.K),y=new c("Matrix3D",new l.z),b=new c("Color3",o.v9.Black(),s.Y.ANIMATIONTYPE_COLOR3),S=new c("Color4",new o.ov(0,0,0,0),s.Y.ANIMATIONTYPE_COLOR4),T=new c("Quaternion",i.PT.Identity(),s.Y.ANIMATIONTYPE_QUATERNION);T.typeTransformer=function(e){if(e.getClassName){if("Vector4"===e.getClassName())return i.PT.FromArray(e.asArray());if("Vector3"===e.getClassName())return i.PT.FromEulerVector(e);if("Matrix"===e.getClassName())return i.PT.FromRotationMatrix(e)}return e};var E=new c("FlowGraphInteger",new a.P(0),s.Y.ANIMATIONTYPE_FLOAT);function x(e){var t=e;switch(typeof e){case"string":return h;case"number":return d;case"boolean":return p;case"object":if(t.getClassName)switch(t.getClassName()){case"Vector2":return f;case"Vector3":return m;case"Vector4":return _;case"Matrix":return g;case"Color3":return b;case"Color4":return S;case"Quaternion":return T;case"FlowGraphInteger":return E;case"Matrix2D":return v;case"Matrix3D":return y}return u;default:return u}}function P(e){switch(e){case"string":return h;case"number":return d;case"boolean":return p;case"Vector2":return f;case"Vector3":return m;case"Vector4":return _;case"Matrix":return g;case"Color3":return b;case"Color4":return S;case"Quaternion":return T;case"FlowGraphInteger":return E;case"Matrix2D":return v;case"Matrix3D":return y;default:return u}}function C(e){switch(e){case"number":default:return s.Y.ANIMATIONTYPE_FLOAT;case"Vector2":return s.Y.ANIMATIONTYPE_VECTOR2;case"Vector3":return s.Y.ANIMATIONTYPE_VECTOR3;case"Matrix":return s.Y.ANIMATIONTYPE_MATRIX;case"Color3":return s.Y.ANIMATIONTYPE_COLOR3;case"Color4":return s.Y.ANIMATIONTYPE_COLOR4;case"Quaternion":return s.Y.ANIMATIONTYPE_QUATERNION}}function R(e){switch(e){case s.Y.ANIMATIONTYPE_FLOAT:return d;case s.Y.ANIMATIONTYPE_VECTOR2:return f;case s.Y.ANIMATIONTYPE_VECTOR3:return m;case s.Y.ANIMATIONTYPE_MATRIX:return g;case s.Y.ANIMATIONTYPE_COLOR3:return b;case s.Y.ANIMATIONTYPE_COLOR4:return S;case s.Y.ANIMATIONTYPE_QUATERNION:return T;default:return u}}},88101:(e,t,n)=>{n.r(t),n.d(t,{screenSpaceReflection2BlurPixelShaderWGSL:()=>a});var r=n(98519),i="screenSpaceReflection2BlurPixelShader",o="var textureSamplerSampler: sampler;var textureSampler: texture_2d;varying vUV: vec2f;uniform texelOffsetScale: vec2f;const weights: array=array(0.071303,0.131514,0.189879,0.321392,0.452906, 0.584419,0.715932,0.847445);fn processSample(uv: vec2f,i: f32,stepSize: vec2f,accumulator: ptr,denominator: ptr)\n{var offsetUV: vec2f=stepSize*i+uv;var coefficient: f32=weights[ i32(2.0-abs(i))];*accumulator+=textureSampleLevel(textureSampler,textureSamplerSampler,offsetUV,0.0)*coefficient;*denominator+=coefficient;}\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var colorFull: vec4f=textureSampleLevel(textureSampler,textureSamplerSampler,input.vUV,0.0);if (dot(colorFull, vec4f(1.0))==0.0) {fragmentOutputs.color=colorFull;return fragmentOutputs;}\nvar blurRadius: f32=colorFull.a*255.0; \nvar stepSize: vec2f=uniforms.texelOffsetScale.xy*blurRadius;var accumulator: vec4f=textureSampleLevel(textureSampler,textureSamplerSampler,input.vUV,0.0)*0.214607;var denominator: f32=0.214607;processSample(input.vUV,1.0,stepSize,&accumulator,&denominator);processSample(input.vUV,1.0*0.2,stepSize,&accumulator,&denominator);processSample(input.vUV,1.0*0.4,stepSize,&accumulator,&denominator);processSample(input.vUV,1.0*0.6,stepSize,&accumulator,&denominator);processSample(input.vUV,1.0*0.8,stepSize,&accumulator,&denominator);processSample(input.vUV,1.0*1.2,stepSize,&accumulator,&denominator);processSample(input.vUV,1.0*1.4,stepSize,&accumulator,&denominator);processSample(input.vUV,1.0*1.6,stepSize,&accumulator,&denominator);processSample(input.vUV,1.0*1.8,stepSize,&accumulator,&denominator);processSample(input.vUV,1.0*2.0,stepSize,&accumulator,&denominator);processSample(input.vUV,-1.0,stepSize,&accumulator,&denominator);processSample(input.vUV,-1.0*0.2,stepSize,&accumulator,&denominator);processSample(input.vUV,-1.0*0.4,stepSize,&accumulator,&denominator);processSample(input.vUV,-1.0*0.6,stepSize,&accumulator,&denominator);processSample(input.vUV,-1.0*0.8,stepSize,&accumulator,&denominator);processSample(input.vUV,-1.0*1.2,stepSize,&accumulator,&denominator);processSample(input.vUV,-1.0*1.4,stepSize,&accumulator,&denominator);processSample(input.vUV,-1.0*1.6,stepSize,&accumulator,&denominator);processSample(input.vUV,-1.0*1.8,stepSize,&accumulator,&denominator);processSample(input.vUV,-1.0*2.0,stepSize,&accumulator,&denominator);fragmentOutputs.color= vec4f(accumulator.rgb/denominator,colorFull.a);}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},88188:(e,t,n)=>{n.d(t,{H:()=>i});var r=n(7164),i=function(){function e(t,n){if(this.data=t,this.isInvalid=!1,!e.IsValid(t))return this.isInvalid=!0,void r.V.Error("texture missing KTX identifier");var i=Uint32Array.BYTES_PER_ELEMENT,o=new DataView(this.data.buffer,this.data.byteOffset+12,13*i),a=67305985===o.getUint32(0,!0);return this.glType=o.getUint32(1*i,a),this.glTypeSize=o.getUint32(2*i,a),this.glFormat=o.getUint32(3*i,a),this.glInternalFormat=o.getUint32(4*i,a),this.glBaseInternalFormat=o.getUint32(5*i,a),this.pixelWidth=o.getUint32(6*i,a),this.pixelHeight=o.getUint32(7*i,a),this.pixelDepth=o.getUint32(8*i,a),this.numberOfArrayElements=o.getUint32(9*i,a),this.numberOfFaces=o.getUint32(10*i,a),this.numberOfMipmapLevels=o.getUint32(11*i,a),this.bytesOfKeyValueData=o.getUint32(12*i,a),0!==this.glType?(r.V.Error("only compressed formats currently supported"),void(this.isInvalid=!0)):(this.numberOfMipmapLevels=Math.max(1,this.numberOfMipmapLevels),0===this.pixelHeight||0!==this.pixelDepth?(r.V.Error("only 2D textures currently supported"),void(this.isInvalid=!0)):0!==this.numberOfArrayElements?(r.V.Error("texture arrays not currently supported"),void(this.isInvalid=!0)):this.numberOfFaces!==n?(r.V.Error("number of faces expected"+n+", but found "+this.numberOfFaces),void(this.isInvalid=!0)):void(this.loadType=e.COMPRESSED_2D))}return e.prototype.uploadLevels=function(t,n){switch(this.loadType){case e.COMPRESSED_2D:this._upload2DCompressedLevels(t,n);case e.TEX_2D:case e.COMPRESSED_3D:case e.TEX_3D:}},e.prototype._upload2DCompressedLevels=function(t,n){for(var r=e.HEADER_LEN+this.bytesOfKeyValueData,i=this.pixelWidth,o=this.pixelHeight,a=n?this.numberOfMipmapLevels:1,s=0;s=12){var t=new Uint8Array(e.buffer,e.byteOffset,12);if(171===t[0]&&75===t[1]&&84===t[2]&&88===t[3]&&32===t[4]&&49===t[5]&&49===t[6]&&187===t[7]&&13===t[8]&&10===t[9]&&26===t[10]&&10===t[11])return!0}return!1},e.HEADER_LEN=64,e.COMPRESSED_2D=0,e.COMPRESSED_3D=1,e.TEX_2D=2,e.TEX_3D=3,e}()},88261:(e,t,n)=>{var r=n(98519),i="pbrBlockImageProcessing";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="#if defined(IMAGEPROCESSINGPOSTPROCESS) || defined(SS_SCATTERING)\n#if !defined(SKIPFINALCOLORCLAMP)\nfinalColor=vec4f(clamp(finalColor.rgb,vec3f(0.),vec3f(30.0)),finalColor.a);\n#endif\n#else\nfinalColor=applyImageProcessing(finalColor);\n#endif\nfinalColor=vec4f(finalColor.rgb,finalColor.a*mesh.visibility);\n#ifdef PREMULTIPLYALPHA\nfinalColor=vec4f(finalColor.rgb*finalColor.a,finalColor.a);;\n#endif\n")},88309:(e,t,n)=>{n.d(t,{Hx:()=>S,Pu:()=>P,RZ:()=>b,UA:()=>A,cU:()=>y,gW:()=>D,o5:()=>C,ow:()=>M,p$:()=>I,qY:()=>N,ux:()=>x});var r=n(78322),i=n(44957),o=n(8046),a=n(48810),s=n(51428),l=n(19133),c=n(28081),u=n(81152),h=n(41409),d=n(30622),p=n(7164),f=n(97411),m=n(24687),_=(n(39813),"image/png"),g=2,v=[134,22,135,150,246,214,150,54];function y(e){for(var t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=0,r=0;rg)throw new Error('Unsupported babylon environment map version "'.concat(e.version,'". Latest supported version is "').concat(g,'".'));return 2===e.version?e:e=(0,r.Cl)((0,r.Cl)({},e),{version:2,imageType:_})}function S(e){return(0,r.sH)(this,arguments,void 0,(function(e,t){var n,i,o,s,l,c,d,p,f,m,y,b,S,x,P,C,R,A,I,O,M,D,N,F,L,w,B,V,U,G,k,z,W,H;return void 0===t&&(t={}),(0,r.YH)(this,(function(r){switch(r.label){case 0:return(n=e.getInternalTexture())?[3,2]:[4,Promise.reject("The cube texture is invalid.")];case 1:return[2,r.sent()];case 2:return i=n.getEngine(),e.textureType===u.Y.TEXTURETYPE_HALF_FLOAT||e.textureType===u.Y.TEXTURETYPE_FLOAT||e.textureType===u.Y.TEXTURETYPE_UNSIGNED_BYTE||e.textureType===u.Y.TEXTURETYPE_UNSIGNED_BYTE||e.textureType===u.Y.TEXTURETYPE_UNSIGNED_INTEGER||-1===e.textureType?[3,4]:[4,Promise.reject("The cube texture should allow HDR (Full Float or Half Float).")];case 3:return[2,r.sent()];case 4:return o=u.Y.TEXTURETYPE_FLOAT,i.getCaps().textureFloatRender?[3,6]:(o=u.Y.TEXTURETYPE_HALF_FLOAT,i.getCaps().textureHalfFloatRender?[3,6]:[4,Promise.reject("Env texture can only be created when the browser supports half float or full float rendering.")]);case 5:return[2,r.sent()];case 6:e.sphericalPolynomial,s=null===(z=e.getInternalTexture())||void 0===z?void 0:z._sphericalPolynomialPromise,l=n.width,c=new h.Z(i),d={},p={},i.flushFramebuffer(),f=null!==(W=t.imageType)&&void 0!==W?W:_,m=(0,a.ILog2)(n.width),U=0,r.label=7;case 7:if(!(U<=m))return[3,12];x=Math.pow(2,m-U),G=0,r.label=8;case 8:return G<6?(y=d,b=6*U+G,[4,T(c,e,o,G,U,x,f,t.imageQuality)]):[3,11];case 9:y[b]=r.sent(),r.label=10;case 10:return G++,[3,8];case 11:return U++,[3,7];case 12:if(!(S=t.disableIrradianceTexture?null:e.irradianceTexture))return[3,16];x=S.getSize().width,G=0,r.label=13;case 13:return G<6?(P=p,C=G,[4,T(c,S,o,G,0,x,f,t.imageQuality)]):[3,16];case 14:P[C]=r.sent(),r.label=15;case 15:return G++,[3,13];case 16:return c.dispose(),s?[4,s]:[3,18];case 17:r.sent(),r.label=18;case 18:for(R={version:g,width:l,imageType:f,irradiance:E(e),specular:{mipmaps:[],lodGenerationScale:e.lodGenerationScale}},A=0,U=0;U<=m;U++)for(G=0;G<6;G++)I=d[6*U+G].byteLength,R.specular.mipmaps.push({length:I,position:A}),A+=I;if(S)for(R.irradiance=R.irradiance||{x:[0,0,0],xx:[0,0,0],y:[0,0,0],yy:[0,0,0],z:[0,0,0],zz:[0,0,0],yz:[0,0,0],zx:[0,0,0],xy:[0,0,0]},R.irradiance.irradianceTexture={size:S.getSize().width,faces:[],dominantDirection:null===(H=S._dominantDirection)||void 0===H?void 0:H.asArray()},G=0;G<6;G++)I=p[G].byteLength,R.irradiance.irradianceTexture.faces.push({length:I,position:A}),A+=I;for(O=JSON.stringify(R),M=new ArrayBuffer(O.length+1),D=new Uint8Array(M),U=0,N=O.length;U{n.r(t),n.d(t,{screenSpaceReflection2BlurCombinerPixelShader:()=>a});var r=n(98519),i=(n(75334),n(64244),n(93664),"screenSpaceReflection2BlurCombinerPixelShader"),o="uniform sampler2D textureSampler; \nuniform sampler2D mainSampler;uniform sampler2D reflectivitySampler;uniform float strength;uniform float reflectionSpecularFalloffExponent;uniform float reflectivityThreshold;varying vec2 vUV;\n#include\n#ifdef SSR_BLEND_WITH_FRESNEL\n#include\n#include\nuniform mat4 projection;uniform mat4 invProjectionMatrix;\n#ifdef SSR_NORMAL_IS_IN_WORLDSPACE\nuniform mat4 view;\n#endif\nuniform sampler2D normalSampler;uniform sampler2D depthSampler;\n#ifdef SSRAYTRACE_SCREENSPACE_DEPTH\nuniform float nearPlaneZ;uniform float farPlaneZ;\n#endif\n#endif\nvoid main()\n{\n#ifdef SSRAYTRACE_DEBUG\ngl_FragColor=texture2D(textureSampler,vUV);\n#else\nvec3 SSR=texture2D(textureSampler,vUV).rgb;vec4 color=texture2D(mainSampler,vUV);vec4 reflectivity=texture2D(reflectivitySampler,vUV);\n#ifndef SSR_DISABLE_REFLECTIVITY_TEST\nif (max(reflectivity.r,max(reflectivity.g,reflectivity.b))<=reflectivityThreshold) {gl_FragColor=color;return;}\n#endif\n#ifdef SSR_INPUT_IS_GAMMA_SPACE\ncolor=toLinearSpace(color);\n#endif\n#ifdef SSR_BLEND_WITH_FRESNEL\nvec2 texSize=vec2(textureSize(depthSampler,0));vec3 csNormal=texelFetch(normalSampler,ivec2(vUV*texSize),0).xyz;\n#ifdef SSR_DECODE_NORMAL\ncsNormal=csNormal*2.0-1.0;\n#endif\n#ifdef SSR_NORMAL_IS_IN_WORLDSPACE\ncsNormal=(view*vec4(csNormal,0.0)).xyz;\n#endif\nfloat depth=texelFetch(depthSampler,ivec2(vUV*texSize),0).r;\n#ifdef SSRAYTRACE_SCREENSPACE_DEPTH\ndepth=linearizeDepth(depth,nearPlaneZ,farPlaneZ);\n#endif\nvec3 csPosition=computeViewPosFromUVDepth(vUV,depth,projection,invProjectionMatrix);vec3 csViewDirection=normalize(csPosition);vec3 F0=reflectivity.rgb;vec3 fresnel=fresnelSchlickGGX(max(dot(csNormal,-csViewDirection),0.0),F0,vec3(1.));vec3 reflectionMultiplier=clamp(pow(fresnel*strength,vec3(reflectionSpecularFalloffExponent)),0.0,1.0);\n#else\nvec3 reflectionMultiplier=clamp(pow(reflectivity.rgb*strength,vec3(reflectionSpecularFalloffExponent)),0.0,1.0);\n#endif\nvec3 colorMultiplier=1.0-reflectionMultiplier;vec3 finalColor=(color.rgb*colorMultiplier)+(SSR*reflectionMultiplier);\n#ifdef SSR_OUTPUT_IS_GAMMA_SPACE\nfinalColor=toGammaSpace(finalColor);\n#endif\ngl_FragColor=vec4(finalColor,color.a);\n#endif\n}\n";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},88380:(e,t,n)=>{var r=n(98519),i="samplerVertexImplementation";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="#if defined(_DEFINENAME_) && _DEFINENAME_DIRECTUV==0\nif (uniforms.v_INFONAME_==0.)\n{vertexOutputs.v_VARYINGNAME_UV= (uniforms._MATRIXNAME_Matrix* vec4f(uvUpdated,1.0,0.0)).xy;}\n#ifdef UV2\nelse if (uniforms.v_INFONAME_==1.)\n{vertexOutputs.v_VARYINGNAME_UV= (uniforms._MATRIXNAME_Matrix* vec4f(uv2Updated,1.0,0.0)).xy;}\n#endif\n#ifdef UV3\nelse if (uniforms.v_INFONAME_==2.)\n{vertexOutputs.v_VARYINGNAME_UV= (uniforms._MATRIXNAME_Matrix* vec4f(vertexInputs.uv3,1.0,0.0)).xy;}\n#endif\n#ifdef UV4\nelse if (uniforms.v_INFONAME_==3.)\n{vertexOutputs.v_VARYINGNAME_UV= (uniforms._MATRIXNAME_Matrix* vec4f(vertexInputs.uv4,1.0,0.0)).xy;}\n#endif\n#ifdef UV5\nelse if (uniforms.v_INFONAME_==4.)\n{vertexOutputs.v_VARYINGNAME_UV= (uniforms._MATRIXNAME_Matrix* vec4f(vertexInputs.uv5,1.0,0.0)).xy;}\n#endif\n#ifdef UV6\nelse if (uniforms.v_INFONAME_==5.)\n{vertexOutputs.v_VARYINGNAME_UV= (uniforms._MATRIXNAME_Matrix* vec4f(vertexInputs.uv6,1.0,0.0)).xy;}\n#endif\n#endif\n")},88456:(e,t,n)=>{n.r(t),n.d(t,{depthOfFieldMergePixelShader:()=>a});var r=n(98519),i="depthOfFieldMergePixelShader",o="#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\n#define TEXTUREFUNC(s,c,lod) texture2DLodEXT(s,c,lod)\n#else\n#define TEXTUREFUNC(s,c,bias) texture2D(s,c,bias)\n#endif\nuniform sampler2D textureSampler;varying vec2 vUV;uniform sampler2D circleOfConfusionSampler;uniform sampler2D blurStep0;\n#if BLUR_LEVEL>0\nuniform sampler2D blurStep1;\n#endif\n#if BLUR_LEVEL>1\nuniform sampler2D blurStep2;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{float coc=TEXTUREFUNC(circleOfConfusionSampler,vUV,0.0).r;\n#if BLUR_LEVEL==0\nvec4 original=TEXTUREFUNC(textureSampler,vUV,0.0);vec4 blurred0=TEXTUREFUNC(blurStep0,vUV,0.0);gl_FragColor=mix(original,blurred0,coc);\n#endif\n#if BLUR_LEVEL==1\nif(coc<0.5){vec4 original=TEXTUREFUNC(textureSampler,vUV,0.0);vec4 blurred1=TEXTUREFUNC(blurStep1,vUV,0.0);gl_FragColor=mix(original,blurred1,coc/0.5);}else{vec4 blurred0=TEXTUREFUNC(blurStep0,vUV,0.0);vec4 blurred1=TEXTUREFUNC(blurStep1,vUV,0.0);gl_FragColor=mix(blurred1,blurred0,(coc-0.5)/0.5);}\n#endif\n#if BLUR_LEVEL==2\nif(coc<0.33){vec4 original=TEXTUREFUNC(textureSampler,vUV,0.0);vec4 blurred2=TEXTUREFUNC(blurStep2,vUV,0.0);gl_FragColor=mix(original,blurred2,coc/0.33);}else if(coc<0.66){vec4 blurred1=TEXTUREFUNC(blurStep1,vUV,0.0);vec4 blurred2=TEXTUREFUNC(blurStep2,vUV,0.0);gl_FragColor=mix(blurred2,blurred1,(coc-0.33)/0.33);}else{vec4 blurred0=TEXTUREFUNC(blurStep0,vUV,0.0);vec4 blurred1=TEXTUREFUNC(blurStep1,vUV,0.0);gl_FragColor=mix(blurred1,blurred0,(coc-0.66)/0.34);}\n#endif\n}\n";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},88469:(e,t,n)=>{n.d(t,{w:()=>i});var r=n(78322),i=function(e){function t(t){var n=e.call(this,t)||this;return n.out=n._registerSignalOutput("out"),n}return(0,r.C6)(t,e),t}(n(88677).u)},88677:(e,t,n)=>{n.d(t,{u:()=>a});var r=n(78322),i=n(45749),o=n(6834),a=function(e){function t(t){var n=e.call(this,t)||this;return n.priority=0,n.signalInputs=[],n.signalOutputs=[],n.in=n._registerSignalInput("in"),n.error=n._registerSignalOutput("error"),n}return(0,r.C6)(t,e),t.prototype._registerSignalInput=function(e){var t=new o.R(e,0,this);return this.signalInputs.push(t),t},t.prototype._registerSignalOutput=function(e){var t=new o.R(e,1,this);return this.signalOutputs.push(t),t},t.prototype._unregisterSignalInput=function(e){var t=this.signalInputs.findIndex((function(t){return t.name===e}));-1!==t&&(this.signalInputs[t].dispose(),this.signalInputs.splice(t,1))},t.prototype._unregisterSignalOutput=function(e){var t=this.signalOutputs.findIndex((function(t){return t.name===e}));-1!==t&&(this.signalOutputs[t].dispose(),this.signalOutputs.splice(t,1))},t.prototype._reportError=function(e,t){this.error.payload="string"==typeof t?new Error(t):t,this.error._activateSignal(e)},t.prototype.getSignalInput=function(e){return this.signalInputs.find((function(t){return t.name===e}))},t.prototype.getSignalOutput=function(e){return this.signalOutputs.find((function(t){return t.name===e}))},t.prototype.serialize=function(t){void 0===t&&(t={}),e.prototype.serialize.call(this,t),t.signalInputs=[],t.signalOutputs=[];for(var n=0,r=this.signalInputs;n{n.r(t),n.d(t,{hdrFilteringVertexShader:()=>a});var r=n(98519),i="hdrFilteringVertexShader",o="attribute vec2 position;varying vec3 direction;uniform vec3 up;uniform vec3 right;uniform vec3 front;\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nmat3 view=mat3(up,right,front);direction=view*vec3(position,1.0);gl_Position=vec4(position,0.0,1.0);\n#define CUSTOM_VERTEX_MAIN_END\n}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},88977:(e,t,n)=>{n.r(t),n.d(t,{colorCorrectionPixelShader:()=>a});var r=n(98519),i="colorCorrectionPixelShader",o="uniform sampler2D textureSampler; \nuniform sampler2D colorTable; \nvarying vec2 vUV;const float SLICE_COUNT=16.0; \n#define inline\nvec4 sampleAs3DTexture(sampler2D textureSampler,vec3 uv,float width) {float sliceSize=1.0/width; \nfloat slicePixelSize=sliceSize/width; \nfloat sliceInnerSize=slicePixelSize*(width-1.0); \nfloat zSlice0=min(floor(uv.z*width),width-1.0);float zSlice1=min(zSlice0+1.0,width-1.0);float xOffset=slicePixelSize*0.5+uv.x*sliceInnerSize;float s0=xOffset+(zSlice0*sliceSize);float s1=xOffset+(zSlice1*sliceSize);vec4 slice0Color=texture2D(textureSampler,vec2(s0,uv.y));vec4 slice1Color=texture2D(textureSampler,vec2(s1,uv.y));float zOffset=mod(uv.z*width,1.0);vec4 result=mix(slice0Color,slice1Color,zOffset);return result;}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{vec4 screen_color=texture2D(textureSampler,vUV);gl_FragColor=sampleAs3DTexture(colorTable,screen_color.rgb,SLICE_COUNT);}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},88996:(e,t,n)=>{n.r(t),n.d(t,{FlowGraphSceneTickEventBlock:()=>s});var r=n(78322),i=n(90279),o=n(34623),a=n(88099),s=function(e){function t(){var t=e.call(this)||this;return t.type="SceneBeforeRender",t.timeSinceStart=t.registerDataOutput("timeSinceStart",a.Es),t.deltaTime=t.registerDataOutput("deltaTime",a.Es),t}return(0,r.C6)(t,e),t.prototype._preparePendingTasks=function(e){},t.prototype._executeEvent=function(e,t){return this.timeSinceStart.setValue(t.timeSinceStart,e),this.deltaTime.setValue(t.deltaTime,e),this._execute(e),!0},t.prototype._cancelPendingTasks=function(e){},t.prototype.getClassName=function(){return"FlowGraphSceneTickEventBlock"},t}(i.i);(0,o.Y5)("FlowGraphSceneTickEventBlock",s)},89021:(e,t,n)=>{n.d(t,{O:()=>r,m:()=>i});var r=0,i=1},89111:(e,t,n)=>{n.r(t),n.d(t,{anaglyphPixelShaderWGSL:()=>a});var r=n(98519),i="anaglyphPixelShader",o="varying vUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d;var leftSamplerSampler: sampler;var leftSampler: texture_2d;\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var leftFrag: vec4f=textureSample(leftSampler,leftSamplerSampler,input.vUV);leftFrag= vec4f(1.0,leftFrag.g,leftFrag.b,1.0);var rightFrag: vec4f=textureSample(textureSampler,textureSamplerSampler,input.vUV);rightFrag= vec4f(rightFrag.r,1.0,1.0,1.0);fragmentOutputs.color= vec4f(rightFrag.rgb*leftFrag.rgb,1.0);}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},89493:(e,t,n)=>{n.r(t),n.d(t,{spritesPixelShaderWGSL:()=>s});var r=n(98519),i=(n(98318),n(38197),n(56897),n(83512),"imageProcessingCompatibility");r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="#ifdef IMAGEPROCESSINGPOSTPROCESS\nfragmentOutputs.color=vec4f(pow(fragmentOutputs.color.rgb, vec3f(2.2)),fragmentOutputs.color.a);\n#endif\n");var o="spritesPixelShader",a="uniform alphaTest: i32;varying vColor: vec4f;varying vUV: vec2f;var diffuseSamplerSampler: sampler;var diffuseSampler: texture_2d;\n#include\n#include\n#define CUSTOM_FRAGMENT_DEFINITIONS\n#ifdef PIXEL_PERFECT\nfn uvPixelPerfect(uv: vec2f)->vec2f {var res: vec2f= vec2f(textureDimensions(diffuseSampler,0));var uvTemp=uv*res;var seam: vec2f=floor(uvTemp+0.5);uvTemp=seam+clamp((uvTemp-seam)/fwidth(uvTemp),vec2f(-0.5),vec2f(0.5));return uvTemp/res;}\n#endif\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#ifdef PIXEL_PERFECT\nvar uv: vec2f=uvPixelPerfect(input.vUV);\n#else\nvar uv: vec2f=input.vUV;\n#endif\nvar color: vec4f=textureSample(diffuseSampler,diffuseSamplerSampler,uv);var fAlphaTest: f32= f32(uniforms.alphaTest);if (fAlphaTest != 0.)\n{if (color.a<0.95) {discard;}}\ncolor*=input.vColor;\n#include\n#include\nfragmentOutputs.color=color;\n#include\n#define CUSTOM_FRAGMENT_MAIN_END\n}";r.l.ShadersStoreWGSL[o]||(r.l.ShadersStoreWGSL[o]=a);var s={name:o,shader:a}},89950:(e,t,n)=>{n.r(t),n.d(t,{sharpenPixelShaderWGSL:()=>a});var r=n(98519),i="sharpenPixelShader",o="varying vUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d;uniform screenSize: vec2f;uniform sharpnessAmounts: vec2f;\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var onePixel: vec2f= vec2f(1.0,1.0)/uniforms.screenSize;var color: vec4f=textureSample(textureSampler,textureSamplerSampler,input.vUV);var edgeDetection: vec4f=textureSample(textureSampler,textureSamplerSampler,input.vUV+onePixel*vec2f(0,-1)) +\ntextureSample(textureSampler,textureSamplerSampler,input.vUV+onePixel*vec2f(-1,0)) +\ntextureSample(textureSampler,textureSamplerSampler,input.vUV+onePixel*vec2f(1,0)) +\ntextureSample(textureSampler,textureSamplerSampler,input.vUV+onePixel*vec2f(0,1)) -\ncolor*4.0;fragmentOutputs.color=max(vec4f(color.rgb*uniforms.sharpnessAmounts.y,color.a)-(uniforms.sharpnessAmounts.x* vec4f(edgeDetection.rgb,0)),vec4f(0.));}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},89967:(e,t,n)=>{n.r(t),n.d(t,{lensFlarePixelShaderWGSL:()=>a});var r=n(98519),i="lensFlarePixelShader",o="varying vUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d;uniform color: vec4f;\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\nvar baseColor: vec4f=textureSample(textureSampler,textureSamplerSampler,input.vUV);fragmentOutputs.color=baseColor*uniforms.color;\n#define CUSTOM_FRAGMENT_MAIN_END\n}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},90075:(e,t,n)=>{n.r(t),n.d(t,{FlowGraphTransformCoordinatesSystemBlock:()=>l});var r=n(78322),i=n(45749),o=n(88099),a=n(8046),s=n(34623),l=function(e){function t(t){var n=e.call(this,t)||this;return n.sourceSystem=n.registerDataInput("sourceSystem",o.Vv),n.destinationSystem=n.registerDataInput("destinationSystem",o.Vv),n.inputCoordinates=n.registerDataInput("inputCoordinates",o.Dx),n.outputCoordinates=n.registerDataOutput("outputCoordinates",o.Dx),n}return(0,r.C6)(t,e),t.prototype._updateOutputs=function(e){var t=this.sourceSystem.getValue(e),n=this.destinationSystem.getValue(e),r=this.inputCoordinates.getValue(e),i=t.getWorldMatrix(),o=n.getWorldMatrix(),s=a.AA.Matrix[0].copyFrom(o);s.invert();var l=a.AA.Matrix[1];s.multiplyToRef(i,l);var c=this.outputCoordinates.getValue(e);a.Pq.TransformCoordinatesToRef(r,l,c)},t.prototype.getClassName=function(){return"FlowGraphTransformCoordinatesSystemBlock"},t}(i.e);(0,s.Y5)("FlowGraphTransformCoordinatesSystemBlock",l)},90130:(e,t,n)=>{var r=n(98519),i="pbrBlockImageProcessing";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#if defined(IMAGEPROCESSINGPOSTPROCESS) || defined(SS_SCATTERING)\n#if !defined(SKIPFINALCOLORCLAMP)\nfinalColor.rgb=clamp(finalColor.rgb,0.,30.0);\n#endif\n#else\nfinalColor=applyImageProcessing(finalColor);\n#endif\nfinalColor.a*=visibility;\n#ifdef PREMULTIPLYALPHA\nfinalColor.rgb*=finalColor.a;\n#endif\n")},90253:(e,t,n)=>{var r=n(98519),i="boundingBoxRendererUboDeclaration";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#ifdef WEBGL2\nuniform vec4 color;uniform mat4 world;uniform mat4 viewProjection;\n#ifdef MULTIVIEW\nuniform mat4 viewProjectionR;\n#endif\n#else\nlayout(std140,column_major) uniform;uniform BoundingBoxRenderer {vec4 color;mat4 world;mat4 viewProjection;mat4 viewProjectionR;};\n#endif\n")},90279:(e,t,n)=>{n.d(t,{i:()=>i});var r=n(78322),i=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.initPriority=0,t.type="NoTrigger",t}return(0,r.C6)(t,e),t.prototype._execute=function(e){e._notifyExecuteNode(this),this.done._activateSignal(e)},t}(n(21379).M)},90453:(e,t,n)=>{n.r(t),n.d(t,{iblVoxelGridVertexShader:()=>a});var r=n(98519),i=(n(36470),n(64400),n(38615),n(24444),n(67369),n(58266),n(84589),n(35397),n(76898),n(49334),"iblVoxelGridVertexShader"),o="attribute vec3 position;varying vec3 vNormalizedPosition;\n#include\n#include\n#include\n#include\n#include[0..maxSimultaneousMorphTargets]\nuniform mat4 invWorldScale;uniform mat4 viewMatrix;void main(void) {vec3 positionUpdated=position;\n#include\n#include[0..maxSimultaneousMorphTargets]\n#include\n#include\n#include\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);gl_Position=viewMatrix*invWorldScale*worldPos;vNormalizedPosition.xyz=gl_Position.xyz*0.5+0.5;\n#ifdef IS_NDC_HALF_ZRANGE\ngl_Position.z=gl_Position.z*0.5+0.5;\n#endif\n}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},90519:(e,t,n)=>{n.d(t,{d:()=>r});var r=function(){function e(e,t){if(void 0===e&&(e=null),this._MSAARenderBuffers=null,this._context=t,!e&&!(e=t.createTexture()))throw new Error("Unable to create webGL texture");this.set(e)}return Object.defineProperty(e.prototype,"underlyingResource",{get:function(){return this._webGLTexture},enumerable:!1,configurable:!0}),e.prototype.setUsage=function(){},e.prototype.set=function(e){this._webGLTexture=e},e.prototype.reset=function(){this._webGLTexture=null,this._MSAARenderBuffers=null},e.prototype.addMSAARenderBuffer=function(e){this._MSAARenderBuffers||(this._MSAARenderBuffers=[]),this._MSAARenderBuffers.push(e)},e.prototype.releaseMSAARenderBuffers=function(){if(this._MSAARenderBuffers){for(var e=0,t=this._MSAARenderBuffers;e{n.r(t),n.d(t,{iblVoxelGridVertexShaderWGSL:()=>a});var r=n(98519),i=(n(45699),n(27279),n(63866),n(73683),n(68478),n(98819),n(77320),n(21310),n(3641),n(86615),"iblVoxelGridVertexShader"),o="attribute position: vec3f;varying vNormalizedPosition: vec3f;\n#include\n#include\n#include\n#include\n#include[0..maxSimultaneousMorphTargets]\nuniform invWorldScale: mat4x4f;uniform viewMatrix: mat4x4f;@vertex\nfn main(input : VertexInputs)->FragmentInputs {var positionUpdated=vertexInputs.position;\n#include\n#include[0..maxSimultaneousMorphTargets]\n#include\n#include\n#include\nlet worldPos=finalWorld*vec4f(positionUpdated,1.0);vertexOutputs.position=uniforms.viewMatrix*uniforms.invWorldScale*worldPos;vertexOutputs.vNormalizedPosition=vertexOutputs.position.xyz*0.5+0.5;\n#ifdef IS_NDC_HALF_ZRANGE\nvertexOutputs.position=vec4f(vertexOutputs.position.x,vertexOutputs.position.y,vertexOutputs.position.z*0.5+0.5,vertexOutputs.position.w);\n#endif\n}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},90821:(e,t,n)=>{n.r(t),n.d(t,{particlesPixelShader:()=>a});var r=n(98519),i=(n(27003),n(59581),n(59262),n(75334),n(40688),n(52767),n(39643),n(13088),n(86343),"particlesPixelShader"),o="#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\nvarying vec2 vUV;varying vec4 vColor;uniform vec4 textureMask;uniform sampler2D diffuseSampler;\n#include\n#include\n#include\n#include\n#include\n#ifdef RAMPGRADIENT\nvarying vec4 remapRanges;uniform sampler2D rampSampler;\n#endif\n#include\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include\nvec4 textureColor=texture2D(diffuseSampler,vUV);vec4 baseColor=(textureColor*textureMask+(vec4(1.,1.,1.,1.)-textureMask))*vColor;\n#ifdef RAMPGRADIENT\nfloat alpha=baseColor.a;float remappedColorIndex=clamp((alpha-remapRanges.x)/remapRanges.y,0.0,1.0);vec4 rampColor=texture2D(rampSampler,vec2(1.0-remappedColorIndex,0.));baseColor.rgb*=rampColor.rgb;float finalAlpha=baseColor.a;baseColor.a=clamp((alpha*rampColor.a-remapRanges.z)/remapRanges.w,0.0,1.0);\n#endif\n#ifdef BLENDMULTIPLYMODE\nfloat sourceAlpha=vColor.a*textureColor.a;baseColor.rgb=baseColor.rgb*sourceAlpha+vec3(1.0)*(1.0-sourceAlpha);\n#endif\n#include\n#include(color,baseColor)\n#ifdef IMAGEPROCESSINGPOSTPROCESS\nbaseColor.rgb=toLinearSpace(baseColor.rgb);\n#else\n#ifdef IMAGEPROCESSING\nbaseColor.rgb=toLinearSpace(baseColor.rgb);baseColor=applyImageProcessing(baseColor);\n#endif\n#endif\ngl_FragColor=baseColor;\n#define CUSTOM_FRAGMENT_MAIN_END\n}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},91016:(e,t,n)=>{n.d(t,{Cf:()=>i,bu:()=>a,lc:()=>s,tG:()=>o});var r=n(78322),i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,r.C6)(t,e),t._setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},t}(Error),o={MeshInvalidPositionsError:0,UnsupportedTextureError:1e3,GLTFLoaderUnexpectedMagicError:2e3,SceneLoaderError:3e3,LoadFileError:4e3,RequestFileError:4001,ReadFileError:4002},a=function(e){function t(n,r,o){var a=e.call(this,n)||this;return a.errorCode=r,a.innerError=o,a.name="RuntimeError",i._setPrototypeOf(a,t.prototype),a}return(0,r.C6)(t,e),t}(i),s=function(e){function t(n){void 0===n&&(n="Operation aborted");var r=e.call(this,n)||this;return r.name="AbortError",i._setPrototypeOf(r,t.prototype),r}return(0,r.C6)(t,e),t}(i)},91209:(e,t,n)=>{n.r(t),n.d(t,{rsmFullGlobalIlluminationPixelShader:()=>a});var r=n(98519),i="rsmFullGlobalIlluminationPixelShader",o="/**\n* The implementation is a direct application of the formula found in http:\n*/\nprecision highp float;varying vec2 vUV;uniform mat4 rsmLightMatrix;uniform vec4 rsmInfo;uniform sampler2D textureSampler;uniform sampler2D normalSampler;uniform sampler2D rsmPositionW;uniform sampler2D rsmNormalW;uniform sampler2D rsmFlux;\n#ifdef TRANSFORM_NORMAL\nuniform mat4 invView;\n#endif\nvec3 computeIndirect(vec3 p,vec3 n) {vec3 indirectDiffuse=vec3(0.);float intensity=rsmInfo.z;float edgeArtifactCorrection=rsmInfo.w;vec4 texRSM=rsmLightMatrix*vec4(p,1.);texRSM.xy/=texRSM.w;texRSM.xy=texRSM.xy*0.5+0.5;int width=int(rsmInfo.x);int height=int(rsmInfo.y);for (int j=0; j{n.r(t),n.d(t,{FlowGraphSceneReadyEventBlock:()=>a});var r=n(78322),i=n(90279),o=n(34623),a=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.initPriority=-1,t.type="SceneReady",t}return(0,r.C6)(t,e),t.prototype._executeEvent=function(e,t){return this._execute(e),!0},t.prototype._preparePendingTasks=function(e){},t.prototype._cancelPendingTasks=function(e){},t.prototype.getClassName=function(){return"FlowGraphSceneReadyEventBlock"},t}(i.i);(0,o.Y5)("FlowGraphSceneReadyEventBlock",a)},91906:(e,t,n)=>{n.d(t,{Q:()=>a});var r=n(98519),i="gaussianSplattingVertexDeclaration",o="attribute vec2 position;uniform mat4 view;uniform mat4 projection;uniform mat4 world;uniform vec4 vEyePosition;";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]=o);var a={name:i,shader:o}},91946:(e,t,n)=>{n.d(t,{c:()=>r});var r=function(){function e(){}return e.CompareLightsPriority=function(e,t){return e.shadowEnabled!==t.shadowEnabled?(t.shadowEnabled?1:0)-(e.shadowEnabled?1:0):t.renderPriority-e.renderPriority},e.FALLOFF_DEFAULT=0,e.FALLOFF_PHYSICAL=1,e.FALLOFF_GLTF=2,e.FALLOFF_STANDARD=3,e.LIGHTMAP_DEFAULT=0,e.LIGHTMAP_SPECULAR=1,e.LIGHTMAP_SHADOWSONLY=2,e.INTENSITYMODE_AUTOMATIC=0,e.INTENSITYMODE_LUMINOUSPOWER=1,e.INTENSITYMODE_LUMINOUSINTENSITY=2,e.INTENSITYMODE_ILLUMINANCE=3,e.INTENSITYMODE_LUMINANCE=4,e.LIGHTTYPEID_POINTLIGHT=0,e.LIGHTTYPEID_DIRECTIONALLIGHT=1,e.LIGHTTYPEID_SPOTLIGHT=2,e.LIGHTTYPEID_HEMISPHERICLIGHT=3,e.LIGHTTYPEID_RECT_AREALIGHT=4,e.LIGHTTYPEID_CLUSTERED_CONTAINER=5,e}()},91952:(e,t,n)=>{n.r(t),n.d(t,{FlowGraphConsoleLogBlock:()=>l});var r=n(78322),i=n(88469),o=n(88099),a=n(34623),s=n(7164),l=function(e){function t(t){var n=e.call(this,t)||this;if(n.message=n.registerDataInput("message",o.Vv),n.logType=n.registerDataInput("logType",o.Vv,"log"),null==t?void 0:t.messageTemplate)for(var r=0,i=n._getTemplateMatches(t.messageTemplate);r{n.r(t),n.d(t,{bloomMergePixelShaderWGSL:()=>a});var r=n(98519),i="bloomMergePixelShader",o="varying vUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d;var bloomBlurSampler: sampler;var bloomBlur: texture_2d;uniform bloomWeight: f32;\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {fragmentOutputs.color=textureSample(textureSampler,textureSamplerSampler,input.vUV);var blurred: vec3f=textureSample(bloomBlur,bloomBlurSampler,input.vUV).rgb;fragmentOutputs.color=vec4f(fragmentOutputs.color.rgb+(blurred.rgb*uniforms.bloomWeight),fragmentOutputs.color.a);}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},92118:(e,t,n)=>{function r(e){return void 0===e.getPipelineContext}n.d(t,{E:()=>r})},92142:(e,t,n)=>{var r=n(82673),i=n(81152);r.$.prototype.setAlphaEquation=function(e,t){if(void 0===t&&(t=0),this._alphaEquation[t]!==e){switch(e){case i.Y.ALPHA_EQUATION_ADD:this._alphaState.setAlphaEquationParameters(i.Y.GL_ALPHA_EQUATION_ADD,i.Y.GL_ALPHA_EQUATION_ADD,t);break;case i.Y.ALPHA_EQUATION_SUBSTRACT:this._alphaState.setAlphaEquationParameters(i.Y.GL_ALPHA_EQUATION_SUBTRACT,i.Y.GL_ALPHA_EQUATION_SUBTRACT,t);break;case i.Y.ALPHA_EQUATION_REVERSE_SUBTRACT:this._alphaState.setAlphaEquationParameters(i.Y.GL_ALPHA_EQUATION_REVERSE_SUBTRACT,i.Y.GL_ALPHA_EQUATION_REVERSE_SUBTRACT,t);break;case i.Y.ALPHA_EQUATION_MAX:this._alphaState.setAlphaEquationParameters(i.Y.GL_ALPHA_EQUATION_MAX,i.Y.GL_ALPHA_EQUATION_MAX,t);break;case i.Y.ALPHA_EQUATION_MIN:this._alphaState.setAlphaEquationParameters(i.Y.GL_ALPHA_EQUATION_MIN,i.Y.GL_ALPHA_EQUATION_MIN,t);break;case i.Y.ALPHA_EQUATION_DARKEN:this._alphaState.setAlphaEquationParameters(i.Y.GL_ALPHA_EQUATION_MIN,i.Y.GL_ALPHA_EQUATION_ADD,t)}this._alphaEquation[t]=e}}},92228:(e,t,n)=>{n.r(t),n.d(t,{iblGenerateVoxelMipPixelShader:()=>a});var r=n(98519),i="iblGenerateVoxelMipPixelShader",o="precision highp float;precision highp sampler3D;varying vec2 vUV;uniform sampler3D srcMip;uniform int layerNum;void main(void) {ivec3 Coords=ivec3(2)*ivec3(gl_FragCoord.x,gl_FragCoord.y,layerNum);uint tex =\nuint(texelFetch(srcMip,Coords+ivec3(0,0,0),0).x>0.0f ? 1u : 0u)\n<< 0u |\nuint(texelFetch(srcMip,Coords+ivec3(1,0,0),0).x>0.0f ? 1u : 0u)\n<< 1u |\nuint(texelFetch(srcMip,Coords+ivec3(0,1,0),0).x>0.0f ? 1u : 0u)\n<< 2u |\nuint(texelFetch(srcMip,Coords+ivec3(1,1,0),0).x>0.0f ? 1u : 0u)\n<< 3u |\nuint(texelFetch(srcMip,Coords+ivec3(0,0,1),0).x>0.0f ? 1u : 0u)\n<< 4u |\nuint(texelFetch(srcMip,Coords+ivec3(1,0,1),0).x>0.0f ? 1u : 0u)\n<< 5u |\nuint(texelFetch(srcMip,Coords+ivec3(0,1,1),0).x>0.0f ? 1u : 0u)\n<< 6u |\nuint(texelFetch(srcMip,Coords+ivec3(1,1,1),0).x>0.0f ? 1u : 0u)\n<< 7u;glFragColor.rgb=vec3(float(tex)/255.0f,0.0f,0.0f);glFragColor.a=1.0;}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},92331:(e,t,n)=>{var r=n(98519),i="fresnelFunction";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="#ifdef FRESNEL\nfn computeFresnelTerm(viewDirection: vec3f,worldNormal: vec3f,bias: f32,power: f32)->f32\n{let fresnelTerm: f32=pow(bias+abs(dot(viewDirection,worldNormal)),power);return clamp(fresnelTerm,0.,1.);}\n#endif\n")},92518:(e,t,n)=>{var r=n(98519),i="harmonicsFunctions";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#ifdef USESPHERICALFROMREFLECTIONMAP\n#ifdef SPHERICAL_HARMONICS\nvec3 computeEnvironmentIrradiance(vec3 normal) {return vSphericalL00\n+ vSphericalL1_1*(normal.y)\n+ vSphericalL10*(normal.z)\n+ vSphericalL11*(normal.x)\n+ vSphericalL2_2*(normal.y*normal.x)\n+ vSphericalL2_1*(normal.y*normal.z)\n+ vSphericalL20*((3.0*normal.z*normal.z)-1.0)\n+ vSphericalL21*(normal.z*normal.x)\n+ vSphericalL22*(normal.x*normal.x-(normal.y*normal.y));}\n#else\nvec3 computeEnvironmentIrradiance(vec3 normal) {float Nx=normal.x;float Ny=normal.y;float Nz=normal.z;vec3 C1=vSphericalZZ.rgb;vec3 Cx=vSphericalX.rgb;vec3 Cy=vSphericalY.rgb;vec3 Cz=vSphericalZ.rgb;vec3 Cxx_zz=vSphericalXX_ZZ.rgb;vec3 Cyy_zz=vSphericalYY_ZZ.rgb;vec3 Cxy=vSphericalXY.rgb;vec3 Cyz=vSphericalYZ.rgb;vec3 Czx=vSphericalZX.rgb;vec3 a1=Cyy_zz*Ny+Cy;vec3 a2=Cyz*Nz+a1;vec3 b1=Czx*Nz+Cx;vec3 b2=Cxy*Ny+b1;vec3 b3=Cxx_zz*Nx+b2;vec3 t1=Cz *Nz+C1;vec3 t2=a2 *Ny+t1;vec3 t3=b3 *Nx+t2;return t3;}\n#endif\n#endif\n")},92548:(e,t,n)=>{n.d(t,{Z:()=>r});var r=function(){function e(){}return e.Eval=function(t,n){return"true"===(t=t.match(/\([^()]*\)/g)?t.replace(/\([^()]*\)/g,(function(t){return t=t.slice(1,t.length-1),e._HandleParenthesisContent(t,n)})):e._HandleParenthesisContent(t,n))||"false"!==t&&e.Eval(t,n)},e._HandleParenthesisContent=function(t,n){var r;n=n||function(e){return"true"===e};var i=t.split("||");for(var o in i)if(Object.prototype.hasOwnProperty.call(i,o)){var a=e._SimplifyNegation(i[o].trim()),s=a.split("&&");if(s.length>1)for(var l=0;l{n.d(t,{x:()=>i});var r=n(78322),i=function(e){function t(t,n,r,i){var o=e.call(this,t,n,r)||this;return o._engine=i,o}return(0,r.C6)(t,e),t.IsCullPass=function(e){return void 0!==e.setObjectList},Object.defineProperty(t.prototype,"objectList",{get:function(){return this._objectList},enumerable:!1,configurable:!0}),t.prototype.setObjectList=function(e){this._objectList=e},t.prototype._isValid=function(){return e.prototype._isValid.call(this)||(void 0!==this._objectList?null:"Object list is not set (call setObjectList to set it)")},t}(n(14486).X)},93050:(e,t,n)=>{n.r(t),n.d(t,{screenSpaceReflection2BlurCombinerPixelShaderWGSL:()=>a});var r=n(98519),i=(n(17393),n(61669),n(7779),"screenSpaceReflection2BlurCombinerPixelShader"),o="var textureSamplerSampler: sampler;var textureSampler: texture_2d; \nvar mainSamplerSampler: sampler;var mainSampler: texture_2d;var reflectivitySamplerSampler: sampler;var reflectivitySampler: texture_2d;uniform strength: f32;uniform reflectionSpecularFalloffExponent: f32;uniform reflectivityThreshold: f32;varying vUV: vec2f;\n#include\n#ifdef SSR_BLEND_WITH_FRESNEL\n#include\n#include\nuniform projection: mat4x4f;uniform invProjectionMatrix: mat4x4f;\n#ifdef SSR_NORMAL_IS_IN_WORLDSPACE\nuniform view: mat4x4f;\n#endif\nvar normalSampler: texture_2d;var depthSampler: texture_2d;\n#ifdef SSRAYTRACE_SCREENSPACE_DEPTH\nuniform nearPlaneZ: f32;uniform farPlaneZ: f32;\n#endif\n#endif\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#ifdef SSRAYTRACE_DEBUG\nfragmentOutputs.color=textureSample(textureSampler,textureSamplerSampler,input.vUV);\n#else\nvar SSR: vec3f=textureSample(textureSampler,textureSamplerSampler,input.vUV).rgb;var color: vec4f=textureSample(mainSampler,textureSamplerSampler,input.vUV);var reflectivity: vec4f=textureSample(reflectivitySampler,reflectivitySamplerSampler,input.vUV);\n#ifndef SSR_DISABLE_REFLECTIVITY_TEST\nif (max(reflectivity.r,max(reflectivity.g,reflectivity.b))<=uniforms.reflectivityThreshold) {fragmentOutputs.color=color;return fragmentOutputs;}\n#endif\n#ifdef SSR_INPUT_IS_GAMMA_SPACE\ncolor=toLinearSpaceVec4(color);\n#endif\n#ifdef SSR_BLEND_WITH_FRESNEL\nvar texSize: vec2f= vec2f(textureDimensions(depthSampler,0));var csNormal: vec3f=textureLoad(normalSampler,vec2(input.vUV*texSize),0).xyz;\n#ifdef SSR_DECODE_NORMAL\ncsNormal=csNormal*2.0-1.0;\n#endif\n#ifdef SSR_NORMAL_IS_IN_WORLDSPACE\ncsNormal=(uniforms.view*vec4f(csNormal,0.0)).xyz;\n#endif\nvar depth: f32=textureLoad(depthSampler,vec2(input.vUV*texSize),0).r;\n#ifdef SSRAYTRACE_SCREENSPACE_DEPTH\ndepth=linearizeDepth(depth,uniforms.nearPlaneZ,uniforms.farPlaneZ);\n#endif\nvar csPosition: vec3f=computeViewPosFromUVDepth(input.vUV,depth,uniforms.projection,uniforms.invProjectionMatrix);var csViewDirection: vec3f=normalize(csPosition);var F0: vec3f=reflectivity.rgb;var fresnel: vec3f=fresnelSchlickGGXVec3(max(dot(csNormal,-csViewDirection),0.0),F0, vec3f(1.));var reflectionMultiplier: vec3f=clamp(pow(fresnel*uniforms.strength, vec3f(uniforms.reflectionSpecularFalloffExponent)),vec3f(0.0),vec3f(1.0));\n#else\nvar reflectionMultiplier: vec3f=clamp(pow(reflectivity.rgb*uniforms.strength, vec3f(uniforms.reflectionSpecularFalloffExponent)),vec3f(0.0),vec3f(1.0));\n#endif\nvar colorMultiplier: vec3f=1.0-reflectionMultiplier;var finalColor: vec3f=(color.rgb*colorMultiplier)+(SSR*reflectionMultiplier);\n#ifdef SSR_OUTPUT_IS_GAMMA_SPACE\nfinalColor=toGammaSpaceVec3(finalColor);\n#endif\nfragmentOutputs.color= vec4f(finalColor,color.a);\n#endif\n}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},93051:(e,t,n)=>{n.d(t,{Qz:()=>a,R$:()=>r,fj:()=>o});var r,i=n(66377);function o(e){var t,n=0,r=Date.now();e.observableParameters=null!==(t=e.observableParameters)&&void 0!==t?t:{};var i=e.contextObservable.add((function(t){var o=Date.now(),a={startTime:r,currentTime:o,deltaTime:n=o-r,completeRate:n/e.timeout,payload:t};e.onTick&&e.onTick(a),e.breakCondition&&e.breakCondition()&&(e.contextObservable.remove(i),e.onAborted&&e.onAborted(a)),n>=e.timeout&&(e.contextObservable.remove(i),e.onEnded&&e.onEnded(a))}),e.observableParameters.mask,e.observableParameters.insertFirst,e.observableParameters.scope);return i}!function(e){e[e.INIT=0]="INIT",e[e.STARTED=1]="STARTED",e[e.ENDED=2]="ENDED"}(r||(r={}));var a=function(){function e(e){var t,n,r=this;this.onEachCountObservable=new i.cP,this.onTimerAbortedObservable=new i.cP,this.onTimerEndedObservable=new i.cP,this.onStateChangedObservable=new i.cP,this._observer=null,this._breakOnNextTick=!1,this._tick=function(e){var t=Date.now();r._timer=t-r._startTime;var n={startTime:r._startTime,currentTime:t,deltaTime:r._timer,completeRate:r._timer/r._timeToEnd,payload:e},i=r._breakOnNextTick||r._breakCondition(n);i||r._timer>=r._timeToEnd?r._stop(n,i):r.onEachCountObservable.notifyObservers(n)},this._setState(0),this._contextObservable=e.contextObservable,this._observableParameters=null!==(t=e.observableParameters)&&void 0!==t?t:{},this._breakCondition=null!==(n=e.breakCondition)&&void 0!==n?n:function(){return!1},this._timeToEnd=e.timeout,e.onEnded&&this.onTimerEndedObservable.add(e.onEnded),e.onTick&&this.onEachCountObservable.add(e.onTick),e.onAborted&&this.onTimerAbortedObservable.add(e.onAborted)}return Object.defineProperty(e.prototype,"breakCondition",{set:function(e){this._breakCondition=e},enumerable:!1,configurable:!0}),e.prototype.clearObservables=function(){this.onEachCountObservable.clear(),this.onTimerAbortedObservable.clear(),this.onTimerEndedObservable.clear(),this.onStateChangedObservable.clear()},e.prototype.start=function(e){if(void 0===e&&(e=this._timeToEnd),1===this._state)throw new Error("Timer already started. Please stop it before starting again");this._timeToEnd=e,this._startTime=Date.now(),this._timer=0,this._observer=this._contextObservable.add(this._tick,this._observableParameters.mask,this._observableParameters.insertFirst,this._observableParameters.scope),this._setState(1)},e.prototype.stop=function(){1===this._state&&(this._breakOnNextTick=!0)},e.prototype.dispose=function(){this._observer&&this._contextObservable.remove(this._observer),this.clearObservables()},e.prototype._setState=function(e){this._state=e,this.onStateChangedObservable.notifyObservers(this._state)},e.prototype._stop=function(e,t){void 0===t&&(t=!1),this._contextObservable.remove(this._observer),this._setState(2),t?this.onTimerAbortedObservable.notifyObservers(e):this.onTimerEndedObservable.notifyObservers(e)},e}()},93100:(e,t,n)=>{n.r(t),n.d(t,{fxaaVertexShader:()=>a});var r=n(98519),i="fxaaVertexShader",o="attribute vec2 position;uniform vec2 texelSize;varying vec2 vUV;varying vec2 sampleCoordS;varying vec2 sampleCoordE;varying vec2 sampleCoordN;varying vec2 sampleCoordW;varying vec2 sampleCoordNW;varying vec2 sampleCoordSE;varying vec2 sampleCoordNE;varying vec2 sampleCoordSW;const vec2 madd=vec2(0.5,0.5);\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvUV=(position*madd+madd);sampleCoordS=vUV+vec2( 0.0,1.0)*texelSize;sampleCoordE=vUV+vec2( 1.0,0.0)*texelSize;sampleCoordN=vUV+vec2( 0.0,-1.0)*texelSize;sampleCoordW=vUV+vec2(-1.0,0.0)*texelSize;sampleCoordNW=vUV+vec2(-1.0,-1.0)*texelSize;sampleCoordSE=vUV+vec2( 1.0,1.0)*texelSize;sampleCoordNE=vUV+vec2( 1.0,-1.0)*texelSize;sampleCoordSW=vUV+vec2(-1.0,1.0)*texelSize;gl_Position=vec4(position,0.0,1.0);\n#define CUSTOM_VERTEX_MAIN_END\n}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},93102:(e,t,n)=>{n.r(t),n.d(t,{geometryPixelShader:()=>s});var r=n(98519),i=(n(27003),"mrtFragmentDeclaration");r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\nlayout(location=0) out vec4 glFragData[{X}];\n#endif\n"),n(48661),n(75394),n(75334),n(39643),n(56159);var o="geometryPixelShader",a="#extension GL_EXT_draw_buffers : require\n#if defined(BUMP) || !defined(NORMAL)\n#extension GL_OES_standard_derivatives : enable\n#endif\nprecision highp float;\n#ifdef BUMP\nvarying mat4 vWorldView;varying vec3 vNormalW;\n#else\nvarying vec3 vNormalV;\n#endif\nvarying vec4 vViewPos;\n#if defined(POSITION) || defined(BUMP)\nvarying vec3 vPositionW;\n#endif\n#if defined(VELOCITY) || defined(VELOCITY_LINEAR)\nvarying vec4 vCurrentPosition;varying vec4 vPreviousPosition;\n#endif\n#ifdef NEED_UV\nvarying vec2 vUV;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;uniform vec2 vTangentSpaceParams;\n#endif\n#if defined(REFLECTIVITY)\n#if defined(ORMTEXTURE) || defined(SPECULARGLOSSINESSTEXTURE) || defined(REFLECTIVITYTEXTURE)\nuniform sampler2D reflectivitySampler;varying vec2 vReflectivityUV;\n#else\n#ifdef METALLIC_TEXTURE\nuniform sampler2D metallicSampler;varying vec2 vMetallicUV;\n#endif\n#ifdef ROUGHNESS_TEXTURE\nuniform sampler2D roughnessSampler;varying vec2 vRoughnessUV;\n#endif\n#endif\n#ifdef ALBEDOTEXTURE\nvarying vec2 vAlbedoUV;uniform sampler2D albedoSampler;\n#endif\n#ifdef REFLECTIVITYCOLOR\nuniform vec3 reflectivityColor;\n#endif\n#ifdef ALBEDOCOLOR\nuniform vec3 albedoColor;\n#endif\n#ifdef METALLIC\nuniform float metallic;\n#endif\n#if defined(ROUGHNESS) || defined(GLOSSINESS)\nuniform float glossiness;\n#endif\n#endif\n#if defined(ALPHATEST) && defined(NEED_UV)\nuniform sampler2D diffuseSampler;\n#endif\n#include\n#include[SCENE_MRT_COUNT]\n#include\n#include\n#include\nvoid main() {\n#include\n#ifdef ALPHATEST\nif (texture2D(diffuseSampler,vUV).a<0.4)\ndiscard;\n#endif\nvec3 normalOutput;\n#ifdef BUMP\nvec3 normalW=normalize(vNormalW);\n#include\n#ifdef NORMAL_WORLDSPACE\nnormalOutput=normalW;\n#else\nnormalOutput=normalize(vec3(vWorldView*vec4(normalW,0.0)));\n#endif\n#elif defined(HAS_NORMAL_ATTRIBUTE)\nnormalOutput=normalize(vNormalV);\n#elif defined(POSITION)\nnormalOutput=normalize(-cross(dFdx(vPositionW),dFdy(vPositionW)));\n#endif\n#ifdef ENCODE_NORMAL\nnormalOutput=normalOutput*0.5+0.5;\n#endif\n#ifdef DEPTH\ngl_FragData[DEPTH_INDEX]=vec4(vViewPos.z/vViewPos.w,0.0,0.0,1.0);\n#endif\n#ifdef NORMAL\ngl_FragData[NORMAL_INDEX]=vec4(normalOutput,1.0);\n#endif\n#ifdef SCREENSPACE_DEPTH\ngl_FragData[SCREENSPACE_DEPTH_INDEX]=vec4(gl_FragCoord.z,0.0,0.0,1.0);\n#endif\n#ifdef POSITION\ngl_FragData[POSITION_INDEX]=vec4(vPositionW,1.0);\n#endif\n#ifdef VELOCITY\nvec2 a=(vCurrentPosition.xy/vCurrentPosition.w)*0.5+0.5;vec2 b=(vPreviousPosition.xy/vPreviousPosition.w)*0.5+0.5;vec2 velocity=abs(a-b);velocity=vec2(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;gl_FragData[VELOCITY_INDEX]=vec4(velocity,0.0,1.0);\n#endif\n#ifdef VELOCITY_LINEAR\nvec2 velocity=vec2(0.5)*((vPreviousPosition.xy/vPreviousPosition.w) -\n(vCurrentPosition.xy/vCurrentPosition.w));gl_FragData[VELOCITY_LINEAR_INDEX]=vec4(velocity,0.0,1.0);\n#endif\n#ifdef REFLECTIVITY\nvec4 reflectivity=vec4(0.0,0.0,0.0,1.0);\n#ifdef METALLICWORKFLOW\nfloat metal=1.0;float roughness=1.0;\n#ifdef ORMTEXTURE\nmetal*=texture2D(reflectivitySampler,vReflectivityUV).b;roughness*=texture2D(reflectivitySampler,vReflectivityUV).g;\n#else\n#ifdef METALLIC_TEXTURE\nmetal*=texture2D(metallicSampler,vMetallicUV).r;\n#endif\n#ifdef ROUGHNESS_TEXTURE\nroughness*=texture2D(roughnessSampler,vRoughnessUV).r;\n#endif\n#endif\n#ifdef METALLIC\nmetal*=metallic;\n#endif\n#ifdef ROUGHNESS\nroughness*=(1.0-glossiness); \n#endif\nreflectivity.a-=roughness;vec3 color=vec3(1.0);\n#ifdef ALBEDOTEXTURE\ncolor=texture2D(albedoSampler,vAlbedoUV).rgb;\n#ifdef GAMMAALBEDO\ncolor=toLinearSpace(color);\n#endif\n#endif\n#ifdef ALBEDOCOLOR\ncolor*=albedoColor.xyz;\n#endif\nreflectivity.rgb=mix(vec3(0.04),color,metal);\n#else\n#if defined(SPECULARGLOSSINESSTEXTURE) || defined(REFLECTIVITYTEXTURE)\nreflectivity=texture2D(reflectivitySampler,vReflectivityUV);\n#ifdef GAMMAREFLECTIVITYTEXTURE\nreflectivity.rgb=toLinearSpace(reflectivity.rgb);\n#endif\n#else \n#ifdef REFLECTIVITYCOLOR\nreflectivity.rgb=toLinearSpace(reflectivityColor.xyz);reflectivity.a=1.0;\n#endif\n#endif\n#ifdef GLOSSINESSS\nreflectivity.a*=glossiness; \n#endif\n#endif\ngl_FragData[REFLECTIVITY_INDEX]=reflectivity;\n#endif\n}\n";r.l.ShadersStore[o]||(r.l.ShadersStore[o]=a);var s={name:o,shader:a}},93130:(e,t,n)=>{var r=n(98519),i="decalFragment";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="#ifdef DECAL\n#ifdef GAMMADECAL\ndecalColor.rgb=toLinearSpace(decalColor.rgb);\n#endif\n#ifdef DECAL_SMOOTHALPHA\ndecalColor.a*=decalColor.a;\n#endif\nsurfaceAlbedo.rgb=mix(surfaceAlbedo.rgb,decalColor.rgb,decalColor.a);\n#endif\n")},93540:(e,t,n)=>{n.d(t,{$:()=>d,J:()=>h});var r=n(78322),i=n(62623),o=n(25187),a=n(81152),s=n(66377),l=n(74239),c=n(14777),u=(n(96795),{positions:[1,1,-1,1,-1,-1,1,-1],indices:[0,1,2,0,2,3]}),h=function(){function e(e,t){var n;void 0===t&&(t=u);var r,a,s=this;this._fullscreenViewport=new o.L(0,0,1,1);var l=null!==(r=t.positions)&&void 0!==r?r:u.positions,c=null!==(a=t.indices)&&void 0!==a?a:u.indices;this.engine=e,this._vertexBuffers=((n={})[i.R.PositionKind]=new i.R(e,l,i.R.PositionKind,!1,!1,2),n),this._indexBuffer=e.createIndexBuffer(c),this._indexBufferLength=c.length,this._onContextRestoredObserver=e.onContextRestoredObservable.add((function(){for(var t in s._indexBuffer=e.createIndexBuffer(c),s._vertexBuffers)s._vertexBuffers[t]._rebuild()}))}return e.prototype.setViewport=function(e){void 0===e&&(e=this._fullscreenViewport),this.engine.setViewport(e)},e.prototype.bindBuffers=function(e){this.engine.bindBuffers(this._vertexBuffers,this._indexBuffer,e)},e.prototype.applyEffectWrapper=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1),this.engine.setState(!0),this.engine.depthCullingState.depthTest=t,this.engine.stencilState.stencilTest=n,this.engine.enableEffect(e.drawWrapper),this.bindBuffers(e.effect),e.onApplyObservable.notifyObservers({})},e.prototype.saveStates=function(){this._savedStateDepthTest=this.engine.depthCullingState.depthTest,this._savedStateStencilTest=this.engine.stencilState.stencilTest},e.prototype.restoreStates=function(){this.engine.depthCullingState.depthTest=this._savedStateDepthTest,this.engine.stencilState.stencilTest=this._savedStateStencilTest},e.prototype.draw=function(){this.engine.drawElementsType(a.Y.MATERIAL_TriangleFillMode,0,this._indexBufferLength)},e.prototype._isRenderTargetTexture=function(e){return void 0!==e.renderTarget},e.prototype.render=function(e,t){if(void 0===t&&(t=null),e.effect.isReady()){this.saveStates(),this.setViewport();var n=null===t?null:this._isRenderTargetTexture(t)?t.renderTarget:t;n&&this.engine.bindFramebuffer(n),this.applyEffectWrapper(e),this.draw(),n&&this.engine.unBindFramebuffer(n),this.restoreStates()}},e.prototype.dispose=function(){var e=this._vertexBuffers[i.R.PositionKind];e&&(e.dispose(),delete this._vertexBuffers[i.R.PositionKind]),this._indexBuffer&&this.engine._releaseBuffer(this._indexBuffer),this._onContextRestoredObserver&&(this.engine.onContextRestoredObservable.remove(this._onContextRestoredObserver),this._onContextRestoredObserver=null)},e}(),d=function(){function e(e){var t,n,i=this;this.alphaMode=a.Y.ALPHA_DISABLE,this.onEffectCreatedObservable=new s.cP(void 0,!0),this.onApplyObservable=new s.cP,this._shadersLoaded=!1,this._webGPUReady=!1,this._importPromises=[],this.options=(0,r.Cl)((0,r.Cl)({},e),{name:e.name||"effectWrapper",engine:e.engine,uniforms:e.uniforms||e.uniformNames||[],uniformNames:void 0,samplers:e.samplers||e.samplerNames||[],samplerNames:void 0,attributeNames:e.attributeNames||["position"],uniformBuffers:e.uniformBuffers||[],defines:e.defines||"",useShaderStore:e.useShaderStore||!1,vertexUrl:e.vertexUrl||e.vertexShader||"postprocess",vertexShader:void 0,fragmentShader:e.fragmentShader||"pass",indexParameters:e.indexParameters,blockCompilation:e.blockCompilation||!1,shaderLanguage:e.shaderLanguage||0,onCompiled:e.onCompiled||void 0,extraInitializations:e.extraInitializations||void 0,extraInitializationsAsync:e.extraInitializationsAsync||void 0,useAsPostProcess:null!==(t=e.useAsPostProcess)&&void 0!==t&&t,allowEmptySourceTexture:null!==(n=e.allowEmptySourceTexture)&&void 0!==n&&n}),this.options.uniformNames=this.options.uniforms,this.options.samplerNames=this.options.samplers,this.options.vertexShader=this.options.vertexUrl,this.options.useAsPostProcess&&(this.options.allowEmptySourceTexture||-1!==this.options.samplers.indexOf("textureSampler")||this.options.samplers.push("textureSampler"),-1===this.options.uniforms.indexOf("scale")&&this.options.uniforms.push("scale")),e.vertexUrl||e.vertexShader?this._shaderPath={vertexSource:this.options.vertexShader}:(this.options.useAsPostProcess||(this.options.uniforms.push("scale"),this.onApplyObservable.add((function(){i.effect.setFloat2("scale",1,1)}))),this._shaderPath={vertex:this.options.vertexShader}),this._shaderPath.fragmentSource=this.options.fragmentShader,this._shaderPath.spectorName=this.options.name,this.options.useShaderStore&&(this._shaderPath.fragment=this._shaderPath.fragmentSource,this._shaderPath.vertex||(this._shaderPath.vertex=this._shaderPath.vertexSource),delete this._shaderPath.fragmentSource,delete this._shaderPath.vertexSource),this.onApplyObservable.add((function(){i.bind()})),this.options.useShaderStore||(this._onContextRestoredObserver=this.options.engine.onContextRestoredObservable.add((function(){i.effect._pipelineContext=null,i.effect._prepareEffect()}))),this._drawWrapper=new c.E(this.options.engine),this._webGPUReady=1===this.options.shaderLanguage;var o=Array.isArray(this.options.defines)?this.options.defines.join("\n"):this.options.defines;this._postConstructor(this.options.blockCompilation,o,this.options.extraInitializations)}return e.RegisterShaderCodeProcessing=function(t,n){n?e._CustomShaderCodeProcessing[null!=t?t:""]=n:delete e._CustomShaderCodeProcessing[null!=t?t:""]},e._GetShaderCodeProcessing=function(t){var n;return null!==(n=e._CustomShaderCodeProcessing[t])&&void 0!==n?n:e._CustomShaderCodeProcessing[""]},Object.defineProperty(e.prototype,"name",{get:function(){return this.options.name},set:function(e){this.options.name=e},enumerable:!1,configurable:!0}),e.prototype.isReady=function(){var e,t;return null!==(t=null===(e=this._drawWrapper.effect)||void 0===e?void 0:e.isReady())&&void 0!==t&&t},Object.defineProperty(e.prototype,"drawWrapper",{get:function(){return this._drawWrapper},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"effect",{get:function(){return this._drawWrapper.effect},set:function(e){this._drawWrapper.effect=e},enumerable:!1,configurable:!0}),e.prototype._gatherImports=function(e,t){void 0===e&&(e=!1),this.options.useAsPostProcess&&(e&&this._webGPUReady?t.push(Promise.all([Promise.resolve().then(n.bind(n,3072))])):t.push(Promise.all([Promise.resolve().then(n.bind(n,96795))])))},e.prototype._postConstructor=function(t,n,r,i){var o;void 0===n&&(n=null),this._importPromises.length=0,i&&(o=this._importPromises).push.apply(o,i);var a=this.options.engine.isWebGPU&&!e.ForceGLSL;this._gatherImports(a,this._importPromises),void 0!==r&&r(a,this._importPromises),a&&this._webGPUReady&&(this.options.shaderLanguage=1),t||this.updateEffect(n)},e.prototype.updateEffect=function(t,n,i,o,a,s,c,u){var h,d,p=this;void 0===t&&(t=null),void 0===n&&(n=null),void 0===i&&(i=null);var f=e._GetShaderCodeProcessing(this.name);if(null==f?void 0:f.defineCustomBindings){var m=null!==(h=null==n?void 0:n.slice())&&void 0!==h?h:[];m.push.apply(m,this.options.uniforms);var _=null!==(d=null==i?void 0:i.slice())&&void 0!==d?d:[];_.push.apply(_,this.options.samplers),t=f.defineCustomBindings(this.name,t,m,_),n=m,i=_}this.options.defines=t||"";var g,v=this._shadersLoaded||0===this._importPromises.length?void 0:function(){return(0,r.sH)(p,void 0,void 0,(function(){return(0,r.YH)(this,(function(e){switch(e.label){case 0:return[4,Promise.all(this._importPromises)];case 1:return e.sent(),this._shadersLoaded=!0,[2]}}))}))};g=this.options.extraInitializationsAsync?function(){return(0,r.sH)(p,void 0,void 0,(function(){return(0,r.YH)(this,(function(e){switch(e.label){case 0:return null==v||v(),[4,this.options.extraInitializationsAsync()];case 1:return e.sent(),[2]}}))}))}:v,this.options.useShaderStore?this._drawWrapper.effect=this.options.engine.createEffect({vertex:null!=c?c:this._shaderPath.vertex,fragment:null!=u?u:this._shaderPath.fragment},{attributes:this.options.attributeNames,uniformsNames:n||this.options.uniforms,uniformBuffersNames:this.options.uniformBuffers,samplers:i||this.options.samplers,defines:null!==t?t:"",fallbacks:null,onCompiled:null!=a?a:this.options.onCompiled,onError:null!=s?s:null,indexParameters:o||this.options.indexParameters,processCodeAfterIncludes:(null==f?void 0:f.processCodeAfterIncludes)?function(e,t){return f.processCodeAfterIncludes(p.name,e,t)}:null,processFinalCode:(null==f?void 0:f.processFinalCode)?function(e,t){return f.processFinalCode(p.name,e,t)}:null,shaderLanguage:this.options.shaderLanguage,extraInitializationsAsync:g},this.options.engine):this._drawWrapper.effect=new l.M(this._shaderPath,this.options.attributeNames,n||this.options.uniforms,i||this.options.samplerNames,this.options.engine,t,void 0,a||this.options.onCompiled,void 0,void 0,void 0,this.options.shaderLanguage,g),this.onEffectCreatedObservable.notifyObservers(this._drawWrapper.effect)},e.prototype.bind=function(t){var n,r;void 0===t&&(t=!1),this.options.useAsPostProcess&&!t&&(this.options.engine.setAlphaMode(this.alphaMode),this.drawWrapper.effect.setFloat2("scale",1,1)),null===(r=null===(n=e._GetShaderCodeProcessing(this.name))||void 0===n?void 0:n.bindCustomBindings)||void 0===r||r.call(n,this.name,this._drawWrapper.effect)},e.prototype.dispose=function(e){void 0===e&&(e=!1),this._onContextRestoredObserver&&(this.effect.getEngine().onContextRestoredObservable.remove(this._onContextRestoredObserver),this._onContextRestoredObserver=null),this.onEffectCreatedObservable.clear(),this._drawWrapper.dispose(!0)},e.ForceGLSL=!1,e._CustomShaderCodeProcessing={},e}()},93664:(e,t,n)=>{var r=n(98519),i="screenSpaceRayTrace";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]="float distanceSquared(vec2 a,vec2 b) { a-=b; return dot(a,a); }\n#ifdef SSRAYTRACE_SCREENSPACE_DEPTH\nfloat linearizeDepth(float depth,float near,float far) {\n#ifdef SSRAYTRACE_RIGHT_HANDED_SCENE\nreturn -(near*far)/(far-depth*(far-near));\n#else\nreturn (near*far)/(far-depth*(far-near));\n#endif\n}\n#endif\n/**\nparam csOrigin Camera-space ray origin,which must be \nwithin the view volume and must have z>0.01 and project within the valid screen rectangle\nparam csDirection Unit length camera-space ray direction\nparam projectToPixelMatrix A projection matrix that maps to **pixel** coordinates \n(**not** [-1,+1] normalized device coordinates).\nparam csZBuffer The camera-space Z buffer\nparam csZBufferSize Dimensions of csZBuffer\nparam csZThickness Camera space csZThickness to ascribe to each pixel in the depth buffer\nparam nearPlaneZ Positive number. Doesn't have to be THE actual near plane,just a reasonable value\nfor clipping rays headed towards the camera\nparam stride Step in horizontal or vertical pixels between samples. This is a float\nbecause integer math is slow on GPUs,but should be set to an integer>=1\nparam jitterFraction Number between 0 and 1 for how far to bump the ray in stride units\nto conceal banding artifacts,plus the stride ray offset.\nparam maxSteps Maximum number of iterations. Higher gives better images but may be slow\nparam maxRayTraceDistance Maximum camera-space distance to trace before returning a miss\nparam selfCollisionNumSkip Number of steps to skip at start when raytracing to avoid self collisions.\n1 is a reasonable value,depending on the scene you may need to set this value to 2\nparam hitPixel Pixel coordinates of the first intersection with the scene\nparam numIterations number of iterations performed\nparam csHitPoint Camera space location of the ray hit\n*/\n#define inline\nbool traceScreenSpaceRay1(\nvec3 csOrigin,\nvec3 csDirection,\nmat4 projectToPixelMatrix,\nsampler2D csZBuffer,\nvec2 csZBufferSize,\n#ifdef SSRAYTRACE_USE_BACK_DEPTHBUFFER\nsampler2D csZBackBuffer,\nfloat csZBackSizeFactor,\n#endif\nfloat csZThickness,\nfloat nearPlaneZ,\nfloat farPlaneZ,\nfloat stride,\nfloat jitterFraction,\nfloat maxSteps,\nfloat maxRayTraceDistance,\nfloat selfCollisionNumSkip,\nout vec2 startPixel,\nout vec2 hitPixel,\nout vec3 csHitPoint,\nout float numIterations\n#ifdef SSRAYTRACE_DEBUG\n,out vec3 debugColor\n#endif\n)\n{\n#ifdef SSRAYTRACE_RIGHT_HANDED_SCENE\nfloat rayLength=(csOrigin.z+csDirection.z*maxRayTraceDistance)>-nearPlaneZ ? (-nearPlaneZ-csOrigin.z)/csDirection.z : maxRayTraceDistance;\n#else\nfloat rayLength=(csOrigin.z+csDirection.z*maxRayTraceDistance)yMax) || (P1.yyMax) ? yMax : yMin))/(P1.y-P0.y);}\nif ((P1.x>xMax) || (P1.xxMax) ? xMax : xMin))/(P1.x-P0.x));}\nP1=mix(P1,P0,alpha); k1=mix(k1,k0,alpha); Q1=mix(Q1,Q0,alpha);\n#endif\nP1+=vec2((distanceSquared(P0,P1)<0.0001) ? 0.01 : 0.0);vec2 delta=P1-P0;bool permute=false;if (abs(delta.x)rayZMax) { \nfloat t=rayZMin; rayZMin=rayZMax; rayZMax=t;}\nsceneZMax=texelFetch(csZBuffer,ivec2(hitPixel),0).r;\n#ifdef SSRAYTRACE_SCREENSPACE_DEPTH\nsceneZMax=linearizeDepth(sceneZMax,nearPlaneZ,farPlaneZ);\n#endif\nif (sceneZMax==0.0) sceneZMax=1e8;\n#ifdef SSRAYTRACE_RIGHT_HANDED_SCENE\n#ifdef SSRAYTRACE_USE_BACK_DEPTHBUFFER\nfloat sceneBackZ=texelFetch(csZBackBuffer,ivec2(hitPixel/csZBackSizeFactor),0).r;\n#ifdef SSRAYTRACE_SCREENSPACE_DEPTH\nsceneBackZ=linearizeDepth(sceneBackZ,nearPlaneZ,farPlaneZ);\n#endif\nif (sceneBackZ==0.0) sceneBackZ=-1e8;hit=(rayZMax>=sceneBackZ-csZThickness) && (rayZMin<=sceneZMax);\n#else\nhit=(rayZMax>=sceneZMax-csZThickness) && (rayZMin<=sceneZMax);\n#endif\n#else\n#ifdef SSRAYTRACE_USE_BACK_DEPTHBUFFER\nfloat sceneBackZ=texelFetch(csZBackBuffer,ivec2(hitPixel/csZBackSizeFactor),0).r;\n#ifdef SSRAYTRACE_SCREENSPACE_DEPTH\nsceneBackZ=linearizeDepth(sceneBackZ,nearPlaneZ,farPlaneZ);\n#endif\nif (sceneBackZ==0.0) sceneBackZ=1e8;hit=(rayZMin<=sceneBackZ+csZThickness) && (rayZMax>=sceneZMax) && (sceneZMax != 0.0);\n#else\nhit=(rayZMin<=sceneZMax+csZThickness) && (rayZMax>=sceneZMax);\n#endif\n#endif\n}\npqk-=dPQK;stepCount-=1.0;if (((pqk.x+dPQK.x)*stepDirection)>end || (stepCount+1.0)>=maxSteps || sceneZMax==0.0) {hit=false;}\n#ifdef SSRAYTRACE_ENABLE_REFINEMENT\nif (stride>1.0 && hit) {pqk-=dPQK;stepCount-=1.0;float invStride=1.0/stride;dPQK*=invStride;float refinementStepCount=0.0;prevZMaxEstimate=pqk.z/pqk.w;rayZMax=prevZMaxEstimate;sceneZMax=rayZMax+1e7;for (;refinementStepCount<=1.0 ||\n(refinementStepCount<=stride*1.4) &&\n(rayZMaxend) {debugColor=vec3(0,0,1);} else if ((stepCount+1.0)>=maxSteps) {debugColor=vec3(1,0,0);} else if (sceneZMax==0.0) {debugColor=vec3(1,1,0);} else {debugColor=vec3(0,stepCount/maxSteps,0);}\n#endif\nreturn hit;}\n/**\ntexCoord: in the [0,1] range\ndepth: depth in view space (range [znear,zfar]])\n*/\nvec3 computeViewPosFromUVDepth(vec2 texCoord,float depth,mat4 projection,mat4 invProjectionMatrix) {vec4 ndc;ndc.xy=texCoord*2.0-1.0;\n#ifdef SSRAYTRACE_RIGHT_HANDED_SCENE\n#ifdef ORTHOGRAPHIC_CAMERA\nndc.z=-projection[2].z*depth+projection[3].z;\n#else\nndc.z=-projection[2].z-projection[3].z/depth;\n#endif\n#else\n#ifdef ORTHOGRAPHIC_CAMERA\nndc.z=projection[2].z*depth+projection[3].z;\n#else\nndc.z=projection[2].z+projection[3].z/depth;\n#endif\n#endif\nndc.w=1.0;vec4 eyePos=invProjectionMatrix*ndc;eyePos.xyz/=eyePos.w;return eyePos.xyz;}\n")},93747:(e,t,n)=>{n.r(t),n.d(t,{ReadExrDataAsync:()=>c,_ExrTextureLoader:()=>l});var r=n(78322),i=n(95487),o=n(99448),a=n(54646),s=n(7164),l=function(){function e(){this.supportCascades=!1}return e.prototype.loadCubeData=function(e,t,n,r,i){throw".exr not supported in Cube."},e.prototype.loadData=function(e,t,n){var r=new DataView(e.buffer),l={value:0},c=(0,i.V)(r,l);(0,o.d)(c,r,l,a.u.DefaultOutputType).then((function(e){(0,o.u)(e,c,r,l);var i=c.dataWindow.xMax-c.dataWindow.xMin+1,a=c.dataWindow.yMax-c.dataWindow.yMin+1;n(i,a,t.generateMipMaps,!1,(function(){var n=t.getEngine();t.format=c.format,t.type=e.textureType,t.invertY=!1,t._gammaSpace=!c.linearSpace,e.byteArray&&n._uploadDataToTextureDirectly(t,e.byteArray,0,0,void 0,!0)}))})).catch((function(e){s.V.Error("Failed to load EXR texture: ",e)}))},e}();function c(e){return(0,r.sH)(this,void 0,void 0,(function(){var t,n,l,c,u;return(0,r.YH)(this,(function(r){switch(r.label){case 0:t=new DataView(e),n={value:0},l=(0,i.V)(t,n),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,(0,o.d)(l,t,n,a.V.Float)];case 2:return c=r.sent(),(0,o.u)(c,l,t,n),c.byteArray?[2,{width:l.dataWindow.xMax-l.dataWindow.xMin+1,height:l.dataWindow.yMax-l.dataWindow.yMin+1,data:new Float32Array(c.byteArray)}]:(s.V.Error("Failed to decode EXR data: No byte array available."),[2,{width:0,height:0,data:null}]);case 3:return u=r.sent(),s.V.Error("Failed to load EXR data: ",u),[3,4];case 4:return[2,{width:0,height:0,data:null}]}}))}))}},94481:(e,t,n)=>{n.r(t),n.d(t,{lodPixelShader:()=>a});var r=n(98519),i="lodPixelShader",o="precision highp float;const float GammaEncodePowerApprox=1.0/2.2;varying vec2 vUV;uniform sampler2D textureSampler;uniform float lod;uniform vec2 texSize;uniform int gamma;void main(void)\n{ivec2 textureDimensions=textureSize(textureSampler,0);gl_FragColor=texelFetch(textureSampler,ivec2(vUV*vec2(textureDimensions)),int(lod));if (gamma==0) {gl_FragColor.rgb=pow(gl_FragColor.rgb,vec3(GammaEncodePowerApprox));}}\n";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},94567:(e,t,n)=>{n.r(t),n.d(t,{layerPixelShader:()=>a});var r=n(98519),i=(n(75334),"layerPixelShader"),o="varying vec2 vUV;uniform sampler2D textureSampler;uniform vec4 color;\n#include\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\nvec4 baseColor=texture2D(textureSampler,vUV);\n#if defined(CONVERT_TO_GAMMA)\nbaseColor.rgb=toGammaSpace(baseColor.rgb);\n#elif defined(CONVERT_TO_LINEAR)\nbaseColor.rgb=toLinearSpace(baseColor.rgb);\n#endif\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\ngl_FragColor=baseColor*color;\n#define CUSTOM_FRAGMENT_MAIN_END\n}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},94727:(e,t,n)=>{n.r(t),n.d(t,{fluidRenderingRenderPixelShaderWGSL:()=>a});var r=n(98519),i="fluidRenderingRenderPixelShader",o="#define DISABLE_UNIFORMITY_ANALYSIS\n#define IOR 1.333\n#define ETA 1.0/IOR\n#define F0 0.02\nvar textureSamplerSampler: sampler;var textureSampler: texture_2d;var depthSamplerSampler: sampler;var depthSampler: texture_2d;\n#ifdef FLUIDRENDERING_DIFFUSETEXTURE\nvar diffuseSamplerSampler: sampler;var diffuseSampler: texture_2d;\n#else\nuniform diffuseColor: vec3f;\n#endif\n#ifdef FLUIDRENDERING_FIXED_THICKNESS\nuniform thickness: f32;var bgDepthSamplerSampler: sampler;var bgDepthSampler: texture_2d;\n#else\nuniform minimumThickness: f32;var thicknessSamplerSampler: sampler;var thicknessSampler: texture_2d;\n#endif\n#ifdef FLUIDRENDERING_ENVIRONMENT\nvar reflectionSamplerSampler: sampler;var reflectionSampler: texture_cube;\n#endif\n#if defined(FLUIDRENDERING_DEBUG) && defined(FLUIDRENDERING_DEBUG_TEXTURE)\nvar debugSamplerSampler: sampler;var debugSampler: texture_2d;\n#endif\nuniform viewMatrix: mat4x4f;uniform projectionMatrix: mat4x4f;uniform invProjectionMatrix: mat4x4f;uniform texelSize: vec2f;uniform dirLight: vec3f;uniform cameraFar: f32;uniform density: f32;uniform refractionStrength: f32;uniform fresnelClamp: f32;uniform specularPower: f32;varying vUV: vec2f;fn computeViewPosFromUVDepth(texCoord: vec2f,depth: f32)->vec3f {var ndc: vec4f=vec4f(texCoord*2.0-1.0,0.0,1.0);\n#ifdef FLUIDRENDERING_RHS\nndc.z=-uniforms.projectionMatrix[2].z+uniforms.projectionMatrix[3].z/depth;\n#else\nndc.z=uniforms.projectionMatrix[2].z+uniforms.projectionMatrix[3].z/depth;\n#endif\nndc.w=1.0;var eyePos: vec4f=uniforms.invProjectionMatrix*ndc;return eyePos.xyz/eyePos.w;}\nfn getViewPosFromTexCoord(texCoord: vec2f)->vec3f {var depth: f32=textureSampleLevel(depthSampler,depthSamplerSampler,texCoord,0.).x;return computeViewPosFromUVDepth(texCoord,depth);}\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var texCoord: vec2f=input.vUV;\n#if defined(FLUIDRENDERING_DEBUG) && defined(FLUIDRENDERING_DEBUG_TEXTURE)\nvar color: vec4f=textureSample(debugSampler,debugSamplerSampler,texCoord);\n#ifdef FLUIDRENDERING_DEBUG_DEPTH\nfragmentOutputs.color=vec4f(color.rgb/vec3f(2.0),1.);if (color.r>0.999 && color.g>0.999) {fragmentOutputs.color=textureSample(textureSampler,textureSamplerSampler,texCoord);}\n#else\nfragmentOutputs.color=vec4f(color.rgb,1.);if (color.r<0.001 && color.g<0.001 && color.b<0.001) {fragmentOutputs.color=textureSample(textureSampler,textureSamplerSampler,texCoord);}\n#endif\nreturn fragmentOutputs;\n#endif\nvar depthVel: vec2f=textureSampleLevel(depthSampler,depthSamplerSampler,texCoord,0.).rg;var depth: f32=depthVel.r;\n#ifndef FLUIDRENDERING_FIXED_THICKNESS\nvar thickness: f32=textureSample(thicknessSampler,thicknessSamplerSampler,texCoord).x;\n#else\nvar thickness: f32=uniforms.thickness;var bgDepth: f32=textureSample(bgDepthSampler,bgDepthSamplerSampler,texCoord).x;var depthNonLinear: f32=uniforms.projectionMatrix[2].z+uniforms.projectionMatrix[3].z/depth;depthNonLinear=depthNonLinear*0.5+0.5;\n#endif\nvar backColor: vec4f=textureSample(textureSampler,textureSamplerSampler,texCoord);\n#ifndef FLUIDRENDERING_FIXED_THICKNESS\nif (depth>=uniforms.cameraFar || depth<=0. || thickness<=uniforms.minimumThickness) {\n#else\nif (depth>=uniforms.cameraFar || depth<=0. || bgDepth<=depthNonLinear) {\n#endif\n#ifdef FLUIDRENDERING_COMPOSITE_MODE\nfragmentOutputs.color=vec4f(backColor.rgb*backColor.a,backColor.a);\n#else\nfragmentOutputs.color=backColor;\n#endif\nreturn fragmentOutputs;}\nvar viewPos: vec3f=computeViewPosFromUVDepth(texCoord,depth);var ddx: vec3f=getViewPosFromTexCoord(texCoord+vec2f(uniforms.texelSize.x,0.))-viewPos;var ddy: vec3f=getViewPosFromTexCoord(texCoord+vec2f(0.,uniforms.texelSize.y))-viewPos;var ddx2: vec3f=viewPos-getViewPosFromTexCoord(texCoord+vec2f(-uniforms.texelSize.x,0.));if (abs(ddx.z)>abs(ddx2.z)) {ddx=ddx2;}\nvar ddy2: vec3f=viewPos-getViewPosFromTexCoord(texCoord+vec2f(0.,-uniforms.texelSize.y));if (abs(ddy.z)>abs(ddy2.z)) {ddy=ddy2;}\nvar normal: vec3f=normalize(cross(ddy,ddx));\n#ifdef FLUIDRENDERING_RHS\nnormal=-normal;\n#endif\n#if defined(FLUIDRENDERING_DEBUG) && defined(FLUIDRENDERING_DEBUG_SHOWNORMAL)\nfragmentOutputs.color=vec4f(normal*0.5+0.5,1.0);return fragmentOutputs;\n#endif\nvar rayDir: vec3f=normalize(viewPos); \n#ifdef FLUIDRENDERING_DIFFUSETEXTURE\nvar diffuseColor: vec3f=textureSampleLevel(diffuseSampler,diffuseSamplerSampler,texCoord,0.0).rgb;\n#else\nvar diffuseColor: vec3f=uniforms.diffuseColor;\n#endif\nvar lightDir: vec3f=normalize((uniforms.viewMatrix*vec4f(-uniforms.dirLight,0.)).xyz);var H: vec3f =normalize(lightDir-rayDir);var specular: f32 =pow(max(0.0,dot(H,normal)),uniforms.specularPower);\n#ifdef FLUIDRENDERING_DEBUG_DIFFUSERENDERING\nvar diffuse: f32 =max(0.0,dot(lightDir,normal))*1.0;fragmentOutputs.color=vec4f(vec3f(0.1) /*ambient*/+vec3f(0.42,0.50,1.00)*diffuse+vec3f(0,0,0.2)+specular,1.);return fragmentOutputs;\n#endif\nvar refractionDir: vec3f=refract(rayDir,normal,ETA);var transmitted: vec4f=textureSampleLevel(textureSampler,textureSamplerSampler,vec2f(texCoord+refractionDir.xy*thickness*uniforms.refractionStrength),0.0);\n#ifdef FLUIDRENDERING_COMPOSITE_MODE\nif (transmitted.a==0.) {transmitted.a=thickness;}\n#endif\nvar transmittance: vec3f=exp(-uniforms.density*thickness*(1.0-diffuseColor)); \nvar refractionColor: vec3f=transmitted.rgb*transmittance;\n#ifdef FLUIDRENDERING_ENVIRONMENT\nvar reflectionDir: vec3f=reflect(rayDir,normal);var reflectionColor: vec3f=(textureSample(reflectionSampler,reflectionSamplerSampler,reflectionDir).rgb);var fresnel: f32=clamp(F0+(1.0-F0)*pow(1.0-dot(normal,-rayDir),5.0),0.,uniforms.fresnelClamp);var finalColor: vec3f=mix(refractionColor,reflectionColor,fresnel)+specular;\n#else\nvar finalColor: vec3f=refractionColor+specular;\n#endif\n#ifdef FLUIDRENDERING_VELOCITY\nvar velocity: f32=depthVel.g;finalColor=mix(finalColor,vec3f(1.0),smoothstep(0.3,1.0,velocity/6.0));\n#endif\nfragmentOutputs.color=vec4f(finalColor,transmitted.a);}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},94785:(e,t,n)=>{n.r(t),n.d(t,{lightVxFragmentDeclaration:()=>a});var r=n(98519),i="lightVxFragmentDeclaration",o="#ifdef LIGHT{X}\nuniform vec4 vLightData{X};uniform vec4 vLightDiffuse{X};\n#ifdef SPECULARTERM\nuniform vec4 vLightSpecular{X};\n#else\nvec4 vLightSpecular{X}=vec4(0.);\n#endif\n#ifdef SHADOW{X}\n#ifdef SHADOWCSM{X}\nuniform mat4 lightMatrix{X}[SHADOWCSMNUM_CASCADES{X}];varying vec4 vPositionFromLight{X}[SHADOWCSMNUM_CASCADES{X}];varying float vDepthMetric{X}[SHADOWCSMNUM_CASCADES{X}];varying vec4 vPositionFromCamera{X};\n#elif defined(SHADOWCUBE{X})\n#else\nvarying vec4 vPositionFromLight{X};varying float vDepthMetric{X};uniform mat4 lightMatrix{X};\n#endif\nuniform vec4 shadowsInfo{X};uniform vec2 depthValues{X};\n#endif\n#ifdef SPOTLIGHT{X}\nuniform vec4 vLightDirection{X};uniform vec4 vLightFalloff{X};\n#elif defined(POINTLIGHT{X})\nuniform vec4 vLightFalloff{X};\n#elif defined(HEMILIGHT{X})\nuniform vec3 vLightGround{X};\n#endif\n#if defined(AREALIGHT{X})\nuniform vec4 vLightWidth{X};uniform vec4 vLightHeight{X};\n#endif\n#endif\n";r.l.IncludesShadersStore[i]||(r.l.IncludesShadersStore[i]=o);var a={name:i,shader:o}},95087:(e,t,n)=>{n.d(t,{D9:()=>r,Ui:()=>s,f0:()=>a});var r,i=n(78322),o=n(66377);!function(e){e[e.HAS_INPUTS=1]="HAS_INPUTS",e[e.HAS_OUTPUTS=2]="HAS_OUTPUTS",e[e.HAS_INPUTS_AND_OUTPUTS=3]="HAS_INPUTS_AND_OUTPUTS"}(r||(r={}));var a=function(){function e(e,t){this.onDisposeObservable=new o.cP,this.engine=e,1&t&&(this._upstreamNodes=new Set),2&t&&(this._downstreamNodes=new Set)}return e.prototype.dispose=function(){if(this._downstreamNodes){for(var e=0,t=Array.from(this._downstreamNodes);e{n.d(t,{Cu:()=>u,Xy:()=>c,jj:()=>d,t4:()=>r,tO:()=>h,uM:()=>l,vr:()=>s});var r,i=n(48810),o=n(8046),a=n(56740);!function(e){e[e.CW=0]="CW",e[e.CCW=1]="CCW"}(r||(r={}));var s=function(){function e(){}return e.Interpolate=function(e,t,n,r,i){if(0===e)return 0;for(var o=1-3*r+3*t,a=3*r-6*t,s=3*t,l=e,c=0;c<5;c++){var u=l*l;l-=1/(3*o*u+2*a*l+s)*(o*(u*l)+a*u+s*l-e),l=Math.min(1,Math.max(0,l))}return 3*Math.pow(1-l,2)*l*n+3*(1-l)*Math.pow(l,2)*i+Math.pow(l,3)},e}(),l=function(){function e(e){this._radians=e,this._radians<0&&(this._radians+=2*Math.PI)}return e.prototype.degrees=function(){return 180*this._radians/Math.PI},e.prototype.radians=function(){return this._radians},e.BetweenTwoPoints=function(t,n){var r=n.subtract(t);return new e(Math.atan2(r.y,r.x))},e.BetweenTwoVectors=function(t,n){var r=t.lengthSquared()*n.lengthSquared();if(0===r)return new e(Math.PI/2);r=Math.sqrt(r);var o=t.dot(n)/r;return o=(0,i.Clamp)(o,-1,1),new e(Math.acos(o))},e.FromRadians=function(t){return new e(t)},e.FromDegrees=function(t){return new e(t*Math.PI/180)},e}(),c=function(e,t,n){this.startPoint=e,this.midPoint=t,this.endPoint=n;var r=Math.pow(t.x,2)+Math.pow(t.y,2),i=(Math.pow(e.x,2)+Math.pow(e.y,2)-r)/2,a=(r-Math.pow(n.x,2)-Math.pow(n.y,2))/2,s=(e.x-t.x)*(t.y-n.y)-(t.x-n.x)*(e.y-t.y);this.centerPoint=new o.I9((i*(t.y-n.y)-a*(e.y-t.y))/s,((e.x-t.x)*a-(t.x-n.x)*i)/s),this.radius=this.centerPoint.subtract(this.startPoint).length(),this.startAngle=l.BetweenTwoPoints(this.centerPoint,this.startPoint);var c=this.startAngle.degrees(),u=l.BetweenTwoPoints(this.centerPoint,this.midPoint).degrees(),h=l.BetweenTwoPoints(this.centerPoint,this.endPoint).degrees();u-c>180&&(u-=360),u-c<-180&&(u+=360),h-u>180&&(h-=360),h-u<-180&&(h+=360),this.orientation=u-c<0?0:1,this.angle=l.FromDegrees(0===this.orientation?c-h:h-c)},u=function(){function e(e,t){this._points=new Array,this._length=0,this.closed=!1,this._points.push(new o.I9(e,t))}return e.prototype.addLineTo=function(e,t){if(this.closed)return this;var n=new o.I9(e,t),r=this._points[this._points.length-1];return this._points.push(n),this._length+=n.subtract(r).length(),this},e.prototype.addArcTo=function(e,t,n,r,i){if(void 0===i&&(i=36),this.closed)return this;var a=this._points[this._points.length-1],s=new o.I9(e,t),l=new o.I9(n,r),u=new c(a,s,l),h=u.angle.radians()/i;0===u.orientation&&(h*=-1);for(var d=u.startAngle.radians()+h,p=0;pNumber.EPSILON){if(l<0&&(o=this._points[i],s=-s,a=this._points[r],l=-l),e.ya.y)continue;if(e.y===o.y&&e.x===o.x)return!0;var c=l*(e.x-o.x)-s*(e.y-o.y);if(0===c)return!0;if(c<0)continue;t=!t}else{if(e.y!==o.y)continue;if(a.x<=e.x&&e.x<=o.x||o.x<=e.x&&e.x<=a.x)return!0}}return t},e.prototype.close=function(){return this.closed=!0,this},e.prototype.length=function(){var e=this._length;if(this.closed){var t=this._points[this._points.length-1];e+=this._points[0].subtract(t).length()}return e},e.prototype.area=function(){for(var e=this._points.length,t=0,n=e-1,r=0;r1)return o.I9.Zero();for(var t=e*this.length(),n=0,r=0;r=n&&t<=l){var c=s.normalize(),u=t-n;return new o.I9(a.x+c.x*u,a.y+c.y*u)}n=l}return o.I9.Zero()},e.StartingAt=function(t,n){return new e(t,n)},e}(),h=function(){function e(e,t,n,r){void 0===t&&(t=null),void 0===r&&(r=!1),this.path=e,this._curve=new Array,this._distances=new Array,this._tangents=new Array,this._normals=new Array,this._binormals=new Array,this._pointAtData={id:0,point:o.Pq.Zero(),previousPointArrayIndex:0,position:0,subPosition:0,interpolateReady:!1,interpolationMatrix:o.uq.Identity()};for(var i=0;in){var r=t;t=n,n=r}var i=this.getCurve(),o=this.getPointAt(t),a=this.getPreviousPointIndexAt(t),s=this.getPointAt(n),l=this.getPreviousPointIndexAt(n)+1,c=[];return 0!==t&&(a++,c.push(o)),c.push.apply(c,i.slice(a,l)),1===n&&1!==t||c.push(s),new e(c,this.getNormalAt(t),this._raw,this._alignTangentsWithPath)},e.prototype.update=function(e,t,n){void 0===t&&(t=null),void 0===n&&(n=!1);for(var r=0;rt+1;)t++,n=this._curve[e].subtract(this._curve[e-t]);return n},e.prototype._normalVector=function(e,t){var n,r=e.length();if(0===r&&(r=1),null==t){var s;s=(0,i.WithinEpsilon)(Math.abs(e.y)/r,1,a.bH)?(0,i.WithinEpsilon)(Math.abs(e.x)/r,1,a.bH)?(0,i.WithinEpsilon)(Math.abs(e.z)/r,1,a.bH)?o.Pq.Zero():new o.Pq(0,0,1):new o.Pq(1,0,0):new o.Pq(0,-1,0),n=o.Pq.Cross(e,s)}else n=o.Pq.Cross(e,t),o.Pq.CrossToRef(n,e,n);return n.normalize(),n},e.prototype._updatePointAtData=function(e,t){if(void 0===t&&(t=!1),this._pointAtData.id===e)return this._pointAtData.interpolateReady||this._updateInterpolationMatrix(),this._pointAtData;this._pointAtData.id=e;var n=this.getPoints();if(e<=0)return this._setPointAtData(0,0,n[0],0,t);if(e>=1)return this._setPointAtData(1,1,n[n.length-1],n.length-1,t);for(var r,i=n[0],a=0,s=e*this.length(),l=1;ls){var u=(a-s)/c,h=i.subtract(r),d=r.add(h.scaleInPlace(u));return this._setPointAtData(e,1-u,d,l-1,t)}i=r}return this._pointAtData},e.prototype._setPointAtData=function(e,t,n,r,i){return this._pointAtData.point=n,this._pointAtData.position=e,this._pointAtData.subPosition=t,this._pointAtData.previousPointArrayIndex=r,this._pointAtData.interpolateReady=i,i&&this._updateInterpolationMatrix(),this._pointAtData},e.prototype._updateInterpolationMatrix=function(){this._pointAtData.interpolationMatrix=o.uq.Identity();var e=this._pointAtData.previousPointArrayIndex;if(e!==this._tangents.length-1){var t=e+1,n=this._tangents[e].clone(),r=this._normals[e].clone(),i=this._binormals[e].clone(),a=this._tangents[t].clone(),s=this._normals[t].clone(),l=this._binormals[t].clone(),c=o.PT.RotationQuaternionFromAxis(r,i,n),u=o.PT.RotationQuaternionFromAxis(s,l,a);o.PT.Slerp(c,u,this._pointAtData.subPosition).toRotationMatrix(this._pointAtData.interpolationMatrix)}},e}(),d=function(){function e(e){this._length=0,this._points=e,this._length=this._computeLength(e)}return e.CreateQuadraticBezier=function(t,n,r,i){i=i>2?i:3;for(var a=[],s=function(e,t,n,r){return(1-e)*(1-e)*t+2*e*(1-e)*n+e*e*r},l=0;l<=i;l++)a.push(new o.Pq(s(l/i,t.x,n.x,r.x),s(l/i,t.y,n.y,r.y),s(l/i,t.z,n.z,r.z)));return new e(a)},e.CreateCubicBezier=function(t,n,r,i,a){a=a>3?a:4;for(var s=[],l=function(e,t,n,r,i){return(1-e)*(1-e)*(1-e)*t+3*e*(1-e)*(1-e)*n+3*e*e*(1-e)*r+e*e*e*i},c=0;c<=a;c++)s.push(new o.Pq(l(c/a,t.x,n.x,r.x,i.x),l(c/a,t.y,n.y,r.y,i.y),l(c/a,t.z,n.z,r.z,i.z)));return new e(s)},e.CreateHermiteSpline=function(t,n,r,i,a){for(var s=[],l=1/a,c=0;c<=a;c++)s.push(o.Pq.Hermite(t,n,r,i,c*l));return new e(s)},e.CreateCatmullRomSpline=function(t,n,r){var i=[],a=1/n,s=0;if(r){for(var l=t.length,c=0;c{n.d(t,{V:()=>s});var r=n(78322),i=n(7164),o=n(45109),a=20000630;function s(e,t){if(e.getUint32(0,!0)!=a)throw new Error("Incorrect OpenEXR format");var n=e.getUint8(4),s=e.getUint8(5),l={singleTile:!!(2&s),longName:!!(4&s),deepFormat:!!(8&s),multiPart:!!(16&s)};t.value=8;for(var c={},u=!0;u;){var h=(0,o.T$)(e.buffer,t);if(h){var d=(0,o.T$)(e.buffer,t),p=(0,o.PX)(e,t),f=(0,o.zX)(e,t,d,p);void 0===f?i.V.Warn("Unknown header attribute type ".concat(d,"'.")):c[h]=f}else u=!1}if(-5&s)throw new Error("Unsupported file format");return(0,r.Cl)({version:n,spec:l},c)}},95579:(e,t,n)=>{n.r(t),n.d(t,{chromaticAberrationPixelShader:()=>a});var r=n(98519),i="chromaticAberrationPixelShader",o="uniform sampler2D textureSampler; \nuniform float chromatic_aberration;uniform float radialIntensity;uniform vec2 direction;uniform vec2 centerPosition;uniform float screen_width;uniform float screen_height;varying vec2 vUV;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{vec2 centered_screen_pos=vec2(vUV.x-centerPosition.x,vUV.y-centerPosition.y);vec2 directionOfEffect=direction;if(directionOfEffect.x==0. && directionOfEffect.y==0.){directionOfEffect=normalize(centered_screen_pos);}\nfloat radius2=centered_screen_pos.x*centered_screen_pos.x\n+ centered_screen_pos.y*centered_screen_pos.y;float radius=sqrt(radius2);vec3 ref_indices=vec3(-0.3,0.0,0.3);float ref_shiftX=chromatic_aberration*pow(radius,radialIntensity)*directionOfEffect.x/screen_width;float ref_shiftY=chromatic_aberration*pow(radius,radialIntensity)*directionOfEffect.y/screen_height;vec2 ref_coords_r=vec2(vUV.x+ref_indices.r*ref_shiftX,vUV.y+ref_indices.r*ref_shiftY*0.5);vec2 ref_coords_g=vec2(vUV.x+ref_indices.g*ref_shiftX,vUV.y+ref_indices.g*ref_shiftY*0.5);vec2 ref_coords_b=vec2(vUV.x+ref_indices.b*ref_shiftX,vUV.y+ref_indices.b*ref_shiftY*0.5);vec4 r=texture2D(textureSampler,ref_coords_r);vec4 g=texture2D(textureSampler,ref_coords_g);vec4 b=texture2D(textureSampler,ref_coords_b);float a=clamp(r.a+g.a+b.a,0.,1.);gl_FragColor=vec4(r.r,g.g,b.b,a);}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},95803:(e,t,n)=>{function r(e,t){return!(!e.parent||e.parent!==t&&!r(e.parent,t))}function i(e){if(e.getClassName)return e.getClassName()}function o(e,t){return e===t&&("Vector2"===e||"Vector3"===e||"Vector4"===e||"Quaternion"===e)}function a(e,t){return e===t&&("Matrix"===e||"Matrix2D"===e||"Matrix3D"===e)}function s(e,t){return"FlowGraphInteger"===e&&"FlowGraphInteger"===t}function l(e,t){var n="number"==typeof e||"number"==typeof(null==e?void 0:e.value);return n&&!t?!isNaN(c(e)):n}function c(e){return"number"==typeof e?e:e.value}n.d(t,{$w:()=>c,Ah:()=>r,An:()=>s,I$:()=>i,VW:()=>a,a2:()=>o,kf:()=>l})},96120:(e,t,n)=>{n.r(t),n.d(t,{FlowGraphDebounceBlock:()=>s});var r=n(78322),i=n(88099),o=n(88469),a=n(34623),s=function(e){function t(t){var n=e.call(this,t)||this;return n.count=n.registerDataInput("count",i.Es),n.reset=n._registerSignalInput("reset"),n.currentCount=n.registerDataOutput("currentCount",i.Es),n}return(0,r.C6)(t,e),t.prototype._execute=function(e,t){if(t!==this.reset){var n=this.count.getValue(e),r=e._getExecutionVariable(this,"debounceCount",0)+1;this.currentCount.setValue(r,e),e._setExecutionVariable(this,"debounceCount",r),r>=n&&(this.out._activateSignal(e),e._setExecutionVariable(this,"debounceCount",0))}else e._setExecutionVariable(this,"debounceCount",0)},t.prototype.getClassName=function(){return"FlowGraphDebounceBlock"},t}(o.w);(0,a.Y5)("FlowGraphDebounceBlock",s)},96588:(e,t,n)=>{n.r(t),n.d(t,{_WebAudioStaticSound:()=>p,_WebAudioStaticSoundBuffer:()=>f});var r=n(78322),i=n(78078),o=n(65572),a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,r.C6)(t,e),t}(n(18333).g),s=n(27063),l=n(82145),c=n(18285),u=n(9918),h=n(85182),d=n(63982),p=function(e){function t(n,r,i){var o,a,s,l,c,u,h,d,p,f=e.call(this,n,r)||this;return f._spatial=null,f._spatialAutoUpdate=!0,f._spatialMinUpdateTime=0,f._stereo=null,"boolean"==typeof i.spatialAutoUpdate&&(f._spatialAutoUpdate=i.spatialAutoUpdate),"number"==typeof i.spatialMinUpdateTime&&(f._spatialMinUpdateTime=i.spatialMinUpdateTime),f._options={autoplay:null!==(o=i.autoplay)&&void 0!==o&&o,duration:null!==(a=i.duration)&&void 0!==a?a:0,loop:null!==(s=i.loop)&&void 0!==s&&s,loopEnd:null!==(l=i.loopEnd)&&void 0!==l?l:0,loopStart:null!==(c=i.loopStart)&&void 0!==c?c:0,maxInstances:null!==(u=i.maxInstances)&&void 0!==u?u:1/0,pitch:null!==(h=i.pitch)&&void 0!==h?h:0,playbackRate:null!==(d=i.playbackRate)&&void 0!==d?d:1,startOffset:null!==(p=i.startOffset)&&void 0!==p?p:0},f._subGraph=new t._SubGraph(f),f}return(0,r.C6)(t,e),t.prototype._initAsync=function(e,t){return(0,r.sH)(this,void 0,void 0,(function(){var n;return(0,r.YH)(this,(function(r){switch(r.label){case 0:return this._audioContext=this.engine._audioContext,e instanceof f?(this._buffer=e,[3,3]):[3,1];case 1:return"string"==typeof e||Array.isArray(e)||e instanceof ArrayBuffer||e instanceof AudioBuffer?(n=this,[4,this.engine.createSoundBufferAsync(e,t)]):[3,3];case 2:n._buffer=r.sent(),r.label=3;case 3:return t.outBus?(this.outBus=t.outBus,[3,6]):[3,4];case 4:return!1===t.outBusAutoDefault?[3,6]:[4,this.engine.isReadyPromise];case 5:r.sent(),this.outBus=this.engine.defaultMainBus,r.label=6;case 6:return[4,this._subGraph.initAsync(t)];case 7:return r.sent(),(0,s.GB)(t)&&this._initSpatialProperty(),t.autoplay&&this.play(),this.engine._addNode(this),[2]}}))}))},Object.defineProperty(t.prototype,"buffer",{get:function(){return this._buffer},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_inNode",{get:function(){return this._subGraph._inNode},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_outNode",{get:function(){return this._subGraph._outNode},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"spatial",{get:function(){return this._spatial?this._spatial:this._initSpatialProperty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stereo",{get:function(){var e;return null!==(e=this._stereo)&&void 0!==e?e:this._stereo=new l.i(this._subGraph)},enumerable:!1,configurable:!0}),t.prototype.cloneAsync=function(){return(0,r.sH)(this,arguments,void 0,(function(e){var t;return void 0===e&&(e=null),(0,r.YH)(this,(function(n){switch(n.label){case 0:return[4,this.engine.createSoundAsync(this.name,(null==e?void 0:e.cloneBuffer)?this.buffer.clone():this.buffer,this._options)];case 1:return(t=n.sent()).outBus=(null==e?void 0:e.outBus)?e.outBus:this.outBus,[2,t]}}))}))},t.prototype.dispose=function(){var t;e.prototype.dispose.call(this),null===(t=this._spatial)||void 0===t||t.dispose(),this._spatial=null,this._stereo=null,this._subGraph.dispose(),this.engine._removeNode(this)},t.prototype.getClassName=function(){return"_WebAudioStaticSound"},t.prototype._createInstance=function(){return new m(this,this._options)},t.prototype._connect=function(t){var n;return!!e.prototype._connect.call(this,t)&&(t._inNode&&(null===(n=this._outNode)||void 0===n||n.connect(t._inNode)),!0)},t.prototype._disconnect=function(t){var n;return!!e.prototype._disconnect.call(this,t)&&(t._inNode&&(null===(n=this._outNode)||void 0===n||n.disconnect(t._inNode)),!0)},t.prototype._initSpatialProperty=function(){return this._spatial||(this._spatial=new d.i(this._subGraph,this._spatialAutoUpdate,this._spatialMinUpdateTime)),this._spatial},t._SubGraph=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,r.C6)(t,e),Object.defineProperty(t.prototype,"_downstreamNodes",{get:function(){var e;return null!==(e=this._owner._downstreamNodes)&&void 0!==e?e:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_upstreamNodes",{get:function(){var e;return null!==(e=this._owner._upstreamNodes)&&void 0!==e?e:null},enumerable:!1,configurable:!0}),t}(h.Q),t}(i.k),f=function(e){function t(t){return e.call(this,t)||this}return(0,r.C6)(t,e),t.prototype._initAsync=function(e,t){return(0,r.sH)(this,void 0,void 0,(function(){var n;return(0,r.YH)(this,(function(r){switch(r.label){case 0:return e instanceof AudioBuffer?(this._audioBuffer=e,[3,7]):[3,1];case 1:return"string"!=typeof e?[3,3]:[4,this._initFromUrlAsync(e)];case 2:return r.sent(),[3,7];case 3:return Array.isArray(e)?[4,this._initFromUrlsAsync(e,null!==(n=t.skipCodecCheck)&&void 0!==n&&n)]:[3,5];case 4:return r.sent(),[3,7];case 5:return e instanceof ArrayBuffer?[4,this._initFromArrayBufferAsync(e)]:[3,7];case 6:r.sent(),r.label=7;case 7:return[2]}}))}))},Object.defineProperty(t.prototype,"channelCount",{get:function(){return this._audioBuffer.numberOfChannels},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"duration",{get:function(){return this._audioBuffer.duration},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return this._audioBuffer.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sampleRate",{get:function(){return this._audioBuffer.sampleRate},enumerable:!1,configurable:!0}),t.prototype.clone=function(e){void 0===e&&(e=null);for(var n=new AudioBuffer({length:this._audioBuffer.length,numberOfChannels:this._audioBuffer.numberOfChannels,sampleRate:this._audioBuffer.sampleRate}),r=0;r0?this._options.duration:void 0)):this._options.loop&&(this._setState(2),this.engine.stateChangedObservable.add(this._onEngineStateChanged))}},t.prototype.pause=function(){var e;5!==this._state&&(this._setState(5),this._enginePauseTime+=this.engine.currentTime-this._enginePlayTime,null===(e=this._sourceNode)||void 0===e||e.stop(),this._deinitSourceNode())},t.prototype.resume=function(){5===this._state&&this.play()},t.prototype.stop=function(e){var t,n;if(void 0===e&&(e={}),1!==this._state){this._setState(1);var r=this.engine.currentTime+(null!==(t=e.waitTime)&&void 0!==t?t:0);null===(n=this._sourceNode)||void 0===n||n.stop(r),this.engine.stateChangedObservable.removeCallback(this._onEngineStateChanged)}},t.prototype._connect=function(t){var n;return!!e.prototype._connect.call(this,t)&&(t instanceof p&&t._inNode&&(null===(n=this._outNode)||void 0===n||n.connect(t._inNode),this._isConnected=!0),!0)},t.prototype._disconnect=function(t){var n;return!!e.prototype._disconnect.call(this,t)&&(t instanceof p&&t._inNode&&(null===(n=this._outNode)||void 0===n||n.disconnect(t._inNode),this._isConnected=!1),!0)},t.prototype._deinitSourceNode=function(){if(this._sourceNode){if(this._isConnected&&!this._disconnect(this._sound))throw new Error("Disconnect failed");this._sourceNode.disconnect(this._volumeNode),this._sourceNode.removeEventListener("ended",this._onEnded),this._sourceNode=null}},t.prototype._initSourceNode=function(){if(!this._sourceNode){if(this._sourceNode=new AudioBufferSourceNode(this._sound._audioContext,{buffer:this._sound.buffer._audioBuffer}),this._sourceNode.addEventListener("ended",this._onEnded,{once:!0}),this._sourceNode.connect(this._volumeNode),!this._connect(this._sound))throw new Error("Connect failed");this._pitch=new u.k(this.engine,this._sourceNode.detune),this._playbackRate=new u.k(this.engine,this._sourceNode.playbackRate)}var e=this._sourceNode;e.detune.value=this._sound.pitch,e.loop=this._options.loop,e.loopEnd=this._options.loopEnd,e.loopStart=this._options.loopStart,e.playbackRate.value=this._sound.playbackRate},t}(a)},96672:(e,t,n)=>{n.r(t),n.d(t,{pickingVertexShaderWGSL:()=>a});var r=n(98519),i=(n(45699),n(27279),n(73683),n(68478),n(63866),n(98819),n(77320),n(21310),n(3641),n(86615),"pickingVertexShader"),o="attribute position: vec3f;\n#if defined(INSTANCES)\nattribute instanceMeshID: f32;\n#endif\n#include\n#include\n#include\n#include[0..maxSimultaneousMorphTargets]\n#include\nuniform viewProjection: mat4x4f;\n#if defined(INSTANCES)\nvarying vMeshID: f32;\n#endif\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#include\n#include[0..maxSimultaneousMorphTargets]\n#include\n#include\n#include\nvar worldPos: vec4f=finalWorld*vec4f(input.position,1.0);vertexOutputs.position=uniforms.viewProjection*worldPos;\n#if defined(INSTANCES)\nvertexOutputs.vMeshID=input.instanceMeshID;\n#endif\n}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},96795:(e,t,n)=>{n.r(t),n.d(t,{postprocessVertexShader:()=>a});var r=n(98519),i="postprocessVertexShader",o="attribute vec2 position;uniform vec2 scale;varying vec2 vUV;const vec2 madd=vec2(0.5,0.5);\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvUV=(position*madd+madd)*scale;gl_Position=vec4(position,0.0,1.0);\n#define CUSTOM_VERTEX_MAIN_END\n}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},96830:(e,t,n)=>{n.r(t),n.d(t,{bumpFragmentMainFunctionsWGSL:()=>a});var r=n(98519),i="bumpFragmentMainFunctions",o="#if defined(BUMP) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC) || defined(DETAIL)\n#if defined(TANGENT) && defined(NORMAL) \nvarying vTBN0: vec3f;varying vTBN1: vec3f;varying vTBN2: vec3f;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\nuniform normalMatrix: mat4x4f;fn toNormalMatrix(m: mat4x4f)->mat4x4f\n{var a00=m[0][0];var a01=m[0][1];var a02=m[0][2];var a03=m[0][3];var a10=m[1][0];var a11=m[1][1];var a12=m[1][2];var a13=m[1][3];var a20=m[2][0]; \nvar a21=m[2][1];var a22=m[2][2];var a23=m[2][3];var a30=m[3][0]; \nvar a31=m[3][1];var a32=m[3][2];var a33=m[3][3];var b00=a00*a11-a01*a10;var b01=a00*a12-a02*a10;var b02=a00*a13-a03*a10;var b03=a01*a12-a02*a11;var b04=a01*a13-a03*a11;var b05=a02*a13-a03*a12;var b06=a20*a31-a21*a30;var b07=a20*a32-a22*a30;var b08=a20*a33-a23*a30;var b09=a21*a32-a22*a31;var b10=a21*a33-a23*a31;var b11=a22*a33-a23*a32;var det=b00*b11-b01*b10+b02*b09+b03*b08-b04*b07+b05*b06;var mi=mat4x4(\n(a11*b11-a12*b10+a13*b09)/det,\n(a02*b10-a01*b11-a03*b09)/det,\n(a31*b05-a32*b04+a33*b03)/det,\n(a22*b04-a21*b05-a23*b03)/det,\n(a12*b08-a10*b11-a13*b07)/det,\n(a00*b11-a02*b08+a03*b07)/det,\n(a32*b02-a30*b05-a33*b01)/det,\n(a20*b05-a22*b02+a23*b01)/det,\n(a10*b10-a11*b08+a13*b06)/det,\n(a01*b08-a00*b10-a03*b06)/det,\n(a30*b04-a31*b02+a33*b00)/det,\n(a21*b02-a20*b04-a23*b00)/det,\n(a11*b07-a10*b09-a12*b06)/det,\n(a00*b09-a01*b07+a02*b06)/det,\n(a31*b01-a30*b03-a32*b00)/det,\n(a20*b03-a21*b01+a22*b00)/det);return mat4x4(mi[0][0],mi[1][0],mi[2][0],mi[3][0],\nmi[0][1],mi[1][1],mi[2][1],mi[3][1],\nmi[0][2],mi[1][2],mi[2][2],mi[3][2],\nmi[0][3],mi[1][3],mi[2][3],mi[3][3]);}\n#endif\nfn perturbNormalBase(cotangentFrame: mat3x3f,normal: vec3f,scale: f32)->vec3f\n{var output=normal;\n#ifdef NORMALXYSCALE\noutput=normalize(output* vec3f(scale,scale,1.0));\n#endif\nreturn normalize(cotangentFrame*output);}\nfn perturbNormal(cotangentFrame: mat3x3f,textureSample: vec3f,scale: f32)->vec3f\n{return perturbNormalBase(cotangentFrame,textureSample*2.0-1.0,scale);}\nfn cotangent_frame(normal: vec3f,p: vec3f,uv: vec2f,tangentSpaceParams: vec2f)->mat3x3f\n{var dp1: vec3f=dpdx(p);var dp2: vec3f=dpdy(p);var duv1: vec2f=dpdx(uv);var duv2: vec2f=dpdy(uv);var dp2perp: vec3f=cross(dp2,normal);var dp1perp: vec3f=cross(normal,dp1);var tangent: vec3f=dp2perp*duv1.x+dp1perp*duv2.x;var bitangent: vec3f=dp2perp*duv1.y+dp1perp*duv2.y;tangent*=tangentSpaceParams.x;bitangent*=tangentSpaceParams.y;var det: f32=max(dot(tangent,tangent),dot(bitangent,bitangent));var invmax: f32=select(inverseSqrt(det),0.0,det==0.0);return mat3x3f(tangent*invmax,bitangent*invmax,normal);}\n#endif\n";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]=o);var a={name:i,shader:o}},96832:(e,t,n)=>{n.d(t,{K:()=>i,z:()=>o});var r=n(8046),i=function(){function e(e){void 0===e&&(e=[1,0,0,1]),this._m=e}return Object.defineProperty(e.prototype,"m",{get:function(){return this._m},enumerable:!1,configurable:!0}),e.prototype.transformVector=function(e){return this.transformVectorToRef(e,new r.I9)},e.prototype.transformVectorToRef=function(e,t){return t.x=e.x*this._m[0]+e.y*this._m[1],t.y=e.x*this._m[2]+e.y*this._m[3],t},e.prototype.asArray=function(){return this.toArray()},e.prototype.toArray=function(e){void 0===e&&(e=[]);for(var t=0;t<4;t++)e[t]=this._m[t];return e},e.prototype.fromArray=function(e){for(var t=0;t<4;t++)this._m[t]=e[t];return this},e.prototype.multiplyToRef=function(e,t){var n=e._m,r=this._m,i=t._m;return i[0]=n[0]*r[0]+n[1]*r[2],i[1]=n[0]*r[1]+n[1]*r[3],i[2]=n[2]*r[0]+n[3]*r[2],i[3]=n[2]*r[1]+n[3]*r[3],t},e.prototype.multiply=function(t){return this.multiplyToRef(t,new e)},e.prototype.divideToRef=function(e,t){var n=this._m,r=e._m,i=t._m;return i[0]=n[0]/r[0],i[1]=n[1]/r[1],i[2]=n[2]/r[2],i[3]=n[3]/r[3],t},e.prototype.divide=function(t){return this.divideToRef(t,new e)},e.prototype.addToRef=function(e,t){var n=this._m,r=e.m,i=t.m;return i[0]=n[0]+r[0],i[1]=n[1]+r[1],i[2]=n[2]+r[2],i[3]=n[3]+r[3],t},e.prototype.add=function(t){return this.addToRef(t,new e)},e.prototype.subtractToRef=function(e,t){var n=this._m,r=e.m,i=t.m;return i[0]=n[0]-r[0],i[1]=n[1]-r[1],i[2]=n[2]-r[2],i[3]=n[3]-r[3],t},e.prototype.subtract=function(t){return this.subtractToRef(t,new e)},e.prototype.transpose=function(){var t=this._m;return new e([t[0],t[2],t[1],t[3]])},e.prototype.determinant=function(){var e=this._m;return e[0]*e[3]-e[1]*e[2]},e.prototype.inverse=function(){var t=this.determinant();if(0===t)throw new Error("Matrix is not invertible");var n=this._m,r=1/t;return new e([n[3]*r,-n[1]*r,-n[2]*r,n[0]*r])},e.prototype.equals=function(e,t){void 0===t&&(t=0);var n=this._m,r=e.m;return 0===t?n[0]===r[0]&&n[1]===r[1]&&n[2]===r[2]&&n[3]===r[3]:Math.abs(n[0]-r[0]){n.r(t),n.d(t,{FlowGraphJsonPointerParserBlock:()=>c});var r=n(78322),i=n(31198),o=n(88099),a=n(34623),s=n(8046),l=n(64726),c=function(e){function t(t){var n=e.call(this,o.Vv,t)||this;return n.config=t,n.object=n.registerDataOutput("object",o.Vv),n.propertyName=n.registerDataOutput("propertyName",o.Vv),n.setterFunction=n.registerDataOutput("setFunction",o.Vv,n._setPropertyValue.bind(n)),n.getterFunction=n.registerDataOutput("getFunction",o.Vv,n._getPropertyValue.bind(n)),n.generateAnimationsFunction=n.registerDataOutput("generateAnimationsFunction",o.Vv,n._getInterpolationAnimationPropertyInfo.bind(n)),n.templateComponent=new i.H(t.jsonPointer,n),n}return(0,r.C6)(t,e),t.prototype._doOperation=function(e){var t,n,r,i=this.templateComponent.getAccessor(this.config.pathConverter,e),o=i.info.get(i.object),a=null===(n=(t=i.info).getTarget)||void 0===n?void 0:n.call(t,i.object),s=null===(r=i.info.getPropertyName)||void 0===r?void 0:r[0](i.object);if(!a)throw new Error("Object is undefined");return this.object.setValue(a,e),s&&this.propertyName.setValue(s,e),o},t.prototype._setPropertyValue=function(e,t,n,r){var i,o,a=this.templateComponent.getAccessor(this.config.pathConverter,r),s=a.info.type;s.startsWith("Color")&&(n=u(n,s)),null===(o=(i=a.info).set)||void 0===o||o.call(i,n,a.object)},t.prototype._getPropertyValue=function(e,t,n){var r=this.templateComponent.getAccessor(this.config.pathConverter,n),i=r.info.type,o=r.info.get(r.object);return i.startsWith("Color")?function(e){if(e instanceof l.v9)return new s.Pq(e.r,e.g,e.b);if(e instanceof l.ov)return new s.IU(e.r,e.g,e.b,e.a);throw new Error("Invalid color type")}(o):o},t.prototype._getInterpolationAnimationPropertyInfo=function(e,t,n){var r=this.templateComponent.getAccessor(this.config.pathConverter,n);return function(e,t,n,i){var o,a=[],s=r.info.type;return s.startsWith("Color")&&(e=e.map((function(e){return{frame:e.frame,value:u(e.value,s)}}))),null===(o=r.info.interpolation)||void 0===o||o.forEach((function(t,o){var s,l=(null===(s=r.info.getPropertyName)||void 0===s?void 0:s[o](r.object))||"Animation-interpolation-"+o,c=e;n!==t.type&&(c=e.map((function(e){return{frame:e.frame,value:t.getValue(void 0,e.value.asArray?e.value.asArray():[e.value],0,1)}})));for(var u=0,h=t.buildAnimations(r.object,l,60,c);u{n.r(t),n.d(t,{FlowGraphContextBlock:()=>s});var r=n(78322),i=n(45749),o=n(88099),a=n(34623),s=function(e){function t(t){var n=e.call(this,t)||this;return n.userVariables=n.registerDataOutput("userVariables",o.Vv),n.executionId=n.registerDataOutput("executionId",o.Es),n}return(0,r.C6)(t,e),t.prototype._updateOutputs=function(e){this.userVariables.setValue(e.userVariables,e),this.executionId.setValue(e.executionId,e)},t.prototype.serialize=function(t){e.prototype.serialize.call(this,t)},t.prototype.getClassName=function(){return"FlowGraphContextBlock"},t}(i.e);(0,a.Y5)("FlowGraphContextBlock",s)},96925:(e,t,n)=>{n.d(t,{v:()=>o});var r=n(81152),i=n(3429),o=function(){function e(e,t,n,r,i){this._textures=null,this._faceIndices=null,this._layerIndices=null,this._samples=1,this._attachments=null,this._generateStencilBuffer=!1,this._generateDepthBuffer=!1,this._depthStencilTextureWithStencil=!1,this.disableAutomaticMSAAResolve=!1,this.resolveMSAAColors=!0,this.resolveMSAADepth=!1,this.resolveMSAAStencil=!1,this.depthReadOnly=!1,this.stencilReadOnly=!1,this._isMulti=e,this._isCube=t,this._size=n,this._engine=r,this._depthStencilTexture=null,this.label=i}return Object.defineProperty(e.prototype,"depthStencilTexture",{get:function(){return this._depthStencilTexture},enumerable:!1,configurable:!0}),e.prototype.setDepthStencilTexture=function(e,t){void 0===t&&(t=!0),t&&this._depthStencilTexture&&this._depthStencilTexture.dispose(),this._depthStencilTexture=e,this._generateDepthBuffer=this._generateStencilBuffer=this._depthStencilTextureWithStencil=!1,e&&(this._generateDepthBuffer=!0,this._generateStencilBuffer=this._depthStencilTextureWithStencil=(0,i.$l)(e.format))},Object.defineProperty(e.prototype,"depthStencilTextureWithStencil",{get:function(){return this._depthStencilTextureWithStencil},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isCube",{get:function(){return this._isCube},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isMulti",{get:function(){return this._isMulti},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"is2DArray",{get:function(){return this.layers>0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"is3D",{get:function(){return this.depth>0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){return this.width},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){var e;return null!==(e=this._size.width)&&void 0!==e?e:this._size},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){var e;return null!==(e=this._size.height)&&void 0!==e?e:this._size},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"layers",{get:function(){return this._size.layers||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"depth",{get:function(){return this._size.depth||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"texture",{get:function(){var e,t;return null!==(t=null===(e=this._textures)||void 0===e?void 0:e[0])&&void 0!==t?t:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textures",{get:function(){return this._textures},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"faceIndices",{get:function(){return this._faceIndices},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"layerIndices",{get:function(){return this._layerIndices},enumerable:!1,configurable:!0}),e.prototype.getBaseArrayLayer=function(e){var t,n,r,i;if(!this._textures)return-1;var o=this._textures[e],a=null!==(n=null===(t=this._layerIndices)||void 0===t?void 0:t[e])&&void 0!==n?n:0,s=null!==(i=null===(r=this._faceIndices)||void 0===r?void 0:r[e])&&void 0!==i?i:0;return o.isCube?6*a+s:o.is3D?0:a},Object.defineProperty(e.prototype,"samples",{get:function(){return this._samples},enumerable:!1,configurable:!0}),e.prototype.setSamples=function(e,t,n){if(void 0===t&&(t=!0),void 0===n&&(n=!1),this.samples===e&&!n)return e;var r=this._isMulti?this._engine.updateMultipleRenderTargetTextureSampleCount(this,e,t):this._engine.updateRenderTargetTextureSampleCount(this,e);return this._samples=e,r},e.prototype.resolveMSAATextures=function(){this.isMulti?this._engine.resolveMultiFramebuffer(this):this._engine.resolveFramebuffer(this)},e.prototype.generateMipMaps=function(){this._engine._currentRenderTarget===this&&this._engine.unBindFramebuffer(this,!0),this.isMulti?this._engine.generateMipMapsMultiFramebuffer(this):this._engine.generateMipMapsFramebuffer(this)},e.prototype.setTextures=function(e){Array.isArray(e)?this._textures=e:this._textures=e?[e]:null},e.prototype.setTexture=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=!0),this._textures||(this._textures=[]),this._textures[t]!==e&&(this._textures[t]&&n&&this._textures[t].dispose(),this._textures[t]=e)},e.prototype.setLayerAndFaceIndices=function(e,t){this._layerIndices=e,this._faceIndices=t},e.prototype.setLayerAndFaceIndex=function(e,t,n){void 0===e&&(e=0),this._layerIndices||(this._layerIndices=[]),this._faceIndices||(this._faceIndices=[]),void 0!==t&&t>=0&&(this._layerIndices[e]=t),void 0!==n&&n>=0&&(this._faceIndices[e]=n)},e.prototype.createDepthStencilTexture=function(e,t,n,i,o,a){var s;return void 0===e&&(e=0),void 0===t&&(t=!0),void 0===n&&(n=!1),void 0===i&&(i=1),void 0===o&&(o=r.Y.TEXTUREFORMAT_DEPTH32_FLOAT),null===(s=this._depthStencilTexture)||void 0===s||s.dispose(),this._depthStencilTextureWithStencil=n,this._depthStencilTextureLabel=a,this._depthStencilTexture=this._engine.createDepthStencilTexture(this._size,{bilinearFiltering:t,comparisonFunction:e,generateStencil:n,isCube:this._isCube,samples:i,depthTextureFormat:o,label:a},this),this._depthStencilTexture},e.prototype._shareDepth=function(e){this.shareDepth(e)},e.prototype.shareDepth=function(e){this._depthStencilTexture&&(e._depthStencilTexture&&e._depthStencilTexture.dispose(),e._depthStencilTexture=this._depthStencilTexture,e._depthStencilTextureWithStencil=this._depthStencilTextureWithStencil,this._depthStencilTexture.incrementReferences())},e.prototype._swapAndDie=function(e){this.texture&&this.texture._swapAndDie(e),this._textures=null,this.dispose(!0)},e.prototype._cloneRenderTargetWrapper=function(){var e,t,n,i,o,a,s,l,c=null;if(this._isMulti){var u=this.textures;if(u&&u.length>0){var h=!1,d=u.length,p=-1,f=u[u.length-1]._source;14!==f&&12!==f||(h=!0,p=u[u.length-1].format,d--);for(var m=[],_=[],g=[],v=[],y=[],b=[],S=[],T={},E=0;E1&&e.setSamples(this.samples),e._swapRenderTargetWrapper(this),e.dispose()}},e.prototype.releaseTextures=function(){if(this._textures)for(var e=0;e{n.r(t),n.d(t,{glowMapGenerationVertexShaderWGSL:()=>a});var r=n(98519),i=(n(45699),n(27279),n(73683),n(68478),n(9436),n(63866),n(98819),n(77320),n(21310),n(3641),n(86615),n(63002),"glowMapGenerationVertexShader"),o="attribute position: vec3f;\n#include\n#include\n#include\n#include[0..maxSimultaneousMorphTargets]\n#include\n#include\nuniform viewProjection: mat4x4f;varying vPosition: vec4f;\n#ifdef UV1\nattribute uv: vec2f;\n#endif\n#ifdef UV2\nattribute uv2: vec2f;\n#endif\n#ifdef DIFFUSE\nvarying vUVDiffuse: vec2f;uniform diffuseMatrix: mat4x4f;\n#endif\n#ifdef OPACITY\nvarying vUVOpacity: vec2f;uniform opacityMatrix: mat4x4f;\n#endif\n#ifdef EMISSIVE\nvarying vUVEmissive: vec2f;uniform emissiveMatrix: mat4x4f;\n#endif\n#ifdef VERTEXALPHA\nattribute color: vec4f;varying vColor: vec4f;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {var positionUpdated: vec3f=input.position;\n#ifdef UV1\nvar uvUpdated: vec2f=input.uv;\n#endif\n#ifdef UV2\nvar uv2Updated: vec2f=input.uv2;\n#endif\n#include\n#include[0..maxSimultaneousMorphTargets]\n#include\n#include\n#include\nvar worldPos: vec4f=finalWorld* vec4f(positionUpdated,1.0);\n#ifdef CUBEMAP\nvertexOutputs.vPosition=worldPos;vertexOutputs.position=uniforms.viewProjection*finalWorld* vec4f(input.position,1.0);\n#else\nvertexOutputs.vPosition=uniforms.viewProjection*worldPos;vertexOutputs.position=vertexOutputs.vPosition;\n#endif\n#ifdef DIFFUSE\n#ifdef DIFFUSEUV1\nvertexOutputs.vUVDiffuse= (uniforms.diffuseMatrix* vec4f(uvUpdated,1.0,0.0)).xy;\n#endif\n#ifdef DIFFUSEUV2\nvertexOutputs.vUVDiffuse= (uniforms.diffuseMatrix* vec4f(uv2Updated,1.0,0.0)).xy;\n#endif\n#endif\n#ifdef OPACITY\n#ifdef OPACITYUV1\nvertexOutputs.vUVOpacity= (uniforms.opacityMatrix* vec4f(uvUpdated,1.0,0.0)).xy;\n#endif\n#ifdef OPACITYUV2\nvertexOutputs.vUVOpacity= (uniforms.opacityMatrix* vec4f(uv2Updated,1.0,0.0)).xy;\n#endif\n#endif\n#ifdef EMISSIVE\n#ifdef EMISSIVEUV1\nvertexOutputs.vUVEmissive= (uniforms.emissiveMatrix* vec4f(uvUpdated,1.0,0.0)).xy;\n#endif\n#ifdef EMISSIVEUV2\nvertexOutputs.vUVEmissive= (uniforms.emissiveMatrix* vec4f(uv2Updated,1.0,0.0)).xy;\n#endif\n#endif\n#ifdef VERTEXALPHA\nvertexOutputs.vColor=vertexInputs.color;\n#endif\n#include\n}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},97088:(e,t,n)=>{var r=n(98519),i=(n(36644),n(40647),"openpbrUboDeclaration");r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="uniform vTangentSpaceParams: vec2f;uniform vLightingIntensity: vec4f;uniform pointSize: f32;uniform vDebugMode: vec2f;uniform cameraInfo: vec4f;uniform vReflectionInfos: vec2f;uniform reflectionMatrix: mat4x4f;uniform vReflectionMicrosurfaceInfos: vec3f;uniform vReflectionPosition: vec3f;uniform vReflectionSize: vec3f;uniform vReflectionFilteringInfo: vec2f;uniform vReflectionDominantDirection: vec3f;uniform vReflectionColor: vec3f;uniform vSphericalL00: vec3f;uniform vSphericalL1_1: vec3f;uniform vSphericalL10: vec3f;uniform vSphericalL11: vec3f;uniform vSphericalL2_2: vec3f;uniform vSphericalL2_1: vec3f;uniform vSphericalL20: vec3f;uniform vSphericalL21: vec3f;uniform vSphericalL22: vec3f;uniform vSphericalX: vec3f;uniform vSphericalY: vec3f;uniform vSphericalZ: vec3f;uniform vSphericalXX_ZZ: vec3f;uniform vSphericalYY_ZZ: vec3f;uniform vSphericalZZ: vec3f;uniform vSphericalXY: vec3f;uniform vSphericalYZ: vec3f;uniform vSphericalZX: vec3f;uniform vBaseWeight: f32;uniform vBaseColor: vec4f;uniform vBaseDiffuseRoughness: f32;uniform vReflectanceInfo: vec4f;uniform vSpecularColor: vec4f;uniform vSpecularAnisotropy: vec3f;uniform vCoatWeight: f32;uniform vCoatColor: vec3f;uniform vCoatRoughness: f32;uniform vCoatRoughnessAnisotropy: f32;uniform vCoatIor: f32;uniform vCoatDarkening : f32;uniform vFuzzWeight: f32;uniform vFuzzColor: vec3f;uniform vFuzzRoughness: f32;uniform vGeometryCoatTangent: vec2f;uniform vEmissionColor: vec3f;uniform vThinFilmWeight: f32;uniform vThinFilmThickness: vec2f;uniform vThinFilmIor: f32;uniform vBaseWeightInfos: vec2f;uniform baseWeightMatrix: mat4x4f;uniform vBaseColorInfos: vec2f;uniform baseColorMatrix: mat4x4f;uniform vBaseDiffuseRoughnessInfos: vec2f;uniform baseDiffuseRoughnessMatrix: mat4x4f;uniform vBaseMetalnessInfos: vec2f;uniform baseMetalnessMatrix: mat4x4f;uniform vSpecularWeightInfos: vec2f;uniform specularWeightMatrix: mat4x4f;uniform vSpecularColorInfos: vec2f;uniform specularColorMatrix: mat4x4f;uniform vSpecularRoughnessInfos: vec2f;uniform specularRoughnessMatrix: mat4x4f;uniform vSpecularRoughnessAnisotropyInfos: vec2f;uniform specularRoughnessAnisotropyMatrix: mat4x4f;uniform vCoatWeightInfos: vec2f;uniform coatWeightMatrix: mat4x4f;uniform vCoatColorInfos: vec2f;uniform coatColorMatrix: mat4x4f;uniform vCoatRoughnessInfos: vec2f;uniform coatRoughnessMatrix: mat4x4f;uniform vCoatRoughnessAnisotropyInfos: vec2f;uniform coatRoughnessAnisotropyMatrix: mat4x4f;uniform vCoatDarkeningInfos : vec2f;uniform coatDarkeningMatrix : mat4x4f;uniform vFuzzWeightInfos: vec2f;uniform fuzzWeightMatrix: mat4x4f;uniform vFuzzColorInfos: vec2f;uniform fuzzColorMatrix: mat4x4f;uniform vFuzzRoughnessInfos: vec2f;uniform fuzzRoughnessMatrix: mat4x4f;uniform vGeometryNormalInfos: vec2f;uniform geometryNormalMatrix: mat4x4f;uniform vGeometryTangentInfos: vec2f;uniform geometryTangentMatrix: mat4x4f;uniform vGeometryCoatNormalInfos: vec2f;uniform geometryCoatNormalMatrix: mat4x4f;uniform vGeometryCoatTangentInfos: vec2f;uniform geometryCoatTangentMatrix: mat4x4f;uniform vGeometryOpacityInfos: vec2f;uniform geometryOpacityMatrix: mat4x4f;uniform vEmissionInfos: vec2f;uniform emissionMatrix: mat4x4f;uniform vThinFilmWeightInfos: vec2f;uniform thinFilmWeightMatrix: mat4x4f;uniform vThinFilmThicknessInfos: vec2f;uniform thinFilmThicknessMatrix: mat4x4f;uniform vAmbientOcclusionInfos: vec2f;uniform ambientOcclusionMatrix: mat4x4f;\n#define ADDITIONAL_UBO_DECLARATION\n#include\n#include\n")},97247:(e,t,n)=>{n.d(t,{L:()=>a});var r=n(93038),i=n(30922),o=n(66377),a=function(){function e(e,t){this._passes=[],this._passesDisabled=[],this._disabled=!1,this.onTexturesAllocatedObservable=new o.cP,this.name=e,this._frameGraph=t,this._reset()}return Object.defineProperty(e.prototype,"name",{get:function(){return this._name},set:function(e){this._name=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"disabled",{get:function(){return this._disabled},set:function(e){this._disabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"passes",{get:function(){return this._passes},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"passesDisabled",{get:function(){return this._passesDisabled},enumerable:!1,configurable:!0}),e.prototype.isReady=function(){return!0},e.prototype.dispose=function(){this._reset(),this.onTexturesAllocatedObservable.clear()},e.prototype._reset=function(){this._passes.length=0,this._passesDisabled.length=0},e.prototype._addPass=function(e,t){t?this._passesDisabled.push(e):this._passes.push(e)},e.prototype._checkTask=function(){for(var e,t=null,n=null,o=0,a=this._passes;o0){if(!this._checkSameRenderTarget(t,u)){for(var b=!0,S=0,T=h;S0?this._passesDisabled:this._passes},e.prototype._checkSameRenderTarget=function(e,t){if(null===e||null===t)return e===t;if(e.length!==t.length)return!1;for(var n=0;n{var r=n(44256),i=n(81152);r.ThinEngine.prototype.setAlphaMode=function(e,t,n){if(void 0===t&&(t=!1),void 0===n&&(n=0),this._alphaMode[n]!==e){var r=e===i.Y.ALPHA_DISABLE;this._alphaState.setAlphaBlend(!r,n),this._alphaState.setAlphaMode(e,n),t||(this.depthCullingState.depthMask=r),this._alphaMode[n]=e}else if(!t){var o=e===i.Y.ALPHA_DISABLE;this.depthCullingState.depthMask!==o&&(this.depthCullingState.depthMask=o)}}},97334:(e,t,n)=>{n.r(t),n.d(t,{lodCubePixelShader:()=>a});var r=n(98519),i="lodCubePixelShader",o="precision highp float;const float GammaEncodePowerApprox=1.0/2.2;varying vec2 vUV;uniform samplerCube textureSampler;uniform float lod;uniform int gamma;void main(void)\n{vec2 uv=vUV*2.0-1.0;\n#ifdef POSITIVEX\ngl_FragColor=textureCube(textureSampler,vec3(1.001,uv.y,uv.x),lod);\n#endif\n#ifdef NEGATIVEX\ngl_FragColor=textureCube(textureSampler,vec3(-1.001,uv.y,uv.x),lod);\n#endif\n#ifdef POSITIVEY\ngl_FragColor=textureCube(textureSampler,vec3(uv.y,1.001,uv.x),lod);\n#endif\n#ifdef NEGATIVEY\ngl_FragColor=textureCube(textureSampler,vec3(uv.y,-1.001,uv.x),lod);\n#endif\n#ifdef POSITIVEZ\ngl_FragColor=textureCube(textureSampler,vec3(uv,1.001),lod);\n#endif\n#ifdef NEGATIVEZ\ngl_FragColor=textureCube(textureSampler,vec3(uv,-1.001),lod);\n#endif\nif (gamma==0) {gl_FragColor.rgb=pow(gl_FragColor.rgb,vec3(GammaEncodePowerApprox));}}\n";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},97411:(e,t,n)=>{n.d(t,{G:()=>s});var r=n(78322),i=n(81152),o=n(30622),a=n(16110),s=function(){function e(){}return e.ExpandRGBDTexture=function(e){var t=this,a=e._texture;if(a&&e.isRGBD){var s=a.getEngine(),l=s.getCaps(),c=a.isReady,u=!1;l.textureHalfFloatRender&&l.textureHalfFloatLinearFiltering?(u=!0,a.type=i.Y.TEXTURETYPE_HALF_FLOAT):l.textureFloatRender&&l.textureFloatLinearFiltering&&(u=!0,a.type=i.Y.TEXTURETYPE_FLOAT),u&&(a.isReady=!1,a._isRGBD=!1,a.invertY=!1);var h=function(){return(0,r.sH)(t,void 0,void 0,(function(){var t,l,c,u;return(0,r.YH)(this,(function(r){switch(r.label){case 0:return t=s.isWebGPU,l=t?1:0,a.isReady=!1,t?[4,Promise.resolve().then(n.bind(n,37494))]:[3,2];case 1:return r.sent(),[3,4];case 2:return[4,Promise.resolve().then(n.bind(n,32407))];case 3:r.sent(),r.label=4;case 4:return(c=new o.w("rgbdDecode","rgbdDecode",null,null,1,null,i.Y.TEXTURE_TRILINEAR_SAMPLINGMODE,s,!1,void 0,a.type,void 0,null,!1,void 0,l)).externalTextureSamplerBinding=!0,u=s.createRenderTargetTexture(a.width,{generateDepthBuffer:!1,generateMipMaps:!1,generateStencilBuffer:!1,samplingMode:a.samplingMode,type:a.type,format:i.Y.TEXTUREFORMAT_RGBA}),c.onEffectCreatedObservable.addOnce((function(t){t.executeWhenCompiled((function(){c.onApply=function(e){e._bindTexture("textureSampler",a),e.setFloat2("scale",1,1)},e.getScene().postProcessManager.directRender([c],u,!0),s.restoreDefaultFramebuffer(),s._releaseTexture(a),c&&c.dispose(),u._swapAndDie(a),a.isReady=!0}))})),[2]}}))}))};u&&(c?h():e.onLoadObservable.addOnce(h))}},e.EncodeTextureToRGBD=function(e,t){return(0,r.sH)(this,arguments,void 0,(function(e,t,o){return void 0===o&&(o=i.Y.TEXTURETYPE_UNSIGNED_BYTE),(0,r.YH)(this,(function(r){switch(r.label){case 0:return t.getEngine().isWebGPU?[3,2]:[4,Promise.resolve().then(n.bind(n,22955))];case 1:return r.sent(),[3,4];case 2:return[4,Promise.resolve().then(n.bind(n,86558))];case 3:r.sent(),r.label=4;case 4:return[4,(0,a.Qs)("rgbdEncode",e,t,o,i.Y.TEXTURE_NEAREST_SAMPLINGMODE,i.Y.TEXTUREFORMAT_RGBA)];case 5:return[2,r.sent()]}}))}))},e}()},97468:(e,t,n)=>{n.r(t),n.d(t,{linePixelShader:()=>a});var r=n(98519),i=(n(27003),n(59262),n(13088),n(39643),"linePixelShader"),o="#include\nuniform vec4 color;\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include\n#include\ngl_FragColor=color;\n#define CUSTOM_FRAGMENT_MAIN_END\n}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},97478:(e,t,n)=>{n.d(t,{s:()=>i});var r=n(78322),i=function(e){function t(t,n){return e.call(this,t,n)||this}return(0,r.C6)(t,e),t}(n(99757).t)},97666:(e,t,n)=>{n.r(t),n.d(t,{rsmFullGlobalIlluminationPixelShaderWGSL:()=>a});var r=n(98519),i="rsmFullGlobalIlluminationPixelShader",o="/**\n* The implementation is a direct application of the formula found in http:\n*/\nvarying vUV: vec2f;uniform rsmLightMatrix: mat4x4f;uniform rsmInfo: vec4f;var textureSamplerSampler: sampler;var textureSampler: texture_2d;var normalSamplerSampler: sampler;var normalSampler: texture_2d;var rsmPositionW: texture_2d;var rsmNormalW: texture_2d;var rsmFlux: texture_2d;\n#ifdef TRANSFORM_NORMAL\nuniform invView: mat4x4f;\n#endif\nfn computeIndirect(p: vec3f,n: vec3f)->vec3f {var indirectDiffuse: vec3f= vec3f(0.);var intensity: f32=uniforms.rsmInfo.z;var edgeArtifactCorrection: f32=uniforms.rsmInfo.w;var texRSM: vec4f=uniforms.rsmLightMatrix* vec4f(p,1.);texRSM=vec4f(texRSM.xy/texRSM.w,texRSM.z,texRSM.w);texRSM=vec4f(texRSM.xy*0.5+0.5,texRSM.z,texRSM.w);var width: i32= i32(uniforms.rsmInfo.x);var height: i32= i32(uniforms.rsmInfo.y);for (var j: i32=0; j(i,j);var vplPositionW: vec3f=textureLoad(rsmPositionW,uv,0).xyz;var vplNormalW: vec3f=textureLoad(rsmNormalW,uv,0).xyz*2.0-1.0;var vplFlux: vec3f=textureLoad(rsmFlux,uv,0).rgb;vplPositionW-=vplNormalW*edgeArtifactCorrection; \nvar dist2: f32=dot(vplPositionW-p,vplPositionW-p);indirectDiffuse+=vplFlux*max(0.,dot(n,vplPositionW-p))*max(0.,dot(vplNormalW,p-vplPositionW))/(dist2*dist2);}}\nreturn clamp(indirectDiffuse*intensity,vec3f(0.0),vec3f(1.0));}\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var positionW: vec3f=textureSample(textureSampler,textureSamplerSampler,fragmentInputs.vUV).xyz;var normalW: vec3f=textureSample(normalSampler,normalSamplerSampler,fragmentInputs.vUV).xyz;\n#ifdef DECODE_NORMAL\nnormalW=normalW*2.0-1.0;\n#endif\n#ifdef TRANSFORM_NORMAL\nnormalW=(uniforms.invView* vec4f(normalW,0.)).xyz;\n#endif\nfragmentOutputs.color=vec4f(computeIndirect(positionW,normalW),1.0);}\n";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},97892:(e,t,n)=>{n.r(t),n.d(t,{_WebAudioMainBus:()=>a});var r=n(78322),i=n(97478),o=n(50016),a=function(e){function t(n,r){var i=e.call(this,n,r)||this;return i._subGraph=new t._SubGraph(i),i}return(0,r.C6)(t,e),t.prototype._initAsync=function(e){return(0,r.sH)(this,void 0,void 0,(function(){return(0,r.YH)(this,(function(t){switch(t.label){case 0:return[4,this._subGraph.initAsync(e)];case 1:if(t.sent(),this.engine.mainOut&&!this._connect(this.engine.mainOut))throw new Error("Connect failed");return this.engine._addMainBus(this),[2]}}))}))},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.engine._removeMainBus(this)},Object.defineProperty(t.prototype,"_inNode",{get:function(){return this._subGraph._inNode},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_outNode",{get:function(){return this._subGraph._outNode},enumerable:!1,configurable:!0}),t.prototype._connect=function(t){var n;return!!e.prototype._connect.call(this,t)&&(t._inNode&&(null===(n=this._outNode)||void 0===n||n.connect(t._inNode)),!0)},t.prototype._disconnect=function(t){var n;return!!e.prototype._disconnect.call(this,t)&&(t._inNode&&(null===(n=this._outNode)||void 0===n||n.disconnect(t._inNode)),!0)},t.prototype.getClassName=function(){return"_WebAudioMainBus"},t._SubGraph=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,r.C6)(t,e),Object.defineProperty(t.prototype,"_downstreamNodes",{get:function(){var e;return null!==(e=this._owner._downstreamNodes)&&void 0!==e?e:null},enumerable:!1,configurable:!0}),t}(o.H),t}(i.s)},98179:(e,t,n)=>{n.r(t),n.d(t,{spritesVertexShaderWGSL:()=>a});var r=n(98519),i=(n(79716),n(38197),n(55607),"spritesVertexShader"),o="attribute position: vec4f;attribute options: vec2f;attribute offsets: vec2f;attribute inverts: vec2f;attribute cellInfo: vec4f;attribute color: vec4f;uniform view: mat4x4f;uniform projection: mat4x4f;varying vUV: vec2f;varying vColor: vec4f;\n#include\n#include\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvar viewPos: vec3f=(uniforms.view* vec4f(input.position.xyz,1.0)).xyz; \nvar cornerPos: vec2f;var angle: f32=input.position.w;var size: vec2f= vec2f(input.options.x,input.options.y);var offset: vec2f=input.offsets.xy;cornerPos= vec2f(offset.x-0.5,offset.y -0.5)*size;var rotatedCorner: vec3f;rotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);rotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);rotatedCorner.z=0.;viewPos+=rotatedCorner;vertexOutputs.position=uniforms.projection*vec4f(viewPos,1.0); \nvertexOutputs.vColor=input.color;var uvOffset: vec2f= vec2f(abs(offset.x-input.inverts.x),abs(1.0-offset.y-input.inverts.y));var uvPlace: vec2f=input.cellInfo.xy;var uvSize: vec2f=input.cellInfo.zw;vertexOutputs.vUV.x=uvPlace.x+uvSize.x*uvOffset.x;vertexOutputs.vUV.y=uvPlace.y+uvSize.y*uvOffset.y;\n#ifdef FOG\nvertexOutputs.vFogDistance=viewPos;\n#endif\n#include\n#define CUSTOM_VERTEX_MAIN_END\n}";r.l.ShadersStoreWGSL[i]||(r.l.ShadersStoreWGSL[i]=o);var a={name:i,shader:o}},98185:(e,t,n)=>{var r=n(98519),i="pbrDebug";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]="#if DEBUGMODE>0\nif (input.vClipSpacePosition.x/input.vClipSpacePosition.w>=uniforms.vDebugMode.x) {var color: vec3f;\n#if DEBUGMODE==1\ncolor=fragmentInputs.vPositionW.rgb;\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==2 && defined(NORMAL)\ncolor=fragmentInputs.vNormalW.rgb;\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==3 && defined(BUMP) || DEBUGMODE==3 && defined(PARALLAX) || DEBUGMODE==3 && defined(ANISOTROPIC)\ncolor=TBN[0];\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==4 && defined(BUMP) || DEBUGMODE==4 && defined(PARALLAX) || DEBUGMODE==4 && defined(ANISOTROPIC)\ncolor=TBN[1];\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==5\ncolor=normalW;\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==6 && defined(MAINUV1)\ncolor= vec3f(input.vMainUV1,0.0);\n#elif DEBUGMODE==7 && defined(MAINUV2)\ncolor= vec3f(input.vMainUV2,0.0);\n#elif DEBUGMODE==8 && defined(CLEARCOAT) && defined(CLEARCOAT_BUMP)\ncolor=clearcoatOut.TBNClearCoat[0];\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==9 && defined(CLEARCOAT) && defined(CLEARCOAT_BUMP)\ncolor=clearcoatOut.TBNClearCoat[1];\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==10 && defined(CLEARCOAT)\ncolor=clearcoatOut.clearCoatNormalW;\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==11 && defined(ANISOTROPIC)\ncolor=anisotropicOut.anisotropicNormal;\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==12 && defined(ANISOTROPIC)\ncolor=anisotropicOut.anisotropicTangent;\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==13 && defined(ANISOTROPIC)\ncolor=anisotropicOut.anisotropicBitangent;\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==20 && defined(ALBEDO)\ncolor=albedoTexture.rgb;\n#ifndef GAMMAALBEDO\n#define DEBUGMODE_GAMMA\n#endif\n#elif DEBUGMODE==21 && defined(AMBIENT)\ncolor=aoOut.ambientOcclusionColorMap.rgb;\n#elif DEBUGMODE==22 && defined(OPACITY)\ncolor=opacityMap.rgb;\n#elif DEBUGMODE==23 && defined(EMISSIVE)\ncolor=emissiveColorTex.rgb;\n#ifndef GAMMAEMISSIVE\n#define DEBUGMODE_GAMMA\n#endif\n#elif DEBUGMODE==24 && defined(LIGHTMAP)\ncolor=lightmapColor;\n#ifndef GAMMALIGHTMAP\n#define DEBUGMODE_GAMMA\n#endif\n#elif DEBUGMODE==25 && defined(REFLECTIVITY) && defined(METALLICWORKFLOW)\ncolor=reflectivityOut.surfaceMetallicColorMap.rgb;\n#elif DEBUGMODE==26 && defined(REFLECTIVITY) && !defined(METALLICWORKFLOW)\ncolor=reflectivityOut.surfaceReflectivityColorMap.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==27 && defined(CLEARCOAT) && defined(CLEARCOAT_TEXTURE)\ncolor= vec3f(clearcoatOut.clearCoatMapData.rg,0.0);\n#elif DEBUGMODE==28 && defined(CLEARCOAT) && defined(CLEARCOAT_TINT) && defined(CLEARCOAT_TINT_TEXTURE)\ncolor=clearcoatOut.clearCoatTintMapData.rgb;\n#elif DEBUGMODE==29 && defined(SHEEN) && defined(SHEEN_TEXTURE)\ncolor=sheenOut.sheenMapData.rgb;\n#elif DEBUGMODE==30 && defined(ANISOTROPIC) && defined(ANISOTROPIC_TEXTURE)\ncolor=anisotropicOut.anisotropyMapData.rgb;\n#elif DEBUGMODE==31 && defined(SUBSURFACE) && defined(SS_THICKNESSANDMASK_TEXTURE)\ncolor=subSurfaceOut.thicknessMap.rgb;\n#elif DEBUGMODE==32 && defined(BUMP)\ncolor=textureSample(bumpSampler,bumpSamplerSampler,fragmentInputs.vBumpUV).rgb;\n#elif DEBUGMODE==40 && defined(SS_REFRACTION)\ncolor=subSurfaceOut.environmentRefraction.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==41 && defined(REFLECTION)\ncolor=reflectionOut.environmentRadiance.rgb;\n#ifndef GAMMAREFLECTION\n#define DEBUGMODE_GAMMA\n#endif\n#elif DEBUGMODE==42 && defined(CLEARCOAT) && defined(REFLECTION)\ncolor=clearcoatOut.environmentClearCoatRadiance.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==50\ncolor=diffuseBase.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==51 && defined(SPECULARTERM)\ncolor=specularBase.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==52 && defined(CLEARCOAT)\ncolor=clearCoatBase.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==53 && defined(SHEEN)\ncolor=sheenBase.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==54 && defined(REFLECTION)\ncolor=reflectionOut.environmentIrradiance.rgb;\n#ifndef GAMMAREFLECTION\n#define DEBUGMODE_GAMMA\n#endif\n#elif DEBUGMODE==60\ncolor=surfaceAlbedo.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==61\ncolor=clearcoatOut.specularEnvironmentR0;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==62 && defined(METALLICWORKFLOW)\ncolor= vec3f(reflectivityOut.metallic);\n#elif DEBUGMODE==71 && defined(METALLICWORKFLOW)\ncolor=reflectivityOut.metallicF0;\n#elif DEBUGMODE==63\ncolor= vec3f(roughness);\n#elif DEBUGMODE==64\ncolor= vec3f(alphaG);\n#elif DEBUGMODE==65\ncolor= vec3f(NdotV);\n#elif DEBUGMODE==66 && defined(CLEARCOAT) && defined(CLEARCOAT_TINT)\ncolor=clearcoatOut.clearCoatColor;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==67 && defined(CLEARCOAT)\ncolor= vec3f(clearcoatOut.clearCoatRoughness);\n#elif DEBUGMODE==68 && defined(CLEARCOAT)\ncolor= vec3f(clearcoatOut.clearCoatNdotV);\n#elif DEBUGMODE==69 && defined(SUBSURFACE) && defined(SS_TRANSLUCENCY)\ncolor=subSurfaceOut.transmittance;\n#elif DEBUGMODE==70 && defined(SUBSURFACE) && defined(SS_REFRACTION)\ncolor=subSurfaceOut.refractionTransmittance;\n#elif DEBUGMODE==72\ncolor= vec3f(microSurface);\n#elif DEBUGMODE==73\ncolor=uniforms.vAlbedoColor.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==74 && !defined(METALLICWORKFLOW)\ncolor=uniforms.vReflectivityColor.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==75\ncolor=uniforms.vEmissiveColor;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==80 && defined(RADIANCEOCCLUSION)\ncolor= vec3f(seo);\n#elif DEBUGMODE==81 && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D)\ncolor= vec3f(eho);\n#elif DEBUGMODE==82 && defined(MS_BRDF_ENERGY_CONSERVATION)\ncolor= vec3f(energyConservationFactor);\n#elif DEBUGMODE==83 && defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\ncolor=baseSpecularEnvironmentReflectance;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==84 && defined(CLEARCOAT) && defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\ncolor=clearcoatOut.clearCoatEnvironmentReflectance;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==85 && defined(SHEEN) && defined(REFLECTION)\ncolor=sheenOut.sheenEnvironmentReflectance;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==86 && defined(ALPHABLEND)\ncolor= vec3f(luminanceOverAlpha);\n#elif DEBUGMODE==87\ncolor= vec3f(alpha);\n#elif DEBUGMODE==88 && defined(ALBEDO)\ncolor= vec3f(albedoTexture.a);\n#elif DEBUGMODE==89\ncolor=aoOut.ambientOcclusionColor;\n#else\nvar stripeWidth: f32=30.;var stripePos: f32=abs(floor(input.position.x/stripeWidth));var whichColor: f32=((stripePos)%(2.));var color1: vec3f= vec3f(.6,.2,.2);var color2: vec3f= vec3f(.3,.1,.1);color=mix(color1,color2,whichColor);\n#endif\ncolor*=uniforms.vDebugMode.y;\n#ifdef DEBUGMODE_NORMALIZE\ncolor=normalize(color)*0.5+0.5;\n#endif\n#ifdef DEBUGMODE_GAMMA\ncolor=toGammaSpaceVec3(color);\n#endif\nfragmentOutputs.color=vec4f(color,1.0);\n#ifdef PREPASS\nfragmentOutputs.fragData0=toLinearSpaceVec3(color); \nfragmentOutputs.fragData1=vec4f(0.,0.,0.,0.); \n#endif\n#ifdef DEBUGMODE_FORCERETURN\nreturn fragmentOutputs;\n#endif\n}\n#endif\n")},98197:(e,t,n)=>{n.r(t),n.d(t,{pickingPixelShader:()=>a});var r=n(98519),i="pickingPixelShader",o="#if defined(INSTANCES)\nvarying float vMeshID;\n#else\nuniform float meshID;\n#endif\nvoid main(void) {float id;\n#if defined(INSTANCES)\nid=vMeshID;\n#else\nid=meshID;\n#endif\n#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\nint castedId=int(id);vec3 color=vec3(\nfloat((castedId>>16) & 0xFF),\nfloat((castedId>>8) & 0xFF),\nfloat(castedId & 0xFF)\n)/255.0;gl_FragColor=vec4(color,1.0);\n#else\nfloat castedId=floor(id+0.5);vec3 color=vec3(\nfloor(mod(castedId,16777216.0)/65536.0),\nfloor(mod(castedId,65536.0)/256.0),\nmod(castedId,256.0)\n)/255.0;gl_FragColor=vec4(color,1.0);\n#endif\n}\n";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},98318:(e,t,n)=>{n.r(t),n.d(t,{fogFragmentDeclarationWGSL:()=>a});var r=n(98519),i="fogFragmentDeclaration",o="#ifdef FOG\n#define FOGMODE_NONE 0.\n#define FOGMODE_EXP 1.\n#define FOGMODE_EXP2 2.\n#define FOGMODE_LINEAR 3.\nconst E=2.71828;uniform vFogInfos: vec4f;uniform vFogColor: vec3f;varying vFogDistance: vec3f;fn CalcFogFactor()->f32\n{var fogCoeff: f32=1.0;var fogStart: f32=uniforms.vFogInfos.y;var fogEnd: f32=uniforms.vFogInfos.z;var fogDensity: f32=uniforms.vFogInfos.w;var fogDistance: f32=length(fragmentInputs.vFogDistance);if (FOGMODE_LINEAR==uniforms.vFogInfos.x)\n{fogCoeff=(fogEnd-fogDistance)/(fogEnd-fogStart);}\nelse if (FOGMODE_EXP==uniforms.vFogInfos.x)\n{fogCoeff=1.0/pow(E,fogDistance*fogDensity);}\nelse if (FOGMODE_EXP2==uniforms.vFogInfos.x)\n{fogCoeff=1.0/pow(E,fogDistance*fogDistance*fogDensity*fogDensity);}\nreturn clamp(fogCoeff,0.0,1.0);}\n#endif\n";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]=o);var a={name:i,shader:o}},98519:(e,t,n)=>{n.d(t,{l:()=>r});var r=function(){function e(){}return e.GetShadersRepository=function(t){return void 0===t&&(t=0),0===t?e.ShadersRepository:e.ShadersRepositoryWGSL},e.GetShadersStore=function(t){return void 0===t&&(t=0),0===t?e.ShadersStore:e.ShadersStoreWGSL},e.GetIncludesShadersStore=function(t){return void 0===t&&(t=0),0===t?e.IncludesShadersStore:e.IncludesShadersStoreWGSL},e.ShadersRepository="src/Shaders/",e.ShadersStore={},e.IncludesShadersStore={},e.ShadersRepositoryWGSL="src/ShadersWGSL/",e.ShadersStoreWGSL={},e.IncludesShadersStoreWGSL={},e}()},98819:(e,t,n)=>{n.r(t),n.d(t,{morphTargetsVertexGlobalWGSL:()=>a});var r=n(98519),i="morphTargetsVertexGlobal",o="#ifdef MORPHTARGETS\n#ifdef MORPHTARGETS_TEXTURE\nvar vertexID : f32;\n#endif\n#endif\n";r.l.IncludesShadersStoreWGSL[i]||(r.l.IncludesShadersStoreWGSL[i]=o);var a={name:i,shader:o}},99032:(e,t,n)=>{n.r(t),n.d(t,{iblVoxelSlabDebugVertexShader:()=>a});var r=n(98519),i="iblVoxelSlabDebugVertexShader",o="attribute vec3 position;varying vec3 vNormalizedPosition;uniform mat4 world;uniform mat4 invWorldScale;uniform mat4 cameraViewMatrix;uniform mat4 projection;uniform mat4 viewMatrix;void main(void) {vec4 worldPosition=(world*vec4(position,1.));gl_Position=projection*cameraViewMatrix*worldPosition;vNormalizedPosition=(viewMatrix*invWorldScale*worldPosition).rgb;vNormalizedPosition.xyz=vNormalizedPosition.xyz*vec3(0.5)+vec3(0.5);}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},99157:(e,t,n)=>{n.d(t,{Sy:()=>a,pN:()=>l,sf:()=>s});var r=n(78322),i=n(59465),o={volume:1},a=function(e){function t(t){return e.call(this,"Volume",t)||this}return(0,r.C6)(t,e),t.prototype.setOptions=function(e){var t;this.volume=null!==(t=e.volume)&&void 0!==t?t:o.volume},t}(i.e);function s(e){return e.getSubNode("Volume")}function l(e,t){var n,r;return null!==(r=null===(n=s(e))||void 0===n?void 0:n[t])&&void 0!==r?r:o[t]}},99349:(e,t,n)=>{n.r(t),n.d(t,{glowMapMergeVertexShader:()=>a});var r=n(98519),i="glowMapMergeVertexShader",o="attribute vec2 position;varying vec2 vUV;const vec2 madd=vec2(0.5,0.5);\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvUV=position*madd+madd;gl_Position=vec4(position,0.0,1.0);\n#define CUSTOM_VERTEX_MAIN_END\n}";r.l.ShadersStore[i]||(r.l.ShadersStore[i]=o);var a={name:i,shader:o}},99448:(e,t,n)=>{n.d(t,{d:()=>u,u:()=>h});var r=n(78322),i=n(45109),o=n(8102),a=n(25598),s=n(81152),l=n(44957),c=n(54646);function u(e,t,n,u){return(0,r.sH)(this,void 0,void 0,(function(){var h,d,p,f,m,_,g,v,y,b,S;return(0,r.YH)(this,(function(r){switch(r.label){case 0:switch(h={size:0,viewer:t,array:new Uint8Array(t.buffer),offset:n,width:e.dataWindow.xMax-e.dataWindow.xMin+1,height:e.dataWindow.yMax-e.dataWindow.yMin+1,channels:e.channels.length,channelLineOffsets:{},scanOrder:function(){return 0},bytesPerLine:0,outLineWidth:0,lines:0,scanlineBlockSize:0,inputSize:null,type:0,uncompress:null,getter:function(){return 0},format:s.Y.TEXTUREFORMAT_RGBA,outputChannels:0,decodeChannels:{},blockCount:null,byteArray:null,linearSpace:!1,textureType:0},e.compression){case i.he.NO_COMPRESSION:return[3,1];case i.he.RLE_COMPRESSION:return[3,2];case i.he.ZIPS_COMPRESSION:return[3,3];case i.he.ZIP_COMPRESSION:return[3,5];case i.he.PIZ_COMPRESSION:return[3,7];case i.he.PXR24_COMPRESSION:return[3,8]}return[3,10];case 1:return h.lines=1,h.uncompress=o.S4,[3,11];case 2:return h.lines=1,h.uncompress=o.r,[3,11];case 3:return h.lines=1,h.uncompress=o.VE,[4,l.S0.LoadScriptAsync(c.u.FFLATEUrl)];case 4:case 6:case 9:return r.sent(),[3,11];case 5:return h.lines=16,h.uncompress=o.VE,[4,l.S0.LoadScriptAsync(c.u.FFLATEUrl)];case 7:return h.lines=32,h.uncompress=o.tg,[3,11];case 8:return h.lines=16,h.uncompress=o._k,[4,l.S0.LoadScriptAsync(c.u.FFLATEUrl)];case 10:throw new Error(i.he[e.compression]+" is unsupported");case 11:for(h.scanlineBlockSize=h.lines,d={},p=0,f=e.channels;pe.height?e.height-l:e.scanlineBlockSize;var c=e.size=e.height))for(var p=u*e.bytesPerLine,f=(e.height-1-d)*e.outLineWidth,m=0;m{n.d(t,{t:()=>i});var r=n(78322),i=function(e){function t(t,n){return e.call(this,t,n,3)||this}return(0,r.C6)(t,e),t}(n(37587).t)},99971:(e,t,n)=>{n.d(t,{Q:()=>a});var r=n(78322),i=n(97247),o=n(59784),a=function(e){function t(t,n,r){var i=e.call(this,t,n)||this;return i._mapSize=1024,i._useFloat32TextureType=!1,i._useRedTextureFormat=!0,i._bias=.01,i._normalBias=0,i._darkness=0,i._transparencyShadow=!1,i._enableSoftTransparentShadow=!1,i._useOpacityTextureForTransparentShadow=!1,i._filter=o.o.FILTER_PCF,i._filteringQuality=o.o.QUALITY_HIGH,i.outputTexture=i._frameGraph.textureManager.createDanglingHandle(),i}return(0,r.C6)(t,e),Object.defineProperty(t.prototype,"light",{get:function(){return this._light},set:function(e){e!==this._light&&(this._light=e,this._setupShadowGenerator())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"camera",{get:function(){return this._camera},set:function(e){this._camera=e,this._setupShadowGenerator()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mapSize",{get:function(){return this._mapSize},set:function(e){e!==this._mapSize&&(this._mapSize=e,this._setupShadowGenerator())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"useFloat32TextureType",{get:function(){return this._useFloat32TextureType},set:function(e){e!==this._useFloat32TextureType&&(this._useFloat32TextureType=e,this._setupShadowGenerator())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"useRedTextureFormat",{get:function(){return this._useRedTextureFormat},set:function(e){e!==this._useRedTextureFormat&&(this._useRedTextureFormat=e,this._setupShadowGenerator())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bias",{get:function(){return this._bias},set:function(e){e!==this._bias&&(this._bias=e,this._shadowGenerator&&(this._shadowGenerator.bias=e))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"normalBias",{get:function(){return this._normalBias},set:function(e){e!==this._normalBias&&(this._normalBias=e,this._shadowGenerator&&(this._shadowGenerator.normalBias=e))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"darkness",{get:function(){return this._darkness},set:function(e){e!==this._darkness&&(this._darkness=e,this._shadowGenerator&&(this._shadowGenerator.darkness=e))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"transparencyShadow",{get:function(){return this._transparencyShadow},set:function(e){e!==this._transparencyShadow&&(this._transparencyShadow=e,this._shadowGenerator&&(this._shadowGenerator.transparencyShadow=e))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableSoftTransparentShadow",{get:function(){return this._enableSoftTransparentShadow},set:function(e){e!==this._enableSoftTransparentShadow&&(this._enableSoftTransparentShadow=e,this._shadowGenerator&&(this._shadowGenerator.enableSoftTransparentShadow=e))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"useOpacityTextureForTransparentShadow",{get:function(){return this._useOpacityTextureForTransparentShadow},set:function(e){e!==this._useOpacityTextureForTransparentShadow&&(this._useOpacityTextureForTransparentShadow=e,this._shadowGenerator&&(this._shadowGenerator.useOpacityTextureForTransparentShadow=e))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"filter",{get:function(){return this._filter},set:function(e){e!==this._filter&&(this._filter=e,this._shadowGenerator&&(this._shadowGenerator.filter=e))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"filteringQuality",{get:function(){return this._filteringQuality},set:function(e){e!==this._filteringQuality&&(this._filteringQuality=e,this._shadowGenerator&&(this._shadowGenerator.filteringQuality=e))},enumerable:!1,configurable:!0}),t.prototype._createShadowGenerator=function(){this._shadowGenerator=new o.o(this._mapSize,this._light,this._useFloat32TextureType,void 0,this._useRedTextureFormat)},t.prototype._setupShadowGenerator=function(){var e;if(null===(e=this._shadowGenerator)||void 0===e||e.dispose(),this._shadowGenerator=void 0,void 0!==this._light){this._createShadowGenerator();var t=this._shadowGenerator;if(void 0===t)return;t.bias=this._bias,t.normalBias=this._normalBias,t.darkness=this._darkness,t.transparencyShadow=this._transparencyShadow,t.enableSoftTransparentShadow=this._enableSoftTransparentShadow,t.useOpacityTextureForTransparentShadow=this._useOpacityTextureForTransparentShadow,t.filter=this._filter,t.filteringQuality=this._filteringQuality;var n=t.getShadowMap();n._disableEngineStages=!0,n.cameraForLOD=this._camera,this.shadowGenerator=t}},t.prototype.isReady=function(){var e;return!!this._shadowGenerator&&!!(null===(e=this._shadowGenerator.getShadowMap())||void 0===e?void 0:e.isReadyForRendering())},t.prototype.record=function(){var e=this;if(void 0===this.light||void 0===this.objectList||void 0===this.camera)throw new Error("FrameGraphShadowGeneratorTask ".concat(this.name,": light, objectList and camera are required"));var t=this._shadowGenerator.getShadowMap();t.renderList=this.objectList.meshes,t.particleSystemList=this.objectList.particleSystems;var n=this._frameGraph.textureManager.importTexture("".concat(this.name," shadowmap"),this._shadowGenerator.getShadowMap().getInternalTexture());this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture,n),this._frameGraph.addPass(this.name).setExecuteFunc((function(t){if(e.light.isEnabled()&&e.light.shadowEnabled){var n=e._shadowGenerator.getShadowMap();n.renderList=e.objectList.meshes,n.particleSystemList=e.objectList.particleSystems,t.saveDepthStates(),t.setDepthStates(!0,!0),t.renderUnmanaged(n),t.restoreDepthStates()}})),this._frameGraph.addPass(this.name+"_disabled",!0).setExecuteFunc((function(e){}))},t.prototype.dispose=function(){var e;null===(e=this._shadowGenerator)||void 0===e||e.dispose(),this._shadowGenerator=void 0},t}(i.L)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};n.d(r,{default:()=>dz});var i={};n.r(i),n.d(i,{AxesViewer:()=>Ka,BoneAxesViewer:()=>Za,DebugLayer:()=>Qa,DebugLayerTab:()=>Xa,DirectionalLightFrustumViewer:()=>Yl,PhysicsViewer:()=>Ol,RayHelper:()=>Ml,SkeletonViewer:()=>Nl});var o={};n.r(o),n.d(o,{AbortError:()=>ue.lc,AbstractActionManager:()=>s.G,AbstractAssetContainer:()=>Qe,AbstractAssetTask:()=>jI,AbstractAudioAnalyzer:()=>sn.zx,AbstractAudioBus:()=>Jt.t,AbstractAudioNode:()=>At.f0,AbstractAudioOutNode:()=>$t.t,AbstractEngine:()=>Ie.$,AbstractMesh:()=>De,AbstractNamedAudioNode:()=>At.Ui,AbstractSound:()=>en.G,AbstractSpatialAudio:()=>ln.lA,AbstractSpatialAudioListener:()=>mt,AbstractStereoAudio:()=>cn.bO,AcquireNativeObjectAsync:()=>Lc,Action:()=>d,ActionEvent:()=>p.X,ActionManager:()=>N,AddAnimationExtensions:()=>U.SM,AddBlock:()=>MT,AddClipPlaneUniforms:()=>Mo.Ll,AddIndividualParser:()=>Ht,AddParser:()=>zt,AddRayExtensions:()=>qn,AddressMode:()=>tu,AdvancedTimer:()=>vy.Qz,Aggregations:()=>bI,AggregatorBlock:()=>TI,AlignAngleBlock:()=>fF,AlignBlock:()=>DA,AlphaState:()=>Vh.i,AmbientOcclusionBlock:()=>cE,AmmoJSPlugin:()=>wb,AnaglyphArcRotateCamera:()=>Di,AnaglyphFreeCamera:()=>Ni,AnaglyphGamepadCamera:()=>Fi,AnaglyphPostProcess:()=>Oi,AnaglyphUniversalCamera:()=>Li,Analyser:()=>tt,AndOrNotEvaluator:()=>XI.Z,Angle:()=>Du.uM,Animatable:()=>U.rT,AnimatedInputBlockTypes:()=>Iv,Animation:()=>w.X5,AnimationAssetTask:()=>QI,AnimationEvent:()=>W,AnimationGroup:()=>H.k,AnimationGroupMask:()=>q,AnimationGroupMaskMode:()=>Y,AnimationKeyInterpolation:()=>V,AnimationPropertiesOverride:()=>G,AnimationRange:()=>X.K,AnisotropyBlock:()=>Zx,AppendSceneAsync:()=>qg,ApplyLut:()=>GS.Kq,ApplyPostProcess:()=>Sn.Qs,Arc2:()=>Du.Xy,ArcFollowCamera:()=>pi,ArcRotateCamera:()=>si,ArcRotateCameraGamepadInput:()=>Rr,ArcRotateCameraInputsManager:()=>Dr,ArcRotateCameraKeyboardMoveInput:()=>Ir,ArcRotateCameraMouseWheelInput:()=>Or,ArcRotateCameraPointersInput:()=>Mr,ArcRotateCameraVRDeviceOrientationInput:()=>Nr,ArcTan2Block:()=>Dx,AreIndices32Bits:()=>be.Lm,AreaLight:()=>fb,AssetContainer:()=>et,AssetTaskState:()=>OI,AssetsManager:()=>oO,AssetsProgressEvent:()=>qI,AsyncLock:()=>GD,AsyncLoop:()=>Z.LV,AttachToBoxBehavior:()=>An,Attractor:()=>_D,AudioBus:()=>tn.l,AudioEngine:()=>Ft,AudioEngineV2:()=>it,AudioNodeType:()=>At.D9,AudioParameterRampShape:()=>qt,AudioSceneComponent:()=>jt,AutoLayoutMode:()=>du,AutoReleaseWorkerPool:()=>mC.h,AutoRotationBehavior:()=>xn,AxesViewer:()=>Ka,Axis:()=>Du._0,AxisDragGizmo:()=>qa,AxisScaleGizmo:()=>R_,BRDFTextureTools:()=>ng,BabylonFileLoaderConfiguration:()=>Hb,BackEase:()=>k.kL,BackgroundMaterial:()=>j_,BakedVertexAnimationManager:()=>mn,BallAndSocketConstraint:()=>lL,BaseCameraMouseWheelInput:()=>br,BaseCameraPointersInput:()=>Sr,BaseError:()=>ue.Cf,BaseParticleSystem:()=>Kv,BaseSixDofDragBehavior:()=>or,BaseTexture:()=>z_.t,BasicColorUpdateBlock:()=>ZN,BasicPositionUpdateBlock:()=>qN,BasicSpriteUpdateBlock:()=>sF,BasisFileInfo:()=>aO.$e,BasisTools:()=>aO.ED,BasisToolsOptions:()=>aO.Sl,BasisTranscodeConfiguration:()=>aO.SV,BezierCurve:()=>Du.vr,BezierCurveEase:()=>k.Bv,BiPlanarBlock:()=>dP,BinaryFileAssetTask:()=>$I,BindBonesParameters:()=>Le.f$,BindClipPlane:()=>Mo.ij,BindFogParameters:()=>Le.Yy,BindIBLParameters:()=>Le.X8,BindIBLSamplers:()=>Le.Wp,BindLight:()=>Le.Kd,BindLightProperties:()=>Le.L0,BindLights:()=>Le.RL,BindLogDepth:()=>Le.DL,BindMorphTargetParameters:()=>Le.nR,BindSceneUniformBuffer:()=>Le._8,BindTextureMatrix:()=>Le.mA,BitArray:()=>kD.P,BlackAndWhitePostProcess:()=>YL,BlendFactor:()=>gu,BlendOperation:()=>vu,BloomEffect:()=>KL,BloomMergePostProcess:()=>qL,BlurPostProcess:()=>W_.j,Bone:()=>yn.$,BoneAxesViewer:()=>Za,BoneIKController:()=>fr,BoneLookController:()=>mr,BonesBlock:()=>FT,BooleanGeometryBlock:()=>$A,BooleanGeometryOperations:()=>QA,BounceEase:()=>k.ND,BouncingBehavior:()=>Pn,BoundingBlock:()=>JA,BoundingBox:()=>Ma.I,BoundingBoxGizmo:()=>A_,BoundingBoxRenderer:()=>oV,BoundingInfo:()=>de.j,BoundingInfoHelper:()=>Da,BoundingSphere:()=>La.i,BoxBlock:()=>WR,BoxBuilder:()=>ts,BoxParticleEmitter:()=>oM,BoxShapeBlock:()=>GN,Buffer:()=>se.h,BufferBindingType:()=>au,BufferMapState:()=>jc,BufferUsage:()=>qc,CSG:()=>BC,CSG2:()=>bR,Camera:()=>oe.i,CameraGizmo:()=>k_,CameraInputTypes:()=>Tr,CameraInputsManager:()=>Er,CannonJSPlugin:()=>Fb,CanvasAlphaMode:()=>Au,CanvasToneMappingMode:()=>Iu,CapsuleBlock:()=>$R,CapsuleBuilder:()=>ps,CascadedShadowGenerator:()=>rb.c,CharacterSupportedState:()=>mL,ChromaticAberrationPostProcess:()=>ZL,CircleEase:()=>k.rm,CircleOfConfusionPostProcess:()=>QL,Clamp:()=>lr.Clamp,ClampBlock:()=>hx,CleanGeometryBlock:()=>vA,ClearCoatBlock:()=>Jx,ClipPlanesBlock:()=>FE,ClipboardEventTypes:()=>rd,ClipboardInfo:()=>id,CloudBlock:()=>lP,CloudPoint:()=>vN,ClusteredLightContainer:()=>gb,ClusteredLightingSceneComponent:()=>vb,Collider:()=>ya,Color3:()=>Du.v9,Color3Gradient:()=>ZO,Color4:()=>Du.ov,ColorConverterBlock:()=>yP,ColorCorrectionPostProcess:()=>JL,ColorCurves:()=>oS.Q,ColorGradient:()=>KO,ColorGradingTexture:()=>IS,ColorMergerBlock:()=>_x,ColorSplitterBlock:()=>Zv,ColorWrite:()=>_u,CombineAction:()=>A,CompareFunction:()=>iu,CompatibilityOptions:()=>ye.p9,CompilationMessageType:()=>uu,CompleteGreasedLineColorTable:()=>dR,CompleteGreasedLineWidthTable:()=>hR,CompressionCodes:()=>WS.he,ComputeAlpha:()=>ii,ComputeBeta:()=>oi,ComputeBindingType:()=>ac,ComputeEffect:()=>Ia,ComputeNormalsBlock:()=>bA,ComputePassTimestampLocation:()=>Eu,ComputeShader:()=>Oa.H,ComputeShaderBoundingHelper:()=>Fa.ComputeShaderBoundingHelper,ComputeShaderParticleSystem:()=>iN,Condition:()=>m,ConditionBlock:()=>pA,ConditionBlockTests:()=>uA,ConditionalBlock:()=>sP,ConditionalBlockConditions:()=>oP,ConeDirectedParticleEmitter:()=>iD,ConeParticleEmitter:()=>rD,Constants:()=>b.Y,ContainerAssetTask:()=>KI,ConversionMode:()=>Vp,ConvertToNodeParticleSystemSetAsync:()=>eF,ConvolutionPostProcess:()=>$L,Coordinate:()=>Du.xp,CopyFloatData:()=>be.gs,CopyMatrixToArray:()=>uC.rl,CopyMatrixToRef:()=>uC.v9,CopyTextureToTexture:()=>Wp,CopyTools:()=>CD.D8,CreateAlignedTypedArray:()=>be.oi,CreateAudioBusAsync:()=>at,CreateAudioEngineAsync:()=>Mt,CreateBox:()=>es,CreateBoxVertexData:()=>Ja,CreateCapsule:()=>ds,CreateCapsuleVertexData:()=>hs,CreateCylinder:()=>Ga,CreateCylinderVertexData:()=>Ua,CreateDashedLines:()=>Bs,CreateDashedLinesVertexData:()=>Fs,CreateDecal:()=>ml,CreateDecoderAsync:()=>HS.d,CreateDisc:()=>vs,CreateDiscVertexData:()=>gs,CreateEnvTextureAsync:()=>uc.Hx,CreateGeodesic:()=>Sl,CreateGoldberg:()=>xl,CreateGoldbergVertexData:()=>El,CreateGreasedLine:()=>cR,CreateGreasedLineMaterial:()=>lR,CreateGround:()=>na,CreateGroundFromHeightMap:()=>ia,CreateGroundFromHeightMapVertexData:()=>ta,CreateGroundVertexData:()=>$o,CreateHemisphere:()=>w_,CreateHotSpotQueryForPickingInfo:()=>hC,CreateIcoSphere:()=>al,CreateIcoSphereVertexData:()=>ol,CreateImageBitmapFromSource:()=>kh.kF,CreateIrradianceImageDataArrayBufferViews:()=>uc.Pu,CreateLathe:()=>Js,CreateLineSystem:()=>Ls,CreateLineSystemVertexData:()=>Ns,CreateLines:()=>ws,CreateMainAudioBusAsync:()=>st,CreateMicrophoneSoundSourceAsync:()=>lt,CreateParticleBlock:()=>zN,CreatePickingRay:()=>Fn,CreatePickingRayInCameraSpace:()=>wn,CreatePickingRayInCameraSpaceToRef:()=>Bn,CreatePickingRayToRef:()=>Ln,CreatePlane:()=>Qn,CreatePlaneVertexData:()=>Zn,CreatePolygon:()=>Ys,CreatePolygonVertexData:()=>Hs,CreatePolyhedron:()=>rl,CreatePolyhedronVertexData:()=>nl,CreateRadianceImageDataArrayBufferViews:()=>uc.ux,CreateResizedCopy:()=>Sn.EE,CreateRibbon:()=>ms,CreateRibbonVertexData:()=>fs,CreateScreenshot:()=>GO,CreateScreenshotAsync:()=>kO,CreateScreenshotForFrameGraphAsync:()=>YO,CreateScreenshotUsingRenderTarget:()=>WO,CreateScreenshotUsingRenderTargetAsync:()=>HO,CreateScreenshotWithResizeAsync:()=>zO,CreateSegmentedBoxVertexData:()=>$a,CreateSoundAsync:()=>ct,CreateSoundBufferAsync:()=>ut,CreateSoundSourceAsync:()=>ht,CreateSphere:()=>rs,CreateSphereVertexData:()=>ns,CreateStreamingSoundAsync:()=>dt,CreateText:()=>Al,CreateTextShapePaths:()=>Rl,CreateTiledBox:()=>Cs,CreateTiledBoxVertexData:()=>Ps,CreateTiledGround:()=>ra,CreateTiledGroundVertexData:()=>ea,CreateTiledPlane:()=>Ss,CreateTiledPlaneVertexData:()=>bs,CreateTorus:()=>sa,CreateTorusKnot:()=>Is,CreateTorusKnotVertexData:()=>As,CreateTorusVertexData:()=>aa,CreateTube:()=>el,CreateUtilityLayerRenderer:()=>Wl,CrossBlock:()=>dx,CubeMapToSphericalPolynomialTools:()=>Sb.d,CubeTexture:()=>Y_,CubeTextureAssetTask:()=>nO,CubicEase:()=>k.vm,CullMode:()=>mu,CurrentScreenBlock:()=>kv,Curve3:()=>Du.jj,CurveBlock:()=>vP,CurveBlockTypes:()=>_P,CustomBlock:()=>px,CustomOptimization:()=>bO,CustomParticleEmitter:()=>ZM,CustomProceduralTexture:()=>KS,CustomShapeBlock:()=>mF,CylinderBlock:()=>JR,CylinderBuilder:()=>ka,CylinderDirectedParticleEmitter:()=>nD,CylinderParticleEmitter:()=>tD,CylinderShapeBlock:()=>XN,DDSTools:()=>sO.DDSTools,DataBuffer:()=>_r.n,DataReader:()=>eM,DataStorage:()=>rM,Database:()=>JD,DebugBlock:()=>zA,DebugLayer:()=>Qa,DebugLayerTab:()=>Xa,DecalBuilder:()=>_l,DecalMapConfiguration:()=>MP,DecalMapDefines:()=>OP,Decode:()=>vn.Tq,DecodeBase64ToBinary:()=>vn.yS,DecodeBase64ToString:()=>vn.AV,DecodeBase64UrlToBinary:()=>Cg.rz,DecodeBase64UrlToString:()=>Cg.dy,DecodeFloat32:()=>WS.Sn,DecodeRunLength:()=>kS._,DeepCopier:()=>D.r,DefaultCollisionCoordinator:()=>ba,DefaultKTX2DecoderOptions:()=>bD.$,DefaultLoadingScreen:()=>bb,DefaultRenderingPipeline:()=>xw,Deferred:()=>lO,DeltaAngle:()=>lr.DeltaAngle,Denormalize:()=>lr.Denormalize,DepthCullingState:()=>ph.N,DepthOfFieldBlurPostProcess:()=>ew,DepthOfFieldEffect:()=>rw,DepthOfFieldEffectBlurLevel:()=>tw,DepthOfFieldMergePostProcess:()=>nw,DepthPeelingRenderer:()=>lV,DepthPeelingSceneComponent:()=>cV,DepthReducer:()=>nM.k,DepthRenderer:()=>Gw.d,DepthRendererSceneComponent:()=>aV,DepthSortedParticle:()=>mN,DepthSourceBlock:()=>NE,DerivativeBlock:()=>tE,DesaturateBlock:()=>qx,DetailMapConfiguration:()=>Oo,DeviceInputEventType:()=>yr.b,DeviceLostReason:()=>Ou,DeviceOrientationCamera:()=>li,DeviceSource:()=>jl.c,DeviceSourceManager:()=>ql.Z,DeviceType:()=>Xl.bq,DirectionalLight:()=>L_.Z,DirectionalLightFrustumViewer:()=>Yl,DiscBlock:()=>eA,DiscBuilder:()=>ys,DiscardBlock:()=>$T,DisplayPassPostProcess:()=>iw,DistanceBlock:()=>Rx,DistanceConstraint:()=>cL,DistanceJoint:()=>as,DivideBlock:()=>yx,DoNothingAction:()=>R,DomManagement:()=>_i.Az,DotBlock:()=>fx,DracoCompression:()=>xC,DracoDecoder:()=>EC,DracoEncoder:()=>MC,DragOperation:()=>E_,DrawWrapper:()=>fe.E,DualSenseInput:()=>Xl.pI,DualShockButton:()=>gi,DualShockDpad:()=>vi,DualShockInput:()=>Xl.h8,DualShockPad:()=>bi,DumpTools:()=>VO.DumpTools,DynamicFloat32Array:()=>ID,DynamicTexture:()=>Go,EXRCubeTexture:()=>NS,EXROutputType:()=>zS.V,EasingFunction:()=>k.KA,EasingFunctionType:()=>$d.EasingFunctionType,EdgesRenderer:()=>hV,Effect:()=>Dl.M,EffectFallbacks:()=>go.J,EffectLayer:()=>Iy,EffectLayerSceneComponent:()=>Oy,EffectRenderer:()=>Ri.J,EffectWrapper:()=>Ri.$,ElasticEase:()=>k._B,ElbowBlock:()=>uP,EncodeArrayBufferToBase64:()=>vn.EL,EndsWith:()=>vn.jq,Engine:()=>Ai.N,EngineFactory:()=>nd,EngineFormat:()=>oT.GQ,EngineInstrumentation:()=>Ry,EngineStore:()=>M.q,EngineView:()=>tc,EnumerateFloatValues:()=>be.XG,EnvCubeTexture:()=>Pb,EnvironmentHelper:()=>q_,EnvironmentTextureTools:()=>uc.qY,Epsilon:()=>Du.bH,EquiRectangularCubeTexture:()=>MS,EquiRectangularCubeTextureAssetTask:()=>iO,ErrorCodes:()=>ue.tG,ErrorFilter:()=>Mu,EventConstants:()=>yr.s,EventState:()=>l.qO,ExecuteCodeAction:()=>I,ExitFullscreen:()=>kh.g7,ExitPointerlock:()=>kh.rT,ExponentialEase:()=>k.E8,ExrLoaderGlobalConfiguration:()=>zS.u,ExternalTexture:()=>mh,ExtractAsInt:()=>lr.ExtractAsInt,ExtractHighlightsPostProcess:()=>jL,ExtrudePolygon:()=>Xs,ExtrudeShape:()=>qs,ExtrudeShapeCustom:()=>Ks,FactorGradient:()=>QO,FadeInOutBehavior:()=>In,FeatureName:()=>Xc,FileTools:()=>Cg.wS,FileToolsOptions:()=>Cg.eC,FilesInput:()=>hO,FilesInputStore:()=>uO.T,FilterMode:()=>nu,FilterPostProcess:()=>ow,FindMainCamera:()=>kl,FindMainObjectRenderer:()=>zl,FixFlippedFaces:()=>pe.Y4,FlowGraph:()=>od.$,FlowGraphAbsBlock:()=>up.FlowGraphAbsBlock,FlowGraphAcosBlock:()=>up.FlowGraphAcosBlock,FlowGraphAcoshBlock:()=>up.FlowGraphAcoshBlock,FlowGraphAction:()=>Nd.r,FlowGraphAddBlock:()=>up.FlowGraphAddBlock,FlowGraphAngleBetweenBlock:()=>pp.FlowGraphAngleBetweenBlock,FlowGraphArrayIndexBlock:()=>gp.FlowGraphArrayIndexBlock,FlowGraphAsinBlock:()=>up.FlowGraphAsinBlock,FlowGraphAsinhBlock:()=>up.FlowGraphAsinhBlock,FlowGraphAssetType:()=>md.$,FlowGraphAtan2Block:()=>up.FlowGraphAtan2Block,FlowGraphAtanBlock:()=>up.FlowGraphAtanBlock,FlowGraphAtanhBlock:()=>up.FlowGraphAtanhBlock,FlowGraphAxisAngleFromQuaternionBlock:()=>pp.FlowGraphAxisAngleFromQuaternionBlock,FlowGraphBezierCurveEasingBlock:()=>ep.FlowGraphBezierCurveEasingBlock,FlowGraphBitwiseAndBlock:()=>up.FlowGraphBitwiseAndBlock,FlowGraphBitwiseLeftShiftBlock:()=>up.FlowGraphBitwiseLeftShiftBlock,FlowGraphBitwiseNotBlock:()=>up.FlowGraphBitwiseNotBlock,FlowGraphBitwiseOrBlock:()=>up.FlowGraphBitwiseOrBlock,FlowGraphBitwiseRightShiftBlock:()=>up.FlowGraphBitwiseRightShiftBlock,FlowGraphBitwiseXorBlock:()=>up.FlowGraphBitwiseXorBlock,FlowGraphBlock:()=>ad.e,FlowGraphBlockNames:()=>Od,FlowGraphBooleanToFloat:()=>mp.FlowGraphBooleanToFloat,FlowGraphBooleanToInt:()=>mp.FlowGraphBooleanToInt,FlowGraphBranchBlock:()=>Ld.FlowGraphBranchBlock,FlowGraphCallCounterBlock:()=>zd.FlowGraphCallCounterBlock,FlowGraphCancelDelayBlock:()=>qd.FlowGraphCancelDelayBlock,FlowGraphCeilBlock:()=>up.FlowGraphCeilBlock,FlowGraphClampBlock:()=>up.FlowGraphClampBlock,FlowGraphCodeExecutionBlock:()=>vp.FlowGraphCodeExecutionBlock,FlowGraphCombineMatrix2DBlock:()=>hp.FlowGraphCombineMatrix2DBlock,FlowGraphCombineMatrix3DBlock:()=>hp.FlowGraphCombineMatrix3DBlock,FlowGraphCombineMatrixBlock:()=>hp.FlowGraphCombineMatrixBlock,FlowGraphCombineVector2Block:()=>hp.FlowGraphCombineVector2Block,FlowGraphCombineVector3Block:()=>hp.FlowGraphCombineVector3Block,FlowGraphCombineVector4Block:()=>hp.FlowGraphCombineVector4Block,FlowGraphConditionalDataBlock:()=>tp.FlowGraphConditionalDataBlock,FlowGraphConjugateBlock:()=>pp.FlowGraphConjugateBlock,FlowGraphConnection:()=>pd.X,FlowGraphConnectionType:()=>pd.H,FlowGraphConsoleLogBlock:()=>Fd.FlowGraphConsoleLogBlock,FlowGraphConstantBlock:()=>sp.FlowGraphConstantBlock,FlowGraphContext:()=>hd.Y,FlowGraphContextBlock:()=>_p.FlowGraphContextBlock,FlowGraphCoordinator:()=>dd.x,FlowGraphCosBlock:()=>up.FlowGraphCosBlock,FlowGraphCoshBlock:()=>up.FlowGraphCoshBlock,FlowGraphCrossBlock:()=>pp.FlowGraphCrossBlock,FlowGraphCubeRootBlock:()=>up.FlowGraphCubeRootBlock,FlowGraphDataConnection:()=>fd.l,FlowGraphDataSwitchBlock:()=>cp.FlowGraphDataSwitchBlock,FlowGraphDebounceBlock:()=>Hd.FlowGraphDebounceBlock,FlowGraphDegToRadBlock:()=>up.FlowGraphDegToRadBlock,FlowGraphDeterminantBlock:()=>dp.FlowGraphDeterminantBlock,FlowGraphDivideBlock:()=>up.FlowGraphDivideBlock,FlowGraphDoNBlock:()=>wd.FlowGraphDoNBlock,FlowGraphDotBlock:()=>pp.FlowGraphDotBlock,FlowGraphEBlock:()=>up.FlowGraphEBlock,FlowGraphEasingBlock:()=>$d.FlowGraphEasingBlock,FlowGraphEqualityBlock:()=>up.FlowGraphEqualityBlock,FlowGraphEventBlock:()=>cd.i,FlowGraphExecutionBlock:()=>ld.u,FlowGraphExpBlock:()=>up.FlowGraphExpBlock,FlowGraphExtractMatrix2DBlock:()=>hp.FlowGraphExtractMatrix2DBlock,FlowGraphExtractMatrix3DBlock:()=>hp.FlowGraphExtractMatrix3DBlock,FlowGraphExtractMatrixBlock:()=>hp.FlowGraphExtractMatrixBlock,FlowGraphExtractVector2Block:()=>hp.FlowGraphExtractVector2Block,FlowGraphExtractVector3Block:()=>hp.FlowGraphExtractVector3Block,FlowGraphExtractVector4Block:()=>hp.FlowGraphExtractVector4Block,FlowGraphFlipFlopBlock:()=>Yd.FlowGraphFlipFlopBlock,FlowGraphFloatToBoolean:()=>mp.FlowGraphFloatToBoolean,FlowGraphFloatToInt:()=>mp.FlowGraphFloatToInt,FlowGraphFloorBlock:()=>up.FlowGraphFloorBlock,FlowGraphForLoopBlock:()=>Bd.FlowGraphForLoopBlock,FlowGraphFractionBlock:()=>up.FlowGraphFractionBlock,FlowGraphFunctionReferenceBlock:()=>bp.FlowGraphFunctionReferenceBlock,FlowGraphGetAssetBlock:()=>lp.FlowGraphGetAssetBlock,FlowGraphGetPropertyBlock:()=>op.FlowGraphGetPropertyBlock,FlowGraphGetVariableBlock:()=>np.FlowGraphGetVariableBlock,FlowGraphGreaterThanBlock:()=>up.FlowGraphGreaterThanBlock,FlowGraphGreaterThanOrEqualBlock:()=>up.FlowGraphGreaterThanOrEqualBlock,FlowGraphIndexOfBlock:()=>yp.FlowGraphIndexOfBlock,FlowGraphInfBlock:()=>up.FlowGraphInfBlock,FlowGraphIntToBoolean:()=>mp.FlowGraphIntToBoolean,FlowGraphIntToFloat:()=>mp.FlowGraphIntToFloat,FlowGraphInteger:()=>Mp.P,FlowGraphInterpolationBlock:()=>Jd.FlowGraphInterpolationBlock,FlowGraphInvertMatrixBlock:()=>dp.FlowGraphInvertMatrixBlock,FlowGraphIsInfinityBlock:()=>up.FlowGraphIsInfinityBlock,FlowGraphIsNanBlock:()=>up.FlowGraphIsNanBlock,FlowGraphJsonPointerParserBlock:()=>fp.FlowGraphJsonPointerParserBlock,FlowGraphLeadingZerosBlock:()=>up.FlowGraphLeadingZerosBlock,FlowGraphLengthBlock:()=>pp.FlowGraphLengthBlock,FlowGraphLessThanBlock:()=>up.FlowGraphLessThanBlock,FlowGraphLessThanOrEqualBlock:()=>up.FlowGraphLessThanOrEqualBlock,FlowGraphLog10Block:()=>up.FlowGraphLog10Block,FlowGraphLog2Block:()=>up.FlowGraphLog2Block,FlowGraphLogBlock:()=>up.FlowGraphLogBlock,FlowGraphLogger:()=>Nd.H,FlowGraphMathInterpolationBlock:()=>up.FlowGraphMathInterpolationBlock,FlowGraphMatrix2D:()=>Dp.K,FlowGraphMatrix3D:()=>Dp.z,FlowGraphMatrixComposeBlock:()=>dp.FlowGraphMatrixComposeBlock,FlowGraphMatrixDecomposeBlock:()=>dp.FlowGraphMatrixDecomposeBlock,FlowGraphMatrixMultiplicationBlock:()=>dp.FlowGraphMatrixMultiplicationBlock,FlowGraphMaxBlock:()=>up.FlowGraphMaxBlock,FlowGraphMeshPickEventBlock:()=>Sp.FlowGraphMeshPickEventBlock,FlowGraphMinBlock:()=>up.FlowGraphMinBlock,FlowGraphModuloBlock:()=>up.FlowGraphModuloBlock,FlowGraphMultiGateBlock:()=>Ud.FlowGraphMultiGateBlock,FlowGraphMultiplyBlock:()=>up.FlowGraphMultiplyBlock,FlowGraphNaNBlock:()=>up.FlowGraphNaNBlock,FlowGraphNegationBlock:()=>up.FlowGraphNegationBlock,FlowGraphNormalizeBlock:()=>pp.FlowGraphNormalizeBlock,FlowGraphOneBitsCounterBlock:()=>up.FlowGraphOneBitsCounterBlock,FlowGraphPathConverter:()=>Md,FlowGraphPathConverterComponent:()=>Dd.H,FlowGraphPauseAnimationBlock:()=>Qd.FlowGraphPauseAnimationBlock,FlowGraphPiBlock:()=>up.FlowGraphPiBlock,FlowGraphPlayAnimationBlock:()=>Kd.FlowGraphPlayAnimationBlock,FlowGraphPointerOutEventBlock:()=>Cp.FlowGraphPointerOutEventBlock,FlowGraphPointerOverEventBlock:()=>Rp.FlowGraphPointerOverEventBlock,FlowGraphPowerBlock:()=>up.FlowGraphPowerBlock,FlowGraphQuaternionFromAxisAngleBlock:()=>pp.FlowGraphQuaternionFromAxisAngleBlock,FlowGraphQuaternionFromDirectionsBlock:()=>pp.FlowGraphQuaternionFromDirectionsBlock,FlowGraphRadToDegBlock:()=>up.FlowGraphRadToDegBlock,FlowGraphRandomBlock:()=>up.FlowGraphRandomBlock,FlowGraphReceiveCustomEventBlock:()=>Ep.FlowGraphReceiveCustomEventBlock,FlowGraphRotate2DBlock:()=>pp.FlowGraphRotate2DBlock,FlowGraphRotate3DBlock:()=>pp.FlowGraphRotate3DBlock,FlowGraphRoundBlock:()=>up.FlowGraphRoundBlock,FlowGraphSaturateBlock:()=>up.FlowGraphSaturateBlock,FlowGraphSceneReadyEventBlock:()=>Tp.FlowGraphSceneReadyEventBlock,FlowGraphSceneTickEventBlock:()=>Pp.FlowGraphSceneTickEventBlock,FlowGraphSendCustomEventBlock:()=>xp.FlowGraphSendCustomEventBlock,FlowGraphSequenceBlock:()=>Xd.FlowGraphSequenceBlock,FlowGraphSetDelayBlock:()=>jd.FlowGraphSetDelayBlock,FlowGraphSetPropertyBlock:()=>ap.FlowGraphSetPropertyBlock,FlowGraphSetVariableBlock:()=>rp.FlowGraphSetVariableBlock,FlowGraphSignBlock:()=>up.FlowGraphSignBlock,FlowGraphSignalConnection:()=>sd.R,FlowGraphSinBlock:()=>up.FlowGraphSinBlock,FlowGraphSinhBlock:()=>up.FlowGraphSinhBlock,FlowGraphSquareRootBlock:()=>up.FlowGraphSquareRootBlock,FlowGraphState:()=>od.I,FlowGraphStopAnimationBlock:()=>Zd.FlowGraphStopAnimationBlock,FlowGraphSubtractBlock:()=>up.FlowGraphSubtractBlock,FlowGraphSwitchBlock:()=>Gd.FlowGraphSwitchBlock,FlowGraphTanBlock:()=>up.FlowGraphTanBlock,FlowGraphTanhBlock:()=>up.FlowGraphTanhBlock,FlowGraphThrottleBlock:()=>Vd.FlowGraphThrottleBlock,FlowGraphTrailingZerosBlock:()=>up.FlowGraphTrailingZerosBlock,FlowGraphTransformBlock:()=>pp.FlowGraphTransformBlock,FlowGraphTransformCoordinatesBlock:()=>pp.FlowGraphTransformCoordinatesBlock,FlowGraphTransformCoordinatesSystemBlock:()=>ip.FlowGraphTransformCoordinatesSystemBlock,FlowGraphTransposeBlock:()=>dp.FlowGraphTransposeBlock,FlowGraphTruncBlock:()=>up.FlowGraphTruncBlock,FlowGraphTypes:()=>ud.Qd,FlowGraphWaitAllBlock:()=>kd.FlowGraphWaitAllBlock,FlowGraphWhileLoopBlock:()=>Wd.FlowGraphWhileLoopBlock,FlowMap:()=>RN,FluidRenderer:()=>XV,FluidRendererSceneComponent:()=>YV,FluidRenderingDebug:()=>NV,FluidRenderingObject:()=>BV,FluidRenderingObjectCustomParticles:()=>kV,FluidRenderingObjectParticleSystem:()=>VV,FluidRenderingTargetRenderer:()=>GV,FlyCamera:()=>ui,FlyCameraInputsManager:()=>ci,FlyCameraKeyboardInput:()=>Fr,FlyCameraMouseInput:()=>Lr,FogBlock:()=>RE,FollowBehavior:()=>cr,FollowCamera:()=>di,FollowCameraInputsManager:()=>hi,FollowCameraKeyboardMoveInput:()=>wr,FollowCameraMouseWheelInput:()=>Br,FollowCameraPointersInput:()=>Vr,FragCoordBlock:()=>nE,FragDepthBlock:()=>aE,FragmentOutputBlock:()=>Ov,FragmentOutputBlockColorSpace:()=>xv,FrameGraph:()=>Qp,FrameGraphAnaglyphTask:()=>Af,FrameGraphBlackAndWhiteTask:()=>Df,FrameGraphBloomTask:()=>Uf,FrameGraphBlurTask:()=>yf,FrameGraphCascadedShadowGeneratorTask:()=>h_.w,FrameGraphChromaticAberrationTask:()=>Wf,FrameGraphCircleOfConfusionTask:()=>Xf,FrameGraphClearTextureTask:()=>ef,FrameGraphColorCorrectionTask:()=>Kf,FrameGraphContext:()=>Hp,FrameGraphConvolutionTask:()=>Jf,FrameGraphCopyToBackbufferColorTask:()=>wp,FrameGraphCopyToTextureTask:()=>y_,FrameGraphCullObjectsTask:()=>sf,FrameGraphCullPass:()=>kp.x,FrameGraphCustomPostProcessTask:()=>P_,FrameGraphDepthOfFieldTask:()=>am,FrameGraphExecuteTask:()=>hf,FrameGraphExtractHighlightsTask:()=>Vf,FrameGraphFXAATask:()=>pm,FrameGraphFilterTask:()=>um,FrameGraphGenerateMipMapsTask:()=>S_,FrameGraphGeometryRendererTask:()=>Ul,FrameGraphGlowLayerTask:()=>Tf,FrameGraphGrainTask:()=>_m,FrameGraphHighlightLayerTask:()=>Cf,FrameGraphImageProcessingTask:()=>ym,FrameGraphMotionBlurTask:()=>Tm,FrameGraphObjectList:()=>C_,FrameGraphObjectRendererTask:()=>Fl.H,FrameGraphPass:()=>Up.X,FrameGraphPassCubeTask:()=>Pm,FrameGraphPassTask:()=>xm,FrameGraphPostProcessTask:()=>vf.C,FrameGraphRenderContext:()=>Yp,FrameGraphRenderPass:()=>Gp.p,FrameGraphRenderTarget:()=>jp,FrameGraphSSAO2RenderingPipelineTask:()=>Gm,FrameGraphSSRRenderingPipelineTask:()=>Zm,FrameGraphScreenSpaceCurvatureTask:()=>Dm,FrameGraphShadowGeneratorTask:()=>f_.Q,FrameGraphSharpenTask:()=>Im,FrameGraphTAATask:()=>i_,FrameGraphTask:()=>wl.L,FrameGraphTextureManager:()=>Kp,FrameGraphTonemapTask:()=>s_,FrameGraphUtilityLayerRendererTask:()=>Gl,FrameGraphUtils:()=>Hl,FramingBehavior:()=>Cn,FreeCamera:()=>ni,FreeCameraDeviceOrientationInput:()=>Yr,FreeCameraGamepadInput:()=>Xr,FreeCameraInputsManager:()=>Hr,FreeCameraKeyboardMoveInput:()=>Ur,FreeCameraMouseInput:()=>kr,FreeCameraMouseWheelInput:()=>zr,FreeCameraTouchInput:()=>Wr,FreeCameraVirtualJoystickInput:()=>Zr,FresnelBlock:()=>xx,FresnelParameters:()=>aS,FromHalfFloat:()=>Sn.SX,FrontFace:()=>fu,FrontFacingBlock:()=>eE,Frustum:()=>Du.PP,FxaaPostProcess:()=>BO,GIRSM:()=>vU,GIRSMManager:()=>yU,GIRSMRenderPluginMaterial:()=>SU,GPUParticleSystem:()=>cN,GPUPicker:()=>xa,GUID:()=>Rg.S,Gamepad:()=>Pr,GamepadCamera:()=>xi,GamepadManager:()=>Si,GamepadSystemSceneComponent:()=>Ti,GaussianBlock:()=>vT,GaussianSplattingBlock:()=>gT,GaussianSplattingMaterial:()=>RT,GaussianSplattingMesh:()=>MI,GenerateBase64StringFromPixelData:()=>CD.c9,GenerateBase64StringFromTexture:()=>CD.lP,GenerateBase64StringFromTextureAsync:()=>CD.nh,GenericPad:()=>Cr,GeodesicData:()=>bl,Geometry:()=>Se,GeometryArcTan2Block:()=>eI,GeometryBufferRenderer:()=>dw,GeometryBufferRendererSceneComponent:()=>fw,GeometryClampBlock:()=>sI,GeometryCollectionBlock:()=>gA,GeometryCrossBlock:()=>cI,GeometryCurveBlock:()=>uI,GeometryCurveBlockTypes:()=>lI,GeometryDesaturateBlock:()=>hI,GeometryDistanceBlock:()=>fI,GeometryDotBlock:()=>mI,GeometryEaseBlock:()=>SI,GeometryEaseBlockTypes:()=>vI,GeometryElbowBlock:()=>yA,GeometryInfoBlock:()=>HA,GeometryInputBlock:()=>zR,GeometryInterceptorBlock:()=>yI,GeometryLengthBlock:()=>_I,GeometryLerpBlock:()=>tI,GeometryModBlock:()=>oI,GeometryNLerpBlock:()=>nI,GeometryOptimizeBlock:()=>YR,GeometryOutputBlock:()=>GR,GeometryPosterizeBlock:()=>dI,GeometryPowBlock:()=>aI,GeometryRenderingTextureClearType:()=>Ao,GeometryReplaceColorBlock:()=>pI,GeometryRotate2dBlock:()=>gI,GeometrySmoothStepBlock:()=>iI,GeometryStepBlock:()=>rI,GeometryTextureBlock:()=>KA,GeometryTextureFetchBlock:()=>ZA,GeometryTransformBlock:()=>RA,GeometryTrigonometryBlock:()=>CA,GeometryTrigonometryBlockOperations:()=>xA,GeospatialCamera:()=>ma,GeospatialCameraMouseWheelInput:()=>Jr,GeospatialCameraPointersInput:()=>Qr,GetAngleBetweenQuaternions:()=>lC.bQ,GetClass:()=>h.n9,GetClassName:()=>h.Uu,GetDOMTextContent:()=>_i.Zl,GetDataOutConnectionByUniqueId:()=>bd,GetEnvInfo:()=>uc.cU,GetEnvironmentBRDFTexture:()=>eg,GetEnvironmentFuzzBRDFTexture:()=>tg,GetExrHeader:()=>YS.V,GetExtensionFromUrl:()=>zD.r,GetFloatData:()=>be.jm,GetFlowGraphAssetWithType:()=>md.N,GetFogState:()=>Le.qL,GetFontOffset:()=>kh.PR,GetForwardRay:()=>Xn,GetForwardRayToRef:()=>jn,GetHotSpotToRef:()=>fC,GetIndividualParser:()=>Yt,GetInternalFormatFromBasisFormat:()=>aO.yT,GetMimeType:()=>Cg.ny,GetParser:()=>Wt,GetPointsCount:()=>uR,GetQuaternionFromDirections:()=>lC.pi,GetQuaternionFromDirectionsToRef:()=>lC.fb,GetRegisteredSceneLoaderPluginMetadata:()=>Ug,GetSignalInConnectionByUniqueId:()=>Sd,GetTGAHeader:()=>LO.O_,GetTextureDataAsync:()=>Sn.Oz,GetTransformedPosition:()=>pC,GetTypeByteLength:()=>be.PD,GetTypedArrayConstructor:()=>be.w,GetTypedArrayData:()=>be.II,Gizmo:()=>ja,GizmoAnchorPoint:()=>Wa,GizmoCoordinatesMode:()=>Ha,GizmoManager:()=>F_,GlowLayer:()=>My,GoldbergMesh:()=>Tl,GradientBlock:()=>Gx,GradientBlockColorStep:()=>Ux,GradientHelper:()=>JO,GrainPostProcess:()=>aw,GreasedLineBaseMesh:()=>rR,GreasedLineMaterialDefaults:()=>UP,GreasedLineMesh:()=>iR,GreasedLineMeshColorDistribution:()=>oR,GreasedLineMeshColorDistributionType:()=>YP,GreasedLineMeshColorMode:()=>HP,GreasedLineMeshMaterialType:()=>WP,GreasedLineMeshWidthDistribution:()=>aR,GreasedLinePluginMaterial:()=>zP,GreasedLineRibbonAutoDirectionMode:()=>eR,GreasedLineRibbonFacesMode:()=>$C,GreasedLineRibbonMesh:()=>sR,GreasedLineRibbonPointsMode:()=>JC,GreasedLineSimpleMaterial:()=>jP,GreasedLineTools:()=>GP,GreasedLineUseOffsetsSimpleMaterialDefine:()=>XP,GridBlock:()=>ZR,GroundBuilder:()=>oa,GroundMesh:()=>Jo,HDRCubeTexture:()=>Rb,HDRCubeTextureAssetTask:()=>rO,HDRFiltering:()=>Tb,HDRTools:()=>Cb.I9,Halton2DSequence:()=>Jm,HandConstraintBehavior:()=>pr,HandConstraintOrientation:()=>tr,HandConstraintVisibility:()=>nr,HandConstraintZone:()=>er,HandPart:()=>cy,HandleFallbacksForShadows:()=>Le.c4,HardwareScalingOptimization:()=>_O,HavokPlugin:()=>OL,HeightToNormalBlock:()=>oE,HemisphereBuilder:()=>B_,HemisphericLight:()=>za,HemisphericParticleEmitter:()=>JM,Hermite:()=>lr.Hermite,Hermite1stDerivative:()=>lr.Hermite1stDerivative,HighestCommonFactor:()=>lr.HighestCommonFactor,HighlightLayer:()=>Ny,HighlightsPostProcess:()=>sw,Hinge2Joint:()=>cs,HingeConstraint:()=>uL,HingeJoint:()=>ls,HtmlElementTexture:()=>FS,HufUncompress:()=>GS.ZR,ILog2:()=>lr.ILog2,IWebXRControllerPhysicsOptions:()=>sk,IblCdfGenerator:()=>Eb,IblCdfGeneratorSceneComponent:()=>pV,IblShadowsRenderPipeline:()=>bV,IcoSphereBlock:()=>qR,IcoSphereBuilder:()=>sl,IdentityMatrixToRef:()=>uC.Ky,ImageAssetTask:()=>eO,ImageProcessingBlock:()=>ZT,ImageProcessingConfiguration:()=>lo.p,ImageProcessingMixin:()=>Fo,ImageProcessingPostProcess:()=>lw,ImageSourceBlock:()=>IT,ImportAnimationsAsync:()=>nv,ImportMeshAsync:()=>Gg,IncrementValueAction:()=>x,IndexFormat:()=>bu,InitializeCSG2Async:()=>TR,InputBlock:()=>Lv,InspectableType:()=>jO,InstancedLinesMesh:()=>Ds,InstancedMesh:()=>Ke,InstancesBlock:()=>LT,InstantiateBlock:()=>VA,InstantiateLinearBlock:()=>UA,InstantiateOnFacesBlock:()=>LA,InstantiateOnVerticesBlock:()=>FA,InstantiateOnVolumeBlock:()=>wA,InstantiateRadialBlock:()=>GA,InstantiatedEntries:()=>$e,IntFloatConverterBlock:()=>kA,InterleaveScalar:()=>WS.KA,InternalTexture:()=>Qi.h,InternalTextureSource:()=>Qi.G,InterpolateValueAction:()=>B,IntersectionInfo:()=>he,InverseLerp:()=>lr.InverseLerp,InvertMatrixToArray:()=>uC.yj,InvertMatrixToRef:()=>uC.EE,IridescenceBlock:()=>$x,IsBase64DataUrl:()=>Cg.f2,IsCSG2Ready:()=>SR,IsDocumentAvailable:()=>_i.Nf,IsFileURL:()=>Cg.my,IsNavigatorAvailable:()=>_i.XD,IsWindowObjectExist:()=>_i.BA,IsWrapper:()=>we.E,JoystickAxis:()=>jr,KeepAssets:()=>Je,KeyboardEventTypes:()=>Ar.TB,KeyboardInfo:()=>Ar.W0,KeyboardInfoPre:()=>Ar.Bu,KhronosTextureContainer:()=>dO.H,KhronosTextureContainer2:()=>bD.Z,LastCreatedAudioEngine:()=>rt,LatheBuilder:()=>$s,Lattice:()=>tR,LatticeBlock:()=>PA,LatticePluginMaterial:()=>nR,Layer:()=>Ly,LayerSceneComponent:()=>Fy,Lazy:()=>WD,LengthBlock:()=>Ax,LensFlare:()=>Zy,LensFlareSystem:()=>Qy,LensFlareSystemSceneComponent:()=>Jy,LensFlaresOptimization:()=>yO,LensRenderingPipeline:()=>Aw,Lerp:()=>lr.Lerp,LerpAngle:()=>lr.LerpAngle,LerpBlock:()=>vx,Light:()=>Ze.v,LightBlock:()=>AE,LightConstants:()=>_b.c,LightGizmo:()=>G_,LightInformationBlock:()=>BT,LineEdgesRenderer:()=>dV,LinesBuilder:()=>Vs,LinesMesh:()=>Ms,LoadAssetContainerAsync:()=>Jg,LoadAssetContainerFromSerializedScene:()=>$b,LoadFile:()=>Cg.zU,LoadFileError:()=>Cg.hX,LoadIESData:()=>yb.i,LoadImage:()=>Cg.W$,LoadImageConfiguration:()=>Cg.qc,LoadOp:()=>Pu,LoadSceneAsync:()=>Hg,LoadTextureFromTranscodeResult:()=>aO.aB,LockConstraint:()=>dL,Logger:()=>y.V,LoopBlock:()=>bP,MainAudioBus:()=>nn.s,MapMode:()=>Kc,MapRangeBlock:()=>hA,MappingBlock:()=>YA,MappingTypes:()=>WA,MarkAsDirty:()=>uC.ER,Material:()=>Be,MaterialAnisotropicDefines:()=>cg,MaterialBRDFDefines:()=>rg,MaterialClearCoatDefines:()=>og,MaterialDefines:()=>ho,MaterialDetailMapDefines:()=>Io,MaterialFlags:()=>_o.h,MaterialGreasedLineDefines:()=>kP,MaterialHelper:()=>sS,MaterialHelperGeometryRendering:()=>Do,MaterialIridescenceDefines:()=>sg,MaterialPluginBase:()=>Ro,MaterialPluginEvent:()=>AP,MaterialPluginManager:()=>bo,MaterialSheenDefines:()=>hg,MaterialStencilState:()=>Fe,MaterialSubSurfaceDefines:()=>pg,MathBlock:()=>cA,MathBlockOperations:()=>sA,Matrix:()=>Du.uq,MatrixBuilderBlock:()=>aP,MatrixComposeBlock:()=>XA,MatrixDeterminantBlock:()=>pP,MatrixManagement:()=>uC.jk,MatrixSplitterBlock:()=>EP,MatrixTransposeBlock:()=>mP,MaxBlock:()=>Px,MergeGeometryBlock:()=>_A,MergeMeshesOptimization:()=>EO,Mesh:()=>qe,MeshAssetTask:()=>ZI,MeshAttributeExistsBlock:()=>gP,MeshAttributeExistsBlockTypes:()=>fP,MeshBlock:()=>jR,MeshBuilder:()=>Il,MeshDebugMode:()=>qP,MeshDebugPluginMaterial:()=>QP,MeshExploder:()=>cO,MeshLODLevel:()=>Ge,MeshParticleEmitter:()=>KM,MeshShapeBlock:()=>jN,MeshUVSpaceRenderer:()=>VC,MeshoptCompression:()=>RC,MinBlock:()=>Cx,MinMaxReducer:()=>tM.R,MipmapFilterMode:()=>ru,MirrorTexture:()=>H_,ModBlock:()=>iP,ModelShape:()=>fN,MorphTarget:()=>Ab,MorphTargetManager:()=>Ob,MorphTargetsBlock:()=>wT,MotionBlurPostProcess:()=>mw,MotorEnabledJoint:()=>ss,MoveTowards:()=>lr.MoveTowards,MoveTowardsAngle:()=>lr.MoveTowardsAngle,MultiMaterial:()=>Ve,MultiObserver:()=>pO,MultiPick:()=>Hn,MultiPickWithRay:()=>Yn,MultiPointerScaleBehavior:()=>ir,MultiRenderTarget:()=>XS,MultiplyBlock:()=>qv,MultiplyMatricesToArray:()=>uC.xO,MultiplyMatricesToRef:()=>uC.fd,NLerpBlock:()=>kx,NativeDataStream:()=>cc,NativeEngine:()=>Gc,NativePointerInput:()=>Xl.Ze,NativeXRFrame:()=>az,NativeXRLayerRenderTargetTextureProvider:()=>Ko,NativeXRLayerWrapper:()=>qo,NativeXRRenderTarget:()=>Zo,NegateBlock:()=>Ix,Node:()=>ae.b,NodeGeometry:()=>HR,NodeGeometryBlock:()=>UR,NodeGeometryBlockConnectionPointTypes:()=>ER,NodeGeometryBuildState:()=>kR,NodeGeometryConnectionPoint:()=>VR,NodeGeometryConnectionPointCompatibilityStates:()=>xR,NodeGeometryConnectionPointDirection:()=>PR,NodeGeometryContextualSources:()=>BR,NodeMaterial:()=>oy,NodeMaterialBlock:()=>Cv,NodeMaterialBlockConnectionPointMode:()=>JS,NodeMaterialBlockConnectionPointTypes:()=>dv,NodeMaterialBlockTargets:()=>pv,NodeMaterialConnectionPoint:()=>Pv,NodeMaterialConnectionPointCompatibilityStates:()=>yv,NodeMaterialConnectionPointCustomObject:()=>_T,NodeMaterialConnectionPointDirection:()=>bv,NodeMaterialDebugBlock:()=>RP,NodeMaterialDefines:()=>iy,NodeMaterialModes:()=>Rv,NodeMaterialOptimizer:()=>IP,NodeMaterialSystemValues:()=>Av,NodeMaterialTeleportInBlock:()=>lx,NodeMaterialTeleportOutBlock:()=>cx,NodeParticleBlock:()=>MN,NodeParticleBlockConnectionPointTypes:()=>bN,NodeParticleBuildState:()=>DN,NodeParticleConnectionPoint:()=>ON,NodeParticleConnectionPointCompatibilityStates:()=>SN,NodeParticleConnectionPointDirection:()=>TN,NodeParticleContextualSources:()=>AN,NodeParticleSystemSet:()=>WN,NodeParticleSystemSources:()=>IN,NodeRenderGraph:()=>cf,NodeRenderGraphAnaglyphPostProcessBlock:()=>Of,NodeRenderGraphBasePostProcessBlock:()=>If,NodeRenderGraphBlackAndWhitePostProcessBlock:()=>Nf,NodeRenderGraphBlock:()=>Lp,NodeRenderGraphBlockConnectionPointTypes:()=>Ap,NodeRenderGraphBloomPostProcessBlock:()=>Gf,NodeRenderGraphBlurPostProcessBlock:()=>kf,NodeRenderGraphBuildState:()=>af,NodeRenderGraphCascadedShadowGeneratorBlock:()=>d_,NodeRenderGraphChromaticAberrationPostProcessBlock:()=>Hf,NodeRenderGraphCircleOfConfusionPostProcessBlock:()=>jf,NodeRenderGraphClearBlock:()=>tf,NodeRenderGraphColorCorrectionPostProcessBlock:()=>Zf,NodeRenderGraphConnectionPoint:()=>Fp,NodeRenderGraphConnectionPointCompatibilityStates:()=>Ip,NodeRenderGraphConnectionPointDirection:()=>Op,NodeRenderGraphConvolutionPostProcessBlock:()=>$f,NodeRenderGraphCopyTextureBlock:()=>b_,NodeRenderGraphCullObjectsBlock:()=>lf,NodeRenderGraphDepthOfFieldPostProcessBlock:()=>sm,NodeRenderGraphElbowBlock:()=>uf,NodeRenderGraphExecuteBlock:()=>df,NodeRenderGraphExtractHighlightsPostProcessBlock:()=>lm,NodeRenderGraphFXAAPostProcessBlock:()=>fm,NodeRenderGraphFilterPostProcessBlock:()=>hm,NodeRenderGraphGenerateMipmapsBlock:()=>T_,NodeRenderGraphGeometryRendererBlock:()=>p_,NodeRenderGraphGlowLayerBlock:()=>Ef,NodeRenderGraphGrainPostProcessBlock:()=>gm,NodeRenderGraphHighlightLayerBlock:()=>Rf,NodeRenderGraphImageProcessingPostProcessBlock:()=>bm,NodeRenderGraphInputBlock:()=>$p,NodeRenderGraphMotionBlurPostProcessBlock:()=>Em,NodeRenderGraphObjectRendererBlock:()=>of,NodeRenderGraphOutputBlock:()=>Bp,NodeRenderGraphPassCubePostProcessBlock:()=>Rm,NodeRenderGraphPassPostProcessBlock:()=>Cm,NodeRenderGraphResourceContainerBlock:()=>pf,NodeRenderGraphSSAO2PostProcessBlock:()=>km,NodeRenderGraphSSRPostProcessBlock:()=>Qm,NodeRenderGraphScreenSpaceCurvaturePostProcessBlock:()=>Nm,NodeRenderGraphShadowGeneratorBlock:()=>m_,NodeRenderGraphSharpenPostProcessBlock:()=>Om,NodeRenderGraphTAAPostProcessBlock:()=>o_,NodeRenderGraphTeleportInBlock:()=>g_,NodeRenderGraphTeleportOutBlock:()=>v_,NodeRenderGraphTonemapPostProcessBlock:()=>l_,NodeRenderGraphUtilityLayerRendererBlock:()=>__,NoiseBlock:()=>mA,NoiseProceduralTexture:()=>QS,NormalBlendBlock:()=>Hx,Normalize:()=>lr.Normalize,NormalizeBlock:()=>mx,NormalizeRadians:()=>lr.NormalizeRadians,NormalizeVectorBlock:()=>TA,NullBlock:()=>tA,NullEngine:()=>Jl,NullEngineOptions:()=>Ql,ObjectRenderer:()=>Bl.P,Observable:()=>l.cP,Observer:()=>l.nu,OcclusionMaterial:()=>uS,Octree:()=>Ba,OctreeBlock:()=>wa,OctreeSceneComponent:()=>Va,OimoJSPlugin:()=>Lb,OnAfterEnteringVRObservableEvent:()=>ua,OneMinusBlock:()=>Tx,OpenPBRMaterial:()=>gS,OpenPBRMaterialDefines:()=>_S,OptimizeAnimations:()=>K,OptimizeIndices:()=>CR.OptimizeIndices,Orientation:()=>Du.t4,OutlineRenderer:()=>FV,OutsideRange:()=>lr.OutsideRange,PBRAnisotropicConfiguration:()=>ug,PBRBRDFConfiguration:()=>ig,PBRBaseMaterial:()=>gg,PBRBaseSimpleMaterial:()=>hS,PBRClearCoatConfiguration:()=>ag,PBRIridescenceConfiguration:()=>lg,PBRMaterial:()=>vg,PBRMaterialDefines:()=>_g,PBRMetallicRoughnessBlock:()=>rP,PBRMetallicRoughnessMaterial:()=>vS,PBRSheenConfiguration:()=>dg,PBRSpecularGlossinessMaterial:()=>yS,PBRSubSurfaceConfiguration:()=>fg,PHI:()=>Du.a6,PadNumber:()=>vn.LW,PanoramaToCubeMapTools:()=>OS.D,Parse:()=>Xt,ParseBlockAsync:()=>Cd,ParseCoordinatorAsync:()=>Td,ParseFloat16:()=>WS.LD,ParseFloat32:()=>WS.Ff,ParseFlowGraph:()=>xd,ParseFlowGraphAsync:()=>Ed,ParseFlowGraphBlockWithClassType:()=>Rd,ParseFlowGraphContext:()=>Pd,ParseGraphConnectionWithClassType:()=>Ad,ParseGraphDataConnection:()=>Id,ParseInt32:()=>WS.cL,ParseInt64:()=>WS.tB,ParseNullTerminatedString:()=>WS.T$,ParseUint16:()=>WS.Jn,ParseUint32:()=>WS.PX,ParseUint8:()=>WS._S,ParseUint8Array:()=>WS.fz,ParseValue:()=>WS.zX,Particle:()=>iM,ParticleBlendMultiplyBlock:()=>Hv,ParticleConditionBlock:()=>RF,ParticleConditionBlockTests:()=>PF,ParticleConverterBlock:()=>bF,ParticleDebugBlock:()=>TF,ParticleElbowBlock:()=>EF,ParticleFresnelBlock:()=>DF,ParticleGradientBlock:()=>vF,ParticleGradientValueBlock:()=>gF,ParticleHelper:()=>hN,ParticleInputBlock:()=>LN,ParticleLerpBlock:()=>tF,ParticleLocalVariableBlock:()=>OF,ParticleLocalVariableBlockScope:()=>AF,ParticleMathBlock:()=>UN,ParticleMathBlockOperations:()=>BN,ParticleRampGradientBlock:()=>Wv,ParticleRandomBlock:()=>QN,ParticleRandomBlockLocks:()=>KN,ParticleSystem:()=>gD,ParticleSystemSet:()=>uN,ParticleTeleportInBlock:()=>xF,ParticleTeleportOutBlock:()=>CF,ParticleTextureBlock:()=>zv,ParticleTextureSourceBlock:()=>wN,ParticleTriggerBlock:()=>IF,ParticleTrigonometryBlock:()=>SF,ParticleTrigonometryBlockOperations:()=>yF,ParticleVectorLengthBlock:()=>MF,ParticlesOptimization:()=>SO,PassCubePostProcess:()=>Pi.s,PassPostProcess:()=>Pi.v,Path2:()=>Du.Cu,Path3D:()=>Du.tO,PathCursor:()=>j,PercentToRange:()=>lr.PercentToRange,PerfCollectionStrategy:()=>wD,PerfCounter:()=>$l.A,PerformanceConfigurator:()=>Kl.I,PerformanceMonitor:()=>Gh.r,PerformanceViewerCollector:()=>FD,PerturbNormalBlock:()=>JT,PhotoDome:()=>Z_,Physics6DoFConstraint:()=>sL,Physics6DoFLimit:()=>aL,PhysicsActivationControl:()=>YF,PhysicsAggregate:()=>gL,PhysicsBody:()=>qF,PhysicsCharacterController:()=>xL,PhysicsConstraint:()=>oL,PhysicsConstraintAxis:()=>VF,PhysicsConstraintAxisLimitMode:()=>BF,PhysicsConstraintMotorType:()=>kF,PhysicsConstraintType:()=>UF,PhysicsEngine:()=>Nb,PhysicsEngineV2:()=>XF,PhysicsEventType:()=>zF,PhysicsHelper:()=>LL,PhysicsImpostor:()=>us,PhysicsJoint:()=>os,PhysicsMaterialCombineMode:()=>jF,PhysicsMotionType:()=>WF,PhysicsPrestepType:()=>HF,PhysicsRadialExplosionEventOptions:()=>GL,PhysicsRadialImpulseFalloff:()=>DL,PhysicsRaycastResult:()=>Db,PhysicsShape:()=>KF,PhysicsShapeBox:()=>$F,PhysicsShapeCapsule:()=>QF,PhysicsShapeContainer:()=>nL,PhysicsShapeConvexHull:()=>eL,PhysicsShapeCylinder:()=>JF,PhysicsShapeGroundMesh:()=>iL,PhysicsShapeHeightField:()=>rL,PhysicsShapeMesh:()=>tL,PhysicsShapeSphere:()=>ZF,PhysicsShapeType:()=>GF,PhysicsUpdraftEventOptions:()=>kL,PhysicsUpdraftMode:()=>NL,PhysicsViewer:()=>Ol,PhysicsVortexEventOptions:()=>zL,Pick:()=>zn,PickWithBoundingInfo:()=>kn,PickWithRay:()=>Wn,PickingCustomization:()=>Dn,PickingInfo:()=>xe.G,PingPong:()=>lr.PingPong,PipelineErrorReason:()=>hu,PivotTools:()=>Kn,Plane:()=>Du.Zc,PlaneBlock:()=>XR,PlaneBuilder:()=>Jn,PlaneDragGizmo:()=>M_,PlaneRotationGizmo:()=>I_,PlayAnimationAction:()=>P,PlaySoundAction:()=>F,PointColor:()=>dN,PointLight:()=>pb,PointListBlock:()=>nA,PointParticleEmitter:()=>QM,PointShapeBlock:()=>HN,PointerDragBehavior:()=>rr,PointerEventTypes:()=>En.Zp,PointerInfo:()=>En.mx,PointerInfoBase:()=>En.Vn,PointerInfoPre:()=>En.tT,PointerInput:()=>Xl.ST,PointsCloudSystem:()=>EN,PointsGroup:()=>yN,Polar:()=>aC,Polygon:()=>zs,PolygonBuilder:()=>js,PolygonMeshBuilder:()=>Ws,PolyhedronBuilder:()=>il,PolyhedronData:()=>yl,PositionGizmo:()=>D_,PositionNormalTextureVertex:()=>Du.k0,PositionNormalVertex:()=>Du.B5,PostProcess:()=>Ci.w,PostProcessManager:()=>_w.X,PostProcessRenderEffect:()=>XL,PostProcessRenderPipeline:()=>Sw,PostProcessRenderPipelineManager:()=>Tw,PostProcessRenderPipelineManagerSceneComponent:()=>Ew,PostProcessesOptimization:()=>vO,PosterizeBlock:()=>Bx,PowBlock:()=>Ox,PowerEase:()=>k.Ww,PowerPreference:()=>Yc,PrePassOutputBlock:()=>lE,PrePassRenderer:()=>TV,PrePassRendererSceneComponent:()=>EV,PrePassTextureBlock:()=>sx,PrecisionDate:()=>Ut.j,PredicateCondition:()=>g,Predictor:()=>WS.XE,PrepareAttributesForBakedVertexAnimation:()=>Le.J2,PrepareAttributesForBones:()=>Le.ni,PrepareAttributesForInstances:()=>Le.ER,PrepareAttributesForMorphTargets:()=>Le.IF,PrepareAttributesForMorphTargetsInfluencers:()=>Le.MF,PrepareDefinesAndAttributesForMorphTargets:()=>Le.Dk,PrepareDefinesForAttributes:()=>Le.qB,PrepareDefinesForBakedVertexAnimation:()=>Le.wu,PrepareDefinesForBones:()=>Le.IC,PrepareDefinesForCamera:()=>Le.Y7,PrepareDefinesForClipPlanes:()=>Mo.e3,PrepareDefinesForFrameBoundValues:()=>Le.OR,PrepareDefinesForIBL:()=>Le.kz,PrepareDefinesForLight:()=>Le.lo,PrepareDefinesForLights:()=>Le.az,PrepareDefinesForMergedUV:()=>Le.YT,PrepareDefinesForMisc:()=>Le.fm,PrepareDefinesForMorphTargets:()=>Le.Jz,PrepareDefinesForMultiview:()=>Le.VO,PrepareDefinesForOIT:()=>Le.Nc,PrepareDefinesForPrePass:()=>Le.N4,PrepareStringDefinesForClipPlanes:()=>Mo.r4,PrepareUniformLayoutForIBL:()=>Le.G$,PrepareUniformsAndSamplersForIBL:()=>Le.B1,PrepareUniformsAndSamplersForLight:()=>Le.GD,PrepareUniformsAndSamplersList:()=>Le.Bb,PressureObserverWrapper:()=>AD,PrimitiveTopology:()=>pu,PrismaticConstraint:()=>pL,ProceduralTexture:()=>$v,ProceduralTextureSceneComponent:()=>Jv,PropertyTypeForEdition:()=>Zp,ProximityCastResult:()=>WL,PushAttributesForInstances:()=>Le.te,PushMaterial:()=>mo,QuadraticEase:()=>k.fA,QuadraticErrorSimplification:()=>jC,QuarticEase:()=>k.Q6,Quaternion:()=>Du.PT,QueryType:()=>Ru,QueueNewFrame:()=>Ie.r,QuinticEase:()=>k.q7,RGBDTextureTools:()=>Q_.G,RSMCreatePluginMaterial:()=>gU,Ragdoll:()=>yL,RagdollBoneProperties:()=>vL,RandomBlock:()=>fA,RandomBlockLocks:()=>dA,RandomGUID:()=>Rg.z,RandomNumberBlock:()=>Mx,RandomRange:()=>lr.RandomRange,RangeToPercent:()=>lr.RangeToPercent,RawCubeTexture:()=>$S,RawTexture:()=>gn,RawTexture2DArray:()=>Ib,RawTexture3D:()=>eT,Ray:()=>Nn,RayHelper:()=>Ml,ReadExrDataAsync:()=>DS.ReadExrDataAsync,ReadFile:()=>Cg.NJ,ReadFileError:()=>Cg.VB,RecastJSCrowd:()=>QD,RecastJSPlugin:()=>ZD,ReciprocalBlock:()=>Fx,RectAreaLight:()=>mb,ReflectBlock:()=>Xx,ReflectionBlock:()=>Qx,ReflectionProbe:()=>Bb,ReflectionTextureBaseBlock:()=>OE,ReflectionTextureBlock:()=>ME,ReflectiveShadowMap:()=>mU,Reflector:()=>RD,RefractBlock:()=>jx,RefractionBlock:()=>eP,RefractionPostProcess:()=>vw,RefractionTexture:()=>tT,RegisterClass:()=>h.Y5,RegisterMaterialPlugin:()=>xo,RegisterNativeTypeAsync:()=>wc,RegisterSceneLoaderPlugin:()=>Bg,RegisterTargetForLateAnimationBinding:()=>U.BT,RemapBlock:()=>Xv,RemoveUnreferencedVerticesData:()=>QC,RenderPassTimestampLocation:()=>xu,RenderTargetTexture:()=>Ji.$,RenderTargetWrapper:()=>Zl.v,RenderTargetsOptimization:()=>TO,RenderingGroup:()=>LV.U,RenderingGroupInfo:()=>wV.o,RenderingManager:()=>wV.m,Repeat:()=>lr.Repeat,ReplaceColorBlock:()=>Lx,RequestFile:()=>Cg.sh,RequestFileError:()=>Cg.Mi,RequestFullscreen:()=>kh.tl,RequestPointerlock:()=>kh.eG,ResizeImageBitmap:()=>kh.jf,RetryStrategy:()=>$O.a,ReverseLutFromBitmap:()=>GS.FG,RibbonBuilder:()=>_s,RichType:()=>ud.D,RichTypeAny:()=>ud.Vv,RichTypeBoolean:()=>ud.RI,RichTypeColor3:()=>ud.Nf,RichTypeColor4:()=>ud.Gx,RichTypeFlowGraphInteger:()=>ud.x2,RichTypeMatrix:()=>ud.Sp,RichTypeMatrix2D:()=>ud.cZ,RichTypeMatrix3D:()=>ud.F4,RichTypeNumber:()=>ud.Es,RichTypeQuaternion:()=>ud.P_,RichTypeString:()=>ud.KV,RichTypeVector2:()=>ud.K$,RichTypeVector3:()=>ud.Dx,RichTypeVector4:()=>ud.Ko,RollingAverage:()=>Gh.K,Rotate2dBlock:()=>Yx,RotationGizmo:()=>O_,RotationXBlock:()=>AA,RotationYBlock:()=>IA,RotationZBlock:()=>OA,RuntimeAnimation:()=>z.x,RuntimeError:()=>ue.bu,SSAO2RenderingPipeline:()=>Ow,SSAORenderingPipeline:()=>Nw,SSRRenderingPipeline:()=>kw,SamplerBindingType:()=>su,Scalar:()=>fa,ScaleBlock:()=>ux,ScaleGizmo:()=>N_,ScalingBlock:()=>MA,ScalingMatrixToRef:()=>uC.fg,ScanData:()=>HS.u,Scene:()=>Vt.Z,SceneComponentConstants:()=>Ue.v,SceneDepthBlock:()=>DE,SceneInstrumentation:()=>Ay,SceneLoader:()=>ov,SceneLoaderAnimationGroupLoadingMode:()=>yg,SceneLoaderFlags:()=>ve,SceneOptimization:()=>fO,SceneOptimizer:()=>PO,SceneOptimizerOptions:()=>xO,ScenePerformancePriority:()=>Vt.F,SceneRecorder:()=>yD,SceneSerializer:()=>OO,ScreenSizeBlock:()=>wv,ScreenSpaceBlock:()=>rE,ScreenSpaceCurvaturePostProcess:()=>oB,ScreenSpaceReflectionPostProcess:()=>ww,ScreenshotTools:()=>qO,SerializationHelper:()=>Te.p,SetBasisTranscoderWorker:()=>aO.af,SetColorsBlock:()=>aA,SetCorsBehavior:()=>Cg.M1,SetMaterialIDBlock:()=>EA,SetNormalsBlock:()=>iA,SetParentAction:()=>O,SetPositionsBlock:()=>rA,SetStateAction:()=>T,SetTangentsBlock:()=>lA,SetToDefaultGaussianSplatting:()=>DT,SetToDefaultSFE:()=>NT,SetUVsBlock:()=>oA,SetValueAction:()=>E,SetupSpriteSheetBlock:()=>_F,SfeModeDefine:()=>Bv,ShaderCodeInliner:()=>vc,ShaderLanguage:()=>bS,ShaderMaterial:()=>Ea,ShaderStage:()=>ou,ShaderStore:()=>Bi.l,ShadowDepthWrapper:()=>bT,ShadowGenerator:()=>c_.o,ShadowGeneratorSceneComponent:()=>ib,ShadowLight:()=>V_.p,ShadowMapBlock:()=>sE,ShadowsOptimization:()=>gO,ShapeBuilder:()=>Qs,ShapeCastResult:()=>HL,SharpenPostProcess:()=>bw,SheenBlock:()=>Kx,SimplexPerlin3DBlock:()=>Wx,SimplicationQueueSceneComponent:()=>qC,SimplificationQueue:()=>zC,SimplificationSettings:()=>kC,SimplificationType:()=>UC,SineEase:()=>k.kc,SixDofDragBehavior:()=>ar,Size:()=>Du.or,Skeleton:()=>bn,SkeletonViewer:()=>Nl,SliderConstraint:()=>hL,SmartArray:()=>co.L,SmartArrayNoDuplicate:()=>co.b,SmartFilterFragmentOutputBlock:()=>Vv,SmartFilterTextureBlock:()=>OT,SmoothStep:()=>lr.SmoothStep,SmoothStepBlock:()=>Nx,SnapshotRenderingHelper:()=>BD,SolidParticle:()=>pN,SolidParticleSystem:()=>gN,SolidParticleVertex:()=>_N,Sound:()=>wt,SoundState:()=>Kt,SoundTrack:()=>Bt,SourceTextureFormat:()=>oT.Ok,Space:()=>Du.$x,SpatialAudioAttachmentType:()=>Zt,SpecularPowerToRoughness:()=>Cy,SphereBlock:()=>KR,SphereBuilder:()=>is,SphereDirectedParticleEmitter:()=>eD,SphereParticleEmitter:()=>$M,SphereShapeBlock:()=>YN,Spherical:()=>sC,SphericalHarmonics:()=>Uh.O,SphericalPolynomial:()=>Uh.Q,SplatReaderBlock:()=>AT,SpotLight:()=>U_,SpringConstraint:()=>fL,Sprite:()=>Vb,SpriteManager:()=>zb,SpriteMap:()=>qG,SpriteMapFrameRotationDirection:()=>HG,SpritePackedManager:()=>KG,SpriteSceneComponent:()=>Ub,Stage:()=>Ue.B,StandardMaterial:()=>Bo,StandardMaterialDefines:()=>wo,StandardRenderingPipeline:()=>Vw,StartsWith:()=>vn.UH,StateCondition:()=>v,StaticSound:()=>rn.k,StaticSoundBuffer:()=>on.C,StencilOperation:()=>yu,StencilState:()=>ek.K,StencilStateComposer:()=>hh.u,StepBlock:()=>Sx,StereoscopicArcRotateCamera:()=>zi,StereoscopicFreeCamera:()=>Wi,StereoscopicGamepadCamera:()=>Hi,StereoscopicInterlacePostProcess:()=>Gi,StereoscopicInterlacePostProcessI:()=>Ui,StereoscopicScreenUniversalCamera:()=>Xi,StereoscopicUniversalCamera:()=>Yi,StickValues:()=>xr,StopAnimationAction:()=>C,StopSoundAction:()=>L,StorageBuffer:()=>gr.K,StorageReadBlock:()=>SP,StorageTextureAccess:()=>cu,StorageWriteBlock:()=>TP,StoreOp:()=>Cu,StreamingSound:()=>an.G,StringDictionary:()=>qr.w,StringTools:()=>vn.nQ,SubEmitter:()=>qM,SubEmitterType:()=>XM,SubMesh:()=>me,SubSurfaceBlock:()=>tP,SubSurfaceSceneComponent:()=>DV,Subdivide:()=>wR,SubdivideBlock:()=>EI,SubtractBlock:()=>bx,SurfaceMagnetismBehavior:()=>sr,SwitchBooleanAction:()=>S,SwitchInput:()=>Xl.dR,SystemBlock:()=>FN,TAARenderingPipeline:()=>Ww,TBNBlock:()=>QT,TGATools:()=>LO.uT,Tags:()=>Q.Y,TargetCamera:()=>ti,TargetedAnimation:()=>H.H,TeleportInBlock:()=>jA,TeleportOutBlock:()=>qA,TestBase64DataUrl:()=>Cg.ZP,TextFileAssetTask:()=>JI,Texture:()=>_n.g,TextureAspect:()=>$c,TextureAssetTask:()=>tO,TextureBlock:()=>IE,TextureDimension:()=>Zc,TextureFormat:()=>eu,TextureOptimization:()=>mO,TexturePacker:()=>qS,TexturePackerFrame:()=>jS,TextureSampleType:()=>lu,TextureSampler:()=>nT.u,TextureTools:()=>Sn.LO,TextureUsage:()=>Qc,TextureViewDimension:()=>Jc,ThinAnaglyphPostProcess:()=>Ii,ThinBlackAndWhitePostProcess:()=>Mf,ThinBloomEffect:()=>Bf,ThinBlurPostProcess:()=>_f.q,ThinChromaticAberrationPostProcess:()=>zf,ThinCircleOfConfusionPostProcess:()=>Yf,ThinColorCorrectionPostProcess:()=>qf,ThinConvolutionPostProcess:()=>Qf,ThinDepthOfFieldEffect:()=>om,ThinDepthOfFieldEffectBlurLevel:()=>em,ThinEffectLayer:()=>mf,ThinEngine:()=>Uo.ThinEngine,ThinExtractHighlightsPostProcess:()=>wf,ThinFXAAPostProcess:()=>dm,ThinFilterPostProcess:()=>cm,ThinGlowBlurPostProcess:()=>ff,ThinGlowLayer:()=>gf,ThinGrainPostProcess:()=>mm,ThinHighlightLayer:()=>Pf,ThinImageProcessingPostProcess:()=>vm,ThinMatrix:()=>cC,ThinMotionBlurPostProcess:()=>Sm,ThinPassCubePostProcess:()=>xf.V,ThinPassPostProcess:()=>xf.m,ThinRenderTargetTexture:()=>iT,ThinScreenSpaceCurvaturePostProcess:()=>Mm,ThinSharpenPostProcess:()=>Am,ThinTexture:()=>rT.D,ThinTonemapPostProcess:()=>a_,TiledBoxBuilder:()=>Rs,TiledPlaneBuilder:()=>Ts,TimerState:()=>vy.R$,TmpColors:()=>Du.IG,TmpVectors:()=>Du.AA,ToGammaSpace:()=>Du.rv,ToHalfFloat:()=>Sn.LZ,ToHex:()=>lr.ToHex,ToLinearSpace:()=>Du.tk,TonemapPostProcess:()=>$w,TonemappingOperator:()=>t_,Tools:()=>Z.S0,TorusBlock:()=>QR,TorusBuilder:()=>la,TorusKnotBuilder:()=>Os,TouchCamera:()=>ri,TrailMesh:()=>GC,Trajectory:()=>SD,TrajectoryClassifier:()=>PD,TranscodeAsync:()=>aO.yk,TranscodeTarget:()=>oT.Xl,TransformBlock:()=>Uv,TransformFeedbackBoundingHelper:()=>Na.TransformFeedbackBoundingHelper,TransformNode:()=>Ee,TranslationBlock:()=>NA,TranslationMatrixToRef:()=>uC.Tf,TriPlanarBlock:()=>hP,TrigonometryBlock:()=>ey,TrigonometryBlockOperations:()=>Qv,TubeBuilder:()=>tl,TwirlBlock:()=>iE,UVDefinesMixin:()=>No,UncompressPIZ:()=>US.tg,UncompressPXR:()=>US._k,UncompressRAW:()=>US.S4,UncompressRLE:()=>US.r,UncompressZIP:()=>US.VE,UniformBuffer:()=>Pe.D,UniversalCamera:()=>Ei,UnregisterAllMaterialPlugins:()=>Co,UnregisterMaterialPlugin:()=>Po,UpdateAgeBlock:()=>aF,UpdateAngleBlock:()=>oF,UpdateAttractorBlock:()=>pF,UpdateColorBlock:()=>rF,UpdateDirectionBlock:()=>nF,UpdateFlowMapBlock:()=>cF,UpdatePositionBlock:()=>VN,UpdateScaleBlock:()=>iF,UpdateSpriteCellIndexBlock:()=>lF,UploadContent:()=>LO.FA,UploadEnvLevelsAsync:()=>uc.o5,UploadEnvSpherical:()=>uc.ow,UploadIrradianceLevelsAsync:()=>uc.p$,UploadRadianceLevelsAsync:()=>uc.UA,UtilityLayerRenderer:()=>Ya,VRCameraMetrics:()=>qi,VRDeviceOrientationArcRotateCamera:()=>oo,VRDeviceOrientationFreeCamera:()=>ao,VRDeviceOrientationGamepadCamera:()=>so,VRDistortionCorrectionPostProcess:()=>Ki,VRExperienceHelper:()=>ha,VRMultiviewToSingleviewPostProcess:()=>ro,ValidatedNativeDataStream:()=>kc,ValueCondition:()=>_,Vector2:()=>Du.I9,Vector2ToFixed:()=>lC.Ve,Vector3:()=>Du.Pq,Vector3Dot:()=>lC.G$,Vector3FromFloatsToRef:()=>lC.Wl,Vector3ScaleToRef:()=>lC.F5,Vector3ToFixed:()=>lC.kf,Vector4:()=>Du.IU,Vector4ToFixed:()=>lC.xl,VectorConverterBlock:()=>SA,VectorMergerBlock:()=>Yv,VectorSplitterBlock:()=>gx,VertexAnimationBaker:()=>Tn,VertexBuffer:()=>se.R,VertexData:()=>ge,VertexDataMaterialInfo:()=>_e,VertexFormat:()=>Su,VertexOutputBlock:()=>Gv,VertexStepMode:()=>Tu,VideoDome:()=>Py,VideoRecorder:()=>wO,VideoTexture:()=>xy,ViewDirectionBlock:()=>Ex,Viewport:()=>Du.LM,VirtualJoystick:()=>Kr,VirtualJoysticksCamera:()=>ji,VolumetricLightScatteringPostProcess:()=>iB,VoronoiNoiseBlock:()=>cP,Wav2Decode:()=>GS.tb,WaveBlock:()=>Vx,WaveBlockKind:()=>wx,WebGL2ParticleSystem:()=>nN,WebGL2ShaderProcessor:()=>td.B,WebGLDataBuffer:()=>gR.A,WebGLHardwareTexture:()=>zo.d,WebGLPipelineContext:()=>ed.x,WebGPUCacheBindGroups:()=>bh,WebGPUCacheRenderPipeline:()=>lh,WebGPUCacheRenderPipelineTree:()=>uh,WebGPUCacheSampler:()=>rh,WebGPUDataBuffer:()=>Qu,WebGPUDrawContext:()=>gh,WebGPUEngine:()=>Zh,WebGPUPipelineContext:()=>wu,WebGPURenderTargetWrapper:()=>Yh,WebGPUShaderProcessor:()=>Lu,WebGPUTintWASM:()=>wh,WebRequest:()=>Sa.u,WebXRAbstractFeature:()=>gv,WebXRAbstractMotionController:()=>av,WebXRAnchorSystem:()=>rk,WebXRBackgroundRemover:()=>ak,WebXRCamera:()=>Eg,WebXRControllerComponent:()=>Pg,WebXRControllerMovement:()=>_k,WebXRControllerPhysics:()=>lk,WebXRControllerPointerSelection:()=>vv,WebXRDefaultExperience:()=>Sy,WebXRDefaultExperienceOptions:()=>by,WebXRDepthSensing:()=>Wk,WebXRDomOverlay:()=>mk,WebXREnterExitUI:()=>py,WebXREnterExitUIButton:()=>hy,WebXREnterExitUIOptions:()=>dy,WebXRExperienceHelper:()=>xg,WebXREyeTracking:()=>vk,WebXRFeatureName:()=>ur,WebXRFeaturePointSystem:()=>uk,WebXRFeaturesManager:()=>hr,WebXRGenericHandController:()=>Zk,WebXRGenericTriggerMotionController:()=>sv,WebXRHTCViveMotionController:()=>iz,WebXRHand:()=>_y,WebXRHandJoint:()=>uy,WebXRHandTracking:()=>gy,WebXRHitTest:()=>ck,WebXRHitTestLegacy:()=>tk,WebXRImageTracking:()=>fk,WebXRInput:()=>_v,WebXRInputSource:()=>mv,WebXRLayerRenderTargetTextureProvider:()=>Wo,WebXRLayers:()=>Ok,WebXRLightEstimation:()=>gk,WebXRManagedOutputCanvas:()=>jo,WebXRManagedOutputCanvasOptions:()=>Xo,WebXRMeshDetector:()=>pk,WebXRMicrosoftMixedRealityController:()=>Jk,WebXRMotionControllerManager:()=>hv,WebXRMotionControllerTeleportation:()=>yy,WebXRNearControllerMode:()=>ny,WebXRNearInteraction:()=>sy,WebXROculusHandController:()=>nz,WebXROculusTouchMotionController:()=>ez,WebXRPlaneDetector:()=>ok,WebXRProfiledMotionController:()=>cv,WebXRRawCameraAccess:()=>Kk,WebXRSessionManager:()=>Qo,WebXRSpaceWarp:()=>qk,WebXRSpaceWarpRenderTargetTextureProvider:()=>jk,WebXRState:()=>XG,WebXRTrackingState:()=>jG,WebXRWalkingLocomotion:()=>Ek,WeightedSound:()=>Qt,WhenTextureReadyAsync:()=>Sn.v9,WithinEpsilon:()=>lr.WithinEpsilon,WorkerPool:()=>mC.T,WorleyNoise3DBlock:()=>zx,XRSpaceWarpRenderTarget:()=>Xk,Xbox360Button:()=>fi,Xbox360Dpad:()=>mi,Xbox360Pad:()=>yi,XboxInput:()=>Xl.sZ,_AudioAnalyzerDefaults:()=>sn.IR,_BabylonLoaderRegistered:()=>Wb,_BasisTextureLoader:()=>BS._BasisTextureLoader,_CommonDispose:()=>kh.kX,_CommonInit:()=>kh.BG,_CreationDataStorage:()=>ke,_DDSTextureLoader:()=>bg._DDSTextureLoader,_ENVTextureLoader:()=>Sg._ENVTextureLoader,_ExrTextureLoader:()=>DS._ExrTextureLoader,_GetAudioEngine:()=>ot,_GetCompatibleTextureLoader:()=>Nc.gT,_HDRTextureLoader:()=>wS._HDRTextureLoader,_HasAudioAnalyzerOptions:()=>sn.GA,_HasSpatialAudioListenerOptions:()=>ft,_HasSpatialAudioOptions:()=>ln.GB,_HasStereoAudioOptions:()=>cn.uD,_IESTextureLoader:()=>VS._IESTextureLoader,_InstancesBatch:()=>He,_KTXTextureLoader:()=>Tg._KTXTextureLoader,_LoadScriptModuleAsync:()=>yR,_MeshCollisionData:()=>Ce,_OcclusionDataStorage:()=>ec,_PrimaryIsoTriangle:()=>vl,_SetStereoscopicAnaglyphRigMode:()=>Mi,_SetStereoscopicRigMode:()=>ki,_SetVrRigMode:()=>io,_SpatialAudioDefaults:()=>ln.Qc,_SpatialAudioListenerDefaults:()=>pt,_StaticOffsetValueColor3:()=>w.wF,_StaticOffsetValueColor4:()=>w.pO,_StaticOffsetValueQuaternion:()=>w.ov,_StaticOffsetValueSize:()=>w.bn,_StaticOffsetValueVector2:()=>w.fY,_StaticOffsetValueVector3:()=>w.mA,_StereoAudioDefaults:()=>cn.uJ,_TGATextureLoader:()=>LS._TGATextureLoader,_TimeToken:()=>ic,_UpdateRGBDAsync:()=>uc.gW,_WebAudioBus:()=>un._WebAudioBus,_WebAudioEngine:()=>Nt,_WebAudioMainBus:()=>hn._WebAudioMainBus,_WebAudioSoundSource:()=>dn._WebAudioSoundSource,_WebAudioStaticSound:()=>pn._WebAudioStaticSound,_WebAudioStaticSoundBuffer:()=>pn._WebAudioStaticSoundBuffer,_WebAudioStreamingSound:()=>fn._WebAudioStreamingSound,_forceSceneHelpersToBundle:()=>Ty,_forceTransformFeedbackToBundle:()=>oc,_injectLTSFileTools:()=>Cg.rh,addAccessorsForMaterialProperty:()=>ce.ru,addToBlockFactory:()=>gd,allocateAndCopyTypedBuffer:()=>sc.k,anaglyphPixelShader:()=>VB.anaglyphPixelShader,anaglyphPixelShaderWGSL:()=>UB.anaglyphPixelShaderWGSL,appendSceneAsync:()=>Kg,backbufferColorTextureHandle:()=>Ll.O,backbufferDepthStencilTextureHandle:()=>Ll.m,backgroundPixelShader:()=>iS.backgroundPixelShader,backgroundPixelShaderWGSL:()=>nS.backgroundPixelShaderWGSL,backgroundVertexShader:()=>rS.backgroundVertexShader,backgroundVertexShaderWGSL:()=>tS.backgroundVertexShaderWGSL,bilateralBlurPixelShader:()=>TU.bilateralBlurPixelShader,bilateralBlurPixelShaderWGSL:()=>CU.bilateralBlurPixelShaderWGSL,bilateralBlurQualityPixelShader:()=>EU.bilateralBlurQualityPixelShader,bilateralBlurQualityPixelShaderWGSL:()=>RU.bilateralBlurQualityPixelShaderWGSL,blackAndWhitePixelShader:()=>wB.blackAndWhitePixelShader,blackAndWhitePixelShaderWGSL:()=>BB.blackAndWhitePixelShaderWGSL,blockFactory:()=>vd,bloomMergePixelShader:()=>AB.bloomMergePixelShader,bloomMergePixelShaderWGSL:()=>IB.bloomMergePixelShaderWGSL,bonesDeclaration:()=>GT.bonesDeclaration,bonesDeclarationWGSL:()=>VT.bonesDeclarationWGSL,bonesVertex:()=>kT.bonesVertex,bonesVertexWGSL:()=>UT.bonesVertexWGSL,boundingBoxRendererPixelShader:()=>LU.boundingBoxRendererPixelShader,boundingBoxRendererPixelShaderWGSL:()=>BU.boundingBoxRendererPixelShaderWGSL,boundingBoxRendererVertexShader:()=>wU.boundingBoxRendererVertexShader,boundingBoxRendererVertexShaderWGSL:()=>VU.boundingBoxRendererVertexShaderWGSL,bumpFragment:()=>vE.bumpFragment,bumpFragmentFunctions:()=>bE.bumpFragmentFunctions,bumpFragmentFunctionsWGSL:()=>gE.bumpFragmentFunctionsWGSL,bumpFragmentMainFunctions:()=>yE.bumpFragmentMainFunctions,bumpFragmentMainFunctionsWGSL:()=>_E.bumpFragmentMainFunctionsWGSL,bumpFragmentWGSL:()=>mE.bumpFragmentWGSL,captureEquirectangularFromScene:()=>UD,chromaticAberrationPixelShader:()=>Pw.chromaticAberrationPixelShader,chromaticAberrationPixelShaderWGSL:()=>EB.chromaticAberrationPixelShaderWGSL,circleOfConfusionPixelShader:()=>CB.circleOfConfusionPixelShader,circleOfConfusionPixelShaderWGSL:()=>RB.circleOfConfusionPixelShaderWGSL,className:()=>Z.s7,clipPlaneFragment:()=>UE.clipPlaneFragment,clipPlaneFragmentDeclaration:()=>GE.clipPlaneFragmentDeclaration,clipPlaneFragmentDeclarationWGSL:()=>wE.clipPlaneFragmentDeclarationWGSL,clipPlaneFragmentWGSL:()=>LE.clipPlaneFragmentWGSL,clipPlaneVertex:()=>kE.clipPlaneVertex,clipPlaneVertexDeclaration:()=>zE.clipPlaneVertexDeclaration,clipPlaneVertexDeclarationWGSL:()=>VE.clipPlaneVertexDeclarationWGSL,clipPlaneVertexWGSL:()=>BE.clipPlaneVertexWGSL,colorCorrectionPixelShader:()=>zB.colorCorrectionPixelShader,colorCorrectionPixelShaderWGSL:()=>WB.colorCorrectionPixelShaderWGSL,colorPixelShader:()=>lS.colorPixelShader,colorPixelShaderWGSL:()=>DI.colorPixelShaderWGSL,colorVertexShader:()=>cS.colorVertexShader,colorVertexShaderWGSL:()=>NI.colorVertexShaderWGSL,computeMaxExtents:()=>ZC,convolutionPixelShader:()=>GB.convolutionPixelShader,convolutionPixelShaderWGSL:()=>kB.convolutionPixelShaderWGSL,copyTexture3DLayerToTexturePixelShader:()=>jU.copyTexture3DLayerToTexturePixelShader,copyTexture3DLayerToTexturePixelShaderWGSL:()=>qU.copyTexture3DLayerToTexturePixelShaderWGSL,copyTextureToTexturePixelShader:()=>qD.copyTextureToTexturePixelShader,copyTextureToTexturePixelShaderWGSL:()=>KD.copyTextureToTexturePixelShaderWGSL,createDetailMapPlugin:()=>VP,createPBRAnisotropicPlugin:()=>DP,createPBRBRDFPlugin:()=>NP,createPBRClearCoatPlugin:()=>FP,createPBRIridescencePlugin:()=>LP,createPBRSheenPlugin:()=>wP,createPBRSubSurfacePlugin:()=>BP,createYieldingScheduler:()=>$,deepMerge:()=>AC,defaultPixelShader:()=>JP.defaultPixelShader,defaultPixelShaderWGSL:()=>eC.defaultPixelShaderWGSL,defaultVertexShader:()=>$P.defaultVertexShader,defaultVertexShaderWGSL:()=>tC.defaultVertexShaderWGSL,depthBoxBlurPixelShader:()=>hb.depthBoxBlurPixelShader,depthBoxBlurPixelShaderWGSL:()=>sb.depthBoxBlurPixelShaderWGSL,depthOfFieldMergePixelShader:()=>xB.depthOfFieldMergePixelShader,depthOfFieldMergePixelShaderWGSL:()=>PB.depthOfFieldMergePixelShaderWGSL,depthPixelShader:()=>OU.depthPixelShader,depthPixelShaderWGSL:()=>MU.depthPixelShaderWGSL,depthVertexShader:()=>eB.depthVertexShader,depthVertexShaderWGSL:()=>DU.depthVertexShaderWGSL,displayPassPixelShader:()=>ZB.displayPassPixelShader,displayPassPixelShaderWGSL:()=>QB.displayPassPixelShaderWGSL,editableInPropertyPage:()=>Jp,expandToProperty:()=>ce.$z,extractHighlightsPixelShader:()=>OB.extractHighlightsPixelShader,extractHighlightsPixelShaderWGSL:()=>MB.extractHighlightsPixelShaderWGSL,extractMinAndMax:()=>pe.b8,extractMinAndMaxIndexed:()=>pe.cD,filterPixelShader:()=>XB.filterPixelShader,filterPixelShaderWGSL:()=>jB.filterPixelShaderWGSL,fluidRenderingBilateralBlurPixelShader:()=>tU.fluidRenderingBilateralBlurPixelShader,fluidRenderingBilateralBlurPixelShaderWGSL:()=>dU.fluidRenderingBilateralBlurPixelShaderWGSL,fluidRenderingParticleDepthPixelShader:()=>qV.fluidRenderingParticleDepthPixelShader,fluidRenderingParticleDepthPixelShaderWGSL:()=>oU.fluidRenderingParticleDepthPixelShaderWGSL,fluidRenderingParticleDepthVertexShader:()=>jV.fluidRenderingParticleDepthVertexShader,fluidRenderingParticleDepthVertexShaderWGSL:()=>iU.fluidRenderingParticleDepthVertexShaderWGSL,fluidRenderingParticleDiffusePixelShader:()=>eU.fluidRenderingParticleDiffusePixelShader,fluidRenderingParticleDiffusePixelShaderWGSL:()=>hU.fluidRenderingParticleDiffusePixelShaderWGSL,fluidRenderingParticleDiffuseVertexShader:()=>$V,fluidRenderingParticleDiffuseVertexShaderWGSL:()=>uU,fluidRenderingParticleThicknessPixelShader:()=>ZV.fluidRenderingParticleThicknessPixelShader,fluidRenderingParticleThicknessPixelShaderWGSL:()=>sU.fluidRenderingParticleThicknessPixelShaderWGSL,fluidRenderingParticleThicknessVertexShader:()=>KV.fluidRenderingParticleThicknessVertexShader,fluidRenderingParticleThicknessVertexShaderWGSL:()=>aU.fluidRenderingParticleThicknessVertexShaderWGSL,fluidRenderingRenderPixelShader:()=>rU.fluidRenderingRenderPixelShader,fluidRenderingRenderPixelShaderWGSL:()=>fU.fluidRenderingRenderPixelShaderWGSL,fluidRenderingStandardBlurPixelShader:()=>nU.fluidRenderingStandardBlurPixelShader,fluidRenderingStandardBlurPixelShaderWGSL:()=>pU.fluidRenderingStandardBlurPixelShaderWGSL,fogFragmentDeclaration:()=>HE.fogFragmentDeclaration,fogFragmentDeclarationWGSL:()=>WE.fogFragmentDeclarationWGSL,fxaaPixelShader:()=>DB.fxaaPixelShader,fxaaPixelShaderWGSL:()=>FB.fxaaPixelShaderWGSL,fxaaVertexShader:()=>NB.fxaaVertexShader,fxaaVertexShaderWGSL:()=>LB.fxaaVertexShaderWGSL,gaussianSplattingVertexDeclaration:()=>TT.Q,gaussianSplattingVertexDeclarationWGSL:()=>CP,geometryPixelShader:()=>cw.geometryPixelShader,geometryPixelShaderWGSL:()=>NU.geometryPixelShaderWGSL,geometryVertexShader:()=>uw.geometryVertexShader,geometryVertexShaderWGSL:()=>FU.geometryVertexShaderWGSL,getAnimationTypeByFlowGraphType:()=>ud.U_,getDimensionsFromTextureSize:()=>Xp.o,getRichTypeByAnimationType:()=>ud.aZ,getRichTypeByFlowGraphType:()=>ud.Yd,getRichTypeFromValue:()=>ud.k4,glowBlurPostProcessPixelShader:()=>zy.glowBlurPostProcessPixelShader,glowBlurPostProcessPixelShaderWGSL:()=>Yy.glowBlurPostProcessPixelShaderWGSL,glowMapGenerationPixelShader:()=>wy.glowMapGenerationPixelShader,glowMapGenerationPixelShaderWGSL:()=>Vy.glowMapGenerationPixelShaderWGSL,glowMapGenerationVertexShader:()=>By.glowMapGenerationVertexShader,glowMapGenerationVertexShaderWGSL:()=>Uy.glowMapGenerationVertexShaderWGSL,glowMapMergePixelShader:()=>Gy.glowMapMergePixelShader,glowMapMergePixelShaderWGSL:()=>Wy.glowMapMergePixelShaderWGSL,glowMapMergeVertexShader:()=>ky.glowMapMergeVertexShader,glowMapMergeVertexShaderWGSL:()=>Hy.glowMapMergeVertexShaderWGSL,grainPixelShader:()=>SB.grainPixelShader,grainPixelShaderWGSL:()=>TB.grainPixelShaderWGSL,greasedLinePixelShader:()=>nC.greasedLinePixelShader,greasedLinePixelShaderWGSL:()=>iC.greasedLinePixelShaderWGSL,greasedLineVertexShader:()=>rC.greasedLineVertexShader,greasedLineVertexShaderWGSL:()=>oC.greasedLineVertexShaderWGSL,hdrFilteringPixelShader:()=>cT.hdrFilteringPixelShader,hdrFilteringPixelShaderWGSL:()=>hT.hdrFilteringPixelShaderWGSL,hdrFilteringVertexShader:()=>lT.hdrFilteringVertexShader,hdrFilteringVertexShaderWGSL:()=>uT.hdrFilteringVertexShaderWGSL,hdrIrradianceFilteringPixelShader:()=>pT.hdrIrradianceFilteringPixelShader,hdrIrradianceFilteringPixelShaderWGSL:()=>mT.hdrIrradianceFilteringPixelShaderWGSL,hdrIrradianceFilteringVertexShader:()=>dT.hdrIrradianceFilteringVertexShader,hdrIrradianceFilteringVertexShaderWGSL:()=>fT.hdrIrradianceFilteringVertexShaderWGSL,helperFunctions:()=>dE.helperFunctions,helperFunctionsWGSL:()=>Gu.helperFunctionsWGSL,highlightsPixelShader:()=>qB.highlightsPixelShader,highlightsPixelShaderWGSL:()=>KB.highlightsPixelShaderWGSL,iblCdfDebugPixelShader:()=>TG.iblCdfDebugPixelShader,iblCdfDebugPixelShaderWGSL:()=>SG.iblCdfDebugPixelShaderWGSL,iblCdfxPixelShader:()=>_G.iblCdfxPixelShader,iblCdfxPixelShaderWGSL:()=>mG.iblCdfxPixelShaderWGSL,iblCdfyPixelShader:()=>vG.iblCdfyPixelShader,iblCdfyPixelShaderWGSL:()=>gG.iblCdfyPixelShaderWGSL,iblCombineVoxelGridsPixelShader:()=>uG.iblCombineVoxelGridsPixelShader,iblCombineVoxelGridsPixelShaderWGSL:()=>cG.iblCombineVoxelGridsPixelShaderWGSL,iblDominantDirectionPixelShader:()=>CG.iblDominantDirectionPixelShader,iblDominantDirectionPixelShaderWGSL:()=>PG.iblDominantDirectionPixelShaderWGSL,iblGenerateVoxelMipPixelShader:()=>hG.iblGenerateVoxelMipPixelShader,iblGenerateVoxelMipPixelShaderWGSL:()=>dG.iblGenerateVoxelMipPixelShaderWGSL,iblIcdfPixelShader:()=>bG.iblIcdfPixelShader,iblIcdfPixelShaderWGSL:()=>yG.iblIcdfPixelShaderWGSL,iblScaledLuminancePixelShader:()=>xG.iblScaledLuminancePixelShader,iblScaledLuminancePixelShaderWGSL:()=>EG.iblScaledLuminancePixelShaderWGSL,iblShadowAccumulationPixelShader:()=>nG.iblShadowAccumulationPixelShader,iblShadowAccumulationPixelShaderWGSL:()=>tG.iblShadowAccumulationPixelShaderWGSL,iblShadowDebugPixelShader:()=>QU.iblShadowDebugPixelShader,iblShadowDebugPixelShaderWGSL:()=>JU.iblShadowDebugPixelShaderWGSL,iblShadowGBufferDebugPixelShader:()=>pG.iblShadowGBufferDebugPixelShader,iblShadowGBufferDebugPixelShaderWGSL:()=>fG.iblShadowGBufferDebugPixelShaderWGSL,iblShadowSpatialBlurPixelShader:()=>eG.iblShadowSpatialBlurPixelShader,iblShadowSpatialBlurPixelShaderWGSL:()=>$U.iblShadowSpatialBlurPixelShaderWGSL,iblShadowVoxelTracingPixelShader:()=>KU.iblShadowVoxelTracingPixelShader,iblShadowVoxelTracingPixelShaderWGSL:()=>ZU.iblShadowVoxelTracingPixelShaderWGSL,iblShadowsCombinePixelShader:()=>oG,iblShadowsCombinePixelShaderWGSL:()=>lG,iblVoxelGrid2dArrayDebugPixelShader:()=>RG.iblVoxelGrid2dArrayDebugPixelShader,iblVoxelGrid2dArrayDebugPixelShaderWGSL:()=>AG.iblVoxelGrid2dArrayDebugPixelShaderWGSL,iblVoxelGrid3dDebugPixelShader:()=>NG.iblVoxelGrid3dDebugPixelShader,iblVoxelGrid3dDebugPixelShaderWGSL:()=>FG.iblVoxelGrid3dDebugPixelShaderWGSL,iblVoxelGridPixelShader:()=>IG.iblVoxelGridPixelShader,iblVoxelGridPixelShaderWGSL:()=>MG.iblVoxelGridPixelShaderWGSL,iblVoxelGridVertexShader:()=>OG.iblVoxelGridVertexShader,iblVoxelGridVertexShaderWGSL:()=>DG.iblVoxelGridVertexShaderWGSL,iblVoxelSlabDebugPixelShader:()=>wG.iblVoxelSlabDebugPixelShader,iblVoxelSlabDebugPixelShaderWGSL:()=>VG.iblVoxelSlabDebugPixelShaderWGSL,iblVoxelSlabDebugVertexShader:()=>LG.iblVoxelSlabDebugVertexShader,iblVoxelSlabDebugVertexShaderWGSL:()=>BG.iblVoxelSlabDebugVertexShaderWGSL,imageProcessingDeclaration:()=>pE.imageProcessingDeclaration,imageProcessingDeclarationWGSL:()=>uE.imageProcessingDeclarationWGSL,imageProcessingFunctions:()=>fE.imageProcessingFunctions,imageProcessingFunctionsWGSL:()=>hE.imageProcessingFunctionsWGSL,imageProcessingPixelShader:()=>yB.imageProcessingPixelShader,imageProcessingPixelShaderWGSL:()=>vB.imageProcessingPixelShaderWGSL,importAnimationsAsync:()=>rv,inlineScheduler:()=>J,kernelBlurPixelShader:()=>lB.kernelBlurPixelShader,kernelBlurPixelShaderWGSL:()=>uB.kernelBlurPixelShaderWGSL,kernelBlurVertexShader:()=>cB.kernelBlurVertexShader,kernelBlurVertexShaderWGSL:()=>hB.kernelBlurVertexShaderWGSL,layerPixelShader:()=>Xy.layerPixelShader,layerPixelShaderWGSL:()=>qy.layerPixelShaderWGSL,layerVertexShader:()=>jy.layerVertexShader,layerVertexShaderWGSL:()=>Ky.layerVertexShaderWGSL,lensFlarePixelShader:()=>$y.lensFlarePixelShader,lensFlarePixelShaderWGSL:()=>tb.lensFlarePixelShaderWGSL,lensFlareVertexShader:()=>eb.lensFlareVertexShader,lensFlareVertexShaderWGSL:()=>nb.lensFlareVertexShaderWGSL,lightFragment:()=>JE.lightFragment,lightFragmentDeclaration:()=>QE.lightFragmentDeclaration,lightFragmentWGSL:()=>YE.lightFragmentWGSL,lightUboDeclaration:()=>$E.lightUboDeclaration,lightUboDeclarationWGSL:()=>XE.lightUboDeclarationWGSL,lightVxFragmentDeclaration:()=>tx.lightVxFragmentDeclaration,lightVxUboDeclaration:()=>ex.lightVxUboDeclaration,lightVxUboDeclarationWGSL:()=>jE.lightVxUboDeclarationWGSL,lightsFragmentFunctions:()=>nx.lightsFragmentFunctions,lightsFragmentFunctionsWGSL:()=>qE.lightsFragmentFunctionsWGSL,linePixelShader:()=>UU.linePixelShader,linePixelShaderWGSL:()=>kU.linePixelShaderWGSL,lineVertexShader:()=>GU.lineVertexShader,lineVertexShaderWGSL:()=>zU.lineVertexShaderWGSL,loadAssetContainerAsync:()=>$g,loadSceneAsync:()=>Yg,lodCubePixelShader:()=>MO.lodCubePixelShader,lodCubePixelShaderWGSL:()=>NO.lodCubePixelShaderWGSL,lodPixelShader:()=>DO.lodPixelShader,lodPixelShaderWGSL:()=>FO.lodPixelShaderWGSL,makeAsyncFunction:()=>ie,makeSyncFunction:()=>re,meshUVSpaceRendererFinaliserPixelShader:()=>VI.meshUVSpaceRendererFinaliserPixelShader,meshUVSpaceRendererFinaliserPixelShaderWGSL:()=>HI.meshUVSpaceRendererFinaliserPixelShaderWGSL,meshUVSpaceRendererFinaliserVertexShader:()=>UI.meshUVSpaceRendererFinaliserVertexShader,meshUVSpaceRendererFinaliserVertexShaderWGSL:()=>YI.meshUVSpaceRendererFinaliserVertexShaderWGSL,meshUVSpaceRendererMaskerPixelShader:()=>BI.meshUVSpaceRendererMaskerPixelShader,meshUVSpaceRendererMaskerPixelShaderWGSL:()=>WI.meshUVSpaceRendererMaskerPixelShaderWGSL,meshUVSpaceRendererMaskerVertexShader:()=>wI.meshUVSpaceRendererMaskerVertexShader,meshUVSpaceRendererMaskerVertexShaderWGSL:()=>zI.meshUVSpaceRendererMaskerVertexShaderWGSL,meshUVSpaceRendererPixelShader:()=>LI.meshUVSpaceRendererPixelShader,meshUVSpaceRendererPixelShaderWGSL:()=>kI.meshUVSpaceRendererPixelShaderWGSL,meshUVSpaceRendererVertexShader:()=>FI.meshUVSpaceRendererVertexShader,meshUVSpaceRendererVertexShaderWGSL:()=>GI.meshUVSpaceRendererVertexShaderWGSL,morphTargetsVertex:()=>XT.morphTargetsVertex,morphTargetsVertexDeclaration:()=>jT.morphTargetsVertexDeclaration,morphTargetsVertexDeclarationWGSL:()=>WT.morphTargetsVertexDeclarationWGSL,morphTargetsVertexGlobal:()=>qT.morphTargetsVertexGlobal,morphTargetsVertexGlobalDeclaration:()=>KT.morphTargetsVertexGlobalDeclaration,morphTargetsVertexGlobalDeclarationWGSL:()=>YT.morphTargetsVertexGlobalDeclarationWGSL,morphTargetsVertexGlobalWGSL:()=>HT.morphTargetsVertexGlobalWGSL,morphTargetsVertexWGSL:()=>zT.morphTargetsVertexWGSL,motionBlurPixelShader:()=>HB.motionBlurPixelShader,motionBlurPixelShaderWGSL:()=>YB.motionBlurPixelShaderWGSL,nativeOverride:()=>ce.Cx,normalizeEnvInfo:()=>uc.RZ,oitBackBlendPixelShader:()=>UG.oitBackBlendPixelShader,oitBackBlendPixelShaderWGSL:()=>kG.oitBackBlendPixelShaderWGSL,oitFinalPixelShader:()=>GG.oitFinalPixelShader,oitFinalPixelShaderWGSL:()=>zG.oitFinalPixelShaderWGSL,openpbrPixelShader:()=>AS.openpbrPixelShader,openpbrPixelShaderWGSL:()=>CS.openpbrPixelShaderWGSL,openpbrVertexShader:()=>RS.openpbrVertexShader,openpbrVertexShaderWGSL:()=>PS.openpbrVertexShaderWGSL,outlinePixelShader:()=>WU.outlinePixelShader,outlinePixelShaderWGSL:()=>YU.outlinePixelShaderWGSL,outlineVertexShader:()=>HU.outlineVertexShader,outlineVertexShaderWGSL:()=>XU.outlineVertexShaderWGSL,packingFunctions:()=>PE.packingFunctions,packingFunctionsWGSL:()=>TE.packingFunctionsWGSL,particlesPixelShader:()=>NF.particlesPixelShader,particlesPixelShaderWGSL:()=>LF.particlesPixelShaderWGSL,particlesVertexShader:()=>FF.particlesVertexShader,particlesVertexShaderWGSL:()=>wF.particlesVertexShaderWGSL,passCubePixelShader:()=>pB.passCubePixelShader,passCubePixelShaderWGSL:()=>mB.passCubePixelShaderWGSL,passPixelShader:()=>dB.passPixelShader,passPixelShaderWGSL:()=>fB.passPixelShaderWGSL,pbrPixelShader:()=>xS.pbrPixelShader,pbrPixelShaderWGSL:()=>TS.pbrPixelShaderWGSL,pbrVertexShader:()=>ES.pbrVertexShader,pbrVertexShaderWGSL:()=>SS.pbrVertexShaderWGSL,pickingPixelShader:()=>Pa.pickingPixelShader,pickingPixelShaderWGSL:()=>Ra.pickingPixelShaderWGSL,pickingVertexShader:()=>Ca.pickingVertexShader,pickingVertexShaderWGSL:()=>Aa.pickingVertexShaderWGSL,postprocessVertexShader:()=>aB.postprocessVertexShader,postprocessVertexShaderWGSL:()=>sB.postprocessVertexShaderWGSL,proceduralVertexShader:()=>sT.proceduralVertexShader,proceduralVertexShaderWGSL:()=>aT.proceduralVertexShaderWGSL,reflectionFunction:()=>ax.reflectionFunction,reflectionFunctionWGSL:()=>ox.reflectionFunctionWGSL,registerSceneLoaderPlugin:()=>Vg,registerTextureLoader:()=>Nc.kf,rgbdDecodePixelShader:()=>HD.rgbdDecodePixelShader,rgbdDecodePixelShaderWGSL:()=>XD.rgbdDecodePixelShaderWGSL,rgbdEncodePixelShader:()=>YD.rgbdEncodePixelShader,rgbdEncodePixelShaderWGSL:()=>jD.rgbdEncodePixelShaderWGSL,rsmFullGlobalIlluminationPixelShader:()=>PU.rsmFullGlobalIlluminationPixelShader,rsmFullGlobalIlluminationPixelShaderWGSL:()=>IU.rsmFullGlobalIlluminationPixelShaderWGSL,rsmGlobalIlluminationPixelShader:()=>xU.rsmGlobalIlluminationPixelShader,rsmGlobalIlluminationPixelShaderWGSL:()=>AU.rsmGlobalIlluminationPixelShaderWGSL,runCoroutine:()=>ee,runCoroutineAsync:()=>ne,runCoroutineSync:()=>te,screenSpaceReflection2BlurCombinerPixelShader:()=>Kw.screenSpaceReflection2BlurCombinerPixelShader,screenSpaceReflection2BlurCombinerPixelShaderWGSL:()=>Jw.screenSpaceReflection2BlurCombinerPixelShaderWGSL,screenSpaceReflection2BlurPixelShader:()=>qw.screenSpaceReflection2BlurPixelShader,screenSpaceReflection2BlurPixelShaderWGSL:()=>Qw.screenSpaceReflection2BlurPixelShaderWGSL,screenSpaceReflection2PixelShader:()=>jw.screenSpaceReflection2PixelShader,screenSpaceReflection2PixelShaderWGSL:()=>Zw.screenSpaceReflection2PixelShaderWGSL,serialize:()=>ce.lK,serializeAsCameraReference:()=>ce.fW,serializeAsColor3:()=>ce.jT,serializeAsColor4:()=>ce.qK,serializeAsColorCurves:()=>ce.wL,serializeAsFresnelParameters:()=>ce.Y9,serializeAsImageProcessingConfiguration:()=>ce.n1,serializeAsMatrix:()=>ce.GG,serializeAsMeshReference:()=>ce.xG,serializeAsQuaternion:()=>ce.bR,serializeAsTexture:()=>ce.uM,serializeAsVector2:()=>ce.WM,serializeAsVector3:()=>ce.P_,setAndStartTimer:()=>vy.fj,setOpenGLOrientationForUV:()=>ye.ge,shadowMapFragment:()=>CE.shadowMapFragment,shadowMapFragmentSoftTransparentShadow:()=>db.shadowMapFragmentSoftTransparentShadow,shadowMapFragmentSoftTransparentShadowWGSL:()=>lb.shadowMapFragmentSoftTransparentShadowWGSL,shadowMapFragmentWGSL:()=>EE.shadowMapFragmentWGSL,shadowMapPixelShader:()=>cb.shadowMapPixelShader,shadowMapPixelShaderWGSL:()=>ob.shadowMapPixelShaderWGSL,shadowMapVertexMetric:()=>xE.shadowMapVertexMetric,shadowMapVertexMetricWGSL:()=>SE.shadowMapVertexMetricWGSL,shadowMapVertexShader:()=>ub.shadowMapVertexShader,shadowMapVertexShaderWGSL:()=>ab.shadowMapVertexShaderWGSL,shadowsFragmentFunctions:()=>rx.shadowsFragmentFunctions,shadowsFragmentFunctionsWGSL:()=>KE.shadowsFragmentFunctionsWGSL,shadowsVertex:()=>ix.shadowsVertex,shadowsVertexWGSL:()=>ZE.shadowsVertexWGSL,sharpenPixelShader:()=>yw.sharpenPixelShader,sharpenPixelShaderWGSL:()=>bB.sharpenPixelShaderWGSL,spritesPixelShader:()=>ZG.spritesPixelShader,spritesPixelShaderWGSL:()=>JG.spritesPixelShaderWGSL,spritesVertexShader:()=>QG.spritesVertexShader,spritesVertexShaderWGSL:()=>$G.spritesVertexShaderWGSL,ssao2PixelShader:()=>Hw.ssao2PixelShader,ssao2PixelShaderWGSL:()=>Yw.ssao2PixelShaderWGSL,ssaoCombinePixelShader:()=>Dw.ssaoCombinePixelShader,ssaoCombinePixelShaderWGSL:()=>Xw.ssaoCombinePixelShaderWGSL,textureSizeIsObject:()=>Xp.e,tonemapPixelShader:()=>JB.tonemapPixelShader,tonemapPixelShaderWGSL:()=>$B.tonemapPixelShaderWGSL,unregisterTextureLoader:()=>Nc.hy,useOpenGLOrientationForUV:()=>ye.rX,vrDistortionCorrectionPixelShader:()=>_B.vrDistortionCorrectionPixelShader,vrDistortionCorrectionPixelShaderWGSL:()=>gB.vrDistortionCorrectionPixelShaderWGSL});var a={};n.r(a),n.d(a,{AbortError:()=>ue.lc,AbstractActionManager:()=>s.G,AbstractAssetContainer:()=>Qe,AbstractAssetTask:()=>jI,AbstractAudioAnalyzer:()=>sn.zx,AbstractAudioBus:()=>Jt.t,AbstractAudioNode:()=>At.f0,AbstractAudioOutNode:()=>$t.t,AbstractEngine:()=>Ie.$,AbstractMesh:()=>De,AbstractNamedAudioNode:()=>At.Ui,AbstractSound:()=>en.G,AbstractSpatialAudio:()=>ln.lA,AbstractSpatialAudioListener:()=>mt,AbstractStereoAudio:()=>cn.bO,AcquireNativeObjectAsync:()=>Lc,Action:()=>d,ActionEvent:()=>p.X,ActionManager:()=>N,AddAnimationExtensions:()=>U.SM,AddBlock:()=>MT,AddClipPlaneUniforms:()=>Mo.Ll,AddIndividualParser:()=>Ht,AddParser:()=>zt,AddRayExtensions:()=>qn,AddressMode:()=>tu,AdvancedTimer:()=>vy.Qz,Aggregations:()=>bI,AggregatorBlock:()=>TI,AlignAngleBlock:()=>fF,AlignBlock:()=>DA,AlphaState:()=>Vh.i,AmbientOcclusionBlock:()=>cE,AmmoJSPlugin:()=>wb,AnaglyphArcRotateCamera:()=>Di,AnaglyphFreeCamera:()=>Ni,AnaglyphGamepadCamera:()=>Fi,AnaglyphPostProcess:()=>Oi,AnaglyphUniversalCamera:()=>Li,Analyser:()=>tt,AndOrNotEvaluator:()=>XI.Z,Angle:()=>Du.uM,Animatable:()=>U.rT,AnimatedInputBlockTypes:()=>Iv,Animation:()=>w.X5,AnimationAssetTask:()=>QI,AnimationEvent:()=>W,AnimationGroup:()=>H.k,AnimationGroupMask:()=>q,AnimationGroupMaskMode:()=>Y,AnimationKeyInterpolation:()=>V,AnimationPropertiesOverride:()=>G,AnimationRange:()=>X.K,AnisotropyBlock:()=>Zx,AppendSceneAsync:()=>qg,ApplyLut:()=>GS.Kq,ApplyPostProcess:()=>Sn.Qs,Arc2:()=>Du.Xy,ArcFollowCamera:()=>pi,ArcRotateCamera:()=>si,ArcRotateCameraGamepadInput:()=>Rr,ArcRotateCameraInputsManager:()=>Dr,ArcRotateCameraKeyboardMoveInput:()=>Ir,ArcRotateCameraMouseWheelInput:()=>Or,ArcRotateCameraPointersInput:()=>Mr,ArcRotateCameraVRDeviceOrientationInput:()=>Nr,ArcTan2Block:()=>Dx,AreIndices32Bits:()=>be.Lm,AreaLight:()=>fb,AssetContainer:()=>et,AssetTaskState:()=>OI,AssetsManager:()=>oO,AssetsProgressEvent:()=>qI,AsyncLock:()=>GD,AsyncLoop:()=>Z.LV,AttachToBoxBehavior:()=>An,Attractor:()=>_D,AudioBus:()=>tn.l,AudioEngine:()=>Ft,AudioEngineV2:()=>it,AudioNodeType:()=>At.D9,AudioParameterRampShape:()=>qt,AudioSceneComponent:()=>jt,AutoLayoutMode:()=>du,AutoReleaseWorkerPool:()=>mC.h,AutoRotationBehavior:()=>xn,AxesViewer:()=>Ka,Axis:()=>Du._0,AxisDragGizmo:()=>qa,AxisScaleGizmo:()=>R_,BRDFTextureTools:()=>ng,BabylonFileLoaderConfiguration:()=>Hb,BackEase:()=>k.kL,BackgroundMaterial:()=>j_,BakedVertexAnimationManager:()=>mn,BallAndSocketConstraint:()=>lL,BaseCameraMouseWheelInput:()=>br,BaseCameraPointersInput:()=>Sr,BaseError:()=>ue.Cf,BaseParticleSystem:()=>Kv,BaseSixDofDragBehavior:()=>or,BaseTexture:()=>z_.t,BasicColorUpdateBlock:()=>ZN,BasicPositionUpdateBlock:()=>qN,BasicSpriteUpdateBlock:()=>sF,BasisFileInfo:()=>aO.$e,BasisTools:()=>aO.ED,BasisToolsOptions:()=>aO.Sl,BasisTranscodeConfiguration:()=>aO.SV,BezierCurve:()=>Du.vr,BezierCurveEase:()=>k.Bv,BiPlanarBlock:()=>dP,BinaryFileAssetTask:()=>$I,BindBonesParameters:()=>Le.f$,BindClipPlane:()=>Mo.ij,BindFogParameters:()=>Le.Yy,BindIBLParameters:()=>Le.X8,BindIBLSamplers:()=>Le.Wp,BindLight:()=>Le.Kd,BindLightProperties:()=>Le.L0,BindLights:()=>Le.RL,BindLogDepth:()=>Le.DL,BindMorphTargetParameters:()=>Le.nR,BindSceneUniformBuffer:()=>Le._8,BindTextureMatrix:()=>Le.mA,BitArray:()=>kD.P,BlackAndWhitePostProcess:()=>YL,BlendFactor:()=>gu,BlendOperation:()=>vu,BloomEffect:()=>KL,BloomMergePostProcess:()=>qL,BlurPostProcess:()=>W_.j,Bone:()=>yn.$,BoneAxesViewer:()=>Za,BoneIKController:()=>fr,BoneLookController:()=>mr,BonesBlock:()=>FT,BooleanGeometryBlock:()=>$A,BooleanGeometryOperations:()=>QA,BounceEase:()=>k.ND,BouncingBehavior:()=>Pn,BoundingBlock:()=>JA,BoundingBox:()=>Ma.I,BoundingBoxGizmo:()=>A_,BoundingBoxRenderer:()=>oV,BoundingInfo:()=>de.j,BoundingInfoHelper:()=>Da,BoundingSphere:()=>La.i,BoxBlock:()=>WR,BoxBuilder:()=>ts,BoxParticleEmitter:()=>oM,BoxShapeBlock:()=>GN,Buffer:()=>se.h,BufferBindingType:()=>au,BufferMapState:()=>jc,BufferUsage:()=>qc,CSG:()=>BC,CSG2:()=>bR,Camera:()=>oe.i,CameraGizmo:()=>k_,CameraInputTypes:()=>Tr,CameraInputsManager:()=>Er,CannonJSPlugin:()=>Fb,CanvasAlphaMode:()=>Au,CanvasToneMappingMode:()=>Iu,CapsuleBlock:()=>$R,CapsuleBuilder:()=>ps,CascadedShadowGenerator:()=>rb.c,CharacterSupportedState:()=>mL,ChromaticAberrationPostProcess:()=>ZL,CircleEase:()=>k.rm,CircleOfConfusionPostProcess:()=>QL,Clamp:()=>lr.Clamp,ClampBlock:()=>hx,CleanGeometryBlock:()=>vA,ClearCoatBlock:()=>Jx,ClipPlanesBlock:()=>FE,ClipboardEventTypes:()=>rd,ClipboardInfo:()=>id,CloudBlock:()=>lP,CloudPoint:()=>vN,ClusteredLightContainer:()=>gb,ClusteredLightingSceneComponent:()=>vb,Collider:()=>ya,Color3:()=>Du.v9,Color3Gradient:()=>ZO,Color4:()=>Du.ov,ColorConverterBlock:()=>yP,ColorCorrectionPostProcess:()=>JL,ColorCurves:()=>oS.Q,ColorGradient:()=>KO,ColorGradingTexture:()=>IS,ColorMergerBlock:()=>_x,ColorSplitterBlock:()=>Zv,ColorWrite:()=>_u,CombineAction:()=>A,CompareFunction:()=>iu,CompatibilityOptions:()=>ye.p9,CompilationMessageType:()=>uu,CompleteGreasedLineColorTable:()=>dR,CompleteGreasedLineWidthTable:()=>hR,CompressionCodes:()=>WS.he,ComputeAlpha:()=>ii,ComputeBeta:()=>oi,ComputeBindingType:()=>ac,ComputeEffect:()=>Ia,ComputeNormalsBlock:()=>bA,ComputePassTimestampLocation:()=>Eu,ComputeShader:()=>Oa.H,ComputeShaderBoundingHelper:()=>Fa.ComputeShaderBoundingHelper,ComputeShaderParticleSystem:()=>iN,Condition:()=>m,ConditionBlock:()=>pA,ConditionBlockTests:()=>uA,ConditionalBlock:()=>sP,ConditionalBlockConditions:()=>oP,ConeDirectedParticleEmitter:()=>iD,ConeParticleEmitter:()=>rD,Constants:()=>b.Y,ContainerAssetTask:()=>KI,ConversionMode:()=>Vp,ConvertToNodeParticleSystemSetAsync:()=>eF,ConvolutionPostProcess:()=>$L,Coordinate:()=>Du.xp,CopyFloatData:()=>be.gs,CopyMatrixToArray:()=>uC.rl,CopyMatrixToRef:()=>uC.v9,CopyTextureToTexture:()=>Wp,CopyTools:()=>CD.D8,CreateAlignedTypedArray:()=>be.oi,CreateAudioBusAsync:()=>at,CreateAudioEngineAsync:()=>Mt,CreateBox:()=>es,CreateBoxVertexData:()=>Ja,CreateCapsule:()=>ds,CreateCapsuleVertexData:()=>hs,CreateCylinder:()=>Ga,CreateCylinderVertexData:()=>Ua,CreateDashedLines:()=>Bs,CreateDashedLinesVertexData:()=>Fs,CreateDecal:()=>ml,CreateDecoderAsync:()=>HS.d,CreateDisc:()=>vs,CreateDiscVertexData:()=>gs,CreateEnvTextureAsync:()=>uc.Hx,CreateGeodesic:()=>Sl,CreateGoldberg:()=>xl,CreateGoldbergVertexData:()=>El,CreateGreasedLine:()=>cR,CreateGreasedLineMaterial:()=>lR,CreateGround:()=>na,CreateGroundFromHeightMap:()=>ia,CreateGroundFromHeightMapVertexData:()=>ta,CreateGroundVertexData:()=>$o,CreateHemisphere:()=>w_,CreateHotSpotQueryForPickingInfo:()=>hC,CreateIcoSphere:()=>al,CreateIcoSphereVertexData:()=>ol,CreateImageBitmapFromSource:()=>kh.kF,CreateIrradianceImageDataArrayBufferViews:()=>uc.Pu,CreateLathe:()=>Js,CreateLineSystem:()=>Ls,CreateLineSystemVertexData:()=>Ns,CreateLines:()=>ws,CreateMainAudioBusAsync:()=>st,CreateMicrophoneSoundSourceAsync:()=>lt,CreateParticleBlock:()=>zN,CreatePickingRay:()=>Fn,CreatePickingRayInCameraSpace:()=>wn,CreatePickingRayInCameraSpaceToRef:()=>Bn,CreatePickingRayToRef:()=>Ln,CreatePlane:()=>Qn,CreatePlaneVertexData:()=>Zn,CreatePolygon:()=>Ys,CreatePolygonVertexData:()=>Hs,CreatePolyhedron:()=>rl,CreatePolyhedronVertexData:()=>nl,CreateRadianceImageDataArrayBufferViews:()=>uc.ux,CreateResizedCopy:()=>Sn.EE,CreateRibbon:()=>ms,CreateRibbonVertexData:()=>fs,CreateScreenshot:()=>GO,CreateScreenshotAsync:()=>kO,CreateScreenshotForFrameGraphAsync:()=>YO,CreateScreenshotUsingRenderTarget:()=>WO,CreateScreenshotUsingRenderTargetAsync:()=>HO,CreateScreenshotWithResizeAsync:()=>zO,CreateSegmentedBoxVertexData:()=>$a,CreateSoundAsync:()=>ct,CreateSoundBufferAsync:()=>ut,CreateSoundSourceAsync:()=>ht,CreateSphere:()=>rs,CreateSphereVertexData:()=>ns,CreateStreamingSoundAsync:()=>dt,CreateText:()=>Al,CreateTextShapePaths:()=>Rl,CreateTiledBox:()=>Cs,CreateTiledBoxVertexData:()=>Ps,CreateTiledGround:()=>ra,CreateTiledGroundVertexData:()=>ea,CreateTiledPlane:()=>Ss,CreateTiledPlaneVertexData:()=>bs,CreateTorus:()=>sa,CreateTorusKnot:()=>Is,CreateTorusKnotVertexData:()=>As,CreateTorusVertexData:()=>aa,CreateTube:()=>el,CreateUtilityLayerRenderer:()=>Wl,CrossBlock:()=>dx,CubeMapToSphericalPolynomialTools:()=>Sb.d,CubeTexture:()=>Y_,CubeTextureAssetTask:()=>nO,CubicEase:()=>k.vm,CullMode:()=>mu,CurrentScreenBlock:()=>kv,Curve3:()=>Du.jj,CurveBlock:()=>vP,CurveBlockTypes:()=>_P,CustomBlock:()=>px,CustomOptimization:()=>bO,CustomParticleEmitter:()=>ZM,CustomProceduralTexture:()=>KS,CustomShapeBlock:()=>mF,CylinderBlock:()=>JR,CylinderBuilder:()=>ka,CylinderDirectedParticleEmitter:()=>nD,CylinderParticleEmitter:()=>tD,CylinderShapeBlock:()=>XN,DDSTools:()=>sO.DDSTools,DataBuffer:()=>_r.n,DataReader:()=>eM,DataStorage:()=>rM,Database:()=>JD,Debug:()=>hz,DebugBlock:()=>zA,DebugLayer:()=>Qa,DebugLayerTab:()=>Xa,DecalBuilder:()=>_l,DecalMapConfiguration:()=>MP,DecalMapDefines:()=>OP,Decode:()=>vn.Tq,DecodeBase64ToBinary:()=>vn.yS,DecodeBase64ToString:()=>vn.AV,DecodeBase64UrlToBinary:()=>Cg.rz,DecodeBase64UrlToString:()=>Cg.dy,DecodeFloat32:()=>WS.Sn,DecodeRunLength:()=>kS._,DeepCopier:()=>D.r,DefaultCollisionCoordinator:()=>ba,DefaultKTX2DecoderOptions:()=>bD.$,DefaultLoadingScreen:()=>bb,DefaultRenderingPipeline:()=>xw,Deferred:()=>lO,DeltaAngle:()=>lr.DeltaAngle,Denormalize:()=>lr.Denormalize,DepthCullingState:()=>ph.N,DepthOfFieldBlurPostProcess:()=>ew,DepthOfFieldEffect:()=>rw,DepthOfFieldEffectBlurLevel:()=>tw,DepthOfFieldMergePostProcess:()=>nw,DepthPeelingRenderer:()=>lV,DepthPeelingSceneComponent:()=>cV,DepthReducer:()=>nM.k,DepthRenderer:()=>Gw.d,DepthRendererSceneComponent:()=>aV,DepthSortedParticle:()=>mN,DepthSourceBlock:()=>NE,DerivativeBlock:()=>tE,DesaturateBlock:()=>qx,DetailMapConfiguration:()=>Oo,DeviceInputEventType:()=>yr.b,DeviceLostReason:()=>Ou,DeviceOrientationCamera:()=>li,DeviceSource:()=>jl.c,DeviceSourceManager:()=>ql.Z,DeviceType:()=>Xl.bq,DirectionalLight:()=>L_.Z,DirectionalLightFrustumViewer:()=>Yl,DiscBlock:()=>eA,DiscBuilder:()=>ys,DiscardBlock:()=>$T,DisplayPassPostProcess:()=>iw,DistanceBlock:()=>Rx,DistanceConstraint:()=>cL,DistanceJoint:()=>as,DivideBlock:()=>yx,DoNothingAction:()=>R,DomManagement:()=>_i.Az,DotBlock:()=>fx,DracoCompression:()=>xC,DracoDecoder:()=>EC,DracoEncoder:()=>MC,DragOperation:()=>E_,DrawWrapper:()=>fe.E,DualSenseInput:()=>Xl.pI,DualShockButton:()=>gi,DualShockDpad:()=>vi,DualShockInput:()=>Xl.h8,DualShockPad:()=>bi,DumpTools:()=>VO.DumpTools,DynamicFloat32Array:()=>ID,DynamicTexture:()=>Go,EXRCubeTexture:()=>NS,EXROutputType:()=>zS.V,EasingFunction:()=>k.KA,EasingFunctionType:()=>$d.EasingFunctionType,EdgesRenderer:()=>hV,Effect:()=>Dl.M,EffectFallbacks:()=>go.J,EffectLayer:()=>Iy,EffectLayerSceneComponent:()=>Oy,EffectRenderer:()=>Ri.J,EffectWrapper:()=>Ri.$,ElasticEase:()=>k._B,ElbowBlock:()=>uP,EncodeArrayBufferToBase64:()=>vn.EL,EndsWith:()=>vn.jq,Engine:()=>Ai.N,EngineFactory:()=>nd,EngineFormat:()=>oT.GQ,EngineInstrumentation:()=>Ry,EngineStore:()=>M.q,EngineView:()=>tc,EnumerateFloatValues:()=>be.XG,EnvCubeTexture:()=>Pb,EnvironmentHelper:()=>q_,EnvironmentTextureTools:()=>uc.qY,Epsilon:()=>Du.bH,EquiRectangularCubeTexture:()=>MS,EquiRectangularCubeTextureAssetTask:()=>iO,ErrorCodes:()=>ue.tG,ErrorFilter:()=>Mu,EventConstants:()=>yr.s,EventState:()=>l.qO,ExecuteCodeAction:()=>I,ExitFullscreen:()=>kh.g7,ExitPointerlock:()=>kh.rT,ExponentialEase:()=>k.E8,ExrLoaderGlobalConfiguration:()=>zS.u,ExternalTexture:()=>mh,ExtractAsInt:()=>lr.ExtractAsInt,ExtractHighlightsPostProcess:()=>jL,ExtrudePolygon:()=>Xs,ExtrudeShape:()=>qs,ExtrudeShapeCustom:()=>Ks,FactorGradient:()=>QO,FadeInOutBehavior:()=>In,FeatureName:()=>Xc,FileTools:()=>Cg.wS,FileToolsOptions:()=>Cg.eC,FilesInput:()=>hO,FilesInputStore:()=>uO.T,FilterMode:()=>nu,FilterPostProcess:()=>ow,FindMainCamera:()=>kl,FindMainObjectRenderer:()=>zl,FixFlippedFaces:()=>pe.Y4,FlowGraph:()=>od.$,FlowGraphAbsBlock:()=>up.FlowGraphAbsBlock,FlowGraphAcosBlock:()=>up.FlowGraphAcosBlock,FlowGraphAcoshBlock:()=>up.FlowGraphAcoshBlock,FlowGraphAction:()=>Nd.r,FlowGraphAddBlock:()=>up.FlowGraphAddBlock,FlowGraphAngleBetweenBlock:()=>pp.FlowGraphAngleBetweenBlock,FlowGraphArrayIndexBlock:()=>gp.FlowGraphArrayIndexBlock,FlowGraphAsinBlock:()=>up.FlowGraphAsinBlock,FlowGraphAsinhBlock:()=>up.FlowGraphAsinhBlock,FlowGraphAssetType:()=>md.$,FlowGraphAtan2Block:()=>up.FlowGraphAtan2Block,FlowGraphAtanBlock:()=>up.FlowGraphAtanBlock,FlowGraphAtanhBlock:()=>up.FlowGraphAtanhBlock,FlowGraphAxisAngleFromQuaternionBlock:()=>pp.FlowGraphAxisAngleFromQuaternionBlock,FlowGraphBezierCurveEasingBlock:()=>ep.FlowGraphBezierCurveEasingBlock,FlowGraphBitwiseAndBlock:()=>up.FlowGraphBitwiseAndBlock,FlowGraphBitwiseLeftShiftBlock:()=>up.FlowGraphBitwiseLeftShiftBlock,FlowGraphBitwiseNotBlock:()=>up.FlowGraphBitwiseNotBlock,FlowGraphBitwiseOrBlock:()=>up.FlowGraphBitwiseOrBlock,FlowGraphBitwiseRightShiftBlock:()=>up.FlowGraphBitwiseRightShiftBlock,FlowGraphBitwiseXorBlock:()=>up.FlowGraphBitwiseXorBlock,FlowGraphBlock:()=>ad.e,FlowGraphBlockNames:()=>Od,FlowGraphBooleanToFloat:()=>mp.FlowGraphBooleanToFloat,FlowGraphBooleanToInt:()=>mp.FlowGraphBooleanToInt,FlowGraphBranchBlock:()=>Ld.FlowGraphBranchBlock,FlowGraphCallCounterBlock:()=>zd.FlowGraphCallCounterBlock,FlowGraphCancelDelayBlock:()=>qd.FlowGraphCancelDelayBlock,FlowGraphCeilBlock:()=>up.FlowGraphCeilBlock,FlowGraphClampBlock:()=>up.FlowGraphClampBlock,FlowGraphCodeExecutionBlock:()=>vp.FlowGraphCodeExecutionBlock,FlowGraphCombineMatrix2DBlock:()=>hp.FlowGraphCombineMatrix2DBlock,FlowGraphCombineMatrix3DBlock:()=>hp.FlowGraphCombineMatrix3DBlock,FlowGraphCombineMatrixBlock:()=>hp.FlowGraphCombineMatrixBlock,FlowGraphCombineVector2Block:()=>hp.FlowGraphCombineVector2Block,FlowGraphCombineVector3Block:()=>hp.FlowGraphCombineVector3Block,FlowGraphCombineVector4Block:()=>hp.FlowGraphCombineVector4Block,FlowGraphConditionalDataBlock:()=>tp.FlowGraphConditionalDataBlock,FlowGraphConjugateBlock:()=>pp.FlowGraphConjugateBlock,FlowGraphConnection:()=>pd.X,FlowGraphConnectionType:()=>pd.H,FlowGraphConsoleLogBlock:()=>Fd.FlowGraphConsoleLogBlock,FlowGraphConstantBlock:()=>sp.FlowGraphConstantBlock,FlowGraphContext:()=>hd.Y,FlowGraphContextBlock:()=>_p.FlowGraphContextBlock,FlowGraphCoordinator:()=>dd.x,FlowGraphCosBlock:()=>up.FlowGraphCosBlock,FlowGraphCoshBlock:()=>up.FlowGraphCoshBlock,FlowGraphCrossBlock:()=>pp.FlowGraphCrossBlock,FlowGraphCubeRootBlock:()=>up.FlowGraphCubeRootBlock,FlowGraphDataConnection:()=>fd.l,FlowGraphDataSwitchBlock:()=>cp.FlowGraphDataSwitchBlock,FlowGraphDebounceBlock:()=>Hd.FlowGraphDebounceBlock,FlowGraphDegToRadBlock:()=>up.FlowGraphDegToRadBlock,FlowGraphDeterminantBlock:()=>dp.FlowGraphDeterminantBlock,FlowGraphDivideBlock:()=>up.FlowGraphDivideBlock,FlowGraphDoNBlock:()=>wd.FlowGraphDoNBlock,FlowGraphDotBlock:()=>pp.FlowGraphDotBlock,FlowGraphEBlock:()=>up.FlowGraphEBlock,FlowGraphEasingBlock:()=>$d.FlowGraphEasingBlock,FlowGraphEqualityBlock:()=>up.FlowGraphEqualityBlock,FlowGraphEventBlock:()=>cd.i,FlowGraphExecutionBlock:()=>ld.u,FlowGraphExpBlock:()=>up.FlowGraphExpBlock,FlowGraphExtractMatrix2DBlock:()=>hp.FlowGraphExtractMatrix2DBlock,FlowGraphExtractMatrix3DBlock:()=>hp.FlowGraphExtractMatrix3DBlock,FlowGraphExtractMatrixBlock:()=>hp.FlowGraphExtractMatrixBlock,FlowGraphExtractVector2Block:()=>hp.FlowGraphExtractVector2Block,FlowGraphExtractVector3Block:()=>hp.FlowGraphExtractVector3Block,FlowGraphExtractVector4Block:()=>hp.FlowGraphExtractVector4Block,FlowGraphFlipFlopBlock:()=>Yd.FlowGraphFlipFlopBlock,FlowGraphFloatToBoolean:()=>mp.FlowGraphFloatToBoolean,FlowGraphFloatToInt:()=>mp.FlowGraphFloatToInt,FlowGraphFloorBlock:()=>up.FlowGraphFloorBlock,FlowGraphForLoopBlock:()=>Bd.FlowGraphForLoopBlock,FlowGraphFractionBlock:()=>up.FlowGraphFractionBlock,FlowGraphFunctionReferenceBlock:()=>bp.FlowGraphFunctionReferenceBlock,FlowGraphGetAssetBlock:()=>lp.FlowGraphGetAssetBlock,FlowGraphGetPropertyBlock:()=>op.FlowGraphGetPropertyBlock,FlowGraphGetVariableBlock:()=>np.FlowGraphGetVariableBlock,FlowGraphGreaterThanBlock:()=>up.FlowGraphGreaterThanBlock,FlowGraphGreaterThanOrEqualBlock:()=>up.FlowGraphGreaterThanOrEqualBlock,FlowGraphIndexOfBlock:()=>yp.FlowGraphIndexOfBlock,FlowGraphInfBlock:()=>up.FlowGraphInfBlock,FlowGraphIntToBoolean:()=>mp.FlowGraphIntToBoolean,FlowGraphIntToFloat:()=>mp.FlowGraphIntToFloat,FlowGraphInteger:()=>Mp.P,FlowGraphInterpolationBlock:()=>Jd.FlowGraphInterpolationBlock,FlowGraphInvertMatrixBlock:()=>dp.FlowGraphInvertMatrixBlock,FlowGraphIsInfinityBlock:()=>up.FlowGraphIsInfinityBlock,FlowGraphIsNanBlock:()=>up.FlowGraphIsNanBlock,FlowGraphJsonPointerParserBlock:()=>fp.FlowGraphJsonPointerParserBlock,FlowGraphLeadingZerosBlock:()=>up.FlowGraphLeadingZerosBlock,FlowGraphLengthBlock:()=>pp.FlowGraphLengthBlock,FlowGraphLessThanBlock:()=>up.FlowGraphLessThanBlock,FlowGraphLessThanOrEqualBlock:()=>up.FlowGraphLessThanOrEqualBlock,FlowGraphLog10Block:()=>up.FlowGraphLog10Block,FlowGraphLog2Block:()=>up.FlowGraphLog2Block,FlowGraphLogBlock:()=>up.FlowGraphLogBlock,FlowGraphLogger:()=>Nd.H,FlowGraphMathInterpolationBlock:()=>up.FlowGraphMathInterpolationBlock,FlowGraphMatrix2D:()=>Dp.K,FlowGraphMatrix3D:()=>Dp.z,FlowGraphMatrixComposeBlock:()=>dp.FlowGraphMatrixComposeBlock,FlowGraphMatrixDecomposeBlock:()=>dp.FlowGraphMatrixDecomposeBlock,FlowGraphMatrixMultiplicationBlock:()=>dp.FlowGraphMatrixMultiplicationBlock,FlowGraphMaxBlock:()=>up.FlowGraphMaxBlock,FlowGraphMeshPickEventBlock:()=>Sp.FlowGraphMeshPickEventBlock,FlowGraphMinBlock:()=>up.FlowGraphMinBlock,FlowGraphModuloBlock:()=>up.FlowGraphModuloBlock,FlowGraphMultiGateBlock:()=>Ud.FlowGraphMultiGateBlock,FlowGraphMultiplyBlock:()=>up.FlowGraphMultiplyBlock,FlowGraphNaNBlock:()=>up.FlowGraphNaNBlock,FlowGraphNegationBlock:()=>up.FlowGraphNegationBlock,FlowGraphNormalizeBlock:()=>pp.FlowGraphNormalizeBlock,FlowGraphOneBitsCounterBlock:()=>up.FlowGraphOneBitsCounterBlock,FlowGraphPathConverter:()=>Md,FlowGraphPathConverterComponent:()=>Dd.H,FlowGraphPauseAnimationBlock:()=>Qd.FlowGraphPauseAnimationBlock,FlowGraphPiBlock:()=>up.FlowGraphPiBlock,FlowGraphPlayAnimationBlock:()=>Kd.FlowGraphPlayAnimationBlock,FlowGraphPointerOutEventBlock:()=>Cp.FlowGraphPointerOutEventBlock,FlowGraphPointerOverEventBlock:()=>Rp.FlowGraphPointerOverEventBlock,FlowGraphPowerBlock:()=>up.FlowGraphPowerBlock,FlowGraphQuaternionFromAxisAngleBlock:()=>pp.FlowGraphQuaternionFromAxisAngleBlock,FlowGraphQuaternionFromDirectionsBlock:()=>pp.FlowGraphQuaternionFromDirectionsBlock,FlowGraphRadToDegBlock:()=>up.FlowGraphRadToDegBlock,FlowGraphRandomBlock:()=>up.FlowGraphRandomBlock,FlowGraphReceiveCustomEventBlock:()=>Ep.FlowGraphReceiveCustomEventBlock,FlowGraphRotate2DBlock:()=>pp.FlowGraphRotate2DBlock,FlowGraphRotate3DBlock:()=>pp.FlowGraphRotate3DBlock,FlowGraphRoundBlock:()=>up.FlowGraphRoundBlock,FlowGraphSaturateBlock:()=>up.FlowGraphSaturateBlock,FlowGraphSceneReadyEventBlock:()=>Tp.FlowGraphSceneReadyEventBlock,FlowGraphSceneTickEventBlock:()=>Pp.FlowGraphSceneTickEventBlock,FlowGraphSendCustomEventBlock:()=>xp.FlowGraphSendCustomEventBlock,FlowGraphSequenceBlock:()=>Xd.FlowGraphSequenceBlock,FlowGraphSetDelayBlock:()=>jd.FlowGraphSetDelayBlock,FlowGraphSetPropertyBlock:()=>ap.FlowGraphSetPropertyBlock,FlowGraphSetVariableBlock:()=>rp.FlowGraphSetVariableBlock,FlowGraphSignBlock:()=>up.FlowGraphSignBlock,FlowGraphSignalConnection:()=>sd.R,FlowGraphSinBlock:()=>up.FlowGraphSinBlock,FlowGraphSinhBlock:()=>up.FlowGraphSinhBlock,FlowGraphSquareRootBlock:()=>up.FlowGraphSquareRootBlock,FlowGraphState:()=>od.I,FlowGraphStopAnimationBlock:()=>Zd.FlowGraphStopAnimationBlock,FlowGraphSubtractBlock:()=>up.FlowGraphSubtractBlock,FlowGraphSwitchBlock:()=>Gd.FlowGraphSwitchBlock,FlowGraphTanBlock:()=>up.FlowGraphTanBlock,FlowGraphTanhBlock:()=>up.FlowGraphTanhBlock,FlowGraphThrottleBlock:()=>Vd.FlowGraphThrottleBlock,FlowGraphTrailingZerosBlock:()=>up.FlowGraphTrailingZerosBlock,FlowGraphTransformBlock:()=>pp.FlowGraphTransformBlock,FlowGraphTransformCoordinatesBlock:()=>pp.FlowGraphTransformCoordinatesBlock,FlowGraphTransformCoordinatesSystemBlock:()=>ip.FlowGraphTransformCoordinatesSystemBlock,FlowGraphTransposeBlock:()=>dp.FlowGraphTransposeBlock,FlowGraphTruncBlock:()=>up.FlowGraphTruncBlock,FlowGraphTypes:()=>ud.Qd,FlowGraphWaitAllBlock:()=>kd.FlowGraphWaitAllBlock,FlowGraphWhileLoopBlock:()=>Wd.FlowGraphWhileLoopBlock,FlowMap:()=>RN,FluidRenderer:()=>XV,FluidRendererSceneComponent:()=>YV,FluidRenderingDebug:()=>NV,FluidRenderingObject:()=>BV,FluidRenderingObjectCustomParticles:()=>kV,FluidRenderingObjectParticleSystem:()=>VV,FluidRenderingTargetRenderer:()=>GV,FlyCamera:()=>ui,FlyCameraInputsManager:()=>ci,FlyCameraKeyboardInput:()=>Fr,FlyCameraMouseInput:()=>Lr,FogBlock:()=>RE,FollowBehavior:()=>cr,FollowCamera:()=>di,FollowCameraInputsManager:()=>hi,FollowCameraKeyboardMoveInput:()=>wr,FollowCameraMouseWheelInput:()=>Br,FollowCameraPointersInput:()=>Vr,FragCoordBlock:()=>nE,FragDepthBlock:()=>aE,FragmentOutputBlock:()=>Ov,FragmentOutputBlockColorSpace:()=>xv,FrameGraph:()=>Qp,FrameGraphAnaglyphTask:()=>Af,FrameGraphBlackAndWhiteTask:()=>Df,FrameGraphBloomTask:()=>Uf,FrameGraphBlurTask:()=>yf,FrameGraphCascadedShadowGeneratorTask:()=>h_.w,FrameGraphChromaticAberrationTask:()=>Wf,FrameGraphCircleOfConfusionTask:()=>Xf,FrameGraphClearTextureTask:()=>ef,FrameGraphColorCorrectionTask:()=>Kf,FrameGraphContext:()=>Hp,FrameGraphConvolutionTask:()=>Jf,FrameGraphCopyToBackbufferColorTask:()=>wp,FrameGraphCopyToTextureTask:()=>y_,FrameGraphCullObjectsTask:()=>sf,FrameGraphCullPass:()=>kp.x,FrameGraphCustomPostProcessTask:()=>P_,FrameGraphDepthOfFieldTask:()=>am,FrameGraphExecuteTask:()=>hf,FrameGraphExtractHighlightsTask:()=>Vf,FrameGraphFXAATask:()=>pm,FrameGraphFilterTask:()=>um,FrameGraphGenerateMipMapsTask:()=>S_,FrameGraphGeometryRendererTask:()=>Ul,FrameGraphGlowLayerTask:()=>Tf,FrameGraphGrainTask:()=>_m,FrameGraphHighlightLayerTask:()=>Cf,FrameGraphImageProcessingTask:()=>ym,FrameGraphMotionBlurTask:()=>Tm,FrameGraphObjectList:()=>C_,FrameGraphObjectRendererTask:()=>Fl.H,FrameGraphPass:()=>Up.X,FrameGraphPassCubeTask:()=>Pm,FrameGraphPassTask:()=>xm,FrameGraphPostProcessTask:()=>vf.C,FrameGraphRenderContext:()=>Yp,FrameGraphRenderPass:()=>Gp.p,FrameGraphRenderTarget:()=>jp,FrameGraphSSAO2RenderingPipelineTask:()=>Gm,FrameGraphSSRRenderingPipelineTask:()=>Zm,FrameGraphScreenSpaceCurvatureTask:()=>Dm,FrameGraphShadowGeneratorTask:()=>f_.Q,FrameGraphSharpenTask:()=>Im,FrameGraphTAATask:()=>i_,FrameGraphTask:()=>wl.L,FrameGraphTextureManager:()=>Kp,FrameGraphTonemapTask:()=>s_,FrameGraphUtilityLayerRendererTask:()=>Gl,FrameGraphUtils:()=>Hl,FramingBehavior:()=>Cn,FreeCamera:()=>ni,FreeCameraDeviceOrientationInput:()=>Yr,FreeCameraGamepadInput:()=>Xr,FreeCameraInputsManager:()=>Hr,FreeCameraKeyboardMoveInput:()=>Ur,FreeCameraMouseInput:()=>kr,FreeCameraMouseWheelInput:()=>zr,FreeCameraTouchInput:()=>Wr,FreeCameraVirtualJoystickInput:()=>Zr,FresnelBlock:()=>xx,FresnelParameters:()=>aS,FromHalfFloat:()=>Sn.SX,FrontFace:()=>fu,FrontFacingBlock:()=>eE,Frustum:()=>Du.PP,FxaaPostProcess:()=>BO,GIRSM:()=>vU,GIRSMManager:()=>yU,GIRSMRenderPluginMaterial:()=>SU,GPUParticleSystem:()=>cN,GPUPicker:()=>xa,GUID:()=>Rg.S,Gamepad:()=>Pr,GamepadCamera:()=>xi,GamepadManager:()=>Si,GamepadSystemSceneComponent:()=>Ti,GaussianBlock:()=>vT,GaussianSplattingBlock:()=>gT,GaussianSplattingMaterial:()=>RT,GaussianSplattingMesh:()=>MI,GenerateBase64StringFromPixelData:()=>CD.c9,GenerateBase64StringFromTexture:()=>CD.lP,GenerateBase64StringFromTextureAsync:()=>CD.nh,GenericPad:()=>Cr,GeodesicData:()=>bl,Geometry:()=>Se,GeometryArcTan2Block:()=>eI,GeometryBufferRenderer:()=>dw,GeometryBufferRendererSceneComponent:()=>fw,GeometryClampBlock:()=>sI,GeometryCollectionBlock:()=>gA,GeometryCrossBlock:()=>cI,GeometryCurveBlock:()=>uI,GeometryCurveBlockTypes:()=>lI,GeometryDesaturateBlock:()=>hI,GeometryDistanceBlock:()=>fI,GeometryDotBlock:()=>mI,GeometryEaseBlock:()=>SI,GeometryEaseBlockTypes:()=>vI,GeometryElbowBlock:()=>yA,GeometryInfoBlock:()=>HA,GeometryInputBlock:()=>zR,GeometryInterceptorBlock:()=>yI,GeometryLengthBlock:()=>_I,GeometryLerpBlock:()=>tI,GeometryModBlock:()=>oI,GeometryNLerpBlock:()=>nI,GeometryOptimizeBlock:()=>YR,GeometryOutputBlock:()=>GR,GeometryPosterizeBlock:()=>dI,GeometryPowBlock:()=>aI,GeometryRenderingTextureClearType:()=>Ao,GeometryReplaceColorBlock:()=>pI,GeometryRotate2dBlock:()=>gI,GeometrySmoothStepBlock:()=>iI,GeometryStepBlock:()=>rI,GeometryTextureBlock:()=>KA,GeometryTextureFetchBlock:()=>ZA,GeometryTransformBlock:()=>RA,GeometryTrigonometryBlock:()=>CA,GeometryTrigonometryBlockOperations:()=>xA,GeospatialCamera:()=>ma,GeospatialCameraMouseWheelInput:()=>Jr,GeospatialCameraPointersInput:()=>Qr,GetAngleBetweenQuaternions:()=>lC.bQ,GetClass:()=>h.n9,GetClassName:()=>h.Uu,GetDOMTextContent:()=>_i.Zl,GetDataOutConnectionByUniqueId:()=>bd,GetEnvInfo:()=>uc.cU,GetEnvironmentBRDFTexture:()=>eg,GetEnvironmentFuzzBRDFTexture:()=>tg,GetExrHeader:()=>YS.V,GetExtensionFromUrl:()=>zD.r,GetFloatData:()=>be.jm,GetFlowGraphAssetWithType:()=>md.N,GetFogState:()=>Le.qL,GetFontOffset:()=>kh.PR,GetForwardRay:()=>Xn,GetForwardRayToRef:()=>jn,GetHotSpotToRef:()=>fC,GetIndividualParser:()=>Yt,GetInternalFormatFromBasisFormat:()=>aO.yT,GetMimeType:()=>Cg.ny,GetParser:()=>Wt,GetPointsCount:()=>uR,GetQuaternionFromDirections:()=>lC.pi,GetQuaternionFromDirectionsToRef:()=>lC.fb,GetRegisteredSceneLoaderPluginMetadata:()=>Ug,GetSignalInConnectionByUniqueId:()=>Sd,GetTGAHeader:()=>LO.O_,GetTextureDataAsync:()=>Sn.Oz,GetTransformedPosition:()=>pC,GetTypeByteLength:()=>be.PD,GetTypedArrayConstructor:()=>be.w,GetTypedArrayData:()=>be.II,Gizmo:()=>ja,GizmoAnchorPoint:()=>Wa,GizmoCoordinatesMode:()=>Ha,GizmoManager:()=>F_,GlowLayer:()=>My,GoldbergMesh:()=>Tl,GradientBlock:()=>Gx,GradientBlockColorStep:()=>Ux,GradientHelper:()=>JO,GrainPostProcess:()=>aw,GreasedLineBaseMesh:()=>rR,GreasedLineMaterialDefaults:()=>UP,GreasedLineMesh:()=>iR,GreasedLineMeshColorDistribution:()=>oR,GreasedLineMeshColorDistributionType:()=>YP,GreasedLineMeshColorMode:()=>HP,GreasedLineMeshMaterialType:()=>WP,GreasedLineMeshWidthDistribution:()=>aR,GreasedLinePluginMaterial:()=>zP,GreasedLineRibbonAutoDirectionMode:()=>eR,GreasedLineRibbonFacesMode:()=>$C,GreasedLineRibbonMesh:()=>sR,GreasedLineRibbonPointsMode:()=>JC,GreasedLineSimpleMaterial:()=>jP,GreasedLineTools:()=>GP,GreasedLineUseOffsetsSimpleMaterialDefine:()=>XP,GridBlock:()=>ZR,GroundBuilder:()=>oa,GroundMesh:()=>Jo,HDRCubeTexture:()=>Rb,HDRCubeTextureAssetTask:()=>rO,HDRFiltering:()=>Tb,HDRTools:()=>Cb.I9,Halton2DSequence:()=>Jm,HandConstraintBehavior:()=>pr,HandConstraintOrientation:()=>tr,HandConstraintVisibility:()=>nr,HandConstraintZone:()=>er,HandPart:()=>cy,HandleFallbacksForShadows:()=>Le.c4,HardwareScalingOptimization:()=>_O,HavokPlugin:()=>OL,HeightToNormalBlock:()=>oE,HemisphereBuilder:()=>B_,HemisphericLight:()=>za,HemisphericParticleEmitter:()=>JM,Hermite:()=>lr.Hermite,Hermite1stDerivative:()=>lr.Hermite1stDerivative,HighestCommonFactor:()=>lr.HighestCommonFactor,HighlightLayer:()=>Ny,HighlightsPostProcess:()=>sw,Hinge2Joint:()=>cs,HingeConstraint:()=>uL,HingeJoint:()=>ls,HtmlElementTexture:()=>FS,HufUncompress:()=>GS.ZR,ILog2:()=>lr.ILog2,IWebXRControllerPhysicsOptions:()=>sk,IblCdfGenerator:()=>Eb,IblCdfGeneratorSceneComponent:()=>pV,IblShadowsRenderPipeline:()=>bV,IcoSphereBlock:()=>qR,IcoSphereBuilder:()=>sl,IdentityMatrixToRef:()=>uC.Ky,ImageAssetTask:()=>eO,ImageProcessingBlock:()=>ZT,ImageProcessingConfiguration:()=>lo.p,ImageProcessingMixin:()=>Fo,ImageProcessingPostProcess:()=>lw,ImageSourceBlock:()=>IT,ImportAnimationsAsync:()=>nv,ImportMeshAsync:()=>Gg,IncrementValueAction:()=>x,IndexFormat:()=>bu,InitializeCSG2Async:()=>TR,InputBlock:()=>Lv,InspectableType:()=>jO,InstancedLinesMesh:()=>Ds,InstancedMesh:()=>Ke,InstancesBlock:()=>LT,InstantiateBlock:()=>VA,InstantiateLinearBlock:()=>UA,InstantiateOnFacesBlock:()=>LA,InstantiateOnVerticesBlock:()=>FA,InstantiateOnVolumeBlock:()=>wA,InstantiateRadialBlock:()=>GA,InstantiatedEntries:()=>$e,IntFloatConverterBlock:()=>kA,InterleaveScalar:()=>WS.KA,InternalTexture:()=>Qi.h,InternalTextureSource:()=>Qi.G,InterpolateValueAction:()=>B,IntersectionInfo:()=>he,InverseLerp:()=>lr.InverseLerp,InvertMatrixToArray:()=>uC.yj,InvertMatrixToRef:()=>uC.EE,IridescenceBlock:()=>$x,IsBase64DataUrl:()=>Cg.f2,IsCSG2Ready:()=>SR,IsDocumentAvailable:()=>_i.Nf,IsFileURL:()=>Cg.my,IsNavigatorAvailable:()=>_i.XD,IsWindowObjectExist:()=>_i.BA,IsWrapper:()=>we.E,JoystickAxis:()=>jr,KeepAssets:()=>Je,KeyboardEventTypes:()=>Ar.TB,KeyboardInfo:()=>Ar.W0,KeyboardInfoPre:()=>Ar.Bu,KhronosTextureContainer:()=>dO.H,KhronosTextureContainer2:()=>bD.Z,LastCreatedAudioEngine:()=>rt,LatheBuilder:()=>$s,Lattice:()=>tR,LatticeBlock:()=>PA,LatticePluginMaterial:()=>nR,Layer:()=>Ly,LayerSceneComponent:()=>Fy,Lazy:()=>WD,LengthBlock:()=>Ax,LensFlare:()=>Zy,LensFlareSystem:()=>Qy,LensFlareSystemSceneComponent:()=>Jy,LensFlaresOptimization:()=>yO,LensRenderingPipeline:()=>Aw,Lerp:()=>lr.Lerp,LerpAngle:()=>lr.LerpAngle,LerpBlock:()=>vx,Light:()=>Ze.v,LightBlock:()=>AE,LightConstants:()=>_b.c,LightGizmo:()=>G_,LightInformationBlock:()=>BT,LineEdgesRenderer:()=>dV,LinesBuilder:()=>Vs,LinesMesh:()=>Ms,LoadAssetContainerAsync:()=>Jg,LoadAssetContainerFromSerializedScene:()=>$b,LoadFile:()=>Cg.zU,LoadFileError:()=>Cg.hX,LoadIESData:()=>yb.i,LoadImage:()=>Cg.W$,LoadImageConfiguration:()=>Cg.qc,LoadOp:()=>Pu,LoadSceneAsync:()=>Hg,LoadTextureFromTranscodeResult:()=>aO.aB,LockConstraint:()=>dL,Logger:()=>y.V,LoopBlock:()=>bP,MainAudioBus:()=>nn.s,MapMode:()=>Kc,MapRangeBlock:()=>hA,MappingBlock:()=>YA,MappingTypes:()=>WA,MarkAsDirty:()=>uC.ER,Material:()=>Be,MaterialAnisotropicDefines:()=>cg,MaterialBRDFDefines:()=>rg,MaterialClearCoatDefines:()=>og,MaterialDefines:()=>ho,MaterialDetailMapDefines:()=>Io,MaterialFlags:()=>_o.h,MaterialGreasedLineDefines:()=>kP,MaterialHelper:()=>sS,MaterialHelperGeometryRendering:()=>Do,MaterialIridescenceDefines:()=>sg,MaterialPluginBase:()=>Ro,MaterialPluginEvent:()=>AP,MaterialPluginManager:()=>bo,MaterialSheenDefines:()=>hg,MaterialStencilState:()=>Fe,MaterialSubSurfaceDefines:()=>pg,MathBlock:()=>cA,MathBlockOperations:()=>sA,Matrix:()=>Du.uq,MatrixBuilderBlock:()=>aP,MatrixComposeBlock:()=>XA,MatrixDeterminantBlock:()=>pP,MatrixManagement:()=>uC.jk,MatrixSplitterBlock:()=>EP,MatrixTransposeBlock:()=>mP,MaxBlock:()=>Px,MergeGeometryBlock:()=>_A,MergeMeshesOptimization:()=>EO,Mesh:()=>qe,MeshAssetTask:()=>ZI,MeshAttributeExistsBlock:()=>gP,MeshAttributeExistsBlockTypes:()=>fP,MeshBlock:()=>jR,MeshBuilder:()=>Il,MeshDebugMode:()=>qP,MeshDebugPluginMaterial:()=>QP,MeshExploder:()=>cO,MeshLODLevel:()=>Ge,MeshParticleEmitter:()=>KM,MeshShapeBlock:()=>jN,MeshUVSpaceRenderer:()=>VC,MeshoptCompression:()=>RC,MinBlock:()=>Cx,MinMaxReducer:()=>tM.R,MipmapFilterMode:()=>ru,MirrorTexture:()=>H_,ModBlock:()=>iP,ModelShape:()=>fN,MorphTarget:()=>Ab,MorphTargetManager:()=>Ob,MorphTargetsBlock:()=>wT,MotionBlurPostProcess:()=>mw,MotorEnabledJoint:()=>ss,MoveTowards:()=>lr.MoveTowards,MoveTowardsAngle:()=>lr.MoveTowardsAngle,MultiMaterial:()=>Ve,MultiObserver:()=>pO,MultiPick:()=>Hn,MultiPickWithRay:()=>Yn,MultiPointerScaleBehavior:()=>ir,MultiRenderTarget:()=>XS,MultiplyBlock:()=>qv,MultiplyMatricesToArray:()=>uC.xO,MultiplyMatricesToRef:()=>uC.fd,NLerpBlock:()=>kx,NativeDataStream:()=>cc,NativeEngine:()=>Gc,NativePointerInput:()=>Xl.Ze,NativeXRFrame:()=>az,NativeXRLayerRenderTargetTextureProvider:()=>Ko,NativeXRLayerWrapper:()=>qo,NativeXRRenderTarget:()=>Zo,NegateBlock:()=>Ix,Node:()=>ae.b,NodeGeometry:()=>HR,NodeGeometryBlock:()=>UR,NodeGeometryBlockConnectionPointTypes:()=>ER,NodeGeometryBuildState:()=>kR,NodeGeometryConnectionPoint:()=>VR,NodeGeometryConnectionPointCompatibilityStates:()=>xR,NodeGeometryConnectionPointDirection:()=>PR,NodeGeometryContextualSources:()=>BR,NodeMaterial:()=>oy,NodeMaterialBlock:()=>Cv,NodeMaterialBlockConnectionPointMode:()=>JS,NodeMaterialBlockConnectionPointTypes:()=>dv,NodeMaterialBlockTargets:()=>pv,NodeMaterialConnectionPoint:()=>Pv,NodeMaterialConnectionPointCompatibilityStates:()=>yv,NodeMaterialConnectionPointCustomObject:()=>_T,NodeMaterialConnectionPointDirection:()=>bv,NodeMaterialDebugBlock:()=>RP,NodeMaterialDefines:()=>iy,NodeMaterialModes:()=>Rv,NodeMaterialOptimizer:()=>IP,NodeMaterialSystemValues:()=>Av,NodeMaterialTeleportInBlock:()=>lx,NodeMaterialTeleportOutBlock:()=>cx,NodeParticleBlock:()=>MN,NodeParticleBlockConnectionPointTypes:()=>bN,NodeParticleBuildState:()=>DN,NodeParticleConnectionPoint:()=>ON,NodeParticleConnectionPointCompatibilityStates:()=>SN,NodeParticleConnectionPointDirection:()=>TN,NodeParticleContextualSources:()=>AN,NodeParticleSystemSet:()=>WN,NodeParticleSystemSources:()=>IN,NodeRenderGraph:()=>cf,NodeRenderGraphAnaglyphPostProcessBlock:()=>Of,NodeRenderGraphBasePostProcessBlock:()=>If,NodeRenderGraphBlackAndWhitePostProcessBlock:()=>Nf,NodeRenderGraphBlock:()=>Lp,NodeRenderGraphBlockConnectionPointTypes:()=>Ap,NodeRenderGraphBloomPostProcessBlock:()=>Gf,NodeRenderGraphBlurPostProcessBlock:()=>kf,NodeRenderGraphBuildState:()=>af,NodeRenderGraphCascadedShadowGeneratorBlock:()=>d_,NodeRenderGraphChromaticAberrationPostProcessBlock:()=>Hf,NodeRenderGraphCircleOfConfusionPostProcessBlock:()=>jf,NodeRenderGraphClearBlock:()=>tf,NodeRenderGraphColorCorrectionPostProcessBlock:()=>Zf,NodeRenderGraphConnectionPoint:()=>Fp,NodeRenderGraphConnectionPointCompatibilityStates:()=>Ip,NodeRenderGraphConnectionPointDirection:()=>Op,NodeRenderGraphConvolutionPostProcessBlock:()=>$f,NodeRenderGraphCopyTextureBlock:()=>b_,NodeRenderGraphCullObjectsBlock:()=>lf,NodeRenderGraphDepthOfFieldPostProcessBlock:()=>sm,NodeRenderGraphElbowBlock:()=>uf,NodeRenderGraphExecuteBlock:()=>df,NodeRenderGraphExtractHighlightsPostProcessBlock:()=>lm,NodeRenderGraphFXAAPostProcessBlock:()=>fm,NodeRenderGraphFilterPostProcessBlock:()=>hm,NodeRenderGraphGenerateMipmapsBlock:()=>T_,NodeRenderGraphGeometryRendererBlock:()=>p_,NodeRenderGraphGlowLayerBlock:()=>Ef,NodeRenderGraphGrainPostProcessBlock:()=>gm,NodeRenderGraphHighlightLayerBlock:()=>Rf,NodeRenderGraphImageProcessingPostProcessBlock:()=>bm,NodeRenderGraphInputBlock:()=>$p,NodeRenderGraphMotionBlurPostProcessBlock:()=>Em,NodeRenderGraphObjectRendererBlock:()=>of,NodeRenderGraphOutputBlock:()=>Bp,NodeRenderGraphPassCubePostProcessBlock:()=>Rm,NodeRenderGraphPassPostProcessBlock:()=>Cm,NodeRenderGraphResourceContainerBlock:()=>pf,NodeRenderGraphSSAO2PostProcessBlock:()=>km,NodeRenderGraphSSRPostProcessBlock:()=>Qm,NodeRenderGraphScreenSpaceCurvaturePostProcessBlock:()=>Nm,NodeRenderGraphShadowGeneratorBlock:()=>m_,NodeRenderGraphSharpenPostProcessBlock:()=>Om,NodeRenderGraphTAAPostProcessBlock:()=>o_,NodeRenderGraphTeleportInBlock:()=>g_,NodeRenderGraphTeleportOutBlock:()=>v_,NodeRenderGraphTonemapPostProcessBlock:()=>l_,NodeRenderGraphUtilityLayerRendererBlock:()=>__,NoiseBlock:()=>mA,NoiseProceduralTexture:()=>QS,NormalBlendBlock:()=>Hx,Normalize:()=>lr.Normalize,NormalizeBlock:()=>mx,NormalizeRadians:()=>lr.NormalizeRadians,NormalizeVectorBlock:()=>TA,NullBlock:()=>tA,NullEngine:()=>Jl,NullEngineOptions:()=>Ql,ObjectRenderer:()=>Bl.P,Observable:()=>l.cP,Observer:()=>l.nu,OcclusionMaterial:()=>uS,Octree:()=>Ba,OctreeBlock:()=>wa,OctreeSceneComponent:()=>Va,OimoJSPlugin:()=>Lb,OnAfterEnteringVRObservableEvent:()=>ua,OneMinusBlock:()=>Tx,OpenPBRMaterial:()=>gS,OpenPBRMaterialDefines:()=>_S,OptimizeAnimations:()=>K,OptimizeIndices:()=>CR.OptimizeIndices,Orientation:()=>Du.t4,OutlineRenderer:()=>FV,OutsideRange:()=>lr.OutsideRange,PBRAnisotropicConfiguration:()=>ug,PBRBRDFConfiguration:()=>ig,PBRBaseMaterial:()=>gg,PBRBaseSimpleMaterial:()=>hS,PBRClearCoatConfiguration:()=>ag,PBRIridescenceConfiguration:()=>lg,PBRMaterial:()=>vg,PBRMaterialDefines:()=>_g,PBRMetallicRoughnessBlock:()=>rP,PBRMetallicRoughnessMaterial:()=>vS,PBRSheenConfiguration:()=>dg,PBRSpecularGlossinessMaterial:()=>yS,PBRSubSurfaceConfiguration:()=>fg,PHI:()=>Du.a6,PadNumber:()=>vn.LW,PanoramaToCubeMapTools:()=>OS.D,Parse:()=>Xt,ParseBlockAsync:()=>Cd,ParseCoordinatorAsync:()=>Td,ParseFloat16:()=>WS.LD,ParseFloat32:()=>WS.Ff,ParseFlowGraph:()=>xd,ParseFlowGraphAsync:()=>Ed,ParseFlowGraphBlockWithClassType:()=>Rd,ParseFlowGraphContext:()=>Pd,ParseGraphConnectionWithClassType:()=>Ad,ParseGraphDataConnection:()=>Id,ParseInt32:()=>WS.cL,ParseInt64:()=>WS.tB,ParseNullTerminatedString:()=>WS.T$,ParseUint16:()=>WS.Jn,ParseUint32:()=>WS.PX,ParseUint8:()=>WS._S,ParseUint8Array:()=>WS.fz,ParseValue:()=>WS.zX,Particle:()=>iM,ParticleBlendMultiplyBlock:()=>Hv,ParticleConditionBlock:()=>RF,ParticleConditionBlockTests:()=>PF,ParticleConverterBlock:()=>bF,ParticleDebugBlock:()=>TF,ParticleElbowBlock:()=>EF,ParticleFresnelBlock:()=>DF,ParticleGradientBlock:()=>vF,ParticleGradientValueBlock:()=>gF,ParticleHelper:()=>hN,ParticleInputBlock:()=>LN,ParticleLerpBlock:()=>tF,ParticleLocalVariableBlock:()=>OF,ParticleLocalVariableBlockScope:()=>AF,ParticleMathBlock:()=>UN,ParticleMathBlockOperations:()=>BN,ParticleRampGradientBlock:()=>Wv,ParticleRandomBlock:()=>QN,ParticleRandomBlockLocks:()=>KN,ParticleSystem:()=>gD,ParticleSystemSet:()=>uN,ParticleTeleportInBlock:()=>xF,ParticleTeleportOutBlock:()=>CF,ParticleTextureBlock:()=>zv,ParticleTextureSourceBlock:()=>wN,ParticleTriggerBlock:()=>IF,ParticleTrigonometryBlock:()=>SF,ParticleTrigonometryBlockOperations:()=>yF,ParticleVectorLengthBlock:()=>MF,ParticlesOptimization:()=>SO,PassCubePostProcess:()=>Pi.s,PassPostProcess:()=>Pi.v,Path2:()=>Du.Cu,Path3D:()=>Du.tO,PathCursor:()=>j,PercentToRange:()=>lr.PercentToRange,PerfCollectionStrategy:()=>wD,PerfCounter:()=>$l.A,PerformanceConfigurator:()=>Kl.I,PerformanceMonitor:()=>Gh.r,PerformanceViewerCollector:()=>FD,PerturbNormalBlock:()=>JT,PhotoDome:()=>Z_,Physics6DoFConstraint:()=>sL,Physics6DoFLimit:()=>aL,PhysicsActivationControl:()=>YF,PhysicsAggregate:()=>gL,PhysicsBody:()=>qF,PhysicsCharacterController:()=>xL,PhysicsConstraint:()=>oL,PhysicsConstraintAxis:()=>VF,PhysicsConstraintAxisLimitMode:()=>BF,PhysicsConstraintMotorType:()=>kF,PhysicsConstraintType:()=>UF,PhysicsEngine:()=>Nb,PhysicsEngineV2:()=>XF,PhysicsEventType:()=>zF,PhysicsHelper:()=>LL,PhysicsImpostor:()=>us,PhysicsJoint:()=>os,PhysicsMaterialCombineMode:()=>jF,PhysicsMotionType:()=>WF,PhysicsPrestepType:()=>HF,PhysicsRadialExplosionEventOptions:()=>GL,PhysicsRadialImpulseFalloff:()=>DL,PhysicsRaycastResult:()=>Db,PhysicsShape:()=>KF,PhysicsShapeBox:()=>$F,PhysicsShapeCapsule:()=>QF,PhysicsShapeContainer:()=>nL,PhysicsShapeConvexHull:()=>eL,PhysicsShapeCylinder:()=>JF,PhysicsShapeGroundMesh:()=>iL,PhysicsShapeHeightField:()=>rL,PhysicsShapeMesh:()=>tL,PhysicsShapeSphere:()=>ZF,PhysicsShapeType:()=>GF,PhysicsUpdraftEventOptions:()=>kL,PhysicsUpdraftMode:()=>NL,PhysicsViewer:()=>Ol,PhysicsVortexEventOptions:()=>zL,Pick:()=>zn,PickWithBoundingInfo:()=>kn,PickWithRay:()=>Wn,PickingCustomization:()=>Dn,PickingInfo:()=>xe.G,PingPong:()=>lr.PingPong,PipelineErrorReason:()=>hu,PivotTools:()=>Kn,Plane:()=>Du.Zc,PlaneBlock:()=>XR,PlaneBuilder:()=>Jn,PlaneDragGizmo:()=>M_,PlaneRotationGizmo:()=>I_,PlayAnimationAction:()=>P,PlaySoundAction:()=>F,PointColor:()=>dN,PointLight:()=>pb,PointListBlock:()=>nA,PointParticleEmitter:()=>QM,PointShapeBlock:()=>HN,PointerDragBehavior:()=>rr,PointerEventTypes:()=>En.Zp,PointerInfo:()=>En.mx,PointerInfoBase:()=>En.Vn,PointerInfoPre:()=>En.tT,PointerInput:()=>Xl.ST,PointsCloudSystem:()=>EN,PointsGroup:()=>yN,Polar:()=>aC,Polygon:()=>zs,PolygonBuilder:()=>js,PolygonMeshBuilder:()=>Ws,PolyhedronBuilder:()=>il,PolyhedronData:()=>yl,PositionGizmo:()=>D_,PositionNormalTextureVertex:()=>Du.k0,PositionNormalVertex:()=>Du.B5,PostProcess:()=>Ci.w,PostProcessManager:()=>_w.X,PostProcessRenderEffect:()=>XL,PostProcessRenderPipeline:()=>Sw,PostProcessRenderPipelineManager:()=>Tw,PostProcessRenderPipelineManagerSceneComponent:()=>Ew,PostProcessesOptimization:()=>vO,PosterizeBlock:()=>Bx,PowBlock:()=>Ox,PowerEase:()=>k.Ww,PowerPreference:()=>Yc,PrePassOutputBlock:()=>lE,PrePassRenderer:()=>TV,PrePassRendererSceneComponent:()=>EV,PrePassTextureBlock:()=>sx,PrecisionDate:()=>Ut.j,PredicateCondition:()=>g,Predictor:()=>WS.XE,PrepareAttributesForBakedVertexAnimation:()=>Le.J2,PrepareAttributesForBones:()=>Le.ni,PrepareAttributesForInstances:()=>Le.ER,PrepareAttributesForMorphTargets:()=>Le.IF,PrepareAttributesForMorphTargetsInfluencers:()=>Le.MF,PrepareDefinesAndAttributesForMorphTargets:()=>Le.Dk,PrepareDefinesForAttributes:()=>Le.qB,PrepareDefinesForBakedVertexAnimation:()=>Le.wu,PrepareDefinesForBones:()=>Le.IC,PrepareDefinesForCamera:()=>Le.Y7,PrepareDefinesForClipPlanes:()=>Mo.e3,PrepareDefinesForFrameBoundValues:()=>Le.OR,PrepareDefinesForIBL:()=>Le.kz,PrepareDefinesForLight:()=>Le.lo,PrepareDefinesForLights:()=>Le.az,PrepareDefinesForMergedUV:()=>Le.YT,PrepareDefinesForMisc:()=>Le.fm,PrepareDefinesForMorphTargets:()=>Le.Jz,PrepareDefinesForMultiview:()=>Le.VO,PrepareDefinesForOIT:()=>Le.Nc,PrepareDefinesForPrePass:()=>Le.N4,PrepareStringDefinesForClipPlanes:()=>Mo.r4,PrepareUniformLayoutForIBL:()=>Le.G$,PrepareUniformsAndSamplersForIBL:()=>Le.B1,PrepareUniformsAndSamplersForLight:()=>Le.GD,PrepareUniformsAndSamplersList:()=>Le.Bb,PressureObserverWrapper:()=>AD,PrimitiveTopology:()=>pu,PrismaticConstraint:()=>pL,ProceduralTexture:()=>$v,ProceduralTextureSceneComponent:()=>Jv,PropertyTypeForEdition:()=>Zp,ProximityCastResult:()=>WL,PushAttributesForInstances:()=>Le.te,PushMaterial:()=>mo,QuadraticEase:()=>k.fA,QuadraticErrorSimplification:()=>jC,QuarticEase:()=>k.Q6,Quaternion:()=>Du.PT,QueryType:()=>Ru,QueueNewFrame:()=>Ie.r,QuinticEase:()=>k.q7,RGBDTextureTools:()=>Q_.G,RSMCreatePluginMaterial:()=>gU,Ragdoll:()=>yL,RagdollBoneProperties:()=>vL,RandomBlock:()=>fA,RandomBlockLocks:()=>dA,RandomGUID:()=>Rg.z,RandomNumberBlock:()=>Mx,RandomRange:()=>lr.RandomRange,RangeToPercent:()=>lr.RangeToPercent,RawCubeTexture:()=>$S,RawTexture:()=>gn,RawTexture2DArray:()=>Ib,RawTexture3D:()=>eT,Ray:()=>Nn,RayHelper:()=>Ml,ReadExrDataAsync:()=>DS.ReadExrDataAsync,ReadFile:()=>Cg.NJ,ReadFileError:()=>Cg.VB,RecastJSCrowd:()=>QD,RecastJSPlugin:()=>ZD,ReciprocalBlock:()=>Fx,RectAreaLight:()=>mb,ReflectBlock:()=>Xx,ReflectionBlock:()=>Qx,ReflectionProbe:()=>Bb,ReflectionTextureBaseBlock:()=>OE,ReflectionTextureBlock:()=>ME,ReflectiveShadowMap:()=>mU,Reflector:()=>RD,RefractBlock:()=>jx,RefractionBlock:()=>eP,RefractionPostProcess:()=>vw,RefractionTexture:()=>tT,RegisterClass:()=>h.Y5,RegisterMaterialPlugin:()=>xo,RegisterNativeTypeAsync:()=>wc,RegisterSceneLoaderPlugin:()=>Bg,RegisterTargetForLateAnimationBinding:()=>U.BT,RemapBlock:()=>Xv,RemoveUnreferencedVerticesData:()=>QC,RenderPassTimestampLocation:()=>xu,RenderTargetTexture:()=>Ji.$,RenderTargetWrapper:()=>Zl.v,RenderTargetsOptimization:()=>TO,RenderingGroup:()=>LV.U,RenderingGroupInfo:()=>wV.o,RenderingManager:()=>wV.m,Repeat:()=>lr.Repeat,ReplaceColorBlock:()=>Lx,RequestFile:()=>Cg.sh,RequestFileError:()=>Cg.Mi,RequestFullscreen:()=>kh.tl,RequestPointerlock:()=>kh.eG,ResizeImageBitmap:()=>kh.jf,RetryStrategy:()=>$O.a,ReverseLutFromBitmap:()=>GS.FG,RibbonBuilder:()=>_s,RichType:()=>ud.D,RichTypeAny:()=>ud.Vv,RichTypeBoolean:()=>ud.RI,RichTypeColor3:()=>ud.Nf,RichTypeColor4:()=>ud.Gx,RichTypeFlowGraphInteger:()=>ud.x2,RichTypeMatrix:()=>ud.Sp,RichTypeMatrix2D:()=>ud.cZ,RichTypeMatrix3D:()=>ud.F4,RichTypeNumber:()=>ud.Es,RichTypeQuaternion:()=>ud.P_,RichTypeString:()=>ud.KV,RichTypeVector2:()=>ud.K$,RichTypeVector3:()=>ud.Dx,RichTypeVector4:()=>ud.Ko,RollingAverage:()=>Gh.K,Rotate2dBlock:()=>Yx,RotationGizmo:()=>O_,RotationXBlock:()=>AA,RotationYBlock:()=>IA,RotationZBlock:()=>OA,RuntimeAnimation:()=>z.x,RuntimeError:()=>ue.bu,SSAO2RenderingPipeline:()=>Ow,SSAORenderingPipeline:()=>Nw,SSRRenderingPipeline:()=>kw,SamplerBindingType:()=>su,Scalar:()=>fa,ScaleBlock:()=>ux,ScaleGizmo:()=>N_,ScalingBlock:()=>MA,ScalingMatrixToRef:()=>uC.fg,ScanData:()=>HS.u,Scene:()=>Vt.Z,SceneComponentConstants:()=>Ue.v,SceneDepthBlock:()=>DE,SceneInstrumentation:()=>Ay,SceneLoader:()=>ov,SceneLoaderAnimationGroupLoadingMode:()=>yg,SceneLoaderFlags:()=>ve,SceneOptimization:()=>fO,SceneOptimizer:()=>PO,SceneOptimizerOptions:()=>xO,ScenePerformancePriority:()=>Vt.F,SceneRecorder:()=>yD,SceneSerializer:()=>OO,ScreenSizeBlock:()=>wv,ScreenSpaceBlock:()=>rE,ScreenSpaceCurvaturePostProcess:()=>oB,ScreenSpaceReflectionPostProcess:()=>ww,ScreenshotTools:()=>qO,SerializationHelper:()=>Te.p,SetBasisTranscoderWorker:()=>aO.af,SetColorsBlock:()=>aA,SetCorsBehavior:()=>Cg.M1,SetMaterialIDBlock:()=>EA,SetNormalsBlock:()=>iA,SetParentAction:()=>O,SetPositionsBlock:()=>rA,SetStateAction:()=>T,SetTangentsBlock:()=>lA,SetToDefaultGaussianSplatting:()=>DT,SetToDefaultSFE:()=>NT,SetUVsBlock:()=>oA,SetValueAction:()=>E,SetupSpriteSheetBlock:()=>_F,SfeModeDefine:()=>Bv,ShaderCodeInliner:()=>vc,ShaderLanguage:()=>bS,ShaderMaterial:()=>Ea,ShaderStage:()=>ou,ShaderStore:()=>Bi.l,ShadowDepthWrapper:()=>bT,ShadowGenerator:()=>c_.o,ShadowGeneratorSceneComponent:()=>ib,ShadowLight:()=>V_.p,ShadowMapBlock:()=>sE,ShadowsOptimization:()=>gO,ShapeBuilder:()=>Qs,ShapeCastResult:()=>HL,SharpenPostProcess:()=>bw,SheenBlock:()=>Kx,SimplexPerlin3DBlock:()=>Wx,SimplicationQueueSceneComponent:()=>qC,SimplificationQueue:()=>zC,SimplificationSettings:()=>kC,SimplificationType:()=>UC,SineEase:()=>k.kc,SixDofDragBehavior:()=>ar,Size:()=>Du.or,Skeleton:()=>bn,SkeletonViewer:()=>Nl,SliderConstraint:()=>hL,SmartArray:()=>co.L,SmartArrayNoDuplicate:()=>co.b,SmartFilterFragmentOutputBlock:()=>Vv,SmartFilterTextureBlock:()=>OT,SmoothStep:()=>lr.SmoothStep,SmoothStepBlock:()=>Nx,SnapshotRenderingHelper:()=>BD,SolidParticle:()=>pN,SolidParticleSystem:()=>gN,SolidParticleVertex:()=>_N,Sound:()=>wt,SoundState:()=>Kt,SoundTrack:()=>Bt,SourceTextureFormat:()=>oT.Ok,Space:()=>Du.$x,SpatialAudioAttachmentType:()=>Zt,SpecularPowerToRoughness:()=>Cy,SphereBlock:()=>KR,SphereBuilder:()=>is,SphereDirectedParticleEmitter:()=>eD,SphereParticleEmitter:()=>$M,SphereShapeBlock:()=>YN,Spherical:()=>sC,SphericalHarmonics:()=>Uh.O,SphericalPolynomial:()=>Uh.Q,SplatReaderBlock:()=>AT,SpotLight:()=>U_,SpringConstraint:()=>fL,Sprite:()=>Vb,SpriteManager:()=>zb,SpriteMap:()=>qG,SpriteMapFrameRotationDirection:()=>HG,SpritePackedManager:()=>KG,SpriteSceneComponent:()=>Ub,Stage:()=>Ue.B,StandardMaterial:()=>Bo,StandardMaterialDefines:()=>wo,StandardRenderingPipeline:()=>Vw,StartsWith:()=>vn.UH,StateCondition:()=>v,StaticSound:()=>rn.k,StaticSoundBuffer:()=>on.C,StencilOperation:()=>yu,StencilState:()=>ek.K,StencilStateComposer:()=>hh.u,StepBlock:()=>Sx,StereoscopicArcRotateCamera:()=>zi,StereoscopicFreeCamera:()=>Wi,StereoscopicGamepadCamera:()=>Hi,StereoscopicInterlacePostProcess:()=>Gi,StereoscopicInterlacePostProcessI:()=>Ui,StereoscopicScreenUniversalCamera:()=>Xi,StereoscopicUniversalCamera:()=>Yi,StickValues:()=>xr,StopAnimationAction:()=>C,StopSoundAction:()=>L,StorageBuffer:()=>gr.K,StorageReadBlock:()=>SP,StorageTextureAccess:()=>cu,StorageWriteBlock:()=>TP,StoreOp:()=>Cu,StreamingSound:()=>an.G,StringDictionary:()=>qr.w,StringTools:()=>vn.nQ,SubEmitter:()=>qM,SubEmitterType:()=>XM,SubMesh:()=>me,SubSurfaceBlock:()=>tP,SubSurfaceSceneComponent:()=>DV,Subdivide:()=>wR,SubdivideBlock:()=>EI,SubtractBlock:()=>bx,SurfaceMagnetismBehavior:()=>sr,SwitchBooleanAction:()=>S,SwitchInput:()=>Xl.dR,SystemBlock:()=>FN,TAARenderingPipeline:()=>Ww,TBNBlock:()=>QT,TGATools:()=>LO.uT,Tags:()=>Q.Y,TargetCamera:()=>ti,TargetedAnimation:()=>H.H,TeleportInBlock:()=>jA,TeleportOutBlock:()=>qA,TestBase64DataUrl:()=>Cg.ZP,TextFileAssetTask:()=>JI,Texture:()=>_n.g,TextureAspect:()=>$c,TextureAssetTask:()=>tO,TextureBlock:()=>IE,TextureDimension:()=>Zc,TextureFormat:()=>eu,TextureOptimization:()=>mO,TexturePacker:()=>qS,TexturePackerFrame:()=>jS,TextureSampleType:()=>lu,TextureSampler:()=>nT.u,TextureTools:()=>Sn.LO,TextureUsage:()=>Qc,TextureViewDimension:()=>Jc,ThinAnaglyphPostProcess:()=>Ii,ThinBlackAndWhitePostProcess:()=>Mf,ThinBloomEffect:()=>Bf,ThinBlurPostProcess:()=>_f.q,ThinChromaticAberrationPostProcess:()=>zf,ThinCircleOfConfusionPostProcess:()=>Yf,ThinColorCorrectionPostProcess:()=>qf,ThinConvolutionPostProcess:()=>Qf,ThinDepthOfFieldEffect:()=>om,ThinDepthOfFieldEffectBlurLevel:()=>em,ThinEffectLayer:()=>mf,ThinEngine:()=>Uo.ThinEngine,ThinExtractHighlightsPostProcess:()=>wf,ThinFXAAPostProcess:()=>dm,ThinFilterPostProcess:()=>cm,ThinGlowBlurPostProcess:()=>ff,ThinGlowLayer:()=>gf,ThinGrainPostProcess:()=>mm,ThinHighlightLayer:()=>Pf,ThinImageProcessingPostProcess:()=>vm,ThinMatrix:()=>cC,ThinMotionBlurPostProcess:()=>Sm,ThinPassCubePostProcess:()=>xf.V,ThinPassPostProcess:()=>xf.m,ThinRenderTargetTexture:()=>iT,ThinScreenSpaceCurvaturePostProcess:()=>Mm,ThinSharpenPostProcess:()=>Am,ThinTexture:()=>rT.D,ThinTonemapPostProcess:()=>a_,TiledBoxBuilder:()=>Rs,TiledPlaneBuilder:()=>Ts,TimerState:()=>vy.R$,TmpColors:()=>Du.IG,TmpVectors:()=>Du.AA,ToGammaSpace:()=>Du.rv,ToHalfFloat:()=>Sn.LZ,ToHex:()=>lr.ToHex,ToLinearSpace:()=>Du.tk,TonemapPostProcess:()=>$w,TonemappingOperator:()=>t_,Tools:()=>Z.S0,TorusBlock:()=>QR,TorusBuilder:()=>la,TorusKnotBuilder:()=>Os,TouchCamera:()=>ri,TrailMesh:()=>GC,Trajectory:()=>SD,TrajectoryClassifier:()=>PD,TranscodeAsync:()=>aO.yk,TranscodeTarget:()=>oT.Xl,TransformBlock:()=>Uv,TransformFeedbackBoundingHelper:()=>Na.TransformFeedbackBoundingHelper,TransformNode:()=>Ee,TranslationBlock:()=>NA,TranslationMatrixToRef:()=>uC.Tf,TriPlanarBlock:()=>hP,TrigonometryBlock:()=>ey,TrigonometryBlockOperations:()=>Qv,TubeBuilder:()=>tl,TwirlBlock:()=>iE,UVDefinesMixin:()=>No,UncompressPIZ:()=>US.tg,UncompressPXR:()=>US._k,UncompressRAW:()=>US.S4,UncompressRLE:()=>US.r,UncompressZIP:()=>US.VE,UniformBuffer:()=>Pe.D,UniversalCamera:()=>Ei,UnregisterAllMaterialPlugins:()=>Co,UnregisterMaterialPlugin:()=>Po,UpdateAgeBlock:()=>aF,UpdateAngleBlock:()=>oF,UpdateAttractorBlock:()=>pF,UpdateColorBlock:()=>rF,UpdateDirectionBlock:()=>nF,UpdateFlowMapBlock:()=>cF,UpdatePositionBlock:()=>VN,UpdateScaleBlock:()=>iF,UpdateSpriteCellIndexBlock:()=>lF,UploadContent:()=>LO.FA,UploadEnvLevelsAsync:()=>uc.o5,UploadEnvSpherical:()=>uc.ow,UploadIrradianceLevelsAsync:()=>uc.p$,UploadRadianceLevelsAsync:()=>uc.UA,UtilityLayerRenderer:()=>Ya,VRCameraMetrics:()=>qi,VRDeviceOrientationArcRotateCamera:()=>oo,VRDeviceOrientationFreeCamera:()=>ao,VRDeviceOrientationGamepadCamera:()=>so,VRDistortionCorrectionPostProcess:()=>Ki,VRExperienceHelper:()=>ha,VRMultiviewToSingleviewPostProcess:()=>ro,ValidatedNativeDataStream:()=>kc,ValueCondition:()=>_,Vector2:()=>Du.I9,Vector2ToFixed:()=>lC.Ve,Vector3:()=>Du.Pq,Vector3Dot:()=>lC.G$,Vector3FromFloatsToRef:()=>lC.Wl,Vector3ScaleToRef:()=>lC.F5,Vector3ToFixed:()=>lC.kf,Vector4:()=>Du.IU,Vector4ToFixed:()=>lC.xl,VectorConverterBlock:()=>SA,VectorMergerBlock:()=>Yv,VectorSplitterBlock:()=>gx,VertexAnimationBaker:()=>Tn,VertexBuffer:()=>se.R,VertexData:()=>ge,VertexDataMaterialInfo:()=>_e,VertexFormat:()=>Su,VertexOutputBlock:()=>Gv,VertexStepMode:()=>Tu,VideoDome:()=>Py,VideoRecorder:()=>wO,VideoTexture:()=>xy,ViewDirectionBlock:()=>Ex,Viewport:()=>Du.LM,VirtualJoystick:()=>Kr,VirtualJoysticksCamera:()=>ji,VolumetricLightScatteringPostProcess:()=>iB,VoronoiNoiseBlock:()=>cP,Wav2Decode:()=>GS.tb,WaveBlock:()=>Vx,WaveBlockKind:()=>wx,WebGL2ParticleSystem:()=>nN,WebGL2ShaderProcessor:()=>td.B,WebGLDataBuffer:()=>gR.A,WebGLHardwareTexture:()=>zo.d,WebGLPipelineContext:()=>ed.x,WebGPUCacheBindGroups:()=>bh,WebGPUCacheRenderPipeline:()=>lh,WebGPUCacheRenderPipelineTree:()=>uh,WebGPUCacheSampler:()=>rh,WebGPUDataBuffer:()=>Qu,WebGPUDrawContext:()=>gh,WebGPUEngine:()=>Zh,WebGPUPipelineContext:()=>wu,WebGPURenderTargetWrapper:()=>Yh,WebGPUShaderProcessor:()=>Lu,WebGPUTintWASM:()=>wh,WebRequest:()=>Sa.u,WebXRAbstractFeature:()=>gv,WebXRAbstractMotionController:()=>av,WebXRAnchorSystem:()=>rk,WebXRBackgroundRemover:()=>ak,WebXRCamera:()=>Eg,WebXRControllerComponent:()=>Pg,WebXRControllerMovement:()=>_k,WebXRControllerPhysics:()=>lk,WebXRControllerPointerSelection:()=>vv,WebXRDefaultExperience:()=>Sy,WebXRDefaultExperienceOptions:()=>by,WebXRDepthSensing:()=>Wk,WebXRDomOverlay:()=>mk,WebXREnterExitUI:()=>py,WebXREnterExitUIButton:()=>hy,WebXREnterExitUIOptions:()=>dy,WebXRExperienceHelper:()=>xg,WebXREyeTracking:()=>vk,WebXRFeatureName:()=>ur,WebXRFeaturePointSystem:()=>uk,WebXRFeaturesManager:()=>hr,WebXRGenericHandController:()=>Zk,WebXRGenericTriggerMotionController:()=>sv,WebXRHTCViveMotionController:()=>iz,WebXRHand:()=>_y,WebXRHandJoint:()=>uy,WebXRHandTracking:()=>gy,WebXRHitTest:()=>ck,WebXRHitTestLegacy:()=>tk,WebXRImageTracking:()=>fk,WebXRInput:()=>_v,WebXRInputSource:()=>mv,WebXRLayerRenderTargetTextureProvider:()=>Wo,WebXRLayers:()=>Ok,WebXRLightEstimation:()=>gk,WebXRManagedOutputCanvas:()=>jo,WebXRManagedOutputCanvasOptions:()=>Xo,WebXRMeshDetector:()=>pk,WebXRMicrosoftMixedRealityController:()=>Jk,WebXRMotionControllerManager:()=>hv,WebXRMotionControllerTeleportation:()=>yy,WebXRNearControllerMode:()=>ny,WebXRNearInteraction:()=>sy,WebXROculusHandController:()=>nz,WebXROculusTouchMotionController:()=>ez,WebXRPlaneDetector:()=>ok,WebXRProfiledMotionController:()=>cv,WebXRRawCameraAccess:()=>Kk,WebXRSessionManager:()=>Qo,WebXRSpaceWarp:()=>qk,WebXRSpaceWarpRenderTargetTextureProvider:()=>jk,WebXRState:()=>XG,WebXRTrackingState:()=>jG,WebXRWalkingLocomotion:()=>Ek,WeightedSound:()=>Qt,WhenTextureReadyAsync:()=>Sn.v9,WithinEpsilon:()=>lr.WithinEpsilon,WorkerPool:()=>mC.T,WorleyNoise3DBlock:()=>zx,XRSpaceWarpRenderTarget:()=>Xk,Xbox360Button:()=>fi,Xbox360Dpad:()=>mi,Xbox360Pad:()=>yi,XboxInput:()=>Xl.sZ,_AudioAnalyzerDefaults:()=>sn.IR,_BabylonLoaderRegistered:()=>Wb,_BasisTextureLoader:()=>BS._BasisTextureLoader,_CommonDispose:()=>kh.kX,_CommonInit:()=>kh.BG,_CreationDataStorage:()=>ke,_DDSTextureLoader:()=>bg._DDSTextureLoader,_ENVTextureLoader:()=>Sg._ENVTextureLoader,_ExrTextureLoader:()=>DS._ExrTextureLoader,_GetAudioEngine:()=>ot,_GetCompatibleTextureLoader:()=>Nc.gT,_HDRTextureLoader:()=>wS._HDRTextureLoader,_HasAudioAnalyzerOptions:()=>sn.GA,_HasSpatialAudioListenerOptions:()=>ft,_HasSpatialAudioOptions:()=>ln.GB,_HasStereoAudioOptions:()=>cn.uD,_IESTextureLoader:()=>VS._IESTextureLoader,_InstancesBatch:()=>He,_KTXTextureLoader:()=>Tg._KTXTextureLoader,_LoadScriptModuleAsync:()=>yR,_MeshCollisionData:()=>Ce,_OcclusionDataStorage:()=>ec,_PrimaryIsoTriangle:()=>vl,_SetStereoscopicAnaglyphRigMode:()=>Mi,_SetStereoscopicRigMode:()=>ki,_SetVrRigMode:()=>io,_SpatialAudioDefaults:()=>ln.Qc,_SpatialAudioListenerDefaults:()=>pt,_StaticOffsetValueColor3:()=>w.wF,_StaticOffsetValueColor4:()=>w.pO,_StaticOffsetValueQuaternion:()=>w.ov,_StaticOffsetValueSize:()=>w.bn,_StaticOffsetValueVector2:()=>w.fY,_StaticOffsetValueVector3:()=>w.mA,_StereoAudioDefaults:()=>cn.uJ,_TGATextureLoader:()=>LS._TGATextureLoader,_TimeToken:()=>ic,_UpdateRGBDAsync:()=>uc.gW,_WebAudioBus:()=>un._WebAudioBus,_WebAudioEngine:()=>Nt,_WebAudioMainBus:()=>hn._WebAudioMainBus,_WebAudioSoundSource:()=>dn._WebAudioSoundSource,_WebAudioStaticSound:()=>pn._WebAudioStaticSound,_WebAudioStaticSoundBuffer:()=>pn._WebAudioStaticSoundBuffer,_WebAudioStreamingSound:()=>fn._WebAudioStreamingSound,_forceSceneHelpersToBundle:()=>Ty,_forceTransformFeedbackToBundle:()=>oc,_injectLTSFileTools:()=>Cg.rh,addAccessorsForMaterialProperty:()=>ce.ru,addToBlockFactory:()=>gd,allocateAndCopyTypedBuffer:()=>sc.k,anaglyphPixelShader:()=>VB.anaglyphPixelShader,anaglyphPixelShaderWGSL:()=>UB.anaglyphPixelShaderWGSL,appendSceneAsync:()=>Kg,backbufferColorTextureHandle:()=>Ll.O,backbufferDepthStencilTextureHandle:()=>Ll.m,backgroundPixelShader:()=>iS.backgroundPixelShader,backgroundPixelShaderWGSL:()=>nS.backgroundPixelShaderWGSL,backgroundVertexShader:()=>rS.backgroundVertexShader,backgroundVertexShaderWGSL:()=>tS.backgroundVertexShaderWGSL,bilateralBlurPixelShader:()=>TU.bilateralBlurPixelShader,bilateralBlurPixelShaderWGSL:()=>CU.bilateralBlurPixelShaderWGSL,bilateralBlurQualityPixelShader:()=>EU.bilateralBlurQualityPixelShader,bilateralBlurQualityPixelShaderWGSL:()=>RU.bilateralBlurQualityPixelShaderWGSL,blackAndWhitePixelShader:()=>wB.blackAndWhitePixelShader,blackAndWhitePixelShaderWGSL:()=>BB.blackAndWhitePixelShaderWGSL,blockFactory:()=>vd,bloomMergePixelShader:()=>AB.bloomMergePixelShader,bloomMergePixelShaderWGSL:()=>IB.bloomMergePixelShaderWGSL,bonesDeclaration:()=>GT.bonesDeclaration,bonesDeclarationWGSL:()=>VT.bonesDeclarationWGSL,bonesVertex:()=>kT.bonesVertex,bonesVertexWGSL:()=>UT.bonesVertexWGSL,boundingBoxRendererPixelShader:()=>LU.boundingBoxRendererPixelShader,boundingBoxRendererPixelShaderWGSL:()=>BU.boundingBoxRendererPixelShaderWGSL,boundingBoxRendererVertexShader:()=>wU.boundingBoxRendererVertexShader,boundingBoxRendererVertexShaderWGSL:()=>VU.boundingBoxRendererVertexShaderWGSL,bumpFragment:()=>vE.bumpFragment,bumpFragmentFunctions:()=>bE.bumpFragmentFunctions,bumpFragmentFunctionsWGSL:()=>gE.bumpFragmentFunctionsWGSL,bumpFragmentMainFunctions:()=>yE.bumpFragmentMainFunctions,bumpFragmentMainFunctionsWGSL:()=>_E.bumpFragmentMainFunctionsWGSL,bumpFragmentWGSL:()=>mE.bumpFragmentWGSL,captureEquirectangularFromScene:()=>UD,chromaticAberrationPixelShader:()=>Pw.chromaticAberrationPixelShader,chromaticAberrationPixelShaderWGSL:()=>EB.chromaticAberrationPixelShaderWGSL,circleOfConfusionPixelShader:()=>CB.circleOfConfusionPixelShader,circleOfConfusionPixelShaderWGSL:()=>RB.circleOfConfusionPixelShaderWGSL,className:()=>Z.s7,clipPlaneFragment:()=>UE.clipPlaneFragment,clipPlaneFragmentDeclaration:()=>GE.clipPlaneFragmentDeclaration,clipPlaneFragmentDeclarationWGSL:()=>wE.clipPlaneFragmentDeclarationWGSL,clipPlaneFragmentWGSL:()=>LE.clipPlaneFragmentWGSL,clipPlaneVertex:()=>kE.clipPlaneVertex,clipPlaneVertexDeclaration:()=>zE.clipPlaneVertexDeclaration,clipPlaneVertexDeclarationWGSL:()=>VE.clipPlaneVertexDeclarationWGSL,clipPlaneVertexWGSL:()=>BE.clipPlaneVertexWGSL,colorCorrectionPixelShader:()=>zB.colorCorrectionPixelShader,colorCorrectionPixelShaderWGSL:()=>WB.colorCorrectionPixelShaderWGSL,colorPixelShader:()=>lS.colorPixelShader,colorPixelShaderWGSL:()=>DI.colorPixelShaderWGSL,colorVertexShader:()=>cS.colorVertexShader,colorVertexShaderWGSL:()=>NI.colorVertexShaderWGSL,computeMaxExtents:()=>ZC,convolutionPixelShader:()=>GB.convolutionPixelShader,convolutionPixelShaderWGSL:()=>kB.convolutionPixelShaderWGSL,copyTexture3DLayerToTexturePixelShader:()=>jU.copyTexture3DLayerToTexturePixelShader,copyTexture3DLayerToTexturePixelShaderWGSL:()=>qU.copyTexture3DLayerToTexturePixelShaderWGSL,copyTextureToTexturePixelShader:()=>qD.copyTextureToTexturePixelShader,copyTextureToTexturePixelShaderWGSL:()=>KD.copyTextureToTexturePixelShaderWGSL,createDetailMapPlugin:()=>VP,createPBRAnisotropicPlugin:()=>DP,createPBRBRDFPlugin:()=>NP,createPBRClearCoatPlugin:()=>FP,createPBRIridescencePlugin:()=>LP,createPBRSheenPlugin:()=>wP,createPBRSubSurfacePlugin:()=>BP,createYieldingScheduler:()=>$,deepMerge:()=>AC,defaultPixelShader:()=>JP.defaultPixelShader,defaultPixelShaderWGSL:()=>eC.defaultPixelShaderWGSL,defaultVertexShader:()=>$P.defaultVertexShader,defaultVertexShaderWGSL:()=>tC.defaultVertexShaderWGSL,depthBoxBlurPixelShader:()=>hb.depthBoxBlurPixelShader,depthBoxBlurPixelShaderWGSL:()=>sb.depthBoxBlurPixelShaderWGSL,depthOfFieldMergePixelShader:()=>xB.depthOfFieldMergePixelShader,depthOfFieldMergePixelShaderWGSL:()=>PB.depthOfFieldMergePixelShaderWGSL,depthPixelShader:()=>OU.depthPixelShader,depthPixelShaderWGSL:()=>MU.depthPixelShaderWGSL,depthVertexShader:()=>eB.depthVertexShader,depthVertexShaderWGSL:()=>DU.depthVertexShaderWGSL,displayPassPixelShader:()=>ZB.displayPassPixelShader,displayPassPixelShaderWGSL:()=>QB.displayPassPixelShaderWGSL,editableInPropertyPage:()=>Jp,expandToProperty:()=>ce.$z,extractHighlightsPixelShader:()=>OB.extractHighlightsPixelShader,extractHighlightsPixelShaderWGSL:()=>MB.extractHighlightsPixelShaderWGSL,extractMinAndMax:()=>pe.b8,extractMinAndMaxIndexed:()=>pe.cD,filterPixelShader:()=>XB.filterPixelShader,filterPixelShaderWGSL:()=>jB.filterPixelShaderWGSL,fluidRenderingBilateralBlurPixelShader:()=>tU.fluidRenderingBilateralBlurPixelShader,fluidRenderingBilateralBlurPixelShaderWGSL:()=>dU.fluidRenderingBilateralBlurPixelShaderWGSL,fluidRenderingParticleDepthPixelShader:()=>qV.fluidRenderingParticleDepthPixelShader,fluidRenderingParticleDepthPixelShaderWGSL:()=>oU.fluidRenderingParticleDepthPixelShaderWGSL,fluidRenderingParticleDepthVertexShader:()=>jV.fluidRenderingParticleDepthVertexShader,fluidRenderingParticleDepthVertexShaderWGSL:()=>iU.fluidRenderingParticleDepthVertexShaderWGSL,fluidRenderingParticleDiffusePixelShader:()=>eU.fluidRenderingParticleDiffusePixelShader,fluidRenderingParticleDiffusePixelShaderWGSL:()=>hU.fluidRenderingParticleDiffusePixelShaderWGSL,fluidRenderingParticleDiffuseVertexShader:()=>$V,fluidRenderingParticleDiffuseVertexShaderWGSL:()=>uU,fluidRenderingParticleThicknessPixelShader:()=>ZV.fluidRenderingParticleThicknessPixelShader,fluidRenderingParticleThicknessPixelShaderWGSL:()=>sU.fluidRenderingParticleThicknessPixelShaderWGSL,fluidRenderingParticleThicknessVertexShader:()=>KV.fluidRenderingParticleThicknessVertexShader,fluidRenderingParticleThicknessVertexShaderWGSL:()=>aU.fluidRenderingParticleThicknessVertexShaderWGSL,fluidRenderingRenderPixelShader:()=>rU.fluidRenderingRenderPixelShader,fluidRenderingRenderPixelShaderWGSL:()=>fU.fluidRenderingRenderPixelShaderWGSL,fluidRenderingStandardBlurPixelShader:()=>nU.fluidRenderingStandardBlurPixelShader,fluidRenderingStandardBlurPixelShaderWGSL:()=>pU.fluidRenderingStandardBlurPixelShaderWGSL,fogFragmentDeclaration:()=>HE.fogFragmentDeclaration,fogFragmentDeclarationWGSL:()=>WE.fogFragmentDeclarationWGSL,fxaaPixelShader:()=>DB.fxaaPixelShader,fxaaPixelShaderWGSL:()=>FB.fxaaPixelShaderWGSL,fxaaVertexShader:()=>NB.fxaaVertexShader,fxaaVertexShaderWGSL:()=>LB.fxaaVertexShaderWGSL,gaussianSplattingVertexDeclaration:()=>TT.Q,gaussianSplattingVertexDeclarationWGSL:()=>CP,geometryPixelShader:()=>cw.geometryPixelShader,geometryPixelShaderWGSL:()=>NU.geometryPixelShaderWGSL,geometryVertexShader:()=>uw.geometryVertexShader,geometryVertexShaderWGSL:()=>FU.geometryVertexShaderWGSL,getAnimationTypeByFlowGraphType:()=>ud.U_,getDimensionsFromTextureSize:()=>Xp.o,getRichTypeByAnimationType:()=>ud.aZ,getRichTypeByFlowGraphType:()=>ud.Yd,getRichTypeFromValue:()=>ud.k4,glowBlurPostProcessPixelShader:()=>zy.glowBlurPostProcessPixelShader,glowBlurPostProcessPixelShaderWGSL:()=>Yy.glowBlurPostProcessPixelShaderWGSL,glowMapGenerationPixelShader:()=>wy.glowMapGenerationPixelShader,glowMapGenerationPixelShaderWGSL:()=>Vy.glowMapGenerationPixelShaderWGSL,glowMapGenerationVertexShader:()=>By.glowMapGenerationVertexShader,glowMapGenerationVertexShaderWGSL:()=>Uy.glowMapGenerationVertexShaderWGSL,glowMapMergePixelShader:()=>Gy.glowMapMergePixelShader,glowMapMergePixelShaderWGSL:()=>Wy.glowMapMergePixelShaderWGSL,glowMapMergeVertexShader:()=>ky.glowMapMergeVertexShader,glowMapMergeVertexShaderWGSL:()=>Hy.glowMapMergeVertexShaderWGSL,grainPixelShader:()=>SB.grainPixelShader,grainPixelShaderWGSL:()=>TB.grainPixelShaderWGSL,greasedLinePixelShader:()=>nC.greasedLinePixelShader,greasedLinePixelShaderWGSL:()=>iC.greasedLinePixelShaderWGSL,greasedLineVertexShader:()=>rC.greasedLineVertexShader,greasedLineVertexShaderWGSL:()=>oC.greasedLineVertexShaderWGSL,hdrFilteringPixelShader:()=>cT.hdrFilteringPixelShader,hdrFilteringPixelShaderWGSL:()=>hT.hdrFilteringPixelShaderWGSL,hdrFilteringVertexShader:()=>lT.hdrFilteringVertexShader,hdrFilteringVertexShaderWGSL:()=>uT.hdrFilteringVertexShaderWGSL,hdrIrradianceFilteringPixelShader:()=>pT.hdrIrradianceFilteringPixelShader,hdrIrradianceFilteringPixelShaderWGSL:()=>mT.hdrIrradianceFilteringPixelShaderWGSL,hdrIrradianceFilteringVertexShader:()=>dT.hdrIrradianceFilteringVertexShader,hdrIrradianceFilteringVertexShaderWGSL:()=>fT.hdrIrradianceFilteringVertexShaderWGSL,helperFunctions:()=>dE.helperFunctions,helperFunctionsWGSL:()=>Gu.helperFunctionsWGSL,highlightsPixelShader:()=>qB.highlightsPixelShader,highlightsPixelShaderWGSL:()=>KB.highlightsPixelShaderWGSL,iblCdfDebugPixelShader:()=>TG.iblCdfDebugPixelShader,iblCdfDebugPixelShaderWGSL:()=>SG.iblCdfDebugPixelShaderWGSL,iblCdfxPixelShader:()=>_G.iblCdfxPixelShader,iblCdfxPixelShaderWGSL:()=>mG.iblCdfxPixelShaderWGSL,iblCdfyPixelShader:()=>vG.iblCdfyPixelShader,iblCdfyPixelShaderWGSL:()=>gG.iblCdfyPixelShaderWGSL,iblCombineVoxelGridsPixelShader:()=>uG.iblCombineVoxelGridsPixelShader,iblCombineVoxelGridsPixelShaderWGSL:()=>cG.iblCombineVoxelGridsPixelShaderWGSL,iblDominantDirectionPixelShader:()=>CG.iblDominantDirectionPixelShader,iblDominantDirectionPixelShaderWGSL:()=>PG.iblDominantDirectionPixelShaderWGSL,iblGenerateVoxelMipPixelShader:()=>hG.iblGenerateVoxelMipPixelShader,iblGenerateVoxelMipPixelShaderWGSL:()=>dG.iblGenerateVoxelMipPixelShaderWGSL,iblIcdfPixelShader:()=>bG.iblIcdfPixelShader,iblIcdfPixelShaderWGSL:()=>yG.iblIcdfPixelShaderWGSL,iblScaledLuminancePixelShader:()=>xG.iblScaledLuminancePixelShader,iblScaledLuminancePixelShaderWGSL:()=>EG.iblScaledLuminancePixelShaderWGSL,iblShadowAccumulationPixelShader:()=>nG.iblShadowAccumulationPixelShader,iblShadowAccumulationPixelShaderWGSL:()=>tG.iblShadowAccumulationPixelShaderWGSL,iblShadowDebugPixelShader:()=>QU.iblShadowDebugPixelShader,iblShadowDebugPixelShaderWGSL:()=>JU.iblShadowDebugPixelShaderWGSL,iblShadowGBufferDebugPixelShader:()=>pG.iblShadowGBufferDebugPixelShader,iblShadowGBufferDebugPixelShaderWGSL:()=>fG.iblShadowGBufferDebugPixelShaderWGSL,iblShadowSpatialBlurPixelShader:()=>eG.iblShadowSpatialBlurPixelShader,iblShadowSpatialBlurPixelShaderWGSL:()=>$U.iblShadowSpatialBlurPixelShaderWGSL,iblShadowVoxelTracingPixelShader:()=>KU.iblShadowVoxelTracingPixelShader,iblShadowVoxelTracingPixelShaderWGSL:()=>ZU.iblShadowVoxelTracingPixelShaderWGSL,iblShadowsCombinePixelShader:()=>oG,iblShadowsCombinePixelShaderWGSL:()=>lG,iblVoxelGrid2dArrayDebugPixelShader:()=>RG.iblVoxelGrid2dArrayDebugPixelShader,iblVoxelGrid2dArrayDebugPixelShaderWGSL:()=>AG.iblVoxelGrid2dArrayDebugPixelShaderWGSL,iblVoxelGrid3dDebugPixelShader:()=>NG.iblVoxelGrid3dDebugPixelShader,iblVoxelGrid3dDebugPixelShaderWGSL:()=>FG.iblVoxelGrid3dDebugPixelShaderWGSL,iblVoxelGridPixelShader:()=>IG.iblVoxelGridPixelShader,iblVoxelGridPixelShaderWGSL:()=>MG.iblVoxelGridPixelShaderWGSL,iblVoxelGridVertexShader:()=>OG.iblVoxelGridVertexShader,iblVoxelGridVertexShaderWGSL:()=>DG.iblVoxelGridVertexShaderWGSL,iblVoxelSlabDebugPixelShader:()=>wG.iblVoxelSlabDebugPixelShader,iblVoxelSlabDebugPixelShaderWGSL:()=>VG.iblVoxelSlabDebugPixelShaderWGSL,iblVoxelSlabDebugVertexShader:()=>LG.iblVoxelSlabDebugVertexShader,iblVoxelSlabDebugVertexShaderWGSL:()=>BG.iblVoxelSlabDebugVertexShaderWGSL,imageProcessingDeclaration:()=>pE.imageProcessingDeclaration,imageProcessingDeclarationWGSL:()=>uE.imageProcessingDeclarationWGSL,imageProcessingFunctions:()=>fE.imageProcessingFunctions,imageProcessingFunctionsWGSL:()=>hE.imageProcessingFunctionsWGSL,imageProcessingPixelShader:()=>yB.imageProcessingPixelShader,imageProcessingPixelShaderWGSL:()=>vB.imageProcessingPixelShaderWGSL,importAnimationsAsync:()=>rv,inlineScheduler:()=>J,kernelBlurPixelShader:()=>lB.kernelBlurPixelShader,kernelBlurPixelShaderWGSL:()=>uB.kernelBlurPixelShaderWGSL,kernelBlurVertexShader:()=>cB.kernelBlurVertexShader,kernelBlurVertexShaderWGSL:()=>hB.kernelBlurVertexShaderWGSL,layerPixelShader:()=>Xy.layerPixelShader,layerPixelShaderWGSL:()=>qy.layerPixelShaderWGSL,layerVertexShader:()=>jy.layerVertexShader,layerVertexShaderWGSL:()=>Ky.layerVertexShaderWGSL,lensFlarePixelShader:()=>$y.lensFlarePixelShader,lensFlarePixelShaderWGSL:()=>tb.lensFlarePixelShaderWGSL,lensFlareVertexShader:()=>eb.lensFlareVertexShader,lensFlareVertexShaderWGSL:()=>nb.lensFlareVertexShaderWGSL,lightFragment:()=>JE.lightFragment,lightFragmentDeclaration:()=>QE.lightFragmentDeclaration,lightFragmentWGSL:()=>YE.lightFragmentWGSL,lightUboDeclaration:()=>$E.lightUboDeclaration,lightUboDeclarationWGSL:()=>XE.lightUboDeclarationWGSL,lightVxFragmentDeclaration:()=>tx.lightVxFragmentDeclaration,lightVxUboDeclaration:()=>ex.lightVxUboDeclaration,lightVxUboDeclarationWGSL:()=>jE.lightVxUboDeclarationWGSL,lightsFragmentFunctions:()=>nx.lightsFragmentFunctions,lightsFragmentFunctionsWGSL:()=>qE.lightsFragmentFunctionsWGSL,linePixelShader:()=>UU.linePixelShader,linePixelShaderWGSL:()=>kU.linePixelShaderWGSL,lineVertexShader:()=>GU.lineVertexShader,lineVertexShaderWGSL:()=>zU.lineVertexShaderWGSL,loadAssetContainerAsync:()=>$g,loadSceneAsync:()=>Yg,lodCubePixelShader:()=>MO.lodCubePixelShader,lodCubePixelShaderWGSL:()=>NO.lodCubePixelShaderWGSL,lodPixelShader:()=>DO.lodPixelShader,lodPixelShaderWGSL:()=>FO.lodPixelShaderWGSL,makeAsyncFunction:()=>ie,makeSyncFunction:()=>re,meshUVSpaceRendererFinaliserPixelShader:()=>VI.meshUVSpaceRendererFinaliserPixelShader,meshUVSpaceRendererFinaliserPixelShaderWGSL:()=>HI.meshUVSpaceRendererFinaliserPixelShaderWGSL,meshUVSpaceRendererFinaliserVertexShader:()=>UI.meshUVSpaceRendererFinaliserVertexShader,meshUVSpaceRendererFinaliserVertexShaderWGSL:()=>YI.meshUVSpaceRendererFinaliserVertexShaderWGSL,meshUVSpaceRendererMaskerPixelShader:()=>BI.meshUVSpaceRendererMaskerPixelShader,meshUVSpaceRendererMaskerPixelShaderWGSL:()=>WI.meshUVSpaceRendererMaskerPixelShaderWGSL,meshUVSpaceRendererMaskerVertexShader:()=>wI.meshUVSpaceRendererMaskerVertexShader,meshUVSpaceRendererMaskerVertexShaderWGSL:()=>zI.meshUVSpaceRendererMaskerVertexShaderWGSL,meshUVSpaceRendererPixelShader:()=>LI.meshUVSpaceRendererPixelShader,meshUVSpaceRendererPixelShaderWGSL:()=>kI.meshUVSpaceRendererPixelShaderWGSL,meshUVSpaceRendererVertexShader:()=>FI.meshUVSpaceRendererVertexShader,meshUVSpaceRendererVertexShaderWGSL:()=>GI.meshUVSpaceRendererVertexShaderWGSL,morphTargetsVertex:()=>XT.morphTargetsVertex,morphTargetsVertexDeclaration:()=>jT.morphTargetsVertexDeclaration,morphTargetsVertexDeclarationWGSL:()=>WT.morphTargetsVertexDeclarationWGSL,morphTargetsVertexGlobal:()=>qT.morphTargetsVertexGlobal,morphTargetsVertexGlobalDeclaration:()=>KT.morphTargetsVertexGlobalDeclaration,morphTargetsVertexGlobalDeclarationWGSL:()=>YT.morphTargetsVertexGlobalDeclarationWGSL,morphTargetsVertexGlobalWGSL:()=>HT.morphTargetsVertexGlobalWGSL,morphTargetsVertexWGSL:()=>zT.morphTargetsVertexWGSL,motionBlurPixelShader:()=>HB.motionBlurPixelShader,motionBlurPixelShaderWGSL:()=>YB.motionBlurPixelShaderWGSL,nativeOverride:()=>ce.Cx,normalizeEnvInfo:()=>uc.RZ,oitBackBlendPixelShader:()=>UG.oitBackBlendPixelShader,oitBackBlendPixelShaderWGSL:()=>kG.oitBackBlendPixelShaderWGSL,oitFinalPixelShader:()=>GG.oitFinalPixelShader,oitFinalPixelShaderWGSL:()=>zG.oitFinalPixelShaderWGSL,openpbrPixelShader:()=>AS.openpbrPixelShader,openpbrPixelShaderWGSL:()=>CS.openpbrPixelShaderWGSL,openpbrVertexShader:()=>RS.openpbrVertexShader,openpbrVertexShaderWGSL:()=>PS.openpbrVertexShaderWGSL,outlinePixelShader:()=>WU.outlinePixelShader,outlinePixelShaderWGSL:()=>YU.outlinePixelShaderWGSL,outlineVertexShader:()=>HU.outlineVertexShader,outlineVertexShaderWGSL:()=>XU.outlineVertexShaderWGSL,packingFunctions:()=>PE.packingFunctions,packingFunctionsWGSL:()=>TE.packingFunctionsWGSL,particlesPixelShader:()=>NF.particlesPixelShader,particlesPixelShaderWGSL:()=>LF.particlesPixelShaderWGSL,particlesVertexShader:()=>FF.particlesVertexShader,particlesVertexShaderWGSL:()=>wF.particlesVertexShaderWGSL,passCubePixelShader:()=>pB.passCubePixelShader,passCubePixelShaderWGSL:()=>mB.passCubePixelShaderWGSL,passPixelShader:()=>dB.passPixelShader,passPixelShaderWGSL:()=>fB.passPixelShaderWGSL,pbrPixelShader:()=>xS.pbrPixelShader,pbrPixelShaderWGSL:()=>TS.pbrPixelShaderWGSL,pbrVertexShader:()=>ES.pbrVertexShader,pbrVertexShaderWGSL:()=>SS.pbrVertexShaderWGSL,pickingPixelShader:()=>Pa.pickingPixelShader,pickingPixelShaderWGSL:()=>Ra.pickingPixelShaderWGSL,pickingVertexShader:()=>Ca.pickingVertexShader,pickingVertexShaderWGSL:()=>Aa.pickingVertexShaderWGSL,postprocessVertexShader:()=>aB.postprocessVertexShader,postprocessVertexShaderWGSL:()=>sB.postprocessVertexShaderWGSL,proceduralVertexShader:()=>sT.proceduralVertexShader,proceduralVertexShaderWGSL:()=>aT.proceduralVertexShaderWGSL,reflectionFunction:()=>ax.reflectionFunction,reflectionFunctionWGSL:()=>ox.reflectionFunctionWGSL,registerSceneLoaderPlugin:()=>Vg,registerTextureLoader:()=>Nc.kf,rgbdDecodePixelShader:()=>HD.rgbdDecodePixelShader,rgbdDecodePixelShaderWGSL:()=>XD.rgbdDecodePixelShaderWGSL,rgbdEncodePixelShader:()=>YD.rgbdEncodePixelShader,rgbdEncodePixelShaderWGSL:()=>jD.rgbdEncodePixelShaderWGSL,rsmFullGlobalIlluminationPixelShader:()=>PU.rsmFullGlobalIlluminationPixelShader,rsmFullGlobalIlluminationPixelShaderWGSL:()=>IU.rsmFullGlobalIlluminationPixelShaderWGSL,rsmGlobalIlluminationPixelShader:()=>xU.rsmGlobalIlluminationPixelShader,rsmGlobalIlluminationPixelShaderWGSL:()=>AU.rsmGlobalIlluminationPixelShaderWGSL,runCoroutine:()=>ee,runCoroutineAsync:()=>ne,runCoroutineSync:()=>te,screenSpaceReflection2BlurCombinerPixelShader:()=>Kw.screenSpaceReflection2BlurCombinerPixelShader,screenSpaceReflection2BlurCombinerPixelShaderWGSL:()=>Jw.screenSpaceReflection2BlurCombinerPixelShaderWGSL,screenSpaceReflection2BlurPixelShader:()=>qw.screenSpaceReflection2BlurPixelShader,screenSpaceReflection2BlurPixelShaderWGSL:()=>Qw.screenSpaceReflection2BlurPixelShaderWGSL,screenSpaceReflection2PixelShader:()=>jw.screenSpaceReflection2PixelShader,screenSpaceReflection2PixelShaderWGSL:()=>Zw.screenSpaceReflection2PixelShaderWGSL,serialize:()=>ce.lK,serializeAsCameraReference:()=>ce.fW,serializeAsColor3:()=>ce.jT,serializeAsColor4:()=>ce.qK,serializeAsColorCurves:()=>ce.wL,serializeAsFresnelParameters:()=>ce.Y9,serializeAsImageProcessingConfiguration:()=>ce.n1,serializeAsMatrix:()=>ce.GG,serializeAsMeshReference:()=>ce.xG,serializeAsQuaternion:()=>ce.bR,serializeAsTexture:()=>ce.uM,serializeAsVector2:()=>ce.WM,serializeAsVector3:()=>ce.P_,setAndStartTimer:()=>vy.fj,setOpenGLOrientationForUV:()=>ye.ge,shadowMapFragment:()=>CE.shadowMapFragment,shadowMapFragmentSoftTransparentShadow:()=>db.shadowMapFragmentSoftTransparentShadow,shadowMapFragmentSoftTransparentShadowWGSL:()=>lb.shadowMapFragmentSoftTransparentShadowWGSL,shadowMapFragmentWGSL:()=>EE.shadowMapFragmentWGSL,shadowMapPixelShader:()=>cb.shadowMapPixelShader,shadowMapPixelShaderWGSL:()=>ob.shadowMapPixelShaderWGSL,shadowMapVertexMetric:()=>xE.shadowMapVertexMetric,shadowMapVertexMetricWGSL:()=>SE.shadowMapVertexMetricWGSL,shadowMapVertexShader:()=>ub.shadowMapVertexShader,shadowMapVertexShaderWGSL:()=>ab.shadowMapVertexShaderWGSL,shadowsFragmentFunctions:()=>rx.shadowsFragmentFunctions,shadowsFragmentFunctionsWGSL:()=>KE.shadowsFragmentFunctionsWGSL,shadowsVertex:()=>ix.shadowsVertex,shadowsVertexWGSL:()=>ZE.shadowsVertexWGSL,sharpenPixelShader:()=>yw.sharpenPixelShader,sharpenPixelShaderWGSL:()=>bB.sharpenPixelShaderWGSL,spritesPixelShader:()=>ZG.spritesPixelShader,spritesPixelShaderWGSL:()=>JG.spritesPixelShaderWGSL,spritesVertexShader:()=>QG.spritesVertexShader,spritesVertexShaderWGSL:()=>$G.spritesVertexShaderWGSL,ssao2PixelShader:()=>Hw.ssao2PixelShader,ssao2PixelShaderWGSL:()=>Yw.ssao2PixelShaderWGSL,ssaoCombinePixelShader:()=>Dw.ssaoCombinePixelShader,ssaoCombinePixelShaderWGSL:()=>Xw.ssaoCombinePixelShaderWGSL,textureSizeIsObject:()=>Xp.e,tonemapPixelShader:()=>JB.tonemapPixelShader,tonemapPixelShaderWGSL:()=>$B.tonemapPixelShaderWGSL,unregisterTextureLoader:()=>Nc.hy,useOpenGLOrientationForUV:()=>ye.rX,vrDistortionCorrectionPixelShader:()=>_B.vrDistortionCorrectionPixelShader,vrDistortionCorrectionPixelShaderWGSL:()=>gB.vrDistortionCorrectionPixelShaderWGSL});var s=n(82966),l=n(66377),c=n(8046),u=n(64726),h=n(34623),d=function(){function e(e,t){this.triggerOptions=e,this.onBeforeExecuteObservable=new l.cP,e.parameter?(this.trigger=e.trigger,this._triggerParameter=e.parameter):e.trigger?this.trigger=e.trigger:this.trigger=e,this._nextActiveAction=this,this._condition=t}return e.prototype._prepare=function(){},e.prototype.getTriggerParameter=function(){return this._triggerParameter},e.prototype.setTriggerParameter=function(e){this._triggerParameter=e},e.prototype._evaluateConditionForCurrentFrame=function(){var e=this._condition;if(!e)return!0;var t=this._actionManager.getScene().getRenderId();return e._evaluationId!==t&&(e._evaluationId=t,e._currentResult=e.isValid()),e._currentResult},e.prototype._executeCurrent=function(e){this._evaluateConditionForCurrentFrame()&&(this.onBeforeExecuteObservable.notifyObservers(this),this._nextActiveAction.execute(e),this.skipToNextActiveAction())},e.prototype.execute=function(e){},e.prototype.skipToNextActiveAction=function(){this._nextActiveAction._child?(this._nextActiveAction._child._actionManager||(this._nextActiveAction._child._actionManager=this._actionManager),this._nextActiveAction=this._nextActiveAction._child):this._nextActiveAction=this},e.prototype.then=function(e){return this._child=e,e._actionManager=this._actionManager,e._prepare(),e},e.prototype._getProperty=function(e){return this._actionManager._getProperty(e)},e.prototype._getEffectiveTarget=function(e,t){return this._actionManager._getEffectiveTarget(e,t)},e.prototype.serialize=function(e){return null},e.prototype._serialize=function(e,t){var n={type:1,children:[],name:e.name,properties:e.properties||[]};if(this._child&&this._child.serialize(n),this._condition){var r=this._condition.serialize();return r.children.push(n),t&&t.children.push(r),r}return t&&t.children.push(n),n},e._SerializeValueAsString=function(e){return"number"==typeof e?e.toString():"boolean"==typeof e?e?"true":"false":e instanceof c.I9?e.x+", "+e.y:e instanceof c.Pq?e.x+", "+e.y+", "+e.z:e instanceof u.v9?e.r+", "+e.g+", "+e.b:e instanceof u.ov?e.r+", "+e.g+", "+e.b+", "+e.a:e},e._GetTargetProperty=function(e){return{name:"target",targetType:e._isMesh?"MeshProperties":e._isLight?"LightProperties":e._isCamera?"CameraProperties":e._isMaterial?"MaterialProperties":"SceneProperties",value:e._isScene?"Scene":e.name}},e}();(0,h.Y5)("BABYLON.Action",d);var p=n(35747),f=n(78322),m=function(){function e(e){this._actionManager=e}return e.prototype.isValid=function(){return!0},e.prototype._getProperty=function(e){return this._actionManager._getProperty(e)},e.prototype._getEffectiveTarget=function(e,t){return this._actionManager._getEffectiveTarget(e,t)},e.prototype.serialize=function(){},e.prototype._serialize=function(e){return{type:2,children:[],name:e.name,properties:e.properties}},e}(),_=function(e){function t(n,r,i,o,a){void 0===a&&(a=t.IsEqual);var s=e.call(this,n)||this;return s.propertyPath=i,s.value=o,s.operator=a,s._target=r,s._effectiveTarget=s._getEffectiveTarget(r,s.propertyPath),s._property=s._getProperty(s.propertyPath),s}return(0,f.C6)(t,e),Object.defineProperty(t,"IsEqual",{get:function(){return t._IsEqual},enumerable:!1,configurable:!0}),Object.defineProperty(t,"IsDifferent",{get:function(){return t._IsDifferent},enumerable:!1,configurable:!0}),Object.defineProperty(t,"IsGreater",{get:function(){return t._IsGreater},enumerable:!1,configurable:!0}),Object.defineProperty(t,"IsLesser",{get:function(){return t._IsLesser},enumerable:!1,configurable:!0}),t.prototype.isValid=function(){switch(this.operator){case t.IsGreater:return this._effectiveTarget[this._property]>this.value;case t.IsLesser:return this._effectiveTarget[this._property]-1&&this._scene.actionManagers.splice(n,1);for(var o=0,a=this._scene.meshes.filter((function(t){return t.actionManager===e}));o-1)return!0}return!1},t.prototype.hasSpecificTriggers2=function(e,t){for(var n=0;n=t.OnPickTrigger&&n.trigger<=t.OnPointerOutTrigger)return!0}return!1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasPickTriggers",{get:function(){for(var e=0;e=t.OnPickTrigger&&n.trigger<=t.OnPickUpTrigger)return!0}return!1},enumerable:!1,configurable:!0}),t.prototype.registerAction=function(e){return e.trigger===t.OnEveryFrameTrigger&&this.getScene().actionManager!==this?(y.V.Warn("OnEveryFrameTrigger can only be used with scene.actionManager"),null):(this.actions.push(e),this.getScene()._registeredActions++,t.Triggers[e.trigger]?t.Triggers[e.trigger]++:t.Triggers[e.trigger]=1,e._actionManager=this,e._prepare(),e)},t.prototype.unregisterAction=function(e){var n=this.actions.indexOf(e);return-1!==n&&(this.actions.splice(n,1),t.Triggers[e.trigger]-=1,0===t.Triggers[e.trigger]&&delete t.Triggers[e.trigger],e._actionManager=null,this.getScene()._registeredActions--,!0)},t.prototype.processTrigger=function(e,n){for(var r=0;r0;if(2===e.type?u.push(i):u.push(n),g){for(var v=[],y=0;y0){var p=d.properties[0].value,g=null===d.properties[0].targetType?p:r.getMeshByName(p);g._meshId&&(g.mesh=r.getMeshById(g._meshId)),l={trigger:t[d.name],parameter:g}}else l=t[d.name];for(var v=0;v1)throw"step size should be less than 1.";return this.value+=e,this._ensureLimits(),this._raiseOnChange(),this},e.prototype._ensureLimits=function(){for(;this.value>1;)this.value-=1;for(;this.value<0;)this.value+=1;return this},e.prototype._raiseOnChange=function(){for(var e=0,t=this._onchange;e1){var h=l._runtimeAnimations[0];for(c=1;c1){var d=l._runtimeAnimations[0]._animation;for(c=1;ce?(t=o,setTimeout((function(){J(n,r,i)}),0)):J(n,r,i)}}function ee(e,t,n,r,i){var o=function(){var a,s=function(e){e.done?n(e.value):void 0===a?a=!0:o()};do{a=void 0,i&&i.aborted?r(new Error("Aborted")):t(e,s,r),void 0===a&&(a=!1)}while(a)};o()}function te(e,t){var n;return ee(e,J,(function(e){return n=e}),(function(e){throw e}),t),n}function ne(e,t,n){return(0,f.sH)(this,void 0,void 0,(function(){return(0,f.YH)(this,(function(r){switch(r.label){case 0:return[4,new Promise((function(r,i){ee(e,t,r,i,n)}))];case 1:return[2,r.sent()]}}))}))}function re(e,t){return function(){for(var n=[],r=0;r65535?new Uint32Array(n):new Uint16Array(n),i=0;if(0===e.length)for(var o=this.indexStart;ol&&(l=h)}return new e(t,s,l-s+1,n,r,i,o,a)},e}(),_e=function(){},ge=function(){function e(){this.uniqueId=0,this.metadata={},this._applyTo=re(this._applyToCoroutine.bind(this)),this.uniqueId=e._UniqueIdGenerator,e._UniqueIdGenerator++}return e.prototype.set=function(e,t){switch(e.length||y.V.Warn("Setting vertex data kind '".concat(t,"' with an empty array")),t){case se.R.PositionKind:this.positions=e;break;case se.R.NormalKind:this.normals=e;break;case se.R.TangentKind:this.tangents=e;break;case se.R.UVKind:this.uvs=e;break;case se.R.UV2Kind:this.uvs2=e;break;case se.R.UV3Kind:this.uvs3=e;break;case se.R.UV4Kind:this.uvs4=e;break;case se.R.UV5Kind:this.uvs5=e;break;case se.R.UV6Kind:this.uvs6=e;break;case se.R.ColorKind:this.colors=e;break;case se.R.MatricesIndicesKind:this.matricesIndices=e;break;case se.R.MatricesWeightsKind:this.matricesWeights=e;break;case se.R.MatricesIndicesExtraKind:this.matricesIndicesExtra=e;break;case se.R.MatricesWeightsExtraKind:this.matricesWeightsExtra=e}},e.prototype.applyToMesh=function(e,t){return this._applyTo(e,t,!1),this},e.prototype.applyToGeometry=function(e,t){return this._applyTo(e,t,!1),this},e.prototype.updateMesh=function(e){return this._update(e),this},e.prototype.updateGeometry=function(e){return this._update(e),this},e.prototype._applyToCoroutine=function(e,t,n){var r,i,o,a,s;return void 0===t&&(t=!1),(0,f.YH)(this,(function(l){switch(l.label){case 0:return this.positions?(e.setVerticesData(se.R.PositionKind,this.positions,t),n?[4]:[3,2]):[3,2];case 1:l.sent(),l.label=2;case 2:return this.normals?(e.setVerticesData(se.R.NormalKind,this.normals,t),n?[4]:[3,4]):[3,4];case 3:l.sent(),l.label=4;case 4:return this.tangents?(e.setVerticesData(se.R.TangentKind,this.tangents,t),n?[4]:[3,6]):[3,6];case 5:l.sent(),l.label=6;case 6:return this.uvs?(e.setVerticesData(se.R.UVKind,this.uvs,t),n?[4]:[3,8]):[3,8];case 7:l.sent(),l.label=8;case 8:return this.uvs2?(e.setVerticesData(se.R.UV2Kind,this.uvs2,t),n?[4]:[3,10]):[3,10];case 9:l.sent(),l.label=10;case 10:return this.uvs3?(e.setVerticesData(se.R.UV3Kind,this.uvs3,t),n?[4]:[3,12]):[3,12];case 11:l.sent(),l.label=12;case 12:return this.uvs4?(e.setVerticesData(se.R.UV4Kind,this.uvs4,t),n?[4]:[3,14]):[3,14];case 13:l.sent(),l.label=14;case 14:return this.uvs5?(e.setVerticesData(se.R.UV5Kind,this.uvs5,t),n?[4]:[3,16]):[3,16];case 15:l.sent(),l.label=16;case 16:return this.uvs6?(e.setVerticesData(se.R.UV6Kind,this.uvs6,t),n?[4]:[3,18]):[3,18];case 17:l.sent(),l.label=18;case 18:return this.colors?(r=this.positions&&this.colors.length===this.positions.length?3:4,e.setVerticesData(se.R.ColorKind,this.colors,t,r),this.hasVertexAlpha&&void 0!==e.hasVertexAlpha&&(e.hasVertexAlpha=!0),n?[4]:[3,20]):[3,20];case 19:l.sent(),l.label=20;case 20:return this.matricesIndices?(e.setVerticesData(se.R.MatricesIndicesKind,this.matricesIndices,t),n?[4]:[3,22]):[3,22];case 21:l.sent(),l.label=22;case 22:return this.matricesWeights?(e.setVerticesData(se.R.MatricesWeightsKind,this.matricesWeights,t),n?[4]:[3,24]):[3,24];case 23:l.sent(),l.label=24;case 24:return this.matricesIndicesExtra?(e.setVerticesData(se.R.MatricesIndicesExtraKind,this.matricesIndicesExtra,t),n?[4]:[3,26]):[3,26];case 25:l.sent(),l.label=26;case 26:return this.matricesWeightsExtra?(e.setVerticesData(se.R.MatricesWeightsExtraKind,this.matricesWeightsExtra,t),n?[4]:[3,28]):[3,28];case 27:l.sent(),l.label=28;case 28:return this.indices?(e.setIndices(this.indices,null,t),n?[4]:[3,30]):[3,31];case 29:l.sent(),l.label=30;case 30:return[3,32];case 31:e.setIndices([],null),l.label=32;case 32:if(e.subMeshes&&this.materialInfos&&this.materialInfos.length>1)for((i=e).subMeshes=[],o=0,a=this.materialInfos;or?1:n===r?0:-1})),I=0,O=b;I0))return[3,4];V=null!==(Z=null==B?void 0:B.length)&&void 0!==Z?Z:0,B||(B=new Array(L)),B.length!==L&&(Array.isArray(B)?B.length=L:((U=r||B instanceof Uint32Array?new Uint32Array(L):new Uint16Array(L)).set(B),B=U),t&&t.determinant()<0&&e._FlipFaces(B,0,V)),G=c.positions?c.positions.length/3:0,k=0,z=n,f.label=1;case 1:if(!(k65535:r;for(var i=0,o=this._meshes;i0&&(this._indexBuffer=this._engine.createIndexBuffer(this._indices,this._updatable,"Geometry_"+this.id+"_IndexBuffer")),e._syncGeometryWithMorphTargetManager(),e.synchronizeInstances()},e.prototype._notifyUpdate=function(e){this.onGeometryUpdated&&this.onGeometryUpdated(this,e),this._vertexArrayObjects&&this._disposeVertexArrayObjects();for(var t=0,n=this._meshes;t0){for(var t=0;t0){for(t=0;t0){for(t=0;t-1&&this._parentContainer.geometries.splice(i,1),this._parentContainer=null}this._isDisposed=!0},e.prototype.copy=function(t){var n=new e(t,this._scene),r=this.getIndices(void 0,!0);r&&n.setIndices(r);var i,o=!1;for(i in this._vertexBuffers){var a=this.getVertexBuffer(i),s=a.getData();if(s){var l=a.isUpdatable(),c=a.getSize(),u=a.type,h=a.byteOffset,d=a.byteStride,p=a.normalized;o=o||l;var f=(0,be.II)(s,c,u,h,d,this._totalVertices,!0),m=new se.R(this._engine,f,i,{updatable:l,useBytes:!1,stride:c,size:c,offset:0,type:u,normalized:p,takeBufferOwnership:!0});n.setVerticesBuffer(m,this._totalVertices)}}for(i in n._updatable=o,n.delayLoadState=this.delayLoadState,n.delayLoadingFile=this.delayLoadingFile,n._delayLoadingFunction=this._delayLoadingFunction,this._delayInfo)n._delayInfo=n._delayInfo||[],n._delayInfo.push(i);return n._boundingInfo=new de.j(this._extend.minimum,this._extend.maximum),n},e.prototype.serialize=function(){var e={};return e.id=this.id,e.uniqueId=this.uniqueId,e.updatable=this._updatable,Q.Y&&Q.Y.HasTags(this)&&(e.tags=Q.Y.GetTags(this)),e},e.prototype._toNumberArray=function(e){return Array.isArray(e)?e:Array.prototype.slice.call(e)},e.prototype.clearCachedData=function(){for(var e in this._indices=[],this._resetPointsArrayCache(),this._vertexBuffers)Object.prototype.hasOwnProperty.call(this._vertexBuffers,e)&&(this._vertexBuffers[e]._buffer._data=null)},e.prototype.serializeVerticeData=function(){var e=this.serialize();return this.isVerticesDataPresent(se.R.PositionKind)&&(e.positions=this._toNumberArray(this.getVerticesData(se.R.PositionKind)),this.isVertexBufferUpdatable(se.R.PositionKind)&&(e.positionsUpdatable=!0)),this.isVerticesDataPresent(se.R.NormalKind)&&(e.normals=this._toNumberArray(this.getVerticesData(se.R.NormalKind)),this.isVertexBufferUpdatable(se.R.NormalKind)&&(e.normalsUpdatable=!0)),this.isVerticesDataPresent(se.R.TangentKind)&&(e.tangents=this._toNumberArray(this.getVerticesData(se.R.TangentKind)),this.isVertexBufferUpdatable(se.R.TangentKind)&&(e.tangentsUpdatable=!0)),this.isVerticesDataPresent(se.R.UVKind)&&(e.uvs=this._toNumberArray(this.getVerticesData(se.R.UVKind)),this.isVertexBufferUpdatable(se.R.UVKind)&&(e.uvsUpdatable=!0)),this.isVerticesDataPresent(se.R.UV2Kind)&&(e.uvs2=this._toNumberArray(this.getVerticesData(se.R.UV2Kind)),this.isVertexBufferUpdatable(se.R.UV2Kind)&&(e.uvs2Updatable=!0)),this.isVerticesDataPresent(se.R.UV3Kind)&&(e.uvs3=this._toNumberArray(this.getVerticesData(se.R.UV3Kind)),this.isVertexBufferUpdatable(se.R.UV3Kind)&&(e.uvs3Updatable=!0)),this.isVerticesDataPresent(se.R.UV4Kind)&&(e.uvs4=this._toNumberArray(this.getVerticesData(se.R.UV4Kind)),this.isVertexBufferUpdatable(se.R.UV4Kind)&&(e.uvs4Updatable=!0)),this.isVerticesDataPresent(se.R.UV5Kind)&&(e.uvs5=this._toNumberArray(this.getVerticesData(se.R.UV5Kind)),this.isVertexBufferUpdatable(se.R.UV5Kind)&&(e.uvs5Updatable=!0)),this.isVerticesDataPresent(se.R.UV6Kind)&&(e.uvs6=this._toNumberArray(this.getVerticesData(se.R.UV6Kind)),this.isVertexBufferUpdatable(se.R.UV6Kind)&&(e.uvs6Updatable=!0)),this.isVerticesDataPresent(se.R.ColorKind)&&(e.colors=this._toNumberArray(this.getVerticesData(se.R.ColorKind)),this.isVertexBufferUpdatable(se.R.ColorKind)&&(e.colorsUpdatable=!0)),this.isVerticesDataPresent(se.R.MatricesIndicesKind)&&(e.matricesIndices=this._toNumberArray(this.getVerticesData(se.R.MatricesIndicesKind)),e.matricesIndicesExpanded=!0,this.isVertexBufferUpdatable(se.R.MatricesIndicesKind)&&(e.matricesIndicesUpdatable=!0)),this.isVerticesDataPresent(se.R.MatricesWeightsKind)&&(e.matricesWeights=this._toNumberArray(this.getVerticesData(se.R.MatricesWeightsKind)),this.isVertexBufferUpdatable(se.R.MatricesWeightsKind)&&(e.matricesWeightsUpdatable=!0)),e.indices=this._toNumberArray(this.getIndices()),e},e.ExtractFromMesh=function(e,t){var n=e._geometry;return n?n.copy(t):null},e.RandomId=function(){return Z.S0.RandomId()},e._GetGeometryByLoadedUniqueId=function(e,t){for(var n=0;n0){var l=new Float32Array(t,s.positionsAttrDesc.offset,s.positionsAttrDesc.count);n.setVerticesData(se.R.PositionKind,l,!1)}if(s.normalsAttrDesc&&s.normalsAttrDesc.count>0){var c=new Float32Array(t,s.normalsAttrDesc.offset,s.normalsAttrDesc.count);n.setVerticesData(se.R.NormalKind,c,!1)}if(s.tangetsAttrDesc&&s.tangetsAttrDesc.count>0){var h=new Float32Array(t,s.tangetsAttrDesc.offset,s.tangetsAttrDesc.count);n.setVerticesData(se.R.TangentKind,h,!1)}if(s.uvsAttrDesc&&s.uvsAttrDesc.count>0){var d=new Float32Array(t,s.uvsAttrDesc.offset,s.uvsAttrDesc.count);if(ye.rX)for(var p=1;p0){var f=new Float32Array(t,s.uvs2AttrDesc.offset,s.uvs2AttrDesc.count);if(ye.rX)for(p=1;p0){var m=new Float32Array(t,s.uvs3AttrDesc.offset,s.uvs3AttrDesc.count);if(ye.rX)for(p=1;p0){var _=new Float32Array(t,s.uvs4AttrDesc.offset,s.uvs4AttrDesc.count);if(ye.rX)for(p=1;p<_.length;p+=2)_[p]=1-_[p];n.setVerticesData(se.R.UV4Kind,_,!1)}if(s.uvs5AttrDesc&&s.uvs5AttrDesc.count>0){var g=new Float32Array(t,s.uvs5AttrDesc.offset,s.uvs5AttrDesc.count);if(ye.rX)for(p=1;p0){var v=new Float32Array(t,s.uvs6AttrDesc.offset,s.uvs6AttrDesc.count);if(ye.rX)for(p=1;p0){var y=new Float32Array(t,s.colorsAttrDesc.offset,s.colorsAttrDesc.count);n.setVerticesData(se.R.ColorKind,y,!1,s.colorsAttrDesc.stride)}if(s.matricesIndicesAttrDesc&&s.matricesIndicesAttrDesc.count>0){for(var b=new Int32Array(t,s.matricesIndicesAttrDesc.offset,s.matricesIndicesAttrDesc.count),S=[],T=0;T>8),S.push((16711680&p)>>16),S.push(p>>24&255);n.setVerticesData(se.R.MatricesIndicesKind,S,!1)}if(s.matricesIndicesExtraAttrDesc&&s.matricesIndicesExtraAttrDesc.count>0){for(b=new Int32Array(t,s.matricesIndicesExtraAttrDesc.offset,s.matricesIndicesExtraAttrDesc.count),S=[],T=0;T>8),S.push((16711680&p)>>16),S.push(p>>24&255);n.setVerticesData(se.R.MatricesIndicesExtraKind,S,!1)}if(s.matricesWeightsAttrDesc&&s.matricesWeightsAttrDesc.count>0){var E=new Float32Array(t,s.matricesWeightsAttrDesc.offset,s.matricesWeightsAttrDesc.count);n.setVerticesData(se.R.MatricesWeightsKind,E,!1)}if(s.indicesAttrDesc&&s.indicesAttrDesc.count>0){var x=new Int32Array(t,s.indicesAttrDesc.offset,s.indicesAttrDesc.count);n.setIndices(x,null)}if(s.subMeshesAttrDesc&&s.subMeshesAttrDesc.count>0){var P=new Int32Array(t,s.subMeshesAttrDesc.offset,5*s.subMeshesAttrDesc.count);for(n.subMeshes=[],T=0;T>8),S.push((16711680&M)>>16),S.push(M>>24&255)}n.setVerticesData(se.R.MatricesIndicesKind,S,t.matricesIndices._updatable||t.matricesIndicesUpdatable)}if(t.matricesIndicesExtra)if(t.matricesIndicesExtraExpanded||t.matricesIndicesExtra._isExpanded)delete t.matricesIndices._isExpanded,delete t.matricesIndicesExtraExpanded,n.setVerticesData(se.R.MatricesIndicesExtraKind,t.matricesIndicesExtra,t.matricesIndicesExtra._updatable||t.matricesIndicesExtraUpdatable);else{for(S=[],T=0;T>8),S.push((16711680&M)>>16),S.push(M>>24&255);n.setVerticesData(se.R.MatricesIndicesExtraKind,S,t.matricesIndicesExtra._updatable||t.matricesIndicesExtraUpdatable)}t.matricesWeights&&(e._CleanMatricesWeights(t,n),n.setVerticesData(se.R.MatricesWeightsKind,t.matricesWeights,t.matricesWeights._updatable)),t.matricesWeightsExtra&&n.setVerticesData(se.R.MatricesWeightsExtraKind,t.matricesWeightsExtra,t.matricesWeights._updatable),n.setIndices(t.indices,null)}if(t.subMeshes){n.subMeshes=[];for(var D=0;D-1){var i=t.getScene().getLastSkeletonById(e.skeletonId);if(i){r=i.bones.length;for(var o=t.getVerticesData(se.R.MatricesIndicesKind),a=t.getVerticesData(se.R.MatricesIndicesExtraKind),s=e.matricesWeights,l=e.matricesWeightsExtra,c=e.numBoneInfluencer,u=s.length,h=0;hc-1)&&(p=c-1),d>n){var _=1/d;for(f=0;f<4;f++)s[h+f]*=_;if(l)for(f=0;f<4;f++)l[h+f]*=_}else p>=4?(l[h+p-4]=1-d,a[h+p-4]=r):(s[h+p]=1-d,o[h+p]=r)}t.setVerticesData(se.R.MatricesIndicesKind,o),e.matricesWeightsExtra&&t.setVerticesData(se.R.MatricesIndicesExtraKind,a)}}}},e.Parse=function(t,n,r){var i=new e(t.id,n,void 0,t.updatable);return i._loadedUniqueId=t.uniqueId,Q.Y&&Q.Y.AddTagsTo(i,t.tags),t.delayLoadingFile?(i.delayLoadState=b.Y.DELAYLOADSTATE_NOTLOADED,i.delayLoadingFile=r+t.delayLoadingFile,i._boundingInfo=new de.j(c.Pq.FromArray(t.boundingBoxMinimum),c.Pq.FromArray(t.boundingBoxMaximum)),i._delayInfo=[],t.hasUVs&&i._delayInfo.push(se.R.UVKind),t.hasUVs2&&i._delayInfo.push(se.R.UV2Kind),t.hasUVs3&&i._delayInfo.push(se.R.UV3Kind),t.hasUVs4&&i._delayInfo.push(se.R.UV4Kind),t.hasUVs5&&i._delayInfo.push(se.R.UV5Kind),t.hasUVs6&&i._delayInfo.push(se.R.UV6Kind),t.hasColors&&i._delayInfo.push(se.R.ColorKind),t.hasMatricesIndices&&i._delayInfo.push(se.R.MatricesIndicesKind),t.hasMatricesWeights&&i._delayInfo.push(se.R.MatricesWeightsKind),i._delayLoadingFunction=ge.ImportVertexData):ge.ImportVertexData(t,i),n.pushGeometry(i,!0),i},e}(),Te=n(12028),Ee=function(e){function t(n,r,i){void 0===r&&(r=null),void 0===i&&(i=!0);var o=e.call(this,n,r,!1)||this;return o._forward=new c.Pq(0,0,1),o._up=new c.Pq(0,1,0),o._right=new c.Pq(1,0,0),o._position=c.Pq.Zero(),o._rotation=c.Pq.Zero(),o._rotationQuaternion=null,o._scaling=c.Pq.One(),o._transformToBoneReferal=null,o._isAbsoluteSynced=!1,o._billboardMode=t.BILLBOARDMODE_NONE,o.scalingDeterminant=1,o._infiniteDistance=!1,o.ignoreNonUniformScaling=!1,o.reIntegrateRotationIntoRotationQuaternion=!1,o._poseMatrix=null,o._localMatrix=c.uq.Zero(),o._usePivotMatrix=!1,o._absolutePosition=c.Pq.Zero(),o._absoluteScaling=c.Pq.Zero(),o._absoluteRotationQuaternion=c.PT.Identity(),o._pivotMatrix=c.uq.Identity(),o._postMultiplyPivotMatrix=!1,o._isWorldMatrixFrozen=!1,o._indexInSceneTransformNodesArray=-1,o.onAfterWorldMatrixUpdateObservable=new l.cP,o._nonUniformScaling=!1,i&&o.getScene().addTransformNode(o),o}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"billboardMode",{get:function(){return this._billboardMode},set:function(e){this._billboardMode!==e&&(this._billboardMode=e,this._cache.useBillboardPosition=0!==(this._billboardMode&t.BILLBOARDMODE_USE_POSITION))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"infiniteDistance",{get:function(){return this._infiniteDistance},set:function(e){this._infiniteDistance!==e&&(this._infiniteDistance=e)},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"TransformNode"},Object.defineProperty(t.prototype,"position",{get:function(){return this._position},set:function(e){this._position=e,this._markAsDirtyInternal()},enumerable:!1,configurable:!0}),t.prototype.isUsingPivotMatrix=function(){return this._usePivotMatrix},t.prototype.isUsingPostMultiplyPivotMatrix=function(){return this._postMultiplyPivotMatrix},Object.defineProperty(t.prototype,"rotation",{get:function(){return this._rotation},set:function(e){this._rotation=e,this._rotationQuaternion=null,this._markAsDirtyInternal()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scaling",{get:function(){return this._scaling},set:function(e){this._scaling=e,this._markAsDirtyInternal()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotationQuaternion",{get:function(){return this._rotationQuaternion},set:function(e){this._rotationQuaternion=e,e&&this._rotation.setAll(0),this._markAsDirtyInternal()},enumerable:!1,configurable:!0}),t.prototype._markAsDirtyInternal=function(){this._isDirty||(this._isDirty=!0,this.customMarkAsDirty&&this.customMarkAsDirty())},Object.defineProperty(t.prototype,"forward",{get:function(){return c.Pq.TransformNormalFromFloatsToRef(0,0,this.getScene().useRightHandedSystem?-1:1,this.getWorldMatrix(),this._forward),this._forward.normalize()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"up",{get:function(){return c.Pq.TransformNormalFromFloatsToRef(0,1,0,this.getWorldMatrix(),this._up),this._up.normalize()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){return c.Pq.TransformNormalFromFloatsToRef(this.getScene().useRightHandedSystem?-1:1,0,0,this.getWorldMatrix(),this._right),this._right.normalize()},enumerable:!1,configurable:!0}),t.prototype.updatePoseMatrix=function(e){return this._poseMatrix?(this._poseMatrix.copyFrom(e),this):(this._poseMatrix=e.clone(),this)},t.prototype.getPoseMatrix=function(){return this._poseMatrix||(this._poseMatrix=c.uq.Identity()),this._poseMatrix},t.prototype._isSynchronized=function(){var e=this._cache;return!(this._billboardMode!==e.billboardMode||this._billboardMode!==t.BILLBOARDMODE_NONE||e.pivotMatrixUpdated||this._infiniteDistance||this._position._isDirty||this._scaling._isDirty||this._rotationQuaternion&&this._rotationQuaternion._isDirty||this._rotation._isDirty)},t.prototype._initCache=function(){e.prototype._initCache.call(this);var t=this._cache;t.localMatrixUpdated=!1,t.billboardMode=-1,t.infiniteDistance=!1,t.useBillboardPosition=!1},Object.defineProperty(t.prototype,"absolutePosition",{get:function(){return this.getAbsolutePosition()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"absoluteScaling",{get:function(){return this._syncAbsoluteScalingAndRotation(),this._absoluteScaling},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"absoluteRotationQuaternion",{get:function(){return this._syncAbsoluteScalingAndRotation(),this._absoluteRotationQuaternion},enumerable:!1,configurable:!0}),t.prototype.setPreTransformMatrix=function(e){return this.setPivotMatrix(e,!1)},t.prototype.setPivotMatrix=function(e,t){return void 0===t&&(t=!0),this._pivotMatrix.copyFrom(e),this._usePivotMatrix=!this._pivotMatrix.isIdentity(),this._cache.pivotMatrixUpdated=!0,this._postMultiplyPivotMatrix=t,this._postMultiplyPivotMatrix&&(this._pivotMatrixInverse?this._pivotMatrix.invertToRef(this._pivotMatrixInverse):this._pivotMatrixInverse=c.uq.Invert(this._pivotMatrix)),this},t.prototype.getPivotMatrix=function(){return this._pivotMatrix},t.prototype.instantiateHierarchy=function(e,t,n){void 0===e&&(e=null);var r=this.clone("Clone of "+(this.name||this.id),e||this.parent,!0);r&&n&&n(this,r);for(var i=0,o=this.getChildTransformNodes(!0);i-1&&this._parentContainer.transformNodes.splice(r,1),this._parentContainer=null}if(this.onAfterWorldMatrixUpdateObservable.clear(),t)for(var i=0,o=this.getChildTransformNodes(!0);iIe.$.CollisionsEpsilon&&i.position.addInPlace(i._internalAbstractMeshDataInfo._meshCollisionData._diffPositionForCollisions),n&&i.onCollideObservable.notifyObservers(n),i.onCollisionPositionChangeObservable.notifyObservers(i.position)},(r=i.getScene()).addMesh(i),i._resyncLightSources(),i._uniformBuffer=new Pe.D(i.getScene().getEngine(),void 0,void 0,n,!i.getScene().getEngine().isWebGPU),i._buildUniformLayout(),r.performancePriority){case 2:i.doNotSyncBoundingInfo=!0;case 1:i.alwaysSelectAsActiveMesh=!0,i.isPickable=!1}return i}return(0,f.C6)(t,e),Object.defineProperty(t,"BILLBOARDMODE_NONE",{get:function(){return Ee.BILLBOARDMODE_NONE},enumerable:!1,configurable:!0}),Object.defineProperty(t,"BILLBOARDMODE_X",{get:function(){return Ee.BILLBOARDMODE_X},enumerable:!1,configurable:!0}),Object.defineProperty(t,"BILLBOARDMODE_Y",{get:function(){return Ee.BILLBOARDMODE_Y},enumerable:!1,configurable:!0}),Object.defineProperty(t,"BILLBOARDMODE_Z",{get:function(){return Ee.BILLBOARDMODE_Z},enumerable:!1,configurable:!0}),Object.defineProperty(t,"BILLBOARDMODE_ALL",{get:function(){return Ee.BILLBOARDMODE_ALL},enumerable:!1,configurable:!0}),Object.defineProperty(t,"BILLBOARDMODE_USE_POSITION",{get:function(){return Ee.BILLBOARDMODE_USE_POSITION},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"facetNb",{get:function(){return this._internalAbstractMeshDataInfo._facetData.facetNb},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"partitioningSubdivisions",{get:function(){return this._internalAbstractMeshDataInfo._facetData.partitioningSubdivisions},set:function(e){this._internalAbstractMeshDataInfo._facetData.partitioningSubdivisions=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"partitioningBBoxRatio",{get:function(){return this._internalAbstractMeshDataInfo._facetData.partitioningBBoxRatio},set:function(e){this._internalAbstractMeshDataInfo._facetData.partitioningBBoxRatio=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mustDepthSortFacets",{get:function(){return this._internalAbstractMeshDataInfo._facetData.facetDepthSort},set:function(e){this._internalAbstractMeshDataInfo._facetData.facetDepthSort=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"facetDepthSortFrom",{get:function(){return this._internalAbstractMeshDataInfo._facetData.facetDepthSortFrom},set:function(e){this._internalAbstractMeshDataInfo._facetData.facetDepthSortFrom=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"collisionRetryCount",{get:function(){return this._internalAbstractMeshDataInfo._collisionRetryCount},set:function(e){this._internalAbstractMeshDataInfo._collisionRetryCount=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isFacetDataEnabled",{get:function(){return this._internalAbstractMeshDataInfo._facetData.facetDataEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"morphTargetManager",{get:function(){return this._internalAbstractMeshDataInfo._morphTargetManager},set:function(e){this._internalAbstractMeshDataInfo._morphTargetManager!==e&&(this._internalAbstractMeshDataInfo._morphTargetManager=e,this._syncGeometryWithMorphTargetManager())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bakedVertexAnimationManager",{get:function(){return this._internalAbstractMeshDataInfo._bakedVertexAnimationManager},set:function(e){this._internalAbstractMeshDataInfo._bakedVertexAnimationManager!==e&&(this._internalAbstractMeshDataInfo._bakedVertexAnimationManager=e,this._markSubMeshesAsAttributesDirty())},enumerable:!1,configurable:!0}),t.prototype._syncGeometryWithMorphTargetManager=function(){},t.prototype._updateNonUniformScalingState=function(t){return!!e.prototype._updateNonUniformScalingState.call(this,t)&&(this._markSubMeshesAsMiscDirty(),!0)},Object.defineProperty(t.prototype,"rawBoundingInfo",{get:function(){return this._internalAbstractMeshDataInfo._rawBoundingInfo},set:function(e){this._internalAbstractMeshDataInfo._rawBoundingInfo=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onCollide",{set:function(e){this._internalAbstractMeshDataInfo._meshCollisionData._onCollideObserver&&this.onCollideObservable.remove(this._internalAbstractMeshDataInfo._meshCollisionData._onCollideObserver),this._internalAbstractMeshDataInfo._meshCollisionData._onCollideObserver=this.onCollideObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onCollisionPositionChange",{set:function(e){this._internalAbstractMeshDataInfo._meshCollisionData._onCollisionPositionChangeObserver&&this.onCollisionPositionChangeObservable.remove(this._internalAbstractMeshDataInfo._meshCollisionData._onCollisionPositionChangeObserver),this._internalAbstractMeshDataInfo._meshCollisionData._onCollisionPositionChangeObserver=this.onCollisionPositionChangeObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"visibility",{get:function(){return this._internalAbstractMeshDataInfo._visibility},set:function(e){if(this._internalAbstractMeshDataInfo._visibility!==e){var t=this._internalAbstractMeshDataInfo._visibility;this._internalAbstractMeshDataInfo._visibility=e,(1===t&&1!==e||1!==t&&1===e)&&this._markSubMeshesAsDirty((function(e){e.markAsMiscDirty(),e.markAsPrePassDirty()}))}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pointerOverDisableMeshTesting",{get:function(){return this._internalAbstractMeshDataInfo._pointerOverDisableMeshTesting},set:function(e){this._internalAbstractMeshDataInfo._pointerOverDisableMeshTesting=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"renderingGroupId",{get:function(){return this._internalAbstractMeshDataInfo._renderingGroupId},set:function(e){this._internalAbstractMeshDataInfo._renderingGroupId=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"material",{get:function(){return this._internalAbstractMeshDataInfo._material},set:function(e){this._setMaterial(e)},enumerable:!1,configurable:!0}),t.prototype._setMaterial=function(e){this._internalAbstractMeshDataInfo._material!==e&&(this._internalAbstractMeshDataInfo._material&&this._internalAbstractMeshDataInfo._material.meshMap&&(this._internalAbstractMeshDataInfo._material.meshMap[this.uniqueId]=void 0),this._internalAbstractMeshDataInfo._material=e,e&&e.meshMap&&(e.meshMap[this.uniqueId]=this),this.onMaterialChangedObservable.hasObservers()&&this.onMaterialChangedObservable.notifyObservers(this),this.subMeshes&&(this.resetDrawCache(void 0,null==e),this._unBindEffect()))},t.prototype.getMaterialForRenderPass=function(e){var t;return null===(t=this._internalAbstractMeshDataInfo._materialForRenderPass)||void 0===t?void 0:t[e]},t.prototype.setMaterialForRenderPass=function(e,t){var n;this.resetDrawCache(e),this._internalAbstractMeshDataInfo._materialForRenderPass||(this._internalAbstractMeshDataInfo._materialForRenderPass=[]);var r=this._internalAbstractMeshDataInfo._materialForRenderPass[e];(null===(n=null==r?void 0:r.meshMap)||void 0===n?void 0:n[this.uniqueId])&&(r.meshMap[this.uniqueId]=void 0),this._internalAbstractMeshDataInfo._materialForRenderPass[e]=t,t&&t.meshMap&&(t.meshMap[this.uniqueId]=this)},Object.defineProperty(t.prototype,"receiveShadows",{get:function(){return this._internalAbstractMeshDataInfo._receiveShadows},set:function(e){this._internalAbstractMeshDataInfo._receiveShadows!==e&&(this._internalAbstractMeshDataInfo._receiveShadows=e,this._markSubMeshesAsLightDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasVertexAlpha",{get:function(){return this._internalAbstractMeshDataInfo._hasVertexAlpha},set:function(e){this._internalAbstractMeshDataInfo._hasVertexAlpha!==e&&(this._internalAbstractMeshDataInfo._hasVertexAlpha=e,this._markSubMeshesAsAttributesDirty(),this._markSubMeshesAsMiscDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"useVertexColors",{get:function(){return this._internalAbstractMeshDataInfo._useVertexColors},set:function(e){this._internalAbstractMeshDataInfo._useVertexColors!==e&&(this._internalAbstractMeshDataInfo._useVertexColors=e,this._markSubMeshesAsAttributesDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"computeBonesUsingShaders",{get:function(){return this._internalAbstractMeshDataInfo._computeBonesUsingShaders},set:function(e){this._internalAbstractMeshDataInfo._computeBonesUsingShaders!==e&&(this._internalAbstractMeshDataInfo._computeBonesUsingShaders=e,this._markSubMeshesAsAttributesDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"numBoneInfluencers",{get:function(){return this._internalAbstractMeshDataInfo._numBoneInfluencers},set:function(e){this._internalAbstractMeshDataInfo._numBoneInfluencers!==e&&(this._internalAbstractMeshDataInfo._numBoneInfluencers=e,this._markSubMeshesAsAttributesDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"applyFog",{get:function(){return this._internalAbstractMeshDataInfo._applyFog},set:function(e){this._internalAbstractMeshDataInfo._applyFog!==e&&(this._internalAbstractMeshDataInfo._applyFog=e,this._markSubMeshesAsMiscDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableDistantPicking",{get:function(){return this._internalAbstractMeshDataInfo._enableDistantPicking},set:function(e){this._internalAbstractMeshDataInfo._enableDistantPicking=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"layerMask",{get:function(){return this._internalAbstractMeshDataInfo._layerMask},set:function(e){e!==this._internalAbstractMeshDataInfo._layerMask&&(this._internalAbstractMeshDataInfo._layerMask=e,this._resyncLightSources())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"collisionMask",{get:function(){return this._internalAbstractMeshDataInfo._meshCollisionData._collisionMask},set:function(e){this._internalAbstractMeshDataInfo._meshCollisionData._collisionMask=isNaN(e)?-1:e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"collisionResponse",{get:function(){return this._internalAbstractMeshDataInfo._meshCollisionData._collisionResponse},set:function(e){this._internalAbstractMeshDataInfo._meshCollisionData._collisionResponse=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"collisionGroup",{get:function(){return this._internalAbstractMeshDataInfo._meshCollisionData._collisionGroup},set:function(e){this._internalAbstractMeshDataInfo._meshCollisionData._collisionGroup=isNaN(e)?-1:e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"surroundingMeshes",{get:function(){return this._internalAbstractMeshDataInfo._meshCollisionData._surroundingMeshes},set:function(e){this._internalAbstractMeshDataInfo._meshCollisionData._surroundingMeshes=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lightSources",{get:function(){return this._lightSources},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"skeleton",{get:function(){return this._internalAbstractMeshDataInfo._skeleton},set:function(e){var t=this._internalAbstractMeshDataInfo._skeleton;t&&t.needInitialSkinMatrix&&t._unregisterMeshWithPoseMatrix(this),e&&e.needInitialSkinMatrix&&e._registerMeshWithPoseMatrix(this),this._internalAbstractMeshDataInfo._skeleton=e,this._internalAbstractMeshDataInfo._skeleton||(this._bonesTransformMatrices=null),this._markSubMeshesAsAttributesDirty()},enumerable:!1,configurable:!0}),t.prototype._buildUniformLayout=function(){this._uniformBuffer.addUniform("world",16),this._uniformBuffer.addUniform("visibility",1),this._uniformBuffer.create()},t.prototype.transferToEffect=function(e){var t=this._uniformBuffer;t.updateMatrix("world",e),t.updateFloat("visibility",this._internalAbstractMeshDataInfo._visibility),t.update()},t.prototype.getMeshUniformBuffer=function(){return this._uniformBuffer},t.prototype.getClassName=function(){return"AbstractMesh"},t.prototype.toString=function(e){var t="Name: "+this.name+", isInstance: "+("InstancedMesh"===this.getClassName()?"YES":"NO");t+=", # of submeshes: "+(this.subMeshes?this.subMeshes.length:0);var n=this._internalAbstractMeshDataInfo._skeleton;return n&&(t+=", skeleton: "+n.name),e&&(t+=", billboard mode: "+["NONE","X","Y",null,"Z",null,null,"ALL"][this.billboardMode],t+=", freeze wrld mat: "+(this._isWorldMatrixFrozen||this._waitingData.freezeWorldMatrix?"YES":"NO")),t},t.prototype._getEffectiveParent=function(){return this._masterMesh&&this.billboardMode!==Ee.BILLBOARDMODE_NONE?this._masterMesh:e.prototype._getEffectiveParent.call(this)},t.prototype._getActionManagerForTrigger=function(e,t){if(void 0===t&&(t=!0),this.actionManager&&(t||this.actionManager.isRecursive)){if(!e)return this.actionManager;if(this.actionManager.hasSpecificTrigger(e))return this.actionManager}return this.parent?this.parent._getActionManagerForTrigger(e,!1):null},t.prototype._rebuild=function(e){if(void 0===e&&(e=!1),this.onRebuildObservable.notifyObservers(this),null!==this._occlusionQuery&&(this._occlusionQuery=null),this.subMeshes){for(var t=0,n=this.subMeshes;t0&&(c.uq.FromFloat32ArrayToRefScaled(n,Math.floor(16*r[p+f]),m,u),l.addToSelf(u));if(o&&a)for(f=0;f<4;f++)(m=a[p+f])>0&&(c.uq.FromFloat32ArrayToRefScaled(n,Math.floor(16*o[p+f]),m,u),l.addToSelf(u));h(e[d],e[d+1],e[d+2],l,s),s.toArray(e,d)}}(e,t,n,r,i,o,a)},t.prototype._getData=function(e,n,r){var i=this;void 0===r&&(r=se.R.PositionKind);var o=e.cache,a=function(e){if(o){var t=o._vertexData||(o._vertexData={});return t[e]||i.copyVerticesData(e,t),t[e]}return i.getVerticesData(e)};if(n||(n=a(r)),!n)return null;if(o?(o._outputData?o._outputData.set(n):o._outputData=new Float32Array(n),n=o._outputData):(e.applyMorph&&this.morphTargetManager||e.applySkeleton&&this.skeleton)&&(n=n.slice()),e.applyMorph&&this.morphTargetManager&&function(e,t,n){var r=null;switch(t){case se.R.PositionKind:r=function(e){return e.getPositions()};break;case se.R.NormalKind:r=function(e){return e.getNormals()};break;case se.R.TangentKind:r=function(e){return e.getTangents()};break;case se.R.UVKind:r=function(e){return e.getUVs()};break;case se.R.UV2Kind:r=function(e){return e.getUV2s()};break;case se.R.ColorKind:r=function(e){return e.getColors()};break;default:return}for(var i=0;i4,h=u?a(se.R.MatricesIndicesExtraKind):null,d=u?a(se.R.MatricesWeightsExtraKind):null,p=this.skeleton.getTransformMatrices(this);t._ApplySkeleton(n,r,p,s,l,h,d)}}if(!1!==e.updatePositionsArray&&r===se.R.PositionKind){var f=this._internalAbstractMeshDataInfo._positions||[],m=f.length;if(f.length=n.length/3,m1||!r.IsGlobal)&&r.updateBoundingInfo(e)}return this},t.prototype._afterComputeWorldMatrix=function(){this.doNotSyncBoundingInfo||(this._boundingInfoIsDirty=!0)},t.prototype.isInFrustum=function(e){return this.getBoundingInfo().isInFrustum(e,this.cullingStrategy)},t.prototype.isCompletelyInFrustum=function(e){return this.getBoundingInfo().isCompletelyInFrustum(e)},t.prototype.intersectsMesh=function(e,t,n){void 0===t&&(t=!1);var r=this.getBoundingInfo(),i=e.getBoundingInfo();if(r.intersects(i,t))return!0;if(n)for(var o=0,a=this.getChildMeshes();o1&&!o._checkCollision(e)||this._collideForSubMesh(o,t,e)}return this},t.prototype._shouldConvertRHS=function(){return!1},t.prototype._checkCollision=function(e){if(!this.getBoundingInfo()._checkCollision(e))return this;var t=c.AA.Matrix[0],n=c.AA.Matrix[1];return c.uq.ScalingToRef(1/e._radius.x,1/e._radius.y,1/e._radius.z,t),this.worldMatrixFromCache.multiplyToRef(t,n),this._processCollisionsForSubMeshes(e,n),this},t.prototype._generatePointsArray=function(){return!1},t.prototype.intersects=function(e,t,n,r,i,o){void 0===r&&(r=!1),void 0===o&&(o=!1);var a=new xe.G,s=this.getClassName(),l="InstancedLinesMesh"===s||"LinesMesh"===s||"GreasedLineMesh"===s?this.intersectionThreshold:0,u=this.getBoundingInfo();if(!this.subMeshes)return a;if(!(o||e.intersectsSphere(u.boundingSphere,l)&&e.intersectsBox(u.boundingBox,l)))return a;if(r)return a.hit=!o,a.pickedMesh=o?null:this,a.distance=o?0:c.Pq.Distance(e.origin,u.boundingSphere.center),a.subMeshId=0,a;if(!this._generatePointsArray())return a;for(var h=null,d=this._scene.getIntersectingSubMeshCandidates(this,e),p=d.length,f=!1,m=0;m1)||o||g.canIntersects(e)){var v=g.intersects(e,this._positions,this.getIndices(),t,n);if(v&&(t||!h||v.distance-1&&this._parentContainer.meshes.splice(g,1),this._parentContainer=null}if(n&&this.material&&("MultiMaterial"===this.material.getClassName()?this.material.dispose(!1,!0,!0):this.material.dispose(!1,!0)),!t)for(r=0;r65535){o=!0;break}e.depthSortedIndices=o?new Uint32Array(n):new Uint16Array(n)}if(e.facetDepthSortFunction=function(e,t){return t.sqDistance-e.sqDistance},!e.facetDepthSortFrom){var s=this.getScene().activeCamera;e.facetDepthSortFrom=s?s.position:c.Pq.Zero()}e.depthSortedFacets=[];for(var l=0;lRe.bH?i.maximum.x-i.minimum.x:Re.bH,e.bbSize.y=i.maximum.y-i.minimum.y>Re.bH?i.maximum.y-i.minimum.y:Re.bH,e.bbSize.z=i.maximum.z-i.minimum.z>Re.bH?i.maximum.z-i.minimum.z:Re.bH;var h=e.bbSize.x>e.bbSize.y?e.bbSize.x:e.bbSize.y;if(h=h>e.bbSize.z?h:e.bbSize.z,e.subDiv.max=e.partitioningSubdivisions,e.subDiv.X=Math.floor(e.subDiv.max*e.bbSize.x/h),e.subDiv.Y=Math.floor(e.subDiv.max*e.bbSize.y/h),e.subDiv.Z=Math.floor(e.subDiv.max*e.bbSize.z/h),e.subDiv.X=e.subDiv.X<1?1:e.subDiv.X,e.subDiv.Y=e.subDiv.Y<1?1:e.subDiv.Y,e.subDiv.Z=e.subDiv.Z<1?1:e.subDiv.Z,e.facetParameters.facetNormals=this.getFacetLocalNormals(),e.facetParameters.facetPositions=this.getFacetLocalPositions(),e.facetParameters.facetPartitioning=this.getFacetLocalPartitioning(),e.facetParameters.bInfo=i,e.facetParameters.bbSize=e.bbSize,e.facetParameters.subDiv=e.subDiv,e.facetParameters.ratio=this.partitioningBBoxRatio,e.facetParameters.depthSort=e.facetDepthSort,e.facetDepthSort&&e.facetDepthSortEnabled&&(this.computeWorldMatrix(!0),this._worldMatrix.invertToRef(e.invertedMatrix),c.Pq.TransformCoordinatesToRef(e.facetDepthSortFrom,e.invertedMatrix,e.facetDepthSortOrigin),e.facetParameters.distanceTo=e.facetDepthSortOrigin),e.facetParameters.depthSortedFacets=e.depthSortedFacets,r&&ge.ComputeNormals(t,n,r,e.facetParameters),e.facetDepthSort&&e.facetDepthSortEnabled){e.depthSortedFacets.sort(e.facetDepthSortFunction);var d=e.depthSortedIndices.length/3|0;for(l=0;li.subDiv.max||a<0||a>i.subDiv.max||s<0||s>i.subDiv.max?null:i.facetPartitioning[o+i.subDiv.max*a+i.subDiv.max*i.subDiv.max*s]},t.prototype.getClosestFacetAtCoordinates=function(e,t,n,r,i,o){void 0===i&&(i=!1),void 0===o&&(o=!0);var a=this.getWorldMatrix(),s=c.AA.Matrix[5];a.invertToRef(s);var l=c.AA.Vector3[8];c.Pq.TransformCoordinatesFromFloatsToRef(e,t,n,s,l);var u=this.getClosestFacetAtLocalCoordinates(l.x,l.y,l.z,r,i,o);return r&&c.Pq.TransformCoordinatesFromFloatsToRef(r.x,r.y,r.z,a,r),u},t.prototype.getClosestFacetAtLocalCoordinates=function(e,t,n,r,i,o){void 0===i&&(i=!1),void 0===o&&(o=!0);var a=null,s=0,l=0,c=0,u=0,h=0,d=0,p=0,f=0,m=this.getFacetLocalPositions(),_=this.getFacetLocalNormals(),g=this.getFacetsAtLocalCoordinates(e,t,n);if(!g)return null;for(var v,y,b,S=Number.MAX_VALUE,T=S,E=0;E=0||i&&!o&&u<=0)&&(u=y.x*b.x+y.y*b.y+y.z*b.z,h=-(y.x*e+y.y*t+y.z*n-u)/(y.x*y.x+y.y*y.y+y.z*y.z),(T=(s=(d=e+y.x*h)-e)*s+(l=(p=t+y.y*h)-t)*l+(c=(f=n+y.z*h)-n)*c)-1&&this._parentContainer.materials.splice(i,1),this._parentContainer=null}if(!0!==n)if(this.meshMap)for(var o in this.meshMap){var a=this.meshMap[o];this._disposeMeshResources(a)}else for(var s=0,l=r.meshes;s=this.subMaterials.length?this.getScene().defaultMaterial:this.subMaterials[e]},t.prototype.getActiveTextures=function(){var t;return(t=e.prototype.getActiveTextures.call(this)).concat.apply(t,this.subMaterials.map((function(e){return e?e.getActiveTextures():[]})))},t.prototype.hasTexture=function(t){var n;if(e.prototype.hasTexture.call(this,t))return!0;for(var r=0;r=0&&i.multiMaterials.splice(s,1),e.prototype.dispose.call(this,t,n)}},t.ParseMultiMaterial=function(e,n){var r=new t(e.name,n);if(r.id=e.id,r._loadedUniqueId=e.uniqueId,Q.Y&&Q.Y.AddTagsTo(r,e.tags),e.materialsUniqueIds)r._waitingSubMaterialsUniqueIds=e.materialsUniqueIds;else for(var i=0,o=e.materials;i0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasThinInstances",{get:function(){return(this.forcedInstanceCount||this._thinInstanceDataStorage.instancesCount||0)>0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"forcedInstanceCount",{get:function(){return this._internalMeshDataInfo._forcedInstanceCount},set:function(e){this._internalMeshDataInfo._forcedInstanceCount=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sideOrientation",{get:function(){return this._internalMeshDataInfo._sideOrientation},set:function(e){this._internalMeshDataInfo._sideOrientation=e,this._internalAbstractMeshDataInfo._sideOrientationHint=this._scene.useRightHandedSystem&&e===b.Y.MATERIAL_CounterClockWiseSideOrientation||!this._scene.useRightHandedSystem&&e===b.Y.MATERIAL_ClockWiseSideOrientation},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_effectiveSideOrientation",{get:function(){return this._internalMeshDataInfo._effectiveSideOrientation},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"overrideMaterialSideOrientation",{get:function(){return this.sideOrientation},set:function(e){this.sideOrientation=e,this.material&&(this.material.sideOrientation=null)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"overrideRenderingFillMode",{get:function(){return this._internalMeshDataInfo._overrideRenderingFillMode},set:function(e){this._internalMeshDataInfo._overrideRenderingFillMode=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"material",{get:function(){return this._internalAbstractMeshDataInfo._material},set:function(e){e&&(this.material&&null===this.material.sideOrientation||this._internalAbstractMeshDataInfo._sideOrientationHint)&&(e.sideOrientation=null),this._setMaterial(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"source",{get:function(){return this._internalMeshDataInfo._source},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cloneMeshMap",{get:function(){return this._internalMeshDataInfo.meshMap},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isUnIndexed",{get:function(){return this._unIndexed},set:function(e){this._unIndexed!==e&&(this._unIndexed=e,this._markSubMeshesAsAttributesDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"worldMatrixInstancedBuffer",{get:function(){var e=this._instanceDataStorage.renderPasses[this._instanceDataStorage.engine.isWebGPU?this._instanceDataStorage.engine.currentRenderPassId:0];return e?e.instancesData:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"previousWorldMatrixInstancedBuffer",{get:function(){var e=this._instanceDataStorage.renderPasses[this._instanceDataStorage.engine.isWebGPU?this._instanceDataStorage.engine.currentRenderPassId:0];return e?e.instancesPreviousData:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"manualUpdateOfWorldMatrixInstancedBuffer",{get:function(){return this._instanceDataStorage.manualUpdate},set:function(e){this._instanceDataStorage.manualUpdate=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"manualUpdateOfPreviousWorldMatrixInstancedBuffer",{get:function(){return this._instanceDataStorage.previousManualUpdate},set:function(e){this._instanceDataStorage.previousManualUpdate=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"forceWorldMatrixInstancedBufferUpdate",{get:function(){return this._instanceDataStorage.forceMatrixUpdates},set:function(e){this._instanceDataStorage.forceMatrixUpdates=e},enumerable:!1,configurable:!0}),t.prototype._copySource=function(e,t,n,r){var i,o;void 0===n&&(n=!0),void 0===r&&(r=!1);var a=this.getScene();if(e._geometry&&e._geometry.applyToMesh(this),D.r.DeepCopy(e,this,["name","material","skeleton","instances","parent","uniqueId","source","metadata","morphTargetManager","hasInstances","worldMatrixInstancedBuffer","previousWorldMatrixInstancedBuffer","hasLODLevels","geometry","isBlocked","areNormalsFrozen","facetNb","isFacetDataEnabled","lightSources","useBones","isAnInstance","collider","edgesRenderer","forward","up","right","absolutePosition","absoluteScaling","absoluteRotationQuaternion","isWorldMatrixFrozen","nonUniformScaling","behaviors","worldMatrixFromCache","hasThinInstances","cloneMeshMap","hasBoundingInfo","physicsBody","physicsImpostor"],["_poseMatrix"]),this._internalMeshDataInfo._source=e,a.useClonedMeshMap&&(e._internalMeshDataInfo.meshMap||(e._internalMeshDataInfo.meshMap={}),e._internalMeshDataInfo.meshMap[this.uniqueId]=this),this._originalBuilderSideOrientation=e._originalBuilderSideOrientation,this._creationDataStorage=e._creationDataStorage,e._ranges){var s=e._ranges;for(var l in s)Object.prototype.hasOwnProperty.call(s,l)&&s[l]&&this.createAnimationRange(l,s[l].from,s[l].to)}if(e.metadata&&e.metadata.clone?this.metadata=e.metadata.clone():this.metadata=e.metadata,this._internalMetadata=e._internalMetadata,Q.Y&&Q.Y.HasTags(e)&&Q.Y.AddTagsTo(this,Q.Y.GetTags(e,!0)),this.setEnabled(e.isEnabled(!1)),this.parent=e.parent,this.setPivotMatrix(e.getPivotMatrix(),this._postMultiplyPivotMatrix),this.id=this.name+"."+e.id,this.material=e.material,!t)for(var c=e.getDescendants(!0),u=0;u0},enumerable:!1,configurable:!0}),t.prototype.getLODLevels=function(){return this._internalMeshDataInfo._LODLevels},t.prototype._sortLODLevels=function(){var e=this._internalMeshDataInfo._useLODScreenCoverage?-1:1;this._internalMeshDataInfo._LODLevels.sort((function(t,n){return t.distanceOrScreenCoveragen.distanceOrScreenCoverage?-e:0}))},t.prototype.addLODLevel=function(e,t){if(t&&t._masterMesh)return y.V.Warn("You cannot use a mesh as LOD level twice"),this;var n=new Ge(e,t);return this._internalMeshDataInfo._LODLevels.push(n),t&&(t._masterMesh=this),this._sortLODLevels(),this},t.prototype.getLODLevelAtDistance=function(e){for(var t=this._internalMeshDataInfo,n=0;na*o)return this.onLODLevelSelection&&this.onLODLevelSelection(o,this,this),this;for(var c=0;c0||this.hasThinInstances);this.computeWorldMatrix();var p=this.material||h.defaultMaterial;if(p)if(p._storeEffectOnSubMeshes)for(var f=0,m=this.subMeshes;f0){var n=this.getIndices();if(!n)return null;var r=n.length,i=!1;if(e)i=!0;else for(var o=0,a=this.subMeshes;or){i=!0;break}if(s.verticesStart+s.verticesCount>t){i=!0;break}}if(!i)return this.subMeshes[0]}return this.releaseSubMeshes(),new me(0,0,t,0,this.getTotalIndices()||(this.isUnIndexed?t:0),this)},t.prototype.subdivide=function(e){if(!(e<1)){for(var t=this.getTotalIndices(),n=t/e|0,r=0;n%3!=0;)n++;this.releaseSubMeshes();for(var i=0;i=t);i++)me.CreateFromIndices(0,r,i===e-1?t-r:n,this,void 0,!1),r+=n;this.refreshBoundingInfo(),this.synchronizeInstances()}},t.prototype.setVerticesData=function(e,t,n,r){if(void 0===n&&(n=!1),this._geometry)this._geometry.setVerticesData(e,t,n,r);else{var i=new ge;i.set(t,e);var o=this.getScene();new Se(Se.RandomId(),o,i,n,this)}return this},t.prototype.removeVerticesData=function(e){this._geometry&&this._geometry.removeVerticesData(e)},t.prototype.markVerticesDataAsUpdatable=function(e,t){void 0===t&&(t=!0);var n=this.getVertexBuffer(e);n&&n.isUpdatable()!==t&&this.setVerticesData(e,this.getVerticesData(e),t)},t.prototype.setVerticesBuffer=function(e,t){return void 0===t&&(t=!0),this._geometry||(this._geometry=Se.CreateGeometryForMesh(this)),this._geometry.setVerticesBuffer(e,null,t),this},t.prototype.updateVerticesData=function(e,t,n,r){return this._geometry?(r?(this.makeGeometryUnique(),this.updateVerticesData(e,t,n,!1)):this._geometry.updateVerticesData(e,t,n),this):this},t.prototype.updateMeshPositions=function(e,t){void 0===t&&(t=!0);var n=this.getVerticesData(se.R.PositionKind);if(!n)return this;if(e(n),this.updateVerticesData(se.R.PositionKind,n,!1,!1),t){var r=this.getIndices(),i=this.getVerticesData(se.R.NormalKind);if(!i)return this;ge.ComputeNormals(n,r,i),this.updateVerticesData(se.R.NormalKind,i,!1,!1)}return this},t.prototype.makeGeometryUnique=function(){if(!this._geometry)return this;if(1===this._geometry.meshes.length)return this;var e=this._geometry,t=this._geometry.copy(Se.RandomId());return e.releaseForMesh(this,!0),t.applyToMesh(this),this},t.prototype.setIndexBuffer=function(e,t,n,r){void 0===r&&(r=null);var i=this._geometry;i||(i=new Se(Se.RandomId(),this.getScene(),void 0,void 0,this)),i.setIndexBuffer(e,t,n,r)},t.prototype.setIndices=function(e,t,n,r){if(void 0===t&&(t=null),void 0===n&&(n=!1),void 0===r&&(r=!1),this._geometry)this._geometry.setIndices(e,t,n,r);else{var i=new ge;i.indices=e;var o=this.getScene();new Se(Se.RandomId(),o,i,n,this)}return this},t.prototype.updateIndices=function(e,t,n){return void 0===n&&(n=!1),this._geometry?(this._geometry.updateIndices(e,t,n),this):this},t.prototype.toLeftHanded=function(){return this._geometry?(this._geometry.toLeftHanded(),this):this},t.prototype._bind=function(e,t,n,r){if(void 0===r&&(r=!0),!this._geometry)return this;var i,o=this.getScene().getEngine();if(this._unIndexed)i=this._getRenderingFillMode(n)===Be.WireFrameFillMode?e._getLinesIndexBuffer(this.getIndices(),o):null;else switch(this._getRenderingFillMode(n)){case Be.PointFillMode:i=null;break;case Be.WireFrameFillMode:i=e._getLinesIndexBuffer(this.getIndices(),o);break;default:case Be.TriangleFillMode:i=this._geometry.getIndexBuffer()}return this._bindDirect(t,i,r)},t.prototype._bindDirect=function(e,t,n){if(void 0===n&&(n=!0),!this._geometry)return this;if(this.morphTargetManager&&this.morphTargetManager.isUsingTextureForTargets&&this.morphTargetManager._bind(e),n&&this._userInstancedBuffersStorage&&!this.hasThinInstances){if(this._instanceDataStorage.engine.isWebGPU&&this._userInstancedBuffersStorage.renderPasses&&this._userInstancedBuffersStorage.renderPasses[this._instanceDataStorage.engine.currentRenderPassId]){var r=this._userInstancedBuffersStorage.renderPasses[this._instanceDataStorage.engine.currentRenderPassId];for(var i in r)this._userInstancedBuffersStorage.vertexBuffers[i]=r[i]}this._geometry._bind(e,t,this._userInstancedBuffersStorage.vertexBuffers,this._userInstancedBuffersStorage.vertexArrayObjects)}else this._geometry._bind(e,t);return this},t.prototype._draw=function(e,t,n){if(!this._geometry||!this._geometry.getVertexBuffers()||!this._unIndexed&&!this._geometry.getIndexBuffer())return this;this._internalMeshDataInfo._onBeforeDrawObservable&&this._internalMeshDataInfo._onBeforeDrawObservable.notifyObservers(this);var r=this.getScene().getEngine(),i=r._currentMaterialContext,o=i&&i.useVertexPulling;return this._unIndexed&&t!==Be.WireFrameFillMode||t==Be.PointFillMode?r.drawArraysType(t,e.verticesStart,e.verticesCount,this.forcedInstanceCount||n):t==Be.WireFrameFillMode?r.drawElementsType(t,0,e._linesIndexCount,this.forcedInstanceCount||n):o?r.drawArraysType(t,e.indexStart,e.indexCount,this.forcedInstanceCount||n):r.drawElementsType(t,e.indexStart,e.indexCount,this.forcedInstanceCount||n),this},t.prototype.registerBeforeRender=function(e){return this.onBeforeRenderObservable.add(e),this},t.prototype.unregisterBeforeRender=function(e){return this.onBeforeRenderObservable.removeCallback(e),this},t.prototype.registerAfterRender=function(e){return this.onAfterRenderObservable.add(e),this},t.prototype.unregisterAfterRender=function(e){return this.onAfterRenderObservable.removeCallback(e),this},t.prototype._getInstancesRenderList=function(e,t){void 0===t&&(t=!1);var n=this._getInstanceDataStorage();if(this._instanceDataStorage.isFrozen){if(t)return n.batchCacheReplacementModeInFrozenMode.hardwareInstancedRendering[e]=!1,n.batchCacheReplacementModeInFrozenMode.renderSelf[e]=!0,n.batchCacheReplacementModeInFrozenMode;if(n.previousBatch)return n.previousBatch}var r=this.getScene(),i=r._isInIntermediateRendering(),o=i?this._internalAbstractMeshDataInfo._onlyForInstancesIntermediate:this._internalAbstractMeshDataInfo._onlyForInstances,a=n.batchCache;if(a.mustReturn=!1,a.renderSelf[e]=t||!o&&this.isEnabled()&&this.isVisible,a.visibleInstances[e]=null,n.visibleInstances&&!t){var s=n.visibleInstances,l=r.getRenderId(),c=i?s.intermediateDefaultRenderId:s.defaultRenderId;a.visibleInstances[e]=s[l],!a.visibleInstances[e]&&c&&(a.visibleInstances[e]=s[c])}return a.hardwareInstancedRendering[e]=!t&&this._instanceDataStorage.hardwareInstancedRendering&&null!==a.visibleInstances[e]&&void 0!==a.visibleInstances[e],n.previousBatch=a,a},t.prototype._updateInstancedBuffers=function(e,n,r,i,o,a){var s,l=n.visibleInstances[e._id],u=l?l.length:0,h=n.parent,d=this._instanceDataStorage,p=h.instancesBuffer,f=h.instancesPreviousBuffer,m=0,_=0,g=n.renderSelf[e._id],v=this._scene.floatingOriginOffset,y=!p||r!==h.instancesBufferSize||this._scene.needsPreviousWorldMatrices&&!h.instancesPreviousBuffer;if(this._instanceDataStorage.manualUpdate||d.isFrozen&&!y)_=(g?1:0)+u;else{var b=this.getWorldMatrix();if(g&&(this._scene.needsPreviousWorldMatrices&&(d.masterMeshPreviousWorldMatrix?(d.masterMeshPreviousWorldMatrix.copyToArray(h.instancesPreviousData,m),d.masterMeshPreviousWorldMatrix.copyFrom(b)):(d.masterMeshPreviousWorldMatrix=b.clone(),d.masterMeshPreviousWorldMatrix.copyToArray(h.instancesPreviousData,m))),b.copyToArray(h.instancesData,m),h.instancesData[m+12]-=v.x,h.instancesData[m+13]-=v.y,h.instancesData[m+14]-=v.z,m+=16,_++),l){if(t.INSTANCEDMESH_SORT_TRANSPARENT&&this._scene.activeCamera&&(null===(s=e.getMaterial())||void 0===s?void 0:s.needAlphaBlendingForMesh(e.getRenderingMesh()))){for(var S=this._scene.activeCamera.globalPosition,T=0;Tt._distanceToCamera?-1:e._distanceToCamera1&&s.activeCamera===s.activeCameras[0]||l<=1)&&this._checkOcclusionQuery()&&!this._occlusionDataStorage.forceRenderingWhenOccluded)return this;var c=this._getInstancesRenderList(e._id,!!n);if(c.mustReturn)return this;if(!this._geometry||!this._geometry.getVertexBuffers()||!this._unIndexed&&!this._geometry.getIndexBuffer())return this;var u=s.getEngine(),h=0,d=null;this.ignoreCameraMaxZ&&s.activeCamera&&!s._isInIntermediateRendering()&&(h=s.activeCamera.maxZ,d=s.activeCamera,s.activeCamera.maxZ=0,s.updateTransformMatrix(!0)),this._internalMeshDataInfo._onBeforeRenderObservable&&this._internalMeshDataInfo._onBeforeRenderObservable.notifyObservers(this);var p,f=e.getRenderingMesh(),m=c.hardwareInstancedRendering[e._id]||f.hasThinInstances||!!this._userInstancedBuffersStorage&&!e.getMesh()._internalAbstractMeshDataInfo._actAsRegularMesh,_=this._instanceDataStorage,g=e.getMaterial();if(!g)return d&&(d.maxZ=h,s.updateTransformMatrix(!0)),this;if(_.isFrozen&&this._internalMeshDataInfo._effectiveMaterial&&this._internalMeshDataInfo._effectiveMaterial===g){if(g._storeEffectOnSubMeshes&&!(null===(o=e._drawWrapper)||void 0===o?void 0:o._wasPreviouslyReady)||!g._storeEffectOnSubMeshes&&!g._getDrawWrapper()._wasPreviouslyReady)return d&&(d.maxZ=h,s.updateTransformMatrix(!0)),this}else{if(g._storeEffectOnSubMeshes){if(!g.isReadyForSubMesh(this,e,m))return d&&(d.maxZ=h,s.updateTransformMatrix(!0)),this}else if(!g.isReady(this,m))return d&&(d.maxZ=h,s.updateTransformMatrix(!0)),this;this._internalMeshDataInfo._effectiveMaterial=g}if(t){var v=this._internalMeshDataInfo._effectiveMaterial;if(1===v.alphaModes.length)u.setAlphaMode(v.alphaMode);else for(var y=0;yu&&r++,0!==f&&d++,h+=f,u=f}if(l[d]++,d>o&&(o=d),0===h)i++;else{var m=1/h,_=0;for(p=0;p.001&&a++}}var g=this.skeleton.bones.length,v=this.getVerticesData(se.R.MatricesIndicesKind),y=this.getVerticesData(se.R.MatricesIndicesExtraKind),b=0;for(c=0;c=g||S<0)&&b++}return{skinned:!0,valid:0===i&&0===a&&0===b,report:"Number of Weights = "+n/4+"\nMaximum influences = "+o+"\nMissing Weights = "+i+"\nNot Sorted = "+r+"\nNot Normalized = "+a+"\nWeightCounts = ["+l+"]\nNumber of bones = "+g+"\nBad Bone Indices = "+b}},t.prototype._checkDelayState=function(){var e=this.getScene();return this._geometry?this._geometry.load(e):this.delayLoadState===b.Y.DELAYLOADSTATE_NOTLOADED&&(this.delayLoadState=b.Y.DELAYLOADSTATE_LOADING,this._queueLoad(e)),this},t.prototype._queueLoad=function(e){var t=this;e.addPendingData(this);var n=-1!==this.delayLoadingFile.indexOf(".babylonbinarymeshdata");return Z.S0.LoadFile(this.delayLoadingFile,(function(n){n instanceof ArrayBuffer?t._delayLoadingFunction(n,t):t._delayLoadingFunction(JSON.parse(n),t);for(var r=0,i=t.instances;r-1;t--)if(n[t].id===e)return this.material=n[t],this;var r=this.getScene().multiMaterials;for(t=r.length-1;t>-1;t--)if(r[t].id===e)return this.material=r[t],this;return this},t.prototype.getAnimatables=function(){var e=[];return this.material&&e.push(this.material),this.skeleton&&e.push(this.skeleton),e},t.prototype.bakeTransformIntoVertices=function(e){if(!this.isVerticesDataPresent(se.R.PositionKind))return this;var t=this.subMeshes.splice(0);this._resetPointsArrayCache();var n,r=this.getVerticesData(se.R.PositionKind),i=c.Pq.Zero();for(n=0;n-1&&(i._waitingMorphTargetManagerId=e.morphTargetManagerId),void 0!==e.skeletonId&&null!==e.skeletonId&&(i.skeleton=n.getLastSkeletonById(e.skeletonId),e.numBoneInfluencers&&(i.numBoneInfluencers=e.numBoneInfluencers)),e.animations){for(var o=0;o4,h=u?this.getVerticesData(se.R.MatricesIndicesExtraKind):null,d=u?this.getVerticesData(se.R.MatricesWeightsExtraKind):null,p=e.getTransformMatrices(this),f=c.Pq.Zero(),m=new c.uq,_=new c.uq,g=0,v=0;v0&&(c.uq.FromFloat32ArrayToRefScaled(p,Math.floor(16*a[g+l]),y,_),m.addToSelf(_));if(u)for(l=0;l<4;l++)(y=d[g+l])>0&&(c.uq.FromFloat32ArrayToRefScaled(p,Math.floor(16*h[g+l]),y,_),m.addToSelf(_));c.Pq.TransformCoordinatesFromFloatsToRef(n._sourcePositions[v],n._sourcePositions[v+1],n._sourcePositions[v+2],m,f),f.toArray(i,v),t&&(c.Pq.TransformNormalFromFloatsToRef(n._sourceNormals[v],n._sourceNormals[v+1],n._sourceNormals[v+2],m,f),f.toArray(o,v)),m.reset()}return this.updateVerticesData(se.R.PositionKind,i),t&&this.updateVerticesData(se.R.NormalKind,o),this},t.MinMax=function(e){for(var t=null,n=null,r=0,i=e;r=65536)return y.V.Warn("Cannot merge meshes because resulting mesh will have more than 65536 vertices. Please use allow32BitsIndices = true to use 32 bits indices"),[2,null];for(a&&(o=!1),u=new Array,h=new Array,d=new Array,p=e[0].sideOrientation,l=0;l=0!=this._getWorldMatrixDeterminant()>=0)return this._internalAbstractMeshDataInfo._actAsRegularMesh=!0,!0;if(this._internalAbstractMeshDataInfo._actAsRegularMesh=!1,this._currentLOD._registerInstanceForRenderId(this,t),n){if(!this._currentLOD._internalAbstractMeshDataInfo._isActiveIntermediate)return this._currentLOD._internalAbstractMeshDataInfo._onlyForInstancesIntermediate=!0,!0}else if(!this._currentLOD._internalAbstractMeshDataInfo._isActive)return this._currentLOD._internalAbstractMeshDataInfo._onlyForInstances=!0,!0}return!1},t.prototype._postActivate=function(){this._sourceMesh.edgesShareWithInstances&&this._sourceMesh._edgesRenderer&&this._sourceMesh._edgesRenderer.isEnabled&&this._sourceMesh._renderingGroup?(this._sourceMesh._renderingGroup._edgesRenderers.pushNoDuplicate(this._sourceMesh._edgesRenderer),this._sourceMesh._edgesRenderer.customInstances.push(this.getWorldMatrix())):this._edgesRenderer&&this._edgesRenderer.isEnabled&&this._sourceMesh._renderingGroup&&this._sourceMesh._renderingGroup._edgesRenderers.push(this._edgesRenderer)},t.prototype.getWorldMatrix=function(){if(this._currentLOD&&this._currentLOD!==this._sourceMesh&&this._currentLOD.billboardMode!==Ee.BILLBOARDMODE_NONE&&this._currentLOD._masterMesh!==this){this._billboardWorldMatrix||(this._billboardWorldMatrix=new c.uq);var t=this._currentLOD._masterMesh;return this._currentLOD._masterMesh=this,c.AA.Vector3[7].copyFrom(this._currentLOD.position),this._currentLOD.position.set(0,0,0),this._billboardWorldMatrix.copyFrom(this._currentLOD.computeWorldMatrix(!0)),this._currentLOD.position.copyFrom(c.AA.Vector3[7]),this._currentLOD._masterMesh=t,this._billboardWorldMatrix}return e.prototype.getWorldMatrix.call(this)},Object.defineProperty(t.prototype,"isAnInstance",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.getLOD=function(e){if(!e)return this;var t=this.sourceMesh.getLODLevels();if(t&&0!==t.length){var n=this.getBoundingInfo();this._currentLOD=this.sourceMesh.getLOD(e,n.boundingSphere)}else this._currentLOD=this.sourceMesh;return this._currentLOD},t.prototype._preActivateForIntermediateRendering=function(e){return this.sourceMesh._preActivateForIntermediateRendering(e)},t.prototype._syncSubMeshes=function(){if(this.releaseSubMeshes(),this._sourceMesh.subMeshes)for(var e=0;e0;){var E=T.shift();g.push(E);for(var x=o.dependedBy.get(E.uniqueId),P=0,C=Array.from(x.values());P0&&(y.V.Error("SceneSerializer._topologicalSort: There were unvisited nodes:"),t.forEach((function(e){y.V.Error(e.name)}))),g},t.prototype._addNodeAndDescendantsToList=function(e,t,n,r){if(n&&(!r||r(n))&&!t.has(n.uniqueId)){e.push(n),t.add(n.uniqueId);for(var i=0,o=n.getDescendants(!0);i-1&&s.animations.splice(i,1)}},c=0,u=a.animations;c0;){var r=t.pop();if(r instanceof qe?(r.geometry&&-1===this.geometries.indexOf(r.geometry)&&this.geometries.push(r.geometry),this.meshes.push(r)):r instanceof Ke?this.meshes.push(r):r instanceof Ee?this.transformNodes.push(r):r instanceof Ze.v?this.lights.push(r):r instanceof oe.i&&this.cameras.push(r),r instanceof De){if(r.material&&-1===this.materials.indexOf(r.material)){this.materials.push(r.material);for(var i=0,o=r.material.getActiveTextures();i0&&(_=!0,this._soundLoaded(n));break;case"AudioBuffer":this._audioBufferLoaded(n);break;case"String":m.push(n);case"Array":0===m.length&&(m=n);for(var g=function(e){var t=m[e];if(_=o&&o.skipCodecCheck||-1!==t.indexOf(".mp3",t.length-4)&&Ie.$.audioEngine.isMP3supported||-1!==t.indexOf(".ogg",t.length-4)&&Ie.$.audioEngine.isOGGsupported||-1!==t.indexOf(".wav",t.length-4)||-1!==t.indexOf(".m4a",t.length-4)||-1!==t.indexOf(".mp4",t.length-4)||-1!==t.indexOf("blob:"))return v._streaming?(v._htmlAudioElement=new Audio(t),v._htmlAudioElement.controls=!1,v._htmlAudioElement.loop=v.loop,Z.S0.SetCorsBehavior(t,v._htmlAudioElement),v._htmlAudioElement.preload="auto",v._htmlAudioElement.addEventListener("canplaythrough",(function(){p._isReadyToPlay=!0,p.autoplay&&p.play(0,p._offset,p._length),p._readyToPlayCallback&&p._readyToPlayCallback()}),{once:!0}),document.body.appendChild(v._htmlAudioElement),v._htmlAudioElement.load()):v._scene._loadFile(t,(function(e){p._soundLoaded(e)}),void 0,!0,!0,(function(e){e&&y.V.Error("XHR "+e.status+" error on: "+t+"."),y.V.Error("Sound creation aborted."),p._scene.mainSoundTrack.removeSound(p)})),"break"},v=this,b=0;b0&&(this._htmlAudioElement.currentTime=0)):null===(t=this._streamingSource)||void 0===t||t.disconnect(),this.isPlaying=!1;else if((null===(n=Ie.$.audioEngine)||void 0===n?void 0:n.audioContext)&&this._soundSource){var i=e?Ie.$.audioEngine.audioContext.currentTime+e:void 0;this._soundSource.onended=function(){r.isPlaying=!1,r.isPaused=!1,r._startTime=0,r._currentTime=0,r._soundSource&&(r._soundSource.onended=function(){}),r._onended()},this._soundSource.stop(i)}else this.isPlaying=!1;else this.isPaused&&(this.isPaused=!1,this._startTime=0,this._currentTime=0)},e.prototype.pause=function(){var e,t;this.isPlaying&&(this._clearTimeoutsAndObservers(),this._streaming?(this._htmlAudioElement?this._htmlAudioElement.pause():null===(e=this._streamingSource)||void 0===e||e.disconnect(),this.isPlaying=!1,this.isPaused=!0):(null===(t=Ie.$.audioEngine)||void 0===t?void 0:t.audioContext)&&this._soundSource&&(this._soundSource.onended=function(){},this._soundSource.stop(),this.isPlaying=!1,this.isPaused=!0,this._currentTime+=Ie.$.audioEngine.audioContext.currentTime-this._startTime))},e.prototype.setVolume=function(e,t){var n;(null===(n=Ie.$.audioEngine)||void 0===n?void 0:n.canUseWebAudio)&&this._soundGain&&(t&&Ie.$.audioEngine.audioContext?(this._soundGain.gain.cancelScheduledValues(Ie.$.audioEngine.audioContext.currentTime),this._soundGain.gain.setValueAtTime(this._soundGain.gain.value,Ie.$.audioEngine.audioContext.currentTime),this._soundGain.gain.linearRampToValueAtTime(e,Ie.$.audioEngine.audioContext.currentTime+t)):this._soundGain.gain.value=e),this._volume=e},e.prototype.setPlaybackRate=function(e){this._playbackRate=e,this.isPlaying&&(this._streaming&&this._htmlAudioElement?this._htmlAudioElement.playbackRate=this._playbackRate:this._soundSource&&(this._soundSource.playbackRate.value=this._playbackRate))},e.prototype.getPlaybackRate=function(){return this._playbackRate},e.prototype.getVolume=function(){return this._volume},e.prototype.attachToMesh=function(e){var t=this;this._connectedTransformNode&&this._registerFunc&&(this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc),this._registerFunc=null),this._connectedTransformNode=e,this._spatialSound||(this._spatialSound=!0,this._createSpatialParameters(),this.isPlaying&&this.loop&&(this.stop(),this.play(0,this._offset,this._length))),this._onRegisterAfterWorldMatrixUpdate(this._connectedTransformNode),this._registerFunc=function(e){return t._onRegisterAfterWorldMatrixUpdate(e)},this._connectedTransformNode.registerAfterWorldMatrixUpdate(this._registerFunc)},e.prototype.detachFromMesh=function(){this._connectedTransformNode&&this._registerFunc&&(this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc),this._registerFunc=null,this._connectedTransformNode=null)},e.prototype._onRegisterAfterWorldMatrixUpdate=function(e){var t;if(e.getBoundingInfo){var n=e.getBoundingInfo();this.setPosition(n.boundingSphere.centerWorld)}else this.setPosition(e.absolutePosition);(null===(t=Ie.$.audioEngine)||void 0===t?void 0:t.canUseWebAudio)&&this._isDirectional&&this.isPlaying&&this._updateDirection()},e.prototype.clone=function(){var t=this;if(this._streaming)return null;var n={autoplay:this.autoplay,loop:this.loop,volume:this._volume,spatialSound:this._spatialSound,maxDistance:this.maxDistance,useCustomAttenuation:this.useCustomAttenuation,rolloffFactor:this.rolloffFactor,refDistance:this.refDistance,distanceModel:this.distanceModel},r=new e(this.name+"_cloned",new ArrayBuffer(0),this._scene,null,n);return this.useCustomAttenuation&&r.setAttenuationFunction(this._customAttenuationFunction),r.setPosition(this._position),r.setPlaybackRate(this._playbackRate),(0,Lt.B)((function(){return t._isReadyToPlay}),(function(){r._audioBuffer=t.getAudioBuffer(),r._isReadyToPlay=!0,r.autoplay&&r.play(0,t._offset,t._length)}),void 0,300),r},e.prototype.getAudioBuffer=function(){return this._audioBuffer},e.prototype.getSoundSource=function(){return this._soundSource},e.prototype.getSoundGain=function(){return this._soundGain},e.prototype.serialize=function(){var e={name:this.name,url:this._url,autoplay:this.autoplay,loop:this.loop,volume:this._volume,spatialSound:this._spatialSound,maxDistance:this.maxDistance,rolloffFactor:this.rolloffFactor,refDistance:this.refDistance,distanceModel:this.distanceModel,playbackRate:this._playbackRate,panningModel:this._panningModel,soundTrackId:this.soundTrackId,metadata:this.metadata};return this._spatialSound&&(this._connectedTransformNode&&(e.connectedMeshId=this._connectedTransformNode.id),e.position=this._position.asArray(),e.refDistance=this.refDistance,e.distanceModel=this.distanceModel,e.isDirectional=this._isDirectional,e.localDirectionToMesh=this._localDirection.asArray(),e.coneInnerAngle=this._coneInnerAngle,e.coneOuterAngle=this._coneOuterAngle,e.coneOuterGain=this._coneOuterGain),e},e.Parse=function(t,n,r,i){var o,a=t.name;o=t.url?r+t.url:r+a;var s,l={autoplay:t.autoplay,loop:t.loop,volume:t.volume,spatialSound:t.spatialSound,maxDistance:t.maxDistance,rolloffFactor:t.rolloffFactor,refDistance:t.refDistance,distanceModel:t.distanceModel,playbackRate:t.playbackRate};if(i?(s=new e(a,new ArrayBuffer(0),n,null,l),(0,Lt.B)((function(){return i._isReadyToPlay}),(function(){s._audioBuffer=i.getAudioBuffer(),s._isReadyToPlay=!0,s.autoplay&&s.play(0,s._offset,s._length)}),void 0,300)):(s=new e(a,o,n,(function(){n.removePendingData(s)}),l),n.addPendingData(s)),t.position){var u=c.Pq.FromArray(t.position);s.setPosition(u)}if(t.isDirectional&&(s.setDirectionalCone(t.coneInnerAngle||360,t.coneOuterAngle||360,t.coneOuterGain||0),t.localDirectionToMesh)){var h=c.Pq.FromArray(t.localDirectionToMesh);s.setLocalDirectionToMesh(h)}if(t.connectedMeshId){var d=n.getMeshById(t.connectedMeshId);d&&s.attachToMesh(d)}return t.metadata&&(s.metadata=t.metadata),s},e.prototype._setOffset=function(e){this._offset!==e&&(this.isPaused&&(this.stop(),this.isPaused=!1),this._offset=e)},e.prototype._clearTimeoutsAndObservers=function(){var e;this._tryToPlayTimeout&&(clearTimeout(this._tryToPlayTimeout),this._tryToPlayTimeout=null),this._audioUnlockedObserver&&(null===(e=Ie.$.audioEngine)||void 0===e||e.onAudioUnlockedObservable.remove(this._audioUnlockedObserver),this._audioUnlockedObserver=null)},e._SceneComponentInitialization=function(e){throw(0,le.n)("AudioSceneComponent")},e}();(0,h.Y5)("BABYLON.Sound",wt);var Bt=function(){function e(e,t){void 0===t&&(t={}),this.id=-1,this._isInitialized=!1,(e=e||M.q.LastCreatedScene)&&(this._scene=e,this.soundCollection=[],this._options=t,!this._options.mainTrack&&this._scene.soundTracks&&(this._scene.soundTracks.push(this),this.id=this._scene.soundTracks.length-1))}return e.prototype._initializeSoundTrackAudioGraph=function(){var e;(null===(e=Ie.$.audioEngine)||void 0===e?void 0:e.canUseWebAudio)&&Ie.$.audioEngine.audioContext&&(this._outputAudioNode=Ie.$.audioEngine.audioContext.createGain(),this._outputAudioNode.connect(Ie.$.audioEngine.masterGain),this._options&&this._options.volume&&(this._outputAudioNode.gain.value=this._options.volume),this._isInitialized=!0)},e.prototype.dispose=function(){if(Ie.$.audioEngine&&Ie.$.audioEngine.canUseWebAudio){for(this._connectedAnalyser&&this._connectedAnalyser.stopDebugCanvas();this.soundCollection.length;)this.soundCollection[0].dispose();this._outputAudioNode&&this._outputAudioNode.disconnect(),this._outputAudioNode=null}},e.prototype.addSound=function(e){var t;this._isInitialized||this._initializeSoundTrackAudioGraph(),(null===(t=Ie.$.audioEngine)||void 0===t?void 0:t.canUseWebAudio)&&this._outputAudioNode&&e.connectToSoundTrackAudioNode(this._outputAudioNode),void 0!==e.soundTrackId&&(-1===e.soundTrackId?this._scene.mainSoundTrack.removeSound(e):this._scene.soundTracks&&this._scene.soundTracks[e.soundTrackId].removeSound(e)),this.soundCollection.push(e),e.soundTrackId=this.id},e.prototype.removeSound=function(e){var t=this.soundCollection.indexOf(e);-1!==t&&this.soundCollection.splice(t,1)},e.prototype.setVolume=function(e){var t;(null===(t=Ie.$.audioEngine)||void 0===t?void 0:t.canUseWebAudio)&&this._outputAudioNode&&(this._outputAudioNode.gain.value=e)},e.prototype.switchPanningModelToHRTF=function(){var e;if(null===(e=Ie.$.audioEngine)||void 0===e?void 0:e.canUseWebAudio)for(var t=0;t0&&(i=n.activeCameras[0]),this.audioListenerPositionProvider){var o=this.audioListenerPositionProvider();r.audioContext.listener.setPosition(o.x||0,o.y||0,o.z||0)}else i?this._cachedCameraPosition.equals(i.globalPosition)||(this._cachedCameraPosition.copyFrom(i.globalPosition),r.audioContext.listener.setPosition(i.globalPosition.x,i.globalPosition.y,i.globalPosition.z)):r.audioContext.listener.setPosition(0,0,0);if(this.audioListenerRotationProvider){var a=this.audioListenerRotationProvider();r.audioContext.listener.setOrientation(a.x||0,a.y||0,a.z||0,0,1,0)}else i?(i.rigCameras&&i.rigCameras.length>0&&(i=i.rigCameras[0]),i.getViewMatrix().invertToRef(this._invertMatrixTemp),c.Pq.TransformNormalToRef(e._CameraDirection,this._invertMatrixTemp,this._cameraDirectionTemp),this._cameraDirectionTemp.normalize(),isNaN(this._cameraDirectionTemp.x)||isNaN(this._cameraDirectionTemp.y)||isNaN(this._cameraDirectionTemp.z)||this._cachedCameraDirection.equals(this._cameraDirectionTemp)||(this._cachedCameraDirection.copyFrom(this._cameraDirectionTemp),r.audioContext.listener.setOrientation(this._cameraDirectionTemp.x,this._cameraDirectionTemp.y,this._cameraDirectionTemp.z,0,1,0))):r.audioContext.listener.setOrientation(0,0,0,0,1,0);var s=void 0;for(s=0;s0?1/i:0,l=0;l0}return Object.defineProperty(e.prototype,"useTextureToStoreBoneMatrices",{get:function(){return this._useTextureToStoreBoneMatrices},set:function(e){this._useTextureToStoreBoneMatrices=e,this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"animationPropertiesOverride",{get:function(){return this._animationPropertiesOverride?this._animationPropertiesOverride:this._scene.animationPropertiesOverride},set:function(e){this._animationPropertiesOverride=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isUsingTextureForMatrices",{get:function(){return this.useTextureToStoreBoneMatrices&&this._canUseTextureForBones},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"uniqueId",{get:function(){return this._uniqueId},enumerable:!1,configurable:!0}),e.prototype.getClassName=function(){return"Skeleton"},e.prototype.getChildren=function(){return this.bones.filter((function(e){return!e.getParent()}))},e.prototype.getTransformMatrices=function(e){if(this.needInitialSkinMatrix){if(!e)throw new Error("getTransformMatrices: When using the needInitialSkinMatrix flag, a mesh must be provided");return e._bonesTransformMatrices||this.prepare(!0),e._bonesTransformMatrices}return this._transformMatrices&&!this._isDirty||this.prepare(!this._transformMatrices),this._transformMatrices},e.prototype.getTransformMatrixTexture=function(e){return this.needInitialSkinMatrix&&e._transformMatrixTexture?e._transformMatrixTexture:this._transformMatrixTexture},e.prototype.getScene=function(){return this._scene},e.prototype.toString=function(e){var t="Name: ".concat(this.name,", nBones: ").concat(this.bones.length);if(t+=", nAnimationRanges: ".concat(this._ranges?Object.keys(this._ranges).length:"none"),e){t+=", Ranges: {";var n=!0;for(var r in this._ranges)n&&(t+=", ",n=!1),t+=r;t+="}"}return t},e.prototype.getBoneIndexByName=function(e){for(var t=0,n=this.bones.length;t-1&&this._meshesWithPoseMatrix.splice(t,1)},e.prototype._computeTransformMatrices=function(e,t){this.onBeforeComputeObservable.notifyObservers(this);for(var n=0;n0)for(var n=0,r=this.bones;n-1&&this._parentContainer.skeletons.splice(e,1),this._parentContainer=null}this._transformMatrixTexture&&(this._transformMatrixTexture.dispose(),this._transformMatrixTexture=null)},e.prototype.serialize=function(){var e,t={};t.name=this.name,t.id=this.id,this.dimensionsAtRest&&(t.dimensionsAtRest=this.dimensionsAtRest.asArray()),t.bones=[],t.needInitialSkinMatrix=this.needInitialSkinMatrix,this.metadata&&(t.metadata=this.metadata);for(var n=0;n0&&(o.animation=r.animations[0].serialize()),t.ranges=[],this._ranges){var s=this._ranges[a];if(s){var l={};l.name=a,l.from=s.from,l.to=s.to,t.ranges.push(l)}}}return t},e.Parse=function(t,n){var r,i=new e(t.name,t.id,n);for(t.dimensionsAtRest&&(i.dimensionsAtRest=c.Pq.FromArray(t.dimensionsAtRest)),i.needInitialSkinMatrix=t.needInitialSkinMatrix,t.metadata&&(i.metadata=t.metadata),r=0;r-1&&(s=i.bones[o.parentBoneIndex]);var l=o.rest?c.uq.FromArray(o.rest):null,u=new yn.$(o.name,i,s,c.uq.FromArray(o.matrix),l,null,a);void 0!==o.id&&null!==o.id&&(u.id=o.id),o.length&&(u.length=o.length),o.metadata&&(u.metadata=o.metadata),o.animation&&u.animations.push(w.X5.Parse(o.animation)),void 0!==o.linkedTransformNodeId&&null!==o.linkedTransformNodeId&&(i._hasWaitingData=!0,u._waitingTransformNodeId=o.linkedTransformNodeId)}if(t.ranges)for(r=0;r0&&(e=this._meshesWithPoseMatrix[0].getPoseMatrix()),e},e.prototype.sortBones=function(){for(var e=[],t=new Array(this.bones.length),n=0;n0},enumerable:!1,configurable:!0}),e.prototype.init=function(){},e.prototype.attach=function(e){var t=this;this._attachedCamera=e;var n=this._attachedCamera.getScene();this._onPrePointerObservableObserver=n.onPrePointerObservable.add((function(e){e.type!==En.Zp.POINTERDOWN?e.type===En.Zp.POINTERUP&&(t._isPointerDown=!1):t._isPointerDown=!0})),this._onAfterCheckInputsObserver=e.onAfterCheckInputsObservable.add((function(){if(!t._reachTargetAlpha()){var e=Ut.j.Now,n=0;null!=t._lastFrameTime&&(n=e-t._lastFrameTime),t._lastFrameTime=e,t._applyUserInteraction();var r=e-t._lastInteractionTime-t._idleRotationWaitTime,i=Math.max(Math.min(r/t._idleRotationSpinupTime,1),0);t._cameraRotationSpeed=t._idleRotationSpeed*i,t._attachedCamera&&(t._attachedCamera.alpha-=t._cameraRotationSpeed*(n/1e3))}}))},e.prototype.detach=function(){if(this._attachedCamera){var e=this._attachedCamera.getScene();this._onPrePointerObservableObserver&&e.onPrePointerObservable.remove(this._onPrePointerObservableObserver),this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver),this._attachedCamera=null,this._lastFrameTime=null}},e.prototype.resetLastInteractionTime=function(e){this._lastInteractionTime=null!=e?e:Ut.j.Now},e.prototype._reachTargetAlpha=function(){return!(!this._attachedCamera||!this.targetAlpha)&&Math.abs(this._attachedCamera.alpha-this.targetAlpha)r.upperRadiusLimit?r.upperRadiusLimit:i),i},e.prototype._maintainCameraAboveGround=function(){var t=this;if(!(this._elevationReturnTime<0)){var n=Ut.j.Now-this._lastInteractionTime,r=.5*Math.PI-this._defaultElevation,i=.5*Math.PI;if(this._attachedCamera&&!this._betaIsAnimating&&this._attachedCamera.beta>i&&n>=this._elevationReturnWaitTime){this._betaIsAnimating=!0,this.stopAllAnimations(),this._betaTransition||(this._betaTransition=w.X5.CreateAnimation("beta",w.X5.ANIMATIONTYPE_FLOAT,60,e.EasingFunction));var o=w.X5.TransitionTo("beta",r,this._attachedCamera,this._attachedCamera.getScene(),60,this._betaTransition,this._elevationReturnTime,(function(){t._clearAnimationLocks(),t.stopAllAnimations()}));o&&this._animatables.push(o)}}},e.prototype._clearAnimationLocks=function(){this._betaIsAnimating=!1},e.prototype._applyUserInteraction=function(){this.isUserIsMoving&&(this._lastInteractionTime=Ut.j.Now,this.stopAllAnimations(),this._clearAnimationLocks())},e.prototype.stopAllAnimations=function(){for(this._attachedCamera&&(this._attachedCamera.animations=[]);this._animatables.length;)this._animatables[0]&&(this._animatables[0].onAnimationEnd=null,this._animatables[0].stop()),this._animatables.shift()},Object.defineProperty(e.prototype,"isUserIsMoving",{get:function(){return!!this._attachedCamera&&(0!==this._attachedCamera.inertialAlphaOffset||0!==this._attachedCamera.inertialBetaOffset||0!==this._attachedCamera.inertialRadiusOffset||0!==this._attachedCamera.inertialPanningX||0!==this._attachedCamera.inertialPanningY||this._isPointerDown)},enumerable:!1,configurable:!0}),e.EasingFunction=new k.E8,e.EasingMode=k.KA.EASINGMODE_EASEINOUT,e.IgnoreBoundsSizeMode=0,e.FitFrustumSidesMode=1,e}(),Rn=function(e,t,n,r){void 0===t&&(t=new c.Pq),void 0===n&&(n=0),void 0===r&&(r=!1),this.direction=e,this.rotatedDirection=t,this.diff=n,this.ignore=r},An=function(){function e(e){this._ui=e,this.name="AttachToBoxBehavior",this.distanceAwayFromFace=.15,this.distanceAwayFromBottomOfFace=.15,this._faceVectors=[new Rn(c.Pq.Up()),new Rn(c.Pq.Down()),new Rn(c.Pq.Left()),new Rn(c.Pq.Right()),new Rn(c.Pq.Forward()),new Rn(c.Pq.Forward().scaleInPlace(-1))],this._tmpMatrix=new c.uq,this._tmpVector=new c.Pq,this._zeroVector=c.Pq.Zero(),this._lookAtTmpMatrix=new c.uq}return e.prototype.init=function(){},e.prototype._closestFace=function(e){for(var t=0,n=this._faceVectors;t1){if(e._setAllVisibility(e._ownerNode,1),e._hoverValue>e._time)return e._hoverValue=e._time,void e._detachObserver()}else if(e._ownerNode.visibility<0&&(e._setAllVisibility(e._ownerNode,0),e._hoverValue<0))return e._hoverValue=0,void e._detachObserver();e._attachObserver()}}}return Object.defineProperty(e.prototype,"delay",{get:function(){return this.fadeInDelay},set:function(e){this.fadeInDelay=e,this.fadeOutDelay=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"name",{get:function(){return"FadeInOut"},enumerable:!1,configurable:!0}),e.prototype.init=function(){},e.prototype.attach=function(e){this._ownerNode=e,this._setAllVisibility(this._ownerNode,0)},e.prototype.detach=function(){this._ownerNode=null},e.prototype.fadeIn=function(e){void 0===e&&(e=!0),this._delay=e?this.fadeInDelay:this.fadeOutDelay,this._time=e?this.fadeInTime:this.fadeOutTime,this._detachObserver(),this._ownerNode&&(e&&this._ownerNode.visibility>=1||!e&&this._ownerNode.visibility<=0)||(this._hovered=e,this._hovered||(this._delay*=-1),this._ownerNode.visibility>=1?this._hoverValue=this._time:this._ownerNode.visibility<=0&&(this._hoverValue=0),this._update())},e.prototype.fadeOut=function(){this.fadeIn(!1)},e.prototype._setAllVisibility=function(e,t){e.visibility=t;for(var n=0,r=e.getChildMeshes();nc.x)return!1}else if(i=1/this.direction.x,o=(l.x-this.origin.x)*i,(a=(c.x-this.origin.x)*i)===-1/0&&(a=1/0),o>a&&(s=o,o=a,a=s),(u=Math.max(o,u))>(h=Math.min(a,h)))return!1;if(Math.abs(this.direction.y)<1e-7){if(this.origin.yc.y)return!1}else if(i=1/this.direction.y,o=(l.y-this.origin.y)*i,(a=(c.y-this.origin.y)*i)===-1/0&&(a=1/0),o>a&&(s=o,o=a,a=s),(u=Math.max(o,u))>(h=Math.min(a,h)))return!1;if(Math.abs(this.direction.z)<1e-7){if(this.origin.zc.z)return!1}else if(i=1/this.direction.z,o=(l.z-this.origin.z)*i,(a=(c.z-this.origin.z)*i)===-1/0&&(a=1/0),o>a&&(s=o,o=a,a=s),(u=Math.max(o,u))>(h=Math.min(a,h)))return!1;return!0},e.prototype.intersectsBox=function(e,t){return void 0===t&&(t=0),this.intersectsBoxMinMax(e.minimum,e.maximum,t)},e.prototype.intersectsSphere=function(e,t){void 0===t&&(t=0);var n=e.center.x-this.origin.x,r=e.center.y-this.origin.y,i=e.center.z-this.origin.z,o=n*n+r*r+i*i,a=e.radius+t,s=a*a;if(o<=s)return!0;var l=n*this.direction.x+r*this.direction.y+i*this.direction.z;return!(l<0)&&o-l*l<=s},e.prototype.intersectsTriangle=function(t,n,r){var i=e._TmpVector3[0],o=e._TmpVector3[1],a=e._TmpVector3[2],s=e._TmpVector3[3],l=e._TmpVector3[4];n.subtractToRef(t,i),r.subtractToRef(t,o),c.Pq.CrossToRef(this.direction,o,a);var u=c.Pq.Dot(i,a);if(0===u)return null;var h=1/u;this.origin.subtractToRef(t,s);var d=c.Pq.Dot(s,a)*h;if(d<-this.epsilon||d>1+this.epsilon)return null;c.Pq.CrossToRef(s,i,l);var p=c.Pq.Dot(this.direction,l)*h;if(p<-this.epsilon||d+p>1+this.epsilon)return null;var f=c.Pq.Dot(o,l)*h;return f>this.length?null:new he(1-d-p,d,f)},e.prototype.intersectsPlane=function(e){var t,n=c.Pq.Dot(e.normal,this.direction);if(Math.abs(n)<9.99999997475243e-7)return null;var r=c.Pq.Dot(e.normal,this.origin);return(t=(-e.d-r)/n)<0?t<-9.99999997475243e-7?null:0:t},e.prototype.intersectsAxis=function(e,t){switch(void 0===t&&(t=0),e){case"y":return(n=(this.origin.y-t)/this.direction.y)>0?null:new c.Pq(this.origin.x+this.direction.x*-n,t,this.origin.z+this.direction.z*-n);case"x":return(n=(this.origin.x-t)/this.direction.x)>0?null:new c.Pq(t,this.origin.y+this.direction.y*-n,this.origin.z+this.direction.z*-n);case"z":var n;return(n=(this.origin.z-t)/this.direction.z)>0?null:new c.Pq(this.origin.x+this.direction.x*-n,this.origin.y+this.direction.y*-n,t);default:return null}},e.prototype.intersectsMesh=function(t,n,r,i,o,a){void 0===i&&(i=!1),void 0===a&&(a=!1);var s=c.AA.Matrix[0];return t.getWorldMatrix().invertToRef(s),this._tmpRay?e.TransformToRef(this,s,this._tmpRay):this._tmpRay=e.Transform(this,s),t.intersects(this._tmpRay,n,r,i,o,a)},e.prototype.intersectsMeshes=function(e,t,n){n?n.length=0:n=[];for(var r=0;rt.distance?1:0},e.prototype.intersectionSegment=function(t,n,r){var i=this.origin,o=c.AA.Vector3[0],a=c.AA.Vector3[1],s=c.AA.Vector3[2],l=c.AA.Vector3[3];n.subtractToRef(t,o),this.direction.scaleToRef(e._Rayl,s),i.addToRef(s,a),t.subtractToRef(i,l);var u,h,d=c.Pq.Dot(o,o),p=c.Pq.Dot(o,s),f=c.Pq.Dot(s,s),m=c.Pq.Dot(o,l),_=c.Pq.Dot(s,l),g=d*f-p*p,v=g,y=g;gv&&(u=v,h=_+p,y=f)),h<0?(h=0,-m<0?u=0:-m>d?u=v:(u=-m,v=d)):h>y&&(h=y,-m+p<0?u=0:-m+p>d?u=v:(u=-m+p,v=d));var b=Math.abs(u)0&&S<=this.length&&x.lengthSquared()=e.distance?null:c:null}function Un(e,t,n,r,i,o){for(var a=null,s=!!(e.activeCameras&&e.activeCameras.length>1&&e.cameraToUseForPointers!==e.activeCamera),l=e.cameraToUseForPointers||e.activeCamera,u=Dn.internalPickerForMesh||Vn,h=0;h1&&e.cameraToUseForPointers!==e.activeCamera),a=e.cameraToUseForPointers||e.activeCamera,s=Dn.internalPickerForMesh||Vn,l=0;l1)throw"Multiple drag modes specified in dragBehavior options. Only one expected"}return Object.defineProperty(e.prototype,"currentDraggingPointerID",{get:function(){return this.currentDraggingPointerId},set:function(e){this.currentDraggingPointerId=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"enabled",{get:function(){return this._enabled},set:function(e){e!=this._enabled&&this.onEnabledObservable.notifyObservers(e),this._enabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"options",{get:function(){return this._options},set:function(e){this._options=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"name",{get:function(){return"PointerDrag"},enumerable:!1,configurable:!0}),e.prototype.init=function(){},e.prototype.attach=function(t,n){var r=this;this._scene=t.getScene(),t.isNearGrabbable=!0,this.attachedNode=t,e._PlaneScene||(this._debugMode?e._PlaneScene=this._scene:(e._PlaneScene=new Vt.Z(this._scene.getEngine(),{virtual:!0}),e._PlaneScene.detachControl(),this._scene.onDisposeObservable.addOnce((function(){e._PlaneScene.dispose(),e._PlaneScene=null})))),this._dragPlane=Qn("pointerDragPlane",{size:this._debugMode?1:1e4,updatable:!1,sideOrientation:qe.DOUBLESIDE},e._PlaneScene),this.lastDragPosition=new c.Pq(0,0,0);var i=n||function(e){return r.attachedNode==e||e.isDescendantOf(r.attachedNode)};this._pointerObserver=this._scene.onPointerObservable.add((function(t){if(r.enabled)if(!r.dragging||r.currentDraggingPointerId!=t.event.pointerId||-1===t.event.button||t.event.button===r._activeDragButton||r.allowOtherButtonsDuringDrag){if(t.type==En.Zp.POINTERDOWN)r.startAndReleaseDragOnPointerEvents&&!r.dragging&&t.pickInfo&&t.pickInfo.hit&&t.pickInfo.pickedMesh&&t.pickInfo.pickedPoint&&t.pickInfo.ray&&i(t.pickInfo.pickedMesh)&&-1===r._activeDragButton&&-1!==r.dragButtons.indexOf(t.event.button)&&(r._activeDragButton=t.event.button,r._activePointerInfo=t,r._startDrag(t.event.pointerId,t.pickInfo.ray,t.pickInfo.pickedPoint));else if(t.type==En.Zp.POINTERUP)!r.startAndReleaseDragOnPointerEvents||r.currentDraggingPointerId!=t.event.pointerId||r._activeDragButton!==t.event.button&&-1!==r._activeDragButton||r.releaseDrag();else if(t.type==En.Zp.POINTERMOVE){var n=t.event.pointerId;if(r.currentDraggingPointerId===e._AnyMouseId&&n!==e._AnyMouseId){var o=t.event;("mouse"===o.pointerType||!r._scene.getEngine().hostInformation.isMobile&&o instanceof MouseEvent)&&(r._lastPointerRay[r.currentDraggingPointerId]&&(r._lastPointerRay[n]=r._lastPointerRay[r.currentDraggingPointerId],delete r._lastPointerRay[r.currentDraggingPointerId]),r.currentDraggingPointerId=n)}r._lastPointerRay[n]||(r._lastPointerRay[n]=new Nn(new c.Pq,new c.Pq)),t.pickInfo&&t.pickInfo.ray&&(r._lastPointerRay[n].origin.copyFrom(t.pickInfo.ray.origin),r._lastPointerRay[n].direction.copyFrom(t.pickInfo.ray.direction),r.currentDraggingPointerId==n&&r.dragging&&r._moveDrag(t.pickInfo.ray))}}else r.releaseDrag();else r._attachedToElement&&r.releaseDrag()})),this._beforeRenderObserver=this._scene.onBeforeRenderObservable.add((function(){if(r._moving&&r.moveAttached){var e=!1;Kn._RemoveAndStorePivotPoint(r.attachedNode),r._targetPosition.subtractToRef(r.attachedNode.absolutePosition,r._tmpVector),r._tmpVector.scaleInPlace(r.dragDeltaRatio),r.attachedNode.getAbsolutePosition().addToRef(r._tmpVector,r._tmpVector),r.validateDrag(r._tmpVector)&&(r.attachedNode.setAbsolutePosition(r._tmpVector),e=!0),Kn._RestorePivotPoint(r.attachedNode),e&&r.attachedNode.computeWorldMatrix()}}))},e.prototype.releaseDrag=function(){if(this.dragging&&(this.dragging=!1,this.onDragEndObservable.notifyObservers({dragPlanePoint:this.lastDragPosition,pointerId:this.currentDraggingPointerId,pointerInfo:this._activePointerInfo})),this.currentDraggingPointerId=-1,this._activeDragButton=-1,this._activePointerInfo=null,this._moving=!1,this.detachCameraControls&&this._attachedToElement&&this._scene.activeCamera&&!this._scene.activeCamera.leftCamera){if("ArcRotateCamera"===this._scene.activeCamera.getClassName()){var e=this._scene.activeCamera;e.attachControl(!e.inputs||e.inputs.noPreventDefault,e._useCtrlForPanning,e._panningMouseButton)}else this._scene.activeCamera.attachControl(!this._scene.activeCamera.inputs||this._scene.activeCamera.inputs.noPreventDefault);this._attachedToElement=!1}},e.prototype.startDrag=function(t,n,r){void 0===t&&(t=e._AnyMouseId),this._startDrag(t,n,r);var i=this._lastPointerRay[t];t===e._AnyMouseId&&(i=this._lastPointerRay[Object.keys(this._lastPointerRay)[0]]),i&&this._moveDrag(i)},e.prototype._startDrag=function(e,t,n){if(this._scene.activeCamera&&!this.dragging&&this.attachedNode){Kn._RemoveAndStorePivotPoint(this.attachedNode),t?(this._startDragRay.direction.copyFrom(t.direction),this._startDragRay.origin.copyFrom(t.origin)):(this._startDragRay.origin.copyFrom(this._scene.activeCamera.position),this.attachedNode.getWorldMatrix().getTranslationToRef(this._tmpVector),this._tmpVector.subtractToRef(this._scene.activeCamera.position,this._startDragRay.direction)),this._updateDragPlanePosition(this._startDragRay,n||this._tmpVector);var r=this._pickWithRayOnDragPlane(this._startDragRay);r?(this.dragging=!0,this.currentDraggingPointerId=e,this.lastDragPosition.copyFrom(r),this.onDragStartObservable.notifyObservers({dragPlanePoint:r,pointerId:this.currentDraggingPointerId,pointerInfo:this._activePointerInfo}),this._targetPosition.copyFrom(this.attachedNode.getAbsolutePosition()),this.detachCameraControls&&this._scene.activeCamera&&this._scene.activeCamera.inputs&&!this._scene.activeCamera.leftCamera&&(this._scene.activeCamera.inputs.attachedToElement?(this._scene.activeCamera.detachControl(),this._attachedToElement=!0):this._attachedToElement=!1)):this.releaseDrag(),Kn._RestorePivotPoint(this.attachedNode)}},e.prototype._moveDrag=function(e){this._moving=!0;var t=this._pickWithRayOnDragPlane(e);if(t){Kn._RemoveAndStorePivotPoint(this.attachedNode),this.updateDragPlane&&this._updateDragPlanePosition(e,t);var n=0;this._options.dragAxis?(this.useObjectOrientationForDragging?c.Pq.TransformCoordinatesToRef(this._options.dragAxis,this.attachedNode.getWorldMatrix().getRotationMatrix(),this._worldDragAxis):this._worldDragAxis.copyFrom(this._options.dragAxis),t.subtractToRef(this.lastDragPosition,this._tmpVector),this._worldDragAxis.normalize(),n=c.Pq.Dot(this._tmpVector,this._worldDragAxis),this._worldDragAxis.scaleToRef(n,this._dragDelta)):(n=this._dragDelta.length(),t.subtractToRef(this.lastDragPosition,this._dragDelta)),this._targetPosition.addInPlace(this._dragDelta),this.onDragObservable.notifyObservers({dragDistance:n,delta:this._dragDelta,dragPlanePoint:t,dragPlaneNormal:this._dragPlane.forward,pointerId:this.currentDraggingPointerId,pointerInfo:this._activePointerInfo}),this.lastDragPosition.copyFrom(t),Kn._RestorePivotPoint(this.attachedNode)}},e.prototype._pickWithRayOnDragPlane=function(e){if(!e)return null;var t=Math.acos(c.Pq.Dot(this._dragPlane.forward,e.direction));if(t>Math.PI/2&&(t=Math.PI-t),this.maxDragAngle>0&&t>this.maxDragAngle){if(this._useAlternatePickedPointAboveMaxDragAngle){this._tmpVector.copyFrom(e.direction),this.attachedNode.absolutePosition.subtractToRef(e.origin,this._alternatePickedPoint),this._alternatePickedPoint.normalize(),this._alternatePickedPoint.scaleInPlace(this._useAlternatePickedPointAboveMaxDragAngleDragSpeed*c.Pq.Dot(this._alternatePickedPoint,this._tmpVector)),this._tmpVector.addInPlace(this._alternatePickedPoint);var n=c.Pq.Dot(this._dragPlane.forward,this._tmpVector);return this._dragPlane.forward.scaleToRef(-n,this._alternatePickedPoint),this._alternatePickedPoint.addInPlace(this._tmpVector),this._alternatePickedPoint.addInPlace(this.attachedNode.absolutePosition),this._alternatePickedPoint}return null}var r=this._dragPlane.forward,i=this._dragPlane.position,o=e.direction.dot(r);if(Math.abs(o).999?Math.abs(c.Pq.Dot(c.Pq.UpReadOnly,this._pointC))>.999?this._lookAt.copyFrom(c.Pq.Right()):this._lookAt.copyFrom(c.Pq.UpReadOnly):(c.Pq.CrossToRef(this._localAxis,this._pointC,this._lookAt),c.Pq.CrossToRef(this._localAxis,this._lookAt,this._lookAt),this._lookAt.normalize()),this._dragPlane.position.copyFrom(this._pointA),this._pointA.addToRef(this._lookAt,this._lookAt),this._dragPlane.lookAt(this._lookAt)):this._options.dragPlaneNormal?(this.useObjectOrientationForDragging?c.Pq.TransformCoordinatesToRef(this._options.dragPlaneNormal,this.attachedNode.getWorldMatrix().getRotationMatrix(),this._localAxis):this._localAxis.copyFrom(this._options.dragPlaneNormal),this._dragPlane.position.copyFrom(this._pointA),this._pointA.addToRef(this._localAxis,this._lookAt),this._dragPlane.lookAt(this._lookAt)):(this._scene.activeCamera&&this._scene.activeCamera.getForwardRay().direction.normalizeToRef(this._localAxis),this._dragPlane.position.copyFrom(this._pointA),this._dragPlane.lookAt(this._pointA.add(this._localAxis))),this._dragPlane.position.copyFrom(this.attachedNode.getAbsolutePosition()),this._dragPlane.computeWorldMatrix(!0)},e.prototype.detach=function(){this._lastPointerRay={},this.attachedNode&&(this.attachedNode.isNearGrabbable=!1),this._pointerObserver&&this._scene.onPointerObservable.remove(this._pointerObserver),this._beforeRenderObserver&&this._scene.onBeforeRenderObservable.remove(this._beforeRenderObserver),this._dragPlane&&this._dragPlane.dispose(),this.releaseDrag()},e._AnyMouseId=-2,e}(),ir=function(){function e(){this._startDistance=0,this._initialScale=new c.Pq(0,0,0),this._targetScale=new c.Pq(0,0,0),this._sceneRenderObserver=null,this._dragBehaviorA=new rr({}),this._dragBehaviorA.moveAttached=!1,this._dragBehaviorB=new rr({}),this._dragBehaviorB.moveAttached=!1}return Object.defineProperty(e.prototype,"name",{get:function(){return"MultiPointerScale"},enumerable:!1,configurable:!0}),e.prototype.init=function(){},e.prototype._getCurrentDistance=function(){return this._dragBehaviorA.lastDragPosition.subtract(this._dragBehaviorB.lastDragPosition).length()},e.prototype.attach=function(e){var t=this;this._ownerNode=e,this._dragBehaviorA.onDragStartObservable.add((function(){t._dragBehaviorA.dragging&&t._dragBehaviorB.dragging&&(t._dragBehaviorA.currentDraggingPointerId==t._dragBehaviorB.currentDraggingPointerId?t._dragBehaviorA.releaseDrag():(t._initialScale.copyFrom(e.scaling),t._startDistance=t._getCurrentDistance()))})),this._dragBehaviorB.onDragStartObservable.add((function(){t._dragBehaviorA.dragging&&t._dragBehaviorB.dragging&&(t._dragBehaviorA.currentDraggingPointerId==t._dragBehaviorB.currentDraggingPointerId?t._dragBehaviorB.releaseDrag():(t._initialScale.copyFrom(e.scaling),t._startDistance=t._getCurrentDistance()))}));for(var n=0,r=[this._dragBehaviorA,this._dragBehaviorB];n.01&&e.scaling.addInPlace(n)}}))},e.prototype.detach=function(){this._ownerNode.getScene().onBeforeRenderObservable.remove(this._sceneRenderObserver);for(var e=0,t=[this._dragBehaviorA,this._dragBehaviorB];ed&&(d=Math.min(.01-h,0)),u.scaleInPlace(d),u.addToRef(i.pivotMesh.absolutePosition,this._tmpVector),i.pivotMesh.setAbsolutePosition(this._tmpVector),u.addToRef(i.dragMesh.absolutePosition,this._tmpVector),i.dragMesh.setAbsolutePosition(this._tmpVector)}},e.prototype.attach=function(t){var n=this;this._ownerNode=t,this._scene=this._ownerNode.getScene(),e._VirtualScene||(e._VirtualScene=new Vt.Z(this._scene.getEngine(),{virtual:!0}),e._VirtualScene.detachControl()),this._pointerObserver=this._scene.onPointerObservable.add((function(e){var t=e.event.pointerId;n._virtualMeshesInfo[t]||(n._virtualMeshesInfo[t]=n._createVirtualMeshInfo());var r,i=n._virtualMeshesInfo[t],o="xr-near"===e.event.pointerType||"xr"===e.event.pointerType,a="xr-near"===e.event.pointerType;if(e.type==En.Zp.POINTERDOWN){if(!i.dragging&&e.pickInfo&&e.pickInfo.hit&&e.pickInfo.pickedMesh&&e.pickInfo.pickedPoint&&e.pickInfo.ray&&(!a||e.pickInfo.aimTransform)&&(r=e.pickInfo.pickedMesh,n._ownerNode===r||r.isDescendantOf(n._ownerNode)&&(!n.draggableMeshes||-1!==n.draggableMeshes.indexOf(r)))){if((!n.allowMultiPointer||o)&&n.currentDraggingPointerIds.length>0)return;!n._pointerCamera||n._pointerCamera.cameraRigMode!==oe.i.RIG_MODE_NONE||n._pointerCamera._isLeftCamera||n._pointerCamera._isRightCamera||e.pickInfo.ray.origin.copyFrom(n._pointerCamera.globalPosition),n._ownerNode.computeWorldMatrix(!0);var s=n._virtualMeshesInfo[t];o?(n._dragging=e.pickInfo.originMesh?n._dragType.NEAR_DRAG:n._dragType.DRAG_WITH_CONTROLLER,s.originMesh.position.copyFrom(e.pickInfo.aimTransform.position),n._dragging===n._dragType.NEAR_DRAG&&e.pickInfo.gripTransform?s.originMesh.rotationQuaternion.copyFrom(e.pickInfo.gripTransform.rotationQuaternion):s.originMesh.rotationQuaternion.copyFrom(e.pickInfo.aimTransform.rotationQuaternion)):(n._dragging=n._dragType.DRAG,s.originMesh.position.copyFrom(e.pickInfo.ray.origin)),s.lastOriginPosition.copyFrom(s.originMesh.position),s.dragMesh.position.copyFrom(e.pickInfo.pickedPoint),s.lastDragPosition.copyFrom(e.pickInfo.pickedPoint),s.pivotMesh.position.copyFrom(n._ownerNode.getAbsolutePivotPoint()),s.pivotMesh.rotationQuaternion.copyFrom(n._ownerNode.absoluteRotationQuaternion),s.startingPosition.copyFrom(s.dragMesh.position),s.startingPivotPosition.copyFrom(s.pivotMesh.position),s.startingOrientation.copyFrom(s.dragMesh.rotationQuaternion),s.startingPivotOrientation.copyFrom(s.pivotMesh.rotationQuaternion),a?(s.originMesh.addChild(s.dragMesh),s.originMesh.addChild(s.pivotMesh)):s.originMesh.lookAt(s.dragMesh.position),s.dragging=!0,-1===n.currentDraggingPointerIds.indexOf(t)&&n.currentDraggingPointerIds.push(t),n.detachCameraControls&&n._pointerCamera&&!n._pointerCamera.leftCamera&&(n._pointerCamera.inputs&&n._pointerCamera.inputs.attachedToElement?(n._pointerCamera.detachControl(),n._attachedToElement=!0):n.allowMultiPointer&&0!==n.currentDraggingPointerIds.length||(n._attachedToElement=!1)),n._targetDragStart(s.pivotMesh.position,s.pivotMesh.rotationQuaternion,t),n.onDragStartObservable.notifyObservers({position:s.pivotMesh.position})}}else if(e.type==En.Zp.POINTERUP||e.type==En.Zp.POINTERDOUBLETAP){var l=n.currentDraggingPointerIds.indexOf(t);i.dragging=!1,-1!==l&&(n.currentDraggingPointerIds.splice(l,1),0===n.currentDraggingPointerIds.length&&(n._moving=!1,n._dragging=n._dragType.NONE,n.detachCameraControls&&n._attachedToElement&&n._pointerCamera&&!n._pointerCamera.leftCamera&&(n._reattachCameraControls(),n._attachedToElement=!1)),i.originMesh.removeChild(i.dragMesh),i.originMesh.removeChild(i.pivotMesh),n._targetDragEnd(t),n.onDragEndObservable.notifyObservers({}))}else if(e.type==En.Zp.POINTERMOVE&&-1!==(l=n.currentDraggingPointerIds.indexOf(t))&&i.dragging&&e.pickInfo&&(e.pickInfo.ray||e.pickInfo.aimTransform)){var c=n.zDragFactor;(n.currentDraggingPointerIds.length>1||e.pickInfo.originMesh)&&(c=0),n._ownerNode.computeWorldMatrix(!0),a?n._pointerUpdateXR(e.pickInfo.aimTransform,e.pickInfo.gripTransform,t,c):n._pointerUpdate2D(e.pickInfo.ray,t,c),n._tmpQuaternion.copyFrom(i.startingPivotOrientation),n._tmpQuaternion.x=-n._tmpQuaternion.x,n._tmpQuaternion.y=-n._tmpQuaternion.y,n._tmpQuaternion.z=-n._tmpQuaternion.z,i.pivotMesh.absoluteRotationQuaternion.multiplyToRef(n._tmpQuaternion,n._tmpQuaternion),i.pivotMesh.absolutePosition.subtractToRef(i.startingPivotPosition,n._tmpVector),n.onDragObservable.notifyObservers({delta:n._tmpVector,position:i.pivotMesh.position,pickInfo:e.pickInfo}),n._targetDrag(n._tmpVector,n._tmpQuaternion,t),i.lastDragPosition.copyFrom(i.dragMesh.absolutePosition),n._moving=!0}}))},e.prototype._applyZOffset=function(e,t,n){e.position.z-=e.position.z<1?t*n:t*n*e.position.z,e.position.z<0&&(e.position.z=0)},e.prototype._targetDragStart=function(e,t,n){},e.prototype._targetDrag=function(e,t,n){},e.prototype._targetDragEnd=function(e){},e.prototype._reattachCameraControls=function(){if(this._pointerCamera)if("ArcRotateCamera"===this._pointerCamera.getClassName()){var e=this._pointerCamera;e.attachControl(!e.inputs||e.inputs.noPreventDefault,e._useCtrlForPanning,e._panningMouseButton)}else this._pointerCamera.attachControl(!this._pointerCamera.inputs||this._pointerCamera.inputs.noPreventDefault)},e.prototype.detach=function(){for(var e in this._scene&&(this.detachCameraControls&&this._attachedToElement&&this._pointerCamera&&!this._pointerCamera.leftCamera&&(this._reattachCameraControls(),this._attachedToElement=!1),this._scene.onPointerObservable.remove(this._pointerObserver)),this._virtualMeshesInfo)this._virtualMeshesInfo[e].originMesh.dispose(),this._virtualMeshesInfo[e].dragMesh.dispose();this.onDragEndObservable.clear(),this.onDragObservable.clear(),this.onDragStartObservable.clear()},e}(),ar=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._sceneRenderObserver=null,t._targetPosition=new c.Pq(0,0,0),t._targetOrientation=new c.PT,t._targetScaling=new c.Pq(1,1,1),t._startingPosition=new c.Pq(0,0,0),t._startingOrientation=new c.PT,t._startingScaling=new c.Pq(1,1,1),t.onPositionChangedObservable=new l.cP,t.dragDeltaRatio=.2,t.rotateDraggedObject=!0,t.rotateAroundYOnly=!1,t.rotateWithMotionController=!0,t.disableMovement=!1,t.faceCameraOnDragStart=!1,t}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"SixDofDrag"},enumerable:!1,configurable:!0}),t.prototype.attach=function(t){var n=this;e.prototype.attach.call(this,t),t.isNearGrabbable=!0;for(var r=0,i=t.getChildMeshes();ru&&(c.PT.RotationAxisToRef(r,-l+u,a),t.rotateByQuaternionToRef(a,t),o=!0)}var h=this._angleBetweenVectorAndPlane(t,r)*(this._scene.useRightHandedSystem?-1:1),d=this.maxViewHorizontalDegrees*Math.PI/180*.5;return h<-d?(c.PT.RotationAxisToRef(i,-h-d,a),t.rotateByQuaternionToRef(a,t),o=!0):h>d&&(c.PT.RotationAxisToRef(i,-h+d,a),t.rotateByQuaternionToRef(a,t),o=!0),o},e.prototype._orientationClamp=function(e,t){var n,r=this._tmpVectors[0];r.copyFrom(e).scaleInPlace(-1).normalize();var i=this._tmpVectors[1],o=this._tmpVectors[2];i.copyFromFloats(0,1,0),c.Pq.CrossToRef(r,i,o);var a=o.length();athis.orientToCameraDeadzoneDegrees},e.prototype._updateLeashing=function(e){if(this.attachedNode&&this._enabled){var t=this.attachedNode.parent;this.attachedNode.setParent(null);var n=this.attachedNode.getWorldMatrix(),r=this._workingPosition,i=this._workingQuaternion,o=this.attachedNode.getPivotPoint(),a=this._tmpInvertView;a.copyFrom(e.getViewMatrix()),a.invert(),c.Pq.TransformCoordinatesToRef(o,n,r);var s=this._tmpPosition;s.copyFromFloats(0,0,0),c.Pq.TransformCoordinatesToRef(s,n,s),s.scaleInPlace(-1).subtractInPlace(o),r.subtractInPlace(e.globalPosition),this.ignoreCameraPitchAndRoll&&this._applyPitchOffset(a);var l=!1,u=this._tmpForward;u.copyFromFloats(0,0,this._scene.useRightHandedSystem?-1:1),c.Pq.TransformNormalToRef(u,a,u);var h=this._tmpNodeForward;if(h.copyFromFloats(0,0,this._scene.useRightHandedSystem?-1:1),c.Pq.TransformNormalToRef(h,n,h),this._recenterNextUpdate)r.copyFrom(u).scaleInPlace(this.defaultDistance);else if(this.ignoreAngleClamp){var d=r.length();r.copyFrom(u).scaleInPlace(d)}else l=this._angularClamp(a,r);var p=!1;this.ignoreDistanceClamp||(p=this._distanceClamp(r,l),this._applyVerticalClamp(r)),this.useFixedVerticalOffset&&(r.y=s.y-e.globalPosition.y+this.fixedVerticalOffset),(l||p||this._passedOrientationDeadzone(r,h)||this._recenterNextUpdate)&&this._orientationClamp(r,i),this._workingPosition.subtractInPlace(o),this._recenterNextUpdate=!1,this.attachedNode.setParent(t)}},e.prototype._updateTransformToGoal=function(e){if(this.attachedNode&&this.followedCamera&&this._enabled){this.attachedNode.rotationQuaternion||(this.attachedNode.rotationQuaternion=c.PT.Identity());var t=this.attachedNode.parent;if(this.attachedNode.setParent(null),!this.interpolatePose)return this.attachedNode.position.copyFrom(this.followedCamera.globalPosition).addInPlace(this._workingPosition),void this.attachedNode.rotationQuaternion.copyFrom(this._workingQuaternion);var n=new c.Pq;n.copyFrom(this.attachedNode.position).subtractInPlace(this.followedCamera.globalPosition),c.Pq.SmoothToRef(n,this._workingPosition,e,this.lerpTime,n),n.addInPlace(this.followedCamera.globalPosition),this.attachedNode.position.copyFrom(n);var r=new c.PT;r.copyFrom(this.attachedNode.rotationQuaternion),c.PT.SmoothToRef(r,this._workingQuaternion,e,this.lerpTime,this.attachedNode.rotationQuaternion),this.attachedNode.setParent(t)}},e.prototype._addObservables=function(){var e=this;this._lastTick=Date.now(),this._onBeforeRender=this._scene.onBeforeRenderObservable.add((function(){if(e.followedCamera){var t=Date.now();e._updateLeashing(e.followedCamera),e._updateTransformToGoal(t-e._lastTick),e._lastTick=t}}))},e.prototype._removeObservables=function(){this._onBeforeRender&&this._scene.onBeforeRenderObservable.remove(this._onBeforeRender)},e}(),ur=function(){function e(){}return e.ANCHOR_SYSTEM="xr-anchor-system",e.BACKGROUND_REMOVER="xr-background-remover",e.HIT_TEST="xr-hit-test",e.MESH_DETECTION="xr-mesh-detection",e.PHYSICS_CONTROLLERS="xr-physics-controller",e.PLANE_DETECTION="xr-plane-detection",e.POINTER_SELECTION="xr-controller-pointer-selection",e.TELEPORTATION="xr-controller-teleportation",e.FEATURE_POINTS="xr-feature-points",e.HAND_TRACKING="xr-hand-tracking",e.IMAGE_TRACKING="xr-image-tracking",e.NEAR_INTERACTION="xr-near-interaction",e.DOM_OVERLAY="xr-dom-overlay",e.MOVEMENT="xr-controller-movement",e.LIGHT_ESTIMATION="xr-light-estimation",e.EYE_TRACKING="xr-eye-tracking",e.WALKING_LOCOMOTION="xr-walking-locomotion",e.LAYERS="xr-layers",e.DEPTH_SENSING="xr-depth-sensing",e.SPACE_WARP="xr-space-warp",e.RAW_CAMERA_ACCESS="xr-raw-camera-access",e}(),hr=function(){function e(e){var t=this;this._xrSessionManager=e,this._features={},this._xrSessionManager.onXRSessionInit.add((function(){for(var e=0,n=t.getEnabledFeatures();ethis._AvailableFeatures[e].latest&&(this._AvailableFeatures[e].latest=n),r&&(this._AvailableFeatures[e].stable=n),this._AvailableFeatures[e][n]=t},e.ConstructFeature=function(e,t,n,r){void 0===t&&(t=1);var i=this._AvailableFeatures[e][t];if(!i)throw new Error("feature not found");return i(n,r)},e.GetAvailableFeatures=function(){return Object.keys(this._AvailableFeatures)},e.GetAvailableVersions=function(e){return Object.keys(this._AvailableFeatures[e])},e.GetLatestVersionOfFeature=function(e){return this._AvailableFeatures[e]&&this._AvailableFeatures[e].latest||-1},e.GetStableVersionOfFeature=function(e){return this._AvailableFeatures[e]&&this._AvailableFeatures[e].stable||-1},e.prototype.attachFeature=function(e){var t=this._features[e];t&&t.enabled&&!t.featureImplementation.attached&&(t.featureImplementation.attach()||Z.S0.Warn("Feature ".concat(e," failed to attach")))},e.prototype.detachFeature=function(e){var t=this._features[e];t&&t.featureImplementation.attached&&(t.featureImplementation.detach()||Z.S0.Warn("Feature ".concat(e," failed to detach")))},e.prototype.disableFeature=function(e){var t="string"==typeof e?e:e.Name,n=this._features[t];return!(!n||!n.enabled||(n.enabled=!1,this.detachFeature(t),n.featureImplementation.dispose(),delete this._features[t],0))},e.prototype.dispose=function(){for(var e=0,t=this.getEnabledFeatures();e0&&a.lengthSquared()-l2*this.palmUpStrictness-1&&(t=!0)}}this._node.setEnabled(t&&n)},e.prototype.detach=function(){this._scene.onBeforeRenderObservable.remove(this._sceneRenderObserver)},e.prototype.linkToXRExperience=function(e){var t=e.featuresManager?e.featuresManager:e;if(t){try{this._eyeTracking=t.getEnabledFeature(ur.EYE_TRACKING)}catch(e){}try{this._handTracking=t.getEnabledFeature(ur.HAND_TRACKING)}catch(e){Z.S0.Error("Hand tracking must be enabled for the Hand Menu to work")}}else Z.S0.Error("XR features manager must be available or provided directly for the Hand Menu to work")},e}(),fr=function(){function e(e,t,n){this.targetPosition=c.Pq.Zero(),this.poleTargetPosition=c.Pq.Zero(),this.poleTargetLocalOffset=c.Pq.Zero(),this.poleAngle=0,this.slerpAmount=1,this._bone1Quat=c.PT.Identity(),this._bone1Mat=c.uq.Identity(),this._bone2Ang=Math.PI,this._maxAngle=Math.PI,this._rightHandedSystem=!1,this._bendAxis=c.Pq.Right(),this._slerping=!1,this._adjustRoll=0,this._notEnoughInformation=!1,this._bone2=t;var r=t.getParent();if(!r)return this._notEnoughInformation=!0,void y.V.Error("BoneIKController: bone must have a parent for IK to work.");if(this._bone1=r,0===this._bone2.children.length&&!this._bone2.length)return this._notEnoughInformation=!0,void y.V.Error("BoneIKController: bone must not be a leaf or it should have a length for IK to work.");this.mesh=e,t.getSkeleton().computeAbsoluteMatrices();var i=t.getPosition();if(t.getAbsoluteMatrix().determinant()>0&&(this._rightHandedSystem=!0,this._bendAxis.x=0,this._bendAxis.y=0,this._bendAxis.z=-1,i.x>i.y&&i.x>i.z&&(this._adjustRoll=.5*Math.PI,this._bendAxis.z=1)),this._bone1.length&&this._bone2.length){var o=this._bone1.getScale(),a=this._bone2.getScale();this._bone1Length=this._bone1.length*o.y*this.mesh.scaling.y,this._bone2Length=this._bone2.length*a.y*this.mesh.scaling.y}else if(this._bone2.children[0]){e.computeWorldMatrix(!0);var s=this._bone2.children[0].getAbsolutePosition(e),l=this._bone2.getAbsolutePosition(e),u=this._bone1.getAbsolutePosition(e);this._bone2Length=c.Pq.Distance(s,l),this._bone1Length=c.Pq.Distance(l,u)}else e.computeWorldMatrix(!0),a=this._bone2.getScale(),this._bone2Length=this._bone2.length*a.y*this.mesh.scaling.y,l=this._bone2.getAbsolutePosition(e),u=this._bone1.getAbsolutePosition(e),this._bone1Length=c.Pq.Distance(l,u);this._bone1.getRotationMatrixToRef(1,e,this._bone1Mat),this.maxAngle=Math.PI,n&&(n.targetMesh&&(this.targetMesh=n.targetMesh,this.targetMesh.computeWorldMatrix(!0)),n.poleTargetMesh?(this.poleTargetMesh=n.poleTargetMesh,this.poleTargetMesh.computeWorldMatrix(!0)):n.poleTargetBone?this.poleTargetBone=n.poleTargetBone:this._bone1.getParent()&&(this.poleTargetBone=this._bone1.getParent()),n.poleTargetLocalOffset&&this.poleTargetLocalOffset.copyFrom(n.poleTargetLocalOffset),n.poleAngle&&(this.poleAngle=n.poleAngle),n.bendAxis&&this._bendAxis.copyFrom(n.bendAxis),n.maxAngle&&(this.maxAngle=n.maxAngle),n.slerpAmount&&(this.slerpAmount=n.slerpAmount))}return Object.defineProperty(e.prototype,"maxAngle",{get:function(){return this._maxAngle},set:function(e){this._setMaxAngle(e)},enumerable:!1,configurable:!0}),e.prototype._setMaxAngle=function(e){e<0&&(e=0),(e>Math.PI||null==e)&&(e=Math.PI),this._maxAngle=e;var t=this._bone1Length,n=this._bone2Length;this._maxReach=Math.sqrt(t*t+n*n-2*t*n*Math.cos(e))},e.prototype.update=function(){if(!this._notEnoughInformation){var t=this.targetPosition,n=this.poleTargetPosition,r=e._TmpMats[0],i=e._TmpMats[1];this.targetMesh&&t.copyFrom(this.targetMesh.getAbsolutePosition()),this.poleTargetBone?this.poleTargetBone.getAbsolutePositionFromLocalToRef(this.poleTargetLocalOffset,this.mesh,n):this.poleTargetMesh&&c.Pq.TransformCoordinatesToRef(this.poleTargetLocalOffset,this.poleTargetMesh.getWorldMatrix(),n);var o=e._TmpVecs[0],a=e._TmpVecs[1],s=e._TmpVecs[2],l=e._TmpVecs[3],u=e._TmpVecs[4],h=e._TmpQuat;this._bone1.getAbsolutePositionToRef(this.mesh,o),n.subtractToRef(o,u),0==u.x&&0==u.y&&0==u.z?u.y=1:u.normalize(),t.subtractToRef(o,l),l.normalize(),c.Pq.CrossToRef(l,u,a),a.normalize(),c.Pq.CrossToRef(l,a,s),s.normalize(),c.uq.FromXYZAxesToRef(s,l,a,r);var d=this._bone1Length,p=this._bone2Length,f=c.Pq.Distance(o,t);this._maxReach>0&&(f=Math.min(this._maxReach,f));var m=(p*p+f*f-d*d)/(2*p*f),_=(f*f+d*d-p*p)/(2*f*d);m>1&&(m=1),_>1&&(_=1),m<-1&&(m=-1),_<-1&&(_=-1);var g=Math.acos(m),v=Math.acos(_),y=-g-v;if(this._rightHandedSystem)c.uq.RotationYawPitchRollToRef(0,0,this._adjustRoll,i),i.multiplyToRef(r,r),c.uq.RotationAxisToRef(this._bendAxis,v,i),i.multiplyToRef(r,r);else{var b=e._TmpVecs[5];b.copyFrom(this._bendAxis),b.x*=-1,c.uq.RotationAxisToRef(b,-v,i),i.multiplyToRef(r,r)}this.poleAngle&&(c.uq.RotationAxisToRef(l,this.poleAngle,i),r.multiplyToRef(i,r)),this._bone1&&(this.slerpAmount<1?(this._slerping||c.PT.FromRotationMatrixToRef(this._bone1Mat,this._bone1Quat),c.PT.FromRotationMatrixToRef(r,h),c.PT.SlerpToRef(this._bone1Quat,h,this.slerpAmount,this._bone1Quat),y=this._bone2Ang*(1-this.slerpAmount)+y*this.slerpAmount,this._bone1.setRotationQuaternion(this._bone1Quat,1,this.mesh),this._slerping=!0):(this._bone1.setRotationMatrix(r,1,this.mesh),this._bone1Mat.copyFrom(r),this._slerping=!1),this._updateLinkedTransformRotation(this._bone1)),this._bone2.setAxisAngle(this._bendAxis,y,0),this._updateLinkedTransformRotation(this._bone2),this._bone2Ang=y}},e.prototype._updateLinkedTransformRotation=function(e){e._linkedTransformNode&&(e._linkedTransformNode.rotationQuaternion||(e._linkedTransformNode.rotationQuaternion=new c.PT),e.getRotationQuaternionToRef(0,null,e._linkedTransformNode.rotationQuaternion))},e._TmpVecs=[c.Pq.Zero(),c.Pq.Zero(),c.Pq.Zero(),c.Pq.Zero(),c.Pq.Zero(),c.Pq.Zero()],e._TmpQuat=c.PT.Identity(),e._TmpMats=[c.uq.Identity(),c.uq.Identity()],e}(),mr=function(){function e(e,t,n,r){if(this.upAxis=c.Pq.Up(),this.upAxisSpace=0,this.adjustYaw=0,this.adjustPitch=0,this.adjustRoll=0,this.slerpAmount=1,this._boneQuat=c.PT.Identity(),this._slerping=!1,this._firstFrameSkipped=!1,this._fowardAxis=c.Pq.Forward(),this.useAbsoluteValueForYaw=!1,this.mesh=e,this.bone=t,this.target=n,r){if(r.adjustYaw&&(this.adjustYaw=r.adjustYaw),r.adjustPitch&&(this.adjustPitch=r.adjustPitch),r.adjustRoll&&(this.adjustRoll=r.adjustRoll),null!=r.maxYaw?this.maxYaw=r.maxYaw:this.maxYaw=Math.PI,null!=r.minYaw?this.minYaw=r.minYaw:this.minYaw=-Math.PI,null!=r.maxPitch?this.maxPitch=r.maxPitch:this.maxPitch=Math.PI,null!=r.minPitch?this.minPitch=r.minPitch:this.minPitch=-Math.PI,null!=r.slerpAmount&&(this.slerpAmount=r.slerpAmount),null!=r.upAxis&&(this.upAxis=r.upAxis),null!=r.upAxisSpace&&(this.upAxisSpace=r.upAxisSpace),null!=r.yawAxis||null!=r.pitchAxis){var i=Ae._0.Y,o=Ae._0.X;null!=r.yawAxis&&(i=r.yawAxis.clone()).normalize(),null!=r.pitchAxis&&(o=r.pitchAxis.clone()).normalize();var a=c.Pq.Cross(o,i);this._transformYawPitch=c.uq.Identity(),c.uq.FromXYZAxesToRef(o,i,a,this._transformYawPitch),this._transformYawPitchInv=this._transformYawPitch.clone(),this._transformYawPitch.invert()}void 0!==r.useAbsoluteValueForYaw&&(this.useAbsoluteValueForYaw=r.useAbsoluteValueForYaw)}t.getParent()||2!=this.upAxisSpace||(this.upAxisSpace=0)}return Object.defineProperty(e.prototype,"minYaw",{get:function(){return this._minYaw},set:function(e){this._minYaw=e,this._minYawSin=Math.sin(e),this._minYawCos=Math.cos(e),null!=this._maxYaw&&(this._midYawConstraint=.5*this._getAngleDiff(this._minYaw,this._maxYaw)+this._minYaw,this._yawRange=this._maxYaw-this._minYaw)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxYaw",{get:function(){return this._maxYaw},set:function(e){this._maxYaw=e,this._maxYawSin=Math.sin(e),this._maxYawCos=Math.cos(e),null!=this._minYaw&&(this._midYawConstraint=.5*this._getAngleDiff(this._minYaw,this._maxYaw)+this._minYaw,this._yawRange=this._maxYaw-this._minYaw)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"minPitch",{get:function(){return this._minPitch},set:function(e){this._minPitch=e,this._minPitchTan=Math.tan(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxPitch",{get:function(){return this._maxPitch},set:function(e){this._maxPitch=e,this._maxPitchTan=Math.tan(e)},enumerable:!1,configurable:!0}),e.prototype.update=function(){if(this.slerpAmount<1&&!this._firstFrameSkipped)this._firstFrameSkipped=!0;else{var t=this.bone,n=e._TmpVecs[0];t.getAbsolutePositionToRef(this.mesh,n);var r=this.target,i=e._TmpMats[0],o=e._TmpMats[1],a=this.mesh,s=t.getParent(),l=e._TmpVecs[1];l.copyFrom(this.upAxis),2==this.upAxisSpace&&s?(this._transformYawPitch&&c.Pq.TransformCoordinatesToRef(l,this._transformYawPitchInv,l),s.getDirectionToRef(l,this.mesh,l)):0==this.upAxisSpace&&(a.getDirectionToRef(l,l),1==a.scaling.x&&1==a.scaling.y&&1==a.scaling.z||l.normalize());var u=!1,h=!1;if(this._maxYaw==Math.PI&&this._minYaw==-Math.PI||(u=!0),this._maxPitch==Math.PI&&this._minPitch==-Math.PI||(h=!0),u||h){var d=e._TmpMats[2],p=e._TmpMats[3];if(2==this.upAxisSpace&&1==l.y&&s)s.getRotationMatrixToRef(1,this.mesh,d);else if(0!=this.upAxisSpace||1!=l.y||s){var f=e._TmpVecs[2];f.copyFrom(this._fowardAxis),this._transformYawPitch&&c.Pq.TransformCoordinatesToRef(f,this._transformYawPitchInv,f),s?s.getDirectionToRef(f,this.mesh,f):a.getDirectionToRef(f,f);var m=c.Pq.Cross(l,f);m.normalize(),f=c.Pq.Cross(m,l),c.uq.FromXYZAxesToRef(m,l,f,d)}else d.copyFrom(a.getWorldMatrix());d.invertToRef(p);var _=null;if(h){var g=e._TmpVecs[3];r.subtractToRef(n,g),c.Pq.TransformCoordinatesToRef(g,p,g),_=Math.sqrt(g.x*g.x+g.z*g.z);var v=Math.atan2(g.y,_),y=v;v>this._maxPitch?(g.y=this._maxPitchTan*_,y=this._maxPitch):vthis._maxYaw||SMath.PI?this._isAngleBetween(b,this._maxYaw,this._midYawConstraint)?(g.z=this._maxYawCos*_,g.x=this._maxYawSin*_,T=this._maxYaw):this._isAngleBetween(b,this._midYawConstraint,this._minYaw)&&(g.z=this._minYawCos*_,g.x=this._minYawSin*_,T=this._minYaw):S>this._maxYaw?(g.z=this._maxYawCos*_,g.x=this._maxYawSin*_,b<0&&this.useAbsoluteValueForYaw&&(g.x*=-1),T=this._maxYaw):SMath.PI){var E=e._TmpVecs[8];E.copyFrom(Ae._0.Z),this._transformYawPitch&&c.Pq.TransformCoordinatesToRef(E,this._transformYawPitchInv,E);var x=e._TmpMats[4];this._boneQuat.toRotationMatrix(x),this.mesh.getWorldMatrix().multiplyToRef(x,x),c.Pq.TransformCoordinatesToRef(E,x,E),c.Pq.TransformCoordinatesToRef(E,p,E);var P=Math.atan2(E.x,E.z);if(this._getAngleBetween(P,b)>this._getAngleBetween(P,this._midYawConstraint)){null==_&&(_=Math.sqrt(g.x*g.x+g.z*g.z));var C=this._getAngleBetween(P,this._maxYaw);this._getAngleBetween(P,this._minYaw)Math.PI?n-=2*Math.PI:n<-Math.PI&&(n+=2*Math.PI),n},e.prototype._getAngleBetween=function(e,t){var n=0;return(n=(e=(e%=2*Math.PI)<0?e+2*Math.PI:e)<(t=(t%=2*Math.PI)<0?t+2*Math.PI:t)?t-e:e-t)>Math.PI&&(n=2*Math.PI-n),n},e.prototype._isAngleBetween=function(e,t,n){if(e=(e%=2*Math.PI)<0?e+2*Math.PI:e,(t=(t%=2*Math.PI)<0?t+2*Math.PI:t)<(n=(n%=2*Math.PI)<0?n+2*Math.PI:n)){if(e>t&&en&&e=2&&(this._leftStick={x:this.browserGamepad.axes[this._leftStickAxisX],y:this.browserGamepad.axes[this._leftStickAxisY]}),this.browserGamepad.axes.length>=4&&(this._rightStick={x:this.browserGamepad.axes[this._rightStickAxisX],y:this.browserGamepad.axes[this._rightStickAxisY]})}return Object.defineProperty(e.prototype,"isConnected",{get:function(){return this._isConnected},enumerable:!1,configurable:!0}),e.prototype.onleftstickchanged=function(e){this._onleftstickchanged=e},e.prototype.onrightstickchanged=function(e){this._onrightstickchanged=e},Object.defineProperty(e.prototype,"leftStick",{get:function(){return this._leftStick},set:function(e){!this._onleftstickchanged||this._leftStick.x===e.x&&this._leftStick.y===e.y||this._onleftstickchanged(e),this._leftStick=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rightStick",{get:function(){return this._rightStick},set:function(e){!this._onrightstickchanged||this._rightStick.x===e.x&&this._rightStick.y===e.y||this._onrightstickchanged(e),this._rightStick=e},enumerable:!1,configurable:!0}),e.prototype.update=function(){this._leftStick&&(this.leftStick={x:this.browserGamepad.axes[this._leftStickAxisX],y:this.browserGamepad.axes[this._leftStickAxisY]},this._invertLeftStickY&&(this.leftStick.y*=-1)),this._rightStick&&(this.rightStick={x:this.browserGamepad.axes[this._rightStickAxisX],y:this.browserGamepad.axes[this._rightStickAxisY]})},e.prototype.dispose=function(){},e.GAMEPAD=0,e.GENERIC=1,e.XBOX=2,e.POSE_ENABLED=3,e.DUALSHOCK=4,e}(),Cr=function(e){function t(t,n,r){var i=e.call(this,t,n,r)||this;return i.onButtonDownObservable=new l.cP,i.onButtonUpObservable=new l.cP,i.type=Pr.GENERIC,i._buttons=new Array(r.buttons.length),i}return(0,f.C6)(t,e),t.prototype.onbuttondown=function(e){this._onbuttondown=e},t.prototype.onbuttonup=function(e){this._onbuttonup=e},t.prototype._setButtonValue=function(e,t,n){return e!==t&&(1===e&&(this._onbuttondown&&this._onbuttondown(n),this.onButtonDownObservable.notifyObservers(n)),0===e&&(this._onbuttonup&&this._onbuttonup(n),this.onButtonUpObservable.notifyObservers(n))),e},t.prototype.update=function(){e.prototype.update.call(this);for(var t=0;t.005&&(e.inertialAlphaOffset+=n)}if(0!=t.y){var r=t.y/this.gamepadRotationSensibility*this._yAxisScale;0!=r&&Math.abs(r)>.005&&(e.inertialBetaOffset+=r)}}var i=this.gamepad.leftStick;if(i&&0!=i.y){var o=i.y/this.gamepadMoveSensibility;0!=o&&Math.abs(o)>.005&&(this.camera.inertialRadiusOffset-=o)}}},e.prototype.getClassName=function(){return"ArcRotateCameraGamepadInput"},e.prototype.getSimpleName=function(){return"gamepad"},(0,f.Cg)([(0,ce.lK)()],e.prototype,"gamepadRotationSensibility",void 0),(0,f.Cg)([(0,ce.lK)()],e.prototype,"gamepadMoveSensibility",void 0),e}();Tr.ArcRotateCameraGamepadInput=Rr;var Ar=n(6451),Ir=function(){function e(){this.keysUp=[38],this.keysDown=[40],this.keysLeft=[37],this.keysRight=[39],this.keysReset=[220],this.panningSensibility=50,this.zoomingSensibility=25,this.useAltToZoom=!0,this.angularSpeed=.01,this._keys=new Array}return e.prototype.attachControl=function(e){var t=this;e=Z.S0.BackCompatCameraNoPreventDefault(arguments),this._onCanvasBlurObserver||(this._scene=this.camera.getScene(),this._engine=this._scene.getEngine(),this._onCanvasBlurObserver=this._engine.onCanvasBlurObservable.add((function(){t._keys.length=0})),this._onKeyboardObserver=this._scene.onKeyboardObservable.add((function(n){var r,i=n.event;i.metaKey||(n.type===Ar.TB.KEYDOWN?(t._ctrlPressed=i.ctrlKey,t._altPressed=i.altKey,(-1!==t.keysUp.indexOf(i.keyCode)||-1!==t.keysDown.indexOf(i.keyCode)||-1!==t.keysLeft.indexOf(i.keyCode)||-1!==t.keysRight.indexOf(i.keyCode)||-1!==t.keysReset.indexOf(i.keyCode))&&(-1===(r=t._keys.indexOf(i.keyCode))&&t._keys.push(i.keyCode),i.preventDefault&&(e||i.preventDefault()))):-1===t.keysUp.indexOf(i.keyCode)&&-1===t.keysDown.indexOf(i.keyCode)&&-1===t.keysLeft.indexOf(i.keyCode)&&-1===t.keysRight.indexOf(i.keyCode)&&-1===t.keysReset.indexOf(i.keyCode)||((r=t._keys.indexOf(i.keyCode))>=0&&t._keys.splice(r,1),i.preventDefault&&(e||i.preventDefault())))})))},e.prototype.detachControl=function(){this._scene&&(this._onKeyboardObserver&&this._scene.onKeyboardObservable.remove(this._onKeyboardObserver),this._onCanvasBlurObserver&&this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver),this._onKeyboardObserver=null,this._onCanvasBlurObserver=null),this._keys.length=0},e.prototype.checkInputs=function(){if(this._onKeyboardObserver)for(var e=this.camera,t=0;t0?n/(1+this.wheelDeltaPercentage):n*(1+this.wheelDeltaPercentage)},e.prototype.attachControl=function(e){var t=this;e=Z.S0.BackCompatCameraNoPreventDefault(arguments),this._wheel=function(n){if(n.type===En.Zp.POINTERWHEEL){var r=n.event,i=0,o=r.deltaMode===yr.s.DOM_DELTA_LINE?40:1,a=-r.deltaY*o;if(t.customComputeDeltaFromMouseWheel)i=t.customComputeDeltaFromMouseWheel(a,t,r);else if(t.wheelDeltaPercentage){if((i=t._computeDeltaFromMouseWheelLegacyEvent(a,t.camera.radius))>0){for(var s=t.camera.radius,l=t.camera.inertialRadiusOffset+i,c=0;c<20&&!(s<=l)&&!(Math.abs(l*t.camera.inertia)<.001);c++)s-=l,l*=t.camera.inertia;s=(0,lr.Clamp)(s,0,Number.MAX_VALUE),i=t._computeDeltaFromMouseWheelLegacyEvent(a,s)}}else i=a/(40*t.wheelPrecision);i&&(t.zoomToMouseLocation?(t._hitPlane||t._updateHitPlane(),t._zoomToMouse(i)):t.camera.inertialRadiusOffset+=i),r.preventDefault&&(e||r.preventDefault())}},this._observer=this.camera.getScene()._inputManager._addCameraPointerObserver(this._wheel,En.Zp.POINTERWHEEL),this.zoomToMouseLocation&&this._inertialPanning.setAll(0)},e.prototype.detachControl=function(){this._observer&&(this.camera.getScene()._inputManager._removeCameraPointerObserver(this._observer),this._observer=null,this._wheel=null)},e.prototype.checkInputs=function(){if(this.zoomToMouseLocation){var e=this.camera;0+e.inertialAlphaOffset+e.inertialBetaOffset+e.inertialRadiusOffset&&(this._updateHitPlane(),e.target.addInPlace(this._inertialPanning),this._inertialPanning.scaleInPlace(e.inertia),this._zeroIfClose(this._inertialPanning))}},e.prototype.getClassName=function(){return"ArcRotateCameraMouseWheelInput"},e.prototype.getSimpleName=function(){return"mousewheel"},e.prototype._updateHitPlane=function(){var e=this.camera,t=e.target.subtract(e.position);this._hitPlane=Ne.Z.FromPositionAndNormal(e.target,t)},e.prototype._getPosition=function(){var e,t=this.camera,n=t.getScene(),r=n.createPickingRay(n.pointerX,n.pointerY,c.uq.Identity(),t,!1);0===t.targetScreenOffset.x&&0===t.targetScreenOffset.y||(this._viewOffset.set(t.targetScreenOffset.x,t.targetScreenOffset.y,0),t.getViewMatrix().invertToRef(t._cameraTransformMatrix),this._globalOffset=c.Pq.TransformNormal(this._viewOffset,t._cameraTransformMatrix),r.origin.addInPlace(this._globalOffset));var i=0;return this._hitPlane&&(i=null!==(e=r.intersectsPlane(this._hitPlane))&&void 0!==e?e:0),r.origin.addInPlace(r.direction.scaleInPlace(i))},e.prototype._zoomToMouse=function(e){var t,n,r=this.camera,i=1-r.inertia;if(r.lowerRadiusLimit){var o=null!==(t=r.lowerRadiusLimit)&&void 0!==t?t:0;r.radius-(r.inertialRadiusOffset+e)/ia&&(e=(r.radius-a)*i-r.inertialRadiusOffset)}var s=e/i/r.radius,l=this._getPosition(),u=c.AA.Vector3[6];l.subtractToRef(r.target,u),u.scaleInPlace(s),u.scaleInPlace(i),this._inertialPanning.addInPlace(u),r.inertialRadiusOffset+=e},e.prototype._zeroIfClose=function(e){Math.abs(e.x)this.camera.pinchToPanMaxDistance?(this._computePinchZoom(n,r),this._isPinching=!0):this._computeMultiTouchPanning(i,o)):this.multiTouchPanning?this._computeMultiTouchPanning(i,o):this.pinchZoom&&this._computePinchZoom(n,r))},t.prototype.onButtonDown=function(e){this._isPanClick=e.button===this.camera._panningMouseButton},t.prototype.onButtonUp=function(e){this._twoFingerActivityCount=0,this._isPinching=!1},t.prototype.onLostFocus=function(){this._isPanClick=!1,this._twoFingerActivityCount=0,this._isPinching=!1},t.MinimumRadiusForPinch=.001,(0,f.Cg)([(0,ce.lK)()],t.prototype,"buttons",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"angularSensibilityX",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"angularSensibilityY",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"pinchPrecision",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"pinchDeltaPercentage",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"useNaturalPinchZoom",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"pinchZoom",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"panningSensibility",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"multiTouchPanning",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"multiTouchPanAndZoom",void 0),t}(Sr);Tr.ArcRotateCameraPointersInput=Mr;var Dr=function(e){function t(t){return e.call(this,t)||this}return(0,f.C6)(t,e),t.prototype.addMouseWheel=function(){return this.add(new Or),this},t.prototype.addPointers=function(){return this.add(new Mr),this},t.prototype.addKeyboard=function(){return this.add(new Ir),this},t}(Er);Dr.prototype.addVRDeviceOrientation=function(){return this.add(new Nr),this};var Nr=function(){function e(){var e=this;this.alphaCorrection=1,this.gammaCorrection=1,this._alpha=0,this._gamma=0,this._dirty=!1,this._deviceOrientationHandler=function(t){return e._onOrientationEvent(t)}}return e.prototype.attachControl=function(e){var t=this;e=Z.S0.BackCompatCameraNoPreventDefault(arguments),this.camera.attachControl(e);var n=this.camera.getScene().getEngine().getHostWindow();n&&("undefined"!=typeof DeviceOrientationEvent&&"function"==typeof DeviceOrientationEvent.requestPermission?DeviceOrientationEvent.requestPermission().then((function(e){"granted"===e?n.addEventListener("deviceorientation",t._deviceOrientationHandler):Z.S0.Warn("Permission not granted.")})).catch((function(e){Z.S0.Error(e)})):n.addEventListener("deviceorientation",this._deviceOrientationHandler))},e.prototype._onOrientationEvent=function(e){null!==e.alpha&&(this._alpha=(0|+e.alpha)*this.alphaCorrection),null!==e.gamma&&(this._gamma=(0|+e.gamma)*this.gammaCorrection),this._dirty=!0},e.prototype.checkInputs=function(){this._dirty&&(this._dirty=!1,this._gamma<0&&(this._gamma=180+this._gamma),this.camera.alpha=-this._alpha/180*Math.PI%Math.PI*2,this.camera.beta=this._gamma/180*Math.PI)},e.prototype.detachControl=function(){window.removeEventListener("deviceorientation",this._deviceOrientationHandler)},e.prototype.getClassName=function(){return"ArcRotateCameraVRDeviceOrientationInput"},e.prototype.getSimpleName=function(){return"VRDeviceOrientation"},e}();Tr.ArcRotateCameraVRDeviceOrientationInput=Nr;var Fr=function(){function e(){this.keysForward=[87],this.keysBackward=[83],this.keysUp=[69],this.keysDown=[81],this.keysRight=[68],this.keysLeft=[65],this._keys=new Array}return e.prototype.attachControl=function(e){var t=this;e=Z.S0.BackCompatCameraNoPreventDefault(arguments),this._onCanvasBlurObserver||(this._scene=this.camera.getScene(),this._engine=this._scene.getEngine(),this._onCanvasBlurObserver=this._engine.onCanvasBlurObservable.add((function(){t._keys.length=0})),this._onKeyboardObserver=this._scene.onKeyboardObservable.add((function(n){var r,i=n.event;n.type===Ar.TB.KEYDOWN?-1===t.keysForward.indexOf(i.keyCode)&&-1===t.keysBackward.indexOf(i.keyCode)&&-1===t.keysUp.indexOf(i.keyCode)&&-1===t.keysDown.indexOf(i.keyCode)&&-1===t.keysLeft.indexOf(i.keyCode)&&-1===t.keysRight.indexOf(i.keyCode)||(-1===(r=t._keys.indexOf(i.keyCode))&&t._keys.push(i.keyCode),e||i.preventDefault()):-1===t.keysForward.indexOf(i.keyCode)&&-1===t.keysBackward.indexOf(i.keyCode)&&-1===t.keysUp.indexOf(i.keyCode)&&-1===t.keysDown.indexOf(i.keyCode)&&-1===t.keysLeft.indexOf(i.keyCode)&&-1===t.keysRight.indexOf(i.keyCode)||((r=t._keys.indexOf(i.keyCode))>=0&&t._keys.splice(r,1),e||i.preventDefault())})))},e.prototype.detachControl=function(){this._scene&&(this._onKeyboardObserver&&this._scene.onKeyboardObservable.remove(this._onKeyboardObserver),this._onCanvasBlurObserver&&this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver),this._onKeyboardObserver=null,this._onCanvasBlurObserver=null),this._keys.length=0},e.prototype.getClassName=function(){return"FlyCameraKeyboardInput"},e.prototype._onLostFocus=function(){this._keys.length=0},e.prototype.getSimpleName=function(){return"keyboard"},e.prototype.checkInputs=function(){if(this._onKeyboardObserver)for(var e=this.camera,t=0;t=0&&t._keys.splice(r,1),i.preventDefault&&(e||i.preventDefault())))})))},e.prototype.detachControl=function(){this._scene&&(this._onKeyboardObserver&&this._scene.onKeyboardObservable.remove(this._onKeyboardObserver),this._onCanvasBlurObserver&&this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver),this._onKeyboardObserver=null,this._onCanvasBlurObserver=null),this._keys.length=0},e.prototype.checkInputs=function(){if(this._onKeyboardObserver)for(var e=0,t=this._keys;e=0&&t._keys.splice(r,1),e||i.preventDefault()))})))},e.prototype.detachControl=function(){this._scene&&(this._onKeyboardObserver&&this._scene.onKeyboardObservable.remove(this._onKeyboardObserver),this._onCanvasBlurObserver&&this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver),this._onKeyboardObserver=null,this._onCanvasBlurObserver=null),this._keys.length=0},e.prototype.checkInputs=function(){if(this._onKeyboardObserver)for(var e=this.camera,t=0;t1)e.cameraRotation.x=-this._offsetY*t/this.touchAngularSensibility;else{var n=e._computeLocalCameraSpeed(),r=new c.Pq(0,0,0!==this.touchMoveSensibility?n*this._offsetY/this.touchMoveSensibility:0);c.uq.RotationYawPitchRollToRef(e.rotation.y,e.rotation.x,0,e._cameraRotationMatrix),e.cameraDirection.addInPlace(c.Pq.TransformCoordinates(r,e._cameraRotationMatrix))}}},e.prototype.getClassName=function(){return"FreeCameraTouchInput"},e.prototype.getSimpleName=function(){return"touch"},(0,f.Cg)([(0,ce.lK)()],e.prototype,"touchAngularSensibility",void 0),(0,f.Cg)([(0,ce.lK)()],e.prototype,"touchMoveSensibility",void 0),e}();Tr.FreeCameraTouchInput=Wr;var Hr=function(e){function t(t){var n=e.call(this,t)||this;return n._mouseInput=null,n._mouseWheelInput=null,n}return(0,f.C6)(t,e),t.prototype.addKeyboard=function(){return this.add(new Ur),this},t.prototype.addMouse=function(e){return void 0===e&&(e=!0),this._mouseInput||(this._mouseInput=new kr(e),this.add(this._mouseInput)),this},t.prototype.removeMouse=function(){return this._mouseInput&&this.remove(this._mouseInput),this},t.prototype.addMouseWheel=function(){return this._mouseWheelInput||(this._mouseWheelInput=new zr,this.add(this._mouseWheelInput)),this},t.prototype.removeMouseWheel=function(){return this._mouseWheelInput&&this.remove(this._mouseWheelInput),this},t.prototype.addTouch=function(){return this.add(new Wr),this},t.prototype.clear=function(){e.prototype.clear.call(this),this._mouseInput=null},t}(Er);Hr.prototype.addDeviceOrientation=function(e){return this._deviceOrientationInput||(this._deviceOrientationInput=new Yr,e&&(this._deviceOrientationInput.smoothFactor=e),this.add(this._deviceOrientationInput)),this};var Yr=function(){function e(){var e=this;this._screenOrientationAngle=0,this._screenQuaternion=new c.PT,this._alpha=0,this._beta=0,this._gamma=0,this.smoothFactor=0,this._onDeviceOrientationChangedObservable=new l.cP,this._orientationChanged=function(){e._screenOrientationAngle=void 0!==window.orientation?+window.orientation:window.screen.orientation&&window.screen.orientation.angle?window.screen.orientation.angle:0,e._screenOrientationAngle=-Z.S0.ToRadians(e._screenOrientationAngle/2),e._screenQuaternion.copyFromFloats(0,Math.sin(e._screenOrientationAngle),0,Math.cos(e._screenOrientationAngle))},this._deviceOrientation=function(t){e.smoothFactor?(e._alpha=null!==t.alpha?Z.S0.SmoothAngleChange(e._alpha,t.alpha,e.smoothFactor):0,e._beta=null!==t.beta?Z.S0.SmoothAngleChange(e._beta,t.beta,e.smoothFactor):0,e._gamma=null!==t.gamma?Z.S0.SmoothAngleChange(e._gamma,t.gamma,e.smoothFactor):0):(e._alpha=null!==t.alpha?t.alpha:0,e._beta=null!==t.beta?t.beta:0,e._gamma=null!==t.gamma?t.gamma:0),null!==t.alpha&&e._onDeviceOrientationChangedObservable.notifyObservers()},this._constantTransform=new c.PT(-Math.sqrt(.5),0,0,Math.sqrt(.5)),this._orientationChanged()}return e.WaitForOrientationChangeAsync=function(e){return(0,f.sH)(this,void 0,void 0,(function(){return(0,f.YH)(this,(function(t){switch(t.label){case 0:return[4,new Promise((function(t,n){var r=!1,i=function(){window.removeEventListener("deviceorientation",i),r=!0,t()};e&&setTimeout((function(){r||(window.removeEventListener("deviceorientation",i),n("WaitForOrientationChangeAsync timed out"))}),e),"undefined"!=typeof DeviceOrientationEvent&&"function"==typeof DeviceOrientationEvent.requestPermission?DeviceOrientationEvent.requestPermission().then((function(e){"granted"==e?window.addEventListener("deviceorientation",i):Z.S0.Warn("Permission not granted.")})).catch((function(e){Z.S0.Error(e)})):window.addEventListener("deviceorientation",i)}))];case 1:return[2,t.sent()]}}))}))},Object.defineProperty(e.prototype,"camera",{get:function(){return this._camera},set:function(e){var t=this;this._camera=e,null==this._camera||this._camera.rotationQuaternion||(this._camera.rotationQuaternion=new c.PT),this._camera&&this._camera.onDisposeObservable.add((function(){t._onDeviceOrientationChangedObservable.clear()}))},enumerable:!1,configurable:!0}),e.prototype.attachControl=function(){var e=this,t=this.camera.getScene().getEngine().getHostWindow();if(t){var n=function(){t.addEventListener("orientationchange",e._orientationChanged),t.addEventListener("deviceorientation",e._deviceOrientation),e._orientationChanged()};"undefined"!=typeof DeviceOrientationEvent&&"function"==typeof DeviceOrientationEvent.requestPermission?DeviceOrientationEvent.requestPermission().then((function(e){"granted"===e?n():Z.S0.Warn("Permission not granted.")})).catch((function(e){Z.S0.Error(e)})):n()}},e.prototype.detachControl=function(){window.removeEventListener("orientationchange",this._orientationChanged),window.removeEventListener("deviceorientation",this._deviceOrientation),this._alpha=0},e.prototype.checkInputs=function(){this._alpha&&(c.PT.RotationYawPitchRollToRef(Z.S0.ToRadians(this._alpha),Z.S0.ToRadians(this._beta),-Z.S0.ToRadians(this._gamma),this.camera.rotationQuaternion),this._camera.rotationQuaternion.multiplyInPlace(this._screenQuaternion),this._camera.rotationQuaternion.multiplyInPlace(this._constantTransform),this._camera.getScene().useRightHandedSystem?this._camera.rotationQuaternion.y*=-1:this._camera.rotationQuaternion.z*=-1,this._camera.rotationQuaternion.w*=-1)},e.prototype.getClassName=function(){return"FreeCameraDeviceOrientationInput"},e.prototype.getSimpleName=function(){return"deviceOrientation"},e}();Tr.FreeCameraDeviceOrientationInput=Yr;var Xr=function(){function e(){this.gamepadAngularSensibility=200,this.gamepadMoveSensibility=40,this.deadzoneDelta=.1,this._yAxisScale=1,this._cameraTransform=c.uq.Identity(),this._deltaTransform=c.Pq.Zero(),this._vector3=c.Pq.Zero(),this._vector2=c.I9.Zero()}return Object.defineProperty(e.prototype,"invertYAxis",{get:function(){return 1!==this._yAxisScale},set:function(e){this._yAxisScale=e?-1:1},enumerable:!1,configurable:!0}),e.prototype.attachControl=function(){var e=this,t=this.camera.getScene().gamepadManager;this._onGamepadConnectedObserver=t.onGamepadConnectedObservable.add((function(t){t.type!==Pr.POSE_ENABLED&&(e.gamepad&&t.type!==Pr.XBOX||(e.gamepad=t))})),this._onGamepadDisconnectedObserver=t.onGamepadDisconnectedObservable.add((function(t){e.gamepad===t&&(e.gamepad=null)})),this.gamepad=t.getGamepadByType(Pr.XBOX),!this.gamepad&&t.gamepads.length&&(this.gamepad=t.gamepads[0])},e.prototype.detachControl=function(){this.camera.getScene().gamepadManager.onGamepadConnectedObservable.remove(this._onGamepadConnectedObserver),this.camera.getScene().gamepadManager.onGamepadDisconnectedObservable.remove(this._onGamepadDisconnectedObserver),this.gamepad=null},e.prototype.checkInputs=function(){if(this.gamepad&&this.gamepad.leftStick){var e=this.camera,t=this.gamepad.leftStick;0!==this.gamepadMoveSensibility&&(t.x=Math.abs(t.x)>this.deadzoneDelta?t.x/this.gamepadMoveSensibility:0,t.y=Math.abs(t.y)>this.deadzoneDelta?t.y/this.gamepadMoveSensibility:0);var n=this.gamepad.rightStick;n&&0!==this.gamepadAngularSensibility?(n.x=Math.abs(n.x)>this.deadzoneDelta?n.x/this.gamepadAngularSensibility:0,n.y=(Math.abs(n.y)>this.deadzoneDelta?n.y/this.gamepadAngularSensibility:0)*this._yAxisScale):n={x:0,y:0},e.rotationQuaternion?e.rotationQuaternion.toRotationMatrix(this._cameraTransform):c.uq.RotationYawPitchRollToRef(e.rotation.y,e.rotation.x,0,this._cameraTransform);var r=50*e._computeLocalCameraSpeed();this._vector3.copyFromFloats(t.x*r,0,-t.y*r),c.Pq.TransformCoordinatesToRef(this._vector3,this._cameraTransform,this._deltaTransform),e.cameraDirection.addInPlace(this._deltaTransform),this._vector2.copyFromFloats(n.y,n.x),e.cameraRotation.addInPlace(this._vector2)}},e.prototype.getClassName=function(){return"FreeCameraGamepadInput"},e.prototype.getSimpleName=function(){return"gamepad"},(0,f.Cg)([(0,ce.lK)()],e.prototype,"gamepadAngularSensibility",void 0),(0,f.Cg)([(0,ce.lK)()],e.prototype,"gamepadMoveSensibility",void 0),e}();Tr.FreeCameraGamepadInput=Xr;var jr,qr=n(59437);!function(e){e[e.X=0]="X",e[e.Y=1]="Y",e[e.Z=2]="Z"}(jr||(jr={}));var Kr=function(){function e(t,n){var r=this;this._released=!1;var i=(0,f.Cl)((0,f.Cl)({},e._GetDefaultOptions()),n);if(this._leftJoystick=!!t,e._GlobalJoystickIndex++,this._axisTargetedByLeftAndRight=0,this._axisTargetedByUpAndDown=1,this.reverseLeftRight=!1,this.reverseUpDown=!1,this._touches=new qr.w,this.deltaPosition=c.Pq.Zero(),this._joystickSensibility=25,this._inversedSensibility=1/(this._joystickSensibility/1e3),this._onResize=function(){e._VjCanvasWidth=window.innerWidth,e._VjCanvasHeight=window.innerHeight,e.Canvas&&(e.Canvas.width=e._VjCanvasWidth,e.Canvas.height=e._VjCanvasHeight),e._HalfWidth=e._VjCanvasWidth/2},!e.Canvas){window.addEventListener("resize",this._onResize,!1),e.Canvas=document.createElement("canvas"),e._VjCanvasWidth=window.innerWidth,e._VjCanvasHeight=window.innerHeight,e.Canvas.width=window.innerWidth,e.Canvas.height=window.innerHeight,e.Canvas.style.width="100%",e.Canvas.style.height="100%",e.Canvas.style.position="absolute",e.Canvas.style.backgroundColor="transparent",e.Canvas.style.top="0px",e.Canvas.style.left="0px",e.Canvas.style.zIndex="5",e.Canvas.style.touchAction="none",e.Canvas.setAttribute("touch-action","none");var o=e.Canvas.getContext("2d");if(!o)throw new Error("Unable to create canvas for virtual joystick");e._VjCanvasContext=o,e._VjCanvasContext.strokeStyle="#ffffff",e._VjCanvasContext.lineWidth=2,document.body.appendChild(e.Canvas)}e._HalfWidth=e.Canvas.width/2,this.pressed=!1,this.limitToContainer=i.limitToContainer,this._joystickColor=i.color,this.containerSize=i.containerSize,this.puckSize=i.puckSize,i.position&&this.setPosition(i.position.x,i.position.y),i.puckImage&&this.setPuckImage(i.puckImage),i.containerImage&&this.setContainerImage(i.containerImage),i.alwaysVisible&&e._AlwaysVisibleSticks++,this.alwaysVisible=i.alwaysVisible,this._joystickPointerId=-1,this._joystickPointerPos=new c.I9(0,0),this._joystickPreviousPointerPos=new c.I9(0,0),this._joystickPointerStartPos=new c.I9(0,0),this._deltaJoystickVector=new c.I9(0,0),this._onPointerDownHandlerRef=function(e){r._onPointerDown(e)},this._onPointerMoveHandlerRef=function(e){r._onPointerMove(e)},this._onPointerUpHandlerRef=function(e){r._onPointerUp(e)},e.Canvas.addEventListener("pointerdown",this._onPointerDownHandlerRef,!1),e.Canvas.addEventListener("pointermove",this._onPointerMoveHandlerRef,!1),e.Canvas.addEventListener("pointerup",this._onPointerUpHandlerRef,!1),e.Canvas.addEventListener("pointerout",this._onPointerUpHandlerRef,!1),e.Canvas.addEventListener("pointercancel",this._onPointerUpHandlerRef,!1),e.Canvas.addEventListener("contextmenu",(function(e){e.preventDefault()}),!1),requestAnimationFrame((function(){r._drawVirtualJoystick()}))}return e._GetDefaultOptions=function(){return{puckSize:40,containerSize:60,color:"cyan",puckImage:void 0,containerImage:void 0,position:void 0,alwaysVisible:!1,limitToContainer:!1}},e.prototype.setJoystickSensibility=function(e){this._joystickSensibility=e,this._inversedSensibility=1/(this._joystickSensibility/1e3)},e.prototype._onPointerDown=function(t){t.preventDefault(),(!0===this._leftJoystick?t.clientXe._HalfWidth)&&this._joystickPointerId<0?(this._joystickPointerId=t.pointerId,this._joystickPosition?(this._joystickPointerStartPos=this._joystickPosition.clone(),this._joystickPointerPos=this._joystickPosition.clone(),this._joystickPreviousPointerPos=this._joystickPosition.clone(),this._onPointerMove(t)):(this._joystickPointerStartPos.x=t.clientX,this._joystickPointerStartPos.y=t.clientY,this._joystickPointerPos=this._joystickPointerStartPos.clone(),this._joystickPreviousPointerPos=this._joystickPointerStartPos.clone()),this._deltaJoystickVector.x=0,this._deltaJoystickVector.y=0,this.pressed=!0,this._touches.add(t.pointerId.toString(),t)):e._GlobalJoystickIndex<2&&this._action&&(this._action(),this._touches.add(t.pointerId.toString(),{x:t.clientX,y:t.clientY,prevX:t.clientX,prevY:t.clientY}))},e.prototype._onPointerMove=function(t){if(this._joystickPointerId==t.pointerId){if(this.limitToContainer){var n=new c.I9(t.clientX-this._joystickPointerStartPos.x,t.clientY-this._joystickPointerStartPos.y),r=n.length();r>this.containerSize&&n.scaleInPlace(this.containerSize/r),this._joystickPointerPos.x=this._joystickPointerStartPos.x+n.x,this._joystickPointerPos.y=this._joystickPointerStartPos.y+n.y}else this._joystickPointerPos.x=t.clientX,this._joystickPointerPos.y=t.clientY;this._deltaJoystickVector=this._joystickPointerPos.clone(),this._deltaJoystickVector=this._deltaJoystickVector.subtract(this._joystickPointerStartPos),0=0)e.origin.addToRef(e.direction.scaleToRef(r,c.AA.Vector3[0]),n)}(t,this._dragPlane,this._dragPlaneHitPoint),this._dragPlaneHitPoint.subtractToRef(this._dragPlaneOriginPoint,n)},t.prototype._handleDrag=function(e){var t=this.camera.getScene(),n=t.pick(t.pointerX,t.pointerY);if(n.ray){var r=c.AA.Vector3[5];this._recalculateDragPlaneOffsetVectorToRef(e,n.ray,r);var i=c.AA.Vector3[6];r.subtractToRef(this._dragPlaneOffsetVector,i),this._dragPlaneOffsetVector.copyFrom(r),this.camera._perFrameGeocentricTranslation.subtractInPlace(i)}},t.prototype._handleTilt=function(e,t){this.camera._perFrameGeocentricRotation.y+=-e/this.angularSensibility,this.camera._perFrameGeocentricRotation.x+=-t/this.angularSensibility},t}(Sr),Jr=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"GeospatialCameraMouseWheelInput"},t.prototype.checkInputs=function(){this.camera._perFrameZoom=this._wheelDeltaY,e.prototype.checkInputs.call(this)},t}(br);Tr.GeospatialCameraMouseWheelInput=Jr,ae.b.AddNodeConstructor("TargetCamera",(function(e,t){return function(){return new ti(e,c.Pq.Zero(),t)}}));var $r=c.uq.Zero(),ei=c.PT.Identity(),ti=function(e){function t(t,n,r,i){void 0===i&&(i=!0);var o=e.call(this,t,n,r,i)||this;return o.cameraDirection=new c.Pq(0,0,0),o.cameraRotation=new c.I9(0,0),o.updateUpVectorFromRotation=!1,o.speed=2,o.noRotationConstraint=!1,o.invertRotation=!1,o.inverseRotationSpeed=.2,o._panningEpsilon=Re.bH,o._rotationEpsilon=Re.bH,o.lockedTarget=null,o._currentTarget=c.Pq.Zero(),o._initialFocalDistance=1,o._viewMatrix=c.uq.Zero(),o._cameraTransformMatrix=c.uq.Zero(),o._cameraRotationMatrix=c.uq.Zero(),o._transformedReferencePoint=c.Pq.Zero(),o._deferredPositionUpdate=new c.Pq,o._deferredRotationQuaternionUpdate=new c.PT,o._deferredRotationUpdate=new c.Pq,o._deferredUpdated=!1,o._deferOnly=!1,o._cachedRotationZ=0,o._cachedQuaternionRotationZ=0,o._referencePoint=c.Pq.Forward(o.getScene().useRightHandedSystem),o.rotation=new c.Pq(0,o.getScene().useRightHandedSystem?Math.PI:0,0),o}return(0,f.C6)(t,e),t.prototype.getFrontPosition=function(e){this.getWorldMatrix();var t=c.AA.Vector3[0],n=c.AA.Vector3[1];return n.set(0,0,this._scene.useRightHandedSystem?-1:1),this.getDirectionToRef(n,t),t.scaleInPlace(e),this.globalPosition.add(t)},t.prototype._getLockedTargetPosition=function(){if(!this.lockedTarget)return null;if(this.lockedTarget.absolutePosition){var e=this.lockedTarget;e.computeWorldMatrix().getTranslationToRef(e.absolutePosition)}return this.lockedTarget.absolutePosition||this.lockedTarget},t.prototype.storeState=function(){return this._storedPosition=this.position.clone(),this._storedRotation=this.rotation.clone(),this.rotationQuaternion&&(this._storedRotationQuaternion=this.rotationQuaternion.clone()),e.prototype.storeState.call(this)},t.prototype._restoreStateValues=function(){return!!e.prototype._restoreStateValues.call(this)&&(this.position=this._storedPosition.clone(),this.rotation=this._storedRotation.clone(),this.rotationQuaternion&&(this.rotationQuaternion=this._storedRotationQuaternion.clone()),this.cameraDirection.copyFromFloats(0,0,0),this.cameraRotation.copyFromFloats(0,0),!0)},t.prototype._initCache=function(){e.prototype._initCache.call(this),this._cache.lockedTarget=new c.Pq(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cache.rotation=new c.Pq(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cache.rotationQuaternion=new c.PT(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE)},t.prototype._updateCache=function(t){t||e.prototype._updateCache.call(this);var n=this._getLockedTargetPosition();n?this._cache.lockedTarget?this._cache.lockedTarget.copyFrom(n):this._cache.lockedTarget=n.clone():this._cache.lockedTarget=null,this._cache.rotation.copyFrom(this.rotation),this.rotationQuaternion&&this._cache.rotationQuaternion.copyFrom(this.rotationQuaternion)},t.prototype._isSynchronizedViewMatrix=function(){if(!e.prototype._isSynchronizedViewMatrix.call(this))return!1;var t=this._getLockedTargetPosition();return(this._cache.lockedTarget?this._cache.lockedTarget.equals(t):!t)&&(this.rotationQuaternion?this.rotationQuaternion.equals(this._cache.rotationQuaternion):this._cache.rotation.equals(this.rotation))},t.prototype._computeLocalCameraSpeed=function(){var e=this.getEngine();return this.speed*Math.sqrt(e.getDeltaTime()/(100*e.getFps()))},t.prototype.setTarget=function(e){this.upVector.normalize(),this._initialFocalDistance=e.subtract(this.position).length(),this.position.z===e.z&&(this.position.z+=Re.bH),this._referencePoint.normalize().scaleInPlace(this._initialFocalDistance),this.getScene().useRightHandedSystem?c.uq.LookAtRHToRef(this.position,e,c.Pq.UpReadOnly,$r):c.uq.LookAtLHToRef(this.position,e,c.Pq.UpReadOnly,$r),$r.invert();var t=this.rotationQuaternion||ei;c.PT.FromRotationMatrixToRef($r,t),t.toEulerAnglesToRef(this.rotation),this.rotation.z=0},Object.defineProperty(t.prototype,"target",{get:function(){return this.getTarget()},set:function(e){this.setTarget(e)},enumerable:!1,configurable:!0}),t.prototype.getTarget=function(){return this._currentTarget},t.prototype._decideIfNeedsToMove=function(){return Math.abs(this.cameraDirection.x)>0||Math.abs(this.cameraDirection.y)>0||Math.abs(this.cameraDirection.z)>0},t.prototype._updatePosition=function(){if(this.parent)return this.parent.getWorldMatrix().invertToRef(c.AA.Matrix[0]),c.Pq.TransformNormalToRef(this.cameraDirection,c.AA.Matrix[0],c.AA.Vector3[0]),this._deferredPositionUpdate.addInPlace(c.AA.Vector3[0]),void(this._deferOnly?this._deferredUpdated=!0:this.position.copyFrom(this._deferredPositionUpdate));this._deferredPositionUpdate.addInPlace(this.cameraDirection),this._deferOnly?this._deferredUpdated=!0:this.position.copyFrom(this._deferredPositionUpdate)},t.prototype._checkInputs=function(){var t=this.invertRotation?-this.inverseRotationSpeed:1,n=this._decideIfNeedsToMove(),r=this.cameraRotation.x||this.cameraRotation.y;if(this._deferredUpdated=!1,this._deferredRotationUpdate.copyFrom(this.rotation),this._deferredPositionUpdate.copyFrom(this.position),this.rotationQuaternion&&this._deferredRotationQuaternionUpdate.copyFrom(this.rotationQuaternion),n&&this._updatePosition(),r){if(this.rotationQuaternion&&this.rotationQuaternion.toEulerAnglesToRef(this._deferredRotationUpdate),this._deferredRotationUpdate.x+=this.cameraRotation.x*t,this._deferredRotationUpdate.y+=this.cameraRotation.y*t,!this.noRotationConstraint){var i=1.570796;this._deferredRotationUpdate.x>i&&(this._deferredRotationUpdate.x=i),this._deferredRotationUpdate.x<-i&&(this._deferredRotationUpdate.x=-i)}this._deferOnly?this._deferredUpdated=!0:this.rotation.copyFrom(this._deferredRotationUpdate),this.rotationQuaternion&&this._deferredRotationUpdate.lengthSquared()&&(c.PT.RotationYawPitchRollToRef(this._deferredRotationUpdate.y,this._deferredRotationUpdate.x,this._deferredRotationUpdate.z,this._deferredRotationQuaternionUpdate),this._deferOnly?this._deferredUpdated=!0:this.rotationQuaternion.copyFrom(this._deferredRotationQuaternionUpdate))}var o=this.speed*this._panningEpsilon,a=this.speed*this._rotationEpsilon;n&&(Math.abs(this.cameraDirection.x)Ie.$.CollisionsEpsilon&&(o.position.addToRef(o._diffPosition,o._deferredPositionUpdate),o._deferOnly?o._deferredUpdated=!0:o.position.copyFrom(o._deferredPositionUpdate),o.onCollide&&n&&o.onCollide(n))},o.inputs=new Hr(o),o.inputs.addKeyboard().addMouse(),o}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"angularSensibility",{get:function(){var e=this.inputs.attached.mouse;return e?e.angularSensibility:0},set:function(e){var t=this.inputs.attached.mouse;t&&(t.angularSensibility=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"keysUp",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysUp:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysUp=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"keysUpward",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysUpward:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysUpward=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"keysDown",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysDown:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysDown=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"keysDownward",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysDownward:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysDownward=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"keysLeft",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysLeft:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysLeft=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"keysRight",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysRight:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysRight=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"keysRotateLeft",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysRotateLeft:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysRotateLeft=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"keysRotateRight",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysRotateRight:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysRotateRight=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"keysRotateUp",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysRotateUp:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysRotateUp=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"keysRotateDown",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysRotateDown:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysRotateDown=e)},enumerable:!1,configurable:!0}),t.prototype.attachControl=function(e,t){t=Z.S0.BackCompatCameraNoPreventDefault(arguments),this.inputs.attachElement(t)},t.prototype.detachControl=function(){this.inputs.detachElement(),this.cameraDirection=new c.Pq(0,0,0),this.cameraRotation=new c.I9(0,0)},Object.defineProperty(t.prototype,"collisionMask",{get:function(){return this._collisionMask},set:function(e){this._collisionMask=isNaN(e)?-1:e},enumerable:!1,configurable:!0}),t.prototype._collideWithWorld=function(e){(this.parent?c.Pq.TransformCoordinates(this.position,this.parent.getWorldMatrix()):this.position).subtractFromFloatsToRef(0,this.ellipsoid.y,0,this._oldPosition),this._oldPosition.addInPlace(this.ellipsoidOffset);var t=this.getScene().collisionCoordinator;this._collider||(this._collider=t.createCollider()),this._collider._radius=this.ellipsoid,this._collider.collisionMask=this._collisionMask;var n=e;this.applyGravity&&(n=e.add(this.getScene().gravity)),t.getNewPosition(this._oldPosition,n,this._collider,3,null,this._onCollisionPositionChange,this.uniqueId)},t.prototype._checkInputs=function(){this._localDirection||(this._localDirection=c.Pq.Zero(),this._transformedDirection=c.Pq.Zero()),this.inputs.checkInputs(),e.prototype._checkInputs.call(this)},Object.defineProperty(t.prototype,"needMoveForGravity",{get:function(){return this._needMoveForGravity},set:function(e){this._needMoveForGravity=e},enumerable:!1,configurable:!0}),t.prototype._decideIfNeedsToMove=function(){return this._needMoveForGravity||Math.abs(this.cameraDirection.x)>0||Math.abs(this.cameraDirection.y)>0||Math.abs(this.cameraDirection.z)>0},t.prototype._updatePosition=function(){this.checkCollisions&&this.getScene().collisionsEnabled?this._collideWithWorld(this.cameraDirection):e.prototype._updatePosition.call(this)},t.prototype.dispose=function(){this.inputs.clear(),e.prototype.dispose.call(this)},t.prototype.getClassName=function(){return"FreeCamera"},(0,f.Cg)([(0,ce.P_)()],t.prototype,"ellipsoid",void 0),(0,f.Cg)([(0,ce.P_)()],t.prototype,"ellipsoidOffset",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"checkCollisions",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"applyGravity",void 0),t}(ti);(0,h.Y5)("BABYLON.FreeCamera",ni),ae.b.AddNodeConstructor("TouchCamera",(function(e,t){return function(){return new ri(e,c.Pq.Zero(),t)}}));var ri=function(e){function t(t,n,r){var i=e.call(this,t,n,r)||this;return i.inputs.addTouch(),i._setupInputs(),i}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"touchAngularSensibility",{get:function(){var e=this.inputs.attached.touch;return e?e.touchAngularSensibility:0},set:function(e){var t=this.inputs.attached.touch;t&&(t.touchAngularSensibility=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"touchMoveSensibility",{get:function(){var e=this.inputs.attached.touch;return e?e.touchMoveSensibility:0},set:function(e){var t=this.inputs.attached.touch;t&&(t.touchMoveSensibility=e)},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"TouchCamera"},t.prototype._setupInputs=function(){var e=this.inputs.attached.touch,t=this.inputs.attached.mouse;t?t.touchEnabled=!e:e.allowMouse=!t},t}(ni);function ii(e){var t=Math.PI/2;return 0===e.x&&0===e.z||(t=Math.acos(e.x/Math.sqrt(Math.pow(e.x,2)+Math.pow(e.z,2)))),e.z<0&&(t=2*Math.PI-t),t}function oi(e,t){return Math.acos(e/t)}function ai(e,t){return isNaN(e)?t:e}ae.b.AddNodeConstructor("ArcRotateCamera",(function(e,t){return function(){return new si(e,0,0,1,c.Pq.Zero(),t)}}));var si=function(e){function t(t,n,r,i,o,a,s){void 0===s&&(s=!0);var u=e.call(this,t,c.Pq.Zero(),a,s)||this;return u.inertialAlphaOffset=0,u.inertialBetaOffset=0,u.inertialRadiusOffset=0,u.lowerAlphaLimit=null,u.upperAlphaLimit=null,u.lowerBetaLimit=.01,u.upperBetaLimit=Math.PI-.01,u.lowerRadiusLimit=null,u.upperRadiusLimit=null,u.lowerTargetYLimit=-1/0,u.inertialPanningX=0,u.inertialPanningY=0,u.pinchToPanMaxDistance=20,u.panningDistanceLimit=null,u.panningOriginTarget=c.Pq.Zero(),u.panningInertia=.9,u.zoomOnFactor=1,u.targetScreenOffset=c.I9.Zero(),u.allowUpsideDown=!0,u.useInputToRestoreState=!0,u.restoreStateInterpolationFactor=0,u._currentInterpolationFactor=0,u._viewMatrix=new c.uq,u.panningAxis=new c.Pq(1,1,0),u._transformedDirection=new c.Pq,u.mapPanning=!1,u._isInterpolating=!1,u.onMeshTargetChangedObservable=new l.cP,u.checkCollisions=!1,u.collisionRadius=new c.Pq(.5,.5,.5),u._previousPosition=c.Pq.Zero(),u._collisionVelocity=c.Pq.Zero(),u._newPosition=c.Pq.Zero(),u._computationVector=c.Pq.Zero(),u._goalAlpha=NaN,u._goalBeta=NaN,u._goalRadius=NaN,u._goalTarget=new c.Pq(NaN,NaN,NaN),u._goalTargetScreenOffset=new c.I9(NaN,NaN),u._onCollisionPositionChange=function(e,t,n){void 0===n&&(n=null),n?(u.setPosition(t),u.onCollide&&u.onCollide(n)):u._previousPosition.copyFrom(u._position);var r=Math.cos(u.alpha),i=Math.sin(u.alpha),o=Math.cos(u.beta),a=Math.sin(u.beta);0===a&&(a=1e-4);var s=u._getTargetPosition();u._computationVector.copyFromFloats(u.radius*r*a,u.radius*o,u.radius*i*a),s.addToRef(u._computationVector,u._newPosition),u._position.copyFrom(u._newPosition);var l=u.upVector;u.allowUpsideDown&&u.beta<0&&(l=(l=l.clone()).negate()),u._computeViewMatrix(u._position,s,l),u._viewMatrix.addAtIndex(12,u.targetScreenOffset.x),u._viewMatrix.addAtIndex(13,u.targetScreenOffset.y),u._collisionTriggered=!1},u._target=c.Pq.Zero(),o&&u.setTarget(o),u.alpha=n,u.beta=r,u.radius=i,u.getViewMatrix(),u.inputs=new Dr(u),u.inputs.addKeyboard().addMouseWheel().addPointers(),u}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"target",{get:function(){return this._target},set:function(e){this.setTarget(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"targetHost",{get:function(){return this._targetHost},set:function(e){e&&this.setTarget(e)},enumerable:!1,configurable:!0}),t.prototype.getTarget=function(){return this.target},Object.defineProperty(t.prototype,"position",{get:function(){return this._position},set:function(e){this.setPosition(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"upVector",{get:function(){return this._upVector},set:function(e){this._upToYMatrix||(this._yToUpMatrix=new c.uq,this._upToYMatrix=new c.uq,this._upVector=c.Pq.Zero()),e.normalize(),this._upVector.copyFrom(e),this.setMatUp()},enumerable:!1,configurable:!0}),t.prototype.setMatUp=function(){c.uq.RotationAlignToRef(c.Pq.UpReadOnly,this._upVector,this._yToUpMatrix),c.uq.RotationAlignToRef(this._upVector,c.Pq.UpReadOnly,this._upToYMatrix)},Object.defineProperty(t.prototype,"angularSensibilityX",{get:function(){var e=this.inputs.attached.pointers;return e?e.angularSensibilityX:0},set:function(e){var t=this.inputs.attached.pointers;t&&(t.angularSensibilityX=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"angularSensibilityY",{get:function(){var e=this.inputs.attached.pointers;return e?e.angularSensibilityY:0},set:function(e){var t=this.inputs.attached.pointers;t&&(t.angularSensibilityY=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pinchPrecision",{get:function(){var e=this.inputs.attached.pointers;return e?e.pinchPrecision:0},set:function(e){var t=this.inputs.attached.pointers;t&&(t.pinchPrecision=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pinchDeltaPercentage",{get:function(){var e=this.inputs.attached.pointers;return e?e.pinchDeltaPercentage:0},set:function(e){var t=this.inputs.attached.pointers;t&&(t.pinchDeltaPercentage=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"useNaturalPinchZoom",{get:function(){var e=this.inputs.attached.pointers;return!!e&&e.useNaturalPinchZoom},set:function(e){var t=this.inputs.attached.pointers;t&&(t.useNaturalPinchZoom=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"panningSensibility",{get:function(){var e=this.inputs.attached.pointers;return e?e.panningSensibility:0},set:function(e){var t=this.inputs.attached.pointers;t&&(t.panningSensibility=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"keysUp",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysUp:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysUp=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"keysDown",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysDown:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysDown=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"keysLeft",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysLeft:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysLeft=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"keysRight",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysRight:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysRight=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wheelPrecision",{get:function(){var e=this.inputs.attached.mousewheel;return e?e.wheelPrecision:0},set:function(e){var t=this.inputs.attached.mousewheel;t&&(t.wheelPrecision=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"zoomToMouseLocation",{get:function(){var e=this.inputs.attached.mousewheel;return!!e&&e.zoomToMouseLocation},set:function(e){var t=this.inputs.attached.mousewheel;t&&(t.zoomToMouseLocation=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wheelDeltaPercentage",{get:function(){var e=this.inputs.attached.mousewheel;return e?e.wheelDeltaPercentage:0},set:function(e){var t=this.inputs.attached.mousewheel;t&&(t.wheelDeltaPercentage=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isInterpolating",{get:function(){return this._isInterpolating},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bouncingBehavior",{get:function(){return this._bouncingBehavior},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"useBouncingBehavior",{get:function(){return null!=this._bouncingBehavior},set:function(e){e!==this.useBouncingBehavior&&(e?(this._bouncingBehavior=new Pn,this.addBehavior(this._bouncingBehavior)):this._bouncingBehavior&&(this.removeBehavior(this._bouncingBehavior),this._bouncingBehavior=null))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"framingBehavior",{get:function(){return this._framingBehavior},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"useFramingBehavior",{get:function(){return null!=this._framingBehavior},set:function(e){e!==this.useFramingBehavior&&(e?(this._framingBehavior=new Cn,this.addBehavior(this._framingBehavior)):this._framingBehavior&&(this.removeBehavior(this._framingBehavior),this._framingBehavior=null))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"autoRotationBehavior",{get:function(){return this._autoRotationBehavior},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"useAutoRotationBehavior",{get:function(){return null!=this._autoRotationBehavior},set:function(e){e!==this.useAutoRotationBehavior&&(e?(this._autoRotationBehavior=new xn,this.addBehavior(this._autoRotationBehavior)):this._autoRotationBehavior&&(this.removeBehavior(this._autoRotationBehavior),this._autoRotationBehavior=null))},enumerable:!1,configurable:!0}),t.prototype._initCache=function(){e.prototype._initCache.call(this),this._cache._target=new c.Pq(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cache.alpha=void 0,this._cache.beta=void 0,this._cache.radius=void 0,this._cache.targetScreenOffset=c.I9.Zero()},t.prototype._updateCache=function(t){t||e.prototype._updateCache.call(this),this._cache._target.copyFrom(this._getTargetPosition()),this._cache.alpha=this.alpha,this._cache.beta=this.beta,this._cache.radius=this.radius,this._cache.targetScreenOffset.copyFrom(this.targetScreenOffset)},t.prototype._getTargetPosition=function(){if(this._targetHost&&this._targetHost.getAbsolutePosition){var e=this._targetHost.getAbsolutePosition();this._targetBoundingCenter?e.addToRef(this._targetBoundingCenter,this._target):this._target.copyFrom(e)}return this._getLockedTargetPosition()||this._target},t.prototype.storeState=function(){return this._storedAlpha=this.alpha,this._storedBeta=this.beta,this._storedRadius=this.radius,this._storedTarget=this._getTargetPosition().clone(),this._storedTargetScreenOffset=this.targetScreenOffset.clone(),e.prototype.storeState.call(this)},t.prototype._restoreStateValues=function(){return this.hasStateStored()&&this.restoreStateInterpolationFactor>Re.bH&&this.restoreStateInterpolationFactor<1?(this.interpolateTo(this._storedAlpha,this._storedBeta,this._storedRadius,this._storedTarget,this._storedTargetScreenOffset,this.restoreStateInterpolationFactor),!0):!!e.prototype._restoreStateValues.call(this)&&(this.setTarget(this._storedTarget.clone()),this.alpha=this._storedAlpha,this.beta=this._storedBeta,this.radius=this._storedRadius,this.targetScreenOffset=this._storedTargetScreenOffset.clone(),this.inertialAlphaOffset=0,this.inertialBetaOffset=0,this.inertialRadiusOffset=0,this.inertialPanningX=0,this.inertialPanningY=0,!0)},t.prototype.stopInterpolation=function(){this._goalAlpha=NaN,this._goalBeta=NaN,this._goalRadius=NaN,this._goalTarget.set(NaN,NaN,NaN),this._goalTargetScreenOffset.set(NaN,NaN)},t.prototype.interpolateTo=function(e,t,n,r,i,o){var a,s,l,c,u,h,d;void 0===e&&(e=this.alpha),void 0===t&&(t=this.beta),void 0===n&&(n=this.radius),void 0===r&&(r=this.target),void 0===i&&(i=this.targetScreenOffset),this.inertialAlphaOffset=0,this.inertialBetaOffset=0,this.inertialRadiusOffset=0,this.inertialPanningX=0,this.inertialPanningY=0,null!=o?this._currentInterpolationFactor=o:0!==this.restoreStateInterpolationFactor?this._currentInterpolationFactor=this.restoreStateInterpolationFactor:this._currentInterpolationFactor=.1,this._goalAlpha=ai(e,this._goalAlpha),this._goalBeta=ai(t,this._goalBeta),this._goalRadius=ai(n,this._goalRadius),this._goalTarget.set(ai(r.x,this._goalTarget.x),ai(r.y,this._goalTarget.y),ai(r.z,this._goalTarget.z)),this._goalTargetScreenOffset.set(ai(i.x,this._goalTargetScreenOffset.x),ai(i.y,this._goalTargetScreenOffset.y)),this._goalAlpha=(0,lr.Clamp)(this._goalAlpha,null!==(a=this.lowerAlphaLimit)&&void 0!==a?a:-1/0,null!==(s=this.upperAlphaLimit)&&void 0!==s?s:1/0),this._goalBeta=(0,lr.Clamp)(this._goalBeta,null!==(l=this.lowerBetaLimit)&&void 0!==l?l:-1/0,null!==(c=this.upperBetaLimit)&&void 0!==c?c:1/0),this._goalRadius=(0,lr.Clamp)(this._goalRadius,null!==(u=this.lowerRadiusLimit)&&void 0!==u?u:-1/0,null!==(h=this.upperRadiusLimit)&&void 0!==h?h:1/0),this._goalTarget.y=(0,lr.Clamp)(this._goalTarget.y,null!==(d=this.lowerTargetYLimit)&&void 0!==d?d:-1/0,1/0),this._isInterpolating=!0},t.prototype._isSynchronizedViewMatrix=function(){return!!e.prototype._isSynchronizedViewMatrix.call(this)&&this._cache._target.equals(this._getTargetPosition())&&this._cache.alpha===this.alpha&&this._cache.beta===this.beta&&this._cache.radius===this.radius&&this._cache.targetScreenOffset.equals(this.targetScreenOffset)},t.prototype.attachControl=function(e,t,n,r){var i=this;void 0===n&&(n=!0),void 0===r&&(r=2);var o=arguments;t=Z.S0.BackCompatCameraNoPreventDefault(o),this._useCtrlForPanning=n,this._panningMouseButton=r,"boolean"==typeof o[0]&&(o.length>1&&(this._useCtrlForPanning=o[1]),o.length>2&&(this._panningMouseButton=o[2])),this.inputs.attachElement(t),this._reset=function(){i.inertialAlphaOffset=0,i.inertialBetaOffset=0,i.inertialRadiusOffset=0,i.inertialPanningX=0,i.inertialPanningY=0}},t.prototype.detachControl=function(){this.inputs.detachElement(),this._reset&&this._reset()},t.prototype._checkInputs=function(){if(!this._collisionTriggered){this.inputs.checkInputs();var t=!1,n=this.speed*this._panningEpsilon,r=this.speed*this._rotationEpsilon;if(0!==this.inertialAlphaOffset||0!==this.inertialBetaOffset||0!==this.inertialRadiusOffset){t=!0;var i=this.invertRotation?-1:1,o=this._calculateHandednessMultiplier(),a=this.inertialAlphaOffset*o;this.beta<0&&(a*=-1),this.alpha+=a*i,this.beta+=this.inertialBetaOffset*i,this.radius-=this.inertialRadiusOffset,this.inertialAlphaOffset*=this.inertia,this.inertialBetaOffset*=this.inertia,this.inertialRadiusOffset*=this.inertia,Math.abs(this.inertialAlphaOffset)Math.PI&&(this.beta=this.beta-2*Math.PI):this.betathis.upperBetaLimit&&(this.beta=this.upperBetaLimit),null!==this.lowerAlphaLimit&&this.alphathis.upperAlphaLimit&&(this.alpha=this.upperAlphaLimit),null!==this.lowerRadiusLimit&&this.radiusthis.upperRadiusLimit&&(this.radius=this.upperRadiusLimit,this.inertialRadiusOffset=0),this.target.y=Math.max(this.target.y,this.lowerTargetYLimit)},t.prototype.rebuildAnglesAndRadius=function(){this._position.subtractToRef(this._getTargetPosition(),this._computationVector),0===this._upVector.x&&1===this._upVector.y&&0===this._upVector.z||c.Pq.TransformCoordinatesToRef(this._computationVector,this._upToYMatrix,this._computationVector),this.radius=this._computationVector.length(),0===this.radius&&(this.radius=1e-4);var e=this.alpha;this.alpha=ii(this._computationVector),this.beta=oi(this._computationVector.y,this.radius);var t=Math.round((e-this.alpha)/(2*Math.PI));this.alpha+=2*t*Math.PI,this._checkLimits()},t.prototype.setPosition=function(e){this._position.equals(e)||(this._position.copyFrom(e),this.rebuildAnglesAndRadius())},t.prototype.setTarget=function(e,t,n,r){var i;if(void 0===t&&(t=!1),void 0===n&&(n=!1),void 0===r&&(r=!1),r=null!==(i=this.overrideCloneAlphaBetaRadius)&&void 0!==i?i:r,e.computeWorldMatrix)t&&e.getBoundingInfo?this._targetBoundingCenter=e.getBoundingInfo().boundingBox.centerWorld.clone():this._targetBoundingCenter=null,e.computeWorldMatrix(),this._targetHost=e,this._target=this._getTargetPosition(),this.onMeshTargetChangedObservable.notifyObservers(this._targetHost);else{var o=e,a=this._getTargetPosition();if(a&&!n&&a.equals(o))return;this._targetHost=null,this._target=o,this._targetBoundingCenter=null,this.onMeshTargetChangedObservable.notifyObservers(null)}r||this.rebuildAnglesAndRadius()},t.prototype._getViewMatrix=function(){var e=Math.cos(this.alpha),t=Math.sin(this.alpha),n=Math.cos(this.beta),r=Math.sin(this.beta);0===r&&(r=1e-4),0===this.radius&&(this.radius=1e-4);var i=this._getTargetPosition();if(this._computationVector.copyFromFloats(this.radius*e*r,this.radius*n,this.radius*t*r),0===this._upVector.x&&1===this._upVector.y&&0===this._upVector.z||c.Pq.TransformCoordinatesToRef(this._computationVector,this._yToUpMatrix,this._computationVector),i.addToRef(this._computationVector,this._newPosition),this.getScene().collisionsEnabled&&this.checkCollisions){var o=this.getScene().collisionCoordinator;this._collider||(this._collider=o.createCollider()),this._collider._radius=this.collisionRadius,this._newPosition.subtractToRef(this._position,this._collisionVelocity),this._collisionTriggered=!0,o.getNewPosition(this._position,this._collisionVelocity,this._collider,3,null,this._onCollisionPositionChange,this.uniqueId)}else{this._position.copyFrom(this._newPosition);var a=this.upVector;this.allowUpsideDown&&r<0&&(a=a.negate()),this._computeViewMatrix(this._position,i,a),this._viewMatrix.addAtIndex(12,this.targetScreenOffset.x),this._viewMatrix.addAtIndex(13,this.targetScreenOffset.y)}return this._currentTarget.copyFrom(i),this._viewMatrix},t.prototype.zoomOn=function(e,t){void 0===t&&(t=!1),e=e||this.getScene().meshes;var n=qe.MinMax(e),r=this._calculateLowerRadiusFromModelBoundingSphere(n.min,n.max);if(r=Math.max(Math.min(r,this.upperRadiusLimit||Number.MAX_VALUE),this.lowerRadiusLimit||0),this.radius=r*this.zoomOnFactor,this.mode===oe.i.ORTHOGRAPHIC_CAMERA){var i=this.getScene().getEngine().getAspectRatio(this),o=r*this.zoomOnFactor/2;this.orthoLeft=-o*i,this.orthoRight=o*i,this.orthoBottom=-o,this.orthoTop=o}this.focusOn({min:n.min,max:n.max,distance:r},t)},t.prototype.focusOn=function(e,t){var n,r;if(void 0===t&&(t=!1),void 0===e.min){var i=e||this.getScene().meshes;n=qe.MinMax(i),r=c.Pq.Distance(n.min,n.max)}else n=e,r=e.distance;this._target=qe.Center(n),t||(this.maxZ=2*r)},t.prototype.createRigCamera=function(e,n){var r=0;switch(this.cameraRigMode){case oe.i.RIG_MODE_STEREOSCOPIC_ANAGLYPH:case oe.i.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:case oe.i.RIG_MODE_STEREOSCOPIC_OVERUNDER:case oe.i.RIG_MODE_STEREOSCOPIC_INTERLACED:case oe.i.RIG_MODE_VR:r=this._cameraRigParams.stereoHalfAngle*(0===n?1:-1);break;case oe.i.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:r=this._cameraRigParams.stereoHalfAngle*(0===n?-1:1)}var i=new t(e,this.alpha+r,this.beta,this.radius,this._target,this.getScene());return i._cameraRigParams={},i.isRigCamera=!0,i.rigParent=this,i.upVector=this.upVector,i.mode=this.mode,i.orthoLeft=this.orthoLeft,i.orthoRight=this.orthoRight,i.orthoBottom=this.orthoBottom,i.orthoTop=this.orthoTop,i},t.prototype._updateRigCameras=function(){var t=this._rigCameras[0],n=this._rigCameras[1];switch(t.beta=n.beta=this.beta,this.cameraRigMode){case oe.i.RIG_MODE_STEREOSCOPIC_ANAGLYPH:case oe.i.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:case oe.i.RIG_MODE_STEREOSCOPIC_OVERUNDER:case oe.i.RIG_MODE_STEREOSCOPIC_INTERLACED:case oe.i.RIG_MODE_VR:t.alpha=this.alpha-this._cameraRigParams.stereoHalfAngle,n.alpha=this.alpha+this._cameraRigParams.stereoHalfAngle;break;case oe.i.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:t.alpha=this.alpha+this._cameraRigParams.stereoHalfAngle,n.alpha=this.alpha-this._cameraRigParams.stereoHalfAngle}e.prototype._updateRigCameras.call(this)},t.prototype._calculateLowerRadiusFromModelBoundingSphere=function(e,t,n){void 0===n&&(n=1);var r=c.Pq.Distance(e,t),i=this.getScene().getEngine().getAspectRatio(this),o=Math.tan(this.fov/2),a=o*i,s=.5*r*n,l=s*Math.sqrt(1+1/(a*a)),u=s*Math.sqrt(1+1/(o*o));return Math.max(l,u)},t.prototype.dispose=function(){this.inputs.clear(),e.prototype.dispose.call(this)},t.prototype.getClassName=function(){return"ArcRotateCamera"},(0,f.Cg)([(0,ce.lK)()],t.prototype,"alpha",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"beta",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"radius",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"overrideCloneAlphaBetaRadius",void 0),(0,f.Cg)([(0,ce.P_)("target")],t.prototype,"_target",void 0),(0,f.Cg)([(0,ce.xG)("targetHost")],t.prototype,"_targetHost",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"inertialAlphaOffset",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"inertialBetaOffset",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"inertialRadiusOffset",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"lowerAlphaLimit",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"upperAlphaLimit",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"lowerBetaLimit",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"upperBetaLimit",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"lowerRadiusLimit",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"upperRadiusLimit",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"lowerTargetYLimit",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"inertialPanningX",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"inertialPanningY",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"pinchToPanMaxDistance",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"panningDistanceLimit",void 0),(0,f.Cg)([(0,ce.P_)()],t.prototype,"panningOriginTarget",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"panningInertia",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"zoomToMouseLocation",null),(0,f.Cg)([(0,ce.lK)()],t.prototype,"zoomOnFactor",void 0),(0,f.Cg)([(0,ce.WM)()],t.prototype,"targetScreenOffset",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"allowUpsideDown",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"useInputToRestoreState",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"restoreStateInterpolationFactor",void 0),t}(ti);(0,h.Y5)("BABYLON.ArcRotateCamera",si),ae.b.AddNodeConstructor("DeviceOrientationCamera",(function(e,t){return function(){return new li(e,c.Pq.Zero(),t)}}));var li=function(e){function t(t,n,r){var i=e.call(this,t,n,r)||this;return i._tmpDragQuaternion=new c.PT,i._disablePointerInputWhenUsingDeviceOrientation=!0,i._dragFactor=0,i._quaternionCache=new c.PT,i.inputs.addDeviceOrientation(),i.inputs._deviceOrientationInput&&i.inputs._deviceOrientationInput._onDeviceOrientationChangedObservable.addOnce((function(){i._disablePointerInputWhenUsingDeviceOrientation&&i.inputs._mouseInput&&(i.inputs._mouseInput._allowCameraRotation=!1,i.inputs._mouseInput.onPointerMovedObservable.add((function(e){0!=i._dragFactor&&(i._initialQuaternion||(i._initialQuaternion=new c.PT),c.PT.FromEulerAnglesToRef(0,e.offsetX*i._dragFactor,0,i._tmpDragQuaternion),i._initialQuaternion.multiplyToRef(i._tmpDragQuaternion,i._initialQuaternion))})))})),i}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"disablePointerInputWhenUsingDeviceOrientation",{get:function(){return this._disablePointerInputWhenUsingDeviceOrientation},set:function(e){this._disablePointerInputWhenUsingDeviceOrientation=e},enumerable:!1,configurable:!0}),t.prototype.enableHorizontalDragging=function(e){void 0===e&&(e=1/300),this._dragFactor=e},t.prototype.getClassName=function(){return"DeviceOrientationCamera"},t.prototype._checkInputs=function(){e.prototype._checkInputs.call(this),this._quaternionCache.copyFrom(this.rotationQuaternion),this._initialQuaternion&&this._initialQuaternion.multiplyToRef(this.rotationQuaternion,this.rotationQuaternion)},t.prototype.resetToCurrentRotation=function(e){if(void 0===e&&(e=Ae._0.Y),this.rotationQuaternion){this._initialQuaternion||(this._initialQuaternion=new c.PT),this._initialQuaternion.copyFrom(this._quaternionCache||this.rotationQuaternion);for(var t=0,n=["x","y","z"];tIe.$.CollisionsEpsilon&&(o.position.addInPlace(o._diffPosition),o.onCollide&&n&&o.onCollide(n))},o.inputs=new ci(o),o.inputs.addKeyboard().addMouse(),o}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"angularSensibility",{get:function(){var e=this.inputs.attached.mouse;return e?e.angularSensibility:0},set:function(e){var t=this.inputs.attached.mouse;t&&(t.angularSensibility=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"keysForward",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysForward:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysForward=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"keysBackward",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysBackward:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysBackward=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"keysUp",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysUp:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysUp=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"keysDown",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysDown:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysDown=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"keysLeft",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysLeft:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysLeft=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"keysRight",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysRight:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysRight=e)},enumerable:!1,configurable:!0}),t.prototype.attachControl=function(e,t){t=Z.S0.BackCompatCameraNoPreventDefault(arguments),this.inputs.attachElement(t)},t.prototype.detachControl=function(){this.inputs.detachElement(),this.cameraDirection=new c.Pq(0,0,0)},Object.defineProperty(t.prototype,"collisionMask",{get:function(){return this._collisionMask},set:function(e){this._collisionMask=isNaN(e)?-1:e},enumerable:!1,configurable:!0}),t.prototype._collideWithWorld=function(e){(this.parent?c.Pq.TransformCoordinates(this.position,this.parent.getWorldMatrix()):this.position).subtractFromFloatsToRef(0,this.ellipsoid.y,0,this._oldPosition),this._oldPosition.addInPlace(this.ellipsoidOffset);var t=this.getScene().collisionCoordinator;this._collider||(this._collider=t.createCollider()),this._collider._radius=this.ellipsoid,this._collider.collisionMask=this._collisionMask;var n=e;this.applyGravity&&(n=e.add(this.getScene().gravity)),t.getNewPosition(this._oldPosition,n,this._collider,3,null,this._onCollisionPositionChange,this.uniqueId)},t.prototype._checkInputs=function(){this._localDirection||(this._localDirection=c.Pq.Zero(),this._transformedDirection=c.Pq.Zero()),this.inputs.checkInputs(),e.prototype._checkInputs.call(this)},Object.defineProperty(t.prototype,"needMoveForGravity",{get:function(){return this._needMoveForGravity},set:function(e){this._needMoveForGravity=e},enumerable:!1,configurable:!0}),t.prototype._decideIfNeedsToMove=function(){return this._needMoveForGravity||Math.abs(this.cameraDirection.x)>0||Math.abs(this.cameraDirection.y)>0||Math.abs(this.cameraDirection.z)>0},t.prototype._updatePosition=function(){this.checkCollisions&&this.getScene().collisionsEnabled?this._collideWithWorld(this.cameraDirection):e.prototype._updatePosition.call(this)},t.prototype.restoreRoll=function(e){var t=this._trackRoll,n=t-this.rotation.z;Math.abs(n)>=.001&&(this.rotation.z+=n/e,Math.abs(t-this.rotation.z)<=.001&&(this.rotation.z=t))},t.prototype.dispose=function(){this.inputs.clear(),e.prototype.dispose.call(this)},t.prototype.getClassName=function(){return"FlyCamera"},(0,f.Cg)([(0,ce.P_)()],t.prototype,"ellipsoid",void 0),(0,f.Cg)([(0,ce.P_)()],t.prototype,"ellipsoidOffset",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"checkCollisions",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"applyGravity",void 0),t}(ti);(0,h.Y5)("BABYLON.FlyCamera",ui);var hi=function(e){function t(t){return e.call(this,t)||this}return(0,f.C6)(t,e),t.prototype.addKeyboard=function(){return this.add(new wr),this},t.prototype.addMouseWheel=function(){return this.add(new Br),this},t.prototype.addPointers=function(){return this.add(new Vr),this},t.prototype.addVRDeviceOrientation=function(){return y.V.Warn("DeviceOrientation support not yet implemented for FollowCamera."),this},t}(Er);ae.b.AddNodeConstructor("FollowCamera",(function(e,t){return function(){return new di(e,c.Pq.Zero(),t)}})),ae.b.AddNodeConstructor("ArcFollowCamera",(function(e,t){return function(){return new pi(e,0,0,1,null,t)}}));var di=function(e){function t(t,n,r,i){void 0===i&&(i=null);var o=e.call(this,t,n,r)||this;return o.radius=12,o.lowerRadiusLimit=null,o.upperRadiusLimit=null,o.rotationOffset=0,o.lowerRotationOffsetLimit=null,o.upperRotationOffsetLimit=null,o.heightOffset=4,o.lowerHeightOffsetLimit=null,o.upperHeightOffsetLimit=null,o.cameraAcceleration=.05,o.maxCameraSpeed=20,o.lockedTarget=i,o.inputs=new hi(o),o.inputs.addKeyboard().addMouseWheel().addPointers(),o}return(0,f.C6)(t,e),t.prototype._follow=function(e){if(e){var t=c.AA.Matrix[0];e.absoluteRotationQuaternion.toRotationMatrix(t);var n=Math.atan2(t.m[8],t.m[10]),r=Z.S0.ToRadians(this.rotationOffset)+n,i=e.getAbsolutePosition(),o=i.x+Math.sin(r)*this.radius,a=i.z+Math.cos(r)*this.radius,s=o-this.position.x,l=i.y+this.heightOffset-this.position.y,u=a-this.position.z,h=s*this.cameraAcceleration*2,d=l*this.cameraAcceleration,p=u*this.cameraAcceleration*2;(h>this.maxCameraSpeed||h<-this.maxCameraSpeed)&&(h=h<1?-this.maxCameraSpeed:this.maxCameraSpeed),(d>this.maxCameraSpeed||d<-this.maxCameraSpeed)&&(d=d<1?-this.maxCameraSpeed:this.maxCameraSpeed),(p>this.maxCameraSpeed||p<-this.maxCameraSpeed)&&(p=p<1?-this.maxCameraSpeed:this.maxCameraSpeed),this.position=new c.Pq(this.position.x+h,this.position.y+d,this.position.z+p),this.setTarget(i)}},t.prototype.attachControl=function(e,t){t=Z.S0.BackCompatCameraNoPreventDefault(arguments),this.inputs.attachElement(t),this._reset=function(){}},t.prototype.detachControl=function(){this.inputs.detachElement(),this._reset&&this._reset()},t.prototype._checkInputs=function(){this.inputs.checkInputs(),this._checkLimits(),e.prototype._checkInputs.call(this),this.lockedTarget&&this._follow(this.lockedTarget)},t.prototype._checkLimits=function(){null!==this.lowerRadiusLimit&&this.radiusthis.upperRadiusLimit&&(this.radius=this.upperRadiusLimit),null!==this.lowerHeightOffsetLimit&&this.heightOffsetthis.upperHeightOffsetLimit&&(this.heightOffset=this.upperHeightOffsetLimit),null!==this.lowerRotationOffsetLimit&&this.rotationOffsetthis.upperRotationOffsetLimit&&(this.rotationOffset=this.upperRotationOffsetLimit)},t.prototype.getClassName=function(){return"FollowCamera"},(0,f.Cg)([(0,ce.lK)()],t.prototype,"radius",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"lowerRadiusLimit",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"upperRadiusLimit",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"rotationOffset",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"lowerRotationOffsetLimit",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"upperRotationOffsetLimit",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"heightOffset",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"lowerHeightOffsetLimit",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"upperHeightOffsetLimit",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"cameraAcceleration",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"maxCameraSpeed",void 0),(0,f.Cg)([(0,ce.xG)("lockedTargetId")],t.prototype,"lockedTarget",void 0),t}(ti),pi=function(e){function t(t,n,r,i,o,a){var s=e.call(this,t,c.Pq.Zero(),a)||this;return s.alpha=n,s.beta=r,s.radius=i,s._cartesianCoordinates=c.Pq.Zero(),s.setMeshTarget(o),s}return(0,f.C6)(t,e),t.prototype.setMeshTarget=function(e){this._meshTarget=e,this._follow()},t.prototype._follow=function(){if(this._meshTarget){this._cartesianCoordinates.x=this.radius*Math.cos(this.alpha)*Math.cos(this.beta),this._cartesianCoordinates.y=this.radius*Math.sin(this.beta),this._cartesianCoordinates.z=this.radius*Math.sin(this.alpha)*Math.cos(this.beta);var e=this._meshTarget.getAbsolutePosition();this.position=e.add(this._cartesianCoordinates),this.setTarget(e)}},t.prototype._checkInputs=function(){e.prototype._checkInputs.call(this),this._follow()},t.prototype.getClassName=function(){return"ArcFollowCamera"},t}(ti);(0,h.Y5)("BABYLON.FollowCamera",di),(0,h.Y5)("BABYLON.ArcFollowCamera",pi);var fi,mi,_i=n(5153);!function(e){e[e.A=0]="A",e[e.B=1]="B",e[e.X=2]="X",e[e.Y=3]="Y",e[e.LB=4]="LB",e[e.RB=5]="RB",e[e.Back=8]="Back",e[e.Start=9]="Start",e[e.LeftStick=10]="LeftStick",e[e.RightStick=11]="RightStick"}(fi||(fi={})),function(e){e[e.Up=12]="Up",e[e.Down=13]="Down",e[e.Left=14]="Left",e[e.Right=15]="Right"}(mi||(mi={}));var gi,vi,yi=function(e){function t(t,n,r,i){void 0===i&&(i=!1);var o=e.call(this,t,n,r,0,1,2,3)||this;return o._leftTrigger=0,o._rightTrigger=0,o.onButtonDownObservable=new l.cP,o.onButtonUpObservable=new l.cP,o.onPadDownObservable=new l.cP,o.onPadUpObservable=new l.cP,o._buttonA=0,o._buttonB=0,o._buttonX=0,o._buttonY=0,o._buttonBack=0,o._buttonStart=0,o._buttonLb=0,o._buttonRb=0,o._buttonLeftStick=0,o._buttonRightStick=0,o._dPadUp=0,o._dPadDown=0,o._dPadLeft=0,o._dPadRight=0,o._isXboxOnePad=!1,o.type=Pr.XBOX,o._isXboxOnePad=i,o}return(0,f.C6)(t,e),t.prototype.onlefttriggerchanged=function(e){this._onlefttriggerchanged=e},t.prototype.onrighttriggerchanged=function(e){this._onrighttriggerchanged=e},Object.defineProperty(t.prototype,"leftTrigger",{get:function(){return this._leftTrigger},set:function(e){this._onlefttriggerchanged&&this._leftTrigger!==e&&this._onlefttriggerchanged(e),this._leftTrigger=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rightTrigger",{get:function(){return this._rightTrigger},set:function(e){this._onrighttriggerchanged&&this._rightTrigger!==e&&this._onrighttriggerchanged(e),this._rightTrigger=e},enumerable:!1,configurable:!0}),t.prototype.onbuttondown=function(e){this._onbuttondown=e},t.prototype.onbuttonup=function(e){this._onbuttonup=e},t.prototype.ondpaddown=function(e){this._ondpaddown=e},t.prototype.ondpadup=function(e){this._ondpadup=e},t.prototype._setButtonValue=function(e,t,n){return e!==t&&(1===e&&(this._onbuttondown&&this._onbuttondown(n),this.onButtonDownObservable.notifyObservers(n)),0===e&&(this._onbuttonup&&this._onbuttonup(n),this.onButtonUpObservable.notifyObservers(n))),e},t.prototype._setDpadValue=function(e,t,n){return e!==t&&(1===e&&(this._ondpaddown&&this._ondpaddown(n),this.onPadDownObservable.notifyObservers(n)),0===e&&(this._ondpadup&&this._ondpadup(n),this.onPadUpObservable.notifyObservers(n))),e},Object.defineProperty(t.prototype,"buttonA",{get:function(){return this._buttonA},set:function(e){this._buttonA=this._setButtonValue(e,this._buttonA,0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"buttonB",{get:function(){return this._buttonB},set:function(e){this._buttonB=this._setButtonValue(e,this._buttonB,1)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"buttonX",{get:function(){return this._buttonX},set:function(e){this._buttonX=this._setButtonValue(e,this._buttonX,2)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"buttonY",{get:function(){return this._buttonY},set:function(e){this._buttonY=this._setButtonValue(e,this._buttonY,3)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"buttonStart",{get:function(){return this._buttonStart},set:function(e){this._buttonStart=this._setButtonValue(e,this._buttonStart,9)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"buttonBack",{get:function(){return this._buttonBack},set:function(e){this._buttonBack=this._setButtonValue(e,this._buttonBack,8)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"buttonLB",{get:function(){return this._buttonLb},set:function(e){this._buttonLb=this._setButtonValue(e,this._buttonLb,4)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"buttonRB",{get:function(){return this._buttonRb},set:function(e){this._buttonRb=this._setButtonValue(e,this._buttonRb,5)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"buttonLeftStick",{get:function(){return this._buttonLeftStick},set:function(e){this._buttonLeftStick=this._setButtonValue(e,this._buttonLeftStick,10)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"buttonRightStick",{get:function(){return this._buttonRightStick},set:function(e){this._buttonRightStick=this._setButtonValue(e,this._buttonRightStick,11)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dPadUp",{get:function(){return this._dPadUp},set:function(e){this._dPadUp=this._setDpadValue(e,this._dPadUp,12)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dPadDown",{get:function(){return this._dPadDown},set:function(e){this._dPadDown=this._setDpadValue(e,this._dPadDown,13)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dPadLeft",{get:function(){return this._dPadLeft},set:function(e){this._dPadLeft=this._setDpadValue(e,this._dPadLeft,14)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dPadRight",{get:function(){return this._dPadRight},set:function(e){this._dPadRight=this._setDpadValue(e,this._dPadRight,15)},enumerable:!1,configurable:!0}),t.prototype.update=function(){e.prototype.update.call(this),this._isXboxOnePad,this.buttonA=this.browserGamepad.buttons[0].value,this.buttonB=this.browserGamepad.buttons[1].value,this.buttonX=this.browserGamepad.buttons[2].value,this.buttonY=this.browserGamepad.buttons[3].value,this.buttonLB=this.browserGamepad.buttons[4].value,this.buttonRB=this.browserGamepad.buttons[5].value,this.leftTrigger=this.browserGamepad.buttons[6].value,this.rightTrigger=this.browserGamepad.buttons[7].value,this.buttonBack=this.browserGamepad.buttons[8].value,this.buttonStart=this.browserGamepad.buttons[9].value,this.buttonLeftStick=this.browserGamepad.buttons[10].value,this.buttonRightStick=this.browserGamepad.buttons[11].value,this.dPadUp=this.browserGamepad.buttons[12].value,this.dPadDown=this.browserGamepad.buttons[13].value,this.dPadLeft=this.browserGamepad.buttons[14].value,this.dPadRight=this.browserGamepad.buttons[15].value},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.onButtonDownObservable.clear(),this.onButtonUpObservable.clear(),this.onPadDownObservable.clear(),this.onPadUpObservable.clear()},t}(Pr);!function(e){e[e.Cross=0]="Cross",e[e.Circle=1]="Circle",e[e.Square=2]="Square",e[e.Triangle=3]="Triangle",e[e.L1=4]="L1",e[e.R1=5]="R1",e[e.Share=8]="Share",e[e.Options=9]="Options",e[e.LeftStick=10]="LeftStick",e[e.RightStick=11]="RightStick"}(gi||(gi={})),function(e){e[e.Up=12]="Up",e[e.Down=13]="Down",e[e.Left=14]="Left",e[e.Right=15]="Right"}(vi||(vi={}));var bi=function(e){function t(t,n,r){var i=e.call(this,t.replace("STANDARD GAMEPAD","SONY PLAYSTATION DUALSHOCK"),n,r,0,1,2,3)||this;return i._leftTrigger=0,i._rightTrigger=0,i.onButtonDownObservable=new l.cP,i.onButtonUpObservable=new l.cP,i.onPadDownObservable=new l.cP,i.onPadUpObservable=new l.cP,i._buttonCross=0,i._buttonCircle=0,i._buttonSquare=0,i._buttonTriangle=0,i._buttonShare=0,i._buttonOptions=0,i._buttonL1=0,i._buttonR1=0,i._buttonLeftStick=0,i._buttonRightStick=0,i._dPadUp=0,i._dPadDown=0,i._dPadLeft=0,i._dPadRight=0,i.type=Pr.DUALSHOCK,i}return(0,f.C6)(t,e),t.prototype.onlefttriggerchanged=function(e){this._onlefttriggerchanged=e},t.prototype.onrighttriggerchanged=function(e){this._onrighttriggerchanged=e},Object.defineProperty(t.prototype,"leftTrigger",{get:function(){return this._leftTrigger},set:function(e){this._onlefttriggerchanged&&this._leftTrigger!==e&&this._onlefttriggerchanged(e),this._leftTrigger=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rightTrigger",{get:function(){return this._rightTrigger},set:function(e){this._onrighttriggerchanged&&this._rightTrigger!==e&&this._onrighttriggerchanged(e),this._rightTrigger=e},enumerable:!1,configurable:!0}),t.prototype.onbuttondown=function(e){this._onbuttondown=e},t.prototype.onbuttonup=function(e){this._onbuttonup=e},t.prototype.ondpaddown=function(e){this._ondpaddown=e},t.prototype.ondpadup=function(e){this._ondpadup=e},t.prototype._setButtonValue=function(e,t,n){return e!==t&&(1===e&&(this._onbuttondown&&this._onbuttondown(n),this.onButtonDownObservable.notifyObservers(n)),0===e&&(this._onbuttonup&&this._onbuttonup(n),this.onButtonUpObservable.notifyObservers(n))),e},t.prototype._setDpadValue=function(e,t,n){return e!==t&&(1===e&&(this._ondpaddown&&this._ondpaddown(n),this.onPadDownObservable.notifyObservers(n)),0===e&&(this._ondpadup&&this._ondpadup(n),this.onPadUpObservable.notifyObservers(n))),e},Object.defineProperty(t.prototype,"buttonCross",{get:function(){return this._buttonCross},set:function(e){this._buttonCross=this._setButtonValue(e,this._buttonCross,0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"buttonCircle",{get:function(){return this._buttonCircle},set:function(e){this._buttonCircle=this._setButtonValue(e,this._buttonCircle,1)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"buttonSquare",{get:function(){return this._buttonSquare},set:function(e){this._buttonSquare=this._setButtonValue(e,this._buttonSquare,2)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"buttonTriangle",{get:function(){return this._buttonTriangle},set:function(e){this._buttonTriangle=this._setButtonValue(e,this._buttonTriangle,3)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"buttonOptions",{get:function(){return this._buttonOptions},set:function(e){this._buttonOptions=this._setButtonValue(e,this._buttonOptions,9)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"buttonShare",{get:function(){return this._buttonShare},set:function(e){this._buttonShare=this._setButtonValue(e,this._buttonShare,8)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"buttonL1",{get:function(){return this._buttonL1},set:function(e){this._buttonL1=this._setButtonValue(e,this._buttonL1,4)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"buttonR1",{get:function(){return this._buttonR1},set:function(e){this._buttonR1=this._setButtonValue(e,this._buttonR1,5)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"buttonLeftStick",{get:function(){return this._buttonLeftStick},set:function(e){this._buttonLeftStick=this._setButtonValue(e,this._buttonLeftStick,10)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"buttonRightStick",{get:function(){return this._buttonRightStick},set:function(e){this._buttonRightStick=this._setButtonValue(e,this._buttonRightStick,11)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dPadUp",{get:function(){return this._dPadUp},set:function(e){this._dPadUp=this._setDpadValue(e,this._dPadUp,12)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dPadDown",{get:function(){return this._dPadDown},set:function(e){this._dPadDown=this._setDpadValue(e,this._dPadDown,13)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dPadLeft",{get:function(){return this._dPadLeft},set:function(e){this._dPadLeft=this._setDpadValue(e,this._dPadLeft,14)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dPadRight",{get:function(){return this._dPadRight},set:function(e){this._dPadRight=this._setDpadValue(e,this._dPadRight,15)},enumerable:!1,configurable:!0}),t.prototype.update=function(){e.prototype.update.call(this),this.buttonCross=this.browserGamepad.buttons[0].value,this.buttonCircle=this.browserGamepad.buttons[1].value,this.buttonSquare=this.browserGamepad.buttons[2].value,this.buttonTriangle=this.browserGamepad.buttons[3].value,this.buttonL1=this.browserGamepad.buttons[4].value,this.buttonR1=this.browserGamepad.buttons[5].value,this.leftTrigger=this.browserGamepad.buttons[6].value,this.rightTrigger=this.browserGamepad.buttons[7].value,this.buttonShare=this.browserGamepad.buttons[8].value,this.buttonOptions=this.browserGamepad.buttons[9].value,this.buttonLeftStick=this.browserGamepad.buttons[10].value,this.buttonRightStick=this.browserGamepad.buttons[11].value,this.dPadUp=this.browserGamepad.buttons[12].value,this.dPadDown=this.browserGamepad.buttons[13].value,this.dPadLeft=this.browserGamepad.buttons[14].value,this.dPadRight=this.browserGamepad.buttons[15].value},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.onButtonDownObservable.clear(),this.onButtonUpObservable.clear(),this.onPadDownObservable.clear(),this.onPadUpObservable.clear()},t}(Pr),Si=function(){function e(e){var t=this;if(this._scene=e,this._babylonGamepads=[],this._oneGamepadConnected=!1,this._isMonitoring=!1,this.onGamepadDisconnectedObservable=new l.cP,(0,_i.BA)()?(this._gamepadEventSupported="GamepadEvent"in window,this._gamepadSupport=navigator&&navigator.getGamepads):this._gamepadEventSupported=!1,this.onGamepadConnectedObservable=new l.cP((function(e){for(var n in t._babylonGamepads){var r=t._babylonGamepads[n];r&&r._isConnected&&t.onGamepadConnectedObservable.notifyObserver(e,r)}})),this._onGamepadConnectedEvent=function(e){var n,r=e.gamepad;r.index in t._babylonGamepads&&t._babylonGamepads[r.index].isConnected||(t._babylonGamepads[r.index]?((n=t._babylonGamepads[r.index]).browserGamepad=r,n._isConnected=!0):n=t._addNewGamepad(r),t.onGamepadConnectedObservable.notifyObservers(n),t._startMonitoringGamepads())},this._onGamepadDisconnectedEvent=function(e){var n=e.gamepad;for(var r in t._babylonGamepads)if(t._babylonGamepads[r].index===n.index){var i=t._babylonGamepads[r];i._isConnected=!1,t.onGamepadDisconnectedObservable.notifyObservers(i),i.dispose&&i.dispose();break}},this._gamepadSupport)if(this._updateGamepadObjects(),this._babylonGamepads.length&&this._startMonitoringGamepads(),this._gamepadEventSupported){var n=this._scene?this._scene.getEngine().getHostWindow():window;n&&(n.addEventListener("gamepadconnected",this._onGamepadConnectedEvent,!1),n.addEventListener("gamepaddisconnected",this._onGamepadDisconnectedEvent,!1))}else this._startMonitoringGamepads()}return Object.defineProperty(e.prototype,"gamepads",{get:function(){return this._babylonGamepads},enumerable:!1,configurable:!0}),e.prototype.getGamepadByType=function(e){void 0===e&&(e=Pr.XBOX);for(var t=0,n=this._babylonGamepads;t0.5;useCamA=!useCamB;texCoord1=vec2(useCamB ? (vUV.x-0.5)*2.0 : vUV.x*2.0,vUV.y);texCoord2=vec2(texCoord1.x+stepSize.x,vUV.y);\n#else\n#ifdef IS_STEREOSCOPIC_INTERLACED\nfloat rowNum=floor(vUV.y/stepSize.y);useCamA=mod(rowNum,2.0)==1.0;useCamB=mod(rowNum,2.0)==0.0;texCoord1=vec2(vUV.x,vUV.y);texCoord2=vec2(vUV.x,vUV.y);\n#else\nuseCamB=vUV.y>0.5;useCamA=!useCamB;texCoord1=vec2(vUV.x,useCamB ? (vUV.y-0.5)*2.0 : vUV.y*2.0);texCoord2=vec2(vUV.x,texCoord1.y+stepSize.y);\n#endif\n#endif\nif (useCamB){frag1=texture2D(textureSampler,texCoord1).rgb;frag2=texture2D(textureSampler,texCoord2).rgb;}else if (useCamA){frag1=texture2D(camASampler ,texCoord1).rgb;frag2=texture2D(camASampler ,texCoord2).rgb;}else {discard;}\ngl_FragColor=vec4((frag1+frag2)/TWO,1.0);}\n");var Ui=function(e){function t(t,n,r,i,o,a,s){var l=e.call(this,t,"stereoscopicInterlace",["stepSize"],["camASampler"],1,n[1],o,a,s,i?"#define IS_STEREOSCOPIC_INTERLACED 1":r?"#define IS_STEREOSCOPIC_HORIZ 1":void 0)||this;return l._passedProcess=n[0]._rigPostProcess,l._stepSize=new c.I9(1/l.width,1/l.height),l.onSizeChangedObservable.add((function(){l._stepSize=new c.I9(1/l.width,1/l.height)})),l.onApplyObservable.add((function(e){e.setTextureFromPostProcess("camASampler",l._passedProcess),e.setFloat2("stepSize",l._stepSize.x,l._stepSize.y)})),l}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"StereoscopicInterlacePostProcessI"},t}(Ci.w),Gi=function(e){function t(t,n,r,i,o,a){var s=e.call(this,t,"stereoscopicInterlace",["stepSize"],["camASampler"],1,n[1],i,o,a,r?"#define IS_STEREOSCOPIC_HORIZ 1":void 0)||this;return s._passedProcess=n[0]._rigPostProcess,s._stepSize=new c.I9(1/s.width,1/s.height),s.onSizeChangedObservable.add((function(){s._stepSize=new c.I9(1/s.width,1/s.height)})),s.onApplyObservable.add((function(e){e.setTextureFromPostProcess("camASampler",s._passedProcess),e.setFloat2("stepSize",s._stepSize.x,s._stepSize.y)})),s}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"StereoscopicInterlacePostProcess"},t}(Ci.w);function ki(e){var t=e.cameraRigMode===oe.i.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL||e.cameraRigMode===oe.i.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED,n=e.cameraRigMode===oe.i.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED;e.cameraRigMode===oe.i.RIG_MODE_STEREOSCOPIC_INTERLACED?(e._rigCameras[0]._rigPostProcess=new Pi.v(e.name+"_passthru",1,e._rigCameras[0]),e._rigCameras[1]._rigPostProcess=new Ui(e.name+"_stereoInterlace",e._rigCameras,!1,!0)):(e._rigCameras[n?1:0].viewport=new wi.L(0,0,t?.5:1,t?1:.5),e._rigCameras[n?0:1].viewport=new wi.L(t?.5:0,t?0:.5,t?.5:1,t?1:.5))}ae.b.AddNodeConstructor("StereoscopicArcRotateCamera",(function(e,t,n){return function(){return new zi(e,0,0,1,c.Pq.Zero(),n.interaxial_distance,n.isStereoscopicSideBySide,t)}}));var zi=function(e){function t(t,n,r,i,o,a,s,l){var c=e.call(this,t,n,r,i,o,l)||this;return c._setRigMode=function(){return ki(c)},c.interaxialDistance=a,c.isStereoscopicSideBySide=s,c.setCameraRigMode(s?oe.i.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:oe.i.RIG_MODE_STEREOSCOPIC_OVERUNDER,{interaxialDistance:a}),c}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"StereoscopicArcRotateCamera"},t}(si);ae.b.AddNodeConstructor("StereoscopicFreeCamera",(function(e,t,n){return function(){return new Wi(e,c.Pq.Zero(),n.interaxial_distance,n.isStereoscopicSideBySide,t)}}));var Wi=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,o)||this;return a._setRigMode=function(){return ki(a)},a.interaxialDistance=r,a.isStereoscopicSideBySide=i,a.setCameraRigMode(i?oe.i.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:oe.i.RIG_MODE_STEREOSCOPIC_OVERUNDER,{interaxialDistance:r}),a}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"StereoscopicFreeCamera"},t}(ni);ae.b.AddNodeConstructor("StereoscopicGamepadCamera",(function(e,t,n){return function(){return new Hi(e,c.Pq.Zero(),n.interaxial_distance,n.isStereoscopicSideBySide,t)}}));var Hi=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,o)||this;return a._setRigMode=function(){return ki(a)},a.interaxialDistance=r,a.isStereoscopicSideBySide=i,a.setCameraRigMode(i?oe.i.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:oe.i.RIG_MODE_STEREOSCOPIC_OVERUNDER,{interaxialDistance:r}),a}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"StereoscopicGamepadCamera"},t}(xi);ae.b.AddNodeConstructor("StereoscopicFreeCamera",(function(e,t,n){return function(){return new Yi(e,c.Pq.Zero(),n.interaxial_distance,n.isStereoscopicSideBySide,t)}}));var Yi=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,o)||this;return a._setRigMode=function(){return ki(a)},a.interaxialDistance=r,a.isStereoscopicSideBySide=i,a.setCameraRigMode(i?oe.i.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:oe.i.RIG_MODE_STEREOSCOPIC_OVERUNDER,{interaxialDistance:r}),a}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"StereoscopicUniversalCamera"},t}(Ei),Xi=function(e){function t(t,n,r,i,o){void 0===i&&(i=1),void 0===o&&(o=.065);var a=e.call(this,t,n,r)||this;return a._distanceBetweenEyes=o,a._distanceToProjectionPlane=i,a.setCameraRigMode(oe.i.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL,{stereoHalfAngle:0}),a._cameraRigParams.stereoHalfAngle=0,a._cameraRigParams.interaxialDistance=o,a}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"distanceBetweenEyes",{get:function(){return this._distanceBetweenEyes},set:function(e){this._distanceBetweenEyes=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"distanceToProjectionPlane",{get:function(){return this._distanceToProjectionPlane},set:function(e){this._distanceToProjectionPlane=e},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"StereoscopicUniversalCamera"},t.prototype.createRigCamera=function(e){var t=new ti(e,c.Pq.Zero(),this.getScene()),n=new Ee("tm_"+e,this.getScene());return t.parent=n,n.setPivotMatrix(c.uq.Identity(),!1),t.isRigCamera=!0,t.rigParent=this,t},t.prototype._updateRigCameras=function(){for(var e=0;e0?e._rigPostProcess.width:this.getEngine().getRenderWidth(!0),e._rigPostProcess&&e._rigPostProcess&&e._rigPostProcess.height>0?e._rigPostProcess.height:this.getEngine().getRenderHeight(!0)),this._multiviewSceneUbo||this._createMultiviewUbo(),e.outputRenderTarget=e._multiviewTexture,this._renderForCamera(e),e.outputRenderTarget=null;for(var t=0;t0&&(n=s.uniforms).push.apply(n,this._uniformList),this._samplerList.length>0&&(r=s.samplers).push.apply(r,this._samplerList),this._uboList.length>0&&(i=s.uniformBuffersNames).push.apply(i,this._uboList),s.customCode=this._injectCustomCode(s,s.customCode);break;case 8:s=t,this._uboDeclaration="",this._vertexDeclaration="",this._fragmentDeclaration="",this._uniformList=[],this._samplerList=[],this._uboList=[];for(var b=1===this._material.shaderLanguage,S=0,T=this._plugins;S0?"uniform ".concat(C.name,": array<").concat(A,", ").concat(R,">;\n"):"uniform ".concat(C.name,": ").concat(A,";\n")}else this._uboDeclaration+="".concat(C.type," ").concat(C.name).concat(R>0?"[".concat(R,"]"):"",";\n")}this._uniformList.push(C.name)}E.vertex&&(this._vertexDeclaration+=E.vertex+"\n"),E.fragment&&(this._fragmentDeclaration+=E.fragment+"\n"),E.externalUniforms&&(o=this._uniformList).push.apply(o,E.externalUniforms)}y.getSamplers(this._samplerList),y.getUniformBuffersNames(this._uboList)}}},e.prototype._collectPointNames=function(e,t){if(t)for(var n in t)this._codeInjectionPoints[e]||(this._codeInjectionPoints[e]={}),this._codeInjectionPoints[e][n]=!0},e.prototype._injectCustomCode=function(e,t){var n=this;return function(r,i){var o,a;t&&(i=t(r,i)),n._uboDeclaration&&(i=i.replace("#define ADDITIONAL_UBO_DECLARATION",n._uboDeclaration)),n._vertexDeclaration&&(i=i.replace("#define ADDITIONAL_VERTEX_DECLARATION",n._vertexDeclaration)),n._fragmentDeclaration&&(i=i.replace("#define ADDITIONAL_FRAGMENT_DECLARATION",n._fragmentDeclaration));var s=null===(o=n._codeInjectionPoints)||void 0===o?void 0:o[r];if(!s)return i;var l=null;for(var c in s){for(var u="",h=function(t){var i=null===(a=t.getCustomCode(r,n._material.shaderLanguage))||void 0===a?void 0:a[c];if(!i)return"continue";t.resolveIncludes&&(null===l&&(l={defines:[],indexParameters:e.indexParameters,isFragment:!1,shouldUseHighPrecisionShader:n._engine._shouldUseHighPrecisionShader,processor:void 0,supportsUniformBuffers:n._engine.supportsUniformBuffers,shadersRepository:Bi.l.GetShadersRepository(0),includesShadersStore:Bi.l.GetIncludesShadersStore(0),version:void 0,platformName:n._engine.shaderPlatformName,processingContext:void 0,isNDCHalfZRange:n._engine.isNDCHalfZRange,useReverseDepthBuffer:n._engine.useReverseDepthBuffer,processCodeAfterIncludes:void 0}),l.isFragment="fragment"===r,(0,vo.je)(i,l,(function(e){return i=e}))),u+=i+"\n"},d=0,p=n._activePlugins;d0)if("!"===c.charAt(0)){var f="g";if("!"===(c=c.substring(1)).charAt(0))f="",c=c.substring(1);else{var m=yo.exec(c);m&&m.length>=2&&(f=m[1],c=c.substring(f.length+1))}f.indexOf("g")<0&&(f+="g");for(var _=i,g=new RegExp(c,f),v=g.exec(_);null!==v;){for(var y=u,b=0;b0?n[0][1]=t:So.push([e,t])}function Po(e){for(var t=0;t0&&e.push(this._texture)},t.prototype.dispose=function(e){var t;e&&(null===(t=this._texture)||void 0===t||t.dispose())},t.prototype.getClassName=function(){return"DetailMapConfiguration"},t.prototype.getSamplers=function(e){e.push("detailSampler")},t.prototype.getUniforms=function(){return{ubo:[{name:"vDetailInfos",size:4,type:"vec4"},{name:"detailMatrix",size:16,type:"mat4"}]}},(0,f.Cg)([(0,ce.uM)("detailTexture"),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"texture",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"diffuseBlendLevel",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"roughnessBlendLevel",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"bumpLevel",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"normalBlendMethod",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"isEnabled",void 0),t}(Ro),Mo=n(34561);!function(e){e[e.Zero=0]="Zero",e[e.One=1]="One",e[e.MaxViewZ=2]="MaxViewZ"}(Ao||(Ao={}));var Do=function(){function e(){}return e.CreateConfiguration=function(t){return e._Configurations[t]={defines:{},previousWorldMatrices:{},previousViewProjection:c.uq.Zero(),currentViewProjection:c.uq.Zero(),previousBones:{},lastUpdateFrameId:-1,excludedSkinnedMesh:[],reverseCulling:!1},e._Configurations[t]},e.DeleteConfiguration=function(t){delete e._Configurations[t]},e.GetConfiguration=function(t){return e._Configurations[t]},e.AddUniformsAndSamplers=function(e,t){e.push("previousWorld","previousViewProjection","mPreviousBones")},e.MarkAsDirty=function(e,t){for(var n=0,r=t;n0,l.REFLECTIONOVERALPHA=this._useReflectionOverAlpha):(l.ROUGHNESS=!1,l.REFLECTIONOVERALPHA=!1),!(0,Le.kz)(s,this._reflectionTexture,l))return!1;if(this._emissiveTexture&&t.EmissiveTextureEnabled){if(!this._emissiveTexture.isReadyOrNotBlocking())return!1;(0,Le.YT)(this._emissiveTexture,l,"EMISSIVE")}else l.EMISSIVE=!1;if(this._lightmapTexture&&t.LightmapTextureEnabled){if(!this._lightmapTexture.isReadyOrNotBlocking())return!1;(0,Le.YT)(this._lightmapTexture,l,"LIGHTMAP"),l.USELIGHTMAPASSHADOWMAP=this._useLightmapAsShadowmap,l.RGBDLIGHTMAP=this._lightmapTexture.isRGBD}else l.LIGHTMAP=!1;if(this._specularTexture&&t.SpecularTextureEnabled){if(!this._specularTexture.isReadyOrNotBlocking())return!1;(0,Le.YT)(this._specularTexture,l,"SPECULAR"),l.GLOSSINESS=this._useGlossinessFromSpecularMapAlpha}else l.SPECULAR=!1;if(s.getEngine().getCaps().standardDerivatives&&this._bumpTexture&&t.BumpTextureEnabled){if(!this._bumpTexture.isReady())return!1;(0,Le.YT)(this._bumpTexture,l,"BUMP"),l.PARALLAX=this._useParallax,l.PARALLAX_RHS=s.useRightHandedSystem,l.PARALLAXOCCLUSION=this._useParallaxOcclusion,l.OBJECTSPACE_NORMALMAP=this._useObjectSpaceNormalMap}else l.BUMP=!1,l.PARALLAX=!1,l.PARALLAX_RHS=!1,l.PARALLAXOCCLUSION=!1;if(this._refractionTexture&&t.RefractionTextureEnabled){if(!this._refractionTexture.isReadyOrNotBlocking())return!1;l._needUVs=!0,l.REFRACTION=!0,l.REFRACTIONMAP_3D=this._refractionTexture.isCube,l.RGBDREFRACTION=this._refractionTexture.isRGBD,l.USE_LOCAL_REFRACTIONMAP_CUBIC=!!this._refractionTexture.boundingBoxSize}else l.REFRACTION=!1;l.TWOSIDEDLIGHTING=!this._backFaceCulling&&this._twoSidedLighting}else l.DIFFUSE=!1,l.AMBIENT=!1,l.OPACITY=!1,l.REFLECTION=!1,l.EMISSIVE=!1,l.LIGHTMAP=!1,l.BUMP=!1,l.REFRACTION=!1;l.ALPHAFROMDIFFUSE=this._shouldUseAlphaFromDiffuseTexture(),l.EMISSIVEASILLUMINATION=this._useEmissiveAsIllumination,l.LINKEMISSIVEWITHDIFFUSE=this._linkEmissiveWithDiffuse,l.SPECULAROVERALPHA=this._useSpecularOverAlpha,l.PREMULTIPLYALPHA=this.alphaMode===b.Y.ALPHA_PREMULTIPLIED||this.alphaMode===b.Y.ALPHA_PREMULTIPLIED_PORTERDUFF,l.ALPHATEST_AFTERALLALPHACOMPUTATIONS=null!==this.transparencyMode,l.ALPHABLEND=null===this.transparencyMode||this.needAlphaBlendingForMesh(e)}if(this._eventInfo.isReadyForSubMesh=!0,this._eventInfo.defines=l,this._eventInfo.subMesh=r,this._callbackPluginEventIsReadyForSubMesh(this._eventInfo),!this._eventInfo.isReadyForSubMesh)return!1;if(l._areImageProcessingDirty&&this._imageProcessingConfiguration){if(!this._imageProcessingConfiguration.isReady())return!1;this._imageProcessingConfiguration.prepareDefines(l),l.IS_REFLECTION_LINEAR=null!=this.reflectionTexture&&!this.reflectionTexture.gammaSpace,l.IS_REFRACTION_LINEAR=null!=this.refractionTexture&&!this.refractionTexture.gammaSpace}if(l._areFresnelDirty&&(t.FresnelEnabled?(this._diffuseFresnelParameters||this._opacityFresnelParameters||this._emissiveFresnelParameters||this._refractionFresnelParameters||this._reflectionFresnelParameters)&&(l.DIFFUSEFRESNEL=this._diffuseFresnelParameters&&this._diffuseFresnelParameters.isEnabled,l.OPACITYFRESNEL=this._opacityFresnelParameters&&this._opacityFresnelParameters.isEnabled,l.REFLECTIONFRESNEL=this._reflectionFresnelParameters&&this._reflectionFresnelParameters.isEnabled,l.REFLECTIONFRESNELFROMSPECULAR=this._useReflectionFresnelFromSpecular,l.REFRACTIONFRESNEL=this._refractionFresnelParameters&&this._refractionFresnelParameters.isEnabled,l.EMISSIVEFRESNEL=this._emissiveFresnelParameters&&this._emissiveFresnelParameters.isEnabled,l._needNormals=!0,l.FRESNEL=!0):l.FRESNEL=!1),l.AREALIGHTUSED||l.CLUSTLIGHT_BATCH)for(var d=0;d0&&t.push(this._diffuseTexture),this._ambientTexture&&this._ambientTexture.animations&&this._ambientTexture.animations.length>0&&t.push(this._ambientTexture),this._opacityTexture&&this._opacityTexture.animations&&this._opacityTexture.animations.length>0&&t.push(this._opacityTexture),this._reflectionTexture&&this._reflectionTexture.animations&&this._reflectionTexture.animations.length>0&&t.push(this._reflectionTexture),this._emissiveTexture&&this._emissiveTexture.animations&&this._emissiveTexture.animations.length>0&&t.push(this._emissiveTexture),this._specularTexture&&this._specularTexture.animations&&this._specularTexture.animations.length>0&&t.push(this._specularTexture),this._bumpTexture&&this._bumpTexture.animations&&this._bumpTexture.animations.length>0&&t.push(this._bumpTexture),this._lightmapTexture&&this._lightmapTexture.animations&&this._lightmapTexture.animations.length>0&&t.push(this._lightmapTexture),this._refractionTexture&&this._refractionTexture.animations&&this._refractionTexture.animations.length>0&&t.push(this._refractionTexture),t},t.prototype.getActiveTextures=function(){var t=e.prototype.getActiveTextures.call(this);return this._diffuseTexture&&t.push(this._diffuseTexture),this._ambientTexture&&t.push(this._ambientTexture),this._opacityTexture&&t.push(this._opacityTexture),this._reflectionTexture&&t.push(this._reflectionTexture),this._emissiveTexture&&t.push(this._emissiveTexture),this._specularTexture&&t.push(this._specularTexture),this._bumpTexture&&t.push(this._bumpTexture),this._lightmapTexture&&t.push(this._lightmapTexture),this._refractionTexture&&t.push(this._refractionTexture),t},t.prototype.hasTexture=function(t){return!!e.prototype.hasTexture.call(this,t)||this._diffuseTexture===t||this._ambientTexture===t||this._opacityTexture===t||this._reflectionTexture===t||this._emissiveTexture===t||this._specularTexture===t||this._bumpTexture===t||this._lightmapTexture===t||this._refractionTexture===t},t.prototype.dispose=function(t,n){var r,i,o,a,s,l,c,u,h;n&&(null===(r=this._diffuseTexture)||void 0===r||r.dispose(),null===(i=this._ambientTexture)||void 0===i||i.dispose(),null===(o=this._opacityTexture)||void 0===o||o.dispose(),null===(a=this._reflectionTexture)||void 0===a||a.dispose(),null===(s=this._emissiveTexture)||void 0===s||s.dispose(),null===(l=this._specularTexture)||void 0===l||l.dispose(),null===(c=this._bumpTexture)||void 0===c||c.dispose(),null===(u=this._lightmapTexture)||void 0===u||u.dispose(),null===(h=this._refractionTexture)||void 0===h||h.dispose()),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),e.prototype.dispose.call(this,t,n)},t.prototype.clone=function(e,n,r){var i=this;void 0===n&&(n=!0),void 0===r&&(r="");var o=Te.p.Clone((function(){return new t(e,i.getScene())}),this,{cloneTexturesOnlyOnce:n});return o.name=e,o.id=e,this.stencil.copyTo(o.stencil),this._clonePlugins(o,r),o},t.Parse=function(e,n,r){var i=Te.p.Parse((function(){return new t(e.name,n)}),e,n,r);return e.stencil&&i.stencil.parse(e.stencil,n,r),Be._ParsePlugins(e,i,n,r),i},Object.defineProperty(t,"DiffuseTextureEnabled",{get:function(){return _o.h.DiffuseTextureEnabled},set:function(e){_o.h.DiffuseTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"DetailTextureEnabled",{get:function(){return _o.h.DetailTextureEnabled},set:function(e){_o.h.DetailTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"AmbientTextureEnabled",{get:function(){return _o.h.AmbientTextureEnabled},set:function(e){_o.h.AmbientTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"OpacityTextureEnabled",{get:function(){return _o.h.OpacityTextureEnabled},set:function(e){_o.h.OpacityTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"ReflectionTextureEnabled",{get:function(){return _o.h.ReflectionTextureEnabled},set:function(e){_o.h.ReflectionTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"EmissiveTextureEnabled",{get:function(){return _o.h.EmissiveTextureEnabled},set:function(e){_o.h.EmissiveTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"SpecularTextureEnabled",{get:function(){return _o.h.SpecularTextureEnabled},set:function(e){_o.h.SpecularTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"BumpTextureEnabled",{get:function(){return _o.h.BumpTextureEnabled},set:function(e){_o.h.BumpTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"LightmapTextureEnabled",{get:function(){return _o.h.LightmapTextureEnabled},set:function(e){_o.h.LightmapTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"RefractionTextureEnabled",{get:function(){return _o.h.RefractionTextureEnabled},set:function(e){_o.h.RefractionTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"ColorGradingTextureEnabled",{get:function(){return _o.h.ColorGradingTextureEnabled},set:function(e){_o.h.ColorGradingTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"FresnelEnabled",{get:function(){return _o.h.FresnelEnabled},set:function(e){_o.h.FresnelEnabled=e},enumerable:!1,configurable:!0}),t.ForceGLSL=!1,(0,f.Cg)([(0,ce.uM)("diffuseTexture")],t.prototype,"_diffuseTexture",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsTexturesAndMiscDirty")],t.prototype,"diffuseTexture",void 0),(0,f.Cg)([(0,ce.uM)("ambientTexture")],t.prototype,"_ambientTexture",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"ambientTexture",void 0),(0,f.Cg)([(0,ce.uM)("opacityTexture")],t.prototype,"_opacityTexture",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsTexturesAndMiscDirty")],t.prototype,"opacityTexture",void 0),(0,f.Cg)([(0,ce.uM)("reflectionTexture")],t.prototype,"_reflectionTexture",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectionTexture",void 0),(0,f.Cg)([(0,ce.uM)("emissiveTexture")],t.prototype,"_emissiveTexture",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"emissiveTexture",void 0),(0,f.Cg)([(0,ce.uM)("specularTexture")],t.prototype,"_specularTexture",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"specularTexture",void 0),(0,f.Cg)([(0,ce.uM)("bumpTexture")],t.prototype,"_bumpTexture",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"bumpTexture",void 0),(0,f.Cg)([(0,ce.uM)("lightmapTexture")],t.prototype,"_lightmapTexture",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"lightmapTexture",void 0),(0,f.Cg)([(0,ce.uM)("refractionTexture")],t.prototype,"_refractionTexture",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"refractionTexture",void 0),(0,f.Cg)([(0,ce.jT)("ambient")],t.prototype,"ambientColor",void 0),(0,f.Cg)([(0,ce.jT)("diffuse")],t.prototype,"diffuseColor",void 0),(0,f.Cg)([(0,ce.jT)("specular")],t.prototype,"specularColor",void 0),(0,f.Cg)([(0,ce.jT)("emissive")],t.prototype,"emissiveColor",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"specularPower",void 0),(0,f.Cg)([(0,ce.lK)("useAlphaFromDiffuseTexture")],t.prototype,"_useAlphaFromDiffuseTexture",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsTexturesAndMiscDirty")],t.prototype,"useAlphaFromDiffuseTexture",void 0),(0,f.Cg)([(0,ce.lK)("useEmissiveAsIllumination")],t.prototype,"_useEmissiveAsIllumination",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useEmissiveAsIllumination",void 0),(0,f.Cg)([(0,ce.lK)("linkEmissiveWithDiffuse")],t.prototype,"_linkEmissiveWithDiffuse",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"linkEmissiveWithDiffuse",void 0),(0,f.Cg)([(0,ce.lK)("useSpecularOverAlpha")],t.prototype,"_useSpecularOverAlpha",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useSpecularOverAlpha",void 0),(0,f.Cg)([(0,ce.lK)("useReflectionOverAlpha")],t.prototype,"_useReflectionOverAlpha",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useReflectionOverAlpha",void 0),(0,f.Cg)([(0,ce.lK)("disableLighting")],t.prototype,"_disableLighting",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsLightsDirty")],t.prototype,"disableLighting",void 0),(0,f.Cg)([(0,ce.lK)("useObjectSpaceNormalMap")],t.prototype,"_useObjectSpaceNormalMap",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useObjectSpaceNormalMap",void 0),(0,f.Cg)([(0,ce.lK)("useParallax")],t.prototype,"_useParallax",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useParallax",void 0),(0,f.Cg)([(0,ce.lK)("useParallaxOcclusion")],t.prototype,"_useParallaxOcclusion",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useParallaxOcclusion",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"parallaxScaleBias",void 0),(0,f.Cg)([(0,ce.lK)("roughness")],t.prototype,"_roughness",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"roughness",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"indexOfRefraction",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"invertRefractionY",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"alphaCutOff",void 0),(0,f.Cg)([(0,ce.lK)("useLightmapAsShadowmap")],t.prototype,"_useLightmapAsShadowmap",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useLightmapAsShadowmap",void 0),(0,f.Cg)([(0,ce.Y9)("diffuseFresnelParameters")],t.prototype,"_diffuseFresnelParameters",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsFresnelDirty")],t.prototype,"diffuseFresnelParameters",void 0),(0,f.Cg)([(0,ce.Y9)("opacityFresnelParameters")],t.prototype,"_opacityFresnelParameters",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsFresnelAndMiscDirty")],t.prototype,"opacityFresnelParameters",void 0),(0,f.Cg)([(0,ce.Y9)("reflectionFresnelParameters")],t.prototype,"_reflectionFresnelParameters",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsFresnelDirty")],t.prototype,"reflectionFresnelParameters",void 0),(0,f.Cg)([(0,ce.Y9)("refractionFresnelParameters")],t.prototype,"_refractionFresnelParameters",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsFresnelDirty")],t.prototype,"refractionFresnelParameters",void 0),(0,f.Cg)([(0,ce.Y9)("emissiveFresnelParameters")],t.prototype,"_emissiveFresnelParameters",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsFresnelDirty")],t.prototype,"emissiveFresnelParameters",void 0),(0,f.Cg)([(0,ce.lK)("useReflectionFresnelFromSpecular")],t.prototype,"_useReflectionFresnelFromSpecular",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsFresnelDirty")],t.prototype,"useReflectionFresnelFromSpecular",void 0),(0,f.Cg)([(0,ce.lK)("useGlossinessFromSpecularMapAlpha")],t.prototype,"_useGlossinessFromSpecularMapAlpha",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useGlossinessFromSpecularMapAlpha",void 0),(0,f.Cg)([(0,ce.lK)("maxSimultaneousLights")],t.prototype,"_maxSimultaneousLights",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsLightsDirty")],t.prototype,"maxSimultaneousLights",void 0),(0,f.Cg)([(0,ce.lK)("invertNormalMapX")],t.prototype,"_invertNormalMapX",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"invertNormalMapX",void 0),(0,f.Cg)([(0,ce.lK)("invertNormalMapY")],t.prototype,"_invertNormalMapY",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"invertNormalMapY",void 0),(0,f.Cg)([(0,ce.lK)("twoSidedLighting")],t.prototype,"_twoSidedLighting",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"twoSidedLighting",void 0),(0,f.Cg)([(0,ce.lK)("applyDecalMapAfterDetailMap")],t.prototype,"_applyDecalMapAfterDetailMap",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsMiscDirty")],t.prototype,"applyDecalMapAfterDetailMap",void 0),t}(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,f.C6)(t,e),t}(Fo(mo)));(0,h.Y5)("BABYLON.StandardMaterial",Bo),Vt.Z.DefaultMaterialFactory=function(e){return new Bo("default material",e)};var Vo=n(87074),Uo=n(44256);Uo.ThinEngine.prototype.createDynamicTexture=function(e,t,n,r){var i=new Qi.h(this,4);return i.baseWidth=e,i.baseHeight=t,n&&(e=this.needPOTTextures?(0,Vo.R)(e,this._caps.maxTextureSize):e,t=this.needPOTTextures?(0,Vo.R)(t,this._caps.maxTextureSize):t),i.width=e,i.height=t,i.isReady=!1,i.generateMipMaps=n,i.samplingMode=r,this.updateTextureSamplingMode(r,i),this._internalTexturesCache.push(i),i},Uo.ThinEngine.prototype.updateDynamicTexture=function(e,t,n,r,i,o,a){if(void 0===r&&(r=!1),void 0===o&&(o=!1),void 0===a&&(a=!1),e){var s=this._gl,l=s.TEXTURE_2D,c=this._bindTextureDirectly(l,e,!0,o);this._unpackFlipY(void 0===n?e.invertY:n),r&&s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,1);var u=this._getWebGLTextureType(e.type),h=this._getInternalFormat(i||e.format),d=this._getRGBABufferInternalSizedFormat(e.type,h);s.texImage2D(l,0,d,h,u,t),e.generateMipMaps&&s.generateMipmap(l),c||this._bindTextureDirectly(l,null),r&&s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,0),i&&(e.format=i),e._dynamicTextureSource=t,e._premulAlpha=r,e.invertY=n||!1,e.isReady=!0}};var Go=function(e){function t(t,n,r,i,o,a,s){void 0===i&&(i=!1),void 0===o&&(o=b.Y.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===a&&(a=b.Y.TEXTUREFORMAT_RGBA);var l=this,c=!r||r._isScene,u=c?r:null==r?void 0:r.scene,h=c?!i:r;(l=e.call(this,null,u,h,s,o,void 0,void 0,void 0,void 0,a)||this).name=t,l.wrapU=_n.g.CLAMP_ADDRESSMODE,l.wrapV=_n.g.CLAMP_ADDRESSMODE,l._generateMipMaps=i;var d=l._getEngine();if(!d)return l;if(n.getContext)l._canvas=n,l._ownCanvas=!1,l._texture=d.createDynamicTexture(l._canvas.width,l._canvas.height,i,o);else{l._canvas=d.createCanvas(1,1),l._ownCanvas=!0;var p=n;p.width||0===p.width?l._texture=d.createDynamicTexture(p.width,p.height,i,o):l._texture=d.createDynamicTexture(n,n,i,o)}var f=l.getSize();return l._canvas.width!==f.width&&(l._canvas.width=f.width),l._canvas.height!==f.height&&(l._canvas.height=f.height),l._context=l._canvas.getContext("2d"),l}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"DynamicTexture"},Object.defineProperty(t.prototype,"canRescale",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype._recreate=function(e){this._canvas.width=e.width,this._canvas.height=e.height,this.releaseInternalTexture(),this._texture=this._getEngine().createDynamicTexture(e.width,e.height,this._generateMipMaps,this.samplingMode)},t.prototype.scale=function(e){var t=this.getSize();t.width*=e,t.height*=e,this._recreate(t)},t.prototype.scaleTo=function(e,t){var n=this.getSize();n.width=e,n.height=t,this._recreate(n)},t.prototype.getContext=function(){return this._context},t.prototype.clear=function(e){var t=this.getSize();e&&(this._context.fillStyle=e),this._context.clearRect(0,0,t.width,t.height)},t.prototype.update=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1),this._texture&&this._getEngine().updateDynamicTexture(this._texture,this._canvas,void 0===e||e,t,this._format||void 0,void 0,n)},t.prototype.drawText=function(e,t,n,r,i,o,a,s){void 0===s&&(s=!0);var l=this.getSize();if(o&&(this._context.fillStyle=o,this._context.fillRect(0,0,l.width,l.height)),this._context.font=r,null==t){var c=this._context.measureText(e);t=(l.width-c.width)/2}if(null==n){var u=parseInt(r.replace(/\D/g,""));n=l.height/2+u/3.65}this._context.fillStyle=i||"",this._context.fillText(e,t,n),s&&this.update(a)},t.prototype.dispose=function(){var t,n;e.prototype.dispose.call(this),this._ownCanvas&&(null===(n=null===(t=this._canvas)||void 0===t?void 0:t.remove)||void 0===n||n.call(t)),this._canvas=null,this._context=null},t.prototype.clone=function(){var e=this.getScene();if(!e)return this;var n=this.getSize(),r=new t(this.name,n,e,this._generateMipMaps);return r.hasAlpha=this.hasAlpha,r.level=this.level,r.wrapU=this.wrapU,r.wrapV=this.wrapV,r},t.prototype.serialize=function(){var n=this.getScene();n&&!n.isReady()&&y.V.Warn("The scene must be ready before serializing the dynamic texture");var r=e.prototype.serialize.call(this);return t._IsCanvasElement(this._canvas)&&(r.base64String=this._canvas.toDataURL()),r.invertY=this._invertY,r.samplingMode=this.samplingMode,r},t._IsCanvasElement=function(e){return void 0!==e.toDataURL},t.prototype._rebuild=function(){this.update()},t}(_n.g),ko=function(){function e(e,t,n,r,i){this.getWidth=e,this.getHeight=t,this.layer=n,this.layerType=r,this._createRenderTargetTextureProvider=i,this._rttWrapper=null}return Object.defineProperty(e.prototype,"isFixedFoveationSupported",{get:function(){return"XRWebGLLayer"==this.layerType&&"number"==typeof this.layer.fixedFoveation},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fixedFoveation",{get:function(){return this.isFixedFoveationSupported?this.layer.fixedFoveation:null},set:function(e){if(this.isFixedFoveationSupported){var t=Math.max(0,Math.min(1,e||0));this.layer.fixedFoveation=t}},enumerable:!1,configurable:!0}),e.prototype.createRenderTargetTextureProvider=function(e){return this._rttWrapper=this._createRenderTargetTextureProvider(e),this._rttWrapper},e.prototype.dispose=function(){this._rttWrapper&&(this._rttWrapper.dispose(),this._rttWrapper=null)},e}(),zo=n(90519),Wo=function(){function e(e,t){this._scene=e,this.layerWrapper=t,this._renderTargetTextures=new Array,this._engine=e.getEngine()}return e.prototype._createInternalTexture=function(e,t){var n=new Qi.h(this._engine,0,!0);return n.width=e.width,n.height=e.height,n._hardwareTexture=new zo.d(t,this._engine._gl),n.isReady=!0,n},e.prototype._createRenderTargetTexture=function(e,t,n,r,i,o){if(!this._engine)throw new Error("Engine is disposed");var a={width:e,height:t},s=o?new $i(this._scene,a):new Ji.$("XR renderTargetTexture",a,this._scene),l=s.renderTarget;if(l._samples=s.samples,!n&&r||(l._framebuffer=n),r)if(o)l._colorTextureArray=r;else{var c=this._createInternalTexture(a,r);l.setTexture(c,0),s._texture=c}return i&&(o?l._depthStencilTextureArray=i:l._depthStencilTexture=this._createInternalTexture(a,i)),s.disableRescaling(),this._renderTargetTextures.push(s),s},e.prototype._destroyRenderTargetTexture=function(e){this._renderTargetTextures.splice(this._renderTargetTextures.indexOf(e),1),e.dispose()},e.prototype.getFramebufferDimensions=function(){return this._framebufferDimensions},e.prototype.dispose=function(){for(var e=0,t=this._renderTargetTextures;e=this._maxX||t<=this._minZ||t>this._maxZ)return this.position.y;this._heightQuads&&0!=this._heightQuads.length||(this._initHeightQuads(),this._computeHeightQuads());var o=this._getFacetAt(e,t),a=-(o.x*e+o.z*t+o.w)/o.y;return c.Pq.TransformCoordinatesFromFloatsToRef(0,a,0,n,i),i.y},t.prototype.getNormalAtCoordinates=function(e,t){var n=new c.Pq(0,1,0);return this.getNormalAtCoordinatesToRef(e,t,n),n},t.prototype.getNormalAtCoordinatesToRef=function(e,t,n){var r=this.getWorldMatrix(),i=c.AA.Matrix[5];r.invertToRef(i);var o=c.AA.Vector3[8];if(c.Pq.TransformCoordinatesFromFloatsToRef(e,0,t,i,o),e=o.x,t=o.z,ethis._maxX||tthis._maxZ)return this;this._heightQuads&&0!=this._heightQuads.length||(this._initHeightQuads(),this._computeHeightQuads());var a=this._getFacetAt(e,t);return c.Pq.TransformNormalFromFloatsToRef(a.x,a.y,a.z,r,n),this},t.prototype.updateCoordinateHeights=function(){return this._heightQuads&&0!=this._heightQuads.length||this._initHeightQuads(),this._computeHeightQuads(),this},t.prototype._getFacetAt=function(e,t){var n=Math.floor((e+this._maxX)*this._subdivisionsX/this._width),r=Math.floor(-(t+this._maxZ)*this._subdivisionsY/this._height+this._subdivisionsY),i=this._heightQuads[r*this._subdivisionsX+n];return te.maxHeight){h=!0;var d=e.maxHeight;e.maxHeight=e.minHeight,e.minHeight=d}for(t=0;t<=e.subdivisions;t++)for(n=0;n<=e.subdivisions;n++){var p=new c.Pq(n*e.width/e.subdivisions-e.width/2,0,(e.subdivisions-t)*e.height/e.subdivisions-e.height/2),f=4*(((p.x+e.width/2)/e.width*(e.bufferWidth-1)|0)+((1-(p.z+e.height/2)/e.height)*(e.bufferHeight-1)|0)*e.bufferWidth),m=e.buffer[f]/255,_=e.buffer[f+1]/255,g=e.buffer[f+2]/255,v=e.buffer[f+3]/255;h&&(m=1-m,_=1-_,g=1-g);var y=m*s.r+_*s.g+g*s.b;p.y=v>=l?e.minHeight+(e.maxHeight-e.minHeight)*y:e.minHeight-Re.bH,e.heightBuffer&&(e.heightBuffer[t*(e.subdivisions+1)+n]=p.y),i.push(p.x,p.y,p.z),o.push(0,0,0),a.push(n/e.subdivisions,1-t/e.subdivisions)}for(t=0;t=e.minHeight,P=i[3*S+1]>=e.minHeight,C=i[3*T+1]>=e.minHeight;x&&P&&C&&(r.push(b),r.push(S),r.push(T)),i[3*E+1]>=e.minHeight&&x&&C&&(r.push(E),r.push(b),r.push(T))}ge.ComputeNormals(i,r,o);var R=new ge;return R.indices=r,R.positions=i,R.normals=o,R.uvs=a,R}function na(e,t,n){void 0===t&&(t={});var r=new Jo(e,n);return r._setReady(!1),r._subdivisionsX=t.subdivisionsX||t.subdivisions||1,r._subdivisionsY=t.subdivisionsY||t.subdivisions||1,r._width=t.width||1,r._height=t.height||1,r._maxX=r._width/2,r._maxZ=r._height/2,r._minX=-r._maxX,r._minZ=-r._maxZ,$o(t).applyToMesh(r,t.updatable),r._setReady(!0),r}function ra(e,t,n){void 0===n&&(n=null);var r=new qe(e,n);return ea(t).applyToMesh(r,t.updatable),r}function ia(e,t,n,r){void 0===n&&(n={}),void 0===r&&(r=null);var i=n.width||10,o=n.height||10,a=n.subdivisions||1,s=n.minHeight||0,l=n.maxHeight||1,c=n.colorFilter||new u.v9(.3,.59,.11),h=n.alphaFilter||0,d=n.updatable,p=n.onReady;r=r||M.q.LastCreatedScene;var f,m=new Jo(e,r);m._subdivisionsX=a,m._subdivisionsY=a,m._width=i,m._height=o,m._maxX=m._width/2,m._maxZ=m._height/2,m._minX=-m._maxX,m._minZ=-m._maxZ,m._setReady(!1),n.passHeightBufferInCallback&&(f=new Float32Array((a+1)*(a+1)));var _=function(e,t,n){ta({width:i,height:o,subdivisions:a,minHeight:s,maxHeight:l,colorFilter:c,buffer:e,bufferWidth:t,bufferHeight:n,alphaFilter:h,heightBuffer:f}).applyToMesh(m,d),p&&p(m,f),m._setReady(!0)};return"string"==typeof t?Z.S0.LoadImage(t,(function(e){var t=e.width,n=e.height;if(!r.isDisposed){var i=null==r?void 0:r.getEngine().resizeImageBitmap(e,t,n);_(i,t,n)}}),n.onError?n.onError:function(){},r.offlineProvider):_(t.data,t.width,t.height),m}var oa={CreateGround:na,CreateGroundFromHeightMap:ia,CreateTiledGround:ra};function aa(e){for(var t=[],n=[],r=[],i=[],o=e.diameter||1,a=e.thickness||.5,s=0|(e.tessellation||16),l=0===e.sideOrientation?0:e.sideOrientation||ge.DEFAULTSIDE,u=s+1,h=0;h<=s;h++)for(var d=h/s,p=h*Math.PI*2/s-Math.PI/2,f=c.uq.Translation(o/2,0,0).multiply(c.uq.RotationY(p)),m=0;m<=s;m++){var _=1-m/s,g=m*Math.PI*2/s+Math.PI,v=Math.cos(g),y=Math.sin(g),b=new c.Pq(v,y,0),S=b.scale(a/2),T=new c.I9(d,_);S=c.Pq.TransformCoordinates(S,f),b=c.Pq.TransformNormal(b,f),n.push(S.x,S.y,S.z),r.push(b.x,b.y,b.z),i.push(T.x,ye.rX?1-T.y:T.y);var E=(h+1)%u,x=(m+1)%u;t.push(h*u+m),t.push(h*u+x),t.push(E*u+m),t.push(h*u+x),t.push(E*u+x),t.push(E*u+m)}ge._ComputeSides(l,n,t,r,i,e.frontUVs,e.backUVs);var P=new ge;return P.indices=t,P.positions=n,P.normals=r,P.uvs=i,P}function sa(e,t,n){void 0===t&&(t={});var r=new qe(e,n);return t.sideOrientation=qe._GetDefaultSideOrientation(t.sideOrientation),r._originalBuilderSideOrientation=t.sideOrientation,aa(t).applyToMesh(r,t.updatable),r}ge.CreateGround=$o,ge.CreateTiledGround=ea,ge.CreateGroundFromHeightMap=ta,qe.CreateGround=function(e,t,n,r,i,o){return na(e,{width:t,height:n,subdivisions:r,updatable:o},i)},qe.CreateTiledGround=function(e,t,n,r,i,o,a,s,l){return ra(e,{xmin:t,zmin:n,xmax:r,zmax:i,subdivisions:o,precision:a,updatable:l},s)},qe.CreateGroundFromHeightMap=function(e,t,n,r,i,o,a,s,l,c,u){return ia(e,t,{width:n,height:r,subdivisions:i,minHeight:o,maxHeight:a,updatable:l,onReady:c,alphaFilter:u},s)};var la={CreateTorus:sa};ge.CreateTorus=aa,qe.CreateTorus=function(e,t,n,r,i,o,a){return sa(e,{diameter:t,thickness:n,tessellation:r,sideOrientation:a,updatable:o},i)};var ca=function(e){function t(t,n){var r=e.call(this,n)||this;return r._getCamera=t,r}return(0,f.C6)(t,e),t.prototype._getForwardRay=function(e){var t=this._getCamera();return t?t.getForwardRay(e):new Nn(c.Pq.Zero(),c.Pq.Forward())},t}(function(){function e(t,n){if(void 0===n&&(n=null),this.scene=t,this._pointerDownOnMeshAsked=!1,this._isActionableMesh=!1,this._teleportationRequestInitiated=!1,this._teleportationBackRequestInitiated=!1,this._rotationRightAsked=!1,this._rotationLeftAsked=!1,this._dpadPressed=!0,this._activePointer=!1,this._id=e._IdCounter++,n)this._gazeTracker=n.clone("gazeTracker");else{this._gazeTracker=sa("gazeTracker",{diameter:.0035,thickness:.0025,tessellation:20,updatable:!1},t),this._gazeTracker.bakeCurrentTransformIntoVertices(),this._gazeTracker.isPickable=!1,this._gazeTracker.isVisible=!1;var r=new Bo("targetMat",t);r.specularColor=u.v9.Black(),r.emissiveColor=new u.v9(.7,.7,.7),r.backFaceCulling=!1,this._gazeTracker.material=r}}return e.prototype._getForwardRay=function(e){return new Nn(c.Pq.Zero(),new c.Pq(0,0,e))},e.prototype._selectionPointerDown=function(){this._pointerDownOnMeshAsked=!0,this._currentHit&&this.scene.simulatePointerDown(this._currentHit,{pointerId:this._id})},e.prototype._selectionPointerUp=function(){this._currentHit&&this.scene.simulatePointerUp(this._currentHit,{pointerId:this._id}),this._pointerDownOnMeshAsked=!1},e.prototype._activatePointer=function(){this._activePointer=!0},e.prototype._deactivatePointer=function(){this._activePointer=!1},e.prototype._updatePointerDistance=function(e){void 0===e&&(e=100)},e.prototype.dispose=function(){this._interactionsEnabled=!1,this._teleportationEnabled=!1,this._gazeTracker&&this._gazeTracker.dispose()},e._IdCounter=0,e}()),ua=function(){},ha=function(){function e(t,n){void 0===n&&(n={});var r=this;if(this.webVROptions=n,this._fullscreenVRpresenting=!1,this.enableGazeEvenWhenNoPointerLock=!1,this.exitVROnDoubleTap=!0,this.onEnteringVRObservable=new l.cP,this.onAfterEnteringVRObservable=new l.cP,this.onExitingVRObservable=new l.cP,this._useCustomVRButton=!1,this._teleportActive=!1,this._floorMeshesCollection=[],this._teleportationMode=e.TELEPORTATIONMODE_CONSTANTTIME,this._teleportationTime=122,this._teleportationSpeed=20,this._rotationAllowed=!0,this._teleportBackwardsVector=new c.Pq(0,-1,-1),this._isDefaultTeleportationTarget=!0,this._teleportationFillColor="#444444",this._teleportationBorderColor="#FFFFFF",this._rotationAngle=0,this._haloCenter=new c.Pq(0,0,0),this._padSensibilityUp=.65,this._padSensibilityDown=.35,this._pickedLaserColor=new u.v9(.2,.2,1),this._pickedGazeColor=new u.v9(0,0,1),this.onNewMeshSelected=new l.cP,this.onNewMeshPicked=new l.cP,this.onBeforeCameraTeleport=new l.cP,this.onAfterCameraTeleport=new l.cP,this.onSelectedMeshUnselected=new l.cP,this.teleportationEnabled=!0,this._teleportationInitialized=!1,this._interactionsEnabled=!1,this._displayGaze=!0,this._displayLaserPointer=!0,this.updateGazeTrackerScale=!0,this.updateGazeTrackerColor=!0,this.updateControllerLaserColor=!0,this.requestPointerLockOnFullScreen=!0,this.xrTestDone=!1,this._onResize=function(){r._moveButtonToBottomRight()},this._onFullscreenChange=function(){r._fullscreenVRpresenting=!!document.fullscreenElement,!r._fullscreenVRpresenting&&r._inputElement&&(r.exitVR(),!r._useCustomVRButton&&r._btnVR&&(r._btnVR.style.top=r._inputElement.offsetTop+r._inputElement.offsetHeight-70+"px",r._btnVR.style.left=r._inputElement.offsetLeft+r._inputElement.offsetWidth-100+"px",r._updateButtonVisibility()))},this._cachedAngularSensibility={angularSensibilityX:null,angularSensibilityY:null,angularSensibility:null},this._beforeRender=function(){r._scene.getEngine().isPointerLock||r.enableGazeEvenWhenNoPointerLock||(r._cameraGazer._gazeTracker.isVisible=!1)},this._onNewGamepadConnected=function(e){e.type!==Pr.POSE_ENABLED&&(e.leftStick&&e.onleftstickchanged((function(e){r._teleportationInitialized&&r.teleportationEnabled&&(r._checkTeleportWithRay(e,r._cameraGazer),r._checkTeleportBackwards(e,r._cameraGazer))})),e.rightStick&&e.onrightstickchanged((function(e){r._teleportationInitialized&&r._checkRotate(e,r._cameraGazer)})),e.type===Pr.XBOX&&(e.onbuttondown((function(e){r._interactionsEnabled&&0===e&&r._cameraGazer._selectionPointerDown()})),e.onbuttonup((function(e){r._interactionsEnabled&&0===e&&r._cameraGazer._selectionPointerUp()}))))},this._workingVector=c.Pq.Zero(),this._workingQuaternion=c.PT.Identity(),this._workingMatrix=c.uq.Identity(),y.V.Warn("WebVR is deprecated. Please avoid using this experience helper and use the WebXR experience helper instead"),this._scene=t,this._inputElement=t.getEngine().getInputElement(),"getVRDisplays"in navigator||void 0!==n.useXR||(n.useXR=!0),void 0===n.createFallbackVRDeviceOrientationFreeCamera&&(n.createFallbackVRDeviceOrientationFreeCamera=!0),void 0===n.createDeviceOrientationCamera&&(n.createDeviceOrientationCamera=!0),void 0===n.laserToggle&&(n.laserToggle=!0),this._hasEnteredVR=!1,this._scene.activeCamera?this._position=this._scene.activeCamera.position.clone():this._position=new c.Pq(0,this._defaultHeight,0),n.createDeviceOrientationCamera||!this._scene.activeCamera){if(this._deviceOrientationCamera=new li("deviceOrientationVRHelper",this._position.clone(),t),this._scene.activeCamera&&(this._deviceOrientationCamera.minZ=this._scene.activeCamera.minZ,this._deviceOrientationCamera.maxZ=this._scene.activeCamera.maxZ,this._scene.activeCamera instanceof ti&&this._scene.activeCamera.rotation)){var i=this._scene.activeCamera;i.rotationQuaternion?this._deviceOrientationCamera.rotationQuaternion.copyFrom(i.rotationQuaternion):this._deviceOrientationCamera.rotationQuaternion.copyFrom(c.PT.RotationYawPitchRoll(i.rotation.y,i.rotation.x,i.rotation.z)),this._deviceOrientationCamera.rotation=i.rotation.clone()}this._scene.activeCamera=this._deviceOrientationCamera,this._inputElement&&this._scene.activeCamera.attachControl()}else this._existingCamera=this._scene.activeCamera;this.webVROptions.useXR&&navigator.xr?Qo.IsSessionSupportedAsync("immersive-vr").then((function(e){e?(y.V.Log("Using WebXR. It is recommended to use the WebXRDefaultExperience directly"),t.createDefaultXRExperienceAsync({floorMeshes:n.floorMeshes||[]}).then((function(e){r.xr=e,r.xrTestDone=!0,r._cameraGazer=new ca((function(){return r.xr.baseExperience.camera}),t),r.xr.baseExperience.onStateChangedObservable.add((function(e){switch(e){case 0:r.onEnteringVRObservable.notifyObservers(r),r._interactionsEnabled||r.xr.pointerSelection.detach(),r.xr.pointerSelection.displayLaserPointer=r._displayLaserPointer;break;case 1:r.onExitingVRObservable.notifyObservers(r),r._scene.getEngine().resize();break;case 2:r._hasEnteredVR=!0;break;case 3:r._hasEnteredVR=!1}}))}))):r._completeVRInit(t,n)})):this._completeVRInit(t,n)}return Object.defineProperty(e.prototype,"onEnteringVR",{get:function(){return this.onEnteringVRObservable},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onExitingVR",{get:function(){return this.onExitingVRObservable},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"teleportationTarget",{get:function(){return this._teleportationTarget},set:function(e){e&&(e.name="teleportationTarget",this._isDefaultTeleportationTarget=!1,this._teleportationTarget=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"gazeTrackerMesh",{get:function(){return this._cameraGazer._gazeTracker},set:function(e){e&&(this._cameraGazer._gazeTracker&&this._cameraGazer._gazeTracker.dispose(),this._cameraGazer._gazeTracker=e,this._cameraGazer._gazeTracker.bakeCurrentTransformIntoVertices(),this._cameraGazer._gazeTracker.isPickable=!1,this._cameraGazer._gazeTracker.isVisible=!1,this._cameraGazer._gazeTracker.name="gazeTracker")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"displayGaze",{get:function(){return this._displayGaze},set:function(e){this._displayGaze=e,e||(this._cameraGazer._gazeTracker.isVisible=!1)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"displayLaserPointer",{get:function(){return this._displayLaserPointer},set:function(e){this._displayLaserPointer=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"deviceOrientationCamera",{get:function(){return this._deviceOrientationCamera},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentVRCamera",{get:function(){return this._scene.activeCamera},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vrDeviceOrientationCamera",{get:function(){return this._vrDeviceOrientationCamera},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vrButton",{get:function(){return this._btnVR},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_teleportationRequestInitiated",{get:function(){return this._cameraGazer._teleportationRequestInitiated},enumerable:!1,configurable:!0}),e.prototype._completeVRInit=function(e,t){var n=this;if(this.xrTestDone=!0,t.createFallbackVRDeviceOrientationFreeCamera&&(this._vrDeviceOrientationCamera=new ao("VRDeviceOrientationVRHelper",this._position,this._scene,!0,t.vrDeviceOrientationCameraMetrics),this._vrDeviceOrientationCamera.angularSensibility=Number.MAX_VALUE),this._cameraGazer=new ca((function(){return n.currentVRCamera}),e),!this._useCustomVRButton){this._btnVR=document.createElement("BUTTON"),this._btnVR.className="babylonVRicon",this._btnVR.id="babylonVRiconbtn",this._btnVR.title="Click to switch to VR";var r=".babylonVRicon { position: absolute; right: 20px; height: 50px; width: 80px; background-color: rgba(51,51,51,0.7); background-image: url("+(window.SVGSVGElement?"data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%222048%22%20height%3D%221152%22%20viewBox%3D%220%200%202048%201152%22%20version%3D%221.1%22%3E%3Cpath%20transform%3D%22rotate%28180%201024%2C576.0000000000001%29%22%20d%3D%22m1109%2C896q17%2C0%2030%2C-12t13%2C-30t-12.5%2C-30.5t-30.5%2C-12.5l-170%2C0q-18%2C0%20-30.5%2C12.5t-12.5%2C30.5t13%2C30t30%2C12l170%2C0zm-85%2C256q59%2C0%20132.5%2C-1.5t154.5%2C-5.5t164.5%2C-11.5t163%2C-20t150%2C-30t124.5%2C-41.5q23%2C-11%2042%2C-24t38%2C-30q27%2C-25%2041%2C-61.5t14%2C-72.5l0%2C-257q0%2C-123%20-47%2C-232t-128%2C-190t-190%2C-128t-232%2C-47l-81%2C0q-37%2C0%20-68.5%2C14t-60.5%2C34.5t-55.5%2C45t-53%2C45t-53%2C34.5t-55.5%2C14t-55.5%2C-14t-53%2C-34.5t-53%2C-45t-55.5%2C-45t-60.5%2C-34.5t-68.5%2C-14l-81%2C0q-123%2C0%20-232%2C47t-190%2C128t-128%2C190t-47%2C232l0%2C257q0%2C68%2038%2C115t97%2C73q54%2C24%20124.5%2C41.5t150%2C30t163%2C20t164.5%2C11.5t154.5%2C5.5t132.5%2C1.5zm939%2C-298q0%2C39%20-24.5%2C67t-58.5%2C42q-54%2C23%20-122%2C39.5t-143.5%2C28t-155.5%2C19t-157%2C11t-148.5%2C5t-129.5%2C1.5q-59%2C0%20-130%2C-1.5t-148%2C-5t-157%2C-11t-155.5%2C-19t-143.5%2C-28t-122%2C-39.5q-34%2C-14%20-58.5%2C-42t-24.5%2C-67l0%2C-257q0%2C-106%2040.5%2C-199t110%2C-162.5t162.5%2C-109.5t199%2C-40l81%2C0q27%2C0%2052%2C14t50%2C34.5t51%2C44.5t55.5%2C44.5t63.5%2C34.5t74%2C14t74%2C-14t63.5%2C-34.5t55.5%2C-44.5t51%2C-44.5t50%2C-34.5t52%2C-14l14%2C0q37%2C0%2070%2C0.5t64.5%2C4.5t63.5%2C12t68%2C23q71%2C30%20128.5%2C78.5t98.5%2C110t63.5%2C133.5t22.5%2C149l0%2C257z%22%20fill%3D%22white%22%20/%3E%3C/svg%3E%0A":"https://cdn.babylonjs.com/Assets/vrButton.png")+"); background-size: 80%; background-repeat:no-repeat; background-position: center; border: none; outline: none; transition: transform 0.125s ease-out } .babylonVRicon:hover { transform: scale(1.05) } .babylonVRicon:active {background-color: rgba(51,51,51,1) } .babylonVRicon:focus {background-color: rgba(51,51,51,1) }";r+=".babylonVRicon.vrdisplaypresenting { display: none; }";var i=document.createElement("style");i.appendChild(document.createTextNode(r)),document.getElementsByTagName("head")[0].appendChild(i),this._moveButtonToBottomRight()}this._btnVR&&this._btnVR.addEventListener("click",(function(){n.isInVRMode||n.enterVR()}));var o=this._scene.getEngine().getHostWindow();o&&(o.addEventListener("resize",this._onResize),document.addEventListener("fullscreenchange",this._onFullscreenChange,!1),t.createFallbackVRDeviceOrientationFreeCamera&&this._displayVRButton(),this._onKeyDown=function(e){27===e.keyCode&&n.isInVRMode&&n.exitVR()},document.addEventListener("keydown",this._onKeyDown),this._scene.onPrePointerObservable.add((function(){n._hasEnteredVR&&n.exitVROnDoubleTap&&(n.exitVR(),n._fullscreenVRpresenting&&n._scene.getEngine().exitFullscreen())}),En.Zp.POINTERDOUBLETAP,!1),e.onDisposeObservable.add((function(){n.dispose()})),this._updateButtonVisibility(),this._circleEase=new k.rm,this._circleEase.setEasingMode(k.KA.EASINGMODE_EASEINOUT),this._teleportationEasing=this._circleEase,e.onPointerObservable.add((function(t){n._interactionsEnabled&&e.activeCamera===n.vrDeviceOrientationCamera&&"mouse"===t.event.pointerType&&(t.type===En.Zp.POINTERDOWN?n._cameraGazer._selectionPointerDown():t.type===En.Zp.POINTERUP&&n._cameraGazer._selectionPointerUp())})),this.webVROptions.floorMeshes&&this.enableTeleportation({floorMeshes:this.webVROptions.floorMeshes}))},Object.defineProperty(e.prototype,"isInVRMode",{get:function(){return this.xr&&this.webVROptions.useXR&&2===this.xr.baseExperience.state||this._fullscreenVRpresenting},enumerable:!1,configurable:!0}),e.prototype._moveButtonToBottomRight=function(){if(this._inputElement&&!this._useCustomVRButton&&this._btnVR){var e=this._inputElement.getBoundingClientRect();this._btnVR.style.top=e.top+e.height-70+"px",this._btnVR.style.left=e.left+e.width-100+"px"}},e.prototype._displayVRButton=function(){this._useCustomVRButton||this._btnVRDisplayed||!this._btnVR||(document.body.appendChild(this._btnVR),this._btnVRDisplayed=!0)},e.prototype._updateButtonVisibility=function(){this._btnVR&&!this._useCustomVRButton&&(this._btnVR.className="babylonVRicon",this.isInVRMode&&(this._btnVR.className+=" vrdisplaypresenting"))},e.prototype.enterVR=function(){var e=this;if(this.xr)this.xr.baseExperience.enterXRAsync("immersive-vr","local-floor",this.xr.renderTarget);else{if(this.onEnteringVRObservable)try{this.onEnteringVRObservable.notifyObservers(this)}catch(e){y.V.Warn("Error in your custom logic onEnteringVR: "+e)}this._scene.activeCamera&&(this._position=this._scene.activeCamera.position.clone(),this.vrDeviceOrientationCamera&&(this.vrDeviceOrientationCamera.rotation=c.PT.FromRotationMatrix(this._scene.activeCamera.getWorldMatrix().getRotationMatrix()).toEulerAngles(),this.vrDeviceOrientationCamera.angularSensibility=2e3),this._existingCamera=this._scene.activeCamera,this._existingCamera.angularSensibilityX&&(this._cachedAngularSensibility.angularSensibilityX=this._existingCamera.angularSensibilityX,this._existingCamera.angularSensibilityX=Number.MAX_VALUE),this._existingCamera.angularSensibilityY&&(this._cachedAngularSensibility.angularSensibilityY=this._existingCamera.angularSensibilityY,this._existingCamera.angularSensibilityY=Number.MAX_VALUE),this._existingCamera.angularSensibility&&(this._cachedAngularSensibility.angularSensibility=this._existingCamera.angularSensibility,this._existingCamera.angularSensibility=Number.MAX_VALUE)),this._vrDeviceOrientationCamera&&(this._vrDeviceOrientationCamera.position=this._position,this._scene.activeCamera&&(this._vrDeviceOrientationCamera.minZ=this._scene.activeCamera.minZ),this._scene.activeCamera=this._vrDeviceOrientationCamera,this._scene.getEngine().enterFullscreen(this.requestPointerLockOnFullScreen),this._updateButtonVisibility(),this._vrDeviceOrientationCamera.onViewMatrixChangedObservable.addOnce((function(){e.onAfterEnteringVRObservable.notifyObservers({success:!0})}))),this._scene.activeCamera&&this._inputElement&&this._scene.activeCamera.attachControl(),this._interactionsEnabled&&this._scene.registerBeforeRender(this._beforeRender),this._hasEnteredVR=!0}},e.prototype.exitVR=function(){if(this.xr)this.xr.baseExperience.exitXRAsync();else if(this._hasEnteredVR){if(this.onExitingVRObservable)try{this.onExitingVRObservable.notifyObservers(this)}catch(e){y.V.Warn("Error in your custom logic onExitingVR: "+e)}this._scene.activeCamera&&(this._position=this._scene.activeCamera.position.clone()),this.vrDeviceOrientationCamera&&(this.vrDeviceOrientationCamera.angularSensibility=Number.MAX_VALUE),this._deviceOrientationCamera?(this._deviceOrientationCamera.position=this._position,this._scene.activeCamera=this._deviceOrientationCamera,this._cachedAngularSensibility.angularSensibilityX&&(this._deviceOrientationCamera.angularSensibilityX=this._cachedAngularSensibility.angularSensibilityX,this._cachedAngularSensibility.angularSensibilityX=null),this._cachedAngularSensibility.angularSensibilityY&&(this._deviceOrientationCamera.angularSensibilityY=this._cachedAngularSensibility.angularSensibilityY,this._cachedAngularSensibility.angularSensibilityY=null),this._cachedAngularSensibility.angularSensibility&&(this._deviceOrientationCamera.angularSensibility=this._cachedAngularSensibility.angularSensibility,this._cachedAngularSensibility.angularSensibility=null)):this._existingCamera&&(this._existingCamera.position=this._position,this._scene.activeCamera=this._existingCamera,this._inputElement&&this._scene.activeCamera.attachControl(),this._cachedAngularSensibility.angularSensibilityX&&(this._existingCamera.angularSensibilityX=this._cachedAngularSensibility.angularSensibilityX,this._cachedAngularSensibility.angularSensibilityX=null),this._cachedAngularSensibility.angularSensibilityY&&(this._existingCamera.angularSensibilityY=this._cachedAngularSensibility.angularSensibilityY,this._cachedAngularSensibility.angularSensibilityY=null),this._cachedAngularSensibility.angularSensibility&&(this._existingCamera.angularSensibility=this._cachedAngularSensibility.angularSensibility,this._cachedAngularSensibility.angularSensibility=null)),this._updateButtonVisibility(),this._interactionsEnabled&&(this._scene.unregisterBeforeRender(this._beforeRender),this._cameraGazer._gazeTracker.isVisible=!1),this._scene.getEngine().resize(),this._hasEnteredVR=!1}},Object.defineProperty(e.prototype,"position",{get:function(){return this._position},set:function(e){this._position=e,this._scene.activeCamera&&(this._scene.activeCamera.position=e)},enumerable:!1,configurable:!0}),e.prototype.enableInteractions=function(){var e=this;if(!this._interactionsEnabled){if(this.xr)return void(2===this.xr.baseExperience.state&&this.xr.pointerSelection.attach());this.raySelectionPredicate=function(t){return t.isVisible&&(t.isPickable||t.name===e._floorMeshName)},this.meshSelectionPredicate=function(){return!0},this._raySelectionPredicate=function(t){return!!(e._isTeleportationFloor(t)||-1===t.name.indexOf("gazeTracker")&&-1===t.name.indexOf("teleportationTarget")&&-1===t.name.indexOf("torusTeleportation"))&&e.raySelectionPredicate(t)},this._interactionsEnabled=!0}},e.prototype._isTeleportationFloor=function(e){for(var t=0;t-1||this._floorMeshesCollection.push(e))},e.prototype.removeFloorMesh=function(e){if(this._floorMeshesCollection){var t=this._floorMeshesCollection.indexOf(e);-1!==t&&this._floorMeshesCollection.splice(t,1)}},e.prototype.enableTeleportation=function(e){var t=this;if(void 0===e&&(e={}),!this._teleportationInitialized){if(this.enableInteractions(),this.webVROptions.useXR&&(e.floorMeshes||e.floorMeshName)){var n=e.floorMeshes||[];if(!n.length){var r=this._scene.getMeshByName(e.floorMeshName);r&&n.push(r)}if(this.xr){for(var i=0,o=n;i0&&(this._teleportationTime=e.teleportationTime),e.teleportationSpeed&&e.teleportationSpeed>0&&(this._teleportationSpeed=e.teleportationSpeed),void 0!==e.easingFunction&&(this._teleportationEasing=e.easingFunction);var l=new lo.p;l.vignetteColor=new u.ov(0,0,0,0),l.vignetteEnabled=!0,this._teleportationInitialized=!0,this._isDefaultTeleportationTarget&&this._createTeleportationCircles()}},e.prototype._checkTeleportWithRay=function(e,t){this._teleportationRequestInitiated&&!t._teleportationRequestInitiated||(t._teleportationRequestInitiated?Math.sqrt(e.y*e.y+e.x*e.x)-this._padSensibilityDown&&(t._rotationLeftAsked=!1):e.x<-this._padSensibilityUp&&t._dpadPressed&&(t._rotationLeftAsked=!0,this._rotationAllowed&&this._rotateCamera(!1)),t._rotationRightAsked?e.xthis._padSensibilityUp&&t._dpadPressed&&(t._rotationRightAsked=!0,this._rotationAllowed&&this._rotateCamera(!0)))},e.prototype._checkTeleportBackwards=function(e,t){if(!t._teleportationRequestInitiated)if(e.y>this._padSensibilityUp&&t._dpadPressed){if(!t._teleportationBackRequestInitiated){if(!this.currentVRCamera)return;var n=c.PT.FromRotationMatrix(this.currentVRCamera.getWorldMatrix().getRotationMatrix()),r=this.currentVRCamera.position;n.toEulerAnglesToRef(this._workingVector),this._workingVector.z=0,this._workingVector.x=0,c.PT.RotationYawPitchRollToRef(this._workingVector.y,this._workingVector.x,this._workingVector.z,this._workingQuaternion),this._workingQuaternion.toRotationMatrix(this._workingMatrix),c.Pq.TransformCoordinatesToRef(this._teleportBackwardsVector,this._workingMatrix,this._workingVector);var i=new Nn(r,this._workingVector),o=this._scene.pickWithRay(i,this._raySelectionPredicate);o&&o.pickedPoint&&o.pickedMesh&&this._isTeleportationFloor(o.pickedMesh)&&o.distance<5&&this.teleportCamera(o.pickedPoint),t._teleportationBackRequestInitiated=!0}}else t._teleportationBackRequestInitiated=!1},e.prototype._createTeleportationCircles=function(){this._teleportationTarget=na("teleportationTarget",{width:2,height:2,subdivisions:2},this._scene),this._teleportationTarget.isPickable=!1;var e=new Go("DynamicTexture",512,this._scene,!0);e.hasAlpha=!0;var t=e.getContext();t.beginPath(),t.arc(256,256,200,0,2*Math.PI,!1),t.fillStyle=this._teleportationFillColor,t.fill(),t.lineWidth=10,t.strokeStyle=this._teleportationBorderColor,t.stroke(),t.closePath(),e.update();var n=new Bo("TextPlaneMaterial",this._scene);n.diffuseTexture=e,this._teleportationTarget.material=n;var r=sa("torusTeleportation",{diameter:.75,thickness:.1,tessellation:25,updatable:!1},this._scene);r.isPickable=!1,r.parent=this._teleportationTarget;var i=new w.X5("animationInnerCircle","position.y",30,w.X5.ANIMATIONTYPE_FLOAT,w.X5.ANIMATIONLOOPMODE_CYCLE),o=[];o.push({frame:0,value:0}),o.push({frame:30,value:.4}),o.push({frame:60,value:0}),i.setKeys(o);var a=new k.kc;a.setEasingMode(k.KA.EASINGMODE_EASEINOUT),i.setEasingFunction(a),r.animations=[],r.animations.push(i),this._scene.beginAnimation(r,0,60,!0),this._hideTeleportationTarget()},e.prototype._hideTeleportationTarget=function(){this._teleportActive=!1,this._teleportationInitialized&&(this._teleportationTarget.isVisible=!1,this._isDefaultTeleportationTarget&&(this._teleportationTarget.getChildren()[0].isVisible=!1))},e.prototype._rotateCamera=function(e){if(this.currentVRCamera instanceof ni){e?this._rotationAngle++:this._rotationAngle--,this.currentVRCamera.animations=[];var t=c.PT.FromRotationMatrix(c.uq.RotationY(Math.PI/4*this._rotationAngle)),n=new w.X5("animationRotation","rotationQuaternion",90,w.X5.ANIMATIONTYPE_QUATERNION,w.X5.ANIMATIONLOOPMODE_CONSTANT),r=[];r.push({frame:0,value:this.currentVRCamera.rotationQuaternion}),r.push({frame:6,value:t}),n.setKeys(r),n.setEasingFunction(this._circleEase),this.currentVRCamera.animations.push(n),this._postProcessMove.animations=[];var i=new w.X5("animationPP","vignetteWeight",90,w.X5.ANIMATIONTYPE_FLOAT,w.X5.ANIMATIONLOOPMODE_CONSTANT),o=[];o.push({frame:0,value:0}),o.push({frame:3,value:4}),o.push({frame:6,value:0}),i.setKeys(o),i.setEasingFunction(this._circleEase),this._postProcessMove.animations.push(i);var a=new w.X5("animationPP2","vignetteStretch",90,w.X5.ANIMATIONTYPE_FLOAT,w.X5.ANIMATIONLOOPMODE_CONSTANT),s=[];s.push({frame:0,value:0}),s.push({frame:3,value:10}),s.push({frame:6,value:0}),a.setKeys(s),a.setEasingFunction(this._circleEase),this._postProcessMove.animations.push(a),this._postProcessMove.imageProcessingConfiguration.vignetteWeight=0,this._postProcessMove.imageProcessingConfiguration.vignetteStretch=0,this._postProcessMove.samples=4,this._scene.beginAnimation(this.currentVRCamera,0,6,!1,1)}},e.prototype.teleportCamera=function(t){var n=this;if(this.currentVRCamera instanceof ni){var r,i;if(this._workingVector.copyFrom(t),this.isInVRMode||(this._workingVector.y+=this._defaultHeight),this.onBeforeCameraTeleport.notifyObservers(this._workingVector),this._teleportationMode==e.TELEPORTATIONMODE_CONSTANTSPEED){i=90;var o=c.Pq.Distance(this.currentVRCamera.position,this._workingVector);r=this._teleportationSpeed/o}else i=Math.round(90*this._teleportationTime/1e3),r=1;this.currentVRCamera.animations=[];var a=new w.X5("animationCameraTeleportation","position",90,w.X5.ANIMATIONTYPE_VECTOR3,w.X5.ANIMATIONLOOPMODE_CONSTANT),s=[{frame:0,value:this.currentVRCamera.position},{frame:i,value:this._workingVector}];a.setKeys(s),a.setEasingFunction(this._teleportationEasing),this.currentVRCamera.animations.push(a),this._postProcessMove.animations=[];var l=Math.round(i/2),u=new w.X5("animationPP","vignetteWeight",90,w.X5.ANIMATIONTYPE_FLOAT,w.X5.ANIMATIONLOOPMODE_CONSTANT),h=[];h.push({frame:0,value:0}),h.push({frame:l,value:8}),h.push({frame:i,value:0}),u.setKeys(h),this._postProcessMove.animations.push(u);var d=new w.X5("animationPP2","vignetteStretch",90,w.X5.ANIMATIONTYPE_FLOAT,w.X5.ANIMATIONLOOPMODE_CONSTANT),p=[];p.push({frame:0,value:0}),p.push({frame:l,value:10}),p.push({frame:i,value:0}),d.setKeys(p),this._postProcessMove.animations.push(d),this._postProcessMove.imageProcessingConfiguration.vignetteWeight=0,this._postProcessMove.imageProcessingConfiguration.vignetteStretch=0,this._scene.beginAnimation(this.currentVRCamera,0,i,!1,r,(function(){n.onAfterCameraTeleport.notifyObservers(n._workingVector)})),this._hideTeleportationTarget()}},e.prototype.setLaserColor=function(e,t){void 0===t&&(t=this._pickedLaserColor),this._pickedLaserColor=t},e.prototype.setLaserLightingState=function(e){void 0===e&&(e=!0)},e.prototype.setGazeColor=function(e,t){void 0===t&&(t=this._pickedGazeColor),this._pickedGazeColor=t},e.prototype.changeLaserColor=function(e){this.updateControllerLaserColor},e.prototype.changeGazeColor=function(e){this.updateGazeTrackerColor&&this._cameraGazer._gazeTracker.material&&(this._cameraGazer._gazeTracker.material.emissiveColor=e)},e.prototype.dispose=function(){this.isInVRMode&&this.exitVR(),this._postProcessMove&&this._postProcessMove.dispose(),this._vrDeviceOrientationCamera&&this._vrDeviceOrientationCamera.dispose(),!this._useCustomVRButton&&this._btnVR&&this._btnVR.parentNode&&document.body.removeChild(this._btnVR),this._deviceOrientationCamera&&this._scene.activeCamera!=this._deviceOrientationCamera&&this._deviceOrientationCamera.dispose(),this._cameraGazer&&this._cameraGazer.dispose(),this._teleportationTarget&&this._teleportationTarget.dispose(),this.xr&&this.xr.dispose(),this._floorMeshesCollection.length=0,document.removeEventListener("keydown",this._onKeyDown),window.removeEventListener("vrdisplaypresentchange",this._onVrDisplayPresentChangeBind),window.removeEventListener("resize",this._onResize),document.removeEventListener("fullscreenchange",this._onFullscreenChange),this._scene.gamepadManager.onGamepadConnectedObservable.removeCallback(this._onNewGamepadConnected),this._scene.unregisterBeforeRender(this._beforeRender)},e.prototype.getClassName=function(){return"VRExperienceHelper"},e.TELEPORTATIONMODE_CONSTANTTIME=0,e.TELEPORTATIONMODE_CONSTANTSPEED=1,e}(),da=function(e){function t(t){return e.call(this,t)||this}return(0,f.C6)(t,e),t.prototype.addMouse=function(){return this.add(new Qr),this},t.prototype.addMouseWheel=function(){return this.add(new Jr),this},t}(Er),pa=lr.HighestCommonFactor,fa=(0,f.Cl)((0,f.Cl)({},lr),{TwoPi:2*Math.PI,Sign:Math.sign,Log2:Math.log2,HCF:pa}),ma=function(e){function t(t,n,r,i){var o=e.call(this,t,c.Pq.Zero(),n)||this;return o._resetToDefault(r),o.pickPredicate=i,o.inputs=new da(o),o.inputs.addMouse().addMouseWheel(),o}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"center",{get:function(){var e,t;return null!==(t=null===(e=this._pickAlongLook)||void 0===e?void 0:e.pickedPoint)&&void 0!==t?t:this._target},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_target",{get:function(){return this.position.addToRef(this._lookAtVector,this._tempPosition)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_geocentricRotationPt",{get:function(){var e;return null!==(e=this._alternateRotationPt)&&void 0!==e?e:this.center},enumerable:!1,configurable:!0}),t.prototype._resetToDefault=function(e){var t,n,r;this._minAltitude=null!==(t=e.minAltitude)&&void 0!==t?t:5,this._maxAltitude=e.maxAltitude,this._planetRadius=e.planetRadius,this._maxCameraRadius=this._maxAltitude?this._planetRadius+this._maxAltitude:void 0,this._restingAltitude=null!==(r=null!==(n=e.restingAltitude)&&void 0!==n?n:this._maxCameraRadius)&&void 0!==r?r:4*this._planetRadius,this.position.copyFromFloats(0,0,-this._restingAltitude),this._perFrameGeocentricRotation=c.Pq.Zero(),this._perFrameGeocentricTranslation=c.Pq.Zero(),this._perFrameZoom=0,this._tempPosition=c.Pq.Zero(),this._tempRotationAxis=c.Pq.Right(),this._tempRotationMatrix=c.uq.Identity(),this._tempGeocentricNormal=c.Pq.Zero(),this._tempPickingRay=new Nn(this.position,this._lookAtVector),this._tempPickingRay.direction=c.Pq.Zero(),this.upVector=c.Pq.Up(),this._lookAtVector=this.position.negate().normalize(),this._viewMatrix=c.uq.Identity(),this._isViewMatrixDirty=!0},t.prototype._getViewMatrix=function(){return this._isViewMatrixDirty?(this._isViewMatrixDirty=!1,this.upVector.normalize(),this._lookAtVector.normalize(),this.getScene().useRightHandedSystem?c.uq.LookAtRHToRef(this.position,this._target,this.upVector,this._viewMatrix):c.uq.LookAtLHToRef(this.position,this._target,this.upVector,this._viewMatrix),this._viewMatrix):this._viewMatrix},t.prototype._isSynchronizedViewMatrix=function(){return!(!e.prototype._isSynchronizedViewMatrix.call(this)||this._isViewMatrixDirty)},t.prototype._applyRotationCorrectionAndSetPos=function(e){!function(e,t,n){var r=c.AA.Matrix[5],i=c.AA.Matrix[6],o=c.AA.Matrix[7],a=c.AA.Vector3[3],s=c.AA.Vector3[4],l=c.AA.Vector3[5];_a(e,a,s,l),c.uq.FromXYZAxesToRef(a,s,l,r),_a(t,a,s,l),c.uq.FromXYZAxesToRef(a,s,l,i),r.transposeToRef(o).multiplyToRef(i,n)}(this.position,e,this._tempRotationMatrix),c.Pq.TransformNormalToRef(this._lookAtVector,this._tempRotationMatrix,this._lookAtVector),c.Pq.TransformNormalToRef(this.upVector,this._tempRotationMatrix,this.upVector),this.position.copyFrom(e),this._isViewMatrixDirty=!0},t.prototype._applyGeocentricTranslation=function(){this.position.addToRef(this._perFrameGeocentricTranslation,this._tempPosition);var e=c.AA.Vector3[2],t=c.AA.Vector3[3];this._tempPosition.normalizeToRef(e).scaleInPlace(this.position.length()),this._tempPosition.subtractToRef(e,t),this._tempPosition.subtractInPlace(t),this._applyRotationCorrectionAndSetPos(this._tempPosition)},t.prototype._applyGeocentricRotation=function(){this._geocentricRotationPt.normalizeToRef(this._tempGeocentricNormal),this.upVector.normalize(),this._lookAtVector.normalize();var e=c.uq.Identity(),t=c.uq.Identity();if(0!==this._perFrameGeocentricRotation.x){c.Pq.CrossToRef(this.upVector,this._tempGeocentricNormal,this._tempRotationAxis),this._tempRotationAxis.lengthSquared()<=Re.bH&&c.Pq.CrossToRef(this._lookAtVector,this._tempGeocentricNormal,this._tempRotationAxis);var n=Math.sign(c.Pq.Dot(this._tempGeocentricNormal,this.upVector))*Math.acos(fa.Clamp(-c.Pq.Dot(this._lookAtVector,this._tempGeocentricNormal),-1,1)),r=fa.Clamp(n+this._perFrameGeocentricRotation.x,0,.5*Math.PI-Re.bH);c.uq.RotationAxisToRef(this._tempRotationAxis.normalize(),r-n,e)}0!==this._perFrameGeocentricRotation.y&&c.uq.RotationAxisToRef(this._tempGeocentricNormal,this._perFrameGeocentricRotation.y,t),e.multiplyToRef(t,this._tempRotationMatrix),this.position.subtractInPlace(this._geocentricRotationPt),c.Pq.TransformCoordinatesToRef(this.position,this._tempRotationMatrix,this.position),c.Pq.TransformNormalToRef(this.upVector,this._tempRotationMatrix,this.upVector),c.Pq.TransformNormalToRef(this._lookAtVector,this._tempRotationMatrix,this._lookAtVector),this.position.addInPlace(this._geocentricRotationPt)},t.prototype._clampZoomDistance=function(e,t){if(e>0)return void 0!==t?t-this._minAltitude<0?0:Math.min(e,t-this._minAltitude):e;if(e<0){var n=this._maxCameraRadius?this._maxCameraRadius-this.position.length():Number.POSITIVE_INFINITY;return Math.max(e,-n)}return 0},t.prototype._applyZoom=function(e){var t,n=this._scene.pick(this._scene.pointerX,this._scene.pointerY,this.pickPredicate);n.hit&&n.ray?this._moveCameraAlongVectorByDistance(n.ray.direction,this._clampZoomDistance(e,n.distance)):this._moveCameraAlongVectorByDistance(this._lookAtVector,this._clampZoomDistance(e,null===(t=this._pickAlongLook)||void 0===t?void 0:t.distance))},t.prototype._moveCameraAlongVectorByDistance=function(e,t){t&&(e.scaleAndAddToRef(t,this._tempPosition),this._applyRotationCorrectionAndSetPos(this._tempPosition))},Object.defineProperty(t.prototype,"_pickAlongLook",{get:function(){return this._tempPickingRay.origin.copyFrom(this.position),this._tempPickingRay.direction.copyFrom(this._lookAtVector),this._scene.pickWithRay(this._tempPickingRay,this.pickPredicate)},enumerable:!1,configurable:!0}),t.prototype._checkInputs=function(){this.inputs.checkInputs(),this._perFrameGeocentricTranslation.lengthSquared()>0&&(this._applyGeocentricTranslation(),this._perFrameGeocentricTranslation.setAll(0),this._isViewMatrixDirty=!0),this._perFrameGeocentricRotation.lengthSquared()>0&&(this._applyGeocentricRotation(),this._perFrameGeocentricRotation.setAll(0),this._isViewMatrixDirty=!0),0!==this._perFrameZoom&&(this._applyZoom(this._perFrameZoom),this._perFrameZoom=0,this._isViewMatrixDirty=!0),e.prototype._checkInputs.call(this)},t.prototype.attachControl=function(e){this.inputs.attachElement(e)},t.prototype.detachControl=function(){this.inputs.detachElement()},t}(oe.i);function _a(e,t,n,r){r.copyFrom(e).normalize();var i=c.Pq.Up();c.Pq.CrossToRef(r,i,t),t.lengthSquared()s){var l=s;s=a,a=l}return a>0&&a0&&s=0))},e.prototype._canDoCollision=function(e,t,n,r){var i=c.Pq.Distance(this._basePointWorld,e),o=Math.max(this._radius.x,this._radius.y,this._radius.z);return!(i>this._velocityWorldLength+o+t||!function(e,t,n,r){return!(e.x>n.x+r||n.x-r>t.x||e.y>n.y+r||n.y-r>t.y||e.z>n.z+r||n.z-r>t.z)}(n,r,this._basePointWorld,this._velocityWorldLength+o))},e.prototype._testTriangle=function(t,n,r,i,o,a,s){var l,u=!1;n||(n=[]),n[t]||(n[t]=new Ne.Z(0,0,0,0),n[t].copyFromPoints(r,i,o));var h=n[t];if(a||h.isFrontFacingTo(this._normalizedVelocity,0)){var d=h.signedDistanceTo(this._basePoint),p=c.Pq.Dot(h.normal,this._velocity);if(!(e.DoubleSidedCheck&&p>1e-4)){if(0==p){if(Math.abs(d)>=1)return;u=!0,l=0}else{var f=(1-d)/p;if((l=(-1-d)/p)>f){var m=f;f=l,l=m}if(l>1||f<0)return;l<0&&(l=0),l>1&&(l=1)}this._collisionPoint.copyFromFloats(0,0,0);var _=!1,g=1;if(u||(this._basePoint.subtractToRef(h.normal,this._planeIntersectionPoint),this._velocity.scaleToRef(l,this._tempVector),this._planeIntersectionPoint.addInPlace(this._tempVector),this._checkPointInTriangle(this._planeIntersectionPoint,r,i,o,h.normal)&&(_=!0,g=l,this._collisionPoint.copyFrom(this._planeIntersectionPoint))),!_){var v=this._velocitySquaredLength;this._basePoint.subtractToRef(r,this._tempVector);var y=2*c.Pq.Dot(this._velocity,this._tempVector),b=this._tempVector.lengthSquared()-1,S=va(v,y,b,g);S.found&&(g=S.root,_=!0,this._collisionPoint.copyFrom(r)),this._basePoint.subtractToRef(i,this._tempVector),y=2*c.Pq.Dot(this._velocity,this._tempVector),b=this._tempVector.lengthSquared()-1,(S=va(v,y,b,g)).found&&(g=S.root,_=!0,this._collisionPoint.copyFrom(i)),this._basePoint.subtractToRef(o,this._tempVector),y=2*c.Pq.Dot(this._velocity,this._tempVector),b=this._tempVector.lengthSquared()-1,(S=va(v,y,b,g)).found&&(g=S.root,_=!0,this._collisionPoint.copyFrom(o)),i.subtractToRef(r,this._edge),r.subtractToRef(this._basePoint,this._baseToVertex);var T,E=this._edge.lengthSquared(),x=c.Pq.Dot(this._edge,this._velocity),P=c.Pq.Dot(this._edge,this._baseToVertex);v=E*-this._velocitySquaredLength+x*x,y=2*(E*c.Pq.Dot(this._velocity,this._baseToVertex)-x*P),b=E*(1-this._baseToVertex.lengthSquared())+P*P,(S=va(v,y,b,g)).found&&(T=(x*S.root-P)/E)>=0&&T<=1&&(g=S.root,_=!0,this._edge.scaleInPlace(T),r.addToRef(this._edge,this._collisionPoint)),o.subtractToRef(i,this._edge),i.subtractToRef(this._basePoint,this._baseToVertex),E=this._edge.lengthSquared(),x=c.Pq.Dot(this._edge,this._velocity),P=c.Pq.Dot(this._edge,this._baseToVertex),v=E*-this._velocitySquaredLength+x*x,y=2*(E*c.Pq.Dot(this._velocity,this._baseToVertex)-x*P),b=E*(1-this._baseToVertex.lengthSquared())+P*P,(S=va(v,y,b,g)).found&&(T=(x*S.root-P)/E)>=0&&T<=1&&(g=S.root,_=!0,this._edge.scaleInPlace(T),i.addToRef(this._edge,this._collisionPoint)),r.subtractToRef(o,this._edge),o.subtractToRef(this._basePoint,this._baseToVertex),E=this._edge.lengthSquared(),x=c.Pq.Dot(this._edge,this._velocity),P=c.Pq.Dot(this._edge,this._baseToVertex),v=E*-this._velocitySquaredLength+x*x,y=2*(E*c.Pq.Dot(this._velocity,this._baseToVertex)-x*P),b=E*(1-this._baseToVertex.lengthSquared())+P*P,(S=va(v,y,b,g)).found&&(T=(x*S.root-P)/E)>=0&&T<=1&&(g=S.root,_=!0,this._edge.scaleInPlace(T),o.addToRef(this._edge,this._collisionPoint))}if(_){var C=g*g*this._velocitySquaredLength;(!this.collisionFound||C=r)i.copyFrom(e);else{var l=a?a.collisionMask:n.collisionMask;n._initialize(e,t,s);for(var c=a&&a.surroundingMeshes||this._scene.meshes,u=0;u=0&&this.options.defines.splice(r,1),("boolean"!=typeof t||t)&&this.options.defines.push(n+t),this},t.prototype.isReadyForSubMesh=function(e,t,n){return this.isReady(e,n,t)},t.prototype.isReady=function(e,t,n){var r,i,o,a,s=n&&this._storeEffectOnSubMeshes;if(this.isFrozen){var l=s?n._drawWrapper:this._drawWrapper;if(l.effect&&l._wasPreviouslyReady&&l._wasPreviouslyUsingInstances===t)return!0}var c=this.getScene(),u=c.getEngine(),h=[],d=[],p=null,f=this._shaderPath,m=this._options.uniforms,_=this._options.uniformBuffers,g=this._options.samplers;u.getCaps().multiview&&c.activeCamera&&c.activeCamera.outputRenderTarget&&c.activeCamera.outputRenderTarget.getViewCount()>1&&(this._multiview=!0,h.push("#define MULTIVIEW"),-1!==m.indexOf("viewProjection")&&-1===m.indexOf("viewProjectionR")&&m.push("viewProjectionR"));for(var v=0;v4&&(d.push(se.R.MatricesIndicesExtraKind),d.push(se.R.MatricesWeightsExtraKind));var b=e.skeleton;h.push("#define NUM_BONE_INFLUENCERS "+e.numBoneInfluencers),(p=new go.J).addCPUSkinningFallback(0,e),b.isUsingTextureForMatrices?(h.push("#define BONETEXTURE"),-1===m.indexOf("boneTextureWidth")&&m.push("boneTextureWidth"),-1===this._options.samplers.indexOf("boneSampler")&&this._options.samplers.push("boneSampler")):(h.push("#define BonesPerMesh "+(b.bones.length+1)),-1===m.indexOf("mBones")&&m.push("mBones"))}else h.push("#define NUM_BONE_INFLUENCERS 0");var S=0,T=e?e.morphTargetManager:null;if(T){var E=-1!==h.indexOf("#define UV1"),x=-1!==h.indexOf("#define UV2"),P=-1!==h.indexOf("#define TANGENT"),C=-1!==h.indexOf("#define NORMAL"),R=-1!==h.indexOf("#define VERTEXCOLOR");S=(0,Le.Dk)(T,h,d,e,!0,C,P,E,x,R),T.isUsingTextureForTargets&&(-1===m.indexOf("morphTargetTextureIndices")&&m.push("morphTargetTextureIndices"),-1===this._options.samplers.indexOf("morphTargets")&&this._options.samplers.push("morphTargets")),S>0&&((m=m.slice()).push("morphTargetInfluences"),m.push("morphTargetCount"),m.push("morphTargetTextureInfo"),m.push("morphTargetTextureIndices"))}else h.push("#define NUM_MORPH_INFLUENCERS 0");if(e){var A=e.bakedVertexAnimationManager;A&&A.isEnabled&&(h.push("#define BAKED_VERTEX_ANIMATION_TEXTURE"),-1===m.indexOf("bakedVertexAnimationSettings")&&m.push("bakedVertexAnimationSettings"),-1===m.indexOf("bakedVertexAnimationTextureSizeInverted")&&m.push("bakedVertexAnimationTextureSizeInverted"),-1===m.indexOf("bakedVertexAnimationTime")&&m.push("bakedVertexAnimationTime"),-1===this._options.samplers.indexOf("bakedVertexAnimationTexture")&&this._options.samplers.push("bakedVertexAnimationTexture")),(0,Le.J2)(d,e,h)}for(var I in this._textures)if(!this._textures[I].isReady())return!1;e&&this.needAlphaTestingForMesh(e)&&h.push("#define ALPHATEST"),!1!==this._options.useClipPlane&&((0,Mo.Ll)(m),(0,Mo.r4)(this,c,h)),c.fogEnabled&&(null==e?void 0:e.applyFog)&&c.fogMode!==Vt.Z.FOGMODE_NONE&&(h.push("#define FOG"),-1===m.indexOf("view")&&m.push("view"),-1===m.indexOf("vFogInfos")&&m.push("vFogInfos"),-1===m.indexOf("vFogColor")&&m.push("vFogColor")),this._useLogarithmicDepth&&(h.push("#define LOGARITHMICDEPTH"),-1===m.indexOf("logarithmicDepthConstant")&&m.push("logarithmicDepthConstant")),this.customShaderNameResolve&&(m=m.slice(),_=_.slice(),g=g.slice(),f=this.customShaderNameResolve(this.name,m,_,g,h,d));var O=n?n.getRenderingMesh():e;if(O&&this.useVertexPulling){h.push("#define USE_VERTEX_PULLING");var M=null===(r=O.geometry)||void 0===r?void 0:r.getIndexBuffer();M&&(h.push("#define VERTEX_PULLING_USE_INDEX_BUFFER"),M.is32Bits&&h.push("#define VERTEX_PULLING_INDEX_BUFFER_32BITS"))}var D=s?n._getDrawWrapper(void 0,!0):this._drawWrapper,N=null!==(i=null==D?void 0:D.effect)&&void 0!==i?i:null,F=null!==(o=null==D?void 0:D.defines)&&void 0!==o?o:null,L=h.join("\n"),w=N;return F!==L&&(w=u.createEffect(f,{attributes:d,uniformsNames:m,uniformBuffersNames:_,samplers:g,defines:L,fallbacks:p,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousMorphTargets:S},shaderLanguage:this._options.shaderLanguage,extraInitializationsAsync:this._options.extraInitializationsAsync},u),s?n.setEffect(w,L,this._materialContext):D&&D.setEffect(w,L),this._onEffectCreatedObservable&&(Ta.effect=w,Ta.subMesh=null!==(a=null!=n?n:null==e?void 0:e.subMeshes[0])&&void 0!==a?a:null,this._onEffectCreatedObservable.notifyObservers(Ta))),D._wasPreviouslyUsingInstances=!!t,!!(null==w?void 0:w.isReady())&&(N!==w&&c.resetCachedMaterial(),D._wasPreviouslyReady=!0,!0)},t.prototype.bindOnlyWorldMatrix=function(e,t){var n=null!=t?t:this.getEffect();if(n){var r=this._options.uniforms;-1!==r.indexOf("world")&&n.setMatrix("world",e);var i=this.getScene();-1!==r.indexOf("worldView")&&(e.multiplyToRef(i.getViewMatrix(),this._cachedWorldViewMatrix),n.setMatrix("worldView",this._cachedWorldViewMatrix)),-1!==r.indexOf("worldViewProjection")&&(e.multiplyToRef(i.getTransformMatrix(),this._cachedWorldViewProjectionMatrix),n.setMatrix("worldViewProjection",this._cachedWorldViewProjectionMatrix)),-1!==r.indexOf("view")&&n.setMatrix("view",i.getViewMatrix())}},t.prototype.bindForSubMesh=function(e,t,n){var r;this.bind(e,t,null===(r=n._drawWrapperOverride)||void 0===r?void 0:r.effect,n)},t.prototype.bind=function(e,t,n,r){var i,o=r&&this._storeEffectOnSubMeshes,a=null!=n?n:o?r.effect:this.getEffect();if(a){var s=this.getScene();this._activeEffect=a,this.bindOnlyWorldMatrix(e,n);var l=this._options.uniformBuffers,c=!1;if(a&&l&&l.length>0&&s.getEngine().supportsUniformBuffers)for(var u=0;u-1&&(this._cachedScene.customRenderTargets.splice(r,1),this._renderPickingTexture=!1)}this._pickingTexture&&this._pickingTexture.dispose(),this._pickingTexture=new Ji.$("pickingTexure",{width:t,height:n},e,{generateMipMaps:!1,type:b.Y.TEXTURETYPE_UNSIGNED_BYTE,samplingMode:b.Y.TEXTURE_NEAREST_NEAREST})},e.prototype._clearPickingMaterials=function(){for(var e=0;e=i||c>=o?[2,null]:(this._pickingInProgress=!0,u=o-c-1,this._preparePickingBuffer(this._engine,i,o,l,u),[4,this._executePickingAsync(l,u,n)])):[2,null];case 1:return[2,h.sent()]}}))}))},e.prototype.multiPickAsync=function(e){return(0,f.sH)(this,arguments,void 0,(function(e,t){var n,r,i,o,a,s,l,c,u,h,d,p,m,_,g,v,y,b,S,T,E;return void 0===t&&(t=!1),(0,f.YH)(this,(function(x){switch(x.label){case 0:return this._pickingInProgress?[2,null]:this._pickableMeshes&&0!==this._pickableMeshes.length&&0!==e.length?1!==e.length?[3,2]:[4,this.pickAsync(e[0].x,e[0].y,t)]:[2,null];case 1:return n=x.sent(),[2,{meshes:[null!==(E=null==n?void 0:n.mesh)&&void 0!==E?E:null],thinInstanceIndexes:(null==n?void 0:n.thinInstanceIndex)?[n.thinInstanceIndex]:void 0}];case 2:for(this._pickingInProgress=!0,r=new Array(e.length),i=1/0,o=-1/0,a=1/0,s=-1/0,l=this._getRenderInfo(),c=l.rttSizeW,u=l.rttSizeH,h=l.devicePixelRatio,d=0;d=a||v>=s||g<0||y<0?(this._pickingInProgress=!1,[2,null]):(b=Math.max(g-_,1),S=Math.max(y-v,1),T=s-y-1,this._preparePickingBuffer(this._engine,a,s,_,T,b,S),[4,this._executeBoxPickingAsync(_,T,b,S,i)])):[2,null];case 1:return[2,f.sent()]}}))}))},e.prototype._getRenderInfo=function(){var e=this._cachedScene.getEngine();return{rttSizeW:e.getRenderWidth(),rttSizeH:e.getRenderHeight(),devicePixelRatio:1/e._hardwareScalingLevel}},e.prototype._prepareForPicking=function(e,t,n){return{x:n*e|0,y:n*t|0}},e.prototype._preparePickingBuffer=function(e,t,n,r,i,o,a){var s,l=this;void 0===o&&(o=1),void 0===a&&(a=1),this._meshRenderingCount=0;var c=e.isWebGPU?4*o*a+255&-256:4*o*a;(!this._readbuffer||this._readbuffer.length-1&&(this._cachedScene.customRenderTargets.splice(a,1),this._renderPickingTexture=!1),[4,this._readTexturePixelsAsync(e,t)]):[3,2];case 1:l.sent()&&(s=this._getColorIdFromReadBuffer(0),this._thinIdMap[s]?(r=this._pickableMeshes[this._thinIdMap[s].meshId],o=this._thinIdMap[s].thinId):r=this._pickableMeshes[this._idMap[s]]),n&&this.dispose(),this._pickingInProgress=!1,i(r?{mesh:r,thinInstanceIndex:o}:null),l.label=2;case 2:return[2]}}))}))}}))];case 1:return[2,i.sent()]}}))}))},e.prototype._executeMultiPickingAsync=function(e,t,n,r,i,o,a){return(0,f.sH)(this,void 0,void 0,(function(){var s=this;return(0,f.YH)(this,(function(l){switch(l.label){case 0:return[4,new Promise((function(l,c){if(!s._pickingTexture)return s._pickingInProgress=!1,void c(new Error("Picking texture not created"));s._pickingTexture.onAfterRender=function(){return(0,f.sH)(s,void 0,void 0,(function(){var s,c,u,h,d,p;return(0,f.YH)(this,(function(f){switch(f.label){case 0:return this._checkRenderStatus()?(this._pickingTexture.onAfterRender=null,s=[],c=[],[4,this._readTexturePixelsAsync(t,r-n-1,i,o)]):[3,2];case 1:if(f.sent())for(u=0;u0&&(this._thinIdMap[u]?(d=this._pickableMeshes[this._thinIdMap[u].meshId],h=this._thinIdMap[u].thinId,o.push(d),s.push(h)):(d=this._pickableMeshes[this._idMap[u]],o.push(d),s.push(0)));i&&this.dispose(),this._pickingInProgress=!1,a({meshes:o,thinInstanceIndexes:s}),p.label=2;case 2:return[2]}}))}))}}))];case 1:return[2,a.sent()]}}))}))},e.prototype._enableScissor=function(e,t,n,r){void 0===n&&(n=1),void 0===r&&(r=1),this._engine.enableScissor&&this._engine.enableScissor(e,t,n,r)},e.prototype._disableScissor=function(){this._engine.disableScissor&&this._engine.disableScissor()},e.prototype._checkRenderStatus=function(){if(this._meshRenderingCount>0){var e=this._cachedScene.customRenderTargets.indexOf(this._pickingTexture);return e>-1&&(this._cachedScene.customRenderTargets.splice(e,1),this._renderPickingTexture=!1),!0}return this._meshRenderingCount=0,!1},e.prototype._getMeshFromMultiplePoints=function(e,t,n,r,i){var o=4*(e-n-1),a=(r-t-1)*i*4;o=Math.max(o,0),a=Math.max(a,0);var s,l=this._getColorIdFromReadBuffer(o+a),c=null;return l>0&&(this._thinIdMap[l]?(c=this._pickableMeshes[this._thinIdMap[l].meshId],s=this._thinIdMap[l].thinId):c=this._pickableMeshes[this._idMap[l]]),{pickedMesh:c,thinInstanceIndex:s}},e.prototype._updateRenderList=function(){this._pickingTexture.renderList=[];for(var e=0,t=this._pickableMeshes;e-1?e:this._shaderRepository+e,this._engine._loadFile(i+"."+t.toLowerCase()+".fx",r)):r(window.atob(e.substring(7))):r(e.substring(7))},Object.defineProperty(e.prototype,"computeSourceCode",{get:function(){var e,t;return this._computeSourceCodeOverride?this._computeSourceCodeOverride:null!==(t=null===(e=this._pipelineContext)||void 0===e?void 0:e._getComputeShaderCode())&&void 0!==t?t:this._computeSourceCode},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rawComputeSourceCode",{get:function(){return this._rawComputeSourceCode},enumerable:!1,configurable:!0}),e.prototype._prepareEffect=function(){var e=this,t=this.defines,n=this._pipelineContext;this._isReady=!1;try{var r=this._engine;this._pipelineContext=r.createComputePipelineContext(),this._pipelineContext._name=this._key,r._prepareComputePipelineContext(this._pipelineContext,this._computeSourceCodeOverride?this._computeSourceCodeOverride:this._computeSourceCode,this._rawComputeSourceCode,this._computeSourceCodeOverride?null:t,this._entryPoint),r._executeWhenComputeStateIsCompiled(this._pipelineContext,(function(t){t&&t.numErrors>0?e._processCompilationErrors(t,n):(e._compilationError="",e._isReady=!0,e.onCompiled&&e.onCompiled(e),e.onCompileObservable.notifyObservers(e),e.onCompileObservable.clear(),n&&e.getEngine()._deleteComputePipelineContext(n))})),this._pipelineContext.isAsync&&this._checkIsReady(n)}catch(e){this._processCompilationErrors(e,n)}},e.prototype._processCompilationErrors=function(t,n){var r;if(void 0===n&&(n=null),this._compilationError="",y.V.Error("Unable to compile compute effect:"),this.defines&&y.V.Error("Defines:\n"+this.defines),e.LogShaderCodeOnCompilationError){var i=null===(r=this._pipelineContext)||void 0===r?void 0:r._getComputeShaderCode();i&&(y.V.Error("Compute code:"),y.V.Error(i))}if("string"==typeof t)this._compilationError=t,y.V.Error("Error: "+this._compilationError);else for(var o=0,a=t.messages;othis.capacity&&this._depth-1&&this.entries.splice(n,1)}},e.prototype.addEntries=function(e){for(var t=0;t1)?1:e.arc||1,p=0===e.sideOrientation?0:e.sideOrientation||ge.DEFAULTSIDE,f=e.faceUV||new Array(3),m=e.faceColors,_=2+(1+(1!==d&&l?2:0))*(s?a:1);for(i=0;i<_;i++)m&&void 0===m[i]&&(m[i]=new u.ov(1,1,1,1));for(i=0;i<_;i++)f&&void 0===f[i]&&(f[i]=new c.IU(0,0,1,1));var g,v,y,b,S,T,E=[],x=[],P=[],C=[],R=[],A=2*Math.PI*d/o,I=(r-n)/2/t,O=c.Pq.Zero(),M=c.Pq.Zero(),D=c.Pq.Zero(),N=c.Pq.Zero(),F=c.Pq.Zero(),L=Ae._0.Y,w=1,B=1,V=0,U=0;for(b=0;b<=a;b++)for(y=((v=b/a)*(n-r)+r)/2,w=s&&0!==b&&b!==a?2:1,T=0;T0)):!r._pointerCaptures[l.pointerId]&&a.distance>=s.distance&&(r.mainSceneTrackerPredicate&&r.mainSceneTrackerPredicate(s.pickedMesh)?(r._notifyObservers(t,s,l),t.skipOnPointerObservable=!0):(t.type!==En.Zp.POINTERMOVE&&t.type!==En.Zp.POINTERUP||r._lastPointerEvents[l.pointerId]&&(r.onPointerOutObservable.notifyObservers(l.pointerId),delete r._lastPointerEvents[l.pointerId]),r._notifyObservers(t,a,l))),t.type===En.Zp.POINTERUP&&r._pointerCaptures[l.pointerId]&&(r._pointerCaptures[l.pointerId]=!1))}}}})),this._originalPointerObserver&&e.onPrePointerObservable.makeObserverTopPriority(this._originalPointerObserver)),this.utilityLayerScene.autoClear=!1,n||(this._afterRenderObserver=this.originalScene.onAfterRenderCameraObservable.add((function(e){r.shouldRender&&e==r.getRenderCamera()&&r.render()}))),this._sceneDisposeObserver=this.originalScene.onDisposeObservable.add((function(){r.dispose()})),this._updateCamera()}return e.prototype.getRenderCamera=function(e){if(this._renderCamera)return this._renderCamera;var t;return t=this.originalScene.activeCameras&&this.originalScene.activeCameras.length>1?this.originalScene.activeCameras[this.originalScene.activeCameras.length-1]:this.originalScene.activeCamera,e&&t&&t.isRigCamera?t.rigParent:t},e.prototype.setRenderCamera=function(e){this._renderCamera=e},e.prototype._getSharedGizmoLight=function(){return this._sharedGizmoLight||(this._sharedGizmoLight=new za("shared gizmo light",new c.Pq(0,1,0),this.utilityLayerScene),this._sharedGizmoLight.intensity=2,this._sharedGizmoLight.groundColor=u.v9.Gray()),this._sharedGizmoLight},Object.defineProperty(e,"DefaultUtilityLayer",{get:function(){return null==e._DefaultUtilityLayer?e._CreateDefaultUtilityLayerFromScene(M.q.LastCreatedScene):e._DefaultUtilityLayer},enumerable:!1,configurable:!0}),e._CreateDefaultUtilityLayerFromScene=function(t){return e._DefaultUtilityLayer=new e(t),e._DefaultUtilityLayer.originalScene.onDisposeObservable.addOnce((function(){e._DefaultUtilityLayer=null})),e._DefaultUtilityLayer},Object.defineProperty(e,"DefaultKeepDepthUtilityLayer",{get:function(){return null==e._DefaultKeepDepthUtilityLayer&&(e._DefaultKeepDepthUtilityLayer=new e(M.q.LastCreatedScene),e._DefaultKeepDepthUtilityLayer.utilityLayerScene.autoClearDepthAndStencil=!1,e._DefaultKeepDepthUtilityLayer.originalScene.onDisposeObservable.addOnce((function(){e._DefaultKeepDepthUtilityLayer=null}))),e._DefaultKeepDepthUtilityLayer},enumerable:!1,configurable:!0}),e.prototype._notifyObservers=function(e,t,n){e.skipOnPointerObservable||(this.utilityLayerScene.onPointerObservable.notifyObservers(new En.mx(e.type,e.event,t),e.type),this._lastPointerEvents[n.pointerId]=!0)},e.prototype.render=function(){if(this._updateCamera(),this.utilityLayerScene.activeCamera){var e=this.utilityLayerScene.activeCamera.getScene(),t=this.utilityLayerScene.activeCamera;t._scene=this.utilityLayerScene,t.leftCamera&&(t.leftCamera._scene=this.utilityLayerScene),t.rightCamera&&(t.rightCamera._scene=this.utilityLayerScene),this.utilityLayerScene.render(!1),t._scene=e,t.leftCamera&&(t.leftCamera._scene=e),t.rightCamera&&(t.rightCamera._scene=e)}},e.prototype.dispose=function(){this.onPointerOutObservable.clear(),this._afterRenderObserver&&this.originalScene.onAfterCameraRenderObservable.remove(this._afterRenderObserver),this._sceneDisposeObserver&&this.originalScene.onDisposeObservable.remove(this._sceneDisposeObserver),this._originalPointerObserver&&this.originalScene.onPrePointerObservable.remove(this._originalPointerObserver),this.utilityLayerScene.dispose()},e.prototype._updateCamera=function(){this.utilityLayerScene.cameraToUseForPointers=this.getRenderCamera(),this.utilityLayerScene.activeCamera=this.getRenderCamera()},e._DefaultUtilityLayer=null,e._DefaultKeepDepthUtilityLayer=null,e}();!function(e){e[e.Origin=0]="Origin",e[e.Pivot=1]="Pivot"}(Wa||(Wa={})),function(e){e[e.World=0]="World",e[e.Local=1]="Local"}(Ha||(Ha={}));var Xa,ja=function(){function e(e){void 0===e&&(e=Ya.DefaultUtilityLayer);var t=this;this.gizmoLayer=e,this._attachedMesh=null,this._attachedNode=null,this._customRotationQuaternion=null,this._scaleRatio=1,this._isHovered=!1,this._customMeshSet=!1,this._updateGizmoRotationToMatchAttachedMesh=!0,this._updateGizmoPositionToMatchAttachedMesh=!0,this._anchorPoint=0,this._updateScale=!0,this._coordinatesMode=1,this._interactionsEnabled=!0,this._rightHandtoLeftHandMatrix=c.uq.RotationY(Math.PI),this._rootMesh=new qe("gizmoRootNode",e.utilityLayerScene),this._rootMesh.rotationQuaternion=c.PT.Identity(),this._beforeRenderObserver=this.gizmoLayer.utilityLayerScene.onBeforeRenderObservable.add((function(){t._update()}))}return Object.defineProperty(e.prototype,"scaleRatio",{get:function(){return this._scaleRatio},set:function(e){this._scaleRatio=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isHovered",{get:function(){return this._isHovered},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"attachedMesh",{get:function(){return this._attachedMesh},set:function(e){this._attachedMesh=e,e&&(this._attachedNode=e),this._rootMesh.setEnabled(!!e),this._attachedNodeChanged(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"attachedNode",{get:function(){return this._attachedNode},set:function(e){this._attachedNode=e,this._attachedMesh=null,this._rootMesh.setEnabled(!!e),this._attachedNodeChanged(e)},enumerable:!1,configurable:!0}),e.prototype.setCustomMesh=function(e){if(e.getScene()!=this.gizmoLayer.utilityLayerScene)throw"When setting a custom mesh on a gizmo, the custom meshes scene must be the same as the gizmos (eg. gizmo.gizmoLayer.utilityLayerScene)";for(var t=0,n=this._rootMesh.getChildMeshes();tp.snapDistance){var n=Math.floor(Math.abs(_)/p.snapDistance);_%=p.snapDistance,e.delta.normalizeToRef(c.AA.Vector3[1]),c.AA.Vector3[1].scaleInPlace(p.snapDistance*n),p.attachedNode.getWorldMatrix().getTranslationToRef(c.AA.Vector3[2]),c.AA.Vector3[2].addInPlace(c.AA.Vector3[1]),p.dragBehavior.validateDrag(c.AA.Vector3[2])&&(p.attachedNode.getWorldMatrix().addTranslationFromFloats(c.AA.Vector3[1].x,c.AA.Vector3[1].y,c.AA.Vector3[1].z),p.attachedNode.updateCache(),g.snapDistance=p.snapDistance*n*Math.sign(_),p.onSnapObservable.notifyObservers(g),t=!0)}t&&p._matrixChanged()}})),p.dragBehavior.onDragStartObservable.add((function(){p._dragging=!0})),p.dragBehavior.onDragEndObservable.add((function(){p._dragging=!1}));var v=i._getSharedGizmoLight();v.includedOnlyMeshes=v.includedOnlyMeshes.concat(p._rootMesh.getChildMeshes(!1));var y={gizmoMeshes:f.getChildMeshes(),colliderMeshes:m.getChildMeshes(),material:p._coloredMaterial,hoverMaterial:p._hoverMaterial,disableMaterial:p._disableMaterial,active:!1,dragBehavior:p.dragBehavior};return null===(d=p._parent)||void 0===d||d.addToAxisCache(m,y),p._pointerObserver=i.utilityLayerScene.onPointerObservable.add((function(e){var t;if(!p._customMeshSet&&(p._isHovered=!(-1==y.colliderMeshes.indexOf(null===(t=null==e?void 0:e.pickInfo)||void 0===t?void 0:t.pickedMesh)),!p._parent)){var n=p.dragBehavior.enabled?p._isHovered||p._dragging?p._hoverMaterial:p._coloredMaterial:p._disableMaterial;p._setGizmoMeshMaterial(y.gizmoMeshes,n)}})),p.dragBehavior.onEnabledObservable.add((function(e){p._setGizmoMeshMaterial(y.gizmoMeshes,e?y.material:y.disableMaterial)})),p}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"coloredMaterial",{get:function(){return this._coloredMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hoverMaterial",{get:function(){return this._hoverMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"disableMaterial",{get:function(){return this._disableMaterial},enumerable:!1,configurable:!0}),t._CreateArrow=function(e,t,n,r){void 0===n&&(n=1),void 0===r&&(r=!1);var i=new Ee("arrow",e),o=Ga("cylinder",{diameterTop:0,height:.075,diameterBottom:.0375*(1+(n-1)/4),tessellation:96},e),a=Ga("cylinder",{diameterTop:.005*n,height:.275,diameterBottom:.005*n,tessellation:96},e);return o.parent=i,o.material=t,o.rotation.x=Math.PI/2,o.position.z+=.3,a.parent=i,a.material=t,a.position.z+=.1375,a.rotation.x=Math.PI/2,r&&(a.visibility=0,o.visibility=0),i},t._CreateArrowInstance=function(e,t){for(var n=new Ee("arrow",e),r=0,i=t.getChildMeshes();r0;)_.unshift(_.pop()),v.unshift(v.pop()),p--;for(;f>0;)g.unshift(g.pop()),y.unshift(y.pop()),f--;_=_.flat(),g=g.flat(),m=m.concat(_).concat(g),n.push(v[0],v[2],v[3],v[0],v[1],v[2]),n.push(y[0],y[2],y[3],y[0],y[1],y[2])}var b=[o/2,a/2,s/2];t=m.reduce((function(e,t,n){return e.concat(t*b[n%3])}),[]);for(var S=0===e.sideOrientation?0:e.sideOrientation||ge.DEFAULTSIDE,T=e.faceUV||new Array(6),E=e.faceColors,x=[],P=0;P<6;P++)void 0===T[P]&&(T[P]=new c.IU(0,0,1,1)),E&&void 0===E[P]&&(E[P]=new u.ov(1,1,1,1));for(var C=0;C<6;C++)if(i.push(T[C].z,ye.rX?1-T[C].w:T[C].w),i.push(T[C].x,ye.rX?1-T[C].w:T[C].w),i.push(T[C].x,ye.rX?1-T[C].y:T[C].y),i.push(T[C].z,ye.rX?1-T[C].y:T[C].y),E)for(var R=0;R<4;R++)x.push(E[C].r,E[C].g,E[C].b,E[C].a);ge._ComputeSides(S,t,n,r,i,e.frontUVs,e.backUVs);var A=new ge;if(A.indices=n,A.positions=t,A.normals=r,A.uvs=i,E){var I=S===ge.DOUBLESIDE?x.concat(x):x;A.colors=I}return A}function $a(e){var t=e.width||e.size||1,n=e.height||e.size||1,r=e.depth||e.size||1,i=0|(e.widthSegments||e.segments||1),o=0|(e.heightSegments||e.segments||1),a=0|(e.depthSegments||e.segments||1),s=new c.uq,l=new c.uq,u=new c.uq,h=$o({width:t,height:r,subdivisionsX:i,subdivisionsY:a});c.uq.TranslationToRef(0,-n/2,0,l),c.uq.RotationZToRef(Math.PI,s),s.multiplyToRef(l,u),h.transform(u);var d=$o({width:t,height:r,subdivisionsX:i,subdivisionsY:a});c.uq.TranslationToRef(0,n/2,0,u),d.transform(u);var p=$o({width:n,height:r,subdivisionsX:o,subdivisionsY:a});c.uq.TranslationToRef(-t/2,0,0,l),c.uq.RotationZToRef(Math.PI/2,s),s.multiplyToRef(l,u),p.transform(u);var f=$o({width:n,height:r,subdivisionsX:o,subdivisionsY:a});c.uq.TranslationToRef(t/2,0,0,l),c.uq.RotationZToRef(-Math.PI/2,s),s.multiplyToRef(l,u),f.transform(u);var m=$o({width:t,height:n,subdivisionsX:i,subdivisionsY:o});c.uq.TranslationToRef(0,0,-r/2,l),c.uq.RotationXToRef(-Math.PI/2,s),s.multiplyToRef(l,u),m.transform(u);var _=$o({width:t,height:n,subdivisionsX:i,subdivisionsY:o});return c.uq.TranslationToRef(0,0,r/2,l),c.uq.RotationXToRef(Math.PI/2,s),s.multiplyToRef(l,u),_.transform(u),h.merge([d,f,p,m,_],!0),h}function es(e,t,n){void 0===t&&(t={}),void 0===n&&(n=null);var r=new qe(e,n);return t.sideOrientation=qe._GetDefaultSideOrientation(t.sideOrientation),r._originalBuilderSideOrientation=t.sideOrientation,Ja(t).applyToMesh(r,t.updatable),r}var ts={CreateBox:es};function ns(e){for(var t=0|(e.segments||32),n=e.diameterX||e.diameter||1,r=e.diameterY||e.diameter||1,i=e.diameterZ||e.diameter||1,o=e.arc&&(e.arc<=0||e.arc>1)?1:e.arc||1,a=e.slice&&e.slice<=0?1:e.slice||1,s=0===e.sideOrientation?0:e.sideOrientation||ge.DEFAULTSIDE,l=!!e.dedupTopBottomIndices,u=new c.Pq(n/2,r/2,i/2),h=2+t,d=2*h,p=[],f=[],m=[],_=[],g=0;g<=h;g++){for(var v=g/h,y=v*Math.PI*a,b=0;b<=d;b++){var S=b/d,T=S*Math.PI*2*o,E=c.uq.RotationZ(-y),x=c.uq.RotationY(T),P=c.Pq.TransformCoordinates(c.Pq.Up(),E),C=c.Pq.TransformCoordinates(P,x),R=C.multiply(u),A=C.divide(u).normalize();f.push(R.x,R.y,R.z),m.push(A.x,A.y,A.z),_.push(S,ye.rX?1-v:v)}if(g>0)for(var I=f.length/3,O=I-2*(d+1);O+d+21&&(p.push(O),p.push(O+1),p.push(O+d+1)),(g100&&(this.soft=!0),this._physicsEngine=this._scene.getPhysicsEngine(),this._physicsEngine?(this.object.rotationQuaternion||(this.object.rotation?this.object.rotationQuaternion=c.PT.RotationYawPitchRoll(this.object.rotation.y,this.object.rotation.x,this.object.rotation.z):this.object.rotationQuaternion=new c.PT),this._options.mass=void 0===r.mass?0:r.mass,this._options.friction=void 0===r.friction?.2:r.friction,this._options.restitution=void 0===r.restitution?.2:r.restitution,this.soft&&(this._options.mass=this._options.mass>0?this._options.mass:1,this._options.pressure=void 0===r.pressure?200:r.pressure,this._options.stiffness=void 0===r.stiffness?1:r.stiffness,this._options.velocityIterations=void 0===r.velocityIterations?20:r.velocityIterations,this._options.positionIterations=void 0===r.positionIterations?20:r.positionIterations,this._options.fixedPoints=void 0===r.fixedPoints?0:r.fixedPoints,this._options.margin=void 0===r.margin?0:r.margin,this._options.damping=void 0===r.damping?0:r.damping,this._options.path=void 0===r.path?null:r.path,this._options.shape=void 0===r.shape?null:r.shape),this._joints=[],!this.object.parent||this._options.ignoreParent?this._init():this.object.parent.physicsImpostor&&y.V.Warn("You must affect impostors to children before affecting impostor to parent.")):y.V.Error("Physics not enabled. Please use scene.enablePhysics(...) before creating impostors."))):y.V.Error("No object was provided. A physics object is obligatory")}return Object.defineProperty(e.prototype,"isDisposed",{get:function(){return this._isDisposed},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mass",{get:function(){return this._physicsEngine?this._physicsEngine.getPhysicsPlugin().getBodyMass(this):0},set:function(e){this.setMass(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"friction",{get:function(){return this._physicsEngine?this._physicsEngine.getPhysicsPlugin().getBodyFriction(this):0},set:function(e){this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().setBodyFriction(this,e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"restitution",{get:function(){return this._physicsEngine?this._physicsEngine.getPhysicsPlugin().getBodyRestitution(this):0},set:function(e){this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().setBodyRestitution(this,e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pressure",{get:function(){if(!this._physicsEngine)return 0;var e=this._physicsEngine.getPhysicsPlugin();return e.setBodyPressure?e.getBodyPressure(this):0},set:function(e){if(this._physicsEngine){var t=this._physicsEngine.getPhysicsPlugin();t.setBodyPressure&&t.setBodyPressure(this,e)}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stiffness",{get:function(){if(!this._physicsEngine)return 0;var e=this._physicsEngine.getPhysicsPlugin();return e.getBodyStiffness?e.getBodyStiffness(this):0},set:function(e){if(this._physicsEngine){var t=this._physicsEngine.getPhysicsPlugin();t.setBodyStiffness&&t.setBodyStiffness(this,e)}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"velocityIterations",{get:function(){if(!this._physicsEngine)return 0;var e=this._physicsEngine.getPhysicsPlugin();return e.getBodyVelocityIterations?e.getBodyVelocityIterations(this):0},set:function(e){if(this._physicsEngine){var t=this._physicsEngine.getPhysicsPlugin();t.setBodyVelocityIterations&&t.setBodyVelocityIterations(this,e)}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"positionIterations",{get:function(){if(!this._physicsEngine)return 0;var e=this._physicsEngine.getPhysicsPlugin();return e.getBodyPositionIterations?e.getBodyPositionIterations(this):0},set:function(e){if(this._physicsEngine){var t=this._physicsEngine.getPhysicsPlugin();t.setBodyPositionIterations&&t.setBodyPositionIterations(this,e)}},enumerable:!1,configurable:!0}),e.prototype._init=function(){this._physicsEngine&&(this._physicsEngine.removeImpostor(this),this.physicsBody=null,this._parent=this._parent||this._getPhysicsParent(),this._isDisposed||this.parent&&!this._options.ignoreParent||this._physicsEngine.addImpostor(this))},e.prototype._getPhysicsParent=function(){return this.object.parent instanceof De?this.object.parent.physicsImpostor:null},e.prototype.isBodyInitRequired=function(){return this._bodyUpdateRequired||!this._physicsBody&&(!this._parent||!!this._options.ignoreParent)},e.prototype.setScalingUpdated=function(){this.forceUpdate()},e.prototype.forceUpdate=function(){this._init(),this.parent&&!this._options.ignoreParent&&this.parent.forceUpdate()},Object.defineProperty(e.prototype,"physicsBody",{get:function(){return this._parent&&!this._options.ignoreParent?this._parent.physicsBody:this._physicsBody},set:function(e){this._physicsBody&&this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().removePhysicsBody(this),this._physicsBody=e,this.resetUpdateFlags()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return!this._options.ignoreParent&&this._parent?this._parent:null},set:function(e){this._parent=e},enumerable:!1,configurable:!0}),e.prototype.resetUpdateFlags=function(){this._bodyUpdateRequired=!1},e.prototype.getObjectExtents=function(){if(this.object.getBoundingInfo){var t=this.object.rotationQuaternion,n=this.object.scaling.clone();this.object.rotationQuaternion=e.IDENTITY_QUATERNION;var r=this.object.computeWorldMatrix&&this.object.computeWorldMatrix(!0);r&&r.decompose(n,void 0,void 0);var i=this.object.getBoundingInfo().boundingBox.extendSize.scale(2).multiplyInPlace(n);return i.x=Math.abs(i.x),i.y=Math.abs(i.y),i.z=Math.abs(i.z),this.object.rotationQuaternion=t,this.object.computeWorldMatrix&&this.object.computeWorldMatrix(!0),i}return e.DEFAULT_OBJECT_SIZE},e.prototype.getObjectCenter=function(){return this.object.getBoundingInfo?this.object.getBoundingInfo().boundingBox.centerWorld:this.object.position},e.prototype.getParam=function(e){return this._options[e]},e.prototype.setParam=function(e,t){this._options[e]=t,this._bodyUpdateRequired=!0},e.prototype.setMass=function(e){this.getParam("mass")!==e&&this.setParam("mass",e),this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().setBodyMass(this,e)},e.prototype.getLinearVelocity=function(){return this._physicsEngine?this._physicsEngine.getPhysicsPlugin().getLinearVelocity(this):c.Pq.Zero()},e.prototype.setLinearVelocity=function(e){this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().setLinearVelocity(this,e)},e.prototype.getAngularVelocity=function(){return this._physicsEngine?this._physicsEngine.getPhysicsPlugin().getAngularVelocity(this):c.Pq.Zero()},e.prototype.setAngularVelocity=function(e){this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().setAngularVelocity(this,e)},e.prototype.executeNativeFunction=function(e){this._physicsEngine&&e(this._physicsEngine.getPhysicsPlugin().world,this.physicsBody)},e.prototype.registerBeforePhysicsStep=function(e){this._onBeforePhysicsStepCallbacks.push(e)},e.prototype.unregisterBeforePhysicsStep=function(e){var t=this._onBeforePhysicsStepCallbacks.indexOf(e);t>-1?this._onBeforePhysicsStepCallbacks.splice(t,1):y.V.Warn("Function to remove was not found")},e.prototype.registerAfterPhysicsStep=function(e){this._onAfterPhysicsStepCallbacks.push(e)},e.prototype.unregisterAfterPhysicsStep=function(e){var t=this._onAfterPhysicsStepCallbacks.indexOf(e);t>-1?this._onAfterPhysicsStepCallbacks.splice(t,1):y.V.Warn("Function to remove was not found")},e.prototype.registerOnPhysicsCollide=function(e,t){var n=e instanceof Array?e:[e];this._onPhysicsCollideCallbacks.push({callback:t,otherImpostors:n})},e.prototype.unregisterOnPhysicsCollide=function(e,t){var n=e instanceof Array?e:[e],r=-1;this._onPhysicsCollideCallbacks.some((function(e,i){if(e.callback===t&&e.otherImpostors.length===n.length){var o=e.otherImpostors.every((function(e){return n.indexOf(e)>-1}));return o&&(r=i),o}return!1}))?this._onPhysicsCollideCallbacks.splice(r,1):y.V.Warn("Function to remove was not found")},e.prototype.getParentsRotation=function(){var e=this.object.parent;for(this._tmpQuat.copyFromFloats(0,0,0,1);e;)e.rotationQuaternion?this._tmpQuat2.copyFrom(e.rotationQuaternion):c.PT.RotationYawPitchRollToRef(e.rotation.y,e.rotation.x,e.rotation.z,this._tmpQuat2),this._tmpQuat.multiplyToRef(this._tmpQuat2,this._tmpQuat),e=e.parent;return this._tmpQuat},e.prototype.applyForce=function(e,t){return this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().applyForce(this,e,t),this},e.prototype.applyImpulse=function(e,t){return this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().applyImpulse(this,e,t),this},e.prototype.createJoint=function(e,t,n){var r=new os(t,n);return this.addJoint(e,r),this},e.prototype.addJoint=function(e,t){return this._joints.push({otherImpostor:e,joint:t}),this._physicsEngine&&this._physicsEngine.addJoint(this,e,t),this},e.prototype.addAnchor=function(e,t,n,r,i){if(!this._physicsEngine)return this;var o=this._physicsEngine.getPhysicsPlugin();return o.appendAnchor?(this._physicsEngine&&o.appendAnchor(this,e,t,n,r,i),this):this},e.prototype.addHook=function(e,t,n,r){if(!this._physicsEngine)return this;var i=this._physicsEngine.getPhysicsPlugin();return i.appendAnchor?(this._physicsEngine&&i.appendHook(this,e,t,n,r),this):this},e.prototype.sleep=function(){return this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().sleepBody(this),this},e.prototype.wakeUp=function(){return this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().wakeUpBody(this),this},e.prototype.clone=function(t){return t?new e(t,this.type,this._options,this._scene):null},e.prototype.dispose=function(){if(this._physicsEngine){for(var e=0,t=this._joints;eo?o:Math.floor(a);var s,l,c,u,h=0===e.sideOrientation?0:e.sideOrientation||ge.DEFAULTSIDE,d=e.uvs,p=e.colors,f=[],m=[],_=[],g=[],v=[],y=[],b=[],S=[],T=[],E=[];if(t.length<2){var x=[],P=[];for(c=0;c0&&(A=C[u].subtract(C[u-1]).length()+b[l],v[l].push(A),b[l]=A),u++;r&&(u--,f.push(C[0].x,C[0].y,C[0].z),A=C[u].subtract(C[0]).length()+b[l],v[l].push(A),b[l]=A),T[l]=R+D,E[l]=M,M+=R+D}var F,L,w=null,B=null;for(c=0;c1)?1:e.arc||1,l=0===e.sideOrientation?0:e.sideOrientation||ge.DEFAULTSIDE;t.push(0,0,0),i.push(.5,.5);for(var c=2*Math.PI*s,u=1===s?c/a:c/(a-1),h=0,d=0;d0||h>0){switch(_=-d,g=-p,v=d,y=p,i){case qe.CENTER:_-=l/=2,v+=l;break;case qe.LEFT:v+=l,f=-l/2;break;case qe.RIGHT:_-=l,f=l/2}switch(o){case qe.CENTER:g-=h/=2,y+=h;break;case qe.BOTTOM:y+=h,m=-h/2;break;case qe.TOP:g-=h,m=h/2}}var b=[],S=[],T=[];T[0]=[0,0,1,0,1,1,0,1],T[1]=[0,0,1,0,1,1,0,1],t!==qe.ROTATE_TILE&&t!==qe.ROTATE_ROW||(T[1]=[1,1,0,1,0,0,1,0]),t!==qe.FLIP_TILE&&t!==qe.FLIP_ROW||(T[1]=[1,0,0,0,0,1,1,1]),t!==qe.FLIP_N_ROTATE_TILE&&t!==qe.FLIP_N_ROTATE_ROW||(T[1]=[0,1,1,1,1,0,0,0]);for(var E=[],x=[],P=[],C=0,R=0;R0||h>0){var I=h>0&&(o===qe.CENTER||o===qe.TOP),O=h>0&&(o===qe.CENTER||o===qe.BOTTOM),M=l>0&&(i===qe.CENTER||i===qe.RIGHT),D=l>0&&(i===qe.CENTER||i===qe.LEFT),N=[],F=void 0,L=void 0,w=void 0,B=void 0;if(I&&M&&(b.push(_+f,g+m,0),b.push(-d+f,g+m,0),b.push(-d+f,g+h+m,0),b.push(_+f,g+h+m,0),P.push(C,C+1,C+3,C+1,C+2,C+3),C+=4,N=[F=1-l/n,L=1-h/r,w=1,L,w,B=1,F,B],t===qe.ROTATE_ROW&&(N=[1-F,1-L,1-w,1-L,1-w,1-B,1-F,1-B]),t===qe.FLIP_ROW&&(N=[1-F,L,1-w,L,1-w,B,1-F,B]),t===qe.FLIP_N_ROTATE_ROW&&(N=[F,1-L,w,1-L,w,1-B,F,1-B]),E=E.concat(N),x.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),S.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)),I&&D&&(b.push(d+f,g+m,0),b.push(v+f,g+m,0),b.push(v+f,g+h+m,0),b.push(d+f,g+h+m,0),P.push(C,C+1,C+3,C+1,C+2,C+3),C+=4,N=[F=0,L=1-h/r,w=l/n,L,w,B=1,F,B],(t===qe.ROTATE_ROW||t===qe.ROTATE_TILE&&s%2==0)&&(N=[1-F,1-L,1-w,1-L,1-w,1-B,1-F,1-B]),(t===qe.FLIP_ROW||t===qe.FLIP_TILE&&s%2==0)&&(N=[1-F,L,1-w,L,1-w,B,1-F,B]),(t===qe.FLIP_N_ROTATE_ROW||t===qe.FLIP_N_ROTATE_TILE&&s%2==0)&&(N=[F,1-L,w,1-L,w,1-B,F,1-B]),E=E.concat(N),x.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),S.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)),O&&M&&(b.push(_+f,p+m,0),b.push(-d+f,p+m,0),b.push(-d+f,y+m,0),b.push(_+f,y+m,0),P.push(C,C+1,C+3,C+1,C+2,C+3),C+=4,N=[F=1-l/n,L=0,w=1,L,w,B=h/r,F,B],(t===qe.ROTATE_ROW&&u%2==1||t===qe.ROTATE_TILE&&u%1==0)&&(N=[1-F,1-L,1-w,1-L,1-w,1-B,1-F,1-B]),(t===qe.FLIP_ROW&&u%2==1||t===qe.FLIP_TILE&&u%2==0)&&(N=[1-F,L,1-w,L,1-w,B,1-F,B]),(t===qe.FLIP_N_ROTATE_ROW&&u%2==1||t===qe.FLIP_N_ROTATE_TILE&&u%2==0)&&(N=[F,1-L,w,1-L,w,1-B,F,1-B]),E=E.concat(N),x.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),S.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)),O&&D&&(b.push(d+f,p+m,0),b.push(v+f,p+m,0),b.push(v+f,y+m,0),b.push(d+f,y+m,0),P.push(C,C+1,C+3,C+1,C+2,C+3),C+=4,N=[F=0,L=0,w=l/n,L,w,B=h/r,F,B],(t===qe.ROTATE_ROW&&u%2==1||t===qe.ROTATE_TILE&&(u+s)%2==1)&&(N=[1-F,1-L,1-w,1-L,1-w,1-B,1-F,1-B]),(t===qe.FLIP_ROW&&u%2==1||t===qe.FLIP_TILE&&(u+s)%2==1)&&(N=[1-F,L,1-w,L,1-w,B,1-F,B]),(t===qe.FLIP_N_ROTATE_ROW&&u%2==1||t===qe.FLIP_N_ROTATE_TILE&&(u+s)%2==1)&&(N=[F,1-L,w,1-L,w,1-B,F,1-B]),E=E.concat(N),x.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),S.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)),I){var V=[];for(F=0,L=1-h/r,w=1,B=1,V[0]=[F,L,w,L,w,B,F,B],V[1]=[F,L,w,L,w,B,F,B],t!==qe.ROTATE_TILE&&t!==qe.ROTATE_ROW||(V[1]=[1-F,1-L,1-w,1-L,1-w,1-B,1-F,1-B]),t!==qe.FLIP_TILE&&t!==qe.FLIP_ROW||(V[1]=[1-F,L,1-w,L,1-w,B,1-F,B]),t!==qe.FLIP_N_ROTATE_TILE&&t!==qe.FLIP_N_ROTATE_ROW||(V[1]=[F,1-L,w,1-L,w,1-B,F,1-B]),A=0;A0&&(t.push(a-1),t.push(a)),a++}var y=new ge;return y.indices=t,y.positions=n,i&&(y.colors=o),y}function Fs(e){var t,n,r=e.dashSize||3,i=e.gapSize||1,o=e.dashNb||200,a=e.points,s=[],l=[],u=c.Pq.Zero(),h=0,d=0,p=0,f=0,m=0;for(m=0;mt.x&&(t.x=i.x),i.yt.y&&(t.y=i.y)}return{min:e,max:t,width:t.x-e.x,height:t.y-e.y}},e}(),zs=function(){function e(){}return e.Rectangle=function(e,t,n,r){return[new c.I9(e,t),new c.I9(n,t),new c.I9(n,r),new c.I9(e,r)]},e.Circle=function(e,t,n,r){void 0===t&&(t=0),void 0===n&&(n=0),void 0===r&&(r=32);for(var i=[],o=0,a=2*Math.PI/r,s=0;s0){for(var p=i.length/3,f=0,m=this._points.elements;fl?El?x0){var g=d[_-1];c.Pq.Dot(g,d[_])<0&&d[_].scaleInPlace(-1),g=p[_-1],c.Pq.Dot(g,p[_])<0&&p[_].scaleInPlace(-1),g=f[_-1],c.Pq.Dot(g,f[_])<0&&f[_].scaleInPlace(-1)}var v=0,y=u&&s?s:function(){return null!==o?o:0},b=u&&a?a:function(){return null!==i?i:1},T=l===qe.NO_CAP||l===qe.CAP_END?0:2,E=c.AA.Matrix[0];for(_=0;_3?0:u;var C=ms(e,{pathArray:E=x(t,n,T=y?new Us.tO(n,y):new Us.tO(n),new Array,r,i,o,a,u,h,b),closeArray:s,closePath:l,updatable:p,sideOrientation:f,invertUV:_,frontUVs:g||void 0,backUVs:v||void 0},d);return C._creationDataStorage.pathArray=E,C._creationDataStorage.path3D=T,C._creationDataStorage.cap=u,C}ge.CreatePolygon=Hs,qe.CreatePolygon=function(e,t,n,r,i,o,a){return void 0===a&&(a=earcut),Ys(e,{shape:t,holes:r,updatable:i,sideOrientation:o},n,a)},qe.ExtrudePolygon=function(e,t,n,r,i,o,a,s){return void 0===s&&(s=earcut),Xs(e,{shape:t,holes:i,depth:n,updatable:o,sideOrientation:a},r,s)};var Qs={ExtrudeShape:qs,ExtrudeShapeCustom:Ks};function Js(e,t,n){void 0===n&&(n=null);var r,i,o=t.arc?t.arc<=0||t.arc>1?1:t.arc:1,a=void 0===t.closed||t.closed,s=t.shape,l=t.radius||1,u=t.tessellation||64,h=t.clip||0,d=t.updatable,p=qe._GetDefaultSideOrientation(t.sideOrientation),f=t.cap||qe.NO_CAP,m=2*Math.PI,_=[],g=t.invertUV||!1,v=0,y=0,b=m/u*o;for(v=0;v<=u-h;v++){for(i=[],f!=qe.CAP_START&&f!=qe.CAP_ALL||(i.push(new c.Pq(0,s[0].y,0)),i.push(new c.Pq(Math.cos(v*b)*s[0].x*l,s[0].y,Math.sin(v*b)*s[0].x*l))),y=0;y1)?1:t.arc||1;var p,f,m=function(e,t,n,r,i,o,a,s){for(var l,u,h,d,p=t.getTangents(),f=t.getNormals(),m=t.getDistances(),_=2*Math.PI/i*s,g=o||function(){return r},v=c.AA.Matrix[0],y=a===qe.NO_CAP||a===qe.CAP_END?0:2,b=0;b3?0:l;var v=ms(e,{pathArray:f=m(r,p=new Us.tO(r),new Array,o,a,s,l,t.arc),closePath:!0,closeArray:!1,updatable:h,sideOrientation:d,invertUV:u,frontUVs:t.frontUVs,backUVs:t.backUVs},n);return v._creationDataStorage.pathArray=f,v._creationDataStorage.path3D=p,v._creationDataStorage.tessellation=a,v._creationDataStorage.cap=l,v._creationDataStorage.arc=t.arc,v._creationDataStorage.radius=o,v}qe.CreateLathe=function(e,t,n,r,i,o,a){return Js(e,{shape:t,radius:n,tessellation:r,sideOrientation:a,updatable:o},i)};var tl={CreateTube:el};function nl(e){var t=[];t[0]={vertex:[[0,0,1.732051],[1.632993,0,-.5773503],[-.8164966,1.414214,-.5773503],[-.8164966,-1.414214,-.5773503]],face:[[0,1,2],[0,2,3],[0,3,1],[1,3,2]]},t[1]={vertex:[[0,0,1.414214],[1.414214,0,0],[0,1.414214,0],[-1.414214,0,0],[0,-1.414214,0],[0,0,-1.414214]],face:[[0,1,2],[0,2,3],[0,3,4],[0,4,1],[1,4,5],[1,5,2],[2,5,3],[3,5,4]]},t[2]={vertex:[[0,0,1.070466],[.7136442,0,.7978784],[-.3568221,.618034,.7978784],[-.3568221,-.618034,.7978784],[.7978784,.618034,.3568221],[.7978784,-.618034,.3568221],[-.9341724,.381966,.3568221],[.1362939,1,.3568221],[.1362939,-1,.3568221],[-.9341724,-.381966,.3568221],[.9341724,.381966,-.3568221],[.9341724,-.381966,-.3568221],[-.7978784,.618034,-.3568221],[-.1362939,1,-.3568221],[-.1362939,-1,-.3568221],[-.7978784,-.618034,-.3568221],[.3568221,.618034,-.7978784],[.3568221,-.618034,-.7978784],[-.7136442,0,-.7978784],[0,0,-1.070466]],face:[[0,1,4,7,2],[0,2,6,9,3],[0,3,8,5,1],[1,5,11,10,4],[2,7,13,12,6],[3,9,15,14,8],[4,10,16,13,7],[5,8,14,17,11],[6,12,18,15,9],[10,11,17,19,16],[12,13,16,19,18],[14,15,18,19,17]]},t[3]={vertex:[[0,0,1.175571],[1.051462,0,.5257311],[.3249197,1,.5257311],[-.8506508,.618034,.5257311],[-.8506508,-.618034,.5257311],[.3249197,-1,.5257311],[.8506508,.618034,-.5257311],[.8506508,-.618034,-.5257311],[-.3249197,1,-.5257311],[-1.051462,0,-.5257311],[-.3249197,-1,-.5257311],[0,0,-1.175571]],face:[[0,1,2],[0,2,3],[0,3,4],[0,4,5],[0,5,1],[1,5,7],[1,7,6],[1,6,2],[2,6,8],[2,8,3],[3,8,9],[3,9,4],[4,9,10],[4,10,5],[5,10,7],[6,7,11],[6,11,8],[7,10,11],[8,11,9],[9,11,10]]},t[4]={vertex:[[0,0,1.070722],[.7148135,0,.7971752],[-.104682,.7071068,.7971752],[-.6841528,.2071068,.7971752],[-.104682,-.7071068,.7971752],[.6101315,.7071068,.5236279],[1.04156,.2071068,.1367736],[.6101315,-.7071068,.5236279],[-.3574067,1,.1367736],[-.7888348,-.5,.5236279],[-.9368776,.5,.1367736],[-.3574067,-1,.1367736],[.3574067,1,-.1367736],[.9368776,-.5,-.1367736],[.7888348,.5,-.5236279],[.3574067,-1,-.1367736],[-.6101315,.7071068,-.5236279],[-1.04156,-.2071068,-.1367736],[-.6101315,-.7071068,-.5236279],[.104682,.7071068,-.7971752],[.6841528,-.2071068,-.7971752],[.104682,-.7071068,-.7971752],[-.7148135,0,-.7971752],[0,0,-1.070722]],face:[[0,2,3],[1,6,5],[4,9,11],[7,15,13],[8,16,10],[12,14,19],[17,22,18],[20,21,23],[0,1,5,2],[0,3,9,4],[0,4,7,1],[1,7,13,6],[2,5,12,8],[2,8,10,3],[3,10,17,9],[4,11,15,7],[5,6,14,12],[6,13,20,14],[8,12,19,16],[9,17,18,11],[10,16,22,17],[11,18,21,15],[13,15,21,20],[14,20,23,19],[16,19,23,22],[18,22,23,21]]},t[5]={vertex:[[0,0,1.322876],[1.309307,0,.1889822],[-.9819805,.8660254,.1889822],[.1636634,-1.299038,.1889822],[.3273268,.8660254,-.9449112],[-.8183171,-.4330127,-.9449112]],face:[[0,3,1],[2,4,5],[0,1,4,2],[0,2,5,3],[1,3,5,4]]},t[6]={vertex:[[0,0,1.159953],[1.013464,0,.5642542],[-.3501431,.9510565,.5642542],[-.7715208,-.6571639,.5642542],[.6633206,.9510565,-.03144481],[.8682979,-.6571639,-.3996071],[-1.121664,.2938926,-.03144481],[-.2348831,-1.063314,-.3996071],[.5181548,.2938926,-.9953061],[-.5850262,-.112257,-.9953061]],face:[[0,1,4,2],[0,2,6,3],[1,5,8,4],[3,6,9,7],[5,7,9,8],[0,3,7,5,1],[2,4,8,9,6]]},t[7]={vertex:[[0,0,1.118034],[.8944272,0,.6708204],[-.2236068,.8660254,.6708204],[-.7826238,-.4330127,.6708204],[.6708204,.8660254,.2236068],[1.006231,-.4330127,-.2236068],[-1.006231,.4330127,.2236068],[-.6708204,-.8660254,-.2236068],[.7826238,.4330127,-.6708204],[.2236068,-.8660254,-.6708204],[-.8944272,0,-.6708204],[0,0,-1.118034]],face:[[0,1,4,2],[0,2,6,3],[1,5,8,4],[3,6,10,7],[5,9,11,8],[7,10,11,9],[0,3,7,9,5,1],[2,4,8,11,10,6]]},t[8]={vertex:[[-.729665,.670121,.319155],[-.655235,-.29213,-.754096],[-.093922,-.607123,.537818],[.702196,.595691,.485187],[.776626,-.36656,-.588064]],face:[[1,4,2],[0,1,2],[3,0,2],[4,3,2],[4,1,0,3]]},t[9]={vertex:[[-.868849,-.100041,.61257],[-.329458,.976099,.28078],[-.26629,-.013796,-.477654],[-.13392,-1.034115,.229829],[.738834,.707117,-.307018],[.859683,-.535264,-.338508]],face:[[3,0,2],[5,3,2],[4,5,2],[1,4,2],[0,1,2],[0,3,5,4,1]]},t[10]={vertex:[[-.610389,.243975,.531213],[-.187812,-.48795,-.664016],[-.187812,.9759,-.664016],[.187812,-.9759,.664016],[.798201,.243975,.132803]],face:[[1,3,0],[3,4,0],[3,1,4],[0,2,1],[0,4,2],[2,4,1]]},t[11]={vertex:[[-1.028778,.392027,-.048786],[-.640503,-.646161,.621837],[-.125162,-.395663,-.540059],[.004683,.888447,-.651988],[.125161,.395663,.540059],[.632925,-.791376,.433102],[1.031672,.157063,-.354165]],face:[[3,2,0],[2,1,0],[2,5,1],[0,4,3],[0,1,4],[4,1,5],[2,3,6],[3,4,6],[5,2,6],[4,5,6]]},t[12]={vertex:[[-.669867,.334933,-.529576],[-.669867,.334933,.529577],[-.4043,1.212901,0],[-.334933,-.669867,-.529576],[-.334933,-.669867,.529577],[.334933,.669867,-.529576],[.334933,.669867,.529577],[.4043,-1.212901,0],[.669867,-.334933,-.529576],[.669867,-.334933,.529577]],face:[[8,9,7],[6,5,2],[3,8,7],[5,0,2],[4,3,7],[0,1,2],[9,4,7],[1,6,2],[9,8,5,6],[8,3,0,5],[3,4,1,0],[4,9,6,1]]},t[13]={vertex:[[-.931836,.219976,-.264632],[-.636706,.318353,.692816],[-.613483,-.735083,-.264632],[-.326545,.979634,0],[-.318353,-.636706,.692816],[-.159176,.477529,-.856368],[.159176,-.477529,-.856368],[.318353,.636706,.692816],[.326545,-.979634,0],[.613482,.735082,-.264632],[.636706,-.318353,.692816],[.931835,-.219977,-.264632]],face:[[11,10,8],[7,9,3],[6,11,8],[9,5,3],[2,6,8],[5,0,3],[4,2,8],[0,1,3],[10,4,8],[1,7,3],[10,11,9,7],[11,6,5,9],[6,2,0,5],[2,4,1,0],[4,10,7,1]]},t[14]={vertex:[[-.93465,.300459,-.271185],[-.838689,-.260219,-.516017],[-.711319,.717591,.128359],[-.710334,-.156922,.080946],[-.599799,.556003,-.725148],[-.503838,-.004675,-.969981],[-.487004,.26021,.48049],[-.460089,-.750282,-.512622],[-.376468,.973135,-.325605],[-.331735,-.646985,.084342],[-.254001,.831847,.530001],[-.125239,-.494738,-.966586],[.029622,.027949,.730817],[.056536,-.982543,-.262295],[.08085,1.087391,.076037],[.125583,-.532729,.485984],[.262625,.599586,.780328],[.391387,-.726999,-.716259],[.513854,-.868287,.139347],[.597475,.85513,.326364],[.641224,.109523,.783723],[.737185,-.451155,.538891],[.848705,-.612742,-.314616],[.976075,.365067,.32976],[1.072036,-.19561,.084927]],face:[[15,18,21],[12,20,16],[6,10,2],[3,0,1],[9,7,13],[2,8,4,0],[0,4,5,1],[1,5,11,7],[7,11,17,13],[13,17,22,18],[18,22,24,21],[21,24,23,20],[20,23,19,16],[16,19,14,10],[10,14,8,2],[15,9,13,18],[12,15,21,20],[6,12,16,10],[3,6,2,0],[9,3,1,7],[9,15,12,6,3],[22,17,11,5,4,8,14,19,23,24]]};var n,r,i,o,a,s,l=e.type&&(e.type<0||e.type>=t.length)?0:e.type||0,h=e.size,d=e.sizeX||h||1,p=e.sizeY||h||1,f=e.sizeZ||h||1,m=e.custom||t[l],_=m.face.length,g=e.faceUV||new Array(_),v=e.faceColors,y=void 0===e.flat||e.flat,b=0===e.sideOrientation?0:e.sideOrientation||ge.DEFAULTSIDE,S=[],T=[],E=[],x=[],P=[],C=0,R=0,A=[],I=0,O=0;if(y)for(O=0;O<_;O++)v&&void 0===v[O]&&(v[O]=new u.ov(1,1,1,1)),g&&void 0===g[O]&&(g[O]=new c.IU(0,0,1,1));if(y)for(O=0;O<_;O++){var M=m.face[O].length;for(i=2*Math.PI/M,o=.5*Math.tan(i/2),a=.5,I=0;I0){var V=r(N,O[I+B],D,4);R[w]=O[I+B],A[w]=(0,lr.Lerp)(M[I+B],V>=0?F[V]:0,C),w++}for(B=0;B<4&&w<4;++B){var U=N[D+B];-1===r(O,U,I,4)&&(R[w]=U,A[w]=(0,lr.Lerp)(0,F[D+B],C),w++)}var G=A[0]+A[1]+A[2]+A[3];A[0]/=G,A[1]/=G,A[2]/=G,A[3]/=G}var k=e.localPositionOverride?e.localPositionOverride[0]:null!==(u=null==m?void 0:m[e.vertexIdx])&&void 0!==u?u:0,z=e.localPositionOverride?e.localPositionOverride[1]:null!==(h=null==m?void 0:m[e.vertexIdx+1])&&void 0!==h?h:0,W=e.localPositionOverride?e.localPositionOverride[2]:null!==(d=null==m?void 0:m[e.vertexIdx+2])&&void 0!==d?d:0,H=i.localPositionOverride?i.localPositionOverride[0]:null!==(p=null==m?void 0:m[i.vertexIdx])&&void 0!==p?p:0,Y=i.localPositionOverride?i.localPositionOverride[1]:null!==(f=null==m?void 0:m[i.vertexIdx+1])&&void 0!==f?f:0,X=i.localPositionOverride?i.localPositionOverride[2]:null!==(g=null==m?void 0:m[i.vertexIdx+2])&&void 0!==g?g:0,j=e.localNormalOverride?e.localNormalOverride[0]:null!==(b=null==_?void 0:_[e.vertexIdx])&&void 0!==b?b:0,q=e.localNormalOverride?e.localNormalOverride[1]:null!==(S=null==_?void 0:_[e.vertexIdx+1])&&void 0!==S?S:0,K=e.localNormalOverride?e.localNormalOverride[2]:null!==(T=null==_?void 0:_[e.vertexIdx+2])&&void 0!==T?T:0,Z=j+((i.localNormalOverride?i.localNormalOverride[0]:null!==(E=null==_?void 0:_[i.vertexIdx])&&void 0!==E?E:0)-j)*C,Q=q+((i.localNormalOverride?i.localNormalOverride[1]:null!==(x=null==_?void 0:_[i.vertexIdx+1])&&void 0!==x?x:0)-q)*C,J=K+((i.localNormalOverride?i.localNormalOverride[2]:null!==(P=null==_?void 0:_[i.vertexIdx+2])&&void 0!==P?P:0)-K)*C,$=Math.sqrt(Z*Z+Q*Q+J*J);return new fl(c.Pq.Lerp(e.position,i.position,C),c.Pq.Lerp(e.normal,i.normal,C).normalize(),c.I9.Lerp(e.uv,i.uv,C),-1,-1,m?[k+(H-k)*C,z+(Y-z)*C,W+(X-W)*C]:null,_?[Z/$,Q/$,J/$]:null,R,A)},o=null;e.length>3&&(o=[]);for(var a=0;a0,p=c.Pq.Dot(e[a+1].position,t)-n>0,f=c.Pq.Dot(e[a+2].position,t)-n>0;switch((d?1:0)+(p?1:0)+(f?1:0)){case 0:e.length>3?(o.push(e[a]),o.push(e[a+1]),o.push(e[a+2])):o=e;break;case 1:if(o=null!=o?o:new Array,d&&(s=e[a+1],l=e[a+2],u=i(e[a],s),h=i(e[a],l)),p){s=e[a],l=e[a+2],u=i(e[a+1],s),h=i(e[a+1],l),o.push(u),o.push(l.clone()),o.push(s.clone()),o.push(l.clone()),o.push(u.clone()),o.push(h);break}f&&(s=e[a],l=e[a+1],u=i(e[a+2],s),h=i(e[a+2],l)),s&&l&&u&&h&&(o.push(s.clone()),o.push(l.clone()),o.push(u),o.push(h),o.push(u.clone()),o.push(l.clone()));break;case 2:o=null!=o?o:new Array,d||(l=i(s=e[a].clone(),e[a+1]),u=i(s,e[a+2]),o.push(s),o.push(l),o.push(u)),p||(l=i(s=e[a+1].clone(),e[a+2]),u=i(s,e[a]),o.push(s),o.push(l),o.push(u)),f||(l=i(s=e[a+2].clone(),e[a]),u=i(s,e[a+1]),o.push(s),o.push(l),o.push(u))}}return o},B=t instanceof qe?t:null,V=null==B?void 0:B._thinInstanceDataStorage.matrixData,U=(null==B?void 0:B.thinInstanceCount)||1,G=c.AA.Matrix[0];G.copyFrom(c.uq.IdentityReadOnly);for(var k=0;k2?T[l[d]]=[-E[n][0],E[n][1],l[d]]:T[l[d]]=[S[E[n][0]],E[n][1],l[d]]};this.IDATA.edgematch=[[1,"B"],[2,"B"],[3,"B"],[4,"B"],[0,"B"],[10,"O",14,"A"],[11,"O",10,"A"],[12,"O",11,"A"],[13,"O",12,"A"],[14,"O",13,"A"],[0,"O"],[1,"O"],[2,"O"],[3,"O"],[4,"O"],[19,"B",5,"A"],[15,"B",6,"A"],[16,"B",7,"A"],[17,"B",8,"A"],[18,"B",9,"A"]];for(var P=0;P<20;P++){if(i=(S=this.IDATA.face[P])[2],o=S[1],a=S[0],f=m.x+"|"+m.y,(d=P+"|"+f)in l||(l[d]=i,T[i]=[S[E[f][0]],E[f][1]]),f=_.x+"|"+_.y,(d=P+"|"+f)in l||(l[d]=o,T[o]=[S[E[f][0]],E[f][1]]),f=g.x+"|"+g.y,(d=P+"|"+f)in l||(l[d]=a,T[a]=[S[E[f][0]],E[f][1]]),n=this.IDATA.edgematch[P][0],"B"===(r=this.IDATA.edgematch[P][1]))for(var C=1;C2?T[l[d]]=[-E[f][0],E[f][1],l[d]]:T[l[d]]=[S[E[f][0]],E[f][1],l[d]])}this.closestTo=T,this.vecToidx=l},e.prototype.calcCoeffs=function(){var e=this.m,t=this.n,n=Math.sqrt(3)/3,r=e*e+t*t+e*t;this.coau=(e+t)/r,this.cobu=-t/r,this.coav=-n*(e-t)/r,this.cobv=n*(2*e+t)/r},e.prototype.createInnerFacets=function(){for(var e=this.m,t=this.n,n=0;n0&&r0){for(var l=(0,lr.HighestCommonFactor)(e,t),c=e/l,u=t/l,h=1;h-1?r[n][1]>0&&t[r[n][0]].push([n,r[n][1]]):t[12].push([n,r[n][0]]);var i=[];for(n=0;n<12;n++)i[n]=n;var o=12;for(n=0;n<12;n++){t[n].sort((function(e,t){return e[1]-t[1]}));for(var a=0;a0;)i=t[s],this.face[i].indexOf(a)>-1?(o=(this.face[i].indexOf(a)+1)%3,a=this.face[i][o],n.push(a),r.push(i),t.splice(s,1),s=0):s++;return this.adjacentFaces.push(n),r},t.prototype.toGoldbergPolyhedronData=function(){var e=new yl("GeoDual","Goldberg",[],[]);e.name="GD dual";for(var t=this.vertex.length,n=new Array(t),r=0;rr){var o=i;i=r,r=o,y.V.Warn("n > m therefore m and n swapped")}var a=new vl;return a.build(r,i),rl(e,{custom:bl.BuildGeodesicData(a),size:t.size,sizeX:t.sizeX,sizeY:t.sizeY,sizeZ:t.sizeZ,faceUV:t.faceUV,faceColors:t.faceColors,flat:t.flat,updatable:t.updatable,sideOrientation:t.sideOrientation,frontUVs:t.frontUVs,backUVs:t.backUVs},n)}qe._GoldbergMeshParser=function(e,t){return Tl.Parse(e,t)};var Tl=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.goldbergData={faceColors:[],faceCenters:[],faceZaxis:[],faceXaxis:[],faceYaxis:[],nbSharedFaces:0,nbUnsharedFaces:0,nbFaces:0,nbFacesAtPole:0,adjacentFaces:[]},t}return(0,f.C6)(t,e),t.prototype.relatedGoldbergFace=function(e,t){return void 0===t?(e>this.goldbergData.nbUnsharedFaces-1&&(y.V.Warn("Maximum number of unshared faces used"),e=this.goldbergData.nbUnsharedFaces-1),this.goldbergData.nbUnsharedFaces+e):(e>11&&(y.V.Warn("Last pole used"),e=11),t>this.goldbergData.nbFacesAtPole-1&&(y.V.Warn("Maximum number of faces at a pole used"),t=this.goldbergData.nbFacesAtPole-1),12+e*this.goldbergData.nbFacesAtPole+t)},t.prototype._changeGoldbergFaceColors=function(e){for(var t=0;t1&&(u=1),l.push(u,h);for(d=0;d<6;d++)u=o.x+a*Math.cos(s+d*Math.PI/3),h=o.y+a*Math.sin(s+d*Math.PI/3),u<0&&(u=0),u>1&&(u=1),c.push(u,h);for(var p=r;ps){var h=l;l=s,s=h,y.V.Warn("n > m therefore m and n swapped")}var d=new vl;d.build(s,l);var p=bl.BuildGeodesicData(d),f=p.toGoldbergPolyhedronData(),m=new Tl(e,n);t.sideOrientation=qe._GetDefaultSideOrientation(t.sideOrientation),m._originalBuilderSideOrientation=t.sideOrientation,El(t,f).applyToMesh(m,t.updatable),m.goldbergData.nbSharedFaces=p.sharedNodes,m.goldbergData.nbUnsharedFaces=p.poleNodes,m.goldbergData.adjacentFaces=p.adjacentFaces,m.goldbergData.nbFaces=m.goldbergData.nbSharedFaces+m.goldbergData.nbUnsharedFaces,m.goldbergData.nbFacesAtPole=(m.goldbergData.nbUnsharedFaces-12)/12;for(var _=0;_0?this._holes.push(n):this._paths.push(n)}if(!this._paths.length&&this._holes.length){var r=this._holes;this._holes=this._paths,this._paths=r}this._tempPaths.length=0},Object.defineProperty(e.prototype,"paths",{get:function(){return this._paths},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"holes",{get:function(){return this._holes},enumerable:!1,configurable:!0}),e}();function Cl(e,t,n,r,i,o){var a=o.glyphs[e]||o.glyphs["?"];if(!a)return null;var s=new Pl(i);if(a.o)for(var l=a.o.split(" "),c=0,u=l.length;cRe.bH&&(e.x=1*Math.sign(e.x)),Math.abs(e.y-1)>Re.bH&&(e.y=1*Math.sign(e.y)),Math.abs(e.z-1)>Re.bH&&(e.z=1*Math.sign(e.z))},e.prototype._updateDebugConstraint=function(e,t){if(e._initOptions){var n=e._initOptions,r=n.pivotA,i=n.pivotB,o=n.axisA,a=n.axisB,s=n.perpAxisA,l=n.perpAxisB;if(r&&i&&o&&a&&s&&l)for(var u=0,h=t.getDescendants(!0);u-1&&this._debugMeshMeshes.splice(o,1),this._numMeshes--,this._numMeshes>0?(this._meshes[r]=this._meshes[this._numMeshes],this._impostors[r]=this._impostors[this._numMeshes],this._meshes[this._numMeshes]=null,this._impostors[this._numMeshes]=null):(this._meshes[0]=null,this._impostors[0]=null),t=!0;break}t&&0===this._numMeshes&&this._scene.unregisterBeforeRender(this._renderFunction)}},e.prototype.hideBody=function(e){if(!e||!this._scene||!this._utilityLayer)return!1;for(var t=!1,n=this._utilityLayer.utilityLayerScene,r=0;r0?(this._bodyMeshes[r]=this._bodyMeshes[this._numBodies],this._bodies[r]=this._bodies[this._numBodies],this._bodyMeshes[this._numBodies]=null,this._bodies[this._numBodies]=null):(this._bodyMeshes[0]=null,this._bodies[0]=null),t=!0;break}return t&&0===this._numBodies&&this._scene.unregisterBeforeRender(this._renderFunction),t},e.prototype.hideInertia=function(e){if(!e||!this._scene||!this._utilityLayer)return!1;for(var t=!1,n=this._utilityLayer.utilityLayerScene,r=0;r0?(this._constraints[r]=this._constraints[this._numConstraints],this._constraintMeshes[r]=this._constraintMeshes[this._numConstraints],this._constraints[this._numConstraints]=null,this._constraintMeshes[this._numConstraints]=null):(this._constraints[0]=null,this._constraintMeshes[0]=null),t=!0;break}t&&0===this._numConstraints&&this._scene.unregisterBeforeRender(this._constraintRenderFunction)}},e.prototype._getDebugMaterial=function(e){return this._debugMaterial||(this._debugMaterial=new Bo("",e),this._debugMaterial.wireframe=!0,this._debugMaterial.emissiveColor=u.v9.White(),this._debugMaterial.disableLighting=!0),this._debugMaterial},e.prototype._getDebugInertiaMaterial=function(e){return this._debugInertiaMaterial||(this._debugInertiaMaterial=new Bo("",e),this._debugInertiaMaterial.disableLighting=!0,this._debugInertiaMaterial.alpha=0),this._debugInertiaMaterial},e.prototype._getDebugAxisColoredMaterial=function(e,t){var n=new Bo("",t);return n.emissiveColor=0==e?u.v9.Red():1==e?u.v9.Green():u.v9.Blue(),n.disableLighting=!0,n},e.prototype._getDebugBoxMesh=function(e){return this._debugBoxMesh||(this._debugBoxMesh=es("physicsBodyBoxViewMesh",{size:1},e),this._debugBoxMesh.rotationQuaternion=c.PT.Identity(),this._debugBoxMesh.material=this._getDebugMaterial(e),this._debugBoxMesh.setEnabled(!1)),this._debugBoxMesh.createInstance("physicsBodyBoxViewInstance")},e.prototype._getDebugSphereMesh=function(e){return this._debugSphereMesh||(this._debugSphereMesh=rs("physicsBodySphereViewMesh",{diameter:1},e),this._debugSphereMesh.rotationQuaternion=c.PT.Identity(),this._debugSphereMesh.material=this._getDebugMaterial(e),this._debugSphereMesh.setEnabled(!1)),this._debugSphereMesh.createInstance("physicsBodySphereViewInstance")},e.prototype._getDebugCapsuleMesh=function(e){return this._debugCapsuleMesh||(this._debugCapsuleMesh=ds("physicsBodyCapsuleViewMesh",{height:1},e),this._debugCapsuleMesh.rotationQuaternion=c.PT.Identity(),this._debugCapsuleMesh.material=this._getDebugMaterial(e),this._debugCapsuleMesh.setEnabled(!1)),this._debugCapsuleMesh.createInstance("physicsBodyCapsuleViewInstance")},e.prototype._getDebugCylinderMesh=function(e){return this._debugCylinderMesh||(this._debugCylinderMesh=Ga("physicsBodyCylinderViewMesh",{diameterTop:1,diameterBottom:1,height:1},e),this._debugCylinderMesh.rotationQuaternion=c.PT.Identity(),this._debugCylinderMesh.material=this._getDebugMaterial(e),this._debugCylinderMesh.setEnabled(!1)),this._debugCylinderMesh.createInstance("physicsBodyCylinderViewInstance")},e.prototype._getDebugMeshMesh=function(e,t){var n=new qe(e.name,t,null,e);return n.setParent(e),n.position=c.Pq.Zero(),n.material=this._getDebugMaterial(t),this._debugMeshMeshes.push(n),n},e.prototype._getDebugMesh=function(e,t){if(!this._utilityLayer)return null;if(t&&t.parent&&t.parent.physicsImpostor)return null;var n=null,r=this._utilityLayer.utilityLayerScene;if(!e.physicsBody)return y.V.Warn("Unable to get physicsBody of impostor. It might be initialized later by its parent's impostor."),null;switch(e.type){case us.BoxImpostor:n=this._getDebugBoxMesh(r),e.getBoxSizeToRef(n.scaling);break;case us.SphereImpostor:n=this._getDebugSphereMesh(r);var i=e.getRadius();n.scaling.x=2*i,n.scaling.y=2*i,n.scaling.z=2*i;break;case us.CapsuleImpostor:n=this._getDebugCapsuleMesh(r);var o=e.object.getBoundingInfo();n.scaling.x=2*(o.boundingBox.maximum.x-o.boundingBox.minimum.x)*e.object.scaling.x,n.scaling.y=(o.boundingBox.maximum.y-o.boundingBox.minimum.y)*e.object.scaling.y,n.scaling.z=2*(o.boundingBox.maximum.z-o.boundingBox.minimum.z)*e.object.scaling.z;break;case us.MeshImpostor:t&&(n=this._getDebugMeshMesh(t,r));break;case us.NoImpostor:if(t)for(var a=0,s=t.getChildMeshes().filter((function(e){return e.physicsImpostor?1:0}));a=0?c.uq.FromArrayToRef(r._thinInstanceDataStorage.matrixData,n,t):t.copyFrom(r.getWorldMatrix())},e.prototype._createAngularConstraintMesh=function(e,t,n,r,i){var o=(t-e)/(2*Math.PI),a=Il.CreateCylinder("ConstraintCylinder",{height:1e-4,diameter:3*this._constraintAngularSize,arc:o},i);a.material=this._getDebugAxisColoredMaterial(n,i),a.parent=r;var s=r.absoluteScaling;switch(n){case 0:a.rotation.z=.5*Math.PI,a.rotation.x=-e+.5*Math.PI,a.scaling.x=1/s.x,a.scaling.y=1/s.z,a.scaling.z=1/s.y;break;case 1:a.rotation.y=1.5*Math.PI+e,a.scaling.x=1/s.z,a.scaling.y=1/s.y,a.scaling.z=1/s.x;break;case 2:a.rotation.x=.5*Math.PI,a.scaling.x=1/s.x,a.scaling.y=1/s.z,a.scaling.z=1/s.y}return a},e.prototype._createCage=function(e,t){var n=Il.CreateBox("cage",{size:1},t);n.setPivotPoint(new c.Pq(-.5,-.5,-.5));var r=new Bo("cage_material",t);return r.alpha=0,n.material=r,n.enableEdgesRendering(),n.edgesWidth=4,n.edgesColor=new u.ov(1,1,1,1),n.parent=e,n},e.prototype._getDebugConstraintMesh=function(e){if(!this._utilityLayer)return null;var t=this._utilityLayer.utilityLayerScene;if(!e._initOptions)return null;var n=e._initOptions,r=n.pivotA,i=n.pivotB,o=n.axisA,a=n.axisB,s=n.perpAxisA,l=n.perpAxisB;if(!(r&&i&&o&&a&&s&&l))return null;var u=new qe("parentingDebugConstraint",t),h=e.getBodiesUsingConstraint(),d=[];d.push(u);for(var p=0,f=h;p=0;e--)this.hideImpostor(this._impostors[0]);for(e=this._numBodies-1;e>=0;e--)this.hideBody(this._bodies[0]);for(e=this._numInertiaBodies-1;e>=0;e--)this.hideInertia(this._inertiaBodies[0]);this._debugBoxMesh&&this._debugBoxMesh.dispose(),this._debugSphereMesh&&this._debugSphereMesh.dispose(),this._debugCylinderMesh&&this._debugCylinderMesh.dispose(),this._debugMaterial&&this._debugMaterial.dispose(),this._impostors.length=0,this._scene=null,this._physicsEnginePlugin=null,this._ownUtilityLayer&&this._utilityLayer&&(this._utilityLayer.dispose(),this._utilityLayer=null)},e}(),Ml=function(){function e(e){this.ray=e}return e.CreateAndShow=function(t,n,r){var i=new e(t);return i.show(n,r),i},e.prototype.show=function(e,t){var n=this;if(!this._renderFunction&&this.ray){var r=this.ray;this._renderFunction=function(){return n._render()},this._scene=e,this._renderPoints=[r.origin,r.origin.add(r.direction.scale(r.length))],this._renderLine=ws("ray",{points:this._renderPoints,updatable:!0},e),this._renderLine.isPickable=!1,this._renderFunction&&this._scene.registerBeforeRender(this._renderFunction)}t&&this._renderLine&&this._renderLine.color.copyFrom(t)},e.prototype.hide=function(){this._renderFunction&&this._scene&&(this._scene.unregisterBeforeRender(this._renderFunction),this._scene=null,this._renderFunction=null,this._renderLine&&(this._renderLine.dispose(),this._renderLine=null),this._renderPoints=[])},e.prototype._render=function(){var e,t=this.ray;if(t){var n=this._renderPoints[1],r=Math.min(t.length,1e6);n.copyFrom(t.direction),n.scaleInPlace(r),n.addInPlace(t.origin),this._renderPoints[0].copyFrom(t.origin),ws("ray",{points:this._renderPoints,updatable:!0,instance:this._renderLine},this._scene),null===(e=this._renderLine)||void 0===e||e.refreshBoundingInfo()}},e.prototype.attachToMesh=function(e,t,n,r){var i=this;this._attachedToMesh=e;var o=this.ray;o&&(o.direction||(o.direction=c.Pq.Zero()),o.origin||(o.origin=c.Pq.Zero()),r&&(o.length=r),n||(n=c.Pq.Zero()),t||(t=new c.Pq(0,0,-1)),this._scene||(this._scene=e.getScene()),this._meshSpaceDirection?(this._meshSpaceDirection.copyFrom(t),this._meshSpaceOrigin.copyFrom(n)):(this._meshSpaceDirection=t.clone(),this._meshSpaceOrigin=n.clone()),this._onAfterRenderObserver||(this._onAfterRenderObserver=this._scene.onBeforeRenderObservable.add((function(){return i._updateToMesh()})),this._onAfterStepObserver=this._scene.onAfterStepObservable.add((function(){return i._updateToMesh()}))),this._attachedToMesh.computeWorldMatrix(!0),this._updateToMesh())},e.prototype.detachFromMesh=function(){this._attachedToMesh&&this._scene&&(this._onAfterRenderObserver&&(this._scene.onBeforeRenderObservable.remove(this._onAfterRenderObserver),this._scene.onAfterStepObservable.remove(this._onAfterStepObserver)),this._attachedToMesh=null,this._onAfterRenderObserver=null,this._onAfterStepObserver=null,this._scene=null)},e.prototype._updateToMesh=function(){var e=this.ray;this._attachedToMesh&&e&&(this._attachedToMesh.isDisposed()?this.detachFromMesh():(this._attachedToMesh.getDirectionToRef(this._meshSpaceDirection,e.direction),c.Pq.TransformCoordinatesToRef(this._meshSpaceOrigin,this._attachedToMesh.getWorldMatrix(),e.origin)))},e.prototype.dispose=function(){this.hide(),this.detachFromMesh(),this.ray=null},e}(),Dl=n(74239),Nl=function(){function e(t,n,r,i,o,a){var s,l,c,h,d,p,f,m,_,g,v,y,b,S;if(void 0===i&&(i=!0),void 0===o&&(o=3),void 0===a&&(a={}),this.skeleton=t,this.mesh=n,this.autoUpdateBonesMatrices=i,this.renderingGroupId=o,this.options=a,this.color=u.v9.White(),this._debugLines=new Array,this._localAxes=null,this._isEnabled=!0,this._obs=null,this._scene=r,this._ready=!1,a.pauseAnimations=null===(s=a.pauseAnimations)||void 0===s||s,a.returnToRest=null!==(l=a.returnToRest)&&void 0!==l&&l,a.displayMode=null!==(c=a.displayMode)&&void 0!==c?c:e.DISPLAY_LINES,a.displayOptions=null!==(h=a.displayOptions)&&void 0!==h?h:{},a.displayOptions.midStep=null!==(d=a.displayOptions.midStep)&&void 0!==d?d:.235,a.displayOptions.midStepFactor=null!==(p=a.displayOptions.midStepFactor)&&void 0!==p?p:.155,a.displayOptions.sphereBaseSize=null!==(f=a.displayOptions.sphereBaseSize)&&void 0!==f?f:.15,a.displayOptions.sphereScaleUnit=null!==(m=a.displayOptions.sphereScaleUnit)&&void 0!==m?m:2,a.displayOptions.sphereFactor=null!==(_=a.displayOptions.sphereFactor)&&void 0!==_?_:.865,a.displayOptions.spurFollowsChild=null!==(g=a.displayOptions.spurFollowsChild)&&void 0!==g&&g,a.displayOptions.showLocalAxes=null!==(v=a.displayOptions.showLocalAxes)&&void 0!==v&&v,a.displayOptions.localAxesSize=null!==(y=a.displayOptions.localAxesSize)&&void 0!==y?y:.075,a.computeBonesUsingShaders=null===(b=a.computeBonesUsingShaders)||void 0===b||b,a.useAllBones=null===(S=a.useAllBones)||void 0===S||S,this._boneIndices=new Set,!a.useAllBones){var T=null==n?void 0:n.getVerticesData(se.R.MatricesIndicesKind),E=null==n?void 0:n.getVerticesData(se.R.MatricesWeightsKind);if(T&&E)for(var x=0;xe.DISPLAY_SPHERE_AND_SPURS&&(C=e.DISPLAY_LINES),this.displayMode=C,this.update(),this._bindObs()}return e.CreateBoneWeightShader=function(e,t){var n,r,i,o,a,s,l=e.skeleton,c=null!==(n=e.colorBase)&&void 0!==n?n:u.v9.Black(),h=null!==(r=e.colorZero)&&void 0!==r?r:u.v9.Blue(),d=null!==(i=e.colorQuarter)&&void 0!==i?i:u.v9.Green(),p=null!==(o=e.colorHalf)&&void 0!==o?o:u.v9.Yellow(),f=null!==(a=e.colorFull)&&void 0!==a?a:u.v9.Red(),m=null!==(s=e.targetBoneIndex)&&void 0!==s?s:0;Dl.M.ShadersStore["boneWeights:"+l.name+"VertexShader"]="precision highp float;\n\n attribute vec3 position;\n attribute vec2 uv;\n\n uniform mat4 view;\n uniform mat4 projection;\n uniform mat4 worldViewProjection;\n\n #include\n #if NUM_BONE_INFLUENCERS == 0\n attribute vec4 matricesIndices;\n attribute vec4 matricesWeights;\n #endif\n #include\n\n #include\n\n varying vec3 vColor;\n\n uniform vec3 colorBase;\n uniform vec3 colorZero;\n uniform vec3 colorQuarter;\n uniform vec3 colorHalf;\n uniform vec3 colorFull;\n\n uniform float targetBoneIndex;\n\n void main() {\n vec3 positionUpdated = position;\n\n #include\n #include\n #include\n\n vec4 worldPos = finalWorld * vec4(positionUpdated, 1.0);\n\n vec3 color = colorBase;\n float totalWeight = 0.;\n if(matricesIndices[0] == targetBoneIndex && matricesWeights[0] > 0.){\n totalWeight += matricesWeights[0];\n }\n if(matricesIndices[1] == targetBoneIndex && matricesWeights[1] > 0.){\n totalWeight += matricesWeights[1];\n }\n if(matricesIndices[2] == targetBoneIndex && matricesWeights[2] > 0.){\n totalWeight += matricesWeights[2];\n }\n if(matricesIndices[3] == targetBoneIndex && matricesWeights[3] > 0.){\n totalWeight += matricesWeights[3];\n }\n\n color = mix(color, colorZero, smoothstep(0., 0.25, totalWeight));\n color = mix(color, colorQuarter, smoothstep(0.25, 0.5, totalWeight));\n color = mix(color, colorHalf, smoothstep(0.5, 0.75, totalWeight));\n color = mix(color, colorFull, smoothstep(0.75, 1.0, totalWeight));\n vColor = color;\n\n gl_Position = projection * view * worldPos;\n }",Dl.M.ShadersStore["boneWeights:"+l.name+"FragmentShader"]="\n precision highp float;\n varying vec3 vPosition;\n\n varying vec3 vColor;\n\n void main() {\n vec4 color = vec4(vColor, 1.0);\n gl_FragColor = color;\n }\n ";var _=new Ea("boneWeight:"+l.name,t,{vertex:"boneWeights:"+l.name,fragment:"boneWeights:"+l.name},{attributes:["position","normal","matricesIndices","matricesWeights"],uniforms:["world","worldView","worldViewProjection","view","projection","viewProjection","colorBase","colorZero","colorQuarter","colorHalf","colorFull","targetBoneIndex"]});return _.setColor3("colorBase",c),_.setColor3("colorZero",h),_.setColor3("colorQuarter",d),_.setColor3("colorHalf",p),_.setColor3("colorFull",f),_.setFloat("targetBoneIndex",m),_.getClassName=function(){return"BoneWeightShader"},_.transparencyMode=Be.MATERIAL_OPAQUE,_},e.CreateSkeletonMapShader=function(t,n){var r,i=t.skeleton,o=null!==(r=t.colorMap)&&void 0!==r?r:[{color:new u.v9(1,.38,.18),location:0},{color:new u.v9(.59,.18,1),location:.2},{color:new u.v9(.59,1,.18),location:.4},{color:new u.v9(1,.87,.17),location:.6},{color:new u.v9(1,.17,.42),location:.8},{color:new u.v9(.17,.68,1),location:1}],a=i.bones.length+1,s=e._CreateBoneMapColorBuffer(a,o,n),l=new Ea("boneWeights:"+i.name,n,{vertexSource:"precision highp float;\n\n attribute vec3 position;\n attribute vec2 uv;\n\n uniform mat4 view;\n uniform mat4 projection;\n uniform mat4 worldViewProjection;\n uniform float colorMap["+4*i.bones.length+"];\n\n #include\n #if NUM_BONE_INFLUENCERS == 0\n attribute vec4 matricesIndices;\n attribute vec4 matricesWeights;\n #endif\n #include\n #include\n\n varying vec3 vColor;\n\n void main() {\n vec3 positionUpdated = position;\n\n #include\n #include\n #include\n\n vec3 color = vec3(0.);\n bool first = true;\n\n for (int i = 0; i < 4; i++) {\n int boneIdx = int(matricesIndices[i]);\n float boneWgt = matricesWeights[i];\n\n vec3 c = vec3(colorMap[boneIdx * 4 + 0], colorMap[boneIdx * 4 + 1], colorMap[boneIdx * 4 + 2]);\n\n if (boneWgt > 0.) {\n if (first) {\n first = false;\n color = c;\n } else {\n color = mix(color, c, boneWgt);\n }\n }\n }\n\n vColor = color;\n\n vec4 worldPos = finalWorld * vec4(positionUpdated, 1.0);\n\n gl_Position = projection * view * worldPos;\n }",fragmentSource:"\n precision highp float;\n varying vec3 vColor;\n\n void main() {\n vec4 color = vec4( vColor, 1.0 );\n gl_FragColor = color;\n }\n "},{attributes:["position","normal","matricesIndices","matricesWeights"],uniforms:["world","worldView","worldViewProjection","view","projection","viewProjection","colorMap"]});return l.setFloats("colorMap",s),l.getClassName=function(){return"SkeletonMapShader"},l.transparencyMode=Be.MATERIAL_OPAQUE,l},e._CreateBoneMapColorBuffer=function(e,t,n){for(var r=new Go("temp",{width:e,height:1},n,!1),i=r.getContext(),o=i.createLinearGradient(0,0,e,0),a=0,s=t;ae.DISPLAY_SPHERE_AND_SPURS&&(t=e.DISPLAY_LINES),this.options.displayMode=t},enumerable:!1,configurable:!0}),e.prototype._bindObs=function(){var t=this;this.displayMode===e.DISPLAY_LINES&&(this._obs=this.scene.onBeforeRenderObservable.add((function(){t._displayLinesUpdate()})))},e.prototype.update=function(){switch(this.displayMode){case e.DISPLAY_LINES:this._displayLinesUpdate();break;case e.DISPLAY_SPHERES:this._buildSpheresAndSpurs(!0);break;case e.DISPLAY_SPHERE_AND_SPURS:this._buildSpheresAndSpurs(!1)}this._buildLocalAxes()},Object.defineProperty(e.prototype,"isEnabled",{get:function(){return this._isEnabled},set:function(e){this.isEnabled!==e&&(this._isEnabled=e,this.debugMesh&&this.debugMesh.setEnabled(e),e&&!this._obs?this._bindObs():!e&&this._obs&&(this.scene.onBeforeRenderObservable.remove(this._obs),this._obs=null))},enumerable:!1,configurable:!0}),e.prototype._getBonePosition=function(e,t,n,r,i,o){void 0===r&&(r=0),void 0===i&&(i=0),void 0===o&&(o=0);var a=c.AA.Matrix[0],s=t.getParent();if(a.copyFrom(t.getLocalMatrix()),0!==r||0!==i||0!==o){var l=c.AA.Matrix[1];c.uq.IdentityToRef(l),l.setTranslationFromFloats(r,i,o),l.multiplyToRef(a,a)}s&&a.multiplyToRef(s.getAbsoluteMatrix(),a),a.multiplyToRef(n,a),e.x=a.m[12],e.y=a.m[13],e.z=a.m[14]},e.prototype._getLinesForBonesWithLength=function(e,t){var n,r,i=e.length;t?(n=t.getWorldMatrix(),r=t.position):(n=new c.uq,r=e[0].position);for(var o=0,a=0;a=0;a--){var s=e[a],l=s.getParent();if(l&&(this._boneIndices.has(s.getIndex())||this.options.useAllBones)){var u=this._debugLines[i];u||(u=[c.Pq.Zero(),c.Pq.Zero()],this._debugLines[i]=u),s.getAbsolutePositionToRef(t,u[0]),l.getAbsolutePositionToRef(t,u[1]),u[0].subtractInPlace(n),u[1].subtractInPlace(n),i++}}o||t.dispose()},e.prototype._revert=function(e){this.options.pauseAnimations&&(this.scene.animationsEnabled=e,this.utilityLayer.utilityLayerScene.animationsEnabled=e)},e.prototype._getAbsoluteBindPoseToRef=function(e,t){null!==e&&-1!==e._index?(this._getAbsoluteBindPoseToRef(e.getParent(),t),e.getBindMatrix().multiplyToRef(t,t)):t.copyFrom(c.uq.Identity())},e.prototype._createSpur=function(e,t,n,r,i,o){for(var a=n.subtract(e),s=a.length(),l=a.normalize().scale(s),u=i.midStep||.165,h=i.midStepFactor||.215,d=l.scale(u),p=Ks("skeletonViewer",{shape:[new c.Pq(1,-1,0),new c.Pq(1,1,0),new c.Pq(-1,1,0),new c.Pq(-1,-1,0),new c.Pq(1,-1,0)],path:[c.Pq.Zero(),d,l],scaleFunction:function(e){switch(e){case 0:case 2:return 0;case 1:return s*h}return 0},sideOrientation:qe.DEFAULTSIDE,updatable:!1},o),f=p.getTotalVertices(),m=[],_=[],g=0;g9?_.push(r.getIndex(),0,0,0):_.push(t.getIndex(),0,0,0);return p.position=e.clone(),p.setVerticesData(se.R.MatricesWeightsKind,m,!1),p.setVerticesData(se.R.MatricesIndicesKind,_,!1),p.convertToFlatShadedMesh(),p},e.prototype._getBoundingSphereForBone=function(e){if(!this.mesh)return null;var t=this.mesh.getVerticesData(se.R.PositionKind),n=this.mesh.getIndices(),r=this.mesh.getVerticesData(se.R.MatricesWeightsKind),i=this.mesh.getVerticesData(se.R.MatricesIndicesKind);if(!(t&&n&&r&&i))return null;for(var o=new c.Pq(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),a=new c.Pq(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),s=0,l=0;l1e-5){c.Pq.FromArrayToRef(t,3*u,c.AA.Vector3[0]),o.minimizeInPlace(c.AA.Vector3[0]),a.maximizeInPlace(c.AA.Vector3[0]),s++;break}}return s>1?{center:c.Pq.Center(o,a),radius:c.Pq.Distance(o,a)/2}:null},e.prototype._buildSpheresAndSpurs=function(e){var t,n;void 0===e&&(e=!0),this._debugMesh&&(this._debugMesh.dispose(),this._debugMesh=null,this.ready=!1),this._ready=!1;var r=null===(t=this.utilityLayer)||void 0===t?void 0:t.utilityLayerScene,i=this.skeleton.bones,o=[],a=[],s=this.scene.animationsEnabled;try{this.options.pauseAnimations&&(this.scene.animationsEnabled=!1,r.animationsEnabled=!1),this.options.returnToRest&&this.skeleton.returnToRest(),this.autoUpdateBonesMatrices&&this.skeleton.computeAbsoluteMatrices();for(var l=Number.NEGATIVE_INFINITY,u=this.options.displayOptions||{},h=0;h0)for(var f=0,m=D.children;fl&&(l=b),e)return;a.push(this._createSpur(p,D,v,_,u,r))}else{var S=this._getBoundingSphereForBone(D.getIndex());if(S&&(S.radius>l&&(l=S.radius),!e)){v=void 0;var T=D.getParent();T?(this._getAbsoluteBindPoseToRef(T,d),d.decompose(void 0,void 0,c.AA.Vector3[0]),v=p.subtract(c.AA.Vector3[0]).normalize().scale(S.radius).add(p)):v=S.center.subtract(p).normalize().scale(S.radius).add(p),a.push(this._createSpur(p,D,v,null,u,r))}}for(var E=(M=rs("skeletonViewer",{segments:6,diameter:u.sphereBaseSize||.2,updatable:!0},r)).getTotalVertices(),x=[],P=[],C=0;C0?this._frameGraph.textureManager.getTextureDescription(r[0]):null;this._textureWidth=null!==(e=null==o?void 0:o.size.width)&&void 0!==e?e:0,this._textureHeight=null!==(t=null==o?void 0:o.size.height)&&void 0!==t?t:0,Do.MarkAsDirty(this._renderer.renderPassId,this.objectList.meshes||this._scene.meshes);var a=this._frameGraph.addRenderPass(this.name);a.setRenderTarget(r);for(var s=!1,l=function(e){var t=c.textureDescriptions[e],n=r[e],i=Do.GeometryTextureDescriptions.findIndex((function(e){return e.type===t.type}));switch(Do.GeometryTextureDescriptions[i].type){case b.Y.PREPASS_DEPTH_TEXTURE_TYPE:c._frameGraph.textureManager.resolveDanglingHandle(c.geometryViewDepthTexture,n);break;case b.Y.PREPASS_NORMALIZED_VIEW_DEPTH_TEXTURE_TYPE:c._frameGraph.textureManager.resolveDanglingHandle(c.geometryNormViewDepthTexture,n);break;case b.Y.PREPASS_SCREENSPACE_DEPTH_TEXTURE_TYPE:c._frameGraph.textureManager.resolveDanglingHandle(c.geometryScreenDepthTexture,n);break;case b.Y.PREPASS_NORMAL_TEXTURE_TYPE:c._frameGraph.textureManager.resolveDanglingHandle(c.geometryViewNormalTexture,n);break;case b.Y.PREPASS_WORLD_NORMAL_TEXTURE_TYPE:c._frameGraph.textureManager.resolveDanglingHandle(c.geometryWorldNormalTexture,n);break;case b.Y.PREPASS_LOCAL_POSITION_TEXTURE_TYPE:c._frameGraph.textureManager.resolveDanglingHandle(c.geometryLocalPositionTexture,n);break;case b.Y.PREPASS_POSITION_TEXTURE_TYPE:c._frameGraph.textureManager.resolveDanglingHandle(c.geometryWorldPositionTexture,n);break;case b.Y.PREPASS_ALBEDO_TEXTURE_TYPE:c._frameGraph.textureManager.resolveDanglingHandle(c.geometryAlbedoTexture,n);break;case b.Y.PREPASS_REFLECTIVITY_TEXTURE_TYPE:c._frameGraph.textureManager.resolveDanglingHandle(c.geometryReflectivityTexture,n);break;case b.Y.PREPASS_VELOCITY_TEXTURE_TYPE:c._frameGraph.textureManager.resolveDanglingHandle(c.geometryVelocityTexture,n),s=!0;break;case b.Y.PREPASS_VELOCITY_LINEAR_TEXTURE_TYPE:c._frameGraph.textureManager.resolveDanglingHandle(c.geometryLinearVelocityTexture,n),s=!0}},c=this,u=0;u0)throw new Error("FrameGraphGeometryRendererTask ".concat(this.name,": the depth texture and the output texture must have the same number of samples"));this._frameGraph.textureManager.resolveDanglingHandle(this.outputDepthTexture,this.depthTexture),e=!0}return e},t.prototype._buildClearAttachmentsLayout=function(){for(var e=this,t=new Map,n=[],r=function(e){var r=i.textureDescriptions[e],o=Do.GeometryTextureDescriptions.findIndex((function(e){return e.type===r.type})),a=Do.GeometryTextureDescriptions[o],s=t.get(a.clearType);if(void 0===s){s=[],t.set(a.clearType,s);for(var l=0;l=0;r--){var i=n[r];if(i instanceof Ul||i instanceof Gl)return i.camera}return null}function zl(e){for(var t=e.getTasksByType(Fl.H),n=null,r=t.length-1;r>=0;--r){if(t[r].isMainObjectRenderer)return t[r];t[r].objectList.meshes&&!n&&(n=t[r])}return n}function Wl(e,t){void 0===t&&(t=!0);var n=e.scene,r=new Ya(n,t,!0);r.utilityLayerScene.activeCamera=n.activeCamera;var i=Hl.FindMainCamera(n.frameGraph);!i&&n.cameras.length>0&&(i=n.cameras[0]),i&&(r.setRenderCamera(i),r.utilityLayerScene.activeCamera=i);var o=n.onAfterRenderObservable.add((function(){r.render()}));return r.utilityLayerScene.onDisposeObservable.addOnce((function(){n.onAfterRenderObservable.remove(o)})),r}var Hl={FindMainCamera:kl,FindMainObjectRenderer:zl,CreateUtilityLayerRenderer:Wl},Yl=function(){function e(e,t){void 0===t&&(t=null),this._oldPosition=new c.Pq(Number.NaN,Number.NaN,Number.NaN),this._oldDirection=new c.Pq(Number.NaN,Number.NaN,Number.NaN),this._transparency=.3,this._showLines=!0,this._showPlanes=!0,this._scene=e.getScene(),this._light=e,this._camera=t,this._inverseViewMatrix=c.uq.Identity(),this._lightHelperFrustumMeshes=[],this._createGeometry(),this.show(),this.update()}return Object.defineProperty(e.prototype,"transparency",{get:function(){return this._transparency},set:function(e){this._transparency=e;for(var t=6;t<12;++t)this._lightHelperFrustumMeshes[t].material.alpha=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"showLines",{get:function(){return this._showLines},set:function(e){if(this._showLines!==e){this._showLines=e;for(var t=0;t<6;++t)this._lightHelperFrustumMeshes[t].setEnabled(e)}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"showPlanes",{get:function(){return this._showPlanes},set:function(e){if(this._showPlanes!==e){this._showPlanes=e;for(var t=6;t<12;++t)this._lightHelperFrustumMeshes[t].setEnabled(e)}},enumerable:!1,configurable:!0}),e.prototype.show=function(){var e=this;this._scene.frameGraph&&(this._removeMeshesFromFrameGraph(this._scene.frameGraph),this._addMeshesToFrameGraph(this._scene.frameGraph)),this._lightHelperFrustumMeshes.forEach((function(t,n){t.setEnabled(n<6&&e._showLines||n>=6&&e._showPlanes)})),this._oldPosition.set(Number.NaN,Number.NaN,Number.NaN),this._visible=!0},e.prototype.hide=function(){this._scene.frameGraph&&this._removeMeshesFromFrameGraph(this._scene.frameGraph);for(var e=0,t=this._lightHelperFrustumMeshes;e0)}else{if(e.occlusionInternalRetryCounter++,!(-1!==e.occlusionRetryCount&&e.occlusionInternalRetryCounter>e.occlusionRetryCount))return e.occlusionType!==De.OCCLUSION_TYPE_OPTIMISTIC&&e.isOccluded;e.isOcclusionQueryInProgress=!1,e.occlusionInternalRetryCounter=0,e.isOccluded=e.occlusionType!==De.OCCLUSION_TYPE_OPTIMISTIC&&e.isOccluded}var r=this.getScene();if(r.getBoundingBoxRenderer){var i=r.getBoundingBoxRenderer();null===this._occlusionQuery&&(this._occlusionQuery=t.createQuery()),this._occlusionQuery&&t.beginOcclusionQuery(e.occlusionQueryAlgorithmType,this._occlusionQuery)&&(i.renderOcclusionBoundingBox(this),t.endOcclusionQuery(e.occlusionQueryAlgorithmType),this._occlusionDataStorage.isOcclusionQueryInProgress=!0)}return e.isOccluded},n(14605),n(20833),n(92142);var tc=function(){},nc=new l.cP,rc=new l.cP;Object.defineProperty(Ie.$.prototype,"onBeforeViewRenderObservable",{get:function(){return nc}}),Object.defineProperty(Ie.$.prototype,"onAfterViewRenderObservable",{get:function(){return rc}}),Object.defineProperty(Ie.$.prototype,"inputElement",{get:function(){return this._inputElement},set:function(e){var t;this._inputElement!==e&&(this._inputElement=e,null===(t=this._onEngineViewChanged)||void 0===t||t.call(this))}}),Ie.$.prototype.getInputElement=function(){return this.inputElement||this.getRenderingCanvas()},Ie.$.prototype.registerView=function(e,t,n){var r=this;this.views||(this.views=[]);for(var i=0,o=this.views;i-1&&(t._gpuFrameTimeToken=null,n.fetchNewFrame(),n.addCount(e,!0))}}))}else this.onBeginFrameObservable.remove(this._onBeginFrameObserver),this._onBeginFrameObserver=null,this.onEndFrameObservable.remove(this._onEndFrameObserver),this._onEndFrameObserver=null},Uo.ThinEngine.prototype._getGlAlgorithmType=function(e){return e===De.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE?this._gl.ANY_SAMPLES_PASSED_CONSERVATIVE:this._gl.ANY_SAMPLES_PASSED};var oc=!0;Ai.N.prototype.createTransformFeedback=function(){var e=this._gl.createTransformFeedback();if(!e)throw new Error("Unable to create Transform Feedback");return e},Ai.N.prototype.deleteTransformFeedback=function(e){this._gl.deleteTransformFeedback(e)},Ai.N.prototype.bindTransformFeedback=function(e){this._gl.bindTransformFeedback(this._gl.TRANSFORM_FEEDBACK,e)},Ai.N.prototype.beginTransformFeedback=function(e){void 0===e&&(e=!0),this._gl.beginTransformFeedback(e?this._gl.POINTS:this._gl.TRIANGLES)},Ai.N.prototype.endTransformFeedback=function(){this._gl.endTransformFeedback()},Ai.N.prototype.setTranformFeedbackVaryings=function(e,t){this._gl.transformFeedbackVaryings(e,t,this._gl.INTERLEAVED_ATTRIBS)},Ai.N.prototype.bindTransformFeedbackBuffer=function(e){this._gl.bindBufferBase(this._gl.TRANSFORM_FEEDBACK_BUFFER,0,e?e.underlyingResource:null)},Ai.N.prototype.readTransformFeedbackBuffer=function(e){this._gl.getBufferSubData(this._gl.TRANSFORM_FEEDBACK_BUFFER,0,e)},n(55557),Uo.ThinEngine.prototype.updateVideoTexture=function(e,t,n){if(e&&!e._isDisabled){var r=this._getInternalFormat(e.format),i=this._getRGBABufferInternalSizedFormat(b.Y.TEXTURETYPE_UNSIGNED_BYTE,e.format),o=this._bindTextureDirectly(this._gl.TEXTURE_2D,e,!0);this._unpackFlipY(!n);try{if(void 0===this._videoTextureSupported&&(this._gl.getError(),this._gl.texImage2D(this._gl.TEXTURE_2D,0,i,r,this._gl.UNSIGNED_BYTE,t),0!==this._gl.getError()?this._videoTextureSupported=!1:this._videoTextureSupported=!0),this._videoTextureSupported)this._gl.texImage2D(this._gl.TEXTURE_2D,0,i,r,this._gl.UNSIGNED_BYTE,t);else{if(!e._workingCanvas){e._workingCanvas=this.createCanvas(e.width,e.height);var a=e._workingCanvas.getContext("2d");if(!a)throw new Error("Unable to get 2d context");e._workingContext=a,e._workingCanvas.width=e.width,e._workingCanvas.height=e.height}e._workingContext.clearRect(0,0,e.width,e.height),e._workingContext.drawImage(t,0,0,t.videoWidth,t.videoHeight,0,0,e.width,e.height),this._gl.texImage2D(this._gl.TEXTURE_2D,0,i,r,this._gl.UNSIGNED_BYTE,e._workingCanvas)}e.generateMipMaps&&this._gl.generateMipmap(this._gl.TEXTURE_2D),o||this._bindTextureDirectly(this._gl.TEXTURE_2D,null),e.isReady=!0}catch(t){e._isDisabled=!0}}},Uo.ThinEngine.prototype.restoreSingleAttachment=function(){var e=this._gl;this.bindAttachments([e.BACK])},Uo.ThinEngine.prototype.restoreSingleAttachmentForRenderTarget=function(){var e=this._gl;this.bindAttachments([e.COLOR_ATTACHMENT0])},Uo.ThinEngine.prototype.buildTextureLayout=function(e,t){void 0===t&&(t=!1);var n=this._gl,r=[];if(t)r.push(n.BACK);else for(var i=0;i1&&(t.depthTextureFormat===b.Y.TEXTUREFORMAT_DEPTH24_STENCIL8||t.depthTextureFormat===b.Y.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8||t.depthTextureFormat===b.Y.TEXTUREFORMAT_DEPTH24||t.depthTextureFormat===b.Y.TEXTUREFORMAT_DEPTH32_FLOAT||t.depthTextureFormat===b.Y.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8)&&(m=t.depthTextureFormat)),void 0===m&&(m=p?b.Y.TEXTUREFORMAT_DEPTH24_STENCIL8:b.Y.TEXTUREFORMAT_DEPTH32_FLOAT);var L=this._gl,w=this._currentFramebuffer,B=L.createFramebuffer();this._bindUnboundFramebuffer(B);var V=null!==(a=e.width)&&void 0!==a?a:e,U=null!==(s=e.height)&&void 0!==s?s:e,G=[],k=[],z=this.webGLVersion>1&&(m===b.Y.TEXTUREFORMAT_DEPTH24_STENCIL8||m===b.Y.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8||m===b.Y.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8);F.label=null!==(l=null==t?void 0:t.label)&&void 0!==l?l:"MultiRenderTargetWrapper",F._framebuffer=B,F._generateDepthBuffer=f||d,F._generateStencilBuffer=f?z:p,F._depthStencilBuffer=this._setupFramebufferDepthAttachments(F._generateStencilBuffer,F._generateDepthBuffer,V,U,1,m),F._attachments=k;for(var W=0;W<_;W++){var H=P[W]||S,Y=x[W]||v,X=C[W]||!1,j=R[W]||T,q=A[W]||E,K=null!==(c=M[W])&&void 0!==c?c:1;(Y!==b.Y.TEXTURETYPE_FLOAT||this._caps.textureFloatLinearFiltering)&&(Y!==b.Y.TEXTURETYPE_HALF_FLOAT||this._caps.textureHalfFloatLinearFiltering)||(H=b.Y.TEXTURE_NEAREST_SAMPLINGMODE);var Z=this._getSamplingParameters(H,h);Y!==b.Y.TEXTURETYPE_FLOAT||this._caps.textureFloat||(Y=b.Y.TEXTURETYPE_UNSIGNED_BYTE,y.V.Warn("Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type")),X=X&&this._caps.supportSRGBBuffers&&(this.webGLVersion>1||this.isWebGPU);var Q=this.webGLVersion>1,J=L[Q?"COLOR_ATTACHMENT"+W:"COLOR_ATTACHMENT"+W+"_WEBGL"];if(k.push(J),-1!==q&&!N){var $=new Qi.h(this,6);G[W]=$,L.activeTexture(L["TEXTURE"+W]),L.bindTexture(q,$._hardwareTexture.underlyingResource),L.texParameteri(q,L.TEXTURE_MAG_FILTER,Z.mag),L.texParameteri(q,L.TEXTURE_MIN_FILTER,Z.min),L.texParameteri(q,L.TEXTURE_WRAP_S,L.CLAMP_TO_EDGE),L.texParameteri(q,L.TEXTURE_WRAP_T,L.CLAMP_TO_EDGE);var ee=this._getRGBABufferInternalSizedFormat(Y,j,X),te=this._getInternalFormat(j),ne=this._getWebGLTextureType(Y);if(!Q||q!==b.Y.TEXTURE_2D_ARRAY&&q!==b.Y.TEXTURE_3D)if(q===b.Y.TEXTURE_CUBE_MAP){for(var re=0;re<6;re++)L.texImage2D(L.TEXTURE_CUBE_MAP_POSITIVE_X+re,0,ee,V,U,0,te,ne,null);$.isCube=!0}else L.texImage2D(L.TEXTURE_2D,0,ee,V,U,0,te,ne,null);else q===b.Y.TEXTURE_2D_ARRAY?$.is2DArray=!0:$.is3D=!0,$.baseDepth=$.depth=K,L.texImage3D(q,0,ee,V,U,K,0,te,ne,null);h&&L.generateMipmap(q),this._bindTextureDirectly(q,null),$.baseWidth=V,$.baseHeight=U,$.width=V,$.height=U,$.isReady=!0,$.samples=1,$.generateMipMaps=h,$.samplingMode=H,$.type=Y,$._useSRGBBuffer=X,$.format=j,$.label=null!==(u=D[W])&&void 0!==u?u:F.label+"-Texture"+W,this._internalTexturesCache.push($)}}if(f&&this._caps.depthTextureExtension&&!N){var ie=new Qi.h(this,14),oe=b.Y.TEXTURETYPE_UNSIGNED_SHORT,ae=L.DEPTH_COMPONENT16,se=L.DEPTH_COMPONENT,le=L.UNSIGNED_SHORT,ce=L.DEPTH_ATTACHMENT;this.webGLVersion<2?ae=L.DEPTH_COMPONENT:m===b.Y.TEXTUREFORMAT_DEPTH32_FLOAT?(oe=b.Y.TEXTURETYPE_FLOAT,le=L.FLOAT,ae=L.DEPTH_COMPONENT32F):m===b.Y.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8?(oe=b.Y.TEXTURETYPE_UNSIGNED_BYTE,le=L.FLOAT_32_UNSIGNED_INT_24_8_REV,ae=L.DEPTH32F_STENCIL8,se=L.DEPTH_STENCIL,ce=L.DEPTH_STENCIL_ATTACHMENT):m===b.Y.TEXTUREFORMAT_DEPTH24?(oe=b.Y.TEXTURETYPE_UNSIGNED_BYTE,le=L.UNSIGNED_INT,ae=L.DEPTH_COMPONENT24,ce=L.DEPTH_ATTACHMENT):m!==b.Y.TEXTUREFORMAT_DEPTH24_STENCIL8&&m!==b.Y.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8||(oe=b.Y.TEXTURETYPE_UNSIGNED_INT_24_8,le=L.UNSIGNED_INT_24_8,ae=L.DEPTH24_STENCIL8,se=L.DEPTH_STENCIL,ce=L.DEPTH_STENCIL_ATTACHMENT),this._bindTextureDirectly(L.TEXTURE_2D,ie,!0),L.texParameteri(L.TEXTURE_2D,L.TEXTURE_MAG_FILTER,L.NEAREST),L.texParameteri(L.TEXTURE_2D,L.TEXTURE_MIN_FILTER,L.NEAREST),L.texParameteri(L.TEXTURE_2D,L.TEXTURE_WRAP_S,L.CLAMP_TO_EDGE),L.texParameteri(L.TEXTURE_2D,L.TEXTURE_WRAP_T,L.CLAMP_TO_EDGE),L.texImage2D(L.TEXTURE_2D,0,ae,V,U,0,se,le,null),L.framebufferTexture2D(L.FRAMEBUFFER,ce,L.TEXTURE_2D,ie._hardwareTexture.underlyingResource,0),this._bindTextureDirectly(L.TEXTURE_2D,null),F._depthStencilTexture=ie,F._depthStencilTextureWithStencil=z,ie.baseWidth=V,ie.baseHeight=U,ie.width=V,ie.height=U,ie.isReady=!0,ie.samples=1,ie.generateMipMaps=h,ie.samplingMode=b.Y.TEXTURE_NEAREST_SAMPLINGMODE,ie.format=m,ie.type=oe,ie.label=F.label+"-DepthStencil",G[_]=ie,this._internalTexturesCache.push(ie)}if(F.setTextures(G),n&&L.drawBuffers(k),this._bindUnboundFramebuffer(w),F.setLayerAndFaceIndices(O,I),this.resetTextureCache(),N){if(g>1){var ue=L.createFramebuffer();if(!ue)throw new Error("Unable to create multi sampled framebuffer");F._samples=g,F._MSAAFramebuffer=ue,_>0&&n&&(this._bindUnboundFramebuffer(ue),L.drawBuffers(k),this._bindUnboundFramebuffer(w))}}else this.updateMultipleRenderTargetTextureSampleCount(F,g,n);return F},Uo.ThinEngine.prototype.updateMultipleRenderTargetTextureSampleCount=function(e,t,n){if(void 0===n&&(n=!0),this.webGLVersion<2||!e)return 1;if(e.samples===t)return t;var r=this._gl;t=Math.min(t,this.getCaps().maxMSAASamples),e._depthStencilBuffer&&(r.deleteRenderbuffer(e._depthStencilBuffer),e._depthStencilBuffer=null),e._MSAAFramebuffer&&(r.deleteFramebuffer(e._MSAAFramebuffer),e._MSAAFramebuffer=null);for(var i=e._attachments.length,o=0;o1&&"function"==typeof r.renderbufferStorageMultisample){var a=r.createFramebuffer();if(!a)throw new Error("Unable to create multi sampled framebuffer");e._MSAAFramebuffer=a,this._bindUnboundFramebuffer(a);var s=[];for(o=0;o1?"COLOR_ATTACHMENT"+o:"COLOR_ATTACHMENT"+o+"_WEBGL"],h=this._createRenderBuffer(l.width,l.height,t,-1,this._getRGBABufferInternalSizedFormat(l.type,l.format,l._useSRGBBuffer),u);if(!h)throw new Error("Unable to create multi sampled framebuffer");c.addMSAARenderBuffer(h),l.samples=t,s.push(u)}n&&r.drawBuffers(s)}else this._bindUnboundFramebuffer(e._framebuffer);var d=e._depthStencilTexture?e._depthStencilTexture.format:void 0;return e._depthStencilBuffer=this._setupFramebufferDepthAttachments(e._generateStencilBuffer,e._generateDepthBuffer,e.width,e.height,t,d),this._bindUnboundFramebuffer(null),e._samples=t,t},Uo.ThinEngine.prototype.generateMipMapsMultiFramebuffer=function(e){var t=e,n=this._gl;if(t.isMulti)for(var r=0;r1?"COLOR_ATTACHMENT"+a:"COLOR_ATTACHMENT"+a+"_WEBGL"],n.readBuffer(i[a]),n.drawBuffers(i),n.blitFramebuffer(0,0,s.width,s.height,0,0,s.width,s.height,r,n.NEAREST)}for(a=0;a1?"COLOR_ATTACHMENT"+a:"COLOR_ATTACHMENT"+a+"_WEBGL"];n.drawBuffers(i),n.bindFramebuffer(this._gl.FRAMEBUFFER,t._MSAAFramebuffer)}},n(71974),n(23778),n(71073),n(8864),n(64838),n(59012),n(23469);var ac,sc=n(82345);function lc(e){if(this._excludedCompressedTextures&&this._excludedCompressedTextures.some((function(t){var n="\\b"+t+"\\b";return e&&(e===t||e.match(new RegExp(n,"g")))})))return e;var t=e.lastIndexOf("."),n=e.lastIndexOf("?"),r=n>-1?e.substring(n,e.length):"";return(t>-1?e.substring(0,t):e)+this._textureFormatInUse+r}!function(e){e[e.Texture=0]="Texture",e[e.StorageTexture=1]="StorageTexture",e[e.UniformBuffer=2]="UniformBuffer",e[e.StorageBuffer=3]="StorageBuffer",e[e.TextureWithoutSampler=4]="TextureWithoutSampler",e[e.Sampler=5]="Sampler",e[e.ExternalTexture=6]="ExternalTexture",e[e.DataBuffer=7]="DataBuffer",e[e.InternalTexture=8]="InternalTexture"}(ac||(ac={})),Uo.ThinEngine.prototype.createComputeEffect=function(e,t){throw new Error("createComputeEffect: This engine does not support compute shaders!")},Uo.ThinEngine.prototype.createComputePipelineContext=function(){throw new Error("createComputePipelineContext: This engine does not support compute shaders!")},Uo.ThinEngine.prototype.createComputeContext=function(){},Uo.ThinEngine.prototype.computeDispatch=function(e,t,n,r,i,o,a){throw new Error("computeDispatch: This engine does not support compute shaders!")},Uo.ThinEngine.prototype.computeDispatchIndirect=function(e,t,n,r,i,o){throw new Error("computeDispatchIndirect: This engine does not support compute shaders!")},Uo.ThinEngine.prototype.areAllComputeEffectsReady=function(){return!0},Uo.ThinEngine.prototype.releaseComputeEffects=function(){},Uo.ThinEngine.prototype._prepareComputePipelineContext=function(e,t,n,r,i){},Uo.ThinEngine.prototype._rebuildComputeEffects=function(){},Ie.$.prototype._executeWhenComputeStateIsCompiled=function(e,t){t(null)},Uo.ThinEngine.prototype._releaseComputeEffect=function(e){},Uo.ThinEngine.prototype._deleteComputePipelineContext=function(e){},Object.defineProperty(Ai.N.prototype,"texturesSupported",{get:function(){var e=[];return this._caps.astc&&e.push("-astc.ktx"),this._caps.s3tc&&e.push("-dxt.ktx"),this._caps.pvrtc&&e.push("-pvrtc.ktx"),this._caps.etc2&&e.push("-etc2.ktx"),this._caps.etc1&&e.push("-etc1.ktx"),e},enumerable:!0,configurable:!0}),Object.defineProperty(Ai.N.prototype,"textureFormatInUse",{get:function(){return this._textureFormatInUse||null},enumerable:!0,configurable:!0}),Ai.N.prototype.setCompressedTextureExclusions=function(e){this._excludedCompressedTextures=e},Ai.N.prototype.setTextureFormatToUse=function(e){for(var t=this.texturesSupported,n=0,r=t.length;nthis._length&&this._flush()},e.prototype._flush=function(){this._nativeDataStream.writeBuffer(this._uint32s.buffer,this._position),this._position=0},e.DEFAULT_BUFFER_SIZE=65536,e}(),uc=n(88309);function hc(e,t,n,r){for(var i=r,o=0,a="";i=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122||95==t}function fc(e){for(var t=0,n="",r=!1,i=[];t=0&&e.charAt(t)!==n&&(!r||e.charAt(t)!==r);)t--;return t}function _c(e,t,n,r){var i=e.indexOf(t);if(i<0)return e;if(n){for(;i++=0&&f.push(_.substring(g+1))}"void"!==a&&f.push("return"),this._functionDescr.push({name:s,type:a,parameters:f,body:d,callIndex:0}),t=h+1;var v=n>0?this._sourceCode.substring(0,n):"",b=h+1=0},e.prototype._replaceFunctionCallsByCode=function(){for(var e=!1,t=0,n=this._functionDescr;t0?this._sourceCode.substring(0,c):"",S=h+1=0&&(e="invariant gl_Position;\n"+e),(null===(r=this._nativeProcessingContext)||void 0===r?void 0:r.injectInVertexMain)&&(e=_c(e,"void main",this._nativeProcessingContext.injectInVertexMain)),-1!==t.indexOf("#define MULTIVIEW"))return"#extension GL_OVR_multiview2 : require\nlayout (num_views = 2) in;\n"+e;return e},e}(),Sc=function(){function e(e,t,n){this.isCompiled=!1,this.vertexBufferKindToType={},this._valueCache={},this._engine=e,this.isAsync=t,this.shaderProcessingContext=n}return Object.defineProperty(e.prototype,"isReady",{get:function(){if(this.compilationError){var e=this.compilationError.message;throw new Error("SHADER ERROR"+("string"==typeof e?"\n"+e:""))}return this.isCompiled},enumerable:!1,configurable:!0}),e.prototype._getVertexShaderCode=function(){return null},e.prototype._getFragmentShaderCode=function(){return null},e.prototype._fillEffectInformation=function(e,t,n,r,i,o,a,s){var l,c=this._engine;if(c.supportsUniformBuffers)for(var u in t)e.bindUniformBlock(u,t[u]);for(this._engine.getUniforms(this,n).forEach((function(e,t){r[n[t]]=e})),this._uniforms=r,l=0;l=0){var l=o[a],c=null;if(i&&(c=i[l]),c||(c=t[l]),c){var u=c.effectiveBuffer;u&&u.nativeVertexBuffer&&this._engine.recordVertexBuffer(e,u.nativeVertexBuffer,s,c.effectiveByteOffset,c.effectiveByteStride,c.getSize(),Rc(c.type),c.normalized,c.getInstanceDivisor())}}}},t.prototype.bindBuffers=function(e,t,n){this._boundBuffersVertexArray&&this._deleteVertexArray(this._boundBuffersVertexArray),this._boundBuffersVertexArray=this._engine.createVertexArray(),this._recordVertexArrayObject(this._boundBuffersVertexArray,e,t,n),this.bindVertexArrayObject(this._boundBuffersVertexArray)},t.prototype.recordVertexArrayObject=function(e,t,n,r){var i=this._engine.createVertexArray();return this._recordVertexArrayObject(i,e,t,n,r),i},t.prototype._deleteVertexArray=function(e){this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_DELETEVERTEXARRAY),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.finishEncodingCommand()},t.prototype.bindVertexArrayObject=function(e){this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_BINDVERTEXARRAY),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.finishEncodingCommand()},t.prototype.releaseVertexArrayObject=function(e){this._deleteVertexArray(e)},t.prototype.getAttributes=function(e,t){var n,r=e,i=r.shaderProcessingContext;Uc.length=0;for(var o=0;o-1?e.substring(T).toLowerCase():""),x=null;(E.endsWith(".basis")||E.endsWith(".ktx")||E.endsWith(".ktx2")||"image/ktx"===h||"image/ktx2"===h)&&(x=(0,Nc.gT)(E)),r&&r.addPendingData(v),v.url=e,v.generateMipMaps=!t,v.samplingMode=i,v.invertY=n,v._useSRGBBuffer=this._getUseSRGBBuffer(f,t),this.doNotHandleContextLost||(v._buffer=s);var P=null;if(o&&!l&&(P=v.onLoadedObservable.add(o)),l||this._internalTexturesCache.push(v),x)throw new Error("Loading textures from IInternalTextureLoader not yet implemented.");var C=function(e){if(v._hardwareTexture){var o=v._hardwareTexture.underlyingResource;m._engine.loadTexture(o,e,!t,n,v._useSRGBBuffer,(function(){v.baseWidth=m._engine.getTextureWidth(o),v.baseHeight=m._engine.getTextureHeight(o),v.width=v.baseWidth,v.height=v.baseHeight,v.isReady=!0;var e=Pc(i);m._setTextureSampling(o,e),r&&r.removePendingData(v),v.onLoadedObservable.notifyObservers(v),v.onLoadedObservable.clear()}),(function(){throw new Error("Could not load a native texture.")}))}else r&&r.removePendingData(v)};if(_&&s)if(s instanceof ArrayBuffer)C(new Uint8Array(s));else if(ArrayBuffer.isView(s))C(s);else{if("string"!=typeof s)throw new Error("Unsupported buffer type");C(new Uint8Array(Z.S0.DecodeBase64(s)))}else g?C(new Uint8Array(Z.S0.DecodeBase64(e))):this._loadFile(e,(function(e){return C(new Uint8Array(e))}),void 0,void 0,!0,(function(n,l){var p;p="Unable to load "+(n&&n.responseURL,l),r&&r.removePendingData(v),e===S?(P&&v.onLoadedObservable.remove(P),M.q.UseFallbackTexture&&m.createTexture(M.q.FallbackTexture,t,v.invertY,r,i,null,a,s,v),a&&a((p||"Unknown error")+(M.q.UseFallbackTexture?" - Fallback texture was used":""),void 0)):(y.V.Warn("Failed to load ".concat(e,", falling back to ").concat(S)),m.createTexture(S,t,v.invertY,r,i,o,a,s,v,c,u,h,d))}));return v},t.prototype.wrapNativeTexture=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=b.Y.TEXTURE_TRILINEAR_SAMPLINGMODE);var r=new Ec(e,this._engine),i=new Qi.h(this,0,!0);return i._hardwareTexture=r,i.baseWidth=this._engine.getTextureWidth(e),i.baseHeight=this._engine.getTextureHeight(e),i.width=i.baseWidth,i.height=i.baseHeight,i.isReady=!0,i.useMipMaps=t,this.updateTextureSamplingMode(n,i),i},t.prototype.wrapWebGLTexture=function(){throw new Error("wrapWebGLTexture is not supported, use wrapNativeTexture instead.")},t.prototype._createDepthStencilTexture=function(e,t,n){var r,i,o=t.generateStencil||!1,a=t.samples||1,s=n,l=new Qi.h(this,12),c=null!==(r=e.width)&&void 0!==r?r:e,u=null!==(i=e.height)&&void 0!==i?i:e,h=this._engine.createFrameBuffer(l._hardwareTexture.underlyingResource,c,u,o,!0,a);return s._framebufferDepthStencil=h,l},t.prototype._releaseFramebufferObjects=function(e){e&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_DELETEFRAMEBUFFER),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.finishEncodingCommand())},t.prototype._createImageBitmapFromSource=function(e,t){return(0,f.sH)(this,void 0,void 0,(function(){var t,n=this;return(0,f.YH)(this,(function(r){switch(r.label){case 0:return t=new Promise((function(t,r){var i=n.createCanvasImage();i.onload=function(){try{var e=n._engine.createImageBitmap(i);t(e)}catch(e){r("Error loading image ".concat(i.src," with exception: ").concat(e))}},i.onerror=function(e){r("Error loading image ".concat(i.src," with exception: ").concat(e))},i.src=e})),[4,t];case 1:return[2,r.sent()]}}))}))},t.prototype.createImageBitmap=function(e,t){return(0,f.sH)(this,void 0,void 0,(function(){var t=this;return(0,f.YH)(this,(function(n){switch(n.label){case 0:return[4,new Promise((function(n,r){if(Array.isArray(e)){var i=e;if(i.length){var o=t._engine.createImageBitmap(i[0]);if(o)return void n(o)}}r("Unsupported data for createImageBitmap.")}))];case 1:return[2,n.sent()]}}))}))},t.prototype.resizeImageBitmap=function(e,t,n){return this._engine.resizeImageBitmap(e,t,n)},t.prototype.createCubeTexture=function(e,t,n,r,i,o,a,s,l,c,u,h,d,p,m){var _=this;void 0===i&&(i=null),void 0===o&&(o=null),void 0===s&&(s=null),void 0===l&&(l=!1),void 0===c&&(c=0),void 0===u&&(u=0),void 0===h&&(h=null),void 0===p&&(p=!1),void 0===m&&(m=null);var g=h||new Qi.h(this,7);g.isCube=!0,g.url=e,g.generateMipMaps=!r,g._lodGenerationScale=c,g._lodGenerationOffset=u,g._useSRGBBuffer=this._getUseSRGBBuffer(p,!!r),this._doNotHandleContextLost||(g._extension=s,g._files=n,g._buffer=m);var v=e.lastIndexOf(".");if(".env"===(s||(v>-1?e.substring(v).toLowerCase():""))){var y=function(e){var t=(0,uc.cU)(e);g.width=t.width,g.height=t.width,(0,uc.ow)(g,t);var n=t.specular;if(!n)throw new Error("Nothing else parsed so far");g._lodGenerationScale=n.lodGenerationScale;var r=(0,uc.ux)(e,t);g.format=b.Y.TEXTUREFORMAT_RGBA,g.type=b.Y.TEXTURETYPE_UNSIGNED_BYTE,g.generateMipMaps=!0,g.getEngine().updateTextureSamplingMode(_n.g.TRILINEAR_SAMPLINGMODE,g),g._isRGBD=!0,g.invertY=!0,_._engine.loadCubeTextureWithMips(g._hardwareTexture.underlyingResource,r,!1,g._useSRGBBuffer,(function(){g.isReady=!0,i&&i()}),(function(){throw new Error("Could not load a native cube texture.")}))};if(m)y(m);else{if(n&&6===n.length)throw new Error("Multi-file loading not allowed on env files.");this._loadFile(e,(function(e){y(new Uint8Array(e,0,e.byteLength))}),void 0,void 0,!0,(function(e,t){o&&e&&o(e.status+" "+e.statusText,t)}))}}else{if(!n||6!==n.length)throw new Error("Cannot load cubemap because 6 files were not defined");var S=[n[0],n[3],n[1],n[4],n[2],n[5]];Promise.all(S.map((function(e){return(0,f.sH)(_,void 0,void 0,(function(){return(0,f.YH)(this,(function(t){switch(t.label){case 0:return[4,this._loadFileAsync(e,void 0,!0).then((function(e){return new Uint8Array(e,0,e.byteLength)}))];case 1:return[2,t.sent()]}}))}))}))).then((function(e){return(0,f.sH)(_,void 0,void 0,(function(){var t=this;return(0,f.YH)(this,(function(n){switch(n.label){case 0:return[4,new Promise((function(n,i){t._engine.loadCubeTexture(g._hardwareTexture.underlyingResource,e,!r,!0,g._useSRGBBuffer,n,i)}))];case 1:return[2,n.sent()]}}))}))})).then((function(){g.isReady=!0,i&&i()}),(function(e){o&&o("Failed to load cubemap: ".concat(e.message),e)}))}return this._internalTexturesCache.push(g),g},t.prototype._createHardwareTexture=function(){return new Ec(this._createTexture(),this._engine)},t.prototype._createHardwareRenderTargetWrapper=function(e,t,n){var r=new Tc(e,t,n,this);return this._renderTargetWrapperCache.push(r),r},t.prototype._createInternalTexture=function(e,t,n,r){var i,o,a;void 0===n&&(n=!0),void 0===r&&(r=0);var s,l=!1,c=b.Y.TEXTURETYPE_UNSIGNED_BYTE,u=b.Y.TEXTURE_TRILINEAR_SAMPLINGMODE,h=b.Y.TEXTUREFORMAT_RGBA,d=!1,p=1;void 0!==t&&"object"==typeof t?(l=!!t.generateMipMaps,c=void 0===t.type?b.Y.TEXTURETYPE_UNSIGNED_BYTE:t.type,u=void 0===t.samplingMode?b.Y.TEXTURE_TRILINEAR_SAMPLINGMODE:t.samplingMode,h=void 0===t.format?b.Y.TEXTUREFORMAT_RGBA:t.format,d=void 0!==t.useSRGBBuffer&&t.useSRGBBuffer,p=null!==(i=t.samples)&&void 0!==i?i:1,s=t.label):l=!!t,d=this._getUseSRGBBuffer(d,!l),(c!==b.Y.TEXTURETYPE_FLOAT||this._caps.textureFloatLinearFiltering)&&(c!==b.Y.TEXTURETYPE_HALF_FLOAT||this._caps.textureHalfFloatLinearFiltering)||(u=b.Y.TEXTURE_NEAREST_SAMPLINGMODE),c!==b.Y.TEXTURETYPE_FLOAT||this._caps.textureFloat||(c=b.Y.TEXTURETYPE_UNSIGNED_BYTE,y.V.Warn("Float textures are not supported. Type forced to TEXTURETYPE_UNSIGNED_BYTE"));var f=new Qi.h(this,r),m=null!==(o=e.width)&&void 0!==o?o:e,_=null!==(a=e.height)&&void 0!==a?a:e,g=e.layers||0;if(0!==g)throw new Error("Texture layers are not supported in Babylon Native");var v=f._hardwareTexture.underlyingResource,S=xc(h,c);return this._engine.initializeTexture(v,m,_,l,S,!0,d,p),this._setTextureSampling(v,Pc(u)),f._useSRGBBuffer=d,f.baseWidth=m,f.baseHeight=_,f.width=m,f.height=_,f.depth=g,f.isReady=!0,f.samples=p,f.generateMipMaps=l,f.samplingMode=u,f.type=c,f.format=h,f.label=s,this._internalTexturesCache.push(f),f},t.prototype.createRenderTargetTexture=function(e,t){var n,r,i,o,a=this._createHardwareRenderTargetWrapper(!1,!1,e),s=!0,l=!1,c=!1,u=void 0,h=1;void 0!==t&&"object"==typeof t&&(s=null===(n=t.generateDepthBuffer)||void 0===n||n,l=!!t.generateStencilBuffer,c=!!t.noColorAttachment,u=t.colorAttachment,h=null!==(r=t.samples)&&void 0!==r?r:1);var d=u||(c?null:this._createInternalTexture(e,t,!0,5)),p=null!==(i=e.width)&&void 0!==i?i:e,f=null!==(o=e.height)&&void 0!==o?o:e,m=this._engine.createFrameBuffer(d?d._hardwareTexture.underlyingResource:null,p,f,l,s,h);return a._framebuffer=m,a._generateDepthBuffer=s,a._generateStencilBuffer=l,a._samples=h,a.setTextures(d),a},t.prototype.updateRenderTargetTextureSampleCount=function(e,t){return y.V.Warn("Updating render target sample count is not currently supported"),e.samples},t.prototype.updateTextureSamplingMode=function(e,t){if(t._hardwareTexture){var n=Pc(e);this._setTextureSampling(t._hardwareTexture.underlyingResource,n)}t.samplingMode=e},t.prototype.bindFramebuffer=function(e,t,n,r,i){var o=e;if(this._currentRenderTarget&&this.unBindFramebuffer(this._currentRenderTarget),this._currentRenderTarget=e,t)throw new Error("Cuboid frame buffers are not yet supported in NativeEngine.");if(n||r)throw new Error("Required width/height for frame buffers not yet supported in NativeEngine.");o._framebufferDepthStencil?this._bindUnboundFramebuffer(o._framebufferDepthStencil):this._bindUnboundFramebuffer(o._framebuffer)},t.prototype.unBindFramebuffer=function(e,t,n){void 0===t&&(t=!1),this._currentRenderTarget=null,n&&n(),this._bindUnboundFramebuffer(null)},t.prototype.createDynamicVertexBuffer=function(e){return this.createVertexBuffer(e,!0)},t.prototype.updateDynamicIndexBuffer=function(e,t,n){void 0===n&&(n=0);var r=e,i=this._normalizeIndexData(t);r.is32Bits=4===i.BYTES_PER_ELEMENT,this._engine.updateDynamicIndexBuffer(r.nativeIndexBuffer,i.buffer,i.byteOffset,i.byteLength,n)},t.prototype.updateDynamicVertexBuffer=function(e,t,n,r){void 0===n&&(n=0);var i=e,o=t instanceof Array?new Float32Array(t):t instanceof ArrayBuffer?new Uint8Array(t):t,a=new Uint8Array(o.buffer,o.byteOffset,null!=r?r:o.byteLength);this._engine.updateDynamicVertexBuffer(i.nativeVertexBuffer,a.buffer,a.byteOffset,a.byteLength,n)},t.prototype._setTexture=function(e,t,n,r){void 0===n&&(n=!1),void 0===r&&(r=!1);var i,o=this._boundUniforms[e];if(!o)return!1;if(!t)return null!=this._boundTexturesCache[e]&&(this._activeChannel=e,this._boundTexturesCache[e]=null,this._unsetNativeTexture(o)),!1;if(t.video)this._activeChannel=e,t.update();else if(t.delayLoadState===b.Y.DELAYLOADSTATE_NOTLOADED)return t.delayLoad(),!1;return i=r?t.depthStencilTexture:t.isReady()?t.getInternalTexture():t.isCube?this.emptyCubeTexture:t.is3D?this.emptyTexture3D:t.is2DArray?this.emptyTexture2DArray:this.emptyTexture,this._activeChannel=e,!(!i||!i._hardwareTexture||(this._setTextureWrapMode(i._hardwareTexture.underlyingResource,Cc(t.wrapU),Cc(t.wrapV),Cc(t.wrapR)),this._updateAnisotropicLevel(t),this._setNativeTexture(o,i._hardwareTexture.underlyingResource),0))},t.prototype._setTextureSampling=function(e,t){this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETTEXTURESAMPLING),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.encodeCommandArgAsUInt32(t),this._commandBufferEncoder.finishEncodingCommand()},t.prototype._setTextureWrapMode=function(e,t,n,r){this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETTEXTUREWRAPMODE),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.encodeCommandArgAsUInt32(t),this._commandBufferEncoder.encodeCommandArgAsUInt32(n),this._commandBufferEncoder.encodeCommandArgAsUInt32(r),this._commandBufferEncoder.finishEncodingCommand()},t.prototype._setNativeTexture=function(e,t){this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETTEXTURE),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.encodeCommandArgAsNativeData(t),this._commandBufferEncoder.finishEncodingCommand()},t.prototype._unsetNativeTexture=function(e){this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_UNSETTEXTURE),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.finishEncodingCommand()},t.prototype._updateAnisotropicLevel=function(e){var t=e.getInternalTexture(),n=e.anisotropicFilteringLevel;t&&t._hardwareTexture&&t._cachedAnisotropicFilteringLevel!==n&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETTEXTUREANISOTROPICLEVEL),this._commandBufferEncoder.encodeCommandArgAsNativeData(t._hardwareTexture.underlyingResource),this._commandBufferEncoder.encodeCommandArgAsUInt32(n),this._commandBufferEncoder.finishEncodingCommand(),t._cachedAnisotropicFilteringLevel=n)},t.prototype._bindTexture=function(e,t){var n=this._boundUniforms[e];if(n)if(t&&t._hardwareTexture){var r=t._hardwareTexture.underlyingResource;this._setNativeTexture(n,r)}else this._unsetNativeTexture(n)},t.prototype.unbindAllTextures=function(){this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_DISCARDALLTEXTURES),this._commandBufferEncoder.finishEncodingCommand()},t.prototype._deleteBuffer=function(e){e.nativeIndexBuffer&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_DELETEINDEXBUFFER),this._commandBufferEncoder.encodeCommandArgAsNativeData(e.nativeIndexBuffer),this._commandBufferEncoder.finishEncodingCommand(),delete e.nativeIndexBuffer),e.nativeVertexBuffer&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_DELETEVERTEXBUFFER),this._commandBufferEncoder.encodeCommandArgAsNativeData(e.nativeVertexBuffer),this._commandBufferEncoder.finishEncodingCommand(),delete e.nativeVertexBuffer)},t.prototype.createCanvas=function(e,t){if(!_native.Canvas)throw new Error("Native Canvas plugin not available.");var n=new _native.Canvas;return n.width=e,n.height=t,n},t.prototype.createCanvasImage=function(){if(!_native.Canvas)throw new Error("Native Canvas plugin not available.");return new _native.Image},t.prototype.createCanvasPath2D=function(e){if(!_native.Canvas)throw new Error("Native Canvas plugin not available.");return new _native.Path2D(e)},t.prototype.updateTextureData=function(e,t,n,r,i,o,a,s,l){throw void 0===a&&(a=0),void 0===s&&(s=0),void 0===l&&(l=!1),new Error("updateTextureData not implemented.")},t.prototype._uploadCompressedDataToTextureDirectly=function(e,t,n,r,i,o,a){throw void 0===o&&(o=0),void 0===a&&(a=0),new Error("_uploadCompressedDataToTextureDirectly not implemented.")},t.prototype._uploadDataToTextureDirectly=function(e,t,n,r){throw void 0===n&&(n=0),void 0===r&&(r=0),new Error("_uploadDataToTextureDirectly not implemented.")},t.prototype._uploadArrayBufferViewToTexture=function(e,t,n,r){throw void 0===n&&(n=0),void 0===r&&(r=0),new Error("_uploadArrayBufferViewToTexture not implemented.")},t.prototype._uploadImageToTexture=function(e,t,n,r){throw void 0===n&&(n=0),void 0===r&&(r=0),new Error("_uploadArrayBufferViewToTexture not implemented.")},t.prototype.getFontOffset=function(e){return{ascent:0,height:0,descent:0}},t.prototype.flushFramebuffer=function(){},t.prototype._readTexturePixels=function(e,t,n,r,i,o,a,s,l,c){var u,h,d,p;if(void 0!==r&&-1!==r)throw new Error("Reading cubemap faces is not supported, but faceIndex is ".concat(r,"."));return this._engine.readTexture(null===(u=e._hardwareTexture)||void 0===u?void 0:u.underlyingResource,null!=i?i:0,null!=l?l:0,null!=c?c:0,t,n,null!==(h=null==o?void 0:o.buffer)&&void 0!==h?h:null,null!==(d=null==o?void 0:o.byteOffset)&&void 0!==d?d:0,null!==(p=null==o?void 0:o.byteLength)&&void 0!==p?p:0).then((function(e){return o||(o=new Uint8Array(e)),o}))},t.prototype.startTimeQuery=function(){return this._gpuFrameTimeToken||(this._gpuFrameTimeToken=new ic),this._gpuFrameTimeToken},t.prototype.endTimeQuery=function(e){return this._engine.populateFrameStats(this._frameStats),this._frameStats.gpuTimeNs},t.PROTOCOL_VERSION=9,t}(Ai.N);Gc._createNativeDataStream=function(){return _native.NativeDataStream.VALIDATION_ENABLED?new kc:new cc};var kc=function(e){function t(){return e.call(this)||this}return(0,f.C6)(t,e),t.prototype.writeUint32=function(t){e.prototype.writeUint32.call(this,_native.NativeDataStream.VALIDATION_UINT_32),e.prototype.writeUint32.call(this,t)},t.prototype.writeInt32=function(t){e.prototype.writeUint32.call(this,_native.NativeDataStream.VALIDATION_INT_32),e.prototype.writeInt32.call(this,t)},t.prototype.writeFloat32=function(t){e.prototype.writeUint32.call(this,_native.NativeDataStream.VALIDATION_FLOAT_32),e.prototype.writeFloat32.call(this,t)},t.prototype.writeUint32Array=function(t){e.prototype.writeUint32.call(this,_native.NativeDataStream.VALIDATION_UINT_32_ARRAY),e.prototype.writeUint32Array.call(this,t)},t.prototype.writeInt32Array=function(t){e.prototype.writeUint32.call(this,_native.NativeDataStream.VALIDATION_INT_32_ARRAY),e.prototype.writeInt32Array.call(this,t)},t.prototype.writeFloat32Array=function(t){e.prototype.writeUint32.call(this,_native.NativeDataStream.VALIDATION_FLOAT_32_ARRAY),e.prototype.writeFloat32Array.call(this,t)},t.prototype.writeNativeData=function(t){e.prototype.writeUint32.call(this,_native.NativeDataStream.VALIDATION_NATIVE_DATA),e.prototype.writeNativeData.call(this,t)},t.prototype.writeBoolean=function(t){e.prototype.writeUint32.call(this,_native.NativeDataStream.VALIDATION_BOOLEAN),e.prototype.writeBoolean.call(this,t)},t}(cc),zc=function(){function e(){}return e.ComputeNumMipmapLevels=function(e,t){return(0,lr.ILog2)(Math.max(e,t))+1},e.GetTextureTypeFromFormat=function(e){switch(e){case"r8unorm":case"r8uint":case"rg8unorm":case"rg8uint":case"rgba8unorm":case"rgba8unorm-srgb":case"rgba8uint":case"bgra8unorm":case"bgra8unorm-srgb":case"rgb10a2uint":case"rgb10a2unorm":case"rgb9e5ufloat":case"rg11b10ufloat":case"bc7-rgba-unorm":case"bc7-rgba-unorm-srgb":case"bc6h-rgb-ufloat":case"bc5-rg-unorm":case"bc3-rgba-unorm":case"bc3-rgba-unorm-srgb":case"bc2-rgba-unorm":case"bc2-rgba-unorm-srgb":case"bc4-r-unorm":case"bc1-rgba-unorm":case"bc1-rgba-unorm-srgb":case"etc2-rgb8unorm":case"etc2-rgb8unorm-srgb":case"etc2-rgb8a1unorm":case"etc2-rgb8a1unorm-srgb":case"etc2-rgba8unorm":case"etc2-rgba8unorm-srgb":case"eac-r11unorm":case"eac-rg11unorm":case"astc-4x4-unorm":case"astc-4x4-unorm-srgb":case"astc-5x4-unorm":case"astc-5x4-unorm-srgb":case"astc-5x5-unorm":case"astc-5x5-unorm-srgb":case"astc-6x5-unorm":case"astc-6x5-unorm-srgb":case"astc-6x6-unorm":case"astc-6x6-unorm-srgb":case"astc-8x5-unorm":case"astc-8x5-unorm-srgb":case"astc-8x6-unorm":case"astc-8x6-unorm-srgb":case"astc-8x8-unorm":case"astc-8x8-unorm-srgb":case"astc-10x5-unorm":case"astc-10x5-unorm-srgb":case"astc-10x6-unorm":case"astc-10x6-unorm-srgb":case"astc-10x8-unorm":case"astc-10x8-unorm-srgb":case"astc-10x10-unorm":case"astc-10x10-unorm-srgb":case"astc-12x10-unorm":case"astc-12x10-unorm-srgb":case"astc-12x12-unorm":case"astc-12x12-unorm-srgb":case"stencil8":return b.Y.TEXTURETYPE_UNSIGNED_BYTE;case"r8snorm":case"r8sint":case"rg8snorm":case"rg8sint":case"rgba8snorm":case"rgba8sint":case"bc6h-rgb-float":case"bc5-rg-snorm":case"bc4-r-snorm":case"eac-r11snorm":case"eac-rg11snorm":return b.Y.TEXTURETYPE_BYTE;case"r16uint":case"r16unorm":case"rg16unorm":case"rgba16unorm":case"rg16uint":case"rgba16uint":case"depth16unorm":return b.Y.TEXTURETYPE_UNSIGNED_SHORT;case"r16sint":case"r16snorm":case"rg16snorm":case"rgba16snorm":case"rg16sint":case"rgba16sint":return b.Y.TEXTURETYPE_SHORT;case"r16float":case"rg16float":case"rgba16float":return b.Y.TEXTURETYPE_HALF_FLOAT;case"r32uint":case"rg32uint":case"rgba32uint":case"r32sint":case"rg32sint":case"rgba32sint":return b.Y.TEXTURETYPE_UNSIGNED_INTEGER;case"r32float":case"rg32float":case"rgba32float":case"depth32float":case"depth32float-stencil8":case"depth24plus":case"depth24plus-stencil8":return b.Y.TEXTURETYPE_FLOAT}return b.Y.TEXTURETYPE_UNSIGNED_BYTE},e.GetBlockInformationFromFormat=function(e){switch(e){case"r8unorm":case"r8snorm":case"r8uint":case"r8sint":return{width:1,height:1,length:1};case"r16uint":case"r16sint":case"r16unorm":case"r16snorm":case"r16float":case"rg8unorm":case"rg8snorm":case"rg8uint":case"rg8sint":case"depth16unorm":return{width:1,height:1,length:2};case"r32uint":case"r32sint":case"r32float":case"rg16uint":case"rg16sint":case"rg16float":case"rg16unorm":case"rg16snorm":case"rgba8unorm":case"rgba8unorm-srgb":case"rgba8snorm":case"rgba8uint":case"rgba8sint":case"bgra8unorm":case"bgra8unorm-srgb":case"rgb9e5ufloat":case"rgb10a2uint":case"rgb10a2unorm":case"rg11b10ufloat":case"depth32float":return{width:1,height:1,length:4};case"rg32uint":case"rg32sint":case"rg32float":case"rgba16uint":case"rgba16sint":case"rgba16float":case"rgba16unorm":case"rgba16snorm":return{width:1,height:1,length:8};case"rgba32uint":case"rgba32sint":case"rgba32float":return{width:1,height:1,length:16};case"stencil8":throw"No fixed size for Stencil8 format!";case"depth24plus":throw"No fixed size for Depth24Plus format!";case"depth24plus-stencil8":throw"No fixed size for Depth24PlusStencil8 format!";case"depth32float-stencil8":return{width:1,height:1,length:5};case"bc7-rgba-unorm":case"bc7-rgba-unorm-srgb":case"bc6h-rgb-ufloat":case"bc6h-rgb-float":case"bc5-rg-unorm":case"bc5-rg-snorm":case"bc3-rgba-unorm":case"bc3-rgba-unorm-srgb":case"bc2-rgba-unorm":case"bc2-rgba-unorm-srgb":case"etc2-rgba8unorm":case"etc2-rgba8unorm-srgb":case"eac-rg11unorm":case"eac-rg11snorm":case"astc-4x4-unorm":case"astc-4x4-unorm-srgb":return{width:4,height:4,length:16};case"bc4-r-unorm":case"bc4-r-snorm":case"bc1-rgba-unorm":case"bc1-rgba-unorm-srgb":case"etc2-rgb8unorm":case"etc2-rgb8unorm-srgb":case"etc2-rgb8a1unorm":case"etc2-rgb8a1unorm-srgb":case"eac-r11unorm":case"eac-r11snorm":return{width:4,height:4,length:8};case"astc-5x4-unorm":case"astc-5x4-unorm-srgb":return{width:5,height:4,length:16};case"astc-5x5-unorm":case"astc-5x5-unorm-srgb":return{width:5,height:5,length:16};case"astc-6x5-unorm":case"astc-6x5-unorm-srgb":return{width:6,height:5,length:16};case"astc-6x6-unorm":case"astc-6x6-unorm-srgb":return{width:6,height:6,length:16};case"astc-8x5-unorm":case"astc-8x5-unorm-srgb":return{width:8,height:5,length:16};case"astc-8x6-unorm":case"astc-8x6-unorm-srgb":return{width:8,height:6,length:16};case"astc-8x8-unorm":case"astc-8x8-unorm-srgb":return{width:8,height:8,length:16};case"astc-10x5-unorm":case"astc-10x5-unorm-srgb":return{width:10,height:5,length:16};case"astc-10x6-unorm":case"astc-10x6-unorm-srgb":return{width:10,height:6,length:16};case"astc-10x8-unorm":case"astc-10x8-unorm-srgb":return{width:10,height:8,length:16};case"astc-10x10-unorm":case"astc-10x10-unorm-srgb":return{width:10,height:10,length:16};case"astc-12x10-unorm":case"astc-12x10-unorm-srgb":return{width:12,height:10,length:16};case"astc-12x12-unorm":case"astc-12x12-unorm-srgb":return{width:12,height:12,length:16}}return{width:1,height:1,length:4}},e.IsHardwareTexture=function(e){return!!e.release},e.IsInternalTexture=function(e){return!!e.dispose},e.IsImageBitmap=function(e){return void 0!==e.close},e.IsImageBitmapArray=function(e){return Array.isArray(e)&&void 0!==e[0].close},e.IsCompressedFormat=function(e){switch(e){case"bc7-rgba-unorm-srgb":case"bc7-rgba-unorm":case"bc6h-rgb-float":case"bc6h-rgb-ufloat":case"bc5-rg-snorm":case"bc5-rg-unorm":case"bc4-r-snorm":case"bc4-r-unorm":case"bc3-rgba-unorm-srgb":case"bc3-rgba-unorm":case"bc2-rgba-unorm-srgb":case"bc2-rgba-unorm":case"bc1-rgba-unorm-srgb":case"bc1-rgba-unorm":case"etc2-rgb8unorm":case"etc2-rgb8unorm-srgb":case"etc2-rgb8a1unorm":case"etc2-rgb8a1unorm-srgb":case"etc2-rgba8unorm":case"etc2-rgba8unorm-srgb":case"eac-r11unorm":case"eac-r11snorm":case"eac-rg11unorm":case"eac-rg11snorm":case"astc-4x4-unorm":case"astc-4x4-unorm-srgb":case"astc-5x4-unorm":case"astc-5x4-unorm-srgb":case"astc-5x5-unorm":case"astc-5x5-unorm-srgb":case"astc-6x5-unorm":case"astc-6x5-unorm-srgb":case"astc-6x6-unorm":case"astc-6x6-unorm-srgb":case"astc-8x5-unorm":case"astc-8x5-unorm-srgb":case"astc-8x6-unorm":case"astc-8x6-unorm-srgb":case"astc-8x8-unorm":case"astc-8x8-unorm-srgb":case"astc-10x5-unorm":case"astc-10x5-unorm-srgb":case"astc-10x6-unorm":case"astc-10x6-unorm-srgb":case"astc-10x8-unorm":case"astc-10x8-unorm-srgb":case"astc-10x10-unorm":case"astc-10x10-unorm-srgb":case"astc-12x10-unorm":case"astc-12x10-unorm-srgb":case"astc-12x12-unorm":case"astc-12x12-unorm-srgb":return!0}return!1},e.GetWebGPUTextureFormat=function(e,t,n){switch(void 0===n&&(n=!1),t){case b.Y.TEXTUREFORMAT_DEPTH16:return"depth16unorm";case b.Y.TEXTUREFORMAT_DEPTH24:return"depth24plus";case b.Y.TEXTUREFORMAT_DEPTH24_STENCIL8:return"depth24plus-stencil8";case b.Y.TEXTUREFORMAT_DEPTH32_FLOAT:return"depth32float";case b.Y.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8:return"depth32float-stencil8";case b.Y.TEXTUREFORMAT_STENCIL8:return"stencil8";case b.Y.TEXTUREFORMAT_COMPRESSED_RGBA_BPTC_UNORM:return n?"bc7-rgba-unorm-srgb":"bc7-rgba-unorm";case b.Y.TEXTUREFORMAT_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT:return"bc6h-rgb-ufloat";case b.Y.TEXTUREFORMAT_COMPRESSED_RGB_BPTC_SIGNED_FLOAT:return"bc6h-rgb-float";case b.Y.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT5:return n?"bc3-rgba-unorm-srgb":"bc3-rgba-unorm";case b.Y.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT3:return n?"bc2-rgba-unorm-srgb":"bc2-rgba-unorm";case b.Y.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT1:case b.Y.TEXTUREFORMAT_COMPRESSED_RGB_S3TC_DXT1:return n?"bc1-rgba-unorm-srgb":"bc1-rgba-unorm";case b.Y.TEXTUREFORMAT_COMPRESSED_RGBA_ASTC_4x4:return n?"astc-4x4-unorm-srgb":"astc-4x4-unorm";case b.Y.TEXTUREFORMAT_COMPRESSED_RGB_ETC1_WEBGL:case b.Y.TEXTUREFORMAT_COMPRESSED_RGB8_ETC2:return n?"etc2-rgb8unorm-srgb":"etc2-rgb8unorm";case b.Y.TEXTUREFORMAT_COMPRESSED_RGBA8_ETC2_EAC:return n?"etc2-rgba8unorm-srgb":"etc2-rgba8unorm"}switch(e){case b.Y.TEXTURETYPE_BYTE:switch(t){case b.Y.TEXTUREFORMAT_RED:return"r8snorm";case b.Y.TEXTUREFORMAT_RG:return"rg8snorm";case b.Y.TEXTUREFORMAT_RGB:throw"RGB format not supported in WebGPU";case b.Y.TEXTUREFORMAT_RED_INTEGER:return"r8sint";case b.Y.TEXTUREFORMAT_RG_INTEGER:return"rg8sint";case b.Y.TEXTUREFORMAT_RGB_INTEGER:throw"RGB_INTEGER format not supported in WebGPU";case b.Y.TEXTUREFORMAT_RGBA_INTEGER:return"rgba8sint";default:return"rgba8snorm"}case b.Y.TEXTURETYPE_UNSIGNED_BYTE:switch(t){case b.Y.TEXTUREFORMAT_RED:return"r8unorm";case b.Y.TEXTUREFORMAT_RG:return"rg8unorm";case b.Y.TEXTUREFORMAT_RGB:throw"TEXTUREFORMAT_RGB format not supported in WebGPU";case b.Y.TEXTUREFORMAT_RGBA:return n?"rgba8unorm-srgb":"rgba8unorm";case b.Y.TEXTUREFORMAT_BGRA:return n?"bgra8unorm-srgb":"bgra8unorm";case b.Y.TEXTUREFORMAT_RED_INTEGER:return"r8uint";case b.Y.TEXTUREFORMAT_RG_INTEGER:return"rg8uint";case b.Y.TEXTUREFORMAT_RGB_INTEGER:throw"RGB_INTEGER format not supported in WebGPU";case b.Y.TEXTUREFORMAT_RGBA_INTEGER:return"rgba8uint";case b.Y.TEXTUREFORMAT_ALPHA:throw"TEXTUREFORMAT_ALPHA format not supported in WebGPU";case b.Y.TEXTUREFORMAT_LUMINANCE:throw"TEXTUREFORMAT_LUMINANCE format not supported in WebGPU";case b.Y.TEXTUREFORMAT_LUMINANCE_ALPHA:throw"TEXTUREFORMAT_LUMINANCE_ALPHA format not supported in WebGPU";default:return"rgba8unorm"}case b.Y.TEXTURETYPE_SHORT:switch(t){case b.Y.TEXTUREFORMAT_RED_INTEGER:return"r16sint";case b.Y.TEXTUREFORMAT_RG_INTEGER:return"rg16sint";case b.Y.TEXTUREFORMAT_RGB_INTEGER:throw"TEXTUREFORMAT_RGB_INTEGER format not supported in WebGPU";case b.Y.TEXTUREFORMAT_RGBA_INTEGER:default:return"rgba16sint"}case b.Y.TEXTURETYPE_UNSIGNED_SHORT:switch(t){case b.Y.TEXTUREFORMAT_RED_INTEGER:return"r16uint";case b.Y.TEXTUREFORMAT_RG_INTEGER:return"rg16uint";case b.Y.TEXTUREFORMAT_RGB_INTEGER:throw"TEXTUREFORMAT_RGB_INTEGER format not supported in WebGPU";case b.Y.TEXTUREFORMAT_RGBA_INTEGER:default:return"rgba16uint"}case b.Y.TEXTURETYPE_INT:switch(t){case b.Y.TEXTUREFORMAT_RED_INTEGER:return"r32sint";case b.Y.TEXTUREFORMAT_RG_INTEGER:return"rg32sint";case b.Y.TEXTUREFORMAT_RGB_INTEGER:throw"TEXTUREFORMAT_RGB_INTEGER format not supported in WebGPU";case b.Y.TEXTUREFORMAT_RGBA_INTEGER:default:return"rgba32sint"}case b.Y.TEXTURETYPE_UNSIGNED_INTEGER:switch(t){case b.Y.TEXTUREFORMAT_RED_INTEGER:return"r32uint";case b.Y.TEXTUREFORMAT_RG_INTEGER:return"rg32uint";case b.Y.TEXTUREFORMAT_RGB_INTEGER:throw"TEXTUREFORMAT_RGB_INTEGER format not supported in WebGPU";case b.Y.TEXTUREFORMAT_RGBA_INTEGER:default:return"rgba32uint"}case b.Y.TEXTURETYPE_FLOAT:switch(t){case b.Y.TEXTUREFORMAT_RED:return"r32float";case b.Y.TEXTUREFORMAT_RG:return"rg32float";case b.Y.TEXTUREFORMAT_RGB:throw"TEXTUREFORMAT_RGB format not supported in WebGPU";case b.Y.TEXTUREFORMAT_RGBA:default:return"rgba32float"}case b.Y.TEXTURETYPE_HALF_FLOAT:switch(t){case b.Y.TEXTUREFORMAT_RED:return"r16float";case b.Y.TEXTUREFORMAT_RG:return"rg16float";case b.Y.TEXTUREFORMAT_RGB:throw"TEXTUREFORMAT_RGB format not supported in WebGPU";case b.Y.TEXTUREFORMAT_RGBA:default:return"rgba16float"}case b.Y.TEXTURETYPE_UNSIGNED_SHORT_5_6_5:throw"TEXTURETYPE_UNSIGNED_SHORT_5_6_5 format not supported in WebGPU";case b.Y.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV:switch(t){case b.Y.TEXTUREFORMAT_RGBA:return"rg11b10ufloat";case b.Y.TEXTUREFORMAT_RGBA_INTEGER:throw"TEXTUREFORMAT_RGBA_INTEGER format not supported in WebGPU when type is TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV";default:return"rg11b10ufloat"}case b.Y.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV:switch(t){case b.Y.TEXTUREFORMAT_RGBA:return"rgb9e5ufloat";case b.Y.TEXTUREFORMAT_RGBA_INTEGER:throw"TEXTUREFORMAT_RGBA_INTEGER format not supported in WebGPU when type is TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV";default:return"rgb9e5ufloat"}case b.Y.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4:throw"TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4 format not supported in WebGPU";case b.Y.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1:throw"TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1 format not supported in WebGPU";case b.Y.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV:switch(t){case b.Y.TEXTUREFORMAT_RGBA:return"rgb10a2unorm";case b.Y.TEXTUREFORMAT_RGBA_INTEGER:return"rgb10a2uint";default:return"rgb10a2unorm"}}return n?"rgba8unorm-srgb":"rgba8unorm"},e.GetNumChannelsFromWebGPUTextureFormat=function(e){switch(e){case"r8unorm":case"r8snorm":case"r8uint":case"r8sint":case"bc4-r-unorm":case"bc4-r-snorm":case"r16uint":case"r16sint":case"depth16unorm":case"r16float":case"r16unorm":case"r16snorm":case"r32uint":case"r32sint":case"r32float":case"depth32float":case"stencil8":case"depth24plus":case"eac-r11unorm":case"eac-r11snorm":return 1;case"rg8unorm":case"rg8snorm":case"rg8uint":case"rg8sint":case"depth32float-stencil8":case"bc5-rg-unorm":case"bc5-rg-snorm":case"rg16uint":case"rg16sint":case"rg16float":case"rg16unorm":case"rg16snorm":case"rg32uint":case"rg32sint":case"rg32float":case"depth24plus-stencil8":case"eac-rg11unorm":case"eac-rg11snorm":return 2;case"rgb9e5ufloat":case"rg11b10ufloat":case"bc6h-rgb-ufloat":case"bc6h-rgb-float":case"etc2-rgb8unorm":case"etc2-rgb8unorm-srgb":return 3;case"rgba8unorm":case"rgba8unorm-srgb":case"rgba8snorm":case"rgba8uint":case"rgba8sint":case"bgra8unorm":case"bgra8unorm-srgb":case"rgba16unorm":case"rgba16snorm":case"rgb10a2uint":case"rgb10a2unorm":case"bc7-rgba-unorm":case"bc7-rgba-unorm-srgb":case"bc3-rgba-unorm":case"bc3-rgba-unorm-srgb":case"bc2-rgba-unorm":case"bc2-rgba-unorm-srgb":case"bc1-rgba-unorm":case"bc1-rgba-unorm-srgb":case"rgba16uint":case"rgba16sint":case"rgba16float":case"rgba32uint":case"rgba32sint":case"rgba32float":case"etc2-rgb8a1unorm":case"etc2-rgb8a1unorm-srgb":case"etc2-rgba8unorm":case"etc2-rgba8unorm-srgb":case"astc-4x4-unorm":case"astc-4x4-unorm-srgb":case"astc-5x4-unorm":case"astc-5x4-unorm-srgb":case"astc-5x5-unorm":case"astc-5x5-unorm-srgb":case"astc-6x5-unorm":case"astc-6x5-unorm-srgb":case"astc-6x6-unorm":case"astc-6x6-unorm-srgb":case"astc-8x5-unorm":case"astc-8x5-unorm-srgb":case"astc-8x6-unorm":case"astc-8x6-unorm-srgb":case"astc-8x8-unorm":case"astc-8x8-unorm-srgb":case"astc-10x5-unorm":case"astc-10x5-unorm-srgb":case"astc-10x6-unorm":case"astc-10x6-unorm-srgb":case"astc-10x8-unorm":case"astc-10x8-unorm-srgb":case"astc-10x10-unorm":case"astc-10x10-unorm-srgb":case"astc-12x10-unorm":case"astc-12x10-unorm-srgb":case"astc-12x12-unorm":case"astc-12x12-unorm-srgb":return 4}throw"Unknown format ".concat(e,"!")},e.HasStencilAspect=function(e){switch(e){case"stencil8":case"depth32float-stencil8":case"depth24plus-stencil8":return!0}return!1},e.HasDepthAndStencilAspects=function(e){switch(e){case"depth32float-stencil8":case"depth24plus-stencil8":return!0}return!1},e.GetDepthFormatOnly=function(e){switch(e){case"depth16unorm":return"depth16unorm";case"depth24plus":case"depth24plus-stencil8":return"depth24plus";case"depth32float":case"depth32float-stencil8":return"depth32float"}return e},e.GetSample=function(e){return e>1?4:1},e}(),Wc=n(37411),Hc=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.dbgShowShaderCode=!1,t.dbgSanityChecks=!0,t.dbgVerboseLogsNumFrames=10,t.dbgLogIfNotDrawWrapper=!0,t.dbgShowEmptyEnableEffectCalls=!0,t.dbgVerboseLogsForFirstFrames=!1,t._currentRenderPass=null,t._snapshotRenderingMode=b.Y.SNAPSHOTRENDERING_STANDARD,t._timestampIndex=0,t._debugStackRenderPass=[],t}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"enableGPUTimingMeasurements",{get:function(){return this._timestampQuery.enable},set:function(e){this._timestampQuery.enable!==e&&(this.gpuTimeInFrameForMainPass=e?new Wc.e:void 0,this._timestampQuery.enable=e)},enumerable:!1,configurable:!0}),t.prototype._currentPassIsMainPass=function(){return null===this._currentRenderTarget},t.prototype._endCurrentRenderPass=function(){var e,t,n;if(!this._currentRenderPass)return 0;if(0!==this._debugStackRenderPass.length)for(var r=0;r=0&&(_.push(a[c]),g.push(v))}this.shaderProcessingContext.attributeNamesFromEffect=_,this.shaderProcessingContext.attributeLocationsFromEffect=g},e.prototype.buildUniformLayout=function(){var e;if(this.shaderProcessingContext.leftOverUniforms.length){null===(e=this.uniformBuffer)||void 0===e||e.dispose(),this.uniformBuffer=new Pe.D(this.engine,void 0,void 0,"leftOver-"+this._name);for(var t=0,n=this.shaderProcessingContext.leftOverUniforms;t)?$/,"$1"),o=Lu.UniformSizes[i];this.uniformBuffer.addUniform(r.name,o,r.length),this._leftOverUniformsByName[r.name]=r.type}this.uniformBuffer.create()}},e.prototype.setEngine=function(e){this.engine=e},e.prototype.dispose=function(){this.uniformBuffer&&this.uniformBuffer.dispose()},e.prototype.setInt=function(e,t){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateInt(e,t)},e.prototype.setInt2=function(e,t,n){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateInt2(e,t,n)},e.prototype.setInt3=function(e,t,n,r){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateInt3(e,t,n,r)},e.prototype.setInt4=function(e,t,n,r,i){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateInt4(e,t,n,r,i)},e.prototype.setIntArray=function(e,t){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateIntArray(e,t)},e.prototype.setIntArray2=function(e,t){this.setIntArray(e,t)},e.prototype.setIntArray3=function(e,t){this.setIntArray(e,t)},e.prototype.setIntArray4=function(e,t){this.setIntArray(e,t)},e.prototype.setUInt=function(e,t){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateUInt(e,t)},e.prototype.setUInt2=function(e,t,n){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateUInt2(e,t,n)},e.prototype.setUInt3=function(e,t,n,r){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateUInt3(e,t,n,r)},e.prototype.setUInt4=function(e,t,n,r,i){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateUInt4(e,t,n,r,i)},e.prototype.setUIntArray=function(e,t){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateUIntArray(e,t)},e.prototype.setUIntArray2=function(e,t){this.setUIntArray(e,t)},e.prototype.setUIntArray3=function(e,t){this.setUIntArray(e,t)},e.prototype.setUIntArray4=function(e,t){this.setUIntArray(e,t)},e.prototype.setArray=function(e,t){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateArray(e,t)},e.prototype.setArray2=function(e,t){this.setArray(e,t)},e.prototype.setArray3=function(e,t){this.setArray(e,t)},e.prototype.setArray4=function(e,t){this.setArray(e,t)},e.prototype.setMatrices=function(e,t){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateMatrices(e,t)},e.prototype.setMatrix=function(e,t){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateMatrix(e,t)},e.prototype.setMatrix3x3=function(e,t){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateMatrix3x3(e,t)},e.prototype.setMatrix2x2=function(e,t){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateMatrix2x2(e,t)},e.prototype.setFloat=function(e,t){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateFloat(e,t)},e.prototype.setVector2=function(e,t){this.setFloat2(e,t.x,t.y)},e.prototype.setFloat2=function(e,t,n){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateFloat2(e,t,n)},e.prototype.setVector3=function(e,t){this.setFloat3(e,t.x,t.y,t.z)},e.prototype.setFloat3=function(e,t,n,r){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateFloat3(e,t,n,r)},e.prototype.setVector4=function(e,t){this.setFloat4(e,t.x,t.y,t.z,t.w)},e.prototype.setQuaternion=function(e,t){this.setFloat4(e,t.x,t.y,t.z,t.w)},e.prototype.setFloat4=function(e,t,n,r,i){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateFloat4(e,t,n,r,i)},e.prototype.setColor3=function(e,t){this.setFloat3(e,t.r,t.g,t.b)},e.prototype.setColor4=function(e,t,n){this.setFloat4(e,t.r,t.g,t.b,n)},e.prototype.setDirectColor4=function(e,t){this.setFloat4(e,t.r,t.g,t.b,t.a)},e.prototype._getVertexShaderCode=function(){var e;return null===(e=this.sources)||void 0===e?void 0:e.vertex},e.prototype._getFragmentShaderCode=function(){var e;return null===(e=this.sources)||void 0===e?void 0:e.fragment},e}(),Bu={mat2:2,mat3:3,mat4:4,mat2x2:2,mat3x3:3,mat4x4:4},Vu=function(){function e(e,t){void 0===t&&(t=!1),this.vertexBufferKindToNumberOfComponents={},this.shaderLanguage=e,this._attributeNextLocation=0,this._varyingNextLocation=0,this.freeGroupIndex=0,this.freeBindingIndex=0,this.availableVaryings={},this.availableAttributes={},this.availableBuffers={},this.availableTextures={},this.availableSamplers={},this.orderedAttributes=[],this.bindGroupLayoutEntries=[],this.bindGroupLayoutEntryInfo=[],this.bindGroupEntries=[],this.bufferNames=[],this.textureNames=[],this.samplerNames=[],this.leftOverUniforms=[],t||this._findStartingGroupBinding()}return Object.defineProperty(e,"KnownUBOs",{get:function(){return e._SimplifiedKnownBindings?e._SimplifiedKnownUBOs:e._KnownUBOs},enumerable:!1,configurable:!0}),e.prototype._findStartingGroupBinding=function(){var t=e.KnownUBOs,n=[];for(var r in t){var i=t[r].binding;-1!==i.groupIndex&&(void 0===n[i.groupIndex]?n[i.groupIndex]=i.bindingIndex:n[i.groupIndex]=Math.max(n[i.groupIndex],i.bindingIndex))}this.freeGroupIndex=n.length-1,0===this.freeGroupIndex?(this.freeGroupIndex++,this.freeBindingIndex=0):this.freeBindingIndex=n[n.length-1]+1},e.prototype.getAttributeNextLocation=function(e,t){var n;void 0===t&&(t=0);var r=this._attributeNextLocation;return this._attributeNextLocation+=(null!==(n=Bu[e])&&void 0!==n?n:1)*(t||1),r},e.prototype.getVaryingNextLocation=function(e,t){var n;void 0===t&&(t=0);var r=this._varyingNextLocation;return this._varyingNextLocation+=(null!==(n=Bu[e])&&void 0!==n?n:1)*(t||1),r},e.prototype.getNextFreeUBOBinding=function(){return this._getNextFreeBinding(1)},e.prototype._getNextFreeBinding=function(e){if(this.freeBindingIndex>65536-e&&(this.freeGroupIndex++,this.freeBindingIndex=0),4===this.freeGroupIndex)throw"Too many textures or UBOs have been declared and it is not supported in WebGPU.";var t={groupIndex:this.freeGroupIndex,bindingIndex:this.freeBindingIndex};return this.freeBindingIndex+=e,t},e._SimplifiedKnownBindings=!0,e._SimplifiedKnownUBOs={Scene:{binding:{groupIndex:0,bindingIndex:0}},Light0:{binding:{groupIndex:-1,bindingIndex:-1}},Light1:{binding:{groupIndex:-1,bindingIndex:-1}},Light2:{binding:{groupIndex:-1,bindingIndex:-1}},Light3:{binding:{groupIndex:-1,bindingIndex:-1}},Light4:{binding:{groupIndex:-1,bindingIndex:-1}},Light5:{binding:{groupIndex:-1,bindingIndex:-1}},Light6:{binding:{groupIndex:-1,bindingIndex:-1}},Light7:{binding:{groupIndex:-1,bindingIndex:-1}},Light8:{binding:{groupIndex:-1,bindingIndex:-1}},Light9:{binding:{groupIndex:-1,bindingIndex:-1}},Light10:{binding:{groupIndex:-1,bindingIndex:-1}},Light11:{binding:{groupIndex:-1,bindingIndex:-1}},Light12:{binding:{groupIndex:-1,bindingIndex:-1}},Light13:{binding:{groupIndex:-1,bindingIndex:-1}},Light14:{binding:{groupIndex:-1,bindingIndex:-1}},Light15:{binding:{groupIndex:-1,bindingIndex:-1}},Light16:{binding:{groupIndex:-1,bindingIndex:-1}},Light17:{binding:{groupIndex:-1,bindingIndex:-1}},Light18:{binding:{groupIndex:-1,bindingIndex:-1}},Light19:{binding:{groupIndex:-1,bindingIndex:-1}},Light20:{binding:{groupIndex:-1,bindingIndex:-1}},Light21:{binding:{groupIndex:-1,bindingIndex:-1}},Light22:{binding:{groupIndex:-1,bindingIndex:-1}},Light23:{binding:{groupIndex:-1,bindingIndex:-1}},Light24:{binding:{groupIndex:-1,bindingIndex:-1}},Light25:{binding:{groupIndex:-1,bindingIndex:-1}},Light26:{binding:{groupIndex:-1,bindingIndex:-1}},Light27:{binding:{groupIndex:-1,bindingIndex:-1}},Light28:{binding:{groupIndex:-1,bindingIndex:-1}},Light29:{binding:{groupIndex:-1,bindingIndex:-1}},Light30:{binding:{groupIndex:-1,bindingIndex:-1}},Light31:{binding:{groupIndex:-1,bindingIndex:-1}},Material:{binding:{groupIndex:-1,bindingIndex:-1}},Mesh:{binding:{groupIndex:-1,bindingIndex:-1}},Internals:{binding:{groupIndex:-1,bindingIndex:-1}}},e._KnownUBOs={Scene:{binding:{groupIndex:0,bindingIndex:0}},Light0:{binding:{groupIndex:1,bindingIndex:0}},Light1:{binding:{groupIndex:1,bindingIndex:1}},Light2:{binding:{groupIndex:1,bindingIndex:2}},Light3:{binding:{groupIndex:1,bindingIndex:3}},Light4:{binding:{groupIndex:1,bindingIndex:4}},Light5:{binding:{groupIndex:1,bindingIndex:5}},Light6:{binding:{groupIndex:1,bindingIndex:6}},Light7:{binding:{groupIndex:1,bindingIndex:7}},Light8:{binding:{groupIndex:1,bindingIndex:8}},Light9:{binding:{groupIndex:1,bindingIndex:9}},Light10:{binding:{groupIndex:1,bindingIndex:10}},Light11:{binding:{groupIndex:1,bindingIndex:11}},Light12:{binding:{groupIndex:1,bindingIndex:12}},Light13:{binding:{groupIndex:1,bindingIndex:13}},Light14:{binding:{groupIndex:1,bindingIndex:14}},Light15:{binding:{groupIndex:1,bindingIndex:15}},Light16:{binding:{groupIndex:1,bindingIndex:16}},Light17:{binding:{groupIndex:1,bindingIndex:17}},Light18:{binding:{groupIndex:1,bindingIndex:18}},Light19:{binding:{groupIndex:1,bindingIndex:19}},Light20:{binding:{groupIndex:1,bindingIndex:20}},Light21:{binding:{groupIndex:1,bindingIndex:21}},Light22:{binding:{groupIndex:1,bindingIndex:22}},Light23:{binding:{groupIndex:1,bindingIndex:23}},Light24:{binding:{groupIndex:1,bindingIndex:24}},Light25:{binding:{groupIndex:1,bindingIndex:25}},Light26:{binding:{groupIndex:1,bindingIndex:26}},Light27:{binding:{groupIndex:1,bindingIndex:27}},Light28:{binding:{groupIndex:1,bindingIndex:28}},Light29:{binding:{groupIndex:1,bindingIndex:29}},Light30:{binding:{groupIndex:1,bindingIndex:30}},Light31:{binding:{groupIndex:1,bindingIndex:31}},Material:{binding:{groupIndex:2,bindingIndex:0}},Mesh:{binding:{groupIndex:2,bindingIndex:1}},Internals:{binding:{groupIndex:2,bindingIndex:2}}},e}(),Uu=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._missingVaryings=[],t._textureArrayProcessing=[],t._vertexIsGLES3=!1,t._fragmentIsGLES3=!1,t.shaderLanguage=0,t.parseGLES3=!0,t}return(0,f.C6)(t,e),t.prototype._getArraySize=function(e,t,n){var r=0,i=e.indexOf("["),o=e.indexOf("]");if(i>0&&o>0){var a=e.substring(i+1,o);r=+a,isNaN(r)&&(r=+n[a.trim()]),e=e.substring(0,i)}return[e,t,r]},t.prototype.initializeShaders=function(e){this._webgpuProcessingContext=e,this._missingVaryings.length=0,this._textureArrayProcessing.length=0,this.attributeKeywordName=void 0,this.varyingVertexKeywordName=void 0,this.varyingFragmentKeywordName=void 0},t.prototype.preProcessShaderCode=function(e,t){var n="// Internals UBO\nuniform ".concat(Lu.InternalsUBOName," {\nfloat yFactor_;\nfloat textureOutputHeight_;\n};\n"),r=-1!==e.indexOf("// Internals UBO");return t?(this._fragmentIsGLES3=-1!==e.indexOf("#version 3"),this._fragmentIsGLES3&&(this.varyingFragmentKeywordName="in"),r?e:n+"##INJECTCODE##\n"+e):(this._vertexIsGLES3=-1!==e.indexOf("#version 3"),this._vertexIsGLES3&&(this.attributeKeywordName="in",this.varyingVertexKeywordName="out"),r?e:n+e)},t.prototype.varyingCheck=function(e,t){return(t&&this._fragmentIsGLES3?/(flat\s)?\s*\bin\b/:!t&&this._vertexIsGLES3?/(flat\s)?\s*\bout\b/:/(flat\s)?\s*\bvarying\b/).test(e)},t.prototype.varyingProcessor=function(e,t,n){var r;this._preProcessors=n;var i=(t&&this._fragmentIsGLES3?/\s*(flat)?\s*in\s+(?:(?:highp)?|(?:lowp)?)\s*(\S+)\s+(\S+)\s*;/gm:!t&&this._vertexIsGLES3?/\s*(flat)?\s*out\s+(?:(?:highp)?|(?:lowp)?)\s*(\S+)\s+(\S+)\s*;/gm:/\s*(flat)?\s*varying\s+(?:(?:highp)?|(?:lowp)?)\s*(\S+)\s+(\S+)\s*;/gm).exec(e);if(null!==i){var o,a=null!==(r=i[1])&&void 0!==r?r:"",s=i[2],l=i[3];t?(o=this._webgpuProcessingContext.availableVaryings[l],this._missingVaryings[o]="",void 0===o&&y.V.Warn('Invalid fragment shader: The varying named "'.concat(l,'" is not declared in the vertex shader! This declaration will be ignored.'))):(o=this._webgpuProcessingContext.getVaryingNextLocation(s,this._getArraySize(l,s,n)[2]),this._webgpuProcessingContext.availableVaryings[l]=o,this._missingVaryings[o]="layout(location = ".concat(o,") ").concat(a," in ").concat(s," ").concat(l,";")),e=e.replace(i[0],void 0===o?"":"layout(location = ".concat(o,") ").concat(a," ").concat(t?"in":"out"," ").concat(s," ").concat(l,";"))}return e},t.prototype.attributeProcessor=function(e,t){this._preProcessors=t;var n=(this._vertexIsGLES3?/\s*in\s+(\S+)\s+(\S+)\s*;/gm:/\s*attribute\s+(\S+)\s+(\S+)\s*;/gm).exec(e);if(null!==n){var r=n[1],i=n[2],o=this._webgpuProcessingContext.getAttributeNextLocation(r,this._getArraySize(i,r,t)[2]);this._webgpuProcessingContext.availableAttributes[i]=o,this._webgpuProcessingContext.orderedAttributes[o]=i;var a=this._webgpuProcessingContext.vertexBufferKindToNumberOfComponents[i];if(void 0!==a){var s=a<0?-1===a?"int":"ivec"+-a:1===a?"uint":"uvec"+a,l="_int_".concat(i,"_");e=e.replace(n[0],"layout(location = ".concat(o,") in ").concat(s," ").concat(l,"; ").concat(r," ").concat(i," = ").concat(r,"(").concat(l,");"))}else e=e.replace(n[0],"layout(location = ".concat(o,") in ").concat(r," ").concat(i,";"))}return e},t.prototype.uniformProcessor=function(e,t,n){var r,i;this._preProcessors=n;var o=/\s*uniform\s+(?:(?:highp)?|(?:lowp)?)\s*(\S+)\s+(\S+)\s*;/gm.exec(e);if(null!==o){var a=o[1],s=o[2];if(0===a.indexOf("sampler")||1===a.indexOf("sampler")){var l=0;s=(r=this._getArraySize(s,a,n))[0],a=r[1],l=r[2];var c=this._webgpuProcessingContext.availableTextures[s];if(!c){c={autoBindSampler:!0,isTextureArray:l>0,isStorageTexture:!1,textures:[],sampleType:"float"};for(var u=0;u<(l||1);++u)c.textures.push(this._webgpuProcessingContext.getNextFreeUBOBinding())}var h=null!==(i=Lu._SamplerTypeByWebGLSamplerType[a])&&void 0!==i?i:"sampler",d=!!Lu._IsComparisonSamplerByWebGPUSamplerType[h],p=d?"comparison":"filtering",f=s+b.Y.AUTOSAMPLERSUFFIX,m=this._webgpuProcessingContext.availableSamplers[f];m||(m={binding:this._webgpuProcessingContext.getNextFreeUBOBinding(),type:p});var _="u"===a.charAt(0)?"u":"i"===a.charAt(0)?"i":"";_&&(a=a.substring(1));var g=d?"depth":"u"===_?"uint":"i"===_?"sint":"float";c.sampleType=g;var v=l>0,y=m.binding.groupIndex,S=m.binding.bindingIndex,T=Lu._SamplerFunctionByWebGLSamplerType[a],E=Lu._TextureTypeByWebGLSamplerType[a],x=Lu._GpuTextureViewDimensionByWebGPUTextureType[E];if(v){var P=[];for(P.push("layout(set = ".concat(y,", binding = ").concat(S,") uniform ").concat(_).concat(h," ").concat(f,";")),e="\n",u=0;u0?"\n":"","#define ").concat(s).concat(u," ").concat(_).concat(T,"(").concat(s,"Texture").concat(u,", ").concat(f,")")}e=P.join("\n")+e,this._textureArrayProcessing.push(s)}else l=1,e="layout(set = ".concat(y,", binding = ").concat(S,") uniform ").concat(h," ").concat(f,";\n layout(set = ").concat(c.textures[0].groupIndex,", binding = ").concat(c.textures[0].bindingIndex,") uniform ").concat(_).concat(E," ").concat(s,"Texture;\n #define ").concat(s," ").concat(_).concat(T,"(").concat(s,"Texture, ").concat(f,")");for(this._webgpuProcessingContext.availableTextures[s]=c,this._webgpuProcessingContext.availableSamplers[f]=m,this._addSamplerBindingDescription(f,m,!t),u=0;u=0,l=s?"vec4 glFragCoord_;\n":"",c=-1!==e.search(/layout *\(location *= *0\) *out/g);if(e=(e=(e=(e=(e=(e=(e=e.replace(/texture2DLodEXT\s*\(/g,"textureLod(")).replace(/textureCubeLodEXT\s*\(/g,"textureLod(")).replace(/textureCube\s*\(/g,"texture(")).replace(/gl_FragDepthEXT/g,"gl_FragDepth")).replace(/gl_FragColor/g,"glFragColor")).replace(/gl_FragData/g,"glFragData")).replace(/gl_FragCoord/g,"glFragCoord_"),this._fragmentIsGLES3){var u=/^\s*out\s+\S+\s+\S+\s*;/gm.exec(e);null!==u&&(e=e.substring(0,u.index)+"layout(location = 0) "+e.substring(u.index))}else e=e.replace(/void\s+?main\s*\(/g,(a||c?"":"layout(location = 0) out vec4 glFragColor;\n")+"void main(");e=(e=e.replace(/dFdy/g,"(-yFactor_)*dFdy")).replace("##INJECTCODE##",l),s&&(e=_c(e,"void main","\n glFragCoord_ = gl_FragCoord;\n if (yFactor_ == 1.) {\n glFragCoord_.y = textureOutputHeight_ - glFragCoord_.y;\n }\n "))}else if("VERTEXOUTPUT_INVARIANT"in o&&(e="invariant gl_Position;\n"+e),e=(e=e.replace(/gl_InstanceID/g,"gl_InstanceIndex")).replace(/gl_VertexID/g,"gl_VertexIndex"),-1!==t.indexOf("#define MULTIVIEW"))return"#extension GL_OVR_multiview2 : require\nlayout (num_views = 2) in;\n"+e;if(!n){var h=e.lastIndexOf("}");e=e.substring(0,h),e+="gl_Position.y *= yFactor_;\n",e+="}"}return e},t.prototype._applyTextureArrayProcessing=function(e,t){for(var n=new RegExp(t+"\\s*\\[(.+)?\\]","gm"),r=n.exec(e);null!==r;){var i=r[1],o=+i;this._preProcessors&&isNaN(o)&&(o=+this._preProcessors[i.trim()]),e=e.replace(r[0],t+o),r=n.exec(e)}return e},t.prototype._generateLeftOverUBOCode=function(e,t){for(var n="layout(set = ".concat(t.binding.groupIndex,", binding = ").concat(t.binding.bindingIndex,") uniform ").concat(e," {\n "),r=0,i=this._webgpuProcessingContext.leftOverUniforms;r0?n+=" ".concat(o.type," ").concat(o.name,"[").concat(o.length,"];\n"):n+=" ".concat(o.type," ").concat(o.name,";\n")}return n+"};\n\n"},t.prototype.finalizeShaders=function(e,t){for(var n=0;n0&&(t=i+"\n"+t)}var o=this._buildLeftOverUBO();return e=o+e,t=o+t,this._collectBindingNames(),this._preCreateBindGroupEntries(),this._preProcessors=null,this._webgpuProcessingContext.vertexBufferKindToNumberOfComponents={},{vertexCode:e,fragmentCode:t}},t}(Lu),Gu=(n(27279),n(86615),n(63866),n(21310),n(17393)),ku=(n(92331),n(40647),n(36644),n(65969),"fragmentOutputs.fragDepth"),zu={texture_1d:"1d",texture_2d:"2d",texture_2d_array:"2d-array",texture_3d:"3d",texture_cube:"cube",texture_cube_array:"cube-array",texture_multisampled_2d:"2d",texture_depth_2d:"2d",texture_depth_2d_array:"2d-array",texture_depth_cube:"cube",texture_depth_cube_array:"cube-array",texture_depth_multisampled_2d:"2d",texture_storage_1d:"1d",texture_storage_2d:"2d",texture_storage_2d_array:"2d-array",texture_storage_3d:"3d",texture_external:null},Wu=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.shaderLanguage=1,t.uniformRegexp=/uniform\s+(\w+)\s*:\s*(.+)\s*;/,t.textureRegexp=/var\s+(\w+)\s*:\s*((array<\s*)?(texture_\w+)\s*(<\s*(.+)\s*>)?\s*(,\s*\w+\s*>\s*)?);/,t.noPrecision=!0,t.pureMode=!1,t}return(0,f.C6)(t,e),t.prototype._getArraySize=function(e,t,n){var r=0,i=t.lastIndexOf(">");if(t.indexOf("array")>=0&&i>0){for(var o=i;o>0&&" "!==t.charAt(o)&&","!==t.charAt(o);)o--;var a=t.substring(o+1,i);for(r=+a,isNaN(r)&&(r=+n[a.trim()]);o>0&&(" "===t.charAt(o)||","===t.charAt(o));)o--;t=t.substring(t.indexOf("<")+1,o+1)}return[e,t,r]},t.prototype.initializeShaders=function(e){this._webgpuProcessingContext=e,this._attributesInputWGSL=[],this._attributesWGSL=[],this._attributesConversionCodeWGSL=[],this._hasNonFloatAttribute=!1,this._varyingsWGSL=[],this._varyingNamesWGSL=[],this._stridedUniformArrays=[]},t.prototype.preProcessShaderCode=function(e){var t=this.pureMode?"":"struct ".concat(Lu.InternalsUBOName," {\n yFactor_: f32,\n textureOutputHeight_: f32,\n};\nvar ").concat("internals"," : ").concat(Lu.InternalsUBOName,";\n");return-1!==e.indexOf(t)?e:t+fc(e)},t.prototype.varyingCheck=function(e){return/(flat|linear|perspective)?\s*(center|centroid|sample)?\s*\bvarying\b/.test(e)},t.prototype.varyingProcessor=function(e,t,n){var r,i,o=/\s*(flat|linear|perspective)?\s*(center|centroid|sample)?\s*varying\s+(?:(?:highp)?|(?:lowp)?)\s*(\S+)\s*:\s*(.+)\s*;/gm.exec(e);if(null!==o){var a,s=null!==(r=o[1])&&void 0!==r?r:"perspective",l=null!==(i=o[2])&&void 0!==i?i:"center",c=o[4],u=o[3],h="flat"===s?"@interpolate(".concat(s,")"):"@interpolate(".concat(s,", ").concat(l,")");t?void 0===(a=this._webgpuProcessingContext.availableVaryings[u])&&y.V.Warn('Invalid fragment shader: The varying named "'.concat(u,'" is not declared in the vertex shader! This declaration will be ignored.')):(a=this._webgpuProcessingContext.getVaryingNextLocation(c,this._getArraySize(u,c,n)[2]),this._webgpuProcessingContext.availableVaryings[u]=a,this._varyingsWGSL.push(" @location(".concat(a,") ").concat(h," ").concat(u," : ").concat(c,",")),this._varyingNamesWGSL.push(u)),e=""}return e},t.prototype.attributeProcessor=function(e,t){var n=/\s*attribute\s+(\S+)\s*:\s*(.+)\s*;/gm.exec(e);if(null!==n){var r=n[2],i=n[1],o=this._webgpuProcessingContext.getAttributeNextLocation(r,this._getArraySize(i,r,t)[2]);this._webgpuProcessingContext.availableAttributes[i]=o,this._webgpuProcessingContext.orderedAttributes[o]=i;var a=this._webgpuProcessingContext.vertexBufferKindToNumberOfComponents[i];if(void 0!==a){var s=a<0?-1===a?"i32":"vec"+-a+"":1===a?"u32":"vec"+a+"",l="_int_".concat(i,"_");this._attributesInputWGSL.push("@location(".concat(o,") ").concat(l," : ").concat(s,",")),this._attributesWGSL.push("".concat(i," : ").concat(r,",")),this._attributesConversionCodeWGSL.push("vertexInputs.".concat(i," = ").concat(r,"(vertexInputs_.").concat(l,");")),this._hasNonFloatAttribute=!0}else this._attributesInputWGSL.push("@location(".concat(o,") ").concat(i," : ").concat(r,",")),this._attributesWGSL.push("".concat(i," : ").concat(r,",")),this._attributesConversionCodeWGSL.push("vertexInputs.".concat(i," = vertexInputs_.").concat(i,";"));e=""}return e},t.prototype.uniformProcessor=function(e,t,n){var r=this.uniformRegexp.exec(e);if(null!==r){var i=r[2],o=r[1];this._addUniformToLeftOverUBO(o,i,n),e=""}return e},t.prototype.textureProcessor=function(e,t,n){var r=this.textureRegexp.exec(e);if(null!==r){var i=r[1],o=r[2],a=!!r[3],s=r[4],l=s.indexOf("storage")>0,c=r[6],u=l?c.substring(0,c.indexOf(",")).trim():null,h=a?this._getArraySize(i,o,n)[2]:0,d=this._webgpuProcessingContext.availableTextures[i];if(d)h=d.textures.length;else{d={isTextureArray:h>0,isStorageTexture:l,textures:[],sampleType:"float"},h=h||1;for(var p=0;p0,m=zu[s],_=f?"depth":"u32"===c?"uint":"i32"===c?"sint":"float";if(d.sampleType=_,void 0===m)throw"Can't get the texture dimension corresponding to the texture function \"".concat(s,'"!');for(p=0;p0?-1:e.length===t.length?0:1}));for(var c=0,u=s;c=0&&!this.pureMode?"\n if (internals.yFactor_ == 1.) {\n fragmentInputs.position.y = internals.textureOutputHeight_ - fragmentInputs.position.y;\n }\n ":"";e=this._processSamplers(e,!0),t=this._processSamplers(t,!1),e=this._processCustomBuffers(e,!0),t=this._processCustomBuffers(t,!1);var i=this._buildLeftOverUBO();t=i+t,e=(e=i+e).replace(/#define /g,"//#define "),e=this._processStridedUniformArrays(e);var o="struct VertexInputs {\n @builtin(vertex_index) vertexIndex : u32,\n @builtin(instance_index) instanceIndex : u32,\n";this._attributesInputWGSL.length>0&&(o+=this._attributesInputWGSL.join("\n")),o+="\n};\nvar vertexInputs"+(this._hasNonFloatAttribute?"_":"")+" : VertexInputs;\n",this._hasNonFloatAttribute&&(o+="struct VertexInputs_ {\n vertexIndex : u32, instanceIndex : u32,\n",o+=this._attributesWGSL.join("\n"),o+="\n};\nvar vertexInputs : VertexInputs_;\n");var a="struct FragmentInputs {\n @builtin(position)"+(e.indexOf("#define VERTEXOUTPUT_INVARIANT")>=0?" @invariant":"")+" position : vec4,\n";this._varyingsWGSL.length>0&&(a+=this._varyingsWGSL.join("\n")),e=o+(a+="\n};\nvar vertexOutputs : FragmentInputs;\n")+e;var s="\n vertexInputs".concat(this._hasNonFloatAttribute?"_":""," = input;\n");this._hasNonFloatAttribute&&(s+="vertexInputs.vertexIndex = vertexInputs_.vertexIndex;\nvertexInputs.instanceIndex = vertexInputs_.instanceIndex;\n",s+=this._attributesConversionCodeWGSL.join("\n"),s+="\n");var l=this.pureMode?" return vertexOutputs;":" vertexOutputs.position.y = vertexOutputs.position.y * internals.yFactor_;\n return vertexOutputs;",c=-1!==e.indexOf(b.Y.DISABLEUA);e=(c?"diagnostic(off, derivative_uniformity);\n":"")+"diagnostic(off, chromium.unreachable_code);\n"+_c(e,"fn main",s,l),t=t.replace(/#define /g,"//#define "),t=this._processStridedUniformArrays(t),this.pureMode||(t=t.replace(/dpdy/g,"(-internals.yFactor_)*dpdy"));var u="struct FragmentInputs {\n @builtin(position) position : vec4,\n @builtin(front_facing) frontFacing : bool,\n";this._varyingsWGSL.length>0&&(u+=this._varyingsWGSL.join("\n")),u+="\n};\nvar fragmentInputs : FragmentInputs;\n";var h="struct FragmentOutputs {\n",d="fragmentOutputs\\.fragData",p=t.match(new RegExp(d+"0","g")),f=0;if(p){h+=" @location(".concat(f,") fragData0 : vec4,\n"),f++;for(var m=1;m<8;m++)(p=t.match(new RegExp(d+m,"g")))&&(h+=" @location(".concat(f,") fragData").concat(f," : vec4,\n"),f++);-1!==t.indexOf("MRT_AND_COLOR")&&(h+=" @location(".concat(f,") color : vec4,\n"),f++)}(p=t.match(/oitDepthSampler/))&&(h+=" @location(".concat(f++,") depth : vec2,\n"),h+=" @location(".concat(f++,") frontColor : vec4,\n"),h+=" @location(".concat(f++,") backColor : vec4,\n")),0===f&&(-1!==t.indexOf("DUAL_SOURCE_BLENDING")?(n.push("dual_source_blending"),h+=" @location(0) @blend_src(0) color : vec4,\n",h+=" @location(0) @blend_src(1) color2 : vec4,\n"):h+=" @location(0) color : vec4,\n",f++);for(var _=!1,g=0;!(_||(g=t.indexOf(ku,g))<0);){var v=g;for(_=!0;g>1&&"\n"!==t.charAt(g);){if("/"===t.charAt(g)&&"/"===t.charAt(g-1)){_=!1;break}g--}g=v+25}_&&(h+=" @builtin(frag_depth) fragDepth: f32,\n");var y=" fragmentInputs = input;\n "+r;return c=-1!==(t=u+(h+="};\nvar fragmentOutputs : FragmentOutputs;\n")+t).indexOf(b.Y.DISABLEUA),n.length>0&&(t="enable "+n.join(";\nenable ")+";\n"+t),t=(c?"diagnostic(off, derivative_uniformity);\n":"")+"diagnostic(off, chromium.unreachable_code);\n"+_c(t,"fn main",y," return fragmentOutputs;"),this._collectBindingNames(),this._preCreateBindGroupEntries(),this._webgpuProcessingContext.vertexBufferKindToNumberOfComponents={},{vertexCode:e,fragmentCode:t}},t.prototype._generateLeftOverUBOCode=function(e,t){for(var n="",r="struct ".concat(e," {\n"),i=0,o=this._webgpuProcessingContext.leftOverUniforms;i)?$/,"$1"),l=Lu.UniformSizes[s];if(a.length>0)if(l<=2){var c="".concat(e,"_").concat(this._stridedUniformArrays.length,"_strided_arr");n+="struct ".concat(c," {\n @size(16)\n el: ").concat(s,",\n }"),this._stridedUniformArrays.push(a.name),r+=" @align(16) ".concat(a.name," : array<").concat(c,", ").concat(a.length,">,\n")}else r+=" ".concat(a.name," : array<").concat(a.type,", ").concat(a.length,">,\n");else r+=" ".concat(a.name," : ").concat(a.type,",\n")}return r+="};\n",(r="".concat(n,"\n").concat(r))+"@group(".concat(t.binding.groupIndex,") @binding(").concat(t.binding.bindingIndex,") var ").concat("uniforms"," : ").concat(e,";\n")},t.prototype._processSamplers=function(e,t){for(var n=/var\s+(\w+Sampler)\s*:\s*(sampler|sampler_comparison)\s*;/gm;;){var r=n.exec(e);if(null===r)break;var i=r[1],o=r[2],a=i.length-b.Y.AUTOSAMPLERSUFFIX.length,s=i.lastIndexOf(b.Y.AUTOSAMPLERSUFFIX)===a?i.substring(0,a):null,l="sampler_comparison"===o?"comparison":"filtering";if(s){var c=this._webgpuProcessingContext.availableTextures[s];c&&(c.autoBindSampler=!0)}var u=this._webgpuProcessingContext.availableSamplers[i];u||(u={binding:this._webgpuProcessingContext.getNextFreeUBOBinding(),type:l},this._webgpuProcessingContext.availableSamplers[i]=u),this._addSamplerBindingDescription(i,u,t);var h=e.substring(0,r.index),d="@group(".concat(u.binding.groupIndex,") @binding(").concat(u.binding.bindingIndex,") "),p=e.substring(r.index);e=h+d+p,n.lastIndex+=d.length}return e},t.prototype._processCustomBuffers=function(e,t){for(var n,r=/var<\s*(uniform|storage)\s*(,\s*(read|read_write)\s*)?>\s+(\S+)\s*:\s*(\S+)\s*;/gm;;){var i=r.exec(e);if(null===i)break;var o=i[1],a=i[3],s=i[4],l=i[5],c=this._webgpuProcessingContext.availableBuffers[s];if(!c){var u="uniform"===o?Vu.KnownUBOs[l]:null,h=void 0;u?(s=l,-1===(h=u.binding).groupIndex&&((h=null===(n=this._webgpuProcessingContext.availableBuffers[s])||void 0===n?void 0:n.binding)||(h=this._webgpuProcessingContext.getNextFreeUBOBinding()))):h=this._webgpuProcessingContext.getNextFreeUBOBinding(),c={binding:h},this._webgpuProcessingContext.availableBuffers[s]=c}this._addBufferBindingDescription(s,this._webgpuProcessingContext.availableBuffers[s],"read_write"===a?"storage":"storage"===o?"read-only-storage":"uniform",t);var d=c.binding.groupIndex,p=c.binding.bindingIndex,f=e.substring(0,i.index),m="@group(".concat(d,") @binding(").concat(p,") "),_=e.substring(i.index);e=f+m+_,r.lastIndex+=m.length}return e},t.prototype._processStridedUniformArrays=function(e){for(var t=0,n=this._stridedUniformArrays;t, 4>( vec2f(-1.0f, 1.0f), vec2f(1.0f, 1.0f), vec2f(-1.0f, -1.0f), vec2f(1.0f, -1.0f));\n const tex = array, 4>( vec2f(0.0f, 0.0f), vec2f(1.0f, 0.0f), vec2f(0.0f, 1.0f), vec2f(1.0f, 1.0f));\n\n var img: texture_2d;\n\n #ifdef INVERTY\n varying vTextureSize: vec2f;\n #endif\n\n @vertex\n fn main(input : VertexInputs) -> FragmentInputs {\n #ifdef INVERTY\n vertexOutputs.vTextureSize = vec2f(textureDimensions(img, 0));\n #endif\n vertexOutputs.position = vec4f(pos[input.vertexIndex], 0.0, 1.0);\n }\n ",Xu=Yu;!function(e){e[e.MipMap=0]="MipMap",e[e.InvertYPremultiplyAlpha=1]="InvertYPremultiplyAlpha",e[e.Clear=2]="Clear",e[e.InvertYPremultiplyAlphaWithOfst=3]="InvertYPremultiplyAlphaWithOfst"}(Nu||(Nu={})),function(e){e[e.DontInvertY=0]="DontInvertY",e[e.InvertY=1]="InvertY"}(Fu||(Fu={}));var ju,qu=[{vertex:"\n const pos = array, 4>( vec2f(-1.0f, 1.0f), vec2f(1.0f, 1.0f), vec2f(-1.0f, -1.0f), vec2f(1.0f, -1.0f));\n const tex = array, 4>( vec2f(0.0f, 0.0f), vec2f(1.0f, 0.0f), vec2f(0.0f, 1.0f), vec2f(1.0f, 1.0f));\n\n varying vTex: vec2f;\n\n @vertex\n fn main(input : VertexInputs) -> FragmentInputs {\n vertexOutputs.vTex = tex[input.vertexIndex];\n vertexOutputs.position = vec4f(pos[input.vertexIndex], 0.0, 1.0);\n }\n ",fragment:"\n var imgSampler: sampler;\n var img: texture_2d;\n\n varying vTex: vec2f;\n\n @fragment\n fn main(input: FragmentInputs) -> FragmentOutputs {\n fragmentOutputs.color = textureSample(img, imgSampler, input.vTex);\n }\n "},{vertex:Yu,fragment:"\n var img: texture_2d;\n\n #ifdef INVERTY\n varying vTextureSize: vec2f;\n #endif\n\n @fragment\n fn main(input: FragmentInputs) -> FragmentOutputs {\n #ifdef INVERTY\n var color: vec4f = textureLoad(img, vec2i(i32(input.position.x), i32(input.vTextureSize.y - input.position.y)), 0);\n #else\n var color: vec4f = textureLoad(img, vec2i(input.position.xy), 0);\n #endif\n #ifdef PREMULTIPLYALPHA\n color = vec4f(color.rgb * color.a, color.a);\n #endif\n fragmentOutputs.color = color;\n }\n "},{vertex:"\n const pos = array, 4>( vec2f(-1.0f, 1.0f), vec2f(1.0f, 1.0f), vec2f(-1.0f, -1.0f), vec2f(1.0f, -1.0f));\n\n @vertex\n fn main(input : VertexInputs) -> FragmentInputs {\n vertexOutputs.position = vec4f(pos[input.vertexIndex], 0.0, 1.0);\n }\n ",fragment:"\n uniform color: vec4f;\n\n\n @fragment\n fn main(input: FragmentInputs) -> FragmentOutputs {\n fragmentOutputs.color = uniforms.color;\n }\n "},{vertex:Xu,fragment:"\n var img: texture_2d;\n uniform ofstX: f32;\n uniform ofstY: f32;\n uniform width: f32;\n uniform height: f32;\n\n #ifdef INVERTY\n varying vTextureSize: vec2f;\n #endif\n\n @fragment\n fn main(input: FragmentInputs) -> FragmentOutputs {\n if (input.position.x < uniforms.ofstX || input.position.x >= uniforms.ofstX + uniforms.width) {\n discard;\n }\n if (input.position.y < uniforms.ofstY || input.position.y >= uniforms.ofstY + uniforms.height) {\n discard;\n }\n #ifdef INVERTY\n var color: vec4f = textureLoad(img, vec2i(i32(input.position.x), i32(uniforms.ofstY + uniforms.height - (input.position.y - uniforms.ofstY))), 0);\n #else\n var color: vec4f = textureLoad(img, vec2i(input.position.xy), 0);\n #endif\n #ifdef PREMULTIPLYALPHA\n color = vec4f(color.rgb * color.a, color.a);\n #endif\n fragmentOutputs.color = color;\n }\n "}],Ku={"":0,r8unorm:1,r8uint:2,r8sint:3,r16uint:4,r16sint:5,r16float:6,rg8unorm:7,rg8uint:8,rg8sint:9,r32uint:10,r32sint:11,r32float:12,rg16uint:13,rg16sint:14,rg16float:15,rgba8unorm:16,"rgba8unorm-srgb":17,rgba8uint:18,rgba8sint:19,bgra8unorm:20,"bgra8unorm-srgb":21,rgb10a2uint:22,rgb10a2unorm:23,rg32uint:24,rg32sint:25,rg32float:26,rgba16uint:27,rgba16sint:28,rgba16float:29,rgba32uint:30,rgba32sint:31,rgba32float:32,stencil8:33,depth16unorm:34,depth24plus:35,"depth24plus-stencil8":36,depth32float:37,"depth32float-stencil8":38,r16unorm:39,rg16unorm:40,rgba16unorm:41,r16snorm:42,rg16snorm:43,rgba16snorm:44},Zu=function(){function e(e,t,n,r){if(this._pipelines={},this._compiledShaders=[],this._videoPipelines={},this._videoCompiledShaders=[],this._deferredReleaseTextures=[],this._engine=e,this._device=t,this._bufferManager=n,-1!==r.indexOf("rg11b10ufloat-renderable")){var i=Object.keys(Ku);Ku.rg11b10ufloat=Ku[i[i.length-1]]+1}this._mipmapSampler=t.createSampler({minFilter:"linear"}),this._videoSampler=t.createSampler({minFilter:"linear"}),this._ubCopyWithOfst=this._bufferManager.createBuffer(16,qc.Uniform|qc.CopyDst,"UBCopyWithOffset").underlyingResource,this._getPipeline("rgba8unorm"),this._getVideoPipeline("rgba8unorm")}return e.prototype._getPipeline=function(e,t,n){void 0===t&&(t=Nu.MipMap);var r=t===Nu.MipMap?1:t===Nu.InvertYPremultiplyAlpha?((n.invertY?1:0)<<1)+((n.premultiplyAlpha?1:0)<<2):t===Nu.Clear?8:t===Nu.InvertYPremultiplyAlphaWithOfst?((n.invertY?1:0)<<4)+((n.premultiplyAlpha?1:0)<<5):0;this._pipelines[e]||(this._pipelines[e]=[]);var i=this._pipelines[e][r];if(!i){var o="";t!==Nu.InvertYPremultiplyAlpha&&t!==Nu.InvertYPremultiplyAlphaWithOfst||(n.invertY&&(o+="#define INVERTY\n"),n.premultiplyAlpha&&(o+="#define PREMULTIPLYALPHA\n"));var a=this._compiledShaders[r];if(!a){var s=qu[t].vertex,l=qu[t].fragment,c={defines:o.split("\n"),indexParameters:null,isFragment:!1,shouldUseHighPrecisionShader:!0,processor:this._engine._getShaderProcessor(1),supportsUniformBuffers:!0,shadersRepository:"",includesShadersStore:{},version:(100*this._engine.version).toString(),platformName:this._engine.shaderPlatformName,processingContext:this._engine._getShaderProcessingContext(1,!0),isNDCHalfZRange:this._engine.isNDCHalfZRange,useReverseDepthBuffer:this._engine.useReverseDepthBuffer};(0,vo.pB)(c),c.processor.pureMode=!0,(0,vo.M0)(s,c,(function(e){s=e}),this._engine),c.isFragment=!0,(0,vo.M0)(l,c,(function(e){l=e}),this._engine);var u=(0,vo.nO)(s,l,c);c.processor.pureMode=!1;var h=this._device.createShaderModule({label:"BabylonWebGPUDevice".concat(this._engine.uniqueId,"_InternalVertexShader_").concat(r),code:u.vertexCode}),d=this._device.createShaderModule({label:"BabylonWebGPUDevice".concat(this._engine.uniqueId,"_InternalFragmentShader_").concat(r),code:u.fragmentCode});a=this._compiledShaders[r]=[h,d]}var p=this._device.createRenderPipeline({label:"BabylonWebGPUDevice".concat(this._engine.uniqueId,"_InternalPipeline_").concat(e,"_").concat(r),layout:"auto",vertex:{module:a[0],entryPoint:"main"},fragment:{module:a[1],entryPoint:"main",targets:[{format:e}]},primitive:{topology:"triangle-strip",stripIndexFormat:"uint16"}});i=this._pipelines[e][r]=[p,p.getBindGroupLayout(0)]}return i},e.prototype._getVideoPipeline=function(e,t){void 0===t&&(t=Fu.DontInvertY);var n=t===Fu.InvertY?1:0;this._videoPipelines[e]||(this._videoPipelines[e]=[]);var r=this._videoPipelines[e][n];if(!r){var i=this._videoCompiledShaders[n];if(!i){var o=this._device.createShaderModule({code:"\n struct VertexOutput {\n @builtin(position) Position : vec4,\n @location(0) fragUV : vec2\n }\n\n @vertex\n fn main(\n @builtin(vertex_index) VertexIndex : u32\n ) -> VertexOutput {\n var pos = array, 4>(\n vec2(-1.0, 1.0),\n vec2( 1.0, 1.0),\n vec2(-1.0, -1.0),\n vec2( 1.0, -1.0)\n );\n var tex = array, 4>(\n vec2(0.0, 0.0),\n vec2(1.0, 0.0),\n vec2(0.0, 1.0),\n vec2(1.0, 1.0)\n );\n\n var output: VertexOutput;\n\n output.Position = vec4(pos[VertexIndex], 0.0, 1.0);\n output.fragUV = tex[VertexIndex];\n\n return output;\n }\n ",label:"BabylonWebGPUDevice".concat(this._engine.uniqueId,"_CopyVideoToTexture_VertexShader")}),a=this._device.createShaderModule({code:0===n?"\n @group(0) @binding(0) var videoSampler: sampler;\n @group(0) @binding(1) var videoTexture: texture_external;\n\n @fragment\n fn main(\n @location(0) fragUV: vec2\n ) -> @location(0) vec4 {\n return textureSampleBaseClampToEdge(videoTexture, videoSampler, fragUV);\n }\n ":"\n @group(0) @binding(0) var videoSampler: sampler;\n @group(0) @binding(1) var videoTexture: texture_external;\n\n @fragment\n fn main(\n @location(0) fragUV: vec2\n ) -> @location(0) vec4 {\n return textureSampleBaseClampToEdge(videoTexture, videoSampler, vec2(fragUV.x, 1.0 - fragUV.y));\n }\n ",label:"BabylonWebGPUDevice".concat(this._engine.uniqueId,"_CopyVideoToTexture_FragmentShader_").concat(0===n?"DontInvertY":"InvertY")});i=this._videoCompiledShaders[n]=[o,a]}var s=this._device.createRenderPipeline({label:"BabylonWebGPUDevice".concat(this._engine.uniqueId,"_InternalVideoPipeline_").concat(e,"_").concat(0===n?"DontInvertY":"InvertY"),layout:"auto",vertex:{module:i[0],entryPoint:"main"},fragment:{module:i[1],entryPoint:"main",targets:[{format:e}]},primitive:{topology:"triangle-strip",stripIndexFormat:"uint16"}});r=this._videoPipelines[e][n]=[s,s.getBindGroupLayout(0)]}return r},e.prototype.setCommandEncoder=function(e){this._commandEncoderForCreation=e},e.prototype.copyVideoToTexture=function(e,t,n,r,i){var o,a,s,l;void 0===r&&(r=!1);var c=void 0===i,u=this._getVideoPipeline(n,r?Fu.InvertY:Fu.DontInvertY),h=u[0],d=u[1];c&&(i=this._device.createCommandEncoder({})),null===(a=(o=i).pushDebugGroup)||void 0===a||a.call(o,"copy video to texture - invertY=".concat(r));var p=t._hardwareTexture,f={label:"BabylonWebGPUDevice".concat(this._engine.uniqueId,"_copyVideoToTexture_").concat(n,"_").concat(r?"InvertY":"DontInvertY").concat(t.label?"_"+t.label:""),colorAttachments:[{view:p.underlyingResource.createView({format:n,dimension:"2d",mipLevelCount:1,baseArrayLayer:0,baseMipLevel:0,arrayLayerCount:1,aspect:"all"}),loadOp:"load",storeOp:"store"}]},m=i.beginRenderPass(f),_={layout:d,entries:[{binding:0,resource:this._videoSampler},{binding:1,resource:this._device.importExternalTexture({source:e.underlyingResource})}]},g=this._device.createBindGroup(_);m.setPipeline(h),m.setBindGroup(0,g),m.draw(4,1,0,0),m.end(),null===(l=(s=i).popDebugGroup)||void 0===l||l.call(s),c&&(this._device.queue.submit([i.finish()]),i=null)},e.prototype.invertYPreMultiplyAlpha=function(e,t,n,r,i,o,a,s,l,c,u,h,d,p,f){var m,_,g,v,y,b;void 0===i&&(i=!1),void 0===o&&(o=!1),void 0===a&&(a=0),void 0===s&&(s=0),void 0===l&&(l=1),void 0===c&&(c=0),void 0===u&&(u=0),void 0===h&&(h=0),void 0===d&&(d=0);var S,T=0!==h,E=void 0===p,x=this._getPipeline(r,T?Nu.InvertYPremultiplyAlphaWithOfst:Nu.InvertYPremultiplyAlpha,{invertY:i,premultiplyAlpha:o}),P=x[0],C=x[1];if(a=Math.max(a,0),E&&(p=this._device.createCommandEncoder({})),null===(_=(m=p).pushDebugGroup)||void 0===_||_.call(m,"internal process texture - invertY=".concat(i," premultiplyAlpha=").concat(o)),zc.IsHardwareTexture(e)?(S=e.underlyingResource,i&&!o&&1===l&&0===a||(e=void 0)):(S=e,e=void 0),S){T&&this._bufferManager.setRawData(this._ubCopyWithOfst,0,new Float32Array([c,u,h,d]),0,16);var R=e,A=null!==(g=null==R?void 0:R._copyInvertYTempTexture)&&void 0!==g?g:this.createTexture({width:t,height:n,layers:1},!1,!1,!1,!1,!1,r,1,p,21,void 0,"TempTextureForCopyWithInvertY"),I=null!==(v=null==R?void 0:R._copyInvertYRenderPassDescr)&&void 0!==v?v:{label:"BabylonWebGPUDevice".concat(this._engine.uniqueId,"_invertYPreMultiplyAlpha_").concat(r,"_").concat(i?"InvertY":"DontInvertY","_").concat(o?"PremultiplyAlpha":"DontPremultiplyAlpha"),colorAttachments:[{view:A.createView({format:r,dimension:"2d",baseMipLevel:0,mipLevelCount:1,arrayLayerCount:1,baseArrayLayer:0}),loadOp:"load",storeOp:"store"}]},O=p.beginRenderPass(I),M=T?null==R?void 0:R._copyInvertYBindGroupWithOfst:null==R?void 0:R._copyInvertYBindGroup;if(!M){var D={layout:C,entries:[{binding:0,resource:S.createView({format:r,dimension:"2d",baseMipLevel:s,mipLevelCount:1,arrayLayerCount:l,baseArrayLayer:a})}]};T&&D.entries.push({binding:1,resource:{buffer:this._ubCopyWithOfst}}),M=this._device.createBindGroup(D)}O.setPipeline(P),O.setBindGroup(0,M),O.draw(4,1,0,0),O.end(),p.copyTextureToTexture({texture:A},{texture:S,mipLevel:s,origin:{x:0,y:0,z:a}},{width:h||t,height:d||n,depthOrArrayLayers:1}),R?(R._copyInvertYTempTexture=A,R._copyInvertYRenderPassDescr=I,T?R._copyInvertYBindGroupWithOfst=M:R._copyInvertYBindGroup=M):this._deferredReleaseTextures.push([A,null]),null===(b=(y=p).popDebugGroup)||void 0===b||b.call(y),E&&(this._device.queue.submit([p.finish()]),p=null)}},e.prototype.createTexture=function(e,t,n,r,i,o,a,s,l,c,u,h){void 0===t&&(t=!1),void 0===n&&(n=!1),void 0===r&&(r=!1),void 0===i&&(i=!1),void 0===o&&(o=!1),void 0===a&&(a="rgba8unorm"),void 0===s&&(s=1),void 0===c&&(c=-1),void 0===u&&(u=0),s=zc.GetSample(s);var d=e.layers||1,p={width:e.width,height:e.height,depthOrArrayLayers:d},f=Ku[a]?16:0,m=zc.IsCompressedFormat(a),_=t?zc.ComputeNumMipmapLevels(e.width,e.height):1,g=c>=0?c:7;u|=t&&!m?1|f:0,m||o||(u|=2|f);var v=this._device.createTexture({label:"BabylonWebGPUDevice".concat(this._engine.uniqueId,"_Texture").concat(o?"3D":"2D","_").concat(h?h+"_":"").concat(p.width,"x").concat(p.height,"x").concat(p.depthOrArrayLayers,"_").concat(t?"wmips":"womips","_").concat(a,"_samples").concat(s),size:p,dimension:o?"3d":"2d",format:a,usage:g|u,sampleCount:s,mipLevelCount:_});return zc.IsImageBitmap(e)&&(this.updateTexture(e,v,e.width,e.height,d,a,0,0,r,i,0,0),t&&n&&this.generateMipmaps(v,a,_,0,o,l)),v},e.prototype.createCubeTexture=function(e,t,n,r,i,o,a,s,l,c,u){void 0===t&&(t=!1),void 0===n&&(n=!1),void 0===r&&(r=!1),void 0===i&&(i=!1),void 0===o&&(o="rgba8unorm"),void 0===a&&(a=1),void 0===l&&(l=-1),void 0===c&&(c=0),a=zc.GetSample(a);var h=zc.IsImageBitmapArray(e)?e[0].width:e.width,d=zc.IsImageBitmapArray(e)?e[0].height:e.height,p=Ku[o]?16:0,f=zc.IsCompressedFormat(o),m=t?zc.ComputeNumMipmapLevels(h,d):1,_=l>=0?l:7;c|=t&&!f?1|p:0,f||(c|=2|p);var g=this._device.createTexture({label:"BabylonWebGPUDevice".concat(this._engine.uniqueId,"_TextureCube_").concat(u?u+"_":"").concat(h,"x").concat(d,"x6_").concat(t?"wmips":"womips","_").concat(o,"_samples").concat(a),size:{width:h,height:d,depthOrArrayLayers:6},dimension:"2d",format:o,usage:_|c,sampleCount:a,mipLevelCount:m});return zc.IsImageBitmapArray(e)&&(this.updateCubeTextures(e,g,h,d,o,r,i,0,0),t&&n&&this.generateCubeMipmaps(g,o,m,s)),g},e.prototype.generateCubeMipmaps=function(e,t,n,r){var i,o,a,s,l=void 0===r;l&&(r=this._device.createCommandEncoder({})),null===(o=(i=r).pushDebugGroup)||void 0===o||o.call(i,"create cube mipmaps - ".concat(n," levels"));for(var c=0;c<6;++c)this.generateMipmaps(e,t,n,c,!1,r);null===(s=(a=r).popDebugGroup)||void 0===s||s.call(a),l&&(this._device.queue.submit([r.finish()]),r=null)},e.prototype.generateMipmaps=function(e,t,n,r,i,o){var a,s,l,c,u,h,d,p;void 0===r&&(r=0),void 0===i&&(i=!1);var f,m=void 0===o,_=this._getPipeline(t),g=_[0],v=_[1];if(r=Math.max(r,0),m&&(o=this._device.createCommandEncoder({})),null===(s=(a=o).pushDebugGroup)||void 0===s||s.call(a,"create mipmaps for face #".concat(r," - ").concat(n," levels")),zc.IsHardwareTexture(e)?(f=e.underlyingResource,e._mipmapGenRenderPassDescr=e._mipmapGenRenderPassDescr||[],e._mipmapGenBindGroup=e._mipmapGenBindGroup||[]):(f=e,e=void 0),f){for(var y=e,b=1;b1?i="linear":(i="nearest",o=a=0);break;case b.Y.TEXTURE_LINEAR_NEAREST:n="linear",r="nearest",i="nearest",o=a=0;break;default:n="nearest",r="nearest",i="nearest",o=a=0}return t>1&&(0!==o||0!==a)?{magFilter:"linear",minFilter:"linear",mipmapFilter:"linear",anisotropyEnabled:!0}:{magFilter:n,minFilter:r,mipmapFilter:i,lodMinClamp:o,lodMaxClamp:a}},e._GetWrappingMode=function(e){switch(e){case b.Y.TEXTURE_WRAP_ADDRESSMODE:return"repeat";case b.Y.TEXTURE_CLAMP_ADDRESSMODE:return"clamp-to-edge";case b.Y.TEXTURE_MIRROR_ADDRESSMODE:return"mirror-repeat"}return"repeat"},e._GetSamplerWrappingDescriptor=function(e){return{addressModeU:this._GetWrappingMode(e._cachedWrapU),addressModeV:this._GetWrappingMode(e._cachedWrapV),addressModeW:this._GetWrappingMode(e._cachedWrapR)}},e._GetSamplerDescriptor=function(t,n){var r=(t.useMipMaps||t.samplingMode===b.Y.TEXTURE_LINEAR_LINEAR)&&t._cachedAnisotropicFilteringLevel?t._cachedAnisotropicFilteringLevel:1;t.samplingMode!==b.Y.TEXTURE_LINEAR_LINEAR_MIPNEAREST&&t.samplingMode!==b.Y.TEXTURE_LINEAR_LINEAR_MIPLINEAR&&t.samplingMode!==b.Y.TEXTURE_LINEAR_LINEAR&&(r=1);var i=this._GetSamplerFilterDescriptor(t,r);return(0,f.Cl)((0,f.Cl)((0,f.Cl)({label:n},i),this._GetSamplerWrappingDescriptor(t)),{compare:t._comparisonFunction?e.GetCompareFunction(t._comparisonFunction):void 0,maxAnisotropy:i.anisotropyEnabled?r:1})},e.GetCompareFunction=function(e){switch(e){case b.Y.ALWAYS:return"always";case b.Y.EQUAL:return"equal";case b.Y.GREATER:return"greater";case b.Y.GEQUAL:return"greater-equal";case b.Y.LESS:return"less";case b.Y.LEQUAL:return"less-equal";case b.Y.NEVER:return"never";case b.Y.NOTEQUAL:return"not-equal";default:return"less"}},e.prototype.getSampler=function(t,n,r,i){if(void 0===n&&(n=!1),void 0===r&&(r=0),this.disabled)return this._device.createSampler(e._GetSamplerDescriptor(t,i));n?r=0:0===r&&(r=e.GetSamplerHashCode(t));var o=n?void 0:this._samplers[r];return o||(o=this._device.createSampler(e._GetSamplerDescriptor(t,i)),n||(this._samplers[r]=o)),o},e}();!function(e){e[e.StencilReadMask=0]="StencilReadMask",e[e.StencilWriteMask=1]="StencilWriteMask",e[e.DepthBias=2]="DepthBias",e[e.DepthBiasSlopeScale=3]="DepthBiasSlopeScale",e[e.DepthStencilState=4]="DepthStencilState",e[e.MRTAttachments=5]="MRTAttachments",e[e.RasterizationState=6]="RasterizationState",e[e.ColorStates1=7]="ColorStates1",e[e.ColorStates2=8]="ColorStates2",e[e.ColorStates3=9]="ColorStates3",e[e.ColorStates4=10]="ColorStates4",e[e.ShaderStage=11]="ShaderStage",e[e.TextureStage=12]="TextureStage",e[e.VertexState=13]="VertexState",e[e.NumStates=14]="NumStates"}(ju||(ju={}));var ih={0:1,1:2,768:3,769:4,770:5,771:6,772:7,773:8,774:9,775:10,776:11,32769:12,32770:13,32771:14,32772:15,35065:16,35066:17,34185:18,35067:19},oh={32774:0,32775:1,32776:2,32778:3,32779:4},ah={0:0,7680:1,7681:2,7682:3,7683:4,5386:5,34055:6,34056:7},sh=[0,0,0,0],lh=function(){function e(e,t){this.mrtTextureCount=0,this._device=e,this._useTextureStage=!0,this._states=new Array(30),this._statesLength=0,this._stateDirtyLowestIndex=0,this._emptyVertexBuffer=t,this._mrtFormats=[],this._parameter={token:void 0,pipeline:null},this.disabled=!1,this.vertexBuffers=[],this._kMaxVertexBufferStride=e.limits.maxVertexBufferArrayStride||2048,this.reset()}return e.prototype.reset=function(){this._isDirty=!0,this.vertexBuffers.length=0,this.setAlphaToCoverage(!1),this.resetDepthCullingState(),this.setClampDepth(!1),this.setDepthBias(0),this._webgpuColorFormat=["bgra8unorm"],this.setColorFormat("bgra8unorm"),this.setMRT([]),this.setAlphaBlendEnabled([!1],1),this.setAlphaBlendFactors([null,null,null,null],[null,null]),this.setWriteMask(15),this.setDepthStencilFormat("depth24plus-stencil8"),this.setStencilEnabled(!1),this.resetStencilState(),this.setBuffers(null,null,null),this._setTextureState(0)},Object.defineProperty(e.prototype,"colorFormats",{get:function(){return this._mrtAttachments>0?this._mrtFormats:this._webgpuColorFormat},enumerable:!1,configurable:!0}),e.prototype.getRenderPipeline=function(t,n,r,i){if(void 0===i&&(i=0),r=zc.GetSample(r),this.disabled){var o=e._GetTopology(t);return this._setVertexState(n),this._setTextureState(i),this._parameter.pipeline=this._createRenderPipeline(n,o,r),e.NumCacheMiss++,e._NumPipelineCreationCurrentFrame++,this._parameter.pipeline}if(this._setShaderStage(n.uniqueId),this._setRasterizationState(t,r),this._setColorStates(),this._setDepthStencilState(),this._setVertexState(n),this._setTextureState(i),this.lastStateDirtyLowestIndex=this._stateDirtyLowestIndex,!this._isDirty&&this._parameter.pipeline)return this._stateDirtyLowestIndex=this._statesLength,e.NumCacheHitWithoutHash++,this._parameter.pipeline;if(this._getRenderPipeline(this._parameter),this._isDirty=!1,this._stateDirtyLowestIndex=this._statesLength,this._parameter.pipeline)return e.NumCacheHitWithHash++,this._parameter.pipeline;var a=e._GetTopology(t);return this._parameter.pipeline=this._createRenderPipeline(n,a,r),this._setRenderPipeline(this._parameter),e.NumCacheMiss++,e._NumPipelineCreationCurrentFrame++,this._parameter.pipeline},e.prototype.endFrame=function(){e.NumPipelineCreationLastFrame=e._NumPipelineCreationCurrentFrame,e._NumPipelineCreationCurrentFrame=0},e.prototype.setAlphaToCoverage=function(e){this._alphaToCoverageEnabled=e},e.prototype.setFrontFace=function(e){this._frontFace=e},e.prototype.setCullEnabled=function(e){this._cullEnabled=e},e.prototype.setCullFace=function(e){this._cullFace=e},e.prototype.setClampDepth=function(e){this._clampDepth=e},e.prototype.resetDepthCullingState=function(){this.setDepthCullingState(!1,2,1,0,0,!0,!0,b.Y.ALWAYS)},e.prototype.setDepthCullingState=function(e,t,n,r,i,o,a,s){this._depthWriteEnabled=a,this._depthTestEnabled=o,this._depthCompare=(null!=s?s:b.Y.ALWAYS)-512,this._cullFace=n,this._cullEnabled=e,this._frontFace=t,this.setDepthBiasSlopeScale(r),this.setDepthBias(i)},e.prototype.setDepthBias=function(e){this._depthBias!==e&&(this._depthBias=e,this._states[ju.DepthBias]=e,this._isDirty=!0,this._stateDirtyLowestIndex=Math.min(this._stateDirtyLowestIndex,ju.DepthBias))},e.prototype.setDepthBiasSlopeScale=function(e){this._depthBiasSlopeScale!==e&&(this._depthBiasSlopeScale=e,this._states[ju.DepthBiasSlopeScale]=e,this._isDirty=!0,this._stateDirtyLowestIndex=Math.min(this._stateDirtyLowestIndex,ju.DepthBiasSlopeScale))},e.prototype.setColorFormat=function(e){this._webgpuColorFormat[0]=e,this._colorFormat=Ku[null!=e?e:""]},e.prototype.setMRTAttachments=function(e){this.mrtAttachments=e;for(var t=0,n=0;n8)throw new Error("Can't handle more than 8 attachments for a MRT in cache render pipeline!");this.mrtTextureArray=e,this.mrtTextureCount=t,this._mrtEnabledMask=65535;for(var i=0,o=0,a=0;a0)for(var h=0;h=this._video.HAVE_CURRENT_DATA},e.prototype.dispose=function(){},e}(),_h=function(){function e(){this.useVertexPulling=!1,this.uniqueId=e._Counter++,this.updateId=0,this.textureState=0,this.reset()}return Object.defineProperty(e.prototype,"forceBindGroupCreation",{get:function(){return this._numExternalTextures>0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasFloatOrDepthTextures",{get:function(){return this._numFloatOrDepthTextures>0},enumerable:!1,configurable:!0}),e.prototype.reset=function(){this.samplers={},this.textures={},this.isDirty=!0,this._numFloatOrDepthTextures=0,this._numExternalTextures=0},e.prototype.setSampler=function(e,t){var n=this.samplers[e],r=-1;n?r=n.hashCode:this.samplers[e]=n={sampler:t,hashCode:0},n.sampler=t,n.hashCode=t?rh.GetSamplerHashCode(t):0;var i=r!==n.hashCode;i&&this.updateId++,this.isDirty||(this.isDirty=i)},e.prototype.setTexture=function(e,t){var n,r,i,o=this.textures[e],a=-1;o?a=null!==(r=null===(n=o.texture)||void 0===n?void 0:n.uniqueId)&&void 0!==r?r:-1:this.textures[e]=o={texture:t,isFloatOrDepthTexture:!1,isExternalTexture:!1},o.isExternalTexture&&this._numExternalTextures--,o.isFloatOrDepthTexture&&this._numFloatOrDepthTextures--,t?(o.isFloatOrDepthTexture=t.type===b.Y.TEXTURETYPE_FLOAT||t.format>=b.Y.TEXTUREFORMAT_DEPTH24_STENCIL8&&t.format<=b.Y.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8,o.isExternalTexture=mh.IsExternalTexture(t),o.isFloatOrDepthTexture&&this._numFloatOrDepthTextures++,o.isExternalTexture&&this._numExternalTextures++):(o.isFloatOrDepthTexture=!1,o.isExternalTexture=!1),o.texture=t;var s=a!==(null!==(i=null==t?void 0:t.uniqueId)&&void 0!==i?i:-1);s&&this.updateId++,this.isDirty||(this.isDirty=s)},e._Counter=0,e}(),gh=function(){function e(t,n){this._dummyIndexBuffer=n,this._enableIndirectDrawInCompatMode=!1,this._bufferManager=t,this.uniqueId=e._Counter++,this._useInstancing=!1,this._currentInstanceCount=0,this._enableIndirectDraw=!1,this._vertexPullingEnabled=!1,this.reset()}return e.prototype.isDirty=function(e){return this._isDirty||this._materialContextUpdateId!==e},e.prototype.resetIsDirty=function(e){this._isDirty=!1,this._materialContextUpdateId=e},Object.defineProperty(e.prototype,"enableIndirectDraw",{get:function(){return this._enableIndirectDraw},set:function(e){this._enableIndirectDrawInCompatMode=!0,this._enableIndirectDraw!==e&&(this._enableIndirectDraw=e,e||this._useInstancing||!this.indirectDrawBuffer?e&&!this.indirectDrawBuffer&&(this.indirectDrawBuffer=this._bufferManager.createRawBuffer(20,qc.CopyDst|qc.Indirect|qc.Storage,void 0,"IndirectDrawBuffer"),this._indirectDrawData=new Uint32Array(5),this._indirectDrawData[3]=0,this._indirectDrawData[4]=0):(this._bufferManager.releaseBuffer(this.indirectDrawBuffer),this.indirectDrawBuffer=void 0,this._indirectDrawData=void 0))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"useInstancing",{get:function(){return this._useInstancing},set:function(e){if(this._useInstancing!==e){this._useInstancing=e,this._currentInstanceCount=-1;var t=this._enableIndirectDrawInCompatMode;this.enableIndirectDraw=e,this._enableIndirectDrawInCompatMode=t}},enumerable:!1,configurable:!0}),e.prototype.reset=function(){this.buffers={},this._isDirty=!0,this._materialContextUpdateId=0,this.fastBundle=void 0,this.bindGroups=void 0,this._vertexPullingEnabled=!1},e.prototype.setBuffer=function(e,t){var n;this._isDirty||(this._isDirty=(null==t?void 0:t.uniqueId)!==(null===(n=this.buffers[e])||void 0===n?void 0:n.uniqueId)),this.buffers[e]=t},e.prototype.setIndirectData=function(e,t,n,r){void 0===r&&(r=!1),(r||t!==this._currentInstanceCount)&&this.indirectDrawBuffer&&this._indirectDrawData&&(this._currentInstanceCount=t,this._indirectDrawData[0]=e,this._indirectDrawData[1]=t,this._indirectDrawData[2]=n,this._bufferManager.setRawData(this.indirectDrawBuffer,0,this._indirectDrawData,0,20))},e.prototype.setVertexPulling=function(e,t,n,r,i){var o;if(this._vertexPullingEnabled!==e){this._vertexPullingEnabled=e,this._isDirty=!0;var a=t.shaderProcessingContext.bufferNames;if(i)for(var s in i)if((c=i[s])&&-1!==a.indexOf(s)){var l=c.effectiveBuffer;this.setBuffer(s,e?l:null)}for(var s in n){var c;i&&s in i||(c=n[s])&&-1!==a.indexOf(s)&&(l=c.effectiveBuffer,this.setBuffer(s,e?l:null))}-1!==a.indexOf("indices")&&this.setBuffer("indices",e?null!==(o=r)&&void 0!==o?o:this._dummyIndexBuffer:null)}},e.prototype.dispose=function(){this.indirectDrawBuffer&&(this._bufferManager.releaseBuffer(this.indirectDrawBuffer),this.indirectDrawBuffer=void 0,this._indirectDrawData=void 0),this.fastBundle=void 0,this.bindGroups=void 0,this.buffers=void 0,this._enableIndirectDraw=!1},e._Counter=0,e}(),vh=Math.pow(2,35),yh=function(){this.values={}},bh=function(){function e(e,t,n){this.disabled=!1,this._device=e,this._cacheSampler=t,this._engine=n}return Object.defineProperty(e,"Statistics",{get:function(){return{totalCreated:e.NumBindGroupsCreatedTotal,lastFrameCreated:e.NumBindGroupsCreatedLastFrame,lookupLastFrame:e.NumBindGroupsLookupLastFrame,noLookupLastFrame:e.NumBindGroupsNoLookupLastFrame}},enumerable:!1,configurable:!0}),e.ResetCache=function(){e._Cache=new yh,e.NumBindGroupsCreatedTotal=0,e.NumBindGroupsCreatedLastFrame=0,e.NumBindGroupsLookupLastFrame=0,e.NumBindGroupsNoLookupLastFrame=0,e._NumBindGroupsCreatedCurrentFrame=0,e._NumBindGroupsLookupCurrentFrame=0,e._NumBindGroupsNoLookupCurrentFrame=0},e.prototype.endFrame=function(){e.NumBindGroupsCreatedLastFrame=e._NumBindGroupsCreatedCurrentFrame,e.NumBindGroupsLookupLastFrame=e._NumBindGroupsLookupCurrentFrame,e.NumBindGroupsNoLookupLastFrame=e._NumBindGroupsNoLookupCurrentFrame,e._NumBindGroupsCreatedCurrentFrame=0,e._NumBindGroupsLookupCurrentFrame=0,e._NumBindGroupsNoLookupCurrentFrame=0},e.prototype.getBindGroups=function(t,n,r){var i,o,a,s,l,c,u,h,d,p,f=void 0,m=e._Cache,_=this.disabled||r.forceBindGroupCreation;if(!_){if(!n.isDirty(r.updateId)&&!r.isDirty)return e._NumBindGroupsNoLookupCurrentFrame++,n.bindGroups;for(var g=0,v=t.shaderProcessingContext.bufferNames;g":t})),", materialContext.uniqueId=").concat(r.uniqueId),50);continue}F[L].resource=this._cacheSampler.getSampler(U,!1,k.hashCode,U.label)}else y.V.Error('Sampler "'.concat(V,'" not found in the material context. Make sure you bound it. entry=').concat(JSON.stringify(w),", materialContext=").concat(JSON.stringify(r,(function(e,t){return"texture"===e||"sampler"===e?"":t}))),50);else if(w.texture||w.storageTexture)if(k=r.textures[V]){if(this._engine.dbgSanityChecks&&null===k.texture){y.V.Error('Trying to bind a null texture! name="'.concat(V,'", entry=').concat(JSON.stringify(w),", bindingInfo=").concat(JSON.stringify(k,(function(e,t){return"texture"===e?"":t})),", materialContext.uniqueId=").concat(r.uniqueId),50);continue}var G=k.texture._hardwareTexture;if(this._engine.dbgSanityChecks&&(!G||w.texture&&!G.view||w.storageTexture&&!G.viewForWriting)){y.V.Error("Trying to bind a null gpu texture or view! entry=".concat(JSON.stringify(w),", name=").concat(V,", bindingInfo=").concat(JSON.stringify(k,(function(e,t){return"texture"===e?"":t})),", isReady=").concat(null===(d=k.texture)||void 0===d?void 0:d.isReady,", materialContext.uniqueId=").concat(r.uniqueId),50);continue}F[L].resource=w.storageTexture?G.viewForWriting:G.view}else y.V.Error('Texture "'.concat(V,'" not found in the material context. Make sure you bound it (something like effect.setTexture("').concat(V,'", texture)). entry=').concat(JSON.stringify(w),", materialContext=").concat(JSON.stringify(r,(function(e,t){return"texture"===e||"sampler"===e?"":t}))),50);else if(w.externalTexture){var k;if(k=r.textures[V]){if(this._engine.dbgSanityChecks&&null===k.texture){y.V.Error("Trying to bind a null external texture! entry=".concat(JSON.stringify(w),", name=").concat(V,", bindingInfo=").concat(JSON.stringify(k,(function(e,t){return"texture"===e?"":t})),", materialContext.uniqueId=").concat(r.uniqueId),50);continue}var z=k.texture.underlyingResource;if(this._engine.dbgSanityChecks&&!z){y.V.Error("Trying to bind a null gpu external texture! entry=".concat(JSON.stringify(w),", name=").concat(V,", bindingInfo=").concat(JSON.stringify(k,(function(e,t){return"texture"===e?"":t})),", isReady=").concat(null===(p=k.texture)||void 0===p?void 0:p.isReady,", materialContext.uniqueId=").concat(r.uniqueId),50);continue}F[L].resource=this._device.importExternalTexture({source:z})}else y.V.Error('External texture "'.concat(V,'" not found in the material context. Make sure you bound it. entry=').concat(JSON.stringify(w),", materialContext=").concat(JSON.stringify(r,(function(e,t){return"texture"===e||"sampler"===e?"":t}))),50)}else if(w.buffer){var W=n.buffers[V];if(W){var H=W.underlyingResource;F[L].resource.buffer=H,F[L].resource.size=W.capacity}else y.V.Error("Can't find buffer \"".concat(V,'" in the draw context. Make sure you bound it. entry=').concat(JSON.stringify(w),", buffers=").concat(JSON.stringify(n.buffers),", drawContext.uniqueId=").concat(n.uniqueId),50)}}var Y=M[D];f[D]=this._device.createBindGroup({layout:Y,entries:F})}return f},e.NumBindGroupsCreatedTotal=0,e.NumBindGroupsCreatedLastFrame=0,e.NumBindGroupsLookupLastFrame=0,e.NumBindGroupsNoLookupLastFrame=0,e._Cache=new yh,e._NumBindGroupsCreatedCurrentFrame=0,e._NumBindGroupsLookupCurrentFrame=0,e._NumBindGroupsNoLookupCurrentFrame=0,e}(),Sh="clearQuadVertexShader";Bi.l.ShadersStoreWGSL[Sh]||(Bi.l.ShadersStoreWGSL[Sh]="uniform depthValue: f32;const pos=array(\nvec2f(-1.0,1.0),\nvec2f(1.0,1.0),\nvec2f(-1.0,-1.0),\nvec2f(1.0,-1.0)\n);\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvertexOutputs.position=vec4f(pos[input.vertexIndex],uniforms.depthValue,1.0);\n#define CUSTOM_VERTEX_MAIN_END\n}\n");var Th="clearQuadPixelShader";Bi.l.ShadersStoreWGSL[Th]||(Bi.l.ShadersStoreWGSL[Th]="uniform color: vec4f;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {fragmentOutputs.color=uniforms.color;}\n");var Eh=function(){function e(e,t,n){this._bindGroups={},this._bundleCache={},this._keyTemp=[],this._device=e,this._engine=t,this._cacheRenderPipeline=new uh(this._device,n),this._cacheRenderPipeline.setDepthTestEnabled(!1),this._cacheRenderPipeline.setStencilReadMask(255),this._effect=t.createEffect("clearQuad",[],["color","depthValue"],void 0,void 0,void 0,void 0,void 0,void 0,1)}return e.prototype.setDepthStencilFormat=function(e){this._depthTextureFormat=e,this._cacheRenderPipeline.setDepthStencilFormat(e)},e.prototype.setColorFormat=function(e){this._cacheRenderPipeline.setColorFormat(e)},e.prototype.setMRTAttachments=function(e,t,n){this._cacheRenderPipeline.setMRT(t,n),this._cacheRenderPipeline.setMRTAttachments(e)},e.prototype.clear=function(e,t,n,r,i){var o,a,s;void 0===i&&(i=1);var l,c=null,u=!!this._engine._currentRenderTarget;if(e)s=e;else{var h=0;this._keyTemp.length=0;for(var d=0;d1?Math.pow(2,36):0)+p*Math.pow(2,37),l=this._keyTemp.join("_"),c=this._bundleCache[l])return c;s=this._device.createRenderBundleEncoder({label:"clearQuadRenderBundle",colorFormats:this._cacheRenderPipeline.colorFormats,depthStencilFormat:this._depthTextureFormat,sampleCount:zc.GetSample(i)})}this._cacheRenderPipeline.setDepthWriteEnabled(!!n),this._cacheRenderPipeline.setStencilEnabled(!!r&&!!this._depthTextureFormat&&zc.HasStencilAspect(this._depthTextureFormat)),this._cacheRenderPipeline.setStencilWriteMask(r?255:0),this._cacheRenderPipeline.setStencilCompare(r?b.Y.ALWAYS:b.Y.NEVER),this._cacheRenderPipeline.setStencilPassOp(r?b.Y.REPLACE:b.Y.KEEP),this._cacheRenderPipeline.setWriteMask(t?15:0);var f=this._cacheRenderPipeline.getRenderPipeline(b.Y.MATERIAL_TriangleStripDrawMode,this._effect,i),m=this._effect._pipelineContext;t&&this._effect.setDirectColor4("color",t),this._effect.setFloat("depthValue",this._engine.useReverseDepthBuffer?this._engine._clearReverseDepthValue:this._engine._clearDepthValue),m.uniformBuffer.update();var _=u?this._engine._ubInvertY:this._engine._ubDontInvertY,g=m.uniformBuffer.getBuffer(),v=g.uniqueId+"-"+_.uniqueId,y=this._bindGroups[v];if(!y){var S=m.bindGroupLayouts[0];(y=this._bindGroups[v]=[]).push(this._device.createBindGroup({label:"clearQuadBindGroup0-".concat(v),layout:S[0],entries:[]})),Vu._SimplifiedKnownBindings||y.push(this._device.createBindGroup({label:"clearQuadBindGroup1-".concat(v),layout:S[1],entries:[]})),y.push(this._device.createBindGroup({label:"clearQuadBindGroup".concat(Vu._SimplifiedKnownBindings?1:2,"-").concat(v),layout:S[Vu._SimplifiedKnownBindings?1:2],entries:[{binding:0,resource:{buffer:_.underlyingResource,size:_.capacity}},{binding:1,resource:{buffer:g.underlyingResource,size:g.capacity}}]}))}for(s.setPipeline(f),d=0;d=0&&(t._gpuFrameTimeCounter.fetchNewFrame(),t._gpuFrameTimeCounter.addCount(e,!0)),t._measureDurationState=0})))},e.prototype.startPass=function(e,t){this._enabled?this._measureDuration.startPass(e,t):e.timestampWrites=void 0},e.prototype.endPass=function(e,t){if(this._enabled&&t){var n=this._engine.frameId;this._measureDuration.stopPass(e).then((function(e){t._addDuration(n,null!==e&&e>0?e:0)}))}},e.prototype.dispose=function(){var e;null===(e=this._measureDuration)||void 0===e||e.dispose()},e}(),Fh=function(){function e(e,t,n,r,i){void 0===r&&(r=2),this._count=r,this._querySet=new Dh(e,r,"timestamp",t,n,!0,i)}return e.prototype.start=function(e){var t;null===(t=e.writeTimestamp)||void 0===t||t.call(e,this._querySet.querySet,0)},e.prototype.stop=function(e){return(0,f.sH)(this,void 0,void 0,(function(){var t,n;return(0,f.YH)(this,(function(r){switch(r.label){case 0:return null===(n=e.writeTimestamp)||void 0===n||n.call(e,this._querySet.querySet,1),e.writeTimestamp?[4,this._querySet.readTwoValuesAndSubtract(0)]:[3,2];case 1:return t=r.sent(),[3,3];case 2:t=0,r.label=3;case 3:return[2,t]}}))}))},e.prototype.startPass=function(e,t){if(t+3>this._count)throw new Error("WebGPUDurationMeasure: index out of range ("+t+")");e.timestampWrites={querySet:this._querySet.querySet,beginningOfPassWriteIndex:t+2,endOfPassWriteIndex:t+3}},e.prototype.stopPass=function(e){return(0,f.sH)(this,void 0,void 0,(function(){return(0,f.YH)(this,(function(t){switch(t.label){case 0:return[4,this._querySet.readTwoValuesAndSubtract(e+2)];case 1:return[2,t.sent()]}}))}))},e.prototype.dispose=function(){this._querySet.dispose()},e}(),Lh=function(){function e(e,t,n,r,i){void 0===r&&(r=50),void 0===i&&(i=100),this._availableIndices=[],this._frameQuerySetIsDirty=-1,this._queryFrameId=[],this._engine=e,this._device=t,this._bufferManager=n,this._frameLastBuffer=-1,this._currentTotalIndices=0,this._countIncrement=i,this._allocateNewIndices(r)}return Object.defineProperty(e.prototype,"querySet",{get:function(){return this._querySet.querySet},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasQueries",{get:function(){return this._currentTotalIndices!==this._availableIndices.length},enumerable:!1,configurable:!0}),e.prototype.canBeginQuery=function(e){if(this._frameQuerySetIsDirty===this._engine.frameId||this._queryFrameId[e]===this._engine.frameId)return!1;var t=void 0!==this._engine._getCurrentRenderPassWrapper().renderPassDescriptor.occlusionQuerySet;return t&&(this._queryFrameId[e]=this._engine.frameId),t},e.prototype.createQuery=function(){0===this._availableIndices.length&&this._allocateNewIndices();var e=this._availableIndices[this._availableIndices.length-1];return this._availableIndices.length--,e},e.prototype.deleteQuery=function(e){this._availableIndices[this._availableIndices.length]=e},e.prototype.isQueryResultAvailable=function(e){return this._retrieveQueryBuffer(),!!this._lastBuffer&&e=this._allBundleLists.length?this._log("endRenderPass","empty or out-of-sync bundleList (_allBundleLists.length=".concat(this._allBundleLists.length,", playBundleListIndex=").concat(this._playBundleListIndex,")")):(this._log("endRenderPass","run bundleList #".concat(this._playBundleListIndex)),t=this._allBundleLists[this._playBundleListIndex++]),t&&(t.run(e),this._mode===b.Y.SNAPSHOTRENDERING_FAST&&this._engine._reportDrawCall(t.numDrawCalls)),!0},e.prototype.endFrame=function(){this._record&&(this._record=!1,this._play=!0,this._mode=this._modeSaved,this._log("endFrame","bundles recorded, switching to play mode")),this._playBundleListIndex=0},e.prototype.reset=function(){this._log("reset","called"),this._record&&(this._mode=this._modeSaved),this.enabled=!1,this.enabled=!0},e.prototype._log=function(e,t){this.showDebugLogs&&y.V.Log("[Frame: ".concat(this._engine.frameId,"] WebGPUSnapshotRendering:").concat(e," - ").concat(t))},e}(),Vh=n(69329),Uh=n(51428),Gh=n(62400),kh=n(608),zh=n(76320),Wh=function(e){function t(t){return e.call(this,t)||this}return(0,f.C6)(t,e),t}(mh);function Hh(e,t,n,r){var i,o=1;r===b.Y.TEXTURETYPE_FLOAT?i=new Float32Array(t*n*4):r===b.Y.TEXTURETYPE_HALF_FLOAT?(i=new Uint16Array(t*n*4),o=15360):i=r===b.Y.TEXTURETYPE_UNSIGNED_INTEGER?new Uint32Array(t*n*4):new Uint8Array(t*n*4);for(var a=0;a>v,S=[],T=0;T<6;T++)E=m[v][g[T]],d&&(E=Hh(E,y,y,i)),S.push(new Uint8Array(E.buffer,E.byteOffset,E.byteLength));this._textureHelper.updateCubeTextures(S,_.underlyingResource,y,y,_.format,h,!1,0,0)}else this.updateRawCubeTexture(p,o,r,i,h);return p.isReady=!0,null==t||t.removePendingData(p),l&&l(),[2]}}))}))})(e).catch((function(e){m(void 0,e)}))}),void 0,null==t?void 0:t.offlineProvider,!0,m),p},Hc.prototype.createRawTexture3D=function(e,t,n,r,i,o,a,s,l,c,u){void 0===l&&(l=null),void 0===c&&(c=b.Y.TEXTURETYPE_UNSIGNED_BYTE),void 0===u&&(u=0);var h=new Qi.h(this,10);return h.baseWidth=t,h.baseHeight=n,h.baseDepth=r,h.width=t,h.height=n,h.depth=r,h.format=i,h.type=c,h.generateMipMaps=o,h.samplingMode=s,h.is3D=!0,h._creationFlags=u,this._doNotHandleContextLost||(h._bufferView=e),this._textureHelper.createGPUTextureForInternalTexture(h,t,n,void 0,u),this.updateRawTexture3D(h,e,i,a,l,c),this._internalTexturesCache.push(h),h},Hc.prototype.updateRawTexture3D=function(e,t,n,r,i,o){if(void 0===i&&(i=null),void 0===o&&(o=b.Y.TEXTURETYPE_UNSIGNED_BYTE),this._doNotHandleContextLost||(e._bufferView=t,e.format=n,e.invertY=r,e._compression=i),t){var a=e._hardwareTexture;n===b.Y.TEXTUREFORMAT_RGB&&(t=Hh(t,e.width,e.height,o));var s=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);this._textureHelper.updateTexture(s,e,e.width,e.height,e.depth,a.format,0,0,r,!1,0,0),e.generateMipMaps&&this._generateMipmaps(e,this._uploadEncoder)}e.isReady=!0},Hc.prototype.createRawTexture2DArray=function(e,t,n,r,i,o,a,s,l,c,u){void 0===l&&(l=null),void 0===c&&(c=b.Y.TEXTURETYPE_UNSIGNED_BYTE),void 0===u&&(u=0);var h=new Qi.h(this,11);return h.baseWidth=t,h.baseHeight=n,h.baseDepth=r,h.width=t,h.height=n,h.depth=r,h.format=i,h.type=c,h.generateMipMaps=o,h.samplingMode=s,h.is2DArray=!0,h._creationFlags=u,this._doNotHandleContextLost||(h._bufferView=e),this._textureHelper.createGPUTextureForInternalTexture(h,t,n,r,u),this.updateRawTexture2DArray(h,e,i,a,l,c),this._internalTexturesCache.push(h),h},Hc.prototype.updateRawTexture2DArray=function(e,t,n,r,i,o){if(void 0===i&&(i=null),void 0===o&&(o=b.Y.TEXTURETYPE_UNSIGNED_BYTE),this._doNotHandleContextLost||(e._bufferView=t,e.format=n,e.invertY=r,e._compression=i),t){var a=e._hardwareTexture;n===b.Y.TEXTUREFORMAT_RGB&&(t=Hh(t,e.width,e.height,o));var s=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);this._textureHelper.updateTexture(s,e,e.width,e.height,e.depth,a.format,0,0,r,!1,0,0),e.generateMipMaps&&this._generateMipmaps(e,this._uploadEncoder)}e.isReady=!0},Hc.prototype._readTexturePixels=function(e,t,n,r,i,o,a,s,l,c){void 0===r&&(r=-1),void 0===i&&(i=0),void 0===o&&(o=null),void 0===a&&(a=!0),void 0===s&&(s=!1),void 0===l&&(l=0),void 0===c&&(c=0);var u=e._hardwareTexture;return a&&this.flushFramebuffer(),this._textureHelper.readPixels(u.underlyingResource,l,c,t,n,u.format,r,i,o,s)},Hc.prototype._readTexturePixelsSync=function(){throw"_readTexturePixelsSync is unsupported in WebGPU!"},Hc.prototype._createDepthStencilCubeTexture=function(e,t){var n=new Qi.h(this,t.generateStencil?12:14);n.isCube=!0,n.label=t.label;var r=(0,f.Cl)({bilinearFiltering:!1,comparisonFunction:0,generateStencil:!1,samples:1,depthTextureFormat:t.generateStencil?b.Y.TEXTUREFORMAT_DEPTH24_STENCIL8:b.Y.TEXTUREFORMAT_DEPTH32_FLOAT},t);n.format=r.depthTextureFormat,this._setupDepthStencilTexture(n,e,r.bilinearFiltering,r.comparisonFunction,r.samples),this._textureHelper.createGPUTextureForInternalTexture(n);var i=n._hardwareTexture;return n.type=zc.GetTextureTypeFromFormat(i.format),this._internalTexturesCache.push(n),n},Hc.prototype.createCubeTexture=function(e,t,n,r,i,o,a,s,l,c,u,h,d,p,f){var m=this;return void 0===i&&(i=null),void 0===o&&(o=null),void 0===s&&(s=null),void 0===l&&(l=!1),void 0===c&&(c=0),void 0===u&&(u=0),void 0===h&&(h=null),void 0===p&&(p=!1),void 0===f&&(f=null),this.createCubeTextureBase(e,t,n,!!r,i,o,a,s,l,c,u,h,null,(function(e,t){var n=t,o=n[0].width,s=o;m._setCubeMapTextureParams(e,!r),e.format=null!=a?a:-1;var l=m._textureHelper.createGPUTextureForInternalTexture(e,o,s);m._textureHelper.updateCubeTextures(n,l.underlyingResource,o,s,l.format,!1,!1,0,0),r||m._generateMipmaps(e,m._uploadEncoder),e.isReady=!0,e.onLoadedObservable.notifyObservers(e),e.onLoadedObservable.clear(),i&&i()}),!!p,f)},Hc.prototype._setCubeMapTextureParams=function(e,t,n){e.samplingMode=t?b.Y.TEXTURE_TRILINEAR_SAMPLINGMODE:b.Y.TEXTURE_BILINEAR_SAMPLINGMODE,e._cachedWrapU=b.Y.TEXTURE_CLAMP_ADDRESSMODE,e._cachedWrapV=b.Y.TEXTURE_CLAMP_ADDRESSMODE,n&&(e._maxLodLevel=n)},Hc.prototype.generateMipMapsForCubemap=function(e){var t;e.generateMipMaps&&((null===(t=e._hardwareTexture)||void 0===t?void 0:t.underlyingResource)||this._textureHelper.createGPUTextureForInternalTexture(e),this._generateMipmaps(e))};var Yh=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i,o)||this;return i.enableGPUTimingMeasurements&&(a.gpuTimeInFrame=new Wc.e),a}return(0,f.C6)(t,e),t}(Zl.v),Xh=n(3429);Hc.prototype._createHardwareRenderTargetWrapper=function(e,t,n){var r=new Yh(e,t,n,this);return this._renderTargetWrapperCache.push(r),r},Hc.prototype.createRenderTargetTexture=function(e,t){var n,r,i,o,a,s=this._createHardwareRenderTargetWrapper(!1,!1,e),l={};void 0!==t&&"object"==typeof t?(l.generateMipMaps=t.generateMipMaps,l.generateDepthBuffer=void 0===t.generateDepthBuffer||t.generateDepthBuffer,l.generateStencilBuffer=l.generateDepthBuffer&&t.generateStencilBuffer,l.samplingMode=void 0===t.samplingMode?b.Y.TEXTURE_TRILINEAR_SAMPLINGMODE:t.samplingMode,l.creationFlags=null!==(n=t.creationFlags)&&void 0!==n?n:0,l.noColorAttachment=!!t.noColorAttachment,l.colorAttachment=t.colorAttachment,l.samples=t.samples,l.label=t.label,l.format=t.format,l.type=t.type):(l.generateMipMaps=t,l.generateDepthBuffer=!0,l.generateStencilBuffer=!1,l.samplingMode=b.Y.TEXTURE_TRILINEAR_SAMPLINGMODE,l.creationFlags=0,l.noColorAttachment=!1);var c=l.colorAttachment||(l.noColorAttachment?null:this._createInternalTexture(e,l,!0,5));return s.label=null!==(r=l.label)&&void 0!==r?r:"RenderTargetWrapper",s._samples=null!==(a=null!==(o=null===(i=l.colorAttachment)||void 0===i?void 0:i.samples)&&void 0!==o?o:l.samples)&&void 0!==a?a:1,s._generateDepthBuffer=l.generateDepthBuffer,s._generateStencilBuffer=!!l.generateStencilBuffer,s.setTextures(c),(s._generateDepthBuffer||s._generateStencilBuffer)&&s.createDepthStencilTexture(0,!1,s._generateStencilBuffer,s.samples,l.generateStencilBuffer?b.Y.TEXTUREFORMAT_DEPTH24_STENCIL8:b.Y.TEXTUREFORMAT_DEPTH32_FLOAT,l.label?l.label+"-DepthStencil":void 0),c&&!l.colorAttachment&&(void 0!==t&&"object"==typeof t&&t.createMipMaps&&!l.generateMipMaps&&(c.generateMipMaps=!0),this._textureHelper.createGPUTextureForInternalTexture(c,void 0,void 0,void 0,l.creationFlags),void 0!==t&&"object"==typeof t&&t.createMipMaps&&!l.generateMipMaps&&(c.generateMipMaps=!1)),s},Hc.prototype._createDepthStencilTexture=function(e,t,n){var r=(0,f.Cl)({bilinearFiltering:!1,comparisonFunction:0,generateStencil:!1,samples:1,depthTextureFormat:t.generateStencil?b.Y.TEXTUREFORMAT_DEPTH24_STENCIL8:b.Y.TEXTUREFORMAT_DEPTH32_FLOAT},t),i=(0,Xh.$l)(r.depthTextureFormat);n._depthStencilTextureWithStencil=i;var o=new Qi.h(this,i?12:14);return o.label=t.label,o.format=r.depthTextureFormat,o.type=(0,Xh.GX)(o.format),this._setupDepthStencilTexture(o,e,r.bilinearFiltering,r.comparisonFunction,r.samples),this._textureHelper.createGPUTextureForInternalTexture(o),this._internalTexturesCache.push(o),o},Hc.prototype._setupDepthStencilTexture=function(e,t,n,r,i){var o,a;void 0===i&&(i=1);var s=null!==(o=t.width)&&void 0!==o?o:t,l=null!==(a=t.height)&&void 0!==a?a:t,c=t.layers||0,u=t.depth||0;e.baseWidth=s,e.baseHeight=l,e.width=s,e.height=l,e.is2DArray=c>0,e.is3D=u>0,e.depth=c||u,e.isReady=!0,e.samples=i,e.generateMipMaps=!1,e.samplingMode=n?b.Y.TEXTURE_BILINEAR_SAMPLINGMODE:b.Y.TEXTURE_NEAREST_SAMPLINGMODE,e.type=b.Y.TEXTURETYPE_FLOAT,e._comparisonFunction=r,e._cachedWrapU=b.Y.TEXTURE_CLAMP_ADDRESSMODE,e._cachedWrapV=b.Y.TEXTURE_CLAMP_ADDRESSMODE},Hc.prototype.updateRenderTargetTextureSampleCount=function(e,t){return e&&e.texture&&e.samples!==t?(t=Math.min(t,this.getCaps().maxMSAASamples),this._textureHelper.createMSAATexture(e.texture,t),e._depthStencilTexture&&(this._textureHelper.createMSAATexture(e._depthStencilTexture,t),e._depthStencilTexture.samples=t),e._samples=t,e.texture.samples=t,t):t},Hc.prototype.setDepthStencilTexture=function(e,t,n,r){n&&n.depthStencilTexture?this._setTexture(e,n,!1,!0,r):this._setTexture(e,null,void 0,void 0,r)},Hc.prototype.createRenderTargetCubeTexture=function(e,t){var n,r=this._createHardwareRenderTargetWrapper(!1,!0,e),i=(0,f.Cl)({generateMipMaps:!0,generateDepthBuffer:!0,generateStencilBuffer:!1,type:b.Y.TEXTURETYPE_UNSIGNED_BYTE,samplingMode:b.Y.TEXTURE_TRILINEAR_SAMPLINGMODE,format:b.Y.TEXTUREFORMAT_RGBA,samples:1},t);i.generateStencilBuffer=i.generateDepthBuffer&&i.generateStencilBuffer,r.label=null!==(n=i.label)&&void 0!==n?n:"RenderTargetWrapper",r._generateDepthBuffer=i.generateDepthBuffer,r._generateStencilBuffer=i.generateStencilBuffer;var o=new Qi.h(this,5);return o.width=e,o.height=e,o.depth=0,o.isReady=!0,o.isCube=!0,o.samples=i.samples,o.generateMipMaps=i.generateMipMaps,o.samplingMode=i.samplingMode,o.type=i.type,o.format=i.format,this._internalTexturesCache.push(o),r.setTextures(o),(r._generateDepthBuffer||r._generateStencilBuffer)&&r.createDepthStencilTexture(0,void 0===i.samplingMode||i.samplingMode===b.Y.TEXTURE_BILINEAR_SAMPLINGMODE||i.samplingMode===b.Y.TEXTURE_LINEAR_LINEAR||i.samplingMode===b.Y.TEXTURE_TRILINEAR_SAMPLINGMODE||i.samplingMode===b.Y.TEXTURE_LINEAR_LINEAR_MIPLINEAR||i.samplingMode===b.Y.TEXTURE_NEAREST_LINEAR_MIPNEAREST||i.samplingMode===b.Y.TEXTURE_NEAREST_LINEAR_MIPLINEAR||i.samplingMode===b.Y.TEXTURE_NEAREST_LINEAR||i.samplingMode===b.Y.TEXTURE_LINEAR_LINEAR_MIPNEAREST,r._generateStencilBuffer,r.samples),t&&t.createMipMaps&&!i.generateMipMaps&&(o.generateMipMaps=!0),this._textureHelper.createGPUTextureForInternalTexture(o),t&&t.createMipMaps&&!i.generateMipMaps&&(o.generateMipMaps=!1),r},Hc.prototype.getGPUFrameTimeCounter=function(){return this._timestampQuery.gpuFrameTimeCounter},Hc.prototype.captureGPUFrameTime=function(e){this._timestampQuery.enable=e&&!!this._caps.timerQuery},Hc.prototype.createQuery=function(){return this._occlusionQuery.createQuery()},Hc.prototype.deleteQuery=function(e){return this._occlusionQuery.deleteQuery(e),this},Hc.prototype.isQueryResultAvailable=function(e){return this._occlusionQuery.isQueryResultAvailable(e)},Hc.prototype.getQueryResult=function(e){return this._occlusionQuery.getQueryResult(e)},Hc.prototype.beginOcclusionQuery=function(e,t){var n;return this.compatibilityMode?!!this._occlusionQuery.canBeginQuery(t)&&(null===(n=this._currentRenderPass)||void 0===n||n.beginOcclusionQuery(t),!0):(this._bundleList.addItem(new Ah(t)),!0)},Hc.prototype.endOcclusionQuery=function(){var e;return this.compatibilityMode?null===(e=this._currentRenderPass)||void 0===e||e.endOcclusionQuery():this._bundleList.addItem(new Ih),this};var jh={label:"TextureView_SwapChain_ResolveTarget",dimension:"2d",format:void 0,mipLevelCount:1,arrayLayerCount:1},qh={label:"TextureView_SwapChain",dimension:"2d",format:void 0,mipLevelCount:1,arrayLayerCount:1},Kh=new Du.ov,Zh=function(e){function t(t,n){var r,i;void 0===n&&(n={});var o=e.call(this,null===(r=n.antialias)||void 0===r||r,n)||this;return o.uniqueId=-1,o._uploadEncoderDescriptor={label:"upload"},o._renderEncoderDescriptor={label:"render"},o._clearDepthValue=1,o._clearReverseDepthValue=0,o._clearStencilValue=0,o._defaultSampleCount=4,o._glslang=null,o._tintWASM=null,o._glslangAndTintAreFullyLoaded=!1,o._adapterInfo={vendor:"",architecture:"",device:"",description:"",subgroupMinSize:0,subgroupMaxSize:0,isFallbackAdapter:!1},o._compiledComputeEffects={},o._counters={numEnableEffects:0,numEnableDrawWrapper:0,numBundleCreationNonCompatMode:0,numBundleReuseNonCompatMode:0},o.countersLastFrame={numEnableEffects:0,numEnableDrawWrapper:0,numBundleCreationNonCompatMode:0,numBundleReuseNonCompatMode:0},o.numMaxUncapturedErrors=20,o.scenes=[],o._virtualScenes=new Array,o._commandBuffers=[null,null],o._mainRenderPassWrapper={renderPassDescriptor:null,colorAttachmentViewDescriptor:null,depthAttachmentViewDescriptor:null,colorAttachmentGPUTextures:[],depthTextureFormat:void 0},o._rttRenderPassWrapper={renderPassDescriptor:null,colorAttachmentViewDescriptor:null,depthAttachmentViewDescriptor:null,colorAttachmentGPUTextures:[],depthTextureFormat:void 0},o._pendingDebugCommands=[],o._currentVertexBuffers={},o._currentOverrideVertexBuffers=null,o._currentIndexBuffer=null,o._colorWriteLocal=!0,o._forceEnableEffect=!1,o.isNDCHalfZRange=!0,o.hasOriginBottomLeft=!1,o._workingGlslangAndTintPromise=null,o._viewportsCurrent={x:0,y:0,w:0,h:0},o._scissorsCurrent={x:0,y:0,w:0,h:0},o._scissorCached={x:0,y:0,z:0,w:0},o._stencilRefsCurrent=-1,o._blendColorsCurrent=[null,null,null,null],o._performanceMonitor=new Gh.r,o._name="WebGPU",o._drawCalls=new $l.A,n.deviceDescriptor=n.deviceDescriptor||{},n.enableGPUDebugMarkers=null!==(i=n.enableGPUDebugMarkers)&&void 0!==i&&i,y.V.Log("Babylon.js v".concat(Ie.$.Version," - ").concat(o.description," engine")),navigator.gpu?(n.swapChainFormat=n.swapChainFormat||navigator.gpu.getPreferredCanvasFormat(),o._isWebGPU=!0,o._shaderPlatformName="WEBGPU",o._renderingCanvas=t,o._options=n,o._mainPassSampleCount=n.antialias?o._defaultSampleCount:1,navigator&&navigator.userAgent&&o._setupMobileChecks(),o._sharedInit(o._renderingCanvas),o._shaderProcessor=new Uu,o._shaderProcessorWGSL=new Wu,o):(y.V.Error("WebGPU is not supported by your browser."),o)}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"snapshotRenderingMode",{get:function(){return this._snapshotRendering.mode},set:function(e){this._snapshotRendering.mode=e},enumerable:!1,configurable:!0}),t.prototype.snapshotRenderingReset=function(){this._snapshotRendering.reset()},Object.defineProperty(t.prototype,"snapshotRendering",{get:function(){return this._snapshotRendering.enabled},set:function(e){this._snapshotRendering.enabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"disableCacheSamplers",{get:function(){return!!this._cacheSampler&&this._cacheSampler.disabled},set:function(e){this._cacheSampler&&(this._cacheSampler.disabled=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"disableCacheRenderPipelines",{get:function(){return!!this._cacheRenderPipeline&&this._cacheRenderPipeline.disabled},set:function(e){this._cacheRenderPipeline&&(this._cacheRenderPipeline.disabled=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"disableCacheBindGroups",{get:function(){return!!this._cacheBindGroups&&this._cacheBindGroups.disabled},set:function(e){this._cacheBindGroups&&(this._cacheBindGroups.disabled=e)},enumerable:!1,configurable:!0}),t.prototype.areAllEffectsReady=function(){return!0},t.prototype.getFontOffset=function(e){return(0,kh.PR)(e)},Object.defineProperty(t,"IsSupportedAsync",{get:function(){return navigator.gpu?navigator.gpu.requestAdapter().then((function(e){return!!e}),(function(){return!1})).catch((function(){return!1})):Promise.resolve(!1)},enumerable:!1,configurable:!0}),Object.defineProperty(t,"IsSupported",{get:function(){return y.V.Warn("You must call IsSupportedAsync for WebGPU!"),!1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"supportsUniformBuffers",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"supportedExtensions",{get:function(){return this._adapterSupportedExtensions},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enabledExtensions",{get:function(){return this._deviceEnabledExtensions},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"supportedLimits",{get:function(){return this._adapterSupportedLimits},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"currentLimits",{get:function(){return this._deviceLimits},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"description",{get:function(){return this.name+this.version},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"version",{get:function(){return 1},enumerable:!1,configurable:!0}),t.prototype.getInfo=function(){return{vendor:this._adapterInfo.vendor||"unknown vendor",renderer:this._adapterInfo.architecture||"unknown renderer",version:this._adapterInfo.description||"unknown version"}},Object.defineProperty(t.prototype,"compatibilityMode",{get:function(){return this._compatibilityMode},set:function(e){this._compatibilityMode=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"currentSampleCount",{get:function(){return this._currentRenderTarget?this._currentRenderTarget.samples:this._mainPassSampleCount},enumerable:!1,configurable:!0}),t.CreateAsync=function(e,n){void 0===n&&(n={});var r=new t(e,n);return new Promise((function(e){r.initAsync(n.glslangOptions,n.twgslOptions).then((function(){return e(r)}))}))},t.prototype.prepareGlslangAndTintAsync=function(){var e=this;return this._workingGlslangAndTintPromise||(this._workingGlslangAndTintPromise=new Promise((function(t){var n,r;e._initGlslangAsync(null!==(n=e._glslangOptions)&&void 0!==n?n:null===(r=e._options)||void 0===r?void 0:r.glslangOptions).then((function(n){var r,i;e._glslang=n,e._tintWASM=new wh,e._tintWASM.initTwgsl(null!==(r=e._twgslOptions)&&void 0!==r?r:null===(i=e._options)||void 0===i?void 0:i.twgslOptions).then((function(){e._glslangAndTintAreFullyLoaded=!0,t()}))}))}))),this._workingGlslangAndTintPromise},t.prototype.initAsync=function(e,n){var r=this;return this.uniqueId=t._InstanceId++,this._glslangOptions=e,this._twgslOptions=n,navigator.gpu.requestAdapter(this._options).then((function(e){return(0,f.sH)(r,void 0,void 0,(function(){var t,n,r,i,o,a,s,l,c,u,h=this;return(0,f.YH)(this,(function(d){switch(d.label){case 0:if(e)return[3,1];throw"Could not retrieve a WebGPU adapter (adapter is null).";case 1:if(this._adapter=e,this._adapterSupportedExtensions=[],null===(l=this._adapter.features)||void 0===l||l.forEach((function(e){h._adapterSupportedExtensions.push(e)})),this._adapterSupportedLimits=this._adapter.limits,this._adapterInfo=this._adapter.info,t=null!==(c=this._options.deviceDescriptor)&&void 0!==c?c:{},n=null!==(u=null==t?void 0:t.requiredFeatures)&&void 0!==u?u:this._options.enableAllFeatures?this._adapterSupportedExtensions:void 0){for(r=[],i=0,o=n;i=0;this._caps={maxTexturesImageUnits:this._deviceLimits.maxSampledTexturesPerShaderStage,maxVertexTextureImageUnits:this._deviceLimits.maxSampledTexturesPerShaderStage,maxCombinedTexturesImageUnits:2*this._deviceLimits.maxSampledTexturesPerShaderStage,maxTextureSize:this._deviceLimits.maxTextureDimension2D,maxCubemapTextureSize:this._deviceLimits.maxTextureDimension2D,maxRenderTextureSize:this._deviceLimits.maxTextureDimension2D,maxVertexAttribs:this._deviceLimits.maxVertexAttributes,maxDrawBuffers:8,maxVaryingVectors:this._deviceLimits.maxInterStageShaderVariables,maxFragmentUniformVectors:Math.floor(this._deviceLimits.maxUniformBufferBindingSize/4),maxVertexUniformVectors:Math.floor(this._deviceLimits.maxUniformBufferBindingSize/4),shaderFloatPrecision:23,standardDerivatives:!0,astc:this._deviceEnabledExtensions.indexOf("texture-compression-astc")>=0||void 0,s3tc:this._deviceEnabledExtensions.indexOf("texture-compression-bc")>=0||void 0,pvrtc:null,etc1:null,etc2:this._deviceEnabledExtensions.indexOf("texture-compression-etc2")>=0||void 0,bptc:this._deviceEnabledExtensions.indexOf("texture-compression-bc")>=0||void 0,maxAnisotropy:16,uintIndices:!0,fragmentDepthSupported:!0,highPrecisionShaderSupported:!0,colorBufferFloat:!0,blendFloat:this._deviceEnabledExtensions.indexOf("float32-blendable")>=0,supportFloatTexturesResolve:!1,rg11b10ufColorRenderable:this._deviceEnabledExtensions.indexOf("rg11b10ufloat-renderable")>=0,textureFloat:!0,textureFloatLinearFiltering:this._deviceEnabledExtensions.indexOf("float32-filterable")>=0,textureFloatRender:!0,textureHalfFloat:!0,textureHalfFloatLinearFiltering:!0,textureHalfFloatRender:!0,textureLOD:!0,texelFetch:!0,drawBuffersExtension:!0,depthTextureExtension:!0,vertexArrayObject:!1,instancedArrays:!0,timerQuery:"undefined"!=typeof BigUint64Array&&-1!==this._deviceEnabledExtensions.indexOf("timestamp-query")||void 0,supportOcclusionQuery:"undefined"!=typeof BigUint64Array,canUseTimestampForTimerQuery:!0,multiview:!1,oculusMultiview:!1,parallelShaderCompile:void 0,blendMinMax:!0,maxMSAASamples:4,canUseGLInstanceID:!0,canUseGLVertexID:!0,supportComputeShaders:!0,supportSRGBBuffers:!0,supportTransformFeedbacks:!1,textureMaxLevel:!0,texture2DArrayMaxLayerCount:this._deviceLimits.maxTextureArrayLayers,disableMorphTargetTexture:!1,textureNorm16:e,blendParametersPerTarget:!0,dualSourceBlending:!0},this._features={forceBitmapOverHTMLImageElement:!0,supportRenderAndCopyToLodForFloatTextures:!0,supportDepthStencilTexture:!0,supportShadowSamplers:!0,uniformBufferHardCheckMatrix:!1,allowTexturePrefiltering:!0,trackUbosInFrame:!0,checkUbosContentBeforeUpload:!0,supportCSM:!0,basisNeedsPOT:!1,support3DTextures:!0,needTypeSuffixInShaderConstants:!0,supportMSAA:!0,supportSSAO2:!0,supportIBLShadows:!0,supportExtendedTextureFormats:!0,supportSwitchCaseInShader:!0,supportSyncTextureRead:!1,needsInvertingBitmap:!1,useUBOBindingCache:!1,needShaderCodeInlining:!0,needToAlwaysBindUniformBuffers:!0,supportRenderPasses:!0,supportSpriteInstancing:!0,forceVertexBufferStrideAndOffsetMultiple4Bytes:!0,_checkNonFloatVertexBuffersDontRecreatePipelineContext:!0,_collectUbosUpdatedInFrame:!1},this._alphaState=new Vh.i(this._caps.blendParametersPerTarget)},t.prototype._initializeContextAndSwapChain=function(){if(!this._renderingCanvas)throw"The rendering canvas has not been set!";this._context=this._renderingCanvas.getContext("webgpu"),this._configureContext(),this._colorFormat=this._options.swapChainFormat,this._mainRenderPassWrapper.colorAttachmentGPUTextures=[new Hu(this)],this._mainRenderPassWrapper.colorAttachmentGPUTextures[0].format=this._colorFormat,this._setColorFormat(this._mainRenderPassWrapper)},t.prototype._initializeMainAttachments=function(){if(this._bufferManager){this.flushFramebuffer(),this._mainTextureExtends={width:this.getRenderWidth(!0),height:this.getRenderHeight(!0),depthOrArrayLayers:1};var e,t=new Float32Array([this.getRenderHeight(!0)]);if(this._bufferManager.setSubData(this._ubInvertY,4,t),this._bufferManager.setSubData(this._ubDontInvertY,4,t),this._options.antialias){var n={label:"Texture_MainColor_".concat(this._mainTextureExtends.width,"x").concat(this._mainTextureExtends.height,"_antialiasing"),size:this._mainTextureExtends,mipLevelCount:1,sampleCount:this._mainPassSampleCount,dimension:"2d",format:this._options.swapChainFormat,usage:16};this._mainTexture&&this._textureHelper.releaseTexture(this._mainTexture),this._mainTexture=this._device.createTexture(n),e=[{view:this._mainTexture.createView({label:"TextureView_MainColor_antialiasing",dimension:"2d",format:this._options.swapChainFormat,mipLevelCount:1,arrayLayerCount:1}),clearValue:new Du.ov(0,0,0,1),loadOp:"clear",storeOp:"store"}]}else e=[{view:void 0,clearValue:new Du.ov(0,0,0,1),loadOp:"clear",storeOp:"store"}];this._mainRenderPassWrapper.depthTextureFormat=this.isStencilEnable?"depth24plus-stencil8":"depth32float",this._setDepthTextureFormat(this._mainRenderPassWrapper),this._setColorFormat(this._mainRenderPassWrapper);var r={label:"Texture_MainDepthStencil_".concat(this._mainTextureExtends.width,"x").concat(this._mainTextureExtends.height),size:this._mainTextureExtends,mipLevelCount:1,sampleCount:this._mainPassSampleCount,dimension:"2d",format:this._mainRenderPassWrapper.depthTextureFormat,usage:16};this._depthTexture&&this._textureHelper.releaseTexture(this._depthTexture),this._depthTexture=this._device.createTexture(r);var i={view:this._depthTexture.createView({label:"TextureView_MainDepthStencil_".concat(this._mainTextureExtends.width,"x").concat(this._mainTextureExtends.height),dimension:"2d",format:this._depthTexture.format,mipLevelCount:1,arrayLayerCount:1}),depthClearValue:this._clearDepthValue,depthLoadOp:"clear",depthStoreOp:"store",stencilClearValue:this._clearStencilValue,stencilLoadOp:this.isStencilEnable?"clear":void 0,stencilStoreOp:this.isStencilEnable?"store":void 0};this._mainRenderPassWrapper.renderPassDescriptor={label:"MainRenderPass",colorAttachments:e,depthStencilAttachment:i},this.beginFrame(),this._startMainRenderPass(!0,null,!0,!1),this._endCurrentRenderPass(),this.endFrame(),this._frameId--}},t.prototype._sharedInit=function(t){e.prototype._sharedInit.call(this,t),(0,kh.BG)(this,t,this._creationOptions)},t.prototype._configureContext=function(){this._context.configure({device:this._device,format:this._options.swapChainFormat,usage:17,alphaMode:this.premultipliedAlpha?"premultiplied":"opaque"})},t.prototype.resizeImageBitmap=function(e,t,n){return(0,kh.jf)(this,e,t,n)},t.prototype._createImageBitmapFromSource=function(e,t){return(0,f.sH)(this,void 0,void 0,(function(){return(0,f.YH)(this,(function(n){switch(n.label){case 0:return[4,(0,kh.kF)(this,e,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.switchFullscreen=function(e){this.isFullscreen?this.exitFullscreen():this.enterFullscreen(e)},t.prototype.enterFullscreen=function(e){this.isFullscreen||(this._pointerLockRequested=e,this._renderingCanvas&&(0,kh.tl)(this._renderingCanvas))},t.prototype.exitFullscreen=function(){this.isFullscreen&&(0,kh.g7)()},t.prototype.enterPointerlock=function(){this._renderingCanvas&&(0,kh.eG)(this._renderingCanvas)},t.prototype.exitPointerlock=function(){(0,kh.rT)()},t.prototype._rebuildBuffers=function(){e.prototype._rebuildBuffers.call(this);for(var t=0,n=this._storageBuffers;t=0,i=t.indexOf(b.Y.DISABLEUA)>=0,o=0===n?this._compileRawShaderToSpirV(e,"vertex"):e,a=0===n?this._compileRawShaderToSpirV(t,"fragment"):t;return this._createPipelineStageDescriptor(o,a,n,r,i)},t.prototype._compilePipelineStageDescriptor=function(e,t,n,r){this.onBeforeShaderCompilationObservable.notifyObservers(this);var i=e.indexOf(b.Y.DISABLEUA)>=0,o=t.indexOf(b.Y.DISABLEUA)>=0,a="#version 450\n",s=0===r?this._compileShaderToSpirV(e,"vertex",n,a):this._getWGSLShader(e,"vertex",n),l=0===r?this._compileShaderToSpirV(t,"fragment",n,a):this._getWGSLShader(t,"fragment",n),c=this._createPipelineStageDescriptor(s,l,r,i,o);return this.onAfterShaderCompilationObservable.notifyObservers(this),c},t.prototype.createRawShaderProgram=function(){throw"Not available on WebGPU"},t.prototype.createShaderProgram=function(){throw"Not available on WebGPU"},t.prototype.inlineShaderCode=function(e){var t=new vc(e);return t.debug=!1,t.processCode(),t.code},t.prototype.createPipelineContext=function(e){return new wu(e,this)},t.prototype.createMaterialContext=function(){return new _h},t.prototype.createDrawContext=function(){return new gh(this._bufferManager,this._dummyIndexBuffer)},t.prototype._preparePipelineContextAsync=function(e,t,n,r,i,o,a,s,l,c,u){return(0,f.sH)(this,void 0,void 0,(function(){var a,l;return(0,f.YH)(this,(function(c){switch(c.label){case 0:return 0!==(l=(a=e).shaderProcessingContext.shaderLanguage)||this._glslangAndTintAreFullyLoaded?[3,2]:[4,this.prepareGlslangAndTintAsync()];case 1:c.sent(),c.label=2;case 2:return this.dbgShowShaderCode&&(y.V.Log(["defines",s]),y.V.Log(t),y.V.Log(n),y.V.Log("***********************************************")),a.sources={fragment:n,vertex:t,rawVertex:i,rawFragment:o},a.stages=r?this._compileRawPipelineStageDescriptor(t,n,l):this._compilePipelineStageDescriptor(t,n,s,l),u(),[2]}}))}))},t.prototype.getAttributes=function(e,t){for(var n=new Array(t.length),r=e,i=0;i0,d.is3D=m>0,d._cachedWrapU=b.Y.TEXTURE_CLAMP_ADDRESSMODE,d._cachedWrapV=b.Y.TEXTURE_CLAMP_ADDRESSMODE,d._useSRGBBuffer=h.useSRGBBuffer,d.label=h.label,this._internalTexturesCache.push(d),!n){var g=!h.generateMipMaps&&h.createMipMaps;g&&(d.generateMipMaps=!0),this._textureHelper.createGPUTextureForInternalTexture(d,p,f,_||1,h.creationFlags),g&&(d.generateMipMaps=!1)}return d},t.prototype.createTexture=function(e,t,n,r,i,o,a,s,l,c,u,h,d,p,f){var m=this;return void 0===i&&(i=b.Y.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===o&&(o=null),void 0===a&&(a=null),void 0===s&&(s=null),void 0===l&&(l=null),void 0===c&&(c=null),void 0===u&&(u=null),this._createTextureBase(e,t,n,r,i,o,a,(function(e,t,n,r,i,o,a,s){var l,u=r;if(e.baseWidth=u.width,e.baseHeight=u.height,e.width=u.width,e.height=u.height,e.format=-1!==e.format?e.format:null!=c?c:b.Y.TEXTUREFORMAT_RGBA,e.type=-1!==e.type?e.type:b.Y.TEXTURETYPE_UNSIGNED_BYTE,e._creationFlags=null!=p?p:0,s(e.width,e.height,u,t,e,(function(){})),null===(l=e._hardwareTexture)||void 0===l?void 0:l.underlyingResource)o||a||m._generateMipmaps(e,m._uploadEncoder);else{var h=m._textureHelper.createGPUTextureForInternalTexture(e,u.width,u.height,void 0,p);zc.IsImageBitmap(u)&&(m._textureHelper.updateTexture(u,e,u.width,u.height,e.depth,h.format,0,0,i,!1,0,0),o||a||m._generateMipmaps(e,m._uploadEncoder))}n&&n.removePendingData(e),e.isReady=!0,e.onLoadedObservable.notifyObservers(e),e.onLoadedObservable.clear()}),(function(){return!1}),s,l,c,u,h,d,f)},t.prototype.wrapWebGPUTexture=function(e){var t=new Hu(this,e),n=new Qi.h(this,0,!0);return n._hardwareTexture=t,n.isReady=!0,n},t.prototype.wrapWebGLTexture=function(){throw new Error("wrapWebGLTexture is not supported, use wrapWebGPUTexture instead.")},t.prototype._getUseSRGBBuffer=function(e,t){return e&&this._caps.supportSRGBBuffers},t.prototype._unpackFlipY=function(e){},t.prototype.updateTextureSamplingMode=function(e,t,n){void 0===n&&(n=!1),n&&(t.generateMipMaps=!0,this._generateMipmaps(t)),t.samplingMode=e},t.prototype.updateTextureWrappingMode=function(e,t,n,r){void 0===n&&(n=null),void 0===r&&(r=null),null!==t&&(e._cachedWrapU=t),null!==n&&(e._cachedWrapV=n),(e.is2DArray||e.is3D)&&null!==r&&(e._cachedWrapR=r)},t.prototype.updateTextureDimensions=function(e,t,n,r){if(void 0===r&&(r=1),e._hardwareTexture&&(e.width!==t||e.height!==n||e.depth!==r)){var i=e._hardwareTexture.textureAdditionalUsages;e._hardwareTexture.release(),this._textureHelper.createGPUTextureForInternalTexture(e,t,n,r,i)}},t.prototype._setInternalTexture=function(e,t,n){if(n=null!=n?n:e,this._currentEffect){var r=this._currentEffect._pipelineContext.shaderProcessingContext.availableTextures[n];if(this._currentMaterialContext.setTexture(e,t),r&&r.autoBindSampler){var i=n+b.Y.AUTOSAMPLERSUFFIX;this._currentMaterialContext.setSampler(i,t)}}},t.prototype.createPrefilteredCubeTexture=function(e,t,n,r,i,o,a,s,l){return void 0===i&&(i=null),void 0===o&&(o=null),void 0===s&&(s=null),void 0===l&&(l=!0),this.createCubeTexture(e,t,null,!1,(function(e){if(e){var t=e.texture;l?e.info.sphericalPolynomial&&(t._sphericalPolynomial=e.info.sphericalPolynomial):t._sphericalPolynomial=new Uh.Q,t._source=9,i&&i(t)}else i&&i(null)}),o,a,s,l,n,r)},t.prototype.setTexture=function(e,t,n,r){this._setTexture(e,n,!1,!1,r,r)},t.prototype.setTextureArray=function(e,t,n,r){for(var i=0;i=b.Y.TEXTUREFORMAT_DEPTH24_STENCIL8&&f.format<=b.Y.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8;((null==f?void 0:f.type)===b.Y.TEXTURETYPE_FLOAT&&!this._caps.textureFloatLinearFiltering||m)&&(u|=h),h<<=1}this._currentMaterialContext.textureState=u;var _=this._cacheRenderPipeline.getRenderPipeline(t,this._currentEffect,this.currentSampleCount,u),g=this._cacheBindGroups.getBindGroups(l,this._currentDrawContext,this._currentMaterialContext);this._snapshotRendering.record||(this._applyRenderPassChanges(this.compatibilityMode?null:s),this.compatibilityMode||(this._counters.numBundleCreationNonCompatMode++,c=this._device.createRenderBundleEncoder({colorFormats:this._cacheRenderPipeline.colorFormats,depthStencilFormat:this._depthTextureFormat,sampleCount:zc.GetSample(this.currentSampleCount)}))),c.setPipeline(_),this._currentIndexBuffer&&c.setIndexBuffer(this._currentIndexBuffer.underlyingResource,this._currentIndexBuffer.is32Bits?"uint32":"uint16",0);for(var v=this._cacheRenderPipeline.vertexBuffers,y=0;y0;for(var i in e){var o=e[i],a=n[i],s=a.group,l=a.binding,c=o.type,u=o.object,h=o.indexInGroupEntries;switch((b=this._bindGroupEntries[s])||(b=this._bindGroupEntries[s]=[]),c){case 5:var d=u;void 0!==h&&r?b[h].resource=this._cacheSampler.getSampler(d):(o.indexInGroupEntries=b.length,b.push({binding:l,resource:this._cacheSampler.getSampler(d)}));break;case 0:case 4:var p=(f=u)._texture._hardwareTexture;void 0!==h&&r?(0===c&&(b[h++].resource=this._cacheSampler.getSampler(f._texture)),b[h].resource=p.view):(o.indexInGroupEntries=b.length,0===c&&b.push({binding:l-1,resource:this._cacheSampler.getSampler(f._texture)}),b.push({binding:l,resource:p.view}));break;case 8:p=(f=u)._hardwareTexture,void 0!==h&&r?b[h].resource=p.view:(o.indexInGroupEntries=b.length,b.push({binding:l,resource:p.view}));break;case 1:8&(p=(f=u)._texture._hardwareTexture).textureAdditionalUsages||y.V.Error("computeDispatch: The texture (name=".concat(f.name,", uniqueId=").concat(f.uniqueId,") is not a storage texture!"),50),void 0!==h&&r?b[h].resource=p.viewForWriting:(o.indexInGroupEntries=b.length,b.push({binding:l,resource:p.viewForWriting}));break;case 6:var f,m=(f=u).underlyingResource;void 0!==h&&r?b[h].resource=this._device.importExternalTexture({source:m}):(o.indexInGroupEntries=b.length,b.push({binding:l,resource:this._device.importExternalTexture({source:m})}));break;case 2:case 3:case 7:var _=7===c?u:u.getBuffer(),g=_.underlyingResource;void 0!==h&&r?(b[h].resource.buffer=g,b[h].resource.size=_.capacity):(o.indexInGroupEntries=b.length,b.push({binding:l,resource:{buffer:g,offset:0,size:_.capacity}}))}}for(var v=0;v0&&d.dispatchWorkgroups(r,i,o),d.end(),c&&(this._timestampQuery.endPass(this._timestampIndex,c),this._timestampIndex+=2)},Zh.prototype.releaseComputeEffects=function(){for(var e in this._compiledComputeEffects){var t=this._compiledComputeEffects[e].getPipelineContext();this._deleteComputePipelineContext(t)}this._compiledComputeEffects={}},Zh.prototype._prepareComputePipelineContext=function(e,t,n,r,i){var o=e;this.dbgShowShaderCode&&(y.V.Log(r),y.V.Log(t)),o.sources={compute:t,rawCompute:n},o.stage=this._createComputePipelineStageDescriptor(t,r,i)},Zh.prototype._releaseComputeEffect=function(e){this._compiledComputeEffects[e._key]&&(delete this._compiledComputeEffects[e._key],this._deleteComputePipelineContext(e.getPipelineContext()))},Zh.prototype._rebuildComputeEffects=function(){for(var e in this._compiledComputeEffects){var t=this._compiledComputeEffects[e];t._pipelineContext=null,t._wasPreviouslyReady=!1,t._prepareEffect()}},Zh.prototype._executeWhenComputeStateIsCompiled=function(e,t){e.stage.module.getCompilationInfo().then((function(e){for(var n={numErrors:0,messages:[]},r=0,i=e.messages;r0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"innerType",{get:function(){return this._linkedConnectionSource&&!this._isMainLinkSource&&this._linkedConnectionSource.isConnected?this.type:this._type},enumerable:!1,configurable:!0}),e.prototype.createCustomInputBlock=function(){return null},e.prototype.getClassName=function(){return"NodeRenderGraphConnectionPoint"},e.prototype.canConnectTo=function(e){return 0===this.checkCompatibilityState(e)},e.prototype.checkCompatibilityState=function(e){var t=this._ownerBlock,n=e.ownerBlock;if(this.type!==e.type&&e.innerType!==Ap.AutoDetect)return e.acceptedConnectionPointTypes&&-1!==e.acceptedConnectionPointTypes.indexOf(this.type)?0:1;if(e.excludedConnectionPointTypes&&-1!==e.excludedConnectionPointTypes.indexOf(this.type))return 1;var r=n,i=t;return 0===this.direction&&(r=t,i=n),r.isAnAncestorOf(i)?2:0},e.prototype.connectTo=function(e,t){if(void 0===t&&(t=!1),!t&&!this.canConnectTo(e))throw'Cannot connect these two connectors. source: "'.concat(this.ownerBlock.name,'".').concat(this.name,', target: "').concat(e.ownerBlock.name,'".').concat(e.name);return this._endpoints.push(e),e._connectedPoint=this,this.onConnectionObservable.notifyObservers(e),e.onConnectionObservable.notifyObservers(this),this},e.prototype.disconnectFrom=function(e){var t=this._endpoints.indexOf(e);return-1===t||(this._endpoints.splice(t,1),e._connectedPoint=null,this.onDisconnectionObservable.notifyObservers(e),e.onDisconnectionObservable.notifyObservers(this)),this},e.prototype.addExcludedConnectionPointFromAllowedTypes=function(e){for(var t=0,n=Math.pow(2,t);n=0)&&(t.isExposedOnFrame=!0,t.exposedPortPosition=this.exposedPortPosition),t},e.prototype.dispose=function(){this.onConnectionObservable.clear(),this.onDisconnectionObservable.clear()},e}(),Lp=function(){function e(e,t,n){for(var r=[],i=3;i1&&(m+=f),o+=m}})),o},Object.defineProperty(e.prototype,"backBufferTextureOverriden",{get:function(){return this._backBufferTextureOverriden},enumerable:!1,configurable:!0}),e.prototype.setBackBufferTextures=function(e,t,n,r){var i,o,a,s;if(!(0!==e&&0!==t||n&&r)){if(this._backBufferTextureOverriden){var l=this._textures.get(Ll.O);null===(i=l.texture)||void 0===i||i.dispose(),l.texture=null,null===(o=l.debug)||void 0===o||o.dispose(),l.debug=void 0,null===(a=(l=this._textures.get(Ll.m)).texture)||void 0===a||a.dispose(),l.texture=null,null===(s=l.debug)||void 0===s||s.dispose(),l.debug=void 0}return this._backBufferTextureEntry=null,this._backBufferDepthStencilTextureEntry=null,this._backBufferTextureOverriden=!1,void this._addSystemTextures()}this._backBufferTextureOverriden=!0;var c={width:e,height:t};this._backBufferTextureEntry={name:"backbuffer color",texture:null,creationOptions:null!=n?n:{size:c,options:{createMipMaps:!1,samples:this.engine.getCreationOptions().antialias?4:1,types:[b.Y.TEXTURETYPE_UNSIGNED_BYTE],formats:[b.Y.TEXTUREFORMAT_RGBA],useSRGBBuffers:[!1],creationFlags:[0],labels:["backbuffer color"]},sizeIsPercentage:!1},namespace:zp.Graph,lifespan:{firstTask:Number.MAX_VALUE,lastTask:0}},this._backBufferTextureEntry.textureDescriptionHash=this._createTextureDescriptionHash(this._backBufferTextureEntry.creationOptions),this._backBufferDepthStencilTextureEntry={name:"backbuffer depth/stencil",texture:null,creationOptions:null!=r?r:{size:c,options:{createMipMaps:!1,samples:this.engine.getCreationOptions().antialias?4:1,types:[b.Y.TEXTURETYPE_UNSIGNED_BYTE],formats:[this.engine.isStencilEnable?b.Y.TEXTUREFORMAT_DEPTH24_STENCIL8:b.Y.TEXTUREFORMAT_DEPTH32_FLOAT],useSRGBBuffers:[!1],creationFlags:[0],labels:["backbuffer depth/stencil"]},sizeIsPercentage:!1},namespace:zp.Graph,lifespan:{firstTask:Number.MAX_VALUE,lastTask:0}},this._backBufferDepthStencilTextureEntry.textureDescriptionHash=this._createTextureDescriptionHash(this._backBufferDepthStencilTextureEntry.creationOptions),this._addSystemTextures()},e.prototype.resetBackBufferTextures=function(){this.setBackBufferTextures(0,0)},Object.defineProperty(e.prototype,"hasHistoryTextures",{get:function(){return this._historyTextures.size>0},enumerable:!1,configurable:!0}),e.prototype._dispose=function(){this._releaseTextures()},e.prototype._allocateTextures=function(e){var t=this;e&&this._optimizeTextureAllocation(e),this._textures.forEach((function(e){var n,r,i,o,a,s,l,c;if(!e.texture)if(void 0!==e.refHandle){var u=t._textures.get(e.refHandle);e.texture=u.texture,null===(n=e.texture)||void 0===n||n.incrementReferences(),u.refHandle===Ll.O&&(e.refHandle=Ll.O),u.refHandle===Ll.m&&(e.refHandle=Ll.m)}else if(e.namespace!==zp.External)if(void 0!==e.aliasHandle){var h=t._textures.get(e.aliasHandle);e.texture=h.texture,e.texture.incrementReferences()}else{var d=e.creationOptions,p=d.sizeIsPercentage?t.getAbsoluteDimensions(d.size):d.size,f=e.textureIndex||0,m={createMipMaps:d.options.createMipMaps,samples:d.options.samples,type:null===(r=d.options.types)||void 0===r?void 0:r[f],format:null===(i=d.options.formats)||void 0===i?void 0:i[f],useSRGBBuffer:null===(o=d.options.useSRGBBuffers)||void 0===o?void 0:o[f],creationFlags:null===(a=d.options.creationFlags)||void 0===a?void 0:a[f],label:null!==(l=null===(s=d.options.labels)||void 0===s?void 0:s[f])&&void 0!==l?l:"".concat(e.name).concat(f>0?"#"+f:""),samplingMode:b.Y.TEXTURE_NEAREST_SAMPLINGMODE,createMSAATexture:d.options.samples>1},_=(0,Xh.vl)(m.format),g=(0,Xh.$l)(m.format),v=_&&g?12:_||g?14:5,y=t.engine._createInternalTexture(p,m,!1,v);_&&(y.type=(0,Xh.GX)(y.format)),e.texture=y}e.texture&&void 0===e.refHandle&&(null===(c=e.debug)||void 0===c||c.dispose(),e.debug=t._createDebugTexture(e.name,e.texture))})),this._historyTextures.forEach((function(e){for(var n=0;n1&&0===a){for(var m=r.options.types.length,_={size:(0,Xp.e)(r.size)?r.size:{width:r.size,height:r.size},options:r.options,sizeIsPercentage:r.sizeIsPercentage},g=1;g=s.firstTask){m=!0;break}}if(!m){this.showDebugLogsForTextureAllcationOptimization&&y.V.Log("Texture ".concat(i," (").concat(o.name,") reuses cache entry ").concat(p)),f.push(s),o.aliasHandle=p,c=!0;break}}c||l.push([i,[s]])}else t.set(a,[[i,[s]]])}}},e.prototype._computeTextureLifespan=function(e){this.showDebugLogsForTextureAllcationOptimization&&y.V.Log("================== Dump of texture dependencies for all tasks/passes ==================");for(var t=0;t0&&this._computeTextureLifespanForPasses(n,t,n.passes),n.passesDisabled.length>0&&this._computeTextureLifespanForPasses(n,t,n.passesDisabled),n.dependencies&&(this.showDebugLogsForTextureAllcationOptimization&&y.V.Log("task#".concat(t," (").concat(n.name,"), global dependencies")),this._updateLifespan(100*t+99,n.dependencies))}if(this.showDebugLogsForTextureAllcationOptimization){y.V.Log("================== Texture lifespans ==================");for(var r=this._textures.keys(),i=r.next();!0!==i.done;i=r.next()){var o=i.value,a=this._textures.get(o);void 0!==a.refHandle||a.namespace===zp.External||this._historyTextures.has(o)||y.V.Log("".concat(o," (").concat(a.name,"): ").concat(a.lifespan.firstTask," - ").concat(a.lifespan.lastTask))}}},e.prototype._computeTextureLifespanForPasses=function(e,t,n){for(var r=0;r0&&0!==(o.layerMask&e.camera.layerMask)&&(e._scene.skipFrustumClipping||o.alwaysSelectAsActiveMesh||o.isInFrustum(n))&&e.outputObjectList.meshes.push(o)}}}));var n=this._frameGraph.addCullPass(this.name+"_disabled",!0);n.setObjectList(this.outputObjectList),n.setExecuteFunc((function(t){e.outputObjectList.meshes=e.objectList.meshes,e.outputObjectList.particleSystems=e.objectList.particleSystems}))},t}(wl.L),lf=function(e){function t(t,n,r){var i=e.call(this,t,n,r)||this;return i.registerInput("camera",Ap.Camera),i.registerInput("objects",Ap.ObjectList),i._addDependenciesInput(),i.registerOutput("output",Ap.ObjectList),i._frameGraphTask=new sf(i.name,n,r),i}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"task",{get:function(){return this._frameGraphTask},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"NodeRenderGraphCullObjectsBlock"},Object.defineProperty(t.prototype,"camera",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"objects",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(t){var n,r;e.prototype._buildBlock.call(this,t),this.output.value=this._frameGraphTask.outputObjectList,this._frameGraphTask.camera=null===(n=this.camera.connectedPoint)||void 0===n?void 0:n.value,this._frameGraphTask.objectList=null===(r=this.objects.connectedPoint)||void 0===r?void 0:r.value},t.prototype._dumpPropertiesCode=function(){return e.prototype._dumpPropertiesCode.call(this)+[].join("\n")},t.prototype.serialize=function(){return e.prototype.serialize.call(this)},t.prototype._deserialize=function(t){e.prototype._deserialize.call(this,t)},t}(Lp);(0,h.Y5)("BABYLON.NodeRenderGraphCullObjectsBlock",lf);var cf=function(){function e(t,n,r){var i=this;this._buildId=e._BuildIdGenerator++,this.BJSNODERENDERGRAPHEDITOR=this._getGlobalNodeRenderGraphEditor(),this.editorData=null,this.attachedBlocks=[],this.onBuildErrorObservable=new l.cP,this.outputBlock=null,this._resizeObserver=null,this.name=t,this._scene=n,this._engine=n.getEngine(),r=(0,f.Cl)({debugTextures:!1,autoConfigure:!1,verbose:!1,rebuildGraphOnEngineResize:!0,autoFillExternalInputs:!0},r),this._options=r,this._frameGraph=new Qp(this._scene,r.debugTextures,this),this._frameGraph.name=t,r.rebuildGraphOnEngineResize&&(this._resizeObserver=this._engine.onResizeObservable.add((function(){i.build()})))}return e.prototype._getGlobalNodeRenderGraphEditor=function(){return"undefined"!=typeof NODERENDERGRAPHEDITOR?NODERENDERGRAPHEDITOR:"undefined"!=typeof BABYLON&&void 0!==BABYLON.NodeRenderGraphEditor?BABYLON:void 0},Object.defineProperty(e.prototype,"onBuildObservable",{get:function(){return this._frameGraph.onBuildObservable},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"frameGraph",{get:function(){return this._frameGraph},enumerable:!1,configurable:!0}),e.prototype.getScene=function(){return this._scene},e.prototype.getClassName=function(){return"NodeRenderGraph"},e.prototype.getBlockByName=function(e){for(var t=null,n=0,r=this.attachedBlocks;n0&&!r.find((function(e){return e.isMainObjectRenderer}))&&(r[0].isMainObjectRenderer=!0);try{this.outputBlock.build(n),t||this._frameGraph.build()}finally{this._buildId=e._BuildIdGenerator++,n.emitErrors(this.onBuildErrorObservable)}},e.prototype._autoFillExternalInputs=function(){for(var e=this.getInputBlocks(),t=[],n=0,r=this._scene.lights;n-1&&this.attachedBlocks.splice(t,1),e===this.outputBlock&&(this.outputBlock=null)},e.prototype.parseSerializedObject=function(e,t){void 0===t&&(t=!1),t||this.clear();for(var n={},r=0,i=e.blocks;r4&&(u.push(se.R.MatricesIndicesExtraKind),u.push(se.R.MatricesWeightsExtraKind)),c.push("#define NUM_BONE_INFLUENCERS "+a.numBoneInfluencers);var y=a.skeleton;y&&y.isUsingTextureForMatrices?c.push("#define BONETEXTURE"):c.push("#define BonesPerMesh "+(y?y.bones.length+1:0)),a.numBoneInfluencers>0&&v.addCPUSkinningFallback(0,a)}else c.push("#define NUM_BONE_INFLUENCERS 0");var b=a.morphTargetManager?(0,Le.Dk)(a.morphTargetManager,c,u,a,!0,!1,!1,h,d,!1):0;t&&(c.push("#define INSTANCES"),(0,Le.te)(u),e.getRenderingMesh().hasThinInstances&&c.push("#define THIN_INSTANCES")),(0,Mo.r4)(l,this._scene,c),this._addCustomEffectDefines(c);var S=e._getDrawWrapper(void 0,!0),T=S.defines,E=c.join("\n");if(T!==E){var x=["world","mBones","viewProjection","glowColor","morphTargetInfluences","morphTargetCount","boneTextureWidth","diffuseMatrix","emissiveMatrix","opacityMatrix","opacityIntensity","morphTargetTextureInfo","morphTargetTextureIndices","glowIntensity"];(0,Mo.Ll)(x),S.setEffect(this._engine.createEffect("glowMapGeneration",u,x,["diffuseSampler","emissiveSampler","opacitySampler","boneSampler","morphTargets"],E,v,void 0,void 0,{maxSimultaneousMorphTargets:b},this._shaderLanguage,this._shadersLoaded?void 0:function(){return(0,f.sH)(i,void 0,void 0,(function(){return(0,f.YH)(this,(function(e){switch(e.label){case 0:return[4,this._importShadersAsync()];case 1:return e.sent(),this._shadersLoaded=!0,[2]}}))}))}),E)}return S.effect.isReady()&&(this._dontCheckIfReady||!this._dontCheckIfReady&&this.isLayerReady())},e.prototype._isSubMeshReady=function(e,t,n){return this._internalIsSubMeshReady(e,t,n)},e.prototype._importShadersAsync=function(){return(0,f.sH)(this,void 0,void 0,(function(){var e;return(0,f.YH)(this,(function(t){switch(t.label){case 0:return 1!==this._shaderLanguage?[3,2]:[4,Promise.all([Promise.resolve().then(n.bind(n,97e3)),Promise.resolve().then(n.bind(n,35750))])];case 1:return t.sent(),[3,4];case 2:return[4,Promise.all([Promise.resolve().then(n.bind(n,47615)),Promise.resolve().then(n.bind(n,75417))])];case 3:t.sent(),t.label=4;case 4:return null===(e=this._additionalImportShadersAsync)||void 0===e||e.call(this),[2]}}))}))},e.prototype._internalIsLayerReady=function(){for(var e=!0,t=0;t-1},t.prototype.referenceMeshToUseItsOwnMaterial=function(e){var t=this;e.resetDrawCache(this._renderPassId),this._meshesUsingTheirOwnMaterials.push(e.uniqueId),e.onDisposeObservable.add((function(){t._disposeMesh(e)}))},t.prototype.unReferenceMeshFromUsingItsOwnMaterial=function(e,t){for(var n=this._meshesUsingTheirOwnMaterials.indexOf(e.uniqueId);n>=0;)this._meshesUsingTheirOwnMaterials.splice(n,1),n=this._meshesUsingTheirOwnMaterials.indexOf(e.uniqueId);e.resetDrawCache(t)},t.prototype._disposeMesh=function(e){this.removeIncludedOnlyMesh(e),this.removeExcludedMesh(e)},t.EffectName="GlowLayer",t.DefaultBlurKernelSize=32,t}(mf),vf=n(29598),yf=function(e){function t(t,n,r){return e.call(this,t,n,r||new _f.q(t,n.engine,new c.I9(1,0),10))||this}return(0,f.C6)(t,e),t.prototype.record=function(t,n,r){void 0===t&&(t=!1);var i=e.prototype.record.call(this,t,n,r);return this.postProcess.textureWidth=this._outputWidth,this.postProcess.textureHeight=this._outputHeight,i},t}(vf.C),bf=function(e){function t(t,n,r){return e.call(this,t,n,r||new ff(t,n.engine,new c.I9(1,0),1))||this}return(0,f.C6)(t,e),t.prototype.record=function(t,n,r){void 0===t&&(t=!1);var i=e.prototype.record.call(this,t,n,r);return this.postProcess.textureWidth=this._outputWidth,this.postProcess.textureHeight=this._outputHeight,i},t}(vf.C),Sf=function(e){function t(t,n,r,i,o,a,s,l){void 0===a&&(a=!1),void 0===s&&(s=!1),void 0===l&&(l=!1);var c=e.call(this,t,n)||this;c._setRenderTargetDepth=s,c._notifyBlurObservable=l,c._blurX=[],c._blurY=[],c._onBeforeBlurTask=null,c._onAfterBlurTask=null,c._onBeforeObservableObserver=null,c._onAfterObservableObserver=null,c._onAfterRenderingGroupObserver=null,c._scene=r,c._engine=r.getEngine(),c.layer=i;for(var u=0;u>1,n.height=n.height>>1}var y=null===(t=this._onAfterBlurTask)||void 0===t?void 0:t.record();this.objectRendererTask.objectRenderer.onBeforeRenderObservable.remove(this._onBeforeObservableObserver),this._onBeforeObservableObserver=this.objectRendererTask.objectRenderer.onBeforeRenderObservable.add((function(){var e=o.layer.shouldRender();u.disabled=!e,d.disabled=!e,f&&(f.disabled=!e);for(var t=0;t0?n+1:""),o._blurY[n].outputTexture)}),-1!==o.layer._options.renderingGroupId?o._onAfterRenderingGroupObserver||(o._onAfterRenderingGroupObserver=o._scene.onAfterRenderingGroupObservable.add((function(t){o.layer.shouldRender()&&t.renderingGroupId===o.layer._options.renderingGroupId&&t.renderingManager===o.objectRendererTask.objectRenderer.renderingManager&&(o._objectRendererForLayer.objectList=o.objectRendererTask.objectList,e.saveDepthStates(),e.setDepthStates(!1,!1),e._applyRenderTarget(),o.layer.compose(),e.restoreDepthStates())}))):(o._clearAfterRenderingGroupObserver(),o.layer.shouldRender()&&(o._objectRendererForLayer.objectList=o.objectRendererTask.objectList,e.setDepthStates(!1,!1),e._applyRenderTarget(),o.layer.compose()))}));var T=this._frameGraph.addRenderPass(this.name+"_disabled",!0);T.setRenderTarget(this.outputTexture),this._setRenderTargetDepth&&T.setRenderTargetDepth(this.objectRendererTask.depthTexture),T.setExecuteFunc((function(e){}))},t.prototype._clearAfterRenderingGroupObserver=function(){this._scene.onAfterRenderingGroupObservable.remove(this._onAfterRenderingGroupObserver),this._onAfterRenderingGroupObserver=null},t.prototype.dispose=function(){var t,n;this._clearAfterRenderingGroupObserver(),this._clearLayerTextures.dispose(),this._objectRendererForLayer.dispose(),null===(t=this._onBeforeBlurTask)||void 0===t||t.dispose(),null===(n=this._onAfterBlurTask)||void 0===n||n.dispose(),this.layer.dispose();for(var r=0;r1?b.Y.TEXTUREFORMAT_RED:b.Y.TEXTUREFORMAT_RGBA,i={size:n,options:{createMipMaps:!1,types:[this._defaultPipelineTextureType],formats:[r],samples:1,useSRGBBuffers:[!1],labels:[""]},sizeIsPercentage:!1},o=this._frameGraph.textureManager.createRenderTargetTexture(this._circleOfConfusion.name,i);this._circleOfConfusion.sourceTexture=this.sourceTexture,this._circleOfConfusion.depthTexture=this.depthTexture,this._circleOfConfusion.depthSamplingMode=this.depthSamplingMode,this._circleOfConfusion.camera=this.camera,this._circleOfConfusion.targetTexture=o,this._circleOfConfusion.record(!0),i.options.formats=[b.Y.TEXTUREFORMAT_RGBA];for(var a=[],s=0;s-1?"#define MALI 1\n":null},t.prototype._gatherImports=function(e,t){e?(this._webGPUReady=!0,t.push(Promise.all([Promise.resolve().then(n.bind(n,23459)),Promise.resolve().then(n.bind(n,13481))]))):t.push(Promise.all([Promise.resolve().then(n.bind(n,59210)),Promise.resolve().then(n.bind(n,93100))]))},t.prototype.bind=function(t){void 0===t&&(t=!1),e.prototype.bind.call(this,t),this._drawWrapper.effect.setFloat2("texelSize",this.texelSize.x,this.texelSize.y)},t.VertexUrl="fxaa",t.FragmentUrl="fxaa",t.Uniforms=["texelSize"],t}(Ri.$),pm=function(e){function t(t,n,r){return e.call(this,t,n,r||new dm(t,n.engine))||this}return(0,f.C6)(t,e),t.prototype.record=function(t,n,r){void 0===t&&(t=!1);var i=e.prototype.record.call(this,t,n,r);return this.postProcess.texelSize.x=1/this._sourceWidth,this.postProcess.texelSize.y=1/this._sourceHeight,i},t}(vf.C),fm=function(e){function t(t,n,r){var i=e.call(this,t,n,r)||this;return i._finalizeInputOutputRegistering(),i._frameGraphTask=new pm(i.name,n,new dm(t,r.getEngine())),i}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"task",{get:function(){return this._frameGraphTask},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"NodeRenderGraphFXAAPostProcessBlock"},t}(If);(0,h.Y5)("BABYLON.NodeRenderGraphFXAAPostProcessBlock",fm);var mm=function(e){function t(n,r,i){void 0===r&&(r=null);var o=e.call(this,(0,f.Cl)((0,f.Cl)({},i),{name:n,engine:r||Ai.N.LastCreatedEngine,useShaderStore:!0,useAsPostProcess:!0,fragmentShader:t.FragmentUrl,uniforms:t.Uniforms}))||this;return o.intensity=30,o.animated=!1,o}return(0,f.C6)(t,e),t.prototype._gatherImports=function(e,t){e?(this._webGPUReady=!0,t.push(Promise.resolve().then(n.bind(n,78138)))):t.push(Promise.resolve().then(n.bind(n,47469)))},t.prototype.bind=function(t){void 0===t&&(t=!1),e.prototype.bind.call(this,t),this._drawWrapper.effect.setFloat("intensity",this.intensity),this._drawWrapper.effect.setFloat("animatedSeed",this.animated?Math.random()+1:1)},t.FragmentUrl="grain",t.Uniforms=["intensity","animatedSeed"],t}(Ri.$),_m=function(e){function t(t,n,r){return e.call(this,t,n,r||new mm(t,n.engine))||this}return(0,f.C6)(t,e),t}(vf.C),gm=function(e){function t(t,n,r){var i=e.call(this,t,n,r)||this;return i._finalizeInputOutputRegistering(),i._frameGraphTask=new _m(i.name,n,new mm(t,r.getEngine())),i}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"task",{get:function(){return this._frameGraphTask},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"intensity",{get:function(){return this._frameGraphTask.postProcess.intensity},set:function(e){this._frameGraphTask.postProcess.intensity=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"animated",{get:function(){return this._frameGraphTask.postProcess.animated},set:function(e){this._frameGraphTask.postProcess.animated=e},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"NodeRenderGraphGrainPostProcessBlock"},t.prototype._dumpPropertiesCode=function(){var t=[];return t.push("".concat(this._codeVariableName,".intensity = ").concat(this.intensity,";")),t.push("".concat(this._codeVariableName,".animated = ").concat(this.animated,";")),e.prototype._dumpPropertiesCode.call(this)+t.join("\n")},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.intensity=this.intensity,t.animated=this.animated,t},t.prototype._deserialize=function(t){e.prototype._deserialize.call(this,t),this.intensity=t.intensity,this.animated=t.animated},(0,f.Cg)([Jp("Intensity",1,"PROPERTIES",{min:0,max:200})],t.prototype,"intensity",null),(0,f.Cg)([Jp("Animated",0,"PROPERTIES")],t.prototype,"animated",null),t}(If);(0,h.Y5)("BABYLON.NodeRenderGraphGrainPostProcessBlock",gm);var vm=function(e){function t(n,r,i){void 0===r&&(r=null);var o=e.call(this,(0,f.Cl)((0,f.Cl)({},i),{name:n,engine:r||Ai.N.LastCreatedEngine,useShaderStore:!0,useAsPostProcess:!0,fragmentShader:t.FragmentUrl}))||this;o._fromLinearSpace=!0,o._defines={IMAGEPROCESSING:!1,VIGNETTE:!1,VIGNETTEBLENDMODEMULTIPLY:!1,VIGNETTEBLENDMODEOPAQUE:!1,TONEMAPPING:0,CONTRAST:!1,COLORCURVES:!1,COLORGRADING:!1,COLORGRADING3D:!1,FROMLINEARSPACE:!1,SAMPLER3DGREENDEPTH:!1,SAMPLER3DBGRMAP:!1,DITHER:!1,IMAGEPROCESSINGPOSTPROCESS:!1,EXPOSURE:!1,SKIPFINALCOLORCLAMP:!1};var a=null==i?void 0:i.imageProcessingConfiguration;return a?(a.applyByPostProcess=!0,o._attachImageProcessingConfiguration(a,!0),o._updateParameters()):(o._attachImageProcessingConfiguration(null,!0),o.imageProcessingConfiguration.applyByPostProcess=!0),o}return(0,f.C6)(t,e),t.prototype._gatherImports=function(e,t){e?(this._webGPUReady=!0,t.push(Promise.resolve().then(n.bind(n,68805)))):t.push(Promise.resolve().then(n.bind(n,14830)))},Object.defineProperty(t.prototype,"imageProcessingConfiguration",{get:function(){return this._imageProcessingConfiguration},set:function(e){e.applyByPostProcess=!0,this._attachImageProcessingConfiguration(e)},enumerable:!1,configurable:!0}),t.prototype._attachImageProcessingConfiguration=function(e,t){var n=this;if(void 0===t&&(t=!1),e!==this._imageProcessingConfiguration){if(this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),e)this._imageProcessingConfiguration=e;else{var r=this.options.scene;if(!r){var i=this.options.engine;if(i&&i.scenes){var o=i.scenes;r=o[o.length-1]}else r=M.q.LastCreatedScene}this._imageProcessingConfiguration=r?r.imageProcessingConfiguration:new lo.p}this._imageProcessingConfiguration&&(this._imageProcessingObserver=this._imageProcessingConfiguration.onUpdateParameters.add((function(){n._updateParameters()}))),t||this._updateParameters()}},Object.defineProperty(t.prototype,"colorCurves",{get:function(){return this.imageProcessingConfiguration.colorCurves},set:function(e){this.imageProcessingConfiguration.colorCurves=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"colorCurvesEnabled",{get:function(){return this.imageProcessingConfiguration.colorCurvesEnabled},set:function(e){this.imageProcessingConfiguration.colorCurvesEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"colorGradingTexture",{get:function(){return this.imageProcessingConfiguration.colorGradingTexture},set:function(e){this.imageProcessingConfiguration.colorGradingTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"colorGradingEnabled",{get:function(){return this.imageProcessingConfiguration.colorGradingEnabled},set:function(e){this.imageProcessingConfiguration.colorGradingEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"exposure",{get:function(){return this.imageProcessingConfiguration.exposure},set:function(e){this.imageProcessingConfiguration.exposure=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"toneMappingEnabled",{get:function(){return this._imageProcessingConfiguration.toneMappingEnabled},set:function(e){this._imageProcessingConfiguration.toneMappingEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"toneMappingType",{get:function(){return this._imageProcessingConfiguration.toneMappingType},set:function(e){this._imageProcessingConfiguration.toneMappingType=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"contrast",{get:function(){return this.imageProcessingConfiguration.contrast},set:function(e){this.imageProcessingConfiguration.contrast=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"vignetteStretch",{get:function(){return this.imageProcessingConfiguration.vignetteStretch},set:function(e){this.imageProcessingConfiguration.vignetteStretch=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"vignetteCentreX",{get:function(){return this.imageProcessingConfiguration.vignetteCenterX},set:function(e){this.imageProcessingConfiguration.vignetteCenterX=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"vignetteCentreY",{get:function(){return this.imageProcessingConfiguration.vignetteCenterY},set:function(e){this.imageProcessingConfiguration.vignetteCenterY=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"vignetteCenterY",{get:function(){return this.imageProcessingConfiguration.vignetteCenterY},set:function(e){this.imageProcessingConfiguration.vignetteCenterY=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"vignetteCenterX",{get:function(){return this.imageProcessingConfiguration.vignetteCenterX},set:function(e){this.imageProcessingConfiguration.vignetteCenterX=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"vignetteWeight",{get:function(){return this.imageProcessingConfiguration.vignetteWeight},set:function(e){this.imageProcessingConfiguration.vignetteWeight=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"vignetteColor",{get:function(){return this.imageProcessingConfiguration.vignetteColor},set:function(e){this.imageProcessingConfiguration.vignetteColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"vignetteCameraFov",{get:function(){return this.imageProcessingConfiguration.vignetteCameraFov},set:function(e){this.imageProcessingConfiguration.vignetteCameraFov=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"vignetteBlendMode",{get:function(){return this.imageProcessingConfiguration.vignetteBlendMode},set:function(e){this.imageProcessingConfiguration.vignetteBlendMode=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"vignetteEnabled",{get:function(){return this.imageProcessingConfiguration.vignetteEnabled},set:function(e){this.imageProcessingConfiguration.vignetteEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ditheringIntensity",{get:function(){return this.imageProcessingConfiguration.ditheringIntensity},set:function(e){this.imageProcessingConfiguration.ditheringIntensity=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ditheringEnabled",{get:function(){return this.imageProcessingConfiguration.ditheringEnabled},set:function(e){this.imageProcessingConfiguration.ditheringEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fromLinearSpace",{get:function(){return this._fromLinearSpace},set:function(e){this._fromLinearSpace!==e&&(this._fromLinearSpace=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"outputTextureWidth",{get:function(){return this.imageProcessingConfiguration.outputTextureWidth},set:function(e){this.imageProcessingConfiguration.outputTextureWidth=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"outputTextureHeight",{get:function(){return this.imageProcessingConfiguration.outputTextureHeight},set:function(e){this.imageProcessingConfiguration.outputTextureHeight=e},enumerable:!1,configurable:!0}),t.prototype._updateParameters=function(){this._defines.FROMLINEARSPACE=this._fromLinearSpace,this.imageProcessingConfiguration.prepareDefines(this._defines,!0);var e="";for(var t in this._defines){var n=this._defines[t];switch(typeof n){case"number":case"string":e+="#define ".concat(t," ").concat(n,";\n");break;default:n&&(e+="#define ".concat(t,";\n"))}}var r=["textureSampler"],i=["scale"];lo.p&&(lo.p.PrepareSamplers(r,this._defines),lo.p.PrepareUniforms(i,this._defines)),this.updateEffect(e,i,r)},t.prototype.bind=function(t){void 0===t&&(t=!1),e.prototype.bind.call(this,t),this.imageProcessingConfiguration.bind(this.effect,this.overrideAspectRatio)},t.prototype.dispose=function(){e.prototype.dispose.call(this),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),this._imageProcessingConfiguration&&(this.imageProcessingConfiguration.applyByPostProcess=!1)},t.FragmentUrl="imageProcessing",t}(Ri.$),ym=function(e){function t(t,n,r){return e.call(this,t,n,r||new vm(t,n.engine))||this}return(0,f.C6)(t,e),t.prototype.record=function(t,n,r){void 0===t&&(t=!1);var i=e.prototype.record.call(this,t,n,r);return this.postProcess.outputTextureWidth=this._outputWidth,this.postProcess.outputTextureHeight=this._outputHeight,i},t}(vf.C),bm=function(e){function t(t,n,r){var i=e.call(this,t,n,r)||this;return i._finalizeInputOutputRegistering(),i._frameGraphTask=new ym(i.name,n,new vm(t,r.getEngine(),{scene:r,imageProcessingConfiguration:new lo.p})),i}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"task",{get:function(){return this._frameGraphTask},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"contrast",{get:function(){return this._frameGraphTask.postProcess.contrast},set:function(e){this._frameGraphTask.postProcess.contrast=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"exposure",{get:function(){return this._frameGraphTask.postProcess.exposure},set:function(e){this._frameGraphTask.postProcess.exposure=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"toneMappingEnabled",{get:function(){return this._frameGraphTask.postProcess.toneMappingEnabled},set:function(e){this._frameGraphTask.postProcess.toneMappingEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"toneMappingType",{get:function(){return this._frameGraphTask.postProcess.toneMappingType},set:function(e){this._frameGraphTask.postProcess.toneMappingType=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"vignetteEnabled",{get:function(){return this._frameGraphTask.postProcess.vignetteEnabled},set:function(e){this._frameGraphTask.postProcess.vignetteEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"vignetteWeight",{get:function(){return this._frameGraphTask.postProcess.vignetteWeight},set:function(e){this._frameGraphTask.postProcess.vignetteWeight=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"vignetteStretch",{get:function(){return this._frameGraphTask.postProcess.vignetteStretch},set:function(e){this._frameGraphTask.postProcess.vignetteStretch=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"vignetteCameraFov",{get:function(){return this._frameGraphTask.postProcess.vignetteCameraFov},set:function(e){this._frameGraphTask.postProcess.vignetteCameraFov=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"vignetteCenterX",{get:function(){return this._frameGraphTask.postProcess.vignetteCenterX},set:function(e){this._frameGraphTask.postProcess.vignetteCenterX=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"vignetteCenterY",{get:function(){return this._frameGraphTask.postProcess.vignetteCenterY},set:function(e){this._frameGraphTask.postProcess.vignetteCenterY=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"vignetteColor",{get:function(){return this._frameGraphTask.postProcess.vignetteColor},set:function(e){this._frameGraphTask.postProcess.vignetteColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"vignetteBlendMode",{get:function(){return this._frameGraphTask.postProcess.vignetteBlendMode},set:function(e){this._frameGraphTask.postProcess.vignetteBlendMode=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ditheringEnabled",{get:function(){return this._frameGraphTask.postProcess.ditheringEnabled},set:function(e){this._frameGraphTask.postProcess.ditheringEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ditheringIntensity",{get:function(){return this._frameGraphTask.postProcess.ditheringIntensity},set:function(e){this._frameGraphTask.postProcess.ditheringIntensity=e},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"NodeRenderGraphImageProcessingPostProcessBlock"},t.prototype._dumpPropertiesCode=function(){var t=[];return t.push("".concat(this._codeVariableName,".contrast = ").concat(this.contrast,";")),t.push("".concat(this._codeVariableName,".exposure = ").concat(this.exposure,";")),t.push("".concat(this._codeVariableName,".toneMappingEnabled = ").concat(this.toneMappingEnabled,";")),t.push("".concat(this._codeVariableName,".toneMappingType = ").concat(this.toneMappingType,";")),t.push("".concat(this._codeVariableName,".vignetteEnabled = ").concat(this.vignetteEnabled,";")),t.push("".concat(this._codeVariableName,".vignetteWeight = ").concat(this.vignetteWeight,";")),t.push("".concat(this._codeVariableName,".vignetteStretch = ").concat(this.vignetteStretch,";")),t.push("".concat(this._codeVariableName,".vignetteCameraFov = ").concat(this.vignetteCameraFov,";")),t.push("".concat(this._codeVariableName,".vignetteCenterX = ").concat(this.vignetteCenterX,";")),t.push("".concat(this._codeVariableName,".vignetteCenterY = ").concat(this.vignetteCenterY,";")),t.push("".concat(this._codeVariableName,".vignetteColor = new BABYLON.Color4(").concat(this.vignetteColor.r,", ").concat(this.vignetteColor.g,", ").concat(this.vignetteColor.b,", 1);")),t.push("".concat(this._codeVariableName,".vignetteBlendMode = ").concat(this.vignetteBlendMode,";")),t.push("".concat(this._codeVariableName,".ditheringEnabled = ").concat(this.ditheringEnabled,";")),t.push("".concat(this._codeVariableName,".ditheringIntensity = ").concat(this.ditheringIntensity,";")),e.prototype._dumpPropertiesCode.call(this)+t.join("\n")},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.contrast=this.contrast,t.exposure=this.exposure,t.toneMappingEnabled=this.toneMappingEnabled,t.toneMappingType=this.toneMappingType,t.vignetteEnabled=this.vignetteEnabled,t.vignetteWeight=this.vignetteWeight,t.vignetteStretch=this.vignetteStretch,t.vignetteCameraFov=this.vignetteCameraFov,t.vignetteCenterX=this.vignetteCenterX,t.vignetteCenterY=this.vignetteCenterY,t.vignetteColor=this.vignetteColor.asArray(),t.vignetteBlendMode=this.vignetteBlendMode,t.ditheringEnabled=this.ditheringEnabled,t.ditheringIntensity=this.ditheringIntensity,t},t.prototype._deserialize=function(t){e.prototype._deserialize.call(this,t),this.contrast=t.contrast,this.exposure=t.exposure,this.toneMappingEnabled=t.toneMappingEnabled,this.toneMappingType=t.toneMappingType,this.vignetteEnabled=t.vignetteEnabled,this.vignetteWeight=t.vignetteWeight,this.vignetteStretch=t.vignetteStretch,this.vignetteCameraFov=t.vignetteCameraFov,this.vignetteCenterX=t.vignetteCenterX,this.vignetteCenterY=t.vignetteCenterY,this.vignetteColor=u.ov.FromArray(t.vignetteColor),this.vignetteBlendMode=t.vignetteBlendMode,this.ditheringEnabled=t.ditheringEnabled,this.ditheringIntensity=t.ditheringIntensity},(0,f.Cg)([Jp("Contrast",1,"PROPERTIES",{min:0,max:4})],t.prototype,"contrast",null),(0,f.Cg)([Jp("Exposure",1,"PROPERTIES",{min:0,max:4})],t.prototype,"exposure",null),(0,f.Cg)([Jp("Enabled",0,"TONE MAPPING")],t.prototype,"toneMappingEnabled",null),(0,f.Cg)([Jp("Type",5,"TONE MAPPING",{options:[{value:lo.p.TONEMAPPING_STANDARD,label:"Standard"},{value:lo.p.TONEMAPPING_ACES,label:"ACES"},{value:lo.p.TONEMAPPING_KHR_PBR_NEUTRAL,label:"KHR PBR Neutral"}]})],t.prototype,"toneMappingType",null),(0,f.Cg)([Jp("Enabled",0,"VIGNETTE")],t.prototype,"vignetteEnabled",null),(0,f.Cg)([Jp("Weight",1,"VIGNETTE",{min:0,max:4})],t.prototype,"vignetteWeight",null),(0,f.Cg)([Jp("Stretch",1,"VIGNETTE",{min:0,max:1})],t.prototype,"vignetteStretch",null),(0,f.Cg)([Jp("FOV",1,"VIGNETTE",{min:0,max:3.14159})],t.prototype,"vignetteCameraFov",null),(0,f.Cg)([Jp("Center X",1,"VIGNETTE",{min:0,max:1})],t.prototype,"vignetteCenterX",null),(0,f.Cg)([Jp("Center Y",1,"VIGNETTE",{min:0,max:1})],t.prototype,"vignetteCenterY",null),(0,f.Cg)([Jp("Color",6,"VIGNETTE")],t.prototype,"vignetteColor",null),(0,f.Cg)([Jp("Blend mode",5,"VIGNETTE",{options:[{value:lo.p.VIGNETTEMODE_MULTIPLY,label:"Multiply"},{value:lo.p.VIGNETTEMODE_OPAQUE,label:"Opaque"}]})],t.prototype,"vignetteBlendMode",null),(0,f.Cg)([Jp("Enabed",0,"DITHERING")],t.prototype,"ditheringEnabled",null),(0,f.Cg)([Jp("Intensity",1,"DITHERING",{min:0,max:1})],t.prototype,"ditheringIntensity",null),t}(If);(0,h.Y5)("BABYLON.NodeRenderGraphImageProcessingPostProcessBlock",bm);var Sm=function(e){function t(n,r,i){var o=e.call(this,(0,f.Cl)((0,f.Cl)({},i),{name:n,engine:r.getEngine(),useShaderStore:!0,useAsPostProcess:!0,fragmentShader:t.FragmentUrl,uniforms:t.Uniforms,samplers:t.Samplers,defines:t.Defines}))||this;return o._invViewProjection=c.uq.Identity(),o._previousViewProjection=c.uq.Identity(),o.motionStrength=1,o._motionBlurSamples=32,o._isObjectBased=!0,o.textureWidth=0,o.textureHeight=0,o._scene=r,o._applyMode(),o}return(0,f.C6)(t,e),t.prototype._gatherImports=function(e,t){e?(this._webGPUReady=!0,t.push(Promise.resolve().then(n.bind(n,70154)))):t.push(Promise.resolve().then(n.bind(n,35007)))},Object.defineProperty(t.prototype,"motionBlurSamples",{get:function(){return this._motionBlurSamples},set:function(e){this._motionBlurSamples=e,this._updateEffect()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isObjectBased",{get:function(){return this._isObjectBased},set:function(e){this._isObjectBased!==e&&(this._isObjectBased=e,this._applyMode())},enumerable:!1,configurable:!0}),t.prototype.bind=function(t){void 0===t&&(t=!1),e.prototype.bind.call(this,t);var n=this._drawWrapper.effect;if(n.setFloat2("screenSize",this.textureWidth,this.textureHeight),n.setFloat("motionScale",this._scene.getAnimationRatio()),n.setFloat("motionStrength",this.motionStrength),!this.isObjectBased){var r=c.AA.Matrix[0];r.copyFrom(this._scene.getTransformMatrix()),r.invertToRef(this._invViewProjection),n.setMatrix("inverseViewProjection",this._invViewProjection),n.setMatrix("prevViewProjection",this._previousViewProjection),this._previousViewProjection.copyFrom(r),n.setMatrix("projection",this._scene.getProjectionMatrix())}},t.prototype._updateEffect=function(){var e=["#define GEOMETRY_SUPPORTED","#define SAMPLES "+this._motionBlurSamples.toFixed(1),this._isObjectBased?"#define OBJECT_BASED":"#define SCREEN_BASED"];this.updateEffect(e.join("\n"))},t.prototype._applyMode=function(){this._updateEffect(),this._previousViewProjection.copyFrom(this._scene.getTransformMatrix())},t.FragmentUrl="motionBlur",t.Uniforms=["motionStrength","motionScale","screenSize","inverseViewProjection","prevViewProjection","projection"],t.Samplers=["velocitySampler","depthSampler"],t.Defines="#define GEOMETRY_SUPPORTED\n#define SAMPLES 64.0\n#define OBJECT_BASED",t}(Ri.$),Tm=function(e){function t(t,n,r){return e.call(this,t,n,r||new Sm(t,n.scene))||this}return(0,f.C6)(t,e),t.prototype.record=function(t){var n=this;if(void 0===t&&(t=!1),void 0===this.sourceTexture)throw new Error('FrameGraphMotionBlurTask "'.concat(this.name,'": sourceTexture is required'));var r=e.prototype.record.call(this,t,void 0,(function(e){if(n.velocityTexture)e.bindTextureHandle(n._postProcessDrawWrapper.effect,"velocitySampler",n.velocityTexture);else if(n.postProcess.isObjectBased)throw new Error('FrameGraphMotionBlurTask "'.concat(n.name,'": velocityTexture is required for object-based motion blur'));if(n.depthTexture)e.bindTextureHandle(n._postProcessDrawWrapper.effect,"depthSampler",n.depthTexture);else if(!n.postProcess.isObjectBased)throw new Error('FrameGraphMotionBlurTask "'.concat(n.name,'": depthTexture is required for screen-based motion blur'))}));return r.addDependencies(this.velocityTexture),r.addDependencies(this.depthTexture),this.postProcess.textureWidth=this._sourceWidth,this.postProcess.textureHeight=this._sourceHeight,r},t}(vf.C),Em=function(e){function t(t,n,r){var i=e.call(this,t,n,r)||this;return i.registerInput("geomVelocity",Ap.TextureVelocity,!0),i.registerInput("geomViewDepth",Ap.TextureViewDepth,!0),i._finalizeInputOutputRegistering(),i._frameGraphTask=new Tm(i.name,n,new Sm(t,n.scene)),i}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"task",{get:function(){return this._frameGraphTask},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"motionStrength",{get:function(){return this._frameGraphTask.postProcess.motionStrength},set:function(e){this._frameGraphTask.postProcess.motionStrength=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"motionBlurSamples",{get:function(){return this._frameGraphTask.postProcess.motionBlurSamples},set:function(e){this._frameGraphTask.postProcess.motionBlurSamples=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isObjectBased",{get:function(){return this._frameGraphTask.postProcess.isObjectBased},set:function(e){this._frameGraphTask.postProcess.isObjectBased=e},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"NodeRenderGraphMotionBlurPostProcessBlock"},Object.defineProperty(t.prototype,"geomVelocity",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"geomViewDepth",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(t){var n,r;e.prototype._buildBlock.call(this,t),this._frameGraphTask.velocityTexture=null===(n=this.geomVelocity.connectedPoint)||void 0===n?void 0:n.value,this._frameGraphTask.depthTexture=null===(r=this.geomViewDepth.connectedPoint)||void 0===r?void 0:r.value},t.prototype._dumpPropertiesCode=function(){var t=[];return t.push("".concat(this._codeVariableName,".motionStrength = ").concat(this.motionStrength,";")),t.push("".concat(this._codeVariableName,".motionBlurSamples = ").concat(this.motionBlurSamples,";")),t.push("".concat(this._codeVariableName,".isObjectBased = ").concat(this.isObjectBased,";")),e.prototype._dumpPropertiesCode.call(this)+t.join("\n")},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.motionStrength=this.motionStrength,t.motionBlurSamples=this.motionBlurSamples,t.isObjectBased=this.isObjectBased,t},t.prototype._deserialize=function(t){e.prototype._deserialize.call(this,t),this.motionStrength=t.motionStrength,this.motionBlurSamples=t.motionBlurSamples,this.isObjectBased=t.isObjectBased},(0,f.Cg)([Jp("Strength",1,"PROPERTIES")],t.prototype,"motionStrength",null),(0,f.Cg)([Jp("Samples",1,"PROPERTIES")],t.prototype,"motionBlurSamples",null),(0,f.Cg)([Jp("Object based",0,"PROPERTIES")],t.prototype,"isObjectBased",null),t}(If);(0,h.Y5)("BABYLON.NodeRenderGraphMotionBlurPostProcessBlock",Em);var xm=function(e){function t(t,n,r){return e.call(this,t,n,r||new xf.m(t,n.engine))||this}return(0,f.C6)(t,e),t}(vf.C),Pm=function(e){function t(t,n,r){return e.call(this,t,n,r||new xf.V(t,n.engine))||this}return(0,f.C6)(t,e),t}(vf.C),Cm=function(e){function t(t,n,r){var i=e.call(this,t,n,r)||this;return i._finalizeInputOutputRegistering(),i._frameGraphTask=new xm(i.name,n,new xf.m(t,r.getEngine())),i}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"task",{get:function(){return this._frameGraphTask},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"NodeRenderGraphPassPostProcessBlock"},t}(If);(0,h.Y5)("BABYLON.NodeRenderGraphPassPostProcessBlock",Cm);var Rm=function(e){function t(t,n,r){var i=e.call(this,t,n,r)||this;return i._finalizeInputOutputRegistering(),i._frameGraphTask=new Pm(i.name,n,new xf.V(t,r.getEngine())),i}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"task",{get:function(){return this._frameGraphTask},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"NodeRenderGraphPassCubePostProcessBlock"},t}(If);(0,h.Y5)("BABYLON.NodeRenderGraphPassCubePostProcessBlock",Rm);var Am=function(e){function t(n,r,i){void 0===r&&(r=null);var o=e.call(this,(0,f.Cl)((0,f.Cl)({},i),{name:n,engine:r||Ai.N.LastCreatedEngine,useShaderStore:!0,useAsPostProcess:!0,fragmentShader:t.FragmentUrl,uniforms:t.Uniforms}))||this;return o.colorAmount=1,o.edgeAmount=.3,o.textureWidth=0,o.textureHeight=0,o}return(0,f.C6)(t,e),t.prototype._gatherImports=function(e,t){e?(this._webGPUReady=!0,t.push(Promise.resolve().then(n.bind(n,89950)))):t.push(Promise.resolve().then(n.bind(n,22129)))},t.prototype.bind=function(t){void 0===t&&(t=!1),e.prototype.bind.call(this,t);var n=this._drawWrapper.effect;n.setFloat2("screenSize",this.textureWidth,this.textureHeight),n.setFloat2("sharpnessAmounts",this.edgeAmount,this.colorAmount)},t.FragmentUrl="sharpen",t.Uniforms=["sharpnessAmounts","screenSize"],t}(Ri.$),Im=function(e){function t(t,n,r){return e.call(this,t,n,r||new Am(t,n.engine))||this}return(0,f.C6)(t,e),t.prototype.record=function(t,n,r){void 0===t&&(t=!1);var i=e.prototype.record.call(this,t,n,r);return this.postProcess.textureWidth=this._sourceWidth,this.postProcess.textureHeight=this._sourceHeight,i},t}(vf.C),Om=function(e){function t(t,n,r){var i=e.call(this,t,n,r)||this;return i._finalizeInputOutputRegistering(),i._frameGraphTask=new Im(i.name,n,new Am(t,r.getEngine())),i}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"task",{get:function(){return this._frameGraphTask},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"colorAmount",{get:function(){return this._frameGraphTask.postProcess.colorAmount},set:function(e){this._frameGraphTask.postProcess.colorAmount=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"edgeAmount",{get:function(){return this._frameGraphTask.postProcess.edgeAmount},set:function(e){this._frameGraphTask.postProcess.edgeAmount=e},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"NodeRenderGraphSharpenPostProcessBlock"},t.prototype._dumpPropertiesCode=function(){var t=[];return t.push("".concat(this._codeVariableName,".colorAmount = ").concat(this.colorAmount,";")),t.push("".concat(this._codeVariableName,".edgeAmount = ").concat(this.edgeAmount,";")),e.prototype._dumpPropertiesCode.call(this)+t.join("\n")},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.colorAmount=this.colorAmount,t.edgeAmount=this.edgeAmount,t},t.prototype._deserialize=function(t){e.prototype._deserialize.call(this,t),this.colorAmount=t.colorAmount,this.edgeAmount=t.edgeAmount},(0,f.Cg)([Jp("Color Amount",1,"PROPERTIES",{min:0,max:1})],t.prototype,"colorAmount",null),(0,f.Cg)([Jp("Edge Amount",1,"PROPERTIES",{min:0,max:1})],t.prototype,"edgeAmount",null),t}(If);(0,h.Y5)("BABYLON.NodeRenderGraphSharpenPostProcessBlock",Om);var Mm=function(e){function t(n,r,i){void 0===r&&(r=null);var o=e.call(this,(0,f.Cl)((0,f.Cl)({},i),{name:n,engine:r||Ai.N.LastCreatedEngine,useShaderStore:!0,useAsPostProcess:!0,fragmentShader:t.FragmentUrl,uniforms:t.Uniforms,samplers:t.Samplers}))||this;return o.ridge=1,o.valley=1,o}return(0,f.C6)(t,e),t.prototype._gatherImports=function(e,t){e?(this._webGPUReady=!0,t.push(Promise.resolve().then(n.bind(n,71050)))):t.push(Promise.resolve().then(n.bind(n,60383)))},t.prototype.bind=function(t){void 0===t&&(t=!1),e.prototype.bind.call(this,t);var n=this._drawWrapper.effect;n.setFloat("curvature_ridge",.5/Math.max(this.ridge*this.ridge,1e-4)),n.setFloat("curvature_valley",.7/Math.max(this.valley*this.valley,1e-4))},t.FragmentUrl="screenSpaceCurvature",t.Uniforms=["curvature_ridge","curvature_valley"],t.Samplers=["normalSampler"],t}(Ri.$),Dm=function(e){function t(t,n,r){return e.call(this,t,n,r||new Mm(t,n.engine))||this}return(0,f.C6)(t,e),t.prototype.record=function(t){var n=this;if(void 0===t&&(t=!1),void 0===this.sourceTexture||void 0===this.normalTexture)throw new Error('FrameGraphScreenSpaceCurvatureTask "'.concat(this.name,'": sourceTexture and normalTexture are required'));var r=e.prototype.record.call(this,t,void 0,(function(e){e.bindTextureHandle(n._postProcessDrawWrapper.effect,"normalSampler",n.normalTexture)}));return r.addDependencies(this.normalTexture),r},t}(vf.C),Nm=function(e){function t(t,n,r){var i=e.call(this,t,n,r)||this;return i.registerInput("geomViewNormal",Ap.TextureViewNormal),i._finalizeInputOutputRegistering(),i._frameGraphTask=new Dm(i.name,n,new Mm(t,r.getEngine())),i}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"task",{get:function(){return this._frameGraphTask},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ridge",{get:function(){return this._frameGraphTask.postProcess.ridge},set:function(e){this._frameGraphTask.postProcess.ridge=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"valley",{get:function(){return this._frameGraphTask.postProcess.valley},set:function(e){this._frameGraphTask.postProcess.valley=e},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"NodeRenderGraphScreenSpaceCurvaturePostProcessBlock"},Object.defineProperty(t.prototype,"geomViewNormal",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(t){var n;e.prototype._buildBlock.call(this,t),this._frameGraphTask.normalTexture=null===(n=this.geomViewNormal.connectedPoint)||void 0===n?void 0:n.value},t.prototype._dumpPropertiesCode=function(){var t=[];return t.push("".concat(this._codeVariableName,".ridge = ").concat(this.ridge,";")),t.push("".concat(this._codeVariableName,".valley = ").concat(this.valley,";")),e.prototype._dumpPropertiesCode.call(this)+t.join("\n")},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.ridge=this.ridge,t.valley=this.valley,t},t.prototype._deserialize=function(t){e.prototype._deserialize.call(this,t),this.ridge=t.ridge,this.valley=t.valley},(0,f.Cg)([Jp("Ridge",1,"PROPERTIES",{min:0,max:1})],t.prototype,"ridge",null),(0,f.Cg)([Jp("Valley",1,"PROPERTIES",{min:0,max:1})],t.prototype,"valley",null),t}(If);(0,h.Y5)("BABYLON.NodeRenderGraphScreenSpaceCurvaturePostProcessBlock",Nm);var Fm=function(e){function t(n,r,i){var o=e.call(this,(0,f.Cl)((0,f.Cl)({},i),{name:n,engine:r.getEngine(),useShaderStore:!0,useAsPostProcess:!0,fragmentShader:t.FragmentUrl,uniforms:t.Uniforms,samplers:t.Samplers,defines:"#define SSAO\n#define SAMPLES 8\n#define EPSILON 0.0001",shaderLanguage:r.getEngine().isWebGPU?1:0}))||this;return o.camera=null,o._textureWidth=0,o._textureHeight=0,o._samples=8,o.totalStrength=1,o.radius=2,o.maxZ=100,o.minZAspect=.2,o.base=0,o._epsilon=.02,o._bits=new Uint32Array(1),o._scene=r,o._createRandomTexture(),o.updateEffect(o._getDefinesForSSAO()),o._sampleSphere=o._generateHemisphere(),o}return(0,f.C6)(t,e),t.prototype._gatherImports=function(e,t){e?(this._webGPUReady=!0,t.push(Promise.resolve().then(n.bind(n,29059)))):t.push(Promise.resolve().then(n.bind(n,16040)))},Object.defineProperty(t.prototype,"textureWidth",{get:function(){return this._textureWidth},set:function(e){this._textureWidth!==e&&(this._textureWidth=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"textureHeight",{get:function(){return this._textureHeight},set:function(e){this._textureHeight!==e&&(this._textureHeight=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"samples",{get:function(){return this._samples},set:function(e){this._samples=e,this.updateEffect(this._getDefinesForSSAO()),this._sampleSphere=this._generateHemisphere()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"epsilon",{get:function(){return this._epsilon},set:function(e){this._epsilon=e,this.updateEffect(this._getDefinesForSSAO())},enumerable:!1,configurable:!0}),t.prototype.bind=function(n){var r,i,o,a;void 0===n&&(n=!1),e.prototype.bind.call(this,n);var s=this._drawWrapper.effect,l=this.camera;if(l){var c=l.getProjectionMatrix();if(s.setArray3("sampleSphere",this._sampleSphere),s.setFloat("randTextureTiles",32),s.setFloat("samplesFactor",1/this.samples),s.setFloat("totalStrength",this.totalStrength),s.setFloat2("texelSize",1/this.textureWidth,1/this.textureHeight),s.setFloat("radius",this.radius),s.setFloat("maxZ",this.maxZ),s.setFloat("minZAspect",this.minZAspect),s.setFloat("base",this.base),s.setFloat("near",l.minZ),l.mode===oe.i.PERSPECTIVE_CAMERA)s.setMatrix3x3("depthProjection",t.PERSPECTIVE_DEPTH_PROJECTION),s.setFloat("xViewport",Math.tan(l.fov/2)*this._scene.getEngine().getAspectRatio(l,!0)),s.setFloat("yViewport",Math.tan(l.fov/2));else{var u=this._scene.getEngine().getRenderWidth()/2,h=this._scene.getEngine().getRenderHeight()/2,d=null!==(r=l.orthoLeft)&&void 0!==r?r:-u,p=null!==(i=l.orthoRight)&&void 0!==i?i:u,f=null!==(o=l.orthoBottom)&&void 0!==o?o:-h,m=null!==(a=l.orthoTop)&&void 0!==a?a:h;s.setMatrix3x3("depthProjection",t.ORTHO_DEPTH_PROJECTION),s.setFloat4("viewport",d,p,f,m)}s.setMatrix("projection",c),s.setTexture("randomSampler",this._randomTexture)}},t.prototype.dispose=function(){this._randomTexture.dispose(),e.prototype.dispose.call(this)},t.prototype._createRandomTexture=function(){for(var e=new Uint8Array(65536),t=c.I9.Zero(),n=0;n>16)>>>0,this._bits[0]=(1431655765&this._bits[0])<<1|(2863311530&this._bits[0])>>>1>>>0,this._bits[0]=(858993459&this._bits[0])<<2|(3435973836&this._bits[0])>>>2>>>0,this._bits[0]=(252645135&this._bits[0])<<4|(4042322160&this._bits[0])>>>4>>>0,this._bits[0]=(16711935&this._bits[0])<<8|(4278255360&this._bits[0])>>>8>>>0,2.3283064365386963e-10*this._bits[0]},t.prototype._hammersley=function(e,t){return[e/t,this._radicalInverseVdC(e)]},t.prototype._hemisphereSampleUniform=function(e,t){var n=2*t*Math.PI,r=1-.85*e,i=Math.sqrt(1-r*r);return new c.Pq(Math.cos(n)*i,Math.sin(n)*i,r)},t.prototype._generateHemisphere=function(){for(var e,t=this.samples,n=[],r=0;r0}return Object.defineProperty(e.prototype,"isSSRSupported",{get:function(){return this._ssrPostProcess.isSSRSupported},set:function(e){this._ssrPostProcess.isSSRSupported=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxDistance",{get:function(){return this._ssrPostProcess.maxDistance},set:function(e){this._ssrPostProcess.maxDistance=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"step",{get:function(){return this._ssrPostProcess.step},set:function(e){this._ssrPostProcess.step=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thickness",{get:function(){return this._ssrPostProcess.thickness},set:function(e){this._ssrPostProcess.thickness=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"strength",{get:function(){return this._ssrPostProcess.strength},set:function(e){this._ssrPostProcess.strength=e,this._ssrBlurCombinerPostProcess.strength=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"reflectionSpecularFalloffExponent",{get:function(){return this._ssrPostProcess.reflectionSpecularFalloffExponent},set:function(e){this._ssrPostProcess.reflectionSpecularFalloffExponent=e,this._ssrBlurCombinerPostProcess.reflectionSpecularFalloffExponent=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxSteps",{get:function(){return this._ssrPostProcess.maxSteps},set:function(e){this._ssrPostProcess.maxSteps=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"roughnessFactor",{get:function(){return this._ssrPostProcess.roughnessFactor},set:function(e){this._ssrPostProcess.roughnessFactor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"selfCollisionNumSkip",{get:function(){return this._ssrPostProcess.selfCollisionNumSkip},set:function(e){this._ssrPostProcess.selfCollisionNumSkip=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"reflectivityThreshold",{get:function(){return this._ssrPostProcess.reflectivityThreshold},set:function(e){e!==this._ssrPostProcess.reflectivityThreshold&&(this._ssrPostProcess.reflectivityThreshold=e,this._ssrBlurCombinerPostProcess.reflectivityThreshold=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blurDispersionStrength",{get:function(){return this._ssrBlurXPostProcess.blurStrength},set:function(e){e!==this._ssrBlurXPostProcess.blurStrength&&(this._ssrPostProcess.useBlur=e>0,this._ssrBlurXPostProcess.blurStrength=e,this._ssrBlurYPostProcess.blurStrength=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"enableSmoothReflections",{get:function(){return this._ssrPostProcess.enableSmoothReflections},set:function(e){this._ssrPostProcess.enableSmoothReflections=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"environmentTexture",{get:function(){return this._ssrPostProcess.environmentTexture},set:function(e){this._ssrPostProcess.environmentTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"environmentTextureIsProbe",{get:function(){return this._ssrPostProcess.environmentTextureIsProbe},set:function(e){this._ssrPostProcess.environmentTextureIsProbe=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"attenuateScreenBorders",{get:function(){return this._ssrPostProcess.attenuateScreenBorders},set:function(e){this._ssrPostProcess.attenuateScreenBorders=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"attenuateIntersectionDistance",{get:function(){return this._ssrPostProcess.attenuateIntersectionDistance},set:function(e){this._ssrPostProcess.attenuateIntersectionDistance=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"attenuateIntersectionIterations",{get:function(){return this._ssrPostProcess.attenuateIntersectionIterations},set:function(e){this._ssrPostProcess.attenuateIntersectionIterations=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"attenuateFacingCamera",{get:function(){return this._ssrPostProcess.attenuateFacingCamera},set:function(e){this._ssrPostProcess.attenuateFacingCamera=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"attenuateBackfaceReflection",{get:function(){return this._ssrPostProcess.attenuateBackfaceReflection},set:function(e){this._ssrPostProcess.attenuateBackfaceReflection=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clipToFrustum",{get:function(){return this._ssrPostProcess.clipToFrustum},set:function(e){this._ssrPostProcess.clipToFrustum=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"useFresnel",{get:function(){return this._ssrPostProcess.useFresnel},set:function(e){this._ssrPostProcess.useFresnel=e,this._ssrBlurCombinerPostProcess.useFresnel=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"enableAutomaticThicknessComputation",{get:function(){return this._ssrPostProcess.enableAutomaticThicknessComputation},set:function(e){this._ssrPostProcess.enableAutomaticThicknessComputation!==e&&(this._ssrPostProcess.enableAutomaticThicknessComputation=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"inputTextureColorIsInGammaSpace",{get:function(){return this._ssrPostProcess.inputTextureColorIsInGammaSpace},set:function(e){this._ssrPostProcess.inputTextureColorIsInGammaSpace!==e&&(this._ssrPostProcess.inputTextureColorIsInGammaSpace=e,this._ssrBlurCombinerPostProcess.inputTextureColorIsInGammaSpace=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"generateOutputInGammaSpace",{get:function(){return this._ssrPostProcess.generateOutputInGammaSpace},set:function(e){this._ssrPostProcess.generateOutputInGammaSpace!==e&&(this._ssrPostProcess.generateOutputInGammaSpace=e,this._ssrBlurCombinerPostProcess.generateOutputInGammaSpace=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"debug",{get:function(){return this._ssrPostProcess.debug},set:function(e){this._ssrPostProcess.debug!==e&&(this._ssrPostProcess.debug=e,this._ssrBlurCombinerPostProcess.debug=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"camera",{get:function(){return this._ssrPostProcess.camera},set:function(e){this._ssrPostProcess.camera=e,this._ssrBlurCombinerPostProcess.camera=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"useScreenspaceDepth",{get:function(){return this._ssrPostProcess.useScreenspaceDepth},set:function(e){this._ssrPostProcess.useScreenspaceDepth=e,this._ssrBlurCombinerPostProcess.useScreenspaceDepth=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"normalsAreInWorldSpace",{get:function(){return this._ssrPostProcess.normalsAreInWorldSpace},set:function(e){this._ssrPostProcess.normalsAreInWorldSpace=e,this._ssrBlurCombinerPostProcess.normalsAreInWorldSpace=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"normalsAreUnsigned",{get:function(){return this._ssrPostProcess.normalsAreUnsigned},set:function(e){this._ssrPostProcess.normalsAreUnsigned=e,this._ssrBlurCombinerPostProcess.normalsAreUnsigned=e},enumerable:!1,configurable:!0}),e.prototype.isReady=function(){return this._ssrPostProcess.isReady()&&this._ssrBlurXPostProcess.isReady()&&this._ssrBlurYPostProcess.isReady()&&this._ssrBlurCombinerPostProcess.isReady()},e.prototype.dispose=function(){var e,t,n,r;null===(e=this._ssrPostProcess)||void 0===e||e.dispose(),null===(t=this._ssrBlurXPostProcess)||void 0===t||t.dispose(),null===(n=this._ssrBlurYPostProcess)||void 0===n||n.dispose(),null===(r=this._ssrBlurCombinerPostProcess)||void 0===r||r.dispose()},e}(),qm=function(e){function t(t,n,r){return e.call(this,t,n,r||new Hm(t,n.scene))||this}return(0,f.C6)(t,e),t.prototype.record=function(t){var n=this;if(void 0===t&&(t=!1),void 0===this.sourceTexture||void 0===this.normalTexture||void 0===this.depthTexture||void 0===this.reflectivityTexture||void 0===this.camera)throw new Error('FrameGraphSSRTask "'.concat(this.name,'": sourceTexture, normalTexture, depthTexture, reflectivityTexture and camera are required'));var r=e.prototype.record.call(this,t,(function(e){n.postProcess.camera=n.camera,e.setTextureSamplingMode(n.normalTexture,b.Y.TEXTURE_BILINEAR_SAMPLINGMODE),e.setTextureSamplingMode(n.depthTexture,b.Y.TEXTURE_BILINEAR_SAMPLINGMODE),e.setTextureSamplingMode(n.reflectivityTexture,b.Y.TEXTURE_BILINEAR_SAMPLINGMODE),n.backDepthTexture&&e.setTextureSamplingMode(n.backDepthTexture,b.Y.TEXTURE_NEAREST_SAMPLINGMODE)}),(function(e){e.bindTextureHandle(n._postProcessDrawWrapper.effect,"normalSampler",n.normalTexture),e.bindTextureHandle(n._postProcessDrawWrapper.effect,"depthSampler",n.depthTexture),e.bindTextureHandle(n._postProcessDrawWrapper.effect,"reflectivitySampler",n.reflectivityTexture),n.backDepthTexture&&e.bindTextureHandle(n._postProcessDrawWrapper.effect,"backDepthSampler",n.backDepthTexture),n.postProcess.enableAutomaticThicknessComputation&&n._postProcessDrawWrapper.effect.setFloat("backSizeFactor",1)}));return r.addDependencies([this.normalTexture,this.depthTexture,this.reflectivityTexture]),this.postProcess.textureWidth=this._sourceWidth,this.postProcess.textureHeight=this._sourceHeight,r},t}(vf.C),Km=function(e){function t(t,n,r){return e.call(this,t,n,r||new Ym(t,n.engine,new c.I9(1,0),.03))||this}return(0,f.C6)(t,e),t.prototype.record=function(t,n,r){void 0===t&&(t=!1);var i=e.prototype.record.call(this,t,n,r);return this.postProcess.textureWidth=this._sourceWidth,this.postProcess.textureHeight=this._sourceHeight,i},t}(vf.C),Zm=function(e){function t(t,n,r){void 0===r&&(r=b.Y.TEXTURETYPE_UNSIGNED_BYTE);var i=e.call(this,t,n)||this;return i.sourceSamplingMode=b.Y.TEXTURE_BILINEAR_SAMPLINGMODE,i.textureType=r,i.ssr=new jm(t,n.scene),i._ssr=new qm("".concat(t," SSR main"),i._frameGraph,i.ssr._ssrPostProcess),i._ssrBlurX=new Km("".concat(t," SSR Blur X"),i._frameGraph,i.ssr._ssrBlurXPostProcess),i._ssrBlurY=new Km("".concat(t," SSR Blur Y"),i._frameGraph,i.ssr._ssrBlurYPostProcess),i._ssrBlurCombiner=new vf.C("".concat(t," SSR Blur Combiner"),i._frameGraph,i.ssr._ssrBlurCombinerPostProcess),i.outputTexture=i._frameGraph.textureManager.createDanglingHandle(),i}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"camera",{get:function(){return this._camera},set:function(e){e!==this._camera&&(this._camera=e,this.ssr.camera=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return this._name},set:function(e){this._name=e,this._ssr&&(this._ssr.name="".concat(e," SSR main")),this._ssrBlurX&&(this._ssrBlurX.name="".concat(e," SSR Blur X")),this._ssrBlurY&&(this._ssrBlurY.name="".concat(e," SSR Blur Y")),this._ssrBlurCombiner&&(this._ssrBlurCombiner.name="".concat(e," SSR Blur Combiner"))},enumerable:!1,configurable:!0}),t.prototype.isReady=function(){return this.ssr.isReady()},t.prototype.record=function(){var e=this;if(void 0===this.sourceTexture||void 0===this.normalTexture||void 0===this.depthTexture||void 0===this.reflectivityTexture||void 0===this.camera)throw new Error('FrameGraphSSRRenderingPipelineTask "'.concat(this.name,'": sourceTexture, normalTexture, depthTexture, reflectivityTexture and camera are required'));var t,n=this._frameGraph.textureManager.getTextureDescription(this.sourceTexture);this._ssr.sourceTexture=this.sourceTexture,this._ssr.sourceSamplingMode=this.sourceSamplingMode,this._ssr.camera=this.camera,this._ssr.normalTexture=this.normalTexture,this._ssr.depthTexture=this.depthTexture,this._ssr.backDepthTexture=this.backDepthTexture,this._ssr.reflectivityTexture=this.reflectivityTexture;var r={width:Math.floor(n.size.width/(this.ssr.ssrDownsample+1))||1,height:Math.floor(n.size.height/(this.ssr.ssrDownsample+1))||1},i={size:r,options:{createMipMaps:!1,types:[this.textureType],formats:[b.Y.TEXTUREFORMAT_RGBA],samples:1,useSRGBBuffers:[!1],labels:[""]},sizeIsPercentage:!1};if((this.ssr.blurDispersionStrength>0||!this.targetTexture)&&(t=this._frameGraph.textureManager.createRenderTargetTexture(this._ssr.name,i)),0===this.ssr.blurDispersionStrength)this._ssr.targetTexture=this.outputTexture,void 0!==t?this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture,t):this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture,this.targetTexture),this._ssr.record(!0);else{this._ssr.targetTexture=t,this._ssr.record(!0),r.width=Math.floor(n.size.width/(this.ssr.blurDownsample+1))||1,r.height=Math.floor(n.size.height/(this.ssr.blurDownsample+1))||1;var o=this._frameGraph.textureManager.getTextureCreationOptions(this.sourceTexture);this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture,this.targetTexture,this.name+" Output",o);var a=this._frameGraph.textureManager.createRenderTargetTexture(this._ssrBlurX.name,i);this._ssrBlurX.sourceTexture=t,this._ssrBlurX.sourceSamplingMode=b.Y.TEXTURE_BILINEAR_SAMPLINGMODE,this._ssrBlurX.targetTexture=a,this._ssrBlurX.record(!0);var s=this._frameGraph.textureManager.createRenderTargetTexture(this._ssrBlurY.name,i);this._ssrBlurY.sourceTexture=a,this._ssrBlurY.sourceSamplingMode=b.Y.TEXTURE_BILINEAR_SAMPLINGMODE,this._ssrBlurY.targetTexture=s,this._ssrBlurY.record(!0),this._ssrBlurCombiner.sourceTexture=this.sourceTexture,this._ssrBlurCombiner.sourceSamplingMode=this.sourceSamplingMode,this._ssrBlurCombiner.targetTexture=this.outputTexture,this._ssrBlurCombiner.record(!0,void 0,(function(t){t.bindTextureHandle(e._ssrBlurCombiner.drawWrapper.effect,"mainSampler",e.sourceTexture),t.bindTextureHandle(e._ssrBlurCombiner.drawWrapper.effect,"textureSampler",s),t.bindTextureHandle(e._ssrBlurCombiner.drawWrapper.effect,"reflectivitySampler",e.reflectivityTexture),e.ssr.useFresnel&&(t.bindTextureHandle(e._ssrBlurCombiner.drawWrapper.effect,"normalSampler",e.normalTexture),t.bindTextureHandle(e._ssrBlurCombiner.drawWrapper.effect,"depthSampler",e.depthTexture))})).addDependencies(s)}var l=this._frameGraph.addRenderPass(this.name+"_disabled",!0);l.addDependencies(this.sourceTexture),l.setRenderTarget(this.outputTexture),l.setExecuteFunc((function(t){t.copyTexture(e.sourceTexture)}))},t.prototype.dispose=function(){this._ssr.dispose(),this._ssrBlurX.dispose(),this._ssrBlurY.dispose(),this._ssrBlurCombiner.dispose(),this.ssr.dispose(),e.prototype.dispose.call(this)},t}(wl.L),Qm=function(e){function t(t,n,r,i){void 0===i&&(i=b.Y.TEXTURETYPE_UNSIGNED_BYTE);var o=e.call(this,t,n,r)||this;return o._additionalConstructionParameters=[i],o.registerInput("camera",Ap.Camera),o.registerInput("geomDepth",Ap.AutoDetect),o.registerInput("geomNormal",Ap.AutoDetect),o.registerInput("geomReflectivity",Ap.TextureReflectivity),o.registerInput("geomBackDepth",Ap.AutoDetect,!0),o.geomNormal.addExcludedConnectionPointFromAllowedTypes(Ap.TextureWorldNormal|Ap.TextureViewNormal),o.geomDepth.addExcludedConnectionPointFromAllowedTypes(Ap.TextureScreenDepth|Ap.TextureViewDepth),o.geomBackDepth.addExcludedConnectionPointFromAllowedTypes(Ap.TextureScreenDepth|Ap.TextureViewDepth),o._finalizeInputOutputRegistering(),o._frameGraphTask=new Zm(o.name,n,i),o}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"task",{get:function(){return this._frameGraphTask},enumerable:!1,configurable:!0}),t.prototype._createTask=function(e){var t=this.sourceSamplingMode,n=this.maxDistance,r=this.step,i=this.thickness,o=this.strength,a=this.reflectionSpecularFalloffExponent,s=this.maxSteps,l=this.roughnessFactor,c=this.selfCollisionNumSkip,u=this.reflectivityThreshold,h=this.ssrDownsample,d=this.blurDispersionStrength,p=this.blurDownsample,f=this.enableSmoothReflections,m=this.attenuateScreenBorders,_=this.attenuateIntersectionDistance,g=this.attenuateIntersectionIterations,v=this.attenuateFacingCamera,y=this.attenuateBackfaceReflection,b=this.clipToFrustum,S=this.enableAutomaticThicknessComputation,T=this.useFresnel,E=this.inputTextureColorIsInGammaSpace,x=this.generateOutputInGammaSpace,P=this.debug;this._frameGraphTask.dispose(),this._frameGraphTask=new Zm(this.name,this._frameGraph,e),this.sourceSamplingMode=t,this.maxDistance=n,this.step=r,this.thickness=i,this.strength=o,this.reflectionSpecularFalloffExponent=a,this.maxSteps=s,this.roughnessFactor=l,this.selfCollisionNumSkip=c,this.reflectivityThreshold=u,this.ssrDownsample=h,this.blurDispersionStrength=d,this.blurDownsample=p,this.enableSmoothReflections=f,this.attenuateScreenBorders=m,this.attenuateIntersectionDistance=_,this.attenuateIntersectionIterations=g,this.attenuateFacingCamera=v,this.attenuateBackfaceReflection=y,this.clipToFrustum=b,this.useFresnel=T,this.enableAutomaticThicknessComputation=S,this.inputTextureColorIsInGammaSpace=E,this.generateOutputInGammaSpace=x,this.debug=P,this._additionalConstructionParameters=[e]},Object.defineProperty(t.prototype,"textureType",{get:function(){return this._frameGraphTask.textureType},set:function(e){this._createTask(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"debug",{get:function(){return this._frameGraphTask.ssr.debug},set:function(e){this._frameGraphTask.ssr.debug=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"strength",{get:function(){return this._frameGraphTask.ssr.strength},set:function(e){this._frameGraphTask.ssr.strength=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"reflectionSpecularFalloffExponent",{get:function(){return this._frameGraphTask.ssr.reflectionSpecularFalloffExponent},set:function(e){this._frameGraphTask.ssr.reflectionSpecularFalloffExponent=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"reflectivityThreshold",{get:function(){return this._frameGraphTask.ssr.reflectivityThreshold},set:function(e){this._frameGraphTask.ssr.reflectivityThreshold=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"thickness",{get:function(){return this._frameGraphTask.ssr.thickness},set:function(e){this._frameGraphTask.ssr.thickness=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"step",{get:function(){return this._frameGraphTask.ssr.step},set:function(e){this._frameGraphTask.ssr.step=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableSmoothReflections",{get:function(){return this._frameGraphTask.ssr.enableSmoothReflections},set:function(e){this._frameGraphTask.ssr.enableSmoothReflections=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxSteps",{get:function(){return this._frameGraphTask.ssr.maxSteps},set:function(e){this._frameGraphTask.ssr.maxSteps=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxDistance",{get:function(){return this._frameGraphTask.ssr.maxDistance},set:function(e){this._frameGraphTask.ssr.maxDistance=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"roughnessFactor",{get:function(){return this._frameGraphTask.ssr.roughnessFactor},set:function(e){this._frameGraphTask.ssr.roughnessFactor=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"selfCollisionNumSkip",{get:function(){return this._frameGraphTask.ssr.selfCollisionNumSkip},set:function(e){this._frameGraphTask.ssr.selfCollisionNumSkip=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ssrDownsample",{get:function(){return this._frameGraphTask.ssr.ssrDownsample},set:function(e){this._frameGraphTask.ssr.ssrDownsample=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clipToFrustum",{get:function(){return this._frameGraphTask.ssr.clipToFrustum},set:function(e){this._frameGraphTask.ssr.clipToFrustum=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableAutomaticThicknessComputation",{get:function(){return this._frameGraphTask.ssr.enableAutomaticThicknessComputation},set:function(e){this._frameGraphTask.ssr.enableAutomaticThicknessComputation=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"useFresnel",{get:function(){return this._frameGraphTask.ssr.useFresnel},set:function(e){this._frameGraphTask.ssr.useFresnel=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"blurDispersionStrength",{get:function(){return this._frameGraphTask.ssr.blurDispersionStrength},set:function(e){this._frameGraphTask.ssr.blurDispersionStrength=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"blurDownsample",{get:function(){return this._frameGraphTask.ssr.blurDownsample},set:function(e){this._frameGraphTask.ssr.blurDownsample=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"attenuateScreenBorders",{get:function(){return this._frameGraphTask.ssr.attenuateScreenBorders},set:function(e){this._frameGraphTask.ssr.attenuateScreenBorders=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"attenuateIntersectionDistance",{get:function(){return this._frameGraphTask.ssr.attenuateIntersectionDistance},set:function(e){this._frameGraphTask.ssr.attenuateIntersectionDistance=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"attenuateIntersectionIterations",{get:function(){return this._frameGraphTask.ssr.attenuateIntersectionIterations},set:function(e){this._frameGraphTask.ssr.attenuateIntersectionIterations=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"attenuateFacingCamera",{get:function(){return this._frameGraphTask.ssr.attenuateFacingCamera},set:function(e){this._frameGraphTask.ssr.attenuateFacingCamera=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"attenuateBackfaceReflection",{get:function(){return this._frameGraphTask.ssr.attenuateBackfaceReflection},set:function(e){this._frameGraphTask.ssr.attenuateBackfaceReflection=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"inputTextureColorIsInGammaSpace",{get:function(){return this._frameGraphTask.ssr.inputTextureColorIsInGammaSpace},set:function(e){this._frameGraphTask.ssr.inputTextureColorIsInGammaSpace=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"generateOutputInGammaSpace",{get:function(){return this._frameGraphTask.ssr.generateOutputInGammaSpace},set:function(e){this._frameGraphTask.ssr.generateOutputInGammaSpace=e},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"NodeRenderGraphSSRPostProcessBlock"},Object.defineProperty(t.prototype,"camera",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"geomDepth",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"geomNormal",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"geomReflectivity",{get:function(){return this._inputs[5]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"geomBackDepth",{get:function(){return this._inputs[6]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(t){var n,r,i,o,a;if(e.prototype._buildBlock.call(this,t),this._frameGraphTask.normalTexture=null===(n=this.geomNormal.connectedPoint)||void 0===n?void 0:n.value,this._frameGraphTask.depthTexture=null===(r=this.geomDepth.connectedPoint)||void 0===r?void 0:r.value,this._frameGraphTask.reflectivityTexture=null===(i=this.geomReflectivity.connectedPoint)||void 0===i?void 0:i.value,this._frameGraphTask.backDepthTexture=null===(o=this.geomBackDepth.connectedPoint)||void 0===o?void 0:o.value,this._frameGraphTask.camera=null===(a=this.camera.connectedPoint)||void 0===a?void 0:a.value,this.enableAutomaticThicknessComputation){if(!this._frameGraphTask.backDepthTexture)throw new Error('SSR post process "'.concat(this.name,'": Automatic thickness computation requires a back depth texture to be connected!'));var s=this.geomBackDepth.connectedPoint.ownerBlock;if("NodeRenderGraphGeometryRendererBlock"===s.getClassName()){if(!s.reverseCulling)throw new Error('SSR post process "'.concat(this.name,'": Automatic thickness computation requires the geometry renderer block for the back depth texture to have reverse culling enabled!'));if(this._frameGraphTask.depthTexture&&"NodeRenderGraphGeometryRendererBlock"===this.geomDepth.connectedPoint.ownerBlock.getClassName()&&this.geomDepth.connectedPoint.type!==this.geomBackDepth.connectedPoint.type)throw new Error('SSR post process "'.concat(this.name,'": Automatic thickness computation requires that geomDepth and geomBackDepth have the same type (view or screen space depth)!'))}}this.geomNormal.connectedPoint&&this.geomNormal.connectedPoint.type===Ap.TextureWorldNormal&&(this._frameGraphTask.ssr.normalsAreInWorldSpace=!0,this._frameGraphTask.ssr.normalsAreUnsigned=!0),this.geomDepth.connectedPoint&&this.geomDepth.connectedPoint.type===Ap.TextureScreenDepth&&(this._frameGraphTask.ssr.useScreenspaceDepth=!0)},t.prototype._dumpPropertiesCode=function(){var t=[];return t.push("".concat(this._codeVariableName,".debug = ").concat(this.debug,";")),t.push("".concat(this._codeVariableName,".strength = ").concat(this.strength,";")),t.push("".concat(this._codeVariableName,".reflectionSpecularFalloffExponent = ").concat(this.reflectionSpecularFalloffExponent,";")),t.push("".concat(this._codeVariableName,".reflectivityThreshold = ").concat(this.reflectivityThreshold,";")),t.push("".concat(this._codeVariableName,".thickness = ").concat(this.thickness,";")),t.push("".concat(this._codeVariableName,".step = ").concat(this.step,";")),t.push("".concat(this._codeVariableName,".enableSmoothReflections = ").concat(this.enableSmoothReflections,";")),t.push("".concat(this._codeVariableName,".maxSteps = ").concat(this.maxSteps,";")),t.push("".concat(this._codeVariableName,".maxDistance = ").concat(this.maxDistance,";")),t.push("".concat(this._codeVariableName,".roughnessFactor = ").concat(this.roughnessFactor,";")),t.push("".concat(this._codeVariableName,".selfCollisionNumSkip = ").concat(this.selfCollisionNumSkip,";")),t.push("".concat(this._codeVariableName,".ssrDownsample = ").concat(this.ssrDownsample,";")),t.push("".concat(this._codeVariableName,".clipToFrustum = ").concat(this.clipToFrustum,";")),t.push("".concat(this._codeVariableName,".useFresnel = ").concat(this.useFresnel,";")),t.push("".concat(this._codeVariableName,".enableAutomaticThicknessComputation = ").concat(this.enableAutomaticThicknessComputation,";")),t.push("".concat(this._codeVariableName,".blurDispersionStrength = ").concat(this.blurDispersionStrength,";")),t.push("".concat(this._codeVariableName,".blurDownsample = ").concat(this.blurDownsample,";")),t.push("".concat(this._codeVariableName,".attenuateScreenBorders = ").concat(this.attenuateScreenBorders,";")),t.push("".concat(this._codeVariableName,".attenuateIntersectionDistance = ").concat(this.attenuateIntersectionDistance,";")),t.push("".concat(this._codeVariableName,".attenuateIntersectionIterations = ").concat(this.attenuateIntersectionIterations,";")),t.push("".concat(this._codeVariableName,".attenuateFacingCamera = ").concat(this.attenuateFacingCamera,";")),t.push("".concat(this._codeVariableName,".attenuateBackfaceReflection = ").concat(this.attenuateBackfaceReflection,";")),t.push("".concat(this._codeVariableName,".inputTextureColorIsInGammaSpace = ").concat(this.inputTextureColorIsInGammaSpace,";")),t.push("".concat(this._codeVariableName,".generateOutputInGammaSpace = ").concat(this.generateOutputInGammaSpace,";")),e.prototype._dumpPropertiesCode.call(this)+t.join("\n")},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.debug=this.debug,t.strength=this.strength,t.reflectionSpecularFalloffExponent=this.reflectionSpecularFalloffExponent,t.reflectivityThreshold=this.reflectivityThreshold,t.thickness=this.thickness,t.step=this.step,t.enableSmoothReflections=this.enableSmoothReflections,t.maxSteps=this.maxSteps,t.maxDistance=this.maxDistance,t.roughnessFactor=this.roughnessFactor,t.selfCollisionNumSkip=this.selfCollisionNumSkip,t.ssrDownsample=this.ssrDownsample,t.clipToFrustum=this.clipToFrustum,t.useFresnel=this.useFresnel,t.enableAutomaticThicknessComputation=this.enableAutomaticThicknessComputation,t.blurDispersionStrength=this.blurDispersionStrength,t.blurDownsample=this.blurDownsample,t.attenuateScreenBorders=this.attenuateScreenBorders,t.attenuateIntersectionDistance=this.attenuateIntersectionDistance,t.attenuateIntersectionIterations=this.attenuateIntersectionIterations,t.attenuateFacingCamera=this.attenuateFacingCamera,t.attenuateBackfaceReflection=this.attenuateBackfaceReflection,t.inputTextureColorIsInGammaSpace=this.inputTextureColorIsInGammaSpace,t.generateOutputInGammaSpace=this.generateOutputInGammaSpace,t},t.prototype._deserialize=function(t){e.prototype._deserialize.call(this,t),this.debug=t.debug,this.strength=t.strength,this.reflectionSpecularFalloffExponent=t.reflectionSpecularFalloffExponent,this.reflectivityThreshold=t.reflectivityThreshold,this.thickness=t.thickness,this.step=t.step,this.enableSmoothReflections=t.enableSmoothReflections,this.maxSteps=t.maxSteps,this.maxDistance=t.maxDistance,this.roughnessFactor=t.roughnessFactor,this.selfCollisionNumSkip=t.selfCollisionNumSkip,this.ssrDownsample=t.ssrDownsample,this.clipToFrustum=t.clipToFrustum,this.useFresnel=t.useFresnel,this.enableAutomaticThicknessComputation=t.enableAutomaticThicknessComputation,this.blurDispersionStrength=t.blurDispersionStrength,this.blurDownsample=t.blurDownsample,this.attenuateScreenBorders=t.attenuateScreenBorders,this.attenuateIntersectionDistance=t.attenuateIntersectionDistance,this.attenuateIntersectionIterations=t.attenuateIntersectionIterations,this.attenuateFacingCamera=t.attenuateFacingCamera,this.attenuateBackfaceReflection=t.attenuateBackfaceReflection,this.inputTextureColorIsInGammaSpace=t.inputTextureColorIsInGammaSpace,this.generateOutputInGammaSpace=t.generateOutputInGammaSpace},(0,f.Cg)([Jp("Texture type",9,"SSR")],t.prototype,"textureType",null),(0,f.Cg)([Jp("Debug",0,"SSR")],t.prototype,"debug",null),(0,f.Cg)([Jp("Strength",1,"SSR",{min:0,max:5})],t.prototype,"strength",null),(0,f.Cg)([Jp("Reflection exponent",1,"SSR",{min:0,max:5})],t.prototype,"reflectionSpecularFalloffExponent",null),(0,f.Cg)([Jp("Reflectivity threshold",1,"SSR",{min:0,max:1})],t.prototype,"reflectivityThreshold",null),(0,f.Cg)([Jp("Thickness",1,"SSR",{min:0,max:10})],t.prototype,"thickness",null),(0,f.Cg)([Jp("Step",2,"SSR",{min:1,max:50})],t.prototype,"step",null),(0,f.Cg)([Jp("Smooth reflections",0,"SSR")],t.prototype,"enableSmoothReflections",null),(0,f.Cg)([Jp("Max steps",2,"SSR",{min:1,max:3e3})],t.prototype,"maxSteps",null),(0,f.Cg)([Jp("Max distance",1,"SSR",{min:1,max:3e3})],t.prototype,"maxDistance",null),(0,f.Cg)([Jp("Roughness factor",1,"SSR",{min:0,max:1})],t.prototype,"roughnessFactor",null),(0,f.Cg)([Jp("Self collision skips",2,"SSR",{min:1,max:10})],t.prototype,"selfCollisionNumSkip",null),(0,f.Cg)([Jp("SSR downsample",2,"SSR",{min:0,max:5})],t.prototype,"ssrDownsample",null),(0,f.Cg)([Jp("Clip to frustum",0,"SSR")],t.prototype,"clipToFrustum",null),(0,f.Cg)([Jp("Automatic thickness computation",0,"SSR")],t.prototype,"enableAutomaticThicknessComputation",null),(0,f.Cg)([Jp("Use Fresnel",0,"SSR")],t.prototype,"useFresnel",null),(0,f.Cg)([Jp("Strength",1,"Blur",{min:0,max:.15})],t.prototype,"blurDispersionStrength",null),(0,f.Cg)([Jp("Blur downsample",2,"Blur",{min:0,max:5})],t.prototype,"blurDownsample",null),(0,f.Cg)([Jp("Screen borders",0,"Attenuations")],t.prototype,"attenuateScreenBorders",null),(0,f.Cg)([Jp("Distance",0,"Attenuations")],t.prototype,"attenuateIntersectionDistance",null),(0,f.Cg)([Jp("Step iterations",0,"Attenuations")],t.prototype,"attenuateIntersectionIterations",null),(0,f.Cg)([Jp("Facing camera",0,"Attenuations")],t.prototype,"attenuateFacingCamera",null),(0,f.Cg)([Jp("Backface reflections",0,"Attenuations")],t.prototype,"attenuateBackfaceReflection",null),(0,f.Cg)([Jp("Input is in gamma space",0,"Color space")],t.prototype,"inputTextureColorIsInGammaSpace",null),(0,f.Cg)([Jp("Output to gamma space",0,"Color space")],t.prototype,"generateOutputInGammaSpace",null),t}(If);(0,h.Y5)("BABYLON.NodeRenderGraphSSRPostProcessBlock",Qm);var Jm=function(){function e(e,t,n,r,i){void 0===t&&(t=2),void 0===n&&(n=3),void 0===r&&(r=1),void 0===i&&(i=1),this._curIndex=0,this._sequence=[],this._numSamples=0,this.x=0,this.y=0,this._width=r,this._height=i,this._baseX=t,this._baseY=n,this._generateSequence(e),this.next()}return e.prototype.regenerate=function(e){this._generateSequence(e),this.next()},e.prototype.setDimensions=function(e,t){this._width=e,this._height=t},e.prototype.next=function(){this.x=this._sequence[this._curIndex]/this._width,this.y=this._sequence[this._curIndex+1]/this._height,this._curIndex+=2,this._curIndex>=2*this._numSamples&&(this._curIndex=0)},e.prototype._generateSequence=function(e){this._sequence=[],this._curIndex=0,this._numSamples=e;for(var t=1;t<=e;++t)this._sequence.push(this._halton(t,this._baseX)-.5,this._halton(t,this._baseY)-.5)},e.prototype._halton=function(e,t){for(var n=1,r=0;e>0;)r+=(n/=t)*(e%t),e=~~(e/t);return r},e}(),$m=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.TAA_JITTER=!1,t}return(0,f.C6)(t,e),t}(ho),e_=function(e){function t(n){var r=e.call(this,n,t.Name,300,new $m)||this;return r.registerForExtraEvents=!0,r.doNotSerialize=!0,r}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"manager",{get:function(){return this._manager},set:function(e){this._manager!==e&&(this.dispose(),this._manager=e,null==e||e._materialPlugins.push(this),this._updateMaterial())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isEnabled",{get:function(){var e,t;return null!==(t=null===(e=this._manager)||void 0===e?void 0:e.isEnabled)&&void 0!==t&&t},enumerable:!1,configurable:!0}),t.prototype._updateMaterial=function(){this._enable(this.isEnabled),this.markAllDefinesAsDirty()},t.prototype.isCompatible=function(){return!0},t.prototype.getClassName=function(){return"TAAJitterMaterialPlugin"},t.prototype.prepareDefines=function(e){e.TAA_JITTER=this.isEnabled},t.prototype.getUniforms=function(e){void 0===e&&(e=0);var t=[{name:"taa_jitter",size:2,type:"vec2"}];return 0===e?{ubo:t,vertex:"\n #ifdef TAA_JITTER\n uniform vec2 taa_jitter;\n #endif\n "}:{ubo:t}},t.prototype.hardBindForSubMesh=function(e){if(this.isEnabled){var t=this._manager.jitter;e.updateFloat2("taa_jitter",t.x,t.y)}},t.prototype.getCustomCode=function(e,t){return void 0===t&&(t=0),"vertex"!==e?null:1===t?{CUSTOM_VERTEX_MAIN_END:"\n #ifdef TAA_JITTER\n vertexOutputs.position += vec4f(uniforms.taa_jitter * vertexOutputs.position.w, 0.0, 0.0);\n #endif\n "}:{CUSTOM_VERTEX_MAIN_END:"\n #ifdef TAA_JITTER\n gl_Position.xy += taa_jitter * gl_Position.w;\n #endif\n "}},t.prototype.dispose=function(){if(this._manager){var e=this._manager._materialPlugins.indexOf(this);-1!==e&&this._manager._materialPlugins.splice(e,1)}},t.Name="TAAJitter",t}(Ro);(0,h.Y5)("BABYLON.TAAJitterMaterialPlugin",e_);var t_,n_=function(){function e(e){var t=this;this._isEnabled=!0,this.jitter=new c.I9,this._materialPlugins=[];for(var n=0,r=e.materials;n "+this.name},t.prototype.detachFromEndpoint=function(e){var t=this._endpoints.indexOf(e);-1!==t&&(this._endpoints.splice(t,1),e._outputs[0]._typeConnectionSource=null,e._entryPoint=null)},t.prototype.dispose=function(){e.prototype.dispose.call(this);for(var t=0,n=this._endpoints;ty.snapDistance?(a=Math.floor(Math.abs(s)/y.snapDistance),s<0&&(a*=-1),I%=y.snapDistance,i.scaleToRef(y.snapDistance*a,i),o=!0):i.scaleInPlace(0)}i.addInPlaceFromFloats(1,1,1),i.x=Math.abs(i.x)0&&y.incrementalSnap?(y.attachedNode.getWorldMatrix().decompose(void 0,c.AA.Quaternion[0],c.AA.Vector3[2],ja.PreserveScaling?l:void 0),i.addInPlace(y._incrementalStartupValue),i.addInPlaceFromFloats(-1,-1,-1),i.x=Math.abs(i.x)*(y._incrementalStartupValue.x>0?1:-1),i.y=Math.abs(i.y)*(y._incrementalStartupValue.y>0?1:-1),i.z=Math.abs(i.z)*(y._incrementalStartupValue.z>0?1:-1),c.uq.ComposeToRef(i,c.AA.Quaternion[0],c.AA.Vector3[2],c.AA.Matrix[1])):(c.uq.ScalingToRef(i.x,i.y,i.z,c.AA.Matrix[2]),c.AA.Matrix[2].multiplyToRef(y.attachedNode.getWorldMatrix(),c.AA.Matrix[1])),c.AA.Matrix[1].decompose(c.AA.Vector3[1],void 0,void 0,ja.PreserveScaling?l:void 0);var u=1e5;Math.abs(c.AA.Vector3[1].x)=8?1.6:.4,height:e>=4&&e<8?1.6:.4,depth:.4},n.utilityLayerScene);t.rotation.x=e<4||e>=8?.25*Math.PI:0,t.rotation.y=e>=4&&e<8?.25*Math.PI:0,t.bakeTransformIntoVertices(t.computeWorldMatrix(!0)),t.rotationQuaternion=new c.PT,t.material=a._coloredMaterial,t.isNearGrabbable=!0;var i=new rr({});i.moveAttached=!1,i.updateDragPlane=!1,t.addBehavior(i);var o=new c.Pq(1,0,0),s=0,l=0;i.onDragStartObservable.add((function(){o.copyFrom(t.forward),s=0,l=0}));var u=function(){var t=Math.floor(e/4);return c.AA.Vector3[0].set(0==t?1:0,1==t?1:0,2==t?1:0),c.AA.Vector3[0]};i.onDragObservable.add((function(t){if(r.onRotationSphereDragObservable.notifyObservers({dragOperation:0,dragAxis:u().clone()}),r.attachedMesh){var n=r.attachedMesh.parent;if(n&&n.scaling&&n.scaling.isNonUniformWithinEpsilon(.001))return void y.V.Warn("BoundingBoxGizmo controls are not supported on child meshes with non-uniform parent scaling");Kn._RemoveAndStorePivotPoint(r.attachedMesh);var i=o,a=t.dragPlaneNormal.scale(c.Pq.Dot(t.dragPlaneNormal,i)),h=i.subtract(a).normalizeToNew(),d=c.Pq.Dot(h,t.delta)<0?Math.abs(t.delta.length()):-Math.abs(t.delta.length());if(d=d/r._boundingDimensions.length()*r._anchorMesh.scaling.length(),r.attachedMesh.rotationQuaternion||(r.attachedMesh.rotationQuaternion=c.PT.RotationYawPitchRoll(r.attachedMesh.rotation.y,r.attachedMesh.rotation.x,r.attachedMesh.rotation.z)),r._anchorMesh.rotationQuaternion||(r._anchorMesh.rotationQuaternion=c.PT.RotationYawPitchRoll(r._anchorMesh.rotation.y,r._anchorMesh.rotation.x,r._anchorMesh.rotation.z)),s+=d,Math.abs(s)<=2*Math.PI){if(r.rotationSnapDistance>0){var p=Math.floor(Math.abs(s)/r.rotationSnapDistance)*(s<0?-1:1),f=r.rotationSnapDistance*p;d=f-l,l=f}e>=8?c.PT.RotationYawPitchRollToRef(0,0,d,r._tmpQuaternion):e>=4?c.PT.RotationYawPitchRollToRef(d,0,0,r._tmpQuaternion):c.PT.RotationYawPitchRollToRef(0,d,0,r._tmpQuaternion),r.attachedMesh.isUsingPivotMatrix()&&r._anchorMesh.position.copyFrom(r.attachedMesh.position),r._anchorMesh.addChild(r.attachedMesh),r._anchorMesh.getScene().useRightHandedSystem&&r._tmpQuaternion.conjugateInPlace(),r._tmpQuaternion.normalize(),r._anchorMesh.rotationQuaternion.multiplyToRef(r._tmpQuaternion,r._anchorMesh.rotationQuaternion),r._anchorMesh.rotationQuaternion.normalize(),r._anchorMesh.removeChild(r.attachedMesh),r.attachedMesh.setParent(n)}r.updateBoundingBox(),Kn._RestorePivotPoint(r.attachedMesh)}r._updateDummy()})),i.onDragStartObservable.add((function(){r.onDragStartObservable.notifyObservers({dragOperation:0,dragAxis:u().clone()}),r._dragging=!0,r._selectNode(t)})),i.onDragEndObservable.add((function(e){r.onRotationSphereDragEndObservable.notifyObservers({dragOperation:0,dragAxis:u().clone()}),r._dragging=!1,r._selectNode(null),r._updateDummy(),r._unhoverMeshOnTouchUp(e.pointerInfo,t)})),a._rotateAnchorsDragBehaviors.push(i),a._rotateAnchorsParent.addChild(t)},a=this,s=0;s<12;s++)o(s);r._rootMesh.addChild(r._rotateAnchorsParent),r._scaleBoxesParent=new Ee("",n.utilityLayerScene),r._scaleBoxesParent.rotationQuaternion=new c.PT;var h=function(e){for(var t=function(t){for(var i=function(i){var o=(1===e?1:0)+(1===t?1:0)+(1===i?1:0);if(1===o||3===o)return"continue";var a=2===o?es("",{size:1},n.utilityLayerScene):d._getCornerMesh(n);0===o&&(a.rotationQuaternion=c.PT.FromEulerAngles(.25*t*Math.PI,.25*(i+3*e-e*i)*Math.PI,0)),a.material=d._coloredMaterial,a._internalMetadata=2===o,a.isNearGrabbable=!0,c.AA.Vector3[0].set(e-1,t-1,i-1),c.AA.Vector3[0].normalize(),a.computeWorldMatrix(!0).invertToRef(c.AA.Matrix[0]);var s=c.Pq.TransformCoordinates(c.AA.Vector3[0],c.AA.Matrix[0]);s.normalize();var l=new rr({dragAxis:s});l.updateDragPlane=!1,l.moveAttached=!1;var u=0,h=0;a.addBehavior(l),l.onDragObservable.add((function(n){if(r.onScaleBoxDragObservable.notifyObservers({dragOperation:1,dragAxis:new c.Pq(e-1,t-1,i-1)}),r.attachedMesh){var l=r.attachedMesh.parent;if(l&&l.scaling&&l.scaling.isNonUniformWithinEpsilon(.001))return void y.V.Warn("BoundingBoxGizmo controls are not supported on child meshes with non-uniform parent scaling");Kn._RemoveAndStorePivotPoint(r.attachedMesh);var d=n.dragDistance/r._boundingDimensions.length()*r._anchorMesh.scaling.length();if(u+=d,r.scalingSnapDistance>0){var p=Math.floor(Math.abs(u)/r.scalingSnapDistance)*(u<0?-1:1),f=r.scalingSnapDistance*p;d=f-h,h=f}var m=new c.Pq(d,d,d),_=new c.Pq(h,h,h);2===o&&(m.x*=Math.abs(s.x),m.y*=Math.abs(s.y),m.z*=Math.abs(s.z)),m.scaleInPlace(r._scaleDragSpeed),m.multiplyInPlace(r._axisFactor),_.scaleInPlace(r._scaleDragSpeed),_.multiplyInPlace(r._axisFactor),_.addInPlace(r._incrementalStartupValue),r.updateBoundingBox(),r.scalePivot?(r.attachedMesh.getWorldMatrix().getRotationMatrixToRef(r._tmpRotationMatrix),r._boundingDimensions.scaleToRef(.5,r._tmpVector),c.Pq.TransformCoordinatesToRef(r._tmpVector,r._tmpRotationMatrix,r._tmpVector),r._anchorMesh.position.subtractInPlace(r._tmpVector),r._boundingDimensions.multiplyToRef(r.scalePivot,r._tmpVector),c.Pq.TransformCoordinatesToRef(r._tmpVector,r._tmpRotationMatrix,r._tmpVector),r._anchorMesh.position.addInPlace(r._tmpVector)):(a.absolutePosition.subtractToRef(r._anchorMesh.position,r._tmpVector),r._anchorMesh.position.subtractInPlace(r._tmpVector),r.attachedMesh.isUsingPivotMatrix()&&r._anchorMesh.position.subtractInPlace(r.attachedMesh.getPivotPoint())),r._anchorMesh.addChild(r.attachedMesh),r.incrementalSnap?(_.x/=Math.abs(r._incrementalStartupValue.x)Re.bH)}n++}}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scaleDragSpeed",{get:function(){return this._scaleDragSpeed},set:function(e){this._scaleDragSpeed=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"coloredMaterial",{get:function(){return this._coloredMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hoverMaterial",{get:function(){return this._hoverColoredMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pointerDragBehavior",{get:function(){return this._pointerDragBehavior},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isDragging",{get:function(){return this._dragging||this._pointerDragBehavior.dragging},enumerable:!1,configurable:!0}),t.prototype.setColor=function(e){this._coloredMaterial.emissiveColor=e,this._hoverColoredMaterial.emissiveColor=e.clone().add(new u.v9(.3,.3,.3));for(var t=0,n=this._lineBoundingBox.getChildren();t0&&(T.scaleInPlace(-1),E.scaleInPlace(-1),f=!0)}c.Pq.Dot(E,h)>0&&(p=-p),c.AA.Vector3[0].set(p,0,0),m.dragBehavior.validateDrag(c.AA.Vector3[0])||(p=0);var g=!1;if(0!=m.snapDistance)if(P+=p,Math.abs(P)>m.snapDistance){var v=Math.floor(Math.abs(P)/m.snapDistance);P<0&&(v*=-1),P%=m.snapDistance,p=m.snapDistance*v,g=!0}else p=0;var A=Math.sin(p/2);if(R.set(T.x*A,T.y*A,T.z*A,Math.cos(p/2)),C.determinant()>0){var I=new c.Pq;R.toEulerAnglesToRef(I),c.PT.RotationYawPitchRollToRef(I.y,-I.x,-I.z,R)}if(m.updateGizmoRotationToMatchAttachedMesh)r.multiplyToRef(R,r),r.normalize(),c.uq.ComposeToRef(t,r,o,m.attachedNode.getWorldMatrix());else{R.toRotationMatrix(c.AA.Matrix[0]);var O=m.attachedNode.getWorldMatrix().getTranslation();m.attachedNode.getWorldMatrix().multiplyToRef(c.AA.Matrix[0],m.attachedNode.getWorldMatrix()),m.attachedNode.getWorldMatrix().setTranslation(O)}b.copyFrom(e.dragPlanePoint),g&&(x.snapDistance=p,m.onSnapObservable.notifyObservers(x)),m._angles.y+=i.utilityLayerScene.useRightHandedSystem?-p:p,m.angle+=f?-p:p,m._rotationShaderMaterial.setVector3("angles",m._angles),m._matrixChanged()}}));var A=i._getSharedGizmoLight();A.includedOnlyMeshes=A.includedOnlyMeshes.concat(m._rootMesh.getChildMeshes(!1));var I={colliderMeshes:[v],gizmoMeshes:[g],material:m._coloredMaterial,hoverMaterial:m._hoverMaterial,disableMaterial:m._disableMaterial,active:!1,dragBehavior:m.dragBehavior};return null===(f=m._parent)||void 0===f||f.addToAxisCache(m._gizmoMesh,I),m._pointerObserver=i.utilityLayerScene.onPointerObservable.add((function(e){var n;if(!m._customMeshSet&&(m.dragBehavior.maxDragAngle=t.MaxDragAngle,m._isHovered=!(-1==I.colliderMeshes.indexOf(null===(n=null==e?void 0:e.pickInfo)||void 0===n?void 0:n.pickedMesh)),!m._parent)){var r=I.dragBehavior.enabled?m._isHovered||m._dragging?m._hoverMaterial:m._coloredMaterial:m._disableMaterial;m._setGizmoMeshMaterial(I.gizmoMeshes,r)}})),m.dragBehavior.onEnabledObservable.add((function(e){m._setGizmoMeshMaterial(I.gizmoMeshes,e?m._coloredMaterial:m._disableMaterial)})),m}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"coloredMaterial",{get:function(){return this._coloredMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hoverMaterial",{get:function(){return this._hoverMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotationColor",{set:function(e){this._rotationShaderMaterial.setColor3("rotationColor",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"disableMaterial",{get:function(){return this._disableMaterial},enumerable:!1,configurable:!0}),t.prototype._createGizmoMesh=function(e,t,n){var r=sa("ignore",{diameter:.6,thickness:.03*t,tessellation:n},this.gizmoLayer.utilityLayerScene);r.visibility=0;var i=sa("",{diameter:.6,thickness:.005*t,tessellation:n},this.gizmoLayer.utilityLayerScene);return i.material=this._coloredMaterial,i.rotation.x=Math.PI/2,r.rotation.x=Math.PI/2,e.addChild(i,ja.PreserveScaling),e.addChild(r,ja.PreserveScaling),{rotationMesh:i,collider:r}},t.prototype._attachedNodeChanged=function(e){this.dragBehavior&&(this.dragBehavior.enabled=!!e)},Object.defineProperty(t.prototype,"isEnabled",{get:function(){return this._isEnabled},set:function(e){this._isEnabled=e,e?this._parent&&(this.attachedMesh=this._parent.attachedMesh):this.attachedMesh=null},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this.onSnapObservable.clear(),this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver),this.dragBehavior.detach(),this._gizmoMesh&&this._gizmoMesh.dispose(),this._rotationDisplayPlane&&this._rotationDisplayPlane.dispose(),this._rotationShaderMaterial&&this._rotationShaderMaterial.dispose();for(var t=0,n=[this._coloredMaterial,this._hoverMaterial,this._disableMaterial];td.snapDistance){var i=(r<0?Math.ceil:Math.floor)(r/d.snapDistance);t[n]=t[n]%d.snapDistance,f.set(0==n?1:0,1==n?1:0,2==n?1:0),f.scaleInPlace(d.snapDistance*i),m.addInPlace(f)}}p.fromArray(t),d.attachedNode.getWorldMatrix().getTranslationToRef(c.AA.Vector3[0]),c.AA.Vector3[0].addToRef(m,c.AA.Vector3[0]),d.dragBehavior.validateDrag(c.AA.Vector3[0])&&(d.attachedNode.getWorldMatrix().addTranslationFromFloats(m.x,m.y,m.z),_.snapDistance=m.length(),d.onSnapObservable.notifyObservers(_))}d._matrixChanged()}})),d.dragBehavior.onDragStartObservable.add((function(){d._dragging=!0})),d.dragBehavior.onDragEndObservable.add((function(){d._dragging=!1}));var g=i._getSharedGizmoLight();g.includedOnlyMeshes=g.includedOnlyMeshes.concat(d._rootMesh.getChildMeshes(!1));var v={gizmoMeshes:d._gizmoMesh.getChildMeshes(),colliderMeshes:d._gizmoMesh.getChildMeshes(),material:d._coloredMaterial,hoverMaterial:d._hoverMaterial,disableMaterial:d._disableMaterial,active:!1,dragBehavior:d.dragBehavior};return null===(h=d._parent)||void 0===h||h.addToAxisCache(d._gizmoMesh,v),d._pointerObserver=i.utilityLayerScene.onPointerObservable.add((function(e){var t;if(!d._customMeshSet&&(d._isHovered=!(-1==v.colliderMeshes.indexOf(null===(t=null==e?void 0:e.pickInfo)||void 0===t?void 0:t.pickedMesh)),!d._parent)){var n=v.dragBehavior.enabled?d._isHovered||d._dragging?d._hoverMaterial:d._coloredMaterial:d._disableMaterial;d._setGizmoMeshMaterial(v.gizmoMeshes,n)}})),d.dragBehavior.onEnabledObservable.add((function(e){d._setGizmoMeshMaterial(v.gizmoMeshes,e?d._coloredMaterial:d._disableMaterial)})),d}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"coloredMaterial",{get:function(){return this._coloredMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hoverMaterial",{get:function(){return this._hoverMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"disableMaterial",{get:function(){return this._disableMaterial},enumerable:!1,configurable:!0}),t._CreatePlane=function(e,t){var n=new Ee("plane",e),r=Qn("dragPlane",{width:.1375,height:.1375,sideOrientation:2},e);return r.material=t,r.parent=n,n},t.prototype._attachedNodeChanged=function(e){this.dragBehavior&&(this.dragBehavior.enabled=!!e)},Object.defineProperty(t.prototype,"isEnabled",{get:function(){return this._isEnabled},set:function(e){this._isEnabled=e,e?this._parent&&(this.attachedNode=this._parent.attachedNode):this.attachedNode=null},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this.onSnapObservable.clear(),this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver),this.dragBehavior.detach(),e.prototype.dispose.call(this),this._gizmoMesh&&this._gizmoMesh.dispose();for(var t=0,n=[this._coloredMaterial,this._hoverMaterial,this._disableMaterial];t0&&e.forEach((function(e,n){t._gizmoAxisCache.set(n,e)}))},e.prototype.releaseDrag=function(){for(var e=0,t=[this.gizmos.positionGizmo,this.gizmos.rotationGizmo,this.gizmos.scaleGizmo,this.gizmos.boundingBoxGizmo];e1e-4){var r=n;this._light.direction=new c.Pq(r.x,r.y,r.z),this._cachedForward.copyFrom(n)}else c.Pq.DistanceSquared(n,this._light.direction)>1e-4&&(this.attachedMesh.setDirection(this._light.direction),this.attachedMesh.computeWorldMatrix(!0),this._cachedForward.copyFrom(n))}}},t.prototype.dispose=function(){this.onClickedObservable.clear(),this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver),this._material.dispose(),e.prototype.dispose.call(this),this._attachedMeshParent.dispose()},t._CreateHemisphericLightMesh=function(e){var n=new qe("hemisphereLight",e),r=w_(n.name,{segments:10,diameter:1},e);return r.position.z=-.15,r.rotation.x=Math.PI/2,r.parent=n,this._CreateLightLines(3,e).parent=n,n.scaling.scaleInPlace(t._Scale),n.rotation.x=Math.PI/2,n},t._CreatePointLightMesh=function(e){var n=new qe("pointLight",e),r=rs(n.name,{segments:10,diameter:1},e);return r.rotation.x=Math.PI/2,r.parent=n,this._CreateLightLines(5,e).parent=n,n.scaling.scaleInPlace(t._Scale),n.rotation.x=Math.PI/2,n},t._CreateSpotLightMesh=function(e){var n=new qe("spotLight",e);rs(n.name,{segments:10,diameter:1},e).parent=n;var r=w_(n.name,{segments:10,diameter:2},e);return r.parent=n,r.rotation.x=-Math.PI/2,this._CreateLightLines(2,e).parent=n,n.scaling.scaleInPlace(t._Scale),n.rotation.x=Math.PI/2,n},t._CreateDirectionalLightMesh=function(e){var n=new qe("directionalLight",e),r=new qe(n.name,e);r.parent=n,rs(n.name,{diameter:1.2,segments:10},e).parent=r;var i=Ga(n.name,{updatable:!1,height:6,diameterTop:.3,diameterBottom:.3,tessellation:6,subdivisions:1},e);i.parent=r;var o=i.clone(n.name);o.scaling.y=.5,o.position.x+=1.25;var a=i.clone(n.name);a.scaling.y=.5,a.position.x+=-1.25;var s=Ga(n.name,{updatable:!1,height:1,diameterTop:0,diameterBottom:.6,tessellation:6,subdivisions:1},e);return s.position.y+=3,s.parent=r,(o=s.clone(n.name)).position.y=1.5,o.position.x+=1.25,(a=s.clone(n.name)).position.y=1.5,a.position.x+=-1.25,r.scaling.scaleInPlace(t._Scale),r.rotation.z=Math.PI/2,r.rotation.y=Math.PI/2,n},t._Scale=.007,t._CreateLightLines=function(e,t){var n=new qe("root",t);n.rotation.x=Math.PI/2;var r=new qe("linePivot",t);r.parent=n;var i=Ga("line",{updatable:!1,height:2,diameterTop:.2,diameterBottom:.3,tessellation:6,subdivisions:1},t);if(i.position.y=i.scaling.y/2+1.2,i.parent=r,e<2)return r;for(var o=0;o<4;o++){var a=r.clone("lineParentClone");a.rotation.z=Math.PI/4,a.rotation.y=Math.PI/2+Math.PI/2*o,a.getChildMeshes()[0].scaling.y=.5,a.getChildMeshes()[0].scaling.x=a.getChildMeshes()[0].scaling.z=.8,a.getChildMeshes()[0].position.y=a.getChildMeshes()[0].scaling.y/2+1.2}if(e<3)return n;for(o=0;o<4;o++){var s=r.clone("linePivotClone");s.rotation.z=Math.PI/2,s.rotation.y=Math.PI/2*o}if(e<4)return n;for(o=0;o<4;o++){var l=r.clone("linePivotClone");l.rotation.z=Math.PI+Math.PI/4,l.rotation.y=Math.PI/2+Math.PI/2*o,l.getChildMeshes()[0].scaling.y=.5,l.getChildMeshes()[0].scaling.x=l.getChildMeshes()[0].scaling.z=.8,l.getChildMeshes()[0].position.y=l.getChildMeshes()[0].scaling.y/2+1.2}return e<5||(r.clone("linePivotClone").rotation.z=Math.PI),n},t}(ja),k_=function(e){function t(t,n,r){void 0===t&&(t=Ya.DefaultUtilityLayer);var i=e.call(this,t)||this;return i._pointerObserver=null,i.onClickedObservable=new l.cP,i._camera=null,i._invProjection=new Du.uq,i._material=new Bo("cameraGizmoMaterial",i.gizmoLayer.utilityLayerScene),i._frustumLinesColor=r,i._material.diffuseColor=null!=n?n:new u.v9(.5,.5,.5),i._material.specularColor=new u.v9(.1,.1,.1),i._pointerObserver=t.utilityLayerScene.onPointerObservable.add((function(e){i._camera&&(i._isHovered=!(!e.pickInfo||-1==i._rootMesh.getChildMeshes().indexOf(e.pickInfo.pickedMesh)),i._isHovered&&e.type===En.Zp.POINTERDOWN&&0===e.event.button&&i.onClickedObservable.notifyObservers(i._camera))})),i}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"displayFrustum",{get:function(){return this._cameraLinesMesh.isEnabled()},set:function(e){this._cameraLinesMesh.setEnabled(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"camera",{get:function(){return this._camera},set:function(e){var n,r;if(this._camera=e,this.attachedNode=e,e){if(!this._customMeshSet){this._cameraMesh&&this._cameraMesh.dispose(),this._cameraMesh=t._CreateCameraMesh(this.gizmoLayer.utilityLayerScene);for(var i=0,o=this._cameraMesh.getChildMeshes(!1);i-1?e.substring(c).toLowerCase():""),h=0===u.indexOf(".dds"),d=0===u.indexOf(".env"),p=0===u.indexOf(".basis");if(d?(this.gammaSpace=!1,this._prefiltered=!1,this.anisotropicFilteringLevel=1):(this._prefiltered=r,r&&(this.gammaSpace=!1,this.anisotropicFilteringLevel=1)),s)this._files=s;else if(p||d||h||o||(o=["_px.jpg","_py.jpg","_pz.jpg","_nx.jpg","_ny.jpg","_nz.jpg"]),this._files=this._files||[],this._files.length=0,o){for(var f=0;f0,this.reflectionFresnel?(s.REFLECTIONFRESNEL=!0,s.REFLECTIONFALLOFF=this.reflectionFalloffDistance>0,this._reflectionControls.x=this.reflectionAmount,this._reflectionControls.y=this.reflectionReflectance0,this._reflectionControls.z=this.reflectionReflectance90,this._reflectionControls.w=1/this.reflectionFalloffDistance):(s.REFLECTIONFRESNEL=!1,s.REFLECTIONFALLOFF=!1)}else s.REFLECTIONFRESNEL=!1,s.REFLECTIONFALLOFF=!1,s.REFLECTIONBLUR=!1}s.PREMULTIPLYALPHA=this.alphaMode===b.Y.ALPHA_PREMULTIPLIED||this.alphaMode===b.Y.ALPHA_PREMULTIPLIED_PORTERDUFF,s.USERGBCOLOR=this._useRGBColor,s.NOISE=this._enableNoise}if(s._areLightsDirty&&(s.USEHIGHLIGHTANDSHADOWCOLORS=!this._useRGBColor&&(0!==this._primaryColorShadowLevel||0!==this._primaryColorHighlightLevel),s.BACKMAT_SHADOWONLY=this._shadowOnly),s._areImageProcessingDirty&&this._imageProcessingConfiguration){if(!this._imageProcessingConfiguration.isReady())return!1;this._imageProcessingConfiguration.prepareDefines(s)}if(s._areMiscDirty&&(s.REFLECTIONMAP_3D&&this._enableGroundProjection?(s.PROJECTED_GROUND=!0,s.REFLECTIONMAP_SKYBOX=!0):s.PROJECTED_GROUND=!1),(0,Le.fm)(e,a,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),s,void 0,void 0,void 0,this._isVertexOutputInvariant),(0,Le.OR)(a,l,this,s,r,null,t.getRenderingMesh().hasThinInstances),(0,Le.qB)(e,s,!1,!0,!1)&&e&&(a.getEngine().getCaps().standardDerivatives||e.isVerticesDataPresent(se.R.NormalKind)||(e.createNormals(!0),y.V.Warn("BackgroundMaterial: Normals have been created for the mesh: "+e.name))),s.isDirty){s.markAsProcessed(),a.resetCachedMaterial();var u=new go.J;s.FOG&&u.addFallback(0,"FOG"),s.POINTSIZE&&u.addFallback(1,"POINTSIZE"),s.MULTIVIEW&&u.addFallback(0,"MULTIVIEW"),(0,Le.c4)(s,u,this._maxSimultaneousLights);var h=[se.R.PositionKind];s.NORMAL&&h.push(se.R.NormalKind),s.UV1&&h.push(se.R.UVKind),s.UV2&&h.push(se.R.UV2Kind),(0,Le.ni)(h,e,s,u),(0,Le.ER)(h,s);var d=["world","view","viewProjection","vEyePosition","vLightsType","vFogInfos","vFogColor","pointSize","mBones","vPrimaryColor","vPrimaryColorShadow","fFovMultiplier","shadowLevel","alpha","vBackgroundCenter","vReflectionControl","vDiffuseInfos","diffuseMatrix","projectedGroundInfos","logarithmicDepthConstant"];(0,Mo.Ll)(d);var p=["diffuseSampler"];(0,Le.B1)(d,p,!1);var m=["Material","Scene"];lo.p&&(lo.p.PrepareUniforms(d,s),lo.p.PrepareSamplers(p,s)),(0,Le.Bb)({uniformsNames:d,uniformBuffersNames:m,samplers:p,defines:s,maxSimultaneousLights:this._maxSimultaneousLights});var _=s.toString(),g=a.getEngine().createEffect("background",{attributes:h,uniformsNames:d,uniformBuffersNames:m,samplers:p,defines:_,fallbacks:u,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:function(){return(0,f.sH)(i,void 0,void 0,(function(){return(0,f.YH)(this,(function(e){switch(e.label){case 0:return 1!==this.shaderLanguage?[3,2]:[4,Promise.all([Promise.resolve().then(n.bind(n,71433)),Promise.resolve().then(n.bind(n,49125))])];case 1:return e.sent(),[3,4];case 2:return[4,Promise.all([Promise.resolve().then(n.bind(n,57826)),Promise.resolve().then(n.bind(n,36423))])];case 3:e.sent(),e.label=4;case 4:return this._shadersLoaded=!0,[2]}}))}))}},l);t.setEffect(g,s,this._materialContext),this.buildUniformLayout()}return!(!t.effect||!t.effect.isReady()||(s._renderId=a.getRenderId(),o._wasPreviouslyReady=!0,o._wasPreviouslyUsingInstances=r,this._checkScenePerformancePriority(),0))},t.prototype._computePrimaryColorFromPerceptualColor=function(){this.__perceptualColor&&(this._primaryColor.copyFrom(this.__perceptualColor),this._primaryColor.toLinearSpaceToRef(this._primaryColor,this.getScene().getEngine().useExactSrgbConversions),this._imageProcessingConfiguration&&this._primaryColor.scaleToRef(1/this._imageProcessingConfiguration.exposure,this._primaryColor),this._computePrimaryColors())},t.prototype._computePrimaryColors=function(){0===this._primaryColorShadowLevel&&0===this._primaryColorHighlightLevel||(this._primaryColor.scaleToRef(this._primaryColorShadowLevel,this._primaryShadowColor),this._primaryColor.subtractToRef(this._primaryShadowColor,this._primaryShadowColor),this._white.subtractToRef(this._primaryColor,this._primaryHighlightColor),this._primaryHighlightColor.scaleToRef(this._primaryColorHighlightLevel,this._primaryHighlightColor),this._primaryColor.addToRef(this._primaryHighlightColor,this._primaryHighlightColor))},t.prototype.buildUniformLayout=function(){this._uniformBuffer.addUniform("vPrimaryColor",4),this._uniformBuffer.addUniform("vPrimaryColorShadow",4),this._uniformBuffer.addUniform("vDiffuseInfos",2),this._uniformBuffer.addUniform("diffuseMatrix",16),this._uniformBuffer.addUniform("fFovMultiplier",1),this._uniformBuffer.addUniform("pointSize",1),this._uniformBuffer.addUniform("shadowLevel",1),this._uniformBuffer.addUniform("alpha",1),this._uniformBuffer.addUniform("vBackgroundCenter",3),this._uniformBuffer.addUniform("vReflectionControl",4),this._uniformBuffer.addUniform("projectedGroundInfos",2),(0,Le.G$)(this._uniformBuffer,!0,!1,!1),this._uniformBuffer.create()},t.prototype.unbind=function(){this._diffuseTexture&&this._diffuseTexture.isRenderTarget&&this._uniformBuffer.setTexture("diffuseSampler",null),this._reflectionTexture&&this._reflectionTexture.isRenderTarget&&this._uniformBuffer.setTexture("reflectionSampler",null),e.prototype.unbind.call(this)},t.prototype.bindOnlyWorldMatrix=function(e){this._activeEffect.setMatrix("world",e)},t.prototype.bindForSubMesh=function(e,t,n){var r=this.getScene(),i=n.materialDefines;if(i){var o=n.effect;if(o){this._activeEffect=o,this.bindOnlyWorldMatrix(e),(0,Le.f$)(t,this._activeEffect);var a=this._mustRebind(r,o,n,t.visibility);if(a){this._uniformBuffer.bindToEffect(o,"Material"),this.bindViewProjection(o);var s=this._reflectionTexture;this._uniformBuffer.useUbo&&this.isFrozen&&this._uniformBuffer.isSync&&!n._drawWrapper._forceRebindOnNextCall||(r.texturesEnabled&&(this._diffuseTexture&&_o.h.DiffuseTextureEnabled&&(this._uniformBuffer.updateFloat2("vDiffuseInfos",this._diffuseTexture.coordinatesIndex,this._diffuseTexture.level),(0,Le.mA)(this._diffuseTexture,this._uniformBuffer,"diffuse")),(0,Le.X8)(r,i,this._uniformBuffer,u.v9.White(),s,!1,!0,!1,!1,!1,!1,this._reflectionBlur)),this.shadowLevel>0&&this._uniformBuffer.updateFloat("shadowLevel",this.shadowLevel),this._uniformBuffer.updateFloat("alpha",this.alpha),this.pointsCloud&&this._uniformBuffer.updateFloat("pointSize",this.pointSize),i.USEHIGHLIGHTANDSHADOWCOLORS?(this._uniformBuffer.updateColor4("vPrimaryColor",this._primaryHighlightColor,1),this._uniformBuffer.updateColor4("vPrimaryColorShadow",this._primaryShadowColor,1)):this._uniformBuffer.updateColor4("vPrimaryColor",this._primaryColor,1)),this._uniformBuffer.updateFloat("fFovMultiplier",this._fovMultiplier),r.texturesEnabled&&(this._diffuseTexture&&_o.h.DiffuseTextureEnabled&&this._uniformBuffer.setTexture("diffuseSampler",this._diffuseTexture),s&&_o.h.ReflectionTextureEnabled&&((0,Le.Wp)(r,i,this._uniformBuffer,s),i.REFLECTIONFRESNEL&&(this._uniformBuffer.updateFloat3("vBackgroundCenter",this.sceneCenter.x,this.sceneCenter.y,this.sceneCenter.z),this._uniformBuffer.updateFloat4("vReflectionControl",this._reflectionControls.x,this._reflectionControls.y,this._reflectionControls.z,this._reflectionControls.w))),i.PROJECTED_GROUND&&this._uniformBuffer.updateFloat2("projectedGroundInfos",this.projectedGroundRadius,this.projectedGroundHeight)),(0,Mo.ij)(this._activeEffect,this,r),r.bindEyePosition(o)}else r.getEngine()._features.needToAlwaysBindUniformBuffers&&(this._uniformBuffer.bindToEffect(o,"Material"),this._needToBindSceneUbo=!0);!a&&this.isFrozen||(r.lightsEnabled&&(0,Le.RL)(r,t,this._activeEffect,i,this._maxSimultaneousLights),this.bindView(o),(0,Le.Yy)(r,t,this._activeEffect,!0),this._useLogarithmicDepth&&(0,Le.DL)(i,o,r),this._imageProcessingConfiguration&&this._imageProcessingConfiguration.bind(this._activeEffect)),this._afterBind(t,this._activeEffect,n),this._uniformBuffer.update()}}},t.prototype.hasTexture=function(t){return!!e.prototype.hasTexture.call(this,t)||this._reflectionTexture===t||this._diffuseTexture===t},t.prototype.dispose=function(t,n){void 0===t&&(t=!1),void 0===n&&(n=!1),n&&(this.diffuseTexture&&this.diffuseTexture.dispose(),this.reflectionTexture&&this.reflectionTexture.dispose()),this._renderTargets.dispose(),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),e.prototype.dispose.call(this,t)},t.prototype.clone=function(e){var n=this;return Te.p.Clone((function(){return new t(e,n.getScene())}),this)},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.customType="BABYLON.BackgroundMaterial",t},t.prototype.getClassName=function(){return"BackgroundMaterial"},t.Parse=function(e,n,r){return Te.p.Parse((function(){return new t(e.name,n)}),e,n,r)},t.StandardReflectance0=.05,t.StandardReflectance90=.5,(0,f.Cg)([(0,ce.jT)()],t.prototype,"_primaryColor",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsLightsDirty")],t.prototype,"primaryColor",void 0),(0,f.Cg)([(0,ce.jT)()],t.prototype,"__perceptualColor",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"_primaryColorShadowLevel",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"_primaryColorHighlightLevel",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsLightsDirty")],t.prototype,"primaryColorHighlightLevel",null),(0,f.Cg)([(0,ce.uM)()],t.prototype,"_reflectionTexture",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectionTexture",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"_reflectionBlur",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectionBlur",void 0),(0,f.Cg)([(0,ce.uM)()],t.prototype,"_diffuseTexture",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"diffuseTexture",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"shadowLights",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"_shadowLevel",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"shadowLevel",void 0),(0,f.Cg)([(0,ce.P_)()],t.prototype,"_sceneCenter",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"sceneCenter",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"_opacityFresnel",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"opacityFresnel",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"_reflectionFresnel",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectionFresnel",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"_reflectionFalloffDistance",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectionFalloffDistance",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"_reflectionAmount",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectionAmount",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"_reflectionReflectance0",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectionReflectance0",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"_reflectionReflectance90",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectionReflectance90",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"_useRGBColor",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useRGBColor",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"_enableNoise",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"enableNoise",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"_maxSimultaneousLights",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"maxSimultaneousLights",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"_shadowOnly",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsLightsDirty")],t.prototype,"shadowOnly",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsMiscDirty")],t.prototype,"enableGroundProjection",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"projectedGroundRadius",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"projectedGroundHeight",void 0),t}(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,f.C6)(t,e),t}(Fo(mo)));(0,h.Y5)("BABYLON.BackgroundMaterial",j_);var q_=function(){function e(t,n){var r=this;this._errorHandler=function(e,t){r.onErrorObservable.notifyObservers({message:e,exception:t})},this._options=(0,f.Cl)((0,f.Cl)({},e._GetDefaultOptions(n)),t),this._scene=n,this.onErrorObservable=new l.cP,this._setupBackground(),this._setupImageProcessing()}return e._GetDefaultOptions=function(e){return{createGround:!0,groundSize:15,groundTexture:Z.S0.GetAssetUrl(this._GroundTextureCDNUrl),groundColor:new u.v9(.2,.2,.3).toLinearSpace(e.getEngine().useExactSrgbConversions).scale(3),groundOpacity:.9,enableGroundShadow:!0,groundShadowLevel:.5,enableGroundMirror:!1,groundMirrorSizeRatio:.3,groundMirrorBlurKernel:64,groundMirrorAmount:1,groundMirrorFresnelWeight:1,groundMirrorFallOffDistance:0,groundMirrorTextureType:b.Y.TEXTURETYPE_UNSIGNED_BYTE,groundYBias:1e-5,createSkybox:!0,skyboxSize:20,skyboxTexture:Z.S0.GetAssetUrl(this._SkyboxTextureCDNUrl),skyboxColor:new u.v9(.2,.2,.3).toLinearSpace(e.getEngine().useExactSrgbConversions).scale(3),backgroundYRotation:0,sizeAuto:!0,rootPosition:c.Pq.Zero(),setupImageProcessing:!0,environmentTexture:Z.S0.GetAssetUrl(this._EnvironmentTextureCDNUrl),cameraExposure:.8,cameraContrast:1.2,toneMappingEnabled:!0}},Object.defineProperty(e.prototype,"rootMesh",{get:function(){return this._rootMesh},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"skybox",{get:function(){return this._skybox},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"skyboxTexture",{get:function(){return this._skyboxTexture},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"skyboxMaterial",{get:function(){return this._skyboxMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ground",{get:function(){return this._ground},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"groundTexture",{get:function(){return this._groundTexture},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"groundMirror",{get:function(){return this._groundMirror},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"groundMirrorRenderList",{get:function(){return this._groundMirror?this._groundMirror.renderList:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"groundMaterial",{get:function(){return this._groundMaterial},enumerable:!1,configurable:!0}),e.prototype.updateOptions=function(e){var t=(0,f.Cl)((0,f.Cl)({},this._options),e);this._ground&&!t.createGround&&(this._ground.dispose(),this._ground=null),this._groundMaterial&&!t.createGround&&(this._groundMaterial.dispose(),this._groundMaterial=null),this._groundTexture&&this._options.groundTexture!=t.groundTexture&&(this._groundTexture.dispose(),this._groundTexture=null),this._skybox&&!t.createSkybox&&(this._skybox.dispose(),this._skybox=null),this._skyboxMaterial&&!t.createSkybox&&(this._skyboxMaterial.dispose(),this._skyboxMaterial=null),this._skyboxTexture&&this._options.skyboxTexture!=t.skyboxTexture&&(this._skyboxTexture.dispose(),this._skyboxTexture=null),this._groundMirror&&!t.enableGroundMirror&&(this._groundMirror.dispose(),this._groundMirror=null),this._scene.environmentTexture&&this._options.environmentTexture!=t.environmentTexture&&this._scene.environmentTexture.dispose(),this._options=t,this._setupBackground(),this._setupImageProcessing()},e.prototype.setMainColor=function(e){this.groundMaterial&&(this.groundMaterial.primaryColor=e),this.skyboxMaterial&&(this.skyboxMaterial.primaryColor=e),this.groundMirror&&(this.groundMirror.clearColor=new u.ov(e.r,e.g,e.b,1))},e.prototype._setupImageProcessing=function(){this._options.setupImageProcessing&&(this._scene.imageProcessingConfiguration.contrast=this._options.cameraContrast,this._scene.imageProcessingConfiguration.exposure=this._options.cameraExposure,this._scene.imageProcessingConfiguration.toneMappingEnabled=this._options.toneMappingEnabled,this._setupEnvironmentTexture())},e.prototype._setupEnvironmentTexture=function(){if(!this._scene.environmentTexture)if(this._options.environmentTexture instanceof z_.t)this._scene.environmentTexture=this._options.environmentTexture;else{var e=Y_.CreateFromPrefilteredData(this._options.environmentTexture,this._scene);this._scene.environmentTexture=e}},e.prototype._setupBackground=function(){this._rootMesh||(this._rootMesh=new qe("BackgroundHelper",this._scene)),this._rootMesh.rotation.y=this._options.backgroundYRotation;var e=this._getSceneSize();this._options.createGround&&(this._setupGround(e),this._setupGroundMaterial(),this._setupGroundDiffuseTexture(),this._options.enableGroundMirror&&this._setupGroundMirrorTexture(e),this._setupMirrorInGroundMaterial()),this._options.createSkybox&&(this._setupSkybox(e),this._setupSkyboxMaterial(),this._setupSkyboxReflectionTexture()),this._rootMesh.position.x=e.rootPosition.x,this._rootMesh.position.z=e.rootPosition.z,this._rootMesh.position.y=e.rootPosition.y},e.prototype._getSceneSize=function(){var e=this,t=this._options.groundSize,n=this._options.skyboxSize,r=this._options.rootPosition;if(!this._scene.meshes||1===this._scene.meshes.length)return{groundSize:t,skyboxSize:n,rootPosition:r};var i=this._scene.getWorldExtends((function(t){return t!==e._ground&&t!==e._rootMesh&&t!==e._skybox})),o=i.max.subtract(i.min);if(this._options.sizeAuto){this._scene.activeCamera instanceof si&&this._scene.activeCamera.upperRadiusLimit&&(n=t=2*this._scene.activeCamera.upperRadiusLimit);var a=o.length();a>t&&(n=t=2*a),t*=1.1,n*=1.5,(r=i.min.add(o.scale(.5))).y=i.min.y-this._options.groundYBias}return{groundSize:t,skyboxSize:n,rootPosition:r}},e.prototype._setupGround=function(e){var t=this;this._ground&&!this._ground.isDisposed()||(this._ground=Qn("BackgroundPlane",{size:e.groundSize},this._scene),this._ground.rotation.x=Math.PI/2,this._ground.isPickable=!1,this._ground.parent=this._rootMesh,this._ground.onDisposeObservable.add((function(){t._ground=null}))),this._ground.receiveShadows=this._options.enableGroundShadow},e.prototype._setupGroundMaterial=function(){this._groundMaterial||(this._groundMaterial=new j_("BackgroundPlaneMaterial",this._scene)),this._groundMaterial.alpha=this._options.groundOpacity,this._groundMaterial.alphaMode=b.Y.ALPHA_PREMULTIPLIED_PORTERDUFF,this._groundMaterial.shadowLevel=this._options.groundShadowLevel,this._groundMaterial.primaryColor=this._options.groundColor,this._groundMaterial.useRGBColor=!1,this._groundMaterial.enableNoise=!0,this._ground&&(this._ground.material=this._groundMaterial)},e.prototype._setupGroundDiffuseTexture=function(){this._groundMaterial&&(this._groundTexture||(this._options.groundTexture instanceof z_.t?this._groundMaterial.diffuseTexture=this._options.groundTexture:(this._groundTexture=new _n.g(this._options.groundTexture,this._scene,void 0,void 0,void 0,void 0,this._errorHandler),this._groundTexture.gammaSpace=!1,this._groundTexture.hasAlpha=!0,this._groundMaterial.diffuseTexture=this._groundTexture)))},e.prototype._setupGroundMirrorTexture=function(e){var t=_n.g.CLAMP_ADDRESSMODE;if(!this._groundMirror&&(this._groundMirror=new H_("BackgroundPlaneMirrorTexture",{ratio:this._options.groundMirrorSizeRatio},this._scene,!1,this._options.groundMirrorTextureType,_n.g.BILINEAR_SAMPLINGMODE,!0),this._groundMirror.mirrorPlane=new Ne.Z(0,-1,0,e.rootPosition.y),this._groundMirror.anisotropicFilteringLevel=1,this._groundMirror.wrapU=t,this._groundMirror.wrapV=t,this._groundMirror.renderList))for(var n=0;n0&&e.push(this._texture),this._textureRoughness&&this._textureRoughness.animations&&this._textureRoughness.animations.length>0&&e.push(this._textureRoughness),this._bumpTexture&&this._bumpTexture.animations&&this._bumpTexture.animations.length>0&&e.push(this._bumpTexture),this._tintTexture&&this._tintTexture.animations&&this._tintTexture.animations.length>0&&e.push(this._tintTexture)},t.prototype.dispose=function(e){var t,n,r,i;e&&(null===(t=this._texture)||void 0===t||t.dispose(),null===(n=this._textureRoughness)||void 0===n||n.dispose(),null===(r=this._bumpTexture)||void 0===r||r.dispose(),null===(i=this._tintTexture)||void 0===i||i.dispose())},t.prototype.getClassName=function(){return"PBRClearCoatConfiguration"},t.prototype.addFallbacks=function(e,t,n){return e.CLEARCOAT_BUMP&&t.addFallback(n++,"CLEARCOAT_BUMP"),e.CLEARCOAT_TINT&&t.addFallback(n++,"CLEARCOAT_TINT"),e.CLEARCOAT&&t.addFallback(n++,"CLEARCOAT"),n},t.prototype.getSamplers=function(e){e.push("clearCoatSampler","clearCoatRoughnessSampler","clearCoatBumpSampler","clearCoatTintSampler")},t.prototype.getUniforms=function(){return{ubo:[{name:"vClearCoatParams",size:2,type:"vec2"},{name:"vClearCoatRefractionParams",size:4,type:"vec4"},{name:"vClearCoatInfos",size:4,type:"vec4"},{name:"clearCoatMatrix",size:16,type:"mat4"},{name:"clearCoatRoughnessMatrix",size:16,type:"mat4"},{name:"vClearCoatBumpInfos",size:2,type:"vec2"},{name:"vClearCoatTangentSpaceParams",size:2,type:"vec2"},{name:"clearCoatBumpMatrix",size:16,type:"mat4"},{name:"vClearCoatTintParams",size:4,type:"vec4"},{name:"clearCoatColorAtDistance",size:1,type:"float"},{name:"vClearCoatTintInfos",size:2,type:"vec2"},{name:"clearCoatTintMatrix",size:16,type:"mat4"}]}},t._DefaultIndexOfRefraction=1.5,(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"isEnabled",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"intensity",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"roughness",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"indexOfRefraction",void 0),(0,f.Cg)([(0,ce.uM)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"texture",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useRoughnessFromMainTexture",void 0),(0,f.Cg)([(0,ce.uM)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"textureRoughness",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"remapF0OnInterfaceChange",void 0),(0,f.Cg)([(0,ce.uM)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"bumpTexture",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"isTintEnabled",void 0),(0,f.Cg)([(0,ce.jT)()],t.prototype,"tintColor",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"tintColorAtDistance",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"tintThickness",void 0),(0,f.Cg)([(0,ce.uM)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"tintTexture",void 0),t}(Ro),sg=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.IRIDESCENCE=!1,t.IRIDESCENCE_TEXTURE=!1,t.IRIDESCENCE_TEXTUREDIRECTUV=0,t.IRIDESCENCE_THICKNESS_TEXTURE=!1,t.IRIDESCENCE_THICKNESS_TEXTUREDIRECTUV=0,t}return(0,f.C6)(t,e),t}(ho),lg=function(e){function t(n,r){void 0===r&&(r=!0);var i=e.call(this,n,"PBRIridescence",110,new sg,r)||this;return i._isEnabled=!1,i.isEnabled=!1,i.intensity=1,i.minimumThickness=t._DefaultMinimumThickness,i.maximumThickness=t._DefaultMaximumThickness,i.indexOfRefraction=t._DefaultIndexOfRefraction,i._texture=null,i.texture=null,i._thicknessTexture=null,i.thicknessTexture=null,i._internalMarkAllSubMeshesAsTexturesDirty=n._dirtyCallbacks[b.Y.MATERIAL_TextureDirtyFlag],i}return(0,f.C6)(t,e),t.prototype._markAllSubMeshesAsTexturesDirty=function(){this._enable(this._isEnabled),this._internalMarkAllSubMeshesAsTexturesDirty()},t.prototype.isCompatible=function(){return!0},t.prototype.isReadyForSubMesh=function(e,t){if(!this._isEnabled)return!0;if(e._areTexturesDirty&&t.texturesEnabled){if(this._texture&&_o.h.IridescenceTextureEnabled&&!this._texture.isReadyOrNotBlocking())return!1;if(this._thicknessTexture&&_o.h.IridescenceTextureEnabled&&!this._thicknessTexture.isReadyOrNotBlocking())return!1}return!0},t.prototype.prepareDefinesBeforeAttributes=function(e,t){this._isEnabled?(e.IRIDESCENCE=!0,e._areTexturesDirty&&t.texturesEnabled&&(this._texture&&_o.h.IridescenceTextureEnabled?(0,Le.YT)(this._texture,e,"IRIDESCENCE_TEXTURE"):e.IRIDESCENCE_TEXTURE=!1,this._thicknessTexture&&_o.h.IridescenceTextureEnabled?(0,Le.YT)(this._thicknessTexture,e,"IRIDESCENCE_THICKNESS_TEXTURE"):e.IRIDESCENCE_THICKNESS_TEXTURE=!1)):(e.IRIDESCENCE=!1,e.IRIDESCENCE_TEXTURE=!1,e.IRIDESCENCE_THICKNESS_TEXTURE=!1,e.IRIDESCENCE_TEXTUREDIRECTUV=0,e.IRIDESCENCE_THICKNESS_TEXTUREDIRECTUV=0)},t.prototype.bindForSubMesh=function(e,t){var n,r,i,o,a,s,l,c;if(this._isEnabled){var u=this._material.isFrozen;e.useUbo&&u&&e.isSync||((this._texture||this._thicknessTexture)&&_o.h.IridescenceTextureEnabled&&(e.updateFloat4("vIridescenceInfos",null!==(r=null===(n=this._texture)||void 0===n?void 0:n.coordinatesIndex)&&void 0!==r?r:0,null!==(o=null===(i=this._texture)||void 0===i?void 0:i.level)&&void 0!==o?o:0,null!==(s=null===(a=this._thicknessTexture)||void 0===a?void 0:a.coordinatesIndex)&&void 0!==s?s:0,null!==(c=null===(l=this._thicknessTexture)||void 0===l?void 0:l.level)&&void 0!==c?c:0),this._texture&&(0,Le.mA)(this._texture,e,"iridescence"),this._thicknessTexture&&(0,Le.mA)(this._thicknessTexture,e,"iridescenceThickness")),e.updateFloat4("vIridescenceParams",this.intensity,this.indexOfRefraction,this.minimumThickness,this.maximumThickness)),t.texturesEnabled&&(this._texture&&_o.h.IridescenceTextureEnabled&&e.setTexture("iridescenceSampler",this._texture),this._thicknessTexture&&_o.h.IridescenceTextureEnabled&&e.setTexture("iridescenceThicknessSampler",this._thicknessTexture))}},t.prototype.hasTexture=function(e){return this._texture===e||this._thicknessTexture===e},t.prototype.getActiveTextures=function(e){this._texture&&e.push(this._texture),this._thicknessTexture&&e.push(this._thicknessTexture)},t.prototype.getAnimatables=function(e){this._texture&&this._texture.animations&&this._texture.animations.length>0&&e.push(this._texture),this._thicknessTexture&&this._thicknessTexture.animations&&this._thicknessTexture.animations.length>0&&e.push(this._thicknessTexture)},t.prototype.dispose=function(e){var t,n;e&&(null===(t=this._texture)||void 0===t||t.dispose(),null===(n=this._thicknessTexture)||void 0===n||n.dispose())},t.prototype.getClassName=function(){return"PBRIridescenceConfiguration"},t.prototype.addFallbacks=function(e,t,n){return e.IRIDESCENCE&&t.addFallback(n++,"IRIDESCENCE"),n},t.prototype.getSamplers=function(e){e.push("iridescenceSampler","iridescenceThicknessSampler")},t.prototype.getUniforms=function(){return{ubo:[{name:"vIridescenceParams",size:4,type:"vec4"},{name:"vIridescenceInfos",size:4,type:"vec4"},{name:"iridescenceMatrix",size:16,type:"mat4"},{name:"iridescenceThicknessMatrix",size:16,type:"mat4"}]}},t._DefaultMinimumThickness=100,t._DefaultMaximumThickness=400,t._DefaultIndexOfRefraction=1.3,(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"isEnabled",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"intensity",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"minimumThickness",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"maximumThickness",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"indexOfRefraction",void 0),(0,f.Cg)([(0,ce.uM)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"texture",void 0),(0,f.Cg)([(0,ce.uM)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"thicknessTexture",void 0),t}(Ro),cg=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.ANISOTROPIC=!1,t.ANISOTROPIC_TEXTURE=!1,t.ANISOTROPIC_TEXTUREDIRECTUV=0,t.ANISOTROPIC_LEGACY=!1,t.MAINUV1=!1,t}return(0,f.C6)(t,e),t}(ho),ug=function(e){function t(t,n){void 0===n&&(n=!0);var r=e.call(this,t,"PBRAnisotropic",110,new cg,n)||this;return r._isEnabled=!1,r.isEnabled=!1,r.intensity=1,r.direction=new c.I9(1,0),r._texture=null,r.texture=null,r._legacy=!1,r.legacy=!1,r._internalMarkAllSubMeshesAsTexturesDirty=t._dirtyCallbacks[b.Y.MATERIAL_TextureDirtyFlag],r._internalMarkAllSubMeshesAsMiscDirty=t._dirtyCallbacks[b.Y.MATERIAL_MiscDirtyFlag],r}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"angle",{get:function(){return Math.atan2(this.direction.y,this.direction.x)},set:function(e){this.direction.x=Math.cos(e),this.direction.y=Math.sin(e)},enumerable:!1,configurable:!0}),t.prototype._markAllSubMeshesAsTexturesDirty=function(){this._enable(this._isEnabled),this._internalMarkAllSubMeshesAsTexturesDirty()},t.prototype._markAllSubMeshesAsMiscDirty=function(){this._enable(this._isEnabled),this._internalMarkAllSubMeshesAsMiscDirty()},t.prototype.isCompatible=function(){return!0},t.prototype.isReadyForSubMesh=function(e,t){return!this._isEnabled||!(e._areTexturesDirty&&t.texturesEnabled&&this._texture&&_o.h.AnisotropicTextureEnabled&&!this._texture.isReadyOrNotBlocking())},t.prototype.prepareDefinesBeforeAttributes=function(e,t,n){this._isEnabled?(e.ANISOTROPIC=this._isEnabled,this._isEnabled&&!n.isVerticesDataPresent(se.R.TangentKind)&&(e._needUVs=!0,e.MAINUV1=!0),e._areTexturesDirty&&t.texturesEnabled&&(this._texture&&_o.h.AnisotropicTextureEnabled?(0,Le.YT)(this._texture,e,"ANISOTROPIC_TEXTURE"):e.ANISOTROPIC_TEXTURE=!1),e._areMiscDirty&&(e.ANISOTROPIC_LEGACY=this._legacy)):(e.ANISOTROPIC=!1,e.ANISOTROPIC_TEXTURE=!1,e.ANISOTROPIC_TEXTUREDIRECTUV=0,e.ANISOTROPIC_LEGACY=!1)},t.prototype.bindForSubMesh=function(e,t){if(this._isEnabled){var n=this._material.isFrozen;e.useUbo&&n&&e.isSync||(this._texture&&_o.h.AnisotropicTextureEnabled&&(e.updateFloat2("vAnisotropyInfos",this._texture.coordinatesIndex,this._texture.level),(0,Le.mA)(this._texture,e,"anisotropy")),e.updateFloat3("vAnisotropy",this.direction.x,this.direction.y,this.intensity)),t.texturesEnabled&&this._texture&&_o.h.AnisotropicTextureEnabled&&e.setTexture("anisotropySampler",this._texture)}},t.prototype.hasTexture=function(e){return this._texture===e},t.prototype.getActiveTextures=function(e){this._texture&&e.push(this._texture)},t.prototype.getAnimatables=function(e){this._texture&&this._texture.animations&&this._texture.animations.length>0&&e.push(this._texture)},t.prototype.dispose=function(e){e&&this._texture&&this._texture.dispose()},t.prototype.getClassName=function(){return"PBRAnisotropicConfiguration"},t.prototype.addFallbacks=function(e,t,n){return e.ANISOTROPIC&&t.addFallback(n++,"ANISOTROPIC"),n},t.prototype.getSamplers=function(e){e.push("anisotropySampler")},t.prototype.getUniforms=function(){return{ubo:[{name:"vAnisotropy",size:3,type:"vec3"},{name:"vAnisotropyInfos",size:2,type:"vec2"},{name:"anisotropyMatrix",size:16,type:"mat4"}]}},t.prototype.parse=function(t,n,r){e.prototype.parse.call(this,t,n,r),void 0===t.legacy&&(this.legacy=!0)},(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"isEnabled",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"intensity",void 0),(0,f.Cg)([(0,ce.WM)()],t.prototype,"direction",void 0),(0,f.Cg)([(0,ce.uM)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"texture",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsMiscDirty")],t.prototype,"legacy",void 0),t}(Ro),hg=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.SHEEN=!1,t.SHEEN_TEXTURE=!1,t.SHEEN_GAMMATEXTURE=!1,t.SHEEN_TEXTURE_ROUGHNESS=!1,t.SHEEN_TEXTUREDIRECTUV=0,t.SHEEN_TEXTURE_ROUGHNESSDIRECTUV=0,t.SHEEN_LINKWITHALBEDO=!1,t.SHEEN_ROUGHNESS=!1,t.SHEEN_ALBEDOSCALING=!1,t.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE=!1,t}return(0,f.C6)(t,e),t}(ho),dg=function(e){function t(t,n){void 0===n&&(n=!0);var r=e.call(this,t,"Sheen",120,new hg,n)||this;return r._isEnabled=!1,r.isEnabled=!1,r._linkSheenWithAlbedo=!1,r.linkSheenWithAlbedo=!1,r.intensity=1,r.color=u.v9.White(),r._texture=null,r.texture=null,r._useRoughnessFromMainTexture=!0,r.useRoughnessFromMainTexture=!0,r._roughness=null,r.roughness=null,r._textureRoughness=null,r.textureRoughness=null,r._albedoScaling=!1,r.albedoScaling=!1,r._internalMarkAllSubMeshesAsTexturesDirty=t._dirtyCallbacks[b.Y.MATERIAL_TextureDirtyFlag],r}return(0,f.C6)(t,e),t.prototype._markAllSubMeshesAsTexturesDirty=function(){this._enable(this._isEnabled),this._internalMarkAllSubMeshesAsTexturesDirty()},t.prototype.isCompatible=function(){return!0},t.prototype.isReadyForSubMesh=function(e,t){if(!this._isEnabled)return!0;if(e._areTexturesDirty&&t.texturesEnabled){if(this._texture&&_o.h.SheenTextureEnabled&&!this._texture.isReadyOrNotBlocking())return!1;if(this._textureRoughness&&_o.h.SheenTextureEnabled&&!this._textureRoughness.isReadyOrNotBlocking())return!1}return!0},t.prototype.prepareDefinesBeforeAttributes=function(e,t){this._isEnabled?(e.SHEEN=!0,e.SHEEN_LINKWITHALBEDO=this._linkSheenWithAlbedo,e.SHEEN_ROUGHNESS=null!==this._roughness,e.SHEEN_ALBEDOSCALING=this._albedoScaling,e.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE=this._useRoughnessFromMainTexture,e._areTexturesDirty&&t.texturesEnabled&&(this._texture&&_o.h.SheenTextureEnabled?((0,Le.YT)(this._texture,e,"SHEEN_TEXTURE"),e.SHEEN_GAMMATEXTURE=this._texture.gammaSpace):e.SHEEN_TEXTURE=!1,this._textureRoughness&&_o.h.SheenTextureEnabled?(0,Le.YT)(this._textureRoughness,e,"SHEEN_TEXTURE_ROUGHNESS"):e.SHEEN_TEXTURE_ROUGHNESS=!1)):(e.SHEEN=!1,e.SHEEN_TEXTURE=!1,e.SHEEN_TEXTURE_ROUGHNESS=!1,e.SHEEN_LINKWITHALBEDO=!1,e.SHEEN_ROUGHNESS=!1,e.SHEEN_ALBEDOSCALING=!1,e.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE=!1,e.SHEEN_GAMMATEXTURE=!1,e.SHEEN_TEXTUREDIRECTUV=0,e.SHEEN_TEXTURE_ROUGHNESSDIRECTUV=0)},t.prototype.bindForSubMesh=function(e,t,n,r){var i,o,a,s,l,c,u,h;if(this._isEnabled){var d=r.materialDefines,p=this._material.isFrozen;e.useUbo&&p&&e.isSync||((this._texture||this._textureRoughness)&&_o.h.SheenTextureEnabled&&(e.updateFloat4("vSheenInfos",null!==(o=null===(i=this._texture)||void 0===i?void 0:i.coordinatesIndex)&&void 0!==o?o:0,null!==(s=null===(a=this._texture)||void 0===a?void 0:a.level)&&void 0!==s?s:0,null!==(c=null===(l=this._textureRoughness)||void 0===l?void 0:l.coordinatesIndex)&&void 0!==c?c:0,null!==(h=null===(u=this._textureRoughness)||void 0===u?void 0:u.level)&&void 0!==h?h:0),this._texture&&(0,Le.mA)(this._texture,e,"sheen"),this._textureRoughness&&!d.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE&&(0,Le.mA)(this._textureRoughness,e,"sheenRoughness")),e.updateFloat4("vSheenColor",this.color.r,this.color.g,this.color.b,this.intensity),null!==this._roughness&&e.updateFloat("vSheenRoughness",this._roughness)),t.texturesEnabled&&(this._texture&&_o.h.SheenTextureEnabled&&e.setTexture("sheenSampler",this._texture),this._textureRoughness&&!d.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE&&_o.h.SheenTextureEnabled&&e.setTexture("sheenRoughnessSampler",this._textureRoughness))}},t.prototype.hasTexture=function(e){return this._texture===e||this._textureRoughness===e},t.prototype.getActiveTextures=function(e){this._texture&&e.push(this._texture),this._textureRoughness&&e.push(this._textureRoughness)},t.prototype.getAnimatables=function(e){this._texture&&this._texture.animations&&this._texture.animations.length>0&&e.push(this._texture),this._textureRoughness&&this._textureRoughness.animations&&this._textureRoughness.animations.length>0&&e.push(this._textureRoughness)},t.prototype.dispose=function(e){var t,n;e&&(null===(t=this._texture)||void 0===t||t.dispose(),null===(n=this._textureRoughness)||void 0===n||n.dispose())},t.prototype.getClassName=function(){return"PBRSheenConfiguration"},t.prototype.addFallbacks=function(e,t,n){return e.SHEEN&&t.addFallback(n++,"SHEEN"),n},t.prototype.getSamplers=function(e){e.push("sheenSampler","sheenRoughnessSampler")},t.prototype.getUniforms=function(){return{ubo:[{name:"vSheenColor",size:4,type:"vec4"},{name:"vSheenRoughness",size:1,type:"float"},{name:"vSheenInfos",size:4,type:"vec4"},{name:"sheenMatrix",size:16,type:"mat4"},{name:"sheenRoughnessMatrix",size:16,type:"mat4"}]}},(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"isEnabled",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"linkSheenWithAlbedo",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"intensity",void 0),(0,f.Cg)([(0,ce.jT)()],t.prototype,"color",void 0),(0,f.Cg)([(0,ce.uM)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"texture",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useRoughnessFromMainTexture",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"roughness",void 0),(0,f.Cg)([(0,ce.uM)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"textureRoughness",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"albedoScaling",void 0),t}(Ro),pg=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.SUBSURFACE=!1,t.SS_REFRACTION=!1,t.SS_REFRACTION_USE_INTENSITY_FROM_THICKNESS=!1,t.SS_TRANSLUCENCY=!1,t.SS_TRANSLUCENCY_USE_INTENSITY_FROM_THICKNESS=!1,t.SS_SCATTERING=!1,t.SS_DISPERSION=!1,t.SS_THICKNESSANDMASK_TEXTURE=!1,t.SS_THICKNESSANDMASK_TEXTUREDIRECTUV=0,t.SS_HAS_THICKNESS=!1,t.SS_REFRACTIONINTENSITY_TEXTURE=!1,t.SS_REFRACTIONINTENSITY_TEXTUREDIRECTUV=0,t.SS_TRANSLUCENCYINTENSITY_TEXTURE=!1,t.SS_TRANSLUCENCYINTENSITY_TEXTUREDIRECTUV=0,t.SS_TRANSLUCENCYCOLOR_TEXTURE=!1,t.SS_TRANSLUCENCYCOLOR_TEXTUREDIRECTUV=0,t.SS_TRANSLUCENCYCOLOR_TEXTURE_GAMMA=!1,t.SS_REFRACTIONMAP_3D=!1,t.SS_REFRACTIONMAP_OPPOSITEZ=!1,t.SS_LODINREFRACTIONALPHA=!1,t.SS_GAMMAREFRACTION=!1,t.SS_RGBDREFRACTION=!1,t.SS_LINEARSPECULARREFRACTION=!1,t.SS_LINKREFRACTIONTOTRANSPARENCY=!1,t.SS_ALBEDOFORREFRACTIONTINT=!1,t.SS_ALBEDOFORTRANSLUCENCYTINT=!1,t.SS_USE_LOCAL_REFRACTIONMAP_CUBIC=!1,t.SS_USE_THICKNESS_AS_DEPTH=!1,t.SS_USE_GLTF_TEXTURES=!1,t.SS_APPLY_ALBEDO_AFTER_SUBSURFACE=!1,t.SS_TRANSLUCENCY_LEGACY=!1,t}return(0,f.C6)(t,e),t}(ho),fg=function(e){function t(n,r){void 0===r&&(r=!0);var i=e.call(this,n,"PBRSubSurface",130,new pg,r)||this;return i._isRefractionEnabled=!1,i.isRefractionEnabled=!1,i._isTranslucencyEnabled=!1,i.isTranslucencyEnabled=!1,i._isDispersionEnabled=!1,i.isDispersionEnabled=!1,i._isScatteringEnabled=!1,i.isScatteringEnabled=!1,i._scatteringDiffusionProfileIndex=0,i.refractionIntensity=1,i.translucencyIntensity=1,i.useAlbedoToTintRefraction=!1,i.useAlbedoToTintTranslucency=!1,i._thicknessTexture=null,i.thicknessTexture=null,i._refractionTexture=null,i.refractionTexture=null,i._indexOfRefraction=1.5,i.indexOfRefraction=1.5,i._volumeIndexOfRefraction=-1,i._invertRefractionY=!1,i.invertRefractionY=!1,i._linkRefractionWithTransparency=!1,i.linkRefractionWithTransparency=!1,i.minimumThickness=0,i.maximumThickness=1,i.useThicknessAsDepth=!1,i.tintColor=u.v9.White(),i.tintColorAtDistance=1,i.dispersion=0,i.diffusionDistance=u.v9.White(),i._useMaskFromThicknessTexture=!1,i.useMaskFromThicknessTexture=!1,i._refractionIntensityTexture=null,i.refractionIntensityTexture=null,i._translucencyIntensityTexture=null,i.translucencyIntensityTexture=null,i.translucencyColor=null,i._translucencyColorTexture=null,i.translucencyColorTexture=null,i._useGltfStyleTextures=!0,i.useGltfStyleTextures=!0,i.applyAlbedoAfterSubSurface=t.DEFAULT_APPLY_ALBEDO_AFTERSUBSURFACE,i.legacyTranslucency=t.DEFAULT_LEGACY_TRANSLUCENCY,i._scene=n.getScene(),i.registerForExtraEvents=!0,i._internalMarkAllSubMeshesAsTexturesDirty=n._dirtyCallbacks[b.Y.MATERIAL_TextureDirtyFlag],i._internalMarkScenePrePassDirty=n._dirtyCallbacks[b.Y.MATERIAL_PrePassDirtyFlag],i}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"scatteringDiffusionProfile",{get:function(){return this._scene.subSurfaceConfiguration?this._scene.subSurfaceConfiguration.ssDiffusionProfileColors[this._scatteringDiffusionProfileIndex]:null},set:function(e){this._scene.enableSubSurfaceForPrePass()&&e&&(this._scatteringDiffusionProfileIndex=this._scene.subSurfaceConfiguration.addDiffusionProfile(e))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"volumeIndexOfRefraction",{get:function(){return this._volumeIndexOfRefraction>=1?this._volumeIndexOfRefraction:this._indexOfRefraction},set:function(e){this._volumeIndexOfRefraction=e>=1?e:-1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"legacyTransluceny",{get:function(){return this.legacyTranslucency},set:function(e){this.legacyTranslucency=e},enumerable:!1,configurable:!0}),t.prototype._markAllSubMeshesAsTexturesDirty=function(){this._enable(this._isRefractionEnabled||this._isTranslucencyEnabled||this._isScatteringEnabled),this._internalMarkAllSubMeshesAsTexturesDirty()},t.prototype._markScenePrePassDirty=function(){this._enable(this._isRefractionEnabled||this._isTranslucencyEnabled||this._isScatteringEnabled),this._internalMarkAllSubMeshesAsTexturesDirty(),this._internalMarkScenePrePassDirty()},t.prototype.isCompatible=function(){return!0},t.prototype.isReadyForSubMesh=function(e,t){if(!this._isRefractionEnabled&&!this._isTranslucencyEnabled&&!this._isScatteringEnabled)return!0;if(e._areTexturesDirty&&t.texturesEnabled){if(this._thicknessTexture&&_o.h.ThicknessTextureEnabled&&!this._thicknessTexture.isReadyOrNotBlocking())return!1;if(this._refractionIntensityTexture&&_o.h.RefractionIntensityTextureEnabled&&!this._refractionIntensityTexture.isReadyOrNotBlocking())return!1;if(this._translucencyColorTexture&&_o.h.TranslucencyColorTextureEnabled&&!this._translucencyColorTexture.isReadyOrNotBlocking())return!1;if(this._translucencyIntensityTexture&&_o.h.TranslucencyIntensityTextureEnabled&&!this._translucencyIntensityTexture.isReadyOrNotBlocking())return!1;var n=this._getRefractionTexture(t);if(n&&_o.h.RefractionTextureEnabled&&!n.isReadyOrNotBlocking())return!1}return!0},t.prototype.prepareDefinesBeforeAttributes=function(e,t){if(!this._isRefractionEnabled&&!this._isTranslucencyEnabled&&!this._isScatteringEnabled)return e.SUBSURFACE=!1,e.SS_DISPERSION=!1,e.SS_TRANSLUCENCY=!1,e.SS_SCATTERING=!1,e.SS_REFRACTION=!1,e.SS_REFRACTION_USE_INTENSITY_FROM_THICKNESS=!1,e.SS_TRANSLUCENCY_USE_INTENSITY_FROM_THICKNESS=!1,e.SS_THICKNESSANDMASK_TEXTURE=!1,e.SS_THICKNESSANDMASK_TEXTUREDIRECTUV=0,e.SS_HAS_THICKNESS=!1,e.SS_REFRACTIONINTENSITY_TEXTURE=!1,e.SS_REFRACTIONINTENSITY_TEXTUREDIRECTUV=0,e.SS_TRANSLUCENCYINTENSITY_TEXTURE=!1,e.SS_TRANSLUCENCYINTENSITY_TEXTUREDIRECTUV=0,e.SS_REFRACTIONMAP_3D=!1,e.SS_REFRACTIONMAP_OPPOSITEZ=!1,e.SS_LODINREFRACTIONALPHA=!1,e.SS_GAMMAREFRACTION=!1,e.SS_RGBDREFRACTION=!1,e.SS_LINEARSPECULARREFRACTION=!1,e.SS_LINKREFRACTIONTOTRANSPARENCY=!1,e.SS_ALBEDOFORREFRACTIONTINT=!1,e.SS_ALBEDOFORTRANSLUCENCYTINT=!1,e.SS_USE_LOCAL_REFRACTIONMAP_CUBIC=!1,e.SS_USE_THICKNESS_AS_DEPTH=!1,e.SS_USE_GLTF_TEXTURES=!1,e.SS_TRANSLUCENCYCOLOR_TEXTURE=!1,e.SS_TRANSLUCENCYCOLOR_TEXTUREDIRECTUV=0,e.SS_TRANSLUCENCYCOLOR_TEXTURE_GAMMA=!1,void(e.SS_APPLY_ALBEDO_AFTER_SUBSURFACE=!1);if(e._areTexturesDirty){if(e.SUBSURFACE=!0,e.SS_DISPERSION=this._isDispersionEnabled,e.SS_TRANSLUCENCY=this._isTranslucencyEnabled,e.SS_TRANSLUCENCY_USE_INTENSITY_FROM_THICKNESS=!1,e.SS_TRANSLUCENCY_LEGACY=this.legacyTranslucency,e.SS_SCATTERING=this._isScatteringEnabled,e.SS_THICKNESSANDMASK_TEXTURE=!1,e.SS_REFRACTIONINTENSITY_TEXTURE=!1,e.SS_TRANSLUCENCYINTENSITY_TEXTURE=!1,e.SS_HAS_THICKNESS=!1,e.SS_USE_GLTF_TEXTURES=!1,e.SS_REFRACTION=!1,e.SS_REFRACTION_USE_INTENSITY_FROM_THICKNESS=!1,e.SS_REFRACTIONMAP_3D=!1,e.SS_GAMMAREFRACTION=!1,e.SS_RGBDREFRACTION=!1,e.SS_LINEARSPECULARREFRACTION=!1,e.SS_REFRACTIONMAP_OPPOSITEZ=!1,e.SS_LODINREFRACTIONALPHA=!1,e.SS_LINKREFRACTIONTOTRANSPARENCY=!1,e.SS_ALBEDOFORREFRACTIONTINT=!1,e.SS_ALBEDOFORTRANSLUCENCYTINT=!1,e.SS_USE_LOCAL_REFRACTIONMAP_CUBIC=!1,e.SS_USE_THICKNESS_AS_DEPTH=!1,e.SS_TRANSLUCENCYCOLOR_TEXTURE=!1,e.SS_APPLY_ALBEDO_AFTER_SUBSURFACE=this.applyAlbedoAfterSubSurface,e._areTexturesDirty&&t.texturesEnabled&&(this._thicknessTexture&&_o.h.ThicknessTextureEnabled&&(0,Le.YT)(this._thicknessTexture,e,"SS_THICKNESSANDMASK_TEXTURE"),this._refractionIntensityTexture&&_o.h.RefractionIntensityTextureEnabled&&(0,Le.YT)(this._refractionIntensityTexture,e,"SS_REFRACTIONINTENSITY_TEXTURE"),this._translucencyIntensityTexture&&_o.h.TranslucencyIntensityTextureEnabled&&(0,Le.YT)(this._translucencyIntensityTexture,e,"SS_TRANSLUCENCYINTENSITY_TEXTURE"),this._translucencyColorTexture&&_o.h.TranslucencyColorTextureEnabled&&((0,Le.YT)(this._translucencyColorTexture,e,"SS_TRANSLUCENCYCOLOR_TEXTURE"),e.SS_TRANSLUCENCYCOLOR_TEXTURE_GAMMA=this._translucencyColorTexture.gammaSpace)),e.SS_HAS_THICKNESS=this.maximumThickness-this.minimumThickness!==0,e.SS_USE_GLTF_TEXTURES=this._useGltfStyleTextures,e.SS_REFRACTION_USE_INTENSITY_FROM_THICKNESS=this._useMaskFromThicknessTexture&&!this._refractionIntensityTexture,e.SS_TRANSLUCENCY_USE_INTENSITY_FROM_THICKNESS=this._useMaskFromThicknessTexture&&!this._translucencyIntensityTexture,this._isRefractionEnabled&&t.texturesEnabled){var n=this._getRefractionTexture(t);n&&_o.h.RefractionTextureEnabled&&(e.SS_REFRACTION=!0,e.SS_REFRACTIONMAP_3D=n.isCube,e.SS_GAMMAREFRACTION=n.gammaSpace,e.SS_RGBDREFRACTION=n.isRGBD,e.SS_LINEARSPECULARREFRACTION=n.linearSpecularLOD,e.SS_REFRACTIONMAP_OPPOSITEZ=this._scene.useRightHandedSystem&&n.isCube?!n.invertZ:n.invertZ,e.SS_LODINREFRACTIONALPHA=n.lodLevelInAlpha,e.SS_LINKREFRACTIONTOTRANSPARENCY=this._linkRefractionWithTransparency,e.SS_ALBEDOFORREFRACTIONTINT=this.useAlbedoToTintRefraction,e.SS_USE_LOCAL_REFRACTIONMAP_CUBIC=n.isCube&&n.boundingBoxSize,e.SS_USE_THICKNESS_AS_DEPTH=this.useThicknessAsDepth)}this._isTranslucencyEnabled&&(e.SS_ALBEDOFORTRANSLUCENCYTINT=this.useAlbedoToTintTranslucency)}},t.prototype.hardBindForSubMesh=function(e,t,n,r){if(this._isRefractionEnabled||this._isTranslucencyEnabled||this._isScatteringEnabled)if(0===this.maximumThickness&&0===this.minimumThickness)e.updateFloat2("vThicknessParam",0,0);else{r.getRenderingMesh().getWorldMatrix().decompose(c.AA.Vector3[0]);var i=Math.max(Math.abs(c.AA.Vector3[0].x),Math.abs(c.AA.Vector3[0].y),Math.abs(c.AA.Vector3[0].z));e.updateFloat2("vThicknessParam",this.minimumThickness*i,(this.maximumThickness-this.minimumThickness)*i)}},t.prototype.bindForSubMesh=function(e,t,n,r){var i;if(this._isRefractionEnabled||this._isTranslucencyEnabled||this._isScatteringEnabled){var o=r.materialDefines,a=this._material.isFrozen,s=this._material.realTimeFiltering,l=o.LODBASEDMICROSFURACE,c=this._getRefractionTexture(t);if(!e.useUbo||!a||!e.isSync){if(this._thicknessTexture&&_o.h.ThicknessTextureEnabled&&(e.updateFloat2("vThicknessInfos",this._thicknessTexture.coordinatesIndex,this._thicknessTexture.level),(0,Le.mA)(this._thicknessTexture,e,"thickness")),this._refractionIntensityTexture&&_o.h.RefractionIntensityTextureEnabled&&o.SS_REFRACTIONINTENSITY_TEXTURE&&(e.updateFloat2("vRefractionIntensityInfos",this._refractionIntensityTexture.coordinatesIndex,this._refractionIntensityTexture.level),(0,Le.mA)(this._refractionIntensityTexture,e,"refractionIntensity")),this._translucencyColorTexture&&_o.h.TranslucencyColorTextureEnabled&&o.SS_TRANSLUCENCYCOLOR_TEXTURE&&(e.updateFloat2("vTranslucencyColorInfos",this._translucencyColorTexture.coordinatesIndex,this._translucencyColorTexture.level),(0,Le.mA)(this._translucencyColorTexture,e,"translucencyColor")),this._translucencyIntensityTexture&&_o.h.TranslucencyIntensityTextureEnabled&&o.SS_TRANSLUCENCYINTENSITY_TEXTURE&&(e.updateFloat2("vTranslucencyIntensityInfos",this._translucencyIntensityTexture.coordinatesIndex,this._translucencyIntensityTexture.level),(0,Le.mA)(this._translucencyIntensityTexture,e,"translucencyIntensity")),c&&_o.h.RefractionTextureEnabled){e.updateMatrix("refractionMatrix",c.getRefractionTextureMatrix());var u=1;c.isCube||c.depth&&(u=c.depth);var h=c.getSize().width,d=this.volumeIndexOfRefraction;if(e.updateFloat4("vRefractionInfos",c.level,1/d,u,this._invertRefractionY?-1:1),e.updateFloat4("vRefractionMicrosurfaceInfos",h,c.lodGenerationScale,c.lodGenerationOffset,1/this.indexOfRefraction),s&&e.updateFloat2("vRefractionFilteringInfo",h,Math.log2(h)),c.boundingBoxSize){var p=c;e.updateVector3("vRefractionPosition",p.boundingBoxPosition),e.updateVector3("vRefractionSize",p.boundingBoxSize)}}this._isScatteringEnabled&&e.updateFloat("scatteringDiffusionProfile",this._scatteringDiffusionProfileIndex),e.updateColor3("vDiffusionDistance",this.diffusionDistance),e.updateFloat4("vTintColor",this.tintColor.r,this.tintColor.g,this.tintColor.b,Math.max(1e-5,this.tintColorAtDistance)),e.updateColor4("vTranslucencyColor",null!==(i=this.translucencyColor)&&void 0!==i?i:this.tintColor,0),e.updateFloat3("vSubSurfaceIntensity",this.refractionIntensity,this.translucencyIntensity,0),e.updateFloat("dispersion",this.dispersion)}t.texturesEnabled&&(this._thicknessTexture&&_o.h.ThicknessTextureEnabled&&e.setTexture("thicknessSampler",this._thicknessTexture),this._refractionIntensityTexture&&_o.h.RefractionIntensityTextureEnabled&&o.SS_REFRACTIONINTENSITY_TEXTURE&&e.setTexture("refractionIntensitySampler",this._refractionIntensityTexture),this._translucencyIntensityTexture&&_o.h.TranslucencyIntensityTextureEnabled&&o.SS_TRANSLUCENCYINTENSITY_TEXTURE&&e.setTexture("translucencyIntensitySampler",this._translucencyIntensityTexture),this._translucencyColorTexture&&_o.h.TranslucencyColorTextureEnabled&&o.SS_TRANSLUCENCYCOLOR_TEXTURE&&e.setTexture("translucencyColorSampler",this._translucencyColorTexture),c&&_o.h.RefractionTextureEnabled&&(l?e.setTexture("refractionSampler",c):(e.setTexture("refractionSampler",c._lodTextureMid||c),e.setTexture("refractionSamplerLow",c._lodTextureLow||c),e.setTexture("refractionSamplerHigh",c._lodTextureHigh||c))))}},t.prototype._getRefractionTexture=function(e){return this._refractionTexture?this._refractionTexture:this._isRefractionEnabled?e.environmentTexture:null},Object.defineProperty(t.prototype,"disableAlphaBlending",{get:function(){return this._isRefractionEnabled&&this._linkRefractionWithTransparency},enumerable:!1,configurable:!0}),t.prototype.fillRenderTargetTextures=function(e){_o.h.RefractionTextureEnabled&&this._refractionTexture&&this._refractionTexture.isRenderTarget&&e.push(this._refractionTexture)},t.prototype.hasTexture=function(e){return this._thicknessTexture===e||this._refractionTexture===e||this._refractionIntensityTexture===e||this._translucencyIntensityTexture===e||this._translucencyColorTexture===e},t.prototype.hasRenderTargetTextures=function(){return!!(_o.h.RefractionTextureEnabled&&this._refractionTexture&&this._refractionTexture.isRenderTarget)},t.prototype.getActiveTextures=function(e){this._thicknessTexture&&e.push(this._thicknessTexture),this._refractionTexture&&e.push(this._refractionTexture),this._refractionIntensityTexture&&e.push(this._refractionIntensityTexture),this._translucencyColorTexture&&e.push(this._translucencyColorTexture),this._translucencyIntensityTexture&&e.push(this._translucencyIntensityTexture)},t.prototype.getAnimatables=function(e){this._thicknessTexture&&this._thicknessTexture.animations&&this._thicknessTexture.animations.length>0&&e.push(this._thicknessTexture),this._refractionTexture&&this._refractionTexture.animations&&this._refractionTexture.animations.length>0&&e.push(this._refractionTexture),this._refractionIntensityTexture&&this._refractionIntensityTexture.animations&&this._refractionIntensityTexture.animations.length>0&&e.push(this._refractionIntensityTexture),this._translucencyColorTexture&&this._translucencyColorTexture.animations&&this._translucencyColorTexture.animations.length>0&&e.push(this._translucencyColorTexture),this._translucencyIntensityTexture&&this._translucencyIntensityTexture.animations&&this._translucencyIntensityTexture.animations.length>0&&e.push(this._translucencyIntensityTexture)},t.prototype.dispose=function(e){e&&(this._thicknessTexture&&this._thicknessTexture.dispose(),this._refractionTexture&&this._refractionTexture.dispose(),this._refractionIntensityTexture&&this._refractionIntensityTexture.dispose(),this._translucencyColorTexture&&this._translucencyColorTexture.dispose(),this._translucencyIntensityTexture&&this._translucencyIntensityTexture.dispose())},t.prototype.getClassName=function(){return"PBRSubSurfaceConfiguration"},t.prototype.addFallbacks=function(e,t,n){return e.SS_SCATTERING&&t.addFallback(n++,"SS_SCATTERING"),e.SS_TRANSLUCENCY&&t.addFallback(n++,"SS_TRANSLUCENCY"),n},t.prototype.getSamplers=function(e){e.push("thicknessSampler","refractionIntensitySampler","translucencyIntensitySampler","refractionSampler","refractionSamplerLow","refractionSamplerHigh","translucencyColorSampler")},t.prototype.getUniforms=function(){return{ubo:[{name:"vRefractionMicrosurfaceInfos",size:4,type:"vec4"},{name:"vRefractionFilteringInfo",size:2,type:"vec2"},{name:"vTranslucencyIntensityInfos",size:2,type:"vec2"},{name:"vRefractionInfos",size:4,type:"vec4"},{name:"refractionMatrix",size:16,type:"mat4"},{name:"vThicknessInfos",size:2,type:"vec2"},{name:"vRefractionIntensityInfos",size:2,type:"vec2"},{name:"thicknessMatrix",size:16,type:"mat4"},{name:"refractionIntensityMatrix",size:16,type:"mat4"},{name:"translucencyIntensityMatrix",size:16,type:"mat4"},{name:"vThicknessParam",size:2,type:"vec2"},{name:"vDiffusionDistance",size:3,type:"vec3"},{name:"vTintColor",size:4,type:"vec4"},{name:"vSubSurfaceIntensity",size:3,type:"vec3"},{name:"vRefractionPosition",size:3,type:"vec3"},{name:"vRefractionSize",size:3,type:"vec3"},{name:"scatteringDiffusionProfile",size:1,type:"float"},{name:"dispersion",size:1,type:"float"},{name:"vTranslucencyColor",size:4,type:"vec4"},{name:"vTranslucencyColorInfos",size:2,type:"vec2"},{name:"translucencyColorMatrix",size:16,type:"mat4"}]}},t.DEFAULT_APPLY_ALBEDO_AFTERSUBSURFACE=!1,t.DEFAULT_LEGACY_TRANSLUCENCY=!1,(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"isRefractionEnabled",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"isTranslucencyEnabled",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"isDispersionEnabled",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markScenePrePassDirty")],t.prototype,"isScatteringEnabled",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"_scatteringDiffusionProfileIndex",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"refractionIntensity",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"translucencyIntensity",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"useAlbedoToTintRefraction",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"useAlbedoToTintTranslucency",void 0),(0,f.Cg)([(0,ce.uM)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"thicknessTexture",void 0),(0,f.Cg)([(0,ce.uM)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"refractionTexture",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"indexOfRefraction",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"_volumeIndexOfRefraction",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"volumeIndexOfRefraction",null),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"invertRefractionY",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"linkRefractionWithTransparency",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"minimumThickness",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"maximumThickness",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"useThicknessAsDepth",void 0),(0,f.Cg)([(0,ce.jT)()],t.prototype,"tintColor",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"tintColorAtDistance",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"dispersion",void 0),(0,f.Cg)([(0,ce.jT)()],t.prototype,"diffusionDistance",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useMaskFromThicknessTexture",void 0),(0,f.Cg)([(0,ce.uM)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"refractionIntensityTexture",void 0),(0,f.Cg)([(0,ce.uM)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"translucencyIntensityTexture",void 0),(0,f.Cg)([(0,ce.jT)()],t.prototype,"translucencyColor",void 0),(0,f.Cg)([(0,ce.uM)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"translucencyColorTexture",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useGltfStyleTextures",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"applyAlbedoAfterSubSurface",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"legacyTranslucency",void 0),t}(Ro),mg={effect:null,subMesh:null},_g=function(e){function t(t){var n=e.call(this,t)||this;return n.PBR=!0,n.NUM_SAMPLES="0",n.REALTIME_FILTERING=!1,n.IBL_CDF_FILTERING=!1,n.ALBEDO=!1,n.GAMMAALBEDO=!1,n.ALBEDODIRECTUV=0,n.VERTEXCOLOR=!1,n.BASE_WEIGHT=!1,n.BASE_WEIGHTDIRECTUV=0,n.BASE_DIFFUSE_ROUGHNESS=!1,n.BASE_DIFFUSE_ROUGHNESSDIRECTUV=0,n.BAKED_VERTEX_ANIMATION_TEXTURE=!1,n.AMBIENT=!1,n.AMBIENTDIRECTUV=0,n.AMBIENTINGRAYSCALE=!1,n.OPACITY=!1,n.VERTEXALPHA=!1,n.OPACITYDIRECTUV=0,n.OPACITYRGB=!1,n.ALPHATEST=!1,n.DEPTHPREPASS=!1,n.ALPHABLEND=!1,n.ALPHAFROMALBEDO=!1,n.ALPHATESTVALUE="0.5",n.SPECULAROVERALPHA=!1,n.RADIANCEOVERALPHA=!1,n.ALPHAFRESNEL=!1,n.LINEARALPHAFRESNEL=!1,n.PREMULTIPLYALPHA=!1,n.EMISSIVE=!1,n.EMISSIVEDIRECTUV=0,n.GAMMAEMISSIVE=!1,n.REFLECTIVITY=!1,n.REFLECTIVITY_GAMMA=!1,n.REFLECTIVITYDIRECTUV=0,n.SPECULARTERM=!1,n.MICROSURFACEFROMREFLECTIVITYMAP=!1,n.MICROSURFACEAUTOMATIC=!1,n.LODBASEDMICROSFURACE=!1,n.MICROSURFACEMAP=!1,n.MICROSURFACEMAPDIRECTUV=0,n.METALLICWORKFLOW=!1,n.ROUGHNESSSTOREINMETALMAPALPHA=!1,n.ROUGHNESSSTOREINMETALMAPGREEN=!1,n.METALLNESSSTOREINMETALMAPBLUE=!1,n.AOSTOREINMETALMAPRED=!1,n.METALLIC_REFLECTANCE=!1,n.METALLIC_REFLECTANCE_GAMMA=!1,n.METALLIC_REFLECTANCEDIRECTUV=0,n.METALLIC_REFLECTANCE_USE_ALPHA_ONLY=!1,n.REFLECTANCE=!1,n.REFLECTANCE_GAMMA=!1,n.REFLECTANCEDIRECTUV=0,n.ENVIRONMENTBRDF=!1,n.ENVIRONMENTBRDF_RGBD=!1,n.NORMAL=!1,n.TANGENT=!1,n.BUMP=!1,n.BUMPDIRECTUV=0,n.OBJECTSPACE_NORMALMAP=!1,n.PARALLAX=!1,n.PARALLAX_RHS=!1,n.PARALLAXOCCLUSION=!1,n.NORMALXYSCALE=!0,n.LIGHTMAP=!1,n.LIGHTMAPDIRECTUV=0,n.USELIGHTMAPASSHADOWMAP=!1,n.GAMMALIGHTMAP=!1,n.RGBDLIGHTMAP=!1,n.REFLECTION=!1,n.REFLECTIONMAP_3D=!1,n.REFLECTIONMAP_SPHERICAL=!1,n.REFLECTIONMAP_PLANAR=!1,n.REFLECTIONMAP_CUBIC=!1,n.USE_LOCAL_REFLECTIONMAP_CUBIC=!1,n.REFLECTIONMAP_PROJECTION=!1,n.REFLECTIONMAP_SKYBOX=!1,n.REFLECTIONMAP_EXPLICIT=!1,n.REFLECTIONMAP_EQUIRECTANGULAR=!1,n.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,n.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,n.INVERTCUBICMAP=!1,n.USESPHERICALFROMREFLECTIONMAP=!1,n.USEIRRADIANCEMAP=!1,n.USE_IRRADIANCE_DOMINANT_DIRECTION=!1,n.USESPHERICALINVERTEX=!1,n.REFLECTIONMAP_OPPOSITEZ=!1,n.LODINREFLECTIONALPHA=!1,n.GAMMAREFLECTION=!1,n.RGBDREFLECTION=!1,n.LINEARSPECULARREFLECTION=!1,n.RADIANCEOCCLUSION=!1,n.HORIZONOCCLUSION=!1,n.INSTANCES=!1,n.THIN_INSTANCES=!1,n.INSTANCESCOLOR=!1,n.PREPASS=!1,n.PREPASS_COLOR=!1,n.PREPASS_COLOR_INDEX=-1,n.PREPASS_IRRADIANCE=!1,n.PREPASS_IRRADIANCE_INDEX=-1,n.PREPASS_ALBEDO=!1,n.PREPASS_ALBEDO_INDEX=-1,n.PREPASS_ALBEDO_SQRT=!1,n.PREPASS_ALBEDO_SQRT_INDEX=-1,n.PREPASS_DEPTH=!1,n.PREPASS_DEPTH_INDEX=-1,n.PREPASS_SCREENSPACE_DEPTH=!1,n.PREPASS_SCREENSPACE_DEPTH_INDEX=-1,n.PREPASS_NORMALIZED_VIEW_DEPTH=!1,n.PREPASS_NORMALIZED_VIEW_DEPTH_INDEX=-1,n.PREPASS_NORMAL=!1,n.PREPASS_NORMAL_INDEX=-1,n.PREPASS_NORMAL_WORLDSPACE=!1,n.PREPASS_WORLD_NORMAL=!1,n.PREPASS_WORLD_NORMAL_INDEX=-1,n.PREPASS_POSITION=!1,n.PREPASS_POSITION_INDEX=-1,n.PREPASS_LOCAL_POSITION=!1,n.PREPASS_LOCAL_POSITION_INDEX=-1,n.PREPASS_VELOCITY=!1,n.PREPASS_VELOCITY_INDEX=-1,n.PREPASS_VELOCITY_LINEAR=!1,n.PREPASS_VELOCITY_LINEAR_INDEX=-1,n.PREPASS_REFLECTIVITY=!1,n.PREPASS_REFLECTIVITY_INDEX=-1,n.SCENE_MRT_COUNT=0,n.NUM_BONE_INFLUENCERS=0,n.BonesPerMesh=0,n.BONETEXTURE=!1,n.BONES_VELOCITY_ENABLED=!1,n.NONUNIFORMSCALING=!1,n.MORPHTARGETS=!1,n.MORPHTARGETS_POSITION=!1,n.MORPHTARGETS_NORMAL=!1,n.MORPHTARGETS_TANGENT=!1,n.MORPHTARGETS_UV=!1,n.MORPHTARGETS_UV2=!1,n.MORPHTARGETS_COLOR=!1,n.MORPHTARGETTEXTURE_HASPOSITIONS=!1,n.MORPHTARGETTEXTURE_HASNORMALS=!1,n.MORPHTARGETTEXTURE_HASTANGENTS=!1,n.MORPHTARGETTEXTURE_HASUVS=!1,n.MORPHTARGETTEXTURE_HASUV2S=!1,n.MORPHTARGETTEXTURE_HASCOLORS=!1,n.NUM_MORPH_INFLUENCERS=0,n.MORPHTARGETS_TEXTURE=!1,n.MULTIVIEW=!1,n.ORDER_INDEPENDENT_TRANSPARENCY=!1,n.ORDER_INDEPENDENT_TRANSPARENCY_16BITS=!1,n.USEPHYSICALLIGHTFALLOFF=!1,n.USEGLTFLIGHTFALLOFF=!1,n.TWOSIDEDLIGHTING=!1,n.MIRRORED=!1,n.SHADOWFLOAT=!1,n.CLIPPLANE=!1,n.CLIPPLANE2=!1,n.CLIPPLANE3=!1,n.CLIPPLANE4=!1,n.CLIPPLANE5=!1,n.CLIPPLANE6=!1,n.POINTSIZE=!1,n.FOG=!1,n.LOGARITHMICDEPTH=!1,n.CAMERA_ORTHOGRAPHIC=!1,n.CAMERA_PERSPECTIVE=!1,n.AREALIGHTSUPPORTED=!0,n.FORCENORMALFORWARD=!1,n.SPECULARAA=!1,n.UNLIT=!1,n.DECAL_AFTER_DETAIL=!1,n.DEBUGMODE=0,n.USE_VERTEX_PULLING=!1,n.CLUSTLIGHT_SLICES=0,n.CLUSTLIGHT_BATCH=0,n.rebuild(),n}return(0,f.C6)(t,e),t.prototype.reset=function(){e.prototype.reset.call(this),this.ALPHATESTVALUE="0.5",this.PBR=!0,this.NORMALXYSCALE=!0},t}(po(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,f.C6)(t,e),t}(No(ho)))),gg=function(e){function t(n,r,i){void 0===i&&(i=!1);var o=e.call(this,n,r,void 0,i||t.ForceGLSL)||this;return o._directIntensity=1,o._emissiveIntensity=1,o._environmentIntensity=1,o._specularIntensity=1,o._lightingInfos=new c.IU(o._directIntensity,o._emissiveIntensity,o._environmentIntensity,o._specularIntensity),o._disableBumpMap=!1,o._albedoTexture=null,o._baseWeightTexture=null,o._baseDiffuseRoughnessTexture=null,o._ambientTexture=null,o._ambientTextureStrength=1,o._ambientTextureImpactOnAnalyticalLights=t.DEFAULT_AO_ON_ANALYTICAL_LIGHTS,o._opacityTexture=null,o._reflectionTexture=null,o._emissiveTexture=null,o._reflectivityTexture=null,o._metallicTexture=null,o._metallic=null,o._roughness=null,o._metallicF0Factor=1,o._metallicReflectanceColor=u.v9.White(),o._useOnlyMetallicFromMetallicReflectanceTexture=!1,o._metallicReflectanceTexture=null,o._reflectanceTexture=null,o._microSurfaceTexture=null,o._bumpTexture=null,o._lightmapTexture=null,o._ambientColor=new u.v9(0,0,0),o._albedoColor=new u.v9(1,1,1),o._baseWeight=1,o._baseDiffuseRoughness=null,o._reflectivityColor=new u.v9(1,1,1),o._reflectionColor=new u.v9(1,1,1),o._emissiveColor=new u.v9(0,0,0),o._microSurface=.9,o._useLightmapAsShadowmap=!1,o._useHorizonOcclusion=!0,o._useRadianceOcclusion=!0,o._useAlphaFromAlbedoTexture=!1,o._useSpecularOverAlpha=!0,o._useMicroSurfaceFromReflectivityMapAlpha=!1,o._useRoughnessFromMetallicTextureAlpha=!0,o._useRoughnessFromMetallicTextureGreen=!1,o._useMetallnessFromMetallicTextureBlue=!1,o._useAmbientOcclusionFromMetallicTextureRed=!1,o._useAmbientInGrayScale=!1,o._useAutoMicroSurfaceFromReflectivityMap=!1,o._lightFalloff=t.LIGHTFALLOFF_PHYSICAL,o._useRadianceOverAlpha=!0,o._useObjectSpaceNormalMap=!1,o._useParallax=!1,o._useParallaxOcclusion=!1,o._parallaxScaleBias=.05,o._disableLighting=!1,o._maxSimultaneousLights=4,o._invertNormalMapX=!1,o._invertNormalMapY=!1,o._twoSidedLighting=!1,o._alphaCutOff=.4,o._useAlphaFresnel=!1,o._useLinearAlphaFresnel=!1,o._environmentBRDFTexture=null,o._forceIrradianceInFragment=!1,o._realTimeFiltering=!1,o._realTimeFilteringQuality=b.Y.TEXTURE_FILTERING_QUALITY_LOW,o._forceNormalForward=!1,o._enableSpecularAntiAliasing=!1,o._renderTargets=new co.L(16),o._globalAmbientColor=new u.v9(0,0,0),o._unlit=!1,o._applyDecalMapAfterDetailMap=!1,o._debugMode=0,o._shadersLoaded=!1,o._breakShaderLoadedCheck=!1,o.debugMode=0,o.debugLimit=-1,o.debugFactor=1,o._cacheHasRenderTargetTextures=!1,o.brdf=new ig(o),o.clearCoat=new ag(o),o.iridescence=new lg(o),o.anisotropy=new ug(o),o.sheen=new dg(o),o.subSurface=new fg(o),o.detailMap=new Oo(o),o._attachImageProcessingConfiguration(null),o.getRenderTargetTextures=function(){return o._renderTargets.reset(),_o.h.ReflectionTextureEnabled&&o._reflectionTexture&&o._reflectionTexture.isRenderTarget&&o._renderTargets.push(o._reflectionTexture),o._eventInfo.renderTargets=o._renderTargets,o._callbackPluginEventFillRenderTargetTextures(o._eventInfo),o._renderTargets},o._environmentBRDFTexture=eg(o.getScene()),o.prePassConfiguration=new uo,o}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"realTimeFiltering",{get:function(){return this._realTimeFiltering},set:function(e){this._realTimeFiltering=e,this.markAsDirty(b.Y.MATERIAL_TextureDirtyFlag)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"realTimeFilteringQuality",{get:function(){return this._realTimeFilteringQuality},set:function(e){this._realTimeFilteringQuality=e,this.markAsDirty(b.Y.MATERIAL_TextureDirtyFlag)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"canRenderToMRT",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasRenderTargetTextures",{get:function(){return!!(_o.h.ReflectionTextureEnabled&&this._reflectionTexture&&this._reflectionTexture.isRenderTarget)||this._cacheHasRenderTargetTextures},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isPrePassCapable",{get:function(){return!this.disableDepthWrite},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"PBRBaseMaterial"},Object.defineProperty(t.prototype,"_disableAlphaBlending",{get:function(){var e;return this._transparencyMode===t.PBRMATERIAL_OPAQUE||this._transparencyMode===t.PBRMATERIAL_ALPHATEST||(null===(e=this.subSurface)||void 0===e?void 0:e.disableAlphaBlending)},enumerable:!1,configurable:!0}),t.prototype.needAlphaBlending=function(){return this._hasTransparencyMode?this._transparencyModeIsBlend:!this._disableAlphaBlending&&(this.alpha<1||null!=this._opacityTexture||this._shouldUseAlphaFromAlbedoTexture())},t.prototype.needAlphaTesting=function(){var e;return this._hasTransparencyMode?this._transparencyModeIsTest:!(null===(e=this.subSurface)||void 0===e?void 0:e.disableAlphaBlending)&&this._hasAlphaChannel()&&(null==this._transparencyMode||this._transparencyMode===t.PBRMATERIAL_ALPHATEST)},t.prototype._shouldUseAlphaFromAlbedoTexture=function(){return null!=this._albedoTexture&&this._albedoTexture.hasAlpha&&this._useAlphaFromAlbedoTexture&&this._transparencyMode!==t.PBRMATERIAL_OPAQUE},t.prototype._hasAlphaChannel=function(){return null!=this._albedoTexture&&this._albedoTexture.hasAlpha||null!=this._opacityTexture},t.prototype.getAlphaTestTexture=function(){return this._albedoTexture},t.prototype.isReadyForSubMesh=function(e,t,n){var r;this._uniformBufferLayoutBuilt||this.buildUniformLayout();var i=t._drawWrapper;if(i.effect&&this.isFrozen&&i._wasPreviouslyReady&&i._wasPreviouslyUsingInstances===n)return!0;t.materialDefines||(this._callbackPluginEventGeneric(4,this._eventInfo),t.materialDefines=new _g(this._eventInfo.defineNames));var o=t.materialDefines;if(this._isReadyForSubMesh(t))return!0;var a=this.getScene(),s=a.getEngine();if(o._areTexturesDirty&&(this._eventInfo.hasRenderTargetTextures=!1,this._callbackPluginEventHasRenderTargetTextures(this._eventInfo),this._cacheHasRenderTargetTextures=this._eventInfo.hasRenderTargetTextures,a.texturesEnabled)){if(this._albedoTexture&&_o.h.DiffuseTextureEnabled&&!this._albedoTexture.isReadyOrNotBlocking())return!1;if(this._baseWeightTexture&&_o.h.BaseWeightTextureEnabled&&!this._baseWeightTexture.isReadyOrNotBlocking())return!1;if(this._baseDiffuseRoughnessTexture&&_o.h.BaseDiffuseRoughnessTextureEnabled&&!this._baseDiffuseRoughnessTexture.isReadyOrNotBlocking())return!1;if(this._ambientTexture&&_o.h.AmbientTextureEnabled&&!this._ambientTexture.isReadyOrNotBlocking())return!1;if(this._opacityTexture&&_o.h.OpacityTextureEnabled&&!this._opacityTexture.isReadyOrNotBlocking())return!1;var l=this._getReflectionTexture();if(l&&_o.h.ReflectionTextureEnabled){if(!l.isReadyOrNotBlocking())return!1;if(l.irradianceTexture){if(!l.irradianceTexture.isReadyOrNotBlocking())return!1}else if(!l.sphericalPolynomial&&(null===(r=l.getInternalTexture())||void 0===r?void 0:r._sphericalPolynomialPromise))return!1}if(this._lightmapTexture&&_o.h.LightmapTextureEnabled&&!this._lightmapTexture.isReadyOrNotBlocking())return!1;if(this._emissiveTexture&&_o.h.EmissiveTextureEnabled&&!this._emissiveTexture.isReadyOrNotBlocking())return!1;if(_o.h.SpecularTextureEnabled){if(this._metallicTexture){if(!this._metallicTexture.isReadyOrNotBlocking())return!1}else if(this._reflectivityTexture&&!this._reflectivityTexture.isReadyOrNotBlocking())return!1;if(this._metallicReflectanceTexture&&!this._metallicReflectanceTexture.isReadyOrNotBlocking())return!1;if(this._reflectanceTexture&&!this._reflectanceTexture.isReadyOrNotBlocking())return!1;if(this._microSurfaceTexture&&!this._microSurfaceTexture.isReadyOrNotBlocking())return!1}if(s.getCaps().standardDerivatives&&this._bumpTexture&&_o.h.BumpTextureEnabled&&!this._disableBumpMap&&!this._bumpTexture.isReady())return!1;if(this._environmentBRDFTexture&&_o.h.ReflectionTextureEnabled&&!this._environmentBRDFTexture.isReady())return!1}if(this._eventInfo.isReadyForSubMesh=!0,this._eventInfo.defines=o,this._eventInfo.subMesh=t,this._callbackPluginEventIsReadyForSubMesh(this._eventInfo),!this._eventInfo.isReadyForSubMesh)return!1;if(o._areImageProcessingDirty&&this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.isReady())return!1;if(o.AREALIGHTUSED||o.CLUSTLIGHT_BATCH)for(var c=0;c0&&t.push(this._albedoTexture),this._baseWeightTexture&&this._baseWeightTexture.animations&&this._baseWeightTexture.animations.length>0&&t.push(this._baseWeightTexture),this._baseDiffuseRoughnessTexture&&this._baseDiffuseRoughnessTexture.animations&&this._baseDiffuseRoughnessTexture.animations.length>0&&t.push(this._baseDiffuseRoughnessTexture),this._ambientTexture&&this._ambientTexture.animations&&this._ambientTexture.animations.length>0&&t.push(this._ambientTexture),this._opacityTexture&&this._opacityTexture.animations&&this._opacityTexture.animations.length>0&&t.push(this._opacityTexture),this._reflectionTexture&&this._reflectionTexture.animations&&this._reflectionTexture.animations.length>0&&t.push(this._reflectionTexture),this._emissiveTexture&&this._emissiveTexture.animations&&this._emissiveTexture.animations.length>0&&t.push(this._emissiveTexture),this._metallicTexture&&this._metallicTexture.animations&&this._metallicTexture.animations.length>0?t.push(this._metallicTexture):this._reflectivityTexture&&this._reflectivityTexture.animations&&this._reflectivityTexture.animations.length>0&&t.push(this._reflectivityTexture),this._bumpTexture&&this._bumpTexture.animations&&this._bumpTexture.animations.length>0&&t.push(this._bumpTexture),this._lightmapTexture&&this._lightmapTexture.animations&&this._lightmapTexture.animations.length>0&&t.push(this._lightmapTexture),this._metallicReflectanceTexture&&this._metallicReflectanceTexture.animations&&this._metallicReflectanceTexture.animations.length>0&&t.push(this._metallicReflectanceTexture),this._reflectanceTexture&&this._reflectanceTexture.animations&&this._reflectanceTexture.animations.length>0&&t.push(this._reflectanceTexture),this._microSurfaceTexture&&this._microSurfaceTexture.animations&&this._microSurfaceTexture.animations.length>0&&t.push(this._microSurfaceTexture),t},t.prototype._getReflectionTexture=function(){return this._reflectionTexture?this._reflectionTexture:this.getScene().environmentTexture},t.prototype.getActiveTextures=function(){var t=e.prototype.getActiveTextures.call(this);return this._albedoTexture&&t.push(this._albedoTexture),this._baseWeightTexture&&t.push(this._baseWeightTexture),this._baseDiffuseRoughnessTexture&&t.push(this._baseDiffuseRoughnessTexture),this._ambientTexture&&t.push(this._ambientTexture),this._opacityTexture&&t.push(this._opacityTexture),this._reflectionTexture&&t.push(this._reflectionTexture),this._emissiveTexture&&t.push(this._emissiveTexture),this._reflectivityTexture&&t.push(this._reflectivityTexture),this._metallicTexture&&t.push(this._metallicTexture),this._metallicReflectanceTexture&&t.push(this._metallicReflectanceTexture),this._reflectanceTexture&&t.push(this._reflectanceTexture),this._microSurfaceTexture&&t.push(this._microSurfaceTexture),this._bumpTexture&&t.push(this._bumpTexture),this._lightmapTexture&&t.push(this._lightmapTexture),t},t.prototype.hasTexture=function(t){return!!e.prototype.hasTexture.call(this,t)||this._albedoTexture===t||this._baseWeightTexture===t||this._baseDiffuseRoughnessTexture===t||this._ambientTexture===t||this._opacityTexture===t||this._reflectionTexture===t||this._emissiveTexture===t||this._reflectivityTexture===t||this._metallicTexture===t||this._metallicReflectanceTexture===t||this._reflectanceTexture===t||this._microSurfaceTexture===t||this._bumpTexture===t||this._lightmapTexture===t},t.prototype.setPrePassRenderer=function(){var e;if(!(null===(e=this.subSurface)||void 0===e?void 0:e.isScatteringEnabled))return!1;var t=this.getScene().enableSubSurfaceForPrePass();return t&&(t.enabled=!0),!0},t.prototype.dispose=function(t,n){var r,i,o,a,s,l,c,u,h,d,p,f,m,_;this._breakShaderLoadedCheck=!0,n&&(this._environmentBRDFTexture&&this.getScene().environmentBRDFTexture!==this._environmentBRDFTexture&&this._environmentBRDFTexture.dispose(),null===(r=this._albedoTexture)||void 0===r||r.dispose(),null===(i=this._baseWeightTexture)||void 0===i||i.dispose(),null===(o=this._baseDiffuseRoughnessTexture)||void 0===o||o.dispose(),null===(a=this._ambientTexture)||void 0===a||a.dispose(),null===(s=this._opacityTexture)||void 0===s||s.dispose(),null===(l=this._reflectionTexture)||void 0===l||l.dispose(),null===(c=this._emissiveTexture)||void 0===c||c.dispose(),null===(u=this._metallicTexture)||void 0===u||u.dispose(),null===(h=this._reflectivityTexture)||void 0===h||h.dispose(),null===(d=this._bumpTexture)||void 0===d||d.dispose(),null===(p=this._lightmapTexture)||void 0===p||p.dispose(),null===(f=this._metallicReflectanceTexture)||void 0===f||f.dispose(),null===(m=this._reflectanceTexture)||void 0===m||m.dispose(),null===(_=this._microSurfaceTexture)||void 0===_||_.dispose()),this._renderTargets.dispose(),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),e.prototype.dispose.call(this,t,n)},t.PBRMATERIAL_OPAQUE=Be.MATERIAL_OPAQUE,t.PBRMATERIAL_ALPHATEST=Be.MATERIAL_ALPHATEST,t.PBRMATERIAL_ALPHABLEND=Be.MATERIAL_ALPHABLEND,t.PBRMATERIAL_ALPHATESTANDBLEND=Be.MATERIAL_ALPHATESTANDBLEND,t.DEFAULT_AO_ON_ANALYTICAL_LIGHTS=0,t.LIGHTFALLOFF_PHYSICAL=0,t.LIGHTFALLOFF_GLTF=1,t.LIGHTFALLOFF_STANDARD=2,t.ForceGLSL=!1,(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsMiscDirty")],t.prototype,"debugMode",void 0),t}(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,f.C6)(t,e),t}(Fo(mo))),vg=function(e){function t(n,r,i){void 0===i&&(i=!1);var o=e.call(this,n,r,i)||this;return o.directIntensity=1,o.emissiveIntensity=1,o.environmentIntensity=1,o.specularIntensity=1,o.disableBumpMap=!1,o.ambientTextureStrength=1,o.ambientTextureImpactOnAnalyticalLights=t.DEFAULT_AO_ON_ANALYTICAL_LIGHTS,o.metallicF0Factor=1,o.metallicReflectanceColor=u.v9.White(),o.useOnlyMetallicFromMetallicReflectanceTexture=!1,o.ambientColor=new u.v9(0,0,0),o.albedoColor=new u.v9(1,1,1),o.baseWeight=1,o.reflectivityColor=new u.v9(1,1,1),o.reflectionColor=new u.v9(1,1,1),o.emissiveColor=new u.v9(0,0,0),o.microSurface=1,o.useLightmapAsShadowmap=!1,o.useAlphaFromAlbedoTexture=!1,o.forceAlphaTest=!1,o.alphaCutOff=.4,o.useSpecularOverAlpha=!0,o.useMicroSurfaceFromReflectivityMapAlpha=!1,o.useRoughnessFromMetallicTextureAlpha=!0,o.useRoughnessFromMetallicTextureGreen=!1,o.useMetallnessFromMetallicTextureBlue=!1,o.useAmbientOcclusionFromMetallicTextureRed=!1,o.useAmbientInGrayScale=!1,o.useAutoMicroSurfaceFromReflectivityMap=!1,o.useRadianceOverAlpha=!0,o.useObjectSpaceNormalMap=!1,o.useParallax=!1,o.useParallaxOcclusion=!1,o.parallaxScaleBias=.05,o.disableLighting=!1,o.forceIrradianceInFragment=!1,o.maxSimultaneousLights=4,o.invertNormalMapX=!1,o.invertNormalMapY=!1,o.twoSidedLighting=!1,o.useAlphaFresnel=!1,o.useLinearAlphaFresnel=!1,o.environmentBRDFTexture=null,o.forceNormalForward=!1,o.enableSpecularAntiAliasing=!1,o.useHorizonOcclusion=!0,o.useRadianceOcclusion=!0,o.unlit=!1,o.applyDecalMapAfterDetailMap=!1,o._environmentBRDFTexture=eg(o.getScene()),o}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"refractionTexture",{get:function(){return this.subSurface.refractionTexture},set:function(e){this.subSurface.refractionTexture=e,e?this.subSurface.isRefractionEnabled=!0:this.subSurface.linkRefractionWithTransparency||(this.subSurface.isRefractionEnabled=!1)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"indexOfRefraction",{get:function(){return this.subSurface.indexOfRefraction},set:function(e){this.subSurface.indexOfRefraction=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"invertRefractionY",{get:function(){return this.subSurface.invertRefractionY},set:function(e){this.subSurface.invertRefractionY=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"linkRefractionWithTransparency",{get:function(){return this.subSurface.linkRefractionWithTransparency},set:function(e){this.subSurface.linkRefractionWithTransparency=e,e&&(this.subSurface.isRefractionEnabled=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"usePhysicalLightFalloff",{get:function(){return this._lightFalloff===gg.LIGHTFALLOFF_PHYSICAL},set:function(e){e!==this.usePhysicalLightFalloff&&(this._markAllSubMeshesAsTexturesDirty(),this._lightFalloff=e?gg.LIGHTFALLOFF_PHYSICAL:gg.LIGHTFALLOFF_STANDARD)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"useGLTFLightFalloff",{get:function(){return this._lightFalloff===gg.LIGHTFALLOFF_GLTF},set:function(e){e!==this.useGLTFLightFalloff&&(this._markAllSubMeshesAsTexturesDirty(),this._lightFalloff=e?gg.LIGHTFALLOFF_GLTF:gg.LIGHTFALLOFF_STANDARD)},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"PBRMaterial"},t.prototype.clone=function(e,n,r){var i=this;void 0===n&&(n=!0),void 0===r&&(r="");var o=Te.p.Clone((function(){return new t(e,i.getScene())}),this,{cloneTexturesOnlyOnce:n});return o.id=e,o.name=e,this.stencil.copyTo(o.stencil),this._clonePlugins(o,r),o},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.customType="BABYLON.PBRMaterial",t},t.Parse=function(e,n,r){var i=Te.p.Parse((function(){return new t(e.name,n)}),e,n,r);return e.stencil&&i.stencil.parse(e.stencil,n,r),Be._ParsePlugins(e,i,n,r),e.clearCoat&&i.clearCoat.parse(e.clearCoat,n,r),e.anisotropy&&i.anisotropy.parse(e.anisotropy,n,r),e.brdf&&i.brdf.parse(e.brdf,n,r),e.sheen&&i.sheen.parse(e.sheen,n,r),e.subSurface&&i.subSurface.parse(e.subSurface,n,r),e.iridescence&&i.iridescence.parse(e.iridescence,n,r),i},t.PBRMATERIAL_OPAQUE=gg.PBRMATERIAL_OPAQUE,t.PBRMATERIAL_ALPHATEST=gg.PBRMATERIAL_ALPHATEST,t.PBRMATERIAL_ALPHABLEND=gg.PBRMATERIAL_ALPHABLEND,t.PBRMATERIAL_ALPHATESTANDBLEND=gg.PBRMATERIAL_ALPHATESTANDBLEND,t.DEFAULT_AO_ON_ANALYTICAL_LIGHTS=gg.DEFAULT_AO_ON_ANALYTICAL_LIGHTS,(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"directIntensity",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"emissiveIntensity",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"environmentIntensity",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"specularIntensity",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"disableBumpMap",void 0),(0,f.Cg)([(0,ce.uM)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"albedoTexture",void 0),(0,f.Cg)([(0,ce.uM)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"baseWeightTexture",void 0),(0,f.Cg)([(0,ce.uM)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"baseDiffuseRoughnessTexture",void 0),(0,f.Cg)([(0,ce.uM)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"ambientTexture",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"ambientTextureStrength",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"ambientTextureImpactOnAnalyticalLights",void 0),(0,f.Cg)([(0,ce.uM)(),(0,ce.$z)("_markAllSubMeshesAsTexturesAndMiscDirty")],t.prototype,"opacityTexture",void 0),(0,f.Cg)([(0,ce.uM)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectionTexture",void 0),(0,f.Cg)([(0,ce.uM)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"emissiveTexture",void 0),(0,f.Cg)([(0,ce.uM)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectivityTexture",void 0),(0,f.Cg)([(0,ce.uM)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"metallicTexture",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"metallic",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"roughness",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"metallicF0Factor",void 0),(0,f.Cg)([(0,ce.jT)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"metallicReflectanceColor",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useOnlyMetallicFromMetallicReflectanceTexture",void 0),(0,f.Cg)([(0,ce.uM)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"metallicReflectanceTexture",void 0),(0,f.Cg)([(0,ce.uM)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectanceTexture",void 0),(0,f.Cg)([(0,ce.uM)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"microSurfaceTexture",void 0),(0,f.Cg)([(0,ce.uM)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"bumpTexture",void 0),(0,f.Cg)([(0,ce.uM)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty",null)],t.prototype,"lightmapTexture",void 0),(0,f.Cg)([(0,ce.jT)("ambient"),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"ambientColor",void 0),(0,f.Cg)([(0,ce.jT)("albedo"),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"albedoColor",void 0),(0,f.Cg)([(0,ce.lK)("baseWeight"),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"baseWeight",void 0),(0,f.Cg)([(0,ce.lK)("baseDiffuseRoughness"),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"baseDiffuseRoughness",void 0),(0,f.Cg)([(0,ce.jT)("reflectivity"),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectivityColor",void 0),(0,f.Cg)([(0,ce.jT)("reflection"),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectionColor",void 0),(0,f.Cg)([(0,ce.jT)("emissive"),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"emissiveColor",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"microSurface",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useLightmapAsShadowmap",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesAndMiscDirty")],t.prototype,"useAlphaFromAlbedoTexture",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesAndMiscDirty")],t.prototype,"forceAlphaTest",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesAndMiscDirty")],t.prototype,"alphaCutOff",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useSpecularOverAlpha",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useMicroSurfaceFromReflectivityMapAlpha",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useRoughnessFromMetallicTextureAlpha",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useRoughnessFromMetallicTextureGreen",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useMetallnessFromMetallicTextureBlue",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useAmbientOcclusionFromMetallicTextureRed",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useAmbientInGrayScale",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useAutoMicroSurfaceFromReflectivityMap",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"usePhysicalLightFalloff",null),(0,f.Cg)([(0,ce.lK)()],t.prototype,"useGLTFLightFalloff",null),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useRadianceOverAlpha",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useObjectSpaceNormalMap",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useParallax",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useParallaxOcclusion",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"parallaxScaleBias",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsLightsDirty")],t.prototype,"disableLighting",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"forceIrradianceInFragment",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsLightsDirty")],t.prototype,"maxSimultaneousLights",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"invertNormalMapX",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"invertNormalMapY",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"twoSidedLighting",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useAlphaFresnel",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useLinearAlphaFresnel",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"environmentBRDFTexture",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"forceNormalForward",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"enableSpecularAntiAliasing",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useHorizonOcclusion",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useRadianceOcclusion",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsMiscDirty")],t.prototype,"unlit",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsMiscDirty")],t.prototype,"applyDecalMapAfterDetailMap",void 0),t}(gg);(0,h.Y5)("BABYLON.PBRMaterial",vg);var yg,bg=n(19135),Sg=n(71545),Tg=n(81867),Eg=function(e){function t(t,n,r){var i=e.call(this,t,c.Pq.Zero(),n)||this;return i._xrSessionManager=r,i._firstFrame=!1,i._referenceQuaternion=c.PT.Identity(),i._referencedPosition=new c.Pq,i._trackingState=0,i.onXRCameraInitializedObservable=new l.cP,i.onBeforeCameraTeleport=new l.cP,i.onAfterCameraTeleport=new l.cP,i.onTrackingStateChanged=new l.cP,i.compensateOnFirstFrame=!0,i.minZ=.1,i.rotationQuaternion=new c.PT,i.cameraRigMode=oe.i.RIG_MODE_CUSTOM,i.updateUpVectorFromRotation=!0,i._updateNumberOfRigCameras(1),i.freezeProjectionMatrix(),i._deferOnly=!0,i._xrSessionManager.onXRSessionInit.add((function(){i._referencedPosition.copyFromFloats(0,0,0),i._referenceQuaternion.copyFromFloats(0,0,0,1),i._firstFrame=i.compensateOnFirstFrame,i._xrSessionManager.onWorldScaleFactorChangedObservable.add((function(){i._xrSessionManager.currentFrame&&i._updateDepthNearFar()}))})),i._xrSessionManager.onXRFrameObservable.add((function(){i._firstFrame&&i._updateFromXRSession(),i.onXRCameraInitializedObservable.hasObservers()&&(i.onXRCameraInitializedObservable.notifyObservers(i),i.onXRCameraInitializedObservable.clear()),i._deferredUpdated&&(i.position.copyFrom(i._deferredPositionUpdate),i.rotationQuaternion.copyFrom(i._deferredRotationQuaternionUpdate)),i._updateReferenceSpace(),i._updateFromXRSession()}),void 0,!0),i}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"trackingState",{get:function(){return this._trackingState},enumerable:!1,configurable:!0}),t.prototype._setTrackingState=function(e){this._trackingState!==e&&(this._trackingState=e,this.onTrackingStateChanged.notifyObservers(e))},Object.defineProperty(t.prototype,"realWorldHeight",{get:function(){var e=this._xrSessionManager.currentFrame&&this._xrSessionManager.currentFrame.getViewerPose(this._xrSessionManager.baseReferenceSpace);return e&&e.transform?e.transform.position.y*this._xrSessionManager.worldScalingFactor:0},enumerable:!1,configurable:!0}),t.prototype._updateForDualEyeDebugging=function(){this._updateNumberOfRigCameras(2),this.rigCameras[0].viewport=new wi.L(0,0,.5,1),this.rigCameras[0].outputRenderTarget=null,this.rigCameras[1].viewport=new wi.L(.5,0,.5,1),this.rigCameras[1].outputRenderTarget=null},t.prototype.setTransformationFromNonVRCamera=function(e,t){void 0===e&&(e=this.getScene().activeCamera),void 0===t&&(t=!0),e&&e!==this&&(e.computeWorldMatrix().decompose(void 0,this.rotationQuaternion,this.position),this.position.y=0,c.PT.FromEulerAnglesToRef(0,this.rotationQuaternion.toEulerAngles().y,0,this.rotationQuaternion),this._firstFrame=!0,t&&this._xrSessionManager.resetReferenceSpace())},t.prototype.getClassName=function(){return"WebXRCamera"},t.prototype.setTarget=function(e){var t=c.AA.Vector3[1];e.subtractToRef(this.position,t),t.y=0,t.normalize();var n=Math.atan2(t.x,t.z)+(this._scene.useRightHandedSystem?Math.PI:0);this.rotationQuaternion.toEulerAnglesToRef(t),c.PT.FromEulerAnglesToRef(t.x,n,t.z,this.rotationQuaternion)},t.prototype.dispose=function(){e.prototype.dispose.call(this),this._lastXRViewerPose=void 0,this.onTrackingStateChanged.clear()},t.prototype._updateDepthNearFar=function(){var e=(this.maxZ||1e4)*this._xrSessionManager.worldScalingFactor,t={depthFar:e,depthNear:this.minZ};this._xrSessionManager.updateRenderState(t),this._cache.minZ=this.minZ,this._cache.maxZ=e},t.prototype._updateFromXRSession=function(){var e,t=this._xrSessionManager.currentFrame&&this._xrSessionManager.currentFrame.getViewerPose(this._xrSessionManager.referenceSpace);if(this._lastXRViewerPose=t||void 0,t){var n=t.emulatedPosition?1:2;if(this._setTrackingState(n),this.minZ===this._cache.minZ&&this.maxZ===this._cache.maxZ||this._updateDepthNearFar(),t.transform){var r=t.transform.orientation;if(void 0===t.transform.orientation.x)return;var i=t.transform.position;this._referencedPosition.set(i.x,i.y,i.z).scaleInPlace(this._xrSessionManager.worldScalingFactor),this._referenceQuaternion.set(r.x,r.y,r.z,r.w),this._scene.useRightHandedSystem||(this._referencedPosition.z*=-1,this._referenceQuaternion.z*=-1,this._referenceQuaternion.w*=-1),this._firstFrame?(this._firstFrame=!1,this.position.y+=this._referencedPosition.y,this._referenceQuaternion.copyFromFloats(0,0,0,1)):(this.rotationQuaternion.copyFrom(this._referenceQuaternion),this.position.copyFrom(this._referencedPosition))}this.rigCameras.length!==t.views.length&&this._updateNumberOfRigCameras(t.views.length);for(var o=0;oe;){var n=this.rigCameras.pop();n&&n.dispose()}},t.prototype._updateReferenceSpace=function(){if(!this.position.equals(this._referencedPosition)||!this.rotationQuaternion.equals(this._referenceQuaternion)){var e=c.AA.Matrix[0],n=c.AA.Matrix[1],r=c.AA.Matrix[2];c.uq.ComposeToRef(t._ScaleReadOnly,this._referenceQuaternion,this._referencedPosition,e),c.uq.ComposeToRef(t._ScaleReadOnly,this.rotationQuaternion,this.position,n),e.invert().multiplyToRef(n,r),r.invert(),this._scene.useRightHandedSystem||r.toggleModelMatrixHandInPlace(),r.decompose(void 0,this._referenceQuaternion,this._referencedPosition);var i=new XRRigidTransform({x:this._referencedPosition.x/this._xrSessionManager.worldScalingFactor,y:this._referencedPosition.y/this._xrSessionManager.worldScalingFactor,z:this._referencedPosition.z/this._xrSessionManager.worldScalingFactor,w:1},{x:this._referenceQuaternion.x,y:this._referenceQuaternion.y,z:this._referenceQuaternion.z,w:this._referenceQuaternion.w});this._xrSessionManager.referenceSpace=this._xrSessionManager.referenceSpace.getOffsetReferenceSpace(i)}},t._ScaleReadOnly=c.Pq.One(),t}(ni),xg=function(){function e(e){var t=this;this._scene=e,this._nonVRCamera=null,this._attachedToElement=!1,this._spectatorCamera=null,this._originalSceneAutoClear=!0,this._supported=!1,this._spectatorMode=!1,this._lastTimestamp=0,this.onInitialXRPoseSetObservable=new l.cP,this.onStateChangedObservable=new l.cP,this.state=3,this.sessionManager=new Qo(e),this.camera=new Eg("webxr",e,this.sessionManager),this.featuresManager=new hr(this.sessionManager),e.onDisposeObservable.addOnce((function(){t.dispose()}))}return e.CreateAsync=function(t){return(0,f.sH)(this,void 0,void 0,(function(){var n;return(0,f.YH)(this,(function(r){switch(r.label){case 0:return[4,(n=new e(t)).sessionManager.initializeAsync().then((function(){return n._supported=!0,n})).catch((function(e){throw n._setState(3),n.dispose(),e}))];case 1:return[2,r.sent()]}}))}))},e.prototype.dispose=function(){var e;this.exitXRAsync(),this.camera.dispose(),this.onStateChangedObservable.clear(),this.onInitialXRPoseSetObservable.clear(),this.sessionManager.dispose(),null===(e=this._spectatorCamera)||void 0===e||e.dispose(),this._nonVRCamera&&(this._scene.activeCamera=this._nonVRCamera)},e.prototype.enterXRAsync=function(e,t){return(0,f.sH)(this,arguments,void 0,(function(e,t,n,r){var i,o,a,s,l,c,u,h=this;return void 0===n&&(n=this.sessionManager.getWebXRRenderTarget()),void 0===r&&(r={}),(0,f.YH)(this,(function(d){switch(d.label){case 0:if(!this._supported)throw"WebXR not supported in this browser or environment";return this._setState(0),"viewer"!==t&&"local"!==t&&(r.optionalFeatures=r.optionalFeatures||[],r.optionalFeatures.push(t)),[4,this.featuresManager._extendXRSessionInitObject(r)];case 1:r=d.sent(),"immersive-ar"===e&&"unbounded"!==t&&y.V.Warn("We recommend using 'unbounded' reference space type when using 'immersive-ar' session mode"),d.label=2;case 2:return d.trys.push([2,7,,8]),[4,this.sessionManager.initializeSessionAsync(e,r)];case 3:return d.sent(),[4,this.sessionManager.setReferenceSpaceTypeAsync(t)];case 4:return d.sent(),i={depthFar:this.camera.maxZ||1e4,depthNear:this.camera.minZ},this.featuresManager.getEnabledFeature(ur.LAYERS)?[3,6]:[4,n.initializeXRLayerAsync(this.sessionManager.session)];case 5:o=d.sent(),i.baseLayer=o,d.label=6;case 6:return this.sessionManager.updateRenderState(i),this.sessionManager.runXRRenderLoop(),this._originalSceneAutoClear=this._scene.autoClear,this._nonVRCamera=this._scene.activeCamera,this._attachedToElement=!!(null===(l=null===(s=this._nonVRCamera)||void 0===s?void 0:s.inputs)||void 0===l?void 0:l.attachedToElement),null===(c=this._nonVRCamera)||void 0===c||c.detachControl(),this._scene.activeCamera=this.camera,"immersive-ar"!==e?this._nonXRToXRCamera():(this._scene.autoClear=!1,this.camera.compensateOnFirstFrame=!1,this.camera.position.set(0,0,0),this.camera.rotationQuaternion.set(0,0,0,1),this.onInitialXRPoseSetObservable.notifyObservers(this.camera)),null===(u=Ie.$.audioEngine)||void 0===u||u._resumeAudioContextOnStateChange(),this.sessionManager.onXRSessionEnded.addOnce((function(){1!==h.state&&h._setState(1);for(var t=0,n=h.camera.rigCameras;t=n&&(t._lastTimestamp=t.sessionManager.currentTimestamp,t._spectatorCamera.position.copyFrom(t.camera.rigCameras[r].globalPosition),t._spectatorCamera.rotationQuaternion.copyFrom(t.camera.rigCameras[r].absoluteRotation))};if(this._spectatorMode){if(r>=this.camera.rigCameras.length)throw new Error("the preferred camera index is beyond the length of rig camera array.");var o=function(){2===t.state?(t._spectatorCamera=new Ei("webxr-spectator",c.Pq.Zero(),t._scene),t._spectatorCamera.rotationQuaternion=new c.PT,t._scene.activeCameras=[t.camera,t._spectatorCamera],t.sessionManager.onXRFrameObservable.add(i),t._scene.onAfterRenderCameraObservable.add((function(e){e===t.camera&&(t._scene.getEngine().framebufferDimensionsObject=null)}))):1===t.state&&(t.sessionManager.onXRFrameObservable.removeCallback(i),t._scene.activeCameras=null)};this.onStateChangedObservable.add(o),o()}else this.sessionManager.onXRFrameObservable.removeCallback(i),this._scene.activeCameras=[this.camera]},e.prototype._nonXRToXRCamera=function(){this.camera.setTransformationFromNonVRCamera(this._nonVRCamera),this.onInitialXRPoseSetObservable.notifyObservers(this.camera)},e.prototype._setState=function(e){this.state!==e&&(this.state=e,this.onStateChangedObservable.notifyObservers(this.state))},e}(),Pg=function(){function e(e,t,n,r){void 0===n&&(n=-1),void 0===r&&(r=[]),this.id=e,this.type=t,this._buttonIndex=n,this._axesIndices=r,this._axes={x:0,y:0},this._changes={},this._currentValue=0,this._hasChanges=!1,this._pressed=!1,this._touched=!1,this.onAxisValueChangedObservable=new l.cP,this.onButtonStateChangedObservable=new l.cP}return Object.defineProperty(e.prototype,"axes",{get:function(){return this._axes},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"changes",{get:function(){return this._changes},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasChanges",{get:function(){return this._hasChanges},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pressed",{get:function(){return this._pressed},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"touched",{get:function(){return this._touched},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this._currentValue},enumerable:!1,configurable:!0}),e.prototype.dispose=function(){this.onAxisValueChangedObservable.clear(),this.onButtonStateChangedObservable.clear()},e.prototype.isAxes=function(){return 0!==this._axesIndices.length},e.prototype.isButton=function(){return-1!==this._buttonIndex},e.prototype.update=function(e){var t=!1,n=!1;if(this._hasChanges=!1,this._changes={},this.isButton()){var r=e.buttons[this._buttonIndex];if(!r)return;this._currentValue!==r.value&&(this.changes.value={current:r.value,previous:this._currentValue},t=!0,this._currentValue=r.value),this._touched!==r.touched&&(this.changes.touched={current:r.touched,previous:this._touched},t=!0,this._touched=r.touched),this._pressed!==r.pressed&&(this.changes.pressed={current:r.pressed,previous:this._pressed},t=!0,this._pressed=r.pressed)}this.isAxes()&&(this._axes.x!==e.axes[this._axesIndices[0]]&&(this.changes.axes={current:{x:e.axes[this._axesIndices[0]],y:this._axes.y},previous:{x:this._axes.x,y:this._axes.y}},this._axes.x=e.axes[this._axesIndices[0]],n=!0),this._axes.y!==e.axes[this._axesIndices[1]]&&(this.changes.axes?this.changes.axes.current.y=e.axes[this._axesIndices[1]]:this.changes.axes={current:{x:this._axes.x,y:e.axes[this._axesIndices[1]]},previous:{x:this._axes.x,y:this._axes.y}},this._axes.y=e.axes[this._axesIndices[1]],n=!0)),t&&(this._hasChanges=!0,this.onButtonStateChangedObservable.notifyObservers(this)),n&&(this._hasChanges=!0,this.onAxisValueChangedObservable.notifyObservers(this._axes))},e.BUTTON_TYPE="button",e.SQUEEZE_TYPE="squeeze",e.THUMBSTICK_TYPE="thumbstick",e.TOUCHPAD_TYPE="touchpad",e.TRIGGER_TYPE="trigger",e}(),Cg=n(17347),Rg=n(23885);function Ag(e,t){return(0,f.sH)(this,void 0,void 0,(function(){var n;return(0,f.YH)(this,(function(r){switch(r.label){case 0:return n=t.method||"GET",[4,new Promise((function(r,i){var o=new Sa.u;o.addEventListener("readystatechange",(function(){if(4==o.readyState)if(200==o.status){var n={};if(t.responseHeaders)for(var a=0,s=t.responseHeaders;ar/10&&(a.isVisible=!0),(s+=t._scene.getEngine().getDeltaTime())>=r)t._scene.simulatePointerDown(n.pick,c),l=!0,t._options.disablePointerUpOnTouchOut&&t._scene.simulatePointerUp(n.pick,c),a.isVisible=!1;else{var e=1-s/r;a.scaling.set(e,e,e)}else l=!1,s=0;t._scene.simulatePointerMove(n.pick,c),o=n.pick}})),void 0!==this._options.renderingGroupId&&(a.renderingGroupId=this._options.renderingGroupId),e&&e.onDisposeObservable.addOnce((function(){n.pick&&!t._options.disablePointerUpOnTouchOut&&l&&(t._scene.simulatePointerUp(n.pick,c),n.finalPointerUpTriggered=!0),a.dispose()}))},t.prototype._attachScreenRayMode=function(e){var t=this,n=this._controllers[e.uniqueId],r=!1,i={pointerId:n.id,pointerType:"xr"};n.onFrameObserver=this._xrSessionManager.onXRFrameObservable.add((function(){t._augmentPointerInit(i,n.id,n.screenCoordinates),!n.pick||t._options.disablePointerUpOnTouchOut&&r||(r?t._scene.simulatePointerMove(n.pick,i):(t._scene.simulatePointerDown(n.pick,i),n.pointerDownTriggered=!0,r=!0,t._options.disablePointerUpOnTouchOut&&t._scene.simulatePointerUp(n.pick,i)))})),e.onDisposeObservable.addOnce((function(){t._augmentPointerInit(i,n.id,n.screenCoordinates),t._xrSessionManager.runInXRFrame((function(){n.pick&&!n.finalPointerUpTriggered&&r&&!t._options.disablePointerUpOnTouchOut&&(t._scene.simulatePointerUp(n.pick,i),n.finalPointerUpTriggered=!0)}))}))},t.prototype._attachTrackedPointerRayMode=function(e){var t=this,n=this._controllers[e.uniqueId];if(this._options.forceGazeMode)return this._attachGazeMode(e);var r={pointerId:n.id,pointerType:"xr"};if(n.onFrameObserver=this._xrSessionManager.onXRFrameObservable.add((function(){n.laserPointer.material.disableLighting=t.disablePointerLighting,n.selectionMesh.material.disableLighting=t.disableSelectionMeshLighting,n.pick&&(t._augmentPointerInit(r,n.id,n.screenCoordinates),t._scene.simulatePointerMove(n.pick,r))})),e.inputSource.gamepad){var i=function(i){t._options.overrideButtonId&&(n.selectionComponent=i.getComponent(t._options.overrideButtonId)),n.selectionComponent||(n.selectionComponent=i.getMainComponent()),n.onButtonChangedObserver=n.selectionComponent.onButtonStateChangedObservable.add((function(i){if(i.changes.pressed){var o=i.changes.pressed.current;if(n.pick)(t._options.enablePointerSelectionOnAllControllers||e.uniqueId===t._attachedController)&&(t._augmentPointerInit(r,n.id,n.screenCoordinates),o?(t._scene.simulatePointerDown(n.pick,r),n.pointerDownTriggered=!0,n.selectionMesh.material.emissiveColor=t.selectionMeshPickedColor,n.laserPointer.material.emissiveColor=t.laserPointerPickedColor):(t._scene.simulatePointerUp(n.pick,r),n.selectionMesh.material.emissiveColor=t.selectionMeshDefaultColor,n.laserPointer.material.emissiveColor=t.laserPointerDefaultColor));else if(o&&!t._options.enablePointerSelectionOnAllControllers&&!t._options.disableSwitchOnClick){var a=t._controllers[t._attachedController];a&&a.pointerDownTriggered&&!a.finalPointerUpTriggered&&(t._augmentPointerInit(r,a.id,a.screenCoordinates),t._scene.simulatePointerUp(new xe.G,{pointerId:a.id,pointerType:"xr"}),a.finalPointerUpTriggered=!0),t._attachedController=e.uniqueId}}}))};e.motionController?i(e.motionController):e.onMotionControllerInitObservable.add(i)}else{var o=function(e){t._xrSessionManager.onXRFrameObservable.addOnce((function(){t._augmentPointerInit(r,n.id,n.screenCoordinates),n.xrController&&e.inputSource===n.xrController.inputSource&&n.pick&&(t._scene.simulatePointerDown(n.pick,r),n.pointerDownTriggered=!0,n.selectionMesh.material.emissiveColor=t.selectionMeshPickedColor,n.laserPointer.material.emissiveColor=t.laserPointerPickedColor)}))},a=function(e){t._xrSessionManager.onXRFrameObservable.addOnce((function(){t._augmentPointerInit(r,n.id,n.screenCoordinates),n.xrController&&e.inputSource===n.xrController.inputSource&&n.pick&&(t._scene.simulatePointerUp(n.pick,r),n.selectionMesh.material.emissiveColor=t.selectionMeshDefaultColor,n.laserPointer.material.emissiveColor=t.laserPointerDefaultColor)}))};n.eventListeners={selectend:a,selectstart:o},this._xrSessionManager.session.addEventListener("selectstart",o),this._xrSessionManager.session.addEventListener("selectend",a)}},t.prototype._convertNormalToDirectionOfRay=function(e,t){return e&&Math.acos(c.Pq.Dot(e,t.direction))r},t.prototype._updatePointerDistance=function(e,t){void 0===t&&(t=100),e.scaling.y=t,this._scene.useRightHandedSystem&&(t*=-1),e.position.z=t/2+.05},t.prototype._augmentPointerInit=function(e,t,n){e.pointerId=t,e.pointerType="xr",n&&(e.screenX=n.x,e.screenY=n.y)},Object.defineProperty(t.prototype,"lasterPointerDefaultColor",{get:function(){return this.laserPointerDefaultColor},enumerable:!1,configurable:!0}),t._IdCounter=200,t.Name=ur.POINTER_SELECTION,t.Version=1,t}(gv);hr.AddWebXRFeature(vv.Name,(function(e,t){return function(){return new vv(e,t)}}),vv.Version,!0),function(e){e[e.Float=1]="Float",e[e.Int=2]="Int",e[e.Vector2=4]="Vector2",e[e.Vector3=8]="Vector3",e[e.Vector4=16]="Vector4",e[e.Color3=32]="Color3",e[e.Color4=64]="Color4",e[e.Matrix=128]="Matrix",e[e.Object=256]="Object",e[e.AutoDetect=1024]="AutoDetect",e[e.BasedOnInput=2048]="BasedOnInput",e[e.All=4095]="All"}(dv||(dv={})),function(e){e[e.Vertex=1]="Vertex",e[e.Fragment=2]="Fragment",e[e.Neutral=4]="Neutral",e[e.VertexAndFragment=3]="VertexAndFragment"}(pv||(pv={}));var yv,bv,Sv=n(47582),Tv=function(){function e(){this.supportUniformBuffers=!1,this.attributes=[],this.uniforms=[],this.constants=[],this.samplers=[],this.functions={},this.extensions={},this.prePassOutput={},this.counters={},this._terminalBlocks=new Set,this._attributeDeclaration="",this._uniformDeclaration="",this._constantDeclaration="",this._samplerDeclaration="",this._varyingTransfer="",this._injectAtEnd="",this._injectAtTop="",this._customEntryHeader="",this._repeatableContentAnchorIndex=0,this._builtCompilationString="",this.compilationString=""}return Object.defineProperty(e.prototype,"shaderLanguage",{get:function(){return this.sharedData.nodeMaterial.shaderLanguage},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fSuffix",{get:function(){return 1===this.shaderLanguage?"f":""},enumerable:!1,configurable:!0}),e.prototype.getProcessedShaderAsync=function(e){return(0,f.sH)(this,void 0,void 0,(function(){var t,n,r=this;return(0,f.YH)(this,(function(i){switch(i.label){case 0:return this._builtCompilationString?(t=this.sharedData.nodeMaterial.getScene().getEngine(),n={defines:e.split("\n"),indexParameters:void 0,isFragment:this.target===pv.Fragment,shouldUseHighPrecisionShader:t._shouldUseHighPrecisionShader,processor:t._getShaderProcessor(this.shaderLanguage),supportsUniformBuffers:t.supportsUniformBuffers,shadersRepository:Bi.l.GetShadersRepository(this.shaderLanguage),includesShadersStore:Bi.l.GetIncludesShadersStore(this.shaderLanguage),version:(100*t.version).toString(),platformName:t.shaderPlatformName,processingContext:null,isNDCHalfZRange:t.isNDCHalfZRange,useReverseDepthBuffer:t.useReverseDepthBuffer},!t.isWebGPU&&t.version>1&&(n.processor=new Sv.n),[4,new Promise((function(e){(0,vo.M0)(r._builtCompilationString,n,(function(t,n){e(t)}),t)}))]):(y.V.Error("getProcessedShaderAsync: Shader not built yet."),[2,""]);case 1:return[2,i.sent()]}}))}))},e.prototype.finalize=function(e){var t=e.sharedData.emitComments,n=this.target===pv.Fragment,r="\n".concat(t?"//Entry point\n":"");this._customEntryHeader?r+=this._customEntryHeader:1===this.shaderLanguage?r+=n?"@fragment\nfn main(input: FragmentInputs) -> FragmentOutputs {\n".concat(this.sharedData.varyingInitializationsFragment):"@vertex\nfn main(input: VertexInputs) -> FragmentInputs{\n":r+="void main(void) {\n",this.compilationString=r+this.compilationString,this._constantDeclaration&&(this.compilationString="\n".concat(t?"//Constants\n":"").concat(this._constantDeclaration,"\n").concat(this.compilationString));var i="";for(var o in this.functions)i+=this.functions[o]+"\n";if(this.compilationString="\n".concat(i,"\n").concat(this.compilationString),!n&&this._varyingTransfer&&(this.compilationString="".concat(this.compilationString,"\n").concat(this._varyingTransfer)),this._injectAtEnd&&(this.compilationString="".concat(this.compilationString,"\n").concat(this._injectAtEnd)),this.compilationString="".concat(this.compilationString,"\n}"),this.sharedData.varyingDeclaration&&(this.compilationString="\n".concat(t?"//Varyings\n":"").concat(n?this.sharedData.varyingDeclarationFragment:this.sharedData.varyingDeclaration,"\n").concat(this.compilationString)),this._samplerDeclaration&&(this.compilationString="\n".concat(t?"//Samplers\n":"").concat(this._samplerDeclaration,"\n").concat(this.compilationString)),this._uniformDeclaration&&(this.compilationString="\n".concat(t?"//Uniforms\n":"").concat(this._uniformDeclaration,"\n").concat(this.compilationString)),this._attributeDeclaration&&!n&&(this.compilationString="\n".concat(t?"//Attributes\n":"").concat(this._attributeDeclaration,"\n").concat(this.compilationString)),1!==this.shaderLanguage)for(var a in this.compilationString="precision highp float;\n"+this.compilationString,this.compilationString="#if defined(WEBGL2) || defined(WEBGPU)\nprecision highp sampler2DArray;\n#endif\n"+this.compilationString,n&&(this.compilationString="#if defined(PREPASS)\r\n#extension GL_EXT_draw_buffers : require\r\nlayout(location = 0) out highp vec4 glFragData[SCENE_MRT_COUNT];\r\nhighp vec4 gl_FragColor;\r\n#endif\r\n"+this.compilationString),this.extensions){var s=this.extensions[a];this.compilationString="\n".concat(s,"\n").concat(this.compilationString)}this._injectAtTop&&(this.compilationString="".concat(this._injectAtTop,"\n").concat(this.compilationString)),this._builtCompilationString=this.compilationString},Object.defineProperty(e.prototype,"_repeatableContentAnchor",{get:function(){return"###___ANCHOR".concat(this._repeatableContentAnchorIndex++,"___###")},enumerable:!1,configurable:!0}),e.prototype._getFreeVariableName=function(e){return e=this.sharedData.formatConfig.formatVariablename(e),void 0===this.sharedData.variableNames[e]?(this.sharedData.variableNames[e]=0,"output"===e||"texture"===e?e+this.sharedData.variableNames[e]:e):(this.sharedData.variableNames[e]++,e+this.sharedData.variableNames[e])},e.prototype._getFreeDefineName=function(e){return void 0===this.sharedData.defineNames[e]?this.sharedData.defineNames[e]=0:this.sharedData.defineNames[e]++,e+this.sharedData.defineNames[e]},e.prototype._excludeVariableName=function(e){this.sharedData.variableNames[e]=0},e.prototype._emit2DSampler=function(e,t,n,r,i,o){if(void 0===t&&(t=""),void 0===n&&(n=!1),this.samplers.indexOf(e)<0||n){if(t&&(this._samplerDeclaration+="#if ".concat(t,"\n")),1===this.shaderLanguage){var a=i?"u":"f";this._samplerDeclaration+="var ".concat(e+b.Y.AUTOSAMPLERSUFFIX,": sampler;\n"),this._samplerDeclaration+="var ".concat(e,": texture_2d<").concat(a,"32>;\n")}else{a=i?"u":"";var s=null!=o?o:"";this._samplerDeclaration+="uniform ".concat(s," ").concat(a,"sampler2D ").concat(e,"; ").concat(r||"","\n")}t&&(this._samplerDeclaration+="#endif\n"),n||this.samplers.push(e)}},e.prototype._emitCubeSampler=function(e,t,n){void 0===t&&(t=""),void 0===n&&(n=!1),(this.samplers.indexOf(e)<0||n)&&(t&&(this._samplerDeclaration+="#if ".concat(t,"\n")),1===this.shaderLanguage?(this._samplerDeclaration+="var ".concat(e+b.Y.AUTOSAMPLERSUFFIX,": sampler;\n"),this._samplerDeclaration+="var ".concat(e,": texture_cube;\n")):this._samplerDeclaration+="uniform samplerCube ".concat(e,";\n"),t&&(this._samplerDeclaration+="#endif\n"),n||this.samplers.push(e))},e.prototype._emit2DArraySampler=function(e){this.samplers.indexOf(e)<0&&(1===this.shaderLanguage?(this._samplerDeclaration+="var ".concat(e+b.Y.AUTOSAMPLERSUFFIX,": sampler;\n"),this._samplerDeclaration+="var ".concat(e,": texture_2d_array;\n")):this._samplerDeclaration+="uniform sampler2DArray ".concat(e,";\n"),this.samplers.push(e))},e.prototype._getGLType=function(e){switch(e){case dv.Float:return"float";case dv.Int:return"int";case dv.Vector2:return"vec2";case dv.Color3:case dv.Vector3:return"vec3";case dv.Color4:case dv.Vector4:return"vec4";case dv.Matrix:return"mat4"}return""},e.prototype._getShaderType=function(e){var t=1===this.shaderLanguage;switch(e){case dv.Float:return t?"f32":"float";case dv.Int:return t?"i32":"int";case dv.Vector2:return t?"vec2f":"vec2";case dv.Color3:case dv.Vector3:return t?"vec3f":"vec3";case dv.Color4:case dv.Vector4:return t?"vec4f":"vec4";case dv.Matrix:return t?"mat4x4f":"mat4"}return""},e.prototype._emitExtension=function(e,t,n){void 0===n&&(n=""),this.extensions[e]||(n&&(t="#if ".concat(n,"\n").concat(t,"\n#endif")),this.extensions[e]=t)},e.prototype._emitFunction=function(e,t,n){this.functions[e]||(this.sharedData.emitComments&&(t=n+"\n"+t),this.functions[e]=t)},e.prototype._emitCodeFromInclude=function(e,t,n){var r=Bi.l.GetIncludesShadersStore(this.shaderLanguage);if(n&&n.repeatKey)return"#include<".concat(e,">").concat(n.substitutionVars?"("+n.substitutionVars+")":"","[0..").concat(n.repeatKey,"]\n");var i=r[e]+"\n";if(this.sharedData.emitComments&&(i=t+"\n"+i),!n)return i;if(n.replaceStrings)for(var o=0;o").concat(n.substitutionVars?"("+n.substitutionVars+")":"","[0..").concat(n.repeatKey,"]\n"):this.functions[i]="#include<".concat(e,">").concat((null==n?void 0:n.substitutionVars)?"("+(null==n?void 0:n.substitutionVars)+")":"","\n"),void(this.sharedData.emitComments&&(this.functions[i]=t+"\n"+this.functions[i]));if(this.functions[i]=o[e],this.sharedData.emitComments&&(this.functions[i]=t+"\n"+this.functions[i]),n.removeIfDef&&(this.functions[i]=this.functions[i].replace(/^\s*?#ifdef.+$/gm,""),this.functions[i]=this.functions[i].replace(/^\s*?#endif.*$/gm,""),this.functions[i]=this.functions[i].replace(/^\s*?#else.*$/gm,""),this.functions[i]=this.functions[i].replace(/^\s*?#elif.*$/gm,"")),n.removeAttributes&&(this.functions[i]=this.functions[i].replace(/\s*?attribute .+?;/g,"\n")),n.removeUniforms&&(this.functions[i]=this.functions[i].replace(/\s*?uniform .*?;/g,"\n")),n.removeVaryings&&(this.functions[i]=this.functions[i].replace(/\s*?(varying|in) .+?;/g,"\n")),n.replaceStrings)for(var a=0;a":"")," ").concat(e,": ").concat(this._getShaderType(t)):"".concat(n?"const ":"").concat(this._getShaderType(t)," ").concat(e)},e.prototype._samplerCubeFunc=function(){return 1===this.shaderLanguage?"textureSample":"textureCube"},e.prototype._samplerFunc=function(){return 1===this.shaderLanguage?"textureSample":"texture2D"},e.prototype._samplerLODFunc=function(){return 1===this.shaderLanguage?"textureSampleLevel":"texture2DLodEXT"},e.prototype._toLinearSpace=function(e){return 1!==this.shaderLanguage||e.type!==dv.Color3&&e.type!==dv.Vector3?"toLinearSpace(".concat(e.associatedVariableName,")"):"toLinearSpaceVec3(".concat(e.associatedVariableName,")")},e.prototype._generateTextureSample=function(e,t){return 1===this.shaderLanguage?"".concat(this._samplerFunc(),"(").concat(t,",").concat(t+b.Y.AUTOSAMPLERSUFFIX,", ").concat(e,")"):"".concat(this._samplerFunc(),"(").concat(t,", ").concat(e,")")},e.prototype._generateTextureSampleLOD=function(e,t,n){return 1===this.shaderLanguage?"".concat(this._samplerLODFunc(),"(").concat(t,",").concat(t+b.Y.AUTOSAMPLERSUFFIX,", ").concat(e,", ").concat(n,")"):"".concat(this._samplerLODFunc(),"(").concat(t,", ").concat(e,", ").concat(n,")")},e.prototype._generateTextureSampleCube=function(e,t){return 1===this.shaderLanguage?"".concat(this._samplerCubeFunc(),"(").concat(t,",").concat(t+b.Y.AUTOSAMPLERSUFFIX,", ").concat(e,")"):"".concat(this._samplerCubeFunc(),"(").concat(t,", ").concat(e,")")},e.prototype._generateTextureSampleCubeLOD=function(e,t,n){return 1===this.shaderLanguage?"".concat(this._samplerCubeFunc(),"(").concat(t,",").concat(t+b.Y.AUTOSAMPLERSUFFIX,", ").concat(e,", ").concat(n,")"):"".concat(this._samplerCubeFunc(),"(").concat(t,", ").concat(e,", ").concat(n,")")},e.prototype._convertVariableDeclarationToWGSL=function(e,t,n){return n.replace(new RegExp("(".concat(e,")\\s+(\\w+)"),"g"),"var $2: ".concat(t))},e.prototype._convertVariableConstructorsToWGSL=function(e,t,n){return n.replace(new RegExp("(".concat(e,")\\("),"g")," ".concat(t,"("))},e.prototype._convertOutParametersToWGSL=function(e){return e.replace(new RegExp("out\\s+var\\s+(\\w+)\\s*:\\s*(\\w+)","g"),"$1: ptr")},e.prototype._convertTernaryOperandsToWGSL=function(e){return e.replace(new RegExp("\\[(.*?)\\?(.*?):(.*)\\]","g"),(function(e,t,n,r){return"select(".concat(r,", ").concat(n,", ").concat(t,")")}))},e.prototype._convertModOperatorsToWGSL=function(e){return e.replace(new RegExp("mod\\((.+?),\\s*(.+?)\\)","g"),(function(e,t,n){return"((".concat(t,")%(").concat(n,"))")}))},e.prototype._convertConstToWGSL=function(e){return e.replace(new RegExp("const var","g"),"const")},e.prototype._convertInnerFunctionsToWGSL=function(e){return e.replace(new RegExp("inversesqrt","g"),"inverseSqrt")},e.prototype._convertFunctionsToWGSL=function(e){for(var t,n=/var\s+(\w+)\s*:\s*(\w+)\((.*)\)/g;null!==(t=n.exec(e));){var r=t[1],i=t[2],o=t[3].replace(/var\s/g,"");e=e.replace(t[0],"fn ".concat(r,"(").concat(o,") -> ").concat(i))}return e},e.prototype._babylonSLtoWGSL=function(e){return e=this._convertVariableDeclarationToWGSL("void","voidnull",e),e=this._convertVariableDeclarationToWGSL("bool","bool",e),e=this._convertVariableDeclarationToWGSL("int","i32",e),e=this._convertVariableDeclarationToWGSL("uint","u32",e),e=this._convertVariableDeclarationToWGSL("float","f32",e),e=this._convertVariableDeclarationToWGSL("vec2","vec2f",e),e=this._convertVariableDeclarationToWGSL("vec3","vec3f",e),e=this._convertVariableDeclarationToWGSL("vec4","vec4f",e),e=this._convertVariableDeclarationToWGSL("mat2","mat2x2f",e),e=this._convertVariableDeclarationToWGSL("mat3","mat3x3f",e),e=this._convertVariableDeclarationToWGSL("mat4","mat4x4f",e),e=this._convertVariableConstructorsToWGSL("float","f32",e),e=this._convertVariableConstructorsToWGSL("vec2","vec2f",e),e=this._convertVariableConstructorsToWGSL("vec3","vec3f",e),e=this._convertVariableConstructorsToWGSL("vec4","vec4f",e),e=this._convertVariableConstructorsToWGSL("mat2","mat2x2f",e),e=this._convertVariableConstructorsToWGSL("mat3","mat3x3f",e),e=this._convertVariableConstructorsToWGSL("mat4","mat4x4f",e),e=this._convertTernaryOperandsToWGSL(e),e=this._convertModOperatorsToWGSL(e),e=this._convertConstToWGSL(e),e=this._convertInnerFunctionsToWGSL(e),e=(e=this._convertOutParametersToWGSL(e)).replace(/\[\*\]/g,"*"),(e=(e=(e=this._convertFunctionsToWGSL(e)).replace(/\s->\svoidnull/g,"")).replace(/dFdx/g,"dpdx")).replace(/dFdy/g,"dpdy")},e.prototype._convertTernaryOperandsToGLSL=function(e){return e.replace(new RegExp("\\[(.+?)\\?(.+?):(.+)\\]","g"),(function(e,t,n,r){return"".concat(t," ? ").concat(n," : ").concat(r)}))},e.prototype._babylonSLtoGLSL=function(e){return e=e.replace(/\[\*\]/g,""),this._convertTernaryOperandsToGLSL(e)},e}(),Ev=function(){function e(){this.temps=[],this.varyings=[],this.varyingDeclaration="",this.varyingDeclarationFragment="",this.varyingInitializationsFragment="",this.inputBlocks=[],this.textureBlocks=[],this.bindableBlocks=[],this.forcedBindableBlocks=[],this.blocksWithFallbacks=[],this.blocksWithDefines=[],this.repeatableContentBlocks=[],this.dynamicUniformBlocks=[],this.blockingBlocks=[],this.animatedInputs=[],this.formatConfig={getUniformAnnotation:null,formatVariablename:function(e){return e.replace(/[^a-zA-Z_]+/g,"")}},this.variableNames={},this.defineNames={},this.hints={needWorldViewMatrix:!1,needWorldViewProjectionMatrix:!1,needAlphaBlending:!1,needAlphaTesting:!1},this.checks={emitVertex:!1,emitFragment:!1,notConnectedNonOptionalInputs:new Array,customErrors:new Array},this.allowEmptyVertexProgram=!1,this.variableNames.position=0,this.variableNames.normal=0,this.variableNames.tangent=0,this.variableNames.uv=0,this.variableNames.uv2=0,this.variableNames.uv3=0,this.variableNames.uv4=0,this.variableNames.uv5=0,this.variableNames.uv6=0,this.variableNames.color=0,this.variableNames.matricesIndices=0,this.variableNames.matricesWeights=0,this.variableNames.matricesIndicesExtra=0,this.variableNames.matricesWeightsExtra=0,this.variableNames.diffuseBase=0,this.variableNames.specularBase=0,this.variableNames.worldPos=0,this.variableNames.shadow=0,this.variableNames.view=0,this.variableNames.vTBN=0,this.defineNames.MAINUV0=0,this.defineNames.MAINUV1=0,this.defineNames.MAINUV2=0,this.defineNames.MAINUV3=0,this.defineNames.MAINUV4=0,this.defineNames.MAINUV5=0,this.defineNames.MAINUV6=0,this.defineNames.MAINUV7=0}return e.prototype.raiseBuildError=function(e){-1!==this.checks.customErrors.indexOf(e)&&this.checks.customErrors.push(e)},e.prototype.emitErrors=function(){var e="";this.checks.emitVertex||this.allowEmptyVertexProgram||(e+="NodeMaterial does not have a vertex output. You need to at least add a block that generates a position value.\n"),this.checks.emitFragment||(e+="NodeMaterial does not have a fragment output. You need to at least add a block that generates a color value.\n");for(var t=0,n=this.checks.notConnectedNonOptionalInputs;t0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isDirectlyConnectedToVertexOutput",{get:function(){if(!this.hasEndpoints)return!1;for(var e=0,t=this._endpoints;e=0)&&(t.isExposedOnFrame=!0,t.exposedPortPosition=this.exposedPortPosition),t},e.prototype.dispose=function(){this.onConnectionObservable.clear(),this.onDisconnectionObservable.clear(),this.onTypeChangedObservable.clear(),this._connectedPoint=null,this._typeConnectionSource=null,this._linkedConnectionSource=null},e.prototype._updateTypeDependentState=function(e){var t=this.type;e(),this.type!==t&&this._notifyTypeChanged()},e.prototype._notifyTypeChanged=function(){this._isTypeChangeObservableNotifying||(this._isTypeChangeObservableNotifying=!0,this.onTypeChangedObservable.notifyObservers(this.type),this._isTypeChangeObservableNotifying=!1)},e}(),Cv=function(){function e(e,t,n,r){switch(void 0===t&&(t=pv.Vertex),void 0===n&&(n=!1),void 0===r&&(r=!1),this._isFinalMerger=!1,this._isInput=!1,this._isLoop=!1,this._isTeleportOut=!1,this._isTeleportIn=!1,this._name="",this._isUnique=!1,this._codeIsReady=!0,this._isFinalOutput=!1,this.onCodeIsReadyObservable=new l.cP,this.inputsAreExclusive=!1,this._codeVariableName="",this._inputs=new Array,this._outputs=new Array,this.comments="",this.visibleInInspector=!1,this.visibleOnFrame=!1,this._target=t,this._originalTargetIsNeutral=t===pv.Neutral,this._isFinalMerger=n,this._isFinalOutput=r,this.getClassName()){case"InputBlock":this._isInput=!0;break;case"NodeMaterialTeleportOutBlock":this._isTeleportOut=!0;break;case"NodeMaterialTeleportInBlock":this._isTeleportIn=!0;break;case"LoopBlock":this._isLoop=!0}this._name=e,this.uniqueId=Np.K.UniqueId}return Object.defineProperty(e.prototype,"_isFinalOutputAndActive",{get:function(){return this._isFinalOutput},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_hasPrecedence",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"name",{get:function(){return this._name},set:function(e){this.validateBlockName(e)&&(this._name=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"codeIsReady",{get:function(){return this._codeIsReady},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isUnique",{get:function(){return this._isUnique},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isFinalMerger",{get:function(){return this._isFinalMerger},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isInput",{get:function(){return this._isInput},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isTeleportOut",{get:function(){return this._isTeleportOut},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isTeleportIn",{get:function(){return this._isTeleportIn},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isLoop",{get:function(){return this._isLoop},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"buildId",{get:function(){return this._buildId},set:function(e){this._buildId=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"target",{get:function(){return this._target},set:function(e){0===(this._target&e)&&(this._target=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"inputs",{get:function(){return this._inputs},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"outputs",{get:function(){return this._outputs},enumerable:!1,configurable:!0}),e.prototype.getInputByName=function(e){var t=this._inputs.filter((function(t){return t.name===e}));return t.length?t[0]:null},e.prototype.getOutputByName=function(e){var t=this._outputs.filter((function(t){return t.name===e}));return t.length?t[0]:null},e.prototype._setInitialTarget=function(e){this._target=e,this._originalTargetIsNeutral=e===pv.Neutral},e.prototype.initialize=function(e){},e.prototype.bind=function(e,t,n,r){},e.prototype._writeVariable=function(e){return e.connectedPoint?"".concat(e.associatedVariableName):"0."},e.prototype._writeFloat=function(e){var t=e.toString();return-1===t.indexOf(".")&&(t+=".0"),"".concat(t)},e.prototype.getClassName=function(){return"NodeMaterialBlock"},e.prototype.isConnectedInFragmentShader=function(){return this.outputs.some((function(e){return e.isConnectedInFragmentShader}))},e.prototype.registerInput=function(e,t,n,r,i){return void 0===n&&(n=!1),(i=null!=i?i:new Pv(e,this,0)).type=t,i.isOptional=n,r&&(i.target=r),this._inputs.push(i),this},e.prototype.registerOutput=function(e,t,n,r){return(r=null!=r?r:new Pv(e,this,1)).type=t,n&&(r.target=n),this._outputs.push(r),this},e.prototype.getFirstAvailableInput=function(e){void 0===e&&(e=null);for(var t=0,n=this._inputs;t=this._outputs.length?null:this._outputs[t+1]},e.prototype.isAnAncestorOf=function(e){for(var t=0,n=this._outputs;t;\r\n"));var c=t._getShaderType(dv.Vector4);if(o.connectedPoint){var u="1.0";i.connectedPoint&&(u=i.associatedVariableName),t.compilationString+="#ifdef ".concat(this._additionalColorDefineName,"\n"),o.connectedPoint.type===dv.Float?t.compilationString+="".concat(l," = ").concat(c,"(").concat(o.associatedVariableName,", ").concat(o.associatedVariableName,", ").concat(o.associatedVariableName,", ").concat(u,");\n"):t.compilationString+="".concat(l," = ").concat(c,"(").concat(o.associatedVariableName,", ").concat(u,");\n"),t.compilationString+="#else\n"}if(n.connectedPoint?i.isConnected?t.compilationString+="".concat(l," = ").concat(c,"(").concat(n.associatedVariableName,".rgb, ").concat(i.associatedVariableName,");\n"):t.compilationString+="".concat(l," = ").concat(n.associatedVariableName,";\n"):r.connectedPoint?(u="1.0",i.connectedPoint&&(u=i.associatedVariableName),r.connectedPoint.type===dv.Float?t.compilationString+="".concat(l," = ").concat(c,"(").concat(r.associatedVariableName,", ").concat(r.associatedVariableName,", ").concat(r.associatedVariableName,", ").concat(u,");\n"):t.compilationString+="".concat(l," = ").concat(c,"(").concat(r.associatedVariableName,", ").concat(u,");\n")):t.sharedData.checks.notConnectedNonOptionalInputs.push(n),o.connectedPoint&&(t.compilationString+="#endif\n"),t.compilationString+="#ifdef ".concat(this._linearDefineName,"\n"),t.compilationString+="".concat(l," = toLinearSpace(").concat(l,");\n"),t.compilationString+="#endif\n",t.compilationString+="#ifdef ".concat(this._gammaDefineName,"\n"),t.compilationString+="".concat(l," = toGammaSpace(").concat(l,");\n"),t.compilationString+="#endif\n",1===t.shaderLanguage&&(t.compilationString+="#if !defined(PREPASS)\r\n",t.compilationString+="fragmentOutputs.color = ".concat(l,";\r\n"),t.compilationString+="#endif\r\n"),this.useLogarithmicDepth||t.sharedData.nodeMaterial.useLogarithmicDepth){var h=a?"input.vFragmentDepth":"vFragmentDepth",d=a?"uniforms.":"",p=a?"fragmentOutputs.fragDepth":"gl_FragDepthEXT";t.compilationString+="".concat(p," = log2(").concat(h,") * ").concat(d,"logarithmicDepthConstant * 0.5;\n")}return t.compilationString+="#if defined(PREPASS)\r\n",t.compilationString+="".concat(a?"fragmentOutputs.fragData0":"gl_FragData[0]"," = ").concat(l,";\r\n"),t.compilationString+="#endif\r\n",this},t.prototype._dumpPropertiesCode=function(){var t=e.prototype._dumpPropertiesCode.call(this);return t+="".concat(this._codeVariableName,".convertToGammaSpace = ").concat(this.convertToGammaSpace,";\n"),(t+="".concat(this._codeVariableName,".convertToLinearSpace = ").concat(this.convertToLinearSpace,";\n"))+"".concat(this._codeVariableName,".useLogarithmicDepth = ").concat(this.useLogarithmicDepth,";\n")},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.convertToGammaSpace=this.convertToGammaSpace,t.convertToLinearSpace=this.convertToLinearSpace,t.useLogarithmicDepth=this.useLogarithmicDepth,t},t.prototype._deserialize=function(t,n,r){var i;e.prototype._deserialize.call(this,t,n,r),this.convertToGammaSpace=!!t.convertToGammaSpace,this.convertToLinearSpace=!!t.convertToLinearSpace,this.useLogarithmicDepth=null!==(i=t.useLogarithmicDepth)&&void 0!==i&&i},(0,f.Cg)([Jp("Use logarithmic depth",0,"PROPERTIES",{embedded:!0})],t.prototype,"useLogarithmicDepth",void 0),(0,f.Cg)([Jp("Color space",5,"ADVANCED",{notifiers:{rebuild:!0},embedded:!0,options:[{label:"No color space",value:xv.NoColorSpace},{label:"Gamma",value:xv.Gamma},{label:"Linear",value:xv.Linear}]})],t.prototype,"colorSpace",null),t}(Cv);(0,h.Y5)("BABYLON.FragmentOutputBlock",Ov),function(e){e[e.Material=0]="Material",e[e.PostProcess=1]="PostProcess",e[e.Particle=2]="Particle",e[e.ProceduralTexture=3]="ProceduralTexture",e[e.GaussianSplatting=4]="GaussianSplatting",e[e.SFE=5]="SFE"}(Rv||(Rv={})),function(e){e[e.World=1]="World",e[e.View=2]="View",e[e.Projection=3]="Projection",e[e.ViewProjection=4]="ViewProjection",e[e.WorldView=5]="WorldView",e[e.WorldViewProjection=6]="WorldViewProjection",e[e.CameraPosition=7]="CameraPosition",e[e.FogColor=8]="FogColor",e[e.DeltaTime=9]="DeltaTime",e[e.CameraParameters=10]="CameraParameters",e[e.MaterialAlpha=11]="MaterialAlpha",e[e.ProjectionInverse=12]="ProjectionInverse"}(Av||(Av={})),function(e){e[e.None=0]="None",e[e.Time=1]="Time",e[e.RealTime=2]="RealTime",e[e.MouseInfo=3]="MouseInfo"}(Iv||(Iv={}));var Mv={position2d:"position",particle_uv:"vUV",particle_color:"vColor",particle_texturemask:"textureMask",particle_positionw:"vPositionW",postprocess_uv:"vUV"},Dv={particle_uv:!0,particle_color:!0,particle_texturemask:!0,particle_positionw:!0,postprocess_uv:!0},Nv={particle_texturemask:!0},Fv={normal:"NORMAL",tangent:"TANGENT",uv:"UV1",uv2:"UV2",uv3:"UV3",uv4:"UV4",uv5:"UV5",uv6:"UV6",uv7:"UV7",uv8:"UV8"},Lv=function(e){function t(t,n,r){void 0===n&&(n=pv.Vertex),void 0===r&&(r=dv.AutoDetect);var i=e.call(this,t,n,!1)||this;return i._mode=3,i._animationType=Iv.None,i._prefix="",i.min=0,i.max=0,i.isBoolean=!1,i.matrixMode=0,i._systemValue=null,i.isConstant=!1,i.groupInInspector="",i.onValueChangedObservable=new l.cP,i.convertToGammaSpace=!1,i.convertToLinearSpace=!1,i._type=r,i.setDefaultValue(),i.registerOutput("output",r),i}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"type",{get:function(){if(this._type===dv.AutoDetect){if(this.isUniform&&null!=this.value){if(!isNaN(this.value))return this._type=dv.Float,this._type;switch(this.value.getClassName()){case"Vector2":return this._type=dv.Vector2,this._type;case"Vector3":return this._type=dv.Vector3,this._type;case"Vector4":return this._type=dv.Vector4,this._type;case"Color3":return this._type=dv.Color3,this._type;case"Color4":return this._type=dv.Color4,this._type;case"Matrix":return this._type=dv.Matrix,this._type}}if(this.isAttribute)switch(this.name){case"splatIndex":return this._type=dv.Float,this._type;case"position":case"normal":case"particle_positionw":case"splatPosition":return this._type=dv.Vector3,this._type;case"uv":case"uv2":case"uv3":case"uv4":case"uv5":case"uv6":case"position2d":case"particle_uv":case"splatScale":case"postprocess_uv":return this._type=dv.Vector2,this._type;case"matricesIndices":case"matricesWeights":case"matricesIndicesExtra":case"matricesWeightsExtra":case"world0":case"world1":case"world2":case"world3":case"tangent":return this._type=dv.Vector4,this._type;case"color":case"instanceColor":case"particle_color":case"particle_texturemask":case"splatColor":return this._type=dv.Color4,this._type}if(this.isSystemValue)switch(this._systemValue){case Av.World:case Av.WorldView:case Av.WorldViewProjection:case Av.View:case Av.ViewProjection:case Av.Projection:case Av.ProjectionInverse:return this._type=dv.Matrix,this._type;case Av.CameraPosition:return this._type=dv.Vector3,this._type;case Av.FogColor:return this._type=dv.Color3,this._type;case Av.DeltaTime:case Av.MaterialAlpha:return this._type=dv.Float,this._type;case Av.CameraParameters:return this._type=dv.Vector4,this._type}}return this._type},enumerable:!1,configurable:!0}),t.prototype.validateBlockName=function(t){return!!this.isAttribute||e.prototype.validateBlockName.call(this,t)},Object.defineProperty(t.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype.setAsAttribute=function(e){return this._mode=1,e&&(this.name=e),this},t.prototype.setAsSystemValue=function(e){return this.systemValue=e,this},Object.defineProperty(t.prototype,"value",{get:function(){return this._storedValue},set:function(e){this.type===dv.Float&&(this.isBoolean?e=e?1:0:this.min!==this.max&&(e=Math.max(this.min,e),e=Math.min(this.max,e))),this._storedValue=e,this._mode=0,this.onValueChangedObservable.notifyObservers(this)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"valueCallback",{get:function(){return this._valueCallback},set:function(e){this._valueCallback=e,this._mode=0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"declarationVariableName",{get:function(){return this._associatedVariableName},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"associatedVariableName",{get:function(){return this._prefix+this._associatedVariableName},set:function(e){this._associatedVariableName=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"animationType",{get:function(){return this._animationType},set:function(e){this._animationType=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isUndefined",{get:function(){return 3===this._mode},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isUniform",{get:function(){return 0===this._mode},set:function(e){this._mode=e?0:3,this.associatedVariableName=""},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAttribute",{get:function(){return 1===this._mode},set:function(e){this._mode=e?1:3,this.associatedVariableName=""},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isVarying",{get:function(){return 2===this._mode},set:function(e){this._mode=e?2:3,this.associatedVariableName=""},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isSystemValue",{get:function(){return null!=this._systemValue},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"systemValue",{get:function(){return this._systemValue},set:function(e){this._mode=0,this.associatedVariableName="",this._systemValue=e},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"InputBlock"},t.prototype.animate=function(e){switch(this._animationType){case Iv.Time:this.type===dv.Float&&(this.value+=.01*e.getAnimationRatio());break;case Iv.RealTime:this.type===dv.Float&&(this.value=(Ut.j.Now-e.getEngine().startTime)/1e3);break;case Iv.MouseInfo:if(this.type===dv.Vector4){var t=e._inputManager._originMouseEvent;if(t){var n=t.offsetX,r=t.offsetY,i=1&t.buttons?1:0,o=2&t.buttons?1:0;this.value=new c.IU(n,r,i,o)}else this.value=new c.IU(0,0,0,0)}}},t.prototype._emitDefine=function(e,t){return void 0===t&&(t=!1),"".concat(t?"#ifndef":"#ifdef"," ").concat(e,"\n")},t.prototype.initialize=function(){this.associatedVariableName=""},t.prototype.setDefaultValue=function(){switch(this.type){case dv.Float:this.value=0;break;case dv.Vector2:this.value=c.I9.Zero();break;case dv.Vector3:this.value=c.Pq.Zero();break;case dv.Vector4:this.value=c.IU.Zero();break;case dv.Color3:this.value=Du.v9.White();break;case dv.Color4:this.value=new Du.ov(1,1,1,1);break;case dv.Matrix:this.value=c.uq.Identity()}},t.prototype._emitConstant=function(e){switch(this.type){case dv.Float:return"".concat(e._emitFloat(this.value));case dv.Vector2:return"vec2(".concat(this.value.x,", ").concat(this.value.y,")");case dv.Vector3:return"vec3(".concat(this.value.x,", ").concat(this.value.y,", ").concat(this.value.z,")");case dv.Vector4:return"vec4(".concat(this.value.x,", ").concat(this.value.y,", ").concat(this.value.z,", ").concat(this.value.w,")");case dv.Color3:return Du.IG.Color3[0].set(this.value.r,this.value.g,this.value.b),this.convertToGammaSpace&&Du.IG.Color3[0].toGammaSpaceToRef(Du.IG.Color3[0],e.sharedData.scene.getEngine().useExactSrgbConversions),this.convertToLinearSpace&&Du.IG.Color3[0].toLinearSpaceToRef(Du.IG.Color3[0],e.sharedData.scene.getEngine().useExactSrgbConversions),"vec3(".concat(Du.IG.Color3[0].r,", ").concat(Du.IG.Color3[0].g,", ").concat(Du.IG.Color3[0].b,")");case dv.Color4:return Du.IG.Color4[0].set(this.value.r,this.value.g,this.value.b,this.value.a),this.convertToGammaSpace&&Du.IG.Color4[0].toGammaSpaceToRef(Du.IG.Color4[0],e.sharedData.scene.getEngine().useExactSrgbConversions),this.convertToLinearSpace&&Du.IG.Color4[0].toLinearSpaceToRef(Du.IG.Color4[0],e.sharedData.scene.getEngine().useExactSrgbConversions),"vec4(".concat(Du.IG.Color4[0].r,", ").concat(Du.IG.Color4[0].g,", ").concat(Du.IG.Color4[0].b,", ").concat(Du.IG.Color4[0].a,")")}return""},Object.defineProperty(t.prototype,"_noContextSwitch",{get:function(){return Dv[this.name]},enumerable:!1,configurable:!0}),t.prototype._emit=function(e){var t;if(this.isUniform){if(this._associatedVariableName||(this._associatedVariableName=e._getFreeVariableName("u_"+this.name)),this.isConstant){if(-1!==e.constants.indexOf(this.associatedVariableName))return;return e.constants.push(this.associatedVariableName),void(e._constantDeclaration+=e._declareOutput(this.output,!0)+" = ".concat(this._emitConstant(e),";\n"))}if(-1!==e.uniforms.indexOf(this.associatedVariableName))return;e._emitUniformFromString(this._associatedVariableName,this.type),1===e.shaderLanguage&&(this._prefix="uniforms.");var n=e.sharedData.hints;if(null!==this._systemValue&&void 0!==this._systemValue)switch(this._systemValue){case Av.WorldView:n.needWorldViewMatrix=!0;break;case Av.WorldViewProjection:n.needWorldViewProjectionMatrix=!0}else this._animationType!==Iv.None&&e.sharedData.animatedInputs.push(this)}else if(this.isAttribute){if(this.associatedVariableName=null!==(t=Mv[this.name])&&void 0!==t?t:this.name,this.target===pv.Vertex&&e._vertexState)return void(Dv[this.name]?Nv[this.name]?(e._emitUniformFromString(this.declarationVariableName,this.type),1===e.shaderLanguage&&(this._prefix="vertexInputs.")):e._emitVaryingFromString(this.declarationVariableName,this.type):this._emit(e._vertexState));var r=-1!==e.attributes.indexOf(this.declarationVariableName);if(r||e.attributes.push(this.declarationVariableName),Dv[this.name])Nv[this.name]?(r||e._emitUniformFromString(this.declarationVariableName,this.type),1===e.shaderLanguage&&(this._prefix="uniforms.")):(r||e._emitVaryingFromString(this.declarationVariableName,this.type),1===e.shaderLanguage&&(this._prefix="fragmentInputs."));else if(1===e.shaderLanguage)r||((i=Fv[this.name])?(e._attributeDeclaration+=this._emitDefine(i),e._attributeDeclaration+="attribute ".concat(this.declarationVariableName,": ").concat(e._getShaderType(this.type),";\n"),e._attributeDeclaration+="#else\n",e._attributeDeclaration+="var ".concat(this.declarationVariableName,": ").concat(e._getShaderType(this.type)," = ").concat(e._getShaderType(this.type),"(0.);\n"),e._attributeDeclaration+="#endif\n"):e._attributeDeclaration+="attribute ".concat(this.declarationVariableName,": ").concat(e._getShaderType(this.type),";\n")),this._prefix="vertexInputs.";else{var i;r||((i=Fv[this.name])?(e._attributeDeclaration+=this._emitDefine(i),e._attributeDeclaration+="attribute ".concat(e._getShaderType(this.type)," ").concat(this.declarationVariableName,";\n"),e._attributeDeclaration+="#else\n",e._attributeDeclaration+="".concat(e._getShaderType(this.type)," ").concat(this.declarationVariableName," = ").concat(e._getShaderType(this.type),"(0.);\n"),e._attributeDeclaration+="#endif\n"):e._attributeDeclaration+="attribute ".concat(e._getShaderType(this.type)," ").concat(this.declarationVariableName,";\n"))}}},t.prototype._transmitWorld=function(e,t,n,r){if(this._systemValue){var i=this._associatedVariableName;switch(this._systemValue){case Av.World:e.setMatrix(i,t);break;case Av.WorldView:e.setMatrix(i,n);break;case Av.WorldViewProjection:e.setMatrix(i,r)}}},t.prototype._transmit=function(e,t,n){if(!this.isAttribute){var r=this._associatedVariableName;if(this._systemValue)switch(this._systemValue){case Av.World:case Av.WorldView:case Av.WorldViewProjection:return;case Av.View:e.setMatrix(r,t.getViewMatrix());break;case Av.Projection:e.setMatrix(r,t.getProjectionMatrix());break;case Av.ProjectionInverse:t.getProjectionMatrix().invertToRef(Du.AA.Matrix[0]),e.setMatrix(r,Du.AA.Matrix[0]);break;case Av.ViewProjection:e.setMatrix(r,t.getTransformMatrix());break;case Av.CameraPosition:t.bindEyePosition(e,r,!0);break;case Av.FogColor:e.setColor3(r,t.fogColor);break;case Av.DeltaTime:e.setFloat(r,t.deltaTime/1e3);break;case Av.CameraParameters:t.activeCamera&&e.setFloat4(r,t.getEngine().hasOriginBottomLeft?-1:1,t.activeCamera.minZ,t.activeCamera.maxZ,1/t.activeCamera.maxZ);break;case Av.MaterialAlpha:e.setFloat(r,n.alpha)}else{var i=this._valueCallback?this._valueCallback():this._storedValue;if(null!==i)switch(this.type){case dv.Float:e.setFloat(r,i);break;case dv.Int:e.setInt(r,i);break;case dv.Color3:Du.IG.Color3[0].set(this.value.r,this.value.g,this.value.b),this.convertToGammaSpace&&Du.IG.Color3[0].toGammaSpaceToRef(Du.IG.Color3[0],t.getEngine().useExactSrgbConversions),this.convertToLinearSpace&&Du.IG.Color3[0].toLinearSpaceToRef(Du.IG.Color3[0],t.getEngine().useExactSrgbConversions),e.setColor3(r,Du.IG.Color3[0]);break;case dv.Color4:Du.IG.Color4[0].set(this.value.r,this.value.g,this.value.b,this.value.a),this.convertToGammaSpace&&Du.IG.Color4[0].toGammaSpaceToRef(Du.IG.Color4[0],t.getEngine().useExactSrgbConversions),this.convertToLinearSpace&&Du.IG.Color4[0].toLinearSpaceToRef(Du.IG.Color4[0],t.getEngine().useExactSrgbConversions),e.setDirectColor4(r,Du.IG.Color4[0]);break;case dv.Vector2:e.setVector2(r,i);break;case dv.Vector3:e.setVector3(r,i);break;case dv.Vector4:e.setVector4(r,i);break;case dv.Matrix:e.setMatrix(r,i)}}}},t.prototype._buildBlock=function(t){e.prototype._buildBlock.call(this,t),(this.isUniform||this.isSystemValue)&&t.sharedData.inputBlocks.push(this),this._emit(t)},t.prototype._dumpPropertiesCode=function(){var t=this._codeVariableName;if(this.isAttribute)return e.prototype._dumpPropertiesCode.call(this)+"".concat(t,'.setAsAttribute("').concat(this.name,'");\n');if(this.isSystemValue)return e.prototype._dumpPropertiesCode.call(this)+"".concat(t,".setAsSystemValue(BABYLON.NodeMaterialSystemValues.").concat(Av[this._systemValue],");\n");if(this.isUniform){var n=[],r="";switch(this.type){case dv.Float:r="".concat(this.value);break;case dv.Vector2:r="new BABYLON.Vector2(".concat(this.value.x,", ").concat(this.value.y,")");break;case dv.Vector3:r="new BABYLON.Vector3(".concat(this.value.x,", ").concat(this.value.y,", ").concat(this.value.z,")");break;case dv.Vector4:r="new BABYLON.Vector4(".concat(this.value.x,", ").concat(this.value.y,", ").concat(this.value.z,", ").concat(this.value.w,")");break;case dv.Color3:r="new BABYLON.Color3(".concat(this.value.r,", ").concat(this.value.g,", ").concat(this.value.b,")"),this.convertToGammaSpace&&(r+=".toGammaSpace()"),this.convertToLinearSpace&&(r+=".toLinearSpace()");break;case dv.Color4:r="new BABYLON.Color4(".concat(this.value.r,", ").concat(this.value.g,", ").concat(this.value.b,", ").concat(this.value.a,")"),this.convertToGammaSpace&&(r+=".toGammaSpace()"),this.convertToLinearSpace&&(r+=".toLinearSpace()");break;case dv.Matrix:r="BABYLON.Matrix.FromArray([".concat(this.value.m.join(", "),"])")}return n.push("".concat(t,".value = ").concat(r)),this.type===dv.Float&&n.push("".concat(t,".min = ").concat(this.min),"".concat(t,".max = ").concat(this.max),"".concat(t,".isBoolean = ").concat(this.isBoolean),"".concat(t,".matrixMode = ").concat(this.matrixMode),"".concat(t,".animationType = BABYLON.AnimatedInputBlockTypes.").concat(Iv[this.animationType])),n.push("".concat(t,".isConstant = ").concat(this.isConstant)),n.push(""),e.prototype._dumpPropertiesCode.call(this)+n.join(";\n")}return e.prototype._dumpPropertiesCode.call(this)},t.prototype.dispose=function(){this.onValueChangedObservable.clear(),e.prototype.dispose.call(this)},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.type=this.type,t.mode=this._mode,t.systemValue=this._systemValue,t.animationType=this._animationType,t.min=this.min,t.max=this.max,t.isBoolean=this.isBoolean,t.matrixMode=this.matrixMode,t.isConstant=this.isConstant,t.groupInInspector=this.groupInInspector,t.convertToGammaSpace=this.convertToGammaSpace,t.convertToLinearSpace=this.convertToLinearSpace,null!=this._storedValue&&0===this._mode&&(this._storedValue.asArray?(t.valueType="BABYLON."+this._storedValue.getClassName(),t.value=this._storedValue.asArray()):(t.valueType="number",t.value=this._storedValue)),t},t.prototype._deserialize=function(t,n,r){if(this._mode=t.mode,e.prototype._deserialize.call(this,t,n,r),this._type=t.type,this._systemValue=t.systemValue||t.wellKnownValue,this._animationType=t.animationType,this.min=t.min||0,this.max=t.max||0,this.isBoolean=!!t.isBoolean,this.matrixMode=t.matrixMode||0,this.isConstant=!!t.isConstant,this.groupInInspector=t.groupInInspector||"",this.convertToGammaSpace=!!t.convertToGammaSpace,this.convertToLinearSpace=!!t.convertToLinearSpace,"tangent"===t.name&&1===t.mode&&t.type===dv.Vector3&&(this._type=dv.Vector4),t.valueType)if("number"===t.valueType)this._storedValue=t.value;else{var i=(0,h.n9)(t.valueType);i&&(this._storedValue=i.FromArray(t.value))}},t}(Cv);(0,h.Y5)("BABYLON.InputBlock",Lv);var wv=function(e){function t(t){var n=e.call(this,t,pv.Fragment)||this;return n.registerOutput("xy",dv.Vector2,pv.Fragment),n.registerOutput("x",dv.Float,pv.Fragment),n.registerOutput("y",dv.Float,pv.Fragment),n}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"associatedVariableName",{get:function(){return this._varName},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"ScreenSizeBlock"},Object.defineProperty(t.prototype,"xy",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"x",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"y",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),t.prototype.bind=function(e){var t=this._scene.getEngine();e.setFloat2(this._varName,t.getRenderWidth(),t.getRenderHeight())},t.prototype.writeOutputs=function(e,t){for(var n="",r=0,i=this._outputs;r1&&"_"===t[1]&&(t=t.substring(2)),t.replace(/[^a-zA-Z]+/g,"")}},t.prototype._generateInputBlockAnnotation=function(e){var t=e.valueCallback?e.valueCallback():e.value;return'// { "default": '.concat(JSON.stringify(t)," }\n")},t.prototype._generateScreenSizeBlockAnnotation=function(){return'// { "autoBind": "outputResolution" }\n'},t.prototype._getMainUvName=function(e){var t=e.sharedData.nodeMaterial.getInputBlockByPredicate((function(e){return e.isAttribute&&"postprocess_uv"===e.name}));return t&&t.isAnAncestorOf(this)?t.associatedVariableName:""},t.prototype._getOutputString=function(){return"outColor"},t.prototype._buildBlock=function(t){e.prototype._buildBlock.call(this,t);var n=this._getOutputString();return t._customEntryHeader+="#ifdef ".concat(Bv,"\n"),t._customEntryHeader+="vec4 nmeMain(vec2 ".concat(this._getMainUvName(t),") { // main\n"),t._customEntryHeader+="#else\n",t._customEntryHeader+="void main(void) {\n",t._customEntryHeader+="#endif\n",t._customEntryHeader+="vec4 ".concat(n," = vec4(0.0);\n"),t.compilationString+="\n#ifndef ".concat(Bv,"\n"),t.compilationString+="gl_FragColor = ".concat(n,";\n"),t.compilationString+="#else\n",t.compilationString+="return ".concat(n,";\n"),t.compilationString+="#endif\n",this},t}(Ov);(0,h.Y5)("BABYLON.SmartFilterFragmentOutputBlock",Vv);var Uv=function(e){function t(t){var n=e.call(this,t,pv.Neutral)||this;return n.complementW=1,n.complementZ=0,n.target=pv.Vertex,n.registerInput("vector",dv.AutoDetect),n.registerInput("transform",dv.Matrix),n.registerOutput("output",dv.Vector4),n.registerOutput("xyz",dv.Vector3),n._inputs[0].onConnectionObservable.add((function(e){if(e.ownerBlock.isInput){var t=e.ownerBlock;"normal"!==t.name&&"tangent"!==t.name||(n.complementW=0)}})),n}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"transformAsDirection",{get:function(){return 0===this.complementW},set:function(e){this.complementW=e?0:1},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"TransformBlock"},Object.defineProperty(t.prototype,"vector",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"xyz",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"transform",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(t){e.prototype._buildBlock.call(this,t);var n=this.vector,r=this.transform,i=t._getShaderType(dv.Vector4),o=t._getShaderType(dv.Vector3);if(n.connectedPoint){if(0===this.complementW||this.transformAsDirection){var a="//".concat(this.name);t._emitFunctionFromInclude("helperFunctions",a),t.sharedData.blocksWithDefines.push(this);var s=t._getFreeVariableName("".concat(r.associatedVariableName,"_NUS"));switch(1===t.shaderLanguage?t.compilationString+="var ".concat(s,": mat3x3f = mat3x3f(").concat(r.associatedVariableName,"[0].xyz, ").concat(r.associatedVariableName,"[1].xyz, ").concat(r.associatedVariableName,"[2].xyz);\n"):t.compilationString+="mat3 ".concat(s," = mat3(").concat(r.associatedVariableName,");\n"),t.compilationString+="#ifdef NONUNIFORMSCALING\n",t.compilationString+="".concat(s," = transposeMat3(inverseMat3(").concat(s,"));\n"),t.compilationString+="#endif\n",n.connectedPoint.type){case dv.Vector2:t.compilationString+=t._declareOutput(this.output)+" = ".concat(i,"(").concat(s," * ").concat(o,"(").concat(n.associatedVariableName,", ").concat(this._writeFloat(this.complementZ),"), ").concat(this._writeFloat(this.complementW),");\n");break;case dv.Vector3:case dv.Color3:t.compilationString+=t._declareOutput(this.output)+" = ".concat(i,"(").concat(s," * ").concat(n.associatedVariableName,", ").concat(this._writeFloat(this.complementW),");\n");break;default:t.compilationString+=t._declareOutput(this.output)+" = ".concat(i,"(").concat(s," * ").concat(n.associatedVariableName,".xyz, ").concat(this._writeFloat(this.complementW),");\n")}}else switch(s=r.associatedVariableName,n.connectedPoint.type){case dv.Vector2:t.compilationString+=t._declareOutput(this.output)+" = ".concat(s," * ").concat(i,"(").concat(n.associatedVariableName,", ").concat(this._writeFloat(this.complementZ),", ").concat(this._writeFloat(this.complementW),");\n");break;case dv.Vector3:case dv.Color3:t.compilationString+=t._declareOutput(this.output)+" = ".concat(s," * ").concat(i,"(").concat(n.associatedVariableName,", ").concat(this._writeFloat(this.complementW),");\n");break;default:t.compilationString+=t._declareOutput(this.output)+" = ".concat(s," * ").concat(n.associatedVariableName,";\n")}this.xyz.hasEndpoints&&(t.compilationString+=t._declareOutput(this.xyz)+" = ".concat(this.output.associatedVariableName,".xyz;\n"))}return this},t.prototype.prepareDefines=function(e,t,n){n&&n.nonUniformScaling&&e.setValue("NONUNIFORMSCALING",!0)},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.complementZ=this.complementZ,t.complementW=this.complementW,t},t.prototype._deserialize=function(t,n,r){e.prototype._deserialize.call(this,t,n,r),this.complementZ=void 0!==t.complementZ?t.complementZ:0,this.complementW=void 0!==t.complementW?t.complementW:1},t.prototype._dumpPropertiesCode=function(){return e.prototype._dumpPropertiesCode.call(this)+"".concat(this._codeVariableName,".complementZ = ").concat(this.complementZ,";\n")+"".concat(this._codeVariableName,".complementW = ").concat(this.complementW,";\n")},(0,f.Cg)([Jp("Transform as direction",0,void 0,{embedded:!0})],t.prototype,"transformAsDirection",null),t}(Cv);(0,h.Y5)("BABYLON.TransformBlock",Uv);var Gv=function(e){function t(t){var n=e.call(this,t,pv.Vertex,!0)||this;return n.registerInput("vector",dv.Vector4),n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"VertexOutputBlock"},Object.defineProperty(t.prototype,"vector",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),t.prototype._isLogarithmicDepthEnabled=function(e,t){if(t)return!0;for(var n=0,r=e;n0||this._emitRateGradients&&this._emitRateGradients.length>0||this._lifeTimeGradients&&this._lifeTimeGradients.length>0},e.prototype._setEngineBasedOnBlendMode=function(t){switch(t){case e.BLENDMODE_MULTIPLYADD:return;case e.BLENDMODE_ADD:t=b.Y.ALPHA_ADD;break;case e.BLENDMODE_ONEONE:t=b.Y.ALPHA_ONEONE;break;case e.BLENDMODE_STANDARD:t=b.Y.ALPHA_COMBINE;break;case e.BLENDMODE_MULTIPLY:t=b.Y.ALPHA_MULTIPLY;break;case e.BLENDMODE_SUBTRACT:t=b.Y.ALPHA_SUBTRACT}this._engine.setAlphaMode(t)},e.prototype.getDragGradients=function(){return this._dragGradients},e.prototype.getLimitVelocityGradients=function(){return this._limitVelocityGradients},e.prototype.getColorGradients=function(){return this._colorGradients},e.prototype.getSizeGradients=function(){return this._sizeGradients},e.prototype.getColorRemapGradients=function(){return this._colorRemapGradients},e.prototype.getAlphaRemapGradients=function(){return this._alphaRemapGradients},e.prototype.getLifeTimeGradients=function(){return this._lifeTimeGradients},e.prototype.getAngularSpeedGradients=function(){return this._angularSpeedGradients},e.prototype.getVelocityGradients=function(){return this._velocityGradients},e.prototype.getStartSizeGradients=function(){return this._startSizeGradients},e.prototype.getEmitRateGradients=function(){return this._emitRateGradients},Object.defineProperty(e.prototype,"direction1",{get:function(){return this.particleEmitterType.direction1?this.particleEmitterType.direction1:c.Pq.Zero()},set:function(e){this.particleEmitterType.direction1&&(this.particleEmitterType.direction1=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"direction2",{get:function(){return this.particleEmitterType.direction2?this.particleEmitterType.direction2:c.Pq.Zero()},set:function(e){this.particleEmitterType.direction2&&(this.particleEmitterType.direction2=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"minEmitBox",{get:function(){return this.particleEmitterType.minEmitBox?this.particleEmitterType.minEmitBox:c.Pq.Zero()},set:function(e){this.particleEmitterType.minEmitBox&&(this.particleEmitterType.minEmitBox=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxEmitBox",{get:function(){return this.particleEmitterType.maxEmitBox?this.particleEmitterType.maxEmitBox:c.Pq.Zero()},set:function(e){this.particleEmitterType.maxEmitBox&&(this.particleEmitterType.maxEmitBox=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"billboardMode",{get:function(){return this._billboardMode},set:function(e){this._billboardMode!==e&&(this._billboardMode=e,this._reset())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isBillboardBased",{get:function(){return this._isBillboardBased},set:function(e){this._isBillboardBased!==e&&(this._isBillboardBased=e,this._reset())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"imageProcessingConfiguration",{get:function(){return this._imageProcessingConfiguration},set:function(e){this._attachImageProcessingConfiguration(e)},enumerable:!1,configurable:!0}),e.prototype._attachImageProcessingConfiguration=function(e){e!==this._imageProcessingConfiguration&&(!e&&this._scene?this._imageProcessingConfiguration=this._scene.imageProcessingConfiguration:this._imageProcessingConfiguration=e)},e.prototype._reset=function(){},e.prototype._removeGradientAndTexture=function(e,t,n){if(!t)return this;for(var r=0,i=0,o=t;i0);for(var e=0;e0)}},e}(),$v=function(e){function t(t,n,r,i,o,a,s,c){var u,h;void 0===o&&(o=null),void 0===a&&(a=!0),void 0===s&&(s=!1),void 0===c&&(c=b.Y.TEXTURETYPE_UNSIGNED_BYTE);var d=e.call(this,null,i,!a)||this;d.isEnabled=!0,d.autoClear=!0,d.onGeneratedObservable=new l.cP,d.onBeforeGenerationObservable=new l.cP,d.nodeMaterialSource=null,d.defines="",d._textures={},d._currentRefreshId=-1,d._frameId=-1,d._refreshRate=1,d._vertexBuffers={},d._uniforms=new Array,d._samplers=new Array,d._floats={},d._ints={},d._floatsArrays={},d._colors3={},d._colors4={},d._vectors2={},d._vectors3={},d._vectors4={},d._matrices={},d._fallbackTextureUsed=!1,d._cachedDefines=null,d._contentUpdateId=-1,d._rtWrapper=null,null===o||o instanceof _n.g?(d._options={},d._fallbackTexture=o):(d._options=o,d._fallbackTexture=null!==(u=o.fallbackTexture)&&void 0!==u?u:null),d._shaderLanguage=null!==(h=d._options.shaderLanguage)&&void 0!==h?h:0;var p=(i=d.getScene()||M.q.LastCreatedScene)._getComponent(Ue.v.NAME_PROCEDURALTEXTURE);p||(p=new Jv(i),i._addComponent(p)),i.proceduralTextures.push(d),d._fullEngine=i.getEngine(),d.name=t,d.isRenderTarget=!0,d._size=n,d._textureType=c,d._generateMipMaps=a,d._drawWrapper=new fe.E(d._fullEngine),d.setFragment(r);var f=d._createRtWrapper(s,n,a,c);d._texture=f.texture;var m=[];return m.push(1,1),m.push(-1,1),m.push(-1,-1),m.push(1,-1),d._vertexBuffers[se.R.PositionKind]=new se.R(d._fullEngine,m,se.R.PositionKind,!1,!1,2),d._createIndexBuffer(),d}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"shaderLanguage",{get:function(){return this._shaderLanguage},enumerable:!1,configurable:!0}),t.prototype._createRtWrapper=function(e,t,n,r){return e?(this._rtWrapper=this._fullEngine.createRenderTargetCubeTexture(t,(0,f.Cl)({generateMipMaps:n,generateDepthBuffer:!1,generateStencilBuffer:!1,type:r},this._options)),this.setFloat("face",0)):(this._rtWrapper=this._fullEngine.createRenderTargetTexture(t,(0,f.Cl)({generateMipMaps:n,generateDepthBuffer:!1,generateStencilBuffer:!1,type:r},this._options)),this._rtWrapper.is3D&&(this.setFloat("layer",0),this.setInt("layerNum",0))),this._rtWrapper},t.prototype.getEffect=function(){return this._drawWrapper.effect},t.prototype._setEffect=function(e){this._drawWrapper.effect=e},t.prototype.getContent=function(){var e=this;return this._contentData&&this._frameId===this._contentUpdateId||(this._contentData?this._contentData.then((function(t){e._contentData=e.readPixels(0,0,t),e._contentUpdateId=e._frameId})):(this._contentData=this.readPixels(0,0),this._contentUpdateId=this._frameId)),this._contentData},t.prototype._createIndexBuffer=function(){var e=this._fullEngine,t=[];t.push(0),t.push(1),t.push(2),t.push(0),t.push(2),t.push(3),this._indexBuffer=e.createIndexBuffer(t)},t.prototype._rebuild=function(){var e=this._vertexBuffers[se.R.PositionKind];e&&e._rebuild(),this._createIndexBuffer(),this.refreshRate===Ji.$.REFRESHRATE_RENDER_ONCE&&(this.refreshRate=Ji.$.REFRESHRATE_RENDER_ONCE)},t.prototype.reset=function(){var e;null===(e=this._drawWrapper.effect)||void 0===e||e.dispose(),this._drawWrapper.effect=null,this._cachedDefines=null},t.prototype._getDefines=function(){return this.defines},t.prototype.executeWhenReady=function(e){var t=this;if(this.isReady())e(this);else{var n=this.getEffect();n&&n.executeWhenCompiled((function(){e(t)}))}},t.prototype.isReady=function(){var e=this,t=this._fullEngine;if(this.nodeMaterialSource)return this._drawWrapper.effect.isReady();if(!this._fragment)return!1;if(this._fallbackTextureUsed)return!0;if(!this._texture)return!1;var r=this._getDefines();if(this._drawWrapper.effect&&r===this._cachedDefines&&this._drawWrapper.effect.isReady())return!0;var i={vertex:"procedural",fragmentElement:this._fragment.fragmentElement,fragmentSource:this._fragment.fragmentSource,fragment:"string"==typeof this._fragment?this._fragment:void 0};return this._cachedDefines!==r&&(this._cachedDefines=r,this._drawWrapper.effect=t.createEffect(i,[se.R.PositionKind],this._uniforms,this._samplers,r,void 0,void 0,(function(){var t;null===(t=e._rtWrapper)||void 0===t||t.dispose(),e._rtWrapper=e._texture=null,e._fallbackTexture&&(e._texture=e._fallbackTexture._texture,e._texture&&e._texture.incrementReferences()),e._fallbackTextureUsed=!0}),void 0,this._shaderLanguage,(function(){return(0,f.sH)(e,void 0,void 0,(function(){return(0,f.YH)(this,(function(e){switch(e.label){case 0:return this._options.extraInitializationsAsync?1!==this.shaderLanguage?[3,2]:[4,Promise.all([Promise.resolve().then(n.bind(n,67400)),this._options.extraInitializationsAsync()])]:[3,5];case 1:return e.sent(),[3,4];case 2:return[4,Promise.all([Promise.resolve().then(n.bind(n,6777)),this._options.extraInitializationsAsync()])];case 3:e.sent(),e.label=4;case 4:return[3,9];case 5:return 1!==this.shaderLanguage?[3,7]:[4,Promise.resolve().then(n.bind(n,67400))];case 6:return e.sent(),[3,9];case 7:return[4,Promise.resolve().then(n.bind(n,6777))];case 8:e.sent(),e.label=9;case 9:return[2]}}))}))}))),this._drawWrapper.effect.isReady()},t.prototype.resetRefreshCounter=function(){this._currentRefreshId=-1},t.prototype.setFragment=function(e){this._fragment=e},Object.defineProperty(t.prototype,"refreshRate",{get:function(){return this._refreshRate},set:function(e){this._refreshRate=e,this.resetRefreshCounter()},enumerable:!1,configurable:!0}),t.prototype._shouldRender=function(){return this.isEnabled&&this.isReady()&&this._texture?!this._fallbackTextureUsed&&(-1===this._currentRefreshId||this.refreshRate===this._currentRefreshId?(this._currentRefreshId=1,this._frameId++,!0):(this._currentRefreshId++,!1)):(this._texture&&(this._texture.isReady=!1),!1)},t.prototype.getRenderSize=function(){return this._size},t.prototype.resize=function(e,t){if(!this._fallbackTextureUsed&&this._rtWrapper&&this._texture){var n=this._texture.isCube;this._rtWrapper.dispose();var r=this._createRtWrapper(n,e,t,this._textureType);this._texture=r.texture,this._size=e,this._generateMipMaps=t}},t.prototype._checkUniform=function(e){-1===this._uniforms.indexOf(e)&&this._uniforms.push(e)},t.prototype.setTexture=function(e,t){return-1===this._samplers.indexOf(e)&&this._samplers.push(e),this._textures[e]=t,this},t.prototype.setFloat=function(e,t){return this._checkUniform(e),this._floats[e]=t,this},t.prototype.setInt=function(e,t){return this._checkUniform(e),this._ints[e]=t,this},t.prototype.setFloats=function(e,t){return this._checkUniform(e),this._floatsArrays[e]=t,this},t.prototype.setColor3=function(e,t){return this._checkUniform(e),this._colors3[e]=t,this},t.prototype.setColor4=function(e,t){return this._checkUniform(e),this._colors4[e]=t,this},t.prototype.setVector2=function(e,t){return this._checkUniform(e),this._vectors2[e]=t,this},t.prototype.setVector3=function(e,t){return this._checkUniform(e),this._vectors3[e]=t,this},t.prototype.setVector4=function(e,t){return this._checkUniform(e),this._vectors4[e]=t,this},t.prototype.setMatrix=function(e,t){return this._checkUniform(e),this._matrices[e]=t,this},t.prototype.render=function(e){var t,n,r,i,o=this.getScene();if(o){var a=this._fullEngine;if(a.enableEffect(this._drawWrapper),this.onBeforeGenerationObservable.notifyObservers(this),a.setState(!1),!this.nodeMaterialSource){for(var s in this._textures)this._drawWrapper.effect.setTexture(s,this._textures[s]);for(var l in this._ints)this._drawWrapper.effect.setInt(l,this._ints[l]);for(var c in this._floats)this._drawWrapper.effect.setFloat(c,this._floats[c]);for(var u in this._floatsArrays)this._drawWrapper.effect.setArray(u,this._floatsArrays[u]);for(var h in this._colors3)this._drawWrapper.effect.setColor3(h,this._colors3[h]);for(var d in this._colors4){var p=this._colors4[d];this._drawWrapper.effect.setFloat4(d,p.r,p.g,p.b,p.a)}for(var f in this._vectors2)this._drawWrapper.effect.setVector2(f,this._vectors2[f]);for(var m in this._vectors3)this._drawWrapper.effect.setVector3(m,this._vectors3[m]);for(var _ in this._vectors4)this._drawWrapper.effect.setVector4(_,this._vectors4[_]);for(var g in this._matrices)this._drawWrapper.effect.setMatrix(g,this._matrices[g])}if(this._texture&&this._rtWrapper){null===(t=a._debugPushGroup)||void 0===t||t.call(a,"procedural texture generation for ".concat(this.name),1);var v=a.currentViewport;if(this.isCube)for(var y=0;y<6;y++)a.bindFramebuffer(this._rtWrapper,y,void 0,void 0,!0),a.bindBuffers(this._vertexBuffers,this._indexBuffer,this._drawWrapper.effect),this._drawWrapper.effect.setFloat("face",y),this.autoClear&&a.clear(o.clearColor,!0,!1,!1),a.drawElementsType(Be.TriangleFillMode,0,6),a.unBindFramebuffer(this._rtWrapper,!0);else{var b=1;this._rtWrapper.is3D?b=this._rtWrapper.depth:this._rtWrapper.is2DArray&&(b=this._rtWrapper.layers);for(var S=0;S=0&&t.proceduralTextures.splice(n,1);var r=this._vertexBuffers[se.R.PositionKind];r&&(r.dispose(),this._vertexBuffers[se.R.PositionKind]=null),this._indexBuffer&&this._fullEngine._releaseBuffer(this._indexBuffer)&&(this._indexBuffer=null),this.onGeneratedObservable.clear(),this.onBeforeGenerationObservable.clear(),e.prototype.dispose.call(this)}},(0,f.Cg)([(0,ce.lK)()],t.prototype,"isEnabled",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"autoClear",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"_generateMipMaps",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"_size",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"refreshRate",null),t}(_n.g);(0,h.Y5)("BABYLON.ProceduralTexture",$v),function(e){e[e.Cos=0]="Cos",e[e.Sin=1]="Sin",e[e.Abs=2]="Abs",e[e.Exp=3]="Exp",e[e.Exp2=4]="Exp2",e[e.Round=5]="Round",e[e.Floor=6]="Floor",e[e.Ceiling=7]="Ceiling",e[e.Sqrt=8]="Sqrt",e[e.Log=9]="Log",e[e.Tan=10]="Tan",e[e.ArcTan=11]="ArcTan",e[e.ArcCos=12]="ArcCos",e[e.ArcSin=13]="ArcSin",e[e.Fract=14]="Fract",e[e.Sign=15]="Sign",e[e.Radians=16]="Radians",e[e.Degrees=17]="Degrees",e[e.Set=18]="Set"}(Qv||(Qv={}));var ey=function(e){function t(t){var n=e.call(this,t,pv.Neutral)||this;return n.operation=Qv.Cos,n.registerInput("input",dv.AutoDetect),n.registerOutput("output",dv.BasedOnInput),n._outputs[0]._typeConnectionSource=n._inputs[0],n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"TrigonometryBlock"},Object.defineProperty(t.prototype,"input",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(t){e.prototype._buildBlock.call(this,t);var n=this._outputs[0],r="";switch(this.operation){case Qv.Cos:r="cos";break;case Qv.Sin:r="sin";break;case Qv.Abs:r="abs";break;case Qv.Exp:r="exp";break;case Qv.Exp2:r="exp2";break;case Qv.Round:r="round";break;case Qv.Floor:r="floor";break;case Qv.Ceiling:r="ceil";break;case Qv.Sqrt:r="sqrt";break;case Qv.Log:r="log";break;case Qv.Tan:r="tan";break;case Qv.ArcTan:r="atan";break;case Qv.ArcCos:r="acos";break;case Qv.ArcSin:r="asin";break;case Qv.Fract:r="fract";break;case Qv.Sign:r="sign";break;case Qv.Radians:r="radians";break;case Qv.Degrees:r="degrees";break;case Qv.Set:r=""}return t.compilationString+=t._declareOutput(n)+" = ".concat(r,"(").concat(this.input.associatedVariableName,");\n"),this},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.operation=this.operation,t},t.prototype._deserialize=function(t,n,r){e.prototype._deserialize.call(this,t,n,r),this.operation=t.operation},t.prototype._dumpPropertiesCode=function(){return e.prototype._dumpPropertiesCode.call(this)+"".concat(this._codeVariableName,".operation = BABYLON.TrigonometryBlockOperations.").concat(Qv[this.operation],";\n")},(0,f.Cg)([Jp("Operation",5,"ADVANCED",{notifiers:{rebuild:!0},embedded:!0,options:[{label:"Cos",value:Qv.Cos},{label:"Sin",value:Qv.Sin},{label:"Abs",value:Qv.Abs},{label:"Exp",value:Qv.Exp},{label:"Exp2",value:Qv.Exp2},{label:"Round",value:Qv.Round},{label:"Floor",value:Qv.Floor},{label:"Ceiling",value:Qv.Ceiling},{label:"Sqrt",value:Qv.Sqrt},{label:"Log",value:Qv.Log},{label:"Tan",value:Qv.Tan},{label:"ArcTan",value:Qv.ArcTan},{label:"ArcCos",value:Qv.ArcCos},{label:"ArcSin",value:Qv.ArcSin},{label:"Fract",value:Qv.Fract},{label:"Sign",value:Qv.Sign},{label:"Radians",value:Qv.Radians},{label:"Degrees",value:Qv.Degrees},{label:"Set",value:Qv.Set}]})],t.prototype,"operation",void 0),t}(Cv);(0,h.Y5)("BABYLON.TrigonometryBlock",ey);var ty,ny,ry={effect:null,subMesh:null},iy=function(e){function t(){var t=e.call(this)||this;return t.NORMAL=!1,t.TANGENT=!1,t.VERTEXCOLOR_NME=!1,t.PREPASS=!1,t.PREPASS_NORMAL=!1,t.PREPASS_NORMAL_INDEX=-1,t.PREPASS_WORLD_NORMAL=!1,t.PREPASS_WORLD_NORMAL_INDEX=-1,t.PREPASS_POSITION=!1,t.PREPASS_POSITION_INDEX=-1,t.PREPASS_LOCAL_POSITION=!1,t.PREPASS_LOCAL_POSITION_INDEX=-1,t.PREPASS_DEPTH=!1,t.PREPASS_DEPTH_INDEX=-1,t.PREPASS_SCREENSPACE_DEPTH=!1,t.PREPASS_SCREENSPACE_DEPTH_INDEX=-1,t.SCENE_MRT_COUNT=0,t.NUM_BONE_INFLUENCERS=0,t.BonesPerMesh=0,t.BONETEXTURE=!1,t.MORPHTARGETS=!1,t.MORPHTARGETS_POSITION=!1,t.MORPHTARGETS_NORMAL=!1,t.MORPHTARGETS_TANGENT=!1,t.MORPHTARGETS_UV=!1,t.MORPHTARGETS_UV2=!1,t.MORPHTARGETS_COLOR=!1,t.MORPHTARGETTEXTURE_HASPOSITIONS=!1,t.MORPHTARGETTEXTURE_HASNORMALS=!1,t.MORPHTARGETTEXTURE_HASTANGENTS=!1,t.MORPHTARGETTEXTURE_HASUVS=!1,t.MORPHTARGETTEXTURE_HASUV2S=!1,t.MORPHTARGETTEXTURE_HASCOLORS=!1,t.NUM_MORPH_INFLUENCERS=0,t.MORPHTARGETS_TEXTURE=!1,t.BUMPDIRECTUV=0,t.CAMERA_ORTHOGRAPHIC=!1,t.CAMERA_PERSPECTIVE=!1,t.AREALIGHTSUPPORTED=!0,t.AREALIGHTNOROUGHTNESS=!0,t.rebuild(),t}return(0,f.C6)(t,e),t.prototype.setValue=function(e,t,n){void 0===n&&(n=!1),void 0===this[e]&&this._keys.push(e),n&&this[e]!==t&&this.markAsUnprocessed(),this[e]=t},t}(po(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,f.C6)(t,e),t}(No(ho)))),oy=function(e){function t(n,r,i){void 0===i&&(i={});var o=e.call(this,n,r||M.q.LastCreatedScene)||this;if(o._buildId=t._BuildIdGenerator++,o._buildWasSuccessful=!1,o._cachedWorldViewMatrix=new c.uq,o._cachedWorldViewProjectionMatrix=new c.uq,o._optimizers=new Array,o._animationFrame=-1,o._buildIsInProgress=!1,o.BJSNODEMATERIALEDITOR=o._getGlobalNodeMaterialEditor(),o._useAdditionalColor=!1,o.editorData=null,o.ignoreAlpha=!1,o.maxSimultaneousLights=4,o.onBuildObservable=new l.cP,o.onBuildErrorObservable=new l.cP,o._vertexOutputNodes=new Array,o._fragmentOutputNodes=new Array,o.attachedBlocks=[],o._mode=Rv.Material,o.forceAlphaBlending=!1,!t.UseNativeShaderLanguageOfEngine&&i&&1===i.shaderLanguage&&!o.getScene().getEngine().isWebGPU)throw new Error("WebGPU shader language is only supported with WebGPU engine");return o._options=(0,f.Cl)({emitComments:!1,shaderLanguage:t.DefaultShaderLanguage},i),t.UseNativeShaderLanguageOfEngine&&(o._options.shaderLanguage=o.getScene().getEngine().isWebGPU?1:0),o._attachImageProcessingConfiguration(null),o}return(0,f.C6)(t,e),t._BlockIsTextureBlock=function(e){return"TextureBlock"===e.getClassName()||"ReflectionTextureBaseBlock"===e.getClassName()||"ReflectionTextureBlock"===e.getClassName()||"ReflectionBlock"===e.getClassName()||"RefractionBlock"===e.getClassName()||"CurrentScreenBlock"===e.getClassName()||"SmartFilterTextureBlock"===e.getClassName()||"ParticleTextureBlock"===e.getClassName()||"ImageSourceBlock"===e.getClassName()||"TriPlanarBlock"===e.getClassName()||"BiPlanarBlock"===e.getClassName()||"PrePassTextureBlock"===e.getClassName()},Object.defineProperty(t.prototype,"buildIsInProgress",{get:function(){return this._buildIsInProgress},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_glowModeEnabled",{set:function(e){this._useAdditionalColor=e},enumerable:!1,configurable:!0}),t.prototype._getGlobalNodeMaterialEditor=function(){return"undefined"!=typeof NODEEDITOR?NODEEDITOR:"undefined"!=typeof BABYLON&&void 0!==BABYLON.NodeEditor?BABYLON:void 0},Object.defineProperty(t.prototype,"shaderLanguage",{get:function(){var e;return(null===(e=this._options)||void 0===e?void 0:e.shaderLanguage)||t.DefaultShaderLanguage},set:function(e){this._options.shaderLanguage=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"options",{get:function(){return this._options},set:function(e){this._options=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mode",{get:function(){return this._mode},set:function(e){this._mode=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"buildId",{get:function(){return this._buildId},set:function(e){this._buildId=e},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"NodeMaterial"},t.prototype.getBlockByName=function(e){for(var t=null,n=0,r=this.attachedBlocks;n-1))return this._optimizers.push(e),this},t.prototype.unregisterOptimizer=function(e){var t=this._optimizers.indexOf(e);if(-1!==t)return this._optimizers.splice(t,1),this},t.prototype.addOutputNode=function(e){if(null===e.target)throw"This node is not meant to be an output node. You may want to explicitly set its target value.";return 0!==(e.target&pv.Vertex)&&this._addVertexOutputNode(e),0!==(e.target&pv.Fragment)&&this._addFragmentOutputNode(e),this},t.prototype.removeOutputNode=function(e){return null===e.target||(0!==(e.target&pv.Vertex)&&this._removeVertexOutputNode(e),0!==(e.target&pv.Fragment)&&this._removeFragmentOutputNode(e)),this},t.prototype._addVertexOutputNode=function(e){if(-1===this._vertexOutputNodes.indexOf(e))return e.target=pv.Vertex,this._vertexOutputNodes.push(e),this},t.prototype._removeVertexOutputNode=function(e){var t=this._vertexOutputNodes.indexOf(e);if(-1!==t)return this._vertexOutputNodes.splice(t,1),this},t.prototype._addFragmentOutputNode=function(e){if(-1===this._fragmentOutputNodes.indexOf(e))return e.target=pv.Fragment,this._fragmentOutputNodes.push(e),this},t.prototype._removeFragmentOutputNode=function(e){var t=this._fragmentOutputNodes.indexOf(e);if(-1!==t)return this._fragmentOutputNodes.splice(t,1),this},Object.defineProperty(t.prototype,"_supportGlowLayer",{get:function(){return 0!==this._fragmentOutputNodes.length&&!!this._fragmentOutputNodes.some((function(e){return e.additionalColor&&e.additionalColor.isConnected}))},enumerable:!1,configurable:!0}),t.prototype.needAlphaBlending=function(){return!this.ignoreAlpha&&(this.forceAlphaBlending||this.alpha<1||this._sharedData&&this._sharedData.hints.needAlphaBlending)},t.prototype.needAlphaTesting=function(){return this._sharedData&&this._sharedData.hints.needAlphaTesting},t.prototype._processInitializeOnLink=function(e,t,n,r){void 0===r&&(r=!0),(e.target===pv.VertexAndFragment||t.target===pv.Fragment&&e.target===pv.Vertex&&e._preparationId!==this._buildId)&&n.push(e),this._initializeBlock(e,t,n,r)},t.prototype._attachBlock=function(e){if(-1===this.attachedBlocks.indexOf(e)){if(e.isUnique)for(var t=e.getClassName(),n=0,r=this.attachedBlocks;n-1&&this.attachedBlocks.splice(t,1),e.isFinalMerger&&this.removeOutputNode(e)},t.prototype.build=function(e,t,n){var r=this;if(void 0===e&&(e=!1),void 0===t&&(t=!0),void 0===n&&(n=!1),this._buildIsInProgress)y.V.Warn("Build is already in progress, You can use NodeMaterial.onBuildObservable to determine when the build is completed.");else{this._buildIsInProgress=!0,this._vertexCompilationState||n||(n=!0),this._buildWasSuccessful=!1;var i=this.getScene().getEngine(),o=this._mode===Rv.Particle||this._mode===Rv.SFE;if(0===this._vertexOutputNodes.length&&!o)return this.onBuildErrorObservable.notifyObservers("You must define at least one vertexOutputNode"),void(this._buildIsInProgress=!1);if(0===this._fragmentOutputNodes.length)return this.onBuildErrorObservable.notifyObservers("You must define at least one fragmentOutputNode"),void(this._buildIsInProgress=!1);this._vertexCompilationState=new Tv,this._vertexCompilationState.supportUniformBuffers=i.supportsUniformBuffers,this._vertexCompilationState.target=pv.Vertex,this._fragmentCompilationState=new Tv,this._fragmentCompilationState.supportUniformBuffers=i.supportsUniformBuffers,this._fragmentCompilationState.target=pv.Fragment;var a=this._fragmentOutputNodes.filter((function(e){return e._isFinalOutputAndActive})).length>1,s=this._fragmentOutputNodes;a&&(s=this._fragmentOutputNodes.filter((function(e){return!e._isFinalOutputAndActive}))).push(this._fragmentOutputNodes.filter((function(e){return e._isFinalOutputAndActive&&e._hasPrecedence}))[0]),this._sharedData=new Ev,this._sharedData.nodeMaterial=this,this._sharedData.fragmentOutputNodes=s,this._vertexCompilationState.sharedData=this._sharedData,this._fragmentCompilationState.sharedData=this._sharedData,this._sharedData.buildId=this._buildId,this._sharedData.emitComments=this._options.emitComments,this._sharedData.verbose=e,this._sharedData.scene=this.getScene(),this._sharedData.allowEmptyVertexProgram=o;for(var l=[],c=[],u=0,h=this._vertexOutputNodes;u1){var n=e.getEffectConfiguration("nodeMaterial");n||(n=e.addEffectConfiguration({enabled:!0,needsImageProcessing:!1,name:"nodeMaterial",texturesRequired:[]}));for(var r=0,i=t;r1},t.prototype.createPostProcess=function(e,t,n,r,i,o,a){return void 0===t&&(t=1),void 0===n&&(n=b.Y.TEXTURE_NEAREST_SAMPLINGMODE),void 0===o&&(o=b.Y.TEXTURETYPE_UNSIGNED_BYTE),void 0===a&&(a=b.Y.TEXTUREFORMAT_RGBA),this.mode!==Rv.PostProcess&&this.mode!==Rv.SFE?(y.V.Log("Incompatible material mode"),null):this._createEffectForPostProcess(null,e,t,n,r,i,o,a)},t.prototype.createEffectForPostProcess=function(e){this._createEffectForPostProcess(e)},t.prototype._createEffectForPostProcess=function(e,t,n,r,i,o,a,s){var l=this;void 0===n&&(n=1),void 0===r&&(r=b.Y.TEXTURE_NEAREST_SAMPLINGMODE),void 0===a&&(a=b.Y.TEXTURETYPE_UNSIGNED_BYTE),void 0===s&&(s=b.Y.TEXTUREFORMAT_RGBA);var c=this.name+this._buildId,u=new iy,h=this._buildId;this._processDefines(u);var d=this._sharedData.checks.emitVertex?this._vertexCompilationState._builtCompilationString:void 0;return Dl.M.RegisterShader(c,this._fragmentCompilationState._builtCompilationString,d,this.shaderLanguage),e?e.updateEffect(u.toString(),this._fragmentCompilationState.uniforms,this._fragmentCompilationState.samplers,{maxSimultaneousLights:this.maxSimultaneousLights},void 0,void 0,c,c):e=new Ci.w(this.name+"PostProcess",c,this._fragmentCompilationState.uniforms,this._fragmentCompilationState.samplers,n,t,r,i,o,u.toString(),a,d?c:"postprocess",{maxSimultaneousLights:this.maxSimultaneousLights},!1,s,this.shaderLanguage),e.nodeMaterialSource=this,e.onApplyObservable.add((function(t){h!==l._buildId&&(delete Dl.M.ShadersStore[c+"VertexShader"],delete Dl.M.ShadersStore[c+"PixelShader"],c=l.name+l._buildId,u.markAllAsDirty(),h=l._buildId),l._processDefines(u)&&(Dl.M.RegisterShader(c,l._fragmentCompilationState._builtCompilationString,l._vertexCompilationState._builtCompilationString),Lt._.SetImmediate((function(){return e.updateEffect(u.toString(),l._fragmentCompilationState.uniforms,l._fragmentCompilationState.samplers,{maxSimultaneousLights:l.maxSimultaneousLights},void 0,void 0,c,c)}))),l._checkInternals(t)})),e},t.prototype.createProceduralTexture=function(e,t){var n=this;if(this.mode!==Rv.ProceduralTexture)return y.V.Log("Incompatible material mode"),null;var r=this.name+this._buildId,i=new $v(r,e,null,t),o=new iy,a=this._processDefines(o);Dl.M.RegisterShader(r,this._fragmentCompilationState._builtCompilationString,this._vertexCompilationState._builtCompilationString,this.shaderLanguage);var s=this.getScene().getEngine().createEffect({vertexElement:r,fragmentElement:r},[se.R.PositionKind],this._fragmentCompilationState.uniforms,this._fragmentCompilationState.samplers,o.toString(),null==a?void 0:a.fallbacks,void 0,void 0,void 0,this.shaderLanguage);i.nodeMaterialSource=this,i._setEffect(s);var l=this._buildId,c=function(){l!==n._buildId&&(delete Dl.M.ShadersStore[r+"VertexShader"],delete Dl.M.ShadersStore[r+"PixelShader"],r=n.name+n._buildId,o.markAllAsDirty(),l=n._buildId);var e=n._processDefines(o);e&&(Dl.M.RegisterShader(r,n._fragmentCompilationState._builtCompilationString,n._vertexCompilationState._builtCompilationString,n.shaderLanguage),Lt._.SetImmediate((function(){s=n.getScene().getEngine().createEffect({vertexElement:r,fragmentElement:r},[se.R.PositionKind],n._fragmentCompilationState.uniforms,n._fragmentCompilationState.samplers,o.toString(),null==e?void 0:e.fallbacks,void 0),i._setEffect(s)}))),n._checkInternals(s)};return i.onBeforeGenerationObservable.add((function(){c()})),this.onBuildObservable.add((function(){c()})),i},t.prototype._createEffectForParticles=function(e,t,n,r,i,o,a){var s=this;void 0===a&&(a="");var l=this.name+this._buildId+"_"+t;o||(o=new iy);var c=this._buildId,u=[],h=a;if(!i){var d=this._processDefines(o);Dl.M.RegisterShader(l,this._fragmentCompilationState._builtCompilationString,void 0,this.shaderLanguage),e.fillDefines(u,t,!1),h=u.join("\n"),i=this.getScene().getEngine().createEffectForParticles(l,this._fragmentCompilationState.uniforms,this._fragmentCompilationState.samplers,o.toString()+"\n"+h,null==d?void 0:d.fallbacks,n,r,e,this.shaderLanguage),e.setCustomEffect(i,t)}i.onBindObservable.add((function(i){c!==s._buildId&&(delete Dl.M.ShadersStore[l+"PixelShader"],l=s.name+s._buildId+"_"+t,o.markAllAsDirty(),c=s._buildId),u.length=0,e.fillDefines(u,t,!1);var d=u.join("\n");d!==h&&(o.markAllAsDirty(),h=d);var p=s._processDefines(o);if(p)return Dl.M.RegisterShader(l,s._fragmentCompilationState._builtCompilationString,void 0,s.shaderLanguage),i=s.getScene().getEngine().createEffectForParticles(l,s._fragmentCompilationState.uniforms,s._fragmentCompilationState.samplers,o.toString()+"\n"+h,null==p?void 0:p.fallbacks,n,r,e),e.setCustomEffect(i,t),void s._createEffectForParticles(e,t,n,r,i,o,a);s._checkInternals(i)}))},t.prototype._checkInternals=function(e){if(this._sharedData.animatedInputs){var t=this.getScene(),n=t.getFrameId();if(this._animationFrame!==n){for(var r=0,i=this._sharedData.animatedInputs;re.currentAnimationState)switch(e.currentAnimationState){case ty.DEHYDRATED:if(e.hydrateCollisionMeshFunction(!0),t===ty.HOVER)break;case ty.HOVER:if(e.touchCollisionMeshFunction(!0),t===ty.TOUCH)break}else switch(e.currentAnimationState){case ty.TOUCH:if(e.touchCollisionMeshFunction(!1),t===ty.HOVER)break;case ty.HOVER:if(e.hydrateCollisionMeshFunction(!1),t===ty.DEHYDRATED)break}e.currentAnimationState=t}},t.prototype._processTouchPoint=function(e,t,n){var r,i=this._controllers[e];i.grabRay.origin.copyFrom(t),n.toEulerAnglesToRef(c.AA.Vector3[0]),i.grabRay.direction.copyFrom(c.AA.Vector3[0]),2!==this._options.nearInteractionControllerMode||(null===(r=i.xrController)||void 0===r?void 0:r.inputSource.hand)||(i.xrController.getWorldPointerRayToRef(this._tmpRay),i.grabRay.origin.addInPlace(this._tmpRay.direction.scale(.05))),i.grabRay.length=this._nearGrabLengthScale*this._hoverRadius*this._xrSessionManager.worldScalingFactor,i.touchCollisionMesh.position.copyFrom(i.grabRay.origin).scaleInPlace(this._xrSessionManager.worldScalingFactor)},t.prototype._onXRFrame=function(e){for(var t,n=this,r=0,i=Object.keys(this._controllers);ru&&(l=0,s.copyFrom(t.center)),-1!==l&&l.7&&!t.teleportationState.forward&&r.backwardsMovementEnabled&&!r.snapPointsOnly&&!t.teleportationState.backwards){t.teleportationState.backwards=!0,r._tmpQuaternion.copyFrom(r._options.xrInput.xrCamera.rotationQuaternion),r._tmpQuaternion.toEulerAnglesToRef(r._tmpVector),r._tmpVector.x=0,r._tmpVector.z=0,c.PT.FromEulerVectorToRef(r._tmpVector,r._tmpQuaternion),r._tmpVector.set(0,0,r.backwardsTeleportationDistance*(r._xrSessionManager.scene.useRightHandedSystem?1:-1)),r._tmpVector.rotateByQuaternionToRef(r._tmpQuaternion,r._tmpVector),r._tmpVector.addInPlace(r._options.xrInput.xrCamera.position),r._tmpRay.origin.copyFrom(r._tmpVector),r._tmpRay.length=r._options.xrInput.xrCamera.realWorldHeight+.1,r._tmpRay.direction.set(0,-1,0);var i=r._xrSessionManager.scene.pickWithRay(r._tmpRay,(function(e){return-1!==r._floorMeshes.indexOf(e)}));i&&i.pickedPoint&&(r._options.xrInput.xrCamera.position.x=i.pickedPoint.x,r._options.xrInput.xrCamera.position.z=i.pickedPoint.z)}if(n.y<-.7&&!r._currentTeleportationControllerId&&!t.teleportationState.rotating&&r.teleportationEnabled&&(t.teleportationState.forward=!0,r._currentTeleportationControllerId=t.xrController.uniqueId,t.teleportationState.baseRotation=r._options.xrInput.xrCamera.rotationQuaternion.toEulerAngles().y),n.x){if(t.teleportationState.forward)r._currentTeleportationControllerId===t.xrController.uniqueId&&(r.rotationEnabled?setTimeout((function(){t.teleportationState.currentRotation=Math.atan2(n.x,n.y*(r._xrSessionManager.scene.useRightHandedSystem?1:-1))})):t.teleportationState.currentRotation=0);else if(!t.teleportationState.rotating&&Math.abs(n.x)>.7){t.teleportationState.rotating=!0;var o=r.rotationAngle*(n.x>0?1:-1)*(r._xrSessionManager.scene.useRightHandedSystem?-1:1);r.onBeforeCameraTeleportRotation.notifyObservers(o),c.PT.FromEulerAngles(0,o,0).multiplyToRef(r._options.xrInput.xrCamera.rotationQuaternion,r._options.xrInput.xrCamera.rotationQuaternion),r.onAfterCameraTeleportRotation.notifyObservers(r._options.xrInput.xrCamera.rotationQuaternion)}}else t.teleportationState.rotating=!1;0===n.x&&0===n.y&&(t.teleportationState.blocked&&(t.teleportationState.blocked=!1,r._setTargetMeshVisibility(!1)),t.teleportationState.forward&&r._teleportForward(e.uniqueId))}))}};e.motionController?n():e.onMotionControllerInitObservable.addOnce((function(){n()}))}else{t.teleportationState.mainComponentUsed=!0;var i=!1,o=function(){r._currentTeleportationControllerId=t.xrController.uniqueId,t.teleportationState.forward=!0,t.teleportationState.initialHit=!1,t.teleportationState.baseRotation=r._options.xrInput.xrCamera.rotationQuaternion.toEulerAngles().y,t.teleportationState.currentRotation=0;var n=r._options.timeToTeleport||3e3;(0,vy.fj)({timeout:n,contextObservable:r._xrSessionManager.onXRFrameObservable,onEnded:function(){r._currentTeleportationControllerId===t.xrController.uniqueId&&t.teleportationState.forward&&r._teleportForward(e.uniqueId)}})};r._xrSessionManager.scene.onPointerObservable.add((function(e){e.type===En.Zp.POINTERDOWN?(i=!1,r._options.timeToTeleportStart?(0,vy.fj)({timeout:r._options.timeToTeleportStart,contextObservable:r._xrSessionManager.onXRFrameObservable,onEnded:function(){r._currentTeleportationControllerId===t.xrController.uniqueId&&o()},breakCondition:function(){return!!i&&(i=!1,!0)}}):o()):e.type===En.Zp.POINTERUP&&(i=!0,t.teleportationState.forward=!1,r._currentTeleportationControllerId="")}))}}},r._colorArray=Array(24).fill(r._cachedColor4White),r._options.teleportationTargetMesh||r._createDefaultTargetMesh(),r._floorMeshes=r._options.floorMeshes||[],r._snapToPositions=r._options.snapPositions||[],r._blockedRayColor=r._options.blockedRayColor||new u.ov(1,0,0,.75),r._setTargetMeshVisibility(!1),r.onBeforeCameraTeleport=n.xrInput.xrCamera.onBeforeCameraTeleport,r.onAfterCameraTeleport=n.xrInput.xrCamera.onAfterCameraTeleport,r.parabolicCheckRadius*=r._xrSessionManager.worldScalingFactor,r._worldScaleObserver=t.onWorldScaleFactorChangedObservable.add((function(e){var t;r.parabolicCheckRadius=r.parabolicCheckRadius/e.previousScaleFactor*e.newScaleFactor,null===(t=r._options.teleportationTargetMesh)||void 0===t||t.scaling.scaleInPlace(e.newScaleFactor/e.previousScaleFactor)})),r}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"rotationEnabled",{get:function(){return this._rotationEnabled},set:function(e){if(this._rotationEnabled=e,this._options.teleportationTargetMesh){var t=this._options.teleportationTargetMesh.getChildMeshes(!1,(function(e){return"rotationCone"===e.name}));t[0]&&t[0].setEnabled(e)}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"teleportationTargetMesh",{get:function(){return this._options.teleportationTargetMesh||null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"snapPointsOnly",{get:function(){return!!this._options.snapPointsOnly},set:function(e){this._options.snapPointsOnly=e},enumerable:!1,configurable:!0}),t.prototype.addFloorMesh=function(e){this._floorMeshes.push(e)},t.prototype.addBlockerMesh=function(e){this._options.pickBlockerMeshes=this._options.pickBlockerMeshes||[],this._options.pickBlockerMeshes.push(e)},t.prototype.addSnapPoint=function(e){this._snapToPositions.push(e)},t.prototype.attach=function(){var t=this;if(!e.prototype.attach.call(this))return!1;this._currentTeleportationControllerId="";for(var n=0,r=this._options.xrInput.controllers;n=u.video.HAVE_CURRENT_DATA;return!u._settings.poster||u._settings.autoPlay&&p?p&&u._createInternalTexture():(u._texture=u._getEngine().createTexture(u._settings.poster,!1,!u.invertY,r),u._displayingPosterTexture=!0),u}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"onUserActionRequestedObservable",{get:function(){return this._onUserActionRequestedObservable||(this._onUserActionRequestedObservable=new l.cP),this._onUserActionRequestedObservable},enumerable:!1,configurable:!0}),t.prototype._processError=function(e){this._errorFound=!0,this._onError?this._onError(null==e?void 0:e.message):y.V.Error(null==e?void 0:e.message)},t.prototype._handlePlay=function(){var e=this;this._errorFound=!1,this.video.play().catch((function(t){if("NotAllowedError"===(null==t?void 0:t.name)){if(e._onUserActionRequestedObservable&&e._onUserActionRequestedObservable.hasObservers())return void e._onUserActionRequestedObservable.notifyObservers(e);if(!e.video.muted)return y.V.Warn("Unable to autoplay a video with sound. Trying again with muted turned true"),e.video.muted=!0,e._errorFound=!1,void e.video.play().catch((function(t){e._processError(t)}))}e._processError(t)}))},t.prototype.getClassName=function(){return"VideoTexture"},t.prototype._getName=function(e){return e instanceof HTMLVideoElement?e.currentSrc:"object"==typeof e?e.toString():e},t.prototype._getVideo=function(e){if(e.isNative)return e;if(e instanceof HTMLVideoElement)return Z.S0.SetCorsBehavior(e.currentSrc,e),e;var t=document.createElement("video");if("string"==typeof e)Z.S0.SetCorsBehavior(e,t),t.src=e;else{Z.S0.SetCorsBehavior(e[0],t);for(var n=0,r=e;n0){this._previousStencilState=this._engine.getStencilBuffer();for(var r=0,i=n;r-1)){this._renderEffects=!0,this._needStencil=this._needStencil||o.needStencil();var a=o._mainTexture;a._shouldRender()&&(this.scene.incrementRenderId(),a.render(!1,!1),t=!0)}}this.scene.incrementRenderId()}return t},e.prototype._setStencil=function(){this._needStencil&&this._engine.setStencilBuffer(!0)},e.prototype._setStencilBack=function(){this._needStencil&&this._engine.setStencilBuffer(this._previousStencilState)},e.prototype._draw=function(e){if(this._renderEffects){this._engine.setDepthBuffer(!1);for(var t=this.scene.effectLayers,n=0;n0&&e.isBackground===t&&e.applyPostProcess===n&&e.renderTargetTextures.indexOf(i)>-1&&0!==(e.layerMask&r)},e.prototype._drawRenderTargetBackground=function(e){var t=this;this._draw((function(n){return t._drawRenderTargetPredicate(n,!0,!0,t.scene.activeCamera?t.scene.activeCamera.layerMask:0,e)}))},e.prototype._drawRenderTargetForegroundWithPostProcessing=function(e){var t=this;this._draw((function(n){return t._drawRenderTargetPredicate(n,!1,!0,t.scene.activeCamera?t.scene.activeCamera.layerMask:0,e)}))},e.prototype._drawRenderTargetForegroundWithoutPostProcessing=function(e){var t=this;this._draw((function(n){return t._drawRenderTargetPredicate(n,!1,!1,t.scene.activeCamera?t.scene.activeCamera.layerMask:0,e)}))},e.prototype.addFromContainer=function(e){if(e.layers)for(var t=0,n=e.layers;t0&&(e.x-=this.viewportBorder,e.y-=this.viewportBorder,e.width+=2*this.viewportBorder,e.height+=2*this.viewportBorder,t.x+=this.viewportBorder,t.y+=this.viewportBorder,this._positionX+=this.viewportBorder,this._positionY+=this.viewportBorder);var n=this._scene.useRightHandedSystem;return!!(t.z>0&&!n||t.z<0&&n)&&(this._positionX>e.x&&this._positionXe.y&&(this._positionY,e.y,e.height),!0)},e.prototype._isVisible=function(){if(!this._isEnabled||!this._scene.activeCamera)return!1;var e=this.getEmitterPosition().subtract(this._scene.activeCamera.globalPosition),t=e.length();e.normalize();var n=new Nn(this._scene.activeCamera.globalPosition,e),r=this._scene.pickWithRay(n,this.meshesSelectionPredicate,!0);return!r||!r.hit||r.distance>t},e.prototype.render=function(){if(!this._scene.activeCamera||!this._shadersLoaded)return!1;var e,t,n=this._scene.getEngine(),r=this._scene.activeCamera.viewport.toGlobal(n.getRenderWidth(!0),n.getRenderHeight(!0));if(!this.computeEffectivePosition(r))return!1;if(!this._isVisible())return!1;var i=(e=this._positionXr.x+r.width-this.borderLimit?this._positionX-r.x-r.width+this.borderLimit:0)>(t=this._positionYr.y+r.height-this.borderLimit?this._positionY-r.y-r.height+this.borderLimit:0)?e:t;(i-=this.viewportBorder)>this.borderLimit&&(i=this.borderLimit);var o=1-(0,lr.Clamp)(i/this.borderLimit,0,1);if(o<0)return!1;o>1&&(o=1),this.viewportBorder>0&&(r.x+=this.viewportBorder,r.y+=this.viewportBorder,r.width-=2*this.viewportBorder,r.height-=2*this.viewportBorder,this._positionX-=this.viewportBorder,this._positionY-=this.viewportBorder);var a=r.x+r.width/2,s=r.y+r.height/2,l=a-this._positionX,u=s-this._positionY;n.setState(!1),n.setDepthBuffer(!1);for(var h=0;h0);for(var n=0,r=t;n0)}},e}();Qy._SceneComponentInitialization=function(e){var t=e._getComponent(Ue.v.NAME_LENSFLARESYSTEM);t||(t=new Jy(e),e._addComponent(t))};var $y=n(25188),eb=n(51006),tb=n(89967),nb=n(51093),rb=n(8822);zt(Ue.v.NAME_SHADOWGENERATOR,(function(e,t){if(void 0!==e.shadowGenerators&&null!==e.shadowGenerators)for(var n=0,r=e.shadowGenerators.length;n=this._thinInstanceDataStorage.instancesCount)return!1;var r=this._thinInstanceDataStorage.matrixData;return t.copyToArray(r,16*e),this._thinInstanceDataStorage.worldMatrices&&(this._thinInstanceDataStorage.worldMatrices[e]=t),n&&(this.thinInstanceBufferUpdated("matrix"),this.doNotSyncBoundingInfo||this.thinInstanceRefreshBoundingInfo(!1)),!0},qe.prototype.thinInstanceSetAttributeAt=function(e,t,n,r){return void 0===r&&(r=!0),e===se.R.ColorKind&&(e=se.R.ColorInstanceKind),!(!this._userThinInstanceBuffersStorage||!this._userThinInstanceBuffersStorage.data[e]||t>=this._thinInstanceDataStorage.instancesCount||(this._thinInstanceUpdateBufferSize(e,0),this._userThinInstanceBuffersStorage.data[e].set(n,t*this._userThinInstanceBuffersStorage.strides[e]),r&&this.thinInstanceBufferUpdated(e),0))},Object.defineProperty(qe.prototype,"thinInstanceCount",{get:function(){return this._thinInstanceDataStorage.instancesCount},set:function(e){var t,n,r=null!==(t=this._thinInstanceDataStorage.matrixData)&&void 0!==t?t:null===(n=this.source)||void 0===n?void 0:n._thinInstanceDataStorage.matrixData;e<=(r?r.length/16:0)&&(this._thinInstanceDataStorage.instancesCount=e)},enumerable:!0,configurable:!0}),qe.prototype._thinInstanceCreateMatrixBuffer=function(e,t,n){void 0===n&&(n=!0);for(var r=new se.h(this.getEngine(),t,!n,16,!1,!0),i=0;i<4;i++)this.setVerticesBuffer(r.createVertexBuffer(e+i,4*i,4));return r},qe.prototype.thinInstanceSetBuffer=function(e,t,n,r){var i,o,a;void 0===n&&(n=0),void 0===r&&(r=!0),n=n||16,"matrix"===e?(null===(i=this._thinInstanceDataStorage.matrixBuffer)||void 0===i||i.dispose(),this._thinInstanceDataStorage.matrixBuffer=null,this._thinInstanceDataStorage.matrixBufferSize=t?t.length:32*n,this._thinInstanceDataStorage.matrixData=t,this._thinInstanceDataStorage.worldMatrices=null,null!==t?(this._thinInstanceDataStorage.instancesCount=t.length/n,this._thinInstanceDataStorage.matrixBuffer=this._thinInstanceCreateMatrixBuffer("world",t,r),this.doNotSyncBoundingInfo||this.thinInstanceRefreshBoundingInfo(!1)):(this._thinInstanceDataStorage.instancesCount=0,this.doNotSyncBoundingInfo||this.refreshBoundingInfo())):"previousMatrix"===e?(null===(o=this._thinInstanceDataStorage.previousMatrixBuffer)||void 0===o||o.dispose(),this._thinInstanceDataStorage.previousMatrixBuffer=null,this._thinInstanceDataStorage.previousMatrixData=t,null!==t&&(this._thinInstanceDataStorage.previousMatrixBuffer=this._thinInstanceCreateMatrixBuffer("previousWorld",t,r))):(e===se.R.ColorKind&&(e=se.R.ColorInstanceKind),null===t?(null===(a=this._userThinInstanceBuffersStorage)||void 0===a?void 0:a.data[e])&&(this.removeVerticesData(e),delete this._userThinInstanceBuffersStorage.data[e],delete this._userThinInstanceBuffersStorage.strides[e],delete this._userThinInstanceBuffersStorage.sizes[e],delete this._userThinInstanceBuffersStorage.vertexBuffers[e]):(this._thinInstanceInitializeUserStorage(),this._userThinInstanceBuffersStorage.data[e]=t,this._userThinInstanceBuffersStorage.strides[e]=n,this._userThinInstanceBuffersStorage.sizes[e]=t.length,this._userThinInstanceBuffersStorage.vertexBuffers[e]=new se.R(this.getEngine(),t,e,!r,!1,n,!0),this.setVerticesBuffer(this._userThinInstanceBuffersStorage.vertexBuffers[e])))},qe.prototype.thinInstanceBufferUpdated=function(e){var t,n,r;"matrix"===e?(this.thinInstanceAllowAutomaticStaticBufferRecreation&&this._thinInstanceDataStorage.matrixBuffer&&!this._thinInstanceDataStorage.matrixBuffer.isUpdatable()&&this._thinInstanceRecreateBuffer(e),null===(t=this._thinInstanceDataStorage.matrixBuffer)||void 0===t||t.updateDirectly(this._thinInstanceDataStorage.matrixData,0,this._thinInstanceDataStorage.instancesCount)):"previousMatrix"===e?(this.thinInstanceAllowAutomaticStaticBufferRecreation&&this._thinInstanceDataStorage.previousMatrixBuffer&&!this._thinInstanceDataStorage.previousMatrixBuffer.isUpdatable()&&this._thinInstanceRecreateBuffer(e),null===(n=this._thinInstanceDataStorage.previousMatrixBuffer)||void 0===n||n.updateDirectly(this._thinInstanceDataStorage.previousMatrixData,0,this._thinInstanceDataStorage.instancesCount)):(e===se.R.ColorKind&&(e=se.R.ColorInstanceKind),(null===(r=this._userThinInstanceBuffersStorage)||void 0===r?void 0:r.vertexBuffers[e])&&(this.thinInstanceAllowAutomaticStaticBufferRecreation&&!this._userThinInstanceBuffersStorage.vertexBuffers[e].isUpdatable()&&this._thinInstanceRecreateBuffer(e),this._userThinInstanceBuffersStorage.vertexBuffers[e].updateDirectly(this._userThinInstanceBuffersStorage.data[e],0)))},qe.prototype.thinInstancePartialBufferUpdate=function(e,t,n){var r;"matrix"===e?this._thinInstanceDataStorage.matrixBuffer&&this._thinInstanceDataStorage.matrixBuffer.updateDirectly(t,n):(e===se.R.ColorKind&&(e=se.R.ColorInstanceKind),(null===(r=this._userThinInstanceBuffersStorage)||void 0===r?void 0:r.vertexBuffers[e])&&this._userThinInstanceBuffersStorage.vertexBuffers[e].updateDirectly(t,n))},qe.prototype.thinInstanceGetWorldMatrices=function(){if(!this._thinInstanceDataStorage.matrixData||!this._thinInstanceDataStorage.matrixBuffer)return[];var e=this._thinInstanceDataStorage.matrixData;if(!this._thinInstanceDataStorage.worldMatrices){this._thinInstanceDataStorage.worldMatrices=[];for(var t=0;t0){t._SceneComponentInitialization(a._scene);for(var l=0,c=i;l1&&t.colorBufferFloat&&t.blendFloat?t.shaderFloatPrecision:0:0},t.IsLightSupported=function(e){return!(0===t._GetEngineBatchSize(e.getEngine())||e.shadowEnabled&&e._scene.shadowsEnabled&&e.getShadowGenerators()||e.falloffType!==Ze.v.FALLOFF_DEFAULT||e.getTypeID()!==_b.c.LIGHTTYPEID_POINTLIGHT&&(e.getTypeID()!==_b.c.LIGHTTYPEID_SPOTLIGHT||e.projectionTexture||e.iesProfileTexture))},Object.defineProperty(t.prototype,"isSupported",{get:function(){return this._batchSize>0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lights",{get:function(){return this._lights},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"horizontalTiles",{get:function(){return this._horizontalTiles},set:function(e){this._horizontalTiles!==e&&(this._horizontalTiles=e,this._tileMaskBatches=-1)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"verticalTiles",{get:function(){return this._verticalTiles},set:function(e){this._verticalTiles!==e&&(this._verticalTiles=e,this._tileMaskBatches=-1)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"depthSlices",{get:function(){return this._depthSlices},set:function(e){this._depthSlices!==e&&(this._depthSlices=e,this._sliceRanges=new Float32Array(2*e),this._uniformBuffer.dispose(),this._uniformBuffer=new Pe.D(this.getEngine(),void 0,void 0,this.name),this._buildUniformLayout())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxRange",{get:function(){return this._maxRange},set:function(e){this._maxRange!==e&&(this._maxRange=e,this._minInverseSquaredRange=1/(e*e))},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"ClusteredLightContainer"},t.prototype.getTypeID=function(){return _b.c.LIGHTTYPEID_CLUSTERED_CONTAINER},t.prototype._updateBatches=function(e){var t,n,r,i=this;void 0===e&&(e=null),this._camera=e,this._proxyMesh.isVisible=this._sortedLights.length>0;var o=Math.max(Math.ceil(this._sortedLights.length/this._batchSize),1);if(this._tileMaskBatches>=o)return this._proxyMesh.thinInstanceCount=this._sortedLights.length,this._tileMaskTexture;var a=this.getEngine(),s=o*this._batchSize;this._lightDataBuffer=new Float32Array(20*s),null===(t=this._lightDataTexture)||void 0===t||t.dispose(),this._lightDataTexture=new gn(this._lightDataBuffer,5,s,b.Y.TEXTUREFORMAT_RGBA,this._scene,!1,!1,b.Y.TEXTURE_NEAREST_SAMPLINGMODE,b.Y.TEXTURETYPE_FLOAT),this._lightDataTexture.name="LightDataTexture_clustered_"+this.name,this._proxyMaterial.setTexture("lightDataTexture",this._lightDataTexture),null===(n=this._tileMaskTexture)||void 0===n||n.dispose();var l={width:this._horizontalTiles,height:this._verticalTiles};a.isWebGPU||(l.height*=o),this._tileMaskTexture=new Ji.$("TileMaskTexture",l,this._scene,{type:a.isWebGPU?b.Y.TEXTURETYPE_UNSIGNED_BYTE:b.Y.TEXTURETYPE_FLOAT,format:b.Y.TEXTUREFORMAT_RED,generateDepthBuffer:!1}),this._tileMaskTexture.renderParticles=!1,this._tileMaskTexture.renderSprites=!1,this._tileMaskTexture.noPrePassRenderer=!0,this._tileMaskTexture.renderList=[this._proxyMesh];var u=null;if(this._tileMaskTexture.onBeforeBindObservable.add((function(){u=a._currentRenderTarget,i._updateLightData()})),this._tileMaskTexture.onAfterUnbindObservable.add((function(){a._currentRenderTarget!==u&&(u?a.bindFramebuffer(u):a.restoreDefaultFramebuffer())})),this._tileMaskTexture.onClearObservable.add((function(){var e;a.isWebGPU?null===(e=i._tileMaskBuffer)||void 0===e||e.clear():a.clear({r:0,g:0,b:0,a:1},!0,!1)})),a.isWebGPU){null===(r=this._tileMaskBuffer)||void 0===r||r.dispose();var h=this._horizontalTiles*this._verticalTiles*o*4;this._tileMaskBuffer=new gr.K(a,h),this._proxyMaterial.setStorageBuffer("tileMaskBuffer",this._tileMaskBuffer)}return this._proxyMaterial.setVector3("tileMaskResolution",new c.Pq(this._horizontalTiles,this.verticalTiles,o)),this._proxyMesh.thinInstanceSetBuffer("matrix",new Float32Array(16*s)),this._proxyMesh.thinInstanceCount=this._sortedLights.length,this._tileMaskBatches=o,this._tileMaskTexture},t.prototype._getSliceIndex=function(e,t){return t=this._depthSlices||(C>l&&(this._sliceRanges[2*C]=p,l=C),this._sliceRanges[2*C+1]=p)}var R=this.getEngine();R.isWebGPU&&R.flushFramebuffer(),this._lightDataTexture.update(this._lightDataBuffer)}},t.prototype.dispose=function(t,n){for(var r,i=0,o=this._lights;i>3)),o=this._createRenderTarget(i);this._effectRenderer.saveStates(),this._effectRenderer.setViewport(),this._effectRenderer.applyEffectWrapper(this._effectWrapper);var a=[[new Du.Pq(0,0,-1),new Du.Pq(0,-1,0),new Du.Pq(1,0,0)],[new Du.Pq(0,0,1),new Du.Pq(0,-1,0),new Du.Pq(-1,0,0)],[new Du.Pq(1,0,0),new Du.Pq(0,0,1),new Du.Pq(0,1,0)],[new Du.Pq(1,0,0),new Du.Pq(0,0,-1),new Du.Pq(0,-1,0)],[new Du.Pq(1,0,0),new Du.Pq(0,-1,0),new Du.Pq(0,0,1)],[new Du.Pq(-1,0,0),new Du.Pq(0,-1,0),new Du.Pq(0,0,-1)]];r.setFloat("hdrScale",this.hdrScale),r.setFloat2("vFilteringInfo",e.getSize().width,n),r.setTexture("inputTexture",e),this._cdfGenerator&&r.setTexture("icdfTexture",this._cdfGenerator.getIcdfTexture());for(var s=0;s<6;s++)r.setVector3("up",a[s][0]),r.setVector3("right",a[s][1]),r.setVector3("front",a[s][2]),this._engine.bindFramebuffer(o,s,void 0,void 0,!0),this._effectRenderer.applyEffectWrapper(this._effectWrapper),this._effectRenderer.draw();this._effectRenderer.restoreStates(),this._engine.restoreDefaultFramebuffer(),r.setTexture("inputTexture",null),r.setTexture("icdfTexture",null);var l=new z_.t(e.getScene(),o.texture);return l.name=e.name+"_irradiance",l.displayName=e.name+"_irradiance",l.gammaSpace=!1,l},e.prototype._createEffect=function(e,t){var r=this,i=[];e.gammaSpace&&i.push("#define GAMMA_INPUT"),i.push("#define NUM_SAMPLES "+this.quality+"u");var o=this._engine.isWebGPU,a=["inputTexture"];this._cdfGenerator&&(a.push("icdfTexture"),i.push("#define IBL_CDF_FILTERING"));var s=new Ri.$({engine:this._engine,name:"HDRIrradianceFiltering",vertexShader:"hdrIrradianceFiltering",fragmentShader:"hdrIrradianceFiltering",samplerNames:a,uniformNames:["vSampleDirections","vWeights","up","right","front","vFilteringInfo","hdrScale"],useShaderStore:!0,defines:i,onCompiled:t,shaderLanguage:o?1:0,extraInitializationsAsync:function(){return(0,f.sH)(r,void 0,void 0,(function(){return(0,f.YH)(this,(function(e){switch(e.label){case 0:return o?[4,Promise.all([Promise.resolve().then(n.bind(n,37475)),Promise.resolve().then(n.bind(n,4141))])]:[3,2];case 1:return e.sent(),[3,4];case 2:return[4,Promise.all([Promise.resolve().then(n.bind(n,61114)),Promise.resolve().then(n.bind(n,47779))])];case 3:e.sent(),e.label=4;case 4:return[2]}}))}))}});return s},e.prototype.isReady=function(e){return e.isReady()&&this._effectWrapper.effect.isReady()},e.prototype.prefilter=function(e){return(0,f.sH)(this,void 0,void 0,(function(){var t,n;return(0,f.YH)(this,(function(r){switch(r.label){case 0:if(!this._engine._features.allowTexturePrefiltering)throw new Error("HDR prefiltering is not available in WebGL 1., you can use real time filtering instead.");return this.useCdf?(this._cdfGenerator=new Eb(this._engine),this._cdfGenerator.iblSource=e,[4,this._cdfGenerator.renderWhenReady()]):[3,2];case 1:r.sent(),r.label=2;case 2:return this._effectRenderer=new Ri.J(this._engine),this._effectWrapper=this._createEffect(e),[4,this._effectWrapper.effect.whenCompiledAsync()];case 3:return r.sent(),t=this._prefilterInternal(e),this.useCdf?[4,this._cdfGenerator.findDominantDirection().then((function(e){t._dominantDirection=e}))]:[3,5];case 4:r.sent(),r.label=5;case 5:return this._effectRenderer.dispose(),this._effectWrapper.dispose(),null===(n=this._cdfGenerator)||void 0===n||n.dispose(),[2,t]}}))}))},e}(),Pb=function(e){function t(t,n,r,i,o,a,s,u,h,d,p,f){var m;void 0===i&&(i=!1),void 0===o&&(o=!0),void 0===a&&(a=!1),void 0===s&&(s=!1),void 0===u&&(u=null),void 0===h&&(h=null),void 0===d&&(d=!1),void 0===p&&(p=!1),void 0===f&&(f=!1);var _=e.call(this,n)||this;return _._generateHarmonics=!0,_._onError=null,_._isBlocking=!0,_._rotationY=0,_.boundingBoxPosition=c.Pq.Zero(),_.onLoadObservable=new l.cP,t?(_._coordinatesMode=_n.g.CUBIC_MODE,_.name=t,_.url=t,_.hasAlpha=!1,_.isCube=!0,_._textureMatrix=c.uq.Identity(),_._prefilterOnLoad=s,_._prefilterIrradianceOnLoad=p,_._prefilterUsingCdf=f,_._onLoad=function(){_.onLoadObservable.notifyObservers(_),u&&u()},_._onError=h,_.gammaSpace=a,_._noMipmap=i,_._size=r,_._supersample=d||f,_._generateHarmonics=o,_._texture=_._getFromCache(t,_._noMipmap,void 0,void 0,void 0,_.isCube),_._texture?_._texture.isReady?Z.S0.SetImmediate((function(){return _._onLoad()})):_._texture.onLoadedObservable.add(_._onLoad):(null===(m=_.getScene())||void 0===m?void 0:m.useDelayedTextureLoading)?_.delayLoadState=b.Y.DELAYLOADSTATE_NOTLOADED:_._loadTexture(),_):_}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"isBlocking",{get:function(){return this._isBlocking},set:function(e){this._isBlocking=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotationY",{get:function(){return this._rotationY},set:function(e){this._rotationY=e,this.setReflectionTextureMatrix(c.uq.RotationY(this._rotationY))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"boundingBoxSize",{get:function(){return this._boundingBoxSize},set:function(e){if(!this._boundingBoxSize||!this._boundingBoxSize.equals(e)){this._boundingBoxSize=e;var t=this.getScene();t&&t.markAllMaterialsAsDirty(b.Y.MATERIAL_TextureDirtyFlag)}},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"EnvCubeTexture"},t.prototype._loadTexture=function(){var e=this,n=this._getEngine(),r=n.getCaps(),i=b.Y.TEXTURETYPE_UNSIGNED_BYTE;if(r.textureFloat&&r.textureFloatLinearFiltering?i=b.Y.TEXTURETYPE_FLOAT:r.textureHalfFloat&&r.textureHalfFloatLinearFiltering&&(i=b.Y.TEXTURETYPE_HALF_FLOAT),n._features.allowTexturePrefiltering&&(this._prefilterOnLoad||this._prefilterIrradianceOnLoad)){var o=this._onLoad,a=new Tb(n);this._onLoad=function(){var t=Promise.resolve(null),r=Promise.resolve();e._prefilterIrradianceOnLoad&&(t=new xb(n,{useCdf:e._prefilterUsingCdf}).prefilter(e)),e._prefilterOnLoad&&(r=a.prefilter(e)),Promise.all([t,r]).then((function(t){var n=t[0];if(e._prefilterIrradianceOnLoad&&n){e.irradianceTexture=n;var r=e.getScene();r&&r.markAllMaterialsAsDirty(b.Y.MATERIAL_TextureDirtyFlag)}o&&o()}))}}this._texture=n.createRawCubeTextureFromUrl(this.url,this.getScene(),this._size,b.Y.TEXTUREFORMAT_RGB,i,this._noMipmap,(function(n){return(0,f.sH)(e,void 0,void 0,(function(){var e,r,o,a,s,l,c,u,h,d,p,m,_;return(0,f.YH)(this,(function(f){switch(f.label){case 0:return this.lodGenerationOffset=0,this.lodGenerationScale=.8,[4,this._getCubeMapTextureDataAsync(n,this._size,this._supersample)];case 1:for(e=f.sent(),this._generateHarmonics&&(r=Sb.d.ConvertCubeMapToSphericalPolynomial(e),this.sphericalPolynomial=r),o=[],a=null,s=null,l=0;l<6;l++){if(i===b.Y.TEXTURETYPE_HALF_FLOAT?s=new Uint16Array(this._size*this._size*3):i===b.Y.TEXTURETYPE_UNSIGNED_BYTE&&(a=new Uint8Array(this._size*this._size*3)),c=e[t._FacesMapping[l]],this.gammaSpace||s||a)for(u=0;u255&&(h*=_=255/m,d*=_,p*=_),a[3*u+0]=h,a[3*u+1]=d,a[3*u+2]=p);s?o.push(s):a?o.push(a):o.push(c)}return[2,o]}}))}))}),null,this._onLoad,this._onError)},t.prototype.delayLoad=function(){this.delayLoadState===b.Y.DELAYLOADSTATE_NOTLOADED&&(this.delayLoadState=b.Y.DELAYLOADSTATE_LOADED,this._texture=this._getFromCache(this.url,this._noMipmap),this._texture||this._loadTexture())},t.prototype.getReflectionTextureMatrix=function(){return this._textureMatrix},t.prototype.setReflectionTextureMatrix=function(e){var t,n=this;this._textureMatrix=e,e.updateFlag!==this._textureMatrix.updateFlag&&e.isIdentity()!==this._textureMatrix.isIdentity()&&(null===(t=this.getScene())||void 0===t||t.markAllMaterialsAsDirty(b.Y.MATERIAL_TextureDirtyFlag,(function(e){return-1!==e.getActiveTextures().indexOf(n)})))},t.prototype.dispose=function(){this.onLoadObservable.clear(),e.prototype.dispose.call(this)},t.prototype.serialize=function(){if(!this.name)return null;var e={};return e.name=this.name,e.hasAlpha=this.hasAlpha,e.isCube=!0,e.level=this.level,e.size=this._size,e.coordinatesMode=this.coordinatesMode,e.useInGammaSpace=this.gammaSpace,e.generateHarmonics=this._generateHarmonics,e.noMipmap=this._noMipmap,e.isBlocking=this._isBlocking,e.rotationY=this._rotationY,e},t.prototype.clone=function(){var e=this._instantiateClone();return e.level=this.level,e.wrapU=this.wrapU,e.wrapV=this.wrapV,e.coordinatesIndex=this.coordinatesIndex,e.coordinatesMode=this.coordinatesMode,e},t._Parse=function(e,t){t.name=e.name,t.hasAlpha=e.hasAlpha,t.level=e.level,t.coordinatesMode=e.coordinatesMode,t.isBlocking=e.isBlocking,e.boundingBoxPosition&&(t.boundingBoxPosition=c.Pq.FromArray(e.boundingBoxPosition)),e.boundingBoxSize&&(t.boundingBoxSize=c.Pq.FromArray(e.boundingBoxSize)),e.rotationY&&(t.rotationY=e.rotationY)},t._FacesMapping=["right","left","up","down","front","back"],t}(z_.t),Cb=n(51967),Rb=function(e){function t(t,n,r,i,o,a,s,l,c,u,h,d){return void 0===i&&(i=!1),void 0===o&&(o=!0),void 0===a&&(a=!1),void 0===s&&(s=!1),void 0===l&&(l=null),void 0===c&&(c=null),void 0===u&&(u=!1),void 0===h&&(h=!1),void 0===d&&(d=!1),e.call(this,t,n,r,i,o,a,s,l,c,u,h,d)||this}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"HDRCubeTexture"},t.prototype._getCubeMapTextureDataAsync=function(e,t,n){return(0,f.sH)(this,void 0,void 0,(function(){return(0,f.YH)(this,(function(r){return[2,(0,Cb.VH)(e,t,n)]}))}))},t.prototype._instantiateClone=function(){return new t(this.url,this.getScene()||this._getEngine(),this._size,this._noMipmap,this._generateHarmonics,this.gammaSpace)},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t?(t.customType="BABYLON.HDRCubeTexture",t):null},t.Parse=function(e,n,r){if(!e.name||e.isRenderTarget)return null;var i=new t(r+e.name,n,e.size,e.noMipmap,e.generateHarmonics,e.useInGammaSpace);return this._Parse(e,i),i},t}(Pb);(0,h.Y5)("BABYLON.HDRCubeTexture",Rb);var Ab=function(){function e(e,t,n){void 0===t&&(t=0),void 0===n&&(n=null),this.name=e,this.animations=[],this._positions=null,this._normals=null,this._tangents=null,this._uvs=null,this._uv2s=null,this._colors=null,this._uniqueId=0,this.onInfluenceChanged=new l.cP,this._onDataLayoutChanged=new l.cP,this._animationPropertiesOverride=null,this.id=e,this._scene=n||M.q.LastCreatedScene,this.influence=t,this._scene&&(this._uniqueId=this._scene.getUniqueId())}return Object.defineProperty(e.prototype,"influence",{get:function(){return this._influence},set:function(e){if(this._influence!==e){var t=this._influence;this._influence=e,this.onInfluenceChanged.hasObservers()&&this.onInfluenceChanged.notifyObservers(0===t||0===e)}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"animationPropertiesOverride",{get:function(){return!this._animationPropertiesOverride&&this._scene?this._scene.animationPropertiesOverride:this._animationPropertiesOverride},set:function(e){this._animationPropertiesOverride=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"uniqueId",{get:function(){return this._uniqueId},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasPositions",{get:function(){return!!this._positions},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasNormals",{get:function(){return!!this._normals},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasTangents",{get:function(){return!!this._tangents},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasUVs",{get:function(){return!!this._uvs},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasUV2s",{get:function(){return!!this._uv2s},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasColors",{get:function(){return!!this._colors},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vertexCount",{get:function(){return this._positions?this._positions.length/3:this._normals?this._normals.length/3:this._tangents?this._tangents.length/3:this._uvs?this._uvs.length/2:this._uv2s?this._uv2s.length/2:this._colors?this._colors.length/4:0},enumerable:!1,configurable:!0}),e.prototype.setPositions=function(e){var t=this.hasPositions;this._positions=e,t!==this.hasPositions&&this._onDataLayoutChanged.notifyObservers(void 0)},e.prototype.getPositions=function(){return this._positions},e.prototype.setNormals=function(e){var t=this.hasNormals;this._normals=e,t!==this.hasNormals&&this._onDataLayoutChanged.notifyObservers(void 0)},e.prototype.getNormals=function(){return this._normals},e.prototype.setTangents=function(e){var t=this.hasTangents;this._tangents=e,t!==this.hasTangents&&this._onDataLayoutChanged.notifyObservers(void 0)},e.prototype.getTangents=function(){return this._tangents},e.prototype.setUVs=function(e){var t=this.hasUVs;this._uvs=e,t!==this.hasUVs&&this._onDataLayoutChanged.notifyObservers(void 0)},e.prototype.getUVs=function(){return this._uvs},e.prototype.setUV2s=function(e){var t=this.hasUV2s;this._uv2s=e,t!==this.hasUV2s&&this._onDataLayoutChanged.notifyObservers(void 0)},e.prototype.getUV2s=function(){return this._uv2s},e.prototype.setColors=function(e){var t=this.hasColors;this._colors=e,t!==this.hasColors&&this._onDataLayoutChanged.notifyObservers(void 0)},e.prototype.getColors=function(){return this._colors},e.prototype.clone=function(){var t=this,n=Te.p.Clone((function(){return new e(t.name,t.influence,t._scene)}),this);return n._positions=this._positions,n._normals=this._normals,n._tangents=this._tangents,n._uvs=this._uvs,n._uv2s=this._uv2s,n._colors=this._colors,n},e.prototype.serialize=function(){var e={};return e.name=this.name,e.influence=this.influence,e.positions=Array.prototype.slice.call(this.getPositions()),null!=this.id&&(e.id=this.id),this.hasNormals&&(e.normals=Array.prototype.slice.call(this.getNormals())),this.hasTangents&&(e.tangents=Array.prototype.slice.call(this.getTangents())),this.hasUVs&&(e.uvs=Array.prototype.slice.call(this.getUVs())),this.hasUV2s&&(e.uv2s=Array.prototype.slice.call(this.getUV2s())),this.hasColors&&(e.colors=Array.prototype.slice.call(this.getColors())),Te.p.AppendSerializedAnimations(this,e),e},e.prototype.getClassName=function(){return"MorphTarget"},e.Parse=function(t,n){var r=new e(t.name,t.influence);if(r.setPositions(t.positions),null!=t.id&&(r.id=t.id),t.normals&&r.setNormals(t.normals),t.tangents&&r.setTangents(t.tangents),t.uvs&&r.setUVs(t.uvs),t.uv2s&&r.setUV2s(t.uv2s),t.colors&&r.setColors(t.colors),t.animations){for(var i=0;i0&&t.texture2DArrayMaxLayerCount>1}}return Object.defineProperty(e.prototype,"areUpdatesFrozen",{get:function(){return this._blockCounter>0},set:function(e){e?this._blockCounter++:(this._blockCounter--,this._blockCounter<=0&&(this._blockCounter=0,this._syncActiveTargets(this._forceUpdateWhenUnfrozen),this._forceUpdateWhenUnfrozen=!1))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"numMaxInfluencers",{get:function(){return e.ConstantTargetCountForTextureMode>0&&this.isUsingTextureForTargets?e.ConstantTargetCountForTextureMode:this._numMaxInfluencers},set:function(e){this._numMaxInfluencers!==e&&(this._numMaxInfluencers=e,this._mustSynchronize=!0,this._syncActiveTargets())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"uniqueId",{get:function(){return this._uniqueId},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vertexCount",{get:function(){return this._vertexCount},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"supportsPositions",{get:function(){return this._supportsPositions&&this.enablePositionMorphing},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"supportsNormals",{get:function(){return this._supportsNormals&&this.enableNormalMorphing},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"supportsTangents",{get:function(){return this._supportsTangents&&this.enableTangentMorphing},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"supportsUVs",{get:function(){return this._supportsUVs&&this.enableUVMorphing},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"supportsUV2s",{get:function(){return this._supportsUV2s&&this.enableUV2Morphing},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"supportsColors",{get:function(){return this._supportsColors&&this.enableColorMorphing},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasPositions",{get:function(){return this._supportsPositions},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasNormals",{get:function(){return this._supportsNormals},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasTangents",{get:function(){return this._supportsTangents},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasUVs",{get:function(){return this._supportsUVs},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasUV2s",{get:function(){return this._supportsUV2s},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasColors",{get:function(){return this._supportsColors},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"numTargets",{get:function(){return this._targets.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"numInfluencers",{get:function(){return this._influencesAreDirty&&this._syncActiveTargets(),this._activeTargets.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"influences",{get:function(){return this._influencesAreDirty&&this._syncActiveTargets(),this._influences},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"useTextureToStoreTargets",{get:function(){return this._useTextureToStoreTargets},set:function(e){this._useTextureToStoreTargets!==e&&(this._useTextureToStoreTargets=e,this._mustSynchronize=!0,this._syncActiveTargets())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isUsingTextureForTargets",{get:function(){var t;return e.EnableTextureStorage&&this.useTextureToStoreTargets&&this._canUseTextureForTargets&&!(null===(t=this._scene)||void 0===t?void 0:t.getEngine().getCaps().disableMorphTargetTexture)},enumerable:!1,configurable:!0}),e.prototype.getActiveTarget=function(e){return this._influencesAreDirty&&this._syncActiveTargets(),this._activeTargets.data[e]},e.prototype.getTarget=function(e){return this._targets[e]},e.prototype.getTargetByName=function(e){for(var t=0,n=this._targets;t=0&&(this._targets.splice(t,1),e.onInfluenceChanged.remove(this._targetInfluenceChangedObservers.splice(t,1)[0]),e._onDataLayoutChanged.remove(this._targetDataLayoutChangedObservers.splice(t,1)[0]),this._mustSynchronize=!0,this._syncActiveTargets()),this._scene&&this._scene.stopAnimation(e)},e.prototype._bind=function(e){this._influencesAreDirty&&this._syncActiveTargets(),e.setFloat3("morphTargetTextureInfo",this._textureVertexStride,this._textureWidth,this._textureHeight),e.setFloatArray("morphTargetTextureIndices",this._morphTargetTextureIndices),e.setTexture("morphTargets",this._targetStoreTexture),e.setFloat("morphTargetCount",this.numInfluencers)},e.prototype.clone=function(){var t=new e(this._scene);t.areUpdatesFrozen=!0;for(var n=0,r=this._targets;n=e.MaxActiveMorphTargetsInVertexAttributeMode&&!this.isUsingTextureForTargets)break;this._activeTargets.push(l),this._morphTargetTextureIndices[i]=o,this._tempInfluences[i++]=l.influence}}this._morphTargetTextureIndices.length!==i&&(this._morphTargetTextureIndices=this._morphTargetTextureIndices.slice(0,i)),this._influences&&this._influences.length===i||(this._influences=new Float32Array(i));for(var c=0;ct.getCaps().texture2DArrayMaxLayerCount&&(this.useTextureToStoreTargets=!1);for(var n=0,r=this._targets;na&&(this._textureHeight=Math.ceil(this._textureWidth/a),this._textureWidth=a);for(var s=this._targets.length,l=new Float32Array(s*this._textureWidth*this._textureHeight*4),c=0,u=0;u-1&&this._parentContainer.morphTargetManagers.splice(e,1),this._parentContainer=null}for(var t=0,n=this._targets;t-1&&this._impostors.splice(t,1).length&&this.getPhysicsPlugin().removePhysicsBody(e)},e.prototype.addJoint=function(e,t,n){var r={mainImpostor:e,connectedImpostor:t,joint:n};n.physicsPlugin=this._physicsPlugin,this._joints.push(r),this._physicsPlugin.generateJoint(r)},e.prototype.removeJoint=function(e,t,n){var r=this._joints.filter((function(r){return r.connectedImpostor===t&&r.joint===n&&r.mainImpostor===e}));r.length&&this._physicsPlugin.removeJoint(r[0])},e.prototype._step=function(e){for(var t=0,n=this._impostors;t.1?e=.1:e<=0&&(e=1/60),this._physicsPlugin.executeStep(e,this._impostors)},e.prototype.getPhysicsPlugin=function(){return this._physicsPlugin},e.prototype.getImpostors=function(){return this._impostors},e.prototype.getImpostorForPhysicsObject=function(e){for(var t=0;t0){for(var e=0,t=this._physicsBodiesToRemoveAfterStep;e1e3*n));s++);this.time+=r;for(var l=this.time%n/n,c=e,u=this.bodies,h=0;h!==u.length;h++){var d=u[h];d.type!==t.Body.STATIC&&d.sleepState!==t.Body.SLEEPING?(d.position.vsub(d.previousPosition,c),c.scale(l,c),d.position.vadd(c,d.interpolatedPosition)):(d.interpolatedPosition.set(d.position.x,d.position.y,d.position.z),d.interpolatedQuaternion.set(d.quaternion.x,d.quaternion.y,d.quaternion.z,d.quaternion.w))}}}},e.prototype.raycast=function(e,t){return this._raycastResult.reset(e,t),this.raycastToRef(e,t,this._raycastResult),this._raycastResult},e.prototype.raycastToRef=function(e,t,n){this._cannonRaycastResult.reset(),this.world.raycastClosest(e,t,{},this._cannonRaycastResult),n.reset(e,t),this._cannonRaycastResult.hasHit&&(n.setHitData({x:this._cannonRaycastResult.hitNormalWorld.x,y:this._cannonRaycastResult.hitNormalWorld.y,z:this._cannonRaycastResult.hitNormalWorld.z},{x:this._cannonRaycastResult.hitPointWorld.x,y:this._cannonRaycastResult.hitPointWorld.y,z:this._cannonRaycastResult.hitPointWorld.z}),n.setHitDistance(this._cannonRaycastResult.distance))},e}();Nb.DefaultPluginFactory=function(){return new Fb};var Lb=function(){function e(e,t,n){void 0===e&&(e=!0),void 0===n&&(n=OIMO),this._useDeltaForWorldStep=e,this.name="OimoJSPlugin",this._fixedTimeStep=1/60,this._tmpImpostorsArray=[],this._tmpPositionVector=c.Pq.Zero(),this.BJSOIMO=n,this.world=new this.BJSOIMO.World({iterations:t}),this.world.clear(),this._raycastResult=new Db}return e.prototype.getPluginVersion=function(){return 1},e.prototype.setGravity=function(e){this.world.gravity.set(e.x,e.y,e.z)},e.prototype.setTimeStep=function(e){this.world.timeStep=e},e.prototype.getTimeStep=function(){return this.world.timeStep},e.prototype.executeStep=function(e,t){for(var n=0,r=t;n0&&e>0;)e-n0&&this._isImpostorInContact(s))for(var l=0,c=s._onPhysicsCollideCallbacks;l3?3:s;var l=(new this.bjsAMMO.btSoftBodyHelpers).CreateRope(this.world.getWorldInfo(),this._tmpAmmoVectorA,this._tmpAmmoVectorB,n-1,s);return l.get_m_cfg().set_collisions(17),l},e.prototype._createCustom=function(e){var t=null;return this.onCreateCustomShape&&(t=this.onCreateCustomShape(e)),null==t&&(t=new this.bjsAMMO.btCompoundShape),t},e.prototype._addHullVerts=function(e,t,n){var r=0;if(n&&n.getIndices&&n.getWorldMatrix&&n.getChildMeshes){var i=n.getIndices();i||(i=[]);var o=n.getVerticesData(se.R.PositionKind);o||(o=[]),n.computeWorldMatrix(!1);for(var a=i.length/3,s=0;s0)return e.type!=us.NoImpostor&&(d=this._createShape(e,!0))&&(this._tmpAmmoTransform.getOrigin().setValue(0,0,0),this._tmpAmmoQuaternion.setValue(0,0,0,1),this._tmpAmmoTransform.setRotation(this._tmpAmmoQuaternion),n.addChildShape(this._tmpAmmoTransform,d)),n;this.bjsAMMO.destroy(n),n=null}switch(e.type){case us.SphereImpostor:if((0,lr.WithinEpsilon)(i.x,i.y,1e-4)&&(0,lr.WithinEpsilon)(i.x,i.z,1e-4))n=new this.bjsAMMO.btSphereShape(i.x/2);else{this._tmpAmmoVectorA.setValue(0,0,0);var m=[this._tmpAmmoVectorA];n=new this.bjsAMMO.btMultiSphereShape(m,[1],1),this._tmpAmmoVectorA.setValue(i.x/2,i.y/2,i.z/2),n.setLocalScaling(this._tmpAmmoVectorA)}break;case us.CapsuleImpostor:var _=i.x/2;n=new this.bjsAMMO.btCapsuleShape(_,i.y-2*_);break;case us.CylinderImpostor:this._tmpAmmoVectorA.setValue(i.x/2,i.y/2,i.z/2),n=new this.bjsAMMO.btCylinderShape(this._tmpAmmoVectorA);break;case us.PlaneImpostor:case us.BoxImpostor:this._tmpAmmoVectorA.setValue(i.x/2,i.y/2,i.z/2),n=new this.bjsAMMO.btBoxShape(this._tmpAmmoVectorA);break;case us.MeshImpostor:if(0==e.getParam("mass")){if(this.onCreateCustomMeshImpostor)n=this.onCreateCustomMeshImpostor(e);else{var g=new this.bjsAMMO.btTriangleMesh;e._pluginData.toDispose.push(g),n=0==this._addMeshVerts(g,r,r)?new this.bjsAMMO.btCompoundShape:new this.bjsAMMO.btBvhTriangleMeshShape(g)}break}case us.ConvexHullImpostor:if(this.onCreateCustomConvexHullImpostor)n=this.onCreateCustomConvexHullImpostor(e);else{var v=new this.bjsAMMO.btConvexHullShape;0==this._addHullVerts(v,r,r)?(e._pluginData.toDispose.push(v),n=new this.bjsAMMO.btCompoundShape):n=v}break;case us.NoImpostor:n=new this.bjsAMMO.btSphereShape(i.x/2);break;case us.CustomImpostor:n=this._createCustom(e);break;case us.SoftbodyImpostor:n=this._createSoftbody(e);break;case us.ClothImpostor:n=this._createCloth(e);break;case us.RopeImpostor:n=this._createRope(e);break;default:y.V.Warn("The impostor type is not currently supported by the ammo plugin.")}return n},e.prototype.setTransformationFromPhysicsBody=function(e){e.physicsBody.getMotionState().getWorldTransform(this._tmpAmmoTransform),e.object.position.set(this._tmpAmmoTransform.getOrigin().x(),this._tmpAmmoTransform.getOrigin().y(),this._tmpAmmoTransform.getOrigin().z()),e.object.rotationQuaternion?e.object.rotationQuaternion.set(this._tmpAmmoTransform.getRotation().x(),this._tmpAmmoTransform.getRotation().y(),this._tmpAmmoTransform.getRotation().z(),this._tmpAmmoTransform.getRotation().w()):e.object.rotation&&(this._tmpQuaternion.set(this._tmpAmmoTransform.getRotation().x(),this._tmpAmmoTransform.getRotation().y(),this._tmpAmmoTransform.getRotation().z(),this._tmpAmmoTransform.getRotation().w()),this._tmpQuaternion.toEulerAnglesToRef(e.object.rotation))},e.prototype.setPhysicsBodyTransformation=function(e,t,n){var r=e.physicsBody.getWorldTransform();if(Math.abs(r.getOrigin().x()-t.x)>Re.bH||Math.abs(r.getOrigin().y()-t.y)>Re.bH||Math.abs(r.getOrigin().z()-t.z)>Re.bH||Math.abs(r.getRotation().x()-n.x)>Re.bH||Math.abs(r.getRotation().y()-n.y)>Re.bH||Math.abs(r.getRotation().z()-n.z)>Re.bH||Math.abs(r.getRotation().w()-n.w)>Re.bH)if(this._tmpAmmoVectorA.setValue(t.x,t.y,t.z),r.setOrigin(this._tmpAmmoVectorA),this._tmpAmmoQuaternion.setValue(n.x,n.y,n.z,n.w),r.setRotation(this._tmpAmmoQuaternion),e.physicsBody.setWorldTransform(r),0==e.mass){var i=e.physicsBody.getMotionState();i&&i.setWorldTransform(r)}else e.physicsBody.activate()},e.prototype.isSupported=function(){return void 0!==this.bjsAMMO},e.prototype.setLinearVelocity=function(e,t){this._tmpAmmoVectorA.setValue(t.x,t.y,t.z),e.soft?e.physicsBody.linearVelocity(this._tmpAmmoVectorA):e.physicsBody.setLinearVelocity(this._tmpAmmoVectorA)},e.prototype.setAngularVelocity=function(e,t){this._tmpAmmoVectorA.setValue(t.x,t.y,t.z),e.soft?e.physicsBody.angularVelocity(this._tmpAmmoVectorA):e.physicsBody.setAngularVelocity(this._tmpAmmoVectorA)},e.prototype.getLinearVelocity=function(e){var t;if(!(t=e.soft?e.physicsBody.linearVelocity():e.physicsBody.getLinearVelocity()))return null;var n=new c.Pq(t.x(),t.y(),t.z());return this.bjsAMMO.destroy(t),n},e.prototype.getAngularVelocity=function(e){var t;if(!(t=e.soft?e.physicsBody.angularVelocity():e.physicsBody.getAngularVelocity()))return null;var n=new c.Pq(t.x(),t.y(),t.z());return this.bjsAMMO.destroy(t),n},e.prototype.setBodyMass=function(e,t){e.soft?e.physicsBody.setTotalMass(t,!1):e.physicsBody.setMassProps(t),e._pluginData.mass=t},e.prototype.getBodyMass=function(e){return e._pluginData.mass||0},e.prototype.getBodyFriction=function(e){return e._pluginData.friction||0},e.prototype.setBodyFriction=function(e,t){e.soft?e.physicsBody.get_m_cfg().set_kDF(t):e.physicsBody.setFriction(t),e._pluginData.friction=t},e.prototype.getBodyRestitution=function(e){return e._pluginData.restitution||0},e.prototype.setBodyRestitution=function(e,t){e.physicsBody.setRestitution(t),e._pluginData.restitution=t},e.prototype.getBodyPressure=function(e){return e.soft?e._pluginData.pressure||0:(y.V.Warn("Pressure is not a property of a rigid body"),0)},e.prototype.setBodyPressure=function(e,t){e.soft?e.type===us.SoftbodyImpostor?(e.physicsBody.get_m_cfg().set_kPR(t),e._pluginData.pressure=t):(e.physicsBody.get_m_cfg().set_kPR(0),e._pluginData.pressure=0):y.V.Warn("Pressure can only be applied to a softbody")},e.prototype.getBodyStiffness=function(e){return e.soft?e._pluginData.stiffness||0:(y.V.Warn("Stiffness is not a property of a rigid body"),0)},e.prototype.setBodyStiffness=function(e,t){e.soft?(t=(t=t<0?0:t)>1?1:t,e.physicsBody.get_m_materials().at(0).set_m_kLST(t),e._pluginData.stiffness=t):y.V.Warn("Stiffness cannot be applied to a rigid body")},e.prototype.getBodyVelocityIterations=function(e){return e.soft?e._pluginData.velocityIterations||0:(y.V.Warn("Velocity iterations is not a property of a rigid body"),0)},e.prototype.setBodyVelocityIterations=function(e,t){e.soft?(t=t<0?0:t,e.physicsBody.get_m_cfg().set_viterations(t),e._pluginData.velocityIterations=t):y.V.Warn("Velocity iterations cannot be applied to a rigid body")},e.prototype.getBodyPositionIterations=function(e){return e.soft?e._pluginData.positionIterations||0:(y.V.Warn("Position iterations is not a property of a rigid body"),0)},e.prototype.setBodyPositionIterations=function(e,t){e.soft?(t=t<0?0:t,e.physicsBody.get_m_cfg().set_piterations(t),e._pluginData.positionIterations=t):y.V.Warn("Position iterations cannot be applied to a rigid body")},e.prototype.appendAnchor=function(e,t,n,r,i,o){void 0===i&&(i=1),void 0===o&&(o=!1);var a=e.segments,s=Math.round((a-1)*n)+a*(a-1-Math.round((a-1)*r));e.physicsBody.appendAnchor(s,t.physicsBody,o,i)},e.prototype.appendHook=function(e,t,n,r,i){void 0===r&&(r=1),void 0===i&&(i=!1);var o=Math.round(e.segments*n);e.physicsBody.appendAnchor(o,t.physicsBody,i,r)},e.prototype.sleepBody=function(e){e.physicsBody.forceActivationState(0)},e.prototype.wakeUpBody=function(e){e.physicsBody.activate()},e.prototype.updateDistanceJoint=function(){y.V.Warn("updateDistanceJoint is not currently supported by the Ammo physics plugin")},e.prototype.setMotor=function(e,t,n){e.physicsJoint.enableAngularMotor(!0,t,n)},e.prototype.setLimit=function(){y.V.Warn("setLimit is not currently supported by the Ammo physics plugin")},e.prototype.syncMeshWithImpostor=function(e,t){t.physicsBody.getMotionState().getWorldTransform(this._tmpAmmoTransform),e.position.x=this._tmpAmmoTransform.getOrigin().x(),e.position.y=this._tmpAmmoTransform.getOrigin().y(),e.position.z=this._tmpAmmoTransform.getOrigin().z(),e.rotationQuaternion&&(e.rotationQuaternion.x=this._tmpAmmoTransform.getRotation().x(),e.rotationQuaternion.y=this._tmpAmmoTransform.getRotation().y(),e.rotationQuaternion.z=this._tmpAmmoTransform.getRotation().z(),e.rotationQuaternion.w=this._tmpAmmoTransform.getRotation().w())},e.prototype.getRadius=function(e){return e.getObjectExtents().x/2},e.prototype.getBoxSizeToRef=function(e,t){var n=e.getObjectExtents();t.x=n.x,t.y=n.y,t.z=n.z},e.prototype.dispose=function(){this.bjsAMMO.destroy(this.world),this.bjsAMMO.destroy(this._softBodySolver),this.bjsAMMO.destroy(this._solver),this.bjsAMMO.destroy(this._overlappingPairCache),this.bjsAMMO.destroy(this._dispatcher),this.bjsAMMO.destroy(this._collisionConfiguration),this.bjsAMMO.destroy(this._tmpAmmoVectorA),this.bjsAMMO.destroy(this._tmpAmmoVectorB),this.bjsAMMO.destroy(this._tmpAmmoVectorC),this.bjsAMMO.destroy(this._tmpAmmoVectorD),this.bjsAMMO.destroy(this._tmpAmmoTransform),this.bjsAMMO.destroy(this._tmpAmmoQuaternion),this.bjsAMMO.destroy(this._tmpAmmoConcreteContactResultCallback),this.world=null},e.prototype.raycast=function(e,t){return this.raycastToRef(e,t,this._raycastResult),this._raycastResult},e.prototype.raycastToRef=function(e,t,n){this._tmpAmmoVectorRCA=new this.bjsAMMO.btVector3(e.x,e.y,e.z),this._tmpAmmoVectorRCB=new this.bjsAMMO.btVector3(t.x,t.y,t.z);var r=new this.bjsAMMO.ClosestRayResultCallback(this._tmpAmmoVectorRCA,this._tmpAmmoVectorRCB);this.world.rayTest(this._tmpAmmoVectorRCA,this._tmpAmmoVectorRCB,r),n.reset(e,t),r.hasHit()&&(n.setHitData({x:r.get_m_hitNormalWorld().x(),y:r.get_m_hitNormalWorld().y(),z:r.get_m_hitNormalWorld().z()},{x:r.get_m_hitPointWorld().x(),y:r.get_m_hitPointWorld().y(),z:r.get_m_hitPointWorld().z()}),n.calculateHitDistance()),this.bjsAMMO.destroy(r),this.bjsAMMO.destroy(this._tmpAmmoVectorRCA),this.bjsAMMO.destroy(this._tmpAmmoVectorRCB)},e._DISABLE_COLLISION_FLAG=4,e._KINEMATIC_FLAG=2,e._DISABLE_DEACTIVATION_FLAG=4,e}();Vt.Z.prototype.removeReflectionProbe=function(e){if(!this.reflectionProbes)return-1;var t=this.reflectionProbes.indexOf(e);return-1!==t&&this.reflectionProbes.splice(t,1),t},Vt.Z.prototype.addReflectionProbe=function(e){this.reflectionProbes||(this.reflectionProbes=[]),this.reflectionProbes.push(e)};var Bb=function(){function e(e,t,n,r,i,o){void 0===r&&(r=!0),void 0===i&&(i=!1),void 0===o&&(o=!1);var a=this;if(this.name=e,this._viewMatrix=c.uq.Identity(),this._target=c.Pq.Zero(),this._add=c.Pq.Zero(),this._invertYAxis=!1,this.position=c.Pq.Zero(),this.metadata=null,this._parentContainer=null,this._scene=n,n.getEngine().supportsUniformBuffers){this._sceneUBOs=[];for(var s=0;s<6;++s)this._sceneUBOs.push(n.createSceneUniformBuffer('Scene for Reflection Probe (name "'.concat(e,'") face #').concat(s)))}this._scene.reflectionProbes||(this._scene.reflectionProbes=[]),this._scene.reflectionProbes.push(this);var l=b.Y.TEXTURETYPE_UNSIGNED_BYTE;if(i){var u=this._scene.getEngine().getCaps();u.textureHalfFloatRender?l=b.Y.TEXTURETYPE_HALF_FLOAT:u.textureFloatRender&&(l=b.Y.TEXTURETYPE_FLOAT)}this._renderTargetTexture=new Ji.$(e,t,n,r,!0,l,!0),this._renderTargetTexture.gammaSpace=!o,this._renderTargetTexture.invertZ=n.useRightHandedSystem;var h,d=n.getEngine().useReverseDepthBuffer;this._renderTargetTexture.onBeforeRenderObservable.add((function(e){switch(a._sceneUBOs&&(n.setSceneUniformBuffer(a._sceneUBOs[e]),n.getSceneUniformBuffer().unbindEffect()),e){case 0:a._add.copyFromFloats(1,0,0);break;case 1:a._add.copyFromFloats(-1,0,0);break;case 2:a._add.copyFromFloats(0,a._invertYAxis?1:-1,0);break;case 3:a._add.copyFromFloats(0,a._invertYAxis?-1:1,0);break;case 4:a._add.copyFromFloats(0,0,n.useRightHandedSystem?-1:1);break;case 5:a._add.copyFromFloats(0,0,n.useRightHandedSystem?1:-1)}a._attachedMesh&&a.position.copyFrom(a._attachedMesh.getAbsolutePosition()),a.position.addToRef(a._add,a._target);var t=n.useRightHandedSystem?c.uq.LookAtRHToRef:c.uq.LookAtLHToRef,r=n.useRightHandedSystem?c.uq.PerspectiveFovRH:c.uq.PerspectiveFovLH;t(a.position,a._target,c.Pq.Up(),a._viewMatrix),n.activeCamera&&(a._projectionMatrix=r(Math.PI/2,1,d?n.activeCamera.maxZ:n.activeCamera.minZ,d?n.activeCamera.minZ:n.activeCamera.maxZ,a._scene.getEngine().isNDCHalfZRange),n.setTransformMatrix(a._viewMatrix,a._projectionMatrix),n.activeCamera.isRigCamera&&!a._renderTargetTexture.activeCamera&&(a._renderTargetTexture.activeCamera=n.activeCamera.rigParent||null)),n._forcedViewPosition=a.position})),this._renderTargetTexture.onBeforeBindObservable.add((function(){var t,r;a._currentSceneUBO=n.getSceneUniformBuffer(),null===(r=(t=n.getEngine())._debugPushGroup)||void 0===r||r.call(t,"reflection probe generation for ".concat(e),1),h=a._scene.imageProcessingConfiguration.applyByPostProcess,o&&(n.imageProcessingConfiguration.applyByPostProcess=!0)})),this._renderTargetTexture.onAfterUnbindObservable.add((function(){var e,t;n.imageProcessingConfiguration.applyByPostProcess=h,n._forcedViewPosition=null,a._sceneUBOs&&n.setSceneUniformBuffer(a._currentSceneUBO),n.updateTransformMatrix(!0),null===(t=(e=n.getEngine())._debugPopGroup)||void 0===t||t.call(e,1)}))}return Object.defineProperty(e.prototype,"samples",{get:function(){return this._renderTargetTexture.samples},set:function(e){this._renderTargetTexture.samples=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"refreshRate",{get:function(){return this._renderTargetTexture.refreshRate},set:function(e){this._renderTargetTexture.refreshRate=e},enumerable:!1,configurable:!0}),e.prototype.getScene=function(){return this._scene},Object.defineProperty(e.prototype,"cubeTexture",{get:function(){return this._renderTargetTexture},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"renderList",{get:function(){return this._renderTargetTexture.renderList},set:function(e){this._renderTargetTexture.renderList=e},enumerable:!1,configurable:!0}),e.prototype.attachToMesh=function(e){this._attachedMesh=e},e.prototype.setRenderingAutoClearDepthStencil=function(e,t){this._renderTargetTexture.setRenderingAutoClearDepthStencil(e,t)},e.prototype.dispose=function(){var e=this._scene.reflectionProbes.indexOf(this);if(-1!==e&&this._scene.reflectionProbes.splice(e,1),this._parentContainer){var t=this._parentContainer.reflectionProbes.indexOf(this);t>-1&&this._parentContainer.reflectionProbes.splice(t,1),this._parentContainer=null}if(this._renderTargetTexture&&(this._renderTargetTexture.dispose(),this._renderTargetTexture=null),this._sceneUBOs){for(var n=0,r=this._sceneUBOs;nthis._delay&&(this._time=this._time%this._delay,this.cellIndex+=this._direction,(this._direction>0&&this.cellIndex>this._toIndex||this._direction<0&&this.cellIndex0?this._fromIndex:this._toIndex:(this.cellIndex=this._toIndex,this._animationStarted=!1,this._onBaseAnimationEnd&&this._onBaseAnimationEnd()))))},e}());Object.defineProperty(Vt.Z.prototype,"onNewSpriteManagerAddedObservable",{get:function(){if(!this.isDisposed&&!this._onNewSpriteManagerAddedObservable){var e=this._onNewSpriteManagerAddedObservable=new l.cP;this.onDisposeObservable.addOnce((function(){return e.clear()}))}return this._onNewSpriteManagerAddedObservable},enumerable:!0,configurable:!0}),Object.defineProperty(Vt.Z.prototype,"onSpriteManagerRemovedObservable",{get:function(){if(!this.isDisposed&&!this._onSpriteManagerRemovedObservable){var e=this._onSpriteManagerRemovedObservable=new l.cP;this.onDisposeObservable.addOnce((function(){return e.clear()}))}return this._onSpriteManagerRemovedObservable},enumerable:!0,configurable:!0}),Vt.Z.prototype._internalPickSprites=function(e,t,n,r){if(!xe.G)return null;var i=null;if(!r){if(!this.activeCamera)return null;r=this.activeCamera}if(this.spriteManagers&&this.spriteManagers.length>0)for(var o=0;o=i.distance))&&(i=s,n))break}}return i||new xe.G},Vt.Z.prototype._internalMultiPickSprites=function(e,t,n){if(!xe.G)return null;var r=[];if(!n){if(!this.activeCamera)return null;n=this.activeCamera}if(this.spriteManagers&&this.spriteManagers.length>0)for(var i=0;i0&&(n=i.pickSprite(e,t,this._spritePredicate,!1,i.cameraToUseForPointers||void 0))&&n.hit&&n.pickedSprite&&n.pickedSprite.actionManager){switch(i._pickedDownSprite=n.pickedSprite,r.button){case 0:n.pickedSprite.actionManager.processTrigger(b.Y.ACTION_OnLeftPickTrigger,p.X.CreateNewFromSprite(n.pickedSprite,i,r));break;case 1:n.pickedSprite.actionManager.processTrigger(b.Y.ACTION_OnCenterPickTrigger,p.X.CreateNewFromSprite(n.pickedSprite,i,r));break;case 2:n.pickedSprite.actionManager.processTrigger(b.Y.ACTION_OnRightPickTrigger,p.X.CreateNewFromSprite(n.pickedSprite,i,r))}n.pickedSprite.actionManager&&n.pickedSprite.actionManager.processTrigger(b.Y.ACTION_OnPickDownTrigger,p.X.CreateNewFromSprite(n.pickedSprite,i,r))}return n},e.prototype._pointerUp=function(e,t,n,r,i){var o=this.scene;if(o.spriteManagers&&o.spriteManagers.length>0){var a=o.pickSprite(e,t,this._spritePredicate,!1,o.cameraToUseForPointers||void 0);a&&(a.hit&&a.pickedSprite&&a.pickedSprite.actionManager&&(a.pickedSprite.actionManager.processTrigger(b.Y.ACTION_OnPickUpTrigger,p.X.CreateNewFromSprite(a.pickedSprite,o,r)),a.pickedSprite.actionManager&&(this.scene._inputManager._isPointerSwiping()||a.pickedSprite.actionManager.processTrigger(b.Y.ACTION_OnPickTrigger,p.X.CreateNewFromSprite(a.pickedSprite,o,r)),i&&a.pickedSprite.actionManager.processTrigger(b.Y.ACTION_OnDoublePickTrigger,p.X.CreateNewFromSprite(a.pickedSprite,o,r)))),o._pickedDownSprite&&o._pickedDownSprite.actionManager&&o._pickedDownSprite!==a.pickedSprite&&o._pickedDownSprite.actionManager.processTrigger(b.Y.ACTION_OnPickOutTrigger,p.X.CreateNewFromSprite(o._pickedDownSprite,o,r)))}return n},e}(),Gb=n(57170),kb=function(){function e(e,t,n,r,i){var o;void 0===n&&(n=.01),void 0===r&&(r=null),this.blendMode=b.Y.ALPHA_COMBINE,this.autoResetAlpha=!0,this.disableDepthWrite=!1,this._fogEnabled=!0,this._pixelPerfect=!1,this._shaderLanguage=0,this._useVAO=!1,this._useInstancing=!1,this._vertexBuffers={},this._isDisposed=!1,this._shadersLoaded=!1,this._pixelPerfect=null!==(o=null==i?void 0:i.pixelPerfect)&&void 0!==o&&o,this._capacity=t,this._epsilon=n,this._engine=e,this._useInstancing=e.getCaps().instancedArrays&&e._features.supportSpriteInstancing,this._useVAO=e.getCaps().vertexArrayObject&&!e.disableVertexArrayObjects,this._scene=r,this._useInstancing||this._buildIndexBuffer(),this._vertexBufferSize=this._useInstancing?16:18,this._vertexData=new Float32Array(t*this._vertexBufferSize*(this._useInstancing?1:4)),this._buffer=new se.h(e,this._vertexData,!0,this._vertexBufferSize);var a,s=this._buffer.createVertexBuffer(se.R.PositionKind,0,4,this._vertexBufferSize,this._useInstancing),l=this._buffer.createVertexBuffer("options",4,2,this._vertexBufferSize,this._useInstancing),c=6;if(this._useInstancing){var u=new Float32Array([this._epsilon,this._epsilon,1-this._epsilon,this._epsilon,this._epsilon,1-this._epsilon,1-this._epsilon,1-this._epsilon]);this._spriteBuffer=new se.h(e,u,!1,2),a=this._spriteBuffer.createVertexBuffer("offsets",0,2)}else a=this._buffer.createVertexBuffer("offsets",c,2,this._vertexBufferSize,this._useInstancing),c+=2;var h=this._buffer.createVertexBuffer("inverts",c,2,this._vertexBufferSize,this._useInstancing),d=this._buffer.createVertexBuffer("cellInfo",c+2,4,this._vertexBufferSize,this._useInstancing),p=this._buffer.createVertexBuffer(se.R.ColorKind,c+6,4,this._vertexBufferSize,this._useInstancing);this._vertexBuffers[se.R.PositionKind]=s,this._vertexBuffers.options=l,this._vertexBuffers.offsets=a,this._vertexBuffers.inverts=h,this._vertexBuffers.cellInfo=d,this._vertexBuffers[se.R.ColorKind]=p,this._initShaderSourceAsync()}return Object.defineProperty(e.prototype,"fogEnabled",{get:function(){return this._fogEnabled},set:function(e){this._fogEnabled!==e&&(this._fogEnabled=e,this._createEffects())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"useLogarithmicDepth",{get:function(){return this._useLogarithmicDepth},set:function(e){var t,n=!!(null===(t=this._scene)||void 0===t?void 0:t.getEngine().getCaps().fragmentDepthSupported);e&&!n&&y.V.Warn("Logarithmic depth has been requested for a sprite renderer on a device that doesn't support it."),this._useLogarithmicDepth=e&&n,this._createEffects()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"capacity",{get:function(){return this._capacity},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pixelPerfect",{get:function(){return this._pixelPerfect},set:function(e){this._pixelPerfect!==e&&(this._pixelPerfect=e,this._createEffects())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shaderLanguage",{get:function(){return this._shaderLanguage},enumerable:!1,configurable:!0}),e.prototype._initShaderSourceAsync=function(){return(0,f.sH)(this,void 0,void 0,(function(){return(0,f.YH)(this,(function(t){switch(t.label){case 0:return!this._engine.isWebGPU||e.ForceGLSL?[3,2]:(this._shaderLanguage=1,[4,Promise.all([Promise.resolve().then(n.bind(n,98179)),Promise.resolve().then(n.bind(n,89493))])]);case 1:return t.sent(),[3,4];case 2:return[4,Promise.all([Promise.resolve().then(n.bind(n,25792)),Promise.resolve().then(n.bind(n,22088))])];case 3:t.sent(),t.label=4;case 4:return this._shadersLoaded=!0,this._createEffects(),[2]}}))}))},e.prototype._createEffects=function(){var e,t;if(!this._isDisposed&&this._shadersLoaded){null===(e=this._drawWrapperBase)||void 0===e||e.dispose(),null===(t=this._drawWrapperDepth)||void 0===t||t.dispose(),this._drawWrapperBase=new fe.E(this._engine),this._drawWrapperDepth=new fe.E(this._engine,!1),this._drawWrapperBase.drawContext&&(this._drawWrapperBase.drawContext.useInstancing=this._useInstancing),this._drawWrapperDepth.drawContext&&(this._drawWrapperDepth.drawContext.useInstancing=this._useInstancing);var n="";this._pixelPerfect&&(n+="#define PIXEL_PERFECT\n"),this._scene&&this._scene.fogEnabled&&0!==this._scene.fogMode&&this._fogEnabled&&(n+="#define FOG\n"),this._useLogarithmicDepth&&(n+="#define LOGARITHMICDEPTH\n"),this._drawWrapperBase.effect=this._engine.createEffect("sprites",[se.R.PositionKind,"options","offsets","inverts","cellInfo",se.R.ColorKind],["view","projection","textureInfos","alphaTest","vFogInfos","vFogColor","logarithmicDepthConstant"],["diffuseSampler"],n,void 0,void 0,void 0,void 0,this._shaderLanguage),this._drawWrapperDepth.effect=this._drawWrapperBase.effect,this._drawWrapperBase.effect._refCount++,this._drawWrapperDepth.materialContext=this._drawWrapperBase.materialContext}},e.prototype.render=function(e,t,n,r,i){if(void 0===i&&(i=null),this._shadersLoaded&&this.texture&&this.texture.isReady()&&e.length){var o=this._drawWrapperBase,a=this._drawWrapperDepth,s=this.fogEnabled&&this._scene&&this._scene.fogEnabled&&0!==this._scene.fogMode,l=o.effect;if(l.isReady()){for(var c=this._engine,u=!(!this._scene||!this._scene.useRightHandedSystem),h=Math.min(this._capacity,e.length),d=0,p=!0,f=0;f0);var u=e.substring(0,c-1)+".json";Z.S0.LoadFile(u,(function(e){try{var t=JSON.parse(e),r=Reflect.ownKeys(t.frames);n._spriteMap=r,n._packedAndReady=!0,n._cellData=t.frames}catch(e){throw n._fromPacked=!1,n._packedAndReady=!1,new Error("Invalid JSON format. Please check documentation for format specifications.")}}),void 0,void 0,!1,(function(){y.V.Error("JSON ERROR: Unable to load JSON file."),n._fromPacked=!1,n._packedAndReady=!1}))}},e.prototype._checkTextureAlpha=function(e,t,n,r,i){var o;if(!e.useAlphaForPicking||!(null===(o=this.texture)||void 0===o?void 0:o.isReady()))return!0;var a=this.texture.getSize();this._textureContent||(this._textureContent=new Uint8Array(a.width*a.height*4),this.texture.readPixels(0,0,this._textureContent));var s=c.AA.Vector3[0];s.copyFrom(t.direction),s.normalize(),s.scaleInPlace(n),s.addInPlace(t.origin);var l=(s.x-r.x)/(i.x-r.x),u=1-(s.y-r.y)/(i.y-r.y),h=e._xOffset*a.width+l*e._xSize|0,d=e._yOffset*a.height+u*e._ySize|0;return this._textureContent[4*(h+d*a.width)+3]>.5},e.prototype.intersects=function(e,t,n,r){for(var i=Math.min(this.capacity,this.sprites.length),o=c.Pq.Zero(),a=c.Pq.Zero(),s=Number.MAX_VALUE,l=null,u=c.AA.Vector3[0],h=c.AA.Vector3[1],d=t.getViewMatrix(),p=e,f=e,m=0;mg){if(!this._checkTextureAlpha(_,p,g,o,a))continue;if(f=p,s=g,l=_,r)break}}}}if(l){var v=new xe.G;d.invertToRef(c.AA.Matrix[0]),v.hit=!0,v.pickedSprite=l,v.distance=s;var y=c.AA.Vector3[2];return y.copyFrom(f.direction),y.normalize(),y.scaleInPlace(s),f.origin.addToRef(y,u),v.pickedPoint=c.Pq.TransformCoordinates(u,c.AA.Matrix[0]),v}return null},e.prototype.multiIntersects=function(e,t,n){for(var r,i=Math.min(this.capacity,this.sprites.length),o=c.Pq.Zero(),a=c.Pq.Zero(),s=[],l=c.AA.Vector3[0].copyFromFloats(0,0,0),u=c.AA.Vector3[1].copyFromFloats(0,0,0),h=t.getViewMatrix(),d=0;d0){var r=t._waitingData.lods.ids,i=n.isEnabled(!1);if(t._waitingData.lods.distances){var o=t._waitingData.lods.distances;if(o.length>=r.length){var a=o.length>r.length?o[o.length-1]:0;n.setEnabled(!1);for(var s=0;s0&&n.addLODLevel(a,null),!0===i&&n.setEnabled(!0)}else Z.S0.Warn("Invalid level of detail distances for "+t.name)}}t._waitingData.lods=null}},Qb=function(e,t,n){if("number"!=typeof e){var r=n.getLastEntryById(e);return r&&null!=t?r.instances[parseInt(t)]:r}var i=Yb[e];return i&&null!=t?i.instances[parseInt(t)]:i},Jb=function(e,t){return"number"!=typeof e?t.getLastMaterialById(e,!0):Xb[e]};function $b(e,t,n){return eS(e,t,n)}var eS=function(e,t,n,r,i){void 0===i&&(i=!1);var o=new et(e),a="importScene has failed JSON parse";try{var s="object"==typeof t?t:JSON.parse(t);a="";var l=ve.loggingLevel===b.Y.SCENELOADER_DETAILED_LOGGING,c=void 0,u=void 0;if(void 0!==s.environmentTexture&&null!==s.environmentTexture){var d=void 0===s.isPBR||s.isPBR;if(s.environmentTextureType&&"BABYLON.HDRCubeTexture"===s.environmentTextureType){var p=s.environmentTextureSize?s.environmentTextureSize:128,f=new Rb((s.environmentTexture.match(/https?:\/\//g)?"":n)+s.environmentTexture,e,p,!0,!d,void 0,s.environmentTexturePrefilterOnLoad);s.environmentTextureRotationY&&(f.rotationY=s.environmentTextureRotationY),e.environmentTexture=f}else if("object"==typeof s.environmentTexture){var m=Y_.Parse(s.environmentTexture,e,n);e.environmentTexture=m}else if(s.environmentTexture.endsWith(".env")){var _=new Y_((s.environmentTexture.match(/https?:\/\//g)?"":n)+s.environmentTexture,e,s.environmentTextureForcedExtension);s.environmentTextureRotationY&&(_.rotationY=s.environmentTextureRotationY),e.environmentTexture=_}else{var g=Y_.CreateFromPrefilteredData((s.environmentTexture.match(/https?:\/\//g)?"":n)+s.environmentTexture,e,s.environmentTextureForcedExtension);s.environmentTextureRotationY&&(g.rotationY=s.environmentTextureRotationY),e.environmentTexture=g}if(!0===s.createDefaultSkybox){var v=void 0!==e.activeCamera&&null!==e.activeCamera?(e.activeCamera.maxZ-e.activeCamera.minZ)/2:1e3,S=s.skyboxBlurLevel||0;e.createDefaultSkybox(e.environmentTexture,d,v,S)}o.environmentTexture=e.environmentTexture}if(void 0!==s.environmentIntensity&&null!==s.environmentIntensity&&(e.environmentIntensity=s.environmentIntensity),void 0!==s.iblIntensity&&null!==s.iblIntensity&&(e.iblIntensity=s.iblIntensity),void 0!==s.lights&&null!==s.lights)for(c=0,u=s.lights.length;c0){for(var He=0;He0){for(var Xe=0;Xe-1))for(var U=0,G=c.skeletons.length;U-1&&void 0!==c.morphTargetManagers&&null!==c.morphTargetManagers&&!(E.indexOf(s.morphTargetManagerId)>-1))for(var W=0;Wn-o)return void(1==o?y.V.Error("Float property ".concat(i.name," has an offset that is too large.")):y.V.Error("Vector".concat(o," property ").concat(i.name," won't fit in Vector").concat(n," or has an offset that is too large.")));"number"==typeof i.value?e._tmpArray[i.targetUniformComponentOffset]=i.value:i.value.toArray(e._tmpArray,i.targetUniformComponentOffset)}t.fromArray(e._tmpArray)},e._tmpArray=[0,0,0,0],e}(),fS=function(){function e(e,t,n,r,i){void 0===i&&(i=0),this.targetUniformComponentNum=4,this.targetUniformComponentOffset=0,this.name=e,this.targetUniformName=n,this.defaultValue=t,this.value=t,this.targetUniformComponentNum=r,this.targetUniformComponentOffset=i}return Object.defineProperty(e.prototype,"numComponents",{get:function(){return"number"==typeof this.defaultValue?1:this.defaultValue.dimension[0]},enumerable:!1,configurable:!0}),e}(),mS=function(){function e(e,t,n){this.value=null,this.samplerPrefix="",this.textureDefine="",this.name=e,this.samplerPrefix=t,this.textureDefine=n}return Object.defineProperty(e.prototype,"samplerName",{get:function(){return this.samplerPrefix+"Sampler"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"samplerInfoName",{get:function(){return"v"+this.samplerPrefix.charAt(0).toUpperCase()+this.samplerPrefix.slice(1)+"Infos"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"samplerMatrixName",{get:function(){return this.samplerPrefix+"Matrix"},enumerable:!1,configurable:!0}),e}(),_S=function(e){function t(t){var n=e.call(this,t)||this;return n.NUM_SAMPLES="0",n.REALTIME_FILTERING=!1,n.IBL_CDF_FILTERING=!1,n.VERTEXCOLOR=!1,n.BAKED_VERTEX_ANIMATION_TEXTURE=!1,n.VERTEXALPHA=!1,n.ALPHATEST=!1,n.DEPTHPREPASS=!1,n.ALPHABLEND=!1,n.ALPHA_FROM_BASE_COLOR_TEXTURE=!1,n.ALPHATESTVALUE="0.5",n.PREMULTIPLYALPHA=!1,n.REFLECTIVITY_GAMMA=!1,n.REFLECTIVITYDIRECTUV=0,n.SPECULARTERM=!1,n.LODBASEDMICROSFURACE=!0,n.METALLICWORKFLOW=!0,n.ROUGHNESSSTOREINMETALMAPALPHA=!1,n.ROUGHNESSSTOREINMETALMAPGREEN=!1,n.METALLNESSSTOREINMETALMAPBLUE=!1,n.AOSTOREINMETALMAPRED=!1,n.SPECULAR_WEIGHT_IN_ALPHA=!1,n.SPECULAR_WEIGHT_FROM_SPECULAR_COLOR_TEXTURE=!1,n.SPECULAR_ROUGHNESS_ANISOTROPY_FROM_TANGENT_TEXTURE=!1,n.COAT_ROUGHNESS_ANISOTROPY_FROM_TANGENT_TEXTURE=!1,n.USE_GLTF_STYLE_ANISOTROPY=!1,n.THIN_FILM_THICKNESS_FROM_THIN_FILM_TEXTURE=!1,n.ENVIRONMENTBRDF=!1,n.ENVIRONMENTBRDF_RGBD=!1,n.FUZZENVIRONMENTBRDF=!1,n.NORMAL=!1,n.TANGENT=!1,n.OBJECTSPACE_NORMALMAP=!1,n.PARALLAX=!1,n.PARALLAX_RHS=!1,n.PARALLAXOCCLUSION=!1,n.NORMALXYSCALE=!0,n.ANISOTROPIC=!1,n.ANISOTROPIC_OPENPBR=!0,n.ANISOTROPIC_BASE=!1,n.ANISOTROPIC_COAT=!1,n.FUZZ_IBL_SAMPLES=6,n.FUZZ=!1,n.THIN_FILM=!1,n.IRIDESCENCE=!1,n.REFLECTION=!1,n.REFLECTIONMAP_3D=!1,n.REFLECTIONMAP_SPHERICAL=!1,n.REFLECTIONMAP_PLANAR=!1,n.REFLECTIONMAP_CUBIC=!1,n.USE_LOCAL_REFLECTIONMAP_CUBIC=!1,n.REFLECTIONMAP_PROJECTION=!1,n.REFLECTIONMAP_SKYBOX=!1,n.REFLECTIONMAP_EXPLICIT=!1,n.REFLECTIONMAP_EQUIRECTANGULAR=!1,n.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,n.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,n.INVERTCUBICMAP=!1,n.USESPHERICALFROMREFLECTIONMAP=!1,n.USEIRRADIANCEMAP=!1,n.USE_IRRADIANCE_DOMINANT_DIRECTION=!1,n.USESPHERICALINVERTEX=!1,n.REFLECTIONMAP_OPPOSITEZ=!1,n.LODINREFLECTIONALPHA=!1,n.GAMMAREFLECTION=!1,n.RGBDREFLECTION=!1,n.RADIANCEOCCLUSION=!1,n.HORIZONOCCLUSION=!1,n.INSTANCES=!1,n.THIN_INSTANCES=!1,n.INSTANCESCOLOR=!1,n.PREPASS=!1,n.PREPASS_COLOR=!1,n.PREPASS_COLOR_INDEX=-1,n.PREPASS_IRRADIANCE=!1,n.PREPASS_IRRADIANCE_INDEX=-1,n.PREPASS_ALBEDO=!1,n.PREPASS_ALBEDO_INDEX=-1,n.PREPASS_ALBEDO_SQRT=!1,n.PREPASS_ALBEDO_SQRT_INDEX=-1,n.PREPASS_DEPTH=!1,n.PREPASS_DEPTH_INDEX=-1,n.PREPASS_SCREENSPACE_DEPTH=!1,n.PREPASS_SCREENSPACE_DEPTH_INDEX=-1,n.PREPASS_NORMALIZED_VIEW_DEPTH=!1,n.PREPASS_NORMALIZED_VIEW_DEPTH_INDEX=-1,n.PREPASS_NORMAL=!1,n.PREPASS_NORMAL_INDEX=-1,n.PREPASS_NORMAL_WORLDSPACE=!1,n.PREPASS_WORLD_NORMAL=!1,n.PREPASS_WORLD_NORMAL_INDEX=-1,n.PREPASS_POSITION=!1,n.PREPASS_POSITION_INDEX=-1,n.PREPASS_LOCAL_POSITION=!1,n.PREPASS_LOCAL_POSITION_INDEX=-1,n.PREPASS_VELOCITY=!1,n.PREPASS_VELOCITY_INDEX=-1,n.PREPASS_VELOCITY_LINEAR=!1,n.PREPASS_VELOCITY_LINEAR_INDEX=-1,n.PREPASS_REFLECTIVITY=!1,n.PREPASS_REFLECTIVITY_INDEX=-1,n.SCENE_MRT_COUNT=0,n.NUM_BONE_INFLUENCERS=0,n.BonesPerMesh=0,n.BONETEXTURE=!1,n.BONES_VELOCITY_ENABLED=!1,n.NONUNIFORMSCALING=!1,n.MORPHTARGETS=!1,n.MORPHTARGETS_POSITION=!1,n.MORPHTARGETS_NORMAL=!1,n.MORPHTARGETS_TANGENT=!1,n.MORPHTARGETS_UV=!1,n.MORPHTARGETS_UV2=!1,n.MORPHTARGETS_COLOR=!1,n.MORPHTARGETTEXTURE_HASPOSITIONS=!1,n.MORPHTARGETTEXTURE_HASNORMALS=!1,n.MORPHTARGETTEXTURE_HASTANGENTS=!1,n.MORPHTARGETTEXTURE_HASUVS=!1,n.MORPHTARGETTEXTURE_HASUV2S=!1,n.MORPHTARGETTEXTURE_HASCOLORS=!1,n.NUM_MORPH_INFLUENCERS=0,n.MORPHTARGETS_TEXTURE=!1,n.USEPHYSICALLIGHTFALLOFF=!1,n.USEGLTFLIGHTFALLOFF=!1,n.TWOSIDEDLIGHTING=!1,n.MIRRORED=!1,n.SHADOWFLOAT=!1,n.CLIPPLANE=!1,n.CLIPPLANE2=!1,n.CLIPPLANE3=!1,n.CLIPPLANE4=!1,n.CLIPPLANE5=!1,n.CLIPPLANE6=!1,n.POINTSIZE=!1,n.FOG=!1,n.LOGARITHMICDEPTH=!1,n.CAMERA_ORTHOGRAPHIC=!1,n.CAMERA_PERSPECTIVE=!1,n.AREALIGHTSUPPORTED=!0,n.FORCENORMALFORWARD=!1,n.SPECULARAA=!1,n.UNLIT=!1,n.DECAL_AFTER_DETAIL=!1,n.DEBUGMODE=0,n.CLUSTLIGHT_SLICES=0,n.CLUSTLIGHT_BATCH=0,n.BRDF_V_HEIGHT_CORRELATED=!0,n.MS_BRDF_ENERGY_CONSERVATION=!0,n.SPHERICAL_HARMONICS=!0,n.SPECULAR_GLOSSINESS_ENERGY_CONSERVATION=!0,n.MIX_IBL_RADIANCE_WITH_IRRADIANCE=!0,n.LEGACY_SPECULAR_ENERGY_CONSERVATION=!1,n.BASE_DIFFUSE_MODEL=b.Y.MATERIAL_DIFFUSE_MODEL_E_OREN_NAYAR,n.DIELECTRIC_SPECULAR_MODEL=b.Y.MATERIAL_DIELECTRIC_SPECULAR_MODEL_OPENPBR,n.CONDUCTOR_SPECULAR_MODEL=b.Y.MATERIAL_CONDUCTOR_SPECULAR_MODEL_OPENPBR,n.rebuild(),n}return(0,f.C6)(t,e),t.prototype.reset=function(){e.prototype.reset.call(this),this.ALPHATESTVALUE="0.5",this.NORMALXYSCALE=!0},t}(po(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,f.C6)(t,e),t}(No(ho)))),gS=function(e){function t(n,r,i){var o;void 0===i&&(i=!1);var a=e.call(this,n,r,void 0,i||t.ForceGLSL)||this;a._baseWeight=new fS("base_weight",1,"vBaseWeight",1),a._baseWeightTexture=new mS("base_weight","baseWeight","BASE_WEIGHT"),a._baseColor=new fS("base_color",u.v9.White(),"vBaseColor",4),a._baseColorTexture=new mS("base_color","baseColor","BASE_COLOR"),a._baseDiffuseRoughness=new fS("base_diffuse_roughness",0,"vBaseDiffuseRoughness",1),a._baseDiffuseRoughnessTexture=new mS("base_diffuse_roughness","baseDiffuseRoughness","BASE_DIFFUSE_ROUGHNESS"),a._baseMetalness=new fS("base_metalness",0,"vReflectanceInfo",4,0),a._baseMetalnessTexture=new mS("base_metalness","baseMetalness","BASE_METALNESS"),a._specularWeight=new fS("specular_weight",1,"vReflectanceInfo",4,3),a._specularWeightTexture=new mS("specular_weight","specularWeight","SPECULAR_WEIGHT"),a._specularColor=new fS("specular_color",u.v9.White(),"vSpecularColor",4),a._specularColorTexture=new mS("specular_color","specularColor","SPECULAR_COLOR"),a._specularRoughness=new fS("specular_roughness",.3,"vReflectanceInfo",4,1),a._specularRoughnessTexture=new mS("specular_roughness","specularRoughness","SPECULAR_ROUGHNESS"),a._specularRoughnessAnisotropy=new fS("specular_roughness_anisotropy",0,"vSpecularAnisotropy",3,2),a._specularRoughnessAnisotropyTexture=new mS("specular_roughness_anisotropy","specularRoughnessAnisotropy","SPECULAR_ROUGHNESS_ANISOTROPY"),a._specularIor=new fS("specular_ior",1.5,"vReflectanceInfo",4,2),a._coatWeight=new fS("coat_weight",0,"vCoatWeight",1,0),a._coatWeightTexture=new mS("coat_weight","coatWeight","COAT_WEIGHT"),a._coatColor=new fS("coat_color",u.v9.White(),"vCoatColor",3,0),a._coatColorTexture=new mS("coat_color","coatColor","COAT_COLOR"),a._coatRoughness=new fS("coat_roughness",0,"vCoatRoughness",1,0),a._coatRoughnessTexture=new mS("coat_roughness","coatRoughness","COAT_ROUGHNESS"),a._coatRoughnessAnisotropy=new fS("coat_roughness_anisotropy",0,"vCoatRoughnessAnisotropy",1),a._coatRoughnessAnisotropyTexture=new mS("coat_roughness_anisotropy","coatRoughnessAnisotropy","COAT_ROUGHNESS_ANISOTROPY"),a._coatIor=new fS("coat_ior",1.5,"vCoatIor",1,0),a._coatDarkening=new fS("coat_darkening",1,"vCoatDarkening",1,0),a._coatDarkeningTexture=new mS("coat_darkening","coatDarkening","COAT_DARKENING"),a.useCoatRoughnessFromWeightTexture=!1,a._fuzzWeight=new fS("fuzz_weight",0,"vFuzzWeight",1,0),a._fuzzWeightTexture=new mS("fuzz_weight","fuzzWeight","FUZZ_WEIGHT"),a._fuzzColor=new fS("fuzz_color",u.v9.White(),"vFuzzColor",3,0),a._fuzzColorTexture=new mS("fuzz_color","fuzzColor","FUZZ_COLOR"),a._fuzzRoughness=new fS("fuzz_roughness",.5,"vFuzzRoughness",1,0),a._fuzzRoughnessTexture=new mS("fuzz_roughness","fuzzRoughness","FUZZ_ROUGHNESS"),a._geometryNormalTexture=new mS("geometry_normal","geometryNormal","GEOMETRY_NORMAL"),a._geometryTangent=new fS("geometry_tangent",new c.I9(1,0),"vSpecularAnisotropy",3,0),a._geometryTangentTexture=new mS("geometry_tangent","geometryTangent","GEOMETRY_TANGENT"),a._geometryCoatNormalTexture=new mS("geometry_coat_normal","geometryCoatNormal","GEOMETRY_COAT_NORMAL"),a._geometryCoatTangent=new fS("geometry_coat_tangent",new c.I9(1,0),"vGeometryCoatTangent",2,0),a._geometryCoatTangentTexture=new mS("geometry_coat_tangent","geometryCoatTangent","GEOMETRY_COAT_TANGENT"),a._geometryOpacity=new fS("geometry_opacity",1,"vBaseColor",4,3),a._geometryOpacityTexture=new mS("geometry_opacity","geometryOpacity","GEOMETRY_OPACITY"),a._emissionLuminance=new fS("emission_luminance",1,"vLightingIntensity",4,1),a._emissionColor=new fS("emission_color",u.v9.Black(),"vEmissionColor",3),a._emissionColorTexture=new mS("emission_color","emissionColor","EMISSION_COLOR"),a._thinFilmWeight=new fS("thin_film_weight",0,"vThinFilmWeight",1,0),a._thinFilmWeightTexture=new mS("thin_film_weight","thinFilmWeight","THIN_FILM_WEIGHT"),a._thinFilmThickness=new fS("thin_film_thickness",.5,"vThinFilmThickness",2,0),a._thinFilmThicknessMin=new fS("thin_film_thickness_min",0,"vThinFilmThickness",2,1),a._thinFilmThicknessTexture=new mS("thin_film_thickness","thinFilmThickness","THIN_FILM_THICKNESS"),a._thinFilmIor=new fS("thin_film_ior",1.4,"vThinFilmIor",1,0),a._ambientOcclusionTexture=new mS("ambient_occlusion","ambientOcclusion","AMBIENT_OCCLUSION"),a._uniformsList={},a._samplersList={},a._samplerDefines={},a.directIntensity=1,a.environmentIntensity=1,a.useSpecularWeightFromTextureAlpha=!1,a.forceAlphaTest=!1,a.alphaCutOff=.4,a.useAmbientOcclusionFromMetallicTextureRed=!1,a.useAmbientInGrayScale=!1,a.useObjectSpaceNormalMap=!1,a.useParallax=!1,a.useParallaxOcclusion=!1,a.parallaxScaleBias=.05,a.disableLighting=!1,a.forceIrradianceInFragment=!1,a.maxSimultaneousLights=4,a.invertNormalMapX=!1,a.invertNormalMapY=!1,a.twoSidedLighting=!1,a.useAlphaFresnel=!1,a.useLinearAlphaFresnel=!1,a.environmentBRDFTexture=null,a.forceNormalForward=!1,a.enableSpecularAntiAliasing=!1,a.useHorizonOcclusion=!0,a.useRadianceOcclusion=!0,a.unlit=!1,a.applyDecalMapAfterDetailMap=!1,a._lightingInfos=new c.IU(a.directIntensity,1,a.environmentIntensity,1),a._radianceTexture=null,a._useSpecularWeightFromAlpha=!1,a._useSpecularWeightFromSpecularColorTexture=!1,a._useSpecularRoughnessAnisotropyFromTangentTexture=!1,a._useCoatRoughnessAnisotropyFromTangentTexture=!1,a._useGltfStyleAnisotropy=!1,a._useHorizonOcclusion=!0,a._useRadianceOcclusion=!0,a._useAlphaFromBaseColorTexture=!1,a._useAmbientOcclusionFromMetallicTextureRed=!1,a._useRoughnessFromMetallicTextureGreen=!1,a._useMetallicFromMetallicTextureBlue=!1,a._useThinFilmThicknessFromTextureGreen=!1,a._lightFalloff=Be.LIGHTFALLOFF_PHYSICAL,a._useObjectSpaceNormalMap=!1,a._useParallax=!1,a._useParallaxOcclusion=!1,a._parallaxScaleBias=.05,a._disableLighting=!1,a._maxSimultaneousLights=4,a._invertNormalMapX=!1,a._invertNormalMapY=!1,a._twoSidedLighting=!1,a._alphaCutOff=.4,a._useAlphaFresnel=!1,a._useLinearAlphaFresnel=!1,a._environmentBRDFTexture=null,a._environmentFuzzBRDFTexture=null,a._forceIrradianceInFragment=!1,a._realTimeFiltering=!1,a._realTimeFilteringQuality=b.Y.TEXTURE_FILTERING_QUALITY_LOW,a._fuzzSampleNumber=4,a._forceNormalForward=!1,a._enableSpecularAntiAliasing=!1,a._renderTargets=new co.L(16),a._unlit=!1,a._applyDecalMapAfterDetailMap=!1,a._debugMode=0,a._shadersLoaded=!1,a._breakShaderLoadedCheck=!1,a.debugMode=0,a.debugLimit=-1,a.debugFactor=1,a._cacheHasRenderTargetTextures=!1,a._transparencyMode=Be.MATERIAL_OPAQUE,a.getScene()&&!(null===(o=a.getScene())||void 0===o?void 0:o.getEngine().isWebGPU)&&a.getScene().getEngine().webGLVersion<2&&y.V.Error("OpenPBRMaterial: WebGL 2.0 or above is required for this material."),t._noiseTextures[a.getScene().uniqueId]||(t._noiseTextures[a.getScene().uniqueId]=new _n.g("https://assets.babylonjs.com/textures/blue_noise/blue_noise_rgb.png",a.getScene(),!1,!0,b.Y.TEXTURE_NEAREST_SAMPLINGMODE),a.getScene().onDisposeObservable.addOnce((function(){var e;null===(e=t._noiseTextures[a.getScene().uniqueId])||void 0===e||e.dispose(),delete t._noiseTextures[a.getScene().uniqueId]}))),a._attachImageProcessingConfiguration(null),a.getRenderTargetTextures=function(){return a._renderTargets.reset(),_o.h.ReflectionTextureEnabled&&a._radianceTexture&&a._radianceTexture.isRenderTarget&&a._renderTargets.push(a._radianceTexture),a._eventInfo.renderTargets=a._renderTargets,a._callbackPluginEventFillRenderTargetTextures(a._eventInfo),a._renderTargets},a._environmentBRDFTexture=eg(a.getScene()),a._environmentFuzzBRDFTexture=tg(a.getScene()),a.prePassConfiguration=new uo,a._propertyList={};for(var s=0,l=Object.getOwnPropertyNames(a);s0&&t.push(r.value)}return this._radianceTexture&&this._radianceTexture.animations&&this._radianceTexture.animations.length>0&&t.push(this._radianceTexture),t},t.prototype.getActiveTextures=function(){var t=e.prototype.getActiveTextures.call(this);for(var n in this._samplersList){var r=this._samplersList[n];r.value&&t.push(r.value)}return this._radianceTexture&&t.push(this._radianceTexture),t},t.prototype.hasTexture=function(t){if(e.prototype.hasTexture.call(this,t))return!0;for(var n in this._samplersList)if(this._samplersList[n].value===t)return!0;return this._radianceTexture===t},t.prototype.setPrePassRenderer=function(){return!1},t.prototype.dispose=function(t,n){var r,i;if(this._breakShaderLoadedCheck=!0,n){for(var o in this._environmentBRDFTexture&&this.getScene().environmentBRDFTexture!==this._environmentBRDFTexture&&this._environmentBRDFTexture.dispose(),this._environmentFuzzBRDFTexture&&this.getScene().environmentFuzzBRDFTexture!==this._environmentFuzzBRDFTexture&&this._environmentFuzzBRDFTexture.dispose(),this._samplersList)null===(r=this._samplersList[o].value)||void 0===r||r.dispose();null===(i=this._radianceTexture)||void 0===i||i.dispose()}this._renderTargets.dispose(),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),e.prototype.dispose.call(this,t,n)},t.prototype._getRadianceTexture=function(){return this._radianceTexture?this._radianceTexture:this.getScene().environmentTexture},t.prototype._prepareEffect=function(e,t,r,i,o,a,s){var l=this;if(void 0===i&&(i=null),void 0===o&&(o=null),void 0===a&&(a=null),void 0===s&&(s=null),this._prepareDefines(e,t,r,a,s),!r.isDirty)return null;r.markAsProcessed();var c=this.getScene().getEngine(),u=new go.J,h=0;r.USESPHERICALINVERTEX&&u.addFallback(h++,"USESPHERICALINVERTEX"),r.FOG&&u.addFallback(h,"FOG"),r.SPECULARAA&&u.addFallback(h,"SPECULARAA"),r.POINTSIZE&&u.addFallback(h,"POINTSIZE"),r.LOGARITHMICDEPTH&&u.addFallback(h,"LOGARITHMICDEPTH"),r.PARALLAX&&u.addFallback(h,"PARALLAX"),r.PARALLAX_RHS&&u.addFallback(h,"PARALLAX_RHS"),r.PARALLAXOCCLUSION&&u.addFallback(h++,"PARALLAXOCCLUSION"),r.ENVIRONMENTBRDF&&u.addFallback(h++,"ENVIRONMENTBRDF"),r.TANGENT&&u.addFallback(h++,"TANGENT"),h=(0,Le.c4)(r,u,this._maxSimultaneousLights,h++),r.SPECULARTERM&&u.addFallback(h++,"SPECULARTERM"),r.USESPHERICALFROMREFLECTIONMAP&&u.addFallback(h++,"USESPHERICALFROMREFLECTIONMAP"),r.USEIRRADIANCEMAP&&u.addFallback(h++,"USEIRRADIANCEMAP"),r.NORMAL&&u.addFallback(h++,"NORMAL"),r.VERTEXCOLOR&&u.addFallback(h++,"VERTEXCOLOR"),r.MORPHTARGETS&&u.addFallback(h++,"MORPHTARGETS"),r.MULTIVIEW&&u.addFallback(0,"MULTIVIEW");var d=[se.R.PositionKind];r.NORMAL&&d.push(se.R.NormalKind),r.TANGENT&&d.push(se.R.TangentKind);for(var p=1;p<=b.Y.MAX_SUPPORTED_UV_SETS;++p)r["UV"+p]&&d.push("uv".concat(1===p?"":p));r.VERTEXCOLOR&&d.push(se.R.ColorKind),(0,Le.ni)(d,e,r,u),(0,Le.ER)(d,r),(0,Le.IF)(d,e,r),(0,Le.J2)(d,e,r);var m="openpbr",_=["world","view","viewProjection","vEyePosition","vLightsType","visibility","vFogInfos","vFogColor","pointSize","mBones","normalMatrix","vLightingIntensity","logarithmicDepthConstant","vTangentSpaceParams","boneTextureWidth","vDebugMode","morphTargetTextureInfo","morphTargetTextureIndices","cameraInfo"];for(var g in this._uniformsList)_.push(g);var v=["environmentBrdfSampler","blueNoiseSampler","boneSampler","morphTargets","oitDepthSampler","oitFrontColorSampler","areaLightsLTC1Sampler","areaLightsLTC2Sampler"];for(var y in r.FUZZENVIRONMENTBRDF&&v.push("environmentFuzzBrdfSampler"),this._samplersList){var S=this._samplersList[y];v.push(S.samplerName),_.push(S.samplerInfoName),_.push(S.samplerMatrixName)}(0,Le.B1)(_,v,!0);var T=["Material","Scene","Mesh"],E={maxSimultaneousLights:this._maxSimultaneousLights,maxSimultaneousMorphTargets:r.NUM_MORPH_INFLUENCERS};this._eventInfo.fallbacks=u,this._eventInfo.fallbackRank=h,this._eventInfo.defines=r,this._eventInfo.uniforms=_,this._eventInfo.attributes=d,this._eventInfo.samplers=v,this._eventInfo.uniformBuffersNames=T,this._eventInfo.customCode=void 0,this._eventInfo.mesh=e,this._eventInfo.indexParameters=E,this._callbackPluginEventGeneric(128,this._eventInfo),Do.AddUniformsAndSamplers(_,v),uo.AddUniforms(_),uo.AddSamplers(v),(0,Mo.Ll)(_),lo.p&&(lo.p.PrepareUniforms(_,r),lo.p.PrepareSamplers(v,r)),(0,Le.Bb)({uniformsNames:_,uniformBuffersNames:T,samplers:v,defines:r,maxSimultaneousLights:this._maxSimultaneousLights});var x={};this.customShaderNameResolve&&(m=this.customShaderNameResolve(m,_,T,v,r,d,x));var P=r.toString(),C=c.createEffect(m,{attributes:d,uniformsNames:_,uniformBuffersNames:T,samplers:v,defines:P,fallbacks:u,onCompiled:i,onError:o,indexParameters:E,processFinalCode:x.processFinalCode,processCodeAfterIncludes:this._eventInfo.customCode,multiTarget:r.PREPASS,shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:function(){return(0,f.sH)(l,void 0,void 0,(function(){return(0,f.YH)(this,(function(e){switch(e.label){case 0:return 1!==this.shaderLanguage?[3,2]:[4,Promise.all([Promise.resolve().then(n.bind(n,10752)),Promise.resolve().then(n.bind(n,27082))])];case 1:return e.sent(),[3,4];case 2:return[4,Promise.all([Promise.resolve().then(n.bind(n,32299)),Promise.resolve().then(n.bind(n,64541))])];case 3:e.sent(),e.label=4;case 4:return this._shadersLoaded=!0,[2]}}))}))}},c);return this._eventInfo.customCode=void 0,C},t.prototype._prepareDefines=function(e,n,r,i,o){void 0===i&&(i=null),void 0===o&&(o=null);var a=n.hasThinInstances,s=this.getScene(),l=s.getEngine();(0,Le.az)(s,e,r,!0,this._maxSimultaneousLights,this._disableLighting),r._needNormals=!0,(0,Le.VO)(s,r);var c=this.needAlphaBlendingForMesh(e)&&this.getScene().useOrderIndependentTransparency;if((0,Le.N4)(s,r,this.canRenderToMRT&&!c),(0,Le.Nc)(s,r,c),Do.PrepareDefines(l.currentRenderPassId,e,r),r.METALLICWORKFLOW=!0,r._areTexturesDirty){r._needUVs=!1;for(var u=1;u<=b.Y.MAX_SUPPORTED_UV_SETS;++u)r["MAINUV"+u]=!1;if(s.texturesEnabled){for(var h in this._samplersList){var d=this._samplersList[h];d.value?((0,Le.YT)(d.value,r,d.textureDefine),r[d.textureDefine+"_GAMMA"]=d.value.gammaSpace):r[d.textureDefine]=!1}var p=this._getRadianceTexture(),f=this._forceIrradianceInFragment||this.realTimeFiltering||this._twoSidedLighting||l.getCaps().maxVaryingVectors<=8||null!=this._baseDiffuseRoughnessTexture;(0,Le.kz)(s,p,r,this.realTimeFiltering,this.realTimeFilteringQuality,!f),this._baseMetalnessTexture&&(r.AOSTOREINMETALMAPRED=this._useAmbientOcclusionFromMetallicTextureRed),r.SPECULAR_WEIGHT_IN_ALPHA=this._useSpecularWeightFromAlpha,r.SPECULAR_WEIGHT_FROM_SPECULAR_COLOR_TEXTURE=this._useSpecularWeightFromSpecularColorTexture,r.SPECULAR_ROUGHNESS_ANISOTROPY_FROM_TANGENT_TEXTURE=this._useSpecularRoughnessAnisotropyFromTangentTexture,r.COAT_ROUGHNESS_ANISOTROPY_FROM_TANGENT_TEXTURE=this._useCoatRoughnessAnisotropyFromTangentTexture,r.ROUGHNESSSTOREINMETALMAPGREEN=this._useRoughnessFromMetallicTextureGreen,r.METALLNESSSTOREINMETALMAPBLUE=this._useMetallicFromMetallicTextureBlue,r.THIN_FILM_THICKNESS_FROM_THIN_FILM_TEXTURE=this._useThinFilmThicknessFromTextureGreen,this.geometryNormalTexture?(this._useParallax&&this.baseColorTexture&&_o.h.DiffuseTextureEnabled?(r.PARALLAX=!0,r.PARALLAX_RHS=s.useRightHandedSystem,r.PARALLAXOCCLUSION=!!this._useParallaxOcclusion):r.PARALLAX=!1,r.OBJECTSPACE_NORMALMAP=this._useObjectSpaceNormalMap):(r.PARALLAX=!1,r.PARALLAX_RHS=!1,r.PARALLAXOCCLUSION=!1,r.OBJECTSPACE_NORMALMAP=!1),this._environmentBRDFTexture&&_o.h.ReflectionTextureEnabled?(r.ENVIRONMENTBRDF=!0,r.ENVIRONMENTBRDF_RGBD=this._environmentBRDFTexture.isRGBD):(r.ENVIRONMENTBRDF=!1,r.ENVIRONMENTBRDF_RGBD=!1),this._environmentFuzzBRDFTexture?r.FUZZENVIRONMENTBRDF=!0:r.FUZZENVIRONMENTBRDF=!1,this._shouldUseAlphaFromBaseColorTexture()?r.ALPHA_FROM_BASE_COLOR_TEXTURE=!0:r.ALPHA_FROM_BASE_COLOR_TEXTURE=!1}this._lightFalloff===Be.LIGHTFALLOFF_STANDARD?(r.USEPHYSICALLIGHTFALLOFF=!1,r.USEGLTFLIGHTFALLOFF=!1):this._lightFalloff===Be.LIGHTFALLOFF_GLTF?(r.USEPHYSICALLIGHTFALLOFF=!1,r.USEGLTFLIGHTFALLOFF=!0):(r.USEPHYSICALLIGHTFALLOFF=!0,r.USEGLTFLIGHTFALLOFF=!1),!this.backFaceCulling&&this._twoSidedLighting?r.TWOSIDEDLIGHTING=!0:r.TWOSIDEDLIGHTING=!1,r.MIRRORED=!!s._mirroredCameraPosition,r.SPECULARAA=l.getCaps().standardDerivatives&&this._enableSpecularAntiAliasing}(r._areTexturesDirty||r._areMiscDirty)&&(r.ALPHATESTVALUE="".concat(this._alphaCutOff).concat(this._alphaCutOff%1==0?".":""),r.PREMULTIPLYALPHA=this.alphaMode===b.Y.ALPHA_PREMULTIPLIED||this.alphaMode===b.Y.ALPHA_PREMULTIPLIED_PORTERDUFF,r.ALPHABLEND=this.needAlphaBlendingForMesh(e)),r._areImageProcessingDirty&&this._imageProcessingConfiguration&&this._imageProcessingConfiguration.prepareDefines(r),r.FORCENORMALFORWARD=this._forceNormalForward,r.RADIANCEOCCLUSION=this._useRadianceOcclusion,r.HORIZONOCCLUSION=this._useHorizonOcclusion,(this.specularRoughnessAnisotropy>0||this.coatRoughnessAnisotropy>0)&&t._noiseTextures[s.uniqueId]&&_o.h.ReflectionTextureEnabled?(r.ANISOTROPIC=!0,e.isVerticesDataPresent(se.R.TangentKind)||(r._needUVs=!0,r.MAINUV1=!0),this._useGltfStyleAnisotropy&&(r.USE_GLTF_STYLE_ANISOTROPY=!0),r.ANISOTROPIC_BASE=this.specularRoughnessAnisotropy>0,r.ANISOTROPIC_COAT=this.coatRoughnessAnisotropy>0):(r.ANISOTROPIC=!1,r.USE_GLTF_STYLE_ANISOTROPY=!1,r.ANISOTROPIC_BASE=!1,r.ANISOTROPIC_COAT=!1),r.THIN_FILM=this.thinFilmWeight>0,r.IRIDESCENCE=this.thinFilmWeight>0,r.FUZZ=this.fuzzWeight>0&&_o.h.ReflectionTextureEnabled,r.FUZZ?(e.isVerticesDataPresent(se.R.TangentKind)||(r._needUVs=!0,r.MAINUV1=!0),this._environmentFuzzBRDFTexture=tg(this.getScene()),r.FUZZ_IBL_SAMPLES=this.fuzzSampleNumber):(this._environmentFuzzBRDFTexture=null,r.FUZZENVIRONMENTBRDF=!1,r.FUZZ_IBL_SAMPLES=0),r._areMiscDirty&&((0,Le.fm)(e,s,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),r,this._applyDecalMapAfterDetailMap,this._useVertexPulling,n,this._isVertexOutputInvariant),r.UNLIT=this._unlit||(this.pointsCloud||this.wireframe)&&!e.isVerticesDataPresent(se.R.NormalKind),r.DEBUGMODE=this._debugMode),(0,Le.OR)(s,l,this,r,!!i,o,a),this._eventInfo.defines=r,this._eventInfo.mesh=e,this._callbackPluginEventPrepareDefinesBeforeAttributes(this._eventInfo),(0,Le.qB)(e,r,!0,!0,!0,this._transparencyMode!==Be.MATERIAL_OPAQUE),this._callbackPluginEventPrepareDefines(this._eventInfo)},t._noiseTextures={},t.ForceGLSL=!1,(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","baseWeight")],t.prototype,"_baseWeight",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","baseWeightTexture")],t.prototype,"_baseWeightTexture",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","baseColor")],t.prototype,"_baseColor",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","baseColorTexture")],t.prototype,"_baseColorTexture",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","baseDiffuseRoughness")],t.prototype,"_baseDiffuseRoughness",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","baseDiffuseRoughnessTexture")],t.prototype,"_baseDiffuseRoughnessTexture",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","baseMetalness")],t.prototype,"_baseMetalness",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","baseMetalnessTexture")],t.prototype,"_baseMetalnessTexture",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","specularWeight")],t.prototype,"_specularWeight",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","specularWeightTexture")],t.prototype,"_specularWeightTexture",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","specularColor")],t.prototype,"_specularColor",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","specularColorTexture")],t.prototype,"_specularColorTexture",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","specularRoughness")],t.prototype,"_specularRoughness",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","specularRoughnessTexture")],t.prototype,"_specularRoughnessTexture",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","specularRoughnessAnisotropy")],t.prototype,"_specularRoughnessAnisotropy",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","specularRoughnessAnisotropyTexture")],t.prototype,"_specularRoughnessAnisotropyTexture",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","specularIor")],t.prototype,"_specularIor",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","coatWeight")],t.prototype,"_coatWeight",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","coatWeightTexture")],t.prototype,"_coatWeightTexture",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","coatColor")],t.prototype,"_coatColor",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","coatColorTexture")],t.prototype,"_coatColorTexture",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","coatRoughness")],t.prototype,"_coatRoughness",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","coatRoughnessTexture")],t.prototype,"_coatRoughnessTexture",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","coatRoughnessAnisotropy")],t.prototype,"_coatRoughnessAnisotropy",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","coatRoughnessAnisotropyTexture")],t.prototype,"_coatRoughnessAnisotropyTexture",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","coatIor")],t.prototype,"_coatIor",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","coatDarkening")],t.prototype,"_coatDarkening",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","coatDarkeningTexture")],t.prototype,"_coatDarkeningTexture",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","fuzzWeight")],t.prototype,"_fuzzWeight",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","fuzzWeightTexture")],t.prototype,"_fuzzWeightTexture",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","fuzzColor")],t.prototype,"_fuzzColor",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","fuzzColorTexture")],t.prototype,"_fuzzColorTexture",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","fuzzRoughness")],t.prototype,"_fuzzRoughness",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","fuzzRoughnessTexture")],t.prototype,"_fuzzRoughnessTexture",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","geometryNormalTexture")],t.prototype,"_geometryNormalTexture",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","geometryTangent")],t.prototype,"_geometryTangent",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","geometryTangentTexture")],t.prototype,"_geometryTangentTexture",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","geometryCoatNormalTexture")],t.prototype,"_geometryCoatNormalTexture",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","geometryCoatTangent")],t.prototype,"_geometryCoatTangent",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","geometryCoatTangentTexture")],t.prototype,"_geometryCoatTangentTexture",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","geometryOpacity")],t.prototype,"_geometryOpacity",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","geometryOpacityTexture")],t.prototype,"_geometryOpacityTexture",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","emissionLuminance")],t.prototype,"_emissionLuminance",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","emissionColor")],t.prototype,"_emissionColor",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","emissionColorTexture")],t.prototype,"_emissionColorTexture",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","thinFilmWeight")],t.prototype,"_thinFilmWeight",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","thinFilmWeightTexture")],t.prototype,"_thinFilmWeightTexture",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","thinFilmThickness")],t.prototype,"_thinFilmThickness",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","thinFilmThicknessMin")],t.prototype,"_thinFilmThicknessMin",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","thinFilmThicknessTexture")],t.prototype,"_thinFilmThicknessTexture",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","thinFilmIor")],t.prototype,"_thinFilmIor",void 0),(0,f.Cg)([(0,ce.ru)("_markAllSubMeshesAsTexturesDirty","ambientOcclusionTexture")],t.prototype,"_ambientOcclusionTexture",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"directIntensity",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"environmentIntensity",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useSpecularWeightFromTextureAlpha",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesAndMiscDirty")],t.prototype,"forceAlphaTest",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesAndMiscDirty")],t.prototype,"alphaCutOff",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useAmbientOcclusionFromMetallicTextureRed",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useAmbientInGrayScale",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"usePhysicalLightFalloff",null),(0,f.Cg)([(0,ce.lK)()],t.prototype,"useGLTFLightFalloff",null),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useObjectSpaceNormalMap",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useParallax",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useParallaxOcclusion",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"parallaxScaleBias",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsLightsDirty")],t.prototype,"disableLighting",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"forceIrradianceInFragment",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsLightsDirty")],t.prototype,"maxSimultaneousLights",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"invertNormalMapX",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"invertNormalMapY",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"twoSidedLighting",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useAlphaFresnel",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useLinearAlphaFresnel",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"environmentBRDFTexture",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"forceNormalForward",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"enableSpecularAntiAliasing",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useHorizonOcclusion",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useRadianceOcclusion",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsMiscDirty")],t.prototype,"unlit",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsMiscDirty")],t.prototype,"applyDecalMapAfterDetailMap",void 0),(0,f.Cg)([(0,ce.$z)("_markAllSubMeshesAsMiscDirty")],t.prototype,"debugMode",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"transparencyMode",null),t}(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,f.C6)(t,e),t}(Fo(mo)));(0,h.Y5)("BABYLON.OpenPBRMaterial",gS);var vS=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r._useRoughnessFromMetallicTextureAlpha=!1,r._useRoughnessFromMetallicTextureGreen=!0,r._useMetallnessFromMetallicTextureBlue=!0,r.metallic=1,r.roughness=1,r}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"PBRMetallicRoughnessMaterial"},t.prototype.clone=function(e){var n=this,r=Te.p.Clone((function(){return new t(e,n.getScene())}),this);return r.id=e,r.name=e,this.clearCoat.copyTo(r.clearCoat),this.anisotropy.copyTo(r.anisotropy),this.brdf.copyTo(r.brdf),this.sheen.copyTo(r.sheen),this.subSurface.copyTo(r.subSurface),r},t.prototype.serialize=function(){var e=Te.p.Serialize(this);return e.customType="BABYLON.PBRMetallicRoughnessMaterial",this.clearCoat.doNotSerialize||(e.clearCoat=this.clearCoat.serialize()),this.anisotropy.doNotSerialize||(e.anisotropy=this.anisotropy.serialize()),this.brdf.doNotSerialize||(e.brdf=this.brdf.serialize()),this.sheen.doNotSerialize||(e.sheen=this.sheen.serialize()),this.subSurface.doNotSerialize||(e.subSurface=this.subSurface.serialize()),this.iridescence.doNotSerialize||(e.iridescence=this.iridescence.serialize()),e},t.Parse=function(e,n,r){var i=Te.p.Parse((function(){return new t(e.name,n)}),e,n,r);return e.clearCoat&&i.clearCoat.parse(e.clearCoat,n,r),e.anisotropy&&i.anisotropy.parse(e.anisotropy,n,r),e.brdf&&i.brdf.parse(e.brdf,n,r),e.sheen&&i.sheen.parse(e.sheen,n,r),e.subSurface&&i.subSurface.parse(e.subSurface,n,r),e.iridescence&&i.iridescence.parse(e.iridescence,n,r),i},(0,f.Cg)([(0,ce.jT)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty","_albedoColor")],t.prototype,"baseColor",void 0),(0,f.Cg)([(0,ce.uM)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty","_albedoTexture")],t.prototype,"baseTexture",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"metallic",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"roughness",void 0),(0,f.Cg)([(0,ce.uM)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty","_metallicTexture")],t.prototype,"metallicRoughnessTexture",void 0),t}(hS);(0,h.Y5)("BABYLON.PBRMetallicRoughnessMaterial",vS);var yS=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r._useMicroSurfaceFromReflectivityMapAlpha=!0,r}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"useMicroSurfaceFromReflectivityMapAlpha",{get:function(){return this._useMicroSurfaceFromReflectivityMapAlpha},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"PBRSpecularGlossinessMaterial"},t.prototype.clone=function(e){var n=this,r=Te.p.Clone((function(){return new t(e,n.getScene())}),this);return r.id=e,r.name=e,this.clearCoat.copyTo(r.clearCoat),this.anisotropy.copyTo(r.anisotropy),this.brdf.copyTo(r.brdf),this.sheen.copyTo(r.sheen),this.subSurface.copyTo(r.subSurface),r},t.prototype.serialize=function(){var e=Te.p.Serialize(this);return e.customType="BABYLON.PBRSpecularGlossinessMaterial",this.clearCoat.doNotSerialize||(e.clearCoat=this.clearCoat.serialize()),this.anisotropy.doNotSerialize||(e.anisotropy=this.anisotropy.serialize()),this.brdf.doNotSerialize||(e.brdf=this.brdf.serialize()),this.sheen.doNotSerialize||(e.sheen=this.sheen.serialize()),this.subSurface.doNotSerialize||(e.subSurface=this.subSurface.serialize()),this.iridescence.doNotSerialize||(e.iridescence=this.iridescence.serialize()),e},t.Parse=function(e,n,r){var i=Te.p.Parse((function(){return new t(e.name,n)}),e,n,r);return e.clearCoat&&i.clearCoat.parse(e.clearCoat,n,r),e.anisotropy&&i.anisotropy.parse(e.anisotropy,n,r),e.brdf&&i.brdf.parse(e.brdf,n,r),e.sheen&&i.sheen.parse(e.sheen,n,r),e.subSurface&&i.subSurface.parse(e.subSurface,n,r),e.iridescence&&i.iridescence.parse(e.iridescence,n,r),i},(0,f.Cg)([(0,ce.jT)("diffuse"),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty","_albedoColor")],t.prototype,"diffuseColor",void 0),(0,f.Cg)([(0,ce.uM)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty","_albedoTexture")],t.prototype,"diffuseTexture",void 0),(0,f.Cg)([(0,ce.jT)("specular"),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty","_reflectivityColor")],t.prototype,"specularColor",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty","_microSurface")],t.prototype,"glossiness",void 0),(0,f.Cg)([(0,ce.uM)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty","_reflectivityTexture")],t.prototype,"specularGlossinessTexture",void 0),t}(hS);(0,h.Y5)("BABYLON.PBRSpecularGlossinessMaterial",yS);var bS,SS=n(10721),TS=n(31194),ES=n(17152),xS=n(40682),PS=n(10752),CS=n(27082),RS=n(32299),AS=n(64541);!function(e){e[e.GLSL=0]="GLSL",e[e.WGSL=1]="WGSL"}(bS||(bS={}));var IS=function(e){function t(t,n,r){void 0===r&&(r=null);var i=e.call(this,n)||this;if(!t)return i;if(i._textureMatrix=c.uq.Identity(),i.name=t,i.url=t,i._onLoad=r,i._texture=i._getFromCache(t,!0),i._texture)i._triggerOnLoad();else{var o=i.getScene();o&&o.useDelayedTextureLoading?i.delayLoadState=b.Y.DELAYLOADSTATE_NOTLOADED:i._loadTexture()}return i}return(0,f.C6)(t,e),t.prototype._triggerOnLoad=function(){this._onLoad&&this._onLoad()},t.prototype.getTextureMatrix=function(){return this._textureMatrix},t.prototype._load3dlTexture=function(){var e,n=this,r=this._getEngine();e=r._features.support3DTextures?r.createRawTexture3D(null,1,1,1,b.Y.TEXTUREFORMAT_RGBA,!1,!1,b.Y.TEXTURE_BILINEAR_SAMPLINGMODE,null,b.Y.TEXTURETYPE_UNSIGNED_BYTE):r.createRawTexture(null,1,1,b.Y.TEXTUREFORMAT_RGBA,!1,!1,b.Y.TEXTURE_BILINEAR_SAMPLINGMODE,null,b.Y.TEXTURETYPE_UNSIGNED_BYTE),this._texture=e,this._texture.isReady=!1,this.isCube=!1,this.is3D=r._features.support3DTextures,this.wrapU=b.Y.TEXTURE_CLAMP_ADDRESSMODE,this.wrapV=b.Y.TEXTURE_CLAMP_ADDRESSMODE,this.wrapR=b.Y.TEXTURE_CLAMP_ADDRESSMODE,this.anisotropicFilteringLevel=1;var i=function(i){if("string"==typeof i){for(var o,a=null,s=null,l=i.split("\n"),c=0,u=0,h=0,d=0,p=0,f=0;f0&&(f+1)%4==0)a[f]=255;else{var S=s[f];a[f]=S/p*255}e.is3D?(e.updateSize(c,c,c),r.updateRawTexture3D(e,a,b.Y.TEXTUREFORMAT_RGBA,!1)):(e.updateSize(c*c,c),r.updateRawTexture(e,a,b.Y.TEXTUREFORMAT_RGBA,!1)),e.isReady=!0,n._triggerOnLoad()}},o=this.getScene();return o?o._loadFile(this.url,i):r._loadFile(this.url,i),this._texture},t.prototype._loadTexture=function(){if(this.url){var e=this.url.toLocaleLowerCase();(e.endsWith(".3dl")||e.startsWith("blob:"))&&this._load3dlTexture()}},t.prototype.clone=function(){var e=new t(this.url,this.getScene()||this._getEngine());return e.level=this.level,e},t.prototype.delayLoad=function(){this.delayLoadState===b.Y.DELAYLOADSTATE_NOTLOADED&&(this.delayLoadState=b.Y.DELAYLOADSTATE_LOADED,this._texture=this._getFromCache(this.url,!0),this._texture||this._loadTexture())},t.Parse=function(e,n){var r=null;return e.name&&!e.isRenderTarget&&((r=new t(e.name,n)).name=e.name,r.level=e.level),r},t.prototype.serialize=function(){if(!this.name)return null;var e={};return e.name=this.name,e.level=this.level,e.customType="BABYLON.ColorGradingTexture",e},t._NoneEmptyLineRegex=/\S+/,t}(z_.t);(0,h.Y5)("BABYLON.ColorGradingTexture",IS);var OS=n(16814),MS=function(e){function t(t,n,r,i,o,a,s,l){void 0===i&&(i=!1),void 0===o&&(o=!0),void 0===a&&(a=null),void 0===s&&(s=null),void 0===l&&(l=!1);var c=e.call(this,n)||this;if(c._onLoad=null,c._onError=null,!t)throw new Error("Image url is not set");return c._coordinatesMode=_n.g.CUBIC_MODE,c.name=t,c.url=t,c._size=r,c._supersample=l,c._noMipmap=i,c.gammaSpace=o,c._onLoad=a,c._onError=s,c.hasAlpha=!1,c.isCube=!0,c._texture=c._getFromCache(t,c._noMipmap,void 0,void 0,void 0,c.isCube),c._texture?a&&(c._texture.isReady?Z.S0.SetImmediate((function(){return a()})):c._texture.onLoadedObservable.add(a)):n.useDelayedTextureLoading?c.delayLoadState=b.Y.DELAYLOADSTATE_NOTLOADED:c._loadImage((function(){return c._loadTexture()}),c._onError),c}return(0,f.C6)(t,e),t.prototype._loadImage=function(e,t){var n=this,r=this.getScene();if(r){var i=r.getEngine().createRawCubeTexture(null,this._size,b.Y.TEXTUREFORMAT_RGB,r.getEngine().getCaps().textureFloat?b.Y.TEXTURETYPE_FLOAT:b.Y.TEXTURETYPE_UNSIGNED_INTEGER,!this._noMipmap,!1,b.Y.TEXTURE_TRILINEAR_SAMPLINGMODE);i.generateMipMaps=!this._noMipmap,r.addPendingData(i),i.url=this.url,i.isReady=!1,r.getEngine()._internalTexturesCache.push(i),this._texture=i,(0,Cg.W$)(this.url,(function(t){var r;n._width=t.width,n._height=t.height,(0,_i.Nf)()?((r=document.createElement("canvas")).width=n._width,r.height=n._height):r=new OffscreenCanvas(n._width,n._height);var i=r.getContext("2d");i.drawImage(t,0,0);var o=i.getImageData(0,0,t.width,t.height);n._buffer=o.data.buffer,r.remove&&r.remove(),e()}),(function(e,o){r.removePendingData(i),t&&t("".concat(n.getClassName()," could not be loaded"),o)}),r?r.offlineProvider:null)}},t.prototype._loadTexture=function(){var e=this,n=this.getScene();if(n){var r=function(){for(var n=e._getFloat32ArrayFromArrayBuffer(e._buffer),r=OS.D.ConvertPanoramaToCubemap(n,e._width,e._height,e._size,e._supersample),i=[],o=0;o<6;o++){var a=r[t._FacesMapping[o]];i.push(a)}return i}(),i=this._texture;n.getEngine().updateRawCubeTexture(i,r,i.format,i.type,i.invertY),i.isReady=!0,n.removePendingData(i),i.onLoadedObservable.notifyObservers(i),i.onLoadedObservable.clear(),this._onLoad&&this._onLoad()}},t.prototype._getFloat32ArrayFromArrayBuffer=function(e){for(var t=new DataView(e),n=new Float32Array(3*e.byteLength/4),r=0,i=0;i0&&(s._createInternalTextures(),s._createTextures(a)),s}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"isSupported",{get:function(){var e,t;return null!==(t=null===(e=this._engine)||void 0===e?void 0:e.getCaps().drawBuffersExtension)&&void 0!==t&&t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"textures",{get:function(){return this._textures},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"depthTexture",{get:function(){return this._textures[this._textures.length-1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wrapU",{set:function(e){if(this._textures)for(var t=0;t=0;r--)this._textures[r]._texture=null;null===(t=this._renderTarget)||void 0===t||t.dispose(),this._renderTarget=null}},t}(Ji.$),jS=function(e,t,n){this.id=e,this.scale=t,this.offset=n},qS=function(){function e(t,n,r,i){var o,a,s,l,c,h,d,p,f,m,_,g,v;return this.name=t,this.meshes=n,this.scene=i,this.options=r,this.options.map=null!==(o=this.options.map)&&void 0!==o?o:["ambientTexture","bumpTexture","diffuseTexture","emissiveTexture","lightmapTexture","opacityTexture","reflectionTexture","refractionTexture","specularTexture"],this.options.uvsIn=null!==(a=this.options.uvsIn)&&void 0!==a?a:se.R.UVKind,this.options.uvsOut=null!==(s=this.options.uvsOut)&&void 0!==s?s:se.R.UVKind,this.options.layout=null!==(l=this.options.layout)&&void 0!==l?l:e.LAYOUT_STRIP,this.options.layout===e.LAYOUT_COLNUM&&(this.options.colnum=null!==(c=this.options.colnum)&&void 0!==c?c:8),this.options.updateInputMeshes=null===(h=this.options.updateInputMeshes)||void 0===h||h,this.options.disposeSources=null===(d=this.options.disposeSources)||void 0===d||d,this._expecting=0,this.options.fillBlanks=null===(p=this.options.fillBlanks)||void 0===p||p,!0===this.options.fillBlanks&&(this.options.customFillColor=null!==(f=this.options.customFillColor)&&void 0!==f?f:"black"),this.options.frameSize=null!==(m=this.options.frameSize)&&void 0!==m?m:256,this.options.paddingRatio=null!==(_=this.options.paddingRatio)&&void 0!==_?_:.0115,this._paddingValue=Math.ceil(this.options.frameSize*this.options.paddingRatio),this._paddingValue%2!=0&&this._paddingValue++,this.options.paddingMode=null!==(g=this.options.paddingMode)&&void 0!==g?g:e.SUBUV_WRAP,this.options.paddingMode===e.SUBUV_COLOR&&(this.options.paddingColor=null!==(v=this.options.paddingColor)&&void 0!==v?v:new u.ov(0,0,0,1)),this.sets={},this.frames=[],this}return e.prototype._createFrames=function(e){for(var t=this,n=this._calculateSize(),r=new c.I9(1,1).divide(n),i=0,o=this._expecting,a=this.meshes.length,s=Object.keys(this.sets),l=0;l0)try{t._config=JSON.parse(i.response),t.updateShaderUniforms(),t.updateTextures(),t.setFragment(t._texturePath+"/custom"),t._animate=t._config.animate,t.refreshRate=t._config.refreshrate}catch(e){n()}else n()}),!1),i.addEventListener("error",(function(){n()}),!1);try{i.send()}catch(e){y.V.Error("CustomProceduralTexture: Error on XHR send request.")}},t.prototype.isReady=function(){if(!e.prototype.isReady.call(this))return!1;for(var t in this._textures)if(!this._textures[t].isReady())return!1;return!0},t.prototype.render=function(t){var n=this.getScene();this._animate&&n&&(this._time+=.03*n.getAnimationRatio(),this.updateShaderUniforms()),e.prototype.render.call(this,t)},t.prototype.updateTextures=function(){for(var e=0;e(".concat(this._options.remappedVariables.join(","),")"):"#include",v=this._options&&this._options.remappedVariables?"#include(".concat(this._options.remappedVariables.join(","),")"):"#include",y=this._options&&this._options.remappedVariables?"#include(".concat(this._options.remappedVariables.join(","),")"):"#include",b="#include",S="#include";m=(m=-1!==(m=(m=0===c.shaderLanguage?m.replace(/void\s+?main/g,"\n".concat(S,"\nvoid main")):m.replace(/@vertex/g,"\n".concat(S,"\n@vertex"))).replace(/#define SHADOWDEPTH_NORMALBIAS|#define CUSTOM_VERTEX_UPDATE_WORLDPOS/g,g)).indexOf("#define SHADOWDEPTH_METRIC")?m.replace(/#define SHADOWDEPTH_METRIC/g,v):m.replace(/}\s*$/g,v+"\n}")).replace(/#define SHADER_NAME.*?\n|out vec4 glFragColor;\n/g,"");var T=_.indexOf("#define SHADOWDEPTH_SOFTTRANSPARENTSHADOW")>=0||_.indexOf("#define CUSTOM_FRAGMENT_BEFORE_FOG")>=0,E=-1!==_.indexOf("#define SHADOWDEPTH_FRAGMENT"),x="";T?_=_.replace(/#define SHADOWDEPTH_SOFTTRANSPARENTSHADOW|#define CUSTOM_FRAGMENT_BEFORE_FOG/g,y):x=y+"\n",_=_.replace(/void\s+?main/g,Dl.M.IncludesShadersStore.shadowMapFragmentExtraDeclaration+"\nvoid main"),E?_=_.replace(/#define SHADOWDEPTH_FRAGMENT/g,b):x+=b+"\n",x&&(_=_.replace(/}\s*$/g,x+"}")),f.push("biasAndScaleSM","depthValuesSM","lightDataSM","softTransparentShadowSM")}h.mainDrawWrapper.effect=s.createEffect({vertexSource:m,fragmentSource:_,vertexToken:h.token,fragmentToken:h.token},{attributes:c.getAttributesNames(),uniformsNames:f,uniformBuffersNames:c.getUniformBuffersNames(),samplers:c.getSamplers(),defines:p+"\n"+c.defines.replace("#define SHADOWS","").replace(/#define SHADOW\d/g,""),indexParameters:c.getIndexParameters(),shaderLanguage:c.shaderLanguage},s);for(var P=0;P\nattribute float splatIndex;uniform vec2 invViewport;uniform vec2 dataTextureSize;uniform vec2 focal;uniform float kernelSize;uniform sampler2D covariancesATexture;uniform sampler2D covariancesBTexture;uniform sampler2D centersTexture;varying vec2 vPosition;\n#include\nvoid main(void) {Splat splat=readSplat(splatIndex);vec3 covA=splat.covA.xyz;vec3 covB=vec3(splat.covA.w,splat.covB.xy);vec4 worldPosGS=world*vec4(splat.center.xyz,1.0);vPosition=position.xy;gl_Position=gaussianSplatting(position.xy,worldPosGS.xyz,vec2(1.,1.),covA,covB,world,view,projection);}"),n(59681);var xT="gaussianSplattingDepthPixelShader";Bi.l.ShadersStoreWGSL[xT]||(Bi.l.ShadersStoreWGSL[xT]="#include\nvarying vPosition: vec2f;fn checkDiscard(inPosition: vec2f)->vec4f {var A : f32=-dot(inPosition,inPosition);if (A<-1.) {discard;}\nreturn vec4f(0.0);}\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {fragmentOutputs.color=checkDiscard(fragmentInputs.vPosition);}\n"),n(68325);var PT="gaussianSplattingDepthVertexShader";Bi.l.ShadersStoreWGSL[PT]||(Bi.l.ShadersStoreWGSL[PT]="#include\n#include\nattribute splatIndex: f32;attribute position: vec2f;uniform invViewport: vec2f;uniform dataTextureSize: vec2f;uniform focal: vec2f;uniform kernelSize: f32;var covariancesATexture: texture_2d;var covariancesBTexture: texture_2d;var centersTexture: texture_2d;varying vPosition: vec2f;\n#include\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {var splat: Splat=readSplat(input.splatIndex,uniforms.dataTextureSize);var covA: vec3f=splat.covA.xyz;var covB: vec3f=vec3f(splat.covA.w,splat.covB.xy);let worldPos: vec4f=mesh.world*vec4f(splat.center.xyz,1.0);vertexOutputs.vPosition=input.position;vertexOutputs.position=gaussianSplatting(input.position,worldPos.xyz,vec2f(1.0,1.0),covA,covB,mesh.world,scene.view,scene.projection,uniforms.focal,uniforms.invViewport,uniforms.kernelSize);}");var CT=function(e){function t(){var t=e.call(this)||this;return t.FOG=!1,t.THIN_INSTANCES=!0,t.LOGARITHMICDEPTH=!1,t.CLIPPLANE=!1,t.CLIPPLANE2=!1,t.CLIPPLANE3=!1,t.CLIPPLANE4=!1,t.CLIPPLANE5=!1,t.CLIPPLANE6=!1,t.SH_DEGREE=0,t.COMPENSATION=!1,t.rebuild(),t}return(0,f.C6)(t,e),t}(ho),RT=function(e){function t(n,r){var i=e.call(this,n,r)||this;return i.kernelSize=t.KernelSize,i._compensation=t.Compensation,i._isDirty=!1,i.backFaceCulling=!1,i.shadowDepthWrapper=t._MakeGaussianSplattingShadowDepthWrapper(r,i.shaderLanguage),i}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"compensation",{get:function(){return this._compensation},set:function(e){this._isDirty=this._isDirty!=e,this._compensation=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasRenderTargetTextures",{get:function(){return!1},enumerable:!1,configurable:!0}),t.prototype.needAlphaTesting=function(){return!1},t.prototype.needAlphaBlending=function(){return!0},t.prototype.isReadyForSubMesh=function(e,r){var i=this,o=!0,a=r._drawWrapper,s=r.materialDefines;if(s&&this._isDirty&&s.markAsUnprocessed(),a.effect&&this.isFrozen&&a._wasPreviouslyReady&&a._wasPreviouslyUsingInstances===o)return!0;r.materialDefines||(s=r.materialDefines=new CT);var l=this.getScene();if(this._isReadyForSubMesh(r))return!0;var c=l.getEngine(),u=e;(0,Le.fm)(e,l,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,!1,s,void 0,void 0,void 0,this._isVertexOutputInvariant),(0,Le.OR)(l,c,this,s,o,null,!0),(0,Le.qB)(e,s,!1,!1),(c.version>1||c.isWebGPU)&&(s.SH_DEGREE=u.shDegree);var h=u.material;if(s.COMPENSATION=h&&h.compensation?h.compensation:t.Compensation,s.isDirty){s.markAsProcessed(),l.resetCachedMaterial(),(0,Le.ER)(t._Attribs,s),(0,Le.Bb)({uniformsNames:t._Uniforms,uniformBuffersNames:t._UniformBuffers,samplers:t._Samplers,defines:s}),(0,Mo.Ll)(t._Uniforms);var d=s.toString(),p=l.getEngine().createEffect("gaussianSplatting",{attributes:t._Attribs,uniformsNames:t._Uniforms,uniformBuffersNames:t._UniformBuffers,samplers:t._Samplers,defines:d,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:function(){return(0,f.sH)(i,void 0,void 0,(function(){return(0,f.YH)(this,(function(e){switch(e.label){case 0:return 1!==this._shaderLanguage?[3,2]:[4,Promise.all([Promise.resolve().then(n.bind(n,86508)),Promise.resolve().then(n.bind(n,8630))])];case 1:return e.sent(),[3,4];case 2:return[4,Promise.all([Promise.resolve().then(n.bind(n,59942)),Promise.resolve().then(n.bind(n,28937))])];case 3:e.sent(),e.label=4;case 4:return[2]}}))}))}},c);r.setEffect(p,s,this._materialContext)}return!(!r.effect||!r.effect.isReady()||(s._renderId=l.getRenderId(),a._wasPreviouslyReady=!0,a._wasPreviouslyUsingInstances=o,this._isDirty=!1,0))},t.BindEffect=function(e,n,r){var i,o,a=r.getEngine(),s=r.activeCamera,l=a.getRenderWidth(),c=a.getRenderHeight(),u=e,h=u.material,d=(null===(i=null==s?void 0:s.rigParent)||void 0===i?void 0:i.rigCameras.length)||1;n.setFloat2("invViewport",1/(l/d),1/c);var p=1e3;if(s){var f=s.getProjectionMatrix().m[5];p=s.fovMode==oe.i.FOVMODE_VERTICAL_FIXED?c*f/2:l*f/2}if(n.setFloat2("focal",p,p),n.setVector3("viewDirectionFactor",u.viewDirectionFactor),n.setFloat("kernelSize",h&&h.kernelSize?h.kernelSize:t.KernelSize),r.bindEyePosition(n,"eyePosition",!0),u.covariancesATexture){var m=u.covariancesATexture.getSize();if(n.setFloat2("dataTextureSize",m.width,m.height),n.setTexture("covariancesATexture",u.covariancesATexture),n.setTexture("covariancesBTexture",u.covariancesBTexture),n.setTexture("centersTexture",u.centersTexture),n.setTexture("colorsTexture",u.colorsTexture),u.shTextures)for(var _=0;_<(null===(o=u.shTextures)||void 0===o?void 0:o.length);_++)n.setTexture("shTexture".concat(_),u.shTextures[_])}},t.prototype.bindForSubMesh=function(e,n,r){var i=this.getScene(),o=r.materialDefines;if(o){var a=r.effect;a&&(this._activeEffect=a,n.getMeshUniformBuffer().bindToEffect(a,"Mesh"),n.transferToEffect(e),this._mustRebind(i,a,r,n.visibility)?(this.bindView(a),this.bindViewProjection(a),t.BindEffect(n,this._activeEffect,i),(0,Mo.ij)(a,this,i)):i.getEngine()._features.needToAlwaysBindUniformBuffers&&(this._needToBindSceneUbo=!0),(0,Le.Yy)(i,n,a),this.useLogarithmicDepth&&(0,Le.DL)(o,a,i),this._afterBind(n,this._activeEffect,r))}},t._MakeGaussianSplattingShadowDepthWrapper=function(e,n){var r=new Ea("gaussianSplattingDepth",e,{vertex:"gaussianSplattingDepth",fragment:"gaussianSplattingDepth"},{attributes:t._Attribs,uniforms:t._Uniforms,samplers:t._Samplers,uniformBuffers:t._UniformBuffers,shaderLanguage:n,defines:["#define GS_DISABLE_COLOR"]}),i=new bT(r,e,{standalone:!0});return r.onBindObservable.add((function(n){var i=r.getEffect(),o=n.material,a=n;n.getMeshUniformBuffer().bindToEffect(i,"Mesh"),r.bindView(i),r.bindViewProjection(i);var s=e.getEngine().getRenderWidth(),l=e.getEngine().getRenderHeight();i.setFloat2("invViewport",1/s,1/l);var c=s*e.getProjectionMatrix().m[5]/2;if(i.setFloat2("focal",c,c),i.setFloat("kernelSize",o&&o.kernelSize?o.kernelSize:t.KernelSize),a.covariancesATexture){var u=a.covariancesATexture.getSize();i.setFloat2("dataTextureSize",u.width,u.height),i.setTexture("covariancesATexture",a.covariancesATexture),i.setTexture("covariancesBTexture",a.covariancesBTexture),i.setTexture("centersTexture",a.centersTexture)}})),i},t.prototype.clone=function(e){var n=this;return Te.p.Clone((function(){return new t(e,n.getScene())}),this)},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.customType="BABYLON.GaussianSplattingMaterial",t},t.prototype.getClassName=function(){return"GaussianSplattingMaterial"},t.Parse=function(e,n,r){return Te.p.Parse((function(){return new t(e.name,n)}),e,n,r)},t.KernelSize=.3,t.Compensation=!1,t._Attribs=[se.R.PositionKind,"splatIndex"],t._Samplers=["covariancesATexture","covariancesBTexture","centersTexture","colorsTexture","shTexture0","shTexture1","shTexture2"],t._UniformBuffers=["Scene","Mesh"],t._Uniforms=["world","view","projection","vFogInfos","vFogColor","logarithmicDepthConstant","invViewport","dataTextureSize","focal","eyePosition","kernelSize","viewDirectionFactor"],t}(mo);(0,h.Y5)("BABYLON.GaussianSplattingMaterial",RT);var AT=function(e){function t(t){var n=e.call(this,t,pv.Vertex)||this;return n._isUnique=!0,n.registerInput("splatIndex",dv.Float,!1,pv.Vertex),n.registerOutput("splatPosition",dv.Vector3,pv.Vertex),n.registerOutput("splatColor",dv.Color4,pv.Vertex),n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"SplatReaderBlock"},Object.defineProperty(t.prototype,"splatIndex",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"splatPosition",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"splatColor",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),t.prototype.initialize=function(e){e._excludeVariableName("covA"),e._excludeVariableName("covB"),e._excludeVariableName("vPosition"),e._excludeVariableName("covariancesATexture"),e._excludeVariableName("covariancesBTexture"),e._excludeVariableName("centersTexture"),e._excludeVariableName("colorsTexture"),e._excludeVariableName("dataTextureSize")},t.prototype.bind=function(e,t,n){if(n){var r=n.getScene();RT.BindEffect(n,e,r)}},t.prototype._buildBlock=function(t){if(e.prototype._buildBlock.call(this,t),t.target!==pv.Fragment){t.sharedData.bindableBlocks.push(this);var n="//".concat(this.name);t._emit2DSampler("covariancesATexture"),t._emit2DSampler("covariancesBTexture"),t._emit2DSampler("centersTexture"),t._emit2DSampler("colorsTexture"),t._emit2DSampler("shTexture0","SH_DEGREE > 0",void 0,void 0,!0,"highp"),t._emit2DSampler("shTexture1","SH_DEGREE > 0",void 0,void 0,!0,"highp"),t._emit2DSampler("shTexture2","SH_DEGREE > 0",void 0,void 0,!0,"highp"),t._emitFunctionFromInclude("gaussianSplattingVertexDeclaration",n),t._emitFunctionFromInclude("gaussianSplatting",n),t._emitVaryingFromString("vPosition",dv.Vector2),t._emitUniformFromString("dataTextureSize",dv.Vector2);var r=this.splatIndex,i=this.splatPosition,o=this.splatColor,a=t._getFreeVariableName("splat");return 1===t.shaderLanguage?(t.compilationString+="var ".concat(a,": Splat = readSplat(").concat(r.associatedVariableName,", uniforms.dataTextureSize);\n"),t.compilationString+="var covA: vec3f = splat.covA.xyz; var covB: vec3f = vec3f(splat.covA.w, splat.covB.xy);\n",t.compilationString+="vertexOutputs.vPosition = input.position;\n"):(t.compilationString+="Splat ".concat(a," = readSplat(").concat(r.associatedVariableName,");\n"),t.compilationString+="vec3 covA = splat.covA.xyz; vec3 covB = vec3(splat.covA.w, splat.covB.xy);\n",t.compilationString+="vPosition = position;\n"),t.compilationString+="".concat(t._declareOutput(i)," = ").concat(a,".center.xyz;\n"),t.compilationString+="".concat(t._declareOutput(o)," = ").concat(a,".color;\n"),this}},t}(Cv);(0,h.Y5)("BABYLON.SplatReaderBlock",AT);var IT=function(e){function t(n){var r=e.call(this,n,pv.VertexAndFragment)||this;return r.registerOutput("source",dv.Object,pv.VertexAndFragment,new _T("source",r,1,t,"ImageSourceBlock")),r.registerOutput("dimensions",dv.Vector2),r}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"texture",{get:function(){return this._texture},set:function(e){var t,n=this;if(this._texture!==e){var r=null!==(t=null==e?void 0:e.getScene())&&void 0!==t?t:M.q.LastCreatedScene;!e&&r&&r.markAllMaterialsAsDirty(b.Y.MATERIAL_TextureDirtyFlag,(function(e){return e.hasTexture(n._texture)})),this._texture=e,e&&r&&r.markAllMaterialsAsDirty(b.Y.MATERIAL_TextureDirtyFlag,(function(t){return t.hasTexture(e)}))}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"samplerName",{get:function(){return this._samplerName},enumerable:!1,configurable:!0}),t.prototype.bind=function(e,t){this.texture&&e.setTexture(this._samplerName,this.texture)},t.prototype.isReady=function(){return!(this.texture&&!this.texture.isReadyOrNotBlocking())},t.prototype.getClassName=function(){return"ImageSourceBlock"},Object.defineProperty(t.prototype,"source",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dimensions",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(t){var n,r;if(e.prototype._buildBlock.call(this,t),t.target===pv.Vertex&&(this._samplerName=t._getFreeVariableName(this.name),t.sharedData.blockingBlocks.push(this),t.sharedData.textureBlocks.push(this),t.sharedData.bindableBlocks.push(this)),this.dimensions.isConnected){var i;i=1===t.shaderLanguage?"vec2f(textureDimensions(".concat(this._samplerName,", 0).xy)"):"vec2(textureSize(".concat(this._samplerName,", 0).xy)"),t.compilationString+="".concat(t._declareOutput(this.dimensions)," = ").concat(i,";\n")}return(null===(r=null===(n=this._texture)||void 0===n?void 0:n._texture)||void 0===r?void 0:r.is2DArray)?t._emit2DArraySampler(this._samplerName):t._emit2DSampler(this._samplerName),this},t.prototype._dumpPropertiesCode=function(t){void 0===t&&(t=!1);var n=e.prototype._dumpPropertiesCode.call(this);return!this.texture||t?n:(n+="".concat(this._codeVariableName,'.texture = new BABYLON.Texture("').concat(this.texture.name,'", null, ').concat(this.texture.noMipmap,", ").concat(this.texture.invertY,", ").concat(this.texture.samplingMode,");\n"),n+="".concat(this._codeVariableName,".texture.wrapU = ").concat(this.texture.wrapU,";\n"),n+="".concat(this._codeVariableName,".texture.wrapV = ").concat(this.texture.wrapV,";\n"),n+="".concat(this._codeVariableName,".texture.uAng = ").concat(this.texture.uAng,";\n"),n+="".concat(this._codeVariableName,".texture.vAng = ").concat(this.texture.vAng,";\n"),n+="".concat(this._codeVariableName,".texture.wAng = ").concat(this.texture.wAng,";\n"),n+="".concat(this._codeVariableName,".texture.uOffset = ").concat(this.texture.uOffset,";\n"),n+="".concat(this._codeVariableName,".texture.vOffset = ").concat(this.texture.vOffset,";\n"),n+="".concat(this._codeVariableName,".texture.uScale = ").concat(this.texture.uScale,";\n"),n+="".concat(this._codeVariableName,".texture.vScale = ").concat(this.texture.vScale,";\n"),n+="".concat(this._codeVariableName,".texture.coordinatesMode = ").concat(this.texture.coordinatesMode,";\n"))},t.prototype.serialize=function(t){void 0===t&&(t=!1);var n=e.prototype.serialize.call(this);return t||!this.texture||!oy.AllowSerializationOfRenderTargetTextures&&this.texture.isRenderTarget||"VideoTexture"===this.texture.getClassName()||(n.texture=this.texture.serialize()),n},t.prototype._deserialize=function(t,n,r,i){e.prototype._deserialize.call(this,t,n,r,i),t.texture&&!oy.IgnoreTexturesAtLoadTime&&(void 0!==t.texture.url&&(0===t.texture.url.indexOf("data:")?r="":i&&(t.texture.url=i(t.texture.url),t.texture.name=t.texture.url)),(t.texture.base64String||void 0!==t.texture.url)&&(this.texture=_n.g.Parse(t.texture,n,r)))},t}(Cv);(0,h.Y5)("BABYLON.ImageSourceBlock",IT);var OT=function(e){function t(t){var n=e.call(this,t)||this;return n._firstInit=!0,n.isMainInput=!1,n.registerInput("source",dv.Object,!0,pv.VertexAndFragment,new _T("source",n,0,IT,"ImageSourceBlock")),n}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"samplerName",{get:function(){return this.source.connectedPoint?this.source.connectedPoint.ownerBlock.samplerName:this._samplerName},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"texture",{get:function(){return this.source.connectedPoint?this.source.connectedPoint.ownerBlock.texture:this._texture},set:function(e){this._texture=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"source",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasImageSource",{get:function(){return this.source.isConnected},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"SmartFilterTextureBlock"},t.prototype.initialize=function(e){this._firstInit&&(this._samplerName=e._getFreeVariableName(this.name),this._firstInit=!1)},t.prototype._getMainUvName=function(e){var t=e.sharedData.nodeMaterial.getInputBlockByPredicate((function(e){return e.isAttribute&&"postprocess_uv"===e.name}));return t&&t.isAnAncestorOf(this)?t.associatedVariableName:(e.sharedData.raiseBuildError("SmartFilterTextureBlock: 'postprocess_uv' attribute from ScreenUVBlock is required."),"")},t.prototype._emitUvAndSampler=function(e){if(e.target===pv.Fragment&&(e._emitVaryingFromString(this._mainUVName,dv.Vector2,Bv,!0),!this.hasImageSource)){var t=this.isMainInput?"// main":void 0;e._emit2DSampler(this._samplerName,void 0,void 0,t)}},t.prototype.autoConfigure=function(e,t){if(void 0===t&&(t=function(){return!0}),!this.uv.isConnected){var n=e.getInputBlockByPredicate((function(e){return e.isAttribute&&"postprocess_uv"===e.name&&t(e)}));n||(n=new Lv("uv")).setAsAttribute("postprocess_uv"),n.output.connectTo(this.uv)}},t.prototype._postBuildBlock=function(){this._firstInit=!0},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.isMainInput=this.isMainInput,t},t.prototype._deserialize=function(t,n,r){e.prototype._deserialize.call(this,t,n,r),this.isMainInput=t.isMainInput},t}(kv);(0,h.Y5)("BABYLON.SmartFilterTextureBlock",OT);var MT=function(e){function t(t){return e.call(this,t)||this}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"AddBlock"},t.prototype._buildBlock=function(t){e.prototype._buildBlock.call(this,t);var n=this._outputs[0];return t.compilationString+=t._declareOutput(n)+" = ".concat(this.left.associatedVariableName," + ").concat(this.right.associatedVariableName,";\n"),this},t}(jv);function DT(e){e.clear(),e.editorData=null;var t=new Lv("SplatIndex");t.setAsAttribute("splatIndex");var n=new AT("SplatReader");t.connectTo(n);var r=new gT("GaussianSplatting");n.connectTo(r);var i=new Lv("World");i.setAsSystemValue(Av.World);var o=new Uv("WorldPos");n.connectTo(o),i.connectTo(o),o.connectTo(r,{output:"xyz",input:"splatPosition"});var a=new Lv("view");a.setAsSystemValue(Av.View);var s=new Lv("Projection");s.setAsSystemValue(Av.Projection),i.connectTo(r,{input:"world"}),a.connectTo(r,{input:"view"}),s.connectTo(r,{input:"projection"});var l=new MT("Add SH"),c=new vT("Gaussian");n.connectTo(c,{input:"splatColor",output:"splatColor"});var u=new Ov("FragmentOutput");r.SH.connectTo(l.left),c.rgb.connectTo(l.right),l.output.connectTo(u.rgb),c.alpha.connectTo(u.a);var h=new Gv("VertexOutput");r.connectTo(h),e.addOutputNode(h),e.addOutputNode(u),e._mode=Rv.GaussianSplatting}function NT(e){e.clear(),e.editorData=null;var t=new Lv("uv");t.setAsAttribute("postprocess_uv"),t.comments="Normalized screen position to sample our texture with.";var n=new OT("Input Texture");n.comments="A placeholder that represents the input texture to compose.",t.connectTo(n);var r=Z.S0.GetAssetUrl("https://assets.babylonjs.com/core/nme/currentScreenPostProcess.png");n.texture=new _n.g(r,e.getScene());var i=new Lv("Color4");i.value=new u.ov(1,0,0,1);var o=new qv("Multiply");i.connectTo(o),n.connectTo(o);var a=new Vv("FragmentOutput");o.connectTo(a),e.addOutputNode(a),e._mode=Rv.SFE}(0,h.Y5)("BABYLON.AddBlock",MT);var FT=function(e){function t(t){var n=e.call(this,t,pv.Vertex)||this;return n.registerInput("matricesIndices",dv.Vector4),n.registerInput("matricesWeights",dv.Vector4),n.registerInput("matricesIndicesExtra",dv.Vector4,!0),n.registerInput("matricesWeightsExtra",dv.Vector4,!0),n.registerInput("world",dv.Matrix),n.registerOutput("output",dv.Matrix),n}return(0,f.C6)(t,e),t.prototype.initialize=function(e){e._excludeVariableName("boneSampler"),e._excludeVariableName("boneTextureWidth"),e._excludeVariableName("mBones"),e._excludeVariableName("BonesPerMesh"),this._initShaderSourceAsync(e.shaderLanguage)},t.prototype._initShaderSourceAsync=function(e){return(0,f.sH)(this,void 0,void 0,(function(){return(0,f.YH)(this,(function(t){switch(t.label){case 0:return this._codeIsReady=!1,1!==e?[3,2]:[4,Promise.all([Promise.resolve().then(n.bind(n,45699)),Promise.resolve().then(n.bind(n,3641))])];case 1:return t.sent(),[3,4];case 2:return[4,Promise.all([Promise.resolve().then(n.bind(n,36470)),Promise.resolve().then(n.bind(n,76898))])];case 3:t.sent(),t.label=4;case 4:return this._codeIsReady=!0,this.onCodeIsReadyObservable.notifyObservers(this),[2]}}))}))},t.prototype.getClassName=function(){return"BonesBlock"},Object.defineProperty(t.prototype,"matricesIndices",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"matricesWeights",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"matricesIndicesExtra",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"matricesWeightsExtra",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"world",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype.autoConfigure=function(e,t){if(void 0===t&&(t=function(){return!0}),!this.matricesIndices.isConnected){var n=e.getInputBlockByPredicate((function(e){return e.isAttribute&&"matricesIndices"===e.name&&t(e)}));n||(n=new Lv("matricesIndices")).setAsAttribute("matricesIndices"),n.output.connectTo(this.matricesIndices)}if(!this.matricesWeights.isConnected){var r=e.getInputBlockByPredicate((function(e){return e.isAttribute&&"matricesWeights"===e.name&&t(e)}));r||(r=new Lv("matricesWeights")).setAsAttribute("matricesWeights"),r.output.connectTo(this.matricesWeights)}if(!this.world.isConnected){var i=e.getInputBlockByPredicate((function(e){return e.systemValue===Av.World&&t(e)}));i||(i=new Lv("world")).setAsSystemValue(Av.World),i.output.connectTo(this.world)}},t.prototype.provideFallbacks=function(e,t){t&&t.useBones&&t.computeBonesUsingShaders&&t.skeleton&&e.addCPUSkinningFallback(0,t)},t.prototype.bind=function(e,t,n){(0,Le.f$)(n,e)},t.prototype.prepareDefines=function(e,t,n){e._areAttributesDirty&&n&&(0,Le.IC)(n,e)},t.prototype._buildBlock=function(t){e.prototype._buildBlock.call(this,t),t.sharedData.blocksWithFallbacks.push(this),t.sharedData.forcedBindableBlocks.push(this),t.sharedData.blocksWithDefines.push(this),t.uniforms.push("boneTextureWidth"),t.uniforms.push("mBones"),t.samplers.push("boneSampler");var n="//".concat(this.name);t._emitFunctionFromInclude("bonesDeclaration",n,{removeAttributes:!0,removeUniforms:!1,removeVaryings:!0,removeIfDef:!1});var r=t._getFreeVariableName("influence");t.compilationString+=t._emitCodeFromInclude("bonesVertex",n,{replaceStrings:[{search:/finalWorld=finalWorld\*influence;/,replace:""},{search:/influence/gm,replace:r}]});var i=this._outputs[0],o=this.world;return t.compilationString+="#if NUM_BONE_INFLUENCERS>0\n",t.compilationString+=t._declareOutput(i)+" = ".concat(o.associatedVariableName," * ").concat(r,";\n"),t.compilationString+="#else\n",t.compilationString+=t._declareOutput(i)+" = ".concat(o.associatedVariableName,";\n"),t.compilationString+="#endif\n",this},t}(Cv);(0,h.Y5)("BABYLON.BonesBlock",FT);var LT=function(e){function t(t){var n=e.call(this,t,pv.Vertex)||this;return n.registerInput("world0",dv.Vector4),n.registerInput("world1",dv.Vector4),n.registerInput("world2",dv.Vector4),n.registerInput("world3",dv.Vector4),n.registerInput("world",dv.Matrix,!0),n.registerOutput("output",dv.Matrix),n.registerOutput("instanceID",dv.Float),n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"InstancesBlock"},Object.defineProperty(t.prototype,"world0",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"world1",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"world2",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"world3",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"world",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"instanceID",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),t.prototype.autoConfigure=function(e,t){if(void 0===t&&(t=function(){return!0}),!this.world0.connectedPoint){var n=e.getInputBlockByPredicate((function(e){return e.isAttribute&&"world0"===e.name&&t(e)}));n||(n=new Lv("world0")).setAsAttribute("world0"),n.output.connectTo(this.world0)}if(!this.world1.connectedPoint){var r=e.getInputBlockByPredicate((function(e){return e.isAttribute&&"world1"===e.name&&t(e)}));r||(r=new Lv("world1")).setAsAttribute("world1"),r.output.connectTo(this.world1)}if(!this.world2.connectedPoint){var i=e.getInputBlockByPredicate((function(e){return e.isAttribute&&"world2"===e.name&&t(e)}));i||(i=new Lv("world2")).setAsAttribute("world2"),i.output.connectTo(this.world2)}if(!this.world3.connectedPoint){var o=e.getInputBlockByPredicate((function(e){return e.isAttribute&&"world3"===e.name&&t(e)}));o||(o=new Lv("world3")).setAsAttribute("world3"),o.output.connectTo(this.world3)}if(!this.world.connectedPoint){var a=e.getInputBlockByPredicate((function(e){return e.isAttribute&&"world"===e.name&&t(e)}));a||(a=new Lv("world")).setAsSystemValue(Av.World),a.output.connectTo(this.world)}this.world.define="!INSTANCES || THIN_INSTANCES"},t.prototype.prepareDefines=function(e,t,n,r,i){void 0===r&&(r=!1);var o=!1;e.INSTANCES!==r&&(e.setValue("INSTANCES",r),o=!0),i&&e.THIN_INSTANCES!==!!(null==i?void 0:i.getRenderingMesh().hasThinInstances)&&(e.setValue("THIN_INSTANCES",!!(null==i?void 0:i.getRenderingMesh().hasThinInstances)),o=!0),o&&e.markAsUnprocessed()},t.prototype._buildBlock=function(t){e.prototype._buildBlock.call(this,t);var n=t.sharedData.scene.getEngine();t.sharedData.blocksWithDefines.push(this);var r=this._outputs[0],i=this._outputs[1],o=this.world0,a=this.world1,s=this.world2,l=this.world3,c="mat4",u="gl_InstanceID",h="float";return 1===t.shaderLanguage&&(c="mat4x4f",u="vertexInputs.instanceIndex",h="f32"),t.compilationString+="#ifdef INSTANCES\n",t.compilationString+=t._declareOutput(r)+" = ".concat(c,"(").concat(o.associatedVariableName,", ").concat(a.associatedVariableName,", ").concat(s.associatedVariableName,", ").concat(l.associatedVariableName,");\n"),t.compilationString+="#ifdef THIN_INSTANCES\n",t.compilationString+="".concat(r.associatedVariableName," = ").concat(this.world.associatedVariableName," * ").concat(r.associatedVariableName,";\n"),t.compilationString+="#endif\n",n._caps.canUseGLInstanceID?t.compilationString+=t._declareOutput(i)+" = ".concat(h,"(").concat(u,");\n"):t.compilationString+=t._declareOutput(i)+" = 0.0;\n",t.compilationString+="#else\n",t.compilationString+=t._declareOutput(r)+" = ".concat(this.world.associatedVariableName,";\n"),t.compilationString+=t._declareOutput(i)+" = 0.0;\n",t.compilationString+="#endif\n",this},t}(Cv);(0,h.Y5)("BABYLON.InstancesBlock",LT);var wT=function(e){function t(t){var n=e.call(this,t,pv.Vertex)||this;return n.registerInput("position",dv.Vector3),n.registerInput("normal",dv.Vector3),n.registerInput("tangent",dv.AutoDetect),n.tangent.addExcludedConnectionPointFromAllowedTypes(dv.Color4|dv.Vector4|dv.Vector3),n.registerInput("uv",dv.Vector2),n.registerInput("uv2",dv.Vector2),n.registerInput("color",dv.Color4),n.registerOutput("positionOutput",dv.Vector3),n.registerOutput("normalOutput",dv.Vector3),n.registerOutput("tangentOutput",dv.Vector4),n.registerOutput("uvOutput",dv.Vector2),n.registerOutput("uv2Output",dv.Vector2),n.registerOutput("colorOutput",dv.Color4),n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"MorphTargetsBlock"},Object.defineProperty(t.prototype,"position",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"normal",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tangent",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"uv",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"uv2",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"color",{get:function(){return this._inputs[5]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"positionOutput",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"normalOutput",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tangentOutput",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"uvOutput",{get:function(){return this._outputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"uv2Output",{get:function(){return this._outputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"colorOutput",{get:function(){return this._outputs[5]},enumerable:!1,configurable:!0}),t.prototype.initialize=function(e){e._excludeVariableName("morphTargetInfluences"),this._initShaderSourceAsync(e.shaderLanguage)},t.prototype._initShaderSourceAsync=function(e){return(0,f.sH)(this,void 0,void 0,(function(){return(0,f.YH)(this,(function(t){switch(t.label){case 0:return this._codeIsReady=!1,1!==e?[3,2]:[4,Promise.all([Promise.resolve().then(n.bind(n,77320)),Promise.resolve().then(n.bind(n,68478)),Promise.resolve().then(n.bind(n,98819)),Promise.resolve().then(n.bind(n,73683))])];case 1:return t.sent(),[3,4];case 2:return[4,Promise.all([Promise.resolve().then(n.bind(n,84589)),Promise.resolve().then(n.bind(n,67369)),Promise.resolve().then(n.bind(n,58266)),Promise.resolve().then(n.bind(n,24444))])];case 3:t.sent(),t.label=4;case 4:return this._codeIsReady=!0,this.onCodeIsReadyObservable.notifyObservers(this),[2]}}))}))},t.prototype.autoConfigure=function(e,t){if(void 0===t&&(t=function(){return!0}),!this.position.isConnected){var n=e.getInputBlockByPredicate((function(e){return e.isAttribute&&"position"===e.name&&t(e)}));n||(n=new Lv("position")).setAsAttribute(),n.output.connectTo(this.position)}if(!this.normal.isConnected){var r=e.getInputBlockByPredicate((function(e){return e.isAttribute&&"normal"===e.name&&t(e)}));r||(r=new Lv("normal")).setAsAttribute("normal"),r.output.connectTo(this.normal)}if(!this.tangent.isConnected){var i=e.getInputBlockByPredicate((function(e){return e.isAttribute&&"tangent"===e.name&&t(e)}));i||(i=new Lv("tangent")).setAsAttribute("tangent"),i.output.connectTo(this.tangent)}if(!this.uv.isConnected){var o=e.getInputBlockByPredicate((function(e){return e.isAttribute&&"uv"===e.name&&t(e)}));o||(o=new Lv("uv")).setAsAttribute("uv"),o.output.connectTo(this.uv)}if(!this.uv2.isConnected){var a=e.getInputBlockByPredicate((function(e){return e.isAttribute&&"uv2"===e.name&&t(e)}));a||(a=new Lv("uv2")).setAsAttribute("uv2"),a.output.connectTo(this.uv2)}if(!this.color.isConnected){var s=e.getInputBlockByPredicate((function(e){return e.isAttribute&&"color"===e.name&&t(e)}));s||(s=new Lv("color")).setAsAttribute("color"),s.output.connectTo(this.color)}},t.prototype.prepareDefines=function(e,t,n){if(n){if(n.morphTargetManager){var r=n.morphTargetManager;(null==r?void 0:r.isUsingTextureForTargets)&&(r.numMaxInfluencers||r.numInfluencers)!==e.NUM_MORPH_INFLUENCERS&&e.markAsAttributesDirty()}e._areAttributesDirty&&(0,Le.Jz)(n,e)}},t.prototype.bind=function(e,t,n){n&&n.morphTargetManager&&n.morphTargetManager.numInfluencers>0&&((0,Le.nR)(n,e),n.morphTargetManager.isUsingTextureForTargets&&n.morphTargetManager._bind(e))},t.prototype.replaceRepeatableContent=function(e,t,n){if(n){var r=this.position,i=this.normal,o=this.tangent,a=this.uv,s=this.uv2,l=this.color,c=this.positionOutput,u=this.normalOutput,h=this.tangentOutput,d=this.uvOutput,p=this.uv2Output,f=this.colorOutput,m=e,_=t.NUM_MORPH_INFLUENCERS,g=n.morphTargetManager,v=g&&g.supportsPositions,y=g&&g.supportsNormals,b=g&&g.supportsTangents,S=g&&g.supportsUVs,T=g&&g.supportsUV2s,E=g&&g.supportsColors,x="";(null==g?void 0:g.isUsingTextureForTargets)&&_>0&&(x+="".concat(m._declareLocalVar("vertexID",dv.Float),";\n")),x+="#ifdef MORPHTARGETS\n";var P=1===m.shaderLanguage,C=P?"uniforms.":"";if(null==g?void 0:g.isUsingTextureForTargets)x+="for (".concat(P?"var":"int"," i = 0; i < NUM_MORPH_INFLUENCERS; i++) {\n"),x+="if (".concat(P?"f32":"float","(i) >= ").concat(C,"morphTargetCount) { break; }\n"),x+="vertexID = ".concat(P?"f32(vertexInputs.vertexIndex":"float(gl_VertexID",") * ").concat(C,"morphTargetTextureInfo.x;\n"),v&&(x+="#ifdef MORPHTARGETS_POSITION\n",x+="".concat(c.associatedVariableName," += (readVector3FromRawSampler(i, vertexID) - ").concat(r.associatedVariableName,") * ").concat(C,"morphTargetInfluences[i];\n"),x+="#endif\n"),x+="#ifdef MORPHTARGETTEXTURE_HASPOSITIONS\n",x+="vertexID += 1.0;\n",x+="#endif\n",y&&(x+="#ifdef MORPHTARGETS_NORMAL\n",x+="".concat(u.associatedVariableName," += (readVector3FromRawSampler(i, vertexID) - ").concat(i.associatedVariableName,") * ").concat(C,"morphTargetInfluences[i];\n"),x+="#endif\n"),x+="#ifdef MORPHTARGETTEXTURE_HASNORMALS\n",x+="vertexID += 1.0;\n",x+="#endif\n",S&&(x+="#ifdef MORPHTARGETS_UV\n",x+="".concat(d.associatedVariableName," += (readVector3FromRawSampler(i, vertexID).xy - ").concat(a.associatedVariableName,") * ").concat(C,"morphTargetInfluences[i];\n"),x+="#endif\n"),x+="#ifdef MORPHTARGETTEXTURE_HASUVS\n",x+="vertexID += 1.0;\n",x+="#endif\n",b&&(x+="#ifdef MORPHTARGETS_TANGENT\n",x+="".concat(h.associatedVariableName,".xyz += (readVector3FromRawSampler(i, vertexID) - ").concat(o.associatedVariableName,".xyz) * ").concat(C,"morphTargetInfluences[i];\n"),o.type===dv.Vector4?x+="".concat(h.associatedVariableName,".w = ").concat(o.associatedVariableName,".w;\n"):x+="".concat(h.associatedVariableName,".w = 1.;\n"),x+="#endif\n"),x+="#ifdef MORPHTARGETTEXTURE_HASTANGENTS\n",x+="vertexID += 1.0;\n",x+="#endif\n",T&&(x+="#ifdef MORPHTARGETS_UV2\n",x+="".concat(p.associatedVariableName," += (readVector3FromRawSampler(i, vertexID).xy - ").concat(s.associatedVariableName,") * morphTargetInfluences[i];\n"),x+="#endif\n"),x+="#ifdef MORPHTARGETTEXTURE_HASUV2S\n",x+="vertexID += 1.0;\n",x+="#endif\n",E&&(x+="#ifdef MORPHTARGETS_COLOR\n",x+="".concat(f.associatedVariableName," += (readVector4FromRawSampler(i, vertexID) - ").concat(l.associatedVariableName,") * ").concat(C,"morphTargetInfluences[i];\n"),x+="#endif\n"),x+="}\n";else for(var R=0;R<_;R++)v&&(x+="#ifdef MORPHTARGETS_POSITION\n",x+="".concat(c.associatedVariableName," += (position").concat(R," - ").concat(r.associatedVariableName,") * ").concat(C,"morphTargetInfluences[").concat(R,"];\n"),x+="#endif\n"),y&&t.NORMAL&&(x+="#ifdef MORPHTARGETS_NORMAL\n",x+="".concat(u.associatedVariableName," += (normal").concat(R," - ").concat(i.associatedVariableName,") * ").concat(C,"morphTargetInfluences[").concat(R,"];\n"),x+="#endif\n"),S&&t.UV1&&(x+="#ifdef MORPHTARGETS_UV\n",x+="".concat(d.associatedVariableName,".xy += (uv_").concat(R," - ").concat(a.associatedVariableName,".xy) * ").concat(C,"morphTargetInfluences[").concat(R,"];\n"),x+="#endif\n"),b&&t.TANGENT&&(x+="#ifdef MORPHTARGETS_TANGENT\n",x+="".concat(h.associatedVariableName,".xyz += (tangent").concat(R," - ").concat(o.associatedVariableName,".xyz) * ").concat(C,"morphTargetInfluences[").concat(R,"];\n"),o.type===dv.Vector4?x+="".concat(h.associatedVariableName,".w = ").concat(o.associatedVariableName,".w;\n"):x+="".concat(h.associatedVariableName,".w = 1.;\n"),x+="#endif\n"),T&&t.UV2&&(x+="#ifdef MORPHTARGETS_UV2\n",x+="".concat(p.associatedVariableName,".xy += (uv2_").concat(R," - ").concat(s.associatedVariableName,".xy) * morphTargetInfluences[").concat(R,"];\n"),x+="#endif\n"),E&&t.VERTEXCOLOR_NME&&(x+="#ifdef MORPHTARGETS_COLOR\n",x+="".concat(f.associatedVariableName," += (color").concat(R," - ").concat(l.associatedVariableName,") * ").concat(C,"morphTargetInfluences[").concat(R,"];\n"),x+="#endif\n");if(x+="#endif\n",m.compilationString=m.compilationString.replace(this._repeatableContentAnchor,x),_>0)for(R=0;R<_;R++)v&&m.attributes.push(se.R.PositionKind+R),y&&t.NORMAL&&m.attributes.push(se.R.NormalKind+R),b&&t.TANGENT&&m.attributes.push(se.R.TangentKind+R),S&&t.UV1&&m.attributes.push(se.R.UVKind+"_"+R),T&&t.UV2&&m.attributes.push(se.R.UV2Kind+"_"+R),E&&t.VERTEXCOLOR_NME&&m.attributes.push(se.R.ColorKind+R)}},t.prototype._buildBlock=function(t){e.prototype._buildBlock.call(this,t),t.sharedData.blocksWithDefines.push(this),t.sharedData.bindableBlocks.push(this),t.sharedData.repeatableContentBlocks.push(this);var n=this.position,r=this.normal,i=this.tangent,o=this.uv,a=this.uv2,s=this.color,l=this.positionOutput,c=this.normalOutput,u=this.tangentOutput,h=this.uvOutput,d=this.uv2Output,p=this.colorOutput,f="//".concat(this.name);return t.uniforms.push("morphTargetInfluences"),t.uniforms.push("morphTargetCount"),t.uniforms.push("morphTargetTextureInfo"),t.uniforms.push("morphTargetTextureIndices"),t.samplers.push("morphTargets"),t._emitFunctionFromInclude("morphTargetsVertexGlobalDeclaration",f),t._emitFunctionFromInclude("morphTargetsVertexDeclaration",f,{repeatKey:"maxSimultaneousMorphTargets"}),t.compilationString+="".concat(t._declareOutput(l)," = ").concat(n.associatedVariableName,";\n"),t.compilationString+="#ifdef NORMAL\n",t.compilationString+="".concat(t._declareOutput(c)," = ").concat(r.associatedVariableName,";\n"),t.compilationString+="#else\n",t.compilationString+="".concat(t._declareOutput(c)," = vec3(0., 0., 0.);\n"),t.compilationString+="#endif\n",t.compilationString+="#ifdef TANGENT\n",t.compilationString+="".concat(t._declareOutput(u)," = ").concat(i.associatedVariableName,";\n"),t.compilationString+="#else\n",t.compilationString+="".concat(t._declareOutput(u)," = vec4(0., 0., 0., 0.);\n"),t.compilationString+="#endif\n",t.compilationString+="#ifdef UV1\n",t.compilationString+="".concat(t._declareOutput(h)," = ").concat(o.associatedVariableName,";\n"),t.compilationString+="#else\n",t.compilationString+="".concat(t._declareOutput(h)," = vec2(0., 0.);\n"),t.compilationString+="#endif\n",t.compilationString+="#ifdef UV2\n",t.compilationString+="".concat(t._declareOutput(d)," = ").concat(a.associatedVariableName,";\n"),t.compilationString+="#else\n",t.compilationString+="".concat(t._declareOutput(d)," = vec2(0., 0.);\n"),t.compilationString+="#endif\n",t.compilationString+="#ifdef VERTEXCOLOR_NME\n",t.compilationString+="".concat(t._declareOutput(p)," = ").concat(s.associatedVariableName,";\n"),t.compilationString+="#else\n",t.compilationString+="".concat(t._declareOutput(p)," = vec4(0., 0., 0., 0.);\n"),t.compilationString+="#endif\n",this._repeatableContentAnchor=t._repeatableContentAnchor,t.compilationString+=this._repeatableContentAnchor,this},t}(Cv);(0,h.Y5)("BABYLON.MorphTargetsBlock",wT);var BT=function(e){function t(t){var n=e.call(this,t,pv.Vertex)||this;return n.registerInput("worldPosition",dv.Vector4,!1,pv.Vertex),n.registerOutput("direction",dv.Vector3),n.registerOutput("color",dv.Color3),n.registerOutput("intensity",dv.Float),n.registerOutput("shadowBias",dv.Float),n.registerOutput("shadowNormalBias",dv.Float),n.registerOutput("shadowDepthScale",dv.Float),n.registerOutput("shadowDepthRange",dv.Vector2),n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"LightInformationBlock"},Object.defineProperty(t.prototype,"worldPosition",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"direction",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"color",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"intensity",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shadowBias",{get:function(){return this._outputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shadowNormalBias",{get:function(){return this._outputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shadowDepthScale",{get:function(){return this._outputs[5]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shadowDepthRange",{get:function(){return this._outputs[6]},enumerable:!1,configurable:!0}),t.prototype.bind=function(e,t,n){if(n){this.light&&this.light.isDisposed()&&(this.light=null);var r=this.light,i=t.getScene();if(!r&&i.lights.length&&(r=this.light=i.lights[0],this._forcePrepareDefines=!0),!r||!r.isEnabled)return e.setFloat3(this._lightDataUniformName,0,0,0),void e.setFloat4(this._lightColorUniformName,0,0,0,0);r.transferToNodeMaterialEffect(e,this._lightDataUniformName),e.setColor4(this._lightColorUniformName,r.diffuse,r.intensity);var o=r.getShadowGenerator();if((this.shadowBias.hasEndpoints||this.shadowNormalBias.hasEndpoints||this.shadowDepthScale.hasEndpoints)&&(o?e.setFloat3(this._lightShadowUniformName,o.bias,o.normalBias,o.depthScale):e.setFloat3(this._lightShadowUniformName,0,0,0)),this.shadowDepthRange)if(o&&i.activeCamera){var a=r;e.setFloat2(this._lightShadowExtraUniformName,a.getDepthMinZ(i.activeCamera),a.getDepthMinZ(i.activeCamera)+a.getDepthMaxZ(i.activeCamera))}else e.setFloat2(this._lightShadowExtraUniformName,0,0)}},t.prototype.prepareDefines=function(e){if(e._areLightsDirty||this._forcePrepareDefines){this._forcePrepareDefines=!1;var t=this.light;e.setValue(this._lightTypeDefineName,!!(t&&t instanceof pb),!0)}},t.prototype._buildBlock=function(t){e.prototype._buildBlock.call(this,t),t.sharedData.bindableBlocks.push(this),t.sharedData.blocksWithDefines.push(this);var n=this.direction,r=this.color,i=this.intensity,o=this.shadowBias,a=this.shadowNormalBias,s=this.shadowDepthScale,l=this.shadowDepthRange;this._lightDataUniformName=t._getFreeVariableName("lightData"),this._lightColorUniformName=t._getFreeVariableName("lightColor"),this._lightShadowUniformName=t._getFreeVariableName("shadowData"),this._lightShadowExtraUniformName=t._getFreeVariableName("shadowExtraData"),this._lightTypeDefineName=t._getFreeDefineName("LIGHTPOINTTYPE");var c=1===t.shaderLanguage?"uniforms.":"";return t._emitUniformFromString(this._lightDataUniformName,dv.Vector3),t._emitUniformFromString(this._lightColorUniformName,dv.Vector4),t.compilationString+="#ifdef ".concat(this._lightTypeDefineName,"\n"),t.compilationString+=t._declareOutput(n)+" = normalize(".concat(this.worldPosition.associatedVariableName,".xyz - ").concat(c).concat(this._lightDataUniformName,");\n"),t.compilationString+="#else\n",t.compilationString+=t._declareOutput(n)+" = ".concat(c).concat(this._lightDataUniformName,";\n"),t.compilationString+="#endif\n",t.compilationString+=t._declareOutput(r)+" = ".concat(c).concat(this._lightColorUniformName,".rgb;\n"),t.compilationString+=t._declareOutput(i)+" = ".concat(c).concat(this._lightColorUniformName,".a;\n"),(o.hasEndpoints||a.hasEndpoints||s.hasEndpoints)&&(t._emitUniformFromString(this._lightShadowUniformName,dv.Vector3),o.hasEndpoints&&(t.compilationString+=t._declareOutput(o)+" = ".concat(c).concat(this._lightShadowUniformName,".x;\n")),a.hasEndpoints&&(t.compilationString+=t._declareOutput(a)+" = ".concat(c).concat(this._lightShadowUniformName,".y;\n")),s.hasEndpoints&&(t.compilationString+=t._declareOutput(s)+" = ".concat(c).concat(this._lightShadowUniformName,".z;\n"))),l.hasEndpoints&&(t._emitUniformFromString(this._lightShadowExtraUniformName,dv.Vector2),t.compilationString+=t._declareOutput(l)+" = ".concat(this._lightShadowUniformName,";\n")),this},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return this.light&&(t.lightId=this.light.id),t},t.prototype._deserialize=function(t,n,r){e.prototype._deserialize.call(this,t,n,r),t.lightId&&(this.light=n.getLightById(t.lightId))},t}(Cv);(0,h.Y5)("BABYLON.LightInformationBlock",BT);var VT=n(45699),UT=n(3641),GT=n(36470),kT=n(76898),zT=n(77320),WT=n(68478),HT=n(98819),YT=n(73683),XT=n(84589),jT=n(67369),qT=n(58266),KT=n(24444),ZT=function(e){function t(t){var n=e.call(this,t,pv.Fragment)||this;return n.convertInputToLinearSpace=!0,n.registerInput("color",dv.AutoDetect),n.registerOutput("output",dv.Color4),n.registerOutput("rgb",dv.Color3),n._inputs[0].addExcludedConnectionPointFromAllowedTypes(dv.Color3|dv.Color4|dv.Vector3|dv.Vector4),n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"ImageProcessingBlock"},Object.defineProperty(t.prototype,"color",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rgb",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),t.prototype.initialize=function(e){e._excludeVariableName("exposureLinear"),e._excludeVariableName("contrast"),e._excludeVariableName("vInverseScreenSize"),e._excludeVariableName("vignetteSettings1"),e._excludeVariableName("vignetteSettings2"),e._excludeVariableName("vCameraColorCurveNegative"),e._excludeVariableName("vCameraColorCurveNeutral"),e._excludeVariableName("vCameraColorCurvePositive"),e._excludeVariableName("txColorTransform"),e._excludeVariableName("colorTransformSettings"),e._excludeVariableName("ditherIntensity"),this._initShaderSourceAsync(e.shaderLanguage)},t.prototype._initShaderSourceAsync=function(e){return(0,f.sH)(this,void 0,void 0,(function(){return(0,f.YH)(this,(function(t){switch(t.label){case 0:return this._codeIsReady=!1,1!==e?[3,2]:[4,Promise.all([Promise.resolve().then(n.bind(n,17393)),Promise.resolve().then(n.bind(n,86320)),Promise.resolve().then(n.bind(n,4661))])];case 1:return t.sent(),[3,4];case 2:return[4,Promise.all([Promise.resolve().then(n.bind(n,75334)),Promise.resolve().then(n.bind(n,59581)),Promise.resolve().then(n.bind(n,40688))])];case 3:t.sent(),t.label=4;case 4:return this._codeIsReady=!0,this.onCodeIsReadyObservable.notifyObservers(this),[2]}}))}))},t.prototype.isReady=function(e,t,n){return!(n._areImageProcessingDirty&&t.imageProcessingConfiguration&&!t.imageProcessingConfiguration.isReady())},t.prototype.prepareDefines=function(e,t){e._areImageProcessingDirty&&t.imageProcessingConfiguration&&t.imageProcessingConfiguration.prepareDefines(e)},t.prototype.bind=function(e,t,n){n&&t.imageProcessingConfiguration&&t.imageProcessingConfiguration.bind(e)},t.prototype._buildBlock=function(t){var n;e.prototype._buildBlock.call(this,t),t.sharedData.blocksWithDefines.push(this),t.sharedData.blockingBlocks.push(this),t.sharedData.bindableBlocks.push(this),t.uniforms.push("exposureLinear"),t.uniforms.push("contrast"),t.uniforms.push("vInverseScreenSize"),t.uniforms.push("vignetteSettings1"),t.uniforms.push("vignetteSettings2"),t.uniforms.push("vCameraColorCurveNegative"),t.uniforms.push("vCameraColorCurveNeutral"),t.uniforms.push("vCameraColorCurvePositive"),t.uniforms.push("txColorTransform"),t.uniforms.push("colorTransformSettings"),t.uniforms.push("ditherIntensity");var r=this.color,i=this._outputs[0],o="//".concat(this.name),a=1===t.shaderLanguage?"Vec3":"";return t._emitFunctionFromInclude("helperFunctions",o),t._emitFunctionFromInclude("imageProcessingDeclaration",o),t._emitFunctionFromInclude("imageProcessingFunctions",o),(null===(n=r.connectedPoint)||void 0===n?void 0:n.isConnected)&&(r.connectedPoint.type===dv.Color4||r.connectedPoint.type===dv.Vector4?t.compilationString+="".concat(t._declareOutput(i)," = ").concat(r.associatedVariableName,";\n"):t.compilationString+="".concat(t._declareOutput(i)," = vec4").concat(t.fSuffix,"(").concat(r.associatedVariableName,", 1.0);\n"),t.compilationString+="#ifdef IMAGEPROCESSINGPOSTPROCESS\n",this.convertInputToLinearSpace&&(t.compilationString+="".concat(i.associatedVariableName," = vec4").concat(t.fSuffix,"(toLinearSpace").concat(a,"(").concat(r.associatedVariableName,".rgb), ").concat(r.associatedVariableName,".a);\n")),t.compilationString+="#else\n",t.compilationString+="#ifdef IMAGEPROCESSING\n",this.convertInputToLinearSpace&&(t.compilationString+="".concat(i.associatedVariableName," = vec4").concat(t.fSuffix,"(toLinearSpace").concat(a,"(").concat(r.associatedVariableName,".rgb), ").concat(r.associatedVariableName,".a);\n")),t.compilationString+="".concat(i.associatedVariableName," = applyImageProcessing(").concat(i.associatedVariableName,");\n"),t.compilationString+="#endif\n",t.compilationString+="#endif\n",this.rgb.hasEndpoints&&(t.compilationString+=t._declareOutput(this.rgb)+" = ".concat(this.output.associatedVariableName,".xyz;\n"))),this},t.prototype._dumpPropertiesCode=function(){return e.prototype._dumpPropertiesCode.call(this)+"".concat(this._codeVariableName,".convertInputToLinearSpace = ").concat(this.convertInputToLinearSpace,";\n")},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.convertInputToLinearSpace=this.convertInputToLinearSpace,t},t.prototype._deserialize=function(t,n,r){var i;e.prototype._deserialize.call(this,t,n,r),this.convertInputToLinearSpace=null===(i=t.convertInputToLinearSpace)||void 0===i||i},(0,f.Cg)([Jp("Convert input to linear space",0,"ADVANCED")],t.prototype,"convertInputToLinearSpace",void 0),t}(Cv);(0,h.Y5)("BABYLON.ImageProcessingBlock",ZT);var QT=function(e){function t(n){var r=e.call(this,n,pv.Fragment,!0)||this;return r.registerInput("normal",dv.AutoDetect,!1),r.normal.addExcludedConnectionPointFromAllowedTypes(dv.Color4|dv.Vector4|dv.Vector3),r.registerInput("tangent",dv.Vector4,!1),r.registerInput("world",dv.Matrix,!1),r.registerOutput("TBN",dv.Object,pv.Fragment,new _T("TBN",r,1,t,"TBNBlock")),r.registerOutput("row0",dv.Vector3,pv.Fragment),r.registerOutput("row1",dv.Vector3,pv.Fragment),r.registerOutput("row2",dv.Vector3,pv.Fragment),r}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"TBNBlock"},t.prototype.initialize=function(e){e._excludeVariableName("tbnNormal"),e._excludeVariableName("tbnTangent"),e._excludeVariableName("tbnBitangent"),e._excludeVariableName("TBN")},Object.defineProperty(t.prototype,"normal",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tangent",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"world",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"TBN",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"row0",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"row1",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"row2",{get:function(){return this._outputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"target",{get:function(){return pv.Fragment},set:function(e){},enumerable:!1,configurable:!0}),t.prototype.autoConfigure=function(e,t){if(void 0===t&&(t=function(){return!0}),!this.world.isConnected){var n=e.getInputBlockByPredicate((function(e){return e.isSystemValue&&e.systemValue===Av.World&&t(e)}));n||(n=new Lv("world")).setAsSystemValue(Av.World),n.output.connectTo(this.world)}if(!this.normal.isConnected){var r=e.getInputBlockByPredicate((function(e){return e.isAttribute&&"normal"===e.name&&t(e)}));r||(r=new Lv("normal")).setAsAttribute("normal"),r.output.connectTo(this.normal)}if(!this.tangent.isConnected){var i=e.getInputBlockByPredicate((function(e){return e.isAttribute&&"tangent"===e.name&&e.type===dv.Vector4&&t(e)}));i||(i=new Lv("tangent")).setAsAttribute("tangent"),i.output.connectTo(this.tangent)}},t.prototype.prepareDefines=function(e,t,n){var r,i,o,a;if(n){var s=this.normal,l=this.tangent,c=s.isConnected;(null===(r=s.connectInputBlock)||void 0===r?void 0:r.isAttribute)&&!n.isVerticesDataPresent(null===(i=s.connectInputBlock)||void 0===i?void 0:i.name)&&(c=!1);var u=l.isConnected;(null===(o=l.connectInputBlock)||void 0===o?void 0:o.isAttribute)&&!n.isVerticesDataPresent(null===(a=l.connectInputBlock)||void 0===a?void 0:a.name)&&(u=!1);var h=c&&u;e.setValue("TBNBLOCK",h,!0)}},t.prototype._buildBlock=function(t){e.prototype._buildBlock.call(this,t);var n=this.normal,r=this.tangent,i=this.world,o=this.TBN,a=this.row0,s=this.row1,l=this.row2,c=1===t.shaderLanguage,u=c?"mat3x3f":"mat3",h=c?"f":"";return t.target===pv.Fragment&&(t.compilationString+="\n // ".concat(this.name,"\n ").concat(t._declareLocalVar("tbnNormal",dv.Vector3)," = normalize(").concat(n.associatedVariableName,").xyz;\n ").concat(t._declareLocalVar("tbnTangent",dv.Vector3)," = normalize(").concat(r.associatedVariableName,".xyz);\n ").concat(t._declareLocalVar("tbnBitangent",dv.Vector3)," = cross(tbnNormal, tbnTangent) * ").concat(r.associatedVariableName,".w;\n ").concat(c?"var":"mat3"," ").concat(o.associatedVariableName," = ").concat(u,"(").concat(i.associatedVariableName,"[0].xyz, ").concat(i.associatedVariableName,"[1].xyz, ").concat(i.associatedVariableName,"[2].xyz) * ").concat(u,"(tbnTangent, tbnBitangent, tbnNormal);\n "),a.hasEndpoints&&(t.compilationString+=t._declareOutput(a)+" = vec3".concat(h,"(").concat(o.associatedVariableName,"[0][0], ").concat(o.associatedVariableName,"[0][1], ").concat(o.associatedVariableName,"[0][2]);\n")),s.hasEndpoints&&(t.compilationString+=t._declareOutput(s)+" = vec3".concat(h,"(").concat(o.associatedVariableName,"[1[0], ").concat(o.associatedVariableName,"[1][1], ").concat(o.associatedVariableName,"[1][2]);\n")),l.hasEndpoints&&(t.compilationString+=t._declareOutput(l)+" = vec3".concat(h,"(").concat(o.associatedVariableName,"[2][0], ").concat(o.associatedVariableName,"[2][1], ").concat(o.associatedVariableName,"[2][2]);\n")),t.sharedData.blocksWithDefines.push(this)),this},t}(Cv);(0,h.Y5)("BABYLON.TBNBlock",QT);var JT=function(e){function t(t){var n=e.call(this,t,pv.Fragment)||this;return n._tangentSpaceParameterName="",n._tangentCorrectionFactorName="",n._worldMatrixName="",n.invertX=!1,n.invertY=!1,n.useParallaxOcclusion=!1,n.useObjectSpaceNormalMap=!1,n._isUnique=!0,n.registerInput("worldPosition",dv.Vector4,!1),n.registerInput("worldNormal",dv.Vector4,!1),n.registerInput("worldTangent",dv.Vector4,!0),n.registerInput("uv",dv.Vector2,!1),n.registerInput("normalMapColor",dv.Color3,!1),n.registerInput("strength",dv.Float,!1),n.registerInput("viewDirection",dv.Vector3,!0),n.registerInput("parallaxScale",dv.Float,!0),n.registerInput("parallaxHeight",dv.Float,!0),n.registerInput("TBN",dv.Object,!0,pv.VertexAndFragment,new _T("TBN",n,0,QT,"TBNBlock")),n.registerInput("world",dv.Matrix,!0),n.registerOutput("output",dv.Vector4),n.registerOutput("uvOffset",dv.Vector2),n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"PerturbNormalBlock"},Object.defineProperty(t.prototype,"worldPosition",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"worldNormal",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"worldTangent",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"uv",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"normalMapColor",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"strength",{get:function(){return this._inputs[5]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"viewDirection",{get:function(){return this._inputs[6]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parallaxScale",{get:function(){return this._inputs[7]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parallaxHeight",{get:function(){return this._inputs[8]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"TBN",{get:function(){return this._inputs[9]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"world",{get:function(){return this._inputs[10]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"uvOffset",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),t.prototype.initialize=function(e){this._initShaderSourceAsync(e.shaderLanguage)},t.prototype._initShaderSourceAsync=function(e){return(0,f.sH)(this,void 0,void 0,(function(){return(0,f.YH)(this,(function(t){switch(t.label){case 0:return this._codeIsReady=!1,1!==e?[3,2]:[4,Promise.all([Promise.resolve().then(n.bind(n,20274)),Promise.resolve().then(n.bind(n,96830)),Promise.resolve().then(n.bind(n,66633))])];case 1:return t.sent(),[3,4];case 2:return[4,Promise.all([Promise.resolve().then(n.bind(n,56159)),Promise.resolve().then(n.bind(n,48661)),Promise.resolve().then(n.bind(n,75394))])];case 3:t.sent(),t.label=4;case 4:return this._codeIsReady=!0,this.onCodeIsReadyObservable.notifyObservers(this),[2]}}))}))},t.prototype.prepareDefines=function(e,t){var n=this.normalMapColor.connectedPoint._ownerBlock.samplerName,r=this.viewDirection.isConnected&&(this.useParallaxOcclusion&&!!n||!this.useParallaxOcclusion&&this.parallaxHeight.isConnected);e.setValue("BUMP",!0),e.setValue("PARALLAX",r,!0),e.setValue("PARALLAX_RHS",t.getScene().useRightHandedSystem,!0),e.setValue("PARALLAXOCCLUSION",this.useParallaxOcclusion,!0),e.setValue("OBJECTSPACE_NORMALMAP",this.useObjectSpaceNormalMap,!0)},t.prototype.bind=function(e,t,n){t.getScene()._mirroredCameraPosition?e.setFloat2(this._tangentSpaceParameterName,this.invertX?1:-1,this.invertY?1:-1):e.setFloat2(this._tangentSpaceParameterName,this.invertX?-1:1,this.invertY?-1:1),n&&(e.setFloat(this._tangentCorrectionFactorName,n.getWorldMatrix().determinant()<0?-1:1),this.useObjectSpaceNormalMap&&!this.world.isConnected&&e.setMatrix(this._worldMatrixName,n.getWorldMatrix()))},t.prototype.autoConfigure=function(e,t){if(void 0===t&&(t=function(){return!0}),!this.uv.isConnected){var n=e.getInputBlockByPredicate((function(e){return e.isAttribute&&"uv"===e.name&&t(e)}));n||(n=new Lv("uv")).setAsAttribute(),n.output.connectTo(this.uv)}if(!this.strength.isConnected){var r=new Lv("strength");r.value=1,r.output.connectTo(this.strength)}},t.prototype._buildBlock=function(t){e.prototype._buildBlock.call(this,t);var n="//".concat(this.name),r=this.uv,i=this.worldPosition,o=this.worldNormal,a=this.worldTangent,s=1===t.shaderLanguage,l=s?"mat3x3f":"mat3",c=s?"f":"",u=s?"uniforms.":"",h=s?"fragmentInputs.":"";t.sharedData.blocksWithDefines.push(this),t.sharedData.bindableBlocks.push(this),this._tangentSpaceParameterName=t._getFreeDefineName("tangentSpaceParameter"),t._emitUniformFromString(this._tangentSpaceParameterName,dv.Vector2),this._tangentCorrectionFactorName=t._getFreeDefineName("tangentCorrectionFactor"),t._emitUniformFromString(this._tangentCorrectionFactorName,dv.Float),this._worldMatrixName=t._getFreeDefineName("perturbNormalWorldMatrix"),t._emitUniformFromString(this._worldMatrixName,dv.Matrix);var d=null;this.normalMapColor.connectedPoint&&(d=this.normalMapColor.connectedPoint._ownerBlock.samplerName);var p=this.viewDirection.isConnected&&(this.useParallaxOcclusion&&!!d||!this.useParallaxOcclusion&&this.parallaxHeight.isConnected),f=this.parallaxScale.isConnectedToInputBlock?this.parallaxScale.connectInputBlock.isConstant?t._emitFloat(this.parallaxScale.connectInputBlock.value):this.parallaxScale.associatedVariableName:"0.05",m=this.strength.isConnectedToInputBlock&&this.strength.connectInputBlock.isConstant?"\n#if !defined(NORMALXYSCALE)\n1.0/\n#endif\n".concat(t._emitFloat(this.strength.connectInputBlock.value)):"\n#if !defined(NORMALXYSCALE)\n1.0/\n#endif\n".concat(this.strength.associatedVariableName);s||t._emitExtension("derivatives","#extension GL_OES_standard_derivatives : enable");var _={search:/defined\(TANGENT\)/g,replace:a.isConnected?"defined(TANGENT)":"defined(IGNORE)"},g={search:s?/uniform normalMatrix: mat4x4f;/g:/uniform mat4 normalMatrix;/g,replace:""},v=this.TBN;v.isConnected?t.compilationString+="\n #ifdef TBNBLOCK\n ".concat(s?"var":"mat3"," vTBN = ").concat(v.associatedVariableName,";\n #endif\n "):a.isConnected&&(t.compilationString+="".concat(t._declareLocalVar("tbnNormal",dv.Vector3)," = normalize(").concat(o.associatedVariableName,".xyz);\n"),t.compilationString+="".concat(t._declareLocalVar("tbnTangent",dv.Vector3)," = normalize(").concat(a.associatedVariableName,".xyz);\n"),t.compilationString+="".concat(t._declareLocalVar("tbnBitangent",dv.Vector3)," = cross(tbnNormal, tbnTangent) * ").concat(u).concat(this._tangentCorrectionFactorName,";\n"),t.compilationString+="".concat(s?"var":"mat3"," vTBN = ").concat(l,"(tbnTangent, tbnBitangent, tbnNormal);\n"));var y=[_,{search:/varying mat3 vTBN;/g,replace:""},g];s&&(y.push({search:/varying vTBN0: vec3f;/g,replace:""}),y.push({search:/varying vTBN1: vec3f;/g,replace:""}),y.push({search:/varying vTBN2: vec3f;/g,replace:""})),t._emitFunctionFromInclude("bumpFragmentMainFunctions",n,{replaceStrings:y});var S=s?"fn parallaxOcclusion(vViewDirCoT: vec3f, vNormalCoT: vec3f, texCoord: vec2f, parallaxScale:f32, bumpSampler: texture_2d, bumpSamplerSampler: sampler)":"#define inline\nvec2 parallaxOcclusion(vec3 vViewDirCoT, vec3 vNormalCoT, vec2 texCoord, float parallaxScale, sampler2D bumpSampler)",T=s?/fn parallaxOcclusion\(vViewDirCoT: vec3f,vNormalCoT: vec3f,texCoord: vec2f,parallaxScale: f32\)/g:/vec2 parallaxOcclusion\(vec3 vViewDirCoT,vec3 vNormalCoT,vec2 texCoord,float parallaxScale\)/g,E=s?"fn parallaxOffset(viewDir: vec3f, heightScale: f32, height_: f32)":"vec2 parallaxOffset(vec3 viewDir, float heightScale, float height_)",x=s?/fn parallaxOffset\(viewDir: vec3f,heightScale: f32\)/g:/vec2 parallaxOffset\(vec3 viewDir,float heightScale\)/g;t._emitFunctionFromInclude("bumpFragmentFunctions",n,{replaceStrings:[{search:/#include\(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump,_SAMPLERNAME_,bump\)/g,replace:""},{search:/uniform sampler2D bumpSampler;/g,replace:""},{search:T,replace:S},{search:x,replace:E},{search:/texture.+?bumpSampler,.*?vBumpUV\)\.w/g,replace:"height_"}]});var P=s?"textureSample(".concat(d,", ").concat(d+b.Y.AUTOSAMPLERSUFFIX):"texture2D(".concat(d),C=p&&d?"".concat(P,", ").concat(r.associatedVariableName," + uvOffset).xyz"):this.normalMapColor.associatedVariableName,R=t._getFreeVariableName("tempOutput");return t.compilationString+=t._declareLocalVar(R,dv.Vector3)+" = vec3".concat(c,"(0.);\n"),y=[{search:new RegExp("texture.+?bumpSampler".concat(s?"Sampler,fragmentInputs.":",","vBumpUV\\)"),"g"),replace:"".concat(C)},{search:/#define CUSTOM_FRAGMENT_BUMP_FRAGMENT/g,replace:"".concat(t._declareLocalVar("normalMatrix",dv.Matrix)," = toNormalMatrix(").concat(this.world.isConnected?this.world.associatedVariableName:u+this._worldMatrixName,");")},{search:new RegExp("perturbNormal\\(TBN,texture.+?bumpSampler".concat(s?"Sampler,fragmentInputs.":",","vBumpUV\\+uvOffset\\).xyz,").concat(u,"vBumpInfos.y\\)"),"g"),replace:"perturbNormal(TBN, ".concat(C,", ").concat(u,"vBumpInfos.y)")},{search:/parallaxOcclusion\(invTBN\*-viewDirectionW,invTBN\*normalW,(fragmentInputs\.)?vBumpUV,(uniforms\.)?vBumpInfos.z\)/g,replace:"parallaxOcclusion((invTBN * -viewDirectionW), (invTBN * normalW), ".concat(h,"vBumpUV, ").concat(u,"vBumpInfos.z, ").concat(s?p&&this.useParallaxOcclusion?"".concat(d,", ").concat(d+b.Y.AUTOSAMPLERSUFFIX):"bump, bumpSampler":p&&this.useParallaxOcclusion?d:"bumpSampler",")")},{search:/parallaxOffset\(invTBN\*viewDirectionW,vBumpInfos\.z\)/g,replace:"parallaxOffset(invTBN * viewDirectionW, ".concat(u,"vBumpInfos.z, ").concat(p?this.parallaxHeight.associatedVariableName:"0.",")")},{search:s?/uniforms.vBumpInfos.y/g:/vBumpInfos.y/g,replace:m},{search:s?/uniforms.vBumpInfos.z/g:/vBumpInfos.z/g,replace:f},{search:/normalW=/g,replace:R+" = "},s?{search:/mat3x3f\(uniforms\.normalMatrix\[0\].xyz,uniforms\.normalMatrix\[1\]\.xyz,uniforms\.normalMatrix\[2\].xyz\)\*normalW/g,replace:"".concat(l,"(normalMatrix[0].xyz, normalMatrix[1].xyz, normalMatrix[2].xyz) * ")+R}:{search:/mat3\(normalMatrix\)\*normalW/g,replace:"".concat(l,"(normalMatrix) * ")+R},{search:/normalW/g,replace:o.associatedVariableName+".xyz"},{search:/viewDirectionW/g,replace:p?this.viewDirection.associatedVariableName:"vec3".concat(c,"(0.)")},_],s?(y.push({search:/fragmentInputs.vBumpUV/g,replace:r.associatedVariableName}),y.push({search:/input.vPositionW/g,replace:i.associatedVariableName+".xyz"}),y.push({search:/uniforms.vTangentSpaceParams/g,replace:u+this._tangentSpaceParameterName}),y.push({search:/var TBN: mat3x3f=mat3x3\(input.vTBN0,input.vTBN1,input.vTBN2\);/g,replace:"var TBN = vTBN;"})):(y.push({search:/vBumpUV/g,replace:r.associatedVariableName}),y.push({search:/vPositionW/g,replace:i.associatedVariableName+".xyz"}),y.push({search:/vTangentSpaceParams/g,replace:u+this._tangentSpaceParameterName})),t.compilationString+=t._emitCodeFromInclude("bumpFragment",n,{replaceStrings:y}),t.compilationString+=t._declareOutput(this.output)+" = vec4".concat(c,"(").concat(R,", 0.);\n"),this},t.prototype._dumpPropertiesCode=function(){var t=e.prototype._dumpPropertiesCode.call(this)+"".concat(this._codeVariableName,".invertX = ").concat(this.invertX,";\n");return t+="".concat(this._codeVariableName,".invertY = ").concat(this.invertY,";\n"),(t+="".concat(this._codeVariableName,".useParallaxOcclusion = ").concat(this.useParallaxOcclusion,";\n"))+"".concat(this._codeVariableName,".useObjectSpaceNormalMap = ").concat(this.useObjectSpaceNormalMap,";\n")},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.invertX=this.invertX,t.invertY=this.invertY,t.useParallaxOcclusion=this.useParallaxOcclusion,t.useObjectSpaceNormalMap=this.useObjectSpaceNormalMap,t},t.prototype._deserialize=function(t,n,r){e.prototype._deserialize.call(this,t,n,r),this.invertX=t.invertX,this.invertY=t.invertY,this.useParallaxOcclusion=!!t.useParallaxOcclusion,this.useObjectSpaceNormalMap=!!t.useObjectSpaceNormalMap,this.parallaxScale._isInactive=this.useParallaxOcclusion,this.parallaxHeight._isInactive=this.useParallaxOcclusion},(0,f.Cg)([Jp("Invert X axis",0,"PROPERTIES",{embedded:!0,notifiers:{update:!0}})],t.prototype,"invertX",void 0),(0,f.Cg)([Jp("Invert Y axis",0,"PROPERTIES",{embedded:!0,notifiers:{update:!0}})],t.prototype,"invertY",void 0),(0,f.Cg)([Jp("Use parallax occlusion",0,void 0,{embedded:!0,notifiers:{update:!0,callback:function(e,t){return t.parallaxScale._isInactive=t.useParallaxOcclusion,t.parallaxHeight._isInactive=t.useParallaxOcclusion,!0}}})],t.prototype,"useParallaxOcclusion",void 0),(0,f.Cg)([Jp("Object Space Mode",0,"PROPERTIES",{embedded:!0,notifiers:{update:!0}})],t.prototype,"useObjectSpaceNormalMap",void 0),t}(Cv);(0,h.Y5)("BABYLON.PerturbNormalBlock",JT);var $T=function(e){function t(t){var n=e.call(this,t,pv.Fragment,!0)||this;return n.registerInput("value",dv.Float,!0),n.registerInput("cutoff",dv.Float,!0),n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"DiscardBlock"},Object.defineProperty(t.prototype,"value",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cutoff",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(t){if(e.prototype._buildBlock.call(this,t),t.sharedData.hints.needAlphaTesting=!0,this.cutoff.isConnected&&this.value.isConnected)return t.compilationString+="if (".concat(this.value.associatedVariableName," < ").concat(this.cutoff.associatedVariableName,") { discard; }\n"),this},t}(Cv);(0,h.Y5)("BABYLON.DiscardBlock",$T);var eE=function(e){function t(t){var n=e.call(this,t,pv.Fragment)||this;return n.registerOutput("output",dv.Float,pv.Fragment),n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"FrontFacingBlock"},Object.defineProperty(t.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(t){if(e.prototype._buildBlock.call(this,t),t.target===pv.Vertex)return t.sharedData.raiseBuildError("FrontFacingBlock must only be used in a fragment shader"),this;var n=this._outputs[0];return t.compilationString+=t._declareOutput(n)+" = ".concat(t._generateTernary("1.0","0.0",0===t.shaderLanguage?"gl_FrontFacing":"fragmentInputs.frontFacing"),";\n"),this},t}(Cv);(0,h.Y5)("BABYLON.FrontFacingBlock",eE);var tE=function(e){function t(t){var n=e.call(this,t,pv.Fragment)||this;return n.registerInput("input",dv.AutoDetect,!1),n.registerOutput("dx",dv.BasedOnInput),n.registerOutput("dy",dv.BasedOnInput),n._outputs[0]._typeConnectionSource=n._inputs[0],n._outputs[1]._typeConnectionSource=n._inputs[0],n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"DerivativeBlock"},Object.defineProperty(t.prototype,"input",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dx",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dy",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(t){e.prototype._buildBlock.call(this,t);var n=this._outputs[0],r=this._outputs[1];t._emitExtension("derivatives","#extension GL_OES_standard_derivatives : enable");var i="dFdx",o="dFdy";return 1===t.shaderLanguage&&(i="dpdx",o="dpdy"),n.hasEndpoints&&(t.compilationString+=t._declareOutput(n)+" = ".concat(i,"(").concat(this.input.associatedVariableName,");\n")),r.hasEndpoints&&(t.compilationString+=t._declareOutput(r)+" = ".concat(o,"(").concat(this.input.associatedVariableName,");\n")),this},t}(Cv);(0,h.Y5)("BABYLON.DerivativeBlock",tE);var nE=function(e){function t(t){var n=e.call(this,t,pv.Fragment)||this;return n.registerOutput("xy",dv.Vector2,pv.Fragment),n.registerOutput("xyz",dv.Vector3,pv.Fragment),n.registerOutput("xyzw",dv.Vector4,pv.Fragment),n.registerOutput("x",dv.Float,pv.Fragment),n.registerOutput("y",dv.Float,pv.Fragment),n.registerOutput("z",dv.Float,pv.Fragment),n.registerOutput("w",dv.Float,pv.Fragment),n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"FragCoordBlock"},Object.defineProperty(t.prototype,"xy",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"xyz",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"xyzw",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"x",{get:function(){return this._outputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"y",{get:function(){return this._outputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"z",{get:function(){return this._outputs[5]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"output",{get:function(){return this._outputs[6]},enumerable:!1,configurable:!0}),t.prototype.writeOutputs=function(e){for(var t="",n=1===e.shaderLanguage?"fragmentInputs.position":"gl_FragCoord",r=0,i=this._outputs;r, SCENE_MRT_COUNT>;\r\n":"vec4 fragData[SCENE_MRT_COUNT];\r\n",t.compilationString+="#ifdef PREPASS_DEPTH\r\n",a.connectedPoint?t.compilationString+=" fragData[PREPASS_DEPTH_INDEX] = ".concat(d,"(").concat(a.associatedVariableName,", 0.0, 0.0, 1.0);\r\n"):t.compilationString+=" fragData[PREPASS_DEPTH_INDEX] = ".concat(d,"(0.0, 0.0, 0.0, 0.0);\r\n"),t.compilationString+="#endif\r\n",t.compilationString+="#ifdef PREPASS_SCREENSPACE_DEPTH\r\n",l.connectedPoint?t.compilationString+=" gl_FragData[PREPASS_SCREENSPACE_DEPTH_INDEX] = vec4(".concat(l.associatedVariableName,", 0.0, 0.0, 1.0);\r\n"):t.compilationString+=" gl_FragData[PREPASS_SCREENSPACE_DEPTH_INDEX] = vec4(0.0, 0.0, 0.0, 0.0);\r\n",t.compilationString+="#endif\r\n",t.compilationString+="#ifdef PREPASS_POSITION\r\n",n.connectedPoint?t.compilationString+="fragData[PREPASS_POSITION_INDEX] = ".concat(d,"(").concat(n.associatedVariableName,".rgb, ").concat(n.connectedPoint.type===dv.Vector4?n.associatedVariableName+".a":"1.0",");\r\n"):t.compilationString+=" fragData[PREPASS_POSITION_INDEX] = ".concat(d,"(0.0, 0.0, 0.0, 0.0);\r\n"),t.compilationString+="#endif\r\n",t.compilationString+="#ifdef PREPASS_LOCAL_POSITION\r\n",r.connectedPoint?t.compilationString+=" gl_FragData[PREPASS_LOCAL_POSITION_INDEX] = vec4(".concat(r.associatedVariableName,".rgb, ").concat(r.connectedPoint.type===dv.Vector4?r.associatedVariableName+".a":"1.0",");\r\n"):t.compilationString+=" gl_FragData[PREPASS_LOCAL_POSITION_INDEX] = vec4(0.0, 0.0, 0.0, 0.0);\r\n",t.compilationString+="#endif\r\n",t.compilationString+="#ifdef PREPASS_NORMAL\r\n",i.connectedPoint?t.compilationString+=" fragData[PREPASS_NORMAL_INDEX] = ".concat(d,"(").concat(i.associatedVariableName,".rgb, ").concat(i.connectedPoint.type===dv.Vector4?i.associatedVariableName+".a":"1.0",");\r\n"):t.compilationString+=" fragData[PREPASS_NORMAL_INDEX] = ".concat(d,"(0.0, 0.0, 0.0, 0.0);\r\n"),t.compilationString+="#endif\r\n",t.compilationString+="#ifdef PREPASS_WORLD_NORMAL\r\n",o.connectedPoint?t.compilationString+=" gl_FragData[PREPASS_WORLD_NORMAL_INDEX] = vec4(".concat(o.associatedVariableName,".rgb, ").concat(o.connectedPoint.type===dv.Vector4?o.associatedVariableName+".a":"1.0",");\r\n"):t.compilationString+=" gl_FragData[PREPASS_WORLD_NORMAL_INDEX] = vec4(0.0, 0.0, 0.0, 0.0);\r\n",t.compilationString+="#endif\r\n",t.compilationString+="#ifdef PREPASS_REFLECTIVITY\r\n",s.connectedPoint?t.compilationString+=" fragData[PREPASS_REFLECTIVITY_INDEX] = ".concat(d,"(").concat(s.associatedVariableName,".rgb, ").concat(s.connectedPoint.type===dv.Vector4?s.associatedVariableName+".a":"1.0",");\r\n"):t.compilationString+=" fragData[PREPASS_REFLECTIVITY_INDEX] = ".concat(d,"(0.0, 0.0, 0.0, 1.0);\r\n"),t.compilationString+="#endif\r\n",t.compilationString+="#ifdef PREPASS_VELOCITY\r\n",c.connectedPoint?t.compilationString+=" fragData[PREPASS_VELOCITY_INDEX] = ".concat(d,"(").concat(c.associatedVariableName,".rgb, ").concat(c.connectedPoint.type===dv.Vector4?c.associatedVariableName+".a":"1.0",");\r\n"):t.compilationString+=" fragData[PREPASS_VELOCITY_INDEX] = ".concat(d,"(0.0, 0.0, 0.0, 1.0);\r\n"),t.compilationString+="#endif\r\n",t.compilationString+="#ifdef PREPASS_VELOCITY_LINEAR\r\n",u.connectedPoint?t.compilationString+=" fragData[PREPASS_VELOCITY_LINEAR_INDEX] = ".concat(d,"(").concat(u.associatedVariableName,".rgb, ").concat(u.connectedPoint.type===dv.Vector4?u.associatedVariableName+".a":"1.0",");\r\n"):t.compilationString+=" fragData[PREPASS_VELOCITY_LINEAR_INDEX] = ".concat(d,"(0.0, 0.0, 0.0, 1.0);\r\n"),t.compilationString+="#endif\r\n",t.compilationString+="#if SCENE_MRT_COUNT > 1\r\n",t.compilationString+="".concat(this._getFragData(p,1)," = fragData[1];\r\n"),t.compilationString+="#endif\r\n",t.compilationString+="#if SCENE_MRT_COUNT > 2\r\n",t.compilationString+="".concat(this._getFragData(p,2)," = fragData[2];\r\n"),t.compilationString+="#endif\r\n",t.compilationString+="#if SCENE_MRT_COUNT > 3\r\n",t.compilationString+="".concat(this._getFragData(p,3)," = fragData[3];\r\n"),t.compilationString+="#endif\r\n",t.compilationString+="#if SCENE_MRT_COUNT > 4\r\n",t.compilationString+="".concat(this._getFragData(p,4)," = fragData[4];\r\n"),t.compilationString+="#endif\r\n",t.compilationString+="#if SCENE_MRT_COUNT > 5\r\n",t.compilationString+="".concat(this._getFragData(p,5)," = fragData[5];\r\n"),t.compilationString+="#endif\r\n",t.compilationString+="#if SCENE_MRT_COUNT > 6\r\n",t.compilationString+="".concat(this._getFragData(p,6)," = fragData[6];\r\n"),t.compilationString+="#endif\r\n",t.compilationString+="#if SCENE_MRT_COUNT > 7\r\n",t.compilationString+="".concat(this._getFragData(p,7)," = fragData[7];\r\n"),t.compilationString+="#endif\r\n",t.compilationString+="#endif\r\n",this},t}(Cv);(0,h.Y5)("BABYLON.PrePassOutputBlock",lE);var cE=function(e){function t(t){var n=e.call(this,t,pv.Fragment)||this;return n.radius=1e-4,n.area=.0075,n.fallOff=1e-6,n.registerInput("source",dv.Object,!0,pv.VertexAndFragment,new _T("source",n,0,IT,"ImageSourceBlock")),n.registerInput("screenSize",dv.Vector2),n.registerOutput("occlusion",dv.Float),n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"AmbientOcclusionBlock"},Object.defineProperty(t.prototype,"source",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"screenSize",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"occlusion",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype.bind=function(e){this._randomTexture||this._createRandomTexture(e.getEngine()),e.setTexture(this._randomSamplerName,this._randomTexture)},t.prototype._createRandomTexture=function(e){for(var t=new Uint8Array(1048576),n=0;n vec3f {\n let offset1: vec2f = vec2f(0.0, radius);\n let offset2: vec2f = vec2f(radius, 0.0);\n\n let depth1: f32 = textureSampleLevel(".concat(r.samplerName,", ").concat(r.samplerName,"Sampler, coords + offset1, 0.0).r;\n let depth2: f32 = textureSampleLevel(").concat(r.samplerName,", ").concat(r.samplerName,"Sampler, coords + offset2, 0.0).r;\n\n let p1: vec3f = vec3f(offset1, depth1 - depth);\n let p2: vec3f = vec3f(offset2, depth2 - depth);\n\n var normal: vec3f = cross(p1, p2);\n normal.z = -normal.z;\n\n return normalize(normal);\n }\n "):"vec3 normalFromDepth(float depth, vec2 coords, float radius) {\n vec2 offset1 = vec2(0.0, radius);\n vec2 offset2 = vec2(radius, 0.0);\n\n float depth1 = textureLod(".concat(r.samplerName,", coords + offset1, 0.0).r;\n float depth2 = textureLod(").concat(r.samplerName,", coords + offset2, 0.0).r;\n\n vec3 p1 = vec3(offset1, depth1 - depth);\n vec3 p2 = vec3(offset2, depth2 - depth);\n\n vec3 normal = cross(p1, p2);\n normal.z = -normal.z;\n\n return normalize(normal);\n }\n "),t._emitFunction("normalFromDepth",n,"// normalFromDepth function"),this._randomSamplerName=t._getFreeVariableName("randomSampler"),t._emit2DSampler(this._randomSamplerName),n=1===t.shaderLanguage?"\n const sampleSphere: array = array(\n vec3f( 0.5381, 0.1856, -0.4319),\n vec3f( 0.1379, 0.2486, 0.4430),\n vec3f( 0.3371, 0.5679, -0.0057),\n vec3f(-0.6999, -0.0451, -0.0019),\n vec3f( 0.0689, -0.1598, -0.8547),\n vec3f( 0.0560, 0.0069, -0.1843),\n vec3f(-0.0146, 0.1402, 0.0762),\n vec3f( 0.0100, -0.1924, -0.0344),\n vec3f(-0.3577, -0.5301, -0.4358),\n vec3f(-0.3169, 0.1063, 0.0158),\n vec3f( 0.0103, -0.5869, 0.0046),\n vec3f(-0.0897, -0.4940, 0.3287),\n vec3f( 0.7119, -0.0154, -0.0918),\n vec3f(-0.0533, 0.0596, -0.5411),\n vec3f( 0.0352, -0.0631, 0.5460),\n vec3f(-0.4776, 0.2847, -0.0271)\n );\n\n fn computeOcclusion(screenSize: vec2f) -> f32 {\n let uv: vec2f = fragmentInputs.position.xy / screenSize;\n let random: vec3f = normalize(textureSampleLevel(".concat(this._randomSamplerName,", ").concat(this._randomSamplerName,"Sampler, uv * 4.0, 0.0).rgb);\n let depth: f32 = textureSampleLevel(").concat(r.samplerName,", ").concat(r.samplerName,"Sampler, uv, 0.0).r;\n let position: vec3f = vec3f(uv, depth);\n let normal: vec3f = normalFromDepth(depth, uv, ").concat(this.radius,"f);\n\n let radiusDepth: f32 = ").concat(this.radius,"f / depth;\n var occlusion: f32 = 0.0;\n\n var ray: vec3f;\n var hemiRay: vec3f;\n var occlusionDepth: f32;\n var difference: f32;\n\n for (var i: i32 = 0; i < 16; i++)\n {\n ray = radiusDepth * reflect(sampleSphere[i], random);\n hemiRay = position + sign(dot(ray, normal)) * ray;\n\n occlusionDepth = textureSample(").concat(r.samplerName,", ").concat(r.samplerName,"Sampler, clamp(hemiRay.xy, vec2f(0.001, 0.001), vec2f(0.999, 0.999))).r;\n difference = depth - occlusionDepth;\n\n occlusion += step(").concat(this.fallOff,"f, difference) * (1.0 - smoothstep(").concat(this.fallOff,"f, ").concat(this.area,"f, difference));\n }\n\n return clamp(1.0 - occlusion / 16.0, 0.0, 1.0);\n }\n "):"\n const vec3 sampleSphere[16] = vec3[](\n vec3( 0.5381, 0.1856, -0.4319),\n vec3( 0.1379, 0.2486, 0.4430),\n vec3( 0.3371, 0.5679, -0.0057),\n vec3(-0.6999, -0.0451, -0.0019),\n vec3( 0.0689, -0.1598, -0.8547),\n vec3( 0.0560, 0.0069, -0.1843),\n vec3(-0.0146, 0.1402, 0.0762),\n vec3( 0.0100, -0.1924, -0.0344),\n vec3(-0.3577, -0.5301, -0.4358),\n vec3(-0.3169, 0.1063, 0.0158),\n vec3( 0.0103, -0.5869, 0.0046),\n vec3(-0.0897, -0.4940, 0.3287),\n vec3( 0.7119, -0.0154, -0.0918),\n vec3(-0.0533, 0.0596, -0.5411),\n vec3( 0.0352, -0.0631, 0.5460),\n vec3(-0.4776, 0.2847, -0.0271)\n );\n\n float computeOcclusion(vec2 screenSize) {\n vec2 uv = gl_FragCoord.xy / screenSize;\n vec3 random = normalize(textureLod(".concat(this._randomSamplerName,", uv * 4., 0.0).rgb);\n float depth = textureLod(").concat(r.samplerName,", uv, 0.0).r; \n vec3 position = vec3(uv, depth);\n vec3 normal = normalFromDepth(depth, uv, ").concat(this.radius," );\n\n float radiusDepth = ").concat(this.radius," / depth;\n float occlusion = 0.0;\n\n vec3 ray;\n vec3 hemiRay;\n float occlusionDepth;\n float difference;\n\n for (int i = 0; i < 16; i++)\n {\n ray = radiusDepth * reflect(sampleSphere[i], random);\n hemiRay = position + sign(dot(ray, normal)) * ray;\n\n occlusionDepth = texture2D(").concat(r.samplerName,", clamp(hemiRay.xy, vec2(0.001, 0.001), vec2(0.999, 0.999))).r;\n difference = depth - occlusionDepth;\n\n occlusion += step(").concat(this.fallOff,", difference) * (1.0 - smoothstep(").concat(this.fallOff,", ").concat(this.area,", difference));\n }\n\n return clamp(1.0 - occlusion / 16.0, 0.0, 1.0);\n }\n "),t._emitFunction("computeOcclusion",n,"// computeOcclusion function"),t.compilationString+=t._declareOutput(i)+" = computeOcclusion(".concat(o.associatedVariableName,");"),this},t.prototype.dispose=function(){this._randomTexture&&(this._randomTexture.dispose(),this._randomTexture=null),e.prototype.dispose.call(this)},(0,f.Cg)([Jp("radius",1,"ADVANCED",{min:1e-4})],t.prototype,"radius",void 0),(0,f.Cg)([Jp("area",1,"ADVANCED",{min:0})],t.prototype,"area",void 0),(0,f.Cg)([Jp("fallOff",1,"ADVANCED",{min:0})],t.prototype,"fallOff",void 0),t}(Cv);(0,h.Y5)("BABYLON.AmbientOcclusionBlock",cE);var uE=n(86320),hE=n(4661),dE=n(75334),pE=n(59581),fE=n(40688),mE=n(20274),_E=n(96830),gE=n(66633),vE=n(56159),yE=n(48661),bE=n(75394),SE=n(28924),TE=n(68298),EE=n(79574),xE=n(62371),PE=n(78531),CE=n(29313),RE=function(e){function t(t){var n=e.call(this,t,pv.VertexAndFragment,!1)||this;return n.registerInput("worldPosition",dv.Vector4,!1,pv.Vertex),n.registerInput("view",dv.Matrix,!1,pv.Vertex),n.registerInput("input",dv.AutoDetect,!1,pv.Fragment),n.registerInput("fogColor",dv.AutoDetect,!1,pv.Fragment),n.registerOutput("output",dv.Color3,pv.Fragment),n.input.addExcludedConnectionPointFromAllowedTypes(dv.Color3|dv.Vector3|dv.Color4),n.fogColor.addExcludedConnectionPointFromAllowedTypes(dv.Color3|dv.Vector3|dv.Color4),n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"FogBlock"},Object.defineProperty(t.prototype,"worldPosition",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"view",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"input",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fogColor",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype.initialize=function(e){this._initShaderSourceAsync(e.shaderLanguage)},t.prototype._initShaderSourceAsync=function(e){return(0,f.sH)(this,void 0,void 0,(function(){return(0,f.YH)(this,(function(t){switch(t.label){case 0:return this._codeIsReady=!1,1!==e?[3,2]:[4,Promise.resolve().then(n.bind(n,98318))];case 1:return t.sent(),[3,4];case 2:return[4,Promise.resolve().then(n.bind(n,52767))];case 3:t.sent(),t.label=4;case 4:return this._codeIsReady=!0,this.onCodeIsReadyObservable.notifyObservers(this),[2]}}))}))},t.prototype.autoConfigure=function(e,t){if(void 0===t&&(t=function(){return!0}),!this.view.isConnected){var n=e.getInputBlockByPredicate((function(e){return e.systemValue===Av.View&&t(e)}));n||(n=new Lv("view")).setAsSystemValue(Av.View),n.output.connectTo(this.view)}if(!this.fogColor.isConnected){var r=e.getInputBlockByPredicate((function(e){return e.systemValue===Av.FogColor&&t(e)}));r||(r=new Lv("fogColor",void 0,dv.Color3)).setAsSystemValue(Av.FogColor),r.output.connectTo(this.fogColor)}},t.prototype.prepareDefines=function(e,t,n){if(n){var r=n.getScene();e.setValue("FOG",t.fogEnabled&&(0,Le.qL)(n,r))}},t.prototype.bind=function(e,t,n){if(n){var r=n.getScene();e.setFloat4(this._fogParameters,r.fogMode,r.fogStart,r.fogEnd,r.fogDensity)}},t.prototype._buildBlock=function(t){if(e.prototype._buildBlock.call(this,t),t.target===pv.Fragment){t.sharedData.blocksWithDefines.push(this),t.sharedData.bindableBlocks.push(this);var n=[],r="",i="";1===t.shaderLanguage?(n=[{search:/fn CalcFogFactor\(\)/,replace:"fn CalcFogFactor(vFogDistance: vec3f, vFogInfos: vec4f)"},{search:/uniforms.vFogInfos/g,replace:"vFogInfos"},{search:/fragmentInputs.vFogDistance/g,replace:"vFogDistance"}],r="fragmentInputs.",i="uniforms."):n=[{search:/float CalcFogFactor\(\)/,replace:"float CalcFogFactor(vec3 vFogDistance, vec4 vFogInfos)"}],t._emitFunctionFromInclude("fogFragmentDeclaration","//".concat(this.name),{removeUniforms:!0,removeVaryings:!0,removeIfDef:!1,replaceStrings:n});var o=t._getFreeVariableName("fog"),a=this.input,s=this.fogColor;this._fogParameters=t._getFreeVariableName("fogParameters");var l=this._outputs[0];t._emitUniformFromString(this._fogParameters,dv.Vector4),t.compilationString+="#ifdef FOG\n",t.compilationString+="".concat(t._declareLocalVar(o,dv.Float)," = CalcFogFactor(").concat(r).concat(this._fogDistanceName,", ").concat(i).concat(this._fogParameters,");\n"),t.compilationString+=t._declareOutput(l)+" = ".concat(o," * ").concat(a.associatedVariableName,".rgb + (1.0 - ").concat(o,") * ").concat(s.associatedVariableName,".rgb;\n"),t.compilationString+="#else\n".concat(t._declareOutput(l)," = ").concat(a.associatedVariableName,".rgb;\n"),t.compilationString+="#endif\n"}else{var c=this.worldPosition,u=this.view;this._fogDistanceName=t._getFreeVariableName("vFogDistance"),t._emitVaryingFromString(this._fogDistanceName,dv.Vector3);var h=1===t.shaderLanguage?"vertexOutputs.":"";t.compilationString+="".concat(h).concat(this._fogDistanceName," = (").concat(u.associatedVariableName," * ").concat(c.associatedVariableName,").xyz;\n")}return this},t}(Cv);(0,h.Y5)("BABYLON.FogBlock",RE);var AE=function(e){function t(t){var n=e.call(this,t,pv.VertexAndFragment)||this;return n._lightId=0,n.generateOnlyFragmentCode=!1,n._isUnique=!0,n.registerInput("worldPosition",dv.Vector4,!1,pv.Vertex),n.registerInput("worldNormal",dv.Vector4,!1,pv.Fragment),n.registerInput("cameraPosition",dv.Vector3,!1,pv.Fragment),n.registerInput("glossiness",dv.Float,!0,pv.Fragment),n.registerInput("glossPower",dv.Float,!0,pv.Fragment),n.registerInput("diffuseColor",dv.Color3,!0,pv.Fragment),n.registerInput("specularColor",dv.Color3,!0,pv.Fragment),n.registerInput("view",dv.Matrix,!0),n.registerOutput("diffuseOutput",dv.Color3,pv.Fragment),n.registerOutput("specularOutput",dv.Color3,pv.Fragment),n.registerOutput("shadow",dv.Float,pv.Fragment),n}return(0,f.C6)(t,e),t._OnGenerateOnlyFragmentCodeChanged=function(e,t){var n=e;return n.worldPosition.isConnected?(n.generateOnlyFragmentCode=!n.generateOnlyFragmentCode,y.V.Error("The worldPosition input must not be connected to be able to switch!"),!1):(n._setTarget(),!0)},t.prototype._setTarget=function(){this._setInitialTarget(this.generateOnlyFragmentCode?pv.Fragment:pv.VertexAndFragment),this.getInputByName("worldPosition").target=this.generateOnlyFragmentCode?pv.Fragment:pv.Vertex},t.prototype.getClassName=function(){return"LightBlock"},Object.defineProperty(t.prototype,"worldPosition",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"worldNormal",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cameraPosition",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"glossiness",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"glossPower",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"diffuseColor",{get:function(){return this._inputs[5]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"specularColor",{get:function(){return this._inputs[6]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"view",{get:function(){return this._inputs[7]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"diffuseOutput",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"specularOutput",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shadow",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),t.prototype.initialize=function(e){this._initShaderSourceAsync(e.shaderLanguage),e._excludeVariableName("vViewDepth")},t.prototype._initShaderSourceAsync=function(e){return(0,f.sH)(this,void 0,void 0,(function(){return(0,f.YH)(this,(function(t){switch(t.label){case 0:return this._codeIsReady=!1,1!==e?[3,2]:[4,Promise.all([Promise.resolve().then(n.bind(n,84192)),Promise.resolve().then(n.bind(n,10896)),Promise.resolve().then(n.bind(n,58902)),Promise.resolve().then(n.bind(n,17393)),Promise.resolve().then(n.bind(n,53378)),Promise.resolve().then(n.bind(n,32532)),Promise.resolve().then(n.bind(n,59115))])];case 1:return t.sent(),[3,4];case 2:return[4,Promise.all([Promise.resolve().then(n.bind(n,87283)),Promise.resolve().then(n.bind(n,7363)),Promise.resolve().then(n.bind(n,32823)),Promise.resolve().then(n.bind(n,48961)),Promise.resolve().then(n.bind(n,94785)),Promise.resolve().then(n.bind(n,75334)),Promise.resolve().then(n.bind(n,54409)),Promise.resolve().then(n.bind(n,46837)),Promise.resolve().then(n.bind(n,62136))])];case 3:t.sent(),t.label=4;case 4:return this._codeIsReady=!0,this.onCodeIsReadyObservable.notifyObservers(this),[2]}}))}))},t.prototype.autoConfigure=function(e,t){if(void 0===t&&(t=function(){return!0}),!this.cameraPosition.isConnected){var n=e.getInputBlockByPredicate((function(e){return e.systemValue===Av.CameraPosition&&t(e)}));n||(n=new Lv("cameraPosition")).setAsSystemValue(Av.CameraPosition),n.output.connectTo(this.cameraPosition)}},t.prototype.prepareDefines=function(e,t,n){if(n&&e._areLightsDirty){var r=n.getScene();if(this.light){var i={needNormals:!1,needRebuild:!1,lightmapMode:!1,shadowEnabled:!1,specularEnabled:!1};(0,Le.lo)(r,n,this.light,this._lightId,e,!0,i),i.needRebuild&&e.rebuild()}else(0,Le.az)(r,n,e,!0,t.maxSimultaneousLights)}},t.prototype.updateUniformsAndSamples=function(e,t,n,r){e.samplers.push("areaLightsLTC1Sampler"),e.samplers.push("areaLightsLTC2Sampler");for(var i=0;i=0;(0,Le.GD)(i,e.uniforms,e.samplers,n["PROJECTEDLIGHTTEXTURE"+i],r,o,n["IESLIGHTTEXTURE"+i],n["CLUSTLIGHT"+i])}},t.prototype.bind=function(e,t,n){if(n){var r=n.getScene();this.light?(0,Le.Kd)(this.light,this._lightId,r,e,!0):(0,Le.RL)(r,n,e,!0,t.maxSimultaneousLights)}},t.prototype._injectVertexCode=function(e){var t=this.worldPosition,n="//".concat(this.name);this.light?(this._lightId=(void 0!==e.counters.lightCounter?e.counters.lightCounter:-1)+1,e.counters.lightCounter=this._lightId,e._emitFunctionFromInclude(e.supportUniformBuffers?"lightVxUboDeclaration":"lightVxFragmentDeclaration",n,{replaceStrings:[{search:/{X}/g,replace:this._lightId.toString()}]},this._lightId.toString())):(e._emitFunctionFromInclude(e.supportUniformBuffers?"lightVxUboDeclaration":"lightVxFragmentDeclaration",n,{repeatKey:"maxSimultaneousLights"}),this._lightId=0,e.sharedData.dynamicUniformBlocks.push(this));var r="v_"+t.associatedVariableName;e._emitVaryingFromString(r,dv.Vector4)&&(e.compilationString+=(1===e.shaderLanguage?"vertexOutputs.":"")+"".concat(r," = ").concat(t.associatedVariableName,";\n")),this.light?e.compilationString+=e._emitCodeFromInclude("shadowsVertex",n,{replaceStrings:[{search:/{X}/g,replace:this._lightId.toString()},{search:/worldPos/g,replace:t.associatedVariableName}]}):(e.compilationString+="".concat(e._declareLocalVar("worldPos",dv.Vector4)," = ").concat(t.associatedVariableName,";\n"),this.view.isConnected&&(e.compilationString+="".concat(e._declareLocalVar("view",dv.Matrix)," = ").concat(this.view.associatedVariableName,";\n"),e._emitVaryingFromString("vViewDepth",dv.Float),e.compilationString+=(1===e.shaderLanguage?"vertexOutputs.":"")+"vViewDepth = (".concat(this.view.associatedVariableName," * ").concat(t.associatedVariableName,").z;\n")),e.compilationString+=e._emitCodeFromInclude("shadowsVertex",n,{repeatKey:"maxSimultaneousLights"}))},t.prototype._injectUBODeclaration=function(e){var t="//".concat(this.name);this.light?e._emitFunctionFromInclude(e.supportUniformBuffers?"lightUboDeclaration":"lightFragmentDeclaration",t,{replaceStrings:[{search:/{X}/g,replace:this._lightId.toString()}]},this._lightId.toString()):e._emitFunctionFromInclude(e.supportUniformBuffers?"lightUboDeclaration":"lightFragmentDeclaration",t,{repeatKey:"maxSimultaneousLights",substitutionVars:this.generateOnlyFragmentCode?"varying,":void 0})},t.prototype._buildBlock=function(t){e.prototype._buildBlock.call(this,t);var n=1===t.shaderLanguage,r=n?"f":"",i="//".concat(this.name);if(t.target===pv.Fragment){this.generateOnlyFragmentCode&&t.sharedData.dynamicUniformBlocks.push(this);var o=n?"fragmentInputs.":"";t.sharedData.forcedBindableBlocks.push(this),t.sharedData.blocksWithDefines.push(this);var a=this.worldPosition,s=a.associatedVariableName;this.generateOnlyFragmentCode?(s=t._getFreeVariableName("globalWorldPos"),t._emitFunction("light_globalworldpos","".concat(t._declareLocalVar(s,dv.Vector3,!1,!0),";\n"),i),t.compilationString+="".concat(s," = ").concat(a.associatedVariableName,".xyz;\n"),t.compilationString+=t._emitCodeFromInclude("shadowsVertex",i,{repeatKey:"maxSimultaneousLights",substitutionVars:"worldPos,".concat(a.associatedVariableName)})):s=o+"v_"+s+".xyz",t._emitFunctionFromInclude("helperFunctions",i);var l={search:/vPositionW/g,replace:s};if(n&&(l={search:/fragmentInputs\.vPositionW/g,replace:s}),t._emitFunctionFromInclude("lightsFragmentFunctions",i,{replaceStrings:[l]}),t._emitFunctionFromInclude("shadowsFragmentFunctions",i,{replaceStrings:[l]}),this._injectUBODeclaration(t),0===this._lightId&&(t._registerTempVariable("viewDirectionW")&&(t.compilationString+="".concat(t._declareLocalVar("viewDirectionW",dv.Vector3)," = normalize(").concat(this.cameraPosition.associatedVariableName," - ").concat(s,");\n")),this.generateOnlyFragmentCode&&this.view.isConnected&&(t.compilationString+="".concat(t._declareLocalVar("vViewDepth",dv.Float)," = (").concat(this.view.associatedVariableName," * ").concat(a.associatedVariableName,").z;\n")),t.compilationString+=n?"var info: lightingInfo;\n":"lightingInfo info;\n",t.compilationString+="".concat(t._declareLocalVar("shadow",dv.Float)," = 1.;\n"),t.compilationString+="".concat(t._declareLocalVar("aggShadow",dv.Float)," = 0.;\n"),t.compilationString+="".concat(t._declareLocalVar("numLights",dv.Float)," = 0.;\n"),t.compilationString+="".concat(t._declareLocalVar("glossiness",dv.Float)," = ").concat(this.glossiness.isConnected?this.glossiness.associatedVariableName:"1.0"," * ").concat(this.glossPower.isConnected?this.glossPower.associatedVariableName:"1024.0",";\n"),t.compilationString+="".concat(t._declareLocalVar("diffuseBase",dv.Vector3)," = vec3").concat(r,"(0., 0., 0.);\n"),t.compilationString+="".concat(t._declareLocalVar("specularBase",dv.Vector3)," = vec3").concat(r,"(0., 0., 0.);\n"),t.compilationString+="".concat(t._declareLocalVar("normalW",dv.Vector3)," = ").concat(this.worldNormal.associatedVariableName,".xyz;\n")),this.light){var c=[{search:/vPositionW/g,replace:s+".xyz"}];n&&(c=[{search:/fragmentInputs\.vPositionW/g,replace:s+".xyz"},{search:/uniforms\.vReflectivityColor/g,replace:"vReflectivityColor"}]),t.compilationString+=t._emitCodeFromInclude("lightFragment",i,{replaceStrings:(0,f.fX)([{search:/{X}/g,replace:this._lightId.toString()}],c,!0)})}else{var u="vPositionW,".concat(s,".xyz");n&&(u="fragmentInputs.vPositionW,".concat(s,".xyz"),this.generateOnlyFragmentCode&&(u+=",fragmentInputs.vViewDepth,vViewDepth")),t.compilationString+=t._emitCodeFromInclude("lightFragment",i,{repeatKey:"maxSimultaneousLights",substitutionVars:u})}0===this._lightId&&(t.compilationString+="aggShadow = aggShadow / numLights;\n");var h=this.diffuseOutput,d=this.specularOutput;return t.compilationString+=t._declareOutput(h)+" = diffuseBase".concat(this.diffuseColor.isConnected?" * "+this.diffuseColor.associatedVariableName:"",";\n"),d.hasEndpoints&&(t.compilationString+=t._declareOutput(d)+" = specularBase".concat(this.specularColor.isConnected?" * "+this.specularColor.associatedVariableName:"",";\n")),this.shadow.hasEndpoints&&(t.compilationString+=t._declareOutput(this.shadow)+" = aggShadow;\n"),this}this._injectVertexCode(t)},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.generateOnlyFragmentCode=this.generateOnlyFragmentCode,this.light&&(t.lightId=this.light.id),t},t.prototype._deserialize=function(t,n,r){e.prototype._deserialize.call(this,t,n,r),t.lightId&&(this.light=n.getLightById(t.lightId)),this.generateOnlyFragmentCode=t.generateOnlyFragmentCode,this._setTarget()},(0,f.Cg)([Jp("Generate only fragment code",0,"ADVANCED",{notifiers:{rebuild:!0,update:!0,onValidation:t._OnGenerateOnlyFragmentCodeChanged}})],t.prototype,"generateOnlyFragmentCode",void 0),t}(Cv);(0,h.Y5)("BABYLON.LightBlock",AE);var IE=function(e){function t(t,n){void 0===n&&(n=!1);var r=e.call(this,t,n?pv.Fragment:pv.VertexAndFragment)||this;return r._convertToGammaSpace=!1,r._convertToLinearSpace=!1,r.disableLevelMultiplication=!1,r._fragmentOnly=n,r.registerInput("uv",dv.AutoDetect,!1,pv.VertexAndFragment),r.registerInput("source",dv.Object,!0,pv.VertexAndFragment,new _T("source",r,0,IT,"ImageSourceBlock")),r.registerInput("layer",dv.Float,!0),r.registerInput("lod",dv.Float,!0),r.registerOutput("rgba",dv.Color4,pv.Neutral),r.registerOutput("rgb",dv.Color3,pv.Neutral),r.registerOutput("r",dv.Float,pv.Neutral),r.registerOutput("g",dv.Float,pv.Neutral),r.registerOutput("b",dv.Float,pv.Neutral),r.registerOutput("a",dv.Float,pv.Neutral),r.registerOutput("level",dv.Float,pv.Neutral),r._inputs[0].addExcludedConnectionPointFromAllowedTypes(dv.Vector2|dv.Vector3|dv.Vector4),r._inputs[0]._prioritizeVertex=!n,r}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"texture",{get:function(){var e;return this.source.isConnected?(null===(e=this.source.connectedPoint)||void 0===e?void 0:e.ownerBlock).texture:this._texture},set:function(e){var t,n=this;if(this._texture!==e){var r=null!==(t=null==e?void 0:e.getScene())&&void 0!==t?t:M.q.LastCreatedScene;!e&&r&&r.markAllMaterialsAsDirty(b.Y.MATERIAL_TextureDirtyFlag,(function(e){return e.hasTexture(n._texture)})),this._texture=e,e&&r&&r.markAllMaterialsAsDirty(b.Y.MATERIAL_TextureDirtyFlag,(function(t){return t.hasTexture(e)}))}},enumerable:!1,configurable:!0}),t._IsPrePassTextureBlock=function(e){return"PrePassTextureBlock"===(null==e?void 0:e.getClassName())},Object.defineProperty(t.prototype,"_isSourcePrePass",{get:function(){return t._IsPrePassTextureBlock(this._imageSource)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"samplerName",{get:function(){if(this._imageSource){if(!t._IsPrePassTextureBlock(this._imageSource))return this._imageSource.samplerName;if(this.source.connectedPoint)return this._imageSource.getSamplerName(this.source.connectedPoint)}return this._samplerName},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasImageSource",{get:function(){return this.source.isConnected},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"convertToGammaSpace",{get:function(){return this._convertToGammaSpace},set:function(e){var t,n=this;if(e!==this._convertToGammaSpace&&(this._convertToGammaSpace=e,this.texture)){var r=null!==(t=this.texture.getScene())&&void 0!==t?t:M.q.LastCreatedScene;null==r||r.markAllMaterialsAsDirty(b.Y.MATERIAL_TextureDirtyFlag,(function(e){return e.hasTexture(n.texture)}))}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"convertToLinearSpace",{get:function(){return this._convertToLinearSpace},set:function(e){var t,n=this;if(e!==this._convertToLinearSpace&&(this._convertToLinearSpace=e,this.texture)){var r=null!==(t=this.texture.getScene())&&void 0!==t?t:M.q.LastCreatedScene;null==r||r.markAllMaterialsAsDirty(b.Y.MATERIAL_TextureDirtyFlag,(function(e){return e.hasTexture(n.texture)}))}},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"TextureBlock"},Object.defineProperty(t.prototype,"uv",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"source",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"layer",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lod",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rgba",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rgb",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"r",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"g",{get:function(){return this._outputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"b",{get:function(){return this._outputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"a",{get:function(){return this._outputs[5]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"level",{get:function(){return this._outputs[6]},enumerable:!1,configurable:!0}),t.prototype._isTiedToFragment=function(e){if(e.target===pv.Fragment)return!0;if(e.target===pv.Vertex)return!1;if(e.target===pv.Neutral||e.target===pv.VertexAndFragment){var t=e.ownerBlock;if(t.target===pv.Fragment)return!0;for(var n=0,r=t.inputs;nvec3f/g,replace:"fn DUMMYFUNC()"}]}),this._reflectionColorName=e._getFreeVariableName("reflectionColor"),this._reflectionVectorName=e._getFreeVariableName("reflectionUVW"),this._reflectionCoordsName=e._getFreeVariableName("reflectionCoords"),this._reflectionPositionName=e._getFreeVariableName("vReflectionPosition"),e._emitUniformFromString(this._reflectionPositionName,dv.Vector3),this._reflectionSizeName=e._getFreeVariableName("vReflectionPosition"),e._emitUniformFromString(this._reflectionSizeName,dv.Vector3)},t.prototype.handleFragmentSideCodeReflectionCoords=function(e,t,n,r,i){void 0===r&&(r=!1),void 0===i&&(i=!1);var o=1===e.shaderLanguage,a=(o?"uniforms.":"")+this._reflectionMatrixName,s="normalize(".concat(this._directionWname,")"),l="".concat(this._positionUVWName),c="".concat(this.cameraPosition.associatedVariableName),u="".concat(this.view.associatedVariableName),h=o?"fragmentInputs.":"";n||(n=this.generateOnlyFragmentCode?this._worldPositionNameInFragmentOnlyMode:"".concat(h,"v_").concat(this.worldPosition.associatedVariableName)),t+=".xyz";var d="\n #ifdef ".concat(this._defineMirroredEquirectangularFixedName,"\n ").concat(e._declareLocalVar(this._reflectionVectorName,dv.Vector3)," = computeMirroredFixedEquirectangularCoords(").concat(n,", ").concat(t,", ").concat(s,");\n #endif\n\n #ifdef ").concat(this._defineEquirectangularFixedName,"\n ").concat(e._declareLocalVar(this._reflectionVectorName,dv.Vector3)," = computeFixedEquirectangularCoords(").concat(n,", ").concat(t,", ").concat(s,");\n #endif\n\n #ifdef ").concat(this._defineEquirectangularName,"\n ").concat(e._declareLocalVar(this._reflectionVectorName,dv.Vector3)," = computeEquirectangularCoords(").concat(n,", ").concat(t,", ").concat(c,".xyz, ").concat(a,");\n #endif\n\n #ifdef ").concat(this._defineSphericalName,"\n ").concat(e._declareLocalVar(this._reflectionVectorName,dv.Vector3)," = computeSphericalCoords(").concat(n,", ").concat(t,", ").concat(u,", ").concat(a,");\n #endif\n\n #ifdef ").concat(this._definePlanarName,"\n ").concat(e._declareLocalVar(this._reflectionVectorName,dv.Vector3)," = computePlanarCoords(").concat(n,", ").concat(t,", ").concat(c,".xyz, ").concat(a,");\n #endif\n\n #ifdef ").concat(this._defineCubicName,"\n #ifdef ").concat(this._defineLocalCubicName,"\n ").concat(e._declareLocalVar(this._reflectionVectorName,dv.Vector3)," = computeCubicLocalCoords(").concat(n,", ").concat(t,", ").concat(c,".xyz, ").concat(a,", ").concat(this._reflectionSizeName,", ").concat(this._reflectionPositionName,");\n #else\n ").concat(e._declareLocalVar(this._reflectionVectorName,dv.Vector3)," = computeCubicCoords(").concat(n,", ").concat(t,", ").concat(c,".xyz, ").concat(a,");\n #endif\n #endif\n\n #ifdef ").concat(this._defineProjectionName,"\n ").concat(e._declareLocalVar(this._reflectionVectorName,dv.Vector3)," = computeProjectionCoords(").concat(n,", ").concat(u,", ").concat(a,");\n #endif\n\n #ifdef ").concat(this._defineSkyboxName,"\n ").concat(e._declareLocalVar(this._reflectionVectorName,dv.Vector3)," = computeSkyBoxCoords(").concat(l,", ").concat(a,");\n #endif\n\n #ifdef ").concat(this._defineExplicitName,"\n ").concat(e._declareLocalVar(this._reflectionVectorName,dv.Vector3)," = vec3(0, 0, 0);\n #endif\n");return i||(d+="#ifdef ".concat(this._defineOppositeZ,"\n ").concat(this._reflectionVectorName,".z *= -1.0;\n #endif\n")),r||(d+="\n #ifdef ".concat(this._define3DName,"\n ").concat(e._declareLocalVar(this._reflectionCoordsName,dv.Vector3)," = ").concat(this._reflectionVectorName,";\n #else\n ").concat(e._declareLocalVar(this._reflectionCoordsName,dv.Vector2)," = ").concat(this._reflectionVectorName,".xy;\n #ifdef ").concat(this._defineProjectionName,"\n ").concat(this._reflectionCoordsName," /= ").concat(this._reflectionVectorName,".z;\n #endif\n ").concat(this._reflectionCoordsName,".y = 1.0 - ").concat(this._reflectionCoordsName,".y;\n #endif\n")),d},t.prototype.handleFragmentSideCodeReflectionColor=function(e,t,n){void 0===n&&(n=".rgb");var r=dv.Vector4;3===n.length&&(r=dv.Vector3);var i="".concat(e._declareLocalVar(this._reflectionColorName,r),";\n #ifdef ").concat(this._define3DName,"\n");return i+=t?"".concat(this._reflectionColorName," = ").concat(e._generateTextureSampleCubeLOD(this._reflectionVectorName,this._cubeSamplerName,t)).concat(n,";\n"):"".concat(this._reflectionColorName," = ").concat(e._generateTextureSampleCube(this._reflectionVectorName,this._cubeSamplerName)).concat(n,";\n"),i+="\n #else\n",(i+=t?"".concat(this._reflectionColorName," =").concat(e._generateTextureSampleLOD(this._reflectionCoordsName,this._2DSamplerName,t)).concat(n,";\n"):"".concat(this._reflectionColorName," = ").concat(e._generateTextureSample(this._reflectionCoordsName,this._2DSamplerName)).concat(n,";\n"))+"#endif\n"},t.prototype.writeOutputs=function(e,t){var n="";if(e.target===pv.Fragment)for(var r=0,i=this._outputs;r "+this.name,this._outputs=this._endpoints.map((function(e){return e.output}))},t.prototype.detachFromEndpoint=function(e){var t=this._endpoints.indexOf(e);-1!==t&&(this._endpoints.splice(t,1),e._outputs[0]._typeConnectionSource=null,e._entryPoint=null,this._outputs=this._endpoints.map((function(e){return e.output})))},t.prototype.dispose=function(){e.prototype.dispose.call(this);for(var t=0,n=this._endpoints;t0&&(t.compilationString+=", "),this._inputSamplers&&-1!==this._inputSamplers.indexOf(c.name)?t.compilationString+=null!==(i=null===(r=null===(n=c.connectedPoint)||void 0===n?void 0:n.ownerBlock)||void 0===r?void 0:r.samplerName)&&void 0!==i?i:c.associatedVariableName:t.compilationString+=c.associatedVariableName,g=!0;for(v=0;v0||g)&&(t.compilationString+=", "),t.compilationString+=f.associatedVariableName;return t.compilationString+=");\n",this},t.prototype._dumpPropertiesCode=function(){return e.prototype._dumpPropertiesCode.call(this)+"".concat(this._codeVariableName,".options = ").concat(JSON.stringify(this._options),";\n")},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.options=this._options,t},t.prototype._deserialize=function(t,n,r){this._deserializeOptions(t.options),e.prototype._deserialize.call(this,t,n,r)},t.prototype._deserializeOptions=function(e){if(this._options=e,this._code=e.code.join("\n")+"\n",this.name=this.name||e.name,this.target=pv[e.target],e.inParameters)for(var t=function(t){var r=e.inParameters[t],i=dv[r.type];"sampler2D"===r.type||"samplerCube"===r.type||"sampler2DArray"===r.type?(n._inputSamplers=n._inputSamplers||[],n._inputSamplers.push(r.name),n.registerInput(r.name,dv.Object,!0,pv.VertexAndFragment,new _T(r.name,n,0,IT,"ImageSourceBlock"))):n.registerInput(r.name,i),Object.defineProperty(n,r.name,{get:function(){return this._inputs[t]},enumerable:!0,configurable:!0})},n=this,r=0;r vec3f {\n ".concat(this.handleFragmentSideCodeReflectionCoords(e,"worldNormal","worldPos",!0,!0),"\n return ").concat(this._reflectionVectorName,";\n }\n"):"\n vec3 computeReflectionCoordsPBR(vec4 worldPos, vec3 worldNormal) {\n ".concat(this.handleFragmentSideCodeReflectionCoords(e,"worldNormal","worldPos",!0,!0),"\n return ").concat(this._reflectionVectorName,";\n }\n");return e._emitFunction("computeReflectionCoordsPBR",i,"//".concat(this.name)),this._vReflectionMicrosurfaceInfosName=e._getFreeVariableName("vReflectionMicrosurfaceInfos"),e._emitUniformFromString(this._vReflectionMicrosurfaceInfosName,dv.Vector3),this._vReflectionInfosName=e._getFreeVariableName("vReflectionInfos"),this._vReflectionFilteringInfoName=e._getFreeVariableName("vReflectionFilteringInfo"),e._emitUniformFromString(this._vReflectionFilteringInfoName,dv.Vector2),this._iblIntensityName=e._getFreeVariableName("iblIntensity"),e._emitUniformFromString(this._iblIntensityName,dv.Float),n+"#ifdef REFLECTION\n ".concat(e._declareLocalVar(this._vReflectionInfosName,dv.Vector2)," = vec2").concat(e.fSuffix,"(").concat((r?"uniforms.":"")+this._iblIntensityName,", 0.);\n\n ").concat(r?"var reflectionOut: reflectionOutParams":"reflectionOutParams reflectionOut",";\n\n reflectionOut = reflectionBlock(\n ").concat(this.generateOnlyFragmentCode?this._worldPositionNameInFragmentOnlyMode:(r?"input.":"")+"v_"+this.worldPosition.associatedVariableName,".xyz\n , ").concat(t,"\n , alphaG\n , ").concat((r?"uniforms.":"")+this._vReflectionMicrosurfaceInfosName,"\n , ").concat(this._vReflectionInfosName,"\n , ").concat(this.reflectionColor,"\n #ifdef ANISOTROPIC\n ,anisotropicOut\n #endif\n #if defined(").concat(this._defineLODReflectionAlpha,") && !defined(").concat(this._defineSkyboxName,")\n ,NdotVUnclamped\n #endif\n #ifdef ").concat(this._defineLinearSpecularReflection,"\n , roughness\n #endif\n #ifdef ").concat(this._define3DName,"\n , ").concat(this._cubeSamplerName,"\n ").concat(r?", ".concat(this._cubeSamplerName,"Sampler"):"","\n #else\n , ").concat(this._2DSamplerName,"\n ").concat(r?", ".concat(this._2DSamplerName,"Sampler"):"","\n #endif\n #if defined(NORMAL) && defined(USESPHERICALINVERTEX)\n , ").concat(r?"input.":"").concat(this._vEnvironmentIrradianceName,"\n #endif\n #if (defined(USESPHERICALFROMREFLECTIONMAP) && (!defined(NORMAL) || !defined(USESPHERICALINVERTEX))) || (defined(USEIRRADIANCEMAP) && defined(REFLECTIONMAP_3D))\n , ").concat(this._reflectionMatrixName,"\n #endif\n #ifdef USEIRRADIANCEMAP\n , irradianceSampler // ** not handled **\n ").concat(r?", irradianceSamplerSampler":"","\n #ifdef USE_IRRADIANCE_DOMINANT_DIRECTION\n , vReflectionDominantDirection\n #endif\n #endif\n #ifndef LODBASEDMICROSFURACE\n #ifdef ").concat(this._define3DName,"\n , ").concat(this._cubeSamplerName,"\n ").concat(r?", ".concat(this._cubeSamplerName,"Sampler"):"","\n , ").concat(this._cubeSamplerName,"\n ").concat(r?", ".concat(this._cubeSamplerName,"Sampler"):"","\n #else\n , ").concat(this._2DSamplerName,"\n ").concat(r?", ".concat(this._2DSamplerName,"Sampler"):"","\n , ").concat(this._2DSamplerName," \n ").concat(r?", ".concat(this._2DSamplerName,"Sampler"):"","\n #endif\n #endif\n #ifdef REALTIME_FILTERING\n , ").concat(this._vReflectionFilteringInfoName,"\n #ifdef IBL_CDF_FILTERING\n , icdfSampler // ** not handled **\n ").concat(r?", icdfSamplerSampler":"","\n #endif\n #endif\n , viewDirectionW\n , diffuseRoughness\n , surfaceAlbedo\n );\n #endif\n")},t.prototype._buildBlock=function(e){return this._scene=e.sharedData.scene,e.target!==pv.Fragment&&(this._defineLODReflectionAlpha=e._getFreeDefineName("LODINREFLECTIONALPHA"),this._defineLinearSpecularReflection=e._getFreeDefineName("LINEARSPECULARREFLECTION")),this},t.prototype._dumpPropertiesCode=function(){var t=e.prototype._dumpPropertiesCode.call(this);return this.texture&&(t+="".concat(this._codeVariableName,".texture.gammaSpace = ").concat(this.texture.gammaSpace,";\n")),(t+="".concat(this._codeVariableName,".useSphericalHarmonics = ").concat(this.useSphericalHarmonics,";\n"))+"".concat(this._codeVariableName,".forceIrradianceInFragment = ").concat(this.forceIrradianceInFragment,";\n")},t.prototype.serialize=function(){var t,n,r=e.prototype.serialize.call(this);return r.useSphericalHarmonics=this.useSphericalHarmonics,r.forceIrradianceInFragment=this.forceIrradianceInFragment,r.gammaSpace=null===(n=null===(t=this.texture)||void 0===t?void 0:t.gammaSpace)||void 0===n||n,r},t.prototype._deserialize=function(t,n,r){e.prototype._deserialize.call(this,t,n,r),this.useSphericalHarmonics=t.useSphericalHarmonics,this.forceIrradianceInFragment=t.forceIrradianceInFragment,this.texture&&(this.texture.gammaSpace=t.gammaSpace)},(0,f.Cg)([Jp("Spherical Harmonics",0,"ADVANCED",{embedded:!0,notifiers:{update:!0}})],t.prototype,"useSphericalHarmonics",void 0),(0,f.Cg)([Jp("Force irradiance in fragment",0,"ADVANCED",{embedded:!0,notifiers:{update:!0}})],t.prototype,"forceIrradianceInFragment",void 0),t}(OE);(0,h.Y5)("BABYLON.ReflectionBlock",Qx);var Jx=function(e){function t(n){var r=e.call(this,n,pv.Fragment)||this;return r._tangentCorrectionFactorName="",r.remapF0OnInterfaceChange=!0,r._isUnique=!0,r.registerInput("intensity",dv.Float,!1,pv.Fragment),r.registerInput("roughness",dv.Float,!0,pv.Fragment),r.registerInput("indexOfRefraction",dv.Float,!0,pv.Fragment),r.registerInput("normalMapColor",dv.Color3,!0,pv.Fragment),r.registerInput("uv",dv.Vector2,!0,pv.Fragment),r.registerInput("tintColor",dv.Color3,!0,pv.Fragment),r.registerInput("tintAtDistance",dv.Float,!0,pv.Fragment),r.registerInput("tintThickness",dv.Float,!0,pv.Fragment),r.registerInput("worldTangent",dv.Vector4,!0),r.registerInput("worldNormal",dv.AutoDetect,!0),r.worldNormal.addExcludedConnectionPointFromAllowedTypes(dv.Color4|dv.Vector4|dv.Vector3),r.registerInput("TBN",dv.Object,!0,pv.VertexAndFragment,new _T("TBN",r,0,QT,"TBNBlock")),r.registerOutput("clearcoat",dv.Object,pv.Fragment,new _T("clearcoat",r,1,t,"ClearCoatBlock")),r}return(0,f.C6)(t,e),t.prototype.initialize=function(e){e._excludeVariableName("clearcoatOut"),e._excludeVariableName("vClearCoatParams"),e._excludeVariableName("vClearCoatTintParams"),e._excludeVariableName("vClearCoatRefractionParams"),e._excludeVariableName("vClearCoatTangentSpaceParams"),e._excludeVariableName("vGeometricNormaClearCoatW")},t.prototype.getClassName=function(){return"ClearCoatBlock"},Object.defineProperty(t.prototype,"intensity",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"roughness",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"indexOfRefraction",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"normalMapColor",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"uv",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tintColor",{get:function(){return this._inputs[5]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tintAtDistance",{get:function(){return this._inputs[6]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tintThickness",{get:function(){return this._inputs[7]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"worldTangent",{get:function(){return this._inputs[8]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"worldNormal",{get:function(){return this._inputs[9]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"TBN",{get:function(){return this._inputs[10]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearcoat",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype.autoConfigure=function(){if(!this.intensity.isConnected){var e=new Lv("ClearCoat intensity",pv.Fragment,dv.Float);e.value=1,e.output.connectTo(this.intensity)}},t.prototype.prepareDefines=function(e){e.setValue("CLEARCOAT",!0),e.setValue("CLEARCOAT_TEXTURE",!1,!0),e.setValue("CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE",!0,!0),e.setValue("CLEARCOAT_TINT",this.tintColor.isConnected||this.tintThickness.isConnected||this.tintAtDistance.isConnected,!0),e.setValue("CLEARCOAT_BUMP",this.normalMapColor.isConnected,!0),e.setValue("CLEARCOAT_DEFAULTIOR",!this.indexOfRefraction.isConnected||this.indexOfRefraction.connectInputBlock.value===ag._DefaultIndexOfRefraction,!0),e.setValue("CLEARCOAT_REMAP_F0",this.remapF0OnInterfaceChange,!0)},t.prototype.bind=function(t,n,r){var i,o;e.prototype.bind.call(this,t,n,r);var a=null!==(o=null===(i=this.indexOfRefraction.connectInputBlock)||void 0===i?void 0:i.value)&&void 0!==o?o:ag._DefaultIndexOfRefraction,s=1-a,l=1+a,c=Math.pow(-s/l,2),u=1/a;t.setFloat4("vClearCoatRefractionParams",c,u,s,l);var h=this.clearcoat.hasEndpoints?this.clearcoat.endpoints[0].ownerBlock:null,d=(null==h?void 0:h.perturbedNormal.isConnected)?h.perturbedNormal.connectedPoint.ownerBlock:null;this._scene._mirroredCameraPosition?t.setFloat2("vClearCoatTangentSpaceParams",(null==d?void 0:d.invertX)?1:-1,(null==d?void 0:d.invertY)?1:-1):t.setFloat2("vClearCoatTangentSpaceParams",(null==d?void 0:d.invertX)?-1:1,(null==d?void 0:d.invertY)?-1:1),r&&t.setFloat(this._tangentCorrectionFactorName,r.getWorldMatrix().determinant()<0?-1:1)},t.prototype._generateTBNSpace=function(e,t,n){var r="",i="//".concat(this.name),o=this.worldTangent,a=1===e.shaderLanguage;a||e._emitExtension("derivatives","#extension GL_OES_standard_derivatives : enable");var s={search:/defined\(TANGENT\)/g,replace:o.isConnected?"defined(TANGENT)":"defined(IGNORE)"},l=this.TBN;return l.isConnected?e.compilationString+="\n #ifdef TBNBLOCK\n ".concat(a?"var TBN":"mat3 TBN"," = ").concat(l.associatedVariableName,";\n #endif\n "):o.isConnected&&(r+="".concat(e._declareLocalVar("tbnNormal",dv.Vector3)," = normalize(").concat(n,".xyz);\n"),r+="".concat(e._declareLocalVar("tbnTangent",dv.Vector3)," = normalize(").concat(o.associatedVariableName,".xyz);\n"),r+="".concat(e._declareLocalVar("tbnBitangent",dv.Vector3)," = cross(tbnNormal, tbnTangent) * ").concat(this._tangentCorrectionFactorName,";\n"),r+="".concat(a?"var vTBN":"mat3 vTBN"," = ").concat(a?"mat3x3f":"mat3","(tbnTangent, tbnBitangent, tbnNormal);\n")),e._emitFunctionFromInclude("bumpFragmentMainFunctions",i,{replaceStrings:[s]}),r},t._GetInitializationCode=function(e,t){var n="",r=(null==t?void 0:t.intensity.isConnected)?t.intensity.associatedVariableName:"1.",i=(null==t?void 0:t.roughness.isConnected)?t.roughness.associatedVariableName:"0.",o=(null==t?void 0:t.tintColor.isConnected)?t.tintColor.associatedVariableName:"vec3".concat(e.fSuffix,"(1.)"),a=(null==t?void 0:t.tintThickness.isConnected)?t.tintThickness.associatedVariableName:"1.";return n+"\n #ifdef CLEARCOAT\n ".concat(e._declareLocalVar("vClearCoatParams",dv.Vector2)," = vec2").concat(e.fSuffix,"(").concat(r,", ").concat(i,");\n ").concat(e._declareLocalVar("vClearCoatTintParams",dv.Vector4)," = vec4").concat(e.fSuffix,"(").concat(o,", ").concat(a,");\n #endif\n")},t.GetCode=function(e,t,n,r,i,o,a){var s="",l=(null==t?void 0:t.normalMapColor.isConnected)?t.normalMapColor.associatedVariableName:"vec3".concat(e.fSuffix,"(0.)"),c=(null==t?void 0:t.uv.isConnected)?t.uv.associatedVariableName:"vec2".concat(e.fSuffix,"(0.)"),u=(null==t?void 0:t.tintAtDistance.isConnected)?t.tintAtDistance.associatedVariableName:"1.",h="vec4".concat(e.fSuffix,"(0.)");if(t){e._emitUniformFromString("vClearCoatRefractionParams",dv.Vector4),e._emitUniformFromString("vClearCoatTangentSpaceParams",dv.Vector2);var d=t.worldNormal;s+="".concat(e._declareLocalVar("vGeometricNormaClearCoatW",dv.Vector3)," = ").concat(d.isConnected?"normalize("+d.associatedVariableName+".xyz)":"geometricNormalW",";\n")}else s+="".concat(e._declareLocalVar("vGeometricNormaClearCoatW",dv.Vector3)," = geometricNormalW;\n");i&&t&&(s+=t._generateTBNSpace(e,r,a),o=t.worldTangent.isConnected);var p=1===e.shaderLanguage;return s+"".concat(p?"var clearcoatOut: clearcoatOutParams":"clearcoatOutParams clearcoatOut",";\n\n #ifdef CLEARCOAT\n clearcoatOut = clearcoatBlock(\n ").concat(r,".xyz\n , vGeometricNormaClearCoatW\n , viewDirectionW\n , vClearCoatParams\n , specularEnvironmentR0\n #ifdef CLEARCOAT_TEXTURE\n , vec2").concat(e.fSuffix,"(0.)\n #endif\n #ifdef CLEARCOAT_TINT\n , vClearCoatTintParams\n , ").concat(u,"\n , ").concat(p?"uniforms.":"","vClearCoatRefractionParams\n #ifdef CLEARCOAT_TINT_TEXTURE\n , ").concat(h,"\n #endif\n #endif\n #ifdef CLEARCOAT_BUMP\n , vec2").concat(e.fSuffix,"(0., 1.)\n , vec4").concat(e.fSuffix,"(").concat(l,", 0.)\n , ").concat(c,"\n #if defined(").concat(o?"TANGENT":"IGNORE",") && defined(NORMAL)\n , vTBN\n #else\n , ").concat(p?"uniforms.":"","vClearCoatTangentSpaceParams\n #endif\n #ifdef OBJECTSPACE_NORMALMAP\n , normalMatrix\n #endif\n #endif\n #if defined(FORCENORMALFORWARD) && defined(NORMAL)\n , faceNormal\n #endif\n #ifdef REFLECTION\n , ").concat(p?"uniforms.":"").concat(null==n?void 0:n._vReflectionMicrosurfaceInfosName,"\n , ").concat(null==n?void 0:n._vReflectionInfosName,"\n , ").concat(null==n?void 0:n.reflectionColor,"\n , ").concat(p?"uniforms.":"","vLightingIntensity\n #ifdef ").concat(null==n?void 0:n._define3DName,"\n , ").concat(null==n?void 0:n._cubeSamplerName," \n ").concat(p?", ".concat(null==n?void 0:n._cubeSamplerName,"Sampler"):"","\n #else\n , ").concat(null==n?void 0:n._2DSamplerName," \n ").concat(p?", ".concat(null==n?void 0:n._2DSamplerName,"Sampler"):"","\n #endif\n #ifndef LODBASEDMICROSFURACE\n #ifdef ").concat(null==n?void 0:n._define3DName,"\n , ").concat(null==n?void 0:n._cubeSamplerName," \n ").concat(p?", ".concat(null==n?void 0:n._cubeSamplerName,"Sampler"):"","\n , ").concat(null==n?void 0:n._cubeSamplerName,"\n ").concat(p?", ".concat(null==n?void 0:n._cubeSamplerName,"Sampler"):"","\n #else\n , ").concat(null==n?void 0:n._2DSamplerName,"\n ").concat(p?", ".concat(null==n?void 0:n._2DSamplerName,"Sampler"):"","\n , ").concat(null==n?void 0:n._2DSamplerName,"\n ").concat(p?", ".concat(null==n?void 0:n._2DSamplerName,"Sampler"):""," \n #endif\n #endif\n #endif\n #if defined(CLEARCOAT_BUMP) || defined(TWOSIDEDLIGHTING)\n , (").concat(e._generateTernary("1.","-1.",p?"fragmentInputs.frontFacing":"gl_FrontFacing"),")\n #endif\n );\n #else\n clearcoatOut.specularEnvironmentR0 = specularEnvironmentR0;\n #endif\n")},t.prototype._buildBlock=function(e){return this._scene=e.sharedData.scene,e.target===pv.Fragment&&(e.sharedData.bindableBlocks.push(this),e.sharedData.blocksWithDefines.push(this),this._tangentCorrectionFactorName=e._getFreeDefineName("tangentCorrectionFactor"),e._emitUniformFromString(this._tangentCorrectionFactorName,dv.Float)),this},t.prototype._dumpPropertiesCode=function(){return e.prototype._dumpPropertiesCode.call(this)+"".concat(this._codeVariableName,".remapF0OnInterfaceChange = ").concat(this.remapF0OnInterfaceChange,";\n")},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.remapF0OnInterfaceChange=this.remapF0OnInterfaceChange,t},t.prototype._deserialize=function(t,n,r){var i;e.prototype._deserialize.call(this,t,n,r),this.remapF0OnInterfaceChange=null===(i=t.remapF0OnInterfaceChange)||void 0===i||i},(0,f.Cg)([Jp("Remap F0 on interface change",0,"ADVANCED",{embedded:!0})],t.prototype,"remapF0OnInterfaceChange",void 0),t}(Cv);(0,h.Y5)("BABYLON.ClearCoatBlock",Jx);var $x=function(e){function t(n){var r=e.call(this,n,pv.Fragment)||this;return r._isUnique=!0,r.registerInput("intensity",dv.Float,!0,pv.Fragment),r.registerInput("indexOfRefraction",dv.Float,!0,pv.Fragment),r.registerInput("thickness",dv.Float,!0,pv.Fragment),r.registerOutput("iridescence",dv.Object,pv.Fragment,new _T("iridescence",r,1,t,"IridescenceBlock")),r}return(0,f.C6)(t,e),t.prototype.initialize=function(e){e._excludeVariableName("iridescenceOut"),e._excludeVariableName("vIridescenceParams")},t.prototype.getClassName=function(){return"IridescenceBlock"},Object.defineProperty(t.prototype,"intensity",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"indexOfRefraction",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"thickness",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"iridescence",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype.autoConfigure=function(){if(!this.intensity.isConnected){var e=new Lv("Iridescence intensity",pv.Fragment,dv.Float);e.value=1,e.output.connectTo(this.intensity);var t=new Lv("Iridescence ior",pv.Fragment,dv.Float);t.value=1.3,t.output.connectTo(this.indexOfRefraction);var n=new Lv("Iridescence thickness",pv.Fragment,dv.Float);n.value=400,n.output.connectTo(this.thickness)}},t.prototype.prepareDefines=function(e){e.setValue("IRIDESCENCE",!0,!0),e.setValue("IRIDESCENCE_TEXTURE",!1,!0),e.setValue("IRIDESCENCE_THICKNESS_TEXTURE",!1,!0)},t.GetCode=function(e,t){var n="",r=(null==e?void 0:e.intensity.isConnected)?e.intensity.associatedVariableName:"1.",i=(null==e?void 0:e.indexOfRefraction.isConnected)?e.indexOfRefraction.associatedVariableName:lg._DefaultIndexOfRefraction,o=(null==e?void 0:e.thickness.isConnected)?e.thickness.associatedVariableName:lg._DefaultMaximumThickness,a=1===t.shaderLanguage;return n+"".concat(a?"var iridescenceOut: iridescenceOutParams":"iridescenceOutParams iridescenceOut",";\n\n #ifdef IRIDESCENCE\n iridescenceOut = iridescenceBlock(\n vec4(").concat(r,", ").concat(i,", 1., ").concat(o,")\n , NdotV\n , specularEnvironmentR0\n #ifdef CLEARCOAT\n , NdotVUnclamped\n , vClearCoatParams\n #endif \n );\n\n ").concat(a?"let":"float"," iridescenceIntensity = iridescenceOut.iridescenceIntensity;\n specularEnvironmentR0 = iridescenceOut.specularEnvironmentR0;\n #endif\n")},t.prototype._buildBlock=function(e){return e.target===pv.Fragment&&(e.sharedData.bindableBlocks.push(this),e.sharedData.blocksWithDefines.push(this)),this},t.prototype.serialize=function(){return e.prototype.serialize.call(this)},t.prototype._deserialize=function(t,n,r){e.prototype._deserialize.call(this,t,n,r)},t}(Cv);(0,h.Y5)("BABYLON.IridescenceBlock",$x);var eP=function(e){function t(n){var r=e.call(this,n,pv.Fragment)||this;return r.linkRefractionWithTransparency=!1,r.invertRefractionY=!1,r.useThicknessAsDepth=!1,r._isUnique=!0,r.registerInput("intensity",dv.Float,!1,pv.Fragment),r.registerInput("tintAtDistance",dv.Float,!0,pv.Fragment),r.registerInput("volumeIndexOfRefraction",dv.Float,!0,pv.Fragment),r.registerOutput("refraction",dv.Object,pv.Fragment,new _T("refraction",r,1,t,"RefractionBlock")),r}return(0,f.C6)(t,e),t.prototype.initialize=function(e){e._excludeVariableName("vRefractionPosition"),e._excludeVariableName("vRefractionSize")},t.prototype.getClassName=function(){return"RefractionBlock"},Object.defineProperty(t.prototype,"intensity",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tintAtDistance",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"volumeIndexOfRefraction",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"view",{get:function(){return this.viewConnectionPoint},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"refraction",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasTexture",{get:function(){return!!this._getTexture()},enumerable:!1,configurable:!0}),t.prototype._getTexture=function(){return this.texture?this.texture:this._scene.environmentTexture},t.prototype.autoConfigure=function(e,t){if(void 0===t&&(t=function(){return!0}),!this.intensity.isConnected){var n=new Lv("Refraction intensity",pv.Fragment,dv.Float);n.value=1,n.output.connectTo(this.intensity)}if(this.view&&!this.view.isConnected){var r=e.getInputBlockByPredicate((function(e){return e.systemValue===Av.View&&t(e)}));r||(r=new Lv("view")).setAsSystemValue(Av.View),r.output.connectTo(this.view)}},t.prototype.prepareDefines=function(e){var t=this._getTexture(),n=t&&t.getTextureMatrix;e.setValue("SS_REFRACTION",n,!0),n&&(e.setValue(this._define3DName,t.isCube,!0),e.setValue(this._defineLODRefractionAlpha,t.lodLevelInAlpha,!0),e.setValue(this._defineLinearSpecularRefraction,t.linearSpecularLOD,!0),e.setValue(this._defineOppositeZ,this._scene.useRightHandedSystem&&t.isCube?!t.invertZ:t.invertZ,!0),e.setValue("SS_LINKREFRACTIONTOTRANSPARENCY",this.linkRefractionWithTransparency,!0),e.setValue("SS_GAMMAREFRACTION",t.gammaSpace,!0),e.setValue("SS_RGBDREFRACTION",t.isRGBD,!0),e.setValue("SS_USE_LOCAL_REFRACTIONMAP_CUBIC",!!t.boundingBoxSize,!0),e.setValue("SS_USE_THICKNESS_AS_DEPTH",this.useThicknessAsDepth,!0))},t.prototype.isReady=function(){var e=this._getTexture();return!(e&&!e.isReadyOrNotBlocking())},t.prototype.bind=function(t,n,r){var i,o,a,s;e.prototype.bind.call(this,t,n,r);var l=this._getTexture();if(l){l.isCube?t.setTexture(this._cubeSamplerName,l):t.setTexture(this._2DSamplerName,l),t.setMatrix(this._refractionMatrixName,l.getRefractionTextureMatrix());var c=1;l.isCube||l.depth&&(c=l.depth);var u=null!==(s=null!==(o=null===(i=this.volumeIndexOfRefraction.connectInputBlock)||void 0===i?void 0:i.value)&&void 0!==o?o:null===(a=this.indexOfRefractionConnectionPoint.connectInputBlock)||void 0===a?void 0:a.value)&&void 0!==s?s:1.5;t.setFloat4(this._vRefractionInfosName,l.level,1/u,c,this.invertRefractionY?-1:1),t.setFloat4(this._vRefractionMicrosurfaceInfosName,l.getSize().width,l.lodGenerationScale,l.lodGenerationOffset,1/u);var h=l.getSize().width;if(t.setFloat2(this._vRefractionFilteringInfoName,h,Math.log2(h)),l.boundingBoxSize){var d=l;t.setVector3("vRefractionPosition",d.boundingBoxPosition),t.setVector3("vRefractionSize",d.boundingBoxSize)}}},t.prototype.getCode=function(e){return e.sharedData.blockingBlocks.push(this),e.sharedData.textureBlocks.push(this),this._cubeSamplerName=e._getFreeVariableName(this.name+"CubeSampler"),e.samplers.push(this._cubeSamplerName),this._2DSamplerName=e._getFreeVariableName(this.name+"2DSampler"),e.samplers.push(this._2DSamplerName),this._define3DName=e._getFreeDefineName("SS_REFRACTIONMAP_3D"),this._getTexture()&&(e._samplerDeclaration+="#ifdef ".concat(this._define3DName,"\n"),e._emitCubeSampler(this._cubeSamplerName,void 0,!0),e._samplerDeclaration+="#else\n",e._emit2DSampler(this._2DSamplerName,void 0,!0),e._samplerDeclaration+="#endif\n"),e.sharedData.blocksWithDefines.push(this),e.sharedData.bindableBlocks.push(this),this._defineLODRefractionAlpha=e._getFreeDefineName("SS_LODINREFRACTIONALPHA"),this._defineLinearSpecularRefraction=e._getFreeDefineName("SS_LINEARSPECULARREFRACTION"),this._defineOppositeZ=e._getFreeDefineName("SS_REFRACTIONMAP_OPPOSITEZ"),this._refractionMatrixName=e._getFreeVariableName("refractionMatrix"),e._emitUniformFromString(this._refractionMatrixName,dv.Matrix),1!==e.shaderLanguage&&(e._emitFunction("sampleRefraction","\n #ifdef ".concat(this._define3DName,"\n #define sampleRefraction(s, c) textureCube(s, c)\n #else\n #define sampleRefraction(s, c) texture2D(s, c)\n #endif\n"),"//".concat(this.name)),e._emitFunction("sampleRefractionLod","\n #ifdef ".concat(this._define3DName,"\n #define sampleRefractionLod(s, c, l) textureCubeLodEXT(s, c, l)\n #else\n #define sampleRefractionLod(s, c, l) texture2DLodEXT(s, c, l)\n #endif\n"),"//".concat(this.name))),this._vRefractionMicrosurfaceInfosName=e._getFreeVariableName("vRefractionMicrosurfaceInfos"),e._emitUniformFromString(this._vRefractionMicrosurfaceInfosName,dv.Vector4),this._vRefractionInfosName=e._getFreeVariableName("vRefractionInfos"),e._emitUniformFromString(this._vRefractionInfosName,dv.Vector4),this._vRefractionFilteringInfoName=e._getFreeVariableName("vRefractionFilteringInfo"),e._emitUniformFromString(this._vRefractionFilteringInfoName,dv.Vector2),e._emitUniformFromString("vRefractionPosition",dv.Vector3),e._emitUniformFromString("vRefractionSize",dv.Vector3),""},t.prototype._buildBlock=function(e){return this._scene=e.sharedData.scene,this},t.prototype._dumpPropertiesCode=function(){var t=e.prototype._dumpPropertiesCode.call(this);return this.texture&&(t=this.texture.isCube?"".concat(this._codeVariableName,'.texture = new BABYLON.CubeTexture("').concat(this.texture.name,'");\n'):"".concat(this._codeVariableName,'.texture = new BABYLON.Texture("').concat(this.texture.name,'");\n'),t+="".concat(this._codeVariableName,".texture.coordinatesMode = ").concat(this.texture.coordinatesMode,";\n")),t+="".concat(this._codeVariableName,".linkRefractionWithTransparency = ").concat(this.linkRefractionWithTransparency,";\n"),(t+="".concat(this._codeVariableName,".invertRefractionY = ").concat(this.invertRefractionY,";\n"))+"".concat(this._codeVariableName,".useThicknessAsDepth = ").concat(this.useThicknessAsDepth,";\n")},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return this.texture&&!this.texture.isRenderTarget&&(t.texture=this.texture.serialize()),t.linkRefractionWithTransparency=this.linkRefractionWithTransparency,t.invertRefractionY=this.invertRefractionY,t.useThicknessAsDepth=this.useThicknessAsDepth,t},t.prototype._deserialize=function(t,n,r){e.prototype._deserialize.call(this,t,n,r),t.texture&&(r=0===t.texture.url.indexOf("data:")?"":r,t.texture.isCube?this.texture=Y_.Parse(t.texture,n,r):this.texture=_n.g.Parse(t.texture,n,r)),this.linkRefractionWithTransparency=t.linkRefractionWithTransparency,this.invertRefractionY=t.invertRefractionY,this.useThicknessAsDepth=!!t.useThicknessAsDepth},(0,f.Cg)([Jp("Link refraction to transparency",0,"ADVANCED",{embedded:!0,notifiers:{update:!0}})],t.prototype,"linkRefractionWithTransparency",void 0),(0,f.Cg)([Jp("Invert refraction Y",0,"ADVANCED",{embedded:!0,notifiers:{update:!0}})],t.prototype,"invertRefractionY",void 0),(0,f.Cg)([Jp("Use thickness as depth",0,"ADVANCED",{embedded:!0,notifiers:{update:!0}})],t.prototype,"useThicknessAsDepth",void 0),t}(Cv);(0,h.Y5)("BABYLON.RefractionBlock",eP);var tP=function(e){function t(n){var r=e.call(this,n,pv.Fragment)||this;return r.applyAlbedoAfterSubSurface=fg.DEFAULT_APPLY_ALBEDO_AFTERSUBSURFACE,r._isUnique=!0,r.registerInput("thickness",dv.Float,!1,pv.Fragment),r.registerInput("tintColor",dv.Color3,!0,pv.Fragment),r.registerInput("translucencyIntensity",dv.Float,!0,pv.Fragment),r.registerInput("translucencyDiffusionDist",dv.Color3,!0,pv.Fragment),r.registerInput("refraction",dv.Object,!0,pv.Fragment,new _T("refraction",r,0,eP,"RefractionBlock")),r.registerInput("dispersion",dv.Float,!0,pv.Fragment),r.registerOutput("subsurface",dv.Object,pv.Fragment,new _T("subsurface",r,1,t,"SubSurfaceBlock")),r}return(0,f.C6)(t,e),t.prototype.initialize=function(e){e._excludeVariableName("subSurfaceOut"),e._excludeVariableName("vThicknessParam"),e._excludeVariableName("vTintColor"),e._excludeVariableName("vTranslucencyColor"),e._excludeVariableName("vSubSurfaceIntensity"),e._excludeVariableName("dispersion")},t.prototype.getClassName=function(){return"SubSurfaceBlock"},Object.defineProperty(t.prototype,"thickness",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tintColor",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"translucencyIntensity",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"translucencyDiffusionDist",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"refraction",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dispersion",{get:function(){return this._inputs[5]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"subsurface",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype.autoConfigure=function(){if(!this.thickness.isConnected){var e=new Lv("SubSurface thickness",pv.Fragment,dv.Float);e.value=0,e.output.connectTo(this.thickness)}},t.prototype.prepareDefines=function(e){var t=this.translucencyDiffusionDist.isConnected||this.translucencyIntensity.isConnected;e.setValue("SUBSURFACE",t||this.refraction.isConnected,!0),e.setValue("SS_TRANSLUCENCY",t,!0),e.setValue("SS_THICKNESSANDMASK_TEXTURE",!1,!0),e.setValue("SS_REFRACTIONINTENSITY_TEXTURE",!1,!0),e.setValue("SS_TRANSLUCENCYINTENSITY_TEXTURE",!1,!0),e.setValue("SS_USE_GLTF_TEXTURES",!1,!0),e.setValue("SS_DISPERSION",this.dispersion.isConnected,!0),e.setValue("SS_APPLY_ALBEDO_AFTER_SUBSURFACE",this.applyAlbedoAfterSubSurface,!0)},t.GetCode=function(e,t,n,r){var i,o,a,s,l,c,u,h,d,p,f,m,_,g,v,y,b="",S=(null==t?void 0:t.thickness.isConnected)?t.thickness.associatedVariableName:"0.",T=(null==t?void 0:t.tintColor.isConnected)?t.tintColor.associatedVariableName:"vec3(1.)",E=(null==t?void 0:t.translucencyIntensity.isConnected)?null==t?void 0:t.translucencyIntensity.associatedVariableName:"1.",x=(null==t?void 0:t.translucencyDiffusionDist.isConnected)?null==t?void 0:t.translucencyDiffusionDist.associatedVariableName:"vec3(1.)",P=(null==t?void 0:t.refraction.isConnected)?null===(i=null==t?void 0:t.refraction.connectedPoint)||void 0===i?void 0:i.ownerBlock:null,C=(null==P?void 0:P.tintAtDistance.isConnected)?P.tintAtDistance.associatedVariableName:"1.",R=(null==P?void 0:P.intensity.isConnected)?P.intensity.associatedVariableName:"1.",A=(null==P?void 0:P.view.isConnected)?P.view.associatedVariableName:"",I=(null==t?void 0:t.dispersion.isConnected)?null==t?void 0:t.dispersion.associatedVariableName:"0.0",O=1===e.shaderLanguage;return b+=null!==(o=null==P?void 0:P.getCode(e))&&void 0!==o?o:"",b+="".concat(O?"var subSurfaceOut: subSurfaceOutParams":"subSurfaceOutParams subSurfaceOut",";\n\n #ifdef SUBSURFACE\n ").concat(e._declareLocalVar("vThicknessParam",dv.Vector2)," = vec2").concat(e.fSuffix,"(0., ").concat(S,");\n ").concat(e._declareLocalVar("vTintColor",dv.Vector4)," = vec4").concat(e.fSuffix,"(").concat(T,", ").concat(C,");\n ").concat(e._declareLocalVar("vSubSurfaceIntensity",dv.Vector3)," = vec3(").concat(R,", ").concat(E,", 0.);\n ").concat(e._declareLocalVar("dispersion",dv.Float)," = ").concat(I,";\n subSurfaceOut = subSurfaceBlock(\n vSubSurfaceIntensity\n , vThicknessParam\n , vTintColor\n , normalW\n #ifdef LEGACY_SPECULAR_ENERGY_CONSERVATION\n "),(b+=O?", vec3f(max(colorSpecularEnvironmentReflectance.r, max(colorSpecularEnvironmentReflectance.g, colorSpecularEnvironmentReflectance.b)))/n":", vec3(max(colorSpecularEnvironmentReflectance.r, max(colorSpecularEnvironmentReflectance.g, colorSpecularEnvironmentReflectance.b)))/n")+"#else\n , baseSpecularEnvironmentReflectance\n #endif\n #ifdef SS_THICKNESSANDMASK_TEXTURE\n , vec4".concat(e.fSuffix,"(0.)\n #endif\n #ifdef REFLECTION\n #ifdef SS_TRANSLUCENCY\n , ").concat((O?"uniforms.":"")+(null==n?void 0:n._reflectionMatrixName),"\n #ifdef USESPHERICALFROMREFLECTIONMAP\n #if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)\n , reflectionOut.irradianceVector\n #endif\n #if defined(REALTIME_FILTERING)\n , ").concat(null==n?void 0:n._cubeSamplerName,"\n ").concat(O?", ".concat(null==n?void 0:n._cubeSamplerName,"Sampler"):"","\n , ").concat(null==n?void 0:n._vReflectionFilteringInfoName,"\n #endif\n #endif\n #ifdef USEIRRADIANCEMAP\n , irradianceSampler\n ").concat(O?", irradianceSamplerSampler":"","\n #endif\n #endif\n #endif\n #if defined(SS_REFRACTION) || defined(SS_TRANSLUCENCY)\n , surfaceAlbedo\n #endif\n #ifdef SS_REFRACTION\n , ").concat(r,".xyz\n , viewDirectionW\n , ").concat(A,"\n , ").concat((O?"uniforms.":"")+(null!==(a=null==P?void 0:P._vRefractionInfosName)&&void 0!==a?a:""),"\n , ").concat((O?"uniforms.":"")+(null!==(s=null==P?void 0:P._refractionMatrixName)&&void 0!==s?s:""),"\n , ").concat((O?"uniforms.":"")+(null!==(l=null==P?void 0:P._vRefractionMicrosurfaceInfosName)&&void 0!==l?l:""),"\n , ").concat(O?"uniforms.":"","vLightingIntensity\n #ifdef SS_LINKREFRACTIONTOTRANSPARENCY\n , alpha\n #endif\n #ifdef ").concat(null!==(c=null==P?void 0:P._defineLODRefractionAlpha)&&void 0!==c?c:"IGNORE","\n , NdotVUnclamped\n #endif\n #ifdef ").concat(null!==(u=null==P?void 0:P._defineLinearSpecularRefraction)&&void 0!==u?u:"IGNORE","\n , roughness\n #endif\n , alphaG\n #ifdef ").concat(null!==(h=null==P?void 0:P._define3DName)&&void 0!==h?h:"IGNORE","\n , ").concat(null!==(d=null==P?void 0:P._cubeSamplerName)&&void 0!==d?d:"","\n ").concat(O?", ".concat(null==P?void 0:P._cubeSamplerName,"Sampler"):"","\n #else\n , ").concat(null!==(p=null==P?void 0:P._2DSamplerName)&&void 0!==p?p:"","\n ").concat(O?", ".concat(null==P?void 0:P._2DSamplerName,"Sampler"):"","\n #endif\n #ifndef LODBASEDMICROSFURACE\n #ifdef ").concat(null!==(f=null==P?void 0:P._define3DName)&&void 0!==f?f:"IGNORE","\n , ").concat(null!==(m=null==P?void 0:P._cubeSamplerName)&&void 0!==m?m:""," \n ").concat(O?", ".concat(null==P?void 0:P._cubeSamplerName,"Sampler"):"","\n , ").concat(null!==(_=null==P?void 0:P._cubeSamplerName)&&void 0!==_?_:""," \n ").concat(O?", ".concat(null==P?void 0:P._cubeSamplerName,"Sampler"):"","\n #else\n , ").concat(null!==(g=null==P?void 0:P._2DSamplerName)&&void 0!==g?g:"","\n ").concat(O?", ".concat(null==P?void 0:P._2DSamplerName,"Sampler"):"","\n , ").concat(null!==(v=null==P?void 0:P._2DSamplerName)&&void 0!==v?v:"","\n ").concat(O?", ".concat(null==P?void 0:P._2DSamplerName,"Sampler"):"","\n #endif\n #endif\n #ifdef ANISOTROPIC\n , anisotropicOut\n #endif\n #ifdef REALTIME_FILTERING\n , ").concat(null!==(y=null==P?void 0:P._vRefractionFilteringInfoName)&&void 0!==y?y:"","\n #endif\n #ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC\n , vRefractionPosition\n , vRefractionSize\n #endif\n #ifdef SS_DISPERSION\n , dispersion\n #endif\n #endif\n #ifdef SS_TRANSLUCENCY\n , ").concat(x,"\n , vTintColor\n #ifdef SS_TRANSLUCENCYCOLOR_TEXTURE\n , vec4").concat(e.fSuffix,"(0.)\n #endif\n #endif \n );\n\n #ifdef SS_REFRACTION\n surfaceAlbedo = subSurfaceOut.surfaceAlbedo;\n #ifdef SS_LINKREFRACTIONTOTRANSPARENCY\n alpha = subSurfaceOut.alpha;\n #endif\n #endif\n #else\n subSurfaceOut.specularEnvironmentReflectance = colorSpecularEnvironmentReflectance;\n #endif\n")},t.prototype._buildBlock=function(e){return e.target===pv.Fragment&&e.sharedData.blocksWithDefines.push(this),this},(0,f.Cg)([Jp("Apply albedo after sub-surface",0,"ADVANCED")],t.prototype,"applyAlbedoAfterSubSurface",void 0),t}(Cv);(0,h.Y5)("BABYLON.SubSurfaceBlock",tP);var nP={ambientClr:["finalAmbient",""],diffuseDir:["finalDiffuse",""],specularDir:["finalSpecularScaled","!defined(UNLIT) && defined(SPECULARTERM)"],clearcoatDir:["finalClearCoatScaled","!defined(UNLIT) && defined(CLEARCOAT)"],sheenDir:["finalSheenScaled","!defined(UNLIT) && defined(SHEEN)"],diffuseInd:["finalIrradiance","!defined(UNLIT) && defined(REFLECTION)"],specularInd:["finalRadianceScaled","!defined(UNLIT) && defined(REFLECTION)"],clearcoatInd:["clearcoatOut.finalClearCoatRadianceScaled","!defined(UNLIT) && defined(REFLECTION) && defined(CLEARCOAT)"],sheenInd:["sheenOut.finalSheenRadianceScaled","!defined(UNLIT) && defined(REFLECTION) && defined(SHEEN) && defined(ENVIRONMENTBRDF)"],refraction:["subSurfaceOut.finalRefraction","!defined(UNLIT) && defined(SS_REFRACTION)"],lighting:["finalColor.rgb",""],shadow:["aggShadow",""],alpha:["alpha",""]},rP=function(e){function t(t){var n=e.call(this,t,pv.VertexAndFragment)||this;return n._environmentBRDFTexture=null,n._metallicReflectanceColor=u.v9.White(),n._metallicF0Factor=1,n.directIntensity=1,n.environmentIntensity=1,n.specularIntensity=1,n.lightFalloff=0,n.useAlphaTest=!1,n.alphaTestCutoff=.5,n.useAlphaBlending=!1,n.useRadianceOverAlpha=!0,n.useSpecularOverAlpha=!0,n.enableSpecularAntiAliasing=!1,n.realTimeFiltering=!1,n.realTimeFilteringQuality=b.Y.TEXTURE_FILTERING_QUALITY_LOW,n.baseDiffuseModel=b.Y.MATERIAL_DIFFUSE_MODEL_E_OREN_NAYAR,n.useEnergyConservation=!0,n.useRadianceOcclusion=!0,n.useHorizonOcclusion=!0,n.unlit=!1,n.forceNormalForward=!1,n.generateOnlyFragmentCode=!1,n.debugMode=0,n.debugLimit=0,n.debugFactor=1,n._isUnique=!0,n.registerInput("worldPosition",dv.Vector4,!1,pv.Vertex),n.registerInput("worldNormal",dv.Vector4,!1,pv.Vertex),n.registerInput("view",dv.Matrix,!1),n.registerInput("cameraPosition",dv.Vector3,!1,pv.Fragment),n.registerInput("perturbedNormal",dv.Vector4,!0,pv.Fragment),n.registerInput("baseColor",dv.Color3,!0,pv.Fragment),n.registerInput("metallic",dv.Float,!1,pv.Fragment),n.registerInput("roughness",dv.Float,!1,pv.Fragment),n.registerInput("ambientOcc",dv.Float,!0,pv.Fragment),n.registerInput("opacity",dv.Float,!0,pv.Fragment),n.registerInput("indexOfRefraction",dv.Float,!0,pv.Fragment),n.registerInput("ambientColor",dv.Color3,!0,pv.Fragment),n.registerInput("reflection",dv.Object,!0,pv.Fragment,new _T("reflection",n,0,Qx,"ReflectionBlock")),n.registerInput("clearcoat",dv.Object,!0,pv.Fragment,new _T("clearcoat",n,0,Jx,"ClearCoatBlock")),n.registerInput("sheen",dv.Object,!0,pv.Fragment,new _T("sheen",n,0,Kx,"SheenBlock")),n.registerInput("subsurface",dv.Object,!0,pv.Fragment,new _T("subsurface",n,0,tP,"SubSurfaceBlock")),n.registerInput("anisotropy",dv.Object,!0,pv.Fragment,new _T("anisotropy",n,0,Zx,"AnisotropyBlock")),n.registerInput("iridescence",dv.Object,!0,pv.Fragment,new _T("iridescence",n,0,$x,"IridescenceBlock")),n.registerOutput("ambientClr",dv.Color3,pv.Fragment),n.registerOutput("diffuseDir",dv.Color3,pv.Fragment),n.registerOutput("specularDir",dv.Color3,pv.Fragment),n.registerOutput("clearcoatDir",dv.Color3,pv.Fragment),n.registerOutput("sheenDir",dv.Color3,pv.Fragment),n.registerOutput("diffuseInd",dv.Color3,pv.Fragment),n.registerOutput("specularInd",dv.Color3,pv.Fragment),n.registerOutput("clearcoatInd",dv.Color3,pv.Fragment),n.registerOutput("sheenInd",dv.Color3,pv.Fragment),n.registerOutput("refraction",dv.Color3,pv.Fragment),n.registerOutput("lighting",dv.Color3,pv.Fragment),n.registerOutput("shadow",dv.Float,pv.Fragment),n.registerOutput("alpha",dv.Float,pv.Fragment),n}return(0,f.C6)(t,e),t._OnGenerateOnlyFragmentCodeChanged=function(e,t){var n=e;return n.worldPosition.isConnected||n.worldNormal.isConnected?(n.generateOnlyFragmentCode=!n.generateOnlyFragmentCode,y.V.Error("The worldPosition and worldNormal inputs must not be connected to be able to switch!"),!1):(n._setTarget(),!0)},t.prototype._setTarget=function(){this._setInitialTarget(this.generateOnlyFragmentCode?pv.Fragment:pv.VertexAndFragment),this.getInputByName("worldPosition").target=this.generateOnlyFragmentCode?pv.Fragment:pv.Vertex,this.getInputByName("worldNormal").target=this.generateOnlyFragmentCode?pv.Fragment:pv.Vertex},t.prototype.initialize=function(e){e._excludeVariableName("vLightingIntensity"),e._excludeVariableName("geometricNormalW"),e._excludeVariableName("normalW"),e._excludeVariableName("faceNormal"),e._excludeVariableName("albedoOpacityOut"),e._excludeVariableName("surfaceAlbedo"),e._excludeVariableName("alpha"),e._excludeVariableName("aoOut"),e._excludeVariableName("baseColor"),e._excludeVariableName("reflectivityOut"),e._excludeVariableName("microSurface"),e._excludeVariableName("roughness"),e._excludeVariableName("vReflectivityColor"),e._excludeVariableName("NdotVUnclamped"),e._excludeVariableName("NdotV"),e._excludeVariableName("alphaG"),e._excludeVariableName("AARoughnessFactors"),e._excludeVariableName("environmentBrdf"),e._excludeVariableName("ambientMonochrome"),e._excludeVariableName("seo"),e._excludeVariableName("eho"),e._excludeVariableName("environmentRadiance"),e._excludeVariableName("irradianceVector"),e._excludeVariableName("environmentIrradiance"),e._excludeVariableName("diffuseBase"),e._excludeVariableName("specularBase"),e._excludeVariableName("preInfo"),e._excludeVariableName("info"),e._excludeVariableName("shadow"),e._excludeVariableName("finalDiffuse"),e._excludeVariableName("finalAmbient"),e._excludeVariableName("ambientOcclusionForDirectDiffuse"),e._excludeVariableName("finalColor"),e._excludeVariableName("vClipSpacePosition"),e._excludeVariableName("vDebugMode"),e._excludeVariableName("vViewDepth"),this._initShaderSourceAsync(e.shaderLanguage)},t.prototype._initShaderSourceAsync=function(e){return(0,f.sH)(this,void 0,void 0,(function(){return(0,f.YH)(this,(function(t){switch(t.label){case 0:return this._codeIsReady=!1,1!==e?[3,2]:[4,Promise.all([Promise.resolve().then(n.bind(n,10721)),Promise.resolve().then(n.bind(n,31194))])];case 1:return t.sent(),[3,4];case 2:return[4,Promise.all([Promise.resolve().then(n.bind(n,17152)),Promise.resolve().then(n.bind(n,40682))])];case 3:t.sent(),t.label=4;case 4:return this._codeIsReady=!0,this.onCodeIsReadyObservable.notifyObservers(this),[2]}}))}))},t.prototype.getClassName=function(){return"PBRMetallicRoughnessBlock"},Object.defineProperty(t.prototype,"worldPosition",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"worldNormal",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"view",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cameraPosition",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"perturbedNormal",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"baseColor",{get:function(){return this._inputs[5]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"metallic",{get:function(){return this._inputs[6]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"roughness",{get:function(){return this._inputs[7]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ambientOcc",{get:function(){return this._inputs[8]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"opacity",{get:function(){return this._inputs[9]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"indexOfRefraction",{get:function(){return this._inputs[10]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ambientColor",{get:function(){return this._inputs[11]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"reflection",{get:function(){return this._inputs[12]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearcoat",{get:function(){return this._inputs[13]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sheen",{get:function(){return this._inputs[14]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"subsurface",{get:function(){return this._inputs[15]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"anisotropy",{get:function(){return this._inputs[16]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"iridescence",{get:function(){return this._inputs[17]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ambientClr",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"diffuseDir",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"specularDir",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearcoatDir",{get:function(){return this._outputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sheenDir",{get:function(){return this._outputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"diffuseInd",{get:function(){return this._outputs[5]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"specularInd",{get:function(){return this._outputs[6]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearcoatInd",{get:function(){return this._outputs[7]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sheenInd",{get:function(){return this._outputs[8]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"refraction",{get:function(){return this._outputs[9]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lighting",{get:function(){return this._outputs[10]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shadow",{get:function(){return this._outputs[11]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"alpha",{get:function(){return this._outputs[12]},enumerable:!1,configurable:!0}),t.prototype.autoConfigure=function(e,t){if(void 0===t&&(t=function(){return!0}),!this.cameraPosition.isConnected){var n=e.getInputBlockByPredicate((function(e){return e.systemValue===Av.CameraPosition&&t(e)}));n||(n=new Lv("cameraPosition")).setAsSystemValue(Av.CameraPosition),n.output.connectTo(this.cameraPosition)}if(!this.view.isConnected){var r=e.getInputBlockByPredicate((function(e){return e.systemValue===Av.View&&t(e)}));r||(r=new Lv("view")).setAsSystemValue(Av.View),r.output.connectTo(this.view)}},t.prototype.prepareDefines=function(e,t,n){if(n){e.setValue("PBR",!0),e.setValue("METALLICWORKFLOW",!0),e.setValue("DEBUGMODE",this.debugMode,!0),e.setValue("DEBUGMODE_FORCERETURN",!0),e.setValue("NORMALXYSCALE",!0),e.setValue("BUMP",this.perturbedNormal.isConnected,!0),e.setValue("LODBASEDMICROSFURACE",this._scene.getEngine().getCaps().textureLOD),e.setValue("ALBEDO",!1,!0),e.setValue("OPACITY",this.opacity.isConnected,!0),e.setValue("AMBIENT",!0,!0),e.setValue("AMBIENTINGRAYSCALE",!1,!0),e.setValue("REFLECTIVITY",!1,!0),e.setValue("AOSTOREINMETALMAPRED",!1,!0),e.setValue("METALLNESSSTOREINMETALMAPBLUE",!1,!0),e.setValue("ROUGHNESSSTOREINMETALMAPALPHA",!1,!0),e.setValue("ROUGHNESSSTOREINMETALMAPGREEN",!1,!0),this.lightFalloff===gg.LIGHTFALLOFF_STANDARD?(e.setValue("USEPHYSICALLIGHTFALLOFF",!1),e.setValue("USEGLTFLIGHTFALLOFF",!1)):this.lightFalloff===gg.LIGHTFALLOFF_GLTF?(e.setValue("USEPHYSICALLIGHTFALLOFF",!1),e.setValue("USEGLTFLIGHTFALLOFF",!0)):(e.setValue("USEPHYSICALLIGHTFALLOFF",!0),e.setValue("USEGLTFLIGHTFALLOFF",!1));var r=this.alphaTestCutoff.toString();e.setValue("ALPHABLEND",this.useAlphaBlending,!0),e.setValue("ALPHAFROMALBEDO",!1,!0),e.setValue("ALPHATEST",this.useAlphaTest,!0),e.setValue("ALPHATESTVALUE",r.indexOf(".")<0?r+".":r,!0),e.setValue("OPACITYRGB",!1,!0),e.setValue("RADIANCEOVERALPHA",this.useRadianceOverAlpha,!0),e.setValue("SPECULAROVERALPHA",this.useSpecularOverAlpha,!0),e.setValue("SPECULARAA",this._scene.getEngine().getCaps().standardDerivatives&&this.enableSpecularAntiAliasing,!0),e.setValue("REALTIME_FILTERING",this.realTimeFiltering,!0);var i=n.getScene();if(i.getEngine()._features.needTypeSuffixInShaderConstants?e.setValue("NUM_SAMPLES",this.realTimeFilteringQuality+"u",!0):e.setValue("NUM_SAMPLES",""+this.realTimeFilteringQuality,!0),e.setValue("BASE_DIFFUSE_MODEL",this.baseDiffuseModel,!0),e.setValue("BRDF_V_HEIGHT_CORRELATED",!0),e.setValue("LEGACY_SPECULAR_ENERGY_CONSERVATION",!0),e.setValue("MS_BRDF_ENERGY_CONSERVATION",this.useEnergyConservation,!0),e.setValue("RADIANCEOCCLUSION",this.useRadianceOcclusion,!0),e.setValue("HORIZONOCCLUSION",this.useHorizonOcclusion,!0),e.setValue("UNLIT",this.unlit,!0),e.setValue("FORCENORMALFORWARD",this.forceNormalForward,!0),this._environmentBRDFTexture&&_o.h.ReflectionTextureEnabled?(e.setValue("ENVIRONMENTBRDF",!0),e.setValue("ENVIRONMENTBRDF_RGBD",this._environmentBRDFTexture.isRGBD,!0)):(e.setValue("ENVIRONMENTBRDF",!1),e.setValue("ENVIRONMENTBRDF_RGBD",!1)),e._areImageProcessingDirty&&t.imageProcessingConfiguration&&t.imageProcessingConfiguration.prepareDefines(e),e._areLightsDirty)if(this.light){var o={needNormals:!1,needRebuild:!1,lightmapMode:!1,shadowEnabled:!1,specularEnabled:!1};(0,Le.lo)(i,n,this.light,this._lightId,e,!0,o),o.needRebuild&&e.rebuild()}else(0,Le.az)(i,n,e,!0,t.maxSimultaneousLights),e._needNormals=!0,(0,Le.VO)(i,e)}},t.prototype.updateUniformsAndSamples=function(e,t,n,r){for(var i=0;i=0;(0,Le.GD)(i,e.uniforms,e.samplers,n["PROJECTEDLIGHTTEXTURE"+i],r,o,n["IESLIGHTTEXTURE"+i],n["CLUSTLIGHT"+i])}},t.prototype.isReady=function(e,t,n){return!(this._environmentBRDFTexture&&!this._environmentBRDFTexture.isReady()||n._areImageProcessingDirty&&t.imageProcessingConfiguration&&!t.imageProcessingConfiguration.isReady())},t.prototype.bind=function(e,t,n){if(n){var r=n.getScene();this.light?(0,Le.Kd)(this.light,this._lightId,r,e,!0):(0,Le.RL)(r,n,e,!0,t.maxSimultaneousLights),e.setTexture(this._environmentBrdfSamplerName,this._environmentBRDFTexture),e.setFloat2("vDebugMode",this.debugLimit,this.debugFactor);var i=this._scene.ambientColor;i&&e.setColor3("ambientFromScene",i);var o=r.useRightHandedSystem===(null!=r._mirroredCameraPosition);e.setFloat(this._invertNormalName,o?-1:1),e.setFloat4("vLightingIntensity",this.directIntensity,1,this.environmentIntensity*this._scene.environmentIntensity,this.specularIntensity);var a=this._metallicF0Factor;e.setColor4(this._vMetallicReflectanceFactorsName,this._metallicReflectanceColor,a),t.imageProcessingConfiguration&&t.imageProcessingConfiguration.bind(e)}},t.prototype._injectVertexCode=function(e){var t,n,r=this.worldPosition,i=this.worldNormal,o="//".concat(this.name),a=1===e.shaderLanguage;this.light?(this._lightId=(void 0!==e.counters.lightCounter?e.counters.lightCounter:-1)+1,e.counters.lightCounter=this._lightId,e._emitFunctionFromInclude(e.supportUniformBuffers?"lightVxUboDeclaration":"lightVxFragmentDeclaration",o,{replaceStrings:[{search:/{X}/g,replace:this._lightId.toString()}]},this._lightId.toString())):(e._emitFunctionFromInclude(e.supportUniformBuffers?"lightVxUboDeclaration":"lightVxFragmentDeclaration",o,{repeatKey:"maxSimultaneousLights"}),this._lightId=0,e.sharedData.dynamicUniformBlocks.push(this));var s="v_"+r.associatedVariableName;e._emitVaryingFromString(s,dv.Vector4)&&(e.compilationString+=(a?"vertexOutputs.":"")+"".concat(s," = ").concat(r.associatedVariableName,";\n"));var l="v_"+i.associatedVariableName;e._emitVaryingFromString(l,dv.Vector4)&&(e.compilationString+=(a?"vertexOutputs.":"")+"".concat(l," = ").concat(i.associatedVariableName,";\n"));var c=this.reflection.isConnected?null===(t=this.reflection.connectedPoint)||void 0===t?void 0:t.ownerBlock:null;c&&(c.viewConnectionPoint=this.view),e.compilationString+=null!==(n=null==c?void 0:c.handleVertexSide(e))&&void 0!==n?n:"",e._emitVaryingFromString("vClipSpacePosition",dv.Vector4,"defined(IGNORE) || DEBUGMODE > 0")&&(e._injectAtEnd+="#if DEBUGMODE > 0\n",e._injectAtEnd+=(a?"vertexOutputs.":"")+"vClipSpacePosition = ".concat(a?"vertexOutputs.position":"gl_Position",";\n"),e._injectAtEnd+="#endif\n"),this.light?e.compilationString+=e._emitCodeFromInclude("shadowsVertex",o,{replaceStrings:[{search:/{X}/g,replace:this._lightId.toString()},{search:/worldPos/g,replace:r.associatedVariableName}]}):(e.compilationString+="".concat(e._declareLocalVar("worldPos",dv.Vector4)," = ").concat(r.associatedVariableName,";\n"),this.view.isConnected&&(e.compilationString+="".concat(e._declareLocalVar("view",dv.Matrix)," = ").concat(this.view.associatedVariableName,";\n"),e._emitVaryingFromString("vViewDepth",dv.Float),e.compilationString+=(1===e.shaderLanguage?"vertexOutputs.":"")+"vViewDepth = (".concat(this.view.associatedVariableName," * ").concat(r.associatedVariableName,").z;\n")),e.compilationString+=e._emitCodeFromInclude("shadowsVertex",o,{repeatKey:"maxSimultaneousLights"}))},t.prototype._getAlbedoOpacityCode=function(e){var t=1===e.shaderLanguage?"var albedoOpacityOut: albedoOpacityOutParams;\n":"albedoOpacityOutParams albedoOpacityOut;\n",n=this.baseColor.isConnected?this.baseColor.associatedVariableName:"vec3(1.)",r=this.opacity.isConnected?this.opacity.associatedVariableName:"1.";return t+"albedoOpacityOut = albedoOpacityBlock(\n vec4".concat(e.fSuffix,"(").concat(n,", 1.)\n #ifdef ALBEDO\n ,vec4").concat(e.fSuffix,"(1.)\n ,vec2").concat(e.fSuffix,"(1., 1.)\n #endif\n ,1. /* Base Weight */\n #ifdef OPACITY\n ,vec4").concat(e.fSuffix,"(").concat(r,")\n ,vec2").concat(e.fSuffix,"(1., 1.)\n #endif\n );\n\n ").concat(e._declareLocalVar("surfaceAlbedo",dv.Vector3)," = albedoOpacityOut.surfaceAlbedo;\n ").concat(e._declareLocalVar("alpha",dv.Float)," = albedoOpacityOut.alpha;\n")},t.prototype._getAmbientOcclusionCode=function(e){var t=1===e.shaderLanguage?"var aoOut: ambientOcclusionOutParams;\n":"ambientOcclusionOutParams aoOut;\n",n=this.ambientOcc.isConnected?this.ambientOcc.associatedVariableName:"1.";return t+"aoOut = ambientOcclusionBlock(\n #ifdef AMBIENT\n vec3".concat(e.fSuffix,"(").concat(n,"),\n vec4").concat(e.fSuffix,"(0., 1.0, 1.0, 0.)\n #endif\n );\n")},t.prototype._getReflectivityCode=function(e){var t,n,r=1===e.shaderLanguage,i=r?"var reflectivityOut: reflectivityOutParams;\n":"reflectivityOutParams reflectivityOut;\n";this._vMetallicReflectanceFactorsName=e._getFreeVariableName("vMetallicReflectanceFactors"),e._emitUniformFromString(this._vMetallicReflectanceFactorsName,dv.Vector4),this._baseDiffuseRoughnessName=e._getFreeVariableName("baseDiffuseRoughness"),e._emitUniformFromString(this._baseDiffuseRoughnessName,dv.Float);var o=null!==(n=null===(t=this.indexOfRefraction.connectInputBlock)||void 0===t?void 0:t.value)&&void 0!==n?n:1.5,a=Math.pow((o-1)/(o+1),2);return i+"".concat(e._declareLocalVar("baseColor",dv.Vector3)," = surfaceAlbedo;\n ").concat(r?"let":"vec4".concat(e.fSuffix)," vReflectivityColor = vec4").concat(e.fSuffix,"(").concat(this.metallic.associatedVariableName,", ").concat(this.roughness.associatedVariableName,", ").concat(this.indexOfRefraction.associatedVariableName||"1.5",", ").concat(a,");\n reflectivityOut = reflectivityBlock(\n vReflectivityColor\n #ifdef METALLICWORKFLOW\n , surfaceAlbedo\n , ").concat((r?"uniforms.":"")+this._vMetallicReflectanceFactorsName,"\n #endif\n , ").concat((r?"uniforms.":"")+this._baseDiffuseRoughnessName,"\n #ifdef BASE_DIFFUSE_ROUGHNESS\n , 0.\n , vec2").concat(e.fSuffix,"(0., 0.)\n #endif\n #ifdef REFLECTIVITY\n , vec3").concat(e.fSuffix,"(0., 0., ").concat("1.",")\n , vec4").concat(e.fSuffix,"(1.)\n #endif\n #if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)\n , aoOut.ambientOcclusionColor\n #endif\n #ifdef MICROSURFACEMAP\n , microSurfaceTexel <== not handled!\n #endif\n );\n\n ").concat(e._declareLocalVar("microSurface",dv.Float)," = reflectivityOut.microSurface;\n ").concat(e._declareLocalVar("roughness",dv.Float)," = reflectivityOut.roughness;\n ").concat(e._declareLocalVar("diffuseRoughness",dv.Float)," = reflectivityOut.diffuseRoughness;\n\n #ifdef METALLICWORKFLOW\n surfaceAlbedo = reflectivityOut.surfaceAlbedo;\n #endif\n #if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)\n aoOut.ambientOcclusionColor = reflectivityOut.ambientOcclusionColor;\n #endif\n")},t.prototype._buildBlock=function(t){var n,r,i,o,a,s,l,c,u,h,d,p,f,m,_,g,v,y,b,S,T,E,x,P,C,R,A,I,O,M,D,N,F,L,w,B,V,U,G,k,z;e.prototype._buildBlock.call(this,t),this._scene=t.sharedData.scene;var W=1===t.shaderLanguage;this._environmentBRDFTexture||(this._environmentBRDFTexture=eg(this._scene));var H=this.reflection.isConnected?null===(n=this.reflection.connectedPoint)||void 0===n?void 0:n.ownerBlock:null;if(H&&(H.worldPositionConnectionPoint=this.worldPosition,H.cameraPositionConnectionPoint=this.cameraPosition,H.worldNormalConnectionPoint=this.worldNormal,H.viewConnectionPoint=this.view),t.target!==pv.Fragment)return this._injectVertexCode(t),this;t.sharedData.forcedBindableBlocks.push(this),t.sharedData.blocksWithDefines.push(this),t.sharedData.blockingBlocks.push(this),this.generateOnlyFragmentCode&&t.sharedData.dynamicUniformBlocks.push(this);var Y="//".concat(this.name),X=this.perturbedNormal,j=this.worldPosition.associatedVariableName,q=this.worldPosition.associatedVariableName,K=this.worldNormal.associatedVariableName;this.generateOnlyFragmentCode?(j=t._getFreeVariableName("globalWorldPos"),t._emitFunction("pbr_globalworldpos","".concat(t._declareLocalVar(j,dv.Vector3,!1,!0),";\n"),Y),t.compilationString+="".concat(j," = ").concat(this.worldPosition.associatedVariableName,".xyz;\n"),q=t._getFreeVariableName("globalWorldPos4"),t._emitFunction("pbr_globalworldpos4","".concat(t._declareLocalVar(q,dv.Vector4,!1,!0),";\n"),Y),t.compilationString+="".concat(q," = ").concat(this.worldPosition.associatedVariableName,";\n"),K=t._getFreeVariableName("globalWorldNormal"),t._emitFunction("pbr_globalworldnorm","".concat(t._declareLocalVar(K,dv.Vector4,!1,!0),";\n"),Y),t.compilationString+="".concat(K," = ").concat(this.worldNormal.associatedVariableName,";\n"),t.compilationString+=t._emitCodeFromInclude("shadowsVertex",Y,{repeatKey:"maxSimultaneousLights",substitutionVars:"worldPos,".concat(this.worldPosition.associatedVariableName)}),t.compilationString+="#if DEBUGMODE > 0\n",t.compilationString+="".concat(t._declareLocalVar("vClipSpacePosition",dv.Vector4)," = vec4").concat(t.fSuffix,"((vec2").concat(t.fSuffix,"(").concat(W?"fragmentInputs.position":"gl_FragCoord.xy",") / vec2").concat(t.fSuffix,"(1.0)) * 2.0 - 1.0, 0.0, 1.0);\n"),t.compilationString+="#endif\n"):(j=(W?"input.":"")+"v_"+j,K=(W?"input.":"")+"v_"+K),this._environmentBrdfSamplerName=t._getFreeVariableName("environmentBrdfSampler"),t._emit2DSampler(this._environmentBrdfSamplerName),t.sharedData.hints.needAlphaBlending=t.sharedData.hints.needAlphaBlending||this.useAlphaBlending,t.sharedData.hints.needAlphaTesting=t.sharedData.hints.needAlphaTesting||this.useAlphaTest,t._emitExtension("lod","#extension GL_EXT_shader_texture_lod : enable","defined(LODBASEDMICROSFURACE)"),t._emitExtension("derivatives","#extension GL_OES_standard_derivatives : enable"),t._emitUniformFromString("vDebugMode",dv.Vector2,"defined(IGNORE) || DEBUGMODE > 0"),t._emitUniformFromString("ambientFromScene",dv.Vector3),t.uniforms.push("exposureLinear"),t.uniforms.push("contrast"),t.uniforms.push("vInverseScreenSize"),t.uniforms.push("vignetteSettings1"),t.uniforms.push("vignetteSettings2"),t.uniforms.push("vCameraColorCurveNegative"),t.uniforms.push("vCameraColorCurveNeutral"),t.uniforms.push("vCameraColorCurvePositive"),t.uniforms.push("txColorTransform"),t.uniforms.push("colorTransformSettings"),t.uniforms.push("ditherIntensity"),this.light?t._emitFunctionFromInclude(t.supportUniformBuffers?"lightUboDeclaration":"lightFragmentDeclaration",Y,{replaceStrings:[{search:/{X}/g,replace:this._lightId.toString()}]},this._lightId.toString()):(this.generateOnlyFragmentCode&&this.view.isConnected&&(t.compilationString+="".concat(t._declareLocalVar("vViewDepth",dv.Float)," = (").concat(this.view.associatedVariableName," * ").concat(q,").z;\n")),t._emitFunctionFromInclude(t.supportUniformBuffers?"lightUboDeclaration":"lightFragmentDeclaration",Y,{repeatKey:"maxSimultaneousLights",substitutionVars:this.generateOnlyFragmentCode?"varying,":void 0})),t._emitFunctionFromInclude("helperFunctions",Y),t._emitFunctionFromInclude("importanceSampling",Y),t._emitFunctionFromInclude("pbrHelperFunctions",Y),t._emitFunctionFromInclude("imageProcessingDeclaration",Y),t._emitFunctionFromInclude("imageProcessingFunctions",Y),t._emitFunctionFromInclude("shadowsFragmentFunctions",Y),t._emitFunctionFromInclude("pbrDirectLightingSetupFunctions",Y),t._emitFunctionFromInclude("pbrDirectLightingFalloffFunctions",Y),t._emitFunctionFromInclude("pbrBRDFFunctions",Y,{replaceStrings:[{search:/REFLECTIONMAP_SKYBOX/g,replace:null!==(r=null==H?void 0:H._defineSkyboxName)&&void 0!==r?r:"REFLECTIONMAP_SKYBOX"}]}),t._emitFunctionFromInclude("hdrFilteringFunctions",Y),t._emitFunctionFromInclude("pbrDirectLightingFunctions",Y),t._emitFunctionFromInclude("pbrIBLFunctions",Y),t._emitFunctionFromInclude("pbrBlockAlbedoOpacity",Y),t._emitFunctionFromInclude("pbrBlockReflectivity",Y),t._emitFunctionFromInclude("pbrBlockAmbientOcclusion",Y),t._emitFunctionFromInclude("pbrBlockAlphaFresnel",Y),t._emitFunctionFromInclude("pbrBlockAnisotropic",Y),W||t._emitFunctionFromInclude("pbrClusteredLightingFunctions",Y),t._emitUniformFromString("vLightingIntensity",dv.Vector4),(null==H?void 0:H.generateOnlyFragmentCode)&&(t.compilationString+=H.handleVertexSide(t)),this._vNormalWName=t._getFreeVariableName("vNormalW"),t.compilationString+="".concat(t._declareLocalVar(this._vNormalWName,dv.Vector4)," = normalize(").concat(K,");\n"),t._registerTempVariable("viewDirectionW")&&(t.compilationString+="".concat(t._declareLocalVar("viewDirectionW",dv.Vector3)," = normalize(").concat(this.cameraPosition.associatedVariableName," - ").concat(j,".xyz);\n")),t.compilationString+="".concat(t._declareLocalVar("geometricNormalW",dv.Vector3)," = ").concat(this._vNormalWName,".xyz;\n"),t.compilationString+="".concat(t._declareLocalVar("normalW",dv.Vector3)," = ").concat(X.isConnected?"normalize("+X.associatedVariableName+".xyz)":"geometricNormalW",";\n"),this._invertNormalName=t._getFreeVariableName("invertNormal"),t._emitUniformFromString(this._invertNormalName,dv.Float),t.compilationString+=t._emitCodeFromInclude("pbrBlockNormalFinal",Y,{replaceStrings:[{search:/vPositionW/g,replace:j+".xyz"},{search:/vEyePosition.w/g,replace:this._invertNormalName}]}),t.compilationString+=this._getAlbedoOpacityCode(t),t.compilationString+=t._emitCodeFromInclude("depthPrePass",Y),t.compilationString+=this._getAmbientOcclusionCode(t),t.compilationString+=t._emitCodeFromInclude("pbrBlockLightmapInit",Y),t.compilationString+="#ifdef UNLIT\n ".concat(t._declareLocalVar("diffuseBase",dv.Vector3)," = vec3").concat(t.fSuffix,"(1., 1., 1.);\n #else\n"),t.compilationString+=this._getReflectivityCode(t),t.compilationString+=t._emitCodeFromInclude("pbrBlockGeometryInfo",Y,{replaceStrings:[{search:/REFLECTIONMAP_SKYBOX/g,replace:null!==(i=null==H?void 0:H._defineSkyboxName)&&void 0!==i?i:"REFLECTIONMAP_SKYBOX"},{search:/REFLECTIONMAP_3D/g,replace:null!==(o=null==H?void 0:H._define3DName)&&void 0!==o?o:"REFLECTIONMAP_3D"}]});var Z=this.anisotropy.isConnected?null===(a=this.anisotropy.connectedPoint)||void 0===a?void 0:a.ownerBlock:null;Z&&(Z.worldPositionConnectionPoint=this.worldPosition,Z.worldNormalConnectionPoint=this.worldNormal,t.compilationString+=Z.getCode(t,!this.perturbedNormal.isConnected)),H&&H.hasTexture&&(t.compilationString+=H.getCode(t,Z?"anisotropicOut.anisotropicNormal":"normalW")),t._emitFunctionFromInclude("pbrBlockReflection",Y,{replaceStrings:[{search:/computeReflectionCoords/g,replace:"computeReflectionCoordsPBR"},{search:/REFLECTIONMAP_3D/g,replace:null!==(s=null==H?void 0:H._define3DName)&&void 0!==s?s:"REFLECTIONMAP_3D"},{search:/REFLECTIONMAP_OPPOSITEZ/g,replace:null!==(l=null==H?void 0:H._defineOppositeZ)&&void 0!==l?l:"REFLECTIONMAP_OPPOSITEZ"},{search:/REFLECTIONMAP_PROJECTION/g,replace:null!==(c=null==H?void 0:H._defineProjectionName)&&void 0!==c?c:"REFLECTIONMAP_PROJECTION"},{search:/REFLECTIONMAP_SKYBOX/g,replace:null!==(u=null==H?void 0:H._defineSkyboxName)&&void 0!==u?u:"REFLECTIONMAP_SKYBOX"},{search:/LODINREFLECTIONALPHA/g,replace:null!==(h=null==H?void 0:H._defineLODReflectionAlpha)&&void 0!==h?h:"LODINREFLECTIONALPHA"},{search:/LINEARSPECULARREFLECTION/g,replace:null!==(d=null==H?void 0:H._defineLinearSpecularReflection)&&void 0!==d?d:"LINEARSPECULARREFLECTION"},{search:/vReflectionFilteringInfo/g,replace:null!==(p=null==H?void 0:H._vReflectionFilteringInfoName)&&void 0!==p?p:"vReflectionFilteringInfo"}]}),t.compilationString+=t._emitCodeFromInclude("pbrBlockReflectance0",Y,{replaceStrings:[{search:/metallicReflectanceFactors/g,replace:(W?"uniforms.":"")+this._vMetallicReflectanceFactorsName}]});var Q=this.sheen.isConnected?null===(f=this.sheen.connectedPoint)||void 0===f?void 0:f.ownerBlock:null;Q&&(t.compilationString+=Q.getCode(H,t)),t._emitFunctionFromInclude("pbrBlockSheen",Y,{replaceStrings:[{search:/REFLECTIONMAP_3D/g,replace:null!==(m=null==H?void 0:H._define3DName)&&void 0!==m?m:"REFLECTIONMAP_3D"},{search:/REFLECTIONMAP_SKYBOX/g,replace:null!==(_=null==H?void 0:H._defineSkyboxName)&&void 0!==_?_:"REFLECTIONMAP_SKYBOX"},{search:/LODINREFLECTIONALPHA/g,replace:null!==(g=null==H?void 0:H._defineLODReflectionAlpha)&&void 0!==g?g:"LODINREFLECTIONALPHA"},{search:/LINEARSPECULARREFLECTION/g,replace:null!==(v=null==H?void 0:H._defineLinearSpecularReflection)&&void 0!==v?v:"LINEARSPECULARREFLECTION"}]});var J=this.clearcoat.isConnected?null===(y=this.clearcoat.connectedPoint)||void 0===y?void 0:y.ownerBlock:null;t.compilationString+=Jx._GetInitializationCode(t,J);var $=this.iridescence.isConnected?null===(b=this.iridescence.connectedPoint)||void 0===b?void 0:b.ownerBlock:null;t.compilationString+=$x.GetCode($,t),t._emitFunctionFromInclude("pbrBlockIridescence",Y,{replaceStrings:[]});var ee=!this.perturbedNormal.isConnected&&!this.anisotropy.isConnected,te=this.perturbedNormal.isConnected&&(null===(T=(null===(S=this.perturbedNormal.connectedPoint)||void 0===S?void 0:S.ownerBlock).worldTangent)||void 0===T?void 0:T.isConnected),ne=this.anisotropy.isConnected&&(null===(E=this.anisotropy.connectedPoint)||void 0===E?void 0:E.ownerBlock).worldTangent.isConnected,re=te||!this.perturbedNormal.isConnected&≠t.compilationString+=Jx.GetCode(t,J,H,j,ee,re,K),ee&&(re=null!==(x=null==J?void 0:J.worldTangent.isConnected)&&void 0!==x&&x),t._emitFunctionFromInclude("pbrBlockClearcoat",Y,{replaceStrings:[{search:/computeReflectionCoords/g,replace:"computeReflectionCoordsPBR"},{search:/REFLECTIONMAP_3D/g,replace:null!==(P=null==H?void 0:H._define3DName)&&void 0!==P?P:"REFLECTIONMAP_3D"},{search:/REFLECTIONMAP_OPPOSITEZ/g,replace:null!==(C=null==H?void 0:H._defineOppositeZ)&&void 0!==C?C:"REFLECTIONMAP_OPPOSITEZ"},{search:/REFLECTIONMAP_PROJECTION/g,replace:null!==(R=null==H?void 0:H._defineProjectionName)&&void 0!==R?R:"REFLECTIONMAP_PROJECTION"},{search:/REFLECTIONMAP_SKYBOX/g,replace:null!==(A=null==H?void 0:H._defineSkyboxName)&&void 0!==A?A:"REFLECTIONMAP_SKYBOX"},{search:/LODINREFLECTIONALPHA/g,replace:null!==(I=null==H?void 0:H._defineLODReflectionAlpha)&&void 0!==I?I:"LODINREFLECTIONALPHA"},{search:/LINEARSPECULARREFLECTION/g,replace:null!==(O=null==H?void 0:H._defineLinearSpecularReflection)&&void 0!==O?O:"LINEARSPECULARREFLECTION"},{search:/defined\(TANGENT\)/g,replace:re?"defined(TANGENT)":"defined(IGNORE)"}]}),t.compilationString+=t._emitCodeFromInclude("pbrBlockReflectance",Y,{replaceStrings:[{search:/REFLECTIONMAP_SKYBOX/g,replace:null!==(M=null==H?void 0:H._defineSkyboxName)&&void 0!==M?M:"REFLECTIONMAP_SKYBOX"},{search:/REFLECTIONMAP_3D/g,replace:null!==(D=null==H?void 0:H._define3DName)&&void 0!==D?D:"REFLECTIONMAP_3D"},{search:/uniforms\.vReflectivityColor/g,replace:"vReflectivityColor"}]});var ie=this.subsurface.isConnected?null===(N=this.subsurface.connectedPoint)||void 0===N?void 0:N.ownerBlock:null,oe=this.subsurface.isConnected?null===(L=(null===(F=this.subsurface.connectedPoint)||void 0===F?void 0:F.ownerBlock).refraction.connectedPoint)||void 0===L?void 0:L.ownerBlock:null;if(oe&&(oe.viewConnectionPoint=this.view,oe.indexOfRefractionConnectionPoint=this.indexOfRefraction),t.compilationString+=tP.GetCode(t,ie,H,j),t._emitFunctionFromInclude("pbrBlockSubSurface",Y,{replaceStrings:[{search:/REFLECTIONMAP_3D/g,replace:null!==(w=null==H?void 0:H._define3DName)&&void 0!==w?w:"REFLECTIONMAP_3D"},{search:/REFLECTIONMAP_OPPOSITEZ/g,replace:null!==(B=null==H?void 0:H._defineOppositeZ)&&void 0!==B?B:"REFLECTIONMAP_OPPOSITEZ"},{search:/REFLECTIONMAP_PROJECTION/g,replace:null!==(V=null==H?void 0:H._defineProjectionName)&&void 0!==V?V:"REFLECTIONMAP_PROJECTION"},{search:/SS_REFRACTIONMAP_3D/g,replace:null!==(U=null==oe?void 0:oe._define3DName)&&void 0!==U?U:"SS_REFRACTIONMAP_3D"},{search:/SS_LODINREFRACTIONALPHA/g,replace:null!==(G=null==oe?void 0:oe._defineLODRefractionAlpha)&&void 0!==G?G:"SS_LODINREFRACTIONALPHA"},{search:/SS_LINEARSPECULARREFRACTION/g,replace:null!==(k=null==oe?void 0:oe._defineLinearSpecularRefraction)&&void 0!==k?k:"SS_LINEARSPECULARREFRACTION"},{search:/SS_REFRACTIONMAP_OPPOSITEZ/g,replace:null!==(z=null==oe?void 0:oe._defineOppositeZ)&&void 0!==z?z:"SS_REFRACTIONMAP_OPPOSITEZ"}]}),t.compilationString+=t._emitCodeFromInclude("pbrBlockDirectLighting",Y),this.light)t.compilationString+=t._emitCodeFromInclude("lightFragment",Y,{replaceStrings:[{search:/{X}/g,replace:this._lightId.toString()},{search:new RegExp("".concat(W?"fragmentInputs.":"","vPositionW"),"g"),replace:j+".xyz"},{search:/uniforms\.vReflectivityColor/g,replace:"vReflectivityColor"}]});else{var ae="vPositionW,".concat(j,".xyz");W&&(ae="fragmentInputs."+ae,this.generateOnlyFragmentCode&&(ae+=",fragmentInputs.vViewDepth,vViewDepth")),t.compilationString+=t._emitCodeFromInclude("lightFragment",Y,{repeatKey:"maxSimultaneousLights",substitutionVars:ae+",uniforms.vReflectivityColor,vReflectivityColor"})}t.compilationString+=t._emitCodeFromInclude("pbrBlockFinalLitComponents",Y),t.compilationString+="#endif\n";var se=this.ambientColor.isConnected?this.ambientColor.associatedVariableName:"vec3".concat(t.fSuffix,"(0., 0., 0.)"),le=gg.DEFAULT_AO_ON_ANALYTICAL_LIGHTS.toString();-1===le.indexOf(".")&&(le+=".");var ce=[{search:/vec3 finalEmissive[\s\S]*?finalEmissive\*=vLightingIntensity\.y;/g,replace:""},{search:new RegExp("".concat(W?"uniforms.":"","vAmbientColor"),"g"),replace:se+" * ".concat(W?"uniforms.":"","ambientFromScene")},{search:new RegExp("".concat(W?"uniforms.":"","vAmbientInfos.w"),"g"),replace:le}];W&&(ce[0]={search:/var finalEmissive[\s\S]*?finalEmissive\*=uniforms.vLightingIntensity\.y;/g,replace:""}),t.compilationString+=t._emitCodeFromInclude("pbrBlockFinalUnlitComponents",Y,{replaceStrings:ce}),t.compilationString+=t._emitCodeFromInclude("pbrBlockFinalColorComposition",Y,{replaceStrings:[{search:/finalEmissive/g,replace:"vec3".concat(t.fSuffix,"(0.)")}]}),ce=W?[{search:/mesh.visibility/g,replace:"1."}]:[{search:/visibility/g,replace:"1."}],t.compilationString+=t._emitCodeFromInclude("pbrBlockImageProcessing",Y,{replaceStrings:ce});var ue=W?"fragmentOutputs.color":"gl_FragColor";ce=[{search:new RegExp("".concat(W?"fragmentInputs.":"","vNormalW"),"g"),replace:this._vNormalWName},{search:new RegExp("".concat(W?"fragmentInputs.":"","vPositionW"),"g"),replace:j},{search:/uniforms\.vReflectivityColor/g,replace:"vReflectivityColor"},{search:/albedoTexture\.rgb;/g,replace:"vec3".concat(t.fSuffix,"(1.);\n").concat(ue,".rgb = toGammaSpace(").concat(ue,".rgb);\n")}],t.compilationString+=t._emitCodeFromInclude("pbrDebug",Y,{replaceStrings:ce});for(var he=0,de=this._outputs;he ").concat(this.b.associatedVariableName)),";\n");break;case oP.GreaterOrEqual:t.compilationString+=t._declareOutput(n)+" = ".concat(t._generateTernary(r,i,"".concat(this.a.associatedVariableName," >= ").concat(this.b.associatedVariableName)),";\n");break;case oP.Xor:t.compilationString+=t._declareOutput(n)+" = ".concat(t._generateTernary(r,i,"(((".concat(this.a.associatedVariableName," + ").concat(this.b.associatedVariableName,") % 2.0) > 0.0)")),";\n");break;case oP.Or:t.compilationString+=t._declareOutput(n)+" = ".concat(t._generateTernary(r,i,"(min(".concat(this.a.associatedVariableName," + ").concat(this.b.associatedVariableName,", 1.0) > 0.0)")),";\n");break;case oP.And:t.compilationString+=t._declareOutput(n)+" = ".concat(t._generateTernary(r,i,"(".concat(this.a.associatedVariableName," * ").concat(this.b.associatedVariableName," > 0.0)")),";\n")}return this},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.condition=this.condition,t},t.prototype._deserialize=function(t,n,r){e.prototype._deserialize.call(this,t,n,r),this.condition=t.condition},t.prototype._dumpPropertiesCode=function(){return e.prototype._dumpPropertiesCode.call(this)+"".concat(this._codeVariableName,".condition = BABYLON.ConditionalBlockConditions.").concat(oP[this.condition],";\n")},(0,f.Cg)([Jp("Condition",5,"ADVANCED",{notifiers:{rebuild:!0},embedded:!0,options:[{label:"Equal",value:oP.Equal},{label:"NotEqual",value:oP.NotEqual},{label:"LessThan",value:oP.LessThan},{label:"GreaterThan",value:oP.GreaterThan},{label:"LessOrEqual",value:oP.LessOrEqual},{label:"GreaterOrEqual",value:oP.GreaterOrEqual},{label:"Xor",value:oP.Xor},{label:"And",value:oP.And},{label:"Or",value:oP.Or}]})],t.prototype,"condition",void 0),t}(Cv);(0,h.Y5)("BABYLON.ConditionalBlock",sP);var lP=function(e){function t(t){var n=e.call(this,t,pv.Neutral)||this;return n.octaves=6,n.registerInput("seed",dv.AutoDetect),n.registerInput("chaos",dv.AutoDetect,!0),n.registerInput("offsetX",dv.Float,!0),n.registerInput("offsetY",dv.Float,!0),n.registerInput("offsetZ",dv.Float,!0),n.registerOutput("output",dv.Float),n._inputs[0].acceptedConnectionPointTypes.push(dv.Vector2),n._inputs[0].acceptedConnectionPointTypes.push(dv.Vector3),n._linkConnectionTypes(0,1),n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"CloudBlock"},Object.defineProperty(t.prototype,"seed",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"chaos",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"offsetX",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"offsetY",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"offsetZ",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(t){var n,r,i;if(e.prototype._buildBlock.call(this,t),this.seed.isConnected&&this._outputs[0].hasEndpoints){var o="\n\n float cloudRandom(float p) { \n float temp = fract(p * 0.011); \n temp *= temp + 7.5; \n temp *= temp + temp; \n return fract(temp); \n }\n\n // Based on Morgan McGuire @morgan3d\n // https://www.shadertoy.com/view/4dS3Wd\n float cloudNoise2(vec2 x, vec2 chaos) {\n vec2 step = chaos * vec2(75., 120.) + vec2(75., 120.);\n\n vec2 i = floor(x);\n vec2 f = fract(x);\n\n float n = dot(i, step);\n\n vec2 u = f * f * (3.0 - 2.0 * f);\n return mix(\n mix(cloudRandom(n + dot(step, vec2(0, 0))), cloudRandom(n + dot(step, vec2(1, 0))), u.x),\n mix(cloudRandom(n + dot(step, vec2(0, 1))), cloudRandom(n + dot(step, vec2(1, 1))), u.x),\n u.y\n );\n }\n\n float cloudNoise3(vec3 x, vec3 chaos) {\n vec3 step = chaos * vec3(60., 120., 75.) + vec3(60., 120., 75.);\n\n vec3 i = floor(x);\n vec3 f = fract(x);\n\n float n = dot(i, step);\n\n vec3 u = f * f * (3.0 - 2.0 * f);\n return mix(mix(mix( cloudRandom(n + dot(step, vec3(0, 0, 0))), cloudRandom(n + dot(step, vec3(1, 0, 0))), u.x),\n mix( cloudRandom(n + dot(step, vec3(0, 1, 0))), cloudRandom(n + dot(step, vec3(1, 1, 0))), u.x), u.y),\n mix(mix( cloudRandom(n + dot(step, vec3(0, 0, 1))), cloudRandom(n + dot(step, vec3(1, 0, 1))), u.x),\n mix( cloudRandom(n + dot(step, vec3(0, 1, 1))), cloudRandom(n + dot(step, vec3(1, 1, 1))), u.x), u.y), u.z);\n }",a="\n float fbm2(vec2 st, vec2 chaos) {\n // Initial values\n float value = 0.0;\n float amplitude = .5;\n float frequency = 0.;\n\n // Loop of octaves\n vec2 tempST = st;\n for (int i = 0; i < OCTAVES; i++) {\n value += amplitude * cloudNoise2(tempST, chaos);\n tempST *= 2.0;\n amplitude *= 0.5;\n }\n return value;\n }\n\n float fbm3(vec3 x, vec3 chaos) {\n // Initial values\n float value = 0.0;\n float amplitude = 0.5;\n vec3 tempX = x;\n for (int i = 0; i < OCTAVES; i++) {\n value += amplitude * cloudNoise3(tempX, chaos);\n tempX = tempX * 2.0;\n amplitude *= 0.5;\n }\n return value;\n }";1===t.shaderLanguage&&(o=t._babylonSLtoWGSL(o),a=t._babylonSLtoWGSL(a));var s="fbm".concat(this.octaves);t._emitFunction("CloudBlockCode",o,"// CloudBlockCode"),t._emitFunction("CloudBlockCodeFBM"+this.octaves,a.replace(/fbm/gi,s).replace(/OCTAVES/gi,(0|this.octaves).toString()),"// CloudBlockCode FBM");var l=t._getFreeVariableName("st"),c=(null===(n=this.seed.connectedPoint)||void 0===n?void 0:n.type)||dv.Vector3;t.compilationString+="".concat(t._declareLocalVar(l,c)," = ").concat(this.seed.associatedVariableName,";\n"),this.offsetX.isConnected&&(t.compilationString+="".concat(l,".x += 0.1 * ").concat(this.offsetX.associatedVariableName,";\n")),this.offsetY.isConnected&&(t.compilationString+="".concat(l,".y += 0.1 * ").concat(this.offsetY.associatedVariableName,";\n")),this.offsetZ.isConnected&&c===dv.Vector3&&(t.compilationString+="".concat(l,".z += 0.1 * ").concat(this.offsetZ.associatedVariableName,";\n"));var u="";if(this.chaos.isConnected)u=this.chaos.associatedVariableName;else{var h=t.fSuffix;u=(null===(r=this.seed.connectedPoint)||void 0===r?void 0:r.type)===dv.Vector2?"vec2".concat(h,"(0., 0.)"):"vec3".concat(h,"(0., 0., 0.)")}return t.compilationString+=t._declareOutput(this._outputs[0])+" = ".concat(s).concat((null===(i=this.seed.connectedPoint)||void 0===i?void 0:i.type)===dv.Vector2?"2":"3","(").concat(l,", ").concat(u,");\n"),this}},t.prototype._dumpPropertiesCode=function(){return e.prototype._dumpPropertiesCode.call(this)+"".concat(this._codeVariableName,".octaves = ").concat(this.octaves,";\n")},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.octaves=this.octaves,t},t.prototype._deserialize=function(t,n,r){e.prototype._deserialize.call(this,t,n,r),this.octaves=t.octaves},(0,f.Cg)([Jp("Octaves",2,void 0,{embedded:!0})],t.prototype,"octaves",void 0),t}(Cv);(0,h.Y5)("BABYLON.CloudBlock",lP);var cP=function(e){function t(t){var n=e.call(this,t,pv.Neutral)||this;return n.registerInput("seed",dv.Vector2),n.registerInput("offset",dv.Float),n.registerInput("density",dv.Float),n.registerOutput("output",dv.Float),n.registerOutput("cells",dv.Float),n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"VoronoiNoiseBlock"},Object.defineProperty(t.prototype,"seed",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"offset",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"density",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cells",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(t){if(e.prototype._buildBlock.call(this,t),this.seed.isConnected){var n="vec2 voronoiRandom(vec2 p){\n p = vec2(dot(p,vec2(127.1,311.7)),dot(p,vec2(269.5,183.3)));\n return fract(sin(p)*18.5453);\n }\n ";1===t.shaderLanguage&&(n=t._babylonSLtoWGSL(n)),t._emitFunction("voronoiRandom",n,"// Voronoi random generator"),n="void voronoi(vec2 seed, float offset, float density, out float outValue, out float cells){\n vec2 n = floor(seed * density);\n vec2 f = fract(seed * density);\n vec3 m = vec3( 8.0 );\n for( int j=-1; j<=1; j++ ){\n for( int i=-1; i<=1; i++ ){\n vec2 g = vec2( float(i), float(j) );\n vec2 o = voronoiRandom( n + g);\n vec2 r = g - f + (0.5+0.5*sin(offset+6.2831*o));\n float d = dot( r, r );\n if( d= 0.0) {\n ").concat(d,".x = -").concat(d,".x;\n }\n if (").concat(h,".y < 0.0) {\n ").concat(p,".y = -").concat(p,".y;\n }\n if (").concat(h,".z < 0.0) {\n ").concat(f,".x = -").concat(f,".x;\n }\n "));var m=e.fSuffix;e.compilationString+="\n ".concat(e._declareLocalVar(s,dv.Vector4)," = ").concat(this._generateTextureSample(r,d,e),";\n ").concat(e._declareLocalVar(l,dv.Vector4)," = ").concat(this._generateTextureSample(i,p,e),";\n ").concat(e._declareLocalVar(c,dv.Vector4)," = ").concat(this._generateTextureSample(o,f,e),";\n \n // blend weights\n ").concat(e._declareLocalVar(u,dv.Vector3)," = pow(abs(").concat(h,"), vec3").concat(m,"(").concat(a,"));\n\n // blend and return\n ").concat(e._declareLocalVar(this._tempTextureRead,dv.Vector4)," = (").concat(s,"*").concat(u,".x + ").concat(l,"*").concat(u,".y + ").concat(c,"*").concat(u,".z) / (").concat(u,".x + ").concat(u,".y + ").concat(u,".z); \n ")},t.prototype._generateConversionCode=function(e,t,n){var r="";1!==e.shaderLanguage||t.type!==dv.Vector3&&t.type!==dv.Color3||(r="Vec3"),"a"!==n&&(this.texture&&this.texture.gammaSpace||(e.compilationString+="#ifdef ".concat(this._linearDefineName,"\n ").concat(t.associatedVariableName," = toGammaSpace").concat(r,"(").concat(t.associatedVariableName,");\n #endif\n ")),e.compilationString+="#ifdef ".concat(this._gammaDefineName,"\n ").concat(t.associatedVariableName," = toLinearSpace").concat(r,"(").concat(t.associatedVariableName,");\n #endif\n "))},t.prototype._writeOutput=function(e,t,n){var r="";this.disableLevelMultiplication||(r=" * ".concat(1===e.shaderLanguage?"uniforms.":"").concat(this._textureInfoName)),e.compilationString+="".concat(e._declareOutput(t)," = ").concat(this._tempTextureRead,".").concat(n).concat(r,";\n"),this._generateConversionCode(e,t,n)},t.prototype._buildBlock=function(t){e.prototype._buildBlock.call(this,t),this.source.isConnected?this._imageSource=this.source.connectedPoint.ownerBlock:this._imageSource=null,this._textureInfoName=t._getFreeVariableName("textureInfoName"),this.level.associatedVariableName=(1===t.shaderLanguage?"uniforms.":"")+this._textureInfoName,this._tempTextureRead=t._getFreeVariableName("tempTextureRead"),this._linearDefineName=t._getFreeDefineName("ISLINEAR"),this._gammaDefineName=t._getFreeDefineName("ISGAMMA"),this._imageSource||(this._samplerName=t._getFreeVariableName(this.name+"Texture"),t._emit2DSampler(this._samplerName)),t.sharedData.blockingBlocks.push(this),t.sharedData.textureBlocks.push(this),t.sharedData.blocksWithDefines.push(this),t.sharedData.bindableBlocks.push(this);var n="//".concat(this.name);t._emitFunctionFromInclude("helperFunctions",n),t._emitUniformFromString(this._textureInfoName,dv.Float),this._generateTextureLookup(t);for(var r=0,i=this._outputs;r"):"ivec3 ".concat(e)},t.prototype._getTextureGrad=function(e,t){return 1===e.shaderLanguage?"textureSampleGrad(".concat(t,",").concat(t+b.Y.AUTOSAMPLERSUFFIX):"textureGrad(".concat(t)},t.prototype._generateTextureLookup=function(e){var t,n=this.samplerName,r=null!==(t=this.samplerYName)&&void 0!==t?t:this.samplerName,i=this.sharpness.isConnected?this.sharpness.associatedVariableName:"1.0",o=e._getFreeVariableName("dxValue"),a=e._getFreeVariableName("dyValue"),s=e._getFreeVariableName("n"),l=e._getFreeVariableName("ma"),c=e._getFreeVariableName("mi"),u=e._getFreeVariableName("me"),h=e._getFreeVariableName("x"),d=e._getFreeVariableName("y"),p=e._getFreeVariableName("w"),f="ivec3",m="dFdx",_="dFdy",g=e.fSuffix;1===e.shaderLanguage&&(f="vec3",m="dpdx",_="dpdy"),e.compilationString+="\n // grab coord derivatives for texturing\n ".concat(e._declareLocalVar(o,dv.Vector3)," = ").concat(m,"(").concat(this.position.associatedVariableName,".xyz);\n ").concat(e._declareLocalVar(a,dv.Vector3)," = ").concat(_,"(").concat(this.position.associatedVariableName,".xyz);\n ").concat(e._declareLocalVar(s,dv.Vector3)," = abs(").concat(this.normal.associatedVariableName,".xyz);\n \n // determine major axis (in x; yz are following axis)\n ").concat(this._declareLocalVarAsVec3I(l,e)," = ").concat(e._generateTernary("".concat(f,"(0,1,2)"),"".concat(e._generateTernary("".concat(f,"(1,2,0)"),"".concat(f,"(2,0,1)"),"(".concat(s,".y>").concat(s,".z)"))),"(".concat(s,".x>").concat(s,".y && ").concat(s,".x>").concat(s,".z)")),"; \n\n // determine minor axis (in x; yz are following axis)\n ").concat(this._declareLocalVarAsVec3I(c,e)," = ").concat(e._generateTernary("".concat(f,"(0,1,2)"),"".concat(e._generateTernary("".concat(f,"(1,2,0)"),"".concat(f,"(2,0,1)"),"(".concat(s,".y<").concat(s,".z)"))),"(".concat(s,".x<").concat(s,".y && ").concat(s,".x<").concat(s,".z)")),"; \n \n // determine median axis (in x; yz are following axis)\n ").concat(this._declareLocalVarAsVec3I(u,e)," = ").concat(f,"(3) - ").concat(c," - ").concat(l,";\n \n // project+fetch\n ").concat(e._declareLocalVar(h,dv.Vector4)," = ").concat(this._getTextureGrad(e,n),", vec2").concat(g,"(").concat(this.position.associatedVariableName,"[").concat(l,".y], ").concat(this.position.associatedVariableName,"[").concat(l,".z]), \n vec2").concat(g,"(").concat(o,"[").concat(l,".y],").concat(o,"[").concat(l,".z]), \n vec2").concat(g,"(").concat(a,"[").concat(l,".y],").concat(a,"[").concat(l,".z]));\n ").concat(e._declareLocalVar(d,dv.Vector4)," = ").concat(this._getTextureGrad(e,r),", vec2").concat(g,"(").concat(this.position.associatedVariableName,"[").concat(u,".y], ").concat(this.position.associatedVariableName,"[").concat(u,".z]), \n vec2").concat(g,"(").concat(o,"[").concat(u,".y],").concat(o,"[").concat(u,".z]),\n vec2").concat(g,"(").concat(a,"[").concat(u,".y],").concat(a,"[").concat(u,".z]));\n \n // blend factors\n ").concat(e._declareLocalVar(p,dv.Vector2)," = vec2").concat(g,"(").concat(s,"[").concat(l,".x],").concat(s,"[").concat(u,".x]);\n // make local support\n ").concat(p," = clamp( (").concat(p,"-0.5773)/(1.0-0.5773), vec2").concat(g,"(0.0), vec2").concat(g,"(1.0) );\n // shape transition\n ").concat(p," = pow( ").concat(p,", vec2").concat(g,"(").concat(i,"/8.0) );\n // blend and return\n ").concat(e._declareLocalVar(this._tempTextureRead,dv.Vector4)," = (").concat(h,"*").concat(p,".x + ").concat(d,"*").concat(p,".y) / (").concat(p,".x + ").concat(p,".y);\n ")},t}(hP);(0,h.Y5)("BABYLON.BiPlanarBlock",dP);var pP=function(e){function t(t){var n=e.call(this,t,pv.Neutral)||this;return n.registerInput("input",dv.Matrix),n.registerOutput("output",dv.Float),n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"MatrixDeterminantBlock"},Object.defineProperty(t.prototype,"input",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(t){e.prototype._buildBlock.call(this,t);var n=this.output,r=this.input;return t.compilationString+=t._declareOutput(n)+" = determinant(".concat(r.associatedVariableName,");\n"),this},t}(Cv);(0,h.Y5)("BABYLON.MatrixDeterminantBlock",pP);var fP,mP=function(e){function t(t){var n=e.call(this,t,pv.Neutral)||this;return n.registerInput("input",dv.Matrix),n.registerOutput("output",dv.Matrix),n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"MatrixTransposeBlock"},Object.defineProperty(t.prototype,"input",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(t){e.prototype._buildBlock.call(this,t);var n=this.output,r=this.input;return t.compilationString+=t._declareOutput(n)+" = transpose(".concat(r.associatedVariableName,");\n"),this},t}(Cv);(0,h.Y5)("BABYLON.MatrixTransposeBlock",mP),function(e){e[e.None=0]="None",e[e.Normal=1]="Normal",e[e.Tangent=2]="Tangent",e[e.VertexColor=3]="VertexColor",e[e.UV1=4]="UV1",e[e.UV2=5]="UV2",e[e.UV3=6]="UV3",e[e.UV4=7]="UV4",e[e.UV5=8]="UV5",e[e.UV6=9]="UV6"}(fP||(fP={}));var _P,gP=function(e){function t(t){var n=e.call(this,t,pv.Neutral)||this;return n.attributeType=0,n.registerInput("input",dv.AutoDetect),n.registerInput("fallback",dv.AutoDetect),n.registerOutput("output",dv.BasedOnInput),n._outputs[0]._typeConnectionSource=n._inputs[0],n._linkConnectionTypes(0,1),n._inputs[0].onConnectionObservable.add((function(e){var t;if(!n.attributeType){var r=e.ownerBlock;if(r instanceof Lv&&r.isAttribute)switch(r.name){case"color":n.attributeType=3;break;case"normal":n.attributeType=1;break;case"tangent":n.attributeType=2;break;case"uv":n.attributeType=4;break;case"uv2":n.attributeType=5;break;case"uv3":n.attributeType=6;break;case"uv4":n.attributeType=7;break;case"uv5":n.attributeType=8;break;case"uv6":n.attributeType=9}else if(r instanceof wT)switch(null===(t=n.input.connectedPoint)||void 0===t?void 0:t.name){case"normalOutput":n.attributeType=1;break;case"tangentOutput":n.attributeType=2;break;case"uvOutput":n.attributeType=4;break;case"uv2Output":n.attributeType=5}}})),n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"MeshAttributeExistsBlock"},Object.defineProperty(t.prototype,"input",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fallback",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(t){e.prototype._buildBlock.call(this,t);var n=null;switch(this.attributeType){case 3:n="VERTEXCOLOR_NME";break;case 1:n="NORMAL";break;case 2:n="TANGENT";break;case 4:n="UV1";break;case 5:n="UV2";break;case 6:n="UV3";break;case 7:n="UV4";break;case 8:n="UV5";break;case 9:n="UV6"}var r=t._declareOutput(this.output);return n&&(t.compilationString+="#ifdef ".concat(n,"\n")),t.compilationString+="".concat(r," = ").concat(this.input.associatedVariableName,";\n"),n&&(t.compilationString+="#else\n",t.compilationString+="".concat(r," = ").concat(this.fallback.associatedVariableName,";\n"),t.compilationString+="#endif\n"),this},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.attributeType=this.attributeType,t},t.prototype._deserialize=function(t,n,r){var i;e.prototype._deserialize.call(this,t,n,r),this.attributeType=null!==(i=t.attributeType)&&void 0!==i?i:0},t.prototype._dumpPropertiesCode=function(){return e.prototype._dumpPropertiesCode.call(this)+"".concat(this._codeVariableName,".attributeType = ").concat(this.attributeType,";\n")},(0,f.Cg)([Jp("Attribute lookup",5,void 0,{notifiers:{update:!0},embedded:!0,options:[{label:"(None)",value:0},{label:"Normal",value:1},{label:"Tangent",value:2},{label:"Vertex Color",value:3},{label:"UV1",value:4},{label:"UV2",value:5},{label:"UV3",value:6},{label:"UV4",value:7},{label:"UV5",value:8},{label:"UV6",value:9}]})],t.prototype,"attributeType",void 0),t}(Cv);(0,h.Y5)("BABYLON.MeshAttributeExistsBlock",gP),function(e){e[e.EaseInSine=0]="EaseInSine",e[e.EaseOutSine=1]="EaseOutSine",e[e.EaseInOutSine=2]="EaseInOutSine",e[e.EaseInQuad=3]="EaseInQuad",e[e.EaseOutQuad=4]="EaseOutQuad",e[e.EaseInOutQuad=5]="EaseInOutQuad",e[e.EaseInCubic=6]="EaseInCubic",e[e.EaseOutCubic=7]="EaseOutCubic",e[e.EaseInOutCubic=8]="EaseInOutCubic",e[e.EaseInQuart=9]="EaseInQuart",e[e.EaseOutQuart=10]="EaseOutQuart",e[e.EaseInOutQuart=11]="EaseInOutQuart",e[e.EaseInQuint=12]="EaseInQuint",e[e.EaseOutQuint=13]="EaseOutQuint",e[e.EaseInOutQuint=14]="EaseInOutQuint",e[e.EaseInExpo=15]="EaseInExpo",e[e.EaseOutExpo=16]="EaseOutExpo",e[e.EaseInOutExpo=17]="EaseInOutExpo",e[e.EaseInCirc=18]="EaseInCirc",e[e.EaseOutCirc=19]="EaseOutCirc",e[e.EaseInOutCirc=20]="EaseInOutCirc",e[e.EaseInBack=21]="EaseInBack",e[e.EaseOutBack=22]="EaseOutBack",e[e.EaseInOutBack=23]="EaseInOutBack",e[e.EaseInElastic=24]="EaseInElastic",e[e.EaseOutElastic=25]="EaseOutElastic",e[e.EaseInOutElastic=26]="EaseInOutElastic"}(_P||(_P={}));var vP=function(e){function t(t){var n=e.call(this,t,pv.Neutral)||this;return n.type=_P.EaseInOutSine,n.registerInput("input",dv.AutoDetect),n.registerOutput("output",dv.BasedOnInput),n._outputs[0]._typeConnectionSource=n._inputs[0],n._inputs[0].excludedConnectionPointTypes.push(dv.Matrix),n._inputs[0].excludedConnectionPointTypes.push(dv.Object),n._inputs[0].excludedConnectionPointTypes.push(dv.Int),n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"CurveBlock"},Object.defineProperty(t.prototype,"input",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype._duplicateEntry=function(e,t){return"ret.".concat(t," = ").concat(e.replace(/VAL/g,"v."+t))},t.prototype._duplicateEntryDirect=function(e){return"return ".concat(e.replace(/VAL/g,"v"))},t.prototype._duplicateVector=function(e,t,n){if("float"===t||"f32"===t)return this._duplicateEntryDirect(e);for(var r=parseInt(t.replace("vec","")),i=n?"\n var ret: vec".concat(r,"f = vec").concat(r,"f(0.0);\n "):"\n vec".concat(r," ret = vec").concat(r,"(0.0);\n "),o=1;o<=r;o++)i+=this._duplicateEntry(e,1===o?"x":2===o?"y":3===o?"z":"w")+";\n";return i+"return ret;\n"},t.prototype._buildBlock=function(t){e.prototype._buildBlock.call(this,t);var n,r=this._outputs[0],i="",o=t._getShaderType(this.input.type),a=1===t.shaderLanguage;switch(n=_P[this.type]+"_"+o.replace("<","").replace(">",""),this.type){case _P.EaseInSine:i="return 1.0 - cos((v * 3.1415) / 2.0)";break;case _P.EaseOutSine:i="return sin((v * 3.1415) / 2.0)";break;case _P.EaseInOutSine:i="return -(cos(v * 3.1415) - 1.0) / 2.0";break;case _P.EaseInQuad:i="return v * v";break;case _P.EaseOutQuad:i="return (1.0 - v) * (1.0 - v)";break;case _P.EaseInOutQuad:var s=t._generateTernary("2.0 * VAL * VAL","1.0 - pow(-2.0 * VAL + 2.0, 2.0) / 2.0","VAL < 0.5");i=this._duplicateVector(s,o,a);break;case _P.EaseInCubic:i="return v * v * v";break;case _P.EaseOutCubic:s="1.0 - pow(1.0 - VAL, 3.0)",i=this._duplicateVector(s,o,a);break;case _P.EaseInOutCubic:s=t._generateTernary("4.0 * VAL * VAL * VAL","1.0 - pow(-2.0 * VAL + 2.0, 3.0) / 2.0","VAL < 0.5"),i=this._duplicateVector(s,o,a);break;case _P.EaseInQuart:i="return v * v * v * v";break;case _P.EaseOutQuart:s="1.0 - pow(1.0 - VAL, 4.0)",i=this._duplicateVector(s,o,a);break;case _P.EaseInOutQuart:s=t._generateTernary("8.0 * VAL * VAL * VAL * VAL","1.0 - pow(-2.0 * VAL + 2.0, 4.0) / 2.0","VAL < 0.5"),i=this._duplicateVector(s,o,a);break;case _P.EaseInQuint:i="return v * v * v * v * v";break;case _P.EaseOutQuint:s="1.0 - pow(1.0 - VAL, 5.0)",i=this._duplicateVector(s,o,a);break;case _P.EaseInOutQuint:s=t._generateTernary("16.0 * VAL * VAL * VAL * VAL * VAL","1.0 - pow(-2.0 * VAL + 2.0, 5.0) / 2.0","VAL < 0.5"),i=this._duplicateVector(s,o,a);break;case _P.EaseInExpo:s=t._generateTernary("0.0","pow(2.0, 10.0 * VAL - 10.0)","VAL == 0.0"),i=this._duplicateVector(s,o,a);break;case _P.EaseOutExpo:s=t._generateTernary("1.0","1.0 - pow(2.0, -10.0 * VAL)","VAL == 1.0"),i=this._duplicateVector(s,o,a);break;case _P.EaseInOutExpo:s=t._generateTernary("0.0",t._generateTernary("1.0",t._generateTernary("pow(2.0, 20.0 * VAL - 10.0) / 2.0","(2.0 - pow(2.0, -20.0 * VAL + 10.0)) / 2.0","VAL < 0.5"),"VAL == 1.0"),"VAL == 0.0"),i=this._duplicateVector(s,o,a);break;case _P.EaseInCirc:s="1.0 - sqrt(1.0 - pow(VAL, 2.0))",i=this._duplicateVector(s,o,a);break;case _P.EaseOutCirc:s="sqrt(1.0 - pow(VAL - 1.0, 2.0))",i=this._duplicateVector(s,o,a);break;case _P.EaseInOutCirc:s=t._generateTernary("(1.0 - sqrt(1.0 - pow(2.0 * VAL, 2.0))) / 2.0","(sqrt(1.0 - pow(-2.0 * VAL + 2.0, 2.0)) + 1.0) / 2.0","VAL < 0.5"),i=this._duplicateVector(s,o,a);break;case _P.EaseInBack:i="return 2.70158 * v * v * v - 1.70158 * v * v";break;case _P.EaseOutBack:s="2.70158 * pow(VAL - 1.0, 3.0) + 1.70158 * pow(VAL - 1.0, 2.0)",i=this._duplicateVector(s,o,a);break;case _P.EaseInOutBack:s=t._generateTernary("(pow(2.0 * VAL, 2.0) * ((3.5949095) * 2.0 * VAL - 2.5949095)) / 2.0","(pow(2.0 * VAL - 2.0, 2.0) * (3.5949095 * (VAL * 2.0 - 2.0) + 3.5949095) + 2.0) / 2.0","VAL < 0.5"),i=this._duplicateVector(s,o,a);break;case _P.EaseInElastic:s=t._generateTernary("0.0",t._generateTernary("1.0","-pow(2.0, 10.0 * VAL - 10.0) * sin((VAL * 10.0 - 10.75) * ((2.0 * 3.1415) / 3.0))","VAL == 1.0"),"VAL == 0.0"),i=this._duplicateVector(s,o,a);break;case _P.EaseOutElastic:s=t._generateTernary("0.0",t._generateTernary("1.0","pow(2.0, -10.0 * VAL) * sin((VAL * 10.0 - 0.75) * ((2.0 * 3.1415) / 3.0)) + 1.0","VAL == 1.0"),"VAL == 0.0"),i=this._duplicateVector(s,o,a);break;case _P.EaseInOutElastic:s=t._generateTernary("0.0",t._generateTernary("1.0",t._generateTernary("-(pow(2.0, 20.0 * VAL - 10.0) * sin((20.0 * VAL - 11.125) * ((2.0 * 3.1415) / 4.5))) / 2.0","(pow(2.0, -20.0 * VAL + 10.0) * sin((20.0 * VAL - 11.125) * ((2.0 * 3.1415) / 4.5))) / 2.0 + 1.0","VAL < 0.5"),"VAL == 1.0"),"VAL == 0.0"),i=this._duplicateVector(s,o,a)}return a?t._emitFunction(n,"fn ".concat(n,"(v: ").concat(o,") -> ").concat(o," {").concat(i,";}\n"),""):t._emitFunction(n,"".concat(o," ").concat(n,"(").concat(o," v) {").concat(i,";}\n"),""),t.compilationString+=t._declareOutput(r)+" = ".concat(n,"(").concat(this.input.associatedVariableName,");\n"),this},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.curveType=this.type,t},t.prototype._deserialize=function(t,n,r){e.prototype._deserialize.call(this,t,n,r),this.type=t.curveType},t.prototype._dumpPropertiesCode=function(){return e.prototype._dumpPropertiesCode.call(this)+"".concat(this._codeVariableName,".type = BABYLON.CurveBlockTypes.").concat(_P[this.type],";\n")},(0,f.Cg)([Jp("Type",5,"ADVANCED",{notifiers:{rebuild:!0},embedded:!0,options:[{label:"EaseInSine",value:_P.EaseInSine},{label:"EaseOutSine",value:_P.EaseOutSine},{label:"EaseInOutSine",value:_P.EaseInOutSine},{label:"EaseInQuad",value:_P.EaseInQuad},{label:"EaseOutQuad",value:_P.EaseOutQuad},{label:"EaseInOutQuad",value:_P.EaseInOutQuad},{label:"EaseInCubic",value:_P.EaseInCubic},{label:"EaseOutCubic",value:_P.EaseOutCubic},{label:"EaseInOutCubic",value:_P.EaseInOutCubic},{label:"EaseInQuart",value:_P.EaseInQuart},{label:"EaseOutQuart",value:_P.EaseOutQuart},{label:"EaseInOutQuart",value:_P.EaseInOutQuart},{label:"EaseInQuint",value:_P.EaseInQuint},{label:"EaseOutQuint",value:_P.EaseOutQuint},{label:"EaseInOutQuint",value:_P.EaseInOutQuint},{label:"EaseInExpo",value:_P.EaseInExpo},{label:"EaseOutExpo",value:_P.EaseOutExpo},{label:"EaseInOutExpo",value:_P.EaseInOutExpo},{label:"EaseInCirc",value:_P.EaseInCirc},{label:"EaseOutCirc",value:_P.EaseOutCirc},{label:"EaseInOutCirc",value:_P.EaseInOutCirc},{label:"EaseInBack",value:_P.EaseInBack},{label:"EaseOutBack",value:_P.EaseOutBack},{label:"EaseInOutBack",value:_P.EaseInOutBack},{label:"EaseInElastic",value:_P.EaseInElastic},{label:"EaseOutElastic",value:_P.EaseOutElastic},{label:"EaseInOutElastic",value:_P.EaseInOutElastic}]})],t.prototype,"type",void 0),t}(Cv);(0,h.Y5)("BABYLON.CurveBlock",vP);var yP=function(e){function t(t){var n=e.call(this,t,pv.Neutral)||this;return n.registerInput("rgb ",dv.Color3,!0),n.registerInput("hsl ",dv.Color3,!0),n.registerOutput("rgb",dv.Color3),n.registerOutput("hsl",dv.Color3),n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"ColorConverterBlock"},Object.defineProperty(t.prototype,"rgbIn",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hslIn",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rgbOut",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hslOut",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),t.prototype._inputRename=function(e){return"rgb "===e?"rgbIn":"hsl "===e?"hslIn":e},t.prototype._outputRename=function(e){return"rgb"===e?"rgbOut":"hsl"===e?"hslOut":e},t.prototype._buildBlock=function(t){e.prototype._buildBlock.call(this,t);var n=this.rgbIn,r=this.hslIn,i=this._outputs[0],o=this._outputs[1],a=t._getShaderType(dv.Vector3),s="\n vec3 rgb2hsl(vec3 color) {\n float r = color.r;\n float g = color.g;\n float b = color.b;\n\n float maxc = max(r, max(g, b));\n float minc = min(r, min(g, b));\n float h = 0.0;\n float s = 0.0;\n float l = (maxc + minc) / 2.0;\n\n if (maxc != minc) {\n float d = maxc - minc;\n if (l > 0.5) {\n s = d / (2.0 - maxc - minc);\n } else {\n s = d / (maxc + minc);\n }\n\n if (maxc == r) {\n float add = 0.0;\n if (g < b) {\n add = 6.0;\n }\n h = (g - b) / d + add;\n } else if (maxc == g) {\n h = (b - r) / d + 2.0;\n } else if (maxc == b) {\n h = (r - g) / d + 4.0;\n }\n h /= 6.0;\n }\n\n return vec3(h, s, l);\n }",l="\n float hue2rgb(float p, float q, float tt) {\n float t = tt;\n if (t < 0.0) {\n t += 1.0;\n }\n if (t > 1.0) {\n t -= 1.0;\n }\n if (t < 1.0/6.0) {\n return p + (q - p) * 6.0 * t;\n }\n if (t < 1.0/2.0) {\n return q;\n }\n if (t < 2.0/3.0) {\n return p + (q - p) * (2.0/3.0 - t) * 6.0;\n }\n return p;\n }",c="\n vec3 hsl2rgb(vec3 hsl) {\n float h = hsl.x;\n float s = hsl.y;\n float l = hsl.z;\n\n float r;\n float g;\n float b;\n\n if (s == 0.0) {\n // Achromatic (grey)\n r = l;\n g = l;\n b = l; \n } else {\n float q;\n \n if (l < 0.5) {\n q = l * (1.0 + s);\n } else {\n q = (l + s - l * s);\n }\n\n float p = 2.0 * l - q;\n\n r = hue2rgb(p, q, h + 1.0/3.0);\n g = hue2rgb(p, q, h);\n b = hue2rgb(p, q, h - 1.0/3.0);\n }\n\n return vec3(r, g, b);\n }";return 1===t.shaderLanguage&&(s=t._babylonSLtoWGSL(s),l=t._babylonSLtoWGSL(l),c=t._babylonSLtoWGSL(c)),t._emitFunction("rgb2hsl",s,""),t._emitFunction("hue2rgb",l,""),t._emitFunction("hsl2rgb",c,""),n.isConnected?(i.hasEndpoints&&(t.compilationString+=t._declareOutput(i)+" = ".concat(n.associatedVariableName,";\n")),o.hasEndpoints&&(t.compilationString+=t._declareOutput(o)+" = rgb2hsl(".concat(n.associatedVariableName,");\n"))):r.isConnected?(i.hasEndpoints&&(t.compilationString+=t._declareOutput(i)+" = hsl2rgb(".concat(r.associatedVariableName,");\n")),o.hasEndpoints&&(t.compilationString+=t._declareOutput(o)+" = ".concat(r.associatedVariableName,";\n"))):(i.hasEndpoints&&(t.compilationString+=t._declareOutput(i)+" = ".concat(a,"(0.);\n")),o.hasEndpoints&&(t.compilationString+=t._declareOutput(o)+" = ".concat(a,"(0.);\n"))),this},t}(Cv);(0,h.Y5)("BABYLON.ColorConverterBlock",yP);var bP=function(e){function t(n){var r=e.call(this,n,pv.Neutral)||this;return r.iterations=4,r.registerInput("input",dv.AutoDetect),r.registerInput("iterations",dv.Float,!0),r.registerOutput("output",dv.BasedOnInput),r.registerOutput("index",dv.Float,pv.Fragment),r.registerOutput("loopID",dv.Object,void 0,new _T("loopID",r,1,t,"LoopBlock")),r._outputs[0]._typeConnectionSource=r._inputs[0],r._outputs[0]._forPostBuild=!0,r._outputs[2]._redirectedSource=r._inputs[0],r._outputs[1]._preventBubbleUp=!0,r._outputs[2]._preventBubbleUp=!0,r}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"LoopBlock"},Object.defineProperty(t.prototype,"input",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"iterationsInput",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"index",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loopID",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(t){e.prototype._buildBlock.call(this,t);var n=this._outputs[0],r=this._outputs[1],i=t._getFreeVariableName("index"),o=1===t.shaderLanguage?"var":"int",a=1===t.shaderLanguage?"f32":"float",s=1===t.shaderLanguage?"i32":"int";t.compilationString+=t._declareOutput(n)+" = ".concat(this.input.associatedVariableName,";\n");var l=this.iterationsInput.isConnected?"".concat(s,"(").concat(this.iterationsInput.associatedVariableName,")"):this.iterations;return t.compilationString+="for (".concat(o," ").concat(i," = 0; ").concat(i," < ").concat(l,"; ").concat(i,"++){\n"),t.compilationString+="".concat(t._declareOutput(r)," = ").concat(a,"(").concat(i,");\n"),this},t.prototype._postBuildBlock=function(t){return e.prototype._postBuildBlock.call(this,t),t.compilationString+="}\n",this},t.prototype._dumpPropertiesCode=function(){return e.prototype._dumpPropertiesCode.call(this)+"".concat(this._codeVariableName,".iterations = ").concat(this.iterations,";\n")},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.iterations=this.iterations,t},t.prototype._deserialize=function(t,n,r){e.prototype._deserialize.call(this,t,n,r),this.iterations=t.iterations},(0,f.Cg)([Jp("Iterations",2,void 0,{embedded:!0})],t.prototype,"iterations",void 0),t}(Cv);(0,h.Y5)("BABYLON.LoopBlock",bP);var SP=function(e){function t(t){var n=e.call(this,t,pv.Neutral)||this;return n.registerInput("loopID",dv.Object,!1,void 0,new _T("loopID",n,0,bP,"LoopBlock")),n.registerOutput("value",dv.AutoDetect),n._outputs[0]._linkedConnectionSource=n._inputs[0],n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"StorageReadBlock"},Object.defineProperty(t.prototype,"loopID",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(t){e.prototype._buildBlock.call(this,t);var n=this.value;if(!this.loopID.isConnected)return this;var r=this.loopID.connectedPoint.ownerBlock;return t.compilationString+=t._declareOutput(n)+" = ".concat(r.output.associatedVariableName,";\n"),this},t}(Cv);(0,h.Y5)("BABYLON.StorageReadBlock",SP);var TP=function(e){function t(t){var n=e.call(this,t,pv.Neutral)||this;return n.registerInput("loopID",dv.Object,!1,void 0,new _T("loopID",n,0,bP,"LoopBlock")),n.registerInput("value",dv.AutoDetect),n._linkConnectionTypes(0,1),n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"StorageWriteBlock"},Object.defineProperty(t.prototype,"loopID",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),t.prototype.isConnectedInFragmentShader=function(){return!!this.loopID.isConnected&&this.loopID.connectedPoint.ownerBlock.output.isConnectedInFragmentShader},t.prototype._buildBlock=function(t){e.prototype._buildBlock.call(this,t);var n=this.value;if(!this.loopID.isConnected)return this;var r=this.loopID.connectedPoint.ownerBlock;return t.compilationString+="".concat(r.output.associatedVariableName," = ").concat(n.associatedVariableName,";\n"),this},t}(Cv);(0,h.Y5)("BABYLON.StorageWriteBlock",TP);var EP=function(e){function t(t){var n=e.call(this,t,pv.Neutral)||this;return n.registerInput("input",dv.Matrix),n.registerOutput("row0",dv.Vector4),n.registerOutput("row1",dv.Vector4),n.registerOutput("row2",dv.Vector4),n.registerOutput("row3",dv.Vector4),n.registerOutput("col0",dv.Vector4),n.registerOutput("col1",dv.Vector4),n.registerOutput("col2",dv.Vector4),n.registerOutput("col3",dv.Vector4),n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"MatrixSplitterBlock"},Object.defineProperty(t.prototype,"input",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"row0",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"row1",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"row2",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"row3",{get:function(){return this._outputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"col0",{get:function(){return this._outputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"col1",{get:function(){return this._outputs[5]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"col2",{get:function(){return this._outputs[6]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"col3",{get:function(){return this._outputs[7]},enumerable:!1,configurable:!0}),t.prototype._exportColumn=function(e,t,n,r){var i=1===e.shaderLanguage?"vec4f":"vec4";e.compilationString+=e._declareOutput(t)+" = ".concat(i,"(").concat(n,"[0][").concat(r,"], ").concat(n,"[1][").concat(r,"], ").concat(n,"[2][").concat(r,"], ").concat(n,"[3][").concat(r,"]);\n")},t.prototype._buildBlock=function(t){e.prototype._buildBlock.call(this,t);var n=this._inputs[0].associatedVariableName,r=this.row0,i=this.row1,o=this.row2,a=this.row3,s=this.col0,l=this.col1,c=this.col2,u=this.col3;return r.hasEndpoints&&(t.compilationString+=t._declareOutput(r)+" = ".concat(n,"[0];\n")),i.hasEndpoints&&(t.compilationString+=t._declareOutput(i)+" = ".concat(n,"[1];\n")),o.hasEndpoints&&(t.compilationString+=t._declareOutput(o)+" = ".concat(n,"[2];\n")),a.hasEndpoints&&(t.compilationString+=t._declareOutput(a)+" = ".concat(n,"[3];\n")),s.hasEndpoints&&this._exportColumn(t,s,n,0),l.hasEndpoints&&this._exportColumn(t,l,n,1),c.hasEndpoints&&this._exportColumn(t,c,n,2),u.hasEndpoints&&this._exportColumn(t,u,n,3),this},t}(Cv);(0,h.Y5)("BABYLON.MatrixSplitterBlock",EP);var xP="gaussianSplattingVertexDeclaration",PP="attribute position: vec2f;\n";Bi.l.IncludesShadersStoreWGSL[xP]||(Bi.l.IncludesShadersStoreWGSL[xP]=PP);var CP={name:xP,shader:PP},RP=function(e){function t(t){var n=e.call(this,t,pv.Fragment,!0,!0)||this;return n._isActive=!1,n.renderAlpha=!1,n.registerInput("debug",dv.AutoDetect,!0),n.debug.excludedConnectionPointTypes.push(dv.Matrix),n}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"isActive",{get:function(){return this._isActive&&this.debug.isConnected},set:function(e){this._isActive!==e&&(this._isActive=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_isFinalOutputAndActive",{get:function(){return this.isActive},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_hasPrecedence",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"debug",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"NodeMaterialDebugBlock"},t.prototype._buildBlock=function(t){if(e.prototype._buildBlock.call(this,t),!this._isActive)return this;var n="gl_FragColor";1===t.shaderLanguage&&(n="fragmentOutputs.color");var r=this.debug;return r.connectedPoint?(r.connectedPoint.type===dv.Float?t.compilationString+="".concat(n," = vec4").concat(t.fSuffix,"(").concat(r.associatedVariableName,", ").concat(r.associatedVariableName,", ").concat(r.associatedVariableName,", 1.0);\n"):r.connectedPoint.type===dv.Vector2?t.compilationString+="".concat(n," = vec4").concat(t.fSuffix,"(").concat(r.associatedVariableName,", 0., 1.0);\n"):r.connectedPoint.type===dv.Color3||r.connectedPoint.type===dv.Vector3?t.compilationString+="".concat(n," = vec4").concat(t.fSuffix,"(").concat(r.associatedVariableName,", 1.0);\n"):this.renderAlpha?t.compilationString+="".concat(n," =").concat(r.associatedVariableName,";\n"):t.compilationString+="".concat(n," = vec4").concat(t.fSuffix,"(").concat(r.associatedVariableName,".rgb, 1.0);\n"),this):this},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.isActive=this._isActive,t.renderAlpha=this.renderAlpha,t},t.prototype._deserialize=function(t,n,r){e.prototype._deserialize.call(this,t,n,r),this.isActive=t.isActive,this.renderAlpha=t.renderAlpha},(0,f.Cg)([Jp("Render Alpha",0,void 0)],t.prototype,"renderAlpha",void 0),t}(Cv);(0,h.Y5)("BABYLON.NodeMaterialDebugBlock",RP);var AP,IP=function(){function e(){}return e.prototype.optimize=function(e,t){},e}();!function(e){e[e.Created=1]="Created",e[e.Disposed=2]="Disposed",e[e.GetDefineNames=4]="GetDefineNames",e[e.PrepareUniformBuffer=8]="PrepareUniformBuffer",e[e.IsReadyForSubMesh=16]="IsReadyForSubMesh",e[e.PrepareDefines=32]="PrepareDefines",e[e.BindForSubMesh=64]="BindForSubMesh",e[e.PrepareEffect=128]="PrepareEffect",e[e.GetAnimatables=256]="GetAnimatables",e[e.GetActiveTextures=512]="GetActiveTextures",e[e.HasTexture=1024]="HasTexture",e[e.FillRenderTargetTextures=2048]="FillRenderTargetTextures",e[e.HasRenderTargetTextures=4096]="HasRenderTargetTextures",e[e.HardBindForSubMesh=8192]="HardBindForSubMesh"}(AP||(AP={}));var OP=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.DECAL=!1,t.DECALDIRECTUV=0,t.DECAL_SMOOTHALPHA=!1,t.GAMMADECAL=!1,t}return(0,f.C6)(t,e),t}(ho),MP=function(e){function t(t,n){void 0===n&&(n=!0);var r=e.call(this,t,"DecalMap",150,new OP,n)||this;return r._isEnabled=!1,r.isEnabled=!1,r._smoothAlpha=!1,r.smoothAlpha=!1,r.registerForExtraEvents=!0,r._internalMarkAllSubMeshesAsTexturesDirty=t._dirtyCallbacks[b.Y.MATERIAL_TextureDirtyFlag],r}return(0,f.C6)(t,e),t.prototype._markAllSubMeshesAsTexturesDirty=function(){this._enable(this._isEnabled),this._internalMarkAllSubMeshesAsTexturesDirty()},t.prototype.isCompatible=function(){return!0},t.prototype.isReadyForSubMesh=function(e,t,n,r){var i=r.getMesh().decalMap;return!(this._isEnabled&&(null==i?void 0:i.texture)&&_o.h.DecalMapEnabled&&t.texturesEnabled)||i.isReady()},t.prototype.prepareDefinesBeforeAttributes=function(e,t,n){var r=n.decalMap;this._isEnabled&&(null==r?void 0:r.texture)&&_o.h.DecalMapEnabled&&t.texturesEnabled?((!e.DECAL||e.GAMMADECAL!==r.texture.gammaSpace)&&e.markAsTexturesDirty(),e.DECAL=!0,e.GAMMADECAL=r.texture.gammaSpace,e.DECAL_SMOOTHALPHA=this._smoothAlpha,(0,Le.YT)(r.texture,e,"DECAL")):(e.DECAL&&e.markAsTexturesDirty(),e.DECAL=!1)},t.prototype.hardBindForSubMesh=function(e,t,n,r){var i=r.getMesh().decalMap;if(this._isEnabled&&(null==i?void 0:i.texture)&&_o.h.DecalMapEnabled&&t.texturesEnabled){var o=this._material.isFrozen,a=i.texture;e.useUbo&&o&&e.isSync||(e.updateFloat4("vDecalInfos",a.coordinatesIndex,0,0,0),(0,Le.mA)(a,e,"decal")),e.setTexture("decalSampler",a)}},t.prototype.getClassName=function(){return"DecalMapConfiguration"},t.prototype.getSamplers=function(e){e.push("decalSampler")},t.prototype.getUniforms=function(){return{ubo:[{name:"vDecalInfos",size:4,type:"vec4"},{name:"decalMatrix",size:16,type:"mat4"}]}},(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"isEnabled",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"smoothAlpha",void 0),t}(Ro);function DP(e){return e instanceof gg?new ug(e):null}function NP(e){return e instanceof gg?new ig(e):null}function FP(e){return e instanceof gg?new ag(e):null}function LP(e){return e instanceof gg?new lg(e):null}function wP(e){return e instanceof gg?new dg(e):null}function BP(e){return e instanceof gg?new fg(e):null}function VP(e){return e instanceof gg||e instanceof Bo?new Oo(e):null}(0,h.Y5)("BABYLON.DecalMapConfiguration",MP);var UP=function(){function e(){}return e.DEFAULT_COLOR=u.v9.White(),e.DEFAULT_WIDTH_ATTENUATED=1,e.DEFAULT_WIDTH=.1,e}(),GP=function(){function e(){}return e.ConvertPoints=function(e,t){if(e.length&&Array.isArray(e)&&"number"==typeof e[0])return[e];if(e.length&&Array.isArray(e[0])&&"number"==typeof e[0][0])return e;if(e.length&&!Array.isArray(e[0])&&e[0]instanceof c.Pq){for(var n=[],r=0;r0&&Array.isArray(e[0])&&e[0].length>0&&e[0][0]instanceof c.Pq){n=[];for(var o=0,a=e;o0&&r.push([e,t]),n.subtract(t).lengthSquared()>0&&r.push([t,n]),e.subtract(n).lengthSquared()>0&&r.push([n,e]),0===r.length?null:r},e.OmitDuplicatesPredicate=function(t,n,r,i){var o=[];return e._SearchInPoints(t,n,i)||o.push([t,n]),e._SearchInPoints(n,r,i)||o.push([n,r]),e._SearchInPoints(r,t,i)||o.push([r,t]),0===o.length?null:o},e._SearchInPoints=function(e,t,n){for(var r,i,o,a=0,s=n;an)for(var s=0,l=e.SegmentizeSegmentByCount(a.point1,a.point2,Math.ceil(a.length/n));sa?a:n.length,l=Math.ceil(n.length/a);l>1&&(n=(0,f.fX)((0,f.fX)([],n,!0),Array(s*l-n.length).fill(n[0]),!0));var c=e.Color3toRGBAUint8(n),u=new gn(c,s,l,Ai.N.TEXTUREFORMAT_RGBA,i,!1,!0,r);return u.name=t,u},e.PrepareEmptyColorsTexture=function(e){if(!UP.EmptyColorsTexture){var t=new Uint8Array(4);UP.EmptyColorsTexture=new gn(t,1,1,Ai.N.TEXTUREFORMAT_RGBA,e,!1,!1,gn.NEAREST_NEAREST),UP.EmptyColorsTexture.name="grlEmptyColorsTexture"}return UP.EmptyColorsTexture},e.DisposeEmptyColorsTexture=function(){var e;null===(e=UP.EmptyColorsTexture)||void 0===e||e.dispose(),UP.EmptyColorsTexture=null},e.BooleanToNumber=function(e){return e?1:0},e}(),kP=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.GREASED_LINE_HAS_COLOR=!1,t.GREASED_LINE_SIZE_ATTENUATION=!1,t.GREASED_LINE_COLOR_DISTRIBUTION_TYPE_LINE=!1,t.GREASED_LINE_RIGHT_HANDED_COORDINATE_SYSTEM=!1,t.GREASED_LINE_CAMERA_FACING=!0,t.GREASED_LINE_USE_OFFSETS=!1,t}return(0,f.C6)(t,e),t}(ho),zP=function(e){function t(n,r,i){var o,a,s,l,u,h,d,p,f,m,_,g,v,y,b,S,T,E=this;i=i||{color:UP.DEFAULT_COLOR};var x=new kP;return x.GREASED_LINE_HAS_COLOR=!!i.color&&!i.useColors,x.GREASED_LINE_SIZE_ATTENUATION=null!==(o=i.sizeAttenuation)&&void 0!==o&&o,x.GREASED_LINE_COLOR_DISTRIBUTION_TYPE_LINE=1===i.colorDistributionType,x.GREASED_LINE_RIGHT_HANDED_COORDINATE_SYSTEM=(null!=r?r:n.getScene()).useRightHandedSystem,x.GREASED_LINE_CAMERA_FACING=null===(a=i.cameraFacing)||void 0===a||a,(E=e.call(this,n,t.GREASED_LINE_MATERIAL_NAME,200,x,!0,!0)||this).colorsTexture=null,E._forceGLSL=!1,E._forceGLSL=(null==i?void 0:i.forceGLSL)||t.ForceGLSL,E._scene=null!=r?r:n.getScene(),E._engine=E._scene.getEngine(),E._cameraFacing=null===(s=i.cameraFacing)||void 0===s||s,E.visibility=null!==(l=i.visibility)&&void 0!==l?l:1,E.useDash=null!==(u=i.useDash)&&void 0!==u&&u,E.dashRatio=null!==(h=i.dashRatio)&&void 0!==h?h:.5,E.dashOffset=null!==(d=i.dashOffset)&&void 0!==d?d:0,E.width=i.width?i.width:i.sizeAttenuation?UP.DEFAULT_WIDTH_ATTENUATED:UP.DEFAULT_WIDTH,E._sizeAttenuation=null!==(p=i.sizeAttenuation)&&void 0!==p&&p,E.colorMode=null!==(f=i.colorMode)&&void 0!==f?f:0,E._color=null!==(m=i.color)&&void 0!==m?m:null,E.useColors=null!==(_=i.useColors)&&void 0!==_&&_,E._colorsDistributionType=null!==(g=i.colorDistributionType)&&void 0!==g?g:0,E.colorsSampling=null!==(v=i.colorsSampling)&&void 0!==v?v:gn.NEAREST_NEAREST,E._colors=null!==(y=i.colors)&&void 0!==y?y:null,E.dashCount=null!==(b=i.dashCount)&&void 0!==b?b:1,E.resolution=null!==(S=i.resolution)&&void 0!==S?S:new c.I9(E._engine.getRenderWidth(),E._engine.getRenderHeight()),i.colorsTexture?E.colorsTexture=i.colorsTexture:E._colors?E.colorsTexture=GP.CreateColorsTexture("".concat(n.name,"-colors-texture"),E._colors,E.colorsSampling,E._scene):(E._color=null!==(T=E._color)&&void 0!==T?T:UP.DEFAULT_COLOR,GP.PrepareEmptyColorsTexture(E._scene)),E._engine.onDisposeObservable.add((function(){GP.DisposeEmptyColorsTexture()})),E}return(0,f.C6)(t,e),t.prototype.isCompatible=function(e){return!0},t.prototype.getAttributes=function(e){e.push("grl_offsets"),e.push("grl_widths"),e.push("grl_colorPointers"),e.push("grl_counters"),this._cameraFacing?(e.push("grl_previousAndSide"),e.push("grl_nextAndCounters")):e.push("grl_slopes")},t.prototype.getSamplers=function(e){e.push("grl_colors")},t.prototype.getActiveTextures=function(e){this.colorsTexture&&e.push(this.colorsTexture)},t.prototype.getUniforms=function(e){void 0===e&&(e=0);var t=[{name:"grl_singleColor",size:3,type:"vec3"},{name:"grl_textureSize",size:2,type:"vec2"},{name:"grl_dashOptions",size:4,type:"vec4"},{name:"grl_colorMode_visibility_colorsWidth_useColors",size:4,type:"vec4"}];return this._cameraFacing&&t.push({name:"grl_projection",size:16,type:"mat4"},{name:"grl_aspect_resolution_lineWidth",size:4,type:"vec4"}),1===e&&t.push({name:"viewProjection",size:16,type:"mat4"}),{ubo:t,vertex:this._cameraFacing&&this._isGLSL(e)?"\n uniform vec4 grl_aspect_resolution_lineWidth;\n uniform mat4 grl_projection;\n ":"",fragment:this._isGLSL(e)?"\n uniform vec4 grl_dashOptions;\n uniform vec2 grl_textureSize;\n uniform vec4 grl_colorMode_visibility_colorsWidth_useColors;\n uniform vec3 grl_singleColor;\n ":""}},Object.defineProperty(t.prototype,"isEnabled",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.bindForSubMesh=function(e){var t,n,r;if(this._cameraFacing){e.updateMatrix("grl_projection",this._scene.getProjectionMatrix()),this._isGLSL(this._material.shaderLanguage)||e.updateMatrix("viewProjection",this._scene.getTransformMatrix());var i=c.AA.Vector4[0];i.x=this._aspect,i.y=this._resolution.x,i.z=this._resolution.y,i.w=this.width,e.updateVector4("grl_aspect_resolution_lineWidth",i)}var o=c.AA.Vector4[0];o.x=GP.BooleanToNumber(this.useDash),o.y=this._dashArray,o.z=this.dashOffset,o.w=this.dashRatio,e.updateVector4("grl_dashOptions",o);var a=c.AA.Vector4[1];a.x=this.colorMode,a.y=this.visibility,a.z=this.colorsTexture?this.colorsTexture.getSize().width:0,a.w=GP.BooleanToNumber(this.useColors),e.updateVector4("grl_colorMode_visibility_colorsWidth_useColors",a),this._color&&e.updateColor3("grl_singleColor",this._color);var s=null!==(t=this.colorsTexture)&&void 0!==t?t:UP.EmptyColorsTexture;e.setTexture("grl_colors",s),e.updateFloat2("grl_textureSize",null!==(n=null==s?void 0:s.getSize().width)&&void 0!==n?n:1,null!==(r=null==s?void 0:s.getSize().height)&&void 0!==r?r:1)},t.prototype.prepareDefines=function(e,t,n){e.GREASED_LINE_HAS_COLOR=!!this.color&&!this.useColors,e.GREASED_LINE_SIZE_ATTENUATION=this._sizeAttenuation,e.GREASED_LINE_COLOR_DISTRIBUTION_TYPE_LINE=1===this._colorsDistributionType,e.GREASED_LINE_RIGHT_HANDED_COORDINATE_SYSTEM=t.useRightHandedSystem,e.GREASED_LINE_CAMERA_FACING=this._cameraFacing,e.GREASED_LINE_USE_OFFSETS=!!n.offsets},t.prototype.getClassName=function(){return t.GREASED_LINE_MATERIAL_NAME},t.prototype.getCustomCode=function(e,t){return void 0===t&&(t=0),this._isGLSL(t)?function(e,t){if("vertex"===e){var n={CUSTOM_VERTEX_DEFINITIONS:"\n attribute float grl_widths;\n attribute vec3 grl_offsets;\n attribute float grl_colorPointers;\n varying float grlCounters;\n varying float grlColorPointer;\n\n #ifdef GREASED_LINE_CAMERA_FACING\n attribute vec4 grl_previousAndSide;\n attribute vec4 grl_nextAndCounters;\n\n vec2 grlFix( vec4 i, float aspect ) {\n vec2 res = i.xy / i.w;\n res.x *= aspect;\n return res;\n }\n #else\n attribute vec3 grl_slopes;\n attribute float grl_counters;\n #endif\n ",CUSTOM_VERTEX_UPDATE_POSITION:"\n #ifdef GREASED_LINE_CAMERA_FACING\n vec3 grlPositionOffset = grl_offsets;\n positionUpdated += grlPositionOffset;\n #else\n positionUpdated = (positionUpdated + grl_offsets) + (grl_slopes * grl_widths);\n #endif\n ",CUSTOM_VERTEX_MAIN_END:"\n grlColorPointer = grl_colorPointers;\n\n #ifdef GREASED_LINE_CAMERA_FACING\n\n float grlAspect = grl_aspect_resolution_lineWidth.x;\n float grlBaseWidth = grl_aspect_resolution_lineWidth.w;\n\n vec3 grlPrevious = grl_previousAndSide.xyz;\n float grlSide = grl_previousAndSide.w;\n\n vec3 grlNext = grl_nextAndCounters.xyz;\n grlCounters = grl_nextAndCounters.w;\n float grlWidth = grlBaseWidth * grl_widths;\n \n vec3 worldDir = normalize(grlNext - grlPrevious);\n vec3 nearPosition = positionUpdated + (worldDir * 0.01);\n mat4 grlMatrix = viewProjection * finalWorld;\n vec4 grlFinalPosition = grlMatrix * vec4(positionUpdated , 1.0);\n vec4 screenNearPos = grlMatrix * vec4(nearPosition, 1.0);\n vec2 grlLinePosition = grlFix(grlFinalPosition, grlAspect);\n vec2 grlLineNearPosition = grlFix(screenNearPos, grlAspect);\n vec2 grlDir = normalize(grlLineNearPosition - grlLinePosition);\n\n vec4 grlNormal = vec4(-grlDir.y, grlDir.x, 0., 1.);\n\n #ifdef GREASED_LINE_RIGHT_HANDED_COORDINATE_SYSTEM\n grlNormal.xy *= -.5 * grlWidth;\n #else\n grlNormal.xy *= .5 * grlWidth;\n #endif\n\n grlNormal *= grl_projection;\n\n #ifdef GREASED_LINE_SIZE_ATTENUATION\n grlNormal.xy *= grlFinalPosition.w;\n grlNormal.xy /= (vec4(grl_aspect_resolution_lineWidth.yz, 0., 1.) * grl_projection).xy;\n #endif\n\n grlFinalPosition.xy += grlNormal.xy * grlSide;\n gl_Position = grlFinalPosition;\n\n vPositionW = vec3(grlFinalPosition);\n #else\n grlCounters = grl_counters;\n #endif\n "};return t&&(n["!gl_Position\\=viewProjection\\*worldPos;"]="//"),n}return"fragment"===e?{CUSTOM_FRAGMENT_DEFINITIONS:"\n #ifdef PBR\n #define grlFinalColor finalColor\n #else\n #define grlFinalColor color\n #endif\n\n varying float grlCounters;\n varying float grlColorPointer;\n uniform sampler2D grl_colors;\n ",CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR:"\n float grlColorMode = grl_colorMode_visibility_colorsWidth_useColors.x;\n float grlVisibility = grl_colorMode_visibility_colorsWidth_useColors.y;\n float grlColorsWidth = grl_colorMode_visibility_colorsWidth_useColors.z;\n float grlUseColors = grl_colorMode_visibility_colorsWidth_useColors.w;\n\n float grlUseDash = grl_dashOptions.x;\n float grlDashArray = grl_dashOptions.y;\n float grlDashOffset = grl_dashOptions.z;\n float grlDashRatio = grl_dashOptions.w;\n\n grlFinalColor.a *= step(grlCounters, grlVisibility);\n if(grlFinalColor.a == 0.) discard;\n\n if(grlUseDash == 1.){\n grlFinalColor.a *= ceil(mod(grlCounters + grlDashOffset, grlDashArray) - (grlDashArray * grlDashRatio));\n if (grlFinalColor.a == 0.) discard;\n }\n\n #ifdef GREASED_LINE_HAS_COLOR\n if (grlColorMode == ".concat(0,".) {\n grlFinalColor.rgb = grl_singleColor;\n } else if (grlColorMode == ").concat(1,".) {\n grlFinalColor.rgb += grl_singleColor;\n } else if (grlColorMode == ").concat(2,".) {\n grlFinalColor.rgb *= grl_singleColor;\n }\n #else\n if (grlUseColors == 1.) {\n #ifdef GREASED_LINE_COLOR_DISTRIBUTION_TYPE_LINE\n vec4 grlColor = texture2D(grl_colors, vec2(grlCounters, 0.), 0.);\n #else\n vec2 lookup = vec2(fract(grlColorPointer / grl_textureSize.x), 1.0 - floor(grlColorPointer / grl_textureSize.x) / max(grl_textureSize.y - 1.0, 1.0));\n vec4 grlColor = texture2D(grl_colors, lookup, 0.0);\n #endif\n if (grlColorMode == ").concat(0,".) {\n grlFinalColor = grlColor;\n } else if (grlColorMode == ").concat(1,".) {\n grlFinalColor += grlColor;\n } else if (grlColorMode == ").concat(2,".) {\n grlFinalColor *= grlColor;\n }\n }\n #endif\n ")}:null}(e,this._cameraFacing):function(e,t){if("vertex"===e){var n={CUSTOM_VERTEX_DEFINITIONS:"\n attribute grl_widths: f32;\n attribute grl_colorPointers: f32;\n varying grlCounters: f32;\n varying grlColorPointer: f32;\n\n #ifdef GREASED_LINE_USE_OFFSETS\n attribute grl_offsets: vec3f; \n #endif\n\n #ifdef GREASED_LINE_CAMERA_FACING\n attribute grl_previousAndSide : vec4f;\n attribute grl_nextAndCounters : vec4f;\n\n fn grlFix(i: vec4f, aspect: f32) -> vec2f {\n var res = i.xy / i.w;\n res.x *= aspect;\n return res;\n }\n #else\n attribute grl_slopes: f32;\n attribute grl_counters: f32;\n #endif\n\n\n ",CUSTOM_VERTEX_UPDATE_POSITION:"\n #ifdef GREASED_LINE_USE_OFFSETS\n var grlPositionOffset: vec3f = input.grl_offsets;\n #else\n var grlPositionOffset = vec3f(0.);\n #endif\n\n #ifdef GREASED_LINE_CAMERA_FACING\n positionUpdated += grlPositionOffset;\n #else\n positionUpdated = (positionUpdated + grlPositionOffset) + (input.grl_slopes * input.grl_widths);\n #endif\n ",CUSTOM_VERTEX_MAIN_END:"\n vertexOutputs.grlColorPointer = input.grl_colorPointers;\n\n #ifdef GREASED_LINE_CAMERA_FACING\n\n let grlAspect: f32 = uniforms.grl_aspect_resolution_lineWidth.x;\n let grlBaseWidth: f32 = uniforms.grl_aspect_resolution_lineWidth.w;\n\n let grlPrevious: vec3f = input.grl_previousAndSide.xyz;\n let grlSide: f32 = input.grl_previousAndSide.w;\n\n let grlNext: vec3f = input.grl_nextAndCounters.xyz;\n vertexOutputs.grlCounters = input.grl_nextAndCounters.w;\n\n let grlWidth: f32 = grlBaseWidth * input.grl_widths;\n\n let worldDir: vec3f = normalize(grlNext - grlPrevious);\n let nearPosition: vec3f = positionUpdated + (worldDir * 0.01);\n let grlMatrix: mat4x4f = uniforms.viewProjection * finalWorld;\n let grlFinalPosition: vec4f = grlMatrix * vec4f(positionUpdated, 1.0); \n let screenNearPos: vec4f = grlMatrix * vec4(nearPosition, 1.0);\n let grlLinePosition: vec2f = grlFix(grlFinalPosition, grlAspect);\n let grlLineNearPosition: vec2f = grlFix(screenNearPos, grlAspect);\n let grlDir: vec2f = normalize(grlLineNearPosition - grlLinePosition);\n\n var grlNormal: vec4f = vec4f(-grlDir.y, grlDir.x, 0.0, 1.0);\n\n let grlHalfWidth: f32 = 0.5 * grlWidth;\n #if defined(GREASED_LINE_RIGHT_HANDED_COORDINATE_SYSTEM)\n grlNormal.x *= -grlHalfWidth;\n grlNormal.y *= -grlHalfWidth;\n #else\n grlNormal.x *= grlHalfWidth;\n grlNormal.y *= grlHalfWidth;\n #endif\n\n grlNormal *= uniforms.grl_projection;\n\n #if defined(GREASED_LINE_SIZE_ATTENUATION)\n grlNormal.x *= grlFinalPosition.w;\n grlNormal.y *= grlFinalPosition.w;\n\n let pr = vec4f(uniforms.grl_aspect_resolution_lineWidth.yz, 0.0, 1.0) * uniforms.grl_projection;\n grlNormal.x /= pr.x;\n grlNormal.y /= pr.y;\n #endif\n\n vertexOutputs.position = vec4f(grlFinalPosition.xy + grlNormal.xy * grlSide, grlFinalPosition.z, grlFinalPosition.w);\n vertexOutputs.vPositionW = vertexOutputs.position.xyz;\n \n #else\n vertexOutputs.grlCounters = input.grl_counters;\n #endif\n "};return t&&(n["!vertexOutputs\\.position\\s=\\sscene\\.viewProjection\\s\\*\\sworldPos;"]="//"),n}return"fragment"===e?{CUSTOM_FRAGMENT_DEFINITIONS:"\n #ifdef PBR\n #define grlFinalColor finalColor\n #else\n #define grlFinalColor color\n #endif\n\n varying grlCounters: f32;\n varying grlColorPointer: 32;\n\n var grl_colors: texture_2d;\n var grl_colorsSampler: sampler;\n ",CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR:"\n let grlColorMode: f32 = uniforms.grl_colorMode_visibility_colorsWidth_useColors.x;\n let grlVisibility: f32 = uniforms.grl_colorMode_visibility_colorsWidth_useColors.y;\n let grlColorsWidth: f32 = uniforms.grl_colorMode_visibility_colorsWidth_useColors.z;\n let grlUseColors: f32 = uniforms.grl_colorMode_visibility_colorsWidth_useColors.w;\n\n let grlUseDash: f32 = uniforms.grl_dashOptions.x;\n let grlDashArray: f32 = uniforms.grl_dashOptions.y;\n let grlDashOffset: f32 = uniforms.grl_dashOptions.z;\n let grlDashRatio: f32 = uniforms.grl_dashOptions.w;\n\n grlFinalColor.a *= step(fragmentInputs.grlCounters, grlVisibility);\n if (grlFinalColor.a == 0.0) {\n discard;\n }\n\n if (grlUseDash == 1.0) {\n let dashPosition = (fragmentInputs.grlCounters + grlDashOffset) % grlDashArray;\n grlFinalColor.a *= ceil(dashPosition - (grlDashArray * grlDashRatio));\n\n if (grlFinalColor.a == 0.0) {\n discard;\n }\n }\n\n #ifdef GREASED_LINE_HAS_COLOR\n if (grlColorMode == ".concat(0,".) {\n grlFinalColor = vec4f(uniforms.grl_singleColor, grlFinalColor.a);\n } else if (grlColorMode == ").concat(1,".) {\n grlFinalColor += vec4f(uniforms.grl_singleColor, grlFinalColor.a);\n } else if (grlColorMode == ").concat(2,".) {\n grlFinalColor *= vec4f(uniforms.grl_singleColor, grlFinalColor.a);\n }\n #else\n if (grlUseColors == 1.) {\n #ifdef GREASED_LINE_COLOR_DISTRIBUTION_TYPE_LINE\n let grlColor: vec4f = textureSample(grl_colors, grl_colorsSampler, vec2f(fragmentInputs.grlCounters, 0.));\n #else\n let lookup: vec2f = vec2(fract(fragmentInputs.grlColorPointer / uniforms.grl_textureSize.x), 1.0 - floor(fragmentInputs.grlColorPointer / uniforms.grl_textureSize.x) / max(uniforms.grl_textureSize.y - 1.0, 1.0));\n let grlColor: vec4f = textureSample(grl_colors, grl_colorsSampler, lookup);\n #endif\n if (grlColorMode == ").concat(0,".) {\n grlFinalColor = grlColor;\n } else if (grlColorMode == ").concat(1,".) {\n grlFinalColor += grlColor;\n } else if (grlColorMode == ").concat(2,".) {\n grlFinalColor *= grlColor;\n }\n }\n #endif\n\n\n ")}:null}(e,this._cameraFacing)},t.prototype.dispose=function(){var t;null===(t=this.colorsTexture)||void 0===t||t.dispose(),e.prototype.dispose.call(this)},Object.defineProperty(t.prototype,"colors",{get:function(){return this._colors},set:function(e){this.setColors(e)},enumerable:!1,configurable:!0}),t.prototype.setColors=function(e,t,n){var r,i,o,a;void 0===t&&(t=!1),void 0===n&&(n=!1);var s=null!==(i=null===(r=this._colors)||void 0===r?void 0:r.length)&&void 0!==i?i:0;if(this._colors=e,null!==e&&0!==e.length){if(!t||n)if(this.colorsTexture&&s===e.length&&!n){var l=GP.Color3toRGBAUint8(e);this.colorsTexture.update(l)}else null===(a=this.colorsTexture)||void 0===a||a.dispose(),this.colorsTexture=GP.CreateColorsTexture("".concat(this._material.name,"-colors-texture"),e,this.colorsSampling,this._scene)}else null===(o=this.colorsTexture)||void 0===o||o.dispose()},t.prototype.updateLazy=function(){this._colors&&this.setColors(this._colors,!1,!0)},Object.defineProperty(t.prototype,"dashCount",{get:function(){return this._dashCount},set:function(e){this._dashCount=e,this._dashArray=1/e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sizeAttenuation",{get:function(){return this._sizeAttenuation},set:function(e){this._sizeAttenuation=e,this.markAllDefinesAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"color",{get:function(){return this._color},set:function(e){this.setColor(e)},enumerable:!1,configurable:!0}),t.prototype.setColor=function(e,t){void 0===t&&(t=!1),null===this._color&&null!==e||null!==this._color&&null===e?(this._color=e,t||this.markAllDefinesAsDirty()):this._color=e},Object.defineProperty(t.prototype,"colorsDistributionType",{get:function(){return this._colorsDistributionType},set:function(e){this._colorsDistributionType=e,this.markAllDefinesAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"resolution",{get:function(){return this._resolution},set:function(e){this._aspect=e.x/e.y,this._resolution=e},enumerable:!1,configurable:!0}),t.prototype.serialize=function(){var t=e.prototype.serialize.call(this),n={colorDistributionType:this._colorsDistributionType,colorsSampling:this.colorsSampling,colorMode:this.colorMode,dashCount:this._dashCount,dashOffset:this.dashOffset,dashRatio:this.dashRatio,resolution:this._resolution,sizeAttenuation:this._sizeAttenuation,useColors:this.useColors,useDash:this.useDash,visibility:this.visibility,width:this.width};return this._colors&&(n.colors=this._colors),this._color&&(n.color=this._color),t.greasedLineMaterialOptions=n,t},t.prototype.parse=function(t,n,r){var i;e.prototype.parse.call(this,t,n,r);var o=t.greasedLineMaterialOptions;null===(i=this.colorsTexture)||void 0===i||i.dispose(),o.color&&this.setColor(o.color,!0),o.colorDistributionType&&(this.colorsDistributionType=o.colorDistributionType),o.colors&&(this.colors=o.colors),o.colorsSampling&&(this.colorsSampling=o.colorsSampling),o.colorMode&&(this.colorMode=o.colorMode),o.useColors&&(this.useColors=o.useColors),o.visibility&&(this.visibility=o.visibility),o.useDash&&(this.useDash=o.useDash),o.dashCount&&(this.dashCount=o.dashCount),o.dashRatio&&(this.dashRatio=o.dashRatio),o.dashOffset&&(this.dashOffset=o.dashOffset),o.width&&(this.width=o.width),o.sizeAttenuation&&(this.sizeAttenuation=o.sizeAttenuation),o.resolution&&(this.resolution=o.resolution),this.colors?this.colorsTexture=GP.CreateColorsTexture("".concat(this._material.name,"-colors-texture"),this.colors,this.colorsSampling,n):GP.PrepareEmptyColorsTexture(n),this.markAllDefinesAsDirty()},t.prototype.copyTo=function(e){var t,n=e;null===(t=n.colorsTexture)||void 0===t||t.dispose(),this._colors&&(n.colorsTexture=GP.CreateColorsTexture("".concat(n._material.name,"-colors-texture"),this._colors,n.colorsSampling,this._scene)),n.setColor(this.color,!0),n.colorsDistributionType=this.colorsDistributionType,n.colorsSampling=this.colorsSampling,n.colorMode=this.colorMode,n.useColors=this.useColors,n.visibility=this.visibility,n.useDash=this.useDash,n.dashCount=this.dashCount,n.dashRatio=this.dashRatio,n.dashOffset=this.dashOffset,n.width=this.width,n.sizeAttenuation=this.sizeAttenuation,n.resolution=this.resolution,n.markAllDefinesAsDirty()},t.prototype._isGLSL=function(e){return 0===e||this._forceGLSL},t.GREASED_LINE_MATERIAL_NAME="GreasedLinePluginMaterial",t.ForceGLSL=!1,t}(Ro);(0,h.Y5)("BABYLON.".concat(zP.GREASED_LINE_MATERIAL_NAME),zP);var WP,HP,YP,XP="GREASED_LINE_USE_OFFSETS",jP=function(e){function t(r,i,o){var a,s,l,h,d,p,m,_,g,v,y,b,S,T,E,x=this,P=i.getEngine(),C=P.isWebGPU&&!(o.forceGLSL||t.ForceGLSL),R=["COLOR_DISTRIBUTION_TYPE_LINE ".concat(1,"."),"COLOR_DISTRIBUTION_TYPE_SEGMENT ".concat(0,"."),"COLOR_MODE_SET ".concat(0,"."),"COLOR_MODE_ADD ".concat(1,"."),"COLOR_MODE_MULTIPLY ".concat(2,".")];i.useRightHandedSystem&&R.push("GREASED_LINE_RIGHT_HANDED_COORDINATE_SYSTEM");var A=["position","grl_widths","grl_offsets","grl_colorPointers"];o.cameraFacing?(R.push("GREASED_LINE_CAMERA_FACING"),A.push("grl_previousAndSide","grl_nextAndCounters")):(A.push("grl_slopes"),A.push("grl_counters"));var I=["grlColorsWidth","grlUseColors","grlWidth","grlColor","grl_colorModeAndColorDistributionType","grlResolution","grlAspect","grlAizeAttenuation","grlDashArray","grlDashOffset","grlDashRatio","grlUseDash","grlVisibility","grlColors"];if(C||I.push("world","viewProjection","view","projection"),x=e.call(this,r,i,{vertex:"greasedLine",fragment:"greasedLine"},{uniformBuffers:C?["Scene","Mesh"]:void 0,attributes:A,uniforms:I,samplers:C?[]:["grlColors"],defines:R,extraInitializationsAsync:function(){return(0,f.sH)(x,void 0,void 0,(function(){return(0,f.YH)(this,(function(e){switch(e.label){case 0:return C?[4,Promise.all([Promise.resolve().then(n.bind(n,66348)),Promise.resolve().then(n.bind(n,17706))])]:[3,2];case 1:return e.sent(),[3,4];case 2:return[4,Promise.all([Promise.resolve().then(n.bind(n,68351)),Promise.resolve().then(n.bind(n,54617))])];case 3:e.sent(),e.label=4;case 4:return[2]}}))}))},shaderLanguage:C?1:0})||this,x._color=u.v9.White(),x._colorsDistributionType=0,x._colorsTexture=null,o=o||{color:UP.DEFAULT_COLOR},x.visibility=null!==(a=o.visibility)&&void 0!==a?a:1,x.useDash=null!==(s=o.useDash)&&void 0!==s&&s,x.dashRatio=null!==(l=o.dashRatio)&&void 0!==l?l:.5,x.dashOffset=null!==(h=o.dashOffset)&&void 0!==h?h:0,x.dashCount=null!==(d=o.dashCount)&&void 0!==d?d:1,x.width=o.width?o.width:o.sizeAttenuation&&o.cameraFacing?UP.DEFAULT_WIDTH_ATTENUATED:UP.DEFAULT_WIDTH,x.sizeAttenuation=null!==(p=o.sizeAttenuation)&&void 0!==p&&p,x.color=null!==(m=o.color)&&void 0!==m?m:u.v9.White(),x.useColors=null!==(_=o.useColors)&&void 0!==_&&_,x.colorsDistributionType=null!==(g=o.colorDistributionType)&&void 0!==g?g:0,x.colorsSampling=null!==(v=o.colorsSampling)&&void 0!==v?v:gn.NEAREST_NEAREST,x.colorMode=null!==(y=o.colorMode)&&void 0!==y?y:0,x._colors=null!==(b=o.colors)&&void 0!==b?b:null,x._cameraFacing=null===(S=o.cameraFacing)||void 0===S||S,x.resolution=null!==(T=o.resolution)&&void 0!==T?T:new c.I9(P.getRenderWidth(),P.getRenderHeight()),o.colorsTexture?x.colorsTexture=o.colorsTexture:x._colors?x.colorsTexture=GP.CreateColorsTexture("".concat(x.name,"-colors-texture"),x._colors,x.colorsSampling,i):(x._color=null!==(E=x._color)&&void 0!==E?E:UP.DEFAULT_COLOR,x.colorsTexture=GP.PrepareEmptyColorsTexture(i)),C){var O=new nT.u;O.setParameters(),O.samplingMode=x.colorsSampling,x.setTextureSampler("grlColorsSampler",O)}return P.onDisposeObservable.add((function(){GP.DisposeEmptyColorsTexture()})),x}return(0,f.C6)(t,e),t.prototype.dispose=function(){var t;null===(t=this._colorsTexture)||void 0===t||t.dispose(),e.prototype.dispose.call(this)},t.prototype._setColorModeAndColorDistributionType=function(){this.setVector2("grl_colorModeAndColorDistributionType",new c.I9(this._colorMode,this._colorsDistributionType))},t.prototype.updateLazy=function(){this._colors&&this.setColors(this._colors,!1,!0)},Object.defineProperty(t.prototype,"colors",{get:function(){return this._colors},set:function(e){this.setColors(e)},enumerable:!1,configurable:!0}),t.prototype.setColors=function(e,t,n){var r,i,o,a;void 0===t&&(t=!1),void 0===n&&(n=!1);var s=null!==(i=null===(r=this._colors)||void 0===r?void 0:r.length)&&void 0!==i?i:0;if(this._colors=e,null!==e&&0!==e.length){if(!t||n)if(this._colorsTexture&&s===e.length&&!n){var l=GP.Color3toRGBAUint8(e);this._colorsTexture.update(l)}else null===(a=this._colorsTexture)||void 0===a||a.dispose(),this.colorsTexture=GP.CreateColorsTexture("".concat(this.name,"-colors-texture"),e,this.colorsSampling,this.getScene())}else null===(o=this._colorsTexture)||void 0===o||o.dispose()},Object.defineProperty(t.prototype,"colorsTexture",{get:function(){var e;return null!==(e=this._colorsTexture)&&void 0!==e?e:null},set:function(e){this._colorsTexture=e,this.setFloat("grlColorsWidth",this._colorsTexture.getSize().width),this.setTexture("grlColors",this._colorsTexture)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this._width},set:function(e){this._width=e,this.setFloat("grlWidth",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"useColors",{get:function(){return this._useColors},set:function(e){this._useColors=e,this.setFloat("grlUseColors",GP.BooleanToNumber(e))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"colorsSampling",{get:function(){return this._colorsSampling},set:function(e){this._colorsSampling=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"visibility",{get:function(){return this._visibility},set:function(e){this._visibility=e,this.setFloat("grlVisibility",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"useDash",{get:function(){return this._useDash},set:function(e){this._useDash=e,this.setFloat("grlUseDash",GP.BooleanToNumber(e))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dashOffset",{get:function(){return this._dashOffset},set:function(e){this._dashOffset=e,this.setFloat("grlDashOffset",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dashRatio",{get:function(){return this._dashRatio},set:function(e){this._dashRatio=e,this.setFloat("grlDashRatio",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dashCount",{get:function(){return this._dashCount},set:function(e){this._dashCount=e,this._dashArray=1/e,this.setFloat("grlDashArray",this._dashArray)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sizeAttenuation",{get:function(){return this._sizeAttenuation},set:function(e){this._sizeAttenuation=e,this.setFloat("grlSizeAttenuation",GP.BooleanToNumber(e))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"color",{get:function(){return this._color},set:function(e){this.setColor(e)},enumerable:!1,configurable:!0}),t.prototype.setColor=function(e){e=null!=e?e:UP.DEFAULT_COLOR,this._color=e,this.setColor3("grlColor",e)},Object.defineProperty(t.prototype,"colorsDistributionType",{get:function(){return this._colorsDistributionType},set:function(e){this._colorsDistributionType=e,this._setColorModeAndColorDistributionType()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"colorMode",{get:function(){return this._colorMode},set:function(e){this._colorMode=e,this._setColorModeAndColorDistributionType()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"resolution",{get:function(){return this._resolution},set:function(e){this._resolution=e,this.setVector2("grlResolution",e),this.setFloat("grlAspect",e.x/e.y)},enumerable:!1,configurable:!0}),t.prototype.serialize=function(){var t=e.prototype.serialize.call(this),n={colorDistributionType:this._colorsDistributionType,colorsSampling:this._colorsSampling,colorMode:this._colorMode,color:this._color,dashCount:this._dashCount,dashOffset:this._dashOffset,dashRatio:this._dashRatio,resolution:this._resolution,sizeAttenuation:this._sizeAttenuation,useColors:this._useColors,useDash:this._useDash,visibility:this._visibility,width:this._width,cameraFacing:this._cameraFacing};return this._colors&&(n.colors=this._colors),t.greasedLineMaterialOptions=n,t},t.prototype.parse=function(e,t,n){var r,i,o=e.greasedLineMaterialOptions;null===(r=this._colorsTexture)||void 0===r||r.dispose(),o.color&&(this.color=o.color),o.colorDistributionType&&(this.colorsDistributionType=o.colorDistributionType),o.colorsSampling&&(this.colorsSampling=o.colorsSampling),o.colorMode&&(this.colorMode=o.colorMode),o.useColors&&(this.useColors=o.useColors),o.visibility&&(this.visibility=o.visibility),o.useDash&&(this.useDash=o.useDash),o.dashCount&&(this.dashCount=o.dashCount),o.dashRatio&&(this.dashRatio=o.dashRatio),o.dashOffset&&(this.dashOffset=o.dashOffset),o.width&&(this.width=o.width),o.sizeAttenuation&&(this.sizeAttenuation=o.sizeAttenuation),o.resolution&&(this.resolution=o.resolution),o.colors?this.colorsTexture=GP.CreateColorsTexture("".concat(this.name,"-colors-texture"),o.colors,this.colorsSampling,this.getScene()):this.colorsTexture=GP.PrepareEmptyColorsTexture(t),this._cameraFacing=null===(i=o.cameraFacing)||void 0===i||i,this.setDefine("GREASED_LINE_CAMERA_FACING",this._cameraFacing)},t.ForceGLSL=!1,t}(Ea);!function(e){e[e.MATERIAL_TYPE_STANDARD=0]="MATERIAL_TYPE_STANDARD",e[e.MATERIAL_TYPE_PBR=1]="MATERIAL_TYPE_PBR",e[e.MATERIAL_TYPE_SIMPLE=2]="MATERIAL_TYPE_SIMPLE"}(WP||(WP={})),function(e){e[e.COLOR_MODE_SET=0]="COLOR_MODE_SET",e[e.COLOR_MODE_ADD=1]="COLOR_MODE_ADD",e[e.COLOR_MODE_MULTIPLY=2]="COLOR_MODE_MULTIPLY"}(HP||(HP={})),function(e){e[e.COLOR_DISTRIBUTION_TYPE_SEGMENT=0]="COLOR_DISTRIBUTION_TYPE_SEGMENT",e[e.COLOR_DISTRIBUTION_TYPE_LINE=1]="COLOR_DISTRIBUTION_TYPE_LINE"}(YP||(YP={}));var qP,KP=[new Du.v9(.98,.26,.38),new Du.v9(.47,.75,.3),new Du.v9(0,.26,.77),new Du.v9(.97,.6,.76),new Du.v9(.19,.63,.78),new Du.v9(.98,.8,.6),new Du.v9(.65,.43,.15),new Du.v9(.15,.47,.22),new Du.v9(.67,.71,.86),new Du.v9(.09,.46,.56),new Du.v9(.8,.98,.02),new Du.v9(.39,.29,.13),new Du.v9(.53,.63,.06),new Du.v9(.95,.96,.41),new Du.v9(1,.72,.94),new Du.v9(.63,.08,.31),new Du.v9(.66,.96,.95),new Du.v9(.22,.14,.19),new Du.v9(.14,.65,.59),new Du.v9(.93,1,.68),new Du.v9(.93,.14,.44),new Du.v9(.47,.86,.67),new Du.v9(.85,.07,.78),new Du.v9(.53,.64,.98),new Du.v9(.43,.37,.56),new Du.v9(.71,.65,.25),new Du.v9(.66,.19,.01),new Du.v9(.94,.53,.12),new Du.v9(.41,.44,.44),new Du.v9(.24,.71,.96),new Du.v9(.57,.28,.56),new Du.v9(.44,.98,.42)];!function(e){e[e.NONE=0]="NONE",e[e.TRIANGLES=1]="TRIANGLES",e[e.VERTICES=2]="VERTICES",e[e.TRIANGLES_VERTICES=3]="TRIANGLES_VERTICES",e[e.UV0=4]="UV0",e[e.UV1=5]="UV1",e[e.VERTEXCOLORS=6]="VERTEXCOLORS",e[e.MATERIALIDS=7]="MATERIALIDS"}(qP||(qP={}));var ZP=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.DBG_MODE=0,t.DBG_MULTIPLY=!0,t.DBG_ENABLED=!0,t}return(0,f.C6)(t,e),t}(ho),QP=function(e){function t(n,r){void 0===r&&(r={});var i,o,a,s,l,c,u,h,d,p,f,m,_,g=this,v=new ZP;return v.DBG_MODE=null!==(i=r.mode)&&void 0!==i?i:v.DBG_MODE,v.DBG_MULTIPLY=null!==(o=r.multiply)&&void 0!==o?o:v.DBG_MULTIPLY,(g=e.call(this,n,"MeshDebug",200,v,!0,!0)||this)._mode=v.DBG_MODE,g._multiply=v.DBG_MULTIPLY,g.shadedDiffuseColor=null!==(a=r.shadedDiffuseColor)&&void 0!==a?a:new Du.v9(1,1,1),g.shadedSpecularColor=null!==(s=r.shadedSpecularColor)&&void 0!==s?s:new Du.v9(.8,.8,.8),g.shadedSpecularPower=null!==(l=r.shadedSpecularPower)&&void 0!==l?l:10,g.wireframeThickness=null!==(c=r.wireframeThickness)&&void 0!==c?c:.7,g.wireframeTrianglesColor=null!==(u=r.wireframeTrianglesColor)&&void 0!==u?u:new Du.v9(0,0,0),g.wireframeVerticesColor=null!==(h=r.wireframeVerticesColor)&&void 0!==h?h:new Du.v9(.8,.8,.8),g.vertexColor=null!==(d=r.vertexColor)&&void 0!==d?d:new Du.v9(0,0,0),g.vertexRadius=null!==(p=r.vertexRadius)&&void 0!==p?p:1.2,g.uvScale=null!==(f=r.uvScale)&&void 0!==f?f:20,g.uvPrimaryColor=null!==(m=r.uvPrimaryColor)&&void 0!==m?m:new Du.v9(1,1,1),g.uvSecondaryColor=null!==(_=r.uvSecondaryColor)&&void 0!==_?_:new Du.v9(.5,.5,.5),g._materialColor=t.MaterialColors[t._PluginCount++%t.MaterialColors.length],g.isEnabled=!0,g}return(0,f.C6)(t,e),t.prototype._markAllDefinesAsDirty=function(){this._enable(this._isEnabled),this.markAllDefinesAsDirty()},t.prototype.isCompatible=function(e){switch(e){case 0:case 1:return!0;default:return!1}},t.prototype.getClassName=function(){return"MeshDebugPluginMaterial"},Object.defineProperty(t.prototype,"isEnabled",{get:function(){return this._isEnabled},set:function(e){if(this._isEnabled!==e){if(!this._material.getScene().getEngine().isWebGPU&&1==this._material.getScene().getEngine().version)return y.V.Error("MeshDebugPluginMaterial is not supported on WebGL 1.0."),void(this._isEnabled=!1);this._isEnabled=e,this._markAllDefinesAsDirty()}},enumerable:!1,configurable:!0}),t.prototype.prepareDefines=function(e,t,n){2!=this._mode&&1!=this._mode&&3!=this._mode||n.isVerticesDataPresent("dbg_initialPass")||y.V.Warn("For best results with TRIANGLES, TRIANGLES_VERTICES, or VERTICES modes, please use MeshDebugPluginMaterial.PrepareMeshForTrianglesAndVerticesMode() on mesh.",1),e.DBG_MODE=this._mode,e.DBG_MULTIPLY=this._multiply,e.DBG_ENABLED=this._isEnabled},t.prototype.getAttributes=function(e){e.push("dbg_initialPass")},t.prototype.getUniforms=function(e){return void 0===e&&(e=0),{ubo:[{name:"dbg_shadedDiffuseColor",size:3,type:"vec3"},{name:"dbg_shadedSpecularColorPower",size:4,type:"vec4"},{name:"dbg_thicknessRadiusScale",size:3,type:"vec3"},{name:"dbg_wireframeTrianglesColor",size:3,type:"vec3"},{name:"dbg_wireframeVerticesColor",size:3,type:"vec3"},{name:"dbg_vertexColor",size:3,type:"vec3"},{name:"dbg_uvPrimaryColor",size:3,type:"vec3"},{name:"dbg_uvSecondaryColor",size:3,type:"vec3"},{name:"dbg_materialColor",size:3,type:"vec3"}],fragment:0===e?"#if defined(DBG_ENABLED)\nuniform vec3 dbg_shadedDiffuseColor;\nuniform vec4 dbg_shadedSpecularColorPower;\nuniform vec3 dbg_thicknessRadiusScale;\n\n#if DBG_MODE == 2 || DBG_MODE == 3\n uniform vec3 dbg_vertexColor;\n#endif\n\n#if DBG_MODE == 1\n uniform vec3 dbg_wireframeTrianglesColor;\n#elif DBG_MODE == 3\n uniform vec3 dbg_wireframeVerticesColor;\n#elif DBG_MODE == 4 || DBG_MODE == 5\n uniform vec3 dbg_uvPrimaryColor;\n uniform vec3 dbg_uvSecondaryColor;\n#elif DBG_MODE == 7\n uniform vec3 dbg_materialColor;\n#endif\n#endif":"#if defined(DBG_ENABLED)\nuniform dbg_shadedDiffuseColor: vec3f;\nuniform dbg_shadedSpecularColorPower: vec4f;\nuniform dbg_thicknessRadiusScale: vec3f;\n\n#if DBG_MODE == 2 || DBG_MODE == 3\n uniform dbg_vertexColor: vec3f;\n#endif\n\n#if DBG_MODE == 1\n uniform dbg_wireframeTrianglesColor: vec3f;\n#elif DBG_MODE == 3\n uniform dbg_wireframeVerticesColor: vec3f;\n#elif DBG_MODE == 4 || DBG_MODE == 5\n uniform dbg_uvPrimaryColor: vec3f;\n uniform dbg_uvSecondaryColor: vec3f;\n#elif DBG_MODE == 7\n uniform dbg_materialColor: vec3f;\n#endif\n#endif"}},t.prototype.bindForSubMesh=function(e){this._isEnabled&&(e.updateFloat3("dbg_shadedDiffuseColor",this.shadedDiffuseColor.r,this.shadedDiffuseColor.g,this.shadedDiffuseColor.b),e.updateFloat4("dbg_shadedSpecularColorPower",this.shadedSpecularColor.r,this.shadedSpecularColor.g,this.shadedSpecularColor.b,this.shadedSpecularPower),e.updateFloat3("dbg_thicknessRadiusScale",this.wireframeThickness,this.vertexRadius,this.uvScale),e.updateColor3("dbg_wireframeTrianglesColor",this.wireframeTrianglesColor),e.updateColor3("dbg_wireframeVerticesColor",this.wireframeVerticesColor),e.updateColor3("dbg_vertexColor",this.vertexColor),e.updateColor3("dbg_uvPrimaryColor",this.uvPrimaryColor),e.updateColor3("dbg_uvSecondaryColor",this.uvSecondaryColor),e.updateColor3("dbg_materialColor",this._materialColor))},t.prototype.getCustomCode=function(e,t){return void 0===t&&(t=0),1===t?"vertex"===e?{CUSTOM_VERTEX_DEFINITIONS:"#if defined(DBG_ENABLED)\nattribute dbg_initialPass: f32;\nvarying dbg_vBarycentric: vec3f;\nvarying dbg_vVertexWorldPos: vec3f;\nvarying dbg_vPass: f32;\n#endif",CUSTOM_VERTEX_MAIN_END:"#if defined(DBG_ENABLED)\nvar dbg_vertexIndex = f32(input.vertexIndex) % 3.;\nif (dbg_vertexIndex == 0.0) { \n vertexOutputs.dbg_vBarycentric = vec3f(1.,0.,0.); \n}\nelse if (dbg_vertexIndex == 1.0) { \n vertexOutputs.dbg_vBarycentric = vec3f(0.,1.,0.); \n}\nelse { \n vertexOutputs.dbg_vBarycentric = vec3f(0.,0.,1.); \n}\n\nvertexOutputs.dbg_vVertexWorldPos = vertexOutputs.vPositionW;\nvertexOutputs.dbg_vPass = input.dbg_initialPass;\n#endif"}:{CUSTOM_FRAGMENT_DEFINITIONS:"#if defined(DBG_ENABLED)\nvarying dbg_vBarycentric: vec3f;\nvarying dbg_vVertexWorldPos: vec3f;\nvarying dbg_vPass: f32;\n\n#if !defined(DBG_MULTIPLY)\n fn dbg_applyShading(color: vec3f) -> vec3f {\n var N = fragmentInputs.vNormalW.xyz;\n var L = normalize(scene.vEyePosition.xyz - fragmentInputs.vPositionW.xyz);\n var H = normalize(L + L);\n var LdotN = clamp(dot(L,N), 0., 1.);\n var HdotN = clamp(dot(H,N), 0., 1.);\n var specTerm = pow(HdotN, uniforms.dbg_shadedSpecularColorPower.w);\n var result = color * (LdotN / PI);\n result += uniforms.dbg_shadedSpecularColorPower.rgb * (specTerm / PI);\n return result;\n }\n#endif\n\n#if DBG_MODE == 1 || DBG_MODE == 3\n fn dbg_edgeFactor() -> f32 {\n var d = fwidth(fragmentInputs.dbg_vBarycentric);\n var a3 = smoothstep(vec3f(0.), d * uniforms.dbg_thicknessRadiusScale.x, fragmentInputs.dbg_vBarycentric);\n return min(min(a3.x, a3.y), a3.z);\n }\n#endif\n\n#if DBG_MODE == 2 || DBG_MODE == 3\n fn dbg_cornerFactor() -> f32 {\n var worldPos = fragmentInputs.vPositionW;\n float dist = length(worldPos - fragmentInputs.dbg_vVertexWorldPos);\n float camDist = length(worldPos - scene.vEyePosition.xyz);\n float d = sqrt(camDist) * .001;\n return smoothstep((uniforms.dbg_thicknessRadiusScale.y * d), ((uniforms.dbg_thicknessRadiusScale.y * 1.01) * d), dist);\n }\n#endif\n\n#if (DBG_MODE == 4 && defined(UV1)) || (DBG_MODE == 5 && defined(UV2))\n fn dbg_checkerboardFactor(uv: vec2f) -> f32 {\n var f = fract(uv * uniforms.dbg_thicknessRadiusScale.z);\n f -= .5;\n return (f.x * f.y) > 0. ? 1. : 0.;\n }\n#endif\n#endif",CUSTOM_FRAGMENT_MAIN_END:"#if defined(DBG_ENABLED)\nvar dbg_color = vec3f(1.);\n#if DBG_MODE == 1\n dbg_color = mix(uniforms.dbg_wireframeTrianglesColor, vec3f(1.), dbg_edgeFactor());\n#elif DBG_MODE == 2 || DBG_MODE == 3\n var dbg_cornerFactor = dbg_cornerFactor();\n if (fragmentInputs.dbg_vPass == 0. && dbg_cornerFactor == 1.) discard;\n dbg_color = mix(uniforms.dbg_vertexColor, vec3(1.), dbg_cornerFactor);\n #if DBG_MODE == 3\n dbg_color *= mix(uniforms.dbg_wireframeVerticesColor, vec3f(1.), dbg_edgeFactor());\n #endif\n#elif DBG_MODE == 4 && defined(MAINUV1)\n dbg_color = mix(uniforms.dbg_uvPrimaryColor, uniforms.dbg_uvSecondaryColor, dbg_checkerboardFactor(fragmentInputs.vMainUV1));\n#elif DBG_MODE == 5 && defined(MAINUV2)\n dbg_color = mix(uniforms.dbg_uvPrimaryColor, uniforms.dbg_uvSecondaryColor, dbg_checkerboardFactor(fragmentInputs.vMainUV2));\n#elif DBG_MODE == 6 && defined(VERTEXCOLOR)\n dbg_color = fragmentInputs.vColor.rgb;\n#elif DBG_MODE == 7\n dbg_color = uniforms.dbg_materialColor;\n#endif\n\n#if defined(DBG_MULTIPLY)\n fragmentOutputs.color *= vec4f(dbg_color, 1.);\n#else\n #if DBG_MODE != 6\n fragmentOutputs.color = vec4f(dbg_applyShading(dbg_shadedDiffuseColor) * dbg_color, 1.);\n #else\n fragmentOutputs.color = vec4f(dbg_color, 1.);\n #endif\n#endif\n#endif"}:"vertex"===e?{CUSTOM_VERTEX_DEFINITIONS:"#if defined(DBG_ENABLED)\nattribute float dbg_initialPass;\nvarying vec3 dbg_vBarycentric;\nflat varying vec3 dbg_vVertexWorldPos;\nflat varying float dbg_vPass;\n#endif",CUSTOM_VERTEX_MAIN_END:"#if defined(DBG_ENABLED)\nfloat dbg_vertexIndex = mod(float(gl_VertexID), 3.);\nif (dbg_vertexIndex == 0.0) { \n dbg_vBarycentric = vec3(1.,0.,0.); \n}\nelse if (dbg_vertexIndex == 1.0) { \n dbg_vBarycentric = vec3(0.,1.,0.); \n}\nelse { \n dbg_vBarycentric = vec3(0.,0.,1.); \n}\n\ndbg_vVertexWorldPos = vPositionW;\ndbg_vPass = dbg_initialPass;\n#endif"}:{CUSTOM_FRAGMENT_DEFINITIONS:"#if defined(DBG_ENABLED)\nvarying vec3 dbg_vBarycentric;\nflat varying vec3 dbg_vVertexWorldPos;\nflat varying float dbg_vPass;\n\n#if !defined(DBG_MULTIPLY)\n vec3 dbg_applyShading(vec3 color) {\n vec3 N = vNormalW.xyz;\n vec3 L = normalize(vEyePosition.xyz - vPositionW.xyz);\n vec3 H = normalize(L + L);\n float LdotN = clamp(dot(L,N), 0., 1.);\n float HdotN = clamp(dot(H,N), 0., 1.);\n float specTerm = pow(HdotN, dbg_shadedSpecularColorPower.w);\n color *= (LdotN / PI);\n color += dbg_shadedSpecularColorPower.rgb * (specTerm / PI);\n return color;\n }\n#endif\n\n#if DBG_MODE == 1 || DBG_MODE == 3\n float dbg_edgeFactor() {\n vec3 d = fwidth(dbg_vBarycentric);\n vec3 a3 = smoothstep(vec3(0.), d * dbg_thicknessRadiusScale.x, dbg_vBarycentric);\n return min(min(a3.x, a3.y), a3.z);\n }\n#endif\n\n#if DBG_MODE == 2 || DBG_MODE == 3\n float dbg_cornerFactor() {\n vec3 worldPos = vPositionW;\n float dist = length(worldPos - dbg_vVertexWorldPos);\n float camDist = length(worldPos - vEyePosition.xyz);\n float d = sqrt(camDist) * .001;\n return smoothstep((dbg_thicknessRadiusScale.y * d), ((dbg_thicknessRadiusScale.y * 1.01) * d), dist);\n }\n#endif\n\n#if (DBG_MODE == 4 && defined(UV1)) || (DBG_MODE == 5 && defined(UV2))\n float dbg_checkerboardFactor(vec2 uv) {\n vec2 f = fract(uv * dbg_thicknessRadiusScale.z);\n f -= .5;\n return (f.x * f.y) > 0. ? 1. : 0.;\n }\n#endif\n#endif",CUSTOM_FRAGMENT_MAIN_END:"#if defined(DBG_ENABLED)\nvec3 dbg_color = vec3(1.);\n#if DBG_MODE == 1\n dbg_color = mix(dbg_wireframeTrianglesColor, vec3(1.), dbg_edgeFactor());\n#elif DBG_MODE == 2 || DBG_MODE == 3\n float dbg_cornerFactor = dbg_cornerFactor();\n if (dbg_vPass == 0. && dbg_cornerFactor == 1.) discard;\n dbg_color = mix(dbg_vertexColor, vec3(1.), dbg_cornerFactor);\n #if DBG_MODE == 3\n dbg_color *= mix(dbg_wireframeVerticesColor, vec3(1.), dbg_edgeFactor());\n #endif\n#elif DBG_MODE == 4 && defined(MAINUV1)\n dbg_color = mix(dbg_uvPrimaryColor, dbg_uvSecondaryColor, dbg_checkerboardFactor(vMainUV1));\n#elif DBG_MODE == 5 && defined(MAINUV2)\n dbg_color = mix(dbg_uvPrimaryColor, dbg_uvSecondaryColor, dbg_checkerboardFactor(vMainUV2));\n#elif DBG_MODE == 6 && defined(VERTEXCOLOR)\n dbg_color = vColor.rgb;\n#elif DBG_MODE == 7\n dbg_color = dbg_materialColor;\n#endif\n\n#if defined(DBG_MULTIPLY)\n gl_FragColor *= vec4(dbg_color, 1.);\n#else\n #if DBG_MODE != 6\n gl_FragColor = vec4(dbg_applyShading(dbg_shadedDiffuseColor) * dbg_color, 1.);\n #else\n gl_FragColor = vec4(dbg_color, 1.);\n #endif\n#endif\n#endif"}},t.Reset=function(){this._PluginCount=0,this.MaterialColors=KP},t.PrepareMeshForTrianglesAndVerticesMode=function(e,t){void 0===t&&(t=!1);var n=function(){};if(0==e.getTotalIndices())return n;if(t){for(var r=e.getVerticesDataKinds(),i=e.getIndices(),o={},a=0,s=r;a4,m=f?dC(e,t,se.R.MatricesIndicesExtraKind):null,_=f?dC(e,t,se.R.MatricesWeightsExtraKind):null,g=e.skeleton.getTransformMatrices(e),v=c.AA.Matrix[0],y=c.AA.Matrix[1];for(v.reset(),o=0;o0&&(c.uq.FromFloat32ArrayToRefScaled(g,Math.floor(16*d[o]),b,y),v.addToSelf(y));if(m&&_)for(o=0;o<_.length;o++){var b;(b=_[o])>0&&(c.uq.FromFloat32ArrayToRefScaled(g,Math.floor(16*m[o]),b,y),v.addToSelf(y))}c.Pq.TransformCoordinatesFromFloatsToRef(r[0],r[1],r[2],v,n)}}return!0}function fC(e,t,n,r){n.set(0,0,0);for(var i=0;i<3;i++){if(!pC(e,t.pointIndex[i],c.AA.Vector3[i]))return!1;c.AA.Vector3[i].scaleAndAddToRef(t.barycentric[i],n)}if(c.Pq.TransformCoordinatesToRef(n,e.getWorldMatrix(),n),r){var o=c.AA.Vector3[0],a=c.AA.Vector3[1],s=c.AA.Vector3[2],l=c.AA.Vector3[3],u=c.AA.Vector3[4];l.copyFrom(a),l.subtractInPlace(o),u.copyFrom(s),u.subtractInPlace(o),l.normalize(),u.normalize(),c.Pq.CrossToRef(l,u,r),e.material&&e.material.sideOrientation===(e.getScene().useRightHandedSystem?b.Y.MATERIAL_ClockWiseSideOrientation:b.Y.MATERIAL_CounterClockWiseSideOrientation)&&r.scaleInPlace(-1),c.Pq.TransformNormalToRef(r,e.getWorldMatrix(),r),r.normalize()}return!0}var mC=n(80244);function _C(e,t,n,r){var i=e,o=null,a=null,s=null,l=null,c={},u=t.find((function(e){return"POSITION"===e.dracoName}));if(!u)throw new Error("Position attribute is required for Draco encoding");if(!n){var h=u.data.length/u.size;n=new(h>65535?Uint32Array:Uint16Array)(h);for(var d=0;de.EPSILON?1:0;l|=h,u.push(h)}switch(l){case 0:(c.Pq.Dot(this.normal,t.plane.normal)>0?n:r).push(t);break;case 1:i.push(t);break;case 2:o.push(t);break;case 3:var d=[],p=[];for(a=0;a=3&&(b=new LC(d,t.shared)).plane&&i.push(b),p.length>=3&&(b=new LC(p,t.shared)).plane&&o.push(b)}},e.EPSILON=1e-5,e}(),LC=function(){function e(e,t){this.vertices=e,this.shared=t,this.plane=FC.FromPoints(e[0].pos,e[1].pos,e[2].pos)}return e.prototype.clone=function(){return new e(this.vertices.map((function(e){return e.clone()})),this.shared)},e.prototype.flip=function(){this.vertices.reverse().map((function(e){e.flip()})),this.plane.flip()},e}(),wC=function(){function e(e){this._plane=null,this._front=null,this._back=null,this._polygons=new Array,e&&this.build(e)}return e.prototype.clone=function(){var t=new e;return t._plane=this._plane&&this._plane.clone(),t._front=this._front&&this._front.clone(),t._back=this._back&&this._back.clone(),t._polygons=this._polygons.map((function(e){return e.clone()})),t},e.prototype.invert=function(){for(var e=0;eu._length?u._length:i.segments:u._length,u._sectionPolygonPointsCount=i.sections||4,u._doNotTaper=null!==(s=i.doNotTaper)&&void 0!==s&&s,u._autoStart=null===(l=i.autoStart)||void 0===l||l):(u.diameter=i||1,u._length=o,u._segments=u._length,u._doNotTaper=!1,u._autoStart=a),u._sectionVectors=[],u._sectionNormalVectors=[];for(var h=0;h<=u._sectionPolygonPointsCount;h++)u._sectionVectors[h]=c.Pq.Zero(),u._sectionNormalVectors[h]=c.Pq.Zero();return u._createMesh(),u}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"TrailMesh"},t.prototype._createMesh=function(){var e=new ge,t=[],n=[],r=[],i=[],o=c.Pq.Zero();o=this._generator instanceof De&&this._generator.hasBoundingInfo?this._generator.getBoundingInfo().boundingBox.centerWorld:this._generator.absolutePosition;for(var a=2*Math.PI/this._sectionPolygonPointsCount,s=0;s<=this._sectionPolygonPointsCount;s++){var l=s!==this._sectionPolygonPointsCount?s*a:0;t.push(o.x+Math.cos(l)*this.diameter,o.y+Math.sin(l)*this.diameter,o.z),i.push(s/this._sectionPolygonPointsCount,0)}for(s=1;s<=this._segments;s++){for(var u=0;u<=this._sectionPolygonPointsCount;u++)l=u!==this._sectionPolygonPointsCount?u*a:0,t.push(o.x+Math.cos(l)*this.diameter,o.y+Math.sin(l)*this.diameter,o.z),i.push(u/this._sectionPolygonPointsCount,s/this._segments);var h=t.length/3-2*(this._sectionPolygonPointsCount+1);for(u=0;u<=this._sectionPolygonPointsCount;u++)r.push(h+u,h+u+this._sectionPolygonPointsCount,h+u+this._sectionPolygonPointsCount+1),r.push(h+u,h+u+this._sectionPolygonPointsCount+1,h+u+1)}ge.ComputeNormals(t,r,n),e.positions=t,e.normals=n,e.indices=r,e.uvs=i,e.applyToMesh(this,!0),this._autoStart&&this.start()},t.prototype._updateSectionVectors=function(){for(var e=this._generator.getWorldMatrix(),t=2*Math.PI/this._sectionPolygonPointsCount,n=0;n<=this._sectionPolygonPointsCount;n++){var r=n!==this._sectionPolygonPointsCount?n*t:0;this._sectionVectors[n].copyFromFloats(Math.cos(r)*this.diameter,Math.sin(r)*this.diameter,0),this._sectionNormalVectors[n].copyFromFloats(Math.cos(r),Math.sin(r),0),c.Pq.TransformCoordinatesToRef(this._sectionVectors[n],e,this._sectionVectors[n]),c.Pq.TransformNormalToRef(this._sectionNormalVectors[n],e,this._sectionNormalVectors[n])}},t.prototype.start=function(){var e=this;this._running||(this._running=!0,this._beforeRenderObserver=this.getScene().onBeforeRenderObservable.add((function(){e.update()})))},t.prototype.stop=function(){this._beforeRenderObserver&&this._running&&(this._running=!1,this.getScene().onBeforeRenderObservable.remove(this._beforeRenderObserver))},t.prototype.update=function(){var e=this.getVerticesData(se.R.PositionKind),t=this.getVerticesData(se.R.NormalKind),n=3*(this._sectionPolygonPointsCount+1);if(e&&t){if(this._doNotTaper)for(var r=n;rs||n.deleted||n.isDirty))for(var i=0;i<3;++i)if(n.error[i]0&&this._reconstructedMesh.setVerticesData(se.R.NormalKind,a),s.length>0&&this._reconstructedMesh.setVerticesData(se.R.UVKind,s),l.length>0&&this._reconstructedMesh.setVerticesData(se.R.ColorKind,l);var P=this._mesh.subMeshes[e];if(e>0){this._reconstructedMesh.subMeshes=[];for(var C=0,R=y;C.999)return!0;var p=c.Pq.Cross(h,d).normalize();if(r[o]=!1,c.Pq.Dot(p,a.normal)<.2)return!0}else r[o]=!0,i.push(a)}}return!1},e.prototype._updateTriangles=function(e,t,n,r){for(var i=r,o=0;o4,v=g?e.getVerticesData(se.R.MatricesWeightsExtraKind):null,y=g?e.getVerticesData(se.R.MatricesIndicesExtraKind):null,b=o.get(e.uniqueId)||new Map;o.set(e.uniqueId,b);var S=function(e,t,n,r){for(var i=t;i0){var o=r[i],a=b.get(o);a?(a.minimum.minimizeInPlace(s[e]),a.maximum.maximizeInPlace(l[e])):b.set(o,{minimum:s[e].clone(),maximum:l[e].clone()})}};for(a=0,u=0;a;\n ",CUSTOM_VERTEX_UPDATE_POSITION:this._prepareCode(t)}:{CUSTOM_VERTEX_DEFINITIONS:"\n precision highp sampler3D;\n uniform sampler3D latticeData;\n ",CUSTOM_VERTEX_UPDATE_POSITION:this._prepareCode(t)}:null},t.prototype.dispose=function(){this._latticeDataTexture&&(this._latticeDataTexture.dispose(),this._latticeDataTexture=null)},t}(Ro);!function(e){e[e.POINTS_MODE_POINTS=0]="POINTS_MODE_POINTS",e[e.POINTS_MODE_PATHS=1]="POINTS_MODE_PATHS"}(JC||(JC={})),function(e){e[e.FACES_MODE_SINGLE_SIDED=0]="FACES_MODE_SINGLE_SIDED",e[e.FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING=1]="FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING",e[e.FACES_MODE_DOUBLE_SIDED=2]="FACES_MODE_DOUBLE_SIDED"}($C||($C={})),function(e){e[e.AUTO_DIRECTIONS_FROM_FIRST_SEGMENT=0]="AUTO_DIRECTIONS_FROM_FIRST_SEGMENT",e[e.AUTO_DIRECTIONS_FROM_ALL_SEGMENTS=1]="AUTO_DIRECTIONS_FROM_ALL_SEGMENTS",e[e.AUTO_DIRECTIONS_ENHANCED=2]="AUTO_DIRECTIONS_ENHANCED",e[e.AUTO_DIRECTIONS_FACE_TO=3]="AUTO_DIRECTIONS_FACE_TO",e[e.AUTO_DIRECTIONS_NONE=99]="AUTO_DIRECTIONS_NONE"}(eR||(eR={}));var rR=function(e){function t(t,n,r){var i,o,a,s,l=e.call(this,t,n,null,null,!1,!1)||this;return l.name=t,l._options=r,l._lazy=!1,l._updatable=!1,l._engine=n.getEngine(),l._lazy=null!==(i=r.lazy)&&void 0!==i&&i,l._updatable=null!==(o=r.updatable)&&void 0!==o&&o,l._vertexPositions=[],l._indices=[],l._uvs=[],l._points=[],l._colorPointers=null!==(a=r.colorPointers)&&void 0!==a?a:[],l._widths=null!==(s=r.widths)&&void 0!==s?s:new Array(r.points.length).fill(1),l}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"GreasedLineMesh"},t.prototype._updateWidthsWithValue=function(e){for(var t=0,n=0,r=this._points;n0),this._offsets=e,this._offsetsBuffer?this._offsetsBuffer.update(e):this._createOffsetsBuffer(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"widths",{get:function(){return this._widths},set:function(e){this._widths=e,this._lazy||this._widthsBuffer&&this._widthsBuffer.update(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"colorPointers",{get:function(){return this._colorPointers},set:function(e){this._colorPointers=e,this._lazy||this._colorPointersBuffer&&this._colorPointersBuffer.update(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"greasedLineMaterial",{get:function(){var e,t;return this.material&&this.material instanceof jP?this.material:(null===(t=null===(e=this.material)||void 0===e?void 0:e.pluginManager)||void 0===t?void 0:t.getPlugin(zP.GREASED_LINE_MATERIAL_NAME))||void 0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"points",{get:function(){var e=[];return D.r.DeepCopy(this._points,e),e},enumerable:!1,configurable:!0}),t.prototype.setPoints=function(e,t){var n;this._points=GP.ConvertPoints(e,null!==(n=null==t?void 0:t.pointsOptions)&&void 0!==n?n:this._options.pointsOptions),this._updateWidths(),(null==t?void 0:t.colorPointers)||this._updateColorPointers(),this._setPoints(this._points,t)},t.prototype._initGreasedLine=function(){this._vertexPositions=[],this._indices=[],this._uvs=[]},t.prototype._createLineOptions=function(){return{points:this._points,colorPointers:this._colorPointers,lazy:this._lazy,updatable:this._updatable,uvs:this._uvs,widths:this._widths,ribbonOptions:this._options.ribbonOptions}},t.prototype.serialize=function(t){e.prototype.serialize.call(this,t),t.type=this.getClassName(),t.lineOptions=this._createLineOptions()},t.prototype._createVertexBuffers=function(e){void 0===e&&(e=!1);var t=new ge;return t.positions=this._vertexPositions,t.indices=this._indices,t.uvs=this._uvs,e&&(t.normals=[],ge.ComputeNormals(this._vertexPositions,this._indices,t.normals)),t.applyToMesh(this,this._options.updatable),t},t.prototype._createOffsetsBuffer=function(e){var t=this._scene.getEngine(),n=new se.h(t,e,this._updatable,3);this.setVerticesBuffer(n.createVertexBuffer("grl_offsets",0,3)),this._offsetsBuffer=n},t}(qe);qe._GreasedLineMeshParser=function(e,t){return iR.Parse(e,t)};var iR=function(e){function t(t,n,r){var i=e.call(this,t,n,r)||this;return i.name=t,i.intersectionThreshold=.1,i._previousAndSide=[],i._nextAndCounters=[],r.points&&i.addPoints(GP.ConvertPoints(r.points)),i}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"GreasedLineMesh"},t.prototype._updateColorPointers=function(){if(!this._options.colorPointers){var e=0;this._colorPointers=[];for(var t=0,n=this._points;t65535?4:2)+4*o+4*a*2),d=new ArrayBuffer(4*(s/3+4*s)),p=0,f=new Float32Array(h,p,r);p+=f.byteLength;var m=r>65535?new Uint32Array(h,p,i):new Uint16Array(h,p,i);p+=m.byteLength;var _=new Float32Array(h,p,o);p+=_.byteLength;var g=new Float32Array(h,p,a);p+=g.byteLength;for(var v=new Float32Array(h,p,a),y=0,b=0,S=0,T=0,E=0,x=0,P=e;x>1]/R;if(this._options.uvs)for(G=0;G2)for(l=0;l0&&(h[0]+=1,h[1]+=1),a.push(h[1]+(c%2!=0?i:0),h[0],h[2]),d&&a.push(h[0],h[1]+(c%2!=0?i:0),h[2]);else for(l=0;lm.y&&m.x>m.z?r?t._RightHandedForwardReadOnlyQuaternion:t._LeftHandedForwardReadOnlyQuaternion:t._LeftReadOnlyQuaternion),u=m.normalize()}h=u.multiplyByFloats(s,s,s),o.push(p.add(h)),a.push(p.subtract(h))}i||(o.push(l[l.length-1].add(h)),a.push(l[l.length-1].subtract(h)))}return[o,a]},t._GetDirectionFromPoints=function(e,n,r){return e.x!==n.x||r&&1!==(null==r?void 0:r.x)?e.y===n.y?t.DIRECTION_XZ:e.z===n.z?t.DIRECTION_XY:t.DIRECTION_XZ:t.DIRECTION_YZ},t.prototype.clone=function(e,n){void 0===e&&(e="".concat(this.name,"-cloned"));var r=this._createLineOptions(),i={},o=[];D.r.DeepCopy(this._pathsOptions,o,void 0,void 0,!0),D.r.DeepCopy(r,i,["instance"],void 0,!0);var a=new t(e,this._scene,i,o);return n&&(a.parent=n),a.material=this.material,a},t.prototype.serialize=function(t){e.prototype.serialize.call(this,t),t.type=this.getClassName(),t.lineOptions=this._createLineOptions(),t.pathsOptions=this._pathsOptions},t.Parse=function(e,n){var r=e.lineOptions;return new t(e.name,n,r,e.pathOptions)},t.prototype._initGreasedLine=function(){e.prototype._initGreasedLine.call(this),this._paths=[],this._counters=[],this._slopes=[],this._ribbonWidths=[]},t.prototype._calculateSegmentLengths=function(e){var t=e.length;this._vSegmentLengths=new Array(t),this._vTotalLengths=new Array(t);for(var n=0,r=0;r0){if(t.length%2!=0&&t.push(r),5===n){for(var s=Math.floor(t.length/2),l=0,c=0;l0){if(5===n){for(var a=Math.floor(t.length/2),s=0;s65535?new Uint32Array(i.triVerts):new Uint16Array(i.triVerts);for(var o=0;o1){var v=new Ve(e,t);v.subMaterials=p,l.material=v}else l.subMeshes.length>1&&l._createGlobalSubMesh(!0),l.material=p[0];return l},e.prototype.dispose=function(){this._manifold&&(this._manifold.delete(),this._manifold=null)},e._ProcessData=function(t,n,r,i,o,a){for(var s=new Float32Array(t*r.reduce((function(e,t){return e+t.stride}),0)),l=0;l0?.5:-.5)|0;return 0===r&&(r=0),"".concat(r)}function IR(e,t){return void 0===t&&(t=RR),"".concat(AR(e.x,t),",").concat(AR(e.y,t),",").concat(AR(e.z,t))}function OR(e,t,n,r,i,o){for(var a=0;a0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"innerType",{get:function(){return this._linkedConnectionSource&&!this._isMainLinkSource&&this._linkedConnectionSource.isConnected?this.type:this._type},enumerable:!1,configurable:!0}),e.prototype._resetCounters=function(){this._callCount=0,this._executionCount=0},Object.defineProperty(e.prototype,"callCount",{get:function(){return this._callCount},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"executionCount",{get:function(){return this._executionCount},enumerable:!1,configurable:!0}),e.prototype.getConnectedValue=function(e){var t;return this.isConnected?(null===(t=this._connectedPoint)||void 0===t?void 0:t._storedFunction)?(this._connectedPoint._callCount++,this._connectedPoint._executionCount++,this._connectedPoint._storedFunction(e)):(this._connectedPoint._callCount++,this._connectedPoint._executionCount=1,this._connectedPoint._storedValue):(this._callCount++,this._executionCount=1,this.value)},e.prototype.getClassName=function(){return"NodeGeometryConnectionPoint"},e.prototype.canConnectTo=function(e){return 0===this.checkCompatibilityState(e)},e.prototype.checkCompatibilityState=function(e){var t=this._ownerBlock,n=e.ownerBlock;if(this.type!==e.type&&e.innerType!==ER.AutoDetect)return e.acceptedConnectionPointTypes&&-1!==e.acceptedConnectionPointTypes.indexOf(this.type)?0:1;if(e.excludedConnectionPointTypes&&-1!==e.excludedConnectionPointTypes.indexOf(this.type))return 1;var r=n,i=t;return 0===this.direction&&(r=t,i=n),r.isAnAncestorOf(i)?2:0},e.prototype.connectTo=function(e,t){if(void 0===t&&(t=!1),!t&&!this.canConnectTo(e))throw'Cannot connect these two connectors. source: "'.concat(this.ownerBlock.name,'".').concat(this.name,', target: "').concat(e.ownerBlock.name,'".').concat(e.name);return this._endpoints.push(e),e._connectedPoint=this,this.onConnectionObservable.notifyObservers(e),e.onConnectionObservable.notifyObservers(this),this},e.prototype.disconnectFrom=function(e){var t=this._endpoints.indexOf(e);return-1===t||(this._endpoints.splice(t,1),e._connectedPoint=null,this.onDisconnectionObservable.notifyObservers(e),e.onDisconnectionObservable.notifyObservers(this)),this},e.prototype.addExcludedConnectionPointFromAllowedTypes=function(e){for(var t=1;t=0)&&(t.isExposedOnFrame=!0,t.exposedPortPosition=this.exposedPortPosition),t},e.prototype.dispose=function(){this.onConnectionObservable.clear(),this.onDisconnectionObservable.clear()},e}(),UR=function(){function e(e){this._name="",this._isInput=!1,this._isTeleportOut=!1,this._isTeleportIn=!1,this._isDebug=!1,this._isUnique=!1,this._buildExecutionTime=0,this.onBuildObservable=new l.cP,this._inputs=new Array,this._outputs=new Array,this._codeVariableName="",this.visibleOnFrame=!1,this._name=e,this.uniqueId=Np.K.UniqueId}return Object.defineProperty(e.prototype,"buildExecutionTime",{get:function(){return this._buildExecutionTime},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"inputs",{get:function(){return this._inputs},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"outputs",{get:function(){return this._outputs},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"name",{get:function(){return this._name},set:function(e){this._name=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isInput",{get:function(){return this._isInput},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isTeleportOut",{get:function(){return this._isTeleportOut},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isTeleportIn",{get:function(){return this._isTeleportIn},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isDebug",{get:function(){return this._isDebug},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isUnique",{get:function(){return this._isUnique},enumerable:!1,configurable:!0}),e.prototype.getClassName=function(){return"NodeGeometryBlock"},e.prototype._inputRename=function(e){return e},e.prototype._outputRename=function(e){return e},e.prototype.isAnAncestorOf=function(e){for(var t=0,n=this._outputs;t0){if(!this._outputs.some((function(e){return e.hasEndpoints}))&&!this.isDebug)return!1;for(var t=0,n=this.outputs;t0?this._geometryContextStack[this._geometryContextStack.length-1]:null},e.prototype.restoreExecutionContext=function(){this._executionContextStack.pop(),this._executionContext=this._executionContextStack.length>0?this._executionContextStack[this._executionContextStack.length-1]:null},e.prototype.restoreInstancingContext=function(){this._instancingContextStack.pop(),this._instancingContext=this._instancingContextStack.length>0?this._instancingContextStack[this._instancingContextStack.length-1]:null},e.prototype.getContextualValue=function(e,t){if(void 0===t&&(t=!1),!this.executionContext)return t||this.noContextualData.push(e),null;var n=this.executionContext.getExecutionIndex();switch(e){case BR.Positions:return this.executionContext.getOverridePositionsContextualValue?this.executionContext.getOverridePositionsContextualValue():this.geometryContext&&this.geometryContext.positions?c.Pq.FromArray(this.geometryContext.positions,3*n):c.Pq.Zero();case BR.Normals:return this.executionContext.getOverrideNormalsContextualValue?this.executionContext.getOverrideNormalsContextualValue():this.geometryContext&&this.geometryContext.normals?c.Pq.FromArray(this.geometryContext.normals,3*n):c.Pq.Zero();case BR.Colors:return this.geometryContext&&this.geometryContext.colors?c.IU.FromArray(this.geometryContext.colors,4*n):c.IU.Zero();case BR.Tangents:return this.geometryContext&&this.geometryContext.tangents?c.IU.FromArray(this.geometryContext.tangents,4*n):c.IU.Zero();case BR.UV:return this.executionContext.getOverrideUVs1ContextualValue?this.executionContext.getOverrideUVs1ContextualValue():this.geometryContext&&this.geometryContext.uvs?c.I9.FromArray(this.geometryContext.uvs,2*n):c.I9.Zero();case BR.UV2:return this.geometryContext&&this.geometryContext.uvs2?c.I9.FromArray(this.geometryContext.uvs2,2*n):c.I9.Zero();case BR.UV3:return this.geometryContext&&this.geometryContext.uvs3?c.I9.FromArray(this.geometryContext.uvs3,2*n):c.I9.Zero();case BR.UV4:return this.geometryContext&&this.geometryContext.uvs4?c.I9.FromArray(this.geometryContext.uvs4,2*n):c.I9.Zero();case BR.UV5:return this.geometryContext&&this.geometryContext.uvs5?c.I9.FromArray(this.geometryContext.uvs5,2*n):c.I9.Zero();case BR.UV6:return this.geometryContext&&this.geometryContext.uvs6?c.I9.FromArray(this.geometryContext.uvs6,2*n):c.I9.Zero();case BR.VertexID:return n;case BR.FaceID:return this.executionContext.getExecutionFaceIndex();case BR.LoopID:return this.executionContext.getExecutionLoopIndex();case BR.InstanceID:return this.instancingContext?this.instancingContext.getInstanceIndex():0;case BR.GeometryID:return this.geometryContext?this.geometryContext.uniqueId:0;case BR.CollectionID:return this.geometryContext&&this.geometryContext.metadata&&this.geometryContext.metadata.collectionId||0;case BR.LatticeID:return this.executionContext.getOverridePositionsContextualValue?this.executionContext.getOverridePositionsContextualValue():c.Pq.Zero();case BR.LatticeControl:return this.executionContext.getOverrideNormalsContextualValue?this.executionContext.getOverrideNormalsContextualValue():c.Pq.Zero()}return null},e.prototype.adapt=function(e,t){var n=e.getConnectedValue(this)||0;if(e.type===t)return n;switch(t){case ER.Vector2:return new c.I9(n,n);case ER.Vector3:return new c.Pq(n,n,n);case ER.Vector4:return new c.IU(n,n,n,n)}return null},e.prototype.adaptInput=function(e,t,n){var r;if(!e.isConnected)return e.value||n;var i=e.getConnectedValue(this);if((null===(r=e._connectedPoint)||void 0===r?void 0:r.type)===t)return i;switch(t){case ER.Vector2:return new c.I9(i,i);case ER.Vector3:return new c.Pq(i,i,i);case ER.Vector4:return new c.IU(i,i,i,i)}return null},e.prototype.emitErrors=function(){for(var e="",t=0,n=this.notConnectedNonOptionalInputs;t-1&&this.attachedBlocks.splice(t,1),e===this.outputBlock&&(this.outputBlock=null)},e.prototype.parseSerializedObject=function(e,t){void 0===t&&(t=!1),t||this.clear();for(var n={},r=0,i=e.blocks;rr-e.epsilon;break;case uA.LessOrEqual:i=n<=r+e.epsilon;break;case uA.GreaterOrEqual:i=n>=r-e.epsilon;break;case uA.Xor:i=!!n&&!r||!n&&!!r;break;case uA.Or:i=!!n||!!r;break;case uA.And:i=!!n&&!!r}return i}(t)?e.ifTrue.getConnectedValue(t):e.ifFalse.getConnectedValue(t)}},t.prototype._dumpPropertiesCode=function(){return e.prototype._dumpPropertiesCode.call(this)+"".concat(this._codeVariableName,".test = BABYLON.ConditionBlockTests.").concat(uA[this.test],";\n")+"".concat(this._codeVariableName,".epsilon = ").concat(this.epsilon,";\n")},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.test=this.test,t.epsilon=this.epsilon,t},t.prototype._deserialize=function(t){e.prototype._deserialize.call(this,t),this.test=t.test,void 0!==t.epsilon&&(this.epsilon=t.epsilon)},(0,f.Cg)([Jp("Test",5,"ADVANCED",{notifiers:{rebuild:!0},embedded:!0,options:[{label:"Equal",value:uA.Equal},{label:"NotEqual",value:uA.NotEqual},{label:"LessThan",value:uA.LessThan},{label:"GreaterThan",value:uA.GreaterThan},{label:"LessOrEqual",value:uA.LessOrEqual},{label:"GreaterOrEqual",value:uA.GreaterOrEqual},{label:"Xor",value:uA.Xor},{label:"Or",value:uA.Or},{label:"And",value:uA.And}]})],t.prototype,"test",void 0),(0,f.Cg)([Jp("Epsilon",1,"ADVANCED",{embedded:!0,notifiers:{rebuild:!0}})],t.prototype,"epsilon",void 0),t}(UR);(0,h.Y5)("BABYLON.ConditionBlock",pA),function(e){e[e.None=0]="None",e[e.LoopID=1]="LoopID",e[e.InstanceID=2]="InstanceID",e[e.Once=3]="Once"}(dA||(dA={}));var fA=function(e){function t(t){var n=e.call(this,t)||this;return n._currentLockId=-1,n.lockMode=dA.None,n.registerInput("min",ER.AutoDetect),n.registerInput("max",ER.AutoDetect),n.registerOutput("output",ER.BasedOnInput),n._inputs[0].excludedConnectionPointTypes.push(ER.Matrix),n._inputs[0].excludedConnectionPointTypes.push(ER.Geometry),n._inputs[0].excludedConnectionPointTypes.push(ER.Texture),n._inputs[1].excludedConnectionPointTypes.push(ER.Matrix),n._inputs[1].excludedConnectionPointTypes.push(ER.Geometry),n._inputs[1].excludedConnectionPointTypes.push(ER.Texture),n._outputs[0]._typeConnectionSource=n._inputs[0],n._linkConnectionTypes(0,1),n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"RandomBlock"},Object.defineProperty(t.prototype,"min",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"max",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype.autoConfigure=function(){if(!this.min.isConnected){var e=new zR("Min");e.value=0,e.output.connectTo(this.min)}if(!this.max.isConnected){var t=new zR("Max");t.value=1,t.output.connectTo(this.max)}},t.prototype._buildBlock=function(){var e=this,t=null;switch(this._currentLockId=-1,this.min.type){case ER.Int:case ER.Float:t=function(t){var n=e.min.getConnectedValue(t)||0,r=e.max.getConnectedValue(t)||0;return n+Math.random()*(r-n)};break;case ER.Vector2:t=function(t){var n=e.min.getConnectedValue(t)||c.I9.Zero(),r=e.max.getConnectedValue(t)||c.I9.Zero();return new c.I9(n.x+Math.random()*(r.x-n.x),n.y+Math.random()*(r.y-n.y))};break;case ER.Vector3:t=function(t){var n=e.min.getConnectedValue(t)||c.Pq.Zero(),r=e.max.getConnectedValue(t)||c.Pq.Zero();return new c.Pq(n.x+Math.random()*(r.x-n.x),n.y+Math.random()*(r.y-n.y),n.z+Math.random()*(r.z-n.z))};break;case ER.Vector4:t=function(t){var n=e.min.getConnectedValue(t)||c.IU.Zero(),r=e.max.getConnectedValue(t)||c.IU.Zero();return new c.IU(n.x+Math.random()*(r.x-n.x),n.y+Math.random()*(r.y-n.y),n.z+Math.random()*(r.z-n.z),n.w+Math.random()*(r.w-n.w))}}this.lockMode!==dA.None&&t?this.output._storedFunction=function(n){var r=0;switch(e.lockMode){case dA.InstanceID:r=n.getContextualValue(BR.InstanceID,!0)||0;break;case dA.LoopID:r=n.getContextualValue(BR.LoopID,!0)||0;break;case dA.Once:r=n.buildId||0}return e._currentLockId===r&&e.lockMode!==dA.None||(e._currentLockId=r,e.output._storedValue=t(n)),e.output._storedValue}:this.output._storedFunction=t},t.prototype._dumpPropertiesCode=function(){return e.prototype._dumpPropertiesCode.call(this)+"".concat(this._codeVariableName,".lockMode = BABYLON.RandomBlockLocks.").concat(dA[this.lockMode],";\n")},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.lockMode=this.lockMode,t},t.prototype._deserialize=function(t){e.prototype._deserialize.call(this,t),this.lockMode=t.lockMode},(0,f.Cg)([Jp("LockMode",5,"ADVANCED",{notifiers:{rebuild:!0},embedded:!0,options:[{label:"None",value:dA.None},{label:"LoopID",value:dA.LoopID},{label:"InstanceID",value:dA.InstanceID},{label:"Once",value:dA.Once}]})],t.prototype,"lockMode",void 0),t}(UR);(0,h.Y5)("BABYLON.RandomBlock",fA);var mA=function(e){function t(t){var n=e.call(this,t)||this;return n.registerInput("offset",ER.Vector3,!0,c.Pq.Zero()),n.registerInput("scale",ER.Float,!0,1),n.registerInput("octaves",ER.Float,!0,2,0,16),n.registerInput("roughness",ER.Float,!0,.5,0,1),n.registerOutput("output",ER.Float),n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"NoiseBlock"},Object.defineProperty(t.prototype,"offset",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scale",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"octaves",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"roughness",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype._negateIf=function(e,t){return 0!==t?-e:e},t.prototype._noiseGrad=function(e,t,n,r){var i=15&e,o=i<8?t:n,a=i<4?n:12===i||14==i?t:r;return this._negateIf(o,i&o)+this._negateIf(a,2&i)},t.prototype._fade=function(e){return e*e*e*(e*(6*e-15)+10)},t.prototype._hashBitRotate=function(e,t){return e<>32-t},t.prototype._hash=function(e,t,n){var r,i,o;return r=i=o=3735928584,o+=n,r+=e,o^=i+=t,r^=o-=this._hashBitRotate(i,14),i^=r-=this._hashBitRotate(o,11),o^=i-=this._hashBitRotate(r,25),r^=o-=this._hashBitRotate(i,16),i^=r-=this._hashBitRotate(o,4),(o^=i-=this._hashBitRotate(r,14))-this._hashBitRotate(i,24)},t.prototype._mix=function(e,t,n,r,i,o,a,s,l,c,u){var h=1-l,d=1-c;return(1-u)*(d*(e*h+t*l)+c*(n*h+r*l))+u*(d*(i*h+o*l)+c*(a*h+s*l))},t.prototype._perlinNoise=function(e){var t=(0|e.x)-(e.x<0?1:0),n=(0|e.y)-(e.y<0?1:0),r=(0|e.z)-(e.z<0?1:0),i=e.x-t,o=e.y-n,a=e.z-r,s=this._fade(i),l=this._fade(o),c=this._fade(a);return this._mix(this._noiseGrad(this._hash(t,n,r),i,o,a),this._noiseGrad(this._hash(t+1,n,r),i-1,o,a),this._noiseGrad(this._hash(t,n+1,r),i,o-1,a),this._noiseGrad(this._hash(t+1,n+1,r),i-1,o-1,a),this._noiseGrad(this._hash(t,n,r+1),i,o,a-1),this._noiseGrad(this._hash(t+1,n,r+1),i-1,o,a-1),this._noiseGrad(this._hash(t,n+1,r+1),i,o-1,a-1),this._noiseGrad(this._hash(t+1,n+1,r+1),i-1,o-1,a-1),s,l,c)},t.prototype._perlinSigned=function(e){return.982*this._perlinNoise(e)},t.prototype._perlin=function(e){return this._perlinSigned(e)/2+.5},t.prototype.noise=function(e,t,n,r,i){for(var o=new c.Pq(n.x*i+r.x,n.y*i+r.y,n.z*i+r.z),a=1,s=1,l=0,u=0,h=0|(e=(0,lr.Clamp)(e,0,15)),d=0;d<=h;d++)u+=this._perlin(o.scale(a))*s,l+=s,s*=(0,lr.Clamp)(t,0,1),a*=2;var p=e-Math.floor(e);if(0==p)return u/l;var f=u+this._perlin(o.scale(a))*s;return(1-p)*(u/=l)+p*(f/(l+s))},t.prototype._buildBlock=function(){var e=this;this.output._storedFunction=function(t){var n=t.getContextualValue(BR.Positions),r=e.octaves.getConnectedValue(t),i=e.roughness.getConnectedValue(t),o=e.offset.getConnectedValue(t),a=e.scale.getConnectedValue(t);return e.noise(r,i,n,o,a)}},t}(UR);(0,h.Y5)("BABYLON.NoiseBlock",mA);var _A=function(e){function t(t){var n=e.call(this,t)||this;return n.evaluateContext=!1,n.registerInput("geometry0",ER.Geometry),n.registerInput("geometry1",ER.Geometry,!0),n.registerInput("geometry2",ER.Geometry,!0),n.registerInput("geometry3",ER.Geometry,!0),n.registerInput("geometry4",ER.Geometry,!0),n.registerOutput("output",ER.Geometry),n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"MergeGeometryBlock"},Object.defineProperty(t.prototype,"geometry0",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"geometry1",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"geometry2",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"geometry3",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"geometry4",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(e){var t=this,n=function(e){var n,r=[];if(t.geometry0.isConnected&&(n=t.geometry0.getConnectedValue(e))&&r.push(n),t.geometry1.isConnected&&(n=t.geometry1.getConnectedValue(e))&&r.push(n),t.geometry2.isConnected&&(n=t.geometry2.getConnectedValue(e))&&r.push(n),t.geometry3.isConnected&&(n=t.geometry3.getConnectedValue(e))&&r.push(n),t.geometry4.isConnected&&(n=t.geometry4.getConnectedValue(e))&&r.push(n),0===r.length)return null;var i=r[0].clone(),o=r.slice(1);return o.length&&i&&(i=i.merge(o,!0,!1,!0,!0)),i};this.evaluateContext?this.output._storedFunction=n:(this.output._storedFunction=null,this.output._storedValue=n(e))},t.prototype._dumpPropertiesCode=function(){return e.prototype._dumpPropertiesCode.call(this)+"".concat(this._codeVariableName,".evaluateContext = ").concat(this.evaluateContext?"true":"false",";\n")},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.evaluateContext=this.evaluateContext,t},t.prototype._deserialize=function(t){e.prototype._deserialize.call(this,t),this.evaluateContext=t.evaluateContext},(0,f.Cg)([Jp("Evaluate context",0,"ADVANCED",{embedded:!0,notifiers:{rebuild:!0}})],t.prototype,"evaluateContext",void 0),t}(UR);(0,h.Y5)("BABYLON.MergeGeometryBlock",_A);var gA=function(e){function t(t){var n=e.call(this,t)||this;return n.evaluateContext=!0,n.registerInput("geometry0",ER.Geometry,!0),n.registerInput("geometry1",ER.Geometry,!0),n.registerInput("geometry2",ER.Geometry,!0),n.registerInput("geometry3",ER.Geometry,!0),n.registerInput("geometry4",ER.Geometry,!0),n.registerInput("geometry5",ER.Geometry,!0),n.registerInput("geometry6",ER.Geometry,!0),n.registerInput("geometry7",ER.Geometry,!0),n.registerInput("geometry8",ER.Geometry,!0),n.registerInput("geometry9",ER.Geometry,!0),n.registerOutput("output",ER.Geometry),n._outputs[0]._typeConnectionSource=n._inputs[0],n._linkConnectionTypes(0,1),n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"GeometryCollectionBlock"},Object.defineProperty(t.prototype,"geometry0",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"geometry1",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"geometry2",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"geometry3",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"geometry4",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"geometry5",{get:function(){return this._inputs[5]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"geometry6",{get:function(){return this._inputs[6]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"geometry7",{get:function(){return this._inputs[7]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"geometry8",{get:function(){return this._inputs[8]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"geometry9",{get:function(){return this._inputs[9]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype._storeGeometry=function(e,t,n,r){if(e.isConnected){var i=e.getConnectedValue(t);if(!i)return;i.metadata=i.metadata||{},i.metadata.collectionId=n,r.push(i)}},t.prototype._buildBlock=function(e){var t=this,n=function(e){var n=[];return t._storeGeometry(t.geometry0,e,0,n),t._storeGeometry(t.geometry1,e,1,n),t._storeGeometry(t.geometry2,e,2,n),t._storeGeometry(t.geometry3,e,3,n),t._storeGeometry(t.geometry4,e,4,n),t._storeGeometry(t.geometry5,e,5,n),t._storeGeometry(t.geometry6,e,6,n),t._storeGeometry(t.geometry7,e,7,n),t._storeGeometry(t.geometry8,e,8,n),t._storeGeometry(t.geometry9,e,9,n),n.length?n[Math.round(Math.random()*(n.length-1))]:null};this.evaluateContext?this.output._storedFunction=n:(this.output._storedFunction=null,this.output._storedValue=n(e))},t.prototype._dumpPropertiesCode=function(){return e.prototype._dumpPropertiesCode.call(this)+"".concat(this._codeVariableName,".evaluateContext = ").concat(this.evaluateContext?"true":"false",";\n")},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.evaluateContext=this.evaluateContext,t},t.prototype._deserialize=function(t){e.prototype._deserialize.call(this,t),this.evaluateContext=t.evaluateContext},(0,f.Cg)([Jp("Evaluate context",0,"ADVANCED",{embedded:!0,notifiers:{rebuild:!0}})],t.prototype,"evaluateContext",void 0),t}(UR);(0,h.Y5)("BABYLON.GeometryCollectionBlock",gA);var vA=function(e){function t(t){var n=e.call(this,t)||this;return n.evaluateContext=!0,n.registerInput("geometry",ER.Geometry),n.registerOutput("output",ER.Geometry),n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"CleanGeometryBlock"},Object.defineProperty(t.prototype,"geometry",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(e){var t=this,n=function(e){if(!t.geometry.isConnected)return null;var n=t.geometry.getConnectedValue(e).clone();if(!n.positions||!n.indices||!n.normals)return n;var r=n.indices,i=n.positions;return(0,pe.Y4)(i,r),n};this.evaluateContext?this.output._storedFunction=n:(this.output._storedFunction=null,this.output._storedValue=n(e))},t.prototype._dumpPropertiesCode=function(){return e.prototype._dumpPropertiesCode.call(this)+"".concat(this._codeVariableName,".evaluateContext = ").concat(this.evaluateContext?"true":"false",";\n")},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.evaluateContext=this.evaluateContext,t},t.prototype._deserialize=function(t){e.prototype._deserialize.call(this,t),this.evaluateContext=t.evaluateContext},(0,f.Cg)([Jp("Evaluate context",0,"ADVANCED",{embedded:!0,notifiers:{rebuild:!0}})],t.prototype,"evaluateContext",void 0),t}(UR);(0,h.Y5)("BABYLON.CleanGeometryBlock",vA);var yA=function(e){function t(t){var n=e.call(this,t)||this;return n.registerInput("input",ER.AutoDetect),n.registerOutput("output",ER.BasedOnInput),n._outputs[0]._typeConnectionSource=n._inputs[0],n}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"buildExecutionTime",{get:function(){return-1},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"GeometryElbowBlock"},Object.defineProperty(t.prototype,"input",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(t){e.prototype._buildBlock.call(this,t);var n=this._outputs[0],r=this._inputs[0];n._storedFunction=function(e){return r.getConnectedValue(e)}},t}(UR);(0,h.Y5)("BABYLON.GeometryElbowBlock",yA);var bA=function(e){function t(t){var n=e.call(this,t)||this;return n.registerInput("geometry",ER.Geometry),n.registerOutput("output",ER.Geometry),n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"ComputeNormalsBlock"},Object.defineProperty(t.prototype,"geometry",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(){var e=this;this.output._storedFunction=function(t){if(!e.geometry.isConnected)return null;var n=e.geometry.getConnectedValue(t);return n?(n.normals||(n.normals=[]),ge.ComputeNormals(n.positions,n.indices,n.normals),n):null}},t}(UR);(0,h.Y5)("BABYLON.ComputeNormalsBlock",bA);var SA=function(e){function t(t){var n=e.call(this,t)||this;return n.registerInput("xyzw ",ER.Vector4,!0),n.registerInput("xyz ",ER.Vector3,!0),n.registerInput("xy ",ER.Vector2,!0),n.registerInput("zw ",ER.Vector2,!0),n.registerInput("x ",ER.Float,!0),n.registerInput("y ",ER.Float,!0),n.registerInput("z ",ER.Float,!0),n.registerInput("w ",ER.Float,!0),n.registerOutput("xyzw",ER.Vector4),n.registerOutput("xyz",ER.Vector3),n.registerOutput("xy",ER.Vector2),n.registerOutput("zw",ER.Vector2),n.registerOutput("x",ER.Float),n.registerOutput("y",ER.Float),n.registerOutput("z",ER.Float),n.registerOutput("w",ER.Float),n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"VectorConverterBlock"},Object.defineProperty(t.prototype,"xyzwIn",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"xyzIn",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"xyIn",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"zwIn",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"xIn",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"yIn",{get:function(){return this._inputs[5]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"zIn",{get:function(){return this._inputs[6]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wIn",{get:function(){return this._inputs[7]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"xyzwOut",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"xyzOut",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"xyOut",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"zwOut",{get:function(){return this._outputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"xOut",{get:function(){return this._outputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"yOut",{get:function(){return this._outputs[5]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"zOut",{get:function(){return this._outputs[6]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wOut",{get:function(){return this._outputs[7]},enumerable:!1,configurable:!0}),t.prototype._inputRename=function(e){return"xyzw "===e?"xyzwIn":"xyz "===e?"xyzIn":"xy "===e?"xyIn":"zw "===e?"zwIn":"x "===e?"xIn":"y "===e?"yIn":"z "===e?"zIn":"w "===e?"wIn":e},t.prototype._outputRename=function(e){switch(e){case"x":return"xOut";case"y":return"yOut";case"z":return"zOut";case"w":return"wOut";case"xy":return"xyOut";case"zw":return"zwOut";case"xyz":return"xyzOut";case"xyzw":return"xyzwOut";default:return e}},t.prototype._buildBlock=function(t){e.prototype._buildBlock.call(this,t);var n=this.xIn,r=this.yIn,i=this.zIn,o=this.wIn,a=this.xyIn,s=this.zwIn,l=this.xyzIn,u=this.xyzwIn,h=this.xyzwOut,d=this.xyzOut,p=this.xyOut,f=this.zwOut,m=this.xOut,_=this.yOut,g=this.zOut,v=this.wOut,y=function(e){if(u.isConnected)return u.getConnectedValue(e);var t,h=0,d=0,p=0,f=0;return n.isConnected&&(h=n.getConnectedValue(e)),r.isConnected&&(d=r.getConnectedValue(e)),i.isConnected&&(p=i.getConnectedValue(e)),o.isConnected&&(f=o.getConnectedValue(e)),a.isConnected&&(t=a.getConnectedValue(e))&&(h=t.x,d=t.y),s.isConnected&&(t=s.getConnectedValue(e))&&(p=t.x,f=t.y),l.isConnected&&(t=l.getConnectedValue(e))&&(h=t.x,d=t.y,p=t.z),new c.IU(h,d,p,f)};h._storedFunction=function(e){return y(e)},d._storedFunction=function(e){var t=y(e);return new c.Pq(t.x,t.y,t.z)},p._storedFunction=function(e){var t=y(e);return new c.I9(t.x,t.y)},f._storedFunction=function(e){var t=y(e);return new c.I9(t.z,t.w)},m._storedFunction=function(e){return y(e).x},_._storedFunction=function(e){return y(e).y},g._storedFunction=function(e){return y(e).z},v._storedFunction=function(e){return y(e).w}},t}(UR);(0,h.Y5)("BABYLON.VectorConverterBlock",SA);var TA=function(e){function t(t){var n=e.call(this,t)||this;return n.registerInput("input",ER.AutoDetect),n.registerOutput("output",ER.BasedOnInput),n._inputs[0].excludedConnectionPointTypes.push(ER.Float),n._inputs[0].excludedConnectionPointTypes.push(ER.Matrix),n._inputs[0].excludedConnectionPointTypes.push(ER.Geometry),n._inputs[0].excludedConnectionPointTypes.push(ER.Texture),n._outputs[0]._typeConnectionSource=n._inputs[0],n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"NormalizeVectorBlock"},Object.defineProperty(t.prototype,"input",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(t){var n=this;e.prototype._buildBlock.call(this,t),this.output._storedFunction=null,this.input.isConnected?this.output._storedFunction=function(e){return n.input.getConnectedValue(e).normalize()}:this.output._storedValue=null},t}(UR);(0,h.Y5)("BABYLON.NormalizeVectorBlock",TA);var EA=function(e){function t(t){var n=e.call(this,t)||this;return n.evaluateContext=!0,n.registerInput("geometry",ER.Geometry),n.registerInput("id",ER.Int,!0,0),n.registerOutput("output",ER.Geometry),n.id.acceptedConnectionPointTypes.push(ER.Float),n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"SetMaterialIDBlock"},Object.defineProperty(t.prototype,"geometry",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"id",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(e){var t=this;if(!this.geometry.isConnected)return this.output._storedFunction=null,void(this.output._storedValue=null);var n=function(e){var n=t.geometry.getConnectedValue(e);if(!n||!n.indices||!n.positions)return n;var r=new _e;return r.materialIndex=0|t.id.getConnectedValue(e),r.indexStart=0,r.indexCount=n.indices.length,r.verticesStart=0,r.verticesCount=n.positions.length/3,n.materialInfos=[r],n};this.evaluateContext?this.output._storedFunction=n:(this.output._storedFunction=null,this.output._storedValue=n(e))},t.prototype._dumpPropertiesCode=function(){return e.prototype._dumpPropertiesCode.call(this)+"".concat(this._codeVariableName,".evaluateContext = ").concat(this.evaluateContext?"true":"false",";\n")},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.evaluateContext=this.evaluateContext,t},t.prototype._deserialize=function(t){e.prototype._deserialize.call(this,t),void 0!==t.evaluateContext&&(this.evaluateContext=t.evaluateContext)},(0,f.Cg)([Jp("Evaluate context",0,"ADVANCED",{embedded:!0,notifiers:{rebuild:!0}})],t.prototype,"evaluateContext",void 0),t}(UR);(0,h.Y5)("BABYLON.SetMaterialIDBlock",EA);var xA,PA=function(e){function t(t){var n=e.call(this,t)||this;return n._indexVector3=new c.Pq,n._currentControl=new c.Pq,n.evaluateContext=!0,n.resolutionX=3,n.resolutionY=3,n.resolutionZ=3,n.registerInput("geometry",ER.Geometry),n.registerInput("controls",ER.Vector3),n.registerOutput("output",ER.Geometry),n}return(0,f.C6)(t,e),t.prototype.getExecutionIndex=function(){return this._currentIndexX+this.resolutionX*(this._currentIndexY+this.resolutionY*this._currentIndexZ)},t.prototype.getExecutionLoopIndex=function(){return this.getExecutionIndex()},t.prototype.getExecutionFaceIndex=function(){return 0},t.prototype.getClassName=function(){return"LatticeBlock"},Object.defineProperty(t.prototype,"geometry",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"controls",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype.getOverridePositionsContextualValue=function(){return this._indexVector3},t.prototype.getOverrideNormalsContextualValue=function(){return this._currentControl},t.prototype._buildBlock=function(e){var t=this,n=function(e){if(e.pushExecutionContext(t),t._vertexData=t.geometry.getConnectedValue(e),t._vertexData&&(t._vertexData=t._vertexData.clone()),!t._vertexData||!t._vertexData.positions)return e.restoreExecutionContext(),void(t.output._storedValue=null);var n=t._vertexData.positions,r=(0,pe.b8)(n,0,n.length/3),i=r.maximum.subtract(r.minimum);for(t._lattice=new tR({resolutionX:t.resolutionX,resolutionY:t.resolutionY,resolutionZ:t.resolutionZ,size:i,position:r.minimum.add(i.scale(.5))}),t._currentIndexX=0;t._currentIndexX=0?e-Math.floor(e):e-Math.ceil(e)}}if(!r)return this.output._storedFunction=null,void(this.output._storedValue=null);switch(this.input.type){case ER.Int:case ER.Float:this.output._storedFunction=function(e){var t=n.input.getConnectedValue(e);return r(t)};break;case ER.Vector2:this.output._storedFunction=function(e){var t=n.input.getConnectedValue(e);return new c.I9(r(t.x),r(t.y))};break;case ER.Vector3:this.output._storedFunction=function(e){var t=n.input.getConnectedValue(e);return new c.Pq(r(t.x),r(t.y),r(t.z))};break;case ER.Vector4:this.output._storedFunction=function(e){var t=n.input.getConnectedValue(e);return new c.IU(r(t.x),r(t.y),r(t.z),r(t.w))}}return this},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.operation=this.operation,t},t.prototype._deserialize=function(t){e.prototype._deserialize.call(this,t),this.operation=t.operation},t.prototype._dumpPropertiesCode=function(){return e.prototype._dumpPropertiesCode.call(this)+"".concat(this._codeVariableName,".operation = BABYLON.GeometryTrigonometryBlockOperations.").concat(xA[this.operation],";\n")},(0,f.Cg)([Jp("Operation",5,"ADVANCED",{embedded:!0,notifiers:{rebuild:!0},options:[{label:"Cos",value:xA.Cos},{label:"Sin",value:xA.Sin},{label:"Abs",value:xA.Abs},{label:"Exp",value:xA.Exp},{label:"Exp2",value:xA.Exp2},{label:"Round",value:xA.Round},{label:"Floor",value:xA.Floor},{label:"Ceiling",value:xA.Ceiling},{label:"Sqrt",value:xA.Sqrt},{label:"Log",value:xA.Log},{label:"Tan",value:xA.Tan},{label:"ArcTan",value:xA.ArcTan},{label:"ArcCos",value:xA.ArcCos},{label:"ArcSin",value:xA.ArcSin},{label:"Sign",value:xA.Sign},{label:"Negate",value:xA.Negate},{label:"OneMinus",value:xA.OneMinus},{label:"Reciprocal",value:xA.Reciprocal},{label:"ToDegrees",value:xA.ToDegrees},{label:"ToRadians",value:xA.ToRadians},{label:"Fract",value:xA.Fract}]})],t.prototype,"operation",void 0),t}(UR);(0,h.Y5)("BABYLON.GeometryTrigonometryBlock",CA);var RA=function(e){function t(t){var n=e.call(this,t)||this;return n._rotationMatrix=new c.uq,n._scalingMatrix=new c.uq,n._translationMatrix=new c.uq,n._scalingRotationMatrix=new c.uq,n._pivotMatrix=new c.uq,n._backPivotMatrix=new c.uq,n._transformMatrix=new c.uq,n.evaluateContext=!0,n.registerInput("value",ER.AutoDetect),n.registerInput("matrix",ER.Matrix,!0),n.registerInput("translation",ER.Vector3,!0,c.Pq.Zero()),n.registerInput("rotation",ER.Vector3,!0,c.Pq.Zero()),n.registerInput("scaling",ER.Vector3,!0,c.Pq.One()),n.registerInput("pivot",ER.Vector3,!0,c.Pq.Zero()),n.registerOutput("output",ER.BasedOnInput),n._outputs[0]._typeConnectionSource=n._inputs[0],n._inputs[0].excludedConnectionPointTypes.push(ER.Float),n._inputs[0].excludedConnectionPointTypes.push(ER.Matrix),n._inputs[0].excludedConnectionPointTypes.push(ER.Texture),n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"GeometryTransformBlock"},Object.defineProperty(t.prototype,"value",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"matrix",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"translation",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotation",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scaling",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pivot",{get:function(){return this._inputs[5]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(e){var t=this;if(!this.value.isConnected)return this.output._storedFunction=null,void(this.output._storedValue=null);var n=function(e){var n,r=t.value.getConnectedValue(e);if(!r)return null;if(t.matrix.isConnected)n=t.matrix.getConnectedValue(e);else{var i=t.scaling.getConnectedValue(e)||c.Pq.OneReadOnly,o=t.rotation.getConnectedValue(e)||c.Pq.ZeroReadOnly,a=t.translation.getConnectedValue(e)||c.Pq.ZeroReadOnly,s=t.pivot.getConnectedValue(e)||c.Pq.ZeroReadOnly;c.uq.TranslationToRef(-s.x,-s.y,-s.z,t._pivotMatrix),c.uq.ScalingToRef(i.x,i.y,i.z,t._scalingMatrix),c.uq.RotationYawPitchRollToRef(o.y,o.x,o.z,t._rotationMatrix),c.uq.TranslationToRef(a.x+s.x,a.y+s.y,a.z+s.z,t._translationMatrix),t._pivotMatrix.multiplyToRef(t._scalingMatrix,t._backPivotMatrix),t._backPivotMatrix.multiplyToRef(t._rotationMatrix,t._scalingRotationMatrix),t._scalingRotationMatrix.multiplyToRef(t._translationMatrix,t._transformMatrix),n=t._transformMatrix}switch(t.value.type){case ER.Geometry:var l=r.clone();return l.transform(n),l;case ER.Vector2:return c.I9.Transform(r,n);case ER.Vector3:return c.Pq.TransformCoordinates(r,n);case ER.Vector4:return c.IU.TransformCoordinates(r,n)}return null};this.evaluateContext?this.output._storedFunction=n:(this.output._storedFunction=null,this.output._storedValue=n(e))},t.prototype._dumpPropertiesCode=function(){return e.prototype._dumpPropertiesCode.call(this)+"".concat(this._codeVariableName,".evaluateContext = ").concat(this.evaluateContext?"true":"false",";\n")},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.evaluateContext=this.evaluateContext,t},t.prototype._deserialize=function(t){e.prototype._deserialize.call(this,t),void 0!==t.evaluateContext&&(this.evaluateContext=t.evaluateContext)},(0,f.Cg)([Jp("Evaluate context",0,"ADVANCED",{embedded:!0,notifiers:{rebuild:!0}})],t.prototype,"evaluateContext",void 0),t}(UR);(0,h.Y5)("BABYLON.GeometryTransformBlock",RA);var AA=function(e){function t(t){var n=e.call(this,t)||this;return n.registerInput("angle",ER.Float,!0,0),n.registerOutput("matrix",ER.Matrix),n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"RotationXBlock"},Object.defineProperty(t.prototype,"angle",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"matrix",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(t){var n=this;e.prototype._buildBlock.call(this,t),this.matrix._storedFunction=function(e){return c.uq.RotationX(n.angle.getConnectedValue(e))}},t}(UR);(0,h.Y5)("BABYLON.RotationXBlock",AA);var IA=function(e){function t(t){var n=e.call(this,t)||this;return n.registerInput("angle",ER.Float,!0,0),n.registerOutput("matrix",ER.Matrix),n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"RotationYBlock"},Object.defineProperty(t.prototype,"angle",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"matrix",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(t){var n=this;e.prototype._buildBlock.call(this,t),this.matrix._storedFunction=function(e){return c.uq.RotationY(n.angle.getConnectedValue(e))}},t}(UR);(0,h.Y5)("BABYLON.RotationYBlock",IA);var OA=function(e){function t(t){var n=e.call(this,t)||this;return n.registerInput("angle",ER.Float,!0,0),n.registerOutput("matrix",ER.Matrix),n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"RotationZBlock"},Object.defineProperty(t.prototype,"angle",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"matrix",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(t){var n=this;e.prototype._buildBlock.call(this,t),this.matrix._storedFunction=function(e){return c.uq.RotationZ(n.angle.getConnectedValue(e))}},t}(UR);(0,h.Y5)("BABYLON.RotationZBlock",OA);var MA=function(e){function t(t){var n=e.call(this,t)||this;return n.registerInput("scale",ER.Vector3,!1,c.Pq.One()),n.registerOutput("matrix",ER.Matrix),n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"ScalingBlock"},Object.defineProperty(t.prototype,"scale",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"matrix",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype.autoConfigure=function(){if(!this.scale.isConnected){var e=new zR("Scale");e.value=new c.Pq(1,1,1),e.output.connectTo(this.scale)}},t.prototype._buildBlock=function(t){var n=this;e.prototype._buildBlock.call(this,t),this.matrix._storedFunction=function(e){var t=n.scale.getConnectedValue(e);return c.uq.Scaling(t.x,t.y,t.z)}},t}(UR);(0,h.Y5)("BABYLON.ScalingBlock",MA);var DA=function(e){function t(t){var n=e.call(this,t)||this;return n.registerInput("source",ER.Vector3,!0,c.Pq.Up()),n.registerInput("target",ER.Vector3,!0,c.Pq.Left()),n.registerOutput("matrix",ER.Matrix),n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"AlignBlock"},Object.defineProperty(t.prototype,"source",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"target",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"matrix",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(t){var n=this;e.prototype._buildBlock.call(this,t),this.matrix._storedFunction=function(e){var t=n.source.getConnectedValue(e).clone(),r=n.target.getConnectedValue(e).clone(),i=new c.uq;return t.normalize(),r.normalize(),c.uq.RotationAlignToRef(t,r,i,!0),i}},t}(UR);(0,h.Y5)("BABYLON.AlignBlock",DA);var NA=function(e){function t(t){var n=e.call(this,t)||this;return n.registerInput("translation",ER.Vector3,!1,c.Pq.Zero()),n.registerOutput("matrix",ER.Matrix),n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"TranslationBlock"},Object.defineProperty(t.prototype,"translation",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"matrix",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype.autoConfigure=function(){if(!this.translation.isConnected){var e=new zR("Translation");e.value=new c.Pq(0,0,0),e.output.connectTo(this.translation)}},t.prototype._buildBlock=function(t){var n=this;e.prototype._buildBlock.call(this,t),this.matrix._storedFunction=function(e){var t=n.translation.getConnectedValue(e);return c.uq.Translation(t.x,t.y,t.z)}},t}(UR);(0,h.Y5)("BABYLON.TranslationBlock",NA);var FA=function(e){function t(t){var n=e.call(this,t)||this;return n._indexTranslation=null,n.evaluateContext=!0,n.removeDuplicatedPositions=!0,n.registerInput("geometry",ER.Geometry),n.registerInput("instance",ER.Geometry,!0),n.registerInput("density",ER.Float,!0,1,0,1),n.registerInput("matrix",ER.Matrix,!0),n.registerInput("offset",ER.Vector3,!0,c.Pq.Zero()),n.registerInput("rotation",ER.Vector3,!0,c.Pq.Zero()),n.registerInput("scaling",ER.Vector3,!0,c.Pq.One()),n.scaling.acceptedConnectionPointTypes.push(ER.Float),n.registerOutput("output",ER.Geometry),n}return(0,f.C6)(t,e),t.prototype.getInstanceIndex=function(){return this._currentLoopIndex},t.prototype.getExecutionIndex=function(){return this._indexTranslation?this._indexTranslation[this._currentIndex]:this._currentIndex},t.prototype.getExecutionLoopIndex=function(){return this._currentLoopIndex},t.prototype.getExecutionFaceIndex=function(){return 0},t.prototype.getClassName=function(){return"InstantiateOnVerticesBlock"},Object.defineProperty(t.prototype,"geometry",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"instance",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"density",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"matrix",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"offset",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotation",{get:function(){return this._inputs[5]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scaling",{get:function(){return this._inputs[6]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(e){var t=this,n=function(e){if(e.pushExecutionContext(t),e.pushInstancingContext(t),t._vertexData=t.geometry.getConnectedValue(e),e.pushGeometryContext(t._vertexData),!t._vertexData||!t._vertexData.positions||!t.instance.isConnected)return e.restoreExecutionContext(),e.restoreInstancingContext(),e.restoreGeometryContext(),void(t.output._storedValue=null);var n=t._vertexData.positions.length/3,r=[],i=new c.Pq,o=[],a=t._vertexData.positions;if(t._currentLoopIndex=0,t.removeDuplicatedPositions){for(t._indexTranslation={},t._currentIndex=0;t._currentIndexf)){i.fromArray(a,3*t._currentIndex);var m=p.clone();if(t.matrix.isConnected){var _=t.matrix.getConnectedValue(e);e._instantiateWithPositionAndMatrix(m,i,_,r)}else{var g=e.adaptInput(t.offset,ER.Vector3,c.Pq.ZeroReadOnly),v=e.adaptInput(t.scaling,ER.Vector3,c.Pq.OneReadOnly),y=t.rotation.getConnectedValue(e)||c.Pq.ZeroReadOnly;i.addInPlace(g),e._instantiate(m,i,y,v,r)}t._currentLoopIndex++}}}if(e.restoreGeometryContext(),e.restoreExecutionContext(),e.restoreInstancingContext(),!r.length)return null;if(1===r.length)t._vertexData=r[0];else{var b=r.splice(0,1)[0];t._vertexData=b.merge(r,!0,!1,!0,!0)}return t._vertexData};this.evaluateContext?this.output._storedFunction=n:(this.output._storedFunction=null,this.output._storedValue=n(e))},t.prototype._dumpPropertiesCode=function(){return e.prototype._dumpPropertiesCode.call(this)+"".concat(this._codeVariableName,".removeDuplicatedPositions = ").concat(this.removeDuplicatedPositions?"true":"false",";\n")+"".concat(this._codeVariableName,".evaluateContext = ").concat(this.evaluateContext?"true":"false",";\n")},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.removeDuplicatedPositions=this.removeDuplicatedPositions,t.evaluateContext=this.evaluateContext,t},t.prototype._deserialize=function(t){e.prototype._deserialize.call(this,t),this.removeDuplicatedPositions=t.removeDuplicatedPositions,void 0!==t.evaluateContext&&(this.evaluateContext=t.evaluateContext)},(0,f.Cg)([Jp("Evaluate context",0,"ADVANCED",{notifiers:{rebuild:!0}})],t.prototype,"evaluateContext",void 0),(0,f.Cg)([Jp("Remove duplicated positions",0,"ADVANCED",{notifiers:{update:!0}})],t.prototype,"removeDuplicatedPositions",void 0),t}(UR);(0,h.Y5)("BABYLON.InstantiateOnVerticesBlock",FA);var LA=function(e){function t(t){var n=e.call(this,t)||this;return n._currentPosition=new c.Pq,n._currentUV=new c.I9,n._vertex0=new c.Pq,n._vertex1=new c.Pq,n._vertex2=new c.Pq,n._tempVector0=new c.Pq,n._tempVector1=new c.Pq,n._uv0=new c.I9,n._uv1=new c.I9,n._uv2=new c.I9,n.evaluateContext=!0,n.registerInput("geometry",ER.Geometry),n.registerInput("instance",ER.Geometry,!0),n.registerInput("count",ER.Int,!0,256),n.registerInput("matrix",ER.Matrix,!0),n.registerInput("offset",ER.Vector3,!0,c.Pq.Zero()),n.registerInput("rotation",ER.Vector3,!0,c.Pq.Zero()),n.registerInput("scaling",ER.Vector3,!0,c.Pq.One()),n.scaling.acceptedConnectionPointTypes.push(ER.Float),n.registerOutput("output",ER.Geometry),n}return(0,f.C6)(t,e),t.prototype.getInstanceIndex=function(){return this._currentLoopIndex},t.prototype.getExecutionIndex=function(){return 0},t.prototype.getExecutionFaceIndex=function(){return this._currentFaceIndex},t.prototype.getExecutionLoopIndex=function(){return this._currentLoopIndex},t.prototype.getOverridePositionsContextualValue=function(){return this._currentPosition},t.prototype.getOverrideNormalsContextualValue=function(){return this._vertex1.subtractToRef(this._vertex0,this._tempVector0),this._vertex2.subtractToRef(this._vertex1,this._tempVector1),this._tempVector0.normalize(),this._tempVector1.normalize(),c.Pq.Cross(this._tempVector1,this._tempVector0)},t.prototype.getOverrideUVs1ContextualValue=function(){return this._currentUV},t.prototype.getClassName=function(){return"InstantiateOnFacesBlock"},Object.defineProperty(t.prototype,"geometry",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"instance",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"count",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"matrix",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"offset",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotation",{get:function(){return this._inputs[5]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scaling",{get:function(){return this._inputs[6]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(e){var t=this,n=function(e){if(e.pushExecutionContext(t),e.pushInstancingContext(t),t._vertexData=t.geometry.getConnectedValue(e),e.pushGeometryContext(t._vertexData),!(t._vertexData&&t._vertexData.positions&&t._vertexData.indices&&t.instance.isConnected))return e.restoreExecutionContext(),e.restoreInstancingContext(),e.restoreGeometryContext(),void(t.output._storedValue=null);var n=null,r=t.count.getConnectedValue(e),i=t._vertexData.indices.length/3,o=r/i,a=0,s=[],l=0;for(t._currentLoopIndex=0,t._currentFaceIndex=0;t._currentFaceIndex=r);f++){var m=Math.random(),_=Math.random();if(m>_){var g=m;m=_,_=g}var v=m,y=_-m,b=1-v-y;if(t._currentPosition.set(v*t._vertex0.x+y*t._vertex1.x+b*t._vertex2.x,v*t._vertex0.y+y*t._vertex1.y+b*t._vertex2.y,v*t._vertex0.z+y*t._vertex1.z+b*t._vertex2.z),t._vertexData.uvs&&t._currentUV.set(v*t._uv0.x+y*t._uv1.x+b*t._uv2.x,v*t._uv0.y+y*t._uv1.y+b*t._uv2.y),(n=t.instance.getConnectedValue(e))&&n.positions&&0!==n.positions.length){var S=n.clone();if(t.matrix.isConnected){var T=t.matrix.getConnectedValue(e);e._instantiateWithPositionAndMatrix(S,t._currentPosition,T,s)}else{var E=e.adaptInput(t.offset,ER.Vector3,c.Pq.ZeroReadOnly),x=e.adaptInput(t.scaling,ER.Vector3,c.Pq.OneReadOnly),P=t.rotation.getConnectedValue(e)||c.Pq.ZeroReadOnly;t._currentPosition.addInPlace(E),e._instantiate(S,t._currentPosition,P,x,s)}l++,t._currentLoopIndex++}else a-=o}}}if(s.length)if(1===s.length)t._vertexData=s[0];else{var C=s.splice(0,1)[0];t._vertexData=C.merge(s,!0,!1,!0,!0)}return e.restoreExecutionContext(),e.restoreInstancingContext(),e.restoreGeometryContext(),t._vertexData};this.evaluateContext?this.output._storedFunction=n:(this.output._storedFunction=null,this.output._storedValue=n(e))},t.prototype._dumpPropertiesCode=function(){return e.prototype._dumpPropertiesCode.call(this)+"".concat(this._codeVariableName,".evaluateContext = ").concat(this.evaluateContext?"true":"false",";\n")},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.evaluateContext=this.evaluateContext,t},t.prototype._deserialize=function(t){e.prototype._deserialize.call(this,t),void 0!==t.evaluateContext&&(this.evaluateContext=t.evaluateContext)},(0,f.Cg)([Jp("Evaluate context",0,"ADVANCED",{notifiers:{rebuild:!0}})],t.prototype,"evaluateContext",void 0),t}(UR);(0,h.Y5)("BABYLON.InstantiateOnFacesBlock",LA);var wA=function(e){function t(t){var n=e.call(this,t)||this;return n._currentPosition=new c.Pq,n._vertex0=new c.Pq,n._vertex1=new c.Pq,n._vertex2=new c.Pq,n.evaluateContext=!0,n.gridMode=!1,n.registerInput("geometry",ER.Geometry),n.registerInput("instance",ER.Geometry,!0),n.registerInput("count",ER.Int,!0,256),n.registerInput("matrix",ER.Matrix,!0),n.registerInput("offset",ER.Vector3,!0,c.Pq.Zero()),n.registerInput("rotation",ER.Vector3,!0,c.Pq.Zero()),n.registerInput("scaling",ER.Vector3,!0,c.Pq.One()),n.registerInput("gridSize",ER.Int,!0,10),n.scaling.acceptedConnectionPointTypes.push(ER.Float),n.registerOutput("output",ER.Geometry),n}return(0,f.C6)(t,e),t.prototype.getInstanceIndex=function(){return this._currentLoopIndex},t.prototype.getExecutionIndex=function(){return 0},t.prototype.getExecutionFaceIndex=function(){return 0},t.prototype.getExecutionLoopIndex=function(){return this._currentLoopIndex},t.prototype.getOverridePositionsContextualValue=function(){return this._currentPosition},t.prototype.getClassName=function(){return"InstantiateOnVolumeBlock"},Object.defineProperty(t.prototype,"geometry",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"instance",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"count",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"matrix",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"offset",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotation",{get:function(){return this._inputs[5]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scaling",{get:function(){return this._inputs[6]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"gridSize",{get:function(){return this._inputs[6]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype._getValueOnGrid=function(e,t,n,r){var i=(r-n)/t;return n+i/2+e*i},t.prototype._getIndexinGrid=function(e,t,n,r){return e+t*r+n*r*r},t.prototype._buildBlock=function(e){var t=this,n=function(e){if(e.pushExecutionContext(t),e.pushInstancingContext(t),t._vertexData=t.geometry.getConnectedValue(e),e.pushGeometryContext(t._vertexData),!(t._vertexData&&t._vertexData.positions&&t._vertexData.indices&&t.instance.isConnected))return e.restoreExecutionContext(),e.restoreInstancingContext(),e.restoreGeometryContext(),void(t.output._storedValue=null);var n,r=null,i=t.count.getConnectedValue(e),o=[],a=(0,pe.b8)(t._vertexData.positions,0,t._vertexData.positions.length/3),s=a.minimum,l=a.maximum,u=new c.Pq(.5,.8,.2),h=t._vertexData.indices.length/3,d=t.gridSize.getConnectedValue(e);if(t._currentLoopIndex=0,t.gridMode){n=[];for(var p=0;p0&&x++}if(x%2!=0){if((r=t.instance.getConnectedValue(e))&&r.positions&&0!==r.positions.length){var R=r.clone();if(t.matrix.isConnected){var A=t.matrix.getConnectedValue(e);e._instantiateWithPositionAndMatrix(R,t._currentPosition,A,o)}else{var I=e.adaptInput(t.offset,ER.Vector3,c.Pq.ZeroReadOnly),O=e.adaptInput(t.scaling,ER.Vector3,c.Pq.OneReadOnly),M=t.rotation.getConnectedValue(e)||c.Pq.ZeroReadOnly;t._currentPosition.addInPlace(I),e._instantiate(R,t._currentPosition,M,O,o)}t._currentLoopIndex++}}else p--}if(o.length)if(1===o.length)t._vertexData=o[0];else{var D=o.splice(0,1)[0];t._vertexData=D.merge(o,!0,!1,!0,!0)}return e.restoreGeometryContext(),e.restoreExecutionContext(),e.restoreInstancingContext(),t._vertexData};this.evaluateContext?this.output._storedFunction=n:(this.output._storedFunction=null,this.output._storedValue=n(e))},t.prototype._dumpPropertiesCode=function(){return e.prototype._dumpPropertiesCode.call(this)+"".concat(this._codeVariableName,".evaluateContext = ").concat(this.evaluateContext?"true":"false",";\n")+"".concat(this._codeVariableName,".gridMode = ").concat(this.gridMode?"true":"false",";\n")},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.evaluateContext=this.evaluateContext,t.gridMode=this.gridMode,t},t.prototype._deserialize=function(t){e.prototype._deserialize.call(this,t),void 0!==t.evaluateContext&&(this.evaluateContext=t.evaluateContext),void 0!==t.gridMode&&(this.gridMode=t.gridMode)},(0,f.Cg)([Jp("Evaluate context",0,"ADVANCED",{notifiers:{rebuild:!0}})],t.prototype,"evaluateContext",void 0),(0,f.Cg)([Jp("Grid mode",0,"MODES",{notifiers:{rebuild:!0}})],t.prototype,"gridMode",void 0),t}(UR);(0,h.Y5)("BABYLON.InstantiateOnVolumeBlock",wA);var BA=function(e){function t(t){var n=e.call(this,t)||this;return n.evaluateContext=!0,n.registerInput("instance",ER.Geometry,!0),n.registerInput("count",ER.Int,!0,1),n.registerOutput("output",ER.Geometry),n}return(0,f.C6)(t,e),t.prototype.getInstanceIndex=function(){return this._currentIndex},t.prototype.getExecutionIndex=function(){return this._currentIndex},t.prototype.getExecutionLoopIndex=function(){return this._currentIndex},t.prototype.getExecutionFaceIndex=function(){return 0},t.prototype.getClassName=function(){return"InstantiateBaseBlock"},Object.defineProperty(t.prototype,"instance",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"count",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype._dumpPropertiesCode=function(){return e.prototype._dumpPropertiesCode.call(this)+"".concat(this._codeVariableName,".evaluateContext = ").concat(this.evaluateContext?"true":"false",";\n")},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.evaluateContext=this.evaluateContext,t},t.prototype._deserialize=function(t){e.prototype._deserialize.call(this,t),void 0!==t.evaluateContext&&(this.evaluateContext=t.evaluateContext)},(0,f.Cg)([Jp("Evaluate context",0,"ADVANCED",{embedded:!0,notifiers:{rebuild:!0}})],t.prototype,"evaluateContext",void 0),t}(UR),VA=function(e){function t(t){var n=e.call(this,t)||this;return n.registerInput("matrix",ER.Matrix,!0),n.registerInput("position",ER.Vector3,!0,c.Pq.Zero()),n.registerInput("rotation",ER.Vector3,!0,c.Pq.Zero()),n.registerInput("scaling",ER.Vector3,!0,c.Pq.One()),n.scaling.acceptedConnectionPointTypes.push(ER.Float),n}return(0,f.C6)(t,e),t.prototype.getInstanceIndex=function(){return this._currentIndex},t.prototype.getExecutionIndex=function(){return this._currentIndex},t.prototype.getExecutionLoopIndex=function(){return this._currentIndex},t.prototype.getExecutionFaceIndex=function(){return 0},t.prototype.getClassName=function(){return"InstantiateBlock"},Object.defineProperty(t.prototype,"matrix",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"position",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotation",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scaling",{get:function(){return this._inputs[5]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(e){var t=this,n=function(e){e.pushExecutionContext(t),e.pushInstancingContext(t);var n=t.count.getConnectedValue(e),r=[];for(t._currentIndex=0;t._currentIndex0&&(a.x=Math.acos(t.y/s)/Math.PI,0===t.x&&0===t.z||(a.y=Math.atan2(t.x,t.z)/(2*Math.PI)));break;case WA.Cylindrical:var s;r.subtractToRef(o,t),(s=t.length())>0&&(a.x=Math.atan2(t.x/s,t.z/s)/(2*Math.PI),a.y=(t.y+1)/2);break;case WA.Cubic:var l=Math.abs(i.x),u=Math.abs(i.y),h=Math.abs(i.z),d=Math.max(Math.abs(r.x),Math.abs(r.y),Math.abs(r.z)),p=0,f=0;l>=u&&l>=h?(p=r.y/d-o.y,f=r.z/d-o.z):u>=l&&u>=h?(p=r.x/d-o.x,f=r.z/d-o.z):(p=r.x/d-o.x,f=r.y/d-o.y),a.x=(p+1)/2,a.y=(f+1)/2}return a}(n)}},t.prototype._dumpPropertiesCode=function(){return e.prototype._dumpPropertiesCode.call(this)+"".concat(this._codeVariableName,".mapping = BABYLON.MappingTypes.").concat(WA[this.mapping],";\n")},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.mapping=this.mapping,t},t.prototype._deserialize=function(t){e.prototype._deserialize.call(this,t),this.mapping=t.mapping},(0,f.Cg)([Jp("Mapping",5,"ADVANCED",{notifiers:{rebuild:!0},embedded:!0,options:[{label:"Spherical",value:WA.Spherical},{label:"Cylindrical",value:WA.Cylindrical},{label:"Cubic",value:WA.Cubic}]})],t.prototype,"mapping",void 0),t}(UR);(0,h.Y5)("BABYLON.MappingBlock",YA);var XA=function(e){function t(t){var n=e.call(this,t)||this;return n.registerInput("matrix0",ER.Matrix),n.registerInput("matrix1",ER.Matrix),n.registerOutput("output",ER.Matrix),n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"MatrixComposeBlock"},Object.defineProperty(t.prototype,"matrix0",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"matrix1",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(){var e=this;this.output._storedFunction=function(t){if(!e.matrix0.isConnected||!e.matrix1.isConnected)return null;var n=e.matrix0.getConnectedValue(t),r=e.matrix1.getConnectedValue(t);return n&&r?n.multiply(r):null}},t}(UR);(0,h.Y5)("BABYLON.MatrixComposeBlock",XA);var jA=function(e){function t(t){var n=e.call(this,t)||this;return n._endpoints=[],n._isTeleportIn=!0,n.registerInput("input",ER.AutoDetect),n}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"endpoints",{get:function(){return this._endpoints},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"TeleportInBlock"},Object.defineProperty(t.prototype,"input",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),t.prototype._dumpCode=function(t,n){for(var r=e.prototype._dumpCode.call(this,t,n),i=0,o=this.endpoints;i "+this.name},t.prototype.detachFromEndpoint=function(e){var t=this._endpoints.indexOf(e);-1!==t&&(this._endpoints.splice(t,1),e._outputs[0]._typeConnectionSource=null,e._entryPoint=null)},t.prototype._buildBlock=function(){for(var e=this,t=0,n=this._endpoints;t=0?e%1:1-Math.abs(e)%1},t.prototype._lerp=function(e,t,n){return new c.IU(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n,e.z*(1-n)+t.z*n,e.w*(1-n)+t.w*n)},t.prototype._getPixel=function(e,t,n,r){var i=4*(t*r+e);return new c.IU(n[i],n[i+1],n[i+2],n[i+3])},t.prototype._buildBlock=function(){var e=this,t=function(t){var n=e.texture.getConnectedValue(t);if(!n||!n.data)return null;var r=e.coordinates.getConnectedValue(t);if(!r)return null;var i=e.clampCoordinates?Math.max(0,Math.min(r.x,1)):e._repeatClamp(r.x),o=e.clampCoordinates?Math.max(0,Math.min(r.y,1)):e._repeatClamp(r.y),a=n.width,s=n.height,l=n.data,c=i*(a-1),u=o*(s-1);if(e.interpolation){var h=Math.floor(c),d=Math.floor(u),p=Math.min(h+1,a-1),f=Math.min(d+1,s-1),m=c-h,_=u-d,g=e._getPixel(h,d,l,a),v=e._getPixel(p,d,l,a),y=e._getPixel(h,f,l,a),b=e._getPixel(p,f,l,a),S=e._lerp(g,v,m),T=e._lerp(y,b,m);return e._lerp(S,T,_)}return e._getPixel(Math.floor(c),Math.floor(u),l,a)};this.rgba._storedFunction=function(e){return t(e)},this.rgb._storedFunction=function(e){var n=t(e);return n?n.toVector3():null},this.r._storedFunction=function(e){var n=t(e);return n?n.x:null},this.g._storedFunction=function(e){var n=t(e);return n?n.y:null},this.b._storedFunction=function(e){var n=t(e);return n?n.z:null},this.a._storedFunction=function(e){var n=t(e);return n?n.w:null}},t.prototype._dumpPropertiesCode=function(){return e.prototype._dumpPropertiesCode.call(this)+"".concat(this._codeVariableName,".clampCoordinates = ").concat(this.clampCoordinates,";\n")},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.clampCoordinates=this.clampCoordinates,t.interpolation=this.interpolation,t},t.prototype._deserialize=function(t){e.prototype._deserialize.call(this,t),this.clampCoordinates=t.clampCoordinates,void 0===t.clampCoordinates&&(this.interpolation=t.interpolation)},(0,f.Cg)([Jp("Clamp Coordinates",0,"ADVANCED",{embedded:!0,notifiers:{rebuild:!0}})],t.prototype,"clampCoordinates",void 0),(0,f.Cg)([Jp("Interpolation",0,"ADVANCED",{embedded:!0,notifiers:{rebuild:!0}})],t.prototype,"interpolation",void 0),t}(UR);(0,h.Y5)("BABYLON.GeometryTextureFetchBlock",ZA);var QA,JA=function(e){function t(t){var n=e.call(this,t)||this;return n.registerInput("geometry",ER.Geometry),n.registerOutput("min",ER.Vector3),n.registerOutput("max",ER.Vector3),n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"BoundingBlock"},Object.defineProperty(t.prototype,"geometry",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"min",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"max",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(){var e=this;this.min._storedFunction=function(t){var n=e.geometry.getConnectedValue(t);return n?(0,pe.b8)(n.positions,0,n.positions.length/3).minimum:null},this.max._storedFunction=function(t){var n=e.geometry.getConnectedValue(t);return n?(0,pe.b8)(n.positions,0,n.positions.length/3).maximum:null}},t}(UR);(0,h.Y5)("BABYLON.BoundingBlock",JA),function(e){e[e.Intersect=0]="Intersect",e[e.Subtract=1]="Subtract",e[e.Union=2]="Union"}(QA||(QA={}));var $A=function(e){function t(t){var n=e.call(this,t)||this;return n.evaluateContext=!1,n.operation=QA.Intersect,n.useOldCSGEngine=!1,n.registerInput("geometry0",ER.Geometry),n.registerInput("geometry1",ER.Geometry),n.registerOutput("output",ER.Geometry),n}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"_isReadyState",{get:function(){return SR()?null:(this._csg2LoadingPromise||(this._csg2LoadingPromise=TR()),this._csg2LoadingPromise)},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"BooleanGeometryBlock"},Object.defineProperty(t.prototype,"geometry0",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"geometry1",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(e){var t=this,n=function(e){var n=t.geometry0.getConnectedValue(e),r=t.geometry1.getConnectedValue(e);if(!n||!r)return null;var i,o=n.positions.length/3;if(!n.normals&&r.normals&&(n.normals=new Array(n.positions.length)),!r.normals&&n.normals&&(r.normals=new Array(r.positions.length)),!n.uvs&&r.uvs&&(n.uvs=new Array(2*o)),!r.uvs&&n.uvs&&(r.uvs=new Array(2*o)),!n.colors&&r.colors&&(n.colors=new Array(4*o)),!r.colors&&n.colors&&(r.colors=new Array(4*o)),t.useOldCSGEngine){var a=BC.FromVertexData(n),s=BC.FromVertexData(r);switch(t.operation){case QA.Intersect:i=a.intersect(s);break;case QA.Subtract:i=a.subtract(s);break;case QA.Union:i=a.union(s)}}else switch(a=bR.FromVertexData(n),s=bR.FromVertexData(r),t.operation){case QA.Intersect:i=a.intersect(s);break;case QA.Subtract:i=a.subtract(s);break;case QA.Union:i=a.add(s)}return i.toVertexData()};this.evaluateContext?this.output._storedFunction=n:(this.output._storedFunction=null,this.output._storedValue=n(e))},t.prototype._dumpPropertiesCode=function(){var t=e.prototype._dumpPropertiesCode.call(this)+"".concat(this._codeVariableName,".evaluateContext = ").concat(this.evaluateContext?"true":"false",";\n");return(t+="".concat(this._codeVariableName,".operation = BABYLON.BooleanGeometryOperations.").concat(QA[this.operation],";\n"))+"".concat(this._codeVariableName,".useOldCSGEngine = ").concat(this.useOldCSGEngine?"true":"false",";\n")},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.evaluateContext=this.evaluateContext,t.operation=this.operation,t.useOldCSGEngine=this.useOldCSGEngine,t},t.prototype._deserialize=function(t){e.prototype._deserialize.call(this,t),this.evaluateContext=t.evaluateContext,t.operation&&(this.operation=t.operation),this.useOldCSGEngine=!!t.useOldCSGEngine},(0,f.Cg)([Jp("Evaluate context",0,"ADVANCED",{embedded:!0,notifiers:{rebuild:!0}})],t.prototype,"evaluateContext",void 0),(0,f.Cg)([Jp("Operation",5,"ADVANCED",{notifiers:{rebuild:!0},embedded:!0,options:[{label:"Intersect",value:QA.Intersect},{label:"Subtract",value:QA.Subtract},{label:"Union",value:QA.Union}]})],t.prototype,"operation",void 0),(0,f.Cg)([Jp("Use old CSG engine",0,"ADVANCED",{embedded:!0,notifiers:{rebuild:!0}})],t.prototype,"useOldCSGEngine",void 0),t}(UR);(0,h.Y5)("BABYLON.BooleanGeometryBlock",$A);var eI=function(e){function t(t){var n=e.call(this,t)||this;return n.registerInput("x",ER.AutoDetect),n.registerInput("y",ER.AutoDetect),n.registerOutput("output",ER.BasedOnInput),n._outputs[0]._typeConnectionSource=n._inputs[0],n._linkConnectionTypes(0,1),n._inputs[0].excludedConnectionPointTypes.push(ER.Matrix),n._inputs[0].excludedConnectionPointTypes.push(ER.Geometry),n._inputs[0].excludedConnectionPointTypes.push(ER.Texture),n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"GeometryArcTan2Block"},Object.defineProperty(t.prototype,"x",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"y",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(){var e=this;if(!this.x.isConnected||!this.y.isConnected)return this.output._storedFunction=null,void(this.output._storedValue=null);var t=function(e,t){return Math.atan2(e,t)};this.output._storedFunction=function(n){var r=e.x.getConnectedValue(n),i=e.y.getConnectedValue(n);switch(e.x.type){case ER.Int:case ER.Float:return t(r,i);case ER.Vector2:return new c.I9(t(r.x,i.x),t(r.y,i.y));case ER.Vector3:return new c.Pq(t(r.x,i.x),t(r.y,i.y),t(r.z,i.z));case ER.Vector4:return new c.IU(t(r.x,i.x),t(r.y,i.y),t(r.z,i.z),t(r.w,i.w))}return 0}},t}(UR);(0,h.Y5)("BABYLON.GeometryArcTan2Block",eI);var tI=function(e){function t(t){var n=e.call(this,t)||this;return n.registerInput("left",ER.AutoDetect),n.registerInput("right",ER.AutoDetect),n.registerInput("gradient",ER.Float,!0,0,0,1),n.registerOutput("output",ER.BasedOnInput),n._outputs[0]._typeConnectionSource=n._inputs[0],n._linkConnectionTypes(0,1),n._inputs[0].excludedConnectionPointTypes.push(ER.Matrix),n._inputs[0].excludedConnectionPointTypes.push(ER.Geometry),n._inputs[0].excludedConnectionPointTypes.push(ER.Texture),n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"GeometryLerpBlock"},Object.defineProperty(t.prototype,"left",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"gradient",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(){var e=this;if(!this.left.isConnected||!this.right.isConnected)return this.output._storedFunction=null,void(this.output._storedValue=null);var t=function(e,t,n){return(1-e)*t+e*n};return this.output._storedFunction=function(n){var r=e.left.getConnectedValue(n),i=e.right.getConnectedValue(n),o=e.gradient.getConnectedValue(n);switch(e.left.type){case ER.Int:case ER.Float:return t(o,r,i);case ER.Vector2:return new c.I9(t(o,r.x,i.x),t(o,r.y,i.y));case ER.Vector3:return new c.Pq(t(o,r.x,i.x),t(o,r.y,i.y),t(o,r.z,i.z));case ER.Vector4:return new c.IU(t(o,r.x,i.x),t(o,r.y,i.y),t(o,r.z,i.z),t(o,r.w,i.w))}return 0},this},t}(UR);(0,h.Y5)("BABYLON.GeometryLerpBlock",tI);var nI=function(e){function t(t){var n=e.call(this,t)||this;return n.registerInput("left",ER.AutoDetect),n.registerInput("right",ER.AutoDetect),n.registerInput("gradient",ER.Float,!0,0,0,1),n.registerOutput("output",ER.BasedOnInput),n._outputs[0]._typeConnectionSource=n._inputs[0],n._linkConnectionTypes(0,1),n._inputs[0].excludedConnectionPointTypes.push(ER.Matrix),n._inputs[0].excludedConnectionPointTypes.push(ER.Geometry),n._inputs[0].excludedConnectionPointTypes.push(ER.Texture),n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"GeometryNLerpBlock"},Object.defineProperty(t.prototype,"left",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"gradient",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(){var e=this;if(!this.left.isConnected||!this.right.isConnected)return this.output._storedFunction=null,void(this.output._storedValue=null);var t=function(e,t,n){return(1-e)*t+e*n};return this.output._storedFunction=function(n){var r=e.left.getConnectedValue(n),i=e.right.getConnectedValue(n),o=e.gradient.getConnectedValue(n);switch(e.left.type){case ER.Int:case ER.Float:return t(o,r,i);case ER.Vector2:return(a=new c.I9(t(o,r.x,i.x),t(o,r.y,i.y))).normalize(),a;case ER.Vector3:return(a=new c.Pq(t(o,r.x,i.x),t(o,r.y,i.y),t(o,r.z,i.z))).normalize(),a;case ER.Vector4:var a;return(a=new c.IU(t(o,r.x,i.x),t(o,r.y,i.y),t(o,r.z,i.z),t(o,r.w,i.w))).normalize(),a}return 0},this},t}(UR);(0,h.Y5)("BABYLON.GeometryNLerpBlock",nI);var rI=function(e){function t(t){var n=e.call(this,t)||this;return n.registerInput("value",ER.AutoDetect),n.registerInput("edge",ER.Float,!0,0),n.registerOutput("output",ER.BasedOnInput),n._outputs[0]._typeConnectionSource=n._inputs[0],n._inputs[0].excludedConnectionPointTypes.push(ER.Matrix),n._inputs[0].excludedConnectionPointTypes.push(ER.Geometry),n._inputs[0].excludedConnectionPointTypes.push(ER.Texture),n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"GeometryStepBlock"},Object.defineProperty(t.prototype,"value",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"edge",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(){var e=this;if(!this.value.isConnected)return this.output._storedFunction=null,void(this.output._storedValue=null);var t=function(e,t){return e>>21,11),t.y=CI(e>>>11,10),t.z=CI(e,11)},AI=function(e,t){t[0]=255*CI(e>>>24,8),t[1]=255*CI(e>>>16,8),t[2]=255*CI(e>>>8,8),t[3]=255*CI(e,8)},II=function(e,t){var n=1/(.5*Math.sqrt(2)),r=(CI(e>>>20,10)-.5)*n,i=(CI(e>>>10,10)-.5)*n,o=(CI(e,10)-.5)*n,a=Math.sqrt(1-(r*r+i*i+o*o));switch(e>>>30){case 0:t.set(a,r,i,o);break;case 1:t.set(r,a,i,o);break;case 2:t.set(r,i,a,o);break;case 3:t.set(r,i,o,a)}};!function(e){e[e.FLOAT=0]="FLOAT",e[e.INT=1]="INT",e[e.UINT=2]="UINT",e[e.DOUBLE=3]="DOUBLE",e[e.UCHAR=4]="UCHAR",e[e.UNDEFINED=5]="UNDEFINED"}(xI||(xI={})),function(e){e[e.MIN_X=0]="MIN_X",e[e.MIN_Y=1]="MIN_Y",e[e.MIN_Z=2]="MIN_Z",e[e.MAX_X=3]="MAX_X",e[e.MAX_Y=4]="MAX_Y",e[e.MAX_Z=5]="MAX_Z",e[e.MIN_SCALE_X=6]="MIN_SCALE_X",e[e.MIN_SCALE_Y=7]="MIN_SCALE_Y",e[e.MIN_SCALE_Z=8]="MIN_SCALE_Z",e[e.MAX_SCALE_X=9]="MAX_SCALE_X",e[e.MAX_SCALE_Y=10]="MAX_SCALE_Y",e[e.MAX_SCALE_Z=11]="MAX_SCALE_Z",e[e.PACKED_POSITION=12]="PACKED_POSITION",e[e.PACKED_ROTATION=13]="PACKED_ROTATION",e[e.PACKED_SCALE=14]="PACKED_SCALE",e[e.PACKED_COLOR=15]="PACKED_COLOR",e[e.X=16]="X",e[e.Y=17]="Y",e[e.Z=18]="Z",e[e.SCALE_0=19]="SCALE_0",e[e.SCALE_1=20]="SCALE_1",e[e.SCALE_2=21]="SCALE_2",e[e.DIFFUSE_RED=22]="DIFFUSE_RED",e[e.DIFFUSE_GREEN=23]="DIFFUSE_GREEN",e[e.DIFFUSE_BLUE=24]="DIFFUSE_BLUE",e[e.OPACITY=25]="OPACITY",e[e.F_DC_0=26]="F_DC_0",e[e.F_DC_1=27]="F_DC_1",e[e.F_DC_2=28]="F_DC_2",e[e.F_DC_3=29]="F_DC_3",e[e.ROT_0=30]="ROT_0",e[e.ROT_1=31]="ROT_1",e[e.ROT_2=32]="ROT_2",e[e.ROT_3=33]="ROT_3",e[e.MIN_COLOR_R=34]="MIN_COLOR_R",e[e.MIN_COLOR_G=35]="MIN_COLOR_G",e[e.MIN_COLOR_B=36]="MIN_COLOR_B",e[e.MAX_COLOR_R=37]="MAX_COLOR_R",e[e.MAX_COLOR_G=38]="MAX_COLOR_G",e[e.MAX_COLOR_B=39]="MAX_COLOR_B",e[e.SH_0=40]="SH_0",e[e.SH_1=41]="SH_1",e[e.SH_2=42]="SH_2",e[e.SH_3=43]="SH_3",e[e.SH_4=44]="SH_4",e[e.SH_5=45]="SH_5",e[e.SH_6=46]="SH_6",e[e.SH_7=47]="SH_7",e[e.SH_8=48]="SH_8",e[e.SH_9=49]="SH_9",e[e.SH_10=50]="SH_10",e[e.SH_11=51]="SH_11",e[e.SH_12=52]="SH_12",e[e.SH_13=53]="SH_13",e[e.SH_14=54]="SH_14",e[e.SH_15=55]="SH_15",e[e.SH_16=56]="SH_16",e[e.SH_17=57]="SH_17",e[e.SH_18=58]="SH_18",e[e.SH_19=59]="SH_19",e[e.SH_20=60]="SH_20",e[e.SH_21=61]="SH_21",e[e.SH_22=62]="SH_22",e[e.SH_23=63]="SH_23",e[e.SH_24=64]="SH_24",e[e.SH_25=65]="SH_25",e[e.SH_26=66]="SH_26",e[e.SH_27=67]="SH_27",e[e.SH_28=68]="SH_28",e[e.SH_29=69]="SH_29",e[e.SH_30=70]="SH_30",e[e.SH_31=71]="SH_31",e[e.SH_32=72]="SH_32",e[e.SH_33=73]="SH_33",e[e.SH_34=74]="SH_34",e[e.SH_35=75]="SH_35",e[e.SH_36=76]="SH_36",e[e.SH_37=77]="SH_37",e[e.SH_38=78]="SH_38",e[e.SH_39=79]="SH_39",e[e.SH_40=80]="SH_40",e[e.SH_41=81]="SH_41",e[e.SH_42=82]="SH_42",e[e.SH_43=83]="SH_43",e[e.SH_44=84]="SH_44",e[e.UNDEFINED=85]="UNDEFINED"}(PI||(PI={}));var OI,MI=function(e){function t(t,n,r,i){void 0===n&&(n=null),void 0===r&&(r=null),void 0===i&&(i=!1);var o=e.call(this,t,r)||this;o._vertexCount=0,o._worker=null,o._frameIdLastUpdate=-1,o._modelViewMatrix=c.uq.Identity(),o._canPostToWorker=!0,o._readyToDisplay=!1,o._covariancesATexture=null,o._covariancesBTexture=null,o._centersTexture=null,o._colorsTexture=null,o._splatPositions=null,o._splatIndex=null,o._shTextures=null,o._splatsData=null,o._sh=null,o._keepInRam=!1,o._delayedTextureUpdate=null,o._oldDirection=new c.Pq,o._useRGBACovariants=!1,o._material=null,o._tmpCovariances=[0,0,0,0,0,0],o._sortIsDirty=!1,o._shDegree=0,o._viewDirectionFactor=new c.Pq(1,1,-1);var a=new ge;return a.positions=[-2,-2,0,2,-2,0,2,2,0,-2,2,0],a.indices=[0,1,2,0,2,3],a.applyToMesh(o),o.subMeshes=[],new me(0,0,4,0,6,o),o.setEnabled(!1),o._useRGBACovariants=!o.getEngine().isWebGPU&&1===o.getEngine().version,o._keepInRam=i,n&&o.loadFileAsync(n),o._material=new RT(o.name+"_material",o._scene),o}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"viewDirectionFactor",{get:function(){return this._viewDirectionFactor},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shDegree",{get:function(){return this._shDegree},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"splatCount",{get:function(){var e;return null===(e=this._splatIndex)||void 0===e?void 0:e.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"splatsData",{get:function(){return this._splatsData},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"covariancesATexture",{get:function(){return this._covariancesATexture},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"covariancesBTexture",{get:function(){return this._covariancesBTexture},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"centersTexture",{get:function(){return this._centersTexture},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"colorsTexture",{get:function(){return this._colorsTexture},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shTextures",{get:function(){return this._shTextures},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"kernelSize",{get:function(){return this._material instanceof RT?this._material.kernelSize:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"compensation",{get:function(){return this._material instanceof RT&&this._material.compensation},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"material",{get:function(){return this._material},set:function(e){this._material=e,this._material.backFaceCulling=!0,this._material.cullBackFaces=!1,e.resetDrawCache()},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"GaussianSplattingMesh"},t.prototype.getTotalVertices=function(){return this._vertexCount},t.prototype.isReady=function(t){return void 0===t&&(t=!1),!(!e.prototype.isReady.call(this,t,!0)||!this._readyToDisplay&&(this._postToWorker(!0),1))},t.prototype._postToWorker=function(e){void 0===e&&(e=!1);var t=this.getScene().getFrameId();if((e||t!==this._frameIdLastUpdate)&&this._worker&&this._scene.activeCamera&&this._canPostToWorker){var n=this._scene.activeCamera.getViewMatrix();this.getWorldMatrix().multiplyToRef(n,this._modelViewMatrix),n.invertToRef(c.AA.Matrix[0]),this.getWorldMatrix().multiplyToRef(c.AA.Matrix[0],c.AA.Matrix[1]),c.Pq.TransformNormalToRef(c.Pq.Forward(this._scene.useRightHandedSystem),c.AA.Matrix[1],c.AA.Vector3[2]),c.AA.Vector3[2].normalize();var r=c.Pq.Dot(c.AA.Vector3[2],this._oldDirection);(e||Math.abs(r-1)>=.01)&&(this._oldDirection.copyFrom(c.AA.Vector3[2]),this._frameIdLastUpdate=t,this._canPostToWorker=!1,this._worker.postMessage({view:this._modelViewMatrix.m,depthMix:this._depthMix,useRightHandedSystem:this._scene.useRightHandedSystem},[this._depthMix.buffer]))}},t.prototype.render=function(t,n,r){return this._postToWorker(),e.prototype.render.call(this,t,n,r)},t._TypeNameToEnum=function(e){switch(e){case"float":return 0;case"int":return 1;case"uint":return 2;case"double":return 3;case"uchar":return 4}return 5},t._ValueNameToEnum=function(e){switch(e){case"min_x":return 0;case"min_y":return 1;case"min_z":return 2;case"max_x":return 3;case"max_y":return 4;case"max_z":return 5;case"min_scale_x":return 6;case"min_scale_y":return 7;case"min_scale_z":return 8;case"max_scale_x":return 9;case"max_scale_y":return 10;case"max_scale_z":return 11;case"packed_position":return 12;case"packed_rotation":return 13;case"packed_scale":return 14;case"packed_color":return 15;case"x":return 16;case"y":return 17;case"z":return 18;case"scale_0":return 19;case"scale_1":return 20;case"scale_2":return 21;case"diffuse_red":case"red":return 22;case"diffuse_green":case"green":return 23;case"diffuse_blue":case"blue":return 24;case"f_dc_0":return 26;case"f_dc_1":return 27;case"f_dc_2":return 28;case"f_dc_3":return 29;case"opacity":return 25;case"rot_0":return 30;case"rot_1":return 31;case"rot_2":return 32;case"rot_3":return 33;case"min_r":return 34;case"min_g":return 35;case"min_b":return 36;case"max_r":return 37;case"max_g":return 38;case"max_b":return 39;case"f_rest_0":return 40;case"f_rest_1":return 41;case"f_rest_2":return 42;case"f_rest_3":return 43;case"f_rest_4":return 44;case"f_rest_5":return 45;case"f_rest_6":return 46;case"f_rest_7":return 47;case"f_rest_8":return 48;case"f_rest_9":return 49;case"f_rest_10":return 50;case"f_rest_11":return 51;case"f_rest_12":return 52;case"f_rest_13":return 53;case"f_rest_14":return 54;case"f_rest_15":return 55;case"f_rest_16":return 56;case"f_rest_17":return 57;case"f_rest_18":return 58;case"f_rest_19":return 59;case"f_rest_20":return 60;case"f_rest_21":return 61;case"f_rest_22":return 62;case"f_rest_23":return 63;case"f_rest_24":return 64;case"f_rest_25":return 65;case"f_rest_26":return 66;case"f_rest_27":return 67;case"f_rest_28":return 68;case"f_rest_29":return 69;case"f_rest_30":return 70;case"f_rest_31":return 71;case"f_rest_32":return 72;case"f_rest_33":return 73;case"f_rest_34":return 74;case"f_rest_35":return 75;case"f_rest_36":return 76;case"f_rest_37":return 77;case"f_rest_38":return 78;case"f_rest_39":return 79;case"f_rest_40":return 80;case"f_rest_41":return 81;case"f_rest_42":return 82;case"f_rest_43":return 83;case"f_rest_44":return 84}return 85},t.ParseHeader=function(e){var n=new Uint8Array(e),r=(new TextDecoder).decode(n.slice(0,10240)),i=r.indexOf("end_header\n");if(i<0||!r)return null;var o=parseInt(/element vertex (\d+)\n/.exec(r)[1]),a=/element chunk (\d+)\n/.exec(r),s=0;a&&(s=parseInt(a[1]));var l,c=0,u=0,h={double:8,int:4,uint:4,float:4,short:2,ushort:2,uchar:1,list:0};!function(e){e[e.Vertex=0]="Vertex",e[e.Chunk=1]="Chunk",e[e.SH=2]="SH"}(l||(l={}));for(var d=1,p=[],f=[],m=0,_=0,g=r.slice(0,i).split("\n");_=84?m=3:E>=64?m=2:E>=48&&(m=1));var x=t._TypeNameToEnum(S);1==d?(f.push({value:E,type:x,offset:u}),u+=h[S]):0==d?(p.push({value:E,type:x,offset:c}),c+=h[S]):2==d&&p.push({value:E,type:x,offset:c}),h[S]||y.V.Warn("Unsupported property type: ".concat(S,"."))}else v.startsWith("element ")&&("chunk"==(x=v.split(" ")[1])?d=1:"vertex"==x?d=0:"sh"==x&&(d=2))}var P=new DataView(e,i+11),C=new ArrayBuffer(t._RowOutputLength*o),R=null,A=0;return m&&(A=3*((m+1)*(m+1)-1),R=new ArrayBuffer(A*o)),{vertexCount:o,chunkCount:s,rowVertexLength:c,rowChunkLength:u,vertexProperties:p,chunkProperties:f,dataView:P,buffer:C,shDegree:m,shCoefficientCount:A,shBuffer:R}},t._GetCompressedChunks=function(e,t){if(!e.chunkCount)return null;for(var n=e.dataView,r=new Array(e.chunkCount),i=0;i>8,g=255,v=0,y=0,b=0,S=[],T=0;T=40&&E.value<=84){var C=E.value-40;if(4==E.type&&e.chunkCount){var R=u.getUint8(e.rowChunkLength*e.chunkCount+e.vertexCount*e.rowVertexLength+n*e.shCoefficientCount+C);S[C]=127.5*(R*(8/255)-4)+127.5}else{var A=fa.Clamp(127.5*x+127.5,0,255);S[C]=A}}}if(m)for(var I=1==e.shDegree?3:2==e.shDegree?8:15,O=0;Othis._splatIndex.length)&&(this._splatIndex=new Float32Array(e),this.thinInstanceSetBuffer("splatIndex",this._splatIndex,1,!1)),this.forcedInstanceCount=e},t.prototype._updateSubTextures=function(e,t,n,r,i,o,a){var s=this,l=function(e,t,n,r,i){s.getEngine().updateTextureData(e.getInternalTexture(),t,0,r,n,i,0,0,!1)},c=this._getTextureSize(this._vertexCount),u=this._useRGBACovariants?4:2,h=i*c.x,d=o*c.x,p=new Uint16Array(t.buffer,4*h*Uint16Array.BYTES_PER_ELEMENT,4*d),f=new Uint16Array(n.buffer,h*u*Uint16Array.BYTES_PER_ELEMENT,d*u),m=new Uint8Array(r.buffer,4*h,4*d),_=new Float32Array(e.buffer,4*h*Float32Array.BYTES_PER_ELEMENT,4*d);if(l(this._covariancesATexture,p,c.x,i,o),l(this._covariancesBTexture,f,c.x,i,o),l(this._centersTexture,_,c.x,i,o),l(this._colorsTexture,m,c.x,i,o),a)for(var g=0;gn&&(y.V.Error("GaussianSplatting texture size: ("+n+", "+r+"), maxTextureSize: "+n),r=n),new c.I9(n,r)},t._RowOutputLength=32,t._SH_C0=.28209479177387814,t._SplatBatchSize=327680,t._PlyConversionBatchSize=32768,t.ProgressiveUpdateAmount=0,t._CreateWorker=function(e){var t,n,r,i,o=0;e.onmessage=function(a){if(a.data.positions)t=a.data.positions,o=a.data.vertexCount;else{var s=a.data.view;if(!t||!s)throw new Error("positions or view is not defined!");n=a.data.depthMix,r=new Uint32Array(n.buffer),i=new Float32Array(n.buffer);for(var l=0;l-1&&this._tasks.splice(t,1)},e.prototype._decreaseWaitingTasksCount=function(e){this._waitingTasksCount--;try{this.onProgress&&this.onProgress(this._waitingTasksCount,this._totalTasksCount,e),this.onProgressObservable.notifyObservers(new qI(this._waitingTasksCount,this._totalTasksCount,e))}catch(e){y.V.Error("Error running progress callbacks."),y.V.Log(e)}if(0===this._waitingTasksCount){try{var t=this._tasks.slice();this.onFinish&&this.onFinish(t);for(var n=0,r=t;n-1&&this._tasks.splice(o,1)}}this.onTasksDoneObservable.notifyObservers(this._tasks)}catch(e){y.V.Error("Error running tasks-done callbacks."),y.V.Log(e)}this._isLoading=!1,this.autoHideLoadingUI&&this._scene.getEngine().hideLoadingUI()}},e.prototype._runTask=function(e){var t=this,n=function(n,r){e._setErrorObject(n,r),t.onTaskError?t.onTaskError(e):e.onError||y.V.Error(t._formatTaskErrorMessage(e)),t.onTaskErrorObservable.notifyObservers(e),t._decreaseWaitingTasksCount(e)};e.run(this._scene,(function(){try{t.onTaskSuccess&&t.onTaskSuccess(e),t.onTaskSuccessObservable.notifyObservers(e),t._decreaseWaitingTasksCount(e)}catch(e){n("Error executing task success callbacks",e)}}),n)},e.prototype._formatTaskErrorMessage=function(e){var t="Unable to complete task "+e.name;return e.errorObject.message&&(t+=": ".concat(e.errorObject.message)),e.errorObject.exception&&(t+=": ".concat(e.errorObject.exception)),t},e.prototype.reset=function(){return this._isLoading=!1,this._tasks=new Array,this},e.prototype.load=function(){if(this._isLoading)return this;if(this._isLoading=!0,this._waitingTasksCount=this._tasks.length,this._totalTasksCount=this._tasks.length,0===this._waitingTasksCount)return this._isLoading=!1,this.onFinish&&this.onFinish(this._tasks),this.onTasksDoneObservable.notifyObservers(this._tasks),this;this.useDefaultLoadingScreen&&this._scene.getEngine().displayLoadingUI();for(var e=0;e=0&&this._meshes.splice(n,1),this._centerPosition=this._centerMesh.getAbsolutePosition().clone();for(var r=0;r0&&this._textureLoadingCallback(e)}this._currentScene.render()}},e.prototype._drag=function(e){e.stopPropagation(),e.preventDefault()},e.prototype._drop=function(e){e.stopPropagation(),e.preventDefault(),this.loadFiles(e)},e.prototype._traverseFolder=function(e,t,n,r){var i=this,o=e.createReader(),a=e.fullPath.replace(/^\//,"").replace(/(.+?)\/?$/,"$1/");o.readEntries((function(e){n.count+=e.length;for(var o=0,s=e;o0)){for(var n=[],r=[],i=e.dataTransfer?e.dataTransfer.items:null,o=0;o0&&y.V.ClearLogCache(),this._engine.stopRenderLoop()),ve.ShowLoadingScreen=!1,this.displayLoadingUI&&this._engine.displayLoadingUI(),this.loadAsync(this._sceneFileToLoad,this._progressCallback).then((function(t){e.useAppend?e.displayLoadingUI&&e._engine.hideLoadingUI():(e._currentScene&&e._currentScene.dispose(),e._currentScene=t,e._currentScene.executeWhenReady((function(){e.displayLoadingUI&&e._engine.hideLoadingUI(),e.dontInjectRenderLoop||e._engine.runRenderLoop((function(){e._renderFunction()}))}))),e._sceneLoadedCallback&&e._currentScene&&e._sceneLoadedCallback(e._sceneFileToLoad,e._currentScene)})).catch((function(t){e.displayLoadingUI&&e._engine.hideLoadingUI(),e._errorCallback&&e._errorCallback(e._sceneFileToLoad,e._currentScene,t.message)}));else{if(1===this._filesToLoad.length){var t=this._filesToLoad[0].name.toLowerCase().split(".").pop();if(t)switch(t.toLowerCase()){case"dds":case"env":case"hdr":return}}y.V.Error("Please provide a valid .babylon file.")}},e}(),dO=n(88188),pO=function(){function e(){}return e.prototype.dispose=function(){if(this._observers&&this._observables)for(var e=0;ethis.maximumSize&&(i.scale(this.step),n=!1)}}return n},t}(fO),_O=function(e){function t(t,n,r){void 0===t&&(t=0),void 0===n&&(n=2),void 0===r&&(r=.25);var i=e.call(this,t)||this;return i.priority=t,i.maximumScale=n,i.step=r,i._currentScale=-1,i._directionOffset=1,i}return(0,f.C6)(t,e),t.prototype.getDescription=function(){return"Setting hardware scaling level to "+this._currentScale},t.prototype.apply=function(e,t){return-1===this._currentScale&&(this._currentScale=e.getEngine().getHardwareScalingLevel(),this._currentScale>this.maximumScale&&(this._directionOffset=-1)),this._currentScale+=this._directionOffset*this.step,this._currentScale=Math.min(this.maximumScale,this._currentScale),e.getEngine().setHardwareScalingLevel(this._currentScale),1===this._directionOffset?this._currentScale>=this.maximumScale:this._currentScale<=this.maximumScale},t}(fO),gO=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,f.C6)(t,e),t.prototype.getDescription=function(){return"Turning shadows on/off"},t.prototype.apply=function(e,t){return e.shadowsEnabled=t.isInImprovementMode,!0},t}(fO),vO=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,f.C6)(t,e),t.prototype.getDescription=function(){return"Turning post-processes on/off"},t.prototype.apply=function(e,t){return e.postProcessesEnabled=t.isInImprovementMode,!0},t}(fO),yO=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,f.C6)(t,e),t.prototype.getDescription=function(){return"Turning lens flares on/off"},t.prototype.apply=function(e,t){return e.lensFlaresEnabled=t.isInImprovementMode,!0},t}(fO),bO=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,f.C6)(t,e),t.prototype.getDescription=function(){return this.onGetDescription?this.onGetDescription():"Running user defined callback"},t.prototype.apply=function(e,t){return!this.onApply||this.onApply(e,t)},t}(fO),SO=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,f.C6)(t,e),t.prototype.getDescription=function(){return"Turning particles on/off"},t.prototype.apply=function(e,t){return e.particlesEnabled=t.isInImprovementMode,!0},t}(fO),TO=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,f.C6)(t,e),t.prototype.getDescription=function(){return"Turning render targets off"},t.prototype.apply=function(e,t){return e.renderTargetsEnabled=t.isInImprovementMode,!0},t}(fO),EO=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._canBeMerged=function(e){if(!(e instanceof qe))return!1;var t=e;return!(t.isDisposed()||!t.isVisible||!t.isEnabled()||t.instances.length>0||t.skeleton||t.hasLODLevels||0===t.getTotalVertices())},t}return(0,f.C6)(t,e),Object.defineProperty(t,"UpdateSelectionTree",{get:function(){return t._UpdateSelectionTree},set:function(e){t._UpdateSelectionTree=e},enumerable:!1,configurable:!0}),t.prototype.getDescription=function(){return"Merging similar meshes together"},t.prototype.apply=function(e,n,r){for(var i=e.meshes.slice(0),o=i.length,a=0;a=this._targetFrameRate)return this._isRunning=!1,void this.onSuccessObservable.notifyObservers(this);for(var r=!0,i=!0,o=0;o0){a.animationGroups=[];for(var d=0;d0)for(a.reflectionProbes=[],r=0;r0&&setTimeout((function(){n.stopRecording()}),1e3*t),this._fileName=e,this._recordedChunks=[],this._resolve=null,this._reject=null,this._isRecording=!0,this._mediaRecorder.start(this._options.recordChunckSize),new Promise((function(e,t){n._resolve=e,n._reject=t}))},e.prototype.dispose=function(){this._canvas=null,this._mediaRecorder=null,this._recordedChunks=[],this._fileName=null,this._resolve=null,this._reject=null},e.prototype._handleDataAvailable=function(e){e.data.size>0&&this._recordedChunks.push(e.data)},e.prototype._handleError=function(e){if(this.stopRecording(),!this._reject)throw new e.error;this._reject(e.error)},e.prototype._handleStop=function(){this.stopRecording();var e=new Blob(this._recordedChunks);this._resolve&&this._resolve(e),window.URL.createObjectURL(e),this._fileName&&Z.S0.Download(e,this._fileName)},e._DefaultOptions={mimeType:"video/webm",fps:25,recordChunckSize:3e3},e}(),BO=function(e){function t(t,n,r,i,o,a,s){void 0===r&&(r=null),void 0===s&&(s=b.Y.TEXTURETYPE_UNSIGNED_BYTE);var l=this,c=(0,f.Cl)({uniforms:dm.Uniforms,size:"number"==typeof n?n:void 0,camera:r,samplingMode:i||_n.g.BILINEAR_SAMPLINGMODE,engine:o,reusable:a,textureType:s},n);return(l=e.call(this,t,dm.FragmentUrl,(0,f.Cl)({effectWrapper:"number"!=typeof n&&n.effectWrapper?void 0:new dm(t,o,c)},c))||this).onApplyObservable.add((function(e){l._effectWrapper.texelSize=l.texelSize})),l}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"FxaaPostProcess"},t._Parse=function(e,n,r,i){return Te.p.Parse((function(){return new t(e.name,e.options,n,e.renderTargetSamplingMode,r.getEngine(),e.reusable)}),e,r,i)},t}(Ci.w);(0,h.Y5)("BABYLON.FxaaPostProcess",BO);var VO=n(24687),UO=null;function GO(e,t,n,r,i,o,a,s,l){void 0===i&&(i="image/png"),void 0===o&&(o=!1),void 0===s&&(s=!1),void 0===l&&(l=!1);var c=XO(e,t,n),u=c.height,h=c.width;if(u&&h){var d=t.getScene(),p=d.activeCamera!==t;if(d.frameGraph){var f=Hl.FindMainObjectRenderer(d.frameGraph);f&&(p=f.camera!==t)}p?WO(e,t,n,(function(e){if(o){var t=new Blob([e]);Z.S0.DownloadBlob(t),r&&r("")}else r&&r(e)}),i,1,e.getCreationOptions().antialias,void 0,void 0,void 0,void 0,a):e.onEndFrameObservable.addOnce((function(){UO||(UO=document.createElement("canvas")),UO.width=h,UO.height=u;var t=UO.getContext("2d"),n=e.getRenderingCanvas();if(t&&n){var c=n.width,p=n.height,f=UO.width,m=UO.height,_=f/c,g=m/p,v=s?Math.max(_,g):Math.min(_,g),b=c*v,S=p*v,T=(f-b)/2,E=(m-S)/2;t.save(),t.fillStyle=l?d.clearColor.toHexString():"rgba(0, 0, 0, 0)",t.fillRect(0,0,h,u),t.restore(),t.drawImage(n,0,0,c,p,T,E,b,S),o?(Z.S0.EncodeScreenshotCanvasData(UO,void 0,i,void 0,a),r&&r("")):Z.S0.EncodeScreenshotCanvasData(UO,r,i,void 0,a)}else y.V.Error("Failed to create screenshot. Rendering context or rendering canvas is not available.")}))}else y.V.Error("Invalid 'size' parameter !")}function kO(e,t,n){return(0,f.sH)(this,arguments,void 0,(function(e,t,n,r,i,o,a,s){return void 0===r&&(r="image/png"),void 0===o&&(o=!1),void 0===a&&(a=!1),void 0===s&&(s=!1),(0,f.YH)(this,(function(l){switch(l.label){case 0:return[4,new Promise((function(l,c){GO(e,t,n,(function(e){void 0!==e?l(e):c(new Error("Data is undefined"))}),r,s,i,o,a)}))];case 1:return[2,l.sent()]}}))}))}function zO(e,t,n,r){return(0,f.sH)(this,arguments,void 0,(function(e,t,n,r,i,o,a){return void 0===i&&(i="image/png"),void 0===a&&(a=!1),(0,f.YH)(this,(function(s){switch(s.label){case 0:return[4,new Promise((function(s){GO(e,t,{width:n,height:r},(function(){s()}),i,!0,o,a)}))];case 1:return[2,s.sent()]}}))}))}function WO(e,t,r,i,o,a,s,l,c,u,h,d,p,m){var _=this;void 0===o&&(o="image/png"),void 0===a&&(a=1),void 0===s&&(s=!1),void 0===c&&(c=!1),void 0===u&&(u=!1),void 0===h&&(h=!0);var g=t.getScene();if(g.frameGraph)YO(g.frameGraph,t,r,o,a,s,l,d,m,!i).then((function(e){i&&i(e)}));else{var v=XO(e,t,r),S=v.height,T=v.width,E=v.finalWidth,x=v.finalHeight,P={width:T,height:S};if(S&&T){e.skipFrameRender=!0;var C=e.getRenderWidth,R=e.getRenderHeight;e.getRenderWidth=function(t){return void 0===t&&(t=!1),!t&&e._currentRenderTarget?e._currentRenderTarget.width:T},e.getRenderHeight=function(t){return void 0===t&&(t=!1),!t&&e._currentRenderTarget?e._currentRenderTarget.height:S},e.onResizeObservable.hasObservers()&&e.onResizeObservable.notifyObservers(e);var A=new Ji.$("screenShot",P,g,!1,!1,b.Y.TEXTURETYPE_UNSIGNED_BYTE,!1,_n.g.BILINEAR_SAMPLINGMODE,void 0,u,void 0,void 0,void 0,a);A.renderList=g.meshes.slice(),A.samples=a,A.renderSprites=c,A.activeCamera=t,A.forceLayerMaskCheck=h,null==p||p(A);var I=m||VO.DumpData,O=function(){g.incrementRenderId(),g.resetCachedMaterial(),(0,Lt.B)((function(){return A.isReadyForRendering()&&t.isReady(!0)}),(function(){e.onEndFrameObservable.addOnce((function(){E===T&&x===S?A.readPixels(void 0,void 0,void 0,!1).then((function(e){I(T,S,e,i,o,l,!0,void 0,d),A.dispose()})):(e.isWebGPU?Promise.resolve().then(n.bind(n,59448)):Promise.resolve().then(n.bind(n,56017))).then((function(){return(0,f.sH)(_,void 0,void 0,(function(){return(0,f.YH)(this,(function(t){switch(t.label){case 0:return[4,(0,Sn.Qs)("pass",A.getInternalTexture(),g,void 0,void 0,void 0,E,x).then((function(t){e._readTexturePixels(t,E,x,-1,0,null,!0,!1,0,0).then((function(e){I(E,x,e,i,o,l,!0,void 0,d),t.dispose()}))}))];case 1:return[2,t.sent()]}}))}))}))})),g.incrementRenderId(),g.resetCachedMaterial();var r=g.activeCamera,a=g.activeCameras,s=t.outputRenderTarget,u=g.spritesEnabled;g.activeCamera=t,g.activeCameras=null,t.outputRenderTarget=A,g.spritesEnabled=c;var h=g.meshes;g.meshes=A.renderList||g.meshes;try{g.render()}finally{g.activeCamera=r,g.activeCameras=a,t.outputRenderTarget=s,g.spritesEnabled=u,g.meshes=h,e.getRenderWidth=C,e.getRenderHeight=R,e.onResizeObservable.hasObservers()&&e.onResizeObservable.notifyObservers(e),t.getProjectionMatrix(!0),e.skipFrameRender=!1}}),(function(){e.skipFrameRender=!1,e.getRenderWidth=C,e.getRenderHeight=R}))};if(s){var M=new BO("antialiasing",1,g.activeCamera);A.addPostProcess(M),M.autoClear=!0,M.onEffectCreatedObservable.addOnce((function(e){e.isReady()?O():e.onCompiled=function(){O()}}))}else O()}else y.V.Error("Invalid 'size' parameter !")}}function HO(e,t,n){return(0,f.sH)(this,arguments,void 0,(function(e,t,n,r,i,o,a,s,l,c,u,h,d){return void 0===r&&(r="image/png"),void 0===i&&(i=1),void 0===o&&(o=!1),void 0===s&&(s=!1),void 0===l&&(l=!1),void 0===c&&(c=!0),(0,f.YH)(this,(function(p){switch(p.label){case 0:return[4,new Promise((function(p,f){WO(e,t,n,(function(e){void 0!==e?p(e):f(new Error("Data is undefined"))}),r,i,o,a,s,l,c,u,h,d)}))];case 1:return[2,p.sent()]}}))}))}function YO(e,t,n){return(0,f.sH)(this,arguments,void 0,(function(e,t,n,r,i,o,a,s,l,c,u){var h,d,p,m,_,g,v,y,S,T,E,x,P,C,R,A,I,O,M,D,N=this;return void 0===r&&(r="image/png"),void 0===i&&(i=1),void 0===o&&(o=!1),void 0===c&&(c=!1),(0,f.YH)(this,(function(F){switch(F.label){case 0:return h=e.engine,d=e.textureManager,p=XO(h,t,n),m=p.height,_=p.width,g=p.finalWidth,v=p.finalHeight,y={width:_,height:m},S=l||VO.DumpData,T=e.tasks,E=T.length,x=e.pausedExecution,P=h.getCaps().parallelShaderCompile,d.setBackBufferTextures(0,0,{size:y,options:{createMipMaps:!1,samples:i,types:[b.Y.TEXTURETYPE_UNSIGNED_BYTE],formats:[b.Y.TEXTUREFORMAT_RGBA],useSRGBBuffers:[!1],creationFlags:[0],labels:["screenshot color"]},sizeIsPercentage:!1},{size:y,options:{createMipMaps:!1,samples:i,types:[b.Y.TEXTURETYPE_UNSIGNED_BYTE],formats:[h.isStencilEnable?b.Y.TEXTUREFORMAT_DEPTH24_STENCIL8:b.Y.TEXTUREFORMAT_DEPTH32_FLOAT],useSRGBBuffers:[!1],creationFlags:[0],labels:["screenshot depth"]},sizeIsPercentage:!1}),C=Ll.O,o&&((R=new pm("fxaa",e)).sourceTexture=C,C=R.outputTexture,e.addTask(R)),g===_&&v===m||((R=new xm("pass",e)).sourceTexture=C,R.targetTexture=e.textureManager.createRenderTargetTexture("pass_output",{size:{width:g,height:v},options:{createMipMaps:!1,types:[b.Y.TEXTURETYPE_UNSIGNED_BYTE],formats:[b.Y.TEXTUREFORMAT_RGBA],samples:1,labels:["screenshot_final_texture"],useSRGBBuffers:[!1]},sizeIsPercentage:!1}),C=R.outputTexture,e.addTask(R)),A=Hl.FindMainObjectRenderer(e),I=null,A&&(I=A.camera,A.camera=t),h.getCaps().parallelShaderCompile=void 0,e.build(),e.pausedExecution=!0,[4,e.whenReadyAsync()];case 1:for(F.sent(),e.pausedExecution=!1,O=null!=u?u:d.hasHistoryTextures?32:1,M=0;Me)n(t[0],t[0],1);else{for(var r=0;r=i.gradient&&e<=o.gradient)return void n(i,o,(e-i.gradient)/(o.gradient-i.gradient))}var a=t.length-1;n(t[a],t[a],1)}},e}(),$O=n(49449),eM=function(){function e(e){this.byteOffset=0,this.buffer=e}return e.prototype.loadAsync=function(e){return(0,f.sH)(this,void 0,void 0,(function(){var t;return(0,f.YH)(this,(function(n){switch(n.label){case 0:return[4,this.buffer.readAsync(this.byteOffset,e)];case 1:return t=n.sent(),this._dataView=new DataView(t.buffer,t.byteOffset,t.byteLength),this._dataByteOffset=0,[2]}}))}))},e.prototype.readUint32=function(){var e=this._dataView.getUint32(this._dataByteOffset,!0);return this._dataByteOffset+=4,this.byteOffset+=4,e},e.prototype.readUint8Array=function(e){var t=new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+this._dataByteOffset,e);return this._dataByteOffset+=e,this.byteOffset+=e,t},e.prototype.readString=function(e){return(0,vn.Tq)(this.readUint8Array(e))},e.prototype.skipBytes=function(e){this._dataByteOffset+=e,this.byteOffset+=e},e}(),tM=n(73216),nM=n(559),rM=function(){function e(){}return e._GetStorage=function(){try{return localStorage.setItem("test",""),localStorage.removeItem("test"),localStorage}catch(t){var e={};return{getItem:function(t){var n=e[t];return void 0===n?null:n},setItem:function(t,n){e[t]=n}}}},e.ReadString=function(e,t){var n=this._Storage.getItem(e);return null!==n?n:t},e.WriteString=function(e,t){this._Storage.setItem(e,t)},e.ReadBoolean=function(e,t){var n=this._Storage.getItem(e);return null!==n?"true"===n:t},e.WriteBoolean=function(e,t){this._Storage.setItem(e,t?"true":"false")},e.ReadNumber=function(e,t){var n=this._Storage.getItem(e);return null!==n?parseFloat(n):t},e.WriteNumber=function(e,t){this._Storage.setItem(e,t.toString())},e._Storage=e._GetStorage(),e}(),iM=function(){function e(t){this.particleSystem=t,this.position=c.Pq.Zero(),this.direction=c.Pq.Zero(),this.color=new u.ov(0,0,0,0),this.colorStep=new u.ov(0,0,0,0),this.initialColor=new u.ov(0,0,0,0),this.colorDead=new u.ov(0,0,0,0),this.lifeTime=1,this.age=0,this.size=0,this.scale=new c.I9(1,1),this.angle=0,this.angularSpeed=0,this.cellIndex=0,this._attachedSubEmitters=null,this._currentColor1=new u.ov(0,0,0,0),this._currentColor2=new u.ov(0,0,0,0),this._currentSize1=0,this._currentSize2=0,this._currentAngularSpeed1=0,this._currentAngularSpeed2=0,this._currentVelocity1=0,this._currentVelocity2=0,this._currentLimitVelocity1=0,this._currentLimitVelocity2=0,this._currentDrag1=0,this._currentDrag2=0,this.id=e._Count++,this.particleSystem.isAnimationSheetEnabled&&this._updateCellInfoFromSystem()}return e.prototype._updateCellInfoFromSystem=function(){this.cellIndex=this.particleSystem.startSpriteCellID},e.prototype.updateCellIndex=function(){var e=this.age,t=this.particleSystem.spriteCellChangeSpeed;this.particleSystem.spriteRandomStartCell&&(void 0===this._randomCellOffset&&(this._randomCellOffset=Math.random()*this.lifeTime),0===t?(t=1,e=this._randomCellOffset):e+=this._randomCellOffset);var n,r=this._initialEndSpriteCellId-this._initialStartSpriteCellId+1;n=this._initialSpriteCellLoop?(0,lr.Clamp)(e*t%this.lifeTime/this.lifeTime):(0,lr.Clamp)(e*t/this.lifeTime),this.cellIndex=this._initialStartSpriteCellId+n*r|0},e.prototype._inheritParticleInfoToSubEmitter=function(e){if(e.particleSystem.emitter.position){var t=e.particleSystem.emitter;if(t.position.copyFrom(this.position),e.inheritDirection){var n=c.AA.Vector3[0];this.direction.normalizeToRef(n),t.setDirection(n,0,Math.PI/2)}}else e.particleSystem.emitter.copyFrom(this.position);this.direction.scaleToRef(e.inheritedVelocityAmount/2,c.AA.Vector3[0]),e.particleSystem._inheritedVelocityOffset.copyFrom(c.AA.Vector3[0])},e.prototype._inheritParticleInfoToSubEmitters=function(){if(this._attachedSubEmitters&&this._attachedSubEmitters.length>0)for(var e=0,t=this._attachedSubEmitters;e1?t._colorGradients[1].getColorToRef(e._currentColor2):e._currentColor2.copyFrom(e.color)}function uM(e,t){var n=t._colorGradients;JO.GetCurrentGradient(t._ratio,n,(function(t,n,r){t!==e._currentColorGradient&&(e._currentColor1.copyFrom(e._currentColor2),n.getColorToRef(e._currentColor2),e._currentColorGradient=t),u.ov.LerpToRef(e._currentColor1,e._currentColor2,r,e.color)}))}function hM(e,t){e.colorStep.scaleToRef(t._scaledUpdateSpeed,t._scaledColorStep),e.color.addInPlace(t._scaledColorStep),e.color.a<0&&(e.color.a=0)}function dM(e,t){JO.GetCurrentGradient(t._ratio,t._angularSpeedGradients,(function(t,n,r){t!==e._currentAngularSpeedGradient&&(e._currentAngularSpeed1=e._currentAngularSpeed2,e._currentAngularSpeed2=n.getFactor(),e._currentAngularSpeedGradient=t),e.angularSpeed=(0,lr.Lerp)(e._currentAngularSpeed1,e._currentAngularSpeed2,r)}))}function pM(e,t){e.angle+=e.angularSpeed*t._scaledUpdateSpeed}function fM(e,t){t.particleEmitterType.startDirectionFunction(t._emitterWorldMatrix,e.direction,e,t.isLocal,t._emitterInverseWorldMatrix)}function mM(e,t){t.startDirectionFunction(t._emitterWorldMatrix,e.direction,e,t.isLocal)}function _M(e,t){e._currentVelocityGradient=t._velocityGradients[0],e._currentVelocity1=e._currentVelocityGradient.getFactor(),t._velocityGradients.length>1?e._currentVelocity2=t._velocityGradients[1].getFactor():e._currentVelocity2=e._currentVelocity1}function gM(e,t){e._currentLimitVelocityGradient=t._limitVelocityGradients[0],e._currentLimitVelocity1=e._currentLimitVelocityGradient.getFactor(),t._limitVelocityGradients.length>1?e._currentLimitVelocity2=t._limitVelocityGradients[1].getFactor():e._currentLimitVelocity2=e._currentLimitVelocity1}function vM(e,t){JO.GetCurrentGradient(t._ratio,t._velocityGradients,(function(n,r,i){n!==e._currentVelocityGradient&&(e._currentVelocity1=e._currentVelocity2,e._currentVelocity2=r.getFactor(),e._currentVelocityGradient=n),t._directionScale*=(0,lr.Lerp)(e._currentVelocity1,e._currentVelocity2,i)}))}function yM(e,t){JO.GetCurrentGradient(t._ratio,t._limitVelocityGradients,(function(n,r,i){n!==e._currentLimitVelocityGradient&&(e._currentLimitVelocity1=e._currentLimitVelocity2,e._currentLimitVelocity2=r.getFactor(),e._currentLimitVelocityGradient=n);var o=(0,lr.Lerp)(e._currentLimitVelocity1,e._currentLimitVelocity2,i);e.direction.length()>o&&e.direction.scaleInPlace(t.limitVelocityDamping)}))}function bM(e,t){e.direction.scaleToRef(t._directionScale,t._scaledDirection)}function SM(e,t){t.particleEmitterType.startPositionFunction(t._emitterWorldMatrix,e.position,e,t.isLocal)}function TM(e,t){t.startPositionFunction(t._emitterWorldMatrix,e.position,e,t.isLocal)}function EM(e,t){e._localPosition?e._localPosition.copyFrom(e.position):e._localPosition=e.position.clone(),c.Pq.TransformCoordinatesToRef(e._localPosition,t._emitterWorldMatrix,e.position)}function xM(e,t){t.isLocal&&e._localPosition?(e._localPosition.addInPlace(t._scaledDirection),c.Pq.TransformCoordinatesToRef(e._localPosition,t._emitterWorldMatrix,e.position)):e.position.addInPlace(t._scaledDirection)}function PM(e,t){e._currentDragGradient=t._dragGradients[0],e._currentDrag1=e._currentDragGradient.getFactor(),t._dragGradients.length>1?e._currentDrag2=t._dragGradients[1].getFactor():e._currentDrag2=e._currentDrag1}function CM(e,t){JO.GetCurrentGradient(t._ratio,t._dragGradients,(function(n,r,i){n!==e._currentDragGradient&&(e._currentDrag1=e._currentDrag2,e._currentDrag2=r.getFactor(),e._currentDragGradient=n);var o=(0,lr.Lerp)(e._currentDrag1,e._currentDrag2,i);t._scaledDirection.scaleInPlace(1-o)}))}function RM(e,t){e._randomNoiseCoordinates1?(e._randomNoiseCoordinates1.copyFromFloats(Math.random(),Math.random(),Math.random()),e._randomNoiseCoordinates2.copyFromFloats(Math.random(),Math.random(),Math.random())):(e._randomNoiseCoordinates1=new c.Pq(Math.random(),Math.random(),Math.random()),e._randomNoiseCoordinates2=new c.Pq(Math.random(),Math.random(),Math.random()))}function AM(e,t){var n=t._noiseTextureData,r=t._noiseTextureSize;if(n&&r&&e._randomNoiseCoordinates1){var i=t._fetchR(e._randomNoiseCoordinates1.x,e._randomNoiseCoordinates1.y,r.width,r.height,n),o=t._fetchR(e._randomNoiseCoordinates1.z,e._randomNoiseCoordinates2.x,r.width,r.height,n),a=t._fetchR(e._randomNoiseCoordinates2.y,e._randomNoiseCoordinates2.z,r.width,r.height,n),s=c.AA.Vector3[0],l=c.AA.Vector3[1];s.copyFromFloats((2*i-1)*t.noiseStrength.x,(2*o-1)*t.noiseStrength.y,(2*a-1)*t.noiseStrength.z),s.scaleToRef(t._tempScaledUpdateSpeed,l),e.direction.addInPlace(l)}}function IM(e,t){t.gravity.scaleToRef(t._tempScaledUpdateSpeed,t._scaledGravity),e.direction.addInPlace(t._scaledGravity)}function OM(e,t){e.size=(0,lr.RandomRange)(t.minSize,t.maxSize),e.scale.copyFromFloats((0,lr.RandomRange)(t.minScaleX,t.maxScaleX),(0,lr.RandomRange)(t.minScaleY,t.maxScaleY))}function MM(e,t){e._currentSizeGradient=t._sizeGradients[0],e._currentSize1=e._currentSizeGradient.getFactor(),e.size=e._currentSize1,t._sizeGradients.length>1?e._currentSize2=t._sizeGradients[1].getFactor():e._currentSize2=e._currentSize1,e.scale.copyFromFloats((0,lr.RandomRange)(t.minScaleX,t.maxScaleX),(0,lr.RandomRange)(t.minScaleY,t.maxScaleY))}function DM(e,t){var n=t._actualFrame/t.targetStopDuration;JO.GetCurrentGradient(n,t._startSizeGradients,(function(n,r,i){n!==t._currentStartSizeGradient&&(t._currentStartSize1=t._currentStartSize2,t._currentStartSize2=r.getFactor(),t._currentStartSizeGradient=n);var o=(0,lr.Lerp)(t._currentStartSize1,t._currentStartSize2,i);e.scale.scaleInPlace(o)}))}function NM(e,t){JO.GetCurrentGradient(t._ratio,t._sizeGradients,(function(t,n,r){t!==e._currentSizeGradient&&(e._currentSize1=e._currentSize2,e._currentSize2=n.getFactor(),e._currentSizeGradient=t),e.size=(0,lr.Lerp)(e._currentSize1,e._currentSize2,r)}))}function FM(e,t){e.remapData=new c.IU(0,1,0,1)}function LM(e,t){t._colorRemapGradients&&t._colorRemapGradients.length>0&&JO.GetCurrentGradient(t._ratio,t._colorRemapGradients,(function(t,n,r){var i=(0,lr.Lerp)(t.factor1,n.factor1,r),o=(0,lr.Lerp)(t.factor2,n.factor2,r);e.remapData.x=i,e.remapData.y=o-i})),t._alphaRemapGradients&&t._alphaRemapGradients.length>0&&JO.GetCurrentGradient(t._ratio,t._alphaRemapGradients,(function(t,n,r){var i=(0,lr.Lerp)(t.factor1,n.factor1,r),o=(0,lr.Lerp)(t.factor2,n.factor2,r);e.remapData.z=i,e.remapData.w=o-i}))}function wM(e,t){var n=(0,lr.Clamp)(t._actualFrame/t.targetStopDuration);JO.GetCurrentGradient(n,t._lifeTimeGradients,(function(t,r){var i=t,o=r,a=i.getFactor(),s=o.getFactor(),l=(n-i.gradient)/(o.gradient-i.gradient);e.lifeTime=(0,lr.Lerp)(a,s,l)})),t._emitPower=(0,lr.RandomRange)(t.minEmitPower,t.maxEmitPower)}function BM(e,t){e.lifeTime=(0,lr.RandomRange)(t.minLifeTime,t.maxLifeTime),t._emitPower=(0,lr.RandomRange)(t.minEmitPower,t.maxEmitPower)}function VM(e,t){0===t._emitPower?(e._initialDirection?e._initialDirection.copyFrom(e.direction):e._initialDirection=e.direction.clone(),e.direction.set(0,0,0)):(e._initialDirection=null,e.direction.scaleInPlace(t._emitPower)),e.direction.addInPlace(t._inheritedVelocityOffset)}function UM(e,t){e.angularSpeed=(0,lr.RandomRange)(t.minAngularSpeed,t.maxAngularSpeed),e.angle=(0,lr.RandomRange)(t.minInitialRotation,t.maxInitialRotation)}function GM(e,t){e._currentAngularSpeedGradient=t._angularSpeedGradients[0],e.angularSpeed=e._currentAngularSpeedGradient.getFactor(),e._currentAngularSpeed1=e.angularSpeed,t._angularSpeedGradients.length>1?e._currentAngularSpeed2=t._angularSpeedGradients[1].getFactor():e._currentAngularSpeed2=e._currentAngularSpeed1,e.angle=(0,lr.RandomRange)(t.minInitialRotation,t.maxInitialRotation)}function kM(e,t){e._initialStartSpriteCellId=t.startSpriteCellID,e._initialEndSpriteCellId=t.endSpriteCellID,e._initialSpriteCellLoop=t.spriteCellLoop}function zM(e,t){e.previousItem=t.previousItem,e.nextItem=t,t.previousItem&&(t.previousItem.nextItem=e),t.previousItem=e}function WM(e,t){e.previousItem=t,e.nextItem=t.nextItem,t.nextItem&&(t.nextItem.previousItem=e),t.nextItem=e}function HM(e,t){for(var n=t;n.nextItem;)n=n.nextItem;e.previousItem=n,e.nextItem=n.nextItem,n.nextItem=e}function YM(e){e.previousItem&&(e.previousItem.nextItem=e.nextItem),e.nextItem&&(e.nextItem.previousItem=e.previousItem)}var XM,jM=function(e){function t(t,n,r,i,o,a,s){void 0===i&&(i=null),void 0===o&&(o=!1),void 0===a&&(a=.01),void 0===s&&(s=!1);var h=e.call(this,t)||this;return h._emitterInverseWorldMatrix=c.uq.Identity(),h._startDirectionFunction=null,h._startPositionFunction=null,h._inheritedVelocityOffset=new c.Pq,h.onDisposeObservable=new l.cP,h.onStoppedObservable=new l.cP,h.onStartedObservable=new l.cP,h._noiseTextureSize=null,h._noiseTextureData=null,h._particles=new Array,h._stockParticles=new Array,h._newPartsExcess=0,h._vertexBuffers={},h._scaledColorStep=new u.ov(0,0,0,0),h._colorDiff=new u.ov(0,0,0,0),h._scaledDirection=c.Pq.Zero(),h._scaledGravity=c.Pq.Zero(),h._currentRenderId=-1,h._useInstancing=!1,h._isDisposed=!1,h._started=!1,h._stopped=!1,h._actualFrame=0,h._currentEmitRate1=0,h._currentEmitRate2=0,h._currentStartSize1=0,h._currentStartSize2=0,h.updateInAnimate=!0,h._rawTextureWidth=256,h._useRampGradients=!1,h._updateQueueStart=null,h._startSizeCreation=null,h._createQueueStart=null,h._isLocal=!1,h.isGPU=!1,h._shaderLanguage=0,h._onBeforeDrawParticlesObservable=null,h._emitFromParticle=function(e){},h.recycleParticle=function(e){var t=h._particles.pop();t!==e&&t.copyTo(e),h._stockParticles.push(t)},h._createParticle=function(){var e;return 0!==h._stockParticles.length?(e=h._stockParticles.pop())._reset():e=new iM(h),h._prepareParticle(e),e},h.paused=!1,h._shadersLoaded=!1,h._capacity=n,h._epsilon=a,r&&"Scene"!==r.getClassName()?(h._engine=r,h.defaultProjectionMatrix=c.uq.PerspectiveFovLH(.8,1,.1,100,h._engine.isNDCHalfZRange)):(h._scene=r||M.q.LastCreatedScene,h._engine=h._scene.getEngine(),h.uniqueId=h._scene.getUniqueId(),h._scene.particleSystems.push(h)),h._engine.getCaps().vertexArrayObject&&(h._vertexArrayObject=null),h._initShaderSourceAsync(),h._lifeTimeCreation={process:BM,previousItem:null,nextItem:null},h._positionCreation={process:SM,previousItem:null,nextItem:null},WM(h._positionCreation,h._lifeTimeCreation),h._directionCreation={process:fM,previousItem:null,nextItem:null},WM(h._directionCreation,h._positionCreation),h._emitPowerCreation={process:VM,previousItem:null,nextItem:null},WM(h._emitPowerCreation,h._directionCreation),h._sizeCreation={process:OM,previousItem:null,nextItem:null},WM(h._sizeCreation,h._emitPowerCreation),h._angleCreation={process:UM,previousItem:null,nextItem:null},WM(h._angleCreation,h._sizeCreation),h._colorCreation={process:sM,previousItem:null,nextItem:null},WM(h._colorCreation,h._angleCreation),h._colorDeadCreation={process:lM,previousItem:null,nextItem:null},WM(h._colorDeadCreation,h._colorCreation),h._createQueueStart=h._lifeTimeCreation,s||(h._colorProcessing={process:hM,previousItem:null,nextItem:null},h._angularSpeedProcessing={process:pM,previousItem:null,nextItem:null},WM(h._angularSpeedProcessing,h._colorProcessing),h._directionProcessing={process:bM,previousItem:null,nextItem:null},WM(h._directionProcessing,h._angularSpeedProcessing),h._positionProcessing={process:xM,previousItem:null,nextItem:null},WM(h._positionProcessing,h._directionProcessing),h._gravityProcessing={process:IM,previousItem:null,nextItem:null},WM(h._gravityProcessing,h._positionProcessing),h._updateQueueStart=h._colorProcessing),h._isAnimationSheetEnabled=o,h._attachImageProcessingConfiguration(null),h._customWrappers={0:new fe.E(h._engine)},h._customWrappers[0].effect=i,h._drawWrappers=[],h._useInstancing=h._engine.getCaps().instancedArrays,h._createIndexBuffer(),h._createVertexBuffers(),h.particleEmitterType=new oM,h.updateFunction=function(e){var t;h.noiseTexture&&(h._noiseTextureSize=h.noiseTexture.getSize(),null===(t=h.noiseTexture.getContent())||void 0===t||t.then((function(e){h._noiseTextureData=e})));for(var n=e===h._particles,r=0;ri.lifeTime){var a=i.age-o,l=i.lifeTime-o;h._tempScaledUpdateSpeed=l*h._tempScaledUpdateSpeed/a,i.age=i.lifeTime}h._ratio=i.age/i.lifeTime,h._directionScale=h._tempScaledUpdateSpeed;for(var c=h._updateQueueStart;c;)c.process(i,h),c=c.nextItem;if(h._isAnimationSheetEnabled&&!s&&i.updateCellIndex(),i._inheritParticleInfoToSubEmitters(),i.age>=i.lifeTime){if(h._emitFromParticle(i),i._attachedSubEmitters){for(var u=0,d=i._attachedSubEmitters;ut.gradient?1:0}))},t.prototype._removeFactorGradient=function(e,t){if(e)for(var n=0,r=0,i=e;r0?this._lifeTimeCreation.process=wM:this._lifeTimeCreation.process=BM},t.prototype._syncStartSizeCreation=function(){this._startSizeGradients&&this._startSizeGradients[0]&&this.targetStopDuration?this._startSizeCreation||(this._startSizeCreation={process:DM,previousItem:null,nextItem:null},WM(this._startSizeCreation,this._sizeCreation)):this._startSizeCreation&&(YM(this._startSizeCreation),this._startSizeCreation=null)},Object.defineProperty(t.prototype,"targetStopDuration",{get:function(){return this._targetStopDuration},set:function(e){this.targetStopDuration!==e&&(this._targetStopDuration=e,this._syncLifeTimeCreation(),this._syncStartSizeCreation())},enumerable:!1,configurable:!0}),t.prototype.addLifeTimeGradient=function(e,t,n){return this._lifeTimeGradients||(this._lifeTimeGradients=[]),this._addFactorGradient(this._lifeTimeGradients,e,t,n),this._syncLifeTimeCreation(),this},t.prototype.removeLifeTimeGradient=function(e){return this._removeFactorGradient(this._lifeTimeGradients,e),this._syncLifeTimeCreation(),this},t.prototype.addSizeGradient=function(e,t,n){return this._sizeGradients||(this._sizeGradients=[]),0===this._sizeGradients.length&&(this._sizeCreation.process=MM,this._sizeGradientProcessing={process:NM,previousItem:null,nextItem:null},zM(this._sizeGradientProcessing,this._gravityProcessing)),this._addFactorGradient(this._sizeGradients,e,t,n),this},t.prototype.removeSizeGradient=function(e){var t;return this._removeFactorGradient(this._sizeGradients,e),0===(null===(t=this._sizeGradients)||void 0===t?void 0:t.length)&&(YM(this._sizeGradientProcessing),this._sizeCreation.process=OM),this},t.prototype.addColorRemapGradient=function(e,t,n){return this._colorRemapGradients||(this._colorRemapGradients=[]),this._addFactorGradient(this._colorRemapGradients,e,t,n),this},t.prototype.removeColorRemapGradient=function(e){return this._removeFactorGradient(this._colorRemapGradients,e),this},t.prototype.addAlphaRemapGradient=function(e,t,n){return this._alphaRemapGradients||(this._alphaRemapGradients=[]),this._addFactorGradient(this._alphaRemapGradients,e,t,n),this},t.prototype.removeAlphaRemapGradient=function(e){return this._removeFactorGradient(this._alphaRemapGradients,e),this},t.prototype.addAngularSpeedGradient=function(e,t,n){return this._angularSpeedGradients||(this._angularSpeedGradients=[]),0===this._angularSpeedGradients.length&&(this._angleCreation.process=GM,this._angularSpeedGradientProcessing={process:dM,previousItem:null,nextItem:null},zM(this._angularSpeedGradientProcessing,this._angularSpeedProcessing)),this._addFactorGradient(this._angularSpeedGradients,e,t,n),this},t.prototype.removeAngularSpeedGradient=function(e){var t;return this._removeFactorGradient(this._angularSpeedGradients,e),0===(null===(t=this._angularSpeedGradients)||void 0===t?void 0:t.length)&&(this._angleCreation.process=UM,YM(this._angularSpeedGradientProcessing)),this},t.prototype.addVelocityGradient=function(e,t,n){return this._velocityGradients||(this._velocityGradients=[]),0===this._velocityGradients.length&&(this._velocityCreation={process:_M,previousItem:null,nextItem:null},WM(this._velocityCreation,this._angleCreation),this._velocityGradientProcessing={process:vM,previousItem:null,nextItem:null},zM(this._velocityGradientProcessing,this._directionProcessing)),this._addFactorGradient(this._velocityGradients,e,t,n),this},t.prototype.removeVelocityGradient=function(e){var t;return this._removeFactorGradient(this._velocityGradients,e),0===(null===(t=this._velocityGradients)||void 0===t?void 0:t.length)&&(YM(this._velocityCreation),YM(this._velocityGradientProcessing)),this},t.prototype.addLimitVelocityGradient=function(e,t,n){return this._limitVelocityGradients||(this._limitVelocityGradients=[]),0===this._limitVelocityGradients.length&&(this._limitVelocityCreation={process:gM,previousItem:null,nextItem:null},WM(this._limitVelocityCreation,this._angleCreation),this._limitVelocityGradientProcessing={process:yM,previousItem:null,nextItem:null},WM(this._limitVelocityGradientProcessing,this._directionProcessing)),this._addFactorGradient(this._limitVelocityGradients,e,t,n),this},t.prototype.removeLimitVelocityGradient=function(e){var t;return this._removeFactorGradient(this._limitVelocityGradients,e),0===(null===(t=this._limitVelocityGradients)||void 0===t?void 0:t.length)&&(YM(this._limitVelocityCreation),YM(this._limitVelocityGradientProcessing)),this},t.prototype.addDragGradient=function(e,t,n){return this._dragGradients||(this._dragGradients=[]),0===this._dragGradients.length&&(this._dragCreation={process:PM,previousItem:null,nextItem:null},zM(this._dragCreation,this._colorDeadCreation),this._dragGradientProcessing={process:CM,previousItem:null,nextItem:null},zM(this._dragGradientProcessing,this._positionProcessing)),this._addFactorGradient(this._dragGradients,e,t,n),this},t.prototype.removeDragGradient=function(e){var t;return this._removeFactorGradient(this._dragGradients,e),0===(null===(t=this._dragGradients)||void 0===t?void 0:t.length)&&(YM(this._dragCreation),YM(this._dragGradientProcessing)),this},t.prototype.addEmitRateGradient=function(e,t,n){return this._emitRateGradients||(this._emitRateGradients=[]),this._addFactorGradient(this._emitRateGradients,e,t,n),this},t.prototype.removeEmitRateGradient=function(e){return this._removeFactorGradient(this._emitRateGradients,e),this},t.prototype.addStartSizeGradient=function(e,t,n){return this._startSizeGradients||(this._startSizeGradients=[]),this._addFactorGradient(this._startSizeGradients,e,t,n),this._syncStartSizeCreation(),this},t.prototype.removeStartSizeGradient=function(e){return this._removeFactorGradient(this._startSizeGradients,e),this._syncStartSizeCreation(),this},t.prototype._createRampGradientTexture=function(){if(this._rampGradients&&this._rampGradients.length&&!this._rampGradientsTexture&&this._scene){for(var e=new Uint8Array(4*this._rawTextureWidth),t=u.IG.Color3[0],n=function(n){var i=n/r._rawTextureWidth;JO.GetCurrentGradient(i,r._rampGradients,(function(r,i,o){u.v9.LerpToRef(r.color,i.color,o,t),e[4*n]=255*t.r,e[4*n+1]=255*t.g,e[4*n+2]=255*t.b,e[4*n+3]=255}))},r=this,i=0;it.gradient?1:0})),this._rampGradientsTexture&&(this._rampGradientsTexture.dispose(),this._rampGradientsTexture=null),this._createRampGradientTexture())},t.prototype.addRampGradient=function(e,t){this._rampGradients||(this._rampGradients=[]);var n=new ZO(e,t);return this._rampGradients.push(n),this._syncRampGradientTexture(),this},t.prototype.removeRampGradient=function(e){return this._removeGradientAndTexture(e,this._rampGradients,this._rampGradientsTexture),this._rampGradientsTexture=null,this._rampGradients&&this._rampGradients.length>0&&this._createRampGradientTexture(),this},t.prototype.addColorGradient=function(e,t,n){this._colorGradients||(this._colorGradients=[]),0===this._colorGradients.length&&(this._colorCreation.process=cM,this._colorProcessing.process=uM);var r=new KO(e,t,n);return this._colorGradients.push(r),this._colorGradients.sort((function(e,t){return e.gradientt.gradient?1:0})),this},t.prototype.removeColorGradient=function(e){if(!this._colorGradients)return this;for(var t=0,n=0,r=this._colorGradients;n0&&(this._currentEmitRateGradient=this._emitRateGradients[0],this._currentEmitRate1=this._currentEmitRateGradient.getFactor(),this._currentEmitRate2=this._currentEmitRate1),this._emitRateGradients.length>1&&(this._currentEmitRate2=this._emitRateGradients[1].getFactor())),this._startSizeGradients&&(this._startSizeGradients.length>0&&(this._currentStartSizeGradient=this._startSizeGradients[0],this._currentStartSize1=this._currentStartSizeGradient.getFactor(),this._currentStartSize2=this._currentStartSize1),this._startSizeGradients.length>1&&(this._currentStartSize2=this._startSizeGradients[1].getFactor())),this.preWarmCycles){-1!==(null===(t=this.emitter)||void 0===t?void 0:t.getClassName().indexOf("Mesh"))&&this.emitter.computeWorldMatrix(!0);var r=this.noiseTexture;if(r&&r.onGeneratedObservable)r.onGeneratedObservable.addOnce((function(){setTimeout((function(){for(var e=0;e0&&this._scene&&this._scene.beginAnimation(this,this.beginAnimationFrom,this.beginAnimationTo,this.beginAnimationLoop),this.onStartedObservable.notifyObservers(this)}},t.prototype.stop=function(e){void 0===e&&(e=!0),this._stopped||(this.onStoppedObservable.notifyObservers(this),this._stopped=!0,this._postStop(e))},t.prototype._postStop=function(e){},t.prototype.reset=function(){this._stockParticles.length=0,this._particles.length=0},t.prototype._appendParticleVertex=function(e,t,n,r){var i,o=e*this._vertexBufferSize,a=c.AA.Vector3[0].copyFrom((null===(i=this._scene)||void 0===i?void 0:i.floatingOriginOffset)||c.Pq.ZeroReadOnly);if(this._vertexData[o++]=t.position.x+this.worldOffset.x-a.x,this._vertexData[o++]=t.position.y+this.worldOffset.y-a.y,this._vertexData[o++]=t.position.z+this.worldOffset.z-a.z,this._vertexData[o++]=t.color.r,this._vertexData[o++]=t.color.g,this._vertexData[o++]=t.color.b,this._vertexData[o++]=t.color.a,this._vertexData[o++]=t.angle,this._vertexData[o++]=t.scale.x*t.size,this._vertexData[o++]=t.scale.y*t.size,this._isAnimationSheetEnabled&&(this._vertexData[o++]=t.cellIndex),this._isBillboardBased)this.billboardMode!==b.Y.PARTICLES_BILLBOARDMODE_STRETCHED&&this.billboardMode!==b.Y.PARTICLES_BILLBOARDMODE_STRETCHED_LOCAL||(this._vertexData[o++]=t.direction.x,this._vertexData[o++]=t.direction.y,this._vertexData[o++]=t.direction.z);else if(t._initialDirection){var s=t._initialDirection;this.isLocal&&(c.Pq.TransformNormalToRef(s,this._emitterWorldMatrix,c.AA.Vector3[0]),s=c.AA.Vector3[0]),0===s.x&&0===s.z&&(s.x=.001),this._vertexData[o++]=s.x,this._vertexData[o++]=s.y,this._vertexData[o++]=s.z}else{var l=t.direction;this.isLocal&&(c.Pq.TransformNormalToRef(l,this._emitterWorldMatrix,c.AA.Vector3[0]),l=c.AA.Vector3[0]),0===l.x&&0===l.z&&(l.x=.001),this._vertexData[o++]=l.x,this._vertexData[o++]=l.y,this._vertexData[o++]=l.z}this._useRampGradients&&t.remapData&&(this._vertexData[o++]=t.remapData.x,this._vertexData[o++]=t.remapData.y,this._vertexData[o++]=t.remapData.z,this._vertexData[o++]=t.remapData.w),this._useInstancing||(this._isAnimationSheetEnabled&&(0===n?n=this._epsilon:1===n&&(n=1-this._epsilon),0===r?r=this._epsilon:1===r&&(r=1-this._epsilon)),this._vertexData[o++]=n,this._vertexData[o++]=r)},t.prototype._prepareParticle=function(e){},t.prototype._createNewOnes=function(e){for(var t,n=0;n0,this.emitter.position){var t=this.emitter;this._emitterWorldMatrix=t.getWorldMatrix()}else{var n=this.emitter;this._emitterWorldMatrix=c.uq.Translation(n.x,n.y,n.z)}this._emitterWorldMatrix.invertToRef(this._emitterInverseWorldMatrix),this.updateFunction(this._particles),this._createNewOnes(e)},t._GetAttributeNamesOrOptions=function(e,t,n){void 0===e&&(e=!1),void 0===t&&(t=!1),void 0===n&&(n=!1);var r=[se.R.PositionKind,se.R.ColorKind,"angle","offset","size"];return e&&r.push("cellIndex"),t||r.push("direction"),n&&r.push("remapData"),r},t._GetEffectCreationOptions=function(e,t,n){void 0===e&&(e=!1),void 0===t&&(t=!1),void 0===n&&(n=!1);var r=["invView","view","projection","textureMask","translationPivot","eyePosition"];return(0,Mo.Ll)(r),e&&r.push("particlesInfos"),t&&r.push("logarithmicDepthConstant"),n&&(r.push("vFogInfos"),r.push("vFogColor")),r},t.prototype.fillDefines=function(e,t,n){if(void 0===n&&(n=!0),this._scene&&((0,Mo.r4)(this,this._scene,e),this.applyFog&&this._scene.fogEnabled&&this._scene.fogMode!==b.Y.FOGMODE_NONE&&e.push("#define FOG")),this._isAnimationSheetEnabled&&e.push("#define ANIMATESHEET"),this.useLogarithmicDepth&&e.push("#define LOGARITHMICDEPTH"),t===Kv.BLENDMODE_MULTIPLY&&e.push("#define BLENDMULTIPLYMODE"),this._useRampGradients&&e.push("#define RAMPGRADIENT"),this._isBillboardBased)switch(e.push("#define BILLBOARD"),this.billboardMode){case b.Y.PARTICLES_BILLBOARDMODE_Y:e.push("#define BILLBOARDY");break;case b.Y.PARTICLES_BILLBOARDMODE_STRETCHED:case b.Y.PARTICLES_BILLBOARDMODE_STRETCHED_LOCAL:e.push("#define BILLBOARDSTRETCHED"),this.billboardMode===b.Y.PARTICLES_BILLBOARDMODE_STRETCHED_LOCAL&&e.push("#define BILLBOARDSTRETCHED_LOCAL");break;case b.Y.PARTICLES_BILLBOARDMODE_ALL:e.push("#define BILLBOARDMODE_ALL")}n&&this._imageProcessingConfiguration&&(this._imageProcessingConfiguration.prepareDefines(this._imageProcessingConfigurationDefines),e.push(this._imageProcessingConfigurationDefines.toString()))},t.prototype.fillUniformsAttributesAndSamplerNames=function(e,n,r){n.push.apply(n,t._GetAttributeNamesOrOptions(this._isAnimationSheetEnabled,this._isBillboardBased&&this.billboardMode!==b.Y.PARTICLES_BILLBOARDMODE_STRETCHED&&this.billboardMode!==b.Y.PARTICLES_BILLBOARDMODE_STRETCHED_LOCAL,this._useRampGradients)),e.push.apply(e,t._GetEffectCreationOptions(this._isAnimationSheetEnabled,this.useLogarithmicDepth,this.applyFog)),r.push("diffuseSampler","rampSampler"),this._imageProcessingConfiguration&&((0,aM._)(e,this._imageProcessingConfigurationDefines),(0,aM.C)(r,this._imageProcessingConfigurationDefines))},t.prototype._getWrapper=function(e){var t=this._getCustomDrawWrapper(e);if(null==t?void 0:t.effect)return t;var n=[];this.fillDefines(n,e);var r=this._engine._features.supportRenderPasses?this._engine.currentRenderPassId:b.Y.RENDERPASS_MAIN,i=this._drawWrappers[r];i||(i=this._drawWrappers[r]=[]);var o=i[e];o||((o=new fe.E(this._engine)).drawContext&&(o.drawContext.useInstancing=this._useInstancing),i[e]=o);var a=n.join("\n");if(o.defines!==a){var s=[],l=[],c=[];this.fillUniformsAttributesAndSamplerNames(l,s,c),o.setEffect(this._engine.createEffect("particles",s,l,c,a,void 0,void 0,void 0,void 0,this._shaderLanguage),a)}return o},t.prototype.animate=function(e){var t,n=this;if(void 0===e&&(e=!1),this._started&&!this.paused){if(!e&&this._scene){if(!this.isReady())return;if(this._currentRenderId===this._scene.getFrameId())return;this._currentRenderId=this._scene.getFrameId()}var r;if(this._scaledUpdateSpeed=this.updateSpeed*(e?this.preWarmStepOffset:(null===(t=this._scene)||void 0===t?void 0:t.getAnimationRatio())||1),this.manualEmitCount>-1)r=this.manualEmitCount,this._newPartsExcess=0,this.manualEmitCount=0;else{var i=this.emitRate;if(this._emitRateGradients&&this._emitRateGradients.length>0&&this.targetStopDuration){var o=this._actualFrame/this.targetStopDuration;JO.GetCurrentGradient(o,this._emitRateGradients,(function(e,t,r){e!==n._currentEmitRateGradient&&(n._currentEmitRate1=n._currentEmitRate2,n._currentEmitRate2=t.getFactor(),n._currentEmitRateGradient=e),i=(0,lr.Lerp)(n._currentEmitRate1,n._currentEmitRate2,r)}))}r=i*this._scaledUpdateSpeed|0,this._newPartsExcess+=i*this._scaledUpdateSpeed-r}if(this._newPartsExcess>1&&(r+=0|this._newPartsExcess,this._newPartsExcess-=0|this._newPartsExcess),this._alive=!1,this._stopped?r=0:(this._actualFrame+=this._scaledUpdateSpeed,this.targetStopDuration&&this._actualFrame>=this.targetStopDuration&&this.stop()),this._update(r),this._stopped&&(this._alive||(this._started=!1,this.onAnimationEnd&&this.onAnimationEnd(),this.disposeOnStop&&this._scene&&this._scene._toBeDisposed.push(this))),!e){for(var a=0,s=0;s=0&&(d.invertToRef(c.AA.Matrix[0]),u.setMatrix("invView",c.AA.Matrix[0])),void 0!==this._vertexArrayObject?(null===(r=this._scene)||void 0===r?void 0:r.forceWireframe)?h.bindBuffers(this._vertexBuffers,this._linesIndexBufferUseInstancing,u):(this._vertexArrayObject||(this._vertexArrayObject=this._engine.recordVertexArrayObject(this._vertexBuffers,this._indexBuffer,u)),this._engine.bindVertexArrayObject(this._vertexArrayObject,this._indexBuffer)):this._indexBuffer?h.bindBuffers(this._vertexBuffers,(null===(o=this._scene)||void 0===o?void 0:o.forceWireframe)?this._linesIndexBuffer:this._indexBuffer,u):h.bindBuffers(this._vertexBuffers,(null===(i=this._scene)||void 0===i?void 0:i.forceWireframe)?this._linesIndexBufferUseInstancing:null,u),this.useLogarithmicDepth&&this._scene&&(0,Le.DL)(m,u,this._scene),this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.applyByPostProcess&&this._imageProcessingConfiguration.bind(u),this._setEngineBasedOnBlendMode(e),this._onBeforeDrawParticlesObservable&&this._onBeforeDrawParticlesObservable.notifyObservers(u),this._useInstancing?(null===(a=this._scene)||void 0===a?void 0:a.forceWireframe)?h.drawElementsType(b.Y.MATERIAL_LineStripDrawMode,0,10,this._particles.length):h.drawArraysType(b.Y.MATERIAL_TriangleStripDrawMode,0,4,this._particles.length):(null===(s=this._scene)||void 0===s?void 0:s.forceWireframe)?h.drawElementsType(b.Y.MATERIAL_WireFrameFillMode,0,10*this._particles.length):h.drawElementsType(b.Y.MATERIAL_TriangleFillMode,0,6*this._particles.length),this._particles.length},t.prototype.render=function(){if(!this.isReady()||!this._particles.length)return 0;var e=this._engine;e.setState&&(e.setState(!1),this.forceDepthWrite&&e.setDepthWrite(!0));var t;return t=this.blendMode===Kv.BLENDMODE_MULTIPLYADD?this._render(Kv.BLENDMODE_MULTIPLY)+this._render(Kv.BLENDMODE_ADD):this._render(this.blendMode),this._engine.unbindInstanceAttributes(),this._engine.setAlphaMode(b.Y.ALPHA_DISABLE),t},t.prototype._onDispose=function(e,t){void 0===e&&(e=!1),void 0===t&&(t=!1)},t.prototype.dispose=function(e,t,n){if(void 0===e&&(e=!0),void 0===t&&(t=!1),void 0===n&&(n=!1),this.resetDrawCache(),this._vertexBuffer&&(this._vertexBuffer.dispose(),this._vertexBuffer=null),this._spriteBuffer&&(this._spriteBuffer.dispose(),this._spriteBuffer=null),this._indexBuffer&&(this._engine._releaseBuffer(this._indexBuffer),this._indexBuffer=null),this._linesIndexBuffer&&(this._engine._releaseBuffer(this._linesIndexBuffer),this._linesIndexBuffer=null),this._linesIndexBufferUseInstancing&&(this._engine._releaseBuffer(this._linesIndexBufferUseInstancing),this._linesIndexBufferUseInstancing=null),this._vertexArrayObject&&(this._engine.releaseVertexArrayObject(this._vertexArrayObject),this._vertexArrayObject=null),e&&this.particleTexture&&(this.particleTexture.dispose(),this.particleTexture=null),e&&this.noiseTexture&&(this.noiseTexture.dispose(),this.noiseTexture=null),this._rampGradientsTexture&&(this._rampGradientsTexture.dispose(),this._rampGradientsTexture=null),this._onDispose(t,n),this._onBeforeDrawParticlesObservable&&this._onBeforeDrawParticlesObservable.clear(),this._scene){var r=this._scene.particleSystems.indexOf(this);r>-1&&this._scene.particleSystems.splice(r,1),this._scene._activeParticleSystems.dispose()}this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this.onStoppedObservable.clear(),this.onStartedObservable.clear(),this.reset(),this._isDisposed=!0},t.ForceGLSL=!1,t}(Kv);!function(e){e[e.ATTACHED=0]="ATTACHED",e[e.END=1]="END"}(XM||(XM={}));var qM=function(){function e(e){if(this.particleSystem=e,this.type=1,this.inheritDirection=!1,this.inheritedVelocityAmount=0,!e.emitter||!e.emitter.dispose){var t=(0,h.n9)("BABYLON.AbstractMesh");e.emitter=new t("SubemitterSystemEmitter",e.getScene()),e._disposeEmitterOnDispose=!0}}return e.prototype.clone=function(){var t=this.particleSystem.emitter;t?t instanceof c.Pq?t=t.clone():-1!==t.getClassName().indexOf("Mesh")&&((t=new((0,h.n9)("BABYLON.Mesh"))("",t.getScene())).isVisible=!1):t=new c.Pq;var n=new e(this.particleSystem.clone(this.particleSystem.name,t));return n.particleSystem.name+="Clone",n.type=this.type,n.inheritDirection=this.inheritDirection,n.inheritedVelocityAmount=this.inheritedVelocityAmount,n.particleSystem._disposeEmitterOnDispose=!0,n.particleSystem.disposeOnStop=!0,n},e.prototype.serialize=function(e){void 0===e&&(e=!1);var t={};return t.type=this.type,t.inheritDirection=this.inheritDirection,t.inheritedVelocityAmount=this.inheritedVelocityAmount,t.particleSystem=this.particleSystem.serialize(e),t},e._ParseParticleSystem=function(e,t,n,r){throw void 0===r&&(r=!1),(0,le.n)("ParseParticle")},e.Parse=function(t,n,r){var i=t.particleSystem,o=new e(e._ParseParticleSystem(i,n,r,!0));return o.type=t.type,o.inheritDirection=t.inheritDirection,o.inheritedVelocityAmount=t.inheritedVelocityAmount,o.particleSystem._isSubEmitter=!0,o},e.prototype.dispose=function(){this.particleSystem.dispose()},e}(),KM=function(){function e(e){void 0===e&&(e=null),this._indices=null,this._positions=null,this._normals=null,this._storedNormal=c.Pq.Zero(),this._mesh=null,this.direction1=new c.Pq(0,1,0),this.direction2=new c.Pq(0,1,0),this.useMeshNormalsForDirection=!0,this.mesh=e}return Object.defineProperty(e.prototype,"mesh",{get:function(){return this._mesh},set:function(e){this._mesh!==e&&(this._mesh=e,e?(this._indices=e.getIndices(),this._positions=e.getVerticesData(se.R.PositionKind),this._normals=e.getVerticesData(se.R.NormalKind)):(this._indices=null,this._positions=null,this._normals=null))},enumerable:!1,configurable:!0}),e.prototype.startDirectionFunction=function(e,t,n,r){if(this.useMeshNormalsForDirection&&this._normals)c.Pq.TransformNormalToRef(this._storedNormal,e,t);else{var i=(0,lr.RandomRange)(this.direction1.x,this.direction2.x),o=(0,lr.RandomRange)(this.direction1.y,this.direction2.y),a=(0,lr.RandomRange)(this.direction1.z,this.direction2.z);r?t.copyFromFloats(i,o,a):c.Pq.TransformNormalFromFloatsToRef(i,o,a,e,t)}},e.prototype.startPositionFunction=function(e,t,n,r){if(this._indices&&this._positions){var i=3*(Math.random()*(this._indices.length/3)|0),o=Math.random(),a=Math.random()*(1-o),s=1-o-a,l=this._indices[i],u=this._indices[i+1],h=this._indices[i+2],d=c.AA.Vector3[0],p=c.AA.Vector3[1],f=c.AA.Vector3[2],m=c.AA.Vector3[3];c.Pq.FromArrayToRef(this._positions,3*l,d),c.Pq.FromArrayToRef(this._positions,3*u,p),c.Pq.FromArrayToRef(this._positions,3*h,f),m.x=o*d.x+a*p.x+s*f.x,m.y=o*d.y+a*p.y+s*f.y,m.z=o*d.z+a*p.z+s*f.z,r?t.copyFromFloats(m.x,m.y,m.z):c.Pq.TransformCoordinatesFromFloatsToRef(m.x,m.y,m.z,e,t),this.useMeshNormalsForDirection&&this._normals&&(c.Pq.FromArrayToRef(this._normals,3*l,d),c.Pq.FromArrayToRef(this._normals,3*u,p),c.Pq.FromArrayToRef(this._normals,3*h,f),this._storedNormal.x=o*d.x+a*p.x+s*f.x,this._storedNormal.y=o*d.y+a*p.y+s*f.y,this._storedNormal.z=o*d.z+a*p.z+s*f.z)}},e.prototype.clone=function(){var t=new e(this.mesh);return D.r.DeepCopy(this,t),t},e.prototype.applyToShader=function(e){e.setVector3("direction1",this.direction1),e.setVector3("direction2",this.direction2)},e.prototype.buildUniformLayout=function(e){e.addUniform("direction1",3),e.addUniform("direction2",3)},e.prototype.getEffectDefines=function(){return""},e.prototype.getClassName=function(){return"MeshParticleEmitter"},e.prototype.serialize=function(){var e,t={};return t.type=this.getClassName(),t.direction1=this.direction1.asArray(),t.direction2=this.direction2.asArray(),t.meshId=null===(e=this.mesh)||void 0===e?void 0:e.id,t.useMeshNormalsForDirection=this.useMeshNormalsForDirection,t},e.prototype.parse=function(e,t){c.Pq.FromArrayToRef(e.direction1,0,this.direction1),c.Pq.FromArrayToRef(e.direction2,0,this.direction2),e.meshId&&t&&(this.mesh=t.getLastMeshById(e.meshId)),this.useMeshNormalsForDirection=e.useMeshNormalsForDirection},e}(),ZM=function(){function e(){this.particlePositionGenerator=function(){},this.particleDestinationGenerator=function(){},this.particleDirectionGenerator=function(){}}return e.prototype.startDirectionFunction=function(e,t,n,r){var i=c.AA.Vector3[0];if(this.particleDirectionGenerator)this.particleDirectionGenerator(-1,n,i);else if(this.particleDestinationGenerator){this.particleDestinationGenerator(-1,n,i);var o=c.AA.Vector3[1];i.subtractToRef(n.position,o),o.scaleToRef(1/n.lifeTime,i)}else i.set(0,0,0);r?t.copyFrom(i):c.Pq.TransformNormalToRef(i,e,t)},e.prototype.startPositionFunction=function(e,t,n,r){var i=c.AA.Vector3[0];this.particlePositionGenerator?this.particlePositionGenerator(-1,n,i):i.set(0,0,0),r?t.copyFrom(i):c.Pq.TransformCoordinatesToRef(i,e,t)},e.prototype.clone=function(){var t=new e;return D.r.DeepCopy(this,t),t},e.prototype.applyToShader=function(e){},e.prototype.buildUniformLayout=function(e){},e.prototype.getEffectDefines=function(){return"#define CUSTOMEMITTER"},e.prototype.getClassName=function(){return"CustomParticleEmitter"},e.prototype.serialize=function(){var e={};return e.type=this.getClassName(),e.particlePositionGenerator=this.particlePositionGenerator,e.particleDestinationGenerator=this.particleDestinationGenerator,e},e.prototype.parse=function(e){e.particlePositionGenerator&&(this.particlePositionGenerator=e.particlePositionGenerator),e.particleDestinationGenerator&&(this.particleDestinationGenerator=e.particleDestinationGenerator)},e}(),QM=function(){function e(){this.direction1=new c.Pq(0,1,0),this.direction2=new c.Pq(0,1,0)}return e.prototype.startDirectionFunction=function(e,t,n,r){var i=(0,lr.RandomRange)(this.direction1.x,this.direction2.x),o=(0,lr.RandomRange)(this.direction1.y,this.direction2.y),a=(0,lr.RandomRange)(this.direction1.z,this.direction2.z);r?t.copyFromFloats(i,o,a):c.Pq.TransformNormalFromFloatsToRef(i,o,a,e,t)},e.prototype.startPositionFunction=function(e,t,n,r){r?t.copyFromFloats(0,0,0):c.Pq.TransformCoordinatesFromFloatsToRef(0,0,0,e,t)},e.prototype.clone=function(){var t=new e;return D.r.DeepCopy(this,t),t},e.prototype.applyToShader=function(e){e.setVector3("direction1",this.direction1),e.setVector3("direction2",this.direction2)},e.prototype.buildUniformLayout=function(e){e.addUniform("direction1",3),e.addUniform("direction2",3)},e.prototype.getEffectDefines=function(){return"#define POINTEMITTER"},e.prototype.getClassName=function(){return"PointParticleEmitter"},e.prototype.serialize=function(){var e={};return e.type=this.getClassName(),e.direction1=this.direction1.asArray(),e.direction2=this.direction2.asArray(),e},e.prototype.parse=function(e){c.Pq.FromArrayToRef(e.direction1,0,this.direction1),c.Pq.FromArrayToRef(e.direction2,0,this.direction2)},e}(),JM=function(){function e(e,t,n){void 0===e&&(e=1),void 0===t&&(t=1),void 0===n&&(n=0),this.radius=e,this.radiusRange=t,this.directionRandomizer=n}return e.prototype.startDirectionFunction=function(e,t,n,r){var i=n.position.subtract(e.getTranslation()).normalize(),o=(0,lr.RandomRange)(0,this.directionRandomizer),a=(0,lr.RandomRange)(0,this.directionRandomizer),s=(0,lr.RandomRange)(0,this.directionRandomizer);i.x+=o,i.y+=a,i.z+=s,i.normalize(),r?t.copyFrom(i):c.Pq.TransformNormalFromFloatsToRef(i.x,i.y,i.z,e,t)},e.prototype.startPositionFunction=function(e,t,n,r){var i=this.radius-(0,lr.RandomRange)(0,this.radius*this.radiusRange),o=(0,lr.RandomRange)(0,1),a=(0,lr.RandomRange)(0,2*Math.PI),s=Math.acos(2*o-1),l=i*Math.cos(a)*Math.sin(s),u=i*Math.cos(s),h=i*Math.sin(a)*Math.sin(s);r?t.copyFromFloats(l,Math.abs(u),h):c.Pq.TransformCoordinatesFromFloatsToRef(l,Math.abs(u),h,e,t)},e.prototype.clone=function(){var t=new e(this.radius,this.directionRandomizer);return D.r.DeepCopy(this,t),t},e.prototype.applyToShader=function(e){e.setFloat("radius",this.radius),e.setFloat("radiusRange",this.radiusRange),e.setFloat("directionRandomizer",this.directionRandomizer)},e.prototype.buildUniformLayout=function(e){e.addUniform("radius",1),e.addUniform("radiusRange",1),e.addUniform("directionRandomizer",1)},e.prototype.getEffectDefines=function(){return"#define HEMISPHERICEMITTER"},e.prototype.getClassName=function(){return"HemisphericParticleEmitter"},e.prototype.serialize=function(){var e={};return e.type=this.getClassName(),e.radius=this.radius,e.radiusRange=this.radiusRange,e.directionRandomizer=this.directionRandomizer,e},e.prototype.parse=function(e){this.radius=e.radius,this.radiusRange=e.radiusRange,this.directionRandomizer=e.directionRandomizer},e}(),$M=function(){function e(e,t,n){void 0===e&&(e=1),void 0===t&&(t=1),void 0===n&&(n=0),this.radius=e,this.radiusRange=t,this.directionRandomizer=n}return e.prototype.startDirectionFunction=function(e,t,n,r){var i=n.position.subtract(e.getTranslation()).normalize(),o=(0,lr.RandomRange)(0,this.directionRandomizer),a=(0,lr.RandomRange)(0,this.directionRandomizer),s=(0,lr.RandomRange)(0,this.directionRandomizer);i.x+=o,i.y+=a,i.z+=s,i.normalize(),r?t.copyFrom(i):c.Pq.TransformNormalFromFloatsToRef(i.x,i.y,i.z,e,t)},e.prototype.startPositionFunction=function(e,t,n,r){var i=this.radius-(0,lr.RandomRange)(0,this.radius*this.radiusRange),o=(0,lr.RandomRange)(0,1),a=(0,lr.RandomRange)(0,2*Math.PI),s=Math.acos(2*o-1),l=i*Math.cos(a)*Math.sin(s),u=i*Math.cos(s),h=i*Math.sin(a)*Math.sin(s);r?t.copyFromFloats(l,u,h):c.Pq.TransformCoordinatesFromFloatsToRef(l,u,h,e,t)},e.prototype.clone=function(){var t=new e(this.radius,this.directionRandomizer);return D.r.DeepCopy(this,t),t},e.prototype.applyToShader=function(e){e.setFloat("radius",this.radius),e.setFloat("radiusRange",this.radiusRange),e.setFloat("directionRandomizer",this.directionRandomizer)},e.prototype.buildUniformLayout=function(e){e.addUniform("radius",1),e.addUniform("radiusRange",1),e.addUniform("directionRandomizer",1)},e.prototype.getEffectDefines=function(){return"#define SPHEREEMITTER"},e.prototype.getClassName=function(){return"SphereParticleEmitter"},e.prototype.serialize=function(){var e={};return e.type=this.getClassName(),e.radius=this.radius,e.radiusRange=this.radiusRange,e.directionRandomizer=this.directionRandomizer,e},e.prototype.parse=function(e){this.radius=e.radius,this.radiusRange=e.radiusRange,this.directionRandomizer=e.directionRandomizer},e}(),eD=function(e){function t(t,n,r){void 0===t&&(t=1),void 0===n&&(n=new c.Pq(0,1,0)),void 0===r&&(r=new c.Pq(0,1,0));var i=e.call(this,t)||this;return i.direction1=n,i.direction2=r,i}return(0,f.C6)(t,e),t.prototype.startDirectionFunction=function(e,t){var n=(0,lr.RandomRange)(this.direction1.x,this.direction2.x),r=(0,lr.RandomRange)(this.direction1.y,this.direction2.y),i=(0,lr.RandomRange)(this.direction1.z,this.direction2.z);c.Pq.TransformNormalFromFloatsToRef(n,r,i,e,t)},t.prototype.clone=function(){var e=new t(this.radius,this.direction1,this.direction2);return D.r.DeepCopy(this,e),e},t.prototype.applyToShader=function(e){e.setFloat("radius",this.radius),e.setFloat("radiusRange",this.radiusRange),e.setVector3("direction1",this.direction1),e.setVector3("direction2",this.direction2)},t.prototype.buildUniformLayout=function(e){e.addUniform("radius",1),e.addUniform("radiusRange",1),e.addUniform("direction1",3),e.addUniform("direction2",3)},t.prototype.getEffectDefines=function(){return"#define SPHEREEMITTER\n#define DIRECTEDSPHEREEMITTER"},t.prototype.getClassName=function(){return"SphereDirectedParticleEmitter"},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.direction1=this.direction1.asArray(),t.direction2=this.direction2.asArray(),t},t.prototype.parse=function(t){e.prototype.parse.call(this,t),this.direction1.copyFrom(t.direction1),this.direction2.copyFrom(t.direction2)},t}($M),tD=function(){function e(e,t,n,r){void 0===e&&(e=1),void 0===t&&(t=1),void 0===n&&(n=1),void 0===r&&(r=0),this.radius=e,this.height=t,this.radiusRange=n,this.directionRandomizer=r,this._tempVector=c.Pq.Zero()}return e.prototype.startDirectionFunction=function(e,t,n,r,i){n.position.subtractToRef(e.getTranslation(),this._tempVector),this._tempVector.normalize(),c.Pq.TransformNormalToRef(this._tempVector,i,this._tempVector);var o=(0,lr.RandomRange)(-this.directionRandomizer/2,this.directionRandomizer/2),a=Math.atan2(this._tempVector.x,this._tempVector.z);a+=(0,lr.RandomRange)(-Math.PI/2,Math.PI/2)*this.directionRandomizer,this._tempVector.y=o,this._tempVector.x=Math.sin(a),this._tempVector.z=Math.cos(a),this._tempVector.normalize(),r?t.copyFrom(this._tempVector):c.Pq.TransformNormalFromFloatsToRef(this._tempVector.x,this._tempVector.y,this._tempVector.z,e,t)},e.prototype.startPositionFunction=function(e,t,n,r){var i=(0,lr.RandomRange)(-this.height/2,this.height/2),o=(0,lr.RandomRange)(0,2*Math.PI),a=(0,lr.RandomRange)((1-this.radiusRange)*(1-this.radiusRange),1),s=Math.sqrt(a)*this.radius,l=s*Math.cos(o),u=s*Math.sin(o);r?t.copyFromFloats(l,i,u):c.Pq.TransformCoordinatesFromFloatsToRef(l,i,u,e,t)},e.prototype.clone=function(){var t=new e(this.radius,this.directionRandomizer);return D.r.DeepCopy(this,t),t},e.prototype.applyToShader=function(e){e.setFloat("radius",this.radius),e.setFloat("height",this.height),e.setFloat("radiusRange",this.radiusRange),e.setFloat("directionRandomizer",this.directionRandomizer)},e.prototype.buildUniformLayout=function(e){e.addUniform("radius",1),e.addUniform("height",1),e.addUniform("radiusRange",1),e.addUniform("directionRandomizer",1)},e.prototype.getEffectDefines=function(){return"#define CYLINDEREMITTER"},e.prototype.getClassName=function(){return"CylinderParticleEmitter"},e.prototype.serialize=function(){var e={};return e.type=this.getClassName(),e.radius=this.radius,e.height=this.height,e.radiusRange=this.radiusRange,e.directionRandomizer=this.directionRandomizer,e},e.prototype.parse=function(e){this.radius=e.radius,this.height=e.height,this.radiusRange=e.radiusRange,this.directionRandomizer=e.directionRandomizer},e}(),nD=function(e){function t(t,n,r,i,o){void 0===t&&(t=1),void 0===n&&(n=1),void 0===r&&(r=1),void 0===i&&(i=new c.Pq(0,1,0)),void 0===o&&(o=new c.Pq(0,1,0));var a=e.call(this,t,n,r)||this;return a.direction1=i,a.direction2=o,a}return(0,f.C6)(t,e),t.prototype.startDirectionFunction=function(e,t,n,r){var i=(0,lr.RandomRange)(this.direction1.x,this.direction2.x),o=(0,lr.RandomRange)(this.direction1.y,this.direction2.y),a=(0,lr.RandomRange)(this.direction1.z,this.direction2.z);r?t.copyFromFloats(i,o,a):c.Pq.TransformNormalFromFloatsToRef(i,o,a,e,t)},t.prototype.clone=function(){var e=new t(this.radius,this.height,this.radiusRange,this.direction1,this.direction2);return D.r.DeepCopy(this,e),e},t.prototype.applyToShader=function(e){e.setFloat("radius",this.radius),e.setFloat("height",this.height),e.setFloat("radiusRange",this.radiusRange),e.setVector3("direction1",this.direction1),e.setVector3("direction2",this.direction2)},t.prototype.buildUniformLayout=function(e){e.addUniform("radius",1),e.addUniform("height",1),e.addUniform("radiusRange",1),e.addUniform("direction1",3),e.addUniform("direction2",3)},t.prototype.getEffectDefines=function(){return"#define CYLINDEREMITTER\n#define DIRECTEDCYLINDEREMITTER"},t.prototype.getClassName=function(){return"CylinderDirectedParticleEmitter"},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.direction1=this.direction1.asArray(),t.direction2=this.direction2.asArray(),t},t.prototype.parse=function(t){e.prototype.parse.call(this,t),c.Pq.FromArrayToRef(t.direction1,0,this.direction1),c.Pq.FromArrayToRef(t.direction2,0,this.direction2)},t}(tD),rD=function(){function e(e,t,n){void 0===e&&(e=1),void 0===t&&(t=Math.PI),void 0===n&&(n=0),this.directionRandomizer=n,this.radiusRange=1,this.heightRange=1,this.emitFromSpawnPointOnly=!1,this.angle=t,this.radius=e}return Object.defineProperty(e.prototype,"radius",{get:function(){return this._radius},set:function(e){this._radius=e,this._buildHeight()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"angle",{get:function(){return this._angle},set:function(e){this._angle=e,this._buildHeight()},enumerable:!1,configurable:!0}),e.prototype._buildHeight=function(){0!==this._angle?this._height=this._radius/Math.tan(this._angle/2):this._height=1},e.prototype.startDirectionFunction=function(e,t,n,r){r?c.AA.Vector3[0].copyFrom(n._localPosition).normalize():n.position.subtractToRef(e.getTranslation(),c.AA.Vector3[0]).normalize();var i=(0,lr.RandomRange)(0,this.directionRandomizer),o=(0,lr.RandomRange)(0,this.directionRandomizer),a=(0,lr.RandomRange)(0,this.directionRandomizer);t.x=c.AA.Vector3[0].x+i,t.y=c.AA.Vector3[0].y+o,t.z=c.AA.Vector3[0].z+a,t.normalize()},e.prototype.startPositionFunction=function(e,t,n,r){var i,o=(0,lr.RandomRange)(0,2*Math.PI);i=this.emitFromSpawnPointOnly?1e-4:1-(i=(0,lr.RandomRange)(0,this.heightRange))*i;var a=this._radius-(0,lr.RandomRange)(0,this._radius*this.radiusRange),s=(a*=i)*Math.sin(o),l=a*Math.cos(o),u=i*this._height;if(r)return t.x=s,t.y=u,void(t.z=l);c.Pq.TransformCoordinatesFromFloatsToRef(s,u,l,e,t)},e.prototype.clone=function(){var t=new e(this._radius,this._angle,this.directionRandomizer);return D.r.DeepCopy(this,t),t},e.prototype.applyToShader=function(e){e.setFloat2("radius",this._radius,this.radiusRange),e.setFloat("coneAngle",this._angle),e.setFloat2("height",this._height,this.heightRange),e.setFloat("directionRandomizer",this.directionRandomizer)},e.prototype.buildUniformLayout=function(e){e.addUniform("radius",2),e.addUniform("coneAngle",1),e.addUniform("height",2),e.addUniform("directionRandomizer",1)},e.prototype.getEffectDefines=function(){var e="#define CONEEMITTER";return this.emitFromSpawnPointOnly&&(e+="\n#define CONEEMITTERSPAWNPOINT"),e},e.prototype.getClassName=function(){return"ConeParticleEmitter"},e.prototype.serialize=function(){var e={};return e.type=this.getClassName(),e.radius=this._radius,e.angle=this._angle,e.directionRandomizer=this.directionRandomizer,e.radiusRange=this.radiusRange,e.heightRange=this.heightRange,e.emitFromSpawnPointOnly=this.emitFromSpawnPointOnly,e},e.prototype.parse=function(e){this.radius=e.radius,this.angle=e.angle,this.directionRandomizer=e.directionRandomizer,this.radiusRange=void 0!==e.radiusRange?e.radiusRange:1,this.heightRange=void 0!==e.radiusRange?e.heightRange:1,this.emitFromSpawnPointOnly=void 0!==e.emitFromSpawnPointOnly&&e.emitFromSpawnPointOnly},e}(),iD=function(e){function t(t,n,r,i){void 0===t&&(t=1),void 0===n&&(n=Math.PI),void 0===r&&(r=new c.Pq(0,1,0)),void 0===i&&(i=new c.Pq(0,1,0));var o=e.call(this,t,n)||this;return o.direction1=r,o.direction2=i,o}return(0,f.C6)(t,e),t.prototype.startDirectionFunction=function(e,t){var n=(0,lr.RandomRange)(this.direction1.x,this.direction2.x),r=(0,lr.RandomRange)(this.direction1.y,this.direction2.y),i=(0,lr.RandomRange)(this.direction1.z,this.direction2.z);c.Pq.TransformNormalFromFloatsToRef(n,r,i,e,t)},t.prototype.clone=function(){var e=new t(this.radius,this.angle,this.direction1,this.direction2);return D.r.DeepCopy(this,e),e},t.prototype.applyToShader=function(e){e.setFloat("radius",this.radius),e.setFloat("radiusRange",this.radiusRange),e.setVector3("direction1",this.direction1),e.setVector3("direction2",this.direction2)},t.prototype.buildUniformLayout=function(e){e.addUniform("radius",1),e.addUniform("radiusRange",1),e.addUniform("direction1",3),e.addUniform("direction2",3)},t.prototype.getEffectDefines=function(){return"#define CONEEMITTER\n#define DIRECTEDCONEEMITTER"},t.prototype.getClassName=function(){return"ConeDirectedParticleEmitter"},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.direction1=this.direction1.asArray(),t.direction2=this.direction2.asArray(),t},t.prototype.parse=function(t){e.prototype.parse.call(this,t),this.direction1.copyFrom(t.direction1),this.direction2.copyFrom(t.direction2)},t}(rD);function oD(e,t){var n=new QM;return n.direction1=e,n.direction2=t,n}function aD(e,t){return void 0===e&&(e=1),void 0===t&&(t=1),new JM(e,t)}function sD(e,t){return void 0===e&&(e=1),void 0===t&&(t=1),new $M(e,t)}function lD(e,t,n){return void 0===e&&(e=1),void 0===t&&(t=new c.Pq(0,1,0)),void 0===n&&(n=new c.Pq(0,1,0)),new eD(e,t,n)}function cD(e,t,n,r){return void 0===e&&(e=1),void 0===t&&(t=1),void 0===n&&(n=1),void 0===r&&(r=0),new tD(e,t,n,r)}function uD(e,t,n,r,i){return void 0===e&&(e=1),void 0===t&&(t=1),void 0===n&&(n=1),void 0===r&&(r=new c.Pq(0,1,0)),void 0===i&&(i=new c.Pq(0,1,0)),new nD(e,t,n,r,i)}function hD(e,t){return void 0===e&&(e=1),void 0===t&&(t=Math.PI/4),new rD(e,t)}function dD(e,t,n,r){return void 0===e&&(e=1),void 0===t&&(t=Math.PI/4),void 0===n&&(n=new c.Pq(0,1,0)),void 0===r&&(r=new c.Pq(0,1,0)),new iD(e,t,n,r)}var pD=c.Pq.Zero(),fD=c.Pq.Zero(),mD=c.Pq.Zero(),_D=function(){function e(){this.strength=0,this.position=c.Pq.Zero()}return e.prototype._processParticle=function(e,t){this.position.subtractToRef(e.position,pD);var n=pD.lengthSquared()+1;pD.normalize().scaleToRef(this.strength/n,fD),fD.scaleToRef(t._tempScaledUpdateSpeed,mD),e.direction.addInPlace(mD)},e.prototype.serialize=function(){return{position:this.position.asArray(),strength:this.strength}},e}(),gD=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._disposeEmitterOnDispose=!1,t.canStart=function(){return!0},t._flowMap=null,t._flowMapUpdate=null,t._source=null,t._blockReference=0,t.flowMapStrength=1,t._attractors=[],t._attractorUpdate=null,t.metadata=null,t._emitFromParticle=function(e){if(t._subEmitters&&0!==t._subEmitters.length)for(var n=Math.floor(Math.random()*t._subEmitters.length),r=0,i=t._subEmitters[n];r0){var t=this._subEmitters[Math.floor(Math.random()*this._subEmitters.length)];e._attachedSubEmitters=[];for(var n=0,r=t;n=0;o-=1)i._attachedSubEmitters[o].dispose()}if(t&&this.activeSubSystems)for(o=this.activeSubSystems.length-1;o>=0;o-=1)this.activeSubSystems[o].dispose();if(this._subEmitters&&this._subEmitters.length){for(var a=0;a0?h.shaderOptions.defines.join("\n"):"";l=a.createEffectForParticles(h.shaderPath.fragmentElement,h.shaderOptions.uniforms,h.shaderOptions.samplers,d)}var p=new t(s,o||e.capacity,n,l,e.isAnimationSheetEnabled);if(p.customShader=h,p._rootUrl=r,e.id&&(p.id=e.id),e.subEmitters){p.subEmitters=[];for(var f=0,m=e.subEmitters;f0?o.shaderOptions.defines.join("\n"):"",l=a.createEffectForParticles(o.shaderPath.fragmentElement,o.shaderOptions.uniforms,o.shaderOptions.samplers,s);i[0]?i[0].effect=l:this.setCustomEffect(l,0)}var c=this.serialize(r),u=t.Parse(c,this._scene||this._engine,this._rootUrl);return u.name=e,u.customShader=o,u._customWrappers=i,void 0===n&&(n=this.emitter),this.noiseTexture&&(u.noiseTexture=this.noiseTexture.clone()),u.emitter=n,this.preventAutoStart||u.start(),u},t.BILLBOARDMODE_Y=b.Y.PARTICLES_BILLBOARDMODE_Y,t.BILLBOARDMODE_ALL=b.Y.PARTICLES_BILLBOARDMODE_ALL,t.BILLBOARDMODE_STRETCHED=b.Y.PARTICLES_BILLBOARDMODE_STRETCHED,t.BILLBOARDMODE_STRETCHED_LOCAL=b.Y.PARTICLES_BILLBOARDMODE_STRETCHED_LOCAL,t}(jM);qM._ParseParticleSystem=gD.Parse;var vD,yD=function(){function e(){this._trackedScene=null}return e.prototype.track=function(e){this._trackedScene=e,Te.p.AllowLoadingUniqueId=!0,this._savedJSON=OO.Serialize(e),Te.p.AllowLoadingUniqueId=!1},e.prototype.getDelta=function(){if(!this._trackedScene)return null;var e=_n.g.ForceSerializeBuffers;_n.g.ForceSerializeBuffers=!1,Te.p.AllowLoadingUniqueId=!0;var t=OO.Serialize(this._trackedScene);Te.p.AllowLoadingUniqueId=!1;var n={};for(var r in t)this._compareCollections(r,this._savedJSON[r],t[r],n);return _n.g.ForceSerializeBuffers=e,n},e.prototype._compareArray=function(e,t,n,r){if(0===t.length&&0===n.length)return!0;if(t.length&&!isNaN(t[0])||n.length&&!isNaN(n[0])){if(t.length!==n.length)return!1;if(0===t.length)return!0;for(var i=0;ie._MAX_SEQUENCE_LENGTH)throw new Error("Sequences longer than "+e._MAX_SEQUENCE_LENGTH+" not supported.");this._alphabet=n,this._characters=t.map((function(e){return r._alphabet.getCharacterIdx(e)}))}return e.prototype.serialize=function(){return JSON.stringify(this._characters)},e.Deserialize=function(t,n){var r=new e([],n);return r._characters=JSON.parse(t),r},e.prototype.distance=function(t){return e._Distance(this,t)},e._Distance=function(t,n){var r=t._alphabet;if(r!==n._alphabet)throw new Error("Cannot Levenshtein compare Sequences built from different alphabets.");var i=t._characters,o=n._characters,a=i.length,s=o.length,l=e._CostMatrix;l[0][0]=0;for(var c=0;c.98||(c.Pq.CrossToRef(e._ForwardDir,e._InverseFromVec,e._UpDir),e._UpDir.normalize(),c.uq.LookAtLHToRef(t,n,e._UpDir,e._LookMatrix),r.subtractToRef(n,e._FromToVec),e._FromToVec.normalize(),c.Pq.TransformNormalToRef(e._FromToVec,e._LookMatrix,i),0))},e._TokenizeSegment=function(t,n){e._BestMatch=0,e._Score=c.Pq.Dot(t,n[0]),e._BestScore=e._Score;for(var r=1;re._BestScore&&(e._BestMatch=r,e._BestScore=e._Score);return e._BestMatch},e._ForwardDir=new c.Pq,e._InverseFromVec=new c.Pq,e._UpDir=new c.Pq,e._FromToVec=new c.Pq,e._LookMatrix=new c.uq,e}(),TD=function(){function e(e){this.chars=new Array(e)}return e.Generate=function(t,n,r,i,o){void 0===t&&(t=64),void 0===n&&(n=256),void 0===r&&(r=.1),void 0===i&&(i=.001),void 0===o&&(o=[]);for(var a,s,l=new e(t),u=0;u1e-6&&p.scaleAndAddToRef(1/(p.lengthSquared()*s),d)}d.scaleInPlace(a),l.chars[u].addInPlace(d),l.chars[u].normalize()}return l},e.prototype.serialize=function(){return JSON.stringify(this.chars)},e.Deserialize=function(t){for(var n=JSON.parse(t),r=new e(n.length),i=0;i4;o=Math.floor(o/2))i.push(t.resampleAtTargetResolution(o).tokenize(n.chars));return i},e.prototype.distance=function(e){for(var t=0,n=0;n0&&(this._averageDistance=Math.max(this._averageDistance/this._descriptors.length,e._MIN_AVERAGE_DISTANCE))},e._MIN_AVERAGE_DISTANCE=1,e}(),PD=function(){function e(){this._maximumAllowableMatchCost=4,this._nameToDescribedTrajectory=new Map}return e.prototype.serialize=function(){var e={};return e.maximumAllowableMatchCost=this._maximumAllowableMatchCost,e.vector3Alphabet=this._vector3Alphabet.serialize(),e.levenshteinAlphabet=this._levenshteinAlphabet.serialize(),e.nameToDescribedTrajectory=[],this._nameToDescribedTrajectory.forEach((function(t,n){e.nameToDescribedTrajectory.push(n),e.nameToDescribedTrajectory.push(t.serialize())})),JSON.stringify(e)},e.Deserialize=function(t){var n=JSON.parse(t),r=new e;r._maximumAllowableMatchCost=n.maximumAllowableMatchCost,r._vector3Alphabet=TD.Deserialize(n.vector3Alphabet),r._levenshteinAlphabet=vD.Alphabet.Deserialize(n.levenshteinAlphabet);for(var i=0;i=this._itemLength?NaN:this._view[e]},e.prototype.subarray=function(e,t){return e>=t||e<0?new Float32Array(0):(t>this._itemLength&&(t=this._itemLength),this._view.subarray(e,t))},e.prototype.push=function(e){this._view[this._itemLength]=e,this._itemLength++,this._itemLength>=this._view.length&&this._growArray()},e.prototype._growArray=function(){var e=Math.floor(1.5*this._view.length),t=new Float32Array(e);t.set(this._view),this._view=t},e}(),OD=1800,MD="timestamp",DD="numPoints",ND=/\r/g,FD=function(){function e(t,n){var r=this;this._scene=t,this._collectDataAtFrame=function(){var t=Ut.j.Now-r._startingTimestamp,n=r.datasets.ids.length,i=r.datasets.startingIndices.itemLength,o=0;if(i>0){var a=r.datasets.startingIndices.at(i-1);o=a+r.datasets.data.at(a+e.NumberOfPointsOffset)+e.SliceDataOffset}r.datasets.startingIndices.push(o),r.datasets.data.push(t),r.datasets.data.push(n);for(var s=0,l=r.datasets.ids;s>n&255).toString(16);r+=i.substring(i.length-2)}return r},e.prototype.getCurrentSlice=function(){for(var e=[Ut.j.Now-this._startingTimestamp,this.datasets.ids.length],t=0,n=this.datasets.ids;t0}))})).filter((function(e){return e.length>0})),i=e.NumberOfPointsOffset;if(r.length<2)return!1;var o={ids:[],data:new ID(OD),startingIndices:new ID(OD)},a=r[0],s=r.slice(1);if(a.length<2||a[0]!==MD||a[i]!==DD)return!1;for(var l=new Map,c=e.SliceDataOffset;c0)){this._log("enableSnapshotRendering","called"),this._disableCancelFunctions.size>0&&this._log("enableSnapshotRendering","cancelling ".concat(this._disableCancelFunctions.size,' "disable" callbacks')),this._disableCancelFunctions.forEach((function(e){return e()})),this._disableCancelFunctions.clear(),this._isEnabling=!0,this._disableRenderingRefCount=0,this._currentPerformancePriorityMode=null!==(e=this._pendingCurrentPerformancePriorityMode)&&void 0!==e?e:this._scene.performancePriority,this._pendingCurrentPerformancePriorityMode=void 0,this._scene.performancePriority=0;var n=function(){t._enableCancelFunctions.delete(n);var e=t._engine.frameId+2;t._log("enableSnapshotRendering","scene ready, add callbacks for frames ".concat(e," and ").concat(e+1)),t._executeAtFrame(e,(function(){t._log("enableSnapshotRendering","callback #1, enable snapshot rendering at the engine level"),t._engine.snapshotRendering=!0})),t._executeAtFrame(e+1,(function(){t._log("enableSnapshotRendering","callback #2, signals that snapshot rendering helper is ready"),t._isEnabling=!1}))};this._enableCancelFunctions.set(n,(function(){return t._scene.onReadyObservable.removeCallback(n)})),this._scene.executeWhenReady(n)}},e.prototype.disableSnapshotRendering=function(){var e=this;if(this._engine.isWebGPU){if(this._log("disableSnapshotRendering","called"),0===this._disableRenderingRefCount&&(this._enableCancelFunctions.size>0&&this._log("disableSnapshotRendering","cancelling ".concat(this._enableCancelFunctions.size,' "enable" callbacks')),this._enableCancelFunctions.forEach((function(e){return e()})),this._enableCancelFunctions.clear(),this._isEnabling=!1,this._scene.performancePriority=0,0!==this._currentPerformancePriorityMode)){this._log("disableSnapshotRendering","makes sure that the scene is rendered once in BackwardCompatible mode (code: ".concat(0,") before switching to mode ").concat(this._currentPerformancePriorityMode)),this._pendingCurrentPerformancePriorityMode=this._currentPerformancePriorityMode;var t=function(){e._log("disableSnapshotRendering","scene ready, add callback for frame ".concat(e._engine.frameId+2)),e._executeAtFrame(e._engine.frameId+2,(function(){e._log("disableSnapshotRendering","switching to performance priority mode ".concat(e._pendingCurrentPerformancePriorityMode)),e._scene.performancePriority=e._pendingCurrentPerformancePriorityMode,e._pendingCurrentPerformancePriorityMode=void 0}),"whenDisabled")};this._disableCancelFunctions.set(t,(function(){return e._scene.onReadyObservable.removeCallback(t)})),this._scene.executeWhenReady(t)}this._engine.snapshotRendering=!1,this._disableRenderingRefCount++}},e.prototype.fixMeshes=function(e){if(this._engine.isWebGPU)for(var t=0,n=e=e||this._scene.meshes;t=e&&(r._engine.onEndFrameObservable.remove(o),"whenEnabled"===n?r._enableCancelFunctions.delete(i):r._disableCancelFunctions.delete(i),t())},o=this._engine.onEndFrameObservable.add(i);"whenEnabled"===n?this._enableCancelFunctions.set(i,(function(){return r._engine.onEndFrameObservable.remove(o)})):this._disableCancelFunctions.set(i,(function(){return r._engine.onEndFrameObservable.remove(o)}))},e.prototype._log=function(e,t){this.showDebugLogs&&y.V.Log("[Frame: ".concat(this._engine.frameId,"] SnapshotRenderingHelper:").concat(e," - ").concat(t))},e}();l.cP.prototype.runCoroutineAsync=function(e){if(!this._coroutineScheduler){var t=(n=this,r=new Array,i=new Array,o=new Array,a=n.add((function(){for(var e=r.length,t=0;t-1&&(this._agentDestinationArmed[n]=!0,this._agentDestination[n].set(t.x,t.y,t.z))},e.prototype.agentTeleport=function(e,t){this.recastCrowd.agentTeleport(e,new this.bjsRECASTPlugin.bjsRECAST.Vec3(t.x,t.y,t.z))},e.prototype.updateAgentParameters=function(e,t){var n=this.recastCrowd.getAgentParameters(e);void 0!==t.radius&&(n.radius=t.radius),void 0!==t.height&&(n.height=t.height),void 0!==t.maxAcceleration&&(n.maxAcceleration=t.maxAcceleration),void 0!==t.maxSpeed&&(n.maxSpeed=t.maxSpeed),void 0!==t.collisionQueryRange&&(n.collisionQueryRange=t.collisionQueryRange),void 0!==t.pathOptimizationRange&&(n.pathOptimizationRange=t.pathOptimizationRange),void 0!==t.separationWeight&&(n.separationWeight=t.separationWeight),this.recastCrowd.setAgentParameters(e,n)},e.prototype.removeAgent=function(e){this.recastCrowd.removeAgent(e);var t=this.agents.indexOf(e);t>-1&&(this.agents.splice(t,1),this.transforms.splice(t,1),this.reachRadii.splice(t,1),this._agentDestinationArmed.splice(t,1),this._agentDestination.splice(t,1))},e.prototype.getAgents=function(){return this.agents},e.prototype.update=function(e){if(this.bjsRECASTPlugin.navMesh.update(),!(e<=Du.bH)){var t=this.bjsRECASTPlugin.getTimeStep(),n=this.bjsRECASTPlugin.getMaximumSubStepCount();if(t<=Du.bH)this.recastCrowd.update(e);else{var r=Math.floor(e/t);n&&r>n&&(r=n),r<1&&(r=1);for(var i=e/r,o=0;od&&l.y=400&&o?o(c):n()}),!1),c.addEventListener("error",(function(){y.V.Error("error on XHR request."),o&&o()}),!1),c.send()}else y.V.Error("Error: IndexedDB not supported by your browser or Babylon.js database is not open."),o&&o()},e._ValidateXHRData=function(e,t){void 0===t&&(t=7);try{if(1&t){if(e.responseText&&e.responseText.length>0)return!0;if(1===t)return!1}if(2&t){var n=(0,LO.O_)(e.response);if(n.width&&n.height&&n.width>0&&n.height>0)return!0;if(2===t)return!1}if(4&t){var r=new Uint8Array(e.response,0,3);return 68===r[0]&&68===r[1]&&83===r[2]}}catch(e){}return!1},e._IsUaSupportingBlobStorage=!0,e.IDBStorageEnabled=!1,e._ParseURL=function(e){document.createElement("a").href=e;var t=e.substring(0,e.lastIndexOf("#")),n=e.substring(t.lastIndexOf("/")+1,e.length);return e.substring(0,e.indexOf(n,0))},e._ReturnFullUrlLocation=function(t){return-1===t.indexOf("http:/")&&-1===t.indexOf("https:/")&&"undefined"!=typeof window?e._ParseURL(window.location.href)+t:t},e}(),$D=function(){function e(e){this._isUbo(e)?(this.setMatrix3x3=e.updateMatrix3x3.bind(e),this.setMatrix2x2=e.updateMatrix2x2.bind(e),this.setFloat=e.updateFloat.bind(e),this.setFloat2=e.updateFloat2.bind(e),this.setFloat3=e.updateFloat3.bind(e),this.setFloat4=e.updateFloat4.bind(e),this.setFloatArray=e.updateFloatArray.bind(e),this.setArray=e.updateArray.bind(e),this.setIntArray=e.updateIntArray.bind(e),this.setMatrix=e.updateMatrix.bind(e),this.setMatrices=e.updateMatrices.bind(e),this.setVector3=e.updateVector3.bind(e),this.setVector4=e.updateVector4.bind(e),this.setColor3=e.updateColor3.bind(e),this.setColor4=e.updateColor4.bind(e),this.setDirectColor4=e.updateDirectColor4.bind(e),this.setInt=e.updateInt.bind(e),this.setInt2=e.updateInt2.bind(e),this.setInt3=e.updateInt3.bind(e),this.setInt4=e.updateInt4.bind(e)):(this.setMatrix3x3=e.setMatrix3x3.bind(e),this.setMatrix2x2=e.setMatrix2x2.bind(e),this.setFloat=e.setFloat.bind(e),this.setFloat2=e.setFloat2.bind(e),this.setFloat3=e.setFloat3.bind(e),this.setFloat4=e.setFloat4.bind(e),this.setFloatArray=e.setFloatArray.bind(e),this.setArray=e.setArray.bind(e),this.setIntArray=e.setIntArray.bind(e),this.setMatrix=e.setMatrix.bind(e),this.setMatrices=e.setMatrices.bind(e),this.setVector3=e.setVector3.bind(e),this.setVector4=e.setVector4.bind(e),this.setColor3=e.setColor3.bind(e),this.setColor4=e.setColor4.bind(e),this.setDirectColor4=e.setDirectColor4.bind(e),this.setInt=e.setInt.bind(e),this.setInt2=e.setInt2.bind(e),this.setInt3=e.setInt3.bind(e),this.setInt4=e.setInt4.bind(e))}return e.prototype._isUbo=function(e){return void 0!==e.addUniform},e}(),eN="gpuUpdateParticlesPixelShader";Bi.l.ShadersStore[eN]||(Bi.l.ShadersStore[eN]="#version 300 es\nvoid main() {discard;}\n");var tN="gpuUpdateParticlesVertexShader";Bi.l.ShadersStore[tN]||(Bi.l.ShadersStore[tN]="#version 300 es\n#define PI 3.14159\nuniform float currentCount;uniform float timeDelta;uniform float stopFactor;\n#ifndef LOCAL\nuniform mat4 emitterWM;\n#endif\nuniform vec2 lifeTime;uniform vec2 emitPower;uniform vec2 sizeRange;uniform vec4 scaleRange;\n#ifdef FLOWMAP\nuniform mat4 flowMapProjection;uniform float flowMapStrength;uniform sampler2D flowMapSampler;\n#endif\n#ifndef COLORGRADIENTS\nuniform vec4 color1;uniform vec4 color2;\n#endif\nuniform vec3 gravity;uniform sampler2D randomSampler;uniform sampler2D randomSampler2;uniform vec4 angleRange;\n#ifdef BOXEMITTER\nuniform vec3 direction1;uniform vec3 direction2;uniform vec3 minEmitBox;uniform vec3 maxEmitBox;\n#endif\n#ifdef POINTEMITTER\nuniform vec3 direction1;uniform vec3 direction2;\n#endif\n#ifdef HEMISPHERICEMITTER\nuniform float radius;uniform float radiusRange;uniform float directionRandomizer;\n#endif\n#ifdef SPHEREEMITTER\nuniform float radius;uniform float radiusRange;\n#ifdef DIRECTEDSPHEREEMITTER\nuniform vec3 direction1;uniform vec3 direction2;\n#else\nuniform float directionRandomizer;\n#endif\n#endif\n#ifdef CYLINDEREMITTER\nuniform float radius;uniform float height;uniform float radiusRange;\n#ifdef DIRECTEDCYLINDEREMITTER\nuniform vec3 direction1;uniform vec3 direction2;\n#else\nuniform float directionRandomizer;\n#endif\n#endif\n#ifdef CONEEMITTER\nuniform vec2 radius;uniform float coneAngle;uniform vec2 height;\n#ifdef DIRECTEDCONEEMITTER\nuniform vec3 direction1;uniform vec3 direction2;\n#else\nuniform float directionRandomizer;\n#endif\n#endif\nin vec3 position;\n#ifdef CUSTOMEMITTER\nin vec3 initialPosition;\n#endif\nin float age;in float life;in vec4 seed;in vec3 size;\n#ifndef COLORGRADIENTS\nin vec4 color;\n#endif\nin vec3 direction;\n#ifndef BILLBOARD\nin vec3 initialDirection;\n#endif\n#ifdef ANGULARSPEEDGRADIENTS\nin float angle;\n#else\nin vec2 angle;\n#endif\n#ifdef ANIMATESHEET\nin float cellIndex;\n#ifdef ANIMATESHEETRANDOMSTART\nin float cellStartOffset;\n#endif\n#endif\n#ifdef NOISE\nin vec3 noiseCoordinates1;in vec3 noiseCoordinates2;\n#endif\nout vec3 outPosition;\n#ifdef CUSTOMEMITTER\nout vec3 outInitialPosition;\n#endif\nout float outAge;out float outLife;out vec4 outSeed;out vec3 outSize;\n#ifndef COLORGRADIENTS\nout vec4 outColor;\n#endif\nout vec3 outDirection;\n#ifndef BILLBOARD\nout vec3 outInitialDirection;\n#endif\n#ifdef ANGULARSPEEDGRADIENTS\nout float outAngle;\n#else\nout vec2 outAngle;\n#endif\n#ifdef ANIMATESHEET\nout float outCellIndex;\n#ifdef ANIMATESHEETRANDOMSTART\nout float outCellStartOffset;\n#endif\n#endif\n#ifdef NOISE\nout vec3 outNoiseCoordinates1;out vec3 outNoiseCoordinates2;\n#endif\n#ifdef SIZEGRADIENTS\nuniform sampler2D sizeGradientSampler;\n#endif \n#ifdef ANGULARSPEEDGRADIENTS\nuniform sampler2D angularSpeedGradientSampler;\n#endif \n#ifdef VELOCITYGRADIENTS\nuniform sampler2D velocityGradientSampler;\n#endif\n#ifdef LIMITVELOCITYGRADIENTS\nuniform sampler2D limitVelocityGradientSampler;uniform float limitVelocityDamping;\n#endif\n#ifdef DRAGGRADIENTS\nuniform sampler2D dragGradientSampler;\n#endif\n#ifdef NOISE\nuniform vec3 noiseStrength;uniform sampler2D noiseSampler;\n#endif\n#ifdef ANIMATESHEET\nuniform vec4 cellInfos;\n#endif\nvec3 getRandomVec3(float offset) {return texture(randomSampler2,vec2(float(gl_VertexID)*offset/currentCount,0)).rgb;}\nvec4 getRandomVec4(float offset) {return texture(randomSampler,vec2(float(gl_VertexID)*offset/currentCount,0));}\nvoid main() {float newAge=age+timeDelta; \nif (newAge>=life && stopFactor != 0.) {vec3 newPosition;vec3 newDirection;vec4 randoms=getRandomVec4(seed.x);outLife=lifeTime.x+(lifeTime.y-lifeTime.x)*randoms.r;outAge=newAge-life;outSeed=seed;\n#ifdef SIZEGRADIENTS \noutSize.x=texture(sizeGradientSampler,vec2(0,0)).r;\n#else\noutSize.x=sizeRange.x+(sizeRange.y-sizeRange.x)*randoms.g;\n#endif\noutSize.y=scaleRange.x+(scaleRange.y-scaleRange.x)*randoms.b;outSize.z=scaleRange.z+(scaleRange.w-scaleRange.z)*randoms.a; \n#ifndef COLORGRADIENTS\noutColor=color1+(color2-color1)*randoms.b;\n#endif\n#ifndef ANGULARSPEEDGRADIENTS \noutAngle.y=angleRange.x+(angleRange.y-angleRange.x)*randoms.a;outAngle.x=angleRange.z+(angleRange.w-angleRange.z)*randoms.r;\n#else\noutAngle=angleRange.z+(angleRange.w-angleRange.z)*randoms.r;\n#endif \n#ifdef POINTEMITTER\nvec3 randoms2=getRandomVec3(seed.y);vec3 randoms3=getRandomVec3(seed.z);newPosition=vec3(0,0,0);newDirection=direction1+(direction2-direction1)*randoms3;\n#elif defined(BOXEMITTER)\nvec3 randoms2=getRandomVec3(seed.y);vec3 randoms3=getRandomVec3(seed.z);newPosition=minEmitBox+(maxEmitBox-minEmitBox)*randoms2;newDirection=direction1+(direction2-direction1)*randoms3; \n#elif defined(HEMISPHERICEMITTER)\nvec3 randoms2=getRandomVec3(seed.y);vec3 randoms3=getRandomVec3(seed.z);float phi=2.0*PI*randoms2.x;float theta=acos(2.0*randoms2.y-1.0);float randX=cos(phi)*sin(theta);float randY=cos(theta);float randZ=sin(phi)*sin(theta);newPosition=(radius-(radius*radiusRange*randoms2.z))*vec3(randX,abs(randY),randZ);newDirection=newPosition+directionRandomizer*randoms3; \n#elif defined(SPHEREEMITTER)\nvec3 randoms2=getRandomVec3(seed.y);vec3 randoms3=getRandomVec3(seed.z);float phi=2.0*PI*randoms2.x;float theta=acos(2.0*randoms2.y-1.0);float randX=cos(phi)*sin(theta);float randY=cos(theta);float randZ=sin(phi)*sin(theta);newPosition=(radius-(radius*radiusRange*randoms2.z))*vec3(randX,randY,randZ);\n#ifdef DIRECTEDSPHEREEMITTER\nnewDirection=normalize(direction1+(direction2-direction1)*randoms3);\n#else\nnewDirection=normalize(newPosition+directionRandomizer*randoms3);\n#endif\n#elif defined(CYLINDEREMITTER)\nvec3 randoms2=getRandomVec3(seed.y);vec3 randoms3=getRandomVec3(seed.z);float yPos=(randoms2.x-0.5)*height;float angle=randoms2.y*PI*2.;float inverseRadiusRangeSquared=((1.-radiusRange)*(1.-radiusRange));float positionRadius=radius*sqrt(inverseRadiusRangeSquared+(randoms2.z*(1.-inverseRadiusRangeSquared)));float xPos=positionRadius*cos(angle);float zPos=positionRadius*sin(angle);newPosition=vec3(xPos,yPos,zPos);\n#ifdef DIRECTEDCYLINDEREMITTER\nnewDirection=direction1+(direction2-direction1)*randoms3;\n#else\nangle=angle+((randoms3.x-0.5)*PI)*directionRandomizer;newDirection=vec3(cos(angle),(randoms3.y-0.5)*directionRandomizer,sin(angle));newDirection=normalize(newDirection);\n#endif\n#elif defined(CONEEMITTER)\nvec3 randoms2=getRandomVec3(seed.y);float s=2.0*PI*randoms2.x;\n#ifdef CONEEMITTERSPAWNPOINT\nfloat h=0.0001;\n#else\nfloat h=randoms2.y*height.y;h=1.-h*h; \n#endif\nfloat lRadius=radius.x-radius.x*randoms2.z*radius.y;lRadius=lRadius*h;float randX=lRadius*sin(s);float randZ=lRadius*cos(s);float randY=h *height.x;newPosition=vec3(randX,randY,randZ); \nvec3 randoms3=getRandomVec3(seed.z);\n#ifdef DIRECTEDCONEEMITTER\nnewDirection=direction1+(direction2-direction1)*randoms3;\n#else\nif (abs(cos(coneAngle))==1.0) {newDirection=vec3(0.,1.0,0.);} else {newDirection=normalize(newPosition+directionRandomizer*randoms3); }\n#endif\n#elif defined(CUSTOMEMITTER)\nnewPosition=initialPosition;outInitialPosition=initialPosition;\n#else \nnewPosition=vec3(0.,0.,0.);newDirection=2.0*(getRandomVec3(seed.w)-vec3(0.5,0.5,0.5));\n#endif\nfloat power=emitPower.x+(emitPower.y-emitPower.x)*randoms.a;\n#ifdef LOCAL\noutPosition=newPosition;\n#else\noutPosition=(emitterWM*vec4(newPosition,1.)).xyz;\n#endif\n#ifdef CUSTOMEMITTER\noutDirection=direction;\n#ifndef BILLBOARD \noutInitialDirection=direction;\n#endif\n#else\n#ifdef LOCAL\nvec3 initial=newDirection;\n#else \nvec3 initial=(emitterWM*vec4(newDirection,0.)).xyz;\n#endif\noutDirection=initial*power;\n#ifndef BILLBOARD \noutInitialDirection=initial;\n#endif\n#endif\n#ifdef ANIMATESHEET \noutCellIndex=cellInfos.x;\n#ifdef ANIMATESHEETRANDOMSTART\noutCellStartOffset=randoms.a*outLife;\n#endif \n#endif\n#ifdef NOISE\noutNoiseCoordinates1=noiseCoordinates1;outNoiseCoordinates2=noiseCoordinates2;\n#endif\n} else {float directionScale=timeDelta;outAge=newAge;float ageGradient=newAge/life;\n#ifdef VELOCITYGRADIENTS\ndirectionScale*=texture(velocityGradientSampler,vec2(ageGradient,0)).r;\n#endif\n#ifdef DRAGGRADIENTS\ndirectionScale*=1.0-texture(dragGradientSampler,vec2(ageGradient,0)).r;\n#endif\n#if defined(CUSTOMEMITTER)\noutPosition=position+(direction-position)*ageGradient; \noutInitialPosition=initialPosition;\n#else\noutPosition=position+direction*directionScale;\n#endif\noutLife=life;outSeed=seed;\n#ifndef COLORGRADIENTS \noutColor=color;\n#endif\n#ifdef SIZEGRADIENTS\noutSize.x=texture(sizeGradientSampler,vec2(ageGradient,0)).r;outSize.yz=size.yz;\n#else\noutSize=size;\n#endif \n#ifndef BILLBOARD \noutInitialDirection=initialDirection;\n#endif\n#ifdef CUSTOMEMITTER\noutDirection=direction;\n#else\nvec3 updatedDirection=direction+gravity*timeDelta;\n#ifdef FLOWMAP\nvec4 clipSpace=(flowMapProjection*vec4(position,1.));vec3 ndcSpace=clipSpace.xyz/clipSpace.w;vec2 flowMapUV=ndcSpace.xy*0.5+0.5;vec4 flowMapValue=texture(flowMapSampler,flowMapUV);vec3 flowMapDirection=(flowMapValue.xyz*2.0-1.0)*flowMapValue.w;updatedDirection+=flowMapDirection*timeDelta*flowMapStrength;\n#endif\n#ifdef LIMITVELOCITYGRADIENTS\nfloat limitVelocity=texture(limitVelocityGradientSampler,vec2(ageGradient,0)).r;float currentVelocity=length(updatedDirection);if (currentVelocity>limitVelocity) {updatedDirection=updatedDirection*limitVelocityDamping;}\n#endif\noutDirection=updatedDirection;\n#ifdef NOISE\nfloat fetchedR=texture(noiseSampler,vec2(noiseCoordinates1.x,noiseCoordinates1.y)*vec2(0.5)+vec2(0.5)).r;float fetchedG=texture(noiseSampler,vec2(noiseCoordinates1.z,noiseCoordinates2.x)*vec2(0.5)+vec2(0.5)).r;float fetchedB=texture(noiseSampler,vec2(noiseCoordinates2.y,noiseCoordinates2.z)*vec2(0.5)+vec2(0.5)).r;vec3 force=vec3(2.*fetchedR-1.,2.*fetchedG-1.,2.*fetchedB-1.)*noiseStrength;outDirection=outDirection+force*timeDelta;outNoiseCoordinates1=noiseCoordinates1;outNoiseCoordinates2=noiseCoordinates2;\n#endif \n#endif \n#ifdef ANGULARSPEEDGRADIENTS\nfloat angularSpeed=texture(angularSpeedGradientSampler,vec2(ageGradient,0)).r;outAngle=angle+angularSpeed*timeDelta;\n#else\noutAngle=vec2(angle.x+angle.y*timeDelta,angle.y);\n#endif\n#ifdef ANIMATESHEET \nfloat offsetAge=outAge;float dist=cellInfos.y-cellInfos.x;\n#ifdef ANIMATESHEETRANDOMSTART\noutCellStartOffset=cellStartOffset;offsetAge+=cellStartOffset;\n#else\nfloat cellStartOffset=0.;\n#endif \nfloat ratio=0.;if (cellInfos.w==1.0) {ratio=clamp(mod(cellStartOffset+cellInfos.z*offsetAge,life)/life,0.,1.0);}\nelse {ratio=clamp(cellStartOffset+cellInfos.z*offsetAge/life,0.,1.0);}\noutCellIndex=float(int(cellInfos.x+ratio*dist));\n#endif\n}}");var nN=function(){function e(e,t){this._renderVAO=[],this._updateVAO=[],this.alignDataInBuffer=!1,this._parent=e,this._engine=t,this._updateEffectOptions={attributes:["position","initialPosition","age","life","seed","size","color","direction","initialDirection","angle","cellIndex","cellStartOffset","noiseCoordinates1","noiseCoordinates2"],uniformsNames:["currentCount","timeDelta","emitterWM","lifeTime","color1","color2","sizeRange","scaleRange","gravity","emitPower","direction1","direction2","minEmitBox","maxEmitBox","radius","directionRandomizer","height","coneAngle","stopFactor","angleRange","radiusRange","cellInfos","noiseStrength","limitVelocityDamping","flowMapProjection","flowMapStrength"],uniformBuffersNames:[],samplers:["randomSampler","randomSampler2","sizeGradientSampler","angularSpeedGradientSampler","velocityGradientSampler","limitVelocityGradientSampler","noiseSampler","dragGradientSampler","flowMapSampler"],defines:"",fallbacks:null,onCompiled:null,onError:null,indexParameters:null,maxSimultaneousLights:0,transformFeedbackVaryings:[]}}return e.prototype.contextLost=function(){this._updateEffect=void 0,this._renderVAO.length=0,this._updateVAO.length=0},e.prototype.isUpdateBufferCreated=function(){return!!this._updateEffect},e.prototype.isUpdateBufferReady=function(){var e,t;return null!==(t=null===(e=this._updateEffect)||void 0===e?void 0:e.isReady())&&void 0!==t&&t},e.prototype.createUpdateBuffer=function(e){return this._updateEffectOptions.transformFeedbackVaryings=["outPosition"],this._updateEffectOptions.transformFeedbackVaryings.push("outAge"),this._updateEffectOptions.transformFeedbackVaryings.push("outSize"),this._updateEffectOptions.transformFeedbackVaryings.push("outLife"),this._updateEffectOptions.transformFeedbackVaryings.push("outSeed"),this._updateEffectOptions.transformFeedbackVaryings.push("outDirection"),this._parent.particleEmitterType instanceof ZM&&this._updateEffectOptions.transformFeedbackVaryings.push("outInitialPosition"),this._parent._colorGradientsTexture||this._updateEffectOptions.transformFeedbackVaryings.push("outColor"),this._parent._isBillboardBased||this._updateEffectOptions.transformFeedbackVaryings.push("outInitialDirection"),this._parent.noiseTexture&&(this._updateEffectOptions.transformFeedbackVaryings.push("outNoiseCoordinates1"),this._updateEffectOptions.transformFeedbackVaryings.push("outNoiseCoordinates2")),this._updateEffectOptions.transformFeedbackVaryings.push("outAngle"),this._parent.isAnimationSheetEnabled&&(this._updateEffectOptions.transformFeedbackVaryings.push("outCellIndex"),this._parent.spriteRandomStartCell&&this._updateEffectOptions.transformFeedbackVaryings.push("outCellStartOffset")),this._updateEffectOptions.defines=e,this._updateEffect=this._engine.createEffect("gpuUpdateParticles",this._updateEffectOptions,this._engine),new $D(this._updateEffect)},e.prototype.createVertexBuffers=function(e,t){this._updateVAO.push(this._createUpdateVAO(e)),this._renderVAO.push(this._engine.recordVertexArrayObject(t,null,this._parent._getWrapper(this._parent.blendMode).effect)),this._engine.bindArrayBuffer(null),this._renderVertexBuffers=t},e.prototype.createParticleBuffer=function(e){return e},e.prototype.bindDrawBuffers=function(e,t,n){n?this._engine.bindBuffers(this._renderVertexBuffers,n,t):this._engine.bindVertexArrayObject(this._renderVAO[e],null)},e.prototype.preUpdateParticleBuffer=function(){var e=this._engine;if(this._engine.enableEffect(this._updateEffect),!e.setState)throw new Error("GPU particles cannot work without a full Engine. ThinEngine is not supported")},e.prototype.updateParticleBuffer=function(e,t,n){this._updateEffect.setTexture("randomSampler",this._parent._randomTexture),this._updateEffect.setTexture("randomSampler2",this._parent._randomTexture2),this._parent._flowMap&&this._updateEffect.setTexture("flowMapSampler",this._parent._flowMap),this._parent._sizeGradientsTexture&&this._updateEffect.setTexture("sizeGradientSampler",this._parent._sizeGradientsTexture),this._parent._angularSpeedGradientsTexture&&this._updateEffect.setTexture("angularSpeedGradientSampler",this._parent._angularSpeedGradientsTexture),this._parent._velocityGradientsTexture&&this._updateEffect.setTexture("velocityGradientSampler",this._parent._velocityGradientsTexture),this._parent._limitVelocityGradientsTexture&&this._updateEffect.setTexture("limitVelocityGradientSampler",this._parent._limitVelocityGradientsTexture),this._parent._dragGradientsTexture&&this._updateEffect.setTexture("dragGradientSampler",this._parent._dragGradientsTexture),this._parent.noiseTexture&&this._updateEffect.setTexture("noiseSampler",this._parent.noiseTexture),this._engine.bindVertexArrayObject(this._updateVAO[e],null);var r=this._engine;r.bindTransformFeedbackBuffer(t.getBuffer()),r.setRasterizerState(!1),r.beginTransformFeedback(!0),r.drawArraysType(b.Y.MATERIAL_PointListDrawMode,0,n),r.endTransformFeedback(),r.setRasterizerState(!0),r.bindTransformFeedbackBuffer(null)},e.prototype.releaseBuffers=function(){},e.prototype.releaseVertexBuffers=function(){for(var e=0;e0&&this._scene&&this._scene.beginAnimation(this,this.beginAnimationFrom,this.beginAnimationTo,this.beginAnimationLoop))},t.prototype.stop=function(){this._stopped||(this.onStoppedObservable.notifyObservers(this),this._stopped=!0)},t.prototype.reset=function(){this._releaseBuffers(),this._platform.releaseVertexBuffers(),this._currentActiveCount=0,this._targetIndex=0},t.prototype.getClassName=function(){return"GPUParticleSystem"},t.prototype.getCustomEffect=function(e){var t,n;return void 0===e&&(e=0),null!==(n=null===(t=this._customWrappers[e])||void 0===t?void 0:t.effect)&&void 0!==n?n:this._customWrappers[0].effect},t.prototype._getCustomDrawWrapper=function(e){var t;return void 0===e&&(e=0),null!==(t=this._customWrappers[e])&&void 0!==t?t:this._customWrappers[0]},t.prototype.setCustomEffect=function(e,t){void 0===t&&(t=0),this._customWrappers[t]=new fe.E(this._engine),this._customWrappers[t].effect=e},Object.defineProperty(t.prototype,"onBeforeDrawParticlesObservable",{get:function(){return this._onBeforeDrawParticlesObservable||(this._onBeforeDrawParticlesObservable=new l.cP),this._onBeforeDrawParticlesObservable},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"vertexShaderName",{get:function(){return"gpuRenderParticles"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"vertexBuffers",{get:function(){return this._renderVertexBuffers[1^this._targetIndex]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"indexBuffer",{get:function(){return null},enumerable:!1,configurable:!0}),t.prototype._removeGradientAndTexture=function(t,n,r){return e.prototype._removeGradientAndTexture.call(this,t,n,r),this._releaseBuffers(),this},t.prototype.addColorGradient=function(e,t){this._colorGradients||(this._colorGradients=[]);var n=new KO(e,t);return this._colorGradients.push(n),this._refreshColorGradient(!0),this._releaseBuffers(),this},t.prototype._refreshColorGradient=function(e){void 0===e&&(e=!1),this._colorGradients&&(e&&this._colorGradients.sort((function(e,t){return e.gradientt.gradient?1:0})),this._colorGradientsTexture&&(this._colorGradientsTexture.dispose(),this._colorGradientsTexture=null))},t.prototype.forceRefreshGradients=function(){this._refreshColorGradient(),this._refreshFactorGradient(this._sizeGradients,"_sizeGradientsTexture"),this._refreshFactorGradient(this._angularSpeedGradients,"_angularSpeedGradientsTexture"),this._refreshFactorGradient(this._velocityGradients,"_velocityGradientsTexture"),this._refreshFactorGradient(this._limitVelocityGradients,"_limitVelocityGradientsTexture"),this._refreshFactorGradient(this._dragGradients,"_dragGradientsTexture"),this.reset()},t.prototype.removeColorGradient=function(e){return this._removeGradientAndTexture(e,this._colorGradients,this._colorGradientsTexture),this._colorGradientsTexture=null,this},t.prototype.resetDrawCache=function(){var e;for(var t in this._drawWrappers)null===(e=this._drawWrappers[t].drawContext)||void 0===e||e.reset()},t.prototype._addFactorGradient=function(e,t,n){var r=new QO(t,n);e.push(r),this._releaseBuffers()},t.prototype.addSizeGradient=function(e,t){return this._sizeGradients||(this._sizeGradients=[]),this._addFactorGradient(this._sizeGradients,e,t),this._refreshFactorGradient(this._sizeGradients,"_sizeGradientsTexture",!0),this._releaseBuffers(),this},t.prototype.removeSizeGradient=function(e){return this._removeGradientAndTexture(e,this._sizeGradients,this._sizeGradientsTexture),this._sizeGradientsTexture=null,this},t.prototype._refreshFactorGradient=function(e,t,n){if(void 0===n&&(n=!1),e){n&&e.sort((function(e,t){return e.gradientt.gradient?1:0}));var r=this;r[t]&&(r[t].dispose(),r[t]=null)}},t.prototype.addAngularSpeedGradient=function(e,t){return this._angularSpeedGradients||(this._angularSpeedGradients=[]),this._addFactorGradient(this._angularSpeedGradients,e,t),this._refreshFactorGradient(this._angularSpeedGradients,"_angularSpeedGradientsTexture",!0),this._releaseBuffers(),this},t.prototype.removeAngularSpeedGradient=function(e){return this._removeGradientAndTexture(e,this._angularSpeedGradients,this._angularSpeedGradientsTexture),this._angularSpeedGradientsTexture=null,this},t.prototype.addVelocityGradient=function(e,t){return this._velocityGradients||(this._velocityGradients=[]),this._addFactorGradient(this._velocityGradients,e,t),this._refreshFactorGradient(this._velocityGradients,"_velocityGradientsTexture",!0),this._releaseBuffers(),this},t.prototype.removeVelocityGradient=function(e){return this._removeGradientAndTexture(e,this._velocityGradients,this._velocityGradientsTexture),this._velocityGradientsTexture=null,this},t.prototype.addLimitVelocityGradient=function(e,t){return this._limitVelocityGradients||(this._limitVelocityGradients=[]),this._addFactorGradient(this._limitVelocityGradients,e,t),this._refreshFactorGradient(this._limitVelocityGradients,"_limitVelocityGradientsTexture",!0),this._releaseBuffers(),this},t.prototype.removeLimitVelocityGradient=function(e){return this._removeGradientAndTexture(e,this._limitVelocityGradients,this._limitVelocityGradientsTexture),this._limitVelocityGradientsTexture=null,this},t.prototype.addDragGradient=function(e,t){return this._dragGradients||(this._dragGradients=[]),this._addFactorGradient(this._dragGradients,e,t),this._refreshFactorGradient(this._dragGradients,"_dragGradientsTexture",!0),this._releaseBuffers(),this},t.prototype.removeDragGradient=function(e){return this._removeGradientAndTexture(e,this._dragGradients,this._dragGradientsTexture),this._dragGradientsTexture=null,this},t.prototype.addEmitRateGradient=function(){return this},t.prototype.removeEmitRateGradient=function(){return this},t.prototype.addStartSizeGradient=function(){return this},t.prototype.removeStartSizeGradient=function(){return this},t.prototype.addColorRemapGradient=function(){return this},t.prototype.removeColorRemapGradient=function(){return this},t.prototype.addAlphaRemapGradient=function(){return this},t.prototype.removeAlphaRemapGradient=function(){return this},t.prototype.addRampGradient=function(){return this},t.prototype.removeRampGradient=function(){return this},t.prototype.getRampGradients=function(){return null},Object.defineProperty(t.prototype,"useRampGradients",{get:function(){return!1},set:function(e){},enumerable:!1,configurable:!0}),t.prototype.addLifeTimeGradient=function(){return this},t.prototype.removeLifeTimeGradient=function(){return this},t.prototype._reset=function(){this._releaseBuffers()},t.prototype._createVertexBuffers=function(e,t,n){var r={};r.position=t.createVertexBuffer("position",0,3,this._attributesStrideSize,!0);var i=3;r.age=t.createVertexBuffer("age",i,1,this._attributesStrideSize,!0),i+=1,r.size=t.createVertexBuffer("size",i,3,this._attributesStrideSize,!0),i+=3,r.life=t.createVertexBuffer("life",i,1,this._attributesStrideSize,!0),i+=1,i+=4,this.billboardMode===gD.BILLBOARDMODE_STRETCHED&&(r.direction=t.createVertexBuffer("direction",i,3,this._attributesStrideSize,!0)),i+=3,this._platform.alignDataInBuffer&&(i+=1),this.particleEmitterType instanceof ZM&&(i+=3,this._platform.alignDataInBuffer&&(i+=1)),this._colorGradientsTexture||(r.color=t.createVertexBuffer("color",i,4,this._attributesStrideSize,!0),i+=4),this._isBillboardBased||(r.initialDirection=t.createVertexBuffer("initialDirection",i,3,this._attributesStrideSize,!0),i+=3,this._platform.alignDataInBuffer&&(i+=1)),this.noiseTexture&&(r.noiseCoordinates1=t.createVertexBuffer("noiseCoordinates1",i,3,this._attributesStrideSize,!0),i+=3,this._platform.alignDataInBuffer&&(i+=1),r.noiseCoordinates2=t.createVertexBuffer("noiseCoordinates2",i,3,this._attributesStrideSize,!0),i+=3,this._platform.alignDataInBuffer&&(i+=1)),r.angle=t.createVertexBuffer("angle",i,1,this._attributesStrideSize,!0),this._angularSpeedGradientsTexture?i++:i+=2,this._isAnimationSheetEnabled&&(r.cellIndex=t.createVertexBuffer("cellIndex",i,1,this._attributesStrideSize,!0),i+=1,this.spriteRandomStartCell&&(r.cellStartOffset=t.createVertexBuffer("cellStartOffset",i,1,this._attributesStrideSize,!0),i+=1)),r.offset=n.createVertexBuffer("offset",0,2),r.uv=n.createVertexBuffer("uv",2,2),this._renderVertexBuffers.push(r),this._platform.createVertexBuffers(e,r),this.resetDrawCache()},t.prototype._initialize=function(e){if(void 0===e&&(e=!1),!this._buffer0||e){var t=this._engine,n=[];this._attributesStrideSize=21,this._targetIndex=0,this._platform.alignDataInBuffer&&(this._attributesStrideSize+=1),this.particleEmitterType instanceof ZM&&(this._attributesStrideSize+=3,this._platform.alignDataInBuffer&&(this._attributesStrideSize+=1)),this.isBillboardBased||(this._attributesStrideSize+=3,this._platform.alignDataInBuffer&&(this._attributesStrideSize+=1)),this._colorGradientsTexture&&(this._attributesStrideSize-=4),this._angularSpeedGradientsTexture&&(this._attributesStrideSize-=1),this._isAnimationSheetEnabled&&(this._attributesStrideSize+=1,this.spriteRandomStartCell&&(this._attributesStrideSize+=1)),this.noiseTexture&&(this._attributesStrideSize+=6,this._platform.alignDataInBuffer&&(this._attributesStrideSize+=2)),this._platform.alignDataInBuffer&&(this._attributesStrideSize+=3-(this._attributesStrideSize+3&3));for(var r=this.particleEmitterType instanceof ZM,i=c.AA.Vector3[0],o=0,a=0;a0;)n.push(0)}var l=new Float32Array([.5,.5,1,1,-.5,.5,0,1,.5,-.5,1,0,-.5,-.5,0,0]),u=this._platform.createParticleBuffer(n),h=this._platform.createParticleBuffer(n);this._buffer0=new se.h(t,u,!1,this._attributesStrideSize),this._buffer1=new se.h(t,h,!1,this._attributesStrideSize),this._spriteBuffer=new se.h(t,l,!1,4),this._renderVertexBuffers=[],this._createVertexBuffers(this._buffer0,this._buffer1,this._spriteBuffer),this._createVertexBuffers(this._buffer1,this._buffer0,this._spriteBuffer),this._sourceBuffer=this._buffer0,this._targetBuffer=this._buffer1}},t.prototype._recreateUpdateEffect=function(){this._createColorGradientTexture(),this._createSizeGradientTexture(),this._createAngularSpeedGradientTexture(),this._createVelocityGradientTexture(),this._createLimitVelocityGradientTexture(),this._createDragGradientTexture();var e=this.particleEmitterType?this.particleEmitterType.getEffectDefines():"";return this._isBillboardBased&&(e+="\n#define BILLBOARD"),this._colorGradientsTexture&&(e+="\n#define COLORGRADIENTS"),this._sizeGradientsTexture&&(e+="\n#define SIZEGRADIENTS"),this._angularSpeedGradientsTexture&&(e+="\n#define ANGULARSPEEDGRADIENTS"),this._velocityGradientsTexture&&(e+="\n#define VELOCITYGRADIENTS"),this._limitVelocityGradientsTexture&&(e+="\n#define LIMITVELOCITYGRADIENTS"),this._dragGradientsTexture&&(e+="\n#define DRAGGRADIENTS"),this._flowMap&&(e+="\n#define FLOWMAP"),this.isAnimationSheetEnabled&&(e+="\n#define ANIMATESHEET",this.spriteRandomStartCell&&(e+="\n#define ANIMATESHEETRANDOMSTART")),this.noiseTexture&&(e+="\n#define NOISE"),this.isLocal&&(e+="\n#define LOCAL"),this._platform.isUpdateBufferCreated()&&this._cachedUpdateDefines===e||(this._cachedUpdateDefines=e,this._updateBuffer=this._platform.createUpdateBuffer(e)),this._platform.isUpdateBufferReady()},t.prototype._getWrapper=function(e){var t=this._getCustomDrawWrapper(e);if(null==t?void 0:t.effect)return t;var n=[];this.fillDefines(n,e);var r=this._drawWrappers[e];r||((r=new fe.E(this._engine)).drawContext&&(r.drawContext.useInstancing=!0),this._drawWrappers[e]=r);var i=n.join("\n");if(r.defines!==i){var o=[],a=[],s=[];this.fillUniformsAttributesAndSamplerNames(a,o,s),r.setEffect(this._engine.createEffect("gpuRenderParticles",o,a,s,i),i)}return r},t._GetAttributeNamesOrOptions=function(e,t,n,r){void 0===e&&(e=!1),void 0===t&&(t=!1),void 0===n&&(n=!1),void 0===r&&(r=!1);var i=[se.R.PositionKind,"age","life","size","angle"];return e||i.push(se.R.ColorKind),t&&i.push("cellIndex"),n||i.push("initialDirection"),r&&i.push("direction"),i.push("offset",se.R.UVKind),i},t._GetEffectCreationOptions=function(e,t,n){void 0===e&&(e=!1),void 0===t&&(t=!1),void 0===n&&(n=!1);var r=["emitterWM","worldOffset","view","projection","colorDead","invView","translationPivot","eyePosition"];return(0,Mo.Ll)(r),e&&r.push("sheetInfos"),t&&r.push("logarithmicDepthConstant"),n&&(r.push("vFogInfos"),r.push("vFogColor")),r},t.prototype.fillDefines=function(e,t,n){if(void 0===t&&(t=0),void 0===n&&(n=!0),this._scene&&((0,Mo.r4)(this,this._scene,e),this.applyFog&&this._scene.fogEnabled&&this._scene.fogMode!==Vt.Z.FOGMODE_NONE&&e.push("#define FOG")),t===gD.BLENDMODE_MULTIPLY&&e.push("#define BLENDMULTIPLYMODE"),this.isLocal&&e.push("#define LOCAL"),this.useLogarithmicDepth&&e.push("#define LOGARITHMICDEPTH"),this._isBillboardBased)switch(e.push("#define BILLBOARD"),this.billboardMode){case gD.BILLBOARDMODE_Y:e.push("#define BILLBOARDY");break;case gD.BILLBOARDMODE_STRETCHED:e.push("#define BILLBOARDSTRETCHED");break;case gD.BILLBOARDMODE_ALL:e.push("#define BILLBOARDMODE_ALL")}this._colorGradientsTexture&&e.push("#define COLORGRADIENTS"),this.isAnimationSheetEnabled&&e.push("#define ANIMATESHEET"),n&&this._imageProcessingConfiguration&&(this._imageProcessingConfiguration.prepareDefines(this._imageProcessingConfigurationDefines),e.push(""+this._imageProcessingConfigurationDefines.toString()))},t.prototype.fillUniformsAttributesAndSamplerNames=function(e,n,r){n.push.apply(n,t._GetAttributeNamesOrOptions(!!this._colorGradientsTexture,this._isAnimationSheetEnabled,this._isBillboardBased,this._isBillboardBased&&this.billboardMode===gD.BILLBOARDMODE_STRETCHED)),e.push.apply(e,t._GetEffectCreationOptions(this._isAnimationSheetEnabled,this.useLogarithmicDepth,this.applyFog)),r.push("diffuseSampler","colorGradientSampler"),this._imageProcessingConfiguration&&(lo.p.PrepareUniforms(e,this._imageProcessingConfigurationDefines),lo.p.PrepareSamplers(r,this._imageProcessingConfigurationDefines))},t.prototype.animate=function(e){var t;void 0===e&&(e=!1),this._timeDelta=this.updateSpeed*(e?this.preWarmStepOffset:(null===(t=this._scene)||void 0===t?void 0:t.getAnimationRatio())||1),this._actualFrame+=this._timeDelta,this._stopped||this.targetStopDuration&&this._actualFrame>=this.targetStopDuration&&this.stop(),this.updateInAnimate&&this._update()},t.prototype._createFactorGradientTexture=function(e,t){var n=this[t];if(e&&e.length&&!n){for(var r=new Float32Array(this._rawTextureWidth),i=function(t){var n=t/o._rawTextureWidth;JO.GetCurrentGradient(n,e,(function(e,n,i){r[t]=(0,lr.Lerp)(e.factor1,n.factor1,i)}))},o=this,a=0;a=0){var _=h.clone();_.invert(),u.setMatrix("invView",_)}return this.useLogarithmicDepth&&this._scene&&(0,Le.DL)(m,u,this._scene),this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.applyByPostProcess&&this._imageProcessingConfiguration.bind(u),this._setEngineBasedOnBlendMode(e),this._platform.bindDrawBuffers(this._targetIndex,u,(null===(o=this._scene)||void 0===o?void 0:o.forceWireframe)?this._linesIndexBufferUseInstancing:null),this._onBeforeDrawParticlesObservable&&this._onBeforeDrawParticlesObservable.notifyObservers(u),(null===(a=this._scene)||void 0===a?void 0:a.forceWireframe)?this._engine.drawElementsType(b.Y.MATERIAL_LineStripDrawMode,0,10,this._currentActiveCount):this._engine.drawArraysType(b.Y.MATERIAL_TriangleStripDrawMode,0,4,this._currentActiveCount),this._engine.setAlphaMode(b.Y.ALPHA_DISABLE),(null===(s=this._scene)||void 0===s?void 0:s.forceWireframe)&&this._engine.unbindInstanceAttributes(),this._currentActiveCount},t.prototype._update=function(e){if(this.emitter&&this._targetBuffer&&this._recreateUpdateEffect()&&!this._rebuildingAfterContextLost){if(!e)if(this.emitter.position)e=this.emitter.getWorldMatrix();else{var t=this.emitter;e=c.AA.Matrix[0],c.uq.TranslationToRef(t.x,t.y,t.z,e)}var n=this._engine,r=n.getDepthWrite();if(n.setDepthWrite(!1),this._platform.preUpdateParticleBuffer(),this._updateBuffer.setFloat("currentCount",this._currentActiveCount),this._updateBuffer.setFloat("timeDelta",this._timeDelta),this._updateBuffer.setFloat("stopFactor",this._stopped?0:1),this._updateBuffer.setInt("randomTextureSize",this._randomTextureSize),this._updateBuffer.setFloat2("lifeTime",this.minLifeTime,this.maxLifeTime),this._updateBuffer.setFloat2("emitPower",this.minEmitPower,this.maxEmitPower),this._colorGradientsTexture||(this._updateBuffer.setDirectColor4("color1",this.color1),this._updateBuffer.setDirectColor4("color2",this.color2)),this._updateBuffer.setFloat2("sizeRange",this.minSize,this.maxSize),this._updateBuffer.setFloat4("scaleRange",this.minScaleX,this.maxScaleX,this.minScaleY,this.maxScaleY),this._updateBuffer.setFloat4("angleRange",this.minAngularSpeed,this.maxAngularSpeed,this.minInitialRotation,this.maxInitialRotation),this._updateBuffer.setVector3("gravity",this.gravity),this._limitVelocityGradientsTexture&&this._updateBuffer.setFloat("limitVelocityDamping",this.limitVelocityDamping),this.particleEmitterType&&this.particleEmitterType.applyToShader(this._updateBuffer),this._isAnimationSheetEnabled&&this._updateBuffer.setFloat4("cellInfos",this.startSpriteCellID,this.endSpriteCellID,this.spriteCellChangeSpeed,this.spriteCellLoop?1:0),this.noiseTexture&&this._updateBuffer.setVector3("noiseStrength",this.noiseStrength),this._flowMap){var i=this.getScene();this._updateBuffer.setFloat("flowMapStrength",this.flowMapStrength),this._updateBuffer.setMatrix("flowMapProjection",i.getTransformMatrix())}this.isLocal||this._updateBuffer.setMatrix("emitterWM",e),this._platform.updateParticleBuffer(this._targetIndex,this._targetBuffer,this._currentActiveCount),this._targetIndex++,2===this._targetIndex&&(this._targetIndex=0);var o=this._sourceBuffer;this._sourceBuffer=this._targetBuffer,this._targetBuffer=o,n.setDepthWrite(r)}},t.prototype.render=function(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=!1),!this._started)return 0;if(!this.isReady())return 0;if(!e&&this._scene){if(!this._preWarmDone&&this.preWarmCycles){for(var n=0;n-1?(this._accumulatedCount+=this.manualEmitCount,this.manualEmitCount=0):this._accumulatedCount+=this.emitRate*this._timeDelta,this._accumulatedCount>=1){var r=0|this._accumulatedCount;this._accumulatedCount-=r,this._currentActiveCount+=r}if(this._currentActiveCount=Math.min(this._maxActiveParticleCount,this._currentActiveCount),!this._currentActiveCount)return 0;var i;if(this.emitter.position)i=this.emitter.getWorldMatrix();else{var o=this.emitter;i=c.AA.Matrix[0],c.uq.TranslationToRef(o.x,o.y,o.z,i)}var a=this._engine;this.updateInAnimate||this._update(i);var s=0;return e||t||(a.setState(!1),this.forceDepthWrite&&a.setDepthWrite(!0),s=this.blendMode===gD.BLENDMODE_MULTIPLYADD?this._render(gD.BLENDMODE_MULTIPLY,i)+this._render(gD.BLENDMODE_ADD,i):this._render(this.blendMode,i),this._engine.setAlphaMode(b.Y.ALPHA_DISABLE)),s},t.prototype.rebuild=function(){var e=this,t=function(){e._recreateUpdateEffect()&&e._platform.isUpdateBufferReady()?(e._initialize(!0),e._rebuildingAfterContextLost=!1):setTimeout(t,10)};this._createIndexBuffer(),this._cachedUpdateDefines="",this._platform.contextLost(),this._rebuildingAfterContextLost=!0,t()},t.prototype._releaseBuffers=function(){this._buffer0&&(this._buffer0.dispose(),this._buffer0=null),this._buffer1&&(this._buffer1.dispose(),this._buffer1=null),this._spriteBuffer&&(this._spriteBuffer.dispose(),this._spriteBuffer=null),this._platform.releaseBuffers()},t.prototype.dispose=function(e){for(var t in void 0===e&&(e=!0),this._drawWrappers)this._drawWrappers[t].dispose();if(this._drawWrappers={},this._scene){var n=this._scene.particleSystems.indexOf(this);n>-1&&this._scene.particleSystems.splice(n,1)}this._releaseBuffers(),this._platform.releaseVertexBuffers();for(var r=0;r0?o.shaderOptions.defines.join("\n"):"";i[0]=a.createEffectForParticles(o.shaderPath.fragmentElement,o.shaderOptions.uniforms,o.shaderOptions.samplers,s,void 0,void 0,void 0,this)}var l=this.serialize(r),c=t.Parse(l,this._scene||this._engine,this._rootUrl);return c.name=e,c.customShader=o,c._customWrappers=i,void 0===n&&(n=this.emitter),this.noiseTexture&&(c.noiseTexture=this.noiseTexture.clone()),c.emitter=n,c},t.prototype.serialize=function(e){void 0===e&&(e=!1);var t={};return gD._Serialize(t,this,e),t.activeParticleCount=this.activeParticleCount,t.randomTextureSize=this._randomTextureSize,t.customShader=this.customShader,t.preventAutoStart=this.preventAutoStart,t.worldOffset=this.worldOffset.asArray(),this.metadata&&(t.metadata=this.metadata),t},t.Parse=function(e,n,r,i,o){void 0===i&&(i=!1);var a,s=e.name;a=n instanceof Ie.$?n:n.getEngine();var l=new t(s,{capacity:o||e.capacity,randomTextureSize:e.randomTextureSize},n,null,e.isAnimationSheetEnabled);if(l._rootUrl=r,e.customShader&&a.createEffectForParticles){var u=e.customShader,h=u.shaderOptions.defines.length>0?u.shaderOptions.defines.join("\n"):"",d=a.createEffectForParticles(u.shaderPath.fragmentElement,u.shaderOptions.uniforms,u.shaderOptions.samplers,h,void 0,void 0,void 0,l);l.setCustomEffect(d,0),l.customShader=u}return e.id&&(l.id=e.id),e.activeParticleCount&&(l.activeParticleCount=e.activeParticleCount),gD._Parse(e,l,n,r),e.worldOffset&&(l.worldOffset=c.Pq.FromArray(e.worldOffset)),e.preventAutoStart&&(l.preventAutoStart=e.preventAutoStart),e.metadata&&(l.metadata=e.metadata),i||l.preventAutoStart||l.start(),l},t}(Kv),uN=function(){function e(){this._emitterNodeIsOwned=!0,this.systems=[]}return Object.defineProperty(e.prototype,"emitterNode",{get:function(){return this._emitterNode},set:function(e){this._emitterNodeIsOwned&&this._emitterNode&&(this._emitterNode.dispose&&this._emitterNode.dispose(),this._emitterNodeIsOwned=!1);for(var t=0,n=this.systems;t0&&n.set(this._uvs32,se.R.UVKind),this._colors32.length>0&&n.set(this._colors32,se.R.ColorKind),n.applyToMesh(this.mesh,this._updatable),this.mesh.isPickable=this._pickable,this._pickable)for(var r=0,i=0;if?f:i,r=Math.round(f/i),o=0):r=r>f?f:r;for(var m=[],_=[],g=[],v=[],y=[],b=c.Pq.Zero(),S=r;pf-(r=S+Math.floor((1+o)*Math.random()))&&(r=f-p),m.length=0,_.length=0,g.length=0,v.length=0,y.length=0;for(var T=0,E=3*p;E<3*(p+r);E++){g.push(T);var x=s[E],P=3*x;if(m.push(a[P],a[P+1],a[P+2]),_.push(h[P],h[P+1],h[P+2]),l){var C=2*x;v.push(l[C],l[C+1])}if(u){var R=4*x;y.push(u[R],u[R+1],u[R+2],u[R+3])}T++}var A=this.nbParticles,I=this._posToShape(m),O=this._uvsToShapeUV(v),M=g.slice(),D=y.slice(),N=_.slice();b.copyFromFloats(0,0,0);var F=void 0;for(F=0;F65535&&(this._needs32Bits=!0)}if(this._depthSort||this._multimaterialEnabled){var V=null!==S.materialIndex?S.materialIndex:0;this.depthSortedParticles.push(new mN(p,t,i.length,V))}return S},e.prototype._posToShape=function(e){for(var t=[],n=0;n=this.nbParticles||!this._updatable)return[];var r=this.particles,i=this.nbParticles;if(t=this.nbParticles?this.nbParticles-1:t,this._computeBoundingBox&&(0!=e||t!=this.nbParticles-1)){var L=this.mesh.getBoundingInfo();L&&(y.copyFrom(L.minimum),b.copyFrom(L.maximum))}var w=(I=this.particles[e]._pos)/3|0;M=4*w,N=2*w;for(var B=e;B<=t;B++){var V=this.particles[B];this.updateParticle(V);var U=V._model._shape,G=V._model._shapeUV,k=V._rotationMatrix,z=V.position,W=V.rotation,H=V.scaling,Y=V._globalPosition;if(f){var X=this.depthSortedParticles[B];X.idx=V.idx,X.ind=V._ind,X.indicesLength=V._model._indicesLength,X.sqDistance=c.Pq.DistanceSquared(V.position,S)}if(V.alive&&(!V._stillInvisible||V.isVisible||this._recomputeInvisibles)){if(V.isVisible){V._stillInvisible=!1;var j=m[12];if(V.pivot.multiplyToRef(H,j),this.billboard&&(W.x=0,W.y=0),(this._computeParticleRotation||this.billboard)&&V.getRotationMatrix(r),null!==V.parentId){var q=this.getParticleById(V.parentId);if(q){var K=q._rotationMatrix,Z=q._globalPosition,Q=z.x*K[1]+z.y*K[4]+z.z*K[7],J=z.x*K[0]+z.y*K[3]+z.z*K[6],$=z.x*K[2]+z.y*K[5]+z.z*K[8];if(Y.x=Z.x+J,Y.y=Z.y+Q,Y.z=Z.z+$,this._computeParticleRotation||this.billboard){var ee=r.m;k[0]=ee[0]*K[0]+ee[1]*K[3]+ee[2]*K[6],k[1]=ee[0]*K[1]+ee[1]*K[4]+ee[2]*K[7],k[2]=ee[0]*K[2]+ee[1]*K[5]+ee[2]*K[8],k[3]=ee[4]*K[0]+ee[5]*K[3]+ee[6]*K[6],k[4]=ee[4]*K[1]+ee[5]*K[4]+ee[6]*K[7],k[5]=ee[4]*K[2]+ee[5]*K[5]+ee[6]*K[8],k[6]=ee[8]*K[0]+ee[9]*K[3]+ee[10]*K[6],k[7]=ee[8]*K[1]+ee[9]*K[4]+ee[10]*K[7],k[8]=ee[8]*K[2]+ee[9]*K[5]+ee[10]*K[8]}}else V.parentId=null}else Y.x=z.x,Y.y=z.y,Y.z=z.z,(this._computeParticleRotation||this.billboard)&&(ee=r.m,k[0]=ee[0],k[1]=ee[1],k[2]=ee[2],k[3]=ee[4],k[4]=ee[5],k[5]=ee[6],k[6]=ee[8],k[7]=ee[9],k[8]=ee[10]);var te=m[11];for(V.translateFromPivot?te.setAll(0):te.copyFrom(j),F=0;F0)for(var t=0;t0&&t.set(this._uvs32,se.R.UVKind),n=0,this._colors32.length>0&&(n=1,t.set(this._colors32,se.R.ColorKind)),r=new qe(this.name,this._scene),t.applyToMesh(r,this._updatable),this.mesh=r,this._positions=null,this._uvs=null,this._colors=null,this._updatable||(this.particles.length=0),(i=e)||((i=new Bo("point cloud material",this._scene)).emissiveColor=new Du.v9(n,n,n),i.disableLighting=!0,i.pointsCloud=!0,i.pointSize=this._size),r.material=i,[2,r]}))}))},e.prototype._addParticle=function(e,t,n,r){var i=new vN(e,t,n,r,this);return this.particles.push(i),i},e.prototype._randomUnitVector=function(e){e.position=new c.Pq(Math.random(),Math.random(),Math.random()),e.color=new Du.ov(1,1,1,1)},e.prototype._getColorIndicesForCoord=function(e,t,n,r){var i=e._groupImageData,o=n*(4*r)+4*t,a=[o,o+1,o+2,o+3],s=a[1],l=a[2],c=a[3],u=i[a[0]],h=i[s],d=i[l],p=i[c];return new Du.ov(u/255,h/255,d/255,p)},e.prototype._setPointsColorOrUV=function(e,t,n,r,i,o,a,s){s=null!=s?s:0,n&&e.updateFacetData();var l=2*e.getBoundingInfo().boundingSphere.radius,u=e.getVerticesData(se.R.PositionKind),h=e.getIndices(),d=e.getVerticesData(se.R.UVKind+(s?s+1:"")),p=e.getVerticesData(se.R.ColorKind),f=c.Pq.Zero();e.computeWorldMatrix();var m=e.getWorldMatrix();if(!m.isIdentity()){u=u.slice(0);for(var _=0;_1&&(Me=1),(De=Ne.b+Ie)<0&&(De=0),De>1&&(De=1),Du.v9.HSVtoRGBToRef(Oe,Me,De,Le),me.set(Le.r,Le.g,Le.b,1)):me=ae.set(Math.random(),Math.random(),Math.random(),1),Be.color=new Du.ov(me.x,me.y,me.z,me.w),this._colors.push(me.x,me.y,me.z,me.w))}},e.prototype._colorFromTexture=function(e,t,n){var r=this;if(null===e.material)return y.V.Warn(e.name+"has no material."),t._groupImageData=null,void this._setPointsColorOrUV(e,t,n,!0,!1);var i=e.material.getActiveTextures();if(0===i.length)return y.V.Warn(e.name+"has no usable texture."),t._groupImageData=null,void this._setPointsColorOrUV(e,t,n,!0,!1);var o=e.clone();o.setEnabled(!1),this._promises.push(new Promise((function(e){z_.t.WhenAllReady(i,(function(){var a=t._textureNb;a<0&&(a=0),a>i.length-1&&(a=i.length-1);var s=function(){t._groupImgWidth=i[a].getSize().width,t._groupImgHeight=i[a].getSize().height,r._setPointsColorOrUV(o,t,n,!0,!0,void 0,void 0,i[a].coordinatesIndex),o.dispose(),e()};t._groupImageData=null;var l=i[a].readPixels();l?l.then((function(e){t._groupImageData=e,s()})):s()}))})))},e.prototype._calculateDensity=function(e,t,n){for(var r,i,o,a,s,l,u,h,d,p,f,m,_=c.Pq.Zero(),g=c.Pq.Zero(),v=c.Pq.Zero(),y=c.Pq.Zero(),b=c.Pq.Zero(),S=c.Pq.Zero(),T=[],E=0,x=n.length/3,P=0;P0;P--){var A=T[P];if(0===A)C[P]=0;else{var I=(A-T[P-1])/A*R,O=Math.floor(I),M=I-O,D=O+Number(Math.random()3)&&(o=0);var a=e.getVerticesData(se.R.PositionKind),s=e.getIndices();this._groups.push(this._groupCounter);var l=new yN(this._groupCounter,null);switch(l._groupDensity=this._calculateDensity(t,a,s),2===o?l._textureNb=r||0:r=r||new Du.ov(1,1,1,1),o){case 2:this._colorFromTexture(e,l,!1);break;case 1:this._setPointsColorOrUV(e,l,!1,!1,!1);break;case 0:this._setPointsColorOrUV(e,l,!1);break;case 3:this._setPointsColorOrUV(e,l,!1,void 0,void 0,r,i)}return this.nbParticles+=t,this._groupCounter++,this._groupCounter-1},e.prototype.addVolumePoints=function(e,t,n,r,i){var o=n||0;(isNaN(o)||o<0||o>3)&&(o=0);var a=e.getVerticesData(se.R.PositionKind),s=e.getIndices();this._groups.push(this._groupCounter);var l=new yN(this._groupCounter,null);switch(l._groupDensity=this._calculateDensity(t,a,s),2===o?l._textureNb=r||0:r=r||new Du.ov(1,1,1,1),o){case 2:this._colorFromTexture(e,l,!0);break;case 1:this._setPointsColorOrUV(e,l,!0,!1,!1);break;case 0:this._setPointsColorOrUV(e,l,!0);break;case 3:this._setPointsColorOrUV(e,l,!0,void 0,void 0,r,i)}return this.nbParticles+=t,this._groupCounter++,this._groupCounter-1},e.prototype.setParticles=function(e,t,n){var r,i;if(void 0===e&&(e=0),void 0===t&&(t=this.nbParticles-1),void 0===n&&(n=!0),!this._updatable||!this._isReady)return this;this.beforeUpdateParticles(e,t,n);var o=c.AA.Matrix[0],a=this.mesh,s=this._colors32,l=this._positions32,u=this._uvs32,h=c.AA.Vector3,d=h[5].copyFromFloats(1,0,0),p=h[6].copyFromFloats(0,1,0),f=h[7].copyFromFloats(0,0,1),m=h[8].setAll(Number.MAX_VALUE),_=h[9].setAll(-Number.MAX_VALUE);c.uq.IdentityToRef(o);var g=0;if((null===(r=this.mesh)||void 0===r?void 0:r.isFacetDataEnabled)&&(this._computeBoundingBox=!0),t=t>=this.nbParticles?this.nbParticles-1:t,this._computeBoundingBox&&(0!=e||t!=this.nbParticles-1)){var v=null===(i=this.mesh)||void 0===i?void 0:i.getBoundingInfo();v&&(m.copyFrom(v.minimum),_.copyFrom(v.maximum))}g=0;for(var y=0,b=0,S=0,T=e;T<=t;T++){var E=this.particles[T];y=3*(g=E.idx),b=4*g,S=2*g,this.updateParticle(E);var x=E._rotationMatrix,P=E.position,C=E._globalPosition;if(this._computeParticleRotation&&E.getRotationMatrix(o),null!==E.parentId){var R=this.particles[E.parentId],A=R._rotationMatrix,I=R._globalPosition,O=P.x*A[1]+P.y*A[4]+P.z*A[7],M=P.x*A[0]+P.y*A[3]+P.z*A[6],D=P.x*A[2]+P.y*A[5]+P.z*A[8];if(C.x=I.x+M,C.y=I.y+O,C.z=I.z+D,this._computeParticleRotation){var N=o.m;x[0]=N[0]*A[0]+N[1]*A[3]+N[2]*A[6],x[1]=N[0]*A[1]+N[1]*A[4]+N[2]*A[7],x[2]=N[0]*A[2]+N[1]*A[5]+N[2]*A[8],x[3]=N[4]*A[0]+N[5]*A[3]+N[6]*A[6],x[4]=N[4]*A[1]+N[5]*A[4]+N[6]*A[7],x[5]=N[4]*A[2]+N[5]*A[5]+N[6]*A[8],x[6]=N[8]*A[0]+N[9]*A[3]+N[10]*A[6],x[7]=N[8]*A[1]+N[9]*A[4]+N[10]*A[7],x[8]=N[8]*A[2]+N[9]*A[5]+N[10]*A[8]}}else C.x=0,C.y=0,C.z=0,this._computeParticleRotation&&(N=o.m,x[0]=N[0],x[1]=N[1],x[2]=N[2],x[3]=N[4],x[4]=N[5],x[5]=N[6],x[6]=N[8],x[7]=N[9],x[8]=N[10]);var F=h[11];E.translateFromPivot?F.setAll(0):F.copyFrom(E.pivot);var L=h[0];L.copyFrom(E.position);var w=L.x-E.pivot.x,B=L.y-E.pivot.y,V=L.z-E.pivot.z,U=w*x[0]+B*x[3]+V*x[6],G=w*x[1]+B*x[4]+V*x[7],k=w*x[2]+B*x[5]+V*x[8];U+=F.x,G+=F.y,k+=F.z;var z=l[y]=C.x+d.x*U+p.x*G+f.x*k,W=l[y+1]=C.y+d.y*U+p.y*G+f.y*k,H=l[y+2]=C.z+d.z*U+p.z*G+f.z*k;if(this._computeBoundingBox&&(m.minimizeInPlaceFromFloats(z,W,H),_.maximizeInPlaceFromFloats(z,W,H)),this._computeParticleColor&&E.color){var Y=E.color,X=this._colors32;X[b]=Y.r,X[b+1]=Y.g,X[b+2]=Y.b,X[b+3]=Y.a}if(this._computeParticleTexture&&E.uv){var j=E.uv,q=this._uvs32;q[S]=j.x,q[S+1]=j.y}}return a&&(n&&(this._computeParticleColor&&a.updateVerticesData(se.R.ColorKind,s,!1,!1),this._computeParticleTexture&&a.updateVerticesData(se.R.UVKind,u,!1,!1),a.updateVerticesData(se.R.PositionKind,l,!1,!1)),this._computeBoundingBox&&(a.hasBoundingInfo?a.getBoundingInfo().reConstruct(m,_,a._worldMatrix):a.buildBoundingInfo(m,_,a._worldMatrix))),this.afterUpdateParticles(e,t,n),this},e.prototype.dispose=function(){var e;null===(e=this.mesh)||void 0===e||e.dispose(),this.vars=null,this._positions=null,this._indices=null,this._normals=null,this._uvs=null,this._colors=null,this._indices32=null,this._positions32=null,this._uvs32=null,this._colors32=null},e.prototype.refreshVisibleSize=function(){var e;return this._isVisibilityBoxLocked||null===(e=this.mesh)||void 0===e||e.refreshBoundingInfo(),this},e.prototype.setVisibilityBox=function(e){if(this.mesh){var t=e/2;this.mesh.buildBoundingInfo(new c.Pq(-t,-t,-t),new c.Pq(t,t,t))}},Object.defineProperty(e.prototype,"isAlwaysVisible",{get:function(){return this._alwaysVisible},set:function(e){this.mesh&&(this._alwaysVisible=e,this.mesh.alwaysSelectAsActiveMesh=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"computeParticleRotation",{set:function(e){this._computeParticleRotation=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"computeParticleColor",{get:function(){return this._computeParticleColor},set:function(e){this._computeParticleColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"computeParticleTexture",{get:function(){return this._computeParticleTexture},set:function(e){this._computeParticleTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"computeBoundingBox",{get:function(){return this._computeBoundingBox},set:function(e){this._computeBoundingBox=e},enumerable:!1,configurable:!0}),e.prototype.initParticles=function(){},e.prototype.recycleParticle=function(e){return e},e.prototype.updateParticle=function(e){return e},e.prototype.beforeUpdateParticles=function(e,t,n){},e.prototype.afterUpdateParticles=function(e,t,n){},e}(),xN=new c.Pq(0,0,0),PN=new c.Pq(0,0,0),CN=new c.Pq(0,0,0),RN=function(){function e(e,t,n){this.width=e,this.height=t,this.data=n}return e.prototype.processFlowable=function(e,t,n){if(void 0===t&&(t=1),n){n instanceof c.uq?c.Pq.TransformCoordinatesToRef(e.position,n,CN):(CN.x=n.x,CN.y=n.y,CN.z=n.z);var r=.5*CN.x+.5,i=1-(.5*CN.y+.5),o=Math.floor(r*this.width),a=Math.floor(i*this.height);if(!(o<0||o>=this.width||a<0||a>=this.height)){var s=4*(a*this.width+o),l=this.data[s]/255*2-1,u=this.data[s+1]/255*2-1,h=this.data[s+2]/255*2-1,d=this.data[s+3]/255;xN.set(l,u,h),xN.scaleToRef(t*d,PN),e.direction.addInPlace(PN)}}},e.prototype._processParticle=function(e,t,n){void 0===t&&(t=1),this.processFlowable(e,t,n)},e.FromUrlAsync=function(t){return(0,f.sH)(this,void 0,void 0,(function(){return(0,f.YH)(this,(function(n){switch(n.label){case 0:return[4,new Promise((function(n,r){var i=document.createElement("canvas"),o=i.getContext("2d"),a=null,s=new Image;s.crossOrigin="anonymous",s.src=t,s.onerror=function(e){r(new Error("Failed to load image: ".concat(t," : ").concat(e)))},s.onload=function(){i.width=s.width,i.height=s.height,o.drawImage(s,0,0),a=o.getImageData(0,0,i.width,i.height),n(new e(i.width,i.height,a.data))}}))];case 1:return[2,n.sent()]}}))}))},e.ExtractFromTextureAsync=function(t){return(0,f.sH)(this,void 0,void 0,(function(){var n,r,i,o;return(0,f.YH)(this,(function(a){switch(a.label){case 0:return[4,Sn.LO.GetTextureDataAsync(t)];case 1:return n=a.sent(),r=t.getSize(),i=r.width,o=r.height,[2,new e(i,o,new Uint8ClampedArray(n))]}}))}))},e}();!function(e){e[e.Int=1]="Int",e[e.Float=2]="Float",e[e.Vector2=4]="Vector2",e[e.Vector3=8]="Vector3",e[e.Matrix=16]="Matrix",e[e.Particle=32]="Particle",e[e.Texture=64]="Texture",e[e.Color4=128]="Color4",e[e.FloatGradient=256]="FloatGradient",e[e.Vector2Gradient=512]="Vector2Gradient",e[e.Vector3Gradient=1024]="Vector3Gradient",e[e.Color4Gradient=2048]="Color4Gradient",e[e.System=4096]="System",e[e.AutoDetect=8192]="AutoDetect",e[e.BasedOnInput=16384]="BasedOnInput",e[e.Undefined=32768]="Undefined",e[e.All=65535]="All"}(bN||(bN={})),function(e){e[e.Compatible=0]="Compatible",e[e.TypeIncompatible=1]="TypeIncompatible",e[e.HierarchyIssue=2]="HierarchyIssue"}(SN||(SN={})),function(e){e[e.Input=0]="Input",e[e.Output=1]="Output"}(TN||(TN={}));var AN,IN,ON=function(){function e(e,t,n){this._connectedPoint=null,this._storedValue=null,this._storedFunction=null,this._acceptedConnectionPointType=null,this._endpoints=new Array,this._type=bN.Particle,this._linkedConnectionSource=null,this._typeConnectionSource=null,this._typeConnectionSourceTranslation=null,this._defaultConnectionPointType=null,this._isMainLinkSource=!1,this.acceptedConnectionPointTypes=[],this.excludedConnectionPointTypes=[],this.onConnectionObservable=new l.cP,this.onDisconnectionObservable=new l.cP,this.isExposedOnFrame=!1,this.exposedPortPosition=-1,this.defaultValue=null,this.value=null,this.valueMin=null,this.valueMax=null,this._ownerBlock=t,this.name=e,this._direction=n}return Object.defineProperty(e.prototype,"direction",{get:function(){return this._direction},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"type",{get:function(){if(this._type===bN.AutoDetect){if(this._ownerBlock.isInput)return this._ownerBlock.type;if(this._connectedPoint)return this._connectedPoint.type;if(this._linkedConnectionSource){if(this._linkedConnectionSource.isConnected)return this._linkedConnectionSource.type;if(this._linkedConnectionSource._defaultConnectionPointType)return this._linkedConnectionSource._defaultConnectionPointType}if(this._defaultConnectionPointType)return this._defaultConnectionPointType}if(this._type===bN.BasedOnInput){if(this._typeConnectionSource)return!this._typeConnectionSource.isConnected&&this._defaultConnectionPointType?this._defaultConnectionPointType:this._typeConnectionSourceTranslation?this._typeConnectionSourceTranslation(this._typeConnectionSource.type):this._typeConnectionSource.type;if(this._defaultConnectionPointType)return this._defaultConnectionPointType}return this._type},set:function(e){this._type=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isConnected",{get:function(){return null!==this.connectedPoint||this.hasEndpoints},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"connectedPoint",{get:function(){return this._connectedPoint},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ownerBlock",{get:function(){return this._ownerBlock},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sourceBlock",{get:function(){return this._connectedPoint?this._connectedPoint.ownerBlock:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"connectedBlocks",{get:function(){return 0===this._endpoints.length?[]:this._endpoints.map((function(e){return e.ownerBlock}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"endpoints",{get:function(){return this._endpoints},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasEndpoints",{get:function(){return this._endpoints&&this._endpoints.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"innerType",{get:function(){return this._linkedConnectionSource&&!this._isMainLinkSource&&this._linkedConnectionSource.isConnected?this.type:this._type},enumerable:!1,configurable:!0}),e.prototype.getClassName=function(){return"NodeParticleConnectionPoint"},e.prototype.getConnectedValue=function(e){var t;return this.isConnected?(null===(t=this._connectedPoint)||void 0===t?void 0:t._storedFunction)?this._connectedPoint._storedFunction(e):this._connectedPoint._storedValue:this.value},e.prototype.canConnectTo=function(e){return 0===this.checkCompatibilityState(e)},e.prototype.checkCompatibilityState=function(e){var t=this._ownerBlock,n=e.ownerBlock;if(this.type!==e.type&&e.innerType!==bN.AutoDetect)return e.acceptedConnectionPointTypes&&-1!==e.acceptedConnectionPointTypes.indexOf(this.type)?0:1;if(e.excludedConnectionPointTypes&&-1!==e.excludedConnectionPointTypes.indexOf(this.type))return 1;var r=n,i=t;return 0===this.direction&&(r=t,i=n),r.isAnAncestorOf(i)?2:0},e.prototype.connectTo=function(e,t){if(void 0===t&&(t=!1),!t&&!this.canConnectTo(e))throw'Cannot connect these two connectors. source: "'.concat(this.ownerBlock.name,'".').concat(this.name,', target: "').concat(e.ownerBlock.name,'".').concat(e.name);return this._endpoints.push(e),e._connectedPoint=this,this.onConnectionObservable.notifyObservers(e),e.onConnectionObservable.notifyObservers(this),this},e.prototype.disconnectFrom=function(e){var t=this._endpoints.indexOf(e);return-1===t||(this._endpoints.splice(t,1),e._connectedPoint=null,this.onDisconnectionObservable.notifyObservers(e),e.onDisconnectionObservable.notifyObservers(this)),this},e.prototype.addExcludedConnectionPointFromAllowedTypes=function(e){for(var t=1;t=0)&&(t.isExposedOnFrame=!0,t.exposedPortPosition=this.exposedPortPosition),t},e.prototype.dispose=function(){this.onConnectionObservable.clear(),this.onDisconnectionObservable.clear()},e}(),MN=function(){function e(e){this._name="",this._isInput=!1,this._isSystem=!1,this._isDebug=!1,this._isTeleportOut=!1,this._isTeleportIn=!1,this._inputs=new Array,this._outputs=new Array,this.onBuildObservable=new l.cP,this.onDisposeObservable=new l.cP,this.onInputChangedObservable=new l.cP,this.visibleOnFrame=!1,this._name=e,this.uniqueId=Np.K.UniqueId}return Object.defineProperty(e.prototype,"isTeleportOut",{get:function(){return this._isTeleportOut},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isTeleportIn",{get:function(){return this._isTeleportIn},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isSystem",{get:function(){return this._isSystem},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isInput",{get:function(){return this._isInput},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isDebug",{get:function(){return this._isDebug},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"name",{get:function(){return this._name},set:function(e){this._name=e},enumerable:!1,configurable:!0}),e.prototype.getClassName=function(){return"NodeParticleBlock"},Object.defineProperty(e.prototype,"inputs",{get:function(){return this._inputs},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"outputs",{get:function(){return this._outputs},enumerable:!1,configurable:!0}),e.prototype._inputRename=function(e){return e},e.prototype._outputRename=function(e){return e},e.prototype.isAnAncestorOf=function(e){for(var t=0,n=this._outputs;t0&&!this._outputs.some((function(e){return e.hasEndpoints}))&&!this.isDebug&&!this.isSystem)return!1;this._buildId=e.buildId;for(var t=0,n=this._inputs;t-1&&this.attachedBlocks.splice(t,1),e.isSystem){var n=this._systemBlocks.indexOf(e);n>-1&&this._systemBlocks.splice(n,1)}},e.prototype.parseSerializedObject=function(e,t){void 0===t&&(t=!1),t||this.clear();for(var n={},r=0,i=e.blocks;re||t._extend()}))},t.prototype.getClassName=function(){return"ParticleGradientBlock"},Object.defineProperty(t.prototype,"gradient",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype._build=function(){for(var e,t=this,n=[],r=1;r=0;o--){var a=n[o];if(a.reference<=r){var s=a.value.getConnectedValue(e);if(i){var l=i.value.getConnectedValue(e),h=i.reference,d=a.reference,p=Math.max(0,Math.min(1,(r-d)/(h-d)));switch(t.output.type){case bN.Float:return(0,lr.Lerp)(s,l,p);case bN.Vector2:return c.I9.Lerp(s,l,p);case bN.Vector3:return c.Pq.Lerp(s,l,p);case bN.Color4:return u.ov.Lerp(s,l,p)}}return s}i=a}return 0}},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t._entryCount=this._entryCount,t},t.prototype._deserialize=function(t){if(e.prototype._deserialize.call(this,t),t._entryCount&&t._entryCount>1)for(var n=1;n=0?e-Math.floor(e):e-Math.ceil(e)}}if(!r)return this.output._storedFunction=null,void(this.output._storedValue=null);switch(this.input.type){case bN.Int:case bN.Float:this.output._storedFunction=function(e){var t=n.input.getConnectedValue(e);return r(t)};break;case bN.Vector2:this.output._storedFunction=function(e){var t=n.input.getConnectedValue(e);return new c.I9(r(t.x),r(t.y))};break;case bN.Vector3:this.output._storedFunction=function(e){var t=n.input.getConnectedValue(e);return new c.Pq(r(t.x),r(t.y),r(t.z))};break;case bN.Color4:this.output._storedFunction=function(e){var t=n.input.getConnectedValue(e);return new u.ov(r(t.r),r(t.g),r(t.b),r(t.a))}}return this},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.operation=this.operation,t},t.prototype._deserialize=function(t){e.prototype._deserialize.call(this,t),this.operation=t.operation},(0,f.Cg)([Jp("Operation",5,"ADVANCED",{embedded:!0,notifiers:{rebuild:!0},options:[{label:"Cos",value:yF.Cos},{label:"Sin",value:yF.Sin},{label:"Abs",value:yF.Abs},{label:"Exp",value:yF.Exp},{label:"Exp2",value:yF.Exp2},{label:"Round",value:yF.Round},{label:"Floor",value:yF.Floor},{label:"Ceiling",value:yF.Ceiling},{label:"Sqrt",value:yF.Sqrt},{label:"Log",value:yF.Log},{label:"Tan",value:yF.Tan},{label:"ArcTan",value:yF.ArcTan},{label:"ArcCos",value:yF.ArcCos},{label:"ArcSin",value:yF.ArcSin},{label:"Sign",value:yF.Sign},{label:"Negate",value:yF.Negate},{label:"OneMinus",value:yF.OneMinus},{label:"Reciprocal",value:yF.Reciprocal},{label:"ToDegrees",value:yF.ToDegrees},{label:"ToRadians",value:yF.ToRadians},{label:"Fract",value:yF.Fract}]})],t.prototype,"operation",void 0),t}(MN);(0,h.Y5)("BABYLON.ParticleTrigonometryBlock",SF);var TF=function(e){function t(t){var n=e.call(this,t)||this;return n.log=[],n.stackSize=10,n.onDataCollectedObservable=new l.cP(void 0,!0),n._isDebug=!0,n.registerInput("input",bN.AutoDetect),n.registerOutput("output",bN.BasedOnInput),n._outputs[0]._typeConnectionSource=n._inputs[0],n._inputs[0].excludedConnectionPointTypes.push(bN.FloatGradient),n._inputs[0].excludedConnectionPointTypes.push(bN.Vector2Gradient),n._inputs[0].excludedConnectionPointTypes.push(bN.Vector3Gradient),n._inputs[0].excludedConnectionPointTypes.push(bN.Color4Gradient),n._inputs[0].excludedConnectionPointTypes.push(bN.System),n._inputs[0].excludedConnectionPointTypes.push(bN.Particle),n._inputs[0].excludedConnectionPointTypes.push(bN.Texture),n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"ParticleDebugBlock"},Object.defineProperty(t.prototype,"input",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype._build=function(e){var t=this;if(!this.input.isConnected)return this.output._storedFunction=null,void(this.output._storedValue=null);this.log=[];var n=function(e){var n=t.input.getConnectedValue(e);if(t.log.length>=t.stackSize)return n;if(null==n)return t.log.push(["null",""]),n;switch(t.input.type){case bN.Vector2:t.log.push([(0,lC.Ve)(n,4),n.toString()]);break;case bN.Vector3:t.log.push([(0,lC.kf)(n,4),n.toString()]);break;case bN.Color4:t.log.push(["{R: ".concat(n.r.toFixed(4)," G: ").concat(n.g.toFixed(4)," B: ").concat(n.b.toFixed(4)," A: ").concat(n.a.toFixed(4),"}"),n.toString()]);break;default:t.log.push([n.toString(),n.toString()])}return t.onDataCollectedObservable.notifyObservers(t),n};this.output.isConnected?this.output._storedFunction=n:this.output._storedValue=n(e)},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.stackSize=this.stackSize,t},t.prototype._deserialize=function(t){e.prototype._deserialize.call(this,t),this.stackSize=t.stackSize},t.prototype.dispose=function(){this.onDataCollectedObservable.clear(),e.prototype.dispose.call(this)},(0,f.Cg)([Jp("Reference",2,"ADVANCED",{embedded:!1,notifiers:{rebuild:!0},min:1,max:100})],t.prototype,"stackSize",void 0),t}(MN);(0,h.Y5)("BABYLON.ParticleDebugBlock",TF);var EF=function(e){function t(t){var n=e.call(this,t)||this;return n.registerInput("input",bN.AutoDetect),n.registerOutput("output",bN.BasedOnInput),n._outputs[0]._typeConnectionSource=n._inputs[0],n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"ParticleElbowBlock"},Object.defineProperty(t.prototype,"input",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype._build=function(t){e.prototype._build.call(this,t);var n=this._outputs[0],r=this._inputs[0];n._storedFunction=function(e){return r.getConnectedValue(e)}},t}(MN);(0,h.Y5)("BABYLON.ParticleElbowBlock",EF);var xF=function(e){function t(t){var n=e.call(this,t)||this;return n._endpoints=[],n._isTeleportIn=!0,n.registerInput("input",bN.AutoDetect),n}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"endpoints",{get:function(){return this._endpoints},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"ParticleTeleportInBlock"},Object.defineProperty(t.prototype,"input",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),t.prototype.isAnAncestorOfType=function(e){if(this.getClassName()===e)return!0;for(var t=0,n=this.endpoints;t "+this.name},t.prototype.detachFromEndpoint=function(e){var t=this._endpoints.indexOf(e);-1!==t&&(this._endpoints.splice(t,1),e._outputs[0]._typeConnectionSource=null,e._entryPoint=null)},t.prototype._build=function(){for(var e=this,t=0,n=this._endpoints;tr-e.epsilon;break;case PF.LessOrEqual:i=n<=r+e.epsilon;break;case PF.GreaterOrEqual:i=n>=r-e.epsilon;break;case PF.Xor:i=!!n&&!r||!n&&!!r;break;case PF.Or:i=!!n||!!r;break;case PF.And:i=!!n&&!!r}return i}(t)?e.ifTrue.getConnectedValue(t):e.ifFalse.getConnectedValue(t)}},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.test=this.test,t.epsilon=this.epsilon,t},t.prototype._deserialize=function(t){e.prototype._deserialize.call(this,t),this.test=t.test,void 0!==t.epsilon&&(this.epsilon=t.epsilon)},(0,f.Cg)([Jp("Test",5,"ADVANCED",{notifiers:{rebuild:!0},embedded:!0,options:[{label:"Equal",value:PF.Equal},{label:"NotEqual",value:PF.NotEqual},{label:"LessThan",value:PF.LessThan},{label:"GreaterThan",value:PF.GreaterThan},{label:"LessOrEqual",value:PF.LessOrEqual},{label:"GreaterOrEqual",value:PF.GreaterOrEqual},{label:"Xor",value:PF.Xor},{label:"Or",value:PF.Or},{label:"And",value:PF.And}]})],t.prototype,"test",void 0),(0,f.Cg)([Jp("Epsilon",1,"ADVANCED",{embedded:!0,notifiers:{rebuild:!0}})],t.prototype,"epsilon",void 0),t}(MN);(0,h.Y5)("BABYLON.ParticleConditionBlock",RF);var AF,IF=function(e){function t(t){var n=e.call(this,t)||this;return n._triggerCount=0,n.limit=5,n.delay=250,n._previousOne=null,n.registerInput("input",bN.Particle),n.registerInput("condition",bN.Float,!0,0),n.registerInput("system",bN.System),n.registerOutput("output",bN.Particle),n}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"ParticleTriggerBlock"},Object.defineProperty(t.prototype,"input",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"condition",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"system",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype._build=function(e){var t=this;this._triggerCount=0;var n=this.input.getConnectedValue(e),r={process:function(r){if(e.particleContext=r,e.systemContext=n,0!==t.condition.getConnectedValue(e)&&(0===t.limit||t._triggerCount.1?e=.1:e<=0&&(e=1/60),this._physicsPlugin.executeStep(e,this._physicsBodies)},e.prototype.addBody=function(e){this._physicsBodies.push(e)},e.prototype.removeBody=function(e){var t=this._physicsBodies.indexOf(e);t>-1&&this._physicsBodies.splice(t,1)},e.prototype.getBodies=function(){return this._physicsBodies},e.prototype.getPhysicsPlugin=function(){return this._physicsPlugin},e.prototype.raycastToRef=function(e,t,n,r){this._physicsPlugin.raycast(e,t,n,r)},e.prototype.raycast=function(e,t,n){var r=new Db;return this._physicsPlugin.raycast(e,t,r,n),r},e}();!function(e){e[e.FREE=0]="FREE",e[e.LIMITED=1]="LIMITED",e[e.LOCKED=2]="LOCKED"}(BF||(BF={})),function(e){e[e.LINEAR_X=0]="LINEAR_X",e[e.LINEAR_Y=1]="LINEAR_Y",e[e.LINEAR_Z=2]="LINEAR_Z",e[e.ANGULAR_X=3]="ANGULAR_X",e[e.ANGULAR_Y=4]="ANGULAR_Y",e[e.ANGULAR_Z=5]="ANGULAR_Z",e[e.LINEAR_DISTANCE=6]="LINEAR_DISTANCE"}(VF||(VF={})),function(e){e[e.BALL_AND_SOCKET=1]="BALL_AND_SOCKET",e[e.DISTANCE=2]="DISTANCE",e[e.HINGE=3]="HINGE",e[e.SLIDER=4]="SLIDER",e[e.LOCK=5]="LOCK",e[e.PRISMATIC=6]="PRISMATIC",e[e.SIX_DOF=7]="SIX_DOF"}(UF||(UF={})),function(e){e[e.SPHERE=0]="SPHERE",e[e.CAPSULE=1]="CAPSULE",e[e.CYLINDER=2]="CYLINDER",e[e.BOX=3]="BOX",e[e.CONVEX_HULL=4]="CONVEX_HULL",e[e.CONTAINER=5]="CONTAINER",e[e.MESH=6]="MESH",e[e.HEIGHTFIELD=7]="HEIGHTFIELD"}(GF||(GF={})),function(e){e[e.NONE=0]="NONE",e[e.VELOCITY=1]="VELOCITY",e[e.POSITION=2]="POSITION"}(kF||(kF={})),function(e){e.COLLISION_STARTED="COLLISION_STARTED",e.COLLISION_CONTINUED="COLLISION_CONTINUED",e.COLLISION_FINISHED="COLLISION_FINISHED",e.TRIGGER_ENTERED="TRIGGER_ENTERED",e.TRIGGER_EXITED="TRIGGER_EXITED"}(zF||(zF={})),function(e){e[e.STATIC=0]="STATIC",e[e.ANIMATED=1]="ANIMATED",e[e.DYNAMIC=2]="DYNAMIC"}(WF||(WF={})),function(e){e[e.DISABLED=0]="DISABLED",e[e.TELEPORT=1]="TELEPORT",e[e.ACTION=2]="ACTION"}(HF||(HF={})),function(e){e[e.SIMULATION_CONTROLLED=0]="SIMULATION_CONTROLLED",e[e.ALWAYS_ACTIVE=1]="ALWAYS_ACTIVE",e[e.ALWAYS_INACTIVE=2]="ALWAYS_INACTIVE"}(YF||(YF={}));var jF,qF=function(){function e(e,t,n,r){var i=this;if(this._pluginData=void 0,this._pluginDataInstances=[],this._collisionCBEnabled=!1,this._collisionEndedCBEnabled=!1,this.disableSync=!1,this._isDisposed=!1,this._shape=null,this._prestepType=HF.DISABLED,r){var o=r.getPhysicsEngine();if(!o)throw new Error("No Physics Engine available.");if(this._physicsEngine=o,2!=o.getPluginVersion())throw new Error("Plugin version is incorrect. Expected version 2.");var a=o.getPhysicsPlugin();if(!a)throw new Error("No Physics Plugin available.");this._physicsPlugin=a,e.rotationQuaternion||(e.rotationQuaternion=c.PT.FromEulerAngles(e.rotation.x,e.rotation.y,e.rotation.z)),this.startAsleep=n,this.disableSync=0==t;var s=e;s.hasThinInstances?this._physicsPlugin.initBodyInstances(this,t,s):(e.parent&&e.computeWorldMatrix(!0),this._physicsPlugin.initBody(this,t,e.absolutePosition,e.absoluteRotationQuaternion)),this.transformNode=e,e.physicsBody=this,o.addBody(this),this._nodeDisposeObserver=e.onDisposeObservable.add((function(){i.dispose()}))}}return Object.defineProperty(e.prototype,"disablePreStep",{get:function(){return this._prestepType==HF.DISABLED},set:function(e){this._prestepType=e?HF.DISABLED:HF.TELEPORT},enumerable:!1,configurable:!0}),e.prototype.getClassName=function(){return"PhysicsBody"},e.prototype.clone=function(t){var n=new e(t,this.getMotionType(),this.startAsleep,this.transformNode.getScene());return n.shape=this.shape,n.setMassProperties(this.getMassProperties()),n.setLinearDamping(this.getLinearDamping()),n.setAngularDamping(this.getAngularDamping()),n},e.prototype.updateBodyInstances=function(){var e=this.transformNode;e.hasThinInstances&&this._physicsPlugin.updateBodyInstances(this,e)},Object.defineProperty(e.prototype,"numInstances",{get:function(){return this._pluginDataInstances.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"motionType",{get:function(){return this._physicsPlugin.getMotionType(this)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shape",{get:function(){return this._shape},set:function(e){this._shape=e,e&&this._physicsPlugin.setShape(this,e)},enumerable:!1,configurable:!0}),e.prototype.getBoundingBox=function(){return this._physicsPlugin.getBodyBoundingBox(this)},e.prototype.setEventMask=function(e,t){this._physicsPlugin.setEventMask(this,e,t)},e.prototype.getEventMask=function(e){return this._physicsPlugin.getEventMask(this,e)},e.prototype.setMotionType=function(e,t){this.disableSync=void 0===t&&0==e,this._physicsPlugin.setMotionType(this,e,t)},e.prototype.getMotionType=function(e){return this._physicsPlugin.getMotionType(this,e)},e.prototype.setPrestepType=function(e){this._prestepType=e},e.prototype.getPrestepType=function(){return this._prestepType},e.prototype.computeMassProperties=function(e){return this._physicsPlugin.computeMassProperties(this,e)},e.prototype.setMassProperties=function(e,t){this._physicsPlugin.setMassProperties(this,e,t)},e.prototype.getMassProperties=function(e){return this._physicsPlugin.getMassProperties(this,e)},e.prototype.setLinearDamping=function(e,t){this._physicsPlugin.setLinearDamping(this,e,t)},e.prototype.getLinearDamping=function(e){return this._physicsPlugin.getLinearDamping(this,e)},e.prototype.setAngularDamping=function(e,t){this._physicsPlugin.setAngularDamping(this,e,t)},e.prototype.getAngularDamping=function(e){return this._physicsPlugin.getAngularDamping(this,e)},e.prototype.setLinearVelocity=function(e,t){this._physicsPlugin.setLinearVelocity(this,e,t)},e.prototype.getLinearVelocityToRef=function(e,t){this._physicsPlugin.getLinearVelocityToRef(this,e,t)},e.prototype.getLinearVelocity=function(e){var t=new c.Pq;return this.getLinearVelocityToRef(t,e),t},e.prototype.setAngularVelocity=function(e,t){this._physicsPlugin.setAngularVelocity(this,e,t)},e.prototype.getAngularVelocityToRef=function(e,t){this._physicsPlugin.getAngularVelocityToRef(this,e,t)},e.prototype.getAngularVelocity=function(e){var t=new c.Pq;return this.getAngularVelocityToRef(t,e),t},e.prototype.applyImpulse=function(e,t,n){this._physicsPlugin.applyImpulse(this,e,t,n)},e.prototype.applyAngularImpulse=function(e,t){this._physicsPlugin.applyAngularImpulse(this,e,t)},e.prototype.applyForce=function(e,t,n){this._physicsPlugin.applyForce(this,e,t,n)},e.prototype.getGeometry=function(){return this._physicsPlugin.getBodyGeometry(this)},e.prototype.getCollisionObservable=function(){return this._physicsPlugin.getCollisionObservable(this)},e.prototype.getCollisionEndedObservable=function(){return this._physicsPlugin.getCollisionEndedObservable(this)},e.prototype.setCollisionCallbackEnabled=function(e){this._collisionCBEnabled=e,this._physicsPlugin.setCollisionCallbackEnabled(this,e)},e.prototype.setCollisionEndedCallbackEnabled=function(e){this._collisionEndedCBEnabled=e,this._physicsPlugin.setCollisionEndedCallbackEnabled(this,e)},e.prototype.getObjectCenterWorld=function(e){var t=new c.Pq;return this.getObjectCenterWorldToRef(t,e)},e.prototype.getObjectCenterWorldToRef=function(e,t){var n;if((null===(n=this._pluginDataInstances)||void 0===n?void 0:n.length)>0){var r=t||0,i=this.transformNode._thinInstanceDataStorage.matrixData;i&&e.set(i[16*r+12],i[16*r+13],i[16*r+14])}else e.copyFrom(this.transformNode.position);return e},e.prototype.addConstraint=function(e,t,n,r){this._physicsPlugin.addConstraint(this,e,t,n,r)},e.prototype.syncWithBone=function(e,t,n,r,i,o){var a=this.transformNode;if(a.rotationQuaternion)if(i){var s=c.AA.Quaternion[0];e.getRotationQuaternionToRef(1,t,s),s.multiplyToRef(i,a.rotationQuaternion)}else e.getRotationQuaternionToRef(1,t,a.rotationQuaternion);var l=c.AA.Vector3[0],u=c.AA.Vector3[1];o||((o=c.AA.Vector3[2]).x=0,o.y=1,o.z=0),e.getDirectionToRef(o,t,u),e.getAbsolutePositionToRef(t,l),null==r&&n&&(r=n.length()),null!=r&&(l.x+=u.x*r,l.y+=u.y*r,l.z+=u.z*r),a.setAbsolutePosition(l)},e.prototype.iterateOverAllInstances=function(e){var t;if((null===(t=this._pluginDataInstances)||void 0===t?void 0:t.length)>0)for(var n=0;n0},e.prototype._addSizeOptions=function(){var e,t,n,r,i,o,a,s;this.transformNode.computeWorldMatrix(!0);var l=this._getObjectBoundingBox(),u=c.AA.Vector3[0];u.copyFrom(l.extendSize),u.scaleInPlace(2),u.multiplyInPlace(this.transformNode.absoluteScaling),u.x=Math.abs(u.x),u.y=Math.abs(u.y),u.z=Math.abs(u.z);var h=c.AA.Vector3[1];if(h.copyFrom(l.minimum),h.multiplyInPlace(this.transformNode.absoluteScaling),!this._options.center){var d=new c.Pq;d.copyFrom(l.center),d.multiplyInPlace(this.transformNode.absoluteScaling),this._options.center=d}switch(this.type){case 0:!this._options.radius&&(0,lr.WithinEpsilon)(u.x,u.y,1e-4)&&(0,lr.WithinEpsilon)(u.x,u.z,1e-4)?this._options.radius=u.x/2:this._options.radius||(y.V.Warn("Non uniform scaling is unsupported for sphere shapes. Setting the radius to the biggest bounding box extent."),this._options.radius=Math.max(u.x,u.y,u.z)/2);break;case 1:var p=u.x/2;this._options.radius=null!==(e=this._options.radius)&&void 0!==e?e:p,this._options.pointA=null!==(t=this._options.pointA)&&void 0!==t?t:new c.Pq(0,h.y+p,0),this._options.pointB=null!==(n=this._options.pointB)&&void 0!==n?n:new c.Pq(0,h.y+u.y-p,0);break;case 2:p=u.x/2,this._options.radius=null!==(r=this._options.radius)&&void 0!==r?r:p,this._options.pointA=null!==(i=this._options.pointA)&&void 0!==i?i:new c.Pq(0,h.y,0),this._options.pointB=null!==(o=this._options.pointB)&&void 0!==o?o:new c.Pq(0,h.y+u.y,0);break;case 6:case 4:case 7:if(!this._options.mesh&&this._hasVertices(this.transformNode))this._options.mesh=this.transformNode;else if(!this._options.mesh||!this._hasVertices(this._options.mesh))throw new Error("No valid mesh was provided for mesh or convex hull shape parameter. Please provide a mesh with valid geometry (number of vertices greater than 0).");break;case 3:this._options.extents=null!==(a=this._options.extents)&&void 0!==a?a:new c.Pq(u.x,u.y,u.z),this._options.rotation=null!==(s=this._options.rotation)&&void 0!==s?s:c.PT.Identity()}},e.prototype.dispose=function(){this._nodeDisposeObserver&&(this.body.transformNode.onDisposeObservable.remove(this._nodeDisposeObserver),this._nodeDisposeObserver=null),this.body.dispose(),this._disposeShapeWhenDisposed&&this.shape.dispose()},e}(),vL=function(){},yL=function(){function e(e,t,n){this._boxConfigs=new Array,this._constraints=new Array,this._bones=new Array,this._initialRotation=new Array,this._initialRotation2=new Array,this._boneNames=[],this._transforms=new Array,this._aggregates=new Array,this._ragdollMode=!1,this._rootBoneName="",this._rootBoneIndex=-1,this._mass=10,this._restitution=0,this._beforeRenderObserver=null,this.pauseSync=!1,this._defaultJoint=3,this._defaultJointMin=-90,this._defaultJointMax=90,this._skeleton=e,this._scene=e.getScene(),this._rootTransformNode=t,this._config=n,this._boxConfigs=[],this._putBoxesInBoneCenter=!1,this._defaultJoint=3,this._init()}return e.prototype.getConstraints=function(){return this._constraints},e.prototype.getAggregate=function(e){return e<0||e>=this._aggregates.length?this._aggregates[this._rootBoneIndex]:this._aggregates[e]},e.prototype._createColliders=function(){var e,t,n;this._rootTransformNode.computeWorldMatrix(),this._skeleton.computeAbsoluteMatrices(!0),this._skeleton.prepare(!0);for(var r=this._config,i=0;i0){for(var a=[],s=1e38,l=r._bodies,u=0;u=0;u--){var f=this._manifold[u];if((E=this._findContact(f,a,1.1))>=0){var m=Math.min(Math.max(this.keepDistance-a[E].distance,0),f.allowedPenetration);this._manifold[u]=a[E],this._manifold[u].allowedPenetration=m,a.splice(E,1)}else this._manifold.splice(u,1)}var _=a.findIndex((function(e){return e.distance==s}));_>=0&&((E=this._findContact(a[_],this._manifold,.1))>=0?(m=Math.min(Math.max(this.keepDistance-a[_].distance,0),this._manifold[E].allowedPenetration),this._manifold[E]=a[_],this._manifold[E].allowedPenetration=m):this._manifold.push(a[_]))}else this._manifold.length=0;var g=0,v=i.HP_QueryCollector_GetNumHits(t)[1];if(v>0){var y=null;for(u=0;u=0;P--){for(var C=P-1;C>=0&&!(this._compareContacts(this._manifold[P],this._manifold[C])<.1);C--);C>=0&&this._manifold.slice(P,1)}return g},e.prototype._createSurfaceConstraint=function(e,t){var n={planeNormal:e.normal.clone(),planeDistance:e.distance,staticFriction:this.staticFriction,dynamicFriction:this.dynamicFriction,extraUpStaticFriction:0,extraDownStaticFriction:0,velocity:c.Pq.Zero(),angularVelocity:c.Pq.Zero(),priority:0},r=Math.max(this.maxSlopeCosine,.1),i=e.normal.dot(this.up),o=e.position.clone();if(i>r){var a=this.getPosition(),s=this._tmpVecs[20];e.position.subtractToRef(a,s);var l=e.normal.dot(s);o.x=a.x+this.up.x*l,o.y=a.y+this.up.y*l,o.z=a.z+this.up.z*l}var u=e.bodyB.body.getMotionType(e.bodyB.index),h=n.velocity.dot(n.planeNormal)*t;return n.planeDistance-=h,0==u?n.priority=2:1==u&&(n.priority=1),n},e.prototype._addMaxSlopePlane=function(e,t,n,r,i){var o=r[n].planeNormal.dot(t);if(o>.01&&o=0)a.planeDistance=s*a.planeNormal.dot(r[n].planeNormal);else{var l=Math.min(0,s+i);a.planeDistance=l/a.planeNormal.dot(r[n].planeNormal),r[n].planeDistance=0,this._resolveConstraintPenetration(a,this.penetrationRecoverySpeed)}return r.push(a),!0}return!1},e.prototype._resolveConstraintPenetration=function(e,t){e.planeDistance<-1e-6&&(e.planeNormal.scaleToRef(e.planeDistance*t,this._tmpVecs[6]),e.velocity.subtractInPlace(this._tmpVecs[6]))},e.prototype._createConstraintsFromManifold=function(e,t){for(var n=[],r=0;r0?t.extraUpStaticFriction:t.extraDownStaticFriction;if(u>0){var h=this.up.cross(t.planeNormal),d=h.lengthSquared(),p=0;if(d>i){h.scaleInPlace(1/Math.sqrt(d));var f=(p=a.dot(h))*p;c*(t.staticFriction*t.staticFriction)>=f&&(a.subtractInPlace(h.scale(p)),p=0)}var m=l-p*p-c;if(c*((t.staticFriction+u)*(t.staticFriction+u))>=m&&0==p)return void r.copyFrom(o)}else if(c*(1+t.staticFriction*t.staticFriction)>=l)return void r.copyFrom(o);if(t.dynamicFriction<1){var _=a.lengthSquared();if(_>=i&&_>1e-4*l){var g=Math.sqrt(l/_);g=t.dynamicFriction+(1-t.dynamicFriction)*g,a.scaleInPlace(g);var v=t.planeNormal.dot(a);a.subtractInPlace(t.planeNormal.scale(v))}}r.copyFrom(a),r.addInPlace(o)},e.prototype._simplexSolverSolveTest1d=function(e,t){var n=this._tmpVecs[23];return t.subtractToRef(e.velocity,n),n.dot(e.planeNormal)<-.001},e.prototype._simplexSolverSolve2d=function(e,t,n,r,i,o){for(var a=n.planeNormal.cross(r.planeNormal),s=a.lengthSquared(),l=!1,u=null;;){if(s<=1e-5||l)return e.getOutput(n).status=2,e.getOutput(r).status=2,void(n.priority>r.priority?(this._simplexSolverSolve1d(e,r,i,o),this._simplexSolverSolve1d(e,n,i,o)):(this._simplexSolverSolve1d(e,n,i,o),this._simplexSolverSolve1d(e,r,i,o)));var h=1/Math.sqrt(s);a.scaleInPlace(h);var d=n.planeNormal.cross(r.planeNormal),p=r.planeNormal.cross(a),f=a.cross(n.planeNormal),m=n.velocity.add(r.velocity),_=this._tmpVecs[2];_.set(.5*a.dot(m),n.planeNormal.dot(n.velocity),r.planeNormal.dot(r.velocity));var g=c.uq.FromValues(d.x,p.x,f.x,0,d.y,p.y,f.y,0,d.z,p.z,f.z,0,0,0,0,1);if((u=c.Pq.TransformNormal(_,g)).scaleInPlace(h),!(Math.abs(u.x)>t.x||Math.abs(u.y)>t.y||Math.abs(u.z)>t.z))break;l=!0}var v=u,y=this._tmpVecs[24];i.subtractToRef(v,y);var b=y.lengthSquared(),S=this.up.dot(a),T=y.dot(a),E=n.staticFriction+r.staticFriction;E+=S*T>0?(n.extraUpStaticFriction+r.extraUpStaticFriction)*S:(n.extraDownStaticFriction+r.extraDownStaticFriction)*S,E*=.5;var x=.5*(n.dynamicFriction+r.dynamicFriction),P=T*T;if(E*E*(b-P)>=P)o.copyFrom(v);else{if(x<1&&T*T>1e-4*b){var C=1/T;T*=Math.abs(C)*Math.sqrt(b)*(1-x)+x}o.copyFrom(v),o.addInPlace(a.scale(T))}},e.prototype._simplexSolverSolve3d=function(e,t,n,r,i,o,a,s){for(var l=null,u=r.planeNormal.cross(i.planeNormal),h=i.planeNormal.cross(n.planeNormal),d=n.planeNormal.cross(r.planeNormal),p=u.dot(n.planeNormal),f=!1;;){if(Math.abs(p)<1e-5||f){o&&(this._simplexSolverSortInfo(e),n=e.supportPlanes[0].constraint,r=e.supportPlanes[1].constraint,i=e.supportPlanes[2].constraint),e.getOutput(n).status=1,e.getOutput(r).status=1,e.getOutput(i).status=1;var m=e.numSupportPlanes;return this._simplexSolverSolve2d(e,t,n,r,a,s),m==e.numSupportPlanes&&this._simplexSolverSolve2d(e,t,n,i,a,s),void(m==e.numSupportPlanes&&this._simplexSolverSolve2d(e,t,r,i,a,s))}var _=this._tmpVecs[2];_.set(n.planeNormal.dot(n.velocity),r.planeNormal.dot(r.velocity),i.planeNormal.dot(i.velocity));var g=c.uq.FromValues(u.x,u.y,u.z,0,h.x,h.y,h.z,0,d.x,d.y,d.z,0,0,0,0,1);if((l=c.Pq.TransformNormal(_,g)).scaleInPlace(1/p),!(Math.abs(l.x)>t.x||Math.abs(l.y)>t.y||Math.abs(l.z)>t.z))break;f=!0}s.copyFrom(l)},e.prototype._simplexSolverExamineActivePlanes=function(e,t,n,r){for(;;)switch(e.numSupportPlanes){case 1:var i=e.supportPlanes[0].constraint;return void this._simplexSolverSolve1d(e,i,n,r);case 2:var o=c.Pq.Zero();return this._simplexSolverSolve1d(e,e.supportPlanes[1].constraint,n,o),void(this._simplexSolverSolveTest1d(e.supportPlanes[0].constraint,o)?this._simplexSolverSolve2d(e,t,e.supportPlanes[0].constraint,e.supportPlanes[1].constraint,n,r):(e.supportPlanes[0].copyFrom(e.supportPlanes[1]),e.numSupportPlanes=1,r.copyFrom(o)));case 3:if(o=c.Pq.Zero(),!(this._simplexSolverSolve1d(e,e.supportPlanes[2].constraint,n,r),this._simplexSolverSolveTest1d(e.supportPlanes[0].constraint,o)||this._simplexSolverSolveTest1d(e.supportPlanes[1].constraint,o))){r.copyFrom(o),e.supportPlanes[0].copyFrom(e.supportPlanes[2]),e.numSupportPlanes=1;continue}for(var a=!1,s=0;s<2;s++)if(o=c.Pq.Zero(),this._simplexSolverSolve2d(e,t,e.supportPlanes[s].constraint,e.supportPlanes[2].constraint,n,r),!this._simplexSolverSolveTest1d(e.supportPlanes[1-s].constraint,o)){e.supportPlanes[0].copyFrom(e.supportPlanes[s]),e.supportPlanes[1].copyFrom(e.supportPlanes[2]),e.numSupportPlanes--,a=!0;break}if(a)continue;return void this._simplexSolverSolve3d(e,t,e.supportPlanes[0].constraint,e.supportPlanes[1].constraint,e.supportPlanes[2].constraint,!0,n,r);case 4:this._simplexSolverSortInfo(e),a=!1;for(var l=0;l<3;l++)if(o=c.Pq.Zero(),this._simplexSolverSolve3d(e,t,e.supportPlanes[(l+1)%3].constraint,e.supportPlanes[(l+2)%3].constraint,e.supportPlanes[3].constraint,!1,n,o),!this._simplexSolverSolveTest1d(e.supportPlanes[l].constraint,o)){e.supportPlanes[l].copyFrom(e.supportPlanes[2]),e.supportPlanes[2].copyFrom(e.supportPlanes[3]),e.numSupportPlanes=3,a=!0;break}if(a)continue;o=n.clone();var u=e.supportPlanes[0].constraint,h=e.supportPlanes[1].constraint,d=e.supportPlanes[2].constraint,p=e.supportPlanes[3].constraint,f=e.numSupportPlanes;f==e.numSupportPlanes?this._simplexSolverSolve3d(e,t,u,h,d,!1,o,o):f==e.numSupportPlanes?this._simplexSolverSolve3d(e,t,u,h,p,!1,o,o):f==e.numSupportPlanes?this._simplexSolverSolve3d(e,t,u,d,p,!1,o,o):f==e.numSupportPlanes&&this._simplexSolverSolve3d(e,t,h,d,p,!1,o,o),r.copyFrom(o);for(var m=0,_=0;_<4;_++)m=Math.max(m,e.supportPlanes[_].interaction.status);for(l=0;l<4;l++){if(m==e.supportPlanes[l].interaction.status){e.supportPlanes[l].copyFrom(e.supportPlanes[3]);break}e.numSupportPlanes--}for(l=0;l<3;l++)e.supportPlanes[l].interaction.status=0;continue}},e.prototype._simplexSolverSolve=function(e,t,n,r,i,o){var a=1e-6,s=new bL;s.position=c.Pq.Zero(),s.velocity=t.clone(),s.planeInteractions=[];for(var l=n,u=0;u0;){var d=-1,p=l;for(u=0;u=1&&h.supportPlanes[0].index==u||h.numSupportPlanes>=2&&h.supportPlanes[1].index==u||h.numSupportPlanes>=3&&h.supportPlanes[2].index==u||0!=s.planeInteractions[u].status)){var f=e[u],m=this._tmpVecs[25];s.velocity.subtractToRef(f.velocity,m);var _=-m.dot(f.planeNormal);if(!(_<=0)){var g=this._tmpVecs[26];f.velocity.scaleToRef(h.currentTime,this._tmpVecs[27]),s.position.subtractToRef(this._tmpVecs[27],g);var v=f.planeNormal.dot(g),y=s.planeInteractions[u].penaltyDistance;y1e-4){for(h.currentTime+=p,l-=p,s.position.addInPlace(s.velocity.scale(p)),u=0;ur)return s}if(d<0){s.deltaTime=n;break}var b=h.supportPlanes[h.numSupportPlanes++];b.constraint=e[d],b.interaction=s.planeInteractions[d],b.interaction.penaltyDistance=2*(b.interaction.penaltyDistance+a),b.index=d,this._simplexSolverExamineActivePlanes(h,o,t,s.velocity)}return s},e.prototype.checkSupport=function(e,t){var n={isSurfaceDynamic:!1,supportedState:0,averageSurfaceNormal:c.Pq.Zero(),averageSurfaceVelocity:c.Pq.Zero(),averageAngularSurfaceVelocity:c.Pq.Zero()};return this.checkSupportToRef(e,t,n),n},e.prototype.checkSupportToRef=function(e,t,n){var r=1e-4;this._validateManifold();for(var i=this._createConstraintsFromManifold(e,0),o=[],a=0;a0&&(n.averageSurfaceNormal.normalize(),n.averageSurfaceVelocity.scaleInPlace(1/u),n.averageAngularSurfaceVelocity.scaleInPlace(1/u)),2==n.supportedState)for(a=0;a1e-5;p++){this._castWithCollectors(this._position,this._position.add(this._lastDisplacement),this._castCollector,this._startCollector);var f=this._updateManifold(this._startCollector,this._castCollector,this._lastDisplacement),m=this._createConstraintsFromManifold(e,e-o),_=this._tmpVecs[3];_.set(this.maxCharacterSpeedForSolver,this.maxCharacterSpeedForSolver,this.maxCharacterSpeedForSolver);var g=0==this._velocity.lengthSquared()?0:.5*this.keepDistance/this._velocity.length(),v=this._simplexSolverSolve(m,this._velocity,o,g,this.up,_),y=v.position,b=v.deltaTime;a=v.velocity,this._resolveContacts(e,n);var S=-1;if(0!=f||y.lengthSquared()>1e-8&&!this._lastDisplacement.equalsWithEpsilon(y,s)){this._castWithCollectors(this._position,this._position.add(y),this._castCollector,this._startCollector);var T=r._hknp,E=T.HP_QueryCollector_GetNumHits(this._castCollector)[1];if(E>0)for(var x=0;x=0){R=this._manifold[S];var A=1/y.length(),I=y.dot(R.normal)*A,O=this.keepDistance/-I;C=R.fraction-O*A,C=Math.min(Math.max(C,0),1);var M=y.scale(C);this._position.addInPlace(M),o-=b*C}else this._position.addInPlace(y),o-=b;this._lastDisplacement.copyFrom(y)}this._velocity.copyFrom(a)},e.prototype.calculateMovementToRef=function(e,t,n,r,i,o,a,s){var l=t.cross(a);if(l.lengthSquared()<1e-5)return!1;l.normalize();var u=l.cross(n);u.normalize(),(l=u.cross(n)).normalize();var h=c.uq.FromValues(u.x,u.y,u.z,0,l.x,l.y,l.z,0,n.x,n.y,n.z,0,0,0,0,1),d=h.clone().invert();r.subtractToRef(i,this._tmpVecs[29]);var p=this._tmpVecs[30];c.Pq.TransformNormalToRef(this._tmpVecs[29],d,p);var f=a.cross(t),m=o.dot(t),_=o.dot(f),g=o.length(),v=this._tmpVecs[4];v.set(-m,_,0),v.normalize(),v.scaleInPlace(g);var y=this._tmpVecs[5];v.subtractToRef(p,y);var b,S=y.lengthSquared(),T=this.maxAcceleration*e;return b=S*this.acceleration*this.acceleration>T*T?T/Math.sqrt(S):this.acceleration,y.scaleInPlace(b),p.addInPlace(y),c.Pq.TransformNormalToRef(p,h,s),s.addInPlace(i),!0},e.prototype.calculateMovement=function(e,t,n,r,i,o,a){var s=new c.Pq(0,0,0);return this.calculateMovementToRef(e,t,n,r,i,o,a,s),s},e}(),PL=function(){function e(e,t,n){this._vertices=[],this._indices=[],this._isRightHanded=n.useRightHandedSystem,this._collectIndices=t}return e.prototype.addNodeMeshes=function(e,t){e.computeWorldMatrix(!0);var n=c.AA.Matrix[0];if(c.uq.ScalingToRef(e.absoluteScaling.x,e.absoluteScaling.y,e.absoluteScaling.z,n),e instanceof qe?this._addMesh(e,n):e instanceof Ke&&this._addMesh(e.sourceMesh,n),t){var r=c.AA.Matrix[1];e.computeWorldMatrix().invertToRef(r);var i=c.AA.Matrix[2];r.multiplyToRef(n,i);for(var o=e.getChildMeshes(!1).filter((function(e){return!e.physicsBody})),a=0,s=o;a0)for(var t=0,n=e._pluginDataInstances;ts){this._createOrUpdateBodyInstances(e,l,a,s,o,!1);var c=this._hknp.HP_Body_GetShape(e._pluginDataInstances[0].hpBodyId)[1];c[0]||(c[0]=null===(i=e.shape)||void 0===i?void 0:i._pluginData[0]);for(var u=s;u0&&void 0===n)for(var i=0;i0){var r=n._thinInstanceDataStorage.matrixData;if(!r)return;var i=e.numInstances;this._createOrUpdateBodyInstances(e,e.getMotionType(),r,0,i,!0)}else this._hknp.HP_Body_SetQTransform(e._pluginData.hpBodyId,this._getTransformInfos(t))}else e.getPrestepType()==HF.ACTION?this.setTargetTransform(e,t.absolutePosition,t.absoluteRotationQuaternion):e.getPrestepType()==HF.DISABLED?y.V.Warn("Prestep type is set to DISABLED. Unable to set physics body transformation."):y.V.Warn("Invalid prestep type set to physics body.")},e.prototype.setTargetTransform=function(e,t,n,r){var i=this;this._applyToBodyOrInstances(e,(function(e){i._hknp.HP_Body_SetTargetQTransform(e.hpBodyId,[i._bVecToV3(t),i._bQuatToV4(n)])}),r)},e.prototype.setGravityFactor=function(e,t,n){var r=this;this._applyToBodyOrInstances(e,(function(e){r._hknp.HP_Body_SetGravityFactor(e.hpBodyId,t)}),n)},e.prototype.getGravityFactor=function(e,t){var n=this._getPluginReference(e,t);return this._hknp.HP_Body_GetGravityFactor(n.hpBodyId)[1]},e.prototype.disposeBody=function(e){if(e._pluginDataInstances&&e._pluginDataInstances.length>0)for(var t=0,n=e._pluginDataInstances;t0?e._pluginDataInstances[0]:e._pluginData,r=this._hknp.HP_Body_GetShape(n.hpBodyId)[1],i=this._hknp.HP_Shape_CreateDebugDisplayGeometry(r);if(i[0]!=this._hknp.Result.RESULT_OK)return{positions:[],indices:[]};var o=this._hknp.HP_DebugGeometry_GetInfo(i[1])[1],a=new Float32Array(this._hknp.HEAPU8.buffer,o[0],3*o[1]),s=new Uint32Array(this._hknp.HEAPU8.buffer,o[2],3*o[3]),l=a.slice(0),c=s.slice(0);return this._hknp.HP_DebugGeometry_Release(i[1]),{positions:l,indices:c}},e.prototype.disposeShape=function(e){this._shapes.delete(e._pluginData[0]),this._hknp.HP_Shape_Release(e._pluginData),e._pluginData=void 0},e.prototype.initConstraint=function(e,t,n,r,i){var o,a,s,l,u,h=e.type,d=e.options;if(h&&d)if(t._pluginDataInstances.length>0&&void 0===r||n._pluginDataInstances.length>0&&void 0===i)y.V.Warn("Body is instanced but no instance index was specified. Constraint will not be applied.");else{e._pluginData=null!==(o=e._pluginData)&&void 0!==o?o:[];var p=this._hknp.HP_Constraint_Create()[1];e._pluginData.push(p);var f=this._getPluginReference(t,r).hpBodyId,m=this._getPluginReference(n,i).hpBodyId;this._hknp.HP_Constraint_SetParentBody(p,f),this._hknp.HP_Constraint_SetChildBody(p,m),this._constraintToBodyIdPair.set(p[0],[f[0],m[0]]);var _=d.pivotA?this._bVecToV3(d.pivotA):this._bVecToV3(c.Pq.Zero()),g=null!==(a=d.axisA)&&void 0!==a?a:new c.Pq(1,0,0),v=this._tmpVec3[0];d.perpAxisA?v.copyFrom(d.perpAxisA):g.getNormalToRef(v),this._hknp.HP_Constraint_SetAnchorInParent(p,_,this._bVecToV3(g),this._bVecToV3(v));var b=d.pivotB?this._bVecToV3(d.pivotB):this._bVecToV3(c.Pq.Zero()),S=null!==(s=d.axisB)&&void 0!==s?s:new c.Pq(1,0,0),T=this._tmpVec3[0];if(d.perpAxisB?T.copyFrom(d.perpAxisB):S.getNormalToRef(T),this._hknp.HP_Constraint_SetAnchorInChild(p,b,this._bVecToV3(S),this._bVecToV3(T)),e._initOptions||(e._initOptions={axisA:g.clone(),axisB:S.clone(),perpAxisA:v.clone(),perpAxisB:T.clone(),pivotA:new c.Pq(_[0],_[1],_[2]),pivotB:new c.Pq(b[0],b[1],b[2])}),5==h)this._hknp.HP_Constraint_SetAxisMode(p,this._hknp.ConstraintAxis.LINEAR_X,this._hknp.ConstraintAxisLimitMode.LOCKED),this._hknp.HP_Constraint_SetAxisMode(p,this._hknp.ConstraintAxis.LINEAR_Y,this._hknp.ConstraintAxisLimitMode.LOCKED),this._hknp.HP_Constraint_SetAxisMode(p,this._hknp.ConstraintAxis.LINEAR_Z,this._hknp.ConstraintAxisLimitMode.LOCKED),this._hknp.HP_Constraint_SetAxisMode(p,this._hknp.ConstraintAxis.ANGULAR_X,this._hknp.ConstraintAxisLimitMode.LOCKED),this._hknp.HP_Constraint_SetAxisMode(p,this._hknp.ConstraintAxis.ANGULAR_Y,this._hknp.ConstraintAxisLimitMode.LOCKED),this._hknp.HP_Constraint_SetAxisMode(p,this._hknp.ConstraintAxis.ANGULAR_Z,this._hknp.ConstraintAxisLimitMode.LOCKED);else if(2==h){var E=d.maxDistance||0,x=this._hknp.ConstraintAxis.LINEAR_DISTANCE;this._hknp.HP_Constraint_SetAxisMode(p,x,this._hknp.ConstraintAxisLimitMode.LIMITED),this._hknp.HP_Constraint_SetAxisMinLimit(p,x,E),this._hknp.HP_Constraint_SetAxisMaxLimit(p,x,E)}else if(3==h)this._hknp.HP_Constraint_SetAxisMode(p,this._hknp.ConstraintAxis.LINEAR_X,this._hknp.ConstraintAxisLimitMode.LOCKED),this._hknp.HP_Constraint_SetAxisMode(p,this._hknp.ConstraintAxis.LINEAR_Y,this._hknp.ConstraintAxisLimitMode.LOCKED),this._hknp.HP_Constraint_SetAxisMode(p,this._hknp.ConstraintAxis.LINEAR_Z,this._hknp.ConstraintAxisLimitMode.LOCKED),this._hknp.HP_Constraint_SetAxisMode(p,this._hknp.ConstraintAxis.ANGULAR_Y,this._hknp.ConstraintAxisLimitMode.LOCKED),this._hknp.HP_Constraint_SetAxisMode(p,this._hknp.ConstraintAxis.ANGULAR_Z,this._hknp.ConstraintAxisLimitMode.LOCKED);else if(6==h)this._hknp.HP_Constraint_SetAxisMode(p,this._hknp.ConstraintAxis.LINEAR_Y,this._hknp.ConstraintAxisLimitMode.LOCKED),this._hknp.HP_Constraint_SetAxisMode(p,this._hknp.ConstraintAxis.LINEAR_Z,this._hknp.ConstraintAxisLimitMode.LOCKED),this._hknp.HP_Constraint_SetAxisMode(p,this._hknp.ConstraintAxis.ANGULAR_X,this._hknp.ConstraintAxisLimitMode.LOCKED),this._hknp.HP_Constraint_SetAxisMode(p,this._hknp.ConstraintAxis.ANGULAR_Y,this._hknp.ConstraintAxisLimitMode.LOCKED),this._hknp.HP_Constraint_SetAxisMode(p,this._hknp.ConstraintAxis.ANGULAR_Z,this._hknp.ConstraintAxisLimitMode.LOCKED);else if(4==h)this._hknp.HP_Constraint_SetAxisMode(p,this._hknp.ConstraintAxis.LINEAR_Y,this._hknp.ConstraintAxisLimitMode.LOCKED),this._hknp.HP_Constraint_SetAxisMode(p,this._hknp.ConstraintAxis.LINEAR_Z,this._hknp.ConstraintAxisLimitMode.LOCKED),this._hknp.HP_Constraint_SetAxisMode(p,this._hknp.ConstraintAxis.ANGULAR_Y,this._hknp.ConstraintAxisLimitMode.LOCKED),this._hknp.HP_Constraint_SetAxisMode(p,this._hknp.ConstraintAxis.ANGULAR_Z,this._hknp.ConstraintAxisLimitMode.LOCKED);else if(1==h)this._hknp.HP_Constraint_SetAxisMode(p,this._hknp.ConstraintAxis.LINEAR_X,this._hknp.ConstraintAxisLimitMode.LOCKED),this._hknp.HP_Constraint_SetAxisMode(p,this._hknp.ConstraintAxis.LINEAR_Y,this._hknp.ConstraintAxisLimitMode.LOCKED),this._hknp.HP_Constraint_SetAxisMode(p,this._hknp.ConstraintAxis.LINEAR_Z,this._hknp.ConstraintAxisLimitMode.LOCKED);else{if(7!=h)throw new Error("Unsupported Constraint Type.");for(var P=0,C=e.limits;P0){var d=this._hknp.HP_QueryCollector_GetCastRayResult(this._queryCollector,0)[1][1];this._populateHitData(d,n),n.calculateHitDistance()}},e.prototype.pointProximity=function(e,t){var n,r,i,o,a=null!==(r=null===(n=null==e?void 0:e.collisionFilter)||void 0===n?void 0:n.membership)&&void 0!==r?r:-1,s=null!==(o=null===(i=null==e?void 0:e.collisionFilter)||void 0===i?void 0:i.collideWith)&&void 0!==o?o:-1;t.reset();var l=e.ignoreBody?[BigInt(e.ignoreBody._pluginData.hpBodyId[0])]:[BigInt(0)],c=[this._bVecToV3(e.position),e.maxDistance,[a,s],e.shouldHitTriggers,l];if(this._hknp.HP_World_PointProximityWithCollector(this.world,this._queryCollector,c),this._hknp.HP_QueryCollector_GetNumHits(this._queryCollector)[1]>0){var u=this._hknp.HP_QueryCollector_GetPointProximityResult(this._queryCollector,0)[1],h=u[0],d=u[1];this._populateHitData(d,t),t.setHitDistance(h)}},e.prototype.shapeProximity=function(e,t,n){t.reset(),n.reset();var r=e.shape._pluginData,i=e.ignoreBody?[BigInt(e.ignoreBody._pluginData.hpBodyId[0])]:[BigInt(0)],o=[r,this._bVecToV3(e.position),this._bQuatToV4(e.rotation),e.maxDistance,e.shouldHitTriggers,i];if(this._hknp.HP_World_ShapeProximityWithCollector(this.world,this._queryCollector,o),this._hknp.HP_QueryCollector_GetNumHits(this._queryCollector)[1]>0){var a=this._hknp.HP_QueryCollector_GetShapeProximityResult(this._queryCollector,0)[1],s=a[0],l=a[1],c=a[2];this._populateHitData(l,t),this._populateHitData(c,n),t.setHitDistance(s),n.setHitDistance(s)}},e.prototype.shapeCast=function(e,t,n){t.reset(),n.reset();var r=e.shape._pluginData,i=e.ignoreBody?[BigInt(e.ignoreBody._pluginData.hpBodyId[0])]:[BigInt(0)],o=[r,this._bQuatToV4(e.rotation),this._bVecToV3(e.startPosition),this._bVecToV3(e.endPosition),e.shouldHitTriggers,i];if(this._hknp.HP_World_ShapeCastWithCollector(this.world,this._queryCollector,o),this._hknp.HP_QueryCollector_GetNumHits(this._queryCollector)[1]>0){var a=this._hknp.HP_QueryCollector_GetShapeCastResult(this._queryCollector,0)[1],s=a[0],l=a[1],c=a[2];this._populateHitData(l,t),this._populateHitData(c,n),t.setHitFraction(s),n.setHitFraction(s)}},e.prototype.getCollisionObservable=function(e){var t=e._pluginData.hpBodyId[0],n=this._bodyCollisionObservable.get(t);return n||(n=new l.cP,this._bodyCollisionObservable.set(t,n)),n},e.prototype.getCollisionEndedObservable=function(e){var t=e._pluginData.hpBodyId[0],n=this._bodyCollisionEndedObservable.get(t);return n||(n=new l.cP,this._bodyCollisionEndedObservable.set(t,n)),n},e.prototype.setCollisionCallbackEnabled=function(e,t){var n=this._hknp.EventType.COLLISION_STARTED.value|this._hknp.EventType.COLLISION_CONTINUED.value|this._hknp.EventType.COLLISION_FINISHED.value;if(e._pluginDataInstances&&e._pluginDataInstances.length)for(var r=0;r0)for(this._physicsTimeAccumulator+=e;this._physicsTimeAccumulator>t;)this.onBeforePhysicsObservable.notifyObservers(this),this._physicsEngine._step(t/1e3),this.onAfterPhysicsObservable.notifyObservers(this),this._physicsTimeAccumulator-=t;else this.onBeforePhysicsObservable.notifyObservers(this),this._physicsEngine._step(e/1e3),this.onAfterPhysicsObservable.notifyObservers(this)}};var ML=function(){function e(e){var t=this;this.name=Ue.v.NAME_PHYSICSENGINE,this.scene=e,this.scene.onBeforePhysicsObservable=new l.cP,this.scene.onAfterPhysicsObservable=new l.cP,this.scene.getDeterministicFrameTime=function(){return t.scene._physicsEngine?1e3*t.scene._physicsEngine.getTimeStep():1e3/60}}return e.prototype.register=function(){},e.prototype.rebuild=function(){},e.prototype.dispose=function(){this.scene.onBeforePhysicsObservable.clear(),this.scene.onAfterPhysicsObservable.clear(),this.scene._physicsEngine&&this.scene.disablePhysicsEngine()},e}();Object.defineProperty(Ee.prototype,"physicsBody",{get:function(){return this._physicsBody},set:function(e){var t=this;this._physicsBody!==e&&(this._disposePhysicsObserver&&this.onDisposeObservable.remove(this._disposePhysicsObserver),this._physicsBody=e,e&&(this._disposePhysicsObserver=this.onDisposeObservable.add((function(){t.physicsBody&&(t.physicsBody.dispose(),t.physicsBody=null)}))))},enumerable:!0,configurable:!0}),Ee.prototype.getPhysicsBody=function(){return this.physicsBody},Ee.prototype.applyImpulse=function(e,t){if(!this.physicsBody)throw new Error("No Physics Body for TransformNode");return this.physicsBody.applyImpulse(e,t),this},Ee.prototype.applyAngularImpulse=function(e){if(!this.physicsBody)throw new Error("No Physics Body for TransformNode");return this.physicsBody.applyAngularImpulse(e),this};var DL,NL,FL=function(){function e(){}return e.GetContactPointToRef=function(e,t,n,r,i){var o=e.getScene().getPhysicsEngine(),a=null==o?void 0:o.getPluginVersion();if(1===a){var s=new Nn(t,n).intersectsMesh(e);if(s.hit&&s.pickedPoint)return r.copyFrom(s.pickedPoint),!0}else if(2===a)return e.physicsBody.getObjectCenterWorldToRef(r,i),!0;return!1},e.HasAppliedForces=function(e,t){var n,r,i;return 0===e.getMotionType(t)||0===(null!==(r=null===(n=e.getMassProperties(t))||void 0===n?void 0:n.mass)&&void 0!==r?r:0)||0===(null===(i=e.transformNode)||void 0===i?void 0:i.getTotalVertices())},e.IsInsideCylinder=function(e,t,n,r){var i=c.AA.Vector3[0];return e.subtractToRef(t,i),Math.abs(i.x)<=n&&Math.abs(i.z)<=n&&i.y>=0&&i.y<=r},e}(),LL=function(){function e(e){this._hitData={force:new c.Pq,contactPoint:new c.Pq,distanceFromOrigin:0},this._scene=e,this._physicsEngine=this._scene.getPhysicsEngine(),this._physicsEngine||y.V.Warn("Physics engine not enabled. Please enable the physics before you can use the methods.")}return e.prototype.applyRadialExplosionImpulse=function(e,t,n,r){if(!this._physicsEngine)return y.V.Warn("Physics engine not enabled. Please enable the physics before you call this method."),null;if(1===this._physicsEngine.getPluginVersion()&&0===this._physicsEngine.getImpostors().length)return null;if(2===this._physicsEngine.getPluginVersion()&&0===this._physicsEngine.getBodies().length)return null;var i=!1;if("number"==typeof t){var o=t;(t=new GL).radius=o,t.strength=null!=n?n:t.strength,t.falloff=null!=r?r:t.falloff}else i=!(!t.affectedImpostorsCallback&&!t.affectedBodiesCallback);var a=new wL(this._scene,t),s=this._hitData;if(1===this._physicsEngine.getPluginVersion()){for(var l=Array(),c=0,u=this._physicsEngine.getImpostors();cthis._options.radius)return!1;var s=0===this._options.falloff?this._options.strength:this._options.strength*(1-a/this._options.radius);return i.scaleInPlace(s),r.force.copyFrom(i),r.contactPoint.copyFrom(o),r.distanceFromOrigin=a,!0},e.prototype.getBodyHitData=function(e,t,n,r){if(FL.HasAppliedForces(e,r))return!1;var i=e.transformNode,o=e.getObjectCenterWorld(r);return n.instanceIndex=r,this._getHitData(i,o,t,n)},e.prototype.getImpostorHitData=function(e,t,n){if(0===e.mass)return!1;if("Mesh"!==e.object.getClassName()&&"InstancedMesh"!==e.object.getClassName())return!1;var r=e.object;if(!this._intersectsWithSphere(r,t,this._options.radius))return!1;var i=e.getObjectCenter();return this._getHitData(r,i,t,n),!0},e.prototype.triggerAffectedImpostorsCallback=function(e){this._options.affectedImpostorsCallback&&this._options.affectedImpostorsCallback(e)},e.prototype.triggerAffectedBodiesCallback=function(e){this._options.affectedBodiesCallback&&this._options.affectedBodiesCallback(e)},e.prototype.dispose=function(e){var t=this;void 0===e&&(e=!0),this._sphere&&(e?this._sphere.dispose():setTimeout((function(){t._dataFetched||t._sphere.dispose()}),0))},e.prototype._prepareSphere=function(){this._sphere||(this._sphere=rs("radialExplosionEventSphere",this._options.sphere,this._scene),this._sphere.isVisible=!1)},e.prototype._intersectsWithSphere=function(e,t,n){return this._prepareSphere(),this._sphere.position=t,this._sphere.scaling.setAll(2*n),this._sphere._updateBoundingInfo(),this._sphere.computeWorldMatrix(!0),this._sphere.intersectsMesh(e,!0)},e}(),BL=function(){function e(e,t,n,r){var i=this;this._physicsHelper=e,this._scene=t,this._origin=n,this._options=r,this._dataFetched=!1,this._options=(0,f.Cl)((0,f.Cl)({},new GL),this._options),this._tickCallback=function(){return i._tick()},this._options.strength=-1*this._options.strength}return e.prototype.getData=function(){return this._dataFetched=!0,{sphere:this._sphere}},e.prototype.enable=function(){this._tickCallback.call(this),this._scene.registerBeforeRender(this._tickCallback)},e.prototype.disable=function(){this._scene.unregisterBeforeRender(this._tickCallback)},e.prototype.dispose=function(e){var t=this;void 0===e&&(e=!0),this._sphere&&(e?this._sphere.dispose():setTimeout((function(){t._dataFetched||t._sphere.dispose()}),0))},e.prototype._tick=function(){var e;if(this._sphere)this._physicsHelper.applyRadialExplosionForce(this._origin,this._options);else{var t=this._physicsHelper.applyRadialExplosionForce(this._origin,this._options);t&&(this._sphere=null===(e=t.getData().sphere)||void 0===e?void 0:e.clone("radialExplosionEventSphereClone"))}},e}(),VL=function(){function e(e,t,n){var r=this;this._scene=e,this._origin=t,this._options=n,this._originTop=c.Pq.Zero(),this._originDirection=c.Pq.Zero(),this._cylinderPosition=c.Pq.Zero(),this._dataFetched=!1,this._physicsEngine=this._scene.getPhysicsEngine(),this._options=(0,f.Cl)((0,f.Cl)({},new kL),this._options),this._origin.addToRef(new c.Pq(0,this._options.height/2,0),this._cylinderPosition),this._origin.addToRef(new c.Pq(0,this._options.height,0),this._originTop),1===this._options.updraftMode&&(this._originDirection=this._origin.subtract(this._originTop).normalize()),this._tickCallback=function(){return r._tick()},1===this._physicsEngine.getPluginVersion()&&this._prepareCylinder()}return e.prototype.getData=function(){return this._dataFetched=!0,{cylinder:this._cylinder}},e.prototype.enable=function(){this._tickCallback.call(this),this._scene.registerBeforeRender(this._tickCallback)},e.prototype.disable=function(){this._scene.unregisterBeforeRender(this._tickCallback)},e.prototype.dispose=function(e){var t=this;void 0===e&&(e=!0),this._cylinder&&(e?(this._cylinder.dispose(),this._cylinder=void 0):setTimeout((function(){!t._dataFetched&&t._cylinder&&(t._cylinder.dispose(),t._cylinder=void 0)}),0))},e.prototype._getHitData=function(e,t){var n;n=1===this._options.updraftMode?this._originDirection:e.subtract(this._originTop);var r=c.Pq.Distance(this._origin,e),i=-1*this._options.strength,o=n.multiplyByFloats(i,i,i);t.force.copyFrom(o),t.contactPoint.copyFrom(e),t.distanceFromOrigin=r},e.prototype._getBodyHitData=function(e,t,n){if(FL.HasAppliedForces(e))return!1;var r=e.getObjectCenterWorld(n);return!!FL.IsInsideCylinder(r,this._origin,this._options.radius,this._options.height)&&(t.instanceIndex=n,this._getHitData(r,t),!0)},e.prototype._getImpostorHitData=function(e,t){if(0===e.mass)return!1;var n=e.object;if(!this._intersectsWithCylinder(n))return!1;var r=e.getObjectCenter();return this._getHitData(r,t),!0},e.prototype._tick=function(){var t=this,n=e._HitData;if(1===this._physicsEngine.getPluginVersion())for(var r=0,i=this._physicsEngine.getImpostors();rthis._options.centripetalForceThreshold&&d.negateInPlace(),h>this._options.centripetalForceThreshold)s=d.x*this._options.centripetalForceMultiplier,l=d.y*this._options.updraftForceMultiplier,u=d.z*this._options.centripetalForceMultiplier;else{var p=c.Pq.Cross(i,n).normalize();s=(p.x+d.x)*this._options.centrifugalForceMultiplier,l=this._originTop.y*this._options.updraftForceMultiplier,u=(p.z+d.z)*this._options.centrifugalForceMultiplier}var f=c.AA.Vector3[3];return f.set(s,l,u),f.scaleInPlace(this._options.strength),r.force.copyFrom(f),r.contactPoint.copyFrom(n),r.distanceFromOrigin=h,!0},e.prototype._getBodyHitData=function(e,t,n){if(FL.HasAppliedForces(e,n))return!1;var r=e.transformNode,i=e.getObjectCenterWorld(n);return!!FL.IsInsideCylinder(i,this._origin,this._options.radius,this._options.height)&&(t.instanceIndex=n,this._getHitData(r,i,t))},e.prototype._getImpostorHitData=function(e,t){if(0===e.mass)return!1;if("Mesh"!==e.object.getClassName()&&"InstancedMesh"!==e.object.getClassName())return!1;var n=e.object;if(!this._intersectsWithCylinder(n))return!1;var r=e.getObjectCenter();return this._getHitData(n,r,t),!0},e.prototype._tick=function(){var t=this,n=e._HitData;if(1===this._physicsEngine.getPluginVersion())for(var r=0,i=this._physicsEngine.getImpostors();r1?b.Y.TEXTUREFORMAT_RED:b.Y.TEXTUREFORMAT_RGBA;s._circleOfConfusion=new QL("circleOfConfusion",n,{size:1,samplingMode:_n.g.BILINEAR_SAMPLINGMODE,engine:l,textureType:i,blockCompilation:o,depthNotNormalized:a,effectWrapper:s._thinDepthOfFieldEffect._circleOfConfusion},null),s._depthOfFieldBlurY=[],s._depthOfFieldBlurX=[];for(var u=s._thinDepthOfFieldEffect._depthOfFieldBlurX.length,h=0;h4&&(i.push(se.R.MatricesIndicesExtraKind),i.push(se.R.MatricesWeightsExtraKind)),r.push("#define NUM_BONE_INFLUENCERS "+o.numBoneInfluencers),r.push("#define BONETEXTURE "+o.skeleton.isUsingTextureForMatrices),r.push("#define BonesPerMesh "+(o.skeleton.bones.length+1))):(r.push("#define NUM_BONE_INFLUENCERS 0"),r.push("#define BONETEXTURE false"),r.push("#define BonesPerMesh 0"));var d=o.morphTargetManager?(0,Le.Dk)(o.morphTargetManager,r,i,o,!0,!0,!1,a,s,!1):0;t&&(r.push("#define INSTANCES"),(0,Le.te)(i,this._enableVelocity||this._enableVelocityLinear),e.getRenderingMesh().hasThinInstances&&r.push("#define THIN_INSTANCES")),this._linkedWithPrePass?r.push("#define SCENE_MRT_COUNT "+this._attachmentsFromPrePass.length):r.push("#define SCENE_MRT_COUNT "+this._multiRenderTarget.textures.length),(0,Mo.r4)(n,this._scene,r);var p=this._scene.getEngine(),f=e._getDrawWrapper(void 0,!0),m=f.defines,_=r.join("\n");return m!==_&&f.setEffect(p.createEffect("geometry",{attributes:i,uniformsNames:hw,samplers:["diffuseSampler","bumpSampler","reflectivitySampler","albedoSampler","morphTargets","boneSampler"],defines:_,onCompiled:null,fallbacks:null,onError:null,uniformBuffersNames:["Scene"],indexParameters:{buffersCount:this._multiRenderTarget.textures.length-1,maxSimultaneousMorphTargets:d},shaderLanguage:this.shaderLanguage},p),_),f.effect.isReady()},e.prototype.getGBuffer=function(){return this._multiRenderTarget},Object.defineProperty(e.prototype,"samples",{get:function(){return this._multiRenderTarget.samples},set:function(e){this._multiRenderTarget.samples=e},enumerable:!1,configurable:!0}),e.prototype.dispose=function(){this._resizeObserver&&(this._scene.getEngine().onResizeObservable.remove(this._resizeObserver),this._resizeObserver=null),this.getGBuffer().dispose()},e.prototype._assignRenderTargetIndices=function(){var t=[],n=[],r=0;return this._enableDepth&&(this._depthIndex=r,r++,t.push("gBuffer_Depth"),n.push(this._textureTypesAndFormats[e.DEPTH_TEXTURE_TYPE])),this._enableNormal&&(this._normalIndex=r,r++,t.push("gBuffer_Normal"),n.push(this._textureTypesAndFormats[e.NORMAL_TEXTURE_TYPE])),this._enablePosition&&(this._positionIndex=r,r++,t.push("gBuffer_Position"),n.push(this._textureTypesAndFormats[e.POSITION_TEXTURE_TYPE])),this._enableVelocity&&(this._velocityIndex=r,r++,t.push("gBuffer_Velocity"),n.push(this._textureTypesAndFormats[e.VELOCITY_TEXTURE_TYPE])),this._enableVelocityLinear&&(this._velocityLinearIndex=r,r++,t.push("gBuffer_VelocityLinear"),n.push(this._textureTypesAndFormats[e.VELOCITY_LINEAR_TEXTURE_TYPE])),this._enableReflectivity&&(this._reflectivityIndex=r,r++,t.push("gBuffer_Reflectivity"),n.push(this._textureTypesAndFormats[e.REFLECTIVITY_TEXTURE_TYPE])),this._enableScreenspaceDepth&&(this._screenspaceDepthIndex=r,r++,t.push("gBuffer_ScreenspaceDepth"),n.push(this._textureTypesAndFormats[e.SCREENSPACE_DEPTH_TEXTURE_TYPE])),[r,t,n]},e.prototype._createRenderTargets=function(){var t=this,n=this._scene.getEngine(),r=this._assignRenderTargetIndices(),i=r[0],o=r[1],a=r[2],s=b.Y.TEXTURETYPE_UNSIGNED_BYTE;n._caps.textureFloat&&n._caps.textureFloatLinearFiltering?s=b.Y.TEXTURETYPE_FLOAT:n._caps.textureHalfFloat&&n._caps.textureHalfFloatLinearFiltering&&(s=b.Y.TEXTURETYPE_HALF_FLOAT);for(var l=void 0!==this._ratioOrDimensions.width?this._ratioOrDimensions:{width:n.getRenderWidth()*this._ratioOrDimensions,height:n.getRenderHeight()*this._ratioOrDimensions},u=[],h=[],d=0,p=a;d-1){var b=y.getTransformMatrixTexture(n);p.setTexture("boneSampler",b),p.setFloat("boneTextureWidth",4*(y.bones.length+1))}else p.setMatrices("mBones",n.skeleton.getTransformMatrices(n));(t._enableVelocity||t._enableVelocityLinear)&&p.setMatrices("mPreviousBones",t._previousBonesTransformationMatrices[n.uniqueId])}(0,Le.nR)(n,p),n.morphTargetManager&&n.morphTargetManager.isUsingTextureForTargets&&n.morphTargetManager._bind(p),(t._enableVelocity||t._enableVelocityLinear)&&(p.setMatrix("previousWorld",t._previousTransformationMatrices[r.uniqueId].world),p.setMatrix("previousViewProjection",t._previousTransformationMatrices[r.uniqueId].viewProjection)),u&&n.hasThinInstances&&p.setMatrix("world",h),n._processRendering(r,e,p,a.fillMode,l,u,(function(e,t){e||p.setMatrix("world",t)}))}(t._enableVelocity||t._enableVelocityLinear)&&(t._previousTransformationMatrices[r.uniqueId].world=h.clone(),t._previousTransformationMatrices[r.uniqueId].viewProjection=t._scene.getTransformMatrix().clone(),n.skeleton&&t._copyBonesTransformationMatrices(n.skeleton.getTransformMatrices(n),t._previousBonesTransformationMatrices[r.uniqueId]))}}};this._multiRenderTarget.customIsReadyFunction=function(e,r,i){if((i||0===r)&&e.subMeshes)for(var o=0;o0){var n=this._renderEffects[t[0]].getPostProcesses();n&&(n[0].samples=e)}return!0},e.prototype._adaptPostProcessesToViewPort=function(){for(var e=0,t=Object.keys(this._renderEffects);e1){for(var n=0,r=this._cameras;n-1&&(e.depthOfField.depthTexture=t.enableDepthRenderer(t.activeCamera).getDepthMap())}))}else{this._scene.onAfterRenderTargetsRenderObservable.remove(this._depthOfFieldSceneObserver);var o=this._scene.enableDepthRenderer(this._cameras[0]);this.depthOfField.depthTexture=o.getDepthMap()}this.depthOfField._isReady()||this.depthOfField._updateEffects(),this.addEffect(this.depthOfField),this._setAutoClearAndTextureSharing(this.depthOfField._effects[0],!0)}else this._scene.onAfterRenderTargetsRenderObservable.remove(this._depthOfFieldSceneObserver);this.bloomEnabled&&(this.bloom._isReady()||this.bloom._updateEffects(),this.addEffect(this.bloom),this._setAutoClearAndTextureSharing(this.bloom._effects[0],!0)),this._imageProcessingEnabled&&(this.imageProcessing=new lw("imageProcessing",1,null,_n.g.BILINEAR_SAMPLINGMODE,t,!1,this._defaultPipelineTextureType,this.scene.imageProcessingConfiguration),this._hdr?(this.addEffect(new XL(t,this.ImageProcessingPostProcessId,(function(){return e.imageProcessing}),!0)),this._setAutoClearAndTextureSharing(this.imageProcessing)):this._scene.imageProcessingConfiguration.applyByPostProcess=!1,this._cameras&&0!==this._cameras.length||(this._scene.imageProcessingConfiguration.applyByPostProcess=!1),this.imageProcessing.getEffect()||this.imageProcessing._updateParameters()),this.sharpenEnabled&&(this.sharpen.isReady()||this.sharpen.updateEffect(),this.addEffect(this._sharpenEffect),this._setAutoClearAndTextureSharing(this.sharpen)),this.grainEnabled&&(this.grain.isReady()||this.grain.updateEffect(),this.addEffect(this._grainEffect),this._setAutoClearAndTextureSharing(this.grain)),this.chromaticAberrationEnabled&&(this.chromaticAberration.isReady()||this.chromaticAberration.updateEffect(),this.addEffect(this._chromaticAberrationEffect),this._setAutoClearAndTextureSharing(this.chromaticAberration)),this.fxaaEnabled&&(this.fxaa=new BO("fxaa",1,null,_n.g.BILINEAR_SAMPLINGMODE,t,!1,this._defaultPipelineTextureType),this.addEffect(new XL(t,this.FxaaPostProcessId,(function(){return e.fxaa}),!0)),this._setAutoClearAndTextureSharing(this.fxaa,!0)),null!==this._cameras&&this._scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(this._name,this._cameras),(this._scene.activeCameras&&this._scene.activeCameras.length>1||this._scene.activeCamera&&-1===this._cameras.indexOf(this._scene.activeCamera))&&(this._scene.autoClear=!0),this._activeCameraChangedObserver||(this._activeCameraChangedObserver=this._scene.onActiveCameraChanged.add((function(){e._scene.activeCamera&&-1===e._cameras.indexOf(e._scene.activeCamera)&&(e._scene.autoClear=!0)}))),this._activeCamerasChangedObserver||(this._activeCamerasChangedObserver=this._scene.onActiveCamerasChanged.add((function(){e._scene.activeCameras&&e._scene.activeCameras.length>1&&(e._scene.autoClear=!0)}))),this._adaptPostProcessesToViewPort(),!this._enableMSAAOnFirstPostProcess(this.samples)&&this.samples>1&&y.V.Warn("MSAA failed to enable, MSAA is only supported in browsers that support webGL >= 2.0"),this.onBuildObservable.notifyObservers(this)}},t.prototype._disposePostProcesses=function(e){void 0===e&&(e=!1);for(var t=0;t1.0) { lum_threshold=0.94+0.01*threshold; }\nelse { lum_threshold=0.5+0.44*threshold; }\nluminance=clamp((luminance-lum_threshold)*(1.0/(1.0-lum_threshold)),0.0,1.0);highlight*=luminance*gain;highlight.a=1.0;return highlight;}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{vec4 original=texture2D(textureSampler,vUV);if (gain==-1.0) {gl_FragColor=vec4(0.0,0.0,0.0,1.0);return;}\nfloat w=2.0/screen_width;float h=2.0/screen_height;float weight=1.0;vec4 blurred=vec4(0.0,0.0,0.0,0.0);\n#ifdef PENTAGON\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.84*w,0.43*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.48*w,-1.29*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.61*w,1.51*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.55*w,-0.74*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.71*w,-0.52*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.94*w,1.59*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.40*w,-1.87*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.62*w,1.16*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.09*w,0.25*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.46*w,-1.71*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.08*w,2.42*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.85*w,-1.89*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.89*w,0.16*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.29*w,1.88*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.40*w,-2.81*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.54*w,2.26*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.60*w,-0.61*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.31*w,-1.30*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.83*w,2.53*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.12*w,-2.48*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.60*w,1.11*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.82*w,0.99*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.50*w,-2.81*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.85*w,3.33*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.94*w,-1.92*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.27*w,-0.53*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.95*w,2.48*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.23*w,-3.04*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.17*w,2.05*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.97*w,-0.04*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.25*w,-2.00*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.31*w,3.08*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.94*w,-2.59*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.37*w,0.64*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-3.13*w,1.93*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.03*w,-3.65*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.60*w,3.17*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-3.14*w,-1.19*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.00*w,-1.19*h)));\n#else\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.85*w,0.36*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.52*w,-1.14*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.46*w,1.42*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.46*w,-0.83*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.79*w,-0.42*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.11*w,1.62*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.29*w,-2.07*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.69*w,1.39*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.28*w,0.12*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.65*w,-1.69*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.08*w,2.44*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.63*w,-1.90*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.55*w,0.31*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.13*w,1.52*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.56*w,-2.61*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.38*w,2.34*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.64*w,-0.81*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.53*w,-1.21*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.06*w,2.63*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.00*w,-2.69*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.59*w,1.32*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.82*w,0.78*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.57*w,-2.50*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.54*w,2.93*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.39*w,-1.81*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.01*w,-0.28*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.04*w,2.25*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.02*w,-3.05*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.09*w,2.25*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-3.07*w,-0.25*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.44*w,-1.90*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.52*w,3.05*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.68*w,-2.61*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.01*w,0.79*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.76*w,1.46*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.05*w,-2.94*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.21*w,2.88*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.84*w,-1.30*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.98*w,-0.96*h)));\n#endif\nblurred/=39.0;gl_FragColor=blurred;}");var Rw="depthOfFieldPixelShader";Bi.l.ShadersStore[Rw]||(Bi.l.ShadersStore[Rw]="uniform sampler2D textureSampler;uniform sampler2D highlightsSampler;uniform sampler2D depthSampler;uniform sampler2D grainSampler;uniform float grain_amount;uniform bool blur_noise;uniform float screen_width;uniform float screen_height;uniform float distortion;uniform bool dof_enabled;uniform float screen_distance; \nuniform float aperture;uniform float darken;uniform float edge_blur;uniform bool highlights;uniform float near;uniform float far;varying vec2 vUV;\n#define PI 3.14159265\n#define TWOPI 6.28318530\n#define inverse_focal_length 0.1 \nvec2 centered_screen_pos;vec2 distorted_coords;float radius2;float radius;vec2 rand(vec2 co)\n{float noise1=(fract(sin(dot(co,vec2(12.9898,78.233)))*43758.5453));float noise2=(fract(sin(dot(co,vec2(12.9898,78.233)*2.0))*43758.5453));return clamp(vec2(noise1,noise2),0.0,1.0);}\nvec2 getDistortedCoords(vec2 coords) {if (distortion==0.0) { return coords; }\nvec2 direction=1.0*normalize(centered_screen_pos);vec2 dist_coords=vec2(0.5,0.5);dist_coords.x=0.5+direction.x*radius2*1.0;dist_coords.y=0.5+direction.y*radius2*1.0;float dist_amount=clamp(distortion*0.23,0.0,1.0);dist_coords=mix(coords,dist_coords,dist_amount);return dist_coords;}\nfloat sampleScreen(inout vec4 color,in vec2 offset,in float weight) {vec2 coords=distorted_coords;float angle=rand(coords*100.0).x*TWOPI;coords+=vec2(offset.x*cos(angle)-offset.y*sin(angle),offset.x*sin(angle)+offset.y*cos(angle));color+=texture2D(textureSampler,coords)*weight;return weight;}\nfloat getBlurLevel(float size) {return min(3.0,ceil(size/1.0));}\nvec4 getBlurColor(float size) {vec4 col=texture2D(textureSampler,distorted_coords);float blur_level=getBlurLevel(size);float w=(size/screen_width);float h=(size/screen_height);float total_weight=1.0;vec2 sample_coords;total_weight+=sampleScreen(col,vec2(-0.50*w,0.24*h),0.93);total_weight+=sampleScreen(col,vec2(0.30*w,-0.75*h),0.90);total_weight+=sampleScreen(col,vec2(0.36*w,0.96*h),0.87);total_weight+=sampleScreen(col,vec2(-1.08*w,-0.55*h),0.85);total_weight+=sampleScreen(col,vec2(1.33*w,-0.37*h),0.83);total_weight+=sampleScreen(col,vec2(-0.82*w,1.31*h),0.80);total_weight+=sampleScreen(col,vec2(-0.31*w,-1.67*h),0.78);total_weight+=sampleScreen(col,vec2(1.47*w,1.11*h),0.76);total_weight+=sampleScreen(col,vec2(-1.97*w,0.19*h),0.74);total_weight+=sampleScreen(col,vec2(1.42*w,-1.57*h),0.72);if (blur_level>1.0) {total_weight+=sampleScreen(col,vec2(0.01*w,2.25*h),0.70);total_weight+=sampleScreen(col,vec2(-1.62*w,-1.74*h),0.67);total_weight+=sampleScreen(col,vec2(2.49*w,0.20*h),0.65);total_weight+=sampleScreen(col,vec2(-2.07*w,1.61*h),0.63);total_weight+=sampleScreen(col,vec2(0.46*w,-2.70*h),0.61);total_weight+=sampleScreen(col,vec2(1.55*w,2.40*h),0.59);total_weight+=sampleScreen(col,vec2(-2.88*w,-0.75*h),0.56);total_weight+=sampleScreen(col,vec2(2.73*w,-1.44*h),0.54);total_weight+=sampleScreen(col,vec2(-1.08*w,3.02*h),0.52);total_weight+=sampleScreen(col,vec2(-1.28*w,-3.05*h),0.49);}\nif (blur_level>2.0) {total_weight+=sampleScreen(col,vec2(3.11*w,1.43*h),0.46);total_weight+=sampleScreen(col,vec2(-3.36*w,1.08*h),0.44);total_weight+=sampleScreen(col,vec2(1.80*w,-3.16*h),0.41);total_weight+=sampleScreen(col,vec2(0.83*w,3.65*h),0.38);total_weight+=sampleScreen(col,vec2(-3.16*w,-2.19*h),0.34);total_weight+=sampleScreen(col,vec2(3.92*w,-0.53*h),0.31);total_weight+=sampleScreen(col,vec2(-2.59*w,3.12*h),0.26);total_weight+=sampleScreen(col,vec2(-0.20*w,-4.15*h),0.22);total_weight+=sampleScreen(col,vec2(3.02*w,3.00*h),0.15);}\ncol/=total_weight; \nif (darken>0.0) {col.rgb*=clamp(0.3,1.0,1.05-size*0.5*darken);}\nreturn col;}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{centered_screen_pos=vec2(vUV.x-0.5,vUV.y-0.5);radius2=centered_screen_pos.x*centered_screen_pos.x+centered_screen_pos.y*centered_screen_pos.y;radius=sqrt(radius2);distorted_coords=getDistortedCoords(vUV); \nvec2 texels_coords=vec2(vUV.x*screen_width,vUV.y*screen_height); \nfloat depth=texture2D(depthSampler,distorted_coords).r; \nfloat distance=near+(far-near)*depth; \nvec4 color=texture2D(textureSampler,vUV); \nfloat coc=abs(aperture*(screen_distance*(inverse_focal_length-1.0/distance)-1.0));if (dof_enabled==false || coc<0.07) { coc=0.0; }\nfloat edge_blur_amount=0.0;if (edge_blur>0.0) {edge_blur_amount=clamp((radius*2.0-1.0+0.15*edge_blur)*1.5,0.0,1.0)*1.3;}\nfloat blur_amount=max(edge_blur_amount,coc);if (blur_amount==0.0) {gl_FragColor=texture2D(textureSampler,distorted_coords);}\nelse {gl_FragColor=getBlurColor(blur_amount*1.7);if (highlights) {gl_FragColor.rgb+=clamp(coc,0.0,1.0)*texture2D(highlightsSampler,distorted_coords).rgb;}\nif (blur_noise) {vec2 noise=rand(distorted_coords)*0.01*blur_amount;vec2 blurred_coord=vec2(distorted_coords.x+noise.x,distorted_coords.y+noise.y);gl_FragColor=0.04*texture2D(textureSampler,blurred_coord)+0.96*gl_FragColor;}}\nif (grain_amount>0.0) {vec4 grain_color=texture2D(grainSampler,texels_coords*0.003);gl_FragColor.rgb+=(-0.5+grain_color.rgb)*0.30*grain_amount;}}\n");var Aw=function(e){function t(t,n,r,i,o){void 0===i&&(i=1);var a=e.call(this,r.getEngine(),t)||this;return a.LensChromaticAberrationEffect="LensChromaticAberrationEffect",a.HighlightsEnhancingEffect="HighlightsEnhancingEffect",a.LensDepthOfFieldEffect="LensDepthOfFieldEffect",a._pentagonBokehIsEnabled=!1,a._scene=r,a._depthTexture=r.enableDepthRenderer().getDepthMap(),n.grain_texture?a._grainTexture=n.grain_texture:a._createGrainTexture(),a._edgeBlur=n.edge_blur?n.edge_blur:0,a._grainAmount=n.grain_amount?n.grain_amount:0,a._chromaticAberration=n.chromatic_aberration?n.chromatic_aberration:0,a._distortion=n.distortion?n.distortion:0,a._highlightsGain=void 0!==n.dof_gain?n.dof_gain:-1,a._highlightsThreshold=n.dof_threshold?n.dof_threshold:1,a._dofDistance=void 0!==n.dof_focus_distance?n.dof_focus_distance:-1,a._dofAperture=n.dof_aperture?n.dof_aperture:1,a._dofDarken=n.dof_darken?n.dof_darken:0,a._dofPentagon=void 0===n.dof_pentagon||n.dof_pentagon,a._blurNoise=void 0===n.blur_noise||n.blur_noise,a._createChromaticAberrationPostProcess(i),a._createHighlightsPostProcess(i),a._createDepthOfFieldPostProcess(i/4),a.addEffect(new XL(r.getEngine(),a.LensChromaticAberrationEffect,(function(){return a._chromaticAberrationPostProcess}),!0)),a.addEffect(new XL(r.getEngine(),a.HighlightsEnhancingEffect,(function(){return a._highlightsPostProcess}),!0)),a.addEffect(new XL(r.getEngine(),a.LensDepthOfFieldEffect,(function(){return a._depthOfFieldPostProcess}),!0)),-1===a._highlightsGain&&a._disableEffect(a.HighlightsEnhancingEffect,null),r.postProcessRenderPipelineManager.addPipeline(a),o&&r.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(t,o),a}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"LensRenderingPipeline"},Object.defineProperty(t.prototype,"scene",{get:function(){return this._scene},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"edgeBlur",{get:function(){return this._edgeBlur},set:function(e){this.setEdgeBlur(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"grainAmount",{get:function(){return this._grainAmount},set:function(e){this.setGrainAmount(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"chromaticAberration",{get:function(){return this._chromaticAberration},set:function(e){this.setChromaticAberration(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dofAperture",{get:function(){return this._dofAperture},set:function(e){this.setAperture(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"edgeDistortion",{get:function(){return this._distortion},set:function(e){this.setEdgeDistortion(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dofDistortion",{get:function(){return this._dofDistance},set:function(e){this.setFocusDistance(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"darkenOutOfFocus",{get:function(){return this._dofDarken},set:function(e){this.setDarkenOutOfFocus(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"blurNoise",{get:function(){return this._blurNoise},set:function(e){this._blurNoise=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pentagonBokeh",{get:function(){return this._pentagonBokehIsEnabled},set:function(e){e?this.enablePentagonBokeh():this.disablePentagonBokeh()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"highlightsGain",{get:function(){return this._highlightsGain},set:function(e){this.setHighlightsGain(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"highlightsThreshold",{get:function(){return this._highlightsThreshold},set:function(e){this.setHighlightsThreshold(e)},enumerable:!1,configurable:!0}),t.prototype.setEdgeBlur=function(e){this._edgeBlur=e},t.prototype.disableEdgeBlur=function(){this._edgeBlur=0},t.prototype.setGrainAmount=function(e){this._grainAmount=e},t.prototype.disableGrain=function(){this._grainAmount=0},t.prototype.setChromaticAberration=function(e){this._chromaticAberration=e},t.prototype.disableChromaticAberration=function(){this._chromaticAberration=0},t.prototype.setEdgeDistortion=function(e){this._distortion=e},t.prototype.disableEdgeDistortion=function(){this._distortion=0},t.prototype.setFocusDistance=function(e){this._dofDistance=e},t.prototype.disableDepthOfField=function(){this._dofDistance=-1},t.prototype.setAperture=function(e){this._dofAperture=e},t.prototype.setDarkenOutOfFocus=function(e){this._dofDarken=e},t.prototype.enablePentagonBokeh=function(){this._highlightsPostProcess.updateEffect("#define PENTAGON\n"),this._pentagonBokehIsEnabled=!0},t.prototype.disablePentagonBokeh=function(){this._pentagonBokehIsEnabled=!1,this._highlightsPostProcess.updateEffect()},t.prototype.enableNoiseBlur=function(){this._blurNoise=!0},t.prototype.disableNoiseBlur=function(){this._blurNoise=!1},t.prototype.setHighlightsGain=function(e){this._highlightsGain=e},t.prototype.setHighlightsThreshold=function(e){-1===this._highlightsGain&&(this._highlightsGain=1),this._highlightsThreshold=e},t.prototype.disableHighlights=function(){this._highlightsGain=-1},t.prototype.dispose=function(e){void 0===e&&(e=!1),this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name,this._scene.cameras),this._scene.postProcessRenderPipelineManager.removePipeline(this._name),this._chromaticAberrationPostProcess=null,this._highlightsPostProcess=null,this._depthOfFieldPostProcess=null,this._grainTexture.dispose(),e&&this._scene.disableDepthRenderer()},t.prototype._createChromaticAberrationPostProcess=function(e){var t=this;this._chromaticAberrationPostProcess=new Ci.w("LensChromaticAberration","chromaticAberration",["chromatic_aberration","screen_width","screen_height","direction","radialIntensity","centerPosition"],[],e,null,_n.g.TRILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1),this._chromaticAberrationPostProcess.onApply=function(e){e.setFloat("chromatic_aberration",t._chromaticAberration),e.setFloat("screen_width",t._scene.getEngine().getRenderWidth()),e.setFloat("screen_height",t._scene.getEngine().getRenderHeight()),e.setFloat("radialIntensity",1),e.setFloat2("direction",17,17),e.setFloat2("centerPosition",.5,.5)}},t.prototype._createHighlightsPostProcess=function(e){var t=this;this._highlightsPostProcess=new Ci.w("LensHighlights","lensHighlights",["gain","threshold","screen_width","screen_height"],[],e,null,_n.g.TRILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,this._dofPentagon?"#define PENTAGON\n":""),this._highlightsPostProcess.externalTextureSamplerBinding=!0,this._highlightsPostProcess.onApply=function(e){e.setFloat("gain",t._highlightsGain),e.setFloat("threshold",t._highlightsThreshold),e.setTextureFromPostProcess("textureSampler",t._chromaticAberrationPostProcess),e.setFloat("screen_width",t._scene.getEngine().getRenderWidth()),e.setFloat("screen_height",t._scene.getEngine().getRenderHeight())}},t.prototype._createDepthOfFieldPostProcess=function(e){var t=this;this._depthOfFieldPostProcess=new Ci.w("LensDepthOfField","depthOfField",["grain_amount","blur_noise","screen_width","screen_height","distortion","dof_enabled","screen_distance","aperture","darken","edge_blur","highlights","near","far"],["depthSampler","grainSampler","highlightsSampler"],e,null,_n.g.TRILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1),this._depthOfFieldPostProcess.externalTextureSamplerBinding=!0,this._depthOfFieldPostProcess.onApply=function(e){e.setTexture("depthSampler",t._depthTexture),e.setTexture("grainSampler",t._grainTexture),e.setTextureFromPostProcess("textureSampler",t._highlightsPostProcess),e.setTextureFromPostProcess("highlightsSampler",t._depthOfFieldPostProcess),e.setFloat("grain_amount",t._grainAmount),e.setBool("blur_noise",t._blurNoise),e.setFloat("screen_width",t._scene.getEngine().getRenderWidth()),e.setFloat("screen_height",t._scene.getEngine().getRenderHeight()),e.setFloat("distortion",t._distortion),e.setBool("dof_enabled",-1!==t._dofDistance),e.setFloat("screen_distance",1/(.1-1/t._dofDistance)),e.setFloat("aperture",t._dofAperture),e.setFloat("darken",t._dofDarken),e.setFloat("edge_blur",t._edgeBlur),e.setBool("highlights",-1!==t._highlightsGain),t._scene.activeCamera&&(e.setFloat("near",t._scene.activeCamera.minZ),e.setFloat("far",t._scene.activeCamera.maxZ))}},t.prototype._createGrainTexture=function(){for(var e=new Uint8Array(1048576),t=0;t0?n:o,i._thinSSAORenderingPipeline._ssaoBlurYPostProcess.textureSize=n>0?n:o,i._geometryBufferRenderer?e.setTexture("depthSampler",i._geometryBufferRenderer.getGBuffer().textures[0]):i._prePassRenderer&&e.setTexture("depthSampler",i._prePassRenderer.getRenderTarget().textures[i._prePassRenderer.getIndex(b.Y.PREPASS_DEPTH_TEXTURE_TYPE)])},o.samples=this.textureSamples,o.autoClear=!1,o},t.prototype._getTextureSize=function(){var e,t=this._scene.getEngine(),n=this._prePassRenderer,r={width:t.getRenderWidth(),height:t.getRenderHeight()};if(n&&(null===(e=this._scene.activeCamera)||void 0===e?void 0:e._getFirstPostProcess())===this._ssaoPostProcess){var i=n.getRenderTarget();i&&i.textures&&(r=i.textures[n.getIndex(b.Y.PREPASS_COLOR_TEXTURE_TYPE)].getSize())}else this._ssaoPostProcess.inputTexture&&(r.width=this._ssaoPostProcess.inputTexture.width,r.height=this._ssaoPostProcess.inputTexture.height);return r},t.prototype._createSSAOPostProcess=function(e,t){var n=this;this._ssaoPostProcess=new Ci.w("ssao",Fm.FragmentUrl,{size:e,samplingMode:b.Y.TEXTURE_BILINEAR_SAMPLINGMODE,engine:this._scene.getEngine(),textureType:t,effectWrapper:this._thinSSAORenderingPipeline._ssaoPostProcess}),this._ssaoPostProcess.autoClear=!1,this._ssaoPostProcess.onApply=function(e){n._thinSSAORenderingPipeline._ssaoPostProcess.camera=n._scene.activeCamera,n._geometryBufferRenderer?(e.setTexture("depthSampler",n._geometryBufferRenderer.getGBuffer().textures[0]),e.setTexture("normalSampler",n._geometryBufferRenderer.getGBuffer().textures[1])):n._prePassRenderer&&(e.setTexture("depthSampler",n._prePassRenderer.getRenderTarget().textures[n._prePassRenderer.getIndex(b.Y.PREPASS_DEPTH_TEXTURE_TYPE)]),e.setTexture("normalSampler",n._prePassRenderer.getRenderTarget().textures[n._prePassRenderer.getIndex(b.Y.PREPASS_NORMAL_TEXTURE_TYPE)]));var t=n._getTextureSize();n._thinSSAORenderingPipeline._ssaoPostProcess.textureWidth=t.width,n._thinSSAORenderingPipeline._ssaoPostProcess.textureHeight=t.height},this._ssaoPostProcess.samples=this.textureSamples,this._forceGeometryBuffer||(this._ssaoPostProcess._prePassEffectConfiguration=new Iw)},t.prototype._createSSAOCombinePostProcess=function(e,t){var n=this;this._ssaoCombinePostProcess=new Ci.w("ssaoCombine",wm.FragmentUrl,{size:e,samplingMode:b.Y.TEXTURE_BILINEAR_SAMPLINGMODE,engine:this._scene.getEngine(),textureType:t,effectWrapper:this._thinSSAORenderingPipeline._ssaoCombinePostProcess}),this._ssaoCombinePostProcess.onApply=function(e){n._thinSSAORenderingPipeline._ssaoCombinePostProcess.camera=n._scene.activeCamera,e.setTextureFromPostProcessOutput("originalColor",n._originalColorPostProcess)},this._ssaoCombinePostProcess.autoClear=!1,this._ssaoCombinePostProcess.samples=this.textureSamples},t.prototype.serialize=function(){var e=Te.p.Serialize(this);return e.customType="SSAO2RenderingPipeline",e},t.Parse=function(e,n,r){return Te.p.Parse((function(){return new t(e._name,n,e._ratio,void 0,e._forceGeometryBuffer,e._textureType)}),e,n,r)},(0,f.Cg)([(0,ce.lK)()],t.prototype,"totalStrength",null),(0,f.Cg)([(0,ce.lK)()],t.prototype,"maxZ",null),(0,f.Cg)([(0,ce.lK)()],t.prototype,"minZAspect",null),(0,f.Cg)([(0,ce.lK)("epsilon")],t.prototype,"epsilon",null),(0,f.Cg)([(0,ce.lK)("samples")],t.prototype,"samples",null),(0,f.Cg)([(0,ce.lK)("textureSamples")],t.prototype,"_textureSamples",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"_forceGeometryBuffer",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"_ratio",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"_textureType",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"radius",null),(0,f.Cg)([(0,ce.lK)()],t.prototype,"base",null),(0,f.Cg)([(0,ce.lK)("bypassBlur")],t.prototype,"bypassBlur",null),(0,f.Cg)([(0,ce.lK)("expensiveBlur")],t.prototype,"expensiveBlur",null),(0,f.Cg)([(0,ce.lK)()],t.prototype,"bilateralSamples",null),(0,f.Cg)([(0,ce.lK)()],t.prototype,"bilateralSoften",null),(0,f.Cg)([(0,ce.lK)()],t.prototype,"bilateralTolerance",null),t}(Sw);(0,h.Y5)("BABYLON.SSAO2RenderingPipeline",Ow);var Mw="ssaoPixelShader";Bi.l.ShadersStore[Mw]||(Bi.l.ShadersStore[Mw]="uniform sampler2D textureSampler;varying vec2 vUV;\n#ifdef SSAO\nuniform sampler2D randomSampler;uniform float randTextureTiles;uniform float samplesFactor;uniform vec3 sampleSphere[SAMPLES];uniform float totalStrength;uniform float radius;uniform float area;uniform float fallOff;uniform float base;vec3 normalFromDepth(float depth,vec2 coords)\n{vec2 offset1=vec2(0.0,radius);vec2 offset2=vec2(radius,0.0);float depth1=texture2D(textureSampler,coords+offset1).r;float depth2=texture2D(textureSampler,coords+offset2).r;vec3 p1=vec3(offset1,depth1-depth);vec3 p2=vec3(offset2,depth2-depth);vec3 normal=cross(p1,p2);normal.z=-normal.z;return normalize(normal);}\nvoid main()\n{vec3 random=normalize(texture2D(randomSampler,vUV*randTextureTiles).rgb);float depth=texture2D(textureSampler,vUV).r;vec3 position=vec3(vUV,depth);vec3 normal=normalFromDepth(depth,vUV);float radiusDepth=radius/depth;float occlusion=0.0;vec3 ray;vec3 hemiRay;float occlusionDepth;float difference;for (int i=0; i0.0)\nhitCoord-=dir;else\nhitCoord+=dir;info.color+=texture2D(textureSampler,projectedCoord.xy).rgb;}\nprojectedCoord=projection*vec4(hitCoord,1.0);projectedCoord.xy/=projectedCoord.w;projectedCoord.xy=0.5*projectedCoord.xy+vec2(0.5);info.coords=vec4(projectedCoord.xy,sampledDepth,1.0);info.color+=texture2D(textureSampler,projectedCoord.xy).rgb;info.color/=float(SMOOTH_STEPS+1);return info;}\n/**\n* Tests the given world position (hitCoord) according to the given reflection vector (dir)\n* until it finds a collision (means that depth is enough close to say \"it's the pixel to sample!\").\n*/\nReflectionInfo getReflectionInfo(vec3 dir,vec3 hitCoord)\n{ReflectionInfo info;vec4 projectedCoord;float sampledDepth;dir*=stepSize;for(int i=0; i1&&y.V.Warn("MSAA failed to enable, MSAA is only supported in browsers that support webGL >= 2.0")},t.prototype._createDownSampleX4PostProcess=function(e,t){var n=this,r=new Array(32);this.downSampleX4PostProcess=new Ci.w("HDRDownSampleX4","standard",["dsOffsets"],[],t,null,_n.g.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define DOWN_SAMPLE_X4",this._floatTextureType),this.downSampleX4PostProcess.onApply=function(e){for(var t=0,i=n.downSampleX4PostProcess.width,o=n.downSampleX4PostProcess.height,a=-2;a<2;a++)for(var s=-2;s<2;s++)r[t]=(a+.5)*(1/i),r[t+1]=(s+.5)*(1/o),t+=2;e.setArray2("dsOffsets",r)},this.addEffect(new XL(e.getEngine(),"HDRDownSampleX4",(function(){return n.downSampleX4PostProcess}),!0))},t.prototype._createBrightPassPostProcess=function(e,t){var n=this,r=new Array(8);this.brightPassPostProcess=new Ci.w("HDRBrightPass","standard",["dsOffsets","brightThreshold"],[],t,null,_n.g.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define BRIGHT_PASS",this._floatTextureType),this.brightPassPostProcess.onApply=function(e){var t=1/n.brightPassPostProcess.width,i=1/n.brightPassPostProcess.height;r[0]=-.5*t,r[1]=.5*i,r[2]=.5*t,r[3]=.5*i,r[4]=-.5*t,r[5]=-.5*i,r[6]=.5*t,r[7]=-.5*i,e.setArray2("dsOffsets",r),e.setFloat("brightThreshold",n.brightThreshold)},this.addEffect(new XL(e.getEngine(),"HDRBrightPass",(function(){return n.brightPassPostProcess}),!0))},t.prototype._createBlurPostProcesses=function(e,t,n,r){var i=this;void 0===r&&(r="blurWidth");var o=e.getEngine(),a=new W_.j("HDRBlurH_"+n,new c.I9(1,0),this[r],t,null,_n.g.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,this._floatTextureType),s=new W_.j("HDRBlurV_"+n,new c.I9(0,1),this[r],t,null,_n.g.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,this._floatTextureType);a.onActivateObservable.add((function(){var e=a.width/o.getRenderWidth();a.kernel=i[r]*e})),s.onActivateObservable.add((function(){var e=s.height/o.getRenderHeight();s.kernel=i.horizontalBlur?64*e:i[r]*e})),this.addEffect(new XL(e.getEngine(),"HDRBlurH"+n,(function(){return a}),!0)),this.addEffect(new XL(e.getEngine(),"HDRBlurV"+n,(function(){return s}),!0)),this.blurHPostProcesses.push(a),this.blurVPostProcesses.push(s)},t.prototype._createTextureAdderPostProcess=function(e,t){var n=this;this.textureAdderPostProcess=new Ci.w("HDRTextureAdder","standard",["exposure"],["otherSampler","lensSampler"],t,null,_n.g.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define TEXTURE_ADDER",this._floatTextureType),this.textureAdderPostProcess.onApply=function(e){e.setTextureFromPostProcess("otherSampler",n._vlsEnabled?n._currentDepthOfFieldSource:n.originalPostProcess),e.setTexture("lensSampler",n.lensTexture),e.setFloat("exposure",n._currentExposure),n._currentDepthOfFieldSource=n.textureAdderFinalPostProcess},this.addEffect(new XL(e.getEngine(),"HDRTextureAdder",(function(){return n.textureAdderPostProcess}),!0))},t.prototype._createVolumetricLightPostProcess=function(e,t){var n=this,r=e.enableGeometryBufferRenderer();r.enablePosition=!0;var i=r.getGBuffer();this.volumetricLightPostProcess=new Ci.w("HDRVLS","standard",["shadowViewProjection","cameraPosition","sunDirection","sunColor","scatteringCoefficient","scatteringPower","depthValues"],["shadowMapSampler","positionSampler"],t/8,null,_n.g.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define VLS\n#define NB_STEPS "+this._volumetricLightStepsCount.toFixed(1));var o=c.I9.Zero();this.volumetricLightPostProcess.onApply=function(e){if(n.sourceLight&&n.sourceLight.getShadowGenerator()&&n._scene.activeCamera){var t=n.sourceLight.getShadowGenerator();e.setTexture("shadowMapSampler",t.getShadowMap()),e.setTexture("positionSampler",i.textures[2]),e.setColor3("sunColor",n.sourceLight.diffuse),e.setVector3("sunDirection",n.sourceLight.getShadowDirection()),e.setVector3("cameraPosition",n._scene.activeCamera.globalPosition),e.setMatrix("shadowViewProjection",t.getTransformMatrix()),e.setFloat("scatteringCoefficient",n.volumetricLightCoefficient),e.setFloat("scatteringPower",n.volumetricLightPower),o.x=n.sourceLight.getDepthMinZ(n._scene.activeCamera),o.y=n.sourceLight.getDepthMaxZ(n._scene.activeCamera),e.setVector2("depthValues",o)}},this.addEffect(new XL(e.getEngine(),"HDRVLS",(function(){return n.volumetricLightPostProcess}),!0)),this._createBlurPostProcesses(e,t/4,0,"volumetricLightBlurScale"),this.volumetricLightMergePostProces=new Ci.w("HDRVLSMerge","standard",[],["originalSampler"],t,null,_n.g.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define VLSMERGE"),this.volumetricLightMergePostProces.onApply=function(e){e.setTextureFromPostProcess("originalSampler",n._bloomEnabled?n.textureAdderFinalPostProcess:n.originalPostProcess),n._currentDepthOfFieldSource=n.volumetricLightFinalPostProcess},this.addEffect(new XL(e.getEngine(),"HDRVLSMerge",(function(){return n.volumetricLightMergePostProces}),!0))},t.prototype._createLuminancePostProcesses=function(e,n){var r=this,i=Math.pow(3,t.LuminanceSteps);this.luminancePostProcess=new Ci.w("HDRLuminance","standard",["lumOffsets"],[],{width:i,height:i},null,_n.g.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define LUMINANCE",n);var o=[];this.luminancePostProcess.onApply=function(e){var t=1/r.luminancePostProcess.width,n=1/r.luminancePostProcess.height;o[0]=-.5*t,o[1]=.5*n,o[2]=.5*t,o[3]=.5*n,o[4]=-.5*t,o[5]=-.5*n,o[6]=.5*t,o[7]=-.5*n,e.setArray2("lumOffsets",o)},this.addEffect(new XL(e.getEngine(),"HDRLuminance",(function(){return r.luminancePostProcess}),!0));for(var a=t.LuminanceSteps-1;a>=0;a--){i=Math.pow(3,a);var s="#define LUMINANCE_DOWN_SAMPLE\n";0===a&&(s+="#define FINAL_DOWN_SAMPLER");var l=new Ci.w("HDRLuminanceDownSample"+a,"standard",["dsOffsets","halfDestPixelSize"],[],{width:i,height:i},null,_n.g.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,s,n);this.luminanceDownSamplePostProcesses.push(l)}for(var u=this.luminancePostProcess,h=function(t){var n=d.luminanceDownSamplePostProcesses[t],i=new Array(18);n.onApply=function(e){if(u){for(var o=0,a=-1;a<2;a++)for(var s=-1;s<2;s++)i[o]=a/u.width,i[o+1]=s/u.height,o+=2;e.setArray2("dsOffsets",i),e.setFloat("halfDestPixelSize",.5/u.width),u=t===r.luminanceDownSamplePostProcesses.length-1?r.luminancePostProcess:n}},t===d.luminanceDownSamplePostProcesses.length-1&&(n.onAfterRender=function(){var t=e.getEngine().readPixels(0,0,1,1),n=new c.IU(1/16581375,1/65025,1/255,1);t.then((function(e){var t=new Uint8Array(e.buffer);r._hdrCurrentLuminance=(t[0]*n.x+t[1]*n.y+t[2]*n.z+t[3]*n.w)/100}))}),d.addEffect(new XL(e.getEngine(),"HDRLuminanceDownSample"+t,(function(){return n}),!0))},d=this,p=0;pi-n.hdrIncreaseRate*r?i-=n.hdrIncreaseRate*r:i=n._hdrCurrentLuminance}n.hdrAutoExposure?n._currentExposure=n._fixedExposure/i:(i=(0,lr.Clamp)(i,n.hdrMinimumLuminance,1e20),t.setFloat("averageLuminance",i)),a=o,n._currentDepthOfFieldSource=n.hdrFinalPostProcess},this.addEffect(new XL(e.getEngine(),"HDR",(function(){return n.hdrPostProcess}),!0))},t.prototype._createLensFlarePostProcess=function(e,t){var n=this;this.lensFlarePostProcess=new Ci.w("HDRLensFlare","standard",["strength","ghostDispersal","haloWidth","resolution","distortionStrength"],["lensColorSampler"],t/2,null,_n.g.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define LENS_FLARE",b.Y.TEXTURETYPE_UNSIGNED_BYTE),this.addEffect(new XL(e.getEngine(),"HDRLensFlare",(function(){return n.lensFlarePostProcess}),!0)),this._createBlurPostProcesses(e,t/4,2,"lensFlareBlurWidth"),this.lensFlareComposePostProcess=new Ci.w("HDRLensFlareCompose","standard",["lensStarMatrix"],["otherSampler","lensDirtSampler","lensStarSampler"],t,null,_n.g.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define LENS_FLARE_COMPOSE",b.Y.TEXTURETYPE_UNSIGNED_BYTE),this.addEffect(new XL(e.getEngine(),"HDRLensFlareCompose",(function(){return n.lensFlareComposePostProcess}),!0));var r=new c.I9(0,0);this.lensFlarePostProcess.externalTextureSamplerBinding=!0,this.lensFlarePostProcess.onApply=function(e){e.setTextureFromPostProcess("textureSampler",n._bloomEnabled?n.blurHPostProcesses[0]:n.originalPostProcess),e.setTexture("lensColorSampler",n.lensColorTexture),e.setFloat("strength",n.lensFlareStrength),e.setFloat("ghostDispersal",n.lensFlareGhostDispersal),e.setFloat("haloWidth",n.lensFlareHaloWidth),r.x=n.lensFlarePostProcess.width,r.y=n.lensFlarePostProcess.height,e.setVector2("resolution",r),e.setFloat("distortionStrength",n.lensFlareDistortionStrength)};var i=c.uq.FromValues(2,0,-1,0,0,2,-1,0,0,0,1,0,0,0,0,1),o=c.uq.FromValues(.5,0,.5,0,0,.5,.5,0,0,0,1,0,0,0,0,1);this.lensFlareComposePostProcess.onApply=function(e){if(n._scene.activeCamera){e.setTextureFromPostProcess("otherSampler",n.lensFlarePostProcess),e.setTexture("lensDirtSampler",n.lensFlareDirtTexture),e.setTexture("lensStarSampler",n.lensStarTexture);var t=n._scene.activeCamera.getViewMatrix().getRow(0),r=n._scene.activeCamera.getViewMatrix().getRow(2),a=c.Pq.Dot(t.toVector3(),new c.Pq(1,0,0))+c.Pq.Dot(r.toVector3(),new c.Pq(0,0,1));a*=4;var s=c.uq.FromValues(.5*Math.cos(a),-Math.sin(a),0,0,Math.sin(a),.5*Math.cos(a),0,0,0,0,1,0,0,0,0,1),l=o.multiply(s).multiply(i);e.setMatrix("lensStarMatrix",l),n._currentDepthOfFieldSource=n.lensFlareFinalPostProcess}}},t.prototype._createDepthOfFieldPostProcess=function(e,t){var n=this;this.depthOfFieldPostProcess=new Ci.w("HDRDepthOfField","standard",["distance"],["otherSampler","depthSampler"],t,null,_n.g.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define DEPTH_OF_FIELD",b.Y.TEXTURETYPE_UNSIGNED_BYTE),this.depthOfFieldPostProcess.onApply=function(e){e.setTextureFromPostProcess("otherSampler",n._currentDepthOfFieldSource),e.setTexture("depthSampler",n._getDepthTexture()),e.setFloat("distance",n.depthOfFieldDistance)},this.addEffect(new XL(e.getEngine(),"HDRDepthOfField",(function(){return n.depthOfFieldPostProcess}),!0))},t.prototype._createMotionBlurPostProcess=function(e,t){var n=this;if(this._isObjectBasedMotionBlur){var r=new mw("HDRMotionBlur",e,t,null,_n.g.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,b.Y.TEXTURETYPE_UNSIGNED_BYTE);r.motionStrength=this.motionStrength,r.motionBlurSamples=this.motionBlurSamples,this.motionBlurPostProcess=r}else{this.motionBlurPostProcess=new Ci.w("HDRMotionBlur","standard",["inverseViewProjection","prevViewProjection","screenSize","motionScale","motionStrength"],["depthSampler"],t,null,_n.g.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define MOTION_BLUR\n#define MAX_MOTION_SAMPLES "+this.motionBlurSamples.toFixed(1),b.Y.TEXTURETYPE_UNSIGNED_BYTE);var i=0,o=c.uq.Identity(),a=c.uq.Identity(),s=c.uq.Identity(),l=c.I9.Zero();this.motionBlurPostProcess.onApply=function(t){(s=e.getProjectionMatrix().multiply(e.getViewMatrix())).invertToRef(a),t.setMatrix("inverseViewProjection",a),t.setMatrix("prevViewProjection",o),o=s,l.x=n.motionBlurPostProcess.width,l.y=n.motionBlurPostProcess.height,t.setVector2("screenSize",l),i=e.getEngine().getFps()/60,t.setFloat("motionScale",i),t.setFloat("motionStrength",n.motionStrength),t.setTexture("depthSampler",n._getDepthTexture())}}this.addEffect(new XL(e.getEngine(),"HDRMotionBlur",(function(){return n.motionBlurPostProcess}),!0))},t.prototype._getDepthTexture=function(){return this._scene.getEngine().getCaps().drawBuffersExtension?this._scene.enableGeometryBufferRenderer().getGBuffer().textures[0]:this._scene.enableDepthRenderer().getDepthMap()},t.prototype._disposePostProcesses=function(){for(var e=0;e0},Object.defineProperty(t.prototype,"blurDownsample",{get:function(){return this._thinSSRRenderingPipeline.blurDownsample},set:function(e){this._thinSSRRenderingPipeline.blurDownsample=e,this._buildPipeline()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableSmoothReflections",{get:function(){return this._thinSSRRenderingPipeline.enableSmoothReflections},set:function(e){this._thinSSRRenderingPipeline.enableSmoothReflections=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_useScreenspaceDepth",{get:function(){return this._thinSSRRenderingPipeline.useScreenspaceDepth},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"environmentTexture",{get:function(){return this._thinSSRRenderingPipeline.environmentTexture},set:function(e){this._thinSSRRenderingPipeline.environmentTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"environmentTextureIsProbe",{get:function(){return this._thinSSRRenderingPipeline.environmentTextureIsProbe},set:function(e){this._thinSSRRenderingPipeline.environmentTextureIsProbe=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"attenuateScreenBorders",{get:function(){return this._thinSSRRenderingPipeline.attenuateScreenBorders},set:function(e){this._thinSSRRenderingPipeline.attenuateScreenBorders=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"attenuateIntersectionDistance",{get:function(){return this._thinSSRRenderingPipeline.attenuateIntersectionDistance},set:function(e){this._thinSSRRenderingPipeline.attenuateIntersectionDistance=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"attenuateIntersectionIterations",{get:function(){return this._thinSSRRenderingPipeline.attenuateIntersectionIterations},set:function(e){this._thinSSRRenderingPipeline.attenuateIntersectionIterations=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"attenuateFacingCamera",{get:function(){return this._thinSSRRenderingPipeline.attenuateFacingCamera},set:function(e){this._thinSSRRenderingPipeline.attenuateFacingCamera=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"attenuateBackfaceReflection",{get:function(){return this._thinSSRRenderingPipeline.attenuateBackfaceReflection},set:function(e){this._thinSSRRenderingPipeline.attenuateBackfaceReflection=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clipToFrustum",{get:function(){return this._thinSSRRenderingPipeline.clipToFrustum},set:function(e){this._thinSSRRenderingPipeline.clipToFrustum=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"useFresnel",{get:function(){return this._thinSSRRenderingPipeline.useFresnel},set:function(e){this._thinSSRRenderingPipeline.useFresnel=e,this._buildPipeline()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableAutomaticThicknessComputation",{get:function(){return this._thinSSRRenderingPipeline.enableAutomaticThicknessComputation},set:function(e){this._thinSSRRenderingPipeline.enableAutomaticThicknessComputation=e,this._buildPipeline()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"backfaceDepthRenderer",{get:function(){return this._depthRenderer},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"backfaceDepthTextureDownsample",{get:function(){return this._backfaceDepthTextureDownsample},set:function(e){this._backfaceDepthTextureDownsample!==e&&(this._backfaceDepthTextureDownsample=e,this._resizeDepthRenderer())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"backfaceForceDepthWriteTransparentMeshes",{get:function(){return this._backfaceForceDepthWriteTransparentMeshes},set:function(e){this._backfaceForceDepthWriteTransparentMeshes!==e&&(this._backfaceForceDepthWriteTransparentMeshes=e,this._depthRenderer&&(this._depthRenderer.forceDepthWriteTransparentMeshes=e))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isEnabled",{get:function(){return this._isEnabled},set:function(e){this._isEnabled!==e&&(this._isEnabled=e,e?e&&(this._isDirty?this._buildPipeline():null!==this._cameras&&this._scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(this._name,this._cameras)):null!==this._cameras&&(this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name,this._cameras),this._cameras=this._camerasToBeAttached.slice()))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"inputTextureColorIsInGammaSpace",{get:function(){return this._thinSSRRenderingPipeline.inputTextureColorIsInGammaSpace},set:function(e){this._thinSSRRenderingPipeline.inputTextureColorIsInGammaSpace=e,this._buildPipeline()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"generateOutputInGammaSpace",{get:function(){return this._thinSSRRenderingPipeline.generateOutputInGammaSpace},set:function(e){this._thinSSRRenderingPipeline.generateOutputInGammaSpace=e,this._buildPipeline()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"debug",{get:function(){return this._thinSSRRenderingPipeline.debug},set:function(e){this._thinSSRRenderingPipeline.debug=e,this._buildPipeline()},enumerable:!1,configurable:!0}),t.prototype.getScene=function(){return this._scene},Object.defineProperty(t.prototype,"_geometryBufferRenderer",{get:function(){return this._forceGeometryBuffer?this._scene.geometryBufferRenderer:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_prePassRenderer",{get:function(){return this._forceGeometryBuffer?null:this._scene.prePassRenderer},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scene",{get:function(){return this._scene},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isSupported",{get:function(){var e=this._scene.getEngine().getCaps();return e.drawBuffersExtension&&e.texelFetch},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"SSRRenderingPipeline"},t.prototype.addCamera=function(e){this._camerasToBeAttached.push(e),this._buildPipeline()},t.prototype.removeCamera=function(e){var t=this._camerasToBeAttached.indexOf(e);this._camerasToBeAttached.splice(t,1),this._buildPipeline()},t.prototype.dispose=function(t){void 0===t&&(t=!1),this._disposeDepthRenderer(),this._disposeSSRPostProcess(),this._disposeBlurPostProcesses(),t&&this._scene.disableGeometryBufferRenderer(),this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name,this._cameras),this._scene.postProcessRenderPipelineManager.removePipeline(this._name),this._thinSSRRenderingPipeline.dispose(),e.prototype.dispose.call(this)},t.prototype._getTextureSize=function(){var e,t,n=this._scene.getEngine(),r=this._prePassRenderer,i={width:n.getRenderWidth(),height:n.getRenderHeight()};if(r&&(null===(e=this._scene.activeCamera)||void 0===e?void 0:e._getFirstPostProcess())===this._ssrPostProcess){var o=r.getRenderTarget();o&&o.textures&&(i=o.textures[r.getIndex(b.Y.PREPASS_COLOR_TEXTURE_TYPE)].getSize())}else(null===(t=this._ssrPostProcess)||void 0===t?void 0:t.inputTexture)&&(i.width=this._ssrPostProcess.inputTexture.width,i.height=this._ssrPostProcess.inputTexture.height);return i},t.prototype._buildPipeline=function(){var e,t,n,r,i=this;if(this.isSupported)if(this._isEnabled){this._isDirty=!1;var o=this._scene.getEngine();if(this._disposeDepthRenderer(),null!==this._cameras&&(this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name,this._cameras),this._cameras=this._camerasToBeAttached.slice(),this._cameras.length>0&&(this._thinSSRRenderingPipeline.camera=this._cameras[0])),this._reset(),this._thinSSRRenderingPipeline.normalsAreInWorldSpace=!!(null!==(t=null===(e=this._geometryBufferRenderer)||void 0===e?void 0:e.generateNormalsInWorldSpace)&&void 0!==t?t:null===(n=this._prePassRenderer)||void 0===n?void 0:n.generateNormalsInWorldSpace),this.enableAutomaticThicknessComputation){var a=null===(r=this._cameras)||void 0===r?void 0:r[0];a&&(this._depthRendererCamera=a,this._depthRenderer=new Gw.d(this._scene,void 0,void 0,this._useScreenspaceDepth,b.Y.TEXTURE_NEAREST_SAMPLINGMODE,!this._useScreenspaceDepth,"SSRBackDepth"),this._depthRenderer.reverseCulling=!0,this._depthRenderer.forceDepthWriteTransparentMeshes=this.backfaceForceDepthWriteTransparentMeshes,this._resizeDepthRenderer(),a.customRenderTargets.push(this._depthRenderer.getDepthMap()))}this.addEffect(new XL(o,this.SSRRenderEffect,(function(){return i._ssrPostProcess}),!0)),this._disposeBlurPostProcesses(),this._useBlur()&&(this._createBlurAndCombinerPostProcesses(),this.addEffect(new XL(o,this.SSRBlurRenderEffect,(function(){return[i._blurPostProcessX,i._blurPostProcessY]}),!0)),this.addEffect(new XL(o,this.SSRCombineRenderEffect,(function(){return i._blurCombinerPostProcess}),!0))),null!==this._cameras&&this._scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(this._name,this._cameras)}else this._isDirty=!0},t.prototype._resizeDepthRenderer=function(){if(this._depthRenderer){var e=this._getTextureSize(),t=this._depthRenderer.getDepthMap().getSize(),n=Math.floor(e.width/(this.backfaceDepthTextureDownsample+1)),r=Math.floor(e.height/(this.backfaceDepthTextureDownsample+1));t.width===n&&t.height===r||this._depthRenderer.getDepthMap().resize({width:n,height:r})}},t.prototype._disposeDepthRenderer=function(){var e;if(this._depthRenderer){if(this._depthRendererCamera){var t=null!==(e=this._depthRendererCamera.customRenderTargets.indexOf(this._depthRenderer.getDepthMap()))&&void 0!==e?e:-1;-1!==t&&this._depthRendererCamera.customRenderTargets.splice(t,1)}this._depthRendererCamera=null,this._depthRenderer.getDepthMap().dispose()}this._depthRenderer=null},t.prototype._disposeBlurPostProcesses=function(){for(var e,t,n,r=0;r4&&(a.push(se.R.MatricesIndicesExtraKind),a.push(se.R.MatricesWeightsExtraKind)),o.push("#define NUM_BONE_INFLUENCERS "+r.numBoneInfluencers),r.numBoneInfluencers>0&&h.addCPUSkinningFallback(0,r);var d=r.skeleton;d.isUsingTextureForMatrices?o.push("#define BONETEXTURE"):o.push("#define BonesPerMesh "+(d.bones.length+1))}else o.push("#define NUM_BONE_INFLUENCERS 0");var p=r.morphTargetManager?(0,Le.Dk)(r.morphTargetManager,o,a,r,!0,!1,!1,l,c,!1):0;t&&(o.push("#define INSTANCES"),(0,Le.te)(a),e.getRenderingMesh().hasThinInstances&&o.push("#define THIN_INSTANCES"));var f=r.bakedVertexAnimationManager;f&&f.isEnabled&&(o.push("#define BAKED_VERTEX_ANIMATION_TEXTURE"),t&&a.push("bakedVertexAnimationSettingsInstanced"));var m=e._getDrawWrapper(void 0,!0),_=m.defines,g=o.join("\n");return _!==g&&m.setEffect(r.getScene().getEngine().createEffect("volumetricLightScatteringPass",{attributes:a,uniformsNames:["world","mBones","boneTextureWidth","viewProjection","diffuseMatrix","morphTargetInfluences","morphTargetCount","morphTargetTextureInfo","morphTargetTextureIndices","bakedVertexAnimationSettings","bakedVertexAnimationTextureSizeInverted","bakedVertexAnimationTime","bakedVertexAnimationTexture"],uniformBuffersNames:[],samplers:["diffuseSampler","morphTargets","boneSampler","bakedVertexAnimationTexture"],defines:g,fallbacks:h,onCompiled:null,onError:null,indexParameters:{maxSimultaneousMorphTargets:p}},r.getScene().getEngine()),g),m.effect.isReady()},t.prototype.setCustomMeshPosition=function(e){this.customMeshPosition=e},t.prototype.getCustomMeshPosition=function(){return this.customMeshPosition},t.prototype.dispose=function(t){var n=t.getScene().customRenderTargets.indexOf(this._volumetricLightScatteringRTT);-1!==n&&t.getScene().customRenderTargets.splice(n,1),this._volumetricLightScatteringRTT.dispose(),e.prototype.dispose.call(this,t)},t.prototype.getPass=function(){return this._volumetricLightScatteringRTT},t.prototype._meshExcluded=function(e){return this.includedMeshes.length>0&&-1===this.includedMeshes.indexOf(e)||this.excludedMeshes.length>0&&-1!==this.excludedMeshes.indexOf(e)},t.prototype._createPass=function(e,t){var n=this,r=e.getEngine();this._volumetricLightScatteringRTT=new Ji.$("volumetricLightScatteringMap",{width:r.getRenderWidth()*t,height:r.getRenderHeight()*t},e,!1,!0,b.Y.TEXTURETYPE_UNSIGNED_BYTE),this._volumetricLightScatteringRTT.wrapU=_n.g.CLAMP_ADDRESSMODE,this._volumetricLightScatteringRTT.wrapV=_n.g.CLAMP_ADDRESSMODE,this._volumetricLightScatteringRTT.renderList=null,this._volumetricLightScatteringRTT.renderParticles=!1,this._volumetricLightScatteringRTT.ignoreCameraViewport=!0;var i=this.getCamera();i?i.customRenderTargets.push(this._volumetricLightScatteringRTT):e.customRenderTargets.push(this._volumetricLightScatteringRTT);var o,a=function(e){var t,r=e.getRenderingMesh(),i=e.getEffectiveMesh();if(!n._meshExcluded(r)){i._internalAbstractMeshDataInfo._isActiveIntermediate=!1;var o=e.getMaterial();if(o){var a=r.getScene(),s=a.getEngine();s.setState(o.backFaceCulling,void 0,void 0,void 0,o.cullBackFaces);var l=r._getInstancesRenderList(e._id,!!e.getReplacementMesh());if(!l.mustReturn){var c=s.getCaps().instancedArrays&&(null!==l.visibleInstances[e._id]||r.hasThinInstances);if(n._isReady(e,c)){var u=null===(t=i._internalAbstractMeshDataInfo._materialForRenderPass)||void 0===t?void 0:t[s.currentRenderPassId],h=e._getDrawWrapper();if(r!==n.mesh||h||(h=o._getDrawWrapper()),!h)return;var d=h.effect;if(s.enableEffect(h),c||r._bind(e,d,o.fillMode),r===n.mesh)o.bind(i.getWorldMatrix(),r);else if(u)u.bindForSubMesh(i.getWorldMatrix(),i,e);else{if(d.setMatrix("viewProjection",a.getTransformMatrix()),o.needAlphaTestingForMesh(i)){var p=o.getAlphaTestTexture();p&&(d.setTexture("diffuseSampler",p),d.setMatrix("diffuseMatrix",p.getTextureMatrix()))}(0,Le.f$)(r,d),(0,Le.nR)(r,d),r.morphTargetManager&&r.morphTargetManager.isUsingTextureForTargets&&r.morphTargetManager._bind(d);var f=e.getMesh().bakedVertexAnimationManager;f&&f.isEnabled&&f.bind(d,c)}c&&r.hasThinInstances&&d.setMatrix("world",i.getWorldMatrix()),r._processRendering(i,e,d,Be.TriangleFillMode,l,c,(function(e,t){e||d.setMatrix("world",t)}))}}}}},s=new u.ov(0,0,0,1);this._volumetricLightScatteringRTT.onBeforeRenderObservable.add((function(){o=e.clearColor,e.clearColor=s})),this._volumetricLightScatteringRTT.onAfterRenderObservable.add((function(){e.clearColor=o})),this._volumetricLightScatteringRTT.customIsReadyFunction=function(e,t,i){if((i||0===t)&&e.subMeshes)for(var o=0;ot._alphaIndex?1:e._alphaIndext._distanceToCamera?-1:0})),s.setAlphaMode(b.Y.ALPHA_COMBINE),o=0;o2*o)&&(i=new Float32Array(o),this._matrices=i),this.onBeforeBoxRenderingObservable.notifyObservers(iV);for(var a=0,s=this.scene.floatingOriginOffset,l=0;l=0&&t.push(n);for(var r=0;r=e[0].length&&e[1].length>=e[2].length?o=1:e[2].length>=e[0].length&&e[2].length>=e[1].length&&(o=2);for(var a=0;a<3;++a)a===o?e[a].sort((function(e,t){return e[1]t[1]?1:0})):e[a].sort((function(e,t){return e[1]>t[1]?-1:e[1]=o+1;--u)i(e[u%3],l,u!==o+2?r[n[t+(u+1)%3]]:-1);var h=l.length;n.push(r[n[t+o]],s[0],l[0]),n.push(r[n[t+(o+1)%3]],l[h-1],s[c-1]);for(var d=c<=h,p=d?c:h,f=d?h:c,m=d?c-1:h-1,_=d?0:1,g=c+h-2,v=0,y=0,b=d?s:l,S=d?l:s,T=0;g-- >0;){_?n.push(b[v],S[y]):n.push(S[y],b[v]);var E=void 0;(T+=p)>=f&&vF){var ee=N;N=F,F=ee}(ne=J[te=N+"_"+F])?ne.done||(c.Pq.Dot($,ne.normal)0||this._source.hasThinInstances)},e.prototype.render=function(){var e=this._source.getScene(),t=e.floatingOriginOffset,n=this._lineShader._getDrawWrapper();if(this._drawWrapper&&this._lineShader._setDrawWrapper(this._drawWrapper),this.isReady()&&e.activeCamera){var r=this._source.hasInstances&&this.customInstances.length>0,i=r||this._source.hasThinInstances,o=0;if(i)if(this._buffersForInstances.world0=this._source.getVertexBuffer("world0"),this._buffersForInstances.world1=this._source.getVertexBuffer("world1"),this._buffersForInstances.world2=this._source.getVertexBuffer("world2"),this._buffersForInstances.world3=this._source.getVertexBuffer("world3"),r){var a=this._source._getInstanceDataStorage(),s=this._source._instanceDataStorage.isFrozen;if(o=this.customInstances.length,!a.instancesData)return void(this._source.getScene()._activeMeshesFrozen||this.customInstances.reset());if(!s){for(var l=0,c=0;c>l,u={width:c,height:c,depth:c};this._mipArray[l-1]=new $v("voxelMip"+l,u,"iblGenerateVoxelMip",this._scene,s,!1),this._scene.proceduralTextures.splice(this._scene.proceduralTextures.indexOf(this._mipArray[l-1]),1);var h=this._mipArray[l-1];h.autoClear=!1,h.wrapU=_n.g.CLAMP_ADDRESSMODE,h.wrapV=_n.g.CLAMP_ADDRESSMODE,h.setTexture("srcMip",l>1?this._mipArray[l-2]:this.getVoxelGrid()),h.setInt("layerNum",0)}this._createVoxelMaterials()},e.prototype._createVoxelMRTs=function(e,t,n){var r=this;t.wrapU=_n.g.CLAMP_ADDRESSMODE,t.wrapV=_n.g.CLAMP_ADDRESSMODE,t.noPrePassRenderer=!0;for(var i=[],o=new Array(this._maxDrawBuffers).fill(this._isVoxelGrid3D?b.Y.TEXTURE_3D:b.Y.TEXTURE_2D_ARRAY),a=function(n){var a=new Array(s._maxDrawBuffers).fill(0);a=a.map((function(e,t){return n*r._maxDrawBuffers+t}));var l=new Array(s._maxDrawBuffers).fill("");l=l.map((function(t,i){return"voxel_grid_"+e+(n*r._maxDrawBuffers+i)}));var c=new XS("mrt_"+e+n,{width:s._voxelResolution,height:s._voxelResolution,depth:s._isVoxelGrid3D?s._voxelResolution:void 0},s._maxDrawBuffers,s._scene,{types:new Array(s._maxDrawBuffers).fill(b.Y.TEXTURETYPE_UNSIGNED_BYTE),samplingModes:new Array(s._maxDrawBuffers).fill(b.Y.TEXTURE_TRILINEAR_SAMPLINGMODE),generateMipMaps:!1,targetTypes:o,formats:new Array(s._maxDrawBuffers).fill(b.Y.TEXTUREFORMAT_R),faceIndex:new Array(s._maxDrawBuffers).fill(0),layerIndex:a,layerCounts:new Array(s._maxDrawBuffers).fill(s._voxelResolution),generateDepthBuffer:!1,generateStencilBuffer:!1},l);c.clearColor=new u.ov(0,0,0,1),c.noPrePassRenderer=!0;for(var h=0;h=0)this._renderTargets.splice(t,e.length);else{var n=this._scene.customRenderTargets.findIndex((function(t){return t===e[0]}));n>=0&&this._scene.customRenderTargets.splice(n,e.length)}},e.prototype.updateVoxelGrid=function(e){this._stopVoxelization(),this._includedMeshes=e,this._voxelizationInProgress=!0,this._triPlanarVoxelization?(this._addRTsForRender(this._voxelMrtsXaxis,e,0),this._addRTsForRender(this._voxelMrtsYaxis,e,1),this._addRTsForRender(this._voxelMrtsZaxis,e,2)):this._addRTsForRender(this._voxelMrtsZaxis,e,2),this._voxelDebugEnabled&&this._addRTsForRender([this._voxelSlabDebugRT],e,this._voxelDebugAxis,1,!0),this._renderVoxelGridBound=this._renderVoxelGrid.bind(this),this._scene.onAfterRenderObservable.add(this._renderVoxelGridBound)},e.prototype._renderVoxelGrid=function(){var e=this;if(this._voxelizationInProgress){for(var t=this.getVoxelGrid().isReady(),n=0;n0&&(null===(o=i.renderList)||void 0===o||o.push(b),i.setMaterialForRendering(b,l));for(var S=0,T=b.getChildMeshes();S0&&(null===(a=i.renderList)||void 0===a||a.push(E),i.setMaterialForRendering(E,l))}}}},d=this,p=0;p;\n\n #ifdef COLORED_IBL_SHADOWS\n fn computeIndirectShadow() -> vec3f {\n var uv = fragmentInputs.position.xy / uniforms.renderTargetSize;\n var shadowValue: vec3f = textureSample(iblShadowsTexture, iblShadowsTextureSampler, uv).rgb;\n return mix(shadowValue, vec3f(1.0), 1.0 - uniforms.shadowOpacity);\n }\n #else\n fn computeIndirectShadow() -> vec2f {\n var uv = fragmentInputs.position.xy / uniforms.renderTargetSize;\n var shadowValue: vec2f = textureSample(iblShadowsTexture, iblShadowsTextureSampler, uv).rg;\n return mix(shadowValue, vec2f(1.0), 1.0 - uniforms.shadowOpacity);\n }\n #endif\n #endif\n "},this._material instanceof gg?n.CUSTOM_FRAGMENT_BEFORE_FINALCOLORCOMPOSITION="\n #ifdef RENDER_WITH_IBL_SHADOWS\n #ifndef UNLIT\n #ifdef REFLECTION\n #ifdef COLORED_IBL_SHADOWS\n var shadowValue: vec3f = computeIndirectShadow();\n finalIrradiance *= shadowValue;\n finalRadianceScaled *= mix(vec3f(1.0), shadowValue, roughness);\n #else\n var shadowValue: vec2f = computeIndirectShadow();\n finalIrradiance *= vec3f(shadowValue.x);\n finalRadianceScaled *= vec3f(mix(pow(shadowValue.y, 4.0), shadowValue.x, roughness));\n #endif\n #endif\n #else\n finalDiffuse *= computeIndirectShadow().x;\n #endif\n #endif\n ":this._material instanceof gS?n.CUSTOM_FRAGMENT_BEFORE_IBLLAYERCOMPOSITION="\n #ifdef RENDER_WITH_IBL_SHADOWS\n #ifndef UNLIT\n #ifdef REFLECTION\n #ifdef COLORED_IBL_SHADOWS\n var shadowValue: vec3f = computeIndirectShadow();\n slab_diffuse_ibl *= shadowValue;\n slab_glossy_ibl *= mix(vec3f(1.0), shadowValue, specularAlphaG);\n #else\n var shadowValue: vec2f = computeIndirectShadow();\n slab_diffuse_ibl *= vec3f(shadowValue.x);\n slab_glossy_ibl *= vec3f(mix(pow(shadowValue.y, 4.0), shadowValue.x, specularAlphaG));\n #endif\n #endif\n #else\n slab_diffuse_ibl *= computeIndirectShadow().x;\n #endif\n #endif\n ":n.CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR="\n #ifdef RENDER_WITH_IBL_SHADOWS\n #ifdef COLORED_IBL_SHADOWS\n var shadowValue: vec3f = computeIndirectShadow();\n color *= toGammaSpace(vec4f(shadowValue, 1.0f));\n #else\n var shadowValue: vec2f = computeIndirectShadow();\n color *= toGammaSpace(vec4f(shadowValue.x, shadowValue.x, shadowValue.x, 1.0f));\n #endif\n #endif\n "):(n={CUSTOM_FRAGMENT_DEFINITIONS:"\n #ifdef RENDER_WITH_IBL_SHADOWS\n uniform sampler2D iblShadowsTexture;\n #ifdef COLORED_IBL_SHADOWS\n vec3 computeIndirectShadow() {\n vec2 uv = gl_FragCoord.xy / renderTargetSize;\n vec3 shadowValue = texture2D(iblShadowsTexture, uv).rgb;\n return mix(shadowValue.rgb, vec3(1.0), 1.0 - shadowOpacity);\n }\n #else\n vec2 computeIndirectShadow() {\n vec2 uv = gl_FragCoord.xy / renderTargetSize;\n vec2 shadowValue = texture2D(iblShadowsTexture, uv).rg;\n return mix(shadowValue.rg, vec2(1.0), 1.0 - shadowOpacity);\n }\n #endif\n #endif\n "},this._material instanceof gg?n.CUSTOM_FRAGMENT_BEFORE_FINALCOLORCOMPOSITION="\n #ifdef RENDER_WITH_IBL_SHADOWS\n #ifndef UNLIT\n #ifdef REFLECTION\n #ifdef COLORED_IBL_SHADOWS\n vec3 shadowValue = computeIndirectShadow();\n finalIrradiance.rgb *= shadowValue.rgb;\n finalRadianceScaled *= mix(vec3(1.0), shadowValue.rgb, roughness);\n #else\n vec2 shadowValue = computeIndirectShadow();\n finalIrradiance *= shadowValue.x;\n finalRadianceScaled *= mix(pow(shadowValue.y, 4.0), shadowValue.x, roughness);\n #endif\n #endif\n #else\n finalDiffuse *= computeIndirectShadow().x;\n #endif\n #endif\n ":this._material instanceof gS?n.CUSTOM_FRAGMENT_BEFORE_IBLLAYERCOMPOSITION="\n #ifdef RENDER_WITH_IBL_SHADOWS\n #ifndef UNLIT\n #ifdef REFLECTION\n #ifdef COLORED_IBL_SHADOWS\n vec3 shadowValue = computeIndirectShadow();\n slab_diffuse_ibl.rgb *= shadowValue.rgb;\n slab_glossy_ibl *= mix(vec3(1.0), shadowValue.rgb, specularAlphaG);\n #else\n vec2 shadowValue = computeIndirectShadow();\n slab_diffuse_ibl *= shadowValue.x;\n slab_glossy_ibl *= mix(pow(shadowValue.y, 4.0), shadowValue.x, specularAlphaG);\n #endif\n #endif\n #else\n slab_diffuse_ibl *= computeIndirectShadow().x;\n #endif\n #endif\n ":n.CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR="\n #ifdef RENDER_WITH_IBL_SHADOWS\n #ifdef COLORED_IBL_SHADOWS\n vec3 shadowValue = computeIndirectShadow();\n color.rgb *= toGammaSpace(shadowValue.rgb);\n #else\n vec2 shadowValue = computeIndirectShadow();\n color.rgb *= toGammaSpace(shadowValue.x);\n #endif\n #endif\n "),"vertex"===e?null:n},t.Name="IBLShadowsPluginMaterial",(0,f.Cg)([(0,ce.lK)()],t.prototype,"shadowOpacity",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"isEnabled",void 0),t}(Ro);(0,h.Y5)("BABYLON.IBLShadowsPluginMaterial",yV);var bV=function(e){function t(t,n,r,i){var o,a,s;void 0===r&&(r={});var u=e.call(this,n.getEngine(),t)||this;u._allowDebugPasses=!1,u._debugPasses=[],u._shadowCastingMeshes=[],u._shadowOpacity=.8,u._enabled=!0,u._coloredShadows=!1,u._materialsWithRenderPlugin=[],u.onShadowTextureReadyObservable=new l.cP,u.onNewIblReadyObservable=new l.cP,u.onVoxelizationCompleteObservable=new l.cP,u.voxelGridSize=1,u._renderSizeFactor=1,u._gbufferDebugEnabled=!1,u._gBufferDebugSizeParams=new c.IU(0,0,0,0),u.scene=n,u._cameras=i||[n.activeCamera];var h=new Uint8Array([0,0,0,255]);u._dummyTexture2d=new gn(h,1,1,Ai.N.TEXTUREFORMAT_RGBA,n,!1),u._dummyTexture3d=new eT(h,1,1,1,Ai.N.TEXTUREFORMAT_RGBA,n,!1);var d={};d[dw.SCREENSPACE_DEPTH_TEXTURE_TYPE]={textureFormat:b.Y.TEXTUREFORMAT_R,textureType:b.Y.TEXTURETYPE_FLOAT},d[dw.VELOCITY_LINEAR_TEXTURE_TYPE]={textureFormat:b.Y.TEXTUREFORMAT_RG,textureType:b.Y.TEXTURETYPE_HALF_FLOAT},d[dw.POSITION_TEXTURE_TYPE]={textureFormat:b.Y.TEXTUREFORMAT_RGBA,textureType:b.Y.TEXTURETYPE_HALF_FLOAT},d[dw.NORMAL_TEXTURE_TYPE]={textureFormat:b.Y.TEXTUREFORMAT_RGBA,textureType:b.Y.TEXTURETYPE_HALF_FLOAT};var p=n.enableGeometryBufferRenderer(void 0,b.Y.TEXTUREFORMAT_DEPTH32_FLOAT,d);return p?(u._geometryBufferRenderer=p,u._geometryBufferRenderer.enableScreenspaceDepth=!0,u._geometryBufferRenderer.enableVelocityLinear=!0,u._geometryBufferRenderer.enablePosition=!0,u._geometryBufferRenderer.enableNormal=!0,u._geometryBufferRenderer.generateNormalsInWorldSpace=!0,u.scene.enableIblCdfGenerator(),u.shadowOpacity=r.shadowOpacity||.8,u._voxelRenderer=new fV(u.scene,u,r?r.resolutionExp:6,void 0===r.triPlanarVoxelization||r.triPlanarVoxelization),u._voxelTracingPass=new mV(u.scene,u),u._spatialBlurPass=new _V(u.scene,u),u._accumulationPass=new gV(u.scene,u),u._accumulationPass.onReadyObservable.addOnce((function(){u.onShadowTextureReadyObservable.notifyObservers()})),u.sampleDirections=r.sampleDirections||2,u.voxelShadowOpacity=null!==(o=r.voxelShadowOpacity)&&void 0!==o?o:1,u.envRotation=null!==(a=r.envRotation)&&void 0!==a?a:0,u.shadowRenderSizeFactor=r.shadowRenderSizeFactor||1,u.ssShadowOpacity=void 0===r.ssShadowsEnabled||r.ssShadowsEnabled?1:0,u.ssShadowDistanceScale=r.ssShadowDistanceScale||1.25,u.ssShadowSampleCount=r.ssShadowSampleCount||16,u.ssShadowStride=r.ssShadowStride||8,u.ssShadowThicknessScale=r.ssShadowThicknessScale||1,u.shadowRemanence=null!==(s=r.shadowRemanence)&&void 0!==s?s:.75,u._noiseTexture=new _n.g("https://assets.babylonjs.com/textures/blue_noise/blue_noise_rgb.png",u.scene,!1,!0,b.Y.TEXTURE_NEAREST_SAMPLINGMODE),n.postProcessRenderPipelineManager.addPipeline(u),u.scene.onActiveCameraChanged.add(u._listenForCameraChanges.bind(u)),u.scene.onBeforeRenderObservable.add(u._updateBeforeRender.bind(u)),u._listenForCameraChanges(),u.scene.getEngine().onResizeObservable.add(u._handleResize.bind(u)),u.scene.iblCdfGenerator&&u.scene.iblCdfGenerator.onGeneratedObservable.add((function(){u._setPluginParameters(),u.onNewIblReadyObservable.notifyObservers()})),u):(y.V.Error("Geometry buffer renderer is required for IBL shadows to work."),u)}return(0,f.C6)(t,e),t.prototype.resetAccumulation=function(){this._accumulationPass.reset=!0},Object.defineProperty(t.prototype,"shadowOpacity",{get:function(){return this._shadowOpacity},set:function(e){this._shadowOpacity=e,this._setPluginParameters()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"coloredShadows",{get:function(){return this._coloredShadows},set:function(e){this._coloredShadows=e,this._voxelTracingPass.coloredShadows=e,this._setPluginParameters()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shadowRenderSizeFactor",{get:function(){return this._renderSizeFactor},set:function(e){this._renderSizeFactor=Math.max(Math.min(e,1),0),this._voxelTracingPass.resize(e),this._spatialBlurPass.resize(e),this._accumulationPass.resize(e),this._setPluginParameters()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"voxelShadowOpacity",{get:function(){var e;return null===(e=this._voxelTracingPass)||void 0===e?void 0:e.voxelShadowOpacity},set:function(e){this._voxelTracingPass&&(this._voxelTracingPass.voxelShadowOpacity=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ssShadowOpacity",{get:function(){var e;return null===(e=this._voxelTracingPass)||void 0===e?void 0:e.ssShadowOpacity},set:function(e){this._voxelTracingPass&&(this._voxelTracingPass.ssShadowOpacity=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ssShadowSampleCount",{get:function(){var e;return null===(e=this._voxelTracingPass)||void 0===e?void 0:e.sssSamples},set:function(e){this._voxelTracingPass&&(this._voxelTracingPass.sssSamples=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ssShadowStride",{get:function(){var e;return null===(e=this._voxelTracingPass)||void 0===e?void 0:e.sssStride},set:function(e){this._voxelTracingPass&&(this._voxelTracingPass.sssStride=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ssShadowDistanceScale",{get:function(){return this._sssMaxDistScale},set:function(e){this._sssMaxDistScale=e,this._updateSsShadowParams()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ssShadowThicknessScale",{get:function(){return this._sssThicknessScale},set:function(e){this._sssThicknessScale=e,this._updateSsShadowParams()},enumerable:!1,configurable:!0}),t.prototype._getVoxelGridTexture=function(){var e,t=null===(e=this._voxelRenderer)||void 0===e?void 0:e.getVoxelGrid();return t&&t.isReady()?t:this._dummyTexture3d},t.prototype._getNoiseTexture=function(){var e=this._noiseTexture;return e&&e.isReady()?e:this._dummyTexture2d},t.prototype._getVoxelTracingTexture=function(){var e,t=null===(e=this._voxelTracingPass)||void 0===e?void 0:e.getOutputTexture();return t&&t.isReady()?t:this._dummyTexture2d},t.prototype._getSpatialBlurTexture=function(){var e=this._spatialBlurPass.getOutputTexture();return e&&e.isReady()?e:this._dummyTexture2d},t.prototype._getAccumulatedTexture=function(){var e,t=null===(e=this._accumulationPass)||void 0===e?void 0:e.getOutputTexture();return t&&t.isReady()?t:this._dummyTexture2d},Object.defineProperty(t.prototype,"gbufferDebugEnabled",{get:function(){return this._gbufferDebugEnabled},set:function(e){!e||this.allowDebugPasses?(this._gbufferDebugEnabled=e,e?this._enableEffect(this._getGBufferDebugPass().name,this.cameras):this._disableEffect(this._getGBufferDebugPass().name,this.cameras)):y.V.Warn("Can't enable G-Buffer debug view without setting allowDebugPasses to true.")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cdfDebugEnabled",{get:function(){return!!this.scene.iblCdfGenerator&&this.scene.iblCdfGenerator.debugEnabled},set:function(e){this.scene.iblCdfGenerator&&(!e||this.allowDebugPasses?e!==this.scene.iblCdfGenerator.debugEnabled&&(this.scene.iblCdfGenerator.debugEnabled=e,e?this._enableEffect(this.scene.iblCdfGenerator.debugPassName,this.cameras):this._disableEffect(this.scene.iblCdfGenerator.debugPassName,this.cameras)):y.V.Warn("Can't enable importance sampling debug view without setting allowDebugPasses to true."))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"voxelDebugEnabled",{get:function(){var e;return null===(e=this._voxelRenderer)||void 0===e?void 0:e.voxelDebugEnabled},set:function(e){this._voxelRenderer&&(!e||this.allowDebugPasses?(this._voxelRenderer.voxelDebugEnabled=e,e?this._enableEffect(this._voxelRenderer.debugPassName,this.cameras):this._disableEffect(this._voxelRenderer.debugPassName,this.cameras)):y.V.Warn("Can't enable voxel debug view without setting allowDebugPasses to true."))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"voxelDebugAxis",{get:function(){var e;return null===(e=this._voxelRenderer)||void 0===e?void 0:e.voxelDebugAxis},set:function(e){this._voxelRenderer&&(this._voxelRenderer.voxelDebugAxis=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"voxelDebugDisplayMip",{set:function(e){this._voxelRenderer&&this._voxelRenderer.setDebugMipNumber(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"voxelTracingDebugEnabled",{get:function(){var e;return null===(e=this._voxelTracingPass)||void 0===e?void 0:e.debugEnabled},set:function(e){this._voxelTracingPass&&(!e||this.allowDebugPasses?e!==this._voxelTracingPass.debugEnabled&&(this._voxelTracingPass.debugEnabled=e,e?this._enableEffect(this._voxelTracingPass.debugPassName,this.cameras):this._disableEffect(this._voxelTracingPass.debugPassName,this.cameras)):y.V.Warn("Can't enable voxel tracing debug view without setting allowDebugPasses to true."))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"spatialBlurPassDebugEnabled",{get:function(){return this._spatialBlurPass.debugEnabled},set:function(e){this._spatialBlurPass&&(!e||this.allowDebugPasses?e!==this._spatialBlurPass.debugEnabled&&(this._spatialBlurPass.debugEnabled=e,e?this._enableEffect(this._spatialBlurPass.debugPassName,this.cameras):this._disableEffect(this._spatialBlurPass.debugPassName,this.cameras)):y.V.Warn("Can't enable spatial blur debug view without setting allowDebugPasses to true."))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"accumulationPassDebugEnabled",{get:function(){var e;return null===(e=this._accumulationPass)||void 0===e?void 0:e.debugEnabled},set:function(e){this._accumulationPass&&(!e||this.allowDebugPasses?e!==this._accumulationPass.debugEnabled&&(this._accumulationPass.debugEnabled=e,e?this._enableEffect(this._accumulationPass.debugPassName,this.cameras):this._disableEffect(this._accumulationPass.debugPassName,this.cameras)):y.V.Warn("Can't enable accumulation pass debug view without setting allowDebugPasses to true."))},enumerable:!1,configurable:!0}),t.prototype.addShadowCastingMesh=function(e){if(Array.isArray(e))for(var t=0,n=e;t0&&(this._useSpecificClearForDepthTexture&&this._mrtLayout[i]===b.Y.PREPASS_DEPTH_TEXTURE_TYPE?(t.push(!1),n.push(!0)):(t.push(!0),n.push(!1)),r.push(!1));this._multiRenderAttachments=this._engine.buildTextureLayout(e),this._clearAttachments=this._engine.buildTextureLayout(t),this._clearDepthAttachments=this._engine.buildTextureLayout(n),this._defaultAttachments=this._engine.buildTextureLayout(r)},e.prototype._resetLayout=function(){for(var t=0;t=0;e--)this.renderTargets[e].dispose();for(e=0;e=5)return y.V.Error("You already reached the maximum number of diffusion profiles."),0;for(var t=0;t4&&(a.push(se.R.MatricesIndicesExtraKind),a.push(se.R.MatricesWeightsExtraKind));var p=s.skeleton;o.push("#define NUM_BONE_INFLUENCERS "+s.numBoneInfluencers),s.numBoneInfluencers>0&&d.addCPUSkinningFallback(0,s),p.isUsingTextureForMatrices?o.push("#define BONETEXTURE"):o.push("#define BonesPerMesh "+(p.bones.length+1))}else o.push("#define NUM_BONE_INFLUENCERS 0");var m=s.morphTargetManager?(0,Le.Dk)(s.morphTargetManager,o,a,s,!0,!0,!1,u,h,!1):0;t&&(o.push("#define INSTANCES"),(0,Le.te)(a),e.getRenderingMesh().hasThinInstances&&o.push("#define THIN_INSTANCES"));var _=s.bakedVertexAnimationManager;_&&_.isEnabled&&(o.push("#define BAKED_VERTEX_ANIMATION_TEXTURE"),t&&a.push("bakedVertexAnimationSettingsInstanced"));var g=e._getDrawWrapper(r,!0),v=g.defines,y=o.join("\n");if(v!==y){var b=["world","mBones","viewProjection","diffuseMatrix","offset","color","logarithmicDepthConstant","morphTargetInfluences","boneTextureWidth","morphTargetCount","morphTargetTextureInfo","morphTargetTextureIndices","bakedVertexAnimationSettings","bakedVertexAnimationTextureSizeInverted","bakedVertexAnimationTime","bakedVertexAnimationTexture"];(0,Mo.Ll)(b),g.setEffect(this.scene.getEngine().createEffect("outline",{attributes:a,uniformsNames:b,uniformBuffersNames:[],samplers:["diffuseSampler","boneSampler","morphTargets","bakedVertexAnimationTexture"],defines:y,fallbacks:d,onCompiled:null,onError:null,indexParameters:{maxSimultaneousMorphTargets:m},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:function(){return(0,f.sH)(i,void 0,void 0,(function(){return(0,f.YH)(this,(function(e){switch(e.label){case 0:return 1!==this._shaderLanguage?[3,2]:[4,Promise.all([Promise.resolve().then(n.bind(n,61189)),Promise.resolve().then(n.bind(n,27179))])];case 1:return e.sent(),[3,4];case 2:return[4,Promise.all([Promise.resolve().then(n.bind(n,23338)),Promise.resolve().then(n.bind(n,18924))])];case 3:e.sent(),e.label=4;case 4:return[2]}}))}))}},this.scene.getEngine()),y)}return g.effect.isReady()},e.prototype._beforeRenderingMesh=function(t,n,r){if(this.enabled&&(this._savedDepthWrite=this._engine.getDepthWrite(),t.renderOutline)){var i=n.getMaterial();i&&i.needAlphaBlendingForMesh(t)&&(this._engine.cacheStencilState(),this._engine.setDepthWrite(!1),this._engine.setColorWrite(!1),this._engine.setStencilBuffer(!0),this._engine.setStencilOperationPass(b.Y.REPLACE),this._engine.setStencilFunction(b.Y.ALWAYS),this._engine.setStencilMask(e._StencilReference),this._engine.setStencilFunctionReference(e._StencilReference),this._engine.stencilStateComposer.useStencilGlobalOnly=!0,this.render(n,r,!0,this._passIdForDrawWrapper[1]),this._engine.setColorWrite(!0),this._engine.setStencilFunction(b.Y.NOTEQUAL)),this._engine.setDepthWrite(!1),this.render(n,r,!1,this._passIdForDrawWrapper[0]),this._engine.setDepthWrite(this._savedDepthWrite),i&&i.needAlphaBlendingForMesh(t)&&(this._engine.stencilStateComposer.useStencilGlobalOnly=!1,this._engine.restoreStencilState())}},e.prototype._afterRenderingMesh=function(e,t,n){if(this.enabled){if(e.renderOverlay){var r=this._engine.getAlphaMode(),i=this._engine.alphaState.alphaBlend;this._engine.setAlphaMode(b.Y.ALPHA_COMBINE),this.render(t,n,!0,this._passIdForDrawWrapper[3]),this._engine.setAlphaMode(r),this._engine.setDepthWrite(this._savedDepthWrite),this._engine.alphaState.setAlphaBlend(i)}e.renderOutline&&this._savedDepthWrite&&(this._engine.setDepthWrite(!0),this._engine.setColorWrite(!1),this.render(t,n,!1,this._passIdForDrawWrapper[2]),this._engine.setColorWrite(!0))}},e._StencilReference=4,e}(),LV=n(85043),wV=n(7931),BV=function(){function e(e,t){this.priority=0,this._particleSize=.1,this.onParticleSizeChanged=new l.cP,this.particleThicknessAlpha=.05,this._useVelocity=!1,this._shaderLanguage=0,this._scene=e,this._engine=e.getEngine(),this._effectsAreDirty=!0,this._depthEffectWrapper=null,this._thicknessEffectWrapper=null,this._shaderLanguage=null!=t?t:this._engine.isWebGPU?1:0}return Object.defineProperty(e.prototype,"particleSize",{get:function(){return this._particleSize},set:function(e){e!==this._particleSize&&(this._particleSize=e,this.onParticleSizeChanged.notifyObservers(this))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"useInstancing",{get:function(){return!this.indexBuffer},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"useVelocity",{get:function(){return this._useVelocity},set:function(e){this._useVelocity!==e&&this._hasVelocity()&&(this._useVelocity=e,this._effectsAreDirty=!0)},enumerable:!1,configurable:!0}),e.prototype._hasVelocity=function(){var e;return!!(null===(e=this.vertexBuffers)||void 0===e?void 0:e.velocity)},Object.defineProperty(e.prototype,"indexBuffer",{get:function(){return null},enumerable:!1,configurable:!0}),e.prototype.getClassName=function(){return"FluidRenderingObject"},Object.defineProperty(e.prototype,"shaderLanguage",{get:function(){return this._shaderLanguage},enumerable:!1,configurable:!0}),e.prototype._createEffects=function(){var e=this,t=["view","projection","particleRadius","size"],r=["position","offset"],i=[];this._effectsAreDirty=!1,this.useVelocity&&(r.push("velocity"),i.push("#define FLUIDRENDERING_VELOCITY")),this._scene.useRightHandedSystem&&i.push("#define FLUIDRENDERING_RHS"),this._depthEffectWrapper=new Ri.$({engine:this._engine,useShaderStore:!0,vertexShader:"fluidRenderingParticleDepth",fragmentShader:"fluidRenderingParticleDepth",attributeNames:r,uniformNames:t,samplerNames:[],defines:i,shaderLanguage:this._shaderLanguage,extraInitializationsAsync:function(){return(0,f.sH)(e,void 0,void 0,(function(){return(0,f.YH)(this,(function(e){switch(e.label){case 0:return 1!==this._shaderLanguage?[3,2]:[4,Promise.all([Promise.resolve().then(n.bind(n,64780)),Promise.resolve().then(n.bind(n,76138))])];case 1:return e.sent(),[3,4];case 2:return[4,Promise.all([Promise.resolve().then(n.bind(n,29687)),Promise.resolve().then(n.bind(n,18337))])];case 3:e.sent(),e.label=4;case 4:return[2]}}))}))}}),t.push("particleAlpha"),this._thicknessEffectWrapper=new Ri.$({engine:this._engine,useShaderStore:!0,vertexShader:"fluidRenderingParticleThickness",fragmentShader:"fluidRenderingParticleThickness",attributeNames:["position","offset"],uniformNames:t,samplerNames:[],shaderLanguage:this._shaderLanguage,extraInitializationsAsync:function(){return(0,f.sH)(e,void 0,void 0,(function(){return(0,f.YH)(this,(function(e){switch(e.label){case 0:return 1!==this._shaderLanguage?[3,2]:[4,Promise.all([Promise.resolve().then(n.bind(n,37113)),Promise.resolve().then(n.bind(n,2835))])];case 1:return e.sent(),[3,4];case 2:return[4,Promise.all([Promise.resolve().then(n.bind(n,55214)),Promise.resolve().then(n.bind(n,10151))])];case 3:e.sent(),e.label=4;case 4:return[2]}}))}))}})},e.prototype.isReady=function(){if(this._effectsAreDirty&&this._createEffects(),!this._depthEffectWrapper||!this._thicknessEffectWrapper)return!1;var e=this._depthEffectWrapper.drawWrapper.effect,t=this._thicknessEffectWrapper.drawWrapper.effect;return e.isReady()&&t.isReady()},e.prototype.renderDepthTexture=function(){var e=this.numParticles;if(this._depthEffectWrapper&&0!==e){var t=this._depthEffectWrapper.drawWrapper,n=t.effect;this._engine.enableEffect(t),this._engine.bindBuffers(this.vertexBuffers,this.indexBuffer,n),n.setMatrix("view",this._scene.getViewMatrix()),n.setMatrix("projection",this._scene.getProjectionMatrix()),n.setFloat2("size",this._particleSize,this._particleSize),n.setFloat("particleRadius",this._particleSize/2),this.useInstancing?this._engine.drawArraysType(b.Y.MATERIAL_TriangleStripDrawMode,0,4,e):this._engine.drawElementsType(b.Y.MATERIAL_TriangleFillMode,0,e)}},e.prototype.renderThicknessTexture=function(){var e=this.numParticles;if(this._thicknessEffectWrapper&&0!==e){var t=this._thicknessEffectWrapper.drawWrapper,n=t.effect;this._engine.setAlphaMode(b.Y.ALPHA_ONEONE),this._engine.setDepthWrite(!1),this._engine.enableEffect(t),this._engine.bindBuffers(this.vertexBuffers,this.indexBuffer,n),n.setMatrix("view",this._scene.getViewMatrix()),n.setMatrix("projection",this._scene.getProjectionMatrix()),n.setFloat("particleAlpha",this.particleThicknessAlpha),n.setFloat2("size",this._particleSize,this._particleSize),this.useInstancing?this._engine.drawArraysType(b.Y.MATERIAL_TriangleStripDrawMode,0,4,e):this._engine.drawElementsType(b.Y.MATERIAL_TriangleFillMode,0,e),this._engine.setDepthWrite(!0),this._engine.setAlphaMode(b.Y.ALPHA_DISABLE)}},e.prototype.renderDiffuseTexture=function(){},e.prototype.dispose=function(){var e,t;null===(e=this._depthEffectWrapper)||void 0===e||e.dispose(!1),null===(t=this._thicknessEffectWrapper)||void 0===t||t.dispose(!1),this.onParticleSizeChanged.clear()},e}(),VV=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return i._useTrueRenderingForDiffuseTexture=!0,i._particleSystem=n,i._originalRender=n.render.bind(n),i._blendMode=n.blendMode,i._onBeforeDrawParticleObserver=null,i._updateInAnimate=i._particleSystem.updateInAnimate,i._particleSystem.updateInAnimate=!0,i._particleSystem.render=function(){return 0},i.particleSize=(n.minSize+n.maxSize)/2,i.useTrueRenderingForDiffuseTexture=!1,i}return(0,f.C6)(t,e),Object.defineProperty(t.prototype,"particleSystem",{get:function(){return this._particleSystem},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"FluidRenderingObjectParticleSystem"},Object.defineProperty(t.prototype,"useTrueRenderingForDiffuseTexture",{get:function(){return this._useTrueRenderingForDiffuseTexture},set:function(e){var t=this;this._useTrueRenderingForDiffuseTexture!==e&&(this._useTrueRenderingForDiffuseTexture=e,e?(this._particleSystem.blendMode=this._blendMode,this._particleSystem.onBeforeDrawParticlesObservable.remove(this._onBeforeDrawParticleObserver),this._onBeforeDrawParticleObserver=null):(this._particleSystem.blendMode=-1,this._onBeforeDrawParticleObserver=this._particleSystem.onBeforeDrawParticlesObservable.add((function(){t._engine.setAlphaMode(b.Y.ALPHA_COMBINE)}))))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"vertexBuffers",{get:function(){return this._particleSystem.vertexBuffers},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"indexBuffer",{get:function(){return this._particleSystem.indexBuffer},enumerable:!1,configurable:!0}),t.prototype.isReady=function(){return e.prototype.isReady.call(this)&&this._particleSystem.isReady()},Object.defineProperty(t.prototype,"numParticles",{get:function(){return this._particleSystem.getActiveCount()},enumerable:!1,configurable:!0}),t.prototype.renderDiffuseTexture=function(){this._originalRender()},t.prototype.dispose=function(){e.prototype.dispose.call(this),this._particleSystem.onBeforeDrawParticlesObservable.remove(this._onBeforeDrawParticleObserver),this._onBeforeDrawParticleObserver=null,this._particleSystem.render=this._originalRender,this._particleSystem.blendMode=this._blendMode,this._particleSystem.updateInAnimate=this._updateInAnimate},t}(BV),UV=function(){function e(e,t,n,r,i,o,a,s,c,u,h,d,p,f,m){void 0===a&&(a=b.Y.TEXTURETYPE_FLOAT),void 0===s&&(s=b.Y.TEXTUREFORMAT_R),void 0===c&&(c=b.Y.TEXTURETYPE_FLOAT),void 0===u&&(u=b.Y.TEXTUREFORMAT_R),void 0===h&&(h=!1),void 0===d&&(d=null),void 0===p&&(p=!0),void 0===f&&(f=1),this.enableBlur=!0,this.blurSizeDivisor=1,this.blurFilterSize=7,this._blurNumIterations=3,this.blurMaxFilterSize=100,this.blurDepthScale=10,this.particleSize=.02,this.onDisposeObservable=new l.cP,this._shaderLanguage=0,this._name=e,this._scene=t,this._camera=d,this._engine=t.getEngine(),this._width=n,this._height=r,this._blurTextureSizeX=i,this._blurTextureSizeY=o,this._textureType=a,this._textureFormat=s,this._blurTextureType=c,this._blurTextureFormat=u,this._useStandardBlur=h,this._generateDepthBuffer=p,this._samples=f,this._postProcessRunningIndex=0,this.enableBlur=0!==i&&0!==o,this._rt=null,this._texture=null,this._rtBlur=null,this._textureBlurred=null,this._blurPostProcesses=null,this._shaderLanguage=null!=m?m:this._engine.isWebGPU?1:0}return Object.defineProperty(e.prototype,"blurNumIterations",{get:function(){return this._blurNumIterations},set:function(e){if(this._blurNumIterations!==e&&(this._blurNumIterations=e,null!==this._blurPostProcesses)){var t=this._blurPostProcesses[0],n=this._blurPostProcesses[1];this._blurPostProcesses=[];for(var r=0;r<2*this._blurNumIterations;++r)this._blurPostProcesses[r]=1&r?n:t}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"renderTarget",{get:function(){return this._rt},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"renderTargetBlur",{get:function(){return this._rtBlur},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"texture",{get:function(){return this._texture},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textureBlur",{get:function(){return this._textureBlurred},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shaderLanguage",{get:function(){return this._shaderLanguage},enumerable:!1,configurable:!0}),e.prototype.initialize=function(){if(this.dispose(),this._createRenderTarget(),this.enableBlur&&this._texture){var e=this._createBlurPostProcesses(this._texture,this._blurTextureType,this._blurTextureFormat,this.blurSizeDivisor,this._name,this._useStandardBlur),t=e[0],n=e[1],r=e[2];this._rtBlur=t,this._textureBlurred=n,this._blurPostProcesses=r}},e.prototype.applyBlurPostProcesses=function(){this.enableBlur&&this._blurPostProcesses&&(this._postProcessRunningIndex=0,this._scene.postProcessManager.directRender(this._blurPostProcesses,this._rtBlur,!0),this._engine.unBindFramebuffer(this._rtBlur))},e.prototype._createRenderTarget=function(){this._rt=this._engine.createRenderTargetTexture({width:this._width,height:this._height},{generateMipMaps:!1,type:this._textureType,format:this._textureFormat,samplingMode:b.Y.TEXTURE_NEAREST_SAMPLINGMODE,generateDepthBuffer:this._generateDepthBuffer,generateStencilBuffer:!1,samples:this._samples,label:"FluidRenderingRTT-".concat(this._name)});var e=this._rt.texture;e.incrementReferences(),this._texture=new _n.g(null,this._scene),this._texture.name="rtt"+this._name,this._texture._texture=e,this._texture.wrapU=_n.g.CLAMP_ADDRESSMODE,this._texture.wrapV=_n.g.CLAMP_ADDRESSMODE,this._texture.anisotropicFilteringLevel=1},e.prototype._createBlurPostProcesses=function(e,t,r,i,o,a){var s=this;void 0===a&&(a=!1);var l=this._scene.getEngine(),u=new c.I9(Math.floor(this._blurTextureSizeX/i),Math.floor(this._blurTextureSizeY/i)),h=t===b.Y.TEXTURETYPE_FLOAT&&l.getCaps().textureFloatLinearFiltering||t===b.Y.TEXTURETYPE_HALF_FLOAT&&l.getCaps().textureHalfFloatLinearFiltering,d=this._engine.createRenderTargetTexture({width:u.x,height:u.y},{generateMipMaps:!1,type:t,format:r,samplingMode:h?b.Y.TEXTURE_BILINEAR_SAMPLINGMODE:b.Y.TEXTURE_NEAREST_SAMPLINGMODE,generateDepthBuffer:!1,generateStencilBuffer:!1,samples:this._samples,label:"FluidRenderingRTTBlur-".concat(o)}),p=d.texture;p.incrementReferences();var m=new _n.g(null,this._scene);if(m.name="rttBlurred"+o,m._texture=p,m.wrapU=_n.g.CLAMP_ADDRESSMODE,m.wrapV=_n.g.CLAMP_ADDRESSMODE,m.anisotropicFilteringLevel=1,a){var _=new Ci.w("BilateralBlurX","fluidRenderingStandardBlur",["filterSize","blurDir"],null,1,null,b.Y.TEXTURE_NEAREST_SAMPLINGMODE,l,!0,null,t,void 0,void 0,void 0,r,this._shaderLanguage,(function(){return(0,f.sH)(s,void 0,void 0,(function(){return(0,f.YH)(this,(function(e){switch(e.label){case 0:return 1!==this.shaderLanguage?[3,2]:[4,Promise.resolve().then(n.bind(n,52063))];case 1:return e.sent(),[3,4];case 2:return[4,Promise.resolve().then(n.bind(n,31298))];case 3:e.sent(),e.label=4;case 4:return[2]}}))}))}));_.samples=this._samples,_.externalTextureSamplerBinding=!0,_.onApplyObservable.add((function(t){0===s._postProcessRunningIndex?t.setTexture("textureSampler",e):t._bindTexture("textureSampler",_.inputTexture.texture),t.setInt("filterSize",s.blurFilterSize),t.setFloat2("blurDir",1/s._blurTextureSizeX,0),s._postProcessRunningIndex++})),_.onSizeChangedObservable.add((function(){_._textures.forEach((function(e){e.texture.wrapU=_n.g.CLAMP_ADDRESSMODE,e.texture.wrapV=_n.g.CLAMP_ADDRESSMODE}))})),this._fixReusablePostProcess(_);var g=new Ci.w("BilateralBlurY","fluidRenderingStandardBlur",["filterSize","blurDir"],null,1,null,b.Y.TEXTURE_NEAREST_SAMPLINGMODE,l,!0,null,t,void 0,void 0,void 0,r,this._shaderLanguage,(function(){return(0,f.sH)(s,void 0,void 0,(function(){return(0,f.YH)(this,(function(e){switch(e.label){case 0:return 1!==this.shaderLanguage?[3,2]:[4,Promise.resolve().then(n.bind(n,52063))];case 1:return e.sent(),[3,4];case 2:return[4,Promise.resolve().then(n.bind(n,31298))];case 3:e.sent(),e.label=4;case 4:return[2]}}))}))}));g.samples=this._samples,g.onApplyObservable.add((function(e){e.setInt("filterSize",s.blurFilterSize),e.setFloat2("blurDir",0,1/s._blurTextureSizeY),s._postProcessRunningIndex++})),g.onSizeChangedObservable.add((function(){g._textures.forEach((function(e){e.texture.wrapU=_n.g.CLAMP_ADDRESSMODE,e.texture.wrapV=_n.g.CLAMP_ADDRESSMODE}))})),this._fixReusablePostProcess(g),_.autoClear=!1,g.autoClear=!1;for(var v=[],y=0;y<2*this._blurNumIterations;++y)v[y]=1&y?g:_;return[d,m,v]}var S=["maxFilterSize","blurDir","projectedParticleConstant","depthThreshold"],T=new Ci.w("BilateralBlurX","fluidRenderingBilateralBlur",S,null,1,null,b.Y.TEXTURE_NEAREST_SAMPLINGMODE,l,!0,null,t,void 0,void 0,void 0,r,this._shaderLanguage,(function(){return(0,f.sH)(s,void 0,void 0,(function(){return(0,f.YH)(this,(function(e){switch(e.label){case 0:return 1!==this.shaderLanguage?[3,2]:[4,Promise.resolve().then(n.bind(n,7060))];case 1:return e.sent(),[3,4];case 2:return[4,Promise.resolve().then(n.bind(n,48063))];case 3:e.sent(),e.label=4;case 4:return[2]}}))}))}));T.samples=this._samples,T.externalTextureSamplerBinding=!0,T.onApplyObservable.add((function(t){0===s._postProcessRunningIndex?t.setTexture("textureSampler",e):t._bindTexture("textureSampler",T.inputTexture.texture),t.setInt("maxFilterSize",s.blurMaxFilterSize),t.setFloat2("blurDir",1/s._blurTextureSizeX,0),t.setFloat("projectedParticleConstant",s._getProjectedParticleConstant()),t.setFloat("depthThreshold",s._getDepthThreshold()),s._postProcessRunningIndex++})),T.onSizeChangedObservable.add((function(){T._textures.forEach((function(e){e.texture.wrapU=_n.g.CLAMP_ADDRESSMODE,e.texture.wrapV=_n.g.CLAMP_ADDRESSMODE}))})),this._fixReusablePostProcess(T);var E=new Ci.w("BilateralBlurY","fluidRenderingBilateralBlur",S,null,1,null,b.Y.TEXTURE_NEAREST_SAMPLINGMODE,l,!0,null,t,void 0,void 0,void 0,r,this._shaderLanguage,(function(){return(0,f.sH)(s,void 0,void 0,(function(){return(0,f.YH)(this,(function(e){switch(e.label){case 0:return 1!==this.shaderLanguage?[3,2]:[4,Promise.resolve().then(n.bind(n,7060))];case 1:return e.sent(),[3,4];case 2:return[4,Promise.resolve().then(n.bind(n,48063))];case 3:e.sent(),e.label=4;case 4:return[2]}}))}))}));for(E.samples=this._samples,E.onApplyObservable.add((function(e){e.setInt("maxFilterSize",s.blurMaxFilterSize),e.setFloat2("blurDir",0,1/s._blurTextureSizeY),e.setFloat("projectedParticleConstant",s._getProjectedParticleConstant()),e.setFloat("depthThreshold",s._getDepthThreshold()),s._postProcessRunningIndex++})),E.onSizeChangedObservable.add((function(){E._textures.forEach((function(e){e.texture.wrapU=_n.g.CLAMP_ADDRESSMODE,e.texture.wrapV=_n.g.CLAMP_ADDRESSMODE}))})),this._fixReusablePostProcess(E),T.autoClear=!1,E.autoClear=!1,v=[],y=0;y<2*this._blurNumIterations;++y)v[y]=1&y?E:T;return[d,m,v]},e.prototype._fixReusablePostProcess=function(e){e.isReusable()&&(e.onActivateObservable.add((function(){e._currentRenderTextureInd=(e._currentRenderTextureInd+1)%2})),e.onApplyObservable.add((function(){e._currentRenderTextureInd=(e._currentRenderTextureInd+1)%2})))},e.prototype._getProjectedParticleConstant=function(){var e,t;return this.blurFilterSize*this.particleSize*.05*(this._height/2)/Math.tan((null!==(t=null===(e=this._camera)||void 0===e?void 0:e.fov)&&void 0!==t?t:45*Math.PI/180)/2)},e.prototype._getDepthThreshold=function(){return this.particleSize/2*this.blurDepthScale},e.prototype.dispose=function(){var e,t,n,r;this.onDisposeObservable.hasObservers()&&this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),null===(e=this._rt)||void 0===e||e.dispose(),this._rt=null,null===(t=this._texture)||void 0===t||t.dispose(),this._texture=null,null===(n=this._rtBlur)||void 0===n||n.dispose(),this._rtBlur=null,null===(r=this._textureBlurred)||void 0===r||r.dispose(),this._textureBlurred=null,this._blurPostProcesses&&(this._blurPostProcesses[0].dispose(),this._blurPostProcesses[1].dispose()),this._blurPostProcesses=null},e}();!function(e){e[e.DepthTexture=0]="DepthTexture",e[e.DepthBlurredTexture=1]="DepthBlurredTexture",e[e.ThicknessTexture=2]="ThicknessTexture",e[e.ThicknessBlurredTexture=3]="ThicknessBlurredTexture",e[e.DiffuseTexture=4]="DiffuseTexture",e[e.Normals=5]="Normals",e[e.DiffuseRendering=6]="DiffuseRendering"}(NV||(NV={}));var GV=function(){function e(e,t,n){this._generateDiffuseTexture=!1,this.fluidColor=new u.v9(.085,.6375,.765),this.density=2,this.refractionStrength=.1,this.fresnelClamp=1,this.specularPower=250,this.minimumThickness=0,this.dirLight=new c.Pq(-2,-1,1).normalize(),this._debugFeature=1,this._debug=!1,this._enableBlurDepth=!0,this._blurDepthSizeDivisor=1,this._blurDepthFilterSize=7,this._blurDepthNumIterations=3,this._blurDepthMaxFilterSize=100,this._blurDepthDepthScale=10,this._enableBlurThickness=!0,this._blurThicknessSizeDivisor=1,this._blurThicknessFilterSize=5,this._blurThicknessNumIterations=1,this._useFixedThickness=!1,this._onUseVelocityChanged=new l.cP,this._useVelocity=!1,this._depthMapSize=null,this._thicknessMapSize=null,this._diffuseMapSize=null,this._samples=1,this._compositeMode=!1,this._shaderLanguage=0,this._scene=e,this._engine=e.getEngine(),this._camera=null!=t?t:e.activeCamera,this._needInitialization=!0,this._bgDepthTexture=null,this._invProjectionMatrix=new c.uq,this._depthClearColor=new u.ov(1e6,1e6,1e6,1),this._thicknessClearColor=new u.ov(0,0,0,1),this._depthRenderTarget=null,this._diffuseRenderTarget=null,this._thicknessRenderTarget=null,this._renderPostProcess=null,this._shaderLanguage=null!=n?n:this._engine.isWebGPU?1:0}return Object.defineProperty(e.prototype,"needInitialization",{get:function(){return this._needInitialization},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"generateDiffuseTexture",{get:function(){return this._generateDiffuseTexture},set:function(e){this._generateDiffuseTexture!==e&&(this._generateDiffuseTexture=e,this._needInitialization=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"debugFeature",{get:function(){return this._debugFeature},set:function(e){this._debugFeature!==e&&(this._needInitialization=!0,this._debugFeature=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"debug",{get:function(){return this._debug},set:function(e){this._debug!==e&&(this._debug=e,this._needInitialization=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"environmentMap",{get:function(){return this._environmentMap},set:function(e){this._environmentMap!==e&&(this._needInitialization=!0,this._environmentMap=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"enableBlurDepth",{get:function(){return this._enableBlurDepth},set:function(e){this._enableBlurDepth!==e&&(this._enableBlurDepth=e,this._needInitialization=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blurDepthSizeDivisor",{get:function(){return this._blurDepthSizeDivisor},set:function(e){this._blurDepthSizeDivisor!==e&&(this._blurDepthSizeDivisor=e,this._needInitialization=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blurDepthFilterSize",{get:function(){return this._blurDepthFilterSize},set:function(e){this._blurDepthFilterSize!==e&&(this._blurDepthFilterSize=e,this._setBlurParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blurDepthNumIterations",{get:function(){return this._blurDepthNumIterations},set:function(e){this._blurDepthNumIterations!==e&&(this._blurDepthNumIterations=e,this._setBlurParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blurDepthMaxFilterSize",{get:function(){return this._blurDepthMaxFilterSize},set:function(e){this._blurDepthMaxFilterSize!==e&&(this._blurDepthMaxFilterSize=e,this._setBlurParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blurDepthDepthScale",{get:function(){return this._blurDepthDepthScale},set:function(e){this._blurDepthDepthScale!==e&&(this._blurDepthDepthScale=e,this._setBlurParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"enableBlurThickness",{get:function(){return this._enableBlurThickness},set:function(e){this._enableBlurThickness!==e&&(this._enableBlurThickness=e,this._needInitialization=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blurThicknessSizeDivisor",{get:function(){return this._blurThicknessSizeDivisor},set:function(e){this._blurThicknessSizeDivisor!==e&&(this._blurThicknessSizeDivisor=e,this._needInitialization=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blurThicknessFilterSize",{get:function(){return this._blurThicknessFilterSize},set:function(e){this._blurThicknessFilterSize!==e&&(this._blurThicknessFilterSize=e,this._setBlurParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blurThicknessNumIterations",{get:function(){return this._blurThicknessNumIterations},set:function(e){this._blurThicknessNumIterations!==e&&(this._blurThicknessNumIterations=e,this._setBlurParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"useFixedThickness",{get:function(){return this._useFixedThickness},set:function(e){this._useFixedThickness!==e&&(this._useFixedThickness=e,this._needInitialization=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"useVelocity",{get:function(){return this._useVelocity},set:function(e){this._useVelocity!==e&&(this._useVelocity=e,this._needInitialization=!0,this._onUseVelocityChanged.notifyObservers(this))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"depthMapSize",{get:function(){return this._depthMapSize},set:function(e){this._depthMapSize!==e&&(this._depthMapSize=e,this._needInitialization=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thicknessMapSize",{get:function(){return this._thicknessMapSize},set:function(e){this._thicknessMapSize!==e&&(this._thicknessMapSize=e,this._needInitialization=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"diffuseMapSize",{get:function(){return this._diffuseMapSize},set:function(e){this._diffuseMapSize!==e&&(this._diffuseMapSize=e,this._needInitialization=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"samples",{get:function(){return this._samples},set:function(e){this._samples!==e&&(this._samples=e,this._needInitialization=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"compositeMode",{get:function(){return this._compositeMode},set:function(e){this._compositeMode!==e&&(this._compositeMode=e,this._needInitialization=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"camera",{get:function(){return this._camera},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shaderLanguage",{get:function(){return this._shaderLanguage},enumerable:!1,configurable:!0}),e.prototype._initialize=function(){var e,t,n;this.dispose(),this._needInitialization=!1;var r=null!==(e=this._depthMapSize)&&void 0!==e?e:this._engine.getRenderWidth(),i=null!==this._depthMapSize?Math.round(this._depthMapSize*this._engine.getRenderHeight()/this._engine.getRenderWidth()):this._engine.getRenderHeight();if(this._depthRenderTarget=new UV("Depth",this._scene,r,i,r,i,b.Y.TEXTURETYPE_FLOAT,b.Y.TEXTUREFORMAT_RG,b.Y.TEXTURETYPE_FLOAT,b.Y.TEXTUREFORMAT_RG,!1,this._camera,!0,this._samples,this._shaderLanguage),this._initializeRenderTarget(this._depthRenderTarget),this.generateDiffuseTexture){var o=null!==(t=this._diffuseMapSize)&&void 0!==t?t:this._engine.getRenderWidth(),a=null!==this._diffuseMapSize?Math.round(this._diffuseMapSize*this._engine.getRenderHeight()/this._engine.getRenderWidth()):this._engine.getRenderHeight();this._diffuseRenderTarget=new UV("Diffuse",this._scene,o,a,0,0,b.Y.TEXTURETYPE_UNSIGNED_BYTE,b.Y.TEXTUREFORMAT_RGBA,b.Y.TEXTURETYPE_UNSIGNED_BYTE,b.Y.TEXTUREFORMAT_RGBA,!0,this._camera,!0,this._samples,this._shaderLanguage),this._initializeRenderTarget(this._diffuseRenderTarget)}var s=null!==(n=this._thicknessMapSize)&&void 0!==n?n:this._engine.getRenderWidth(),l=null!==this._thicknessMapSize?Math.round(this._thicknessMapSize*this._engine.getRenderHeight()/this._engine.getRenderWidth()):this._engine.getRenderHeight();this._useFixedThickness||(this._thicknessRenderTarget=new UV("Thickness",this._scene,s,l,s,l,b.Y.TEXTURETYPE_HALF_FLOAT,b.Y.TEXTUREFORMAT_R,b.Y.TEXTURETYPE_HALF_FLOAT,b.Y.TEXTUREFORMAT_R,!0,this._camera,!1,this._samples,this._shaderLanguage),this._initializeRenderTarget(this._thicknessRenderTarget)),this._createLiquidRenderingPostProcess()},e.prototype._setBlurParameters=function(e){void 0===e&&(e=null),null!==e&&e!==this._depthRenderTarget||this._setBlurDepthParameters(),null!==e&&e!==this._thicknessRenderTarget||this._setBlurThicknessParameters()},e.prototype._setBlurDepthParameters=function(){this._depthRenderTarget&&(this._depthRenderTarget.blurFilterSize=this.blurDepthFilterSize,this._depthRenderTarget.blurMaxFilterSize=this.blurDepthMaxFilterSize,this._depthRenderTarget.blurNumIterations=this.blurDepthNumIterations,this._depthRenderTarget.blurDepthScale=this.blurDepthDepthScale)},e.prototype._setBlurThicknessParameters=function(){this._thicknessRenderTarget&&(this._thicknessRenderTarget.blurFilterSize=this.blurThicknessFilterSize,this._thicknessRenderTarget.blurNumIterations=this.blurThicknessNumIterations)},e.prototype._initializeRenderTarget=function(e){e!==this._diffuseRenderTarget&&(e.enableBlur=e===this._depthRenderTarget?this.enableBlurDepth:this.enableBlurThickness,e.blurSizeDivisor=e===this._depthRenderTarget?this.blurDepthSizeDivisor:this.blurThicknessSizeDivisor),this._setBlurParameters(e),e.initialize()},e.prototype._createLiquidRenderingPostProcess=function(){var e,t=this,r=this._scene.getEngine(),i=["viewMatrix","projectionMatrix","invProjectionMatrix","texelSize","dirLight","cameraFar","density","refractionStrength","fresnelClamp","specularPower"],o=["depthSampler"],a=[];if(this.dispose(!0),this._camera){var s=this._depthRenderTarget.enableBlur?this._depthRenderTarget.textureBlur:this._depthRenderTarget.texture,l=new c.I9(1/s.getSize().width,1/s.getSize().height);this._scene.useRightHandedSystem&&a.push("#define FLUIDRENDERING_RHS"),null!==this._environmentMap&&(null!==(e=this._environmentMap)&&void 0!==e?e:this._scene.environmentTexture)&&(o.push("reflectionSampler"),a.push("#define FLUIDRENDERING_ENVIRONMENT")),this._diffuseRenderTarget?(o.push("diffuseSampler"),a.push("#define FLUIDRENDERING_DIFFUSETEXTURE")):i.push("diffuseColor"),this._useVelocity&&(o.push("velocitySampler"),a.push("#define FLUIDRENDERING_VELOCITY")),this._useFixedThickness?(i.push("thickness"),o.push("bgDepthSampler"),a.push("#define FLUIDRENDERING_FIXED_THICKNESS")):(i.push("minimumThickness"),o.push("thicknessSampler")),this._compositeMode&&a.push("#define FLUIDRENDERING_COMPOSITE_MODE"),this._debug&&(a.push("#define FLUIDRENDERING_DEBUG"),5===this._debugFeature?a.push("#define FLUIDRENDERING_DEBUG_SHOWNORMAL"):6===this._debugFeature?a.push("#define FLUIDRENDERING_DEBUG_DIFFUSERENDERING"):(a.push("#define FLUIDRENDERING_DEBUG_TEXTURE"),o.push("debugSampler"),0!==this._debugFeature&&1!==this._debugFeature||a.push("#define FLUIDRENDERING_DEBUG_DEPTH"))),this._renderPostProcess=new Ci.w("FluidRendering","fluidRenderingRender",i,o,1,null,b.Y.TEXTURE_BILINEAR_SAMPLINGMODE,r,!1,null,b.Y.TEXTURETYPE_UNSIGNED_BYTE,void 0,void 0,!0,void 0,this._shaderLanguage,(function(){return(0,f.sH)(t,void 0,void 0,(function(){return(0,f.YH)(this,(function(e){switch(e.label){case 0:return 1!==this._shaderLanguage?[3,2]:[4,Promise.resolve().then(n.bind(n,94727))];case 1:return e.sent(),[3,4];case 2:return[4,Promise.resolve().then(n.bind(n,36870))];case 3:e.sent(),e.label=4;case 4:return[2]}}))}))})),this._renderPostProcess.updateEffect(a.join("\n")),this._renderPostProcess.samples=this._samples;var u=r,h=u.setTextureSampler;this._renderPostProcess.onApplyObservable.add((function(e){var n,r,i,o,a,s,c,d,p,f,m,_,g,v,y,b,S,T,E,x,P,C,R;if(t._invProjectionMatrix.copyFrom(t._scene.getProjectionMatrix()),t._invProjectionMatrix.invert(),h&&h.call(u,"textureSamplerSampler",t._renderPostProcess.inputTexture.texture),t._depthRenderTarget.enableBlur?(e.setTexture("depthSampler",t._depthRenderTarget.textureBlur),h&&h.call(u,"depthSamplerSampler",null!==(o=null===(i=t._depthRenderTarget.textureBlur)||void 0===i?void 0:i.getInternalTexture())&&void 0!==o?o:null)):(e.setTexture("depthSampler",t._depthRenderTarget.texture),h&&h.call(u,"depthSamplerSampler",null!==(r=null===(n=t._depthRenderTarget.texture)||void 0===n?void 0:n.getInternalTexture())&&void 0!==r?r:null)),t._diffuseRenderTarget?t._diffuseRenderTarget.enableBlur?(e.setTexture("diffuseSampler",t._diffuseRenderTarget.textureBlur),h&&h.call(u,"diffuseSamplerSampler",null!==(d=null===(c=t._diffuseRenderTarget.textureBlur)||void 0===c?void 0:c.getInternalTexture())&&void 0!==d?d:null)):(e.setTexture("diffuseSampler",t._diffuseRenderTarget.texture),h&&h.call(u,"diffuseSamplerSampler",null!==(s=null===(a=t._diffuseRenderTarget.texture)||void 0===a?void 0:a.getInternalTexture())&&void 0!==s?s:null)):e.setColor3("diffuseColor",t.fluidColor),t._useFixedThickness?(e.setFloat("thickness",t.minimumThickness),e._bindTexture("bgDepthSampler",t._bgDepthTexture),h&&h.call(u,"bgDepthSamplerSampler",null!==(p=t._bgDepthTexture)&&void 0!==p?p:null)):(t._thicknessRenderTarget.enableBlur?(e.setTexture("thicknessSampler",t._thicknessRenderTarget.textureBlur),h&&h.call(u,"thicknessSamplerSampler",null!==(g=null===(_=t._thicknessRenderTarget.textureBlur)||void 0===_?void 0:_.getInternalTexture())&&void 0!==g?g:null)):(e.setTexture("thicknessSampler",t._thicknessRenderTarget.texture),h&&h.call(u,"thicknessSamplerSampler",null!==(m=null===(f=t._thicknessRenderTarget.texture)||void 0===f?void 0:f.getInternalTexture())&&void 0!==m?m:null)),e.setFloat("minimumThickness",t.minimumThickness)),null!==t._environmentMap){var A=null!==(v=t._environmentMap)&&void 0!==v?v:t._scene.environmentTexture;A&&(e.setTexture("reflectionSampler",A),h&&h.call(u,"reflectionSamplerSampler",null!==(y=null==A?void 0:A.getInternalTexture())&&void 0!==y?y:null))}if(e.setMatrix("viewMatrix",t._scene.getViewMatrix()),e.setMatrix("invProjectionMatrix",t._invProjectionMatrix),e.setMatrix("projectionMatrix",t._scene.getProjectionMatrix()),e.setVector2("texelSize",l),e.setFloat("density",t.density),e.setFloat("refractionStrength",t.refractionStrength),e.setFloat("fresnelClamp",t.fresnelClamp),e.setFloat("specularPower",t.specularPower),e.setVector3("dirLight",t.dirLight),e.setFloat("cameraFar",t._camera.maxZ),t._debug){var I=null;switch(t._debugFeature){case 0:I=t._depthRenderTarget.texture;break;case 1:I=t._depthRenderTarget.enableBlur?t._depthRenderTarget.textureBlur:t._depthRenderTarget.texture;break;case 2:I=null!==(S=null===(b=t._thicknessRenderTarget)||void 0===b?void 0:b.texture)&&void 0!==S?S:null;break;case 3:I=(null===(T=t._thicknessRenderTarget)||void 0===T?void 0:T.enableBlur)?null!==(x=null===(E=t._thicknessRenderTarget)||void 0===E?void 0:E.textureBlur)&&void 0!==x?x:null:null!==(C=null===(P=t._thicknessRenderTarget)||void 0===P?void 0:P.texture)&&void 0!==C?C:null;break;case 4:t._diffuseRenderTarget&&(I=t._diffuseRenderTarget.texture)}5!==t._debugFeature&&(e.setTexture("debugSampler",I),h&&h.call(u,"debugSamplerSampler",null!==(R=null==I?void 0:I.getInternalTexture())&&void 0!==R?R:null))}}))}},e.prototype._clearTargets=function(){var e,t,n;(null===(e=this._depthRenderTarget)||void 0===e?void 0:e.renderTarget)&&(this._engine.bindFramebuffer(this._depthRenderTarget.renderTarget),this._engine.clear(this._depthClearColor,!0,!0,!1),this._engine.unBindFramebuffer(this._depthRenderTarget.renderTarget)),(null===(t=this._diffuseRenderTarget)||void 0===t?void 0:t.renderTarget)&&(this._engine.bindFramebuffer(this._diffuseRenderTarget.renderTarget),this._engine.clear(this._thicknessClearColor,!0,!0,!1),this._engine.unBindFramebuffer(this._diffuseRenderTarget.renderTarget)),(null===(n=this._thicknessRenderTarget)||void 0===n?void 0:n.renderTarget)&&(this._engine.bindFramebuffer(this._thicknessRenderTarget.renderTarget),this._engine.clear(this._thicknessClearColor,!0,!1,!1),this._engine.unBindFramebuffer(this._thicknessRenderTarget.renderTarget))},e.prototype._render=function(e){var t,n,r,i,o,a;if(!this._needInitialization&&e.isReady()){var s=this._engine._currentRenderTarget;this._engine.setState(!1,void 0,void 0,void 0,!0),this._engine.setDepthBuffer(!0),this._engine.setDepthWrite(!0),this._engine.setAlphaMode(b.Y.ALPHA_DISABLE),(null===(t=this._depthRenderTarget)||void 0===t?void 0:t.renderTarget)&&(this._engine.bindFramebuffer(this._depthRenderTarget.renderTarget),e.renderDepthTexture(),this._engine.unbindInstanceAttributes(),this._engine.unBindFramebuffer(this._depthRenderTarget.renderTarget)),(null===(n=this._diffuseRenderTarget)||void 0===n?void 0:n.renderTarget)&&(this._engine.bindFramebuffer(this._diffuseRenderTarget.renderTarget),e.renderDiffuseTexture(),this._engine.unbindInstanceAttributes(),this._engine.unBindFramebuffer(this._diffuseRenderTarget.renderTarget)),(null===(r=this._thicknessRenderTarget)||void 0===r?void 0:r.renderTarget)&&(this._engine.bindFramebuffer(this._thicknessRenderTarget.renderTarget),e.renderThicknessTexture(),this._engine.unbindInstanceAttributes(),this._engine.unBindFramebuffer(this._thicknessRenderTarget.renderTarget)),null===(i=this._depthRenderTarget)||void 0===i||i.applyBlurPostProcesses(),null===(o=this._diffuseRenderTarget)||void 0===o||o.applyBlurPostProcesses(),null===(a=this._thicknessRenderTarget)||void 0===a||a.applyBlurPostProcesses(),s&&this._engine.bindFramebuffer(s)}},e.prototype.dispose=function(e){var t,n,r,i;void 0===e&&(e=!1),e||(null===(t=this._depthRenderTarget)||void 0===t||t.dispose(),this._depthRenderTarget=null,null===(n=this._diffuseRenderTarget)||void 0===n||n.dispose(),this._diffuseRenderTarget=null,null===(r=this._thicknessRenderTarget)||void 0===r||r.dispose(),this._thicknessRenderTarget=null),this._renderPostProcess&&this._camera&&this._camera.detachPostProcess(this._renderPostProcess),null===(i=this._renderPostProcess)||void 0===i||i.dispose(),this._renderPostProcess=null,this._onUseVelocityChanged.clear(),this._needInitialization=!1},e}(),kV=function(e){function t(t,n,r,i){var o=e.call(this,t,i)||this;return o._numParticles=r,o._diffuseEffectWrapper=null,o._vertexBuffers={},o.addBuffers(n),o}return(0,f.C6)(t,e),t.prototype.getClassName=function(){return"FluidRenderingObjectCustomParticles"},Object.defineProperty(t.prototype,"vertexBuffers",{get:function(){return this._vertexBuffers},enumerable:!1,configurable:!0}),t.prototype.addBuffers=function(e){for(var t in e){var n=void 0,r=!0;switch(t){case"velocity":n=3;break;case"offset":r=!1}this._vertexBuffers[t]=new se.R(this._engine,e[t],t,!0,!1,n,r)}},t.prototype._createEffects=function(){var t=this;e.prototype._createEffects.call(this),this._diffuseEffectWrapper=new Ri.$({engine:this._engine,useShaderStore:!0,vertexShader:"fluidRenderingParticleDiffuse",fragmentShader:"fluidRenderingParticleDiffuse",attributeNames:["position","offset","color"],uniformNames:["view","projection","size"],samplerNames:[],shaderLanguage:this._shaderLanguage,extraInitializationsAsync:function(){return(0,f.sH)(t,void 0,void 0,(function(){return(0,f.YH)(this,(function(e){switch(e.label){case 0:return 1!==this._shaderLanguage?[3,2]:[4,Promise.resolve().then(n.bind(n,70183))];case 1:return e.sent(),[3,4];case 2:return[4,Promise.resolve().then(n.bind(n,45868))];case 3:e.sent(),e.label=4;case 4:return[2]}}))}))}})},t.prototype.isReady=function(){var t,n;return this._vertexBuffers.offset||(this._vertexBuffers.offset=new se.R(this._engine,[0,0,1,0,0,1,1,1],"offset",!1,!1,2)),e.prototype.isReady.call(this)&&null!==(n=null===(t=this._diffuseEffectWrapper)||void 0===t?void 0:t.effect.isReady())&&void 0!==n&&n},Object.defineProperty(t.prototype,"numParticles",{get:function(){return this._numParticles},enumerable:!1,configurable:!0}),t.prototype.setNumParticles=function(e){this._numParticles=e},t.prototype.renderDiffuseTexture=function(){var e=this.numParticles;if(this._diffuseEffectWrapper&&0!==e){var t=this._diffuseEffectWrapper.drawWrapper,n=t.effect;this._engine.enableEffect(t),this._engine.bindBuffers(this.vertexBuffers,this.indexBuffer,n),n.setMatrix("view",this._scene.getViewMatrix()),n.setMatrix("projection",this._scene.getProjectionMatrix()),null!==this._particleSize&&n.setFloat2("size",this._particleSize,this._particleSize),this.useInstancing?this._engine.drawArraysType(b.Y.MATERIAL_TriangleStripDrawMode,0,4,e):this._engine.drawElementsType(b.Y.MATERIAL_TriangleFillMode,0,e)}},t.prototype.dispose=function(){var t;for(var n in e.prototype.dispose.call(this),null===(t=this._diffuseEffectWrapper)||void 0===t||t.dispose(),this._vertexBuffers)this._vertexBuffers[n].dispose();this._vertexBuffers={}},t}(BV),zV=function(){function e(e,t,n,r){void 0===r&&(r=1),this._engine=e,this._copyTextureToTexture=new Wp(e,!0),this._depthRTWrapper=this._engine.createRenderTargetTexture({width:t,height:n},{generateMipMaps:!1,type:b.Y.TEXTURETYPE_UNSIGNED_BYTE,format:b.Y.TEXTUREFORMAT_R,samplingMode:b.Y.TEXTURE_NEAREST_SAMPLINGMODE,generateDepthBuffer:!0,generateStencilBuffer:!1,samples:r,noColorAttachment:!0,label:"FluidRenderingDepthTextureCopyRTT"}),this._depthRTWrapper.createDepthStencilTexture(0,!1,!1,1,void 0,"FluidRenderingDepthTextureCopyRTTDepthStencil").label="FluidDepthTextureCopy".concat(t,"x").concat(n,"x").concat(r)}return Object.defineProperty(e.prototype,"depthRTWrapper",{get:function(){return this._depthRTWrapper},enumerable:!1,configurable:!0}),e.prototype.copy=function(e){return this._copyTextureToTexture.copy(e,this._depthRTWrapper)},e.prototype.dispose=function(){this._depthRTWrapper.dispose(),this._copyTextureToTexture.dispose()},e}();function WV(e){return!!e.particleSystem}function HV(e){return!!e.addBuffers}Object.defineProperty(Vt.Z.prototype,"fluidRenderer",{get:function(){return this._fluidRenderer},set:function(e){this._fluidRenderer=e},enumerable:!0,configurable:!0}),Vt.Z.prototype.enableFluidRenderer=function(){return this._fluidRenderer||(this._fluidRenderer=new XV(this)),this._fluidRenderer},Vt.Z.prototype.disableFluidRenderer=function(){var e;null===(e=this._fluidRenderer)||void 0===e||e.dispose(),this._fluidRenderer=null};var YV=function(){function e(e){this.name=Ue.v.NAME_FLUIDRENDERER,this.scene=e}return e.prototype.register=function(){this.scene._gatherActiveCameraRenderTargetsStage.registerStep(Ue.v.STEP_GATHERACTIVECAMERARENDERTARGETS_FLUIDRENDERER,this,this._gatherActiveCameraRenderTargets),this.scene._afterCameraDrawStage.registerStep(Ue.v.STEP_AFTERCAMERADRAW_FLUIDRENDERER,this,this._afterCameraDraw)},e.prototype._gatherActiveCameraRenderTargets=function(e){var t;null===(t=this.scene.fluidRenderer)||void 0===t||t._prepareRendering()},e.prototype._afterCameraDraw=function(e){var t;null===(t=this.scene.fluidRenderer)||void 0===t||t._render(e)},e.prototype.rebuild=function(){var e=this.scene.fluidRenderer;if(e){for(var t=new Set,n=0;nt.object.priority?1:0}))},e.prototype._removeUnusedTargetRenderers=function(){for(var e,t={},n=0;nFragmentInputs {var cornerPos: vec3f=vec3f(\nvec2f(input.offset.x-0.5,input.offset.y-0.5)*uniforms.size,\n0.0\n);var viewPos: vec3f=(uniforms.view*vec4f(input.position,1.0)).xyz+cornerPos;vertexOutputs.position=uniforms.projection*vec4f(viewPos,1.0);vertexOutputs.uv=input.offset;vertexOutputs.diffuseColor=input.color.rgb;}\n";Bi.l.ShadersStoreWGSL[lU]||(Bi.l.ShadersStoreWGSL[lU]=cU);var uU={name:lU,shader:cU},hU=n(70183),dU=n(7060),pU=n(52063),fU=n(94727),mU=function(){function e(e,t,n){void 0===n&&(n={width:512,height:512}),this._lightTransformMatrix=c.uq.Identity(),this._enable=!1,this.forceUpdateLightParameters=!1,this._scene=e,this._light=t,this._textureDimensions=n,this._regularMatToMatWithPlugin=new Map,this._counters=[{name:"RSM Generation "+t.name,value:0}],this._createMultiRenderTarget(),this._recomputeLightTransformationMatrix(),this.enable=!0}return Object.defineProperty(e.prototype,"enable",{get:function(){return this._enable},set:function(e){this._enable!==e&&(this._enable=e,this._customRenderTarget(e))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"positionWorldTexture",{get:function(){return this._mrt.textures[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"normalWorldTexture",{get:function(){return this._mrt.textures[1]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fluxTexture",{get:function(){return this._mrt.textures[2]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"renderList",{get:function(){return this._mrt.renderList},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"light",{get:function(){return this._light},enumerable:!1,configurable:!0}),e.prototype.setTextureDimensions=function(e){var t=this._mrt.renderList;if(this._textureDimensions=e,this._disposeMultiRenderTarget(),this._createMultiRenderTarget(),t)for(var n=0,r=t;n;\n #endif\n #endif\n ",CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR:"\n #ifdef RSMCREATE\n var rsmColor = ".concat(this._varAlbedoName," * uniforms.rsmLightColor;\n #ifdef RSMCREATE_PROJTEXTURE\n {\n var strq = uniforms.rsmTextureProjectionMatrix * vec4f(fragmentInputs.vPositionW, 1.0);\n strq /= strq.w;\n rsmColor *= textureSample(rsmTextureProjectionSampler, rsmTextureProjectionSamplerSampler, strq.xy).rgb;\n }\n #endif\n #ifdef RSMCREATE_LIGHT_IS_SPOT\n {\n var cosAngle = max(0., dot(uniforms.rsmSpotInfo.xyz, normalize(fragmentInputs.vPositionW - uniforms.rsmLightPosition)));\n rsmColor = sign(cosAngle - uniforms.rsmSpotInfo.w) * rsmColor;\n }\n #endif\n\n #define MRT_AND_COLOR\n fragmentOutputs.fragData0 = vec4f(fragmentInputs.vPositionW, 1.);\n fragmentOutputs.fragData1 = vec4f(normalize(normalW) * 0.5 + 0.5, 1.);\n fragmentOutputs.fragData2 = vec4f(rsmColor, 1.);\n #endif\n ")}:{CUSTOM_FRAGMENT_BEGIN:"\n #ifdef RSMCREATE\n #extension GL_EXT_draw_buffers : require\n #endif\n ",CUSTOM_FRAGMENT_DEFINITIONS:"\n #ifdef RSMCREATE\n #ifdef RSMCREATE_PROJTEXTURE\n uniform highp sampler2D rsmTextureProjectionSampler; \n #endif\n layout(location = 0) out highp vec4 glFragData[3];\n vec4 glFragColor;\n #endif\n ",CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR:"\n #ifdef RSMCREATE\n vec3 rsmColor = ".concat(this._varAlbedoName," * rsmLightColor;\n #ifdef RSMCREATE_PROJTEXTURE\n {\n vec4 strq = rsmTextureProjectionMatrix * vec4(vPositionW, 1.0);\n strq /= strq.w;\n rsmColor *= texture2D(rsmTextureProjectionSampler, strq.xy).rgb;\n }\n #endif\n #ifdef RSMCREATE_LIGHT_IS_SPOT\n {\n float cosAngle = max(0., dot(rsmSpotInfo.xyz, normalize(vPositionW - rsmLightPosition)));\n rsmColor = sign(cosAngle - rsmSpotInfo.w) * rsmColor;\n }\n #endif\n glFragData[0] = vec4(vPositionW, 1.);\n glFragData[1] = vec4(normalize(normalW) * 0.5 + 0.5, 1.);\n glFragData[2] = vec4(rsmColor, 1.);\n #endif\n ")}},t.Name="RSMCreate",(0,f.Cg)([(0,ce.lK)()],t.prototype,"light",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"isEnabled",void 0),t}(Ro);(0,h.Y5)("BABYLON.RSMCreatePluginMaterial",gU);var vU=function(){function e(e){this.numSamples=400,this.radius=.1,this.intensity=.1,this.edgeArtifactCorrection=.1,this.rotateSample=!0,this.noiseFactor=100,this.useFullTexture=!1,this.rsm=e}return e.prototype.dispose=function(){this.rsm.dispose()},e}(),yU=function(){function e(e,t,n,r,i){void 0===n&&(n={width:256,height:256}),void 0===r&&(r=2048),void 0===i&&(i=b.Y.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV);var o=this;this._giRSM=[],this._blurRTT=null,this._blurPostProcesses=null,this._blurXPostprocess=null,this._blurYPostprocess=null,this._upsamplingXPostprocess=null,this._upsamplingYPostprocess=null,this._ppGlobalIllumination=[],this._firstActivation=!0,this._geomBufferEnabled=!1,this._geomBufferEnablePosition=!1,this._tempMatrix=new c.uq,this._enable=!1,this.pause=!1,this._enableBlur=!0,this._useQualityBlur=!1,this.blurDepthThreshold=.05,this.blurNormalThreshold=.25,this.blurKernel=12,this._forceFullSizeBlur=!1,this._useQualityUpsampling=!1,this.upsamplerKernel=6,this._showOnlyGI=!1,this._use32BitsDepthBuffer=!1,this._shaderLanguage=0,this._shadersLoaded=!1,this._onShaderLoadedObservable=new l.cP,this._scene=e,this._engine=e.getEngine(),this._outputDimensions=t,this._giTextureDimensions=n,this._giTextureType=i,this._materialsWithRenderPlugin=[],this._maxSamples=r,this._debugLayer=new Ly("debug layer",null,this._scene,!1),this._debugLayer.isEnabled=!1,this._counters=[],this._countersRTW=[],this._initShaderSourceAsync(),this.generateSampleTexture(r),this._drawPhaseObserver=this._scene.onBeforeDrawPhaseObservable.add((function(){var e,t,n,r,i=o._engine._currentRenderTarget,a=!1;if(o._enable&&o._shadersLoaded){!o.pause&&o._ppGlobalIllumination.length>0&&(o._scene.postProcessManager.directRender(o._ppGlobalIllumination,o._ppGlobalIllumination[0].inputTexture),o._engine.unBindFramebuffer(o._ppGlobalIllumination[0].inputTexture,!0),o._engine.setAlphaMode(b.Y.ALPHA_DISABLE),a=!0,o.enableBlur&&o._blurPostProcesses&&(o._scene.postProcessManager.directRender(o._blurPostProcesses,o._blurRTT.renderTarget,!0),o._engine.unBindFramebuffer(o._blurRTT.renderTarget,!0)));for(var s=0;s0&&r.isEnabled()&&r.material&&this._addGISupportToMaterial(r.material)}},Object.defineProperty(e.prototype,"countersGPU",{get:function(){return this._counters},enumerable:!1,configurable:!0}),e.prototype.recreateResources=function(e){var t=this;void 0===e&&(e=!1),this._shadersLoaded?(this._disposePostProcesses(e),this._createPostProcesses(),this._setPluginParameters()):this._onShaderLoadedObservable.addOnce((function(){t.recreateResources(e)}))},e.prototype.generateSampleTexture=function(e){var t;null===(t=this._sampleTexture)||void 0===t||t.dispose(),this._maxSamples=e;for(var n=new Float32Array(4*this._maxSamples),r=0;r=this._outputDimensions.width&&this._giTextureDimensions.height>=this._outputDimensions.height||this._forceFullSizeBlur)v.push(this._blurRTT.renderTarget);else{var y=[];this._counters.push({name:"GI upsampling",value:0}),this._countersRTW.push(y),this._upsamplingXPostprocess=new Ci.w(this._useQualityUpsampling?"BilateralUpsampling":"BilateralUpsamplingX",this._useQualityUpsampling?"bilateralBlurQuality":"bilateralBlur",{uniforms:["filterSize","blurDir","depthThreshold","normalThreshold"],samplers:["depthSampler","normalSampler"],defines:s?"#define DECODE_NORMAL":void 0,size:g,samplingMode:b.Y.TEXTURE_BILINEAR_SAMPLINGMODE,engine:this._engine,textureType:this._giTextureType,textureFormat:o,shaderLanguage:this._shaderLanguage}),this._upsamplingXPostprocess.autoClear=!1,this._upsamplingXPostprocess.onApplyObservable.add((function(e){e.setTexture("depthSampler",a.getGBuffer().textures[a.getTextureIndex(dw.DEPTH_TEXTURE_TYPE)]),e.setTexture("normalSampler",a.getGBuffer().textures[a.getTextureIndex(dw.NORMAL_TEXTURE_TYPE)]),e.setInt("filterSize",i.upsamplerKernel),e.setFloat2("blurDir",1/i._outputDimensions.width,i._useQualityUpsampling?1/i._outputDimensions.height:0),e.setFloat("depthThreshold",i.blurDepthThreshold),e.setFloat("normalThreshold",i.blurNormalThreshold)})),this._upsamplingXPostprocess.resize(g.width,g.height),v.push(this._upsamplingXPostprocess.inputTexture),this.useQualityUpsampling||(this._upsamplingYPostprocess=new Ci.w("BilateralUpsamplingY","bilateralBlur",{uniforms:["filterSize","blurDir","depthThreshold","normalThreshold"],samplers:["depthSampler","normalSampler"],defines:s?"#define DECODE_NORMAL":void 0,size:this._outputDimensions,samplingMode:b.Y.TEXTURE_BILINEAR_SAMPLINGMODE,engine:this._engine,textureType:this._giTextureType,textureFormat:o,shaderLanguage:this._shaderLanguage}),this._upsamplingYPostprocess.autoClear=!1,this._upsamplingYPostprocess.onApplyObservable.add((function(e){e.setTexture("depthSampler",a.getGBuffer().textures[a.getTextureIndex(dw.DEPTH_TEXTURE_TYPE)]),e.setTexture("normalSampler",a.getGBuffer().textures[a.getTextureIndex(dw.NORMAL_TEXTURE_TYPE)]),e.setInt("filterSize",i.upsamplerKernel),e.setFloat2("blurDir",0,1/i._outputDimensions.height),e.setFloat("depthThreshold",i.blurDepthThreshold),e.setFloat("normalThreshold",i.blurNormalThreshold)})),this._upsamplingYPostprocess.resize(this._outputDimensions.width,this._outputDimensions.height),y.push(this._upsamplingYPostprocess.inputTexture)),y.push(this._blurRTT.renderTarget),this._blurPostProcesses.push(this._upsamplingXPostprocess),this._upsamplingYPostprocess&&this._blurPostProcesses.push(this._upsamplingYPostprocess)}}null===(r=this._debugLayer.texture)||void 0===r||r.dispose(),this._debugLayer.texture=new z_.t(this._scene,this._enableBlur?this._blurRTT.renderTarget.texture:this._ppGlobalIllumination[0].inputTexture.texture)}},e.prototype._addGISupportToMaterial=function(e){var t;if(!(null===(t=e.pluginManager)||void 0===t?void 0:t.getPlugin(SU.Name))){var n=new SU(e);this._enable&&this._ppGlobalIllumination.length>0&&(n.textureGIContrib=this._ppGlobalIllumination[0].inputTexture.texture,n.outputTextureWidth=this._outputDimensions.width,n.outputTextureHeight=this._outputDimensions.height),n.isEnabled=this._enable,this._materialsWithRenderPlugin.push(e)}},e.GeometryBufferTextureTypesAndFormats={0:{textureType:b.Y.TEXTURETYPE_HALF_FLOAT,textureFormat:b.Y.TEXTUREFORMAT_R},1:{textureType:b.Y.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV,textureFormat:b.Y.TEXTUREFORMAT_RGBA},2:{textureType:b.Y.TEXTURETYPE_HALF_FLOAT,textureFormat:b.Y.TEXTUREFORMAT_RGBA}},e}(),bU=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.RENDER_WITH_GIRSM=!1,t.RSMCREATE_PROJTEXTURE=!1,t}return(0,f.C6)(t,e),t}(ho),SU=function(e){function t(n){var r=e.call(this,n,t.Name,310,new bU)||this;return r._isEnabled=!1,r.isEnabled=!1,r._internalMarkAllSubMeshesAsTexturesDirty=n._dirtyCallbacks[b.Y.MATERIAL_TextureDirtyFlag],r._isPBR=n instanceof gg,r}return(0,f.C6)(t,e),t.prototype._markAllSubMeshesAsTexturesDirty=function(){this._enable(this._isEnabled),this._internalMarkAllSubMeshesAsTexturesDirty()},t.prototype.isCompatible=function(){return!0},t.prototype.prepareDefines=function(e){e.RENDER_WITH_GIRSM=this._isEnabled},t.prototype.getClassName=function(){return"GIRSMRenderPluginMaterial"},t.prototype.getUniforms=function(){return{ubo:[{name:"girsmTextureOutputSize",size:2,type:"vec2"}],fragment:"#ifdef RENDER_WITH_GIRSM\n uniform vec2 girsmTextureOutputSize;\n #endif"}},t.prototype.getSamplers=function(e){e.push("girsmTextureGIContrib")},t.prototype.bindForSubMesh=function(e){this._isEnabled&&(e.bindTexture("girsmTextureGIContrib",this.textureGIContrib),e.updateFloat2("girsmTextureOutputSize",this.outputTextureWidth,this.outputTextureHeight))},t.prototype.getCustomCode=function(e,t){var n;return 1===t?(n={CUSTOM_FRAGMENT_DEFINITIONS:"\n #ifdef RENDER_WITH_GIRSM\n var girsmTextureGIContribSampler: sampler;\n var girsmTextureGIContrib: texture_2d;\n\n fn computeIndirect() -> vec3f {\n var uv = fragmentInputs.position.xy / uniforms.girsmTextureOutputSize;\n return textureSample(girsmTextureGIContrib, girsmTextureGIContribSampler, uv).rgb;\n }\n #endif\n ",CUSTOM_FRAGMENT_BEFORE_FINALCOLORCOMPOSITION:"\n #ifdef RENDER_WITH_GIRSM\n finalDiffuse += computeIndirect() * surfaceAlbedo.rgb;\n #endif\n "},this._isPBR||(n.CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR="\n #ifdef RENDER_WITH_GIRSM\n color = vec4f(color.rgb + computeIndirect() * baseColor.rgb, color.a);\n #endif\n ")):(n={CUSTOM_FRAGMENT_DEFINITIONS:"\n #ifdef RENDER_WITH_GIRSM\n uniform sampler2D girsmTextureGIContrib;\n\n vec3 computeIndirect() {\n vec2 uv = gl_FragCoord.xy / girsmTextureOutputSize;\n return texture2D(girsmTextureGIContrib, uv).rgb;\n }\n #endif\n ",CUSTOM_FRAGMENT_BEFORE_FINALCOLORCOMPOSITION:"\n #ifdef RENDER_WITH_GIRSM\n finalDiffuse += computeIndirect() * surfaceAlbedo.rgb;\n #endif\n "},this._isPBR||(n.CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR="\n #ifdef RENDER_WITH_GIRSM\n color.rgb += computeIndirect() * baseColor.rgb;\n #endif\n ")),"vertex"===e?null:n},t.Name="GIRSMRender",(0,f.Cg)([(0,ce.lK)()],t.prototype,"textureGIContrib",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"outputTextureWidth",void 0),(0,f.Cg)([(0,ce.lK)()],t.prototype,"outputTextureHeight",void 0),(0,f.Cg)([(0,ce.lK)(),(0,ce.$z)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"isEnabled",void 0),t}(Ro);(0,h.Y5)("BABYLON.GIRSMRenderPluginMaterial",SU);var TU=n(87851),EU=n(12132),xU=n(76526),PU=n(91209),CU=n(38884),RU=n(15229),AU=n(47257),IU=n(97666),OU=n(80119),MU=n(62004),DU=n(31086),NU=n(51319),FU=n(40877),LU=n(72627),wU=n(67569),BU=n(30025),VU=n(34063),UU=n(97468),GU=n(60738),kU=n(34873),zU=n(63327),WU=n(23338),HU=n(18924),YU=n(61189),XU=n(27179),jU=n(37592),qU=n(79147),KU=n(53365),ZU=n(75626),QU=n(45310),JU=n(35139),$U=n(79401),eG=n(31984),tG=n(21181),nG=n(84586),rG="iblShadowsCombinePixelShader",iG="precision highp float;varying vec2 vUV;uniform sampler2D shadowSampler;uniform sampler2D textureSampler;uniform float shadowOpacity;void main(void)\n{vec3 shadow=texture(shadowSampler,vUV).rgb;vec3 sceneColor=texture(textureSampler,vUV).rgb;float shadowValue=mix(1.0,shadow.x,shadowOpacity);gl_FragColor=vec4(sceneColor*shadowValue,1.0);}";Bi.l.ShadersStore[rG]||(Bi.l.ShadersStore[rG]=iG);var oG={name:rG,shader:iG},aG="iblShadowsCombinePixelShader",sG="varying vUV: vec2f;var shadowSamplerSampler : sampler;var shadowSampler : texture_2d;var textureSamplerSampler: sampler;var textureSampler: texture_2d;uniform shadowOpacity: f32;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {var shadow\n: vec3f =\ntextureSample(shadowSampler,shadowSamplerSampler,input.vUV).rgb;var color\n: vec3f =\ntextureSample(textureSampler,textureSamplerSampler,input.vUV).rgb;var shadowValue: f32=mix(1.0,shadow.x,uniforms.shadowOpacity);fragmentOutputs.color=vec4f(color*shadowValue,1.0);}";Bi.l.ShadersStoreWGSL[aG]||(Bi.l.ShadersStoreWGSL[aG]=sG);var lG={name:aG,shader:sG},cG=n(8866),uG=n(82911),hG=n(92228),dG=n(52651),pG=n(41745),fG=n(75866),mG=n(24019),_G=n(43212),gG=n(76686),vG=n(78145),yG=n(59214),bG=n(18985),SG=n(68202),TG=n(11469),EG=n(17874),xG=n(35819),PG=n(25773),CG=n(79504),RG=n(76933),AG=n(39768),IG=n(81487),OG=n(90453),MG=n(30738),DG=n(90564),NG=n(48533),FG=n(42362),LG=n(99032),wG=n(77142),BG=n(64015),VG=n(56809),UG=n(37624),GG=n(73758),kG=n(27993),zG=n(5519),WG="spriteMapPixelShader";Bi.l.ShadersStore[WG]||(Bi.l.ShadersStore[WG]="#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\n#define TEXTUREFUNC(s,c,l) texture2DLodEXT(s,c,l)\n#else\n#define TEXTUREFUNC(s,c,b) texture2D(s,c,b)\n#endif\nprecision highp float;varying vec3 vPosition;varying vec2 vUV;varying vec2 tUV;uniform float time;uniform float spriteCount;uniform sampler2D spriteSheet;uniform vec2 spriteMapSize;uniform vec2 outputSize;uniform vec2 stageSize;uniform sampler2D frameMap;uniform sampler2D tileMaps[LAYERS];uniform sampler2D animationMap;uniform vec3 colorMul;\n#include\n#include\nfloat mt;const float fdStep=1.0*0.25;const float aFrameSteps=MAX_ANIMATION_FRAMES==0.0 ? 0.0 : 1.0/MAX_ANIMATION_FRAMES;mat4 getFrameData(float frameID) {float fX=frameID/spriteCount;return mat4(\nTEXTUREFUNC(frameMap,vec2(fX,0.0),0.0),\nTEXTUREFUNC(frameMap,vec2(fX,fdStep*1.0),0.0),\nTEXTUREFUNC(frameMap,vec2(fX,fdStep*2.0),0.0),\nvec4(0.0)\n);}\nvoid main() {vec4 color=vec4(0.0);vec2 tileUV=fract(tUV);vec2 tileID=floor(tUV);vec2 sheetUnits=1.0/spriteMapSize;float spriteUnits=1.0/spriteCount;vec2 stageUnits=1.0/stageSize;for(int i=0; i0.0) {mt=mod(time*animationData.z,1.0);for(float f=0.0; fmt) {frameID=animationData.x;break;}\nanimationData=TEXTUREFUNC(animationMap,vec2((frameID+0.5)/spriteCount,aFrameSteps*f),0.0);}}\nmat4 frameData=getFrameData(frameID+0.5);vec2 frameSize=(frameData[0].zw)/spriteMapSize;vec2 offset=frameData[0].xy*sheetUnits;vec2 ratio=frameData[2].xy/frameData[0].zw;\n#ifdef FR_CW\nif (frameData[2].z==1.0) {tileUV.xy=tileUV.yx;} else {tileUV.xy=fract(tUV).xy;}\n#ifdef FLIPU\ntileUV.y=1.0-tileUV.y;\n#endif\n#else\nif (frameData[2].z==1.0) {\n#ifdef FLIPU\ntileUV.y=1.0-tileUV.y;\n#endif\ntileUV.xy=tileUV.yx;} else {tileUV.xy=fract(tUV).xy;\n#ifdef FLIPU\ntileUV.y=1.0-tileUV.y;\n#endif\n}\n#endif\nvec4 nc=TEXTUREFUNC(spriteSheet,tileUV*frameSize+offset,0.0);if (i==0) {color=nc;} else {float alpha=min(color.a+nc.a,1.0);vec3 mixed=mix(color.xyz,nc.xyz,nc.a);color=vec4(mixed,alpha);}}\ncolor.xyz*=colorMul;\n#include\n#include\ngl_FragColor=color;}");var HG,YG="spriteMapVertexShader";Bi.l.ShadersStore[YG]||(Bi.l.ShadersStore[YG]="precision highp float;attribute vec3 position;attribute vec3 normal;attribute vec2 uv;varying vec3 vPosition;varying vec2 vUV;varying vec2 tUV;uniform float time;uniform mat4 world;uniform mat4 view;uniform mat4 projection;uniform vec2 stageSize;uniform float stageScale;\n#include\n#include\nvoid main() {vec4 p=vec4( position,1. );vPosition=p.xyz;vUV=uv;tUV=uv*stageSize; \nvec3 viewPos=(view*world*p).xyz; \ngl_Position=projection*vec4(viewPos,1.0); \n#ifdef FOG\nvFogDistance=viewPos;\n#endif\n#include\n}"),function(e){e[e.CCW=0]="CCW",e[e.CW=1]="CW"}(HG||(HG={}));var XG,jG,qG=function(){function e(e,t,n,r,i){var o=this;this.name=e,this.sprites=[],this.atlasJSON=t,this.sprites=this.atlasJSON.frames,this.spriteSheet=n,this.options=r,r.stageSize=r.stageSize||new c.I9(1,1),r.outputSize=r.outputSize||r.stageSize,r.outputPosition=r.outputPosition||c.Pq.Zero(),r.outputRotation=r.outputRotation||c.Pq.Zero(),r.layerCount=r.layerCount||1,r.maxAnimationFrames=r.maxAnimationFrames||0,r.baseTile=r.baseTile||0,r.flipU=r.flipU||!1,r.colorMultiply=r.colorMultiply||new c.Pq(1,1,1),this._scene=i,this._frameMap=this._createFrameBuffer(),this._tileMaps=[];for(var a=0;a0&&(e+="\n\r"),e+=this._tileMaps[t]._texture._bufferView.toString();var n=document.createElement("a");n.href="data:octet/stream;charset=utf-8,"+encodeURI(e),n.target="_blank",n.download=this.name+".tilemaps",n.click(),n.remove()},e.prototype.loadTileMaps=function(e){var t=this,n=new XMLHttpRequest;n.open("GET",e);var r=this.options.layerCount||0;n.onload=function(){for(var e=n.response.split("\n\r"),i=0;i0&&this.onFeaturePointsAddedObservable.notifyObservers(i),r.length>0&&this.onFeaturePointsUpdatedObservable.notifyObservers(r)}}},t.prototype._init=function(){this._xrSessionManager.session.trySetFeaturePointCloudEnabled&&this._xrSessionManager.session.trySetFeaturePointCloudEnabled(!0)&&(this._enabled=!0)},t.Name=ur.FEATURE_POINTS,t.Version=1,t}(gv);hr.AddWebXRFeature(uk.Name,(function(e){return function(){return new uk(e)}}),uk.Version);var hk,dk=0,pk=function(e){function t(t,n){void 0===n&&(n={});var r=e.call(this,t)||this;return r._options=n,r._detectedMeshes=new Map,r.onMeshAddedObservable=new l.cP,r.onMeshRemovedObservable=new l.cP,r.onMeshUpdatedObservable=new l.cP,r.xrNativeFeatureName="mesh-detection",r._options.generateMeshes&&(r._options.convertCoordinateSystems=!0),r._xrSessionManager.session?r._init():r._xrSessionManager.onXRSessionInit.addOnce((function(){r._init()})),r}return(0,f.C6)(t,e),t.prototype.detach=function(){var t=this;return!!e.prototype.detach.call(this)&&(this._xrSessionManager.isNative&&this._xrSessionManager.session.trySetMeshDetectorEnabled&&this._xrSessionManager.session.trySetMeshDetectorEnabled(!1),this._options.doNotRemoveMeshesOnSessionEnded||(this._detectedMeshes.forEach((function(e){t.onMeshRemovedObservable.notifyObservers(e)})),this._detectedMeshes.clear()),!0)},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.onMeshAddedObservable.clear(),this.onMeshRemovedObservable.clear(),this.onMeshUpdatedObservable.clear()},t.prototype._onXRFrame=function(e){var t,n=this;try{if(!this.attached||!e)return;var r=e.detectedMeshes||(null===(t=e.worldInformation)||void 0===t?void 0:t.detectedMeshes);if(r){var i=new Set;this._detectedMeshes.forEach((function(e,t){r.has(t)||i.add(t)})),i.forEach((function(e){var t=n._detectedMeshes.get(e);t&&(n.onMeshRemovedObservable.notifyObservers(t),n._detectedMeshes.delete(e))})),r.forEach((function(t){if(n._detectedMeshes.has(t))t.lastChangedTime===n._xrSessionManager.currentTimestamp&&(i=n._detectedMeshes.get(t))&&(n._updateVertexDataWithXRMesh(t,i,e),n.onMeshUpdatedObservable.notifyObservers(i));else{var r={id:dk++,xrMesh:t},i=n._updateVertexDataWithXRMesh(t,r,e);n._detectedMeshes.set(t,i),n.onMeshAddedObservable.notifyObservers(i)}}))}}catch(e){y.V.Log(e.stack)}},t.prototype._init=function(){this._xrSessionManager.isNative&&(this._xrSessionManager.session.trySetMeshDetectorEnabled&&this._xrSessionManager.session.trySetMeshDetectorEnabled(!0),this._options.preferredDetectorOptions&&this._xrSessionManager.session.trySetPreferredMeshDetectorOptions&&this._xrSessionManager.session.trySetPreferredMeshDetectorOptions(this._options.preferredDetectorOptions))},t.prototype._updateVertexDataWithXRMesh=function(e,t,n){var r;t.xrMesh=e,t.worldParentNode=this._options.worldParentNode;var i=e.vertices||e.positions;if(this._options.convertCoordinateSystems){if(this._xrSessionManager.scene.useRightHandedSystem)t.positions=i,t.normals=e.normals;else{t.positions=new Float32Array(i.length);for(var o=0;o0?hk.Received:hk.NotReceived,[2]}}))}))},t.Name=ur.IMAGE_TRACKING,t.Version=1,t}(gv);hr.AddWebXRFeature(fk.Name,(function(e,t){return function(){return new fk(e,t)}}),fk.Version,!1);var mk=function(e){function t(t,n){var r=e.call(this,t)||this;return r.options=n,r._domOverlayType=null,r._beforeXRSelectListener=null,r._element=null,r.xrNativeFeatureName="dom-overlay",Z.S0.Warn("dom-overlay is an experimental and unstable feature."),r}return(0,f.C6)(t,e),t.prototype.attach=function(){return!(!e.prototype.attach.call(this)||!this._xrSessionManager.session.domOverlayState||null===this._xrSessionManager.session.domOverlayState.type||(this._domOverlayType=this._xrSessionManager.session.domOverlayState.type,null!==this._element&&!0===this.options.supressXRSelectEvents&&(this._beforeXRSelectListener=function(e){e.preventDefault()},this._element.addEventListener("beforexrselect",this._beforeXRSelectListener)),0))},Object.defineProperty(t.prototype,"domOverlayType",{get:function(){return this._domOverlayType},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){e.prototype.dispose.call(this),null!==this._element&&this._beforeXRSelectListener&&this._element.removeEventListener("beforexrselect",this._beforeXRSelectListener)},t.prototype._onXRFrame=function(e){},t.prototype.getXRSessionInitExtension=function(){return(0,f.sH)(this,void 0,void 0,(function(){var e;return(0,f.YH)(this,(function(t){if(void 0===this.options.element)return Z.S0.Warn('"element" option must be provided to attach xr-dom-overlay feature.'),[2,{}];if("string"==typeof this.options.element){if(null===(e=document.querySelector(this.options.element)))return Z.S0.Warn("element not found '".concat(this.options.element,"' (not requesting xr-dom-overlay)")),[2,{}];this._element=e}else this._element=this.options.element;return[2,{domOverlay:{root:this._element}}]}))}))},t.Name=ur.DOM_OVERLAY,t.Version=1,t}(gv);hr.AddWebXRFeature(mk.Name,(function(e,t){return function(){return new mk(e,t)}}),mk.Version,!1);var _k=function(e){function t(n,r){var i,o,a,s,l,u,h,d,p=e.call(this,n)||this;return p._controllers={},p._currentRegistrationConfigurations=[],p._movementDirection=new c.PT,p._tmpRotationMatrix=c.uq.Identity(),p._tmpTranslationDirection=new c.Pq,p._tmpMovementTranslation=new c.Pq,p._tempCacheQuaternion=new c.PT,p._attachController=function(e){if(!p._controllers[e.uniqueId]){p._controllers[e.uniqueId]={xrController:e,registeredComponents:[]};var t=p._controllers[e.uniqueId];if("tracked-pointer"===t.xrController.inputSource.targetRayMode&&t.xrController.inputSource.gamepad){var n=function(){if(e.motionController)for(var n=function(n){var r=null;if(n.allowedComponentTypes)for(var i=0,o=n.allowedComponentTypes;in.rotationThreshold?e.x:0,t.rotateY=Math.abs(e.y)>n.rotationThreshold?e.y:0}},{allowedComponentTypes:[Pg.THUMBSTICK_TYPE,Pg.TOUCHPAD_TYPE],forceHandedness:"right",axisChangedHandler:function(e,t,n){t.moveX=Math.abs(e.x)>n.movementThreshold?e.x:0,t.moveY=Math.abs(e.y)>n.movementThreshold?e.y:0}}]},t.Version=1,t}(gv);hr.AddWebXRFeature(_k.Name,(function(e,t){return function(){return new _k(e,t)}}),_k.Version,!0);var gk=function(e){function t(t,n){var r=e.call(this,t)||this;return r.options=n,r._canvasContext=null,r._reflectionCubeMap=null,r._xrLightEstimate=null,r._xrLightProbe=null,r._xrWebGLBinding=null,r._lightDirection=c.Pq.Up().negateInPlace(),r._lightColor=u.v9.White(),r._intensity=1,r._sphericalHarmonics=new Uh.O,r._cubeMapPollTime=Date.now(),r._lightEstimationPollTime=Date.now(),r._reflectionCubeMapTextureSize=16,r.directionalLight=null,r.onReflectionCubeMapUpdatedObservable=new l.cP,r._updateReflectionCubeMap=function(){var e;if(r._xrLightProbe){if(r.options.cubeMapPollInterval){var t=Date.now();if(t-r._cubeMapPollTime=this._samples.length)throw new Error("Index out of bounds");return this._samples[(this._idx+e)%this._samples.length]},e}(),bk=function(){function e(){this._samples=new yk(20),this._entropy=0,this.onFirstStepDetected=new l.cP}return e.prototype.update=function(e,t,n,r){this._samples.push(e,t);var i=this._samples.at(0);if(this._entropy*=this._entropyDecayFactor,this._entropy+=c.I9.Distance(i,this._samples.at(1)),!(this._entropy>this._entropyThreshold)){var o;for(o=this._samePointCheckStartIdx;oa&&(s=u,a=l);if(!(ao*this._squaredProjectionDistanceThreshold)){var _=c.AA.Vector3[0];_.set(n,r,0);var g=c.AA.Vector3[1];g.set(d.x,d.y,0);var v=c.Pq.Cross(_,g).z>0,y=i.clone(),b=i.clone();h.subtractToRef(i,d),v?(d.scaleAndAddToRef(this._axisToApexShrinkFactor,y),d.scaleAndAddToRef(this._axisToApexExtendFactor,b)):(d.scaleAndAddToRef(this._axisToApexExtendFactor,y),d.scaleAndAddToRef(this._axisToApexShrinkFactor,b)),this.onFirstStepDetected.notifyObservers({leftApex:y,rightApex:b,currentPosition:i,currentStepDirection:v?"right":"left"})}}}}},e.prototype.reset=function(){for(var e=0;ethis._maxT&&(this._maxT=this._t,this._maxTPosition.copyFromFloats(e,t)),!(this._vitalityn&&(this.onMovement.notifyObservers({deltaT:this._t-n}),n<.5&&this._t>=.5&&this.onFootfall.notifyObservers({foot:this._steppingLeft?"left":"right"})),this._t<.95*this._maxT&&(this._currentPosition.copyFromFloats(e,t),this._steppingLeft?this._leftApex.copyFrom(this._maxTPosition):this._rightApex.copyFrom(this._maxTPosition),this._reset(this._leftApex,this._rightApex,this._currentPosition,!this._steppingLeft)),this._axisLength<.03))},Object.defineProperty(e.prototype,"_vitalityThreshold",{get:function(){return.1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"forward",{get:function(){return this._forward},enumerable:!1,configurable:!0}),e}(),Tk=function(){function e(t){var n=this;this._detector=new bk,this._walker=null,this._movement=new c.I9,this._millisecondsSinceLastUpdate=e._MillisecondsPerUpdate,this.movementThisFrame=c.Pq.Zero(),this._engine=t,this._detector.onFirstStepDetected.add((function(e){n._walker||(n._walker=new Sk(e.leftApex,e.rightApex,e.currentPosition,e.currentStepDirection),n._walker.onFootfall.add((function(){y.V.Log("Footfall!")})),n._walker.onMovement.add((function(e){n._walker.forward.scaleAndAddToRef(.024*e.deltaT,n._movement)})))}))}return Object.defineProperty(e,"_MillisecondsPerUpdate",{get:function(){return 1e3/15},enumerable:!1,configurable:!0}),e.prototype.update=function(t,n){n.y=0,n.normalize(),this._millisecondsSinceLastUpdate+=this._engine.getDeltaTime(),this._millisecondsSinceLastUpdate>=e._MillisecondsPerUpdate&&(this._millisecondsSinceLastUpdate-=e._MillisecondsPerUpdate,this._detector.update(t.x,t.z,n.x,n.z),this._walker&&(this._walker.update(t.x,t.z)||(this._walker=null)),this._movement.scaleInPlace(.85)),this.movementThisFrame.set(this._movement.x,0,this._movement.y)},e}(),Ek=function(e){function t(t,n){var r=e.call(this,t)||this;return r._up=new c.Pq,r._forward=new c.Pq,r._position=new c.Pq,r._movement=new c.Pq,r._sessionManager=t,r.locomotionTarget=n.locomotionTarget,r._isLocomotionTargetWebXRCamera&&y.V.Warn("Using walking locomotion directly on a WebXRCamera may have unintended interactions with other XR techniques. Using an XR space parent is highly recommended"),r}return(0,f.C6)(t,e),Object.defineProperty(t,"Name",{get:function(){return ur.WALKING_LOCOMOTION},enumerable:!1,configurable:!0}),Object.defineProperty(t,"Version",{get:function(){return 1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"locomotionTarget",{get:function(){return this._locomotionTarget},set:function(e){this._locomotionTarget=e,this._isLocomotionTargetWebXRCamera="WebXRCamera"===this._locomotionTarget.getClassName()},enumerable:!1,configurable:!0}),t.prototype.isCompatible=function(){return void 0===this._sessionManager.sessionMode||"immersive-vr"===this._sessionManager.sessionMode},t.prototype.attach=function(){return!(!this.isCompatible||!e.prototype.attach.call(this)||(this._walker=new Tk(this._sessionManager.scene.getEngine()),0))},t.prototype.detach=function(){return!!e.prototype.detach.call(this)&&(this._walker=null,!0)},t.prototype._onXRFrame=function(e){var t=e.getViewerPose(this._sessionManager.baseReferenceSpace);if(t){var n=this.locomotionTarget.getScene().useRightHandedSystem?1:-1,r=t.transform.matrix;this._up.copyFromFloats(r[4],r[5],n*r[6]),this._forward.copyFromFloats(r[8],r[9],n*r[10]),this._position.copyFromFloats(r[12],r[13],n*r[14]),this._forward.scaleAndAddToRef(.05,this._position),this._up.scaleAndAddToRef(-.05,this._position),this._walker.update(this._position,this._forward),this._movement.copyFrom(this._walker.movementThisFrame),this._isLocomotionTargetWebXRCamera||c.Pq.TransformNormalToRef(this._movement,this.locomotionTarget.getWorldMatrix(),this._movement),this.locomotionTarget.position.addInPlace(this._movement)}},t}(gv);hr.AddWebXRFeature(Ek.Name,(function(e,t){return function(){return new Ek(e,t)}}),Ek.Version,!1);var xk=function(e){function t(t,n,r,i,o,a,s){void 0===s&&(s=null);var l=e.call(this,t,n,r,i,a)||this;return l.getWidth=t,l.getHeight=n,l.layer=r,l.layerType=i,l.isMultiview=o,l.createRTTProvider=a,l._originalInternalTexture=s,l}return(0,f.C6)(t,e),t}(ko),Pk=function(e){function t(t,n,r){var i=e.call(this,t.scene,r)||this;return i._xrSessionManager=t,i._xrWebGLBinding=n,i.layerWrapper=r,i._lastSubImages=new Map,i.onRenderTargetTextureCreatedObservable=new l.cP,i._compositionLayer=r.layer,i}return(0,f.C6)(t,e),t.prototype._getRenderTargetForSubImage=function(e,t){var n,r,i,o;void 0===t&&(t="none");var a=this._lastSubImages.get(t),s="right"==t?1:0,l=null!==(n=e.colorTextureWidth)&&void 0!==n?n:e.textureWidth,c=null!==(r=e.colorTextureHeight)&&void 0!==r?r:e.textureHeight;if(!this._renderTargetTextures[s]||(null==a?void 0:a.textureWidth)!==l||(null==a?void 0:a.textureHeight)!==c){var u=void 0,h=null!==(i=e.depthStencilTextureWidth)&&void 0!==i?i:l,d=null!==(o=e.depthStencilTextureHeight)&&void 0!==o?o:c;l!==h&&c!==d||(u=e.depthStencilTexture),this._renderTargetTextures[s]=this._createRenderTargetTexture(l,c,null,e.colorTexture,u,this.layerWrapper.isMultiview),this._framebufferDimensions={framebufferWidth:l,framebufferHeight:c},this.onRenderTargetTextureCreatedObservable.notifyObservers({texture:this._renderTargetTextures[s],eye:t})}return this._lastSubImages.set(t,e),this._renderTargetTextures[s]},t.prototype._getSubImageForEye=function(e){var t=this._xrSessionManager.currentFrame;return t?this._xrWebGLBinding.getSubImage(this._compositionLayer,t,e):null},t.prototype.getRenderTargetTextureForEye=function(e){var t=this._getSubImageForEye(e);return t?this._getRenderTargetForSubImage(t,e):null},t.prototype.getRenderTargetTextureForView=function(e){return this.getRenderTargetTextureForEye(null==e?void 0:e.eye)},t.prototype._setViewportForSubImage=function(e,t){var n,r,i=null!==(n=t.colorTextureWidth)&&void 0!==n?n:t.textureWidth,o=null!==(r=t.colorTextureHeight)&&void 0!==r?r:t.textureHeight,a=t.viewport;e.x=a.x/i,e.y=a.y/o,e.width=a.width/i,e.height=a.height/o},t.prototype.trySetViewportForView=function(e,t){var n=this._lastSubImages.get(t.eye)||this._getSubImageForEye(t.eye);return!!n&&(this._setViewportForSubImage(e,n),!0)},t}(Wo),Ck=function(e){function t(t,n,r){var i=e.call(this,(function(){return t.textureWidth}),(function(){return t.textureHeight}),t,"XRProjectionLayer",n,(function(e){return new Rk(e,r,i)}))||this;return i.layer=t,i}return(0,f.C6)(t,e),t}(xk),Rk=function(e){function t(t,n,r){var i=e.call(this,t,n,r)||this;return i.layerWrapper=r,i._projectionLayer=r.layer,i}return(0,f.C6)(t,e),t.prototype._getSubImageForView=function(e){return this._xrWebGLBinding.getViewSubImage(this._projectionLayer,e)},t.prototype.getRenderTargetTextureForView=function(e){return this._getRenderTargetForSubImage(this._getSubImageForView(e),e.eye)},t.prototype.getRenderTargetTextureForEye=function(e){var t=this._lastSubImages.get(e);return t?this._getRenderTargetForSubImage(t,e):null},t.prototype.trySetViewportForView=function(e,t){var n=this._lastSubImages.get(t.eye)||this._getSubImageForView(t);return!!n&&(this._setViewportForSubImage(e,n),!0)},t}(Pk),Ak={textureType:"texture",colorFormat:6408,depthFormat:35056,scaleFactor:1,clearOnAccess:!1},Ik={},Ok=function(e){function t(t,n){void 0===n&&(n={});var r=e.call(this,t)||this;return r._options=n,r._existingLayers=[],r._isMultiviewEnabled=!1,r._projectionLayerInitialized=!1,r._compositionLayerTextureMapping=new WeakMap,r._layerToRTTProviderMapping=new WeakMap,r.xrNativeFeatureName="layers",r}return(0,f.C6)(t,e),t.prototype.attach=function(){if(!e.prototype.attach.call(this))return!1;var t=this._xrSessionManager.scene.getEngine();this._glContext=t._gl,this._xrWebGLBinding=new XRWebGLBinding(this._xrSessionManager.session,this._glContext),this._existingLayers.length=0;var n=(0,f.Cl)((0,f.Cl)({},Ak),this._options.projectionLayerInit);return this._isMultiviewEnabled=this._options.preferMultiviewOnInit&&t.getCaps().multiview,this.createProjectionLayer(n),this._projectionLayerInitialized=!0,!0},t.prototype.detach=function(){if(!e.prototype.detach.call(this))return!1;for(var t=0,n=this._existingLayers;t0?e.at(0):null)},t.prototype.isCompatible=function(){return!this._xrSessionManager.isNative&&"undefined"!=typeof XRWebGLBinding&&!!XRWebGLBinding.prototype.createProjectionLayer},t.prototype.dispose=function(){e.prototype.dispose.call(this)},t.prototype._onXRFrame=function(e){for(var t=this._existingLayers,n=0;n0?e.rigCameras[0].viewport:e.viewport;Lk.width=e.outputRenderTarget.getRenderWidth()/(e.rigParent&&e.rigParent.rigCameras.length||1),Lk.height=e.outputRenderTarget.getRenderHeight(),wk.x=t.x,wk.y=t.y,wk.width=t.width,wk.height=t.height,e.rigParent&&(Vk=e.isLeftCamera?0:1)}}))}return!0},t.prototype.detach=function(){Dk=!1,Nk=null,this._cachedWebGLTexture=null,this._cachedDepthBuffer=null;for(var t=0,n=kk;t