!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