babylonjs-materials 9.5.0 → 9.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/babylon.cellMaterial.min.js +1 -1
- package/babylon.cellMaterial.min.js.map +1 -1
- package/babylon.customMaterial.min.js +1 -1
- package/babylon.customMaterial.min.js.map +1 -1
- package/babylon.fireMaterial.min.js +1 -1
- package/babylon.fireMaterial.min.js.map +1 -1
- package/babylon.furMaterial.min.js +1 -1
- package/babylon.furMaterial.min.js.map +1 -1
- package/babylon.gradientMaterial.min.js +1 -1
- package/babylon.gradientMaterial.min.js.map +1 -1
- package/babylon.gridMaterial.min.js +1 -1
- package/babylon.gridMaterial.min.js.map +1 -1
- package/babylon.lavaMaterial.min.js +1 -1
- package/babylon.lavaMaterial.min.js.map +1 -1
- package/babylon.mixMaterial.min.js +1 -1
- package/babylon.mixMaterial.min.js.map +1 -1
- package/babylon.normalMaterial.min.js +1 -1
- package/babylon.normalMaterial.min.js.map +1 -1
- package/babylon.shadowOnlyMaterial.min.js +1 -1
- package/babylon.shadowOnlyMaterial.min.js.map +1 -1
- package/babylon.simpleMaterial.min.js +1 -1
- package/babylon.simpleMaterial.min.js.map +1 -1
- package/babylon.skyMaterial.min.js +1 -1
- package/babylon.skyMaterial.min.js.map +1 -1
- package/babylon.terrainMaterial.min.js +1 -1
- package/babylon.terrainMaterial.min.js.map +1 -1
- package/babylon.triPlanarMaterial.min.js +1 -1
- package/babylon.triPlanarMaterial.min.js.map +1 -1
- package/babylon.waterMaterial.min.js +1 -1
- package/babylon.waterMaterial.min.js.map +1 -1
- package/babylonjs.materials.js +1 -1
- package/babylonjs.materials.js.map +1 -1
- package/babylonjs.materials.min.js +1 -1
- package/babylonjs.materials.min.js.map +1 -1
- package/package.json +3 -2
- package/rollup.config.umd.mjs +2 -0
- package/src/cell.ts +2 -3
- package/src/custom.ts +2 -3
- package/src/fire.ts +2 -3
- package/src/fur.ts +2 -3
- package/src/gradient.ts +2 -3
- package/src/grid.ts +2 -3
- package/src/index.ts +2 -3
- package/src/lava.ts +2 -3
- package/src/mix.ts +2 -3
- package/src/normal.ts +2 -3
- package/src/shadowOnly.ts +2 -3
- package/src/simple.ts +2 -3
- package/src/sky.ts +2 -3
- package/src/terrain.ts +2 -3
- package/src/triPlanar.ts +2 -3
- package/src/water.ts +2 -3
- package/webpack.config.js +0 -35
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports,require("babylonjs")):"function"==typeof define&&define.amd?define(["exports","babylonjs"],i):i((e="undefined"!=typeof globalThis?globalThis:e||self).BABYLON=e.BABYLON||{},e.BABYLON)}(this,function(e,i){"use strict";var n=function(e,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,i){e.__proto__=i}||function(e,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])},n(e,i)};function t(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function t(){this.constructor=e}n(e,i),e.prototype=null===i?Object.create(i):(t.prototype=i.prototype,new t)}function r(e,i,n,t){var r,o=arguments.length,a=o<3?i:null===t?t=Object.getOwnPropertyDescriptor(i,n):t;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,i,n,t);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(i,n,a):r(i,n))||a);return o>3&&a&&Object.defineProperty(i,n,a),a}function o(e,i,n,t){return new(n||(n=Promise))(function(r,o){function a(e){try{f(t.next(e))}catch(e){o(e)}}function s(e){try{f(t.throw(e))}catch(e){o(e)}}function f(e){var i;e.done?r(e.value):(i=e.value,i instanceof n?i:new n(function(e){e(i)})).then(a,s)}f((t=t.apply(e,i||[])).next())})}function a(e,i){var n,t,r,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(f){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,t&&(r=2&s[0]?t.return:s[0]?t.throw||((r=t.return)&&r.call(t),0):t.next)&&!(r=r.call(t,s[1])).done)return r;switch(t=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,t=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=i.call(e,o)}catch(e){s=[6,e],t=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,f])}}}"function"==typeof SuppressedError&&SuppressedError;var s=function(e){function i(){var i=e.call(this)||this;return i.DIFFUSE=!1,i.CLIPPLANE=!1,i.CLIPPLANE2=!1,i.CLIPPLANE3=!1,i.CLIPPLANE4=!1,i.CLIPPLANE5=!1,i.CLIPPLANE6=!1,i.ALPHATEST=!1,i.POINTSIZE=!1,i.FOG=!1,i.NORMAL=!1,i.UV1=!1,i.UV2=!1,i.VERTEXCOLOR=!1,i.VERTEXALPHA=!1,i.NUM_BONE_INFLUENCERS=0,i.BonesPerMesh=0,i.INSTANCES=!1,i.INSTANCESCOLOR=!1,i.NDOTL=!0,i.CUSTOMUSERLIGHTING=!0,i.CELLBASIC=!0,i.DEPTHPREPASS=!1,i.IMAGEPROCESSINGPOSTPROCESS=!1,i.SKIPFINALCOLORCLAMP=!1,i.LOGARITHMICDEPTH=!1,i.AREALIGHTSUPPORTED=!0,i.AREALIGHTNOROUGHTNESS=!0,i.rebuild(),i}return t(i,e),i}(i.MaterialDefines),f=function(e){function n(n,t,r){void 0===r&&(r=!1);var o=e.call(this,n,t,void 0,r)||this;return o.diffuseColor=new i.Color3(1,1,1),o._computeHighLevel=!1,o._disableLighting=!1,o._maxSimultaneousLights=4,o._shadersLoaded=!1,o}return t(n,e),n.prototype.needAlphaBlending=function(){return this.alpha<1},n.prototype.needAlphaTesting=function(){return!1},n.prototype.getAlphaTestTexture=function(){return null},n.prototype.isReadyForSubMesh=function(e,n,t){var r=this,f=n._drawWrapper;if(this.isFrozen&&f.effect&&f._wasPreviouslyReady&&f._wasPreviouslyUsingInstances===t)return!0;n.materialDefines||(n.materialDefines=new s);var l=n.materialDefines,u=this.getScene();if(this._isReadyForSubMesh(n))return!0;var d=u.getEngine();if(l._areTexturesDirty&&(l._needUVs=!1,u.texturesEnabled&&this._diffuseTexture&&i.MaterialFlags.DiffuseTextureEnabled)){if(!this._diffuseTexture.isReady())return!1;l._needUVs=!0,l.DIFFUSE=!0}if(l.CELLBASIC=!this.computeHighLevel,i.PrepareDefinesForMisc(e,u,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),l,void 0,void 0,void 0,this._isVertexOutputInvariant),l._needNormals=i.PrepareDefinesForLights(u,e,l,!1,this._maxSimultaneousLights,this._disableLighting),i.PrepareDefinesForFrameBoundValues(u,d,this,l,!!t),i.PrepareDefinesForAttributes(e,l,!0,!0),l.isDirty){l.markAsProcessed(),u.resetCachedMaterial();var c=new i.EffectFallbacks;l.FOG&&c.addFallback(1,"FOG"),i.HandleFallbacksForShadows(l,c,this.maxSimultaneousLights),l.NUM_BONE_INFLUENCERS>0&&c.addCPUSkinningFallback(0,e),l.IMAGEPROCESSINGPOSTPROCESS=u.imageProcessingConfiguration.applyByPostProcess;var v=[i.VertexBuffer.PositionKind];l.NORMAL&&v.push(i.VertexBuffer.NormalKind),l.UV1&&v.push(i.VertexBuffer.UVKind),l.UV2&&v.push(i.VertexBuffer.UV2Kind),l.VERTEXCOLOR&&v.push(i.VertexBuffer.ColorKind),i.PrepareAttributesForBones(v,e,l,c),i.PrepareAttributesForInstances(v,l);var m=l.toString(),p=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vFogInfos","vFogColor","pointSize","vDiffuseInfos","mBones","diffuseMatrix","logarithmicDepthConstant"],h=["diffuseSampler","areaLightsLTC1Sampler","areaLightsLTC2Sampler"],g=[];i.AddClipPlaneUniforms(p),i.PrepareUniformsAndSamplersList({uniformsNames:p,uniformBuffersNames:g,samplers:h,defines:l,maxSimultaneousLights:this.maxSimultaneousLights}),n.setEffect(u.getEngine().createEffect("cell",{attributes:v,uniformsNames:p,uniformBuffersNames:g,samplers:h,defines:m,fallbacks:c,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights-1},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:function(){return o(r,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return 1!==this.shaderLanguage?[3,2]:[4,Promise.all([Promise.resolve().then(function(){return Z}),Promise.resolve().then(function(){return q})])];case 1:return e.sent(),[3,4];case 2:return[4,Promise.all([Promise.resolve().then(function(){return $}),Promise.resolve().then(function(){return ne})])];case 3:e.sent(),e.label=4;case 4:return this._shadersLoaded=!0,[2]}})})}},d),l,this._materialContext)}if(l.AREALIGHTUSED)for(var S=0;S<e.lightSources.length;S++)if(!e.lightSources[S]._isReady())return!1;return!(!n.effect||!n.effect.isReady()||(l._renderId=u.getRenderId(),f._wasPreviouslyReady=!0,f._wasPreviouslyUsingInstances=!!t,0))},n.prototype.bindForSubMesh=function(e,n,t){var r=this.getScene(),o=t.materialDefines;if(o){var a=t.effect;a&&(this._activeEffect=a,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),i.BindBonesParameters(n,this._activeEffect),this._mustRebind(r,a,t)&&(this._diffuseTexture&&i.MaterialFlags.DiffuseTextureEnabled&&(this._activeEffect.setTexture("diffuseSampler",this._diffuseTexture),this._activeEffect.setFloat2("vDiffuseInfos",this._diffuseTexture.coordinatesIndex,this._diffuseTexture.level),this._activeEffect.setMatrix("diffuseMatrix",this._diffuseTexture.getTextureMatrix())),i.BindClipPlane(this._activeEffect,this,r),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&i.BindLogDepth(o,a,r),r.bindEyePosition(a)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*n.visibility),r.lightsEnabled&&!this.disableLighting&&i.BindLights(r,n,this._activeEffect,o,this._maxSimultaneousLights),r.fogEnabled&&n.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,n,this._activeEffect),this._afterBind(n,this._activeEffect,t))}},n.prototype.getAnimatables=function(){var e=[];return this._diffuseTexture&&this._diffuseTexture.animations&&this._diffuseTexture.animations.length>0&&e.push(this._diffuseTexture),e},n.prototype.getActiveTextures=function(){var i=e.prototype.getActiveTextures.call(this);return this._diffuseTexture&&i.push(this._diffuseTexture),i},n.prototype.hasTexture=function(i){return!!e.prototype.hasTexture.call(this,i)||this._diffuseTexture===i},n.prototype.dispose=function(i){this._diffuseTexture&&this._diffuseTexture.dispose(),e.prototype.dispose.call(this,i)},n.prototype.getClassName=function(){return"CellMaterial"},n.prototype.clone=function(e){var t=this;return i.SerializationHelper.Clone(function(){return new n(e,t.getScene())},this)},n.prototype.serialize=function(){var i=e.prototype.serialize.call(this);return i.customType="BABYLON.CellMaterial",i},n.Parse=function(e,t,r){return i.SerializationHelper.Parse(function(){return new n(e.name,t)},e,t,r)},r([i.serializeAsTexture("diffuseTexture")],n.prototype,"_diffuseTexture",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"diffuseTexture",void 0),r([i.serializeAsColor3("diffuse")],n.prototype,"diffuseColor",void 0),r([i.serialize("computeHighLevel")],n.prototype,"_computeHighLevel",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"computeHighLevel",void 0),r([i.serialize("disableLighting")],n.prototype,"_disableLighting",void 0),r([i.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"disableLighting",void 0),r([i.serialize("maxSimultaneousLights")],n.prototype,"_maxSimultaneousLights",void 0),r([i.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"maxSimultaneousLights",void 0),n}(i.PushMaterial);i.RegisterClass("BABYLON.CellMaterial",f);var l=function(){},u=function(){},d=function(e){function n(t,r){var o=e.call(this,t,r,!0)||this;return o.CustomParts=new u,o.customShaderNameResolve=o.Builder,o.FragmentShader=i.Effect.ShadersStore.defaultPixelShader,o.VertexShader=i.Effect.ShadersStore.defaultVertexShader,n.ShaderIndexer++,o._createdShaderName="custom_"+n.ShaderIndexer,o}return t(n,e),n.prototype.AttachAfterBind=function(e,n){if(this._newUniformInstances)for(var t in this._newUniformInstances)"vec2"==(r=t.toString().split("-"))[0]?n.setVector2(r[1],this._newUniformInstances[t]):"vec3"==r[0]?this._newUniformInstances[t]instanceof i.Color3?n.setColor3(r[1],this._newUniformInstances[t]):n.setVector3(r[1],this._newUniformInstances[t]):"vec4"==r[0]?(this._newUniformInstances[t]instanceof i.Color4?n.setDirectColor4(r[1],this._newUniformInstances[t]):n.setVector4(r[1],this._newUniformInstances[t]),n.setVector4(r[1],this._newUniformInstances[t])):"mat4"==r[0]?n.setMatrix(r[1],this._newUniformInstances[t]):"float"==r[0]&&n.setFloat(r[1],this._newUniformInstances[t]);if(this._newSamplerInstances)for(var t in this._newSamplerInstances){var r;"sampler2D"==(r=t.toString().split("-"))[0]&&this._newSamplerInstances[t].isReady&&this._newSamplerInstances[t].isReady()&&n.setTexture(r[1],this._newSamplerInstances[t])}},n.prototype.ReviewUniform=function(e,i){if("uniform"==e&&this._newUniforms)for(var n=0;n<this._newUniforms.length;n++)-1==this._customUniform[n].indexOf("sampler")&&i.push(this._newUniforms[n].replace(/\[\d*\]/g,""));if("sampler"==e&&this._newUniforms)for(n=0;n<this._newUniforms.length;n++)-1!=this._customUniform[n].indexOf("sampler")&&i.push(this._newUniforms[n].replace(/\[\d*\]/g,""));return i},n.prototype.Builder=function(e,n,t,r,o,a){a&&this._customAttributes&&this._customAttributes.length>0&&a.push.apply(a,this._customAttributes),this.ReviewUniform("uniform",n),this.ReviewUniform("sampler",r);var s=this._createdShaderName;return i.Effect.ShadersStore[s+"VertexShader"]&&i.Effect.ShadersStore[s+"PixelShader"]||(i.Effect.ShadersStore[s+"VertexShader"]=this._injectCustomCode(this.VertexShader,"vertex"),i.Effect.ShadersStore[s+"PixelShader"]=this._injectCustomCode(this.FragmentShader,"fragment")),s},n.prototype._injectCustomCode=function(e,i){var n=this._getCustomCode(i);for(var t in n){var r=n[t];if(r&&r.length>0){var o="#define "+t;e=e.replace(o,"\n"+r+"\n"+o)}}return e},n.prototype._getCustomCode=function(e){var i,n;return"vertex"===e?{CUSTOM_VERTEX_BEGIN:this.CustomParts.Vertex_Begin,CUSTOM_VERTEX_DEFINITIONS:((null===(i=this._customUniform)||void 0===i?void 0:i.join("\n"))||"")+(this.CustomParts.Vertex_Definitions||""),CUSTOM_VERTEX_MAIN_BEGIN:this.CustomParts.Vertex_MainBegin,CUSTOM_VERTEX_UPDATE_POSITION:this.CustomParts.Vertex_Before_PositionUpdated,CUSTOM_VERTEX_UPDATE_NORMAL:this.CustomParts.Vertex_Before_NormalUpdated,CUSTOM_VERTEX_MAIN_END:this.CustomParts.Vertex_MainEnd,CUSTOM_VERTEX_UPDATE_WORLDPOS:this.CustomParts.Vertex_After_WorldPosComputed}:{CUSTOM_FRAGMENT_BEGIN:this.CustomParts.Fragment_Begin,CUSTOM_FRAGMENT_DEFINITIONS:((null===(n=this._customUniform)||void 0===n?void 0:n.join("\n"))||"")+(this.CustomParts.Fragment_Definitions||""),CUSTOM_FRAGMENT_MAIN_BEGIN:this.CustomParts.Fragment_MainBegin,CUSTOM_FRAGMENT_UPDATE_DIFFUSE:this.CustomParts.Fragment_Custom_Diffuse,CUSTOM_FRAGMENT_UPDATE_ALPHA:this.CustomParts.Fragment_Custom_Alpha,CUSTOM_FRAGMENT_BEFORE_LIGHTS:this.CustomParts.Fragment_Before_Lights,CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR:this.CustomParts.Fragment_Before_FragColor,CUSTOM_FRAGMENT_MAIN_END:this.CustomParts.Fragment_MainEnd,CUSTOM_FRAGMENT_BEFORE_FOG:this.CustomParts.Fragment_Before_Fog}},n.prototype._afterBind=function(i,n,t){if(void 0===n&&(n=null),n){this.AttachAfterBind(i,n);try{e.prototype._afterBind.call(this,i,n,t)}catch(e){}}},n.prototype.AddUniform=function(e,i,n){return this._customUniform||(this._customUniform=[],this._newUniforms=[],this._newSamplerInstances={},this._newUniformInstances={}),n&&(-1!=i.indexOf("sampler")?this._newSamplerInstances[i+"-"+e]=n:this._newUniformInstances[i+"-"+e]=n),this._customUniform.push("uniform "+i+" "+e+";"),this._newUniforms.push(e),this},n.prototype.AddAttribute=function(e){return this._customAttributes||(this._customAttributes=[]),this._customAttributes.push(e),this},n.prototype.Fragment_Begin=function(e){return this.CustomParts.Fragment_Begin=e,this},n.prototype.Fragment_Definitions=function(e){return this.CustomParts.Fragment_Definitions=e,this},n.prototype.Fragment_MainBegin=function(e){return this.CustomParts.Fragment_MainBegin=e,this},n.prototype.Fragment_MainEnd=function(e){return this.CustomParts.Fragment_MainEnd=e,this},n.prototype.Fragment_Custom_Diffuse=function(e){return this.CustomParts.Fragment_Custom_Diffuse=e.replace("result","diffuseColor"),this},n.prototype.Fragment_Custom_Alpha=function(e){return this.CustomParts.Fragment_Custom_Alpha=e.replace("result","alpha"),this},n.prototype.Fragment_Before_Lights=function(e){return this.CustomParts.Fragment_Before_Lights=e,this},n.prototype.Fragment_Before_Fog=function(e){return this.CustomParts.Fragment_Before_Fog=e,this},n.prototype.Fragment_Before_FragColor=function(e){return this.CustomParts.Fragment_Before_FragColor=e.replace("result","color"),this},n.prototype.Vertex_Begin=function(e){return this.CustomParts.Vertex_Begin=e,this},n.prototype.Vertex_Definitions=function(e){return this.CustomParts.Vertex_Definitions=e,this},n.prototype.Vertex_MainBegin=function(e){return this.CustomParts.Vertex_MainBegin=e,this},n.prototype.Vertex_Before_PositionUpdated=function(e){return this.CustomParts.Vertex_Before_PositionUpdated=e.replace("result","positionUpdated"),this},n.prototype.Vertex_Before_NormalUpdated=function(e){return this.CustomParts.Vertex_Before_NormalUpdated=e.replace("result","normalUpdated"),this},n.prototype.Vertex_After_WorldPosComputed=function(e){return this.CustomParts.Vertex_After_WorldPosComputed=e,this},n.prototype.Vertex_MainEnd=function(e){return this.CustomParts.Vertex_MainEnd=e,this},n.ShaderIndexer=1,n}(i.StandardMaterial);i.RegisterClass("BABYLON.CustomMaterial",d);var c=function(){},v=c,m=function(e){function n(t,r){var o=e.call(this,t,r,!0)||this;return o.CustomParts=new c,o.customShaderNameResolve=o.Builder,o.FragmentShader=i.Effect.ShadersStore.pbrPixelShader,o.VertexShader=i.Effect.ShadersStore.pbrVertexShader,o.FragmentShader=o.FragmentShader.replace(/#include<pbrBlockAlbedoOpacity>/g,i.Effect.IncludesShadersStore.pbrBlockAlbedoOpacity),o.FragmentShader=o.FragmentShader.replace(/#include<pbrBlockReflectivity>/g,i.Effect.IncludesShadersStore.pbrBlockReflectivity),o.FragmentShader=o.FragmentShader.replace(/#include<pbrBlockFinalColorComposition>/g,i.Effect.IncludesShadersStore.pbrBlockFinalColorComposition),n.ShaderIndexer++,o._createdShaderName="custompbr_"+n.ShaderIndexer,o}return t(n,e),n.prototype.AttachAfterBind=function(e,n){if(this._newUniformInstances)for(var t in this._newUniformInstances)"vec2"==(r=t.toString().split("-"))[0]?n.setVector2(r[1],this._newUniformInstances[t]):"vec3"==r[0]?this._newUniformInstances[t]instanceof i.Color3?n.setColor3(r[1],this._newUniformInstances[t]):n.setVector3(r[1],this._newUniformInstances[t]):"vec4"==r[0]?(this._newUniformInstances[t]instanceof i.Color4?n.setDirectColor4(r[1],this._newUniformInstances[t]):n.setVector4(r[1],this._newUniformInstances[t]),n.setVector4(r[1],this._newUniformInstances[t])):"mat4"==r[0]?n.setMatrix(r[1],this._newUniformInstances[t]):"float"==r[0]&&n.setFloat(r[1],this._newUniformInstances[t]);if(this._newSamplerInstances)for(var t in this._newSamplerInstances){var r;"sampler2D"==(r=t.toString().split("-"))[0]&&this._newSamplerInstances[t].isReady&&this._newSamplerInstances[t].isReady()&&n.setTexture(r[1],this._newSamplerInstances[t])}},n.prototype.ReviewUniform=function(e,i){if("uniform"==e&&this._newUniforms)for(var n=0;n<this._newUniforms.length;n++)-1==this._customUniform[n].indexOf("sampler")&&i.push(this._newUniforms[n].replace(/\[\d*\]/g,""));if("sampler"==e&&this._newUniforms)for(n=0;n<this._newUniforms.length;n++)-1!=this._customUniform[n].indexOf("sampler")&&i.push(this._newUniforms[n].replace(/\[\d*\]/g,""));return i},n.prototype.Builder=function(e,n,t,r,o,a,s){if(s){var f=s.processFinalCode;s.processFinalCode=function(e,n){if("vertex"===e)return f?f(e,n):n;var t=new i.ShaderCodeInliner(n);return t.inlineToken="#define pbr_inline",t.processCode(),f?f(e,t.code):t.code}}a&&this._customAttributes&&this._customAttributes.length>0&&a.push.apply(a,this._customAttributes),this.ReviewUniform("uniform",n),this.ReviewUniform("sampler",r);var l=this._createdShaderName;return i.Effect.ShadersStore[l+"VertexShader"]&&i.Effect.ShadersStore[l+"PixelShader"]||(i.Effect.ShadersStore[l+"VertexShader"]=this._injectCustomCode(this.VertexShader,"vertex"),i.Effect.ShadersStore[l+"PixelShader"]=this._injectCustomCode(this.FragmentShader,"fragment")),l},n.prototype._injectCustomCode=function(e,i){var n=this._getCustomCode(i);for(var t in n){var r=n[t];if(r&&r.length>0){var o="#define "+t;e=e.replace(o,"\n"+r+"\n"+o)}}return e},n.prototype._getCustomCode=function(e){var i,n;return"vertex"===e?{CUSTOM_VERTEX_BEGIN:this.CustomParts.Vertex_Begin,CUSTOM_VERTEX_DEFINITIONS:((null===(i=this._customUniform)||void 0===i?void 0:i.join("\n"))||"")+(this.CustomParts.Vertex_Definitions||""),CUSTOM_VERTEX_MAIN_BEGIN:this.CustomParts.Vertex_MainBegin,CUSTOM_VERTEX_UPDATE_POSITION:this.CustomParts.Vertex_Before_PositionUpdated,CUSTOM_VERTEX_UPDATE_NORMAL:this.CustomParts.Vertex_Before_NormalUpdated,CUSTOM_VERTEX_MAIN_END:this.CustomParts.Vertex_MainEnd,CUSTOM_VERTEX_UPDATE_WORLDPOS:this.CustomParts.Vertex_After_WorldPosComputed}:{CUSTOM_FRAGMENT_BEGIN:this.CustomParts.Fragment_Begin,CUSTOM_FRAGMENT_MAIN_BEGIN:this.CustomParts.Fragment_MainBegin,CUSTOM_FRAGMENT_DEFINITIONS:((null===(n=this._customUniform)||void 0===n?void 0:n.join("\n"))||"")+(this.CustomParts.Fragment_Definitions||""),CUSTOM_FRAGMENT_UPDATE_ALBEDO:this.CustomParts.Fragment_Custom_Albedo,CUSTOM_FRAGMENT_UPDATE_ALPHA:this.CustomParts.Fragment_Custom_Alpha,CUSTOM_FRAGMENT_BEFORE_LIGHTS:this.CustomParts.Fragment_Before_Lights,CUSTOM_FRAGMENT_UPDATE_METALLICROUGHNESS:this.CustomParts.Fragment_Custom_MetallicRoughness,CUSTOM_FRAGMENT_UPDATE_MICROSURFACE:this.CustomParts.Fragment_Custom_MicroSurface,CUSTOM_FRAGMENT_BEFORE_FINALCOLORCOMPOSITION:this.CustomParts.Fragment_Before_FinalColorComposition,CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR:this.CustomParts.Fragment_Before_FragColor,CUSTOM_FRAGMENT_MAIN_END:this.CustomParts.Fragment_MainEnd,CUSTOM_FRAGMENT_BEFORE_FOG:this.CustomParts.Fragment_Before_Fog}},n.prototype._afterBind=function(i,n,t){if(void 0===n&&(n=null),n){this.AttachAfterBind(i,n);try{e.prototype._afterBind.call(this,i,n,t)}catch(e){}}},n.prototype.AddUniform=function(e,i,n){return this._customUniform||(this._customUniform=[],this._newUniforms=[],this._newSamplerInstances={},this._newUniformInstances={}),n&&(-1!=i.indexOf("sampler")?this._newSamplerInstances[i+"-"+e]=n:this._newUniformInstances[i+"-"+e]=n),this._customUniform.push("uniform "+i+" "+e+";"),this._newUniforms.push(e),this},n.prototype.AddAttribute=function(e){return this._customAttributes||(this._customAttributes=[]),this._customAttributes.push(e),this},n.prototype.Fragment_Begin=function(e){return this.CustomParts.Fragment_Begin=e,this},n.prototype.Fragment_Definitions=function(e){return this.CustomParts.Fragment_Definitions=e,this},n.prototype.Fragment_MainBegin=function(e){return this.CustomParts.Fragment_MainBegin=e,this},n.prototype.Fragment_Custom_Albedo=function(e){return this.CustomParts.Fragment_Custom_Albedo=e.replace("result","surfaceAlbedo"),this},n.prototype.Fragment_Custom_Alpha=function(e){return this.CustomParts.Fragment_Custom_Alpha=e.replace("result","alpha"),this},n.prototype.Fragment_Before_Lights=function(e){return this.CustomParts.Fragment_Before_Lights=e,this},n.prototype.Fragment_Custom_MetallicRoughness=function(e){return this.CustomParts.Fragment_Custom_MetallicRoughness=e,this},n.prototype.Fragment_Custom_MicroSurface=function(e){return this.CustomParts.Fragment_Custom_MicroSurface=e,this},n.prototype.Fragment_Before_Fog=function(e){return this.CustomParts.Fragment_Before_Fog=e,this},n.prototype.Fragment_Before_FinalColorComposition=function(e){return this.CustomParts.Fragment_Before_FinalColorComposition=e,this},n.prototype.Fragment_Before_FragColor=function(e){return this.CustomParts.Fragment_Before_FragColor=e.replace("result","color"),this},n.prototype.Fragment_MainEnd=function(e){return this.CustomParts.Fragment_MainEnd=e,this},n.prototype.Vertex_Begin=function(e){return this.CustomParts.Vertex_Begin=e,this},n.prototype.Vertex_Definitions=function(e){return this.CustomParts.Vertex_Definitions=e,this},n.prototype.Vertex_MainBegin=function(e){return this.CustomParts.Vertex_MainBegin=e,this},n.prototype.Vertex_Before_PositionUpdated=function(e){return this.CustomParts.Vertex_Before_PositionUpdated=e.replace("result","positionUpdated"),this},n.prototype.Vertex_Before_NormalUpdated=function(e){return this.CustomParts.Vertex_Before_NormalUpdated=e.replace("result","normalUpdated"),this},n.prototype.Vertex_After_WorldPosComputed=function(e){return this.CustomParts.Vertex_After_WorldPosComputed=e,this},n.prototype.Vertex_MainEnd=function(e){return this.CustomParts.Vertex_MainEnd=e,this},n.ShaderIndexer=1,n}(i.PBRMaterial);i.RegisterClass("BABYLON.PBRCustomMaterial",m);var p=function(e){function i(){var i=e.call(this)||this;return i.DIFFUSE=!1,i.CLIPPLANE=!1,i.CLIPPLANE2=!1,i.CLIPPLANE3=!1,i.CLIPPLANE4=!1,i.CLIPPLANE5=!1,i.CLIPPLANE6=!1,i.ALPHATEST=!1,i.DEPTHPREPASS=!1,i.POINTSIZE=!1,i.FOG=!1,i.UV1=!1,i.VERTEXCOLOR=!1,i.VERTEXALPHA=!1,i.BonesPerMesh=0,i.NUM_BONE_INFLUENCERS=0,i.INSTANCES=!1,i.INSTANCESCOLOR=!1,i.IMAGEPROCESSINGPOSTPROCESS=!1,i.SKIPFINALCOLORCLAMP=!1,i.LOGARITHMICDEPTH=!1,i.rebuild(),i}return t(i,e),i}(i.MaterialDefines),h=function(e){function n(n,t,r){void 0===r&&(r=!1);var o=e.call(this,n,t,void 0,r)||this;return o.diffuseColor=new i.Color3(1,1,1),o.speed=1,o._scaledDiffuse=new i.Color3,o._lastTime=0,o._shadersLoaded=!1,o}return t(n,e),n.prototype.needAlphaBlending=function(){return!1},n.prototype.needAlphaTesting=function(){return!0},n.prototype.getAlphaTestTexture=function(){return null},n.prototype.isReadyForSubMesh=function(e,n,t){var r=this,s=n._drawWrapper;if(this.isFrozen&&s._wasPreviouslyReady&&s._wasPreviouslyUsingInstances===t)return!0;n.materialDefines||(n.materialDefines=new p);var f=n.materialDefines,l=this.getScene();if(this._isReadyForSubMesh(n))return!0;var u=l.getEngine();if(f._areTexturesDirty&&(f._needUVs=!1,this._diffuseTexture&&i.MaterialFlags.DiffuseTextureEnabled)){if(!this._diffuseTexture.isReady())return!1;f._needUVs=!0,f.DIFFUSE=!0}if(f.ALPHATEST=!!this._opacityTexture,f._areMiscDirty&&(f.POINTSIZE=this.pointsCloud||l.forcePointsCloud,f.FOG=l.fogEnabled&&e.applyFog&&l.fogMode!==i.Scene.FOGMODE_NONE&&this.fogEnabled,f.LOGARITHMICDEPTH=this._useLogarithmicDepth),i.PrepareDefinesForFrameBoundValues(l,u,this,f,!!t),i.PrepareDefinesForAttributes(e,f,!1,!0),f.isDirty){f.markAsProcessed(),l.resetCachedMaterial();var d=new i.EffectFallbacks;f.FOG&&d.addFallback(1,"FOG"),f.NUM_BONE_INFLUENCERS>0&&d.addCPUSkinningFallback(0,e),f.IMAGEPROCESSINGPOSTPROCESS=l.imageProcessingConfiguration.applyByPostProcess;var c=[i.VertexBuffer.PositionKind];f.UV1&&c.push(i.VertexBuffer.UVKind),f.VERTEXCOLOR&&c.push(i.VertexBuffer.ColorKind),i.PrepareAttributesForBones(c,e,f,d),i.PrepareAttributesForInstances(c,f);var v=["world","view","viewProjection","vEyePosition","vFogInfos","vFogColor","pointSize","vDiffuseInfos","mBones","diffuseMatrix","logarithmicDepthConstant","time","speed"];i.AddClipPlaneUniforms(v);var m=f.toString();n.setEffect(l.getEngine().createEffect("fire",{attributes:c,uniformsNames:v,uniformBuffersNames:[],samplers:["diffuseSampler","distortionSampler","opacitySampler"],defines:m,fallbacks:d,onCompiled:this.onCompiled,onError:this.onError,indexParameters:null,maxSimultaneousLights:4,transformFeedbackVaryings:null,shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:function(){return o(r,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return 1!==this.shaderLanguage?[3,2]:[4,Promise.all([Promise.resolve().then(function(){return oe}),Promise.resolve().then(function(){return fe})])];case 1:return e.sent(),[3,4];case 2:return[4,Promise.all([Promise.resolve().then(function(){return de}),Promise.resolve().then(function(){return me})])];case 3:e.sent(),e.label=4;case 4:return this._shadersLoaded=!0,[2]}})})}},u),f,this._materialContext)}return!(!n.effect||!n.effect.isReady()||(f._renderId=l.getRenderId(),s._wasPreviouslyReady=!0,s._wasPreviouslyUsingInstances=!!t,0))},n.prototype.bindForSubMesh=function(e,n,t){var r=this.getScene(),o=t.materialDefines;if(o){var a=t.effect;a&&(this._activeEffect=a,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),i.BindBonesParameters(n,this._activeEffect),this._mustRebind(r,a,t)&&(this._diffuseTexture&&i.MaterialFlags.DiffuseTextureEnabled&&(this._activeEffect.setTexture("diffuseSampler",this._diffuseTexture),this._activeEffect.setFloat2("vDiffuseInfos",this._diffuseTexture.coordinatesIndex,this._diffuseTexture.level),this._activeEffect.setMatrix("diffuseMatrix",this._diffuseTexture.getTextureMatrix()),this._activeEffect.setTexture("distortionSampler",this._distortionTexture),this._activeEffect.setTexture("opacitySampler",this._opacityTexture)),i.BindClipPlane(this._activeEffect,this,r),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&i.BindLogDepth(o,a,r),r.bindEyePosition(a)),this._activeEffect.setColor4("vDiffuseColor",this._scaledDiffuse,this.alpha*n.visibility),r.fogEnabled&&n.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,n,this._activeEffect),this._lastTime+=r.getEngine().getDeltaTime(),this._activeEffect.setFloat("time",this._lastTime),this._activeEffect.setFloat("speed",this.speed),this._afterBind(n,this._activeEffect,t))}},n.prototype.getAnimatables=function(){var e=[];return this._diffuseTexture&&this._diffuseTexture.animations&&this._diffuseTexture.animations.length>0&&e.push(this._diffuseTexture),this._distortionTexture&&this._distortionTexture.animations&&this._distortionTexture.animations.length>0&&e.push(this._distortionTexture),this._opacityTexture&&this._opacityTexture.animations&&this._opacityTexture.animations.length>0&&e.push(this._opacityTexture),e},n.prototype.getActiveTextures=function(){var i=e.prototype.getActiveTextures.call(this);return this._diffuseTexture&&i.push(this._diffuseTexture),this._distortionTexture&&i.push(this._distortionTexture),this._opacityTexture&&i.push(this._opacityTexture),i},n.prototype.hasTexture=function(i){return!!e.prototype.hasTexture.call(this,i)||this._diffuseTexture===i||this._distortionTexture===i||this._opacityTexture===i},n.prototype.getClassName=function(){return"FireMaterial"},n.prototype.dispose=function(i){this._diffuseTexture&&this._diffuseTexture.dispose(),this._distortionTexture&&this._distortionTexture.dispose(),e.prototype.dispose.call(this,i)},n.prototype.clone=function(e){var t=this;return i.SerializationHelper.Clone(function(){return new n(e,t.getScene())},this)},n.prototype.serialize=function(){var i=e.prototype.serialize.call(this);return i.customType="BABYLON.FireMaterial",i.diffuseColor=this.diffuseColor.asArray(),i.speed=this.speed,this._diffuseTexture&&(i._diffuseTexture=this._diffuseTexture.serialize()),this._distortionTexture&&(i._distortionTexture=this._distortionTexture.serialize()),this._opacityTexture&&(i._opacityTexture=this._opacityTexture.serialize()),i},n.Parse=function(e,t,r){var o=new n(e.name,t);return o.diffuseColor=i.Color3.FromArray(e.diffuseColor),o.speed=e.speed,o.alpha=e.alpha,o.id=e.id,i.Tags.AddTagsTo(o,e.tags),o.backFaceCulling=e.backFaceCulling,o.wireframe=e.wireframe,e._diffuseTexture&&(o._diffuseTexture=i.Texture.Parse(e._diffuseTexture,t,r)),e._distortionTexture&&(o._distortionTexture=i.Texture.Parse(e._distortionTexture,t,r)),e._opacityTexture&&(o._opacityTexture=i.Texture.Parse(e._opacityTexture,t,r)),o},r([i.serializeAsTexture("diffuseTexture")],n.prototype,"_diffuseTexture",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"diffuseTexture",void 0),r([i.serializeAsTexture("distortionTexture")],n.prototype,"_distortionTexture",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"distortionTexture",void 0),r([i.serializeAsTexture("opacityTexture")],n.prototype,"_opacityTexture",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"opacityTexture",void 0),r([i.serializeAsColor3("diffuse")],n.prototype,"diffuseColor",void 0),r([i.serialize()],n.prototype,"speed",void 0),n}(i.PushMaterial);i.RegisterClass("BABYLON.FireMaterial",h);var g=function(e){function i(){var i=e.call(this)||this;return i.DIFFUSE=!1,i.HEIGHTMAP=!1,i.CLIPPLANE=!1,i.CLIPPLANE2=!1,i.CLIPPLANE3=!1,i.CLIPPLANE4=!1,i.CLIPPLANE5=!1,i.CLIPPLANE6=!1,i.ALPHATEST=!1,i.DEPTHPREPASS=!1,i.POINTSIZE=!1,i.FOG=!1,i.NORMAL=!1,i.UV1=!1,i.UV2=!1,i.VERTEXCOLOR=!1,i.VERTEXALPHA=!1,i.NUM_BONE_INFLUENCERS=0,i.BonesPerMesh=0,i.INSTANCES=!1,i.INSTANCESCOLOR=!1,i.HIGHLEVEL=!1,i.IMAGEPROCESSINGPOSTPROCESS=!1,i.SKIPFINALCOLORCLAMP=!1,i.LOGARITHMICDEPTH=!1,i.AREALIGHTSUPPORTED=!0,i.AREALIGHTNOROUGHTNESS=!0,i.rebuild(),i}return t(i,e),i}(i.MaterialDefines),S=function(e){function n(n,t,r){void 0===r&&(r=!1);var o=e.call(this,n,t,void 0,r)||this;return o.diffuseColor=new i.Color3(1,1,1),o.furLength=1,o.furAngle=0,o.furColor=new i.Color3(.44,.21,.02),o.furOffset=0,o.furSpacing=12,o.furGravity=new i.Vector3(0,0,0),o.furSpeed=100,o.furDensity=20,o.furOcclusion=0,o._disableLighting=!1,o._maxSimultaneousLights=4,o.highLevelFur=!0,o._furTime=0,o._shadersLoaded=!1,o}return t(n,e),Object.defineProperty(n.prototype,"furTime",{get:function(){return this._furTime},set:function(e){this._furTime=e},enumerable:!1,configurable:!0}),n.prototype.needAlphaBlending=function(){return this.alpha<1},n.prototype.needAlphaTesting=function(){return!1},n.prototype.getAlphaTestTexture=function(){return null},n.prototype.updateFur=function(){for(var e=1;e<this._meshes.length;e++){var i=this._meshes[e].material;i.furLength=this.furLength,i.furAngle=this.furAngle,i.furGravity=this.furGravity,i.furSpacing=this.furSpacing,i.furSpeed=this.furSpeed,i.furColor=this.furColor,i.diffuseTexture=this.diffuseTexture,i.furTexture=this.furTexture,i.highLevelFur=this.highLevelFur,i.furTime=this.furTime,i.furDensity=this.furDensity}},n.prototype.isReadyForSubMesh=function(e,n,t){var r=this,s=n._drawWrapper;if(this.isFrozen&&s.effect&&s._wasPreviouslyReady&&s._wasPreviouslyUsingInstances===t)return!0;n.materialDefines||(n.materialDefines=new g);var f=n.materialDefines,l=this.getScene();if(this._isReadyForSubMesh(n))return!0;var u=l.getEngine();if(f._areTexturesDirty&&l.texturesEnabled){if(this.diffuseTexture&&i.MaterialFlags.DiffuseTextureEnabled){if(!this.diffuseTexture.isReady())return!1;f._needUVs=!0,f.DIFFUSE=!0}if(this.heightTexture&&u.getCaps().maxVertexTextureImageUnits){if(!this.heightTexture.isReady())return!1;f._needUVs=!0,f.HEIGHTMAP=!0}}if(this.highLevelFur!==f.HIGHLEVEL&&(f.HIGHLEVEL=!0,f.markAsUnprocessed()),i.PrepareDefinesForMisc(e,l,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),f,void 0,void 0,void 0,this._isVertexOutputInvariant),f._needNormals=i.PrepareDefinesForLights(l,e,f,!1,this._maxSimultaneousLights,this._disableLighting),i.PrepareDefinesForFrameBoundValues(l,u,this,f,!!t),i.PrepareDefinesForAttributes(e,f,!0,!0),f.isDirty){f.markAsProcessed(),l.resetCachedMaterial();var d=new i.EffectFallbacks;f.FOG&&d.addFallback(1,"FOG"),i.HandleFallbacksForShadows(f,d,this.maxSimultaneousLights),f.NUM_BONE_INFLUENCERS>0&&d.addCPUSkinningFallback(0,e),f.IMAGEPROCESSINGPOSTPROCESS=l.imageProcessingConfiguration.applyByPostProcess;var c=[i.VertexBuffer.PositionKind];f.NORMAL&&c.push(i.VertexBuffer.NormalKind),f.UV1&&c.push(i.VertexBuffer.UVKind),f.UV2&&c.push(i.VertexBuffer.UV2Kind),f.VERTEXCOLOR&&c.push(i.VertexBuffer.ColorKind),i.PrepareAttributesForBones(c,e,f,d),i.PrepareAttributesForInstances(c,f);var v=f.toString(),m=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vFogInfos","vFogColor","pointSize","vDiffuseInfos","mBones","diffuseMatrix","logarithmicDepthConstant","furLength","furAngle","furColor","furOffset","furGravity","furTime","furSpacing","furDensity","furOcclusion"];i.AddClipPlaneUniforms(m);var p=["diffuseSampler","heightTexture","furTexture","areaLightsLTC1Sampler","areaLightsLTC2Sampler"],h=[];i.PrepareUniformsAndSamplersList({uniformsNames:m,uniformBuffersNames:h,samplers:p,defines:f,maxSimultaneousLights:this.maxSimultaneousLights}),n.setEffect(l.getEngine().createEffect("fur",{attributes:c,uniformsNames:m,uniformBuffersNames:h,samplers:p,defines:v,fallbacks:d,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:function(){return o(r,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return 1!==this.shaderLanguage?[3,2]:[4,Promise.all([Promise.resolve().then(function(){return ge}),Promise.resolve().then(function(){return Te})])];case 1:return e.sent(),[3,4];case 2:return[4,Promise.all([Promise.resolve().then(function(){return Ee}),Promise.resolve().then(function(){return ye})])];case 3:e.sent(),e.label=4;case 4:return this._shadersLoaded=!0,[2]}})})}},u),f,this._materialContext)}if(f.AREALIGHTUSED)for(var S=0;S<e.lightSources.length;S++)if(!e.lightSources[S]._isReady())return!1;return!(!n.effect||!n.effect.isReady()||(f._renderId=l.getRenderId(),s._wasPreviouslyReady=!0,s._wasPreviouslyUsingInstances=!!t,0))},n.prototype.bindForSubMesh=function(e,n,t){var r=this.getScene(),o=t.materialDefines;if(o){var a=t.effect;a&&(this._activeEffect=a,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),i.BindBonesParameters(n,this._activeEffect),this._mustRebind(r,a,t)&&(this._diffuseTexture&&i.MaterialFlags.DiffuseTextureEnabled&&(this._activeEffect.setTexture("diffuseSampler",this._diffuseTexture),this._activeEffect.setFloat2("vDiffuseInfos",this._diffuseTexture.coordinatesIndex,this._diffuseTexture.level),this._activeEffect.setMatrix("diffuseMatrix",this._diffuseTexture.getTextureMatrix())),this._heightTexture&&this._activeEffect.setTexture("heightTexture",this._heightTexture),i.BindClipPlane(this._activeEffect,this,r),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&i.BindLogDepth(o,a,r),r.bindEyePosition(a)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*n.visibility),r.lightsEnabled&&!this.disableLighting&&i.BindLights(r,n,this._activeEffect,o,this.maxSimultaneousLights),r.fogEnabled&&n.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,n,this._activeEffect),this._activeEffect.setFloat("furLength",this.furLength),this._activeEffect.setFloat("furAngle",this.furAngle),this._activeEffect.setColor4("furColor",this.furColor,1),this.highLevelFur&&(this._activeEffect.setVector3("furGravity",this.furGravity),this._activeEffect.setFloat("furOffset",this.furOffset),this._activeEffect.setFloat("furSpacing",this.furSpacing),this._activeEffect.setFloat("furDensity",this.furDensity),this._activeEffect.setFloat("furOcclusion",this.furOcclusion),this._furTime+=this.getScene().getEngine().getDeltaTime()/this.furSpeed,this._activeEffect.setFloat("furTime",this._furTime),this._activeEffect.setTexture("furTexture",this.furTexture)),this._afterBind(n,this._activeEffect,t))}},n.prototype.getAnimatables=function(){var e=[];return this.diffuseTexture&&this.diffuseTexture.animations&&this.diffuseTexture.animations.length>0&&e.push(this.diffuseTexture),this.heightTexture&&this.heightTexture.animations&&this.heightTexture.animations.length>0&&e.push(this.heightTexture),e},n.prototype.getActiveTextures=function(){var i=e.prototype.getActiveTextures.call(this);return this._diffuseTexture&&i.push(this._diffuseTexture),this._heightTexture&&i.push(this._heightTexture),i},n.prototype.hasTexture=function(i){return!!e.prototype.hasTexture.call(this,i)||this.diffuseTexture===i||this._heightTexture===i},n.prototype.dispose=function(i){if(this.diffuseTexture&&this.diffuseTexture.dispose(),this._meshes)for(var n=1;n<this._meshes.length;n++){var t=this._meshes[n].material;t&&t.dispose(i),this._meshes[n].dispose()}e.prototype.dispose.call(this,i)},n.prototype.clone=function(e){var t=this;return i.SerializationHelper.Clone(function(){return new n(e,t.getScene())},this)},n.prototype.serialize=function(){var i=e.prototype.serialize.call(this);return i.customType="BABYLON.FurMaterial",this._meshes&&(i.sourceMeshName=this._meshes[0].name,i.quality=this._meshes.length),i},n.prototype.getClassName=function(){return"FurMaterial"},n.Parse=function(e,t,r){var o=i.SerializationHelper.Parse(function(){return new n(e.name,t)},e,t,r);return e.sourceMeshName&&o.highLevelFur&&t.executeWhenReady(function(){var i=t.getMeshByName(e.sourceMeshName);if(i){var r=n.GenerateTexture("Fur Texture",t);o.furTexture=r,n.FurifyMesh(i,e.quality)}}),o},n.GenerateTexture=function(e,n){for(var t=new i.DynamicTexture("FurTexture "+e,256,n,!0),r=t.getContext(),o=0;o<2e4;++o)r.fillStyle="rgba(255, "+Math.floor(255*Math.random())+", "+Math.floor(255*Math.random())+", 1)",r.fillRect(Math.random()*t.getSize().width,Math.random()*t.getSize().height,2,2);return t.update(!1),t.wrapU=i.Texture.WRAP_ADDRESSMODE,t.wrapV=i.Texture.WRAP_ADDRESSMODE,t},n.FurifyMesh=function(e,t){var r,o=[e],a=e.material;if(!(a instanceof n))throw"The material of the source mesh must be a Fur Material";for(r=1;r<t;r++){var s=new n(a.name+r,e.getScene());e.getScene().materials.pop(),i.Tags.EnableFor(s),i.Tags.AddTagsTo(s,"furShellMaterial"),s.furLength=a.furLength,s.furAngle=a.furAngle,s.furGravity=a.furGravity,s.furSpacing=a.furSpacing,s.furSpeed=a.furSpeed,s.furColor=a.furColor,s.diffuseTexture=a.diffuseTexture,s.furOffset=r/t,s.furTexture=a.furTexture,s.highLevelFur=a.highLevelFur,s.furTime=a.furTime,s.furDensity=a.furDensity;var f=e.clone(e.name+r);f.material=s,f.skeleton=e.skeleton,f.position=i.Vector3.Zero(),o.push(f)}for(r=1;r<o.length;r++)o[r].parent=e;return e.material._meshes=o,o},r([i.serializeAsTexture("diffuseTexture")],n.prototype,"_diffuseTexture",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"diffuseTexture",void 0),r([i.serializeAsTexture("heightTexture")],n.prototype,"_heightTexture",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"heightTexture",void 0),r([i.serializeAsColor3()],n.prototype,"diffuseColor",void 0),r([i.serialize()],n.prototype,"furLength",void 0),r([i.serialize()],n.prototype,"furAngle",void 0),r([i.serializeAsColor3()],n.prototype,"furColor",void 0),r([i.serialize()],n.prototype,"furOffset",void 0),r([i.serialize()],n.prototype,"furSpacing",void 0),r([i.serializeAsVector3()],n.prototype,"furGravity",void 0),r([i.serialize()],n.prototype,"furSpeed",void 0),r([i.serialize()],n.prototype,"furDensity",void 0),r([i.serialize()],n.prototype,"furOcclusion",void 0),r([i.serialize("disableLighting")],n.prototype,"_disableLighting",void 0),r([i.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"disableLighting",void 0),r([i.serialize("maxSimultaneousLights")],n.prototype,"_maxSimultaneousLights",void 0),r([i.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"maxSimultaneousLights",void 0),r([i.serialize()],n.prototype,"highLevelFur",void 0),r([i.serialize()],n.prototype,"furTime",null),n}(i.PushMaterial);i.RegisterClass("BABYLON.FurMaterial",S);var x=function(e){function i(){var i=e.call(this)||this;return i.EMISSIVE=!1,i.CLIPPLANE=!1,i.CLIPPLANE2=!1,i.CLIPPLANE3=!1,i.CLIPPLANE4=!1,i.CLIPPLANE5=!1,i.CLIPPLANE6=!1,i.ALPHATEST=!1,i.DEPTHPREPASS=!1,i.POINTSIZE=!1,i.FOG=!1,i.NORMAL=!1,i.UV1=!1,i.UV2=!1,i.VERTEXCOLOR=!1,i.VERTEXALPHA=!1,i.NUM_BONE_INFLUENCERS=0,i.BonesPerMesh=0,i.INSTANCES=!1,i.INSTANCESCOLOR=!1,i.IMAGEPROCESSINGPOSTPROCESS=!1,i.SKIPFINALCOLORCLAMP=!1,i.LOGARITHMICDEPTH=!1,i.AREALIGHTSUPPORTED=!0,i.AREALIGHTNOROUGHTNESS=!0,i.rebuild(),i}return t(i,e),i}(i.MaterialDefines),T=function(e){function n(n,t,r){void 0===r&&(r=!1);var o=e.call(this,n,t,void 0,r)||this;return o._maxSimultaneousLights=4,o.topColor=new i.Color3(1,0,0),o.topColorAlpha=1,o.bottomColor=new i.Color3(0,0,1),o.bottomColorAlpha=1,o.offset=0,o.scale=1,o.smoothness=1,o._disableLighting=!1,o._shadersLoaded=!1,o}return t(n,e),n.prototype.needAlphaBlending=function(){return this.alpha<1||this.topColorAlpha<1||this.bottomColorAlpha<1},n.prototype.needAlphaTesting=function(){return!0},n.prototype.getAlphaTestTexture=function(){return null},n.prototype.isReadyForSubMesh=function(e,n,t){var r=this,s=n._drawWrapper;if(this.isFrozen&&s.effect&&s._wasPreviouslyReady&&s._wasPreviouslyUsingInstances===t)return!0;n.materialDefines||(n.materialDefines=new x);var f=n.materialDefines,l=this.getScene();if(this._isReadyForSubMesh(n))return!0;var u=l.getEngine();if(i.PrepareDefinesForFrameBoundValues(l,u,this,f,!!t),i.PrepareDefinesForMisc(e,l,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),f,void 0,void 0,void 0,this._isVertexOutputInvariant),f._needNormals=i.PrepareDefinesForLights(l,e,f,!1,this._maxSimultaneousLights,this._disableLighting),f.EMISSIVE=this._disableLighting,i.PrepareDefinesForAttributes(e,f,!1,!0),f.isDirty){f.markAsProcessed(),l.resetCachedMaterial();var d=new i.EffectFallbacks;f.FOG&&d.addFallback(1,"FOG"),i.HandleFallbacksForShadows(f,d),f.NUM_BONE_INFLUENCERS>0&&d.addCPUSkinningFallback(0,e),f.IMAGEPROCESSINGPOSTPROCESS=l.imageProcessingConfiguration.applyByPostProcess;var c=[i.VertexBuffer.PositionKind];f.NORMAL&&c.push(i.VertexBuffer.NormalKind),f.UV1&&c.push(i.VertexBuffer.UVKind),f.UV2&&c.push(i.VertexBuffer.UV2Kind),f.VERTEXCOLOR&&c.push(i.VertexBuffer.ColorKind),i.PrepareAttributesForBones(c,e,f,d),i.PrepareAttributesForInstances(c,f);var v=f.toString(),m=["world","view","viewProjection","vEyePosition","vLightsType","vFogInfos","vFogColor","pointSize","mBones","logarithmicDepthConstant","topColor","bottomColor","offset","smoothness","scale"];i.AddClipPlaneUniforms(m);var p=["areaLightsLTC1Sampler","areaLightsLTC2Sampler"],h=[];i.PrepareUniformsAndSamplersList({uniformsNames:m,uniformBuffersNames:h,samplers:p,defines:f,maxSimultaneousLights:4}),n.setEffect(l.getEngine().createEffect("gradient",{attributes:c,uniformsNames:m,uniformBuffersNames:h,samplers:p,defines:v,fallbacks:d,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:function(){return o(r,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return 1!==this.shaderLanguage?[3,2]:[4,Promise.all([Promise.resolve().then(function(){return Oe}),Promise.resolve().then(function(){return be})])];case 1:return e.sent(),[3,4];case 2:return[4,Promise.all([Promise.resolve().then(function(){return Re}),Promise.resolve().then(function(){return we})])];case 3:e.sent(),e.label=4;case 4:return this._shadersLoaded=!0,[2]}})})}},u),f,this._materialContext)}if(f.AREALIGHTUSED)for(var g=0;g<e.lightSources.length;g++)if(!e.lightSources[g]._isReady())return!1;return!(!n.effect||!n.effect.isReady()||(f._renderId=l.getRenderId(),s._wasPreviouslyReady=!0,s._wasPreviouslyUsingInstances=!!t,0))},n.prototype.bindForSubMesh=function(e,n,t){var r=this.getScene(),o=t.materialDefines;if(o){var a=t.effect;a&&(this._activeEffect=a,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),i.BindBonesParameters(n,a),this._mustRebind(r,a,t)&&(i.BindClipPlane(a,this,r),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&i.BindLogDepth(o,a,r),r.bindEyePosition(a)),r.lightsEnabled&&!this.disableLighting&&i.BindLights(r,n,this._activeEffect,o,this.maxSimultaneousLights),r.fogEnabled&&n.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,n,this._activeEffect),this._activeEffect.setColor4("topColor",this.topColor,this.topColorAlpha),this._activeEffect.setColor4("bottomColor",this.bottomColor,this.bottomColorAlpha),this._activeEffect.setFloat("offset",this.offset),this._activeEffect.setFloat("scale",this.scale),this._activeEffect.setFloat("smoothness",this.smoothness),this._afterBind(n,this._activeEffect,t))}},n.prototype.getAnimatables=function(){return[]},n.prototype.dispose=function(i){e.prototype.dispose.call(this,i)},n.prototype.clone=function(e){var t=this;return i.SerializationHelper.Clone(function(){return new n(e,t.getScene())},this)},n.prototype.serialize=function(){var i=e.prototype.serialize.call(this);return i.customType="BABYLON.GradientMaterial",i},n.prototype.getClassName=function(){return"GradientMaterial"},n.Parse=function(e,t,r){return i.SerializationHelper.Parse(function(){return new n(e.name,t)},e,t,r)},r([i.serialize("maxSimultaneousLights")],n.prototype,"_maxSimultaneousLights",void 0),r([i.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"maxSimultaneousLights",void 0),r([i.serializeAsColor3()],n.prototype,"topColor",void 0),r([i.serialize()],n.prototype,"topColorAlpha",void 0),r([i.serializeAsColor3()],n.prototype,"bottomColor",void 0),r([i.serialize()],n.prototype,"bottomColorAlpha",void 0),r([i.serialize()],n.prototype,"offset",void 0),r([i.serialize()],n.prototype,"scale",void 0),r([i.serialize()],n.prototype,"smoothness",void 0),r([i.serialize("disableLighting")],n.prototype,"_disableLighting",void 0),r([i.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"disableLighting",void 0),n}(i.PushMaterial);i.RegisterClass("BABYLON.GradientMaterial",T);var _=function(e){function i(){var i=e.call(this)||this;return i.CLIPPLANE=!1,i.CLIPPLANE2=!1,i.CLIPPLANE3=!1,i.CLIPPLANE4=!1,i.CLIPPLANE5=!1,i.CLIPPLANE6=!1,i.OPACITY=!1,i.ANTIALIAS=!1,i.TRANSPARENT=!1,i.FOG=!1,i.PREMULTIPLYALPHA=!1,i.MAX_LINE=!1,i.UV1=!1,i.UV2=!1,i.INSTANCES=!1,i.THIN_INSTANCES=!1,i.IMAGEPROCESSINGPOSTPROCESS=!1,i.SKIPFINALCOLORCLAMP=!1,i.LOGARITHMICDEPTH=!1,i.rebuild(),i}return t(i,e),i}(i.MaterialDefines),C=function(e){function n(n,t,r){void 0===r&&(r=!1);var o=e.call(this,n,t,void 0,r)||this;return o.mainColor=i.Color3.Black(),o.lineColor=i.Color3.Teal(),o.gridRatio=1,o.gridOffset=i.Vector3.Zero(),o.majorUnitFrequency=10,o.minorUnitVisibility=.33,o.opacity=1,o.antialias=!0,o.preMultiplyAlpha=!1,o.useMaxLine=!1,o._gridControl=new i.Vector4(o.gridRatio,o.majorUnitFrequency,o.minorUnitVisibility,o.opacity),o._shadersLoaded=!1,o}return t(n,e),n.prototype.needAlphaBlending=function(){return this.opacity<1||this._opacityTexture&&this._opacityTexture.isReady()},n.prototype.needAlphaBlendingForMesh=function(e){return e.visibility<1||this.needAlphaBlending()},n.prototype.isReadyForSubMesh=function(e,n,t){var r=this,s=n._drawWrapper;if(this.isFrozen&&s.effect&&s._wasPreviouslyReady&&s._wasPreviouslyUsingInstances===t)return!0;n.materialDefines||(n.materialDefines=new _);var f=n.materialDefines,l=this.getScene();if(this._isReadyForSubMesh(n))return!0;if(f.TRANSPARENT!==this.opacity<1&&(f.TRANSPARENT=!f.TRANSPARENT,f.markAsUnprocessed()),f.PREMULTIPLYALPHA!=this.preMultiplyAlpha&&(f.PREMULTIPLYALPHA=!f.PREMULTIPLYALPHA,f.markAsUnprocessed()),f.MAX_LINE!==this.useMaxLine&&(f.MAX_LINE=!f.MAX_LINE,f.markAsUnprocessed()),f.ANTIALIAS!==this.antialias&&(f.ANTIALIAS=!f.ANTIALIAS,f.markAsUnprocessed()),f._areTexturesDirty&&(f._needUVs=!1,l.texturesEnabled&&this._opacityTexture&&i.MaterialFlags.OpacityTextureEnabled)){if(!this._opacityTexture.isReady())return!1;f._needUVs=!0,f.OPACITY=!0}if(i.PrepareDefinesForMisc(e,l,this._useLogarithmicDepth,!1,this.fogEnabled,!1,f,void 0,void 0,void 0,this._isVertexOutputInvariant),i.PrepareDefinesForFrameBoundValues(l,l.getEngine(),this,f,!!t),f.isDirty){f.markAsProcessed(),l.resetCachedMaterial(),i.PrepareDefinesForAttributes(e,f,!1,!1);var u=[i.VertexBuffer.PositionKind,i.VertexBuffer.NormalKind];f.UV1&&u.push(i.VertexBuffer.UVKind),f.UV2&&u.push(i.VertexBuffer.UV2Kind),f.IMAGEPROCESSINGPOSTPROCESS=l.imageProcessingConfiguration.applyByPostProcess,i.PrepareAttributesForInstances(u,f);var d=["projection","mainColor","lineColor","gridControl","gridOffset","vFogInfos","vFogColor","world","view","opacityMatrix","vOpacityInfos","visibility","logarithmicDepthConstant"],c=f.toString();i.AddClipPlaneUniforms(d),n.setEffect(l.getEngine().createEffect("grid",{attributes:u,uniformsNames:d,uniformBuffersNames:["Scene"],samplers:["opacitySampler"],defines:c,fallbacks:null,onCompiled:this.onCompiled,onError:this.onError,shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:function(){return o(r,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return 1!==this.shaderLanguage?[3,2]:[4,Promise.all([Promise.resolve().then(function(){return Ge}),Promise.resolve().then(function(){return Xe})])];case 1:return e.sent(),[3,4];case 2:return[4,Promise.all([Promise.resolve().then(function(){return Ze}),Promise.resolve().then(function(){return qe})])];case 3:e.sent(),e.label=4;case 4:return this._shadersLoaded=!0,[2]}})})}},l.getEngine()),f,this._materialContext)}return!(!n.effect||!n.effect.isReady()||(f._renderId=l.getRenderId(),s._wasPreviouslyReady=!0,s._wasPreviouslyUsingInstances=!!t,0))},n.prototype.bindForSubMesh=function(e,n,t){var r=this.getScene(),o=t.materialDefines;if(o){var a=t.effect;a&&(this._activeEffect=a,this._activeEffect.setFloat("visibility",n.visibility),o.INSTANCES&&!o.THIN_INSTANCE||this.bindOnlyWorldMatrix(e),this.bindView(a),this.bindViewProjection(a),this._mustRebind(r,a,t)&&(this._activeEffect.setColor3("mainColor",this.mainColor),this._activeEffect.setColor3("lineColor",this.lineColor),this._activeEffect.setVector3("gridOffset",this.gridOffset),this._gridControl.x=this.gridRatio,this._gridControl.y=Math.round(this.majorUnitFrequency),this._gridControl.z=this.minorUnitVisibility,this._gridControl.w=this.opacity,this._activeEffect.setVector4("gridControl",this._gridControl),this._opacityTexture&&i.MaterialFlags.OpacityTextureEnabled&&(this._activeEffect.setTexture("opacitySampler",this._opacityTexture),this._activeEffect.setFloat2("vOpacityInfos",this._opacityTexture.coordinatesIndex,this._opacityTexture.level),this._activeEffect.setMatrix("opacityMatrix",this._opacityTexture.getTextureMatrix())),i.BindClipPlane(a,this,r),this._useLogarithmicDepth&&i.BindLogDepth(o,a,r)),i.BindFogParameters(r,n,this._activeEffect),this._afterBind(n,this._activeEffect,t))}},n.prototype.dispose=function(i){e.prototype.dispose.call(this,i)},n.prototype.clone=function(e){var t=this;return i.SerializationHelper.Clone(function(){return new n(e,t.getScene())},this)},n.prototype.serialize=function(){var i=e.prototype.serialize.call(this);return i.customType="BABYLON.GridMaterial",i},n.prototype.getClassName=function(){return"GridMaterial"},n.Parse=function(e,t,r){return i.SerializationHelper.Parse(function(){return new n(e.name,t)},e,t,r)},r([i.serializeAsColor3()],n.prototype,"mainColor",void 0),r([i.serializeAsColor3()],n.prototype,"lineColor",void 0),r([i.serialize()],n.prototype,"gridRatio",void 0),r([i.serializeAsVector3()],n.prototype,"gridOffset",void 0),r([i.serialize()],n.prototype,"majorUnitFrequency",void 0),r([i.serialize()],n.prototype,"minorUnitVisibility",void 0),r([i.serialize()],n.prototype,"opacity",void 0),r([i.serialize()],n.prototype,"antialias",void 0),r([i.serialize()],n.prototype,"preMultiplyAlpha",void 0),r([i.serialize()],n.prototype,"useMaxLine",void 0),r([i.serializeAsTexture("opacityTexture")],n.prototype,"_opacityTexture",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"opacityTexture",void 0),n}(i.PushMaterial);i.RegisterClass("BABYLON.GridMaterial",C);var E=function(e){function i(){var i=e.call(this)||this;return i.DIFFUSE=!1,i.CLIPPLANE=!1,i.CLIPPLANE2=!1,i.CLIPPLANE3=!1,i.CLIPPLANE4=!1,i.CLIPPLANE5=!1,i.CLIPPLANE6=!1,i.ALPHATEST=!1,i.DEPTHPREPASS=!1,i.POINTSIZE=!1,i.FOG=!1,i.LIGHT0=!1,i.LIGHT1=!1,i.LIGHT2=!1,i.LIGHT3=!1,i.SPOTLIGHT0=!1,i.SPOTLIGHT1=!1,i.SPOTLIGHT2=!1,i.SPOTLIGHT3=!1,i.HEMILIGHT0=!1,i.HEMILIGHT1=!1,i.HEMILIGHT2=!1,i.HEMILIGHT3=!1,i.DIRLIGHT0=!1,i.DIRLIGHT1=!1,i.DIRLIGHT2=!1,i.DIRLIGHT3=!1,i.POINTLIGHT0=!1,i.POINTLIGHT1=!1,i.POINTLIGHT2=!1,i.POINTLIGHT3=!1,i.SHADOW0=!1,i.SHADOW1=!1,i.SHADOW2=!1,i.SHADOW3=!1,i.SHADOWS=!1,i.SHADOWESM0=!1,i.SHADOWESM1=!1,i.SHADOWESM2=!1,i.SHADOWESM3=!1,i.SHADOWPOISSON0=!1,i.SHADOWPOISSON1=!1,i.SHADOWPOISSON2=!1,i.SHADOWPOISSON3=!1,i.SHADOWPCF0=!1,i.SHADOWPCF1=!1,i.SHADOWPCF2=!1,i.SHADOWPCF3=!1,i.SHADOWPCSS0=!1,i.SHADOWPCSS1=!1,i.SHADOWPCSS2=!1,i.SHADOWPCSS3=!1,i.NORMAL=!1,i.UV1=!1,i.UV2=!1,i.VERTEXCOLOR=!1,i.VERTEXALPHA=!1,i.NUM_BONE_INFLUENCERS=0,i.BonesPerMesh=0,i.INSTANCES=!1,i.INSTANCESCOLOR=!1,i.UNLIT=!1,i.IMAGEPROCESSINGPOSTPROCESS=!1,i.SKIPFINALCOLORCLAMP=!1,i.LOGARITHMICDEPTH=!1,i.AREALIGHTSUPPORTED=!0,i.AREALIGHTNOROUGHTNESS=!0,i.rebuild(),i}return t(i,e),i}(i.MaterialDefines),P=function(e){function n(n,t,r){void 0===r&&(r=!1);var o=e.call(this,n,t,void 0,r)||this;return o.speed=1,o.movingSpeed=1,o.lowFrequencySpeed=1,o.fogDensity=.15,o._lastTime=0,o.diffuseColor=new i.Color3(1,1,1),o._disableLighting=!1,o._unlit=!1,o._maxSimultaneousLights=4,o._scaledDiffuse=new i.Color3,o._shadersLoaded=!1,o}return t(n,e),n.prototype.needAlphaBlending=function(){return this.alpha<1},n.prototype.needAlphaTesting=function(){return!1},n.prototype.getAlphaTestTexture=function(){return null},n.prototype.isReadyForSubMesh=function(e,n,t){var r=this,s=n._drawWrapper;if(this.isFrozen&&s.effect&&s._wasPreviouslyReady&&s._wasPreviouslyUsingInstances===t)return!0;n.materialDefines||(n.materialDefines=new E);var f=n.materialDefines,l=this.getScene();if(this._isReadyForSubMesh(n))return!0;var u=l.getEngine();if(f._areTexturesDirty&&(f._needUVs=!1,l.texturesEnabled&&this._diffuseTexture&&i.MaterialFlags.DiffuseTextureEnabled)){if(!this._diffuseTexture.isReady())return!1;f._needUVs=!0,f.DIFFUSE=!0}if(i.PrepareDefinesForMisc(e,l,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),f,void 0,void 0,void 0,this._isVertexOutputInvariant),f._needNormals=!0,i.PrepareDefinesForLights(l,e,f,!1,this._maxSimultaneousLights,this._disableLighting),i.PrepareDefinesForFrameBoundValues(l,u,this,f,!!t),i.PrepareDefinesForAttributes(e,f,!0,!0),f.isDirty){f.markAsProcessed(),l.resetCachedMaterial();var d=new i.EffectFallbacks;f.FOG&&d.addFallback(1,"FOG"),i.HandleFallbacksForShadows(f,d),f.NUM_BONE_INFLUENCERS>0&&d.addCPUSkinningFallback(0,e),f.IMAGEPROCESSINGPOSTPROCESS=l.imageProcessingConfiguration.applyByPostProcess;var c=[i.VertexBuffer.PositionKind];f.NORMAL&&c.push(i.VertexBuffer.NormalKind),f.UV1&&c.push(i.VertexBuffer.UVKind),f.UV2&&c.push(i.VertexBuffer.UV2Kind),f.VERTEXCOLOR&&c.push(i.VertexBuffer.ColorKind),i.PrepareAttributesForBones(c,e,f,d),i.PrepareAttributesForInstances(c,f);var v=f.toString(),m=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vFogInfos","vFogColor","pointSize","vDiffuseInfos","mBones","diffuseMatrix","logarithmicDepthConstant","time","speed","movingSpeed","fogColor","fogDensity","lowFrequencySpeed"];i.AddClipPlaneUniforms(m);var p=["diffuseSampler","noiseTexture","areaLightsLTC1Sampler","areaLightsLTC2Sampler"],h=[];i.PrepareUniformsAndSamplersList({uniformsNames:m,uniformBuffersNames:h,samplers:p,defines:f,maxSimultaneousLights:this.maxSimultaneousLights}),n.setEffect(l.getEngine().createEffect("lava",{attributes:c,uniformsNames:m,uniformBuffersNames:h,samplers:p,defines:v,fallbacks:d,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:function(){return o(r,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return 1!==this.shaderLanguage?[3,2]:[4,Promise.all([Promise.resolve().then(function(){return $e}),Promise.resolve().then(function(){return ni})])];case 1:return e.sent(),[3,4];case 2:return[4,Promise.all([Promise.resolve().then(function(){return oi}),Promise.resolve().then(function(){return fi})])];case 3:e.sent(),e.label=4;case 4:return this._shadersLoaded=!0,[2]}})})}},u),f,this._materialContext)}if(f.AREALIGHTUSED)for(var g=0;g<e.lightSources.length;g++)if(!e.lightSources[g]._isReady())return!1;return!(!n.effect||!n.effect.isReady()||(f._renderId=l.getRenderId(),s._wasPreviouslyReady=!0,s._wasPreviouslyUsingInstances=!!t,0))},n.prototype.bindForSubMesh=function(e,n,t){var r=this.getScene(),o=t.materialDefines;if(o){var a=t.effect;a&&(this._activeEffect=a,o.UNLIT=this._unlit,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),i.BindBonesParameters(n,this._activeEffect),this._mustRebind(r,a,t)&&(this.diffuseTexture&&i.MaterialFlags.DiffuseTextureEnabled&&(this._activeEffect.setTexture("diffuseSampler",this.diffuseTexture),this._activeEffect.setFloat2("vDiffuseInfos",this.diffuseTexture.coordinatesIndex,this.diffuseTexture.level),this._activeEffect.setMatrix("diffuseMatrix",this.diffuseTexture.getTextureMatrix())),this.noiseTexture&&this._activeEffect.setTexture("noiseTexture",this.noiseTexture),i.BindClipPlane(a,this,r),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&i.BindLogDepth(o,a,r),r.bindEyePosition(a)),this._activeEffect.setColor4("vDiffuseColor",this._scaledDiffuse,this.alpha*n.visibility),r.lightsEnabled&&!this.disableLighting&&i.BindLights(r,n,this._activeEffect,o),r.fogEnabled&&n.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,n,this._activeEffect),this._lastTime+=r.getEngine().getDeltaTime(),this._activeEffect.setFloat("time",this._lastTime*this.speed/1e3),this.fogColor||(this.fogColor=i.Color3.Black()),this._activeEffect.setColor3("fogColor",this.fogColor),this._activeEffect.setFloat("fogDensity",this.fogDensity),this._activeEffect.setFloat("lowFrequencySpeed",this.lowFrequencySpeed),this._activeEffect.setFloat("movingSpeed",this.movingSpeed),this._afterBind(n,this._activeEffect,t))}},n.prototype.getAnimatables=function(){var e=[];return this.diffuseTexture&&this.diffuseTexture.animations&&this.diffuseTexture.animations.length>0&&e.push(this.diffuseTexture),this.noiseTexture&&this.noiseTexture.animations&&this.noiseTexture.animations.length>0&&e.push(this.noiseTexture),e},n.prototype.getActiveTextures=function(){var i=e.prototype.getActiveTextures.call(this);return this._diffuseTexture&&i.push(this._diffuseTexture),i},n.prototype.hasTexture=function(i){return!!e.prototype.hasTexture.call(this,i)||this.diffuseTexture===i},n.prototype.dispose=function(i){this.diffuseTexture&&this.diffuseTexture.dispose(),this.noiseTexture&&this.noiseTexture.dispose(),e.prototype.dispose.call(this,i)},n.prototype.clone=function(e){var t=this;return i.SerializationHelper.Clone(function(){return new n(e,t.getScene())},this)},n.prototype.serialize=function(){var i=e.prototype.serialize.call(this);return i.customType="BABYLON.LavaMaterial",i},n.prototype.getClassName=function(){return"LavaMaterial"},n.Parse=function(e,t,r){return i.SerializationHelper.Parse(function(){return new n(e.name,t)},e,t,r)},r([i.serializeAsTexture("diffuseTexture")],n.prototype,"_diffuseTexture",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"diffuseTexture",void 0),r([i.serializeAsTexture()],n.prototype,"noiseTexture",void 0),r([i.serializeAsColor3()],n.prototype,"fogColor",void 0),r([i.serialize()],n.prototype,"speed",void 0),r([i.serialize()],n.prototype,"movingSpeed",void 0),r([i.serialize()],n.prototype,"lowFrequencySpeed",void 0),r([i.serialize()],n.prototype,"fogDensity",void 0),r([i.serializeAsColor3()],n.prototype,"diffuseColor",void 0),r([i.serialize("disableLighting")],n.prototype,"_disableLighting",void 0),r([i.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"disableLighting",void 0),r([i.serialize("unlit")],n.prototype,"_unlit",void 0),r([i.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"unlit",void 0),r([i.serialize("maxSimultaneousLights")],n.prototype,"_maxSimultaneousLights",void 0),r([i.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"maxSimultaneousLights",void 0),n}(i.PushMaterial);i.RegisterClass("BABYLON.LavaMaterial",P);var I=function(e){function i(){var i=e.call(this)||this;return i.DIFFUSE=!1,i.CLIPPLANE=!1,i.CLIPPLANE2=!1,i.CLIPPLANE3=!1,i.CLIPPLANE4=!1,i.CLIPPLANE5=!1,i.CLIPPLANE6=!1,i.ALPHATEST=!1,i.DEPTHPREPASS=!1,i.POINTSIZE=!1,i.FOG=!1,i.SPECULARTERM=!1,i.NORMAL=!1,i.UV1=!1,i.UV2=!1,i.VERTEXCOLOR=!1,i.VERTEXALPHA=!1,i.NUM_BONE_INFLUENCERS=0,i.BonesPerMesh=0,i.INSTANCES=!1,i.INSTANCESCOLOR=!1,i.MIXMAP2=!1,i.IMAGEPROCESSINGPOSTPROCESS=!1,i.SKIPFINALCOLORCLAMP=!1,i.LOGARITHMICDEPTH=!1,i.rebuild(),i}return t(i,e),i}(i.MaterialDefines),y=function(e){function n(n,t,r){void 0===r&&(r=!1);var o=e.call(this,n,t,void 0,r)||this;return o.diffuseColor=new i.Color3(1,1,1),o.specularColor=new i.Color3(0,0,0),o.specularPower=64,o._disableLighting=!1,o._maxSimultaneousLights=4,o._shadersLoaded=!1,o}return t(n,e),n.prototype.needAlphaBlending=function(){return this.alpha<1},n.prototype.needAlphaTesting=function(){return!1},n.prototype.getAlphaTestTexture=function(){return null},n.prototype.isReadyForSubMesh=function(e,n,t){var r=this,s=n._drawWrapper;if(this.isFrozen&&s.effect&&s._wasPreviouslyReady&&s._wasPreviouslyUsingInstances===t)return!0;n.materialDefines||(n.materialDefines=new I);var f=n.materialDefines,l=this.getScene();if(this._isReadyForSubMesh(n))return!0;var u=l.getEngine();if(l.texturesEnabled){if(!this._mixTexture1||!this._mixTexture1.isReady())return!1;if(f._needUVs=!0,i.MaterialFlags.DiffuseTextureEnabled){if(!this._diffuseTexture1||!this._diffuseTexture1.isReady())return!1;if(f.DIFFUSE=!0,!this._diffuseTexture2||!this._diffuseTexture2.isReady())return!1;if(!this._diffuseTexture3||!this._diffuseTexture3.isReady())return!1;if(!this._diffuseTexture4||!this._diffuseTexture4.isReady())return!1;if(this._mixTexture2){if(!this._mixTexture2.isReady())return!1;if(f.MIXMAP2=!0,!this._diffuseTexture5||!this._diffuseTexture5.isReady())return!1;if(!this._diffuseTexture6||!this._diffuseTexture6.isReady())return!1;if(!this._diffuseTexture7||!this._diffuseTexture7.isReady())return!1;if(!this._diffuseTexture8||!this._diffuseTexture8.isReady())return!1}}}if(i.PrepareDefinesForMisc(e,l,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),f,void 0,void 0,void 0,this._isVertexOutputInvariant),f._needNormals=i.PrepareDefinesForLights(l,e,f,!1,this._maxSimultaneousLights,this._disableLighting),i.PrepareDefinesForFrameBoundValues(l,u,this,f,!!t),i.PrepareDefinesForAttributes(e,f,!0,!0),f.isDirty){f.markAsProcessed(),l.resetCachedMaterial();var d=new i.EffectFallbacks;f.FOG&&d.addFallback(1,"FOG"),i.HandleFallbacksForShadows(f,d,this.maxSimultaneousLights),f.NUM_BONE_INFLUENCERS>0&&d.addCPUSkinningFallback(0,e),f.IMAGEPROCESSINGPOSTPROCESS=l.imageProcessingConfiguration.applyByPostProcess;var c=[i.VertexBuffer.PositionKind];f.NORMAL&&c.push(i.VertexBuffer.NormalKind),f.UV1&&c.push(i.VertexBuffer.UVKind),f.UV2&&c.push(i.VertexBuffer.UV2Kind),f.VERTEXCOLOR&&c.push(i.VertexBuffer.ColorKind),i.PrepareAttributesForBones(c,e,f,d),i.PrepareAttributesForInstances(c,f);var v=f.toString(),m=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vSpecularColor","vFogInfos","vFogColor","pointSize","vTextureInfos","mBones","textureMatrix","logarithmicDepthConstant","diffuse1Infos","diffuse2Infos","diffuse3Infos","diffuse4Infos","diffuse5Infos","diffuse6Infos","diffuse7Infos","diffuse8Infos"],p=["mixMap1Sampler","mixMap2Sampler","diffuse1Sampler","diffuse2Sampler","diffuse3Sampler","diffuse4Sampler","diffuse5Sampler","diffuse6Sampler","diffuse7Sampler","diffuse8Sampler"],h=[];i.AddClipPlaneUniforms(m),i.PrepareUniformsAndSamplersList({uniformsNames:m,uniformBuffersNames:h,samplers:p,defines:f,maxSimultaneousLights:this.maxSimultaneousLights}),n.setEffect(l.getEngine().createEffect("mix",{attributes:c,uniformsNames:m,uniformBuffersNames:h,samplers:p,defines:v,fallbacks:d,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:function(){return o(r,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return 1!==this.shaderLanguage?[3,2]:[4,Promise.all([Promise.resolve().then(function(){return di}),Promise.resolve().then(function(){return mi})])];case 1:return e.sent(),[3,4];case 2:return[4,Promise.all([Promise.resolve().then(function(){return gi}),Promise.resolve().then(function(){return Ti})])];case 3:e.sent(),e.label=4;case 4:return this._shadersLoaded=!0,[2]}})})}},u),f,this._materialContext)}return!(!n.effect||!n.effect.isReady()||(f._renderId=l.getRenderId(),s._wasPreviouslyReady=!0,s._wasPreviouslyUsingInstances=!!t,0))},n.prototype.bindForSubMesh=function(e,n,t){var r=this.getScene(),o=t.materialDefines;if(o){var a=t.effect;a&&(this._activeEffect=a,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),i.BindBonesParameters(n,this._activeEffect),this._mustRebind(r,a,t)&&(this._mixTexture1&&(this._activeEffect.setTexture("mixMap1Sampler",this._mixTexture1),this._activeEffect.setFloat2("vTextureInfos",this._mixTexture1.coordinatesIndex,this._mixTexture1.level),this._activeEffect.setMatrix("textureMatrix",this._mixTexture1.getTextureMatrix()),i.MaterialFlags.DiffuseTextureEnabled&&(this._diffuseTexture1&&(this._activeEffect.setTexture("diffuse1Sampler",this._diffuseTexture1),this._activeEffect.setFloat2("diffuse1Infos",this._diffuseTexture1.uScale,this._diffuseTexture1.vScale)),this._diffuseTexture2&&(this._activeEffect.setTexture("diffuse2Sampler",this._diffuseTexture2),this._activeEffect.setFloat2("diffuse2Infos",this._diffuseTexture2.uScale,this._diffuseTexture2.vScale)),this._diffuseTexture3&&(this._activeEffect.setTexture("diffuse3Sampler",this._diffuseTexture3),this._activeEffect.setFloat2("diffuse3Infos",this._diffuseTexture3.uScale,this._diffuseTexture3.vScale)),this._diffuseTexture4&&(this._activeEffect.setTexture("diffuse4Sampler",this._diffuseTexture4),this._activeEffect.setFloat2("diffuse4Infos",this._diffuseTexture4.uScale,this._diffuseTexture4.vScale)))),this._mixTexture2&&(this._activeEffect.setTexture("mixMap2Sampler",this._mixTexture2),i.MaterialFlags.DiffuseTextureEnabled&&(this._diffuseTexture5&&(this._activeEffect.setTexture("diffuse5Sampler",this._diffuseTexture5),this._activeEffect.setFloat2("diffuse5Infos",this._diffuseTexture5.uScale,this._diffuseTexture5.vScale)),this._diffuseTexture6&&(this._activeEffect.setTexture("diffuse6Sampler",this._diffuseTexture6),this._activeEffect.setFloat2("diffuse6Infos",this._diffuseTexture6.uScale,this._diffuseTexture6.vScale)),this._diffuseTexture7&&(this._activeEffect.setTexture("diffuse7Sampler",this._diffuseTexture7),this._activeEffect.setFloat2("diffuse7Infos",this._diffuseTexture7.uScale,this._diffuseTexture7.vScale)),this._diffuseTexture8&&(this._activeEffect.setTexture("diffuse8Sampler",this._diffuseTexture8),this._activeEffect.setFloat2("diffuse8Infos",this._diffuseTexture8.uScale,this._diffuseTexture8.vScale)))),i.BindClipPlane(a,this,r),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&i.BindLogDepth(o,a,r),r.bindEyePosition(a)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*n.visibility),o.SPECULARTERM&&this._activeEffect.setColor4("vSpecularColor",this.specularColor,this.specularPower),r.lightsEnabled&&!this.disableLighting&&i.BindLights(r,n,this._activeEffect,o,this.maxSimultaneousLights),r.fogEnabled&&n.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,n,this._activeEffect),this._afterBind(n,this._activeEffect,t))}},n.prototype.getAnimatables=function(){var e=[];return this._mixTexture1&&this._mixTexture1.animations&&this._mixTexture1.animations.length>0&&e.push(this._mixTexture1),this._mixTexture2&&this._mixTexture2.animations&&this._mixTexture2.animations.length>0&&e.push(this._mixTexture2),e},n.prototype.getActiveTextures=function(){var i=e.prototype.getActiveTextures.call(this);return this._mixTexture1&&i.push(this._mixTexture1),this._diffuseTexture1&&i.push(this._diffuseTexture1),this._diffuseTexture2&&i.push(this._diffuseTexture2),this._diffuseTexture3&&i.push(this._diffuseTexture3),this._diffuseTexture4&&i.push(this._diffuseTexture4),this._mixTexture2&&i.push(this._mixTexture2),this._diffuseTexture5&&i.push(this._diffuseTexture5),this._diffuseTexture6&&i.push(this._diffuseTexture6),this._diffuseTexture7&&i.push(this._diffuseTexture7),this._diffuseTexture8&&i.push(this._diffuseTexture8),i},n.prototype.hasTexture=function(i){return!!e.prototype.hasTexture.call(this,i)||this._mixTexture1===i||this._diffuseTexture1===i||this._diffuseTexture2===i||this._diffuseTexture3===i||this._diffuseTexture4===i||this._mixTexture2===i||this._diffuseTexture5===i||this._diffuseTexture6===i||this._diffuseTexture7===i||this._diffuseTexture8===i},n.prototype.dispose=function(i){this._mixTexture1&&this._mixTexture1.dispose(),e.prototype.dispose.call(this,i)},n.prototype.clone=function(e){var t=this;return i.SerializationHelper.Clone(function(){return new n(e,t.getScene())},this)},n.prototype.serialize=function(){var i=e.prototype.serialize.call(this);return i.customType="BABYLON.MixMaterial",i},n.prototype.getClassName=function(){return"MixMaterial"},n.Parse=function(e,t,r){return i.SerializationHelper.Parse(function(){return new n(e.name,t)},e,t,r)},r([i.serializeAsTexture("mixTexture1")],n.prototype,"_mixTexture1",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"mixTexture1",void 0),r([i.serializeAsTexture("mixTexture2")],n.prototype,"_mixTexture2",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"mixTexture2",void 0),r([i.serializeAsTexture("diffuseTexture1")],n.prototype,"_diffuseTexture1",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"diffuseTexture1",void 0),r([i.serializeAsTexture("diffuseTexture2")],n.prototype,"_diffuseTexture2",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"diffuseTexture2",void 0),r([i.serializeAsTexture("diffuseTexture3")],n.prototype,"_diffuseTexture3",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"diffuseTexture3",void 0),r([i.serializeAsTexture("diffuseTexture4")],n.prototype,"_diffuseTexture4",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"diffuseTexture4",void 0),r([i.serializeAsTexture("diffuseTexture1")],n.prototype,"_diffuseTexture5",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"diffuseTexture5",void 0),r([i.serializeAsTexture("diffuseTexture2")],n.prototype,"_diffuseTexture6",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"diffuseTexture6",void 0),r([i.serializeAsTexture("diffuseTexture3")],n.prototype,"_diffuseTexture7",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"diffuseTexture7",void 0),r([i.serializeAsTexture("diffuseTexture4")],n.prototype,"_diffuseTexture8",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"diffuseTexture8",void 0),r([i.serializeAsColor3()],n.prototype,"diffuseColor",void 0),r([i.serializeAsColor3()],n.prototype,"specularColor",void 0),r([i.serialize()],n.prototype,"specularPower",void 0),r([i.serialize("disableLighting")],n.prototype,"_disableLighting",void 0),r([i.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"disableLighting",void 0),r([i.serialize("maxSimultaneousLights")],n.prototype,"_maxSimultaneousLights",void 0),r([i.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"maxSimultaneousLights",void 0),n}(i.PushMaterial);i.RegisterClass("BABYLON.MixMaterial",y);var L=function(e){function i(){var i=e.call(this)||this;return i.DIFFUSE=!1,i.CLIPPLANE=!1,i.CLIPPLANE2=!1,i.CLIPPLANE3=!1,i.CLIPPLANE4=!1,i.CLIPPLANE5=!1,i.CLIPPLANE6=!1,i.ALPHATEST=!1,i.DEPTHPREPASS=!1,i.POINTSIZE=!1,i.FOG=!1,i.LIGHT0=!1,i.LIGHT1=!1,i.LIGHT2=!1,i.LIGHT3=!1,i.SPOTLIGHT0=!1,i.SPOTLIGHT1=!1,i.SPOTLIGHT2=!1,i.SPOTLIGHT3=!1,i.HEMILIGHT0=!1,i.HEMILIGHT1=!1,i.HEMILIGHT2=!1,i.HEMILIGHT3=!1,i.DIRLIGHT0=!1,i.DIRLIGHT1=!1,i.DIRLIGHT2=!1,i.DIRLIGHT3=!1,i.POINTLIGHT0=!1,i.POINTLIGHT1=!1,i.POINTLIGHT2=!1,i.POINTLIGHT3=!1,i.SHADOW0=!1,i.SHADOW1=!1,i.SHADOW2=!1,i.SHADOW3=!1,i.SHADOWS=!1,i.SHADOWESM0=!1,i.SHADOWESM1=!1,i.SHADOWESM2=!1,i.SHADOWESM3=!1,i.SHADOWPOISSON0=!1,i.SHADOWPOISSON1=!1,i.SHADOWPOISSON2=!1,i.SHADOWPOISSON3=!1,i.SHADOWPCF0=!1,i.SHADOWPCF1=!1,i.SHADOWPCF2=!1,i.SHADOWPCF3=!1,i.SHADOWPCSS0=!1,i.SHADOWPCSS1=!1,i.SHADOWPCSS2=!1,i.SHADOWPCSS3=!1,i.NORMAL=!1,i.UV1=!1,i.UV2=!1,i.NUM_BONE_INFLUENCERS=0,i.BonesPerMesh=0,i.INSTANCES=!1,i.THIN_INSTANCES=!1,i.LIGHTING=!1,i.IMAGEPROCESSINGPOSTPROCESS=!1,i.SKIPFINALCOLORCLAMP=!1,i.LOGARITHMICDEPTH=!1,i.AREALIGHTSUPPORTED=!0,i.AREALIGHTNOROUGHTNESS=!0,i.rebuild(),i}return t(i,e),i}(i.MaterialDefines),A=function(e){function n(n,t,r){void 0===r&&(r=!1);var o=e.call(this,n,t,void 0,r)||this;return o.diffuseColor=new i.Color3(1,1,1),o._disableLighting=!1,o._maxSimultaneousLights=4,o._shadersLoaded=!1,o}return t(n,e),n.prototype.needAlphaBlending=function(){return this.alpha<1},n.prototype.needAlphaBlendingForMesh=function(e){return this.needAlphaBlending()||e.visibility<1},n.prototype.needAlphaTesting=function(){return!1},n.prototype.getAlphaTestTexture=function(){return null},n.prototype.isReadyForSubMesh=function(e,n,t){var r=this,s=n._drawWrapper;if(this.isFrozen&&s.effect&&s._wasPreviouslyReady&&s._wasPreviouslyUsingInstances===t)return!0;n.materialDefines||(n.materialDefines=new L);var f=n.materialDefines,l=this.getScene();if(this._isReadyForSubMesh(n))return!0;var u=l.getEngine();if(f._areTexturesDirty&&(f._needUVs=!1,l.texturesEnabled&&this._diffuseTexture&&i.MaterialFlags.DiffuseTextureEnabled)){if(!this._diffuseTexture.isReady())return!1;f._needUVs=!0,f.DIFFUSE=!0}if(i.PrepareDefinesForMisc(e,l,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),f,void 0,void 0,void 0,this._isVertexOutputInvariant),f._needNormals=!0,i.PrepareDefinesForLights(l,e,f,!1,this._maxSimultaneousLights,this._disableLighting),i.PrepareDefinesForFrameBoundValues(l,u,this,f,!!t,null,n.getRenderingMesh().hasThinInstances),f.LIGHTING=!this._disableLighting,i.PrepareDefinesForAttributes(e,f,!0,!0),f.isDirty){f.markAsProcessed(),l.resetCachedMaterial();var d=new i.EffectFallbacks;f.FOG&&d.addFallback(1,"FOG"),i.HandleFallbacksForShadows(f,d),f.NUM_BONE_INFLUENCERS>0&&d.addCPUSkinningFallback(0,e),f.IMAGEPROCESSINGPOSTPROCESS=l.imageProcessingConfiguration.applyByPostProcess;var c=[i.VertexBuffer.PositionKind];f.NORMAL&&c.push(i.VertexBuffer.NormalKind),f.UV1&&c.push(i.VertexBuffer.UVKind),f.UV2&&c.push(i.VertexBuffer.UV2Kind),i.PrepareAttributesForBones(c,e,f,d),i.PrepareAttributesForInstances(c,f);var v=f.toString(),m=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vFogInfos","vFogColor","pointSize","vDiffuseInfos","mBones","diffuseMatrix","logarithmicDepthConstant"],p=["diffuseSampler","areaLightsLTC1Sampler","areaLightsLTC2Sampler"],h=[];i.AddClipPlaneUniforms(m),i.PrepareUniformsAndSamplersList({uniformsNames:m,uniformBuffersNames:h,samplers:p,defines:f,maxSimultaneousLights:4}),n.setEffect(l.getEngine().createEffect("normal",{attributes:c,uniformsNames:m,uniformBuffersNames:h,samplers:p,defines:v,fallbacks:d,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:function(){return o(r,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return 1!==this.shaderLanguage?[3,2]:[4,Promise.all([Promise.resolve().then(function(){return Ei}),Promise.resolve().then(function(){return yi})])];case 1:return e.sent(),[3,4];case 2:return[4,Promise.all([Promise.resolve().then(function(){return Oi}),Promise.resolve().then(function(){return bi})])];case 3:e.sent(),e.label=4;case 4:return this._shadersLoaded=!0,[2]}})})}},u),f,this._materialContext)}if(f.AREALIGHTUSED)for(var g=0;g<e.lightSources.length;g++)if(!e.lightSources[g]._isReady())return!1;return!(!n.effect||!n.effect.isReady()||(f._renderId=l.getRenderId(),s._wasPreviouslyReady=!0,s._wasPreviouslyUsingInstances=!!t,0))},n.prototype.bindForSubMesh=function(e,n,t){var r=this.getScene(),o=t.materialDefines;if(o){var a=t.effect;a&&(this._activeEffect=a,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),i.BindBonesParameters(n,this._activeEffect),this._mustRebind(r,a,t)&&(this.diffuseTexture&&i.MaterialFlags.DiffuseTextureEnabled&&(this._activeEffect.setTexture("diffuseSampler",this.diffuseTexture),this._activeEffect.setFloat2("vDiffuseInfos",this.diffuseTexture.coordinatesIndex,this.diffuseTexture.level),this._activeEffect.setMatrix("diffuseMatrix",this.diffuseTexture.getTextureMatrix())),i.BindClipPlane(a,this,r),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&i.BindLogDepth(o,a,r),r.bindEyePosition(a)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*n.visibility),r.lightsEnabled&&!this.disableLighting&&i.BindLights(r,n,this._activeEffect,o),r.fogEnabled&&n.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,n,this._activeEffect),this._afterBind(n,this._activeEffect,t))}},n.prototype.getAnimatables=function(){var e=[];return this.diffuseTexture&&this.diffuseTexture.animations&&this.diffuseTexture.animations.length>0&&e.push(this.diffuseTexture),e},n.prototype.getActiveTextures=function(){var i=e.prototype.getActiveTextures.call(this);return this._diffuseTexture&&i.push(this._diffuseTexture),i},n.prototype.hasTexture=function(i){return!!e.prototype.hasTexture.call(this,i)||this.diffuseTexture===i},n.prototype.dispose=function(i){this.diffuseTexture&&this.diffuseTexture.dispose(),e.prototype.dispose.call(this,i)},n.prototype.clone=function(e){var t=this;return i.SerializationHelper.Clone(function(){return new n(e,t.getScene())},this)},n.prototype.serialize=function(){var i=e.prototype.serialize.call(this);return i.customType="BABYLON.NormalMaterial",i},n.prototype.getClassName=function(){return"NormalMaterial"},n.Parse=function(e,t,r){return i.SerializationHelper.Parse(function(){return new n(e.name,t)},e,t,r)},r([i.serializeAsTexture("diffuseTexture")],n.prototype,"_diffuseTexture",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"diffuseTexture",void 0),r([i.serializeAsColor3()],n.prototype,"diffuseColor",void 0),r([i.serialize("disableLighting")],n.prototype,"_disableLighting",void 0),r([i.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"disableLighting",void 0),r([i.serialize("maxSimultaneousLights")],n.prototype,"_maxSimultaneousLights",void 0),r([i.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"maxSimultaneousLights",void 0),n}(i.PushMaterial);i.RegisterClass("BABYLON.NormalMaterial",A);var O=function(e){function i(){var i=e.call(this)||this;return i.CLIPPLANE=!1,i.CLIPPLANE2=!1,i.CLIPPLANE3=!1,i.CLIPPLANE4=!1,i.CLIPPLANE5=!1,i.CLIPPLANE6=!1,i.POINTSIZE=!1,i.FOG=!1,i.NORMAL=!1,i.NUM_BONE_INFLUENCERS=0,i.BonesPerMesh=0,i.INSTANCES=!1,i.IMAGEPROCESSINGPOSTPROCESS=!1,i.SKIPFINALCOLORCLAMP=!1,i.LOGARITHMICDEPTH=!1,i.rebuild(),i}return t(i,e),i}(i.MaterialDefines),D=function(e){function n(n,t,r){void 0===r&&(r=!1);var o=e.call(this,n,t,void 0,r)||this;return o._needAlphaBlending=!0,o._shadersLoaded=!1,o.shadowColor=i.Color3.Black(),o}return t(n,e),n.prototype.needAlphaBlending=function(){return this._needAlphaBlending},n.prototype.needAlphaTesting=function(){return!1},n.prototype.getAlphaTestTexture=function(){return null},Object.defineProperty(n.prototype,"activeLight",{get:function(){return this._activeLight},set:function(e){this._activeLight=e},enumerable:!1,configurable:!0}),n.prototype._getFirstShadowLightForMesh=function(e){for(var i=0,n=e.lightSources;i<n.length;i++){var t=n[i];if(t.shadowEnabled)return t}return null},n.prototype.isReadyForSubMesh=function(e,n,t){var r,s=this,f=n._drawWrapper;if(this.isFrozen&&f.effect&&f._wasPreviouslyReady&&f._wasPreviouslyUsingInstances===t)return!0;n.materialDefines||(n.materialDefines=new O);var l=n.materialDefines,u=this.getScene();if(this._isReadyForSubMesh(n))return!0;var d=u.getEngine();if(this._activeLight)for(var c=0,v=e.lightSources;c<v.length;c++){var m=v[c];if(m.shadowEnabled){if(this._activeLight===m)break;var p=e.lightSources.indexOf(this._activeLight);-1!==p&&(e.lightSources.splice(p,1),e.lightSources.splice(0,0,this._activeLight));break}}i.PrepareDefinesForFrameBoundValues(u,d,this,l,!!t),i.PrepareDefinesForMisc(e,u,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),l,void 0,void 0,void 0,this._isVertexOutputInvariant),l._needNormals=i.PrepareDefinesForLights(u,e,l,!1,1);var h=null===(r=this._getFirstShadowLightForMesh(e))||void 0===r?void 0:r.getShadowGenerator();if(this._needAlphaBlending=!0,h&&h.getClassName&&"CascadedShadowGenerator"===h.getClassName()){var g=h;this._needAlphaBlending=!g.autoCalcDepthBounds}if(i.PrepareDefinesForAttributes(e,l,!1,!0),l.isDirty){l.markAsProcessed(),u.resetCachedMaterial();var S=new i.EffectFallbacks;l.FOG&&S.addFallback(1,"FOG"),i.HandleFallbacksForShadows(l,S,1),l.NUM_BONE_INFLUENCERS>0&&S.addCPUSkinningFallback(0,e),l.IMAGEPROCESSINGPOSTPROCESS=u.imageProcessingConfiguration.applyByPostProcess;var x=[i.VertexBuffer.PositionKind];l.NORMAL&&x.push(i.VertexBuffer.NormalKind),i.PrepareAttributesForBones(x,e,l,S),i.PrepareAttributesForInstances(x,l);var T=l.toString(),_=["world","view","viewProjection","vEyePosition","vLightsType","vFogInfos","vFogColor","pointSize","alpha","shadowColor","mBones","logarithmicDepthConstant"],C=[],E=["Scene"];i.AddClipPlaneUniforms(_),i.PrepareUniformsAndSamplersList({uniformsNames:_,uniformBuffersNames:E,samplers:C,defines:l,maxSimultaneousLights:1}),n.setEffect(u.getEngine().createEffect("shadowOnly",{attributes:x,uniformsNames:_,uniformBuffersNames:E,samplers:C,defines:T,fallbacks:S,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:1},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:function(){return o(s,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return 1!==this.shaderLanguage?[3,2]:[4,Promise.all([Promise.resolve().then(function(){return Ri}),Promise.resolve().then(function(){return wi})])];case 1:return e.sent(),[3,4];case 2:return[4,Promise.all([Promise.resolve().then(function(){return Gi}),Promise.resolve().then(function(){return Xi})])];case 3:e.sent(),e.label=4;case 4:return this._shadersLoaded=!0,[2]}})})}},d),l,this._materialContext)}return!(!n.effect||!n.effect.isReady()||(l._renderId=u.getRenderId(),f._wasPreviouslyReady=!0,f._wasPreviouslyUsingInstances=!!t,0))},n.prototype.bindForSubMesh=function(e,n,t){var r=this.getScene(),o=t.materialDefines;if(o){var a=t.effect;if(a){if(this._activeEffect=a,this.bindOnlyWorldMatrix(e),this.bindViewProjection(a),i.BindBonesParameters(n,this._activeEffect),this._mustRebind(r,a,t)&&(i.BindClipPlane(a,this,r),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._activeEffect.setFloat("alpha",this.alpha),this._activeEffect.setColor3("shadowColor",this.shadowColor),this._useLogarithmicDepth&&i.BindLogDepth(o,a,r),r.bindEyePosition(a)),r.lightsEnabled){i.BindLights(r,n,this._activeEffect,o,1);var s=this._getFirstShadowLightForMesh(n);s&&(s._renderId=-1)}(r.fogEnabled&&n.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE||o.SHADOWCSM0)&&this.bindView(a),i.BindFogParameters(r,n,this._activeEffect),this._afterBind(n,this._activeEffect,t)}}},n.prototype.clone=function(e){var t=this;return i.SerializationHelper.Clone(function(){return new n(e,t.getScene())},this)},n.prototype.serialize=function(){var i=e.prototype.serialize.call(this);return i.customType="BABYLON.ShadowOnlyMaterial",i},n.prototype.getClassName=function(){return"ShadowOnlyMaterial"},n.Parse=function(e,t,r){return i.SerializationHelper.Parse(function(){return new n(e.name,t)},e,t,r)},n}(i.PushMaterial);i.RegisterClass("BABYLON.ShadowOnlyMaterial",D);var N=function(e){function i(){var i=e.call(this)||this;return i.DIFFUSE=!1,i.CLIPPLANE=!1,i.CLIPPLANE2=!1,i.CLIPPLANE3=!1,i.CLIPPLANE4=!1,i.CLIPPLANE5=!1,i.CLIPPLANE6=!1,i.ALPHATEST=!1,i.DEPTHPREPASS=!1,i.POINTSIZE=!1,i.FOG=!1,i.NORMAL=!1,i.UV1=!1,i.UV2=!1,i.VERTEXCOLOR=!1,i.VERTEXALPHA=!1,i.NUM_BONE_INFLUENCERS=0,i.BonesPerMesh=0,i.INSTANCES=!1,i.INSTANCESCOLOR=!1,i.IMAGEPROCESSINGPOSTPROCESS=!1,i.SKIPFINALCOLORCLAMP=!1,i.LOGARITHMICDEPTH=!1,i.AREALIGHTSUPPORTED=!0,i.AREALIGHTNOROUGHTNESS=!0,i.rebuild(),i}return t(i,e),i}(i.MaterialDefines),b=function(e){function n(n,t,r){void 0===r&&(r=!1);var o=e.call(this,n,t,void 0,r)||this;return o.diffuseColor=new i.Color3(1,1,1),o._disableLighting=!1,o._maxSimultaneousLights=4,o._shadersLoaded=!1,o}return t(n,e),n.prototype.needAlphaBlending=function(){return this.alpha<1},n.prototype.needAlphaTesting=function(){return!1},n.prototype.getAlphaTestTexture=function(){return null},n.prototype.isReadyForSubMesh=function(e,n,t){var r=this,s=n._drawWrapper;if(this.isFrozen&&s.effect&&s._wasPreviouslyReady&&s._wasPreviouslyUsingInstances===t)return!0;n.materialDefines||(n.materialDefines=new N);var f=n.materialDefines,l=this.getScene();if(this._isReadyForSubMesh(n))return!0;var u=l.getEngine();if(f._areTexturesDirty&&(f._needUVs=!1,l.texturesEnabled&&this._diffuseTexture&&i.MaterialFlags.DiffuseTextureEnabled)){if(!this._diffuseTexture.isReady())return!1;f._needUVs=!0,f.DIFFUSE=!0}if(i.PrepareDefinesForMisc(e,l,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),f,void 0,void 0,void 0,this._isVertexOutputInvariant),f._needNormals=i.PrepareDefinesForLights(l,e,f,!1,this._maxSimultaneousLights,this._disableLighting),i.PrepareDefinesForFrameBoundValues(l,u,this,f,!!t),i.PrepareDefinesForAttributes(e,f,!0,!0),f.isDirty){f.markAsProcessed(),l.resetCachedMaterial();var d=new i.EffectFallbacks;f.FOG&&d.addFallback(1,"FOG"),i.HandleFallbacksForShadows(f,d,this.maxSimultaneousLights),f.NUM_BONE_INFLUENCERS>0&&d.addCPUSkinningFallback(0,e),f.IMAGEPROCESSINGPOSTPROCESS=l.imageProcessingConfiguration.applyByPostProcess;var c=[i.VertexBuffer.PositionKind];f.NORMAL&&c.push(i.VertexBuffer.NormalKind),f.UV1&&c.push(i.VertexBuffer.UVKind),f.UV2&&c.push(i.VertexBuffer.UV2Kind),f.VERTEXCOLOR&&c.push(i.VertexBuffer.ColorKind),i.PrepareAttributesForBones(c,e,f,d),i.PrepareAttributesForInstances(c,f);var v=f.toString(),m=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vFogInfos","vFogColor","pointSize","vDiffuseInfos","mBones","diffuseMatrix","logarithmicDepthConstant"],p=["diffuseSampler","areaLightsLTC1Sampler","areaLightsLTC2Sampler"],h=[];i.AddClipPlaneUniforms(m),i.PrepareUniformsAndSamplersList({uniformsNames:m,uniformBuffersNames:h,samplers:p,defines:f,maxSimultaneousLights:this.maxSimultaneousLights}),n.setEffect(l.getEngine().createEffect("simple",{attributes:c,uniformsNames:m,uniformBuffersNames:h,samplers:p,defines:v,fallbacks:d,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights-1},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:function(){return o(r,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return 1!==this.shaderLanguage?[3,2]:[4,Promise.all([Promise.resolve().then(function(){return Zi}),Promise.resolve().then(function(){return qi})])];case 1:return e.sent(),[3,4];case 2:return[4,Promise.all([Promise.resolve().then(function(){return $i}),Promise.resolve().then(function(){return tn})])];case 3:e.sent(),e.label=4;case 4:return this._shadersLoaded=!0,[2]}})})}},u),f,this._materialContext)}if(f.AREALIGHTUSED)for(var g=0;g<e.lightSources.length;g++)if(!e.lightSources[g]._isReady())return!1;return!(!n.effect||!n.effect.isReady()||(f._renderId=l.getRenderId(),s._wasPreviouslyReady=!0,s._wasPreviouslyUsingInstances=!!t,0))},n.prototype.bindForSubMesh=function(e,n,t){var r=this.getScene(),o=t.materialDefines;if(o){var a=t.effect;a&&(this._activeEffect=a,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),i.BindBonesParameters(n,this._activeEffect),this._mustRebind(r,a,t)&&(this._diffuseTexture&&i.MaterialFlags.DiffuseTextureEnabled&&(this._activeEffect.setTexture("diffuseSampler",this._diffuseTexture),this._activeEffect.setFloat2("vDiffuseInfos",this._diffuseTexture.coordinatesIndex,this._diffuseTexture.level),this._activeEffect.setMatrix("diffuseMatrix",this._diffuseTexture.getTextureMatrix())),i.BindClipPlane(a,this,r),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&i.BindLogDepth(o,a,r),r.bindEyePosition(a)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*n.visibility),r.lightsEnabled&&!this.disableLighting&&i.BindLights(r,n,this._activeEffect,o,this.maxSimultaneousLights),r.fogEnabled&&n.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,n,this._activeEffect),this._afterBind(n,this._activeEffect,t))}},n.prototype.getAnimatables=function(){var e=[];return this._diffuseTexture&&this._diffuseTexture.animations&&this._diffuseTexture.animations.length>0&&e.push(this._diffuseTexture),e},n.prototype.getActiveTextures=function(){var i=e.prototype.getActiveTextures.call(this);return this._diffuseTexture&&i.push(this._diffuseTexture),i},n.prototype.hasTexture=function(i){return!!e.prototype.hasTexture.call(this,i)||this.diffuseTexture===i},n.prototype.dispose=function(i){this._diffuseTexture&&this._diffuseTexture.dispose(),e.prototype.dispose.call(this,i)},n.prototype.clone=function(e){var t=this;return i.SerializationHelper.Clone(function(){return new n(e,t.getScene())},this)},n.prototype.serialize=function(){var i=e.prototype.serialize.call(this);return i.customType="BABYLON.SimpleMaterial",i},n.prototype.getClassName=function(){return"SimpleMaterial"},n.Parse=function(e,t,r){return i.SerializationHelper.Parse(function(){return new n(e.name,t)},e,t,r)},r([i.serializeAsTexture("diffuseTexture")],n.prototype,"_diffuseTexture",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"diffuseTexture",void 0),r([i.serializeAsColor3("diffuse")],n.prototype,"diffuseColor",void 0),r([i.serialize("disableLighting")],n.prototype,"_disableLighting",void 0),r([i.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"disableLighting",void 0),r([i.serialize("maxSimultaneousLights")],n.prototype,"_maxSimultaneousLights",void 0),r([i.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"maxSimultaneousLights",void 0),n}(i.PushMaterial);i.RegisterClass("BABYLON.SimpleMaterial",b);var F=function(e){function i(){var i=e.call(this)||this;return i.CLIPPLANE=!1,i.CLIPPLANE2=!1,i.CLIPPLANE3=!1,i.CLIPPLANE4=!1,i.CLIPPLANE5=!1,i.CLIPPLANE6=!1,i.POINTSIZE=!1,i.FOG=!1,i.VERTEXCOLOR=!1,i.VERTEXALPHA=!1,i.IMAGEPROCESSINGPOSTPROCESS=!1,i.SKIPFINALCOLORCLAMP=!1,i.DITHER=!1,i.LOGARITHMICDEPTH=!1,i.rebuild(),i}return t(i,e),i}(i.MaterialDefines),M=function(e){function n(n,t,r){void 0===r&&(r=!1);var o=e.call(this,n,t,void 0,r)||this;return o.luminance=1,o.turbidity=10,o.rayleigh=2,o.mieCoefficient=.005,o.mieDirectionalG=.8,o.distance=500,o.inclination=.49,o.azimuth=.25,o.sunPosition=new i.Vector3(0,100,0),o.useSunPosition=!1,o.cameraOffset=i.Vector3.Zero(),o.up=i.Vector3.Up(),o.dithering=!1,o._cameraPosition=i.Vector3.Zero(),o._skyOrientation=new i.Quaternion,o._shadersLoaded=!1,o}return t(n,e),n.prototype.needAlphaBlending=function(){return this.alpha<1},n.prototype.needAlphaTesting=function(){return!1},n.prototype.getAlphaTestTexture=function(){return null},n.prototype.isReadyForSubMesh=function(e,n){var t=this,r=n._drawWrapper;if(this.isFrozen&&r.effect&&r._wasPreviouslyReady)return!0;n.materialDefines||(n.materialDefines=new F);var s=n.materialDefines,f=this.getScene();if(this._isReadyForSubMesh(n))return!0;if(i.PrepareDefinesForMisc(e,f,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,!1,s,void 0,void 0,void 0,this._isVertexOutputInvariant),i.PrepareDefinesForAttributes(e,s,!0,!1),s.IMAGEPROCESSINGPOSTPROCESS!==f.imageProcessingConfiguration.applyByPostProcess&&s.markAsMiscDirty(),s.DITHER!==this.dithering&&s.markAsMiscDirty(),s.isDirty){s.markAsProcessed(),f.resetCachedMaterial();var l=new i.EffectFallbacks;s.FOG&&l.addFallback(1,"FOG"),s.IMAGEPROCESSINGPOSTPROCESS=f.imageProcessingConfiguration.applyByPostProcess,s.DITHER=this.dithering;var u=[i.VertexBuffer.PositionKind];s.VERTEXCOLOR&&u.push(i.VertexBuffer.ColorKind);var d=["world","viewProjection","view","vFogInfos","vFogColor","logarithmicDepthConstant","pointSize","luminance","turbidity","rayleigh","mieCoefficient","mieDirectionalG","sunPosition","cameraPosition","cameraOffset","up"];i.AddClipPlaneUniforms(d);var c=s.toString();n.setEffect(f.getEngine().createEffect("sky",{attributes:u,uniformsNames:d,uniformBuffersNames:[],samplers:[],defines:c,fallbacks:l,onCompiled:this.onCompiled,onError:this.onError,shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:function(){return o(t,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return 1!==this.shaderLanguage?[3,2]:[4,Promise.all([Promise.resolve().then(function(){return an}),Promise.resolve().then(function(){return ln})])];case 1:return e.sent(),[3,4];case 2:return[4,Promise.all([Promise.resolve().then(function(){return cn}),Promise.resolve().then(function(){return pn})])];case 3:e.sent(),e.label=4;case 4:return this._shadersLoaded=!0,[2]}})})}},f.getEngine()),s,this._materialContext)}return!(!n.effect||!n.effect.isReady()||(s._renderId=f.getRenderId(),r._wasPreviouslyReady=!0,0))},n.prototype.bindForSubMesh=function(e,n,t){var r=this.getScene(),o=t.materialDefines;if(o){var a=t.effect;if(a){this._activeEffect=a,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),this._mustRebind(r,a,t)&&(i.BindClipPlane(a,this,r),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&i.BindLogDepth(o,a,r)),r.fogEnabled&&n.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,n,this._activeEffect);var s=r.activeCamera;if(s){var f=s.getWorldMatrix();this._cameraPosition.x=f.m[12],this._cameraPosition.y=f.m[13],this._cameraPosition.z=f.m[14],this._activeEffect.setVector3("cameraPosition",i.TmpVectors.Vector3[0].copyFrom(this._cameraPosition).subtractInPlace(r.floatingOriginOffset))}if(this._activeEffect.setVector3("cameraOffset",this.cameraOffset),this._activeEffect.setVector3("up",this.up),this.luminance>0&&this._activeEffect.setFloat("luminance",this.luminance),this._activeEffect.setFloat("turbidity",this.turbidity),this._activeEffect.setFloat("rayleigh",this.rayleigh),this._activeEffect.setFloat("mieCoefficient",this.mieCoefficient),this._activeEffect.setFloat("mieDirectionalG",this.mieDirectionalG),!this.useSunPosition){var l=Math.PI*(this.inclination-.5),u=2*Math.PI*(this.azimuth-.5);this.sunPosition.x=this.distance*Math.cos(u)*Math.cos(l),this.sunPosition.y=this.distance*Math.sin(-l),this.sunPosition.z=this.distance*Math.sin(u)*Math.cos(l),i.Quaternion.FromUnitVectorsToRef(i.Vector3.UpReadOnly,this.up,this._skyOrientation),this.sunPosition.rotateByQuaternionToRef(this._skyOrientation,this.sunPosition)}this._activeEffect.setVector3("sunPosition",this.sunPosition),this._afterBind(n,this._activeEffect,t)}}},n.prototype.getAnimatables=function(){return[]},n.prototype.dispose=function(i){e.prototype.dispose.call(this,i)},n.prototype.clone=function(e){var t=this;return i.SerializationHelper.Clone(function(){return new n(e,t.getScene())},this)},n.prototype.serialize=function(){var i=e.prototype.serialize.call(this);return i.customType="BABYLON.SkyMaterial",i},n.prototype.getClassName=function(){return"SkyMaterial"},n.Parse=function(e,t,r){return i.SerializationHelper.Parse(function(){return new n(e.name,t)},e,t,r)},r([i.serialize()],n.prototype,"luminance",void 0),r([i.serialize()],n.prototype,"turbidity",void 0),r([i.serialize()],n.prototype,"rayleigh",void 0),r([i.serialize()],n.prototype,"mieCoefficient",void 0),r([i.serialize()],n.prototype,"mieDirectionalG",void 0),r([i.serialize()],n.prototype,"distance",void 0),r([i.serialize()],n.prototype,"inclination",void 0),r([i.serialize()],n.prototype,"azimuth",void 0),r([i.serializeAsVector3()],n.prototype,"sunPosition",void 0),r([i.serialize()],n.prototype,"useSunPosition",void 0),r([i.serializeAsVector3()],n.prototype,"cameraOffset",void 0),r([i.serializeAsVector3()],n.prototype,"up",void 0),r([i.serialize()],n.prototype,"dithering",void 0),n}(i.PushMaterial);i.RegisterClass("BABYLON.SkyMaterial",M);var R=function(e){function i(){var i=e.call(this)||this;return i.DIFFUSE=!1,i.BUMP=!1,i.CLIPPLANE=!1,i.CLIPPLANE2=!1,i.CLIPPLANE3=!1,i.CLIPPLANE4=!1,i.CLIPPLANE5=!1,i.CLIPPLANE6=!1,i.ALPHATEST=!1,i.DEPTHPREPASS=!1,i.POINTSIZE=!1,i.FOG=!1,i.SPECULARTERM=!1,i.NORMAL=!1,i.UV1=!1,i.UV2=!1,i.VERTEXCOLOR=!1,i.VERTEXALPHA=!1,i.NUM_BONE_INFLUENCERS=0,i.BonesPerMesh=0,i.INSTANCES=!1,i.INSTANCESCOLOR=!1,i.IMAGEPROCESSINGPOSTPROCESS=!1,i.SKIPFINALCOLORCLAMP=!1,i.LOGARITHMICDEPTH=!1,i.AREALIGHTSUPPORTED=!0,i.AREALIGHTNOROUGHTNESS=!0,i.rebuild(),i}return t(i,e),i}(i.MaterialDefines),V=function(e){function n(n,t,r){void 0===r&&(r=!1);var o=e.call(this,n,t,void 0,r)||this;return o.diffuseColor=new i.Color3(1,1,1),o.specularColor=new i.Color3(0,0,0),o.specularPower=64,o._disableLighting=!1,o._maxSimultaneousLights=4,o._shadersLoaded=!1,o}return t(n,e),n.prototype.needAlphaBlending=function(){return this.alpha<1},n.prototype.needAlphaTesting=function(){return!1},n.prototype.getAlphaTestTexture=function(){return null},n.prototype.isReadyForSubMesh=function(e,n,t){var r=this,s=n._drawWrapper;if(this.isFrozen&&s.effect&&s._wasPreviouslyReady&&s._wasPreviouslyUsingInstances===t)return!0;n.materialDefines||(n.materialDefines=new R);var f=n.materialDefines,l=this.getScene();if(this._isReadyForSubMesh(n))return!0;var u=l.getEngine();if(l.texturesEnabled){if(!this.mixTexture||!this.mixTexture.isReady())return!1;if(f._needUVs=!0,i.MaterialFlags.DiffuseTextureEnabled){if(!this.diffuseTexture1||!this.diffuseTexture1.isReady())return!1;if(!this.diffuseTexture2||!this.diffuseTexture2.isReady())return!1;if(!this.diffuseTexture3||!this.diffuseTexture3.isReady())return!1;f.DIFFUSE=!0}if(this.bumpTexture1&&this.bumpTexture2&&this.bumpTexture3&&i.MaterialFlags.BumpTextureEnabled){if(!this.bumpTexture1.isReady())return!1;if(!this.bumpTexture2.isReady())return!1;if(!this.bumpTexture3.isReady())return!1;f._needNormals=!0,f.BUMP=!0}}if(i.PrepareDefinesForMisc(e,l,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),f,void 0,void 0,void 0,this._isVertexOutputInvariant),f._needNormals=i.PrepareDefinesForLights(l,e,f,!1,this._maxSimultaneousLights,this._disableLighting),i.PrepareDefinesForFrameBoundValues(l,u,this,f,!!t),i.PrepareDefinesForAttributes(e,f,!0,!0),f.isDirty){f.markAsProcessed(),l.resetCachedMaterial();var d=new i.EffectFallbacks;f.FOG&&d.addFallback(1,"FOG"),i.HandleFallbacksForShadows(f,d,this.maxSimultaneousLights),f.NUM_BONE_INFLUENCERS>0&&d.addCPUSkinningFallback(0,e),f.IMAGEPROCESSINGPOSTPROCESS=l.imageProcessingConfiguration.applyByPostProcess;var c=[i.VertexBuffer.PositionKind];f.NORMAL&&c.push(i.VertexBuffer.NormalKind),f.UV1&&c.push(i.VertexBuffer.UVKind),f.UV2&&c.push(i.VertexBuffer.UV2Kind),f.VERTEXCOLOR&&c.push(i.VertexBuffer.ColorKind),i.PrepareAttributesForBones(c,e,f,d),i.PrepareAttributesForInstances(c,f);var v=f.toString(),m=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vSpecularColor","vFogInfos","vFogColor","pointSize","vTextureInfos","mBones","textureMatrix","diffuse1Infos","diffuse2Infos","diffuse3Infos"],p=["textureSampler","diffuse1Sampler","diffuse2Sampler","diffuse3Sampler","bump1Sampler","bump2Sampler","bump3Sampler","logarithmicDepthConstant","areaLightsLTC1Sampler","areaLightsLTC2Sampler"],h=[];i.AddClipPlaneUniforms(m),i.PrepareUniformsAndSamplersList({uniformsNames:m,uniformBuffersNames:h,samplers:p,defines:f,maxSimultaneousLights:this.maxSimultaneousLights}),n.setEffect(l.getEngine().createEffect("terrain",{attributes:c,uniformsNames:m,uniformBuffersNames:h,samplers:p,defines:v,fallbacks:d,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:function(){return o(r,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return 1!==this.shaderLanguage?[3,2]:[4,Promise.all([Promise.resolve().then(function(){return Sn}),Promise.resolve().then(function(){return _n})])];case 1:return e.sent(),[3,4];case 2:return[4,Promise.all([Promise.resolve().then(function(){return Pn}),Promise.resolve().then(function(){return Ln})])];case 3:e.sent(),e.label=4;case 4:return this._shadersLoaded=!0,[2]}})})}},u),f,this._materialContext)}if(f.AREALIGHTUSED)for(var g=0;g<e.lightSources.length;g++)if(!e.lightSources[g]._isReady())return!1;return!(!n.effect||!n.effect.isReady()||(f._renderId=l.getRenderId(),s._wasPreviouslyReady=!0,s._wasPreviouslyUsingInstances=!!t,0))},n.prototype.bindForSubMesh=function(e,n,t){var r=this.getScene(),o=t.materialDefines;if(o){var a=t.effect;a&&(this._activeEffect=a,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("view",r.getViewMatrix()),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),i.BindBonesParameters(n,this._activeEffect),this._mustRebind(r,a,t)&&(this.mixTexture&&(this._activeEffect.setTexture("textureSampler",this._mixTexture),this._activeEffect.setFloat2("vTextureInfos",this._mixTexture.coordinatesIndex,this._mixTexture.level),this._activeEffect.setMatrix("textureMatrix",this._mixTexture.getTextureMatrix()),i.MaterialFlags.DiffuseTextureEnabled&&(this._diffuseTexture1&&(this._activeEffect.setTexture("diffuse1Sampler",this._diffuseTexture1),this._activeEffect.setFloat2("diffuse1Infos",this._diffuseTexture1.uScale,this._diffuseTexture1.vScale)),this._diffuseTexture2&&(this._activeEffect.setTexture("diffuse2Sampler",this._diffuseTexture2),this._activeEffect.setFloat2("diffuse2Infos",this._diffuseTexture2.uScale,this._diffuseTexture2.vScale)),this._diffuseTexture3&&(this._activeEffect.setTexture("diffuse3Sampler",this._diffuseTexture3),this._activeEffect.setFloat2("diffuse3Infos",this._diffuseTexture3.uScale,this._diffuseTexture3.vScale))),i.MaterialFlags.BumpTextureEnabled&&r.getEngine().getCaps().standardDerivatives&&(this._bumpTexture1&&this._activeEffect.setTexture("bump1Sampler",this._bumpTexture1),this._bumpTexture2&&this._activeEffect.setTexture("bump2Sampler",this._bumpTexture2),this._bumpTexture3&&this._activeEffect.setTexture("bump3Sampler",this._bumpTexture3))),i.BindClipPlane(a,this,r),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&i.BindLogDepth(o,a,r),r.bindEyePosition(a)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*n.visibility),o.SPECULARTERM&&this._activeEffect.setColor4("vSpecularColor",this.specularColor,this.specularPower),r.lightsEnabled&&!this.disableLighting&&i.BindLights(r,n,this._activeEffect,o,this.maxSimultaneousLights),r.fogEnabled&&n.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,n,this._activeEffect),this._afterBind(n,this._activeEffect,t))}},n.prototype.getAnimatables=function(){var e=[];return this.mixTexture&&this.mixTexture.animations&&this.mixTexture.animations.length>0&&e.push(this.mixTexture),e},n.prototype.getActiveTextures=function(){var i=e.prototype.getActiveTextures.call(this);return this._mixTexture&&i.push(this._mixTexture),this._diffuseTexture1&&i.push(this._diffuseTexture1),this._diffuseTexture2&&i.push(this._diffuseTexture2),this._diffuseTexture3&&i.push(this._diffuseTexture3),this._bumpTexture1&&i.push(this._bumpTexture1),this._bumpTexture2&&i.push(this._bumpTexture2),this._bumpTexture3&&i.push(this._bumpTexture3),i},n.prototype.hasTexture=function(i){return!!e.prototype.hasTexture.call(this,i)||this._mixTexture===i||this._diffuseTexture1===i||this._diffuseTexture2===i||this._diffuseTexture3===i||this._bumpTexture1===i||this._bumpTexture2===i||this._bumpTexture3===i},n.prototype.dispose=function(i){this.mixTexture&&this.mixTexture.dispose(),e.prototype.dispose.call(this,i)},n.prototype.clone=function(e){var t=this;return i.SerializationHelper.Clone(function(){return new n(e,t.getScene())},this)},n.prototype.serialize=function(){var i=e.prototype.serialize.call(this);return i.customType="BABYLON.TerrainMaterial",i},n.prototype.getClassName=function(){return"TerrainMaterial"},n.Parse=function(e,t,r){return i.SerializationHelper.Parse(function(){return new n(e.name,t)},e,t,r)},r([i.serializeAsTexture("mixTexture")],n.prototype,"_mixTexture",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"mixTexture",void 0),r([i.serializeAsTexture("diffuseTexture1")],n.prototype,"_diffuseTexture1",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"diffuseTexture1",void 0),r([i.serializeAsTexture("diffuseTexture2")],n.prototype,"_diffuseTexture2",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"diffuseTexture2",void 0),r([i.serializeAsTexture("diffuseTexture3")],n.prototype,"_diffuseTexture3",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"diffuseTexture3",void 0),r([i.serializeAsTexture("bumpTexture1")],n.prototype,"_bumpTexture1",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"bumpTexture1",void 0),r([i.serializeAsTexture("bumpTexture2")],n.prototype,"_bumpTexture2",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"bumpTexture2",void 0),r([i.serializeAsTexture("bumpTexture3")],n.prototype,"_bumpTexture3",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"bumpTexture3",void 0),r([i.serializeAsColor3()],n.prototype,"diffuseColor",void 0),r([i.serializeAsColor3()],n.prototype,"specularColor",void 0),r([i.serialize()],n.prototype,"specularPower",void 0),r([i.serialize("disableLighting")],n.prototype,"_disableLighting",void 0),r([i.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"disableLighting",void 0),r([i.serialize("maxSimultaneousLights")],n.prototype,"_maxSimultaneousLights",void 0),r([i.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"maxSimultaneousLights",void 0),n}(i.PushMaterial);i.RegisterClass("BABYLON.TerrainMaterial",V);var U=function(e){function i(){var i=e.call(this)||this;return i.DIFFUSEX=!1,i.DIFFUSEY=!1,i.DIFFUSEZ=!1,i.BUMPX=!1,i.BUMPY=!1,i.BUMPZ=!1,i.CLIPPLANE=!1,i.CLIPPLANE2=!1,i.CLIPPLANE3=!1,i.CLIPPLANE4=!1,i.CLIPPLANE5=!1,i.CLIPPLANE6=!1,i.ALPHATEST=!1,i.DEPTHPREPASS=!1,i.POINTSIZE=!1,i.FOG=!1,i.SPECULARTERM=!1,i.NORMAL=!1,i.VERTEXCOLOR=!1,i.VERTEXALPHA=!1,i.NUM_BONE_INFLUENCERS=0,i.BonesPerMesh=0,i.INSTANCES=!1,i.INSTANCESCOLOR=!1,i.IMAGEPROCESSINGPOSTPROCESS=!1,i.SKIPFINALCOLORCLAMP=!1,i.NONUNIFORMSCALING=!1,i.LOGARITHMICDEPTH=!1,i.AREALIGHTSUPPORTED=!0,i.AREALIGHTNOROUGHTNESS=!0,i.rebuild(),i}return t(i,e),i}(i.MaterialDefines),w=function(e){function n(n,t,r){void 0===r&&(r=!1);var o=e.call(this,n,t,void 0,r)||this;return o.tileSize=1,o.diffuseColor=new i.Color3(1,1,1),o.specularColor=new i.Color3(.2,.2,.2),o.specularPower=64,o._disableLighting=!1,o._maxSimultaneousLights=4,o._shadersLoaded=!1,o}return t(n,e),n.prototype.needAlphaBlending=function(){return this.alpha<1},n.prototype.needAlphaTesting=function(){return!1},n.prototype.getAlphaTestTexture=function(){return null},n.prototype.isReadyForSubMesh=function(e,n,t){var r=this,s=n._drawWrapper;if(this.isFrozen&&s.effect&&s._wasPreviouslyReady&&s._wasPreviouslyUsingInstances===t)return!0;n.materialDefines||(n.materialDefines=new U);var f=n.materialDefines,l=this.getScene();if(this._isReadyForSubMesh(n))return!0;var u=l.getEngine();if(f._areTexturesDirty&&l.texturesEnabled){if(i.MaterialFlags.DiffuseTextureEnabled)for(var d=[this.diffuseTextureX,this.diffuseTextureY,this.diffuseTextureZ],c=["DIFFUSEX","DIFFUSEY","DIFFUSEZ"],v=0;v<d.length;v++)if(d[v]){if(!d[v].isReady())return!1;f[c[v]]=!0}if(i.MaterialFlags.BumpTextureEnabled)for(d=[this.normalTextureX,this.normalTextureY,this.normalTextureZ],c=["BUMPX","BUMPY","BUMPZ"],v=0;v<d.length;v++)if(d[v]){if(!d[v].isReady())return!1;f[c[v]]=!0}}if(i.PrepareDefinesForMisc(e,l,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),f,void 0,void 0,void 0,this._isVertexOutputInvariant),f._needNormals=i.PrepareDefinesForLights(l,e,f,!1,this._maxSimultaneousLights,this._disableLighting),i.PrepareDefinesForFrameBoundValues(l,u,this,f,!!t),i.PrepareDefinesForAttributes(e,f,!0,!0),f.isDirty){f.markAsProcessed(),l.resetCachedMaterial();var m=new i.EffectFallbacks;f.FOG&&m.addFallback(1,"FOG"),i.HandleFallbacksForShadows(f,m,this.maxSimultaneousLights),f.NUM_BONE_INFLUENCERS>0&&m.addCPUSkinningFallback(0,e),f.IMAGEPROCESSINGPOSTPROCESS=l.imageProcessingConfiguration.applyByPostProcess;var p=[i.VertexBuffer.PositionKind];f.NORMAL&&p.push(i.VertexBuffer.NormalKind),f.VERTEXCOLOR&&p.push(i.VertexBuffer.ColorKind),i.PrepareAttributesForBones(p,e,f,m),i.PrepareAttributesForInstances(p,f);var h=f.toString(),g=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vSpecularColor","vFogInfos","vFogColor","pointSize","mBones","tileSize"],S=["diffuseSamplerX","diffuseSamplerY","diffuseSamplerZ","normalSamplerX","normalSamplerY","normalSamplerZ","logarithmicDepthConstant","areaLightsLTC1Sampler","areaLightsLTC2Sampler"],x=[];i.AddClipPlaneUniforms(g),i.PrepareUniformsAndSamplersList({uniformsNames:g,uniformBuffersNames:x,samplers:S,defines:f,maxSimultaneousLights:this.maxSimultaneousLights}),n.setEffect(l.getEngine().createEffect("triplanar",{attributes:p,uniformsNames:g,uniformBuffersNames:x,samplers:S,defines:h,fallbacks:m,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:function(){return o(r,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return 1!==this.shaderLanguage?[3,2]:[4,Promise.all([Promise.resolve().then(function(){return Dn}),Promise.resolve().then(function(){return Fn})])];case 1:return e.sent(),[3,4];case 2:return[4,Promise.all([Promise.resolve().then(function(){return Vn}),Promise.resolve().then(function(){return Bn})])];case 3:e.sent(),e.label=4;case 4:return this._shadersLoaded=!0,[2]}})})}},u),f,this._materialContext)}if(f.AREALIGHTUSED)for(var T=0;T<e.lightSources.length;T++)if(!e.lightSources[T]._isReady())return!1;return!(!n.effect||!n.effect.isReady()||(f._renderId=l.getRenderId(),s._wasPreviouslyReady=!0,s._wasPreviouslyUsingInstances=!!t,0))},n.prototype.bindForSubMesh=function(e,n,t){var r=this.getScene(),o=t.materialDefines;if(o){var a=t.effect;a&&(this._activeEffect=a,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),i.BindBonesParameters(n,this._activeEffect),this._activeEffect.setFloat("tileSize",this.tileSize),this._mustRebind(r,a,t)&&(this.diffuseTextureX&&this._activeEffect.setTexture("diffuseSamplerX",this.diffuseTextureX),this.diffuseTextureY&&this._activeEffect.setTexture("diffuseSamplerY",this.diffuseTextureY),this.diffuseTextureZ&&this._activeEffect.setTexture("diffuseSamplerZ",this.diffuseTextureZ),this.normalTextureX&&this._activeEffect.setTexture("normalSamplerX",this.normalTextureX),this.normalTextureY&&this._activeEffect.setTexture("normalSamplerY",this.normalTextureY),this.normalTextureZ&&this._activeEffect.setTexture("normalSamplerZ",this.normalTextureZ),i.BindClipPlane(a,this,r),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&i.BindLogDepth(o,a,r),r.bindEyePosition(a)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*n.visibility),o.SPECULARTERM&&this._activeEffect.setColor4("vSpecularColor",this.specularColor,this.specularPower),r.lightsEnabled&&!this.disableLighting&&i.BindLights(r,n,this._activeEffect,o,this.maxSimultaneousLights),r.fogEnabled&&n.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,n,this._activeEffect),this._afterBind(n,this._activeEffect,t))}},n.prototype.getAnimatables=function(){var e=[];return this.mixTexture&&this.mixTexture.animations&&this.mixTexture.animations.length>0&&e.push(this.mixTexture),e},n.prototype.getActiveTextures=function(){var i=e.prototype.getActiveTextures.call(this);return this._diffuseTextureX&&i.push(this._diffuseTextureX),this._diffuseTextureY&&i.push(this._diffuseTextureY),this._diffuseTextureZ&&i.push(this._diffuseTextureZ),this._normalTextureX&&i.push(this._normalTextureX),this._normalTextureY&&i.push(this._normalTextureY),this._normalTextureZ&&i.push(this._normalTextureZ),i},n.prototype.hasTexture=function(i){return!!e.prototype.hasTexture.call(this,i)||this._diffuseTextureX===i||this._diffuseTextureY===i||this._diffuseTextureZ===i||this._normalTextureX===i||this._normalTextureY===i||this._normalTextureZ===i},n.prototype.dispose=function(i){this.mixTexture&&this.mixTexture.dispose(),e.prototype.dispose.call(this,i)},n.prototype.clone=function(e){var t=this;return i.SerializationHelper.Clone(function(){return new n(e,t.getScene())},this)},n.prototype.serialize=function(){var i=e.prototype.serialize.call(this);return i.customType="BABYLON.TriPlanarMaterial",i},n.prototype.getClassName=function(){return"TriPlanarMaterial"},n.Parse=function(e,t,r){return i.SerializationHelper.Parse(function(){return new n(e.name,t)},e,t,r)},r([i.serializeAsTexture()],n.prototype,"mixTexture",void 0),r([i.serializeAsTexture("diffuseTextureX")],n.prototype,"_diffuseTextureX",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"diffuseTextureX",void 0),r([i.serializeAsTexture("diffuseTexturY")],n.prototype,"_diffuseTextureY",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"diffuseTextureY",void 0),r([i.serializeAsTexture("diffuseTextureZ")],n.prototype,"_diffuseTextureZ",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"diffuseTextureZ",void 0),r([i.serializeAsTexture("normalTextureX")],n.prototype,"_normalTextureX",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"normalTextureX",void 0),r([i.serializeAsTexture("normalTextureY")],n.prototype,"_normalTextureY",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"normalTextureY",void 0),r([i.serializeAsTexture("normalTextureZ")],n.prototype,"_normalTextureZ",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"normalTextureZ",void 0),r([i.serialize()],n.prototype,"tileSize",void 0),r([i.serializeAsColor3()],n.prototype,"diffuseColor",void 0),r([i.serializeAsColor3()],n.prototype,"specularColor",void 0),r([i.serialize()],n.prototype,"specularPower",void 0),r([i.serialize("disableLighting")],n.prototype,"_disableLighting",void 0),r([i.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"disableLighting",void 0),r([i.serialize("maxSimultaneousLights")],n.prototype,"_maxSimultaneousLights",void 0),r([i.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"maxSimultaneousLights",void 0),n}(i.PushMaterial);i.RegisterClass("BABYLON.TriPlanarMaterial",w);var B=function(e){function i(){var i=e.call(this)||this;return i.BUMP=!1,i.REFLECTION=!1,i.CLIPPLANE=!1,i.CLIPPLANE2=!1,i.CLIPPLANE3=!1,i.CLIPPLANE4=!1,i.CLIPPLANE5=!1,i.CLIPPLANE6=!1,i.ALPHATEST=!1,i.DEPTHPREPASS=!1,i.POINTSIZE=!1,i.FOG=!1,i.NORMAL=!1,i.UV1=!1,i.UV2=!1,i.VERTEXCOLOR=!1,i.VERTEXALPHA=!1,i.NUM_BONE_INFLUENCERS=0,i.BonesPerMesh=0,i.INSTANCES=!1,i.INSTANCESCOLOR=!1,i.SPECULARTERM=!1,i.LOGARITHMICDEPTH=!1,i.USE_REVERSE_DEPTHBUFFER=!1,i.FRESNELSEPARATE=!1,i.BUMPSUPERIMPOSE=!1,i.BUMPAFFECTSREFLECTION=!1,i.USE_WORLD_COORDINATES=!1,i.IMAGEPROCESSING=!1,i.VIGNETTE=!1,i.VIGNETTEBLENDMODEMULTIPLY=!1,i.VIGNETTEBLENDMODEOPAQUE=!1,i.TONEMAPPING=0,i.CONTRAST=!1,i.EXPOSURE=!1,i.COLORCURVES=!1,i.COLORGRADING=!1,i.COLORGRADING3D=!1,i.SAMPLER3DGREENDEPTH=!1,i.SAMPLER3DBGRMAP=!1,i.DITHER=!1,i.IMAGEPROCESSINGPOSTPROCESS=!1,i.SKIPFINALCOLORCLAMP=!1,i.rebuild(),i}return t(i,e),i}(i.MaterialDefines),z=function(e){function n(n,t,r,o){void 0===r&&(r=new i.Vector2(512,512)),void 0===o&&(o=!1);var a=e.call(this,n,t,void 0,o)||this;return a.renderTargetSize=r,a.diffuseColor=new i.Color3(1,1,1),a.specularColor=new i.Color3(0,0,0),a.specularPower=64,a._disableLighting=!1,a._maxSimultaneousLights=4,a.windForce=6,a.windDirection=new i.Vector2(0,1),a.waveHeight=.4,a.bumpHeight=.4,a._bumpSuperimpose=!1,a._fresnelSeparate=!1,a._bumpAffectsReflection=!1,a.waterColor=new i.Color3(.1,.1,.6),a.colorBlendFactor=.2,a.waterColor2=new i.Color3(.1,.1,.6),a.colorBlendFactor2=.2,a.waveLength=.1,a.waveSpeed=1,a.waveCount=20,a.disableClipPlane=!1,a._useWorldCoordinatesForWaveDeformation=!1,a._renderTargets=new i.SmartArray(16),a._mesh=null,a._reflectionTransform=i.Matrix.Zero(),a._offsetMirror=i.Matrix.Zero(),a._tempPlane=new i.Plane(0,0,0,0),a._lastTime=0,a._shadersLoaded=!1,a._lastDeltaTime=0,a._createRenderTargets(a.getScene(),r),a.getRenderTargetTextures=function(){return a._renderTargets.reset(),a._renderTargets.push(a._reflectionRTT),a._renderTargets.push(a._refractionRTT),a._renderTargets},a._imageProcessingConfiguration=a.getScene().imageProcessingConfiguration,a._imageProcessingConfiguration&&(a._imageProcessingObserver=a._imageProcessingConfiguration.onUpdateParameters.add(function(){a._markAllSubMeshesAsImageProcessingDirty()})),a}return t(n,e),Object.defineProperty(n.prototype,"hasRenderTargetTextures",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"refractionTexture",{get:function(){return this._refractionRTT},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"reflectionTexture",{get:function(){return this._reflectionRTT},enumerable:!1,configurable:!0}),n.prototype.addToRenderList=function(e){this._refractionRTT&&this._refractionRTT.renderList&&this._refractionRTT.renderList.push(e),this._reflectionRTT&&this._reflectionRTT.renderList&&this._reflectionRTT.renderList.push(e)},n.prototype.removeFromRenderList=function(e){var i;this._refractionRTT&&this._refractionRTT.renderList&&-1!==(i=this._refractionRTT.renderList.indexOf(e))&&this._refractionRTT.renderList.splice(i,1),this._reflectionRTT&&this._reflectionRTT.renderList&&-1!==(i=this._reflectionRTT.renderList.indexOf(e))&&this._reflectionRTT.renderList.splice(i,1)},n.prototype.enableRenderTargets=function(e){var i=e?1:0;this._refractionRTT&&(this._refractionRTT.refreshRate=i),this._reflectionRTT&&(this._reflectionRTT.refreshRate=i)},n.prototype.getRenderList=function(){return this._refractionRTT?this._refractionRTT.renderList:[]},Object.defineProperty(n.prototype,"renderTargetsEnabled",{get:function(){return!(this._refractionRTT&&0===this._refractionRTT.refreshRate)},enumerable:!1,configurable:!0}),n.prototype.needAlphaBlending=function(){return this.alpha<1},n.prototype.needAlphaTesting=function(){return!1},n.prototype.getAlphaTestTexture=function(){return null},n.prototype.isReadyForSubMesh=function(e,n,t){var r=this,s=n._drawWrapper;if(this.isFrozen&&s.effect&&s._wasPreviouslyReady&&s._wasPreviouslyUsingInstances===t)return!0;n.materialDefines||(n.materialDefines=new B);var f=n.materialDefines,l=this.getScene();if(this._isReadyForSubMesh(n))return!0;var u=l.getEngine();if(f._areTexturesDirty&&(f._needUVs=!1,l.texturesEnabled)){if(this.bumpTexture&&i.MaterialFlags.BumpTextureEnabled){if(!this.bumpTexture.isReady())return!1;f._needUVs=!0,f.BUMP=!0}i.MaterialFlags.ReflectionTextureEnabled&&(f.REFLECTION=!0)}if(i.PrepareDefinesForFrameBoundValues(l,u,this,f,!!t),i.PrepareDefinesForMisc(e,l,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),f,void 0,void 0,void 0,this._isVertexOutputInvariant),f._areMiscDirty&&(f.FRESNELSEPARATE=this._fresnelSeparate,f.BUMPSUPERIMPOSE=this._bumpSuperimpose,f.BUMPAFFECTSREFLECTION=this._bumpAffectsReflection,f.USE_WORLD_COORDINATES=this._useWorldCoordinatesForWaveDeformation),f._needNormals=i.PrepareDefinesForLights(l,e,f,!0,this._maxSimultaneousLights,this._disableLighting),f._areImageProcessingDirty&&this._imageProcessingConfiguration){if(!this._imageProcessingConfiguration.isReady())return!1;this._imageProcessingConfiguration.prepareDefines(f),f.IS_REFLECTION_LINEAR=null!=this.reflectionTexture&&!this.reflectionTexture.gammaSpace,f.IS_REFRACTION_LINEAR=null!=this.refractionTexture&&!this.refractionTexture.gammaSpace}if(i.PrepareDefinesForAttributes(e,f,!0,!0),this._mesh=e,this._waitingRenderList){for(var d=0;d<this._waitingRenderList.length;d++)this.addToRenderList(l.getNodeById(this._waitingRenderList[d]));this._waitingRenderList=null}if(f.isDirty){f.markAsProcessed(),l.resetCachedMaterial();var c=new i.EffectFallbacks;f.FOG&&c.addFallback(1,"FOG"),f.LOGARITHMICDEPTH&&c.addFallback(0,"LOGARITHMICDEPTH"),i.HandleFallbacksForShadows(f,c,this.maxSimultaneousLights),f.NUM_BONE_INFLUENCERS>0&&c.addCPUSkinningFallback(0,e);var v=[i.VertexBuffer.PositionKind];f.NORMAL&&v.push(i.VertexBuffer.NormalKind),f.UV1&&v.push(i.VertexBuffer.UVKind),f.UV2&&v.push(i.VertexBuffer.UV2Kind),f.VERTEXCOLOR&&v.push(i.VertexBuffer.ColorKind),i.PrepareAttributesForBones(v,e,f,c),i.PrepareAttributesForInstances(v,f);var m=f.toString(),p=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vSpecularColor","vFogInfos","vFogColor","pointSize","vNormalInfos","mBones","normalMatrix","logarithmicDepthConstant","reflectionViewProjection","windDirection","waveLength","time","windForce","cameraPosition","bumpHeight","waveHeight","waterColor","waterColor2","colorBlendFactor","colorBlendFactor2","waveSpeed","waveCount"],h=["normalSampler","refractionSampler","reflectionSampler"],g=[];i.ImageProcessingConfiguration&&(i.ImageProcessingConfiguration.PrepareUniforms(p,f),i.ImageProcessingConfiguration.PrepareSamplers(h,f)),i.AddClipPlaneUniforms(p),i.PrepareUniformsAndSamplersList({uniformsNames:p,uniformBuffersNames:g,samplers:h,defines:f,maxSimultaneousLights:this.maxSimultaneousLights}),n.setEffect(l.getEngine().createEffect("water",{attributes:v,uniformsNames:p,uniformBuffersNames:g,samplers:h,defines:m,fallbacks:c,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:function(){return o(r,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return 1!==this.shaderLanguage?[3,2]:[4,Promise.all([Promise.resolve().then(function(){return Hn}),Promise.resolve().then(function(){return kn})])];case 1:return e.sent(),[3,4];case 2:return[4,Promise.all([Promise.resolve().then(function(){return Yn}),Promise.resolve().then(function(){return Qn})])];case 3:e.sent(),e.label=4;case 4:return this._shadersLoaded=!0,[2]}})})}},u),f,this._materialContext)}return!(!n.effect||!n.effect.isReady()||(f._renderId=l.getRenderId(),s._wasPreviouslyReady=!0,s._wasPreviouslyUsingInstances=!!t,0))},n.prototype.bindForSubMesh=function(e,n,t){var r=this.getScene(),o=t.materialDefines;if(o){var a=t.effect;if(a&&this._mesh){this._activeEffect=a,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),i.BindBonesParameters(n,this._activeEffect),this._mustRebind(r,a,t)&&(this.bumpTexture&&i.MaterialFlags.BumpTextureEnabled&&(this._activeEffect.setTexture("normalSampler",this.bumpTexture),this._activeEffect.setFloat2("vNormalInfos",this.bumpTexture.coordinatesIndex,this.bumpTexture.level),this._activeEffect.setMatrix("normalMatrix",this.bumpTexture.getTextureMatrix())),i.BindClipPlane(a,this,r),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&i.BindLogDepth(o,a,r),r.bindEyePosition(a)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*n.visibility),o.SPECULARTERM&&this._activeEffect.setColor4("vSpecularColor",this.specularColor,this.specularPower),r.lightsEnabled&&!this.disableLighting&&i.BindLights(r,n,this._activeEffect,o,this.maxSimultaneousLights),r.fogEnabled&&n.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,n,this._activeEffect),i.BindLogDepth(o,this._activeEffect,r),i.MaterialFlags.ReflectionTextureEnabled&&(this._activeEffect.setTexture("refractionSampler",this._refractionRTT),this._activeEffect.setTexture("reflectionSampler",this._reflectionRTT));var s=i.TmpVectors.Matrix[3].copyFrom(this._reflectionTransform);if(r.floatingOriginMode){var f=i.OffsetViewToRef(r.floatingOriginOffset,r.getViewMatrix(),i.TmpVectors.Matrix[1]);i.MultiplyMatricesToRef(this._offsetMirror,f,s)}s.multiplyToRef(r.getProjectionMatrix(),s);var l=r.getEngine().getDeltaTime();l!==this._lastDeltaTime&&(this._lastDeltaTime=l,this._lastTime+=this._lastDeltaTime),this._activeEffect.setMatrix("reflectionViewProjection",s),this._activeEffect.setVector2("windDirection",this.windDirection),this._activeEffect.setFloat("waveLength",this.waveLength),this._activeEffect.setFloat("time",this._lastTime/1e5),this._activeEffect.setFloat("windForce",this.windForce),this._activeEffect.setFloat("waveHeight",this.waveHeight),this._activeEffect.setFloat("bumpHeight",this.bumpHeight),this._activeEffect.setColor4("waterColor",this.waterColor,1),this._activeEffect.setFloat("colorBlendFactor",this.colorBlendFactor),this._activeEffect.setColor4("waterColor2",this.waterColor2,1),this._activeEffect.setFloat("colorBlendFactor2",this.colorBlendFactor2),this._activeEffect.setFloat("waveSpeed",this.waveSpeed),this._activeEffect.setFloat("waveCount",this.waveCount),this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.applyByPostProcess&&this._imageProcessingConfiguration.bind(this._activeEffect),this._afterBind(n,this._activeEffect,t)}}},n.prototype._createRenderTargets=function(e,n){var t=this;this._refractionRTT=new i.RenderTargetTexture(name+"_refraction",{width:n.x,height:n.y},e,!1,!0),this._refractionRTT.wrapU=i.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._refractionRTT.wrapV=i.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._refractionRTT.ignoreCameraViewport=!0;var r,o=!1;this._refractionRTT.onBeforeRenderObservable.add(function(){o=e.getBoundingBoxRenderer().enabled,e.getBoundingBoxRenderer().enabled=!1}),this._refractionRTT.onAfterRenderObservable.add(function(){e.getBoundingBoxRenderer().enabled=o}),this._reflectionRTT=new i.RenderTargetTexture(name+"_reflection",{width:n.x,height:n.y},e,!1,!0),this._reflectionRTT.wrapU=i.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._reflectionRTT.wrapV=i.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._reflectionRTT.ignoreCameraViewport=!0;var a,s=null,f=i.Matrix.Zero();this._refractionRTT.onBeforeRender=function(){if(t._mesh&&(r=t._mesh.isVisible,t._mesh.isVisible=!1),!t.disableClipPlane){s=e.clipPlane;var n=t._mesh?t._mesh.absolutePosition.y:0;e.clipPlane=i.Plane.FromPositionAndNormal(new i.Vector3(0,n+.05,0),new i.Vector3(0,1,0))}},this._refractionRTT.onAfterRender=function(){t._mesh&&(t._mesh.isVisible=r),t.disableClipPlane||(e.clipPlane=s)},this._reflectionRTT.onBeforeRender=function(){if(t._mesh&&(r=t._mesh.isVisible,t._mesh.isVisible=!1),!t.disableClipPlane){s=e.clipPlane;var n=t._mesh?t._mesh.absolutePosition.y:0;e.clipPlane=i.Plane.FromPositionAndNormal(new i.Vector3(0,n-.05,0),new i.Vector3(0,-1,0)),i.Matrix.ReflectionToRef(e.clipPlane,f),t._offsetMirror.copyFrom(f),e.floatingOriginMode&&(i.OffsetClipPlaneToRef(e.floatingOriginOffset,e.clipPlane,t._tempPlane),i.Matrix.ReflectionToRef(t._tempPlane,t._offsetMirror))}a=e.getViewMatrix(),f.multiplyToRef(a,t._reflectionTransform),e.setTransformMatrix(t._reflectionTransform,e.getProjectionMatrix());var o=i.Vector3.TransformCoordinates(e.activeCamera.position,f);e._mirroredCameraPosition=o,e._forcedViewPosition=o},this._reflectionRTT.onAfterRender=function(){t._mesh&&(t._mesh.isVisible=r),e.clipPlane=s,e.setTransformMatrix(a,e.getProjectionMatrix()),e._mirroredCameraPosition=null,e._forcedViewPosition=null}},n.prototype.getAnimatables=function(){var e=[];return this.bumpTexture&&this.bumpTexture.animations&&this.bumpTexture.animations.length>0&&e.push(this.bumpTexture),this._reflectionRTT&&this._reflectionRTT.animations&&this._reflectionRTT.animations.length>0&&e.push(this._reflectionRTT),this._refractionRTT&&this._refractionRTT.animations&&this._refractionRTT.animations.length>0&&e.push(this._refractionRTT),e},n.prototype.getActiveTextures=function(){var i=e.prototype.getActiveTextures.call(this);return this._bumpTexture&&i.push(this._bumpTexture),i},n.prototype.hasTexture=function(i){return!!e.prototype.hasTexture.call(this,i)||this._bumpTexture===i},n.prototype.dispose=function(i){this.bumpTexture&&this.bumpTexture.dispose();var n=this.getScene().customRenderTargets.indexOf(this._refractionRTT);-1!=n&&this.getScene().customRenderTargets.splice(n,1),-1!=(n=this.getScene().customRenderTargets.indexOf(this._reflectionRTT))&&this.getScene().customRenderTargets.splice(n,1),this._reflectionRTT&&this._reflectionRTT.dispose(),this._refractionRTT&&this._refractionRTT.dispose(),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),e.prototype.dispose.call(this,i)},n.prototype.clone=function(e){var t=this;return i.SerializationHelper.Clone(function(){return new n(e,t.getScene())},this)},n.prototype.serialize=function(){var i=e.prototype.serialize.call(this);if(i.customType="BABYLON.WaterMaterial",i.renderList=[],this._refractionRTT&&this._refractionRTT.renderList)for(var n=0;n<this._refractionRTT.renderList.length;n++)i.renderList.push(this._refractionRTT.renderList[n].id);return i},n.prototype.getClassName=function(){return"WaterMaterial"},n.Parse=function(e,t,r){var o=i.SerializationHelper.Parse(function(){return new n(e.name,t)},e,t,r);return o._waitingRenderList=e.renderList,o},n.CreateDefaultMesh=function(e,n){return i.CreateGround(e,{width:512,height:512,subdivisions:32,updatable:!1},n)},r([i.serializeAsTexture("bumpTexture")],n.prototype,"_bumpTexture",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"bumpTexture",void 0),r([i.serializeAsColor3()],n.prototype,"diffuseColor",void 0),r([i.serializeAsColor3()],n.prototype,"specularColor",void 0),r([i.serialize()],n.prototype,"specularPower",void 0),r([i.serialize("disableLighting")],n.prototype,"_disableLighting",void 0),r([i.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"disableLighting",void 0),r([i.serialize("maxSimultaneousLights")],n.prototype,"_maxSimultaneousLights",void 0),r([i.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"maxSimultaneousLights",void 0),r([i.serialize()],n.prototype,"windForce",void 0),r([i.serializeAsVector2()],n.prototype,"windDirection",void 0),r([i.serialize()],n.prototype,"waveHeight",void 0),r([i.serialize()],n.prototype,"bumpHeight",void 0),r([i.serialize("bumpSuperimpose")],n.prototype,"_bumpSuperimpose",void 0),r([i.expandToProperty("_markAllSubMeshesAsMiscDirty")],n.prototype,"bumpSuperimpose",void 0),r([i.serialize("fresnelSeparate")],n.prototype,"_fresnelSeparate",void 0),r([i.expandToProperty("_markAllSubMeshesAsMiscDirty")],n.prototype,"fresnelSeparate",void 0),r([i.serialize("bumpAffectsReflection")],n.prototype,"_bumpAffectsReflection",void 0),r([i.expandToProperty("_markAllSubMeshesAsMiscDirty")],n.prototype,"bumpAffectsReflection",void 0),r([i.serializeAsColor3()],n.prototype,"waterColor",void 0),r([i.serialize()],n.prototype,"colorBlendFactor",void 0),r([i.serializeAsColor3()],n.prototype,"waterColor2",void 0),r([i.serialize()],n.prototype,"colorBlendFactor2",void 0),r([i.serialize()],n.prototype,"waveLength",void 0),r([i.serialize()],n.prototype,"waveSpeed",void 0),r([i.serialize()],n.prototype,"waveCount",void 0),r([i.serialize()],n.prototype,"disableClipPlane",void 0),r([i.serialize("useWorldCoordinatesForWaveDeformation")],n.prototype,"_useWorldCoordinatesForWaveDeformation",void 0),r([i.expandToProperty("_markAllSubMeshesAsMiscDirty")],n.prototype,"useWorldCoordinatesForWaveDeformation",void 0),n}(i.PushMaterial);i.RegisterClass("BABYLON.WaterMaterial",z);var G={__proto__:null,CellMaterial:f,CustomMaterial:d,CustomShaderStructure:l,FireMaterial:h,FurMaterial:S,GradientMaterial:T,GridMaterial:C,LavaMaterial:P,MixMaterial:y,NormalMaterial:A,PBRCustomMaterial:m,ShaderAlbedoParts:c,ShaderAlebdoParts:v,ShaderSpecialParts:u,ShadowOnlyMaterial:D,SimpleMaterial:b,SkyMaterial:M,TerrainMaterial:V,TriPlanarMaterial:w,WaterMaterial:z},H="undefined"!=typeof global?global:"undefined"!=typeof window?window:void 0;if(void 0!==H){for(var W in H.BABYLON=H.BABYLON||{},G)H.BABYLON[W]=G[W];H.MATERIALS=G}var X={__proto__:null,CellMaterial:f,CustomMaterial:d,CustomShaderStructure:l,FireMaterial:h,FurMaterial:S,GradientMaterial:T,GridMaterial:C,LavaMaterial:P,MixMaterial:y,NormalMaterial:A,PBRCustomMaterial:m,ShaderAlbedoParts:c,ShaderAlebdoParts:v,ShaderSpecialParts:u,ShadowOnlyMaterial:D,SimpleMaterial:b,SkyMaterial:M,TerrainMaterial:V,TriPlanarMaterial:w,WaterMaterial:z},k="cellVertexShader",j="attribute position: vec3f;\n#ifdef NORMAL\nattribute normal: vec3f;\n#endif\n#ifdef UV1\nattribute uv: vec2f;\n#endif\n#ifdef UV2\nattribute uv2: vec2f;\n#endif\n#ifdef VERTEXCOLOR\nattribute color: vec4f;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform view: mat4x4f;uniform viewProjection: mat4x4f;\n#ifdef DIFFUSE\nvarying vDiffuseUV: vec2f;uniform diffuseMatrix: mat4x4f;uniform vDiffuseInfos: vec2f;\n#endif\n#ifdef POINTSIZE\nuniform pointSize: f32;\n#endif\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef VERTEXCOLOR\nvar colorUpdated: vec4f=vertexInputs.color;\n#endif\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvar worldPos: vec4f=finalWorld* vec4f(vertexInputs.position,1.0);vertexOutputs.position=uniforms.viewProjection*worldPos;vertexOutputs.vPositionW= worldPos.xyz;\n#ifdef NORMAL\nvertexOutputs.vNormalW=normalize(( finalWorld* vec4f(vertexInputs.normal,0.0)).xyz);\n#endif\n#ifndef UV1\nvar uv: vec2f= vec2f(0.,0.);\n#else\nvar uv: vec2f=vertexInputs.uv;\n#endif\n#ifndef UV2\nvar uv2: vec2f= vec2f(0.,0.);\n#else\nvar uv2: vec2f=vertexInputs.uv2;\n#endif\n#ifdef DIFFUSE\nif (uniforms.vDiffuseInfos.x==0.)\n{vertexOutputs.vDiffuseUV=(uniforms.diffuseMatrix* vec4f(uv,1.0,0.0)).xy;}\nelse\n{vertexOutputs.vDiffuseUV=(uniforms.diffuseMatrix* vec4f(uv2,1.0,0.0)).xy;}\n#endif\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#include<logDepthVertex>\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[k]||(i.ShaderStore.ShadersStoreWGSL[k]=j);var Z={__proto__:null,cellVertexShaderWGSL:{name:k,shader:j}},Y="cellPixelShader",K="uniform vEyePosition: vec4f;uniform vDiffuseColor: vec4f;varying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<helperFunctions>\n#include<lightUboDeclaration>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#ifdef DIFFUSE\nvarying vDiffuseUV: vec2f;var diffuseSamplerSampler: sampler;var diffuseSampler: texture_2d<f32>;uniform vDiffuseInfos: vec2f;\n#endif\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\nfn computeCustomDiffuseLighting(info: lightingInfo,diffuseBaseIn: vec3f,shadow: f32)->vec3f\n{var diffuseBase: vec3f=info.diffuse*shadow;\n#ifdef CELLBASIC\nvar level: f32=1.0;if (info.ndl<0.5) {level=0.5;}\ndiffuseBase=diffuseBase.rgb* vec3f(level,level,level);\n#else\nvar ToonThresholds: array<f32,4>;ToonThresholds[0]=0.95;ToonThresholds[1]=0.5;ToonThresholds[2]=0.2;ToonThresholds[3]=0.03;var ToonBrightnessLevels: array<f32,5>;ToonBrightnessLevels[0]=1.0;ToonBrightnessLevels[1]=0.8;ToonBrightnessLevels[2]=0.6;ToonBrightnessLevels[3]=0.35;ToonBrightnessLevels[4]=0.2;if (info.ndl>ToonThresholds[0])\n{diffuseBase=diffuseBase.rgb*ToonBrightnessLevels[0];}\nelse if (info.ndl>ToonThresholds[1])\n{diffuseBase=diffuseBase.rgb*ToonBrightnessLevels[1];}\nelse if (info.ndl>ToonThresholds[2])\n{diffuseBase=diffuseBase.rgb*ToonBrightnessLevels[2];}\nelse if (info.ndl>ToonThresholds[3])\n{diffuseBase=diffuseBase.rgb*ToonBrightnessLevels[3];}\nelse\n{diffuseBase=diffuseBase.rgb*ToonBrightnessLevels[4];}\n#endif\nreturn max(diffuseBase, vec3f(0.2));}\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvar viewDirectionW: vec3f=normalize(uniforms.vEyePosition.xyz-fragmentInputs.vPositionW);var baseColor: vec4f= vec4f(1.,1.,1.,1.);var diffuseColor: vec3f=uniforms.vDiffuseColor.rgb;var alpha: f32=uniforms.vDiffuseColor.a;\n#ifdef DIFFUSE\nbaseColor=textureSample(diffuseSampler,diffuseSamplerSampler,fragmentInputs.vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4) {discard;}\n#endif\n#include<depthPrePass>\nbaseColor=vec4f(baseColor.rgb*uniforms.vDiffuseInfos.y,baseColor.a);\n#endif\n#ifdef VERTEXCOLOR\nbaseColor=vec4f(baseColor.rgb*fragmentInputs.vColor.rgb,baseColor.a);\n#endif\n#ifdef NORMAL\nvar normalW: vec3f=normalize(fragmentInputs.vNormalW);\n#else\nvar normalW: vec3f= vec3f(1.0,1.0,1.0);\n#endif\nvar info: lightingInfo;var diffuseBase: vec3f= vec3f(0.,0.,0.);var shadow: f32=1.;var glossiness: f32=0.;var aggShadow: f32=0.;var numLights: f32=0.;\n#ifdef SPECULARTERM\nvar specularBase: vec3f= vec3f(0.,0.,0.);\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=fragmentInputs.vColor.a;\n#endif\nvar finalDiffuse: vec3f=clamp(diffuseBase*diffuseColor,vec3f(0.0),vec3f(1.0))*baseColor.rgb;var color: vec4f= vec4f(finalDiffuse,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\nfragmentOutputs.color=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[Y]||(i.ShaderStore.ShadersStoreWGSL[Y]=K);var q={__proto__:null,cellPixelShaderWGSL:{name:Y,shader:K}},Q="cellVertexShader",J="precision highp float;attribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform mat4 view;uniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;uniform mat4 diffuseMatrix;uniform vec2 vDiffuseInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef VERTEXCOLOR\nvec4 colorUpdated=color;\n#endif\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);gl_Position=viewProjection*worldPos;vPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x==0.)\n{vDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));}\nelse\n{vDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));}\n#endif\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#include<logDepthVertex>\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStore[Q]||(i.ShaderStore.ShadersStore[Q]=J);var $={__proto__:null,cellVertexShader:{name:Q,shader:J}},ee="cellPixelShader",ie="precision highp float;uniform vec4 vEyePosition;uniform vec4 vDiffuseColor;varying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<helperFunctions>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;uniform sampler2D diffuseSampler;uniform vec2 vDiffuseInfos;\n#endif\n#include<clipPlaneFragmentDeclaration>\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\nvec3 computeCustomDiffuseLighting(lightingInfo info,vec3 diffuseBase,float shadow)\n{diffuseBase=info.diffuse*shadow;\n#ifdef CELLBASIC\nfloat level=1.0;if (info.ndl<0.5)\nlevel=0.5;diffuseBase.rgb*vec3(level,level,level);\n#else\nfloat ToonThresholds[4];ToonThresholds[0]=0.95;ToonThresholds[1]=0.5;ToonThresholds[2]=0.2;ToonThresholds[3]=0.03;float ToonBrightnessLevels[5];ToonBrightnessLevels[0]=1.0;ToonBrightnessLevels[1]=0.8;ToonBrightnessLevels[2]=0.6;ToonBrightnessLevels[3]=0.35;ToonBrightnessLevels[4]=0.2;if (info.ndl>ToonThresholds[0])\n{diffuseBase.rgb*=ToonBrightnessLevels[0];}\nelse if (info.ndl>ToonThresholds[1])\n{diffuseBase.rgb*=ToonBrightnessLevels[1];}\nelse if (info.ndl>ToonThresholds[2])\n{diffuseBase.rgb*=ToonBrightnessLevels[2];}\nelse if (info.ndl>ToonThresholds[3])\n{diffuseBase.rgb*=ToonBrightnessLevels[3];}\nelse\n{diffuseBase.rgb*=ToonBrightnessLevels[4];}\n#endif\nreturn max(diffuseBase,vec3(0.2));}\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);vec4 baseColor=vec4(1.,1.,1.,1.);vec3 diffuseColor=vDiffuseColor.rgb;float alpha=vDiffuseColor.a;\n#ifdef DIFFUSE\nbaseColor=texture2D(diffuseSampler,vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include<depthPrePass>\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\nlightingInfo info;vec3 diffuseBase=vec3(0.,0.,0.);float shadow=1.;float glossiness=0.;float aggShadow=0.;float numLights=0.;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif \n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;vec4 color=vec4(finalDiffuse,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}";i.ShaderStore.ShadersStore[ee]||(i.ShaderStore.ShadersStore[ee]=ie);var ne={__proto__:null,cellPixelShader:{name:ee,shader:ie}},te="fireVertexShader",re="attribute position: vec3f;\n#ifdef UV1\nattribute uv: vec2f;\n#endif\n#ifdef UV2\nattribute uv2: vec2f;\n#endif\n#ifdef VERTEXCOLOR\nattribute color: vec4f;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform view: mat4x4f;uniform viewProjection: mat4x4f;\n#ifdef DIFFUSE\nvarying vDiffuseUV: vec2f;\n#endif\n#ifdef POINTSIZE\nuniform pointSize: f32;\n#endif\nvarying vPositionW: vec3f;\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\nuniform time: f32;uniform speed: f32;\n#ifdef DIFFUSE\nvarying vDistortionCoords1: vec2f;varying vDistortionCoords2: vec2f;varying vDistortionCoords3: vec2f;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef VERTEXCOLOR\nvar colorUpdated: vec4f=vertexInputs.color;\n#endif\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvar worldPos: vec4f=finalWorld* vec4f(vertexInputs.position,1.0);vertexOutputs.position=uniforms.viewProjection*worldPos;vertexOutputs.vPositionW= worldPos.xyz;\n#ifdef DIFFUSE\nvertexOutputs.vDiffuseUV=vec2f(vertexInputs.uv.x,vertexInputs.uv.y-0.2);\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<vertexColorMixing>\n#ifdef DIFFUSE\nvar layerSpeed: vec3f= vec3f(-0.2,-0.52,-0.1)*uniforms.speed;vertexOutputs.vDistortionCoords1=vec2f(vertexInputs.uv.x,vertexInputs.uv.y+layerSpeed.x*uniforms.time/1000.0);vertexOutputs.vDistortionCoords2=vec2f(vertexInputs.uv.x,vertexInputs.uv.y+layerSpeed.y*uniforms.time/1000.0);vertexOutputs.vDistortionCoords3=vec2f(vertexInputs.uv.x,vertexInputs.uv.y+layerSpeed.z*uniforms.time/1000.0);\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[te]||(i.ShaderStore.ShadersStoreWGSL[te]=re);var oe={__proto__:null,fireVertexShaderWGSL:{name:te,shader:re}},ae="firePixelShader",se="uniform vEyePosition: vec4f;varying vPositionW: vec3f;\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#ifdef DIFFUSE\nvarying vDiffuseUV: vec2f;var diffuseSamplerSampler: sampler;var diffuseSampler: texture_2d<f32>;uniform vDiffuseInfos: vec2f;\n#endif\nvar distortionSamplerSampler: sampler;var distortionSampler: texture_2d<f32>;var opacitySamplerSampler: sampler;var opacitySampler: texture_2d<f32>;\n#ifdef DIFFUSE\nvarying vDistortionCoords1: vec2f;varying vDistortionCoords2: vec2f;varying vDistortionCoords3: vec2f;\n#endif\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\nfn bx2(x: vec4f)->vec4f\n{return vec4f(2.0)*x- vec4f(1.0);}\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvar viewDirectionW: vec3f=normalize(uniforms.vEyePosition.xyz-fragmentInputs.vPositionW);var baseColor: vec4f= vec4f(1.,1.,1.,1.);var alpha: f32=1.0;\n#ifdef DIFFUSE\nlet distortionAmount0: f32=0.092;let distortionAmount1: f32=0.092;let distortionAmount2: f32=0.092;var heightAttenuation: vec2f= vec2f(0.3,0.39);var noise0: vec4f=textureSample(distortionSampler,distortionSamplerSampler,fragmentInputs.vDistortionCoords1);var noise1: vec4f=textureSample(distortionSampler,distortionSamplerSampler,fragmentInputs.vDistortionCoords2);var noise2: vec4f=textureSample(distortionSampler,distortionSamplerSampler,fragmentInputs.vDistortionCoords3);var noiseSum: vec4f=bx2(noise0)*distortionAmount0+bx2(noise1)*distortionAmount1+bx2(noise2)*distortionAmount2;var perturbedBaseCoords: vec4f= vec4f(fragmentInputs.vDiffuseUV,0.0,1.0)+noiseSum*(fragmentInputs.vDiffuseUV.y*heightAttenuation.x+heightAttenuation.y);var opacityColor: vec4f=textureSample(opacitySampler,opacitySamplerSampler,perturbedBaseCoords.xy);\n#ifdef ALPHATEST\nif (opacityColor.r<0.1) {discard;}\n#endif\n#include<depthPrePass>\nbaseColor=textureSample(diffuseSampler,diffuseSamplerSampler,perturbedBaseCoords.xy)*2.0;baseColor=baseColor*opacityColor;baseColor=vec4f(baseColor.rgb*uniforms.vDiffuseInfos.y,baseColor.a);\n#endif\n#ifdef VERTEXCOLOR\nbaseColor=vec4f(baseColor.rgb*fragmentInputs.vColor.rgb,baseColor.a);\n#endif\nvar diffuseBase: vec3f= vec3f(1.0,1.0,1.0);\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=fragmentInputs.vColor.a;\n#endif\nvar color: vec4f= vec4f(baseColor.rgb,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\nfragmentOutputs.color=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[ae]||(i.ShaderStore.ShadersStoreWGSL[ae]=se);var fe={__proto__:null,firePixelShaderWGSL:{name:ae,shader:se}},le="fireVertexShader",ue="precision highp float;attribute vec3 position;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform mat4 view;uniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\nuniform float time;uniform float speed;\n#ifdef DIFFUSE\nvarying vec2 vDistortionCoords1;varying vec2 vDistortionCoords2;varying vec2 vDistortionCoords3;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef VERTEXCOLOR\nvec4 colorUpdated=color;\n#endif\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);gl_Position=viewProjection*worldPos;vPositionW=vec3(worldPos);\n#ifdef DIFFUSE\nvDiffuseUV=uv;vDiffuseUV.y-=0.2;\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<vertexColorMixing>\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#ifdef DIFFUSE\nvec3 layerSpeed=vec3(-0.2,-0.52,-0.1)*speed;vDistortionCoords1.x=uv.x;vDistortionCoords1.y=uv.y+layerSpeed.x*time/1000.0;vDistortionCoords2.x=uv.x;vDistortionCoords2.y=uv.y+layerSpeed.y*time/1000.0;vDistortionCoords3.x=uv.x;vDistortionCoords3.y=uv.y+layerSpeed.z*time/1000.0;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStore[le]||(i.ShaderStore.ShadersStore[le]=ue);var de={__proto__:null,fireVertexShader:{name:le,shader:ue}},ce="firePixelShader",ve="precision highp float;uniform vec4 vEyePosition;varying vec3 vPositionW;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;uniform sampler2D diffuseSampler;uniform vec2 vDiffuseInfos;\n#endif\nuniform sampler2D distortionSampler;uniform sampler2D opacitySampler;\n#ifdef DIFFUSE\nvarying vec2 vDistortionCoords1;varying vec2 vDistortionCoords2;varying vec2 vDistortionCoords3;\n#endif\n#include<clipPlaneFragmentDeclaration>\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\nvec4 bx2(vec4 x)\n{return vec4(2.0)*x-vec4(1.0);}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);vec4 baseColor=vec4(1.,1.,1.,1.);float alpha=1.0;\n#ifdef DIFFUSE\nconst float distortionAmount0 =0.092;const float distortionAmount1 =0.092;const float distortionAmount2 =0.092;vec2 heightAttenuation=vec2(0.3,0.39);vec4 noise0=texture2D(distortionSampler,vDistortionCoords1);vec4 noise1=texture2D(distortionSampler,vDistortionCoords2);vec4 noise2=texture2D(distortionSampler,vDistortionCoords3);vec4 noiseSum=bx2(noise0)*distortionAmount0+bx2(noise1)*distortionAmount1+bx2(noise2)*distortionAmount2;vec4 perturbedBaseCoords=vec4(vDiffuseUV,0.0,1.0)+noiseSum*(vDiffuseUV.y*heightAttenuation.x+heightAttenuation.y);vec4 opacityColor=texture2D(opacitySampler,perturbedBaseCoords.xy);\n#ifdef ALPHATEST\nif (opacityColor.r<0.1)\ndiscard;\n#endif\n#include<depthPrePass>\nbaseColor=texture2D(diffuseSampler,perturbedBaseCoords.xy)*2.0;baseColor*=opacityColor;baseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\nvec3 diffuseBase=vec3(1.0,1.0,1.0);\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\nvec4 color=vec4(baseColor.rgb,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}";i.ShaderStore.ShadersStore[ce]||(i.ShaderStore.ShadersStore[ce]=ve);var me={__proto__:null,firePixelShader:{name:ce,shader:ve}},pe="furVertexShader",he="attribute position: vec3f;attribute normal: vec3f;\n#ifdef UV1\nattribute uv: vec2f;\n#endif\n#ifdef UV2\nattribute uv2: vec2f;\n#endif\n#ifdef VERTEXCOLOR\nattribute color: vec4f;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\nuniform furLength: f32;uniform furAngle: f32;\n#ifdef HIGHLEVEL\nuniform furOffset: f32;uniform furGravity: vec3f;uniform furTime: f32;uniform furSpacing: f32;uniform furDensity: f32;\n#endif\n#ifdef HEIGHTMAP\nvar heightTextureSampler: sampler;var heightTexture: texture_2d<f32>;\n#endif\n#ifdef HIGHLEVEL\nvarying vFurUV: vec2f;\n#endif\n#include<instancesDeclaration>\nuniform view: mat4x4f;uniform viewProjection: mat4x4f;\n#ifdef DIFFUSE\nvarying vDiffuseUV: vec2f;uniform diffuseMatrix: mat4x4f;uniform vDiffuseInfos: vec2f;\n#endif\n#ifdef POINTSIZE\nuniform pointSize: f32;\n#endif\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\nvarying vfur_length: f32;\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\nfn Rand(rv: vec3f)->f32 {var x: f32=dot(rv, vec3f(12.9898,78.233,24.65487));return fract(sin(x)*43758.5453);}\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef VERTEXCOLOR\nvar colorUpdated: vec4f=vertexInputs.color;\n#endif\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvar r: f32=Rand(vertexInputs.position);\n#ifdef HEIGHTMAP\nvertexOutputs.vfur_length=uniforms.furLength*textureSampleLevel(heightTexture,heightTextureSampler,vertexInputs.uv,0.).x;\n#else\nvertexOutputs.vfur_length=(uniforms.furLength*r);\n#endif\nvar tangent1: vec3f= vec3f(vertexInputs.normal.y,-vertexInputs.normal.x,0);var tangent2: vec3f= vec3f(-vertexInputs.normal.z,0,vertexInputs.normal.x);r=Rand(tangent1*r);var J: f32=(2.0+4.0*r);r=Rand(tangent2*r);var K: f32=(2.0+2.0*r);tangent1=tangent1*J+tangent2*K;tangent1=normalize(tangent1);var newPosition: vec3f=vertexInputs.position+vertexInputs.normal*vertexOutputs.vfur_length*cos(uniforms.furAngle)+tangent1*vertexOutputs.vfur_length*sin(uniforms.furAngle);\n#ifdef HIGHLEVEL\nvar forceDirection: vec3f= vec3f(0.0,0.0,0.0);forceDirection.x=sin(uniforms.furTime+vertexInputs.position.x*0.05)*0.2;forceDirection.y=cos(uniforms.furTime*0.7+vertexInputs.position.y*0.04)*0.2;forceDirection.z=sin(uniforms.furTime*0.7+vertexInputs.position.z*0.04)*0.2;var displacement: vec3f= vec3f(0.0,0.0,0.0);displacement=uniforms.furGravity+forceDirection;var displacementFactor: f32=pow(uniforms.furOffset,3.0);var aNormal: vec3f=vertexInputs.normal;aNormal=vec3f(aNormal.xyz+displacement*displacementFactor);newPosition= vec3f(newPosition.x,newPosition.y,newPosition.z)+(normalize(aNormal)*uniforms.furOffset*uniforms.furSpacing);\n#endif\n#ifdef NORMAL\nvertexOutputs.vNormalW=normalize(( finalWorld* vec4f(vertexInputs.normal,0.0)).xyz);\n#endif\nvertexOutputs.position=uniforms.viewProjection*finalWorld* vec4f(newPosition,1.0);var worldPos: vec4f=finalWorld* vec4f(newPosition,1.0);vertexOutputs.vPositionW= worldPos.xyz;\n#ifndef UV1\nvar uv: vec2f= vec2f(0.,0.);\n#else\nvar uv: vec2f=vertexInputs.uv;\n#endif\n#ifndef UV2\nvar uv2: vec2f= vec2f(0.,0.);\n#else\nvar uv2: vec2f=vertexInputs.uv2;\n#endif\n#ifdef DIFFUSE\nif (uniforms.vDiffuseInfos.x==0.)\n{vertexOutputs.vDiffuseUV=(uniforms.diffuseMatrix* vec4f(uv,1.0,0.0)).xy;}\nelse\n{vertexOutputs.vDiffuseUV=(uniforms.diffuseMatrix* vec4f(uv2,1.0,0.0)).xy;}\n#ifdef HIGHLEVEL\nvertexOutputs.vFurUV=vertexOutputs.vDiffuseUV*uniforms.furDensity;\n#endif\n#else\n#ifdef HIGHLEVEL\nvertexOutputs.vFurUV=uv*uniforms.furDensity;\n#endif\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[pe]||(i.ShaderStore.ShadersStoreWGSL[pe]=he);var ge={__proto__:null,furVertexShaderWGSL:{name:pe,shader:he}},Se="furPixelShader",xe="uniform vEyePosition: vec4f;uniform vDiffuseColor: vec4f;uniform furColor: vec4f;uniform furLength: f32;varying vPositionW: vec3f;varying vfur_length: f32;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<helperFunctions>\n#include<lightUboDeclaration>[0..maxSimultaneousLights]\n#ifdef DIFFUSE\nvarying vDiffuseUV: vec2f;var diffuseSamplerSampler: sampler;var diffuseSampler: texture_2d<f32>;uniform vDiffuseInfos: vec2f;\n#endif\n#ifdef HIGHLEVEL\nuniform furOffset: f32;uniform furOcclusion: f32;var furTextureSampler: sampler;var furTexture: texture_2d<f32>;varying vFurUV: vec2f;\n#endif\n#include<logDepthDeclaration>\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<fogFragmentDeclaration>\n#include<clipPlaneFragmentDeclaration>\nfn Rand(rv: vec3f)->f32 {var x: f32=dot(rv, vec3f(12.9898,78.233,24.65487));return fract(sin(x)*43758.5453);}\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvar viewDirectionW: vec3f=normalize(uniforms.vEyePosition.xyz-fragmentInputs.vPositionW);var baseColor: vec4f=uniforms.furColor;var diffuseColor: vec3f=uniforms.vDiffuseColor.rgb;var alpha: f32=uniforms.vDiffuseColor.a;\n#ifdef DIFFUSE\nbaseColor=baseColor*textureSample(diffuseSampler,diffuseSamplerSampler,fragmentInputs.vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4) {discard;}\n#endif\n#include<depthPrePass>\nbaseColor=vec4f(baseColor.rgb*uniforms.vDiffuseInfos.y,baseColor.a);\n#endif\n#ifdef VERTEXCOLOR\nbaseColor=vec4f(baseColor.rgb*fragmentInputs.vColor.rgb,baseColor.a);\n#endif\n#ifdef NORMAL\nvar normalW: vec3f=normalize(fragmentInputs.vNormalW);\n#else\nvar normalW: vec3f= vec3f(1.0,1.0,1.0);\n#endif\n#ifdef HIGHLEVEL\nvar furTextureColor: vec4f=textureSample(furTexture,furTextureSampler, vec2f(fragmentInputs.vFurUV.x,fragmentInputs.vFurUV.y));if (furTextureColor.a<=0.0 || furTextureColor.g<uniforms.furOffset) {discard;}\nvar occlusion: f32=mix(0.0,furTextureColor.b*1.2,uniforms.furOffset);baseColor= vec4f(baseColor.xyz*max(occlusion,uniforms.furOcclusion),1.1-uniforms.furOffset);\n#endif\nvar diffuseBase: vec3f= vec3f(0.,0.,0.);var info: lightingInfo;var shadow: f32=1.;var glossiness: f32=0.;var aggShadow: f32=0.;var numLights: f32=0.;\n#ifdef SPECULARTERM\nvar specularBase: vec3f= vec3f(0.,0.,0.);\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=fragmentInputs.vColor.a;\n#endif\nvar finalDiffuse: vec3f=clamp(diffuseBase.rgb*baseColor.rgb,vec3f(0.0),vec3f(1.0));\n#ifdef HIGHLEVEL\nvar color: vec4f= vec4f(finalDiffuse,alpha);\n#else\nvar rr: f32=fragmentInputs.vfur_length/uniforms.furLength*0.5;var color: vec4f= vec4f(finalDiffuse*(0.5+rr),alpha);\n#endif\n#include<logDepthFragment>\n#include<fogFragment>\nfragmentOutputs.color=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[Se]||(i.ShaderStore.ShadersStoreWGSL[Se]=xe);var Te={__proto__:null,furPixelShaderWGSL:{name:Se,shader:xe}},_e="furVertexShader",Ce="precision highp float;attribute vec3 position;attribute vec3 normal;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\nuniform float furLength;uniform float furAngle;\n#ifdef HIGHLEVEL\nuniform float furOffset;uniform vec3 furGravity;uniform float furTime;uniform float furSpacing;uniform float furDensity;\n#endif\n#ifdef HEIGHTMAP\nuniform sampler2D heightTexture;\n#endif\n#ifdef HIGHLEVEL\nvarying vec2 vFurUV;\n#endif\n#include<instancesDeclaration>\nuniform mat4 view;uniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;uniform mat4 diffuseMatrix;uniform vec2 vDiffuseInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\nvarying float vfur_length;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\nfloat Rand(vec3 rv) {float x=dot(rv,vec3(12.9898,78.233,24.65487));return fract(sin(x)*43758.5453);}\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef VERTEXCOLOR\nvec4 colorUpdated=color;\n#endif\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nfloat r=Rand(position);\n#ifdef HEIGHTMAP\n#if __VERSION__>100\nvfur_length=furLength*texture(heightTexture,uv).x;\n#else\nvfur_length=furLength*texture2D(heightTexture,uv).r;\n#endif\n#else \nvfur_length=(furLength*r);\n#endif\nvec3 tangent1=vec3(normal.y,-normal.x,0);vec3 tangent2=vec3(-normal.z,0,normal.x);r=Rand(tangent1*r);float J=(2.0+4.0*r);r=Rand(tangent2*r);float K=(2.0+2.0*r);tangent1=tangent1*J+tangent2*K;tangent1=normalize(tangent1);vec3 newPosition=position+normal*vfur_length*cos(furAngle)+tangent1*vfur_length*sin(furAngle);\n#ifdef HIGHLEVEL\nvec3 forceDirection=vec3(0.0,0.0,0.0);forceDirection.x=sin(furTime+position.x*0.05)*0.2;forceDirection.y=cos(furTime*0.7+position.y*0.04)*0.2;forceDirection.z=sin(furTime*0.7+position.z*0.04)*0.2;vec3 displacement=vec3(0.0,0.0,0.0);displacement=furGravity+forceDirection;float displacementFactor=pow(furOffset,3.0);vec3 aNormal=normal;aNormal.xyz+=displacement*displacementFactor;newPosition=vec3(newPosition.x,newPosition.y,newPosition.z)+(normalize(aNormal)*furOffset*furSpacing);\n#endif\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\ngl_Position=viewProjection*finalWorld*vec4(newPosition,1.0);vec4 worldPos=finalWorld*vec4(newPosition,1.0);vPositionW=vec3(worldPos);\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x==0.)\n{vDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));}\nelse\n{vDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));}\n#ifdef HIGHLEVEL\nvFurUV=vDiffuseUV*furDensity;\n#endif\n#else\n#ifdef HIGHLEVEL\nvFurUV=uv*furDensity;\n#endif\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStore[_e]||(i.ShaderStore.ShadersStore[_e]=Ce);var Ee={__proto__:null,furVertexShader:{name:_e,shader:Ce}},Pe="furPixelShader",Ie="precision highp float;uniform vec4 vEyePosition;uniform vec4 vDiffuseColor;uniform vec4 furColor;uniform float furLength;varying vec3 vPositionW;varying float vfur_length;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<helperFunctions>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;uniform sampler2D diffuseSampler;uniform vec2 vDiffuseInfos;\n#endif\n#ifdef HIGHLEVEL\nuniform float furOffset;uniform float furOcclusion;uniform sampler2D furTexture;varying vec2 vFurUV;\n#endif\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<logDepthDeclaration>\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<fogFragmentDeclaration>\n#include<clipPlaneFragmentDeclaration>\nfloat Rand(vec3 rv) {float x=dot(rv,vec3(12.9898,78.233,24.65487));return fract(sin(x)*43758.5453);}\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);vec4 baseColor=furColor;vec3 diffuseColor=vDiffuseColor.rgb;float alpha=vDiffuseColor.a;\n#ifdef DIFFUSE\nbaseColor*=texture2D(diffuseSampler,vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include<depthPrePass>\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#ifdef HIGHLEVEL\nvec4 furTextureColor=texture2D(furTexture,vec2(vFurUV.x,vFurUV.y));if (furTextureColor.a<=0.0 || furTextureColor.g<furOffset) {discard;}\nfloat occlusion=mix(0.0,furTextureColor.b*1.2,furOffset);baseColor=vec4(baseColor.xyz*max(occlusion,furOcclusion),1.1-furOffset);\n#endif\nvec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;float shadow=1.;float glossiness=0.;float aggShadow=0.;float numLights=0.;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\nvec3 finalDiffuse=clamp(diffuseBase.rgb*baseColor.rgb,0.0,1.0);\n#ifdef HIGHLEVEL\nvec4 color=vec4(finalDiffuse,alpha);\n#else\nfloat r=vfur_length/furLength*0.5;vec4 color=vec4(finalDiffuse*(0.5+r),alpha);\n#endif\n#include<logDepthFragment>\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}";i.ShaderStore.ShadersStore[Pe]||(i.ShaderStore.ShadersStore[Pe]=Ie);var ye={__proto__:null,furPixelShader:{name:Pe,shader:Ie}},Le="gradientVertexShader",Ae="attribute position: vec3f;\n#ifdef NORMAL\nattribute normal: vec3f;\n#endif\n#ifdef UV1\nattribute uv: vec2f;\n#endif\n#ifdef UV2\nattribute uv2: vec2f;\n#endif\n#ifdef VERTEXCOLOR\nattribute color: vec4f;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform view: mat4x4f;uniform viewProjection: mat4x4f;\n#ifdef POINTSIZE\nuniform pointSize: f32;\n#endif\nvarying vPositionW: vec3f;varying vPosition: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef VERTEXCOLOR\nvar colorUpdated: vec4f=vertexInputs.color;\n#endif\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvar worldPos: vec4f=finalWorld* vec4f(vertexInputs.position,1.0);vertexOutputs.position=uniforms.viewProjection*worldPos;vertexOutputs.vPositionW= worldPos.xyz;vertexOutputs.vPosition=vertexInputs.position;\n#ifdef NORMAL\nvertexOutputs.vNormalW=normalize(( finalWorld* vec4f(vertexInputs.normal,0.0)).xyz);\n#endif\n#ifndef UV1\nvar uv: vec2f= vec2f(0.,0.);\n#else\nvar uv: vec2f=vertexInputs.uv;\n#endif\n#ifndef UV2\nvar uv2: vec2f= vec2f(0.,0.);\n#else\nvar uv2: vec2f=vertexInputs.uv2;\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[Le]||(i.ShaderStore.ShadersStoreWGSL[Le]=Ae);var Oe={__proto__:null,gradientVertexShaderWGSL:{name:Le,shader:Ae}},De="gradientPixelShader",Ne="uniform vEyePosition: vec4f;uniform topColor: vec4f;uniform bottomColor: vec4f;uniform offset: f32;uniform scale: f32;uniform smoothness: f32;varying vPositionW: vec3f;varying vPosition: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<helperFunctions>\n#include<lightUboDeclaration>[0]\n#include<lightUboDeclaration>[1]\n#include<lightUboDeclaration>[2]\n#include<lightUboDeclaration>[3]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvar viewDirectionW: vec3f=normalize(uniforms.vEyePosition.xyz-fragmentInputs.vPositionW);var h: f32=fragmentInputs.vPosition.y*uniforms.scale+uniforms.offset;var mysmoothness: f32=clamp(uniforms.smoothness,0.01,max(uniforms.smoothness,10.));var baseColor: vec4f=mix(uniforms.bottomColor,uniforms.topColor,vec4f(max(pow(max(h,0.0),mysmoothness),0.0)));var diffuseColor: vec3f=baseColor.rgb;var alpha: f32=baseColor.a;\n#ifdef ALPHATEST\nif (baseColor.a<0.4) {discard;}\n#endif\n#include<depthPrePass>\n#ifdef VERTEXCOLOR\nbaseColor=vec4f(baseColor.rgb*fragmentInputs.vColor.rgb,baseColor.a);\n#endif\n#ifdef NORMAL\nvar normalW: vec3f=normalize(fragmentInputs.vNormalW);\n#else\nvar normalW: vec3f= vec3f(1.0,1.0,1.0);\n#endif\n#ifdef EMISSIVE\nvar diffuseBase: vec3f=baseColor.rgb;\n#else\nvar diffuseBase: vec3f= vec3f(0.,0.,0.);\n#endif\nvar info: lightingInfo;var shadow: f32=1.;var glossiness: f32=0.;var aggShadow: f32=0.;var numLights: f32=0.;\n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=fragmentInputs.vColor.a;\n#endif\nvar finalDiffuse: vec3f=clamp(diffuseBase*diffuseColor,vec3f(0.0),vec3f(1.0))*baseColor.rgb;var color: vec4f= vec4f(finalDiffuse,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\nfragmentOutputs.color=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[De]||(i.ShaderStore.ShadersStoreWGSL[De]=Ne);var be={__proto__:null,gradientPixelShaderWGSL:{name:De,shader:Ne}},Fe="gradientVertexShader",Me="precision highp float;attribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform mat4 view;uniform mat4 viewProjection;\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;varying vec3 vPosition;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef VERTEXCOLOR\nvec4 colorUpdated=color;\n#endif\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);gl_Position=viewProjection*worldPos;vPositionW=vec3(worldPos);vPosition=position;\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStore[Fe]||(i.ShaderStore.ShadersStore[Fe]=Me);var Re={__proto__:null,gradientVertexShader:{name:Fe,shader:Me}},Ve="gradientPixelShader",Ue="precision highp float;uniform vec4 vEyePosition;uniform vec4 topColor;uniform vec4 bottomColor;uniform float offset;uniform float scale;uniform float smoothness;varying vec3 vPositionW;varying vec3 vPosition;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<helperFunctions>\n#include<__decl__lightFragment>[0]\n#include<__decl__lightFragment>[1]\n#include<__decl__lightFragment>[2]\n#include<__decl__lightFragment>[3]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);float h=vPosition.y*scale+offset;float mysmoothness=clamp(smoothness,0.01,max(smoothness,10.));vec4 baseColor=mix(bottomColor,topColor,max(pow(max(h,0.0),mysmoothness),0.0));vec3 diffuseColor=baseColor.rgb;float alpha=baseColor.a;\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include<depthPrePass>\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#ifdef EMISSIVE\nvec3 diffuseBase=baseColor.rgb;\n#else\nvec3 diffuseBase=vec3(0.,0.,0.);\n#endif\nlightingInfo info;float shadow=1.;float glossiness=0.;float aggShadow=0.;float numLights=0.;\n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;vec4 color=vec4(finalDiffuse,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStore[Ve]||(i.ShaderStore.ShadersStore[Ve]=Ue);var we={__proto__:null,gradientPixelShader:{name:Ve,shader:Ue}},Be="gridVertexShader",ze="attribute position: vec3f;attribute normal: vec3f;\n#ifdef UV1\nattribute uv: vec2f;\n#endif\n#ifdef UV2\nattribute uv2: vec2f;\n#endif\n#include<instancesDeclaration>\n#include<sceneUboDeclaration>\nvarying vPosition: vec3f;varying vNormal: vec3f;\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#ifdef OPACITY\nvarying vOpacityUV: vec2f;uniform opacityMatrix: mat4x4f;uniform vOpacityInfos: vec2f;\n#endif\n#include<clipPlaneVertexDeclaration>\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\nvar worldPos: vec4f=finalWorld* vec4f(vertexInputs.position,1.0);\n#include<fogVertex>\nvar cameraSpacePosition: vec4f=scene.view*worldPos;vertexOutputs.position=scene.projection*cameraSpacePosition;\n#ifdef OPACITY\n#ifndef UV1\nvar uv: vec2f= vec2f(0.,0.);\n#else\nvar uv: vec2f=vertexInputs.uv;\n#endif\n#ifndef UV2\nvar uv2: vec2f= vec2f(0.,0.);\n#else\nvar uv2: vec2f=vertexInputs.uv2;\n#endif\nif (uniforms.vOpacityInfos.x==0.)\n{vertexOutputs.vOpacityUV=(uniforms.opacityMatrix* vec4f(uv,1.0,0.0)).xy;}\nelse\n{vertexOutputs.vOpacityUV=(uniforms.opacityMatrix* vec4f(uv2,1.0,0.0)).xy;}\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\nvertexOutputs.vPosition=vertexInputs.position;vertexOutputs.vNormal=vertexInputs.normal;\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[Be]||(i.ShaderStore.ShadersStoreWGSL[Be]=ze);var Ge={__proto__:null,gridVertexShaderWGSL:{name:Be,shader:ze}},He="gridPixelShader",We="#define SQRT2 1.41421356\n#define PI 3.14159\nuniform visibility: f32;uniform mainColor: vec3f;uniform lineColor: vec3f;uniform gridControl: vec4f;uniform gridOffset: vec3f;varying vPosition: vec3f;varying vNormal: vec3f;\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#ifdef OPACITY\nvarying vOpacityUV: vec2f;var opacitySamplerSampler: sampler;var opacitySampler: texture_2d<f32>;uniform vOpacityInfos: vec2f;\n#endif\nfn getDynamicVisibility(position: f32)->f32 {var majorGridFrequency: f32=uniforms.gridControl.y;if (floor(position+0.5)==floor(position/majorGridFrequency+0.5)*majorGridFrequency)\n{return 1.0;}\nreturn uniforms.gridControl.z;}\nfn getAnisotropicAttenuation(differentialLength: f32)->f32 {let maxNumberOfLines: f32=10.0;return clamp(1.0/(differentialLength+1.0)-1.0/maxNumberOfLines,0.0,1.0);}\nfn isPointOnLine(position: f32,differentialLength: f32)->f32 {var fractionPartOfPosition: f32=position-floor(position+0.5);fractionPartOfPosition=fractionPartOfPosition/differentialLength;\n#ifdef ANTIALIAS\nfractionPartOfPosition=clamp(fractionPartOfPosition,-1.,1.);var result: f32=0.5+0.5*cos(fractionPartOfPosition*PI);return result;\n#else\nif (abs(fractionPartOfPosition)<SQRT2/4.) {return 1.;}\nreturn 0.;\n#endif\n}\nfn contributionOnAxis(position: f32)->f32 {var differentialLength: f32=length( vec2f(dpdx(position),dpdy(position)));differentialLength=differentialLength*SQRT2;var result: f32=isPointOnLine(position,differentialLength);var dynamicVisibility: f32=getDynamicVisibility(position);result=result*dynamicVisibility;var anisotropicAttenuation: f32=getAnisotropicAttenuation(differentialLength);result=result*anisotropicAttenuation;return result;}\nfn normalImpactOnAxis(x: f32)->f32 {var normalImpact: f32=clamp(1.0-3.0*abs(x*x*x),0.0,1.0);return normalImpact;}\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvar gridRatio: f32=uniforms.gridControl.x;var gridPos: vec3f=(fragmentInputs.vPosition+uniforms.gridOffset.xyz)/gridRatio;var x: f32=contributionOnAxis(gridPos.x);var y: f32=contributionOnAxis(gridPos.y);var z: f32=contributionOnAxis(gridPos.z);var normal: vec3f=normalize(fragmentInputs.vNormal);x=x*normalImpactOnAxis(normal.x);y=y*normalImpactOnAxis(normal.y);z=z*normalImpactOnAxis(normal.z);\n#ifdef MAX_LINE\nvar grid: f32=clamp(max(max(x,y),z),0.,1.);\n#else\nvar grid: f32=clamp(x+y+z,0.,1.);\n#endif\nvar color: vec4f=vec4f(mix(uniforms.mainColor,uniforms.lineColor,vec3f(grid)),1.0);\n#ifdef FOG\n#include<fogFragment>\n#endif\nvar opacity: f32=1.0;\n#ifdef TRANSPARENT\nopacity=clamp(grid,0.08,uniforms.gridControl.w*grid);\n#endif\n#ifdef OPACITY\nopacity=opacity*textureSample(opacitySampler,opacitySamplerSampler,fragmentInputs.vOpacityUV).a;\n#endif\nfragmentOutputs.color= vec4f(color.rgb,opacity*uniforms.visibility);\n#ifdef TRANSPARENT\n#ifdef PREMULTIPLYALPHA\nfragmentOutputs.color=vec4f(fragmentOutputs.color.rgb*opacity,fragmentOutputs.color.a);\n#endif\n#else\n#endif\n#include<logDepthFragment>\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[He]||(i.ShaderStore.ShadersStoreWGSL[He]=We);var Xe={__proto__:null,gridPixelShaderWGSL:{name:He,shader:We}},ke="gridVertexShader",je="precision highp float;attribute vec3 position;attribute vec3 normal;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#include<instancesDeclaration>\n#include<__decl__sceneVertex>\nvarying vec3 vPosition;varying vec3 vNormal;\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#ifdef OPACITY\nvarying vec2 vOpacityUV;uniform mat4 opacityMatrix;uniform vec2 vOpacityInfos;\n#endif\n#include<clipPlaneVertexDeclaration>\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\nvec4 worldPos=finalWorld*vec4(position,1.0);\n#include<fogVertex>\nvec4 cameraSpacePosition=view*worldPos;gl_Position=projection*cameraSpacePosition;\n#ifdef OPACITY\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\nif (vOpacityInfos.x==0.)\n{vOpacityUV=vec2(opacityMatrix*vec4(uv,1.0,0.0));}\nelse\n{vOpacityUV=vec2(opacityMatrix*vec4(uv2,1.0,0.0));}\n#endif \n#include<clipPlaneVertex>\n#include<logDepthVertex>\nvPosition=position;vNormal=normal;\n#define CUSTOM_VERTEX_MAIN_END\n}";i.ShaderStore.ShadersStore[ke]||(i.ShaderStore.ShadersStore[ke]=je);var Ze={__proto__:null,gridVertexShader:{name:ke,shader:je}},Ye="gridPixelShader",Ke="#extension GL_OES_standard_derivatives : enable\n#define SQRT2 1.41421356\n#define PI 3.14159\nprecision highp float;uniform float visibility;uniform vec3 mainColor;uniform vec3 lineColor;uniform vec4 gridControl;uniform vec3 gridOffset;varying vec3 vPosition;varying vec3 vNormal;\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#ifdef OPACITY\nvarying vec2 vOpacityUV;uniform sampler2D opacitySampler;uniform vec2 vOpacityInfos;\n#endif\nfloat getDynamicVisibility(float position) {float majorGridFrequency=gridControl.y;if (floor(position+0.5)==floor(position/majorGridFrequency+0.5)*majorGridFrequency)\n{return 1.0;}\nreturn gridControl.z;}\nfloat getAnisotropicAttenuation(float differentialLength) {const float maxNumberOfLines=10.0;return clamp(1.0/(differentialLength+1.0)-1.0/maxNumberOfLines,0.0,1.0);}\nfloat isPointOnLine(float position,float differentialLength) {float fractionPartOfPosition=position-floor(position+0.5); \nfractionPartOfPosition/=differentialLength; \n#ifdef ANTIALIAS\nfractionPartOfPosition=clamp(fractionPartOfPosition,-1.,1.);float result=0.5+0.5*cos(fractionPartOfPosition*PI); \nreturn result;\n#else\nreturn abs(fractionPartOfPosition)<SQRT2/4. ? 1. : 0.;\n#endif\n}\nfloat contributionOnAxis(float position) {float differentialLength=length(vec2(dFdx(position),dFdy(position)));differentialLength*=SQRT2; \nfloat result=isPointOnLine(position,differentialLength);float dynamicVisibility=getDynamicVisibility(position);result*=dynamicVisibility;float anisotropicAttenuation=getAnisotropicAttenuation(differentialLength);result*=anisotropicAttenuation;return result;}\nfloat normalImpactOnAxis(float x) {float normalImpact=clamp(1.0-3.0*abs(x*x*x),0.0,1.0);return normalImpact;}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nfloat gridRatio=gridControl.x;vec3 gridPos=(vPosition+gridOffset.xyz)/gridRatio;float x=contributionOnAxis(gridPos.x);float y=contributionOnAxis(gridPos.y);float z=contributionOnAxis(gridPos.z);vec3 normal=normalize(vNormal);x*=normalImpactOnAxis(normal.x);y*=normalImpactOnAxis(normal.y);z*=normalImpactOnAxis(normal.z);\n#ifdef MAX_LINE\nfloat grid=clamp(max(max(x,y),z),0.,1.);\n#else\nfloat grid=clamp(x+y+z,0.,1.);\n#endif\nvec3 color=mix(mainColor,lineColor,grid);\n#ifdef FOG\n#include<fogFragment>\n#endif\nfloat opacity=1.0;\n#ifdef TRANSPARENT\nopacity=clamp(grid,0.08,gridControl.w*grid);\n#endif\n#ifdef OPACITY\nopacity*=texture2D(opacitySampler,vOpacityUV).a;\n#endif\ngl_FragColor=vec4(color.rgb,opacity*visibility);\n#ifdef TRANSPARENT\n#ifdef PREMULTIPLYALPHA\ngl_FragColor.rgb*=opacity;\n#endif\n#else\n#endif\n#include<logDepthFragment>\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStore[Ye]||(i.ShaderStore.ShadersStore[Ye]=Ke);var qe={__proto__:null,gridPixelShader:{name:Ye,shader:Ke}},Qe="lavaVertexShader",Je="uniform time: f32;uniform lowFrequencySpeed: f32;varying noise: f32;attribute position: vec3f;\n#ifdef NORMAL\nattribute normal: vec3f;\n#endif\n#ifdef UV1\nattribute uv: vec2f;\n#endif\n#ifdef UV2\nattribute uv2: vec2f;\n#endif\n#ifdef VERTEXCOLOR\nattribute color: vec4f;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform view: mat4x4f;uniform viewProjection: mat4x4f;\n#ifdef DIFFUSE\nvarying vDiffuseUV: vec2f;uniform diffuseMatrix: mat4x4f;uniform vDiffuseInfos: vec2f;\n#endif\n#ifdef POINTSIZE\nuniform pointSize: f32;\n#endif\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\n/* NOISE FUNCTIONS */\nfn mod289v3(x: vec3f)->vec3f\n{return x-floor(x*(1.0/289.0))*289.0;}\nfn mod289v4(x: vec4f)->vec4f\n{return x-floor(x*(1.0/289.0))*289.0;}\nfn permute(x: vec4f)->vec4f\n{return mod289v4(((x*34.0)+1.0)*x);}\nfn taylorInvSqrt(r: vec4f)->vec4f\n{return vec4f(1.79284291400159)-0.85373472095314*r;}\nfn fade(t: vec3f)->vec3f {return t*t*t*(t*(t*6.0-15.0)+10.0);}\nfn pnoise(P: vec3f,rep: vec3f)->f32\n{var Pi0: vec3f=(P-rep*floor(P/rep)); \nPi0=floor(Pi0);var Pi1: vec3f=Pi0+ vec3f(1.0);Pi1=Pi1-rep*floor(Pi1/rep);Pi0=mod289v3(Pi0);Pi1=mod289v3(Pi1);var Pf0: vec3f=fract(P);var Pf1: vec3f=Pf0- vec3f(1.0);var ix: vec4f= vec4f(Pi0.x,Pi1.x,Pi0.x,Pi1.x);var iy: vec4f= vec4f(Pi0.y,Pi0.y,Pi1.y,Pi1.y);var iz0: vec4f= vec4f(Pi0.z);var iz1: vec4f= vec4f(Pi1.z);var ixy: vec4f=permute(permute(ix)+iy);var ixy0: vec4f=permute(ixy+iz0);var ixy1: vec4f=permute(ixy+iz1);var gx0: vec4f=ixy0*(1.0/7.0);var gy0: vec4f=fract(floor(gx0)*(1.0/7.0))-0.5;gx0=fract(gx0);var gz0: vec4f= vec4f(0.5)-abs(gx0)-abs(gy0);var sz0: vec4f=step(gz0, vec4f(0.0));gx0=gx0-sz0*(step( vec4f(0.0),gx0)-0.5);gy0=gy0-sz0*(step( vec4f(0.0),gy0)-0.5);var gx1: vec4f=ixy1*(1.0/7.0);var gy1: vec4f=fract(floor(gx1)*(1.0/7.0))-0.5;gx1=fract(gx1);var gz1: vec4f= vec4f(0.5)-abs(gx1)-abs(gy1);var sz1: vec4f=step(gz1, vec4f(0.0));gx1=gx1-sz1*(step( vec4f(0.0),gx1)-0.5);gy1=gy1-sz1*(step( vec4f(0.0),gy1)-0.5);var g000: vec3f= vec3f(gx0.x,gy0.x,gz0.x);var g100: vec3f= vec3f(gx0.y,gy0.y,gz0.y);var g010: vec3f= vec3f(gx0.z,gy0.z,gz0.z);var g110: vec3f= vec3f(gx0.w,gy0.w,gz0.w);var g001: vec3f= vec3f(gx1.x,gy1.x,gz1.x);var g101: vec3f= vec3f(gx1.y,gy1.y,gz1.y);var g011: vec3f= vec3f(gx1.z,gy1.z,gz1.z);var g111: vec3f= vec3f(gx1.w,gy1.w,gz1.w);var norm0: vec4f=taylorInvSqrt( vec4f(dot(g000,g000),dot(g010,g010),dot(g100,g100),dot(g110,g110)));g000=g000*norm0.x;g010=g010*norm0.y;g100=g100*norm0.z;g110=g110*norm0.w;var norm1: vec4f=taylorInvSqrt( vec4f(dot(g001,g001),dot(g011,g011),dot(g101,g101),dot(g111,g111)));g001=g001*norm1.x;g011=g011*norm1.y;g101=g101*norm1.z;g111=g111*norm1.w;var n000: f32=dot(g000,Pf0);var n100: f32=dot(g100, vec3f(Pf1.x,Pf0.yz));var n010: f32=dot(g010, vec3f(Pf0.x,Pf1.y,Pf0.z));var n110: f32=dot(g110, vec3f(Pf1.xy,Pf0.z));var n001: f32=dot(g001, vec3f(Pf0.xy,Pf1.z));var n101: f32=dot(g101, vec3f(Pf1.x,Pf0.y,Pf1.z));var n011: f32=dot(g011, vec3f(Pf0.x,Pf1.yz));var n111: f32=dot(g111,Pf1);var fade_xyz: vec3f=fade(Pf0);var n_z: vec4f=mix( vec4f(n000,n100,n010,n110), vec4f(n001,n101,n011,n111), vec4f(fade_xyz.z));var n_yz: vec2f=mix(n_z.xy,n_z.zw, vec2f(fade_xyz.y));var n_xyz: f32=mix(n_yz.x,n_yz.y,fade_xyz.x);return 2.2*n_xyz;}\n/* END FUNCTION */\nfn turbulence(p: vec3f)->f32 {var w: f32=100.0;var t: f32=-.5;for (var f: f32=1.0; f<=10.0; f=f+1.0){var power: f32=pow(2.0,f);t=t+abs(pnoise( vec3f(power*p), vec3f(10.0,10.0,10.0))/power);}\nreturn t;}\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef VERTEXCOLOR\nvar colorUpdated: vec4f=vertexInputs.color;\n#endif\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\n#ifdef NORMAL\nvertexOutputs.noise=10.0*-.10*turbulence(.5*vertexInputs.normal+uniforms.time*1.15);var b: f32=uniforms.lowFrequencySpeed*5.0*pnoise(0.05*vertexInputs.position+ vec3f(uniforms.time*1.025), vec3f(100.0));var displacement: f32=-1.5*vertexOutputs.noise+b;var newPosition: vec3f=vertexInputs.position+vertexInputs.normal*displacement;vertexOutputs.position=uniforms.viewProjection*finalWorld* vec4f(newPosition,1.0);var worldPos: vec4f=finalWorld* vec4f(newPosition,1.0);vertexOutputs.vPositionW= worldPos.xyz;vertexOutputs.vNormalW=normalize(( finalWorld* vec4f(vertexInputs.normal,0.0)).xyz);\n#endif\n#ifndef UV1\nvar uv: vec2f= vec2f(0.,0.);\n#else\nvar uv: vec2f=vertexInputs.uv;\n#endif\n#ifndef UV2\nvar uv2: vec2f= vec2f(0.,0.);\n#else\nvar uv2: vec2f=vertexInputs.uv2;\n#endif\n#ifdef DIFFUSE\nif (uniforms.vDiffuseInfos.x==0.)\n{vertexOutputs.vDiffuseUV=(uniforms.diffuseMatrix* vec4f(uv,1.0,0.0)).xy;}\nelse\n{vertexOutputs.vDiffuseUV=(uniforms.diffuseMatrix* vec4f(uv2,1.0,0.0)).xy;}\n#endif\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#include<logDepthVertex>\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[Qe]||(i.ShaderStore.ShadersStoreWGSL[Qe]=Je);var $e={__proto__:null,lavaVertexShaderWGSL:{name:Qe,shader:Je}},ei="lavaPixelShader",ii="uniform vEyePosition: vec4f;uniform vDiffuseColor: vec4f;varying vPositionW: vec3f;uniform time: f32;uniform speed: f32;uniform movingSpeed: f32;uniform fogColor: vec3f;var noiseTextureSampler: sampler;var noiseTexture: texture_2d<f32>;uniform fogDensity: f32;varying noise: f32;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<helperFunctions>\n#include<lightUboDeclaration>[0]\n#include<lightUboDeclaration>[1]\n#include<lightUboDeclaration>[2]\n#include<lightUboDeclaration>[3]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#ifdef DIFFUSE\nvarying vDiffuseUV: vec2f;var diffuseSamplerSampler: sampler;var diffuseSampler: texture_2d<f32>;uniform vDiffuseInfos: vec2f;\n#endif\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\nfn random(scale: vec3f,seed: f32)->f32 {return fract(sin(dot(fragmentInputs.position.xyz+seed,scale))*43758.5453+seed);}\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvar viewDirectionW: vec3f=normalize(uniforms.vEyePosition.xyz-fragmentInputs.vPositionW);var baseColor: vec4f= vec4f(1.,1.,1.,1.);var diffuseColor: vec3f=uniforms.vDiffuseColor.rgb;var alpha: f32=uniforms.vDiffuseColor.a;\n#ifdef DIFFUSE\nvar noiseTex: vec4f=textureSample(noiseTexture,noiseTextureSampler,fragmentInputs.vDiffuseUV);var T1: vec2f=fragmentInputs.vDiffuseUV+ vec2f(1.5,-1.5)*uniforms.time*0.02;var T2: vec2f=fragmentInputs.vDiffuseUV+ vec2f(-0.5,2.0)*uniforms.time*0.01*uniforms.speed;T1=vec2f(T1.x+noiseTex.x*2.0,T1.y+noiseTex.y*2.0);T2=vec2f(T2.x-noiseTex.y*0.2-uniforms.time*0.001*uniforms.movingSpeed,T2.y+noiseTex.z*0.2+uniforms.time*0.002*uniforms.movingSpeed);var p: f32=textureSample(noiseTexture,noiseTextureSampler,T1*3.0).a;var lavaColor: vec4f=textureSample(diffuseSampler,diffuseSamplerSampler,T2*4.0);var temp: vec4f=lavaColor*( vec4f(p,p,p,p)*2.)+(lavaColor*lavaColor-0.1);baseColor=temp;var depth: f32=fragmentInputs.position.z*4.0;let LOG2: f32=1.442695;var fogFactor: f32=exp2(-uniforms.fogDensity*uniforms.fogDensity*depth*depth*LOG2);fogFactor=1.0-clamp(fogFactor,0.0,1.0);baseColor=mix(baseColor, vec4f(uniforms.fogColor,baseColor.w), vec4f(fogFactor));diffuseColor=baseColor.rgb;\n#ifdef ALPHATEST\nif (baseColor.a<0.4) {discard;}\n#endif\n#include<depthPrePass>\nbaseColor=vec4f(baseColor.rgb*uniforms.vDiffuseInfos.y,baseColor.a);\n#endif\n#ifdef VERTEXCOLOR\nbaseColor=vec4f(baseColor.rgb*fragmentInputs.vColor.rgb,baseColor.a);\n#endif\n#ifdef NORMAL\nvar normalW: vec3f=normalize(fragmentInputs.vNormalW);\n#else\nvar normalW: vec3f= vec3f(1.0,1.0,1.0);\n#endif\n#ifdef UNLIT\nvar diffuseBase: vec3f= vec3f(1.,1.,1.);\n#else\nvar diffuseBase: vec3f= vec3f(0.,0.,0.);var info: lightingInfo;var shadow: f32=1.;var glossiness: f32=0.;var aggShadow: f32=0.;var numLights: f32=0.;\n#include<lightFragment>[0]\n#include<lightFragment>[1]\n#include<lightFragment>[2]\n#include<lightFragment>[3]\n#endif\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=fragmentInputs.vColor.a;\n#endif\nvar finalDiffuse: vec3f=clamp(diffuseBase*diffuseColor,vec3f(0.0),vec3f(1.0))*baseColor.rgb;var color: vec4f= vec4f(finalDiffuse,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\nfragmentOutputs.color=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[ei]||(i.ShaderStore.ShadersStoreWGSL[ei]=ii);var ni={__proto__:null,lavaPixelShaderWGSL:{name:ei,shader:ii}},ti="lavaVertexShader",ri="precision highp float;uniform float time;uniform float lowFrequencySpeed;varying float noise;attribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform mat4 view;uniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;uniform mat4 diffuseMatrix;uniform vec2 vDiffuseInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n/* NOISE FUNCTIONS */\nvec3 mod289(vec3 x)\n{return x-floor(x*(1.0/289.0))*289.0;}\nvec4 mod289(vec4 x)\n{return x-floor(x*(1.0/289.0))*289.0;}\nvec4 permute(vec4 x)\n{return mod289(((x*34.0)+1.0)*x);}\nvec4 taylorInvSqrt(vec4 r)\n{return 1.79284291400159-0.85373472095314*r;}\nvec3 fade(vec3 t) {return t*t*t*(t*(t*6.0-15.0)+10.0);}\nfloat pnoise(vec3 P,vec3 rep)\n{vec3 Pi0=mod(floor(P),rep); \nvec3 Pi1=mod(Pi0+vec3(1.0),rep); \nPi0=mod289(Pi0);Pi1=mod289(Pi1);vec3 Pf0=fract(P); \nvec3 Pf1=Pf0-vec3(1.0); \nvec4 ix=vec4(Pi0.x,Pi1.x,Pi0.x,Pi1.x);vec4 iy=vec4(Pi0.yy,Pi1.yy);vec4 iz0=Pi0.zzzz;vec4 iz1=Pi1.zzzz;vec4 ixy=permute(permute(ix)+iy);vec4 ixy0=permute(ixy+iz0);vec4 ixy1=permute(ixy+iz1);vec4 gx0=ixy0*(1.0/7.0);vec4 gy0=fract(floor(gx0)*(1.0/7.0))-0.5;gx0=fract(gx0);vec4 gz0=vec4(0.5)-abs(gx0)-abs(gy0);vec4 sz0=step(gz0,vec4(0.0));gx0-=sz0*(step(0.0,gx0)-0.5);gy0-=sz0*(step(0.0,gy0)-0.5);vec4 gx1=ixy1*(1.0/7.0);vec4 gy1=fract(floor(gx1)*(1.0/7.0))-0.5;gx1=fract(gx1);vec4 gz1=vec4(0.5)-abs(gx1)-abs(gy1);vec4 sz1=step(gz1,vec4(0.0));gx1-=sz1*(step(0.0,gx1)-0.5);gy1-=sz1*(step(0.0,gy1)-0.5);vec3 g000=vec3(gx0.x,gy0.x,gz0.x);vec3 g100=vec3(gx0.y,gy0.y,gz0.y);vec3 g010=vec3(gx0.z,gy0.z,gz0.z);vec3 g110=vec3(gx0.w,gy0.w,gz0.w);vec3 g001=vec3(gx1.x,gy1.x,gz1.x);vec3 g101=vec3(gx1.y,gy1.y,gz1.y);vec3 g011=vec3(gx1.z,gy1.z,gz1.z);vec3 g111=vec3(gx1.w,gy1.w,gz1.w);vec4 norm0=taylorInvSqrt(vec4(dot(g000,g000),dot(g010,g010),dot(g100,g100),dot(g110,g110)));g000*=norm0.x;g010*=norm0.y;g100*=norm0.z;g110*=norm0.w;vec4 norm1=taylorInvSqrt(vec4(dot(g001,g001),dot(g011,g011),dot(g101,g101),dot(g111,g111)));g001*=norm1.x;g011*=norm1.y;g101*=norm1.z;g111*=norm1.w;float n000=dot(g000,Pf0);float n100=dot(g100,vec3(Pf1.x,Pf0.yz));float n010=dot(g010,vec3(Pf0.x,Pf1.y,Pf0.z));float n110=dot(g110,vec3(Pf1.xy,Pf0.z));float n001=dot(g001,vec3(Pf0.xy,Pf1.z));float n101=dot(g101,vec3(Pf1.x,Pf0.y,Pf1.z));float n011=dot(g011,vec3(Pf0.x,Pf1.yz));float n111=dot(g111,Pf1);vec3 fade_xyz=fade(Pf0);vec4 n_z=mix(vec4(n000,n100,n010,n110),vec4(n001,n101,n011,n111),fade_xyz.z);vec2 n_yz=mix(n_z.xy,n_z.zw,fade_xyz.y);float n_xyz=mix(n_yz.x,n_yz.y,fade_xyz.x);return 2.2*n_xyz;}\n/* END FUNCTION */\nfloat turbulence( vec3 p ) {float w=100.0;float t=-.5;for (float f=1.0 ; f<=10.0 ; f++ ){float power=pow( 2.0,f );t+=abs( pnoise( vec3( power*p ),vec3( 10.0,10.0,10.0 ) )/power );}\nreturn t;}\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef VERTEXCOLOR\nvec4 colorUpdated=color;\n#endif\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\n#ifdef NORMAL\nnoise=10.0* -.10*turbulence( .5*normal+time*1.15 );float b=lowFrequencySpeed*5.0*pnoise( 0.05*position +vec3(time*1.025),vec3( 100.0 ) );float displacement=- 1.5*noise+b;vec3 newPosition=position+normal*displacement;gl_Position=viewProjection*finalWorld*vec4( newPosition,1.0 );vec4 worldPos=finalWorld*vec4(newPosition,1.0);vPositionW=vec3(worldPos);vNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x==0.)\n{vDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));}\nelse\n{vDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));}\n#endif\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#include<logDepthVertex>\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}";i.ShaderStore.ShadersStore[ti]||(i.ShaderStore.ShadersStore[ti]=ri);var oi={__proto__:null,lavaVertexShader:{name:ti,shader:ri}},ai="lavaPixelShader",si="precision highp float;uniform vec4 vEyePosition;uniform vec4 vDiffuseColor;varying vec3 vPositionW;uniform float time;uniform float speed;uniform float movingSpeed;uniform vec3 fogColor;uniform sampler2D noiseTexture;uniform float fogDensity;varying float noise;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<helperFunctions>\n#include<__decl__lightFragment>[0]\n#include<__decl__lightFragment>[1]\n#include<__decl__lightFragment>[2]\n#include<__decl__lightFragment>[3]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;uniform sampler2D diffuseSampler;uniform vec2 vDiffuseInfos;\n#endif\n#include<clipPlaneFragmentDeclaration>\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\nfloat random( vec3 scale,float seed ){return fract( sin( dot( gl_FragCoord.xyz+seed,scale ) )*43758.5453+seed ) ;}\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);vec4 baseColor=vec4(1.,1.,1.,1.);vec3 diffuseColor=vDiffuseColor.rgb;float alpha=vDiffuseColor.a;\n#ifdef DIFFUSE\nvec4 noiseTex=texture2D( noiseTexture,vDiffuseUV );vec2 T1=vDiffuseUV+vec2( 1.5,-1.5 )*time *0.02;vec2 T2=vDiffuseUV+vec2( -0.5,2.0 )*time*0.01*speed;T1.x+=noiseTex.x*2.0;T1.y+=noiseTex.y*2.0;T2.x-=noiseTex.y*0.2+time*0.001*movingSpeed;T2.y+=noiseTex.z*0.2+time*0.002*movingSpeed;float p=texture2D( noiseTexture,T1*3.0 ).a;vec4 lavaColor=texture2D( diffuseSampler,T2*4.0);vec4 temp=lavaColor*( vec4( p,p,p,p )*2. )+( lavaColor*lavaColor-0.1 );baseColor=temp;float depth=gl_FragCoord.z*4.0;const float LOG2=1.442695;float fogFactor=exp2(-fogDensity*fogDensity*depth*depth*LOG2 );fogFactor=1.0-clamp( fogFactor,0.0,1.0 );baseColor=mix( baseColor,vec4( fogColor,baseColor.w ),fogFactor );diffuseColor=baseColor.rgb;\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include<depthPrePass>\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#ifdef UNLIT\nvec3 diffuseBase=vec3(1.,1.,1.);\n#else\nvec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;float shadow=1.;float glossiness=0.;float aggShadow=0.;float numLights=0.;\n#include<lightFragment>[0]\n#include<lightFragment>[1]\n#include<lightFragment>[2]\n#include<lightFragment>[3]\n#endif\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;vec4 color=vec4(finalDiffuse,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}";i.ShaderStore.ShadersStore[ai]||(i.ShaderStore.ShadersStore[ai]=si);var fi={__proto__:null,lavaPixelShader:{name:ai,shader:si}},li="mixVertexShader",ui="attribute position: vec3f;\n#ifdef NORMAL\nattribute normal: vec3f;\n#endif\n#ifdef UV1\nattribute uv: vec2f;\n#endif\n#ifdef UV2\nattribute uv2: vec2f;\n#endif\n#ifdef VERTEXCOLOR\nattribute color: vec4f;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform view: mat4x4f;uniform viewProjection: mat4x4f;\n#ifdef DIFFUSE\nvarying vTextureUV: vec2f;uniform textureMatrix: mat4x4f;uniform vTextureInfos: vec2f;\n#endif\n#ifdef POINTSIZE\nuniform pointSize: f32;\n#endif\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef VERTEXCOLOR\nvar colorUpdated: vec4f=vertexInputs.color;\n#endif\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvar worldPos: vec4f=finalWorld* vec4f(vertexInputs.position,1.0);vertexOutputs.position=uniforms.viewProjection*worldPos;vertexOutputs.vPositionW= worldPos.xyz;\n#ifdef NORMAL\nvertexOutputs.vNormalW=normalize(( finalWorld* vec4f(vertexInputs.normal,0.0)).xyz);\n#endif\n#ifndef UV1\nvar uv: vec2f= vec2f(0.,0.);\n#else\nvar uv: vec2f=vertexInputs.uv;\n#endif\n#ifndef UV2\nvar uv2: vec2f= vec2f(0.,0.);\n#else\nvar uv2: vec2f=vertexInputs.uv2;\n#endif\n#ifdef DIFFUSE\nif (uniforms.vTextureInfos.x==0.)\n{vertexOutputs.vTextureUV=(uniforms.textureMatrix* vec4f(uv,1.0,0.0)).xy;}\nelse\n{vertexOutputs.vTextureUV=(uniforms.textureMatrix* vec4f(uv2,1.0,0.0)).xy;}\n#endif\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#include<logDepthVertex>\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[li]||(i.ShaderStore.ShadersStoreWGSL[li]=ui);var di={__proto__:null,mixVertexShaderWGSL:{name:li,shader:ui}},ci="mixPixelShader",vi="uniform vEyePosition: vec4f;uniform vDiffuseColor: vec4f;\n#ifdef SPECULARTERM\nuniform vSpecularColor: vec4f;\n#endif\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<helperFunctions>\n#include<lightUboDeclaration>[0..maxSimultaneousLights]\n#ifdef DIFFUSE\nvarying vTextureUV: vec2f;var mixMap1SamplerSampler: sampler;var mixMap1Sampler: texture_2d<f32>;uniform vTextureInfos: vec2f;\n#ifdef MIXMAP2\nvar mixMap2SamplerSampler: sampler;var mixMap2Sampler: texture_2d<f32>;\n#endif\nvar diffuse1SamplerSampler: sampler;var diffuse1Sampler: texture_2d<f32>;var diffuse2SamplerSampler: sampler;var diffuse2Sampler: texture_2d<f32>;var diffuse3SamplerSampler: sampler;var diffuse3Sampler: texture_2d<f32>;var diffuse4SamplerSampler: sampler;var diffuse4Sampler: texture_2d<f32>;uniform diffuse1Infos: vec2f;uniform diffuse2Infos: vec2f;uniform diffuse3Infos: vec2f;uniform diffuse4Infos: vec2f;\n#ifdef MIXMAP2\nvar diffuse5SamplerSampler: sampler;var diffuse5Sampler: texture_2d<f32>;var diffuse6SamplerSampler: sampler;var diffuse6Sampler: texture_2d<f32>;var diffuse7SamplerSampler: sampler;var diffuse7Sampler: texture_2d<f32>;var diffuse8SamplerSampler: sampler;var diffuse8Sampler: texture_2d<f32>;uniform diffuse5Infos: vec2f;uniform diffuse6Infos: vec2f;uniform diffuse7Infos: vec2f;uniform diffuse8Infos: vec2f;\n#endif\n#endif\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvar viewDirectionW: vec3f=normalize(uniforms.vEyePosition.xyz-fragmentInputs.vPositionW);var finalMixColor: vec4f= vec4f(1.,1.,1.,1.);var diffuseColor: vec3f=uniforms.vDiffuseColor.rgb;\n#ifdef MIXMAP2\nvar mixColor2: vec4f= vec4f(1.,1.,1.,1.);\n#endif\n#ifdef SPECULARTERM\nvar glossiness: f32=uniforms.vSpecularColor.a;var specularColor: vec3f=uniforms.vSpecularColor.rgb;\n#else\nvar glossiness: f32=0.;\n#endif\nvar alpha: f32=uniforms.vDiffuseColor.a;\n#ifdef NORMAL\nvar normalW: vec3f=normalize(fragmentInputs.vNormalW);\n#else\nvar normalW: vec3f= vec3f(1.0,1.0,1.0);\n#endif\n#ifdef DIFFUSE\nvar mixColor: vec4f=textureSample(mixMap1Sampler,mixMap1SamplerSampler,fragmentInputs.vTextureUV);\n#include<depthPrePass>\nmixColor=vec4f(mixColor.rgb*uniforms.vTextureInfos.y,mixColor.a);var diffuse1Color: vec4f=textureSample(diffuse1Sampler,diffuse1SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse1Infos);var diffuse2Color: vec4f=textureSample(diffuse2Sampler,diffuse2SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse2Infos);var diffuse3Color: vec4f=textureSample(diffuse3Sampler,diffuse3SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse3Infos);var diffuse4Color: vec4f=textureSample(diffuse4Sampler,diffuse4SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse4Infos);diffuse1Color=vec4f(diffuse1Color.rgb*mixColor.r,diffuse1Color.a);diffuse2Color=vec4f(mix(diffuse1Color.rgb,diffuse2Color.rgb,vec3f(mixColor.g)),diffuse2Color.a);diffuse3Color=vec4f(mix(diffuse2Color.rgb,diffuse3Color.rgb,vec3f(mixColor.b)),diffuse3Color.a);finalMixColor=vec4f(mix(diffuse3Color.rgb,diffuse4Color.rgb,vec3f(1.0-mixColor.a)),finalMixColor.a);\n#ifdef MIXMAP2\nmixColor=textureSample(mixMap2Sampler,mixMap2SamplerSampler,fragmentInputs.vTextureUV);mixColor=vec4f(mixColor.rgb*uniforms.vTextureInfos.y,mixColor.a);var diffuse5Color: vec4f=textureSample(diffuse5Sampler,diffuse5SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse5Infos);var diffuse6Color: vec4f=textureSample(diffuse6Sampler,diffuse6SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse6Infos);var diffuse7Color: vec4f=textureSample(diffuse7Sampler,diffuse7SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse7Infos);var diffuse8Color: vec4f=textureSample(diffuse8Sampler,diffuse8SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse8Infos);diffuse5Color=vec4f(mix(finalMixColor.rgb,diffuse5Color.rgb,vec3f(mixColor.r)),diffuse5Color.a);diffuse6Color=vec4f(mix(diffuse5Color.rgb,diffuse6Color.rgb,vec3f(mixColor.g)),diffuse6Color.a);diffuse7Color=vec4f(mix(diffuse6Color.rgb,diffuse7Color.rgb,vec3f(mixColor.b)),diffuse7Color.a);finalMixColor=vec4f(mix(diffuse7Color.rgb,diffuse8Color.rgb,vec3f(1.0-mixColor.a)),finalMixColor.a);\n#endif\n#endif\n#ifdef VERTEXCOLOR\nfinalMixColor=vec4f(finalMixColor.rgb*fragmentInputs.vColor.rgb,finalMixColor.a);\n#endif\nvar diffuseBase: vec3f= vec3f(0.,0.,0.);var info: lightingInfo;var shadow: f32=1.;var aggShadow: f32=0.;var numLights: f32=0.;\n#ifdef SPECULARTERM\nvar specularBase: vec3f= vec3f(0.,0.,0.);\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=fragmentInputs.vColor.a;\n#endif\n#ifdef SPECULARTERM\nvar finalSpecular: vec3f=specularBase*specularColor;\n#else\nvar finalSpecular: vec3f= vec3f(0.0);\n#endif\nvar finalDiffuse: vec3f=clamp(diffuseBase*diffuseColor*finalMixColor.rgb,vec3f(0.0),vec3f(1.0));var color: vec4f= vec4f(finalDiffuse+finalSpecular,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\nfragmentOutputs.color=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[ci]||(i.ShaderStore.ShadersStoreWGSL[ci]=vi);var mi={__proto__:null,mixPixelShaderWGSL:{name:ci,shader:vi}},pi="mixVertexShader",hi="precision highp float;attribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform mat4 view;uniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vTextureUV;uniform mat4 textureMatrix;uniform vec2 vTextureInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef VERTEXCOLOR\nvec4 colorUpdated=color;\n#endif\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);gl_Position=viewProjection*worldPos;vPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vTextureInfos.x==0.)\n{vTextureUV=vec2(textureMatrix*vec4(uv,1.0,0.0));}\nelse\n{vTextureUV=vec2(textureMatrix*vec4(uv2,1.0,0.0));}\n#endif\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#include<logDepthVertex>\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStore[pi]||(i.ShaderStore.ShadersStore[pi]=hi);var gi={__proto__:null,mixVertexShader:{name:pi,shader:hi}},Si="mixPixelShader",xi="precision highp float;uniform vec4 vEyePosition;uniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<helperFunctions>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#ifdef DIFFUSE\nvarying vec2 vTextureUV;uniform sampler2D mixMap1Sampler;uniform vec2 vTextureInfos;\n#ifdef MIXMAP2\nuniform sampler2D mixMap2Sampler;\n#endif\nuniform sampler2D diffuse1Sampler;uniform sampler2D diffuse2Sampler;uniform sampler2D diffuse3Sampler;uniform sampler2D diffuse4Sampler;uniform vec2 diffuse1Infos;uniform vec2 diffuse2Infos;uniform vec2 diffuse3Infos;uniform vec2 diffuse4Infos;\n#ifdef MIXMAP2\nuniform sampler2D diffuse5Sampler;uniform sampler2D diffuse6Sampler;uniform sampler2D diffuse7Sampler;uniform sampler2D diffuse8Sampler;uniform vec2 diffuse5Infos;uniform vec2 diffuse6Infos;uniform vec2 diffuse7Infos;uniform vec2 diffuse8Infos;\n#endif\n#endif\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);vec4 finalMixColor=vec4(1.,1.,1.,1.);vec3 diffuseColor=vDiffuseColor.rgb;\n#ifdef MIXMAP2\nvec4 mixColor2=vec4(1.,1.,1.,1.);\n#endif\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;vec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\nfloat alpha=vDiffuseColor.a;\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#ifdef DIFFUSE\nvec4 mixColor=texture2D(mixMap1Sampler,vTextureUV);\n#include<depthPrePass>\nmixColor.rgb*=vTextureInfos.y;vec4 diffuse1Color=texture2D(diffuse1Sampler,vTextureUV*diffuse1Infos);vec4 diffuse2Color=texture2D(diffuse2Sampler,vTextureUV*diffuse2Infos);vec4 diffuse3Color=texture2D(diffuse3Sampler,vTextureUV*diffuse3Infos);vec4 diffuse4Color=texture2D(diffuse4Sampler,vTextureUV*diffuse4Infos);diffuse1Color.rgb*=mixColor.r;diffuse2Color.rgb=mix(diffuse1Color.rgb,diffuse2Color.rgb,mixColor.g);diffuse3Color.rgb=mix(diffuse2Color.rgb,diffuse3Color.rgb,mixColor.b);finalMixColor.rgb=mix(diffuse3Color.rgb,diffuse4Color.rgb,1.0-mixColor.a);\n#ifdef MIXMAP2\nmixColor=texture2D(mixMap2Sampler,vTextureUV);mixColor.rgb*=vTextureInfos.y;vec4 diffuse5Color=texture2D(diffuse5Sampler,vTextureUV*diffuse5Infos);vec4 diffuse6Color=texture2D(diffuse6Sampler,vTextureUV*diffuse6Infos);vec4 diffuse7Color=texture2D(diffuse7Sampler,vTextureUV*diffuse7Infos);vec4 diffuse8Color=texture2D(diffuse8Sampler,vTextureUV*diffuse8Infos);diffuse5Color.rgb=mix(finalMixColor.rgb,diffuse5Color.rgb,mixColor.r);diffuse6Color.rgb=mix(diffuse5Color.rgb,diffuse6Color.rgb,mixColor.g);diffuse7Color.rgb=mix(diffuse6Color.rgb,diffuse7Color.rgb,mixColor.b);finalMixColor.rgb=mix(diffuse7Color.rgb,diffuse8Color.rgb,1.0-mixColor.a);\n#endif\n#endif\n#ifdef VERTEXCOLOR\nfinalMixColor.rgb*=vColor.rgb;\n#endif\nvec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;float shadow=1.;float aggShadow=0.;float numLights=0.;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor*finalMixColor.rgb,0.0,1.0);vec4 color=vec4(finalDiffuse+finalSpecular,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStore[Si]||(i.ShaderStore.ShadersStore[Si]=xi);var Ti={__proto__:null,mixPixelShader:{name:Si,shader:xi}},_i="normalVertexShader",Ci="attribute position: vec3f;\n#ifdef NORMAL\nattribute normal: vec3f;\n#endif\n#ifdef UV1\nattribute uv: vec2f;\n#endif\n#ifdef UV2\nattribute uv2: vec2f;\n#endif\n#ifdef VERTEXCOLOR\nattribute color: vec4f;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform view: mat4x4f;uniform viewProjection: mat4x4f;\n#ifdef DIFFUSE\nvarying vDiffuseUV: vec2f;uniform diffuseMatrix: mat4x4f;uniform vDiffuseInfos: vec2f;\n#endif\n#ifdef POINTSIZE\nuniform pointSize: f32;\n#endif\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvar worldPos: vec4f=finalWorld* vec4f(vertexInputs.position,1.0);vertexOutputs.position=uniforms.viewProjection*worldPos;vertexOutputs.vPositionW= worldPos.xyz;\n#ifdef NORMAL\nvertexOutputs.vNormalW=normalize(( finalWorld* vec4f(vertexInputs.normal,0.0)).xyz);\n#endif\n#ifndef UV1\nvar uv: vec2f= vec2f(0.,0.);\n#else\nvar uv: vec2f=vertexInputs.uv;\n#endif\n#ifndef UV2\nvar uv2: vec2f= vec2f(0.,0.);\n#else\nvar uv2: vec2f=vertexInputs.uv2;\n#endif\n#ifdef DIFFUSE\nif (uniforms.vDiffuseInfos.x==0.)\n{vertexOutputs.vDiffuseUV=(uniforms.diffuseMatrix* vec4f(uv,1.0,0.0)).xy;}\nelse\n{vertexOutputs.vDiffuseUV=(uniforms.diffuseMatrix* vec4f(uv2,1.0,0.0)).xy;}\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[_i]||(i.ShaderStore.ShadersStoreWGSL[_i]=Ci);var Ei={__proto__:null,normalVertexShaderWGSL:{name:_i,shader:Ci}},Pi="normalPixelShader",Ii="uniform vEyePosition: vec4f;uniform vDiffuseColor: vec4f;varying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#ifdef LIGHTING\n#include<helperFunctions>\n#include<lightUboDeclaration>[0]\n#include<lightUboDeclaration>[1]\n#include<lightUboDeclaration>[2]\n#include<lightUboDeclaration>[3]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#endif\n#ifdef DIFFUSE\nvarying vDiffuseUV: vec2f;var diffuseSamplerSampler: sampler;var diffuseSampler: texture_2d<f32>;uniform vDiffuseInfos: vec2f;\n#endif\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvar viewDirectionW: vec3f=normalize(uniforms.vEyePosition.xyz-fragmentInputs.vPositionW);var baseColor: vec4f= vec4f(1.,1.,1.,1.);var diffuseColor: vec3f=uniforms.vDiffuseColor.rgb;var alpha: f32=uniforms.vDiffuseColor.a;\n#ifdef DIFFUSE\nbaseColor=textureSample(diffuseSampler,diffuseSamplerSampler,fragmentInputs.vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4) {discard;}\n#endif\n#include<depthPrePass>\nbaseColor=vec4f(baseColor.rgb*uniforms.vDiffuseInfos.y,baseColor.a);\n#endif\n#ifdef NORMAL\nbaseColor=mix(baseColor, vec4f(fragmentInputs.vNormalW,1.0),0.5);\n#endif\n#ifdef NORMAL\nvar normalW: vec3f=normalize(fragmentInputs.vNormalW);\n#else\nvar normalW: vec3f= vec3f(1.0,1.0,1.0);\n#endif\n#ifdef LIGHTING\nvar diffuseBase: vec3f= vec3f(0.,0.,0.);var info: lightingInfo;var shadow: f32=1.;var glossiness: f32=0.;var aggShadow: f32=0.;var numLights: f32=0.;\n#include<lightFragment>[0]\n#include<lightFragment>[1]\n#include<lightFragment>[2]\n#include<lightFragment>[3]\nvar finalDiffuse: vec3f=clamp(diffuseBase*diffuseColor,vec3f(0.0),vec3f(1.0))*baseColor.rgb;\n#else\nvar finalDiffuse: vec3f= baseColor.rgb;\n#endif\nvar color: vec4f= vec4f(finalDiffuse,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\nfragmentOutputs.color=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[Pi]||(i.ShaderStore.ShadersStoreWGSL[Pi]=Ii);var yi={__proto__:null,normalPixelShaderWGSL:{name:Pi,shader:Ii}},Li="normalVertexShader",Ai="precision highp float;attribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform mat4 view;uniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;uniform mat4 diffuseMatrix;uniform vec2 vDiffuseInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);gl_Position=viewProjection*worldPos;vPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x==0.)\n{vDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));}\nelse\n{vDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));}\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStore[Li]||(i.ShaderStore.ShadersStore[Li]=Ai);var Oi={__proto__:null,normalVertexShader:{name:Li,shader:Ai}},Di="normalPixelShader",Ni="precision highp float;uniform vec4 vEyePosition;uniform vec4 vDiffuseColor;varying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef LIGHTING\n#include<helperFunctions>\n#include<__decl__lightFragment>[0]\n#include<__decl__lightFragment>[1]\n#include<__decl__lightFragment>[2]\n#include<__decl__lightFragment>[3]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#endif\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;uniform sampler2D diffuseSampler;uniform vec2 vDiffuseInfos;\n#endif\n#include<clipPlaneFragmentDeclaration>\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);vec4 baseColor=vec4(1.,1.,1.,1.);vec3 diffuseColor=vDiffuseColor.rgb;float alpha=vDiffuseColor.a;\n#ifdef DIFFUSE\nbaseColor=texture2D(diffuseSampler,vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include<depthPrePass>\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef NORMAL\nbaseColor=mix(baseColor,vec4(vNormalW,1.0),0.5);\n#endif\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#ifdef LIGHTING\nvec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;float shadow=1.;float glossiness=0.;float aggShadow=0.;float numLights=0.;\n#include<lightFragment>[0]\n#include<lightFragment>[1]\n#include<lightFragment>[2]\n#include<lightFragment>[3]\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;\n#else\nvec3 finalDiffuse= baseColor.rgb;\n#endif\nvec4 color=vec4(finalDiffuse,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}";i.ShaderStore.ShadersStore[Di]||(i.ShaderStore.ShadersStore[Di]=Ni);var bi={__proto__:null,normalPixelShader:{name:Di,shader:Ni}},Fi="shadowOnlyVertexShader",Mi="attribute position: vec3f;\n#ifdef NORMAL\nattribute normal: vec3f;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\n#include<sceneUboDeclaration>\n#ifdef POINTSIZE\nuniform pointSize: f32;\n#endif\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvar worldPos: vec4f=finalWorld* vec4f(vertexInputs.position,1.0);vertexOutputs.position=scene.viewProjection*worldPos;vertexOutputs.vPositionW= worldPos.xyz;\n#ifdef NORMAL\nvertexOutputs.vNormalW=normalize(( finalWorld* vec4f(vertexInputs.normal,0.0)).xyz);\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[Fi]||(i.ShaderStore.ShadersStoreWGSL[Fi]=Mi);var Ri={__proto__:null,shadowOnlyVertexShaderWGSL:{name:Fi,shader:Mi}},Vi="shadowOnlyPixelShader",Ui="#include<sceneUboDeclaration>\nuniform alpha: f32;uniform shadowColor: vec3f;varying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#include<helperFunctions>\n#include<lightUboDeclaration>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvar viewDirectionW: vec3f=normalize(scene.vEyePosition.xyz-fragmentInputs.vPositionW);\n#ifdef NORMAL\nvar normalW: vec3f=normalize(fragmentInputs.vNormalW);\n#else\nvar normalW: vec3f= vec3f(1.0,1.0,1.0);\n#endif\nvar diffuseBase: vec3f= vec3f(0.,0.,0.);var info: lightingInfo;var shadow: f32=1.;var glossiness: f32=0.;var aggShadow: f32=0.;var numLights: f32=0.;\n#include<lightFragment>[0..1]\nvar color: vec4f= vec4f(uniforms.shadowColor,(1.0-clamp(shadow,0.,1.))*uniforms.alpha);\n#include<logDepthFragment>\n#include<fogFragment>\nfragmentOutputs.color=color;\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[Vi]||(i.ShaderStore.ShadersStoreWGSL[Vi]=Ui);var wi={__proto__:null,shadowOnlyPixelShaderWGSL:{name:Vi,shader:Ui}},Bi="shadowOnlyVertexShader",zi="precision highp float;attribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\n#include<__decl__sceneVertex>\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);gl_Position=viewProjection*worldPos;vPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStore[Bi]||(i.ShaderStore.ShadersStore[Bi]=zi);var Gi={__proto__:null,shadowOnlyVertexShader:{name:Bi,shader:zi}},Hi="shadowOnlyPixelShader",Wi="precision highp float;\n#include<__decl__sceneFragment>\nuniform float alpha;uniform vec3 shadowColor;varying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#include<helperFunctions>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\nvec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;float shadow=1.;float glossiness=0.;float aggShadow=0.;float numLights=0.;\n#include<lightFragment>[0..1]\nvec4 color=vec4(shadowColor,(1.0-clamp(shadow,0.,1.))*alpha);\n#include<logDepthFragment>\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}";i.ShaderStore.ShadersStore[Hi]||(i.ShaderStore.ShadersStore[Hi]=Wi);var Xi={__proto__:null,shadowOnlyPixelShader:{name:Hi,shader:Wi}},ki="simpleVertexShader",ji="attribute position: vec3f;\n#ifdef NORMAL\nattribute normal: vec3f;\n#endif\n#ifdef UV1\nattribute uv: vec2f;\n#endif\n#ifdef UV2\nattribute uv2: vec2f;\n#endif\n#ifdef VERTEXCOLOR\nattribute color: vec4f;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform view: mat4x4f;uniform viewProjection: mat4x4f;\n#ifdef DIFFUSE\nvarying vDiffuseUV: vec2f;uniform diffuseMatrix: mat4x4f;uniform vDiffuseInfos: vec2f;\n#endif\n#ifdef POINTSIZE\nuniform pointSize: f32;\n#endif\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef VERTEXCOLOR\nvar colorUpdated: vec4f=vertexInputs.color;\n#endif\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvar worldPos: vec4f=finalWorld* vec4f(vertexInputs.position,1.0);vertexOutputs.position=uniforms.viewProjection*worldPos;vertexOutputs.vPositionW= worldPos.xyz;\n#ifdef NORMAL\nvertexOutputs.vNormalW=normalize(( finalWorld* vec4f(vertexInputs.normal,0.0)).xyz);\n#endif\n#ifndef UV1\nvar uv: vec2f= vec2f(0.,0.);\n#else\nvar uv: vec2f=vertexInputs.uv;\n#endif\n#ifndef UV2\nvar uv2: vec2f= vec2f(0.,0.);\n#else\nvar uv2: vec2f=vertexInputs.uv2;\n#endif\n#ifdef DIFFUSE\nif (uniforms.vDiffuseInfos.x==0.)\n{vertexOutputs.vDiffuseUV=(uniforms.diffuseMatrix* vec4f(uv,1.0,0.0)).xy;}\nelse\n{vertexOutputs.vDiffuseUV=(uniforms.diffuseMatrix* vec4f(uv2,1.0,0.0)).xy;}\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[ki]||(i.ShaderStore.ShadersStoreWGSL[ki]=ji);var Zi={__proto__:null,simpleVertexShaderWGSL:{name:ki,shader:ji}},Yi="simplePixelShader",Ki="uniform vEyePosition: vec4f;uniform vDiffuseColor: vec4f;varying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<helperFunctions>\n#include<lightUboDeclaration>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#ifdef DIFFUSE\nvarying vDiffuseUV: vec2f;var diffuseSamplerSampler: sampler;var diffuseSampler: texture_2d<f32>;uniform vDiffuseInfos: vec2f;\n#endif\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvar viewDirectionW: vec3f=normalize(uniforms.vEyePosition.xyz-fragmentInputs.vPositionW);var baseColor: vec4f= vec4f(1.,1.,1.,1.);var diffuseColor: vec3f=uniforms.vDiffuseColor.rgb;var alpha: f32=uniforms.vDiffuseColor.a;\n#ifdef DIFFUSE\nbaseColor=textureSample(diffuseSampler,diffuseSamplerSampler,fragmentInputs.vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4) {discard;}\n#endif\n#include<depthPrePass>\nbaseColor=vec4f(baseColor.rgb*uniforms.vDiffuseInfos.y,baseColor.a);\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nbaseColor=vec4f(baseColor.rgb*fragmentInputs.vColor.rgb,baseColor.a);\n#endif\n#ifdef NORMAL\nvar normalW: vec3f=normalize(fragmentInputs.vNormalW);\n#else\nvar normalW: vec3f= vec3f(1.0,1.0,1.0);\n#endif\nvar diffuseBase: vec3f= vec3f(0.,0.,0.);var info: lightingInfo;var shadow: f32=1.;var glossiness: f32=0.;var aggShadow: f32=0.;var numLights: f32=0.;\n#ifdef SPECULARTERM\nvar specularBase: vec3f= vec3f(0.,0.,0.);\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=fragmentInputs.vColor.a;\n#endif\nvar finalDiffuse: vec3f=clamp(diffuseBase*diffuseColor,vec3f(0.0),vec3f(1.0))*baseColor.rgb;var color: vec4f= vec4f(finalDiffuse,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\nfragmentOutputs.color=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[Yi]||(i.ShaderStore.ShadersStoreWGSL[Yi]=Ki);var qi={__proto__:null,simplePixelShaderWGSL:{name:Yi,shader:Ki}},Qi="simpleVertexShader",Ji="precision highp float;attribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform mat4 view;uniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;uniform mat4 diffuseMatrix;uniform vec2 vDiffuseInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef VERTEXCOLOR\nvec4 colorUpdated=color;\n#endif\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);gl_Position=viewProjection*worldPos;vPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x==0.)\n{vDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));}\nelse\n{vDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));}\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStore[Qi]||(i.ShaderStore.ShadersStore[Qi]=Ji);var $i={__proto__:null,simpleVertexShader:{name:Qi,shader:Ji}},en="simplePixelShader",nn="precision highp float;uniform vec4 vEyePosition;uniform vec4 vDiffuseColor;varying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#include<helperFunctions>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;uniform sampler2D diffuseSampler;uniform vec2 vDiffuseInfos;\n#endif\n#include<clipPlaneFragmentDeclaration>\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);vec4 baseColor=vec4(1.,1.,1.,1.);vec3 diffuseColor=vDiffuseColor.rgb;float alpha=vDiffuseColor.a;\n#ifdef DIFFUSE\nbaseColor=texture2D(diffuseSampler,vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include<depthPrePass>\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nbaseColor.rgb*=vColor.rgb;\n#endif\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\nvec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;float shadow=1.;float glossiness=0.;float aggShadow=0.;float numLights=0.;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif \n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;vec4 color=vec4(finalDiffuse,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}";i.ShaderStore.ShadersStore[en]||(i.ShaderStore.ShadersStore[en]=nn);var tn={__proto__:null,simplePixelShader:{name:en,shader:nn}},rn="skyVertexShader",on="attribute position: vec3f;\n#ifdef VERTEXCOLOR\nattribute color: vec4f;\n#endif\nuniform world: mat4x4f;uniform view: mat4x4f;uniform viewProjection: mat4x4f;\n#ifdef POINTSIZE\nuniform pointSize: f32;\n#endif\nvarying vPositionW: vec3f;\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<logDepthDeclaration>\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvertexOutputs.position=uniforms.viewProjection*uniforms.world* vec4f(vertexInputs.position,1.0);var worldPos: vec4f=uniforms.world* vec4f(vertexInputs.position,1.0);vertexOutputs.vPositionW= worldPos.xyz;\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#ifdef VERTEXCOLOR\nvertexOutputs.vColor=vertexInputs.color;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[rn]||(i.ShaderStore.ShadersStoreWGSL[rn]=on);var an={__proto__:null,skyVertexShaderWGSL:{name:rn,shader:on}},sn="skyPixelShader",fn="varying vPositionW: vec3f;\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<clipPlaneFragmentDeclaration>\nuniform cameraPosition: vec3f;uniform cameraOffset: vec3f;uniform up: vec3f;uniform luminance: f32;uniform turbidity: f32;uniform rayleigh: f32;uniform mieCoefficient: f32;uniform mieDirectionalG: f32;uniform sunPosition: vec3f;\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\nconst ce: f32=2.71828182845904523536028747135266249775724709369995957;const pi: f32=3.141592653589793238462643383279502884197169;const cn: f32=1.0003;const cN: f32=2.545E25;const pn: f32=0.035;const lambda: vec3f= vec3f(680E-9,550E-9,450E-9);const cK: vec3f= vec3f(0.686,0.678,0.666);const cv: f32=4.0;const rayleighZenithLength: f32=8.4E3;const mieZenithLength: f32=1.25E3;const EE: f32=1000.0;const sunAngularDiameterCos: f32=0.999956676946448443553574619906976478926848692873900859324;const cutoffAngle: f32=pi/1.95;const steepness: f32=1.5;fn totalRayleigh(lambdaIn: vec3f)->vec3f\n{return (8.0*pow(pi,3.0)*pow(pow(cn,2.0)-1.0,2.0)*(6.0+3.0*pn))/(3.0*cN*pow(lambdaIn, vec3f(4.0))*(6.0-7.0*pn));}\nfn simplifiedRayleigh()->vec3f\n{return vec3f(0.0005)/ vec3f(94,40,18);}\nfn rayleighPhase(cosTheta: f32)->f32\n{return (3.0/(16.0*pi))*(1.0+pow(cosTheta,2.0));}\nfn totalMie(lambdaIn: vec3f,KIn: vec3f,T: f32)->vec3f\n{var c: f32=(0.2*T)*10E-18;return 0.434*c*pi*pow((2.0*pi)/lambdaIn, vec3f(cv-2.0))*KIn;}\nfn hgPhase(cosTheta: f32,g: f32)->f32\n{return (1.0/(4.0*pi))*((1.0-pow(g,2.0))/pow(1.0-2.0*g*cosTheta+pow(g,2.0),1.5));}\nfn sunIntensity(zenithAngleCos: f32)->f32\n{return EE*max(0.0,1.0-exp((-(cutoffAngle-acos(zenithAngleCos))/steepness)));}\nconst A: f32=0.15;const B: f32=0.50;const C: f32=0.10;const D: f32=0.20;const EEE: f32=0.02;const F: f32=0.30;const W: f32=1000.0;fn Uncharted2Tonemap(x: vec3f)->vec3f\n{return ((x*(A*x+C*B)+D*EEE)/(x*(A*x+B)+D*F))-EEE/F;}\n#if DITHER\n#include<helperFunctions>\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\n/**\n* Sky Color\n*/\nvar sunfade: f32=1.0-clamp(1.0-exp((uniforms.sunPosition.y/450000.0)),0.0,1.0);var rayleighCoefficient: f32=uniforms.rayleigh-(1.0*(1.0-sunfade));var sunDirection: vec3f=normalize(uniforms.sunPosition);var sunE: f32=sunIntensity(dot(sunDirection,uniforms.up));var betaR: vec3f=simplifiedRayleigh()*rayleighCoefficient;var betaM: vec3f=totalMie(lambda,cK,uniforms.turbidity)*uniforms.mieCoefficient;var zenithAngle: f32=acos(max(0.0,dot(uniforms.up,normalize(fragmentInputs.vPositionW-uniforms.cameraPosition+uniforms.cameraOffset))));var sR: f32=rayleighZenithLength/(cos(zenithAngle)+0.15*pow(93.885-((zenithAngle*180.0)/pi),-1.253));var sM: f32=mieZenithLength/(cos(zenithAngle)+0.15*pow(93.885-((zenithAngle*180.0)/pi),-1.253));var Fex: vec3f=exp(-(betaR*sR+betaM*sM));var cosTheta: f32=dot(normalize(fragmentInputs.vPositionW-uniforms.cameraPosition),sunDirection);var rPhase: f32=rayleighPhase(cosTheta*0.5+0.5);var betaRTheta: vec3f=betaR*rPhase;var mPhase: f32=hgPhase(cosTheta,uniforms.mieDirectionalG);var betaMTheta: vec3f=betaM*mPhase;var Lin: vec3f=pow(sunE*((betaRTheta+betaMTheta)/(betaR+betaM))*(1.0-Fex), vec3f(1.5));Lin=Lin*mix( vec3f(1.0),pow(sunE*((betaRTheta+betaMTheta)/(betaR+betaM))*Fex, vec3f(1.0/2.0)), vec3f(clamp(pow(1.0-dot(uniforms.up,sunDirection),5.0),0.0,1.0)));var direction: vec3f=normalize(fragmentInputs.vPositionW-uniforms.cameraPosition);var theta: f32=acos(direction.y);var phi: f32=atan2(direction.z,direction.x);var uv: vec2f= vec2f(phi,theta)/ vec2f(2.0*pi,pi)+ vec2f(0.5,0.0);var L0: vec3f= vec3f(0.1)*Fex;var sundisk: f32=smoothstep(sunAngularDiameterCos,sunAngularDiameterCos+0.00002,cosTheta);L0=L0+(sunE*19000.0*Fex)*sundisk;var whiteScale: vec3f=1.0/Uncharted2Tonemap( vec3f(W));var texColor: vec3f=(Lin+L0);texColor=texColor*0.04;texColor=texColor+ vec3f(0.0,0.001,0.0025)*0.3;var g_fMaxLuminance: f32=1.0;var fLumScaled: f32=0.1/uniforms.luminance;var fLumCompressed: f32=(fLumScaled*(1.0+(fLumScaled/(g_fMaxLuminance*g_fMaxLuminance))))/(1.0+fLumScaled);var ExposureBias: f32=fLumCompressed;var curr: vec3f=Uncharted2Tonemap((log2(2.0/pow(uniforms.luminance,4.0)))*texColor);var retColor: vec3f=curr*whiteScale;var alpha: f32=1.0;\n#ifdef VERTEXCOLOR\nretColor=retColor.rgb*fragmentInputs.vColor.rgb;\n#endif\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=fragmentInputs.vColor.a;\n#endif\n#if DITHER\nretColor=retColor.rgb+dither(fragmentInputs.position.xy,0.5);\n#endif\nvar color: vec4f=clamp( vec4f(retColor.rgb,alpha), vec4f(0.0), vec4f(1.0));\n#include<logDepthFragment>\n#include<fogFragment>\nfragmentOutputs.color=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[sn]||(i.ShaderStore.ShadersStoreWGSL[sn]=fn);var ln={__proto__:null,skyPixelShaderWGSL:{name:sn,shader:fn}},un="skyVertexShader",dn="precision highp float;attribute vec3 position;\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\nuniform mat4 world;uniform mat4 view;uniform mat4 viewProjection;\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<logDepthDeclaration>\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\ngl_Position=viewProjection*world*vec4(position,1.0);vec4 worldPos=world*vec4(position,1.0);vPositionW=vec3(worldPos);\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStore[un]||(i.ShaderStore.ShadersStore[un]=dn);var cn={__proto__:null,skyVertexShader:{name:un,shader:dn}},vn="skyPixelShader",mn="precision highp float;varying vec3 vPositionW;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneFragmentDeclaration>\nuniform vec3 cameraPosition;uniform vec3 cameraOffset;uniform vec3 up;uniform float luminance;uniform float turbidity;uniform float rayleigh;uniform float mieCoefficient;uniform float mieDirectionalG;uniform vec3 sunPosition;\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\nconst float e=2.71828182845904523536028747135266249775724709369995957;const float pi=3.141592653589793238462643383279502884197169;const float n=1.0003;const float N=2.545E25;const float pn=0.035;const vec3 lambda=vec3(680E-9,550E-9,450E-9);const vec3 K=vec3(0.686,0.678,0.666);const float v=4.0;const float rayleighZenithLength=8.4E3;const float mieZenithLength=1.25E3;const float EE=1000.0;const float sunAngularDiameterCos=0.999956676946448443553574619906976478926848692873900859324;const float cutoffAngle=pi/1.95;const float steepness=1.5;vec3 totalRayleigh(vec3 lambda)\n{return (8.0*pow(pi,3.0)*pow(pow(n,2.0)-1.0,2.0)*(6.0+3.0*pn))/(3.0*N*pow(lambda,vec3(4.0))*(6.0-7.0*pn));}\nvec3 simplifiedRayleigh()\n{return 0.0005/vec3(94,40,18);}\nfloat rayleighPhase(float cosTheta)\n{ \nreturn (3.0/(16.0*pi))*(1.0+pow(cosTheta,2.0));}\nvec3 totalMie(vec3 lambda,vec3 K,float T)\n{float c=(0.2*T )*10E-18;return 0.434*c*pi*pow((2.0*pi)/lambda,vec3(v-2.0))*K;}\nfloat hgPhase(float cosTheta,float g)\n{return (1.0/(4.0*pi))*((1.0-pow(g,2.0))/pow(1.0-2.0*g*cosTheta+pow(g,2.0),1.5));}\nfloat sunIntensity(float zenithAngleCos)\n{return EE*max(0.0,1.0-exp((-(cutoffAngle-acos(zenithAngleCos))/steepness)));}\nfloat A=0.15;float B=0.50;float C=0.10;float D=0.20;float EEE=0.02;float F=0.30;float W=1000.0;vec3 Uncharted2Tonemap(vec3 x)\n{return ((x*(A*x+C*B)+D*EEE)/(x*(A*x+B)+D*F))-EEE/F;}\n#if DITHER\n#include<helperFunctions>\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\n/**\n*--------------------------------------------------------------------------------------------------\n* Sky Color\n*--------------------------------------------------------------------------------------------------\n*/\nfloat sunfade=1.0-clamp(1.0-exp((sunPosition.y/450000.0)),0.0,1.0);float rayleighCoefficient=rayleigh-(1.0*(1.0-sunfade));vec3 sunDirection=normalize(sunPosition);float sunE=sunIntensity(dot(sunDirection,up));vec3 betaR=simplifiedRayleigh()*rayleighCoefficient;vec3 betaM=totalMie(lambda,K,turbidity)*mieCoefficient;float zenithAngle=acos(max(0.0,dot(up,normalize(vPositionW-cameraPosition+cameraOffset))));float sR=rayleighZenithLength/(cos(zenithAngle)+0.15*pow(93.885-((zenithAngle*180.0)/pi),-1.253));float sM=mieZenithLength/(cos(zenithAngle)+0.15*pow(93.885-((zenithAngle*180.0)/pi),-1.253));vec3 Fex=exp(-(betaR*sR+betaM*sM));float cosTheta=dot(normalize(vPositionW-cameraPosition),sunDirection);float rPhase=rayleighPhase(cosTheta*0.5+0.5);vec3 betaRTheta=betaR*rPhase;float mPhase=hgPhase(cosTheta,mieDirectionalG);vec3 betaMTheta=betaM*mPhase;vec3 Lin=pow(sunE*((betaRTheta+betaMTheta)/(betaR+betaM))*(1.0-Fex),vec3(1.5));Lin*=mix(vec3(1.0),pow(sunE*((betaRTheta+betaMTheta)/(betaR+betaM))*Fex,vec3(1.0/2.0)),clamp(pow(1.0-dot(up,sunDirection),5.0),0.0,1.0));vec3 direction=normalize(vPositionW-cameraPosition);float theta=acos(direction.y);float phi=atan(direction.z,direction.x);vec2 uv=vec2(phi,theta)/vec2(2.0*pi,pi)+vec2(0.5,0.0);vec3 L0=vec3(0.1)*Fex;float sundisk=smoothstep(sunAngularDiameterCos,sunAngularDiameterCos+0.00002,cosTheta);L0+=(sunE*19000.0*Fex)*sundisk;vec3 whiteScale=1.0/Uncharted2Tonemap(vec3(W));vec3 texColor=(Lin+L0);texColor*=0.04 ;texColor+=vec3(0.0,0.001,0.0025)*0.3;float g_fMaxLuminance=1.0;float fLumScaled=0.1/luminance; \nfloat fLumCompressed=(fLumScaled*(1.0+(fLumScaled/(g_fMaxLuminance*g_fMaxLuminance))))/(1.0+fLumScaled); \nfloat ExposureBias=fLumCompressed;vec3 curr=Uncharted2Tonemap((log2(2.0/pow(luminance,4.0)))*texColor);vec3 retColor=curr*whiteScale;/**\n*--------------------------------------------------------------------------------------------------\n* Sky Color\n*--------------------------------------------------------------------------------------------------\n*/\nfloat alpha=1.0;\n#ifdef VERTEXCOLOR\nretColor.rgb*=vColor.rgb;\n#endif\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\n#if DITHER\nretColor.rgb+=dither(gl_FragCoord.xy,0.5);\n#endif\nvec4 color=clamp(vec4(retColor.rgb,alpha),0.0,1.0);\n#include<logDepthFragment>\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStore[vn]||(i.ShaderStore.ShadersStore[vn]=mn);var pn={__proto__:null,skyPixelShader:{name:vn,shader:mn}},hn="terrainVertexShader",gn="attribute position: vec3f;\n#ifdef NORMAL\nattribute normal: vec3f;\n#endif\n#ifdef UV1\nattribute uv: vec2f;\n#endif\n#ifdef UV2\nattribute uv2: vec2f;\n#endif\n#ifdef VERTEXCOLOR\nattribute color: vec4f;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform view: mat4x4f;uniform viewProjection: mat4x4f;\n#ifdef DIFFUSE\nvarying vTextureUV: vec2f;uniform textureMatrix: mat4x4f;uniform vTextureInfos: vec2f;\n#endif\n#ifdef POINTSIZE\nuniform pointSize: f32;\n#endif\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vColor: vec4f;\n#endif\n#include<logDepthDeclaration>\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef VERTEXCOLOR\nvar colorUpdated: vec4f=vertexInputs.color;\n#endif\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvar worldPos: vec4f=finalWorld* vec4f(vertexInputs.position,1.0);vertexOutputs.position=uniforms.viewProjection*worldPos;vertexOutputs.vPositionW= worldPos.xyz;\n#ifdef NORMAL\nvertexOutputs.vNormalW=normalize(( finalWorld* vec4f(vertexInputs.normal,0.0)).xyz);\n#endif\n#ifndef UV1\nvar uv: vec2f= vec2f(0.,0.);\n#else\nvar uv: vec2f=vertexInputs.uv;\n#endif\n#ifndef UV2\nvar uv2: vec2f= vec2f(0.,0.);\n#else\nvar uv2: vec2f=vertexInputs.uv2;\n#endif\n#ifdef DIFFUSE\nif (uniforms.vTextureInfos.x==0.)\n{vertexOutputs.vTextureUV=(uniforms.textureMatrix* vec4f(uv,1.0,0.0)).xy;}\nelse\n{vertexOutputs.vTextureUV=(uniforms.textureMatrix* vec4f(uv2,1.0,0.0)).xy;}\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[hn]||(i.ShaderStore.ShadersStoreWGSL[hn]=gn);var Sn={__proto__:null,terrainVertexShaderWGSL:{name:hn,shader:gn}},xn="terrainPixelShader",Tn="uniform vEyePosition: vec4f;uniform vDiffuseColor: vec4f;\n#ifdef SPECULARTERM\nuniform vSpecularColor: vec4f;\n#endif\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vColor: vec4f;\n#endif\n#include<helperFunctions>\n#include<lightUboDeclaration>[0..maxSimultaneousLights]\n#ifdef DIFFUSE\nvarying vTextureUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d<f32>;uniform vTextureInfos: vec2f;var diffuse1SamplerSampler: sampler;var diffuse1Sampler: texture_2d<f32>;var diffuse2SamplerSampler: sampler;var diffuse2Sampler: texture_2d<f32>;var diffuse3SamplerSampler: sampler;var diffuse3Sampler: texture_2d<f32>;uniform diffuse1Infos: vec2f;uniform diffuse2Infos: vec2f;uniform diffuse3Infos: vec2f;\n#endif\n#ifdef BUMP\nvar bump1SamplerSampler: sampler;var bump1Sampler: texture_2d<f32>;var bump2SamplerSampler: sampler;var bump2Sampler: texture_2d<f32>;var bump3SamplerSampler: sampler;var bump3Sampler: texture_2d<f32>;\n#endif\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#ifdef BUMP\nfn cotangent_frame(normal: vec3f,p: vec3f,uv: vec2f)->mat3x3f\n{var dp1: vec3f=dpdx(p);var dp2: vec3f=dpdy(p);var duv1: vec2f=dpdx(uv);var duv2: vec2f=dpdy(uv);var dp2perp: vec3f=cross(dp2,normal);var dp1perp: vec3f=cross(normal,dp1);var tangent: vec3f=dp2perp*duv1.x+dp1perp*duv2.x;var binormal: vec3f=dp2perp*duv1.y+dp1perp*duv2.y;var invmax: f32=inverseSqrt(max(dot(tangent,tangent),dot(binormal,binormal)));return mat3x3f(tangent*invmax,binormal*invmax,normal);}\nfn perturbNormal(viewDir: vec3f,mixColor: vec3f)->vec3f\n{var bump1Color: vec3f=textureSample(bump1Sampler,bump1SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse1Infos).xyz;var bump2Color: vec3f=textureSample(bump2Sampler,bump2SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse2Infos).xyz;var bump3Color: vec3f=textureSample(bump3Sampler,bump3SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse3Infos).xyz;bump1Color=bump1Color.rgb*mixColor.r;bump2Color=mix(bump1Color.rgb,bump2Color.rgb,vec3f(mixColor.g));var map: vec3f=mix(bump2Color.rgb,bump3Color.rgb,vec3f(mixColor.b));map=map*255./127.-128./127.;var TBN: mat3x3f=cotangent_frame(fragmentInputs.vNormalW*uniforms.vTextureInfos.y,-viewDir,fragmentInputs.vTextureUV);return normalize(TBN*map);}\n#endif\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvar viewDirectionW: vec3f=normalize(uniforms.vEyePosition.xyz-fragmentInputs.vPositionW);var baseColor: vec4f= vec4f(1.,1.,1.,1.);var diffuseColor: vec3f=uniforms.vDiffuseColor.rgb;\n#ifdef SPECULARTERM\nvar glossiness: f32=uniforms.vSpecularColor.a;var specularColor: vec3f=uniforms.vSpecularColor.rgb;\n#else\nvar glossiness: f32=0.;\n#endif\nvar alpha: f32=uniforms.vDiffuseColor.a;\n#ifdef NORMAL\nvar normalW: vec3f=normalize(fragmentInputs.vNormalW);\n#else\nvar normalW: vec3f= vec3f(1.0,1.0,1.0);\n#endif\n#ifdef DIFFUSE\nbaseColor=textureSample(textureSampler,textureSamplerSampler,fragmentInputs.vTextureUV);\n#if defined(BUMP) && defined(DIFFUSE)\nnormalW=perturbNormal(viewDirectionW,baseColor.rgb);\n#endif\n#ifdef ALPHATEST\nif (baseColor.a<0.4) {discard;}\n#endif\n#include<depthPrePass>\nbaseColor=vec4f(baseColor.rgb*uniforms.vTextureInfos.y,baseColor.a);var diffuse1Color: vec4f=textureSample(diffuse1Sampler,diffuse1SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse1Infos);var diffuse2Color: vec4f=textureSample(diffuse2Sampler,diffuse2SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse2Infos);var diffuse3Color: vec4f=textureSample(diffuse3Sampler,diffuse3SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse3Infos);diffuse1Color=vec4f(diffuse1Color.rgb*baseColor.r,diffuse1Color.a);diffuse2Color=vec4f(mix(diffuse1Color.rgb,diffuse2Color.rgb,vec3f(baseColor.g)),diffuse2Color.a);baseColor=vec4f(mix(diffuse2Color.rgb,diffuse3Color.rgb,vec3f(baseColor.b)),baseColor.a);\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nbaseColor=vec4f(baseColor.rgb*fragmentInputs.vColor.rgb,baseColor.a);\n#endif\nvar diffuseBase: vec3f= vec3f(0.,0.,0.);var info: lightingInfo;var shadow: f32=1.;var aggShadow: f32=0.;var numLights: f32=0.;\n#ifdef SPECULARTERM\nvar specularBase: vec3f= vec3f(0.,0.,0.);\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=fragmentInputs.vColor.a;\n#endif\n#ifdef SPECULARTERM\nvar finalSpecular: vec3f=specularBase*specularColor;\n#else\nvar finalSpecular: vec3f= vec3f(0.0);\n#endif\nvar finalDiffuse: vec3f=clamp(diffuseBase*diffuseColor*baseColor.rgb,vec3f(0.0),vec3f(1.0));var color: vec4f= vec4f(finalDiffuse+finalSpecular,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\nfragmentOutputs.color=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[xn]||(i.ShaderStore.ShadersStoreWGSL[xn]=Tn);var _n={__proto__:null,terrainPixelShaderWGSL:{name:xn,shader:Tn}},Cn="terrainVertexShader",En="precision highp float;attribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform mat4 view;uniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vTextureUV;uniform mat4 textureMatrix;uniform vec2 vTextureInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#include<logDepthDeclaration>\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef VERTEXCOLOR\nvec4 colorUpdated=color;\n#endif\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);gl_Position=viewProjection*worldPos;vPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vTextureInfos.x==0.)\n{vTextureUV=vec2(textureMatrix*vec4(uv,1.0,0.0));}\nelse\n{vTextureUV=vec2(textureMatrix*vec4(uv2,1.0,0.0));}\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStore[Cn]||(i.ShaderStore.ShadersStore[Cn]=En);var Pn={__proto__:null,terrainVertexShader:{name:Cn,shader:En}},In="terrainPixelShader",yn="precision highp float;uniform vec4 vEyePosition;uniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#include<helperFunctions>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#ifdef DIFFUSE\nvarying vec2 vTextureUV;uniform sampler2D textureSampler;uniform vec2 vTextureInfos;uniform sampler2D diffuse1Sampler;uniform sampler2D diffuse2Sampler;uniform sampler2D diffuse3Sampler;uniform vec2 diffuse1Infos;uniform vec2 diffuse2Infos;uniform vec2 diffuse3Infos;\n#endif\n#ifdef BUMP\nuniform sampler2D bump1Sampler;uniform sampler2D bump2Sampler;uniform sampler2D bump3Sampler;\n#endif\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#ifdef BUMP\n#extension GL_OES_standard_derivatives : enable\nmat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv)\n{vec3 dp1=dFdx(p);vec3 dp2=dFdy(p);vec2 duv1=dFdx(uv);vec2 duv2=dFdy(uv);vec3 dp2perp=cross(dp2,normal);vec3 dp1perp=cross(normal,dp1);vec3 tangent=dp2perp*duv1.x+dp1perp*duv2.x;vec3 binormal=dp2perp*duv1.y+dp1perp*duv2.y;float invmax=inversesqrt(max(dot(tangent,tangent),dot(binormal,binormal)));return mat3(tangent*invmax,binormal*invmax,normal);}\nvec3 perturbNormal(vec3 viewDir,vec3 mixColor)\n{vec3 bump1Color=texture2D(bump1Sampler,vTextureUV*diffuse1Infos).xyz;vec3 bump2Color=texture2D(bump2Sampler,vTextureUV*diffuse2Infos).xyz;vec3 bump3Color=texture2D(bump3Sampler,vTextureUV*diffuse3Infos).xyz;bump1Color.rgb*=mixColor.r;bump2Color.rgb=mix(bump1Color.rgb,bump2Color.rgb,mixColor.g);vec3 map=mix(bump2Color.rgb,bump3Color.rgb,mixColor.b);map=map*255./127.-128./127.;mat3 TBN=cotangent_frame(vNormalW*vTextureInfos.y,-viewDir,vTextureUV);return normalize(TBN*map);}\n#endif\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);vec4 baseColor=vec4(1.,1.,1.,1.);vec3 diffuseColor=vDiffuseColor.rgb;\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;vec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\nfloat alpha=vDiffuseColor.a;\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#ifdef DIFFUSE\nbaseColor=texture2D(textureSampler,vTextureUV);\n#if defined(BUMP) && defined(DIFFUSE)\nnormalW=perturbNormal(viewDirectionW,baseColor.rgb);\n#endif\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include<depthPrePass>\nbaseColor.rgb*=vTextureInfos.y;vec4 diffuse1Color=texture2D(diffuse1Sampler,vTextureUV*diffuse1Infos);vec4 diffuse2Color=texture2D(diffuse2Sampler,vTextureUV*diffuse2Infos);vec4 diffuse3Color=texture2D(diffuse3Sampler,vTextureUV*diffuse3Infos);diffuse1Color.rgb*=baseColor.r;diffuse2Color.rgb=mix(diffuse1Color.rgb,diffuse2Color.rgb,baseColor.g);baseColor.rgb=mix(diffuse2Color.rgb,diffuse3Color.rgb,baseColor.b);\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nbaseColor.rgb*=vColor.rgb;\n#endif\nvec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;float shadow=1.;float aggShadow=0.;float numLights=0.;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor*baseColor.rgb,0.0,1.0);vec4 color=vec4(finalDiffuse+finalSpecular,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStore[In]||(i.ShaderStore.ShadersStore[In]=yn);var Ln={__proto__:null,terrainPixelShader:{name:In,shader:yn}},An="triplanarVertexShader",On="attribute position: vec3f;\n#ifdef NORMAL\nattribute normal: vec3f;\n#endif\n#ifdef VERTEXCOLOR\nattribute color: vec4f;\n#endif\n#include<helperFunctions>\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform view: mat4x4f;uniform viewProjection: mat4x4f;\n#ifdef DIFFUSEX\nvarying vTextureUVX: vec2f;\n#endif\n#ifdef DIFFUSEY\nvarying vTextureUVY: vec2f;\n#endif\n#ifdef DIFFUSEZ\nvarying vTextureUVZ: vec2f;\n#endif\nuniform tileSize: f32;\n#ifdef POINTSIZE\nuniform pointSize: f32;\n#endif\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying tangentSpace0: vec3f;varying tangentSpace1: vec3f;varying tangentSpace2: vec3f;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vColor: vec4f;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs\n{\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef VERTEXCOLOR\nvar colorUpdated: vec4f=vertexInputs.color;\n#endif\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvar worldPos: vec4f=finalWorld* vec4f(vertexInputs.position,1.0);vertexOutputs.position=uniforms.viewProjection*worldPos;vertexOutputs.vPositionW= worldPos.xyz;\n#ifdef DIFFUSEX\nvertexOutputs.vTextureUVX=worldPos.zy/uniforms.tileSize;\n#endif\n#ifdef DIFFUSEY\nvertexOutputs.vTextureUVY=worldPos.xz/uniforms.tileSize;\n#endif\n#ifdef DIFFUSEZ\nvertexOutputs.vTextureUVZ=worldPos.xy/uniforms.tileSize;\n#endif\n#ifdef NORMAL\nvar xtan: vec3f= vec3f(0,0,1);var xbin: vec3f= vec3f(0,1,0);var ytan: vec3f= vec3f(1,0,0);var ybin: vec3f= vec3f(0,0,1);var ztan: vec3f= vec3f(1,0,0);var zbin: vec3f= vec3f(0,1,0);var normalizedNormal: vec3f=normalize(vertexInputs.normal);normalizedNormal=normalizedNormal*normalizedNormal;var worldBinormal: vec3f=normalize(xbin*normalizedNormal.x+ybin*normalizedNormal.y+zbin*normalizedNormal.z);var worldTangent: vec3f=normalize(xtan*normalizedNormal.x+ytan*normalizedNormal.y+ztan*normalizedNormal.z);var normalWorld: mat3x3f= mat3x3f(finalWorld[0].xyz,finalWorld[1].xyz,finalWorld[2].xyz);\n#ifdef NONUNIFORMSCALING\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\n#endif\nworldTangent=normalize((normalWorld*worldTangent).xyz);worldBinormal=normalize((normalWorld*worldBinormal).xyz);var worldNormal: vec3f=normalize((normalWorld*normalize(vertexInputs.normal)).xyz);vertexOutputs.tangentSpace0=worldTangent;vertexOutputs.tangentSpace1=worldBinormal;vertexOutputs.tangentSpace2=worldNormal;\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[An]||(i.ShaderStore.ShadersStoreWGSL[An]=On);var Dn={__proto__:null,triplanarVertexShaderWGSL:{name:An,shader:On}},Nn="triplanarPixelShader",bn="uniform vEyePosition: vec4f;uniform vDiffuseColor: vec4f;\n#ifdef SPECULARTERM\nuniform vSpecularColor: vec4f;\n#endif\nvarying vPositionW: vec3f;\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vColor: vec4f;\n#endif\n#include<helperFunctions>\n#include<lightUboDeclaration>[0..maxSimultaneousLights]\n#ifdef DIFFUSEX\nvarying vTextureUVX: vec2f;var diffuseSamplerXSampler: sampler;var diffuseSamplerX: texture_2d<f32>;\n#ifdef BUMPX\nvar normalSamplerXSampler: sampler;var normalSamplerX: texture_2d<f32>;\n#endif\n#endif\n#ifdef DIFFUSEY\nvarying vTextureUVY: vec2f;var diffuseSamplerYSampler: sampler;var diffuseSamplerY: texture_2d<f32>;\n#ifdef BUMPY\nvar normalSamplerYSampler: sampler;var normalSamplerY: texture_2d<f32>;\n#endif\n#endif\n#ifdef DIFFUSEZ\nvarying vTextureUVZ: vec2f;var diffuseSamplerZSampler: sampler;var diffuseSamplerZ: texture_2d<f32>;\n#ifdef BUMPZ\nvar normalSamplerZSampler: sampler;var normalSamplerZ: texture_2d<f32>;\n#endif\n#endif\n#ifdef NORMAL\nvarying tangentSpace0: vec3f;varying tangentSpace1: vec3f;varying tangentSpace2: vec3f;\n#endif\n#include<logDepthDeclaration>\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvar viewDirectionW: vec3f=normalize(uniforms.vEyePosition.xyz-fragmentInputs.vPositionW);var baseColor: vec4f= vec4f(0.,0.,0.,1.);var diffuseColor: vec3f=uniforms.vDiffuseColor.rgb;var alpha: f32=uniforms.vDiffuseColor.a;\n#ifdef NORMAL\nvar normalW: vec3f=fragmentInputs.tangentSpace2;\n#else\nvar normalW: vec3f= vec3f(1.0,1.0,1.0);\n#endif\nvar baseNormal: vec4f= vec4f(0.0,0.0,0.0,1.0);normalW=normalW*normalW;\n#ifdef DIFFUSEX\nbaseColor=baseColor+textureSample(diffuseSamplerX,diffuseSamplerXSampler,fragmentInputs.vTextureUVX)*normalW.x;\n#ifdef BUMPX\nbaseNormal=baseNormal+textureSample(normalSamplerX,normalSamplerXSampler,fragmentInputs.vTextureUVX)*normalW.x;\n#endif\n#endif\n#ifdef DIFFUSEY\nbaseColor=baseColor+textureSample(diffuseSamplerY,diffuseSamplerYSampler,fragmentInputs.vTextureUVY)*normalW.y;\n#ifdef BUMPY\nbaseNormal=baseNormal+textureSample(normalSamplerY,normalSamplerYSampler,fragmentInputs.vTextureUVY)*normalW.y;\n#endif\n#endif\n#ifdef DIFFUSEZ\nbaseColor=baseColor+textureSample(diffuseSamplerZ,diffuseSamplerZSampler,fragmentInputs.vTextureUVZ)*normalW.z;\n#ifdef BUMPZ\nbaseNormal=baseNormal+textureSample(normalSamplerZ,normalSamplerZSampler,fragmentInputs.vTextureUVZ)*normalW.z;\n#endif\n#endif\n#ifdef NORMAL\nvar tangentSpace: mat3x3f=mat3x3f(fragmentInputs.tangentSpace0,fragmentInputs.tangentSpace1,fragmentInputs.tangentSpace2);normalW=normalize((2.0*baseNormal.xyz-1.0)*tangentSpace);\n#endif\n#ifdef ALPHATEST\nif (baseColor.a<0.4) {discard;}\n#endif\n#include<depthPrePass>\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nbaseColor=vec4f(baseColor.rgb*fragmentInputs.vColor.rgb,baseColor.a);\n#endif\nvar diffuseBase: vec3f= vec3f(0.,0.,0.);var info: lightingInfo;var shadow: f32=1.;var aggShadow: f32=0.;var numLights: f32=0.;\n#ifdef SPECULARTERM\nvar glossiness: f32=uniforms.vSpecularColor.a;var specularBase: vec3f= vec3f(0.,0.,0.);var specularColor: vec3f=uniforms.vSpecularColor.rgb;\n#else\nvar glossiness: f32=0.;\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=fragmentInputs.vColor.a;\n#endif\n#ifdef SPECULARTERM\nvar finalSpecular: vec3f=specularBase*specularColor;\n#else\nvar finalSpecular: vec3f= vec3f(0.0);\n#endif\nvar finalDiffuse: vec3f=clamp(diffuseBase*diffuseColor,vec3f(0.0),vec3f(1.0))*baseColor.rgb;var color: vec4f= vec4f(finalDiffuse+finalSpecular,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\nfragmentOutputs.color=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[Nn]||(i.ShaderStore.ShadersStoreWGSL[Nn]=bn);var Fn={__proto__:null,triplanarPixelShaderWGSL:{name:Nn,shader:bn}},Mn="triplanarVertexShader",Rn="precision highp float;attribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<helperFunctions>\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform mat4 view;uniform mat4 viewProjection;\n#ifdef DIFFUSEX\nvarying vec2 vTextureUVX;\n#endif\n#ifdef DIFFUSEY\nvarying vec2 vTextureUVY;\n#endif\n#ifdef DIFFUSEZ\nvarying vec2 vTextureUVZ;\n#endif\nuniform float tileSize;\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying mat3 tangentSpace;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void)\n{\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef VERTEXCOLOR\nvec4 colorUpdated=color;\n#endif\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);gl_Position=viewProjection*worldPos;vPositionW=vec3(worldPos);\n#ifdef DIFFUSEX\nvTextureUVX=worldPos.zy/tileSize;\n#endif\n#ifdef DIFFUSEY\nvTextureUVY=worldPos.xz/tileSize;\n#endif\n#ifdef DIFFUSEZ\nvTextureUVZ=worldPos.xy/tileSize;\n#endif\n#ifdef NORMAL\nvec3 xtan=vec3(0,0,1);vec3 xbin=vec3(0,1,0);vec3 ytan=vec3(1,0,0);vec3 ybin=vec3(0,0,1);vec3 ztan=vec3(1,0,0);vec3 zbin=vec3(0,1,0);vec3 normalizedNormal=normalize(normal);normalizedNormal*=normalizedNormal;vec3 worldBinormal=normalize(xbin*normalizedNormal.x+ybin*normalizedNormal.y+zbin*normalizedNormal.z);vec3 worldTangent=normalize(xtan*normalizedNormal.x+ytan*normalizedNormal.y+ztan*normalizedNormal.z);mat3 normalWorld=mat3(finalWorld);\n#ifdef NONUNIFORMSCALING\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\n#endif\nworldTangent=normalize((normalWorld*worldTangent).xyz);worldBinormal=normalize((normalWorld*worldBinormal).xyz);vec3 worldNormal=normalize((normalWorld*normalize(normal)).xyz);tangentSpace[0]=worldTangent;tangentSpace[1]=worldBinormal;tangentSpace[2]=worldNormal;\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStore[Mn]||(i.ShaderStore.ShadersStore[Mn]=Rn);var Vn={__proto__:null,triplanarVertexShader:{name:Mn,shader:Rn}},Un="triplanarPixelShader",wn="precision highp float;uniform vec4 vEyePosition;uniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\nvarying vec3 vPositionW;\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#include<helperFunctions>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#ifdef DIFFUSEX\nvarying vec2 vTextureUVX;uniform sampler2D diffuseSamplerX;\n#ifdef BUMPX\nuniform sampler2D normalSamplerX;\n#endif\n#endif\n#ifdef DIFFUSEY\nvarying vec2 vTextureUVY;uniform sampler2D diffuseSamplerY;\n#ifdef BUMPY\nuniform sampler2D normalSamplerY;\n#endif\n#endif\n#ifdef DIFFUSEZ\nvarying vec2 vTextureUVZ;uniform sampler2D diffuseSamplerZ;\n#ifdef BUMPZ\nuniform sampler2D normalSamplerZ;\n#endif\n#endif\n#ifdef NORMAL\nvarying mat3 tangentSpace;\n#endif\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<logDepthDeclaration>\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);vec4 baseColor=vec4(0.,0.,0.,1.);vec3 diffuseColor=vDiffuseColor.rgb;float alpha=vDiffuseColor.a;\n#ifdef NORMAL\nvec3 normalW=tangentSpace[2];\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\nvec4 baseNormal=vec4(0.0,0.0,0.0,1.0);normalW*=normalW;\n#ifdef DIFFUSEX\nbaseColor+=texture2D(diffuseSamplerX,vTextureUVX)*normalW.x;\n#ifdef BUMPX\nbaseNormal+=texture2D(normalSamplerX,vTextureUVX)*normalW.x;\n#endif\n#endif\n#ifdef DIFFUSEY\nbaseColor+=texture2D(diffuseSamplerY,vTextureUVY)*normalW.y;\n#ifdef BUMPY\nbaseNormal+=texture2D(normalSamplerY,vTextureUVY)*normalW.y;\n#endif\n#endif\n#ifdef DIFFUSEZ\nbaseColor+=texture2D(diffuseSamplerZ,vTextureUVZ)*normalW.z;\n#ifdef BUMPZ\nbaseNormal+=texture2D(normalSamplerZ,vTextureUVZ)*normalW.z;\n#endif\n#endif\n#ifdef NORMAL\nnormalW=normalize((2.0*baseNormal.xyz-1.0)*tangentSpace);\n#endif\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include<depthPrePass>\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nbaseColor.rgb*=vColor.rgb;\n#endif\nvec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;float shadow=1.;float aggShadow=0.;float numLights=0.;\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;vec3 specularBase=vec3(0.,0.,0.);vec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;vec4 color=vec4(finalDiffuse+finalSpecular,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStore[Un]||(i.ShaderStore.ShadersStore[Un]=wn);var Bn={__proto__:null,triplanarPixelShader:{name:Un,shader:wn}},zn="waterVertexShader",Gn="attribute position: vec3f;\n#ifdef NORMAL\nattribute normal: vec3f;\n#endif\n#ifdef UV1\nattribute uv: vec2f;\n#endif\n#ifdef UV2\nattribute uv2: vec2f;\n#endif\n#ifdef VERTEXCOLOR\nattribute color: vec4f;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform view: mat4x4f;uniform viewProjection: mat4x4f;\n#ifdef BUMP\nvarying vNormalUV: vec2f;\n#ifdef BUMPSUPERIMPOSE\nvarying vNormalUV2: vec2f;\n#endif\nuniform normalMatrix: mat4x4f;uniform vNormalInfos: vec2f;\n#endif\n#ifdef POINTSIZE\nuniform pointSize: f32;\n#endif\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vColor: vec4f;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\n#include<logDepthDeclaration>\nuniform reflectionViewProjection: mat4x4f;uniform windDirection: vec2f;uniform waveLength: f32;uniform time: f32;uniform windForce: f32;uniform waveHeight: f32;uniform waveSpeed: f32;uniform waveCount: f32;varying vRefractionMapTexCoord: vec3f;varying vReflectionMapTexCoord: vec3f;\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef VERTEXCOLOR\nvar colorUpdated: vec4f=vertexInputs.color;\n#endif\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvar worldPos: vec4f=finalWorld* vec4f(vertexInputs.position,1.0);vertexOutputs.vPositionW= worldPos.xyz;\n#ifdef NORMAL\nvertexOutputs.vNormalW=normalize(( finalWorld* vec4f(vertexInputs.normal,0.0)).xyz);\n#endif\n#ifndef UV1\nvar uv: vec2f= vec2f(0.,0.);\n#else\nvar uv: vec2f=vertexInputs.uv;\n#endif\n#ifndef UV2\nvar uv2: vec2f= vec2f(0.,0.);\n#else\nvar uv2: vec2f=vertexInputs.uv2;\n#endif\n#ifdef BUMP\nif (uniforms.vNormalInfos.x==0.)\n{vertexOutputs.vNormalUV=(uniforms.normalMatrix* vec4f((uv*1.0)/uniforms.waveLength+uniforms.time*uniforms.windForce*uniforms.windDirection,1.0,0.0)).xy;\n#ifdef BUMPSUPERIMPOSE\nvertexOutputs.vNormalUV2=(uniforms.normalMatrix* vec4f((uv*0.721)/uniforms.waveLength+uniforms.time*1.2*uniforms.windForce*uniforms.windDirection,1.0,0.0)).xy;\n#endif\n}\nelse\n{vertexOutputs.vNormalUV=(uniforms.normalMatrix* vec4f((uv2*1.0)/uniforms.waveLength+uniforms.time*uniforms.windForce*uniforms.windDirection,1.0,0.0)).xy;\n#ifdef BUMPSUPERIMPOSE\nvertexOutputs.vNormalUV2=(uniforms.normalMatrix* vec4f((uv2*0.721)/uniforms.waveLength+uniforms.time*1.2*uniforms.windForce*uniforms.windDirection,1.0,0.0)).xy;\n#endif\n}\n#endif\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\nvar finalWaveCount: f32=1.0/(uniforms.waveCount*0.5);\n#ifdef USE_WORLD_COORDINATES\nvar p: vec3f=worldPos.xyz;\n#else\nvar p: vec3f=vertexInputs.position;\n#endif\nvar newY: f32=(sin(((p.x/finalWaveCount)+uniforms.time*uniforms.waveSpeed))*uniforms.waveHeight*uniforms.windDirection.x*5.0)\n+ (cos(((p.z/finalWaveCount)+uniforms.time*uniforms.waveSpeed))*uniforms.waveHeight*uniforms.windDirection.y*5.0);p.y=p.y+abs(newY);\n#ifdef USE_WORLD_COORDINATES\nvertexOutputs.position=uniforms.viewProjection* vec4f(p,1.0);\n#else\nvertexOutputs.position=uniforms.viewProjection*finalWorld* vec4f(p,1.0);\n#endif\n#ifdef REFLECTION\nvertexOutputs.vRefractionMapTexCoord=vec3f(\n0.5*(vertexOutputs.position.w+vertexOutputs.position.x),\n0.5*(vertexOutputs.position.w+vertexOutputs.position.y),\nvertexOutputs.position.w\n);worldPos=uniforms.reflectionViewProjection*finalWorld* vec4f(vertexInputs.position,1.0);vertexOutputs.vReflectionMapTexCoord=vec3f(\n0.5*(worldPos.w+worldPos.x),\n0.5*(worldPos.w+worldPos.y),\nworldPos.w\n);\n#endif\n#include<logDepthVertex>\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[zn]||(i.ShaderStore.ShadersStoreWGSL[zn]=Gn);var Hn={__proto__:null,waterVertexShaderWGSL:{name:zn,shader:Gn}},Wn="waterPixelShader",Xn="uniform vEyePosition: vec4f;uniform vDiffuseColor: vec4f;\n#ifdef SPECULARTERM\nuniform vSpecularColor: vec4f;\n#endif\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vColor: vec4f;\n#endif\n#include<helperFunctions>\n#include<imageProcessingDeclaration>\n#include<imageProcessingFunctions>\n#include<lightUboDeclaration>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#ifdef BUMP\nvarying vNormalUV: vec2f;\n#ifdef BUMPSUPERIMPOSE\nvarying vNormalUV2: vec2f;\n#endif\nvar normalSamplerSampler: sampler;var normalSampler: texture_2d<f32>;uniform vNormalInfos: vec2f;\n#endif\nvar refractionSamplerSampler: sampler;var refractionSampler: texture_2d<f32>;var reflectionSamplerSampler: sampler;var reflectionSampler: texture_2d<f32>;const LOG2: f32=1.442695;uniform cameraPosition: vec3f;uniform waterColor: vec4f;uniform colorBlendFactor: f32;uniform waterColor2: vec4f;uniform colorBlendFactor2: f32;uniform bumpHeight: f32;uniform time: f32;varying vRefractionMapTexCoord: vec3f;varying vReflectionMapTexCoord: vec3f;\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvar viewDirectionW: vec3f=normalize(uniforms.vEyePosition.xyz-fragmentInputs.vPositionW);var baseColor: vec4f= vec4f(1.,1.,1.,1.);var diffuseColor: vec3f=uniforms.vDiffuseColor.rgb;var alpha: f32=uniforms.vDiffuseColor.a;\n#ifdef BUMP\n#ifdef BUMPSUPERIMPOSE\nbaseColor=0.6*textureSample(normalSampler,normalSamplerSampler,fragmentInputs.vNormalUV)+0.4*textureSample(normalSampler,normalSamplerSampler, vec2f(fragmentInputs.vNormalUV2.x,fragmentInputs.vNormalUV2.y));\n#else\nbaseColor=textureSample(normalSampler,normalSamplerSampler,fragmentInputs.vNormalUV);\n#endif\nvar bumpColor: vec3f=baseColor.rgb;\n#ifdef ALPHATEST\nif (baseColor.a<0.4) {discard;}\n#endif\nbaseColor=vec4f(baseColor.rgb*uniforms.vNormalInfos.y,baseColor.a);\n#else\nvar bumpColor: vec3f= vec3f(1.0);\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nbaseColor=vec4f(baseColor.rgb*fragmentInputs.vColor.rgb,baseColor.a);\n#endif\n#ifdef NORMAL\nvar perturbation: vec2f=uniforms.bumpHeight*(baseColor.rg-0.5);\n#ifdef BUMPAFFECTSREFLECTION\nvar normalW: vec3f=normalize(fragmentInputs.vNormalW+ vec3f(perturbation.x*8.0,0.0,perturbation.y*8.0));if (normalW.y<0.0) {normalW.y=-normalW.y;}\n#else\nvar normalW: vec3f=normalize(fragmentInputs.vNormalW);\n#endif\n#else\nvar normalW: vec3f= vec3f(1.0,1.0,1.0);var perturbation: vec2f=uniforms.bumpHeight*( vec2f(1.0,1.0)-0.5);\n#endif\n#ifdef FRESNELSEPARATE\n#ifdef REFLECTION\nvar projectedRefractionTexCoords: vec2f=clamp(fragmentInputs.vRefractionMapTexCoord.xy/fragmentInputs.vRefractionMapTexCoord.z+perturbation*0.5, vec2f(0.0), vec2f(1.0));var refractiveColor: vec4f=textureSample(refractionSampler,refractionSamplerSampler,projectedRefractionTexCoords);\n#ifdef IS_REFRACTION_LINEAR\nrefractiveColor=vec4f(toGammaSpace(refractiveColor.rgb),refractiveColor.a);\n#endif\nvar projectedReflectionTexCoords: vec2f= vec2f(\nfragmentInputs.vReflectionMapTexCoord.x/fragmentInputs.vReflectionMapTexCoord.z+perturbation.x*0.3,\nfragmentInputs.vReflectionMapTexCoord.y/fragmentInputs.vReflectionMapTexCoord.z+perturbation.y\n);var reflectiveColor: vec4f=textureSample(reflectionSampler,reflectionSamplerSampler,projectedReflectionTexCoords);\n#ifdef IS_REFLECTION_LINEAR\nreflectiveColor=vec4f(toGammaSpace(reflectiveColor.rgb),reflectiveColor.a);\n#endif\nvar upVector: vec3f= vec3f(0.0,1.0,0.0);var fresnelTerm: f32=clamp(abs(pow(dot(viewDirectionW,upVector),3.0)),0.05,0.65);var IfresnelTerm: f32=1.0-fresnelTerm;refractiveColor=uniforms.colorBlendFactor*uniforms.waterColor+(1.0-uniforms.colorBlendFactor)*refractiveColor;reflectiveColor=IfresnelTerm*uniforms.colorBlendFactor2*uniforms.waterColor+(1.0-uniforms.colorBlendFactor2*IfresnelTerm)*reflectiveColor;var combinedColor: vec4f=refractiveColor*fresnelTerm+reflectiveColor*IfresnelTerm;baseColor=combinedColor;\n#endif\nvar diffuseBase: vec3f= vec3f(0.,0.,0.);var info: lightingInfo;var shadow: f32=1.;var aggShadow: f32=0.;var numLights: f32=0.;\n#ifdef SPECULARTERM\nvar glossiness: f32=uniforms.vSpecularColor.a;var specularBase: vec3f= vec3f(0.,0.,0.);var specularColor: vec3f=uniforms.vSpecularColor.rgb;\n#else\nvar glossiness: f32=0.;\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\nvar finalDiffuse: vec3f=clamp(baseColor.rgb,vec3f(0.0),vec3f(1.0));\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=fragmentInputs.vColor.a;\n#endif\n#ifdef SPECULARTERM\nvar finalSpecular: vec3f=specularBase*specularColor;\n#else\nvar finalSpecular: vec3f= vec3f(0.0);\n#endif\n#else \n#ifdef REFLECTION\nvar projectedRefractionTexCoords: vec2f=clamp(fragmentInputs.vRefractionMapTexCoord.xy/fragmentInputs.vRefractionMapTexCoord.z+perturbation, vec2f(0.0), vec2f(1.0));var refractiveColor: vec4f=textureSample(refractionSampler,refractionSamplerSampler,projectedRefractionTexCoords);\n#ifdef IS_REFRACTION_LINEAR\nrefractiveColor=vec4f(toGammaSpace(refractiveColor.rgb),refractiveColor.a);\n#endif\nvar projectedReflectionTexCoords: vec2f=fragmentInputs.vReflectionMapTexCoord.xy/fragmentInputs.vReflectionMapTexCoord.z+perturbation;var reflectiveColor: vec4f=textureSample(reflectionSampler,reflectionSamplerSampler,projectedReflectionTexCoords);\n#ifdef IS_REFLECTION_LINEAR\nreflectiveColor=vec4f(toGammaSpace(reflectiveColor.rgb),reflectiveColor.a);\n#endif\nvar upVector: vec3f= vec3f(0.0,1.0,0.0);var fresnelTerm: f32=max(dot(viewDirectionW,upVector),0.0);var combinedColor: vec4f=refractiveColor*fresnelTerm+reflectiveColor*(1.0-fresnelTerm);baseColor=uniforms.colorBlendFactor*uniforms.waterColor+(1.0-uniforms.colorBlendFactor)*combinedColor;\n#endif\nvar diffuseBase: vec3f= vec3f(0.,0.,0.);var info: lightingInfo;var shadow: f32=1.;var aggShadow: f32=0.;var numLights: f32=0.;\n#ifdef SPECULARTERM\nvar glossiness: f32=uniforms.vSpecularColor.a;var specularBase: vec3f= vec3f(0.,0.,0.);var specularColor: vec3f=uniforms.vSpecularColor.rgb;\n#else\nvar glossiness: f32=0.;\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\nvar finalDiffuse: vec3f=clamp(baseColor.rgb,vec3f(0.0),vec3f(1.0));\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=fragmentInputs.vColor.a;\n#endif\n#ifdef SPECULARTERM\nvar finalSpecular: vec3f=specularBase*specularColor;\n#else\nvar finalSpecular: vec3f= vec3f(0.0);\n#endif\n#endif\nvar color: vec4f= vec4f(finalDiffuse+finalSpecular,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\n#ifdef IMAGEPROCESSINGPOSTPROCESS\ncolor=vec4f(toLinearSpace(color.rgb),color.a);\n#elif defined(IMAGEPROCESSING)\ncolor=vec4f(toLinearSpace(color.rgb),color.a);color=applyImageProcessing(color);\n#endif\nfragmentOutputs.color=color;\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[Wn]||(i.ShaderStore.ShadersStoreWGSL[Wn]=Xn);var kn={__proto__:null,waterPixelShaderWGSL:{name:Wn,shader:Xn}},jn="waterVertexShader",Zn="precision highp float;attribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform mat4 view;uniform mat4 viewProjection;\n#ifdef BUMP\nvarying vec2 vNormalUV;\n#ifdef BUMPSUPERIMPOSE\nvarying vec2 vNormalUV2;\n#endif\nuniform mat4 normalMatrix;uniform vec2 vNormalInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<logDepthDeclaration>\nuniform mat4 reflectionViewProjection;uniform vec2 windDirection;uniform float waveLength;uniform float time;uniform float windForce;uniform float waveHeight;uniform float waveSpeed;uniform float waveCount;varying vec3 vRefractionMapTexCoord;varying vec3 vReflectionMapTexCoord;\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef VERTEXCOLOR\nvec4 colorUpdated=color;\n#endif\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);vPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef BUMP\nif (vNormalInfos.x==0.)\n{vNormalUV=vec2(normalMatrix*vec4((uv*1.0)/waveLength+time*windForce*windDirection,1.0,0.0));\n#ifdef BUMPSUPERIMPOSE\nvNormalUV2=vec2(normalMatrix*vec4((uv*0.721)/waveLength+time*1.2*windForce*windDirection,1.0,0.0));\n#endif\n}\nelse\n{vNormalUV=vec2(normalMatrix*vec4((uv2*1.0)/waveLength+time*windForce*windDirection ,1.0,0.0));\n#ifdef BUMPSUPERIMPOSE\nvNormalUV2=vec2(normalMatrix*vec4((uv2*0.721)/waveLength+time*1.2*windForce*windDirection ,1.0,0.0));\n#endif\n}\n#endif\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\nfloat finalWaveCount=1.0/(waveCount*0.5);\n#ifdef USE_WORLD_COORDINATES\nvec3 p=worldPos.xyz;\n#else\nvec3 p=position;\n#endif\nfloat newY=(sin(((p.x/finalWaveCount)+time*waveSpeed))*waveHeight*windDirection.x*5.0)\n+ (cos(((p.z/finalWaveCount)+ time*waveSpeed))*waveHeight*windDirection.y*5.0);p.y+=abs(newY);\n#ifdef USE_WORLD_COORDINATES\ngl_Position=viewProjection*vec4(p,1.0);\n#else\ngl_Position=viewProjection*finalWorld*vec4(p,1.0);\n#endif\n#ifdef REFLECTION\nvRefractionMapTexCoord.x=0.5*(gl_Position.w+gl_Position.x);vRefractionMapTexCoord.y=0.5*(gl_Position.w+gl_Position.y);vRefractionMapTexCoord.z=gl_Position.w;worldPos=reflectionViewProjection*finalWorld*vec4(position,1.0);vReflectionMapTexCoord.x=0.5*(worldPos.w+worldPos.x);vReflectionMapTexCoord.y=0.5*(worldPos.w+worldPos.y);vReflectionMapTexCoord.z=worldPos.w;\n#endif\n#include<logDepthVertex>\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStore[jn]||(i.ShaderStore.ShadersStore[jn]=Zn);var Yn={__proto__:null,waterVertexShader:{name:jn,shader:Zn}},Kn="waterPixelShader",qn="#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\nprecision highp float;uniform vec4 vEyePosition;uniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#include<helperFunctions>\n#include<imageProcessingDeclaration>\n#include<imageProcessingFunctions>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#ifdef BUMP\nvarying vec2 vNormalUV;\n#ifdef BUMPSUPERIMPOSE\nvarying vec2 vNormalUV2;\n#endif\nuniform sampler2D normalSampler;uniform vec2 vNormalInfos;\n#endif\nuniform sampler2D refractionSampler;uniform sampler2D reflectionSampler;const float LOG2=1.442695;uniform vec3 cameraPosition;uniform vec4 waterColor;uniform float colorBlendFactor;uniform vec4 waterColor2;uniform float colorBlendFactor2;uniform float bumpHeight;uniform float time;varying vec3 vRefractionMapTexCoord;varying vec3 vReflectionMapTexCoord;\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);vec4 baseColor=vec4(1.,1.,1.,1.);vec3 diffuseColor=vDiffuseColor.rgb;float alpha=vDiffuseColor.a;\n#ifdef BUMP\n#ifdef BUMPSUPERIMPOSE\nbaseColor=0.6*texture2D(normalSampler,vNormalUV)+0.4*texture2D(normalSampler,vec2(vNormalUV2.x,vNormalUV2.y));\n#else\nbaseColor=texture2D(normalSampler,vNormalUV);\n#endif\nvec3 bumpColor=baseColor.rgb;\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\nbaseColor.rgb*=vNormalInfos.y;\n#else\nvec3 bumpColor=vec3(1.0);\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nbaseColor.rgb*=vColor.rgb;\n#endif\n#ifdef NORMAL\nvec2 perturbation=bumpHeight*(baseColor.rg-0.5);\n#ifdef BUMPAFFECTSREFLECTION\nvec3 normalW=normalize(vNormalW+vec3(perturbation.x*8.0,0.0,perturbation.y*8.0));if (normalW.y<0.0) {normalW.y=-normalW.y;}\n#else\nvec3 normalW=normalize(vNormalW);\n#endif\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);vec2 perturbation=bumpHeight*(vec2(1.0,1.0)-0.5);\n#endif\n#ifdef FRESNELSEPARATE\n#ifdef REFLECTION\nvec2 projectedRefractionTexCoords=clamp(vRefractionMapTexCoord.xy/vRefractionMapTexCoord.z+perturbation*0.5,0.0,1.0);vec4 refractiveColor=texture2D(refractionSampler,projectedRefractionTexCoords);\n#ifdef IS_REFRACTION_LINEAR\nrefractiveColor.rgb=toGammaSpace(refractiveColor.rgb);\n#endif\nvec2 projectedReflectionTexCoords=vec2(\nvReflectionMapTexCoord.x/vReflectionMapTexCoord.z+perturbation.x*0.3,\nvReflectionMapTexCoord.y/vReflectionMapTexCoord.z+perturbation.y\n);vec4 reflectiveColor=texture2D(reflectionSampler,projectedReflectionTexCoords);\n#ifdef IS_REFLECTION_LINEAR\nreflectiveColor.rgb=toGammaSpace(reflectiveColor.rgb);\n#endif\nvec3 upVector=vec3(0.0,1.0,0.0);float fresnelTerm=clamp(abs(pow(dot(viewDirectionW,upVector),3.0)),0.05,0.65);float IfresnelTerm=1.0-fresnelTerm;refractiveColor=colorBlendFactor*waterColor+(1.0-colorBlendFactor)*refractiveColor;reflectiveColor=IfresnelTerm*colorBlendFactor2*waterColor+(1.0-colorBlendFactor2*IfresnelTerm)*reflectiveColor;vec4 combinedColor=refractiveColor*fresnelTerm+reflectiveColor*IfresnelTerm;baseColor=combinedColor;\n#endif\nvec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;float shadow=1.;float aggShadow=0.;float numLights=0.;\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;vec3 specularBase=vec3(0.,0.,0.);vec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\nvec3 finalDiffuse=clamp(baseColor.rgb,0.0,1.0);\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\n#else \n#ifdef REFLECTION\nvec2 projectedRefractionTexCoords=clamp(vRefractionMapTexCoord.xy/vRefractionMapTexCoord.z+perturbation,0.0,1.0);vec4 refractiveColor=texture2D(refractionSampler,projectedRefractionTexCoords);\n#ifdef IS_REFRACTION_LINEAR\nrefractiveColor.rgb=toGammaSpace(refractiveColor.rgb);\n#endif\nvec2 projectedReflectionTexCoords=vReflectionMapTexCoord.xy/vReflectionMapTexCoord.z+perturbation;vec4 reflectiveColor=texture2D(reflectionSampler,projectedReflectionTexCoords);\n#ifdef IS_REFLECTION_LINEAR\nreflectiveColor.rgb=toGammaSpace(reflectiveColor.rgb);\n#endif\nvec3 upVector=vec3(0.0,1.0,0.0);float fresnelTerm=max(dot(viewDirectionW,upVector),0.0);vec4 combinedColor=refractiveColor*fresnelTerm+reflectiveColor*(1.0-fresnelTerm);baseColor=colorBlendFactor*waterColor+(1.0-colorBlendFactor)*combinedColor;\n#endif\nvec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;float shadow=1.;float aggShadow=0.;float numLights=0.;\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;vec3 specularBase=vec3(0.,0.,0.);vec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\nvec3 finalDiffuse=clamp(baseColor.rgb,0.0,1.0);\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\n#endif\nvec4 color=vec4(finalDiffuse+finalSpecular,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\n#ifdef IMAGEPROCESSINGPOSTPROCESS\ncolor.rgb=toLinearSpace(color.rgb);\n#elif defined(IMAGEPROCESSING)\ncolor.rgb=toLinearSpace(color.rgb);color=applyImageProcessing(color);\n#endif\ngl_FragColor=color;\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStore[Kn]||(i.ShaderStore.ShadersStore[Kn]=qn);var Qn={__proto__:null,waterPixelShader:{name:Kn,shader:qn}};e.default=X,e.materials=X,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
1
|
+
!function(e,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports,require("babylonjs")):"function"==typeof define&&define.amd?define(["exports","babylonjs"],i):i((e="undefined"!=typeof globalThis?globalThis:e||self).BABYLON=e.BABYLON||{},e.BABYLON)}(this,function(e,i){"use strict";var n=function(e,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,i){e.__proto__=i}||function(e,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])},n(e,i)};function t(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function t(){this.constructor=e}n(e,i),e.prototype=null===i?Object.create(i):(t.prototype=i.prototype,new t)}function r(e,i,n,t){var r,o=arguments.length,a=o<3?i:null===t?t=Object.getOwnPropertyDescriptor(i,n):t;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,i,n,t);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(i,n,a):r(i,n))||a);return o>3&&a&&Object.defineProperty(i,n,a),a}function o(e,i,n,t){return new(n||(n=Promise))(function(r,o){function a(e){try{f(t.next(e))}catch(e){o(e)}}function s(e){try{f(t.throw(e))}catch(e){o(e)}}function f(e){var i;e.done?r(e.value):(i=e.value,i instanceof n?i:new n(function(e){e(i)})).then(a,s)}f((t=t.apply(e,i||[])).next())})}function a(e,i){var n,t,r,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(f){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,t&&(r=2&s[0]?t.return:s[0]?t.throw||((r=t.return)&&r.call(t),0):t.next)&&!(r=r.call(t,s[1])).done)return r;switch(t=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,t=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=i.call(e,o)}catch(e){s=[6,e],t=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,f])}}}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;var s=function(e){function i(){var i=e.call(this)||this;return i.DIFFUSE=!1,i.CLIPPLANE=!1,i.CLIPPLANE2=!1,i.CLIPPLANE3=!1,i.CLIPPLANE4=!1,i.CLIPPLANE5=!1,i.CLIPPLANE6=!1,i.ALPHATEST=!1,i.POINTSIZE=!1,i.FOG=!1,i.NORMAL=!1,i.UV1=!1,i.UV2=!1,i.VERTEXCOLOR=!1,i.VERTEXALPHA=!1,i.NUM_BONE_INFLUENCERS=0,i.BonesPerMesh=0,i.INSTANCES=!1,i.INSTANCESCOLOR=!1,i.NDOTL=!0,i.CUSTOMUSERLIGHTING=!0,i.CELLBASIC=!0,i.DEPTHPREPASS=!1,i.IMAGEPROCESSINGPOSTPROCESS=!1,i.SKIPFINALCOLORCLAMP=!1,i.LOGARITHMICDEPTH=!1,i.AREALIGHTSUPPORTED=!0,i.AREALIGHTNOROUGHTNESS=!0,i.rebuild(),i}return t(i,e),i}(i.MaterialDefines),f=function(e){function n(n,t,r){void 0===r&&(r=!1);var o=e.call(this,n,t,void 0,r)||this;return o.diffuseColor=new i.Color3(1,1,1),o._computeHighLevel=!1,o._disableLighting=!1,o._maxSimultaneousLights=4,o._shadersLoaded=!1,o}return t(n,e),n.prototype.needAlphaBlending=function(){return this.alpha<1},n.prototype.needAlphaTesting=function(){return!1},n.prototype.getAlphaTestTexture=function(){return null},n.prototype.isReadyForSubMesh=function(e,n,t){var r=this,f=n._drawWrapper;if(this.isFrozen&&f.effect&&f._wasPreviouslyReady&&f._wasPreviouslyUsingInstances===t)return!0;n.materialDefines||(n.materialDefines=new s);var l=n.materialDefines,u=this.getScene();if(this._isReadyForSubMesh(n))return!0;var d=u.getEngine();if(l._areTexturesDirty&&(l._needUVs=!1,u.texturesEnabled&&this._diffuseTexture&&i.MaterialFlags.DiffuseTextureEnabled)){if(!this._diffuseTexture.isReady())return!1;l._needUVs=!0,l.DIFFUSE=!0}if(l.CELLBASIC=!this.computeHighLevel,i.PrepareDefinesForMisc(e,u,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),l,void 0,void 0,void 0,this._isVertexOutputInvariant),l._needNormals=i.PrepareDefinesForLights(u,e,l,!1,this._maxSimultaneousLights,this._disableLighting),i.PrepareDefinesForFrameBoundValues(u,d,this,l,!!t),i.PrepareDefinesForAttributes(e,l,!0,!0),l.isDirty){l.markAsProcessed(),u.resetCachedMaterial();var c=new i.EffectFallbacks;l.FOG&&c.addFallback(1,"FOG"),i.HandleFallbacksForShadows(l,c,this.maxSimultaneousLights),l.NUM_BONE_INFLUENCERS>0&&c.addCPUSkinningFallback(0,e),l.IMAGEPROCESSINGPOSTPROCESS=u.imageProcessingConfiguration.applyByPostProcess;var v=[i.VertexBuffer.PositionKind];l.NORMAL&&v.push(i.VertexBuffer.NormalKind),l.UV1&&v.push(i.VertexBuffer.UVKind),l.UV2&&v.push(i.VertexBuffer.UV2Kind),l.VERTEXCOLOR&&v.push(i.VertexBuffer.ColorKind),i.PrepareAttributesForBones(v,e,l,c),i.PrepareAttributesForInstances(v,l);var m=l.toString(),p=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vFogInfos","vFogColor","pointSize","vDiffuseInfos","mBones","diffuseMatrix","logarithmicDepthConstant"],h=["diffuseSampler","areaLightsLTC1Sampler","areaLightsLTC2Sampler"],g=[];i.AddClipPlaneUniforms(p),i.PrepareUniformsAndSamplersList({uniformsNames:p,uniformBuffersNames:g,samplers:h,defines:l,maxSimultaneousLights:this.maxSimultaneousLights,shaderLanguage:this._shaderLanguage}),n.setEffect(u.getEngine().createEffect("cell",{attributes:v,uniformsNames:p,uniformBuffersNames:g,samplers:h,defines:m,fallbacks:c,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights-1},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:function(){return o(r,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return 1!==this.shaderLanguage?[3,2]:[4,Promise.all([Promise.resolve().then(function(){return j}),Promise.resolve().then(function(){return K})])];case 1:return e.sent(),[3,4];case 2:return[4,Promise.all([Promise.resolve().then(function(){return J}),Promise.resolve().then(function(){return ie})])];case 3:e.sent(),e.label=4;case 4:return this._shadersLoaded=!0,[2]}})})}},d),l,this._materialContext)}if(l.AREALIGHTUSED)for(var S=0;S<e.lightSources.length;S++)if(!e.lightSources[S]._isReady())return!1;return!(!n.effect||!n.effect.isReady()||(l._renderId=u.getRenderId(),f._wasPreviouslyReady=!0,f._wasPreviouslyUsingInstances=!!t,0))},n.prototype.bindForSubMesh=function(e,n,t){var r=this.getScene(),o=t.materialDefines;if(o){var a=t.effect;a&&(this._activeEffect=a,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),i.BindBonesParameters(n,this._activeEffect),this._mustRebind(r,a,t)&&(this._diffuseTexture&&i.MaterialFlags.DiffuseTextureEnabled&&(this._activeEffect.setTexture("diffuseSampler",this._diffuseTexture),this._activeEffect.setFloat2("vDiffuseInfos",this._diffuseTexture.coordinatesIndex,this._diffuseTexture.level),this._activeEffect.setMatrix("diffuseMatrix",this._diffuseTexture.getTextureMatrix())),i.BindClipPlane(this._activeEffect,this,r),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&i.BindLogDepth(o,a,r),r.bindEyePosition(a)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*n.visibility),r.lightsEnabled&&!this.disableLighting&&i.BindLights(r,n,this._activeEffect,o,this._maxSimultaneousLights),r.fogEnabled&&n.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,n,this._activeEffect),this._afterBind(n,this._activeEffect,t))}},n.prototype.getAnimatables=function(){var e=[];return this._diffuseTexture&&this._diffuseTexture.animations&&this._diffuseTexture.animations.length>0&&e.push(this._diffuseTexture),e},n.prototype.getActiveTextures=function(){var i=e.prototype.getActiveTextures.call(this);return this._diffuseTexture&&i.push(this._diffuseTexture),i},n.prototype.hasTexture=function(i){return!!e.prototype.hasTexture.call(this,i)||this._diffuseTexture===i},n.prototype.dispose=function(i){this._diffuseTexture&&this._diffuseTexture.dispose(),e.prototype.dispose.call(this,i)},n.prototype.getClassName=function(){return"CellMaterial"},n.prototype.clone=function(e){var t=this;return i.SerializationHelper.Clone(function(){return new n(e,t.getScene())},this)},n.prototype.serialize=function(){var i=e.prototype.serialize.call(this);return i.customType="BABYLON.CellMaterial",i},n.Parse=function(e,t,r){return i.SerializationHelper.Parse(function(){return new n(e.name,t)},e,t,r)},r([i.serializeAsTexture("diffuseTexture")],n.prototype,"_diffuseTexture",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"diffuseTexture",void 0),r([i.serializeAsColor3("diffuse")],n.prototype,"diffuseColor",void 0),r([i.serialize("computeHighLevel")],n.prototype,"_computeHighLevel",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"computeHighLevel",void 0),r([i.serialize("disableLighting")],n.prototype,"_disableLighting",void 0),r([i.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"disableLighting",void 0),r([i.serialize("maxSimultaneousLights")],n.prototype,"_maxSimultaneousLights",void 0),r([i.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"maxSimultaneousLights",void 0),n}(i.PushMaterial);i.RegisterClass("BABYLON.CellMaterial",f);var l=function(){},u=function(){},d=function(e){function n(t,r){var o=e.call(this,t,r,!0)||this;return o.CustomParts=new u,o.customShaderNameResolve=o.Builder,o.FragmentShader=i.Effect.ShadersStore.defaultPixelShader,o.VertexShader=i.Effect.ShadersStore.defaultVertexShader,n.ShaderIndexer++,o._createdShaderName="custom_"+n.ShaderIndexer,o}return t(n,e),n.prototype.AttachAfterBind=function(e,n){if(this._newUniformInstances)for(var t in this._newUniformInstances)"vec2"==(r=t.toString().split("-"))[0]?n.setVector2(r[1],this._newUniformInstances[t]):"vec3"==r[0]?this._newUniformInstances[t]instanceof i.Color3?n.setColor3(r[1],this._newUniformInstances[t]):n.setVector3(r[1],this._newUniformInstances[t]):"vec4"==r[0]?(this._newUniformInstances[t]instanceof i.Color4?n.setDirectColor4(r[1],this._newUniformInstances[t]):n.setVector4(r[1],this._newUniformInstances[t]),n.setVector4(r[1],this._newUniformInstances[t])):"mat4"==r[0]?n.setMatrix(r[1],this._newUniformInstances[t]):"float"==r[0]&&n.setFloat(r[1],this._newUniformInstances[t]);if(this._newSamplerInstances)for(var t in this._newSamplerInstances){var r;"sampler2D"==(r=t.toString().split("-"))[0]&&this._newSamplerInstances[t].isReady&&this._newSamplerInstances[t].isReady()&&n.setTexture(r[1],this._newSamplerInstances[t])}},n.prototype.ReviewUniform=function(e,i){if("uniform"==e&&this._newUniforms)for(var n=0;n<this._newUniforms.length;n++)-1==this._customUniform[n].indexOf("sampler")&&i.push(this._newUniforms[n].replace(/\[\d*\]/g,""));if("sampler"==e&&this._newUniforms)for(n=0;n<this._newUniforms.length;n++)-1!=this._customUniform[n].indexOf("sampler")&&i.push(this._newUniforms[n].replace(/\[\d*\]/g,""));return i},n.prototype.Builder=function(e,n,t,r,o,a){a&&this._customAttributes&&this._customAttributes.length>0&&a.push.apply(a,this._customAttributes),this.ReviewUniform("uniform",n),this.ReviewUniform("sampler",r);var s=this._createdShaderName;return i.Effect.ShadersStore[s+"VertexShader"]&&i.Effect.ShadersStore[s+"PixelShader"]||(i.Effect.ShadersStore[s+"VertexShader"]=this._injectCustomCode(this.VertexShader,"vertex"),i.Effect.ShadersStore[s+"PixelShader"]=this._injectCustomCode(this.FragmentShader,"fragment")),s},n.prototype._injectCustomCode=function(e,i){var n=this._getCustomCode(i);for(var t in n){var r=n[t];if(r&&r.length>0){var o="#define "+t;e=e.replace(o,"\n"+r+"\n"+o)}}return e},n.prototype._getCustomCode=function(e){var i,n;return"vertex"===e?{CUSTOM_VERTEX_BEGIN:this.CustomParts.Vertex_Begin,CUSTOM_VERTEX_DEFINITIONS:((null===(i=this._customUniform)||void 0===i?void 0:i.join("\n"))||"")+(this.CustomParts.Vertex_Definitions||""),CUSTOM_VERTEX_MAIN_BEGIN:this.CustomParts.Vertex_MainBegin,CUSTOM_VERTEX_UPDATE_POSITION:this.CustomParts.Vertex_Before_PositionUpdated,CUSTOM_VERTEX_UPDATE_NORMAL:this.CustomParts.Vertex_Before_NormalUpdated,CUSTOM_VERTEX_MAIN_END:this.CustomParts.Vertex_MainEnd,CUSTOM_VERTEX_UPDATE_WORLDPOS:this.CustomParts.Vertex_After_WorldPosComputed}:{CUSTOM_FRAGMENT_BEGIN:this.CustomParts.Fragment_Begin,CUSTOM_FRAGMENT_DEFINITIONS:((null===(n=this._customUniform)||void 0===n?void 0:n.join("\n"))||"")+(this.CustomParts.Fragment_Definitions||""),CUSTOM_FRAGMENT_MAIN_BEGIN:this.CustomParts.Fragment_MainBegin,CUSTOM_FRAGMENT_UPDATE_DIFFUSE:this.CustomParts.Fragment_Custom_Diffuse,CUSTOM_FRAGMENT_UPDATE_ALPHA:this.CustomParts.Fragment_Custom_Alpha,CUSTOM_FRAGMENT_BEFORE_LIGHTS:this.CustomParts.Fragment_Before_Lights,CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR:this.CustomParts.Fragment_Before_FragColor,CUSTOM_FRAGMENT_MAIN_END:this.CustomParts.Fragment_MainEnd,CUSTOM_FRAGMENT_BEFORE_FOG:this.CustomParts.Fragment_Before_Fog}},n.prototype._afterBind=function(i,n,t){if(void 0===n&&(n=null),n){this.AttachAfterBind(i,n);try{e.prototype._afterBind.call(this,i,n,t)}catch(e){}}},n.prototype.AddUniform=function(e,i,n){return this._customUniform||(this._customUniform=[],this._newUniforms=[],this._newSamplerInstances={},this._newUniformInstances={}),n&&(-1!=i.indexOf("sampler")?this._newSamplerInstances[i+"-"+e]=n:this._newUniformInstances[i+"-"+e]=n),this._customUniform.push("uniform "+i+" "+e+";"),this._newUniforms.push(e),this},n.prototype.AddAttribute=function(e){return this._customAttributes||(this._customAttributes=[]),this._customAttributes.push(e),this},n.prototype.Fragment_Begin=function(e){return this.CustomParts.Fragment_Begin=e,this},n.prototype.Fragment_Definitions=function(e){return this.CustomParts.Fragment_Definitions=e,this},n.prototype.Fragment_MainBegin=function(e){return this.CustomParts.Fragment_MainBegin=e,this},n.prototype.Fragment_MainEnd=function(e){return this.CustomParts.Fragment_MainEnd=e,this},n.prototype.Fragment_Custom_Diffuse=function(e){return this.CustomParts.Fragment_Custom_Diffuse=e.replace("result","diffuseColor"),this},n.prototype.Fragment_Custom_Alpha=function(e){return this.CustomParts.Fragment_Custom_Alpha=e.replace("result","alpha"),this},n.prototype.Fragment_Before_Lights=function(e){return this.CustomParts.Fragment_Before_Lights=e,this},n.prototype.Fragment_Before_Fog=function(e){return this.CustomParts.Fragment_Before_Fog=e,this},n.prototype.Fragment_Before_FragColor=function(e){return this.CustomParts.Fragment_Before_FragColor=e.replace("result","color"),this},n.prototype.Vertex_Begin=function(e){return this.CustomParts.Vertex_Begin=e,this},n.prototype.Vertex_Definitions=function(e){return this.CustomParts.Vertex_Definitions=e,this},n.prototype.Vertex_MainBegin=function(e){return this.CustomParts.Vertex_MainBegin=e,this},n.prototype.Vertex_Before_PositionUpdated=function(e){return this.CustomParts.Vertex_Before_PositionUpdated=e.replace("result","positionUpdated"),this},n.prototype.Vertex_Before_NormalUpdated=function(e){return this.CustomParts.Vertex_Before_NormalUpdated=e.replace("result","normalUpdated"),this},n.prototype.Vertex_After_WorldPosComputed=function(e){return this.CustomParts.Vertex_After_WorldPosComputed=e,this},n.prototype.Vertex_MainEnd=function(e){return this.CustomParts.Vertex_MainEnd=e,this},n.ShaderIndexer=1,n}(i.StandardMaterial);i.RegisterClass("BABYLON.CustomMaterial",d);var c=function(){},v=c,m=function(e){function n(t,r){var o=e.call(this,t,r,!0)||this;return o.CustomParts=new c,o.customShaderNameResolve=o.Builder,o.FragmentShader=i.Effect.ShadersStore.pbrPixelShader,o.VertexShader=i.Effect.ShadersStore.pbrVertexShader,o.FragmentShader=o.FragmentShader.replace(/#include<pbrBlockAlbedoOpacity>/g,i.Effect.IncludesShadersStore.pbrBlockAlbedoOpacity),o.FragmentShader=o.FragmentShader.replace(/#include<pbrBlockReflectivity>/g,i.Effect.IncludesShadersStore.pbrBlockReflectivity),o.FragmentShader=o.FragmentShader.replace(/#include<pbrBlockFinalColorComposition>/g,i.Effect.IncludesShadersStore.pbrBlockFinalColorComposition),n.ShaderIndexer++,o._createdShaderName="custompbr_"+n.ShaderIndexer,o}return t(n,e),n.prototype.AttachAfterBind=function(e,n){if(this._newUniformInstances)for(var t in this._newUniformInstances)"vec2"==(r=t.toString().split("-"))[0]?n.setVector2(r[1],this._newUniformInstances[t]):"vec3"==r[0]?this._newUniformInstances[t]instanceof i.Color3?n.setColor3(r[1],this._newUniformInstances[t]):n.setVector3(r[1],this._newUniformInstances[t]):"vec4"==r[0]?(this._newUniformInstances[t]instanceof i.Color4?n.setDirectColor4(r[1],this._newUniformInstances[t]):n.setVector4(r[1],this._newUniformInstances[t]),n.setVector4(r[1],this._newUniformInstances[t])):"mat4"==r[0]?n.setMatrix(r[1],this._newUniformInstances[t]):"float"==r[0]&&n.setFloat(r[1],this._newUniformInstances[t]);if(this._newSamplerInstances)for(var t in this._newSamplerInstances){var r;"sampler2D"==(r=t.toString().split("-"))[0]&&this._newSamplerInstances[t].isReady&&this._newSamplerInstances[t].isReady()&&n.setTexture(r[1],this._newSamplerInstances[t])}},n.prototype.ReviewUniform=function(e,i){if("uniform"==e&&this._newUniforms)for(var n=0;n<this._newUniforms.length;n++)-1==this._customUniform[n].indexOf("sampler")&&i.push(this._newUniforms[n].replace(/\[\d*\]/g,""));if("sampler"==e&&this._newUniforms)for(n=0;n<this._newUniforms.length;n++)-1!=this._customUniform[n].indexOf("sampler")&&i.push(this._newUniforms[n].replace(/\[\d*\]/g,""));return i},n.prototype.Builder=function(e,n,t,r,o,a,s){if(s){var f=s.processFinalCode;s.processFinalCode=function(e,n){if("vertex"===e)return f?f(e,n):n;var t=new i.ShaderCodeInliner(n);return t.inlineToken="#define pbr_inline",t.processCode(),f?f(e,t.code):t.code}}a&&this._customAttributes&&this._customAttributes.length>0&&a.push.apply(a,this._customAttributes),this.ReviewUniform("uniform",n),this.ReviewUniform("sampler",r);var l=this._createdShaderName;return i.Effect.ShadersStore[l+"VertexShader"]&&i.Effect.ShadersStore[l+"PixelShader"]||(i.Effect.ShadersStore[l+"VertexShader"]=this._injectCustomCode(this.VertexShader,"vertex"),i.Effect.ShadersStore[l+"PixelShader"]=this._injectCustomCode(this.FragmentShader,"fragment")),l},n.prototype._injectCustomCode=function(e,i){var n=this._getCustomCode(i);for(var t in n){var r=n[t];if(r&&r.length>0){var o="#define "+t;e=e.replace(o,"\n"+r+"\n"+o)}}return e},n.prototype._getCustomCode=function(e){var i,n;return"vertex"===e?{CUSTOM_VERTEX_BEGIN:this.CustomParts.Vertex_Begin,CUSTOM_VERTEX_DEFINITIONS:((null===(i=this._customUniform)||void 0===i?void 0:i.join("\n"))||"")+(this.CustomParts.Vertex_Definitions||""),CUSTOM_VERTEX_MAIN_BEGIN:this.CustomParts.Vertex_MainBegin,CUSTOM_VERTEX_UPDATE_POSITION:this.CustomParts.Vertex_Before_PositionUpdated,CUSTOM_VERTEX_UPDATE_NORMAL:this.CustomParts.Vertex_Before_NormalUpdated,CUSTOM_VERTEX_MAIN_END:this.CustomParts.Vertex_MainEnd,CUSTOM_VERTEX_UPDATE_WORLDPOS:this.CustomParts.Vertex_After_WorldPosComputed}:{CUSTOM_FRAGMENT_BEGIN:this.CustomParts.Fragment_Begin,CUSTOM_FRAGMENT_MAIN_BEGIN:this.CustomParts.Fragment_MainBegin,CUSTOM_FRAGMENT_DEFINITIONS:((null===(n=this._customUniform)||void 0===n?void 0:n.join("\n"))||"")+(this.CustomParts.Fragment_Definitions||""),CUSTOM_FRAGMENT_UPDATE_ALBEDO:this.CustomParts.Fragment_Custom_Albedo,CUSTOM_FRAGMENT_UPDATE_ALPHA:this.CustomParts.Fragment_Custom_Alpha,CUSTOM_FRAGMENT_BEFORE_LIGHTS:this.CustomParts.Fragment_Before_Lights,CUSTOM_FRAGMENT_UPDATE_METALLICROUGHNESS:this.CustomParts.Fragment_Custom_MetallicRoughness,CUSTOM_FRAGMENT_UPDATE_MICROSURFACE:this.CustomParts.Fragment_Custom_MicroSurface,CUSTOM_FRAGMENT_BEFORE_FINALCOLORCOMPOSITION:this.CustomParts.Fragment_Before_FinalColorComposition,CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR:this.CustomParts.Fragment_Before_FragColor,CUSTOM_FRAGMENT_MAIN_END:this.CustomParts.Fragment_MainEnd,CUSTOM_FRAGMENT_BEFORE_FOG:this.CustomParts.Fragment_Before_Fog}},n.prototype._afterBind=function(i,n,t){if(void 0===n&&(n=null),n){this.AttachAfterBind(i,n);try{e.prototype._afterBind.call(this,i,n,t)}catch(e){}}},n.prototype.AddUniform=function(e,i,n){return this._customUniform||(this._customUniform=[],this._newUniforms=[],this._newSamplerInstances={},this._newUniformInstances={}),n&&(-1!=i.indexOf("sampler")?this._newSamplerInstances[i+"-"+e]=n:this._newUniformInstances[i+"-"+e]=n),this._customUniform.push("uniform "+i+" "+e+";"),this._newUniforms.push(e),this},n.prototype.AddAttribute=function(e){return this._customAttributes||(this._customAttributes=[]),this._customAttributes.push(e),this},n.prototype.Fragment_Begin=function(e){return this.CustomParts.Fragment_Begin=e,this},n.prototype.Fragment_Definitions=function(e){return this.CustomParts.Fragment_Definitions=e,this},n.prototype.Fragment_MainBegin=function(e){return this.CustomParts.Fragment_MainBegin=e,this},n.prototype.Fragment_Custom_Albedo=function(e){return this.CustomParts.Fragment_Custom_Albedo=e.replace("result","surfaceAlbedo"),this},n.prototype.Fragment_Custom_Alpha=function(e){return this.CustomParts.Fragment_Custom_Alpha=e.replace("result","alpha"),this},n.prototype.Fragment_Before_Lights=function(e){return this.CustomParts.Fragment_Before_Lights=e,this},n.prototype.Fragment_Custom_MetallicRoughness=function(e){return this.CustomParts.Fragment_Custom_MetallicRoughness=e,this},n.prototype.Fragment_Custom_MicroSurface=function(e){return this.CustomParts.Fragment_Custom_MicroSurface=e,this},n.prototype.Fragment_Before_Fog=function(e){return this.CustomParts.Fragment_Before_Fog=e,this},n.prototype.Fragment_Before_FinalColorComposition=function(e){return this.CustomParts.Fragment_Before_FinalColorComposition=e,this},n.prototype.Fragment_Before_FragColor=function(e){return this.CustomParts.Fragment_Before_FragColor=e.replace("result","color"),this},n.prototype.Fragment_MainEnd=function(e){return this.CustomParts.Fragment_MainEnd=e,this},n.prototype.Vertex_Begin=function(e){return this.CustomParts.Vertex_Begin=e,this},n.prototype.Vertex_Definitions=function(e){return this.CustomParts.Vertex_Definitions=e,this},n.prototype.Vertex_MainBegin=function(e){return this.CustomParts.Vertex_MainBegin=e,this},n.prototype.Vertex_Before_PositionUpdated=function(e){return this.CustomParts.Vertex_Before_PositionUpdated=e.replace("result","positionUpdated"),this},n.prototype.Vertex_Before_NormalUpdated=function(e){return this.CustomParts.Vertex_Before_NormalUpdated=e.replace("result","normalUpdated"),this},n.prototype.Vertex_After_WorldPosComputed=function(e){return this.CustomParts.Vertex_After_WorldPosComputed=e,this},n.prototype.Vertex_MainEnd=function(e){return this.CustomParts.Vertex_MainEnd=e,this},n.ShaderIndexer=1,n}(i.PBRMaterial);i.RegisterClass("BABYLON.PBRCustomMaterial",m);var p=function(e){function i(){var i=e.call(this)||this;return i.DIFFUSE=!1,i.CLIPPLANE=!1,i.CLIPPLANE2=!1,i.CLIPPLANE3=!1,i.CLIPPLANE4=!1,i.CLIPPLANE5=!1,i.CLIPPLANE6=!1,i.ALPHATEST=!1,i.DEPTHPREPASS=!1,i.POINTSIZE=!1,i.FOG=!1,i.UV1=!1,i.VERTEXCOLOR=!1,i.VERTEXALPHA=!1,i.BonesPerMesh=0,i.NUM_BONE_INFLUENCERS=0,i.INSTANCES=!1,i.INSTANCESCOLOR=!1,i.IMAGEPROCESSINGPOSTPROCESS=!1,i.SKIPFINALCOLORCLAMP=!1,i.LOGARITHMICDEPTH=!1,i.rebuild(),i}return t(i,e),i}(i.MaterialDefines),h=function(e){function n(n,t,r){void 0===r&&(r=!1);var o=e.call(this,n,t,void 0,r)||this;return o.diffuseColor=new i.Color3(1,1,1),o.speed=1,o._scaledDiffuse=new i.Color3,o._lastTime=0,o._shadersLoaded=!1,o}return t(n,e),n.prototype.needAlphaBlending=function(){return!1},n.prototype.needAlphaTesting=function(){return!0},n.prototype.getAlphaTestTexture=function(){return null},n.prototype.isReadyForSubMesh=function(e,n,t){var r=this,s=n._drawWrapper;if(this.isFrozen&&s._wasPreviouslyReady&&s._wasPreviouslyUsingInstances===t)return!0;n.materialDefines||(n.materialDefines=new p);var f=n.materialDefines,l=this.getScene();if(this._isReadyForSubMesh(n))return!0;var u=l.getEngine();if(f._areTexturesDirty&&(f._needUVs=!1,this._diffuseTexture&&i.MaterialFlags.DiffuseTextureEnabled)){if(!this._diffuseTexture.isReady())return!1;f._needUVs=!0,f.DIFFUSE=!0}if(f.ALPHATEST=!!this._opacityTexture,f._areMiscDirty&&(f.POINTSIZE=this.pointsCloud||l.forcePointsCloud,f.FOG=l.fogEnabled&&e.applyFog&&l.fogMode!==i.Scene.FOGMODE_NONE&&this.fogEnabled,f.LOGARITHMICDEPTH=this._useLogarithmicDepth),i.PrepareDefinesForFrameBoundValues(l,u,this,f,!!t),i.PrepareDefinesForAttributes(e,f,!1,!0),f.isDirty){f.markAsProcessed(),l.resetCachedMaterial();var d=new i.EffectFallbacks;f.FOG&&d.addFallback(1,"FOG"),f.NUM_BONE_INFLUENCERS>0&&d.addCPUSkinningFallback(0,e),f.IMAGEPROCESSINGPOSTPROCESS=l.imageProcessingConfiguration.applyByPostProcess;var c=[i.VertexBuffer.PositionKind];f.UV1&&c.push(i.VertexBuffer.UVKind),f.VERTEXCOLOR&&c.push(i.VertexBuffer.ColorKind),i.PrepareAttributesForBones(c,e,f,d),i.PrepareAttributesForInstances(c,f);var v=["world","view","viewProjection","vEyePosition","vFogInfos","vFogColor","pointSize","vDiffuseInfos","mBones","diffuseMatrix","logarithmicDepthConstant","time","speed"];i.AddClipPlaneUniforms(v);var m=f.toString();n.setEffect(l.getEngine().createEffect("fire",{attributes:c,uniformsNames:v,uniformBuffersNames:[],samplers:["diffuseSampler","distortionSampler","opacitySampler"],defines:m,fallbacks:d,onCompiled:this.onCompiled,onError:this.onError,indexParameters:null,maxSimultaneousLights:4,transformFeedbackVaryings:null,shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:function(){return o(r,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return 1!==this.shaderLanguage?[3,2]:[4,Promise.all([Promise.resolve().then(function(){return re}),Promise.resolve().then(function(){return se})])];case 1:return e.sent(),[3,4];case 2:return[4,Promise.all([Promise.resolve().then(function(){return ue}),Promise.resolve().then(function(){return ve})])];case 3:e.sent(),e.label=4;case 4:return this._shadersLoaded=!0,[2]}})})}},u),f,this._materialContext)}return!(!n.effect||!n.effect.isReady()||(f._renderId=l.getRenderId(),s._wasPreviouslyReady=!0,s._wasPreviouslyUsingInstances=!!t,0))},n.prototype.bindForSubMesh=function(e,n,t){var r=this.getScene(),o=t.materialDefines;if(o){var a=t.effect;a&&(this._activeEffect=a,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),i.BindBonesParameters(n,this._activeEffect),this._mustRebind(r,a,t)&&(this._diffuseTexture&&i.MaterialFlags.DiffuseTextureEnabled&&(this._activeEffect.setTexture("diffuseSampler",this._diffuseTexture),this._activeEffect.setFloat2("vDiffuseInfos",this._diffuseTexture.coordinatesIndex,this._diffuseTexture.level),this._activeEffect.setMatrix("diffuseMatrix",this._diffuseTexture.getTextureMatrix()),this._activeEffect.setTexture("distortionSampler",this._distortionTexture),this._activeEffect.setTexture("opacitySampler",this._opacityTexture)),i.BindClipPlane(this._activeEffect,this,r),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&i.BindLogDepth(o,a,r),r.bindEyePosition(a)),this._activeEffect.setColor4("vDiffuseColor",this._scaledDiffuse,this.alpha*n.visibility),r.fogEnabled&&n.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,n,this._activeEffect),this._lastTime+=r.getEngine().getDeltaTime(),this._activeEffect.setFloat("time",this._lastTime),this._activeEffect.setFloat("speed",this.speed),this._afterBind(n,this._activeEffect,t))}},n.prototype.getAnimatables=function(){var e=[];return this._diffuseTexture&&this._diffuseTexture.animations&&this._diffuseTexture.animations.length>0&&e.push(this._diffuseTexture),this._distortionTexture&&this._distortionTexture.animations&&this._distortionTexture.animations.length>0&&e.push(this._distortionTexture),this._opacityTexture&&this._opacityTexture.animations&&this._opacityTexture.animations.length>0&&e.push(this._opacityTexture),e},n.prototype.getActiveTextures=function(){var i=e.prototype.getActiveTextures.call(this);return this._diffuseTexture&&i.push(this._diffuseTexture),this._distortionTexture&&i.push(this._distortionTexture),this._opacityTexture&&i.push(this._opacityTexture),i},n.prototype.hasTexture=function(i){return!!e.prototype.hasTexture.call(this,i)||this._diffuseTexture===i||this._distortionTexture===i||this._opacityTexture===i},n.prototype.getClassName=function(){return"FireMaterial"},n.prototype.dispose=function(i){this._diffuseTexture&&this._diffuseTexture.dispose(),this._distortionTexture&&this._distortionTexture.dispose(),e.prototype.dispose.call(this,i)},n.prototype.clone=function(e){var t=this;return i.SerializationHelper.Clone(function(){return new n(e,t.getScene())},this)},n.prototype.serialize=function(){var i=e.prototype.serialize.call(this);return i.customType="BABYLON.FireMaterial",i.diffuseColor=this.diffuseColor.asArray(),i.speed=this.speed,this._diffuseTexture&&(i._diffuseTexture=this._diffuseTexture.serialize()),this._distortionTexture&&(i._distortionTexture=this._distortionTexture.serialize()),this._opacityTexture&&(i._opacityTexture=this._opacityTexture.serialize()),i},n.Parse=function(e,t,r){var o=new n(e.name,t);return o.diffuseColor=i.Color3.FromArray(e.diffuseColor),o.speed=e.speed,o.alpha=e.alpha,o.id=e.id,i.Tags.AddTagsTo(o,e.tags),o.backFaceCulling=e.backFaceCulling,o.wireframe=e.wireframe,e._diffuseTexture&&(o._diffuseTexture=i.Texture.Parse(e._diffuseTexture,t,r)),e._distortionTexture&&(o._distortionTexture=i.Texture.Parse(e._distortionTexture,t,r)),e._opacityTexture&&(o._opacityTexture=i.Texture.Parse(e._opacityTexture,t,r)),o},r([i.serializeAsTexture("diffuseTexture")],n.prototype,"_diffuseTexture",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"diffuseTexture",void 0),r([i.serializeAsTexture("distortionTexture")],n.prototype,"_distortionTexture",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"distortionTexture",void 0),r([i.serializeAsTexture("opacityTexture")],n.prototype,"_opacityTexture",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"opacityTexture",void 0),r([i.serializeAsColor3("diffuse")],n.prototype,"diffuseColor",void 0),r([i.serialize()],n.prototype,"speed",void 0),n}(i.PushMaterial);i.RegisterClass("BABYLON.FireMaterial",h);var g=function(e){function i(){var i=e.call(this)||this;return i.DIFFUSE=!1,i.HEIGHTMAP=!1,i.CLIPPLANE=!1,i.CLIPPLANE2=!1,i.CLIPPLANE3=!1,i.CLIPPLANE4=!1,i.CLIPPLANE5=!1,i.CLIPPLANE6=!1,i.ALPHATEST=!1,i.DEPTHPREPASS=!1,i.POINTSIZE=!1,i.FOG=!1,i.NORMAL=!1,i.UV1=!1,i.UV2=!1,i.VERTEXCOLOR=!1,i.VERTEXALPHA=!1,i.NUM_BONE_INFLUENCERS=0,i.BonesPerMesh=0,i.INSTANCES=!1,i.INSTANCESCOLOR=!1,i.HIGHLEVEL=!1,i.IMAGEPROCESSINGPOSTPROCESS=!1,i.SKIPFINALCOLORCLAMP=!1,i.LOGARITHMICDEPTH=!1,i.AREALIGHTSUPPORTED=!0,i.AREALIGHTNOROUGHTNESS=!0,i.rebuild(),i}return t(i,e),i}(i.MaterialDefines),S=function(e){function n(n,t,r){void 0===r&&(r=!1);var o=e.call(this,n,t,void 0,r)||this;return o.diffuseColor=new i.Color3(1,1,1),o.furLength=1,o.furAngle=0,o.furColor=new i.Color3(.44,.21,.02),o.furOffset=0,o.furSpacing=12,o.furGravity=new i.Vector3(0,0,0),o.furSpeed=100,o.furDensity=20,o.furOcclusion=0,o._disableLighting=!1,o._maxSimultaneousLights=4,o.highLevelFur=!0,o._furTime=0,o._shadersLoaded=!1,o}return t(n,e),Object.defineProperty(n.prototype,"furTime",{get:function(){return this._furTime},set:function(e){this._furTime=e},enumerable:!1,configurable:!0}),n.prototype.needAlphaBlending=function(){return this.alpha<1},n.prototype.needAlphaTesting=function(){return!1},n.prototype.getAlphaTestTexture=function(){return null},n.prototype.updateFur=function(){for(var e=1;e<this._meshes.length;e++){var i=this._meshes[e].material;i.furLength=this.furLength,i.furAngle=this.furAngle,i.furGravity=this.furGravity,i.furSpacing=this.furSpacing,i.furSpeed=this.furSpeed,i.furColor=this.furColor,i.diffuseTexture=this.diffuseTexture,i.furTexture=this.furTexture,i.highLevelFur=this.highLevelFur,i.furTime=this.furTime,i.furDensity=this.furDensity}},n.prototype.isReadyForSubMesh=function(e,n,t){var r=this,s=n._drawWrapper;if(this.isFrozen&&s.effect&&s._wasPreviouslyReady&&s._wasPreviouslyUsingInstances===t)return!0;n.materialDefines||(n.materialDefines=new g);var f=n.materialDefines,l=this.getScene();if(this._isReadyForSubMesh(n))return!0;var u=l.getEngine();if(f._areTexturesDirty&&l.texturesEnabled){if(this.diffuseTexture&&i.MaterialFlags.DiffuseTextureEnabled){if(!this.diffuseTexture.isReady())return!1;f._needUVs=!0,f.DIFFUSE=!0}if(this.heightTexture&&u.getCaps().maxVertexTextureImageUnits){if(!this.heightTexture.isReady())return!1;f._needUVs=!0,f.HEIGHTMAP=!0}}if(this.highLevelFur!==f.HIGHLEVEL&&(f.HIGHLEVEL=!0,f.markAsUnprocessed()),i.PrepareDefinesForMisc(e,l,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),f,void 0,void 0,void 0,this._isVertexOutputInvariant),f._needNormals=i.PrepareDefinesForLights(l,e,f,!1,this._maxSimultaneousLights,this._disableLighting),i.PrepareDefinesForFrameBoundValues(l,u,this,f,!!t),i.PrepareDefinesForAttributes(e,f,!0,!0),f.isDirty){f.markAsProcessed(),l.resetCachedMaterial();var d=new i.EffectFallbacks;f.FOG&&d.addFallback(1,"FOG"),i.HandleFallbacksForShadows(f,d,this.maxSimultaneousLights),f.NUM_BONE_INFLUENCERS>0&&d.addCPUSkinningFallback(0,e),f.IMAGEPROCESSINGPOSTPROCESS=l.imageProcessingConfiguration.applyByPostProcess;var c=[i.VertexBuffer.PositionKind];f.NORMAL&&c.push(i.VertexBuffer.NormalKind),f.UV1&&c.push(i.VertexBuffer.UVKind),f.UV2&&c.push(i.VertexBuffer.UV2Kind),f.VERTEXCOLOR&&c.push(i.VertexBuffer.ColorKind),i.PrepareAttributesForBones(c,e,f,d),i.PrepareAttributesForInstances(c,f);var v=f.toString(),m=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vFogInfos","vFogColor","pointSize","vDiffuseInfos","mBones","diffuseMatrix","logarithmicDepthConstant","furLength","furAngle","furColor","furOffset","furGravity","furTime","furSpacing","furDensity","furOcclusion"];i.AddClipPlaneUniforms(m);var p=["diffuseSampler","heightTexture","furTexture","areaLightsLTC1Sampler","areaLightsLTC2Sampler"],h=[];i.PrepareUniformsAndSamplersList({uniformsNames:m,uniformBuffersNames:h,samplers:p,defines:f,maxSimultaneousLights:this.maxSimultaneousLights,shaderLanguage:this._shaderLanguage}),n.setEffect(l.getEngine().createEffect("fur",{attributes:c,uniformsNames:m,uniformBuffersNames:h,samplers:p,defines:v,fallbacks:d,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:function(){return o(r,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return 1!==this.shaderLanguage?[3,2]:[4,Promise.all([Promise.resolve().then(function(){return he}),Promise.resolve().then(function(){return xe})])];case 1:return e.sent(),[3,4];case 2:return[4,Promise.all([Promise.resolve().then(function(){return Ce}),Promise.resolve().then(function(){return Ie})])];case 3:e.sent(),e.label=4;case 4:return this._shadersLoaded=!0,[2]}})})}},u),f,this._materialContext)}if(f.AREALIGHTUSED)for(var S=0;S<e.lightSources.length;S++)if(!e.lightSources[S]._isReady())return!1;return!(!n.effect||!n.effect.isReady()||(f._renderId=l.getRenderId(),s._wasPreviouslyReady=!0,s._wasPreviouslyUsingInstances=!!t,0))},n.prototype.bindForSubMesh=function(e,n,t){var r=this.getScene(),o=t.materialDefines;if(o){var a=t.effect;a&&(this._activeEffect=a,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),i.BindBonesParameters(n,this._activeEffect),this._mustRebind(r,a,t)&&(this._diffuseTexture&&i.MaterialFlags.DiffuseTextureEnabled&&(this._activeEffect.setTexture("diffuseSampler",this._diffuseTexture),this._activeEffect.setFloat2("vDiffuseInfos",this._diffuseTexture.coordinatesIndex,this._diffuseTexture.level),this._activeEffect.setMatrix("diffuseMatrix",this._diffuseTexture.getTextureMatrix())),this._heightTexture&&this._activeEffect.setTexture("heightTexture",this._heightTexture),i.BindClipPlane(this._activeEffect,this,r),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&i.BindLogDepth(o,a,r),r.bindEyePosition(a)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*n.visibility),r.lightsEnabled&&!this.disableLighting&&i.BindLights(r,n,this._activeEffect,o,this.maxSimultaneousLights),r.fogEnabled&&n.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,n,this._activeEffect),this._activeEffect.setFloat("furLength",this.furLength),this._activeEffect.setFloat("furAngle",this.furAngle),this._activeEffect.setColor4("furColor",this.furColor,1),this.highLevelFur&&(this._activeEffect.setVector3("furGravity",this.furGravity),this._activeEffect.setFloat("furOffset",this.furOffset),this._activeEffect.setFloat("furSpacing",this.furSpacing),this._activeEffect.setFloat("furDensity",this.furDensity),this._activeEffect.setFloat("furOcclusion",this.furOcclusion),this._furTime+=this.getScene().getEngine().getDeltaTime()/this.furSpeed,this._activeEffect.setFloat("furTime",this._furTime),this._activeEffect.setTexture("furTexture",this.furTexture)),this._afterBind(n,this._activeEffect,t))}},n.prototype.getAnimatables=function(){var e=[];return this.diffuseTexture&&this.diffuseTexture.animations&&this.diffuseTexture.animations.length>0&&e.push(this.diffuseTexture),this.heightTexture&&this.heightTexture.animations&&this.heightTexture.animations.length>0&&e.push(this.heightTexture),e},n.prototype.getActiveTextures=function(){var i=e.prototype.getActiveTextures.call(this);return this._diffuseTexture&&i.push(this._diffuseTexture),this._heightTexture&&i.push(this._heightTexture),i},n.prototype.hasTexture=function(i){return!!e.prototype.hasTexture.call(this,i)||this.diffuseTexture===i||this._heightTexture===i},n.prototype.dispose=function(i){if(this.diffuseTexture&&this.diffuseTexture.dispose(),this._meshes)for(var n=1;n<this._meshes.length;n++){var t=this._meshes[n].material;t&&t.dispose(i),this._meshes[n].dispose()}e.prototype.dispose.call(this,i)},n.prototype.clone=function(e){var t=this;return i.SerializationHelper.Clone(function(){return new n(e,t.getScene())},this)},n.prototype.serialize=function(){var i=e.prototype.serialize.call(this);return i.customType="BABYLON.FurMaterial",this._meshes&&(i.sourceMeshName=this._meshes[0].name,i.quality=this._meshes.length),i},n.prototype.getClassName=function(){return"FurMaterial"},n.Parse=function(e,t,r){var o=i.SerializationHelper.Parse(function(){return new n(e.name,t)},e,t,r);return e.sourceMeshName&&o.highLevelFur&&t.executeWhenReady(function(){var i=t.getMeshByName(e.sourceMeshName);if(i){var r=n.GenerateTexture("Fur Texture",t);o.furTexture=r,n.FurifyMesh(i,e.quality)}}),o},n.GenerateTexture=function(e,n){for(var t=new i.DynamicTexture("FurTexture "+e,256,n,!0),r=t.getContext(),o=0;o<2e4;++o)r.fillStyle="rgba(255, "+Math.floor(255*Math.random())+", "+Math.floor(255*Math.random())+", 1)",r.fillRect(Math.random()*t.getSize().width,Math.random()*t.getSize().height,2,2);return t.update(!1),t.wrapU=i.Texture.WRAP_ADDRESSMODE,t.wrapV=i.Texture.WRAP_ADDRESSMODE,t},n.FurifyMesh=function(e,t){var r,o=[e],a=e.material;if(!(a instanceof n))throw"The material of the source mesh must be a Fur Material";for(r=1;r<t;r++){var s=new n(a.name+r,e.getScene());e.getScene().materials.pop(),i.Tags.EnableFor(s),i.Tags.AddTagsTo(s,"furShellMaterial"),s.furLength=a.furLength,s.furAngle=a.furAngle,s.furGravity=a.furGravity,s.furSpacing=a.furSpacing,s.furSpeed=a.furSpeed,s.furColor=a.furColor,s.diffuseTexture=a.diffuseTexture,s.furOffset=r/t,s.furTexture=a.furTexture,s.highLevelFur=a.highLevelFur,s.furTime=a.furTime,s.furDensity=a.furDensity;var f=e.clone(e.name+r);f.material=s,f.skeleton=e.skeleton,f.position=i.Vector3.Zero(),o.push(f)}for(r=1;r<o.length;r++)o[r].parent=e;return e.material._meshes=o,o},r([i.serializeAsTexture("diffuseTexture")],n.prototype,"_diffuseTexture",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"diffuseTexture",void 0),r([i.serializeAsTexture("heightTexture")],n.prototype,"_heightTexture",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"heightTexture",void 0),r([i.serializeAsColor3()],n.prototype,"diffuseColor",void 0),r([i.serialize()],n.prototype,"furLength",void 0),r([i.serialize()],n.prototype,"furAngle",void 0),r([i.serializeAsColor3()],n.prototype,"furColor",void 0),r([i.serialize()],n.prototype,"furOffset",void 0),r([i.serialize()],n.prototype,"furSpacing",void 0),r([i.serializeAsVector3()],n.prototype,"furGravity",void 0),r([i.serialize()],n.prototype,"furSpeed",void 0),r([i.serialize()],n.prototype,"furDensity",void 0),r([i.serialize()],n.prototype,"furOcclusion",void 0),r([i.serialize("disableLighting")],n.prototype,"_disableLighting",void 0),r([i.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"disableLighting",void 0),r([i.serialize("maxSimultaneousLights")],n.prototype,"_maxSimultaneousLights",void 0),r([i.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"maxSimultaneousLights",void 0),r([i.serialize()],n.prototype,"highLevelFur",void 0),r([i.serialize()],n.prototype,"furTime",null),n}(i.PushMaterial);i.RegisterClass("BABYLON.FurMaterial",S);var x=function(e){function i(){var i=e.call(this)||this;return i.EMISSIVE=!1,i.CLIPPLANE=!1,i.CLIPPLANE2=!1,i.CLIPPLANE3=!1,i.CLIPPLANE4=!1,i.CLIPPLANE5=!1,i.CLIPPLANE6=!1,i.ALPHATEST=!1,i.DEPTHPREPASS=!1,i.POINTSIZE=!1,i.FOG=!1,i.NORMAL=!1,i.UV1=!1,i.UV2=!1,i.VERTEXCOLOR=!1,i.VERTEXALPHA=!1,i.NUM_BONE_INFLUENCERS=0,i.BonesPerMesh=0,i.INSTANCES=!1,i.INSTANCESCOLOR=!1,i.IMAGEPROCESSINGPOSTPROCESS=!1,i.SKIPFINALCOLORCLAMP=!1,i.LOGARITHMICDEPTH=!1,i.AREALIGHTSUPPORTED=!0,i.AREALIGHTNOROUGHTNESS=!0,i.rebuild(),i}return t(i,e),i}(i.MaterialDefines),T=function(e){function n(n,t,r){void 0===r&&(r=!1);var o=e.call(this,n,t,void 0,r)||this;return o._maxSimultaneousLights=4,o.topColor=new i.Color3(1,0,0),o.topColorAlpha=1,o.bottomColor=new i.Color3(0,0,1),o.bottomColorAlpha=1,o.offset=0,o.scale=1,o.smoothness=1,o._disableLighting=!1,o._shadersLoaded=!1,o}return t(n,e),n.prototype.needAlphaBlending=function(){return this.alpha<1||this.topColorAlpha<1||this.bottomColorAlpha<1},n.prototype.needAlphaTesting=function(){return!0},n.prototype.getAlphaTestTexture=function(){return null},n.prototype.isReadyForSubMesh=function(e,n,t){var r=this,s=n._drawWrapper;if(this.isFrozen&&s.effect&&s._wasPreviouslyReady&&s._wasPreviouslyUsingInstances===t)return!0;n.materialDefines||(n.materialDefines=new x);var f=n.materialDefines,l=this.getScene();if(this._isReadyForSubMesh(n))return!0;var u=l.getEngine();if(i.PrepareDefinesForFrameBoundValues(l,u,this,f,!!t),i.PrepareDefinesForMisc(e,l,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),f,void 0,void 0,void 0,this._isVertexOutputInvariant),f._needNormals=i.PrepareDefinesForLights(l,e,f,!1,this._maxSimultaneousLights,this._disableLighting),f.EMISSIVE=this._disableLighting,i.PrepareDefinesForAttributes(e,f,!1,!0),f.isDirty){f.markAsProcessed(),l.resetCachedMaterial();var d=new i.EffectFallbacks;f.FOG&&d.addFallback(1,"FOG"),i.HandleFallbacksForShadows(f,d),f.NUM_BONE_INFLUENCERS>0&&d.addCPUSkinningFallback(0,e),f.IMAGEPROCESSINGPOSTPROCESS=l.imageProcessingConfiguration.applyByPostProcess;var c=[i.VertexBuffer.PositionKind];f.NORMAL&&c.push(i.VertexBuffer.NormalKind),f.UV1&&c.push(i.VertexBuffer.UVKind),f.UV2&&c.push(i.VertexBuffer.UV2Kind),f.VERTEXCOLOR&&c.push(i.VertexBuffer.ColorKind),i.PrepareAttributesForBones(c,e,f,d),i.PrepareAttributesForInstances(c,f);var v=f.toString(),m=["world","view","viewProjection","vEyePosition","vLightsType","vFogInfos","vFogColor","pointSize","mBones","logarithmicDepthConstant","topColor","bottomColor","offset","smoothness","scale"];i.AddClipPlaneUniforms(m);var p=["areaLightsLTC1Sampler","areaLightsLTC2Sampler"],h=[];i.PrepareUniformsAndSamplersList({uniformsNames:m,uniformBuffersNames:h,samplers:p,defines:f,maxSimultaneousLights:4,shaderLanguage:this._shaderLanguage}),n.setEffect(l.getEngine().createEffect("gradient",{attributes:c,uniformsNames:m,uniformBuffersNames:h,samplers:p,defines:v,fallbacks:d,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:function(){return o(r,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return 1!==this.shaderLanguage?[3,2]:[4,Promise.all([Promise.resolve().then(function(){return Ae}),Promise.resolve().then(function(){return Ne})])];case 1:return e.sent(),[3,4];case 2:return[4,Promise.all([Promise.resolve().then(function(){return Me}),Promise.resolve().then(function(){return Ue})])];case 3:e.sent(),e.label=4;case 4:return this._shadersLoaded=!0,[2]}})})}},u),f,this._materialContext)}if(f.AREALIGHTUSED)for(var g=0;g<e.lightSources.length;g++)if(!e.lightSources[g]._isReady())return!1;return!(!n.effect||!n.effect.isReady()||(f._renderId=l.getRenderId(),s._wasPreviouslyReady=!0,s._wasPreviouslyUsingInstances=!!t,0))},n.prototype.bindForSubMesh=function(e,n,t){var r=this.getScene(),o=t.materialDefines;if(o){var a=t.effect;a&&(this._activeEffect=a,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),i.BindBonesParameters(n,a),this._mustRebind(r,a,t)&&(i.BindClipPlane(a,this,r),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&i.BindLogDepth(o,a,r),r.bindEyePosition(a)),r.lightsEnabled&&!this.disableLighting&&i.BindLights(r,n,this._activeEffect,o,this.maxSimultaneousLights),r.fogEnabled&&n.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,n,this._activeEffect),this._activeEffect.setColor4("topColor",this.topColor,this.topColorAlpha),this._activeEffect.setColor4("bottomColor",this.bottomColor,this.bottomColorAlpha),this._activeEffect.setFloat("offset",this.offset),this._activeEffect.setFloat("scale",this.scale),this._activeEffect.setFloat("smoothness",this.smoothness),this._afterBind(n,this._activeEffect,t))}},n.prototype.getAnimatables=function(){return[]},n.prototype.dispose=function(i){e.prototype.dispose.call(this,i)},n.prototype.clone=function(e){var t=this;return i.SerializationHelper.Clone(function(){return new n(e,t.getScene())},this)},n.prototype.serialize=function(){var i=e.prototype.serialize.call(this);return i.customType="BABYLON.GradientMaterial",i},n.prototype.getClassName=function(){return"GradientMaterial"},n.Parse=function(e,t,r){return i.SerializationHelper.Parse(function(){return new n(e.name,t)},e,t,r)},r([i.serialize("maxSimultaneousLights")],n.prototype,"_maxSimultaneousLights",void 0),r([i.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"maxSimultaneousLights",void 0),r([i.serializeAsColor3()],n.prototype,"topColor",void 0),r([i.serialize()],n.prototype,"topColorAlpha",void 0),r([i.serializeAsColor3()],n.prototype,"bottomColor",void 0),r([i.serialize()],n.prototype,"bottomColorAlpha",void 0),r([i.serialize()],n.prototype,"offset",void 0),r([i.serialize()],n.prototype,"scale",void 0),r([i.serialize()],n.prototype,"smoothness",void 0),r([i.serialize("disableLighting")],n.prototype,"_disableLighting",void 0),r([i.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"disableLighting",void 0),n}(i.PushMaterial);i.RegisterClass("BABYLON.GradientMaterial",T);var _=function(e){function i(){var i=e.call(this)||this;return i.CLIPPLANE=!1,i.CLIPPLANE2=!1,i.CLIPPLANE3=!1,i.CLIPPLANE4=!1,i.CLIPPLANE5=!1,i.CLIPPLANE6=!1,i.OPACITY=!1,i.ANTIALIAS=!1,i.TRANSPARENT=!1,i.FOG=!1,i.PREMULTIPLYALPHA=!1,i.MAX_LINE=!1,i.UV1=!1,i.UV2=!1,i.INSTANCES=!1,i.THIN_INSTANCES=!1,i.IMAGEPROCESSINGPOSTPROCESS=!1,i.SKIPFINALCOLORCLAMP=!1,i.LOGARITHMICDEPTH=!1,i.rebuild(),i}return t(i,e),i}(i.MaterialDefines),C=function(e){function n(n,t,r){void 0===r&&(r=!1);var o=e.call(this,n,t,void 0,r)||this;return o.mainColor=i.Color3.Black(),o.lineColor=i.Color3.Teal(),o.gridRatio=1,o.gridOffset=i.Vector3.Zero(),o.majorUnitFrequency=10,o.minorUnitVisibility=.33,o.opacity=1,o.antialias=!0,o.preMultiplyAlpha=!1,o.useMaxLine=!1,o._gridControl=new i.Vector4(o.gridRatio,o.majorUnitFrequency,o.minorUnitVisibility,o.opacity),o._shadersLoaded=!1,o}return t(n,e),n.prototype.needAlphaBlending=function(){return this.opacity<1||this._opacityTexture&&this._opacityTexture.isReady()},n.prototype.needAlphaBlendingForMesh=function(e){return e.visibility<1||this.needAlphaBlending()},n.prototype.isReadyForSubMesh=function(e,n,t){var r=this,s=n._drawWrapper;if(this.isFrozen&&s.effect&&s._wasPreviouslyReady&&s._wasPreviouslyUsingInstances===t)return!0;n.materialDefines||(n.materialDefines=new _);var f=n.materialDefines,l=this.getScene();if(this._isReadyForSubMesh(n))return!0;if(f.TRANSPARENT!==this.opacity<1&&(f.TRANSPARENT=!f.TRANSPARENT,f.markAsUnprocessed()),f.PREMULTIPLYALPHA!=this.preMultiplyAlpha&&(f.PREMULTIPLYALPHA=!f.PREMULTIPLYALPHA,f.markAsUnprocessed()),f.MAX_LINE!==this.useMaxLine&&(f.MAX_LINE=!f.MAX_LINE,f.markAsUnprocessed()),f.ANTIALIAS!==this.antialias&&(f.ANTIALIAS=!f.ANTIALIAS,f.markAsUnprocessed()),f._areTexturesDirty&&(f._needUVs=!1,l.texturesEnabled&&this._opacityTexture&&i.MaterialFlags.OpacityTextureEnabled)){if(!this._opacityTexture.isReady())return!1;f._needUVs=!0,f.OPACITY=!0}if(i.PrepareDefinesForMisc(e,l,this._useLogarithmicDepth,!1,this.fogEnabled,!1,f,void 0,void 0,void 0,this._isVertexOutputInvariant),i.PrepareDefinesForFrameBoundValues(l,l.getEngine(),this,f,!!t),f.isDirty){f.markAsProcessed(),l.resetCachedMaterial(),i.PrepareDefinesForAttributes(e,f,!1,!1);var u=[i.VertexBuffer.PositionKind,i.VertexBuffer.NormalKind];f.UV1&&u.push(i.VertexBuffer.UVKind),f.UV2&&u.push(i.VertexBuffer.UV2Kind),f.IMAGEPROCESSINGPOSTPROCESS=l.imageProcessingConfiguration.applyByPostProcess,i.PrepareAttributesForInstances(u,f);var d=["projection","mainColor","lineColor","gridControl","gridOffset","vFogInfos","vFogColor","world","view","opacityMatrix","vOpacityInfos","visibility","logarithmicDepthConstant"],c=f.toString();i.AddClipPlaneUniforms(d),n.setEffect(l.getEngine().createEffect("grid",{attributes:u,uniformsNames:d,uniformBuffersNames:["Scene"],samplers:["opacitySampler"],defines:c,fallbacks:null,onCompiled:this.onCompiled,onError:this.onError,shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:function(){return o(r,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return 1!==this.shaderLanguage?[3,2]:[4,Promise.all([Promise.resolve().then(function(){return ze}),Promise.resolve().then(function(){return We})])];case 1:return e.sent(),[3,4];case 2:return[4,Promise.all([Promise.resolve().then(function(){return je}),Promise.resolve().then(function(){return Ke})])];case 3:e.sent(),e.label=4;case 4:return this._shadersLoaded=!0,[2]}})})}},l.getEngine()),f,this._materialContext)}return!(!n.effect||!n.effect.isReady()||(f._renderId=l.getRenderId(),s._wasPreviouslyReady=!0,s._wasPreviouslyUsingInstances=!!t,0))},n.prototype.bindForSubMesh=function(e,n,t){var r=this.getScene(),o=t.materialDefines;if(o){var a=t.effect;a&&(this._activeEffect=a,this._activeEffect.setFloat("visibility",n.visibility),o.INSTANCES&&!o.THIN_INSTANCE||this.bindOnlyWorldMatrix(e),this.bindView(a),this.bindViewProjection(a),this._mustRebind(r,a,t)&&(this._activeEffect.setColor3("mainColor",this.mainColor),this._activeEffect.setColor3("lineColor",this.lineColor),this._activeEffect.setVector3("gridOffset",this.gridOffset),this._gridControl.x=this.gridRatio,this._gridControl.y=Math.round(this.majorUnitFrequency),this._gridControl.z=this.minorUnitVisibility,this._gridControl.w=this.opacity,this._activeEffect.setVector4("gridControl",this._gridControl),this._opacityTexture&&i.MaterialFlags.OpacityTextureEnabled&&(this._activeEffect.setTexture("opacitySampler",this._opacityTexture),this._activeEffect.setFloat2("vOpacityInfos",this._opacityTexture.coordinatesIndex,this._opacityTexture.level),this._activeEffect.setMatrix("opacityMatrix",this._opacityTexture.getTextureMatrix())),i.BindClipPlane(a,this,r),this._useLogarithmicDepth&&i.BindLogDepth(o,a,r)),i.BindFogParameters(r,n,this._activeEffect),this._afterBind(n,this._activeEffect,t))}},n.prototype.dispose=function(i){e.prototype.dispose.call(this,i)},n.prototype.clone=function(e){var t=this;return i.SerializationHelper.Clone(function(){return new n(e,t.getScene())},this)},n.prototype.serialize=function(){var i=e.prototype.serialize.call(this);return i.customType="BABYLON.GridMaterial",i},n.prototype.getClassName=function(){return"GridMaterial"},n.Parse=function(e,t,r){return i.SerializationHelper.Parse(function(){return new n(e.name,t)},e,t,r)},r([i.serializeAsColor3()],n.prototype,"mainColor",void 0),r([i.serializeAsColor3()],n.prototype,"lineColor",void 0),r([i.serialize()],n.prototype,"gridRatio",void 0),r([i.serializeAsVector3()],n.prototype,"gridOffset",void 0),r([i.serialize()],n.prototype,"majorUnitFrequency",void 0),r([i.serialize()],n.prototype,"minorUnitVisibility",void 0),r([i.serialize()],n.prototype,"opacity",void 0),r([i.serialize()],n.prototype,"antialias",void 0),r([i.serialize()],n.prototype,"preMultiplyAlpha",void 0),r([i.serialize()],n.prototype,"useMaxLine",void 0),r([i.serializeAsTexture("opacityTexture")],n.prototype,"_opacityTexture",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"opacityTexture",void 0),n}(i.PushMaterial);i.RegisterClass("BABYLON.GridMaterial",C);var E=function(e){function i(){var i=e.call(this)||this;return i.DIFFUSE=!1,i.CLIPPLANE=!1,i.CLIPPLANE2=!1,i.CLIPPLANE3=!1,i.CLIPPLANE4=!1,i.CLIPPLANE5=!1,i.CLIPPLANE6=!1,i.ALPHATEST=!1,i.DEPTHPREPASS=!1,i.POINTSIZE=!1,i.FOG=!1,i.LIGHT0=!1,i.LIGHT1=!1,i.LIGHT2=!1,i.LIGHT3=!1,i.SPOTLIGHT0=!1,i.SPOTLIGHT1=!1,i.SPOTLIGHT2=!1,i.SPOTLIGHT3=!1,i.HEMILIGHT0=!1,i.HEMILIGHT1=!1,i.HEMILIGHT2=!1,i.HEMILIGHT3=!1,i.DIRLIGHT0=!1,i.DIRLIGHT1=!1,i.DIRLIGHT2=!1,i.DIRLIGHT3=!1,i.POINTLIGHT0=!1,i.POINTLIGHT1=!1,i.POINTLIGHT2=!1,i.POINTLIGHT3=!1,i.SHADOW0=!1,i.SHADOW1=!1,i.SHADOW2=!1,i.SHADOW3=!1,i.SHADOWS=!1,i.SHADOWESM0=!1,i.SHADOWESM1=!1,i.SHADOWESM2=!1,i.SHADOWESM3=!1,i.SHADOWPOISSON0=!1,i.SHADOWPOISSON1=!1,i.SHADOWPOISSON2=!1,i.SHADOWPOISSON3=!1,i.SHADOWPCF0=!1,i.SHADOWPCF1=!1,i.SHADOWPCF2=!1,i.SHADOWPCF3=!1,i.SHADOWPCSS0=!1,i.SHADOWPCSS1=!1,i.SHADOWPCSS2=!1,i.SHADOWPCSS3=!1,i.NORMAL=!1,i.UV1=!1,i.UV2=!1,i.VERTEXCOLOR=!1,i.VERTEXALPHA=!1,i.NUM_BONE_INFLUENCERS=0,i.BonesPerMesh=0,i.INSTANCES=!1,i.INSTANCESCOLOR=!1,i.UNLIT=!1,i.IMAGEPROCESSINGPOSTPROCESS=!1,i.SKIPFINALCOLORCLAMP=!1,i.LOGARITHMICDEPTH=!1,i.AREALIGHTSUPPORTED=!0,i.AREALIGHTNOROUGHTNESS=!0,i.rebuild(),i}return t(i,e),i}(i.MaterialDefines),P=function(e){function n(n,t,r){void 0===r&&(r=!1);var o=e.call(this,n,t,void 0,r)||this;return o.speed=1,o.movingSpeed=1,o.lowFrequencySpeed=1,o.fogDensity=.15,o._lastTime=0,o.diffuseColor=new i.Color3(1,1,1),o._disableLighting=!1,o._unlit=!1,o._maxSimultaneousLights=4,o._scaledDiffuse=new i.Color3,o._shadersLoaded=!1,o}return t(n,e),n.prototype.needAlphaBlending=function(){return this.alpha<1},n.prototype.needAlphaTesting=function(){return!1},n.prototype.getAlphaTestTexture=function(){return null},n.prototype.isReadyForSubMesh=function(e,n,t){var r=this,s=n._drawWrapper;if(this.isFrozen&&s.effect&&s._wasPreviouslyReady&&s._wasPreviouslyUsingInstances===t)return!0;n.materialDefines||(n.materialDefines=new E);var f=n.materialDefines,l=this.getScene();if(this._isReadyForSubMesh(n))return!0;var u=l.getEngine();if(f._areTexturesDirty&&(f._needUVs=!1,l.texturesEnabled&&this._diffuseTexture&&i.MaterialFlags.DiffuseTextureEnabled)){if(!this._diffuseTexture.isReady())return!1;f._needUVs=!0,f.DIFFUSE=!0}if(i.PrepareDefinesForMisc(e,l,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),f,void 0,void 0,void 0,this._isVertexOutputInvariant),f._needNormals=!0,i.PrepareDefinesForLights(l,e,f,!1,this._maxSimultaneousLights,this._disableLighting),i.PrepareDefinesForFrameBoundValues(l,u,this,f,!!t),i.PrepareDefinesForAttributes(e,f,!0,!0),f.isDirty){f.markAsProcessed(),l.resetCachedMaterial();var d=new i.EffectFallbacks;f.FOG&&d.addFallback(1,"FOG"),i.HandleFallbacksForShadows(f,d),f.NUM_BONE_INFLUENCERS>0&&d.addCPUSkinningFallback(0,e),f.IMAGEPROCESSINGPOSTPROCESS=l.imageProcessingConfiguration.applyByPostProcess;var c=[i.VertexBuffer.PositionKind];f.NORMAL&&c.push(i.VertexBuffer.NormalKind),f.UV1&&c.push(i.VertexBuffer.UVKind),f.UV2&&c.push(i.VertexBuffer.UV2Kind),f.VERTEXCOLOR&&c.push(i.VertexBuffer.ColorKind),i.PrepareAttributesForBones(c,e,f,d),i.PrepareAttributesForInstances(c,f);var v=f.toString(),m=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vFogInfos","vFogColor","pointSize","vDiffuseInfos","mBones","diffuseMatrix","logarithmicDepthConstant","time","speed","movingSpeed","fogColor","fogDensity","lowFrequencySpeed"];i.AddClipPlaneUniforms(m);var p=["diffuseSampler","noiseTexture","areaLightsLTC1Sampler","areaLightsLTC2Sampler"],h=[];i.PrepareUniformsAndSamplersList({uniformsNames:m,uniformBuffersNames:h,samplers:p,defines:f,maxSimultaneousLights:this.maxSimultaneousLights,shaderLanguage:this._shaderLanguage}),n.setEffect(l.getEngine().createEffect("lava",{attributes:c,uniformsNames:m,uniformBuffersNames:h,samplers:p,defines:v,fallbacks:d,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:function(){return o(r,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return 1!==this.shaderLanguage?[3,2]:[4,Promise.all([Promise.resolve().then(function(){return Je}),Promise.resolve().then(function(){return ii})])];case 1:return e.sent(),[3,4];case 2:return[4,Promise.all([Promise.resolve().then(function(){return ri}),Promise.resolve().then(function(){return si})])];case 3:e.sent(),e.label=4;case 4:return this._shadersLoaded=!0,[2]}})})}},u),f,this._materialContext)}if(f.AREALIGHTUSED)for(var g=0;g<e.lightSources.length;g++)if(!e.lightSources[g]._isReady())return!1;return!(!n.effect||!n.effect.isReady()||(f._renderId=l.getRenderId(),s._wasPreviouslyReady=!0,s._wasPreviouslyUsingInstances=!!t,0))},n.prototype.bindForSubMesh=function(e,n,t){var r=this.getScene(),o=t.materialDefines;if(o){var a=t.effect;a&&(this._activeEffect=a,o.UNLIT=this._unlit,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),i.BindBonesParameters(n,this._activeEffect),this._mustRebind(r,a,t)&&(this.diffuseTexture&&i.MaterialFlags.DiffuseTextureEnabled&&(this._activeEffect.setTexture("diffuseSampler",this.diffuseTexture),this._activeEffect.setFloat2("vDiffuseInfos",this.diffuseTexture.coordinatesIndex,this.diffuseTexture.level),this._activeEffect.setMatrix("diffuseMatrix",this.diffuseTexture.getTextureMatrix())),this.noiseTexture&&this._activeEffect.setTexture("noiseTexture",this.noiseTexture),i.BindClipPlane(a,this,r),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&i.BindLogDepth(o,a,r),r.bindEyePosition(a)),this._activeEffect.setColor4("vDiffuseColor",this._scaledDiffuse,this.alpha*n.visibility),r.lightsEnabled&&!this.disableLighting&&i.BindLights(r,n,this._activeEffect,o),r.fogEnabled&&n.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,n,this._activeEffect),this._lastTime+=r.getEngine().getDeltaTime(),this._activeEffect.setFloat("time",this._lastTime*this.speed/1e3),this.fogColor||(this.fogColor=i.Color3.Black()),this._activeEffect.setColor3("fogColor",this.fogColor),this._activeEffect.setFloat("fogDensity",this.fogDensity),this._activeEffect.setFloat("lowFrequencySpeed",this.lowFrequencySpeed),this._activeEffect.setFloat("movingSpeed",this.movingSpeed),this._afterBind(n,this._activeEffect,t))}},n.prototype.getAnimatables=function(){var e=[];return this.diffuseTexture&&this.diffuseTexture.animations&&this.diffuseTexture.animations.length>0&&e.push(this.diffuseTexture),this.noiseTexture&&this.noiseTexture.animations&&this.noiseTexture.animations.length>0&&e.push(this.noiseTexture),e},n.prototype.getActiveTextures=function(){var i=e.prototype.getActiveTextures.call(this);return this._diffuseTexture&&i.push(this._diffuseTexture),i},n.prototype.hasTexture=function(i){return!!e.prototype.hasTexture.call(this,i)||this.diffuseTexture===i},n.prototype.dispose=function(i){this.diffuseTexture&&this.diffuseTexture.dispose(),this.noiseTexture&&this.noiseTexture.dispose(),e.prototype.dispose.call(this,i)},n.prototype.clone=function(e){var t=this;return i.SerializationHelper.Clone(function(){return new n(e,t.getScene())},this)},n.prototype.serialize=function(){var i=e.prototype.serialize.call(this);return i.customType="BABYLON.LavaMaterial",i},n.prototype.getClassName=function(){return"LavaMaterial"},n.Parse=function(e,t,r){return i.SerializationHelper.Parse(function(){return new n(e.name,t)},e,t,r)},r([i.serializeAsTexture("diffuseTexture")],n.prototype,"_diffuseTexture",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"diffuseTexture",void 0),r([i.serializeAsTexture()],n.prototype,"noiseTexture",void 0),r([i.serializeAsColor3()],n.prototype,"fogColor",void 0),r([i.serialize()],n.prototype,"speed",void 0),r([i.serialize()],n.prototype,"movingSpeed",void 0),r([i.serialize()],n.prototype,"lowFrequencySpeed",void 0),r([i.serialize()],n.prototype,"fogDensity",void 0),r([i.serializeAsColor3()],n.prototype,"diffuseColor",void 0),r([i.serialize("disableLighting")],n.prototype,"_disableLighting",void 0),r([i.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"disableLighting",void 0),r([i.serialize("unlit")],n.prototype,"_unlit",void 0),r([i.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"unlit",void 0),r([i.serialize("maxSimultaneousLights")],n.prototype,"_maxSimultaneousLights",void 0),r([i.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"maxSimultaneousLights",void 0),n}(i.PushMaterial);i.RegisterClass("BABYLON.LavaMaterial",P);var I=function(e){function i(){var i=e.call(this)||this;return i.DIFFUSE=!1,i.CLIPPLANE=!1,i.CLIPPLANE2=!1,i.CLIPPLANE3=!1,i.CLIPPLANE4=!1,i.CLIPPLANE5=!1,i.CLIPPLANE6=!1,i.ALPHATEST=!1,i.DEPTHPREPASS=!1,i.POINTSIZE=!1,i.FOG=!1,i.SPECULARTERM=!1,i.NORMAL=!1,i.UV1=!1,i.UV2=!1,i.VERTEXCOLOR=!1,i.VERTEXALPHA=!1,i.NUM_BONE_INFLUENCERS=0,i.BonesPerMesh=0,i.INSTANCES=!1,i.INSTANCESCOLOR=!1,i.MIXMAP2=!1,i.IMAGEPROCESSINGPOSTPROCESS=!1,i.SKIPFINALCOLORCLAMP=!1,i.LOGARITHMICDEPTH=!1,i.rebuild(),i}return t(i,e),i}(i.MaterialDefines),y=function(e){function n(n,t,r){void 0===r&&(r=!1);var o=e.call(this,n,t,void 0,r)||this;return o.diffuseColor=new i.Color3(1,1,1),o.specularColor=new i.Color3(0,0,0),o.specularPower=64,o._disableLighting=!1,o._maxSimultaneousLights=4,o._shadersLoaded=!1,o}return t(n,e),n.prototype.needAlphaBlending=function(){return this.alpha<1},n.prototype.needAlphaTesting=function(){return!1},n.prototype.getAlphaTestTexture=function(){return null},n.prototype.isReadyForSubMesh=function(e,n,t){var r=this,s=n._drawWrapper;if(this.isFrozen&&s.effect&&s._wasPreviouslyReady&&s._wasPreviouslyUsingInstances===t)return!0;n.materialDefines||(n.materialDefines=new I);var f=n.materialDefines,l=this.getScene();if(this._isReadyForSubMesh(n))return!0;var u=l.getEngine();if(l.texturesEnabled){if(!this._mixTexture1||!this._mixTexture1.isReady())return!1;if(f._needUVs=!0,i.MaterialFlags.DiffuseTextureEnabled){if(!this._diffuseTexture1||!this._diffuseTexture1.isReady())return!1;if(f.DIFFUSE=!0,!this._diffuseTexture2||!this._diffuseTexture2.isReady())return!1;if(!this._diffuseTexture3||!this._diffuseTexture3.isReady())return!1;if(!this._diffuseTexture4||!this._diffuseTexture4.isReady())return!1;if(this._mixTexture2){if(!this._mixTexture2.isReady())return!1;if(f.MIXMAP2=!0,!this._diffuseTexture5||!this._diffuseTexture5.isReady())return!1;if(!this._diffuseTexture6||!this._diffuseTexture6.isReady())return!1;if(!this._diffuseTexture7||!this._diffuseTexture7.isReady())return!1;if(!this._diffuseTexture8||!this._diffuseTexture8.isReady())return!1}}}if(i.PrepareDefinesForMisc(e,l,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),f,void 0,void 0,void 0,this._isVertexOutputInvariant),f._needNormals=i.PrepareDefinesForLights(l,e,f,!1,this._maxSimultaneousLights,this._disableLighting),i.PrepareDefinesForFrameBoundValues(l,u,this,f,!!t),i.PrepareDefinesForAttributes(e,f,!0,!0),f.isDirty){f.markAsProcessed(),l.resetCachedMaterial();var d=new i.EffectFallbacks;f.FOG&&d.addFallback(1,"FOG"),i.HandleFallbacksForShadows(f,d,this.maxSimultaneousLights),f.NUM_BONE_INFLUENCERS>0&&d.addCPUSkinningFallback(0,e),f.IMAGEPROCESSINGPOSTPROCESS=l.imageProcessingConfiguration.applyByPostProcess;var c=[i.VertexBuffer.PositionKind];f.NORMAL&&c.push(i.VertexBuffer.NormalKind),f.UV1&&c.push(i.VertexBuffer.UVKind),f.UV2&&c.push(i.VertexBuffer.UV2Kind),f.VERTEXCOLOR&&c.push(i.VertexBuffer.ColorKind),i.PrepareAttributesForBones(c,e,f,d),i.PrepareAttributesForInstances(c,f);var v=f.toString(),m=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vSpecularColor","vFogInfos","vFogColor","pointSize","vTextureInfos","mBones","textureMatrix","logarithmicDepthConstant","diffuse1Infos","diffuse2Infos","diffuse3Infos","diffuse4Infos","diffuse5Infos","diffuse6Infos","diffuse7Infos","diffuse8Infos"],p=["mixMap1Sampler","mixMap2Sampler","diffuse1Sampler","diffuse2Sampler","diffuse3Sampler","diffuse4Sampler","diffuse5Sampler","diffuse6Sampler","diffuse7Sampler","diffuse8Sampler"],h=[];i.AddClipPlaneUniforms(m),i.PrepareUniformsAndSamplersList({uniformsNames:m,uniformBuffersNames:h,samplers:p,defines:f,maxSimultaneousLights:this.maxSimultaneousLights,shaderLanguage:this._shaderLanguage}),n.setEffect(l.getEngine().createEffect("mix",{attributes:c,uniformsNames:m,uniformBuffersNames:h,samplers:p,defines:v,fallbacks:d,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:function(){return o(r,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return 1!==this.shaderLanguage?[3,2]:[4,Promise.all([Promise.resolve().then(function(){return ui}),Promise.resolve().then(function(){return vi})])];case 1:return e.sent(),[3,4];case 2:return[4,Promise.all([Promise.resolve().then(function(){return hi}),Promise.resolve().then(function(){return xi})])];case 3:e.sent(),e.label=4;case 4:return this._shadersLoaded=!0,[2]}})})}},u),f,this._materialContext)}return!(!n.effect||!n.effect.isReady()||(f._renderId=l.getRenderId(),s._wasPreviouslyReady=!0,s._wasPreviouslyUsingInstances=!!t,0))},n.prototype.bindForSubMesh=function(e,n,t){var r=this.getScene(),o=t.materialDefines;if(o){var a=t.effect;a&&(this._activeEffect=a,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),i.BindBonesParameters(n,this._activeEffect),this._mustRebind(r,a,t)&&(this._mixTexture1&&(this._activeEffect.setTexture("mixMap1Sampler",this._mixTexture1),this._activeEffect.setFloat2("vTextureInfos",this._mixTexture1.coordinatesIndex,this._mixTexture1.level),this._activeEffect.setMatrix("textureMatrix",this._mixTexture1.getTextureMatrix()),i.MaterialFlags.DiffuseTextureEnabled&&(this._diffuseTexture1&&(this._activeEffect.setTexture("diffuse1Sampler",this._diffuseTexture1),this._activeEffect.setFloat2("diffuse1Infos",this._diffuseTexture1.uScale,this._diffuseTexture1.vScale)),this._diffuseTexture2&&(this._activeEffect.setTexture("diffuse2Sampler",this._diffuseTexture2),this._activeEffect.setFloat2("diffuse2Infos",this._diffuseTexture2.uScale,this._diffuseTexture2.vScale)),this._diffuseTexture3&&(this._activeEffect.setTexture("diffuse3Sampler",this._diffuseTexture3),this._activeEffect.setFloat2("diffuse3Infos",this._diffuseTexture3.uScale,this._diffuseTexture3.vScale)),this._diffuseTexture4&&(this._activeEffect.setTexture("diffuse4Sampler",this._diffuseTexture4),this._activeEffect.setFloat2("diffuse4Infos",this._diffuseTexture4.uScale,this._diffuseTexture4.vScale)))),this._mixTexture2&&(this._activeEffect.setTexture("mixMap2Sampler",this._mixTexture2),i.MaterialFlags.DiffuseTextureEnabled&&(this._diffuseTexture5&&(this._activeEffect.setTexture("diffuse5Sampler",this._diffuseTexture5),this._activeEffect.setFloat2("diffuse5Infos",this._diffuseTexture5.uScale,this._diffuseTexture5.vScale)),this._diffuseTexture6&&(this._activeEffect.setTexture("diffuse6Sampler",this._diffuseTexture6),this._activeEffect.setFloat2("diffuse6Infos",this._diffuseTexture6.uScale,this._diffuseTexture6.vScale)),this._diffuseTexture7&&(this._activeEffect.setTexture("diffuse7Sampler",this._diffuseTexture7),this._activeEffect.setFloat2("diffuse7Infos",this._diffuseTexture7.uScale,this._diffuseTexture7.vScale)),this._diffuseTexture8&&(this._activeEffect.setTexture("diffuse8Sampler",this._diffuseTexture8),this._activeEffect.setFloat2("diffuse8Infos",this._diffuseTexture8.uScale,this._diffuseTexture8.vScale)))),i.BindClipPlane(a,this,r),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&i.BindLogDepth(o,a,r),r.bindEyePosition(a)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*n.visibility),o.SPECULARTERM&&this._activeEffect.setColor4("vSpecularColor",this.specularColor,this.specularPower),r.lightsEnabled&&!this.disableLighting&&i.BindLights(r,n,this._activeEffect,o,this.maxSimultaneousLights),r.fogEnabled&&n.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,n,this._activeEffect),this._afterBind(n,this._activeEffect,t))}},n.prototype.getAnimatables=function(){var e=[];return this._mixTexture1&&this._mixTexture1.animations&&this._mixTexture1.animations.length>0&&e.push(this._mixTexture1),this._mixTexture2&&this._mixTexture2.animations&&this._mixTexture2.animations.length>0&&e.push(this._mixTexture2),e},n.prototype.getActiveTextures=function(){var i=e.prototype.getActiveTextures.call(this);return this._mixTexture1&&i.push(this._mixTexture1),this._diffuseTexture1&&i.push(this._diffuseTexture1),this._diffuseTexture2&&i.push(this._diffuseTexture2),this._diffuseTexture3&&i.push(this._diffuseTexture3),this._diffuseTexture4&&i.push(this._diffuseTexture4),this._mixTexture2&&i.push(this._mixTexture2),this._diffuseTexture5&&i.push(this._diffuseTexture5),this._diffuseTexture6&&i.push(this._diffuseTexture6),this._diffuseTexture7&&i.push(this._diffuseTexture7),this._diffuseTexture8&&i.push(this._diffuseTexture8),i},n.prototype.hasTexture=function(i){return!!e.prototype.hasTexture.call(this,i)||this._mixTexture1===i||this._diffuseTexture1===i||this._diffuseTexture2===i||this._diffuseTexture3===i||this._diffuseTexture4===i||this._mixTexture2===i||this._diffuseTexture5===i||this._diffuseTexture6===i||this._diffuseTexture7===i||this._diffuseTexture8===i},n.prototype.dispose=function(i){this._mixTexture1&&this._mixTexture1.dispose(),e.prototype.dispose.call(this,i)},n.prototype.clone=function(e){var t=this;return i.SerializationHelper.Clone(function(){return new n(e,t.getScene())},this)},n.prototype.serialize=function(){var i=e.prototype.serialize.call(this);return i.customType="BABYLON.MixMaterial",i},n.prototype.getClassName=function(){return"MixMaterial"},n.Parse=function(e,t,r){return i.SerializationHelper.Parse(function(){return new n(e.name,t)},e,t,r)},r([i.serializeAsTexture("mixTexture1")],n.prototype,"_mixTexture1",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"mixTexture1",void 0),r([i.serializeAsTexture("mixTexture2")],n.prototype,"_mixTexture2",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"mixTexture2",void 0),r([i.serializeAsTexture("diffuseTexture1")],n.prototype,"_diffuseTexture1",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"diffuseTexture1",void 0),r([i.serializeAsTexture("diffuseTexture2")],n.prototype,"_diffuseTexture2",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"diffuseTexture2",void 0),r([i.serializeAsTexture("diffuseTexture3")],n.prototype,"_diffuseTexture3",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"diffuseTexture3",void 0),r([i.serializeAsTexture("diffuseTexture4")],n.prototype,"_diffuseTexture4",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"diffuseTexture4",void 0),r([i.serializeAsTexture("diffuseTexture1")],n.prototype,"_diffuseTexture5",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"diffuseTexture5",void 0),r([i.serializeAsTexture("diffuseTexture2")],n.prototype,"_diffuseTexture6",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"diffuseTexture6",void 0),r([i.serializeAsTexture("diffuseTexture3")],n.prototype,"_diffuseTexture7",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"diffuseTexture7",void 0),r([i.serializeAsTexture("diffuseTexture4")],n.prototype,"_diffuseTexture8",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"diffuseTexture8",void 0),r([i.serializeAsColor3()],n.prototype,"diffuseColor",void 0),r([i.serializeAsColor3()],n.prototype,"specularColor",void 0),r([i.serialize()],n.prototype,"specularPower",void 0),r([i.serialize("disableLighting")],n.prototype,"_disableLighting",void 0),r([i.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"disableLighting",void 0),r([i.serialize("maxSimultaneousLights")],n.prototype,"_maxSimultaneousLights",void 0),r([i.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"maxSimultaneousLights",void 0),n}(i.PushMaterial);i.RegisterClass("BABYLON.MixMaterial",y);var L=function(e){function i(){var i=e.call(this)||this;return i.DIFFUSE=!1,i.CLIPPLANE=!1,i.CLIPPLANE2=!1,i.CLIPPLANE3=!1,i.CLIPPLANE4=!1,i.CLIPPLANE5=!1,i.CLIPPLANE6=!1,i.ALPHATEST=!1,i.DEPTHPREPASS=!1,i.POINTSIZE=!1,i.FOG=!1,i.LIGHT0=!1,i.LIGHT1=!1,i.LIGHT2=!1,i.LIGHT3=!1,i.SPOTLIGHT0=!1,i.SPOTLIGHT1=!1,i.SPOTLIGHT2=!1,i.SPOTLIGHT3=!1,i.HEMILIGHT0=!1,i.HEMILIGHT1=!1,i.HEMILIGHT2=!1,i.HEMILIGHT3=!1,i.DIRLIGHT0=!1,i.DIRLIGHT1=!1,i.DIRLIGHT2=!1,i.DIRLIGHT3=!1,i.POINTLIGHT0=!1,i.POINTLIGHT1=!1,i.POINTLIGHT2=!1,i.POINTLIGHT3=!1,i.SHADOW0=!1,i.SHADOW1=!1,i.SHADOW2=!1,i.SHADOW3=!1,i.SHADOWS=!1,i.SHADOWESM0=!1,i.SHADOWESM1=!1,i.SHADOWESM2=!1,i.SHADOWESM3=!1,i.SHADOWPOISSON0=!1,i.SHADOWPOISSON1=!1,i.SHADOWPOISSON2=!1,i.SHADOWPOISSON3=!1,i.SHADOWPCF0=!1,i.SHADOWPCF1=!1,i.SHADOWPCF2=!1,i.SHADOWPCF3=!1,i.SHADOWPCSS0=!1,i.SHADOWPCSS1=!1,i.SHADOWPCSS2=!1,i.SHADOWPCSS3=!1,i.NORMAL=!1,i.UV1=!1,i.UV2=!1,i.NUM_BONE_INFLUENCERS=0,i.BonesPerMesh=0,i.INSTANCES=!1,i.THIN_INSTANCES=!1,i.LIGHTING=!1,i.IMAGEPROCESSINGPOSTPROCESS=!1,i.SKIPFINALCOLORCLAMP=!1,i.LOGARITHMICDEPTH=!1,i.AREALIGHTSUPPORTED=!0,i.AREALIGHTNOROUGHTNESS=!0,i.rebuild(),i}return t(i,e),i}(i.MaterialDefines),A=function(e){function n(n,t,r){void 0===r&&(r=!1);var o=e.call(this,n,t,void 0,r)||this;return o.diffuseColor=new i.Color3(1,1,1),o._disableLighting=!1,o._maxSimultaneousLights=4,o._shadersLoaded=!1,o}return t(n,e),n.prototype.needAlphaBlending=function(){return this.alpha<1},n.prototype.needAlphaBlendingForMesh=function(e){return this.needAlphaBlending()||e.visibility<1},n.prototype.needAlphaTesting=function(){return!1},n.prototype.getAlphaTestTexture=function(){return null},n.prototype.isReadyForSubMesh=function(e,n,t){var r=this,s=n._drawWrapper;if(this.isFrozen&&s.effect&&s._wasPreviouslyReady&&s._wasPreviouslyUsingInstances===t)return!0;n.materialDefines||(n.materialDefines=new L);var f=n.materialDefines,l=this.getScene();if(this._isReadyForSubMesh(n))return!0;var u=l.getEngine();if(f._areTexturesDirty&&(f._needUVs=!1,l.texturesEnabled&&this._diffuseTexture&&i.MaterialFlags.DiffuseTextureEnabled)){if(!this._diffuseTexture.isReady())return!1;f._needUVs=!0,f.DIFFUSE=!0}if(i.PrepareDefinesForMisc(e,l,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),f,void 0,void 0,void 0,this._isVertexOutputInvariant),f._needNormals=!0,i.PrepareDefinesForLights(l,e,f,!1,this._maxSimultaneousLights,this._disableLighting),i.PrepareDefinesForFrameBoundValues(l,u,this,f,!!t,null,n.getRenderingMesh().hasThinInstances),f.LIGHTING=!this._disableLighting,i.PrepareDefinesForAttributes(e,f,!0,!0),f.isDirty){f.markAsProcessed(),l.resetCachedMaterial();var d=new i.EffectFallbacks;f.FOG&&d.addFallback(1,"FOG"),i.HandleFallbacksForShadows(f,d),f.NUM_BONE_INFLUENCERS>0&&d.addCPUSkinningFallback(0,e),f.IMAGEPROCESSINGPOSTPROCESS=l.imageProcessingConfiguration.applyByPostProcess;var c=[i.VertexBuffer.PositionKind];f.NORMAL&&c.push(i.VertexBuffer.NormalKind),f.UV1&&c.push(i.VertexBuffer.UVKind),f.UV2&&c.push(i.VertexBuffer.UV2Kind),i.PrepareAttributesForBones(c,e,f,d),i.PrepareAttributesForInstances(c,f);var v=f.toString(),m=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vFogInfos","vFogColor","pointSize","vDiffuseInfos","mBones","diffuseMatrix","logarithmicDepthConstant"],p=["diffuseSampler","areaLightsLTC1Sampler","areaLightsLTC2Sampler"],h=[];i.AddClipPlaneUniforms(m),i.PrepareUniformsAndSamplersList({uniformsNames:m,uniformBuffersNames:h,samplers:p,defines:f,maxSimultaneousLights:4,shaderLanguage:this._shaderLanguage}),n.setEffect(l.getEngine().createEffect("normal",{attributes:c,uniformsNames:m,uniformBuffersNames:h,samplers:p,defines:v,fallbacks:d,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:function(){return o(r,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return 1!==this.shaderLanguage?[3,2]:[4,Promise.all([Promise.resolve().then(function(){return Ci}),Promise.resolve().then(function(){return Ii})])];case 1:return e.sent(),[3,4];case 2:return[4,Promise.all([Promise.resolve().then(function(){return Ai}),Promise.resolve().then(function(){return Ni})])];case 3:e.sent(),e.label=4;case 4:return this._shadersLoaded=!0,[2]}})})}},u),f,this._materialContext)}if(f.AREALIGHTUSED)for(var g=0;g<e.lightSources.length;g++)if(!e.lightSources[g]._isReady())return!1;return!(!n.effect||!n.effect.isReady()||(f._renderId=l.getRenderId(),s._wasPreviouslyReady=!0,s._wasPreviouslyUsingInstances=!!t,0))},n.prototype.bindForSubMesh=function(e,n,t){var r=this.getScene(),o=t.materialDefines;if(o){var a=t.effect;a&&(this._activeEffect=a,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),i.BindBonesParameters(n,this._activeEffect),this._mustRebind(r,a,t)&&(this.diffuseTexture&&i.MaterialFlags.DiffuseTextureEnabled&&(this._activeEffect.setTexture("diffuseSampler",this.diffuseTexture),this._activeEffect.setFloat2("vDiffuseInfos",this.diffuseTexture.coordinatesIndex,this.diffuseTexture.level),this._activeEffect.setMatrix("diffuseMatrix",this.diffuseTexture.getTextureMatrix())),i.BindClipPlane(a,this,r),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&i.BindLogDepth(o,a,r),r.bindEyePosition(a)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*n.visibility),r.lightsEnabled&&!this.disableLighting&&i.BindLights(r,n,this._activeEffect,o),r.fogEnabled&&n.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,n,this._activeEffect),this._afterBind(n,this._activeEffect,t))}},n.prototype.getAnimatables=function(){var e=[];return this.diffuseTexture&&this.diffuseTexture.animations&&this.diffuseTexture.animations.length>0&&e.push(this.diffuseTexture),e},n.prototype.getActiveTextures=function(){var i=e.prototype.getActiveTextures.call(this);return this._diffuseTexture&&i.push(this._diffuseTexture),i},n.prototype.hasTexture=function(i){return!!e.prototype.hasTexture.call(this,i)||this.diffuseTexture===i},n.prototype.dispose=function(i){this.diffuseTexture&&this.diffuseTexture.dispose(),e.prototype.dispose.call(this,i)},n.prototype.clone=function(e){var t=this;return i.SerializationHelper.Clone(function(){return new n(e,t.getScene())},this)},n.prototype.serialize=function(){var i=e.prototype.serialize.call(this);return i.customType="BABYLON.NormalMaterial",i},n.prototype.getClassName=function(){return"NormalMaterial"},n.Parse=function(e,t,r){return i.SerializationHelper.Parse(function(){return new n(e.name,t)},e,t,r)},r([i.serializeAsTexture("diffuseTexture")],n.prototype,"_diffuseTexture",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"diffuseTexture",void 0),r([i.serializeAsColor3()],n.prototype,"diffuseColor",void 0),r([i.serialize("disableLighting")],n.prototype,"_disableLighting",void 0),r([i.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"disableLighting",void 0),r([i.serialize("maxSimultaneousLights")],n.prototype,"_maxSimultaneousLights",void 0),r([i.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"maxSimultaneousLights",void 0),n}(i.PushMaterial);i.RegisterClass("BABYLON.NormalMaterial",A);var O=function(e){function i(){var i=e.call(this)||this;return i.CLIPPLANE=!1,i.CLIPPLANE2=!1,i.CLIPPLANE3=!1,i.CLIPPLANE4=!1,i.CLIPPLANE5=!1,i.CLIPPLANE6=!1,i.POINTSIZE=!1,i.FOG=!1,i.NORMAL=!1,i.NUM_BONE_INFLUENCERS=0,i.BonesPerMesh=0,i.INSTANCES=!1,i.IMAGEPROCESSINGPOSTPROCESS=!1,i.SKIPFINALCOLORCLAMP=!1,i.LOGARITHMICDEPTH=!1,i.rebuild(),i}return t(i,e),i}(i.MaterialDefines),D=function(e){function n(n,t,r){void 0===r&&(r=!1);var o=e.call(this,n,t,void 0,r)||this;return o._needAlphaBlending=!0,o._shadersLoaded=!1,o.shadowColor=i.Color3.Black(),o}return t(n,e),n.prototype.needAlphaBlending=function(){return this._needAlphaBlending},n.prototype.needAlphaTesting=function(){return!1},n.prototype.getAlphaTestTexture=function(){return null},Object.defineProperty(n.prototype,"activeLight",{get:function(){return this._activeLight},set:function(e){this._activeLight=e},enumerable:!1,configurable:!0}),n.prototype._getFirstShadowLightForMesh=function(e){for(var i=0,n=e.lightSources;i<n.length;i++){var t=n[i];if(t.shadowEnabled)return t}return null},n.prototype.isReadyForSubMesh=function(e,n,t){var r,s=this,f=n._drawWrapper;if(this.isFrozen&&f.effect&&f._wasPreviouslyReady&&f._wasPreviouslyUsingInstances===t)return!0;n.materialDefines||(n.materialDefines=new O);var l=n.materialDefines,u=this.getScene();if(this._isReadyForSubMesh(n))return!0;var d=u.getEngine();if(this._activeLight)for(var c=0,v=e.lightSources;c<v.length;c++){var m=v[c];if(m.shadowEnabled){if(this._activeLight===m)break;var p=e.lightSources.indexOf(this._activeLight);-1!==p&&(e.lightSources.splice(p,1),e.lightSources.splice(0,0,this._activeLight));break}}i.PrepareDefinesForFrameBoundValues(u,d,this,l,!!t),i.PrepareDefinesForMisc(e,u,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),l,void 0,void 0,void 0,this._isVertexOutputInvariant),l._needNormals=i.PrepareDefinesForLights(u,e,l,!1,1);var h=null===(r=this._getFirstShadowLightForMesh(e))||void 0===r?void 0:r.getShadowGenerator();if(this._needAlphaBlending=!0,h&&h.getClassName&&"CascadedShadowGenerator"===h.getClassName()){var g=h;this._needAlphaBlending=!g.autoCalcDepthBounds}if(i.PrepareDefinesForAttributes(e,l,!1,!0),l.isDirty){l.markAsProcessed(),u.resetCachedMaterial();var S=new i.EffectFallbacks;l.FOG&&S.addFallback(1,"FOG"),i.HandleFallbacksForShadows(l,S,1),l.NUM_BONE_INFLUENCERS>0&&S.addCPUSkinningFallback(0,e),l.IMAGEPROCESSINGPOSTPROCESS=u.imageProcessingConfiguration.applyByPostProcess;var x=[i.VertexBuffer.PositionKind];l.NORMAL&&x.push(i.VertexBuffer.NormalKind),i.PrepareAttributesForBones(x,e,l,S),i.PrepareAttributesForInstances(x,l);var T=l.toString(),_=["world","view","viewProjection","vEyePosition","vLightsType","vFogInfos","vFogColor","pointSize","alpha","shadowColor","mBones","logarithmicDepthConstant"],C=[],E=["Scene"];i.AddClipPlaneUniforms(_),i.PrepareUniformsAndSamplersList({uniformsNames:_,uniformBuffersNames:E,samplers:C,defines:l,maxSimultaneousLights:1,shaderLanguage:this._shaderLanguage}),n.setEffect(u.getEngine().createEffect("shadowOnly",{attributes:x,uniformsNames:_,uniformBuffersNames:E,samplers:C,defines:T,fallbacks:S,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:1},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:function(){return o(s,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return 1!==this.shaderLanguage?[3,2]:[4,Promise.all([Promise.resolve().then(function(){return Mi}),Promise.resolve().then(function(){return Ui})])];case 1:return e.sent(),[3,4];case 2:return[4,Promise.all([Promise.resolve().then(function(){return zi}),Promise.resolve().then(function(){return Wi})])];case 3:e.sent(),e.label=4;case 4:return this._shadersLoaded=!0,[2]}})})}},d),l,this._materialContext)}return!(!n.effect||!n.effect.isReady()||(l._renderId=u.getRenderId(),f._wasPreviouslyReady=!0,f._wasPreviouslyUsingInstances=!!t,0))},n.prototype.bindForSubMesh=function(e,n,t){var r=this.getScene(),o=t.materialDefines;if(o){var a=t.effect;if(a){if(this._activeEffect=a,this.bindOnlyWorldMatrix(e),this.bindViewProjection(a),i.BindBonesParameters(n,this._activeEffect),this._mustRebind(r,a,t)&&(i.BindClipPlane(a,this,r),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._activeEffect.setFloat("alpha",this.alpha),this._activeEffect.setColor3("shadowColor",this.shadowColor),this._useLogarithmicDepth&&i.BindLogDepth(o,a,r),r.bindEyePosition(a)),r.lightsEnabled){i.BindLights(r,n,this._activeEffect,o,1);var s=this._getFirstShadowLightForMesh(n);s&&(s._renderId=-1)}(r.fogEnabled&&n.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE||o.SHADOWCSM0)&&this.bindView(a),i.BindFogParameters(r,n,this._activeEffect),this._afterBind(n,this._activeEffect,t)}}},n.prototype.clone=function(e){var t=this;return i.SerializationHelper.Clone(function(){return new n(e,t.getScene())},this)},n.prototype.serialize=function(){var i=e.prototype.serialize.call(this);return i.customType="BABYLON.ShadowOnlyMaterial",i},n.prototype.getClassName=function(){return"ShadowOnlyMaterial"},n.Parse=function(e,t,r){return i.SerializationHelper.Parse(function(){return new n(e.name,t)},e,t,r)},n}(i.PushMaterial);i.RegisterClass("BABYLON.ShadowOnlyMaterial",D);var N=function(e){function i(){var i=e.call(this)||this;return i.DIFFUSE=!1,i.CLIPPLANE=!1,i.CLIPPLANE2=!1,i.CLIPPLANE3=!1,i.CLIPPLANE4=!1,i.CLIPPLANE5=!1,i.CLIPPLANE6=!1,i.ALPHATEST=!1,i.DEPTHPREPASS=!1,i.POINTSIZE=!1,i.FOG=!1,i.NORMAL=!1,i.UV1=!1,i.UV2=!1,i.VERTEXCOLOR=!1,i.VERTEXALPHA=!1,i.NUM_BONE_INFLUENCERS=0,i.BonesPerMesh=0,i.INSTANCES=!1,i.INSTANCESCOLOR=!1,i.IMAGEPROCESSINGPOSTPROCESS=!1,i.SKIPFINALCOLORCLAMP=!1,i.LOGARITHMICDEPTH=!1,i.AREALIGHTSUPPORTED=!0,i.AREALIGHTNOROUGHTNESS=!0,i.rebuild(),i}return t(i,e),i}(i.MaterialDefines),b=function(e){function n(n,t,r){void 0===r&&(r=!1);var o=e.call(this,n,t,void 0,r)||this;return o.diffuseColor=new i.Color3(1,1,1),o._disableLighting=!1,o._maxSimultaneousLights=4,o._shadersLoaded=!1,o}return t(n,e),n.prototype.needAlphaBlending=function(){return this.alpha<1},n.prototype.needAlphaTesting=function(){return!1},n.prototype.getAlphaTestTexture=function(){return null},n.prototype.isReadyForSubMesh=function(e,n,t){var r=this,s=n._drawWrapper;if(this.isFrozen&&s.effect&&s._wasPreviouslyReady&&s._wasPreviouslyUsingInstances===t)return!0;n.materialDefines||(n.materialDefines=new N);var f=n.materialDefines,l=this.getScene();if(this._isReadyForSubMesh(n))return!0;var u=l.getEngine();if(f._areTexturesDirty&&(f._needUVs=!1,l.texturesEnabled&&this._diffuseTexture&&i.MaterialFlags.DiffuseTextureEnabled)){if(!this._diffuseTexture.isReady())return!1;f._needUVs=!0,f.DIFFUSE=!0}if(i.PrepareDefinesForMisc(e,l,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),f,void 0,void 0,void 0,this._isVertexOutputInvariant),f._needNormals=i.PrepareDefinesForLights(l,e,f,!1,this._maxSimultaneousLights,this._disableLighting),i.PrepareDefinesForFrameBoundValues(l,u,this,f,!!t),i.PrepareDefinesForAttributes(e,f,!0,!0),f.isDirty){f.markAsProcessed(),l.resetCachedMaterial();var d=new i.EffectFallbacks;f.FOG&&d.addFallback(1,"FOG"),i.HandleFallbacksForShadows(f,d,this.maxSimultaneousLights),f.NUM_BONE_INFLUENCERS>0&&d.addCPUSkinningFallback(0,e),f.IMAGEPROCESSINGPOSTPROCESS=l.imageProcessingConfiguration.applyByPostProcess;var c=[i.VertexBuffer.PositionKind];f.NORMAL&&c.push(i.VertexBuffer.NormalKind),f.UV1&&c.push(i.VertexBuffer.UVKind),f.UV2&&c.push(i.VertexBuffer.UV2Kind),f.VERTEXCOLOR&&c.push(i.VertexBuffer.ColorKind),i.PrepareAttributesForBones(c,e,f,d),i.PrepareAttributesForInstances(c,f);var v=f.toString(),m=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vFogInfos","vFogColor","pointSize","vDiffuseInfos","mBones","diffuseMatrix","logarithmicDepthConstant"],p=["diffuseSampler","areaLightsLTC1Sampler","areaLightsLTC2Sampler"],h=[];i.AddClipPlaneUniforms(m),i.PrepareUniformsAndSamplersList({uniformsNames:m,uniformBuffersNames:h,samplers:p,defines:f,maxSimultaneousLights:this.maxSimultaneousLights,shaderLanguage:this._shaderLanguage}),n.setEffect(l.getEngine().createEffect("simple",{attributes:c,uniformsNames:m,uniformBuffersNames:h,samplers:p,defines:v,fallbacks:d,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights-1},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:function(){return o(r,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return 1!==this.shaderLanguage?[3,2]:[4,Promise.all([Promise.resolve().then(function(){return ji}),Promise.resolve().then(function(){return Ki})])];case 1:return e.sent(),[3,4];case 2:return[4,Promise.all([Promise.resolve().then(function(){return Ji}),Promise.resolve().then(function(){return nn})])];case 3:e.sent(),e.label=4;case 4:return this._shadersLoaded=!0,[2]}})})}},u),f,this._materialContext)}if(f.AREALIGHTUSED)for(var g=0;g<e.lightSources.length;g++)if(!e.lightSources[g]._isReady())return!1;return!(!n.effect||!n.effect.isReady()||(f._renderId=l.getRenderId(),s._wasPreviouslyReady=!0,s._wasPreviouslyUsingInstances=!!t,0))},n.prototype.bindForSubMesh=function(e,n,t){var r=this.getScene(),o=t.materialDefines;if(o){var a=t.effect;a&&(this._activeEffect=a,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),i.BindBonesParameters(n,this._activeEffect),this._mustRebind(r,a,t)&&(this._diffuseTexture&&i.MaterialFlags.DiffuseTextureEnabled&&(this._activeEffect.setTexture("diffuseSampler",this._diffuseTexture),this._activeEffect.setFloat2("vDiffuseInfos",this._diffuseTexture.coordinatesIndex,this._diffuseTexture.level),this._activeEffect.setMatrix("diffuseMatrix",this._diffuseTexture.getTextureMatrix())),i.BindClipPlane(a,this,r),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&i.BindLogDepth(o,a,r),r.bindEyePosition(a)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*n.visibility),r.lightsEnabled&&!this.disableLighting&&i.BindLights(r,n,this._activeEffect,o,this.maxSimultaneousLights),r.fogEnabled&&n.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,n,this._activeEffect),this._afterBind(n,this._activeEffect,t))}},n.prototype.getAnimatables=function(){var e=[];return this._diffuseTexture&&this._diffuseTexture.animations&&this._diffuseTexture.animations.length>0&&e.push(this._diffuseTexture),e},n.prototype.getActiveTextures=function(){var i=e.prototype.getActiveTextures.call(this);return this._diffuseTexture&&i.push(this._diffuseTexture),i},n.prototype.hasTexture=function(i){return!!e.prototype.hasTexture.call(this,i)||this.diffuseTexture===i},n.prototype.dispose=function(i){this._diffuseTexture&&this._diffuseTexture.dispose(),e.prototype.dispose.call(this,i)},n.prototype.clone=function(e){var t=this;return i.SerializationHelper.Clone(function(){return new n(e,t.getScene())},this)},n.prototype.serialize=function(){var i=e.prototype.serialize.call(this);return i.customType="BABYLON.SimpleMaterial",i},n.prototype.getClassName=function(){return"SimpleMaterial"},n.Parse=function(e,t,r){return i.SerializationHelper.Parse(function(){return new n(e.name,t)},e,t,r)},r([i.serializeAsTexture("diffuseTexture")],n.prototype,"_diffuseTexture",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"diffuseTexture",void 0),r([i.serializeAsColor3("diffuse")],n.prototype,"diffuseColor",void 0),r([i.serialize("disableLighting")],n.prototype,"_disableLighting",void 0),r([i.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"disableLighting",void 0),r([i.serialize("maxSimultaneousLights")],n.prototype,"_maxSimultaneousLights",void 0),r([i.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"maxSimultaneousLights",void 0),n}(i.PushMaterial);i.RegisterClass("BABYLON.SimpleMaterial",b);var F=function(e){function i(){var i=e.call(this)||this;return i.CLIPPLANE=!1,i.CLIPPLANE2=!1,i.CLIPPLANE3=!1,i.CLIPPLANE4=!1,i.CLIPPLANE5=!1,i.CLIPPLANE6=!1,i.POINTSIZE=!1,i.FOG=!1,i.VERTEXCOLOR=!1,i.VERTEXALPHA=!1,i.IMAGEPROCESSINGPOSTPROCESS=!1,i.SKIPFINALCOLORCLAMP=!1,i.DITHER=!1,i.LOGARITHMICDEPTH=!1,i.rebuild(),i}return t(i,e),i}(i.MaterialDefines),M=function(e){function n(n,t,r){void 0===r&&(r=!1);var o=e.call(this,n,t,void 0,r)||this;return o.luminance=1,o.turbidity=10,o.rayleigh=2,o.mieCoefficient=.005,o.mieDirectionalG=.8,o.distance=500,o.inclination=.49,o.azimuth=.25,o.sunPosition=new i.Vector3(0,100,0),o.useSunPosition=!1,o.cameraOffset=i.Vector3.Zero(),o.up=i.Vector3.Up(),o.dithering=!1,o._cameraPosition=i.Vector3.Zero(),o._skyOrientation=new i.Quaternion,o._shadersLoaded=!1,o}return t(n,e),n.prototype.needAlphaBlending=function(){return this.alpha<1},n.prototype.needAlphaTesting=function(){return!1},n.prototype.getAlphaTestTexture=function(){return null},n.prototype.isReadyForSubMesh=function(e,n){var t=this,r=n._drawWrapper;if(this.isFrozen&&r.effect&&r._wasPreviouslyReady)return!0;n.materialDefines||(n.materialDefines=new F);var s=n.materialDefines,f=this.getScene();if(this._isReadyForSubMesh(n))return!0;if(i.PrepareDefinesForMisc(e,f,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,!1,s,void 0,void 0,void 0,this._isVertexOutputInvariant),i.PrepareDefinesForAttributes(e,s,!0,!1),s.IMAGEPROCESSINGPOSTPROCESS!==f.imageProcessingConfiguration.applyByPostProcess&&s.markAsMiscDirty(),s.DITHER!==this.dithering&&s.markAsMiscDirty(),s.isDirty){s.markAsProcessed(),f.resetCachedMaterial();var l=new i.EffectFallbacks;s.FOG&&l.addFallback(1,"FOG"),s.IMAGEPROCESSINGPOSTPROCESS=f.imageProcessingConfiguration.applyByPostProcess,s.DITHER=this.dithering;var u=[i.VertexBuffer.PositionKind];s.VERTEXCOLOR&&u.push(i.VertexBuffer.ColorKind);var d=["world","viewProjection","view","vFogInfos","vFogColor","logarithmicDepthConstant","pointSize","luminance","turbidity","rayleigh","mieCoefficient","mieDirectionalG","sunPosition","cameraPosition","cameraOffset","up"];i.AddClipPlaneUniforms(d);var c=s.toString();n.setEffect(f.getEngine().createEffect("sky",{attributes:u,uniformsNames:d,uniformBuffersNames:[],samplers:[],defines:c,fallbacks:l,onCompiled:this.onCompiled,onError:this.onError,shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:function(){return o(t,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return 1!==this.shaderLanguage?[3,2]:[4,Promise.all([Promise.resolve().then(function(){return on}),Promise.resolve().then(function(){return fn})])];case 1:return e.sent(),[3,4];case 2:return[4,Promise.all([Promise.resolve().then(function(){return dn}),Promise.resolve().then(function(){return mn})])];case 3:e.sent(),e.label=4;case 4:return this._shadersLoaded=!0,[2]}})})}},f.getEngine()),s,this._materialContext)}return!(!n.effect||!n.effect.isReady()||(s._renderId=f.getRenderId(),r._wasPreviouslyReady=!0,0))},n.prototype.bindForSubMesh=function(e,n,t){var r=this.getScene(),o=t.materialDefines;if(o){var a=t.effect;if(a){this._activeEffect=a,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),this._mustRebind(r,a,t)&&(i.BindClipPlane(a,this,r),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&i.BindLogDepth(o,a,r)),r.fogEnabled&&n.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,n,this._activeEffect);var s=r.activeCamera;if(s){var f=s.getWorldMatrix();this._cameraPosition.x=f.m[12],this._cameraPosition.y=f.m[13],this._cameraPosition.z=f.m[14],this._activeEffect.setVector3("cameraPosition",i.TmpVectors.Vector3[0].copyFrom(this._cameraPosition).subtractInPlace(r.floatingOriginOffset))}if(this._activeEffect.setVector3("cameraOffset",this.cameraOffset),this._activeEffect.setVector3("up",this.up),this.luminance>0&&this._activeEffect.setFloat("luminance",this.luminance),this._activeEffect.setFloat("turbidity",this.turbidity),this._activeEffect.setFloat("rayleigh",this.rayleigh),this._activeEffect.setFloat("mieCoefficient",this.mieCoefficient),this._activeEffect.setFloat("mieDirectionalG",this.mieDirectionalG),!this.useSunPosition){var l=Math.PI*(this.inclination-.5),u=2*Math.PI*(this.azimuth-.5);this.sunPosition.x=this.distance*Math.cos(u)*Math.cos(l),this.sunPosition.y=this.distance*Math.sin(-l),this.sunPosition.z=this.distance*Math.sin(u)*Math.cos(l),i.Quaternion.FromUnitVectorsToRef(i.Vector3.UpReadOnly,this.up,this._skyOrientation),this.sunPosition.rotateByQuaternionToRef(this._skyOrientation,this.sunPosition)}this._activeEffect.setVector3("sunPosition",this.sunPosition),this._afterBind(n,this._activeEffect,t)}}},n.prototype.getAnimatables=function(){return[]},n.prototype.dispose=function(i){e.prototype.dispose.call(this,i)},n.prototype.clone=function(e){var t=this;return i.SerializationHelper.Clone(function(){return new n(e,t.getScene())},this)},n.prototype.serialize=function(){var i=e.prototype.serialize.call(this);return i.customType="BABYLON.SkyMaterial",i},n.prototype.getClassName=function(){return"SkyMaterial"},n.Parse=function(e,t,r){return i.SerializationHelper.Parse(function(){return new n(e.name,t)},e,t,r)},r([i.serialize()],n.prototype,"luminance",void 0),r([i.serialize()],n.prototype,"turbidity",void 0),r([i.serialize()],n.prototype,"rayleigh",void 0),r([i.serialize()],n.prototype,"mieCoefficient",void 0),r([i.serialize()],n.prototype,"mieDirectionalG",void 0),r([i.serialize()],n.prototype,"distance",void 0),r([i.serialize()],n.prototype,"inclination",void 0),r([i.serialize()],n.prototype,"azimuth",void 0),r([i.serializeAsVector3()],n.prototype,"sunPosition",void 0),r([i.serialize()],n.prototype,"useSunPosition",void 0),r([i.serializeAsVector3()],n.prototype,"cameraOffset",void 0),r([i.serializeAsVector3()],n.prototype,"up",void 0),r([i.serialize()],n.prototype,"dithering",void 0),n}(i.PushMaterial);i.RegisterClass("BABYLON.SkyMaterial",M);var R=function(e){function i(){var i=e.call(this)||this;return i.DIFFUSE=!1,i.BUMP=!1,i.CLIPPLANE=!1,i.CLIPPLANE2=!1,i.CLIPPLANE3=!1,i.CLIPPLANE4=!1,i.CLIPPLANE5=!1,i.CLIPPLANE6=!1,i.ALPHATEST=!1,i.DEPTHPREPASS=!1,i.POINTSIZE=!1,i.FOG=!1,i.SPECULARTERM=!1,i.NORMAL=!1,i.UV1=!1,i.UV2=!1,i.VERTEXCOLOR=!1,i.VERTEXALPHA=!1,i.NUM_BONE_INFLUENCERS=0,i.BonesPerMesh=0,i.INSTANCES=!1,i.INSTANCESCOLOR=!1,i.IMAGEPROCESSINGPOSTPROCESS=!1,i.SKIPFINALCOLORCLAMP=!1,i.LOGARITHMICDEPTH=!1,i.AREALIGHTSUPPORTED=!0,i.AREALIGHTNOROUGHTNESS=!0,i.rebuild(),i}return t(i,e),i}(i.MaterialDefines),V=function(e){function n(n,t,r){void 0===r&&(r=!1);var o=e.call(this,n,t,void 0,r)||this;return o.diffuseColor=new i.Color3(1,1,1),o.specularColor=new i.Color3(0,0,0),o.specularPower=64,o._disableLighting=!1,o._maxSimultaneousLights=4,o._shadersLoaded=!1,o}return t(n,e),n.prototype.needAlphaBlending=function(){return this.alpha<1},n.prototype.needAlphaTesting=function(){return!1},n.prototype.getAlphaTestTexture=function(){return null},n.prototype.isReadyForSubMesh=function(e,n,t){var r=this,s=n._drawWrapper;if(this.isFrozen&&s.effect&&s._wasPreviouslyReady&&s._wasPreviouslyUsingInstances===t)return!0;n.materialDefines||(n.materialDefines=new R);var f=n.materialDefines,l=this.getScene();if(this._isReadyForSubMesh(n))return!0;var u=l.getEngine();if(l.texturesEnabled){if(!this.mixTexture||!this.mixTexture.isReady())return!1;if(f._needUVs=!0,i.MaterialFlags.DiffuseTextureEnabled){if(!this.diffuseTexture1||!this.diffuseTexture1.isReady())return!1;if(!this.diffuseTexture2||!this.diffuseTexture2.isReady())return!1;if(!this.diffuseTexture3||!this.diffuseTexture3.isReady())return!1;f.DIFFUSE=!0}if(this.bumpTexture1&&this.bumpTexture2&&this.bumpTexture3&&i.MaterialFlags.BumpTextureEnabled){if(!this.bumpTexture1.isReady())return!1;if(!this.bumpTexture2.isReady())return!1;if(!this.bumpTexture3.isReady())return!1;f._needNormals=!0,f.BUMP=!0}}if(i.PrepareDefinesForMisc(e,l,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),f,void 0,void 0,void 0,this._isVertexOutputInvariant),f._needNormals=i.PrepareDefinesForLights(l,e,f,!1,this._maxSimultaneousLights,this._disableLighting),i.PrepareDefinesForFrameBoundValues(l,u,this,f,!!t),i.PrepareDefinesForAttributes(e,f,!0,!0),f.isDirty){f.markAsProcessed(),l.resetCachedMaterial();var d=new i.EffectFallbacks;f.FOG&&d.addFallback(1,"FOG"),i.HandleFallbacksForShadows(f,d,this.maxSimultaneousLights),f.NUM_BONE_INFLUENCERS>0&&d.addCPUSkinningFallback(0,e),f.IMAGEPROCESSINGPOSTPROCESS=l.imageProcessingConfiguration.applyByPostProcess;var c=[i.VertexBuffer.PositionKind];f.NORMAL&&c.push(i.VertexBuffer.NormalKind),f.UV1&&c.push(i.VertexBuffer.UVKind),f.UV2&&c.push(i.VertexBuffer.UV2Kind),f.VERTEXCOLOR&&c.push(i.VertexBuffer.ColorKind),i.PrepareAttributesForBones(c,e,f,d),i.PrepareAttributesForInstances(c,f);var v=f.toString(),m=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vSpecularColor","vFogInfos","vFogColor","pointSize","vTextureInfos","mBones","textureMatrix","diffuse1Infos","diffuse2Infos","diffuse3Infos"],p=["textureSampler","diffuse1Sampler","diffuse2Sampler","diffuse3Sampler","bump1Sampler","bump2Sampler","bump3Sampler","logarithmicDepthConstant","areaLightsLTC1Sampler","areaLightsLTC2Sampler"],h=[];i.AddClipPlaneUniforms(m),i.PrepareUniformsAndSamplersList({uniformsNames:m,uniformBuffersNames:h,samplers:p,defines:f,maxSimultaneousLights:this.maxSimultaneousLights,shaderLanguage:this._shaderLanguage}),n.setEffect(l.getEngine().createEffect("terrain",{attributes:c,uniformsNames:m,uniformBuffersNames:h,samplers:p,defines:v,fallbacks:d,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:function(){return o(r,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return 1!==this.shaderLanguage?[3,2]:[4,Promise.all([Promise.resolve().then(function(){return gn}),Promise.resolve().then(function(){return Tn})])];case 1:return e.sent(),[3,4];case 2:return[4,Promise.all([Promise.resolve().then(function(){return En}),Promise.resolve().then(function(){return yn})])];case 3:e.sent(),e.label=4;case 4:return this._shadersLoaded=!0,[2]}})})}},u),f,this._materialContext)}if(f.AREALIGHTUSED)for(var g=0;g<e.lightSources.length;g++)if(!e.lightSources[g]._isReady())return!1;return!(!n.effect||!n.effect.isReady()||(f._renderId=l.getRenderId(),s._wasPreviouslyReady=!0,s._wasPreviouslyUsingInstances=!!t,0))},n.prototype.bindForSubMesh=function(e,n,t){var r=this.getScene(),o=t.materialDefines;if(o){var a=t.effect;a&&(this._activeEffect=a,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("view",r.getViewMatrix()),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),i.BindBonesParameters(n,this._activeEffect),this._mustRebind(r,a,t)&&(this.mixTexture&&(this._activeEffect.setTexture("textureSampler",this._mixTexture),this._activeEffect.setFloat2("vTextureInfos",this._mixTexture.coordinatesIndex,this._mixTexture.level),this._activeEffect.setMatrix("textureMatrix",this._mixTexture.getTextureMatrix()),i.MaterialFlags.DiffuseTextureEnabled&&(this._diffuseTexture1&&(this._activeEffect.setTexture("diffuse1Sampler",this._diffuseTexture1),this._activeEffect.setFloat2("diffuse1Infos",this._diffuseTexture1.uScale,this._diffuseTexture1.vScale)),this._diffuseTexture2&&(this._activeEffect.setTexture("diffuse2Sampler",this._diffuseTexture2),this._activeEffect.setFloat2("diffuse2Infos",this._diffuseTexture2.uScale,this._diffuseTexture2.vScale)),this._diffuseTexture3&&(this._activeEffect.setTexture("diffuse3Sampler",this._diffuseTexture3),this._activeEffect.setFloat2("diffuse3Infos",this._diffuseTexture3.uScale,this._diffuseTexture3.vScale))),i.MaterialFlags.BumpTextureEnabled&&r.getEngine().getCaps().standardDerivatives&&(this._bumpTexture1&&this._activeEffect.setTexture("bump1Sampler",this._bumpTexture1),this._bumpTexture2&&this._activeEffect.setTexture("bump2Sampler",this._bumpTexture2),this._bumpTexture3&&this._activeEffect.setTexture("bump3Sampler",this._bumpTexture3))),i.BindClipPlane(a,this,r),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&i.BindLogDepth(o,a,r),r.bindEyePosition(a)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*n.visibility),o.SPECULARTERM&&this._activeEffect.setColor4("vSpecularColor",this.specularColor,this.specularPower),r.lightsEnabled&&!this.disableLighting&&i.BindLights(r,n,this._activeEffect,o,this.maxSimultaneousLights),r.fogEnabled&&n.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,n,this._activeEffect),this._afterBind(n,this._activeEffect,t))}},n.prototype.getAnimatables=function(){var e=[];return this.mixTexture&&this.mixTexture.animations&&this.mixTexture.animations.length>0&&e.push(this.mixTexture),e},n.prototype.getActiveTextures=function(){var i=e.prototype.getActiveTextures.call(this);return this._mixTexture&&i.push(this._mixTexture),this._diffuseTexture1&&i.push(this._diffuseTexture1),this._diffuseTexture2&&i.push(this._diffuseTexture2),this._diffuseTexture3&&i.push(this._diffuseTexture3),this._bumpTexture1&&i.push(this._bumpTexture1),this._bumpTexture2&&i.push(this._bumpTexture2),this._bumpTexture3&&i.push(this._bumpTexture3),i},n.prototype.hasTexture=function(i){return!!e.prototype.hasTexture.call(this,i)||this._mixTexture===i||this._diffuseTexture1===i||this._diffuseTexture2===i||this._diffuseTexture3===i||this._bumpTexture1===i||this._bumpTexture2===i||this._bumpTexture3===i},n.prototype.dispose=function(i){this.mixTexture&&this.mixTexture.dispose(),e.prototype.dispose.call(this,i)},n.prototype.clone=function(e){var t=this;return i.SerializationHelper.Clone(function(){return new n(e,t.getScene())},this)},n.prototype.serialize=function(){var i=e.prototype.serialize.call(this);return i.customType="BABYLON.TerrainMaterial",i},n.prototype.getClassName=function(){return"TerrainMaterial"},n.Parse=function(e,t,r){return i.SerializationHelper.Parse(function(){return new n(e.name,t)},e,t,r)},r([i.serializeAsTexture("mixTexture")],n.prototype,"_mixTexture",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"mixTexture",void 0),r([i.serializeAsTexture("diffuseTexture1")],n.prototype,"_diffuseTexture1",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"diffuseTexture1",void 0),r([i.serializeAsTexture("diffuseTexture2")],n.prototype,"_diffuseTexture2",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"diffuseTexture2",void 0),r([i.serializeAsTexture("diffuseTexture3")],n.prototype,"_diffuseTexture3",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"diffuseTexture3",void 0),r([i.serializeAsTexture("bumpTexture1")],n.prototype,"_bumpTexture1",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"bumpTexture1",void 0),r([i.serializeAsTexture("bumpTexture2")],n.prototype,"_bumpTexture2",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"bumpTexture2",void 0),r([i.serializeAsTexture("bumpTexture3")],n.prototype,"_bumpTexture3",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"bumpTexture3",void 0),r([i.serializeAsColor3()],n.prototype,"diffuseColor",void 0),r([i.serializeAsColor3()],n.prototype,"specularColor",void 0),r([i.serialize()],n.prototype,"specularPower",void 0),r([i.serialize("disableLighting")],n.prototype,"_disableLighting",void 0),r([i.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"disableLighting",void 0),r([i.serialize("maxSimultaneousLights")],n.prototype,"_maxSimultaneousLights",void 0),r([i.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"maxSimultaneousLights",void 0),n}(i.PushMaterial);i.RegisterClass("BABYLON.TerrainMaterial",V);var U=function(e){function i(){var i=e.call(this)||this;return i.DIFFUSEX=!1,i.DIFFUSEY=!1,i.DIFFUSEZ=!1,i.BUMPX=!1,i.BUMPY=!1,i.BUMPZ=!1,i.CLIPPLANE=!1,i.CLIPPLANE2=!1,i.CLIPPLANE3=!1,i.CLIPPLANE4=!1,i.CLIPPLANE5=!1,i.CLIPPLANE6=!1,i.ALPHATEST=!1,i.DEPTHPREPASS=!1,i.POINTSIZE=!1,i.FOG=!1,i.SPECULARTERM=!1,i.NORMAL=!1,i.VERTEXCOLOR=!1,i.VERTEXALPHA=!1,i.NUM_BONE_INFLUENCERS=0,i.BonesPerMesh=0,i.INSTANCES=!1,i.INSTANCESCOLOR=!1,i.IMAGEPROCESSINGPOSTPROCESS=!1,i.SKIPFINALCOLORCLAMP=!1,i.NONUNIFORMSCALING=!1,i.LOGARITHMICDEPTH=!1,i.AREALIGHTSUPPORTED=!0,i.AREALIGHTNOROUGHTNESS=!0,i.rebuild(),i}return t(i,e),i}(i.MaterialDefines),w=function(e){function n(n,t,r){void 0===r&&(r=!1);var o=e.call(this,n,t,void 0,r)||this;return o.tileSize=1,o.diffuseColor=new i.Color3(1,1,1),o.specularColor=new i.Color3(.2,.2,.2),o.specularPower=64,o._disableLighting=!1,o._maxSimultaneousLights=4,o._shadersLoaded=!1,o}return t(n,e),n.prototype.needAlphaBlending=function(){return this.alpha<1},n.prototype.needAlphaTesting=function(){return!1},n.prototype.getAlphaTestTexture=function(){return null},n.prototype.isReadyForSubMesh=function(e,n,t){var r=this,s=n._drawWrapper;if(this.isFrozen&&s.effect&&s._wasPreviouslyReady&&s._wasPreviouslyUsingInstances===t)return!0;n.materialDefines||(n.materialDefines=new U);var f=n.materialDefines,l=this.getScene();if(this._isReadyForSubMesh(n))return!0;var u=l.getEngine();if(f._areTexturesDirty&&l.texturesEnabled){if(i.MaterialFlags.DiffuseTextureEnabled)for(var d=[this.diffuseTextureX,this.diffuseTextureY,this.diffuseTextureZ],c=["DIFFUSEX","DIFFUSEY","DIFFUSEZ"],v=0;v<d.length;v++)if(d[v]){if(!d[v].isReady())return!1;f[c[v]]=!0}if(i.MaterialFlags.BumpTextureEnabled)for(d=[this.normalTextureX,this.normalTextureY,this.normalTextureZ],c=["BUMPX","BUMPY","BUMPZ"],v=0;v<d.length;v++)if(d[v]){if(!d[v].isReady())return!1;f[c[v]]=!0}}if(i.PrepareDefinesForMisc(e,l,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),f,void 0,void 0,void 0,this._isVertexOutputInvariant),f._needNormals=i.PrepareDefinesForLights(l,e,f,!1,this._maxSimultaneousLights,this._disableLighting),i.PrepareDefinesForFrameBoundValues(l,u,this,f,!!t),i.PrepareDefinesForAttributes(e,f,!0,!0),f.isDirty){f.markAsProcessed(),l.resetCachedMaterial();var m=new i.EffectFallbacks;f.FOG&&m.addFallback(1,"FOG"),i.HandleFallbacksForShadows(f,m,this.maxSimultaneousLights),f.NUM_BONE_INFLUENCERS>0&&m.addCPUSkinningFallback(0,e),f.IMAGEPROCESSINGPOSTPROCESS=l.imageProcessingConfiguration.applyByPostProcess;var p=[i.VertexBuffer.PositionKind];f.NORMAL&&p.push(i.VertexBuffer.NormalKind),f.VERTEXCOLOR&&p.push(i.VertexBuffer.ColorKind),i.PrepareAttributesForBones(p,e,f,m),i.PrepareAttributesForInstances(p,f);var h=f.toString(),g=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vSpecularColor","vFogInfos","vFogColor","pointSize","mBones","tileSize"],S=["diffuseSamplerX","diffuseSamplerY","diffuseSamplerZ","normalSamplerX","normalSamplerY","normalSamplerZ","logarithmicDepthConstant","areaLightsLTC1Sampler","areaLightsLTC2Sampler"],x=[];i.AddClipPlaneUniforms(g),i.PrepareUniformsAndSamplersList({uniformsNames:g,uniformBuffersNames:x,samplers:S,defines:f,maxSimultaneousLights:this.maxSimultaneousLights,shaderLanguage:this._shaderLanguage}),n.setEffect(l.getEngine().createEffect("triplanar",{attributes:p,uniformsNames:g,uniformBuffersNames:x,samplers:S,defines:h,fallbacks:m,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:function(){return o(r,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return 1!==this.shaderLanguage?[3,2]:[4,Promise.all([Promise.resolve().then(function(){return On}),Promise.resolve().then(function(){return bn})])];case 1:return e.sent(),[3,4];case 2:return[4,Promise.all([Promise.resolve().then(function(){return Rn}),Promise.resolve().then(function(){return wn})])];case 3:e.sent(),e.label=4;case 4:return this._shadersLoaded=!0,[2]}})})}},u),f,this._materialContext)}if(f.AREALIGHTUSED)for(var T=0;T<e.lightSources.length;T++)if(!e.lightSources[T]._isReady())return!1;return!(!n.effect||!n.effect.isReady()||(f._renderId=l.getRenderId(),s._wasPreviouslyReady=!0,s._wasPreviouslyUsingInstances=!!t,0))},n.prototype.bindForSubMesh=function(e,n,t){var r=this.getScene(),o=t.materialDefines;if(o){var a=t.effect;a&&(this._activeEffect=a,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),i.BindBonesParameters(n,this._activeEffect),this._activeEffect.setFloat("tileSize",this.tileSize),this._mustRebind(r,a,t)&&(this.diffuseTextureX&&this._activeEffect.setTexture("diffuseSamplerX",this.diffuseTextureX),this.diffuseTextureY&&this._activeEffect.setTexture("diffuseSamplerY",this.diffuseTextureY),this.diffuseTextureZ&&this._activeEffect.setTexture("diffuseSamplerZ",this.diffuseTextureZ),this.normalTextureX&&this._activeEffect.setTexture("normalSamplerX",this.normalTextureX),this.normalTextureY&&this._activeEffect.setTexture("normalSamplerY",this.normalTextureY),this.normalTextureZ&&this._activeEffect.setTexture("normalSamplerZ",this.normalTextureZ),i.BindClipPlane(a,this,r),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&i.BindLogDepth(o,a,r),r.bindEyePosition(a)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*n.visibility),o.SPECULARTERM&&this._activeEffect.setColor4("vSpecularColor",this.specularColor,this.specularPower),r.lightsEnabled&&!this.disableLighting&&i.BindLights(r,n,this._activeEffect,o,this.maxSimultaneousLights),r.fogEnabled&&n.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,n,this._activeEffect),this._afterBind(n,this._activeEffect,t))}},n.prototype.getAnimatables=function(){var e=[];return this.mixTexture&&this.mixTexture.animations&&this.mixTexture.animations.length>0&&e.push(this.mixTexture),e},n.prototype.getActiveTextures=function(){var i=e.prototype.getActiveTextures.call(this);return this._diffuseTextureX&&i.push(this._diffuseTextureX),this._diffuseTextureY&&i.push(this._diffuseTextureY),this._diffuseTextureZ&&i.push(this._diffuseTextureZ),this._normalTextureX&&i.push(this._normalTextureX),this._normalTextureY&&i.push(this._normalTextureY),this._normalTextureZ&&i.push(this._normalTextureZ),i},n.prototype.hasTexture=function(i){return!!e.prototype.hasTexture.call(this,i)||this._diffuseTextureX===i||this._diffuseTextureY===i||this._diffuseTextureZ===i||this._normalTextureX===i||this._normalTextureY===i||this._normalTextureZ===i},n.prototype.dispose=function(i){this.mixTexture&&this.mixTexture.dispose(),e.prototype.dispose.call(this,i)},n.prototype.clone=function(e){var t=this;return i.SerializationHelper.Clone(function(){return new n(e,t.getScene())},this)},n.prototype.serialize=function(){var i=e.prototype.serialize.call(this);return i.customType="BABYLON.TriPlanarMaterial",i},n.prototype.getClassName=function(){return"TriPlanarMaterial"},n.Parse=function(e,t,r){return i.SerializationHelper.Parse(function(){return new n(e.name,t)},e,t,r)},r([i.serializeAsTexture()],n.prototype,"mixTexture",void 0),r([i.serializeAsTexture("diffuseTextureX")],n.prototype,"_diffuseTextureX",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"diffuseTextureX",void 0),r([i.serializeAsTexture("diffuseTexturY")],n.prototype,"_diffuseTextureY",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"diffuseTextureY",void 0),r([i.serializeAsTexture("diffuseTextureZ")],n.prototype,"_diffuseTextureZ",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"diffuseTextureZ",void 0),r([i.serializeAsTexture("normalTextureX")],n.prototype,"_normalTextureX",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"normalTextureX",void 0),r([i.serializeAsTexture("normalTextureY")],n.prototype,"_normalTextureY",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"normalTextureY",void 0),r([i.serializeAsTexture("normalTextureZ")],n.prototype,"_normalTextureZ",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"normalTextureZ",void 0),r([i.serialize()],n.prototype,"tileSize",void 0),r([i.serializeAsColor3()],n.prototype,"diffuseColor",void 0),r([i.serializeAsColor3()],n.prototype,"specularColor",void 0),r([i.serialize()],n.prototype,"specularPower",void 0),r([i.serialize("disableLighting")],n.prototype,"_disableLighting",void 0),r([i.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"disableLighting",void 0),r([i.serialize("maxSimultaneousLights")],n.prototype,"_maxSimultaneousLights",void 0),r([i.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"maxSimultaneousLights",void 0),n}(i.PushMaterial);i.RegisterClass("BABYLON.TriPlanarMaterial",w);var B=function(e){function i(){var i=e.call(this)||this;return i.BUMP=!1,i.REFLECTION=!1,i.CLIPPLANE=!1,i.CLIPPLANE2=!1,i.CLIPPLANE3=!1,i.CLIPPLANE4=!1,i.CLIPPLANE5=!1,i.CLIPPLANE6=!1,i.ALPHATEST=!1,i.DEPTHPREPASS=!1,i.POINTSIZE=!1,i.FOG=!1,i.NORMAL=!1,i.UV1=!1,i.UV2=!1,i.VERTEXCOLOR=!1,i.VERTEXALPHA=!1,i.NUM_BONE_INFLUENCERS=0,i.BonesPerMesh=0,i.INSTANCES=!1,i.INSTANCESCOLOR=!1,i.SPECULARTERM=!1,i.LOGARITHMICDEPTH=!1,i.USE_REVERSE_DEPTHBUFFER=!1,i.FRESNELSEPARATE=!1,i.BUMPSUPERIMPOSE=!1,i.BUMPAFFECTSREFLECTION=!1,i.USE_WORLD_COORDINATES=!1,i.IMAGEPROCESSING=!1,i.VIGNETTE=!1,i.VIGNETTEBLENDMODEMULTIPLY=!1,i.VIGNETTEBLENDMODEOPAQUE=!1,i.TONEMAPPING=0,i.CONTRAST=!1,i.EXPOSURE=!1,i.COLORCURVES=!1,i.COLORGRADING=!1,i.COLORGRADING3D=!1,i.SAMPLER3DGREENDEPTH=!1,i.SAMPLER3DBGRMAP=!1,i.DITHER=!1,i.IMAGEPROCESSINGPOSTPROCESS=!1,i.SKIPFINALCOLORCLAMP=!1,i.rebuild(),i}return t(i,e),i}(i.MaterialDefines),z=function(e){function n(n,t,r,o){void 0===r&&(r=new i.Vector2(512,512)),void 0===o&&(o=!1);var a=e.call(this,n,t,void 0,o)||this;return a.renderTargetSize=r,a.diffuseColor=new i.Color3(1,1,1),a.specularColor=new i.Color3(0,0,0),a.specularPower=64,a._disableLighting=!1,a._maxSimultaneousLights=4,a.windForce=6,a.windDirection=new i.Vector2(0,1),a.waveHeight=.4,a.bumpHeight=.4,a._bumpSuperimpose=!1,a._fresnelSeparate=!1,a._bumpAffectsReflection=!1,a.waterColor=new i.Color3(.1,.1,.6),a.colorBlendFactor=.2,a.waterColor2=new i.Color3(.1,.1,.6),a.colorBlendFactor2=.2,a.waveLength=.1,a.waveSpeed=1,a.waveCount=20,a.disableClipPlane=!1,a._useWorldCoordinatesForWaveDeformation=!1,a._renderTargets=new i.SmartArray(16),a._mesh=null,a._reflectionTransform=i.Matrix.Zero(),a._offsetMirror=i.Matrix.Zero(),a._tempPlane=new i.Plane(0,0,0,0),a._lastTime=0,a._shadersLoaded=!1,a._lastDeltaTime=0,a._createRenderTargets(a.getScene(),r),a.getRenderTargetTextures=function(){return a._renderTargets.reset(),a._renderTargets.push(a._reflectionRTT),a._renderTargets.push(a._refractionRTT),a._renderTargets},a._imageProcessingConfiguration=a.getScene().imageProcessingConfiguration,a._imageProcessingConfiguration&&(a._imageProcessingObserver=a._imageProcessingConfiguration.onUpdateParameters.add(function(){a._markAllSubMeshesAsImageProcessingDirty()})),a}return t(n,e),Object.defineProperty(n.prototype,"hasRenderTargetTextures",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"refractionTexture",{get:function(){return this._refractionRTT},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"reflectionTexture",{get:function(){return this._reflectionRTT},enumerable:!1,configurable:!0}),n.prototype.addToRenderList=function(e){this._refractionRTT&&this._refractionRTT.renderList&&this._refractionRTT.renderList.push(e),this._reflectionRTT&&this._reflectionRTT.renderList&&this._reflectionRTT.renderList.push(e)},n.prototype.removeFromRenderList=function(e){var i;this._refractionRTT&&this._refractionRTT.renderList&&-1!==(i=this._refractionRTT.renderList.indexOf(e))&&this._refractionRTT.renderList.splice(i,1),this._reflectionRTT&&this._reflectionRTT.renderList&&-1!==(i=this._reflectionRTT.renderList.indexOf(e))&&this._reflectionRTT.renderList.splice(i,1)},n.prototype.enableRenderTargets=function(e){var i=e?1:0;this._refractionRTT&&(this._refractionRTT.refreshRate=i),this._reflectionRTT&&(this._reflectionRTT.refreshRate=i)},n.prototype.getRenderList=function(){return this._refractionRTT?this._refractionRTT.renderList:[]},Object.defineProperty(n.prototype,"renderTargetsEnabled",{get:function(){return!(this._refractionRTT&&0===this._refractionRTT.refreshRate)},enumerable:!1,configurable:!0}),n.prototype.needAlphaBlending=function(){return this.alpha<1},n.prototype.needAlphaTesting=function(){return!1},n.prototype.getAlphaTestTexture=function(){return null},n.prototype.isReadyForSubMesh=function(e,n,t){var r=this,s=n._drawWrapper;if(this.isFrozen&&s.effect&&s._wasPreviouslyReady&&s._wasPreviouslyUsingInstances===t)return!0;n.materialDefines||(n.materialDefines=new B);var f=n.materialDefines,l=this.getScene();if(this._isReadyForSubMesh(n))return!0;var u=l.getEngine();if(f._areTexturesDirty&&(f._needUVs=!1,l.texturesEnabled)){if(this.bumpTexture&&i.MaterialFlags.BumpTextureEnabled){if(!this.bumpTexture.isReady())return!1;f._needUVs=!0,f.BUMP=!0}i.MaterialFlags.ReflectionTextureEnabled&&(f.REFLECTION=!0)}if(i.PrepareDefinesForFrameBoundValues(l,u,this,f,!!t),i.PrepareDefinesForMisc(e,l,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),f,void 0,void 0,void 0,this._isVertexOutputInvariant),f._areMiscDirty&&(f.FRESNELSEPARATE=this._fresnelSeparate,f.BUMPSUPERIMPOSE=this._bumpSuperimpose,f.BUMPAFFECTSREFLECTION=this._bumpAffectsReflection,f.USE_WORLD_COORDINATES=this._useWorldCoordinatesForWaveDeformation),f._needNormals=i.PrepareDefinesForLights(l,e,f,!0,this._maxSimultaneousLights,this._disableLighting),f._areImageProcessingDirty&&this._imageProcessingConfiguration){if(!this._imageProcessingConfiguration.isReady())return!1;this._imageProcessingConfiguration.prepareDefines(f),f.IS_REFLECTION_LINEAR=null!=this.reflectionTexture&&!this.reflectionTexture.gammaSpace,f.IS_REFRACTION_LINEAR=null!=this.refractionTexture&&!this.refractionTexture.gammaSpace}if(i.PrepareDefinesForAttributes(e,f,!0,!0),this._mesh=e,this._waitingRenderList){for(var d=0;d<this._waitingRenderList.length;d++)this.addToRenderList(l.getNodeById(this._waitingRenderList[d]));this._waitingRenderList=null}if(f.isDirty){f.markAsProcessed(),l.resetCachedMaterial();var c=new i.EffectFallbacks;f.FOG&&c.addFallback(1,"FOG"),f.LOGARITHMICDEPTH&&c.addFallback(0,"LOGARITHMICDEPTH"),i.HandleFallbacksForShadows(f,c,this.maxSimultaneousLights),f.NUM_BONE_INFLUENCERS>0&&c.addCPUSkinningFallback(0,e);var v=[i.VertexBuffer.PositionKind];f.NORMAL&&v.push(i.VertexBuffer.NormalKind),f.UV1&&v.push(i.VertexBuffer.UVKind),f.UV2&&v.push(i.VertexBuffer.UV2Kind),f.VERTEXCOLOR&&v.push(i.VertexBuffer.ColorKind),i.PrepareAttributesForBones(v,e,f,c),i.PrepareAttributesForInstances(v,f);var m=f.toString(),p=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vSpecularColor","vFogInfos","vFogColor","pointSize","vNormalInfos","mBones","normalMatrix","logarithmicDepthConstant","reflectionViewProjection","windDirection","waveLength","time","windForce","cameraPosition","bumpHeight","waveHeight","waterColor","waterColor2","colorBlendFactor","colorBlendFactor2","waveSpeed","waveCount"],h=["normalSampler","refractionSampler","reflectionSampler"],g=[];i.ImageProcessingConfiguration&&(i.ImageProcessingConfiguration.PrepareUniforms(p,f),i.ImageProcessingConfiguration.PrepareSamplers(h,f)),i.AddClipPlaneUniforms(p),i.PrepareUniformsAndSamplersList({uniformsNames:p,uniformBuffersNames:g,samplers:h,defines:f,maxSimultaneousLights:this.maxSimultaneousLights,shaderLanguage:this._shaderLanguage}),n.setEffect(l.getEngine().createEffect("water",{attributes:v,uniformsNames:p,uniformBuffersNames:g,samplers:h,defines:m,fallbacks:c,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:function(){return o(r,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return 1!==this.shaderLanguage?[3,2]:[4,Promise.all([Promise.resolve().then(function(){return Gn}),Promise.resolve().then(function(){return Xn})])];case 1:return e.sent(),[3,4];case 2:return[4,Promise.all([Promise.resolve().then(function(){return Zn}),Promise.resolve().then(function(){return qn})])];case 3:e.sent(),e.label=4;case 4:return this._shadersLoaded=!0,[2]}})})}},u),f,this._materialContext)}return!(!n.effect||!n.effect.isReady()||(f._renderId=l.getRenderId(),s._wasPreviouslyReady=!0,s._wasPreviouslyUsingInstances=!!t,0))},n.prototype.bindForSubMesh=function(e,n,t){var r=this.getScene(),o=t.materialDefines;if(o){var a=t.effect;if(a&&this._mesh){this._activeEffect=a,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),i.BindBonesParameters(n,this._activeEffect),this._mustRebind(r,a,t)&&(this.bumpTexture&&i.MaterialFlags.BumpTextureEnabled&&(this._activeEffect.setTexture("normalSampler",this.bumpTexture),this._activeEffect.setFloat2("vNormalInfos",this.bumpTexture.coordinatesIndex,this.bumpTexture.level),this._activeEffect.setMatrix("normalMatrix",this.bumpTexture.getTextureMatrix())),i.BindClipPlane(a,this,r),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&i.BindLogDepth(o,a,r),r.bindEyePosition(a)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*n.visibility),o.SPECULARTERM&&this._activeEffect.setColor4("vSpecularColor",this.specularColor,this.specularPower),r.lightsEnabled&&!this.disableLighting&&i.BindLights(r,n,this._activeEffect,o,this.maxSimultaneousLights),r.fogEnabled&&n.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,n,this._activeEffect),i.BindLogDepth(o,this._activeEffect,r),i.MaterialFlags.ReflectionTextureEnabled&&(this._activeEffect.setTexture("refractionSampler",this._refractionRTT),this._activeEffect.setTexture("reflectionSampler",this._reflectionRTT));var s=i.TmpVectors.Matrix[3].copyFrom(this._reflectionTransform);if(r.floatingOriginMode){var f=i.OffsetViewToRef(r.floatingOriginOffset,r.getViewMatrix(),i.TmpVectors.Matrix[1]);i.MultiplyMatricesToRef(this._offsetMirror,f,s)}s.multiplyToRef(r.getProjectionMatrix(),s);var l=r.getEngine().getDeltaTime();l!==this._lastDeltaTime&&(this._lastDeltaTime=l,this._lastTime+=this._lastDeltaTime),this._activeEffect.setMatrix("reflectionViewProjection",s),this._activeEffect.setVector2("windDirection",this.windDirection),this._activeEffect.setFloat("waveLength",this.waveLength),this._activeEffect.setFloat("time",this._lastTime/1e5),this._activeEffect.setFloat("windForce",this.windForce),this._activeEffect.setFloat("waveHeight",this.waveHeight),this._activeEffect.setFloat("bumpHeight",this.bumpHeight),this._activeEffect.setColor4("waterColor",this.waterColor,1),this._activeEffect.setFloat("colorBlendFactor",this.colorBlendFactor),this._activeEffect.setColor4("waterColor2",this.waterColor2,1),this._activeEffect.setFloat("colorBlendFactor2",this.colorBlendFactor2),this._activeEffect.setFloat("waveSpeed",this.waveSpeed),this._activeEffect.setFloat("waveCount",this.waveCount),this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.applyByPostProcess&&this._imageProcessingConfiguration.bind(this._activeEffect),this._afterBind(n,this._activeEffect,t)}}},n.prototype._createRenderTargets=function(e,n){var t=this;this._refractionRTT=new i.RenderTargetTexture(name+"_refraction",{width:n.x,height:n.y},e,!1,!0),this._refractionRTT.wrapU=i.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._refractionRTT.wrapV=i.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._refractionRTT.ignoreCameraViewport=!0;var r,o=!1;this._refractionRTT.onBeforeRenderObservable.add(function(){o=e.getBoundingBoxRenderer().enabled,e.getBoundingBoxRenderer().enabled=!1}),this._refractionRTT.onAfterRenderObservable.add(function(){e.getBoundingBoxRenderer().enabled=o}),this._reflectionRTT=new i.RenderTargetTexture(name+"_reflection",{width:n.x,height:n.y},e,!1,!0),this._reflectionRTT.wrapU=i.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._reflectionRTT.wrapV=i.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._reflectionRTT.ignoreCameraViewport=!0;var a,s=null,f=i.Matrix.Zero();this._refractionRTT.onBeforeRender=function(){if(t._mesh&&(r=t._mesh.isVisible,t._mesh.isVisible=!1),!t.disableClipPlane){s=e.clipPlane;var n=t._mesh?t._mesh.absolutePosition.y:0;e.clipPlane=i.Plane.FromPositionAndNormal(new i.Vector3(0,n+.05,0),new i.Vector3(0,1,0))}},this._refractionRTT.onAfterRender=function(){t._mesh&&(t._mesh.isVisible=r),t.disableClipPlane||(e.clipPlane=s)},this._reflectionRTT.onBeforeRender=function(){if(t._mesh&&(r=t._mesh.isVisible,t._mesh.isVisible=!1),!t.disableClipPlane){s=e.clipPlane;var n=t._mesh?t._mesh.absolutePosition.y:0;e.clipPlane=i.Plane.FromPositionAndNormal(new i.Vector3(0,n-.05,0),new i.Vector3(0,-1,0)),i.Matrix.ReflectionToRef(e.clipPlane,f),t._offsetMirror.copyFrom(f),e.floatingOriginMode&&(i.OffsetClipPlaneToRef(e.floatingOriginOffset,e.clipPlane,t._tempPlane),i.Matrix.ReflectionToRef(t._tempPlane,t._offsetMirror))}a=e.getViewMatrix(),f.multiplyToRef(a,t._reflectionTransform),e.setTransformMatrix(t._reflectionTransform,e.getProjectionMatrix());var o=i.Vector3.TransformCoordinates(e.activeCamera.position,f);e._mirroredCameraPosition=o,e._forcedViewPosition=o},this._reflectionRTT.onAfterRender=function(){t._mesh&&(t._mesh.isVisible=r),e.clipPlane=s,e.setTransformMatrix(a,e.getProjectionMatrix()),e._mirroredCameraPosition=null,e._forcedViewPosition=null}},n.prototype.getAnimatables=function(){var e=[];return this.bumpTexture&&this.bumpTexture.animations&&this.bumpTexture.animations.length>0&&e.push(this.bumpTexture),this._reflectionRTT&&this._reflectionRTT.animations&&this._reflectionRTT.animations.length>0&&e.push(this._reflectionRTT),this._refractionRTT&&this._refractionRTT.animations&&this._refractionRTT.animations.length>0&&e.push(this._refractionRTT),e},n.prototype.getActiveTextures=function(){var i=e.prototype.getActiveTextures.call(this);return this._bumpTexture&&i.push(this._bumpTexture),i},n.prototype.hasTexture=function(i){return!!e.prototype.hasTexture.call(this,i)||this._bumpTexture===i},n.prototype.dispose=function(i){this.bumpTexture&&this.bumpTexture.dispose();var n=this.getScene().customRenderTargets.indexOf(this._refractionRTT);-1!=n&&this.getScene().customRenderTargets.splice(n,1),-1!=(n=this.getScene().customRenderTargets.indexOf(this._reflectionRTT))&&this.getScene().customRenderTargets.splice(n,1),this._reflectionRTT&&this._reflectionRTT.dispose(),this._refractionRTT&&this._refractionRTT.dispose(),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),e.prototype.dispose.call(this,i)},n.prototype.clone=function(e){var t=this;return i.SerializationHelper.Clone(function(){return new n(e,t.getScene())},this)},n.prototype.serialize=function(){var i=e.prototype.serialize.call(this);if(i.customType="BABYLON.WaterMaterial",i.renderList=[],this._refractionRTT&&this._refractionRTT.renderList)for(var n=0;n<this._refractionRTT.renderList.length;n++)i.renderList.push(this._refractionRTT.renderList[n].id);return i},n.prototype.getClassName=function(){return"WaterMaterial"},n.Parse=function(e,t,r){var o=i.SerializationHelper.Parse(function(){return new n(e.name,t)},e,t,r);return o._waitingRenderList=e.renderList,o},n.CreateDefaultMesh=function(e,n){return i.CreateGround(e,{width:512,height:512,subdivisions:32,updatable:!1},n)},r([i.serializeAsTexture("bumpTexture")],n.prototype,"_bumpTexture",void 0),r([i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"bumpTexture",void 0),r([i.serializeAsColor3()],n.prototype,"diffuseColor",void 0),r([i.serializeAsColor3()],n.prototype,"specularColor",void 0),r([i.serialize()],n.prototype,"specularPower",void 0),r([i.serialize("disableLighting")],n.prototype,"_disableLighting",void 0),r([i.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"disableLighting",void 0),r([i.serialize("maxSimultaneousLights")],n.prototype,"_maxSimultaneousLights",void 0),r([i.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"maxSimultaneousLights",void 0),r([i.serialize()],n.prototype,"windForce",void 0),r([i.serializeAsVector2()],n.prototype,"windDirection",void 0),r([i.serialize()],n.prototype,"waveHeight",void 0),r([i.serialize()],n.prototype,"bumpHeight",void 0),r([i.serialize("bumpSuperimpose")],n.prototype,"_bumpSuperimpose",void 0),r([i.expandToProperty("_markAllSubMeshesAsMiscDirty")],n.prototype,"bumpSuperimpose",void 0),r([i.serialize("fresnelSeparate")],n.prototype,"_fresnelSeparate",void 0),r([i.expandToProperty("_markAllSubMeshesAsMiscDirty")],n.prototype,"fresnelSeparate",void 0),r([i.serialize("bumpAffectsReflection")],n.prototype,"_bumpAffectsReflection",void 0),r([i.expandToProperty("_markAllSubMeshesAsMiscDirty")],n.prototype,"bumpAffectsReflection",void 0),r([i.serializeAsColor3()],n.prototype,"waterColor",void 0),r([i.serialize()],n.prototype,"colorBlendFactor",void 0),r([i.serializeAsColor3()],n.prototype,"waterColor2",void 0),r([i.serialize()],n.prototype,"colorBlendFactor2",void 0),r([i.serialize()],n.prototype,"waveLength",void 0),r([i.serialize()],n.prototype,"waveSpeed",void 0),r([i.serialize()],n.prototype,"waveCount",void 0),r([i.serialize()],n.prototype,"disableClipPlane",void 0),r([i.serialize("useWorldCoordinatesForWaveDeformation")],n.prototype,"_useWorldCoordinatesForWaveDeformation",void 0),r([i.expandToProperty("_markAllSubMeshesAsMiscDirty")],n.prototype,"useWorldCoordinatesForWaveDeformation",void 0),n}(i.PushMaterial);i.RegisterClass("BABYLON.WaterMaterial",z);var G={__proto__:null,CellMaterial:f,CustomMaterial:d,CustomShaderStructure:l,FireMaterial:h,FurMaterial:S,GradientMaterial:T,GridMaterial:C,LavaMaterial:P,MixMaterial:y,NormalMaterial:A,PBRCustomMaterial:m,ShaderAlbedoParts:c,ShaderAlebdoParts:v,ShaderSpecialParts:u,ShadowOnlyMaterial:D,SimpleMaterial:b,SkyMaterial:M,TerrainMaterial:V,TriPlanarMaterial:w,WaterMaterial:z},H="undefined"!=typeof global?global:"undefined"!=typeof window?window:void 0;if(void 0!==H){for(var W in H.BABYLON=H.BABYLON||{},G)H.BABYLON[W]=G[W];H.MATERIALS=G}var X="cellVertexShader",k="attribute position: vec3f;\n#ifdef NORMAL\nattribute normal: vec3f;\n#endif\n#ifdef UV1\nattribute uv: vec2f;\n#endif\n#ifdef UV2\nattribute uv2: vec2f;\n#endif\n#ifdef VERTEXCOLOR\nattribute color: vec4f;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform view: mat4x4f;uniform viewProjection: mat4x4f;\n#ifdef DIFFUSE\nvarying vDiffuseUV: vec2f;uniform diffuseMatrix: mat4x4f;uniform vDiffuseInfos: vec2f;\n#endif\n#ifdef POINTSIZE\nuniform pointSize: f32;\n#endif\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef VERTEXCOLOR\nvar colorUpdated: vec4f=vertexInputs.color;\n#endif\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvar worldPos: vec4f=finalWorld* vec4f(vertexInputs.position,1.0);vertexOutputs.position=uniforms.viewProjection*worldPos;vertexOutputs.vPositionW= worldPos.xyz;\n#ifdef NORMAL\nvertexOutputs.vNormalW=normalize(( finalWorld* vec4f(vertexInputs.normal,0.0)).xyz);\n#endif\n#ifndef UV1\nvar uv: vec2f= vec2f(0.,0.);\n#else\nvar uv: vec2f=vertexInputs.uv;\n#endif\n#ifndef UV2\nvar uv2: vec2f= vec2f(0.,0.);\n#else\nvar uv2: vec2f=vertexInputs.uv2;\n#endif\n#ifdef DIFFUSE\nif (uniforms.vDiffuseInfos.x==0.)\n{vertexOutputs.vDiffuseUV=(uniforms.diffuseMatrix* vec4f(uv,1.0,0.0)).xy;}\nelse\n{vertexOutputs.vDiffuseUV=(uniforms.diffuseMatrix* vec4f(uv2,1.0,0.0)).xy;}\n#endif\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#include<logDepthVertex>\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[X]||(i.ShaderStore.ShadersStoreWGSL[X]=k);var j={__proto__:null,cellVertexShaderWGSL:{name:X,shader:k}},Z="cellPixelShader",Y="uniform vEyePosition: vec4f;uniform vDiffuseColor: vec4f;varying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<helperFunctions>\n#include<lightUboDeclaration>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#ifdef DIFFUSE\nvarying vDiffuseUV: vec2f;var diffuseSamplerSampler: sampler;var diffuseSampler: texture_2d<f32>;uniform vDiffuseInfos: vec2f;\n#endif\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\nfn computeCustomDiffuseLighting(info: lightingInfo,diffuseBaseIn: vec3f,shadow: f32)->vec3f\n{var diffuseBase: vec3f=info.diffuse*shadow;\n#ifdef CELLBASIC\nvar level: f32=1.0;if (info.ndl<0.5) {level=0.5;}\ndiffuseBase=diffuseBase.rgb* vec3f(level,level,level);\n#else\nvar ToonThresholds: array<f32,4>;ToonThresholds[0]=0.95;ToonThresholds[1]=0.5;ToonThresholds[2]=0.2;ToonThresholds[3]=0.03;var ToonBrightnessLevels: array<f32,5>;ToonBrightnessLevels[0]=1.0;ToonBrightnessLevels[1]=0.8;ToonBrightnessLevels[2]=0.6;ToonBrightnessLevels[3]=0.35;ToonBrightnessLevels[4]=0.2;if (info.ndl>ToonThresholds[0])\n{diffuseBase=diffuseBase.rgb*ToonBrightnessLevels[0];}\nelse if (info.ndl>ToonThresholds[1])\n{diffuseBase=diffuseBase.rgb*ToonBrightnessLevels[1];}\nelse if (info.ndl>ToonThresholds[2])\n{diffuseBase=diffuseBase.rgb*ToonBrightnessLevels[2];}\nelse if (info.ndl>ToonThresholds[3])\n{diffuseBase=diffuseBase.rgb*ToonBrightnessLevels[3];}\nelse\n{diffuseBase=diffuseBase.rgb*ToonBrightnessLevels[4];}\n#endif\nreturn max(diffuseBase, vec3f(0.2));}\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvar viewDirectionW: vec3f=normalize(uniforms.vEyePosition.xyz-fragmentInputs.vPositionW);var baseColor: vec4f= vec4f(1.,1.,1.,1.);var diffuseColor: vec3f=uniforms.vDiffuseColor.rgb;var alpha: f32=uniforms.vDiffuseColor.a;\n#ifdef DIFFUSE\nbaseColor=textureSample(diffuseSampler,diffuseSamplerSampler,fragmentInputs.vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4) {discard;}\n#endif\n#include<depthPrePass>\nbaseColor=vec4f(baseColor.rgb*uniforms.vDiffuseInfos.y,baseColor.a);\n#endif\n#ifdef VERTEXCOLOR\nbaseColor=vec4f(baseColor.rgb*fragmentInputs.vColor.rgb,baseColor.a);\n#endif\n#ifdef NORMAL\nvar normalW: vec3f=normalize(fragmentInputs.vNormalW);\n#else\nvar normalW: vec3f= vec3f(1.0,1.0,1.0);\n#endif\nvar info: lightingInfo;var diffuseBase: vec3f= vec3f(0.,0.,0.);var shadow: f32=1.;var glossiness: f32=0.;var aggShadow: f32=0.;var numLights: f32=0.;\n#ifdef SPECULARTERM\nvar specularBase: vec3f= vec3f(0.,0.,0.);\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=fragmentInputs.vColor.a;\n#endif\nvar finalDiffuse: vec3f=clamp(diffuseBase*diffuseColor,vec3f(0.0),vec3f(1.0))*baseColor.rgb;var color: vec4f= vec4f(finalDiffuse,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\nfragmentOutputs.color=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[Z]||(i.ShaderStore.ShadersStoreWGSL[Z]=Y);var K={__proto__:null,cellPixelShaderWGSL:{name:Z,shader:Y}},q="cellVertexShader",Q="precision highp float;attribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform mat4 view;uniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;uniform mat4 diffuseMatrix;uniform vec2 vDiffuseInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef VERTEXCOLOR\nvec4 colorUpdated=color;\n#endif\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);gl_Position=viewProjection*worldPos;vPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x==0.)\n{vDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));}\nelse\n{vDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));}\n#endif\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#include<logDepthVertex>\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStore[q]||(i.ShaderStore.ShadersStore[q]=Q);var J={__proto__:null,cellVertexShader:{name:q,shader:Q}},$="cellPixelShader",ee="precision highp float;uniform vec4 vEyePosition;uniform vec4 vDiffuseColor;varying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<helperFunctions>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;uniform sampler2D diffuseSampler;uniform vec2 vDiffuseInfos;\n#endif\n#include<clipPlaneFragmentDeclaration>\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\nvec3 computeCustomDiffuseLighting(lightingInfo info,vec3 diffuseBase,float shadow)\n{diffuseBase=info.diffuse*shadow;\n#ifdef CELLBASIC\nfloat level=1.0;if (info.ndl<0.5)\nlevel=0.5;diffuseBase.rgb*vec3(level,level,level);\n#else\nfloat ToonThresholds[4];ToonThresholds[0]=0.95;ToonThresholds[1]=0.5;ToonThresholds[2]=0.2;ToonThresholds[3]=0.03;float ToonBrightnessLevels[5];ToonBrightnessLevels[0]=1.0;ToonBrightnessLevels[1]=0.8;ToonBrightnessLevels[2]=0.6;ToonBrightnessLevels[3]=0.35;ToonBrightnessLevels[4]=0.2;if (info.ndl>ToonThresholds[0])\n{diffuseBase.rgb*=ToonBrightnessLevels[0];}\nelse if (info.ndl>ToonThresholds[1])\n{diffuseBase.rgb*=ToonBrightnessLevels[1];}\nelse if (info.ndl>ToonThresholds[2])\n{diffuseBase.rgb*=ToonBrightnessLevels[2];}\nelse if (info.ndl>ToonThresholds[3])\n{diffuseBase.rgb*=ToonBrightnessLevels[3];}\nelse\n{diffuseBase.rgb*=ToonBrightnessLevels[4];}\n#endif\nreturn max(diffuseBase,vec3(0.2));}\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);vec4 baseColor=vec4(1.,1.,1.,1.);vec3 diffuseColor=vDiffuseColor.rgb;float alpha=vDiffuseColor.a;\n#ifdef DIFFUSE\nbaseColor=texture2D(diffuseSampler,vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include<depthPrePass>\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\nlightingInfo info;vec3 diffuseBase=vec3(0.,0.,0.);float shadow=1.;float glossiness=0.;float aggShadow=0.;float numLights=0.;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif \n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;vec4 color=vec4(finalDiffuse,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}";i.ShaderStore.ShadersStore[$]||(i.ShaderStore.ShadersStore[$]=ee);var ie={__proto__:null,cellPixelShader:{name:$,shader:ee}},ne="fireVertexShader",te="attribute position: vec3f;\n#ifdef UV1\nattribute uv: vec2f;\n#endif\n#ifdef UV2\nattribute uv2: vec2f;\n#endif\n#ifdef VERTEXCOLOR\nattribute color: vec4f;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform view: mat4x4f;uniform viewProjection: mat4x4f;\n#ifdef DIFFUSE\nvarying vDiffuseUV: vec2f;\n#endif\n#ifdef POINTSIZE\nuniform pointSize: f32;\n#endif\nvarying vPositionW: vec3f;\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\nuniform time: f32;uniform speed: f32;\n#ifdef DIFFUSE\nvarying vDistortionCoords1: vec2f;varying vDistortionCoords2: vec2f;varying vDistortionCoords3: vec2f;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef VERTEXCOLOR\nvar colorUpdated: vec4f=vertexInputs.color;\n#endif\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvar worldPos: vec4f=finalWorld* vec4f(vertexInputs.position,1.0);vertexOutputs.position=uniforms.viewProjection*worldPos;vertexOutputs.vPositionW= worldPos.xyz;\n#ifdef DIFFUSE\nvertexOutputs.vDiffuseUV=vec2f(vertexInputs.uv.x,vertexInputs.uv.y-0.2);\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<vertexColorMixing>\n#ifdef DIFFUSE\nvar layerSpeed: vec3f= vec3f(-0.2,-0.52,-0.1)*uniforms.speed;vertexOutputs.vDistortionCoords1=vec2f(vertexInputs.uv.x,vertexInputs.uv.y+layerSpeed.x*uniforms.time/1000.0);vertexOutputs.vDistortionCoords2=vec2f(vertexInputs.uv.x,vertexInputs.uv.y+layerSpeed.y*uniforms.time/1000.0);vertexOutputs.vDistortionCoords3=vec2f(vertexInputs.uv.x,vertexInputs.uv.y+layerSpeed.z*uniforms.time/1000.0);\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[ne]||(i.ShaderStore.ShadersStoreWGSL[ne]=te);var re={__proto__:null,fireVertexShaderWGSL:{name:ne,shader:te}},oe="firePixelShader",ae="uniform vEyePosition: vec4f;varying vPositionW: vec3f;\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#ifdef DIFFUSE\nvarying vDiffuseUV: vec2f;var diffuseSamplerSampler: sampler;var diffuseSampler: texture_2d<f32>;uniform vDiffuseInfos: vec2f;\n#endif\nvar distortionSamplerSampler: sampler;var distortionSampler: texture_2d<f32>;var opacitySamplerSampler: sampler;var opacitySampler: texture_2d<f32>;\n#ifdef DIFFUSE\nvarying vDistortionCoords1: vec2f;varying vDistortionCoords2: vec2f;varying vDistortionCoords3: vec2f;\n#endif\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\nfn bx2(x: vec4f)->vec4f\n{return vec4f(2.0)*x- vec4f(1.0);}\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvar viewDirectionW: vec3f=normalize(uniforms.vEyePosition.xyz-fragmentInputs.vPositionW);var baseColor: vec4f= vec4f(1.,1.,1.,1.);var alpha: f32=1.0;\n#ifdef DIFFUSE\nlet distortionAmount0: f32=0.092;let distortionAmount1: f32=0.092;let distortionAmount2: f32=0.092;var heightAttenuation: vec2f= vec2f(0.3,0.39);var noise0: vec4f=textureSample(distortionSampler,distortionSamplerSampler,fragmentInputs.vDistortionCoords1);var noise1: vec4f=textureSample(distortionSampler,distortionSamplerSampler,fragmentInputs.vDistortionCoords2);var noise2: vec4f=textureSample(distortionSampler,distortionSamplerSampler,fragmentInputs.vDistortionCoords3);var noiseSum: vec4f=bx2(noise0)*distortionAmount0+bx2(noise1)*distortionAmount1+bx2(noise2)*distortionAmount2;var perturbedBaseCoords: vec4f= vec4f(fragmentInputs.vDiffuseUV,0.0,1.0)+noiseSum*(fragmentInputs.vDiffuseUV.y*heightAttenuation.x+heightAttenuation.y);var opacityColor: vec4f=textureSample(opacitySampler,opacitySamplerSampler,perturbedBaseCoords.xy);\n#ifdef ALPHATEST\nif (opacityColor.r<0.1) {discard;}\n#endif\n#include<depthPrePass>\nbaseColor=textureSample(diffuseSampler,diffuseSamplerSampler,perturbedBaseCoords.xy)*2.0;baseColor=baseColor*opacityColor;baseColor=vec4f(baseColor.rgb*uniforms.vDiffuseInfos.y,baseColor.a);\n#endif\n#ifdef VERTEXCOLOR\nbaseColor=vec4f(baseColor.rgb*fragmentInputs.vColor.rgb,baseColor.a);\n#endif\nvar diffuseBase: vec3f= vec3f(1.0,1.0,1.0);\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=fragmentInputs.vColor.a;\n#endif\nvar color: vec4f= vec4f(baseColor.rgb,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\nfragmentOutputs.color=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[oe]||(i.ShaderStore.ShadersStoreWGSL[oe]=ae);var se={__proto__:null,firePixelShaderWGSL:{name:oe,shader:ae}},fe="fireVertexShader",le="precision highp float;attribute vec3 position;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform mat4 view;uniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\nuniform float time;uniform float speed;\n#ifdef DIFFUSE\nvarying vec2 vDistortionCoords1;varying vec2 vDistortionCoords2;varying vec2 vDistortionCoords3;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef VERTEXCOLOR\nvec4 colorUpdated=color;\n#endif\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);gl_Position=viewProjection*worldPos;vPositionW=vec3(worldPos);\n#ifdef DIFFUSE\nvDiffuseUV=uv;vDiffuseUV.y-=0.2;\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<vertexColorMixing>\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#ifdef DIFFUSE\nvec3 layerSpeed=vec3(-0.2,-0.52,-0.1)*speed;vDistortionCoords1.x=uv.x;vDistortionCoords1.y=uv.y+layerSpeed.x*time/1000.0;vDistortionCoords2.x=uv.x;vDistortionCoords2.y=uv.y+layerSpeed.y*time/1000.0;vDistortionCoords3.x=uv.x;vDistortionCoords3.y=uv.y+layerSpeed.z*time/1000.0;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStore[fe]||(i.ShaderStore.ShadersStore[fe]=le);var ue={__proto__:null,fireVertexShader:{name:fe,shader:le}},de="firePixelShader",ce="precision highp float;uniform vec4 vEyePosition;varying vec3 vPositionW;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;uniform sampler2D diffuseSampler;uniform vec2 vDiffuseInfos;\n#endif\nuniform sampler2D distortionSampler;uniform sampler2D opacitySampler;\n#ifdef DIFFUSE\nvarying vec2 vDistortionCoords1;varying vec2 vDistortionCoords2;varying vec2 vDistortionCoords3;\n#endif\n#include<clipPlaneFragmentDeclaration>\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\nvec4 bx2(vec4 x)\n{return vec4(2.0)*x-vec4(1.0);}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);vec4 baseColor=vec4(1.,1.,1.,1.);float alpha=1.0;\n#ifdef DIFFUSE\nconst float distortionAmount0 =0.092;const float distortionAmount1 =0.092;const float distortionAmount2 =0.092;vec2 heightAttenuation=vec2(0.3,0.39);vec4 noise0=texture2D(distortionSampler,vDistortionCoords1);vec4 noise1=texture2D(distortionSampler,vDistortionCoords2);vec4 noise2=texture2D(distortionSampler,vDistortionCoords3);vec4 noiseSum=bx2(noise0)*distortionAmount0+bx2(noise1)*distortionAmount1+bx2(noise2)*distortionAmount2;vec4 perturbedBaseCoords=vec4(vDiffuseUV,0.0,1.0)+noiseSum*(vDiffuseUV.y*heightAttenuation.x+heightAttenuation.y);vec4 opacityColor=texture2D(opacitySampler,perturbedBaseCoords.xy);\n#ifdef ALPHATEST\nif (opacityColor.r<0.1)\ndiscard;\n#endif\n#include<depthPrePass>\nbaseColor=texture2D(diffuseSampler,perturbedBaseCoords.xy)*2.0;baseColor*=opacityColor;baseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\nvec3 diffuseBase=vec3(1.0,1.0,1.0);\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\nvec4 color=vec4(baseColor.rgb,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}";i.ShaderStore.ShadersStore[de]||(i.ShaderStore.ShadersStore[de]=ce);var ve={__proto__:null,firePixelShader:{name:de,shader:ce}},me="furVertexShader",pe="attribute position: vec3f;attribute normal: vec3f;\n#ifdef UV1\nattribute uv: vec2f;\n#endif\n#ifdef UV2\nattribute uv2: vec2f;\n#endif\n#ifdef VERTEXCOLOR\nattribute color: vec4f;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\nuniform furLength: f32;uniform furAngle: f32;\n#ifdef HIGHLEVEL\nuniform furOffset: f32;uniform furGravity: vec3f;uniform furTime: f32;uniform furSpacing: f32;uniform furDensity: f32;\n#endif\n#ifdef HEIGHTMAP\nvar heightTextureSampler: sampler;var heightTexture: texture_2d<f32>;\n#endif\n#ifdef HIGHLEVEL\nvarying vFurUV: vec2f;\n#endif\n#include<instancesDeclaration>\nuniform view: mat4x4f;uniform viewProjection: mat4x4f;\n#ifdef DIFFUSE\nvarying vDiffuseUV: vec2f;uniform diffuseMatrix: mat4x4f;uniform vDiffuseInfos: vec2f;\n#endif\n#ifdef POINTSIZE\nuniform pointSize: f32;\n#endif\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\nvarying vfur_length: f32;\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\nfn Rand(rv: vec3f)->f32 {var x: f32=dot(rv, vec3f(12.9898,78.233,24.65487));return fract(sin(x)*43758.5453);}\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef VERTEXCOLOR\nvar colorUpdated: vec4f=vertexInputs.color;\n#endif\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvar r: f32=Rand(vertexInputs.position);\n#ifdef HEIGHTMAP\nvertexOutputs.vfur_length=uniforms.furLength*textureSampleLevel(heightTexture,heightTextureSampler,vertexInputs.uv,0.).x;\n#else\nvertexOutputs.vfur_length=(uniforms.furLength*r);\n#endif\nvar tangent1: vec3f= vec3f(vertexInputs.normal.y,-vertexInputs.normal.x,0);var tangent2: vec3f= vec3f(-vertexInputs.normal.z,0,vertexInputs.normal.x);r=Rand(tangent1*r);var J: f32=(2.0+4.0*r);r=Rand(tangent2*r);var K: f32=(2.0+2.0*r);tangent1=tangent1*J+tangent2*K;tangent1=normalize(tangent1);var newPosition: vec3f=vertexInputs.position+vertexInputs.normal*vertexOutputs.vfur_length*cos(uniforms.furAngle)+tangent1*vertexOutputs.vfur_length*sin(uniforms.furAngle);\n#ifdef HIGHLEVEL\nvar forceDirection: vec3f= vec3f(0.0,0.0,0.0);forceDirection.x=sin(uniforms.furTime+vertexInputs.position.x*0.05)*0.2;forceDirection.y=cos(uniforms.furTime*0.7+vertexInputs.position.y*0.04)*0.2;forceDirection.z=sin(uniforms.furTime*0.7+vertexInputs.position.z*0.04)*0.2;var displacement: vec3f= vec3f(0.0,0.0,0.0);displacement=uniforms.furGravity+forceDirection;var displacementFactor: f32=pow(uniforms.furOffset,3.0);var aNormal: vec3f=vertexInputs.normal;aNormal=vec3f(aNormal.xyz+displacement*displacementFactor);newPosition= vec3f(newPosition.x,newPosition.y,newPosition.z)+(normalize(aNormal)*uniforms.furOffset*uniforms.furSpacing);\n#endif\n#ifdef NORMAL\nvertexOutputs.vNormalW=normalize(( finalWorld* vec4f(vertexInputs.normal,0.0)).xyz);\n#endif\nvertexOutputs.position=uniforms.viewProjection*finalWorld* vec4f(newPosition,1.0);var worldPos: vec4f=finalWorld* vec4f(newPosition,1.0);vertexOutputs.vPositionW= worldPos.xyz;\n#ifndef UV1\nvar uv: vec2f= vec2f(0.,0.);\n#else\nvar uv: vec2f=vertexInputs.uv;\n#endif\n#ifndef UV2\nvar uv2: vec2f= vec2f(0.,0.);\n#else\nvar uv2: vec2f=vertexInputs.uv2;\n#endif\n#ifdef DIFFUSE\nif (uniforms.vDiffuseInfos.x==0.)\n{vertexOutputs.vDiffuseUV=(uniforms.diffuseMatrix* vec4f(uv,1.0,0.0)).xy;}\nelse\n{vertexOutputs.vDiffuseUV=(uniforms.diffuseMatrix* vec4f(uv2,1.0,0.0)).xy;}\n#ifdef HIGHLEVEL\nvertexOutputs.vFurUV=vertexOutputs.vDiffuseUV*uniforms.furDensity;\n#endif\n#else\n#ifdef HIGHLEVEL\nvertexOutputs.vFurUV=uv*uniforms.furDensity;\n#endif\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[me]||(i.ShaderStore.ShadersStoreWGSL[me]=pe);var he={__proto__:null,furVertexShaderWGSL:{name:me,shader:pe}},ge="furPixelShader",Se="uniform vEyePosition: vec4f;uniform vDiffuseColor: vec4f;uniform furColor: vec4f;uniform furLength: f32;varying vPositionW: vec3f;varying vfur_length: f32;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<helperFunctions>\n#include<lightUboDeclaration>[0..maxSimultaneousLights]\n#ifdef DIFFUSE\nvarying vDiffuseUV: vec2f;var diffuseSamplerSampler: sampler;var diffuseSampler: texture_2d<f32>;uniform vDiffuseInfos: vec2f;\n#endif\n#ifdef HIGHLEVEL\nuniform furOffset: f32;uniform furOcclusion: f32;var furTextureSampler: sampler;var furTexture: texture_2d<f32>;varying vFurUV: vec2f;\n#endif\n#include<logDepthDeclaration>\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<fogFragmentDeclaration>\n#include<clipPlaneFragmentDeclaration>\nfn Rand(rv: vec3f)->f32 {var x: f32=dot(rv, vec3f(12.9898,78.233,24.65487));return fract(sin(x)*43758.5453);}\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvar viewDirectionW: vec3f=normalize(uniforms.vEyePosition.xyz-fragmentInputs.vPositionW);var baseColor: vec4f=uniforms.furColor;var diffuseColor: vec3f=uniforms.vDiffuseColor.rgb;var alpha: f32=uniforms.vDiffuseColor.a;\n#ifdef DIFFUSE\nbaseColor=baseColor*textureSample(diffuseSampler,diffuseSamplerSampler,fragmentInputs.vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4) {discard;}\n#endif\n#include<depthPrePass>\nbaseColor=vec4f(baseColor.rgb*uniforms.vDiffuseInfos.y,baseColor.a);\n#endif\n#ifdef VERTEXCOLOR\nbaseColor=vec4f(baseColor.rgb*fragmentInputs.vColor.rgb,baseColor.a);\n#endif\n#ifdef NORMAL\nvar normalW: vec3f=normalize(fragmentInputs.vNormalW);\n#else\nvar normalW: vec3f= vec3f(1.0,1.0,1.0);\n#endif\n#ifdef HIGHLEVEL\nvar furTextureColor: vec4f=textureSample(furTexture,furTextureSampler, vec2f(fragmentInputs.vFurUV.x,fragmentInputs.vFurUV.y));if (furTextureColor.a<=0.0 || furTextureColor.g<uniforms.furOffset) {discard;}\nvar occlusion: f32=mix(0.0,furTextureColor.b*1.2,uniforms.furOffset);baseColor= vec4f(baseColor.xyz*max(occlusion,uniforms.furOcclusion),1.1-uniforms.furOffset);\n#endif\nvar diffuseBase: vec3f= vec3f(0.,0.,0.);var info: lightingInfo;var shadow: f32=1.;var glossiness: f32=0.;var aggShadow: f32=0.;var numLights: f32=0.;\n#ifdef SPECULARTERM\nvar specularBase: vec3f= vec3f(0.,0.,0.);\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=fragmentInputs.vColor.a;\n#endif\nvar finalDiffuse: vec3f=clamp(diffuseBase.rgb*baseColor.rgb,vec3f(0.0),vec3f(1.0));\n#ifdef HIGHLEVEL\nvar color: vec4f= vec4f(finalDiffuse,alpha);\n#else\nvar rr: f32=fragmentInputs.vfur_length/uniforms.furLength*0.5;var color: vec4f= vec4f(finalDiffuse*(0.5+rr),alpha);\n#endif\n#include<logDepthFragment>\n#include<fogFragment>\nfragmentOutputs.color=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[ge]||(i.ShaderStore.ShadersStoreWGSL[ge]=Se);var xe={__proto__:null,furPixelShaderWGSL:{name:ge,shader:Se}},Te="furVertexShader",_e="precision highp float;attribute vec3 position;attribute vec3 normal;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\nuniform float furLength;uniform float furAngle;\n#ifdef HIGHLEVEL\nuniform float furOffset;uniform vec3 furGravity;uniform float furTime;uniform float furSpacing;uniform float furDensity;\n#endif\n#ifdef HEIGHTMAP\nuniform sampler2D heightTexture;\n#endif\n#ifdef HIGHLEVEL\nvarying vec2 vFurUV;\n#endif\n#include<instancesDeclaration>\nuniform mat4 view;uniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;uniform mat4 diffuseMatrix;uniform vec2 vDiffuseInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\nvarying float vfur_length;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\nfloat Rand(vec3 rv) {float x=dot(rv,vec3(12.9898,78.233,24.65487));return fract(sin(x)*43758.5453);}\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef VERTEXCOLOR\nvec4 colorUpdated=color;\n#endif\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nfloat r=Rand(position);\n#ifdef HEIGHTMAP\n#if __VERSION__>100\nvfur_length=furLength*texture(heightTexture,uv).x;\n#else\nvfur_length=furLength*texture2D(heightTexture,uv).r;\n#endif\n#else \nvfur_length=(furLength*r);\n#endif\nvec3 tangent1=vec3(normal.y,-normal.x,0);vec3 tangent2=vec3(-normal.z,0,normal.x);r=Rand(tangent1*r);float J=(2.0+4.0*r);r=Rand(tangent2*r);float K=(2.0+2.0*r);tangent1=tangent1*J+tangent2*K;tangent1=normalize(tangent1);vec3 newPosition=position+normal*vfur_length*cos(furAngle)+tangent1*vfur_length*sin(furAngle);\n#ifdef HIGHLEVEL\nvec3 forceDirection=vec3(0.0,0.0,0.0);forceDirection.x=sin(furTime+position.x*0.05)*0.2;forceDirection.y=cos(furTime*0.7+position.y*0.04)*0.2;forceDirection.z=sin(furTime*0.7+position.z*0.04)*0.2;vec3 displacement=vec3(0.0,0.0,0.0);displacement=furGravity+forceDirection;float displacementFactor=pow(furOffset,3.0);vec3 aNormal=normal;aNormal.xyz+=displacement*displacementFactor;newPosition=vec3(newPosition.x,newPosition.y,newPosition.z)+(normalize(aNormal)*furOffset*furSpacing);\n#endif\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\ngl_Position=viewProjection*finalWorld*vec4(newPosition,1.0);vec4 worldPos=finalWorld*vec4(newPosition,1.0);vPositionW=vec3(worldPos);\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x==0.)\n{vDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));}\nelse\n{vDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));}\n#ifdef HIGHLEVEL\nvFurUV=vDiffuseUV*furDensity;\n#endif\n#else\n#ifdef HIGHLEVEL\nvFurUV=uv*furDensity;\n#endif\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStore[Te]||(i.ShaderStore.ShadersStore[Te]=_e);var Ce={__proto__:null,furVertexShader:{name:Te,shader:_e}},Ee="furPixelShader",Pe="precision highp float;uniform vec4 vEyePosition;uniform vec4 vDiffuseColor;uniform vec4 furColor;uniform float furLength;varying vec3 vPositionW;varying float vfur_length;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<helperFunctions>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;uniform sampler2D diffuseSampler;uniform vec2 vDiffuseInfos;\n#endif\n#ifdef HIGHLEVEL\nuniform float furOffset;uniform float furOcclusion;uniform sampler2D furTexture;varying vec2 vFurUV;\n#endif\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<logDepthDeclaration>\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<fogFragmentDeclaration>\n#include<clipPlaneFragmentDeclaration>\nfloat Rand(vec3 rv) {float x=dot(rv,vec3(12.9898,78.233,24.65487));return fract(sin(x)*43758.5453);}\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);vec4 baseColor=furColor;vec3 diffuseColor=vDiffuseColor.rgb;float alpha=vDiffuseColor.a;\n#ifdef DIFFUSE\nbaseColor*=texture2D(diffuseSampler,vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include<depthPrePass>\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#ifdef HIGHLEVEL\nvec4 furTextureColor=texture2D(furTexture,vec2(vFurUV.x,vFurUV.y));if (furTextureColor.a<=0.0 || furTextureColor.g<furOffset) {discard;}\nfloat occlusion=mix(0.0,furTextureColor.b*1.2,furOffset);baseColor=vec4(baseColor.xyz*max(occlusion,furOcclusion),1.1-furOffset);\n#endif\nvec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;float shadow=1.;float glossiness=0.;float aggShadow=0.;float numLights=0.;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\nvec3 finalDiffuse=clamp(diffuseBase.rgb*baseColor.rgb,0.0,1.0);\n#ifdef HIGHLEVEL\nvec4 color=vec4(finalDiffuse,alpha);\n#else\nfloat r=vfur_length/furLength*0.5;vec4 color=vec4(finalDiffuse*(0.5+r),alpha);\n#endif\n#include<logDepthFragment>\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}";i.ShaderStore.ShadersStore[Ee]||(i.ShaderStore.ShadersStore[Ee]=Pe);var Ie={__proto__:null,furPixelShader:{name:Ee,shader:Pe}},ye="gradientVertexShader",Le="attribute position: vec3f;\n#ifdef NORMAL\nattribute normal: vec3f;\n#endif\n#ifdef UV1\nattribute uv: vec2f;\n#endif\n#ifdef UV2\nattribute uv2: vec2f;\n#endif\n#ifdef VERTEXCOLOR\nattribute color: vec4f;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform view: mat4x4f;uniform viewProjection: mat4x4f;\n#ifdef POINTSIZE\nuniform pointSize: f32;\n#endif\nvarying vPositionW: vec3f;varying vPosition: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef VERTEXCOLOR\nvar colorUpdated: vec4f=vertexInputs.color;\n#endif\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvar worldPos: vec4f=finalWorld* vec4f(vertexInputs.position,1.0);vertexOutputs.position=uniforms.viewProjection*worldPos;vertexOutputs.vPositionW= worldPos.xyz;vertexOutputs.vPosition=vertexInputs.position;\n#ifdef NORMAL\nvertexOutputs.vNormalW=normalize(( finalWorld* vec4f(vertexInputs.normal,0.0)).xyz);\n#endif\n#ifndef UV1\nvar uv: vec2f= vec2f(0.,0.);\n#else\nvar uv: vec2f=vertexInputs.uv;\n#endif\n#ifndef UV2\nvar uv2: vec2f= vec2f(0.,0.);\n#else\nvar uv2: vec2f=vertexInputs.uv2;\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[ye]||(i.ShaderStore.ShadersStoreWGSL[ye]=Le);var Ae={__proto__:null,gradientVertexShaderWGSL:{name:ye,shader:Le}},Oe="gradientPixelShader",De="uniform vEyePosition: vec4f;uniform topColor: vec4f;uniform bottomColor: vec4f;uniform offset: f32;uniform scale: f32;uniform smoothness: f32;varying vPositionW: vec3f;varying vPosition: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<helperFunctions>\n#include<lightUboDeclaration>[0]\n#include<lightUboDeclaration>[1]\n#include<lightUboDeclaration>[2]\n#include<lightUboDeclaration>[3]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvar viewDirectionW: vec3f=normalize(uniforms.vEyePosition.xyz-fragmentInputs.vPositionW);var h: f32=fragmentInputs.vPosition.y*uniforms.scale+uniforms.offset;var mysmoothness: f32=clamp(uniforms.smoothness,0.01,max(uniforms.smoothness,10.));var baseColor: vec4f=mix(uniforms.bottomColor,uniforms.topColor,vec4f(max(pow(max(h,0.0),mysmoothness),0.0)));var diffuseColor: vec3f=baseColor.rgb;var alpha: f32=baseColor.a;\n#ifdef ALPHATEST\nif (baseColor.a<0.4) {discard;}\n#endif\n#include<depthPrePass>\n#ifdef VERTEXCOLOR\nbaseColor=vec4f(baseColor.rgb*fragmentInputs.vColor.rgb,baseColor.a);\n#endif\n#ifdef NORMAL\nvar normalW: vec3f=normalize(fragmentInputs.vNormalW);\n#else\nvar normalW: vec3f= vec3f(1.0,1.0,1.0);\n#endif\n#ifdef EMISSIVE\nvar diffuseBase: vec3f=baseColor.rgb;\n#else\nvar diffuseBase: vec3f= vec3f(0.,0.,0.);\n#endif\nvar info: lightingInfo;var shadow: f32=1.;var glossiness: f32=0.;var aggShadow: f32=0.;var numLights: f32=0.;\n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=fragmentInputs.vColor.a;\n#endif\nvar finalDiffuse: vec3f=clamp(diffuseBase*diffuseColor,vec3f(0.0),vec3f(1.0))*baseColor.rgb;var color: vec4f= vec4f(finalDiffuse,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\nfragmentOutputs.color=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[Oe]||(i.ShaderStore.ShadersStoreWGSL[Oe]=De);var Ne={__proto__:null,gradientPixelShaderWGSL:{name:Oe,shader:De}},be="gradientVertexShader",Fe="precision highp float;attribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform mat4 view;uniform mat4 viewProjection;\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;varying vec3 vPosition;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef VERTEXCOLOR\nvec4 colorUpdated=color;\n#endif\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);gl_Position=viewProjection*worldPos;vPositionW=vec3(worldPos);vPosition=position;\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStore[be]||(i.ShaderStore.ShadersStore[be]=Fe);var Me={__proto__:null,gradientVertexShader:{name:be,shader:Fe}},Re="gradientPixelShader",Ve="precision highp float;uniform vec4 vEyePosition;uniform vec4 topColor;uniform vec4 bottomColor;uniform float offset;uniform float scale;uniform float smoothness;varying vec3 vPositionW;varying vec3 vPosition;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<helperFunctions>\n#include<__decl__lightFragment>[0]\n#include<__decl__lightFragment>[1]\n#include<__decl__lightFragment>[2]\n#include<__decl__lightFragment>[3]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);float h=vPosition.y*scale+offset;float mysmoothness=clamp(smoothness,0.01,max(smoothness,10.));vec4 baseColor=mix(bottomColor,topColor,max(pow(max(h,0.0),mysmoothness),0.0));vec3 diffuseColor=baseColor.rgb;float alpha=baseColor.a;\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include<depthPrePass>\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#ifdef EMISSIVE\nvec3 diffuseBase=baseColor.rgb;\n#else\nvec3 diffuseBase=vec3(0.,0.,0.);\n#endif\nlightingInfo info;float shadow=1.;float glossiness=0.;float aggShadow=0.;float numLights=0.;\n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;vec4 color=vec4(finalDiffuse,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStore[Re]||(i.ShaderStore.ShadersStore[Re]=Ve);var Ue={__proto__:null,gradientPixelShader:{name:Re,shader:Ve}},we="gridVertexShader",Be="attribute position: vec3f;attribute normal: vec3f;\n#ifdef UV1\nattribute uv: vec2f;\n#endif\n#ifdef UV2\nattribute uv2: vec2f;\n#endif\n#include<instancesDeclaration>\n#include<sceneUboDeclaration>\nvarying vPosition: vec3f;varying vNormal: vec3f;\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#ifdef OPACITY\nvarying vOpacityUV: vec2f;uniform opacityMatrix: mat4x4f;uniform vOpacityInfos: vec2f;\n#endif\n#include<clipPlaneVertexDeclaration>\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\nvar worldPos: vec4f=finalWorld* vec4f(vertexInputs.position,1.0);\n#include<fogVertex>\nvar cameraSpacePosition: vec4f=scene.view*worldPos;vertexOutputs.position=scene.projection*cameraSpacePosition;\n#ifdef OPACITY\n#ifndef UV1\nvar uv: vec2f= vec2f(0.,0.);\n#else\nvar uv: vec2f=vertexInputs.uv;\n#endif\n#ifndef UV2\nvar uv2: vec2f= vec2f(0.,0.);\n#else\nvar uv2: vec2f=vertexInputs.uv2;\n#endif\nif (uniforms.vOpacityInfos.x==0.)\n{vertexOutputs.vOpacityUV=(uniforms.opacityMatrix* vec4f(uv,1.0,0.0)).xy;}\nelse\n{vertexOutputs.vOpacityUV=(uniforms.opacityMatrix* vec4f(uv2,1.0,0.0)).xy;}\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\nvertexOutputs.vPosition=vertexInputs.position;vertexOutputs.vNormal=vertexInputs.normal;\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[we]||(i.ShaderStore.ShadersStoreWGSL[we]=Be);var ze={__proto__:null,gridVertexShaderWGSL:{name:we,shader:Be}},Ge="gridPixelShader",He="#define SQRT2 1.41421356\n#define PI 3.14159\nuniform visibility: f32;uniform mainColor: vec3f;uniform lineColor: vec3f;uniform gridControl: vec4f;uniform gridOffset: vec3f;varying vPosition: vec3f;varying vNormal: vec3f;\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#ifdef OPACITY\nvarying vOpacityUV: vec2f;var opacitySamplerSampler: sampler;var opacitySampler: texture_2d<f32>;uniform vOpacityInfos: vec2f;\n#endif\nfn getDynamicVisibility(position: f32)->f32 {var majorGridFrequency: f32=uniforms.gridControl.y;if (floor(position+0.5)==floor(position/majorGridFrequency+0.5)*majorGridFrequency)\n{return 1.0;}\nreturn uniforms.gridControl.z;}\nfn getAnisotropicAttenuation(differentialLength: f32)->f32 {let maxNumberOfLines: f32=10.0;return clamp(1.0/(differentialLength+1.0)-1.0/maxNumberOfLines,0.0,1.0);}\nfn isPointOnLine(position: f32,differentialLength: f32)->f32 {var fractionPartOfPosition: f32=position-floor(position+0.5);fractionPartOfPosition=fractionPartOfPosition/differentialLength;\n#ifdef ANTIALIAS\nfractionPartOfPosition=clamp(fractionPartOfPosition,-1.,1.);var result: f32=0.5+0.5*cos(fractionPartOfPosition*PI);return result;\n#else\nif (abs(fractionPartOfPosition)<SQRT2/4.) {return 1.;}\nreturn 0.;\n#endif\n}\nfn contributionOnAxis(position: f32)->f32 {var differentialLength: f32=length( vec2f(dpdx(position),dpdy(position)));differentialLength=differentialLength*SQRT2;var result: f32=isPointOnLine(position,differentialLength);var dynamicVisibility: f32=getDynamicVisibility(position);result=result*dynamicVisibility;var anisotropicAttenuation: f32=getAnisotropicAttenuation(differentialLength);result=result*anisotropicAttenuation;return result;}\nfn normalImpactOnAxis(x: f32)->f32 {var normalImpact: f32=clamp(1.0-3.0*abs(x*x*x),0.0,1.0);return normalImpact;}\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvar gridRatio: f32=uniforms.gridControl.x;var gridPos: vec3f=(fragmentInputs.vPosition+uniforms.gridOffset.xyz)/gridRatio;var x: f32=contributionOnAxis(gridPos.x);var y: f32=contributionOnAxis(gridPos.y);var z: f32=contributionOnAxis(gridPos.z);var normal: vec3f=normalize(fragmentInputs.vNormal);x=x*normalImpactOnAxis(normal.x);y=y*normalImpactOnAxis(normal.y);z=z*normalImpactOnAxis(normal.z);\n#ifdef MAX_LINE\nvar grid: f32=clamp(max(max(x,y),z),0.,1.);\n#else\nvar grid: f32=clamp(x+y+z,0.,1.);\n#endif\nvar color: vec4f=vec4f(mix(uniforms.mainColor,uniforms.lineColor,vec3f(grid)),1.0);\n#ifdef FOG\n#include<fogFragment>\n#endif\nvar opacity: f32=1.0;\n#ifdef TRANSPARENT\nopacity=clamp(grid,0.08,uniforms.gridControl.w*grid);\n#endif\n#ifdef OPACITY\nopacity=opacity*textureSample(opacitySampler,opacitySamplerSampler,fragmentInputs.vOpacityUV).a;\n#endif\nfragmentOutputs.color= vec4f(color.rgb,opacity*uniforms.visibility);\n#ifdef TRANSPARENT\n#ifdef PREMULTIPLYALPHA\nfragmentOutputs.color=vec4f(fragmentOutputs.color.rgb*opacity,fragmentOutputs.color.a);\n#endif\n#else\n#endif\n#include<logDepthFragment>\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[Ge]||(i.ShaderStore.ShadersStoreWGSL[Ge]=He);var We={__proto__:null,gridPixelShaderWGSL:{name:Ge,shader:He}},Xe="gridVertexShader",ke="precision highp float;attribute vec3 position;attribute vec3 normal;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#include<instancesDeclaration>\n#include<__decl__sceneVertex>\nvarying vec3 vPosition;varying vec3 vNormal;\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#ifdef OPACITY\nvarying vec2 vOpacityUV;uniform mat4 opacityMatrix;uniform vec2 vOpacityInfos;\n#endif\n#include<clipPlaneVertexDeclaration>\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\nvec4 worldPos=finalWorld*vec4(position,1.0);\n#include<fogVertex>\nvec4 cameraSpacePosition=view*worldPos;gl_Position=projection*cameraSpacePosition;\n#ifdef OPACITY\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\nif (vOpacityInfos.x==0.)\n{vOpacityUV=vec2(opacityMatrix*vec4(uv,1.0,0.0));}\nelse\n{vOpacityUV=vec2(opacityMatrix*vec4(uv2,1.0,0.0));}\n#endif \n#include<clipPlaneVertex>\n#include<logDepthVertex>\nvPosition=position;vNormal=normal;\n#define CUSTOM_VERTEX_MAIN_END\n}";i.ShaderStore.ShadersStore[Xe]||(i.ShaderStore.ShadersStore[Xe]=ke);var je={__proto__:null,gridVertexShader:{name:Xe,shader:ke}},Ze="gridPixelShader",Ye="#extension GL_OES_standard_derivatives : enable\n#define SQRT2 1.41421356\n#define PI 3.14159\nprecision highp float;uniform float visibility;uniform vec3 mainColor;uniform vec3 lineColor;uniform vec4 gridControl;uniform vec3 gridOffset;varying vec3 vPosition;varying vec3 vNormal;\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#ifdef OPACITY\nvarying vec2 vOpacityUV;uniform sampler2D opacitySampler;uniform vec2 vOpacityInfos;\n#endif\nfloat getDynamicVisibility(float position) {float majorGridFrequency=gridControl.y;if (floor(position+0.5)==floor(position/majorGridFrequency+0.5)*majorGridFrequency)\n{return 1.0;}\nreturn gridControl.z;}\nfloat getAnisotropicAttenuation(float differentialLength) {const float maxNumberOfLines=10.0;return clamp(1.0/(differentialLength+1.0)-1.0/maxNumberOfLines,0.0,1.0);}\nfloat isPointOnLine(float position,float differentialLength) {float fractionPartOfPosition=position-floor(position+0.5); \nfractionPartOfPosition/=differentialLength; \n#ifdef ANTIALIAS\nfractionPartOfPosition=clamp(fractionPartOfPosition,-1.,1.);float result=0.5+0.5*cos(fractionPartOfPosition*PI); \nreturn result;\n#else\nreturn abs(fractionPartOfPosition)<SQRT2/4. ? 1. : 0.;\n#endif\n}\nfloat contributionOnAxis(float position) {float differentialLength=length(vec2(dFdx(position),dFdy(position)));differentialLength*=SQRT2; \nfloat result=isPointOnLine(position,differentialLength);float dynamicVisibility=getDynamicVisibility(position);result*=dynamicVisibility;float anisotropicAttenuation=getAnisotropicAttenuation(differentialLength);result*=anisotropicAttenuation;return result;}\nfloat normalImpactOnAxis(float x) {float normalImpact=clamp(1.0-3.0*abs(x*x*x),0.0,1.0);return normalImpact;}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nfloat gridRatio=gridControl.x;vec3 gridPos=(vPosition+gridOffset.xyz)/gridRatio;float x=contributionOnAxis(gridPos.x);float y=contributionOnAxis(gridPos.y);float z=contributionOnAxis(gridPos.z);vec3 normal=normalize(vNormal);x*=normalImpactOnAxis(normal.x);y*=normalImpactOnAxis(normal.y);z*=normalImpactOnAxis(normal.z);\n#ifdef MAX_LINE\nfloat grid=clamp(max(max(x,y),z),0.,1.);\n#else\nfloat grid=clamp(x+y+z,0.,1.);\n#endif\nvec3 color=mix(mainColor,lineColor,grid);\n#ifdef FOG\n#include<fogFragment>\n#endif\nfloat opacity=1.0;\n#ifdef TRANSPARENT\nopacity=clamp(grid,0.08,gridControl.w*grid);\n#endif\n#ifdef OPACITY\nopacity*=texture2D(opacitySampler,vOpacityUV).a;\n#endif\ngl_FragColor=vec4(color.rgb,opacity*visibility);\n#ifdef TRANSPARENT\n#ifdef PREMULTIPLYALPHA\ngl_FragColor.rgb*=opacity;\n#endif\n#else\n#endif\n#include<logDepthFragment>\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStore[Ze]||(i.ShaderStore.ShadersStore[Ze]=Ye);var Ke={__proto__:null,gridPixelShader:{name:Ze,shader:Ye}},qe="lavaVertexShader",Qe="uniform time: f32;uniform lowFrequencySpeed: f32;varying noise: f32;attribute position: vec3f;\n#ifdef NORMAL\nattribute normal: vec3f;\n#endif\n#ifdef UV1\nattribute uv: vec2f;\n#endif\n#ifdef UV2\nattribute uv2: vec2f;\n#endif\n#ifdef VERTEXCOLOR\nattribute color: vec4f;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform view: mat4x4f;uniform viewProjection: mat4x4f;\n#ifdef DIFFUSE\nvarying vDiffuseUV: vec2f;uniform diffuseMatrix: mat4x4f;uniform vDiffuseInfos: vec2f;\n#endif\n#ifdef POINTSIZE\nuniform pointSize: f32;\n#endif\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\n/* NOISE FUNCTIONS */\nfn mod289v3(x: vec3f)->vec3f\n{return x-floor(x*(1.0/289.0))*289.0;}\nfn mod289v4(x: vec4f)->vec4f\n{return x-floor(x*(1.0/289.0))*289.0;}\nfn permute(x: vec4f)->vec4f\n{return mod289v4(((x*34.0)+1.0)*x);}\nfn taylorInvSqrt(r: vec4f)->vec4f\n{return vec4f(1.79284291400159)-0.85373472095314*r;}\nfn fade(t: vec3f)->vec3f {return t*t*t*(t*(t*6.0-15.0)+10.0);}\nfn pnoise(P: vec3f,rep: vec3f)->f32\n{var Pi0: vec3f=(P-rep*floor(P/rep)); \nPi0=floor(Pi0);var Pi1: vec3f=Pi0+ vec3f(1.0);Pi1=Pi1-rep*floor(Pi1/rep);Pi0=mod289v3(Pi0);Pi1=mod289v3(Pi1);var Pf0: vec3f=fract(P);var Pf1: vec3f=Pf0- vec3f(1.0);var ix: vec4f= vec4f(Pi0.x,Pi1.x,Pi0.x,Pi1.x);var iy: vec4f= vec4f(Pi0.y,Pi0.y,Pi1.y,Pi1.y);var iz0: vec4f= vec4f(Pi0.z);var iz1: vec4f= vec4f(Pi1.z);var ixy: vec4f=permute(permute(ix)+iy);var ixy0: vec4f=permute(ixy+iz0);var ixy1: vec4f=permute(ixy+iz1);var gx0: vec4f=ixy0*(1.0/7.0);var gy0: vec4f=fract(floor(gx0)*(1.0/7.0))-0.5;gx0=fract(gx0);var gz0: vec4f= vec4f(0.5)-abs(gx0)-abs(gy0);var sz0: vec4f=step(gz0, vec4f(0.0));gx0=gx0-sz0*(step( vec4f(0.0),gx0)-0.5);gy0=gy0-sz0*(step( vec4f(0.0),gy0)-0.5);var gx1: vec4f=ixy1*(1.0/7.0);var gy1: vec4f=fract(floor(gx1)*(1.0/7.0))-0.5;gx1=fract(gx1);var gz1: vec4f= vec4f(0.5)-abs(gx1)-abs(gy1);var sz1: vec4f=step(gz1, vec4f(0.0));gx1=gx1-sz1*(step( vec4f(0.0),gx1)-0.5);gy1=gy1-sz1*(step( vec4f(0.0),gy1)-0.5);var g000: vec3f= vec3f(gx0.x,gy0.x,gz0.x);var g100: vec3f= vec3f(gx0.y,gy0.y,gz0.y);var g010: vec3f= vec3f(gx0.z,gy0.z,gz0.z);var g110: vec3f= vec3f(gx0.w,gy0.w,gz0.w);var g001: vec3f= vec3f(gx1.x,gy1.x,gz1.x);var g101: vec3f= vec3f(gx1.y,gy1.y,gz1.y);var g011: vec3f= vec3f(gx1.z,gy1.z,gz1.z);var g111: vec3f= vec3f(gx1.w,gy1.w,gz1.w);var norm0: vec4f=taylorInvSqrt( vec4f(dot(g000,g000),dot(g010,g010),dot(g100,g100),dot(g110,g110)));g000=g000*norm0.x;g010=g010*norm0.y;g100=g100*norm0.z;g110=g110*norm0.w;var norm1: vec4f=taylorInvSqrt( vec4f(dot(g001,g001),dot(g011,g011),dot(g101,g101),dot(g111,g111)));g001=g001*norm1.x;g011=g011*norm1.y;g101=g101*norm1.z;g111=g111*norm1.w;var n000: f32=dot(g000,Pf0);var n100: f32=dot(g100, vec3f(Pf1.x,Pf0.yz));var n010: f32=dot(g010, vec3f(Pf0.x,Pf1.y,Pf0.z));var n110: f32=dot(g110, vec3f(Pf1.xy,Pf0.z));var n001: f32=dot(g001, vec3f(Pf0.xy,Pf1.z));var n101: f32=dot(g101, vec3f(Pf1.x,Pf0.y,Pf1.z));var n011: f32=dot(g011, vec3f(Pf0.x,Pf1.yz));var n111: f32=dot(g111,Pf1);var fade_xyz: vec3f=fade(Pf0);var n_z: vec4f=mix( vec4f(n000,n100,n010,n110), vec4f(n001,n101,n011,n111), vec4f(fade_xyz.z));var n_yz: vec2f=mix(n_z.xy,n_z.zw, vec2f(fade_xyz.y));var n_xyz: f32=mix(n_yz.x,n_yz.y,fade_xyz.x);return 2.2*n_xyz;}\n/* END FUNCTION */\nfn turbulence(p: vec3f)->f32 {var w: f32=100.0;var t: f32=-.5;for (var f: f32=1.0; f<=10.0; f=f+1.0){var power: f32=pow(2.0,f);t=t+abs(pnoise( vec3f(power*p), vec3f(10.0,10.0,10.0))/power);}\nreturn t;}\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef VERTEXCOLOR\nvar colorUpdated: vec4f=vertexInputs.color;\n#endif\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\n#ifdef NORMAL\nvertexOutputs.noise=10.0*-.10*turbulence(.5*vertexInputs.normal+uniforms.time*1.15);var b: f32=uniforms.lowFrequencySpeed*5.0*pnoise(0.05*vertexInputs.position+ vec3f(uniforms.time*1.025), vec3f(100.0));var displacement: f32=-1.5*vertexOutputs.noise+b;var newPosition: vec3f=vertexInputs.position+vertexInputs.normal*displacement;vertexOutputs.position=uniforms.viewProjection*finalWorld* vec4f(newPosition,1.0);var worldPos: vec4f=finalWorld* vec4f(newPosition,1.0);vertexOutputs.vPositionW= worldPos.xyz;vertexOutputs.vNormalW=normalize(( finalWorld* vec4f(vertexInputs.normal,0.0)).xyz);\n#endif\n#ifndef UV1\nvar uv: vec2f= vec2f(0.,0.);\n#else\nvar uv: vec2f=vertexInputs.uv;\n#endif\n#ifndef UV2\nvar uv2: vec2f= vec2f(0.,0.);\n#else\nvar uv2: vec2f=vertexInputs.uv2;\n#endif\n#ifdef DIFFUSE\nif (uniforms.vDiffuseInfos.x==0.)\n{vertexOutputs.vDiffuseUV=(uniforms.diffuseMatrix* vec4f(uv,1.0,0.0)).xy;}\nelse\n{vertexOutputs.vDiffuseUV=(uniforms.diffuseMatrix* vec4f(uv2,1.0,0.0)).xy;}\n#endif\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#include<logDepthVertex>\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[qe]||(i.ShaderStore.ShadersStoreWGSL[qe]=Qe);var Je={__proto__:null,lavaVertexShaderWGSL:{name:qe,shader:Qe}},$e="lavaPixelShader",ei="uniform vEyePosition: vec4f;uniform vDiffuseColor: vec4f;varying vPositionW: vec3f;uniform time: f32;uniform speed: f32;uniform movingSpeed: f32;uniform fogColor: vec3f;var noiseTextureSampler: sampler;var noiseTexture: texture_2d<f32>;uniform fogDensity: f32;varying noise: f32;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<helperFunctions>\n#include<lightUboDeclaration>[0]\n#include<lightUboDeclaration>[1]\n#include<lightUboDeclaration>[2]\n#include<lightUboDeclaration>[3]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#ifdef DIFFUSE\nvarying vDiffuseUV: vec2f;var diffuseSamplerSampler: sampler;var diffuseSampler: texture_2d<f32>;uniform vDiffuseInfos: vec2f;\n#endif\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\nfn random(scale: vec3f,seed: f32)->f32 {return fract(sin(dot(fragmentInputs.position.xyz+seed,scale))*43758.5453+seed);}\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvar viewDirectionW: vec3f=normalize(uniforms.vEyePosition.xyz-fragmentInputs.vPositionW);var baseColor: vec4f= vec4f(1.,1.,1.,1.);var diffuseColor: vec3f=uniforms.vDiffuseColor.rgb;var alpha: f32=uniforms.vDiffuseColor.a;\n#ifdef DIFFUSE\nvar noiseTex: vec4f=textureSample(noiseTexture,noiseTextureSampler,fragmentInputs.vDiffuseUV);var T1: vec2f=fragmentInputs.vDiffuseUV+ vec2f(1.5,-1.5)*uniforms.time*0.02;var T2: vec2f=fragmentInputs.vDiffuseUV+ vec2f(-0.5,2.0)*uniforms.time*0.01*uniforms.speed;T1=vec2f(T1.x+noiseTex.x*2.0,T1.y+noiseTex.y*2.0);T2=vec2f(T2.x-noiseTex.y*0.2-uniforms.time*0.001*uniforms.movingSpeed,T2.y+noiseTex.z*0.2+uniforms.time*0.002*uniforms.movingSpeed);var p: f32=textureSample(noiseTexture,noiseTextureSampler,T1*3.0).a;var lavaColor: vec4f=textureSample(diffuseSampler,diffuseSamplerSampler,T2*4.0);var temp: vec4f=lavaColor*( vec4f(p,p,p,p)*2.)+(lavaColor*lavaColor-0.1);baseColor=temp;var depth: f32=fragmentInputs.position.z*4.0;let LOG2: f32=1.442695;var fogFactor: f32=exp2(-uniforms.fogDensity*uniforms.fogDensity*depth*depth*LOG2);fogFactor=1.0-clamp(fogFactor,0.0,1.0);baseColor=mix(baseColor, vec4f(uniforms.fogColor,baseColor.w), vec4f(fogFactor));diffuseColor=baseColor.rgb;\n#ifdef ALPHATEST\nif (baseColor.a<0.4) {discard;}\n#endif\n#include<depthPrePass>\nbaseColor=vec4f(baseColor.rgb*uniforms.vDiffuseInfos.y,baseColor.a);\n#endif\n#ifdef VERTEXCOLOR\nbaseColor=vec4f(baseColor.rgb*fragmentInputs.vColor.rgb,baseColor.a);\n#endif\n#ifdef NORMAL\nvar normalW: vec3f=normalize(fragmentInputs.vNormalW);\n#else\nvar normalW: vec3f= vec3f(1.0,1.0,1.0);\n#endif\n#ifdef UNLIT\nvar diffuseBase: vec3f= vec3f(1.,1.,1.);\n#else\nvar diffuseBase: vec3f= vec3f(0.,0.,0.);var info: lightingInfo;var shadow: f32=1.;var glossiness: f32=0.;var aggShadow: f32=0.;var numLights: f32=0.;\n#include<lightFragment>[0]\n#include<lightFragment>[1]\n#include<lightFragment>[2]\n#include<lightFragment>[3]\n#endif\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=fragmentInputs.vColor.a;\n#endif\nvar finalDiffuse: vec3f=clamp(diffuseBase*diffuseColor,vec3f(0.0),vec3f(1.0))*baseColor.rgb;var color: vec4f= vec4f(finalDiffuse,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\nfragmentOutputs.color=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[$e]||(i.ShaderStore.ShadersStoreWGSL[$e]=ei);var ii={__proto__:null,lavaPixelShaderWGSL:{name:$e,shader:ei}},ni="lavaVertexShader",ti="precision highp float;uniform float time;uniform float lowFrequencySpeed;varying float noise;attribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform mat4 view;uniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;uniform mat4 diffuseMatrix;uniform vec2 vDiffuseInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n/* NOISE FUNCTIONS */\nvec3 mod289(vec3 x)\n{return x-floor(x*(1.0/289.0))*289.0;}\nvec4 mod289(vec4 x)\n{return x-floor(x*(1.0/289.0))*289.0;}\nvec4 permute(vec4 x)\n{return mod289(((x*34.0)+1.0)*x);}\nvec4 taylorInvSqrt(vec4 r)\n{return 1.79284291400159-0.85373472095314*r;}\nvec3 fade(vec3 t) {return t*t*t*(t*(t*6.0-15.0)+10.0);}\nfloat pnoise(vec3 P,vec3 rep)\n{vec3 Pi0=mod(floor(P),rep); \nvec3 Pi1=mod(Pi0+vec3(1.0),rep); \nPi0=mod289(Pi0);Pi1=mod289(Pi1);vec3 Pf0=fract(P); \nvec3 Pf1=Pf0-vec3(1.0); \nvec4 ix=vec4(Pi0.x,Pi1.x,Pi0.x,Pi1.x);vec4 iy=vec4(Pi0.yy,Pi1.yy);vec4 iz0=Pi0.zzzz;vec4 iz1=Pi1.zzzz;vec4 ixy=permute(permute(ix)+iy);vec4 ixy0=permute(ixy+iz0);vec4 ixy1=permute(ixy+iz1);vec4 gx0=ixy0*(1.0/7.0);vec4 gy0=fract(floor(gx0)*(1.0/7.0))-0.5;gx0=fract(gx0);vec4 gz0=vec4(0.5)-abs(gx0)-abs(gy0);vec4 sz0=step(gz0,vec4(0.0));gx0-=sz0*(step(0.0,gx0)-0.5);gy0-=sz0*(step(0.0,gy0)-0.5);vec4 gx1=ixy1*(1.0/7.0);vec4 gy1=fract(floor(gx1)*(1.0/7.0))-0.5;gx1=fract(gx1);vec4 gz1=vec4(0.5)-abs(gx1)-abs(gy1);vec4 sz1=step(gz1,vec4(0.0));gx1-=sz1*(step(0.0,gx1)-0.5);gy1-=sz1*(step(0.0,gy1)-0.5);vec3 g000=vec3(gx0.x,gy0.x,gz0.x);vec3 g100=vec3(gx0.y,gy0.y,gz0.y);vec3 g010=vec3(gx0.z,gy0.z,gz0.z);vec3 g110=vec3(gx0.w,gy0.w,gz0.w);vec3 g001=vec3(gx1.x,gy1.x,gz1.x);vec3 g101=vec3(gx1.y,gy1.y,gz1.y);vec3 g011=vec3(gx1.z,gy1.z,gz1.z);vec3 g111=vec3(gx1.w,gy1.w,gz1.w);vec4 norm0=taylorInvSqrt(vec4(dot(g000,g000),dot(g010,g010),dot(g100,g100),dot(g110,g110)));g000*=norm0.x;g010*=norm0.y;g100*=norm0.z;g110*=norm0.w;vec4 norm1=taylorInvSqrt(vec4(dot(g001,g001),dot(g011,g011),dot(g101,g101),dot(g111,g111)));g001*=norm1.x;g011*=norm1.y;g101*=norm1.z;g111*=norm1.w;float n000=dot(g000,Pf0);float n100=dot(g100,vec3(Pf1.x,Pf0.yz));float n010=dot(g010,vec3(Pf0.x,Pf1.y,Pf0.z));float n110=dot(g110,vec3(Pf1.xy,Pf0.z));float n001=dot(g001,vec3(Pf0.xy,Pf1.z));float n101=dot(g101,vec3(Pf1.x,Pf0.y,Pf1.z));float n011=dot(g011,vec3(Pf0.x,Pf1.yz));float n111=dot(g111,Pf1);vec3 fade_xyz=fade(Pf0);vec4 n_z=mix(vec4(n000,n100,n010,n110),vec4(n001,n101,n011,n111),fade_xyz.z);vec2 n_yz=mix(n_z.xy,n_z.zw,fade_xyz.y);float n_xyz=mix(n_yz.x,n_yz.y,fade_xyz.x);return 2.2*n_xyz;}\n/* END FUNCTION */\nfloat turbulence( vec3 p ) {float w=100.0;float t=-.5;for (float f=1.0 ; f<=10.0 ; f++ ){float power=pow( 2.0,f );t+=abs( pnoise( vec3( power*p ),vec3( 10.0,10.0,10.0 ) )/power );}\nreturn t;}\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef VERTEXCOLOR\nvec4 colorUpdated=color;\n#endif\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\n#ifdef NORMAL\nnoise=10.0* -.10*turbulence( .5*normal+time*1.15 );float b=lowFrequencySpeed*5.0*pnoise( 0.05*position +vec3(time*1.025),vec3( 100.0 ) );float displacement=- 1.5*noise+b;vec3 newPosition=position+normal*displacement;gl_Position=viewProjection*finalWorld*vec4( newPosition,1.0 );vec4 worldPos=finalWorld*vec4(newPosition,1.0);vPositionW=vec3(worldPos);vNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x==0.)\n{vDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));}\nelse\n{vDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));}\n#endif\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#include<logDepthVertex>\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}";i.ShaderStore.ShadersStore[ni]||(i.ShaderStore.ShadersStore[ni]=ti);var ri={__proto__:null,lavaVertexShader:{name:ni,shader:ti}},oi="lavaPixelShader",ai="precision highp float;uniform vec4 vEyePosition;uniform vec4 vDiffuseColor;varying vec3 vPositionW;uniform float time;uniform float speed;uniform float movingSpeed;uniform vec3 fogColor;uniform sampler2D noiseTexture;uniform float fogDensity;varying float noise;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<helperFunctions>\n#include<__decl__lightFragment>[0]\n#include<__decl__lightFragment>[1]\n#include<__decl__lightFragment>[2]\n#include<__decl__lightFragment>[3]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;uniform sampler2D diffuseSampler;uniform vec2 vDiffuseInfos;\n#endif\n#include<clipPlaneFragmentDeclaration>\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\nfloat random( vec3 scale,float seed ){return fract( sin( dot( gl_FragCoord.xyz+seed,scale ) )*43758.5453+seed ) ;}\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);vec4 baseColor=vec4(1.,1.,1.,1.);vec3 diffuseColor=vDiffuseColor.rgb;float alpha=vDiffuseColor.a;\n#ifdef DIFFUSE\nvec4 noiseTex=texture2D( noiseTexture,vDiffuseUV );vec2 T1=vDiffuseUV+vec2( 1.5,-1.5 )*time *0.02;vec2 T2=vDiffuseUV+vec2( -0.5,2.0 )*time*0.01*speed;T1.x+=noiseTex.x*2.0;T1.y+=noiseTex.y*2.0;T2.x-=noiseTex.y*0.2+time*0.001*movingSpeed;T2.y+=noiseTex.z*0.2+time*0.002*movingSpeed;float p=texture2D( noiseTexture,T1*3.0 ).a;vec4 lavaColor=texture2D( diffuseSampler,T2*4.0);vec4 temp=lavaColor*( vec4( p,p,p,p )*2. )+( lavaColor*lavaColor-0.1 );baseColor=temp;float depth=gl_FragCoord.z*4.0;const float LOG2=1.442695;float fogFactor=exp2(-fogDensity*fogDensity*depth*depth*LOG2 );fogFactor=1.0-clamp( fogFactor,0.0,1.0 );baseColor=mix( baseColor,vec4( fogColor,baseColor.w ),fogFactor );diffuseColor=baseColor.rgb;\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include<depthPrePass>\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#ifdef UNLIT\nvec3 diffuseBase=vec3(1.,1.,1.);\n#else\nvec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;float shadow=1.;float glossiness=0.;float aggShadow=0.;float numLights=0.;\n#include<lightFragment>[0]\n#include<lightFragment>[1]\n#include<lightFragment>[2]\n#include<lightFragment>[3]\n#endif\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;vec4 color=vec4(finalDiffuse,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}";i.ShaderStore.ShadersStore[oi]||(i.ShaderStore.ShadersStore[oi]=ai);var si={__proto__:null,lavaPixelShader:{name:oi,shader:ai}},fi="mixVertexShader",li="attribute position: vec3f;\n#ifdef NORMAL\nattribute normal: vec3f;\n#endif\n#ifdef UV1\nattribute uv: vec2f;\n#endif\n#ifdef UV2\nattribute uv2: vec2f;\n#endif\n#ifdef VERTEXCOLOR\nattribute color: vec4f;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform view: mat4x4f;uniform viewProjection: mat4x4f;\n#ifdef DIFFUSE\nvarying vTextureUV: vec2f;uniform textureMatrix: mat4x4f;uniform vTextureInfos: vec2f;\n#endif\n#ifdef POINTSIZE\nuniform pointSize: f32;\n#endif\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef VERTEXCOLOR\nvar colorUpdated: vec4f=vertexInputs.color;\n#endif\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvar worldPos: vec4f=finalWorld* vec4f(vertexInputs.position,1.0);vertexOutputs.position=uniforms.viewProjection*worldPos;vertexOutputs.vPositionW= worldPos.xyz;\n#ifdef NORMAL\nvertexOutputs.vNormalW=normalize(( finalWorld* vec4f(vertexInputs.normal,0.0)).xyz);\n#endif\n#ifndef UV1\nvar uv: vec2f= vec2f(0.,0.);\n#else\nvar uv: vec2f=vertexInputs.uv;\n#endif\n#ifndef UV2\nvar uv2: vec2f= vec2f(0.,0.);\n#else\nvar uv2: vec2f=vertexInputs.uv2;\n#endif\n#ifdef DIFFUSE\nif (uniforms.vTextureInfos.x==0.)\n{vertexOutputs.vTextureUV=(uniforms.textureMatrix* vec4f(uv,1.0,0.0)).xy;}\nelse\n{vertexOutputs.vTextureUV=(uniforms.textureMatrix* vec4f(uv2,1.0,0.0)).xy;}\n#endif\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#include<logDepthVertex>\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[fi]||(i.ShaderStore.ShadersStoreWGSL[fi]=li);var ui={__proto__:null,mixVertexShaderWGSL:{name:fi,shader:li}},di="mixPixelShader",ci="uniform vEyePosition: vec4f;uniform vDiffuseColor: vec4f;\n#ifdef SPECULARTERM\nuniform vSpecularColor: vec4f;\n#endif\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<helperFunctions>\n#include<lightUboDeclaration>[0..maxSimultaneousLights]\n#ifdef DIFFUSE\nvarying vTextureUV: vec2f;var mixMap1SamplerSampler: sampler;var mixMap1Sampler: texture_2d<f32>;uniform vTextureInfos: vec2f;\n#ifdef MIXMAP2\nvar mixMap2SamplerSampler: sampler;var mixMap2Sampler: texture_2d<f32>;\n#endif\nvar diffuse1SamplerSampler: sampler;var diffuse1Sampler: texture_2d<f32>;var diffuse2SamplerSampler: sampler;var diffuse2Sampler: texture_2d<f32>;var diffuse3SamplerSampler: sampler;var diffuse3Sampler: texture_2d<f32>;var diffuse4SamplerSampler: sampler;var diffuse4Sampler: texture_2d<f32>;uniform diffuse1Infos: vec2f;uniform diffuse2Infos: vec2f;uniform diffuse3Infos: vec2f;uniform diffuse4Infos: vec2f;\n#ifdef MIXMAP2\nvar diffuse5SamplerSampler: sampler;var diffuse5Sampler: texture_2d<f32>;var diffuse6SamplerSampler: sampler;var diffuse6Sampler: texture_2d<f32>;var diffuse7SamplerSampler: sampler;var diffuse7Sampler: texture_2d<f32>;var diffuse8SamplerSampler: sampler;var diffuse8Sampler: texture_2d<f32>;uniform diffuse5Infos: vec2f;uniform diffuse6Infos: vec2f;uniform diffuse7Infos: vec2f;uniform diffuse8Infos: vec2f;\n#endif\n#endif\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvar viewDirectionW: vec3f=normalize(uniforms.vEyePosition.xyz-fragmentInputs.vPositionW);var finalMixColor: vec4f= vec4f(1.,1.,1.,1.);var diffuseColor: vec3f=uniforms.vDiffuseColor.rgb;\n#ifdef MIXMAP2\nvar mixColor2: vec4f= vec4f(1.,1.,1.,1.);\n#endif\n#ifdef SPECULARTERM\nvar glossiness: f32=uniforms.vSpecularColor.a;var specularColor: vec3f=uniforms.vSpecularColor.rgb;\n#else\nvar glossiness: f32=0.;\n#endif\nvar alpha: f32=uniforms.vDiffuseColor.a;\n#ifdef NORMAL\nvar normalW: vec3f=normalize(fragmentInputs.vNormalW);\n#else\nvar normalW: vec3f= vec3f(1.0,1.0,1.0);\n#endif\n#ifdef DIFFUSE\nvar mixColor: vec4f=textureSample(mixMap1Sampler,mixMap1SamplerSampler,fragmentInputs.vTextureUV);\n#include<depthPrePass>\nmixColor=vec4f(mixColor.rgb*uniforms.vTextureInfos.y,mixColor.a);var diffuse1Color: vec4f=textureSample(diffuse1Sampler,diffuse1SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse1Infos);var diffuse2Color: vec4f=textureSample(diffuse2Sampler,diffuse2SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse2Infos);var diffuse3Color: vec4f=textureSample(diffuse3Sampler,diffuse3SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse3Infos);var diffuse4Color: vec4f=textureSample(diffuse4Sampler,diffuse4SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse4Infos);diffuse1Color=vec4f(diffuse1Color.rgb*mixColor.r,diffuse1Color.a);diffuse2Color=vec4f(mix(diffuse1Color.rgb,diffuse2Color.rgb,vec3f(mixColor.g)),diffuse2Color.a);diffuse3Color=vec4f(mix(diffuse2Color.rgb,diffuse3Color.rgb,vec3f(mixColor.b)),diffuse3Color.a);finalMixColor=vec4f(mix(diffuse3Color.rgb,diffuse4Color.rgb,vec3f(1.0-mixColor.a)),finalMixColor.a);\n#ifdef MIXMAP2\nmixColor=textureSample(mixMap2Sampler,mixMap2SamplerSampler,fragmentInputs.vTextureUV);mixColor=vec4f(mixColor.rgb*uniforms.vTextureInfos.y,mixColor.a);var diffuse5Color: vec4f=textureSample(diffuse5Sampler,diffuse5SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse5Infos);var diffuse6Color: vec4f=textureSample(diffuse6Sampler,diffuse6SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse6Infos);var diffuse7Color: vec4f=textureSample(diffuse7Sampler,diffuse7SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse7Infos);var diffuse8Color: vec4f=textureSample(diffuse8Sampler,diffuse8SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse8Infos);diffuse5Color=vec4f(mix(finalMixColor.rgb,diffuse5Color.rgb,vec3f(mixColor.r)),diffuse5Color.a);diffuse6Color=vec4f(mix(diffuse5Color.rgb,diffuse6Color.rgb,vec3f(mixColor.g)),diffuse6Color.a);diffuse7Color=vec4f(mix(diffuse6Color.rgb,diffuse7Color.rgb,vec3f(mixColor.b)),diffuse7Color.a);finalMixColor=vec4f(mix(diffuse7Color.rgb,diffuse8Color.rgb,vec3f(1.0-mixColor.a)),finalMixColor.a);\n#endif\n#endif\n#ifdef VERTEXCOLOR\nfinalMixColor=vec4f(finalMixColor.rgb*fragmentInputs.vColor.rgb,finalMixColor.a);\n#endif\nvar diffuseBase: vec3f= vec3f(0.,0.,0.);var info: lightingInfo;var shadow: f32=1.;var aggShadow: f32=0.;var numLights: f32=0.;\n#ifdef SPECULARTERM\nvar specularBase: vec3f= vec3f(0.,0.,0.);\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=fragmentInputs.vColor.a;\n#endif\n#ifdef SPECULARTERM\nvar finalSpecular: vec3f=specularBase*specularColor;\n#else\nvar finalSpecular: vec3f= vec3f(0.0);\n#endif\nvar finalDiffuse: vec3f=clamp(diffuseBase*diffuseColor*finalMixColor.rgb,vec3f(0.0),vec3f(1.0));var color: vec4f= vec4f(finalDiffuse+finalSpecular,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\nfragmentOutputs.color=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[di]||(i.ShaderStore.ShadersStoreWGSL[di]=ci);var vi={__proto__:null,mixPixelShaderWGSL:{name:di,shader:ci}},mi="mixVertexShader",pi="precision highp float;attribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform mat4 view;uniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vTextureUV;uniform mat4 textureMatrix;uniform vec2 vTextureInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef VERTEXCOLOR\nvec4 colorUpdated=color;\n#endif\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);gl_Position=viewProjection*worldPos;vPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vTextureInfos.x==0.)\n{vTextureUV=vec2(textureMatrix*vec4(uv,1.0,0.0));}\nelse\n{vTextureUV=vec2(textureMatrix*vec4(uv2,1.0,0.0));}\n#endif\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#include<logDepthVertex>\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStore[mi]||(i.ShaderStore.ShadersStore[mi]=pi);var hi={__proto__:null,mixVertexShader:{name:mi,shader:pi}},gi="mixPixelShader",Si="precision highp float;uniform vec4 vEyePosition;uniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<helperFunctions>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#ifdef DIFFUSE\nvarying vec2 vTextureUV;uniform sampler2D mixMap1Sampler;uniform vec2 vTextureInfos;\n#ifdef MIXMAP2\nuniform sampler2D mixMap2Sampler;\n#endif\nuniform sampler2D diffuse1Sampler;uniform sampler2D diffuse2Sampler;uniform sampler2D diffuse3Sampler;uniform sampler2D diffuse4Sampler;uniform vec2 diffuse1Infos;uniform vec2 diffuse2Infos;uniform vec2 diffuse3Infos;uniform vec2 diffuse4Infos;\n#ifdef MIXMAP2\nuniform sampler2D diffuse5Sampler;uniform sampler2D diffuse6Sampler;uniform sampler2D diffuse7Sampler;uniform sampler2D diffuse8Sampler;uniform vec2 diffuse5Infos;uniform vec2 diffuse6Infos;uniform vec2 diffuse7Infos;uniform vec2 diffuse8Infos;\n#endif\n#endif\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);vec4 finalMixColor=vec4(1.,1.,1.,1.);vec3 diffuseColor=vDiffuseColor.rgb;\n#ifdef MIXMAP2\nvec4 mixColor2=vec4(1.,1.,1.,1.);\n#endif\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;vec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\nfloat alpha=vDiffuseColor.a;\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#ifdef DIFFUSE\nvec4 mixColor=texture2D(mixMap1Sampler,vTextureUV);\n#include<depthPrePass>\nmixColor.rgb*=vTextureInfos.y;vec4 diffuse1Color=texture2D(diffuse1Sampler,vTextureUV*diffuse1Infos);vec4 diffuse2Color=texture2D(diffuse2Sampler,vTextureUV*diffuse2Infos);vec4 diffuse3Color=texture2D(diffuse3Sampler,vTextureUV*diffuse3Infos);vec4 diffuse4Color=texture2D(diffuse4Sampler,vTextureUV*diffuse4Infos);diffuse1Color.rgb*=mixColor.r;diffuse2Color.rgb=mix(diffuse1Color.rgb,diffuse2Color.rgb,mixColor.g);diffuse3Color.rgb=mix(diffuse2Color.rgb,diffuse3Color.rgb,mixColor.b);finalMixColor.rgb=mix(diffuse3Color.rgb,diffuse4Color.rgb,1.0-mixColor.a);\n#ifdef MIXMAP2\nmixColor=texture2D(mixMap2Sampler,vTextureUV);mixColor.rgb*=vTextureInfos.y;vec4 diffuse5Color=texture2D(diffuse5Sampler,vTextureUV*diffuse5Infos);vec4 diffuse6Color=texture2D(diffuse6Sampler,vTextureUV*diffuse6Infos);vec4 diffuse7Color=texture2D(diffuse7Sampler,vTextureUV*diffuse7Infos);vec4 diffuse8Color=texture2D(diffuse8Sampler,vTextureUV*diffuse8Infos);diffuse5Color.rgb=mix(finalMixColor.rgb,diffuse5Color.rgb,mixColor.r);diffuse6Color.rgb=mix(diffuse5Color.rgb,diffuse6Color.rgb,mixColor.g);diffuse7Color.rgb=mix(diffuse6Color.rgb,diffuse7Color.rgb,mixColor.b);finalMixColor.rgb=mix(diffuse7Color.rgb,diffuse8Color.rgb,1.0-mixColor.a);\n#endif\n#endif\n#ifdef VERTEXCOLOR\nfinalMixColor.rgb*=vColor.rgb;\n#endif\nvec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;float shadow=1.;float aggShadow=0.;float numLights=0.;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor*finalMixColor.rgb,0.0,1.0);vec4 color=vec4(finalDiffuse+finalSpecular,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStore[gi]||(i.ShaderStore.ShadersStore[gi]=Si);var xi={__proto__:null,mixPixelShader:{name:gi,shader:Si}},Ti="normalVertexShader",_i="attribute position: vec3f;\n#ifdef NORMAL\nattribute normal: vec3f;\n#endif\n#ifdef UV1\nattribute uv: vec2f;\n#endif\n#ifdef UV2\nattribute uv2: vec2f;\n#endif\n#ifdef VERTEXCOLOR\nattribute color: vec4f;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform view: mat4x4f;uniform viewProjection: mat4x4f;\n#ifdef DIFFUSE\nvarying vDiffuseUV: vec2f;uniform diffuseMatrix: mat4x4f;uniform vDiffuseInfos: vec2f;\n#endif\n#ifdef POINTSIZE\nuniform pointSize: f32;\n#endif\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvar worldPos: vec4f=finalWorld* vec4f(vertexInputs.position,1.0);vertexOutputs.position=uniforms.viewProjection*worldPos;vertexOutputs.vPositionW= worldPos.xyz;\n#ifdef NORMAL\nvertexOutputs.vNormalW=normalize(( finalWorld* vec4f(vertexInputs.normal,0.0)).xyz);\n#endif\n#ifndef UV1\nvar uv: vec2f= vec2f(0.,0.);\n#else\nvar uv: vec2f=vertexInputs.uv;\n#endif\n#ifndef UV2\nvar uv2: vec2f= vec2f(0.,0.);\n#else\nvar uv2: vec2f=vertexInputs.uv2;\n#endif\n#ifdef DIFFUSE\nif (uniforms.vDiffuseInfos.x==0.)\n{vertexOutputs.vDiffuseUV=(uniforms.diffuseMatrix* vec4f(uv,1.0,0.0)).xy;}\nelse\n{vertexOutputs.vDiffuseUV=(uniforms.diffuseMatrix* vec4f(uv2,1.0,0.0)).xy;}\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[Ti]||(i.ShaderStore.ShadersStoreWGSL[Ti]=_i);var Ci={__proto__:null,normalVertexShaderWGSL:{name:Ti,shader:_i}},Ei="normalPixelShader",Pi="uniform vEyePosition: vec4f;uniform vDiffuseColor: vec4f;varying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#ifdef LIGHTING\n#include<helperFunctions>\n#include<lightUboDeclaration>[0]\n#include<lightUboDeclaration>[1]\n#include<lightUboDeclaration>[2]\n#include<lightUboDeclaration>[3]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#endif\n#ifdef DIFFUSE\nvarying vDiffuseUV: vec2f;var diffuseSamplerSampler: sampler;var diffuseSampler: texture_2d<f32>;uniform vDiffuseInfos: vec2f;\n#endif\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvar viewDirectionW: vec3f=normalize(uniforms.vEyePosition.xyz-fragmentInputs.vPositionW);var baseColor: vec4f= vec4f(1.,1.,1.,1.);var diffuseColor: vec3f=uniforms.vDiffuseColor.rgb;var alpha: f32=uniforms.vDiffuseColor.a;\n#ifdef DIFFUSE\nbaseColor=textureSample(diffuseSampler,diffuseSamplerSampler,fragmentInputs.vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4) {discard;}\n#endif\n#include<depthPrePass>\nbaseColor=vec4f(baseColor.rgb*uniforms.vDiffuseInfos.y,baseColor.a);\n#endif\n#ifdef NORMAL\nbaseColor=mix(baseColor, vec4f(fragmentInputs.vNormalW,1.0),0.5);\n#endif\n#ifdef NORMAL\nvar normalW: vec3f=normalize(fragmentInputs.vNormalW);\n#else\nvar normalW: vec3f= vec3f(1.0,1.0,1.0);\n#endif\n#ifdef LIGHTING\nvar diffuseBase: vec3f= vec3f(0.,0.,0.);var info: lightingInfo;var shadow: f32=1.;var glossiness: f32=0.;var aggShadow: f32=0.;var numLights: f32=0.;\n#include<lightFragment>[0]\n#include<lightFragment>[1]\n#include<lightFragment>[2]\n#include<lightFragment>[3]\nvar finalDiffuse: vec3f=clamp(diffuseBase*diffuseColor,vec3f(0.0),vec3f(1.0))*baseColor.rgb;\n#else\nvar finalDiffuse: vec3f= baseColor.rgb;\n#endif\nvar color: vec4f= vec4f(finalDiffuse,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\nfragmentOutputs.color=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[Ei]||(i.ShaderStore.ShadersStoreWGSL[Ei]=Pi);var Ii={__proto__:null,normalPixelShaderWGSL:{name:Ei,shader:Pi}},yi="normalVertexShader",Li="precision highp float;attribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform mat4 view;uniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;uniform mat4 diffuseMatrix;uniform vec2 vDiffuseInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);gl_Position=viewProjection*worldPos;vPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x==0.)\n{vDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));}\nelse\n{vDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));}\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStore[yi]||(i.ShaderStore.ShadersStore[yi]=Li);var Ai={__proto__:null,normalVertexShader:{name:yi,shader:Li}},Oi="normalPixelShader",Di="precision highp float;uniform vec4 vEyePosition;uniform vec4 vDiffuseColor;varying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef LIGHTING\n#include<helperFunctions>\n#include<__decl__lightFragment>[0]\n#include<__decl__lightFragment>[1]\n#include<__decl__lightFragment>[2]\n#include<__decl__lightFragment>[3]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#endif\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;uniform sampler2D diffuseSampler;uniform vec2 vDiffuseInfos;\n#endif\n#include<clipPlaneFragmentDeclaration>\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);vec4 baseColor=vec4(1.,1.,1.,1.);vec3 diffuseColor=vDiffuseColor.rgb;float alpha=vDiffuseColor.a;\n#ifdef DIFFUSE\nbaseColor=texture2D(diffuseSampler,vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include<depthPrePass>\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef NORMAL\nbaseColor=mix(baseColor,vec4(vNormalW,1.0),0.5);\n#endif\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#ifdef LIGHTING\nvec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;float shadow=1.;float glossiness=0.;float aggShadow=0.;float numLights=0.;\n#include<lightFragment>[0]\n#include<lightFragment>[1]\n#include<lightFragment>[2]\n#include<lightFragment>[3]\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;\n#else\nvec3 finalDiffuse= baseColor.rgb;\n#endif\nvec4 color=vec4(finalDiffuse,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}";i.ShaderStore.ShadersStore[Oi]||(i.ShaderStore.ShadersStore[Oi]=Di);var Ni={__proto__:null,normalPixelShader:{name:Oi,shader:Di}},bi="shadowOnlyVertexShader",Fi="attribute position: vec3f;\n#ifdef NORMAL\nattribute normal: vec3f;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\n#include<sceneUboDeclaration>\n#ifdef POINTSIZE\nuniform pointSize: f32;\n#endif\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvar worldPos: vec4f=finalWorld* vec4f(vertexInputs.position,1.0);vertexOutputs.position=scene.viewProjection*worldPos;vertexOutputs.vPositionW= worldPos.xyz;\n#ifdef NORMAL\nvertexOutputs.vNormalW=normalize(( finalWorld* vec4f(vertexInputs.normal,0.0)).xyz);\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[bi]||(i.ShaderStore.ShadersStoreWGSL[bi]=Fi);var Mi={__proto__:null,shadowOnlyVertexShaderWGSL:{name:bi,shader:Fi}},Ri="shadowOnlyPixelShader",Vi="#include<sceneUboDeclaration>\nuniform alpha: f32;uniform shadowColor: vec3f;varying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#include<helperFunctions>\n#include<lightUboDeclaration>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvar viewDirectionW: vec3f=normalize(scene.vEyePosition.xyz-fragmentInputs.vPositionW);\n#ifdef NORMAL\nvar normalW: vec3f=normalize(fragmentInputs.vNormalW);\n#else\nvar normalW: vec3f= vec3f(1.0,1.0,1.0);\n#endif\nvar diffuseBase: vec3f= vec3f(0.,0.,0.);var info: lightingInfo;var shadow: f32=1.;var glossiness: f32=0.;var aggShadow: f32=0.;var numLights: f32=0.;\n#include<lightFragment>[0..1]\nvar color: vec4f= vec4f(uniforms.shadowColor,(1.0-clamp(shadow,0.,1.))*uniforms.alpha);\n#include<logDepthFragment>\n#include<fogFragment>\nfragmentOutputs.color=color;\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[Ri]||(i.ShaderStore.ShadersStoreWGSL[Ri]=Vi);var Ui={__proto__:null,shadowOnlyPixelShaderWGSL:{name:Ri,shader:Vi}},wi="shadowOnlyVertexShader",Bi="precision highp float;attribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\n#include<__decl__sceneVertex>\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);gl_Position=viewProjection*worldPos;vPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStore[wi]||(i.ShaderStore.ShadersStore[wi]=Bi);var zi={__proto__:null,shadowOnlyVertexShader:{name:wi,shader:Bi}},Gi="shadowOnlyPixelShader",Hi="precision highp float;\n#include<__decl__sceneFragment>\nuniform float alpha;uniform vec3 shadowColor;varying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#include<helperFunctions>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\nvec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;float shadow=1.;float glossiness=0.;float aggShadow=0.;float numLights=0.;\n#include<lightFragment>[0..1]\nvec4 color=vec4(shadowColor,(1.0-clamp(shadow,0.,1.))*alpha);\n#include<logDepthFragment>\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}";i.ShaderStore.ShadersStore[Gi]||(i.ShaderStore.ShadersStore[Gi]=Hi);var Wi={__proto__:null,shadowOnlyPixelShader:{name:Gi,shader:Hi}},Xi="simpleVertexShader",ki="attribute position: vec3f;\n#ifdef NORMAL\nattribute normal: vec3f;\n#endif\n#ifdef UV1\nattribute uv: vec2f;\n#endif\n#ifdef UV2\nattribute uv2: vec2f;\n#endif\n#ifdef VERTEXCOLOR\nattribute color: vec4f;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform view: mat4x4f;uniform viewProjection: mat4x4f;\n#ifdef DIFFUSE\nvarying vDiffuseUV: vec2f;uniform diffuseMatrix: mat4x4f;uniform vDiffuseInfos: vec2f;\n#endif\n#ifdef POINTSIZE\nuniform pointSize: f32;\n#endif\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef VERTEXCOLOR\nvar colorUpdated: vec4f=vertexInputs.color;\n#endif\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvar worldPos: vec4f=finalWorld* vec4f(vertexInputs.position,1.0);vertexOutputs.position=uniforms.viewProjection*worldPos;vertexOutputs.vPositionW= worldPos.xyz;\n#ifdef NORMAL\nvertexOutputs.vNormalW=normalize(( finalWorld* vec4f(vertexInputs.normal,0.0)).xyz);\n#endif\n#ifndef UV1\nvar uv: vec2f= vec2f(0.,0.);\n#else\nvar uv: vec2f=vertexInputs.uv;\n#endif\n#ifndef UV2\nvar uv2: vec2f= vec2f(0.,0.);\n#else\nvar uv2: vec2f=vertexInputs.uv2;\n#endif\n#ifdef DIFFUSE\nif (uniforms.vDiffuseInfos.x==0.)\n{vertexOutputs.vDiffuseUV=(uniforms.diffuseMatrix* vec4f(uv,1.0,0.0)).xy;}\nelse\n{vertexOutputs.vDiffuseUV=(uniforms.diffuseMatrix* vec4f(uv2,1.0,0.0)).xy;}\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[Xi]||(i.ShaderStore.ShadersStoreWGSL[Xi]=ki);var ji={__proto__:null,simpleVertexShaderWGSL:{name:Xi,shader:ki}},Zi="simplePixelShader",Yi="uniform vEyePosition: vec4f;uniform vDiffuseColor: vec4f;varying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<helperFunctions>\n#include<lightUboDeclaration>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#ifdef DIFFUSE\nvarying vDiffuseUV: vec2f;var diffuseSamplerSampler: sampler;var diffuseSampler: texture_2d<f32>;uniform vDiffuseInfos: vec2f;\n#endif\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvar viewDirectionW: vec3f=normalize(uniforms.vEyePosition.xyz-fragmentInputs.vPositionW);var baseColor: vec4f= vec4f(1.,1.,1.,1.);var diffuseColor: vec3f=uniforms.vDiffuseColor.rgb;var alpha: f32=uniforms.vDiffuseColor.a;\n#ifdef DIFFUSE\nbaseColor=textureSample(diffuseSampler,diffuseSamplerSampler,fragmentInputs.vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4) {discard;}\n#endif\n#include<depthPrePass>\nbaseColor=vec4f(baseColor.rgb*uniforms.vDiffuseInfos.y,baseColor.a);\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nbaseColor=vec4f(baseColor.rgb*fragmentInputs.vColor.rgb,baseColor.a);\n#endif\n#ifdef NORMAL\nvar normalW: vec3f=normalize(fragmentInputs.vNormalW);\n#else\nvar normalW: vec3f= vec3f(1.0,1.0,1.0);\n#endif\nvar diffuseBase: vec3f= vec3f(0.,0.,0.);var info: lightingInfo;var shadow: f32=1.;var glossiness: f32=0.;var aggShadow: f32=0.;var numLights: f32=0.;\n#ifdef SPECULARTERM\nvar specularBase: vec3f= vec3f(0.,0.,0.);\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=fragmentInputs.vColor.a;\n#endif\nvar finalDiffuse: vec3f=clamp(diffuseBase*diffuseColor,vec3f(0.0),vec3f(1.0))*baseColor.rgb;var color: vec4f= vec4f(finalDiffuse,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\nfragmentOutputs.color=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[Zi]||(i.ShaderStore.ShadersStoreWGSL[Zi]=Yi);var Ki={__proto__:null,simplePixelShaderWGSL:{name:Zi,shader:Yi}},qi="simpleVertexShader",Qi="precision highp float;attribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform mat4 view;uniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;uniform mat4 diffuseMatrix;uniform vec2 vDiffuseInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef VERTEXCOLOR\nvec4 colorUpdated=color;\n#endif\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);gl_Position=viewProjection*worldPos;vPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x==0.)\n{vDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));}\nelse\n{vDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));}\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStore[qi]||(i.ShaderStore.ShadersStore[qi]=Qi);var Ji={__proto__:null,simpleVertexShader:{name:qi,shader:Qi}},$i="simplePixelShader",en="precision highp float;uniform vec4 vEyePosition;uniform vec4 vDiffuseColor;varying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#include<helperFunctions>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;uniform sampler2D diffuseSampler;uniform vec2 vDiffuseInfos;\n#endif\n#include<clipPlaneFragmentDeclaration>\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);vec4 baseColor=vec4(1.,1.,1.,1.);vec3 diffuseColor=vDiffuseColor.rgb;float alpha=vDiffuseColor.a;\n#ifdef DIFFUSE\nbaseColor=texture2D(diffuseSampler,vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include<depthPrePass>\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nbaseColor.rgb*=vColor.rgb;\n#endif\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\nvec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;float shadow=1.;float glossiness=0.;float aggShadow=0.;float numLights=0.;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif \n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;vec4 color=vec4(finalDiffuse,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}";i.ShaderStore.ShadersStore[$i]||(i.ShaderStore.ShadersStore[$i]=en);var nn={__proto__:null,simplePixelShader:{name:$i,shader:en}},tn="skyVertexShader",rn="attribute position: vec3f;\n#ifdef VERTEXCOLOR\nattribute color: vec4f;\n#endif\nuniform world: mat4x4f;uniform view: mat4x4f;uniform viewProjection: mat4x4f;\n#ifdef POINTSIZE\nuniform pointSize: f32;\n#endif\nvarying vPositionW: vec3f;\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<logDepthDeclaration>\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvertexOutputs.position=uniforms.viewProjection*uniforms.world* vec4f(vertexInputs.position,1.0);var worldPos: vec4f=uniforms.world* vec4f(vertexInputs.position,1.0);vertexOutputs.vPositionW= worldPos.xyz;\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#ifdef VERTEXCOLOR\nvertexOutputs.vColor=vertexInputs.color;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[tn]||(i.ShaderStore.ShadersStoreWGSL[tn]=rn);var on={__proto__:null,skyVertexShaderWGSL:{name:tn,shader:rn}},an="skyPixelShader",sn="varying vPositionW: vec3f;\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<clipPlaneFragmentDeclaration>\nuniform cameraPosition: vec3f;uniform cameraOffset: vec3f;uniform up: vec3f;uniform luminance: f32;uniform turbidity: f32;uniform rayleigh: f32;uniform mieCoefficient: f32;uniform mieDirectionalG: f32;uniform sunPosition: vec3f;\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\nconst ce: f32=2.71828182845904523536028747135266249775724709369995957;const pi: f32=3.141592653589793238462643383279502884197169;const cn: f32=1.0003;const cN: f32=2.545E25;const pn: f32=0.035;const lambda: vec3f= vec3f(680E-9,550E-9,450E-9);const cK: vec3f= vec3f(0.686,0.678,0.666);const cv: f32=4.0;const rayleighZenithLength: f32=8.4E3;const mieZenithLength: f32=1.25E3;const EE: f32=1000.0;const sunAngularDiameterCos: f32=0.999956676946448443553574619906976478926848692873900859324;const cutoffAngle: f32=pi/1.95;const steepness: f32=1.5;fn totalRayleigh(lambdaIn: vec3f)->vec3f\n{return (8.0*pow(pi,3.0)*pow(pow(cn,2.0)-1.0,2.0)*(6.0+3.0*pn))/(3.0*cN*pow(lambdaIn, vec3f(4.0))*(6.0-7.0*pn));}\nfn simplifiedRayleigh()->vec3f\n{return vec3f(0.0005)/ vec3f(94,40,18);}\nfn rayleighPhase(cosTheta: f32)->f32\n{return (3.0/(16.0*pi))*(1.0+pow(cosTheta,2.0));}\nfn totalMie(lambdaIn: vec3f,KIn: vec3f,T: f32)->vec3f\n{var c: f32=(0.2*T)*10E-18;return 0.434*c*pi*pow((2.0*pi)/lambdaIn, vec3f(cv-2.0))*KIn;}\nfn hgPhase(cosTheta: f32,g: f32)->f32\n{return (1.0/(4.0*pi))*((1.0-pow(g,2.0))/pow(1.0-2.0*g*cosTheta+pow(g,2.0),1.5));}\nfn sunIntensity(zenithAngleCos: f32)->f32\n{return EE*max(0.0,1.0-exp((-(cutoffAngle-acos(zenithAngleCos))/steepness)));}\nconst A: f32=0.15;const B: f32=0.50;const C: f32=0.10;const D: f32=0.20;const EEE: f32=0.02;const F: f32=0.30;const W: f32=1000.0;fn Uncharted2Tonemap(x: vec3f)->vec3f\n{return ((x*(A*x+C*B)+D*EEE)/(x*(A*x+B)+D*F))-EEE/F;}\n#if DITHER\n#include<helperFunctions>\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\n/**\n* Sky Color\n*/\nvar sunfade: f32=1.0-clamp(1.0-exp((uniforms.sunPosition.y/450000.0)),0.0,1.0);var rayleighCoefficient: f32=uniforms.rayleigh-(1.0*(1.0-sunfade));var sunDirection: vec3f=normalize(uniforms.sunPosition);var sunE: f32=sunIntensity(dot(sunDirection,uniforms.up));var betaR: vec3f=simplifiedRayleigh()*rayleighCoefficient;var betaM: vec3f=totalMie(lambda,cK,uniforms.turbidity)*uniforms.mieCoefficient;var zenithAngle: f32=acos(max(0.0,dot(uniforms.up,normalize(fragmentInputs.vPositionW-uniforms.cameraPosition+uniforms.cameraOffset))));var sR: f32=rayleighZenithLength/(cos(zenithAngle)+0.15*pow(93.885-((zenithAngle*180.0)/pi),-1.253));var sM: f32=mieZenithLength/(cos(zenithAngle)+0.15*pow(93.885-((zenithAngle*180.0)/pi),-1.253));var Fex: vec3f=exp(-(betaR*sR+betaM*sM));var cosTheta: f32=dot(normalize(fragmentInputs.vPositionW-uniforms.cameraPosition),sunDirection);var rPhase: f32=rayleighPhase(cosTheta*0.5+0.5);var betaRTheta: vec3f=betaR*rPhase;var mPhase: f32=hgPhase(cosTheta,uniforms.mieDirectionalG);var betaMTheta: vec3f=betaM*mPhase;var Lin: vec3f=pow(sunE*((betaRTheta+betaMTheta)/(betaR+betaM))*(1.0-Fex), vec3f(1.5));Lin=Lin*mix( vec3f(1.0),pow(sunE*((betaRTheta+betaMTheta)/(betaR+betaM))*Fex, vec3f(1.0/2.0)), vec3f(clamp(pow(1.0-dot(uniforms.up,sunDirection),5.0),0.0,1.0)));var direction: vec3f=normalize(fragmentInputs.vPositionW-uniforms.cameraPosition);var theta: f32=acos(direction.y);var phi: f32=atan2(direction.z,direction.x);var uv: vec2f= vec2f(phi,theta)/ vec2f(2.0*pi,pi)+ vec2f(0.5,0.0);var L0: vec3f= vec3f(0.1)*Fex;var sundisk: f32=smoothstep(sunAngularDiameterCos,sunAngularDiameterCos+0.00002,cosTheta);L0=L0+(sunE*19000.0*Fex)*sundisk;var whiteScale: vec3f=1.0/Uncharted2Tonemap( vec3f(W));var texColor: vec3f=(Lin+L0);texColor=texColor*0.04;texColor=texColor+ vec3f(0.0,0.001,0.0025)*0.3;var g_fMaxLuminance: f32=1.0;var fLumScaled: f32=0.1/uniforms.luminance;var fLumCompressed: f32=(fLumScaled*(1.0+(fLumScaled/(g_fMaxLuminance*g_fMaxLuminance))))/(1.0+fLumScaled);var ExposureBias: f32=fLumCompressed;var curr: vec3f=Uncharted2Tonemap((log2(2.0/pow(uniforms.luminance,4.0)))*texColor);var retColor: vec3f=curr*whiteScale;var alpha: f32=1.0;\n#ifdef VERTEXCOLOR\nretColor=retColor.rgb*fragmentInputs.vColor.rgb;\n#endif\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=fragmentInputs.vColor.a;\n#endif\n#if DITHER\nretColor=retColor.rgb+dither(fragmentInputs.position.xy,0.5);\n#endif\nvar color: vec4f=clamp( vec4f(retColor.rgb,alpha), vec4f(0.0), vec4f(1.0));\n#include<logDepthFragment>\n#include<fogFragment>\nfragmentOutputs.color=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[an]||(i.ShaderStore.ShadersStoreWGSL[an]=sn);var fn={__proto__:null,skyPixelShaderWGSL:{name:an,shader:sn}},ln="skyVertexShader",un="precision highp float;attribute vec3 position;\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\nuniform mat4 world;uniform mat4 view;uniform mat4 viewProjection;\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<logDepthDeclaration>\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\ngl_Position=viewProjection*world*vec4(position,1.0);vec4 worldPos=world*vec4(position,1.0);vPositionW=vec3(worldPos);\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStore[ln]||(i.ShaderStore.ShadersStore[ln]=un);var dn={__proto__:null,skyVertexShader:{name:ln,shader:un}},cn="skyPixelShader",vn="precision highp float;varying vec3 vPositionW;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneFragmentDeclaration>\nuniform vec3 cameraPosition;uniform vec3 cameraOffset;uniform vec3 up;uniform float luminance;uniform float turbidity;uniform float rayleigh;uniform float mieCoefficient;uniform float mieDirectionalG;uniform vec3 sunPosition;\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\nconst float e=2.71828182845904523536028747135266249775724709369995957;const float pi=3.141592653589793238462643383279502884197169;const float n=1.0003;const float N=2.545E25;const float pn=0.035;const vec3 lambda=vec3(680E-9,550E-9,450E-9);const vec3 K=vec3(0.686,0.678,0.666);const float v=4.0;const float rayleighZenithLength=8.4E3;const float mieZenithLength=1.25E3;const float EE=1000.0;const float sunAngularDiameterCos=0.999956676946448443553574619906976478926848692873900859324;const float cutoffAngle=pi/1.95;const float steepness=1.5;vec3 totalRayleigh(vec3 lambda)\n{return (8.0*pow(pi,3.0)*pow(pow(n,2.0)-1.0,2.0)*(6.0+3.0*pn))/(3.0*N*pow(lambda,vec3(4.0))*(6.0-7.0*pn));}\nvec3 simplifiedRayleigh()\n{return 0.0005/vec3(94,40,18);}\nfloat rayleighPhase(float cosTheta)\n{ \nreturn (3.0/(16.0*pi))*(1.0+pow(cosTheta,2.0));}\nvec3 totalMie(vec3 lambda,vec3 K,float T)\n{float c=(0.2*T )*10E-18;return 0.434*c*pi*pow((2.0*pi)/lambda,vec3(v-2.0))*K;}\nfloat hgPhase(float cosTheta,float g)\n{return (1.0/(4.0*pi))*((1.0-pow(g,2.0))/pow(1.0-2.0*g*cosTheta+pow(g,2.0),1.5));}\nfloat sunIntensity(float zenithAngleCos)\n{return EE*max(0.0,1.0-exp((-(cutoffAngle-acos(zenithAngleCos))/steepness)));}\nfloat A=0.15;float B=0.50;float C=0.10;float D=0.20;float EEE=0.02;float F=0.30;float W=1000.0;vec3 Uncharted2Tonemap(vec3 x)\n{return ((x*(A*x+C*B)+D*EEE)/(x*(A*x+B)+D*F))-EEE/F;}\n#if DITHER\n#include<helperFunctions>\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\n/**\n*--------------------------------------------------------------------------------------------------\n* Sky Color\n*--------------------------------------------------------------------------------------------------\n*/\nfloat sunfade=1.0-clamp(1.0-exp((sunPosition.y/450000.0)),0.0,1.0);float rayleighCoefficient=rayleigh-(1.0*(1.0-sunfade));vec3 sunDirection=normalize(sunPosition);float sunE=sunIntensity(dot(sunDirection,up));vec3 betaR=simplifiedRayleigh()*rayleighCoefficient;vec3 betaM=totalMie(lambda,K,turbidity)*mieCoefficient;float zenithAngle=acos(max(0.0,dot(up,normalize(vPositionW-cameraPosition+cameraOffset))));float sR=rayleighZenithLength/(cos(zenithAngle)+0.15*pow(93.885-((zenithAngle*180.0)/pi),-1.253));float sM=mieZenithLength/(cos(zenithAngle)+0.15*pow(93.885-((zenithAngle*180.0)/pi),-1.253));vec3 Fex=exp(-(betaR*sR+betaM*sM));float cosTheta=dot(normalize(vPositionW-cameraPosition),sunDirection);float rPhase=rayleighPhase(cosTheta*0.5+0.5);vec3 betaRTheta=betaR*rPhase;float mPhase=hgPhase(cosTheta,mieDirectionalG);vec3 betaMTheta=betaM*mPhase;vec3 Lin=pow(sunE*((betaRTheta+betaMTheta)/(betaR+betaM))*(1.0-Fex),vec3(1.5));Lin*=mix(vec3(1.0),pow(sunE*((betaRTheta+betaMTheta)/(betaR+betaM))*Fex,vec3(1.0/2.0)),clamp(pow(1.0-dot(up,sunDirection),5.0),0.0,1.0));vec3 direction=normalize(vPositionW-cameraPosition);float theta=acos(direction.y);float phi=atan(direction.z,direction.x);vec2 uv=vec2(phi,theta)/vec2(2.0*pi,pi)+vec2(0.5,0.0);vec3 L0=vec3(0.1)*Fex;float sundisk=smoothstep(sunAngularDiameterCos,sunAngularDiameterCos+0.00002,cosTheta);L0+=(sunE*19000.0*Fex)*sundisk;vec3 whiteScale=1.0/Uncharted2Tonemap(vec3(W));vec3 texColor=(Lin+L0);texColor*=0.04 ;texColor+=vec3(0.0,0.001,0.0025)*0.3;float g_fMaxLuminance=1.0;float fLumScaled=0.1/luminance; \nfloat fLumCompressed=(fLumScaled*(1.0+(fLumScaled/(g_fMaxLuminance*g_fMaxLuminance))))/(1.0+fLumScaled); \nfloat ExposureBias=fLumCompressed;vec3 curr=Uncharted2Tonemap((log2(2.0/pow(luminance,4.0)))*texColor);vec3 retColor=curr*whiteScale;/**\n*--------------------------------------------------------------------------------------------------\n* Sky Color\n*--------------------------------------------------------------------------------------------------\n*/\nfloat alpha=1.0;\n#ifdef VERTEXCOLOR\nretColor.rgb*=vColor.rgb;\n#endif\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\n#if DITHER\nretColor.rgb+=dither(gl_FragCoord.xy,0.5);\n#endif\nvec4 color=clamp(vec4(retColor.rgb,alpha),0.0,1.0);\n#include<logDepthFragment>\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStore[cn]||(i.ShaderStore.ShadersStore[cn]=vn);var mn={__proto__:null,skyPixelShader:{name:cn,shader:vn}},pn="terrainVertexShader",hn="attribute position: vec3f;\n#ifdef NORMAL\nattribute normal: vec3f;\n#endif\n#ifdef UV1\nattribute uv: vec2f;\n#endif\n#ifdef UV2\nattribute uv2: vec2f;\n#endif\n#ifdef VERTEXCOLOR\nattribute color: vec4f;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform view: mat4x4f;uniform viewProjection: mat4x4f;\n#ifdef DIFFUSE\nvarying vTextureUV: vec2f;uniform textureMatrix: mat4x4f;uniform vTextureInfos: vec2f;\n#endif\n#ifdef POINTSIZE\nuniform pointSize: f32;\n#endif\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vColor: vec4f;\n#endif\n#include<logDepthDeclaration>\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef VERTEXCOLOR\nvar colorUpdated: vec4f=vertexInputs.color;\n#endif\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvar worldPos: vec4f=finalWorld* vec4f(vertexInputs.position,1.0);vertexOutputs.position=uniforms.viewProjection*worldPos;vertexOutputs.vPositionW= worldPos.xyz;\n#ifdef NORMAL\nvertexOutputs.vNormalW=normalize(( finalWorld* vec4f(vertexInputs.normal,0.0)).xyz);\n#endif\n#ifndef UV1\nvar uv: vec2f= vec2f(0.,0.);\n#else\nvar uv: vec2f=vertexInputs.uv;\n#endif\n#ifndef UV2\nvar uv2: vec2f= vec2f(0.,0.);\n#else\nvar uv2: vec2f=vertexInputs.uv2;\n#endif\n#ifdef DIFFUSE\nif (uniforms.vTextureInfos.x==0.)\n{vertexOutputs.vTextureUV=(uniforms.textureMatrix* vec4f(uv,1.0,0.0)).xy;}\nelse\n{vertexOutputs.vTextureUV=(uniforms.textureMatrix* vec4f(uv2,1.0,0.0)).xy;}\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[pn]||(i.ShaderStore.ShadersStoreWGSL[pn]=hn);var gn={__proto__:null,terrainVertexShaderWGSL:{name:pn,shader:hn}},Sn="terrainPixelShader",xn="uniform vEyePosition: vec4f;uniform vDiffuseColor: vec4f;\n#ifdef SPECULARTERM\nuniform vSpecularColor: vec4f;\n#endif\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vColor: vec4f;\n#endif\n#include<helperFunctions>\n#include<lightUboDeclaration>[0..maxSimultaneousLights]\n#ifdef DIFFUSE\nvarying vTextureUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d<f32>;uniform vTextureInfos: vec2f;var diffuse1SamplerSampler: sampler;var diffuse1Sampler: texture_2d<f32>;var diffuse2SamplerSampler: sampler;var diffuse2Sampler: texture_2d<f32>;var diffuse3SamplerSampler: sampler;var diffuse3Sampler: texture_2d<f32>;uniform diffuse1Infos: vec2f;uniform diffuse2Infos: vec2f;uniform diffuse3Infos: vec2f;\n#endif\n#ifdef BUMP\nvar bump1SamplerSampler: sampler;var bump1Sampler: texture_2d<f32>;var bump2SamplerSampler: sampler;var bump2Sampler: texture_2d<f32>;var bump3SamplerSampler: sampler;var bump3Sampler: texture_2d<f32>;\n#endif\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#ifdef BUMP\nfn cotangent_frame(normal: vec3f,p: vec3f,uv: vec2f)->mat3x3f\n{var dp1: vec3f=dpdx(p);var dp2: vec3f=dpdy(p);var duv1: vec2f=dpdx(uv);var duv2: vec2f=dpdy(uv);var dp2perp: vec3f=cross(dp2,normal);var dp1perp: vec3f=cross(normal,dp1);var tangent: vec3f=dp2perp*duv1.x+dp1perp*duv2.x;var binormal: vec3f=dp2perp*duv1.y+dp1perp*duv2.y;var invmax: f32=inverseSqrt(max(dot(tangent,tangent),dot(binormal,binormal)));return mat3x3f(tangent*invmax,binormal*invmax,normal);}\nfn perturbNormal(viewDir: vec3f,mixColor: vec3f)->vec3f\n{var bump1Color: vec3f=textureSample(bump1Sampler,bump1SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse1Infos).xyz;var bump2Color: vec3f=textureSample(bump2Sampler,bump2SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse2Infos).xyz;var bump3Color: vec3f=textureSample(bump3Sampler,bump3SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse3Infos).xyz;bump1Color=bump1Color.rgb*mixColor.r;bump2Color=mix(bump1Color.rgb,bump2Color.rgb,vec3f(mixColor.g));var map: vec3f=mix(bump2Color.rgb,bump3Color.rgb,vec3f(mixColor.b));map=map*255./127.-128./127.;var TBN: mat3x3f=cotangent_frame(fragmentInputs.vNormalW*uniforms.vTextureInfos.y,-viewDir,fragmentInputs.vTextureUV);return normalize(TBN*map);}\n#endif\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvar viewDirectionW: vec3f=normalize(uniforms.vEyePosition.xyz-fragmentInputs.vPositionW);var baseColor: vec4f= vec4f(1.,1.,1.,1.);var diffuseColor: vec3f=uniforms.vDiffuseColor.rgb;\n#ifdef SPECULARTERM\nvar glossiness: f32=uniforms.vSpecularColor.a;var specularColor: vec3f=uniforms.vSpecularColor.rgb;\n#else\nvar glossiness: f32=0.;\n#endif\nvar alpha: f32=uniforms.vDiffuseColor.a;\n#ifdef NORMAL\nvar normalW: vec3f=normalize(fragmentInputs.vNormalW);\n#else\nvar normalW: vec3f= vec3f(1.0,1.0,1.0);\n#endif\n#ifdef DIFFUSE\nbaseColor=textureSample(textureSampler,textureSamplerSampler,fragmentInputs.vTextureUV);\n#if defined(BUMP) && defined(DIFFUSE)\nnormalW=perturbNormal(viewDirectionW,baseColor.rgb);\n#endif\n#ifdef ALPHATEST\nif (baseColor.a<0.4) {discard;}\n#endif\n#include<depthPrePass>\nbaseColor=vec4f(baseColor.rgb*uniforms.vTextureInfos.y,baseColor.a);var diffuse1Color: vec4f=textureSample(diffuse1Sampler,diffuse1SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse1Infos);var diffuse2Color: vec4f=textureSample(diffuse2Sampler,diffuse2SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse2Infos);var diffuse3Color: vec4f=textureSample(diffuse3Sampler,diffuse3SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse3Infos);diffuse1Color=vec4f(diffuse1Color.rgb*baseColor.r,diffuse1Color.a);diffuse2Color=vec4f(mix(diffuse1Color.rgb,diffuse2Color.rgb,vec3f(baseColor.g)),diffuse2Color.a);baseColor=vec4f(mix(diffuse2Color.rgb,diffuse3Color.rgb,vec3f(baseColor.b)),baseColor.a);\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nbaseColor=vec4f(baseColor.rgb*fragmentInputs.vColor.rgb,baseColor.a);\n#endif\nvar diffuseBase: vec3f= vec3f(0.,0.,0.);var info: lightingInfo;var shadow: f32=1.;var aggShadow: f32=0.;var numLights: f32=0.;\n#ifdef SPECULARTERM\nvar specularBase: vec3f= vec3f(0.,0.,0.);\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=fragmentInputs.vColor.a;\n#endif\n#ifdef SPECULARTERM\nvar finalSpecular: vec3f=specularBase*specularColor;\n#else\nvar finalSpecular: vec3f= vec3f(0.0);\n#endif\nvar finalDiffuse: vec3f=clamp(diffuseBase*diffuseColor*baseColor.rgb,vec3f(0.0),vec3f(1.0));var color: vec4f= vec4f(finalDiffuse+finalSpecular,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\nfragmentOutputs.color=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[Sn]||(i.ShaderStore.ShadersStoreWGSL[Sn]=xn);var Tn={__proto__:null,terrainPixelShaderWGSL:{name:Sn,shader:xn}},_n="terrainVertexShader",Cn="precision highp float;attribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform mat4 view;uniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vTextureUV;uniform mat4 textureMatrix;uniform vec2 vTextureInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#include<logDepthDeclaration>\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef VERTEXCOLOR\nvec4 colorUpdated=color;\n#endif\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);gl_Position=viewProjection*worldPos;vPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vTextureInfos.x==0.)\n{vTextureUV=vec2(textureMatrix*vec4(uv,1.0,0.0));}\nelse\n{vTextureUV=vec2(textureMatrix*vec4(uv2,1.0,0.0));}\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStore[_n]||(i.ShaderStore.ShadersStore[_n]=Cn);var En={__proto__:null,terrainVertexShader:{name:_n,shader:Cn}},Pn="terrainPixelShader",In="precision highp float;uniform vec4 vEyePosition;uniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#include<helperFunctions>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#ifdef DIFFUSE\nvarying vec2 vTextureUV;uniform sampler2D textureSampler;uniform vec2 vTextureInfos;uniform sampler2D diffuse1Sampler;uniform sampler2D diffuse2Sampler;uniform sampler2D diffuse3Sampler;uniform vec2 diffuse1Infos;uniform vec2 diffuse2Infos;uniform vec2 diffuse3Infos;\n#endif\n#ifdef BUMP\nuniform sampler2D bump1Sampler;uniform sampler2D bump2Sampler;uniform sampler2D bump3Sampler;\n#endif\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#ifdef BUMP\n#extension GL_OES_standard_derivatives : enable\nmat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv)\n{vec3 dp1=dFdx(p);vec3 dp2=dFdy(p);vec2 duv1=dFdx(uv);vec2 duv2=dFdy(uv);vec3 dp2perp=cross(dp2,normal);vec3 dp1perp=cross(normal,dp1);vec3 tangent=dp2perp*duv1.x+dp1perp*duv2.x;vec3 binormal=dp2perp*duv1.y+dp1perp*duv2.y;float invmax=inversesqrt(max(dot(tangent,tangent),dot(binormal,binormal)));return mat3(tangent*invmax,binormal*invmax,normal);}\nvec3 perturbNormal(vec3 viewDir,vec3 mixColor)\n{vec3 bump1Color=texture2D(bump1Sampler,vTextureUV*diffuse1Infos).xyz;vec3 bump2Color=texture2D(bump2Sampler,vTextureUV*diffuse2Infos).xyz;vec3 bump3Color=texture2D(bump3Sampler,vTextureUV*diffuse3Infos).xyz;bump1Color.rgb*=mixColor.r;bump2Color.rgb=mix(bump1Color.rgb,bump2Color.rgb,mixColor.g);vec3 map=mix(bump2Color.rgb,bump3Color.rgb,mixColor.b);map=map*255./127.-128./127.;mat3 TBN=cotangent_frame(vNormalW*vTextureInfos.y,-viewDir,vTextureUV);return normalize(TBN*map);}\n#endif\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);vec4 baseColor=vec4(1.,1.,1.,1.);vec3 diffuseColor=vDiffuseColor.rgb;\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;vec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\nfloat alpha=vDiffuseColor.a;\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#ifdef DIFFUSE\nbaseColor=texture2D(textureSampler,vTextureUV);\n#if defined(BUMP) && defined(DIFFUSE)\nnormalW=perturbNormal(viewDirectionW,baseColor.rgb);\n#endif\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include<depthPrePass>\nbaseColor.rgb*=vTextureInfos.y;vec4 diffuse1Color=texture2D(diffuse1Sampler,vTextureUV*diffuse1Infos);vec4 diffuse2Color=texture2D(diffuse2Sampler,vTextureUV*diffuse2Infos);vec4 diffuse3Color=texture2D(diffuse3Sampler,vTextureUV*diffuse3Infos);diffuse1Color.rgb*=baseColor.r;diffuse2Color.rgb=mix(diffuse1Color.rgb,diffuse2Color.rgb,baseColor.g);baseColor.rgb=mix(diffuse2Color.rgb,diffuse3Color.rgb,baseColor.b);\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nbaseColor.rgb*=vColor.rgb;\n#endif\nvec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;float shadow=1.;float aggShadow=0.;float numLights=0.;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor*baseColor.rgb,0.0,1.0);vec4 color=vec4(finalDiffuse+finalSpecular,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStore[Pn]||(i.ShaderStore.ShadersStore[Pn]=In);var yn={__proto__:null,terrainPixelShader:{name:Pn,shader:In}},Ln="triplanarVertexShader",An="attribute position: vec3f;\n#ifdef NORMAL\nattribute normal: vec3f;\n#endif\n#ifdef VERTEXCOLOR\nattribute color: vec4f;\n#endif\n#include<helperFunctions>\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform view: mat4x4f;uniform viewProjection: mat4x4f;\n#ifdef DIFFUSEX\nvarying vTextureUVX: vec2f;\n#endif\n#ifdef DIFFUSEY\nvarying vTextureUVY: vec2f;\n#endif\n#ifdef DIFFUSEZ\nvarying vTextureUVZ: vec2f;\n#endif\nuniform tileSize: f32;\n#ifdef POINTSIZE\nuniform pointSize: f32;\n#endif\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying tangentSpace0: vec3f;varying tangentSpace1: vec3f;varying tangentSpace2: vec3f;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vColor: vec4f;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs\n{\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef VERTEXCOLOR\nvar colorUpdated: vec4f=vertexInputs.color;\n#endif\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvar worldPos: vec4f=finalWorld* vec4f(vertexInputs.position,1.0);vertexOutputs.position=uniforms.viewProjection*worldPos;vertexOutputs.vPositionW= worldPos.xyz;\n#ifdef DIFFUSEX\nvertexOutputs.vTextureUVX=worldPos.zy/uniforms.tileSize;\n#endif\n#ifdef DIFFUSEY\nvertexOutputs.vTextureUVY=worldPos.xz/uniforms.tileSize;\n#endif\n#ifdef DIFFUSEZ\nvertexOutputs.vTextureUVZ=worldPos.xy/uniforms.tileSize;\n#endif\n#ifdef NORMAL\nvar xtan: vec3f= vec3f(0,0,1);var xbin: vec3f= vec3f(0,1,0);var ytan: vec3f= vec3f(1,0,0);var ybin: vec3f= vec3f(0,0,1);var ztan: vec3f= vec3f(1,0,0);var zbin: vec3f= vec3f(0,1,0);var normalizedNormal: vec3f=normalize(vertexInputs.normal);normalizedNormal=normalizedNormal*normalizedNormal;var worldBinormal: vec3f=normalize(xbin*normalizedNormal.x+ybin*normalizedNormal.y+zbin*normalizedNormal.z);var worldTangent: vec3f=normalize(xtan*normalizedNormal.x+ytan*normalizedNormal.y+ztan*normalizedNormal.z);var normalWorld: mat3x3f= mat3x3f(finalWorld[0].xyz,finalWorld[1].xyz,finalWorld[2].xyz);\n#ifdef NONUNIFORMSCALING\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\n#endif\nworldTangent=normalize((normalWorld*worldTangent).xyz);worldBinormal=normalize((normalWorld*worldBinormal).xyz);var worldNormal: vec3f=normalize((normalWorld*normalize(vertexInputs.normal)).xyz);vertexOutputs.tangentSpace0=worldTangent;vertexOutputs.tangentSpace1=worldBinormal;vertexOutputs.tangentSpace2=worldNormal;\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[Ln]||(i.ShaderStore.ShadersStoreWGSL[Ln]=An);var On={__proto__:null,triplanarVertexShaderWGSL:{name:Ln,shader:An}},Dn="triplanarPixelShader",Nn="uniform vEyePosition: vec4f;uniform vDiffuseColor: vec4f;\n#ifdef SPECULARTERM\nuniform vSpecularColor: vec4f;\n#endif\nvarying vPositionW: vec3f;\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vColor: vec4f;\n#endif\n#include<helperFunctions>\n#include<lightUboDeclaration>[0..maxSimultaneousLights]\n#ifdef DIFFUSEX\nvarying vTextureUVX: vec2f;var diffuseSamplerXSampler: sampler;var diffuseSamplerX: texture_2d<f32>;\n#ifdef BUMPX\nvar normalSamplerXSampler: sampler;var normalSamplerX: texture_2d<f32>;\n#endif\n#endif\n#ifdef DIFFUSEY\nvarying vTextureUVY: vec2f;var diffuseSamplerYSampler: sampler;var diffuseSamplerY: texture_2d<f32>;\n#ifdef BUMPY\nvar normalSamplerYSampler: sampler;var normalSamplerY: texture_2d<f32>;\n#endif\n#endif\n#ifdef DIFFUSEZ\nvarying vTextureUVZ: vec2f;var diffuseSamplerZSampler: sampler;var diffuseSamplerZ: texture_2d<f32>;\n#ifdef BUMPZ\nvar normalSamplerZSampler: sampler;var normalSamplerZ: texture_2d<f32>;\n#endif\n#endif\n#ifdef NORMAL\nvarying tangentSpace0: vec3f;varying tangentSpace1: vec3f;varying tangentSpace2: vec3f;\n#endif\n#include<logDepthDeclaration>\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvar viewDirectionW: vec3f=normalize(uniforms.vEyePosition.xyz-fragmentInputs.vPositionW);var baseColor: vec4f= vec4f(0.,0.,0.,1.);var diffuseColor: vec3f=uniforms.vDiffuseColor.rgb;var alpha: f32=uniforms.vDiffuseColor.a;\n#ifdef NORMAL\nvar normalW: vec3f=fragmentInputs.tangentSpace2;\n#else\nvar normalW: vec3f= vec3f(1.0,1.0,1.0);\n#endif\nvar baseNormal: vec4f= vec4f(0.0,0.0,0.0,1.0);normalW=normalW*normalW;\n#ifdef DIFFUSEX\nbaseColor=baseColor+textureSample(diffuseSamplerX,diffuseSamplerXSampler,fragmentInputs.vTextureUVX)*normalW.x;\n#ifdef BUMPX\nbaseNormal=baseNormal+textureSample(normalSamplerX,normalSamplerXSampler,fragmentInputs.vTextureUVX)*normalW.x;\n#endif\n#endif\n#ifdef DIFFUSEY\nbaseColor=baseColor+textureSample(diffuseSamplerY,diffuseSamplerYSampler,fragmentInputs.vTextureUVY)*normalW.y;\n#ifdef BUMPY\nbaseNormal=baseNormal+textureSample(normalSamplerY,normalSamplerYSampler,fragmentInputs.vTextureUVY)*normalW.y;\n#endif\n#endif\n#ifdef DIFFUSEZ\nbaseColor=baseColor+textureSample(diffuseSamplerZ,diffuseSamplerZSampler,fragmentInputs.vTextureUVZ)*normalW.z;\n#ifdef BUMPZ\nbaseNormal=baseNormal+textureSample(normalSamplerZ,normalSamplerZSampler,fragmentInputs.vTextureUVZ)*normalW.z;\n#endif\n#endif\n#ifdef NORMAL\nvar tangentSpace: mat3x3f=mat3x3f(fragmentInputs.tangentSpace0,fragmentInputs.tangentSpace1,fragmentInputs.tangentSpace2);normalW=normalize((2.0*baseNormal.xyz-1.0)*tangentSpace);\n#endif\n#ifdef ALPHATEST\nif (baseColor.a<0.4) {discard;}\n#endif\n#include<depthPrePass>\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nbaseColor=vec4f(baseColor.rgb*fragmentInputs.vColor.rgb,baseColor.a);\n#endif\nvar diffuseBase: vec3f= vec3f(0.,0.,0.);var info: lightingInfo;var shadow: f32=1.;var aggShadow: f32=0.;var numLights: f32=0.;\n#ifdef SPECULARTERM\nvar glossiness: f32=uniforms.vSpecularColor.a;var specularBase: vec3f= vec3f(0.,0.,0.);var specularColor: vec3f=uniforms.vSpecularColor.rgb;\n#else\nvar glossiness: f32=0.;\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=fragmentInputs.vColor.a;\n#endif\n#ifdef SPECULARTERM\nvar finalSpecular: vec3f=specularBase*specularColor;\n#else\nvar finalSpecular: vec3f= vec3f(0.0);\n#endif\nvar finalDiffuse: vec3f=clamp(diffuseBase*diffuseColor,vec3f(0.0),vec3f(1.0))*baseColor.rgb;var color: vec4f= vec4f(finalDiffuse+finalSpecular,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\nfragmentOutputs.color=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[Dn]||(i.ShaderStore.ShadersStoreWGSL[Dn]=Nn);var bn={__proto__:null,triplanarPixelShaderWGSL:{name:Dn,shader:Nn}},Fn="triplanarVertexShader",Mn="precision highp float;attribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<helperFunctions>\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform mat4 view;uniform mat4 viewProjection;\n#ifdef DIFFUSEX\nvarying vec2 vTextureUVX;\n#endif\n#ifdef DIFFUSEY\nvarying vec2 vTextureUVY;\n#endif\n#ifdef DIFFUSEZ\nvarying vec2 vTextureUVZ;\n#endif\nuniform float tileSize;\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying mat3 tangentSpace;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void)\n{\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef VERTEXCOLOR\nvec4 colorUpdated=color;\n#endif\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);gl_Position=viewProjection*worldPos;vPositionW=vec3(worldPos);\n#ifdef DIFFUSEX\nvTextureUVX=worldPos.zy/tileSize;\n#endif\n#ifdef DIFFUSEY\nvTextureUVY=worldPos.xz/tileSize;\n#endif\n#ifdef DIFFUSEZ\nvTextureUVZ=worldPos.xy/tileSize;\n#endif\n#ifdef NORMAL\nvec3 xtan=vec3(0,0,1);vec3 xbin=vec3(0,1,0);vec3 ytan=vec3(1,0,0);vec3 ybin=vec3(0,0,1);vec3 ztan=vec3(1,0,0);vec3 zbin=vec3(0,1,0);vec3 normalizedNormal=normalize(normal);normalizedNormal*=normalizedNormal;vec3 worldBinormal=normalize(xbin*normalizedNormal.x+ybin*normalizedNormal.y+zbin*normalizedNormal.z);vec3 worldTangent=normalize(xtan*normalizedNormal.x+ytan*normalizedNormal.y+ztan*normalizedNormal.z);mat3 normalWorld=mat3(finalWorld);\n#ifdef NONUNIFORMSCALING\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\n#endif\nworldTangent=normalize((normalWorld*worldTangent).xyz);worldBinormal=normalize((normalWorld*worldBinormal).xyz);vec3 worldNormal=normalize((normalWorld*normalize(normal)).xyz);tangentSpace[0]=worldTangent;tangentSpace[1]=worldBinormal;tangentSpace[2]=worldNormal;\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStore[Fn]||(i.ShaderStore.ShadersStore[Fn]=Mn);var Rn={__proto__:null,triplanarVertexShader:{name:Fn,shader:Mn}},Vn="triplanarPixelShader",Un="precision highp float;uniform vec4 vEyePosition;uniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\nvarying vec3 vPositionW;\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#include<helperFunctions>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#ifdef DIFFUSEX\nvarying vec2 vTextureUVX;uniform sampler2D diffuseSamplerX;\n#ifdef BUMPX\nuniform sampler2D normalSamplerX;\n#endif\n#endif\n#ifdef DIFFUSEY\nvarying vec2 vTextureUVY;uniform sampler2D diffuseSamplerY;\n#ifdef BUMPY\nuniform sampler2D normalSamplerY;\n#endif\n#endif\n#ifdef DIFFUSEZ\nvarying vec2 vTextureUVZ;uniform sampler2D diffuseSamplerZ;\n#ifdef BUMPZ\nuniform sampler2D normalSamplerZ;\n#endif\n#endif\n#ifdef NORMAL\nvarying mat3 tangentSpace;\n#endif\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<logDepthDeclaration>\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);vec4 baseColor=vec4(0.,0.,0.,1.);vec3 diffuseColor=vDiffuseColor.rgb;float alpha=vDiffuseColor.a;\n#ifdef NORMAL\nvec3 normalW=tangentSpace[2];\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\nvec4 baseNormal=vec4(0.0,0.0,0.0,1.0);normalW*=normalW;\n#ifdef DIFFUSEX\nbaseColor+=texture2D(diffuseSamplerX,vTextureUVX)*normalW.x;\n#ifdef BUMPX\nbaseNormal+=texture2D(normalSamplerX,vTextureUVX)*normalW.x;\n#endif\n#endif\n#ifdef DIFFUSEY\nbaseColor+=texture2D(diffuseSamplerY,vTextureUVY)*normalW.y;\n#ifdef BUMPY\nbaseNormal+=texture2D(normalSamplerY,vTextureUVY)*normalW.y;\n#endif\n#endif\n#ifdef DIFFUSEZ\nbaseColor+=texture2D(diffuseSamplerZ,vTextureUVZ)*normalW.z;\n#ifdef BUMPZ\nbaseNormal+=texture2D(normalSamplerZ,vTextureUVZ)*normalW.z;\n#endif\n#endif\n#ifdef NORMAL\nnormalW=normalize((2.0*baseNormal.xyz-1.0)*tangentSpace);\n#endif\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include<depthPrePass>\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nbaseColor.rgb*=vColor.rgb;\n#endif\nvec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;float shadow=1.;float aggShadow=0.;float numLights=0.;\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;vec3 specularBase=vec3(0.,0.,0.);vec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;vec4 color=vec4(finalDiffuse+finalSpecular,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStore[Vn]||(i.ShaderStore.ShadersStore[Vn]=Un);var wn={__proto__:null,triplanarPixelShader:{name:Vn,shader:Un}},Bn="waterVertexShader",zn="attribute position: vec3f;\n#ifdef NORMAL\nattribute normal: vec3f;\n#endif\n#ifdef UV1\nattribute uv: vec2f;\n#endif\n#ifdef UV2\nattribute uv2: vec2f;\n#endif\n#ifdef VERTEXCOLOR\nattribute color: vec4f;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform view: mat4x4f;uniform viewProjection: mat4x4f;\n#ifdef BUMP\nvarying vNormalUV: vec2f;\n#ifdef BUMPSUPERIMPOSE\nvarying vNormalUV2: vec2f;\n#endif\nuniform normalMatrix: mat4x4f;uniform vNormalInfos: vec2f;\n#endif\n#ifdef POINTSIZE\nuniform pointSize: f32;\n#endif\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vColor: vec4f;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\n#include<logDepthDeclaration>\nuniform reflectionViewProjection: mat4x4f;uniform windDirection: vec2f;uniform waveLength: f32;uniform time: f32;uniform windForce: f32;uniform waveHeight: f32;uniform waveSpeed: f32;uniform waveCount: f32;varying vRefractionMapTexCoord: vec3f;varying vReflectionMapTexCoord: vec3f;\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef VERTEXCOLOR\nvar colorUpdated: vec4f=vertexInputs.color;\n#endif\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvar worldPos: vec4f=finalWorld* vec4f(vertexInputs.position,1.0);vertexOutputs.vPositionW= worldPos.xyz;\n#ifdef NORMAL\nvertexOutputs.vNormalW=normalize(( finalWorld* vec4f(vertexInputs.normal,0.0)).xyz);\n#endif\n#ifndef UV1\nvar uv: vec2f= vec2f(0.,0.);\n#else\nvar uv: vec2f=vertexInputs.uv;\n#endif\n#ifndef UV2\nvar uv2: vec2f= vec2f(0.,0.);\n#else\nvar uv2: vec2f=vertexInputs.uv2;\n#endif\n#ifdef BUMP\nif (uniforms.vNormalInfos.x==0.)\n{vertexOutputs.vNormalUV=(uniforms.normalMatrix* vec4f((uv*1.0)/uniforms.waveLength+uniforms.time*uniforms.windForce*uniforms.windDirection,1.0,0.0)).xy;\n#ifdef BUMPSUPERIMPOSE\nvertexOutputs.vNormalUV2=(uniforms.normalMatrix* vec4f((uv*0.721)/uniforms.waveLength+uniforms.time*1.2*uniforms.windForce*uniforms.windDirection,1.0,0.0)).xy;\n#endif\n}\nelse\n{vertexOutputs.vNormalUV=(uniforms.normalMatrix* vec4f((uv2*1.0)/uniforms.waveLength+uniforms.time*uniforms.windForce*uniforms.windDirection,1.0,0.0)).xy;\n#ifdef BUMPSUPERIMPOSE\nvertexOutputs.vNormalUV2=(uniforms.normalMatrix* vec4f((uv2*0.721)/uniforms.waveLength+uniforms.time*1.2*uniforms.windForce*uniforms.windDirection,1.0,0.0)).xy;\n#endif\n}\n#endif\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\nvar finalWaveCount: f32=1.0/(uniforms.waveCount*0.5);\n#ifdef USE_WORLD_COORDINATES\nvar p: vec3f=worldPos.xyz;\n#else\nvar p: vec3f=vertexInputs.position;\n#endif\nvar newY: f32=(sin(((p.x/finalWaveCount)+uniforms.time*uniforms.waveSpeed))*uniforms.waveHeight*uniforms.windDirection.x*5.0)\n+ (cos(((p.z/finalWaveCount)+uniforms.time*uniforms.waveSpeed))*uniforms.waveHeight*uniforms.windDirection.y*5.0);p.y=p.y+abs(newY);\n#ifdef USE_WORLD_COORDINATES\nvertexOutputs.position=uniforms.viewProjection* vec4f(p,1.0);\n#else\nvertexOutputs.position=uniforms.viewProjection*finalWorld* vec4f(p,1.0);\n#endif\n#ifdef REFLECTION\nvertexOutputs.vRefractionMapTexCoord=vec3f(\n0.5*(vertexOutputs.position.w+vertexOutputs.position.x),\n0.5*(vertexOutputs.position.w+vertexOutputs.position.y),\nvertexOutputs.position.w\n);worldPos=uniforms.reflectionViewProjection*finalWorld* vec4f(vertexInputs.position,1.0);vertexOutputs.vReflectionMapTexCoord=vec3f(\n0.5*(worldPos.w+worldPos.x),\n0.5*(worldPos.w+worldPos.y),\nworldPos.w\n);\n#endif\n#include<logDepthVertex>\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[Bn]||(i.ShaderStore.ShadersStoreWGSL[Bn]=zn);var Gn={__proto__:null,waterVertexShaderWGSL:{name:Bn,shader:zn}},Hn="waterPixelShader",Wn="uniform vEyePosition: vec4f;uniform vDiffuseColor: vec4f;\n#ifdef SPECULARTERM\nuniform vSpecularColor: vec4f;\n#endif\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vColor: vec4f;\n#endif\n#include<helperFunctions>\n#include<imageProcessingDeclaration>\n#include<imageProcessingFunctions>\n#include<lightUboDeclaration>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#ifdef BUMP\nvarying vNormalUV: vec2f;\n#ifdef BUMPSUPERIMPOSE\nvarying vNormalUV2: vec2f;\n#endif\nvar normalSamplerSampler: sampler;var normalSampler: texture_2d<f32>;uniform vNormalInfos: vec2f;\n#endif\nvar refractionSamplerSampler: sampler;var refractionSampler: texture_2d<f32>;var reflectionSamplerSampler: sampler;var reflectionSampler: texture_2d<f32>;const LOG2: f32=1.442695;uniform cameraPosition: vec3f;uniform waterColor: vec4f;uniform colorBlendFactor: f32;uniform waterColor2: vec4f;uniform colorBlendFactor2: f32;uniform bumpHeight: f32;uniform time: f32;varying vRefractionMapTexCoord: vec3f;varying vReflectionMapTexCoord: vec3f;\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvar viewDirectionW: vec3f=normalize(uniforms.vEyePosition.xyz-fragmentInputs.vPositionW);var baseColor: vec4f= vec4f(1.,1.,1.,1.);var diffuseColor: vec3f=uniforms.vDiffuseColor.rgb;var alpha: f32=uniforms.vDiffuseColor.a;\n#ifdef BUMP\n#ifdef BUMPSUPERIMPOSE\nbaseColor=0.6*textureSample(normalSampler,normalSamplerSampler,fragmentInputs.vNormalUV)+0.4*textureSample(normalSampler,normalSamplerSampler, vec2f(fragmentInputs.vNormalUV2.x,fragmentInputs.vNormalUV2.y));\n#else\nbaseColor=textureSample(normalSampler,normalSamplerSampler,fragmentInputs.vNormalUV);\n#endif\nvar bumpColor: vec3f=baseColor.rgb;\n#ifdef ALPHATEST\nif (baseColor.a<0.4) {discard;}\n#endif\nbaseColor=vec4f(baseColor.rgb*uniforms.vNormalInfos.y,baseColor.a);\n#else\nvar bumpColor: vec3f= vec3f(1.0);\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nbaseColor=vec4f(baseColor.rgb*fragmentInputs.vColor.rgb,baseColor.a);\n#endif\n#ifdef NORMAL\nvar perturbation: vec2f=uniforms.bumpHeight*(baseColor.rg-0.5);\n#ifdef BUMPAFFECTSREFLECTION\nvar normalW: vec3f=normalize(fragmentInputs.vNormalW+ vec3f(perturbation.x*8.0,0.0,perturbation.y*8.0));if (normalW.y<0.0) {normalW.y=-normalW.y;}\n#else\nvar normalW: vec3f=normalize(fragmentInputs.vNormalW);\n#endif\n#else\nvar normalW: vec3f= vec3f(1.0,1.0,1.0);var perturbation: vec2f=uniforms.bumpHeight*( vec2f(1.0,1.0)-0.5);\n#endif\n#ifdef FRESNELSEPARATE\n#ifdef REFLECTION\nvar projectedRefractionTexCoords: vec2f=clamp(fragmentInputs.vRefractionMapTexCoord.xy/fragmentInputs.vRefractionMapTexCoord.z+perturbation*0.5, vec2f(0.0), vec2f(1.0));var refractiveColor: vec4f=textureSample(refractionSampler,refractionSamplerSampler,projectedRefractionTexCoords);\n#ifdef IS_REFRACTION_LINEAR\nrefractiveColor=vec4f(toGammaSpace(refractiveColor.rgb),refractiveColor.a);\n#endif\nvar projectedReflectionTexCoords: vec2f= vec2f(\nfragmentInputs.vReflectionMapTexCoord.x/fragmentInputs.vReflectionMapTexCoord.z+perturbation.x*0.3,\nfragmentInputs.vReflectionMapTexCoord.y/fragmentInputs.vReflectionMapTexCoord.z+perturbation.y\n);var reflectiveColor: vec4f=textureSample(reflectionSampler,reflectionSamplerSampler,projectedReflectionTexCoords);\n#ifdef IS_REFLECTION_LINEAR\nreflectiveColor=vec4f(toGammaSpace(reflectiveColor.rgb),reflectiveColor.a);\n#endif\nvar upVector: vec3f= vec3f(0.0,1.0,0.0);var fresnelTerm: f32=clamp(abs(pow(dot(viewDirectionW,upVector),3.0)),0.05,0.65);var IfresnelTerm: f32=1.0-fresnelTerm;refractiveColor=uniforms.colorBlendFactor*uniforms.waterColor+(1.0-uniforms.colorBlendFactor)*refractiveColor;reflectiveColor=IfresnelTerm*uniforms.colorBlendFactor2*uniforms.waterColor+(1.0-uniforms.colorBlendFactor2*IfresnelTerm)*reflectiveColor;var combinedColor: vec4f=refractiveColor*fresnelTerm+reflectiveColor*IfresnelTerm;baseColor=combinedColor;\n#endif\nvar diffuseBase: vec3f= vec3f(0.,0.,0.);var info: lightingInfo;var shadow: f32=1.;var aggShadow: f32=0.;var numLights: f32=0.;\n#ifdef SPECULARTERM\nvar glossiness: f32=uniforms.vSpecularColor.a;var specularBase: vec3f= vec3f(0.,0.,0.);var specularColor: vec3f=uniforms.vSpecularColor.rgb;\n#else\nvar glossiness: f32=0.;\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\nvar finalDiffuse: vec3f=clamp(baseColor.rgb,vec3f(0.0),vec3f(1.0));\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=fragmentInputs.vColor.a;\n#endif\n#ifdef SPECULARTERM\nvar finalSpecular: vec3f=specularBase*specularColor;\n#else\nvar finalSpecular: vec3f= vec3f(0.0);\n#endif\n#else \n#ifdef REFLECTION\nvar projectedRefractionTexCoords: vec2f=clamp(fragmentInputs.vRefractionMapTexCoord.xy/fragmentInputs.vRefractionMapTexCoord.z+perturbation, vec2f(0.0), vec2f(1.0));var refractiveColor: vec4f=textureSample(refractionSampler,refractionSamplerSampler,projectedRefractionTexCoords);\n#ifdef IS_REFRACTION_LINEAR\nrefractiveColor=vec4f(toGammaSpace(refractiveColor.rgb),refractiveColor.a);\n#endif\nvar projectedReflectionTexCoords: vec2f=fragmentInputs.vReflectionMapTexCoord.xy/fragmentInputs.vReflectionMapTexCoord.z+perturbation;var reflectiveColor: vec4f=textureSample(reflectionSampler,reflectionSamplerSampler,projectedReflectionTexCoords);\n#ifdef IS_REFLECTION_LINEAR\nreflectiveColor=vec4f(toGammaSpace(reflectiveColor.rgb),reflectiveColor.a);\n#endif\nvar upVector: vec3f= vec3f(0.0,1.0,0.0);var fresnelTerm: f32=max(dot(viewDirectionW,upVector),0.0);var combinedColor: vec4f=refractiveColor*fresnelTerm+reflectiveColor*(1.0-fresnelTerm);baseColor=uniforms.colorBlendFactor*uniforms.waterColor+(1.0-uniforms.colorBlendFactor)*combinedColor;\n#endif\nvar diffuseBase: vec3f= vec3f(0.,0.,0.);var info: lightingInfo;var shadow: f32=1.;var aggShadow: f32=0.;var numLights: f32=0.;\n#ifdef SPECULARTERM\nvar glossiness: f32=uniforms.vSpecularColor.a;var specularBase: vec3f= vec3f(0.,0.,0.);var specularColor: vec3f=uniforms.vSpecularColor.rgb;\n#else\nvar glossiness: f32=0.;\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\nvar finalDiffuse: vec3f=clamp(baseColor.rgb,vec3f(0.0),vec3f(1.0));\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=fragmentInputs.vColor.a;\n#endif\n#ifdef SPECULARTERM\nvar finalSpecular: vec3f=specularBase*specularColor;\n#else\nvar finalSpecular: vec3f= vec3f(0.0);\n#endif\n#endif\nvar color: vec4f= vec4f(finalDiffuse+finalSpecular,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\n#ifdef IMAGEPROCESSINGPOSTPROCESS\ncolor=vec4f(toLinearSpace(color.rgb),color.a);\n#elif defined(IMAGEPROCESSING)\ncolor=vec4f(toLinearSpace(color.rgb),color.a);color=applyImageProcessing(color);\n#endif\nfragmentOutputs.color=color;\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[Hn]||(i.ShaderStore.ShadersStoreWGSL[Hn]=Wn);var Xn={__proto__:null,waterPixelShaderWGSL:{name:Hn,shader:Wn}},kn="waterVertexShader",jn="precision highp float;attribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform mat4 view;uniform mat4 viewProjection;\n#ifdef BUMP\nvarying vec2 vNormalUV;\n#ifdef BUMPSUPERIMPOSE\nvarying vec2 vNormalUV2;\n#endif\nuniform mat4 normalMatrix;uniform vec2 vNormalInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<logDepthDeclaration>\nuniform mat4 reflectionViewProjection;uniform vec2 windDirection;uniform float waveLength;uniform float time;uniform float windForce;uniform float waveHeight;uniform float waveSpeed;uniform float waveCount;varying vec3 vRefractionMapTexCoord;varying vec3 vReflectionMapTexCoord;\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef VERTEXCOLOR\nvec4 colorUpdated=color;\n#endif\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);vPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef BUMP\nif (vNormalInfos.x==0.)\n{vNormalUV=vec2(normalMatrix*vec4((uv*1.0)/waveLength+time*windForce*windDirection,1.0,0.0));\n#ifdef BUMPSUPERIMPOSE\nvNormalUV2=vec2(normalMatrix*vec4((uv*0.721)/waveLength+time*1.2*windForce*windDirection,1.0,0.0));\n#endif\n}\nelse\n{vNormalUV=vec2(normalMatrix*vec4((uv2*1.0)/waveLength+time*windForce*windDirection ,1.0,0.0));\n#ifdef BUMPSUPERIMPOSE\nvNormalUV2=vec2(normalMatrix*vec4((uv2*0.721)/waveLength+time*1.2*windForce*windDirection ,1.0,0.0));\n#endif\n}\n#endif\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\nfloat finalWaveCount=1.0/(waveCount*0.5);\n#ifdef USE_WORLD_COORDINATES\nvec3 p=worldPos.xyz;\n#else\nvec3 p=position;\n#endif\nfloat newY=(sin(((p.x/finalWaveCount)+time*waveSpeed))*waveHeight*windDirection.x*5.0)\n+ (cos(((p.z/finalWaveCount)+ time*waveSpeed))*waveHeight*windDirection.y*5.0);p.y+=abs(newY);\n#ifdef USE_WORLD_COORDINATES\ngl_Position=viewProjection*vec4(p,1.0);\n#else\ngl_Position=viewProjection*finalWorld*vec4(p,1.0);\n#endif\n#ifdef REFLECTION\nvRefractionMapTexCoord.x=0.5*(gl_Position.w+gl_Position.x);vRefractionMapTexCoord.y=0.5*(gl_Position.w+gl_Position.y);vRefractionMapTexCoord.z=gl_Position.w;worldPos=reflectionViewProjection*finalWorld*vec4(position,1.0);vReflectionMapTexCoord.x=0.5*(worldPos.w+worldPos.x);vReflectionMapTexCoord.y=0.5*(worldPos.w+worldPos.y);vReflectionMapTexCoord.z=worldPos.w;\n#endif\n#include<logDepthVertex>\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStore[kn]||(i.ShaderStore.ShadersStore[kn]=jn);var Zn={__proto__:null,waterVertexShader:{name:kn,shader:jn}},Yn="waterPixelShader",Kn="#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\nprecision highp float;uniform vec4 vEyePosition;uniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#include<helperFunctions>\n#include<imageProcessingDeclaration>\n#include<imageProcessingFunctions>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#ifdef BUMP\nvarying vec2 vNormalUV;\n#ifdef BUMPSUPERIMPOSE\nvarying vec2 vNormalUV2;\n#endif\nuniform sampler2D normalSampler;uniform vec2 vNormalInfos;\n#endif\nuniform sampler2D refractionSampler;uniform sampler2D reflectionSampler;const float LOG2=1.442695;uniform vec3 cameraPosition;uniform vec4 waterColor;uniform float colorBlendFactor;uniform vec4 waterColor2;uniform float colorBlendFactor2;uniform float bumpHeight;uniform float time;varying vec3 vRefractionMapTexCoord;varying vec3 vReflectionMapTexCoord;\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);vec4 baseColor=vec4(1.,1.,1.,1.);vec3 diffuseColor=vDiffuseColor.rgb;float alpha=vDiffuseColor.a;\n#ifdef BUMP\n#ifdef BUMPSUPERIMPOSE\nbaseColor=0.6*texture2D(normalSampler,vNormalUV)+0.4*texture2D(normalSampler,vec2(vNormalUV2.x,vNormalUV2.y));\n#else\nbaseColor=texture2D(normalSampler,vNormalUV);\n#endif\nvec3 bumpColor=baseColor.rgb;\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\nbaseColor.rgb*=vNormalInfos.y;\n#else\nvec3 bumpColor=vec3(1.0);\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nbaseColor.rgb*=vColor.rgb;\n#endif\n#ifdef NORMAL\nvec2 perturbation=bumpHeight*(baseColor.rg-0.5);\n#ifdef BUMPAFFECTSREFLECTION\nvec3 normalW=normalize(vNormalW+vec3(perturbation.x*8.0,0.0,perturbation.y*8.0));if (normalW.y<0.0) {normalW.y=-normalW.y;}\n#else\nvec3 normalW=normalize(vNormalW);\n#endif\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);vec2 perturbation=bumpHeight*(vec2(1.0,1.0)-0.5);\n#endif\n#ifdef FRESNELSEPARATE\n#ifdef REFLECTION\nvec2 projectedRefractionTexCoords=clamp(vRefractionMapTexCoord.xy/vRefractionMapTexCoord.z+perturbation*0.5,0.0,1.0);vec4 refractiveColor=texture2D(refractionSampler,projectedRefractionTexCoords);\n#ifdef IS_REFRACTION_LINEAR\nrefractiveColor.rgb=toGammaSpace(refractiveColor.rgb);\n#endif\nvec2 projectedReflectionTexCoords=vec2(\nvReflectionMapTexCoord.x/vReflectionMapTexCoord.z+perturbation.x*0.3,\nvReflectionMapTexCoord.y/vReflectionMapTexCoord.z+perturbation.y\n);vec4 reflectiveColor=texture2D(reflectionSampler,projectedReflectionTexCoords);\n#ifdef IS_REFLECTION_LINEAR\nreflectiveColor.rgb=toGammaSpace(reflectiveColor.rgb);\n#endif\nvec3 upVector=vec3(0.0,1.0,0.0);float fresnelTerm=clamp(abs(pow(dot(viewDirectionW,upVector),3.0)),0.05,0.65);float IfresnelTerm=1.0-fresnelTerm;refractiveColor=colorBlendFactor*waterColor+(1.0-colorBlendFactor)*refractiveColor;reflectiveColor=IfresnelTerm*colorBlendFactor2*waterColor+(1.0-colorBlendFactor2*IfresnelTerm)*reflectiveColor;vec4 combinedColor=refractiveColor*fresnelTerm+reflectiveColor*IfresnelTerm;baseColor=combinedColor;\n#endif\nvec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;float shadow=1.;float aggShadow=0.;float numLights=0.;\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;vec3 specularBase=vec3(0.,0.,0.);vec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\nvec3 finalDiffuse=clamp(baseColor.rgb,0.0,1.0);\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\n#else \n#ifdef REFLECTION\nvec2 projectedRefractionTexCoords=clamp(vRefractionMapTexCoord.xy/vRefractionMapTexCoord.z+perturbation,0.0,1.0);vec4 refractiveColor=texture2D(refractionSampler,projectedRefractionTexCoords);\n#ifdef IS_REFRACTION_LINEAR\nrefractiveColor.rgb=toGammaSpace(refractiveColor.rgb);\n#endif\nvec2 projectedReflectionTexCoords=vReflectionMapTexCoord.xy/vReflectionMapTexCoord.z+perturbation;vec4 reflectiveColor=texture2D(reflectionSampler,projectedReflectionTexCoords);\n#ifdef IS_REFLECTION_LINEAR\nreflectiveColor.rgb=toGammaSpace(reflectiveColor.rgb);\n#endif\nvec3 upVector=vec3(0.0,1.0,0.0);float fresnelTerm=max(dot(viewDirectionW,upVector),0.0);vec4 combinedColor=refractiveColor*fresnelTerm+reflectiveColor*(1.0-fresnelTerm);baseColor=colorBlendFactor*waterColor+(1.0-colorBlendFactor)*combinedColor;\n#endif\nvec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;float shadow=1.;float aggShadow=0.;float numLights=0.;\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;vec3 specularBase=vec3(0.,0.,0.);vec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\nvec3 finalDiffuse=clamp(baseColor.rgb,0.0,1.0);\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\n#endif\nvec4 color=vec4(finalDiffuse+finalSpecular,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\n#ifdef IMAGEPROCESSINGPOSTPROCESS\ncolor.rgb=toLinearSpace(color.rgb);\n#elif defined(IMAGEPROCESSING)\ncolor.rgb=toLinearSpace(color.rgb);color=applyImageProcessing(color);\n#endif\ngl_FragColor=color;\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStore[Yn]||(i.ShaderStore.ShadersStore[Yn]=Kn);var qn={__proto__:null,waterPixelShader:{name:Yn,shader:Kn}};e.CellMaterial=f,e.CustomMaterial=d,e.CustomShaderStructure=l,e.FireMaterial=h,e.FurMaterial=S,e.GradientMaterial=T,e.GridMaterial=C,e.LavaMaterial=P,e.MixMaterial=y,e.NormalMaterial=A,e.PBRCustomMaterial=m,e.ShaderAlbedoParts=c,e.ShaderAlebdoParts=v,e.ShaderSpecialParts=u,e.ShadowOnlyMaterial=D,e.SimpleMaterial=b,e.SkyMaterial=M,e.TerrainMaterial=V,e.TriPlanarMaterial=w,e.WaterMaterial=z});
|
|
2
2
|
//# sourceMappingURL=babylonjs.materials.min.js.map
|